Class LinearScaleTicks2
- java.lang.Object
-
- org.eclipse.nebula.visualization.xygraph.linearscale.LinearScaleTicks2
-
- All Implemented Interfaces:
ITicksProvider
public class LinearScaleTicks2 extends java.lang.Object implements ITicksProvider
Class to represent a major tick for axes with scientific notation. This tick provider is used if aDAxisis created.
-
-
Field Summary
Fields Modifier and Type Field Description private static doubleLAST_STEP_FRACfraction of major tick step between 9 and 10private static intMAX_TICKSprivate intmaxHeightthe maximum height of tick labelsprivate intmaxWidththe maximum width of tick labelsprivate static intMIN_TICKSprotected java.util.ArrayList<java.lang.Integer>minorPositionsthe array of minor tick positions in pixelsprivate static java.lang.StringMINUSstatic java.lang.StringNAMEThe name of this tick providerprotected IScaleProviderscalethe scaleprivate booleanshowMaxLabeldefault: show max labelprivate booleanshowMinLabeldefault: show min labelprivate static intTICKMINDIST_IN_PIXELS_Xprivate static intTICKMINDIST_IN_PIXELS_Yprotected java.util.List<Tick>ticksthe list of ticks marksprivate booleanticksIndexBased
-
Constructor Summary
Constructors Constructor Description LinearScaleTicks2(DAxis scale)constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetDefaultFormatPattern(double min, double max)intgetHeadMargin()java.lang.StringgetLabel(int index)intgetLabelPosition(int index)java.util.List<java.lang.String>getLabels()intgetMajorCount()intgetMaxHeight()intgetMaxWidth()intgetMinorCount()intgetMinorPosition(int index)intgetPosition(int index)java.util.List<java.lang.Integer>getPositions()Gets the tick positions.intgetTailMargin()doublegetValue(int index)java.util.List<java.lang.Boolean>getVisibilities()booleanisShowMaxLabel()Shows the maximum value of the range as a labelbooleanisShowMinLabel()Shows the minimum value of the range as a labelbooleanisVisible(int index)voidsetShowMaxLabel(boolean showMaxLabel)sets the visibility of the maximum labelvoidsetShowMinLabel(boolean showMinLabel)Sets the visibility of the minimum labelvoidsetTicksIndexBased(boolean isTicksIndexBased)Rangeupdate(double min, double max, int length)Update ticks.private booleanupdateLabelPositionsAndCheckGaps(int length, int hMargin, int tMargin)Update positions and max dimensions of tick labelsprivate voidupdateMinorTicks(int end)
-
-
-
Field Detail
-
NAME
public static final java.lang.String NAME
The name of this tick provider- See Also:
- Constant Field Values
-
ticks
protected java.util.List<Tick> ticks
the list of ticks marks
-
maxWidth
private int maxWidth
the maximum width of tick labels
-
maxHeight
private int maxHeight
the maximum height of tick labels
-
minorPositions
protected java.util.ArrayList<java.lang.Integer> minorPositions
the array of minor tick positions in pixels
-
scale
protected IScaleProvider scale
the scale
-
ticksIndexBased
private boolean ticksIndexBased
-
showMaxLabel
private boolean showMaxLabel
default: show max label
-
showMinLabel
private boolean showMinLabel
default: show min label
-
TICKMINDIST_IN_PIXELS_X
private static final int TICKMINDIST_IN_PIXELS_X
- See Also:
- Constant Field Values
-
TICKMINDIST_IN_PIXELS_Y
private static final int TICKMINDIST_IN_PIXELS_Y
- See Also:
- Constant Field Values
-
MAX_TICKS
private static final int MAX_TICKS
- See Also:
- Constant Field Values
-
MIN_TICKS
private static final int MIN_TICKS
- See Also:
- Constant Field Values
-
MINUS
private static final java.lang.String MINUS
- See Also:
- Constant Field Values
-
LAST_STEP_FRAC
private static final double LAST_STEP_FRAC
fraction of major tick step between 9 and 10
-
-
Constructor Detail
-
LinearScaleTicks2
public LinearScaleTicks2(DAxis scale)
constructor- Parameters:
scale-
-
-
Method Detail
-
getPositions
public java.util.List<java.lang.Integer> getPositions()
Description copied from interface:ITicksProviderGets the tick positions.- Specified by:
getPositionsin interfaceITicksProvider- Returns:
- the tick positions
-
getVisibilities
public java.util.List<java.lang.Boolean> getVisibilities()
- Specified by:
getVisibilitiesin interfaceITicksProvider- Returns:
- the tick visibilities
-
getLabels
public java.util.List<java.lang.String> getLabels()
- Specified by:
getLabelsin interfaceITicksProvider- Returns:
- the tick labels
-
getPosition
public int getPosition(int index)
- Specified by:
getPositionin interfaceITicksProvider- Returns:
- tick position
-
getLabelPosition
public int getLabelPosition(int index)
- Specified by:
getLabelPositionin interfaceITicksProvider- Returns:
- label position
-
getValue
public double getValue(int index)
- Specified by:
getValuein interfaceITicksProvider- Returns:
- tick value
-
getLabel
public java.lang.String getLabel(int index)
- Specified by:
getLabelin interfaceITicksProvider- Returns:
- tick label
-
isVisible
public boolean isVisible(int index)
- Specified by:
isVisiblein interfaceITicksProvider- Returns:
- true if tick is visible
-
getMajorCount
public int getMajorCount()
- Specified by:
getMajorCountin interfaceITicksProvider- Returns:
- number of major ticks
-
getMinorCount
public int getMinorCount()
- Specified by:
getMinorCountin interfaceITicksProvider- Returns:
- number of minor ticks
-
getMinorPosition
public int getMinorPosition(int index)
- Specified by:
getMinorPositionin interfaceITicksProvider- Returns:
- minor tick position
-
getMaxWidth
public int getMaxWidth()
- Specified by:
getMaxWidthin interfaceITicksProvider- Returns:
- maximum width in pixels of tick labels
-
getMaxHeight
public int getMaxHeight()
- Specified by:
getMaxHeightin interfaceITicksProvider- Returns:
- maximum height in pixels of tick labels
-
isShowMaxLabel
public boolean isShowMaxLabel()
Description copied from interface:ITicksProviderShows the maximum value of the range as a label- Specified by:
isShowMaxLabelin interfaceITicksProvider- Returns:
- true (default) if shown
-
setShowMaxLabel
public void setShowMaxLabel(boolean showMaxLabel)
Description copied from interface:ITicksProvidersets the visibility of the maximum label- Specified by:
setShowMaxLabelin interfaceITicksProvider
-
isShowMinLabel
public boolean isShowMinLabel()
Description copied from interface:ITicksProviderShows the minimum value of the range as a label- Specified by:
isShowMinLabelin interfaceITicksProvider- Returns:
- true (default) if shown
-
setShowMinLabel
public void setShowMinLabel(boolean showMinLabel)
Description copied from interface:ITicksProviderSets the visibility of the minimum label- Specified by:
setShowMinLabelin interfaceITicksProvider
-
update
public Range update(double min, double max, int length)
Description copied from interface:ITicksProviderUpdate ticks.- Specified by:
updatein interfaceITicksProvider- Returns:
- null unless the provider has not had cause to change the range - in which case, the new range is returned.
-
getDefaultFormatPattern
public java.lang.String getDefaultFormatPattern(double min, double max)- Specified by:
getDefaultFormatPatternin interfaceITicksProvider- Returns:
- default format pattern for labels
-
getHeadMargin
public int getHeadMargin()
- Specified by:
getHeadMarginin interfaceITicksProvider- Returns:
- margin in pixel between edge of client area and head of axis line
-
getTailMargin
public int getTailMargin()
- Specified by:
getTailMarginin interfaceITicksProvider- Returns:
- margin in pixel between edge of client area and tail of axis line
-
updateLabelPositionsAndCheckGaps
private boolean updateLabelPositionsAndCheckGaps(int length, int hMargin, int tMargin)Update positions and max dimensions of tick labels- Returns:
- true if there is no overlaps
-
updateMinorTicks
private void updateMinorTicks(int end)
-
setTicksIndexBased
public void setTicksIndexBased(boolean isTicksIndexBased)
- Parameters:
isTicksIndexBased- if true, make ticks based on axis dataset indexes
-
-