Chartjs-Failed to create chart

0๐Ÿ‘

i thin problem in getting ID

<canvas id="myChart"></canvas>

 var ctx = document.getElementById("myChart");
 var myChart = new Chart(ctx,{
    type: 'pie',
    data: data,
    options: options
})

0๐Ÿ‘

You need to make sure that your chart is created before the view is rendered. And to do that, see this

https://stackoverflow.com/a/53166341/3504273

Leave a comment