Esempio n. 1
0
 function monthchart($xdata, $ydata, $title = 'Line Chart')
 {
     // Create the graph. These two calls are always required
     $graph = new Graph(600, 250, "auto", 60);
     $graph->img->SetAntiAliasing(false);
     $graph->SetScale("textlin");
     $graph->xaxis->SetTickLabels($xdata);
     $graph->xgrid->SetColor('#E3E3E3');
     $graph->legend->SetFrameWeight(1);
     // Setup title
     $graph->title->Set($title);
     foreach ($ydata as $item) {
         // Create the linear plot
         if (count($item['values']) != count($xdata)) {
             continue;
         }
         $lineplot = new LinePlot($item['values'], $xdata);
         $lineplot->SetColor($item['color']);
         if (count($ydata) == 1) {
             $lineplot->SetFillColor($item['color']);
         }
         // Add the plot to the graph
         $graph->Add($lineplot);
         $lineplot->SetLegend($item['legend']);
     }
     return $graph;
 }
 public function graficofecha($gestion)
 {
     if (Conectar::con()) {
         //$gestion='2013';
         $objetoanalisis = new classAnalisis();
         $anio = $gestion;
         for ($i = 0; $i < 12; $i++) {
             $dat[] = $objetoanalisis->ventamensual($anio, $i);
         }
         $datos = $dat;
         //$datos =array('1','4','3','3','5');
         $grafico = new Graph(400, 300, "auto");
         $grafico->SetScale("textlin");
         $grafico->title->Set("Resumen de ventas por gestion");
         $grafico->xaxis->title->Set("");
         $grafico->yaxis->title->Set("");
         // Un gradiente Horizontal de rojo a azul
         // 25 pixeles de ancho para cada barra
         $lineplot = new LinePlot($datos);
         $lineplot->SetColor("green");
         $lineplot->SetWeight(2);
         $grafico->Add($lineplot);
         return $grafico->Stroke();
     }
 }
 /**
  * @return Chart
  */
 public function buildGraph()
 {
     require_once 'common/chart/Chart.class.php';
     if ($this->error == NULL) {
         if ($this->width == 0) {
             $this->width = count($this->data) * self::WIDTH_PER_POINT + self::MARGIN;
         }
         if ($this->scale == GraphOnTrackersV5_Chart_CumulativeFlow::SCALE_DAY) {
             foreach ($this->data as $date => $label) {
                 $dates[] = date('M-d', $date);
             }
         } else {
             foreach ($this->data as $date => $label) {
                 $dates[] = date('M-Y', $date);
             }
         }
         $this->graph = new Chart($this->width, $this->height);
         $colors = $this->getColors();
         $this->graph->SetScale("datlin");
         $this->graph->title->Set($this->title);
         $this->graph->xaxis->SetTickLabels($dates);
         $this->graph->yaxis->scale->SetAutoMin(0);
         if (is_null($this->description)) {
             $this->description = "";
         }
         $this->graph->subtitle->Set($this->description);
         $this->keys = array_keys($this->data[$this->start_date]);
         $this->nbOpt = count($this->keys);
         $this->stackDataCount();
         $this->graph->ygrid->SetFill(true, '#F3FFFF@0.5', '#FFFFFF@0.5');
         for ($i = $this->nbOpt - 1; $i >= 0; $i--) {
             $lineData = array();
             foreach ($this->data as $data => $row) {
                 $lineData[] = $row[$this->keys[$i]];
             }
             $line = new LinePlot($lineData);
             $line->SetFillColor($colors[$this->keys[$i]]);
             $line->SetColor('#000');
             $line->SetLegend($this->keys[$i]);
             $this->graph->Add($line);
         }
         try {
             $legend_line_height = 20;
             $graph_margin_bottom = 70;
             $margin_size = $this->nbOpt * $legend_line_height + $graph_margin_bottom;
             $this->graph->img->SetMargin(70, 30, 30, $margin_size);
         } catch (Exception $e) {
             // do nothing, JPGraph displays the error by itself
         }
         $this->graph->legend->SetAbsPos(0, $this->height, 'left', 'bottom');
     } else {
         $this->graph = $this->error;
     }
     return $this->graph;
 }
Esempio n. 4
0
 public function renderGraph()
 {
     require_once 'libs/jpgraph/jpgraph.php';
     require_once 'libs/jpgraph/jpgraph_bar.php';
     require_once 'libs/jpgraph/jpgraph_line.php';
     $graph = new Graph(300, 200, 'auto');
     $graph->SetMarginColor('white');
     $graph->SetFrame(false);
     $graph->SetScale("textlin");
     $graph->SetY2Scale("lin");
     $graph->img->SetMargin(0, 30, 20, 65);
     $graph->yaxis->HideLabels();
     $graph->yaxis->HideTicks();
     $graph->yaxis->scale->SetGrace(20);
     $graph->y2axis->SetColor("black", "red");
     $graph->ygrid->SetFill(true, '#EFEFEF@0.5', '#BBCCFF@0.5');
     $labelsy = array();
     $datay = array();
     $datay2 = array();
     switch ($this->_controllerAction->getRequest()->getParam('type')) {
         case 'year':
             $this->_populateYearData($labelsy, $datay, $datay2);
             break;
         default:
             $this->_populateWeekData($labelsy, $datay, $datay2);
     }
     $graph->xaxis->SetTickLabels($labelsy);
     $locale = Zend_Registry::get('Zend_Locale');
     if ($locale == 'ja') {
         // the ttf file for FF_MINCHO is already encoded in utf-8
         $legend1 = $this->view->translate('Trusted sites');
         $legend2 = $this->view->translate('Sites per user');
     } else {
         // default ttf files are latin-1 encoded
         $legend1 = utf8_decode($this->view->translate('Trusted sites'));
         $legend2 = utf8_decode($this->view->translate('Sites per user'));
     }
     $bplot = new BarPlot($datay);
     $bplot->setLegend($legend1);
     $bplot->SetFillGradient("navy", "lightsteelblue", GRAD_WIDE_MIDVER);
     $bplot->value->Show();
     $bplot->value->SetFormat('%d');
     $p1 = new LinePlot($datay2);
     $p1->SetColor("red");
     $p1->SetLegend($legend2);
     $graph->Add($bplot);
     $graph->AddY2($p1);
     $graph->legend->SetLayout(LEGEND_HOR);
     if ($locale == 'ja') {
         $graph->legend->setFont(FF_MINCHO, FS_NORMAL);
     }
     $graph->legend->Pos(0.5, 0.99, "center", "bottom");
     $graph->Stroke();
 }
