Class AxisTickCalculator_

java.lang.Object
org.knowm.xchart.internal.chartpart.AxisTickCalculator_
All Implemented Interfaces:
AxisTickCalculator
Direct Known Subclasses:
AxisTickCalculator_Callback, AxisTickCalculator_Category, AxisTickCalculator_Date, AxisTickCalculator_Logarithmic, AxisTickCalculator_Number

public abstract class AxisTickCalculator_ extends Object implements AxisTickCalculator
  • Field Details

    • tickLocations

      final List<Double> tickLocations
      the List of tick label position in pixels
    • tickLabels

      final List<String> tickLabels
      the List of tick label values
    • axisDirection

      final Axis.Direction axisDirection
    • workingSpace

      final double workingSpace
    • minValue

      final double minValue
    • maxValue

      final double maxValue
    • axisValues

      List<Double> axisValues
    • styler

      final AxesChartStyler styler
    • axisFormat

      Format axisFormat
  • Constructor Details

    • AxisTickCalculator_

      AxisTickCalculator_(Axis.Direction axisDirection, double workingSpace, double minValue, double maxValue, AxesChartStyler styler)
      Constructor
      Parameters:
      axisDirection -
      workingSpace -
      minValue -
      maxValue -
      styler -
    • AxisTickCalculator_

      AxisTickCalculator_(Axis.Direction axisDirection, double workingSpace, double minValue, double maxValue, List<Double> axisValues, AxesChartStyler styler)
  • Method Details

    • getFirstPosition

      double getFirstPosition(double gridStep)
      Gets the first position
      Parameters:
      gridStep -
      Returns:
    • getTickLocations

      public List<Double> getTickLocations()
      Specified by:
      getTickLocations in interface AxisTickCalculator
    • getTickLabels

      public List<String> getTickLabels()
      Specified by:
      getTickLabels in interface AxisTickCalculator
    • willLabelsFitInTickSpaceHint

      boolean willLabelsFitInTickSpaceHint(List<String> tickLabels, int tickSpacingHint)
      Given the generated tickLabels, will they fit side-by-side without overlapping each other and looking bad? Sometimes the given tickSpacingHint is simply too small.
      Parameters:
      tickLabels -
      tickSpacingHint -
      Returns:
    • getAxisFormat

      public Format getAxisFormat()
      Specified by:
      getAxisFormat in interface AxisTickCalculator
    • calculate

      protected void calculate()
    • areValuesEquallySpaced

      private boolean areValuesEquallySpaced(List<Double> values)
    • calculateForEquallySpacedAxisValues

      private void calculateForEquallySpacedAxisValues(double tickSpace, double margin)
      Calculates the ticks so that they only appear at positions where data is available.
      Parameters:
      tickSpace - a percentage of the working space available for ticks
      margin - where the tick should begin in the working space in pixels
    • areAllTickLabelsUnique

      boolean areAllTickLabelsUnique(List<?> tickLabels)
    • isNumberFormatChoppingDecimals

      private boolean isNumberFormatChoppingDecimals(double axisMax, double axisMin)