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

Bug #4113 Image_Graph_Driver_GD::pieSlice() warnings
Submitted: 2005-04-11 04:40 UTC
From: aharvey at optimiser dot com Assigned: nosey
Status: Closed Package: Image_Graph
PHP Version: 5.0.3 OS: Any
Roadmaps: (Not assigned)    
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:
Solve the problem : 11 + 41 = ?

 [2005-04-11 04:40 UTC] aharvey at optimiser dot com
Description: ------------ Not enough points are generated within the $polygon array in Image_Graph_Driver_GD::pieSlice() when a pie slice has 0 width. A patch addressing this against 0.3.0 is available at Reproduce code: --------------- <?php include_once 'Image/Graph.php'; error_reporting(E_ALL); $graph = Image_Graph::factory('graph', array(640, 480)); $plotarea = $graph->addNew('plotarea'); $plotarea->hideAxis(); $dataset = Image_Graph::factory('Image_Graph_Dataset_Trivial'); $dataset->addPoint(1, 1); $dataset->addPoint(2, 2); $dataset->addPoint(3, 0); $plot = $plotarea->addNew('Image_Graph_Plot_Pie', $dataset); $plot->setLineColor('black'); $fillstyle = Image_Graph::factory('Image_Graph_Fill_Array'); $fillstyle->addColor('red'); $fillstyle->addColor('green'); $fillstyle->addColor('blue'); $plot->setFillStyle($fillstyle); $graph->done(); ?> Expected result: ---------------- A graph should appear with two visible slices, as the third slice has zero width. Actual result: -------------- The graph is generated, but the following warnings appear before the graph data: Warning: imagefilledpolygon() [function.imagefilledpolygon]: You must have at least 3 points in your array in /usr/share/pear/Image/Graph/Driver/GD.php on line 964 Warning: imagepolygon() [function.imagepolygon]: You must have at least 3 points in your array in /usr/share/pear/Image/Graph/Driver/GD.php on line 968 This is caused by the $polygon array having only four elements instead of the required six.


 [2005-04-17 06:44 UTC] pear dot nosey at veggerby dot dk
Thanks for your input and your patch. I will apply it at the first given opportunity. /Jesper
 [2005-05-17 21:15 UTC] pear dot nosey at veggerby dot dk
This bug has been fixed in CVS. In case this was a documentation problem, the fix will show up at the end of next Sunday (CET) on In case this was a website problem, the change will show up on the website in short time. Thank you for the report, and for helping us make PEAR better.