Class DefaultTicks
- java.lang.Object
-
- org.pepstock.charba.client.defaults.globals.DefaultTicks
-
- All Implemented Interfaces:
IsDefaultFontContainer
,IsDefaultTicks
public class DefaultTicks extends Object implements IsDefaultTicks
CHART.JS default values for TICKS element.- 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.String
getBackdropColorAsString()
Returns the color of label backdrops.IsDefaultPadding
getBackdropPadding()
Returns the padding of label backdrop.String
getColorAsString()
Returns the font color as string.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.IsDefaultFont
getFont()
Returns the font element.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.IsDefaultMajor
getMajor()
Returns the major tick defaults.int
getMaxRotation()
Returns the maximum rotation for tick labels when rotating to condense labels.int
getMaxTicksLimit()
Returns the maximum number of ticks and grid to show.int
getMinRotation()
Returns the minimum rotation for tick labels.IsDefaultNumberFormatOptions
getNumberFormat()
Returns the number formatting options.int
getPadding()
Returns the padding between the tick label and the axis.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.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()
If true, automatically calculates how many labels that can be shown and hides labels accordingly.boolean
isDisplay()
If true, show tick marksboolean
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.boolean
isShowLabelBackdrop()
If true, draw a background behind the tick labels.
-
-
-
Method Detail
-
getFont
public IsDefaultFont getFont()
Description copied from interface:IsDefaultFontContainer
Returns the font element.- Specified by:
getFont
in interfaceIsDefaultFontContainer
- Returns:
- the font
-
getBackdropPadding
public IsDefaultPadding getBackdropPadding()
Description copied from interface:IsDefaultTicks
Returns the padding of label backdrop.- Specified by:
getBackdropPadding
in interfaceIsDefaultTicks
- Returns:
- padding of label backdrop.
-
getMajor
public IsDefaultMajor getMajor()
Description copied from interface:IsDefaultTicks
Returns the major tick defaults.- Specified by:
getMajor
in interfaceIsDefaultTicks
- Returns:
- the major tick defaults.
-
getNumberFormat
public IsDefaultNumberFormatOptions getNumberFormat()
Description copied from interface:IsDefaultTicks
Returns the number formatting options.- Specified by:
getNumberFormat
in interfaceIsDefaultTicks
- Returns:
- the number formatting options
-
getColorAsString
public String getColorAsString()
Description copied from interface:IsDefaultFontContainer
Returns the font color as string.- Specified by:
getColorAsString
in interfaceIsDefaultFontContainer
- Returns:
- font color as string
-
isDisplay
public boolean isDisplay()
Description copied from interface:IsDefaultTicks
If true, show tick marks- Specified by:
isDisplay
in interfaceIsDefaultTicks
- Returns:
- if true, show tick marks.
-
isAutoSkip
public boolean isAutoSkip()
Description copied from interface:IsDefaultTicks
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- 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.
-
getAutoSkipPadding
public int getAutoSkipPadding()
Description copied from interface:IsDefaultTicks
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.
-
isIncludeBounds
public boolean isIncludeBounds()
Description copied from interface:IsDefaultTicks
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"
-
getLabelOffset
public int getLabelOffset()
Description copied from interface:IsDefaultTicks
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).
-
getCount
public int getCount()
Description copied from interface:IsDefaultTicks
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
-
getMaxRotation
public int getMaxRotation()
Description copied from interface:IsDefaultTicks
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.
-
getMinRotation
public int getMinRotation()
Description copied from interface:IsDefaultTicks
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.
-
isMirror
public boolean isMirror()
Description copied from interface:IsDefaultTicks
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.
-
getPadding
public int getPadding()
Description copied from interface:IsDefaultTicks
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.
-
getMaxTicksLimit
public int getMaxTicksLimit()
Description copied from interface:IsDefaultTicks
Returns the maximum number of ticks and grid to show.- Specified by:
getMaxTicksLimit
in interfaceIsDefaultTicks
- Returns:
- maximum number of ticks and grid to show.
-
getStepSize
public double getStepSize()
Description copied from interface:IsDefaultTicks
Returns the user defined fixed step size for the scale.- Specified by:
getStepSize
in interfaceIsDefaultTicks
- Returns:
- user defined fixed step size for the scale.
-
getBackdropColorAsString
public String getBackdropColorAsString()
Description copied from interface:IsDefaultTicks
Returns the color of label backdrops.- Specified by:
getBackdropColorAsString
in interfaceIsDefaultTicks
- Returns:
- color of label backdrops.
-
isShowLabelBackdrop
public boolean isShowLabelBackdrop()
Description copied from interface:IsDefaultTicks
If true, draw a background behind the tick labels.- Specified by:
isShowLabelBackdrop
in interfaceIsDefaultTicks
- Returns:
- if true, draw a background behind the tick labels.
-
getSource
public TickSource getSource()
Description copied from interface:IsDefaultTicks
Returns the property controls the ticks generation.- Specified by:
getSource
in interfaceIsDefaultTicks
- Returns:
- property controls the ticks generation.
-
getPrecision
public int getPrecision()
Description copied from interface:IsDefaultTicks
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.
-
getZ
public int getZ()
Description copied from interface:IsDefaultTicks
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.
-
getSampleSize
public int getSampleSize()
Description copied from interface:IsDefaultTicks
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.
-
getAlign
public TickAlign getAlign()
Description copied from interface:IsDefaultTicks
Returns the tick alignment along the axis.- Specified by:
getAlign
in interfaceIsDefaultTicks
- Returns:
- the tick alignment along the axis
-
getCrossAlign
public CrossAlign getCrossAlign()
Description copied from interface:IsDefaultTicks
Returns the tick alignment perpendicular to the axis.- Specified by:
getCrossAlign
in interfaceIsDefaultTicks
- Returns:
- the tick alignment perpendicular to the axis
-
getTextStrokeColorAsString
public String getTextStrokeColorAsString()
Description copied from interface:IsDefaultTicks
Returns the text stroke color as string.- Specified by:
getTextStrokeColorAsString
in interfaceIsDefaultTicks
- Returns:
- the text stroke color as string.
-
getTextStrokeWidth
public int getTextStrokeWidth()
Description copied from interface:IsDefaultTicks
Returns the text stroke width.- Specified by:
getTextStrokeWidth
in interfaceIsDefaultTicks
- Returns:
- the text stroke width.
-
-