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

Bug #12763 No image map areas when only one datapoint present
Submitted: 2007-12-22 16:50 UTC
From: scififan Assigned:
Status: Open Package: Image_Graph (version 0.7.2)
PHP Version: 5.2.4 OS: Gentoo Linux
Roadmaps: (Not assigned)    
Subscription  


 [2007-12-22 16:50 UTC] scififan (Scifi Fan)
Description: ------------ I created a line graph and enabled client side image maps. If I only assign one single data point to this line, no image map is created for this datapoint. It seems like this is due to Image/Graph/Plot/Line.php Line 154 checks for "$numpoints > 1" and resets the line graph otherwise, which might be correct but omits rendering of the vertices if only one datapoint is in that line graph. Test script: --------------- <?php $limit = 1; require_once 'Image/Graph.php'; $Canvas =& Image_Canvas::factory('png', array('width' => 800, 'height' => 400, 'usemap' => true)); $Graph =& Image_Graph::factory('graph', $Canvas); $Graph->add($Plotarea = Image_Graph::factory('plotarea', array('Image_Graph_Axis', 'Image_Graph_Axis_Category'))); $Dataset =& Image_Graph::factory('dataset'); $Marker =& Image_Graph::factory('Image_Graph_Marker_Diamond'); for($i=1;$i<=$limit;++$i){ $Dataset->addPoint(20*$i,$i,array('url' => '#')); } $Plot = $Plotarea->addNew('line', array(&$Dataset)); $Plot->setMarker($Marker); $output = $Graph->done(array('tohtml' => true,'filename' => 'imagemap.png','filepath' => 'tmp/','urlpath' => 'tmp/')); echo htmlentities($output)."<br/>".$output; ?> Expected result: ---------------- When setting $limit to any integer value greater than 0, $limit <map>-Tags should be created. Actual result: -------------- When setting $limit to 1, no <map>-Tag is created, setting it to anything greater than 1, <map>-Tags are created accordingly.

Comments