2016-09-20 65 views
0

我正在尋找將plotbands/zones添加到我的高圖。我指的是標記點下面的深黃色帶。Limit plot bank upto marker line

enter image description here

我已經看到了如何繪製plotBands但沒有似乎給了限制的選項plotBand高度的幾個例子。

http://jsfiddle.net/gh/get/jquery/1.7.2/highslide-software/highcharts.com/tree/master/samples/highcharts/members/axis-addplotband/

chart.xAxis[0].addPlotBand({ 
       from: 5.5, 
       to: 7.5, 
       color: '#FCFFC5', 
       id: 'plot-band-1' 
      }); 

任何線索將不勝感激。

+1

不,'plotBands'不能以這種方式進行限制。如果你可以更具體一些,有各種潛在的解決方法 - 我不清楚你的圖像的哪一部分是爲了表示一個情節帶。 – jlbriggs

+1

我認爲你可以在圖表的情況下使用區域:http://jsfiddle.net/jgyxcbxo/這是你的問題的答案,我將它作爲答案發布 –

+0

@jlbriggs我已更新問題 – runtimeZero

回答

0

你應該能夠使用面積系列類型和您的負載增加斷裂線(重繪)事件的回調函數,使用chart.renderer.path:

var breakLines = function(chart) { 
    var xAxis = chart.xAxis[0], 
     yAxis = chart.yAxis[0]; 
    $('.breakLines').remove(); 
    Highcharts.each(chart.series[0].data, function(p) { 
     chart.renderer.path([ 
     'M', 
     xAxis.toPixels(p.x), 
     yAxis.toPixels(0), 
     'L', 
     xAxis.toPixels(p.x), 
     yAxis.toPixels(p.y) 
     ]).attr({ 
     'stroke-width': 1, 
     stroke: 'white', 
     zIndex: 3 
     }).addClass('breakLines').add() 
    }); 
    } 

在這裏你可以看到一個例子如何可以工作:http://jsfiddle.net/jgyxcbxo/1/