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
- Chartjs-Is it possible to get chart js data using ajax?
- Chartjs-Chart.js scatter chart stops working after extending to multiple datasets
Source:stackexchange.com