Exemplo n.º 1
0
require_once 'jpgraph/jpgraph.php';
require_once 'jpgraph/jpgraph_pie.php';
require_once 'jpgraph/jpgraph_pie3d.php';
//$gJpgBrandTiming=true;
// Some data
$data = array(40, 21, 17, 27, 23);
// Create the Pie Graph.
$graph = new PieGraph(400, 200, 'auto');
$graph->SetShadow();
// Set A title for the plot
$graph->title->Set("3D Pie Client side image map");
$graph->title->SetFont(FF_FONT1, FS_BOLD);
// Create
$p1 = new PiePlot3D($data);
$p1->SetLegends(array("Jan (%d)", "Feb", "Mar", "Apr", "May", "Jun", "Jul"));
$targ = array("pie3d_csimex1.php?v=1", "pie3d_csimex1.php?v=2", "pie3d_csimex1.php?v=3", "pie3d_csimex1.php?v=4", "pie3d_csimex1.php?v=5", "pie3d_csimex1.php?v=6");
$alts = array("val=%d", "val=%d", "val=%d", "val=%d", "val=%d", "val=%d");
$p1->SetCSIMTargets($targ, $alts);
// Use absolute labels
$p1->SetLabelType(1);
$p1->value->SetFormat("%d kr");
// Move the pie slightly to the left
$p1->SetCenter(0.4, 0.5);
$graph->Add($p1);
// Send back the HTML page which will call this script again
// to retrieve the image.
$graph->StrokeCSIM();
?>


 //					$graph->footer->left->Set ("LogAnalyzer v" . $content['BUILDNUMBER'] . "\n" . GetAndReplaceLangStr($content['LN_STATS_GENERATEDAT'], date("Y-m-d")) );
 //					$graph->footer->left->SetFont( FF_VERA, FS_NORMAL, 8);
 //					$graph->footer->right->SetColor("darkred");
 // Show 0 label on Y-axis (default is not to show)
 $graph->yscale->ticks->SupressZeroLabel(false);
 // Set Fonts for graph!
 $graph->xaxis->SetFont(FF_VERA, FS_NORMAL, 8);
 $graph->yaxis->SetFont(FF_VERA, FS_NORMAL, 8);
 $graph->legend->SetFont(FF_VERA, FS_NORMAL, 8);
 // Create
 $p1 = new PiePlot3D($YchartData);
 $p1->SetLegends($XchartData);
 $p1->SetEdge('#333333', 1);
 $p1->SetTheme('earth');
 /*   "earth"    * "pastel"    * "sand"    * "water" */
 $p1->SetCSIMTargets($chartImageMapLinks, $chartImageMapAlts, $chartImageMapTargets);
 // Set label format
 if ($content['showpercent'] == 1) {
     $p1->SetLabelType(0);
     $p1->value->SetFormat("%d%%");
 } else {
     $p1->SetLabelType(1);
     $p1->value->SetFormat("%d");
 }
 // Set label properties
 $p1->SetLabelPos(1.0);
 $p1->SetSliceColors(array('#FFF584', '#CBFF84', '#FF6B9E', '#FF9584', '#EAFF84', '#7BFF51', '#51FFA6', '#51FF52', '#6BCFFF', '#5170FF', '#519CFF', '#EAE3AD', '#FFF184', '#8584FF', '#E698FF', '#C384FF', '#FF84EC', '#FF98A3', '#E5C285', '#FFDA98'));
 $p1->value->SetFont(FF_VERA, FS_NORMAL, 8);
 $p1->value->SetColor("black");
 // Adjust other Pie Properties
 $p1->SetLabelMargin(5);
Exemplo n.º 3
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;

	
}
Exemplo n.º 4
0
}
$legends = array();
foreach ($labels as $currentKey => $currentLabel) {
    $legends[] = $currentLabel . ' - ' . $amounts[$currentKey]->getFormatted();
}
$targets = array();
foreach ($labels as $currentId => $currentLabel) {
    if ($currentId != 'none' && $currentId != 'other') {
        $targets[] = 'javascript:reachThroughCategory(\'' . substr($currentId, 1) . '\');';
    } else {
        $targets[] = '';
    }
}
$pie = new PiePlot3D($data);
$pie->SetLegends($legends);
$pie->SetCSIMTargets($targets, $dataNames);
$pie->value->SetFont(FF_VERA);
$pie->value->SetFormatCallback('formatPercentage');
$pie->SetCenter(0.33, 0.5);
//$pie->SetSliceColors($chartColors);
$graph->Add($pie);
$graph->legend->SetFont(FF_VERA);
$graph->legend->SetPos(0.03, 0.05);
$graph->SetMargin(10, 10, 10, 10);
$graph->SetShadow();
$graph->SetAntiAliasing();
$graph->StrokeCSIM(basename(__FILE__));
require_once BADGER_ROOT . "/includes/fileFooter.php";
function formatPercentage($val)
{
    global $us;