javascript Highcharts : 带有向下钻取的图表如何获取向上钻取按钮的点击事件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24489480/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Highcharts : Chart with drilldown how to obtain click event of drill up button
提问by Rahul Gupta
I am using Highcharts wtih drilldown and here is my working FIDDLE.
我正在使用带有钻取功能的 Highcharts,这是我的工作FIDDLE。
How can I get the click event of the drill up button ?I have referred the Highcharts APIbut can't figure out how can I incorporate this into my code.
如何获得向上钻取按钮的点击事件?我已经提到了Highcharts API,但不知道如何将其合并到我的代码中。
I want to do something like:
我想做类似的事情:
drillUp: function(){
//get point details by using something like this or this.point
//get series details by using something like point.series
}
回答by wergeld
You need to catch the event
. See the chart.events.drillup
API doc.
To get the series and points in the series you would do something like:
你需要抓住event
. 请参阅chart.events.drillup
API 文档。要获得系列和系列中的积分,您可以执行以下操作:
events: {
drillup: function (e) {
console.log(this);
console.log(this.options.series[0].name);
console.log(this.options.series[0].data[0].name);
}
}
Since you did not state which series or points you wanted this is the most general method.
由于您没有说明您想要哪个系列或点,这是最通用的方法。
Link to the updated working FIDDLE
链接到更新的工作 FIDDLE
回答by Shahina
chart: {
type: 'column',
events: {
drillup: function (e) {
alert(e.seriesOptions.name);
}
}
}
From the below line,
从下面的行,
e.seriesOptions.name
e.seriesOptions.name
You will get the series name, which you are loading, by clicking that back button(drill up button).
单击后退按钮(向上钻取按钮),您将获得正在加载的系列名称。