com.approximatrix.charting.model
Class EditableChartDataModel

java.lang.Object
  extended by com.approximatrix.charting.model.AbstractChartDataModel
      extended by com.approximatrix.charting.model.DefaultChartDataModel
          extended by com.approximatrix.charting.model.EditableChartDataModel
All Implemented Interfaces:
ChartDataModel
Direct Known Subclasses:
ScatterDataModel

public class EditableChartDataModel
extends DefaultChartDataModel

Implements an editable ChartModel. It uses a vector of DataSets and the columns are numeric.

Version:
1.0
Author:
mueller

Field Summary
 
Fields inherited from class com.approximatrix.charting.model.DefaultChartDataModel
columnSet, constraints1, constraints2, data, valuesbyaxis
 
Fields inherited from class com.approximatrix.charting.model.AbstractChartDataModel
autoscale, listener, manualscale, maxcolumn, maxvalue, mincolumn, minvalue
 
Constructor Summary
EditableChartDataModel()
          Creates a new empty EditableChartDataModel.
EditableChartDataModel(double[][] data, double[] columns, java.lang.String[] rows)
          Creates new EditableChartDataModel.
EditableChartDataModel(EditableDataSet[] ds)
          Creates a new EditableChartDataModel using the given array of EditableDataSets, effectively enabling the creation of DataModels with differently sized DataSets.
EditableChartDataModel(int[][] data, double[] columns, java.lang.String[] rows)
          Creates new EditableChartDataModel.
EditableChartDataModel(java.lang.Number[][] data, double[] columns, java.lang.String[] rows)
          Creates new EditableChartDataModel with the default axis binding.
 
Method Summary
 void insertValue(int set, java.lang.Object value, java.lang.Object column)
          Inserts a value together with its column value at the right position.
 void removeValueAt(int set, int index)
          Removes the value in a given DataSet.
 void setAxisBinding(int set, int axis)
          Sets the axis binding for a given DataSet.
 void setValueAt(int set, int index, java.lang.Object value)
          Sets the value in a given DataSet.
 
Methods inherited from class com.approximatrix.charting.model.DefaultChartDataModel
getAxisBinding, getChartDataModelConstraints, getColumnClass, getColumnValueAt, getColumnValueAt, getDataSetLength, getDataSetName, getDataSetNumber, getFirstColumnValue, getLastColumnValue, getOrderedValues, getValueAt, isColumnNumeric, setChartDataModelConstraints, trimSet
 
Methods inherited from class com.approximatrix.charting.model.AbstractChartDataModel
addChartDataModelListener, equals, fireChartDataModelChangedEvent, getManualMaximumColumnValue, getManualMaximumValue, getManualMinimumColumnValue, getManualMinimumValue, isAutoScale, isManualScale, removeChartDataModelListener, setAutoScale, setManualScale, setMaximumColumnValue, setMaximumValue, setMinimumColumnValue, setMinimumValue
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EditableChartDataModel

public EditableChartDataModel()
Creates a new empty EditableChartDataModel.


EditableChartDataModel

public EditableChartDataModel(java.lang.Number[][] data,
                              double[] columns,
                              java.lang.String[] rows)
Creates new EditableChartDataModel with the default axis binding.

Parameters:
data - the array of values. The first index specifies the datasets, the last one is the value index.
columns - the array of x-axis values. The length of the datasets and the length of the column should be equal and the columns should be ordered.
rows - the array of DataSet titles. It has to have the same length as the number of DataSets.

EditableChartDataModel

public EditableChartDataModel(int[][] data,
                              double[] columns,
                              java.lang.String[] rows)
Creates new EditableChartDataModel.

Parameters:
data - the array of values. The first index specifies the datasets, the last one is the value index.
columns - the array of x-axis values. The length of the datasets and the length of the column should be equal and the columns should be ordered.
rows - the array of DataSet titles. It has to have the same length as the number of DataSets.

EditableChartDataModel

public EditableChartDataModel(double[][] data,
                              double[] columns,
                              java.lang.String[] rows)
Creates new EditableChartDataModel.

Parameters:
data - the array of values. The first index specifies the datasets, the last one is the value index.
columns - the array of x-axis values. The length of the datasets and the length of the column should be equal and the columns should be ordered.
rows - the array of DataSet titles. It has to have the same length as the number of DataSets.

EditableChartDataModel

public EditableChartDataModel(EditableDataSet[] ds)
Creates a new EditableChartDataModel using the given array of EditableDataSets, effectively enabling the creation of DataModels with differently sized DataSets.

Parameters:
ds - the array of DataSets to be used.
Method Detail

setAxisBinding

public void setAxisBinding(int set,
                           int axis)
Sets the axis binding for a given DataSet.

Specified by:
setAxisBinding in interface ChartDataModel
Overrides:
setAxisBinding in class AbstractChartDataModel
Parameters:
set - the DataSet
axis - the Axis binding

setValueAt

public void setValueAt(int set,
                       int index,
                       java.lang.Object value)
Sets the value in a given DataSet.

Specified by:
setValueAt in interface ChartDataModel
Overrides:
setValueAt in class AbstractChartDataModel
Parameters:
set - the DataSet in which the value should be set
index - the index in the DataSet where the value should be stored
value - the value object

insertValue

public void insertValue(int set,
                        java.lang.Object value,
                        java.lang.Object column)
Inserts a value together with its column value at the right position. The right index is determined by performing a binary search on the columns in the DataSet. Fires a ChartDataModelChangedEvent.

Parameters:
set - the DataSet in which the value should be set
value - the value object
column - the column value object

removeValueAt

public void removeValueAt(int set,
                          int index)
Removes the value in a given DataSet.

Parameters:
set - the DataSet in which the value should be set
index - the index in the DataSet where the value should be stored