summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--TODO2
-rw-r--r--design/design.txt20
-rw-r--r--src/exceptions/no_such_element.php25
-rw-r--r--src/graph_autoload.php1
-rw-r--r--src/interfaces/chart.php41
-rw-r--r--tests/background_image_test.php10
-rw-r--r--tests/dataset_test.php86
-rw-r--r--tests/font_test.php2
-rw-r--r--tests/labeled_axis_test.php42
-rw-r--r--tests/legend_test.php16
-rw-r--r--tests/line_test.php29
-rw-r--r--tests/numeric_axis_test.php70
-rw-r--r--tests/palette_test.php24
-rw-r--r--tests/pie_test.php22
-rw-r--r--tests/text_test.php6
15 files changed, 224 insertions, 172 deletions
diff --git a/TODO b/TODO
index e7a2a03..1d95ed1 100644
--- a/TODO
+++ b/TODO
@@ -10,6 +10,8 @@ Alpha:
Next steps:
- 3D-Renderer
- SVG-Driver
+ - Return datapoinnt positions for imagemap and / or adding additional
+ information with div overlays
- TextElement to add copyright info etc.
- GD-Driver
- Antialiasing of lines
diff --git a/design/design.txt b/design/design.txt
index 89ef258..a4e0b05 100644
--- a/design/design.txt
+++ b/design/design.txt
@@ -101,24 +101,24 @@ The following example shows how to use the class: ::
$pie->options->border->color = '#ff0000';
$pie->title = 'Apple Pie';
- $pie->humanoids = array( 'monkey' => 54, 'ape' => 37, 'human' => 9 ); // adds a new data set
- $pie->humanoids->color['monkey'] = 'blueish'; // setting datapoint color
- $pie->humanoids->highlight( 'monkey' ); // chart type dependent
+ $pie['humanoids'] = array( 'monkey' => 54, 'ape' => 37, 'human' => 9 ); // adds a new data set
+ $pie['humanoids']->color['monkey'] = 'blueish'; // setting datapoint color
+ $pie['humanoids']->highlight( 'monkey' ); // chart type dependent
$line = ezcGraph::create( 'Line' );
$line->options->backgroundColor = 'pink';
- $line->income = array( 1990 => 5, 5.1, 5.4, 5.3, 6.9 );
- $line->income->color = 'blue';
- $line->income->symbol = ezcGraph::diamond;
+ $line['income'] = array( 1990 => 5, 5.1, 5.4, 5.3, 6.9 );
+ $line['income']->color = 'blue';
+ $line['income']->symbol = ezcGraph::diamond;
- $line->incomeWithTax = array( 1990 => 4.9, 5.0, 5.2, 5.1, 6.4 );
- $line->incomeWithTax->color = 'red';
- $line->incomeWithTax->symbol = ezcGraph::squareWithChupi;
+ $line['incomeWithTax'] = array( 1990 => 4.9, 5.0, 5.2, 5.1, 6.4 );
+ $line['incomeWithTax']->color = 'red';
+ $line['incomeWithTax']->symbol = ezcGraph::squareWithChupi;
// Create a new averaging line
- $line->averageIncome = ezcDataSetAverage::createFrom($line->income[, options]);
+ $line['averageIncome'] = ezcDataSetAverage::createFrom($line->income[, options]);
$line->renderer = new ezcGraphRenderer2D();
$line->driver = new ezcGraphGDDriver();
diff --git a/src/exceptions/no_such_element.php b/src/exceptions/no_such_element.php
new file mode 100644
index 0000000..6832d23
--- /dev/null
+++ b/src/exceptions/no_such_element.php
@@ -0,0 +1,25 @@
+<?php
+/**
+ * File containing the ezcGraphNoSuchElementException class
+ *
+ * @package Graph
+ * @version //autogen//
+ * @copyright Copyright (C) 2005, 2006 eZ systems as. All rights reserved.
+ * @license http://ez.no/licenses/new_bsd New BSD License
+ */
+/**
+ * ezcGraphUnknownChartTypeException is the exception which is thrown when the
+ * factory method tries to return an instance of an unknown chart type
+ *
+ * @package Graph
+ * @version //autogen//
+ */
+class ezcGraphNoSuchElementException extends ezcGraphException
+{
+ public function __construct( $name )
+ {
+ parent::__construct( "No chart element with name <{$name}> found." );
+ }
+}
+
+?>
diff --git a/src/graph_autoload.php b/src/graph_autoload.php
index ef0aecf..912f18a 100644
--- a/src/graph_autoload.php
+++ b/src/graph_autoload.php
@@ -46,6 +46,7 @@ return array(
'ezcGraphUnknownPaletteException' => 'Graph/exceptions/unknown_palette.php',
'ezcGraphChartElement' => 'Graph/interfaces/element.php',
+ 'ezcGraphNoSuchElementException' => 'Graph/exceptions/no_such_element.php',
'ezcGraphFontOptions' => 'Graph/options/font.php',
'ezcGraphChartElementText' => 'Graph/element/text.php',
'ezcGraphChartElementLegend' => 'Graph/element/legend.php',
diff --git a/src/interfaces/chart.php b/src/interfaces/chart.php
index de990bd..6cc1e8c 100644
--- a/src/interfaces/chart.php
+++ b/src/interfaces/chart.php
@@ -12,7 +12,7 @@
*
* @package Graph
*/
-abstract class ezcGraphChart
+abstract class ezcGraphChart implements ArrayAccess
{
/**
@@ -161,7 +161,7 @@ abstract class ezcGraphChart
throw new ezcBaseValueException( "options", $propertyValue, "instanceof ezcGraphOptions" );
}
default:
- return $this->addDataSet($propertyName, $propertyValue);
+ throw new ezcBasePropertyNotFoundException( $propertyName );
break;
}
}
@@ -235,19 +235,44 @@ abstract class ezcGraphChart
return $this->elements[$propertyName];
}
- if ( isset( $this->data[$propertyName] ) )
- {
- return $this->data[$propertyName];
- }
-
if ( $propertyName === "options" )
{
return $this->options;
}
else
{
- throw new ezcGraphNoSuchDatasetException( $propertyName );
+ throw new ezcGraphNoSuchElementException( $propertyName );
+ }
+ }
+
+ public function offsetExists( $key )
+ {
+ return isset( $this->data[$key] );
+ }
+
+ public function offsetGet( $key )
+ {
+ if ( !isset( $key ) )
+ {
+ throw new ezcGraphNoSuchDatasetException( $key );
}
+
+ return $this->data[$key];
+ }
+
+ public function offsetSet( $key, $value )
+ {
+ return $this->addDataset( $key, $value );
+ }
+
+ public function offsetUnset( $key )
+ {
+ if ( !isset( $key ) )
+ {
+ throw new ezcGraphNoSuchDatasetException( $key );
+ }
+
+ unset( $this->data[$key] );
}
public function setOptions( $options )
diff --git a/tests/background_image_test.php b/tests/background_image_test.php
index af6f6ef..77a5a6a 100644
--- a/tests/background_image_test.php
+++ b/tests/background_image_test.php
@@ -56,7 +56,7 @@ class ezcGraphBackgroundImageTest extends ezcTestCase
public function testRenderStandard()
{
$chart = ezcGraph::create( 'line' );
- $chart->sampleData = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1);
+ $chart['sampleData'] = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1);
$chart->options->backgroundImage = $this->basePath . $this->testFiles['png'];
$chart->options->background = '#000000FF';
@@ -81,7 +81,7 @@ class ezcGraphBackgroundImageTest extends ezcTestCase
public function testRenderPieBottomRight()
{
$chart = ezcGraph::create( 'pie' );
- $chart->sampleData = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1);
+ $chart['sampleData'] = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1);
$chart->options->backgroundImage = $this->basePath . $this->testFiles['png'];
$chart->options->backgroundImage->position = ezcGraph::BOTTOM | ezcGraph::RIGHT;
$chart->options->background = '#000000FF';
@@ -107,7 +107,7 @@ class ezcGraphBackgroundImageTest extends ezcTestCase
public function testRenderTop()
{
$chart = ezcGraph::create( 'line' );
- $chart->sampleData = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1);
+ $chart['sampleData'] = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1);
$chart->options->backgroundImage = $this->basePath . $this->testFiles['png'];
$chart->options->backgroundImage->position = ezcGraph::TOP;
$chart->options->background = '#000000FF';
@@ -133,7 +133,7 @@ class ezcGraphBackgroundImageTest extends ezcTestCase
public function testRenderLeft()
{
$chart = ezcGraph::create( 'line' );
- $chart->sampleData = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1);
+ $chart['sampleData'] = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1);
$chart->options->backgroundImage = $this->basePath . $this->testFiles['png'];
$chart->options->backgroundImage->position = ezcGraph::LEFT;
$chart->options->background = '#000000FF';
@@ -161,7 +161,7 @@ class ezcGraphBackgroundImageTest extends ezcTestCase
$filename = $this->tempDir . __FUNCTION__ . '.png';
$chart = ezcGraph::create( 'line' );
- $chart->sampleData = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1);
+ $chart['sampleData'] = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1);
$chart->palette = 'Black';
$chart->options->backgroundImage = $this->basePath . $this->testFiles['png'];
$chart->options->background = '#2E343655';
diff --git a/tests/dataset_test.php b/tests/dataset_test.php
index 44aa377..b333418 100644
--- a/tests/dataset_test.php
+++ b/tests/dataset_test.php
@@ -44,7 +44,7 @@ class ezcGraphDatasetTest extends ezcTestCase
public function testCreateDatasetFromArray()
{
$chart = ezcGraph::create( 'Pie' );
- $chart->humanoids = array( 'monkey' => 54, 'ape' => 37, 'human' => 9 );
+ $chart['humanoids'] = array( 'monkey' => 54, 'ape' => 37, 'human' => 9 );
$datasets = $this->getNonPublicProperty( $chart, 'data' );
$this->assertTrue(
@@ -56,10 +56,10 @@ class ezcGraphDatasetTest extends ezcTestCase
public function testGetDataset()
{
$chart = ezcGraph::create( 'Pie' );
- $chart->humanoids = array( 'monkey' => 54, 'ape' => 37, 'human' => 9 );
+ $chart['humanoids'] = array( 'monkey' => 54, 'ape' => 37, 'human' => 9 );
$this->assertTrue(
- $chart->humanoids instanceof ezcGraphDataset,
+ $chart['humanoids'] instanceof ezcGraphDataset,
'No ezcGraphDataset was created.'
);
}
@@ -67,9 +67,9 @@ class ezcGraphDatasetTest extends ezcTestCase
public function testDatasetContent()
{
$chart = ezcGraph::create( 'Pie' );
- $chart->example = array( 'monkey' => 54, 2001 => 37 );
+ $chart['example'] = array( 'monkey' => 54, 2001 => 37 );
- $data = $this->getNonPublicProperty( $chart->example, 'data' );
+ $data = $this->getNonPublicProperty( $chart['example'], 'data' );
$this->assertSame(
54.,
@@ -84,8 +84,8 @@ class ezcGraphDatasetTest extends ezcTestCase
public function testCreateMultipleDatasetsFromArray()
{
$chart = ezcGraph::create( 'Line' );
- $chart->income = array( 2000 => 2345.2, 2456.3, 2567.4 );
- $chart->spending = array( 2000 => 2347.2, 2458.3, 2569.4 );
+ $chart['income'] = array( 2000 => 2345.2, 2456.3, 2567.4 );
+ $chart['spending'] = 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 = ezcGraph::create( 'Pie' );
- $chart->income = array( 2000 => 2345.2, 2456.3, 2567.4 );
- $chart->spending = array( 2000 => 2347.2, 2458.3, 2569.4 );
+ $chart['income'] = array( 2000 => 2345.2, 2456.3, 2567.4 );
+ $chart['spending'] = array( 2000 => 2347.2, 2458.3, 2569.4 );
}
catch ( ezcGraphTooManyDatasetsExceptions $e )
{
@@ -117,116 +117,116 @@ class ezcGraphDatasetTest extends ezcTestCase
public function testDatasetLabel()
{
$chart = ezcGraph::create( 'Pie' );
- $chart->income = array( 2000 => 2345.2, 2456.3, 2567.4 );
+ $chart['income'] = array( 2000 => 2345.2, 2456.3, 2567.4 );
$this->assertEquals(
'income',
- $chart->income->label->default
+ $chart['income']->label->default
);
}
public function testDatasetSetLabel()
{
$chart = ezcGraph::create( 'Pie' );
- $chart->income = array( 2000 => 2345.2, 2456.3, 2567.4 );
- $chart->income->label = 'Income Label';
+ $chart['income'] = array( 2000 => 2345.2, 2456.3, 2567.4 );
+ $chart['income']->label = 'Income Label';
$this->assertEquals(
'Income Label',
- $chart->income->label->default
+ $chart['income']->label->default
);
}
public function testDatasetSetColor()
{
$chart = ezcGraph::create( 'Pie' );
- $chart->income = array( 2000 => 2345.2, 2456.3, 2567.4 );
- $chart->income->color = '#FF0000';
+ $chart['income'] = array( 2000 => 2345.2, 2456.3, 2567.4 );
+ $chart['income']->color = '#FF0000';
$this->assertEquals(
ezcGraphColor::fromHex( '#FF0000' ),
- $chart->income->color->default
+ $chart['income']->color->default
);
}
public function testDatasetSetHighlight()
{
$chart = ezcGraph::create( 'Pie' );
- $chart->income = array( 2000 => 2345.2, 2456.3, 2567.4 );
- $chart->income->highlight = true;
+ $chart['income'] = array( 2000 => 2345.2, 2456.3, 2567.4 );
+ $chart['income']->highlight = true;
$this->assertEquals(
true,
- $chart->income->highlight->default
+ $chart['income']->highlight->default
);
}
public function testDatasetGetHighlight()
{
$chart = ezcGraph::create( 'Pie' );
- $chart->income = array( 2000 => 2345.2, 2456.3, 2567.4 );
+ $chart['income'] = array( 2000 => 2345.2, 2456.3, 2567.4 );
$this->assertEquals(
false,
- $chart->income->highlight[2001]
+ $chart['income']->highlight[2001]
);
$this->assertEquals(
false,
- $chart->income->highlight->default
+ $chart['income']->highlight->default
);
}
public function testDatasetSetHighlightSingle()
{
$chart = ezcGraph::create( 'Pie' );
- $chart->income = array( 2000 => 2345.2, 2456.3, 2567.4 );
- $chart->income->highlight[2001] = true;
+ $chart['income'] = array( 2000 => 2345.2, 2456.3, 2567.4 );
+ $chart['income']->highlight[2001] = true;
$this->assertEquals(
false,
- $chart->income->highlight[2000]
+ $chart['income']->highlight[2000]
);
$this->assertEquals(
true,
- $chart->income->highlight[2001]
+ $chart['income']->highlight[2001]
);
}
public function testDatasetSetSingleColor()
{
$chart = ezcGraph::create( 'Pie' );
- $chart->income = array( 2000 => 2345.2, 2456.3, 2567.4 );
- $chart->income->color[2001] = '#FF0000';
+ $chart['income'] = array( 2000 => 2345.2, 2456.3, 2567.4 );
+ $chart['income']->color[2001] = '#FF0000';
$this->assertEquals(
ezcGraphColor::fromHex( '#FF0000' ),
- $chart->income->color[2001]
+ $chart['income']->color[2001]
);
}
public function testDatasetSetSingleSymbol()
{
$chart = ezcGraph::create( 'Pie' );
- $chart->income = array( 2000 => 2345.2, 2456.3, 2567.4 );
- $chart->income->symbol[2001] = ezcGraph::DIAMOND;
+ $chart['income'] = array( 2000 => 2345.2, 2456.3, 2567.4 );
+ $chart['income']->symbol[2001] = ezcGraph::DIAMOND;
$this->assertEquals(
ezcGraph::DIAMOND,
- $chart->income->symbol[2001]
+ $chart['income']->symbol[2001]
);
}
public function testDatasetPropertyValueFallback()
{
$chart = ezcGraph::create( 'Pie' );
- $chart->income = array( 2000 => 2345.2, 2456.3, 2567.4 );
- $chart->income->symbol = ezcGraph::DIAMOND;
+ $chart['income'] = array( 2000 => 2345.2, 2456.3, 2567.4 );
+ $chart['income']->symbol = ezcGraph::DIAMOND;
$this->assertEquals(
ezcGraph::DIAMOND,
- $chart->income->symbol[2001]
+ $chart['income']->symbol[2001]
);
}
@@ -235,8 +235,8 @@ class ezcGraphDatasetTest extends ezcTestCase
try
{
$chart = ezcGraph::create( 'Pie' );
- $chart->income = array( 2000 => 2345.2, 2456.3, 2567.4 );
- $chart->income->symbol[2006] = ezcGraph::DIAMOND;
+ $chart['income'] = array( 2000 => 2345.2, 2456.3, 2567.4 );
+ $chart['income']->symbol[2006] = ezcGraph::DIAMOND;
}
catch ( ezcGraphNoSuchDataException $e )
{
@@ -249,23 +249,23 @@ class ezcGraphDatasetTest extends ezcTestCase
public function testDatasetGetSingleData()
{
$chart = ezcGraph::create( 'Pie' );
- $chart->income = array( 2000 => 2345.2, 2456.3, 2567.4 );
+ $chart['income'] = array( 2000 => 2345.2, 2456.3, 2567.4 );
$this->assertSame(
2345.2,
- $chart->income[2000]
+ $chart['income'][2000]
);
}
public function testDatasetSetSingleData()
{
$chart = ezcGraph::create( 'Pie' );
- $chart->income = array( 2000 => 2345.2, 2456.3, 2567.4 );
- $chart->income[2005] = 234.21;
+ $chart['income'] = array( 2000 => 2345.2, 2456.3, 2567.4 );
+ $chart['income'][2005] = 234.21;
$this->assertSame(
234.21,
- $chart->income[2005]
+ $chart['income'][2005]
);
}
}
diff --git a/tests/font_test.php b/tests/font_test.php
index 7a362ad..8d6795c 100644
--- a/tests/font_test.php
+++ b/tests/font_test.php
@@ -117,7 +117,7 @@ class ezcGraphFontTest extends ezcTestCase
public function testSetFontForElementWithRendering()
{
$chart = ezcGraph::create( 'Line' );
- $chart->sampleData = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1);
+ $chart['sampleData'] = 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 19c3a3f..27c8af1 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 = ezcGraph::create( 'Line' );
- $chart->sample = array( 2000 => 20, 70, 12, 130 );
+ $chart['sample'] = array( 2000 => 20, 70, 12, 130 );
$chart->render( 500, 200 );
$this->assertSame(
@@ -70,8 +70,8 @@ class ezcGraphLabeledAxisTest extends ezcTestCase
public function testAutomaticLabelingMultiple()
{
$chart = ezcGraph::create( 'Line' );
- $chart->sample = array( 2000 => 1045, 1300, 1012, 1450 );
- $chart->sample2 = array( 2002 => 1270, 1170, 1610, 1370 );
+ $chart['sample'] = array( 2000 => 1045, 1300, 1012, 1450 );
+ $chart['sample2'] = array( 2002 => 1270, 1170, 1610, 1370 );
$chart->render( 500, 200 );
$this->assertSame(
@@ -90,8 +90,8 @@ class ezcGraphLabeledAxisTest extends ezcTestCase
public function testAutomaticLabelingMultipleMixed()
{
$chart = ezcGraph::create( 'Line' );
- $chart->sample = array( 2000 => 1045, 2001 => 1300, 2004 => 1012, 2006 => 1450 );
- $chart->sample2 = array( 2001 => 1270, 1170, 1610, 1370, 1559 );
+ $chart['sample'] = array( 2000 => 1045, 2001 => 1300, 2004 => 1012, 2006 => 1450 );
+ $chart['sample2'] = 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 = ezcGraph::create( 'Line' );
- $chart->sample = array( 2000 => 1045, 1300, 1012, 1450 );
+ $chart['sample'] = array( 2000 => 1045, 1300, 1012, 1450 );
$chart->xAxis->position = ezcGraph::LEFT;
$chart->render( 500, 200 );
@@ -155,7 +155,7 @@ class ezcGraphLabeledAxisTest extends ezcTestCase
public function testPositionRight()
{
$chart = ezcGraph::create( 'Line' );
- $chart->sample = array( 2000 => 1045, 1300, 1012, 1450 );
+ $chart['sample'] = array( 2000 => 1045, 1300, 1012, 1450 );
$chart->xAxis->position = ezcGraph::RIGHT;
$chart->render( 500, 200 );
@@ -199,7 +199,7 @@ class ezcGraphLabeledAxisTest extends ezcTestCase
public function testPositionTop()
{
$chart = ezcGraph::create( 'Line' );
- $chart->sample = array( 2000 => 1045, 1300, 1012, 1450 );
+ $chart['sample'] = array( 2000 => 1045, 1300, 1012, 1450 );
$chart->xAxis->position = ezcGraph::TOP;
$chart->render( 500, 200 );
@@ -243,7 +243,7 @@ class ezcGraphLabeledAxisTest extends ezcTestCase
public function testPositionBottom()
{
$chart = ezcGraph::create( 'Line' );
- $chart->sample = array( 2000 => 1045, 1300, 1012, 1450 );
+ $chart['sample'] = array( 2000 => 1045, 1300, 1012, 1450 );
$chart->xAxis->position = ezcGraph::BOTTOM;
$chart->render( 500, 200 );
@@ -287,8 +287,8 @@ class ezcGraphLabeledAxisTest extends ezcTestCase
public function testRenderLabeledAxisBase()
{
$chart = ezcGraph::create( 'Line' );
- $chart->sample = array( 2000 => 1045, 1300, 1012, 1450 );
- $chart->sample2 = array( 2000 => 1270, 1170, 1610, 1370 );
+ $chart['sample'] = array( 2000 => 1045, 1300, 1012, 1450 );
+ $chart['sample2'] = array( 2000 => 1270, 1170, 1610, 1370 );
$mockedRenderer = $this->getMock( 'ezcGraphRenderer2D', array(
'drawLine',
@@ -313,8 +313,8 @@ class ezcGraphLabeledAxisTest extends ezcTestCase
public function testRenderLabeledAxisArrowHead()
{
$chart = ezcGraph::create( 'Line' );
- $chart->sample = array( 2000 => 1045, 1300, 1012, 1450 );
- $chart->sample2 = array( 2000 => 1270, 1170, 1610, 1370 );
+ $chart['sample'] = array( 2000 => 1045, 1300, 1012, 1450 );
+ $chart['sample2'] = array( 2000 => 1270, 1170, 1610, 1370 );
$mockedRenderer = $this->getMock( 'ezcGraphRenderer2D', array(
'drawPolygon',
@@ -342,8 +342,8 @@ class ezcGraphLabeledAxisTest extends ezcTestCase
public function testRenderLabeledAxisMajor()
{
$chart = ezcGraph::create( 'Line' );
- $chart->sample = array( 2000 => 1045, 1300, 1012, 1450 );
- $chart->sample2 = array( 2000 => 1270, 1170, 1610, 1370 );
+ $chart['sample'] = array( 2000 => 1045, 1300, 1012, 1450 );
+ $chart['sample2'] = array( 2000 => 1270, 1170, 1610, 1370 );
$mockedRenderer = $this->getMock( 'ezcGraphRenderer2D', array(
'drawLine',
@@ -395,7 +395,7 @@ class ezcGraphLabeledAxisTest extends ezcTestCase
public function testRenderNumericAxisMajorGrid()
{
$chart = ezcGraph::create( 'Line' );
- $chart->sample = array( 2000 => 1045, 1300, 1012, 1450 );
+ $chart['sample'] = array( 2000 => 1045, 1300, 1012, 1450 );
$chart->xAxis->grid = '#BBBBBB';
$mockedRenderer = $this->getMock( 'ezcGraphRenderer2D', array(
@@ -448,8 +448,8 @@ class ezcGraphLabeledAxisTest extends ezcTestCase
public function testRenderLabeledAxisLabels()
{
$chart = ezcGraph::create( 'Line' );
- $chart->sample = array( 2000 => 1045, 1300, 1012, 1450 );
- $chart->sample2 = array( 2000 => 1270, 1170, 1610, 1370 );
+ $chart['sample'] = array( 2000 => 1045, 1300, 1012, 1450 );
+ $chart['sample2'] = array( 2000 => 1270, 1170, 1610, 1370 );
$mockedRenderer = $this->getMock( 'ezcGraphRenderer2D', array(
'drawTextBox',
@@ -505,8 +505,8 @@ class ezcGraphLabeledAxisTest extends ezcTestCase
public function testRenderNumericAxisCustomLabels()
{
$chart = ezcGraph::create( 'Line' );
- $chart->sample = array( 2000 => 1045, 1300, 1012, 1450 );
- $chart->sample2 = array( 2000 => 1270, 1170, 1610, 1370 );
+ $chart['sample'] = array( 2000 => 1045, 1300, 1012, 1450 );
+ $chart['sample2'] = array( 2000 => 1270, 1170, 1610, 1370 );
$chart->xAxis->formatString = 'test';
$mockedRenderer = $this->getMock( 'ezcGraphRenderer2D', array(
@@ -568,7 +568,7 @@ class ezcGraphLabeledAxisTest extends ezcTestCase
$data[$i] = 25 * sin( $i / 50 );
}
$chart = ezcGraph::create( 'Line' );
- $chart->sinus = $data;
+ $chart['sinus'] = $data;
$mockedRenderer = $this->getMock( 'ezcGraphRenderer2D', array(
'drawTextBox',
diff --git a/tests/legend_test.php b/tests/legend_test.php
index fcacead..6c7f2ce 100644
--- a/tests/legend_test.php
+++ b/tests/legend_test.php
@@ -43,14 +43,14 @@ class ezcGraphLegendTest 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->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->color = '#FF0000';
- $chart->evenMoreData = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1);
- $chart->evenMoreData->color = '#FF0000';
- $chart->evenMoreData->label = 'Even more data';
+ $chart['sampleData'] = 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']->color = '#FF0000';
+ $chart['evenMoreData'] = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1);
+ $chart['evenMoreData']->color = '#FF0000';
+ $chart['evenMoreData']->label = 'Even more data';
}
public function testFactoryLegend()
diff --git a/tests/line_test.php b/tests/line_test.php
index c81f74e..0d89592 100644
--- a/tests/line_test.php
+++ b/tests/line_test.php
@@ -51,10 +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->evenMoreData = array( 'sample 1' => 300, 'sample 2' => -30, 'sample 3' => 220, 'sample 4' => 67, 'sample 5' => 450);
- $chart->evenMoreData->label = 'Even more data';
+ $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);
}
public function testElementGenerationLegend()
@@ -99,9 +98,9 @@ class ezcGraphLineChartTest extends ezcTestCase
public function testRenderChartLines()
{
$chart = ezcGraph::create( 'Line' );
- $chart->sampleData = 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'] = 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;
$mockedRenderer = $this->getMock( 'ezcGraphRenderer2D', array(
'drawLine',
@@ -152,7 +151,7 @@ class ezcGraphLineChartTest extends ezcTestCase
public function testRenderChartFilledLines()
{
$chart = ezcGraph::create( 'Line' );
- $chart->sampleData = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => -46, 'sample 4' => 120 );
+ $chart['sampleData'] = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => -46, 'sample 4' => 120 );
$chart->palette = 'Black';
$chart->options->fillLines = 100;
@@ -231,7 +230,7 @@ class ezcGraphLineChartTest extends ezcTestCase
public function testRenderChartFilledLinesZero()
{
$chart = ezcGraph::create( 'Line' );
- $chart->sampleData = array( 'sample 1' => 0, 'sample 2' => 0 );
+ $chart['sampleData'] = array( 'sample 1' => 0, 'sample 2' => 0 );
$chart->palette = 'Black';
$chart->options->fillLines = 100;
@@ -261,9 +260,9 @@ class ezcGraphLineChartTest extends ezcTestCase
public function testRenderChartLinesModifiedThickness()
{
$chart = ezcGraph::create( 'Line' );
- $chart->sampleData = 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'] = 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->options->lineThickness = 1;
$mockedRenderer = $this->getMock( 'ezcGraphRenderer2D', array(
@@ -315,9 +314,9 @@ class ezcGraphLineChartTest extends ezcTestCase
public function testRenderChartSymbols()
{
$chart = ezcGraph::create( 'Line' );
- $chart->sampleData = 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'] = 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;
$mockedRenderer = $this->getMock( 'ezcGraphRenderer2D', array(
'drawSymbol',
diff --git a/tests/numeric_axis_test.php b/tests/numeric_axis_test.php
index 6fed7f2..fa9d7f7 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 = ezcGraph::create( 'Line' );
- $chart->sample = array( 2000 => 20, 70, 12, 130 );
+ $chart['sample'] = array( 2000 => 20, 70, 12, 130 );
$chart->render( 500, 200 );
$this->assertEquals(
@@ -146,7 +146,7 @@ class ezcGraphNumericAxisTest extends ezcTestCase
public function testAutomagicScalingSingle2()
{
$chart = ezcGraph::create( 'Line' );
- $chart->sample = array( 2000 => 1, 4.3, .2, 3.82 );
+ $chart['sample'] = 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 = ezcGraph::create( 'Line' );
- $chart->sample = array( 2000 => -1.8, 4.3, .2, 3.82 );
+ $chart['sample'] = 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 = ezcGraph::create( 'Line' );
- $chart->sample = array( 2000 => 1045, 1300, 1012, 1450 );
+ $chart['sample'] = array( 2000 => 1045, 1300, 1012, 1450 );
$chart->render( 500, 200 );
$this->assertEquals(
@@ -239,8 +239,8 @@ class ezcGraphNumericAxisTest extends ezcTestCase
public function testAutomagicScalingMultiple()
{
$chart = ezcGraph::create( 'Line' );
- $chart->sample = array( 2000 => 1045, 1300, 1012, 1450 );
- $chart->sample2 = array( 2000 => 1270, 1170, 1610, 1370 );
+ $chart['sample'] = array( 2000 => 1045, 1300, 1012, 1450 );
+ $chart['sample2'] = array( 2000 => 1270, 1170, 1610, 1370 );
$chart->render( 500, 200 );
$this->assertEquals(
@@ -271,7 +271,7 @@ class ezcGraphNumericAxisTest extends ezcTestCase
public function testMixedAutomagicAndManualScaling()
{
$chart = ezcGraph::create( 'Line' );
- $chart->sample = array( 2000 => 1045, 1300, 1012, 1450 );
+ $chart['sample'] = 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 = ezcGraph::create( 'Line' );
- $chart->sample = array( 2000 => 1045, 1300, 1012, 1450 );
+ $chart['sample'] = 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 = ezcGraph::create( 'Line' );
- $chart->sample = array( 2000 => 1045, 1300, 1012, 1450 );
+ $chart['sample'] = 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 = ezcGraph::create( 'Line' );
- $chart->sample = array( 2000 => 1045, 1300, 1012, 1450 );
+ $chart['sample'] = 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 = ezcGraph::create( 'Line' );
- $chart->sample = array( 2000 => 1045, 1300, 1012, 1450 );
+ $chart['sample'] = array( 2000 => 1045, 1300, 1012, 1450 );
$chart->yAxis->position = ezcGraph::LEFT;
$chart->render( 500, 200 );
@@ -438,7 +438,7 @@ class ezcGraphNumericAxisTest extends ezcTestCase
public function testPositionRight()
{
$chart = ezcGraph::create( 'Line' );
- $chart->sample = array( 2000 => 1045, 1300, 1012, 1450 );
+ $chart['sample'] = array( 2000 => 1045, 1300, 1012, 1450 );
$chart->yAxis->position = ezcGraph::RIGHT;
$chart->render( 500, 200 );
@@ -476,7 +476,7 @@ class ezcGraphNumericAxisTest extends ezcTestCase
public function testPositionTop()
{
$chart = ezcGraph::create( 'Line' );
- $chart->sample = array( 2000 => 1045, 1300, 1012, 1450 );
+ $chart['sample'] = array( 2000 => 1045, 1300, 1012, 1450 );
$chart->yAxis->position = ezcGraph::TOP;
$chart->render( 500, 200 );
@@ -514,7 +514,7 @@ class ezcGraphNumericAxisTest extends ezcTestCase
public function testPositionBottom()
{
$chart = ezcGraph::create( 'Line' );
- $chart->sample = array( 2000 => 1045, 1300, 1012, 1450 );
+ $chart['sample'] = array( 2000 => 1045, 1300, 1012, 1450 );
$chart->yAxis->position = ezcGraph::BOTTOM;
$chart->render( 500, 200 );
@@ -552,7 +552,7 @@ class ezcGraphNumericAxisTest extends ezcTestCase
public function testPositionLeftNegativMinimum()
{
$chart = ezcGraph::create( 'Line' );
- $chart->sample = array( 2000 => -300, 1300, 1012, 1450 );
+ $chart['sample'] = array( 2000 => -300, 1300, 1012, 1450 );
$chart->yAxis->majorStep = 500;
$chart->yAxis->position = ezcGraph::LEFT;
$chart->render( 500, 200 );
@@ -591,9 +591,9 @@ class ezcGraphNumericAxisTest extends ezcTestCase
public function testNullPositionMultipleDatasets()
{
$chart = ezcGraph::create( 'Line' );
- $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'] = 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->render( 500, 200 );
$testBoundings = new ezcGraphBoundings();
@@ -612,8 +612,8 @@ class ezcGraphNumericAxisTest extends ezcTestCase
public function testRenderNumericAxisBase()
{
$chart = ezcGraph::create( 'Line' );
- $chart->sample = array( 2000 => 1045, 1300, 1012, 1450 );
- $chart->sample2 = array( 2000 => 1270, 1170, 1610, 1370 );
+ $chart['sample'] = array( 2000 => 1045, 1300, 1012, 1450 );
+ $chart['sample2'] = array( 2000 => 1270, 1170, 1610, 1370 );
$mockedRenderer = $this->getMock( 'ezcGraphRenderer2D', array(
'drawLine',
@@ -639,8 +639,8 @@ class ezcGraphNumericAxisTest extends ezcTestCase
public function testRenderNumericAxisArrowHead()
{
$chart = ezcGraph::create( 'Line' );
- $chart->sample = array( 2000 => 1045, 1300, 1012, 1450 );
- $chart->sample2 = array( 2000 => 1270, 1170, 1610, 1370 );
+ $chart['sample'] = array( 2000 => 1045, 1300, 1012, 1450 );
+ $chart['sample2'] = array( 2000 => 1270, 1170, 1610, 1370 );
$mockedRenderer = $this->getMock( 'ezcGraphRenderer2D', array(
'drawPolygon',
@@ -668,8 +668,8 @@ class ezcGraphNumericAxisTest extends ezcTestCase
public function testRenderNumericAxisMajor()
{
$chart = ezcGraph::create( 'Line' );
- $chart->sample = array( 2000 => 1045, 1300, 1012, 1450 );
- $chart->sample2 = array( 2000 => 1270, 1170, 1610, 1370 );
+ $chart['sample'] = array( 2000 => 1045, 1300, 1012, 1450 );
+ $chart['sample2'] = array( 2000 => 1270, 1170, 1610, 1370 );
$mockedRenderer = $this->getMock( 'ezcGraphRenderer2D', array(
'drawLine',
@@ -723,7 +723,7 @@ class ezcGraphNumericAxisTest extends ezcTestCase
public function testRenderNumericAxisMajorGrid()
{
$chart = ezcGraph::create( 'Line' );
- $chart->sample = array( 2000 => 1045, 1300, 1012, 1450 );
+ $chart['sample'] = array( 2000 => 1045, 1300, 1012, 1450 );
$chart->yAxis->grid = ezcGraphColor::fromHex( '#BBBBBB' );
$mockedRenderer = $this->getMock( 'ezcGraphRenderer2D', array(
@@ -767,8 +767,8 @@ class ezcGraphNumericAxisTest extends ezcTestCase
public function testRenderNumericAxisMinor()
{
$chart = ezcGraph::create( 'Line' );
- $chart->sample = array( 2000 => 1045, 1300, 1012, 1450 );
- $chart->sample2 = array( 2000 => 1270, 1170, 1610, 1370 );
+ $chart['sample'] = array( 2000 => 1045, 1300, 1012, 1450 );
+ $chart['sample2'] = array( 2000 => 1270, 1170, 1610, 1370 );
$mockedRenderer = $this->getMock( 'ezcGraphRenderer2D', array(
'drawLine',
@@ -823,7 +823,7 @@ class ezcGraphNumericAxisTest extends ezcTestCase
public function testRenderNumericAxisMinorGrid()
{
$chart = ezcGraph::create( 'Line' );
- $chart->sample = array( 2000 => 1045, 1300, 1012, 1450 );
+ $chart['sample'] = array( 2000 => 1045, 1300, 1012, 1450 );
$chart->yAxis->minorGrid = '#BBBBBB';
$mockedRenderer = $this->getMock( 'ezcGraphRenderer2D', array(
@@ -869,8 +869,8 @@ class ezcGraphNumericAxisTest extends ezcTestCase
public function testRenderNumericAxisLabels()
{
$chart = ezcGraph::create( 'Line' );
- $chart->sample = array( 2000 => 1045, 1300, 1012, 1450 );
- $chart->sample2 = array( 2000 => 1270, 1170, 1610, 1370 );
+ $chart['sample'] = array( 2000 => 1045, 1300, 1012, 1450 );
+ $chart['sample2'] = array( 2000 => 1270, 1170, 1610, 1370 );
$mockedRenderer = $this->getMock( 'ezcGraphRenderer2D', array(
'drawTextBox',
@@ -916,8 +916,8 @@ class ezcGraphNumericAxisTest extends ezcTestCase
public function testRenderNumericAxisCustomLabels()
{
$chart = ezcGraph::create( 'Line' );
- $chart->sample = array( 2000 => 1045, 1300, 1012, 1450 );
- $chart->sample2 = array( 2000 => 1270, 1170, 1610, 1370 );
+ $chart['sample'] = array( 2000 => 1045, 1300, 1012, 1450 );
+ $chart['sample2'] = array( 2000 => 1270, 1170, 1610, 1370 );
$chart->yAxis->formatString = 'test';
$mockedRenderer = $this->getMock( 'ezcGraphRenderer2D', array(
@@ -971,7 +971,7 @@ class ezcGraphNumericAxisTest extends ezcTestCase
$chart = ezcGraph::create( 'Line' );
$chart->xAxis = new ezcGraphChartElementNumericAxis();
- $chart->sinus = $sin;
+ $chart['sinus'] = $sin;
$mockedRenderer = $this->getMock( 'ezcGraphRenderer2D', array(
'drawTextBox',
@@ -1025,7 +1025,7 @@ class ezcGraphNumericAxisTest extends ezcTestCase
public function testValueZeroAmplitude()
{
$chart = ezcGraph::create( 'Line' );
- $chart->sample = array( 2000 => 70, 70, 70, 70 );
+ $chart['sample'] = array( 2000 => 70, 70, 70, 70 );
$chart->render( 500, 200 );
$this->assertEquals(
@@ -1056,7 +1056,7 @@ class ezcGraphNumericAxisTest extends ezcTestCase
public function testValueAllZero()
{
$chart = ezcGraph::create( 'Line' );
- $chart->sample = array( 2000 => 0, 0 );
+ $chart['sample'] = array( 2000 => 0, 0 );
$chart->render( 500, 200 );
$this->assertEquals(
diff --git a/tests/palette_test.php b/tests/palette_test.php
index fab2f97..5ed820f 100644
--- a/tests/palette_test.php
+++ b/tests/palette_test.php
@@ -289,18 +289,18 @@ class ezcGraphPaletteTest extends ezcTestCase
public function testDatasetAutomaticColorization()
{
$chart = ezcGraph::create( 'Line' );
- $chart->income = array( 2000 => 2345.2, 2456.3, 2567.4 );
- $chart->spending = array( 2000 => 2347.2, 2458.3, 2569.4 );
+ $chart['income'] = array( 2000 => 2345.2, 2456.3, 2567.4 );
+ $chart['spending'] = array( 2000 => 2347.2, 2458.3, 2569.4 );
$this->assertEquals(
ezcGraphColor::fromHex( '#3465A4' ),
- $chart->income->color->default,
+ $chart['income']->color->default,
'Wrong automatic color set.'
);
$this->assertEquals(
ezcGraphColor::fromHex( '#4E9A06' ),
- $chart->spending->color->default,
+ $chart['spending']->color->default,
'Wrong automatic color set.'
);
}
@@ -308,8 +308,8 @@ class ezcGraphPaletteTest extends ezcTestCase
public function testChartBackground()
{
$chart = ezcGraph::create( 'Line' );
- $chart->income = array( 2000 => 2345.2, 2456.3, 2567.4 );
- $chart->spending = array( 2000 => 2347.2, 2458.3, 2569.4 );
+ $chart['income'] = array( 2000 => 2345.2, 2456.3, 2567.4 );
+ $chart['spending'] = 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 = ezcGraph::create( 'Line' );
- $chart->income = array( 2000 => 2345.2, 2456.3, 2567.4 );
- $chart->spending = array( 2000 => 2347.2, 2458.3, 2569.4 );
+ $chart['income'] = array( 2000 => 2345.2, 2456.3, 2567.4 );
+ $chart['spending'] = 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 = ezcGraph::create( 'Line' );
- $chart->income = array( 2000 => 2345.2, 2456.3, 2567.4 );
- $chart->spending = array( 2000 => 2347.2, 2458.3, 2569.4 );
+ $chart['income'] = array( 2000 => 2345.2, 2456.3, 2567.4 );
+ $chart['spending'] = array( 2000 => 2347.2, 2458.3, 2569.4 );
$this->assertEquals(
0,
@@ -347,8 +347,8 @@ class ezcGraphPaletteTest extends ezcTestCase
public function testChartElementAxisColor()
{
$chart = ezcGraph::create( 'Line' );
- $chart->income = array( 2000 => 2345.2, 2456.3, 2567.4 );
- $chart->spending = array( 2000 => 2347.2, 2458.3, 2569.4 );
+ $chart['income'] = array( 2000 => 2345.2, 2456.3, 2567.4 );
+ $chart['spending'] = 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 a094d57..d2005fd 100644
--- a/tests/pie_test.php
+++ b/tests/pie_test.php
@@ -52,7 +52,7 @@ class ezcGraphPieChartTest extends ezcTestCase
public function testElementGenerationLegend()
{
$chart = ezcGraph::create( 'Pie' );
- $chart->sampleData = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1);
+ $chart['sampleData'] = 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' );
@@ -85,7 +85,7 @@ class ezcGraphPieChartTest extends ezcTestCase
public function testPieRenderPieSegments()
{
$chart = ezcGraph::create( 'Pie' );
- $chart->sample = array(
+ $chart['sample'] = array(
'Mozilla' => 4375,
'IE' => 345,
'Opera' => 1204,
@@ -160,7 +160,7 @@ class ezcGraphPieChartTest extends ezcTestCase
public function testPieRenderPieLables()
{
$chart = ezcGraph::create( 'Pie' );
- $chart->sample = array(
+ $chart['sample'] = array(
'Mozilla' => 4375,
'IE' => 345,
'Opera' => 1204,
@@ -230,7 +230,7 @@ class ezcGraphPieChartTest extends ezcTestCase
public function testPieRenderPieLablesWithoutSymbols()
{
$chart = ezcGraph::create( 'Pie' );
- $chart->sample = array(
+ $chart['sample'] = array(
'Mozilla' => 4375,
'IE' => 345,
'Opera' => 1204,
@@ -301,7 +301,7 @@ class ezcGraphPieChartTest extends ezcTestCase
public function testPieRenderPieLableIdentifiers()
{
$chart = ezcGraph::create( 'Pie' );
- $chart->sample = array(
+ $chart['sample'] = array(
'Mozilla' => 4375,
'IE' => 345,
'Opera' => 1204,
@@ -354,7 +354,7 @@ class ezcGraphPieChartTest extends ezcTestCase
$chart = ezcGraph::create( 'Pie' );
- $chart->sample = array(
+ $chart['sample'] = array(
'Mozilla' => 4375,
'IE' => 345,
'Opera' => 1204,
@@ -384,7 +384,7 @@ class ezcGraphPieChartTest extends ezcTestCase
$chart = ezcGraph::create( 'Pie' );
- $chart->sample = array(
+ $chart['sample'] = array(
'Mozilla' => 4375,
'IE' => 345,
'Opera' => 1204,
@@ -415,14 +415,14 @@ class ezcGraphPieChartTest extends ezcTestCase
$chart = ezcGraph::create( 'Pie' );
- $chart->sample = array(
+ $chart['sample'] = array(
'Mozilla' => 4375,
'IE' => 345,
'Opera' => 1204,
'wget' => 231,
'Safari' => 987,
);
- $chart->sample->highlight['Safari'] = true;
+ $chart['sample']->highlight['Safari'] = true;
$chart->driver = new ezcGraphGdDriver();
$chart->options->font = $this->basePath . 'font.ttf';
@@ -447,14 +447,14 @@ class ezcGraphPieChartTest extends ezcTestCase
$chart = ezcGraph::create( 'Pie' );
$chart->options->showSymbol = false;
- $chart->sample = array(
+ $chart['sample'] = array(
'Mozilla' => 4375,
'IE' => 345,
'Opera' => 1204,
'wget' => 231,
'Safari' => 987,
);
- $chart->sample->highlight['Safari'] = true;
+ $chart['sample']->highlight['Safari'] = true;
$chart->driver = new ezcGraphGdDriver();
$chart->options->font = $this->basePath . 'font.ttf';
diff --git a/tests/text_test.php b/tests/text_test.php
index 8cb6f36..b2734a2 100644
--- a/tests/text_test.php
+++ b/tests/text_test.php
@@ -44,7 +44,7 @@ class ezcGraphTextTest extends ezcTestCase
public function testRenderTextTop()
{
$chart = ezcGraph::create( 'Line' );
- $chart->sample = array( 'foo' => 1, 'bar' => 10 );
+ $chart['sample'] = array( 'foo' => 1, 'bar' => 10 );
$chart->title = 'Title of a chart';
@@ -83,7 +83,7 @@ class ezcGraphTextTest extends ezcTestCase
public function testRenderTextBottom()
{
$chart = ezcGraph::create( 'Line' );
- $chart->sample = array( 'foo' => 1, 'bar' => 10 );
+ $chart['sample'] = array( 'foo' => 1, 'bar' => 10 );
$chart->title = 'Title of a chart';
$chart->title->position = ezcGraph::BOTTOM;
@@ -112,7 +112,7 @@ class ezcGraphTextTest extends ezcTestCase
public function testRenderTextTopMargin()
{
$chart = ezcGraph::create( 'Line' );
- $chart->sample = array( 'foo' => 1, 'bar' => 10 );
+ $chart['sample'] = array( 'foo' => 1, 'bar' => 10 );
$chart->title = 'Title of a chart';
$chart->title->position = ezcGraph::TOP;
OpenPOWER on IntegriCloud