function LineGraph($w, $h, $title, $data1, $data2, $datax, $output)
{
    // Create the graph. These two calls are always required
    $graph = new Graph($w, $h, "auto");
    $graph->SetScale("textlin");
    $graph->SetMarginColor('white');
    $graph->SetFrame(true);
    // Adjust the margin
    $graph->img->SetMargin(40, 100, 20, 40);
    $graph->SetShadow(false);
    // Create the linear plot
    $lineplot = new LinePlot($data1);
    $lineplot->SetWeight(2);
    $lineplot->SetColor("blue");
    $lineplot->mark->SetType(MARK_DIAMOND);
    $lineplot->mark->SetWidth(5);
    $lineplot->mark->SetFillColor('blue');
    $lineplot->value->SetMargin(-20);
    $lineplot->value->show();
    $lineplot->value->SetColor('blue');
    $lineplot->value->SetFormat('%0.0f');
    $lineplot->SetLegend($_SESSION[Tahun1]);
    $lineplot2 = new LinePlot($data2);
    $lineplot2->SetColor("green");
    $lineplot2->SetWeight(2);
    $lineplot2->mark->SetType(MARK_FILLEDCIRCLE);
    $lineplot2->mark->SetWidth(3);
    $lineplot2->mark->SetFillColor('green');
    $lineplot2->value->show();
    $lineplot2->value->SetColor('darkgreen');
    $lineplot2->value->SetFormat('%0.0f');
    $lineplot2->SetLegend($_SESSION[Tahun2]);
    // Add the plot to the graph
    $graph->Add($lineplot);
    $graph->xaxis->SetTickLabels($datax);
    $graph->title->Set($title);
    $graph->xaxis->title->Set("");
    $graph->yaxis->title->Set("");
    $graph->title->SetFont(FF_FONT1, FS_BOLD);
    $graph->yaxis->title->SetFont(FF_FONT1, FS_BOLD);
    $graph->xaxis->title->SetFont(FF_FONT1, FS_BOLD);
    $graph->Add($lineplot2);
    $graph->legend->SetShadow(false);
    $graph->legend->SetFillColor('white');
    $graph->legend->SetPos(0.01, 0.88, 'right', 'center');
    // Display the graph
    $graph->Stroke($output);
}
Esempio n. 6
0
 function linechart($ydata, $title = 'Line Chart')
 {
     require_once APPPATH . 'third_party/jpgraph-3.5.0b1/src/jpgraph.php';
     require_once APPPATH . 'third_party/jpgraph-3.5.0b1/src/jpgraph_line.php';
     // Create the graph. These two calls are always required
     $graph = new Graph(350, 250, "auto", 60);
     $graph->SetScale("textlin");
     // Setup title
     $graph->title->Set($title);
     // Create the linear plot
     $lineplot = new LinePlot($ydata);
     $lineplot->SetColor("blue");
     // Add the plot to the graph
     $graph->Add($lineplot);
     return $graph;
     // does PHP5 return a reference automatically?
 }
function createSpline($ydata = "")
{
    $xdata = array(2, 4, 6, 8, 10, 12, 14, 16);
    if (!$ydata) {
        $ydata = array(5, 1, 9, 6, 4, 3, 4, 2);
    }
    // Get the interpolated values by creating
    // a new Spline object.
    $spline = new Spline($xdata, $ydata);
    // For the new data set we want 40 points to
    // get a smooth curve.
    list($newx, $newy) = $spline->Get(50);
    // Create the graph
    $g = new Graph(380, 300);
    $g->SetMargin(30, 20, 40, 30);
    //$g->title->Set("Natural cubic splines");
    //$g->title->SetFont(FF_ARIAL,FS_NORMAL,12);
    //$g->subtitle->Set('(Control points shown in red)');
    //$g->subtitle->SetColor('darkred');
    $g->SetMarginColor('lightblue');
    //$g->img->SetAntiAliasing();
    // We need a linlin scale since we provide both
    // x and y coordinates for the data points.
    $g->SetScale('linlin');
    $xlable = array('', 'AA', 'AA', 'AB', 'AB', 'BB', 'BB', 'BC', 'BC', 'CC', 'CC', 'CD', 'CD', 'DD', 'DD', 'FF', 'FF', '');
    // We want 1 decimal for the X-label
    //$g -> xaxis -> SetLabelFormat('%d');
    $g->xaxis->SetTickLabels($xlable);
    // We use a scatterplot to illustrate the original
    // contro points.
    $splot = new ScatterPlot($ydata, $xdata);
    //
    $splot->mark->SetFillColor('red@0.3');
    $splot->mark->SetColor('red@0.5');
    // And a line plot to stroke the smooth curve we got
    // from the original control points
    $lplot = new LinePlot($newy, $newx);
    $lplot->SetColor('navy');
    // Add the plots to the graph and stroke
    $g->Add($lplot);
    $g->Add($splot);
    $g->Stroke();
}
Esempio n. 8
0
File: image.php Progetto: ztobs/wsf
function draw_graph($datay, $data2y, $label_x)
{
    include_once "src/jpgraph.php";
    include_once "src/jpgraph_line.php";
    // A nice graph with anti-aliasing
    $graph = new Graph(800, 600, "auto");
    $graph->img->SetMargin(40, 180, 40, 40);
    $graph->img->SetAntiAliasing("white");
    $graph->SetScale("textlin");
    $graph->SetShadow();
    $graph->title->Set("Nodes and Comment Count By Duration");
    $graph->xaxis->SetTickLabels($label_x);
    // Use built in font
    $graph->title->SetFont(FF_FONT1, FS_BOLD);
    // Slightly adjust the legend from it's default position in the
    // top right corner.
    $graph->legend->Pos(0.05, 0.5, "right", "center");
    // Create the first line
    if ($datay) {
        $p1 = new LinePlot($datay);
        $p1->mark->SetType(MARK_FILLEDCIRCLE);
        $p1->mark->SetFillColor("blue");
        $p1->mark->SetWidth(4);
        $p1->SetColor("blue");
        $p1->SetCenter();
        $p1->SetLegend("Nodes Count");
        $graph->Add($p1);
    }
    // ... and the second
    if ($data2y) {
        $p2 = new LinePlot($data2y);
        $p2->mark->SetType(MARK_STAR);
        $p2->mark->SetFillColor("red");
        $p2->mark->SetWidth(4);
        $p2->SetColor("red");
        $p2->SetCenter();
        $p2->SetLegend("Comments Count");
        $graph->Add($p2);
    }
    // Output line
    $graph->Stroke();
}
Esempio n. 9
0
 function plot()
 {
     $this->_setValues();
     $graph = new Graph(380, 250);
     $graph->img->SetMargin(50, 30, 40, 40);
     $graph->SetShadow();
     $graph->SetColor("lightyellow");
     $graph->SetScale("textlin");
     $graph->title->Set($this->_graphTitle);
     $graph->yaxis->SetColor("blue");
     $graph->xaxis->SetColor("blue");
     $graph->title->SetFont(FONT1_BOLD);
     $graph->xaxis->SetTickLabels($this->_xaxisValues);
     $lineplot = new LinePlot($this->_yaxisValues);
     $lineplot->SetColor("red");
     // Add the plot to the graph
     $graph->Add($lineplot);
     // Display the graph
     $graph->Stroke();
 }
