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();
<?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 create_graph($graph_type = '') { $graph = new PHPGraphLib(1400, 600); $model = new TwextraModel(); //$data = array("Alex"=>99, "Mary"=>98, "Joan"=>70, "Ed"=>90); if ($graph_type == 'daily_stats') { $data = $model->get_stats_daily(); $graph->setTitle("Daily Unique Traffic"); } else { if ($graph_type == 'message_history') { //this graph is currently not plotted! $screen_name = 'rajen4126'; $message_from = 0; $next = 20; $order = 'created'; $asc_desc = 'desc'; $length = 20; $data = $model->get_message_history($screen_name, $message_from, $next, $order, $asc_desc, $length); foreach ($data as $entry) { $data[$entry[message_id]] = $entry[view_count]; } $graph->setTitle("Message History"); } else { if ($graph_type == 'monthly_stats') { $data = $model->get_monthly_uniques(); $graph->setTitle("Monthly Unique Traffic"); } else { if ($graph_type == 'messages_stats') { $data = $model->get_messages_stats(); $graph->setTitle("Daily Messages Created"); } else { $data = array(); } } } } $graph->addData($data); $graph->setTextColor("blue"); //additions for a line graph.......... $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'); //........ return $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 }
function make_graph_multi_line($title, $data_min, $data_avg, $data_max, $is_bar_graph) { include 'phpgraphlib.php'; $graph = new PHPGraphLib(780, 300); if ($is_bar_graph == 'true') { $graph->setBars(true); $graph->setLine(false); } else { $graph->setBars(false); $graph->setLine(true); } $graph->setDataPoints(true); $graph->setDataPointSize(4); $graph->setDataPointColor('purple'); $graph->setLegend(true); if (!isset($data_min)) { $graph->addData($data_avg); $graph->addData($data_max); if ($is_bar_graph == 'true') { $graph->setBarColor('purple', 'red'); } else { $graph->setLineColor('purple', 'red'); } $graph->setLegendTitle('avg', 'max'); } else { $graph->addData($data_min); $graph->addData($data_avg); $graph->addData($data_max); if ($is_bar_graph == 'true') { $graph->setBarColor('blue', 'purple', 'red'); } else { $graph->setLineColor('blue', 'purple', 'red'); } $graph->setLegendTitle('min', 'avg', 'max'); } $graph->setTitle($title); $graph->setTitleColor("88,89,91"); $graph->setXValuesVertical(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}\">"; }
$link = mysql_connect($dbhost, $dbuser, $dbpass) or die('Could not connect: ' . mysql_error()); mysql_select_db('buttonnb') or die('Could not select database'); $dataArray = array(); //get data from database $sql = "SELECT temperature, id, currtime FROM biltong LIMIT 150"; $result = mysql_query($sql) or die('Query failed: ' . mysql_error()); if ($result) { while ($row = mysql_fetch_assoc($result)) { $temperature = $row["temperature"]; $count = $row["currtime"]; //add to data areray $dataArray[$count] = $temperature; print '<p>'; print 'id=' . $row['id']; print ',temperature=' . $row['temperature']; print 'currtime=' . $row['currtime']; print '</p>'; } } //configure graph $graph->addData($dataArray); $graph->setTitle("Temperature"); $graph->setGradient("lime", "green"); $graph->setBarOutlineColor("black"); $graph->setBars(false); $graph->setLine(true); $graph->createGraph(); //echo $sql; ?>
<?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 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 include '../phpgraphlib.php'; $set1 = array(1917 => 4011, 1918 => 4886, 1919 => 5411, 1920 => 5831, 1921 => 5865, 1922 => 5704, 1923 => 5337, 1924 => 5144, 1925 => 5018, 1926 => 4971, 1927 => 4630, 1928 => 4411, 1929 => 4287, 1930 => 4116, 1931 => 3940, 1932 => 3764, 1933 => 3592, 1934 => 3447, 1935 => 3280, 1936 => 3215, 1937 => 3366, 1938 => 3569, 1939 => 3598, 1940 => 4436, 1941 => 5939, 1942 => 7397, 1943 => 8855, 1944 => 9835, 1945 => 9998, 1946 => 10631, 1947 => 11340, 1948 => 11549, 1949 => 11642); $set2 = array(1910 => 2059, 1911 => 2135, 1912 => 2209, 1913 => 2332, 1914 => 2437, 1915 => 2786, 1916 => 3747, 1917 => 5011, 1918 => 5886, 1919 => 6411, 1920 => 6831, 1921 => 6865, 1922 => 6704, 1923 => 6337, 1924 => 6144, 1925 => 6018, 1926 => 5971, 1927 => 5630, 1928 => 5411, 1929 => 5287, 1930 => 5116, 1931 => 4940, 1932 => 4764, 1933 => 4592, 1934 => 4447, 1935 => 4280, 1936 => 4215, 1937 => 4366, 1938 => 4569, 1939 => 4598, 1940 => 5436, 1941 => 5939, 1942 => 8397, 1943 => 9855, 1944 => 10835); $graph = new PHPGraphLib(600, 400); $graph->addData($set1, $set2); $graph->setTitleLocation('left'); $graph->setTitle("Two sets with different start points"); $graph->setBars(false); $graph->setLine(true); $graph->setDataPoints(false); $graph->setLineColor('blue', 'red'); $graph->setDataValues(false); $graph->setXValuesInterval(5); $graph->setDataValueColor('blue', 'red'); $graph->setLegend(true); $graph->setLegendTitle("set1", "set2"); $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 /********************************************************************* 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 '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();
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"); if (count($results) > 0) { $data = array(); foreach ($results as $line) {
$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); $graph->setDataPointColor('black'); $graph->setDataValues(true); $graph->setDataValueColor('black'); $graph->setGoalLine(6000); $graph->setGoalLineColor('blue'); $graph->createGraph();
<?php include 'phpgraphlib.php'; $graph = new PHPGraphLib(480, 300); $data = array("Sunday" => 145, "Monday" => 102, "Tuesday" => 123, "Wednesday" => 137, "Thursday" => 149, "Friday" => 99, "Saturday" => 88); $graph->setBackgroundColor("black"); $graph->addData($data); $graph->setBarColor('255,255,204'); $graph->setTitle('This Week Sell of $Item'); $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();
// "5" => .0034, "6" => .0031, "7" => .0036, "8" => .0027, "9" => .0024, // "10" => .0021, "11" => .0026, "12" => .0024, "13" => .0036, // "14" => .0028, "15" => .0025); $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; } } $graph->addData($data); $graph->setTitle('Analyze'); $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(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();
$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 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 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 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 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 include '../phpgraphlib.php'; $graph = new PHPGraphLib(500, 350); $data = array(12124, 5535, 43373, 22223, 90432, 23332, 15544, 24523, 32778, 38878, 28787, 33243, 34832, 32302); $graph->addData($data); $graph->setTitle('Widgets Produced'); $graph->setGradient('red', 'maroon'); $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 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();
//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();
} $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"])) { ImageText::createTextImage($chartWidth, $chartHeight, "Neturima duomenų apie pasirinktą mėnesį"); exit(0); } $chartData = array(); foreach ($dbResult["data"] as $i) { $chartData[$i["Kodas"]] = $i["Paraiskos"]; } $graph->addData($chartData); drawAnalysisGraph($graph); break; case "is_paraiskos": if (!isset($_GET["menuo"])) {