Exemplo n.º 1
0
$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";
$graph->SetDataType("data-data");
//Must be called before SetDataValues
$graph->SetDataValues($example_data);
$graph->SetNewPlotAreaPixels(90, 260, 540, 350);
Exemplo n.º 2
0
$p->SetDataType('data-data-error');
$p->SetDataValues($data);
#print_r($p);
#exit;
# We don't use the data labels (all set to '') so might as well turn them off:
#$p->SetXDataLabelPos('none');
# Turn off unused ticks and tick labels
$p->SetXTickLabelPos('none');
$p->SetXTickPos('none');
# Need to set area and ticks to get reasonable choices.
$p->SetPlotAreaWorld(0, 0, 11, 25);
$p->SetXTickIncrement(1);
# Draw both grids:
$p->SetDrawXGrid(True);
$p->SetDrawYGrid(True);
# Is default
# Options for error bars:
if (isset($tp['EBShape'])) {
    $p->SetErrorBarShape($tp['EBShape']);
}
if (isset($tp['EBLWidth'])) {
    $p->SetErrorBarLineWidth($tp['EBLWidth']);
}
if (isset($tp['EBColors'])) {
    $p->SetErrorBarColors($tp['EBColors']);
}
if (isset($tp['EBSize'])) {
    $p->SetErrorBarSize($tp['EBSize']);
}
$p->SetPlotType('lines');
$p->DrawGraph();
Exemplo n.º 3
0
        $graph->SetDrawXGrid(FALSE);
        $graph->SetDrawYGrid(FALSE);
}
$graph->SetXTickLabelPos($which_xtick_label_pos);
$graph->SetYTickLabelPos($which_ytick_label_pos);
$graph->SetXDataLabelPos($which_xdata_label_pos);
$graph->SetYDataLabelPos($which_ydata_label_pos);
// Please remember that angles other than 90 are taken as 0 when working fith fixed fonts.
$graph->SetXLabelAngle($which_xlabel_angle);
$graph->SetYLabelAngle($which_ylabel_angle);
//$graph->SetLineStyles(array("dashed","dashed","solid","solid"));
$graph->SetPointShape($which_point);
$graph->SetPointSize($which_point_size);
$graph->SetDrawBrokenLines($which_broken);
// Some forms in format_chart.php don't set this variable, suppress errors.
@$graph->SetErrorBarShape($which_error_type);
$graph->SetXAxisPosition($which_xap);
$graph->SetYAxisPosition($which_yap);
$graph->SetPlotBorderType($which_btype);
if ($maxy_in) {
    if ($which_data_type = "text-data") {
        $graph->SetPlotAreaWorld(0, $miny_in, count($data), $maxy_in);
    }
}
/*
//Even more settings

	$graph->SetPlotAreaWorld(0,100,5.5,1000);
	$graph->SetPlotAreaWorld(0,-10,6,35);
	$graph->SetPlotAreaPixels(150,50,600,400);
Exemplo n.º 4
0
<?php

# PHPlot Example: Point chart with error bars
require_once 'phplot.php';
$data = array(array('', 1, 23.5, 5, 5), array('', 2, 20.1, 3, 3), array('', 3, 19.1, 2, 2), array('', 4, 16.8, 3, 3), array('', 5, 18.4, 4, 6), array('', 6, 20.5, 3, 2), array('', 7, 23.2, 4, 4), array('', 8, 23.1, 5, 2), array('', 9, 24.5, 2, 2), array('', 10, 28.1, 2, 2));
$plot = new PHPlot(800, 600);
$plot->SetImageBorderType('plain');
$plot->SetPlotType('points');
$plot->SetDataType('data-data-error');
$plot->SetDataValues($data);
# Main plot title:
$plot->SetTitle('Points Plot With Error Bars');
# Set data range and tick increments to get nice even numbers:
$plot->SetPlotAreaWorld(0, 0, 11, 40);
$plot->SetXTickIncrement(1);
$plot->SetYTickIncrement(5);
# Draw both grids:
$plot->SetDrawXGrid(True);
$plot->SetDrawYGrid(True);
# Is default
# Set some options for error bars:
$plot->SetErrorBarShape('tee');
# Is default
$plot->SetErrorBarSize(10);
$plot->SetErrorBarLineWidth(2);
# Use a darker color for the plot:
$plot->SetDataColors('brown');
$plot->SetErrorBarColors('brown');
# Make the points bigger so we can see them:
$plot->SetPointSizes(10);
$plot->DrawGraph();
Exemplo n.º 5
0
//Must be first thing
$graph->SetPrecisionY(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
Exemplo n.º 6
0
} else {
    # Vertical plot
    $p->SetPlotAreaWorld(0, NULL, 10, NULL);
    $p->SetXTitle('X Axis - Independent variable');
    $p->SetYTitle('Y Axis - Dependent variable');
    $p->SetYDataLabelPos('plotin');
    # Tick labels below, Axis Data labels above, so both can be seen.
    $p->SetXTickLabelPos('plotdown');
    $p->SetXDataLabelPos('plotup');
}
$p->SetPlotBorderType('full');
# With error plots, the default 90 degree position for data value labels
# will overlay the error bar, so move them to another angle:
$p->data_value_label_angle = 135;
# Turn off the grid lines, so the error bars are move visible.
$p->SetDrawXGrid(False);
$p->SetDrawYGrid(False);
# Style variations:
if (!empty($eb_lwidth)) {
    $p->SetErrorBarLineWidth($eb_lwidth);
}
if (isset($eb_shape)) {
    $p->SetErrorBarShape($eb_shape);
}
if (isset($eb_size)) {
    $p->SetErrorBarSize($eb_size);
}
if (!empty($eb_colors)) {
    $p->SetErrorBarColors($eb_colors);
}
$p->DrawGraph();