|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectlt.monarch.chart.models.AbstractDataModel
lt.monarch.chart.models.StackedDataModel
public class StackedDataModel extends AbstractDataModel implements ChartDataModelListener
Stacked data model. On the first created StackDataModel You must to set the key, which will be used for stacking. All latter data models will use this stacking key. Here is the sample how to stack simple array data model:
ChartDataModel m1 = new ChartDataModel(2);
m1.add(new Double[] { 10d, 15d });
m1.add(new Double[] { 20d, 25d });
m1.add(new Double[] { 30d, 35d });
ChartDataModel m2 = new ChartDataModel(2);
m2.add(new Double[] { 10d, 150d });
m2.add(new Double[] { 20d, 250d });
m2.add(new Double[] { 30d, 350d });
model1 = new StackedDataModel(m1);
model2 = model1.setStackedModel(m2);
Stacking matrixes is a little bit tricky, since all values in the matrix will be stacked. All the
values in the data model are stored as double values.
NOTE: The stacking is performed either on KEY or VALUE columns, but EXTENT and further columns are not stacked.
| Modifier and Type | Field and Description |
|---|---|
protected ArrayDataModel |
array
Array data model instance |
protected lt.monarch.chart.models.StackedDataModel.SubValue |
bottomModel
Bottom model of the stack. |
protected DataColumnType |
keyType
Specifies what is the key type, i.e. |
protected MatrixDataModel |
matrix
Matrix data model instance |
protected DataModel |
model
Original data model |
protected boolean |
stackedByValue
Specifies if the models are stacked by value. |
protected lt.monarch.chart.models.StackedDataModel.SubValue |
topModel
Top model of the stack. |
| Fields inherited from class lt.monarch.chart.models.AbstractDataModel |
|---|
columns, data, dataListeners, dimensions, suspended |
| Constructor and Description |
|---|
StackedDataModel(DataModel dataModel)
Stacked data model constructor. |
StackedDataModel(DataModel dataModel,
DataColumnType keyType)
Stacked data model constructor. |
| Modifier and Type | Method and Description |
|---|---|
void |
dispose()
Disposes data model |
DataModelDimensions |
getAddressDimensions()
Address dimensions, which shows if the model is array or matrix. |
StackedDataModel |
getBottomModel()
Gets the bottom data model. |
java.lang.Double |
getBottomValueAt(DataColumnType type,
int index)
Returns bottom value from the array model according to the index of the current data model. |
java.lang.Double |
getBottomValueAt(DataColumnType type,
int row,
int column)
Returns bottom value from the array model according to the index of the current data model |
DataColumnType |
getKeyType()
Gets key type |
DataModel |
getModel()
Gets current model (not stacked) |
int |
getPointCount()
Counts the data model size. |
int |
getPointCount(MatrixDimensions dimension)
Gets the count of point in the specified dimension. |
StackedDataModel |
getTopModel()
Gets the top data model. |
java.lang.Object |
getValueAt(DataColumnType valType,
int index)
Gets the data value at the specified point. |
java.lang.Object |
getValueAt(DataColumnType valType,
int row,
int column)
Get value at specified point. |
int |
getValuesInPoint()
Gets the count of the data columns at each point in the data model. |
boolean |
hasColumn(DataColumnType type)
Returns flag showing if this data model contains column of the given type. |
boolean |
isStackedByValue()
Gets if the data model is stacked by value. |
void |
modelChanged(DataModelChangeEvent event)
|
void |
setKeyType(DataColumnType keyType)
Sets the stacking key type. |
void |
setStackedByValue(boolean stackedByValue)
Sets the stacking type. |
StackedDataModel |
setStackedModel(DataModel topModel)
Stacks the data model on the specified data model and returns the stacked top data model. |
void |
setValueAt(DataColumnType valType,
int row,
int column,
java.lang.Object value)
Sets value at the specified point. |
void |
setValueAt(DataColumnType valType,
int index,
java.lang.Object value)
Sets value at specified point. |
void |
unstackModel()
Unstacks data model, thus removes it from the stack setting bottom model to null and the top model in bottom model is set to null too. |
| Methods inherited from class lt.monarch.chart.models.AbstractDataModel |
|---|
addColumn, addListener, castToArray, castToMatrix, fireDataChanged, getColumns, removeListener, resumeListeners, setColumns, suspendListeners |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected DataModel model
protected ArrayDataModel array
protected MatrixDataModel matrix
protected lt.monarch.chart.models.StackedDataModel.SubValue bottomModel
protected lt.monarch.chart.models.StackedDataModel.SubValue topModel
protected boolean stackedByValue
protected DataColumnType keyType
| Constructor Detail |
|---|
public StackedDataModel(DataModel dataModel)
dataModel - top data model. Other data model will be stacked on top of it.
public StackedDataModel(DataModel dataModel,
DataColumnType keyType)
dataModel - top data model. Other data model will be stacked on top of it.keyType - data value type which is used as a key for stacking.| Method Detail |
|---|
public StackedDataModel setStackedModel(DataModel topModel)
topModel - model to stack on this model.public void unstackModel()
public DataModelDimensions getAddressDimensions()
DataModel
getAddressDimensions in interface DataModelgetAddressDimensions in class AbstractDataModelpublic int getValuesInPoint()
DataModel
getValuesInPoint in interface DataModelgetValuesInPoint in class AbstractDataModel
public java.lang.Object getValueAt(DataColumnType valType,
int index)
ArrayDataModel
getValueAt in interface ArrayDataModelvalType - data column type (KEY, VALUE and etc.)index - data value index in the data model
public void setValueAt(DataColumnType valType,
int index,
java.lang.Object value)
ArrayDataModel
setValueAt in interface ArrayDataModelvalType - data column type (KEY, VALUE and etc.)index - data value index in the data modelvalue - value to set
public java.lang.Double getBottomValueAt(DataColumnType type,
int index)
type - column type which value has to be turnedindex - index of the current data model valuepublic int getPointCount()
ArrayDataModel
getPointCount in interface ArrayDataModel
public java.lang.Object getValueAt(DataColumnType valType,
int row,
int column)
MatrixDataModel
getValueAt in interface MatrixDataModelvalType - data column typerow - row of the matrixcolumn - column of the matrix
public void setValueAt(DataColumnType valType,
int row,
int column,
java.lang.Object value)
MatrixDataModel
setValueAt in interface MatrixDataModelvalType - data column typerow - row number of the matrixcolumn - column number of the matrixvalue - value to set to the specified point
public java.lang.Double getBottomValueAt(DataColumnType type,
int row,
int column)
type - column type which value has to be turnedrow - row of the current data model valuecolumn - column of the current data model valuepublic int getPointCount(MatrixDimensions dimension)
MatrixDataModel
getPointCount in interface MatrixDataModeldimension - dimension of the matrixpublic StackedDataModel getBottomModel()
public StackedDataModel getTopModel()
public boolean isStackedByValue()
true)
or by index (false)public void setStackedByValue(boolean stackedByValue)
stackedByValue - the stacking type. True if stacked by value.public void setKeyType(DataColumnType keyType)
keyType - key value typepublic DataModel getModel()
public DataColumnType getKeyType()
public void modelChanged(DataModelChangeEvent event)
modelChanged in interface ChartDataModelListenerpublic void dispose()
DataModel
dispose in interface DataModeldispose in class AbstractDataModelpublic boolean hasColumn(DataColumnType type)
DataModel
hasColumn in interface DataModeltype - data column typetrue if column with the given type exists.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||