Chartjs-Chart.js not rendering unless i set a timeout

0๐Ÿ‘

โœ…

i solved it adding encapsulating the canvar into a div, so the canva resizes with my page, i changed:

from:

ctx.htmlItem.html('<canvas id="myChart2" height="400" width="800" style="width:800px;height:400px;"></canvas>'); 

to

ctx.htmlItem.html('<div><canvas id="myChart2" height="400" width="800" style="width:800px;height:400px;"></canvas></div>'); 

a now it works

Leave a comment