highlightOffset.patch (3.1 kb) added by Markus Lervik
Description: Patch allowing you to set x/y offsets for highlightValue in 2d graphs
Index: charts/line.php
===================================================================
--- charts/line.php (revision 2289)
+++ charts/line.php (revision 2290)
@@ -394,7 +394,9 @@
$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 )
);
}
Index: options/line_chart.php
===================================================================
--- options/line_chart.php (revision 2289)
+++ options/line_chart.php (revision 2290)
@@ -64,6 +64,8 @@
$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;
@@ -99,9 +101,16 @@
{
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 >= 1' );
+ }
+ $this->properties[$propertyName] = (int) $propertyValue;
+ break;
case 'fillLines':
if ( ( $propertyValue !== false ) &&
!is_numeric( $propertyValue ) ||
Index: renderer/2d.php
===================================================================
--- renderer/2d.php (revision 2289)
+++ renderer/2d.php (revision 2290)
@@ -958,14 +958,17 @@
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 )