public function doGet(WebAppRequest $req, WebAppResponse $res)
 {
     // Bootstraps Innomatic
     require_once 'innomatic/core/InnomaticContainer.php';
     $innomatic = InnomaticContainer::instance('innomaticcontainer');
     // Sets Innomatic base URL
     $baseUrl = '';
     $webAppPath = $req->getUrlPath();
     if (!is_null($webAppPath) && $webAppPath != '/') {
         $baseUrl = $req->generateControllerPath($webAppPath, true);
     }
     $innomatic->setBaseUrl($baseUrl);
     $innomatic->setInterface(InnomaticContainer::INTERFACE_WEB);
     $home = WebAppContainer::instance('webappcontainer')->getCurrentWebApp()->getHome();
     $innomatic->bootstrap($home, $home . 'core/conf/innomatic.ini');
     $id = basename($req->getParameter('id'));
     //$id = basename($_GET['id']);
     $args = unserialize(file_get_contents(InnomaticContainer::instance('innomaticcontainer')->getHome() . 'core/temp/phplot/' . $id));
     require_once 'phplot/PHPlot.php';
     $graph = new PHPlot($args['width'], $args['height']);
     $graph->SetIsInline('1');
     //$graph->SetDataColors( array("blue",'white'),array("black") );
     //$graph->$line_style = array('dashed','dashed','solid','dashed','dashed','solid');
     // Base
     $graph->SetDataValues($args['data']);
     $graph->SetPlotType($args['plottype']);
     // Appearance
     $graph->SetPointShape($args['pointshape']);
     $graph->SetPointSize($args['pointsize']);
     $graph->SetTitle($args['title']);
     // Color
     $graph->SetBackgroundColor($args['backgroundcolor']);
     $graph->SetGridColor($args['gridcolor']);
     if (count($args['legend'])) {
         $graph->SetLegend($args['legend']);
     }
     $graph->SetLineWidth($args['linewidth']);
     $graph->SetTextColor($args['textcolor']);
     $graph->SetDataColors(array(array(145, 165, 207), array(114, 167, 112), array(71, 85, 159), array(175, 83, 50), array(247, 148, 53), array(240, 231, 125), array(154, 204, 203), array(201, 164, 196)), 'black');
     //$graph->data_color = array( array(145,165,207), array(114,167,112), array(71,85,159), array(175,83,50), array(247,148,53), array(240,231,125), array(154,204,203), array(201,164,196) );
     //array('blue','green','yellow','red','orange');
     $graph->DrawGraph();
     unlink(InnomaticContainer::instance('innomaticcontainer')->getHome() . 'core/temp/phplot/' . $id);
 }
Example #2
0
$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);
$graph->SetDataValues($example_data);
$graph->SetXGridLabelType("time");
$graph->SetXDataLabelAngle(90);
Example #3
0
$graph->SetXTitle($xlbl, $which_xtitle_pos);
$graph->SetYTitle($ylbl, $which_ytitle_pos);
$graph->SetLegend(array("A", "Bee", "Cee", "Dee"));
$graph->SetFileFormat($which_fileformat);
$graph->SetPlotType($which_plot_type);
$graph->SetUseTTF($which_use_ttf);
$graph->SetYTickIncrement($which_yti);
$graph->SetXTickIncrement($which_xti);
$graph->SetXTickLength($which_xtl);
$graph->SetYTickLength($which_ytl);
$graph->SetXTickCrossing($which_xtc);
$graph->SetYTickCrossing($which_ytc);
$graph->SetXTickPos($which_xtick_pos);
$graph->SetYTickPos($which_ytick_pos);
$graph->SetShading($which_shading);
$graph->SetLineWidth($which_line_width);
$graph->SetErrorBarLineWidth($which_errorbar_line_width);
$graph->SetDrawDashedGrid($which_dashed_grid);
switch ($which_draw_grid) {
    case 'x':
        $graph->SetDrawXGrid(TRUE);
        $graph->SetDrawYGrid(FALSE);
        break;
    case 'y':
        $graph->SetDrawXGrid(FALSE);
        $graph->SetDrawYGrid(TRUE);
        break;
    case 'both':
        $graph->SetDrawXGrid(TRUE);
        $graph->SetDrawYGrid(TRUE);
        break;
Example #4
0
}
$graph->SetDataType("linear-linear-error");
//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
Example #5
0
<?php

