com.steema.teechart.functions
Class Average

java.lang.Object
  extended by com.steema.teechart.TeeBase
      extended by com.steema.teechart.functions.Function
          extended by com.steema.teechart.functions.Average
All Implemented Interfaces:
java.io.Serializable

public class Average
extends Function

Title: Average class

Description: Average (mean) Function.

Example:


 avgFunction = new com.steema.teechart.functions.Average();
 avgFunction.setChart(myChart.getChart());
 avgFunction.setPeriod(0); //all points
 avgFunction.setIncludeNulls(false);

 lineSeries.setDataSource(barSeries);
 lineSeries.setFunction(avgFunction);
 

Copyright (c) 2005-2008 by Steema Software SL. All Rights Reserved.

Company: Steema Software SL

See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.steema.teechart.functions.Function
canUsePeriod, dPeriod, HideSourceList, noSourceRequired, series, SingleSource, updating
 
Fields inherited from class com.steema.teechart.TeeBase
chart
 
Constructor Summary
Average()
          Initializes a new Average function, using Null values.
Average(boolean useNulls)
          If UseNulls is true, null values will be treated as zero in average calculation.
 
Method Summary
 double calculate(Series sourceSeries, int firstIndex, int lastIndex)
          Performs function operation on SourceSeries series.
First and Last parameters are ValueIndex of first and last point used in calculation.
 double calculateMany(java.util.ArrayList sourceSeriesList, int valueIndex)
          Performs function operation on list of series (SourceSeriesList).
The ValueIndex parameter defines ValueIndex of point in each Series in list.
 java.lang.String getDescription()
          Gets descriptive text.
 boolean getIncludeNulls()
          Calculates the average using only the non-null points of a series, or not.
 void setIncludeNulls(boolean value)
          Calculates the average using only the non-null points of a series, or not.
 
Methods inherited from class com.steema.teechart.functions.Function
addFunctionXY, addPoints, calculateAllPoints, calculateByPeriod, calculatePeriod, clear, doCalculation, getPeriod, getPeriodAlign, getPeriodStyle, getSeries, newInstance, readResolve, recalculate, setPeriod, setPeriodAlign, setPeriodStyle, setSeries, valueList
 
Methods inherited from class com.steema.teechart.TeeBase
getChart, invalidate, setBooleanProperty, setChart, setColorProperty, setColorProperty, setDoubleProperty, setIntegerProperty, setStringProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Average

public Average()
Initializes a new Average function, using Null values.


Average

public Average(boolean useNulls)
If UseNulls is true, null values will be treated as zero in average calculation.

Parameters:
useNulls - boolean
Method Detail

getIncludeNulls

public boolean getIncludeNulls()
Calculates the average using only the non-null points of a series, or not.

Returns:
boolean

setIncludeNulls

public void setIncludeNulls(boolean value)
Calculates the average using only the non-null points of a series, or not.

Parameters:
value - boolean

calculate

public double calculate(Series sourceSeries,
                        int firstIndex,
                        int lastIndex)
Performs function operation on SourceSeries series.
First and Last parameters are ValueIndex of first and last point used in calculation.
You can override Calculate function to perform customized calculation on one SourceSeries.

Overrides:
calculate in class Function
Parameters:
sourceSeries - Series
firstIndex - int
lastIndex - int
Returns:
double

calculateMany

public double calculateMany(java.util.ArrayList sourceSeriesList,
                            int valueIndex)
Performs function operation on list of series (SourceSeriesList).
The ValueIndex parameter defines ValueIndex of point in each Series in list.
You can override CalculateMany function to perform customized calculation on list of SourceSeries.

Overrides:
calculateMany in class Function
Parameters:
sourceSeriesList - ArrayList
valueIndex - int
Returns:
double

getDescription

public java.lang.String getDescription()
Gets descriptive text.

Overrides:
getDescription in class Function
Returns:
String