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

查看:33
本文介绍了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 状态我可以向类型的周期选择器添加一个监听器 '改变了',但该事件几乎随时都在运行

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' 属性将事件处理程序添加到图表设置对象上的 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天全站免登陆