I have an array of objects that have an x and y property. How do I get the correct property values to be used in the correct places in a chart.js chart?
I have the following .js code so far
var lineChartData = {
labels: progress.y,
datasets: [{
label: 'My First dataset',
borderColor: window.chartColors.red,
backgroundColor: window.chartColors.red,
fill: false,
data: progress,
yAxisID: 'y-axis-1'
}]
};
The array object is called progress. I think the data: progress is picking up the x property value automatically, but the labels: progress.y isn't.
Any ideas how I get the y axis label to work?
EDIT: The progress object looks like this when I view the page source
var progress = [{"y":1624,"x":0},{"y":1606,"x":1}, etc
progressobject? Is it showing the dataset?