Chartjs-Chartjs does not render chart when set responsive option to true

1đź‘Ť

âś…

When the responsive option is set the width of the canvas is driven by the width of its parent. So make sure that the parent has a non-0 clientWidth. For example if the parent is floated and positioned relatively with the child canvas absolutely positioned, it’s width collapses to 0 causing the canvas to have no size. There could be other ways this could happen, but to fix your problem you just need to ensure that the parent has a width (could be % too) of it’s own.

Leave a comment