summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docs/img/tutorial_example_31.svg.pngbin0 -> 9839 bytes
-rw-r--r--docs/tutorial.txt23
-rw-r--r--docs/tutorial_example_31.php24
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
new file mode 100644
index 0000000..a25156c
--- /dev/null
+++ b/docs/img/tutorial_example_31.svg.png
Binary files differ
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' );
+
+?>
OpenPOWER on IntegriCloud