summaryrefslogtreecommitdiffstats
path: root/src/renderer/3d.php
diff options
context:
space:
mode:
authorKore Nordmann <github@kore-nordmann.de>2013-12-21 03:34:09 -0800
committerKore Nordmann <github@kore-nordmann.de>2013-12-21 03:34:09 -0800
commit691431de8c17573398a9248fc37c8de3a88cb258 (patch)
tree97358ab26b1f399dd49eee71d282a9c5692119b1 /src/renderer/3d.php
parent699ac2e47bf0a21fffc6da55cc6714c067a2e80a (diff)
parentf7b8cc2569b001eab98f276a7fc7260d9699c13d (diff)
downloadzetacomponents-graph-691431de8c17573398a9248fc37c8de3a88cb258.zip
zetacomponents-graph-691431de8c17573398a9248fc37c8de3a88cb258.tar.gz
Merge pull request #2 from mschirmacher/master
Fixed faulty label rendering in case of additional axes
Diffstat (limited to 'src/renderer/3d.php')
-rw-r--r--src/renderer/3d.php58
1 files changed, 32 insertions, 26 deletions
diff --git a/src/renderer/3d.php b/src/renderer/3d.php
index 9d43c17..8a226c3 100644
--- a/src/renderer/3d.php
+++ b/src/renderer/3d.php
@@ -2251,40 +2251,46 @@ class ezcGraphRenderer3d
'start' => clone $start,
'end' => clone $end,
'axis' => $axis,
+ 'positioningDone' => false,
);
if ( $this->xAxisSpace && $this->yAxisSpace )
{
- foreach ( $this->axisLabels as $axisLabel )
+ foreach ( $this->axisLabels as &$axisLabel )
{
- // If font should not be synchronized, use font configuration from
- // each axis
- if ( $this->options->syncAxisFonts === false )
+ if ( !$axisLabel['positioningDone'] )
{
- $this->driver->options->font = $axisLabel['axis']->font;
- }
+ // If font should not be synchronized, use font configuration from
+ // each axis
+ if ( $this->options->syncAxisFonts === false )
+ {
+ $this->driver->options->font = $axisLabel['axis']->font;
+ }
+
+ switch ( $axisLabel['axis']->position )
+ {
+ case ezcGraph::RIGHT:
+ case ezcGraph::LEFT:
+ $axisLabel['start']->x += $this->xAxisSpace * ( $axisLabel['start'] > $axisLabel['end'] ? -1 : 1 );
+ $axisLabel['end']->x -= $this->xAxisSpace * ( $axisLabel['start'] > $axisLabel['end'] ? -1 : 1 );
+ break;
+ case ezcGraph::TOP:
+ case ezcGraph::BOTTOM:
+ $axisLabel['start']->y += $this->yAxisSpace * ( $axisLabel['start'] > $axisLabel['end'] ? -1 : 1 );
+ $axisLabel['end']->y -= $this->yAxisSpace * ( $axisLabel['start'] > $axisLabel['end'] ? -1 : 1 );
+ break;
+ }
+
+ $axisLabel['object']->renderLabels(
+ $this,
+ $axisLabel['boundings'],
+ $axisLabel['start'],
+ $axisLabel['end'],
+ $axisLabel['axis']
+ );
- switch ( $axisLabel['axis']->position )
- {
- case ezcGraph::RIGHT:
- case ezcGraph::LEFT:
- $axisLabel['start']->x += $this->xAxisSpace * ( $axisLabel['start'] > $axisLabel['end'] ? -1 : 1 );
- $axisLabel['end']->x -= $this->xAxisSpace * ( $axisLabel['start'] > $axisLabel['end'] ? -1 : 1 );
- break;
- case ezcGraph::TOP:
- case ezcGraph::BOTTOM:
- $axisLabel['start']->y += $this->yAxisSpace * ( $axisLabel['start'] > $axisLabel['end'] ? -1 : 1 );
- $axisLabel['end']->y -= $this->yAxisSpace * ( $axisLabel['start'] > $axisLabel['end'] ? -1 : 1 );
- break;
+ $axisLabel['positioningDone'] = true;
}
-
- $axisLabel['object']->renderLabels(
- $this,
- $axisLabel['boundings'],
- $axisLabel['start'],
- $axisLabel['end'],
- $axisLabel['axis']
- );
}
}
}
OpenPOWER on IntegriCloud