Here is my code:
var scatterChart = new Chart(document.getElementById('chartr'), {
type: 'scatter',
data: {
datasets: [{
data: data
}],
options: {
scales: {
xAxes: [{
type: 'time',
time: {
parser: 'YYYY-MMM',
unit: 'month',
displayFormats: {
'month': 'YYYY-MMM'
}
}
}]
}
}
}
});
But the chart doesn't work. Data is in form of {moment().format(YYYY-MMM), value}. Nothing that I tried works, apart from feeding chart UNIX data, but that way the chart looks ugly.
Here is the short data snippet:
2016-Apr: 0.6031746031746031
2016-May: 0.5079365079365079
2016-Oct: 0.4126984126984127
2017-Apr: 0.746031746031746
I can use moment.js, I that helps.