Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.8.0

Bug #20923 Unable to view graph
Submitted: 2015-07-23 11:22 UTC
From: akshay Assigned:
Status: Open Package: Image_Graph (version 0.8.0)
PHP Version: 5.4.43 OS: Linux
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 23 + 42 = ?

 
 [2015-07-23 11:22 UTC] akshay (akshay ballarpure)
Description: ------------ I am unable to view graph using Image_Graph, can you please let me know the steps to debug this issue . Test script: --------------- function doChart($table, $fields, $appName, $node = "", $nodeTbl = "") { global $date, $site, $statsDB; include "Image/Graph.php"; if ( file_exists("/usr/openwin/lib/X11/fonts/TrueType/LiberationSans-Regular.ttf" ) ) { $fontPath = "/usr/openwin/lib/X11/fonts/TrueType/LiberationSans-Regular.ttf"; } else if ( file_exists("/usr/share/fonts/liberation/LiberationSans-Regular.ttf") ) { $fontPath = "/usr/share/fonts/liberation/LiberationSans-Regular.ttf"; } $graph =& Image_Graph::factory("graph",array(640,400)); $font =& $graph->addNew("font",$fontPath); $font->setSize(8); $graph->setFont($font); //Image_Graph::factory('title',array("EBA " . strtoupper($appName) . " Metrics: " . $fields, 12)), //Image_Graph::factory('title',array($date,8)), $graph->add( Image_Graph::vertical( Image_Graph::vertical( Image_Graph::factory('title',array("",12)), Image_Graph::factory('title',array("", 8)), 80 ), Image_Graph::vertical( $plotArea = Image_Graph::factory('plotarea'), $legend = Image_Graph::factory('legend'), 85 ), 9) ); $legend->setPlotArea($plotArea); $legend->setFillColor("#cccccc@0.5"); $gridY =& $plotArea->addNew('line_grid', null, IMAGE_GRAPH_AXIS_Y); $gridY->setLineColor('gray@0.1'); $fieldArr = explode(",", $fields); $datasets = array(); foreach ($fieldArr as $f) { $datasets[$f] =& Image_Graph::factory('dataset'); } $nodeFilter = ""; $tables = "eba_mdc," . $table . ",sites"; if ($node != "") { $nodeFilter = $table . ".moid_id = eba_moid.id AND eba_moid.name = '" . $node . "' AND "; $tables = "eba_moid," . $tables; } $sql = "SELECT DATE_FORMAT(begin_time,'%H:%i') AS begin_time," . $fields . " FROM " . $tables ." WHERE " . "begin_time BETWEEN '" . $date . " 00:00:00' AND '" . $date . " 23:59:59' AND " . "neun='" . $appName . "' AND siteid=sites.id AND sites.name = '" . $site . "' AND " . $nodeFilter . "mdc_id=eba_mdc.id ORDER BY begin_time"; $statsDB->query($sql); $yMax = 0; while ($row = $statsDB->getNextNamedRow()) { foreach ($row as $key => $val) { if ($key == "begin_time") { $xVal = $val; } else { if (isset($val) && $val != "" && isset($datasets[$key])) { if ($val > $yMax) $yMax = $val; $datasets[$key]->addPoint($xVal, $val); } } } } $colours = array("red","orange","yellow","green","blue","indigo","violet"); $i = 0; foreach ($datasets as $key => $dataset) { $plot =& $plotArea->addNew('line', array(&$dataset)); $plot->setTitle($key); $plot->setLineColor($colours[$i++]); } $xAxis =& $plotArea->getAxis(IMAGE_GRAPH_AXIS_X); $xAxis->setTitle("Time"); $xAxis->setLabelInterval(8); $yAxis =& $plotArea->getAxis(IMAGE_GRAPH_AXIS_Y); $yAxis->setTitle("Count", 'vertical'); $yAxis->forceMaximum($yMax * 1.1); $graph->setPadding(10); $graph->done(); } Expected result: ---------------- it must display image Actual result: -------------- image can't be displayed

Comments