diff options
author | Kore Nordmann <github@kore-nordmann.de> | 2007-11-21 14:00:53 +0000 |
---|---|---|
committer | Kore Nordmann <github@kore-nordmann.de> | 2007-11-21 14:00:53 +0000 |
commit | 3129cc66ee5bda2ead9a1327333a62ba8901188d (patch) | |
tree | e623245e07b29f9385a952bd7b8141b8859080e8 /docs | |
parent | 8babf06ba2eb872e81d74c31e90dcf02cb003ed3 (diff) | |
download | zetacomponents-graph-3129cc66ee5bda2ead9a1327333a62ba8901188d.zip zetacomponents-graph-3129cc66ee5bda2ead9a1327333a62ba8901188d.tar.gz |
- Documented additional axis feature in tutorial
# The tutorial documentation of the new features should be complete now.
Diffstat (limited to 'docs')
-rw-r--r-- | docs/img/tutorial_line_chart_additional_axis.svg.png | bin | 0 -> 18277 bytes | |||
-rw-r--r-- | docs/img/tutorial_line_chart_markers.svg.png | bin | 0 -> 17421 bytes | |||
-rw-r--r-- | docs/tutorial.txt | 56 | ||||
-rw-r--r-- | docs/tutorial/tutorial_line_chart_additional_axis.php | 33 | ||||
-rw-r--r-- | docs/tutorial/tutorial_line_chart_markers.php | 23 |
5 files changed, 112 insertions, 0 deletions
diff --git a/docs/img/tutorial_line_chart_additional_axis.svg.png b/docs/img/tutorial_line_chart_additional_axis.svg.png Binary files differnew file mode 100644 index 0000000..4a759e5 --- /dev/null +++ b/docs/img/tutorial_line_chart_additional_axis.svg.png diff --git a/docs/img/tutorial_line_chart_markers.svg.png b/docs/img/tutorial_line_chart_markers.svg.png Binary files differnew file mode 100644 index 0000000..546fd75 --- /dev/null +++ b/docs/img/tutorial_line_chart_markers.svg.png diff --git a/docs/tutorial.txt b/docs/tutorial.txt index 5d33bb5..25d04c7 100644 --- a/docs/tutorial.txt +++ b/docs/tutorial.txt @@ -698,6 +698,62 @@ rotated labels like done in line 11 of the above example. The results conatins rotated labels, which enables you to pack a lot more labels on one axis. +Additional axis & markers +------------------------- + +Beside the x axis and the y axis you may add additional axis and markers to one +chart. Also you may assign those additional axis to datasets, so that some +datasets use different axis then others. + +Add markers to chart +~~~~~~~~~~~~~~~~~~~~ + +First add some markers to a chart, which only get a label, and reside at some +user defined position in the chart. You may use them to display data boundings +on the y axis, or important values on the x axis. + +.. include:: tutorial/tutorial_line_chart_markers.php + :literal: + +You can see a standard line chart, like in the examples before again using the +wikipedia datasets. In line 15 we add another axis, and configure this one in +the following lines. The position of an axis defines its origin, so that the +position ezcGraph::LEFT means, that the axis starts at the left side of the +graph. You may also use ezcGraph::RIGHT to let the axis start at the right. + +The position of the axis may be defined by a float value, which defines the +percentual position in the chart, calculated from the top left position. After +this we also define a label for the axis. + +.. image:: img/tutorial_line_chart_markers.svg.png + :alt: Line chart with marker + +Additional axis +~~~~~~~~~~~~~~~ + +As said before, you may not only add additional axis to one chart, but you can +also assigne datasets to use one of those new axis. This will cause the used +axis to caclulate its values depending on the assigned datasets and the data to +orientate at the new axis. + +The new axis may also be of a completely different type then the original chart +axis. + +.. include:: tutorial/tutorial_line_chart_additional_axis.php + :literal: + +In this chart we use a different axis, positioned at the very end of the chart, +for the norwegian wikipedia data. Due to the different scaling for the englsih +and norwegian data, you can easily see that the development of articles is very +similar, on a completely different level. + +To use the axis with some dataset, you need to assign the newly created axis to +one of the both axis properties to the data set. In this case we use the $yAxis +property - the property $xAxis of course also exists. + +.. image:: img/tutorial_line_chart_additional_axis.svg.png + :alt: Line chart with additional axis + Datasets ======== diff --git a/docs/tutorial/tutorial_line_chart_additional_axis.php b/docs/tutorial/tutorial_line_chart_additional_axis.php new file mode 100644 index 0000000..d06723a --- /dev/null +++ b/docs/tutorial/tutorial_line_chart_additional_axis.php @@ -0,0 +1,33 @@ +<?php + +require_once 'tutorial_autoload.php'; +$wikidata = include 'tutorial_wikipedia_data.php'; + +$graph = new ezcGraphLineChart(); +$graph->title = 'Wikipedia articles'; + +// Add data +foreach ( $wikidata as $language => $data ) +{ + $graph->data[$language] = new ezcGraphArrayDataSet( $data ); +} + +$graph->yAxis->min = 0; + +// Use a different axis for the norwegian dataset +$graph->additionalAxis['norwegian'] = $nAxis = new ezcGraphChartElementNumericAxis(); +$nAxis->position = ezcGraph::BOTTOM; +$nAxis->chartPosition = 1; +$nAxis->min = 0; + +$graph->data['Norwegian']->yAxis = $nAxis; + +// Still use the marker +$graph->additionalAxis['border'] = $marker = new ezcGraphChartElementNumericAxis(); + +$marker->position = ezcGraph::LEFT; +$marker->chartPosition = 1 / 3; + +$graph->render( 400, 150, 'tutorial_line_chart_additional_axis.svg' ); + +?> diff --git a/docs/tutorial/tutorial_line_chart_markers.php b/docs/tutorial/tutorial_line_chart_markers.php new file mode 100644 index 0000000..a11637f --- /dev/null +++ b/docs/tutorial/tutorial_line_chart_markers.php @@ -0,0 +1,23 @@ +<?php + +require_once 'tutorial_autoload.php'; +$wikidata = include 'tutorial_wikipedia_data.php'; + +$graph = new ezcGraphLineChart(); +$graph->title = 'Wikipedia articles'; + +// Add data +foreach ( $wikidata as $language => $data ) +{ + $graph->data[$language] = new ezcGraphArrayDataSet( $data ); +} + +$graph->additionalAxis['border'] = $marker = new ezcGraphChartElementNumericAxis( ); + +$marker->position = ezcGraph::LEFT; +$marker->chartPosition = 1 / 3; +$marker->label = 'One million!'; + +$graph->render( 400, 150, 'tutorial_line_chart_markers.svg' ); + +?> |