Esempio n. 10
0
 /**
  * @return Chart
  */
 public function buildGraph()
 {
     $graph = new Chart($this->width, $this->height);
     $graph->SetScale("datlin");
     $graph->title->Set($this->title);
     $graph->subtitle->Set($this->description);
     $colors = $graph->getThemedColors();
     $graph->xaxis->SetTickLabels($this->burndown_data->getHumanReadableDates());
     $remaining_effort = new LinePlot($this->burndown_data->getRemainingEffort());
     $remaining_effort->SetColor($colors[1] . ':0.7');
     $remaining_effort->SetWeight(2);
     $remaining_effort->SetLegend('Remaining effort');
     $remaining_effort->mark->SetType(MARK_FILLEDCIRCLE);
     $remaining_effort->mark->SetColor($colors[1] . ':0.7');
     $remaining_effort->mark->SetFillColor($colors[1]);
     $remaining_effort->mark->SetSize(3);
     $graph->Add($remaining_effort);
     $ideal_burndown = new LinePlot($this->burndown_data->getIdealEffort());
     $ideal_burndown->SetColor($colors[0] . ':1.25');
     $ideal_burndown->SetLegend('Ideal Burndown');
     $graph->Add($ideal_burndown);
     return $graph;
 }
Esempio n. 11
0
//
$graph = new Graph(400, 200);
//
// We use an integer scale on the X-axis since the positions on the X axis
// are assumed to be UNI timestamps
$graph->SetScale('intlin', 0, 0, $xmin, $xmax);
$graph->title->Set('Basic example with manual ticks');
$graph->title->SetFont(FF_ARIAL, FS_NORMAL, 12);
//
// Make sure that the X-axis is always at the bottom of the scale
// (By default the X-axis is alwys positioned at Y=0 so if the scale
// doesn't happen to include 0 the axis will not be shown)
$graph->xaxis->SetPos('min');
// Now set the tic positions
$graph->xaxis->SetTickPositions($tickPositions, $minTickPositions);
// The labels should be formatted at dates with "Year-month"
$graph->xaxis->SetLabelFormatString('My', true);
// Use Ariel font
$graph->xaxis->SetFont(FF_ARIAL, FS_NORMAL, 9);
// Add a X-grid
$graph->xgrid->Show();
// Create the plot line
$p1 = new LinePlot($datay, $datax);
$p1->SetColor('teal');
$graph->Add($p1);
// Output graph
$graph->Stroke();
?>


Esempio n. 12
0
<?php

include "../jpgraph.php";
include "../jpgraph_line.php";
$ydata = array(12, 17, 22, 19, 5, 15);
$graph = new Graph(270, 170);
$graph->SetMargin(30, 90, 30, 30);
$graph->SetScale("textlin");
$graph->img->SetAngle(90);
$graph->img->SetCenter(floor(270 / 2), floor(170 / 2));
$line = new LinePlot($ydata);
$line->SetLegend('2002');
$line->SetColor('darkred');
$line->SetWeight(2);
$graph->Add($line);
// Output graph
$graph->Stroke();
?>


Esempio n. 13
0
// Use built in font
$graph->title->SetFont(FF_FONT1, FS_BOLD);
// Make the margin around the plot a little bit bigger
// then default
$graph->img->SetMargin(40, 140, 40, 80);
// Slightly adjust the legend from it's default position in the
// top right corner to middle right side
$graph->legend->Pos(0.05, 0.5, "right", "center");
// Display every 10:th datalabel
$graph->xaxis->SetTextTickInterval(6);
$graph->xaxis->SetTextLabelInterval(2);
$graph->xaxis->SetTickLabels($databarx);
$graph->xaxis->SetLabelAngle(90);
// Create a red line plot
$p1 = new LinePlot($datay);
$p1->SetColor("red");
$p1->SetLegend("Pressure");
// Create the bar plot
$b1 = new BarPlot($databary);
$b1->SetLegend("Temperature");
$b1->SetAbsWidth(6);
$b1->SetShadow();
// The order the plots are added determines who's ontop
$graph->Add($p1);
$graph->Add($b1);
// Finally output the  image
$graph->Stroke();
?>


