Chartjs-Pie chart doesn't appear with Chart.js

0๐Ÿ‘

The reason its not working is because of this line

Document let ctx = document.getElementById('myChart').getContext('2d'); let labels = ['Pizza ๐Ÿ•', 'Taco ๐ŸŒฎ', 'Hot Dog ๐ŸŒญ', 'Sushi ๐Ÿฃ']; let colorHex = ['#FB3640', '#EFCA08', '#43AA8B', '#253D5B'];

You say Document let ctx = ... but thats invalid JS, you will need to remove the Document keyword so you will get the following:

let ctx = document.getElementById('myChart').getContext('2d'); let labels = ['Pizza ๐Ÿ•', 'Taco ๐ŸŒฎ', 'Hot Dog ๐ŸŒญ', 'Sushi ๐Ÿฃ']; let colorHex = ['#FB3640', '#EFCA08', '#43AA8B', '#253D5B'];

If you do that it will work fine

Leave a comment