Ejemplo n.º 1
0
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();
}
Ejemplo n.º 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();
Ejemplo n.º 3
0
<?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();
?>

Ejemplo n.º 4
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();
Ejemplo n.º 5
0
<?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();
Ejemplo n.º 6
0
                            $data = array_merge($data, array($line['name'] => $times_avg));
                        }
                    }
                }
            }
            if ($posts <= 0) {
                header("Content-type: image/png");
                $handle = ImageCreate(600, 50) or die("Cannot Create image");
                $bg_color = ImageColorAllocate($handle, 255, 255, 255);
                $txt_color = ImageColorAllocate($handle, 255, 0, 0);
                ImageString($handle, 5, 5, 18, $setTitle . " : none", $txt_color);
                ImagePng($handle);
            } else {
                $graph->addData($data);
                $graph->setGradient('red', 'maroon');
                $graph->setTextColor('black');
                $graph->createGraph();
            }
        }
    }
    die;
}
/* Does nothing if the user isn't logged in */
$manage_class->SetModerationCookies();
/* Decide what needs to be done */
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'announcements';
switch ($action) {
    case 'logout':
        $manage_class->Logout();
        break;
    case 'showlogin':
Ejemplo n.º 7
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();
Ejemplo n.º 8
0
<?php

include "graph/phpgraphlib.php";
$graph = new PHPGraphLib(800, 600);
$data = unserialize(urldecode(stripslashes($_GET['mydata'])));
$graph->setBackgroundColor("#B2B09B");
$graph->addData($data);
$graph->setBarColor("#FF6F59", "#43AA8B");
$graph->setBarOutlineColor("#43AA8B");
$graph->setTitle("Comparisons-IRCTC");
$graph->setTextColor("blue");
$graph->setTextColor("#FFFCDD");
$graph->setBarOutlineColor("#72C4FF");
$graph->createGraph();
?>

Ejemplo n.º 9
0
<?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();