com.jrefinery.chart.data
Class MovingAveragePlotFitAlgorithm
java.lang.Object
|
+--com.jrefinery.chart.data.MovingAveragePlotFitAlgorithm
- All Implemented Interfaces:
- PlotFitAlgorithm
- public class MovingAveragePlotFitAlgorithm
- extends java.lang.Object
- implements PlotFitAlgorithm
Calculates a moving average for an XYDataset.
- Author:
- MW
Method Summary |
java.lang.String |
getName()
Returns the name that you want to see in the legend. |
java.lang.Number |
getY(int series,
java.lang.Number x)
Returns the y-value for any x-value. |
void |
setPeriod(int period)
Sets the period for this moving average algorithm. |
void |
setXYDataset(XYDataset ds)
This Algorithm might or might not need an XYDataset to be relevant. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MovingAveragePlotFitAlgorithm
public MovingAveragePlotFitAlgorithm()
getName
public java.lang.String getName()
- Description copied from interface:
PlotFitAlgorithm
- Returns the name that you want to see in the legend.
This is prepended to the series name that generated
this plot i.e. for "Chicago Moving Average" , the name
would be, "Moving Average" and "Chicago" would be the
name of the series that generated the moving average.
- Specified by:
getName
in interface PlotFitAlgorithm
- Returns:
- the name that you want to see in the legend.
setPeriod
public void setPeriod(int period)
- Sets the period for this moving average algorithm.
- Parameters:
period
- the number of points to include in the average.
setXYDataset
public void setXYDataset(XYDataset ds)
- Description copied from interface:
PlotFitAlgorithm
- This Algorithm might or might not need an XYDataset to be relevant.
- Specified by:
setXYDataset
in interface PlotFitAlgorithm
- Parameters:
ds
- the underlying XYDataset.
getY
public java.lang.Number getY(int series,
java.lang.Number x)
- Returns the y-value for any x-value.
- Specified by:
getY
in interface PlotFitAlgorithm
- Parameters:
x
- The x-value.series
- The series.- Returns:
- The y-value