summaryrefslogtreecommitdiffstats
path: root/src/charts/pie.php
diff options
context:
space:
mode:
authorKore Nordmann <github@kore-nordmann.de>2006-08-15 09:37:47 +0000
committerKore Nordmann <github@kore-nordmann.de>2006-08-15 09:37:47 +0000
commit04e2d9db41d47bc0364261a1cb30fe502409c339 (patch)
tree5d67ca1c0433d8521671fcf3364e2f4030f0fdad /src/charts/pie.php
parent58808385c0739092503c32c35e9365335040d5d0 (diff)
downloadzetacomponents-graph-04e2d9db41d47bc0364261a1cb30fe502409c339.zip
zetacomponents-graph-04e2d9db41d47bc0364261a1cb30fe502409c339.tar.gz
- Changed access to datasets from $chart['dataset'] to $chart->data['dataset']
Diffstat (limited to 'src/charts/pie.php')
-rw-r--r--src/charts/pie.php34
1 files changed, 4 insertions, 30 deletions
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;
OpenPOWER on IntegriCloud