Class Ticks
- java.lang.Object
-
- org.pepstock.charba.client.commons.NativeObjectContainer
-
- org.pepstock.charba.client.commons.AbstractNode
-
- org.pepstock.charba.client.options.AbstractModel<AbstractScale,IsDefaultTicks>
-
- org.pepstock.charba.client.options.Ticks
-
- All Implemented Interfaces:
IsDefaultFontContainer,IsDefaultTicks,HasFont
public final class Ticks extends AbstractModel<AbstractScale,IsDefaultTicks> implements IsDefaultTicks, HasFont
All configuration for ticks of a chart.
It defines options for the tick marks that are generated by the axis.- Author:
- Andrea "Stock" Stocchero
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TickAligngetAlign()Returns the tick alignment along the axis.intgetAutoSkipPadding()Returns the padding between the ticks on the horizontal axis when autoSkip is enabled.
Note: Only applicable to horizontal scales.IsColorgetBackdropColor()Returns the color of label backdrops.StringgetBackdropColorAsString()Returns the color of label backdrops.PaddinggetBackdropPadding()Returns the padding of label backdrop.intgetCount()Returns the number of ticks to generate.
If specified, this overrides the automatic generation.CrossAligngetCrossAlign()Returns the tick alignment perpendicular to the axis.FontContainergetFontContainer()Returns a font container instance to use in the default methods of this interface.intgetLabelOffset()Returns the distance in pixels to offset the label from the center point of the tick (in the y direction for the x axis, and the x direction for the y axis).
Note: this can cause labels at the edges to be cropped by the edge of the canvas.MajorgetMajor()Returns the major element.intgetMaxRotation()Returns the maximum rotation for tick labels when rotating to condense labels.
Note: Rotation doesn't occur until necessary.intgetMaxTicksLimit()Returns the maximum number of ticks and grid to show.intgetMinRotation()Returns the minimum rotation for tick labels.
Note: Only applicable to horizontal scales.TicksNumberFormatgetNumberFormat()Returns the number formatting options.intgetPadding()Returns the padding between the tick label and the axis.
When set on a vertical axis, this applies in the horizontal (X) direction.
When set on a horizontal axis, this applies in the vertical (Y) direction.intgetPrecision()If defined and stepSize is not specified, the step size will be rounded to this many decimal places.intgetSampleSize()Returns the number of ticks to examine when deciding how many labels will fit.
Setting a smaller value will be faster, but may be less accurate when there is large variability in label length.TickSourcegetSource()Returns the property controls the ticks generation.doublegetStepSize()Returns the user defined fixed step size for the scale.IsColorgetTextStrokeColor()Returns the text stroke color.StringgetTextStrokeColorAsString()Returns the text stroke color as string.intgetTextStrokeWidth()Returns the text stroke width.intgetZ()Returns z-index of tick layer.booleanisAutoSkip()Iftrue, automatically calculates how many labels that can be shown and hides labels accordingly.
Turn it off to show all labels no matter whatbooleanisDisplay()Iftrue, show tick marks.booleanisIncludeBounds()Iftrue, the defined minimum and maximum values should be presented as ticks even if they are not "nice".booleanisMirror()Returns the flips tick labels around axis, displaying the labels inside the chart instead of outside.
Note: Only applicable to vertical scales.booleanisShowLabelBackdrop()Iftrue, draw a background behind the tick labels.voidsetAlign(TickAlign align)Sets the tick alignment along the axis.voidsetAutoSkip(boolean autoSkip)Iftrue, automatically calculates how many labels that can be shown and hides labels accordingly.
Turn it off to show all labels no matter whatvoidsetAutoSkipPadding(int autoSkipPadding)Sets the padding between the ticks on the horizontal axis when autoSkip is enabled.
Note: Only applicable to horizontal scales.voidsetBackdropColor(String backdropColor)Sets the color of label backdrops.voidsetBackdropColor(IsColor backdropColor)Sets the color of label backdrops.voidsetCount(int count)Sets the number of ticks to generate.
If specified, this overrides the automatic generation.voidsetCrossAlign(CrossAlign crossAlign)Sets the tick alignment perpendicular to the axis.voidsetDisplay(boolean display)Iftrue, show tick marks.voidsetIncludeBounds(boolean includeBounds)Iftrue, the defined min and maximum values should be presented as ticks even if they are not "nice"voidsetLabelOffset(int labelOffset)Sets the distance in pixels to offset the label from the center point of the tick (in the y direction for the x axis, and the x direction for the y axis).
Note: this can cause labels at the edges to be cropped by the edge of the canvas.voidsetMaxRotation(int maxRotation)Sets the maximum rotation for tick labels when rotating to condense labels.
Note: Rotation doesn't occur until necessary.
Note: Only applicable to horizontal scales.voidsetMaxTicksLimit(int maxTicksLimit)Sets the maximum number of ticks and grid to show.voidsetMinRotation(int minRotation)Sets the minimum rotation for tick labels.
Note: Only applicable to horizontal scales.voidsetMirror(boolean mirror)Sets the flips tick labels around axis, displaying the labels inside the chart instead of outside.
Note: Only applicable to vertical scales.voidsetPadding(int padding)Sets the padding between the tick label and the axis.
When set on a vertical axis, this applies in the horizontal (X) direction.
When set on a horizontal axis, this applies in the vertical (Y) direction.voidsetPrecision(int precision)If defined and stepSize is not specified, the step size will be rounded to this many decimal places.voidsetSampleSize(int sampleSize)Sets the number of ticks to examine when deciding how many labels will fit.
Setting a smaller value will be faster, but may be less accurate when there is large variability in label length.voidsetShowLabelBackdrop(boolean showLabelBackdrop)Iftrue, draw a background behind the tick labels.voidsetSource(TickSource source)Sets the property controls the ticks generation.voidsetStepSize(double stepSize)Sets the user defined fixed step size for the scale.voidsetTextStrokeColor(String color)Sets the text stroke color.voidsetTextStrokeColor(IsColor color)Sets the text stroke color.voidsetTextStrokeWidth(int textStrokeWidth)Sets the text stroke width.voidsetZ(int z)Sets z-index of tick layer.-
Methods inherited from class org.pepstock.charba.client.options.AbstractModel
getDefaultValues, getParent, loadPadding, setCallbackToModel, setCallbackToModel, setEventToModel
-
Methods inherited from class org.pepstock.charba.client.commons.AbstractNode
checkAndAddToParent, getChildKey, getParentNode, getRootNode, getUpdateListener, retrieveRoot, setArrayValueAndAddToParent, setArrayValueAndAddToParent, setArrayValueAndAddToParent, setElementAndAddToParent, setInternalCallbackToModel, setInternalCallbackToModel, setUpdateListener, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueOrArrayAndAddToParent, setValueOrArrayAndAddToParent, setValueOrArrayAndAddToParent, setValueOrArrayAndAddToParent, setValueOrArrayAndAddToParent, setValueOrArrayAndAddToParent, setValueOrArrayAndAddToParent, setValueOrArrayAndAddToParent, setValueOrArrayAndAddToParent, setValueOrArrayAndAddToParent
-
Methods inherited from class org.pepstock.charba.client.commons.NativeObjectContainer
checkAndGetColor, checkDefaultValuesArgument, empty, getArrayValue, getElement, getIncrementalId, getNativeChart, getNativeEvent, getNativeObject, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValueForMultipleKeyTypes, getValueForMultipleKeyTypes, getValueForMultipleKeyTypes, getValueOrArray, getValueOrArray, getValueOrArray, getValueOrArray, getValueOrArray, getValueOrArray, getValueOrArray, getValueOrArray, getValueOrArray, has, has, isType, keys, loadNativeObject, remove, remove, setArrayValue, setArrayValue, setArrayValue, setElement, setEmptyValue, setNewIncrementalId, setNewIncrementalId, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, toJSON, type
-
-
-
-
Method Detail
-
getFontContainer
public FontContainer getFontContainer()
Description copied from interface:HasFontReturns a font container instance to use in the default methods of this interface.- Specified by:
getFontContainerin interfaceHasFont- Returns:
- a font container instance
-
getMajor
public Major getMajor()
Returns the major element.- Specified by:
getMajorin interfaceIsDefaultTicks- Returns:
- the major
-
getNumberFormat
public TicksNumberFormat getNumberFormat()
Returns the number formatting options.- Specified by:
getNumberFormatin interfaceIsDefaultTicks- Returns:
- the number formatting options
-
getBackdropPadding
public Padding getBackdropPadding()
Returns the padding of label backdrop.- Specified by:
getBackdropPaddingin interfaceIsDefaultTicks- Returns:
- the padding of label backdrop
-
setDisplay
public void setDisplay(boolean display)
Iftrue, show tick marks.- Parameters:
display- iftrue, show tick marks.
-
isDisplay
public boolean isDisplay()
Iftrue, show tick marks.- Specified by:
isDisplayin interfaceIsDefaultTicks- Returns:
- if
true, show tick marks.
-
setAutoSkip
public void setAutoSkip(boolean autoSkip)
Iftrue, automatically calculates how many labels that can be shown and hides labels accordingly.
Turn it off to show all labels no matter what- Parameters:
autoSkip- iftrue, automatically calculates how many labels that can be shown and hides labels accordingly.
Turn it off to show all labels no matter what
-
isAutoSkip
public boolean isAutoSkip()
Iftrue, automatically calculates how many labels that can be shown and hides labels accordingly.
Turn it off to show all labels no matter what- Specified by:
isAutoSkipin interfaceIsDefaultTicks- Returns:
- if
true, automatically calculates how many labels that can be shown and hides labels accordingly.
Turn it off to show all labels no matter what.
-
setAutoSkipPadding
public void setAutoSkipPadding(int autoSkipPadding)
Sets the padding between the ticks on the horizontal axis when autoSkip is enabled.
Note: Only applicable to horizontal scales.- Parameters:
autoSkipPadding- padding between the ticks on the horizontal axis when autoSkip is enabled.
Note: Only applicable to horizontal scales.
-
getAutoSkipPadding
public int getAutoSkipPadding()
Returns the padding between the ticks on the horizontal axis when autoSkip is enabled.
Note: Only applicable to horizontal scales.- Specified by:
getAutoSkipPaddingin interfaceIsDefaultTicks- Returns:
- padding between the ticks on the horizontal axis when autoSkip is enabled.
Note: Only applicable to horizontal scales.
-
setIncludeBounds
public void setIncludeBounds(boolean includeBounds)
Iftrue, the defined min and maximum values should be presented as ticks even if they are not "nice"- Parameters:
includeBounds- iftrue, the defined min and maximum values should be presented as ticks even if they are not "nice"
-
isIncludeBounds
public boolean isIncludeBounds()
Iftrue, the defined minimum and maximum values should be presented as ticks even if they are not "nice".- Specified by:
isIncludeBoundsin interfaceIsDefaultTicks- Returns:
- if
true, the defined min and maximum values should be presented as ticks even if they are not "nice"
-
setLabelOffset
public void setLabelOffset(int labelOffset)
Sets the distance in pixels to offset the label from the center point of the tick (in the y direction for the x axis, and the x direction for the y axis).
Note: this can cause labels at the edges to be cropped by the edge of the canvas.- Parameters:
labelOffset- the distance in pixels to offset the label from the center point of the tick (in the y direction for the x axis, and the x direction for the y axis)
-
getLabelOffset
public int getLabelOffset()
Returns the distance in pixels to offset the label from the center point of the tick (in the y direction for the x axis, and the x direction for the y axis).
Note: this can cause labels at the edges to be cropped by the edge of the canvas.- Specified by:
getLabelOffsetin interfaceIsDefaultTicks- Returns:
- the distance in pixels to offset the label from the center point of the tick (in the y direction for the x axis, and the x direction for the y axis).
-
setCount
public void setCount(int count)
Sets the number of ticks to generate.
If specified, this overrides the automatic generation.- Parameters:
count- the number of ticks to generate.
If specified, this overrides the automatic generation
-
getCount
public int getCount()
Returns the number of ticks to generate.
If specified, this overrides the automatic generation.- Specified by:
getCountin interfaceIsDefaultTicks- Returns:
- the number of ticks to generate.
If specified, this overrides the automatic generation
-
setMaxRotation
public void setMaxRotation(int maxRotation)
Sets the maximum rotation for tick labels when rotating to condense labels.
Note: Rotation doesn't occur until necessary.
Note: Only applicable to horizontal scales.- Parameters:
maxRotation- maximum rotation for tick labels when rotating to condense labels.
Note: Rotation doesn't occur until necessary.
Note: Only applicable to horizontal scales.
-
getMaxRotation
public int getMaxRotation()
Returns the maximum rotation for tick labels when rotating to condense labels.
Note: Rotation doesn't occur until necessary. Note: Only applicable to horizontal scales.- Specified by:
getMaxRotationin interfaceIsDefaultTicks- Returns:
- maximum rotation for tick labels when rotating to condense labels.
Note: Rotation doesn't occur until necessary. Note: Only applicable to horizontal scales.
-
setMinRotation
public void setMinRotation(int minRotation)
Sets the minimum rotation for tick labels.
Note: Only applicable to horizontal scales.- Parameters:
minRotation- minimum rotation for tick labels.
Note: Only applicable to horizontal scales.
-
getMinRotation
public int getMinRotation()
Returns the minimum rotation for tick labels.
Note: Only applicable to horizontal scales.- Specified by:
getMinRotationin interfaceIsDefaultTicks- Returns:
- minimum rotation for tick labels.
Note: Only applicable to horizontal scales.
-
setMirror
public void setMirror(boolean mirror)
Sets the flips tick labels around axis, displaying the labels inside the chart instead of outside.
Note: Only applicable to vertical scales.- Parameters:
mirror- flips tick labels around axis, displaying the labels inside the chart instead of outside.
Note: Only applicable to vertical scales.
-
isMirror
public boolean isMirror()
Returns the flips tick labels around axis, displaying the labels inside the chart instead of outside.
Note: Only applicable to vertical scales.- Specified by:
isMirrorin interfaceIsDefaultTicks- Returns:
- flips tick labels around axis, displaying the labels inside the chart instead of outside.
Note: Only applicable to vertical scales.
-
setPadding
public void setPadding(int padding)
Sets the padding between the tick label and the axis.
When set on a vertical axis, this applies in the horizontal (X) direction.
When set on a horizontal axis, this applies in the vertical (Y) direction.- Parameters:
padding- padding between the tick label and the axis.
When set on a vertical axis, this applies in the horizontal (X) direction.
When set on a horizontal axis, this applies in the vertical (Y) direction.
-
getPadding
public int getPadding()
Returns the padding between the tick label and the axis.
When set on a vertical axis, this applies in the horizontal (X) direction.
When set on a horizontal axis, this applies in the vertical (Y) direction.- Specified by:
getPaddingin interfaceIsDefaultTicks- Returns:
- padding between the tick label and the axis.
When set on a vertical axis, this applies in the horizontal (X) direction.
When set on a horizontal axis, this applies in the vertical (Y) direction.
-
setMaxTicksLimit
public void setMaxTicksLimit(int maxTicksLimit)
Sets the maximum number of ticks and grid to show.- Parameters:
maxTicksLimit- maximum number of ticks and grid to show.
-
getMaxTicksLimit
public int getMaxTicksLimit()
Returns the maximum number of ticks and grid to show.- Specified by:
getMaxTicksLimitin interfaceIsDefaultTicks- Returns:
- maximum number of ticks and grid to show.
-
setStepSize
public void setStepSize(double stepSize)
Sets the user defined fixed step size for the scale.- Parameters:
stepSize- user defined fixed step size for the scale.
-
getStepSize
public double getStepSize()
Returns the user defined fixed step size for the scale.- Specified by:
getStepSizein interfaceIsDefaultTicks- Returns:
- user defined fixed step size for the scale.
-
setBackdropColor
public void setBackdropColor(IsColor backdropColor)
Sets the color of label backdrops.- Parameters:
backdropColor- color of label backdrops.
-
setBackdropColor
public void setBackdropColor(String backdropColor)
Sets the color of label backdrops.- Parameters:
backdropColor- color of label backdrops.
-
getBackdropColorAsString
public String getBackdropColorAsString()
Returns the color of label backdrops.- Specified by:
getBackdropColorAsStringin interfaceIsDefaultTicks- Returns:
- color of label backdrops.
-
getBackdropColor
public IsColor getBackdropColor()
Returns the color of label backdrops.- Returns:
- color of label backdrops.
-
setShowLabelBackdrop
public void setShowLabelBackdrop(boolean showLabelBackdrop)
Iftrue, draw a background behind the tick labels.- Parameters:
showLabelBackdrop- iftrue, draw a background behind the tick labels.
-
isShowLabelBackdrop
public boolean isShowLabelBackdrop()
Iftrue, draw a background behind the tick labels.- Specified by:
isShowLabelBackdropin interfaceIsDefaultTicks- Returns:
- if
true, draw a background behind the tick labels.
-
setSource
public void setSource(TickSource source)
Sets the property controls the ticks generation.- Parameters:
source- property controls the ticks generation.
-
getSource
public TickSource getSource()
Returns the property controls the ticks generation.- Specified by:
getSourcein interfaceIsDefaultTicks- Returns:
- property controls the ticks generation.
-
setPrecision
public void setPrecision(int precision)
If defined and stepSize is not specified, the step size will be rounded to this many decimal places.- Parameters:
precision- if defined and stepSize is not specified, the step size will be rounded to this many decimal places.
-
getPrecision
public int getPrecision()
If defined and stepSize is not specified, the step size will be rounded to this many decimal places.- Specified by:
getPrecisionin interfaceIsDefaultTicks- Returns:
- if defined and stepSize is not specified, the step size will be rounded to this many decimal places.
-
setZ
public void setZ(int z)
Sets z-index of tick layer. Useful when ticks are drawn on chart area.
Values less than or equals to 0 are drawn under datasets, greater than 0 on top.- Parameters:
z- z-index of tick layer. Useful when ticks are drawn on chart area.
Values less than or equals to 0 are drawn under datasets, greater than 0 on top.
-
getZ
public int getZ()
Returns z-index of tick layer. Useful when ticks are drawn on chart area.
Values less than or equals to 0 are drawn under datasets, greater than 0 on top.- Specified by:
getZin interfaceIsDefaultTicks- Returns:
- z-index of tick layer. Useful when ticks are drawn on chart area.
Values less than or equals to 0 are drawn under datasets, greater than 0 on top.
-
setSampleSize
public void setSampleSize(int sampleSize)
Sets the number of ticks to examine when deciding how many labels will fit.
Setting a smaller value will be faster, but may be less accurate when there is large variability in label length.- Parameters:
sampleSize- the number of ticks to examine when deciding how many labels will fit.
-
getSampleSize
public int getSampleSize()
Returns the number of ticks to examine when deciding how many labels will fit.
Setting a smaller value will be faster, but may be less accurate when there is large variability in label length.- Specified by:
getSampleSizein interfaceIsDefaultTicks- Returns:
- the number of ticks to examine when deciding how many labels will fit.
-
setAlign
public void setAlign(TickAlign align)
Sets the tick alignment along the axis.- Parameters:
align- the tick alignment along the axis
-
getAlign
public TickAlign getAlign()
Returns the tick alignment along the axis.- Specified by:
getAlignin interfaceIsDefaultTicks- Returns:
- the tick alignment along the axis
-
setCrossAlign
public void setCrossAlign(CrossAlign crossAlign)
Sets the tick alignment perpendicular to the axis.- Parameters:
crossAlign- the tick alignment perpendicular to the axis
-
getCrossAlign
public CrossAlign getCrossAlign()
Returns the tick alignment perpendicular to the axis.- Specified by:
getCrossAlignin interfaceIsDefaultTicks- Returns:
- the tick alignment perpendicular to the axis
-
setTextStrokeColor
public final void setTextStrokeColor(IsColor color)
Sets the text stroke color.- Parameters:
color- the text stroke color
-
setTextStrokeColor
public final void setTextStrokeColor(String color)
Sets the text stroke color.- Parameters:
color- the text stroke color.
-
getTextStrokeColorAsString
public final String getTextStrokeColorAsString()
Returns the text stroke color as string.- Specified by:
getTextStrokeColorAsStringin interfaceIsDefaultTicks- Returns:
- the text stroke color as string.
-
getTextStrokeColor
public final IsColor getTextStrokeColor()
Returns the text stroke color.- Returns:
- the text stroke color.
-
setTextStrokeWidth
public final void setTextStrokeWidth(int textStrokeWidth)
Sets the text stroke width.- Parameters:
textStrokeWidth- the text stroke width.
-
getTextStrokeWidth
public final int getTextStrokeWidth()
Returns the text stroke width.- Specified by:
getTextStrokeWidthin interfaceIsDefaultTicks- Returns:
- the text stroke width.
-
-