Esempio n. 14
0
 function Create(MASK $mask = NULL, INTERVAL $iv = NULL)
 {
     global $GRAPH_MARGINS;
     global $GRAPH_DENSITY_PLOT_VALID_SIZE;
     global $GRAPH_DENSITY_PLOT_VALID_COLOR;
     global $GRAPH_DENSITY_PLOT_INVALID_SIZE;
     global $GRAPH_DENSITY_PLOT_INVALID_COLOR;
     global $GRAPH_DENSITY_POINTS_TYPE;
     global $GRAPH_DENSITY_POINTS_SIZE;
     global $GRAPH_DENSITY_POINTS_COLOR;
     global $GRAPH_DENSITY_POINTS_OUTLINE;
     global $JPGRAPH_VERSION;
     if ($this->ready) {
         return;
     }
     list($axes, $data, $spec) = $this->PrepareData($this->reader, $mask, $iv);
     $draw_modes = array();
     foreach ($data as $info) {
         $items = $info['items'];
         foreach ($items as $item) {
             array_push($draw_modes, $item['draw_mode']);
         }
     }
     $this->plot_mode = $this->FindPlotMode($this->req->props['plot_mode']);
     $this->AnalyzeGapsRequirements($axes, $data, $spec);
     $this->AnalyzeMarksRequirements($axes, $data, $spec);
     list($xaxis, $yaxis) = $this->ConfigureAxis($axes, $iv, $data, $spec);
     $this->spec =& $spec;
     $this->graph = new Graph($this->width, $this->height, "auto");
     $this->graph->SetTickDensity(TICKD_SPARSE, TICKD_SPARSE);
     if ($xaxis['date_format']) {
         $this->graph->SetScale("datlin", 0, 1, $xaxis['from'], $xaxis['to']);
         //$this->graph->xaxis->scale->Update($this->graph, $xaxis['from'], $xaxis['to']);
         $this->graph->xaxis->scale->SetDateFormat($xaxis['date_format']);
     } else {
         $this->graph->SetScale("linlin", 0, 1, $xaxis['from'], $xaxis['to']);
         if ($xaxis['ticks']) {
             $this->graph->xscale->ticks->Set($xaxis['ticks'][0], $xaxis['ticks'][1]);
         }
     }
     if ($xaxis['label_interval']) {
         $this->graph->xaxis->SetTextLabelInterval($xaxis['label_interval']);
     }
     if ($this->hide_axes) {
         if (strcasecmp($this->hide_axes, 'Y')) {
             $hide_x = true;
         } else {
             $hide_x = false;
         }
         $hide_y = true;
     } else {
         $hide_x = false;
         $hide_y = false;
     }
     $this->graph_margin = array();
     if ($hide_y) {
         $this->graph_yaxis_size = 0;
         if ($hide_x) {
             $this->graph_margin[0] = 0;
             $this->graph_margin[2] = 0;
         } else {
             $this->graph_margin[0] = $GRAPH_MARGINS['right'] + $GRAPH_MARGINS['axis'];
             $this->graph_margin[2] = $GRAPH_MARGINS['right'];
         }
         $this->graph->yaxis->HideLabels();
     } else {
         $this->graph_yaxis_size = $GRAPH_MARGINS['axis'];
         $this->graph_margin[0] = $GRAPH_MARGINS['left'] + $this->graph_yaxis_size * $axes->GetAxesNumber();
         $this->graph_margin[2] = $GRAPH_MARGINS['right'];
     }
     if ($hide_x) {
         $this->graph_margin[1] = 0;
         $this->graph_margin[3] = 1;
         $this->graph->xaxis->HideLabels();
     } else {
         $this->graph_margin[1] = $GRAPH_MARGINS['top'];
         $this->graph_margin[3] = $GRAPH_MARGINS['bottom'];
         $title = $this->GenerateTitle($data, $spec);
         $this->graph->title->Set($title);
         $this->graph->xaxis->SetPos("min");
         //$this->graph->xaxis->SetLabelAngle(0);
         $this->graph->xaxis->SetFont(FF_ARIAL, FS_NORMAL, 8);
         //$this->graph->xaxis->scale->SetTimeAlign(MINADJ_15);
         // We can use SetLabelFormatCallback for higher control
         //$this->graph->yaxis->SetLabelFormat('%0.5g');
         //$this->graph->SetYDeltaDist($this->graph_yaxis_size);
     }
     $this->graph->img->SetMargin($this->graph_margin[0], $this->graph_margin[2], $this->graph_margin[1], $this->graph_margin[3]);
     $this->graph->xaxis->SetLabelMargin(13);
     foreach ($axes as $axis_i => $axis) {
         $empty_axis = true;
         if (intval($this->plot_mode) === DRAW::PLOT_STANDARD) {
             foreach ($axis as $i => $plot_data) {
                 $plot = new LinePlot($plot_data[1], $plot_data[0]);
                 $color = $axis->GetChannelColor($i);
                 if ($color) {
                     $plot->SetColor($color);
                 }
                 $weight = $axis->GetChannelProperty($i, "weight");
                 if ($weight) {
                     $plot->SetWeight($weight);
                 }
                 if ($spec['marks']) {
                     $prop = $axis->GetChannelProperty($i, "mark_type");
                     if ($prop) {
                         $plot->mark->SetType($prop);
                     }
                     $prop = $axis->GetChannelProperty($i, "mark_size");
                     if ($prop) {
                         $plot->mark->SetSize($prop);
                     }
                     $prop = $axis->GetChannelProperty($i, "mark_fill");
                     if ($prop) {
                         $plot->mark->SetFillColor($prop);
                     }
                 }
                 $this->graph->AddY($axis_i, $plot);
                 $empty_axis = false;
             }
         } else {
             if (intval($this->plot_mode) === DRAW::PLOT_CUSTOM) {
                 foreach ($data as $info) {
                     $acc_lineplot_array = array();
                     $lineplot_array = array();
                     $items = $info['items'];
                     $time = $info['time'];
                     $values = $info['values'];
                     foreach ($axis as $i => $plot_data) {
                         $plot = new LinePlot($plot_data[1], $plot_data[0]);
                         $color = $axis->GetChannelColor($i);
                         if ($color) {
                             $plot->SetColor($color);
                         }
                         $weight = $axis->GetChannelProperty($i, "weight");
                         if ($weight) {
                             $plot->SetWeight($weight);
                         }
                         if ($spec['marks']) {
                             $prop = $axis->GetChannelProperty($i, "mark_type");
                             if ($prop) {
                                 $plot->mark->SetType($prop);
                             }
                             $prop = $axis->GetChannelProperty($i, "mark_size");
                             if ($prop) {
                                 $plot->mark->SetSize($prop);
                             }
                             $prop = $axis->GetChannelProperty($i, "mark_fill");
                             if ($prop) {
                                 $plot->mark->SetFillColor($prop);
                             }
                         }
                         if ($items[$i]['draw_mode'] !== "LINE") {
                             $plot->SetFillColor($color);
                             array_push($acc_lineplot_array, $plot);
                         } else {
                             array_push($lineplot_array, $plot);
                         }
                         $empty_axis = false;
                     }
                     if (!empty($acc_lineplot_array)) {
                         $accplot = new AccLinePlot($acc_lineplot_array);
                         $this->graph->AddY($axis_i, $accplot);
                     }
                     if (!empty($lineplot_array)) {
                         foreach ($lineplot_array as $plot) {
                             $this->graph->AddY($axis_i, $plot);
                         }
                     }
                 }
             }
         }
         if ($empty_axis) {
             $plot = new LinePlot(array(0), array($spec['from']));
             $this->graph->AddY($axis_i, $plot);
         }
         $range = $axis->GetRange();
         $scale = $axis->IsLogarithmic() ? "log" : "lin";
         if ($range) {
             if ($axis->IsLogarithmic()) {
                 if ($range[0] <= 0) {
                     $range[0] = DRAW::MIN_LOG;
                 }
                 if ($range[1] <= 0) {
                     $range[1] = 1;
                 }
                 $this->graph->SetYScale($axis_i, $scale, log10($range[0]), log10($range[1]));
                 //	        $this->graph->SetYScale($axis_i, $scale, (log10(max(DRAW::MIN_LOG, $range[0]))), (log10(max(DRAW::MIN_LOG, $range[1]))));
             } else {
                 $this->graph->SetYScale($axis_i, $scale, $range[0], $range[1]);
             }
         } else {
             if ($empty_axis) {
                 $this->graph->SetYScale($axis_i, $scale, 0, 1);
             } else {
                 $this->graph->SetYScale($axis_i, $scale);
             }
         }
         $color = $axis->GetColor();
         $this->graph->ynaxis[$axis_i]->SetColor($color);
         if ($hide_y) {
             $this->graph->ynaxis[$axis_i]->HideLabels();
         } else {
             $this->graph->ynaxis[$axis_i]->SetPos("min");
             $this->graph->ynaxis[$axis_i]->SetTickSide(SIDE_RIGHT);
             $this->graph->ynaxis[$axis_i]->SetLabelSide(SIDE_LEFT);
             $this->graph->ynaxis[$axis_i]->SetPosAbsDelta(-$axis_i * $this->graph_yaxis_size - 2);
             if (!$range) {
                 $this->graph->ynaxis[$axis_i]->scale->SetGrace(0.1, 0.1);
             }
             $title = $axis->GetTitle();
             if ($title) {
                 $this->graph->ynaxis[$axis_i]->SetTitle($title, "high");
                 $this->graph->ynaxis[$axis_i]->SetTitleSide(SIDE_LEFT);
                 if ($JPGRAPH_VERSION > 2) {
                     $this->graph->ynaxis[$axis_i]->SetTitleMargin(15 - $this->graph_yaxis_size);
                 } else {
                     $this->graph->ynaxis[$axis_i]->SetTitleMargin($this->graph_yaxis_size - 20);
                 }
                 $this->graph->ynaxis[$axis_i]->title->SetColor($color);
                 $this->graph->ynaxis[$axis_i]->HideLastTickLabel();
             }
         }
         // We can use SetLabelFormatCallback for higher control
         //$this->graph->ynaxis[$axis_i]->SetLabelFormat('%0.5g');
         $this->graph->ynaxis[$axis_i]->SetLabelFormatCallback(array(new DRAW_JPGraphAxisHolder($this, $axis, $this->graph->ynaxis[$axis_i]), "YLabelFormat"));
     }
     /*
         $plot = new LinePlot(array(0), array($spec['from']));
         $this->graph->AddY(1, $plot);
         $this->graph->SetYScale(1, 'lin', $range[0], $range[1]);
             $this->graph->ynaxis[1]->SetPos("min");
             $this->graph->ynaxis[1]->SetTitleSide(SIDE_LEFT);
             $this->graph->ynaxis[1]->SetTickSide(SIDE_RIGHT);
             $this->graph->ynaxis[1]->SetLabelSide(SIDE_LEFT);
     	$this->graph->ynaxis[1]->SetPosAbsDelta(-1 * 60 - 2);
     */
     $something_shown = false;
     if ($spec['gaps']) {
         //$px = ($max - $min) / $this->height; $realmax = $max + 2*$px;
         $realmax = 1 + 3 / $this->height;
         switch ($spec['gaps']) {
             case DRAW::SHOW_GAPS:
                 $gtime = array();
                 $gvalue = array();
                 foreach ($data as &$info) {
                     $flag = 0;
                     foreach ($info['gaps'] as $idx => &$val) {
                         if ($val) {
                             if ($flag) {
                                 $flag++;
                             } else {
                                 array_push($gtime, $info['time'][$idx]);
                                 array_push($gvalue, $realmax);
                                 $flag = 1;
                             }
                         } else {
                             if ($flag) {
                                 array_push($gtime, $info['time'][$idx]);
                                 array_push($gvalue, $realmax);
                                 array_push($gtime, $info['time'][$idx]);
                                 array_push($gvalue, false);
                                 $flag = 0;
                             }
                         }
                     }
                     if (sizeof($gtime) > 0) {
                         $something_shown = true;
                         $plot = new LinePlot($gvalue, $gtime);
                         $plot->SetColor($GRAPH_DENSITY_PLOT_INVALID_COLOR);
                         $plot->SetWeight($GRAPH_DENSITY_PLOT_INVALID_SIZE);
                         $this->graph->Add($plot);
                     }
                 }
                 break;
             case DRAW::SHOW_POINTS:
                 $something_shown = true;
                 foreach ($data as &$info) {
                     foreach ($info['gaps'] as $idx => &$val) {
                         if ($val > 1) {
                             $val = false;
                         } else {
                             $val = $realmax;
                         }
                     }
                     //		print_r($info['gaps']);
                     $plot = new LinePlot($info['gaps'], $info['time']);
                     $plot->SetColor($GRAPH_DENSITY_PLOT_VALID_COLOR);
                     $plot->SetWeight($GRAPH_DENSITY_PLOT_VALID_SIZE);
                     if ($GRAPH_DENSITY_POINTS_TYPE) {
                         eval("\$mtype={$GRAPH_DENSITY_POINTS_TYPE};");
                     }
                     $plot->mark->SetType($mtype);
                     $plot->mark->SetColor($GRAPH_DENSITY_POINTS_OUTLINE);
                     $plot->mark->SetFillColor($GRAPH_DENSITY_POINTS_COLOR);
                     $plot->mark->SetSize($GRAPH_DENSITY_POINTS_SIZE);
                     $this->graph->Add($plot);
                 }
         }
     }
     if (!$something_shown) {
         $plot = new LinePlot(array(0), array($spec['from']));
         $this->graph->Add($plot);
     }
     $this->graph->yaxis->Hide();
     $this->graph_interval = $iv;
     $this->graph_axes = $axes;
     $this->precision = $spec['precision'];
 }
