Exemple #1
0
function dansguardian_buildGraph_week(){
include_once(dirname(__FILE__).'/listener.graphs.php');
$sql="SELECT COUNT( sitename ) AS tcount ,TYPE FROM `dansguardian_events` WHERE YEARWEEK( zDate ) = YEARWEEK( NOW( ) ) GROUP BY TYPE ORDER BY tcount DESC LIMIT 0 , 30";
if(isset($_GET["dansguardian-stats-query"])){return dansguardian_buildGraph_by_type();}

$md5=md5($sql);


	$q=new mysql();
	$results=$q->QUERY_SQL($sql,'artica_events');
	$html="<table style='width:100%'>";
	while ($ligne = mysql_fetch_array($results)) { 
		if($ligne["TYPE"]<>null){
			$data[]=$ligne["tcount"];
			$labels[]=$ligne["TYPE"];
			$jsa="javascript:ShowGraphDansGuardianDetails('{$ligne["TYPE"]}','week');";
			$html=$html . "<tr " . CellRollOver().">
				<td width=1%><img src='img/fw_bold.gif'>
				<td><strong style='font-size:11px'>{$ligne["tcount"]}</td>
				<td><strong style='font-size:11px'><a href='#' OnClick=\"$jsa\">{$ligne["TYPE"]}</a></td>
				</tr>
				
				";
			$js[]="$jsa";
			
		}
		
	}
	
	
	
   $html=$html."</table>";
   if (!is_array($data)){
   		die("<center>".ICON_DANSGUARDIAN_STATISTICS()."</center>");
   }
   
   $tpl=new templates();

   



$p1 = new PiePlot3D($data);
$p1->SetSize(.4); 
$p1->SetAngle(75); 
$p1->SetCSIMTargets($js,$labels);
$p1->SetCenter(0.3,0.5);
$p1->ExplodeAll(10); 
$p1->SetLegends($labels);
//$p1->SetSliceColors(array('red','blue','green','navy','orange')); 

$graph = new PieGraph(470,350,'auto');
$graph->Add($p1);
$graph->title->Set("Week");
$graph->title->SetFont(FF_FONT1,FS_BOLD);
$graph->legend->Pos(0,0,'right','top');
$graph->legend->SetFillColor('white'); 
$graph->legend->SetLineWeight(0);
//$graph->legend->SetLayout(LEGEND_HOR); //hori 
$graph->legend->SetColor('black'); 
$graph->legend->SetShadow("white",0); 
$graph->SetFrame(false); 
if(function_exists("imageantialias")){$graph->img->SetAntiAliasing();}
$mapName = 'MapName';
$imgMap = $graph->GetHTMLImageMap($mapName); 
$graph->Stroke("ressources/logs/$md5.png");

$html=  "
<table style='width:100%'>

<tr>
	<td valign='top'>
$imgMap
".RoundedLightWhite("
<img src='ressources/logs/$md5.png' alt='graph' ismap usemap='#$mapName' border='0'>")."
</td>
<td valign='top'>".RoundedLightWhite($html)."</td>
</tr>
</table>

";


return $html;

	
}
<?php

include "../jpgraph.php";
include "../jpgraph_pie.php";
// Some data
$data = array(40, 21, 17, 14, 23);
// Create the Pie Graph.
$graph = new PieGraph(300, 200);
$graph->SetShadow();
// Set A title for the plot
$graph->title->Set("Client side image map");
$graph->title->SetFont(FF_FONT1, FS_BOLD);
// Create
$p1 = new PiePlot($data);
$p1->SetLegends(array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul"));
$targ = array("pie_csimex1.php#1", "pie_csimex1.php#2", "pie_csimex1.php#3", "pie_csimex1.php#4", "pie_csimex1.php#5", "pie_csimex1.php#6");
$alts = array("val=%v", "val=%v", "val=%v", "val=%v", "val=%v", "val=%v");
$p1->SetCSIMTargets($targ, $alts);
$graph->Add($p1);
$graph->Stroke(GenImgName());
echo $graph->GetHTMLImageMap("myimagemap");
echo "<img src=\"" . GenImgName() . "\" ISMAP USEMAP=\"#myimagemap\" border=0>";
?>


Exemple #3
0
}
// Set theme colors
// Options are "earth", "sand", "water" and doodoo, no, I mean "pastel" :-)
$p1->SetTheme("earth");
// Explode all slices
$p1->ExplodeAll($topx);
// Add drop shadow
$aColor = "darkgray";
$p1->SetShadow($aColor);
// Finally add the plot
$graph->Add($p1);
// ... and stroke it
// $graph->Stroke();
//$ih = $graph->Stroke(_IMG_HANDLE);
// $graph->StrokeCSIM("$graph_name");
$graph->Stroke($fileName);
// $mapName = 'Top10';
$imgMap = $graph->GetHTMLImageMap($mapName);
// die("?offset=".$offset. "PPP" .$ParamsGET);
echo "{$imgMap} <TD ALIGN=\"center\"><img src=\"{$fileName}\" alt=\"{$mapName} Graph - Click on slice to drill down\" ismap usemap=\"#{$mapName}\" border=\"0\"></TD></TR>";
require_once 'includes/html_footer.php';
//------------------------------------------------------------------------
// Else just direct the user back to the form
//------------------------------------------------------------------------
/* } else {
	echo "No results found.<br><a href=\"index.php?pageId=searchform\">BACK TO SEARCH</a>";
}
*/
//========================================================================
// END: BUILDING THE HTML PAGE
//========================================================================