Not specifying a width
or height
should allow relying on responsive and aspectRatio to be respected.
The defaults of 400
for height
and width
means that aspectRatio
has no effect when set via options, it is always 400 / 400 = 1
. Manually setting width
and height
to null
fixes the issue.
Hi @jacobmischka
thanks for the issue and the PR. I am super sorry for the late reply. However, I kind of missed this issue.
I will need some time to test the changes. I think chart.js (recently) changed some of their defaults and improved the responsive behaviour of the charts.
As far as I remember, you literally had to define the width and height of the canvas to be rendered properly.
That is the reason why the defaults are set, so people could use it "out of the box".
I will check how it will behave without the defaults set. And more importantly how the regression is. Because, I guess removing the defaults, will end up in a lot of breaking charts.
Setting the height and width props to null
did the trick. Hope to see this fix for this merged soon.
This should be mentioned atleast on the documentation, I spent hours and hours trying to get aspect ratio to work, setting width and height to null did fix the issue. BTW, @apertureless and everyone who worked on this project, great work I appreciate your work, thanks.
Most helpful comment
Setting the height and width props to
null
did the trick. Hope to see this fix for this merged soon.