summaryrefslogtreecommitdiffstats
path: root/docs/examples
diff options
context:
space:
mode:
authorKore Nordmann <github@kore-nordmann.de>2006-09-08 09:42:23 +0000
committerKore Nordmann <github@kore-nordmann.de>2006-09-08 09:42:23 +0000
commit982561ba29c4324df471bbbf28d6c486c12e82bf (patch)
tree426c0ebb25b3c0a3b727322bcb4f66d2b10f2661 /docs/examples
parent9c9a40a30f9ec7dc384fb9a4f775dde6e41143c9 (diff)
downloadzetacomponents-graph-982561ba29c4324df471bbbf28d6c486c12e82bf.zip
zetacomponents-graph-982561ba29c4324df471bbbf28d6c486c12e82bf.tar.gz
- Added wikipedia example
Diffstat (limited to 'docs/examples')
-rw-r--r--docs/examples/wikipedia.php38
1 files changed, 38 insertions, 0 deletions
diff --git a/docs/examples/wikipedia.php b/docs/examples/wikipedia.php
new file mode 100644
index 0000000..3e3f0b5
--- /dev/null
+++ b/docs/examples/wikipedia.php
@@ -0,0 +1,38 @@
+<?php
+
+require 'Base/src/base.php';
+function __autoload( $className )
+{
+ ezcBase::autoload( $className );
+}
+
+// Create the graph
+$graph = new ezcGraphPieChart();
+
+// 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['Norway'] = true;
+
+// Set graph title
+$graph->title = '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 = 16;
+$graph->renderer->options->legendSymbolGleam = .5;
+$graph->renderer->options->pieChartOffset = 100;
+
+// Output the graph with std SVG driver
+$graph->render( 500, 200, 'wiki_graph.svg' );
+
OpenPOWER on IntegriCloud