javascript amCharts 图表项点击事件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12668482/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-26 16:49:21  来源:igfitidea点击:

javascript amCharts graph item click event

javascriptjquery-mobileamcharts

提问by Vivek

In amChartsflash chart there is a event name clickGraphItem which work as click on graph item and after fetching this event we can do any action on graph item click.

amChartsflash 图表中,有一个事件名称 clickGraphItem,它用作点击图表项目,在获取此事件后,我们可以对图表项目点击执行任何操作。

I need the same functionality in javascript amCharts. So is it possible to implement clickGraphItem in javascript amCharts?

我需要javascript amCharts 中的相同功能。那么是否可以在 javascript amCharts 中实现 clickGraphItem 呢?

Please provide solution. Any source code would be appreciated.

请提供解决方案。任何源代码将不胜感激。

回答by zeroin

You can add event handlers to the AMCharts Javascript library in the following way

您可以通过以下方式向 AMCharts Javascript 库添加事件处理程序

// add click listener
chart.addListener("clickGraphItem", handleClick);

Here is jsFiddle for this:

这是用于此的 jsFiddle:

http://jsfiddle.net/amcharts2/cV8GG/

http://jsfiddle.net/amcharts2/cV8GG/