Login Register Wishes Forum About
Language Reference » Dataset functions » setSerieOnAxis
Help topics
Latest updates
4699d  replaceImageMapTitle
4699d  replaceImageMapValues
4699d  createFunctionSerie
4699d  setAbsicssaPosition
4699d  negateValues
  Download as PDF
  Print this page
  Share this page
  Create an account
  Feed the updates!
Google AdSense
setSerieOnAxis - Bind a serie to one axis

This function allows you to bind a data serie to one ordinate axis. You can create as many axis as you want. If the axis ID you are specifying does not exists it will be created with its default parameters. You can then name it, place it and specify how to display data on it.

It is important to create different axis to dispatch data series of different natures. You cant scale the same way temperatures (C) and humidity values (%). Creating two axis, one for each kind of data will help you to display the link between this two entities on the same chart without stretching the scales.

By default all new series are binded to the default axis with an ID of 0. You can bind a serie to another axis using the setSerieOnAxis function.

Calling this function

Where :

Series is the name of the serie you want to bind to another axis. (or an array of names)
AxisID is the ID of the axis we want to name.

Sample script #1

 /* Create the pData object */
 $MyData = new pData(); 

 /* Create some dummy data */

 /* Dispatch the two data series on dedicated axis */
 $MyData->setSerieOnAxis("Temperature",0); // This one isnt needed as this is the default serie

Sample script #2

 $MyData = new pData();  

 /* Prepare some nice data & axis config */
 $MyData->addPoints(array(1,2,VOID,9,10),"Humidity 1");
 $MyData->addPoints(array(1,VOID,7,-9,0),"Humidity 2");
 $MyData->addPoints(array(-1,-1,-1,-1,-1),"Humidity 3");
 $MyData->setSerieOnAxis("Humidity 1",1);
 $MyData->setSerieOnAxis("Humidity 2",1);
 $MyData->setSerieOnAxis("Humidity 3",1);
 $MyData->setAxisName(2,"Empty value");

 /* Bind a data serie to the X axis */
 $MyData->setSerieDescription("Labels","My labels");

 /* Define the graph area and do some makeup */
 $myPicture->drawText(350,55,"My chart title",array("FontSize"=>20,"Align"=>TEXT_ALIGN_BOTTOMMIDDLE));

 /* Compute and draw the scale */
Last updated on 12/03/2009 
by Jean-Damien 
Linked resources
Community comments
  No comments have been posted yet.
© Copyrights
Components used on this web site : Famfamfam icons has been made by Mark James, Rounded corners lite has been coded by Cameron Cooke and Tim Hutchison, SyntaxHighlighter has been written by Alex Gorbatchev. pChart and this web site have been created by Jean-Damien POGOLOTTI. This documentation contains 185 pages and 56 comments. 415 users have registered. This page has been rendered in 0,01 seconds. Wiki revision 1.37.