bah*_*Agi 2 highcharts highstock
我想知道如何确定在highstock中选择了哪个rangeSelector按钮.
我的rangeSelector按钮:
buttons: [{
type: 'month',
count: 1,
text: '1 MONTH',
}, {
type: 'month',
count: 3,
text: '3 MONTH'
}, {
type: 'month',
count: 6,
text: '6 MONTH'
}, {
type: 'ytd',
text: 'YTD'
}, {
type: 'year',
count: 1,
text: '1 YEAR'
}, {
type: 'all',
text: 'ALL'
}],
Run Code Online (Sandbox Code Playgroud)
例如,我点击我的第一个rangeSelector,即1个月.我想知道这个按钮是否被选中.
有什么事吗?
谢谢
您可以捕获setExtremes()(http://api.highcharts.com/highstock#xAxis.events.setExtremes),然后在事件obejct中,您可以访问具有count,text和type属性的event.rangeSelectorButton对象.
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);
}
}
}
},
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5854 次 |
| 最近记录: |