lt.monarch.chart.plugins
Class AutoAxisAdjuster

java.lang.Object
  extended by lt.monarch.chart.plugins.AbstractChartPlugin<AbstractChart<?,?>>
      extended by lt.monarch.chart.plugins.AutoAxisAdjuster
All Implemented Interfaces:
java.io.Serializable, ChartPlugin<AbstractChart<?,?>>

public class AutoAxisAdjuster
extends AbstractChartPlugin<AbstractChart<?,?>>

This plug-ins adjusts the axes according to the supplied mappers and data model. By default horizontalBase is equal to zero and chart is adjusted to the horizontal base. Default horizontal and vertical base is 0. Adjustments to base true.

See Also:
Serialized Form

Field Summary
Modifier and Type Field and Description
protected  MinMaxValues xAxisValues
          Maximum and minimum values from data model for X values
protected  MinMaxValues yAxisValues
          Maximum and minimum values from data model for Y values
protected  MinMaxValues zAxisValues
          Maximum and minimum values from data model for Z values
 
Constructor Summary
Constructor and Description
AutoAxisAdjuster(AxisMapper xAxisMapper, AxisMapper yAxisMapper)
          Constructor for 2D chart passing the two axes, which are associated to certain series.
AutoAxisAdjuster(AxisMapper xAxisMapper, AxisMapper yAxisMapper, AxisMapper zAxisMapper)
          Constructor for 3D chart and with an array of models.
AutoAxisAdjuster(ChartObject[] objectList, AxisMapper xAxisMapper, AxisMapper yAxisMapper)
          Constructor for 2D chart passing the two axes, which are associated to certain series.
AutoAxisAdjuster(ChartObject[] objectList, AxisMapper xAxisMapper, AxisMapper yAxisMapper, AxisMapper zAxisMapper)
          Constructor for 3D chart and with an array of models.
 
Method Summary
Modifier and Type Method and Description
 void activate()
          Prepares the plug-in, when it is installed.
 void adjustChart()
          Performs chart objects modifications.
 void deactivate()
          Cleanups the plug-in, when it is uninstalled.
 java.lang.Object getMargin(DataColumnType valType)
          Gets margin for specified data column
 java.lang.Object getMaxValue(DataColumnType valType)
          Gets max value for specified data column
 java.lang.Object getMinValue(DataColumnType valType)
          Gets minimum value for specified data column
 void init()
          Initializes the values according to the mappers and adjusts the mappers according to the models
static boolean isEnabledForChart(Chart<?> chart)
          Test if a chart has AuoAxisAdjuster enabled
 boolean isReadjustNeeded()
          If needs to readjusts mappers
 void setMargin(DataColumnType valType, double margin)
          Sets margin value for specified data column.
 void setMaxValue(DataColumnType valType, java.lang.Object maxValue)
          Sets max value for specified data column
 void setMinValue(DataColumnType valType, java.lang.Object minValue)
          Sets minimum value for specified data column
 
Methods inherited from class lt.monarch.chart.plugins.AbstractChartPlugin
chart, getChart, install, isActivated, paint, uninstall
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

xAxisValues

protected MinMaxValues xAxisValues
Maximum and minimum values from data model for X values


yAxisValues

protected MinMaxValues yAxisValues
Maximum and minimum values from data model for Y values


zAxisValues

protected MinMaxValues zAxisValues
Maximum and minimum values from data model for Z values

Constructor Detail

AutoAxisAdjuster

public AutoAxisAdjuster(AxisMapper xAxisMapper,
                        AxisMapper yAxisMapper)
Constructor for 2D chart passing the two axes, which are associated to certain series. Be sure that the series uses 2D model, since only x and y axis are provided. For example Ribbon series uses 2D model, so yMapper and zMapper should be provided here. Adjusts to all chart series and marker lines and ranges.

Parameters:
xAxisMapper - x axis mapper
yAxisMapper - y axis mapper

AutoAxisAdjuster

