public abstract class FunctionLineSeries extends AbstractLineSeries
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); } };
Modifier and Type | Field and Description |
---|---|
protected double |
maxx |
protected double |
minx |
Modifier | Constructor and Description |
---|---|
protected |
FunctionLineSeries(String name) |
|
FunctionLineSeries(String name,
double min,
double max)
Create a new FunctionLineSeries
|
Modifier and Type | Method and Description |
---|---|
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.
|
setDepth
addBox, addLine, addMarker, getName, outputToSeries, outputToSeriesFunction, setFloatingPointX, setFloatingPointY, setStyle, toString
protected FunctionLineSeries(String name)
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 seriesIllegalArgumentException
- if min>max or min or max is Infinitepublic 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 aboveIllegalArgumentException
- 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 Infinitepublic void complete()
super.complete()
first.Copyright © 2001-2016 Big Faceless Organization