1

当我在 xaxis 上的两个点之间使用 plotbands 并使用 pointLines 在这两个点之间画一条线时,它永远不会出现但是如果你在 yAxis 上做同样的事情,一切都很好,这是我的代码

  $(function () {
    var chart = new Highcharts.Chart({
    chart: {
        renderTo: 'container'
    },
    xAxis: {        
        plotBands: [{ // mark the weekend
            color: 'rgba(68, 170, 213, 0.2)',
            from: Date.UTC(2010, 0, 2),
            to: Date.UTC(2010, 0, 4)
        }],
        plotLines:[{
         value: Date.UTC(2010, 0, 3),
                  color: 'green',
                  dashStyle: 'shortdash',
                  width: 2,
        }],
        plotLines:[{
         value: Date.UTC(2010, 0, 6),
                  color: 'green',
                  dashStyle: 'shortdash',
                  width: 2,
        }],
        tickInterval: 24 * 3600 * 1000, // one day
        type: 'datetime'
    },
    yAxis:{
        plotLines:[{
            value : 200,
            color: 'green',
                  dashStyle: 'shortdash',
                  width: 2,
        }] ,
         plotBands: [{ // mark the weekend
            color: 'rgba(68, 170, 213, 0.2)',
            from: 150,
            to: 250,
        }],  
    },

    series: [{
        data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4 , 255.7],
        pointStart: Date.UTC(2010, 0, 1),
        pointInterval: 24 * 3600 * 1000
       }]
   });
 });​

我也 jsFiddle 它http://jsfiddle.net/MsCqR/3/

4

2 回答 2

1

我认为你的问题是,如果你想设置 2 plotLines 你必须通过一个数组传递它们,就像下面的代码:

plotLines:[{
    value: Date.UTC(2010, 0, 3),
    color: 'green',
    dashStyle: 'shortdash',
    width: 2,
}, {
   value: Date.UTC(2010, 0, 6),
   color: 'green',
   dashStyle: 'shortdash',
   width: 2,
}]

如何添加超过 1 条绘图线LINK1
如何编辑 plotLines 的 zindexLINK2

于 2012-05-02T19:50:57.913 回答
0

使用 zIndex 绘制线或 plotbands 位置...

            plotLines: [{
                width: 3,
                color: "#808080"
            },{
                value: "200",
                width: 4,
                color: "#FF0000",
        zIndex: 4}],
于 2013-09-24T14:20:00.577 回答