Highcharts: How can I achiveve multiple rows on chart labels?

巧了我就是萌 提交于 2019-12-12 01:25:45

问题


How can I achieve something similar to this?


回答1:


You can simply add another xAxis, linked it to the first one and set appropriate tick interval. Check demo I posted you below.

Code:

Highcharts.stockChart('container', {
  xAxis: [{
    type: 'datetime',
    tickInterval: 3 * 3600 * 1000, // 3 hours
    labels: {
      formatter: function() {
        return Highcharts.dateFormat('%H:%M', this.value);
      }
    }
  }, {
    offset: 40,
    type: 'datetime',
    linkedTo: 0,
    tickInterval: 24 * 3600 * 1000 // one day
  }],
  series: [{
    data: data
  }]
});

Demo:
https://jsfiddle.net/ngp5o98u/

Api reference:
https://api.highcharts.com/highcharts/xAxis.linkedTo



来源:https://stackoverflow.com/questions/53823190/highcharts-how-can-i-achiveve-multiple-rows-on-chart-labels

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!