org.jplot2d.element
Interface AxisTickManager
-
- All Superinterfaces:
- Element
- All Known Subinterfaces:
- AxisTickManagerEx
- All Known Implementing Classes:
- AxisTickManagerImpl
public interface AxisTickManager extends Element
Manage ticks of axes. Axes may have the same tick manager. Their ticks are exactly same.The tick decision rules
- if autoValues is false, the values can be set by
#setFixedTickValues(double[]) - if autoInterval is false, the interval can be set by
setTickInterval(double) - the interval is calculated according to tick number. If autoAdjustNumber is true, the number can be adjusted to derive better values.
-
-
Field Summary
Fields Modifier and Type Field and Description static intDEFAULT_TICKS_NUMBER
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method and Description intgetActualMinorTicks()Return the number of minor ticks displayed between two major ticks.Axis[]getAxes()Returns all axes whose ticks are controlled by this tick manager.AxisTransformgetAxisTransform()java.lang.String[]getFixedLabelStrings()Returns the user assigned substitute labels.java.lang.ObjectgetFixedMinorTickValues()Return an array ofdoublerepresenting the fixed minor tick positions set bysetFixedMinorTickValues(Object)java.lang.ObjectgetFixedTickValues()Return an array of number to representing the fixed tick positions set bysetFixedTickValues(Object)java.lang.StringgetLabelFormat()Returns the printf-style format of the labels of ticks.intgetLabelInterval()Get the label interval.java.lang.String[]getLabelStrings()Return an array of string representing the labels shown in the axis.java.text.FormatgetLabelTextFormat()Returns the format of the labels of ticks.intgetMinorTicks()Return the number of minor ticks displayed between two major ticks.java.lang.ObjectgetMinorTickValues()Return an array of number representing the minor tick positions shown in the axis.RangegetRange()Returns the tick range of this axis.doublegetTickInterval()Return the interval in axis units between two ticks.doublegetTickOffset()Return the offset of ticks.intgetTicks()Returns the proposed number of ticks.AxisTickTransformgetTickTransform()Returns the AxisTickTransform, which defines The relationship between user value and tick value.java.lang.ObjectgetTickValues()Return an array of number representing the tick positions shown in the axis.booleanisAutoAdjustTicks()Returns true if the tick number is allowed to be automatically reduced to avoid tick label overlaps.booleanisAutoLabelFormat()Returnstrueif labels format is auto calculated or assigned bysetLabelFormat(String)booleanisAutoMinorTicks()Returnstrueis the minor ticks number is derived from tick interval.booleanisAutoTickInterval()Returns true if the tick interval is auto calculated from tick number and range, or false if the tick interval is assigned bysetTickInterval(double)booleanisAutoTickValues()Returnstrueif tick values is auto calculated from interval, orfalseif tick values is assigned by#setFixedTickValues(double[]).voidsetAutoAdjustTicks(boolean flag)Set to true to allow the tick number to be automatically reduced to avoid tick label overlaps.voidsetAutoLabelFormat(boolean alf)Setstrueto auto calculate proper labels format.voidsetAutoMinorTicks(boolean flag)When autoTickInterval is set to true: if tick interval is 1, the minor interval is 0.2, create 4 minor ticks if tick interval is 2, the minor interval is 0.5, create 3 minor ticks if tick interval is 3, the minor interval is 1, create 2 minor ticks if tick interval is 4, the minor interval is 1, create 3 minor ticks if tick interval is 5, the minor interval is 1, create 4 minor ticks if tick interval is 6, the minor interval is 2, create 2 minor ticks if tick interval is 7, the minor interval is 1, create 6 minor ticks if tick interval is 8, the minor interval is 2, create 3 minor ticks if tick interval is 9, the minor interval is 3, create 2 minor ticks if tick interval is not integer, create 0 minor ticks when autoTickInterval is set to false: minor ticks is exactly the user set by#setMinorTicks(Integer).voidsetAutoTickInterval(boolean ati)Set totrueto indicate the tick interval need to be auto calculated, orfalseto disable auto-calculation and keep using the current interval.voidsetAutoTickValues(boolean atv)Set totrueto indicate the tick values need to be auto calculated orfalseto use user assigned values.voidsetAxisTransform(AxisTransform rangeManager)voidsetFixedLabelStrings(java.lang.String[] labels)Set an array of String to substitute the labels of the fixed ticks.voidsetFixedMinorTickValues(java.lang.Object minorValues)Set an array ofdouble.voidsetFixedTickValues(java.lang.Object values)Set an array of values that ticks will show.voidsetLabelFormat(java.lang.String format)Sets the printf-style format that is used to format the tick labels from tick values.voidsetLabelInterval(int n)Set the tick labels displayed after n ticksvoidsetLabelTextFormat(java.text.Format format)Sets the format object that is used to format the tick labels from tick values.voidsetMinorTicks(int minors)Set the number of minor ticks displayed between two major ticks.voidsetRange(Range range)Set the tick range of the axis.voidsetTickInterval(double interval)Set the interval in axis units between two ticks.voidsetTickOffset(double offset)voidsetTicks(int tickNumber)Set the proposed number of ticks in the axis.voidsetTickTransform(AxisTickTransform transform)Sets the AxisTickTransform, which defines The relationship between user value and tick value.-
Methods inherited from interface org.jplot2d.element.Element
getEnvironment, getId, getParent
-
-
-
-
Field Detail
-
DEFAULT_TICKS_NUMBER
static final int DEFAULT_TICKS_NUMBER
- See Also:
- Constant Field Values
-
-
Method Detail
-
getAxisTransform
AxisTransform getAxisTransform()
-
setAxisTransform
void setAxisTransform(AxisTransform rangeManager)
-
getAxes
Axis[] getAxes()
Returns all axes whose ticks are controlled by this tick manager.- Returns:
- all axes whose ticks are controlled by this tick manager
-
getTickTransform
AxisTickTransform getTickTransform()
Returns the AxisTickTransform, which defines The relationship between user value and tick value.- Returns:
- the AxisTickTransform.
-
setTickTransform
void setTickTransform(AxisTickTransform transform)
Sets the AxisTickTransform, which defines The relationship between user value and tick value. The AuxTransform must be efficient immutable.- Parameters:
transform- the AxisTickTransform object.
-
getRange
Range getRange()
Returns the tick range of this axis.- Returns:
- the tick range of this axis.
-
setRange
void setRange(Range range)
Set the tick range of the axis.- Parameters:
range- the new tick range of the axis
-
isAutoTickValues
boolean isAutoTickValues()
Returnstrueif tick values is auto calculated from interval, orfalseif tick values is assigned by#setFixedTickValues(double[]).- Returns:
trueif tick values is auto calculated.
-
setAutoTickValues
void setAutoTickValues(boolean atv)
Set totrueto indicate the tick values need to be auto calculated orfalseto use user assigned values.- Parameters:
atv- the flag
-
getFixedTickValues
java.lang.Object getFixedTickValues()
Return an array of number to representing the fixed tick positions set bysetFixedTickValues(Object)- Returns:
- the labels of the ticks
-
setFixedTickValues
void setFixedTickValues(java.lang.Object values)
Set an array of values that ticks will show. If the given values is null or a empty array, no tick will be drawn.The autoValues will be set to false when this method is called. The minor values will be cleared by this method.
- Parameters:
values- the values in user unit where ticks are displayed.
-
getFixedMinorTickValues
java.lang.Object getFixedMinorTickValues()
Return an array ofdoublerepresenting the fixed minor tick positions set bysetFixedMinorTickValues(Object)- Returns:
- the labels of the ticks
-
setFixedMinorTickValues
void setFixedMinorTickValues(java.lang.Object minorValues)
Set an array ofdouble. If the given values is null or a empty array, no tick will be drawn.This method must be called after
#setFixedTickValues(double[])is called.#setFixedTickValues(double[])calling will clear the minor values.- Parameters:
values- the values in user unit where minor ticks are displayed.
-
isAutoTickInterval
boolean isAutoTickInterval()
Returns true if the tick interval is auto calculated from tick number and range, or false if the tick interval is assigned bysetTickInterval(double)- Returns:
- if the tick number is auto calculated.
-
setAutoTickInterval
void setAutoTickInterval(boolean ati)
Set totrueto indicate the tick interval need to be auto calculated, orfalseto disable auto-calculation and keep using the current interval.- Parameters:
ati- the flag
-
getTickInterval
double getTickInterval()
Return the interval in axis units between two ticks. For LOG axis, interval is the multiplying factor between two ticks.- Returns:
- the interval between two ticks
-
setTickInterval
void setTickInterval(double interval)
Set the interval in axis units between two ticks. It change the number of ticks displayed in the axis. For LOG axis, interval is the multiplying factor between two ticks.Setting a new interval will set autoInterval to
false.- Parameters:
interval- the interval between two major ticks- See Also:
#setAutoTickInterval(Boolean)
-
getTickOffset
double getTickOffset()
Return the offset of ticks.- Returns:
- the offset.
-
setTickOffset
void setTickOffset(double offset)
- Parameters:
offset- the offset of ticks
-
getTicks
int getTicks()
Returns the proposed number of ticks. The actual number may be different from the given number, to get nice tick values.- Returns:
- the number of ticks
-
setTicks
void setTicks(int tickNumber)
Set the proposed number of ticks in the axis. The actual number may be different from the given number, to get nice tick values. If the ticks may cause the tick interval close to precision limit, the actual ticks may be less than the given value without throw PrecisionException.- Parameters:
tickNumber- the number of ticks.
-
isAutoAdjustTicks
boolean isAutoAdjustTicks()
Returns true if the tick number is allowed to be automatically reduced to avoid tick label overlaps.- Returns:
- if the tick number is auto calculated.
-
setAutoAdjustTicks
void setAutoAdjustTicks(boolean flag)
Set to true to allow the tick number to be automatically reduced to avoid tick label overlaps.- Parameters:
flag-
-
isAutoMinorTicks
boolean isAutoMinorTicks()
Returnstrueis the minor ticks number is derived from tick interval.- Returns:
trueis the minor ticks number is derived from tick interval.
-
setAutoMinorTicks
void setAutoMinorTicks(boolean flag)
When autoTickInterval is set to true:- if tick interval is 1, the minor interval is 0.2, create 4 minor ticks
- if tick interval is 2, the minor interval is 0.5, create 3 minor ticks
- if tick interval is 3, the minor interval is 1, create 2 minor ticks
- if tick interval is 4, the minor interval is 1, create 3 minor ticks
- if tick interval is 5, the minor interval is 1, create 4 minor ticks
- if tick interval is 6, the minor interval is 2, create 2 minor ticks
- if tick interval is 7, the minor interval is 1, create 6 minor ticks
- if tick interval is 8, the minor interval is 2, create 3 minor ticks
- if tick interval is 9, the minor interval is 3, create 2 minor ticks
- if tick interval is not integer, create 0 minor ticks
#setMinorTicks(Integer). The Default number is zero, means not shown by default.- Parameters:
flag-
-
getMinorTicks
int getMinorTicks()
Return the number of minor ticks displayed between two major ticks. This method always returns the number set by#setMinorTicks(Integer), no matter if the actual number has been adjusted.- Returns:
- the number of minor ticks displayed
-
setMinorTicks
void setMinorTicks(int minors)
Set the number of minor ticks displayed between two major ticks. The actual number may be adjusted, and not equal the number set by this method.Setting a new minor number will set autoMinornumber to
false.- Parameters:
minors- the number of minor ticks displayed
-
getActualMinorTicks
int getActualMinorTicks()
Return the number of minor ticks displayed between two major ticks. This method returns the actual number, might be different form the number set by#setMinorTicks(Integer).- Returns:
- the number of minor ticks displayed
-
getTickValues
java.lang.Object getTickValues()
Return an array of number representing the tick positions shown in the axis.- Returns:
- the values of the ticks
-
getMinorTickValues
java.lang.Object getMinorTickValues()
Return an array of number representing the minor tick positions shown in the axis.- Returns:
- the values of the ticks
-
getLabelInterval
int getLabelInterval()
Get the label interval. The tick labels are displayed after that number of ticks- Returns:
- label interval
-
setLabelInterval
void setLabelInterval(int n)
Set the tick labels displayed after n ticks- Parameters:
n- label displayed each n ticks .
-
isAutoLabelFormat
boolean isAutoLabelFormat()
Returnstrueif labels format is auto calculated or assigned bysetLabelFormat(String)- Returns:
trueif labels format is auto calculated
-
setAutoLabelFormat
void setAutoLabelFormat(boolean alf)
Setstrueto auto calculate proper labels format. Or setsfalseto assign a label format bysetLabelFormat(String)- Parameters:
alf- the flag
-
getLabelTextFormat
java.text.Format getLabelTextFormat()
Returns the format of the labels of ticks.- Returns:
- the format of the labels.
-
setLabelTextFormat
void setLabelTextFormat(java.text.Format format)
Sets the format object that is used to format the tick labels from tick values. If this text format is null, the printf-style format will be used to format the labels.Setting a new labelTextFormat will set autoLabelFormat to
false- Parameters:
format- the format object
-
getLabelFormat
java.lang.String getLabelFormat()
Returns the printf-style format of the labels of ticks.- Returns:
- the format of the labels.
-
setLabelFormat
void setLabelFormat(java.lang.String format)
Sets the printf-style format that is used to format the tick labels from tick values. The syntax of format string is described inFormatter. Beside the standard Java formatter conversions, a special conversion 'm' can be used to produce labels in n_10^e format. The usage of conversion 'm' is like the standard conversion 'e'.Setting a new labelFormat will set autoLabelFormat to
false- Parameters:
format- the format string, or null to used the auto format.
-
getFixedLabelStrings
java.lang.String[] getFixedLabelStrings()
Returns the user assigned substitute labels.nullhas a special meaning of "undecided".- Returns:
- the user assigned substitute labels.
-
setFixedLabelStrings
void setFixedLabelStrings(java.lang.String[] labels)
Set an array of String to substitute the labels of the fixed ticks. If the length of the array is shorter then the number of fixed ticks, only the first ticks are changed, if the length of the array is longer then the number of ticks only the first labels are used. null in the array means not substitute the label. The given labels can be null or a empty array.If the tick is autoValues mode (a.k.a. no fixedValues assigned), the given fixedLabels will substitute the auto labels of visible ticks.
- Parameters:
labels- the new labels to be displayed in the ticks- See Also:
setFixedTickValues(Object)
-
getLabelStrings
java.lang.String[] getLabelStrings()
Return an array of string representing the labels shown in the axis.- Returns:
- the labels of the ticks
-
-
DMelt 3.0 © DataMelt by jWork.ORG