Ejemplo n.º 1
2
 function xls_write_graph($graphfile = null)
 {
     //init all
     $CI =& get_instance();
     //load
     $CI->load->helper('misc');
     $graph = new PHPGraphLib(495, 280, $graphfile);
     $data1 = array('alpha' => intval(rand(20) + 1), 'beta' => intval(rand(15) + 1), 'cappa' => intval(rand(10) + 1), 'delta' => intval(rand(20) + 1), 'echo' => intval(rand(10) + 1));
     $data2 = array('alpha' => intval(rand(8) + 1), 'beta' => intval(rand(20) + 1), 'cappa' => intval(rand(20) + 1), 'delta' => intval(rand(20) + 1), 'echo' => intval(rand(50) + 1));
     $data3 = array('alpha' => intval(rand(25) + 1), 'beta' => intval(rand(8) + 1), 'cappa' => intval(rand(10) + 1), 'delta' => intval(rand(50) + 1), 'echo' => intval(rand(50) + 1));
     $data4 = array('alpha' => intval(rand(7) + 1), 'beta' => intval(rand(50) + 1), 'cappa' => intval(rand(5) + 1), 'delta' => intval(rand(50) + 1), 'echo' => intval(rand(50) + 1));
     $data = array(rand(20, 30), rand(40, 50), 20, 44, 41, 18, rand(40, 50), 19, rand(40, 50));
     $data2 = array(15, rand(20, 30), rand(20, 30), 11, rand(40, 60), 21, rand(40, 60), 34, rand(20, 30));
     $data3 = array(rand(40, 50), rand(20, 30), 34, 23, rand(45, 60), 32, 43, 41);
     $graph->addData($data, $data2, $data3);
     $graph->setTitle('CPU Cycles x1000');
     $graph->setTitleLocation('left');
     $graph->setLegend(true);
     $graph->setLegendTitle('Module-1', 'Module-2', 'Module-3');
     $xcolor1 = sprintf("%02X%02X%02X", rand(20, 255), rand(20, 250), rand(20, 250));
     $xcolor2 = sprintf("%02X%02X%02X", rand(20, 250), rand(20, 255), rand(20, 250));
     $graph->setGradient("#{$xcolor1}", "#{$xcolor2}");
     $graph->createGraph();
     //give the format
     return 1;
 }
Ejemplo n.º 2
0
<?php

include '../phpgraphlib.php';
$graph = new PHPGraphLib(500, 280);
$data = array(23, 45, 20, 44, 41, 18, 49, 19, 42);
$data2 = array(15, 23, 23, 11, 54, 21, 56, 34, 23);
$data3 = array(43, 23, 34, 23, 53, 32, 43, 41);
$graph->addData($data, $data2, $data3);
$graph->setTitle('CPU Cycles x1000');
$graph->setTitleLocation('left');
$graph->setLegend(true);
$graph->setLegendTitle('Module-1', 'Module-2', 'Module-3');
$graph->setGradient('green', 'olive');
$graph->createGraph();
Ejemplo n.º 3
0
                 preg_match('/([0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3})\\.[0-9]{1,3}/', $value['subnet'], $match);
                 $sql = "SELECT `ip` FROM `conf_leases` WHERE `ip` LIKE \"" . $match[1] . ".%\"";
                 // execute query and place results (if any) in array per-subnet
                 if (($value = $db->dbQuery($val->ValidateSQL($sql, $dbconn), $dbconn)) !== -1) {
                     $all[$name] = $total;
                     $data[$name] = count($db->dbArrayResults($value));
                 }
             }
         }
         // generate our graphs but check for gd lib extensions first
         if (function_exists('imagedestroy')) {
             $graph = new PHPGraphLib(450, 200);
             // push the image and assign attributes
             $graph->addData($data, $all);
             $graph->setTitle("Total Leases: " . $total_leases);
             $graph->setTitleLocation("left");
             $graph->setLegendTitle("Available", "In Use");
             $graph->setBars(true);
             $graph->setLegend(true);
             $graph->setDataPoints(true);
             $graph->setDataPointColor("red");
             $graph->setDataValueColor("gray");
             $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']);