Login Register Wishes Forum About
Language Reference » Drawing functions » drawFromPNG
Help topics
Latest updates
2147d  replaceImageMapTitle
2147d  replaceImageMapValues
2147d  createFunctionSerie
2147d  setAbsicssaPosition
2147d  negateValues
  Download as PDF
  Print this page
  Share this page
  Create an account
  Feed the updates!
Google AdSense
drawFromPNG - Add pictures to your charts

This function allows you to add PNG pictures to your charts. If you turn on shadow support before calling this function, the merged picture will be drawn with the specified shadow parameters.

Calling this function
Where :

X,Y are the coordinate where will be drawn the top left corner of the picture.
FileName is the path to the picture file.

It is recommended to use PNG files when you want to include pictures into your charts. This is the only real portable format that can handle alpha channels, thus the pictures will look crystal clear.

Sample script

 /* pChart library inclusions */

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

 /* Add a border to the picture */
 /* Write the picture title */ 
 $myPicture->drawText(10,13,"drawFromPNG() - add pictures to your charts",array("R"=>255,"G"=>255,"B"=>255));

 /* Turn off shadow computing */ 

 /* Draw a PNG object */

 /* Turn on shadow computing */ 

 /* Draw a PNG object */

 /* Write the legend */
 $TextSettings = array("R"=>255,"G"=>255,"B"=>255,"FontSize"=>10,"FontName"=>"../fonts/calibri.ttf","Align"=>TEXT_ALIGN_BOTTOMMIDDLE);
 $myPicture->drawText(240,190,"          Without shadow
(only PNG alpha channels)",$TextSettings);
 $myPicture->drawText(460,200,"With enhanced shadow",$TextSettings);

 /* Render the picture (choose the best way) */

This will draw two pictures, the first one with only alpha channels included in the PNG file (that may contains a shadow effect!!) and the second one with the internal pChart shadow algorithm.
Last updated on 12/23/2010 
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.