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; }
<?php require $_SERVER['DOCUMENT_ROOT'] . '/y/includes/config.php'; include "phpgraphlib.php"; $graph = new PHPGraphLib(500, 300); $dataArray = array(); $sql = "SELECT purchase_date, SUM(totalcost) AS 'tot' FROM item_purchase GROUP BY purchase_date"; $result = mysql_query($sql) or die('Query failed: ' . mysql_error()); if ($result) { while ($row = mysql_fetch_assoc($result)) { $purchaseDate = $row["purchase_date"]; $sum = $row["tot"]; $dataArray[$purchaseDate] = $sum; } } $graph->addData($dataArray); $graph->setBars(false); $graph->setLine(true); $graph->setDataPoints(true); $graph->setDataPointColor('maroon'); $graph->setDataValues(true); $graph->setDataValueColor('maroon'); $graph->setGoalLine(8000); $graph->setGoalLineColor('red'); $graph->createGraph();
\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();
<?php require '../functions.php'; require 'phpgraphlib.php'; date_default_timezone_set('America/New_York'); $display = strtotime("30 days ago"); $query = mysql_query("Select `EditTime` from `Wiki_Edits` where `EditTime` > {$display} order by `EditTime` asc"); while (list($time) = mysql_fetch_array($query)) { $when = date('d M', $time); $data[$when]++; } $graph = new PHPGraphLib(800, 400); $graph->addData($data); $graph->setTitle("Edits This Month"); $graph->setTextColor("blue"); $graph->createGraph();
function returnColorArray($color) { //THIS FUNCTION FIRST CHECKS EXISITNG COLORS IN PHPGraphLib //THEN IF NOT FOUND CHECKS ITS OWN LIST //COMES WITH VARIOUS PRESET LIGHTER PIE CHART FRIENDLY COLORS if ($resultColor = PHPGraphLib::returnColorArray($color)) { return $resultColor; } else { //REMOVE LAST ERROR GENERATED (PHPGraphLib::returnColorArray) SETS ONLY ONE ERROR IF FALSE) array_pop($this->error); //CHECK TO SEE IF NUMERIC COLOR PASSED THROUGH IN FORM '128,128,128' if (strpos($color, ',') !== false) { return explode(',', $color); } switch (strtolower($color)) { //BR's colors case 'passed': return array(170, 255, 170); break; case 'failed': return array(255, 123, 123); break; case 'notdone': return array(192, 192, 192); break; //NAMED COLORS BASED ON W3C's RECOMMENDED HTML COLORS //NAMED COLORS BASED ON W3C's RECOMMENDED HTML COLORS case 'pastel_orange_1': return array(238, 197, 145); break; case 'pastel_orange_2': return array(238, 180, 34); break; case 'pastel_blue_1': return array(122, 197, 205); break; case 'pastel_green_1': return array(102, 205, 0); break; case 'pastel_blue_2': return array(125, 167, 217); break; case 'pastel_green_2': return array(196, 223, 155); break; case 'clay': return array(246, 142, 85); break; case 'pastel_yellow': return array(255, 247, 153); break; case 'pastel_purple': return array(135, 129, 189); break; case 'brown': return array(166, 124, 81); break; } $this->error[] = "Color name \"{$color}\" not recogized."; return false; } }
protected function returnColorArray($color) { //this function first checks exisitng colors in phpgraphlib //then if not found checks its own list //comes with various preset lighter pie chart friendly colors if ($resultColor = parent::returnColorArray($color)) { return $resultColor; } else { //remove last error generated (phpgraphlib::returncolorarray) sets only one error if false) array_pop($this->error); //check to see if numeric color passed through in form '128,128,128' if (strpos($color, ',') !== false) { return explode(',', $color); } switch (strtolower($color)) { //named colors based on w3c's recommended html colors case 'pastel_orange_1': return array(238, 197, 145); break; case 'pastel_orange_2': return array(238, 180, 34); break; case 'pastel_blue_1': return array(122, 197, 205); break; case 'pastel_green_1': return array(102, 205, 0); break; case 'pastel_blue_2': return array(125, 167, 217); break; case 'pastel_green_2': return array(196, 223, 155); break; case 'clay': return array(246, 142, 85); break; case 'pastel_yellow': return array(255, 247, 153); break; case 'pastel_purple': return array(135, 129, 189); break; case 'brown': return array(166, 124, 81); break; } $this->error[] = "Color name \"{$color}\" not recogized."; return false; } }
$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(400, 300); $data = array("Alex" => 99, "Mary" => 98, "Joan" => 70, "Ed" => 90); $graph->addData($data); $graph->setTitle("Test Scores"); $graph->setTextColor("blue"); $graph->createGraph(); ?>
<?php require '../functions.php'; require 'phpgraphlib.php'; date_default_timezone_set('America/New_York'); // Use date to generate the current day. // Omitting the specific time passed makes strtotime() return today's first second. $Today = strtotime(date("d F Y")); $Day = 86400; // Seconds $LastWeek = $Today - $Day * 30; $Query = mysql_query("Select `Time` from `Wiki Searches` where `Time` > {$LastWeek}"); while (list($Time) = mysql_fetch_array($Query)) { $When = date('d M', $Time); $Data[$When]++; } $Graph = new PHPGraphLib(800, 400); $Graph->addData($Data); $Graph->setTitle("Searches This Month"); $Graph->setTextColor("blue"); $Graph->createGraph();
<?php session_start(); include "graph/phpgraphlib.php"; $graph = new PHPGraphLib(680, 300, "haha.png"); ?> <?php $servername = "localhost"; $username = "******"; $password = ""; $dbname = "irctc_data"; $conn = new mysqli($servername, $username, $password, $dbname); if ($conn->connect_error) { die("Database Connectivity Error! Please report to admin." . $conn->connect_error); } $dataArray = array(); $hold1 = 0; $hold2 = 0; $arg1 = $_GET["month1"] . $_GET["year1"]; $sql = "SELECT `TktsBkd` FROM actualdata WHERE `id`= {$arg1}"; $result = $conn->query($sql); if ($result->num_rows > 0) { while ($row = $result->fetch_assoc()) { $hold1 = $row["TktsBkd"]; } } $arg2 = $_GET["month2"] . $_GET["year2"]; $sql = "SELECT `TktsBkd` FROM actualdata WHERE `id`= {$arg2}"; $result = $conn->query($sql); if ($result->num_rows > 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();
session_start(); require 'config.php'; require KU_ROOTDIR . 'lib/dwoo.php'; require KU_ROOTDIR . 'inc/functions.php'; require KU_ROOTDIR . 'inc/classes/manage.class.php'; require KU_ROOTDIR . 'inc/classes/board-post.class.php'; require KU_ROOTDIR . 'inc/classes/bans.class.php'; $dwoo_data->assign('styles', explode(':', KU_MENUSTYLES)); $manage_class = new Manage(); $bans_class = new Bans(); if (isset($_GET['graph'])) { $manage_class->ValidateSession(); require KU_ROOTDIR . 'lib/graph/phpgraphlib.php'; if (isset($_GET['type'])) { if ($_GET['type'] == 'day' || $_GET['type'] == 'week' || $_GET['type'] == 'postnum' || $_GET['type'] == 'unique' || $_GET['type'] == 'posttime') { $graph = new PHPGraphLib(600, 600); if ($_GET['type'] == 'day') { $setTitle = 'Posts per board in past 24hrs'; $graph->setTitle($setTitle); $results = $tc_db->GetAll("SELECT HIGH_PRIORITY * FROM `" . KU_DBPREFIX . "boards` ORDER BY `name` ASC"); if (count($results) > 0) { $data = array(); foreach ($results as $line) { $posts = $tc_db->GetOne("SELECT HIGH_PRIORITY COUNT(*) FROM `" . KU_DBPREFIX . "posts` WHERE `boardid` = " . $line['id'] . " AND `timestamp` > " . (time() - 86400) . ""); $data = array_merge($data, array($line['name'] => $posts)); } } } elseif ($_GET['type'] == 'week') { $setTitle = 'Posts per board in past week'; $graph->setTitle($setTitle); $results = $tc_db->GetAll("SELECT HIGH_PRIORITY * FROM `" . KU_DBPREFIX . "boards` ORDER BY `name` ASC");
<?php include 'graph/phpgraphlib.php'; $graph = new PHPGraphLib(650, 200); $data = array(1.02, 0.667, 0.367, 0.278, 0.237, 0.187, 0.155, 0.156, 0.142, 0.111, 0.12, 0.097, 0.099, 0.089, 0.079); $graph->addData($data); $graph->setTitle('Banyak Obat Terlarut'); $graph->setBars(false); $graph->setLine(true); $graph->setDataPoints(true); $graph->setDataPointColor('maroon'); $graph->setDataValues(true); $graph->setDataValueColor('maroon'); $graph->setGoalLine(0.0025); $graph->setGoalLineColor('red'); $graph->createGraph();
<?php include './phpgraphlib.php'; $graph = new PHPGraphLib(1000, 350); //$data = array(12124, 5535, 43373, 22223, 90432, 23332, 15544, 24523, 32778, // 38878, 28787, 33243, 34832, 32302); $link = mysql_connect('localhost', 'root', 'Cookiemonster1!') or die('Could not connect: ' . mysql_error()); mysql_select_db('healthbuddies') or die('Could not select database'); $dataArray = array(); //get data from database $sql = "SELECT date, steps FROM steps"; $result = mysql_query($sql) or die('Query failed: ' . mysql_error()); if ($result) { while ($row = mysql_fetch_assoc($result)) { $salesgroup = $row["date"]; $count = $row["steps"]; //add to data areray $dataArray[$salesgroup] = $count; } } //configure graph //$graph->addData($dataArray); //$graph->setTitle("Steps"); //$graph->setGradient("lime", "green"); //$graph->setBarOutlineColor("black"); //$graph->createGraph(); $graph->addData($dataArray); $graph->setTitle('Steps'); $graph->setBars(false); $graph->setLine(true); $graph->setDataPoints(true);
<?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();
<?php error_reporting(0); session_start(); include 'phpgraphlib.php'; $servername = "mysql.hostinger.in"; $username = "******"; $password = "******"; $conn = mysqli_connect($servername, $username, $password); if (!$conn) { die("Connection failed: " . mysqli_connect_error()); } mysqli_select_db($conn, "u629516793_udb"); $graph = new PHPGraphLib(1000, 500); $lenddata = array(); $borrowdata = array(); $all = array(array()); $sql = "SELECT LB, remote_ID, name, amount, transdate FROM firsttable"; $result = mysqli_query($conn, $sql); if (mysqli_num_rows($result) > 0) { while ($row = mysqli_fetch_assoc($result)) { if ($row['remote_ID'] == $_SESSION['handle']) { if ($row['name'] == $_SESSION["graphval"]) { if ($row['LB'] == 'L') { if (array_key_exists($row['transdate'], $lenddata)) { $lenddata[$row['transdate']] = $lenddata[$row['transdate']] + $row['amount']; } else { $lenddata[$row['transdate']] = $row['amount']; } } else { if (array_key_exists($row['transdate'], $borrowdata)) {
function PHPGraphLibStacked($width = '', $height = '') { PHPGraphLib::PHPGraphLib($width, $height); }
<?php include '../phpgraphlib.php'; $graph = new PHPGraphLib(450, 300); $data = array("Jan" => -10.1, "Feb" => -3.6, "Mar" => 11.0, "Apr" => 30.7, "May" => 48.6, "Jun" => 59.8, "Jul" => 62.5, "Aug" => 56.8, "Sep" => 45.5, "Oct" => 25.1, "Nov" => 2.7, "Dec" => -6.5); $graph->addData($data); $graph->setBarColor('navy'); $graph->setupXAxis(20, 'blue'); $graph->setTitle('Average Temperature by Month, in Fairbanks Alaska'); $graph->setTitleColor('blue'); $graph->setGridColor('153,204,255'); $graph->setDataValues(true); $graph->setDataValueColor('navy'); $graph->setDataFormat('degrees'); $graph->setGoalLine('32'); $graph->setGoalLineColor('red'); $graph->createGraph();
<?php session_start(); require_once "../Includes.php"; //print("<img src=\"../Utilities/Charts.php?chart=padaliniu_paraiskos&menuo=2008-01-01\">"); $graph = new PHPGraphLib(650, 200); $data1 = array(0); $data2 = array(8, 15, 4, 12); $data3 = array(1, 2, 3, 4); $graph->addData($data2); $graph->setTitle('PPM Per Container'); $graph->setBars(false); $graph->setLine(true); $graph->setLineColor('#FF0000', 'green', 'red'); $graph->setDataPoints(true); $graph->setDataPointColor('maroon'); $graph->setDataValues(true); $graph->setDataValueColor('maroon'); $graph->setLegend(true); $graph->setLegendTitle("PA1", "PA2", "PA3"); $graph->createGraph(); p(ErrorMessages::getErrors());
<?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();
define("STANDARD_CHART_HEIGHT", 200); $chartWidth = STANDARD_CHART_WIDTH; $chartHeight = STANDARD_CHART_HEIGHT; if (isset($_GET["width"])) { $chartWidth = (int) $_GET["width"]; } if (isset($_GET["height"])) { $chartHeight = (int) $_GET["height"]; } if (!isset($_GET["chart"])) { ImageText::createTextImage($chartWidth, $chartHeight, "Bloga nuoroda"); exit(0); } $chart = repairSqlInjection($_GET["chart"]); //$chartType = repairSqlInjection($_GET["type"]); $graph = new PHPGraphLib($chartWidth, $chartHeight); switch ($chart) { case "padaliniu_paraiskos": if (!isset($_GET["menuo"])) { ImageText::createTextImage($chartWidth, $chartHeight, "Bloga nuoroda"); exit(0); } $data = $_GET["menuo"] . "-01"; if (ObjectValidation::validateDate($data) == false) { ImageText::createTextImage($chartWidth, $chartHeight, "Blogas datos formatas"); exit(0); } $graph->setTitle($data); $dbQuery = "SELECT * FROM PadaliniuParaiskuKiekis WHERE Nuo = '" . $data . "'"; $dbResult = db::select($dbQuery); if (empty($dbResult["data"])) {
<?php include "phpgraphlib.php"; $graph = new PHPGraphLib(550, 350); $link = @mysql_connect('localhost', 'root', 'root') or die('Could not connect: ' . mysql_error()); mysql_select_db('mas') or die('Could not select database'); $dataArray = array(); $name = $_POST['name']; $gen = $_POST['gen']; $year = $_POST['yr']; $sql = "select amount, year from master where name='{$name}' and year >= {$year} and gen_code={$gen}"; $qry = mysql_query($sql); if ($qry) { while ($row = mysql_fetch_assoc($qry)) { $year = $row["year"]; $amount = $row["amount"]; //add to data areray $dataArray[$year] = $amount; } } //configure graph $graph->addData($dataArray); $graph->setTitle("Sales by Group"); $graph->setGradient("lime", "green"); $graph->setBarOutlineColor("black"); $graph->createGraph();
public function getGraphData() { $company = Input::get('company'); $interval = Input::get('interval'); $precision = Input::get('prc'); $company_symbol = isset($company) && !empty($company) ? $company : 'goog'; $interval = isset($interval) && !empty($interval) ? $interval : 'd'; $precision = isset($precision) && !empty($precision) && is_numeric($precision) ? $precision : 1; $stock_market = new StockMarket($company_symbol, $interval, $precision); //<---class declared here and passed the datas /* // <--utilizing the function for finding the Company name from Symbol //<-- to check the given company symbol is correct or not */ $company_name = $stock_market->find_company_name_from_symbol(); if ($company_name) { //<-- if company name given is not false go further $stock_records = $stock_market->get_the_market_data(); //<--function to collect Historical data for given company symbol if ($stock_records) { //<----if it retuns a record then proceed $range_from = $stock_market->get_graph_range_start(); //<--this function helps to calculate historical Graph area minmum range $range_to = $stock_market->get_graph_range_ends(); //<--this function helps to calculate historical Graph area maximum range $lower_range_coords = $stock_market->get_lower_price_data(); //<--this function helps to return the lower price data for graph $higher_range_coords = $stock_market->get_higher_price_data(); //<--this function helps to return the higher price data for graph $graph = new PHPGraphLib(470, 270); $graph->addData($lower_range_coords); $graph->addData($higher_range_coords); $graph->setRange($range_from, $range_to); $graph->setTitle($company_name . ' Graph'); $graph->setBars(false); $graph->setLine(true); $graph->setDataPoints(true); $graph->setDataPointColor('maroon'); $graph->setDataPointColor('red'); $graph->setDataValues(true); $graph->setDataValueColor('blue'); $graph->setGoalLine(0.25); $graph->setGoalLineColor('red'); $graph->createGraph(); //<--this draw the graph $contents = View::make('graph')->with('graph', $graph); // Create a response and modify a header value $response = Response::make($contents, 200); $response->header('Content-Type', 'image/png'); return $response; } //<-- stock data checks ends } //<--company name check ends }
<?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 "CheckIfUserNotLogin.php"; include "phpgraphlib.php"; $email = $_SESSION['login']; $graph = new PHPGraphLib(1010, 425); $link = mysqli_connect("devweb2013.cis.strath.ac.uk", "ckb12185", "cengonap", "ckb12185") or die('Could not connect: ' . mysql_error()); //$link = mysqli_connect("devweb2013.cis.strath.ac.uk", "gfb11176", "buonstat","gfb11176") or die('Could not connect: ' . mysql_error()); //$link = mysql_connect("localhost", "root", "") or die("MySQL Error: " . mysql_error()); mysqli_select_db($link, "ckb12185") or die('Could not select database'); //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);
<?php include '../phpgraphlib.php'; $graph = new PHPGraphLib(500, 450); $data = array("Jan" => -1324, "Feb" => -1200, "Mar" => -100, "Apr" => -1925, "May" => -1444, "Jun" => -957, "Jul" => -364, "Aug" => -221, "Sep" => -1300, "Oct" => -848, "Nov" => -719, "Dec" => -114); $graph->addData($data); $graph->setBarColor('255,255,204'); $graph->setTitle('Money Made at XYZ Corp'); $graph->setTextColor('gray'); $graph->createGraph();
<?php error_reporting(0); include "phpgraphlib.php"; $datavalues = $_GET['datavalues']; $showsmall = $_GET['showsmall']; $header = unserialize(urldecode(stripslashes($_GET['header']))); $data = unserialize(urldecode(stripslashes($_GET['mydata']))); $data2 = unserialize(urldecode(stripslashes($_GET['mywebdata']))); if ($showsmall) { $graph = new PHPGraphLib(300, 300); } else { $graph = new PHPGraphLib(500, 300); } $graph->addData($data); $graph->addData($data2); //$graph->setDataValues(true); //$graph->setLegend(true); //$graph->setLegendTitle('Your data','MyWebToNet'); $graph->setXValuesHorizontal(TRUE); $graph->setTitle($header); //$graph->setTitleLocation('left'); $graph->setTextColor('blue'); $graph->setBarColor('blue', 'green'); //$graph->setLegend(TRUE); $graph->createGraph();
<?php include 'phpgraphlib.php'; $graph = new PHPGraphLib(650, 200); $data = array("1" => 0.0032, "2" => 0.0028, "3" => 0.0021, "4" => 0.0033, "5" => 0.0034, "6" => 0.0031, "7" => 0.0036, "8" => 0.0027, "9" => 0.0024, "10" => 0.0021, "11" => 0.0026, "12" => 0.0024, "13" => 0.0036, "14" => 0.0028, "15" => 0.0025); $graph->addData($data); $graph->setTitle('PPM Per Container'); $graph->setBars(false); $graph->setLine(true); $graph->setDataPoints(true); $graph->setDataPointColor('maroon'); $graph->setDataValues(true); $graph->setDataValueColor('maroon'); $graph->setGoalLine(0.0025); $graph->setGoalLineColor('red'); $graph->createGraph();
<?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();
<?php require_once dirname(__FILE__) . '\\..\\util.php'; require_abs('images/graphs/phpgraphlib.php'); require_abs('images/graphs/phpgraphlib_pie.php'); require_controller('statisticsGraphicsController'); use Qnet\Controller\StatisticsGraphicsController; $sid = $_GET['sid']; $ctrl = new StatisticsGraphicsController(); $ctrl->computeStatistic($sid); if (!$ctrl->isDrawable()) { echo 'Cannot draw this statistic.'; } else { $big = $_GET['size'] == 'big'; $graph = new PHPGraphLib($big ? 800 : 400, $big ? 400 : 200); $graph->addData($ctrl->getData(0), $ctrl->getData(1), $ctrl->getData(2), $ctrl->getData(3), $ctrl->getData(4)); if ($ctrl->hasZ()) { $graph->setLegend(true); $graph->setLegendTitle($ctrl->getLegend(0), $ctrl->getLegend(1), $ctrl->getLegend(2), $ctrl->getLegend(3), $ctrl->getLegend(4)); } $graph->setXValuesHorizontal(true); $graph->createGraph(); }