|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.jidesoft.chart.model.SortedChartModel
public class SortedChartModel
Sorts the points of a chart model in increasing order. Note that the underlying unsorted model remains unchanged, but this class presents a sorted wrapper for it so that, for example, an unordered scatter plot can be displayed as a line chart in which the line progresses left to right or top to bottom instead of a random squiggle.
The class allows you to specify an orientation for the sort, which means whether the sort is based on the x or the y values. If the orientation is horizontal the sort order is based on the y values and if the orientation is vertical the sort order is based on the x values (to understand the orientation consider sorting the bars of a bar chart).
Constructor Summary | |
---|---|
SortedChartModel()
Create an empty SortedChartModel. |
|
SortedChartModel(ChartModel delegate,
Orientation orientation)
Create a SortedChartModel as a ChartModel that wraps the delegate, and with the sort orientation (x or y) defined by the orientation parameter. |
|
SortedChartModel(ChartModel delegate,
Orientation orientation,
boolean sortIncreasing)
Create a SortedChartModel as a ChartModel that wraps the delegate, and with the sort orientation (x or y) defined by the orientation parameter. |
Method Summary | |
---|---|
void |
addChartModelListener(ChartModelListener listener)
Adds the supplied ChartModelListener as a listener to this model |
void |
chartModelChanged()
Forces a re-computation of the sort order and fires a change event. |
protected void |
fireModelChanged()
|
Annotation |
getAnnotation(int n)
Gets the nth annotation. |
int |
getAnnotationCount()
Returns the number of annotations |
ChartModel |
getDelegate()
Returns the underlying unsorted model |
Integer |
getDelegateIndex(int n)
Returns the index in the delegate model of the nth point of this model |
String |
getName()
returns the name of the model |
Orientation |
getOrientation()
Returns the orientation of the sort - vertical for x values and horizontal for y values |
Chartable |
getPoint(int n)
Returns the Chartable object for the nth point of this model |
int |
getPointCount()
Returns the number of points in the model |
boolean |
isAnnotationsVisible()
Use this method to discover whether annotations should be shown or hidden. |
boolean |
isCyclical()
Returns whether the model is cyclical |
boolean |
isSortIncreasing()
Returns a boolean to indicate whether the sort is increasing. |
Iterator<Chartable> |
iterator()
Returns an iterator over all the points of the model |
void |
removeChartModelListener(ChartModelListener listener)
Removes the supplied ChartModelListener from this class |
void |
setAnnotationsVisible(boolean visible)
Specify whether annotations should be shown |
void |
setDelegate(ChartModel delegate)
Specify the delegate model that is to be sorted |
void |
setOrientation(Orientation orientation)
Specify the orientation of the sort |
void |
setSortIncreasing(boolean sortIncreasing)
Specify the order of the sort |
void |
update()
Recomputes the sort order |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SortedChartModel()
public SortedChartModel(ChartModel delegate, Orientation orientation)
delegate
- the ChartModel to be sortedorientation
- the orientation of the sort; use vertical for x values and horizontal for y values.public SortedChartModel(ChartModel delegate, Orientation orientation, boolean sortIncreasing)
delegate
- the ChartModel to be sortedorientation
- the orientation of the sort; use vertical for x values and horizontal for y values.sortIncreasing
- Specify whether the sort should be for increasing or decreasing valuesMethod Detail |
---|
public Orientation getOrientation()
public void setOrientation(Orientation orientation)
orientation
- whether the sort is on x or y values (vertical for x values and horizontal for y values)public void setDelegate(ChartModel delegate)
delegate
- the model that is to be sortedpublic ChartModel getDelegate()
public boolean isSortIncreasing()
public void setSortIncreasing(boolean sortIncreasing)
sortIncreasing
- whether the sort is to increasing (true) or decreasing (false)public void addChartModelListener(ChartModelListener listener)
addChartModelListener
in interface ChartModel
listener
- the listener that will receive eventspublic void removeChartModelListener(ChartModelListener listener)
removeChartModelListener
in interface ChartModel
listener
- the listener that will no longer receive eventsprotected void fireModelChanged()
public void chartModelChanged()
chartModelChanged
in interface ChartModelListener
public Integer getDelegateIndex(int n)
n
- the index of the point in this model
public void update()
public String getName()
getName
in interface ChartModel
getName
in interface Named
public Chartable getPoint(int n)
getPoint
in interface ChartModel
n
- the index
public int getPointCount()
getPointCount
in interface ChartModel
public boolean isCyclical()
isCyclical
in interface ChartModel
public Iterator<Chartable> iterator()
iterator
in interface Iterable<Chartable>
public Annotation getAnnotation(int n)
AnnotationModel
getAnnotation
in interface AnnotationModel
n
- the index.
public int getAnnotationCount()
AnnotationModel
getAnnotationCount
in interface AnnotationModel
public boolean isAnnotationsVisible()
AnnotationModel
isAnnotationsVisible
in interface AnnotationModel
public void setAnnotationsVisible(boolean visible)
AnnotationModel
setAnnotationsVisible
in interface AnnotationModel
visible
- whether annotations should be shown
|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |