summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog8
-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
-rw-r--r--tests/axis_centered_renderer_test.php35
-rw-r--r--tests/data/compare/ezcGraphLineChartTest_testLineChartHighlightValueOffset.svg2
-rw-r--r--tests/line_test.php28
10 files changed, 105 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index cd11efe..ab3161a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+1.4beta2 - [RELEASEDATE]
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+- Implemented feature #014010: Possibility to set x/y offsets for
+ highlightValue
+ (Patch by Markus Lervik)
+
+
1.4beta1 - Monday 01 December 2008
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
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;
diff --git a/tests/axis_centered_renderer_test.php b/tests/axis_centered_renderer_test.php
index e3fffc8..5445944 100644
--- a/tests/axis_centered_renderer_test.php
+++ b/tests/axis_centered_renderer_test.php
@@ -68,6 +68,41 @@ class ezcGraphAxisCenteredRendererTest extends ezcTestCase
$chart->render( 500, 200 );
}
+ public function testRenderAxisGridZeroAxisSpace()
+ {
+ $chart = new ezcGraphLineChart();
+ $chart->palette = new ezcGraphPaletteBlack();
+ $chart->xAxis->axisLabelRenderer = new ezcGraphAxisCenteredLabelRenderer();
+ $chart->yAxis->axisLabelRenderer = new ezcGraphAxisNoLabelRenderer();
+ $chart->yAxis->axisSpace = 0.001;
+ $chart->data['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) );
+
+ $mockedRenderer = $this->getMock( 'ezcGraphRenderer2d', array(
+ 'drawGridLine',
+ ) );
+
+ $mockedRenderer
+ ->expects( $this->at( 0 ) )
+ ->method( 'drawGridLine' )
+ ->with(
+ $this->equalTo( new ezcGraphCoordinate( 200., 20. ), 1. ),
+ $this->equalTo( new ezcGraphCoordinate( 200., 180. ), 1. ),
+ $this->equalTo( ezcGraphColor::fromHex( '#888A85' ) )
+ );
+ $mockedRenderer
+ ->expects( $this->at( 3 ) )
+ ->method( 'drawGridLine' )
+ ->with(
+ $this->equalTo( new ezcGraphCoordinate( 500., 20. ), 1. ),
+ $this->equalTo( new ezcGraphCoordinate( 500., 180. ), 1. ),
+ $this->equalTo( ezcGraphColor::fromHex( '#888A85' ) )
+ );
+
+ $chart->renderer = $mockedRenderer;
+
+ $chart->render( 500, 200 );
+ }
+
public function testRenderAxisOuterGrid()
{
$chart = new ezcGraphLineChart();
diff --git a/tests/data/compare/ezcGraphLineChartTest_testLineChartHighlightValueOffset.svg b/tests/data/compare/ezcGraphLineChartTest_testLineChartHighlightValueOffset.svg
new file mode 100644
index 0000000..499d470
--- /dev/null
+++ b/tests/data/compare/ezcGraphLineChartTest_testLineChartHighlightValueOffset.svg
@@ -0,0 +1,2 @@
+<?xml version="1.0"?>
+<svg xmlns="http://www.w3.org/2000/svg" width="500" height="200" version="1.0" id="ezcGraph"><defs/><g id="ezcGraphChart" color-rendering="optimizeQuality" shape-rendering="geometricPrecision" text-rendering="optimizeLegibility"><path d=" M 0.0000,200.0000 L 0.0000,0.0000 L 500.0000,0.0000 L 500.0000,200.0000 L 0.0000,200.0000 z " style="fill: #eeeeec; fill-opacity: 1.00; stroke: none;" id="ezcGraphPolygon_1"/><path d=" M 0.0000,200.0000 L 0.0000,0.0000 L 100.0000,0.0000 L 100.0000,200.0000 L 0.0000,200.0000 z " style="fill: #000000; fill-opacity: 0.00; stroke: none;" id="ezcGraphPolygon_2"/><path d=" M 2.0000,16.0000 L 2.0000,2.0000 L 16.0000,2.0000 L 16.0000,16.0000 L 2.0000,16.0000 z " style="fill: #3465a4; fill-opacity: 1.00; stroke: none;" id="ezcGraphPolygon_3"/><path d=" M 100.0000,180.0000 L 500.0000,180.0000" style="fill: none; stroke: #2e3436; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_5"/><path d=" M 492.0000,176.0000 L 500.0000,180.0000 L 492.0000,184.0000 L 492.0000,176.0000 z " style="fill: #2e3436; fill-opacity: 1.00; stroke: none;" id="ezcGraphPolygon_6"/><path d=" M 140.0000,200.0000 L 140.0000,0.0000" style="fill: none; stroke: #2e3436; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_7"/><path d=" M 137.5000,5.0000 L 140.0000,0.0000 L 142.5000,5.0000 L 137.5000,5.0000 z " style="fill: #2e3436; fill-opacity: 1.00; stroke: none;" id="ezcGraphPolygon_8"/><path d=" M 220.0000,20.0000 L 220.0000,180.0000" style="fill: none; stroke: #000000; stroke-width: 1; stroke-opacity: 0.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_9"/><path d=" M 220.0000,177.0000 L 220.0000,180.0000" style="fill: none; stroke: #2e3436; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_10"/><path d=" M 300.0000,20.0000 L 300.0000,180.0000" style="fill: none; stroke: #000000; stroke-width: 1; stroke-opacity: 0.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_12"/><path d=" M 300.0000,177.0000 L 300.0000,180.0000" style="fill: none; stroke: #2e3436; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_13"/><path d=" M 380.0000,20.0000 L 380.0000,180.0000" style="fill: none; stroke: #000000; stroke-width: 1; stroke-opacity: 0.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_15"/><path d=" M 380.0000,177.0000 L 380.0000,180.0000" style="fill: none; stroke: #2e3436; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_16"/><path d=" M 460.0000,20.0000 L 460.0000,180.0000" style="fill: none; stroke: #000000; stroke-width: 1; stroke-opacity: 0.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_18"/><path d=" M 460.0000,177.0000 L 460.0000,180.0000" style="fill: none; stroke: #2e3436; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_19"/><path d=" M 140.0000,172.0000 L 460.0000,172.0000" style="fill: none; stroke: #000000; stroke-width: 1; stroke-opacity: 0.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_22"/><path d=" M 140.0000,172.0000 L 141.0000,172.0000" style="fill: none; stroke: #2e3436; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_23"/><path d=" M 140.0000,164.0000 L 460.0000,164.0000" style="fill: none; stroke: #000000; stroke-width: 1; stroke-opacity: 0.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_24"/><path d=" M 140.0000,164.0000 L 141.0000,164.0000" style="fill: none; stroke: #2e3436; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_25"/><path d=" M 140.0000,156.0000 L 460.0000,156.0000" style="fill: none; stroke: #000000; stroke-width: 1; stroke-opacity: 0.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_26"/><path d=" M 140.0000,156.0000 L 141.0000,156.0000" style="fill: none; stroke: #2e3436; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_27"/><path d=" M 140.0000,148.0000 L 460.0000,148.0000" style="fill: none; stroke: #000000; stroke-width: 1; stroke-opacity: 0.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_28"/><path d=" M 140.0000,148.0000 L 143.0000,148.0000" style="fill: none; stroke: #2e3436; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_29"/><path d=" M 140.0000,140.0000 L 460.0000,140.0000" style="fill: none; stroke: #000000; stroke-width: 1; stroke-opacity: 0.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_31"/><path d=" M 140.0000,140.0000 L 141.0000,140.0000" style="fill: none; stroke: #2e3436; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_32"/><path d=" M 140.0000,132.0000 L 460.0000,132.0000" style="fill: none; stroke: #000000; stroke-width: 1; stroke-opacity: 0.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_33"/><path d=" M 140.0000,132.0000 L 141.0000,132.0000" style="fill: none; stroke: #2e3436; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_34"/><path d=" M 140.0000,124.0000 L 460.0000,124.0000" style="fill: none; stroke: #000000; stroke-width: 1; stroke-opacity: 0.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_35"/><path d=" M 140.0000,124.0000 L 141.0000,124.0000" style="fill: none; stroke: #2e3436; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_36"/><path d=" M 140.0000,116.0000 L 460.0000,116.0000" style="fill: none; stroke: #000000; stroke-width: 1; stroke-opacity: 0.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_37"/><path d=" M 140.0000,116.0000 L 143.0000,116.0000" style="fill: none; stroke: #2e3436; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_38"/><path d=" M 140.0000,108.0000 L 460.0000,108.0000" style="fill: none; stroke: #000000; stroke-width: 1; stroke-opacity: 0.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_40"/><path d=" M 140.0000,108.0000 L 141.0000,108.0000" style="fill: none; stroke: #2e3436; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_41"/><path d=" M 140.0000,100.0000 L 460.0000,100.0000" style="fill: none; stroke: #000000; stroke-width: 1; stroke-opacity: 0.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_42"/><path d=" M 140.0000,100.0000 L 141.0000,100.0000" style="fill: none; stroke: #2e3436; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_43"/><path d=" M 140.0000,92.0000 L 460.0000,92.0000" style="fill: none; stroke: #000000; stroke-width: 1; stroke-opacity: 0.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_44"/><path d=" M 140.0000,92.0000 L 141.0000,92.0000" style="fill: none; stroke: #2e3436; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_45"/><path d=" M 140.0000,84.0000 L 460.0000,84.0000" style="fill: none; stroke: #000000; stroke-width: 1; stroke-opacity: 0.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_46"/><path d=" M 140.0000,84.0000 L 143.0000,84.0000" style="fill: none; stroke: #2e3436; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_47"/><path d=" M 140.0000,76.0000 L 460.0000,76.0000" style="fill: none; stroke: #000000; stroke-width: 1; stroke-opacity: 0.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_49"/><path d=" M 140.0000,76.0000 L 141.0000,76.0000" style="fill: none; stroke: #2e3436; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_50"/><path d=" M 140.0000,68.0000 L 460.0000,68.0000" style="fill: none; stroke: #000000; stroke-width: 1; stroke-opacity: 0.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_51"/><path d=" M 140.0000,68.0000 L 141.0000,68.0000" style="fill: none; stroke: #2e3436; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_52"/><path d=" M 140.0000,60.0000 L 460.0000,60.0000" style="fill: none; stroke: #000000; stroke-width: 1; stroke-opacity: 0.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_53"/><path d=" M 140.0000,60.0000 L 141.0000,60.0000" style="fill: none; stroke: #2e3436; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_54"/><path d=" M 140.0000,52.0000 L 460.0000,52.0000" style="fill: none; stroke: #000000; stroke-width: 1; stroke-opacity: 0.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_55"/><path d=" M 140.0000,52.0000 L 143.0000,52.0000" style="fill: none; stroke: #2e3436; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_56"/><path d=" M 140.0000,44.0000 L 460.0000,44.0000" style="fill: none; stroke: #000000; stroke-width: 1; stroke-opacity: 0.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_58"/><path d=" M 140.0000,44.0000 L 141.0000,44.0000" style="fill: none; stroke: #2e3436; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_59"/><path d=" M 140.0000,36.0000 L 460.0000,36.0000" style="fill: none; stroke: #000000; stroke-width: 1; stroke-opacity: 0.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_60"/><path d=" M 140.0000,36.0000 L 141.0000,36.0000" style="fill: none; stroke: #2e3436; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_61"/><path d=" M 140.0000,28.0000 L 460.0000,28.0000" style="fill: none; stroke: #000000; stroke-width: 1; stroke-opacity: 0.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_62"/><path d=" M 140.0000,28.0000 L 141.0000,28.0000" style="fill: none; stroke: #2e3436; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_63"/><path d=" M 140.0000,20.0000 L 460.0000,20.0000" style="fill: none; stroke: #000000; stroke-width: 1; stroke-opacity: 0.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_64"/><path d=" M 140.0000,20.0000 L 143.0000,20.0000" style="fill: none; stroke: #2e3436; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_65"/><path d=" M 140.0000,40.0000 L 140.0000,40.0000" style="fill: none; stroke: #3465a4; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_67"/><path d=" M 140.0000,40.0000 L 220.0000,168.9600" style="fill: none; stroke: #3465a4; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_69"/><path d=" M 220.0000,168.9600 L 300.0000,141.4720" style="fill: none; stroke: #3465a4; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_71"/><path d=" M 300.0000,141.4720 L 380.0000,172.6080" style="fill: none; stroke: #3465a4; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_73"/><path d=" M 380.0000,172.6080 L 460.0000,148.4160" style="fill: none; stroke: #3465a4; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_75"/><g id="ezcGraphTextBox_4"><path d=" M 16.5000,17.0000 L 16.5000,1.5000 L 62.5200,1.5000 L 62.5200,17.0000 L 16.5000,17.0000 z " style="fill: #ffffff; fill-opacity: 0.00; stroke: none;" id="ezcGraphPolygon_77"/><text id="ezcGraphTextBox_4_text" x="17.0000" text-length="44.5200px" y="13.9000" style="font-size: 14px; font-family: 'sans-serif'; fill: #2e3436; fill-opacity: 1.00; stroke: none;">sample</text></g><g id="ezcGraphTextBox_11"><path d=" M 213.1400,195.0000 L 213.1400,181.5000 L 227.3600,181.5000 L 227.3600,195.0000 L 213.1400,195.0000 z " style="fill: #ffffff; fill-opacity: 0.00; stroke: none;" id="ezcGraphPolygon_78"/><text id="ezcGraphTextBox_11_text" x="213.6400" text-length="12.7200px" y="192.2000" style="font-size: 12px; font-family: 'sans-serif'; fill: #2e3436; fill-opacity: 1.00; stroke: none;">IE</text></g><g id="ezcGraphTextBox_14"><path d=" M 283.6000,195.0000 L 283.6000,181.5000 L 316.9000,181.5000 L 316.9000,195.0000 L 283.6000,195.0000 z " style="fill: #ffffff; fill-opacity: 0.00; stroke: none;" id="ezcGraphPolygon_79"/><text id="ezcGraphTextBox_14_text" x="284.1000" text-length="31.8000px" y="192.2000" style="font-size: 12px; font-family: 'sans-serif'; fill: #2e3436; fill-opacity: 1.00; stroke: none;">Opera</text></g><g id="ezcGraphTextBox_17"><path d=" M 366.7800,195.0000 L 366.7800,181.5000 L 393.7200,181.5000 L 393.7200,195.0000 L 366.7800,195.0000 z " style="fill: #ffffff; fill-opacity: 0.00; stroke: none;" id="ezcGraphPolygon_80"/><text id="ezcGraphTextBox_17_text" x="367.2800" text-length="25.4400px" y="192.2000" style="font-size: 12px; font-family: 'sans-serif'; fill: #2e3436; fill-opacity: 1.00; stroke: none;">wget</text></g><g id="ezcGraphTextBox_20"><path d=" M 440.4200,195.0000 L 440.4200,181.5000 L 480.0800,181.5000 L 480.0800,195.0000 L 440.4200,195.0000 z " style="fill: #ffffff; fill-opacity: 0.00; stroke: none;" id="ezcGraphPolygon_81"/><text id="ezcGraphTextBox_20_text" x="440.9200" text-length="38.1600px" y="192.2000" style="font-size: 12px; font-family: 'sans-serif'; fill: #2e3436; fill-opacity: 1.00; stroke: none;">Safari</text></g><g id="ezcGraphTextBox_21"><path d=" M 130.0600,179.0000 L 130.0600,165.5000 L 139.0000,165.5000 L 139.0000,179.0000 L 130.0600,179.0000 z " style="fill: #ffffff; fill-opacity: 0.00; stroke: none;" id="ezcGraphPolygon_82"/><text id="ezcGraphTextBox_21_text" x="130.5600" text-length="7.4400px" y="176.2000" style="font-size: 12px; font-family: 'sans-serif'; fill: #2e3436; fill-opacity: 1.00; stroke: none;">0</text></g><g id="ezcGraphTextBox_30"><path d=" M 107.7400,147.0000 L 107.7400,133.5000 L 139.0000,133.5000 L 139.0000,147.0000 L 107.7400,147.0000 z " style="fill: #ffffff; fill-opacity: 0.00; stroke: none;" id="ezcGraphPolygon_83"/><text id="ezcGraphTextBox_30_text" x="108.2400" text-length="29.7600px" y="144.2000" style="font-size: 12px; font-family: 'sans-serif'; fill: #2e3436; fill-opacity: 1.00; stroke: none;">1000</text></g><g id="ezcGraphTextBox_39"><path d=" M 107.7400,115.0000 L 107.7400,101.5000 L 139.0000,101.5000 L 139.0000,115.0000 L 107.7400,115.0000 z " style="fill: #ffffff; fill-opacity: 0.00; stroke: none;" id="ezcGraphPolygon_84"/><text id="ezcGraphTextBox_39_text" x="108.2400" text-length="29.7600px" y="112.2000" style="font-size: 12px; font-family: 'sans-serif'; fill: #2e3436; fill-opacity: 1.00; stroke: none;">2000</text></g><g id="ezcGraphTextBox_48"><path d=" M 107.7400,83.0000 L 107.7400,69.5000 L 139.0000,69.5000 L 139.0000,83.0000 L 107.7400,83.0000 z " style="fill: #ffffff; fill-opacity: 0.00; stroke: none;" id="ezcGraphPolygon_85"/><text id="ezcGraphTextBox_48_text" x="108.2400" text-length="29.7600px" y="80.2000" style="font-size: 12px; font-family: 'sans-serif'; fill: #2e3436; fill-opacity: 1.00; stroke: none;">3000</text></g><g id="ezcGraphTextBox_57"><path d=" M 107.7400,51.0000 L 107.7400,37.5000 L 139.0000,37.5000 L 139.0000,51.0000 L 107.7400,51.0000 z " style="fill: #ffffff; fill-opacity: 0.00; stroke: none;" id="ezcGraphPolygon_86"/><text id="ezcGraphTextBox_57_text" x="108.2400" text-length="29.7600px" y="48.2000" style="font-size: 12px; font-family: 'sans-serif'; fill: #2e3436; fill-opacity: 1.00; stroke: none;">4000</text></g><g id="ezcGraphTextBox_66"><path d=" M 107.7400,35.0000 L 107.7400,21.5000 L 139.0000,21.5000 L 139.0000,35.0000 L 107.7400,35.0000 z " style="fill: #ffffff; fill-opacity: 0.00; stroke: none;" id="ezcGraphPolygon_87"/><text id="ezcGraphTextBox_66_text" x="108.2400" text-length="29.7600px" y="32.2000" style="font-size: 12px; font-family: 'sans-serif'; fill: #2e3436; fill-opacity: 1.00; stroke: none;">5000</text></g><g id="ezcGraphTextBox_68"><path d=" M 142.1400,25.0000 L 142.1400,9.5000 L 178.3600,9.5000 L 178.3600,25.0000 L 142.1400,25.0000 z " style="fill: #ffffff; fill-opacity: 0.00; stroke: none;" id="ezcGraphPolygon_88"/><text id="ezcGraphTextBox_68_text" x="142.6400" text-length="34.7200px" y="21.9000" style="font-size: 14px; font-family: 'sans-serif'; fill: #2e3436; fill-opacity: 1.00; stroke: none;">4375</text></g><g id="ezcGraphTextBox_70"><path d=" M 226.4800,153.9600 L 226.4800,138.4600 L 254.0200,138.4600 L 254.0200,153.9600 L 226.4800,153.9600 z " style="fill: #ffffff; fill-opacity: 0.00; stroke: none;" id="ezcGraphPolygon_89"/><text id="ezcGraphTextBox_70_text" x="226.9800" text-length="26.0400px" y="150.8600" style="font-size: 14px; font-family: 'sans-serif'; fill: #2e3436; fill-opacity: 1.00; stroke: none;">345</text></g><g id="ezcGraphTextBox_72"><path d=" M 297.2400,126.4720 L 297.2400,110.9720 L 343.2600,110.9720 L 343.2600,126.4720 L 297.2400,126.4720 z " style="fill: #ffffff; fill-opacity: 0.00; stroke: none;" id="ezcGraphPolygon_90"/><text id="ezcGraphTextBox_72_text" x="297.7400" text-length="44.5200px" y="123.3720" style="font-size: 14px; font-family: 'sans-serif'; fill: #2e3436; fill-opacity: 1.00; stroke: none;">Opera!</text></g><g id="ezcGraphTextBox_74"><path d=" M 386.4800,157.6080 L 386.4800,142.1080 L 414.0200,142.1080 L 414.0200,157.6080 L 386.4800,157.6080 z " style="fill: #ffffff; fill-opacity: 0.00; stroke: none;" id="ezcGraphPolygon_91"/><text id="ezcGraphTextBox_74_text" x="386.9800" text-length="26.0400px" y="154.5080" style="font-size: 14px; font-family: 'sans-serif'; fill: #2e3436; fill-opacity: 1.00; stroke: none;">231</text></g><g id="ezcGraphTextBox_76"><path d=" M 466.4800,133.4160 L 466.4800,117.9160 L 494.0200,117.9160 L 494.0200,133.4160 L 466.4800,133.4160 z " style="fill: #ffffff; fill-opacity: 0.00; stroke: none;" id="ezcGraphPolygon_92"/><text id="ezcGraphTextBox_76_text" x="466.9800" text-length="26.0400px" y="130.3160" style="font-size: 14px; font-family: 'sans-serif'; fill: #2e3436; fill-opacity: 1.00; stroke: none;">987</text></g></g></svg>
diff --git a/tests/line_test.php b/tests/line_test.php
index 72ae0b8..2c1e029 100644
--- a/tests/line_test.php
+++ b/tests/line_test.php
@@ -882,6 +882,34 @@ class ezcGraphLineChartTest extends ezcGraphTestCase
);
}
+ public function testLineChartHighlightValueOffset()
+ {
+ $filename = $this->tempDir . __FUNCTION__ . '.svg';
+
+ $chart = new ezcGraphLineChart();
+ $chart->data['sample'] = new ezcGraphArrayDataSet( array(
+ 'Mozilla' => 4375,
+ 'IE' => 345,
+ 'Opera' => 1204,
+ 'wget' => 231,
+ 'Safari' => 987,
+ ) );
+
+ $chart->data['sample']->highlight = true;
+ $chart->data['sample']->highlightValue['Opera'] = 'Opera!';
+
+ $chart->options->highlightXOffset = 20;
+ $chart->options->highlightYOffset = -10;
+
+ $chart->driver = new ezcGraphSvgDriver();
+ $chart->render( 500, 200, $filename );
+
+ $this->compare(
+ $filename,
+ $this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.svg'
+ );
+ }
+
public function testLineChartHighlightFontPadding()
{
$filename = $this->tempDir . __FUNCTION__ . '.svg';
OpenPOWER on IntegriCloud