afreechart/src/main/java/org/afree/data/time/MovingAverage.java
/**
     * Creates a new {@link TimeSeriesCollection} containing a moving average
     * series for each series in the source collection.
     *
     * @param source  the source collection.
     * @param suffix  the suffix added to each source series name to create the
     *                corresponding moving average series name.
     * @param periodCount  the number of periods in the moving average
     *                     calculation.
     * @param skip  the number of initial periods to skip.
     *
     * @return A collection of moving average time series.
     */
Creates a new  TimeSeriesCollection containing a moving average
series for each series in the source collection.

@param source  the source collection.
@param suffix  the suffix added to each source series name to create the
corresponding moving average series name.
@param periodCount  the number of periods in the moving average
calculation.
@param skip  the number of initial periods to skip.

@return A collection of moving average time series.
Creates a new TimeSeriesCollection containing a moving average series for each series in the source collection . @param source the source collection . @param suffix the suffix added to each source series name to create the corresponding moving average series name . @param periodCount the number of periods in the moving average calculation . @param skip the number of initial periods to skip . @return A collection of moving average time series .
public static TimeSeriesCollection createMovingAverage(
            TimeSeriesCollection source, String suffix, int periodCount,
            int skip) {
        if (source == null) {
            throw new IllegalArgumentException("Null 'source' argument.");
        }
        if (periodCount < 1) {
            throw new IllegalArgumentException("periodCount must be greater "
                    + "than or equal to 1.");
        }
        TimeSeriesCollection result = new TimeSeriesCollection();
        for (int i = 0; i < source.getSeriesCount(); i++) {
            TimeSeries sourceSeries = source.getSeries(i);
            TimeSeries maSeries = createMovingAverage(sourceSeries,
                    sourceSeries.getKey() + suffix, periodCount, skip);
            result.addSeries(maSeries);
        }
        return result;
    }
public static TimeSeriesCollection createMovingAverage ( TimeSeriesCollection source , String suffix , int periodCount , int skip ) { if ( source == null ) { throw new IllegalArgumentException ( "Null 'source' argument." ) ; } if ( periodCount < 1 ) { throw new IllegalArgumentException ( "periodCount must be greater " + "than or equal to 1." ) ; } TimeSeriesCollection result = new TimeSeriesCollection ( ) ; for ( int i = 0 ; i < source . getSeriesCount ( ) ; i ++ ) { TimeSeries sourceSeries = source . getSeries ( i ) ; TimeSeries maSeries = createMovingAverage ( sourceSeries , sourceSeries . getKey ( ) + suffix , periodCount , skip ) ; result . addSeries ( maSeries ) ; } return result ; }
Creates a new {@link TimeSeriesCollection} containing a moving average
 series for each series in the source collection.
Creates a new { @link TimeSeriesCollection } containing a moving average series for each series in the source collection .