require 'amproot.php';
init_amp_root();
OpenLibrary('phplot.library');
$id = basename($_GET['id']);
$args = unserialize(file_get_contents(TMP_PATH . 'phplot/' . $id));
$graph = new PHPlot($args['width'], $args['height']);
$graph->SetIsInline('1');
//$graph->SetDataColors( array("blue",'white'),array("black") );
//$graph->$line_style = array('dashed','dashed','solid','dashed','dashed','solid');
// Base
$graph->SetDataValues($args['data']);
$graph->SetPlotType($args['plottype']);
// Appearance
$graph->SetPointShape($args['pointshape']);
$graph->SetPointSize($args['pointsize']);
$graph->SetTitle($args['title']);
// Color
$graph->SetBackgroundColor($args['backgroundcolor']);
$graph->SetGridColor($args['gridcolor']);
if (count($args['legend'])) {
    $graph->SetLegend($args['legend']);
}
$graph->SetLineWidth($args['linewidth']);
$graph->SetTextColor($args['textcolor']);
$graph->SetDataColors(array(array(145, 165, 207), array(114, 167, 112), array(71, 85, 159), array(175, 83, 50), array(247, 148, 53), array(240, 231, 125), array(154, 204, 203), array(201, 164, 196)), 'black');
//$graph->data_color = array( array(145,165,207), array(114,167,112), array(71,85,159), array(175,83,50), array(247,148,53), array(240,231,125), array(154,204,203), array(201,164,196) );
//array('blue','green','yellow','red','orange');
$graph->DrawGraph();
unlink(TMP_PATH . 'phplot/' . $id);
Example #6
0
/**
 * drawing the graph for a evaluation question
 *
 * @param array() $data
 * @param string $evalquestion_id
 */
function do_graph($data, $evalquestion_id)
{
    global $tmp_path_export, $auth, $PATH_EXPORT;
    $type = do_graph_template();
    //Define the object
    if ($type == "pie") {
        // Beim pie muss die Zeichenflaeche etwas groesser gewaehlt werden...
        $graph = new PHPlot(500, 300);
    } else {
        $graph = new PHPlot(300, 250);
    }
    if ($type == "pie") {
        // Beim pie muss das Array umgeformt werden. Bug in PHPlot?
        $tmp = array();
        $tmp2 = array();
        $legend = array();
        array_push($tmp, "Test");
        foreach ($data as $k => $d) {
            array_push($tmp, $d[1]);
            array_push($legend, $d[0]);
        }
        array_push($tmp2, $tmp);
        $data = $tmp2;
        $graph->SetLegend($legend);
    }
    //Data Colors
    $graph->SetDataColors(array("blue", "green", "yellow", "red", "PeachPuff", "orange", "pink", "lavender", "navy", "peru", "salmon", "maroon", "magenta", "orchid", "ivory"), array("black"));
    $max_x = max(array_map('next', $data));
    $graph->SetPlotAreaWorld(NULL, 0);
    // y-achse bei 0 starten
    $graph->SetPrecisionY(0);
    //anzahl kommastellen y-achse
    $graph->SetYTickIncrement($max_x < 10 ? 1 : round($max_x / 10));
    $graph->SetPlotBgColor(array(222, 222, 222));
    $graph->SetDataType("text-data");
    $graph->SetFileFormat(Config::get()->EVAL_AUSWERTUNG_GRAPH_FORMAT);
    $graph->SetOutputFile($tmp_path_export . "/evalsum" . $evalquestion_id . $auth->auth["uid"] . "." . Config::get()->EVAL_AUSWERTUNG_GRAPH_FORMAT);
    $graph->SetIsInline(true);
    $graph->SetDataValues($data);
    $graph->SetPlotType($type);
    $graph->SetXLabelAngle(count($data) < 10 ? 0 : 90);
    //$graph->SetShading(0); // kein 3D
    $graph->SetLineWidth(1);
    $graph->SetDrawXDataLabels(true);
    //Draw it
    $graph->DrawGraph();
}