Package org.jfree.data
Class MovingAverage
java.lang.Object
org.jfree.data.MovingAverage
public class MovingAverage extends Object
A utility class for calculating moving averages of time series data.
-
Constructor Summary
Constructors Constructor Description MovingAverage() -
Method Summary
Modifier and Type Method Description static TimeSeriesCollectioncreateMovingAverage(TimeSeriesCollection source, String suffix, int periodCount, int skip)Creates a newTimeSeriesCollectioncontaining a moving average series for each series in the source collection.static TimeSeriescreateMovingAverage(TimeSeries source, String name, int periodCount, int skip)Creates a newTimeSeriescontaining moving average values for the given series.static XYSeriescreateMovingAverage(XYDataset source, int series, String name, double period, double skip)Creates a newXYSeriescontaining the moving averages of one series in thesourcedataset.static XYSeriescreateMovingAverage(XYDataset source, int series, String name, long period, long skip)Deprecated.Use similar method with 'double' parameters.static XYDatasetcreateMovingAverage(XYDataset source, String suffix, double period, double skip)Creates a newXYDatasetcontaining the moving averages of each series in thesourcedataset.static XYDatasetcreateMovingAverage(XYDataset source, String suffix, long period, long skip)Creates a newXYDatasetcontaining the moving averages of each series in thesourcedataset.static TimeSeriescreatePointMovingAverage(TimeSeries source, String name, int pointCount)Creates a newTimeSeriescontaining moving average values for the given series, calculated by number of points (irrespective of the 'age' of those points).
-
Constructor Details
-
MovingAverage
public MovingAverage()
-
-
Method Details
-
createMovingAverage
public static TimeSeriesCollection createMovingAverage(TimeSeriesCollection source, String suffix, int periodCount, int skip)Creates a newTimeSeriesCollectioncontaining a moving average series for each series in the source collection.- Parameters:
source- the source collection.suffix- the suffix added to each source series name to create the corresponding moving average series name.periodCount- the number of periods in the moving average calculation.skip- the number of initial periods to skip.- Returns:
- A collection of moving average time series.
-
createMovingAverage
public static TimeSeries createMovingAverage(TimeSeries source, String name, int periodCount, int skip)Creates a newTimeSeriescontaining moving average values for the given series.If the series is empty (contains zero items), the result is an empty series.
- Parameters:
source- the source series.name- the name of the new series.periodCount- the number of periods used in the average calculation.skip- the number of initial periods to skip.- Returns:
- The moving average series.
-
createPointMovingAverage
Creates a newTimeSeriescontaining moving average values for the given series, calculated by number of points (irrespective of the 'age' of those points).If the series is empty (contains zero items), the result is an empty series.
Developed by Benoit Xhenseval (www.ObjectLab.co.uk).
- Parameters:
source- the source series.name- the name of the new series.pointCount- the number of POINTS used in the average calculation (not periods!)- Returns:
- The moving average series.
-
createMovingAverage
public static XYDataset createMovingAverage(XYDataset source, String suffix, long period, long skip)Creates a newXYDatasetcontaining the moving averages of each series in thesourcedataset.- Parameters:
source- the source dataset.suffix- the string to append to source series names to create target series names.period- the averaging period.skip- the length of the initial skip period.- Returns:
- The dataset.
-
createMovingAverage
public static XYDataset createMovingAverage(XYDataset source, String suffix, double period, double skip)Creates a newXYDatasetcontaining the moving averages of each series in thesourcedataset.- Parameters:
source- the source dataset.suffix- the string to append to source series names to create target series names.period- the averaging period.skip- the length of the initial skip period.- Returns:
- The dataset.
-
createMovingAverage
public static XYSeries createMovingAverage(XYDataset source, int series, String name, long period, long skip)Deprecated.Use similar method with 'double' parameters.Creates a newXYSeriescontaining the moving averages of one series in thesourcedataset.- Parameters:
source- the source dataset.series- the series index (zero based).name- the name for the new series.period- the averaging period.skip- the length of the initial skip period.- Returns:
- The dataset.
-
createMovingAverage
public static XYSeries createMovingAverage(XYDataset source, int series, String name, double period, double skip)Creates a newXYSeriescontaining the moving averages of one series in thesourcedataset.- Parameters:
source- the source dataset.series- the series index (zero based).name- the name for the new series.period- the averaging period.skip- the length of the initial skip period.- Returns:
- The dataset.
-