summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKore Nordmann <github@kore-nordmann.de>2008-12-04 16:03:47 +0000
committerKore Nordmann <github@kore-nordmann.de>2008-12-04 16:03:47 +0000
commitb0bd4a7169a375ff74266d5cb15e817b1484dc07 (patch)
tree4d6aed10aaec67892ce1f0137726ebef60b6722e /src
parentb322a8d3c8f26d9df21244319c3a2aa281795d07 (diff)
downloadzetacomponents-graph-b0bd4a7169a375ff74266d5cb15e817b1484dc07.zip
zetacomponents-graph-b0bd4a7169a375ff74266d5cb15e817b1484dc07.tar.gz
- Implemented feature #014010: Possibility to set x/y offsets for
highlightValue (Patch by Markus Lervik)
Diffstat (limited to 'src')
-rw-r--r--src/charts/line.php4
-rw-r--r--src/element/axis.php4
-rw-r--r--src/interfaces/renderer.php6
-rw-r--r--src/options/line_chart.php11
-rw-r--r--src/renderer/2d.php10
-rw-r--r--src/renderer/3d.php6
6 files changed, 32 insertions, 9 deletions
diff --git a/src/charts/line.php b/src/charts/line.php
index ed342e8..d990c36 100644
--- a/src/charts/line.php
+++ b/src/charts/line.php
@@ -395,7 +395,9 @@ class ezcGraphLineChart extends ezcGraphChart
$this->options->highlightFont,
( $data->highlightValue[$key] ? $data->highlightValue[$key] : $value ),
$this->options->highlightSize + $this->options->highlightFont->padding * 2,
- ( $this->options->highlightLines ? $data->color[$key] : null )
+ ( $this->options->highlightLines ? $data->color[$key] : null ),
+ ( $this->options->highlightXOffset ? $this->options->highlightXOffset : 0 ),
+ ( $this->options->highlightYOffset ? $this->options->highlightYOffset : 0 )
);
}
diff --git a/src/element/axis.php b/src/element/axis.php
index d9b615e..f79965c 100644
--- a/src/element/axis.php
+++ b/src/element/axis.php
@@ -198,10 +198,10 @@ abstract class ezcGraphChartElementAxis extends ezcGraphChartElement
break;
case 'axisSpace':
if ( !is_numeric( $propertyValue ) ||
- ( $propertyValue < 0 ) ||
+ ( $propertyValue <= 0 ) ||
( $propertyValue > 1 ) )
{
- throw new ezcBaseValueException( $propertyName, $propertyValue, '0 <= float <= 1' );
+ throw new ezcBaseValueException( $propertyName, $propertyValue, '0 < float <= 1' );
}
$this->properties['axisSpace'] = (float) $propertyValue;
diff --git a/src/interfaces/renderer.php b/src/interfaces/renderer.php
index 8abbcfb..090b947 100644
--- a/src/interfaces/renderer.php
+++ b/src/interfaces/renderer.php
@@ -251,6 +251,8 @@ abstract class ezcGraphRenderer
* @param string $text Acutual value
* @param int $size Size of highlight text
* @param ezcGraphColor $markLines
+ * @param int $xOffset
+ * @param int $yOffset
* @return void
*/
abstract public function drawDataHighlightText(
@@ -263,7 +265,9 @@ abstract class ezcGraphRenderer
ezcGraphFontOptions $font,
$text,
$size,
- ezcGraphColor $markLines = null
+ ezcGraphColor $markLines = null,
+ $xOffset = 0,
+ $yOffset = 0
);
/**
diff --git a/src/options/line_chart.php b/src/options/line_chart.php
index fa963dd..b596efb 100644
--- a/src/options/line_chart.php
+++ b/src/options/line_chart.php
@@ -75,6 +75,8 @@ class ezcGraphLineChartOptions extends ezcGraphChartOptions
$this->properties['highlightFont'] = new ezcGraphFontOptions();
$this->properties['highlightFontCloned'] = false;
$this->properties['highlightSize'] = 14;
+ $this->properties['highlightXOffset'] = 0;
+ $this->properties['highlightYOffset'] = 0;
$this->properties['highlightLines'] = false;
$this->properties['stackBars'] = false;
@@ -110,7 +112,14 @@ class ezcGraphLineChartOptions extends ezcGraphChartOptions
{
throw new ezcBaseValueException( $propertyName, $propertyValue, 'int >= 1' );
}
-
+ $this->properties[$propertyName] = (int) $propertyValue;
+ break;
+ case 'highlightXOffset':
+ case 'highlightYOffset':
+ if ( !is_numeric ( $propertyValue ) )
+ {
+ throw new ezcBaseValueException( $propertyName, $propertyValue, 'int' );
+ }
$this->properties[$propertyName] = (int) $propertyValue;
break;
case 'fillLines':
diff --git a/src/renderer/2d.php b/src/renderer/2d.php
index a821d80..ac2ef93 100644
--- a/src/renderer/2d.php
+++ b/src/renderer/2d.php
@@ -946,6 +946,8 @@ class ezcGraphRenderer2d
* @param string $text Acutual value
* @param int $size Size of highlight text
* @param ezcGraphColor $markLines
+ * @param int $xOffset
+ * @param int $yOffset
* @return void
*/
public function drawDataHighlightText(
@@ -958,14 +960,16 @@ class ezcGraphRenderer2d
ezcGraphFontOptions $font,
$text,
$size,
- ezcGraphColor $markLines = null )
+ ezcGraphColor $markLines = null,
+ $xOffset = 0,
+ $yOffset = 0 )
{
$this->driver->options->font = $font;
$width = $boundings->width / $dataCount;
$dataPoint = new ezcGraphCoordinate(
- $boundings->x0 + ( $boundings->width ) * $end->x,
- $boundings->y0 + ( $boundings->height ) * $end->y
+ $boundings->x0 + ( $boundings->width ) * $end->x + $xOffset,
+ $boundings->y0 + ( $boundings->height ) * $end->y + $yOffset
);
if ( $end->y < $axisPosition )
diff --git a/src/renderer/3d.php b/src/renderer/3d.php
index cb0ed2a..311f55f 100644
--- a/src/renderer/3d.php
+++ b/src/renderer/3d.php
@@ -1550,6 +1550,8 @@ class ezcGraphRenderer3d
* @param string $text Acutual value
* @param int $size Size of highlight text
* @param ezcGraphColor $markLines
+ * @param int $xOffset
+ * @param int $yOffset
* @return void
*/
public function drawDataHighlightText(
@@ -1562,7 +1564,9 @@ class ezcGraphRenderer3d
ezcGraphFontOptions $font,
$text,
$size,
- ezcGraphColor $markLines = null )
+ ezcGraphColor $markLines = null,
+ $xOffset = 0,
+ $yOffset = 0 )
{
$this->driver->options->font = $font;
$width = $this->dataBoundings->width / $dataCount;
OpenPOWER on IntegriCloud