diff options
Diffstat (limited to 'src/axis')
-rw-r--r-- | src/axis/date.php | 44 | ||||
-rw-r--r-- | src/axis/labeled.php | 22 | ||||
-rw-r--r-- | src/axis/numeric.php | 8 |
3 files changed, 65 insertions, 9 deletions
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 @@ <?php /** - * File containing the abstract ezcGraphChartElementDateAxis class + * File containing the ezcGraphChartElementDateAxis class * * @package Graph * @version //autogentag// @@ -8,7 +8,13 @@ * @license http://ez.no/licenses/new_bsd New BSD License */ /** - * Class to represent a axe as a chart element + * Class to represent date axis. Date axis will try to find a "nice" interval + * based on the values on the x axis. If non numeric values are given, + * ezcGraphChartElementDateAxis will convert them to timestamps using PHPs + * strtotime function. + * + * It is always possible to set start date, end date and the interval manually + * by yourself. * * @property float $startDate * Starting date used to display on axis. @@ -192,6 +198,16 @@ class ezcGraphChartElementDateAxis extends ezcGraphChartElementAxis $this->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 @@ <?php /** - * File containing the abstract ezcGraphChartElementLabeledAxis class + * File containing the ezcGraphChartElementLabeledAxis class * * @package Graph * @version //autogentag// @@ -8,7 +8,8 @@ * @license http://ez.no/licenses/new_bsd New BSD License */ /** - * Class to represent a axe as a chart element + * Class to represent a labeled axis. Values on the x axis are considered as + * strings and used in the given order. * * @package Graph */ @@ -35,6 +36,13 @@ class ezcGraphChartElementLabeledAxis extends ezcGraphChartElementAxis */ const MAX_LABEL_COUNT = 10; + /** + * Constructor + * + * @param array $options Default option array + * @return void + * @ignore + */ public function __construct( array $options = array() ) { $this->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 |