diff options
author | Kore Nordmann <github@kore-nordmann.de> | 2006-05-15 13:16:17 +0000 |
---|---|---|
committer | Kore Nordmann <github@kore-nordmann.de> | 2006-05-15 13:16:17 +0000 |
commit | 945b562659c64bf83f40b68f0d41d94dc1076055 (patch) | |
tree | fc51d3e814cfa8977bc6958b93667a5c8efa7d69 /src | |
parent | c5fbd776b29217dfbf2c955b9d076d6f22b37d09 (diff) | |
download | zetacomponents-graph-945b562659c64bf83f40b68f0d41d94dc1076055.zip zetacomponents-graph-945b562659c64bf83f40b68f0d41d94dc1076055.tar.gz |
- Implemented manual scaling for numeric axis
Diffstat (limited to 'src')
-rw-r--r-- | src/charts/line.php | 8 | ||||
-rw-r--r-- | src/element/axe.php | 30 | ||||
-rw-r--r-- | src/element/numeric_axis.php | 91 | ||||
-rw-r--r-- | src/graph_autoload.php | 1 |
4 files changed, 100 insertions, 30 deletions
diff --git a/src/charts/line.php b/src/charts/line.php index 8b77bcd..1b7d97e 100644 --- a/src/charts/line.php +++ b/src/charts/line.php @@ -14,6 +14,14 @@ */ class ezcGraphLineChart extends ezcGraphChart { + + public function __construct() + { + parent::__construct(); + + $this->elements['Y_axis'] = new ezcGraphChartElementNumericAxis(); + } + /** * Render a line chart * diff --git a/src/element/axe.php b/src/element/axe.php deleted file mode 100644 index 1f48c66..0000000 --- a/src/element/axe.php +++ /dev/null @@ -1,30 +0,0 @@ -<?php -/** - * File containing the abstract ezcChartElementAxe class - * - * @package Graph - * @version //autogentag// - * @copyright Copyright (C) 2005, 2006 eZ systems as. All rights reserved. - * @license http://ez.no/licenses/new_bsd New BSD License - */ -/** - * Class to represent a axe as a chart element - * - * @package Graph - */ -class ezcChartElementAxe implements ezcChartElement -{ - - /** - * Render an axe - * - * @param ezcGraphRenderer $renderer - * @access public - * @return void - */ - public function render( ezcGraphRenderer $renderer ) - { - - } - -} diff --git a/src/element/numeric_axis.php b/src/element/numeric_axis.php new file mode 100644 index 0000000..e108574 --- /dev/null +++ b/src/element/numeric_axis.php @@ -0,0 +1,91 @@ +<?php +/** + * File containing the abstract ezcGraphChartElementNumericAxis class + * + * @package Graph + * @version //autogentag// + * @copyright Copyright (C) 2005, 2006 eZ systems as. All rights reserved. + * @license http://ez.no/licenses/new_bsd New BSD License + */ +/** + * Class to represent a axe as a chart element + * + * @package Graph + */ +class ezcGraphChartElementNumericAxis extends ezcGraphChartElement +{ + + protected $min = false; + + protected $max = false; + + protected $majorStep = false; + + protected $minorStep = false; + + /** + * __set + * + * @param mixed $propertyName + * @param mixed $propertyValue + * @throws ezcBaseValueException + * If a submitted parameter was out of range or type. + * @throws ezcBasePropertyNotFoundException + * If a the value for the property options is not an instance of + * @return void + */ + public function __set( $propertyName, $propertyValue ) + { + switch ( $propertyName ) + { + case 'min': + $this->min = (float) $propertyValue; + break; + case 'max': + $this->max = (float) $propertyValue; + break; + case 'majorStep': + if ( $propertyValue <= 0 ) + { + throw new ezcBaseValueException( 'majorStep', $propertyValue, 'float > 0' ); + } + $this->majorStep = (float) $propertyValue; + break; + case 'minorStep': + if ( $propertyValue <= 0 ) + { + throw new ezcBaseValueException( 'minorStep', $propertyValue, 'float > 0' ); + } + $this->minorStep = (float) $propertyValue; + break; + default: + parent::__set( $propertyName, $propertyValue ); + break; + } + } + + /** + * Calculate steps, min and max values from given datasets, if not set + * manually before. receives an array of array( ezcGraphDataset ) + * + * @param array $datasets + * @return void + */ + public function calculateFromDataset(array $datasets) + { + + } + + /** + * Render an axe + * + * @param ezcGraphRenderer $renderer + * @access public + * @return void + */ + public function render( ezcGraphRenderer $renderer ) + { + + } + +} diff --git a/src/graph_autoload.php b/src/graph_autoload.php index f86cd27..56319f6 100644 --- a/src/graph_autoload.php +++ b/src/graph_autoload.php @@ -34,6 +34,7 @@ return array( 'ezcGraphChartElement' => 'Graph/interfaces/element.php', 'ezcGraphChartElementLegend' => 'Graph/element/legend.php', + 'ezcGraphChartElementNumericAxis' => 'Graph/element/numeric_axis.php', 'ezcGraphDataset' => 'Graph/datasets/base.php', 'ezcGraphDatasetAverage' => 'Graph/datasets/average.php', |