Home forums Using CanvasJS Bar chart auto adjust width height

This topic contains 1 reply, has 2 voices, and was last updated by  Priyanka M S 5 days, 6 hours ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #23031

    Sravya
    Member

    I have plotted a bar chart. It will have different data based on input.the data size might be 1 or 2 or anything.I want a bar chart to be re-adjusted in terms of width and height dynamically based on data size.can someone help me in this ?

    #23034

    Priyanka M S
    Member

    @sravya,

    By default, Chart takes the size of its container(if set). So you can just set the width and height of the chart-container in which you are rendering the chart as shown below:
    <div id="chartContainer" style="height: 300px; width: 100%;">

    If you like to change the height of the chart keeping the dataPointWidth as constant, please take a look at this JSFiddle.

    __
    Priyanka M S
    Team CanvasJS

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.