0👍
All you have to do is to add the custom tick callback.
You can go through this in the chartjs documentation. Here have a look: link.
The callback provides you the value of each label. You can edit it and return the edited value.
function renderChart(data, labels) {
var ctx = document.getElementById("myChart").getContext('2d');
var myChart = new Chart(ctx, {
type: 'scatter',
data: {
labels: labels,
datasets: [{
label: '48 Hours Pressure History HPa',
data: data,
borderColor: 'rgba(75, 192, 192, 1)',
backgroundColor: 'rgba(75, 192, 192, 0.2)',
},
]
},
options: {
scales: {
xAxes: [{
ticks: {
callback: function(value) {
return new Date(value).getDate() +"-"+ new Date(value).getMonth() + "-"+new Date(value).getFullYear();
}
}
}]
}
}
});
}
Source:stackexchange.com