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

Bug #16217 stacked bar graph doesn't work with one dataPoint
Submitted: 2009-05-11 15:45 UTC
From: mortoray Assigned:
Status: Open Package: Image_Graph (version 0.7.2)
PHP Version: 5.2.9 OS:
Roadmaps: (Not assigned)    
Subscription  


 [2009-05-11 15:45 UTC] mortoray (edA-qa mort-ora-y)
Description: ------------ A stacked bar graph simply isn't displayed if there is only a single data point (which multiple values). (I discovered this while writing my test case for 16216) Test script: --------------- <?php error_reporting( E_ERROR ); require_once 'Image/Graph.php'; $graph = Image_Graph::factory('graph', array(400, 300)); $graph->add( $plotarea = Image_Graph::factory('plotarea',array('category','axis','horizontal')) ); $data = array( 1, 2, 1, 3 ); for( $i=0; $i < count( $data); $i++ ) { $dataset[$i] = Image_Graph::factory('dataset'); $dataset[$i]->addPoint( 'One', $data[$i] ); //$dataset[$i]->addPoint( 'Two', $data[$i]*2 ); } $plot = $plotarea->addNew('bar', array($dataset,'stacked')); $plotarea->addNew('line_grid', array(), IMAGE_GRAPH_AXIS_Y); $fillArray = @Image_Graph::factory('Image_Graph_Fill_Array'); $fillArray->addColor( "blue@0.5" ); $fillArray->addColor( "green@0.5" ); $fillArray->addColor( "red@0.5" ); $fillArray->addColor( "black@0.5" ); $plot->setFillStyle($fillArray); $xAxis = $plotarea->getAxis( IMAGE_GRAPH_AXIS_Y ); $xAxis->forceMaximum( 9 ); $graph->done(); ?> Expected result: ---------------- I'd expect the "One" dataset to be plotted. Actual result: -------------- Nothing is plotted.

Comments