0π
β
To change the behavior of the x axis, I had to use the scales
option. As follows:
<Line
options={{
responsive: true,
plugins: {
legend: {
position: 'top' as const
}
},
scales: {
x: {
ticks: {
callback: (value, index) => historicDate[index].split(',')
}
}
}
}}
data={{
labels: historicDate,
datasets: [
{
label: 'Temperatura',
data: historicTemperature,
borderColor: 'rgb(255, 99, 132)',
backgroundColor: 'rgba(255, 99, 132, 0.5)'
}
]
}}
/>
Source:stackexchange.com