Esempio n. 15
0
$report = new ReportUserAdded($SPAN, $start, $end);
//
//	Check for error, such as license key problem
//
if ($report->isError()) {
    echo $report->getErrorMessage();
    exit;
}
// Some data
$ydata = $report->getData();
// Create the graph. These two calls are always required
$graph = new Graph(640, 480, "auto");
$graph->SetMargin(50, 10, 35, 50);
$graph->SetScale("textlin");
// Create the linear plot
$lineplot = new LinePlot($ydata);
$lineplot->SetColor("black");
$lineplot->SetFillColor("orange");
// Add the plot to the graph
$graph->Add($lineplot);
//$graph->SetMargin(10,10,25,10);
$graph->title->Set("Users Added " . $report->getSpanName() . " (" . date('m/d/Y', $report->getStartDate()) . "-" . date('m/d/Y', $report->getEndDate()) . ")");
$graph->subtitle->Set($sys_name);
//$graph->xaxis-> title->Set("Date" );
//$graph->yaxis-> title->Set("Number" );
$a = $report->getDates();
$graph->xaxis->SetTickLabels($a);
$graph->xaxis->SetLabelAngle(90);
$graph->xaxis->SetTextLabelInterval($report->getGraphInterval());
// Display the graph
$graph->Stroke();
Esempio n. 16
0
 /**
  * 线图
  */
 function createmonthline($title, $data = array(), $size = 40, $height = 100, $width = 80, $legend = array())
 {
     vendor("Jpgraph.jpgraph");
     vendor("Jpgraph.jpgraph_line");
     $labels = $legend;
     //编码转化
     foreach ($labels as $k => $v) {
         $labels[$k] = iconv('utf-8', 'gb2312', $v);
     }
     $data = $data;
     $graph = new Graph($width, $height, "auto");
     $graph->img->SetMargin(40, 40, 40, 40);
     $graph->img->SetAntiAliasing();
     $graph->SetScale("textlin");
     $graph->SetShadow();
     $graph->title->Set(iconv('utf-8', 'gb2312', "{$title}"));
     $graph->title->SetFont(FF_SIMSUN, FS_NORMAL, 14);
     $graph->SetFrame(false, '#ffffff', 0);
     //去掉周围的边框
     $graph->xaxis->SetFont(FF_SIMSUN, FS_NORMAL, 9);
     $graph->xaxis->SetTickLabels($labels);
     $graph->xaxis->SetLabelAngle(0);
     $p1 = new LinePlot($data);
     $p1->mark->SetType(MARK_FILLEDCIRCLE);
     $p1->mark->SetFillColor("#0080C0");
     $p1->mark->SetWidth(4);
     $p1->SetColor("#000000");
     $p1->SetCenter();
     $graph->Add($p1);
     $graph->Stroke();
 }
