JIDE 3.5.15

com.jidesoft.chart.model
Class WaterfallModelAdapter

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

public class WaterfallModelAdapter
extends AbstractDelegatingChartModel

This class converts a waterfall model to a conventional chart model. A waterfall model is one in which the first and last points of the model are absolute values, whereas the (y) values in between are interpreted as differences, each y value being a difference from the previous y value.


Field Summary
static Highlight FALLING
           
static Highlight FIRST
           
static Highlight LAST
           
static Highlight RISING
           
 
Constructor Summary
WaterfallModelAdapter(ChartModel waterfallModel)
          Constructs a conventional ChartModel out of a waterfall model.
 
Method Summary
 Annotation getAnnotation(int n)
          Gets the nth annotation.
 int getAnnotationCount()
          Returns the number of annotations
 Chartable getPoint(int n)
          Gets the nth point.
 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.
 Iterator<Chartable> iterator()
          
 void setAnnotationsVisible(boolean visible)
          Specify whether annotations should be shown
protected  void update()
          Updates the points of this model based on the points of its delegate model
 
Methods inherited from class com.jidesoft.chart.model.AbstractDelegatingChartModel
addChartModelListener, chartModelChanged, equals, fireModelChanged, getDelegate, getDelegate, getDelegates, getName, hashCode, init, removeChartModelListener, setDelegate, setDelegates, setDelegates, setName
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FIRST

public static final Highlight FIRST

RISING

public static final Highlight RISING

FALLING

public static final Highlight FALLING

LAST

public static final Highlight LAST
Constructor Detail

WaterfallModelAdapter

public WaterfallModelAdapter(ChartModel waterfallModel)
Constructs a conventional ChartModel out of a waterfall model.

Parameters:
waterfallModel - a chart model in which the values are interpreted as waterfall values
Method Detail

update

protected void update()
Updates the points of this model based on the points of its delegate model

Specified by:
update in class AbstractDelegatingChartModel

getAnnotationCount

public int getAnnotationCount()
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)
Gets the nth annotation.

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

isAnnotationsVisible

public boolean isAnnotationsVisible()
Use this method to discover whether annotations should be shown or hidden.

Returns:
whether annotations should be shown

setAnnotationsVisible

public void setAnnotationsVisible(boolean visible)
Specify whether annotations should be shown

Parameters:
visible - whether annotations should be shown

getPoint

public Chartable getPoint(int n)
Gets the nth point. The first point has index 0.

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()
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

isCyclical

public boolean isCyclical()
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

iterator

public Iterator<Chartable> iterator()

Specified by:
iterator in interface Iterable<Chartable>
Overrides:
iterator in class AbstractDelegatingChartModel

JIDE 3.5.15