Contents
Login Register Wishes Forum About
Language Reference » Drawing functions » writeBounds
Help topics
Latest updates
2115d  replaceImageMapTitle
2115d  replaceImageMapValues
2115d  createFunctionSerie
2115d  setAbsicssaPosition
2115d  negateValues
Toolbox
  Download as PDF
  Print this page
  Share this page
  Create an account
  Feed the updates!
Google AdSense
writeBounds - Write the min/max values over your chart

This function allows you to write the series boundaries (max, min, both) over your charts. All the drawing parameters are given trough a $Format array. To learn more about this please read the Format array guide.

This function must be called after a charting function because some of them introduce a X offset on the series


Calling this function
writeBoundaries($Type=BOUND_BOTH,$Format=NULL);
Where :

Type can be either BOUND_MIN, BOUND_MAX or BOUND_BOTH depending of what you want to display.
Format is an array containing the drawing parameters of the arrow.

Customisation array - Tune up your rendering!

It is possible to customize the rendering by playing with this array. Providing a detailled configuration is not mandatory, by default both min & max boundaries will be written with different colors.

The text displayed for the max. value can be set with MaxLabelTxt.
The text displayed for the min. value can be set with MinLabelTxt.
The series you want to exclude can be listed in an array named ExcludedSeries.
The offset between the data point and the label can be adjusted with DisplayOffset.
You can decide to draw a box under the caption setting DrawBox. to TRUE.

If you choose to draw a box under the caption, all the drawText() extended styles can be used (DrawBoxBorder,BorderOffset,BoxRounded, ...) to have the complete list of parameters, take a look at the drawText() page.

The label coloring method can be defined setting DisplayColor to :

DISPLAY_MANUAL if you want to define specific colors, then use MaxDisplayR, MaxDisplayG, MaxDisplayB and MinDisplayR, MinDisplayG, MinDisplayB to define it.
DISPLAY_AUTO if you want automatic coloring.

You can specify if the labels will be written on top or under the data point setting MinLabelPos and MaxLabelPos to :

BOUND_LABEL_POS_TOP to display the label on top of the point.
BOUND_LABEL_POS_BOTTOM to display the label under the point.
BOUND_LABEL_POS_AUTO for automatic positioning.

Sample script



 /* pChart library inclusions */
 include("../class/pData.class.php");
 include("../class/pDraw.class.php");
 include("../class/pImage.class.php");

 /* Create and populate the pData object */
 $MyData = new pData();  
 $MyData->addPoints(array(2,7,5,18,VOID,12,10,15,8,5,6,9),"Help Desk");
 $MyData->setAxisName(0,"Incidents");
 $MyData->addPoints(array("Jan","Feb","Mar","Apr","May","Jun","Jui","Aou","Sep","Oct","Nov","Dec"),"Labels");
 $MyData->setSerieDescription("Labels","Months");
 $MyData->setAbscissa("Labels");

 /* Create the pChart object */
 $myPicture = new pImage(700,230,$MyData);
 $myPicture->drawGradientArea(0,0,700,230,DIRECTION_VERTICAL,array("StartR"=>100,"StartG"=>100,"StartB"=>100,"EndR"=>50,"EndG"=>50,"EndB"=>50,"Alpha"=>100));
 $myPicture->drawGradientArea(0,0,700,230,DIRECTION_HORIZONTAL,array("StartR"=>100,"StartG"=>100,"StartB"=>100,"EndR"=>50,"EndG"=>50,"EndB"=>50,"Alpha"=>20));
 $myPicture->drawGradientArea(0,0,60,230,DIRECTION_HORIZONTAL,array("StartR"=>0,"StartG"=>0,"StartB"=>0,"EndR"=>50,"EndG"=>50,"EndB"=>50,"Alpha"=>100));

 /* Do some cosmetics */
 $myPicture->setShadow(TRUE,array("X"=>1,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10));
 $myPicture->drawLine(60,0,60,230,array("R"=>70,"G"=>70,"B"=>70));
 $myPicture->drawRectangle(0,0,699,229,array("R"=>0,"G"=>0,"B"=>0));
 $myPicture->setFontProperties(array("FontName"=>"../fonts/Forgotte.ttf","FontSize"=>11));
 $myPicture->drawText(35,115,"Recorded cases",array("R"=>255,"G"=>255,"B"=>255,"FontSize"=>20,"Angle"=>90,"Align"=>TEXT_ALIGN_BOTTOMMIDDLE));

 /* Draw a spline chart */
 $myPicture->setGraphArea(100,30,680,190);
 $myPicture->drawFilledRectangle(100,30,680,190,array("R"=>255,"G"=>255,"B"=>255,"Alpha"=>20));
 $myPicture->setFontProperties(array("R"=>255,"G"=>255,"B"=>255,"FontName"=>"../fonts/pf_arma_five.ttf","FontSize"=>6));
 $myPicture->drawScale(array("AxisR"=>255,"AxisG"=>255,"AxisB"=>255,"DrawSubTicks"=>TRUE,"CycleBackground"=>TRUE));
 $myPicture->drawSplineChart();

 /* Write the data bounds */
 $myPicture->writeBounds();
 $myPicture->setShadow(FALSE);

 /* Write the chart legend */ 
 $myPicture->drawLegend(630,215,array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HORIZONTAL));

 /* Render the picture (choose the best way) */
 $myPicture->autoOutput("pictures/example.writeBounds.png");
Last updated on 12/25/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. 409 users have registered. This page has been rendered in 0,01 seconds. Wiki revision 1.37.