Menu

Handle zoom support

This section provides information on handling zoom in and zoom out APIs inside a graph view.

Perform the following steps to add zoom API support for a graph view.

1. Enable the following flag using the XYMultipleSeriesRenderer instance to activate zoom functionality.

<rendererInstance>.setExternalZoomEnabled(true);

2. Set the zoom rate using the XYMultipleSeriesRenderer instance. Zoom rate is a factor which can be applied to width and height of the graph to get rescaled view after every zoom in and zoom out action.

<rendererInstance>. setZoomRate(1.05f)

3. Create a graphical view and add the zoom in listener to the view

private OnClickListener ZoomInListener = new OnClickListener() {
 @Override
 public void onClick(View v) {
  if (v != null)
   v.zoomIn();
 }
};

4. Add the zoom out listener to the graph view.

private OnClickListener ZoomOutListener = new OnClickListener() {
 @Override
 public void onClick(View v) {
  if (v != null)
   v.zoomOut();
 }
};