Setting X Labels
It can be usefull / mandatory to define what will be the X labels displayed on the graphs (line, curve, bar, ..).
In a basic configuration we do not care of this, the pData class automaticaly create a 'Name' serie incrementing
a value for each new point, in results, X labels are numeric values. It is hopefully possible for
you to manually define this labels creating a dedicated serie!
Create your X Labels data serie
The creation of this serie will be done exactly the same way you are creating your data series. You
can do this using different pData functions. Let's first try with the AddPoint method adding one label
per call :
$DataSet->AddPoint("Jan","XLabel");
$DataSet->AddPoint("Feb","XLabel");
$DataSet->AddPoint("Mar","XLabel");
you can also use an array :
$DataSet->AddPoint(array("Jan","Feb","Mar"),"XLabel");
We now have a data serie containing the labels.
Use a serie as X Labels
The pData class embed a function named
SetAbsciseLabelSerie(). This method can be used
to set which serie will be used for X Labels. By default, calling it with no parameters will set
the inbuild 'Name' serie to be used. To set the serie we've previously populated :
$DataSet->SetAbsciseLabelSerie("XLabel");
Be careful if you are using the
AddAllSeries to mark all your series as graphable. The XLabel
serie will also be drawn and we don't want that. You have two possibilies. First one would be to remove
this serie from the graphable list :
$DataSet->RemoveSerie("XLabel");
The other solution would be to not use the
AddAllSeries but add manually each series :
$DataSet->AddSerie("Serie1");
$DataSet->AddSerie("Serie2");
$DataSet->AddSerie("Serie3");
...
|
|
Last updated on 07/18/2008 |