cvs: pear /Image_Graph/Graph/Axis Category.php

From: Date: Sun, 02 Oct 2005 19:25:21 +0000
Subject: cvs: pear /Image_Graph/Graph/Axis Category.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-35229@lists.php.net to get a copy of this message
nosey Sun Oct 2 15:25:21 2005 EDT Modified files: /pear/Image_Graph/Graph/Axis Category.php Log: Fixed Bug #5415 "Axis's wrong when plot is Dot/Scatter" http://cvs.php.net/diff.php/pear/Image_Graph/Graph/Axis/Category.php?r1=1.15&r2=1.16&ty=u Index: pear/Image_Graph/Graph/Axis/Category.php diff -u pear/Image_Graph/Graph/Axis/Category.php:1.15 pear/Image_Graph/Graph/Axis/Category.php:1.16 --- pear/Image_Graph/Graph/Axis/Category.php:1.15 Thu Sep 29 14:37:22 2005 +++ pear/Image_Graph/Graph/Axis/Category.php Sun Oct 2 15:25:19 2005 @@ -24,7 +24,7 @@ * @author Jesper Veggerby <pear.nosey@veggerby.dk> * @copyright Copyright (C) 2003, 2004 Jesper Veggerby Hansen * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version CVS: $Id: Category.php,v 1.15 2005/09/29 18:37:22 nosey Exp $ + * @version CVS: $Id: Category.php,v 1.16 2005/10/02 19:25:19 nosey Exp $ * @link http://pear.php.net/package/Image_Graph */ @@ -271,6 +271,8 @@ $allLabels = array(); $dataset->_reset(); + $count = 0; + $count_new = 0; while ($point = $dataset->_next()) { if ($this->_type == IMAGE_GRAPH_AXIS_X) { $data = $point['X']; @@ -278,15 +280,15 @@ $data = $point['Y']; } if (!isset($this->_labels[$data])) { - $newLabels[$data] = count($newLabels); + $newLabels[$data] = $count_new++; //$this->_labels[] = $data; } - $allLabels[$data] = count($allLabels); + $allLabels[$data] = $count++; } if (count($this->_labels) == 0) { - $this->_labels = $newLabels; - } elseif (is_array($newLabels)) { + $this->_labels = $newLabels; + } elseif ((is_array($newLabels)) && (count($newLabels) > 0)) { // get all intersecting labels $intersect = array_intersect(array_keys($allLabels), array_keys($this->_labels)); // traverse all new and find their relative position withing the @@ -328,6 +330,13 @@ } unset($keys); } + + $labels = array_keys($this->_labels); + $i = 0; + foreach ($labels as $label) { + $this->_labels[$label] = $i++; + } + // $this->_labels = array_values(array_unique($this->_labels)); $this->_calcLabelInterval(); }

« previous php.pear.cvs (#35229) next »