Contents
Login Register Wishes Forum About
Language Reference » Dataset functions » setXAxisUnit
Help topics
Latest updates
4574d  replaceImageMapTitle
4574d  replaceImageMapValues
4574d  createFunctionSerie
4574d  setAbsicssaPosition
4574d  negateValues
Toolbox
  Download as PDF
  Print this page
  Share this page
  Create an account
  Feed the updates!
Google AdSense
setXAxisUnit - Define the unit to use on the X Axis

This function allows you to set the unit associated to the X Axis. This unit will be displayed when the axis display mode is set to AXIS_FORMAT_UNIT.

Calling this function
setXAxisUnit($Unit);

Where :

Unit is the kind of data that will be displayed.


Sample script #1

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

 /* Units appended to the axis values will be "m/s" */
 $MyData->setXAxisUnit("m/s");

Sample script #2



 $MyData = new pData();  

 /* Prepare some nice data & axis config */
 $MyData = new pData();  
 $MyData->addPoints(array(1700,2500,7800,4500,3150),"Distance");
 $MyData->setAxisName(0,"Maximum distance");
 $MyData->setAxisUnit(0,"m");
 $MyData->setAxisDisplay(0,AXIS_FORMAT_METRIC);

 /* Create the X serie */
 $MyData->addPoints(array(1230768000,1233446400,1235865600,1238544000,1241136000,1243814400),"Timestamp");
 $MyData->setSerieDescription("Timestamp","Sampled Dates");
 $MyData->setAbscissa("Timestamp");
 $MyData->setXAxisDisplay(AXIS_FORMAT_DATE);

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

 /* Compute and draw the scale */
 $myPicture->drawScale();
Last updated on 01/06/2011 
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,20 seconds. Wiki revision 1.37.