cvs: pear /Image_Graph/Graph Axis.php
| From: | Jesper Veggerby Hansen | Date: | Wed, 19 Jan 2005 09:30:48 +0000 |
| Subject: | cvs: pear /Image_Graph/Graph Axis.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-28683@lists.php.net to get a copy of this message | ||
nosey Wed Jan 19 04:30:48 2005 EDT
Modified files:
/pear/Image_Graph/Graph Axis.php
Log:
Fixed minor problems with axis inversion
http://cvs.php.net/diff.php/pear/Image_Graph/Graph/Axis.php?r1=1.11&r2=1.12&ty=u
Index: pear/Image_Graph/Graph/Axis.php
diff -u pear/Image_Graph/Graph/Axis.php:1.11 pear/Image_Graph/Graph/Axis.php:1.12
--- pear/Image_Graph/Graph/Axis.php:1.11 Tue Jan 18 03:47:42 2005
+++ pear/Image_Graph/Graph/Axis.php Wed Jan 19 04:30:45 2005
@@ -31,7 +31,7 @@
* @copyright Copyright (C) 2003, 2004 Jesper Veggerby Hansen
* @license http://www.gnu.org/licenses/lgpl.txt
GNU Lesser General Public License
* @author Jesper Veggerby <pear.nosey@veggerby.dk>
- * @version $Id: Axis.php,v 1.11 2005/01/18 08:47:42 nosey Exp $
+ * @version $Id: Axis.php,v 1.12 2005/01/19 09:30:45 nosey Exp $
*/
/**
@@ -423,6 +423,10 @@
*
* This is used as an alternative (maybe better) method, that using layout's
* for axis-title generation.
+ *
+ * To use the current propagated font, but just set it vertically, simply
+ * pass 'vertical' as second parameter for vertical alignment down-to-up or
+ * 'vertical2' for up-to-down alignment.
*
* @param string $title The title of this axis
* @param Image_Graph_Font $font The font used for the title
@@ -431,7 +435,13 @@
function setTitle($title, $font = false)
{
$this->_title = $title;
- $this->_titleFont =& $font;
+ if ($font === 'vertical') {
+ $this->_titleFont = array('vertical' => true, 'angle' =>
90);
+ } elseif ($font === 'vertical2') {
+ $this->_titleFont = array('vertical' => true, 'angle' =>
270);
+ } else {
+ $this->_titleFont =& $font;
+ }
}
/**
@@ -544,15 +554,31 @@
if (($value === 'min') || ($value < $this->_getMinimum())) {
if ($this->_type == IMAGE_GRAPH_AXIS_X) {
- return $this->_left;
+ if ($this->_invert) {
+ return $this->_right;
+ } else {
+ return $this->_left;
+ }
} else {
- return $this->_bottom;
+ if ($this->_invert) {
+ return $this->_top;
+ } else {
+ return $this->_bottom;
+ }
}
} elseif (($value === 'max') || ($value > $this->_getMaximum())) {
if ($this->_type == IMAGE_GRAPH_AXIS_X) {
- return $this->_right;
+ if ($this->_invert) {
+ return $this->_left;
+ } else {
+ return $this->_right;
+ }
} else {
- return $this->_top;
+ if ($this->_invert) {
+ return $this->_bottom;
+ } else {
+ return $this->_top;
+ }
}
}