Login Register Wishes Forum About
Language Reference » Charting functions » drawPlotChart
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
drawPlotChart - Draw a plot chart

This function allows you to draw a plot chart. All the drawing parameters are given trough a $Format array. To learn more about this please read the Format array guide.

Calling this function
Where :

Format is an array containing the drawing parameters of the chart.

Customisation array - Tune up your chart!

It is possible to customize the plot chart rendering by playing with this array. Providing a detailled configuration is not mandatory, by default the bar will be drawn with a width of 200px, a height of 20px and basic color sets.

You can specify the size of the plot with PlotSize.
You can draw a border around the plot setting PlotBorder to TRUE or FALSE.
You can set the plot border color with BorderR, BorderG, BorderB.
You can set the plot border alpha with BorderAlpha.
You can set the width of the border with BorderSize.
You can use the Surrounding option to define the border color. This value will be added to the R, G, B factors to define the new color.
You can specify if the values must be written on the chart setting DisplayValues to TRUE or FALSE.
You can specify the text UP/RIGHT offset with DisplayOffset.
You can enable image map recording by setting RecordImageMap to TRUE.
You can specify the labels color with DisplayR,DisplayG,DisplayB.

You can define if the labels color will be the same than the serie color of if you want to force it manually setting DisplayColor to :

DISPLAY_MANUAL, color will be specified manually with DisplayR,DisplayG,DisplayB.
DISPLAY_AUTO, will use the serie color.

Sample script #1

 /* Build a dataset */
 $MyData = new pData();  
 $MyData->addPoints(array(-4,VOID,VOID,12,8,3),"Probe 1");
 $MyData->addPoints(array(3,12,15,8,5,-5),"Probe 2");
 $MyData->addPoints(array(2,7,5,18,19,22),"Probe 3");

 /* Create the 1st chart*/
 $myPicture->drawPlotChart(array("BorderSize"=>1, "Surrounding"=>40, "BorderAlpha"=>100, "PlotSize"=>2, "PlotBorder"=>TRUE, "DisplayValues"=>TRUE, "DisplayColor"=>DISPLAY_AUTO));

 /* Create the 2nd chart */

 /* Write the legend*/

Sample script #2

 /* pChart library inclusions */

 /* Create and populate the pData object */
 $MyData = new pData();  
 for($i=0;$i<=20;$i++) { $MyData->addPoints(rand(0,20),"Probe 1"); }
 for($i=0;$i<=20;$i++) { $MyData->addPoints(rand(0,20),"Probe 2"); }
 $MyData->setSerieShape("Probe 1",SERIE_SHAPE_FILLEDTRIANGLE);
 $MyData->setSerieShape("Probe 2",SERIE_SHAPE_FILLEDSQUARE);

 /* Create the pChart object */
 $myPicture = new pImage(700,230,$MyData);

 /* Turn of Antialiasing */
 $myPicture->Antialias = FALSE;

 /* Add a border to the picture */
 /* Write the chart title */ 
 $myPicture->drawText(150,35,"Average temperature",array("FontSize"=>20,"Align"=>TEXT_ALIGN_BOTTOMMIDDLE));

 /* Set the default font */

 /* Define the chart area */

 /* Draw the scale */
 $scaleSettings = array("XMargin"=>10,"YMargin"=>10,"Floating"=>TRUE,"GridR"=>200,"GridG"=>200,"GridB"=>200,"DrawSubTicks"=>TRUE,"CycleBackground"=>TRUE);

 /* Turn on Antialiasing */
 $myPicture->Antialias = TRUE;

 /* Draw the line chart */

 /* Write the chart legend */

 /* Render the picture (choose the best way) */
Last updated on 09/03/2010 
by Jean-Damien 
Linked resources
  There is no linked topic yet.
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.