2016-02-11 54 views
1

当我将鼠标移到HighChart图表上时,需要突出显示(整个)当前列带区。我有如下(的jsfiddle here,从基本的演示图的适应)获得该使用动态情节的乐队:Highcharts中的动态绘图带

$(function() { 
    $('#container').highcharts({ 
     chart: { 
      type: 'column' 
     }, 
     xAxis: { 
      plotBands: [{from:1,to:1}], 
     }, 
     plotOptions:{ 
     series: { 
      point: { 
      events: { 
       mouseOver: function() {moveBand(this.index);} 
      } 
      } 
     } 
     }, 
     series: [{ 
      data: [49.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4] 

     }] 
    }); 

function moveBand(a) { 
var chart = $('#container').highcharts(); 
chart.xAxis[0].update({plotBands:[{color: '#f0c0c0',from:a-0.5,to:a+0.5}]}); 
}  
}); 

由于该解决方案是我真正的图表(其中包含几十点和几个有点慢系列)我问,如果这是满足我的需求的最佳方式,或者有更好的解决方案。

+0

如何使用类似十字线? http://www.highcharts.com/demo/column-basic –

+0

我错过了!请将您的评论作为答案,以便我可以对其进行投票。 – tic

+0

谢谢,我补充说。 –

回答