cvs: pear /Image_Graph package.xml /Image_Graph/Graph Axis.php Common.php Element.php Layout.php Legend.php Plotarea.php /Image_Graph/Graph/Layout
Horizontal.php /Image_Graph/Graph/Marker Value.php /Image_Graph/Graph/Plotarea Map.php Radar.php /Image_Graph/docs ChangeLog TODO
/Image_Graph/docs/examples clipping.php driver_pdf.php frontpage_sample.php log_axis_forcemin.php log_axis_low.php
| From: | Jesper Veggerby Hansen | Date: | Tue, 28 Feb 2006 22:48:07 +0000 |
| Subject: | cvs: pear /Image_Graph package.xml /Image_Graph/Graph Axis.php Common.php Element.php Layout.php Legend.php Plotarea.php /Image_Graph/Graph/Layout Horizontal.php /Image_Graph/Graph/Marker Value.php /Image_Graph/Graph/Plotarea Map.php Radar.php /Image_Graph/docs ChangeLog TODO /Image_Graph/docs/examples clipping.php driver_pdf.php frontpage_sample.php log_axis_forcemin.php log_axis_low.php |
||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-38756@lists.php.net to get a copy of this message | ||
nosey Tue Feb 28 22:48:07 2006 UTC
Added files:
/pear/Image_Graph/docs/examples log_axis_forcemin.php
log_axis_low.php
Modified files:
/pear/Image_Graph/Graph Element.php Legend.php Plotarea.php
Axis.php Common.php Layout.php
/pear/Image_Graph/docs ChangeLog TODO
/pear/Image_Graph/docs/examples clipping.php driver_pdf.php
frontpage_sample.php
/pear/Image_Graph/Graph/Plotarea Radar.php Map.php
/pear/Image_Graph/Graph/Marker Value.php
/pear/Image_Graph package.xml
/pear/Image_Graph/Graph/Layout Horizontal.php
Log:
Added possibility to specify padding on all edges of an element separately
http://cvs.php.net/viewcvs.cgi/pear/Image_Graph/Graph/Element.php?r1=1.17&r2=1.18&diff_format=u Index: pear/Image_Graph/Graph/Element.php diff -u pear/Image_Graph/Graph/Element.php:1.17 pear/Image_Graph/Graph/Element.php:1.18 --- pear/Image_Graph/Graph/Element.php:1.17 Sun Nov 27 22:21:17 2005 +++ pear/Image_Graph/Graph/Element.php Tue Feb 28 22:48:07 2006 @@ -23,7 +23,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: Element.php,v 1.17 2005/11/27 22:21:17 nosey Exp $ + * @version CVS: $Id: Element.php,v 1.18 2006/02/28 22:48:07 nosey Exp $ * @link http://pear.php.net/package/Image_Graph */ @@ -146,7 +146,7 @@ * @var int * @access private */ - var $_padding = 0; + var $_padding = array('left' => 0, 'top' => 0, 'right' => 0, 'bottom' => 0); /** * Sets the background fill style of the element @@ -562,11 +562,26 @@ /** * Sets padding of the element * - * @param int $padding Number of pixels the element should be padded with + * @param mixed $padding Number of pixels the element should be padded with + * or an array of paddings (left, top, right and bottom as index) */ function setPadding($padding) { - $this->_padding = $padding; + if (is_array($padding)) { + $this->_padding = array(); + $this->_padding['left'] = (isset($padding['left']) ? $padding['left'] : 0); + $this->_padding['top'] = (isset($padding['top']) ? $padding['top'] : 0); + $this->_padding['right'] = (isset($padding['right']) ? $padding['right'] : 0); + $this->_padding['bottom'] = (isset($padding['bottom']) ? $padding['bottom'] : 0); + } + else { + $this->_padding = array( + 'left' => $padding, + 'top' => $padding, + 'right' => $padding, + 'bottom' => $padding + ); + } } /** @@ -597,7 +612,7 @@ */ function _fillLeft() { - return $this->_left + $this->_padding; + return $this->_left + $this->_padding['left']; } /** @@ -608,7 +623,7 @@ */ function _fillTop() { - return $this->_top + $this->_padding; + return $this->_top + $this->_padding['top']; } /** @@ -619,7 +634,7 @@ */ function _fillRight() { - return $this->_right - $this->_padding; + return $this->_right - $this->_padding['right']; } /** @@ -630,7 +645,7 @@ */ function _fillBottom() { - return $this->_bottom - $this->_padding; + return $this->_bottom - $this->_padding['bottom']; } /** http://cvs.php.net/viewcvs.cgi/pear/Image_Graph/Graph/Legend.php?r1=1.15&r2=1.16&diff_format=u Index: pear/Image_Graph/Graph/Legend.php diff -u pear/Image_Graph/Graph/Legend.php:1.15 pear/Image_Graph/Graph/Legend.php:1.16 --- pear/Image_Graph/Graph/Legend.php:1.15 Fri Sep 30 18:59:18 2005 +++ pear/Image_Graph/Graph/Legend.php Tue Feb 28 22:48:07 2006 @@ -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: Legend.php,v 1.15 2005/09/30 18:59:18 nosey Exp $ + * @version CVS: $Id: Legend.php,v 1.16 2006/02/28 22:48:07 nosey Exp $ * @link http://pear.php.net/package/Image_Graph */ @@ -81,7 +81,7 @@ function Image_Graph_Legend() { parent::Image_Graph_Layout(); - $this->_padding = 5; + $this->_padding = array('left' => 5, 'top' => 5, 'right' => 5, 'bottom' => 5); } /** @@ -120,13 +120,13 @@ */ function _parameterArray($simulate = false) { - $param['left'] = $this->_left + $this->_padding; - $param['top'] = $this->_top + $this->_padding; - $param['right'] = $this->_right - $this->_padding; - $param['bottom'] = $this->_bottom - $this->_padding; + $param['left'] = $this->_left + $this->_padding['left']; + $param['top'] = $this->_top + $this->_padding['top']; + $param['right'] = $this->_right - $this->_padding['right']; + $param['bottom'] = $this->_bottom - $this->_padding['bottom']; $param['align'] = $this->_alignment; - $param['x'] = $this->_left + $this->_padding; - $param['y'] = $this->_top + $this->_padding; + $param['x'] = $this->_left + $this->_padding['left']; + $param['y'] = $this->_top + $this->_padding['top']; $param['width'] = 16; $param['height'] = 16; $param['show_marker'] = $this->_showMarker; @@ -166,7 +166,7 @@ unset($keys2); } unset($keys); - return abs($param['y'] - $param0['y']) + 2*$this->_padding; + return abs($param['y'] - $param0['y']) + $this->_padding['top'] + $this->_padding['bottom']; } else { return parent::height(); } @@ -234,15 +234,15 @@ } if (($this->_alignment & IMAGE_GRAPH_ALIGN_BOTTOM) != 0) { - $y = $this->_parent->_fillBottom() - $h - $this->_padding; + $y = $this->_parent->_fillBottom() - $h - $this->_padding['bottom']; } else { - $y = $this->_parent->_fillTop() + $this->_padding; + $y = $this->_parent->_fillTop() + $this->_padding['top']; } if (($this->_alignment & IMAGE_GRAPH_ALIGN_LEFT) != 0) { - $x = $this->_parent->_fillLeft() + $this->_padding; + $x = $this->_parent->_fillLeft() + $this->_padding['left']; } else { - $x = $this->_parent->_fillRight() - $w - $this->_padding; + $x = $this->_parent->_fillRight() - $w - $this->_padding['right']; } $this->_setCoords($x, $y, $x + $w, $y + $h); http://cvs.php.net/viewcvs.cgi/pear/Image_Graph/Graph/Plotarea.php?r1=1.22&r2=1.23&diff_format=u Index: pear/Image_Graph/Graph/Plotarea.php diff -u pear/Image_Graph/Graph/Plotarea.php:1.22 pear/Image_Graph/Graph/Plotarea.php:1.23 --- pear/Image_Graph/Graph/Plotarea.php:1.22 Wed Nov 16 20:44:48 2005 +++ pear/Image_Graph/Graph/Plotarea.php Tue Feb 28 22:48:07 2006 @@ -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: Plotarea.php,v 1.22 2005/11/16 20:44:48 nosey Exp $ + * @version CVS: $Id: Plotarea.php,v 1.23 2006/02/28 22:48:07 nosey Exp $ * @link http://pear.php.net/package/Image_Graph */ @@ -133,7 +133,7 @@ { parent::Image_Graph_Layout(); - $this->_padding = 5; + $this->_padding = array('left' => 5, 'top' => 5, 'right' => 5, 'bottom' => 5);; include_once 'Image/Graph.php'; @@ -645,10 +645,10 @@ $pctWidth = (int) ($this->width() * 0.05); $pctHeight = (int) ($this->height() * 0.05); - $left = $this->_left + $this->_padding; - $top = $this->_top + $this->_padding; - $right = $this->_right - $this->_padding; - $bottom = $this->_bottom - $this->_padding; + $left = $this->_left + $this->_padding['left']; + $top = $this->_top + $this->_padding['top']; + $right = $this->_right - $this->_padding['right']; + $bottom = $this->_bottom - $this->_padding['bottom']; // temporary place holder for axis point calculations $axisPoints['x'] = array($left, $top, $right, $bottom); http://cvs.php.net/viewcvs.cgi/pear/Image_Graph/Graph/Axis.php?r1=1.34&r2=1.35&diff_format=u Index: pear/Image_Graph/Graph/Axis.php diff -u pear/Image_Graph/Graph/Axis.php:1.34 pear/Image_Graph/Graph/Axis.php:1.35 --- pear/Image_Graph/Graph/Axis.php:1.34 Wed Nov 16 20:44:48 2005 +++ pear/Image_Graph/Graph/Axis.php Tue Feb 28 22:48:07 2006 @@ -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: Axis.php,v 1.34 2005/11/16 20:44:48 nosey Exp $ + * @version CVS: $Id: Axis.php,v 1.35 2006/02/28 22:48:07 nosey Exp $ * @link http://pear.php.net/package/Image_Graph */ @@ -1172,9 +1172,9 @@ } else { $this->write( $labelPosition, - $this->_top + 3 + $offset, + $this->_top + 6 + $offset + $font['size'] * (substr_count($labelText, "\n") + 1), $labelText, - IMAGE_GRAPH_ALIGN_TOP | IMAGE_GRAPH_ALIGN_CENTER_X, + IMAGE_GRAPH_ALIGN_BOTTOM | IMAGE_GRAPH_ALIGN_CENTER_X, $font ); } @@ -1203,9 +1203,9 @@ if ($labelInside) { $this->write( $labelPosition, - $this->_bottom + 3 + $offset, + $this->_bottom + 6 + $offset + $font['size'] * (substr_count($labelText, "\n") + 1), $labelText, - IMAGE_GRAPH_ALIGN_TOP | IMAGE_GRAPH_ALIGN_CENTER_X, + IMAGE_GRAPH_ALIGN_BOTTOM | IMAGE_GRAPH_ALIGN_CENTER_X, $font ); } else { @@ -1266,12 +1266,12 @@ IMAGE_GRAPH_ALIGN_CENTER_X | IMAGE_GRAPH_ALIGN_BOTTOM, $font ); - } else { + } else { $this->write( $labelPosition, - $this->_top + 3 + $offset, + $this->_top + 6 + $offset + $font['size'] * (substr_count($labelText, "\n") + 1), $labelText, - IMAGE_GRAPH_ALIGN_CENTER_X | IMAGE_GRAPH_ALIGN_TOP, + IMAGE_GRAPH_ALIGN_CENTER_X | IMAGE_GRAPH_ALIGN_BOTTOM, $font ); } http://cvs.php.net/viewcvs.cgi/pear/Image_Graph/Graph/Common.php?r1=1.15&r2=1.16&diff_format=u Index: pear/Image_Graph/Graph/Common.php diff -u pear/Image_Graph/Graph/Common.php:1.15 pear/Image_Graph/Graph/Common.php:1.16 --- pear/Image_Graph/Graph/Common.php:1.15 Mon Nov 21 19:20:09 2005 +++ pear/Image_Graph/Graph/Common.php Tue Feb 28 22:48:07 2006 @@ -23,7 +23,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: Common.php,v 1.15 2005/11/21 19:20:09 nosey Exp $ + * @version CVS: $Id: Common.php,v 1.16 2006/02/28 22:48:07 nosey Exp $ * @link http://pear.php.net/package/Image_Graph */ @@ -241,14 +241,16 @@ */ function _error($text, $params = false, $error_code = IMAGE_GRAPH_ERROR_GENERIC) { - foreach ($params as $name => $key) { - if (isset($parameters)) { - $parameters .= ' '; - } - else { - $parameters = ''; + if ((is_array($params)) && (count($params) > 0)) { + foreach ($params as $name => $key) { + if (isset($parameters)) { + $parameters .= ' '; + } + else { + $parameters = ''; + } + $parameters .= $name . '=' . $key; } - $parameters .= $name . '=' . $key; } $error =& PEAR::raiseError( $text . http://cvs.php.net/viewcvs.cgi/pear/Image_Graph/Graph/Layout.php?r1=1.11&r2=1.12&diff_format=u Index: pear/Image_Graph/Graph/Layout.php diff -u pear/Image_Graph/Graph/Layout.php:1.11 pear/Image_Graph/Graph/Layout.php:1.12 --- pear/Image_Graph/Graph/Layout.php:1.11 Wed Sep 14 20:27:25 2005 +++ pear/Image_Graph/Graph/Layout.php Tue Feb 28 22:48:07 2006 @@ -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: Layout.php,v 1.11 2005/09/14 20:27:25 nosey Exp $ + * @version CVS: $Id: Layout.php,v 1.12 2006/02/28 22:48:07 nosey Exp $ * @link http://pear.php.net/package/Image_Graph */ @@ -71,7 +71,7 @@ function Image_Graph_Layout() { parent::Image_Graph_Element(); - $this->_padding = 2; + $this->_padding = array('left' => 2, 'top' => 2, 'right' => 2, 'bottom' => 2); } /** @@ -146,10 +146,10 @@ ); $this->_setCoords( - $left + $this->_padding, - $top + $this->_padding, - $right - $this->_padding, - $bottom - $this->_padding + $left + $this->_padding['left'], + $top + $this->_padding['top'], + $right - $this->_padding['right'], + $bottom - $this->_padding['bottom'] ); } } http://cvs.php.net/viewcvs.cgi/pear/Image_Graph/docs/ChangeLog?r1=1.44&r2=1.45&diff_format=u Index: pear/Image_Graph/docs/ChangeLog diff -u pear/Image_Graph/docs/ChangeLog:1.44 pear/Image_Graph/docs/ChangeLog:1.45 --- pear/Image_Graph/docs/ChangeLog:1.44 Sun Nov 27 22:21:14 2005 +++ pear/Image_Graph/docs/ChangeLog Tue Feb 28 22:48:07 2006 @@ -1,7 +1,7 @@ ************************* Image_Graph - Changelog ************************* -Version 0.x.x alpha [2005-xxx-xx] - Jesper Veggerby <pear.nosey@veggerby.dk> +Version 0.7.2-alpha [2006-Fec-28] - Jesper Veggerby <pear.nosey@veggerby.dk> * Added Pie chart support for grouping items with values below a specified threshold in a "the rest" group * Added possibility to set color of axis ticks (thanks to bdondo from forum) * Added clipping support, causing forceMinimum() and forceMaximum() to show expected results @@ -10,6 +10,12 @@ * Fixed a bug with Candlestick, Band and Box & Whisker plots not working when using markers * Fixed Bug #6024 "Undefined variable: parameters" * Fixed Bug #6085 "Graph doesn't understand a numeric variable extracted from the GET method." + * Fixed Bug #6919 "Isolated points in linegraphs with breaks drawn incorrectly" + * Fixed Bug #6921 "Marker not drawn for points with Y value == 0" + * Fixed Bug #6941 "Logarithmic axis values between 0 and 1" + * Fixed Request #5985 "Logarithmic Axis Minimum Value" + * Fixed a problem with labels not appearing on the same baseline + * Added possibility to specify padding on all edges of an element separately Version 0.7.1-alpha [2005-Oct-05] - Jesper Veggerby <pear.nosey@veggerby.dk> * Fixed Bug #5415 "Axis's wrong when plot is Dot/Scatter" http://cvs.php.net/viewcvs.cgi/pear/Image_Graph/docs/TODO?r1=1.7&r2=1.8&diff_format=u Index: pear/Image_Graph/docs/TODO diff -u pear/Image_Graph/docs/TODO:1.7 pear/Image_Graph/docs/TODO:1.8 --- pear/Image_Graph/docs/TODO:1.7 Sat Aug 27 17:27:32 2005 +++ pear/Image_Graph/docs/TODO Tue Feb 28 22:48:07 2006 @@ -22,15 +22,11 @@ Image_Graph_Plot_Line *** Consider new legend icon -Image_Graph_Plot_Pie -*** Group items together in one pie ("the rest") if less than a certain value/percentage - Image_Graph_Plot_Smoothed_Radar *** Create legend sample for smoothed radar chart Image_Graph_Axis *** Create a method to align '0' of primary and secondary y-axis -*** Values aren't properly cropped when "above" maximum or "below" minimum (i.e. graph should be cropped to plotarea!) Image_Graph_Axis_Composite *** Implement composite axis (i.e. linear from 0-10, log from 10-1000, and category from 1001, 1004, 10000, ...) http://cvs.php.net/viewcvs.cgi/pear/Image_Graph/docs/examples/clipping.php?r1=1.1&r2=1.2&diff_format=u Index: pear/Image_Graph/docs/examples/clipping.php diff -u pear/Image_Graph/docs/examples/clipping.php:1.1 pear/Image_Graph/docs/examples/clipping.php:1.2 --- pear/Image_Graph/docs/examples/clipping.php:1.1 Sun Nov 27 22:21:17 2005 +++ pear/Image_Graph/docs/examples/clipping.php Tue Feb 28 22:48:07 2006 @@ -8,20 +8,13 @@ * Other: * None specific * - * $Id: clipping.php,v 1.1 2005/11/27 22:21:17 nosey Exp $ + * $Id: clipping.php,v 1.2 2006/02/28 22:48:07 nosey Exp $ * * @package Image_Graph * @author Jesper Veggerby <pear.nosey@veggerby.dk> */ require_once 'Image/Graph.php'; -//require_once 'Image/Canvas.php'; -// -//// create a new GD canvas -//$Canvas =& Image_Canvas::factory('svg', array('width' => 400, 'height' => 300)); -// -//// create the graph -//$Graph =& Image_Graph::factory('graph', $Canvas); $Graph =& Image_Graph::factory('graph', array(600, 400)); @@ -50,52 +43,52 @@ $GridY_Weather->setLineColor('gray@0.1'); $Dataset_TempAvg =& Image_Graph::factory('dataset'); -$Dataset_TempAvg->addPoint('Jan', 0.2); -$Dataset_TempAvg->addPoint('Feb', 0.1); -$Dataset_TempAvg->addPoint('Mar', 2.3); -$Dataset_TempAvg->addPoint('Apr', 5.8); -$Dataset_TempAvg->addPoint('May', 10.8); -$Dataset_TempAvg->addPoint('Jun', 14.1); -$Dataset_TempAvg->addPoint('Jul', 16.2); -$Dataset_TempAvg->addPoint('Aug', 15.9); -$Dataset_TempAvg->addPoint('Sep', 12.1); -$Dataset_TempAvg->addPoint('Oct', 8.7); -$Dataset_TempAvg->addPoint('Nov', 4.4); -$Dataset_TempAvg->addPoint('Dec', 1.8); +$Dataset_TempAvg->addPoint("Jan\n2005", 0.2); +$Dataset_TempAvg->addPoint("Feb\n2005", 0.1); +$Dataset_TempAvg->addPoint("Mar\n2005", 2.3); +$Dataset_TempAvg->addPoint("Apr\n2005", 5.8); +$Dataset_TempAvg->addPoint("May\n2005", 10.8); +$Dataset_TempAvg->addPoint("Jun\n2005", 14.1); +$Dataset_TempAvg->addPoint("Jul\n2005", 16.2); +$Dataset_TempAvg->addPoint("Aug\n2005", 15.9); +$Dataset_TempAvg->addPoint("Sep\n2005", 12.1); +$Dataset_TempAvg->addPoint("Oct\n2005", 8.7); +$Dataset_TempAvg->addPoint("Nov\n2005", 4.4); +$Dataset_TempAvg->addPoint("Dec\n2005", 1.8); $Plot_TempAvg =& $Plotarea_Weather->addNew('smooth_line', array(&$Dataset_TempAvg)); $Plot_TempAvg->setLineColor('blue'); $Plot_TempAvg->setTitle('Average temperature'); $Dataset_TempMin =& Image_Graph::factory('dataset'); -$Dataset_TempMin->addPoint('Jan', -2.7); -$Dataset_TempMin->addPoint('Feb', -2.8); -$Dataset_TempMin->addPoint('Mar', -0.9); -$Dataset_TempMin->addPoint('Apr', 1.2); -$Dataset_TempMin->addPoint('May', 5.5); -$Dataset_TempMin->addPoint('Jun', 9.2); -$Dataset_TempMin->addPoint('Jul', 11.3); -$Dataset_TempMin->addPoint('Aug', 11.1); -$Dataset_TempMin->addPoint('Sep', 7.8); -$Dataset_TempMin->addPoint('Oct', 5.0); -$Dataset_TempMin->addPoint('Nov', 1.5); -$Dataset_TempMin->addPoint('Dec', -0.9); +$Dataset_TempMin->addPoint("Jan\n2005", -2.7); +$Dataset_TempMin->addPoint("Feb\n2005", -2.8); +$Dataset_TempMin->addPoint("Mar\n2005", -0.9); +$Dataset_TempMin->addPoint("Apr\n2005", 1.2); +$Dataset_TempMin->addPoint("May\n2005", 5.5); +$Dataset_TempMin->addPoint("Jun\n2005", 9.2); +$Dataset_TempMin->addPoint("Jul\n2005", 11.3); +$Dataset_TempMin->addPoint("Aug\n2005", 11.1); +$Dataset_TempMin->addPoint("Sep\n2005", 7.8); +$Dataset_TempMin->addPoint("Oct\n2005", 5.0); +$Dataset_TempMin->addPoint("Nov\n2005", 1.5); +$Dataset_TempMin->addPoint("Dec\n2005", -0.9); $Plot_TempMin =& $Plotarea_Weather->addNew('smooth_line', array(&$Dataset_TempMin)); $Plot_TempMin->setLineColor('teal'); $Plot_TempMin->setTitle('Minimum temperature'); $Dataset_TempMax =& Image_Graph::factory('dataset'); -$Dataset_TempMax->addPoint('Jan', 2.4); -$Dataset_TempMax->addPoint('Feb', 2.5); -$Dataset_TempMax->addPoint('Mar', 5.4); -$Dataset_TempMax->addPoint('Apr', 10.5); -$Dataset_TempMax->addPoint('May', 15.8); -$Dataset_TempMax->addPoint('Jun', 18.9); -$Dataset_TempMax->addPoint('Jul', 21.2); -$Dataset_TempMax->addPoint('Aug', 20.8); -$Dataset_TempMax->addPoint('Sep', 16.3); -$Dataset_TempMax->addPoint('Oct', 11.8); -$Dataset_TempMax->addPoint('Nov', 6.9); -$Dataset_TempMax->addPoint('Dec', 4.1); +$Dataset_TempMax->addPoint("Jan\n2005", 2.4); +$Dataset_TempMax->addPoint("Feb\n2005", 2.5); +$Dataset_TempMax->addPoint("Mar\n2005", 5.4); +$Dataset_TempMax->addPoint("Apr\n2005", 10.5); +$Dataset_TempMax->addPoint("May\n2005", 15.8); +$Dataset_TempMax->addPoint("Jun\n2005", 18.9); +$Dataset_TempMax->addPoint("Jul\n2005", 21.2); +$Dataset_TempMax->addPoint("Aug\n2005", 20.8); +$Dataset_TempMax->addPoint("Sep\n2005", 16.3); +$Dataset_TempMax->addPoint("Oct\n2005", 11.8); +$Dataset_TempMax->addPoint("Nov\n2005", 6.9); +$Dataset_TempMax->addPoint("Dec\n2005", 4.1); $Plot_TempMax =& $Plotarea_Weather->addNew('smooth_line', array(&$Dataset_TempMax)); $Plot_TempMax->setLineColor('red'); $Plot_TempMax->setTitle('Maximum temperature'); @@ -122,5 +115,6 @@ $AxisY_Weather->forceMinimum(5); // output the graph +$Graph->setPadding(10); $Graph->done(); ?> \ No newline at end of file http://cvs.php.net/viewcvs.cgi/pear/Image_Graph/docs/examples/driver_pdf.php?r1=1.3&r2=1.4&diff_format=u Index: pear/Image_Graph/docs/examples/driver_pdf.php diff -u pear/Image_Graph/docs/examples/driver_pdf.php:1.3 pear/Image_Graph/docs/examples/driver_pdf.php:1.4 --- pear/Image_Graph/docs/examples/driver_pdf.php:1.3 Wed Aug 3 21:21:53 2005 +++ pear/Image_Graph/docs/examples/driver_pdf.php Tue Feb 28 22:48:07 2006 @@ -8,7 +8,7 @@ * Other: * Datapreprocessor, Axis markers * - * $Id: driver_pdf.php,v 1.3 2005/08/03 21:21:53 nosey Exp $ + * $Id: driver_pdf.php,v 1.4 2006/02/28 22:48:07 nosey Exp $ * * @package Image_Graph * @author Jesper Veggerby <pear.nosey@veggerby.dk> @@ -19,179 +19,246 @@ require_once 'Image/Graph.php'; require_once 'Image/Canvas.php'; -$Canvas =& Image_Canvas::factory('pdflib', array('page' => 'A3', 'align' => 'center', 'width' => 600, 'height' => 400)); +$Canvas =& Image_Canvas::factory('cpdf', array('page' => 'A3', 'align' => 'center', 'width' => 600, 'height' => 400)); // create the graph $Graph =& Image_Graph::factory('graph', $Canvas); -// add a TrueType font $Font =& $Graph->addNew('font', 'Verdana'); -// set the font size to 15 pixels -$Font->setSize(15); -// add a title using the created font - -$Dataset_SmoothedLine =& Image_Graph::factory('dataset'); -$Dataset_SmoothedLine->addPoint('DK', 6); -$Dataset_SmoothedLine->addPoint('UK', 8); -$Dataset_SmoothedLine->addPoint('PO', 2); -$Dataset_SmoothedLine->addPoint('NL', 4); +$Font->setSize(7); + +$Graph->setFont($Font); $Graph->add( Image_Graph::vertical( - Image_Graph::factory('title', array('Layout and Legend Sample', &$Font)), - Image_Graph::horizontal( + Image_Graph::factory('title', array('Image_Graph Demonstration', 12)), + Image_Graph::vertical( Image_Graph::vertical( - Image_Graph::horizontal( - Image_Graph::factory('title', array('This is the Y Axis', &$_Image_Graph_verticalFont)), + $Plotarea_Weather = Image_Graph::factory('plotarea'), + $Legend_Weather = Image_Graph::factory('legend'), + 85 + ), + Image_Graph::horizontal( + Image_Graph::vertical( Image_Graph::vertical( - $Plotarea_BarAndLine = Image_Graph::factory('plotarea'), - Image_Graph::factory('title', array('This is the X Axis', &$_Image_Graph_font)), - 95 + Image_Graph::factory( + 'title', + array('Demonstration of Mathematical Functions', 10) + ), + $Plotarea_SinCos = Image_Graph::factory('plotarea', 'axis'), + 5 ), - 5 + $Legend_SinCos = Image_Graph::factory('legend'), + 90 ), - $Legend_BarAndLine = Image_Graph::factory('legend'), - 95 - ), - Image_Graph::vertical( - Image_Graph::horizontal( - $Plotarea_SmoothedLine = Image_Graph::factory('plotarea'), - $Legend_SmoothedLine = Image_Graph::factory('legend'), - 80 - ), - $Plotarea_Radar = Image_Graph::factory('Image_Graph_Plotarea_Radar') - ), - 65 + $Plotarea_Car = Image_Graph::factory('plotarea'), + 50 + ), + 60 ), - 9 - ) + 5) ); +$Legend_Weather->setPlotarea($Plotarea_Weather); +$Legend_Weather->setFontSize(7); -$Legend_BarAndLine->setPlotarea($Plotarea_BarAndLine); -$Legend_SmoothedLine->setPlotarea($Plotarea_SmoothedLine); - -// create a Y grid -$Grid_Radar =& $Plotarea_Radar->addNew('line_grid', IMAGE_GRAPH_AXIS_Y); -$Grid_Radar->setLineColor('lightgrey'); - -// create a Y grid -$Grid_BarAndLine =& $Plotarea_BarAndLine->addNew('bar_grid', IMAGE_GRAPH_AXIS_Y); -// that is light gray in color -$Grid_BarAndLine->setFillStyle(Image_Graph::factory('gradient', array(IMAGE_GRAPH_GRAD_VERTICAL, 'white', 'lightgrey'))); - -// create a Y grid -$Grid_SmoothedLine =& $Plotarea_SmoothedLine->addNew('line_grid', IMAGE_GRAPH_AXIS_Y); -$Grid_SmoothedLine->setLineColor('lightgrey'); - -// create the 1st dataset -//$Dataset_SmoothedLine =& new Image_RandomDataset(4, 2, 15, true); -// create the 1st plot as smoothed area chart using the 1st dataset -$Plot_SmoothedLine =& $Plotarea_SmoothedLine->addNew('Image_Graph_Plot_Smoothed_Line', $Dataset_SmoothedLine); -$Plot_SmoothedLine->setLineColor('orange'); - -// create a 3rd dataset -$Dataset_BarChart =& Image_Graph::factory('random', array(8, 10, 120, false)); -// create the 3rd plot as line chart using the 2nd dataset -$Plot_BarChart =& $Plotarea_BarAndLine->addNew('bar', $Dataset_BarChart); -// set the fill style of the barchart to the almost transparent BlueAlpha -$FillArray =& Image_Graph::factory('Image_Graph_Fill_Array'); -$Plot_BarChart->setFillStyle($FillArray); -$FillArray->addNew('gradient', array(IMAGE_GRAPH_GRAD_VERTICAL, 'white', 'red')); -$FillArray->addNew('gradient', array(IMAGE_GRAPH_GRAD_VERTICAL, 'white', 'blue')); -$FillArray->addNew('gradient', array(IMAGE_GRAPH_GRAD_VERTICAL, 'white', 'yellow')); -$FillArray->addNew('gradient', array(IMAGE_GRAPH_GRAD_VERTICAL, 'white', 'green')); -$FillArray->addNew('gradient', array(IMAGE_GRAPH_GRAD_VERTICAL, 'white', 'purple')); -$FillArray->addNew('gradient', array(IMAGE_GRAPH_GRAD_VERTICAL, 'white', 'orange')); -$FillArray->addNew('gradient', array(IMAGE_GRAPH_GRAD_VERTICAL, 'white', 'black')); -$FillArray->addNew('gradient', array(IMAGE_GRAPH_GRAD_VERTICAL, 'white', 'brown')); - -// create the 2nd dataset -$Dataset_LineMarker =& Image_Graph::factory('random', array(8, 20, 100, false)); -// create the 2nd plot as line chart using the 2nd dataset -$Plot_LineMarker =& $Plotarea_BarAndLine->addNew('line', $Dataset_LineMarker); - -$Marker =& Image_Graph::factory('Image_Graph_Marker_Array'); -$CrossMarker =& Image_Graph::factory('Image_Graph_Marker_Cross'); -$CircleMarker =& Image_Graph::factory('Image_Graph_Marker_Circle'); -$Marker->add($CrossMarker); -$Marker->add($CircleMarker); -$Plot_LineMarker->setMarker($Marker); -// Create a red line -$CrossMarker->setLineColor('red'); -// Create a blue line -$CircleMarker->setLineColor('blue'); - -// Show arrow heads on the axis -$AxisX =& $Plotarea_BarAndLine->getAxis(IMAGE_GRAPH_AXIS_X); -$AxisY =& $Plotarea_BarAndLine->getAxis(IMAGE_GRAPH_AXIS_Y); -$AxisX->showArrow(); -$AxisY->showArrow(); - -// create an data label array for formatting label data based on an array -$ArrayData =& Image_Graph::factory('Image_Graph_DataPreprocessor_Array', - array( - array( - 1=>'A Point', - 2=>'Another', - 6=>'Yet another' - ) - ) +$Legend_SinCos->setPlotarea($Plotarea_SinCos); +$Legend_SinCos->setFontSize(8); + +$GridY_Weather =& $Plotarea_Weather->addNew( + 'line_grid', + null, + IMAGE_GRAPH_AXIS_Y ); +$GridY_Weather->setLineColor('gray@0.1'); -// use the data label array on the X axis -$AxisX->setDataPreprocessor($ArrayData); -$AxisFontX =& $Graph->addNew('Image_Graph_Font_Vertical'); -$AxisX->setFont($AxisFontX); - -$Legend_BarAndLine->setFillColor('white'); -$Legend_SmoothedLine->setFillColor('white'); - -$Font2 =& $Graph->addNew('font', 'Verdana'); -$Font2->setSize(8); -$Legend_BarAndLine->setFont($Font2); -$Legend_SmoothedLine->setFont($Font2); - -$Plot_SmoothedLine->setTitle('Oil'); -$Plot_LineMarker->setTitle('Data Set 1'); -$Plot_BarChart->setTitle('Data Set 2'); - -// create the dataset -$Dataset_Radar1 =& Image_Graph::factory('random', array(8, 1, 5)); -$Dataset_Radar2 =& Image_Graph::factory('random', array(8, 1, 5)); -// create the 1st plot as smoothed area chart using the 1st dataset -$Plot_Radar1 =& $Plotarea_Radar->addNew('Image_Graph_Plot_Radar', $Dataset_Radar1); -$Plot_Radar2 =& $Plotarea_Radar->addNew('Image_Graph_Plot_Radar', $Dataset_Radar2); +$Marker_AverageSpan =& + $Plotarea_Weather->addNew( + 'Image_Graph_Axis_Marker_Area', + IMAGE_GRAPH_AXIS_Y + ); +$Marker_AverageSpan->setFillColor('green@0.2'); +$Marker_AverageSpan->setLowerBound(3.8); +$Marker_AverageSpan->setUpperBound(11.4); + +$Marker_Average =& + $Plotarea_Weather->addNew( + 'Image_Graph_Axis_Marker_Line', + IMAGE_GRAPH_AXIS_Y + ); +$Marker_Average->setLineColor('blue@0.4'); +$Marker_Average->setValue(7.7); + +$Dataset_Rainfall =& Image_Graph::factory('dataset'); +$Dataset_Rainfall->addPoint('Jan', 60); +$Dataset_Rainfall->addPoint('Feb', 41); +$Dataset_Rainfall->addPoint('Mar', 48); +$Dataset_Rainfall->addPoint('Apr', 42); +$Dataset_Rainfall->addPoint('May', 50); +$Dataset_Rainfall->addPoint('Jun', 55); +$Dataset_Rainfall->addPoint('Jul', 67); +$Dataset_Rainfall->addPoint('Aug', 65); +$Dataset_Rainfall->addPoint('Sep', 72); +$Dataset_Rainfall->addPoint('Oct', 77); +$Dataset_Rainfall->addPoint('Nov', 80); +$Dataset_Rainfall->addPoint('Dec', 68); +$Plot_Rainfall =& + $Plotarea_Weather->addNew( + 'bar', + array(&$Dataset_Rainfall), + IMAGE_GRAPH_AXIS_Y_SECONDARY + ); +$Plot_Rainfall->setLineColor('gray'); +$Plot_Rainfall->setFillColor('yellow@0.1'); +$Plot_Rainfall->setTitle('Average rainfall'); + +$Dataset_TempAvg =& Image_Graph::factory('dataset'); +$Dataset_TempAvg->addPoint('Jan', 0.2); +$Dataset_TempAvg->addPoint('Feb', 0.1); +$Dataset_TempAvg->addPoint('Mar', 2.3); +$Dataset_TempAvg->addPoint('Apr', 5.8); +$Dataset_TempAvg->addPoint('May', 10.8); +$Dataset_TempAvg->addPoint('Jun', 14.1); +$Dataset_TempAvg->addPoint('Jul', 16.2); +$Dataset_TempAvg->addPoint('Aug', 15.9); +$Dataset_TempAvg->addPoint('Sep', 12.1); +$Dataset_TempAvg->addPoint('Oct', 8.7); +$Dataset_TempAvg->addPoint('Nov', 4.4); +$Dataset_TempAvg->addPoint('Dec', 1.8); +$Plot_TempAvg =& + $Plotarea_Weather->addNew( + 'Image_Graph_Plot_Smoothed_Line', + array(&$Dataset_TempAvg) + ); +$Plot_TempAvg->setLineColor('blue'); +$Plot_TempAvg->setTitle('Average temperature'); + +$Dataset_TempMin =& Image_Graph::factory('dataset'); +$Dataset_TempMin->addPoint('Jan', -2.7); +$Dataset_TempMin->addPoint('Feb', -2.8); +$Dataset_TempMin->addPoint('Mar', -0.9); +$Dataset_TempMin->addPoint('Apr', 1.2); +$Dataset_TempMin->addPoint('May', 5.5); +$Dataset_TempMin->addPoint('Jun', 9.2); +$Dataset_TempMin->addPoint('Jul', 11.3); +$Dataset_TempMin->addPoint('Aug', 11.1); +$Dataset_TempMin->addPoint('Sep', 7.8); +$Dataset_TempMin->addPoint('Oct', 5.0); +$Dataset_TempMin->addPoint('Nov', 1.5); +$Dataset_TempMin->addPoint('Dec', -0.9); +$Plot_TempMin =& + $Plotarea_Weather->addNew( + 'Image_Graph_Plot_Smoothed_Line', + array(&$Dataset_TempMin) + ); +$Plot_TempMin->setLineColor('teal'); +$Plot_TempMin->setTitle('Minimum temperature'); + +$Dataset_TempMax =& Image_Graph::factory('dataset'); +$Dataset_TempMax->addPoint('Jan', 2.4); +$Dataset_TempMax->addPoint('Feb', 2.5); +$Dataset_TempMax->addPoint('Mar', 5.4); +$Dataset_TempMax->addPoint('Apr', 10.5); +$Dataset_TempMax->addPoint('May', 15.8); +$Dataset_TempMax->addPoint('Jun', 18.9); +$Dataset_TempMax->addPoint('Jul', 21.2); +$Dataset_TempMax->addPoint('Aug', 20.8); +$Dataset_TempMax->addPoint('Sep', 16.3); +$Dataset_TempMax->addPoint('Oct', 11.8); +$Dataset_TempMax->addPoint('Nov', 6.9); +$Dataset_TempMax->addPoint('Dec', 4.1); +$Plot_TempMax =& + $Plotarea_Weather->addNew( + 'Image_Graph_Plot_Smoothed_Line', + array(&$Dataset_TempMax) + ); +$Plot_TempMax->setLineColor('red'); +$Plot_TempMax->setTitle('Maximum temperature'); -//$Dataset_Radar1->setMaximumY(7); - -$DataPreprocessor =& Image_Graph::factory('Image_Graph_DataPreprocessor_Array', - array( - array( - 'Irrelevance', - 'Partly', - 'Regular', - 'Relevance', - 'Something', - 'Everything', - 'Nothing', - 'Irregular' - ) - ) +$DataPreprocessor_MM =& + Image_Graph::factory('Image_Graph_DataPreprocessor_Formatted', '%d mm'); +$DataPreprocessor_DegC =& + Image_Graph::factory('Image_Graph_DataPreprocessor_Formatted', '%d C'); + +$Marker_Rainfall =& + $Plot_Rainfall->addNew('Image_Graph_Marker_Value', IMAGE_GRAPH_VALUE_Y); +$Marker_Rainfall->setDataPreprocessor($DataPreprocessor_MM); +$Marker_Rainfall->setFontSize(7); +$PointingMarker_Rainfall =& + $Plot_Rainfall->addNew( + 'Image_Graph_Marker_Pointing_Angular', + array(20, &$Marker_Rainfall) + ); +$Plot_Rainfall->setMarker($PointingMarker_Rainfall); + +$AxisY_Weather =& $Plotarea_Weather->getAxis(IMAGE_GRAPH_AXIS_Y); +$AxisY_Weather->showLabel(IMAGE_GRAPH_LABEL_ZERO); +$AxisY_Weather->setDataPreprocessor($DataPreprocessor_DegC); +$AxisY_Weather->setTitle( + 'Temperature', + array('vertical' => true, 'angle' => 90) ); -$AxisX =& $Plotarea_Radar->getAxis(IMAGE_GRAPH_AXIS_X); -$AxisX->setDataPreprocessor($DataPreprocessor); - -$AverageMarker =& Image_Graph::factory('Image_Graph_Marker_Average'); -$Plot_SmoothedLine->setMarker($AverageMarker); -$AverageMarker->setLineColor('purple'); - -// set a standard fill style -$Plot_Radar1->setFillColor('yellow@0.2'); -$Plot_Radar2->setFillColor('green@0.2'); -// output the Graph +$AxisYsecondary_Weather =& + $Plotarea_Weather->getAxis(IMAGE_GRAPH_AXIS_Y_SECONDARY); +$AxisYsecondary_Weather->setDataPreprocessor($DataPreprocessor_MM); +$AxisYsecondary_Weather->setTitle( + 'Rainfall', + array('vertical' => true, 'angle' => 270) +); +$GridX_SinCos =& + $Plotarea_SinCos->addNew('line_grid', null, IMAGE_GRAPH_AXIS_X); +$GridY_SinCos =& + $Plotarea_SinCos->addNew('line_grid', null, IMAGE_GRAPH_AXIS_Y); +$Dataset_Sin =& + Image_Graph::factory( + 'Image_Graph_Dataset_Function', + array(-2*pi(), 2*pi(), 'sin', 50) + ); +$Dataset_Cos =& + Image_Graph::factory( + 'Image_Graph_Dataset_Function', + array(-2*pi(), 2*pi(), 'cos', 50) + ); +$Plot_Sin =& $Plotarea_SinCos->addNew('line', $Dataset_Sin); +$Plot_Cos =& $Plotarea_SinCos->addNew('line', $Dataset_Cos); +$Plot_Sin->setLineColor('red'); +$Plot_Cos->setLineColor('blue'); +$Plot_Sin->setTitle('sin(x)'); +$Plot_Cos->setTitle('cos(x)'); +$AxisX_SinCos =& $Plotarea_SinCos->getAxis(IMAGE_GRAPH_AXIS_X); +$AxisX_SinCos->setLabelInterval(array(-6, -4, -2, 2, 4, 6)); +$AxisY_SinCos =& $Plotarea_SinCos->getAxis(IMAGE_GRAPH_AXIS_Y); +$AxisY_SinCos->forceMinimum(-1.1); +$AxisY_SinCos->forceMaximum(1.1); +$AxisY_SinCos->setLabelInterval(array(-1, -0.5, 0.5, 1)); + +function carLabel($value) { + return 2000+$value; +} + +$DataPreprocessor_Car =& + Image_Graph::factory('Image_Graph_DataPreprocessor_Function', 'carLabel'); + +$GridX_Car =& $Plotarea_Car->addNew('line_grid', null, IMAGE_GRAPH_AXIS_X); +$GridY_Car =& $Plotarea_Car->addNew('line_grid', null, IMAGE_GRAPH_AXIS_Y); +$GridX_Car->setLineColor('gray@0.2'); +$GridY_Car->setLineColor('gray@0.2'); +$Dataset_Car =& Image_Graph::factory('random', array(10, 10, 100, true)); +$Fill_Car =& + Image_Graph::factory('Image_Graph_Fill_Image', './images/audi-tt-coupe.jpg'); +$Plotarea_Car->setFillStyle($Fill_Car); +$Plot_Car =& + $Plotarea_Car->addNew('Image_Graph_Plot_Smoothed_Area', $Dataset_Car); +$Plot_Car->setLineColor('gray'); +$Plot_Car->setFillColor('white@0.7'); + +$AxisX_Car =& $Plotarea_Car->getAxis(IMAGE_GRAPH_AXIS_X); +$AxisX_Car->setDataPreprocessor($DataPreprocessor_Car); +$AxisX_Car->setFontSize(6); +$AxisY_Car =& $Plotarea_Car->getAxis(IMAGE_GRAPH_AXIS_Y); +$AxisY_Car->forceMaximum(100); // output the Graph $Graph->done(); http://cvs.php.net/viewcvs.cgi/pear/Image_Graph/docs/examples/frontpage_sample.php?r1=1.4&r2=1.5&diff_format=u Index: pear/Image_Graph/docs/examples/frontpage_sample.php diff -u pear/Image_Graph/docs/examples/frontpage_sample.php:1.4 pear/Image_Graph/docs/examples/frontpage_sample.php:1.5 --- pear/Image_Graph/docs/examples/frontpage_sample.php:1.4 Wed Aug 3 21:21:53 2005 +++ pear/Image_Graph/docs/examples/frontpage_sample.php Tue Feb 28 22:48:07 2006 @@ -9,7 +9,7 @@ * Grids, Axis markers, Secondary Y-axis, Datapreprocessor, Multiple plotareas, * Axis titles * - * $Id: frontpage_sample.php,v 1.4 2005/08/03 21:21:53 nosey Exp $ + * $Id: frontpage_sample.php,v 1.5 2006/02/28 22:48:07 nosey Exp $ * * @package Image_Graph * @author Jesper Veggerby <pear.nosey@veggerby.dk> @@ -277,7 +277,7 @@ // make the graph use this now instead $Graph->setCanvas($Canvas); -// 're'-output the graph, but not using the SVG canvas +// 're'-output the graph, but now using the SVG canvas $Graph->done(array('filename' => './output/frontpage_sample.svg')); /* @@ -294,7 +294,7 @@ // make the graph use this now instead $Graph->setCanvas($Canvas); -// 're'-output the graph, but not using the PDF canvas +// 're'-output the graph, but now using the PDF canvas $Graph->done(array('filename' => './output/frontpage_sample.pdf')); // create a new SWF canvas @@ -307,7 +307,7 @@ // make the graph use this now instead $Graph->setCanvas($Canvas); -// 're'-output the graph, but not using the SWF canvas +// 're'-output the graph, but now using the SWF canvas $Graph->done(array('filename' => './output/frontpage_sample.swf')); */ ?> \ No newline at end of file http://cvs.php.net/viewcvs.cgi/pear/Image_Graph/Graph/Plotarea/Radar.php?r1=1.7&r2=1.8&diff_format=u Index: pear/Image_Graph/Graph/Plotarea/Radar.php diff -u pear/Image_Graph/Graph/Plotarea/Radar.php:1.7 pear/Image_Graph/Graph/Plotarea/Radar.php:1.8 --- pear/Image_Graph/Graph/Plotarea/Radar.php:1.7 Wed Aug 24 20:36:02 2005 +++ pear/Image_Graph/Graph/Plotarea/Radar.php Tue Feb 28 22:48:07 2006 @@ -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: Radar.php,v 1.7 2005/08/24 20:36:02 nosey Exp $ + * @version CVS: $Id: Radar.php,v 1.8 2006/02/28 22:48:07 nosey Exp $ * @link http://pear.php.net/package/Image_Graph */ @@ -54,7 +54,7 @@ function Image_Graph_Plotarea_Radar() { parent::Image_Graph_Element(); - $this->_padding = 10; + $this->_padding = array('left' => 10, 'top' => 10, 'right' => 10, 'bottom' => 10); $this->_axisX =& Image_Graph::factory('Image_Graph_Axis_Radar'); $this->_axisX->_setParent($this); $this->_axisY =& Image_Graph::factory('Image_Graph_Axis', IMAGE_GRAPH_AXIS_Y); http://cvs.php.net/viewcvs.cgi/pear/Image_Graph/Graph/Plotarea/Map.php?r1=1.9&r2=1.10&diff_format=u Index: pear/Image_Graph/Graph/Plotarea/Map.php diff -u pear/Image_Graph/Graph/Plotarea/Map.php:1.9 pear/Image_Graph/Graph/Plotarea/Map.php:1.10 --- pear/Image_Graph/Graph/Plotarea/Map.php:1.9 Wed Aug 24 20:36:01 2005 +++ pear/Image_Graph/Graph/Plotarea/Map.php Tue Feb 28 22:48:07 2006 @@ -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: Map.php,v 1.9 2005/08/24 20:36:01 nosey Exp $ + * @version CVS: $Id: Map.php,v 1.10 2006/02/28 22:48:07 nosey Exp $ * @link http://pear.php.net/package/Image_Graph */ @@ -119,7 +119,7 @@ */ function _fillLeft() { - return $this->_left + $this->_padding; + return $this->_left + $this->_padding['left']; } /** @@ -130,7 +130,7 @@ */ function _fillTop() { - return $this->_top + $this->_padding; + return $this->_top + $this->_padding['top']; } /** @@ -141,7 +141,7 @@ */ function _fillRight() { - return $this->_right - $this->_padding; + return $this->_right - $this->_padding['right']; } /** @@ -152,7 +152,7 @@ */ function _fillBottom() { - return $this->_bottom - $this->_padding; + return $this->_bottom - $this->_padding['bottom']; } /** http://cvs.php.net/viewcvs.cgi/pear/Image_Graph/Graph/Marker/Value.php?r1=1.9&r2=1.10&diff_format=u Index: pear/Image_Graph/Graph/Marker/Value.php diff -u pear/Image_Graph/Graph/Marker/Value.php:1.9 pear/Image_Graph/Graph/Marker/Value.php:1.10 --- pear/Image_Graph/Graph/Marker/Value.php:1.9 Wed Aug 24 20:35:52 2005 +++ pear/Image_Graph/Graph/Marker/Value.php Tue Feb 28 22:48:07 2006 @@ -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: Value.php,v 1.9 2005/08/24 20:35:52 nosey Exp $ + * @version CVS: $Id: Value.php,v 1.10 2006/02/28 22:48:07 nosey Exp $ * @link http://pear.php.net/package/Image_Graph */ @@ -72,7 +72,7 @@ function Image_Graph_Marker_Value($useValue = IMAGE_GRAPH_VALUE_X) { parent::Image_Graph_Marker(); - $this->_padding = 2; + $this->_padding = array('left' => 2, 'top' => 2, 'right' => 2, 'bottom' => 2); $this->_useValue = $useValue; $this->_fillStyle = 'white'; $this->_borderStyle = 'black'; @@ -192,8 +192,8 @@ $width = $this->_canvas->textWidth($value); $height = $this->_canvas->textHeight($value); - $offsetX = $width/2 + $this->_padding; - $offsetY = $height/2 + $this->_padding; + $offsetX = $width/2 + $this->_padding['left']; + $offsetY = $height/2 + $this->_padding['top']; $this->_getFillStyle(); $this->_getBorderStyle(); http://cvs.php.net/viewcvs.cgi/pear/Image_Graph/package.xml?r1=1.21&r2=1.22&diff_format=u Index: pear/Image_Graph/package.xml diff -u pear/Image_Graph/package.xml:1.21 pear/Image_Graph/package.xml:1.22 --- pear/Image_Graph/package.xml:1.21 Fri Sep 30 19:27:14 2005 +++ pear/Image_Graph/package.xml Tue Feb 28 22:48:07 2006 @@ -34,30 +34,14 @@ </maintainer> </maintainers> <release> - <version>0.7.0</version> - <date>2005-09-30</date> + <version>0.7.1</version> + <date>2005-10-05</date> <license>LGPL</license> <state>alpha</state> - <notes>* Added Image_Graph_Plot_Odo (thanks Maxime Delorme) -* Added Image_Graph_DataSelector_Values (thanks Paolo) -* Added best-fit line plot (Image_Graph_Plot_Fit_Line) -* Added possibility to specify the pie plot diameter -* Modified Image_Graph_Plot_CandleStick, it is now only necessary to specify 'open' for first point (other 'open' = previous 'close') -* Changed Image_Graph_Plotarea::hideAxis() to actually hide the axis, not remove them -* Added Image_Graph_Plotarea::clearAxis() to remove the axis -* Fixed markers so that y values equal to null never shows markers -* Fixed problem in Image_Graph_Plot_BoxWhisker causing an undefined method -* Fixed problem with markers and horizontal plots -* Fixed problem with axis not showing arrow-ends even if enabled -* Fixed problem with an error "Call to a member function on a non-object..." in Common.php -* Fixed a problem with Image_Graph_Dataset_Trivial when supplying a datarray as constructor parameter and Image_Graph_Fill_Array -* Fixed Bug #5421 "Documentation for Image_Graph constructor wrong" -* Fixed Bug #5502 "Axis_Logarithmic::setAxisIntersection('max') is broken" -* Fixed Bug #5504 "PHP Notice: Undefined index: tohtml" -* Fixed PHP notice with Image_Graph::done() when using output to file -* Fixed so it is possible to use array(R, G, B, a?) as fill color -* Fixed issue with markers not rotating along with plot when using setStartingAngle() -* Fixed trivial dataset so that it is possible to use 'id' as key when populating dataset in constructor + <notes>* Fixed Bug #5415 "Axis's wrong when plot is Dot/Scatter" +* Fixed Bug #5607 "X Axis Labels align to right" +* Fixed a problem with horizontal plots and axis labels and titles not showing/aligning properly +* Fixed a problem with horizontal Step plot </notes> <deps> <dep type="pkg" rel="ge" version="1.3.1" optional="no">PEAR</dep> @@ -181,6 +165,7 @@ <provides type="class" name="Image_Graph_DataSelector_EveryNthPoint" extends="Image_Graph_DataSelector" /> <provides type="class" name="Image_Graph_DataSelector_NoZeros" extends="Image_Graph_DataSelector" /> <provides type="class" name="Image_Graph_DataSelector_Values" extends="Image_Graph_DataSelector" /> + <provides type="function" name="Image_Graph_DataSelector_Values::setValueArray" /> <provides type="class" name="Image_Graph_Dataset_Function" extends="Image_Graph_Dataset" /> <provides type="function" name="Image_Graph_Dataset_Function::addPoint" /> <provides type="class" name="Image_Graph_Dataset_Random" extends="Image_Graph_Dataset_Trivial" /> @@ -327,6 +312,9 @@ <file role="doc" baseinstalldir="Image" name="docs/examples/double_category_axis.php"> <replace type="package-info" from="@package_version@" to="version"/> </file> + <file role="doc" baseinstalldir="Image" name="docs/examples/driver_filepdf.php"> + <replace type="package-info" from="@package_version@" to="version"/> + </file> <file role="doc" baseinstalldir="Image" name="docs/examples/driver_pdf.php"> <replace type="package-info" from="@package_version@" to="version"/> </file> @@ -354,6 +342,9 @@ <file role="doc" baseinstalldir="Image" name="docs/examples/gradient_step.php"> <replace type="package-info" from="@package_version@" to="version"/> </file> + <file role="doc" baseinstalldir="Image" name="docs/examples/horizontal.php"> + <replace type="package-info" from="@package_version@" to="version"/> + </file> <file role="doc" baseinstalldir="Image" name="docs/examples/html_image_map.php"> <replace type="package-info" from="@package_version@" to="version"/> </file> @@ -1116,5 +1107,16 @@ * Fixed trivial dataset so that it is possible to use 'id' as key when populating dataset in constructor </notes> </release> + <release> + <version>0.7.1</version> + <date>2005-10-05</date> + <license>LGPL</license> + <state>alpha</state> + <notes>* Fixed Bug #5415 "Axis's wrong when plot is Dot/Scatter" +* Fixed Bug #5607 "X Axis Labels align to right" +* Fixed a problem with horizontal plots and axis labels and titles not showing/aligning properly +* Fixed a problem with horizontal Step plot + </notes> + </release> </changelog> </package> http://cvs.php.net/viewcvs.cgi/pear/Image_Graph/Graph/Layout/Horizontal.php?r1=1.10&r2=1.11&diff_format=u Index: pear/Image_Graph/Graph/Layout/Horizontal.php diff -u pear/Image_Graph/Graph/Layout/Horizontal.php:1.10 pear/Image_Graph/Graph/Layout/Horizontal.php:1.11 --- pear/Image_Graph/Graph/Layout/Horizontal.php:1.10 Wed Aug 24 20:35:58 2005 +++ pear/Image_Graph/Graph/Layout/Horizontal.php Tue Feb 28 22:48:07 2006 @@ -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: Horizontal.php,v 1.10 2005/08/24 20:35:58 nosey Exp $ + * @version CVS: $Id: Horizontal.php,v 1.11 2006/02/28 22:48:07 nosey Exp $ * @link http://pear.php.net/package/Image_Graph */ @@ -115,7 +115,7 @@ $this->_percentage = max(0, min(100, $percentage)); } $this->_split(); - $this->_padding = 0; + $this->_padding = array('left' => 0, 'top' => 0, 'right' => 0, 'bottom' => 0); } /** http://cvs.php.net/viewcvs.cgi/pear/Image_Graph/docs/examples/log_axis_forcemin.php?view=markup&rev=1.1 Index: pear/Image_Graph/docs/examples/log_axis_forcemin.php +++ pear/Image_Graph/docs/examples/log_axis_forcemin.php <?php /** * Usage example for Image_Graph. * * Main purpose: * Demonstrate logarithmic axis * * Other: * Matrix layout, Axis titles * * $Id: log_axis_forcemin.php,v 1.1 2006/02/28 22:48:07 nosey Exp $ * * @package Image_Graph * @author Jesper Veggerby <pear.nosey@veggerby.dk> */ require_once 'Image/Graph.php'; require_once 'Image/Canvas.php'; $Canvas =& Image_Canvas::factory('png', array('width' => 600, 'height' => 400, 'antialias' => true)); // create the graph $Graph =& Image_Graph::factory('graph', $Canvas); // add a TrueType font $Font =& $Graph->addNew('font', 'Verdana'); // set the font size to 15 pixels $Font->setSize(8); // add a title using the created font for ($i = 0; $i < 2; $i++) { for ($j = 0; $j < 2; $j++) { $Axis['X'][($i*2+$j)] = 'axis' . ($i % 2 == 0 ? '' : '_log'); $Axis['Y'][($i*2+$j)] = 'axis' . ($j % 2 == 0 ? '' : '_log'); } } for ($i = 0; $i < 4; $i++) { $Plotarea[$i] =& Image_Graph::factory('plotarea', array($Axis['X'][$i], $Axis['Y'][$i])); } $Graph->setFont($Font); // create the plotarea $Graph->add( Image_Graph::vertical( Image_Graph::factory('title', array('Logarithmic Axis', 11)), Image_Graph::vertical( Image_Graph::horizontal( Image_Graph::vertical( Image_Graph::factory('title', array('Normal Y-Axis', array('size' => 10, 'angle' => 90))), Image_Graph::factory('title', array('Logarithmic Y-Axis', array('size' => 10, 'angle' => 90))) ), Image_Graph::horizontal( Image_Graph::vertical( Image_Graph::factory('title', array('Normal X-Axis', 10)), Image_Graph::vertical( $Plotarea[0], $Plotarea[1] ), 7 ), Image_Graph::vertical( Image_Graph::factory('Image_Graph_Title', array('Logarithmic X-Axis', 10)), Image_Graph::vertical( $Plotarea[2], $Plotarea[3] ), 7 ) ), 4 ), $Legend = Image_Graph::factory('Image_Graph_Legend'), 92 ), 5 ) ); $Legend->setPlotarea($Plotarea[0]); $Dataset = Image_Graph::factory('dataset'); $i = 1; while ($i <= 10) { $Dataset->addPoint($i, $i*$i); $i++; } for ($i = 0; $i < 4; $i++) { $Plotarea[$i]->addNew('line_grid', false, IMAGE_GRAPH_AXIS_X); $Plotarea[$i]->addNew('line_grid', false, IMAGE_GRAPH_AXIS_Y); $Axis =& $Plotarea[$i]->getAxis(IMAGE_GRAPH_AXIS_Y); if ($i % 2 == 1) { $Axis->setLabelInterval(array(30, 45, 50, 65, 100)); } $Axis->forceMinimum(25); $Axis->forceMaximum(125); $Axis =& $Plotarea[$i]->getAxis(IMAGE_GRAPH_AXIS_X); if ($i > 1) { $Axis->setLabelInterval(array(1, 2, 3, 4, 5, 6, 8, 10)); } $Axis->forceMaximum(12); $Plot =& $Plotarea[$i]->addNew('line', array(&$Dataset)); $Plot->setLineColor('red'); $Plot->setTitle("x^2"); } $Graph->done(); ?> http://cvs.php.net/viewcvs.cgi/pear/Image_Graph/docs/examples/log_axis_low.php?view=markup&rev=1.1 Index: pear/Image_Graph/docs/examples/log_axis_low.php +++ pear/Image_Graph/docs/examples/log_axis_low.php <?php /** * Usage example for Image_Graph. * * Main purpose: * Show line chart * * Other: * None specific * * $Id: log_axis_low.php,v 1.1 2006/02/28 22:48:07 nosey Exp $ * * @package Image_Graph * @author Jesper Veggerby <pear.nosey@veggerby.dk> */ require_once 'Image/Graph.php'; // create the graph $Graph =& Image_Graph::factory('graph', array(400, 300)); // add a TrueType font $Font =& $Graph->addNew('font', 'Verdana'); // set the font size to 11 pixels $Font->setSize(10); $Graph->setFont($Font); // setup the plotarea, legend and their layout $Graph->add( Image_Graph::vertical( Image_Graph::factory('title', array('Small Values on Log Axis Chart Sample', 12)), Image_Graph::vertical( $Plotarea = Image_Graph::factory('plotarea', array('axis_log', 'axis')), $Legend = Image_Graph::factory('legend'), 88 ), 5 ) ); // link the legend with the plotares $Legend->setPlotarea($Plotarea); $Dataset =& Image_Graph::factory('dataset'); $Dataset->addPoint(0.063,5); $Dataset->addPoint(0.125,7); $Dataset->addPoint(0.25,8); $Dataset->addPoint(0.5,10); $Dataset->addPoint(1,15); $Dataset->addPoint(2,30); $Dataset->addPoint(4,45); $Dataset->addPoint(8,80); // create the plot as line chart using the dataset $Plot =& $Plotarea->addNew('line', array(&$Dataset)); // set a line color $Plot->setLineColor('red'); // output the Graph $Graph->done(); ?>
http://cvs.php.net/viewcvs.cgi/pear/Image_Graph/Graph/Element.php?r1=1.17&r2=1.18&diff_format=u Index: pear/Image_Graph/Graph/Element.php diff -u pear/Image_Graph/Graph/Element.php:1.17 pear/Image_Graph/Graph/Element.php:1.18 --- pear/Image_Graph/Graph/Element.php:1.17 Sun Nov 27 22:21:17 2005 +++ pear/Image_Graph/Graph/Element.php Tue Feb 28 22:48:07 2006 @@ -23,7 +23,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: Element.php,v 1.17 2005/11/27 22:21:17 nosey Exp $ + * @version CVS: $Id: Element.php,v 1.18 2006/02/28 22:48:07 nosey Exp $ * @link http://pear.php.net/package/Image_Graph */ @@ -146,7 +146,7 @@ * @var int * @access private */ - var $_padding = 0; + var $_padding = array('left' => 0, 'top' => 0, 'right' => 0, 'bottom' => 0); /** * Sets the background fill style of the element @@ -562,11 +562,26 @@ /** * Sets padding of the element * - * @param int $padding Number of pixels the element should be padded with + * @param mixed $padding Number of pixels the element should be padded with + * or an array of paddings (left, top, right and bottom as index) */ function setPadding($padding) { - $this->_padding = $padding; + if (is_array($padding)) { + $this->_padding = array(); + $this->_padding['left'] = (isset($padding['left']) ? $padding['left'] : 0); + $this->_padding['top'] = (isset($padding['top']) ? $padding['top'] : 0); + $this->_padding['right'] = (isset($padding['right']) ? $padding['right'] : 0); + $this->_padding['bottom'] = (isset($padding['bottom']) ? $padding['bottom'] : 0); + } + else { + $this->_padding = array( + 'left' => $padding, + 'top' => $padding, + 'right' => $padding, + 'bottom' => $padding + ); + } } /** @@ -597,7 +612,7 @@ */ function _fillLeft() { - return $this->_left + $this->_padding; + return $this->_left + $this->_padding['left']; } /** @@ -608,7 +623,7 @@ */ function _fillTop() { - return $this->_top + $this->_padding; + return $this->_top + $this->_padding['top']; } /** @@ -619,7 +634,7 @@ */ function _fillRight() { - return $this->_right - $this->_padding; + return $this->_right - $this->_padding['right']; } /** @@ -630,7 +645,7 @@ */ function _fillBottom() { - return $this->_bottom - $this->_padding; + return $this->_bottom - $this->_padding['bottom']; } /** http://cvs.php.net/viewcvs.cgi/pear/Image_Graph/Graph/Legend.php?r1=1.15&r2=1.16&diff_format=u Index: pear/Image_Graph/Graph/Legend.php diff -u pear/Image_Graph/Graph/Legend.php:1.15 pear/Image_Graph/Graph/Legend.php:1.16 --- pear/Image_Graph/Graph/Legend.php:1.15 Fri Sep 30 18:59:18 2005 +++ pear/Image_Graph/Graph/Legend.php Tue Feb 28 22:48:07 2006 @@ -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: Legend.php,v 1.15 2005/09/30 18:59:18 nosey Exp $ + * @version CVS: $Id: Legend.php,v 1.16 2006/02/28 22:48:07 nosey Exp $ * @link http://pear.php.net/package/Image_Graph */ @@ -81,7 +81,7 @@ function Image_Graph_Legend() { parent::Image_Graph_Layout(); - $this->_padding = 5; + $this->_padding = array('left' => 5, 'top' => 5, 'right' => 5, 'bottom' => 5); } /** @@ -120,13 +120,13 @@ */ function _parameterArray($simulate = false) { - $param['left'] = $this->_left + $this->_padding; - $param['top'] = $this->_top + $this->_padding; - $param['right'] = $this->_right - $this->_padding; - $param['bottom'] = $this->_bottom - $this->_padding; + $param['left'] = $this->_left + $this->_padding['left']; + $param['top'] = $this->_top + $this->_padding['top']; + $param['right'] = $this->_right - $this->_padding['right']; + $param['bottom'] = $this->_bottom - $this->_padding['bottom']; $param['align'] = $this->_alignment; - $param['x'] = $this->_left + $this->_padding; - $param['y'] = $this->_top + $this->_padding; + $param['x'] = $this->_left + $this->_padding['left']; + $param['y'] = $this->_top + $this->_padding['top']; $param['width'] = 16; $param['height'] = 16; $param['show_marker'] = $this->_showMarker; @@ -166,7 +166,7 @@ unset($keys2); } unset($keys); - return abs($param['y'] - $param0['y']) + 2*$this->_padding; + return abs($param['y'] - $param0['y']) + $this->_padding['top'] + $this->_padding['bottom']; } else { return parent::height(); } @@ -234,15 +234,15 @@ } if (($this->_alignment & IMAGE_GRAPH_ALIGN_BOTTOM) != 0) { - $y = $this->_parent->_fillBottom() - $h - $this->_padding; + $y = $this->_parent->_fillBottom() - $h - $this->_padding['bottom']; } else { - $y = $this->_parent->_fillTop() + $this->_padding; + $y = $this->_parent->_fillTop() + $this->_padding['top']; } if (($this->_alignment & IMAGE_GRAPH_ALIGN_LEFT) != 0) { - $x = $this->_parent->_fillLeft() + $this->_padding; + $x = $this->_parent->_fillLeft() + $this->_padding['left']; } else { - $x = $this->_parent->_fillRight() - $w - $this->_padding; + $x = $this->_parent->_fillRight() - $w - $this->_padding['right']; } $this->_setCoords($x, $y, $x + $w, $y + $h); http://cvs.php.net/viewcvs.cgi/pear/Image_Graph/Graph/Plotarea.php?r1=1.22&r2=1.23&diff_format=u Index: pear/Image_Graph/Graph/Plotarea.php diff -u pear/Image_Graph/Graph/Plotarea.php:1.22 pear/Image_Graph/Graph/Plotarea.php:1.23 --- pear/Image_Graph/Graph/Plotarea.php:1.22 Wed Nov 16 20:44:48 2005 +++ pear/Image_Graph/Graph/Plotarea.php Tue Feb 28 22:48:07 2006 @@ -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: Plotarea.php,v 1.22 2005/11/16 20:44:48 nosey Exp $ + * @version CVS: $Id: Plotarea.php,v 1.23 2006/02/28 22:48:07 nosey Exp $ * @link http://pear.php.net/package/Image_Graph */ @@ -133,7 +133,7 @@ { parent::Image_Graph_Layout(); - $this->_padding = 5; + $this->_padding = array('left' => 5, 'top' => 5, 'right' => 5, 'bottom' => 5);; include_once 'Image/Graph.php'; @@ -645,10 +645,10 @@ $pctWidth = (int) ($this->width() * 0.05); $pctHeight = (int) ($this->height() * 0.05); - $left = $this->_left + $this->_padding; - $top = $this->_top + $this->_padding; - $right = $this->_right - $this->_padding; - $bottom = $this->_bottom - $this->_padding; + $left = $this->_left + $this->_padding['left']; + $top = $this->_top + $this->_padding['top']; + $right = $this->_right - $this->_padding['right']; + $bottom = $this->_bottom - $this->_padding['bottom']; // temporary place holder for axis point calculations $axisPoints['x'] = array($left, $top, $right, $bottom); http://cvs.php.net/viewcvs.cgi/pear/Image_Graph/Graph/Axis.php?r1=1.34&r2=1.35&diff_format=u Index: pear/Image_Graph/Graph/Axis.php diff -u pear/Image_Graph/Graph/Axis.php:1.34 pear/Image_Graph/Graph/Axis.php:1.35 --- pear/Image_Graph/Graph/Axis.php:1.34 Wed Nov 16 20:44:48 2005 +++ pear/Image_Graph/Graph/Axis.php Tue Feb 28 22:48:07 2006 @@ -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: Axis.php,v 1.34 2005/11/16 20:44:48 nosey Exp $ + * @version CVS: $Id: Axis.php,v 1.35 2006/02/28 22:48:07 nosey Exp $ * @link http://pear.php.net/package/Image_Graph */ @@ -1172,9 +1172,9 @@ } else { $this->write( $labelPosition, - $this->_top + 3 + $offset, + $this->_top + 6 + $offset + $font['size'] * (substr_count($labelText, "\n") + 1), $labelText, - IMAGE_GRAPH_ALIGN_TOP | IMAGE_GRAPH_ALIGN_CENTER_X, + IMAGE_GRAPH_ALIGN_BOTTOM | IMAGE_GRAPH_ALIGN_CENTER_X, $font ); } @@ -1203,9 +1203,9 @@ if ($labelInside) { $this->write( $labelPosition, - $this->_bottom + 3 + $offset, + $this->_bottom + 6 + $offset + $font['size'] * (substr_count($labelText, "\n") + 1), $labelText, - IMAGE_GRAPH_ALIGN_TOP | IMAGE_GRAPH_ALIGN_CENTER_X, + IMAGE_GRAPH_ALIGN_BOTTOM | IMAGE_GRAPH_ALIGN_CENTER_X, $font ); } else { @@ -1266,12 +1266,12 @@ IMAGE_GRAPH_ALIGN_CENTER_X | IMAGE_GRAPH_ALIGN_BOTTOM, $font ); - } else { + } else { $this->write( $labelPosition, - $this->_top + 3 + $offset, + $this->_top + 6 + $offset + $font['size'] * (substr_count($labelText, "\n") + 1), $labelText, - IMAGE_GRAPH_ALIGN_CENTER_X | IMAGE_GRAPH_ALIGN_TOP, + IMAGE_GRAPH_ALIGN_CENTER_X | IMAGE_GRAPH_ALIGN_BOTTOM, $font ); } http://cvs.php.net/viewcvs.cgi/pear/Image_Graph/Graph/Common.php?r1=1.15&r2=1.16&diff_format=u Index: pear/Image_Graph/Graph/Common.php diff -u pear/Image_Graph/Graph/Common.php:1.15 pear/Image_Graph/Graph/Common.php:1.16 --- pear/Image_Graph/Graph/Common.php:1.15 Mon Nov 21 19:20:09 2005 +++ pear/Image_Graph/Graph/Common.php Tue Feb 28 22:48:07 2006 @@ -23,7 +23,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: Common.php,v 1.15 2005/11/21 19:20:09 nosey Exp $ + * @version CVS: $Id: Common.php,v 1.16 2006/02/28 22:48:07 nosey Exp $ * @link http://pear.php.net/package/Image_Graph */ @@ -241,14 +241,16 @@ */ function _error($text, $params = false, $error_code = IMAGE_GRAPH_ERROR_GENERIC) { - foreach ($params as $name => $key) { - if (isset($parameters)) { - $parameters .= ' '; - } - else { - $parameters = ''; + if ((is_array($params)) && (count($params) > 0)) { + foreach ($params as $name => $key) { + if (isset($parameters)) { + $parameters .= ' '; + } + else { + $parameters = ''; + } + $parameters .= $name . '=' . $key; } - $parameters .= $name . '=' . $key; } $error =& PEAR::raiseError( $text . http://cvs.php.net/viewcvs.cgi/pear/Image_Graph/Graph/Layout.php?r1=1.11&r2=1.12&diff_format=u Index: pear/Image_Graph/Graph/Layout.php diff -u pear/Image_Graph/Graph/Layout.php:1.11 pear/Image_Graph/Graph/Layout.php:1.12 --- pear/Image_Graph/Graph/Layout.php:1.11 Wed Sep 14 20:27:25 2005 +++ pear/Image_Graph/Graph/Layout.php Tue Feb 28 22:48:07 2006 @@ -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: Layout.php,v 1.11 2005/09/14 20:27:25 nosey Exp $ + * @version CVS: $Id: Layout.php,v 1.12 2006/02/28 22:48:07 nosey Exp $ * @link http://pear.php.net/package/Image_Graph */ @@ -71,7 +71,7 @@ function Image_Graph_Layout() { parent::Image_Graph_Element(); - $this->_padding = 2; + $this->_padding = array('left' => 2, 'top' => 2, 'right' => 2, 'bottom' => 2); } /** @@ -146,10 +146,10 @@ ); $this->_setCoords( - $left + $this->_padding, - $top + $this->_padding, - $right - $this->_padding, - $bottom - $this->_padding + $left + $this->_padding['left'], + $top + $this->_padding['top'], + $right - $this->_padding['right'], + $bottom - $this->_padding['bottom'] ); } } http://cvs.php.net/viewcvs.cgi/pear/Image_Graph/docs/ChangeLog?r1=1.44&r2=1.45&diff_format=u Index: pear/Image_Graph/docs/ChangeLog diff -u pear/Image_Graph/docs/ChangeLog:1.44 pear/Image_Graph/docs/ChangeLog:1.45 --- pear/Image_Graph/docs/ChangeLog:1.44 Sun Nov 27 22:21:14 2005 +++ pear/Image_Graph/docs/ChangeLog Tue Feb 28 22:48:07 2006 @@ -1,7 +1,7 @@ ************************* Image_Graph - Changelog ************************* -Version 0.x.x alpha [2005-xxx-xx] - Jesper Veggerby <pear.nosey@veggerby.dk> +Version 0.7.2-alpha [2006-Fec-28] - Jesper Veggerby <pear.nosey@veggerby.dk> * Added Pie chart support for grouping items with values below a specified threshold in a "the rest" group * Added possibility to set color of axis ticks (thanks to bdondo from forum) * Added clipping support, causing forceMinimum() and forceMaximum() to show expected results @@ -10,6 +10,12 @@ * Fixed a bug with Candlestick, Band and Box & Whisker plots not working when using markers * Fixed Bug #6024 "Undefined variable: parameters" * Fixed Bug #6085 "Graph doesn't understand a numeric variable extracted from the GET method." + * Fixed Bug #6919 "Isolated points in linegraphs with breaks drawn incorrectly" + * Fixed Bug #6921 "Marker not drawn for points with Y value == 0" + * Fixed Bug #6941 "Logarithmic axis values between 0 and 1" + * Fixed Request #5985 "Logarithmic Axis Minimum Value" + * Fixed a problem with labels not appearing on the same baseline + * Added possibility to specify padding on all edges of an element separately Version 0.7.1-alpha [2005-Oct-05] - Jesper Veggerby <pear.nosey@veggerby.dk> * Fixed Bug #5415 "Axis's wrong when plot is Dot/Scatter" http://cvs.php.net/viewcvs.cgi/pear/Image_Graph/docs/TODO?r1=1.7&r2=1.8&diff_format=u Index: pear/Image_Graph/docs/TODO diff -u pear/Image_Graph/docs/TODO:1.7 pear/Image_Graph/docs/TODO:1.8 --- pear/Image_Graph/docs/TODO:1.7 Sat Aug 27 17:27:32 2005 +++ pear/Image_Graph/docs/TODO Tue Feb 28 22:48:07 2006 @@ -22,15 +22,11 @@ Image_Graph_Plot_Line *** Consider new legend icon -Image_Graph_Plot_Pie -*** Group items together in one pie ("the rest") if less than a certain value/percentage - Image_Graph_Plot_Smoothed_Radar *** Create legend sample for smoothed radar chart Image_Graph_Axis *** Create a method to align '0' of primary and secondary y-axis -*** Values aren't properly cropped when "above" maximum or "below" minimum (i.e. graph should be cropped to plotarea!) Image_Graph_Axis_Composite *** Implement composite axis (i.e. linear from 0-10, log from 10-1000, and category from 1001, 1004, 10000, ...) http://cvs.php.net/viewcvs.cgi/pear/Image_Graph/docs/examples/clipping.php?r1=1.1&r2=1.2&diff_format=u Index: pear/Image_Graph/docs/examples/clipping.php diff -u pear/Image_Graph/docs/examples/clipping.php:1.1 pear/Image_Graph/docs/examples/clipping.php:1.2 --- pear/Image_Graph/docs/examples/clipping.php:1.1 Sun Nov 27 22:21:17 2005 +++ pear/Image_Graph/docs/examples/clipping.php Tue Feb 28 22:48:07 2006 @@ -8,20 +8,13 @@ * Other: * None specific * - * $Id: clipping.php,v 1.1 2005/11/27 22:21:17 nosey Exp $ + * $Id: clipping.php,v 1.2 2006/02/28 22:48:07 nosey Exp $ * * @package Image_Graph * @author Jesper Veggerby <pear.nosey@veggerby.dk> */ require_once 'Image/Graph.php'; -//require_once 'Image/Canvas.php'; -// -//// create a new GD canvas -//$Canvas =& Image_Canvas::factory('svg', array('width' => 400, 'height' => 300)); -// -//// create the graph -//$Graph =& Image_Graph::factory('graph', $Canvas); $Graph =& Image_Graph::factory('graph', array(600, 400)); @@ -50,52 +43,52 @@ $GridY_Weather->setLineColor('gray@0.1'); $Dataset_TempAvg =& Image_Graph::factory('dataset'); -$Dataset_TempAvg->addPoint('Jan', 0.2); -$Dataset_TempAvg->addPoint('Feb', 0.1); -$Dataset_TempAvg->addPoint('Mar', 2.3); -$Dataset_TempAvg->addPoint('Apr', 5.8); -$Dataset_TempAvg->addPoint('May', 10.8); -$Dataset_TempAvg->addPoint('Jun', 14.1); -$Dataset_TempAvg->addPoint('Jul', 16.2); -$Dataset_TempAvg->addPoint('Aug', 15.9); -$Dataset_TempAvg->addPoint('Sep', 12.1); -$Dataset_TempAvg->addPoint('Oct', 8.7); -$Dataset_TempAvg->addPoint('Nov', 4.4); -$Dataset_TempAvg->addPoint('Dec', 1.8); +$Dataset_TempAvg->addPoint("Jan\n2005", 0.2); +$Dataset_TempAvg->addPoint("Feb\n2005", 0.1); +$Dataset_TempAvg->addPoint("Mar\n2005", 2.3); +$Dataset_TempAvg->addPoint("Apr\n2005", 5.8); +$Dataset_TempAvg->addPoint("May\n2005", 10.8); +$Dataset_TempAvg->addPoint("Jun\n2005", 14.1); +$Dataset_TempAvg->addPoint("Jul\n2005", 16.2); +$Dataset_TempAvg->addPoint("Aug\n2005", 15.9); +$Dataset_TempAvg->addPoint("Sep\n2005", 12.1); +$Dataset_TempAvg->addPoint("Oct\n2005", 8.7); +$Dataset_TempAvg->addPoint("Nov\n2005", 4.4); +$Dataset_TempAvg->addPoint("Dec\n2005", 1.8); $Plot_TempAvg =& $Plotarea_Weather->addNew('smooth_line', array(&$Dataset_TempAvg)); $Plot_TempAvg->setLineColor('blue'); $Plot_TempAvg->setTitle('Average temperature'); $Dataset_TempMin =& Image_Graph::factory('dataset'); -$Dataset_TempMin->addPoint('Jan', -2.7); -$Dataset_TempMin->addPoint('Feb', -2.8); -$Dataset_TempMin->addPoint('Mar', -0.9); -$Dataset_TempMin->addPoint('Apr', 1.2); -$Dataset_TempMin->addPoint('May', 5.5); -$Dataset_TempMin->addPoint('Jun', 9.2); -$Dataset_TempMin->addPoint('Jul', 11.3); -$Dataset_TempMin->addPoint('Aug', 11.1); -$Dataset_TempMin->addPoint('Sep', 7.8); -$Dataset_TempMin->addPoint('Oct', 5.0); -$Dataset_TempMin->addPoint('Nov', 1.5); -$Dataset_TempMin->addPoint('Dec', -0.9); +$Dataset_TempMin->addPoint("Jan\n2005", -2.7); +$Dataset_TempMin->addPoint("Feb\n2005", -2.8); +$Dataset_TempMin->addPoint("Mar\n2005", -0.9); +$Dataset_TempMin->addPoint("Apr\n2005", 1.2); +$Dataset_TempMin->addPoint("May\n2005", 5.5); +$Dataset_TempMin->addPoint("Jun\n2005", 9.2); +$Dataset_TempMin->addPoint("Jul\n2005", 11.3); +$Dataset_TempMin->addPoint("Aug\n2005", 11.1); +$Dataset_TempMin->addPoint("Sep\n2005", 7.8); +$Dataset_TempMin->addPoint("Oct\n2005", 5.0); +$Dataset_TempMin->addPoint("Nov\n2005", 1.5); +$Dataset_TempMin->addPoint("Dec\n2005", -0.9); $Plot_TempMin =& $Plotarea_Weather->addNew('smooth_line', array(&$Dataset_TempMin)); $Plot_TempMin->setLineColor('teal'); $Plot_TempMin->setTitle('Minimum temperature'); $Dataset_TempMax =& Image_Graph::factory('dataset'); -$Dataset_TempMax->addPoint('Jan', 2.4); -$Dataset_TempMax->addPoint('Feb', 2.5); -$Dataset_TempMax->addPoint('Mar', 5.4); -$Dataset_TempMax->addPoint('Apr', 10.5); -$Dataset_TempMax->addPoint('May', 15.8); -$Dataset_TempMax->addPoint('Jun', 18.9); -$Dataset_TempMax->addPoint('Jul', 21.2); -$Dataset_TempMax->addPoint('Aug', 20.8); -$Dataset_TempMax->addPoint('Sep', 16.3); -$Dataset_TempMax->addPoint('Oct', 11.8); -$Dataset_TempMax->addPoint('Nov', 6.9); -$Dataset_TempMax->addPoint('Dec', 4.1); +$Dataset_TempMax->addPoint("Jan\n2005", 2.4); +$Dataset_TempMax->addPoint("Feb\n2005", 2.5); +$Dataset_TempMax->addPoint("Mar\n2005", 5.4); +$Dataset_TempMax->addPoint("Apr\n2005", 10.5); +$Dataset_TempMax->addPoint("May\n2005", 15.8); +$Dataset_TempMax->addPoint("Jun\n2005", 18.9); +$Dataset_TempMax->addPoint("Jul\n2005", 21.2); +$Dataset_TempMax->addPoint("Aug\n2005", 20.8); +$Dataset_TempMax->addPoint("Sep\n2005", 16.3); +$Dataset_TempMax->addPoint("Oct\n2005", 11.8); +$Dataset_TempMax->addPoint("Nov\n2005", 6.9); +$Dataset_TempMax->addPoint("Dec\n2005", 4.1); $Plot_TempMax =& $Plotarea_Weather->addNew('smooth_line', array(&$Dataset_TempMax)); $Plot_TempMax->setLineColor('red'); $Plot_TempMax->setTitle('Maximum temperature'); @@ -122,5 +115,6 @@ $AxisY_Weather->forceMinimum(5); // output the graph +$Graph->setPadding(10); $Graph->done(); ?> \ No newline at end of file http://cvs.php.net/viewcvs.cgi/pear/Image_Graph/docs/examples/driver_pdf.php?r1=1.3&r2=1.4&diff_format=u Index: pear/Image_Graph/docs/examples/driver_pdf.php diff -u pear/Image_Graph/docs/examples/driver_pdf.php:1.3 pear/Image_Graph/docs/examples/driver_pdf.php:1.4 --- pear/Image_Graph/docs/examples/driver_pdf.php:1.3 Wed Aug 3 21:21:53 2005 +++ pear/Image_Graph/docs/examples/driver_pdf.php Tue Feb 28 22:48:07 2006 @@ -8,7 +8,7 @@ * Other: * Datapreprocessor, Axis markers * - * $Id: driver_pdf.php,v 1.3 2005/08/03 21:21:53 nosey Exp $ + * $Id: driver_pdf.php,v 1.4 2006/02/28 22:48:07 nosey Exp $ * * @package Image_Graph * @author Jesper Veggerby <pear.nosey@veggerby.dk> @@ -19,179 +19,246 @@ require_once 'Image/Graph.php'; require_once 'Image/Canvas.php'; -$Canvas =& Image_Canvas::factory('pdflib', array('page' => 'A3', 'align' => 'center', 'width' => 600, 'height' => 400)); +$Canvas =& Image_Canvas::factory('cpdf', array('page' => 'A3', 'align' => 'center', 'width' => 600, 'height' => 400)); // create the graph $Graph =& Image_Graph::factory('graph', $Canvas); -// add a TrueType font $Font =& $Graph->addNew('font', 'Verdana'); -// set the font size to 15 pixels -$Font->setSize(15); -// add a title using the created font - -$Dataset_SmoothedLine =& Image_Graph::factory('dataset'); -$Dataset_SmoothedLine->addPoint('DK', 6); -$Dataset_SmoothedLine->addPoint('UK', 8); -$Dataset_SmoothedLine->addPoint('PO', 2); -$Dataset_SmoothedLine->addPoint('NL', 4); +$Font->setSize(7); + +$Graph->setFont($Font); $Graph->add( Image_Graph::vertical( - Image_Graph::factory('title', array('Layout and Legend Sample', &$Font)), - Image_Graph::horizontal( + Image_Graph::factory('title', array('Image_Graph Demonstration', 12)), + Image_Graph::vertical( Image_Graph::vertical( - Image_Graph::horizontal( - Image_Graph::factory('title', array('This is the Y Axis', &$_Image_Graph_verticalFont)), + $Plotarea_Weather = Image_Graph::factory('plotarea'), + $Legend_Weather = Image_Graph::factory('legend'), + 85 + ), + Image_Graph::horizontal( + Image_Graph::vertical( Image_Graph::vertical( - $Plotarea_BarAndLine = Image_Graph::factory('plotarea'), - Image_Graph::factory('title', array('This is the X Axis', &$_Image_Graph_font)), - 95 + Image_Graph::factory( + 'title', + array('Demonstration of Mathematical Functions', 10) + ), + $Plotarea_SinCos = Image_Graph::factory('plotarea', 'axis'), + 5 ), - 5 + $Legend_SinCos = Image_Graph::factory('legend'), + 90 ), - $Legend_BarAndLine = Image_Graph::factory('legend'), - 95 - ), - Image_Graph::vertical( - Image_Graph::horizontal( - $Plotarea_SmoothedLine = Image_Graph::factory('plotarea'), - $Legend_SmoothedLine = Image_Graph::factory('legend'), - 80 - ), - $Plotarea_Radar = Image_Graph::factory('Image_Graph_Plotarea_Radar') - ), - 65 + $Plotarea_Car = Image_Graph::factory('plotarea'), + 50 + ), + 60 ), - 9 - ) + 5) ); +$Legend_Weather->setPlotarea($Plotarea_Weather); +$Legend_Weather->setFontSize(7); -$Legend_BarAndLine->setPlotarea($Plotarea_BarAndLine); -$Legend_SmoothedLine->setPlotarea($Plotarea_SmoothedLine); - -// create a Y grid -$Grid_Radar =& $Plotarea_Radar->addNew('line_grid', IMAGE_GRAPH_AXIS_Y); -$Grid_Radar->setLineColor('lightgrey'); - -// create a Y grid -$Grid_BarAndLine =& $Plotarea_BarAndLine->addNew('bar_grid', IMAGE_GRAPH_AXIS_Y); -// that is light gray in color -$Grid_BarAndLine->setFillStyle(Image_Graph::factory('gradient', array(IMAGE_GRAPH_GRAD_VERTICAL, 'white', 'lightgrey'))); - -// create a Y grid -$Grid_SmoothedLine =& $Plotarea_SmoothedLine->addNew('line_grid', IMAGE_GRAPH_AXIS_Y); -$Grid_SmoothedLine->setLineColor('lightgrey'); - -// create the 1st dataset -//$Dataset_SmoothedLine =& new Image_RandomDataset(4, 2, 15, true); -// create the 1st plot as smoothed area chart using the 1st dataset -$Plot_SmoothedLine =& $Plotarea_SmoothedLine->addNew('Image_Graph_Plot_Smoothed_Line', $Dataset_SmoothedLine); -$Plot_SmoothedLine->setLineColor('orange'); - -// create a 3rd dataset -$Dataset_BarChart =& Image_Graph::factory('random', array(8, 10, 120, false)); -// create the 3rd plot as line chart using the 2nd dataset -$Plot_BarChart =& $Plotarea_BarAndLine->addNew('bar', $Dataset_BarChart); -// set the fill style of the barchart to the almost transparent BlueAlpha -$FillArray =& Image_Graph::factory('Image_Graph_Fill_Array'); -$Plot_BarChart->setFillStyle($FillArray); -$FillArray->addNew('gradient', array(IMAGE_GRAPH_GRAD_VERTICAL, 'white', 'red')); -$FillArray->addNew('gradient', array(IMAGE_GRAPH_GRAD_VERTICAL, 'white', 'blue')); -$FillArray->addNew('gradient', array(IMAGE_GRAPH_GRAD_VERTICAL, 'white', 'yellow')); -$FillArray->addNew('gradient', array(IMAGE_GRAPH_GRAD_VERTICAL, 'white', 'green')); -$FillArray->addNew('gradient', array(IMAGE_GRAPH_GRAD_VERTICAL, 'white', 'purple')); -$FillArray->addNew('gradient', array(IMAGE_GRAPH_GRAD_VERTICAL, 'white', 'orange')); -$FillArray->addNew('gradient', array(IMAGE_GRAPH_GRAD_VERTICAL, 'white', 'black')); -$FillArray->addNew('gradient', array(IMAGE_GRAPH_GRAD_VERTICAL, 'white', 'brown')); - -// create the 2nd dataset -$Dataset_LineMarker =& Image_Graph::factory('random', array(8, 20, 100, false)); -// create the 2nd plot as line chart using the 2nd dataset -$Plot_LineMarker =& $Plotarea_BarAndLine->addNew('line', $Dataset_LineMarker); - -$Marker =& Image_Graph::factory('Image_Graph_Marker_Array'); -$CrossMarker =& Image_Graph::factory('Image_Graph_Marker_Cross'); -$CircleMarker =& Image_Graph::factory('Image_Graph_Marker_Circle'); -$Marker->add($CrossMarker); -$Marker->add($CircleMarker); -$Plot_LineMarker->setMarker($Marker); -// Create a red line -$CrossMarker->setLineColor('red'); -// Create a blue line -$CircleMarker->setLineColor('blue'); - -// Show arrow heads on the axis -$AxisX =& $Plotarea_BarAndLine->getAxis(IMAGE_GRAPH_AXIS_X); -$AxisY =& $Plotarea_BarAndLine->getAxis(IMAGE_GRAPH_AXIS_Y); -$AxisX->showArrow(); -$AxisY->showArrow(); - -// create an data label array for formatting label data based on an array -$ArrayData =& Image_Graph::factory('Image_Graph_DataPreprocessor_Array', - array( - array( - 1=>'A Point', - 2=>'Another', - 6=>'Yet another' - ) - ) +$Legend_SinCos->setPlotarea($Plotarea_SinCos); +$Legend_SinCos->setFontSize(8); + +$GridY_Weather =& $Plotarea_Weather->addNew( + 'line_grid', + null, + IMAGE_GRAPH_AXIS_Y ); +$GridY_Weather->setLineColor('gray@0.1'); -// use the data label array on the X axis -$AxisX->setDataPreprocessor($ArrayData); -$AxisFontX =& $Graph->addNew('Image_Graph_Font_Vertical'); -$AxisX->setFont($AxisFontX); - -$Legend_BarAndLine->setFillColor('white'); -$Legend_SmoothedLine->setFillColor('white'); - -$Font2 =& $Graph->addNew('font', 'Verdana'); -$Font2->setSize(8); -$Legend_BarAndLine->setFont($Font2); -$Legend_SmoothedLine->setFont($Font2); - -$Plot_SmoothedLine->setTitle('Oil'); -$Plot_LineMarker->setTitle('Data Set 1'); -$Plot_BarChart->setTitle('Data Set 2'); - -// create the dataset -$Dataset_Radar1 =& Image_Graph::factory('random', array(8, 1, 5)); -$Dataset_Radar2 =& Image_Graph::factory('random', array(8, 1, 5)); -// create the 1st plot as smoothed area chart using the 1st dataset -$Plot_Radar1 =& $Plotarea_Radar->addNew('Image_Graph_Plot_Radar', $Dataset_Radar1); -$Plot_Radar2 =& $Plotarea_Radar->addNew('Image_Graph_Plot_Radar', $Dataset_Radar2); +$Marker_AverageSpan =& + $Plotarea_Weather->addNew( + 'Image_Graph_Axis_Marker_Area', + IMAGE_GRAPH_AXIS_Y + ); +$Marker_AverageSpan->setFillColor('green@0.2'); +$Marker_AverageSpan->setLowerBound(3.8); +$Marker_AverageSpan->setUpperBound(11.4); + +$Marker_Average =& + $Plotarea_Weather->addNew( + 'Image_Graph_Axis_Marker_Line', + IMAGE_GRAPH_AXIS_Y + ); +$Marker_Average->setLineColor('blue@0.4'); +$Marker_Average->setValue(7.7); + +$Dataset_Rainfall =& Image_Graph::factory('dataset'); +$Dataset_Rainfall->addPoint('Jan', 60); +$Dataset_Rainfall->addPoint('Feb', 41); +$Dataset_Rainfall->addPoint('Mar', 48); +$Dataset_Rainfall->addPoint('Apr', 42); +$Dataset_Rainfall->addPoint('May', 50); +$Dataset_Rainfall->addPoint('Jun', 55); +$Dataset_Rainfall->addPoint('Jul', 67); +$Dataset_Rainfall->addPoint('Aug', 65); +$Dataset_Rainfall->addPoint('Sep', 72); +$Dataset_Rainfall->addPoint('Oct', 77); +$Dataset_Rainfall->addPoint('Nov', 80); +$Dataset_Rainfall->addPoint('Dec', 68); +$Plot_Rainfall =& + $Plotarea_Weather->addNew( + 'bar', + array(&$Dataset_Rainfall), + IMAGE_GRAPH_AXIS_Y_SECONDARY + ); +$Plot_Rainfall->setLineColor('gray'); +$Plot_Rainfall->setFillColor('yellow@0.1'); +$Plot_Rainfall->setTitle('Average rainfall'); + +$Dataset_TempAvg =& Image_Graph::factory('dataset'); +$Dataset_TempAvg->addPoint('Jan', 0.2); +$Dataset_TempAvg->addPoint('Feb', 0.1); +$Dataset_TempAvg->addPoint('Mar', 2.3); +$Dataset_TempAvg->addPoint('Apr', 5.8); +$Dataset_TempAvg->addPoint('May', 10.8); +$Dataset_TempAvg->addPoint('Jun', 14.1); +$Dataset_TempAvg->addPoint('Jul', 16.2); +$Dataset_TempAvg->addPoint('Aug', 15.9); +$Dataset_TempAvg->addPoint('Sep', 12.1); +$Dataset_TempAvg->addPoint('Oct', 8.7); +$Dataset_TempAvg->addPoint('Nov', 4.4); +$Dataset_TempAvg->addPoint('Dec', 1.8); +$Plot_TempAvg =& + $Plotarea_Weather->addNew( + 'Image_Graph_Plot_Smoothed_Line', + array(&$Dataset_TempAvg) + ); +$Plot_TempAvg->setLineColor('blue'); +$Plot_TempAvg->setTitle('Average temperature'); + +$Dataset_TempMin =& Image_Graph::factory('dataset'); +$Dataset_TempMin->addPoint('Jan', -2.7); +$Dataset_TempMin->addPoint('Feb', -2.8); +$Dataset_TempMin->addPoint('Mar', -0.9); +$Dataset_TempMin->addPoint('Apr', 1.2); +$Dataset_TempMin->addPoint('May', 5.5); +$Dataset_TempMin->addPoint('Jun', 9.2); +$Dataset_TempMin->addPoint('Jul', 11.3); +$Dataset_TempMin->addPoint('Aug', 11.1); +$Dataset_TempMin->addPoint('Sep', 7.8); +$Dataset_TempMin->addPoint('Oct', 5.0); +$Dataset_TempMin->addPoint('Nov', 1.5); +$Dataset_TempMin->addPoint('Dec', -0.9); +$Plot_TempMin =& + $Plotarea_Weather->addNew( + 'Image_Graph_Plot_Smoothed_Line', + array(&$Dataset_TempMin) + ); +$Plot_TempMin->setLineColor('teal'); +$Plot_TempMin->setTitle('Minimum temperature'); + +$Dataset_TempMax =& Image_Graph::factory('dataset'); +$Dataset_TempMax->addPoint('Jan', 2.4); +$Dataset_TempMax->addPoint('Feb', 2.5); +$Dataset_TempMax->addPoint('Mar', 5.4); +$Dataset_TempMax->addPoint('Apr', 10.5); +$Dataset_TempMax->addPoint('May', 15.8); +$Dataset_TempMax->addPoint('Jun', 18.9); +$Dataset_TempMax->addPoint('Jul', 21.2); +$Dataset_TempMax->addPoint('Aug', 20.8); +$Dataset_TempMax->addPoint('Sep', 16.3); +$Dataset_TempMax->addPoint('Oct', 11.8); +$Dataset_TempMax->addPoint('Nov', 6.9); +$Dataset_TempMax->addPoint('Dec', 4.1); +$Plot_TempMax =& + $Plotarea_Weather->addNew( + 'Image_Graph_Plot_Smoothed_Line', + array(&$Dataset_TempMax) + ); +$Plot_TempMax->setLineColor('red'); +$Plot_TempMax->setTitle('Maximum temperature'); -//$Dataset_Radar1->setMaximumY(7); - -$DataPreprocessor =& Image_Graph::factory('Image_Graph_DataPreprocessor_Array', - array( - array( - 'Irrelevance', - 'Partly', - 'Regular', - 'Relevance', - 'Something', - 'Everything', - 'Nothing', - 'Irregular' - ) - ) +$DataPreprocessor_MM =& + Image_Graph::factory('Image_Graph_DataPreprocessor_Formatted', '%d mm'); +$DataPreprocessor_DegC =& + Image_Graph::factory('Image_Graph_DataPreprocessor_Formatted', '%d C'); + +$Marker_Rainfall =& + $Plot_Rainfall->addNew('Image_Graph_Marker_Value', IMAGE_GRAPH_VALUE_Y); +$Marker_Rainfall->setDataPreprocessor($DataPreprocessor_MM); +$Marker_Rainfall->setFontSize(7); +$PointingMarker_Rainfall =& + $Plot_Rainfall->addNew( + 'Image_Graph_Marker_Pointing_Angular', + array(20, &$Marker_Rainfall) + ); +$Plot_Rainfall->setMarker($PointingMarker_Rainfall); + +$AxisY_Weather =& $Plotarea_Weather->getAxis(IMAGE_GRAPH_AXIS_Y); +$AxisY_Weather->showLabel(IMAGE_GRAPH_LABEL_ZERO); +$AxisY_Weather->setDataPreprocessor($DataPreprocessor_DegC); +$AxisY_Weather->setTitle( + 'Temperature', + array('vertical' => true, 'angle' => 90) ); -$AxisX =& $Plotarea_Radar->getAxis(IMAGE_GRAPH_AXIS_X); -$AxisX->setDataPreprocessor($DataPreprocessor); - -$AverageMarker =& Image_Graph::factory('Image_Graph_Marker_Average'); -$Plot_SmoothedLine->setMarker($AverageMarker); -$AverageMarker->setLineColor('purple'); - -// set a standard fill style -$Plot_Radar1->setFillColor('yellow@0.2'); -$Plot_Radar2->setFillColor('green@0.2'); -// output the Graph +$AxisYsecondary_Weather =& + $Plotarea_Weather->getAxis(IMAGE_GRAPH_AXIS_Y_SECONDARY); +$AxisYsecondary_Weather->setDataPreprocessor($DataPreprocessor_MM); +$AxisYsecondary_Weather->setTitle( + 'Rainfall', + array('vertical' => true, 'angle' => 270) +); +$GridX_SinCos =& + $Plotarea_SinCos->addNew('line_grid', null, IMAGE_GRAPH_AXIS_X); +$GridY_SinCos =& + $Plotarea_SinCos->addNew('line_grid', null, IMAGE_GRAPH_AXIS_Y); +$Dataset_Sin =& + Image_Graph::factory( + 'Image_Graph_Dataset_Function', + array(-2*pi(), 2*pi(), 'sin', 50) + ); +$Dataset_Cos =& + Image_Graph::factory( + 'Image_Graph_Dataset_Function', + array(-2*pi(), 2*pi(), 'cos', 50) + ); +$Plot_Sin =& $Plotarea_SinCos->addNew('line', $Dataset_Sin); +$Plot_Cos =& $Plotarea_SinCos->addNew('line', $Dataset_Cos); +$Plot_Sin->setLineColor('red'); +$Plot_Cos->setLineColor('blue'); +$Plot_Sin->setTitle('sin(x)'); +$Plot_Cos->setTitle('cos(x)'); +$AxisX_SinCos =& $Plotarea_SinCos->getAxis(IMAGE_GRAPH_AXIS_X); +$AxisX_SinCos->setLabelInterval(array(-6, -4, -2, 2, 4, 6)); +$AxisY_SinCos =& $Plotarea_SinCos->getAxis(IMAGE_GRAPH_AXIS_Y); +$AxisY_SinCos->forceMinimum(-1.1); +$AxisY_SinCos->forceMaximum(1.1); +$AxisY_SinCos->setLabelInterval(array(-1, -0.5, 0.5, 1)); + +function carLabel($value) { + return 2000+$value; +} + +$DataPreprocessor_Car =& + Image_Graph::factory('Image_Graph_DataPreprocessor_Function', 'carLabel'); + +$GridX_Car =& $Plotarea_Car->addNew('line_grid', null, IMAGE_GRAPH_AXIS_X); +$GridY_Car =& $Plotarea_Car->addNew('line_grid', null, IMAGE_GRAPH_AXIS_Y); +$GridX_Car->setLineColor('gray@0.2'); +$GridY_Car->setLineColor('gray@0.2'); +$Dataset_Car =& Image_Graph::factory('random', array(10, 10, 100, true)); +$Fill_Car =& + Image_Graph::factory('Image_Graph_Fill_Image', './images/audi-tt-coupe.jpg'); +$Plotarea_Car->setFillStyle($Fill_Car); +$Plot_Car =& + $Plotarea_Car->addNew('Image_Graph_Plot_Smoothed_Area', $Dataset_Car); +$Plot_Car->setLineColor('gray'); +$Plot_Car->setFillColor('white@0.7'); + +$AxisX_Car =& $Plotarea_Car->getAxis(IMAGE_GRAPH_AXIS_X); +$AxisX_Car->setDataPreprocessor($DataPreprocessor_Car); +$AxisX_Car->setFontSize(6); +$AxisY_Car =& $Plotarea_Car->getAxis(IMAGE_GRAPH_AXIS_Y); +$AxisY_Car->forceMaximum(100); // output the Graph $Graph->done(); http://cvs.php.net/viewcvs.cgi/pear/Image_Graph/docs/examples/frontpage_sample.php?r1=1.4&r2=1.5&diff_format=u Index: pear/Image_Graph/docs/examples/frontpage_sample.php diff -u pear/Image_Graph/docs/examples/frontpage_sample.php:1.4 pear/Image_Graph/docs/examples/frontpage_sample.php:1.5 --- pear/Image_Graph/docs/examples/frontpage_sample.php:1.4 Wed Aug 3 21:21:53 2005 +++ pear/Image_Graph/docs/examples/frontpage_sample.php Tue Feb 28 22:48:07 2006 @@ -9,7 +9,7 @@ * Grids, Axis markers, Secondary Y-axis, Datapreprocessor, Multiple plotareas, * Axis titles * - * $Id: frontpage_sample.php,v 1.4 2005/08/03 21:21:53 nosey Exp $ + * $Id: frontpage_sample.php,v 1.5 2006/02/28 22:48:07 nosey Exp $ * * @package Image_Graph * @author Jesper Veggerby <pear.nosey@veggerby.dk> @@ -277,7 +277,7 @@ // make the graph use this now instead $Graph->setCanvas($Canvas); -// 're'-output the graph, but not using the SVG canvas +// 're'-output the graph, but now using the SVG canvas $Graph->done(array('filename' => './output/frontpage_sample.svg')); /* @@ -294,7 +294,7 @@ // make the graph use this now instead $Graph->setCanvas($Canvas); -// 're'-output the graph, but not using the PDF canvas +// 're'-output the graph, but now using the PDF canvas $Graph->done(array('filename' => './output/frontpage_sample.pdf')); // create a new SWF canvas @@ -307,7 +307,7 @@ // make the graph use this now instead $Graph->setCanvas($Canvas); -// 're'-output the graph, but not using the SWF canvas +// 're'-output the graph, but now using the SWF canvas $Graph->done(array('filename' => './output/frontpage_sample.swf')); */ ?> \ No newline at end of file http://cvs.php.net/viewcvs.cgi/pear/Image_Graph/Graph/Plotarea/Radar.php?r1=1.7&r2=1.8&diff_format=u Index: pear/Image_Graph/Graph/Plotarea/Radar.php diff -u pear/Image_Graph/Graph/Plotarea/Radar.php:1.7 pear/Image_Graph/Graph/Plotarea/Radar.php:1.8 --- pear/Image_Graph/Graph/Plotarea/Radar.php:1.7 Wed Aug 24 20:36:02 2005 +++ pear/Image_Graph/Graph/Plotarea/Radar.php Tue Feb 28 22:48:07 2006 @@ -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: Radar.php,v 1.7 2005/08/24 20:36:02 nosey Exp $ + * @version CVS: $Id: Radar.php,v 1.8 2006/02/28 22:48:07 nosey Exp $ * @link http://pear.php.net/package/Image_Graph */ @@ -54,7 +54,7 @@ function Image_Graph_Plotarea_Radar() { parent::Image_Graph_Element(); - $this->_padding = 10; + $this->_padding = array('left' => 10, 'top' => 10, 'right' => 10, 'bottom' => 10); $this->_axisX =& Image_Graph::factory('Image_Graph_Axis_Radar'); $this->_axisX->_setParent($this); $this->_axisY =& Image_Graph::factory('Image_Graph_Axis', IMAGE_GRAPH_AXIS_Y); http://cvs.php.net/viewcvs.cgi/pear/Image_Graph/Graph/Plotarea/Map.php?r1=1.9&r2=1.10&diff_format=u Index: pear/Image_Graph/Graph/Plotarea/Map.php diff -u pear/Image_Graph/Graph/Plotarea/Map.php:1.9 pear/Image_Graph/Graph/Plotarea/Map.php:1.10 --- pear/Image_Graph/Graph/Plotarea/Map.php:1.9 Wed Aug 24 20:36:01 2005 +++ pear/Image_Graph/Graph/Plotarea/Map.php Tue Feb 28 22:48:07 2006 @@ -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: Map.php,v 1.9 2005/08/24 20:36:01 nosey Exp $ + * @version CVS: $Id: Map.php,v 1.10 2006/02/28 22:48:07 nosey Exp $ * @link http://pear.php.net/package/Image_Graph */ @@ -119,7 +119,7 @@ */ function _fillLeft() { - return $this->_left + $this->_padding; + return $this->_left + $this->_padding['left']; } /** @@ -130,7 +130,7 @@ */ function _fillTop() { - return $this->_top + $this->_padding; + return $this->_top + $this->_padding['top']; } /** @@ -141,7 +141,7 @@ */ function _fillRight() { - return $this->_right - $this->_padding; + return $this->_right - $this->_padding['right']; } /** @@ -152,7 +152,7 @@ */ function _fillBottom() { - return $this->_bottom - $this->_padding; + return $this->_bottom - $this->_padding['bottom']; } /** http://cvs.php.net/viewcvs.cgi/pear/Image_Graph/Graph/Marker/Value.php?r1=1.9&r2=1.10&diff_format=u Index: pear/Image_Graph/Graph/Marker/Value.php diff -u pear/Image_Graph/Graph/Marker/Value.php:1.9 pear/Image_Graph/Graph/Marker/Value.php:1.10 --- pear/Image_Graph/Graph/Marker/Value.php:1.9 Wed Aug 24 20:35:52 2005 +++ pear/Image_Graph/Graph/Marker/Value.php Tue Feb 28 22:48:07 2006 @@ -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: Value.php,v 1.9 2005/08/24 20:35:52 nosey Exp $ + * @version CVS: $Id: Value.php,v 1.10 2006/02/28 22:48:07 nosey Exp $ * @link http://pear.php.net/package/Image_Graph */ @@ -72,7 +72,7 @@ function Image_Graph_Marker_Value($useValue = IMAGE_GRAPH_VALUE_X) { parent::Image_Graph_Marker(); - $this->_padding = 2; + $this->_padding = array('left' => 2, 'top' => 2, 'right' => 2, 'bottom' => 2); $this->_useValue = $useValue; $this->_fillStyle = 'white'; $this->_borderStyle = 'black'; @@ -192,8 +192,8 @@ $width = $this->_canvas->textWidth($value); $height = $this->_canvas->textHeight($value); - $offsetX = $width/2 + $this->_padding; - $offsetY = $height/2 + $this->_padding; + $offsetX = $width/2 + $this->_padding['left']; + $offsetY = $height/2 + $this->_padding['top']; $this->_getFillStyle(); $this->_getBorderStyle(); http://cvs.php.net/viewcvs.cgi/pear/Image_Graph/package.xml?r1=1.21&r2=1.22&diff_format=u Index: pear/Image_Graph/package.xml diff -u pear/Image_Graph/package.xml:1.21 pear/Image_Graph/package.xml:1.22 --- pear/Image_Graph/package.xml:1.21 Fri Sep 30 19:27:14 2005 +++ pear/Image_Graph/package.xml Tue Feb 28 22:48:07 2006 @@ -34,30 +34,14 @@ </maintainer> </maintainers> <release> - <version>0.7.0</version> - <date>2005-09-30</date> + <version>0.7.1</version> + <date>2005-10-05</date> <license>LGPL</license> <state>alpha</state> - <notes>* Added Image_Graph_Plot_Odo (thanks Maxime Delorme) -* Added Image_Graph_DataSelector_Values (thanks Paolo) -* Added best-fit line plot (Image_Graph_Plot_Fit_Line) -* Added possibility to specify the pie plot diameter -* Modified Image_Graph_Plot_CandleStick, it is now only necessary to specify 'open' for first point (other 'open' = previous 'close') -* Changed Image_Graph_Plotarea::hideAxis() to actually hide the axis, not remove them -* Added Image_Graph_Plotarea::clearAxis() to remove the axis -* Fixed markers so that y values equal to null never shows markers -* Fixed problem in Image_Graph_Plot_BoxWhisker causing an undefined method -* Fixed problem with markers and horizontal plots -* Fixed problem with axis not showing arrow-ends even if enabled -* Fixed problem with an error "Call to a member function on a non-object..." in Common.php -* Fixed a problem with Image_Graph_Dataset_Trivial when supplying a datarray as constructor parameter and Image_Graph_Fill_Array -* Fixed Bug #5421 "Documentation for Image_Graph constructor wrong" -* Fixed Bug #5502 "Axis_Logarithmic::setAxisIntersection('max') is broken" -* Fixed Bug #5504 "PHP Notice: Undefined index: tohtml" -* Fixed PHP notice with Image_Graph::done() when using output to file -* Fixed so it is possible to use array(R, G, B, a?) as fill color -* Fixed issue with markers not rotating along with plot when using setStartingAngle() -* Fixed trivial dataset so that it is possible to use 'id' as key when populating dataset in constructor + <notes>* Fixed Bug #5415 "Axis's wrong when plot is Dot/Scatter" +* Fixed Bug #5607 "X Axis Labels align to right" +* Fixed a problem with horizontal plots and axis labels and titles not showing/aligning properly +* Fixed a problem with horizontal Step plot </notes> <deps> <dep type="pkg" rel="ge" version="1.3.1" optional="no">PEAR</dep> @@ -181,6 +165,7 @@ <provides type="class" name="Image_Graph_DataSelector_EveryNthPoint" extends="Image_Graph_DataSelector" /> <provides type="class" name="Image_Graph_DataSelector_NoZeros" extends="Image_Graph_DataSelector" /> <provides type="class" name="Image_Graph_DataSelector_Values" extends="Image_Graph_DataSelector" /> + <provides type="function" name="Image_Graph_DataSelector_Values::setValueArray" /> <provides type="class" name="Image_Graph_Dataset_Function" extends="Image_Graph_Dataset" /> <provides type="function" name="Image_Graph_Dataset_Function::addPoint" /> <provides type="class" name="Image_Graph_Dataset_Random" extends="Image_Graph_Dataset_Trivial" /> @@ -327,6 +312,9 @@ <file role="doc" baseinstalldir="Image" name="docs/examples/double_category_axis.php"> <replace type="package-info" from="@package_version@" to="version"/> </file> + <file role="doc" baseinstalldir="Image" name="docs/examples/driver_filepdf.php"> + <replace type="package-info" from="@package_version@" to="version"/> + </file> <file role="doc" baseinstalldir="Image" name="docs/examples/driver_pdf.php"> <replace type="package-info" from="@package_version@" to="version"/> </file> @@ -354,6 +342,9 @@ <file role="doc" baseinstalldir="Image" name="docs/examples/gradient_step.php"> <replace type="package-info" from="@package_version@" to="version"/> </file> + <file role="doc" baseinstalldir="Image" name="docs/examples/horizontal.php"> + <replace type="package-info" from="@package_version@" to="version"/> + </file> <file role="doc" baseinstalldir="Image" name="docs/examples/html_image_map.php"> <replace type="package-info" from="@package_version@" to="version"/> </file> @@ -1116,5 +1107,16 @@ * Fixed trivial dataset so that it is possible to use 'id' as key when populating dataset in constructor </notes> </release> + <release> + <version>0.7.1</version> + <date>2005-10-05</date> + <license>LGPL</license> + <state>alpha</state> + <notes>* Fixed Bug #5415 "Axis's wrong when plot is Dot/Scatter" +* Fixed Bug #5607 "X Axis Labels align to right" +* Fixed a problem with horizontal plots and axis labels and titles not showing/aligning properly +* Fixed a problem with horizontal Step plot + </notes> + </release> </changelog> </package> http://cvs.php.net/viewcvs.cgi/pear/Image_Graph/Graph/Layout/Horizontal.php?r1=1.10&r2=1.11&diff_format=u Index: pear/Image_Graph/Graph/Layout/Horizontal.php diff -u pear/Image_Graph/Graph/Layout/Horizontal.php:1.10 pear/Image_Graph/Graph/Layout/Horizontal.php:1.11 --- pear/Image_Graph/Graph/Layout/Horizontal.php:1.10 Wed Aug 24 20:35:58 2005 +++ pear/Image_Graph/Graph/Layout/Horizontal.php Tue Feb 28 22:48:07 2006 @@ -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: Horizontal.php,v 1.10 2005/08/24 20:35:58 nosey Exp $ + * @version CVS: $Id: Horizontal.php,v 1.11 2006/02/28 22:48:07 nosey Exp $ * @link http://pear.php.net/package/Image_Graph */ @@ -115,7 +115,7 @@ $this->_percentage = max(0, min(100, $percentage)); } $this->_split(); - $this->_padding = 0; + $this->_padding = array('left' => 0, 'top' => 0, 'right' => 0, 'bottom' => 0); } /** http://cvs.php.net/viewcvs.cgi/pear/Image_Graph/docs/examples/log_axis_forcemin.php?view=markup&rev=1.1 Index: pear/Image_Graph/docs/examples/log_axis_forcemin.php +++ pear/Image_Graph/docs/examples/log_axis_forcemin.php <?php /** * Usage example for Image_Graph. * * Main purpose: * Demonstrate logarithmic axis * * Other: * Matrix layout, Axis titles * * $Id: log_axis_forcemin.php,v 1.1 2006/02/28 22:48:07 nosey Exp $ * * @package Image_Graph * @author Jesper Veggerby <pear.nosey@veggerby.dk> */ require_once 'Image/Graph.php'; require_once 'Image/Canvas.php'; $Canvas =& Image_Canvas::factory('png', array('width' => 600, 'height' => 400, 'antialias' => true)); // create the graph $Graph =& Image_Graph::factory('graph', $Canvas); // add a TrueType font $Font =& $Graph->addNew('font', 'Verdana'); // set the font size to 15 pixels $Font->setSize(8); // add a title using the created font for ($i = 0; $i < 2; $i++) { for ($j = 0; $j < 2; $j++) { $Axis['X'][($i*2+$j)] = 'axis' . ($i % 2 == 0 ? '' : '_log'); $Axis['Y'][($i*2+$j)] = 'axis' . ($j % 2 == 0 ? '' : '_log'); } } for ($i = 0; $i < 4; $i++) { $Plotarea[$i] =& Image_Graph::factory('plotarea', array($Axis['X'][$i], $Axis['Y'][$i])); } $Graph->setFont($Font); // create the plotarea $Graph->add( Image_Graph::vertical( Image_Graph::factory('title', array('Logarithmic Axis', 11)), Image_Graph::vertical( Image_Graph::horizontal( Image_Graph::vertical( Image_Graph::factory('title', array('Normal Y-Axis', array('size' => 10, 'angle' => 90))), Image_Graph::factory('title', array('Logarithmic Y-Axis', array('size' => 10, 'angle' => 90))) ), Image_Graph::horizontal( Image_Graph::vertical( Image_Graph::factory('title', array('Normal X-Axis', 10)), Image_Graph::vertical( $Plotarea[0], $Plotarea[1] ), 7 ), Image_Graph::vertical( Image_Graph::factory('Image_Graph_Title', array('Logarithmic X-Axis', 10)), Image_Graph::vertical( $Plotarea[2], $Plotarea[3] ), 7 ) ), 4 ), $Legend = Image_Graph::factory('Image_Graph_Legend'), 92 ), 5 ) ); $Legend->setPlotarea($Plotarea[0]); $Dataset = Image_Graph::factory('dataset'); $i = 1; while ($i <= 10) { $Dataset->addPoint($i, $i*$i); $i++; } for ($i = 0; $i < 4; $i++) { $Plotarea[$i]->addNew('line_grid', false, IMAGE_GRAPH_AXIS_X); $Plotarea[$i]->addNew('line_grid', false, IMAGE_GRAPH_AXIS_Y); $Axis =& $Plotarea[$i]->getAxis(IMAGE_GRAPH_AXIS_Y); if ($i % 2 == 1) { $Axis->setLabelInterval(array(30, 45, 50, 65, 100)); } $Axis->forceMinimum(25); $Axis->forceMaximum(125); $Axis =& $Plotarea[$i]->getAxis(IMAGE_GRAPH_AXIS_X); if ($i > 1) { $Axis->setLabelInterval(array(1, 2, 3, 4, 5, 6, 8, 10)); } $Axis->forceMaximum(12); $Plot =& $Plotarea[$i]->addNew('line', array(&$Dataset)); $Plot->setLineColor('red'); $Plot->setTitle("x^2"); } $Graph->done(); ?> http://cvs.php.net/viewcvs.cgi/pear/Image_Graph/docs/examples/log_axis_low.php?view=markup&rev=1.1 Index: pear/Image_Graph/docs/examples/log_axis_low.php +++ pear/Image_Graph/docs/examples/log_axis_low.php <?php /** * Usage example for Image_Graph. * * Main purpose: * Show line chart * * Other: * None specific * * $Id: log_axis_low.php,v 1.1 2006/02/28 22:48:07 nosey Exp $ * * @package Image_Graph * @author Jesper Veggerby <pear.nosey@veggerby.dk> */ require_once 'Image/Graph.php'; // create the graph $Graph =& Image_Graph::factory('graph', array(400, 300)); // add a TrueType font $Font =& $Graph->addNew('font', 'Verdana'); // set the font size to 11 pixels $Font->setSize(10); $Graph->setFont($Font); // setup the plotarea, legend and their layout $Graph->add( Image_Graph::vertical( Image_Graph::factory('title', array('Small Values on Log Axis Chart Sample', 12)), Image_Graph::vertical( $Plotarea = Image_Graph::factory('plotarea', array('axis_log', 'axis')), $Legend = Image_Graph::factory('legend'), 88 ), 5 ) ); // link the legend with the plotares $Legend->setPlotarea($Plotarea); $Dataset =& Image_Graph::factory('dataset'); $Dataset->addPoint(0.063,5); $Dataset->addPoint(0.125,7); $Dataset->addPoint(0.25,8); $Dataset->addPoint(0.5,10); $Dataset->addPoint(1,15); $Dataset->addPoint(2,30); $Dataset->addPoint(4,45); $Dataset->addPoint(8,80); // create the plot as line chart using the dataset $Plot =& $Plotarea->addNew('line', array(&$Dataset)); // set a line color $Plot->setLineColor('red'); // output the Graph $Graph->done(); ?>