0👍
The quotation marks within the label declaration are escaped, hence the error message with the ‘&’.
To pass data to JavaScript within jinja I recommend the filter tojson
.
<script>
const data = {
labels: {{ labels | tojson }},
datasets: [{
label: 'My First Dataset',
data: {{ data | tojson }},
}],
};
const config = {
type: 'line',
data: data,
options: {
// ...
}
};
const myChart = new Chart(
document.getElementById('myChart'),
config
);
</script>
- Chartjs-Add Modal Popup for each chart.js data value
- Chartjs-How to group and count missing values using linq
Source:stackexchange.com