summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKore Nordmann <github@kore-nordmann.de>2007-03-08 12:01:24 +0000
committerKore Nordmann <github@kore-nordmann.de>2007-03-08 12:01:24 +0000
commitb08ae56b53938333b051b91b0a1f912428864950 (patch)
tree68f089c05feab87cbaf0c3cfcd36407b3cce755f
parenteff7a30681180181dc22b9500e6db45a7a916183 (diff)
downloadzetacomponents-graph-b08ae56b53938333b051b91b0a1f912428864950.zip
zetacomponents-graph-b08ae56b53938333b051b91b0a1f912428864950.tar.gz
- Added feature #9511: Added helper functions to create image maps an link SVG
images in ezcGraphTools
-rw-r--r--ChangeLog2
-rw-r--r--src/charts/line.php10
-rw-r--r--src/charts/pie.php4
-rw-r--r--src/datasets/base.php4
-rw-r--r--src/element/legend.php2
-rw-r--r--src/exceptions/incompatible_driver.php26
-rw-r--r--src/exceptions/not_rendered.php25
-rw-r--r--src/graph_autoload.php3
-rw-r--r--src/interfaces/chart.php17
-rw-r--r--src/options/svg_driver.php6
-rw-r--r--src/renderer/2d.php2
-rw-r--r--src/structs/context.php17
-rw-r--r--src/tools.php176
-rw-r--r--tests/data/compare/ezcGraphToolsTest_testLineChartImageMap.html10
-rw-r--r--tests/data/compare/ezcGraphToolsTest_testLineChartSvgLinking.svg2
-rw-r--r--tests/data/compare/ezcGraphToolsTest_testPieChartImageMap.html22
-rw-r--r--tests/data/compare/ezcGraphToolsTest_testPieChartImageMapCustomName.html22
-rw-r--r--tests/data/compare/ezcGraphToolsTest_testPieChartSvgLinking.svg2
-rw-r--r--tests/driver_svg_test.php22
-rw-r--r--tests/struct_test.php45
-rw-r--r--tests/suite.php88
-rw-r--r--tests/tools_test.php266
22 files changed, 721 insertions, 52 deletions
diff --git a/ChangeLog b/ChangeLog
index 778f4c6..6a86247 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -21,6 +21,8 @@
number > 10) + 1 labels
- Added feature #10375: Manually reduce or increase the label count on
labeled axis
+- Added feature #9511: Added helper functions to create image maps an link SVG
+ images in ezcGraphTools
1.0 - Monday 18 December 2006
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/src/charts/line.php b/src/charts/line.php
index 0f5aa42..f58d1c6 100644
--- a/src/charts/line.php
+++ b/src/charts/line.php
@@ -195,7 +195,7 @@ class ezcGraphLineChart extends ezcGraphChart
$renderer->drawDataLine(
$boundings,
- new ezcGraphContext( $datasetName, $key ),
+ new ezcGraphContext( $datasetName, $key, $data->url[$key] ),
$data->color->default,
( $lastPoint === false ? $point : $lastPoint ),
$point,
@@ -211,7 +211,7 @@ class ezcGraphLineChart extends ezcGraphChart
{
$renderer->drawDataHighlightText(
$boundings,
- new ezcGraphContext( $datasetName, $key ),
+ new ezcGraphContext( $datasetName, $key, $data->url[$key] ),
$point,
$yAxisNullPosition,
$nr[$data->displayType->default],
@@ -254,7 +254,7 @@ class ezcGraphLineChart extends ezcGraphChart
$renderer->drawBar(
$boundings,
- new ezcGraphContext( $datasetName, $key ),
+ new ezcGraphContext( $datasetName, $key, $data->url[$key] ),
$data->color->default,
$point = $this->elements['xAxis']->axisLabelRenderer->modifyChartDataPosition(
$this->elements['yAxis']->axisLabelRenderer->modifyChartDataPosition(
@@ -272,7 +272,7 @@ class ezcGraphLineChart extends ezcGraphChart
{
$renderer->drawDataHighlightText(
$boundings,
- new ezcGraphContext( $datasetName, $key ),
+ new ezcGraphContext( $datasetName, $key, $data->url[$key] ),
$point,
$yAxisNullPosition,
$nr[$data->displayType->default],
@@ -399,6 +399,8 @@ class ezcGraphLineChart extends ezcGraphChart
{
$this->renderer->render( $file );
}
+
+ $this->renderedFile = $file;
}
/**
diff --git a/src/charts/pie.php b/src/charts/pie.php
index 7ec1d7a..782ad32 100644
--- a/src/charts/pie.php
+++ b/src/charts/pie.php
@@ -107,7 +107,7 @@ class ezcGraphPieChart extends ezcGraphChart
$renderer->drawPieSegment(
$boundings,
- new ezcGraphContext( $datasetName, $label ),
+ new ezcGraphContext( $datasetName, $label, $dataset->url[$label] ),
$dataset->color[$label],
$angle,
$angle += $value / $sum * 360,
@@ -249,6 +249,8 @@ class ezcGraphPieChart extends ezcGraphChart
{
$this->renderer->render( $file );
}
+
+ $this->renderedFile = $file;
}
/**
diff --git a/src/datasets/base.php b/src/datasets/base.php
index 7810c4d..277146e 100644
--- a/src/datasets/base.php
+++ b/src/datasets/base.php
@@ -21,6 +21,8 @@
* Status if datapoint element is hilighted
* @property int $displayType
* Display type of chart data
+ * @property string $url
+ * URL associated with datapoint
*
* @package Graph
* @access private
@@ -71,6 +73,7 @@ abstract class ezcGraphDataSet implements ArrayAccess, Iterator, Countable
$this->properties['symbol'] = new ezcGraphDataSetIntProperty( $this );
$this->properties['highlight'] = new ezcGraphDataSetBooleanProperty( $this );
$this->properties['displayType'] = new ezcGraphDataSetIntProperty( $this );
+ $this->properties['url'] = new ezcGraphDataSetStringProperty( $this );
$this->properties['highlight']->default = false;
}
@@ -94,6 +97,7 @@ abstract class ezcGraphDataSet implements ArrayAccess, Iterator, Countable
case 'hilight':
$propertyName = 'highlight';
case 'label':
+ case 'url':
case 'color':
case 'symbol':
case 'highlight':
diff --git a/src/element/legend.php b/src/element/legend.php
index 3ed1060..8cf7473 100644
--- a/src/element/legend.php
+++ b/src/element/legend.php
@@ -167,6 +167,7 @@ class ezcGraphChartElementLegend extends ezcGraphChartElement
{
$this->labels[] = array(
'label' => $dataset->label->default,
+ 'url' => $dataset->url->default,
'color' => $dataset->color->default,
'symbol' => ( $dataset->symbol->default === null ?
ezcGraph::NO_SYMBOL :
@@ -188,6 +189,7 @@ class ezcGraphChartElementLegend extends ezcGraphChartElement
{
$this->labels[] = array(
'label' => $label,
+ 'url' => $dataset->url[$label],
'color' => $dataset->color[$label],
'symbol' => ( $dataset->symbol[$label] === null ?
ezcGraph::NO_SYMBOL :
diff --git a/src/exceptions/incompatible_driver.php b/src/exceptions/incompatible_driver.php
new file mode 100644
index 0000000..16fe6aa
--- /dev/null
+++ b/src/exceptions/incompatible_driver.php
@@ -0,0 +1,26 @@
+<?php
+/**
+ * File containing the ezcGraphToolsIncompatibleDriverException class
+ *
+ * @package Graph
+ * @version //autogen//
+ * @copyright Copyright (C) 2005-2007 eZ systems as. All rights reserved.
+ * @license http://ez.no/licenses/new_bsd New BSD License
+ */
+/**
+ * Exception thrown when trying to modify rendered images with incompatible
+ * graph tools.
+ *
+ * @package Graph
+ * @version //autogen//
+ */
+class ezcGraphToolsIncompatibleDriverException extends ezcGraphException
+{
+ public function __construct( $driver, $accepted )
+ {
+ $driverClass = get_class( $driver );
+ parent::__construct( "Incompatible driver used. Driver '{$driverClass}' is not an instance of '{$accepted}'." );
+ }
+}
+
+?>
diff --git a/src/exceptions/not_rendered.php b/src/exceptions/not_rendered.php
new file mode 100644
index 0000000..8b53e95
--- /dev/null
+++ b/src/exceptions/not_rendered.php
@@ -0,0 +1,25 @@
+<?php
+/**
+ * File containing the ezcGraphToolsNotRenderedException class
+ *
+ * @package Graph
+ * @version //autogen//
+ * @copyright Copyright (C) 2005-2007 eZ systems as. All rights reserved.
+ * @license http://ez.no/licenses/new_bsd New BSD License
+ */
+/**
+ * Exception thrown when a chart was not rendered yet, but the graph tool
+ * requires information only available in rendered charts.
+ *
+ * @package Graph
+ * @version //autogen//
+ */
+class ezcGraphToolsNotRenderedException extends ezcGraphException
+{
+ public function __construct( $chart )
+ {
+ parent::__construct( "Chart is not yet rendered." );
+ }
+}
+
+?>
diff --git a/src/graph_autoload.php b/src/graph_autoload.php
index 757df48..8c9e6c9 100644
--- a/src/graph_autoload.php
+++ b/src/graph_autoload.php
@@ -11,6 +11,9 @@
return array(
'ezcGraph' => 'Graph/graph.php',
+ 'ezcGraphTools' => 'Graph/tools.php',
+ 'ezcGraphToolsIncompatibleDriverException' => 'Graph/exceptions/incompatible_driver.php',
+ 'ezcGraphToolsNotRenderedException' => 'Graph/exceptions/not_rendered.php',
'ezcGraphException' => 'Graph/exceptions/exception.php',
'ezcGraphChart' => 'Graph/interfaces/chart.php',
diff --git a/src/interfaces/chart.php b/src/interfaces/chart.php
index 32f4ca0..3195938 100644
--- a/src/interfaces/chart.php
+++ b/src/interfaces/chart.php
@@ -65,6 +65,13 @@ abstract class ezcGraphChart
protected $renderElement;
/**
+ * Contains the filename of the rendered file, if rendered.
+ *
+ * @var mixed
+ */
+ protected $renderedFile;
+
+ /**
* Constructor
*
* @param array $options Default option array
@@ -249,6 +256,16 @@ abstract class ezcGraphChart
abstract public function getDefaultDisplayType();
/**
+ * Return filename of rendered file, and false if no file was yet rendered.
+ *
+ * @return mixed
+ */
+ public function getRenderedFile()
+ {
+ return ( $this->renderedFile !== null ? $this->renderedFile : false );
+ }
+
+ /**
* Renders this chart
*
* Creates basic visual chart elements from the chart to be processed by
diff --git a/src/options/svg_driver.php b/src/options/svg_driver.php
index f7c2f12..9007252 100644
--- a/src/options/svg_driver.php
+++ b/src/options/svg_driver.php
@@ -49,6 +49,8 @@
* Offset of the graph in the svg.
* @property string $idPrefix
* Prefix used for the ids in SVG documents.
+ * @property string $linkCursor
+ * CSS value for cursor property used for linked SVG elements
*
* @package Graph
*/
@@ -75,6 +77,7 @@ class ezcGraphSvgDriverOptions extends ezcGraphDriverOptions
$this->properties['insertIntoGroup'] = false;
$this->properties['graphOffset'] = new ezcGraphCoordinate( 0, 0 );
$this->properties['idPrefix'] = 'ezcGraph';
+ $this->properties['linkCursor'] = 'pointer';
parent::__construct( $options );
}
@@ -234,6 +237,9 @@ class ezcGraphSvgDriverOptions extends ezcGraphDriverOptions
case 'encoding':
$this->properties['encoding'] = (string) $propertyValue;
break;
+ case 'linkCursor':
+ $this->properties['linkCursor'] = (string) $propertyValue;
+ break;
default:
parent::__set( $propertyName, $propertyValue );
break;
diff --git a/src/renderer/2d.php b/src/renderer/2d.php
index c509c7c..384bd87 100644
--- a/src/renderer/2d.php
+++ b/src/renderer/2d.php
@@ -791,6 +791,8 @@ class ezcGraphRenderer2d extends ezcGraphRenderer
$labelPosition = new ezcGraphCoordinate( $boundings->x0, $boundings->y0 );
foreach ( $labels as $label )
{
+ $this->elements['legend_url'][$label['label']] = $label['url'];
+
$this->elements['legend'][$label['label']]['symbol'] = $this->drawSymbol(
new ezcGraphBoundings(
$labelPosition->x + $legend->padding,
diff --git a/src/structs/context.php b/src/structs/context.php
index 8fe881a..cdef482 100644
--- a/src/structs/context.php
+++ b/src/structs/context.php
@@ -29,6 +29,13 @@ class ezcGraphContext extends ezcBaseStruct
public $datapoint = false;
/**
+ * Associated URL for datapoint
+ *
+ * @var string
+ */
+ public $url;
+
+ /**
* Simple constructor
*
* @param string $dataset Name of dataset
@@ -36,10 +43,11 @@ class ezcGraphContext extends ezcBaseStruct
* @return void
* @ignore
*/
- public function __construct( $dataset = false, $datapoint = false )
+ public function __construct( $dataset = false, $datapoint = false, $url = null )
{
$this->dataset = $dataset;
$this->datapoint = $datapoint;
+ $this->url = $url;
}
/**
@@ -53,6 +61,13 @@ class ezcGraphContext extends ezcBaseStruct
{
$this->dataset = (string) $properties['dataset'];
$this->datapoint = (string) $properties['datapoint'];
+
+ // Check to keep BC
+ // @TODO: Remvove unnesecary check on next major version
+ if ( array_key_exists( 'url', $properties ) )
+ {
+ $this->url = (string) $properties['url'];
+ }
}
}
diff --git a/src/tools.php b/src/tools.php
new file mode 100644
index 0000000..690a47f
--- /dev/null
+++ b/src/tools.php
@@ -0,0 +1,176 @@
+<?php
+/**
+ * File containing the abstract ezcGraph class
+ *
+ * @package Graph
+ * @version //autogentag//
+ * @copyright Copyright (C) 2005-2007 eZ systems as. All rights reserved.
+ * @license http://ez.no/licenses/new_bsd New BSD License
+ */
+/**
+ * Toolkit for several operation with graphs
+ *
+ * @package Graph
+ * @mainclass
+ */
+class ezcGraphTools
+{
+ /**
+ * Create an XHtml image map from a chart with gd driver. The name of the
+ * image map can be specified and will be ezcGraphImageMap otherwise.
+ *
+ * @param ezcGraphChart $chart
+ * @param string $name
+ * @return string
+ */
+ public static function createImageMap( ezcGraphChart $chart, $name = null )
+ {
+ if ( $name === null )
+ {
+ $name = 'ezcGraphImageMap';
+ }
+
+ if ( ! ( $chart->driver instanceof ezcGraphGdDriver ) )
+ {
+ throw new ezcGraphToolsIncompatibleDriverException( $chart->driver, 'ezcGraphGdDriver' );
+ }
+
+ $elements = $chart->renderer->getElementReferences();
+
+ if ( !count( $elements ) )
+ {
+ throw new ezcGraphToolsNotRenderedException( $chart );
+ }
+
+ $imageMap = sprintf( "<map name=\"%s\">\n", $name );
+
+ // Iterate over legends elements
+ foreach ( $elements['legend'] as $objectName => $polygones )
+ {
+ $url = $elements['legend_url'][$objectName];
+
+ if ( empty( $url ) )
+ {
+ continue;
+ }
+
+ foreach ( $polygones as $shape => $polygone )
+ {
+ $coordinateString = '';
+ foreach ( $polygone as $coordinate )
+ {
+ $coordinateString .= sprintf( '%d,%d,', $coordinate->x, $coordinate->y );
+ }
+
+ $imageMap .= sprintf( "\t<area shape=\"poly\" coords=\"%s\" href=\"%s\" alt=\"%s\" />\n",
+ substr( $coordinateString, 0, -1 ),
+ $url,
+ $objectName
+ );
+ }
+ }
+
+ // Iterate over data
+ foreach ( $elements['data'] as $dataset => $datapoints )
+ {
+ foreach ( $datapoints as $datapoint => $polygones )
+ {
+ $url = $chart->data[$dataset]->url[$datapoint];
+
+ if ( empty( $url ) )
+ {
+ continue;
+ }
+
+ foreach ( $polygones as $polygon )
+ {
+ $coordinateString = '';
+ foreach ( $polygon as $coordinate )
+ {
+ $coordinateString .= sprintf( '%d,%d,', $coordinate->x, $coordinate->y );
+ }
+
+ $imageMap .= sprintf( "\t<area shape=\"poly\" coords=\"%s\" href=\"%s\" alt=\"%s\" />\n",
+ substr( $coordinateString, 0, -1 ),
+ $url,
+ $datapoint
+ );
+ }
+ }
+ }
+
+ return $imageMap . "</map>\n";
+ }
+
+ /**
+ * Add links to clickable SVG elements in a chart with SVG driver.
+ *
+ * @param ezcGraphChart $chart
+ * @return void
+ */
+ public static function linkSvgElements( ezcGraphChart $chart )
+ {
+ if ( ! ( $chart->driver instanceof ezcGraphSvgDriver ) )
+ {
+ throw new ezcGraphToolsIncompatibleDriverException( $chart->driver, 'ezcGraphSvgDriver' );
+ }
+
+ $fileName = $chart->getRenderedFile();
+
+ if ( !$fileName )
+ {
+ throw new ezcGraphToolsNotRenderedException( $chart );
+ }
+
+ $dom = new DOMDocument();
+ $dom->load( $fileName );
+ $xpath = new DomXPath( $dom );
+
+ $elements = $chart->renderer->getElementReferences();
+
+ // Link chart elements
+ foreach ( $elements['data'] as $dataset => $datapoints )
+ {
+ foreach( $datapoints as $datapoint => $ids )
+ {
+ $url = $chart->data[$dataset]->url[$datapoint];
+
+ if ( empty( $url ) )
+ {
+ continue;
+ }
+
+ foreach ( $ids as $id )
+ {
+ $element = $xpath->query( '//*[@id = \'' . $id . '\']' )->item( 0 );
+
+ $element->setAttribute( 'style', $element->getAttribute( 'style' ) . ' cursor: pointer;' );
+ $element->setAttribute( 'onclick', "top.location = '{$url}'" );
+ }
+ }
+ }
+
+ // Link legend elements
+ foreach ( $elements['legend'] as $objectName => $ids )
+ {
+ $url = $elements['legend_url'][$objectName];
+
+ if ( empty( $url ) )
+ {
+ continue;
+ }
+
+ foreach ( $ids as $id )
+ {
+ $element = $xpath->query( '//*[@id = \'' . $id . '\']' )->item( 0 );
+
+ $element->setAttribute( 'style', $element->getAttribute( 'style' ) . ' cursor: pointer;' );
+ $element->setAttribute( 'onclick', "top.location = '{$url}'" );
+ }
+ }
+
+ $dom->save( $fileName );
+ }
+}
+
+?>
diff --git a/tests/data/compare/ezcGraphToolsTest_testLineChartImageMap.html b/tests/data/compare/ezcGraphToolsTest_testLineChartImageMap.html
new file mode 100644
index 0000000..67d845a
--- /dev/null
+++ b/tests/data/compare/ezcGraphToolsTest_testLineChartImageMap.html
@@ -0,0 +1,10 @@
+<map name="ezcGraphImageMap">
+ <area shape="poly" coords="18,11,17,12,17,13,17,14,16,15,15,16,14,17,13,17,12,17,11,18,9,17,8,17,7,17,6,16,5,15,4,14,4,13,4,12,4,11,4,9,4,8,4,7,5,6,6,5,7,4,8,4,9,4,10,4,12,4,13,4,14,4,15,5,16,6,17,7,17,8,17,9" href="http://example.org/line_1" alt="Line 1" />
+ <area shape="poly" coords="19,4,96,4,96,18,19,18" href="http://example.org/line_1" alt="Line 1" />
+ <area shape="poly" coords="143,130,142,130,142,131,142,131,142,132,141,132,141,132,141,132,140,133,140,133,139,133,138,132,138,132,138,132,137,132,137,131,137,131,137,130,137,130,137,129,137,129,137,128,137,128,138,127,138,127,138,127,139,127,140,127,140,127,141,127,141,127,141,127,142,128,142,128,142,129,142,129" href="http://example.org/line_1" alt="sample 1" />
+ <area shape="poly" coords="223,175,222,176,222,176,222,177,222,177,221,177,221,178,221,178,220,178,220,178,219,178,218,178,218,178,218,177,217,177,217,177,217,176,217,176,217,175,217,174,217,174,217,174,217,173,218,173,218,172,218,172,219,172,220,172,220,172,221,172,221,172,221,173,222,173,222,174,222,174,222,174" href="http://example.org/line_1" alt="sample 2" />
+ <area shape="poly" coords="303,110,302,111,302,111,302,112,302,112,301,113,301,113,301,113,300,113,300,113,299,113,298,113,298,113,298,113,297,112,297,112,297,111,297,111,297,110,297,110,297,109,297,109,297,108,298,108,298,108,298,108,299,107,300,107,300,107,301,108,301,108,301,108,302,108,302,109,302,109,302,110" href="http://example.org/line_1" alt="sample 3" />
+ <area shape="poly" coords="383,154,382,154,382,155,382,155,382,156,381,156,381,156,381,157,380,157,380,157,379,157,378,157,378,156,378,156,377,156,377,155,377,155,377,154,377,154,377,153,377,153,377,152,377,152,378,152,378,151,378,151,379,151,380,151,380,151,381,151,381,151,381,152,382,152,382,152,382,153,382,153" href="http://example.org/line_1" alt="sample 4" />
+ <area shape="poly" coords="463,179,462,180,462,180,462,181,462,181,461,182,461,182,461,182,460,182,460,182,459,182,458,182,458,182,458,182,457,181,457,181,457,180,457,180,457,179,457,179,457,178,457,178,457,177,458,177,458,177,458,176,459,176,460,176,460,176,461,176,461,177,461,177,462,177,462,178,462,178,462,179" href="http://example.org/line_1" alt="sample 5" />
+ <area shape="poly" coords="303,116,302,116,302,117,302,117,302,118,301,118,301,119,301,119,300,119,300,119,299,119,298,119,298,119,298,118,297,118,297,117,297,117,297,116,297,116,297,115,297,115,297,114,297,114,298,114,298,113,298,113,299,113,300,113,300,113,301,113,301,113,301,114,302,114,302,114,302,115,302,115" href="http://example.org/line_2/sample_3" alt="sample 3" />
+</map>
diff --git a/tests/data/compare/ezcGraphToolsTest_testLineChartSvgLinking.svg b/tests/data/compare/ezcGraphToolsTest_testLineChartSvgLinking.svg
new file mode 100644
index 0000000..47255ea
--- /dev/null
+++ b/tests/data/compare/ezcGraphToolsTest_testLineChartSvgLinking.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: #2e3436; fill-opacity: 1.00; stroke: none;" id="ezcGraphPolygon_1"/><path d=" M 1.0000,199.0000 L 1.0000,1.0000 L 99.0000,1.0000 L 99.0000,199.0000 L 1.0000,199.0000 z " style="fill: #000000; fill-opacity: 0.00; stroke: none;" id="ezcGraphPolygon_2"/><path d=" M 1.5000,1.5000 L 98.5000,1.5000 L 98.5000,198.5000 L 1.5000,198.5000 L 1.5000,1.5000 z " style="fill: none; stroke: #555753; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphPolygon_3"/><ellipse cx="11" cy="11" rx="7" ry="7" style="fill: #729fcf; fill-opacity: 1.00; stroke: none; cursor: pointer;" id="ezcGraphCircle_4" onclick="top.location = 'http://example.org/line_1'"/><ellipse cx="11" cy="29" rx="7" ry="7" style="fill: #ef2929; fill-opacity: 1.00; stroke: none;" id="ezcGraphCircle_6"/><path d=" M 100.0000,180.0000 L 500.0000,180.0000" style="fill: none; stroke: #eeeeec; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_8"/><path d=" M 492.0000,184.0000 L 500.0000,180.0000 L 492.0000,176.0000 L 492.0000,184.0000 z " style="fill: #eeeeec; fill-opacity: 1.00; stroke: none;" id="ezcGraphPolygon_9"/><path d=" M 140.0000,200.0000 L 140.0000,0.0000" style="fill: none; stroke: #eeeeec; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_10"/><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: #eeeeec; fill-opacity: 1.00; stroke: none;" id="ezcGraphPolygon_11"/><path d=" M 220.0000,20.0000 L 220.0000,180.0000" style="fill: none; stroke: #888a85; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_12"/><path d=" M 220.0000,177.0000 L 220.0000,180.0000" style="fill: none; stroke: #eeeeec; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_13"/><path d=" M 300.0000,20.0000 L 300.0000,180.0000" style="fill: none; stroke: #888a85; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_15"/><path d=" M 300.0000,177.0000 L 300.0000,180.0000" style="fill: none; stroke: #eeeeec; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_16"/><path d=" M 380.0000,20.0000 L 380.0000,180.0000" style="fill: none; stroke: #888a85; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_18"/><path d=" M 380.0000,177.0000 L 380.0000,180.0000" style="fill: none; stroke: #eeeeec; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_19"/><path d=" M 460.0000,20.0000 L 460.0000,180.0000" style="fill: none; stroke: #888a85; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_21"/><path d=" M 460.0000,177.0000 L 460.0000,180.0000" style="fill: none; stroke: #eeeeec; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_22"/><path d=" M 140.0000,168.8000 L 460.0000,168.8000" style="fill: none; stroke: #888a85; stroke-width: 1; stroke-opacity: 0.47; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_25"/><path d=" M 140.0000,169.3333 L 141.0000,169.3333" style="fill: none; stroke: #eeeeec; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_26"/><path d=" M 140.0000,159.2000 L 460.0000,159.2000" style="fill: none; stroke: #888a85; stroke-width: 1; stroke-opacity: 0.47; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_27"/><path d=" M 140.0000,158.6667 L 141.0000,158.6667" style="fill: none; stroke: #eeeeec; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_28"/><path d=" M 140.0000,148.0000 L 460.0000,148.0000" style="fill: none; stroke: #888a85; stroke-width: 1; stroke-opacity: 0.47; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_29"/><path d=" M 140.0000,148.0000 L 141.0000,148.0000" style="fill: none; stroke: #eeeeec; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_30"/><path d=" M 140.0000,136.8000 L 460.0000,136.8000" style="fill: none; stroke: #888a85; stroke-width: 1; stroke-opacity: 0.47; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_31"/><path d=" M 140.0000,137.3333 L 141.0000,137.3333" style="fill: none; stroke: #eeeeec; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_32"/><path d=" M 140.0000,127.2000 L 460.0000,127.2000" style="fill: none; stroke: #888a85; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_33"/><path d=" M 140.0000,126.6667 L 143.0000,126.6667" style="fill: none; stroke: #eeeeec; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_34"/><path d=" M 140.0000,116.0000 L 460.0000,116.0000" style="fill: none; stroke: #888a85; stroke-width: 1; stroke-opacity: 0.47; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_36"/><path d=" M 140.0000,116.0000 L 141.0000,116.0000" style="fill: none; stroke: #eeeeec; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_37"/><path d=" M 140.0000,104.8000 L 460.0000,104.8000" style="fill: none; stroke: #888a85; stroke-width: 1; stroke-opacity: 0.47; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_38"/><path d=" M 140.0000,105.3333 L 141.0000,105.3333" style="fill: none; stroke: #eeeeec; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_39"/><path d=" M 140.0000,95.2000 L 460.0000,95.2000" style="fill: none; stroke: #888a85; stroke-width: 1; stroke-opacity: 0.47; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_40"/><path d=" M 140.0000,94.6667 L 141.0000,94.6667" style="fill: none; stroke: #eeeeec; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_41"/><path d=" M 140.0000,84.0000 L 460.0000,84.0000" style="fill: none; stroke: #888a85; stroke-width: 1; stroke-opacity: 0.47; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_42"/><path d=" M 140.0000,84.0000 L 141.0000,84.0000" style="fill: none; stroke: #eeeeec; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_43"/><path d=" M 140.0000,72.8000 L 460.0000,72.8000" style="fill: none; stroke: #888a85; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_44"/><path d=" M 140.0000,73.3333 L 143.0000,73.3333" style="fill: none; stroke: #eeeeec; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_45"/><path d=" M 140.0000,63.2000 L 460.0000,63.2000" style="fill: none; stroke: #888a85; stroke-width: 1; stroke-opacity: 0.47; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_47"/><path d=" M 140.0000,62.6667 L 141.0000,62.6667" style="fill: none; stroke: #eeeeec; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_48"/><path d=" M 140.0000,52.0000 L 460.0000,52.0000" style="fill: none; stroke: #888a85; stroke-width: 1; stroke-opacity: 0.47; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_49"/><path d=" M 140.0000,52.0000 L 141.0000,52.0000" style="fill: none; stroke: #eeeeec; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_50"/><path d=" M 140.0000,40.8000 L 460.0000,40.8000" style="fill: none; stroke: #888a85; stroke-width: 1; stroke-opacity: 0.47; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_51"/><path d=" M 140.0000,41.3333 L 141.0000,41.3333" style="fill: none; stroke: #eeeeec; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_52"/><path d=" M 140.0000,31.2000 L 460.0000,31.2000" style="fill: none; stroke: #888a85; stroke-width: 1; stroke-opacity: 0.47; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_53"/><path d=" M 140.0000,30.6667 L 141.0000,30.6667" style="fill: none; stroke: #eeeeec; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_54"/><path d=" M 140.0000,20.0000 L 460.0000,20.0000" style="fill: none; stroke: #888a85; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_55"/><path d=" M 140.0000,20.0000 L 143.0000,20.0000" style="fill: none; stroke: #eeeeec; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_56"/><path d=" M 140.0000,130.0800 L 140.0000,130.0800" style="fill: none; stroke: #729fcf; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_58"/><path d=" M 140.0000,180.0000 L 140.0000,130.0800 L 220.0000,175.5200 L 220.0000,180.0000 L 140.0000,180.0000 z " style="fill: #729fcf; fill-opacity: 0.22; stroke: none;" id="ezcGraphPolygon_59"/><path d=" M 140.0000,130.0800 L 220.0000,175.5200" style="fill: none; stroke: #729fcf; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_60"/><path d=" M 220.0000,180.0000 L 220.0000,175.5200 L 300.0000,110.8800 L 300.0000,180.0000 L 220.0000,180.0000 z " style="fill: #729fcf; fill-opacity: 0.22; stroke: none;" id="ezcGraphPolygon_61"/><path d=" M 220.0000,175.5200 L 300.0000,110.8800" style="fill: none; stroke: #729fcf; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_62"/><path d=" M 300.0000,180.0000 L 300.0000,110.8800 L 380.0000,154.4000 L 380.0000,180.0000 L 300.0000,180.0000 z " style="fill: #729fcf; fill-opacity: 0.22; stroke: none;" id="ezcGraphPolygon_63"/><path d=" M 300.0000,110.8800 L 380.0000,154.4000" style="fill: none; stroke: #729fcf; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_64"/><path d=" M 380.0000,180.0000 L 380.0000,154.4000 L 460.0000,179.7867 L 460.0000,180.0000 L 380.0000,180.0000 z " style="fill: #729fcf; fill-opacity: 0.22; stroke: none;" id="ezcGraphPolygon_65"/><path d=" M 380.0000,154.4000 L 460.0000,179.7867" style="fill: none; stroke: #729fcf; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_66"/><path d=" M 140.0000,64.1600 L 140.0000,64.1600" style="fill: none; stroke: #ef2929; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_67"/><path d=" M 140.0000,180.0000 L 140.0000,64.1600 L 220.0000,130.0800 L 220.0000,180.0000 L 140.0000,180.0000 z " style="fill: #ef2929; fill-opacity: 0.22; stroke: none;" id="ezcGraphPolygon_68"/><path d=" M 140.0000,64.1600 L 220.0000,130.0800" style="fill: none; stroke: #ef2929; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_69"/><path d=" M 220.0000,180.0000 L 220.0000,130.0800 L 300.0000,116.4267 L 300.0000,180.0000 L 220.0000,180.0000 z " style="fill: #ef2929; fill-opacity: 0.22; stroke: none;" id="ezcGraphPolygon_70"/><path d=" M 220.0000,130.0800 L 300.0000,116.4267" style="fill: none; stroke: #ef2929; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_71"/><path d=" M 300.0000,180.0000 L 300.0000,116.4267 L 380.0000,178.9333 L 380.0000,180.0000 L 300.0000,180.0000 z " style="fill: #ef2929; fill-opacity: 0.22; stroke: none;" id="ezcGraphPolygon_72"/><path d=" M 300.0000,116.4267 L 380.0000,178.9333" style="fill: none; stroke: #ef2929; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_73"/><path d=" M 380.0000,180.0000 L 380.0000,178.9333 L 460.0000,49.2267 L 460.0000,180.0000 L 380.0000,180.0000 z " style="fill: #ef2929; fill-opacity: 0.22; stroke: none;" id="ezcGraphPolygon_74"/><path d=" M 380.0000,178.9333 L 460.0000,49.2267" style="fill: none; stroke: #ef2929; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_75"/><ellipse cx="140" cy="130.08" rx="3" ry="3" style="fill: #729fcf; fill-opacity: 1.00; stroke: none; cursor: pointer;" id="ezcGraphCircle_76" onclick="top.location = 'http://example.org/line_1'"/><ellipse cx="220" cy="175.52" rx="3" ry="3" style="fill: #729fcf; fill-opacity: 1.00; stroke: none; cursor: pointer;" id="ezcGraphCircle_77" onclick="top.location = 'http://example.org/line_1'"/><ellipse cx="300" cy="110.88" rx="3" ry="3" style="fill: #729fcf; fill-opacity: 1.00; stroke: none; cursor: pointer;" id="ezcGraphCircle_78" onclick="top.location = 'http://example.org/line_1'"/><ellipse cx="380" cy="154.4" rx="3" ry="3" style="fill: #729fcf; fill-opacity: 1.00; stroke: none; cursor: pointer;" id="ezcGraphCircle_79" onclick="top.location = 'http://example.org/line_1'"/><ellipse cx="460" cy="179.7867" rx="3" ry="3" style="fill: #729fcf; fill-opacity: 1.00; stroke: none; cursor: pointer;" id="ezcGraphCircle_80" onclick="top.location = 'http://example.org/line_1'"/><ellipse cx="140" cy="64.16" rx="3" ry="3" style="fill: #ef2929; fill-opacity: 1.00; stroke: none;" id="ezcGraphCircle_81"/><ellipse cx="220" cy="130.08" rx="3" ry="3" style="fill: #ef2929; fill-opacity: 1.00; stroke: none;" id="ezcGraphCircle_82"/><ellipse cx="300" cy="116.4267" rx="3" ry="3" style="fill: #ef2929; fill-opacity: 1.00; stroke: none; cursor: pointer;" id="ezcGraphCircle_83" onclick="top.location = 'http://example.org/line_2/sample_3'"/><ellipse cx="380" cy="178.9333" rx="3" ry="3" style="fill: #ef2929; fill-opacity: 1.00; stroke: none;" id="ezcGraphCircle_84"/><ellipse cx="460" cy="49.2267" rx="3" ry="3" style="fill: #ef2929; fill-opacity: 1.00; stroke: none;" id="ezcGraphCircle_85"/><g id="ezcGraphTextBox_5" style=" cursor: pointer;" onclick="top.location = 'http://example.org/line_1'"><path d=" M 18.5000,19.0000 L 18.5000,3.5000 L 64.5200,3.5000 L 64.5200,19.0000 L 18.5000,19.0000 z " style="fill: #ffffff; fill-opacity: 0.00; stroke: none;" id="ezcGraphPolygon_86"/><text id="ezcGraphTextBox_5_text" x="19" text-length="44.52px" y="15.9" style="font-size: 14px; font-family: sans-serif; fill: #d3d7cf; fill-opacity: 1.00; stroke: none;">Line 1</text></g><g id="ezcGraphTextBox_7"><path d=" M 18.5000,37.0000 L 18.5000,21.5000 L 64.5200,21.5000 L 64.5200,37.0000 L 18.5000,37.0000 z " style="fill: #ffffff; fill-opacity: 0.00; stroke: none;" id="ezcGraphPolygon_87"/><text id="ezcGraphTextBox_7_text" x="19" text-length="44.52px" y="33.9" style="font-size: 14px; font-family: sans-serif; fill: #d3d7cf; fill-opacity: 1.00; stroke: none;">Line 2</text></g><g id="ezcGraphTextBox_14"><path d=" M 185.5800,199.0000 L 185.5800,181.5000 L 254.9200,181.5000 L 254.9200,199.0000 L 185.5800,199.0000 z " style="fill: #ffffff; fill-opacity: 0.00; stroke: none;" id="ezcGraphPolygon_88"/><text id="ezcGraphTextBox_14_text" x="186.08" text-length="67.84px" y="195.6" style="font-size: 16px; font-family: sans-serif; fill: #d3d7cf; fill-opacity: 1.00; stroke: none;">sample 2</text></g><g id="ezcGraphTextBox_17"><path d=" M 265.5800,199.0000 L 265.5800,181.5000 L 334.9200,181.5000 L 334.9200,199.0000 L 265.5800,199.0000 z " style="fill: #ffffff; fill-opacity: 0.00; stroke: none;" id="ezcGraphPolygon_89"/><text id="ezcGraphTextBox_17_text" x="266.08" text-length="67.84px" y="195.6" style="font-size: 16px; font-family: sans-serif; fill: #d3d7cf; fill-opacity: 1.00; stroke: none;">sample 3</text></g><g id="ezcGraphTextBox_20"><path d=" M 345.5800,199.0000 L 345.5800,181.5000 L 414.9200,181.5000 L 414.9200,199.0000 L 345.5800,199.0000 z " style="fill: #ffffff; fill-opacity: 0.00; stroke: none;" id="ezcGraphPolygon_90"/><text id="ezcGraphTextBox_20_text" x="346.08" text-length="67.84px" y="195.6" style="font-size: 16px; font-family: sans-serif; fill: #d3d7cf; fill-opacity: 1.00; stroke: none;">sample 4</text></g><g id="ezcGraphTextBox_23"><path d=" M 425.5800,199.0000 L 425.5800,181.5000 L 494.9200,181.5000 L 494.9200,199.0000 L 425.5800,199.0000 z " style="fill: #ffffff; fill-opacity: 0.00; stroke: none;" id="ezcGraphPolygon_91"/><text id="ezcGraphTextBox_23_text" x="426.08" text-length="67.84px" y="195.6" style="font-size: 16px; font-family: sans-serif; fill: #d3d7cf; fill-opacity: 1.00; stroke: none;">sample 5</text></g><g id="ezcGraphTextBox_24"><path d=" M 127.5800,179.0000 L 127.5800,161.5000 L 139.0000,161.5000 L 139.0000,179.0000 L 127.5800,179.0000 z " style="fill: #ffffff; fill-opacity: 0.00; stroke: none;" id="ezcGraphPolygon_92"/><text id="ezcGraphTextBox_24_text" x="128.08" text-length="9.92px" y="175.6" style="font-size: 16px; font-family: sans-serif; fill: #d3d7cf; fill-opacity: 1.00; stroke: none;">0</text></g><g id="ezcGraphTextBox_35"><path d=" M 107.7400,125.6667 L 107.7400,108.1667 L 139.0000,108.1667 L 139.0000,125.6667 L 107.7400,125.6667 z " style="fill: #ffffff; fill-opacity: 0.00; stroke: none;" id="ezcGraphPolygon_93"/><text id="ezcGraphTextBox_35_text" x="108.24" text-length="29.76px" y="122.2667" style="font-size: 16px; font-family: sans-serif; fill: #d3d7cf; fill-opacity: 1.00; stroke: none;">250</text></g><g id="ezcGraphTextBox_46"><path d=" M 107.7400,72.3333 L 107.7400,54.8333 L 139.0000,54.8333 L 139.0000,72.3333 L 107.7400,72.3333 z " style="fill: #ffffff; fill-opacity: 0.00; stroke: none;" id="ezcGraphPolygon_94"/><text id="ezcGraphTextBox_46_text" x="108.24" text-length="29.76px" y="68.9333" style="font-size: 16px; font-family: sans-serif; fill: #d3d7cf; fill-opacity: 1.00; stroke: none;">500</text></g><g id="ezcGraphTextBox_57"><path d=" M 107.7400,39.0000 L 107.7400,21.5000 L 139.0000,21.5000 L 139.0000,39.0000 L 107.7400,39.0000 z " style="fill: #ffffff; fill-opacity: 0.00; stroke: none;" id="ezcGraphPolygon_95"/><text id="ezcGraphTextBox_57_text" x="108.24" text-length="29.76px" y="35.6" style="font-size: 16px; font-family: sans-serif; fill: #d3d7cf; fill-opacity: 1.00; stroke: none;">750</text></g></g></svg>
diff --git a/tests/data/compare/ezcGraphToolsTest_testPieChartImageMap.html b/tests/data/compare/ezcGraphToolsTest_testPieChartImageMap.html
new file mode 100644
index 0000000..6c1981e
--- /dev/null
+++ b/tests/data/compare/ezcGraphToolsTest_testPieChartImageMap.html
@@ -0,0 +1,22 @@
+<map name="ezcGraphImageMap">
+ <area shape="poly" coords="2,2,16,2,16,16,2,16" href="http://example.org/browsers/mozilla" alt="Mozilla" />
+ <area shape="poly" coords="17,2,98,2,98,16,17,16" href="http://example.org/browsers/mozilla" alt="Mozilla" />
+ <area shape="poly" coords="2,20,16,20,16,34,2,34" href="http://example.org/browsers" alt="IE" />
+ <area shape="poly" coords="17,20,98,20,98,34,17,34" href="http://example.org/browsers" alt="IE" />
+ <area shape="poly" coords="2,38,16,38,16,52,2,52" href="http://example.org/browsers" alt="Opera" />
+ <area shape="poly" coords="17,38,98,38,98,52,17,52" href="http://example.org/browsers" alt="Opera" />
+ <area shape="poly" coords="2,56,16,56,16,70,2,70" href="http://example.org/browsers" alt="wget" />
+ <area shape="poly" coords="17,56,98,56,98,70,17,70" href="http://example.org/browsers" alt="wget" />
+ <area shape="poly" coords="2,74,16,74,16,88,2,88" href="http://example.org/browsers" alt="Safari" />
+ <area shape="poly" coords="17,74,98,74,98,88,17,88" href="http://example.org/browsers" alt="Safari" />
+ <area shape="poly" coords="300,100,390,100,388,115,384,130,377,145,368,157,357,168,345,177,330,184,315,188,300,190,284,188,269,184,255,177,242,168,231,157,222,145,215,130,211,115,210,100,211,84,215,69,222,55,231,42,231,41" href="http://example.org/browsers/mozilla" alt="Mozilla" />
+ <area shape="poly" coords="100,180,244,180,244,200,100,200" href="http://example.org/browsers/mozilla" alt="Mozilla" />
+ <area shape="poly" coords="300,100,231,41,242,30,252,23" href="http://example.org/browsers" alt="IE" />
+ <area shape="poly" coords="100,20,216,20,216,40,100,40" href="http://example.org/browsers" alt="IE" />
+ <area shape="poly" coords="299,90,251,13,265,6,280,1,296,0,312,0,327,4,341,10,342,10" href="http://example.org/browsers" alt="Opera" />
+ <area shape="poly" coords="100,0,244,0,244,20,100,20" href="http://example.org/browsers" alt="Opera" />
+ <area shape="poly" coords="300,100,343,20,356,29,358,31" href="http://example.org/browsers" alt="wget" />
+ <area shape="poly" coords="367,7,500,7,500,27,367,27" href="http://example.org/browsers" alt="wget" />
+ <area shape="poly" coords="300,100,358,31,369,42,378,55,384,69,388,84,390,99" href="http://example.org/browsers" alt="Safari" />
+ <area shape="poly" coords="402,47,500,47,500,67,402,67" href="http://example.org/browsers" alt="Safari" />
+</map>
diff --git a/tests/data/compare/ezcGraphToolsTest_testPieChartImageMapCustomName.html b/tests/data/compare/ezcGraphToolsTest_testPieChartImageMapCustomName.html
new file mode 100644
index 0000000..555443b
--- /dev/null
+++ b/tests/data/compare/ezcGraphToolsTest_testPieChartImageMapCustomName.html
@@ -0,0 +1,22 @@
+<map name="CustomImageMapName">
+ <area shape="poly" coords="2,2,16,2,16,16,2,16" href="http://example.org/browsers/mozilla" alt="Mozilla" />
+ <area shape="poly" coords="17,2,98,2,98,16,17,16" href="http://example.org/browsers/mozilla" alt="Mozilla" />
+ <area shape="poly" coords="2,20,16,20,16,34,2,34" href="http://example.org/browsers" alt="IE" />
+ <area shape="poly" coords="17,20,98,20,98,34,17,34" href="http://example.org/browsers" alt="IE" />
+ <area shape="poly" coords="2,38,16,38,16,52,2,52" href="http://example.org/browsers" alt="Opera" />
+ <area shape="poly" coords="17,38,98,38,98,52,17,52" href="http://example.org/browsers" alt="Opera" />
+ <area shape="poly" coords="2,56,16,56,16,70,2,70" href="http://example.org/browsers" alt="wget" />
+ <area shape="poly" coords="17,56,98,56,98,70,17,70" href="http://example.org/browsers" alt="wget" />
+ <area shape="poly" coords="2,74,16,74,16,88,2,88" href="http://example.org/browsers" alt="Safari" />
+ <area shape="poly" coords="17,74,98,74,98,88,17,88" href="http://example.org/browsers" alt="Safari" />
+ <area shape="poly" coords="300,100,390,100,388,115,384,130,377,145,368,157,357,168,345,177,330,184,315,188,300,190,284,188,269,184,255,177,242,168,231,157,222,145,215,130,211,115,210,100,211,84,215,69,222,55,231,42,231,41" href="http://example.org/browsers/mozilla" alt="Mozilla" />
+ <area shape="poly" coords="100,180,244,180,244,200,100,200" href="http://example.org/browsers/mozilla" alt="Mozilla" />
+ <area shape="poly" coords="300,100,231,41,242,30,252,23" href="http://example.org/browsers" alt="IE" />
+ <area shape="poly" coords="100,20,216,20,216,40,100,40" href="http://example.org/browsers" alt="IE" />
+ <area shape="poly" coords="299,90,251,13,265,6,280,1,296,0,312,0,327,4,341,10,342,10" href="http://example.org/browsers" alt="Opera" />
+ <area shape="poly" coords="100,0,244,0,244,20,100,20" href="http://example.org/browsers" alt="Opera" />
+ <area shape="poly" coords="300,100,343,20,356,29,358,31" href="http://example.org/browsers" alt="wget" />
+ <area shape="poly" coords="367,7,500,7,500,27,367,27" href="http://example.org/browsers" alt="wget" />
+ <area shape="poly" coords="300,100,358,31,369,42,378,55,384,69,388,84,390,99" href="http://example.org/browsers" alt="Safari" />
+ <area shape="poly" coords="402,47,500,47,500,67,402,67" href="http://example.org/browsers" alt="Safari" />
+</map>
diff --git a/tests/data/compare/ezcGraphToolsTest_testPieChartSvgLinking.svg b/tests/data/compare/ezcGraphToolsTest_testPieChartSvgLinking.svg
new file mode 100644
index 0000000..660e9c0
--- /dev/null
+++ b/tests/data/compare/ezcGraphToolsTest_testPieChartSvgLinking.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: #4e9a06; fill-opacity: 1.00; stroke: none; cursor: pointer;" id="ezcGraphPolygon_3" onclick="top.location = 'http://example.org/browsers/mozilla'"/><path d=" M 2.0000,34.0000 L 2.0000,20.0000 L 16.0000,20.0000 L 16.0000,34.0000 L 2.0000,34.0000 z " style="fill: #cc0000; fill-opacity: 1.00; stroke: none; cursor: pointer;" id="ezcGraphPolygon_5" onclick="top.location = 'http://example.org/browsers'"/><path d=" M 2.0000,52.0000 L 2.0000,38.0000 L 16.0000,38.0000 L 16.0000,52.0000 L 2.0000,52.0000 z " style="fill: #edd400; fill-opacity: 1.00; stroke: none; cursor: pointer;" id="ezcGraphPolygon_7" onclick="top.location = 'http://example.org/browsers'"/><path d=" M 2.0000,70.0000 L 2.0000,56.0000 L 16.0000,56.0000 L 16.0000,70.0000 L 2.0000,70.0000 z " style="fill: #75505b; fill-opacity: 1.00; stroke: none; cursor: pointer;" id="ezcGraphPolygon_9" onclick="top.location = 'http://example.org/browsers'"/><path d=" M 2.0000,88.0000 L 2.0000,74.0000 L 16.0000,74.0000 L 16.0000,88.0000 L 2.0000,88.0000 z " style="fill: #f57900; fill-opacity: 1.00; stroke: none; cursor: pointer;" id="ezcGraphPolygon_11" onclick="top.location = 'http://example.org/browsers'"/><path d="M 300.00,100.00 L 390.00,100.00 A 90.00,90.00 0 1,1 231.59,41.52 z" style="fill: #4e9a06; fill-opacity: 1.00; stroke: none; cursor: pointer;" id="ezcGraphCircleSector_13" onclick="top.location = 'http://example.org/browsers/mozilla'"/><path d="M 299.82,100.50 L 389.50,100.50 A 89.50,89.50 0 1,1 231.65,42.22 z" style="fill: none; stroke: #274d03; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphCircleSector_14"/><path d="M 300.00,100.00 L 231.59,41.52 A 90.00,90.00 0 0,1 252.20,23.75 z" style="fill: #cc0000; fill-opacity: 1.00; stroke: none; cursor: pointer;" id="ezcGraphCircleSector_15" onclick="top.location = 'http://example.org/browsers'"/><path d="M 297.84,97.50 L 232.30,41.46 A 89.50,89.50 0 0,1 252.04,24.43 z" style="fill: none; stroke: #660000; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphCircleSector_16"/><path d="M 299.70,90.00 L 251.89,13.75 A 90.00,90.00 0 0,1 342.79,10.99 z" style="fill: #edd400; fill-opacity: 1.00; stroke: none; cursor: pointer;" id="ezcGraphCircleSector_17" onclick="top.location = 'http://example.org/browsers'"/><path d="M 299.67,89.02 L 252.58,13.91 A 89.50,89.50 0 0,1 342.11,11.19 z" style="fill: none; stroke: #776a00; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphCircleSector_18"/><path d="M 300.00,100.00 L 343.09,20.99 A 90.00,90.00 0 0,1 358.15,31.31 z" style="fill: #75505b; fill-opacity: 1.00; stroke: none; cursor: pointer;" id="ezcGraphCircleSector_19" onclick="top.location = 'http://example.org/browsers'"/><path d="M 302.79,95.93 L 343.29,21.66 A 89.50,89.50 0 0,1 357.45,31.37 z" style="fill: none; stroke: #3b282e; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphCircleSector_20"/><path d="M 300.00,100.00 L 358.15,31.31 A 90.00,90.00 0 0,1 390.00,100.00 z" style="fill: #f57900; fill-opacity: 1.00; stroke: none; cursor: pointer;" id="ezcGraphCircleSector_21" onclick="top.location = 'http://example.org/browsers'"/><path d="M 301.08,99.50 L 358.21,32.01 A 89.50,89.50 0 0,1 389.50,99.50 z" style="fill: none; stroke: #7b3d00; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphCircleSector_22"/><path d=" M 297.6734,23.3686 L 250.4110,10.0000" style="fill: none; stroke: #000000; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_23"/><ellipse cx="297.6734" cy="23.3686" rx="3" ry="3" style="fill: #000000; fill-opacity: 1.00; stroke: none;" id="ezcGraphCircle_24"/><ellipse cx="250.411" cy="10" rx="3" ry="3" style="fill: #000000; fill-opacity: 1.00; stroke: none;" id="ezcGraphCircle_25"/><path d=" M 256.4576,49.5173 L 222.5857,30.0000" style="fill: none; stroke: #000000; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_27"/><ellipse cx="256.4576" cy="49.5173" rx="3" ry="3" style="fill: #000000; fill-opacity: 1.00; stroke: none;" id="ezcGraphCircle_28"/><ellipse cx="222.5857" cy="30" rx="3" ry="3" style="fill: #000000; fill-opacity: 1.00; stroke: none;" id="ezcGraphCircle_29"/><path d=" M 276.9111,162.5408 L 250.4110,190.0000" style="fill: none; stroke: #000000; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_31"/><ellipse cx="276.9111" cy="162.5408" rx="3" ry="3" style="fill: #000000; fill-opacity: 1.00; stroke: none;" id="ezcGraphCircle_32"/><ellipse cx="250.411" cy="190" rx="3" ry="3" style="fill: #000000; fill-opacity: 1.00; stroke: none;" id="ezcGraphCircle_33"/><path d=" M 337.6907,45.0104 L 361.7763,17.0000" style="fill: none; stroke: #000000; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_35"/><ellipse cx="337.6907" cy="45.0104" rx="3" ry="3" style="fill: #000000; fill-opacity: 1.00; stroke: none;" id="ezcGraphCircle_36"/><ellipse cx="361.7763" cy="17" rx="3" ry="3" style="fill: #000000; fill-opacity: 1.00; stroke: none;" id="ezcGraphCircle_37"/><path d=" M 360.4817,71.9569 L 396.2829,57.0000" style="fill: none; stroke: #000000; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_39"/><ellipse cx="360.4817" cy="71.9569" rx="3" ry="3" style="fill: #000000; fill-opacity: 1.00; stroke: none;" id="ezcGraphCircle_40"/><ellipse cx="396.2829" cy="57" rx="3" ry="3" style="fill: #000000; fill-opacity: 1.00; stroke: none;" id="ezcGraphCircle_41"/><g id="ezcGraphTextBox_4" style=" cursor: pointer;" onclick="top.location = 'http://example.org/browsers/mozilla'"><path d=" M 16.5000,17.0000 L 16.5000,1.5000 L 69.9400,1.5000 L 69.9400,17.0000 L 16.5000,17.0000 z " style="fill: #ffffff; fill-opacity: 0.00; stroke: none;" id="ezcGraphPolygon_43"/><text id="ezcGraphTextBox_4_text" x="17" text-length="51.94px" y="13.9" style="font-size: 14px; font-family: sans-serif; fill: #2e3436; fill-opacity: 1.00; stroke: none;">Mozilla</text></g><g id="ezcGraphTextBox_6" style=" cursor: pointer;" onclick="top.location = 'http://example.org/browsers'"><path d=" M 16.5000,35.0000 L 16.5000,19.5000 L 32.8400,19.5000 L 32.8400,35.0000 L 16.5000,35.0000 z " style="fill: #ffffff; fill-opacity: 0.00; stroke: none;" id="ezcGraphPolygon_44"/><text id="ezcGraphTextBox_6_text" x="17" text-length="14.84px" y="31.9" style="font-size: 14px; font-family: sans-serif; fill: #2e3436; fill-opacity: 1.00; stroke: none;">IE</text></g><g id="ezcGraphTextBox_8" style=" cursor: pointer;" onclick="top.location = 'http://example.org/browsers'"><path d=" M 16.5000,53.0000 L 16.5000,37.5000 L 55.1000,37.5000 L 55.1000,53.0000 L 16.5000,53.0000 z " style="fill: #ffffff; fill-opacity: 0.00; stroke: none;" id="ezcGraphPolygon_45"/><text id="ezcGraphTextBox_8_text" x="17" text-length="37.1px" y="49.9" style="font-size: 14px; font-family: sans-serif; fill: #2e3436; fill-opacity: 1.00; stroke: none;">Opera</text></g><g id="ezcGraphTextBox_10" style=" cursor: pointer;" onclick="top.location = 'http://example.org/browsers'"><path d=" M 16.5000,71.0000 L 16.5000,55.5000 L 47.6800,55.5000 L 47.6800,71.0000 L 16.5000,71.0000 z " style="fill: #ffffff; fill-opacity: 0.00; stroke: none;" id="ezcGraphPolygon_46"/><text id="ezcGraphTextBox_10_text" x="17" text-length="29.68px" y="67.9" style="font-size: 14px; font-family: sans-serif; fill: #2e3436; fill-opacity: 1.00; stroke: none;">wget</text></g><g id="ezcGraphTextBox_12" style=" cursor: pointer;" onclick="top.location = 'http://example.org/browsers'"><path d=" M 16.5000,89.0000 L 16.5000,73.5000 L 62.5200,73.5000 L 62.5200,89.0000 L 16.5000,89.0000 z " style="fill: #ffffff; fill-opacity: 0.00; stroke: none;" id="ezcGraphPolygon_47"/><text id="ezcGraphTextBox_12_text" x="17" text-length="44.52px" y="85.9" style="font-size: 14px; font-family: sans-serif; fill: #2e3436; fill-opacity: 1.00; stroke: none;">Safari</text></g><g id="ezcGraphTextBox_26" style=" cursor: pointer;" onclick="top.location = 'http://example.org/browsers'"><path d=" M 153.2810,15.5000 L 153.2810,5.0000 L 245.4110,5.0000 L 245.4110,15.5000 L 153.2810,15.5000 z " style="fill: #ffffff; fill-opacity: 0.00; stroke: none;" id="ezcGraphPolygon_48"/><text id="ezcGraphTextBox_26_text" x="153.781" text-length="90.63px" y="13.15" style="font-size: 9px; font-family: sans-serif; fill: #2e3436; fill-opacity: 1.00; stroke: none;">Opera: 1204 (16.9%)</text></g><g id="ezcGraphTextBox_30" style=" cursor: pointer;" onclick="top.location = 'http://example.org/browsers'"><path d=" M 149.3057,35.5000 L 149.3057,25.0000 L 217.5857,25.0000 L 217.5857,35.5000 L 149.3057,35.5000 z " style="fill: #ffffff; fill-opacity: 0.00; stroke: none;" id="ezcGraphPolygon_49"/><text id="ezcGraphTextBox_30_text" x="149.8057" text-length="66.78px" y="33.15" style="font-size: 9px; font-family: sans-serif; fill: #2e3436; fill-opacity: 1.00; stroke: none;">IE: 345 (4.8%)</text></g><g id="ezcGraphTextBox_34" style=" cursor: pointer;" onclick="top.location = 'http://example.org/browsers/mozilla'"><path d=" M 143.7410,195.5000 L 143.7410,185.0000 L 245.4110,185.0000 L 245.4110,195.5000 L 143.7410,195.5000 z " style="fill: #ffffff; fill-opacity: 0.00; stroke: none;" id="ezcGraphPolygon_50"/><text id="ezcGraphTextBox_34_text" x="144.241" text-length="100.17px" y="193.15" style="font-size: 9px; font-family: sans-serif; fill: #2e3436; fill-opacity: 1.00; stroke: none;">Mozilla: 4375 (61.3%)</text></g><g id="ezcGraphTextBox_38" style=" cursor: pointer;" onclick="top.location = 'http://example.org/browsers'"><path d=" M 367.2763,22.5000 L 367.2763,12.0000 L 445.0963,12.0000 L 445.0963,22.5000 L 367.2763,22.5000 z " style="fill: #ffffff; fill-opacity: 0.00; stroke: none;" id="ezcGraphPolygon_51"/><text id="ezcGraphTextBox_38_text" x="367.7763" text-length="76.32px" y="20.15" style="font-size: 9px; font-family: sans-serif; fill: #2e3436; fill-opacity: 1.00; stroke: none;">wget: 231 (3.2%)</text></g><g id="ezcGraphTextBox_42" style=" cursor: pointer;" onclick="top.location = 'http://example.org/browsers'"><path d=" M 401.7829,62.5000 L 401.7829,52.0000 L 493.9129,52.0000 L 493.9129,62.5000 L 401.7829,62.5000 z " style="fill: #ffffff; fill-opacity: 0.00; stroke: none;" id="ezcGraphPolygon_52"/><text id="ezcGraphTextBox_42_text" x="402.2829" text-length="90.63px" y="60.15" style="font-size: 9px; font-family: sans-serif; fill: #2e3436; fill-opacity: 1.00; stroke: none;">Safari: 987 (13.8%)</text></g></g></svg>
diff --git a/tests/driver_svg_test.php b/tests/driver_svg_test.php
index d797e3c..f54b1e2 100644
--- a/tests/driver_svg_test.php
+++ b/tests/driver_svg_test.php
@@ -1594,14 +1594,32 @@ class ezcGraphSvgDriverTest extends ezcGraphTestCase
$this->assertSame(
null,
$options->encoding,
- 'Wrong default value for property idPrefix in class ezcGraphSvgDriverOptions'
+ 'Wrong default value for property encoding in class ezcGraphSvgDriverOptions'
);
$options->encoding = 'ISO-8859-15';
$this->assertSame(
'ISO-8859-15',
$options->encoding,
- 'Setting property value did not work for property idPrefix in class ezcGraphSvgDriverOptions'
+ 'Setting property value did not work for property encoding in class ezcGraphSvgDriverOptions'
+ );
+ }
+
+ public function testSvgDriverOptionsPropertyLinkCursor()
+ {
+ $options = new ezcGraphSvgDriverOptions();
+
+ $this->assertSame(
+ 'pointer',
+ $options->linkCursor,
+ 'Wrong default value for property linkCursor in class ezcGraphSvgDriverOptions'
+ );
+
+ $options->linkCursor = 'auto';
+ $this->assertSame(
+ 'auto',
+ $options->linkCursor,
+ 'Setting property value did not work for property linkCursor in class ezcGraphSvgDriverOptions'
);
}
}
diff --git a/tests/struct_test.php b/tests/struct_test.php
index 699c3e8..ad7d555 100644
--- a/tests/struct_test.php
+++ b/tests/struct_test.php
@@ -24,7 +24,7 @@ class ezcGraphStructTest extends ezcTestCase
public function testCreateContext()
{
- $context = new ezcGraphContext( 'set', 'point' );
+ $context = new ezcGraphContext( 'set', 'point', 'url://' );
$this->assertSame(
'set',
@@ -38,8 +38,15 @@ class ezcGraphStructTest extends ezcTestCase
'Wrong value when reading public property datapoint in ezcGraphContext.'
);
+ $this->assertSame(
+ 'url://',
+ $context->url,
+ 'Wrong value when reading public property url in ezcGraphContext.'
+ );
+
$context->dataset = 'set 2';
$context->datapoint = 'point 2';
+ $context->url = 'url://2';
$this->assertSame(
'set 2',
@@ -52,6 +59,12 @@ class ezcGraphStructTest extends ezcTestCase
$context->datapoint,
'Wrong value when reading public property datapoint in ezcGraphContext.'
);
+
+ $this->assertSame(
+ 'url://2',
+ $context->url,
+ 'Wrong value when reading public property url in ezcGraphContext.'
+ );
}
public function testContextUnknowPropertySet()
@@ -109,6 +122,36 @@ class ezcGraphStructTest extends ezcTestCase
);
}
+ public function testContextSetStateWithURL()
+ {
+ $context = new ezcGraphContext();
+
+ $context->__set_state(
+ array(
+ 'dataset' => 'set',
+ 'datapoint' => 'point',
+ 'url' => 'url://',
+ ) );
+
+ $this->assertSame(
+ 'set',
+ $context->dataset,
+ 'Wrong value when reading public property dataset in ezcGraphContext.'
+ );
+
+ $this->assertSame(
+ 'point',
+ $context->datapoint,
+ 'Wrong value when reading public property datapoint in ezcGraphContext.'
+ );
+
+ $this->assertSame(
+ 'url://',
+ $context->url,
+ 'Wrong value when reading public property url in ezcGraphContext.'
+ );
+ }
+
public function testCreateCoordinate()
{
$context = new ezcGraphCoordinate( 23, 42 );
diff --git a/tests/suite.php b/tests/suite.php
index 92ae202..4b490ae 100644
--- a/tests/suite.php
+++ b/tests/suite.php
@@ -12,38 +12,39 @@
/**
* Require test suites.
*/
-require_once 'color_test.php';
+require_once 'axis_centered_renderer_test.php';
+require_once 'axis_exact_renderer_test.php';
+require_once 'background_test.php';
+require_once 'boundings_test.php';
require_once 'chart_test.php';
-require_once 'pie_test.php';
-require_once 'line_test.php';
-require_once 'dataset_test.php';
+require_once 'color_test.php';
require_once 'dataset_average_test.php';
require_once 'dataset_numeric_test.php';
require_once 'dataset_pdo_test.php';
-require_once 'element_options_test.php';
-require_once 'legend_test.php';
-require_once 'background_test.php';
-require_once 'text_test.php';
-require_once 'numeric_axis_test.php';
-require_once 'labeled_axis_test.php';
-require_once 'logarithmical_axis_test.php';
+require_once 'dataset_test.php';
require_once 'date_axis_test.php';
-require_once 'renderer_2d_test.php';
-require_once 'renderer_3d_test.php';
-require_once 'axis_exact_renderer_test.php';
-require_once 'axis_centered_renderer_test.php';
-require_once 'driver_options_test.php';
+require_once 'driver_flash_test.php';
require_once 'driver_gd_test.php';
+require_once 'driver_options_test.php';
require_once 'driver_svg_test.php';
-require_once 'driver_flash_test.php';
+require_once 'element_options_test.php';
require_once 'font_test.php';
-require_once 'palette_test.php';
+require_once 'image_map_test.php';
+require_once 'labeled_axis_test.php';
+require_once 'legend_test.php';
+require_once 'line_test.php';
+require_once 'logarithmical_axis_test.php';
require_once 'matrix_test.php';
-require_once 'vector_test.php';
-require_once 'boundings_test.php';
+require_once 'numeric_axis_test.php';
+require_once 'palette_test.php';
+require_once 'pie_test.php';
require_once 'polynom_test.php';
+require_once 'renderer_2d_test.php';
+require_once 'renderer_3d_test.php';
require_once 'struct_test.php';
-require_once 'image_map_test.php';
+require_once 'text_test.php';
+require_once 'tools_test.php';
+require_once 'vector_test.php';
/**
* Test suite for ImageAnalysis package.
@@ -58,38 +59,39 @@ class ezcGraphSuite extends PHPUnit_Framework_TestSuite
parent::__construct();
$this->setName( "Graph" );
- $this->addTest( ezcGraphColorTest::suite() );
+ $this->addTest( ezcGraphAxisCenteredRendererTest::suite() );
+ $this->addTest( ezcGraphAxisExactRendererTest::suite() );
+ $this->addTest( ezcGraphBackgroundTest::suite() );
+ $this->addTest( ezcGraphBoundingsTest::suite() );
$this->addTest( ezcGraphChartTest::suite() );
- $this->addTest( ezcGraphPieChartTest::suite() );
- $this->addTest( ezcGraphLineChartTest::suite() );
- $this->addTest( ezcGraphDataSetTest::suite() );
+ $this->addTest( ezcGraphColorTest::suite() );
$this->addTest( ezcGraphDataSetAverageTest::suite() );
- $this->addTest( ezcGraphNumericDataSetTest::suite() );
- $this->addTest( ezcGraphPdoDataSetTest::suite() );
+ $this->addTest( ezcGraphDataSetTest::suite() );
+ $this->addTest( ezcGraphDateAxisTest::suite() );
+ $this->addTest( ezcGraphDriverOptionsTest::suite() );
$this->addTest( ezcGraphElementOptionsTest::suite() );
- $this->addTest( ezcGraphLegendTest::suite() );
- $this->addTest( ezcGraphBackgroundTest::suite() );
- $this->addTest( ezcGraphNumericAxisTest::suite() );
+ $this->addTest( ezcGraphFlashDriverTest::suite() );
+ $this->addTest( ezcGraphFontTest::suite() );
+ $this->addTest( ezcGraphGdDriverTest::suite() );
+ $this->addTest( ezcGraphImageMapTest::suite() );
$this->addTest( ezcGraphLabeledAxisTest::suite() );
+ $this->addTest( ezcGraphLegendTest::suite() );
+ $this->addTest( ezcGraphLineChartTest::suite() );
$this->addTest( ezcGraphLogarithmicalAxisTest::suite() );
- $this->addTest( ezcGraphDateAxisTest::suite() );
+ $this->addTest( ezcGraphMatrixTest::suite() );
+ $this->addTest( ezcGraphNumericAxisTest::suite() );
+ $this->addTest( ezcGraphNumericDataSetTest::suite() );
+ $this->addTest( ezcGraphPaletteTest::suite() );
+ $this->addTest( ezcGraphPdoDataSetTest::suite() );
+ $this->addTest( ezcGraphPieChartTest::suite() );
+ $this->addTest( ezcGraphPolynomTest::suite() );
$this->addTest( ezcGraphRenderer2dTest::suite() );
$this->addTest( ezcGraphRenderer3dTest::suite() );
- $this->addTest( ezcGraphAxisExactRendererTest::suite() );
- $this->addTest( ezcGraphAxisCenteredRendererTest::suite() );
- $this->addTest( ezcGraphDriverOptionsTest::suite() );
- $this->addTest( ezcGraphGdDriverTest::suite() );
+ $this->addTest( ezcGraphStructTest::suite() );
$this->addTest( ezcGraphSvgDriverTest::suite() );
- $this->addTest( ezcGraphFlashDriverTest::suite() );
- $this->addTest( ezcGraphFontTest::suite() );
$this->addTest( ezcGraphTextTest::suite() );
- $this->addTest( ezcGraphPaletteTest::suite() );
- $this->addTest( ezcGraphMatrixTest::suite() );
+ $this->addTest( ezcGraphToolsTest::suite() );
$this->addTest( ezcGraphVectorTest::suite() );
- $this->addTest( ezcGraphBoundingsTest::suite() );
- $this->addTest( ezcGraphPolynomTest::suite() );
- $this->addTest( ezcGraphStructTest::suite() );
- $this->addTest( ezcGraphImageMapTest::suite() );
}
public static function suite()
diff --git a/tests/tools_test.php b/tests/tools_test.php
new file mode 100644
index 0000000..e597f17
--- /dev/null
+++ b/tests/tools_test.php
@@ -0,0 +1,266 @@
+<?php
+/**
+ * ezcGraphToolsTest
+ *
+ * @package Graph
+ * @version //autogen//
+ * @subpackage Tests
+ * @copyright Copyright (C) 2005-2007 eZ systems as. All rights reserved.
+ * @license http://ez.no/licenses/new_bsd New BSD License
+ */
+
+require_once dirname( __FILE__ ) . '/test_case.php';
+
+/**
+ * Tests for ezcGraph class.
+ *
+ * @package ImageAnalysis
+ * @subpackage Tests
+ */
+class ezcGraphToolsTest extends ezcGraphTestCase
+{
+ public static function suite()
+ {
+ return new PHPUnit_Framework_TestSuite( "ezcGraphToolsTest" );
+ }
+
+ protected function setUp()
+ {
+ static $i = 0;
+ $this->tempDir = $this->createTempDir( __CLASS__ . sprintf( '_%03d_', ++$i ) ) . '/';
+ $this->basePath = dirname( __FILE__ ) . '/data/';
+ }
+
+ protected function tearDown()
+ {
+ if ( !$this->hasFailed() )
+ {
+ $this->removeTempDir();
+ }
+ }
+
+ public function testPieChartImageMap()
+ {
+ $filename = $this->tempDir . __FUNCTION__ . '.png';
+ $htmlFilename = $this->tempDir . __FUNCTION__ . '.html';
+
+ $chart = new ezcGraphPieChart();
+ $chart->data['sample'] = new ezcGraphArrayDataSet( array(
+ 'Mozilla' => 4375,
+ 'IE' => 345,
+ 'Opera' => 1204,
+ 'wget' => 231,
+ 'Safari' => 987,
+ ) );
+
+ $chart->data['sample']->url = 'http://example.org/browsers';
+ $chart->data['sample']->url['Mozilla'] = 'http://example.org/browsers/mozilla';
+ $chart->data['sample']->highlight['Opera'] = true;
+
+ $chart->driver = new ezcGraphGdDriver();
+ $chart->options->font->path = $this->basePath . 'font.ttf';
+
+ $chart->render( 500, 200, $filename );
+
+ file_put_contents( $htmlFilename, ezcGraphTools::createImageMap( $chart ) );
+
+ $this->compare(
+ $htmlFilename,
+ $this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.html'
+ );
+ }
+
+ public function testPieChartImageMapCustomName()
+ {
+ $filename = $this->tempDir . __FUNCTION__ . '.png';
+ $htmlFilename = $this->tempDir . __FUNCTION__ . '.html';
+
+ $chart = new ezcGraphPieChart();
+ $chart->data['sample'] = new ezcGraphArrayDataSet( array(
+ 'Mozilla' => 4375,
+ 'IE' => 345,
+ 'Opera' => 1204,
+ 'wget' => 231,
+ 'Safari' => 987,
+ ) );
+
+ $chart->data['sample']->url = 'http://example.org/browsers';
+ $chart->data['sample']->url['Mozilla'] = 'http://example.org/browsers/mozilla';
+ $chart->data['sample']->highlight['Opera'] = true;
+
+ $chart->driver = new ezcGraphGdDriver();
+ $chart->options->font->path = $this->basePath . 'font.ttf';
+
+ $chart->render( 500, 200, $filename );
+
+ file_put_contents( $htmlFilename, ezcGraphTools::createImageMap( $chart, 'CustomImageMapName' ) );
+
+ $this->compare(
+ $htmlFilename,
+ $this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.html'
+ );
+ }
+
+ public function testLineChartImageMap()
+ {
+ $filename = $this->tempDir . __FUNCTION__ . '.png';
+ $htmlFilename = $this->tempDir . __FUNCTION__ . '.html';
+
+ $chart = new ezcGraphLineChart();
+ $chart->palette = new ezcGraphPaletteBlack();
+ $chart->options->fillLines = 200;
+
+ $chart->data['Line 1'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) );
+ $chart->data['Line 2'] = new ezcGraphArrayDataSet( array( 'sample 1' => 543, 'sample 2' => 234, 'sample 3' => 298, 'sample 4' => 5, 'sample 5' => 613) );
+
+ $chart->data['Line 1']->url = 'http://example.org/line_1';
+ $chart->data['Line 2']->url['sample 3'] = 'http://example.org/line_2/sample_3';
+
+ $chart->driver = new ezcGraphGdDriver();
+ $chart->options->font->path = $this->basePath . 'font.ttf';
+
+ $chart->render( 500, 200, $filename );
+
+ file_put_contents( $htmlFilename, ezcGraphTools::createImageMap( $chart ) );
+
+ $this->compare(
+ $htmlFilename,
+ $this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.html'
+ );
+ }
+
+ public function testImageMapWithWrongDriver()
+ {
+ $filename = $this->tempDir . __FUNCTION__ . '.png';
+
+ $chart = new ezcGraphLineChart();
+ $chart->data['Line 1'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) );
+ $chart->render( 500, 200, $filename );
+
+ try
+ {
+ ezcGraphTools::createImageMap( $chart );
+ }
+ catch ( ezcGraphToolsIncompatibleDriverException $e )
+ {
+ return true;
+ }
+
+ $this->fail( 'Expected ezcGraphToolsIncompatibleDriverException.' );
+ }
+
+ public function testImageMapWithoutRendering()
+ {
+ $filename = $this->tempDir . __FUNCTION__ . '.png';
+
+ $chart = new ezcGraphLineChart();
+ $chart->data['Line 1'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) );
+ $chart->driver = new ezcGraphGdDriver();
+
+ try
+ {
+ ezcGraphTools::createImageMap( $chart );
+ }
+ catch ( ezcGraphToolsNotRenderedException $e )
+ {
+ return true;
+ }
+
+ $this->fail( 'Expected ezcGraphToolsNotRenderedException.' );
+ }
+
+ public function testPieChartSvgLinking()
+ {
+ $filename = $this->tempDir . __FUNCTION__ . '.svg';
+
+ $chart = new ezcGraphPieChart();
+ $chart->data['sample'] = new ezcGraphArrayDataSet( array(
+ 'Mozilla' => 4375,
+ 'IE' => 345,
+ 'Opera' => 1204,
+ 'wget' => 231,
+ 'Safari' => 987,
+ ) );
+
+ $chart->data['sample']->url = 'http://example.org/browsers';
+ $chart->data['sample']->url['Mozilla'] = 'http://example.org/browsers/mozilla';
+ $chart->data['sample']->highlight['Opera'] = true;
+
+ $chart->render( 500, 200, $filename );
+
+ ezcGraphTools::linkSvgElements( $chart );
+
+ $this->compare(
+ $filename,
+ $this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.svg'
+ );
+ }
+
+ public function testLineChartSvgLinking()
+ {
+ $filename = $this->tempDir . __FUNCTION__ . '.svg';
+
+ $chart = new ezcGraphLineChart();
+ $chart->palette = new ezcGraphPaletteBlack();
+ $chart->options->fillLines = 200;
+
+ $chart->data['Line 1'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) );
+ $chart->data['Line 2'] = new ezcGraphArrayDataSet( array( 'sample 1' => 543, 'sample 2' => 234, 'sample 3' => 298, 'sample 4' => 5, 'sample 5' => 613) );
+
+ $chart->data['Line 1']->url = 'http://example.org/line_1';
+ $chart->data['Line 2']->url['sample 3'] = 'http://example.org/line_2/sample_3';
+
+ $chart->render( 500, 200, $filename );
+
+ ezcGraphTools::linkSvgElements( $chart );
+
+ $this->compare(
+ $filename,
+ $this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.svg'
+ );
+ }
+
+ public function testSvgLinkingWithWrongDriver()
+ {
+ $filename = $this->tempDir . __FUNCTION__ . '.svg';
+
+ $chart = new ezcGraphLineChart();
+ $chart->data['Line 1'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) );
+ $chart->render( 500, 200, $filename );
+
+ $chart->driver = new ezcGraphGdDriver();
+ $chart->options->font->path = $this->basePath . 'font.ttf';
+
+ try
+ {
+ ezcGraphTools::linkSvgElements( $chart );
+ }
+ catch ( ezcGraphToolsIncompatibleDriverException $e )
+ {
+ return true;
+ }
+
+ $this->fail( 'Expected ezcGraphToolsIncompatibleDriverException.' );
+ }
+
+ public function testSvgLinkingWithoutRendering()
+ {
+ $filename = $this->tempDir . __FUNCTION__ . '.svg';
+
+ $chart = new ezcGraphLineChart();
+ $chart->data['Line 1'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) );
+
+ try
+ {
+ ezcGraphTools::linkSvgElements( $chart );
+ }
+ catch ( ezcGraphToolsNotRenderedException $e )
+ {
+ return true;
+ }
+
+ $this->fail( 'Expected ezcGraphToolsNotRenderedException.' );
+ }
+}
+
+?>
OpenPOWER on IntegriCloud