summaryrefslogtreecommitdiffstats
path: root/src/charts/pie.php
diff options
context:
space:
mode:
authorKore Nordmann <github@kore-nordmann.de>2006-08-14 12:50:28 +0000
committerKore Nordmann <github@kore-nordmann.de>2006-08-14 12:50:28 +0000
commit48155e33dd6901e3966d9b151d837bcbdc8e9968 (patch)
tree04fbae229bbf0a5bbea14d3e4da3f0bd976a4572 /src/charts/pie.php
parent21f7809f953a75b9e6214d0549a7f1941e3df7b9 (diff)
downloadzetacomponents-graph-48155e33dd6901e3966d9b151d837bcbdc8e9968.zip
zetacomponents-graph-48155e33dd6901e3966d9b151d837bcbdc8e9968.tar.gz
- Changed datsets to accept instances of ezcGraphDataSet only
- Added bar charts - Globally increase acceptable difference noise for created images in tests
Diffstat (limited to 'src/charts/pie.php')
-rw-r--r--src/charts/pie.php36
1 files changed, 27 insertions, 9 deletions
diff --git a/src/charts/pie.php b/src/charts/pie.php
index 4a23911..a832796 100644
--- a/src/charts/pie.php
+++ b/src/charts/pie.php
@@ -31,7 +31,7 @@ class ezcGraphPieChart extends ezcGraphChart
* If too many datasets are created
* @return ezcGraphDataSet
*/
- protected function addDataSet( $name, $values )
+ protected function addDataSet( $name, ezcGraphDataSet $values )
{
if ( count( $this->data ) >= 1 &&
!isset( $this->data[$name] ) )
@@ -67,18 +67,36 @@ class ezcGraphPieChart extends ezcGraphChart
$angle = 0;
foreach ( $dataset as $label => $value )
{
- $renderer->drawPieSegment(
- $boundings,
- $dataset->color[$label],
- $angle,
- $angle += $value / $sum * 360,
- sprintf( $this->options->label, $label, $value, $value / $sum * 100 ),
- $dataset->highlight[$label]
- );
+ switch( $dataset->displayType->default )
+ {
+ case ezcGraph::PIE:
+ $renderer->drawPieSegment(
+ $boundings,
+ $dataset->color[$label],
+ $angle,
+ $angle += $value / $sum * 360,
+ sprintf( $this->options->label, $label, $value, $value / $sum * 100 ),
+ $dataset->highlight[$label]
+ );
+ break;
+ default:
+ throw new ezcGraphInvalidDisplayTypeException( $dataset->displayType->default );
+ break;
+ }
}
}
/**
+ * Returns the default display type of the current chart type.
+ *
+ * @return int Display type
+ */
+ protected function getDefaultDisplayType()
+ {
+ return ezcGraph::PIE;
+ }
+
+ /**
* Render a pie chart
*
* @param ezcGraphRenderer $renderer
OpenPOWER on IntegriCloud