Exemplo n.º 1
0
    //Set some data
    if ($graph_type == 1) {
        //text-data (no time)
        $example_data = array($data_array, $data_array);
    } else {
        //data-data (any extra entries are time).
        $example_data = array($data_array);
    }
    $graph->SetDataValues($example_data);
    //Error_Reporting(0);
    $graph->SetPlotType($graph_type_str);
    $graph->SetLabelScalePosition(1.27);
    $graph->SetLegend($legend_array);
    if ($graph_type == 2) {
        $graph->SetYLabel($element);
        $graph->SetXLabel($cw['users']);
    } else {
        $graph->SetLegendPixels(1, 1, "");
    }
    //$graph->SetTitle("$element per user");
    //Draw it
    $graph->DrawGraph();
    //list things to change on the graph
} else {
    print_header($cw['graphs']);
    if (isset($graph_selected) && $graph_selected == 1) {
        echo sprintf($st[143], $element) . "<img src='{$_SERVER['PHP_SELF']}?graph_db={$graph_db}&draw_graph=1&graph_type={$graph_type}&remaining={$remaining}' alt='" . sprintf($st[144], $graph_type_str, $element) . "' /><br />" . $st[145] . "</center>";
    } else {
        $graph_selected = 0;
    }
    $type_link = "<a href={$_SERVER['PHP_SELF']}?graph_db={$graph_db}&element={$element}&graph_selected={$graph_selected}&remaining={$remaining}&graph_type=";
Exemplo n.º 2
0
<?php

//Include the code
include "../phplot.php";
//Define the object and get background image 0cars.jpg
//////NOTE! THIS EXAMPLE WILL ONLY WORK IF YOU HAVE
//////JPEG SUPPORT ENABLED. (Use a different file as a background
//////if you have png or gif enabled.
$graph = new PHPlot(500, 223, "", "0cars.jpg");
//Set some data
$example_data = array(array("55", 5), array("60", 10), array("65", 20), array("70", 30), array("75", 25), array("80", 10));
$graph->SetDataValues($example_data);
//Set up some nice formatting things
$graph->SetTitle("Speed Histogram");
$graph->SetXLabel("Miles per Hour");
$graph->SetYLabel("Percent of Cars");
$graph->SetVertTickIncrement(5);
$graph->SetPlotAreaWorld(0, 0, 6, 35);
//Make the margins nice for the background image
$graph->SetMarginsPixels(80, 35, 35, 70);
//Set up some color and printing options
$graph->background_done = 1;
//The image background we get from 0cars.jpg
$graph->SetDrawPlotAreaBackground(0);
//Plot Area background we get from the image
$graph->SetDataColors(array("white"), array("black"));
//Set Output format
$graph->SetFileFormat("png");
//Draw it
$graph->DrawGraph();
Exemplo n.º 3
0
<?php

include "./data_date2.php";
include "../phplot.php";
$graph = new PHPlot(600, 400);
$graph->SetPrintImage(0);
//Don't draw the image yet
$graph->SetDataType("data-data-error");
//Must be called before SetDataValues
$graph->SetNewPlotAreaPixels(90, 40, 540, 190);
$graph->SetDataValues($example_data);
$graph->SetXGridLabelType("time");
$graph->SetXDataLabelAngle(90);
$graph->SetXLabel("");
$graph->SetYLabel("Price");
$graph->SetVertTickIncrement(20);
$graph->SetHorizTickIncrement(2679000);
$graph->SetXTimeFormat("%b %y");
$graph->SetPlotType("lines");
$graph->SetErrorBarShape("line");
$graph->SetPointShape("halfline");
$graph->SetYScaleType("log");
$graph->SetLineWidth(1);
$graph->SetPlotAreaWorld(883634400, 1, 915095000, 140);
$graph->DrawGraph();
//Now do the second chart on the image
unset($example_data);
$graph->SetPrintImage(1);
//Now draw the image
$graph->SetYScaleType("linear");
include "./data_date.php";
require 'mem_image.php';
$graph = new PHPlot(500, 300);
$graph->SetDataType('data-data');
//Specify some data
$data = array(array('', 2000, 750), array('', 2010, 1700), array('', 2015, 2000), array('', 2020, 1800), array('', 2025, 1300), array('', 2030, 400));
$graph->SetDataValues($data);
//Specify plotting area details
$graph->SetPlotType('lines');
$graph->SetTitleFontSize('2');
$graph->SetTitle('Social Security trust fund asset estimates, in $ billions');
$graph->SetMarginsPixels(null, null, 40, null);
$graph->SetPlotAreaWorld(2000, 0, 2035, 2000);
$graph->SetPlotBgColor('white');
$graph->SetPlotBorderType('left');
$graph->SetBackgroundColor('white');
$graph->SetDataColors(array('red'), array('black'));
//Define the X axis
$graph->SetXLabel('Year');
$graph->SetXTickIncrement(5);
//Define the Y axis
$graph->SetYTickIncrement(500);
$graph->SetPrecisionY(0);
$graph->SetLightGridColor('blue');
//Disable image output
$graph->SetPrintImage(false);
//Draw the graph
$graph->DrawGraph();
$pdf = new PDF_MemImage();
$pdf->AddPage();
$pdf->GDImage($graph->img, 30, 20, 140);
$pdf->Output();
Exemplo n.º 5
0
$graph->SetPrecisionX(0);
$graph->SetPrecisionY(0);
$graph->SetUseTTF("0");
$graph->SetDrawYGrid("1");
// 1 = true
$graph->SetDataValues($data);
$graph->SetImageArea(600, 400);
$graph->SetVertTickIncrement("");
$graph->SetHorizTickIncrement(1);
$graph->SetErrorBarLineWidth(1);
$graph->SetYScaleType("log");
$graph->SetPointShape("halfline");
$graph->SetErrorBarShape("line");
$graph->SetPlotType("points");
$graph->SetXGridLabelType("title");
$graph->SetXLabel("Day");
$graph->SetYLabel("index");
$graph->SetTitle("Stock Market Data");
//$graph->SetErrorBarColors(array("blue","red","green","black"));
$graph->SetDataColors(array("blue", "green", "yellow", "red"), array("black"));
//$graph->SetPlotAreaWorld(0,5,32,30);
//$graph->SetPlotAreaPixels(150,50,600,400);
/*
//Other settings
		$graph->SetPlotBgColor(array(222,222,222));
		$graph->SetBackgroundColor(array(200,222,222)); //can use rgb values or "name" values
		$graph->SetTextColor("black");
		$graph->SetGridColor("black");
		$graph->SetLightGridColor(array(175,175,175));
		$graph->SetTickColor("black");
		$graph->SetTitleColor(array(0,0,0)); // Can be array or name
Exemplo n.º 6
0
$graph->SetPrecisionX(0);
////////////////////////////////////////////////
$graph->SetDataType($which_data_type);
//Must be first thing
$graph->SetUseTTF("0");
$graph->SetDrawYGrid("1");
// 1 = true
$graph->SetDataValues($data);
$graph->SetImageArea($XSIZE_in, $YSIZE_in);
$graph->SetVertTickIncrement($which_vti);
$graph->SetHorizTickIncrement($which_hti);
$graph->SetLineWidth("1");
$graph->SetPointShape("{$which_dot}");
$graph->SetErrorBarShape("{$which_error_type}");
$graph->SetPlotType($which_plot_type);
$graph->SetXLabel($xlbl);
$graph->SetYLabel($ylbl);
$graph->SetTitle($title);
$graph->SetDataColors(array("blue", "green", "yellow", "red"), array("black"));
if ($maxy_in) {
    $graph->SetPlotAreaWorld(0, $miny_in, count($data), $maxy_in);
}
//$graph->SetPlotAreaWorld(0,-5,count($data),30);
//$graph->SetPlotAreaWorld(0,-10,5,35);
//$graph->SetPlotAreaPixels(150,50,600,400);
/*
//Other settings
		$graph->SetPlotBgColor(array(222,222,222));
		$graph->SetBackgroundColor(array(200,222,222)); //can use rgb values or "name" values
		$graph->SetTextColor("black");
		$graph->SetGridColor("black");
include "/usr/lib/phplot/phplot.php";
include "/usr/lib/phplot/rgb.inc.php";
include "/tmp/plot.data.php";
// Test data
//$cvs_data = array(
//	array( "", "2000/03/15", 750),
//	array("", "2010/04/18", 1700),
//	array("", "2015/05/19", 2000),
//	array("", "2030/06/20", 400)
//	);
$graph = new PHPlot(238, 220);
$graph->SetIsInline("1");
$graph->SetDataType("text-data");
$graph->SetPlotType("bars");
$graph->SetDataValues($cvs_data);
// Specify plotting area details
$graph->SetImageArea(238, 220);
$graph->SetPlotAreaPixels(55, 20, 208, 190);
$graph->SetPrecisionY("0");
$graph->SetVertTickIncrement("100");
$graph->SetTickLength("5");
$graph->SetTitleFontSize("2");
$graph->SetPlotBgColor(204, 204, 204);
$graph->SetPlotBorderType("left");
$graph->SetBackgroundColor($ColorArray["gray80"]);
// Define the X axis
$graph->SetXLabel("Date");
// Define the Y axis
$graph->SetDataColors(array("blue", "red"), array("black"));
$graph->SetFileFormat("png");
$graph->DrawGraph();