0

In my site, I am using amcharts v3. I update data for every 10 seconds, and whenever update data and redraw charts, it reset zoom level, I want to maintain user zoom level. If anyone ha experience, please help me thanks.

BaiMaoli
  • 168
  • 2
  • 15

1 Answers1

2

You need to set zoomOutOnDataUpdate to false in your config to prevent the chart from zooming out on update.

AmCharts.makeChart("...", {
  // ...
  zoomOutOnDataUpdate: false,
  // ...
});
xorspark
  • 15,749
  • 2
  • 29
  • 38
  • I have one more question. How can i show the number of points that in zoomed range whenever data updated? – BaiMaoli Mar 19 '20 at 08:07
  • There's the [`dataUpdated`](https://www.amcharts.com/docs/v3/reference/amserialchart/#dataUpdated_event) event, which fires after you update your data (validateData). From there you can use the chart's [`startIndex`](https://www.amcharts.com/docs/v3/reference/amserialchart/#startIndex_property) and [`endIndex`](https://www.amcharts.com/docs/v3/reference/amserialchart/#endIndex_property) properties to get the axis/data indexes visible and work from there. – xorspark Mar 20 '20 at 01:14