Class LinearAxis

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

    public class LinearAxis
    extends AbstractAxis
    Author:
    rstein
    See Also:
    Serialized Form
    • Constructor Detail

      • LinearAxis

        public LinearAxis()
        Creates an auto-ranging LinearAxis.
      • LinearAxis

        public LinearAxis​(double lowerBound,
                          double upperBound,
                          double tickUnit)
        Creates a non-auto-ranging LinearAxis with the given upper bound, lower bound and tick unit.
        Parameters:
        lowerBound - the lower bound of the axis
        upperBound - the upper bound of the axis
        tickUnit - the tick unit, i.e. space between tick marks
      • LinearAxis

        public LinearAxis​(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
    • Method Detail

      • computePreferredTickUnit

        public double computePreferredTickUnit​(double axisLength)
        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
      • forceZeroInRangeProperty

        public javafx.beans.property.BooleanProperty forceZeroInRangeProperty()
        When true zero is always included in the visible range. This only has effect if auto-ranging is on.
        Returns:
        forceZeroInRange property
      • getCssMetaData

        public java.util.List<javafx.css.CssMetaData<? extends javafx.css.Styleable,​?>> getCssMetaData()
        Specified by:
        getCssMetaData in interface javafx.css.Styleable
        Overrides:
        getCssMetaData in class AbstractAxisParameter
      • 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
      • getLogAxisType

        public LogAxisType getLogAxisType()
        Returns:
        the log axis Type @see LogAxisType
      • getValueForDisplay

        public double getValueForDisplay​(double displayPosition)
        Get the data value for the given display position on this axis. If the axis is a CategoryAxis this will be the nearest value. -- cached double optimised version (shaves of 50% on delays)
        Parameters:
        displayPosition - A pixel position on this axis
        Returns:
        the nearest data value to the given pixel position or null if not on axis;
      • getZeroPosition

        public double getZeroPosition()
        Get the display position of the zero line along this axis.
        Specified by:
        getZeroPosition in interface Axis
        Overrides:
        getZeroPosition in class AbstractAxis
        Returns:
        display position or Double.NaN if zero is not in current range;
      • isForceZeroInRange

        public boolean isForceZeroInRange()
        Returns the value of the forceZeroInRangeProperty().
        Returns:
        value of the forceZeroInRange property
      • isLogAxis

        public boolean isLogAxis()
        Returns the value of the logAxisProperty.
        Returns:
        value of the logAxis property
      • isValueOnAxis

        public boolean isValueOnAxis​(double value)
        Checks if the given value is plottable on this axis
        Specified by:
        isValueOnAxis in interface Axis
        Overrides:
        isValueOnAxis in class AbstractAxis
        Parameters:
        value - The value to check if its on axis
        Returns:
        true if the given value is plottable on this axis
      • requestAxisLayout

        public void requestAxisLayout()
        Description copied from class: AbstractAxis
        Request that the axis is laid out in the next layout pass. This replaces requestLayout() as it has been overridden to do nothing so that changes to children's bounds etc do not cause a layout. This was done as a optimisation as the Axis knows the exact minimal set of changes that really need layout to be updated. So we only want to request layout then, not on any child change.
        Specified by:
        requestAxisLayout in interface Axis
        Overrides:
        requestAxisLayout in class AbstractAxis
      • setForceZeroInRange

        public void setForceZeroInRange​(boolean value)
        Sets the value of the forceZeroInRangeProperty().
        Parameters:
        value - if true, zero is always included in the visible range
      • setTickUnitSupplier

        public void setTickUnitSupplier​(TickUnitSupplier supplier)
        Sets the value of the tickUnitSupplierProperty().
        Parameters:
        supplier - the tick unit supplier. If null, the default one will be used
      • tickUnitProperty

        public javafx.beans.property.DoubleProperty tickUnitProperty()
        The value between each major tick mark in data units. This is automatically set if we are auto-ranging.
        Specified by:
        tickUnitProperty in interface Axis
        Overrides:
        tickUnitProperty in class AbstractAxisParameter
        Returns:
        tickUnit property
      • tickUnitSupplierProperty

        public javafx.beans.property.ObjectProperty<TickUnitSupplier> tickUnitSupplierProperty()
        Strategy to compute major tick unit when auto-range is on or when axis bounds change. By default initialized to DefaultTickUnitSupplier.

        See TickUnitSupplier for more information about the expected behavior of the strategy.

        Returns:
        tickUnitSupplier property
      • autoRange

        protected AxisRange autoRange​(double minValue,
                                      double maxValue,
                                      double length,
                                      double labelSize)
        Overrides:
        autoRange in class AbstractAxis
      • calculateMajorTickValues

        protected java.util.List<java.lang.Double> calculateMajorTickValues​(double axisLength,
                                                                            AxisRange range)
        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:
        axisLength - The length of the axis in display units
        range - 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
      • getClassCssMetaData

        public static java.util.List<javafx.css.CssMetaData<? extends javafx.css.Styleable,​?>> getClassCssMetaData()