Chart.js
I can't get this stupid chart to stay in its container when padding
has been applied to the container. It doesn't matter if the responsive
option is set to true
.
It also doesn't matter what I set box-sizing
to. What's the purpose of the responsive
option if not to fit it's container?
As with most CSS, the answer is to use another wrapper!
I had the same problem (and I'm using box sizing)
Just put one div around your canvas! (the divs will inherit the box sizing)
<div>
<canvas></canvas>
</div>
Good luck
:)
This will solve the issue
Javascript:
new Chart(ctx).Line(data, {
responsive:true,
maintainAspectRatio: false
});
ES6
Chart.defaults.global.responsive = true;
Chart.defaults.global.maintainAspectRatio = false;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With