amcharts / dataloader

Apache License 2.0
25 stars 25 forks source link

ZoomToindex and dataloader #18

Open arnaud-42 opened 7 years ago

arnaud-42 commented 7 years ago

I try to use Zoomtoindex for my charts. I use dataloader with some json data.

I want to do something like this : zoomToIndex(chart.daraLoader.length -90 , chart.daraLoader.length -1);

But it doesn't work ... how can I have the length of the json data loaded with dataloader ?

Thanks

martynasma commented 7 years ago

Hi there,

Sorry for not getting back earlier.

I suppose you could do that with chart's dataUpdated event:

"listeners": [{
  "event": "dataUpdated",
  "method": function(e) {
    e.chart.zoomToIndex(e.chart.dataProvider.length - 90, e.chart.dataProvider.length - 1);
  }
}]
jomayan commented 6 years ago

I tried the code above and it does not work.

martynasma commented 6 years ago

@jomayan Can you post your whole code?

siQuang commented 6 years ago

It doesn't work because there is no "es" in zoomToIndexes. Try this:

e.chart.zoomToIndexes(e.chart.dataProvider.length - 90, e.chart.dataProvider.length - 1);