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}\">";
 }
Esempio n. 2
0
<?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();
Esempio n. 3
0
<?php

error_reporting(0);
include "phpgraphlib.php";
include "phpgraphlib_pie.php";
$showsmall = $_GET['showsmall'];
$datavalues = $_GET['datavalues'];
$header = unserialize(urldecode(stripslashes($_GET['header'])));
$data = unserialize(urldecode(stripslashes($_GET['mydata'])));
if ($showsmall) {
    $graph = new PHPGraphLibPie(300, 200);
} else {
    $graph = new PHPGraphLibPie(500, 300);
}
if ($datavalues) {
    $graph->setDataValues(true);
} else {
    $graph->setDataValues(false);
}
$graph->addData($data);
$graph->setTitle($header);
$graph->setLabelTextColor("blue");
$graph->createGraph();
<?php

session_start();
require_once "../../conf/pathconf.php";
require_once "phpgraphlib.php";
require_once "phpgraphlib_pie.php";
$data = $_SESSION["_pasteltmp_data"];
$titulo = $_SESSION["_pasteltmp_titulo"];
$width = $_SESSION["_pasteltmp_width"];
$height = $_SESSION["_pasteltmp_height"];
/*$_SESSION["_pasteltmp_data"] = null;
$_SESSION["_pasteltmp_titulo"] = null;
$_SESSION["_pasteltmp_width"] = null;
$_SESSION["_pasteltmp_height"] = null;*/
$graph = new PHPGraphLibPie($width, $height, XTSITE_PATH_ABSOLUTE . "tmp/pie/_" . $_SESSION["USERID"] . $_SESSION["TIPOID"] . "pieimagen.png");
$graph->addData($data);
$graph->setTitle($titulo);
$graph->setLabelTextColor('50,50,50');
$graph->setLegendTextColor('50,50,50');
$graph->createGraph();
             }
         }
         // execute as many database queries as we need for our host to subnet assignment
         foreach ($sql as $key => $value) {
             if (($res = $db->dbQuery($val->ValidateSQL($value, $dbconn), $dbconn)) !== -1) {
                 $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']);
Esempio n. 6
0
<?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();
}
Esempio n. 7
0
             }
         }
         // execute as many database queries as we need for our host to subnet assignment
         foreach ($sql as $key => $value) {
             if (($res = $db->dbQuery($val->ValidateSQL($value, $dbconn), $dbconn)) !== -1) {
                 $hostdata[$key] = $db->dbArrayResults($res);
             }
         }
         // now build an unassigned list
         $sql['hosts'] = "SELECT * FROM `conf_hosts` WHERE `pxe-group` IS NULL OR `pxe-group` = ''";
         if (($value = $db->dbQuery($val->ValidateSQL($sql['hosts'], $dbconn), $dbconn)) !== -1) {
             $hostdata['unassigned'] = $db->dbArrayResults($value);
         }
         // generate our graphs
         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 PXE Group Assignments: Total hosts to pxe groups #" . $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']);
<?php

$dbhost = 'localhost';
$dbuser = '******';
$dbpass = '******';
$link = mysql_connect($dbhost, $dbuser, $dbpass) or die('Could not connect: ' . mysql_error());
mysql_select_db('buttonnb') or die('Could not select database');
$data = array();
//get data from database
$sql = "SELECT return_value, currtime FROM balr2_tbl LIMIT 150";
$result = mysql_query($sql) or die('Query failed: ' . mysql_error());
if ($result) {
    while ($row = mysql_fetch_assoc($result)) {
        $return_value = $row["return_value"];
        $count = $row["currtime"];
        //add to data areray
        $data[$count] = $return_value;
    }
}
include 'phpgraphlib.php';
include 'phpgraphlib_pie.php';
$graph = new PHPGraphLibPie(400, 200);
$graph->addData($data);
$graph->setTitle('Analyze');
//$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();
Esempio n. 9
0
<?php

require_once dirname(__FILE__) . '\\..\\util.php';
require_dao('answersDAO');
require_abs('images/graphs/phpgraphlib.php');
require_abs('images/graphs/phpgraphlib_pie.php');
use Qnet\Dao\AnswersDAO;
$questionId = $_GET['qid'];
$title = $_GET['title'];
$dao = new AnswersDAO();
$dao->selectAnswersByQuestionId($questionId);
$graph = new PHPGraphLibPie(400, 200);
$data = array();
foreach ($dao->getLabelsAndCountsMap() as $label => $count) {
    $data[$label] = $count;
}
$graph->addData($data);
if ($title != null) {
    $graph->setTitle($title);
}
//$graph->setLabelTextColor('50,50,50');
//$graph->setLegendTextColor('50,50,50');
$graph->createGraph();