Reputation: 33
In the amcharts serial chart you can select a specific area of values to display using this function:
chart.zoomToIndexes(chartData.length - x, chartData.length - 1)
This displays the last x values. However, this selected area can be changed by the user dragging the chart cursor. So if i would want to save the last indexes the chart was zoomed to before leaving the page / doing whatever, how can i get them?
The documentation does not seem to provide any helpful information here...
Upvotes: 1
Views: 3180
Reputation: 16012
You probably missed these in the documentation.
startIndex - gives you a read-only value of the current start zoom index.
endIndex - gives you a read-only value of the current end zoom index.
They are accessible through the chart instance. For example, here's how to access them during the zoomed event:
"listeners": [{
"event": "zoomed",
"method": function(e) {
console.log('Start zoom index: ', e.chart.startIndex, 'End zoom index: ', e.chart.endIndex);
}
}]
Upvotes: 2