summaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
authorKore Nordmann <github@kore-nordmann.de>2007-01-04 11:08:14 +0000
committerKore Nordmann <github@kore-nordmann.de>2007-01-04 11:08:14 +0000
commit6dcb98c4e47b4f8ef728441521882fd08505367b (patch)
tree172a9710a3edc19b28621c0f7bce9f017a7eb4f3 /docs
parent097f99bcb85dc06ddd9c78b20c75cbb3363aa1a6 (diff)
downloadzetacomponents-graph-6dcb98c4e47b4f8ef728441521882fd08505367b.zip
zetacomponents-graph-6dcb98c4e47b4f8ef728441521882fd08505367b.tar.gz
- Resolved task #9910: Add "renderToOutput" example to Graph tutorial.
Diffstat (limited to 'docs')
-rw-r--r--docs/tutorial.txt16
-rw-r--r--docs/tutorial_example_30.php19
2 files changed, 35 insertions, 0 deletions
diff --git a/docs/tutorial.txt b/docs/tutorial.txt
index 9ca127d..edb4c78 100644
--- a/docs/tutorial.txt
+++ b/docs/tutorial.txt
@@ -895,6 +895,22 @@ generated bitmap`__.
__ img/tutorial_example_29.html
+Direct output
+=============
+
+By default a graph is rendered to a file, because you normally want to cache
+generated images. ezcGraph also provides a method for direct output of
+generated charts, but use this with caution.
+
+The ezcGraph::renderToOutput() method sends the correct Content-Type header
+for the selected output driver and writes the charts image data directly to
+the output. Pay attention not to output anything before using this method.
+
+.. include:: tutorial_example_30.php
+ :literal:
+
+This example renders the first graph of this tutorial.
+
More Information
================
diff --git a/docs/tutorial_example_30.php b/docs/tutorial_example_30.php
new file mode 100644
index 0000000..738c0e4
--- /dev/null
+++ b/docs/tutorial_example_30.php
@@ -0,0 +1,19 @@
+<?php
+
+require_once 'tutorial_autoload.php';
+
+$graph = new ezcGraphPieChart();
+$graph->title = 'Access statistics';
+
+$graph->data['Access statistics'] = new ezcGraphArrayDataSet( array(
+ 'Mozilla' => 19113,
+ 'Explorer' => 10917,
+ 'Opera' => 1464,
+ 'Safari' => 652,
+ 'Konqueror' => 474,
+) );
+$graph->data['Access statistics']->highlight['Opera'] = true;
+
+$graph->renderToOutput( 400, 150 );
+
+?>
OpenPOWER on IntegriCloud