com.approximatrix.charting.model
Class DefaultChartDataModelConstraints

java.lang.Object
  extended by com.approximatrix.charting.model.DefaultChartDataModelConstraints
All Implemented Interfaces:
ChartDataModelConstraints

public class DefaultChartDataModelConstraints
extends java.lang.Object
implements ChartDataModelConstraints

Implementing the ChartDataModelConstraints this class provides the default implementation for the data model constraints. Alternative implementations could return the sum of all column values to implement stacked bar charts e.g.

Author:
smueller

Field Summary
protected  boolean allowManualColScale
          A flag which determines if column values should be manually scalable.
protected  int axis
          The axis to compute the constraints.
protected  AbstractChartDataModel model
          The model for which to calculate the constraints.
 
Constructor Summary
DefaultChartDataModelConstraints(AbstractChartDataModel model, int axis)
          Creates a new instance of DefaultChartDataModelConstraints
DefaultChartDataModelConstraints(AbstractChartDataModel model, int axis, boolean allowManualColScale)
          Creates a new instance of DefaultChartDataModelConstraints
 
Method Summary
 double getMaximumColumnValue()
          Returns the maximum column value.
 java.lang.Number getMaximumValue()
          Returns the maximum value of all datasets.
 double getMinimumColumnValue()
          Returns the minimum column value.
 java.lang.Number getMinimumValue()
          Returns the minimum value of all datasets.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

model

protected AbstractChartDataModel model
The model for which to calculate the constraints.


axis

protected int axis
The axis to compute the constraints.


allowManualColScale

protected boolean allowManualColScale
A flag which determines if column values should be manually scalable.

Constructor Detail

DefaultChartDataModelConstraints

public DefaultChartDataModelConstraints(AbstractChartDataModel model,
                                        int axis)
Creates a new instance of DefaultChartDataModelConstraints


DefaultChartDataModelConstraints

public DefaultChartDataModelConstraints(AbstractChartDataModel model,
                                        int axis,
                                        boolean allowManualColScale)
Creates a new instance of DefaultChartDataModelConstraints

Parameters:
model - the AbstractDataModel for which constraints will be computed
axis - the y-axis which will be considered
allowManualScale - a flag which triggers if column values should be allowed to be scaled manually (default is yes)
Method Detail

getMaximumValue

public java.lang.Number getMaximumValue()
Returns the maximum value of all datasets.

Specified by:
getMaximumValue in interface ChartDataModelConstraints
Returns:
a Number object defining the maximum value

getMinimumValue

public java.lang.Number getMinimumValue()
Returns the minimum value of all datasets.

Specified by:
getMinimumValue in interface ChartDataModelConstraints
Returns:
a Number object defining the smallest value.

getMinimumColumnValue

public double getMinimumColumnValue()
Returns the minimum column value.

Specified by:
getMinimumColumnValue in interface ChartDataModelConstraints
Returns:
In the case of non-numeric x-values this should be 0, in the case of numeric x-values this should nomen est omen be the smallest value.
Throws:
java.lang.ArrayIndexOutOfBoundsException - if the Model is empty

getMaximumColumnValue

public double getMaximumColumnValue()
Returns the maximum column value.

Specified by:
getMaximumColumnValue in interface ChartDataModelConstraints
Returns:
In the case of non-numeric x-values this should be the amount of columns - 1, in the case of numeric x-values this should nomen est omen be the smallest value.
Throws:
java.lang.ArrayIndexOutOfBoundsException - if the model is empty