Adding a plotarea
Afterwards you must create one or more Image_Graph_Plotarea(s) to use for plotting.
After you have created the Image_Graph object you must add all other elements, either directly
to the Image_Graph object or an object that has a parent-child chain that terminates in the
Image_Graph object, ie Image_Graph->Image_Graph_Plotarea->Image_Graph_Plot_Line->add(Image_Graph_Marker) (this is not actual code!).
To add a new PlotArea to the Graph do either of the following.
or a less compact but perhaps more comprehensible version.
It is very important to remember the "&" (ampersand) after the "=" (equals) sign.
Especially if you want to modify/add to the object after the add. Cause PHP 4 assigns by
making a copy of the object instead of by reference. So if the "&" is forgotten and
you make (some) changes to the created object, they will not be applied to the "added"
object because it is another copy. The following pseudo code will demonstrate this:
1 $A = new A(); // create an instance of the A class and assign it to $A 2 $B = $A; // assign $A to $B, this makes a COPY of $A and stores it in $B 3 &$A == &$B;
|
Line 3 in the above example will evaluate to FALSE, because $B is a COPY of $A and therefore
it will NOT refer to the same object (this is pseudo PHP code!).
On the other hand if you did the following:
1 $A =& new A(); // create an instance of the A class and assign THE REFERENCE to it to $A 2 $B = &$A; // assign THE REFERENCE of $A to $B 3 &$A == &$B;
|
Line 3 in the above example will evaluate to TRUE, because $B is a reference to $A and therefore
it will refer to the same object (this is pseudo PHP code!), ie the reference/pointer is the same.