graphpite
[ class tree: graphpite ] [ index: graphpite ] [ all elements ]
Prev Next
Adding plots

Adding plots

The GraPHPite Tutorial

Adding plots

When the GraPHP, PlotArea and DataSet is in place you can specify which plottype to use for displaying the data. There are a number of plottypes and they are all listed below.

The usage is however common for all of them so it's pretty straight forward to explain how to use them. The code example below demonstrates the usage:

  1. ... // initially the GraPHP, PlotArea and DataSet have been created
  2. $PlotArea->addPlot(new PlotType($DataSet), "PlotType");
  3. ...

Plot types

There exist the following plottypes:

  • BarChart

  • AreaChart

  • LineChart

  • SmoothedAreaChart

  • SmoothedLineChart

The following code example demonstrates how to create an SmoothedAreaChart from scratch (this example will actually create a "real" graph):

  1. $GraPHP =& new GraPHP(800, 600); // create the graph
  2. $GraPHP->add(new PlotArea(), "PlotArea"); // create the plotarea
  3. $PlotArea->addPlot(new SmoothedAreaChart(new RandomDataSet(10, 20, 100), "PlotType");
  4. // and a new SmoothedAreaChart using a new RandomDataSet
  5. $GraPHP->Done();

Prev Up Next
Creating the dataset How to use GraPHPite Modifying appearance

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