diff options
author | Kore Nordmann <github@kore-nordmann.de> | 2006-12-07 14:47:30 +0000 |
---|---|---|
committer | Kore Nordmann <github@kore-nordmann.de> | 2006-12-07 14:47:30 +0000 |
commit | b18f980f00c730e679ab47a1d58afdd3b080f0c9 (patch) | |
tree | f48bcd9f934582660c9a487f7b65a8794d264edc /docs/examples/php_magazine.php | |
parent | 052165cca269587641656e9c9714343f2f5b3cf7 (diff) | |
download | zetacomponents-graph-b18f980f00c730e679ab47a1d58afdd3b080f0c9.zip zetacomponents-graph-b18f980f00c730e679ab47a1d58afdd3b080f0c9.tar.gz |
- Added example from PHP Magazine columne
Diffstat (limited to 'docs/examples/php_magazine.php')
-rw-r--r-- | docs/examples/php_magazine.php | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/docs/examples/php_magazine.php b/docs/examples/php_magazine.php new file mode 100644 index 0000000..ebf0066 --- /dev/null +++ b/docs/examples/php_magazine.php @@ -0,0 +1,45 @@ +<?php + +require 'Base/src/base.php'; +function __autoload( $className ) +{ + ezcBase::autoload( $className ); +} + +// Create the graph +$graph = new ezcGraphPieChart(); + +$graph->palette = new ezcGraphPaletteEzRed(); + +// Add the data and hilight norwegian data set +$graph->data['articles'] = new ezcGraphArrayDataSet( array( + 'English' => 1300000, + 'Germany' => 452000, + 'Netherlands' => 217000, + 'Norway' => 70000, +) ); +$graph->data['articles']->highlight['Germany'] = true; + +// Set graph title +$graph->title = 'Wikipedia articles by country'; + +// Modify pie chart label to only show amount and percent +$graph->options->label = '%2$d (%3$.1f%%)'; + +// Use 3d renderer, and beautify it +$graph->renderer = new ezcGraphRenderer3d(); + +$graph->renderer->options->pieChartShadowSize = 12; +$graph->renderer->options->pieChartGleam = .5; +$graph->renderer->options->dataBorder = false; + +$graph->renderer->options->pieChartHeight = 8; +$graph->renderer->options->pieChartRotation = .8; +$graph->renderer->options->pieChartOffset = 190; + +$graph->renderer->options->legendSymbolGleam = .5; + +// Output the graph with std SVG driver +$graph->render( 400, 200, 'wikipedia.svg' ); + +?> |