0👍
✅
var ctx = document.getElementById('myChart').getContext('2d');
var chart = new Chart(ctx, {
type: 'line',
// The data for our dataset
data: {
datasets: [{
label: "My First dataset",
backgroundColor: 'rgb(255, 99, 132)',
borderColor: 'rgb(255, 99, 132)',
// data : [10,20]
data: [{x: new Date(), y:15},{x: moment().add(10,'days'), y:50},
{x : moment().add(15,'days'), y:20}],
}]
},
// Configuration options go here
options: {
scales: {
xAxes: [{
type: 'time',
time: {
// unit: 'month',
displayFormats: {
quarter: 'MMM YYYY'
}
}
}]
}
}
});
Source:stackexchange.com