Javascript Math Toolkit Function Graphing Engine Update Part III


The Javascript Math Toolkit function graphing engine development continues to go well.  One of my near-term goals was to add seamless integration between the standalone function parser and graph layers.  This is accomplished by setting a Boolean flag to true when adding a function to a graph layer.

var layer = new layerRef.GraphLayer();
var parsed = __parser.parse(equation);
if( parsed )
  layer.set_function( __parser, true );
  layer.set_lineProperties( '#ffff00', 2 );
  graph.addLayer( "FREE", layer );

The following screen shot illustrates how to graph a freeform function whose description is obtained from an input field.


I’m also working on the pre-defined function library, which provides a mechanism to efficiently plot a variety of simple or complex functions (and derivatives).  Any library class may be copied and modified to produce another plotting method, even for non-functions such as circles.

Here is an example that shows an abs. value function a*|x| + b plotted below a complex step function.  The latter is defined by arbitrary functions over intervals.  Interval endpoints may be open or closed and are defined using an IntervalData class.


The goal for the function graphing engine is not to create the graphing engine to end all graphing engines.  Rather, it provides a robust architecture that can be forked and then modified to suit individual client needs.

After a few more function library classes, I’ll work on integrating interactive overlays, namely markers and slice tools.

Comments are closed.