Class AxisTickCalculator_

    • Field Detail

      • tickLocations

        final java.util.List<java.lang.Double> tickLocations
        the List of tick label position in pixels
      • tickLabels

        final java.util.List<java.lang.String> tickLabels
        the List of tick label values
      • workingSpace

        final double workingSpace
      • minValue

        final double minValue
      • maxValue

        final double maxValue
      • axisValues

        java.util.List<java.lang.Double> axisValues
      • axisFormat

        java.text.Format axisFormat
    • Constructor Detail

      • 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,
                            java.util.List<java.lang.Double> axisValues,
                            AxesChartStyler styler)
    • Method Detail

      • getFirstPosition

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

        boolean willLabelsFitInTickSpaceHint​(java.util.List<java.lang.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:
      • calculate

        protected void calculate()
      • areValuesEquallySpaced

        private boolean areValuesEquallySpaced​(java.util.List<java.lang.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​(java.util.List<?> tickLabels)
      • isNumberFormatChoppingDecimals

        private boolean isNumberFormatChoppingDecimals​(double axisMax,
                                                       double axisMin)