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

Bug #16216 forceMaximum on stacked bar graph "wraps" values
Submitted: 2009-05-11 15:40 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:40 UTC] mortoray (edA-qa mort-ora-y)
Description: ------------ On a stacked bar graph if you use forceMaximum and set a value "lower" than the total of one of the stacked graphs that last item seems to fill back to zero instead of that maximum. 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 would expect the black bar on the top graph to extend to the right side. Actual result: -------------- Instead it goes to the left side -- the opacity has been set low so you can easily see the overlap of the colors.

Comments