graphpite
[ class tree: graphpite ] [ index: graphpite ] [ all elements ]
Prev Next
Modifying appearance

Modifying appearance

The GraPHPite Tutorial

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:

  1. ...
  2. $Graph->addColor(new Color(R, G, B), "SomeColor");
  3. // creates a color to use
  4. $LineStyle =& new SolidLine($SomeColor);
  5. // create the line style as a solid line with the newly created color
  6. $FillStyle =& new SolidFill($SomeColor);
  7. // create the fill style as a solid fill with the newly created color
  8. ...

When you have created the style you must set it on the graph element:

  1. ...
  2. $Element->setLineStyle($LineStyle);
  3. // set the line style
  4. $Element->setFillStyle($FillStyle);
  5. // set the fill style
  6. ...

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:

  1. ...
  2. $Element->setBorderStyle($LineStyle);
  3. // set the border style
  4. $Element->setBackground($FillStyle);
  5. // set the background style
  6. ...

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:

  • Font

  • FontTTF

  1. ...
  2. $StdFont = new Font();
  3. // create a standard font
  4. $TTFFont = new FontTTF("c:\windows\fonts\arial.ttf");
  5. // create a true type font
  6. ...

When you have created the font, you must set it on the graph element similarly to the fill/linestyle:

  1. ...
  2. $Element->setFont($Font);
  3. // set the font
  4. ...

Prev Up Next
Adding plots How to use GraPHPite Plot Layout

Documentation generated on Fri, 12 Nov 2004 08:24:30 +0100 by phpDocumentor 1.3.0RC3