-
Book Overview & Buying
-
Table Of Contents
ActionScript Graphing Cookbook
By :
In this recipe, we expand on drawing in multiple dimensions. For now, we've only shown a 2D graph translated to 3D. Now we will show how to draw two separate data sets and get a real three-dimensional graph.
Start by creating a copy of the Moving around the chart recipe. This will be the basis for the current recipe.
Now replace the data set with the following one:
private var _data:Array = [[0, 20, 40], [50, 70, 60], [100, 0, 10], [150, 150, 170], [200, 300, 280], [250, 200, 210], [300, 400, 350], [350, 20, 50], [400, 60, 70], [450, 250, 230], [500, 90, 110], [550, 400, 350], [600, 500, 400],[650, 450, 380],[700,320, 350]];
It's basically the same set as before, plus an additional one.
The current code should work as it is, but it will only display the first data set:
To also display the second one, we only need to extend the Graph3D class. Replace the drawDataPoints method with the following code (remember drawFunction is the method responsible...
Change the font size
Change margin width
Change background colour