Contents
Login Register Wishes Forum About
Language Reference » Dataset functions » setAxisPosition
Help topics
Latest updates
2023d  replaceImageMapTitle
2023d  replaceImageMapValues
2023d  createFunctionSerie
2023d  setAbsicssaPosition
2023d  negateValues
Toolbox
  Download as PDF
  Print this page
  Share this page
  Create an account
  Feed the updates!
Google AdSense
setAxisPosition - Define the position of one Y Axis

This function allows you to set position (left or right) of an Y Axis. Values on this axis are automatically computed by the scaling algorithm.

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
setAxisPosition($AxisID,$Position);

Where :

AxisID is the ID of the axis we want to name.
Position is the side where the axis will be drawn.

Valid Position values are :

AXIS_POSITION_LEFT default positioning on the left side of the chart.
AXIS_POSITION_RIGHT to put the axis on the right side of the chart.


Sample script #1

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

 /* The default ordinate axis will be on the left side*/
 $MyData->setAxisPosition(0,AXIS_FORMAT_METRIC);
 /* The second ordinate axis will be on the right side */
 $MyData->setAxisPosition(1,AXIS_POSITION_RIGHT);

Sample script #2



 $MyData = new pData();  

 /* Prepare some nice data & axis config */
 $MyData->addPoints(array(24,-25,26,25,25),"Temperature");
 $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->addPoints(array(0,0,0,0,0),"Vide");
 $MyData->setSerieOnAxis("Temperature",0);
 $MyData->setSerieOnAxis("Humidity 1",1);
 $MyData->setSerieOnAxis("Humidity 2",1);
 $MyData->setSerieOnAxis("Humidity 3",1);
 $MyData->setSerieOnAxis("Vide",2);
 $MyData->setAxisPosition(2,AXIS_POSITION_RIGHT);
 $MyData->setAxisName(0,"Temperature");
 $MyData->setAxisName(1,"Humidity");
 $MyData->setAxisName(2,"Empty value");

 /* Bind a data serie to the X axis */
 $MyData->addPoints(array("Jan","Feb","Mar","Apr","May","Jun"),"Labels");
 $MyData->setSerieDescription("Labels","My labels");
 $MyData->setAbscissa("Labels");

 /* Define the graph area and do some makeup */
 $myPicture->setGraphArea(90,60,660,190);
 $myPicture->drawText(350,55,"My chart title",array("FontSize"=>20,"Align"=>TEXT_ALIGN_BOTTOMMIDDLE));
 $myPicture->drawFilledRectangle(90,60,660,190,array("R"=>255,"G"=>255,"B"=>255,"Surrounding"=>-200,"Alpha"=>10));

 /* Compute and draw the scale */
 $myPicture->drawScale(array("DrawYLines"=>array(0)));
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. 409 users have registered. This page has been rendered in 0,01 seconds. Wiki revision 1.37.