info.monitorenter.gui.chart.axis
Class AxisLog10<T extends AxisScalePolicyTransformation>

java.lang.Object
  extended by info.monitorenter.gui.chart.axis.AAxis<T>
      extended by info.monitorenter.gui.chart.axis.AAxisTransformation<T>
          extended by info.monitorenter.gui.chart.axis.AxisLog10<T>
Type Parameters:
T - Used to enforce that this instance only accepts AxisScalePolicyTransformation and subtypes.
All Implemented Interfaces:
IAxis<T>, java.beans.PropertyChangeListener, java.io.Serializable, java.util.EventListener

public class AxisLog10<T extends AxisScalePolicyTransformation>
extends AAxisTransformation<T>

An AAxis with log base 10 scaled display of values.

Caution

This will not work with negative values (Double.NaN is computed for log of negative values).

This will even not work with values < 1.0 as the log transformation turns negative for values < 1.0 and becomes Double.NEGATIVE_INFINITY with lim -> 0.0 with more and more turns to a 100 % CPU load.

Version:
$Revision: 1.15 $
Author:
Pieter-Jan Busschaert (contributor), Achim Westermann
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class info.monitorenter.gui.chart.axis.AAxisTransformation
AAxisTransformation.XDataAccessor, AAxisTransformation.YDataAccessor
 
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
 
Fields inherited from class info.monitorenter.gui.chart.axis.AAxisTransformation
m_outputErrorTstamp
 
Fields inherited from class info.monitorenter.gui.chart.axis.AAxis
DEBUG, m_accessor, m_formatter, m_majorTickSpacing, m_max, m_min, m_minorTickSpacing, m_needsFullRescale, m_rangePolicy
 
Fields inherited from interface info.monitorenter.gui.chart.IAxis
PROPERTY_ADD_REMOVE_TRACE, PROPERTY_AXIS_SCALE_POLICY_CHANGED, PROPERTY_LABELFORMATTER, PROPERTY_PAINTGRID, PROPERTY_PAINTSCALE, PROPERTY_RANGEPOLICY
 
Constructor Summary
AxisLog10()
          Creates an instance that uses a LabelFormatterSimple for formatting numbers and a AxisScalePolicyAutomaticBestFit for controlling the scale.
AxisLog10(IAxisLabelFormatter formatter, T scalePolicy)
          Constructor that uses the given label formatter for formatting labels.
 
Method Summary
 double transform(double in)
          Performs Math.log10(double) with a check for reaching infinity.
 double untransform(double in)
          Template method for performing the reverse axis transformation.
 
Methods inherited from class info.monitorenter.gui.chart.axis.AAxisTransformation
createAccessor, getMaxTransformed, getMinTransformed, getScaledValue, scaleTrace, translateMousePosition, translatePxToValue
 
Methods inherited from class info.monitorenter.gui.chart.axis.AAxis
addPropertyChangeListener, addTrace, ensureInitialized, equals, findMax, findMin, getAccessor, getAxisPosition, getAxisScalePolicy, getAxisTitle, getDimension, getDimensionString, getFormatter, getHeight, getMajorTickSpacing, getMax, getMaxValue, getMin, getMinorTickSpacing, getMinValue, getPixelXLeft, getPixelXRight, getPixelYBottom, getPixelYTop, getPropertyChangeListeners, getRange, getRangePolicy, getTitle, getTitlePainter, getTraces, getValueDistanceForPixel, getWidth, hashCode, hasTrace, initPaintIteration, isDirtyScaling, isPaintGrid, isPaintScale, isStartMajorTick, isVisible, paint, paintTitle, propertyChange, removeAllTraces, removeAxisTitle, removePropertyChangeListener, removeTrace, scale, scalePoint, setAccessor, setAxisPosition, setAxisScalePolicy, 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
 

Constructor Detail

AxisLog10

public AxisLog10()
Creates an instance that uses a LabelFormatterSimple for formatting numbers and a AxisScalePolicyAutomaticBestFit for controlling the scale.


AxisLog10

public AxisLog10(IAxisLabelFormatter formatter,
                 T scalePolicy)
Constructor that uses the given label formatter for formatting labels.

Parameters:
formatter - needed for formatting labels of this axis. Prefer using simple implementations like LabelFormatterSimple, a log axis is complicated enough to understand.
scalePolicy - controls the ticks/labels and their distance.
Method Detail

transform

public double transform(double in)
Performs Math.log10(double) with a check for reaching infinity.

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

If the argument is close to zero, the result of log would be Double.POSITIVE_INFINITY which is transformed to Double.MAX_VALUE.

Specified by:
transform in class AAxisTransformation<T extends AxisScalePolicyTransformation>
Parameters:
in - the value to compute the log base 10 of.
Returns:
log base 10 for the given value.

untransform

public double untransform(double in)
Description copied from class: AAxisTransformation
Template method for performing the reverse axis transformation.

This is the counterpart to AAxisTransformation.transform(double).

Specified by:
untransform in class AAxisTransformation<T extends AxisScalePolicyTransformation>
Parameters:
in - the transformed value.
Returns:
the normal value;
See Also:
AAxisTransformation.untransform(double)


Copyright © 2001 - 2010 LGPL, All Rights Footloose.