Esempio n. 17
0
<?php

include "../jpgraph.php";
include "../jpgraph_line.php";
$f = new FuncGenerator('cos($i)', '$i*$i*$i');
list($xdata, $ydata) = $f->E(-M_PI, M_PI, 25);
$graph = new Graph(350, 430, "auto");
$graph->SetScale("linlin");
$graph->SetShadow();
$graph->img->SetMargin(50, 50, 60, 40);
$graph->SetBox(true, 'black', 2);
$graph->SetMarginColor('white');
$graph->SetColor('lightyellow');
$graph->SetAxisStyle(AXSTYLE_BOXIN);
$graph->xgrid->Show();
//$graph->xaxis->SetLabelFormat('%.0f');
$graph->img->SetMargin(50, 50, 60, 40);
$graph->title->Set("Function plot");
$graph->title->SetFont(FF_FONT1, FS_BOLD);
$graph->subtitle->Set("(BOXIN Axis style)");
$graph->subtitle->SetFont(FF_FONT1, FS_NORMAL);
$lp1 = new LinePlot($ydata, $xdata);
$lp1->SetColor("blue");
$lp1->SetWeight(2);
$graph->Add($lp1);
$graph->Stroke();
?>


Esempio n. 18
0
     $b1plot = new BarPlot($weekArray);
     $gbplot = new GroupBarPlot(array($b1plot));
     $graph->Add($gbplot);
     $graph->xaxis->SetTickLabels($label);
     $graph->title->SetFont(FF_FONT1, FS_BOLD);
     $graph->yaxis->title->SetFont(FF_FONT1, FS_BOLD);
     $graph->xaxis->title->SetFont(FF_FONT1, FS_BOLD);
     $graph->Stroke();
 } elseif ($statistic == 1) {
     $graph = new Graph(1280, 720);
     $graph->SetScale("textlin");
     $graph->SetShadow();
     $graph->img->SetMargin(40, 30, 20, 40);
     $graph->SetBox(false);
     $p1 = new LinePlot($weekArray);
     $p1->SetColor("#FFD800");
     $p1->mark->SetType(MARK_FILLEDCIRCLE, '', 1.0);
     $p1->mark->SetColor('#FFD800');
     $p1->mark->SetFillColor('#FFD800');
     $p1->SetCenter();
     $graph->Add($p1);
     $graph->xaxis->SetTickLabels($label);
     $graph->title->SetFont(FF_FONT1, FS_BOLD);
     $graph->yaxis->title->SetFont(FF_FONT1, FS_BOLD);
     $graph->xaxis->title->SetFont(FF_FONT1, FS_BOLD);
     $graph->Stroke();
 } else {
     $graph = new Graph(1280, 720);
     $graph->SetScale("textlin");
     $graph->SetShadow();
     $graph->img->SetMargin(40, 30, 20, 40);
Esempio n. 19
0
$graph->SetShadow();
$graph->title->Set("Background image");
// Use built in font
$graph->title->SetFont(FF_FONT1, FS_BOLD);
// Slightly adjust the legend from it's default position in the
// top right corner.
$graph->legend->Pos(0.05, 0.5, "right", "center");
// Create the first line
$p1 = new LinePlot($datay);
$p1->mark->SetType(MARK_FILLEDCIRCLE);
$p1->mark->SetFillColor("red");
$p1->mark->SetWidth(4);
$p1->SetColor("blue");
$p1->SetCenter();
$p1->SetLegend("Triumph Tiger -98");
$graph->Add($p1);
// ... and the second
$p2 = new LinePlot($data2y);
$p2->mark->SetType(MARK_STAR);
$p2->mark->SetFillColor("red");
$p2->mark->SetWidth(4);
$p2->SetColor("red");
$p2->SetCenter();
$p2->SetLegend("New tiger -99");
$graph->Add($p2);
// Output line
$graph->Stroke();
?>


Esempio n. 20
0
}
// Setup the graph
$graph = new Graph(450, 250);
$graph->SetMargin(40, 150, 40, 30);
$graph->SetMarginColor('white');
$graph->SetScale('intlin');
$graph->title->Set('Using multiple Y-axis');
$graph->title->SetFont(FF_ARIAL, FS_NORMAL, 14);
$graph->SetYScale(0, 'lin');
$graph->SetYScale(1, 'lin');
$graph->SetYScale(2, 'lin');
$p1 = new LinePlot($datay);
$graph->Add($p1);
$p2 = new LinePlot($datay2);
$p2->SetColor('teal');
$graph->AddY(0, $p2);
$graph->ynaxis[0]->SetColor('teal');
$p3 = new LinePlot($datay3);
$p3->SetColor('red');
$graph->AddY(1, $p3);
$graph->ynaxis[1]->SetColor('red');
$p4 = new LinePlot($datay4);
$p4->SetColor('blue');
$graph->AddY(2, $p4);
$graph->ynaxis[2]->SetColor('blue');
// Output line
$graph->Stroke();
?>


