I am using ChartJs library in my application for my charts. At the moment I have a chart showing 31 days of the month but due to a lot of dates, the dates are showing like this:
but I actually need them like this :
Does anyone have any idea about changing the way they are shown, thus that the date is shown below the month or the opposite. Momentally my code looks like this:
const ctx = document.getElementById('myChart').getContext('2d');
const myChart = new Chart(ctx, {
type: 'bar',
data: {
labels: data.map(x => moment(x.date).format("MMM Do")),
datasets: [{
data: data.map(x => x.premium),
backgroundColor: '#ffec87',
borderColor: "#ffec87",
borderWidth: 2,
borderStyle: 'dotted'
}]
},
options: {
scales: {
xAxis: { grid: { display: false } },
yAxis: { grid: { borderDash: [3, 5] } }
}
}
});