Location: PHPKode > projects > phpTrafficA > phpTrafficA-2.3/plotStatPie.php
 phpTrafficA @soft.ZoneO.net
 Copyright (C) 2004-2008 ZoneO-soft, Butchu (email: "butchu" with the domain "zoneo.net")

 This program is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License
 as published by the Free Software Foundation; either version 2
 of the License, or (at your option) any later version.

 More Info About The Licence At http://www.gnu.org/copyleft/gpl.html

if (!isset($file) or $file=="") {$file = $_GET['file'];}

// Secure the file parameter
$file = "$tmpdirectory/".str_replace("/", "", $file);
if (is_file("$file")) {
} else {
	die("Something is wrong.");

function hex2rgb($hex) {
$color = str_replace('#','',$hex);
$rgb = array(hexdec(substr($color,0,2)),
return $rgb;

$dark = hex2rgb("#122C4D");
$dark = hex2rgb("#122C4D");

if (!isset($width)) {$width = 500;}
if (!isset($height)) {$height = 200;}
$plot = min($width,$height);

$graph = new PHPlot($width,$height);
$graph->SetDataType("text-data");  //Must be called before SetDataValues
// Special function (I added it to phplot to shif my pie plots to the left)
// 60 pixels margin on the left, 5 on top
$graph->SetPiePlotPixels(30, 5, $plot+30, $plot+5);
//position lower left corner
// Setting the image format
if (function_exists("imagepng")) {
} elseif (function_exists("imagejpeg")) {
}  elseif (function_exists("imagewbmp")) {
} else {
	die("No image support in this PHP server");
Return current item: phpTrafficA