Xaxis数据按降序提供给highcharts但仍然是xaxis按升序显示

时间:2017-07-21 09:17:03

标签: javascript sorting highcharts time-series

我想在xaxis数据上使用降序排序时间序列。我已经按降序给出了我的数据,但仍然是高位图以递增的顺序绘制它 检查小提琴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]
    ]
}]

});

1 个答案:

答案 0 :(得分:2)

您可以通过添加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