diff options
author | Kore Nordmann <github@kore-nordmann.de> | 2009-01-20 11:03:10 +0000 |
---|---|---|
committer | Kore Nordmann <github@kore-nordmann.de> | 2009-01-20 11:03:10 +0000 |
commit | c8e553c98361944727f7ae933e5fc89d7ba5956c (patch) | |
tree | 50a3e781ee7ced107805258eb027676aecbad8f4 /src/renderer | |
parent | 5b619326b8c725be88d1b19c4d0719b6fd0da096 (diff) | |
download | zetacomponents-graph-c8e553c98361944727f7ae933e5fc89d7ba5956c.zip zetacomponents-graph-c8e553c98361944727f7ae933e5fc89d7ba5956c.tar.gz |
- Implemented feature #13634: Make Offset of ezcGraphAxisRotatedLabelRenderer
optional
Diffstat (limited to 'src/renderer')
-rw-r--r-- | src/renderer/axis_label_rotated.php | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/src/renderer/axis_label_rotated.php b/src/renderer/axis_label_rotated.php index fd9445b..de37691 100644 --- a/src/renderer/axis_label_rotated.php +++ b/src/renderer/axis_label_rotated.php @@ -69,7 +69,8 @@ class ezcGraphAxisRotatedLabelRenderer extends ezcGraphAxisLabelRenderer public function __construct( array $options = array() ) { parent::__construct( $options ); - $this->properties['angle'] = null; + $this->properties['angle'] = null; + $this->properties['labelOffset'] = true; } /** @@ -97,6 +98,16 @@ class ezcGraphAxisRotatedLabelRenderer extends ezcGraphAxisLabelRenderer $reducement = (int) ( $propertyValue - $propertyValue % 360 ); $this->properties['angle'] = (float) $propertyValue - $reducement; break; + + case 'labelOffset': + if ( !is_bool( $propertyValue ) ) + { + throw new ezcBaseValueException( $propertyName, $propertyValue, 'bool' ); + } + + $this->properties[$propertyName] = (bool) $propertyValue; + break; + default: return parent::__set( $propertyName, $propertyValue ); } @@ -193,10 +204,17 @@ class ezcGraphAxisRotatedLabelRenderer extends ezcGraphAxisLabelRenderer $degTextAngle += 360.; } - $this->offset = - ( $this->angle < 0 ? -1 : 1 ) * - ( $axis->position & ( ezcGraph::TOP | ezcGraph::LEFT ) ? 1 : -1 ) * - ( 1 - cos( deg2rad( $this->angle * 2 ) ) ); + if ( $this->properties['labelOffset'] ) + { + $this->offset = + ( $this->angle < 0 ? -1 : 1 ) * + ( $axis->position & ( ezcGraph::TOP | ezcGraph::LEFT ) ? 1 : -1 ) * + ( 1 - cos( deg2rad( $this->angle * 2 ) ) ); + } + else + { + $this->offset = 0; + } $axisSpaceFactor = abs( ( $this->direction->x == 0 ? 0 : |