Class TickFactory
- java.lang.Object
-
- org.eclipse.nebula.visualization.xygraph.linearscale.TickFactory
-
public class TickFactory extends java.lang.ObjectTick factory produces the different axis ticks. When specifying a format and given the screen size parameters and range it will return a list of Ticks
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTickFactory.TickFormattingtick formatting modes
-
Field Summary
Fields Modifier and Type Field Description private static java.math.BigDecimalBREL_ERRORprivate static intDIGITS_LOWER_LIMITlimit for number of zeros to display right of decimal pointprivate static intDIGITS_UPPER_LIMITlimit for number of digits to display left of decimal pointprivate static java.math.BigDecimalEPSILONprivate TickFactory.TickFormattingformatOfTicksprivate doublegraphMaxprivate doublegraphMinprivate static intHIGHEST_LOG_10private static java.text.DecimalFormatINDEX_FORMATprivate booleanisReversedprivate static intLOWER_LOG_10private static intLOWEST_LOG_10private intnumberOfIntervalsprivate static doubleREL_ERRORprivate static doubleROUND_FRACTIONfraction of denominator to round toprivate IScaleProviderscaleprivate java.lang.StringtickFormat
-
Constructor Summary
Constructors Constructor Description TickFactory(IScaleProvider scale)TickFactory(TickFactory.TickFormatting format, IScaleProvider scale)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static booleancompare(boolean isGreaterThan, double a, double b)private voidcreateFormatString(int precision, boolean useExponent)private intdetermineNumLogTicks(double min, double max, int maxTicks, boolean allowMinMaxOver)private doubledetermineNumTicks(double min, double max, int maxTicks, boolean allowMinMaxOver)private static java.math.BigDecimaldivide(java.math.BigDecimal dividend, int divisor)java.util.List<Tick>generateIndexBasedTicks(double min, double max, int maxTicks)Generate a list of ticks that span range given by min and max.java.util.List<Tick>generateLogTicks(double min, double max, int maxTicks, boolean allowMinMaxOver, boolean tight)java.util.List<Tick>generateTicks(double min, double max, int maxTicks, boolean allowMinMaxOver, boolean tight)Generate a list of ticks that span range given by min and max.private java.lang.StringgetTickString(double value)private booleaninRange(double x, double min, double max)private booleaninRangeLog(double x, double min, double max)private static intlog10(java.math.BigDecimal x)protected static java.math.BigDecimalnicenum(java.math.BigDecimal x, boolean round)protected static doubleroundDown(java.math.BigDecimal numerator, java.math.BigDecimal denominator)Round numerator down to multiples of denominatorsprotected static doubleroundUp(java.math.BigDecimal numerator, java.math.BigDecimal denominator)Round numerator up to multiples of denominators
-
-
-
Field Detail
-
formatOfTicks
private TickFactory.TickFormatting formatOfTicks
-
EPSILON
private static final java.math.BigDecimal EPSILON
-
DIGITS_UPPER_LIMIT
private static final int DIGITS_UPPER_LIMIT
limit for number of digits to display left of decimal point- See Also:
- Constant Field Values
-
DIGITS_LOWER_LIMIT
private static final int DIGITS_LOWER_LIMIT
limit for number of zeros to display right of decimal point- See Also:
- Constant Field Values
-
ROUND_FRACTION
private static final double ROUND_FRACTION
fraction of denominator to round to- See Also:
- Constant Field Values
-
BREL_ERROR
private static final java.math.BigDecimal BREL_ERROR
-
REL_ERROR
private static final double REL_ERROR
-
graphMin
private double graphMin
-
graphMax
private double graphMax
-
tickFormat
private java.lang.String tickFormat
-
scale
private IScaleProvider scale
-
numberOfIntervals
private int numberOfIntervals
-
isReversed
private boolean isReversed
-
INDEX_FORMAT
private static final java.text.DecimalFormat INDEX_FORMAT
-
LOWEST_LOG_10
private static final int LOWEST_LOG_10
- See Also:
- Constant Field Values
-
LOWER_LOG_10
private static final int LOWER_LOG_10
- See Also:
- Constant Field Values
-
HIGHEST_LOG_10
private static final int HIGHEST_LOG_10
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
TickFactory
public TickFactory(IScaleProvider scale)
- Parameters:
format-
-
TickFactory
public TickFactory(TickFactory.TickFormatting format, IScaleProvider scale)
- Parameters:
format-
-
-
Method Detail
-
getTickString
private java.lang.String getTickString(double value)
-
createFormatString
private void createFormatString(int precision, boolean useExponent)
-
roundDown
protected static double roundDown(java.math.BigDecimal numerator, java.math.BigDecimal denominator)Round numerator down to multiples of denominators- Parameters:
numerator-denominator-- Returns:
- rounded down value
-
roundUp
protected static double roundUp(java.math.BigDecimal numerator, java.math.BigDecimal denominator)Round numerator up to multiples of denominators- Parameters:
numerator-denominator-- Returns:
- rounded up value
-
log10
private static int log10(java.math.BigDecimal x)
- Parameters:
x-- Returns:
- floor of log 10
-
divide
private static java.math.BigDecimal divide(java.math.BigDecimal dividend, int divisor)
-
nicenum
protected static java.math.BigDecimal nicenum(java.math.BigDecimal x, boolean round)- Parameters:
x-round- if true, then round else take ceiling- Returns:
- a nice number
-
determineNumTicks
private double determineNumTicks(double min, double max, int maxTicks, boolean allowMinMaxOver)
-
inRange
private boolean inRange(double x, double min, double max)
-
generateTicks
public java.util.List<Tick> generateTicks(double min, double max, int maxTicks, boolean allowMinMaxOver, boolean tight)
Generate a list of ticks that span range given by min and max. The maximum number of ticks is exceed by one in the case where the range straddles zero.- Parameters:
min-max-maxTicks-allowMinMaxOver- allow min/maximum overwritetight- if true then remove ticks outside range- Returns:
- a list of the ticks for the axis
-
compare
private static boolean compare(boolean isGreaterThan, double a, double b)
-
generateIndexBasedTicks
public java.util.List<Tick> generateIndexBasedTicks(double min, double max, int maxTicks)
Generate a list of ticks that span range given by min and max.- Parameters:
min-max-maxTicks-- Returns:
- a list of the ticks for the axis
-
determineNumLogTicks
private int determineNumLogTicks(double min, double max, int maxTicks, boolean allowMinMaxOver)
-
inRangeLog
private boolean inRangeLog(double x, double min, double max)
-
generateLogTicks
public java.util.List<Tick> generateLogTicks(double min, double max, int maxTicks, boolean allowMinMaxOver, boolean tight)
- Parameters:
min- (must be >0)max- (must be >0)maxTicks-allowMinMaxOver- allow min/maximum overwritetight- if true then remove ticks outside range- Returns:
- a list of the ticks for the axis
-
-