Esempio n. 21
0
$graph->yaxis->SetTickSide(SIDE_LEFT);
$graph->y2axis->SetTickSide(SIDE_RIGHT);
$graph->y2axis->SetColor('black', 'blue');
$graph->y2axis->SetLabelFormat('%3d.0%%');
// Create a bar pot
$bplot = new BarPlot($data_freq);
// Create targets and alt texts for the image maps. One for each bar
// (In this example this is just "dummy" targets)
$targ = array("#1", "#2", "#3", "#4", "#5", "#6", "#7");
$alts = array("val=%d", "val=%d", "val=%d", "val=%d", "val=%d", "val=%d", "val=%d");
$bplot->SetCSIMTargets($targ, $alts);
// Create accumulative graph
$lplot = new LinePlot($data_accfreq);
// We want the line plot data point in the middle of the bars
$lplot->SetBarCenter();
// Use transperancy
$lplot->SetFillColor('lightblue@0.6');
$lplot->SetColor('blue@0.6');
//$lplot->SetColor('blue');
$graph->AddY2($lplot);
// Setup the bars
$bplot->SetFillColor("orange@0.2");
$bplot->SetValuePos('center');
$bplot->value->SetFormat("%d");
$bplot->value->SetFont(FF_ARIAL, FS_NORMAL, 9);
$bplot->value->Show();
// Add it to the graph
$graph->Add($bplot);
// Send back the HTML page which will call this script again
// to retrieve the image.
$graph->StrokeCSIM();
Esempio n. 22
0
// Create the graph
$g = new Graph(300, 200);
$g->SetMargin(30, 20, 40, 30);
$g->title->Set("Natural cubic splines");
$g->title->SetFont(FF_ARIAL, FS_NORMAL, 12);
$g->subtitle->Set('(Control points shown in red)');
$g->subtitle->SetColor('darkred');
$g->SetMarginColor('lightblue');
//$g->img->SetAntiAliasing();
// We need a linlin scale since we provide both
// x and y coordinates for the data points.
$g->SetScale('linlin');
// We want 1 decimal for the X-label
$g->xaxis->SetLabelFormat('%1.1f');
// We use a scatterplot to illustrate the original
// contro points.
$splot = new ScatterPlot($ydata, $xdata);
//
$splot->mark->SetFillColor('red@0.3');
$splot->mark->SetColor('red@0.5');
// And a line plot to stroke the smooth curve we got
// from the original control points
$lplot = new LinePlot($newy, $newx);
$lplot->SetColor('navy');
// Add the plots to the graph and stroke
$g->Add($lplot);
$g->Add($splot);
$g->Stroke();
?>

Esempio n. 23
0
pg_close($coop);
include "../../../include/jpgraph/jpgraph.php";
include "../../../include/jpgraph/jpgraph_bar.php";
include "../../../include/jpgraph/jpgraph_line.php";
include "../../../include/network.php";
$nt = new NetworkTable("IACLIMATE");
$cities = $nt->table;
$graph = new Graph(600, 400, "example1");
$graph->SetScale("textlin", 0, 100);
$graph->img->SetMargin(40, 5, 35, 60);
$graph->xaxis->SetTickLabels($xdata);
$graph->xaxis->SetTextTickInterval(100);
$graph->xaxis->SetLabelAngle(90);
$graph->xaxis->SetTitle("Precip [inches]");
$graph->xaxis->SetTitleMargin(30);
$graph->yaxis->SetTitle("Cumulative Distribution (percent)");
$graph->title->Set($cities[$station]['name'] . " Precip Accumulation Probabilities");
$graph->subtitle->Set($subtitle);
$l1 = new LinePlot($ydata);
$l1->SetColor("blue");
$l1->SetWeight(2);
$l1->AddArea($hm, $hm, LP_AREA_FILLED, "lightred");
$l1->AddArea($h95, $h95, LP_AREA_FILLED, "lightred");
$l1->AddArea($h5, $h5, LP_AREA_FILLED, "lightred");
$txt = new Text("Diagnostics\n  Min: {$lowVal} ({$lowYear})\n  95%: " . ($lowVal + $h95 * 0.01) . "\n~Mean: " . ($lowVal + $hm * 0.01) . "\n   SD: {$stddev}\n   5%: " . ($lowVal + $h5 * 0.01) . "\n  Max: {$hiVal} ({$hiYear})\n");
$txt->SetPos(0.71, 0.128);
$txt->SetFont(FF_FONT1, FS_NORMAL);
$txt->SetColor("blue");
$graph->Add($l1);
$graph->Add($txt);
$graph->Stroke();
Esempio n. 24
0
$graph = new Graph(300, 200);
$graph->SetMarginColor('white');
$graph->SetScale("textlin");
$graph->SetFrame(false);
$graph->SetMargin(30, 5, 25, 20);
// Setup the tab
$graph->tabtitle->Set(' Year 2003 ');
$graph->tabtitle->SetFont(FF_ARIAL, FS_BOLD, 13);
$graph->tabtitle->SetColor('darkred', '#E1E1FF');
// Enable X-grid as well
$graph->xgrid->Show();
// Use months as X-labels
$graph->xaxis->SetTickLabels($gDateLocale->GetShortMonth());
// Create the plot
$p1 = new LinePlot($datay1);
$p1->SetColor("navy");
$p1->SetCSIMTargets(array('#1', '#2', '#3', '#4', '#5'));
// Use an image of favourite car as
$p1->mark->SetType(MARK_IMG, 'saab_95.jpg', 0.5);
//$p1->mark->SetType(MARK_SQUARE);
// Displayes value on top of marker image
$p1->value->SetFormat('%d mil');
$p1->value->Show();
$p1->value->SetColor('darkred');
$p1->value->SetFont(FF_ARIAL, FS_BOLD, 10);
// Increase the margin so that the value is printed avove tje
// img marker
$p1->value->SetMargin(14);
// Incent the X-scale so the first and last point doesn't
// fall on the edges
$p1->SetCenter();
Esempio n. 25
0
$graph->SetScale("textlin");
$graph->SetFrame(false);
$graph->SetMargin(30, 50, 30, 30);
$graph->title->Set('Filled Y-grid');
$graph->yaxis->HideZeroLabel();
$graph->ygrid->SetFill(true, '#EFEFEF@0.5', '#BBCCFF@0.5');
$graph->xgrid->Show();
$graph->xaxis->SetTickLabels($gDateLocale->GetShortMonth());
// Create the first line
$p1 = new LinePlot($datay1);
$p1->SetColor("navy");
$p1->SetLegend('Line 1');
$graph->Add($p1);
// Create the second line
$p2 = new LinePlot($datay2);
$p2->SetColor("red");
$p2->SetLegend('Line 2');
$graph->Add($p2);
// Create the third line
$p3 = new LinePlot($datay3);
$p3->SetColor("orange");
$p3->SetLegend('Line 3');
$graph->Add($p3);
$graph->legend->SetShadow('gray@0.4', 5);
$graph->legend->SetPos(0.1, 0.1, 'right', 'top');
// Output line
$graph->Stroke();
?>


