Complicated graphs can sometimes offer too much data to fit on one screen. One option to make this manageable is to offer a zoom function, so users can zoom in on the data they would like to investigate closely.
When zoomed in, you also want to enable the user to move the graph so he can investigate different areas of the graph. This is called panning.
We will once again build on the code used in the previous chapters. If you skipped any of the recipes, you can download the code files and start from there.
To start from scratch, create a new workspace and copy the Graph
and PointGraph
classes from the previous chapters into your source folder (you can find them in the provided code files).
We'll start the recipe from an existing point graph with some random data:
package com.graphing.zoompan { import com.graphing.PointGraph; public class Recipe1 extends Sprite { private var _graph:PointGraph; private var _data:Array...