Class OscilloscopeAxis

  • All Implemented Interfaces:
    Axis, de.gsi.dataset.AxisDescription, de.gsi.dataset.event.EventSource, java.io.Serializable, javafx.css.Styleable, javafx.event.EventTarget

    public class OscilloscopeAxis
    extends AbstractAxis
    implements Axis
    Implements an Oscilloscope-like axis with a default of 10 divisions (tick marks) and fixed zero (or offset) screen position

    Compared to the DefaultNumericAxis, this one has a few additional/different features:

    • the number of grid and label divisions is kept (by convention) always at 10
    • the zero is kept at the same relative screen position and min/max ranges are adjusted accordingly
    • the default tick-unit ranges are <1.0, 2.0, 5.0> (DEFAULT_MULTIPLIERS1) but can be changed to half steps (ie. using DEFAULT_MULTIPLIERS2)
    • it provides a getMinRange() and getMaxRange() feature to force a minimum and/or maximum axis range (N.B. to disable this, simply 'clear()' these ranges).
    Author:
    rstein
    See Also:
    Serialized Form
    • Field Detail

      • DEFAULT_MULTIPLIERS1

        public static final java.util.SortedSet<java.lang.Number> DEFAULT_MULTIPLIERS1
      • DEFAULT_MULTIPLIERS2

        public static final java.util.SortedSet<java.lang.Number> DEFAULT_MULTIPLIERS2
      • isUpdating

        protected boolean isUpdating
    • Constructor Detail

      • OscilloscopeAxis

        public OscilloscopeAxis​(java.lang.String axisLabel)
        Creates an auto-ranging Axis.
        Parameters:
        axisLabel - the axis label
      • OscilloscopeAxis

        public OscilloscopeAxis​(java.lang.String axisLabel,
                                double lowerBound,
                                double upperBound,
                                double tickUnit)
        Create a non-auto-ranging Axis with the given upper bound, lower bound and tick unit.
        Parameters:
        axisLabel - the axis label
        lowerBound - the lower bound of the axis
        upperBound - the upper bound of the axis
        tickUnit - the tick unit, i.e. space between tick marks
      • OscilloscopeAxis

        public OscilloscopeAxis​(java.lang.String axisLabel,
                                java.lang.String unit)
        Creates an auto-ranging Axis.
        Parameters:
        axisLabel - the axis label
        unit - the unit of the axis axis label
    • Method Detail

      • axisZeroValueProperty

        public javafx.beans.property.DoubleProperty axisZeroValueProperty()
        The relative centre axis value (commonly '0')
        Returns:
        the axisZeroValue property
      • centerAxisZeroPositionProperty

        public javafx.beans.property.DoubleProperty centerAxisZeroPositionProperty()
        The relative zero centre position (N.B. clamped to [0.0,1.0]) w.r.t. the axis length
        Returns:
        the axisZeroPosition property
      • computePreferredTickUnit

        public double computePreferredTickUnit​(double axisLength)
        Description copied from class: AbstractAxis
        Computes the preferred tick unit based on the upper/lower bounds and the length of the axis in screen coordinates.
        Specified by:
        computePreferredTickUnit in class AbstractAxis
        Parameters:
        axisLength - the length in screen coordinates
        Returns:
        the tick unit
      • getAxisZeroPosition

        public double getAxisZeroPosition()
        The relative zero centre position (N.B. clamped to [0.0,1.0]) w.r.t. the axis length
        Returns:
        the centerAxisZeroPosition
      • getAxisZeroValue

        public double getAxisZeroValue()
        The relative centre axis value (commonly '0')
        Returns:
        the axisZeroValue
      • getClampedRange

        public de.gsi.dataset.spi.DataRange getClampedRange()
        Returns:
        the range that is clamped to limits defined by getMinRange() and getMaxRange().
      • getLogAxisType

        public LogAxisType getLogAxisType()
        Specified by:
        getLogAxisType in interface Axis
        Returns:
        given linear and/or logarithmic (+ sub-type, e.g. log10, dB20, ...) axis types
      • getMaxRange

        public de.gsi.dataset.spi.DataRange getMaxRange()
        Returns:
        the maximum range, axis range will never be smaller than this. To disable this feature, simply use getMaxRange().clear().
      • getMinRange

        public de.gsi.dataset.spi.DataRange getMinRange()
        Returns:
        the minimum range, axis range will never be smaller than this. To disable this feature, simply use getMinRange().clear().
      • getTickUnitSupplier

        public TickUnitSupplier getTickUnitSupplier()
        Returns:
        the tickUnitSupplier
      • getValueForDisplay

        public double getValueForDisplay​(double displayPosition)
        Description copied from interface: Axis
        Get the data value for the given display position on this axis. If the axis is a CategoryAxis this will be the nearest value.
        Specified by:
        getValueForDisplay in interface Axis
        Parameters:
        displayPosition - A pixel position on this axis
        Returns:
        the nearest data value to the given pixel position or null if not on axis;
      • isLogAxis

        public boolean isLogAxis()
        Description copied from interface: Axis
        This is true when the axis implements a log scale
        Specified by:
        isLogAxis in interface Axis
        Returns:
        true if axis is log scale
      • setAxisZeroPosition

        public void setAxisZeroPosition​(double value)
        Parameters:
        value - the relative zero centre position (N.B. clamped to [0.0,1.0]) w.r.t. the axis length
      • setAxisZeroValue

        public void setAxisZeroValue​(double value)
        Parameters:
        value - the relative centre axis value (commonly '0')
      • setTickUnitSupplier

        public void setTickUnitSupplier​(TickUnitSupplier tickUnitSupplier)
        Parameters:
        tickUnitSupplier - the tickUnitSupplier to set
      • calculateMajorTickValues

        protected java.util.List<java.lang.Double> calculateMajorTickValues​(double length,
                                                                            AxisRange axisRange)
        Description copied from class: AbstractAxis
        Calculate a list of all the data values for each tick mark in range
        Specified by:
        calculateMajorTickValues in class AbstractAxis
        Parameters:
        length - The length of the axis in display units
        axisRange - A range object returned from autoRange()
        Returns:
        A list of tick marks that fit along the axis if it was the given length
      • calculateMinorTickValues

        protected java.util.List<java.lang.Double> calculateMinorTickValues()
        Description copied from class: AbstractAxis
        Calculate a list of the data values for every minor tick mark
        Specified by:
        calculateMinorTickValues in class AbstractAxis
        Returns:
        List of data values where to draw minor tick marks
      • set

        public boolean set​(double min,
                           double max)
        Specified by:
        set in interface de.gsi.dataset.AxisDescription
        Overrides:
        set in class AbstractAxisParameter
      • set

        public boolean set​(de.gsi.dataset.AxisDescription range)
        Specified by:
        set in interface de.gsi.dataset.AxisDescription
      • set

        public boolean set​(java.lang.String axisName,
                           java.lang.String axisUnit,
                           double rangeMin,
                           double rangeMax)
        Specified by:
        set in interface de.gsi.dataset.AxisDescription
        Overrides:
        set in class AbstractAxisParameter
      • setMax

        public boolean setMax​(double value)
        Specified by:
        setMax in interface de.gsi.dataset.AxisDescription
        Overrides:
        setMax in class AbstractAxis
      • setMin

        public boolean setMin​(double value)
        Specified by:
        setMin in interface de.gsi.dataset.AxisDescription
        Overrides:
        setMin in class AbstractAxis
      • getClassCssMetaData

        public static java.util.List<javafx.css.CssMetaData<? extends javafx.css.Styleable,​?>> getClassCssMetaData()
        Returns:
        The CssMetaData associated with this class, which may include the CssMetaData of its super classes.
      • getEffectiveRange

        protected static double getEffectiveRange​(double min,
                                                  double max)
      • getDisplayPosition

        public double getDisplayPosition​(double value)
        Get the display position along this axis for a given value. If the value is not in the current range, the returned value will be an extrapolation of the display position. -- cached double optimised version (shaves of 50% on delays)
        Specified by:
        getDisplayPosition in interface Axis
        Overrides:
        getDisplayPosition in class AbstractAxis
        Parameters:
        value - The data value to work out display position for
        Returns:
        display position