AChartEngine Android – reset zoom and pan of graph? Code Answer

Hello Developer, Hope you guys are doing great. Today at Tutorial Guruji Official website, we are sharing the answer of AChartEngine Android – reset zoom and pan of graph? without wasting too much if your time.

The question is published on by Tutorial Guruji team.

I am building an Android Application and I am using AChartEngine to display a graph and values I obtain.

I am able to graph the values I have properly. However, once the user zooms in and pans around my graph, it becomes difficult to view the data. One option I considered is to display a “redraw graph” button where once the user clicks it, the graph would redraw itself to the original state, zoom and pan would also reset.

Here’s by code thus far:

public void redrawGraph(View view){

where redrawGraph is a the onClick function of my button and chartView is an object of type GraphicalView.

However, that does seem to do anything as it only repaints changes in my graph (if I added/removed series renderers, series, etc).

How can I reset the zoom and pan of graphs in AChartEngine?


My answer refers to XY/time charts. First you have to enable the external zoom feature in every renderer you use. The snippet below shows the code for accomplishing this:


In your method redrawGraph you then have to execute the command shown below:

public void redrawGraph(View view) {

This works great for me. If you need any further information leave a comment.

We are here to answer your question about AChartEngine Android – reset zoom and pan of graph? - If you find the proper solution, please don't forgot to share this with your team members.

Related Posts

Tutorial Guruji