cvs: pear /Image_Graph Graph.php /Image_Graph/docs/examples complex1.php complex1b.php simple1.php simple2.php stacked1.php
| From: | Stefan Neufeind | Date: | Wed, 18 Feb 2004 01:36:56 +0000 |
| Subject: | cvs: pear /Image_Graph Graph.php /Image_Graph/docs/examples complex1.php complex1b.php simple1.php simple2.php stacked1.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-16632@lists.php.net to get a copy of this message | ||
neufeind Tue Feb 17 20:36:56 2004 EDT
Modified files:
/pear/Image_Graph Graph.php
/pear/Image_Graph/docs/examples complex1.php complex1b.php
simple1.php simple2.php
stacked1.php
Log:
in the works
http://cvs.php.net/diff.php/pear/Image_Graph/Graph.php?r1=1.28&r2=1.29&ty=u Index: pear/Image_Graph/Graph.php diff -u pear/Image_Graph/Graph.php:1.28 pear/Image_Graph/Graph.php:1.29 --- pear/Image_Graph/Graph.php:1.28 Tue Feb 17 18:07:43 2004 +++ pear/Image_Graph/Graph.php Tue Feb 17 20:36:54 2004 @@ -16,7 +16,7 @@ // | Author: Stefan Neufeind <pear.neufeind@speedpartner.de> | // +----------------------------------------------------------------------+ // -// $Id: Graph.php,v 1.28 2004/02/17 23:07:43 toby Exp $ +// $Id: Graph.php,v 1.29 2004/02/18 01:36:54 neufeind Exp $ /** * Package for drawing graphs (bars, lines, ...) @@ -725,7 +725,6 @@ $currLabel = null; } if (!empty($currLabel)) { - // @todo: remove this dirty little hack :-) we shouldn't access the lines directly, should we? if (is_string($currLabel)) { $tempText->set('text', $currLabel); } else { @@ -758,7 +757,6 @@ require_once 'Image/Text.php'; $maxWidth = 0; foreach ($this->{$currAxis}->_ticksMajorEffective as $currTick) { - // @todo: remove this dirty little hack :-) we shouldn't access the lines directly, should we? $tempText = new Image_Text(sprintf($this->{$currAxis}->_numberformat, $currTick), $this->{$currAxis}->_fontOptions); $tempText->init(); $tempText->measurize(); @@ -813,7 +811,7 @@ // draw title text if (!empty($this->diagramTitle->_text)) { require_once 'Image/Text.php'; // already done in _prepareInternalVariables() - but remember it's an require_once - $textY = $this->_pos[1] + $this->_borderspace; + $textY = $this->_pos[1] + $this->_borderspace + $this->diagramTitle->_spacer['top']; $textX = 0; $options = array_merge($this->diagramTitle->_fontOptions, array('x' => $textX, 'y' => $textY)); @@ -833,9 +831,7 @@ "g" => $this->diagramTitle->_color[1], "b" => $this->diagramTitle->_color[2])); $tempText->measurize(); - // var_dump($tempText); $tempText->render(); - //var_dump($tempText); } // draw x-axis text @@ -858,12 +854,10 @@ $tempText->set('canvas', $img); $tempText->init(); $tempText->measurize(); + $tempText->setColor(array ("r" => $this->axisX->title->_color[0], + "g" => $this->axisX->title->_color[1], + "b" => $this->axisX->title->_color[2])); - // var_dump($tempText); - - $tempText->setColor(array ("r" => $this->axisX->_color[0], - "g" => $this->axisX->_color[1], - "b" => $this->axisX->_color[2])); $tempText->render(); } @@ -886,10 +880,6 @@ } $textY = $this->_drawingareaPos[1] + ($this->_drawingareaSize[1]/2) + ($textSize['width']/2); - // BEGIN: workaround for current Image_Text v0.2 - // $textY -= ($textSize['height'] + ($this->{$currAxis}->title->_fontOptions['fontSize'] / 4)); - // END: workaround for current Image_Text v0.2 - if (is_null($this->{$currAxis}->title->_color)) { $this->{$currAxis}->title->_color = $this->{$currAxis}->_color; } @@ -959,7 +949,6 @@ $currLabel = null; } if (!empty($currLabel)) { - // @todo: remove this dirty little hack :-) we shouldn't access the lines directly, should we? if (is_string($currLabel)) { $tempText->set('text', $currLabel); } else { @@ -969,7 +958,6 @@ $tempText->set('align', IMAGE_TEXT_ALIGN_CENTER); $tempText->init(); $tempText->measurize(); - // var_dump($tempText); $textSize = $tempText->_realTextSize; $textX = $this->axisX->valueToPixelAbsolute($labelCount); @@ -984,7 +972,6 @@ $tempText->set($opts); $tempText->init(); $tempText->measurize(); - // var_dump($tempText); $tempText->render(); } } @@ -994,18 +981,18 @@ $axesXpositions = array ($this->_drawingareaPos[0], $this->_drawingareaPos[0]+$this->_drawingareaSize[0]-1); - $axesXfactors = array (1, -1); - for ($axisCount=0; $axisCount<=1; $axisCount++) { $currAxis = "axisY".$axisCount; if ($this->{$currAxis}->_containsData) { imageline ($img, $axesXpositions[$axisCount], $this->_drawingareaPos[1]+$this->_drawingareaSize[1]-1, $axesXpositions[$axisCount], $this->_drawingareaPos[1], $drawColor); + $tickSize = $this->{$currAxis}->_tickSize; + $this->{$currAxis}->_internalTempValues['tickSize'] = $tickSize; + foreach ($this->{$currAxis}->_ticksMajorEffective as $currTick) { $relativeYPosition = $this->{$currAxis}->valueToPixelRelative($currTick); - $tickSize = $this->{$currAxis}->_tickSize * $axesXfactors[$axisCount]; switch ($this->{$currAxis}->_tickStyle) { case IMAGE_GRAPH_TICKS_INSIDE: imageline ($img, $axesXpositions[$axisCount] , $this->_drawingareaPos[1]+$relativeYPosition, @@ -1025,9 +1012,10 @@ } } + $tickSize = ceil($this->{$currAxis}->_tickSize/2); foreach ($this->{$currAxis}->_ticksMinorEffective as $currTick) { $relativeYPosition = $this->{$currAxis}->valueToPixelRelative($currTick); - $tickSize = ceil($this->{$currAxis}->_tickSize/2) * $axesXfactors[$axisCount]; + switch ($this->{$currAxis}->_tickStyle) { case IMAGE_GRAPH_TICKS_INSIDE: imageline ($img, $axesXpositions[$axisCount] , $this->_drawingareaPos[1]+$relativeYPosition, @@ -1060,13 +1048,21 @@ $tempText = new Image_Text("", $textoptions); if ($axisCount == 0) { // axis 0 (left axis) - $textX = $this->_pos[0] + $this->_borderspace + $this->{$currAxis}->_internalTempValues['totalTitleWidth']; + $textX = $this->_drawingareaPos[0] + - $this->{$currAxis}->_internalTempValues['maxNumWidth']; + if (($this->{$currAxis}->_tickStyle == IMAGE_GRAPH_TICKS_OUTSIDE) || + ($this->{$currAxis}->_tickStyle == IMAGE_GRAPH_TICKS_BOTH)) { + $textX -= $this->{$currAxis}->_internalTempValues['tickSize']; + } } else { // axis 1 (right axis) - $textX = $this->_pos[0] + $this->_size[0] - $this->_borderspace - $this->{$currAxis}->_internalTempValues['maxNumWidth'] - $this->{$currAxis}->_internalTempValues['totalTitleWidth']; + $textX = $this->_drawingareaPos[0] + $this->_drawingareaSize[0]; + if (($this->{$currAxis}->_tickStyle == IMAGE_GRAPH_TICKS_OUTSIDE) || + ($this->{$currAxis}->_tickStyle == IMAGE_GRAPH_TICKS_BOTH)) { + $textX += $this->{$currAxis}->_internalTempValues['tickSize']; + } } foreach ($this->{$currAxis}->_ticksMajorEffective as $currTick) { - // @todo: remove this dirty little hack :-) we shouldn't access the lines directly, should we? $tempText->set('text', sprintf($this->{$currAxis}->_numberformat, $currTick)); $tempText->set('align', IMAGE_TEXT_ALIGN_LEFT); $tempText->set('canvas', $img); @@ -1075,9 +1071,6 @@ $textSize = $tempText->_realTextSize; $relativeYPosition = $this->{$currAxis}->valueToPixelRelative($currTick); $textY = $this->_drawingareaPos[1]+$relativeYPosition - ($textSize['height']/2); - // BEGIN: workaround for current Image_Text v0.2 - // $textY -= ($this->{$currAxis}->_fontOptions['fontSize'] / 4); - // END: workaround for current Image_Text v0.2 if (is_null($this->{$currAxis}->_numbercolor)) { $this->{$currAxis}->_numbercolor = $this->{$currAxis}->_color; http://cvs.php.net/diff.php/pear/Image_Graph/docs/examples/complex1.php?r1=1.8&r2=1.9&ty=u Index: pear/Image_Graph/docs/examples/complex1.php diff -u pear/Image_Graph/docs/examples/complex1.php:1.8 pear/Image_Graph/docs/examples/complex1.php:1.9 --- pear/Image_Graph/docs/examples/complex1.php:1.8 Fri Feb 13 14:59:10 2004 +++ pear/Image_Graph/docs/examples/complex1.php Tue Feb 17 20:36:55 2004 @@ -1,5 +1,5 @@ <?php -// $Id: complex1.php,v 1.8 2004/02/13 19:59:10 neufeind Exp $ +// $Id: complex1.php,v 1.9 2004/02/18 01:36:55 neufeind Exp $ /** * Example for using the Image_Graph-class * @@ -9,15 +9,16 @@ require_once("Image/Graph.php"); - $graph = new Image_Graph (400, 200); - $graph->setBackgroundColor (array(0x59, 0x59, 0x59)); - $graph->setSpaceFromBorder (5); // 5 pixels from each border - $graph->setDefaultFontOptions (array("fontType" => "ttf", - "fontPath" => "", - "fontFile" => "arial", - "antiAliasing" => true, - "fontSize" => 10, - "color" => array(0,0,0) )); + $graph = new Image_Graph(400, 200); + $graph->setBackgroundColor(array(0x59, 0x59, 0x59)); + $graph->setSpaceFromBorder(5); // 5 pixels from each border + $graph->setDefaultFontOptions(array("font_type" => "ttf", + "font_path" => "/usr/share/fonts/truetype/", + "font_file" => "arial.ttf", + "anti_aliasing" => true, + "font_size" => 10, + "color" => array(0,0,0) + )); $graph->diagramTitle->setColor (array(0xBF,0xBF,0xBF)); $graph->diagramTitle->setSpacer (array("bottom" => 10)); @@ -37,8 +38,8 @@ $graph->axisY0->title->setColor (array(0xCC,0x29,0x29)); $graph->axisY1->title->setColor (array(0x29,0xCC,0x29)); - $graph->axisY0->title->setFontOptions (array("fontSize" => 8)); - $graph->axisY1->title->setFontOptions (array("fontSize" => 8)); + $graph->axisY0->title->setFontOptions (array("font_size" => 8)); + $graph->axisY1->title->setFontOptions (array("font_size" => 8)); $graph->setAxesColor(array(0x40, 0x40, 0xFF)); http://cvs.php.net/diff.php/pear/Image_Graph/docs/examples/complex1b.php?r1=1.3&r2=1.4&ty=u Index: pear/Image_Graph/docs/examples/complex1b.php diff -u pear/Image_Graph/docs/examples/complex1b.php:1.3 pear/Image_Graph/docs/examples/complex1b.php:1.4 --- pear/Image_Graph/docs/examples/complex1b.php:1.3 Sun Feb 15 16:38:47 2004 +++ pear/Image_Graph/docs/examples/complex1b.php Tue Feb 17 20:36:55 2004 @@ -1,5 +1,5 @@ <?php -// $Id: complex1b.php,v 1.3 2004/02/15 21:38:47 toby Exp $ +// $Id: complex1b.php,v 1.4 2004/02/18 01:36:55 neufeind Exp $ /** * Example for using the Image_Graph-class * @@ -10,14 +10,15 @@ require_once("Image/Graph.php"); $graph = new Image_Graph (400, 200); - $graph->setBackgroundColor (array(0x59, 0x59, 0x59)); - $graph->setSpaceFromBorder (5); // 5 pixels from each border - $graph->setDefaultFontOptions (array("fontType" => "ttf", - "fontPath" => "", - "fontFile" => "arial", - "antiAliasing" => true, - "fontSize" => 10, - "color" => array(0,0,0) )); + $graph->setBackgroundColor(array(0x59, 0x59, 0x59)); + $graph->setSpaceFromBorder(5); // 5 pixels from each border + $graph->setDefaultFontOptions(array("font_type" => "ttf", + "font_path" => "/usr/share/fonts/truetype/", + "font_file" => "arial.ttf", + "anti_aliasing" => true, + "font_size" => 10, + "color" => array(0,0,0) + )); $graph->diagramTitle->setColor (array(0xBF,0xBF,0xBF)); $graph->diagramTitle->setSpacer (array("bottom" => 10)); @@ -37,8 +38,8 @@ $graph->axisY0->title->setColor (array(0xCC,0x29,0x29)); $graph->axisY1->title->setColor (array(0x29,0xCC,0x29)); - $graph->axisY0->title->setFontOptions (array("fontSize" => 8)); - $graph->axisY1->title->setFontOptions (array("fontSize" => 8)); + $graph->axisY0->title->setFontOptions (array("font_size" => 8)); + $graph->axisY1->title->setFontOptions (array("font_size" => 8)); $graph->gridY0->setFillType(IMAGE_GRAPH_GRID_MINOR); http://cvs.php.net/diff.php/pear/Image_Graph/docs/examples/simple1.php?r1=1.8&r2=1.9&ty=u Index: pear/Image_Graph/docs/examples/simple1.php diff -u pear/Image_Graph/docs/examples/simple1.php:1.8 pear/Image_Graph/docs/examples/simple1.php:1.9 --- pear/Image_Graph/docs/examples/simple1.php:1.8 Sun Feb 15 16:38:47 2004 +++ pear/Image_Graph/docs/examples/simple1.php Tue Feb 17 20:36:55 2004 @@ -1,5 +1,5 @@ <?php -// $Id: simple1.php,v 1.8 2004/02/15 21:38:47 toby Exp $ +// $Id: simple1.php,v 1.9 2004/02/18 01:36:55 neufeind Exp $ /** * Example for using the Image_Graph-class * @@ -11,12 +11,13 @@ $graph = new Image_Graph (400, 200); $graph->setBackgroundColor(array(200, 200, 200)); - $graph->setDefaultFontOptions(array("fontType" => "ttf", - "fontPath" => "", - "fontFile" => "arial", - "antiAliasing" => true, - "fontSize" => 10, - "color" => array(0,0,0) )); + $graph->setDefaultFontOptions(array("font_type" => "ttf", + "font_path" => "/usr/share/fonts/truetype/", + "font_file" => "arial.ttf", + "anti_aliasing" => true, + "font_size" => 10, + "color" => array(0,0,0) + )); $graph->diagramTitle->setText("Downloads June 2003"); http://cvs.php.net/diff.php/pear/Image_Graph/docs/examples/simple2.php?r1=1.5&r2=1.6&ty=u Index: pear/Image_Graph/docs/examples/simple2.php diff -u pear/Image_Graph/docs/examples/simple2.php:1.5 pear/Image_Graph/docs/examples/simple2.php:1.6 --- pear/Image_Graph/docs/examples/simple2.php:1.5 Sun Feb 15 16:38:47 2004 +++ pear/Image_Graph/docs/examples/simple2.php Tue Feb 17 20:36:55 2004 @@ -1,5 +1,5 @@ <?php -// $Id: simple2.php,v 1.5 2004/02/15 21:38:47 toby Exp $ +// $Id: simple2.php,v 1.6 2004/02/18 01:36:55 neufeind Exp $ /** * Example for using the Image_Graph-class * @@ -11,12 +11,13 @@ $graph = new Image_Graph (400, 200); $graph->setBackgroundColor(array(200, 200, 200)); - $graph->setDefaultFontOptions(array("fontType" => "ttf", - "fontPath" => "", - "fontFile" => "arial", - "antiAliasing" => true, - "fontSize" => 10, - "color" => array(0,0,0) )); + $graph->setDefaultFontOptions(array("font_type" => "ttf", + "font_path" => "/usr/share/fonts/truetype/", + "font_file" => "arial.ttf", + "anti_aliasing" => true, + "font_size" => 10, + "color" => array(0,0,0) + )); $graph->diagramTitle->setText("Downloads June 2003"); http://cvs.php.net/diff.php/pear/Image_Graph/docs/examples/stacked1.php?r1=1.10&r2=1.11&ty=u Index: pear/Image_Graph/docs/examples/stacked1.php diff -u pear/Image_Graph/docs/examples/stacked1.php:1.10 pear/Image_Graph/docs/examples/stacked1.php:1.11 --- pear/Image_Graph/docs/examples/stacked1.php:1.10 Sun Feb 15 16:38:47 2004 +++ pear/Image_Graph/docs/examples/stacked1.php Tue Feb 17 20:36:55 2004 @@ -1,5 +1,5 @@ <?php -// $Id: stacked1.php,v 1.10 2004/02/15 21:38:47 toby Exp $ +// $Id: stacked1.php,v 1.11 2004/02/18 01:36:55 neufeind Exp $ /** * Example for using the Image_Graph-class * @@ -12,12 +12,13 @@ $graph = new Image_Graph (400, 200); $graph->setBackgroundColor (array(0x59, 0x59, 0x59)); $graph->setSpaceFromBorder (5); // 5 pixels from each border - $graph->setDefaultFontOptions (array("fontType" => "ttf", - "fontPath" => "", - "fontFile" => "arial", - "antiAliasing" => true, - "fontSize" => 10, - "color" => array(0,0,0) )); + $graph->setDefaultFontOptions(array("font_type" => "ttf", + "font_path" => "/usr/share/fonts/truetype/", + "font_file" => "arial.ttf", + "anti_aliasing" => true, + "font_size" => 10, + "color" => array(0,0,0) + )); $graph->diagramTitle->setColor (array(0xBF,0xBF,0xBF)); $graph->diagramTitle->setSpacer (array("bottom" => 10));
http://cvs.php.net/diff.php/pear/Image_Graph/Graph.php?r1=1.28&r2=1.29&ty=u Index: pear/Image_Graph/Graph.php diff -u pear/Image_Graph/Graph.php:1.28 pear/Image_Graph/Graph.php:1.29 --- pear/Image_Graph/Graph.php:1.28 Tue Feb 17 18:07:43 2004 +++ pear/Image_Graph/Graph.php Tue Feb 17 20:36:54 2004 @@ -16,7 +16,7 @@ // | Author: Stefan Neufeind <pear.neufeind@speedpartner.de> | // +----------------------------------------------------------------------+ // -// $Id: Graph.php,v 1.28 2004/02/17 23:07:43 toby Exp $ +// $Id: Graph.php,v 1.29 2004/02/18 01:36:54 neufeind Exp $ /** * Package for drawing graphs (bars, lines, ...) @@ -725,7 +725,6 @@ $currLabel = null; } if (!empty($currLabel)) { - // @todo: remove this dirty little hack :-) we shouldn't access the lines directly, should we? if (is_string($currLabel)) { $tempText->set('text', $currLabel); } else { @@ -758,7 +757,6 @@ require_once 'Image/Text.php'; $maxWidth = 0; foreach ($this->{$currAxis}->_ticksMajorEffective as $currTick) { - // @todo: remove this dirty little hack :-) we shouldn't access the lines directly, should we? $tempText = new Image_Text(sprintf($this->{$currAxis}->_numberformat, $currTick), $this->{$currAxis}->_fontOptions); $tempText->init(); $tempText->measurize(); @@ -813,7 +811,7 @@ // draw title text if (!empty($this->diagramTitle->_text)) { require_once 'Image/Text.php'; // already done in _prepareInternalVariables() - but remember it's an require_once - $textY = $this->_pos[1] + $this->_borderspace; + $textY = $this->_pos[1] + $this->_borderspace + $this->diagramTitle->_spacer['top']; $textX = 0; $options = array_merge($this->diagramTitle->_fontOptions, array('x' => $textX, 'y' => $textY)); @@ -833,9 +831,7 @@ "g" => $this->diagramTitle->_color[1], "b" => $this->diagramTitle->_color[2])); $tempText->measurize(); - // var_dump($tempText); $tempText->render(); - //var_dump($tempText); } // draw x-axis text @@ -858,12 +854,10 @@ $tempText->set('canvas', $img); $tempText->init(); $tempText->measurize(); + $tempText->setColor(array ("r" => $this->axisX->title->_color[0], + "g" => $this->axisX->title->_color[1], + "b" => $this->axisX->title->_color[2])); - // var_dump($tempText); - - $tempText->setColor(array ("r" => $this->axisX->_color[0], - "g" => $this->axisX->_color[1], - "b" => $this->axisX->_color[2])); $tempText->render(); } @@ -886,10 +880,6 @@ } $textY = $this->_drawingareaPos[1] + ($this->_drawingareaSize[1]/2) + ($textSize['width']/2); - // BEGIN: workaround for current Image_Text v0.2 - // $textY -= ($textSize['height'] + ($this->{$currAxis}->title->_fontOptions['fontSize'] / 4)); - // END: workaround for current Image_Text v0.2 - if (is_null($this->{$currAxis}->title->_color)) { $this->{$currAxis}->title->_color = $this->{$currAxis}->_color; } @@ -959,7 +949,6 @@ $currLabel = null; } if (!empty($currLabel)) { - // @todo: remove this dirty little hack :-) we shouldn't access the lines directly, should we? if (is_string($currLabel)) { $tempText->set('text', $currLabel); } else { @@ -969,7 +958,6 @@ $tempText->set('align', IMAGE_TEXT_ALIGN_CENTER); $tempText->init(); $tempText->measurize(); - // var_dump($tempText); $textSize = $tempText->_realTextSize; $textX = $this->axisX->valueToPixelAbsolute($labelCount); @@ -984,7 +972,6 @@ $tempText->set($opts); $tempText->init(); $tempText->measurize(); - // var_dump($tempText); $tempText->render(); } } @@ -994,18 +981,18 @@ $axesXpositions = array ($this->_drawingareaPos[0], $this->_drawingareaPos[0]+$this->_drawingareaSize[0]-1); - $axesXfactors = array (1, -1); - for ($axisCount=0; $axisCount<=1; $axisCount++) { $currAxis = "axisY".$axisCount; if ($this->{$currAxis}->_containsData) { imageline ($img, $axesXpositions[$axisCount], $this->_drawingareaPos[1]+$this->_drawingareaSize[1]-1, $axesXpositions[$axisCount], $this->_drawingareaPos[1], $drawColor); + $tickSize = $this->{$currAxis}->_tickSize; + $this->{$currAxis}->_internalTempValues['tickSize'] = $tickSize; + foreach ($this->{$currAxis}->_ticksMajorEffective as $currTick) { $relativeYPosition = $this->{$currAxis}->valueToPixelRelative($currTick); - $tickSize = $this->{$currAxis}->_tickSize * $axesXfactors[$axisCount]; switch ($this->{$currAxis}->_tickStyle) { case IMAGE_GRAPH_TICKS_INSIDE: imageline ($img, $axesXpositions[$axisCount] , $this->_drawingareaPos[1]+$relativeYPosition, @@ -1025,9 +1012,10 @@ } } + $tickSize = ceil($this->{$currAxis}->_tickSize/2); foreach ($this->{$currAxis}->_ticksMinorEffective as $currTick) { $relativeYPosition = $this->{$currAxis}->valueToPixelRelative($currTick); - $tickSize = ceil($this->{$currAxis}->_tickSize/2) * $axesXfactors[$axisCount]; + switch ($this->{$currAxis}->_tickStyle) { case IMAGE_GRAPH_TICKS_INSIDE: imageline ($img, $axesXpositions[$axisCount] , $this->_drawingareaPos[1]+$relativeYPosition, @@ -1060,13 +1048,21 @@ $tempText = new Image_Text("", $textoptions); if ($axisCount == 0) { // axis 0 (left axis) - $textX = $this->_pos[0] + $this->_borderspace + $this->{$currAxis}->_internalTempValues['totalTitleWidth']; + $textX = $this->_drawingareaPos[0] + - $this->{$currAxis}->_internalTempValues['maxNumWidth']; + if (($this->{$currAxis}->_tickStyle == IMAGE_GRAPH_TICKS_OUTSIDE) || + ($this->{$currAxis}->_tickStyle == IMAGE_GRAPH_TICKS_BOTH)) { + $textX -= $this->{$currAxis}->_internalTempValues['tickSize']; + } } else { // axis 1 (right axis) - $textX = $this->_pos[0] + $this->_size[0] - $this->_borderspace - $this->{$currAxis}->_internalTempValues['maxNumWidth'] - $this->{$currAxis}->_internalTempValues['totalTitleWidth']; + $textX = $this->_drawingareaPos[0] + $this->_drawingareaSize[0]; + if (($this->{$currAxis}->_tickStyle == IMAGE_GRAPH_TICKS_OUTSIDE) || + ($this->{$currAxis}->_tickStyle == IMAGE_GRAPH_TICKS_BOTH)) { + $textX += $this->{$currAxis}->_internalTempValues['tickSize']; + } } foreach ($this->{$currAxis}->_ticksMajorEffective as $currTick) { - // @todo: remove this dirty little hack :-) we shouldn't access the lines directly, should we? $tempText->set('text', sprintf($this->{$currAxis}->_numberformat, $currTick)); $tempText->set('align', IMAGE_TEXT_ALIGN_LEFT); $tempText->set('canvas', $img); @@ -1075,9 +1071,6 @@ $textSize = $tempText->_realTextSize; $relativeYPosition = $this->{$currAxis}->valueToPixelRelative($currTick); $textY = $this->_drawingareaPos[1]+$relativeYPosition - ($textSize['height']/2); - // BEGIN: workaround for current Image_Text v0.2 - // $textY -= ($this->{$currAxis}->_fontOptions['fontSize'] / 4); - // END: workaround for current Image_Text v0.2 if (is_null($this->{$currAxis}->_numbercolor)) { $this->{$currAxis}->_numbercolor = $this->{$currAxis}->_color; http://cvs.php.net/diff.php/pear/Image_Graph/docs/examples/complex1.php?r1=1.8&r2=1.9&ty=u Index: pear/Image_Graph/docs/examples/complex1.php diff -u pear/Image_Graph/docs/examples/complex1.php:1.8 pear/Image_Graph/docs/examples/complex1.php:1.9 --- pear/Image_Graph/docs/examples/complex1.php:1.8 Fri Feb 13 14:59:10 2004 +++ pear/Image_Graph/docs/examples/complex1.php Tue Feb 17 20:36:55 2004 @@ -1,5 +1,5 @@ <?php -// $Id: complex1.php,v 1.8 2004/02/13 19:59:10 neufeind Exp $ +// $Id: complex1.php,v 1.9 2004/02/18 01:36:55 neufeind Exp $ /** * Example for using the Image_Graph-class * @@ -9,15 +9,16 @@ require_once("Image/Graph.php"); - $graph = new Image_Graph (400, 200); - $graph->setBackgroundColor (array(0x59, 0x59, 0x59)); - $graph->setSpaceFromBorder (5); // 5 pixels from each border - $graph->setDefaultFontOptions (array("fontType" => "ttf", - "fontPath" => "", - "fontFile" => "arial", - "antiAliasing" => true, - "fontSize" => 10, - "color" => array(0,0,0) )); + $graph = new Image_Graph(400, 200); + $graph->setBackgroundColor(array(0x59, 0x59, 0x59)); + $graph->setSpaceFromBorder(5); // 5 pixels from each border + $graph->setDefaultFontOptions(array("font_type" => "ttf", + "font_path" => "/usr/share/fonts/truetype/", + "font_file" => "arial.ttf", + "anti_aliasing" => true, + "font_size" => 10, + "color" => array(0,0,0) + )); $graph->diagramTitle->setColor (array(0xBF,0xBF,0xBF)); $graph->diagramTitle->setSpacer (array("bottom" => 10)); @@ -37,8 +38,8 @@ $graph->axisY0->title->setColor (array(0xCC,0x29,0x29)); $graph->axisY1->title->setColor (array(0x29,0xCC,0x29)); - $graph->axisY0->title->setFontOptions (array("fontSize" => 8)); - $graph->axisY1->title->setFontOptions (array("fontSize" => 8)); + $graph->axisY0->title->setFontOptions (array("font_size" => 8)); + $graph->axisY1->title->setFontOptions (array("font_size" => 8)); $graph->setAxesColor(array(0x40, 0x40, 0xFF)); http://cvs.php.net/diff.php/pear/Image_Graph/docs/examples/complex1b.php?r1=1.3&r2=1.4&ty=u Index: pear/Image_Graph/docs/examples/complex1b.php diff -u pear/Image_Graph/docs/examples/complex1b.php:1.3 pear/Image_Graph/docs/examples/complex1b.php:1.4 --- pear/Image_Graph/docs/examples/complex1b.php:1.3 Sun Feb 15 16:38:47 2004 +++ pear/Image_Graph/docs/examples/complex1b.php Tue Feb 17 20:36:55 2004 @@ -1,5 +1,5 @@ <?php -// $Id: complex1b.php,v 1.3 2004/02/15 21:38:47 toby Exp $ +// $Id: complex1b.php,v 1.4 2004/02/18 01:36:55 neufeind Exp $ /** * Example for using the Image_Graph-class * @@ -10,14 +10,15 @@ require_once("Image/Graph.php"); $graph = new Image_Graph (400, 200); - $graph->setBackgroundColor (array(0x59, 0x59, 0x59)); - $graph->setSpaceFromBorder (5); // 5 pixels from each border - $graph->setDefaultFontOptions (array("fontType" => "ttf", - "fontPath" => "", - "fontFile" => "arial", - "antiAliasing" => true, - "fontSize" => 10, - "color" => array(0,0,0) )); + $graph->setBackgroundColor(array(0x59, 0x59, 0x59)); + $graph->setSpaceFromBorder(5); // 5 pixels from each border + $graph->setDefaultFontOptions(array("font_type" => "ttf", + "font_path" => "/usr/share/fonts/truetype/", + "font_file" => "arial.ttf", + "anti_aliasing" => true, + "font_size" => 10, + "color" => array(0,0,0) + )); $graph->diagramTitle->setColor (array(0xBF,0xBF,0xBF)); $graph->diagramTitle->setSpacer (array("bottom" => 10)); @@ -37,8 +38,8 @@ $graph->axisY0->title->setColor (array(0xCC,0x29,0x29)); $graph->axisY1->title->setColor (array(0x29,0xCC,0x29)); - $graph->axisY0->title->setFontOptions (array("fontSize" => 8)); - $graph->axisY1->title->setFontOptions (array("fontSize" => 8)); + $graph->axisY0->title->setFontOptions (array("font_size" => 8)); + $graph->axisY1->title->setFontOptions (array("font_size" => 8)); $graph->gridY0->setFillType(IMAGE_GRAPH_GRID_MINOR); http://cvs.php.net/diff.php/pear/Image_Graph/docs/examples/simple1.php?r1=1.8&r2=1.9&ty=u Index: pear/Image_Graph/docs/examples/simple1.php diff -u pear/Image_Graph/docs/examples/simple1.php:1.8 pear/Image_Graph/docs/examples/simple1.php:1.9 --- pear/Image_Graph/docs/examples/simple1.php:1.8 Sun Feb 15 16:38:47 2004 +++ pear/Image_Graph/docs/examples/simple1.php Tue Feb 17 20:36:55 2004 @@ -1,5 +1,5 @@ <?php -// $Id: simple1.php,v 1.8 2004/02/15 21:38:47 toby Exp $ +// $Id: simple1.php,v 1.9 2004/02/18 01:36:55 neufeind Exp $ /** * Example for using the Image_Graph-class * @@ -11,12 +11,13 @@ $graph = new Image_Graph (400, 200); $graph->setBackgroundColor(array(200, 200, 200)); - $graph->setDefaultFontOptions(array("fontType" => "ttf", - "fontPath" => "", - "fontFile" => "arial", - "antiAliasing" => true, - "fontSize" => 10, - "color" => array(0,0,0) )); + $graph->setDefaultFontOptions(array("font_type" => "ttf", + "font_path" => "/usr/share/fonts/truetype/", + "font_file" => "arial.ttf", + "anti_aliasing" => true, + "font_size" => 10, + "color" => array(0,0,0) + )); $graph->diagramTitle->setText("Downloads June 2003"); http://cvs.php.net/diff.php/pear/Image_Graph/docs/examples/simple2.php?r1=1.5&r2=1.6&ty=u Index: pear/Image_Graph/docs/examples/simple2.php diff -u pear/Image_Graph/docs/examples/simple2.php:1.5 pear/Image_Graph/docs/examples/simple2.php:1.6 --- pear/Image_Graph/docs/examples/simple2.php:1.5 Sun Feb 15 16:38:47 2004 +++ pear/Image_Graph/docs/examples/simple2.php Tue Feb 17 20:36:55 2004 @@ -1,5 +1,5 @@ <?php -// $Id: simple2.php,v 1.5 2004/02/15 21:38:47 toby Exp $ +// $Id: simple2.php,v 1.6 2004/02/18 01:36:55 neufeind Exp $ /** * Example for using the Image_Graph-class * @@ -11,12 +11,13 @@ $graph = new Image_Graph (400, 200); $graph->setBackgroundColor(array(200, 200, 200)); - $graph->setDefaultFontOptions(array("fontType" => "ttf", - "fontPath" => "", - "fontFile" => "arial", - "antiAliasing" => true, - "fontSize" => 10, - "color" => array(0,0,0) )); + $graph->setDefaultFontOptions(array("font_type" => "ttf", + "font_path" => "/usr/share/fonts/truetype/", + "font_file" => "arial.ttf", + "anti_aliasing" => true, + "font_size" => 10, + "color" => array(0,0,0) + )); $graph->diagramTitle->setText("Downloads June 2003"); http://cvs.php.net/diff.php/pear/Image_Graph/docs/examples/stacked1.php?r1=1.10&r2=1.11&ty=u Index: pear/Image_Graph/docs/examples/stacked1.php diff -u pear/Image_Graph/docs/examples/stacked1.php:1.10 pear/Image_Graph/docs/examples/stacked1.php:1.11 --- pear/Image_Graph/docs/examples/stacked1.php:1.10 Sun Feb 15 16:38:47 2004 +++ pear/Image_Graph/docs/examples/stacked1.php Tue Feb 17 20:36:55 2004 @@ -1,5 +1,5 @@ <?php -// $Id: stacked1.php,v 1.10 2004/02/15 21:38:47 toby Exp $ +// $Id: stacked1.php,v 1.11 2004/02/18 01:36:55 neufeind Exp $ /** * Example for using the Image_Graph-class * @@ -12,12 +12,13 @@ $graph = new Image_Graph (400, 200); $graph->setBackgroundColor (array(0x59, 0x59, 0x59)); $graph->setSpaceFromBorder (5); // 5 pixels from each border - $graph->setDefaultFontOptions (array("fontType" => "ttf", - "fontPath" => "", - "fontFile" => "arial", - "antiAliasing" => true, - "fontSize" => 10, - "color" => array(0,0,0) )); + $graph->setDefaultFontOptions(array("font_type" => "ttf", + "font_path" => "/usr/share/fonts/truetype/", + "font_file" => "arial.ttf", + "anti_aliasing" => true, + "font_size" => 10, + "color" => array(0,0,0) + )); $graph->diagramTitle->setColor (array(0xBF,0xBF,0xBF)); $graph->diagramTitle->setSpacer (array("bottom" => 10));