Author: Kore Nordmann Date: 2007-01-04 12:49:45 +0100 (Thu, 04 Jan 2007) New Revision: 4467
Log: - Added numeric dataset example to tutorial Added: trunk/Graph/docs/img/tutorial_example_31.svg.png trunk/Graph/docs/tutorial_example_31.php Modified: trunk/Graph/docs/tutorial.txt Added: trunk/Graph/docs/img/tutorial_example_31.svg.png =================================================================== (Binary files differ) Property changes on: trunk/Graph/docs/img/tutorial_example_31.svg.png ___________________________________________________________________ Name: svn:mime-type + image/png Modified: trunk/Graph/docs/tutorial.txt =================================================================== --- trunk/Graph/docs/tutorial.txt 2007-01-04 11:25:39 UTC (rev 4466) +++ trunk/Graph/docs/tutorial.txt 2007-01-04 11:49:45 UTC (rev 4467) @@ -578,6 +578,29 @@ 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 ======== Added: trunk/Graph/docs/tutorial_example_31.php =================================================================== --- trunk/Graph/docs/tutorial_example_31.php 2007-01-04 11:25:39 UTC (rev 4466) +++ trunk/Graph/docs/tutorial_example_31.php 2007-01-04 11:49:45 UTC (rev 4467) @@ -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' ); + +?> Property changes on: trunk/Graph/docs/tutorial_example_31.php ___________________________________________________________________ Name: svn:eol-style + native -- svn-components mailing list svn-components@lists.ez.no http://lists.ez.no/mailman/listinfo/svn-components