public AutoAxisAdjuster(ChartObject[] objectList,
                        AxisMapper xAxisMapper,
                        AxisMapper yAxisMapper)
Constructor for 2D chart passing the two axes, which are associated to certain series. Be sure that the series uses 2D model, since only x and y axis are provided. For example Ribbon series uses 2D model, so yMapper and zMapper should be provided here.

Parameters:
objectList - chart object array to adjust to
xAxisMapper - x axis mapper
yAxisMapper - y axis mapper

AutoAxisAdjuster

public AutoAxisAdjuster(AxisMapper xAxisMapper,
                        AxisMapper yAxisMapper,
                        AxisMapper zAxisMapper)
Constructor for 3D chart and with an array of models. This constructor should be used only for those series, that uses 3D models, thus it cannot be used for RibbonSeries or SplineRibbonSeries. Adjusts to all chart series and marker lines and ranges.

Parameters:
xAxisMapper - x axis mapper
yAxisMapper - y axis mapper
zAxisMapper - z axis mapper

AutoAxisAdjuster

public AutoAxisAdjuster(ChartObject[] objectList,
                        AxisMapper xAxisMapper,
                        AxisMapper yAxisMapper,
                        AxisMapper zAxisMapper)
Constructor for 3D chart and with an array of models. This constructor should be used only for those series, that uses 3D models, thus it cannot be used for RibbonSeries or SplineRibbonSeries.

Parameters:
objectList - chart object array to adjust to
xAxisMapper - x axis mapper
yAxisMapper - y axis mapper
zAxisMapper - z axis mapper
Method Detail

isReadjustNeeded

public boolean isReadjustNeeded()
If needs to readjusts mappers


activate

public void activate()
Description copied from class: AbstractChartPlugin
Prepares the plug-in, when it is installed. Also called when chart is activated.

Specified by:
activate in class AbstractChartPlugin<AbstractChart<?,?>>

adjustChart

public void adjustChart()
Description copied from interface: ChartPlugin
Performs chart objects modifications. Is called before chart paint.

Specified by:
adjustChart in interface ChartPlugin<AbstractChart<?,?>>
Overrides:
adjustChart in class AbstractChartPlugin<AbstractChart<?,?>>

deactivate

public void deactivate()
Description copied from class: AbstractChartPlugin
Cleanups the plug-in, when it is uninstalled. Also called when chart is deactivated.

Specified by:
deactivate in class AbstractChartPlugin<AbstractChart<?,?>>

init

public void init()
Initializes the values according to the mappers and adjusts the mappers according to the models


setMargin

public void setMargin(DataColumnType valType,
                      double margin)
Sets margin value for specified data column. Value is between 0 and 0.5. If there is no minimum or maximum value set,then margin is calculated from data model minimum, max values. However if minimum and maximum value are set,then the margin is added from that specified value.

Parameters:
valType - data model column type
margin - margin for specified data column

getMargin

public java.lang.Object getMargin(DataColumnType valType)
Gets margin for specified data column

Parameters:
valType - data model column type
Returns:
margin for specified data model column

setMaxValue

public void setMaxValue(DataColumnType valType,
                        java.lang.Object maxValue)
Sets max value for specified data column

Parameters:
valType - data model column type
maxValue - the max value for specified data column

getMaxValue

public java.lang.Object getMaxValue(DataColumnType valType)
Gets max value for specified data column

Parameters:
valType - data model column type
Returns:
max value for specified data model column

setMinValue

public void setMinValue(DataColumnType valType,
                        java.lang.Object minValue)
Sets minimum value for specified data column

Parameters:
valType - data model column type
minValue - minimum value for specified data column

getMinValue

public java.lang.Object getMinValue(DataColumnType valType)
Gets minimum value for specified data column

Parameters:
valType - data model column type
Returns:
minimum value for specified data model column

isEnabledForChart

public static boolean isEnabledForChart(Chart<?> chart)
Test if a chart has AuoAxisAdjuster enabled

Parameters:
chart - a chart
Returns:
whether a chart has AuoAxisAdjuster enabled