summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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