Linechart Highchart中的背景列

时间:2019-03-27 17:21:05

标签: javascript node.js highcharts

我必须做一个这样的图

image

已经创建了带有其图例和轴标签的折线图。仅缺少列。 我不知道该怎么做,你能帮我吗?

1 个答案:

答案 0 :(得分:0)

我在xAxis上使用plotBands创建类似的东西。将其与您的项目混合应该会返回想要的结果。

xAxis: {
    plotBands: [{
            borderColor: 'grey',
        borderWidth: 3,
        color: '#FCFFC5',
        from: Date.UTC(2019, 02, 2),
        to: Date.UTC(2019, 02, 4)
    }, { // mark the weekend
        color: '#FCFFC5',
        from: Date.UTC(2019, 02, 9),
        to: Date.UTC(2019, 02, 11)
    }, { // mark the weekend
        color: '#FCFFC5',
        from: Date.UTC(2019, 02, 16),
        to: Date.UTC(2019, 02, 18)
    }, { // mark the weekend
        color: '#FCFFC5',
        from: Date.UTC(2019, 02, 23),
        to: Date.UTC(2019, 02, 25)
    }, { // mark the weekend
        color: '#FCFFC5',
        from: Date.UTC(2019, 02, 30),
        to: Date.UTC(2019, 03, 1)
    }],
    tickInterval: 24 * 3600 * 1000, // one day
    type: 'datetime',
},

Link to demo