Search code examples
html5-canvaschart.js

Canvas static height Chartjs


I am using chart.js 2.3.0 to draw graph. I want to make the height of the graph static(fixed e.g. 200px) but also want to set the width to 100%. One solution I have seen is to do:

responsive: false

in the graph options. But after doing this, width also reduces. Is there any best way to do it?

static height and 100% width.


Solution

  • options: {
      responsive: true, 
      maintainAspectRatio: false
    }
    

    It works perfectly with these options.