Contents
Login Register Wishes Forum About
Language Reference » Misc functions » drawAreaMirror
Help topics
Latest updates
2208d  replaceImageMapTitle
2208d  replaceImageMapValues
2208d  createFunctionSerie
2208d  setAbsicssaPosition
2208d  negateValues
Toolbox
  Download as PDF
  Print this page
  Share this page
  Create an account
  Feed the updates!
Google AdSense
drawAreaMirror - Mirror one part of the picture

This function allows you to mirror one part of the picture to do some nice looking reflexion effects on your charts.

Calling this function
drawAreaMirror($X,$Y,$Width,$Height,$Format="");
Where :

X,Y are the zone starting positiong.
Width is the width of the zone to mirror.
Height is the heightof the zone to mirror.
Format is an array containing the additional parameters.


Customisation array - Enhance rendering!

It is possible to customize the way your mirrir area will be rendered by playing with this array. Providing a detailled configuration is not mandatory.

You can specify the starting alpha value with StartAlpha. (default is 80)
You can specify the ending alpha value with EndAlpha. (default is 0)[/


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(150,220,300,250,420,200,300,200,100),"Server A"); 
 $MyData->addPoints(array(140,0,340,300,320,300,200,100,50),"Server B"); 
 $MyData->setAxisName(0,"Hits"); 
 $MyData->addPoints(array("January","February","March","April","May","Juin","July","August","September"),"Months");
  $MyData->setSerieDescription("Months","Month"); 
 $MyData->setAbscissa("Months"); 
 $MyData->setAbsicssaPosition(AXIS_POSITION_TOP);  

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

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

 /* Add a border to the picture */ 
 $myPicture->drawGradientArea(0,0,700,230,DIRECTION_VERTICAL,array("StartR"=>240,"StartG"=>240,"StartB"=>240,"EndR"=>80,"EndG"=>80,"EndB"=>80,"Alpha"=>100));
  $myPicture->drawGradientArea(0,0,700,230,DIRECTION_HORIZONTAL,array("StartR"=>240,"StartG"=>240,"StartB"=>240,"EndR"=>80,"EndG"=>80,"EndB"=>80,"Alpha"=>20));
  $myPicture->drawRectangle(0,0,699,229,array("R"=>0,"G"=>0,"B"=>0)); 

 /* Set the default font */ 
 $myPicture->setFontProperties(array("FontName"=>"../fonts/pf_arma_five.ttf","FontSize"=>6));
 
 /* Define the chart area */ 
 $myPicture->setGraphArea(60,40,650,200); 

 /* Draw the scale */ 
 $scaleSettings = array("GridR"=>200,"GridG"=>200,"GridB"=>200,"DrawSubTicks"=>TRUE,"CycleBackground"=>TRUE);
 $myPicture->drawScale($scaleSettings); 

 /* Write the chart legend */ 
 $myPicture->drawLegend(580,12,array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HORIZONTAL));
 
 /* Turn on shadow computing */  
 $myPicture->setShadow(TRUE,array("X"=>1,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10));
 
 /* Draw the chart */ 
 $myPicture->setShadow(TRUE,array("X"=>1,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10));
 $settings = array("Surrounding"=>-30,"InnerSurrounding"=>30,"Interleave"=>0); 
 $myPicture->drawBarChart($settings); 

 /* Draw the bottom black area */ 
 $myPicture->setShadow(FALSE); 
 $myPicture->drawFilledRectangle(0,174,700,230,array("R"=>0,"G"=>0,"B"=>0)); 

 /* Do the mirror effect */ 
 $myPicture->drawAreaMirror(0,174,700,48); 

 /* Draw the horizon line */ 
 $myPicture->drawLine(1,174,698,174,array("R"=>80,"G"=>80,"B"=>80)); 

 /* Render the picture (choose the best way) */ 
 $myPicture->autoOutput("pictures/example.drawAreaMirror.png"); 

This will print 45.
Last updated on 09/09/2011 
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.