summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKore Nordmann <github@kore-nordmann.de>2007-05-10 06:58:33 +0000
committerKore Nordmann <github@kore-nordmann.de>2007-05-10 06:58:33 +0000
commit98ff576c569c8a9c82d56fd22916d61f540c2cb9 (patch)
tree05b01bed0cf28327880c444c0b30e1e3dba9dd7a /src
parent9e5906b3523afbfce28cb94d001967b195b4d55d (diff)
downloadzetacomponents-graph-98ff576c569c8a9c82d56fd22916d61f540c2cb9.zip
zetacomponents-graph-98ff576c569c8a9c82d56fd22916d61f540c2cb9.tar.gz
- Fixed issue #10745 (BaxedAxisLabelRenderer wrong label positions for angles:
(135 <= $angle <= 325)
Diffstat (limited to 'src')
-rw-r--r--src/renderer/axis_label_boxed.php63
1 files changed, 43 insertions, 20 deletions
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 );
OpenPOWER on IntegriCloud