2013-07-14 2 views
2

차트의 클릭 이벤트에 선을 그릴 수 있습니까?차트 클릭 이벤트에서 하이 차트에 줄을 그리는 방법은 무엇입니까?

Chart Click Event

chart: { 
     events: { 
      click: function(event) { 
       alert ('x: '+ event.xAxis[0].value +', y: '+ 
         event.chartY); 
       var chart = event.xAxis[0]; 
          chart.removePlotLine('plot-line-1'); 
          chart.addPlotLine({ 
           value: event.chartX, 
           color: '#FF0000', 
           width: 2, 
           id: 'plot-line-1' 
          }); 
      } 
     }   
    }, 

나는 처음 highcharts의 plotoptions 클릭 이벤트에서 같은 일을했다. 이제 차트 클릭 이벤트를 사용하여 동일한 작업을 수행합니까? 시리즈 xaxis 객체를 가져올 수 없습니다.

답변

6

Worked!

Working LINK

chart: { 
     events: { 
      click: function (event) { 
       var chart = this.xAxis[0]; 
       chart.removePlotLine('plot-line-1'); 
       chart.addPlotLine({ 
        value: event.xAxis[0].value, 
        color: '#FF0000', 
        width: 2, 
        id: 'plot-line-1' 
       }); 
      } 
     } 
:-) ... highcharts 문서를 읽을 수 있었다
관련 문제