summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKore Nordmann <github@kore-nordmann.de>2006-08-14 12:50:28 +0000
committerKore Nordmann <github@kore-nordmann.de>2006-08-14 12:50:28 +0000
commit48155e33dd6901e3966d9b151d837bcbdc8e9968 (patch)
tree04fbae229bbf0a5bbea14d3e4da3f0bd976a4572
parent21f7809f953a75b9e6214d0549a7f1941e3df7b9 (diff)
downloadzetacomponents-graph-48155e33dd6901e3966d9b151d837bcbdc8e9968.zip
zetacomponents-graph-48155e33dd6901e3966d9b151d837bcbdc8e9968.tar.gz
- Changed datsets to accept instances of ezcGraphDataSet only
- Added bar charts - Globally increase acceptable difference noise for created images in tests
-rw-r--r--src/charts/line.php140
-rw-r--r--src/charts/pie.php36
-rw-r--r--src/datasets/array.php42
-rw-r--r--src/datasets/average.php2
-rw-r--r--src/datasets/base.php31
-rw-r--r--src/exceptions/invalid_id.php1
-rw-r--r--src/exceptions/unknown_dataset_source.php2
-rw-r--r--src/graph.php4
-rw-r--r--src/graph_autoload.php5
-rw-r--r--src/interfaces/axis_label_renderer.php5
-rw-r--r--src/interfaces/chart.php35
-rw-r--r--src/interfaces/renderer.php24
-rw-r--r--src/options/renderer_2d.php31
-rw-r--r--src/options/renderer_3d.php33
-rw-r--r--src/renderer/2d.php66
-rw-r--r--src/renderer/3d.php29
-rw-r--r--src/renderer/axis_label_boxed.php171
-rw-r--r--tests/axis_centered_renderer_test.php28
-rw-r--r--tests/axis_exact_renderer_test.php28
-rw-r--r--tests/data/compare/ezcGraphRenderer2dTest_testRenderFilledLineBarChart.pngbin0 -> 76616 bytes
-rw-r--r--tests/dataset_test.php38
-rw-r--r--tests/date_axis_test.php30
-rw-r--r--tests/driver_gd_test.php86
-rw-r--r--tests/driver_svg_test.php8
-rw-r--r--tests/font_test.php2
-rw-r--r--tests/labeled_axis_test.php18
-rw-r--r--tests/line_test.php175
-rw-r--r--tests/numeric_axis_test.php36
-rw-r--r--tests/palette_test.php20
-rw-r--r--tests/pie_test.php32
-rw-r--r--tests/renderer_2d_test.php156
-rw-r--r--tests/renderer_3d_test.php112
-rw-r--r--tests/text_test.php6
33 files changed, 1097 insertions, 335 deletions
diff --git a/src/charts/line.php b/src/charts/line.php
index 8ca290a..db33938 100644
--- a/src/charts/line.php
+++ b/src/charts/line.php
@@ -83,49 +83,119 @@ class ezcGraphLineChart extends ezcGraphChart
$yAxisNullPosition = $this->elements['yAxis']->getCoordinate( false );
- $nr = count( $this->data );
+ // Initialize counters
+ $nr = array();
+ $count = array();
+
foreach ( $this->data as $data )
{
- --$nr;
- // Determine fill color for dataset
- if ( $this->options->fillLines !== false )
- {
- $fillColor = clone $data->color->default;
- $fillColor->alpha = (int) round( ( 255 - $fillColor->alpha ) * ( $this->options->fillLines / 255 ) );
- }
- else
+ if ( !isset( $nr[$data->displayType->default] ) )
{
- $fillColor = null;
+ $nr[$data->displayType->default] = 0;
+ $count[$data->displayType->default] = 0;
}
- // Draw lines for dataset
- $lastPoint = false;
- foreach ( $data as $key => $value )
+ $nr[$data->displayType->default]++;
+ $count[$data->displayType->default]++;
+ }
+
+ // Display data
+ foreach ( $this->data as $data )
+ {
+ --$nr[$data->displayType->default];
+ switch ( $data->displayType->default )
{
- $point = new ezcGraphCoordinate(
- $this->elements['xAxis']->getCoordinate( $key ),
- $this->elements['yAxis']->getCoordinate( $value )
- );
-
- $renderer->drawDataLine(
- $boundings,
- $data->color->default,
- ( $lastPoint === false ? $point : $lastPoint ),
- $point,
- $nr,
- count( $this->data ),
- $data->symbol[$key],
- $data->color[$key],
- $fillColor,
- $yAxisNullPosition
- );
-
- $lastPoint = $point;
+ case ezcGraph::LINE:
+ // Determine fill color for dataset
+ if ( $this->options->fillLines !== false )
+ {
+ $fillColor = clone $data->color->default;
+ $fillColor->alpha = (int) round( ( 255 - $fillColor->alpha ) * ( $this->options->fillLines / 255 ) );
+ }
+ else
+ {
+ $fillColor = null;
+ }
+
+ // Draw lines for dataset
+ $lastPoint = false;
+ foreach ( $data as $key => $value )
+ {
+ $point = $this->elements['xAxis']->axisLabelRenderer->modifyChartDataPosition(
+ $this->elements['yAxis']->axisLabelRenderer->modifyChartDataPosition(
+ new ezcGraphCoordinate(
+ $this->elements['xAxis']->getCoordinate( $key ),
+ $this->elements['yAxis']->getCoordinate( $value )
+ )
+ )
+ );
+
+ $renderer->drawDataLine(
+ $boundings,
+ $data->color->default,
+ ( $lastPoint === false ? $point : $lastPoint ),
+ $point,
+ $nr[$data->displayType->default],
+ $count[$data->displayType->default],
+ $data->symbol[$key],
+ $data->color[$key],
+ $fillColor,
+ $yAxisNullPosition
+ );
+
+ $lastPoint = $point;
+ }
+ break;
+ case ezcGraph::BAR:
+ $width = $this->elements['xAxis']->axisLabelRenderer->modifyChartDataPosition(
+ $this->elements['yAxis']->axisLabelRenderer->modifyChartDataPosition(
+ new ezcGraphCoordinate(
+ ( $boundings->x1 - $boundings->x0 ) / $this->elements['xAxis']->getMajorStepCount(),
+ 0
+ )
+ )
+ )->x;
+
+ foreach ( $data as $key => $value )
+ {
+ $point = new ezcGraphCoordinate(
+ $this->elements['xAxis']->getCoordinate( $key ),
+ $this->elements['yAxis']->getCoordinate( $value )
+ );
+
+ $renderer->drawBar(
+ $boundings,
+ $data->color->default,
+ $this->elements['xAxis']->axisLabelRenderer->modifyChartDataPosition(
+ $this->elements['yAxis']->axisLabelRenderer->modifyChartDataPosition(
+ $point
+ )
+ ),
+ $width,
+ $nr[$data->displayType->default],
+ $count[$data->displayType->default],
+ $yAxisNullPosition
+ );
+ }
+ break;
+ default:
+ throw new ezcGraphInvalidDisplayTypeException( $data->displayType->default );
+ break;
}
}
}
/**
+ * Returns the default display type of the current chart type.
+ *
+ * @return int Display type
+ */
+ protected function getDefaultDisplayType()
+ {
+ return ezcGraph::LINE;
+ }
+
+ /**
* Render a line chart
*
* @param ezcGraphRenderer $renderer
@@ -168,6 +238,12 @@ class ezcGraphLineChart extends ezcGraphChart
$boundings->x1 = $this->options->width;
$boundings->y1 = $this->options->height;
+ $boundings = $this->elements['xAxis']->axisLabelRenderer->modifyChartBoundings(
+ $this->elements['yAxis']->axisLabelRenderer->modifyChartBoundings(
+ $boundings, new ezcGraphCoordinate( 1, 0 )
+ ), new ezcGraphCoordinate( -1, 0 )
+ );
+
// Render subelements
foreach ( $this->elements as $name => $element )
{
diff --git a/src/charts/pie.php b/src/charts/pie.php
index 4a23911..a832796 100644
--- a/src/charts/pie.php
+++ b/src/charts/pie.php
@@ -31,7 +31,7 @@ class ezcGraphPieChart extends ezcGraphChart
* If too many datasets are created
* @return ezcGraphDataSet
*/
- protected function addDataSet( $name, $values )
+ protected function addDataSet( $name, ezcGraphDataSet $values )
{
if ( count( $this->data ) >= 1 &&
!isset( $this->data[$name] ) )
@@ -67,18 +67,36 @@ class ezcGraphPieChart extends ezcGraphChart
$angle = 0;
foreach ( $dataset as $label => $value )
{
- $renderer->drawPieSegment(
- $boundings,
- $dataset->color[$label],
- $angle,
- $angle += $value / $sum * 360,
- sprintf( $this->options->label, $label, $value, $value / $sum * 100 ),
- $dataset->highlight[$label]
- );
+ switch( $dataset->displayType->default )
+ {
+ case ezcGraph::PIE:
+ $renderer->drawPieSegment(
+ $boundings,
+ $dataset->color[$label],
+ $angle,
+ $angle += $value / $sum * 360,
+ sprintf( $this->options->label, $label, $value, $value / $sum * 100 ),
+ $dataset->highlight[$label]
+ );
+ break;
+ default:
+ throw new ezcGraphInvalidDisplayTypeException( $dataset->displayType->default );
+ break;
+ }
}
}
/**
+ * Returns the default display type of the current chart type.
+ *
+ * @return int Display type
+ */
+ protected function getDefaultDisplayType()
+ {
+ return ezcGraph::PIE;
+ }
+
+ /**
* Render a pie chart
*
* @param ezcGraphRenderer $renderer
diff --git a/src/datasets/array.php b/src/datasets/array.php
new file mode 100644
index 0000000..44aa82c
--- /dev/null
+++ b/src/datasets/array.php
@@ -0,0 +1,42 @@
+<?php
+/**
+ * File containing the abstract ezcGraphArrayDataSet class
+ *
+ * @package Graph
+ * @version //autogentag//
+ * @copyright Copyright (C) 2005, 2006 eZ systems as. All rights reserved.
+ * @license http://ez.no/licenses/new_bsd New BSD License
+ */
+/**
+ * Basic class to contain the charts data
+ *
+ * @package Graph
+ */
+class ezcGraphArrayDataSet extends ezcGraphDataSet
+{
+ public function __construct( $data )
+ {
+ $this->createFromArray( $data );
+ parent::__construct();
+ }
+
+ /**
+ * setData
+ *
+ * @param array $data
+ * @access public
+ * @return void
+ */
+ protected function createFromArray( $data = array() )
+ {
+ foreach ( $data as $key => $value )
+ {
+ if ( is_numeric( $value ) )
+ {
+ $this->data[$key] = (float) $value;
+ }
+ }
+ }
+}
+
+?>
diff --git a/src/datasets/average.php b/src/datasets/average.php
index 7d9a662..3af2094 100644
--- a/src/datasets/average.php
+++ b/src/datasets/average.php
@@ -12,7 +12,7 @@
*
* @package Graph
*/
-class ezcGraphDataSetAverage extends ezcDataSet
+class ezcGraphDataSetAverage extends ezcGraphDataSet
{
}
diff --git a/src/datasets/base.php b/src/datasets/base.php
index 849f996..2f5fc92 100644
--- a/src/datasets/base.php
+++ b/src/datasets/base.php
@@ -12,7 +12,7 @@
*
* @package Graph
*/
-class ezcGraphDataSet implements ArrayAccess, Iterator
+abstract class ezcGraphDataSet implements ArrayAccess, Iterator
{
/**
@@ -45,6 +45,13 @@ class ezcGraphDataSet implements ArrayAccess, Iterator
protected $highlight;
/**
+ * Display type of chart data.
+ *
+ * @var integer
+ */
+ protected $displayType;
+
+ /**
* Array which contains the data of the dataset
*
* @var array
@@ -72,28 +79,11 @@ class ezcGraphDataSet implements ArrayAccess, Iterator
$this->color = new ezcGraphDataSetColorProperty( $this );
$this->symbol = new ezcGraphDataSetIntProperty( $this );
$this->highlight = new ezcGraphDataSetBooleanProperty( $this );
+ $this->displayType = new ezcGraphDataSetIntProperty( $this );
$this->highlight->default = false;
}
- /**
- * setData
- *
- * @param array $data
- * @access public
- * @return void
- */
- public function createFromArray( $data = array() )
- {
- foreach ( $data as $key => $value )
- {
- if ( is_numeric( $value ) )
- {
- $this->data[$key] = (float) $value;
- }
- }
- }
-
public function __set( $propertyName, $propertyValue )
{
switch ( $propertyName )
@@ -111,6 +101,9 @@ class ezcGraphDataSet implements ArrayAccess, Iterator
case 'hilight':
$this->highlight->default = $propertyValue;
break;
+ case 'displayType':
+ $this->displayType->default = $propertyValue;
+ break;
case 'palette':
$this->palette = $propertyValue;
$this->color->default = $this->palette->dataSetColor;
diff --git a/src/exceptions/invalid_id.php b/src/exceptions/invalid_id.php
index d849f13..684aeeb 100644
--- a/src/exceptions/invalid_id.php
+++ b/src/exceptions/invalid_id.php
@@ -23,4 +23,3 @@ class ezcGraphSvgDriverInvalidIdException extends ezcGraphException
}
?>
-
diff --git a/src/exceptions/unknown_dataset_source.php b/src/exceptions/unknown_dataset_source.php
index 63beb52..7bd719a 100644
--- a/src/exceptions/unknown_dataset_source.php
+++ b/src/exceptions/unknown_dataset_source.php
@@ -18,7 +18,7 @@ class ezcGraphUnknownDataSetSourceException extends ezcGraphException
{
public function __construct( $source )
{
- parent::__construct( 'You provided data which could not be handled as a dataset, yet.' );
+ parent::__construct( 'Your provided data which could not be handled as a dataset.' );
}
}
diff --git a/src/graph.php b/src/graph.php
index fa4555a..0b9cff3 100644
--- a/src/graph.php
+++ b/src/graph.php
@@ -29,6 +29,10 @@ class ezcGraph
const RIGHT = 8;
const CENTER = 16;
const MIDDLE = 32;
+
+ const PIE = 1;
+ const LINE = 2;
+ const BAR = 3;
}
?>
diff --git a/src/graph_autoload.php b/src/graph_autoload.php
index 15703ea..188a38a 100644
--- a/src/graph_autoload.php
+++ b/src/graph_autoload.php
@@ -36,6 +36,7 @@ return array(
'ezcGraphAxisNoLabelRenderer' => 'Graph/renderer/axis_label_none.php',
'ezcGraphAxisExactLabelRenderer' => 'Graph/renderer/axis_label_exact.php',
'ezcGraphAxisCenteredLabelRenderer' => 'Graph/renderer/axis_label_centered.php',
+ 'ezcGraphAxisBoxedLabelRenderer' => 'Graph/renderer/axis_label_boxed.php',
'ezcGraphDriver' => 'Graph/interfaces/driver.php',
'ezcGraphDriverOptions' => 'Graph/options/driver.php',
@@ -66,7 +67,8 @@ return array(
'ezcGraphChartElementLabeledAxis' => 'Graph/axis/labeled.php',
'ezcGraphDataSet' => 'Graph/datasets/base.php',
- 'ezcGraphDataSetAverage' => 'Graph/datasets/average.php',
+ 'ezcGraphArrayDataSet' => 'Graph/datasets/array.php',
+ 'ezcGraphAverageDataSet' => 'Graph/datasets/average.php',
'ezcGraphDataSetProperty' => 'Graph/interfaces/dataset_property.php',
'ezcGraphDataSetColorProperty' => 'Graph/datasets/property/color.php',
'ezcGraphDataSetStringProperty' => 'Graph/datasets/property/string.php',
@@ -76,6 +78,7 @@ return array(
'ezcGraphNoSuchDataSetException' => 'Graph/exceptions/no_such_dataset.php',
'ezcGraphTooManyDataSetsExceptions' => 'Graph/exceptions/too_many_datasets.php',
'ezcGraphUnknownDataSetSourceException' => 'Graph/exceptions/unknown_dataset_source.php',
+ 'ezcGraphInvalidDisplayTypeException' => 'Graph/exceptions/invalid_display_type.php',
'ezcGraphBoundings' => 'Graph/structs/boundings.php',
'ezcGraphCoordinate' => 'Graph/structs/coordinate.php',
diff --git a/src/interfaces/axis_label_renderer.php b/src/interfaces/axis_label_renderer.php
index 309edcc..63401d5 100644
--- a/src/interfaces/axis_label_renderer.php
+++ b/src/interfaces/axis_label_renderer.php
@@ -270,7 +270,7 @@ abstract class ezcGraphAxisLabelRenderer extends ezcBaseOptions
/**
* Modify chart boundings
*
- * Optionally modify boundings of
+ * Optionally modify boundings of chart data
*
* @param ezcGraphBoundings $boundings Current boundings of chart
* @param ezcGraphCoordinate $direction Direction of the current axis
@@ -287,10 +287,9 @@ abstract class ezcGraphAxisLabelRenderer extends ezcBaseOptions
* Optionally additionally modify the coodinate of a data point
*
* @param ezcGraphCoordinate $coordinate Data point coordinate
- * @param ezcGraphCoordinate $direction Direction of the current axis
* @return ezcGraphCoordinate Modified coordinate
*/
- public function modifyChartDataPosition( ezcGraphCoordinate $coordinate, ezcGraphCoordinate $direction )
+ public function modifyChartDataPosition( ezcGraphCoordinate $coordinate )
{
return $coordinate;
}
diff --git a/src/interfaces/chart.php b/src/interfaces/chart.php
index ca9b16b..d87ad37 100644
--- a/src/interfaces/chart.php
+++ b/src/interfaces/chart.php
@@ -194,26 +194,13 @@ abstract class ezcGraphChart implements ArrayAccess
* If too many datasets are created
* @return ezcGraphDataSet
*/
- protected function addDataSet( $name, $values )
+ protected function addDataSet( $name, ezcGraphDataSet $dataSet )
{
- $this->data[$name] = new ezcGraphDataSet();
+ $this->data[$name] = $dataSet;
- if ( is_array($values) )
- {
- $this->data[$name]->createFromArray( $values );
- $this->data[$name]->label = $name;
- $this->data[$name]->palette = $this->palette;
- }
- elseif ( $values instanceof PDOStatement )
- {
- $this->data[$name]->createFromStatement( $values );
- $this->data[$name]->label = $name;
- $this->data[$name]->palette = $this->palette;
- }
- else
- {
- throw new ezcGraphUnknownDataSetSourceException( $values );
- }
+ $this->data[$name]->label = $name;
+ $this->data[$name]->palette = $this->palette;
+ $this->data[$name]->displayType = $this->getDefaultDisplayType();
}
/**
@@ -261,6 +248,11 @@ abstract class ezcGraphChart implements ArrayAccess
public function offsetSet( $key, $value )
{
+ if ( !$value instanceof ezcGraphDataSet )
+ {
+ throw new ezcGraphUnknownDataSetSourceException( $value );
+ }
+
return $this->addDataSet( $key, $value );
}
@@ -291,6 +283,13 @@ abstract class ezcGraphChart implements ArrayAccess
}
/**
+ * Returns the default display type of the current chart type.
+ *
+ * @return int Display type
+ */
+ abstract protected function getDefaultDisplayType();
+
+ /**
* Renders this chart
*
* Creates basic visual chart elements from the chart to be processed by
diff --git a/src/interfaces/renderer.php b/src/interfaces/renderer.php
index 5abb86f..2549f00 100644
--- a/src/interfaces/renderer.php
+++ b/src/interfaces/renderer.php
@@ -47,6 +47,30 @@ abstract class ezcGraphRenderer
);
/**
+ * Draw bar
+ *
+ * Draws a bar as a data element in a line chart
+ *
+ * @param ezcGraphBoundings $boundings Chart boundings
+ * @param ezcGraphColor $color Color of line
+ * @param ezcGraphCoordinate $position Position of data point
+ * @param float $stepSize Space which can be used for bars
+ * @param int $dataNumber Number of dataset
+ * @param int $dataCount Count of datasets in chart
+ * @param float $axisPosition Position of axis for drawing filled lines
+ * @return void
+ */
+ abstract public function drawBar(
+ ezcGraphBoundings $boundings,
+ ezcGraphColor $color,
+ ezcGraphCoordinate $position,
+ $stepSize,
+ $dataNumber = 1,
+ $dataCount = 1,
+ $axisPosition = 0.
+ );
+
+ /**
* Draw data line
*
* Draws a line as a data element in a line chart
diff --git a/src/options/renderer_2d.php b/src/options/renderer_2d.php
index caddacd..dd2c4b2 100644
--- a/src/options/renderer_2d.php
+++ b/src/options/renderer_2d.php
@@ -60,6 +60,28 @@ class ezcGraphRenderer2dOptions extends ezcGraphChartOptions
protected $titleAlignement = 48; // ezcGraph::MIDDLE | ezcGraph::CENTER
/**
+ * Factor to darken border of data elements, like lines, bars and pie
+ * segments
+ *
+ * @var float
+ */
+ protected $dataBorder = .5;
+
+ /**
+ * Procentual distance between bar blocks
+ *
+ * @var float
+ */
+ protected $barMargin = .1;
+
+ /**
+ * Procentual distance between bars
+ *
+ * @var float
+ */
+ protected $barPadding = .05;
+
+ /**
* Set an option value
*
* @param string $propertyName
@@ -90,6 +112,15 @@ class ezcGraphRenderer2dOptions extends ezcGraphChartOptions
case 'titleAlignement':
$this->titleAlignement = (int) $propertyValue;
break;
+ case 'dataBorder':
+ $this->dataBorder = min( 1, max( 0, (float) $propertyValue ) );
+ break;
+ case 'barMargin':
+ $this->barMargin = min( 1, max( 0, (float) $propertyValue ) );
+ break;
+ case 'barPadding':
+ $this->barPadding = min( 1, max( 0, (float) $propertyValue ) );
+ break;
default:
return parent::__set( $propertyName, $propertyValue );
}
diff --git a/src/options/renderer_3d.php b/src/options/renderer_3d.php
index abf8046..04994d1 100644
--- a/src/options/renderer_3d.php
+++ b/src/options/renderer_3d.php
@@ -112,6 +112,27 @@ class ezcGraphRenderer3dOptions extends ezcGraphChartOptions
protected $pieChartRotation = .6;
/**
+ * Used transparency for pie chart shadows
+ *
+ * @var float
+ */
+ protected $pieChartShadow = .6;
+
+ /**
+ * Procentual distance between bar blocks
+ *
+ * @var float
+ */
+ protected $barMargin = .1;
+
+ /**
+ * Procentual distance between bars
+ *
+ * @var float
+ */
+ protected $barPadding = .05;
+
+ /**
* Set an option value
*
* @param string $propertyName
@@ -163,6 +184,18 @@ class ezcGraphRenderer3dOptions extends ezcGraphChartOptions
case 'pieChartRotation':
$this->pieChartRotation = min( 1, max( 0, (float) $propertyValue ) );
break;
+ case 'pieChartRotation':
+ $this->pieChartRotation = min( 1, max( 0, (float) $propertyValue ) );
+ break;
+ case 'pieChartShadow':
+ $this->pieChartShadow = min( 1, max( 0, (float) $propertyValue ) );
+ break;
+ case 'barMargin':
+ $this->barMargin = min( 1, max( 0, (float) $propertyValue ) );
+ break;
+ case 'barPadding':
+ $this->barPadding = min( 1, max( 0, (float) $propertyValue ) );
+ break;
default:
return parent::__set( $propertyName, $propertyValue );
}
diff --git a/src/renderer/2d.php b/src/renderer/2d.php
index 1c54de0..ed3ebff 100644
--- a/src/renderer/2d.php
+++ b/src/renderer/2d.php
@@ -264,6 +264,72 @@ class ezcGraphRenderer2d extends ezcGraphRenderer
}
/**
+ * Draw bar
+ *
+ * Draws a bar as a data element in a line chart
+ *
+ * @param ezcGraphBoundings $boundings Chart boundings
+ * @param ezcGraphColor $color Color of line
+ * @param ezcGraphCoordinate $position Position of data point
+ * @param float $stepSize Space which can be used for bars
+ * @param int $dataNumber Number of dataset
+ * @param int $dataCount Count of datasets in chart
+ * @param float $axisPosition Position of axis for drawing filled lines
+ * @return void
+ */
+ public function drawBar(
+ ezcGraphBoundings $boundings,
+ ezcGraphColor $color,
+ ezcGraphCoordinate $position,
+ $stepSize,
+ $dataNumber = 1,
+ $dataCount = 1,
+ $axisPosition = 0. )
+ {
+ // Apply margin
+ $margin = $stepSize * $this->options->barMargin;
+ $padding = $stepSize * $this->options->barPadding;
+ $barWidth = ( $stepSize - $margin ) / $dataCount - $padding;
+ $offset = - $stepSize / 2 + $margin / 2 + $dataNumber * ( $padding + $barWidth ) + $padding / 2;
+
+ $barPointArray = array(
+ new ezcGraphCoordinate(
+ $boundings->x0 + ( $boundings->x1 - $boundings->x0 ) * $position->x + $offset,
+ $boundings->y0 + ( $boundings->y1 - $boundings->y0 ) * $axisPosition
+ ),
+ new ezcGraphCoordinate(
+ $boundings->x0 + ( $boundings->x1 - $boundings->x0 ) * $position->x + $offset,
+ $boundings->y0 + ( $boundings->y1 - $boundings->y0 ) * $position->y
+ ),
+ new ezcGraphCoordinate(
+ $boundings->x0 + ( $boundings->x1 - $boundings->x0 ) * $position->x + $offset + $barWidth,
+ $boundings->y0 + ( $boundings->y1 - $boundings->y0 ) * $position->y
+ ),
+ new ezcGraphCoordinate(
+ $boundings->x0 + ( $boundings->x1 - $boundings->x0 ) * $position->x + $offset + $barWidth,
+ $boundings->y0 + ( $boundings->y1 - $boundings->y0 ) * $axisPosition
+ ),
+ );
+
+ $this->driver->drawPolygon(
+ $barPointArray,
+ $color,
+ true
+ );
+
+ if ( $this->options->dataBorder > 0 )
+ {
+ $darkened = $color->darken( $this->options->dataBorder );
+ $this->driver->drawPolygon(
+ $barPointArray,
+ $darkened,
+ false,
+ 1
+ );
+ }
+ }
+
+ /**
* Draw data line
*
* Draws a line as a data element in a line chart
diff --git a/src/renderer/3d.php b/src/renderer/3d.php
index 1997e56..4537fa7 100644
--- a/src/renderer/3d.php
+++ b/src/renderer/3d.php
@@ -91,7 +91,8 @@ class ezcGraphRenderer3d extends ezcGraphRenderer
// Calculate position and size of pie
$center = new ezcGraphCoordinate(
$boundings->x0 + ( $boundings->x1 - $boundings->x0 ) / 2,
- $boundings->y0 + ( $boundings->y1 - $boundings->y0 ) / 2 - $this->options->pieChartHeight / 2
+ $boundings->y0 + ( $boundings->y1 - $boundings->y0 ) / 2
+ - $this->options->pieChartHeight / 2
);
// Limit radius to fourth of width and half of height at maximum
@@ -432,6 +433,32 @@ class ezcGraphRenderer3d extends ezcGraphRenderer
}
/**
+ * Draw bar
+ *
+ * Draws a bar as a data element in a line chart
+ *
+ * @param ezcGraphBoundings $boundings Chart boundings
+ * @param ezcGraphColor $color Color of line
+ * @param ezcGraphCoordinate $position Position of data point
+ * @param float $stepSize Space which can be used for bars
+ * @param int $dataNumber Number of dataset
+ * @param int $dataCount Count of datasets in chart
+ * @param float $axisPosition Position of axis for drawing filled lines
+ * @return void
+ */
+ public function drawBar(
+ ezcGraphBoundings $boundings,
+ ezcGraphColor $color,
+ ezcGraphCoordinate $position,
+ $stepSize,
+ $dataNumber = 1,
+ $dataCount = 1,
+ $axisPosition = 0. )
+ {
+ // @TODO: implement
+ }
+
+ /**
* Draw data line
*
* Draws a line as a data element in a line chart
diff --git a/src/renderer/axis_label_boxed.php b/src/renderer/axis_label_boxed.php
new file mode 100644
index 0000000..be76e9a
--- /dev/null
+++ b/src/renderer/axis_label_boxed.php
@@ -0,0 +1,171 @@
+<?php
+/**
+ * File containing the abstract ezcGraphAxisExactLabelRenderer class
+ *
+ * @package Graph
+ * @version //autogentag//
+ * @copyright Copyright (C) 2005,
+ 2006 eZ systems as. All rights reserved.
+ * @license http://ez.no/licenses/new_bsd New BSD License
+ */
+/**
+ * Renders axis labels like known from charts drawn in analysis
+ *
+ * @package Graph
+ */
+class ezcGraphAxisBoxedLabelRenderer extends ezcGraphAxisLabelRenderer
+{
+
+ protected $outerStep = true;
+
+ protected $direction;
+
+ /**
+ * Render Axis labels
+ *
+ * Render labels for an axis.
+ *
+ * @param ezcGraphRenderer $renderer Renderer used to draw the chart
+ * @param ezcGraphBoundings $boundings Boundings of the axis
+ * @param ezcGraphCoordinate $start Axis starting point
+ * @param ezcGraphCoordinate $end Axis ending point
+ * @param ezcGraphChartElementAxis $axis Axis instance
+ * @return void
+ */
+ public function renderLabels(
+ ezcGraphRenderer $renderer,
+ ezcGraphBoundings $boundings,
+ ezcGraphCoordinate $start,
+ ezcGraphCoordinate $end,
+ ezcGraphChartElementAxis $axis )
+ {
+ // receive rendering parameters from axis
+ $this->majorStepCount = $axis->getMajorStepCount() + 1;
+
+ // Determine normalized axis direction
+ $direction = new ezcGraphCoordinate(
+ $start->x - $end->x,
+ $start->y - $end->y
+ );
+ $length = sqrt( pow( $direction->x, 2) + pow( $direction->y, 2 ) );
+ $direction->x /= $length;
+ $direction->y /= $length;
+ $this->direction = $direction;
+
+ // Calculate stepsizes for mjor and minor steps
+ $majorStep = new ezcGraphCoordinate(
+ ( $end->x - $start->x ) / $this->majorStepCount,
+ ( $end->y - $start->y ) / $this->majorStepCount
+ );
+
+ if ( $this->outerGrid )
+ {
+ $gridBoundings = $boundings;
+ }
+ else
+ {
+ $gridBoundings = new ezcGraphBoundings(
+ $boundings->x0 + ( $boundings->x1 - $boundings->x0 ) * $axis->axisSpace,
+ $boundings->y0 + ( $boundings->y1 - $boundings->y0 ) * $axis->axisSpace,
+ $boundings->x1 - ( $boundings->x1 - $boundings->x0 ) * $axis->axisSpace,
+ $boundings->y1 - ( $boundings->y1 - $boundings->y0 ) * $axis->axisSpace
+ );
+ }
+
+ // Determine size of labels
+ switch ( $axis->position )
+ {
+ case ezcGraph::RIGHT:
+ case ezcGraph::LEFT:
+ $labelWidth = min(
+ abs( $majorStep->x ),
+ ( $boundings->x1 - $boundings->x0 ) * $axis->axisSpace * 2
+ );
+ $labelHeight = ( $boundings->y1 - $boundings->y0 ) * $axis->axisSpace;
+ break;
+ case ezcGraph::BOTTOM:
+ case ezcGraph::TOP:
+ $labelWidth = ( $boundings->x1 - $boundings->x0 ) * $axis->axisSpace;
+ $labelHeight = min(
+ abs( $majorStep->y ),
+ ( $boundings->y1 - $boundings->y0 ) * $axis->axisSpace * 2
+ );
+ break;
+ }
+
+ // Draw steps and grid
+ $step = 0;
+ while ( $step <= $this->majorStepCount )
+ {
+ if ( ! $axis->isZeroStep( $step ) )
+ {
+ // major grid
+ if ( $axis->majorGrid )
+ {
+ $this->drawGrid( $renderer, $gridBoundings, $start, $majorStep, $axis->majorGrid );
+ }
+
+ // major step
+ $this->drawStep( $renderer, $start, $direction, $axis->position, $this->majorStepSize, $axis->border );
+ }
+
+ // draw label
+ if ( $step < $this->majorStepCount )
+ {
+ $label = $axis->getLabel( $step );
+ switch ( $axis->position )
+ {
+ case ezcGraph::TOP:
+ case ezcGraph::BOTTOM:
+ $renderer->drawText(
+ new ezcGraphBoundings(
+ $start->x - $labelWidth + $this->labelPadding,
+ $start->y + $this->labelPadding,
+ $start->x - $this->labelPadding,
+ $start->y + $labelHeight - $this->labelPadding
+ ),
+ $label,
+ ezcGraph::MIDDLE | ezcGraph::RIGHT
+ );
+ break;
+ case ezcGraph::LEFT:
+ case ezcGraph::RIGHT:
+ $renderer->drawText(
+ new ezcGraphBoundings(
+ $start->x + $this->labelPadding,
+ $start->y + $this->labelPadding,
+ $start->x + $labelWidth - $this->labelPadding,
+ $start->y + $labelHeight - $this->labelPadding
+ ),
+ $label,
+ ezcGraph::CENTER | ezcGraph::TOP
+ );
+ break;
+ }
+ }
+
+ $start->x += $majorStep->x;
+ $start->y += $majorStep->y;
+ ++$step;
+ }
+ }
+
+ /**
+ * Modify chart data position
+ *
+ * Optionally additionally modify the coodinate of a data point
+ *
+ * @param ezcGraphCoordinate $coordinate Data point coordinate
+ * @return ezcGraphCoordinate Modified coordinate
+ */
+ public function modifyChartDataPosition( ezcGraphCoordinate $coordinate )
+ {
+ return new ezcGraphCoordinate(
+ $coordinate->x * abs( $this->direction->y ) +
+ ( $coordinate->x * ( 1 - 1 / $this->majorStepCount ) + ( 1 / $this->majorStepCount / 2 ) ) * abs( $this->direction->x ),
+ $coordinate->y * abs( $this->direction->x ) +
+ ( $coordinate->y * ( 1 - 1 / $this->majorStepCount ) + ( 1 / $this->majorStepCount / 2 ) ) * abs( $this->direction->y )
+ );
+ }
+}
+?>
diff --git a/tests/axis_centered_renderer_test.php b/tests/axis_centered_renderer_test.php
index 2ae65ba..058664f 100644
--- a/tests/axis_centered_renderer_test.php
+++ b/tests/axis_centered_renderer_test.php
@@ -51,7 +51,7 @@ class ezcGraphAxisCenteredRendererTest extends ezcTestCase
$chart->palette = new ezcGraphPaletteBlack();
$chart->xAxis->axisLabelRenderer = new ezcGraphAxisCenteredLabelRenderer();
$chart->yAxis->axisLabelRenderer = new ezcGraphAxisNoLabelRenderer();
- $chart['sampleData'] = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1);
+ $chart['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',
@@ -86,7 +86,7 @@ class ezcGraphAxisCenteredRendererTest extends ezcTestCase
$chart->xAxis->axisLabelRenderer = new ezcGraphAxisCenteredLabelRenderer();
$chart->yAxis->axisLabelRenderer = new ezcGraphAxisNoLabelRenderer();
$chart->xAxis->axisLabelRenderer->outerGrid = true;
- $chart['sampleData'] = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1);
+ $chart['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',
@@ -120,7 +120,7 @@ class ezcGraphAxisCenteredRendererTest extends ezcTestCase
$chart->palette = new ezcGraphPaletteBlack();
$chart->xAxis->axisLabelRenderer = new ezcGraphAxisCenteredLabelRenderer();
$chart->yAxis->axisLabelRenderer = new ezcGraphAxisNoLabelRenderer();
- $chart['sampleData'] = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1);
+ $chart['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) );
$mockedRenderer = $this->getMock( 'ezcGraphRenderer2d', array(
'drawStepLine',
@@ -155,7 +155,7 @@ class ezcGraphAxisCenteredRendererTest extends ezcTestCase
$chart->xAxis->axisLabelRenderer = new ezcGraphAxisCenteredLabelRenderer();
$chart->yAxis->axisLabelRenderer = new ezcGraphAxisNoLabelRenderer();
$chart->xAxis->axisLabelRenderer->outerStep = true;
- $chart['sampleData'] = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1);
+ $chart['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) );
$mockedRenderer = $this->getMock( 'ezcGraphRenderer2d', array(
'drawStepLine',
@@ -191,7 +191,7 @@ class ezcGraphAxisCenteredRendererTest extends ezcTestCase
$chart->yAxis->axisLabelRenderer = new ezcGraphAxisNoLabelRenderer();
$chart->xAxis->axisLabelRenderer->innerStep = false;
$chart->xAxis->axisLabelRenderer->outerStep = true;
- $chart['sampleData'] = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1);
+ $chart['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) );
$mockedRenderer = $this->getMock( 'ezcGraphRenderer2d', array(
'drawStepLine',
@@ -227,7 +227,7 @@ class ezcGraphAxisCenteredRendererTest extends ezcTestCase
$chart->yAxis->axisLabelRenderer = new ezcGraphAxisNoLabelRenderer();
$chart->xAxis->axisLabelRenderer->innerStep = false;
$chart->yAxis->axisLabelRenderer->innerStep = false;
- $chart['sampleData'] = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1);
+ $chart['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) );
$mockedRenderer = $this->getMock( 'ezcGraphRenderer2d', array(
'drawStepLine',
@@ -248,7 +248,7 @@ class ezcGraphAxisCenteredRendererTest extends ezcTestCase
$chart->palette = new ezcGraphPaletteBlack();
$chart->xAxis->axisLabelRenderer = new ezcGraphAxisCenteredLabelRenderer();
$chart->yAxis->axisLabelRenderer = new ezcGraphAxisNoLabelRenderer();
- $chart['sampleData'] = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1);
+ $chart['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) );
$mockedRenderer = $this->getMock( 'ezcGraphRenderer2d', array(
'drawText',
@@ -283,7 +283,7 @@ class ezcGraphAxisCenteredRendererTest extends ezcTestCase
$chart->xAxis->axisLabelRenderer = new ezcGraphAxisCenteredLabelRenderer();
$chart->yAxis->axisLabelRenderer = new ezcGraphAxisNoLabelRenderer();
$chart->xAxis->axisLabelRenderer->showZeroValue = true;
- $chart['sampleData'] = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1);
+ $chart['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) );
$mockedRenderer = $this->getMock( 'ezcGraphRenderer2d', array(
'drawText',
@@ -326,7 +326,7 @@ class ezcGraphAxisCenteredRendererTest extends ezcTestCase
$chart->xAxis->axisLabelRenderer = new ezcGraphAxisCenteredLabelRenderer();
$chart->yAxis->axisLabelRenderer = new ezcGraphAxisNoLabelRenderer();
$chart->xAxis->position = ezcGraph::RIGHT;
- $chart['sampleData'] = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1);
+ $chart['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',
@@ -361,7 +361,7 @@ class ezcGraphAxisCenteredRendererTest extends ezcTestCase
$chart->xAxis->axisLabelRenderer = new ezcGraphAxisNoLabelRenderer();
$chart->yAxis->axisLabelRenderer = new ezcGraphAxisCenteredLabelRenderer();
$chart->yAxis->position = ezcGraph::TOP;
- $chart['sampleData'] = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1);
+ $chart['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',
@@ -396,7 +396,7 @@ class ezcGraphAxisCenteredRendererTest extends ezcTestCase
$chart->xAxis->axisLabelRenderer = new ezcGraphAxisNoLabelRenderer();
$chart->yAxis->axisLabelRenderer = new ezcGraphAxisCenteredLabelRenderer();
$chart->yAxis->position = ezcGraph::BOTTOM;
- $chart['sampleData'] = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1);
+ $chart['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',
@@ -431,7 +431,7 @@ class ezcGraphAxisCenteredRendererTest extends ezcTestCase
$chart->xAxis->axisLabelRenderer = new ezcGraphAxisCenteredLabelRenderer();
$chart->xAxis->position = ezcGraph::RIGHT;
$chart->yAxis->axisLabelRenderer = new ezcGraphAxisNoLabelRenderer();
- $chart['sampleData'] = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1);
+ $chart['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) );
$mockedRenderer = $this->getMock( 'ezcGraphRenderer2d', array(
'drawText',
@@ -466,7 +466,7 @@ class ezcGraphAxisCenteredRendererTest extends ezcTestCase
$chart->xAxis->axisLabelRenderer = new ezcGraphAxisNoLabelRenderer();
$chart->yAxis->axisLabelRenderer = new ezcGraphAxisCenteredLabelRenderer();
$chart->yAxis->position = ezcGraph::TOP;
- $chart['sampleData'] = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1);
+ $chart['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) );
$mockedRenderer = $this->getMock( 'ezcGraphRenderer2d', array(
'drawText',
@@ -501,7 +501,7 @@ class ezcGraphAxisCenteredRendererTest extends ezcTestCase
$chart->xAxis->axisLabelRenderer = new ezcGraphAxisNoLabelRenderer();
$chart->yAxis->axisLabelRenderer = new ezcGraphAxisCenteredLabelRenderer();
$chart->yAxis->position = ezcGraph::BOTTOM;
- $chart['sampleData'] = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1);
+ $chart['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) );
$mockedRenderer = $this->getMock( 'ezcGraphRenderer2d', array(
'drawText',
diff --git a/tests/axis_exact_renderer_test.php b/tests/axis_exact_renderer_test.php
index 5e97d60..94dd622 100644
--- a/tests/axis_exact_renderer_test.php
+++ b/tests/axis_exact_renderer_test.php
@@ -131,7 +131,7 @@ class ezcGraphAxisExactRendererTest extends ezcTestCase
$chart->palette = new ezcGraphPaletteBlack();
$chart->xAxis->axisLabelRenderer = new ezcGraphAxisExactLabelRenderer();
$chart->yAxis->axisLabelRenderer = new ezcGraphAxisNoLabelRenderer();
- $chart['sampleData'] = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1);
+ $chart['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',
@@ -166,7 +166,7 @@ class ezcGraphAxisExactRendererTest extends ezcTestCase
$chart->xAxis->axisLabelRenderer = new ezcGraphAxisExactLabelRenderer();
$chart->yAxis->axisLabelRenderer = new ezcGraphAxisNoLabelRenderer();
$chart->xAxis->axisLabelRenderer->outerGrid = true;
- $chart['sampleData'] = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1);
+ $chart['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',
@@ -200,7 +200,7 @@ class ezcGraphAxisExactRendererTest extends ezcTestCase
$chart->palette = new ezcGraphPaletteBlack();
$chart->xAxis->axisLabelRenderer = new ezcGraphAxisExactLabelRenderer();
$chart->yAxis->axisLabelRenderer = new ezcGraphAxisNoLabelRenderer();
- $chart['sampleData'] = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1);
+ $chart['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) );
$mockedRenderer = $this->getMock( 'ezcGraphRenderer2d', array(
'drawStepLine',
@@ -235,7 +235,7 @@ class ezcGraphAxisExactRendererTest extends ezcTestCase
$chart->xAxis->axisLabelRenderer = new ezcGraphAxisExactLabelRenderer();
$chart->yAxis->axisLabelRenderer = new ezcGraphAxisNoLabelRenderer();
$chart->xAxis->axisLabelRenderer->outerStep = true;
- $chart['sampleData'] = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1);
+ $chart['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) );
$mockedRenderer = $this->getMock( 'ezcGraphRenderer2d', array(
'drawStepLine',
@@ -271,7 +271,7 @@ class ezcGraphAxisExactRendererTest extends ezcTestCase
$chart->yAxis->axisLabelRenderer = new ezcGraphAxisNoLabelRenderer();
$chart->xAxis->axisLabelRenderer->innerStep = false;
$chart->xAxis->axisLabelRenderer->outerStep = true;
- $chart['sampleData'] = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1);
+ $chart['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) );
$mockedRenderer = $this->getMock( 'ezcGraphRenderer2d', array(
'drawStepLine',
@@ -307,7 +307,7 @@ class ezcGraphAxisExactRendererTest extends ezcTestCase
$chart->yAxis->axisLabelRenderer = new ezcGraphAxisNoLabelRenderer();
$chart->xAxis->axisLabelRenderer->innerStep = false;
$chart->yAxis->axisLabelRenderer->innerStep = false;
- $chart['sampleData'] = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1);
+ $chart['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) );
$mockedRenderer = $this->getMock( 'ezcGraphRenderer2d', array(
'drawStepLine',
@@ -328,7 +328,7 @@ class ezcGraphAxisExactRendererTest extends ezcTestCase
$chart->palette = new ezcGraphPaletteBlack();
$chart->xAxis->axisLabelRenderer = new ezcGraphAxisExactLabelRenderer();
$chart->yAxis->axisLabelRenderer = new ezcGraphAxisNoLabelRenderer();
- $chart['sampleData'] = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1);
+ $chart['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) );
$mockedRenderer = $this->getMock( 'ezcGraphRenderer2d', array(
'drawText',
@@ -371,7 +371,7 @@ class ezcGraphAxisExactRendererTest extends ezcTestCase
$chart->xAxis->axisLabelRenderer = new ezcGraphAxisExactLabelRenderer();
$chart->yAxis->axisLabelRenderer = new ezcGraphAxisNoLabelRenderer();
$chart->xAxis->axisLabelRenderer->showLastValue = false;
- $chart['sampleData'] = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1);
+ $chart['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) );
$mockedRenderer = $this->getMock( 'ezcGraphRenderer2d', array(
'drawText',
@@ -414,7 +414,7 @@ class ezcGraphAxisExactRendererTest extends ezcTestCase
$chart->xAxis->axisLabelRenderer = new ezcGraphAxisExactLabelRenderer();
$chart->yAxis->axisLabelRenderer = new ezcGraphAxisNoLabelRenderer();
$chart->xAxis->position = ezcGraph::RIGHT;
- $chart['sampleData'] = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1);
+ $chart['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',
@@ -449,7 +449,7 @@ class ezcGraphAxisExactRendererTest extends ezcTestCase
$chart->xAxis->axisLabelRenderer = new ezcGraphAxisNoLabelRenderer();
$chart->yAxis->axisLabelRenderer = new ezcGraphAxisExactLabelRenderer();
$chart->yAxis->position = ezcGraph::TOP;
- $chart['sampleData'] = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1);
+ $chart['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',
@@ -484,7 +484,7 @@ class ezcGraphAxisExactRendererTest extends ezcTestCase
$chart->xAxis->axisLabelRenderer = new ezcGraphAxisNoLabelRenderer();
$chart->yAxis->axisLabelRenderer = new ezcGraphAxisExactLabelRenderer();
$chart->yAxis->position = ezcGraph::BOTTOM;
- $chart['sampleData'] = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1);
+ $chart['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',
@@ -519,7 +519,7 @@ class ezcGraphAxisExactRendererTest extends ezcTestCase
$chart->xAxis->axisLabelRenderer = new ezcGraphAxisExactLabelRenderer();
$chart->xAxis->position = ezcGraph::RIGHT;
$chart->yAxis->axisLabelRenderer = new ezcGraphAxisNoLabelRenderer();
- $chart['sampleData'] = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1);
+ $chart['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) );
$mockedRenderer = $this->getMock( 'ezcGraphRenderer2d', array(
'drawText',
@@ -562,7 +562,7 @@ class ezcGraphAxisExactRendererTest extends ezcTestCase
$chart->xAxis->axisLabelRenderer = new ezcGraphAxisNoLabelRenderer();
$chart->yAxis->axisLabelRenderer = new ezcGraphAxisExactLabelRenderer();
$chart->yAxis->position = ezcGraph::TOP;
- $chart['sampleData'] = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1);
+ $chart['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) );
$mockedRenderer = $this->getMock( 'ezcGraphRenderer2d', array(
'drawText',
@@ -605,7 +605,7 @@ class ezcGraphAxisExactRendererTest extends ezcTestCase
$chart->xAxis->axisLabelRenderer = new ezcGraphAxisNoLabelRenderer();
$chart->yAxis->axisLabelRenderer = new ezcGraphAxisExactLabelRenderer();
$chart->yAxis->position = ezcGraph::BOTTOM;
- $chart['sampleData'] = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1);
+ $chart['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) );
$mockedRenderer = $this->getMock( 'ezcGraphRenderer2d', array(
'drawText',
diff --git a/tests/data/compare/ezcGraphRenderer2dTest_testRenderFilledLineBarChart.png b/tests/data/compare/ezcGraphRenderer2dTest_testRenderFilledLineBarChart.png
new file mode 100644
index 0000000..7a0efbe
--- /dev/null
+++ b/tests/data/compare/ezcGraphRenderer2dTest_testRenderFilledLineBarChart.png
Binary files differ
diff --git a/tests/dataset_test.php b/tests/dataset_test.php
index 7af448c..54851ed 100644
--- a/tests/dataset_test.php
+++ b/tests/dataset_test.php
@@ -44,7 +44,7 @@ class ezcGraphDataSetTest extends ezcTestCase
public function testCreateDataSetFromArray()
{
$chart = new ezcGraphPieChart();
- $chart['humanoids'] = array( 'monkey' => 54, 'ape' => 37, 'human' => 9 );
+ $chart['humanoids'] = new ezcGraphArrayDataSet( array( 'monkey' => 54, 'ape' => 37, 'human' => 9 ) );
$datasets = $this->getNonPublicProperty( $chart, 'data' );
$this->assertTrue(
@@ -56,7 +56,7 @@ class ezcGraphDataSetTest extends ezcTestCase
public function testGetDataSet()
{
$chart = new ezcGraphPieChart();
- $chart['humanoids'] = array( 'monkey' => 54, 'ape' => 37, 'human' => 9 );
+ $chart['humanoids'] = new ezcGraphArrayDataSet( array( 'monkey' => 54, 'ape' => 37, 'human' => 9 ) );
$this->assertTrue(
$chart['humanoids'] instanceof ezcGraphDataSet,
@@ -67,7 +67,7 @@ class ezcGraphDataSetTest extends ezcTestCase
public function testDataSetContent()
{
$chart = new ezcGraphPieChart();
- $chart['example'] = array( 'monkey' => 54, 2001 => 37 );
+ $chart['example'] = new ezcGraphArrayDataSet( array( 'monkey' => 54, 2001 => 37 ) );
$data = $this->getNonPublicProperty( $chart['example'], 'data' );
@@ -84,8 +84,8 @@ class ezcGraphDataSetTest extends ezcTestCase
public function testCreateMultipleDataSetsFromArray()
{
$chart = new ezcGraphLineChart();
- $chart['income'] = array( 2000 => 2345.2, 2456.3, 2567.4 );
- $chart['spending'] = array( 2000 => 2347.2, 2458.3, 2569.4 );
+ $chart['income'] = new ezcGraphArrayDataSet( array( 2000 => 2345.2, 2456.3, 2567.4 ) );
+ $chart['spending'] = new ezcGraphArrayDataSet( array( 2000 => 2347.2, 2458.3, 2569.4 ) );
$datasets = $this->getNonPublicProperty( $chart, 'data' );
$this->assertTrue(
@@ -103,8 +103,8 @@ class ezcGraphDataSetTest extends ezcTestCase
try
{
$chart = new ezcGraphPieChart();
- $chart['income'] = array( 2000 => 2345.2, 2456.3, 2567.4 );
- $chart['spending'] = array( 2000 => 2347.2, 2458.3, 2569.4 );
+ $chart['income'] = new ezcGraphArrayDataSet( array( 2000 => 2345.2, 2456.3, 2567.4 ) );
+ $chart['spending'] = new ezcGraphArrayDataSet( array( 2000 => 2347.2, 2458.3, 2569.4 ) );
}
catch ( ezcGraphTooManyDataSetsExceptions $e )
{
@@ -117,7 +117,7 @@ class ezcGraphDataSetTest extends ezcTestCase
public function testDataSetLabel()
{
$chart = new ezcGraphPieChart();
- $chart['income'] = array( 2000 => 2345.2, 2456.3, 2567.4 );
+ $chart['income'] = new ezcGraphArrayDataSet( array( 2000 => 2345.2, 2456.3, 2567.4 ) );
$this->assertEquals(
'income',
@@ -128,7 +128,7 @@ class ezcGraphDataSetTest extends ezcTestCase
public function testDataSetSetLabel()
{
$chart = new ezcGraphPieChart();
- $chart['income'] = array( 2000 => 2345.2, 2456.3, 2567.4 );
+ $chart['income'] = new ezcGraphArrayDataSet( array( 2000 => 2345.2, 2456.3, 2567.4 ) );
$chart['income']->label = 'Income Label';
$this->assertEquals(
@@ -140,7 +140,7 @@ class ezcGraphDataSetTest extends ezcTestCase
public function testDataSetSetColor()
{
$chart = new ezcGraphPieChart();
- $chart['income'] = array( 2000 => 2345.2, 2456.3, 2567.4 );
+ $chart['income'] = new ezcGraphArrayDataSet( array( 2000 => 2345.2, 2456.3, 2567.4 ) );
$chart['income']->color = '#FF0000';
$this->assertEquals(
@@ -152,7 +152,7 @@ class ezcGraphDataSetTest extends ezcTestCase
public function testDataSetSetHighlight()
{
$chart = new ezcGraphPieChart();
- $chart['income'] = array( 2000 => 2345.2, 2456.3, 2567.4 );
+ $chart['income'] = new ezcGraphArrayDataSet( array( 2000 => 2345.2, 2456.3, 2567.4 ) );
$chart['income']->highlight = true;
$this->assertEquals(
@@ -164,7 +164,7 @@ class ezcGraphDataSetTest extends ezcTestCase
public function testDataSetGetHighlight()
{
$chart = new ezcGraphPieChart();
- $chart['income'] = array( 2000 => 2345.2, 2456.3, 2567.4 );
+ $chart['income'] = new ezcGraphArrayDataSet( array( 2000 => 2345.2, 2456.3, 2567.4 ) );
$this->assertEquals(
false,
@@ -180,7 +180,7 @@ class ezcGraphDataSetTest extends ezcTestCase
public function testDataSetSetHighlightSingle()
{
$chart = new ezcGraphPieChart();
- $chart['income'] = array( 2000 => 2345.2, 2456.3, 2567.4 );
+ $chart['income'] = new ezcGraphArrayDataSet( array( 2000 => 2345.2, 2456.3, 2567.4 ) );
$chart['income']->highlight[2001] = true;
$this->assertEquals(
@@ -197,7 +197,7 @@ class ezcGraphDataSetTest extends ezcTestCase
public function testDataSetSetSingleColor()
{
$chart = new ezcGraphPieChart();
- $chart['income'] = array( 2000 => 2345.2, 2456.3, 2567.4 );
+ $chart['income'] = new ezcGraphArrayDataSet( array( 2000 => 2345.2, 2456.3, 2567.4 ) );
$chart['income']->color[2001] = '#FF0000';
$this->assertEquals(
@@ -209,7 +209,7 @@ class ezcGraphDataSetTest extends ezcTestCase
public function testDataSetSetSingleSymbol()
{
$chart = new ezcGraphPieChart();
- $chart['income'] = array( 2000 => 2345.2, 2456.3, 2567.4 );
+ $chart['income'] = new ezcGraphArrayDataSet( array( 2000 => 2345.2, 2456.3, 2567.4 ) );
$chart['income']->symbol[2001] = ezcGraph::DIAMOND;
$this->assertEquals(
@@ -221,7 +221,7 @@ class ezcGraphDataSetTest extends ezcTestCase
public function testDataSetPropertyValueFallback()
{
$chart = new ezcGraphPieChart();
- $chart['income'] = array( 2000 => 2345.2, 2456.3, 2567.4 );
+ $chart['income'] = new ezcGraphArrayDataSet( array( 2000 => 2345.2, 2456.3, 2567.4 ) );
$chart['income']->symbol = ezcGraph::DIAMOND;
$this->assertEquals(
@@ -235,7 +235,7 @@ class ezcGraphDataSetTest extends ezcTestCase
try
{
$chart = new ezcGraphPieChart();
- $chart['income'] = array( 2000 => 2345.2, 2456.3, 2567.4 );
+ $chart['income'] = new ezcGraphArrayDataSet( array( 2000 => 2345.2, 2456.3, 2567.4 ) );
$chart['income']->symbol[2006] = ezcGraph::DIAMOND;
}
catch ( ezcGraphNoSuchDataException $e )
@@ -249,7 +249,7 @@ class ezcGraphDataSetTest extends ezcTestCase
public function testDataSetGetSingleData()
{
$chart = new ezcGraphPieChart();
- $chart['income'] = array( 2000 => 2345.2, 2456.3, 2567.4 );
+ $chart['income'] = new ezcGraphArrayDataSet( array( 2000 => 2345.2, 2456.3, 2567.4 ) );
$this->assertSame(
2345.2,
@@ -260,7 +260,7 @@ class ezcGraphDataSetTest extends ezcTestCase
public function testDataSetSetSingleData()
{
$chart = new ezcGraphPieChart();
- $chart['income'] = array( 2000 => 2345.2, 2456.3, 2567.4 );
+ $chart['income'] = new ezcGraphArrayDataSet( array( 2000 => 2345.2, 2456.3, 2567.4 ) );
$chart['income'][2005] = 234.21;
$this->assertSame(
diff --git a/tests/date_axis_test.php b/tests/date_axis_test.php
index a78f1cc..4a4be39 100644
--- a/tests/date_axis_test.php
+++ b/tests/date_axis_test.php
@@ -54,7 +54,7 @@ class ezcGraphDateAxisTest extends ezcTestCase
$this->chart->xAxis->endDate = 100;
$this->chart->xAxis->interval = 10;
- $this->chart['some data'] = array( 10 => 12, 37 => 235, 43 => 17, 114 => 39 );
+ $this->chart['some data'] = new ezcGraphArrayDataSet( array( 10 => 12, 37 => 235, 43 => 17, 114 => 39 ) );
$this->chart->render( 500, 200 );
@@ -82,7 +82,7 @@ class ezcGraphDateAxisTest extends ezcTestCase
$this->chart->xAxis->startDate = 0;
$this->chart->xAxis->endDate = 100;
- $this->chart['some data'] = array( 10 => 12, 37 => 235, 43 => 17, 114 => 39 );
+ $this->chart['some data'] = new ezcGraphArrayDataSet( array( 10 => 12, 37 => 235, 43 => 17, 114 => 39 ) );
$this->chart->render( 500, 200 );
@@ -109,7 +109,7 @@ class ezcGraphDateAxisTest extends ezcTestCase
{
$this->chart->xAxis->interval = 10;
- $this->chart['some data'] = array( 10 => 12, 37 => 235, 43 => 17, 114 => 39 );
+ $this->chart['some data'] = new ezcGraphArrayDataSet( array( 10 => 12, 37 => 235, 43 => 17, 114 => 39 ) );
$this->chart->render( 500, 200 );
@@ -134,7 +134,7 @@ class ezcGraphDateAxisTest extends ezcTestCase
public function testAutomagicScalingSingle1()
{
- $this->chart['some data'] = array( 10 => 12, 37 => 235, 43 => 17, 114 => 39 );
+ $this->chart['some data'] = new ezcGraphArrayDataSet( array( 10 => 12, 37 => 235, 43 => 17, 114 => 39 ) );
$this->chart->render( 500, 200 );
$this->assertEquals(
@@ -158,7 +158,7 @@ class ezcGraphDateAxisTest extends ezcTestCase
public function testAutomagicScalingSingle2()
{
- $this->chart['some data'] = array( 30010 => 12, 30037 => 235, 30043 => 17, 30114 => 39 );
+ $this->chart['some data'] = new ezcGraphArrayDataSet( array( 30010 => 12, 30037 => 235, 30043 => 17, 30114 => 39 ) );
$this->chart->render( 500, 200 );
$this->assertEquals(
@@ -182,12 +182,12 @@ class ezcGraphDateAxisTest extends ezcTestCase
public function testAutomagicScalingSingle3()
{
- $this->chart['some data'] = array(
+ $this->chart['some data'] = new ezcGraphArrayDataSet( array(
mktime( 10, 13, 57, 5, 7, 2006 ) => 324,
mktime( 10, 46, 13, 5, 7, 2006 ) => 324,
mktime( 11, 15, 45, 5, 7, 2006 ) => 324,
mktime( 12, 32, 01, 5, 7, 2006 ) => 324,
- );
+ ) );
$this->chart->render( 500, 200 );
$this->assertEquals(
@@ -211,13 +211,13 @@ class ezcGraphDateAxisTest extends ezcTestCase
public function testAutomagicScalingSingle4()
{
- $this->chart['some data'] = array(
+ $this->chart['some data'] = new ezcGraphArrayDataSet( array(
mktime( 10, 13, 57, 5, 7, 2006 ) => 324,
mktime( 17, 46, 13, 5, 7, 2006 ) => 324,
mktime( 11, 15, 45, 5, 8, 2006 ) => 324,
mktime( 20, 32, 1, 5, 8, 2006 ) => 324,
mktime( 8, 43, 19, 5, 9, 2006 ) => 324,
- );
+ ) );
$this->chart->render( 500, 200 );
$this->assertEquals(
@@ -241,12 +241,12 @@ class ezcGraphDateAxisTest extends ezcTestCase
public function testAutomagicScalingSingle5()
{
- $this->chart['some data'] = array(
+ $this->chart['some data'] = new ezcGraphArrayDataSet( array(
mktime( 1, 0, 0, 1, 1, 2001 ) => 324,
mktime( 1, 0, 0, 1, 1, 2002 ) => 324,
mktime( 1, 0, 0, 1, 1, 2003 ) => 324,
mktime( 1, 0, 0, 1, 1, 2004 ) => 324,
- );
+ ) );
$this->chart->render( 500, 200 );
$this->assertEquals(
@@ -270,13 +270,13 @@ class ezcGraphDateAxisTest extends ezcTestCase
public function testPositionLeft()
{
- $this->chart['some data'] = array(
+ $this->chart['some data'] = new ezcGraphArrayDataSet( array(
mktime( 10, 13, 57, 5, 7, 2006 ) => 324,
mktime( 17, 46, 13, 5, 7, 2006 ) => 324,
mktime( 11, 15, 45, 5, 8, 2006 ) => 324,
mktime( 20, 32, 1, 5, 8, 2006 ) => 324,
mktime( 8, 43, 19, 5, 9, 2006 ) => 324,
- );
+ ) );
$this->chart->xAxis->position = ezcGraph::LEFT;
$this->chart->render( 500, 200 );
@@ -311,13 +311,13 @@ class ezcGraphDateAxisTest extends ezcTestCase
public function testPositionRight()
{
- $this->chart['some data'] = array(
+ $this->chart['some data'] = new ezcGraphArrayDataSet( array(
mktime( 10, 13, 57, 5, 7, 2006 ) => 324,
mktime( 17, 46, 13, 5, 7, 2006 ) => 324,
mktime( 11, 15, 45, 5, 8, 2006 ) => 324,
mktime( 20, 32, 1, 5, 8, 2006 ) => 324,
mktime( 8, 43, 19, 5, 9, 2006 ) => 324,
- );
+ ) );
$this->chart->xAxis->position = ezcGraph::RIGHT;
$this->chart->render( 500, 200 );
diff --git a/tests/driver_gd_test.php b/tests/driver_gd_test.php
index 8624d03..95ff066 100644
--- a/tests/driver_gd_test.php
+++ b/tests/driver_gd_test.php
@@ -84,7 +84,7 @@ class ezcGraphGdDriverTest extends ezcImageTestCase
$filename,
$this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png',
'Image does not look as expected.',
- 10
+ 2000
);
}
@@ -113,7 +113,7 @@ class ezcGraphGdDriverTest extends ezcImageTestCase
$filename,
$this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png',
'Image does not look as expected.',
- 10
+ 2000
);
}
@@ -142,7 +142,7 @@ class ezcGraphGdDriverTest extends ezcImageTestCase
$filename,
$this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png',
'Image does not look as expected.',
- 10
+ 2000
);
}
@@ -171,7 +171,7 @@ class ezcGraphGdDriverTest extends ezcImageTestCase
$filename,
$this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png',
'Image does not look as expected.',
- 10
+ 2000
);
}
@@ -202,7 +202,7 @@ class ezcGraphGdDriverTest extends ezcImageTestCase
$filename,
$this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png',
'Image does not look as expected.',
- 10
+ 2000
);
}
@@ -230,7 +230,7 @@ class ezcGraphGdDriverTest extends ezcImageTestCase
$filename,
$this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png',
'Image does not look as expected.',
- 10
+ 2000
);
}
@@ -259,7 +259,7 @@ class ezcGraphGdDriverTest extends ezcImageTestCase
$filename,
$this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png',
'Image does not look as expected.',
- 10
+ 2000
);
}
@@ -287,7 +287,7 @@ class ezcGraphGdDriverTest extends ezcImageTestCase
$filename,
$this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png',
'Image does not look as expected.',
- 10
+ 2000
);
}
@@ -315,7 +315,7 @@ class ezcGraphGdDriverTest extends ezcImageTestCase
$filename,
$this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png',
'Image does not look as expected.',
- 10
+ 2000
);
}
@@ -344,7 +344,7 @@ class ezcGraphGdDriverTest extends ezcImageTestCase
$filename,
$this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png',
'Image does not look as expected.',
- 10
+ 2000
);
}
@@ -373,7 +373,7 @@ class ezcGraphGdDriverTest extends ezcImageTestCase
$filename,
$this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png',
'Image does not look as expected.',
- 10
+ 2000
);
}
@@ -402,7 +402,7 @@ class ezcGraphGdDriverTest extends ezcImageTestCase
$filename,
$this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png',
'Image does not look as expected.',
- 10
+ 2000
);
}
@@ -428,7 +428,7 @@ class ezcGraphGdDriverTest extends ezcImageTestCase
$filename,
$this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png',
'Image does not look as expected.',
- 10
+ 2000
);
}
@@ -455,7 +455,7 @@ class ezcGraphGdDriverTest extends ezcImageTestCase
$filename,
$this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png',
'Image does not look as expected.',
- 10
+ 2000
);
}
@@ -481,7 +481,7 @@ class ezcGraphGdDriverTest extends ezcImageTestCase
$filename,
$this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png',
'Image does not look as expected.',
- 10
+ 2000
);
}
@@ -507,7 +507,7 @@ class ezcGraphGdDriverTest extends ezcImageTestCase
$filename,
$this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png',
'Image does not look as expected.',
- 10
+ 2000
);
}
@@ -534,7 +534,7 @@ class ezcGraphGdDriverTest extends ezcImageTestCase
$filename,
$this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png',
'Image does not look as expected.',
- 10
+ 2000
);
}
@@ -561,7 +561,7 @@ class ezcGraphGdDriverTest extends ezcImageTestCase
$filename,
$this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png',
'Image does not look as expected.',
- 10
+ 2000
);
}
@@ -588,7 +588,7 @@ class ezcGraphGdDriverTest extends ezcImageTestCase
$filename,
$this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png',
'Image does not look as expected.',
- 10
+ 2000
);
}
@@ -615,7 +615,7 @@ class ezcGraphGdDriverTest extends ezcImageTestCase
$filename,
$this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png',
'Image does not look as expected.',
- 10
+ 2000
);
}
@@ -652,7 +652,7 @@ class ezcGraphGdDriverTest extends ezcImageTestCase
$filename,
$this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png',
'Image does not look as expected.',
- 10
+ 2000
);
}
@@ -679,7 +679,7 @@ class ezcGraphGdDriverTest extends ezcImageTestCase
$filename,
$this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png',
'Image does not look as expected.',
- 10
+ 2000
);
}
@@ -706,7 +706,7 @@ class ezcGraphGdDriverTest extends ezcImageTestCase
$filename,
$this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png',
'Image does not look as expected.',
- 10
+ 2000
);
}
@@ -733,7 +733,7 @@ class ezcGraphGdDriverTest extends ezcImageTestCase
$filename,
$this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png',
'Image does not look as expected.',
- 10
+ 2000
);
}
@@ -760,7 +760,7 @@ class ezcGraphGdDriverTest extends ezcImageTestCase
$filename,
$this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png',
'Image does not look as expected.',
- 10
+ 2000
);
}
@@ -787,7 +787,7 @@ class ezcGraphGdDriverTest extends ezcImageTestCase
$filename,
$this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png',
'Image does not look as expected.',
- 10
+ 2000
);
}
@@ -814,7 +814,7 @@ class ezcGraphGdDriverTest extends ezcImageTestCase
$filename,
$this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png',
'Image does not look as expected.',
- 10
+ 2000
);
}
@@ -841,7 +841,7 @@ class ezcGraphGdDriverTest extends ezcImageTestCase
$filename,
$this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png',
'Image does not look as expected.',
- 10
+ 2000
);
}
@@ -868,7 +868,7 @@ class ezcGraphGdDriverTest extends ezcImageTestCase
$filename,
$this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png',
'Image does not look as expected.',
- 10
+ 2000
);
}
@@ -894,7 +894,7 @@ class ezcGraphGdDriverTest extends ezcImageTestCase
$filename,
$this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png',
'Image does not look as expected.',
- 10
+ 2000
);
}
@@ -920,7 +920,7 @@ class ezcGraphGdDriverTest extends ezcImageTestCase
$filename,
$this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png',
'Image does not look as expected.',
- 10
+ 2000
);
}
@@ -950,7 +950,7 @@ class ezcGraphGdDriverTest extends ezcImageTestCase
$filename,
$this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png',
'Image does not look as expected.',
- 10
+ 2000
);
}
@@ -980,7 +980,7 @@ class ezcGraphGdDriverTest extends ezcImageTestCase
$filename,
$this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png',
'Image does not look as expected.',
- 10
+ 2000
);
}
@@ -1009,7 +1009,7 @@ class ezcGraphGdDriverTest extends ezcImageTestCase
$filename,
$this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png',
'Image does not look as expected.',
- 10
+ 2000
);
}
@@ -1039,7 +1039,7 @@ class ezcGraphGdDriverTest extends ezcImageTestCase
$filename,
$this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png',
'Image does not look as expected.',
- 10
+ 2000
);
}
@@ -1066,7 +1066,7 @@ class ezcGraphGdDriverTest extends ezcImageTestCase
$filename,
$this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png',
'Image does not look as expected.',
- 10
+ 2000
);
}
@@ -1094,7 +1094,7 @@ class ezcGraphGdDriverTest extends ezcImageTestCase
$filename,
$this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png',
'Image does not look as expected.',
- 10
+ 2000
);
}
@@ -1121,7 +1121,7 @@ class ezcGraphGdDriverTest extends ezcImageTestCase
$filename,
$this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png',
'Image does not look as expected.',
- 10
+ 2000
);
}
@@ -1149,7 +1149,7 @@ class ezcGraphGdDriverTest extends ezcImageTestCase
$filename,
$this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png',
'Image does not look as expected.',
- 10
+ 2000
);
}
@@ -1177,7 +1177,7 @@ class ezcGraphGdDriverTest extends ezcImageTestCase
$filename,
$this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png',
'Image does not look as expected.',
- 10
+ 2000
);
}
@@ -1206,7 +1206,7 @@ class ezcGraphGdDriverTest extends ezcImageTestCase
$filename,
$this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png',
'Image does not look as expected.',
- 10
+ 2000
);
}
@@ -1234,7 +1234,7 @@ class ezcGraphGdDriverTest extends ezcImageTestCase
$filename,
$this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png',
'Image does not look as expected.',
- 10
+ 2000
);
}
@@ -1272,7 +1272,7 @@ class ezcGraphGdDriverTest extends ezcImageTestCase
$filename,
$this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png',
'Image does not look as expected.',
- 10
+ 2000
);
}
}
diff --git a/tests/driver_svg_test.php b/tests/driver_svg_test.php
index 5c19c0a..b6cdb2f 100644
--- a/tests/driver_svg_test.php
+++ b/tests/driver_svg_test.php
@@ -828,13 +828,13 @@ class ezcGraphSvgDriverTest extends ezcTestCase
$filename = $this->tempDir . __FUNCTION__ . '.svg';
$chart = new ezcGraphPieChart();
- $chart['sample'] = array(
+ $chart['sample'] = new ezcGraphArrayDataSet( array(
'Mozilla' => 4375,
'IE' => 345,
'Opera' => 1204,
'wget' => 231,
'Safari' => 987,
- );
+ ) );
$chart->driver = new ezcGraphSvgDriver();
$chart->driver->options->templateDocument = dirname( __FILE__ ) . '/data/template.svg';
@@ -853,13 +853,13 @@ class ezcGraphSvgDriverTest extends ezcTestCase
$filename = $this->tempDir . __FUNCTION__ . '.svg';
$chart = new ezcGraphPieChart();
- $chart['sample'] = array(
+ $chart['sample'] = new ezcGraphArrayDataSet( array(
'Mozilla' => 4375,
'IE' => 345,
'Opera' => 1204,
'wget' => 231,
'Safari' => 987,
- );
+ ) );
$chart->driver = new ezcGraphSvgDriver();
$chart->driver->options->templateDocument = dirname( __FILE__ ) . '/data/template.svg';
diff --git a/tests/font_test.php b/tests/font_test.php
index 9a06edd..f9faa2c 100644
--- a/tests/font_test.php
+++ b/tests/font_test.php
@@ -117,7 +117,7 @@ class ezcGraphFontTest extends ezcTestCase
public function testSetFontForElementWithRendering()
{
$chart = new ezcGraphLineChart();
- $chart['sampleData'] = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1);
+ $chart['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) );
$chart->options->font = $this->basePath . 'font.ttf';
$chart->legend->font = $this->basePath . 'font2.ttf';
$chart->render( 500, 200 );
diff --git a/tests/labeled_axis_test.php b/tests/labeled_axis_test.php
index 7de876b..4f4370e 100644
--- a/tests/labeled_axis_test.php
+++ b/tests/labeled_axis_test.php
@@ -53,7 +53,7 @@ class ezcGraphLabeledAxisTest extends ezcTestCase
public function testAutomaticLabelingSingle()
{
$chart = new ezcGraphLineChart();
- $chart['sample'] = array( 2000 => 20, 70, 12, 130 );
+ $chart['sample'] = new ezcGraphArrayDataSet( array( 2000 => 20, 70, 12, 130 ) );
$chart->render( 500, 200 );
$this->assertSame(
@@ -70,8 +70,8 @@ class ezcGraphLabeledAxisTest extends ezcTestCase
public function testAutomaticLabelingMultiple()
{
$chart = new ezcGraphLineChart();
- $chart['sample'] = array( 2000 => 1045, 1300, 1012, 1450 );
- $chart['sample2'] = array( 2002 => 1270, 1170, 1610, 1370 );
+ $chart['sample'] = new ezcGraphArrayDataSet( array( 2000 => 1045, 1300, 1012, 1450 ) );
+ $chart['sample2'] = new ezcGraphArrayDataSet( array( 2002 => 1270, 1170, 1610, 1370 ) );
$chart->render( 500, 200 );
$this->assertSame(
@@ -90,8 +90,8 @@ class ezcGraphLabeledAxisTest extends ezcTestCase
public function testAutomaticLabelingMultipleMixed()
{
$chart = new ezcGraphLineChart();
- $chart['sample'] = array( 2000 => 1045, 2001 => 1300, 2004 => 1012, 2006 => 1450 );
- $chart['sample2'] = array( 2001 => 1270, 1170, 1610, 1370, 1559 );
+ $chart['sample'] = new ezcGraphArrayDataSet( array( 2000 => 1045, 2001 => 1300, 2004 => 1012, 2006 => 1450 ) );
+ $chart['sample2'] = new ezcGraphArrayDataSet( array( 2001 => 1270, 1170, 1610, 1370, 1559 ) );
$chart->render( 500, 200 );
$this->assertSame(
@@ -111,7 +111,7 @@ class ezcGraphLabeledAxisTest extends ezcTestCase
public function testPositionLeft()
{
$chart = new ezcGraphLineChart();
- $chart['sample'] = array( 2000 => 1045, 1300, 1012, 1450 );
+ $chart['sample'] = new ezcGraphArrayDataSet( array( 2000 => 1045, 1300, 1012, 1450 ) );
$chart->xAxis->position = ezcGraph::LEFT;
$chart->render( 500, 200 );
@@ -154,7 +154,7 @@ class ezcGraphLabeledAxisTest extends ezcTestCase
public function testPositionRight()
{
$chart = new ezcGraphLineChart();
- $chart['sample'] = array( 2000 => 1045, 1300, 1012, 1450 );
+ $chart['sample'] = new ezcGraphArrayDataSet( array( 2000 => 1045, 1300, 1012, 1450 ) );
$chart->xAxis->position = ezcGraph::RIGHT;
$chart->render( 500, 200 );
@@ -197,7 +197,7 @@ class ezcGraphLabeledAxisTest extends ezcTestCase
public function testPositionTop()
{
$chart = new ezcGraphLineChart();
- $chart['sample'] = array( 2000 => 1045, 1300, 1012, 1450 );
+ $chart['sample'] = new ezcGraphArrayDataSet( array( 2000 => 1045, 1300, 1012, 1450 ) );
$chart->xAxis->position = ezcGraph::TOP;
$chart->render( 500, 200 );
@@ -240,7 +240,7 @@ class ezcGraphLabeledAxisTest extends ezcTestCase
public function testPositionBottom()
{
$chart = new ezcGraphLineChart();
- $chart['sample'] = array( 2000 => 1045, 1300, 1012, 1450 );
+ $chart['sample'] = new ezcGraphArrayDataSet( array( 2000 => 1045, 1300, 1012, 1450 ) );
$chart->xAxis->position = ezcGraph::BOTTOM;
$chart->render( 500, 200 );
diff --git a/tests/line_test.php b/tests/line_test.php
index 5363db0..bf04926 100644
--- a/tests/line_test.php
+++ b/tests/line_test.php
@@ -51,9 +51,9 @@ class ezcGraphLineChartTest extends ezcTestCase
protected function addSampleData( ezcGraphChart $chart )
{
- $chart['sampleData'] = array( 'sample 1' => 234, 'sample 2' => -21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1);
- $chart['moreData'] = array( 'sample 1' => 112, 'sample 2' => 54, 'sample 3' => 12, 'sample 4' => -167, 'sample 5' => 329);
- $chart['Even more data'] = array( 'sample 1' => 300, 'sample 2' => -30, 'sample 3' => 220, 'sample 4' => 67, 'sample 5' => 450);
+ $chart['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => -21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) );
+ $chart['moreData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 112, 'sample 2' => 54, 'sample 3' => 12, 'sample 4' => -167, 'sample 5' => 329) );
+ $chart['Even more data'] = new ezcGraphArrayDataSet( array( 'sample 1' => 300, 'sample 2' => -30, 'sample 3' => 220, 'sample 4' => 67, 'sample 5' => 450) );
}
public function testElementGenerationLegend()
@@ -95,10 +95,28 @@ class ezcGraphLineChartTest extends ezcTestCase
);
}
+ public function testInvalidDisplayType()
+ {
+ $chart = new ezcGraphLineChart();
+ $chart['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1 ) );
+ $chart['sampleData']->displayType = ezcGraph::PIE;
+
+ try
+ {
+ $chart->render( 500, 200 );
+ }
+ catch ( ezcGraphInvalidDisplayTypeException $e )
+ {
+ return true;
+ }
+
+ $this->fail( 'Expected ezcGraphInvalidDisplayTypeException.' );
+ }
+
public function testRenderChartLines()
{
$chart = new ezcGraphLineChart();
- $chart['sampleData'] = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1 );
+ $chart['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1 ) );
$chart['sampleData']->color = '#CC0000';
$chart['sampleData']->symbol = ezcGraph::DIAMOND;
@@ -182,10 +200,155 @@ class ezcGraphLineChartTest extends ezcTestCase
$chart->render( 500, 200 );
}
+ public function testRenderChartMixedBarsAndLines()
+ {
+ $chart = new ezcGraphLineChart();
+ $chart['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1 ) );
+ $chart['sampleData']->color = '#CC0000';
+ $chart['sampleData']->displayType = ezcGraph::BAR;
+
+ $chart['sampleData2'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1 ) );
+ $chart['sampleData2']->color = '#CC0000';
+ $chart['sampleData2']->symbol = ezcGraph::DIAMOND;
+
+ $mockedRenderer = $this->getMock( 'ezcGraphRenderer2d', array(
+ 'drawBar',
+ 'drawDataLine',
+ ) );
+
+ $mockedRenderer
+ ->expects( $this->at( 0 ) )
+ ->method( 'drawBar' )
+ ->with(
+ $this->equalTo( new ezcGraphBoundings( 140., 20., 460., 180. ), 1. ),
+ $this->equalTo( ezcGraphColor::fromHex( '#CC0000' ) ),
+ $this->equalTo( new ezcGraphCoordinate( .0, .415 ), .05 ),
+ $this->equalTo( 80., 1. ),
+ $this->equalTo( 0 ),
+ $this->equalTo( 1 )
+ );
+ $mockedRenderer
+ ->expects( $this->at( 4 ) )
+ ->method( 'drawBar' )
+ ->with(
+ $this->equalTo( new ezcGraphBoundings( 140., 20., 460., 180. ), 1. ),
+ $this->equalTo( ezcGraphColor::fromHex( '#CC0000' ) ),
+ $this->equalTo( new ezcGraphCoordinate( 1., .9975 ), .05 ),
+ $this->equalTo( 80., 1. ),
+ $this->equalTo( 0 ),
+ $this->equalTo( 1 )
+ );
+ $mockedRenderer
+ ->expects( $this->at( 5 ) )
+ ->method( 'drawDataLine' )
+ ->with(
+ $this->equalTo( new ezcGraphBoundings( 140., 20., 460., 180. ), 1. ),
+ $this->equalTo( ezcGraphColor::fromHex( '#CC0000' ) ),
+ $this->equalTo( new ezcGraphCoordinate( .0, .415 ), .05 ),
+ $this->equalTo( new ezcGraphCoordinate( .0, .415 ), .05 ),
+ $this->equalTo( 0 ),
+ $this->equalTo( 1 ),
+ $this->equalTo( ezcGraph::DIAMOND ),
+ $this->equalTo( ezcGraphColor::fromHex( '#CC0000' ) ),
+ $this->equalTo( null )
+ );
+ $mockedRenderer
+ ->expects( $this->at( 9 ) )
+ ->method( 'drawDataLine' )
+ ->with(
+ $this->equalTo( new ezcGraphBoundings( 140., 20., 460., 180. ), 1. ),
+ $this->equalTo( ezcGraphColor::fromHex( '#CC0000' ) ),
+ $this->equalTo( new ezcGraphCoordinate( .75, .7 ), .05 ),
+ $this->equalTo( new ezcGraphCoordinate( 1., .9975 ), .05 ),
+ $this->equalTo( 0 ),
+ $this->equalTo( 1 ),
+ $this->equalTo( ezcGraph::DIAMOND ),
+ $this->equalTo( ezcGraphColor::fromHex( '#CC0000' ) ),
+ $this->equalTo( null )
+ );
+
+ $chart->renderer = $mockedRenderer;
+
+ $chart->render( 500, 200 );
+ }
+
+ public function testRenderChartBars()
+ {
+ $chart = new ezcGraphLineChart();
+ $chart['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1 ) );
+ $chart['sampleData']->color = '#CC0000';
+ $chart['sampleData']->symbol = ezcGraph::DIAMOND;
+ $chart['sampleData']->displayType = ezcGraph::BAR;
+
+ $mockedRenderer = $this->getMock( 'ezcGraphRenderer2d', array(
+ 'drawBar',
+ ) );
+
+ $mockedRenderer
+ ->expects( $this->at( 0 ) )
+ ->method( 'drawBar' )
+ ->with(
+ $this->equalTo( new ezcGraphBoundings( 140., 20., 460., 180. ), 1. ),
+ $this->equalTo( ezcGraphColor::fromHex( '#CC0000' ) ),
+ $this->equalTo( new ezcGraphCoordinate( .0, .415 ), .05 ),
+ $this->equalTo( 80., 1. ),
+ $this->equalTo( 0 ),
+ $this->equalTo( 1 )
+ );
+ $mockedRenderer
+ ->expects( $this->at( 1 ) )
+ ->method( 'drawBar' )
+ ->with(
+ $this->equalTo( new ezcGraphBoundings( 140., 20., 460., 180. ), 1. ),
+ $this->equalTo( ezcGraphColor::fromHex( '#CC0000' ) ),
+ $this->equalTo( new ezcGraphCoordinate( .25, .95 ), .05 ),
+ $this->equalTo( 80., 1. ),
+ $this->equalTo( 0 ),
+ $this->equalTo( 1 )
+ );
+ $mockedRenderer
+ ->expects( $this->at( 2 ) )
+ ->method( 'drawBar' )
+ ->with(
+ $this->equalTo( new ezcGraphBoundings( 140., 20., 460., 180. ), 1. ),
+ $this->equalTo( ezcGraphColor::fromHex( '#CC0000' ) ),
+ $this->equalTo( new ezcGraphCoordinate( .5, .2 ), .05 ),
+ $this->equalTo( 80., 1. ),
+ $this->equalTo( 0 ),
+ $this->equalTo( 1 )
+ );
+ $mockedRenderer
+ ->expects( $this->at( 3 ) )
+ ->method( 'drawBar' )
+ ->with(
+ $this->equalTo( new ezcGraphBoundings( 140., 20., 460., 180. ), 1. ),
+ $this->equalTo( ezcGraphColor::fromHex( '#CC0000' ) ),
+ $this->equalTo( new ezcGraphCoordinate( .75, .7 ), .05 ),
+ $this->equalTo( 80., 1. ),
+ $this->equalTo( 0 ),
+ $this->equalTo( 1 )
+ );
+ $mockedRenderer
+ ->expects( $this->at( 4 ) )
+ ->method( 'drawBar' )
+ ->with(
+ $this->equalTo( new ezcGraphBoundings( 140., 20., 460., 180. ), 1. ),
+ $this->equalTo( ezcGraphColor::fromHex( '#CC0000' ) ),
+ $this->equalTo( new ezcGraphCoordinate( 1., .9975 ), .05 ),
+ $this->equalTo( 80., 1. ),
+ $this->equalTo( 0 ),
+ $this->equalTo( 1 )
+ );
+
+ $chart->renderer = $mockedRenderer;
+
+ $chart->render( 500, 200 );
+ }
+
public function testRenderChartFilledLines()
{
$chart = new ezcGraphLineChart();
- $chart['sampleData'] = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => -46, 'sample 4' => 120, 'sample 5' => 100 );
+ $chart['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => -46, 'sample 4' => 120, 'sample 5' => 100 ) );
$chart->palette = new ezcGraphPaletteBlack();
$chart->options->fillLines = 100;
@@ -245,7 +408,7 @@ class ezcGraphLineChartTest extends ezcTestCase
{
$chart = new ezcGraphLineChart();
$chart->palette = new ezcGraphPaletteBlack();
- $chart['sampleData'] = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1);
+ $chart['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) );
$chart['sampleData']->symbol = ezcGraph::DIAMOND;
$chart['sampleData']->symbol['sample 3'] = ezcGraph::CIRCLE;
diff --git a/tests/numeric_axis_test.php b/tests/numeric_axis_test.php
index 1b6428d..6cd392a 100644
--- a/tests/numeric_axis_test.php
+++ b/tests/numeric_axis_test.php
@@ -115,7 +115,7 @@ class ezcGraphNumericAxisTest extends ezcTestCase
public function testAutomagicScalingSingle()
{
$chart = new ezcGraphLineChart();
- $chart['sample'] = array( 2000 => 20, 70, 12, 130 );
+ $chart['sample'] = new ezcGraphArrayDataSet( array( 2000 => 20, 70, 12, 130 ) );
$chart->render( 500, 200 );
$this->assertEquals(
@@ -146,7 +146,7 @@ class ezcGraphNumericAxisTest extends ezcTestCase
public function testAutomagicScalingSingle2()
{
$chart = new ezcGraphLineChart();
- $chart['sample'] = array( 2000 => 1, 4.3, .2, 3.82 );
+ $chart['sample'] = new ezcGraphArrayDataSet( array( 2000 => 1, 4.3, .2, 3.82 ) );
$chart->render( 500, 200 );
$this->assertEquals(
@@ -177,7 +177,7 @@ class ezcGraphNumericAxisTest extends ezcTestCase
public function testAutomagicScalingSingle3()
{
$chart = new ezcGraphLineChart();
- $chart['sample'] = array( 2000 => -1.8, 4.3, .2, 3.82 );
+ $chart['sample'] = new ezcGraphArrayDataSet( array( 2000 => -1.8, 4.3, .2, 3.82 ) );
$chart->render( 500, 200 );
$this->assertEquals(
@@ -208,7 +208,7 @@ class ezcGraphNumericAxisTest extends ezcTestCase
public function testAutomagicScalingSingle4()
{
$chart = new ezcGraphLineChart();
- $chart['sample'] = array( 2000 => 1045, 1300, 1012, 1450 );
+ $chart['sample'] = new ezcGraphArrayDataSet( array( 2000 => 1045, 1300, 1012, 1450 ) );
$chart->render( 500, 200 );
$this->assertEquals(
@@ -239,8 +239,8 @@ class ezcGraphNumericAxisTest extends ezcTestCase
public function testAutomagicScalingMultiple()
{
$chart = new ezcGraphLineChart();
- $chart['sample'] = array( 2000 => 1045, 1300, 1012, 1450 );
- $chart['sample2'] = array( 2000 => 1270, 1170, 1610, 1370 );
+ $chart['sample'] = new ezcGraphArrayDataSet( array( 2000 => 1045, 1300, 1012, 1450 ) );
+ $chart['sample2'] = new ezcGraphArrayDataSet( array( 2000 => 1270, 1170, 1610, 1370 ) );
$chart->render( 500, 200 );
$this->assertEquals(
@@ -271,7 +271,7 @@ class ezcGraphNumericAxisTest extends ezcTestCase
public function testMixedAutomagicAndManualScaling()
{
$chart = new ezcGraphLineChart();
- $chart['sample'] = array( 2000 => 1045, 1300, 1012, 1450 );
+ $chart['sample'] = new ezcGraphArrayDataSet( array( 2000 => 1045, 1300, 1012, 1450 ) );
$chart->yAxis->majorStep = 50;
$chart->render( 500, 200 );
@@ -303,7 +303,7 @@ class ezcGraphNumericAxisTest extends ezcTestCase
public function testMixedAutomagicAndManualScaling2()
{
$chart = new ezcGraphLineChart();
- $chart['sample'] = array( 2000 => 1045, 1300, 1012, 1450 );
+ $chart['sample'] = new ezcGraphArrayDataSet( array( 2000 => 1045, 1300, 1012, 1450 ) );
$chart->yAxis->min = 0;
$chart->render( 500, 200 );
@@ -335,7 +335,7 @@ class ezcGraphNumericAxisTest extends ezcTestCase
public function testMixedAutomagicAndManualScaling3()
{
$chart = new ezcGraphLineChart();
- $chart['sample'] = array( 2000 => 1045, 1300, 1012, 1450 );
+ $chart['sample'] = new ezcGraphArrayDataSet( array( 2000 => 1045, 1300, 1012, 1450 ) );
$chart->yAxis->max = 2000;
$chart->render( 500, 200 );
@@ -367,7 +367,7 @@ class ezcGraphNumericAxisTest extends ezcTestCase
public function testMixedAutomagicAndManualScaling4()
{
$chart = new ezcGraphLineChart();
- $chart['sample'] = array( 2000 => 1045, 1300, 1012, 1450 );
+ $chart['sample'] = new ezcGraphArrayDataSet( array( 2000 => 1045, 1300, 1012, 1450 ) );
$chart->yAxis->min = 0;
$chart->yAxis->max = 2000;
$chart->render( 500, 200 );
@@ -400,7 +400,7 @@ class ezcGraphNumericAxisTest extends ezcTestCase
public function testPositionLeft()
{
$chart = new ezcGraphLineChart();
- $chart['sample'] = array( 2000 => 1045, 1300, 1012, 1450 );
+ $chart['sample'] = new ezcGraphArrayDataSet( array( 2000 => 1045, 1300, 1012, 1450 ) );
$chart->yAxis->position = ezcGraph::LEFT;
$chart->render( 500, 200 );
@@ -436,7 +436,7 @@ class ezcGraphNumericAxisTest extends ezcTestCase
public function testPositionRight()
{
$chart = new ezcGraphLineChart();
- $chart['sample'] = array( 2000 => 1045, 1300, 1012, 1450 );
+ $chart['sample'] = new ezcGraphArrayDataSet( array( 2000 => 1045, 1300, 1012, 1450 ) );
$chart->yAxis->position = ezcGraph::RIGHT;
$chart->render( 500, 200 );
@@ -472,7 +472,7 @@ class ezcGraphNumericAxisTest extends ezcTestCase
public function testPositionTop()
{
$chart = new ezcGraphLineChart();
- $chart['sample'] = array( 2000 => 1045, 1300, 1012, 1450 );
+ $chart['sample'] = new ezcGraphArrayDataSet( array( 2000 => 1045, 1300, 1012, 1450 ) );
$chart->yAxis->position = ezcGraph::TOP;
$chart->render( 500, 200 );
@@ -508,7 +508,7 @@ class ezcGraphNumericAxisTest extends ezcTestCase
public function testPositionBottom()
{
$chart = new ezcGraphLineChart();
- $chart['sample'] = array( 2000 => 1045, 1300, 1012, 1450 );
+ $chart['sample'] = new ezcGraphArrayDataSet( array( 2000 => 1045, 1300, 1012, 1450 ) );
$chart->yAxis->position = ezcGraph::BOTTOM;
$chart->render( 500, 200 );
@@ -544,7 +544,7 @@ class ezcGraphNumericAxisTest extends ezcTestCase
public function testPositionLeftNegativMinimum()
{
$chart = new ezcGraphLineChart();
- $chart['sample'] = array( 2000 => -300, 1300, 1012, 1450 );
+ $chart['sample'] = new ezcGraphArrayDataSet( array( 2000 => -300, 1300, 1012, 1450 ) );
$chart->yAxis->majorStep = 500;
$chart->yAxis->position = ezcGraph::LEFT;
$chart->render( 500, 200 );
@@ -581,9 +581,9 @@ class ezcGraphNumericAxisTest extends ezcTestCase
public function testNullPositionMultipleDataSets()
{
$chart = new ezcGraphLineChart();
- $chart['sampleData'] = array( 'sample 1' => 234, 'sample 2' => -21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1);
- $chart['moreData'] = array( 'sample 1' => 112, 'sample 2' => 54, 'sample 3' => 12, 'sample 4' => -167, 'sample 5' => 329);
- $chart['evenMoreData'] = array( 'sample 1' => 300, 'sample 2' => -30, 'sample 3' => 220, 'sample 4' => 67, 'sample 5' => 450);
+ $chart['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => -21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) );
+ $chart['moreData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 112, 'sample 2' => 54, 'sample 3' => 12, 'sample 4' => -167, 'sample 5' => 329) );
+ $chart['evenMoreData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 300, 'sample 2' => -30, 'sample 3' => 220, 'sample 4' => 67, 'sample 5' => 450) );
$chart->render( 500, 200 );
$this->assertEquals(
diff --git a/tests/palette_test.php b/tests/palette_test.php
index 59e6c8d..7ec97bd 100644
--- a/tests/palette_test.php
+++ b/tests/palette_test.php
@@ -289,8 +289,8 @@ class ezcGraphPaletteTest extends ezcTestCase
public function testDataSetAutomaticColorization()
{
$chart = new ezcGraphLineChart();
- $chart['income'] = array( 2000 => 2345.2, 2456.3, 2567.4 );
- $chart['spending'] = array( 2000 => 2347.2, 2458.3, 2569.4 );
+ $chart['income'] = new ezcGraphArrayDataSet( array( 2000 => 2345.2, 2456.3, 2567.4 ) );
+ $chart['spending'] = new ezcGraphArrayDataSet( array( 2000 => 2347.2, 2458.3, 2569.4 ) );
$this->assertEquals(
ezcGraphColor::fromHex( '#3465A4' ),
@@ -308,8 +308,8 @@ class ezcGraphPaletteTest extends ezcTestCase
public function testChartBackground()
{
$chart = new ezcGraphLineChart();
- $chart['income'] = array( 2000 => 2345.2, 2456.3, 2567.4 );
- $chart['spending'] = array( 2000 => 2347.2, 2458.3, 2569.4 );
+ $chart['income'] = new ezcGraphArrayDataSet( array( 2000 => 2345.2, 2456.3, 2567.4 ) );
+ $chart['spending'] = new ezcGraphArrayDataSet( array( 2000 => 2347.2, 2458.3, 2569.4 ) );
$this->assertEquals(
ezcGraphColor::fromHex( '#EEEEEC' ),
@@ -321,8 +321,8 @@ class ezcGraphPaletteTest extends ezcTestCase
public function testChartElementBorder()
{
$chart = new ezcGraphLineChart();
- $chart['income'] = array( 2000 => 2345.2, 2456.3, 2567.4 );
- $chart['spending'] = array( 2000 => 2347.2, 2458.3, 2569.4 );
+ $chart['income'] = new ezcGraphArrayDataSet( array( 2000 => 2345.2, 2456.3, 2567.4 ) );
+ $chart['spending'] = new ezcGraphArrayDataSet( array( 2000 => 2347.2, 2458.3, 2569.4 ) );
$this->assertEquals(
ezcGraphColor::fromHex( '#000000FF' ),
@@ -334,8 +334,8 @@ class ezcGraphPaletteTest extends ezcTestCase
public function testChartElementBorderWidth()
{
$chart = new ezcGraphLineChart();
- $chart['income'] = array( 2000 => 2345.2, 2456.3, 2567.4 );
- $chart['spending'] = array( 2000 => 2347.2, 2458.3, 2569.4 );
+ $chart['income'] = new ezcGraphArrayDataSet( array( 2000 => 2345.2, 2456.3, 2567.4 ) );
+ $chart['spending'] = new ezcGraphArrayDataSet( array( 2000 => 2347.2, 2458.3, 2569.4 ) );
$this->assertEquals(
0,
@@ -347,8 +347,8 @@ class ezcGraphPaletteTest extends ezcTestCase
public function testChartElementAxisColor()
{
$chart = new ezcGraphLineChart();
- $chart['income'] = array( 2000 => 2345.2, 2456.3, 2567.4 );
- $chart['spending'] = array( 2000 => 2347.2, 2458.3, 2569.4 );
+ $chart['income'] = new ezcGraphArrayDataSet( array( 2000 => 2345.2, 2456.3, 2567.4 ) );
+ $chart['spending'] = new ezcGraphArrayDataSet( array( 2000 => 2347.2, 2458.3, 2569.4 ) );
$this->assertEquals(
ezcGraphColor::fromHex( '#2E3436' ),
diff --git a/tests/pie_test.php b/tests/pie_test.php
index ce0b343..4a79d79 100644
--- a/tests/pie_test.php
+++ b/tests/pie_test.php
@@ -52,7 +52,7 @@ class ezcGraphPieChartTest extends ezcImageTestCase
public function testElementGenerationLegend()
{
$chart = new ezcGraphPieChart();
- $chart['sampleData'] = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1);
+ $chart['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1 ) );
$chart->render( 500, 200 );
$legend = $this->getNonPublicProperty( $chart->legend, 'labels' );
@@ -82,16 +82,34 @@ class ezcGraphPieChartTest extends ezcImageTestCase
);
}
+ public function testInvalidDisplayType()
+ {
+ $chart = new ezcGraphPieChart();
+ $chart['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1 ) );
+ $chart['sampleData']->displayType = ezcGraph::LINE;
+
+ try
+ {
+ $chart->render( 500, 200 );
+ }
+ catch ( ezcGraphInvalidDisplayTypeException $e )
+ {
+ return true;
+ }
+
+ $this->fail( 'Expected ezcGraphInvalidDisplayTypeException.' );
+ }
+
public function testPieRenderPieSegments()
{
$chart = new ezcGraphPieChart();
- $chart['sample'] = array(
+ $chart['sample'] = new ezcGraphArrayDataSet( array(
'Mozilla' => 4375,
'IE' => 345,
'Opera' => 1204,
'wget' => 231,
'Safari' => 987,
- );
+ ) );
$chart['sample']->highlight['wget'] = true;
@@ -164,7 +182,7 @@ class ezcGraphPieChartTest extends ezcImageTestCase
$filename = $this->tempDir . __FUNCTION__ . '.png';
$chart = new ezcGraphPieChart();
- $chart['Skien'] = array( 'Norwegian' => 10, 'Dutch' => 3, 'German' => 2, 'French' => 2, 'Hindi' => 1, 'Taiwanese' => 1, 'Brazilian' => 1, 'Venezuelan' => 1, 'Japanese' => 1, 'Czech' => 1, 'Hungarian' => 1, 'Romanian' => 1 );
+ $chart['Skien'] = new ezcGraphArrayDataSet( array( 'Norwegian' => 10, 'Dutch' => 3, 'German' => 2, 'French' => 2, 'Hindi' => 1, 'Taiwanese' => 1, 'Brazilian' => 1, 'Venezuelan' => 1, 'Japanese' => 1, 'Czech' => 1, 'Hungarian' => 1, 'Romanian' => 1 ) );
$chart['Skien']->highlight['Norwegian'] = true;
@@ -176,7 +194,7 @@ class ezcGraphPieChartTest extends ezcImageTestCase
$filename,
$this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png',
'Image does not look as expected.',
- 10
+ 2000
);
}
@@ -185,7 +203,7 @@ class ezcGraphPieChartTest extends ezcImageTestCase
$filename = $this->tempDir . __FUNCTION__ . '.png';
$chart = new ezcGraphPieChart();
- $chart['Skien'] = array( 'Norwegian' => 10, 'Dutch' => 3, 'German' => 2, 'French' => 2, 'Hindi' => 1, 'Taiwanese' => 1, 'Brazilian' => 1, 'Venezuelan' => 1, 'Japanese' => 1, 'Czech' => 1, 'Hungarian' => 1, 'Romanian' => 1 );
+ $chart['Skien'] = new ezcGraphArrayDataSet( array( 'Norwegian' => 10, 'Dutch' => 3, 'German' => 2, 'French' => 2, 'Hindi' => 1, 'Taiwanese' => 1, 'Brazilian' => 1, 'Venezuelan' => 1, 'Japanese' => 1, 'Czech' => 1, 'Hungarian' => 1, 'Romanian' => 1 ) );
$chart['Skien']->highlight['Norwegian'] = true;
@@ -197,7 +215,7 @@ class ezcGraphPieChartTest extends ezcImageTestCase
$filename,
$this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png',
'Image does not look as expected.',
- 10
+ 2000
);
}
}
diff --git a/tests/renderer_2d_test.php b/tests/renderer_2d_test.php
index 81f4b96..80ba103 100644
--- a/tests/renderer_2d_test.php
+++ b/tests/renderer_2d_test.php
@@ -295,6 +295,73 @@ class ezcGraphRenderer2dTest extends ezcImageTestCase
$this->renderer->render( 'foo.png' );
}
+ public function testRenderBar()
+ {
+ $this->driver
+ ->expects( $this->at( 0 ) )
+ ->method( 'drawPolygon' )
+ ->with(
+ $this->equalTo( array(
+ new ezcGraphCoordinate( 157.5, 0. ),
+ new ezcGraphCoordinate( 157.5, 40. ),
+ new ezcGraphCoordinate( 242.5, 40. ),
+ new ezcGraphCoordinate( 242.5, 0. ),
+ ), 1. ),
+ $this->equalTo( ezcGraphColor::fromHex( '#FF0000' ) ),
+ $this->equalTo( true )
+ );
+ $this->driver
+ ->expects( $this->at( 1 ) )
+ ->method( 'drawPolygon' )
+ ->with(
+ $this->equalTo( array(
+ new ezcGraphCoordinate( 157.5, 0. ),
+ new ezcGraphCoordinate( 157.5, 40. ),
+ new ezcGraphCoordinate( 242.5, 40. ),
+ new ezcGraphCoordinate( 242.5, 0. ),
+ ), 1. ),
+ $this->equalTo( ezcGraphColor::fromHex( '#800000' ) ),
+ $this->equalTo( false )
+ );
+
+ $this->renderer->drawBar(
+ new ezcGraphBoundings( 0, 0, 400, 200 ),
+ ezcGraphColor::fromHex( '#FF0000' ),
+ new ezcGraphCoordinate( .5, .2 ),
+ 100,
+ 0,
+ 1,
+ 0
+ );
+ }
+
+ public function testRenderSecondBar()
+ {
+ $this->driver
+ ->expects( $this->at( 0 ) )
+ ->method( 'drawPolygon' )
+ ->with(
+ $this->equalTo( array(
+ new ezcGraphCoordinate( 202.5, 0. ),
+ new ezcGraphCoordinate( 202.5, 40. ),
+ new ezcGraphCoordinate( 242.5, 40. ),
+ new ezcGraphCoordinate( 242.5, 0. ),
+ ), 1. ),
+ $this->equalTo( ezcGraphColor::fromHex( '#FF0000' ) ),
+ $this->equalTo( 1 )
+ );
+
+ $this->renderer->drawBar(
+ new ezcGraphBoundings( 0, 0, 400, 200 ),
+ ezcGraphColor::fromHex( '#FF0000' ),
+ new ezcGraphCoordinate( .5, .2 ),
+ 100,
+ 1,
+ 2,
+ 0
+ );
+ }
+
public function testRenderDataLine()
{
$this->driver
@@ -1092,12 +1159,12 @@ class ezcGraphRenderer2dTest extends ezcImageTestCase
{
$chart = new ezcGraphLineChart();
- $chart['sampleData'] = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1);
+ $chart['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) );
$chart['sampleData']->color = '#0000FF';
$chart['sampleData']->symbol = ezcGraph::DIAMOND;
- $chart['moreData'] = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1);
+ $chart['moreData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) );
$chart['moreData']->color = '#FF0000';
- $chart['evenMoreData'] = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1);
+ $chart['evenMoreData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) );
$chart['evenMoreData']->color = '#00FF00';
$chart['evenMoreData']->label = 'Even more data';
@@ -1159,12 +1226,12 @@ class ezcGraphRenderer2dTest extends ezcImageTestCase
{
$chart = new ezcGraphLineChart();
- $chart['sampleData'] = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1);
+ $chart['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) );
$chart['sampleData']->color = '#0000FF';
$chart['sampleData']->symbol = ezcGraph::DIAMOND;
- $chart['moreData'] = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1);
+ $chart['moreData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) );
$chart['moreData']->color = '#FF0000';
- $chart['evenMoreData'] = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1);
+ $chart['evenMoreData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) );
$chart['evenMoreData']->color = '#00FF00';
$chart['evenMoreData']->label = 'Even more data';
@@ -1217,12 +1284,12 @@ class ezcGraphRenderer2dTest extends ezcImageTestCase
{
$chart = new ezcGraphLineChart();
- $chart['sampleData'] = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1);
+ $chart['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) );
$chart['sampleData']->color = '#0000FF';
$chart['sampleData']->symbol = ezcGraph::DIAMOND;
- $chart['moreData'] = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1);
+ $chart['moreData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) );
$chart['moreData']->color = '#FF0000';
- $chart['evenMoreData'] = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1);
+ $chart['evenMoreData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) );
$chart['evenMoreData']->color = '#00FF00';
$chart['evenMoreData']->label = 'Even more data';
@@ -1285,12 +1352,12 @@ class ezcGraphRenderer2dTest extends ezcImageTestCase
{
$chart = new ezcGraphLineChart();
- $chart['sampleData'] = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1);
+ $chart['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) );
$chart['sampleData']->color = '#0000FF';
$chart['sampleData']->symbol = ezcGraph::DIAMOND;
- $chart['moreData'] = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1);
+ $chart['moreData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) );
$chart['moreData']->color = '#FF0000';
- $chart['evenMoreData'] = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1);
+ $chart['evenMoreData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) );
$chart['evenMoreData']->color = '#00FF00';
$chart['evenMoreData']->label = 'Even more data';
@@ -1483,8 +1550,8 @@ class ezcGraphRenderer2dTest extends ezcImageTestCase
$chart = new ezcGraphLineChart();
$chart->palette = new ezcGraphPaletteBlack();
- $chart['Line 1'] = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1);
- $chart['Line 2'] = array( 'sample 1' => 543, 'sample 2' => 234, 'sample 3' => 298, 'sample 4' => 5, 'sample 5' => 613);
+ $chart['Line 1'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) );
+ $chart['Line 2'] = new ezcGraphArrayDataSet( array( 'sample 1' => 543, 'sample 2' => 234, 'sample 3' => 298, 'sample 4' => 5, 'sample 5' => 613) );
$chart->driver = new ezcGraphGdDriver();
$chart->options->font = $this->basePath . 'font.ttf';
@@ -1494,7 +1561,7 @@ class ezcGraphRenderer2dTest extends ezcImageTestCase
$filename,
$this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png',
'Image does not look as expected.',
- 10
+ 2000
);
}
@@ -1506,8 +1573,8 @@ class ezcGraphRenderer2dTest extends ezcImageTestCase
$chart->palette = new ezcGraphPaletteBlack();
$chart->options->fillLines = 200;
- $chart['Line 1'] = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1);
- $chart['Line 2'] = array( 'sample 1' => 543, 'sample 2' => 234, 'sample 3' => 298, 'sample 4' => 5, 'sample 5' => 613);
+ $chart['Line 1'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) );
+ $chart['Line 2'] = new ezcGraphArrayDataSet( array( 'sample 1' => 543, 'sample 2' => 234, 'sample 3' => 298, 'sample 4' => 5, 'sample 5' => 613) );
$chart->driver = new ezcGraphGdDriver();
$chart->options->font = $this->basePath . 'font.ttf';
@@ -1517,7 +1584,36 @@ class ezcGraphRenderer2dTest extends ezcImageTestCase
$filename,
$this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png',
'Image does not look as expected.',
- 10
+ 2000
+ );
+ }
+
+ public function testRenderFilledLineBarChart()
+ {
+ $filename = $this->tempDir . __FUNCTION__ . '.png';
+
+ $chart = new ezcGraphLineChart();
+ $chart->palette = new ezcGraphPaletteBlack();
+ $chart->options->fillLines = 200;
+
+ $chart['Line 0'] = new ezcGraphArrayDataSet( array( 'sample 1' => 432, 'sample 2' => 43, 'sample 3' => 65, 'sample 4' => 97, 'sample 5' => 154) );
+ $chart['Line 1'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) );
+ $chart['Line 2'] = new ezcGraphArrayDataSet( array( 'sample 1' => 543, 'sample 2' => 234, 'sample 3' => 298, 'sample 4' => 5, 'sample 5' => 613) );
+
+ $chart['Line 0']->displayType = ezcGraph::BAR;
+ $chart['Line 1']->displayType = ezcGraph::BAR;
+
+ $chart->xAxis->axisLabelRenderer = new ezcGraphAxisBoxedLabelRenderer();
+
+ $chart->driver = new ezcGraphGdDriver();
+ $chart->options->font = $this->basePath . 'font.ttf';
+ $chart->render( 500, 200, $filename );
+
+ $this->assertImageSimilar(
+ $filename,
+ $this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png',
+ 'Image does not look as expected.',
+ 2000
);
}
@@ -1529,8 +1625,8 @@ class ezcGraphRenderer2dTest extends ezcImageTestCase
$chart->palette = new ezcGraphPaletteBlack();
$chart->options->fillLines = 200;
- $chart['Line 1'] = array( 'sample 1' => 234, 'sample 2' => -151, 'sample 3' => 324, 'sample 4' => -120, 'sample 5' => 1);
- $chart['Line 2'] = array( 'sample 1' => 543, 'sample 2' => 234, 'sample 3' => 298, 'sample 4' => -5, 'sample 5' => -124);
+ $chart['Line 1'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => -151, 'sample 3' => 324, 'sample 4' => -120, 'sample 5' => 1) );
+ $chart['Line 2'] = new ezcGraphArrayDataSet( array( 'sample 1' => 543, 'sample 2' => 234, 'sample 3' => 298, 'sample 4' => -5, 'sample 5' => -124) );
$chart->driver = new ezcGraphGdDriver();
$chart->options->font = $this->basePath . 'font.ttf';
@@ -1540,7 +1636,7 @@ class ezcGraphRenderer2dTest extends ezcImageTestCase
$filename,
$this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png',
'Image does not look as expected.',
- 10
+ 2000
);
}
@@ -1549,13 +1645,13 @@ class ezcGraphRenderer2dTest extends ezcImageTestCase
$filename = $this->tempDir . __FUNCTION__ . '.png';
$chart = new ezcGraphPieChart();
- $chart['sample'] = array(
+ $chart['sample'] = new ezcGraphArrayDataSet( array(
'Mozilla' => 4375,
'IE' => 345,
'Opera' => 1204,
'wget' => 231,
'Safari' => 987,
- );
+ ) );
$chart['sample']->highlight['Safari'] = true;
@@ -1567,7 +1663,7 @@ class ezcGraphRenderer2dTest extends ezcImageTestCase
$filename,
$this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png',
'Image does not look as expected.',
- 10
+ 2000
);
}
@@ -1576,13 +1672,13 @@ class ezcGraphRenderer2dTest extends ezcImageTestCase
$filename = $this->tempDir . __FUNCTION__ . '.png';
$chart = new ezcGraphPieChart();
- $chart['sample'] = array(
+ $chart['sample'] = new ezcGraphArrayDataSet( array(
'Mozilla' => 4375,
'IE' => 345,
'Opera' => 1204,
'wget' => 231,
'Safari' => 987,
- );
+ ) );
$chart->background->color = '#FFFFFFDD';
$chart->background->image = dirname( __FILE__ ) . '/data/ez.png';
@@ -1596,7 +1692,7 @@ class ezcGraphRenderer2dTest extends ezcImageTestCase
$filename,
$this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png',
'Image does not look as expected.',
- 10
+ 2000
);
}
@@ -1605,13 +1701,13 @@ class ezcGraphRenderer2dTest extends ezcImageTestCase
$filename = $this->tempDir . __FUNCTION__ . '.png';
$chart = new ezcGraphPieChart();
- $chart['sample'] = array(
+ $chart['sample'] = new ezcGraphArrayDataSet( array(
'Mozilla' => 4375,
'IE' => 345,
'Opera' => 1204,
'wget' => 231,
'Safari' => 987,
- );
+ ) );
$chart->background->color = '#FFFFFFDD';
$chart->background->image = dirname( __FILE__ ) . '/data/texture.png';
@@ -1625,7 +1721,7 @@ class ezcGraphRenderer2dTest extends ezcImageTestCase
$filename,
$this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png',
'Image does not look as expected.',
- 10
+ 2000
);
}
}
diff --git a/tests/renderer_3d_test.php b/tests/renderer_3d_test.php
index 1cb25e1..5d93447 100644
--- a/tests/renderer_3d_test.php
+++ b/tests/renderer_3d_test.php
@@ -297,13 +297,13 @@ class ezcGraphRenderer3dTest extends ezcImageTestCase
$filename = $this->tempDir . __FUNCTION__ . '.png';
$chart = new ezcGraphPieChart();
- $chart['sample'] = array(
+ $chart['sample'] = new ezcGraphArrayDataSet( array(
'Mozilla' => 4375,
'IE' => 345,
'Opera' => 1204,
'wget' => 231,
'Safari' => 987,
- );
+ ) );
$chart['sample']->highlight['Safari'] = true;
@@ -316,7 +316,7 @@ class ezcGraphRenderer3dTest extends ezcImageTestCase
$filename,
$this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png',
'Image does not look as expected.',
- 10
+ 2000
);
}
@@ -325,13 +325,13 @@ class ezcGraphRenderer3dTest extends ezcImageTestCase
$filename = $this->tempDir . __FUNCTION__ . '.png';
$chart = new ezcGraphPieChart();
- $chart['sample'] = array(
+ $chart['sample'] = new ezcGraphArrayDataSet( array(
'Mozilla' => 4375,
'IE' => 345,
'Opera' => 1204,
'wget' => 231,
'Safari' => 987,
- );
+ ) );
$chart['sample']->highlight['Safari'] = true;
@@ -346,7 +346,7 @@ class ezcGraphRenderer3dTest extends ezcImageTestCase
$filename,
$this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png',
'Image does not look as expected.',
- 10
+ 2000
);
}
@@ -355,7 +355,7 @@ class ezcGraphRenderer3dTest extends ezcImageTestCase
$filename = $this->tempDir . __FUNCTION__ . '.png';
$chart = new ezcGraphPieChart();
- $chart['sample'] = array(
+ $chart['sample'] = new ezcGraphArrayDataSet( array(
'label 1' => 20,
'label 2' => 20,
'label 3' => 20,
@@ -366,7 +366,7 @@ class ezcGraphRenderer3dTest extends ezcImageTestCase
'label 8' => 20,
'label 9' => 20,
'label 10' => 20,
- );
+ ) );
$chart['sample']->highlight = true;
$chart->options->label = '%1$s';
@@ -383,7 +383,7 @@ class ezcGraphRenderer3dTest extends ezcImageTestCase
$filename,
$this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png',
'Image does not look as expected.',
- 10
+ 2000
);
}
@@ -392,13 +392,13 @@ class ezcGraphRenderer3dTest extends ezcImageTestCase
$filename = $this->tempDir . __FUNCTION__ . '.png';
$chart = new ezcGraphPieChart();
- $chart['sample'] = array(
+ $chart['sample'] = new ezcGraphArrayDataSet( array(
'Mozilla' => 4375,
'IE' => 345,
'Opera' => 1204,
'wget' => 231,
'Safari' => 987,
- );
+ ) );
$chart['sample']->highlight['Safari'] = true;
@@ -413,7 +413,7 @@ class ezcGraphRenderer3dTest extends ezcImageTestCase
$filename,
$this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png',
'Image does not look as expected.',
- 10
+ 2000
);
}
@@ -422,13 +422,13 @@ class ezcGraphRenderer3dTest extends ezcImageTestCase
$filename = $this->tempDir . __FUNCTION__ . '.png';
$chart = new ezcGraphPieChart();
- $chart['sample'] = array(
+ $chart['sample'] = new ezcGraphArrayDataSet( array(
'Mozilla' => 4375,
'IE' => 345,
'Opera' => 1204,
'wget' => 231,
'Safari' => 987,
- );
+ ) );
$chart['sample']->highlight['Safari'] = true;
@@ -443,7 +443,7 @@ class ezcGraphRenderer3dTest extends ezcImageTestCase
$filename,
$this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png',
'Image does not look as expected.',
- 10
+ 2000
);
}
@@ -452,13 +452,13 @@ class ezcGraphRenderer3dTest extends ezcImageTestCase
$filename = $this->tempDir . __FUNCTION__ . '.png';
$chart = new ezcGraphPieChart();
- $chart['sample'] = array(
+ $chart['sample'] = new ezcGraphArrayDataSet( array(
'Mozilla' => 4375,
'IE' => 345,
'Opera' => 1204,
'wget' => 231,
'Safari' => 987,
- );
+ ) );
$chart['sample']->highlight['Safari'] = true;
@@ -473,7 +473,7 @@ class ezcGraphRenderer3dTest extends ezcImageTestCase
$filename,
$this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png',
'Image does not look as expected.',
- 10
+ 2000
);
}
@@ -482,13 +482,13 @@ class ezcGraphRenderer3dTest extends ezcImageTestCase
$filename = $this->tempDir . __FUNCTION__ . '.png';
$chart = new ezcGraphPieChart();
- $chart['sample'] = array(
+ $chart['sample'] = new ezcGraphArrayDataSet( array(
'Mozilla' => 4375,
'IE' => 345,
'Opera' => 1204,
'wget' => 231,
'Safari' => 987,
- );
+ ) );
$chart['sample']->highlight['Safari'] = true;
@@ -503,7 +503,7 @@ class ezcGraphRenderer3dTest extends ezcImageTestCase
$filename,
$this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png',
'Image does not look as expected.',
- 10
+ 2000
);
}
@@ -512,13 +512,13 @@ class ezcGraphRenderer3dTest extends ezcImageTestCase
$filename = $this->tempDir . __FUNCTION__ . '.png';
$chart = new ezcGraphPieChart();
- $chart['sample'] = array(
+ $chart['sample'] = new ezcGraphArrayDataSet( array(
'Mozilla' => 4375,
'IE' => 345,
'Opera' => 1204,
'wget' => 231,
'Safari' => 987,
- );
+ ) );
$chart['sample']->highlight['Safari'] = true;
@@ -533,7 +533,7 @@ class ezcGraphRenderer3dTest extends ezcImageTestCase
$filename,
$this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png',
'Image does not look as expected.',
- 10
+ 2000
);
}
@@ -542,7 +542,7 @@ class ezcGraphRenderer3dTest extends ezcImageTestCase
$filename = $this->tempDir . __FUNCTION__ . '.png';
$chart = new ezcGraphPieChart();
- $chart['Skien'] = array( 'Norwegian' => 10, 'Dutch' => 3, 'German' => 2, 'French' => 2, 'Hindi' => 1, 'Taiwanese' => 1, 'Brazilian' => 1, 'Venezuelan' => 1, 'Japanese' => 1, 'Czech' => 1, 'Hungarian' => 1, 'Romanian' => 1 );
+ $chart['Skien'] = new ezcGraphArrayDataSet( array( 'Norwegian' => 10, 'Dutch' => 3, 'German' => 2, 'French' => 2, 'Hindi' => 1, 'Taiwanese' => 1, 'Brazilian' => 1, 'Venezuelan' => 1, 'Japanese' => 1, 'Czech' => 1, 'Hungarian' => 1, 'Romanian' => 1 ) );
$chart['Skien']->highlight['Norwegian'] = true;
@@ -555,7 +555,7 @@ class ezcGraphRenderer3dTest extends ezcImageTestCase
$filename,
$this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png',
'Image does not look as expected.',
- 10
+ 2000
);
}
@@ -566,8 +566,8 @@ class ezcGraphRenderer3dTest extends ezcImageTestCase
$chart = new ezcGraphLineChart();
$chart->palette = new ezcGraphPaletteBlack();
- $chart['Line 1'] = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1);
- $chart['Line 2'] = array( 'sample 1' => 543, 'sample 2' => 234, 'sample 3' => 298, 'sample 4' => 5, 'sample 5' => 613);
+ $chart['Line 1'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) );
+ $chart['Line 2'] = new ezcGraphArrayDataSet( array( 'sample 1' => 543, 'sample 2' => 234, 'sample 3' => 298, 'sample 4' => 5, 'sample 5' => 613) );
$chart->title = 'Line chart title';
@@ -580,7 +580,7 @@ class ezcGraphRenderer3dTest extends ezcImageTestCase
$filename,
$this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png',
'Image does not look as expected.',
- 10
+ 2000
);
}
@@ -591,8 +591,8 @@ class ezcGraphRenderer3dTest extends ezcImageTestCase
$chart = new ezcGraphLineChart();
$chart->palette = new ezcGraphPaletteBlack();
- $chart['Line 1'] = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1);
- $chart['Line 2'] = array( 'sample 1' => 543, 'sample 2' => 234, 'sample 3' => 298, 'sample 4' => 5, 'sample 5' => 613);
+ $chart['Line 1'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) );
+ $chart['Line 2'] = new ezcGraphArrayDataSet( array( 'sample 1' => 543, 'sample 2' => 234, 'sample 3' => 298, 'sample 4' => 5, 'sample 5' => 613) );
$chart->title = 'Line chart title';
@@ -606,7 +606,7 @@ class ezcGraphRenderer3dTest extends ezcImageTestCase
$filename,
$this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png',
'Image does not look as expected.',
- 10
+ 2000
);
}
@@ -617,8 +617,8 @@ class ezcGraphRenderer3dTest extends ezcImageTestCase
$chart = new ezcGraphLineChart();
$chart->palette = new ezcGraphPaletteBlack();
- $chart['Line 1'] = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1);
- $chart['Line 2'] = array( 'sample 1' => 543, 'sample 2' => 234, 'sample 3' => 298, 'sample 4' => 5, 'sample 5' => 613);
+ $chart['Line 1'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) );
+ $chart['Line 2'] = new ezcGraphArrayDataSet( array( 'sample 1' => 543, 'sample 2' => 234, 'sample 3' => 298, 'sample 4' => 5, 'sample 5' => 613) );
$chart->title = 'Line chart title';
$chart->title->maxHeight = .2;
@@ -633,7 +633,7 @@ class ezcGraphRenderer3dTest extends ezcImageTestCase
$filename,
$this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png',
'Image does not look as expected.',
- 10
+ 2000
);
}
@@ -645,8 +645,8 @@ class ezcGraphRenderer3dTest extends ezcImageTestCase
$chart->palette = new ezcGraphPaletteBlack();
$chart->options->fillLines = 200;
- $chart['Line 1'] = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1);
- $chart['Line 2'] = array( 'sample 1' => 543, 'sample 2' => 234, 'sample 3' => 298, 'sample 4' => 5, 'sample 5' => 613);
+ $chart['Line 1'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) );
+ $chart['Line 2'] = new ezcGraphArrayDataSet( array( 'sample 1' => 543, 'sample 2' => 234, 'sample 3' => 298, 'sample 4' => 5, 'sample 5' => 613) );
$chart->driver = new ezcGraphGdDriver();
$chart->renderer = new ezcGraphRenderer3d();
@@ -657,7 +657,7 @@ class ezcGraphRenderer3dTest extends ezcImageTestCase
$filename,
$this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png',
'Image does not look as expected.',
- 10
+ 2000
);
}
@@ -669,8 +669,8 @@ class ezcGraphRenderer3dTest extends ezcImageTestCase
$chart->palette = new ezcGraphPaletteBlack();
$chart->options->fillLines = 200;
- $chart['Line 1'] = array( 'sample 1' => 234, 'sample 2' => -151, 'sample 3' => 324, 'sample 4' => -120, 'sample 5' => 1);
- $chart['Line 2'] = array( 'sample 1' => 543, 'sample 2' => 234, 'sample 3' => 298, 'sample 4' => -5, 'sample 5' => -124);
+ $chart['Line 1'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => -151, 'sample 3' => 324, 'sample 4' => -120, 'sample 5' => 1) );
+ $chart['Line 2'] = new ezcGraphArrayDataSet( array( 'sample 1' => 543, 'sample 2' => 234, 'sample 3' => 298, 'sample 4' => -5, 'sample 5' => -124) );
$chart->driver = new ezcGraphGdDriver();
$chart->renderer = new ezcGraphRenderer3d();
@@ -681,7 +681,7 @@ class ezcGraphRenderer3dTest extends ezcImageTestCase
$filename,
$this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png',
'Image does not look as expected.',
- 10
+ 2000
);
}
@@ -692,8 +692,8 @@ class ezcGraphRenderer3dTest extends ezcImageTestCase
$chart = new ezcGraphLineChart();
$chart->palette = new ezcGraphPaletteBlack();
- $chart['Line 1'] = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1);
- $chart['Line 2'] = array( 'sample 1' => 543, 'sample 2' => 234, 'sample 3' => 298, 'sample 4' => 5, 'sample 5' => 613);
+ $chart['Line 1'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) );
+ $chart['Line 2'] = new ezcGraphArrayDataSet( array( 'sample 1' => 543, 'sample 2' => 234, 'sample 3' => 298, 'sample 4' => 5, 'sample 5' => 613) );
$chart->driver = new ezcGraphGdDriver();
$chart->renderer = new ezcGraphRenderer3d();
@@ -706,7 +706,7 @@ class ezcGraphRenderer3dTest extends ezcImageTestCase
$filename,
$this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png',
'Image does not look as expected.',
- 10
+ 2000
);
}
@@ -717,8 +717,8 @@ class ezcGraphRenderer3dTest extends ezcImageTestCase
$chart = new ezcGraphLineChart();
$chart->palette = new ezcGraphPaletteBlack();
- $chart['Line 1'] = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1);
- $chart['Line 2'] = array( 'sample 1' => 543, 'sample 2' => 234, 'sample 3' => 298, 'sample 4' => 5, 'sample 5' => 613);
+ $chart['Line 1'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) );
+ $chart['Line 2'] = new ezcGraphArrayDataSet( array( 'sample 1' => 543, 'sample 2' => 234, 'sample 3' => 298, 'sample 4' => 5, 'sample 5' => 613) );
$chart->driver = new ezcGraphGdDriver();
$chart->renderer = new ezcGraphRenderer3d();
@@ -731,7 +731,7 @@ class ezcGraphRenderer3dTest extends ezcImageTestCase
$filename,
$this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png',
'Image does not look as expected.',
- 10
+ 2000
);
}
@@ -742,8 +742,8 @@ class ezcGraphRenderer3dTest extends ezcImageTestCase
$chart = new ezcGraphLineChart();
$chart->palette = new ezcGraphPaletteBlack();
- $chart['Line 1'] = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1);
- $chart['Line 2'] = array( 'sample 1' => 543, 'sample 2' => 234, 'sample 3' => 298, 'sample 4' => 5, 'sample 5' => 613);
+ $chart['Line 1'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) );
+ $chart['Line 2'] = new ezcGraphArrayDataSet( array( 'sample 1' => 543, 'sample 2' => 234, 'sample 3' => 298, 'sample 4' => 5, 'sample 5' => 613) );
$chart->driver = new ezcGraphGdDriver();
$chart->renderer = new ezcGraphRenderer3d();
@@ -756,7 +756,7 @@ class ezcGraphRenderer3dTest extends ezcImageTestCase
$filename,
$this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png',
'Image does not look as expected.',
- 10
+ 2000
);
}
@@ -765,13 +765,13 @@ class ezcGraphRenderer3dTest extends ezcImageTestCase
$filename = $this->tempDir . __FUNCTION__ . '.png';
$chart = new ezcGraphPieChart();
- $chart['sample'] = array(
+ $chart['sample'] = new ezcGraphArrayDataSet( array(
'Mozilla' => 4375,
'IE' => 345,
'Opera' => 1204,
'wget' => 231,
'Safari' => 987,
- );
+ ) );
$chart->background->color = '#FFFFFFDD';
$chart->background->image = dirname( __FILE__ ) . '/data/ez.png';
@@ -785,7 +785,7 @@ class ezcGraphRenderer3dTest extends ezcImageTestCase
$filename,
$this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png',
'Image does not look as expected.',
- 10
+ 2000
);
}
@@ -794,13 +794,13 @@ class ezcGraphRenderer3dTest extends ezcImageTestCase
$filename = $this->tempDir . __FUNCTION__ . '.png';
$chart = new ezcGraphPieChart();
- $chart['sample'] = array(
+ $chart['sample'] = new ezcGraphArrayDataSet( array(
'Mozilla' => 4375,
'IE' => 345,
'Opera' => 1204,
'wget' => 231,
'Safari' => 987,
- );
+ ) );
$chart->background->color = '#FFFFFFDD';
$chart->background->image = dirname( __FILE__ ) . '/data/texture.png';
@@ -815,7 +815,7 @@ class ezcGraphRenderer3dTest extends ezcImageTestCase
$filename,
$this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png',
'Image does not look as expected.',
- 10
+ 2000
);
}
}
diff --git a/tests/text_test.php b/tests/text_test.php
index 74ec76c..d2bfb34 100644
--- a/tests/text_test.php
+++ b/tests/text_test.php
@@ -44,7 +44,7 @@ class ezcGraphTextTest extends ezcTestCase
public function testRenderTextTop()
{
$chart = new ezcGraphLineChart();
- $chart['sample'] = array( 'foo' => 1, 'bar' => 10 );
+ $chart['sample'] = new ezcGraphArrayDataSet( array( 'foo' => 1, 'bar' => 10 ) );
$chart->title = 'Title of a chart';
@@ -70,7 +70,7 @@ class ezcGraphTextTest extends ezcTestCase
public function testRenderTextBottom()
{
$chart = new ezcGraphLineChart();
- $chart['sample'] = array( 'foo' => 1, 'bar' => 10 );
+ $chart['sample'] = new ezcGraphArrayDataSet( array( 'foo' => 1, 'bar' => 10 ) );
$chart->title = 'Title of a chart';
$chart->title->position = ezcGraph::BOTTOM;
@@ -97,7 +97,7 @@ class ezcGraphTextTest extends ezcTestCase
public function testRenderTextTopMargin()
{
$chart = new ezcGraphLineChart();
- $chart['sample'] = array( 'foo' => 1, 'bar' => 10 );
+ $chart['sample'] = new ezcGraphArrayDataSet( array( 'foo' => 1, 'bar' => 10 ) );
$chart->title = 'Title of a chart';
$chart->title->position = ezcGraph::TOP;
OpenPOWER on IntegriCloud