Chartjs-ChartJS + jQuery = Chart not showing

0๐Ÿ‘

Youโ€™re probably not able to get a hold of ctx.

Inspect with the console like this:

var ctx = document.getElementById("currenciesTag").getContext("2d");
console.log(ctx);

Check your html and make sure you have, for example:

<body>
  <canvas id="currenciesTag" width="600" height="400"></canvas>
</body>

You can see your code working here:

https://jsfiddle.net/zwjj20L5/

0๐Ÿ‘

I had same problem and it takes 4.5 hours to solve it god damn nevermind if you have

window.onload = function() { }

outside of your

var ctx = document.getElementById('canvas').getContext('2d'); 

code just delete it after that you can use it in any function like $(function() { }); or button click. Have a nice day ๐Ÿ™‚

Leave a comment