summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMalte Schirmacher <thana@thana.crosscangmbh.local>2013-01-23 18:10:36 +0100
committerMalte Schirmacher <thana@thana.crosscangmbh.local>2013-01-23 18:10:36 +0100
commitf7b8cc2569b001eab98f276a7fc7260d9699c13d (patch)
tree23ff604a58ac4911f1d8d038ec065470b6f71951
parentddea34cb8ab9325adbe6a7de9acd3d500e38ebcb (diff)
downloadzetacomponents-graph-f7b8cc2569b001eab98f276a7fc7260d9699c13d.zip
zetacomponents-graph-f7b8cc2569b001eab98f276a7fc7260d9699c13d.tar.gz
Patched ezcGraphRenderer3d to render labels correclty in case of additional axes
In case there are additional axes ezcGraphRenderer3d renders labels multiple times (once for additional axis) at varying positions. Added a flag to avoid this faulty behavior.
-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