I wish to pass values of an array to the data and label fields of the chart.js dataset.
Here the code from success of ajax call made to fetch json data. I fetch the
LabelResult is an array, change
labels: [LabelResult]
to
labels: LabelResult
Also:
data: [DataResult]
data: DataResult
Like:
var myChart = new Chart(ctx, { type: 'bar', data: { labels: LabelResult, datasets: [{ label: '# of Votes', data: DataResult, borderWidth: 1 }] } });