com.approximatrix.charting.model
Interface ChartDataModel

All Known Implementing Classes:
AbstractChartDataModel, DefaultChartDataModel, EditableChartDataModel, MultiScatterDataModel, ObjectChartDataModel, ScatterDataModel

public interface ChartDataModel

This interface defines the methods to access chart data. It has to deal with several difficulties. The model is basically resembling a Swing table model. Furthermore, in the implementation it needs to be defined whether the datasets are organized in rows or in columns, whether the x-axis values are numeric etc. In order to layout certain components, there must be methods to return the maximum and minimum values.

A DataSet is a series of figures belonging together, whereas a column is the value printed at the x-axis. They can be rendered using specific Format classes.

Version:
1.0
Author:
mueller

Method Summary
 void addChartDataModelListener(ChartDataModelListener l)
          Adds a ChartDataModelListener
 int getAxisBinding(int set)
          Returns the Axis binding of a specific DataSet.
 ChartDataModelConstraints getChartDataModelConstraints(int axis)
          Returns a ChartDataModelConstraints object for the given axis binding.
 java.lang.Class getColumnClass()
          Returns the class of the columns.
 java.lang.Object getColumnValueAt(int col)
          Returns a specific column value.
 java.lang.Object getColumnValueAt(int set, int col)
          Returns a specific column value.
 int getDataSetLength(int set)
          Returns the length of a certain dataset.
 java.lang.String getDataSetName(int set)
          Returns the title of the DataSet used for rendering the Legend.
 int getDataSetNumber()
          Returns the total amount of datasets.
 double getManualMaximumColumnValue()
          Returns the current maximum x-axis value used for manual scaling.
 java.lang.Number getManualMaximumValue()
          Returns the current maximum y-axis value used for manual scaling.
 double getManualMinimumColumnValue()
          Returns the current minimum x-axis value used for manual scaling.
 java.lang.Number getManualMinimumValue()
          Returns the current minimum y-axis value used for manual scaling.
 java.lang.Number getValueAt(int set, int index)
          Returns the Value in a specific dataset at a certain index.
 boolean isAutoScale()
          Returns true if autoscaling is enabled.
 boolean isColumnNumeric()
          Defines whether the column values are numeric, that is, they can be casted to Number.
 boolean isManualScale()
          Returns true if the manual axis scaling is enabled.
 void removeChartDataModelListener(ChartDataModelListener l)
          Removes a ChartDataModelListener
 void setAutoScale(boolean b)
          Enables or disables chart autoscaling.
 void setAxisBinding(int set, int axis)
          Sets the Axis binding of a DataSet.
 void setChartDataModelConstraints(int axis, ChartDataModelConstraints constraints)
          Sets the ChartDataModelConstraints object for the given axis binding.
 void setManualScale(boolean b)
          Enables the manual axis scaling.
 void setMaximumColumnValue(double d)
          Sets the maximum x-axis value.
 void setMaximumValue(java.lang.Number n)
          Sets the maximum y-axis value.
 void setMinimumColumnValue(double d)
          Sets the minimum x-axis value.
 void setMinimumValue(java.lang.Number n)
          Sets the minimum y-axis value.
 void setValueAt(int set, int index, java.lang.Object value)
          Sets the value in a specific dataset at the given index.
 

Method Detail

getDataSetNumber

int getDataSetNumber()
Returns the total amount of datasets.

Returns:
the total amount of DataSets

getAxisBinding

int getAxisBinding(int set)
Returns the Axis binding of a specific DataSet.

Parameters:
set - the DataSet index
Returns:
an integer constant defining the Axis binding

setAxisBinding

void setAxisBinding(int set,
                    int axis)
Sets the Axis binding of a DataSet.

Parameters:
set - the DataSet index
axis - the Axis binding constant

getDataSetLength

int getDataSetLength(int set)
Returns the length of a certain dataset. Note that for proper rendering all datasets should have an equal length.

Parameters:
set - the DataSet index
Returns:
the int length of a DataSet

getDataSetName

