Zeta Components Manual :: Docs For Class ezcGraphChartElementDateAxis
Graph::ezcGraphChartElementDateAxis
Class ezcGraphChartElementDateAxis
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
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:
- $graph->options->fillLines = 210;
- $graph->title = 'Concurrent requests';
- $graph->legend = false;
- // Add data
- '8:00' => 3241,
- '8:13' => 934,
- '8:24' => 1201,
- '8:27' => 1752,
- '8:51' => 123,
- ) );
- '8:05' => 623,
- '8:12' => 2103,
- '8:33' => 543,
- '8:43' => 2034,
- '8:59' => 3410,
- ) );
Source for this file: /Graph/src/axis/date.php
ezcBaseOptions | --ezcGraphChartElement | --ezcGraphChartElementAxis | --ezcGraphChartElementDateAxis
Version: | //autogentag// |
Constants
DECADE
= 315360000
|
|
MAJOR_COUNT
= 10
|
Constant used for calculation of automatic definition of major scaling steps |
MONTH
= 2629800
|
|
YEAR
= 31536000
|
Properties
string | read/write |
$dateFormat
Format of date string Like http://php.net/date |
float | read/write |
$endDate
End date used to display on axis. |
float | read/write |
$interval
Time interval between steps on axis. |
float | read/write |
$startDate
Starting date used to display on axis. |
Member Variables
protected int |
$maxValue
= false
Maximum inserted date |
protected int |
$minValue
= false
Minimum inserted date |
protected array |
$predefinedIntervals
= array(
Nice time intervals to used if there is no user defined interval |
Inherited Member Variables
From ezcGraphChartElementAxis | |
---|---|
protected |
ezcGraphChartElementAxis::$axisLabelRenderer
|
protected |
ezcGraphChartElementAxis::$innerBoundings
|
From ezcBaseOptions | |
protected |
ezcBaseOptions::$properties
|
Method Summary
protected static int |
ensureTimestamp(
$value
)
Ensure proper timestamp |
public void |
addData(
$values
)
Add data for this axis |
public void |
calculateAxisBoundings(
)
Calculate axis bounding values on base of the assigned values |
protected void |
calculateInterval(
$min
, $max
)
Calculate nice time interval |
protected int |
calculateLowerNiceDate(
$min
, $interval
)
Calculate lower nice date |
public void |
calculateMaximum(
$min
, $max
)
Calculate end date |
public void |
calculateMinimum(
$min
, $max
)
Calculate start date |
public float |
getCoordinate(
$value
)
Get coordinate for a dedicated value on the chart |
public string |
getLabel(
$step
)
Get label for a dedicated step on the axis |
protected string |
getLabelFromTimestamp(
$time
, $step
)
Get label for timestamp |
public integer |
getMajorStepCount(
)
Return count of major steps |
public integer |
getMinorStepCount(
)
Return count of minor steps |
public array( |
getSteps(
)
Return array of steps on this axis |
public bool |
isZeroStep(
$step
)
Is zero step |
Inherited Methods
From ezcGraphChartElementAxis | |
---|---|
public abstract void |
ezcGraphChartElementAxis::addData()
Add data for this axis |
public abstract void |
ezcGraphChartElementAxis::calculateAxisBoundings()
Calculate axis bounding values on base of the assigned values |
public abstract float |
ezcGraphChartElementAxis::getCoordinate()
Get coordinate for a dedicated value on the chart |
public abstract string |
ezcGraphChartElementAxis::getLabel()
Get label for a dedicated step on the axis |
public abstract integer |
ezcGraphChartElementAxis::getMajorStepCount()
Return count of major steps |
public abstract integer |
ezcGraphChartElementAxis::getMinorStepCount()
Return count of minor steps |
public array( |
ezcGraphChartElementAxis::getSteps()
Return array of steps on this axis |
public abstract bool |
ezcGraphChartElementAxis::isZeroStep()
Is zero step |
public ezcGraphBoundings |
ezcGraphChartElementAxis::render()
Render the axis |
public void |
ezcGraphChartElementAxis::setFromPalette()
Set colors and border fro this element |
public void |
ezcGraphChartElementAxis::__set()
__set |
From ezcGraphChartElement | |
protected ezcGraphBoundings |
ezcGraphChartElement::getTitleSize()
Returns calculated boundings based on available percentual space of given bounding box specified in the elements options and direction of the box. |
public abstract ezcGraphBoundings |
ezcGraphChartElement::render()
Renders this chart element |
public void |
ezcGraphChartElement::setFromPalette()
Set colors and border fro this element |
From ezcBaseOptions | |
public ezcBaseOptions |
ezcBaseOptions::__construct()
Construct a new options object. |
public void |
ezcBaseOptions::merge()
Merge an array into the actual options object. |
public bool |
ezcBaseOptions::offsetExists()
Returns if an option exists. |
public mixed |
ezcBaseOptions::offsetGet()
Returns an option value. |
public void |
ezcBaseOptions::offsetSet()
Set an option. |
public void |
ezcBaseOptions::offsetUnset()
Unset an option. |
Methods
ensureTimestamp
Ensure proper timestamp
Takes a mixed value from datasets, like timestamps, or strings describing some time and converts it to a timestamp.
Parameters:
Name | Type | Description |
---|---|---|
$value |
mixed |
addData
Add data for this axis
Parameters:
Name | Type | Description |
---|---|---|
$values |
array | Value which will be displayed on this axis |
Redefinition of:
Method | Description |
---|---|
ezcGraphChartElementAxis::addData() |
Add data for this axis |
calculateAxisBoundings
Calculate axis bounding values on base of the assigned values
Redefinition of:
Method | Description |
---|---|
ezcGraphChartElementAxis::calculateAxisBoundings() |
Calculate axis bounding values on base of the assigned values |
calculateInterval
Calculate nice time interval
Use the best fitting time interval defined in class property array predefinedIntervals.
Parameters:
Name | Type | Description |
---|---|---|
$min |
int | Start time |
$max |
int | End time |
calculateLowerNiceDate
Calculate lower nice date
Calculates a date which is earlier or equal to the given date, and is divisible by the given interval.
Parameters:
Name | Type | Description |
---|---|---|
$min |
int | Date |
$interval |
int | Interval |
calculateMaximum
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.
Parameters:
Name | Type | Description |
---|---|---|
$min |
mixed | Minimum date |
$max |
mixed | Maximum date |
calculateMinimum
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.
Parameters:
Name | Type | Description |
---|---|---|
$min |
mixed | Minimum date |
$max |
mixed | Maximum date |
getCoordinate
Get coordinate for a dedicated value on the chart
Parameters:
Name | Type | Description |
---|---|---|
$value |
float | Value to determine position for |
Redefinition of:
Method | Description |
---|---|
ezcGraphChartElementAxis::getCoordinate() |
Get coordinate for a dedicated value on the chart |
getLabel
Get label for a dedicated step on the axis
Parameters:
Name | Type | Description |
---|---|---|
$step |
integer | Number of step |
Redefinition of:
Method | Description |
---|---|
ezcGraphChartElementAxis::getLabel() |
Get label for a dedicated step on the axis |
getLabelFromTimestamp
Get label for timestamp
Parameters:
Name | Type | Description |
---|---|---|
$time |
int | |
$step |
int |
getMajorStepCount
Return count of major steps
Redefinition of:
Method | Description |
---|---|
ezcGraphChartElementAxis::getMajorStepCount() |
Return count of major steps |
getMinorStepCount
Return count of minor steps
Redefinition of:
Method | Description |
---|---|
ezcGraphChartElementAxis::getMinorStepCount() |
Return count of minor steps |
getSteps
Return array of steps on this axis
Redefinition of:
Method | Description |
---|---|
ezcGraphChartElementAxis::getSteps() |
Return array of steps on this axis |
isZeroStep
Is zero step
Returns true if the given step is the one on the initial axis position
Parameters:
Name | Type | Description |
---|---|---|
$step |
int | Number of step |
Redefinition of:
Method | Description |
---|---|
ezcGraphChartElementAxis::isZeroStep() |
Is zero step |