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

Request #5971 Image_Graph_Axis_Category does not undersand levels
Submitted: 2005-11-15 16:26 UTC
From: chebatron at gmail dot com Assigned: nosey
Status: Assigned Package: Image_Graph
PHP Version: 5.0.3 OS: Slackware 10.1
Roadmaps: (Not assigned)    
Subscription  
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes. If this is not your bug, you can add a comment by following this link. If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
2005-11-16 18:45 UTC
Package:
Bug Type:
Summary:
From: chebatron at gmail dot com
New email:
PHP Version: Package Version: OS:

 

 [2005-11-15 16:26 UTC] chebatron at gmail dot com
Description: ------------ Category Axis does not understend levels. All operations such as setLabelInterval and others are perfomed on the first (1) level. Test script: --------------- == Test script == <?php require_once 'Image/Graph.php'; $Graph =& Image_Graph::factory('graph', array(800, 300)); $Plotarea =& $Graph->addNew('plotarea'); $Dataset =& Image_Graph::factory('dataset'); // adding some data with time labels $Dataset->addPoint('10:00', 1); $Dataset->addPoint('10:30', 1); $Dataset->addPoint('11:00', 1); $Dataset->addPoint('11:30', 1); $Dataset->addPoint('12:00', 1); $Dataset->addPoint('12:30', 1); $Dataset->addPoint('13:00', 1); $Dataset->addPoint('13:30', 1); $Dataset->addPoint('14:00', 1); $Plot =& $Plotarea->addNew('line', array(&$Dataset)); $AxisX =& $Plotarea->addNew('Image_Graph_Axis_Category', IMAGE_GRAPH_AXIS_X); // showing labels and ticks for everyt second point (every hour) $AxisX->setLabelInterval(2, 1); // showing ticks without labels for every point (half an hour ticks) $AxisX->setLabelInterval(1, 2); $AxisX->setLabelOption('showtext', false, 2); $Graph->done(); ?> == Fix (not fully tested but works for me) == --- Category.php-fixed 2005-11-15 17:38:59.000000000 +0200 +++ Category.php-original 2005-11-15 17:17:31.000000000 +0200 @@ -154,9 +154,9 @@ function setLabelInterval($labelInterval = 'auto', $level = 1) { if ($labelInterval == 'auto') { - parent::setLabelInterval(1, $level); + parent::setLabelInterval(1); } else { - parent::setLabelInterval(round($labelInterval), $level); + parent::setLabelInterval(round($labelInterval)); } } @@ -369,8 +369,8 @@ reset($this->_labels); } $result = false; - $count = ($currentLabel === false ? $this->_labelInterval($level) - 1 : 0); - while ($count < $this->_labelInterval($level)) { + $count = ($currentLabel === false ? $this->_labelInterval() - 1 : 0); + while ($count < $this->_labelInterval()) { $result = (list($label) = each($this->_labels)); $count++; } @@ -410,11 +410,9 @@ $this->_drawAxisLines(); $this->_canvas->startGroup(get_class($this) . '_ticks'); - foreach ($this->_labelOptions as $level => $labelOption) { - $label = false; - while (($label = $this->_getNextLabel($label, $level)) !== false) { - $this->_drawTick($label, $level); - } + $label = false; + while (($label = $this->_getNextLabel($label)) !== false) { + $this->_drawTick($label); } $this->_canvas->endGroup(); @@ -425,4 +423,4 @@ } -?> +?> \ No newline at end of file Expected result: ---------------- I expect to see labels for full hours but not for every tick. Actual result: -------------- Instead I see labels for every tick.

Comments

 [2005-11-16 18:45 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!