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;
    }
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";
Exemplo n.º 4
0
<?php

include "../phplot.php";
$graph = new PHPlot(600, 200);
include "./data_date.php";
$graph->SetDataType("data-data");
//Must be called before SetDataValues
$graph->SetXGridLabelType("time");
$graph->SetXDataLabelAngle(90);
$graph->SetXLabel("");
$graph->SetYLabel("Volume");
$graph->SetVertTickIncrement(30);
$graph->SetXTimeFormat("%b %y");
$graph->SetDataValues($example_data);
$graph->SetHorizTickIncrement(2679000);
$graph->SetPlotType("thinbarline");
//$graph->SetDrawXDataLabels(1);
$graph->SetPlotAreaWorld(883634400, 0, 915095000, 90);
$graph->DrawGraph();
Exemplo n.º 5
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->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");
		$graph->SetLightGridColor(array(175,175,175));
Exemplo n.º 7
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("Stock value");
$graph->SetTitle("Logarithmic scale\nexample 4");
//$graph->SetErrorBarColors(array("blue","red","green","black"));
$graph->SetDataColors(array("blue", "green", "yellow", "red"), array("black"));
$graph->SetPlotAreaWorld(0, 0, 32, 50);
//$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
*/