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); }
$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); $graph->SetDataValues($example_data);
$graph->SetDrawXGrid(TRUE); $graph->SetDrawYGrid(TRUE); break; case 'none': $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->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 $graph->SetPlotBgColor(array(222,222,222));
<?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);