Package org.zkoss.chart.model
Class DefaultXYModel
- java.lang.Object
-
- org.zkoss.chart.model.AbstractChartsModel
-
- org.zkoss.chart.model.DefaultXYModel
-
- All Implemented Interfaces:
Serializable
,ChartsModel
,XYModel
- Direct Known Subclasses:
DefaultLowHighModel
,DefaultXYZModel
public class DefaultXYModel extends AbstractChartsModel implements XYModel
A XY data model implementation ofXYModel
. A XY model is an N series of (X, Y) data objects .- Author:
- jumperchen
- See Also:
XYModel
,Charts
, Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
DefaultXYModel.XYPair
-
Field Summary
Fields Modifier and Type Field Description protected List<Comparable<?>>
_seriesList
protected Map<Comparable<?>,List<DefaultXYModel.XYPair>>
_seriesMap
-
Fields inherited from class org.zkoss.chart.model.AbstractChartsModel
_listeners
-
-
Constructor Summary
Constructors Constructor Description DefaultXYModel()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addValue(Comparable<?> series, Number x, Number y)
Append an (x,y) into a series.void
addValue(Comparable<?> series, Number x, Number y, int index)
Add an (x,y) into a series at specified index.void
clear()
clear this model.Object
clone()
int
getDataCount(Comparable<?> series)
Get data count of a specified series.Collection<Comparable<?>>
getSeries()
Get all series as a collection.Comparable<?>
getSeries(int index)
Get a series of the specified index;Number
getX(Comparable<?> series, int index)
Get X value of a specified series and data index.Number
getY(Comparable<?> series, int index)
Get Y value of a specified series and data index.boolean
isAutoSort()
check whether to autosort on x value for each series; default is true.void
removeSeries(Comparable<?> series)
/** Remove data of a specified series.void
removeValue(Comparable<?> series, int index)
Remove (x,Y) value of a specified series and data index.void
setAutoSort(boolean auto)
Set model to autosort on x value for each series.void
setValue(Comparable<?> series, Number x, Number y, int index)
Replace the value of the new (x,y) into a series at specified index.-
Methods inherited from class org.zkoss.chart.model.AbstractChartsModel
addChartsDataListener, fireEvent, removeChartsDataListener
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.zkoss.chart.model.ChartsModel
addChartsDataListener, removeChartsDataListener
-
-
-
-
Field Detail
-
_seriesMap
protected Map<Comparable<?>,List<DefaultXYModel.XYPair>> _seriesMap
-
_seriesList
protected List<Comparable<?>> _seriesList
-
-
Method Detail
-
getSeries
public Comparable<?> getSeries(int index)
Description copied from interface:XYModel
Get a series of the specified index;
-
getSeries
public Collection<Comparable<?>> getSeries()
Description copied from interface:XYModel
Get all series as a collection.
-
getDataCount
public int getDataCount(Comparable<?> series)
Description copied from interface:XYModel
Get data count of a specified series.- Specified by:
getDataCount
in interfaceXYModel
- Parameters:
series
- the specified series.
-
getX
public Number getX(Comparable<?> series, int index)
Description copied from interface:XYModel
Get X value of a specified series and data index.
-
getY
public Number getY(Comparable<?> series, int index)
Description copied from interface:XYModel
Get Y value of a specified series and data index.
-
setValue
public void setValue(Comparable<?> series, Number x, Number y, int index)
Description copied from interface:XYModel
Replace the value of the new (x,y) into a series at specified index.
-
addValue
public void addValue(Comparable<?> series, Number x, Number y)
Description copied from interface:XYModel
Append an (x,y) into a series.
-
addValue
public void addValue(Comparable<?> series, Number x, Number y, int index)
Description copied from interface:XYModel
Add an (x,y) into a series at specified index.
-
setAutoSort
public void setAutoSort(boolean auto)
Description copied from interface:XYModel
Set model to autosort on x value for each series.- Specified by:
setAutoSort
in interfaceXYModel
-
isAutoSort
public boolean isAutoSort()
Description copied from interface:XYModel
check whether to autosort on x value for each series; default is true.- Specified by:
isAutoSort
in interfaceXYModel
-
removeSeries
public void removeSeries(Comparable<?> series)
Description copied from interface:XYModel
/** Remove data of a specified series.- Specified by:
removeSeries
in interfaceXYModel
- Parameters:
series
- the series
-
removeValue
public void removeValue(Comparable<?> series, int index)
Description copied from interface:XYModel
Remove (x,Y) value of a specified series and data index.- Specified by:
removeValue
in interfaceXYModel
- Parameters:
series
- the series.index
- the data index.
-
clear
public void clear()
Description copied from interface:XYModel
clear this model.
-
clone
public Object clone()
- Overrides:
clone
in classAbstractChartsModel
-
-