Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 224
Syed Uzair Uddin Avatar asked Oct 26 '16 13:10

Syed Uzair Uddin


1 Answers

options: {
responsive: true, 
maintainAspectRatio: false
}

It works perfectly with these options.

like image 122
Syed Uzair Uddin Avatar answered Oct 10 '22 13:10

Syed Uzair Uddin