info.monitorenter.gui.chart.axis
Class AAxisTransformation

java.lang.Object
  extended by info.monitorenter.gui.chart.axis.AAxis
      extended by info.monitorenter.gui.chart.axis.AAxisTransformation
All Implemented Interfaces:
IAxis, PropertyChangeListener, Serializable, EventListener
Direct Known Subclasses:
AxisLog10, AxisLogE

public abstract class AAxisTransformation
extends AAxis

Base class for Axis implementations that transform the scale for changed display.

Version:
$Revision: 1.32 $
Author:
Achim Westermann
See Also:
Serialized Form

Nested Class Summary
 class AAxisTransformation.XDataAccessor
          An accessor for the x axis of a chart.
protected  class AAxisTransformation.YDataAccessor
          Accesses the y axis of the Chart2D.
 
Nested classes/interfaces inherited from class info.monitorenter.gui.chart.axis.AAxis
AAxis.AChart2DDataAccessor
 
Nested classes/interfaces inherited from interface info.monitorenter.gui.chart.IAxis
IAxis.AxisTitle
 
Field Summary
protected  long m_outputErrorTstamp
          Internal timestamp of the last transformation error reporting.
 
Fields inherited from class info.monitorenter.gui.chart.axis.AAxis
m_accessor, m_formatter, m_majorTickSpacing, m_max, m_min, m_minorTickSpacing, m_needsFullRescale, m_power, m_rangePolicy
 
Fields inherited from interface info.monitorenter.gui.chart.IAxis
PROPERTY_ADD_REMOVE_TRACE, PROPERTY_LABELFORMATTER, PROPERTY_PAINTGRID, PROPERTY_RANGEPOLICY
 
Constructor Summary
AAxisTransformation()
          Creates a default instance that will use a LabelFormatterAutoUnits for formatting labels.
AAxisTransformation(IAxisLabelFormatter formatter)
          Creates an instance that will the given label formatter for formatting labels.
 
Method Summary
protected  AAxis.AChart2DDataAccessor createAccessor(Chart2D chart, int dimension, int position)
          Template method to create the proper AAxis.AChart2DDataAccessor implementation.
 double getMax()
          Returns the maximum value from all traces of this axis with respect to the installed range policy.
 double getMin()
          Returns the minimum value of all traces of this axis with respect to the installed range policy.
 double getScaledValue(double absolute)
          Deprecated. replaced by AAxis.scaleTrace(ITrace2D)