java.lang.String getDataSetName(int set)
Returns the title of the DataSet used for rendering the Legend.

Parameters:
set - the DataSet index
Returns:
a String containing the Title.

getValueAt

java.lang.Number getValueAt(int set,
                            int index)
Returns the Value in a specific dataset at a certain index.

Parameters:
set - the DataSet index
index - the value index in the DataSet
Returns:
the value Object

setValueAt

void setValueAt(int set,
                int index,
                java.lang.Object value)
Sets the value in a specific dataset at the given index.

Parameters:
set - the DataSet index
index - the value index in the DataSet
value - the value to be stored

getColumnClass

java.lang.Class getColumnClass()
Returns the class of the columns.

Returns:
the class of the column values. In case of numeric columns this is always Number.class.

getColumnValueAt

java.lang.Object getColumnValueAt(int col)
Returns a specific column value.

Parameters:
col - the column index
Returns:
the column value. In case of numeric columns this is always a Number object.

getColumnValueAt

java.lang.Object getColumnValueAt(int set,
                                  int col)
Returns a specific column value.

Parameters:
set - the data set index
col - the column index
Returns:
the column value. In case of numeric columns this is always a Number object.

isColumnNumeric

boolean isColumnNumeric()
Defines whether the column values are numeric, that is, they can be casted to Number.

Returns:
true if the column value can be safely casted to Number type.

addChartDataModelListener

void addChartDataModelListener(ChartDataModelListener l)
Adds a ChartDataModelListener

Parameters:
l - the ChartDataModelListener

removeChartDataModelListener

void removeChartDataModelListener(ChartDataModelListener l)
Removes a ChartDataModelListener

Parameters:
l - the ChartDataModelListener

getChartDataModelConstraints

ChartDataModelConstraints getChartDataModelConstraints(int axis)
Returns a ChartDataModelConstraints object for the given axis binding.

Parameters:
axis - the Axis constant
Returns:
a ChartDataModelConstraints object.

setChartDataModelConstraints

void setChartDataModelConstraints(int axis,
                                  ChartDataModelConstraints constraints)
Sets the ChartDataModelConstraints object for the given axis binding.

Parameters:
axis - the Axis constant
constraints - the ChartDataModelConstraints object

setAutoScale

void setAutoScale(boolean b)
Enables or disables chart autoscaling. This setting is overridden by the manual axis scaling flag.

Parameters:
b - true to enable autoscaling, false otherwise

isAutoScale

boolean isAutoScale()
Returns true if autoscaling is enabled. Does not depend on the manual scaling flag.

Returns:
true if autoscaling is enabled, false otherwise

setManualScale

void setManualScale(boolean b)
Enables the manual axis scaling. Set the desired maximum and minimum values using the setMaximum...Value functions.


isManualScale

boolean isManualScale()
Returns true if the manual axis scaling is enabled. This overrides the enabled automatic axis scaling.


setMaximumColumnValue

void setMaximumColumnValue(double d)
Sets the maximum x-axis value.


setMinimumColumnValue

void setMinimumColumnValue(double d)
Sets the minimum x-axis value.


setMaximumValue

void setMaximumValue(java.lang.Number n)
Sets the maximum y-axis value.


setMinimumValue

void setMinimumValue(java.lang.Number n)
Sets the minimum y-axis value.


getManualMaximumColumnValue

double getManualMaximumColumnValue()
Returns the current maximum x-axis value used for manual scaling.

Returns:
the maximum column value as a double for manual scaling

getManualMinimumColumnValue

double getManualMinimumColumnValue()
Returns the current minimum x-axis value used for manual scaling.

Returns:
the minimum column value as a double for manual scaling

getManualMaximumValue

java.lang.Number getManualMaximumValue()
Returns the current maximum y-axis value used for manual scaling.

Returns:
the maximum for manual scaling

getManualMinimumValue

java.lang.Number getManualMinimumValue()
Returns the current minimum y-axis value used for manual scaling.

Returns:
the minimum for manual scaling