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 java.lang.Object implements AxisTickCalculator
-
-
Field Summary
Fields Modifier and Type Field Description (package private) Axis.DirectionaxisDirection(package private) java.text.FormataxisFormat(package private) java.util.List<java.lang.Double>axisValues(package private) doublemaxValue(package private) doubleminValue(package private) AxesChartStylerstyler(package private) java.util.List<java.lang.String>tickLabelsthe List of tick label values(package private) java.util.List<java.lang.Double>tickLocationsthe List of tick label position in pixels(package private) doubleworkingSpace
-
Constructor Summary
Constructors Constructor Description AxisTickCalculator_(Axis.Direction axisDirection, double workingSpace, double minValue, double maxValue, java.util.List<java.lang.Double> axisValues, AxesChartStyler styler)AxisTickCalculator_(Axis.Direction axisDirection, double workingSpace, double minValue, double maxValue, AxesChartStyler styler)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) booleanareAllTickLabelsUnique(java.util.List<?> tickLabels)private booleanareValuesEquallySpaced(java.util.List<java.lang.Double> values)protected voidcalculate()private voidcalculateForEquallySpacedAxisValues(double tickSpace, double margin)Calculates the ticks so that they only appear at positions where data is available.java.text.FormatgetAxisFormat()(package private) doublegetFirstPosition(double gridStep)Gets the first positionjava.util.List<java.lang.String>getTickLabels()java.util.List<java.lang.Double>getTickLocations()private booleanisNumberFormatChoppingDecimals(double axisMax, double axisMin)(package private) booleanwillLabelsFitInTickSpaceHint(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.
-
-
-
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
-
axisDirection
final Axis.Direction axisDirection
-
workingSpace
final double workingSpace
-
minValue
final double minValue
-
maxValue
final double maxValue
-
axisValues
java.util.List<java.lang.Double> axisValues
-
styler
final AxesChartStyler styler
-
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:
-
getTickLocations
public java.util.List<java.lang.Double> getTickLocations()
- Specified by:
getTickLocationsin interfaceAxisTickCalculator
-
getTickLabels
public java.util.List<java.lang.String> getTickLabels()
- Specified by:
getTickLabelsin interfaceAxisTickCalculator
-
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:
-
getAxisFormat
public java.text.Format getAxisFormat()
- Specified by:
getAxisFormatin interfaceAxisTickCalculator
-
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 ticksmargin- 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)
-
-