由于某种原因,图表的xAxes从最新数据到最早的日期。我显然希望以其他方式/以正常方式进行处理。如何还原xAxes? ..或只是xAxes可以正常显示日期。
我的图表在这里:https://www.betscout.com/tips(单击统计标签) 我已经尝试过此选项:https://jsfiddle.net/marineboudeau/4awme3fp/3-但它不起作用,甚至在所提供的示例中也不起作用(当我将reverse:true替换为reverse:false时,没有任何改变。)
我可以轻松地通过这种方式反转yAxes,为什么不使用xAxes?
这是我的一些JS代码:
let chart = document.getElementById('chart');
let myLineChart = new Chart(chart, {
type: 'line',
data: {
labels: grades,
datasets: [{
data: numbers,
label: 'Total profit',
fill: false,
borderColor: '#3771a3'
}]
},
options: {
scales: {
yAxes: [{
gridLines: {
display: true,
color: "rgba(55, 113, 163, 0.18)"
},
ticks: {
beginAtZero: true,
}
}],
xAxes: [{
gridLines: {
display: true,
color: "rgba(55, 113, 163, 0.18)"
},
ticks: {
display: true,
reverse: true,
fontSize: 12
}
}]
}
}
});
}