Pratik
Pratik

Reputation: 755

Amcharts: Is there a way to control zoom level of the chart by custom buttons?

I am using serialChart provided by amCharts.

It is possible to have chartScrollBar to control the zoom level of the chart but is it possible to have custom zoom-in and zoom-out buttons that control the same functionality?

Upvotes: 2

Views: 1744

Answers (1)

xorspark
xorspark

Reputation: 16012

It's possible to control the zoom through external buttons, but you're limited to the serial chart's zoom API methods. For a date-based chart, you can use zoomToIndexes, and zoomToDates, whereas a non-date based categoryAxis supports zoomToIndexes and zoomToCategoryValues. To zoom completely out, you can use the zoomOut method.

Here's a demo that has external form elements and buttons that call each of the zoom methods for a date-based chart.

Upvotes: 3

Related Questions