ICC WORLD CUP 2011 WATCH LIVE ONLINE

Create clickable Graph using PHP

10:25 PM Posted by: Isuru Jayathissa 0 comments

There are two methods to do this:

  1. GettingHoldOfImageMap
  2. Using StrokeCSIM
I get 3D-Pie chart as a example ,


include ("../../../../jpgraph/src/jpgraph.php");
include ("../../../../jpgraph/src/jpgraph_pie.php");
include ("../../../../jpgraph/src/jpgraph_pie3d.php");

$graph = new PieGraph(600,600);
$graph->SetShadow();

$graph->title->Set("Incoming Traffic - IP Occurrences");
$graph->title->SetFont(FF_FONT1,FS_BOLD);

/// using this we can click Title///
$graph->title->SetCSIMTarget('#99','Incoming Traffic');

$p1 = new PiePlot3D($data);


///those targets can get using GET method//
$targets = array('?path = 11', '?path = 22','?path = 44','?path = 66','?path = 55');
$alts = $dataIP;

/// Because of Using this SetCSIMTargets method, we can click image///
$p1->SetCSIMTargets($targets,$alts);
$p1->SetLegends($dataIP);
$graph->Add($p1);

$graph->Stroke();
/// Using this STROKE method , get image to the web page ///

/* if we use this Stroke method only, we can not add any other item (ex: text, table,etc...). therefore I used a method to solve that problem .
  1. that is : save image another folder and send that image to the server and get back to the web page.

///this is the first method "1.
GettingHoldOfImageMap"


$graph->Stroke( "/opt/lampp/htdocs/Test/img/image001.png" ); /// Using this Stroke methode we can save image .
echo $graph ->GetHTMLImageMap ("myimagemap001" );

echo "< xxxx ISMAP USEMAP=\"#myimagemap001\" border=0" ; echo "width=\"600\" height=\"600\"> " ;
///note : you have to replace image path with the
xxxx . I can not give image path , because of Publishing problem .///

/// this is the second method
2.Using StrokeCSIM

//~ $graph-> StrokeCSIM( basename( __FILE__)); //using this "basename(_FILE_)" we can save as same as PHP file name or we can use this
//~ $graph-> StrokeCSIM( 'creatImg.php');

?>



Check the My other post also



 


2009 Isuru's Blog. All rights reserved.
.
For the more details..,
keijayathissa@gmail.com