Chartjs-How do I resolve this error; 'document.getElementById('myChart').getContext' is undefined)?

0👍

Only a canvas can have a context. Please change

<div class="container">
    <div id='myChart'></div>
</div>

for

<div class="container">
    <canvas id='myChart'></canvas> <!-- this line -->
</div>

Leave a comment