How to set a fixed height, the default height is 50% of the width。
I you want height fixed at 350px, modify the <canvas>
that hosts the chart with a height attribute:
<canvas height="350px"></canvas>
Then when you set the chart options, make it non-responsive so it won't auto-resize:
var options = {
responsive:false
}
@RoxKilly is correct
To get a fixed height and variable width…
width
or height
on the canvas
element.height
on parent html container.maintainAspectRatio: false,
Here is a demo:
https://codepen.io/beau/pen/rvJRzb/
Most helpful comment
To get a fixed height and variable width…
width
orheight
on thecanvas
element.height
on parent html container.maintainAspectRatio: false,
Here is a demo:
https://codepen.io/beau/pen/rvJRzb/