summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKore Nordmann <github@kore-nordmann.de>2007-05-31 08:54:18 +0000
committerKore Nordmann <github@kore-nordmann.de>2007-05-31 08:54:18 +0000
commit9779dc08013a202e004a807ef6de8e02ba41648f (patch)
treecd13e39a9ff94ac54e300e5bb8ff613e255cdf22 /src
parent3af71ccb085ebeb83d84e6e1f29b3fcb8a4ba650 (diff)
downloadzetacomponents-graph-9779dc08013a202e004a807ef6de8e02ba41648f.zip
zetacomponents-graph-9779dc08013a202e004a807ef6de8e02ba41648f.tar.gz
- Fixed issue #10881: Wrong labeling with ezcGraphDateAxis
# Axis labels fixed in two test results, error not noticed before
Diffstat (limited to 'src')
-rw-r--r--src/axis/date.php17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/axis/date.php b/src/axis/date.php
index 38508bd..bb588b4 100644
--- a/src/axis/date.php
+++ b/src/axis/date.php
@@ -492,19 +492,30 @@ class ezcGraphChartElementDateAxis extends ezcGraphChartElementAxis
*/
public function getLabel( $step )
{
+ return $this->getLabelFromTimestamp( $this->startDate + ( $step * $this->interval ), $step );
+ }
+
+ /**
+ * Get label for timestamp
+ *
+ * @param int $time
+ * @return string
+ */
+ protected function getLabelFromTimestamp( $time, $step )
+ {
if ( $this->properties['labelCallback'] !== null )
{
return call_user_func_array(
$this->properties['labelCallback'],
array(
- date( $this->properties['dateFormat'], $this->startDate + ( $step * $this->interval ) ),
+ date( $this->properties['dateFormat'], $time ),
$step,
)
);
}
else
{
- return date( $this->properties['dateFormat'], $this->startDate + ( $step * $this->interval ) );
+ return date( $this->properties['dateFormat'], $time );
}
}
@@ -527,7 +538,7 @@ class ezcGraphChartElementDateAxis extends ezcGraphChartElementAxis
$steps[] = new ezcGraphAxisStep(
( $time - $start ) / $distance,
$this->interval / $distance,
- $this->getLabel( $step++ ),
+ $this->getLabelFromTimestamp( $time, $step++ ),
array(),
$step === 1,
$time >= $end
OpenPOWER on IntegriCloud