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; }
\t\t\t\t\tFROM ( \t\t\t\t\t\tSELECT m.id, count(*) as cnt \t\t\t\t\t\tFROM medlemmer as m, fremmoede as f \t\t\t\t\t\tWHERE m.id = f.mid AND dag >= '{$start_date}' AND dag < '{$end_date}' \t\t\t\t\t\tGROUP BY m.id \t\t\t\t\t\t) as t1 \t\t\t\t\tGROUP BY cnt \t\t\t\t\tORDER BY cnt ASDF; $query = query($sql); //default data $data = array(1 => 0, 2 => 0, 3 => 0, 4 => 0, 5 => 0); //actual data $cnt = 0; while ($row = $query->tryGet()) { $cnt++; while ($row[0] !== "{$cnt}") { $data[$cnt] = 0; $cnt++; } $data[$cnt] = $row[1]; } //graph $graph = new PHPGraphLib(400, 350); $graph->addData($data); $graph->setTitle($caption); $graph->setGradient('red', 'maroon'); $graph->setYValues(false); $graph->setXValuesHorizontal(true); $graph->setDataValues(true); $graph->createGraph();
public function gbarra_getImagen($titulo = " ", $width = "500", $height = "350") { $config = XTConfig::singleton(); $data = $this->barra_data; $nombreimagen = uniqid() . "barraimagen.png"; $file = $config->get("XTSITE_PATH_ABSOLUTE") . "tmp/pie/" . $nombreimagen; $file_url = $config->get("XTSITE_PATH") . "tmp/pie/" . $nombreimagen; $graph = new PHPGraphLib($width, $height, $file); $graph->addData($data); //$graph->setBarColor('255,255,204'); $graph->setGradient('255,255,204', '254,254,154'); if ($titulo != "") { $graph->setTitle($titulo); } $graph->setLineColor('maroon'); $graph->setDataPointColor('maroon'); $graph->setXValuesHorizontal(true); $graph->setLine(true); $graph->setDataPoints(true); $graph->setDataValues(true); $graph->createGraph(); print "<img src=\"{$file_url}\">"; }
<?php include '../phpgraphlib.php'; $graph = new PHPGraphLib(350, 280); $data = array("Roger" => 145, "Ralph" => 102, "Rhonda" => 123, "Ronaldo" => 137, "Rosario" => 149, "Robin" => 99, "Robert" => 88, "Rustof" => 111); $graph->setBackgroundColor("black"); $graph->addData($data); $graph->setBarColor('255, 255, 204'); $graph->setTitle('IQ Scores'); $graph->setTitleColor('yellow'); $graph->setupYAxis(12, 'yellow'); $graph->setupXAxis(20, 'yellow'); $graph->setGrid(false); $graph->setGradient('silver', 'gray'); $graph->setBarOutlineColor('white'); $graph->setTextColor('white'); $graph->setDataPoints(true); $graph->setDataPointColor('yellow'); $graph->setLine(true); $graph->setLineColor('yellow'); $graph->createGraph();
//mysqli_select_db($link,'gfb11176') or die('Could not select database'); //mysql_select_db("mydatabase") or die("MySQL Error: " . mysql_error()); $dataArray = array(); // Get the values from the COReadings table for the currently logged in user. $sql = "SELECT COValue, AddedOn FROM COReadings \n\t\tJOIN COUsers ON COUsers.id = COReadings.UserID\n\t\tWHERE COUsers.Email = '{$email}'"; $result = mysqli_query($link, $sql) or die('Query failed: ' . mysql_error()); if ($result) { while ($row = mysqli_fetch_assoc($result)) { $dateAdded = $row["AddedOn"]; $count = $row["COValue"]; // Add to data array $dataArray[$dateAdded] = $count; } } // Configure graph $graph->addData($dataArray); $graph->setTitle("Carbon Monoxide Readings"); $graph->setTitleColor('navy'); $graph->setGradient("lime", "green"); $graph->setBars(false); $graph->setLine(true); $graph->setDataPoints(true); $graph->setDataValues(true); $graph->setDataValueColor('navy'); $graph->setDataPointColor('navy'); $graph->setXValuesHorizontal(true); //$graph->setBackgroundColor("black"); $graph->setYAxisTextColor('black'); $graph->setXAxisTextColor('black'); $graph->setLineColor('navy'); $graph->createGraph();
<?php extract($_REQUEST); include 'class/DBConn.php'; include "class/phpgraphlib.php"; $POTotal['1'] = 0; $POTotal['2']; $POTotal['3'] = 0; $POTotal['4'] = 0; $POTotal['5'] = 0; $POTotal['6'] = 0; $sql = "SELECT doc_type, total, B.exchange FROM purchases A, currencies B\r\n where doc_tag='po'\r\n AND A.currency = B.id\r\n AND YEAR( A.po_date ) = {$year}\r\n AND MONTH( A.po_date ) = {$month}\r\n ORDER BY doc_type"; connectToDB(); $result = mysql_query($sql) or die("error"); //doc_type, total, currency, exchange while ($row = mysql_fetch_array($result)) { $doc = $row['doc_type']; $inRinggit = $row['total'] * $row['exchange']; $POTotal[$doc] = $POTotal[$doc] + $inRinggit; } //header('Content-Type: image/png'); $graph = new PHPGraphLib(400, 300); $data = array("PO1" => $POTotal['1'], "PO2" => $POTotal['2'], "PO3" => $POTotal['3'], "PO4" => $POTotal['4'], "PO5" => $POTotal['5'], "PO6" => $POTotal['6']); $graph->addData($data); $graph->setTitle("Purchase Order Report "); $graph->setGradient("red", "maroon"); $graph->createGraph();
<?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();
<?php /********************************************************************* chart.php Configuring and creating report chart. Use the PHPGraphLib library. Copyright (c) 2012-2014 Katak Support http://www.katak-support.com/ Released under the GNU General Public License WITHOUT ANY WARRANTY. See LICENSE.TXT for details. $Id: $ **********************************************************************/ include "../include/lib/phpgraphlib.php"; // receive data $data = unserialize(urldecode(stripslashes($_GET['mydata']))); // instantiate the graph $graph = new PHPGraphLib(570, 380); //configure graph $graph->addData($data); $graph->setTitle("Tickets per month"); $graph->setGradient("black", "lime"); $graph->setBarOutlineColor("black"); $graph->setDataValues(TRUE); $graph->setYValues(false); $graph->createGraph();
<?php include '../phpgraphlib.php'; $graph = new PHPGraphLib(495, 280); $data = array('alpha' => 23, 'beta' => 45, 'cappa' => 20, 'delta' => 32, 'echo' => 14); $data2 = array('alpha' => 15, 'beta' => 23, 'cappa' => 23, 'delta' => 12, 'echo' => 17); $data3 = array('alpha' => 43, 'beta' => 23, 'cappa' => 34, 'delta' => 16, 'echo' => 20); $data4 = array('alpha' => 23, 'beta' => 34, 'cappa' => 23, 'delta' => 9, 'echo' => 8); $graph->addData($data, $data2, $data3, $data4); $graph->setupYAxis("15"); $graph->setGradient('teal', '#0000FF'); $graph->setXValuesHorizontal(true); $graph->setXAxisTextColor('navy'); $graph->setLegend(true); $graph->setLegendTitle('M1', 'M2', 'M3', 'M4'); $graph->createGraph();
$hl = $XAxisLength * 6; $h = $hl + 200; //entered as % of graph width/height $YAxisLength = 100 * $wl / $w; $XAxisLength = 100 * $hl / $h; /* echo '<pre>'; print_r(array( 'GET' => $_GET, 'from' => $from, 'num' => $num, 'totalNum' => $totalNum, 'labels' => $labels, 'values' => $values, 'data' => $data, 'w' => $w, 'h' => $h, 'YAxisLength' => $YAxisLength, 'XAxisLength' => $XAxisLength, )); echo '</pre>'; exit; */ include "phpgraphlib.php"; $graph = new PHPGraphLib($w, $h); $graph->addData($data); $graph->setTitle($title); $graph->setupXAxis($XAxisLength, "black"); $graph->setupYAxis($YAxisLength, "black"); $graph->setGradient("156,189,225", "19,92,184"); $graph->createGraph();
<?php include 'phpgraphlib.php'; $graph = new PHPGraphLib(350, 280); $data = array("Day1" => 0.5, "Day2" => 0, "Day3" => 0.5, "Day4" => 0, "Day5" => 0.5, "Day6" => 0, "Day7" => 1, "Day8" => 0, "Day9" => 2.5); //$graph->setBackgroundColor("black"); $graph->addData($data); $graph->setBarColor('255,255,204'); $graph->setTitle('Workout Summary'); $graph->setTitleColor('black'); $graph->setupYAxis(15, 'black'); $graph->setupXAxis(20, 'black'); $graph->setGrid(false); $graph->setGradient('blue', 'white'); $graph->setBarOutlineColor('white'); $graph->setTextColor('black'); $graph->setDataPoints(true); $graph->setDataPointColor('red'); $graph->setLine(true); $graph->setLineColor('red'); $graph->createGraph();
<?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(); }
<?php include 'include/phpgraphlib.php'; include 'forum_data.php'; global $dato; global $num_rows; $i = 0; $graph = new PHPGraphLib(900, 500); $data = array(); for ($i = 0; $i < $num_rows; $i++) { $data[$dato["uname"][$i]] = $dato["num_post"][$i]; } $graph->addData($data); $graph->setTitle("Numero post nel forum negli ultimi 30 giorni"); $graph->setTextColor("red"); $graph->setGradient("green", "yellow"); $graph->createGraph();