This class represents a mathematical curve (eg. a Sine curve), drawn onto the
graph as a line. To plot a curve, simply extend this class and implement the
func(double) method. For example, to plot a Sine curve:

Method Detail

createFunctionSeries

Return a FunctionLineSeries that uses the specifed method
as it's function. The method passed in must be public, static,
non-abstract, take a single double as an argument and return
a single double, and not throw any exceptions (other than the
implied RuntimeException. An example method meeting this
criteria would be Math.sin(double).

Parameters:

name - the name of the series

min - the minimum value to be plotted with this series

max - the maximum value to be plotted with this series

method - the method as described above

Throws:

IllegalArgumentException - if min>max or min or max is Infinite, or if the method
does not meet the requirements described above.

getLineSeries

setSteps

public void setSteps(int steps)

Set the number of steps to plot this curve in. By default the
curve is broken into 50 smaller line segments, but you can set
the number with this method - higher values give smoother curves
but take longer to plot.

func

public abstract double func(double x)

Given an X value, return the equivalent Y value of this function. The returned
value may be Double.NaN or infinite, and either of those values
will result in a gap in the line.

Parameters:

x - the X-value of the function - guaranteed not to be NaN or Infinite

Returns:

y the corresponding Y value

complete

public void complete()

Complete the function. This method is called after all the data
points are available to the graph, and can be overridden to calculate
the function based on the points in the graph. It is called automatically
by the library - subclasses overriding this method must always
call super.complete() first.