Hey there, I'm currently working on displaying some data using chart.js in angularjs. However, I seem to be facing an issue with the ordering of my data which is resulting in a strange looking chart like this:
https://i.stack.imgur.com/F6phH.png
Here are the options I'm using:
vm.options = {
type:'line',
fill: false,
backgroundColor: 'transparent',
scales: {
xAxes: [{
type: 'time',
position: 'bottom'
}]
}
};
I attempted to organize the dates of my data by sorting it like so:
vm.data.sort(function(a,b){
// Turn your strings into dates, and then subtract them
// to get a value that is either negative, positive, or zero.
return new Date(b.time) - new Date(a.time);
});
However, despite this effort, I still end up with the odd chart as shown in the image above. Could someone possibly assist me in identifying where the problem lies?