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:
- ... // initially the GraPHP, PlotArea and DataSet have been created
- $PlotArea->addPlot(new PlotType($DataSet), "PlotType");
- ...
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):
- $GraPHP =& new GraPHP(800, 600); // create the graph
- $GraPHP->add(new PlotArea(), "PlotArea"); // create the plotarea
- $PlotArea->addPlot(new SmoothedAreaChart(new RandomDataSet(10, 20, 100), "PlotType");
- // and a new SmoothedAreaChart using a new RandomDataSet
- $GraPHP->Done();