[ Index ]

PHP Cross Reference of MantisBT

title

Body

[close]

/library/ezc/Graph/src/axis/ -> date.php (summary)

File containing the ezcGraphChartElementDateAxis class

Copyright: Copyright (C) 2005-2009 eZ Systems AS. All rights reserved.
License: http://ez.no/licenses/new_bsd New BSD License
Version: 1.5
File Size: 633 lines (18 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

ezcGraphChartElementDateAxis:: (16 methods):
  __construct()
  __set()
  ensureTimestamp()
  addData()
  calculateInterval()
  calculateLowerNiceDate()
  calculateMinimum()
  calculateMaximum()
  calculateAxisBoundings()
  getCoordinate()
  getMinorStepCount()
  getMajorStepCount()
  getLabel()
  getLabelFromTimestamp()
  getSteps()
  isZeroStep()


Class: ezcGraphChartElementDateAxis  - X-Ref

Class to represent date axis.

Axis elements represent the axis in a bar, line or radar chart. They are
chart elements (ezcGraphChartElement) extending from
ezcGraphChartElementAxis, where additional formatting options can be found.
You should generally use the axis, which matches your input data best, so
that the automatic chart layouting works best. Aavailable axis types are:

- ezcGraphChartElementDateAxis
- ezcGraphChartElementLabeledAxis
- ezcGraphChartElementLogarithmicalAxis
- ezcGraphChartElementNumericAxis

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.

The $dateFormat option provides an additional way of formatting the labels
used on the axis. The options from the parent class $formatString and
$labelCallback do still apply.

You may use a date axis like in the following example:

<code>
$graph = new ezcGraphLineChart();
$graph->options->fillLines = 210;
$graph->title = 'Concurrent requests';
$graph->legend = false;

$graph->xAxis = new ezcGraphChartElementDateAxis();

// Add data
$graph->data['Machine 1'] = new ezcGraphArrayDataSet( array(
'8:00' => 3241,
'8:13' => 934,
'8:24' => 1201,
'8:27' => 1752,
'8:51' => 123,
) );
$graph->data['Machine 2'] = new ezcGraphArrayDataSet( array(
'8:05' => 623,
'8:12' => 2103,
'8:33' => 543,
'8:43' => 2034,
'8:59' => 3410,
) );

$graph->data['Machine 1']->symbol = ezcGraph::BULLET;
$graph->data['Machine 2']->symbol = ezcGraph::BULLET;

$graph->render( 400, 150, 'tutorial_axis_datetime.svg' );
</code>

__construct( array $options = array()   X-Ref
Constructor

param: array $options Default option array
return: void

__set( $propertyName, $propertyValue )   X-Ref
__set

param: mixed $propertyName
param: mixed $propertyValue
return: void

ensureTimestamp( $value )   X-Ref
Ensure proper timestamp

Takes a mixed value from datasets, like timestamps, or strings
describing some time and converts it to a timestamp.

param: mixed $value
return: int

addData( array $values )   X-Ref
Add data for this axis

param: array $values Value which will be displayed on this axis
return: void

calculateInterval( $min, $max )   X-Ref
Calculate nice time interval

Use the best fitting time interval defined in class property array
predefinedIntervals.

param: int $min Start time
param: int $max End time
return: void

calculateLowerNiceDate( $min, $interval )   X-Ref
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

calculateMinimum( $min, $max )   X-Ref
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

calculateMaximum( $min, $max )   X-Ref
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

calculateAxisBoundings()   X-Ref
Calculate axis bounding values on base of the assigned values

return: void

getCoordinate( $value )   X-Ref
Get coordinate for a dedicated value on the chart

param: float $value Value to determine position for
return: float Position on chart

getMinorStepCount()   X-Ref
Return count of minor steps

return: integer Count of minor steps

getMajorStepCount()   X-Ref
Return count of major steps

return: integer Count of major steps

getLabel( $step )   X-Ref
Get label for a dedicated step on the axis

param: integer $step Number of step
return: string label

getLabelFromTimestamp( $time, $step )   X-Ref
Get label for timestamp

param: int $time
param: int $step
return: string

getSteps()   X-Ref
Return array of steps on this axis

return: array( ezcGraphAxisStep )

isZeroStep( $step )   X-Ref
Is zero step

Returns true if the given step is the one on the initial axis position

param: int $step Number of step
return: bool Status If given step is initial axis position



Generated: Thu Jul 28 15:48:31 2011 Cross-referenced by PHPXref 0.7