|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.faceless.graph2.Series
org.faceless.graph2.AbstractLineSeries
org.faceless.graph2.FunctionLineSeries
public abstract class FunctionLineSeries
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:
FunctionLineSeries sinecurve = new FunctionLineSeries("Sine", -Math.PI, Math.PI) { public double func(double x) { return Math.sin(x); } };
Constructor Summary | |
---|---|
FunctionLineSeries(String name,
double min,
double max)
Create a new FunctionLineSeries |
Method Summary | |
---|---|
void |
complete()
Complete the function. |
static FunctionLineSeries |
createFunctionSeries(String name,
double min,
double max,
Method method)
Return a FunctionLineSeries that uses the specifed method as it's function. |
abstract double |
func(double x)
Given an X value, return the equivalent Y value of this function. |
LineSeries |
getLineSeries()
Return the LineSeries set by the setLineSeries(org.faceless.graph2.LineSeries) method. |
void |
setLineSeries(LineSeries data)
Set the LineSeries that this function takes it's data from. |
void |
setSteps(int steps)
Set the number of steps to plot this curve in. |
Methods inherited from class org.faceless.graph2.AbstractLineSeries |
---|
setDepth |
Methods inherited from class org.faceless.graph2.Series |
---|
addBox, addLine, addMarker, getName, outputToSeries, outputToSeriesFunction, setStyle, toString |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public FunctionLineSeries(String name, double min, double max)
name
- the name of the seriesmin
- the minimum value to be plotted with this seriesmax
- the maximum value to be plotted with this series
IllegalArgumentException
- if min>max or min or max is InfiniteMethod Detail |
---|
public static FunctionLineSeries createFunctionSeries(String name, double min, double max, Method method)
RuntimeException
. An example method meeting this
criteria would be Math.sin(double)
.
name
- the name of the seriesmin
- the minimum value to be plotted with this seriesmax
- the maximum value to be plotted with this seriesmethod
- the method as described above
IllegalArgumentException
- if min>max or min or max is Infinite, or if the method
does not meet the requirements described above.public void setLineSeries(LineSeries data)
public LineSeries getLineSeries()
setLineSeries(org.faceless.graph2.LineSeries)
method.
public void setSteps(int steps)
public abstract double func(double x)
Double.NaN
or infinite, and either of those values
will result in a gap in the line.
x
- the X-value of the function - guaranteed not to be NaN or Infinite
public void complete()
super.complete()
first.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |