diff options
author | Kore Nordmann <github@kore-nordmann.de> | 2007-05-16 14:55:43 +0000 |
---|---|---|
committer | Kore Nordmann <github@kore-nordmann.de> | 2007-05-16 14:55:43 +0000 |
commit | d0e44a284a0fbd401e643ec71bdb007b2020c0c8 (patch) | |
tree | e6e6f390cee160e0b2757a4f33c9facdc5e12009 | |
parent | 0155557c5e0003b9199f34260c0b6ff99583ad6b (diff) | |
download | zetacomponents-graph-d0e44a284a0fbd401e643ec71bdb007b2020c0c8.zip zetacomponents-graph-d0e44a284a0fbd401e643ec71bdb007b2020c0c8.tar.gz |
- Added radar chart examples to the tutorial
-rw-r--r-- | docs/img/tutorial_complex_radar_chart.svg.png | bin | 0 -> 72733 bytes | |||
-rw-r--r-- | docs/img/tutorial_radar_chart.svg.png | bin | 0 -> 26220 bytes | |||
-rw-r--r-- | docs/tutorial.txt | 49 | ||||
-rw-r--r-- | docs/tutorial/tutorial_complex_radar_chart.php | 32 | ||||
-rw-r--r-- | docs/tutorial/tutorial_radar_chart.php | 19 |
5 files changed, 100 insertions, 0 deletions
diff --git a/docs/img/tutorial_complex_radar_chart.svg.png b/docs/img/tutorial_complex_radar_chart.svg.png Binary files differnew file mode 100644 index 0000000..bfd3005 --- /dev/null +++ b/docs/img/tutorial_complex_radar_chart.svg.png diff --git a/docs/img/tutorial_radar_chart.svg.png b/docs/img/tutorial_radar_chart.svg.png Binary files differnew file mode 100644 index 0000000..49e4ccf --- /dev/null +++ b/docs/img/tutorial_radar_chart.svg.png diff --git a/docs/tutorial.txt b/docs/tutorial.txt index 543a411..8896d16 100644 --- a/docs/tutorial.txt +++ b/docs/tutorial.txt @@ -215,6 +215,55 @@ line and bar charts. .. image:: img/tutorial_bar_options.svg.png :alt: Configured highlight in combined line and bar chart +Radar charts +------------ + +Radar charts are very similar to line charts, but only with one axis, which +will be drawn multiple times, rotated around the center point of the chart. + +.. include:: tutorial/tutorial_radar_chart.php + :literal: + +This again is one of the simplest ways to create a radar chart. Nearly all +options described later are also available in radar charts. The basic +difference is, that a ezcGraphRadarChart object is created in line 6. The +radar charts accept multiple data sets, like bar and line charts. In line 14 +the first element of the data set is reassigned as the last element to close +the circle. You may also not reassign this value to get a radar chart where +the tails do join. + +.. image:: img/tutorial_radar_chart.svg.png + :alt: Simple radar chart + +Controlling radar axis +~~~~~~~~~~~~~~~~~~~~~~ + +Instead of having a x and a y axis the radar chart has a main axis, which is +the aequivalent to the y axis in the other charts, and a rotation axis, the +aequivalent of the x axis. The steps on the rotation axis define the positions +of the rotated main axis. This way you may use all available data sets and +axis. + +.. include:: tutorial/tutorial_complex_radar_chart.php + :literal: + +The settings on the graph will be explained later in the tutorial in detail. +In line 11 the type of the rotation axis is set to a numeric axis, which is +explained in "Chart elements" -> "Axis". + +For line 15 to 23 a first data set is added with some random data. On the base +of this data a new data set is build which calculates a polynomial +interpolation function on the data. This is described in more detail in the +section "Datasets" -> "Average polynomial dataset". Finally the default colors +and symbols from the palette are modified. + +.. image:: img/tutorial_complex_radar_chart.svg.png + :alt: Complex radar chart + +The resulting radar chart shows how minor steps on the rotation axis are drawn +as grayed out axis and major steps as regular axis. It also obvious that all +types of data sets can be drawn using radar charts. + Palettes ======== diff --git a/docs/tutorial/tutorial_complex_radar_chart.php b/docs/tutorial/tutorial_complex_radar_chart.php new file mode 100644 index 0000000..e990cf9 --- /dev/null +++ b/docs/tutorial/tutorial_complex_radar_chart.php @@ -0,0 +1,32 @@ +<?php + +require_once 'tutorial_autoload.php'; +$wikidata = include 'tutorial_wikipedia_data.php'; + +$graph = new ezcGraphRadarChart(); +$graph->palette = new ezcGraphPaletteEzBlue(); +$graph->options->fillLines = 220; +$graph->legend->position = ezcGraph::BOTTOM; + +$graph->rotationAxis = new ezcGraphChartElementNumericAxis(); +$graph->rotationAxis->majorStep = 2; +$graph->rotationAxis->minorStep = .5; + +mt_srand( 5 ); +$data = array(); +for ( $i = 0; $i <= 10; $i++ ) +{ + $data[$i] = mt_rand( -5, 5 ); +} +$data[$i - 1] = reset( $data ); + +$graph->data['random data'] = $dataset = new ezcGraphArrayDataSet( $data ); + +$average = new ezcGraphDataSetAveragePolynom( $dataset, 4 ); +$graph->data[(string) $average->getPolynom()] = $average; +$graph->data[(string) $average->getPolynom()]->symbol = ezcGraph::NO_SYMBOL; +$graph->data[(string) $average->getPolynom()]->color = '#9CAE86'; + +$graph->render( 500, 250, 'tutorial_complex_radar_chart.svg' ); + +?> diff --git a/docs/tutorial/tutorial_radar_chart.php b/docs/tutorial/tutorial_radar_chart.php new file mode 100644 index 0000000..d10a1d7 --- /dev/null +++ b/docs/tutorial/tutorial_radar_chart.php @@ -0,0 +1,19 @@ +<?php + +require_once 'tutorial_autoload.php'; +$wikidata = include 'tutorial_wikipedia_data.php'; + +$graph = new ezcGraphRadarChart(); +$graph->title = 'Wikipedia articles'; +$graph->options->fillLines = 220; + +// Add data +foreach ( $wikidata as $language => $data ) +{ + $graph->data[$language] = new ezcGraphArrayDataSet( $data ); + $graph->data[$language][] = reset( $data ); +} + +$graph->render( 400, 150, 'tutorial_radar_chart.svg' ); + +?> |