diff options
author | Kore Nordmann <github@kore-nordmann.de> | 2007-01-04 11:49:45 +0000 |
---|---|---|
committer | Kore Nordmann <github@kore-nordmann.de> | 2007-01-04 11:49:45 +0000 |
commit | 55315d4878f12829b900cb7d98f3d2e363bd5029 (patch) | |
tree | 1dac8e21b479f1e88b2d313e01f34cc236e55119 /docs | |
parent | 6dcb98c4e47b4f8ef728441521882fd08505367b (diff) | |
download | zetacomponents-graph-55315d4878f12829b900cb7d98f3d2e363bd5029.zip zetacomponents-graph-55315d4878f12829b900cb7d98f3d2e363bd5029.tar.gz |
- Added numeric dataset example to tutorial
Diffstat (limited to 'docs')
-rw-r--r-- | docs/img/tutorial_example_31.svg.png | bin | 0 -> 9839 bytes | |||
-rw-r--r-- | docs/tutorial.txt | 23 | ||||
-rw-r--r-- | docs/tutorial_example_31.php | 24 |
3 files changed, 47 insertions, 0 deletions
diff --git a/docs/img/tutorial_example_31.svg.png b/docs/img/tutorial_example_31.svg.png Binary files differnew file mode 100644 index 0000000..a25156c --- /dev/null +++ b/docs/img/tutorial_example_31.svg.png diff --git a/docs/tutorial.txt b/docs/tutorial.txt index edb4c78..e04c4b9 100644 --- a/docs/tutorial.txt +++ b/docs/tutorial.txt @@ -578,6 +578,29 @@ size of the matrix is equal to the point count of the used dataset. Be careful with data sets with large point count. Because this could mean that ezcGraph will consume a lot of memory and processing power. +Numeric dataset +--------------- + +Numeric datasets are used to represent mathematical function in your chart. You +use callbacks to PHP functions, own functions or methods which define the +mathematical function used to create the data set. + +.. include:: tutorial_example_31.php + :literal: + +The numeric data set constructor receives the start value, the end value for +the functions input and the function itself using PHPs `callback datatype`. In +this example we create a function on runtime using create_function() which +returns the name of the created function, which is a valid callback. The +code of the ceated function in line 16 returns sinus values for the input in +degree. + +__ http://php.net/manual/en/language.pseudo-types.php + +The resolution set in line 20 defines the numer of steps used to interpolate +the function in your graph. You should not use a bigger number then the width +of your chart here. + Renderer ======== diff --git a/docs/tutorial_example_31.php b/docs/tutorial_example_31.php new file mode 100644 index 0000000..ac3fcaa --- /dev/null +++ b/docs/tutorial_example_31.php @@ -0,0 +1,24 @@ +<?php + +require_once 'tutorial_autoload.php'; + +$graph = new ezcGraphLineChart(); +$graph->title = 'Sinus'; +$graph->legend->position = ezcGraph::BOTTOM; + +$graph->xAxis = new ezcGraphChartElementNumericAxis(); + +$graph->data['sinus'] = new ezcGraphNumericDataSet( + -360, // Start value + 360, // End value + create_function( + '$x', + 'return sin( deg2rad( $x ) );' + ) +); + +$graph->data['sinus']->resolution = 120; + +$graph->render( 400, 150, 'tutorial_example_31.svg' ); + +?> |