Example #1
0
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();
}
Example #2
0
<?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();
Example #3
0
<?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();
Example #4
0
<?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();
Example #5
0
$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)) {
                        $borrowdata[$row['transdate']] = $borrowdata[$row['transdate']] + $row['amount'];
                    } else {
                        $borrowdata[$row['transdate']] = $row['amount'];
                    }
                }
            }
        }
    }
}
$graph->addData($lenddata, $borrowdata);
$graph->setXValuesHorizontal(TRUE);
$graph->setTextColor('blue');
$graph->setBarColor('green', 'red');
$graph->setLegend(TRUE);
$graph->setLegendTitle('Lended', 'Borrowed');
$graph->createGraph();
Example #6
0
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) {
    while ($row = $result->fetch_assoc()) {
        $hold2 = $row["TktsBkd"];
    }
}
$data = array("April" => $hold1, "May" => $hold2);
$graph->setBackgroundColor("#B2B09B");
$graph->addData($data);
$graph->setBarColor("#FF6F59", "#43AA8B");
$graph->setBarOutlineColor("#43AA8B");
$graph->setTitle("Test Scores");
$graph->setTextColor("#FFFCDD");
$graph->setBarOutlineColor("#72C4FF");
$graph->createGraph();
            break;
        case 'memuse':
            $graph = new PHPGraphLib(800, 450, "./result-" . date("Ymd") . "/memory-usage.png");
            $graph->addData($rsm['memuse']);
            $graph->setTitle("Memory Usage (KB)");
            break;
        case 'files':
            $graph = new PHPGraphLib(800, 450, "./result-" . date("Ymd") . "/number-of-files.png");
            $graph->addData($rsm['files']);
            $graph->setTitle("Number of files been included or required");
            break;
        case 'funcal':
            $graph = new PHPGraphLib(800, 450, "./result-" . date("Ymd") . "/number-of-function-calls.png");
            $graph->addData($rsm['funcal']);
            $graph->setTitle("Number fo function calls");
            break;
        case 'time':
            $graph = new PHPGraphLib(800, 450, "./result-" . date("Ymd") . "/response-time.png");
            $graph->addData($rsm['time']);
            $graph->setTitle("Response Time (Millisecond)");
            break;
        default:
            continue;
    }
    $graph->setTitleLocation('left');
    $graph->setBarColor('255,102,51');
    $graph->setDataValues(true);
    $graph->setXValuesHorizontal(true);
    $graph->setupXAxis(20, '');
    $graph->createGraph();
}