protected abstract  double transform(double in)
          Template method for performing the axis transformation.
 double translateMousePosition(MouseEvent mouseEvent)
          Returns the translation of the mouse event coordinates of the given mouse event to the value within the chart for the dimension (x,y) covered by this axis.
 double translatePxToValue(int pixel)
          Transforms the given pixel value (which has to be a awt value like MouseEvent.getY() into the chart value.
protected abstract  double untransform(double in)
          Template method for performing the reverse axis transformation.
 
Methods inherited from class info.monitorenter.gui.chart.axis.AAxis
addPropertyChangeListener, addTrace, equals, findMax, findMin, getAccessor, getAxisPosition, getAxisTitle, getDimension, getDimensionString, getFormatter, getHeight, getLabels, getMajorTickSpacing, getMaxValue, getMinorTickSpacing, getMinValue, getPixelXLeft, getPixelXRight, getPixelYBottom, getPixelYTop, getPropertyChangeListeners, getRange, getRangePolicy, getScaleValues, getTitle, getTitlePainter, getTraces, getValueDistanceForPixel, getWidth, hashCode, hasTrace, initPaintIteration, isDirtyScaling, isPaintGrid, isPaintScale, isStartMajorTick, isVisible, paint, paintTitle, propertyChange, removeAllTraces, removeAxisTitle, removePropertyChangeListener, removeTrace, roundToTicks, scale, scalePoint, scaleTrace, setAccessor, setAxisPosition, setAxisTitle, setChart, setFormatter, setMajorTickSpacing, setMinorTickSpacing, setPaintGrid, setPaintScale, setPixelXLeft, setPixelXRight, setPixelYBottom, setPixelYTop, setRange, setRangePolicy, setStartMajorTick, setTitle, setTitlePainter, setVisible, translateValueToPx
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_outputErrorTstamp

protected long m_outputErrorTstamp
Internal timestamp of the last transformation error reporting.

Constructor Detail

AAxisTransformation

public AAxisTransformation()
Creates a default instance that will use a LabelFormatterAutoUnits for formatting labels.


AAxisTransformation

public AAxisTransformation(IAxisLabelFormatter formatter)
Creates an instance that will the given label formatter for formatting labels.

Parameters:
formatter - needed for formatting labels of this axis.
Method Detail

createAccessor

protected AAxis.AChart2DDataAccessor createAccessor(Chart2D chart,
                                                    int dimension,
                                                    int position)
Description copied from class: AAxis
Template method to create the proper AAxis.AChart2DDataAccessor implementation.

Specified by:
createAccessor in class AAxis
Parameters:
chart - the chart to access.
dimension - Chart2D.X or Chart2D.Y.
position - Chart2D.CHART_POSITION_BOTTOM, Chart2D.CHART_POSITION_LEFT, Chart2D.CHART_POSITION_RIGHT or Chart2D.CHART_POSITION_TOP.
Returns:
the proper AAxis.AChart2DDataAccessor implementation.
See Also:
AAxis.createAccessor(info.monitorenter.gui.chart.Chart2D, int, int)

getMax

public double getMax()
Description copied from interface: IAxis
Returns the maximum value from all traces of this axis with respect to the installed range policy.

Specified by:
getMax in interface IAxis
Overrides:
getMax in class AAxis
Returns:
the maximum value from all traces of this axis with respect to the installed range policy.
See Also:
AAxis.getMax()

getMin

public double getMin()
Description copied from interface: IAxis
Returns the minimum value of all traces of this axis with respect to the installed range policy.

Specified by:
getMin in interface IAxis
Overrides:
getMin in class AAxis
Returns:
the minimum value of all traces of this axis with respect to the installed range policy.
See Also:
AAxis.getMin()

getScaledValue

@Deprecated
public final double getScaledValue(double absolute)
Deprecated. replaced by AAxis.scaleTrace(ITrace2D)

Description copied from interface: IAxis
Scales the given absolute value into a value between 0 and 1.0 (if it is in the range of the data).

If the given absolute value is not in the display- range of the Chart2D, negative values or values greater than 1.0 may result.

Parameters:
absolute - a value in the real value range of the corresponding chart.
Returns:
a value between 0.0 and 1.0 that is mapped to a position within the chart.
See Also:
IAxis.getScaledValue(double)

transform

protected abstract double transform(double in)
                             throws IllegalArgumentException
Template method for performing the axis transformation.

The argument should not be negative, so only normalized values (no chart values but their scaled values or pixel values) should be given here.

Parameters:
in - the value to transform.
Returns:
the transformed value.
Throws:
IllegalArgumentException - if scaling is impossible (due to some mathematical transformation in implementations like AxisLog10

translateMousePosition

public final double translateMousePosition(MouseEvent mouseEvent)
                                    throws IllegalArgumentException
Description copied from class: AAxis
Returns the translation of the mouse event coordinates of the given mouse event to the value within the chart for the dimension (x,y) covered by this axis.

Note that the mouse event has to be an event fired on the correspondinig chart component!

Overrides:
translateMousePosition in class AAxis
Parameters:
mouseEvent - a mouse event that has been fired on this component.
Returns:
the translation of the mouse event coordinates of the given mouse event to the value within the chart for the dimension covered by this axis (x or y) or null if no calculations could be performed as the chart was not painted before.
Throws:
IllegalArgumentException - if the given mouse event is out of the current graphics context (not a mouse event of the chart component).
See Also:
AAxis.translateMousePosition(java.awt.event.MouseEvent)

translatePxToValue

public double translatePxToValue(int pixel)
Description copied from interface: IAxis
Transforms the given pixel value (which has to be a awt value like MouseEvent.getY() into the chart value.

Internal use only, the interface does not guarantee that the pixel corresponds to any valid awt pixel value within the chart component.

Specified by:
translatePxToValue in interface IAxis
Overrides:
translatePxToValue in class AAxis
Parameters:
pixel - a pixel value of the chart component as used by awt.
Returns:
the awt pixel value transformed to the chart value.
See Also:
AAxis.translatePxToValue(int)

untransform

protected abstract double untransform(double in)
Template method for performing the reverse axis transformation.

This is the counterpart to transform(double).

Parameters:
in - the transformed value.
Returns:
the normal value;


Copyright © 2001 - 2010 LGPL, All Rights Footloose.