Class CartesianLogarithmicTick
- java.lang.Object
-
- org.pepstock.charba.client.configuration.CartesianLogarithmicTick
-
- All Implemented Interfaces:
IsNumericTick
,IsScriptableFontProvider<ScaleContext>
public class CartesianLogarithmicTick extends Object
The logarithmic scale is use to chart numerical data. It can be placed on either the x or y axis.
As the name suggests, logarithmic interpolation is used to determine where a value lies on the axis.- Author:
- Andrea "Stock" Stocchero
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ElementAlign
getAlign()
Returns the tick alignment along the axis.int
getAutoSkipPadding()
Returns the padding between the ticks on the horizontal axis when autoSkip is enabled.Axis
getAxis()
Returns the axis instance.IsColor
getBackdropColor()
Returns the color of label backdrops.String
getBackdropColorAsString()
Returns the color of label backdrops.ColorCallback<ScaleContext>
getBackdropColorCallback()
Returns the backdrop color callback instance.Padding
getBackdropPadding()
Returns the padding of label backdrop.TickCallback
getCallback()
Returns the user callback instance.IsColor
getColor()
Returns the font color.String
getColorAsString()
Returns the font color as string.ColorCallback<ScaleContext>
getColorCallback()
Returns the color callback, if set, otherwisenull
.CrossAlign
getCrossAlign()
Returns the tick alignment perpendicular to the axis.Font
getFont()
Returns the font element.FontCallback<ScaleContext>
getFontCallback()
Returns the font callback, if set, otherwisenull
.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 major tick element.int
getMaxRotation()
Returns the maximum rotation for tick labels when rotating to condense labels.int
getMinRotation()
Returns the minimum rotation for tick labels.IsNumberFormat
getNumberFormat()
Returns the number format instance.int
getPadding()
Returns the padding between the tick label and the axis.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.ShowLabelBackdropCallback
getShowLabelBackdropCallback()
Returns the show label backdrop callback instance.IsColor
getTextStrokeColor()
Returns the text stroke color.String
getTextStrokeColorAsString()
Returns the text stroke color as string.ColorCallback<ScaleContext>
getTextStrokeColorCallback()
Returns the text stroke color callback, if set, otherwisenull
.int
getTextStrokeWidth()
Returns the text stroke width.WidthCallback<ScaleContext>
getTextStrokeWidthCallback()
Returns the text stroke width callback, if set, otherwisenull
.org.pepstock.charba.client.configuration.NumericTickOptionsHandler
getTickOptionsHandler()
Returns the linear tick options handler instance, for callbacks.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.void
setAlign(ElementAlign align)
Sets the tick alignment along the axis.void
setAutoSkip(boolean autoSkip)
If true, automatically calculates how many labels that can be shown and hides labels accordingly.void
setAutoSkipPadding(int autoSkipPadding)
Sets the padding between the ticks on the horizontal axis when autoSkip is enabled.void
setBackdropColor(String backdropColor)
Sets the color of label backdrops.void
setBackdropColor(ColorCallback<ScaleContext> backdropColorCallback)
Sets the backdrop color callback instance.void
setBackdropColor(NativeCallback backdropColorCallback)
Sets the backdrop color callback instance.void
setBackdropColor(IsColor backdropColor)
Sets the color of label backdrops.void
setCallback(TickCallback callback)
Sets the user callback instance.void
setColor(String color)
Sets the font color.void
setColor(ColorCallback<ScaleContext> colorCallback)
Sets the color callback.void
setColor(NativeCallback colorCallback)
Sets the color callback.void
setColor(IsColor color)
Sets the font color.void
setCrossAlign(CrossAlign crossAlign)
Sets the tick alignment perpendicular to the axis.void
setDisplay(boolean display)
If true, show tick marks.void
setFont(FontCallback<ScaleContext> fontCallback)
Sets the font callback.void
setFont(NativeCallback fontCallback)
Sets the font callback.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.void
setMinRotation(int minRotation)
Sets the minimum rotation for tick labels.void
setMirror(boolean mirror)
Sets the flips tick labels around axis, displaying the labels inside the chart instead of outside.void
setPadding(int padding)
Sets the padding between the tick label and the axis.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)
If true, draw a background behind the tick labels.void
setShowLabelBackdrop(NativeCallback showLabelBackdropCallback)
Sets the show label backdrop callback instance.void
setShowLabelBackdrop(ShowLabelBackdropCallback showLabelBackdropCallback)
Sets the show label backdrop callback instance.void
setTextStrokeColor(String color)
Sets the text stroke color.void
setTextStrokeColor(ColorCallback<ScaleContext> textStrokeColorCallback)
Sets the text stroke color callback.void
setTextStrokeColor(NativeCallback textStrokeColorCallback)
Sets the text stroke color callback.void
setTextStrokeColor(IsColor color)
Sets the text stroke color.void
setTextStrokeWidth(int textStrokeWidth)
Sets the text stroke width.void
setTextStrokeWidth(NativeCallback textStrokeWidthCallback)
Sets the text stroke width callback.void
setTextStrokeWidth(WidthCallback<ScaleContext> textStrokeWidthCallback)
Sets the text stroke width callback.void
setZ(int z)
Sets z-index of tick layer.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.pepstock.charba.client.configuration.IsNumericTick
getNumberFormatCallback, setNumberFormat, setNumberFormat
-
-
-
-
Method Detail
-
getTickOptionsHandler
public final org.pepstock.charba.client.configuration.NumericTickOptionsHandler getTickOptionsHandler()
Description copied from interface:IsNumericTick
Returns the linear tick options handler instance, for callbacks.- Returns:
- the linear tick options handler instance, for callbacks
-
getCallback
public TickCallback getCallback()
Returns the user callback instance.- Returns:
- the callback
-
setCallback
public void setCallback(TickCallback callback)
Sets the user callback instance.- Parameters:
callback
- the callback to set
-
getNumberFormat
public final IsNumberFormat getNumberFormat()
Description copied from interface:IsNumericTick
Returns the number format instance.- Specified by:
getNumberFormat
in interfaceIsNumericTick
- Returns:
- the number format instance
-
setAutoSkip
public void setAutoSkip(boolean autoSkip)
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- Parameters:
autoSkip
- 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
-
isAutoSkip
public boolean isAutoSkip()
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- 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.- 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".- 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.- 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).
-
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.- 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.- 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.- Returns:
- flips tick labels around axis, displaying the labels inside the chart instead of outside. Note: Only applicable to vertical scales.
-
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.- Returns:
- the number of ticks to examine when deciding how many labels will fit.
-
setAlign
public void setAlign(ElementAlign align)
Sets the tick alignment along the axis.- Parameters:
align
- the tick alignment along the axis
-
getAlign
public ElementAlign getAlign()
Returns the tick alignment along the axis.- 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.- Returns:
- the tick alignment perpendicular to the axis
-
getMajor
public Major getMajor()
Returns major tick element.- Returns:
- the major
-
getFont
public Font getFont()
Returns the font element.- Returns:
- the font element
-
getBackdropPadding
public Padding getBackdropPadding()
Returns the padding of label backdrop.- Returns:
- padding of label backdrop.
-
setColor
public void setColor(IsColor color)
Sets the font color.- Parameters:
color
- font color.
-
setColor
public void setColor(String color)
Sets the font color.- Parameters:
color
- font color.
-
getColorAsString
public String getColorAsString()
Returns the font color as string.- Returns:
- font color as string
-
getColor
public IsColor getColor()
Returns the font color.- Returns:
- font color
-
setDisplay
public void setDisplay(boolean display)
If true, show tick marks.- Parameters:
display
- if true, show tick marks
-
isDisplay
public boolean isDisplay()
If true, show tick marks- Returns:
- if true, show tick marks.
-
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.- 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.
-
setTextStrokeColor
public void setTextStrokeColor(IsColor color)
Sets the text stroke color.- Parameters:
color
- the text stroke color
-
setTextStrokeColor
public void setTextStrokeColor(String color)
Sets the text stroke color.- Parameters:
color
- the text stroke color.
-
getTextStrokeColorAsString
public String getTextStrokeColorAsString()
Returns the text stroke color as string.- Returns:
- the text stroke color as string.
-
getTextStrokeColor
public IsColor getTextStrokeColor()
Returns the text stroke color.- Returns:
- the text stroke color.
-
setTextStrokeWidth
public void setTextStrokeWidth(int textStrokeWidth)
Sets the text stroke width.- Parameters:
textStrokeWidth
- the text stroke width.
-
getTextStrokeWidth
public int getTextStrokeWidth()
Returns the text stroke width.- Returns:
- the text stroke width.
-
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.- 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.
-
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.- 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)
If true, draw a background behind the tick labels.- Parameters:
showLabelBackdrop
- if true, draw a background behind the tick labels.
-
isShowLabelBackdrop
public boolean isShowLabelBackdrop()
If true, draw a background behind the tick labels.- Returns:
- if true, draw a background behind the tick labels.
-
getFontCallback
public FontCallback<ScaleContext> getFontCallback()
Returns the font callback, if set, otherwisenull
.- Specified by:
getFontCallback
in interfaceIsScriptableFontProvider<ScaleContext>
- Returns:
- the font callback, if set, otherwise
null
.
-
getColorCallback
public ColorCallback<ScaleContext> getColorCallback()
Returns the color callback, if set, otherwisenull
.- Returns:
- the color callback, if set, otherwise
null
.
-
getTextStrokeColorCallback
public ColorCallback<ScaleContext> getTextStrokeColorCallback()
Returns the text stroke color callback, if set, otherwisenull
.- Returns:
- the text stroke color callback, if set, otherwise
null
.
-
getTextStrokeWidthCallback
public WidthCallback<ScaleContext> getTextStrokeWidthCallback()
Returns the text stroke width callback, if set, otherwisenull
.- Returns:
- the text stroke width callback, if set, otherwise
null
.
-
getBackdropColorCallback
public ColorCallback<ScaleContext> getBackdropColorCallback()
Returns the backdrop color callback instance.- Returns:
- the backdrop color callback instance
-
getShowLabelBackdropCallback
public ShowLabelBackdropCallback getShowLabelBackdropCallback()
Returns the show label backdrop callback instance.- Returns:
- the show label backdrop callback instance
-
setColor
public void setColor(ColorCallback<ScaleContext> colorCallback)
Sets the color callback.- Parameters:
colorCallback
- the color callback to set
-
setColor
public void setColor(NativeCallback colorCallback)
Sets the color callback.- Parameters:
colorCallback
- the color callback to set
-
setTextStrokeColor
public void setTextStrokeColor(ColorCallback<ScaleContext> textStrokeColorCallback)
Sets the text stroke color callback.- Parameters:
textStrokeColorCallback
- the text stroke color callback to set
-
setTextStrokeColor
public void setTextStrokeColor(NativeCallback textStrokeColorCallback)
Sets the text stroke color callback.- Parameters:
textStrokeColorCallback
- the text stroke color callback to set
-
setTextStrokeWidth
public void setTextStrokeWidth(WidthCallback<ScaleContext> textStrokeWidthCallback)
Sets the text stroke width callback.- Parameters:
textStrokeWidthCallback
- the text stroke width callback to set
-
setTextStrokeWidth
public void setTextStrokeWidth(NativeCallback textStrokeWidthCallback)
Sets the text stroke width callback.- Parameters:
textStrokeWidthCallback
- the text stroke width callback to set
-
setFont
public void setFont(FontCallback<ScaleContext> fontCallback)
Sets the font callback.- Specified by:
setFont
in interfaceIsScriptableFontProvider<ScaleContext>
- Parameters:
fontCallback
- the font callback to set
-
setFont
public void setFont(NativeCallback fontCallback)
Sets the font callback.- Specified by:
setFont
in interfaceIsScriptableFontProvider<ScaleContext>
- Parameters:
fontCallback
- the font callback to set
-
setBackdropColor
public void setBackdropColor(ColorCallback<ScaleContext> backdropColorCallback)
Sets the backdrop color callback instance.- Parameters:
backdropColorCallback
- the backdrop color callback instance
-
setBackdropColor
public void setBackdropColor(NativeCallback backdropColorCallback)
Sets the backdrop color callback instance.- Parameters:
backdropColorCallback
- the backdrop color callback instance
-
setShowLabelBackdrop
public void setShowLabelBackdrop(ShowLabelBackdropCallback showLabelBackdropCallback)
Sets the show label backdrop callback instance.- Parameters:
showLabelBackdropCallback
- the show label backdrop callback instance
-
setShowLabelBackdrop
public void setShowLabelBackdrop(NativeCallback showLabelBackdropCallback)
Sets the show label backdrop callback instance.- Parameters:
showLabelBackdropCallback
- the show label backdrop callback instance
-
getAxis
public final Axis getAxis()
Returns the axis instance.- Returns:
- the axis
-
-