public function index() { // We want a bar graph, so use JpGraph's bar chart library require_once APPPATH . '/libraries/JpGraph/jpgraph_bar.php'; // Example data (04/2015) $json = '[{"Hogwarts Academy":{"Yield":"19021 kWh","Yield specific":"127.01 kWh\\/kWp","Target yield":"16069.23 kWh","Current-target yield %":"<span style=\\"color: #3ab121\\">118.37 %<span>"}},{"cols": [{"id":"","label":"Time","pattern":"","type":"string"},{"id":"","label":"Hogwarts Academy (AC)","pattern":"","type":"number"},{"id":"","label":"Target values","pattern":"","type":"number"}], "rows": [{"c":[{"v":"01/04","f":null}, {"v":615.8,"f":"615,80 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"02/04","f":null}, {"v":712.5,"f":"712,50 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"03/04","f":null}, {"v":171,"f":"171,00 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"04/04","f":null}, {"v":382.3,"f":"382,30 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"05/04","f":null}, {"v":606.3,"f":"606,30 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"06/04","f":null}, {"v":774.5,"f":"774,50 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"07/04","f":null}, {"v":570.6,"f":"570,60 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"08/04","f":null}, {"v":726.8,"f":"726,80 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"09/04","f":null}, {"v":789.2,"f":"789,20 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"10/04","f":null}, {"v":592.9,"f":"592,90 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"11/04","f":null}, {"v":677.1,"f":"677,10 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"12/04","f":null}, {"v":244.5,"f":"244,50 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"13/04","f":null}, {"v":457.4,"f":"457,40 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"14/04","f":null}, {"v":340.8,"f":"340,80 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"15/04","f":null}, {"v":425.3,"f":"425,30 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"16/04","f":null}, {"v":828.8,"f":"828,80 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"17/04","f":null}, {"v":616.8,"f":"616,80 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"18/04","f":null}, {"v":660.3,"f":"660,30 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"19/04","f":null}, {"v":453.2,"f":"453,20 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"20/04","f":null}, {"v":691.9,"f":"691,90 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"21/04","f":null}, {"v":904.4,"f":"904,40 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"22/04","f":null}, {"v":879.1,"f":"879,10 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"23/04","f":null}, {"v":824.8,"f":"824,80 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"24/04","f":null}, {"v":777.9,"f":"777,90 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"25/04","f":null}, {"v":413.8,"f":"413,80 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"26/04","f":null}, {"v":834.8,"f":"834,80 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"27/04","f":null}, {"v":920.8,"f":"920,80 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"28/04","f":null}, {"v":751,"f":"751,00 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"29/04","f":null}, {"v":737.7,"f":"737,70 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"30/04","f":null}, {"v":638.7,"f":"638,70 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]}]}]'; // Turn string into object $obj = json_decode($json); // Stores for graph data $xdata = array(); $ydata = array(); // Get coords data from object $obj_data = $obj[1]->rows; $counter = 1; // Add it to each of our storage arrays foreach ($obj_data as $data) { // only plot when there is a kW value if (isset($data->c[1]->v)) { $xdata[] = $data->c[0]->v; // date $ydata[] = $data->c[1]->v; // kw } } // Create the graph. // One minute timeout for the cached image // INLINE_NO means don't stream it back to the browser. $graph = new Graph(600, 350, 'auto'); $graph->SetScale("textlin"); $graph->img->SetMargin(60, 30, 20, 40); $graph->yaxis->SetTitleMargin(45); $graph->yaxis->scale->SetGrace(30); $graph->SetShadow(); // Turn the tickmarks $graph->xaxis->SetTickSide(SIDE_DOWN); $graph->yaxis->SetTickSide(SIDE_LEFT); // Create a bar pot $bplot = new BarPlot($ydata); $bplot->SetFillColor("orange"); // Use a shadow on the bar graphs (just use the default settings) $bplot->SetShadow(); $bplot->value->SetFormat(" %2.1f kW", 70); $bplot->value->SetFont(FF_VERDANA, FS_NORMAL, 8); $bplot->value->SetColor("blue"); $bplot->value->Show(); $graph->Add($bplot); $graph->title->Set("Hogwarts Academy"); $graph->xaxis->title->Set("Day"); $graph->yaxis->title->Set("Yield in kilowatt hours"); $graph->title->SetFont(FF_FONT1, FS_BOLD); $graph->yaxis->title->SetFont(FF_FONT1, FS_BOLD); $graph->xaxis->title->SetFont(FF_FONT1, FS_BOLD); // Send back the HTML page which will call this script again // to retrieve the image. $graph->StrokeCSIM(); }
public function iterationSummaryAux($id) { JpGraph\JpGraph::load(); JpGraph\JpGraph::module('bar'); $datay = array(12, 26, 9, 17, 31); // Create the graph. // One minute timeout for the cached image // INLINE_NO means don't stream it back to the browser. $graph = new Graph(310, 250, 'auto'); $graph->SetScale("textlin"); $graph->img->SetMargin(60, 30, 20, 40); $graph->yaxis->SetTitleMargin(45); $graph->yaxis->scale->SetGrace(30); $graph->SetShadow(); // Turn the tickmarks $graph->xaxis->SetTickSide(SIDE_DOWN); $graph->yaxis->SetTickSide(SIDE_LEFT); // Create a bar pot $bplot = new BarPlot($datay); // Create targets for the image maps. One for each column $targ = array("bar_clsmex1.php#1", "bar_clsmex1.php#2", "bar_clsmex1.php#3", "bar_clsmex1.php#4", "bar_clsmex1.php#5", "bar_clsmex1.php#6"); $alts = array("val=%d", "val=%d", "val=%d", "val=%d", "val=%d", "val=%d"); $bplot->SetCSIMTargets($targ, $alts); $bplot->SetFillColor("orange"); // Use a shadow on the bar graphs (just use the default settings) $bplot->SetShadow(); $bplot->value->SetFormat(" \$ %2.1f", 70); $bplot->value->SetFont(FF_ARIAL, FS_NORMAL, 9); $bplot->value->SetColor("blue"); $bplot->value->Show(); $graph->Add($bplot); $graph->title->Set("Image maps barex1"); $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); // Send back the HTML page which will call this script again // to retrieve the image. $graph->StrokeCSIM(); }
"bar_clsmex2.php#4","bar_clsmex2.php#5","bar_clsmex2.php#6"); $alts=array("val=%d","val=%d","val=%d","val=%d","val=%d","val=%d"); $b1plot->SetCSIMTargets($targ,$alts); $b2plot = new BarPlot($data2y); $b2plot->SetFillColor("blue"); $targ=array("bar_clsmex2.php#7","bar_clsmex2.php#8","bar_clsmex2.php#9", "bar_clsmex2.php#10","bar_clsmex2.php#11","bar_clsmex2.php#12"); $alts=array("val=%d","val=%d","val=%d","val=%d","val=%d","val=%d"); $b2plot->SetCSIMTargets($targ,$alts); // Create the accumulated bar plot $abplot = new AccBarPlot(array($b1plot,$b2plot)); $abplot->SetShadow(); // We want to display the value of each bar at the top $abplot->value->Show(); $abplot->value->SetFont(FF_FONT1,FS_NORMAL); $abplot->value->SetAlign('left','center'); $abplot->value->SetColor("black","darkred"); $abplot->value->SetFormat('%.1f mkr'); // ...and add it to the graph $graph->Add($abplot); // Send back the HTML page which will call this script again // to retrieve the image. $graph->StrokeCSIM(); ?>
$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('barlinefreq_csimex1.php');
<?php // Example of a stock chart include "../jpgraph.php"; include "../jpgraph_stock.php"; // Data must be in the format : open,close,min,max,median $datay = array(34, 42, 27, 45, 36, 55, 25, 14, 59, 40, 15, 40, 12, 47, 23, 62, 38, 25, 65, 57, 38, 49, 32, 64, 45); // Setup a simple graph $graph = new Graph(300, 200); $graph->SetScale("textlin"); $graph->SetMarginColor('lightblue'); $graph->title->Set('Box Stock chart example'); // Create a new stock plot $p1 = new BoxPlot($datay); // Setup URL target for image map $p1->SetCSIMTargets(array('#1', '#2', '#3', '#4', '#5')); // Width of the bars (in pixels) $p1->SetWidth(9); //$p1->SetCenter(); // Uncomment the following line to hide the horizontal end lines //$p1->HideEndLines(); // Add the plot to the graph and send it back to the browser $graph->Add($p1); $graph->StrokeCSIM(basename(__FILE__));
$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(); $graph->Add($p1); $graph->StrokeCSIM('imgmarkercsimex1.php'); ?>
$graph = new Graph(310, 200, 'auto'); $graph->SetScale("textlin"); $graph->img->SetMargin(40, 30, 20, 40); $graph->SetShadow(); // Create the bar plots $b1plot = new BarPlot($data1y); $b1plot->SetFillColor("orange"); $targ = array("bar_clsmex2.php#1", "bar_clsmex2.php#2", "bar_clsmex2.php#3", "bar_clsmex2.php#4", "bar_clsmex2.php#5", "bar_clsmex2.php#6"); $alts = array("val=%d", "val=%d", "val=%d", "val=%d", "val=%d", "val=%d"); $b1plot->SetCSIMTargets($targ, $alts); $b2plot = new BarPlot($data2y); $b2plot->SetFillColor("blue"); $targ = array("bar_clsmex2.php#7", "bar_clsmex2.php#8", "bar_clsmex2.php#9", "bar_clsmex2.php#10", "bar_clsmex2.php#11", "bar_clsmex2.php#12"); $alts = array("val=%d", "val=%d", "val=%d", "val=%d", "val=%d", "val=%d"); $b2plot->SetCSIMTargets($targ, $alts); // Create the grouped bar plot $abplot = new AccBarPlot(array($b1plot, $b2plot)); $abplot->SetShadow(); $abplot->value->Show(); // ...and add it to the graPH $graph->Add($abplot); $graph->title->Set("Image map barex2"); $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); // Send back the HTML page which will call this script again // to retrieve the image. $graph->StrokeCSIM('bar_csimex2.php');
<?php include_once "../jpgraph.php"; include_once "../jpgraph_scatter.php"; // Some data for the points $datax = array(3.5, 13.7, 3, 4, 6.2, 6, 3.5, 8, 14, 8, 11.1, 13.7); $datay = array(10, 22, 12, 13, 17, 20, 16, 19, 30, 31, 40, 43); // A new scatter graph $graph = new Graph(300, 200, 'auto'); $graph->SetShadow(); $graph->SetScale("linlin"); //$graph->img->SetMargin(40,40,40,40); $graph->title->Set("Scatter plot with Image Map"); $graph->title->SetFont(FF_FONT1, FS_BOLD); // Client side image map targets $targ = array("pie_csimex1.php#1", "pie_csimex1.php#2", "pie_csimex1.php#3", "pie_csimex1.php#4", "pie_csimex1.php#5", "pie_csimex1.php#6", "pie_csimex1.php#7", "pie_csimex1.php#8", "pie_csimex1.php#9"); // Strings to put as "alts" (and "title" value) $alts = array("val=%d", "val=%d", "val=%d", "val=%d", "val=%d", "val=%d", "val=%d", "val=%d", "val=%d"); // Create a new scatter plot $sp1 = new ScatterPlot($datay, $datax); // Use diamonds as markerss $sp1->mark->SetType(MARK_DIAMOND); $sp1->mark->SetWidth(10); // Set the scatter plot image map targets $sp1->SetCSIMTargets($targ, $alts); // Add the plot $graph->Add($sp1); // Send back the HTML page which will call this script again // to retrieve the image. $graph->StrokeCSIM('scatter_csimex1.php');
// This will disable to Main SyslogView and show an error message $content['error_occured'] = true; $content['error_details'] = GetErrorMessage($res); if (isset($extraErrorDescription)) { $content['error_details'] .= "\n\n" . GetAndReplaceLangStr($content['LN_SOURCES_ERROR_EXTRAMSG'], $extraErrorDescription); } } // Close file! $stream->Close(); } else { $content['error_occured'] = true; $content['error_details'] = GetAndReplaceLangStr($content['LN_GEN_ERROR_SOURCENOTFOUND'], $currentSourceID); } } if ($content['error_occured']) { // Use JpGraph to display errors! $myError = new JpGraphErrObjectImg(); $myError->SetTitle($content['LN_GEN_ERRORDETAILS']); if (GetConfigSetting("MiscShowDebugMsg", 0, CFGLEVEL_USER) == 1) { $myError->Raise($content['error_details'] . "\n\nDebug Details: \n" . var_export($content['DEBUGMSG'], true), true); } else { $myError->Raise($content['error_details'], true); } // Exit in any case exit; } // --- // --- Output the image //$graph->Stroke(); $graph->StrokeCSIM(basename(__FILE__), '', 0); // ---
$graph->img->SetMargin(60, 30, 20, 40); $graph->yaxis->SetTitleMargin(45); $graph->yaxis->scale->SetGrace(30); $graph->SetShadow(); // Turn the tickmarks $graph->xaxis->SetTickSide(SIDE_DOWN); $graph->yaxis->SetTickSide(SIDE_LEFT); // Create a bar pot $bplot = new BarPlot($datay); // Create targets for the image maps. One for each column $targ = array("bar_clsmex1.php#1", "bar_clsmex1.php#2", "bar_clsmex1.php#3", "bar_clsmex1.php#4", "bar_clsmex1.php#5", "bar_clsmex1.php#6"); $alts = array("val=%d", "val=%d", "val=%d", "val=%d", "val=%d", "val=%d"); $bplot->SetCSIMTargets($targ, $alts); $bplot->SetFillColor("orange"); // Use a shadow on the bar graphs (just use the default settings) $bplot->SetShadow(); $bplot->value->SetFormat(" \$ %2.1f", 70); $bplot->value->SetFont(FF_ARIAL, FS_NORMAL, 9); $bplot->value->SetColor("blue"); $bplot->value->Show(); $graph->Add($bplot); $graph->title->Set("Image maps barex1"); $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); // Send back the HTML page which will call this script again // to retrieve the image. $graph->StrokeCSIM('bar_csimex1.php', 'bar_csimex1');
$graph->yaxis->title->Align('center', 'top'); $graph->yaxis->SetTitleMargin(30); // Arrange the labels $graph->yaxis->SetLabelSide(SIDE_RIGHT); $graph->yaxis->SetLabelAlign('center', 'top'); // Create the bar plots with image maps $b1plot = new BarPlot($data1y); $b1plot->SetFillColor("orange"); $targ = array("bar_clsmex2.php#1", "bar_clsmex2.php#2", "bar_clsmex2.php#3", "bar_clsmex2.php#4", "bar_clsmex2.php#5", "bar_clsmex2.php#6"); $alts = array("val=%d", "val=%d", "val=%d", "val=%d", "val=%d", "val=%d"); $b1plot->SetCSIMTargets($targ, $alts); $b2plot = new BarPlot($data2y); $b2plot->SetFillColor("blue"); $targ = array("bar_clsmex2.php#7", "bar_clsmex2.php#8", "bar_clsmex2.php#9", "bar_clsmex2.php#10", "bar_clsmex2.php#11", "bar_clsmex2.php#12"); $alts = array("val=%d", "val=%d", "val=%d", "val=%d", "val=%d", "val=%d"); $b2plot->SetCSIMTargets($targ, $alts); // Create the accumulated bar plot $abplot = new AccBarPlot(array($b1plot, $b2plot)); $abplot->SetShadow(); // We want to display the value of each bar at the top $abplot->value->Show(); $abplot->value->SetFont(FF_FONT1, FS_NORMAL); $abplot->value->SetAlign('left', 'center'); $abplot->value->SetColor("black", "darkred"); $abplot->value->SetFormat('%.1f mkr'); // ...and add it to the graph $graph->Add($abplot); // Send back the HTML page which will call this script again // to retrieve the image. $graph->StrokeCSIM('bar_csimex3.php', 'bar_csimex3');
$graph->yaxis->title->SetFont(FF_ARIAL, FS_BOLD, 10); $graph->yaxis->title->SetColor('black'); $graph->Add($lp1); // First multi Y-axis plot $lp2 = new LinePlot($datay2); $lp2->SetLegend('2002'); $lp2->mark->SetType(MARK_DIAMOND); $lp2->mark->SetWidth(15); $lp2->mark->SetFillColor('darkred'); $lp2->SetCSIMTargets($targ2, $alts2); $graph->ynaxis[0]->SetColor('darkred'); $graph->ynaxis[0]->title->Set('Rate A'); $graph->ynaxis[0]->title->SetFont(FF_ARIAL, FS_BOLD, 10); $graph->ynaxis[0]->title->SetColor('darkred'); $graph->AddY(0, $lp2); // Second multi Y-axis plot $lp3 = new LinePlot($datay3); $lp3->SetLegend('2003'); $lp3->mark->SetType(MARK_DIAMOND); $lp3->mark->SetWidth(15); $lp3->mark->SetFillColor('darkgreen'); $lp3->SetCSIMTargets($targ3, $alts3); $graph->ynaxis[1]->SetColor('darkgreen'); $graph->ynaxis[1]->title->Set('Rate B'); $graph->ynaxis[1]->title->SetFont(FF_ARIAL, FS_BOLD, 10); $graph->ynaxis[1]->title->SetColor('darkgreen'); $graph->AddY(1, $lp3); // Send back the HTML page which will call this script again // to retrieve the image. $graph->StrokeCSIM('auto');
// Display the values on top of each bar $bplot->SetShadow(); $bplot->value->SetFormat(" \$ %2.1f", 70); $bplot->value->SetFont(FF_ARIAL, FS_NORMAL, 9); $bplot->value->SetColor("blue"); $bplot->value->Show(); $graph->Add($bplot); // Create a big "button" that has an image map action $txt1 = new Text("A simple text with\ntwo rows"); $txt1->SetFont(FF_ARIAL); $txt1->SetBox('lightblue', 'black', 'white@1', 5); $txt1->SetParagraphAlign('center'); $txt1->SetPos(40, 50); $txt1->SetCSIMTarget('#88', 'Text element'); $graph->Add($txt1); // Add image map to the graph title as well (you can do this to the // sub- and subsub-title as well) $graph->title->Set("Image maps barex1"); $graph->title->SetFont(FF_FONT1, FS_BOLD); $graph->title->SetCSIMTarget('#45', 'Title for Bar'); $graph->xaxis->title->Set("X-title"); $graph->yaxis->title->Set("Y-title"); // Setup the axis title image map and font style $graph->yaxis->title->SetFont(FF_FONT2, FS_BOLD); $graph->yaxis->title->SetCSIMTarget('#55', 'Y-axis title'); $graph->xaxis->title->SetFont(FF_FONT2, FS_BOLD); $graph->xaxis->title->SetCSIMTarget('#55', 'X-axis title'); // Send back the HTML page which will call this script again // to retrieve the image. $graph->StrokeCSIM('titlecsimex01.php');
$db->close(); $ydata = array_reverse($array_string_temperature); $xdata = array_reverse($array_string_timestamp); function getLocaltime($utc_time) { $utc_date = DateTime::createFromFormat('Y-m-d H:i:s', $utc_time, new DateTimeZone('UTC')); $local_date = $utc_date; $local_date->setTimeZone(new DateTimeZone('Europe/Helsinki')); $timestamp_string = $local_date->format('Y-m-d H:i:s'); return $timestamp_string; } require_once 'jpgraph/jpgraph.php'; require_once 'jpgraph/jpgraph_line.php'; require_once 'jpgraph/jpgraph_date.php'; // Create the graph. These two calls are always required $graph = new Graph(800, 600); $graph->SetScale('datlin'); $graph->xaxis->scale->SetTimeAlign(HOURADJ_1); $graph->xaxis->scale->SetDateFormat('H:i'); $graph->xaxis->SetLabelAngle(90); $graph->xgrid->Show(true); // Create the linear plot $lineplot = new LinePlot($ydata, $xdata); $lineplot->SetColor('blue'); // Add the plot to the graph $graph->Add($lineplot); // Display the graph $graph->StrokeCSIM("temp_graph.php"); ?>
$myError->SetTitle($content['LN_GEN_ERRORDETAILS']); if ( GetConfigSetting("MiscShowDebugMsg", 0, CFGLEVEL_USER) == 1 ) $myError->Raise($content['error_details'] . "\n\nDebug Details: \n" . var_export($content['DEBUGMSG'], true), true); else $myError->Raise($content['error_details'], true); // Exit in any case exit; } // --- */ // --- Output the image with HTML Code // Use Exception handling here to Show error's as well! try { $graph->StrokeCSIM($content['custombasepath'] . basename(__FILE__), '', 0); } catch (JpGraphException $e) { $content['error_occured'] = true; $content['error_details'] = $e->GetMessage(); OutpuCustomErrorMessage(); } // --- function OutpuCustomErrorMessage() { global $page, $content; // Create template Parser and output results $content['TITLE'] .= " :: " . $content['LN_GEN_ERRORDETAILS']; InitTemplateParser(); $page->parser($content, "chartgenerator.html"); $page->output(); // Exit in any case