0👍
I think something like: [{% for t in timeline %}t|date:"j b",{% endfor %}]
- Chartjs-Get data from SQLite as an array and generate charts with the data using Chart.js in an HTML
- Chartjs-How to make one datefilter for multiple charts on one webpage?
0👍
Solution
First encoding the data with json in the view:
json_timeline = json.dumps(timeline)
And the in the template script:
labels: {{timeline|safe}},
I get the information from the attached link: Pass a list of string from Django to Javascript
- Chartjs-How to create datasets for all labels for stacked bar in chart.js?
- Chartjs-ChartJS align bars to left instead of center
Source:stackexchange.com