I have two functions like this:
function zoomChart() {
chart.zoomToIndexes(0, 20000);
}
function zoomAtStartToLast90() {
var dataLength = am_chartData.length;
chart.zoomToIndexes(dataLength - 90, dataLength - 1);
}
When I draw the chart at the beginning, I want to see last 90 records. So I need to call for zoomAtStartToLast90()
function, but when I make an update on chart I want to see all 20k records, so I will call for zoomChart()
.
inside AmCharts.ready(function () {
I call this: chart.addListener("dataUpdated", zoomChart);
But where can I call zoomAtStartToLast90()
function ? If I add it to addListener, chart is zoomed to last 90 records. Is it possible to call some function just after creeating chart ?
to trigger a function just after creating chat you can use init event..
REF: AMcharts Docs
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With