AmCharts,捕获时段选择器的点击事件 [英] AmCharts, capturing click event for period selector

查看:211
本文介绍了AmCharts,捕获时段选择器的点击事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用AmCharts 3,我想知道是否可以通过单击时段选择器的按钮来捕获事件?

I'm using AmCharts 3 and I was wondering is there a way to capture an event for clicking the buttons of the period selector?

文档状态,我可以向类型为'更改",但事件几乎随时都可以运行

The Docs state I can add a listener to the period selector of the type 'changed' but then the event runs almost anytime

有一个"zoomed"监听器,但是无论我是否单击时段选择器,它都会在我每次缩放图表时运行

There is a listener for 'zoomed', but it runs every time I zoom my chart regardless if I clicked the period selector

这是我的尝试:

chart = AmCharts.makeChart(scope.vm.chartId, chartSettings);
    AmCharts.addInitHandler(function () {
    // add events to item
    _.each(chart.panels, function (item) {
    //item.addListener("zoomed", onZoomed);
    item.addListener("changed", function(e) {
    console.debug("changed " + e.periodString);
   });
 });
});

推荐答案

由于您是通过配置对象初始化的,因此建议您使用最新版本的AmCharts支持的新"listeners"属性将事件处理程序添加到chartSettings对象上的periodSelector对象.应该可以.

Since you are initiating through a configuration object, I suggest you use the new 'listeners' property supported in the latest version of AmCharts to add an event handler to the periodSelector object on your chartSettings object. It should work.

这篇关于AmCharts,捕获时段选择器的点击事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