0👍
Have you tried using the maintainAspectRatio
property and setting it to true
? That should hopefully fix your window resize issue.
The only way to fix the legend issue is to use a legend that is external to the canvas
because the legend takes up space in the canvas
so the chart is squished horizontally (there is no layering concept in a canvas
). See this example for how to generate an external legend.
You must use the legendCallback
property and the .generateLegend()
prototype method.
- Chartjs-How to sum array value in chart.js inside loop function?
- Chartjs-Chart.js How to sum the values in a pie chart and display them in the header
Source:stackexchange.com