cvs: pear /Image_Graph/Graph Axis.php /Image_Graph/Graph/Driver PDFlib.php /Image_Graph/docs ChangeLog
| From: | Jesper Veggerby Hansen | Date: | Tue, 18 Jan 2005 08:47:42 +0000 |
| Subject: | cvs: pear /Image_Graph/Graph Axis.php /Image_Graph/Graph/Driver PDFlib.php /Image_Graph/docs ChangeLog | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-28658@lists.php.net to get a copy of this message | ||
nosey Tue Jan 18 03:47:42 2005 EDT
Modified files:
/pear/Image_Graph/Graph/Driver PDFlib.php
/pear/Image_Graph/docs ChangeLog
/pear/Image_Graph/Graph Axis.php
Log:
PDFLib.php: Fixed overlayImage() to display images correctly
Axis.php: Added possibility for inversion & fixed minor bug with intersection and
forceMinimum()
http://cvs.php.net/diff.php/pear/Image_Graph/Graph/Driver/PDFlib.php?r1=1.4&r2=1.5&ty=u
Index: pear/Image_Graph/Graph/Driver/PDFlib.php
diff -u pear/Image_Graph/Graph/Driver/PDFlib.php:1.4 pear/Image_Graph/Graph/Driver/PDFlib.php:1.5
--- pear/Image_Graph/Graph/Driver/PDFlib.php:1.4 Thu Jan 13 07:45:51 2005
+++ pear/Image_Graph/Graph/Driver/PDFlib.php Tue Jan 18 03:47:42 2005
@@ -33,7 +33,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: PDFlib.php,v 1.4 2005/01/13 12:45:51 nosey Exp $
+ * @version $Id: PDFlib.php,v 1.5 2005/01/18 08:47:42 nosey Exp $
* @since 0.3.0dev2
*/
@@ -884,17 +884,17 @@
$x -= $outputWidth / 2;
}
- if ($alignment & IMAGE_GRAPH_ALIGN_TOP) {
+ if (($alignment & IMAGE_GRAPH_ALIGN_TOP) || ($alignment === false)) {
$y += $outputHeight;
} elseif ($alignment & IMAGE_GRAPH_ALIGN_CENTER_Y) {
- $y -= $outputHeight / 2;
+ $y += $outputHeight / 2;
}
if (($width === false) && ($height === false)) {
$scale = 1;
} else {
$scale = max(($height/$height_), ($width/$width_));
- }
+ }
pdf_place_image($this->_pdf, $image, $this->_getX($x), $this->_getY($y), $scale);
pdf_close_image($this->_pdf, $image);
http://cvs.php.net/diff.php/pear/Image_Graph/docs/ChangeLog?r1=1.7&r2=1.8&ty=u
Index: pear/Image_Graph/docs/ChangeLog
diff -u pear/Image_Graph/docs/ChangeLog:1.7 pear/Image_Graph/docs/ChangeLog:1.8
--- pear/Image_Graph/docs/ChangeLog:1.7 Thu Jan 13 08:08:43 2005
+++ pear/Image_Graph/docs/ChangeLog Tue Jan 18 03:47:42 2005
@@ -1,6 +1,11 @@
*************************
Image_Graph - Changelog
*************************
+Version 0.3.0-dev3 [2005-xxx-xx] - Jesper Veggerby <pear.nosey@veggerby.dk>
+ * Added possibility to invert axis direction, fx. minimum at top or bottom
+ * Fixed axis so that forceMinimum() works with axis intersection
+ * Fixed PDF (PDFlib) driver to display images correctly
+
Version 0.3.0-dev2 [2005-Jan-13] - Jesper Veggerby <pear.nosey@veggerby.dk>
* Added functionality for multi-level labels (ticks, text, etc.) to support for minor and major
labels (and more if needed)
* Added fontmapping in GD drivers useful for mapping mnemonic fontnames, i.e. Times New Roman
to font file names (either partial or full)
http://cvs.php.net/diff.php/pear/Image_Graph/Graph/Axis.php?r1=1.10&r2=1.11&ty=u
Index: pear/Image_Graph/Graph/Axis.php
diff -u pear/Image_Graph/Graph/Axis.php:1.10 pear/Image_Graph/Graph/Axis.php:1.11
--- pear/Image_Graph/Graph/Axis.php:1.10 Mon Jan 10 13:17:14 2005
+++ pear/Image_Graph/Graph/Axis.php Tue Jan 18 03:47:42 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.10 2005/01/10 18:17:14 nosey Exp $
+ * @version $Id: Axis.php,v 1.11 2005/01/18 08:47:42 nosey Exp $
*/
/**
@@ -188,6 +188,15 @@
* @access private
*/
var $_titleFont = false;
+
+ /**
+ * Invert the axis (i.e. if an y-axis normally displays minimum values at
+ * the bottom, they are not displayed at the top
+ * @var bool
+ * @access private
+ * @since 0.3.0dev3
+ */
+ var $_invert = false;
/**
* Image_Graph_Axis [Constructor].
@@ -330,7 +339,7 @@
* @param bool $userEnforce This value should not be set, used internally
*/
function forceMinimum($minimum, $userEnforce = true)
- {
+ {
if (($userEnforce) || (!$this->_minimumSet)) {
$this->_minimum = $minimum;
$this->_minimumSet = $userEnforce;
@@ -505,9 +514,17 @@
function _point($value)
{
if ($this->_type == IMAGE_GRAPH_AXIS_X) {
- return $this->_left + $this->_delta() * $this->_value($value);
+ if ($this->_invert) {
+ return $this->_right - $this->_delta() * $this->_value($value);
+ } else {
+ return $this->_left + $this->_delta() * $this->_value($value);
+ }
} else {
- return $this->_bottom - $this->_delta() * $this->_value($value);
+ if ($this->_invert) {
+ return $this->_top + $this->_delta() * $this->_value($value);
+ } else {
+ return $this->_bottom - $this->_delta() * $this->_value($value);
+ }
}
}
@@ -525,26 +542,20 @@
function _intersectPoint($value)
{
- if ($value === 'min') {
+ if (($value === 'min') || ($value < $this->_getMinimum())) {
if ($this->_type == IMAGE_GRAPH_AXIS_X) {
return $this->_left;
} else {
return $this->_bottom;
}
- //$value = $this->_getMinimum();
- } elseif ($value === 'max') {
+ } elseif (($value === 'max') || ($value > $this->_getMaximum())) {
if ($this->_type == IMAGE_GRAPH_AXIS_X) {
return $this->_right;
} else {
return $this->_top;
}
- //$value = $this->_getMaximum();
- } elseif ($value < $this->_getMinimum()) {
- $this->_setMinimum($value);
- } elseif ($value > $this->_getMaximum()) {
- $this->_setMaximum($value);
- }
-
+ }
+
return $this->_point($value);
}
@@ -810,6 +821,20 @@
'end' => $end
);
}
+
+ /**
+ * Invert the axis direction
+ *
+ * If the minimum values are normally displayed fx. at the bottom setting
+ * axis inversion to true, will cause the minimum values to be displayed at
+ * the top and maximum at the bottom.
+ *
+ * @param bool $invert True if the axis is to be inverted, false if not
+ * @since 0.3.0dev3
+ */
+ function setInverted($invert) {
+ $this->_invert = $invert;
+ }
/**
* Set axis intersection.