plotBands使plotLines消失为高图

时间:2012-05-02 19:37:02

标签: javascript jquery highcharts highstock

当我在xaxis上使用两点之间的绘图带并使用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 it http://jsfiddle.net/MsCqR/3/

2 个答案:

答案 0 :(得分: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的zindex LINK2

答案 1 :(得分:0)

使用z索引绘制线条或绘图带位置......

            plotLines: [{
                width: 3,
                color: "#808080"
            },{
                value: "200",
                width: 4,
                color: "#FF0000",
        zIndex: 4}],