Contents
Login Register Wishes Forum About
Language Reference » Image Maps » addToImageMap
Help topics
Latest updates
2028d  replaceImageMapTitle
2028d  replaceImageMapValues
2028d  createFunctionSerie
2028d  setAbsicssaPosition
2028d  negateValues
Toolbox
  Download as PDF
  Print this page
  Share this page
  Create an account
  Feed the updates!
Google AdSense
addToImageMap - Add an element to your image map

This function allows you to add a zone in your image map.

Calling this function
addToImageMap($Type,$Plots,$Color=NULL,$Title=NULL,$Message=NULL)
Where :

Type is the type of zone (RECT,CIRCLE,POLYGON)
Plots is the list of points defining the area.
Color is an HTML formated color.
Title is the title of the image map boxes displayed over this zone.
Messageis the message contained in the image map boxes displayed over this zone.


Note that the area Type are the one defined in the HTML standards. A circle is defined by 3 points (X,Y,Radius), a rectangle by 4 points (X1,Y1,X2,Y2) and a polygon by any even number of points.

Sample script

This will create a file named /tmp/BarChart.map to store the image map coordinates on the server.
 /* Library settings */
 define("CLASS_PATH", "../../../class");
 define("FONT_PATH", "../../../fonts");

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

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

 /* Set the image map name */
 $myPicture->initialiseImageMap("ImageMapBarChart",IMAGE_MAP_STORAGE_FILE,"BarChart","/tmp");

 /* Add a circle area to the image map */
 $myPicture->addToImageMap("CIRCLE","100,100,30","#FF0000","Circle area","This is a red area");

 /* Add a rectangular area to the image map */
 $myPicture->addToImageMap("CIRCLE","200,100,300,100","#00FF00","Rectangle area","This is a green area");

 /* Add a polygonal area to the image map */
 $myPicture->addToImageMap("POLYGON","20,20,60,20,50,50","#0000FF","Polygon area","This is a blue area");
Last updated on 08/04/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.