public function gpastel_getImagen($titulo = " ", $width = "500", $height = "350") { $config = XTConfig::singleton(); $data = $this->pastel_data; $nombreimagen = uniqid() . "pieimagen.png"; $file = $config->get("XTSITE_PATH_ABSOLUTE") . "tmp/pie/" . $nombreimagen; $file_url = $config->get("XTSITE_PATH") . "tmp/pie/" . $nombreimagen; $graph = new PHPGraphLibPie($width, $height, $file); $graph->addData($data); $graph->setTitle($titulo); $graph->setLabelTextColor('50,50,50'); $graph->setLegendTextColor('50,50,50'); $graph->createGraph(); print "<img src=\"{$file_url}\">"; }
<?php include '../phpgraphlib.php'; include '../phpgraphlib_pie.php'; $graph = new PHPGraphLibPie(400, 200); $data = array("CBS" => 6.3, "NBC" => 4.5, "FOX" => 2.8, "ABC" => 2.7, "CW" => 1.4); $graph->addData($data); $graph->setTitle('8/29/07 Top 5 TV Networks Market Share'); $graph->setLabelTextColor('50, 50, 50'); $graph->setLegendTextColor('50, 50, 50'); $graph->createGraph();
$hostdata[$key] = $db->dbArrayResults($res); } } // now build an unassigned list $sql['hosts'] = "SELECT * FROM `conf_hosts` WHERE `subnet-name` IS NULL OR `subnet-name` = ''"; if (($value = $db->dbQuery($val->ValidateSQL($sql['hosts'], $dbconn), $dbconn)) !== -1) { $hostdata['unassigned'] = $db->dbArrayResults($value); } // generate our graphs but check for gd lib extensions first if (function_exists('imagedestroy')) { $graph = new PHPGraphLibPie(450, 200); foreach ($hostdata as $key => $value) { $array[$key] = count($value); $total = $total + count($value); } $graph->addData($array); $graph->setTitle("Hosts to Subnet Assignments: Total static hosts #" . $total); $graph->setLabelTextColor("50, 50, 50"); $graph->setLegendTextColor("50, 50, 50"); $graph->setLegendOutlineColor("black"); $graph->createGraph(); } } } else { // page view restricted by access level $ERROR = $err->GenerateErrorLink("help/help.html", "#undef", $defined['error'], $errors['level']); } } else { // general authentication error $ERROR = $err->GenerateErrorLink("help/help.html", "#undef", $defined['error'], $errors['auth_n']); }
<?php if ($_REQUEST['mode'] == 'graph' || $_REQUEST['mode'] == 'graph_line') { include '../lib/phpgraphlib.php'; $graph = new PHPGraphLib(1120, 600); $graph->addData(unserialize($_REQUEST['graph_data'])); if ($_REQUEST['mode'] == 'graph_line') { $graph->setBars(false); $graph->setLine(true); $graph->setLineColor(); } else { $graph->setGradient(); } $graph->setLegend(true); $graph->setLegendTitle(unserialize($_REQUEST['titles'])); $graph->createGraph(); } elseif ($_REQUEST['mode'] == 'graph_pie') { include '../lib/phpgraphlib.php'; include '../lib/phpgraphlib_pie.php'; $graph = new PHPGraphLibPie(1120, 600); $graph->addData(unserialize($_REQUEST['graph_data'])); $graph->setLabelTextColor("50,50,50"); $graph->createGraph(); }