diff options
-rw-r--r-- | src/renderer/3d.php | 58 |
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'] - ); } } } |