# Javascript Math Toolkit Function Graphing Engine Update Part II

What a difference a day and a half makes It’s been a while since I’ve been up well past midnight, coding. And, it feels really good.

The function graphing engine is coming along quite well. I mentioned auto-derivative evaluation and line decorators in the previous post on the graphing engine. The derivative evaluation uses a high-order central difference formula that is in-lined for performance reasons. It does not yet handle discontinuities in the first derivative and presumes continuous higher-order derivatives. I do have another derivative-evaluation method that can be used (Ridders’ method), but it is less suitable for many derivative evaluations in an interval. If necessary, I can always create a Chebyshev approximation to the original function and then differentiate the approximation.

Line decorators are integrated into the GraphLayer. Here is the addition to the code from the prior post to support a dashed-line plot of the derivative of the original function.

layer = new layerRef.GraphLayer(); layer.set_derivative(true); layer.set_function( f ); layer.set_decorator(layer.DASHED); layer.set_lineProperties( '#00ff00', 2 ); graph.addLayer( "COS", layer );

Line decorators are created just-in-time and then re-used from a pool for use cases where frequent switching of line decorators inside a layer is required.

Zooming and panning now work for the entire graph (grid and function layers).

The next task on the list, however, will take more time. I am now working on the library of pre-defined functions.