diff options
author | Kore Nordmann <github@kore-nordmann.de> | 2006-10-26 14:08:20 +0000 |
---|---|---|
committer | Kore Nordmann <github@kore-nordmann.de> | 2006-10-26 14:08:20 +0000 |
commit | b6069cc0bfb2a7baaf2e79263cfc9c222d9e8299 (patch) | |
tree | a59d5e0b75fefd08ece3c927211f6f6e965e7933 /src/options | |
parent | 7e56dbbe610469d173133cc6f2d19da5039079bb (diff) | |
download | zetacomponents-graph-b6069cc0bfb2a7baaf2e79263cfc9c222d9e8299.zip zetacomponents-graph-b6069cc0bfb2a7baaf2e79263cfc9c222d9e8299.tar.gz |
- Added some more tests for read and write accesss on properties
Diffstat (limited to 'src/options')
-rw-r--r-- | src/options/driver.php | 11 | ||||
-rw-r--r-- | src/options/font.php | 4 | ||||
-rw-r--r-- | src/options/line_chart.php | 2 | ||||
-rw-r--r-- | src/options/ming_driver.php | 2 | ||||
-rw-r--r-- | src/options/renderer.php | 20 | ||||
-rw-r--r-- | src/options/renderer_3d.php | 18 |
6 files changed, 31 insertions, 26 deletions
diff --git a/src/options/driver.php b/src/options/driver.php index 2bc2c55..fd905e5 100644 --- a/src/options/driver.php +++ b/src/options/driver.php @@ -16,11 +16,12 @@ * Height of the chart. * @property float $shadeCircularArc * Percent to darken circular arcs at the sides - * @property int $font - * Font used in the graph. * @property float $lineSpacing * Percent of font size used for line spacing * + * @property int $font + * Font used in the graph. + * * @package Graph */ abstract class ezcGraphDriverOptions extends ezcBaseOptions @@ -34,6 +35,9 @@ abstract class ezcGraphDriverOptions extends ezcBaseOptions */ public function __construct( array $options = array() ) { + $this->properties['width'] = false; + $this->properties['height'] = false; + $this->properties['lineSpacing'] = .1; $this->properties['shadeCircularArc'] = .5; $this->properties['font'] = new ezcGraphFontOptions(); @@ -61,6 +65,9 @@ abstract class ezcGraphDriverOptions extends ezcBaseOptions case 'height': $this->properties['height'] = max( 1, (int) $propertyValue ); break; + case 'lineSpacing': + $this->properties['lineSpacing'] = max( 0, min( 1, (float) $propertyValue ) ); + break; case 'shadeCircularArc': $this->properties['shadeCircularArc'] = max( 0, min( 1, (float) $propertyValue ) ); break; diff --git a/src/options/font.php b/src/options/font.php index 523687c..0a0f135 100644 --- a/src/options/font.php +++ b/src/options/font.php @@ -27,8 +27,6 @@ * The minimal used font size for this element. * @property ezcGraphColor $color * Font color. - * @property float $lineSpacing - * Percent of font size used for line spacing * @property ezcGraphColor $background * Background color * @property ezcGraphColor $border @@ -70,7 +68,6 @@ class ezcGraphFontOptions extends ezcBaseOptions $this->properties['minFontSize'] = 6; $this->properties['maxFontSize'] = 96; $this->properties['minimalUsedFont'] = 96; - $this->properties['lineSpacing'] = .1; $this->properties['color'] = ezcGraphColor::fromHex( '#000000' ); $this->properties['background'] = false; @@ -187,6 +184,7 @@ class ezcGraphFontOptions extends ezcBaseOptions { throw new ezcBaseValueException( $propertyName, $propertyValue, 'int' ); } + break; default: throw new ezcBasePropertyNotFoundException( $propertyName ); break; diff --git a/src/options/line_chart.php b/src/options/line_chart.php index c8eadb5..a90512a 100644 --- a/src/options/line_chart.php +++ b/src/options/line_chart.php @@ -96,7 +96,7 @@ class ezcGraphLineChartOptions extends ezcGraphChartOptions } else { - throw new ezcBaseValueException( $propertyValue, 'ezcGraphFontOptions' ); + throw new ezcBaseValueException( $propertyName, $propertyValue, 'ezcGraphFontOptions' ); } break; case 'highlightSize': diff --git a/src/options/ming_driver.php b/src/options/ming_driver.php index 22483ae..4e5d1cd 100644 --- a/src/options/ming_driver.php +++ b/src/options/ming_driver.php @@ -31,7 +31,7 @@ class ezcGraphMingDriverOptions extends ezcGraphDriverOptions public function __construct( array $options = array() ) { $this->properties['compression'] = 9; - $this->properties['circleResolution'] = 2; + $this->properties['circleResolution'] = 2.; parent::__construct( $options ); } diff --git a/src/options/renderer.php b/src/options/renderer.php index 489bbbe..35441ef 100644 --- a/src/options/renderer.php +++ b/src/options/renderer.php @@ -101,13 +101,13 @@ class ezcGraphRendererOptions extends ezcGraphChartOptions switch ( $propertyName ) { case 'maxLabelHeight': - $this->properties['maxLabelHeight'] = min( 1, max( 0, (float) $propertyValue ) ); + $this->properties['maxLabelHeight'] = min( 1., max( .0, (float) $propertyValue ) ); break; case 'symbolSize': $this->properties['symbolSize'] = (int) $propertyValue; break; case 'moveOut': - $this->properties['moveOut'] = min( 1, max( 0, (float) $propertyValue ) ); + $this->properties['moveOut'] = min( 1., max( .0, (float) $propertyValue ) ); break; case 'showSymbol': $this->properties['showSymbol'] = (bool) $propertyValue; @@ -119,13 +119,13 @@ class ezcGraphRendererOptions extends ezcGraphChartOptions $this->properties['titleAlignement'] = (int) $propertyValue; break; case 'dataBorder': - $this->properties['dataBorder'] = min( 1, max( 0, (float) $propertyValue ) ); + $this->properties['dataBorder'] = min( 1., max( .0, (float) $propertyValue ) ); break; case 'barMargin': - $this->properties['barMargin'] = min( 1, max( 0, (float) $propertyValue ) ); + $this->properties['barMargin'] = min( 1., max( .0, (float) $propertyValue ) ); break; case 'barPadding': - $this->properties['barPadding'] = min( 1, max( 0, (float) $propertyValue ) ); + $this->properties['barPadding'] = min( 1., max( .0, (float) $propertyValue ) ); break; case 'pieChartOffset': $this->properties['pieChartOffset'] = $propertyValue % 360; @@ -134,7 +134,7 @@ class ezcGraphRendererOptions extends ezcGraphChartOptions $this->properties['pieChartSymbolColor'] = ezcGraphColor::create( $propertyValue ); break; case 'pieChartGleam': - $this->properties['pieChartGleam'] = min( 1, max( 0, (float) $propertyValue ) ); + $this->properties['pieChartGleam'] = min( 1., max( .0, (float) $propertyValue ) ); break; case 'pieChartGleamColor': $this->properties['pieChartGleamColor'] = ezcGraphColor::create( $propertyValue ); @@ -143,19 +143,19 @@ class ezcGraphRendererOptions extends ezcGraphChartOptions $this->properties['pieChartGleamBorder'] = max( 0, (int) $propertyValue ); break; case 'legendSymbolGleam': - $this->properties['legendSymbolGleam'] = min( 1, max( 0, (float) $propertyValue ) ); + $this->properties['legendSymbolGleam'] = min( 1., max( .0, (float) $propertyValue ) ); break; case 'legendSymbolGleamSize': - $this->properties['legendSymbolGleamSize'] = min( 1, max( 0, (float) $propertyValue ) ); + $this->properties['legendSymbolGleamSize'] = min( 1., max( .0, (float) $propertyValue ) ); break; case 'legendSymbolGleamColor': $this->properties['legendSymbolGleamColor'] = ezcGraphColor::create( $propertyValue ); break; case 'pieVerticalSize': - $this->properties['pieVerticalSize'] = min( 1, max( 0, (float) $propertyValue ) ); + $this->properties['pieVerticalSize'] = min( 1., max( .0, (float) $propertyValue ) ); break; case 'pieHorizontalSize': - $this->properties['pieHorizontalSize'] = min( 1, max( 0, (float) $propertyValue ) ); + $this->properties['pieHorizontalSize'] = min( 1., max( .0, (float) $propertyValue ) ); break; default: return parent::__set( $propertyName, $propertyValue ); diff --git a/src/options/renderer_3d.php b/src/options/renderer_3d.php index 1f2c658..ceb1ab6 100644 --- a/src/options/renderer_3d.php +++ b/src/options/renderer_3d.php @@ -83,43 +83,43 @@ class ezcGraphRenderer3dOptions extends ezcGraphRendererOptions switch ( $propertyName ) { case 'depth': - $this->properties['depth'] = min( 1, max( 0, (float) $propertyValue ) ); + $this->properties['depth'] = min( 1., max( .0, (float) $propertyValue ) ); break; case 'seperateLines': $this->properties['seperateLines'] = (bool) $propertyValue; break; case 'fillAxis': - $this->properties['fillAxis'] = min( 1, max( 0, (float) $propertyValue ) ); + $this->properties['fillAxis'] = min( 1., max( .0, (float) $propertyValue ) ); break; case 'fillGrid': - $this->properties['fillGrid'] = min( 1, max( 0, (float) $propertyValue ) ); + $this->properties['fillGrid'] = min( 1., max( .0, (float) $propertyValue ) ); break; case 'dataBorder': - $this->properties['dataBorder'] = min( 1, max( 0, (float) $propertyValue ) ); + $this->properties['dataBorder'] = min( 1., max( .0, (float) $propertyValue ) ); break; case 'pieChartHeight': $this->properties['pieChartHeight'] = (float) $propertyValue; break; case 'pieChartRotation': - $this->properties['pieChartRotation'] = min( 1, max( 0, (float) $propertyValue ) ); + $this->properties['pieChartRotation'] = min( 1., max( .0, (float) $propertyValue ) ); break; case 'pieChartShadowSize': $this->properties['pieChartShadowSize'] = max( 0, (int) $propertyValue ); break; case 'pieChartShadowTransparency': - $this->properties['pieChartShadowTransparency'] = min( 1, max( 0, (float) $propertyValue ) ); + $this->properties['pieChartShadowTransparency'] = min( 1., max( .0, (float) $propertyValue ) ); break; case 'pieChartShadowColor': $this->properties['pieChartShadowColor'] = ezcGraphColor::create( $propertyValue ); break; case 'barDarkenSide': - $this->properties['barDarkenSide'] = min( 1, max( 0, (float) $propertyValue ) ); + $this->properties['barDarkenSide'] = min( 1., max( .0, (float) $propertyValue ) ); break; case 'barDarkenTop': - $this->properties['barDarkenTop'] = min( 1, max( 0, (float) $propertyValue ) ); + $this->properties['barDarkenTop'] = min( 1., max( .0, (float) $propertyValue ) ); break; case 'barChartGleam': - $this->properties['barChartGleam'] = min( 1, max( 0, (float) $propertyValue ) ); + $this->properties['barChartGleam'] = min( 1., max( .0, (float) $propertyValue ) ); break; default: return parent::__set( $propertyName, $propertyValue ); |