2013-12-19 84 views

回答

0

這些按鈕可以從chart對象訪問爲.rangeSelector.buttons。所以像這樣的東西會創建一個額外的點擊處理器:

var thoseButts = Highcharts.charts[0].rangeSelector.buttons; 
for (var i = 0; i < thoseButts.length; i++){ 
    $(thoseButts[i].element).click({idx: i},function(event){ 
     alert('Index: ' + event.data.idx); 
    }); 
} 

小提琴here

0

替代溶液

xAxis: { 
    events: { 
     setExtremes: function(e) { 
      console.log(this); 
      if(typeof(e.rangeSelectorButton)!== 'undefined') 
      { 
       alert('count: '+e.rangeSelectorButton.count + 'text: ' +e.rangeSelectorButton.text + ' type:' + e.rangeSelectorButton.type); 
      } 
     } 
    } 
}, 

http://jsfiddle.net/E6GHC/1/