I wrote a class library for function graphing and exploration (with several complex, interactive features) years ago that uses XML for most of the graphing setup. The library dealt with functions defined by a modest number of parameters whose values may change, but the basic functional representation is immutable.

A student might explore x^{2} + 3x + 2 over a variety of intervals, or may even study ax^{2} + bx + c, where the constants a, b, and c are interactively varied. The function is still defined, in advance, by a small, finite number of parameters.

My client recently wished to use this engine to explore functions that arise from physical simulations over time. The ‘function’ is not mathematically defined by a formula. Instead, its values are sampled over time. Data points are plotted either separately, or connected by lines. Two new low-level functions, ScatterPlot and LinePlot were introduced into the defined functions library and new methods were added to the function graphing class to allow data that ‘defines’ a function to be updated at runtime. New methods to adjust the graph range and tic increments were also added.

The function graphing engine now supports panning restrictions by quadrant. Many physical simulations are sampled over time intervals, so the graph x-coordinate is a time sample (always greater than or equal to zero). For simulations whose y-axis values are positive, restricting graph panning to the first quadrant is desirable. One or two-quadrant combination panning restrictions are now allowed in the function graph XML.

<learningObject id=”simulationGraph” class=”display.graphing.functions.FunctionPlot” x=”35″ y=”40″ width=”350″ height=”280″ display=”f1,f2,f3″ pannable=”true” **restrictPan=”quadrant:1″** >

Here’s a screenshot of the engine in action,

The modifications have been quite interesting, but would have been far more difficult without the extreme level of internal and external documentation generated for this complex class library. Over two years went by between modifications. So, think about the next person that comes along after your code is written.

It might be you 🙂

### Like this:

Like Loading...

*Related*