amcharts / amcharts3

JavaScript Charts V3
Other
395 stars 129 forks source link

Problem firing events #231

Open RaulPampliegaMayoral opened 5 years ago

RaulPampliegaMayoral commented 5 years ago

Hi, we are evaluating purchase the library. First we used v4 but due to some performance problem over iexplorer we are now using v3.

With v4 we had no problems with "ready" events, but with v3 the event is fired when makeChart is called. This also happens with "init" event.

For example, this is not firing never:

AmChart chart = AmCharts.makeChart(div, conf); chart.addListener("rendered", () -> { AmCharts.makeChart(div2, conf2); });

We are using amcharts over GWT.

Do you have any ideas?

Thanks in advance

martynasma commented 5 years ago

I suspect that adding "rendered" event after makeChart() call might happen after it has been fired.

How about adding it into config?

{
  // ...
  "listeners": {
    "event": "rendered",
    "method": function(ev) {
      // ...
    }
  }
}
RaulPampliegaMayoral commented 5 years ago

Hi again Martynas!

Thanks for your response. I will try it and think it will work.

I was based on the stackoverflow answer https://stackoverflow.com/questions/44491378/multiple-charts-latency-issue-svg-or-html5-canvas

zur4ik commented 4 years ago

Had the same problem. Adding listeners into the config, as @martynasma suggested, solved the problem.