diff options
author | Kore Nordmann <github@kore-nordmann.de> | 2007-05-10 06:58:33 +0000 |
---|---|---|
committer | Kore Nordmann <github@kore-nordmann.de> | 2007-05-10 06:58:33 +0000 |
commit | 98ff576c569c8a9c82d56fd22916d61f540c2cb9 (patch) | |
tree | 05b01bed0cf28327880c444c0b30e1e3dba9dd7a | |
parent | 9e5906b3523afbfce28cb94d001967b195b4d55d (diff) | |
download | zetacomponents-graph-98ff576c569c8a9c82d56fd22916d61f540c2cb9.zip zetacomponents-graph-98ff576c569c8a9c82d56fd22916d61f540c2cb9.tar.gz |
- Fixed issue #10745 (BaxedAxisLabelRenderer wrong label positions for angles:
(135 <= $angle <= 325)
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | src/renderer/axis_label_boxed.php | 63 |
2 files changed, 45 insertions, 20 deletions
@@ -7,6 +7,8 @@ second last value if showLastValue is disabled - Fixed issue #10747: axisLabelRotatedRenderer accesses unitialised variables for Angles % 90 != 0 +- Fixed issue #10745 (BaxedAxisLabelRenderer wrong label positions for angles: + (135 <= $angle <= 325) 1.1beta1 - [RELEASEDATE] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/renderer/axis_label_boxed.php b/src/renderer/axis_label_boxed.php index dfa6a9f..d587f58 100644 --- a/src/renderer/axis_label_boxed.php +++ b/src/renderer/axis_label_boxed.php @@ -124,27 +124,50 @@ class ezcGraphAxisBoxedLabelRenderer extends ezcGraphAxisLabelRenderer if ( $this->showLabels ) { // Calculate label boundings - if ( abs( $this->direction->x ) > abs( $this->direction->y ) ) + switch ( true ) { - $labelBoundings = new ezcGraphBoundings( - $position->x - $stepSize->x + $this->labelPadding, - $position->y + $this->labelPadding, - $position->x + - $this->labelPadding, - $position->y + $renderer->yAxisSpace - $this->labelPadding - ); - - $alignement = ezcGraph::CENTER | ezcGraph::TOP; - } - else - { - $labelBoundings = new ezcGraphBoundings( - $position->x - $renderer->xAxisSpace + $this->labelPadding, - $position->y - $stepSize->y + $this->labelPadding, - $position->x - $this->labelPadding, - $position->y - $this->labelPadding - ); - - $alignement = ezcGraph::MIDDLE | ezcGraph::RIGHT; + case ( abs( $this->direction->x ) > abs( $this->direction->y ) ) && + ( $this->direction->x <= 0 ): + $labelBoundings = new ezcGraphBoundings( + $position->x - $stepSize->x + $this->labelPadding, + $position->y + $this->labelPadding, + $position->x - $this->labelPadding, + $position->y + $renderer->yAxisSpace - $this->labelPadding + ); + + $alignement = ezcGraph::CENTER | ezcGraph::TOP; + break; + case ( abs( $this->direction->x ) > abs( $this->direction->y ) ) && + ( $this->direction->x > 0 ): + $labelBoundings = new ezcGraphBoundings( + $position->x + $this->labelPadding, + $position->y + $this->labelPadding, + $position->x + $stepSize->x - $this->labelPadding, + $position->y + $renderer->yAxisSpace - $this->labelPadding + ); + + $alignement = ezcGraph::CENTER | ezcGraph::TOP; + break; + case ( $this->direction->y <= 0 ): + $labelBoundings = new ezcGraphBoundings( + $position->x - $renderer->xAxisSpace + $this->labelPadding, + $position->y - $stepSize->y + $this->labelPadding, + $position->x - $this->labelPadding, + $position->y - $this->labelPadding + ); + + $alignement = ezcGraph::MIDDLE | ezcGraph::RIGHT; + break; + case ( $this->direction->y > 0 ): + $labelBoundings = new ezcGraphBoundings( + $position->x - $renderer->xAxisSpace + $this->labelPadding, + $position->y + $this->labelPadding, + $position->x - $this->labelPadding, + $position->y + $stepSize->y - $this->labelPadding + ); + + $alignement = ezcGraph::MIDDLE | ezcGraph::RIGHT; + break; } $renderer->drawText( $labelBoundings, $step->label, $alignement ); |