Esempio n. 26
0
 private function _renderPlotScatter($groupID, $bubble)
 {
     $grouping = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotGrouping();
     $scatterStyle = $bubbleSize = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotStyle();
     $seriesCount = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount();
     $seriesPlots = array();
     //	Loop through each data series in turn
     for ($i = 0; $i < $seriesCount; ++$i) {
         $dataValuesY = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex($i)->getDataValues();
         $dataValuesX = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues();
         foreach ($dataValuesY as $k => $dataValueY) {
             $dataValuesY[$k] = $k;
         }
         $seriesPlot = new ScatterPlot($dataValuesX, $dataValuesY);
         if ($scatterStyle == 'lineMarker') {
             $seriesPlot->SetLinkPoints();
             $seriesPlot->link->SetColor(self::$_colourSet[self::$_plotColour]);
         } elseif ($scatterStyle == 'smoothMarker') {
             $spline = new Spline($dataValuesY, $dataValuesX);
             list($splineDataY, $splineDataX) = $spline->Get(count($dataValuesX) * self::$_width / 20);
             $lplot = new LinePlot($splineDataX, $splineDataY);
             $lplot->SetColor(self::$_colourSet[self::$_plotColour]);
             $this->_graph->Add($lplot);
         }
         if ($bubble) {
             $this->_formatPointMarker($seriesPlot, 'dot');
             $seriesPlot->mark->SetColor('black');
             $seriesPlot->mark->SetSize($bubbleSize);
         } else {
             $marker = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getPointMarker();
             $this->_formatPointMarker($seriesPlot, $marker);
         }
         $dataLabel = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotLabelByIndex($i)->getDataValue();
         $seriesPlot->SetLegend($dataLabel);
         $this->_graph->Add($seriesPlot);
     }
 }
Esempio n. 27
0
<?php

// content="text/plain; charset=utf-8"
require_once '../jpgraph.php';
require_once '../jpgraph_line.php';
$ydata = array(11, 3, 8, 12, 5, 1, 9, 13, 5, 7);
// Create the graph. These two calls are always required
$graph = new Graph(300, 200);
$graph->SetScale("textlin");
$graph->img->SetMargin(50, 90, 40, 50);
$graph->xaxis->SetFont(FF_FONT1, FS_BOLD);
$graph->title->Set("Examples for graph");
// Create the linear plot
$lineplot = new LinePlot($ydata);
$lineplot->SetLegend("Test 1");
$lineplot->SetColor("blue");
// Add the plot to the graph
$graph->Add($lineplot);
// Display the graph
$graph->Stroke();
Esempio n. 28
0
    $x[$i] = str_pad($crhour, 2, $hr_pad, STR_PAD_LEFT) . ":" . str_pad($crmin, 2, "0", STR_PAD_LEFT);
}
$datax = $x;
// Create the graph. These two calls are always required
$graph = new Graph($xsize, $ysize, "auto", 30);
$graph->SetScale("textlin");
$graph->yaxis->scale->SetGrace(10);
$graph->SetMarginColor("{$margincolour}");
// Add a drop shadow
$graph->SetShadow();
// Adjust the margin a bit to make more room for titles
$graph->SetMargin($lm, $rm, $tm, $bm);
// Create a line plot
$lplot = new LinePlot($datay);
$lplot->SetWeight(2);
$lplot->SetColor("{$speed_col}");
$graph->Add($lplot);
// titles
$graph->title->SetFont(FF_ARIAL, FS_BOLD, 10);
$graph->title->Set("{$txt_wind_sp} {$txt_60m} ({$speed_unit})");
$graph->title->SetColor("{$textcolour}");
//x-axis
$graph->xaxis->title->SetFont(FF_ARIAL, FS_BOLD, 8);
$graph->xaxis->SetFont(FF_ARIAL, FS_BOLD, 8);
$graph->xaxis->SetTitlemargin(25);
$graph->xaxis->SetLabelMargin(10);
$graph->xaxis->SetTickLabels($datax);
$graph->xaxis->SetLabelAngle($label_angle);
$graph->xaxis->SetTextLabelInterval($label_interval);
$graph->xaxis->SetPos("min");
$graph->xaxis->HideTicks(true, true);
Esempio n. 29
0
<?php

// content="text/plain; charset=utf-8"
require_once "jpgraph/jpgraph.php";
require_once "jpgraph/jpgraph_line.php";
$l1datay = array(11, 9, 2, 4, 3, 13, 17);
$l2datay = array(23, 12, 5, 19, 17, 10, 15);
$datax = array('Jan', 'Feb', 'Mar', 'Apr', 'May');
// Create the graph.
$graph = new Graph(400, 200);
$graph->SetScale('textlin');
$graph->img->SetMargin(40, 130, 20, 40);
$graph->SetShadow();
// Create the linear error plot
$l1plot = new LinePlot($l1datay);
$l1plot->SetColor('red');
$l1plot->SetWeight(2);
$l1plot->SetLegend('Prediction');
// Create the bar plot
$l2plot = new LinePlot($l2datay);
$l2plot->SetFillColor('orange');
$l2plot->SetLegend('Result');
// Add the plots to the graph
$graph->Add($l2plot);
$graph->Add($l1plot);
$graph->title->Set('Mixing line and filled line');
$graph->xaxis->title->Set('X-title');
$graph->yaxis->title->Set('Y-title');
$graph->title->SetFont(FF_FONT1, FS_BOLD);
$graph->yaxis->title->SetFont(FF_FONT1, FS_BOLD);
$graph->xaxis->title->SetFont(FF_FONT1, FS_BOLD);
Esempio n. 30
0
$lineplot_in = new LinePlot($in_data, $ticks);
$lineplot_in->SetLegend('Traffic In');
$lineplot_in->SetColor('darkgreen');
$lineplot_in->SetFillColor('lightgreen@0.4');
$lineplot_in->SetWeight(1);
$lineplot_out = new LinePlot($out_data_inv, $ticks);
$lineplot_out->SetLegend('Traffic Out');
$lineplot_out->SetColor('darkblue');
$lineplot_out->SetFillColor('lightblue@0.4');
$lineplot_out->SetWeight(1);
if ($_GET['95th']) {
    $lineplot_95th = new LinePlot($per_data, $ticks);
    $lineplot_95th->SetColor('red');
}
if ($_GET['ave']) {
    $lineplot_ave = new LinePlot($ave_data, $ticks);
    $lineplot_ave->SetColor('red');
}
$graph->legend->SetLayout(LEGEND_HOR);
$graph->legend->Pos(0.52, 0.9, 'center');
$graph->Add($lineplot);
// $graph->Add($lineplot2);
$graph->Add($lineplot_in);
$graph->Add($lineplot_out);
if ($_GET['95th']) {
    $graph->Add($lineplot_95th);
}
if ($_GET['ave']) {
    $graph->Add($lineplot_ave);
}
$graph->stroke();