0👍
You mean like this?
If you store your data outside the chart itself you can then access it from the ticks callback of a second x axis:
var data = [12, 19, 3, 5, 2, 3, 8];
var myChart = new Chart(ctx, {
type: 'line',
data: {
labels: ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT'],
datasets: [{
label: 'Tickets Sold',
data: data,
backgroundColor: gradient
}]
...
},
options: {
...
xAxes: [{
position: 'top',
ticks: {
callback: function(value, index, values) {
return data[index];
}
}
}, {
...
}],
...
},
});
Source:stackexchange.com