Modifying appearance
When you have just created the graph you would most likely want to change the way it looks.
For all elements you can basically modify the apperance by changing:
Line style
Fill style
Font
Border
Background
You CAN change all of the above for all elements, but some element will not "use" them all,
ie. a LineChart will not use the "Fill Style".
Modifying line/fill style
There exist the following line styles:
SolidLine
FormattedLine
DashedLine
DottedLine
And fill-styles:
SolidFill
ImageFill
GradientFill
First of all you must create the line-/fillstyle:
- ...
- $Graph->addColor(new Color(R, G, B), "SomeColor");
- // creates a color to use
-
- $LineStyle =& new SolidLine($SomeColor);
- // create the line style as a solid line with the newly created color
-
- $FillStyle =& new SolidFill($SomeColor);
- // create the fill style as a solid fill with the newly created color
- ...
When you have created the style you must set it on the graph element:
- ...
- $Element->setLineStyle($LineStyle);
- // set the line style
-
- $Element->setFillStyle($FillStyle);
- // set the fill style
- ...
It's that easy!.
In the case of the border and background it's basically "just" another linestyle and
another fillstyle to set on the element:
- ...
- $Element->setBorderStyle($LineStyle);
- // set the border style
-
- $Element->setBackground($FillStyle);
- // set the background style
- ...
Using another font
To use another font for displaying text on the element, create a font and assigned it to
the element in much the same way as the line-/fillstyle described above. There exist the
following types of fonts:
- ...
- $StdFont = new Font();
- // create a standard font
-
- $TTFFont = new FontTTF("c:\windows\fonts\arial.ttf");
- // create a true type font
- ...
When you have created the font, you must set it on the graph element similarly to the
fill/linestyle:
- ...
- $Element->setFont($Font);
- // set the font
- ...