JIDE 3.5.15

com.jidesoft.chart.model
Class AverageChartModel

java.lang.Object
  extended by com.jidesoft.chart.model.AbstractDelegatingChartModel
      extended by com.jidesoft.chart.model.AverageChartModel
All Implemented Interfaces:
AnnotatedChartModel, AnnotationModel, ChartModel, ChartModelListener, Named, Iterable<Chartable>

public class AverageChartModel
extends AbstractDelegatingChartModel

A ChartModel that averages all the y values of its delegate that have the same x value.


Constructor Summary
AverageChartModel(AnnotatedChartModel[] delegates)
           
AverageChartModel(String name, AnnotatedChartModel[] delegates)
           
 
Method Summary
static Double average(List<Double> values)
           
 Annotation getAnnotation(int n)
          Gets the nth annotation.
 int getAnnotationCount()
          Returns the number of annotations
 Chartable getPoint(int n)
          Takes the (y axis) average of the nth points of the supplied chart models.
 int getPointCount()
          Gets the number of points in the data set
 boolean isAnnotationsVisible()
          Use this method to discover whether annotations should be shown or hidden.
 boolean isCyclical()
          Cyclical models are quite rare so we return a value of false here as a default.
 void setAnnotationsVisible(boolean visible)
          Specify whether annotations should be shown
protected  void update()
           
 
Methods inherited from class com.jidesoft.chart.model.AbstractDelegatingChartModel
addChartModelListener, chartModelChanged, equals, fireModelChanged, getDelegate, getDelegate, getDelegates, getName, hashCode, init, iterator, removeChartModelListener, setDelegate, setDelegates, setDelegates, setName
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AverageChartModel

public AverageChartModel(AnnotatedChartModel[] delegates)

AverageChartModel

public AverageChartModel(String name,
                         AnnotatedChartModel[] delegates)
Method Detail

getAnnotationCount

public int getAnnotationCount()
Description copied from interface: AnnotationModel
Returns the number of annotations

Specified by:
getAnnotationCount in interface AnnotationModel
Specified by:
getAnnotationCount in class AbstractDelegatingChartModel
Returns:
the number of annotations

getAnnotation

public Annotation getAnnotation(int n)
Description copied from interface: AnnotationModel
Gets the nth annotation.

Specified by:
getAnnotation in interface AnnotationModel
Specified by:
getAnnotation in class AbstractDelegatingChartModel
Parameters:
n - the index.
Returns:
the nth annotation

update

protected void update()
Specified by:
update in class AbstractDelegatingChartModel

average

public static Double average(List<Double> values)

getPoint

public Chartable getPoint(int n)
Takes the (y axis) average of the nth points of the supplied chart models. Note that this may not necessarily be what you expect.

Specified by:
getPoint in interface ChartModel
Specified by:
getPoint in class AbstractDelegatingChartModel
Parameters:
n - the index
Returns:
the nth point in the ChartModel.

getPointCount

public int getPointCount()
Description copied from interface: ChartModel
Gets the number of points in the data set

Specified by:
getPointCount in interface ChartModel
Specified by:
getPointCount in class AbstractDelegatingChartModel
Returns:
the number of points

isAnnotationsVisible

public boolean isAnnotationsVisible()
Description copied from interface: AnnotationModel
Use this method to discover whether annotations should be shown or hidden.

Returns:
whether annotations should be shown

setAnnotationsVisible

public void setAnnotationsVisible(boolean visible)
Description copied from interface: AnnotationModel
Specify whether annotations should be shown

Parameters:
visible - whether annotations should be shown

isCyclical

public boolean isCyclical()
Description copied from class: AbstractDelegatingChartModel
Cyclical models are quite rare so we return a value of false here as a default. Subclasses can override this if appropriate.

Specified by:
isCyclical in interface ChartModel
Overrides:
isCyclical in class AbstractDelegatingChartModel
Returns:
whether the model represents a cycle of values

JIDE 3.5.15