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 TickAlign
getAlign()
Returns the tick alignment along the axis.int
getAutoSkipPadding()
Returns the padding between the ticks on the horizontal axis when autoSkip is enabled.
Note: Only applicable to horizontal scales.IsColor
getBackdropColor()
Returns the color of label backdrops.String
getBackdropColorAsString()
Returns the color of label backdrops.Padding
getBackdropPadding()
Returns the padding of label backdrop.int
getCount()
Returns the number of ticks to generate.
If specified, this overrides the automatic generation.CrossAlign
getCrossAlign()
Returns the tick alignment perpendicular to the axis.FontContainer
getFontContainer()
Returns a font container instance to use in the default methods of this interface.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.Major
getMajor()
Returns the major element.int
getMaxRotation()
Returns the maximum rotation for tick labels when rotating to condense labels.
Note: Rotation doesn't occur until necessary.int
getMaxTicksLimit()
Returns the maximum number of ticks and grid to show.int
getMinRotation()
Returns the minimum rotation for tick labels.
Note: Only applicable to horizontal scales.TicksNumberFormat
getNumberFormat()
Returns the number formatting options.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.int
getPrecision()
If defined and stepSize is not specified, the step size will be rounded to this many decimal places.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.TickSource
getSource()
Returns the property controls the ticks generation.double
getStepSize()
Returns the user defined fixed step size for the scale.IsColor
getTextStrokeColor()
Returns the text stroke color.String
getTextStrokeColorAsString()
Returns the text stroke color as string.int
getTextStrokeWidth()
Returns the text stroke width.int
getZ()
Returns z-index of tick layer.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 whatboolean
isDisplay()
Iftrue
, show tick marks.boolean
isIncludeBounds()
Iftrue
, the defined minimum and maximum values should be presented as ticks even if they are not "nice".boolean
isMirror()
Returns the flips tick labels around axis, displaying the labels inside the chart instead of outside.
Note: Only applicable to vertical scales.boolean
isShowLabelBackdrop()
Iftrue
, draw a background behind the tick labels.void
setAlign(TickAlign align)
Sets the tick alignment along the axis.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 whatvoid
setAutoSkipPadding(int autoSkipPadding)
Sets the padding between the ticks on the horizontal axis when autoSkip is enabled.
Note: Only applicable to horizontal scales.void
setBackdropColor(String backdropColor)
Sets the color of label backdrops.void
setBackdropColor(IsColor backdropColor)
Sets the color of label backdrops.void
setCount(int count)
Sets the number of ticks to generate.
If specified, this overrides the automatic generation.void
setCrossAlign(CrossAlign crossAlign)
Sets the tick alignment perpendicular to the axis.void
setDisplay(boolean display)
Iftrue
, show tick marks.void
setIncludeBounds(boolean includeBounds)
Iftrue
, the defined min and maximum values should be presented as ticks even if they are not "nice"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.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.void
setMaxTicksLimit(int maxTicksLimit)
Sets the maximum number of ticks and grid to show.void
setMinRotation(int minRotation)
Sets the minimum rotation for tick labels.
Note: Only applicable to horizontal scales.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.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.void
setPrecision(int precision)
If defined and stepSize is not specified, the step size will be rounded to this many decimal places.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.void
setShowLabelBackdrop(boolean showLabelBackdrop)
Iftrue
, draw a background behind the tick labels.void
setSource(TickSource source)
Sets the property controls the ticks generation.void
setStepSize(double stepSize)
Sets the user defined fixed step size for the scale.void
setTextStrokeColor(String color)
Sets the text stroke color.void
setTextStrokeColor(IsColor color)
Sets the text stroke color.void
setTextStrokeWidth(int textStrokeWidth)
Sets the text stroke width.void
setZ(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, retrieveRoot, setArrayValueAndAddToParent, setArrayValueAndAddToParent, setArrayValueAndAddToParent, setElementAndAddToParent, setInternalCallbackToModel, setInternalCallbackToModel, 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
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, 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, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, toJSON, type
-
-
-
-
Method Detail
-
getFontContainer
public FontContainer getFontContainer()
Description copied from interface:HasFont
Returns a font container instance to use in the default methods of this interface.- Specified by:
getFontContainer
in interfaceHasFont
- Returns:
- a font container instance
-
getMajor
public Major getMajor()
Returns the major element.- Specified by:
getMajor
in interfaceIsDefaultTicks
- Returns:
- the major
-
getNumberFormat
public TicksNumberFormat getNumberFormat()
Returns the number formatting options.- Specified by:
getNumberFormat
in interfaceIsDefaultTicks
- Returns:
- the number formatting options
-
getBackdropPadding
public Padding getBackdropPadding()
Returns the padding of label backdrop.- Specified by:
getBackdropPadding
in 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:
isDisplay
in 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:
isAutoSkip
in 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:
getAutoSkipPadding
in 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:
isIncludeBounds
in 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:
getLabelOffset
in 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:
getCount
in 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:
getMaxRotation
in 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:
getMinRotation
in 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:
isMirror
in 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:
getPadding
in 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:
getMaxTicksLimit
in 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:
getStepSize
in 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:
getBackdropColorAsString
in 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:
isShowLabelBackdrop
in 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:
getSource
in 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:
getPrecision
in 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:
getZ
in 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:
getSampleSize
in 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:
getAlign
in 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:
getCrossAlign
in 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:
getTextStrokeColorAsString
in 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:
getTextStrokeWidth
in interfaceIsDefaultTicks
- Returns:
- the text stroke width.
-
-