x轴上的绘图带无法按时工作

时间:2019-01-08 11:54:10

标签: javascript highcharts

我已经根据时间在x轴上使用了图带高图表。我已经给出了from: Date.UTC(2018, 11, 20)to: Date.UTC(2018, 11, 23),,但没有显示出图带。我尝试了一些不同的格式,但这些也不起作用。

https://jsfiddle.net/v1oazypd/4/

谢谢。

1 个答案:

答案 0 :(得分:1)

您使用的类别类型为xAxis,因此对于绘图带API必须使用number

plotBands: [{
  from: 7,
  to: 9,
  color: 'rgba(68, 170, 213, .2)'
}]

Fiddle - category

OR

忘记类别,并像这样真正使用dateTime:

xAxis: {
  tickInterval: 24 * 3600 * 1000,
  type: 'datetime',
  plotBands: [{
    from: Date.UTC(2018, 11, 8),
    to: Date.UTC(2018, 11, 10),
    color: 'rgba(68, 170, 213, .2)'
  }]
},
...
series: [{
    pointStart: Date.UTC(2018, 11, 1),
    pointInterval: 24 * 3600 * 1000,
    name: 'test.html',
    marker: {
      symbol: 'circle' //No I18N
    },
    color: '#63cdca', //No I18N
    data: [
      0, 0, 0, 0, 0, 0, 0, 4, 104, 0, 0, 0, 0,
    ],
  }
]

Fiddle - Datetime