summaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
authorKore Nordmann <github@kore-nordmann.de>2008-06-16 10:23:47 +0000
committerKore Nordmann <github@kore-nordmann.de>2008-06-16 10:23:47 +0000
commitcf3dde9ca8eb4e037ca1319273711c9477be9f07 (patch)
treedf2caea9cdc813e2b7869dcc13845cf4adf678b1 /docs
parent4e9f557a4b3c28a4f6bc0302eabb40d39b693579 (diff)
downloadzetacomponents-graph-cf3dde9ca8eb4e037ca1319273711c9477be9f07.zip
zetacomponents-graph-cf3dde9ca8eb4e037ca1319273711c9477be9f07.tar.gz
- Added cairo example to the tutorial
- Mention glyph support in the tutorial
Diffstat (limited to 'docs')
-rw-r--r--docs/img/tutorial_driver_cairo.pngbin0 -> 33101 bytes
-rw-r--r--docs/tutorial.txt46
-rw-r--r--docs/tutorial/tutorial_driver_cairo.php25
3 files changed, 54 insertions, 17 deletions
diff --git a/docs/img/tutorial_driver_cairo.png b/docs/img/tutorial_driver_cairo.png
new file mode 100644
index 0000000..d819743
--- /dev/null
+++ b/docs/img/tutorial_driver_cairo.png
Binary files differ
diff --git a/docs/tutorial.txt b/docs/tutorial.txt
index 5dc5338..fc862f1 100644
--- a/docs/tutorial.txt
+++ b/docs/tutorial.txt
@@ -1005,11 +1005,22 @@ simple pie chart rendered using this template.
The only drawback of SVG is that it is impossible to determine or define the
exact width of text strings. As a result, the driver can only estimate the size of
-text in the resulting image, which will sometimes fail slightly.
+text in the resulting image, which will sometimes fail slightly. Since the
+1.3 (2008.1) release you can work around this issue, by using the `Glyph support`_.
.. [1] Abobe SVG plugin: http://www.adobe.com/svg/viewer/install/main.html
.. [2] Corel SVG plugin: http://www.corel.com/servlet/Satellite?pagename=CorelCom/Layout&c=Content_C1&cid=1152796555406&lc=en
+Glyph support
+~~~~~~~~~~~~~
+
+Since version 1.3 (2008.1) you may set a SVG font to be used by the SVG driver,
+which will result in exact text width estimation using glyphs for the chracters
+in texts. SVG fonts may be created from TTF fonts using the ttf2svg command
+available in the `apache batik`__ package.
+
+__ http://xml.apache.org/batik/
+
Embedding SVG in HTML
~~~~~~~~~~~~~~~~~~~~~
@@ -1054,12 +1065,12 @@ Another alternative for embedding SVGs in your HTML would be to use iframes.
GD driver
---------
-The GD driver is, for now, the choice for generating bitmap images. It supports
+The GD driver is one of the choices for generating bitmap images. It supports
different font types, if available in your PHP installation, like True Type
-Fonts (using the FreeType 2 library or native TTF support) and PostScript
-Type 1 fonts. We use super sampling to enable basic anti aliasing in the GD
-driver, where the image is rendered twice as big and resized back to the
-requested size. This is used for all image primitives except text and images.
+Fonts (using the FreeType 2 library or native TTF support) and PostScript Type
+1 fonts. We use super sampling to enable basic anti aliasing in the GD driver,
+where the image is rendered twice as big and resized back to the requested
+size. This is used for all image primitives except text and images.
There are some drawbacks in the GD library that we have not been able to
overcome:
@@ -1080,6 +1091,29 @@ following example.
.. image:: img/tutorial_driver_gd.jpg
:alt: GD driver example jpeg
+Cairo driver
+------------
+
+ Cairo is a software library used to provide a vector graphics-based,
+ device-independent API for software developers. It is designed to provide
+ primitives for 2-dimensional drawing across a number of different
+ backends. Cairo is designed to use hardware acceleration when available.
+
+ .. Wikipedia
+
+Using the PHP extension `pecl/cairo_wrapper`__ and the driver class
+ezcGraphCairoDriver you can also create bitmaps with a far better quality then
+the GD driver, supporting all features required by the graph components with
+high quality anti aliasing.
+
+.. include:: tutorial/tutorial_driver_cairo.php
+ :literal:
+
+.. image:: img/tutorial_driver_cairo.jpg
+ :alt: Cairo driver example jpeg
+
+__ http://pecl.php.net/package/cairo_wrapper
+
Ming/Flash driver
-----------------
diff --git a/docs/tutorial/tutorial_driver_cairo.php b/docs/tutorial/tutorial_driver_cairo.php
index 37914fd..d4e6b2a 100644
--- a/docs/tutorial/tutorial_driver_cairo.php
+++ b/docs/tutorial/tutorial_driver_cairo.php
@@ -3,8 +3,12 @@
require_once 'tutorial_autoload.php';
$graph = new ezcGraphPieChart();
+$graph->palette = new ezcGraphPaletteEzBlue();
$graph->title = 'Access statistics';
-$graph->options->label = '%2$d (%3$.1f%%)';
+$graph->legend = false;
+
+// Set the cairo driver
+$graph->driver = new ezcGraphCairoDriver();
$graph->data['Access statistics'] = new ezcGraphArrayDataSet( array(
'Mozilla' => 19113,
@@ -13,24 +17,23 @@ $graph->data['Access statistics'] = new ezcGraphArrayDataSet( array(
'Safari' => 652,
'Konqueror' => 474,
) );
-$graph->data['Access statistics']->highlight['Explorer'] = true;
-$graph->data['Access statistics']->symbol = ezcGraph::BULLET;
$graph->renderer = new ezcGraphRenderer3d();
+$graph->renderer->options->pieChartGleam = .3;
+$graph->renderer->options->pieChartGleamColor = '#FFFFFF';
$graph->renderer->options->pieChartShadowSize = 5;
-$graph->renderer->options->pieChartShadowColor = ezcGraphColor::create( '#000000' );
-$graph->renderer->options->pieChartGleam = .5;
-$graph->renderer->options->dataBorder = false;
-$graph->renderer->options->pieChartHeight = 8;
-$graph->renderer->options->pieChartSymbolColor = '#888A8588';
-$graph->renderer->options->pieChartRotation = .8;
+$graph->renderer->options->pieChartShadowColor = '#000000';
+
$graph->renderer->options->legendSymbolGleam = .5;
$graph->renderer->options->legendSymbolGleamSize = .9;
$graph->renderer->options->legendSymbolGleamColor = '#FFFFFF';
-$graph->driver = new ezcGraphCairoDriver();
+$graph->renderer->options->pieChartSymbolColor = '#55575388';
+
+$graph->renderer->options->pieChartHeight = 5;
+$graph->renderer->options->pieChartRotation = .8;
-$graph->render( 400, 150, 'tutorial_driver_cairo.png' );
+$graph->render( 400, 300, 'tutorial_driver_cairo.png' );
?>
OpenPOWER on IntegriCloud