2๐
I ended up changing the labels and data field to the following:
[{% for label in graph_labels %} {{ label }}, {% endfor %}]
[{% for value in graph_values %} {{ value }}, {% endfor %}]
Notice the comma in the for loop, without it the values will not be processed correctly.
0๐
{{ graph_labels }} and {{ graph_values }} are Django template variable and you are trying to access then inside javascript , this will not work. Use template tag "json_script" Django Documentation to pass data from django template to your javascript.
- Chartjs-Chart,js stepSize working for right hand Y axis but not left hand Y axis
- Chartjs-Chart.js 3.7 version. How to modify legend label?
Source:stackexchange.com