const myChartCompare = new Chart(ctxCompare, {
type: 'line',
data: {
labels: [new Date("2015-3-15").toLocaleString(), new Date("2015-3-25").toLocaleString(), new Date("2015-4-25").toLocaleString()],
datasets: [
{label: 'One',
data: [{
t: new Date("2010-3-15"),
y: 12
},
{
t: new Date("2015-3-25"),
y: 21
},
{
t: new Date("2020-4-25"),
y: 32
}
],
borderColor: "#464646",
backgroundColor: 'transparent',
borderWidth: 2
},
{label: 'Two',
data: [{
t: new Date("2008-3-15"),
y: 12
},
{
t: new Date("2009-3-25"),
y: 21
},
{
t: new Date("2010-4-25"),
y: 1
}
],
borderColor: "#939393",
backgroundColor: 'transparent',
borderWidth: 2
}
]
},
options: {
scales: {
xAxes: [{
ticks: {
callback: function(value, index, values) {
return value + 'г';
}
},
type: 'time',
time: {
unit: 'year'
}
}],
yAxes: [{
ticks: {
callback: function(value, index, values) {
return value + '%';
}
},
}]
}
}
});