diff options
author | Kore Nordmann <github@kore-nordmann.de> | 2006-08-15 09:37:47 +0000 |
---|---|---|
committer | Kore Nordmann <github@kore-nordmann.de> | 2006-08-15 09:37:47 +0000 |
commit | 04e2d9db41d47bc0364261a1cb30fe502409c339 (patch) | |
tree | 5d67ca1c0433d8521671fcf3364e2f4030f0fdad | |
parent | 58808385c0739092503c32c35e9365335040d5d0 (diff) | |
download | zetacomponents-graph-04e2d9db41d47bc0364261a1cb30fe502409c339.zip zetacomponents-graph-04e2d9db41d47bc0364261a1cb30fe502409c339.tar.gz |
- Changed access to datasets from $chart['dataset'] to $chart->data['dataset']
-rw-r--r-- | src/charts/line.php | 2 | ||||
-rw-r--r-- | src/charts/pie.php | 34 | ||||
-rw-r--r-- | src/data_container/base.php | 215 | ||||
-rw-r--r-- | src/data_container/single.php | 46 | ||||
-rw-r--r-- | src/driver/svg.php | 1 | ||||
-rw-r--r-- | src/element/legend.php | 8 | ||||
-rw-r--r-- | src/graph_autoload.php | 3 | ||||
-rw-r--r-- | src/interfaces/chart.php | 65 | ||||
-rw-r--r-- | tests/axis_centered_renderer_test.php | 28 | ||||
-rw-r--r-- | tests/axis_exact_renderer_test.php | 28 | ||||
-rw-r--r-- | tests/dataset_test.php | 86 | ||||
-rw-r--r-- | tests/date_axis_test.php | 20 | ||||
-rw-r--r-- | tests/driver_svg_test.php | 4 | ||||
-rw-r--r-- | tests/font_test.php | 2 | ||||
-rw-r--r-- | tests/labeled_axis_test.php | 18 | ||||
-rw-r--r-- | tests/legend_test.php | 16 | ||||
-rw-r--r-- | tests/line_test.php | 44 | ||||
-rw-r--r-- | tests/numeric_axis_test.php | 36 | ||||
-rw-r--r-- | tests/palette_test.php | 24 | ||||
-rw-r--r-- | tests/pie_test.php | 18 | ||||
-rw-r--r-- | tests/renderer_2d_test.php | 126 | ||||
-rw-r--r-- | tests/renderer_3d_test.php | 72 | ||||
-rw-r--r-- | tests/text_test.php | 6 |
23 files changed, 533 insertions, 369 deletions
diff --git a/src/charts/line.php b/src/charts/line.php index db33938..02323e9 100644 --- a/src/charts/line.php +++ b/src/charts/line.php @@ -190,7 +190,7 @@ class ezcGraphLineChart extends ezcGraphChart * * @return int Display type */ - protected function getDefaultDisplayType() + public function getDefaultDisplayType() { return ezcGraph::LINE; } diff --git a/src/charts/pie.php b/src/charts/pie.php index a832796..3b38648 100644 --- a/src/charts/pie.php +++ b/src/charts/pie.php @@ -20,40 +20,14 @@ class ezcGraphPieChart extends ezcGraphChart $this->options = new ezcGraphPieChartOptions( $options ); parent::__construct( $options ); - } - - /** - * Adds a dataset to the charts data - * - * @param string $name Name of dataset - * @param mixed $values Values to create dataset with - * @throws ezcGraphTooManyDataSetExceptions - * If too many datasets are created - * @return ezcGraphDataSet - */ - protected function addDataSet( $name, ezcGraphDataSet $values ) - { - if ( count( $this->data ) >= 1 && - !isset( $this->data[$name] ) ) - { - throw new ezcGraphTooManyDataSetsExceptions( $name ); - } - else - { - parent::addDataSet( $name, $values ); - // Colorize each data element - foreach ( $this->data[$name] as $label => $value ) - { - $this->data[$name]->color[$label] = $this->palette->dataSetColor; - } - } + $this->data = new ezcGraphChartSingleDataContainer( $this ); } protected function renderData( $renderer, $boundings ) { // Only draw the first (and only) dataset - $dataset = reset( $this->data ); + $dataset = $this->data->rewind(); $this->driver->options->font = $this->options->font; @@ -91,7 +65,7 @@ class ezcGraphPieChart extends ezcGraphChart * * @return int Display type */ - protected function getDefaultDisplayType() + public function getDefaultDisplayType() { return ezcGraph::PIE; } @@ -110,7 +84,7 @@ class ezcGraphPieChart extends ezcGraphChart $this->driver->options->height = $height; // Generate legend - $this->elements['legend']->generateFromDataSet( reset( $this->data ) ); + $this->elements['legend']->generateFromDataSet( $this->data->rewind() ); // Get boundings from parameters $this->options->width = $width; diff --git a/src/data_container/base.php b/src/data_container/base.php new file mode 100644 index 0000000..38bc86c --- /dev/null +++ b/src/data_container/base.php @@ -0,0 +1,215 @@ +<?php +/** + * File containing the abstract ezcGraphChart 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 + */ +/** + * Class containing the container for the charts datasets + * + * @package Graph + */ + +class ezcGraphChartDataContainer implements ArrayAccess, Iterator, Countable +{ + /** + * Contains the data of a chart + * + * @var array( ezcGraphDataSet ) + */ + protected $data = array(); + + /** + * Chart using this data set storage + * + * @var ezcGraphChart + */ + protected $chart; + + public function __construct( ezcGraphChart $chart ) + { + $this->chart = $chart; + } + + /** + * Adds a dataset to the charts data + * + * @param string $name Name of dataset + * @param mixed $values Values to create dataset with + * @throws ezcGraphTooManyDataSetExceptions + * If too many datasets are created + * @return ezcGraphDataSet + */ + protected function addDataSet( $name, ezcGraphDataSet $dataSet ) + { + $this->data[$name] = $dataSet; + + $this->data[$name]->label = $name; + $this->data[$name]->palette = $this->chart->palette; + $this->data[$name]->displayType = $this->chart->getDefaultDisplayType(); + } + + /** + * Returns if the given offset exists. + * + * This method is part of the ArrayAccess interface to allow access to the + * data of this object as if it was an array. + * + * @param string $key Identifier of dataset. + * @return bool True when the offset exists, otherwise false. + */ + public function offsetExists( $key ) + { + return isset( $this->data[$key] ); + } + + /** + * Returns the element with the given offset. + * + * This method is part of the ArrayAccess interface to allow access to the + * data of this object as if it was an array. + * + * @param string $key Identifier of dataset. + * @return ezcGraphDataSet + * + * @throws ezcGraphNoSuchDataSetException + * If no dataset with identifier exists + */ + public function offsetGet( $key ) + { + if ( !isset( $key ) ) + { + throw new ezcGraphNoSuchDataSetException( $key ); + } + + return $this->data[$key]; + } + + /** + * Set the element with the given offset. + * + * This method is part of the ArrayAccess interface to allow access to the + * data of this object as if it was an array. + * + * @param string $key Identifier of dataset + * @param ezcGraphDataSet$value The dataset to assign. + * @return void + * + * @throws ezcGraphUnknownDataSetSourceException + * If supplied value is not an ezcGraphDataSet + */ + public function offsetSet( $key, $value ) + { + if ( !$value instanceof ezcGraphDataSet ) + { + throw new ezcGraphUnknownDataSetSourceException( $value ); + } + + return $this->addDataSet( $key, $value ); + } + + /** + * Unset the element with the given offset. + * + * This method is part of the ArrayAccess interface to allow access to the + * data of this object as if it was an array. + * + * @param int $offset The offset to unset the value for. + * @return void + */ + public function offsetUnset( $key ) + { + if ( !isset( $key ) ) + { + throw new ezcGraphNoSuchDataSetException( $key ); + } + + unset( $this->data[$key] ); + } + + /** + * Returns the currently selected dataset. + * + * This method is part of the Iterator interface to allow access to the + * datasets of this row by iterating over it like an array (e.g. using + * foreach). + * + * @return ezcGraphDataSet The currently selected dataset. + */ + public function current() + { + return current( $this->data ); + } + + /** + * Returns the next dataset and selects it or false on the last dataset. + * + * This method is part of the Iterator interface to allow access to the + * datasets of this row by iterating over it like an array (e.g. using + * foreach). + * + * @return mixed ezcGraphDataSet if the next dataset exists, or false. + */ + public function next() + { + return next( $this->data ); + } + + /** + * Returns the key of the currently selected dataset. + * + * This method is part of the Iterator interface to allow access to the + * datasets of this row by iterating over it like an array (e.g. using + * foreach). + * + * @return int The key of the currently selected dataset. + */ + public function key() + { + return key( $this->data ); + } + + /** + * Returns if the current dataset is valid. + * + * This method is part of the Iterator interface to allow access to the + * datasets of this row by iterating over it like an array (e.g. using + * foreach). + * + * @return bool If the current dataset is valid + */ + public function valid() + { + return ( current( $this->data ) !== false ); + } + + /** + * Selects the very first dataset and returns it. + * This method is part of the Iterator interface to allow access to the + * datasets of this row by iterating over it like an array (e.g. using + * foreach). + * + * @return ezcGraphDataSet The very first dataset. + */ + public function rewind() + { + return reset( $this->data ); + } + + /** + * Returns the number of datasets in the row. + * + * This method is part of the Countable interface to allow the usage of + * PHP's count() function to check how many datasets exist. + * + * @return int Number of datasets. + */ + public function count() + { + return count( $this->data ); + } +} +?> diff --git a/src/data_container/single.php b/src/data_container/single.php new file mode 100644 index 0000000..5167511 --- /dev/null +++ b/src/data_container/single.php @@ -0,0 +1,46 @@ +<?php +/** + * File containing the abstract ezcGraphChart 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 + */ +/** + * Class containing the container for the charts datasets + * + * @package Graph + */ + +class ezcGraphChartSingleDataContainer extends ezcGraphChartDataContainer +{ + /** + * Adds a dataset to the charts data + * + * @param string $name Name of dataset + * @param mixed $values Values to create dataset with + * @throws ezcGraphTooManyDataSetExceptions + * If too many datasets are created + * @return ezcGraphDataSet + */ + protected function addDataSet( $name, ezcGraphDataSet $dataSet ) + { + if ( count( $this->data ) >= 1 && + !isset( $this->data[$name] ) ) + { + throw new ezcGraphTooManyDataSetsExceptions( $name ); + } + else + { + parent::addDataSet( $name, $dataSet ); + + // Colorize each data element + foreach ( $this->data[$name] as $label => $value ) + { + $this->data[$name]->color[$label] = $this->chart->palette->dataSetColor; + } + } + } +} +?> diff --git a/src/driver/svg.php b/src/driver/svg.php index 53bb73c..2b5ff90 100644 --- a/src/driver/svg.php +++ b/src/driver/svg.php @@ -60,6 +60,7 @@ class ezcGraphSvgDriver extends ezcGraphDriver if ( $this->options->templateDocument !== false ) { $this->dom = new DOMDocument(); +// @TODO: Add $this->dom->format $this->dom->load( $this->options->templateDocument ); $this->defs = $this->dom->getElementsByTagName( 'defs' )->item( 0 ); diff --git a/src/element/legend.php b/src/element/legend.php index 952bfc1..8f0458c 100644 --- a/src/element/legend.php +++ b/src/element/legend.php @@ -117,10 +117,10 @@ class ezcGraphChartElementLegend extends ezcGraphChartElement * @param array $datasets * @return void */ - public function generateFromDataSets(array $datasets) + public function generateFromDataSets( ezcGraphChartDataContainer $datasets ) { $this->labels = array(); - foreach ($datasets as $dataset) + foreach ( $datasets as $dataset ) { $this->labels[] = array( 'label' => $dataset->label->default, @@ -138,10 +138,10 @@ class ezcGraphChartElementLegend extends ezcGraphChartElement * @param ezcGraphDataSet $dataset * @return void */ - public function generateFromDataSet(ezcGraphDataSet $dataset) + public function generateFromDataSet( ezcGraphDataSet $dataset ) { $this->labels = array(); - foreach ($dataset as $label => $data) + foreach ( $dataset as $label => $data ) { $this->labels[] = array( 'label' => $label, diff --git a/src/graph_autoload.php b/src/graph_autoload.php index 188a38a..f8a1693 100644 --- a/src/graph_autoload.php +++ b/src/graph_autoload.php @@ -22,6 +22,9 @@ return array( 'ezcGraphLineChartOptions' => 'Graph/options/line_chart.php', 'ezcGraphInvalidImageFileException' => 'Graph/exceptions/invalid_image_file.php', + 'ezcGraphChartDataContainer' => 'Graph/data_container/base.php', + 'ezcGraphChartSingleDataContainer' => 'Graph/data_container/single.php', + 'ezcGraphColor' => 'Graph/structs/color.php', 'ezcGraphUnknownColorDefinitionException' => 'Graph/exceptions/unknown_color_definition.php', diff --git a/src/interfaces/chart.php b/src/interfaces/chart.php index d87ad37..828a77b 100644 --- a/src/interfaces/chart.php +++ b/src/interfaces/chart.php @@ -12,7 +12,7 @@ * * @package Graph */ -abstract class ezcGraphChart implements ArrayAccess +abstract class ezcGraphChart { /** @@ -32,9 +32,9 @@ abstract class ezcGraphChart implements ArrayAccess /** * Contains the data of the chart * - * @var array( ezcGraphDataSet ) + * @var ezcGraphChartDataContainer */ - protected $data = array(); + protected $data; /** * Renderer for the chart @@ -68,6 +68,8 @@ abstract class ezcGraphChart implements ArrayAccess { $this->__set( 'palette', new ezcGraphPaletteTango() ); + $this->data = new ezcGraphChartDataContainer( $this ); + // Add standard elements $this->addElement( 'background', new ezcGraphChartElementBackground() ); $this->elements['background']->position = ezcGraph::CENTER | ezcGraph::MIDDLE; @@ -186,24 +188,6 @@ abstract class ezcGraphChart implements ArrayAccess } /** - * Adds a dataset to the charts data - * - * @param string $name Name of dataset - * @param mixed $values Values to create dataset with - * @throws ezcGraphTooManyDataSetExceptions - * If too many datasets are created - * @return ezcGraphDataSet - */ - protected function addDataSet( $name, ezcGraphDataSet $dataSet ) - { - $this->data[$name] = $dataSet; - - $this->data[$name]->label = $name; - $this->data[$name]->palette = $this->palette; - $this->data[$name]->displayType = $this->getDefaultDisplayType(); - } - - /** * Returns the requested property * * @param mixed $propertyName @@ -221,7 +205,7 @@ abstract class ezcGraphChart implements ArrayAccess return $this->elements[$propertyName]; } - if ( $propertyName === "options" ) + if ( $propertyName === 'options' ) { return $this->options; } @@ -231,41 +215,6 @@ abstract class ezcGraphChart implements ArrayAccess } } - 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 ) - { - if ( !$value instanceof ezcGraphDataSet ) - { - throw new ezcGraphUnknownDataSetSourceException( $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 ) { if ( is_array( $options ) ) @@ -287,7 +236,7 @@ abstract class ezcGraphChart implements ArrayAccess * * @return int Display type */ - abstract protected function getDefaultDisplayType(); + abstract public function getDefaultDisplayType(); /** * Renders this chart diff --git a/tests/axis_centered_renderer_test.php b/tests/axis_centered_renderer_test.php index 058664f..170e11c 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'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); + $chart->data['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); $mockedRenderer = $this->getMock( 'ezcGraphRenderer2d', array( 'drawGridLine', @@ -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'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); + $chart->data['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); $mockedRenderer = $this->getMock( 'ezcGraphRenderer2d', array( 'drawGridLine', @@ -120,7 +120,7 @@ class ezcGraphAxisCenteredRendererTest extends ezcTestCase $chart->palette = new ezcGraphPaletteBlack(); $chart->xAxis->axisLabelRenderer = new ezcGraphAxisCenteredLabelRenderer(); $chart->yAxis->axisLabelRenderer = new ezcGraphAxisNoLabelRenderer(); - $chart['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); + $chart->data['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); $mockedRenderer = $this->getMock( 'ezcGraphRenderer2d', array( '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'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); + $chart->data['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); $mockedRenderer = $this->getMock( 'ezcGraphRenderer2d', array( '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'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); + $chart->data['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); $mockedRenderer = $this->getMock( 'ezcGraphRenderer2d', array( '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'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); + $chart->data['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); $mockedRenderer = $this->getMock( 'ezcGraphRenderer2d', array( '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'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); + $chart->data['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); $mockedRenderer = $this->getMock( 'ezcGraphRenderer2d', array( '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'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); + $chart->data['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); $mockedRenderer = $this->getMock( 'ezcGraphRenderer2d', array( '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'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); + $chart->data['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); $mockedRenderer = $this->getMock( 'ezcGraphRenderer2d', array( 'drawGridLine', @@ -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'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); + $chart->data['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); $mockedRenderer = $this->getMock( 'ezcGraphRenderer2d', array( 'drawGridLine', @@ -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'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); + $chart->data['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); $mockedRenderer = $this->getMock( 'ezcGraphRenderer2d', array( 'drawGridLine', @@ -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'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); + $chart->data['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); $mockedRenderer = $this->getMock( 'ezcGraphRenderer2d', array( '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'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); + $chart->data['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); $mockedRenderer = $this->getMock( 'ezcGraphRenderer2d', array( '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'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); + $chart->data['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); $mockedRenderer = $this->getMock( 'ezcGraphRenderer2d', array( 'drawText', diff --git a/tests/axis_exact_renderer_test.php b/tests/axis_exact_renderer_test.php index 94dd622..34f08f2 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'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); + $chart->data['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); $mockedRenderer = $this->getMock( 'ezcGraphRenderer2d', array( 'drawGridLine', @@ -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'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); + $chart->data['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); $mockedRenderer = $this->getMock( 'ezcGraphRenderer2d', array( 'drawGridLine', @@ -200,7 +200,7 @@ class ezcGraphAxisExactRendererTest extends ezcTestCase $chart->palette = new ezcGraphPaletteBlack(); $chart->xAxis->axisLabelRenderer = new ezcGraphAxisExactLabelRenderer(); $chart->yAxis->axisLabelRenderer = new ezcGraphAxisNoLabelRenderer(); - $chart['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); + $chart->data['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); $mockedRenderer = $this->getMock( 'ezcGraphRenderer2d', array( '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'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); + $chart->data['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); $mockedRenderer = $this->getMock( 'ezcGraphRenderer2d', array( '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'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); + $chart->data['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); $mockedRenderer = $this->getMock( 'ezcGraphRenderer2d', array( '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'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); + $chart->data['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); $mockedRenderer = $this->getMock( 'ezcGraphRenderer2d', array( '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'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); + $chart->data['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); $mockedRenderer = $this->getMock( 'ezcGraphRenderer2d', array( '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'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); + $chart->data['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); $mockedRenderer = $this->getMock( 'ezcGraphRenderer2d', array( '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'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); + $chart->data['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); $mockedRenderer = $this->getMock( 'ezcGraphRenderer2d', array( 'drawGridLine', @@ -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'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); + $chart->data['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); $mockedRenderer = $this->getMock( 'ezcGraphRenderer2d', array( 'drawGridLine', @@ -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'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); + $chart->data['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); $mockedRenderer = $this->getMock( 'ezcGraphRenderer2d', array( 'drawGridLine', @@ -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'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); + $chart->data['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); $mockedRenderer = $this->getMock( 'ezcGraphRenderer2d', array( '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'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); + $chart->data['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); $mockedRenderer = $this->getMock( 'ezcGraphRenderer2d', array( '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'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); + $chart->data['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); $mockedRenderer = $this->getMock( 'ezcGraphRenderer2d', array( 'drawText', diff --git a/tests/dataset_test.php b/tests/dataset_test.php index 19b1981..edf712f 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'] = new ezcGraphArrayDataSet( array( 'monkey' => 54, 'ape' => 37, 'human' => 9 ) ); + $chart->data['humanoids'] = new ezcGraphArrayDataSet( array( 'monkey' => 54, 'ape' => 37, 'human' => 9 ) ); $datasets = $this->getAttribute( $chart, 'data' ); $this->assertTrue( @@ -56,10 +56,10 @@ class ezcGraphDataSetTest extends ezcTestCase public function testGetDataSet() { $chart = new ezcGraphPieChart(); - $chart['humanoids'] = new ezcGraphArrayDataSet( array( 'monkey' => 54, 'ape' => 37, 'human' => 9 ) ); + $chart->data['humanoids'] = new ezcGraphArrayDataSet( array( 'monkey' => 54, 'ape' => 37, 'human' => 9 ) ); $this->assertTrue( - $chart['humanoids'] instanceof ezcGraphDataSet, + $chart->data['humanoids'] instanceof ezcGraphDataSet, 'No ezcGraphDataSet was created.' ); } @@ -67,9 +67,9 @@ class ezcGraphDataSetTest extends ezcTestCase public function testDataSetContent() { $chart = new ezcGraphPieChart(); - $chart['example'] = new ezcGraphArrayDataSet( array( 'monkey' => 54, 2001 => 37 ) ); + $chart->data['example'] = new ezcGraphArrayDataSet( array( 'monkey' => 54, 2001 => 37 ) ); - $data = $this->getAttribute( $chart['example'], 'data' ); + $data = $this->getAttribute( $chart->data['example'], 'data' ); $this->assertSame( 54., @@ -84,8 +84,8 @@ class ezcGraphDataSetTest extends ezcTestCase public function testCreateMultipleDataSetsFromArray() { $chart = new ezcGraphLineChart(); - $chart['income'] = new ezcGraphArrayDataSet( array( 2000 => 2345.2, 2456.3, 2567.4 ) ); - $chart['spending'] = new ezcGraphArrayDataSet( array( 2000 => 2347.2, 2458.3, 2569.4 ) ); + $chart->data['income'] = new ezcGraphArrayDataSet( array( 2000 => 2345.2, 2456.3, 2567.4 ) ); + $chart->data['spending'] = new ezcGraphArrayDataSet( array( 2000 => 2347.2, 2458.3, 2569.4 ) ); $datasets = $this->getAttribute( $chart, 'data' ); $this->assertTrue( @@ -103,8 +103,8 @@ class ezcGraphDataSetTest extends ezcTestCase try { $chart = new ezcGraphPieChart(); - $chart['income'] = new ezcGraphArrayDataSet( array( 2000 => 2345.2, 2456.3, 2567.4 ) ); - $chart['spending'] = new ezcGraphArrayDataSet( array( 2000 => 2347.2, 2458.3, 2569.4 ) ); + $chart->data['income'] = new ezcGraphArrayDataSet( array( 2000 => 2345.2, 2456.3, 2567.4 ) ); + $chart->data['spending'] = new ezcGraphArrayDataSet( array( 2000 => 2347.2, 2458.3, 2569.4 ) ); } catch ( ezcGraphTooManyDataSetsExceptions $e ) { @@ -117,116 +117,116 @@ class ezcGraphDataSetTest extends ezcTestCase public function testDataSetLabel() { $chart = new ezcGraphPieChart(); - $chart['income'] = new ezcGraphArrayDataSet( array( 2000 => 2345.2, 2456.3, 2567.4 ) ); + $chart->data['income'] = new ezcGraphArrayDataSet( array( 2000 => 2345.2, 2456.3, 2567.4 ) ); $this->assertEquals( 'income', - $chart['income']->label->default + $chart->data['income']->label->default ); } public function testDataSetSetLabel() { $chart = new ezcGraphPieChart(); - $chart['income'] = new ezcGraphArrayDataSet( array( 2000 => 2345.2, 2456.3, 2567.4 ) ); - $chart['income']->label = 'Income Label'; + $chart->data['income'] = new ezcGraphArrayDataSet( array( 2000 => 2345.2, 2456.3, 2567.4 ) ); + $chart->data['income']->label = 'Income Label'; $this->assertEquals( 'Income Label', - $chart['income']->label->default + $chart->data['income']->label->default ); } public function testDataSetSetColor() { $chart = new ezcGraphPieChart(); - $chart['income'] = new ezcGraphArrayDataSet( array( 2000 => 2345.2, 2456.3, 2567.4 ) ); - $chart['income']->color = '#FF0000'; + $chart->data['income'] = new ezcGraphArrayDataSet( array( 2000 => 2345.2, 2456.3, 2567.4 ) ); + $chart->data['income']->color = '#FF0000'; $this->assertEquals( ezcGraphColor::fromHex( '#FF0000' ), - $chart['income']->color->default + $chart->data['income']->color->default ); } public function testDataSetSetHighlight() { $chart = new ezcGraphPieChart(); - $chart['income'] = new ezcGraphArrayDataSet( array( 2000 => 2345.2, 2456.3, 2567.4 ) ); - $chart['income']->highlight = true; + $chart->data['income'] = new ezcGraphArrayDataSet( array( 2000 => 2345.2, 2456.3, 2567.4 ) ); + $chart->data['income']->highlight = true; $this->assertEquals( true, - $chart['income']->highlight->default + $chart->data['income']->highlight->default ); } public function testDataSetGetHighlight() { $chart = new ezcGraphPieChart(); - $chart['income'] = new ezcGraphArrayDataSet( array( 2000 => 2345.2, 2456.3, 2567.4 ) ); + $chart->data['income'] = new ezcGraphArrayDataSet( array( 2000 => 2345.2, 2456.3, 2567.4 ) ); $this->assertEquals( false, - $chart['income']->highlight[2001] + $chart->data['income']->highlight[2001] ); $this->assertEquals( false, - $chart['income']->highlight->default + $chart->data['income']->highlight->default ); } public function testDataSetSetHighlightSingle() { $chart = new ezcGraphPieChart(); - $chart['income'] = new ezcGraphArrayDataSet( array( 2000 => 2345.2, 2456.3, 2567.4 ) ); - $chart['income']->highlight[2001] = true; + $chart->data['income'] = new ezcGraphArrayDataSet( array( 2000 => 2345.2, 2456.3, 2567.4 ) ); + $chart->data['income']->highlight[2001] = true; $this->assertEquals( false, - $chart['income']->highlight[2000] + $chart->data['income']->highlight[2000] ); $this->assertEquals( true, - $chart['income']->highlight[2001] + $chart->data['income']->highlight[2001] ); } public function testDataSetSetSingleColor() { $chart = new ezcGraphPieChart(); - $chart['income'] = new ezcGraphArrayDataSet( array( 2000 => 2345.2, 2456.3, 2567.4 ) ); - $chart['income']->color[2001] = '#FF0000'; + $chart->data['income'] = new ezcGraphArrayDataSet( array( 2000 => 2345.2, 2456.3, 2567.4 ) ); + $chart->data['income']->color[2001] = '#FF0000'; $this->assertEquals( ezcGraphColor::fromHex( '#FF0000' ), - $chart['income']->color[2001] + $chart->data['income']->color[2001] ); } public function testDataSetSetSingleSymbol() { $chart = new ezcGraphPieChart(); - $chart['income'] = new ezcGraphArrayDataSet( array( 2000 => 2345.2, 2456.3, 2567.4 ) ); - $chart['income']->symbol[2001] = ezcGraph::DIAMOND; + $chart->data['income'] = new ezcGraphArrayDataSet( array( 2000 => 2345.2, 2456.3, 2567.4 ) ); + $chart->data['income']->symbol[2001] = ezcGraph::DIAMOND; $this->assertEquals( ezcGraph::DIAMOND, - $chart['income']->symbol[2001] + $chart->data['income']->symbol[2001] ); } public function testDataSetPropertyValueFallback() { $chart = new ezcGraphPieChart(); - $chart['income'] = new ezcGraphArrayDataSet( array( 2000 => 2345.2, 2456.3, 2567.4 ) ); - $chart['income']->symbol = ezcGraph::DIAMOND; + $chart->data['income'] = new ezcGraphArrayDataSet( array( 2000 => 2345.2, 2456.3, 2567.4 ) ); + $chart->data['income']->symbol = ezcGraph::DIAMOND; $this->assertEquals( ezcGraph::DIAMOND, - $chart['income']->symbol[2001] + $chart->data['income']->symbol[2001] ); } @@ -235,8 +235,8 @@ class ezcGraphDataSetTest extends ezcTestCase try { $chart = new ezcGraphPieChart(); - $chart['income'] = new ezcGraphArrayDataSet( array( 2000 => 2345.2, 2456.3, 2567.4 ) ); - $chart['income']->symbol[2006] = ezcGraph::DIAMOND; + $chart->data['income'] = new ezcGraphArrayDataSet( array( 2000 => 2345.2, 2456.3, 2567.4 ) ); + $chart->data['income']->symbol[2006] = ezcGraph::DIAMOND; } catch ( ezcGraphNoSuchDataException $e ) { @@ -249,23 +249,23 @@ class ezcGraphDataSetTest extends ezcTestCase public function testDataSetGetSingleData() { $chart = new ezcGraphPieChart(); - $chart['income'] = new ezcGraphArrayDataSet( array( 2000 => 2345.2, 2456.3, 2567.4 ) ); + $chart->data['income'] = new ezcGraphArrayDataSet( array( 2000 => 2345.2, 2456.3, 2567.4 ) ); $this->assertSame( 2345.2, - $chart['income'][2000] + $chart->data['income'][2000] ); } public function testDataSetSetSingleData() { $chart = new ezcGraphPieChart(); - $chart['income'] = new ezcGraphArrayDataSet( array( 2000 => 2345.2, 2456.3, 2567.4 ) ); - $chart['income'][2005] = 234.21; + $chart->data['income'] = new ezcGraphArrayDataSet( array( 2000 => 2345.2, 2456.3, 2567.4 ) ); + $chart->data['income'][2005] = 234.21; $this->assertSame( 234.21, - $chart['income'][2005] + $chart->data['income'][2005] ); } } diff --git a/tests/date_axis_test.php b/tests/date_axis_test.php index c6d3dae..4d9654a 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'] = new ezcGraphArrayDataSet( array( 10 => 12, 37 => 235, 43 => 17, 114 => 39 ) ); + $this->chart->data['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'] = new ezcGraphArrayDataSet( array( 10 => 12, 37 => 235, 43 => 17, 114 => 39 ) ); + $this->chart->data['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'] = new ezcGraphArrayDataSet( array( 10 => 12, 37 => 235, 43 => 17, 114 => 39 ) ); + $this->chart->data['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'] = new ezcGraphArrayDataSet( array( 10 => 12, 37 => 235, 43 => 17, 114 => 39 ) ); + $this->chart->data['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'] = new ezcGraphArrayDataSet( array( 30010 => 12, 30037 => 235, 30043 => 17, 30114 => 39 ) ); + $this->chart->data['some data'] = new ezcGraphArrayDataSet( array( 30010 => 12, 30037 => 235, 30043 => 17, 30114 => 39 ) ); $this->chart->render( 500, 200 ); $this->assertEquals( @@ -182,7 +182,7 @@ class ezcGraphDateAxisTest extends ezcTestCase public function testAutomagicScalingSingle3() { - $this->chart['some data'] = new ezcGraphArrayDataSet( array( + $this->chart->data['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, @@ -211,7 +211,7 @@ class ezcGraphDateAxisTest extends ezcTestCase public function testAutomagicScalingSingle4() { - $this->chart['some data'] = new ezcGraphArrayDataSet( array( + $this->chart->data['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, @@ -241,7 +241,7 @@ class ezcGraphDateAxisTest extends ezcTestCase public function testAutomagicScalingSingle5() { - $this->chart['some data'] = new ezcGraphArrayDataSet( array( + $this->chart->data['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, @@ -270,7 +270,7 @@ class ezcGraphDateAxisTest extends ezcTestCase public function testPositionLeft() { - $this->chart['some data'] = new ezcGraphArrayDataSet( array( + $this->chart->data['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, @@ -311,7 +311,7 @@ class ezcGraphDateAxisTest extends ezcTestCase public function testPositionRight() { - $this->chart['some data'] = new ezcGraphArrayDataSet( array( + $this->chart->data['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, diff --git a/tests/driver_svg_test.php b/tests/driver_svg_test.php index b6cdb2f..c1b5a13 100644 --- a/tests/driver_svg_test.php +++ b/tests/driver_svg_test.php @@ -828,7 +828,7 @@ class ezcGraphSvgDriverTest extends ezcTestCase $filename = $this->tempDir . __FUNCTION__ . '.svg'; $chart = new ezcGraphPieChart(); - $chart['sample'] = new ezcGraphArrayDataSet( array( + $chart->data['sample'] = new ezcGraphArrayDataSet( array( 'Mozilla' => 4375, 'IE' => 345, 'Opera' => 1204, @@ -853,7 +853,7 @@ class ezcGraphSvgDriverTest extends ezcTestCase $filename = $this->tempDir . __FUNCTION__ . '.svg'; $chart = new ezcGraphPieChart(); - $chart['sample'] = new ezcGraphArrayDataSet( array( + $chart->data['sample'] = new ezcGraphArrayDataSet( array( 'Mozilla' => 4375, 'IE' => 345, 'Opera' => 1204, diff --git a/tests/font_test.php b/tests/font_test.php index f9faa2c..ce0eb06 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'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); + $chart->data['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 8576e4d..55a1df1 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'] = new ezcGraphArrayDataSet( array( 2000 => 20, 70, 12, 130 ) ); + $chart->data['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'] = new ezcGraphArrayDataSet( array( 2000 => 1045, 1300, 1012, 1450 ) ); - $chart['sample2'] = new ezcGraphArrayDataSet( array( 2002 => 1270, 1170, 1610, 1370 ) ); + $chart->data['sample'] = new ezcGraphArrayDataSet( array( 2000 => 1045, 1300, 1012, 1450 ) ); + $chart->data['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'] = new ezcGraphArrayDataSet( array( 2000 => 1045, 2001 => 1300, 2004 => 1012, 2006 => 1450 ) ); - $chart['sample2'] = new ezcGraphArrayDataSet( array( 2001 => 1270, 1170, 1610, 1370, 1559 ) ); + $chart->data['sample'] = new ezcGraphArrayDataSet( array( 2000 => 1045, 2001 => 1300, 2004 => 1012, 2006 => 1450 ) ); + $chart->data['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'] = new ezcGraphArrayDataSet( array( 2000 => 1045, 1300, 1012, 1450 ) ); + $chart->data['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'] = new ezcGraphArrayDataSet( array( 2000 => 1045, 1300, 1012, 1450 ) ); + $chart->data['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'] = new ezcGraphArrayDataSet( array( 2000 => 1045, 1300, 1012, 1450 ) ); + $chart->data['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'] = new ezcGraphArrayDataSet( array( 2000 => 1045, 1300, 1012, 1450 ) ); + $chart->data['sample'] = new ezcGraphArrayDataSet( array( 2000 => 1045, 1300, 1012, 1450 ) ); $chart->xAxis->position = ezcGraph::BOTTOM; $chart->render( 500, 200 ); diff --git a/tests/legend_test.php b/tests/legend_test.php index bd43fed..1af1143 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->data['sampleData'] = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1); + $chart->data['sampleData']->color = '#0000FF'; + $chart->data['sampleData']->symbol = ezcGraph::DIAMOND; + $chart->data['moreData'] = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1); + $chart->data['moreData']->color = '#FF0000'; + $chart->data['evenMoreData'] = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1); + $chart->data['evenMoreData']->color = '#FF0000'; + $chart->data['evenMoreData']->label = 'Even more data'; } public function testFactoryLegend() diff --git a/tests/line_test.php b/tests/line_test.php index 013c4b3..f8424eb 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'] = 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) ); + $chart->data['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => -21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); + $chart->data['moreData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 112, 'sample 2' => 54, 'sample 3' => 12, 'sample 4' => -167, 'sample 5' => 329) ); + $chart->data['Even more data'] = new ezcGraphArrayDataSet( array( 'sample 1' => 300, 'sample 2' => -30, 'sample 3' => 220, 'sample 4' => 67, 'sample 5' => 450) ); } public function testElementGenerationLegend() @@ -98,8 +98,8 @@ 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; + $chart->data['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1 ) ); + $chart->data['sampleData']->displayType = ezcGraph::PIE; try { @@ -116,9 +116,9 @@ class ezcGraphLineChartTest extends ezcTestCase public function testRenderChartLines() { $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->data['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1 ) ); + $chart->data['sampleData']->color = '#CC0000'; + $chart->data['sampleData']->symbol = ezcGraph::DIAMOND; $mockedRenderer = $this->getMock( 'ezcGraphRenderer2d', array( 'drawDataLine', @@ -203,13 +203,13 @@ class ezcGraphLineChartTest extends ezcTestCase 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->data['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1 ) ); + $chart->data['sampleData']->color = '#CC0000'; + $chart->data['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; + $chart->data['sampleData2'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1 ) ); + $chart->data['sampleData2']->color = '#CC0000'; + $chart->data['sampleData2']->symbol = ezcGraph::DIAMOND; $mockedRenderer = $this->getMock( 'ezcGraphRenderer2d', array( 'drawBar', @@ -275,10 +275,10 @@ class ezcGraphLineChartTest extends ezcTestCase 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; + $chart->data['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1 ) ); + $chart->data['sampleData']->color = '#CC0000'; + $chart->data['sampleData']->symbol = ezcGraph::DIAMOND; + $chart->data['sampleData']->displayType = ezcGraph::BAR; $mockedRenderer = $this->getMock( 'ezcGraphRenderer2d', array( 'drawBar', @@ -348,7 +348,7 @@ class ezcGraphLineChartTest extends ezcTestCase public function testRenderChartFilledLines() { $chart = new ezcGraphLineChart(); - $chart['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => -46, 'sample 4' => 120, 'sample 5' => 100 ) ); + $chart->data['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; @@ -408,9 +408,9 @@ class ezcGraphLineChartTest extends ezcTestCase { $chart = new ezcGraphLineChart(); $chart->palette = new ezcGraphPaletteBlack(); - $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; + $chart->data['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); + $chart->data['sampleData']->symbol = ezcGraph::DIAMOND; + $chart->data['sampleData']->symbol['sample 3'] = ezcGraph::CIRCLE; $mockedRenderer = $this->getMock( 'ezcGraphRenderer2d', array( 'drawDataLine', diff --git a/tests/numeric_axis_test.php b/tests/numeric_axis_test.php index 6bb20ef..26ce3b7 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'] = new ezcGraphArrayDataSet( array( 2000 => 20, 70, 12, 130 ) ); + $chart->data['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'] = new ezcGraphArrayDataSet( array( 2000 => 1, 4.3, .2, 3.82 ) ); + $chart->data['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'] = new ezcGraphArrayDataSet( array( 2000 => -1.8, 4.3, .2, 3.82 ) ); + $chart->data['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'] = new ezcGraphArrayDataSet( array( 2000 => 1045, 1300, 1012, 1450 ) ); + $chart->data['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'] = new ezcGraphArrayDataSet( array( 2000 => 1045, 1300, 1012, 1450 ) ); - $chart['sample2'] = new ezcGraphArrayDataSet( array( 2000 => 1270, 1170, 1610, 1370 ) ); + $chart->data['sample'] = new ezcGraphArrayDataSet( array( 2000 => 1045, 1300, 1012, 1450 ) ); + $chart->data['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'] = new ezcGraphArrayDataSet( array( 2000 => 1045, 1300, 1012, 1450 ) ); + $chart->data['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'] = new ezcGraphArrayDataSet( array( 2000 => 1045, 1300, 1012, 1450 ) ); + $chart->data['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'] = new ezcGraphArrayDataSet( array( 2000 => 1045, 1300, 1012, 1450 ) ); + $chart->data['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'] = new ezcGraphArrayDataSet( array( 2000 => 1045, 1300, 1012, 1450 ) ); + $chart->data['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'] = new ezcGraphArrayDataSet( array( 2000 => 1045, 1300, 1012, 1450 ) ); + $chart->data['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'] = new ezcGraphArrayDataSet( array( 2000 => 1045, 1300, 1012, 1450 ) ); + $chart->data['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'] = new ezcGraphArrayDataSet( array( 2000 => 1045, 1300, 1012, 1450 ) ); + $chart->data['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'] = new ezcGraphArrayDataSet( array( 2000 => 1045, 1300, 1012, 1450 ) ); + $chart->data['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'] = new ezcGraphArrayDataSet( array( 2000 => -300, 1300, 1012, 1450 ) ); + $chart->data['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'] = 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->data['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => -21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); + $chart->data['moreData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 112, 'sample 2' => 54, 'sample 3' => 12, 'sample 4' => -167, 'sample 5' => 329) ); + $chart->data['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 7ec97bd..29c5b18 100644 --- a/tests/palette_test.php +++ b/tests/palette_test.php @@ -289,18 +289,18 @@ class ezcGraphPaletteTest extends ezcTestCase public function testDataSetAutomaticColorization() { $chart = new ezcGraphLineChart(); - $chart['income'] = new ezcGraphArrayDataSet( array( 2000 => 2345.2, 2456.3, 2567.4 ) ); - $chart['spending'] = new ezcGraphArrayDataSet( array( 2000 => 2347.2, 2458.3, 2569.4 ) ); + $chart->data['income'] = new ezcGraphArrayDataSet( array( 2000 => 2345.2, 2456.3, 2567.4 ) ); + $chart->data['spending'] = new ezcGraphArrayDataSet( array( 2000 => 2347.2, 2458.3, 2569.4 ) ); $this->assertEquals( ezcGraphColor::fromHex( '#3465A4' ), - $chart['income']->color->default, + $chart->data['income']->color->default, 'Wrong automatic color set.' ); $this->assertEquals( ezcGraphColor::fromHex( '#4E9A06' ), - $chart['spending']->color->default, + $chart->data['spending']->color->default, 'Wrong automatic color set.' ); } @@ -308,8 +308,8 @@ class ezcGraphPaletteTest extends ezcTestCase public function testChartBackground() { $chart = new ezcGraphLineChart(); - $chart['income'] = new ezcGraphArrayDataSet( array( 2000 => 2345.2, 2456.3, 2567.4 ) ); - $chart['spending'] = new ezcGraphArrayDataSet( array( 2000 => 2347.2, 2458.3, 2569.4 ) ); + $chart->data['income'] = new ezcGraphArrayDataSet( array( 2000 => 2345.2, 2456.3, 2567.4 ) ); + $chart->data['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'] = new ezcGraphArrayDataSet( array( 2000 => 2345.2, 2456.3, 2567.4 ) ); - $chart['spending'] = new ezcGraphArrayDataSet( array( 2000 => 2347.2, 2458.3, 2569.4 ) ); + $chart->data['income'] = new ezcGraphArrayDataSet( array( 2000 => 2345.2, 2456.3, 2567.4 ) ); + $chart->data['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'] = new ezcGraphArrayDataSet( array( 2000 => 2345.2, 2456.3, 2567.4 ) ); - $chart['spending'] = new ezcGraphArrayDataSet( array( 2000 => 2347.2, 2458.3, 2569.4 ) ); + $chart->data['income'] = new ezcGraphArrayDataSet( array( 2000 => 2345.2, 2456.3, 2567.4 ) ); + $chart->data['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'] = new ezcGraphArrayDataSet( array( 2000 => 2345.2, 2456.3, 2567.4 ) ); - $chart['spending'] = new ezcGraphArrayDataSet( array( 2000 => 2347.2, 2458.3, 2569.4 ) ); + $chart->data['income'] = new ezcGraphArrayDataSet( array( 2000 => 2345.2, 2456.3, 2567.4 ) ); + $chart->data['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 f0e77bf..a49f865 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'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1 ) ); + $chart->data['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->getAttribute( $chart->legend, 'labels' ); @@ -85,8 +85,8 @@ 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; + $chart->data['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1 ) ); + $chart->data['sampleData']->displayType = ezcGraph::LINE; try { @@ -103,7 +103,7 @@ class ezcGraphPieChartTest extends ezcImageTestCase public function testPieRenderPieSegments() { $chart = new ezcGraphPieChart(); - $chart['sample'] = new ezcGraphArrayDataSet( array( + $chart->data['sample'] = new ezcGraphArrayDataSet( array( 'Mozilla' => 4375, 'IE' => 345, 'Opera' => 1204, @@ -111,7 +111,7 @@ class ezcGraphPieChartTest extends ezcImageTestCase 'Safari' => 987, ) ); - $chart['sample']->highlight['wget'] = true; + $chart->data['sample']->highlight['wget'] = true; $mockedRenderer = $this->getMock( 'ezcGraphRenderer2d', array( 'drawPieSegment', @@ -182,9 +182,9 @@ class ezcGraphPieChartTest extends ezcImageTestCase $filename = $this->tempDir . __FUNCTION__ . '.png'; $chart = new ezcGraphPieChart(); - $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->data['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; + $chart->data['Skien']->highlight['Norwegian'] = true; $chart->driver = new ezcGraphGdDriver(); $chart->options->font = $this->basePath . 'font.ttf'; @@ -203,9 +203,9 @@ class ezcGraphPieChartTest extends ezcImageTestCase $filename = $this->tempDir . __FUNCTION__ . '.png'; $chart = new ezcGraphPieChart(); - $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->data['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; + $chart->data['Skien']->highlight['Norwegian'] = true; $chart->driver = new ezcGraphGdDriver(); $chart->options->font = $this->basePath . 'font.ttf'; diff --git a/tests/renderer_2d_test.php b/tests/renderer_2d_test.php index 80ba103..39c29b1 100644 --- a/tests/renderer_2d_test.php +++ b/tests/renderer_2d_test.php @@ -1159,22 +1159,16 @@ class ezcGraphRenderer2dTest extends ezcImageTestCase { $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 = '#0000FF'; - $chart['sampleData']->symbol = ezcGraph::DIAMOND; - $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'] = 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'; - - $datasets = array( - $chart['sampleData'], - $chart['moreData'], - $chart['evenMoreData'], - ); + $chart->data['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); + $chart->data['sampleData']->color = '#0000FF'; + $chart->data['sampleData']->symbol = ezcGraph::DIAMOND; + $chart->data['moreData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); + $chart->data['moreData']->color = '#FF0000'; + $chart->data['evenMoreData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); + $chart->data['evenMoreData']->color = '#00FF00'; + $chart->data['evenMoreData']->label = 'Even more data'; - $chart->legend->generateFromDataSets( $datasets ); + $chart->legend->generateFromDataSets( $chart->data ); $this->driver ->expects( $this->at( 0 ) ) @@ -1226,22 +1220,16 @@ class ezcGraphRenderer2dTest extends ezcImageTestCase { $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 = '#0000FF'; - $chart['sampleData']->symbol = ezcGraph::DIAMOND; - $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'] = 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'; - - $datasets = array( - $chart['sampleData'], - $chart['moreData'], - $chart['evenMoreData'], - ); + $chart->data['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); + $chart->data['sampleData']->color = '#0000FF'; + $chart->data['sampleData']->symbol = ezcGraph::DIAMOND; + $chart->data['moreData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); + $chart->data['moreData']->color = '#FF0000'; + $chart->data['evenMoreData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); + $chart->data['evenMoreData']->color = '#00FF00'; + $chart->data['evenMoreData']->label = 'Even more data'; - $chart->legend->generateFromDataSets( $datasets ); + $chart->legend->generateFromDataSets( $chart->data ); $this->driver ->expects( $this->at( 1 ) ) @@ -1284,22 +1272,16 @@ class ezcGraphRenderer2dTest extends ezcImageTestCase { $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 = '#0000FF'; - $chart['sampleData']->symbol = ezcGraph::DIAMOND; - $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'] = 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'; - - $datasets = array( - $chart['sampleData'], - $chart['moreData'], - $chart['evenMoreData'], - ); + $chart->data['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); + $chart->data['sampleData']->color = '#0000FF'; + $chart->data['sampleData']->symbol = ezcGraph::DIAMOND; + $chart->data['moreData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); + $chart->data['moreData']->color = '#FF0000'; + $chart->data['evenMoreData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); + $chart->data['evenMoreData']->color = '#00FF00'; + $chart->data['evenMoreData']->label = 'Even more data'; - $chart->legend->generateFromDataSets( $datasets ); + $chart->legend->generateFromDataSets( $chart->data ); $this->driver ->expects( $this->at( 0 ) ) @@ -1352,22 +1334,16 @@ class ezcGraphRenderer2dTest extends ezcImageTestCase { $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 = '#0000FF'; - $chart['sampleData']->symbol = ezcGraph::DIAMOND; - $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'] = 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'; - - $datasets = array( - $chart['sampleData'], - $chart['moreData'], - $chart['evenMoreData'], - ); + $chart->data['sampleData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); + $chart->data['sampleData']->color = '#0000FF'; + $chart->data['sampleData']->symbol = ezcGraph::DIAMOND; + $chart->data['moreData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); + $chart->data['moreData']->color = '#FF0000'; + $chart->data['evenMoreData'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); + $chart->data['evenMoreData']->color = '#00FF00'; + $chart->data['evenMoreData']->label = 'Even more data'; - $chart->legend->generateFromDataSets( $datasets ); + $chart->legend->generateFromDataSets( $chart->data ); $this->driver ->expects( $this->at( 1 ) ) @@ -1550,8 +1526,8 @@ class ezcGraphRenderer2dTest extends ezcImageTestCase $chart = new ezcGraphLineChart(); $chart->palette = new ezcGraphPaletteBlack(); - $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->data['Line 1'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); + $chart->data['Line 2'] = new ezcGraphArrayDataSet( array( 'sample 1' => 543, 'sample 2' => 234, 'sample 3' => 298, 'sample 4' => 5, 'sample 5' => 613) ); $chart->driver = new ezcGraphGdDriver(); $chart->options->font = $this->basePath . 'font.ttf'; @@ -1573,8 +1549,8 @@ class ezcGraphRenderer2dTest extends ezcImageTestCase $chart->palette = new ezcGraphPaletteBlack(); $chart->options->fillLines = 200; - $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->data['Line 1'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); + $chart->data['Line 2'] = new ezcGraphArrayDataSet( array( 'sample 1' => 543, 'sample 2' => 234, 'sample 3' => 298, 'sample 4' => 5, 'sample 5' => 613) ); $chart->driver = new ezcGraphGdDriver(); $chart->options->font = $this->basePath . 'font.ttf'; @@ -1596,12 +1572,12 @@ class ezcGraphRenderer2dTest extends ezcImageTestCase $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->data['Line 0'] = new ezcGraphArrayDataSet( array( 'sample 1' => 432, 'sample 2' => 43, 'sample 3' => 65, 'sample 4' => 97, 'sample 5' => 154) ); + $chart->data['Line 1'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); + $chart->data['Line 2'] = new ezcGraphArrayDataSet( array( 'sample 1' => 543, 'sample 2' => 234, 'sample 3' => 298, 'sample 4' => 5, 'sample 5' => 613) ); - $chart['Line 0']->displayType = ezcGraph::BAR; - $chart['Line 1']->displayType = ezcGraph::BAR; + $chart->data['Line 0']->displayType = ezcGraph::BAR; + $chart->data['Line 1']->displayType = ezcGraph::BAR; $chart->xAxis->axisLabelRenderer = new ezcGraphAxisBoxedLabelRenderer(); @@ -1625,8 +1601,8 @@ class ezcGraphRenderer2dTest extends ezcImageTestCase $chart->palette = new ezcGraphPaletteBlack(); $chart->options->fillLines = 200; - $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->data['Line 1'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => -151, 'sample 3' => 324, 'sample 4' => -120, 'sample 5' => 1) ); + $chart->data['Line 2'] = new ezcGraphArrayDataSet( array( 'sample 1' => 543, 'sample 2' => 234, 'sample 3' => 298, 'sample 4' => -5, 'sample 5' => -124) ); $chart->driver = new ezcGraphGdDriver(); $chart->options->font = $this->basePath . 'font.ttf'; @@ -1645,7 +1621,7 @@ class ezcGraphRenderer2dTest extends ezcImageTestCase $filename = $this->tempDir . __FUNCTION__ . '.png'; $chart = new ezcGraphPieChart(); - $chart['sample'] = new ezcGraphArrayDataSet( array( + $chart->data['sample'] = new ezcGraphArrayDataSet( array( 'Mozilla' => 4375, 'IE' => 345, 'Opera' => 1204, @@ -1653,7 +1629,7 @@ class ezcGraphRenderer2dTest extends ezcImageTestCase 'Safari' => 987, ) ); - $chart['sample']->highlight['Safari'] = true; + $chart->data['sample']->highlight['Safari'] = true; $chart->driver = new ezcGraphGdDriver(); $chart->options->font = $this->basePath . 'font.ttf'; @@ -1672,7 +1648,7 @@ class ezcGraphRenderer2dTest extends ezcImageTestCase $filename = $this->tempDir . __FUNCTION__ . '.png'; $chart = new ezcGraphPieChart(); - $chart['sample'] = new ezcGraphArrayDataSet( array( + $chart->data['sample'] = new ezcGraphArrayDataSet( array( 'Mozilla' => 4375, 'IE' => 345, 'Opera' => 1204, @@ -1701,7 +1677,7 @@ class ezcGraphRenderer2dTest extends ezcImageTestCase $filename = $this->tempDir . __FUNCTION__ . '.png'; $chart = new ezcGraphPieChart(); - $chart['sample'] = new ezcGraphArrayDataSet( array( + $chart->data['sample'] = new ezcGraphArrayDataSet( array( 'Mozilla' => 4375, 'IE' => 345, 'Opera' => 1204, diff --git a/tests/renderer_3d_test.php b/tests/renderer_3d_test.php index 5d93447..8b0074b 100644 --- a/tests/renderer_3d_test.php +++ b/tests/renderer_3d_test.php @@ -297,7 +297,7 @@ class ezcGraphRenderer3dTest extends ezcImageTestCase $filename = $this->tempDir . __FUNCTION__ . '.png'; $chart = new ezcGraphPieChart(); - $chart['sample'] = new ezcGraphArrayDataSet( array( + $chart->data['sample'] = new ezcGraphArrayDataSet( array( 'Mozilla' => 4375, 'IE' => 345, 'Opera' => 1204, @@ -305,7 +305,7 @@ class ezcGraphRenderer3dTest extends ezcImageTestCase 'Safari' => 987, ) ); - $chart['sample']->highlight['Safari'] = true; + $chart->data['sample']->highlight['Safari'] = true; $chart->renderer = new ezcGraphRenderer3d(); $chart->driver = new ezcGraphGdDriver(); @@ -325,7 +325,7 @@ class ezcGraphRenderer3dTest extends ezcImageTestCase $filename = $this->tempDir . __FUNCTION__ . '.png'; $chart = new ezcGraphPieChart(); - $chart['sample'] = new ezcGraphArrayDataSet( array( + $chart->data['sample'] = new ezcGraphArrayDataSet( array( 'Mozilla' => 4375, 'IE' => 345, 'Opera' => 1204, @@ -333,7 +333,7 @@ class ezcGraphRenderer3dTest extends ezcImageTestCase 'Safari' => 987, ) ); - $chart['sample']->highlight['Safari'] = true; + $chart->data['sample']->highlight['Safari'] = true; $chart->title = 'Pie chart title'; @@ -355,7 +355,7 @@ class ezcGraphRenderer3dTest extends ezcImageTestCase $filename = $this->tempDir . __FUNCTION__ . '.png'; $chart = new ezcGraphPieChart(); - $chart['sample'] = new ezcGraphArrayDataSet( array( + $chart->data['sample'] = new ezcGraphArrayDataSet( array( 'label 1' => 20, 'label 2' => 20, 'label 3' => 20, @@ -368,7 +368,7 @@ class ezcGraphRenderer3dTest extends ezcImageTestCase 'label 10' => 20, ) ); - $chart['sample']->highlight = true; + $chart->data['sample']->highlight = true; $chart->options->label = '%1$s'; $chart->legend = false; @@ -392,7 +392,7 @@ class ezcGraphRenderer3dTest extends ezcImageTestCase $filename = $this->tempDir . __FUNCTION__ . '.png'; $chart = new ezcGraphPieChart(); - $chart['sample'] = new ezcGraphArrayDataSet( array( + $chart->data['sample'] = new ezcGraphArrayDataSet( array( 'Mozilla' => 4375, 'IE' => 345, 'Opera' => 1204, @@ -400,7 +400,7 @@ class ezcGraphRenderer3dTest extends ezcImageTestCase 'Safari' => 987, ) ); - $chart['sample']->highlight['Safari'] = true; + $chart->data['sample']->highlight['Safari'] = true; $chart->renderer = new ezcGraphRenderer3d(); $chart->renderer->options->showSymbol = false; @@ -422,7 +422,7 @@ class ezcGraphRenderer3dTest extends ezcImageTestCase $filename = $this->tempDir . __FUNCTION__ . '.png'; $chart = new ezcGraphPieChart(); - $chart['sample'] = new ezcGraphArrayDataSet( array( + $chart->data['sample'] = new ezcGraphArrayDataSet( array( 'Mozilla' => 4375, 'IE' => 345, 'Opera' => 1204, @@ -430,7 +430,7 @@ class ezcGraphRenderer3dTest extends ezcImageTestCase 'Safari' => 987, ) ); - $chart['sample']->highlight['Safari'] = true; + $chart->data['sample']->highlight['Safari'] = true; $chart->renderer = new ezcGraphRenderer3d(); $chart->renderer->options->moveOut = .2; @@ -452,7 +452,7 @@ class ezcGraphRenderer3dTest extends ezcImageTestCase $filename = $this->tempDir . __FUNCTION__ . '.png'; $chart = new ezcGraphPieChart(); - $chart['sample'] = new ezcGraphArrayDataSet( array( + $chart->data['sample'] = new ezcGraphArrayDataSet( array( 'Mozilla' => 4375, 'IE' => 345, 'Opera' => 1204, @@ -460,7 +460,7 @@ class ezcGraphRenderer3dTest extends ezcImageTestCase 'Safari' => 987, ) ); - $chart['sample']->highlight['Safari'] = true; + $chart->data['sample']->highlight['Safari'] = true; $chart->renderer = new ezcGraphRenderer3d(); $chart->renderer->options->dataBorder = 0; @@ -482,7 +482,7 @@ class ezcGraphRenderer3dTest extends ezcImageTestCase $filename = $this->tempDir . __FUNCTION__ . '.png'; $chart = new ezcGraphPieChart(); - $chart['sample'] = new ezcGraphArrayDataSet( array( + $chart->data['sample'] = new ezcGraphArrayDataSet( array( 'Mozilla' => 4375, 'IE' => 345, 'Opera' => 1204, @@ -490,7 +490,7 @@ class ezcGraphRenderer3dTest extends ezcImageTestCase 'Safari' => 987, ) ); - $chart['sample']->highlight['Safari'] = true; + $chart->data['sample']->highlight['Safari'] = true; $chart->renderer = new ezcGraphRenderer3d(); $chart->renderer->options->pieChartHeight = 5; @@ -512,7 +512,7 @@ class ezcGraphRenderer3dTest extends ezcImageTestCase $filename = $this->tempDir . __FUNCTION__ . '.png'; $chart = new ezcGraphPieChart(); - $chart['sample'] = new ezcGraphArrayDataSet( array( + $chart->data['sample'] = new ezcGraphArrayDataSet( array( 'Mozilla' => 4375, 'IE' => 345, 'Opera' => 1204, @@ -520,7 +520,7 @@ class ezcGraphRenderer3dTest extends ezcImageTestCase 'Safari' => 987, ) ); - $chart['sample']->highlight['Safari'] = true; + $chart->data['sample']->highlight['Safari'] = true; $chart->renderer = new ezcGraphRenderer3d(); $chart->renderer->options->pieChartRotation = .3; @@ -542,9 +542,9 @@ class ezcGraphRenderer3dTest extends ezcImageTestCase $filename = $this->tempDir . __FUNCTION__ . '.png'; $chart = new ezcGraphPieChart(); - $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->data['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; + $chart->data['Skien']->highlight['Norwegian'] = true; $chart->driver = new ezcGraphGdDriver(); $chart->renderer = new ezcGraphRenderer3d(); @@ -566,8 +566,8 @@ class ezcGraphRenderer3dTest extends ezcImageTestCase $chart = new ezcGraphLineChart(); $chart->palette = new ezcGraphPaletteBlack(); - $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->data['Line 1'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); + $chart->data['Line 2'] = new ezcGraphArrayDataSet( array( 'sample 1' => 543, 'sample 2' => 234, 'sample 3' => 298, 'sample 4' => 5, 'sample 5' => 613) ); $chart->title = 'Line chart title'; @@ -591,8 +591,8 @@ class ezcGraphRenderer3dTest extends ezcImageTestCase $chart = new ezcGraphLineChart(); $chart->palette = new ezcGraphPaletteBlack(); - $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->data['Line 1'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); + $chart->data['Line 2'] = new ezcGraphArrayDataSet( array( 'sample 1' => 543, 'sample 2' => 234, 'sample 3' => 298, 'sample 4' => 5, 'sample 5' => 613) ); $chart->title = 'Line chart title'; @@ -617,8 +617,8 @@ class ezcGraphRenderer3dTest extends ezcImageTestCase $chart = new ezcGraphLineChart(); $chart->palette = new ezcGraphPaletteBlack(); - $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->data['Line 1'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); + $chart->data['Line 2'] = new ezcGraphArrayDataSet( array( 'sample 1' => 543, 'sample 2' => 234, 'sample 3' => 298, 'sample 4' => 5, 'sample 5' => 613) ); $chart->title = 'Line chart title'; $chart->title->maxHeight = .2; @@ -645,8 +645,8 @@ class ezcGraphRenderer3dTest extends ezcImageTestCase $chart->palette = new ezcGraphPaletteBlack(); $chart->options->fillLines = 200; - $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->data['Line 1'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); + $chart->data['Line 2'] = new ezcGraphArrayDataSet( array( 'sample 1' => 543, 'sample 2' => 234, 'sample 3' => 298, 'sample 4' => 5, 'sample 5' => 613) ); $chart->driver = new ezcGraphGdDriver(); $chart->renderer = new ezcGraphRenderer3d(); @@ -669,8 +669,8 @@ class ezcGraphRenderer3dTest extends ezcImageTestCase $chart->palette = new ezcGraphPaletteBlack(); $chart->options->fillLines = 200; - $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->data['Line 1'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => -151, 'sample 3' => 324, 'sample 4' => -120, 'sample 5' => 1) ); + $chart->data['Line 2'] = new ezcGraphArrayDataSet( array( 'sample 1' => 543, 'sample 2' => 234, 'sample 3' => 298, 'sample 4' => -5, 'sample 5' => -124) ); $chart->driver = new ezcGraphGdDriver(); $chart->renderer = new ezcGraphRenderer3d(); @@ -692,8 +692,8 @@ class ezcGraphRenderer3dTest extends ezcImageTestCase $chart = new ezcGraphLineChart(); $chart->palette = new ezcGraphPaletteBlack(); - $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->data['Line 1'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); + $chart->data['Line 2'] = new ezcGraphArrayDataSet( array( 'sample 1' => 543, 'sample 2' => 234, 'sample 3' => 298, 'sample 4' => 5, 'sample 5' => 613) ); $chart->driver = new ezcGraphGdDriver(); $chart->renderer = new ezcGraphRenderer3d(); @@ -717,8 +717,8 @@ class ezcGraphRenderer3dTest extends ezcImageTestCase $chart = new ezcGraphLineChart(); $chart->palette = new ezcGraphPaletteBlack(); - $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->data['Line 1'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); + $chart->data['Line 2'] = new ezcGraphArrayDataSet( array( 'sample 1' => 543, 'sample 2' => 234, 'sample 3' => 298, 'sample 4' => 5, 'sample 5' => 613) ); $chart->driver = new ezcGraphGdDriver(); $chart->renderer = new ezcGraphRenderer3d(); @@ -742,8 +742,8 @@ class ezcGraphRenderer3dTest extends ezcImageTestCase $chart = new ezcGraphLineChart(); $chart->palette = new ezcGraphPaletteBlack(); - $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->data['Line 1'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) ); + $chart->data['Line 2'] = new ezcGraphArrayDataSet( array( 'sample 1' => 543, 'sample 2' => 234, 'sample 3' => 298, 'sample 4' => 5, 'sample 5' => 613) ); $chart->driver = new ezcGraphGdDriver(); $chart->renderer = new ezcGraphRenderer3d(); @@ -765,7 +765,7 @@ class ezcGraphRenderer3dTest extends ezcImageTestCase $filename = $this->tempDir . __FUNCTION__ . '.png'; $chart = new ezcGraphPieChart(); - $chart['sample'] = new ezcGraphArrayDataSet( array( + $chart->data['sample'] = new ezcGraphArrayDataSet( array( 'Mozilla' => 4375, 'IE' => 345, 'Opera' => 1204, @@ -794,7 +794,7 @@ class ezcGraphRenderer3dTest extends ezcImageTestCase $filename = $this->tempDir . __FUNCTION__ . '.png'; $chart = new ezcGraphPieChart(); - $chart['sample'] = new ezcGraphArrayDataSet( array( + $chart->data['sample'] = new ezcGraphArrayDataSet( array( 'Mozilla' => 4375, 'IE' => 345, 'Opera' => 1204, diff --git a/tests/text_test.php b/tests/text_test.php index d2bfb34..8054c13 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'] = new ezcGraphArrayDataSet( array( 'foo' => 1, 'bar' => 10 ) ); + $chart->data['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'] = new ezcGraphArrayDataSet( array( 'foo' => 1, 'bar' => 10 ) ); + $chart->data['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'] = new ezcGraphArrayDataSet( array( 'foo' => 1, 'bar' => 10 ) ); + $chart->data['sample'] = new ezcGraphArrayDataSet( array( 'foo' => 1, 'bar' => 10 ) ); $chart->title = 'Title of a chart'; $chart->title->position = ezcGraph::TOP; |