2014-09-22 48 views
0

我在平均線上創建了BBox。我有下面的代碼Highchart更新BBox放大位置

$('#container').highcharts({ 
       chart: { 
         zoomType: 'x', 
         }, 
       . 
       . 
       . 
       . 
      }, function(chart){ 
       if(chart.series[0].data[1]) 
       { 
        var point = chart.series[0].data[1], 
         text = chart.renderer.text(
          'Average='+Math.ceil(point.y)+" s", 
          point.plotX + chart.plotLeft - 45, 
          point.plotY + chart.plotTop - 13 
         ).attr({ 
          zIndex: 5 
         }).add(), 
         box = text.getBBox(); 
        chart.renderer.rect(box.x - 5, box.y - 5, box.width + 10, box.height + 10, 5) 
         .attr({ 
          fill: '#FFFFEF', 
          stroke: 'gray', 
          'stroke-width': 1, 
          zIndex: 4 
         }) 
         .add(); 
       } 

      }); 

箱已創建 我想根據平均線來改變BBOX位置創建的BBOX當角色變焦性能。 我該如何做到這一點..預先提前

回答

0

您需要在事件中使用您的代碼在highcahrts。注意destroy(舊渲染對象)並創建新的或翻譯它。

例如: http://jsfiddle.net/be2ebcg2/1/