Class ValueAxis<T extends Number>

All Implemented Interfaces:
Styleable, EventTarget
Direct Known Subclasses:
NumberAxis

public abstract class ValueAxis<T extends Number> extends Axis<T>
An axis whose data is defined as Numbers. It can also draw minor tick-marks between the major ones.
Since:
JavaFX 2.0
  • Property Details

  • Field Details

    • currentLowerBound

      protected final DoubleProperty currentLowerBound
      The current value for the lowerBound of this axis (minimum value). This may be the same as lowerBound or different. It is used by NumberAxis to animate the lowerBound from the old value to the new value.
  • Constructor Details

    • ValueAxis

      public ValueAxis()
      Creates a auto-ranging ValueAxis.
    • ValueAxis

      public ValueAxis(double lowerBound, double upperBound)
      Creates a non-auto-ranging ValueAxis with the given lower and upper bound.
      Parameters:
      lowerBound - The lower bound for this axis, i.e. min plottable value
      upperBound - The upper bound for this axis, i.e. max plottable value
  • Method Details

    • isMinorTickVisible

      public final boolean isMinorTickVisible()
      Gets the value of the property minorTickVisible.
      Property description:
      true if minor tick marks should be displayed
    • setMinorTickVisible

      public final void setMinorTickVisible(boolean value)
      Sets the value of the property minorTickVisible.
      Property description:
      true if minor tick marks should be displayed
    • minorTickVisibleProperty

      public final BooleanProperty minorTickVisibleProperty()
      true if minor tick marks should be displayed
      See Also:
    • getScale

      public final double getScale()
      Gets the value of the property scale.
      Property description:
      The scale factor from data units to visual units
    • setScale

      protected final void setScale(double scale)
      Sets the value of the property scale.
      Property description:
      The scale factor from data units to visual units
    • scaleProperty

      public final ReadOnlyDoubleProperty scaleProperty()
      The scale factor from data units to visual units
      See Also:
    • getUpperBound

      public final double getUpperBound()
      Gets the value of the property upperBound.
      Property description:
      The value for the upper bound of this axis (maximum value). This is automatically set if auto ranging is on.
    • setUpperBound

      public final void setUpperBound(double value)
      Sets the value of the property upperBound.
      Property description:
      The value for the upper bound of this axis (maximum value). This is automatically set if auto ranging is on.
    • upperBoundProperty

      public final DoubleProperty upperBoundProperty()
      The value for the upper bound of this axis (maximum value). This is automatically set if auto ranging is on.
      See Also:
    • getLowerBound

      public final double getLowerBound()
      Gets the value of the property lowerBound.
      Property description:
      The value for the lower bound of this axis (minimum value). This is automatically set if auto ranging is on.
    • setLowerBound

      public final void setLowerBound(double value)
      Sets the value of the property lowerBound.
      Property description:
      The value for the lower bound of this axis (minimum value). This is automatically set if auto ranging is on.
    • lowerBoundProperty

      public final DoubleProperty lowerBoundProperty()
      The value for the lower bound of this axis (minimum value). This is automatically set if auto ranging is on.
      See Also:
    • getTickLabelFormatter

      public final StringConverter<T> getTickLabelFormatter()
      Gets the value of the property tickLabelFormatter.
      Property description:
      StringConverter used to format tick mark labels. If null a default will be used
    • setTickLabelFormatter

      public final void setTickLabelFormatter(StringConverter<T> value)
      Sets the value of the property tickLabelFormatter.
      Property description:
      StringConverter used to format tick mark labels. If null a default will be used
    • tickLabelFormatterProperty

      public final ObjectProperty<StringConverter<T>> tickLabelFormatterProperty()
      StringConverter used to format tick mark labels. If null a default will be used
      See Also:
    • getMinorTickLength

      public final double getMinorTickLength()
      Gets the value of the property minorTickLength.
      Property description:
      The length of minor tick mark lines. Set to 0 to not display minor tick marks.
    • setMinorTickLength

      public final void setMinorTickLength(double value)
      Sets the value of the property minorTickLength.
      Property description:
      The length of minor tick mark lines. Set to 0 to not display minor tick marks.
    • minorTickLengthProperty

      public final DoubleProperty minorTickLengthProperty()
      The length of minor tick mark lines. Set to 0 to not display minor tick marks.
      See Also:
    • getMinorTickCount

      public final int getMinorTickCount()
      Gets the value of the property minorTickCount.
      Property description:
      The number of minor tick divisions to be displayed between each major tick mark. The number of actual minor tick marks will be one less than this.
    • setMinorTickCount

      public final void setMinorTickCount(int value)
      Sets the value of the property minorTickCount.
      Property description:
      The number of minor tick divisions to be displayed between each major tick mark. The number of actual minor tick marks will be one less than this.
    • minorTickCountProperty

      public final IntegerProperty minorTickCountProperty()
      The number of minor tick divisions to be displayed between each major tick mark. The number of actual minor tick marks will be one less than this.
      See Also:
    • autoRange

      protected final Object autoRange(double length)
      This calculates the upper and lower bound based on the data provided to invalidateRange() method. This must not affect the state of the axis. Any results of the auto-ranging should be returned in the range object. This will we passed to setRange() if it has been decided to adopt this range for this axis.
      Specified by:
      autoRange in class Axis<T extends Number>
      Parameters:
      length - The length of the axis in screen coordinates
      Returns:
      Range information, this is implementation dependent
    • calculateNewScale

      protected final double calculateNewScale(double length, double lowerBound, double upperBound)
      Calculates new scale for this axis. This should not affect any properties of this axis.
      Parameters:
      length - The display length of the axis
      lowerBound - The lower bound value
      upperBound - The upper bound value
      Returns:
      new scale to fit the range from lower bound to upper bound in the given display length
    • autoRange

      protected Object autoRange(double minValue, double maxValue, double length, double labelSize)
      Called to set the upper and lower bound and anything else that needs to be auto-ranged. This must not affect the state of the axis. Any results of the auto-ranging should be returned in the range object. This will we passed to setRange() if it has been decided to adopt this range for this axis.
      Parameters:
      minValue - The min data value that needs to be plotted on this axis
      maxValue - The max data value that needs to be plotted on this axis
      length - The length of the axis in display coordinates
      labelSize - The approximate average size a label takes along the axis
      Returns:
      The calculated range
    • calculateMinorTickMarks

      protected abstract List<T> calculateMinorTickMarks()
      Calculates a list of the data values for every minor tick mark
      Returns:
      List of data values where to draw minor tick marks
    • tickMarksUpdated

      protected void tickMarksUpdated()
      Called during layout if the tickmarks have been updated, allowing subclasses to do anything they need to in reaction.
      Overrides:
      tickMarksUpdated in class Axis<T extends Number>
    • layoutChildren

      protected void layoutChildren()
      Invoked during the layout pass to layout this axis and all its content.
      Overrides:
      layoutChildren in class Axis<T extends Number>
    • invalidateRange

      public void invalidateRange(List<T> data)
      Called when the data has changed and the range may not be valid anymore. This is only called by the chart if isAutoRanging() returns true. If we are auto ranging it will cause layout to be requested and auto ranging to happen on next layout pass.
      Overrides:
      invalidateRange in class Axis<T extends Number>
      Parameters:
      data - The current set of all data that needs to be plotted on this axis
    • getDisplayPosition

      public double getDisplayPosition(T value)
      Gets 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.
      Specified by:
      getDisplayPosition in class Axis<T extends Number>
      Parameters:
      value - The data value to work out display position for
      Returns:
      display position
    • getValueForDisplay

      public T getValueForDisplay(double displayPosition)
      Gets 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 class Axis<T extends Number>
      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()
      Gets the display position of the zero line along this axis.
      Specified by:
      getZeroPosition in class Axis<T extends Number>
      Returns:
      display position or Double.NaN if zero is not in current range;
    • isValueOnAxis

      public boolean isValueOnAxis(T value)
      Checks if the given value is plottable on this axis
      Specified by:
      isValueOnAxis in class Axis<T extends Number>
      Parameters:
      value - The value to check if its on axis
      Returns:
      true if the given value is plottable on this axis
    • toNumericValue

      public double toNumericValue(T value)
      All axis values must be representable by some numeric value. This gets the numeric value for a given data value.
      Specified by:
      toNumericValue in class Axis<T extends Number>
      Parameters:
      value - The data value to convert
      Returns:
      Numeric value for the given data value
    • toRealValue

      public T toRealValue(double value)
      All axis values must be representable by some numeric value. This gets the data value for a given numeric value.
      Specified by:
      toRealValue in class Axis<T extends Number>
      Parameters:
      value - The numeric value to convert
      Returns:
      Data value for given numeric value
    • getClassCssMetaData

      public static List<CssMetaData<? extends Styleable,?>> getClassCssMetaData()
      Gets the CssMetaData associated with this class, which may include the CssMetaData of its superclasses.
      Returns:
      the CssMetaData
      Since:
      JavaFX 8.0
    • getCssMetaData

      public List<CssMetaData<? extends Styleable,?>> getCssMetaData()
      This method should delegate to Node.getClassCssMetaData() so that a Node's CssMetaData can be accessed without the need for reflection.
      Specified by:
      getCssMetaData in interface Styleable
      Overrides:
      getCssMetaData in class Axis<T extends Number>
      Returns:
      The CssMetaData associated with this node, which may include the CssMetaData of its superclasses.
      Since:
      JavaFX 8.0