gpt4 book ai didi

javascript - Xaxis 数据按降序提供给 highcharts 但 xaxis 仍然按升序出现

转载 作者:行者123 更新时间:2023-11-30 15:10:03 26 4
gpt4 key购买 nike

我想绘制按 x 轴数据降序排序的时间序列。我已经按降序给出了我的数据,但 highcharts 仍然按升序绘制它检查 fiddle http://jsfiddle.net/r4rex6oz/

Highcharts.chart('container', {
xAxis: {
type: 'datetime'
},
series: [{
data: [
[Date.UTC(2010, 0, 8), 176.0],
[Date.UTC(2010, 0, 7), 144.0],
[Date.UTC(2010, 0, 6), 129.2],
[Date.UTC(2010, 0, 3), 106.4],
[Date.UTC(2010, 0, 2), 71.5],
[Date.UTC(2010, 0, 1), 29.9]
]
}]

});

最佳答案

您可以通过添加 reversed: true 来反转。

Highcharts.chart('container', {
xAxis: {
type: 'datetime',
reversed: true
},
series: [{
data: [
[Date.UTC(2010, 0, 8), 176.0],
[Date.UTC(2010, 0, 7), 144.0],
[Date.UTC(2010, 0, 6), 129.2],
[Date.UTC(2010, 0, 3), 106.4],
[Date.UTC(2010, 0, 2), 71.5],
[Date.UTC(2010, 0, 1), 29.9]
]
}]
});

查看更多选项 here .

关于javascript - Xaxis 数据按降序提供给 highcharts 但 xaxis 仍然按升序出现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45233807/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com