From 9d8baefbdf52a83adfb2efed5ebe4bd7b7f765a7 Mon Sep 17 00:00:00 2001 From: Kore Nordmann Date: Wed, 20 Sep 2006 15:12:20 +0000 Subject: - Added and improved documentation --- src/axis/date.php | 44 ++++++++++++++++++++++++++++++++++++++++---- src/axis/labeled.php | 22 +++++++++++++++++++--- src/axis/numeric.php | 8 ++++++-- 3 files changed, 65 insertions(+), 9 deletions(-) (limited to 'src/axis') diff --git a/src/axis/date.php b/src/axis/date.php index 601119a..7bb8e1c 100644 --- a/src/axis/date.php +++ b/src/axis/date.php @@ -1,6 +1,6 @@ properties['interval'] = $interval; } + /** + * Calculate lower nice date + * + * Calculates a date which is earlier or equal to the given date, and is + * divisible by the given interval. + * + * @param int $min Date + * @param int $interval Interval + * @return int Earlier date + */ protected function calculateLowerNiceDate( $min, $interval ) { $dateSteps = array( 60, 60, 24, 7, 52 ); @@ -225,11 +241,33 @@ class ezcGraphChartElementDateAxis extends ezcGraphChartElementAxis ); } + /** + * Calculate start date + * + * Use calculateLowerNiceDate to get a date earlier or equal date then the + * minimum date to use it as the start date for the axis depending on the + * selected interval. + * + * @param mixed $min Minimum date + * @param mixed $max Maximum date + * @return void + */ public function calculateMinimum( $min, $max ) { $this->properties['startDate'] = $this->calculateLowerNiceDate( $min, $this->interval ); } + /** + * Calculate end date + * + * Use calculateLowerNiceDate to get a date later or equal date then the + * maximum date to use it as the end date for the axis depending on the + * selected interval. + * + * @param mixed $min Minimum date + * @param mixed $max Maximum date + * @return void + */ public function calculateMaximum( $min, $max ) { $this->properties['endDate'] = $this->calculateLowerNiceDate( $max, $this->interval ); @@ -243,8 +281,6 @@ class ezcGraphChartElementDateAxis extends ezcGraphChartElementAxis /** * Calculate axis bounding values on base of the assigned values * - * @abstract - * @access public * @return void */ public function calculateAxisBoundings() diff --git a/src/axis/labeled.php b/src/axis/labeled.php index 7b1225c..bbfd102 100644 --- a/src/axis/labeled.php +++ b/src/axis/labeled.php @@ -1,6 +1,6 @@ axisLabelRenderer = new ezcGraphAxisCenteredLabelRenderer(); @@ -42,7 +50,15 @@ class ezcGraphChartElementLabeledAxis extends ezcGraphChartElementAxis parent::__construct( $options ); } - protected function increaseKeys( $array, $startKey ) + /** + * Increase the keys of all elements in the array up from the start key, to + * insert an additional element at the correct position. + * + * @param array $array Array + * @param int $startKey Key to increase keys from + * @return array Updated array + */ + protected function increaseKeys( array $array, $startKey ) { foreach ( $array as $key => $value ) { diff --git a/src/axis/numeric.php b/src/axis/numeric.php index 1bf3cfe..85da3f6 100644 --- a/src/axis/numeric.php +++ b/src/axis/numeric.php @@ -8,7 +8,12 @@ * @license http://ez.no/licenses/new_bsd New BSD License */ /** - * Class to represent a axe as a chart element + * Class to represent a numeric axis. The axis tries to calculate "nice" start + * and end values for the axis scale. The used interval is considered as nice, + * if it is equal to [1,2,5] * 10^x with x in [.., -1, 0, 1, ..]. + * + * The start and end value are the next bigger / smaller multiple of the + * intervall compared to the maximum / minimum axis value. * * @property float $min * Minimum value of displayed scale on axis. @@ -19,7 +24,6 @@ * @property float $maxValue * Maximum value to display on this axis. * - * * @package Graph */ class ezcGraphChartElementNumericAxis extends ezcGraphChartElementAxis -- cgit v1.1