
Maintain the original canvas aspect ratio (width / height) when resizing.Ĭanvas aspect ratio (i.e. Resizes the chart canvas when its container does ( important note.). Chart.js needs a dedicated container for each canvas and this styling should be applied there.Ĭhart.js provides a few options to enable responsiveness and control the resize behavior of charts by detecting when the canvas display size changes and update the render size accordingly. : invalid behavior, the canvas continually shrinks.: invalid behavior, the canvas is resized but becomes blurry ( example (opens new window)).: invalid values, the canvas doesn't resize ( example (opens new window)).Furthermore, these sizes are independent from each other and thus the canvas render size does not adjust automatically based on the display size, making the rendering inaccurate.

height) can not be expressed with relative values, contrary to the display size ( and. When it comes to changing the chart size based on the window size, a major limitation is that the canvas render size ( canvas.width and.
