which rangeSelector button is selected in highcharts

前端 未结 2 2072
面向向阳花
面向向阳花 2020-12-11 11:54

I want to know how to determine which rangeSelector button is selected in highstock.

my rangeSelector buttons:

   buttons: [{
            type: \'mon         


        
2条回答
  •  星月不相逢
    2020-12-11 12:16

    You can catch setExtremes() (http://api.highcharts.com/highstock#xAxis.events.setExtremes), and then in event obejct you have access to event.rangeSelectorButton object with count, text and type property.

     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/

提交回复
热议问题