Class DataLabelsOptions
- java.lang.Object
-
- org.pepstock.charba.client.commons.NativeObjectContainer
-
- org.pepstock.charba.client.commons.AbstractNode
-
- org.pepstock.charba.client.plugins.AbstractPluginOptions
-
- org.pepstock.charba.client.datalabels.LabelItem
-
- org.pepstock.charba.client.datalabels.DataLabelsOptions
-
- All Implemented Interfaces:
IsDefaultEventHandler
,HasEvents
,IsScriptableFontProvider<DataLabelsContext>
,IsScriptablePaddingProvider<DataLabelsContext>
public final class DataLabelsOptions extends LabelItem
This is theDataLabelsPlugin.ID
plugin options where to set all the configuration needed to the plugin.
The options could be set by simply the value or by setting a callback.
TheDataLabelsPlugin.ID
plugin is highly customizable CHART.JS plugin that displays labels on data for any type of charts.- Author:
- Andrea "Stock" Stocchero
-
-
Field Summary
Fields Modifier and Type Field Description static Align
DEFAULT_ALIGN
Default position of the label relative to the anchor point position and orientation,Align.CENTER
.static Anchor
DEFAULT_ANCHOR
Default anchor point, which is defined by an orientation vector and a position on the data element,Anchor.CENTER
.static String
DEFAULT_BACKGROUND_COLOR
Default background color,null
, and uses the background color of dataset.static String
DEFAULT_BORDER_COLOR
Default border color,null
, and uses the border color of dataset.static double
DEFAULT_BORDER_RADIUS
Default border radius of labels, 0.0.static int
DEFAULT_BORDER_WIDTH
Default border width of labels, 0.static boolean
DEFAULT_CLAMP
Default to enforce the anchor position to be calculated based on the visible geometry of the associated element, false.static boolean
DEFAULT_CLIP
Default to enforce the part of the label which is outside the chart area will be masked, false.static Display
DEFAULT_DISPLAY
Default visibility of labels,Display.TRUE
.static int
DEFAULT_OFFSET
Default distance (in pixels) to pull the label away from the anchor point, 4.static double
DEFAULT_OPACITY
Default opacity, 1.0.static double
DEFAULT_ROTATION
Default clockwise rotation angle (in degrees) of the label, 0.0.static TextAlign
DEFAULT_TEXT_ALIGN
Default text alignment being used when drawing the label text,TextAlign.START
.static double
DEFAULT_TEXT_SHADOW_BLUR
Default text shadow blur, 0.0.static int
DEFAULT_TEXT_STROKE_WIDTH
Default text stroke width, 0.
-
Constructor Summary
Constructors Constructor Description DataLabelsOptions()
Creates newDataLabelsPlugin.ID
plugin options.DataLabelsOptions(IsChart chart)
Creates newDataLabelsPlugin.ID
plugin options, relating to chart instance for default.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Default Methods Modifier and Type Method Description protected void
applyingDefaults()
This is invoked before storing the plugins options as default.default Align
getAlign()
Returns the position of the label relative to the anchor point position and orientation.default AlignCallback
getAlignCallback()
Returns the align callback.default Anchor
getAnchor()
Returns the anchor point, which is defined by an orientation vector and a position on the data elementdefault AnchorCallback
getAnchorCallback()
Returns the anchor callback.default String
getBackgroundColorAsString()
Returns the background color as string.default ColorCallback<DataLabelsContext>
getBackgroundColorCallback()
Returns the background color callback.default String
getBorderColorAsString()
Returns the border color as string.default ColorCallback<DataLabelsContext>
getBorderColorCallback()
Returns the border color callback.default double
getBorderRadius()
Returns the border radius.default RadiusCallback<DataLabelsContext>
getBorderRadiusCallback()
Returns the border radius callback.default int
getBorderWidth()
Returns the border width.default WidthCallback<DataLabelsContext>
getBorderWidthCallback()
Returns the border width callback.default ClampCallback
getClampCallback()
Returns the clamp callback.default ClipCallback
getClipCallback()
Returns the clip callback.default String
getColorAsString()
Returns the color as string.default ColorCallback<DataLabelsContext>
getColorCallback()
Returns the color callback.default Display
getDisplay()
Returns the visibility of labels.default DisplayCallback<DataLabelsContext>
getDisplayCallback()
Returns the display callback.IsDefaultFont
getFont()
Returns the font element.default FontCallback<DataLabelsContext>
getFontCallback()
Returns the font callback.default FormatterCallback
getFormatterCallback()
Returns the formatter callback.Labels
getLabels()
Returns the labels element.org.pepstock.charba.client.datalabels.IsDefaultListeners
getListeners()
Returns the listeners element.default int
getOffset()
Returns the distance (in pixels) to pull the label away from the anchor point.default OffsetCallback<DataLabelsContext>
getOffsetCallback()
Returns the offset callback.default double
getOpacity()
Returns the opacity.default OpacityCallback
getOpacityCallback()
Returns the opacity callback.IsDefaultPadding
getPadding()
Returns the padding element.default PaddingCallback<DataLabelsContext>
getPaddingCallback()
Returns the padding callback.default double
getRotation()
Returns the clockwise rotation angle (in degrees) of the label, the rotation center point being the label center.default RotationCallback<DataLabelsContext>
getRotationCallback()
Returns the rotation callback.default TextAlign
getTextAlign()
Returns the text alignment being used when drawing the label text.default TextAlignCallback<DataLabelsContext>
getTextAlignCallback()
Returns the text align callback.default double
getTextShadowBlur()
Returns the text shadow blur.default TextShadowBlurCallback
getTextShadowBlurCallback()
Returns the text shadow blur callback.default String
getTextShadowColorAsString()
Returns the text shadow color as string.default ColorCallback<DataLabelsContext>
getTextShadowColorCallback()
Returns the text shadow color callback.default String
getTextStrokeColorAsString()
Returns the text stroke color as string.default ColorCallback<DataLabelsContext>
getTextStrokeColorCallback()
Returns the text stroke color callback.default int
getTextStrokeWidth()
Returns the text stroke width.default WidthCallback<DataLabelsContext>
getTextStrokeWidthCallback()
Returns the text stroke width callback.default boolean
isClamp()
Returnstrue
to enforce the anchor position to be calculated based on the visible geometry of the associated element (i.e.default boolean
isClip()
When the clip option istrue
, the part of the label which is outside the chart area will be masked.-
Methods inherited from class org.pepstock.charba.client.datalabels.LabelItem
getAlign, getAlignCallback, getAlignDegrees, getAnchor, getAnchorCallback, getBackgroundColor, getBackgroundColorAsString, getBackgroundColorCallback, getBorderColor, getBorderColorAsString, getBorderColorCallback, getBorderRadius, getBorderRadiusCallback, getBorderWidth, getBorderWidthCallback, getClampCallback, getClipCallback, getColor, getColorAsString, getColorCallback, getDisplay, getDisplayCallback, getFont, getFontCallback, getFormatterCallback, getListeners, getOffset, getOffsetCallback, getOpacity, getOpacityCallback, getPadding, getPaddingCallback, getRotation, getRotationCallback, getTextAlign, getTextAlignCallback, getTextShadowBlur, getTextShadowBlurCallback, getTextShadowColor, getTextShadowColorAsString, getTextShadowColorCallback, getTextStrokeColor, getTextStrokeColorAsString, getTextStrokeColorCallback, getTextStrokeWidth, getTextStrokeWidthCallback, isClamp, isClip, setAlign, setAlign, setAlign, setAlign, setAnchor, setAnchor, setAnchor, setBackgroundColor, setBackgroundColor, setBackgroundColor, setBackgroundColor, setBorderColor, setBorderColor, setBorderColor, setBorderColor, setBorderRadius, setBorderRadius, setBorderRadius, setBorderWidth, setBorderWidth, setBorderWidth, setClamp, setClamp, setClamp, setClip, setClip, setClip, setColor, setColor, setColor, setColor, setDisplay, setDisplay, setDisplay, setDisplay, setFont, setFont, setFormatter, setListenersHandler, setOffset, setOffset, setOffset, setOpacity, setOpacity, setOpacity, setPadding, setPadding, setRotation, setRotation, setRotation, setTextAlign, setTextAlign, setTextAlign, setTextShadowBlur, setTextShadowBlur, setTextShadowBlur, setTextShadowColor, setTextShadowColor, setTextShadowColor, setTextShadowColor, setTextStrokeColor, setTextStrokeColor, setTextStrokeColor, setTextStrokeColor, setTextStrokeWidth, setTextStrokeWidth, setTextStrokeWidth
-
Methods inherited from class org.pepstock.charba.client.plugins.AbstractPluginOptions
applyingDefaults, getEventsOptionHandler, getId, getPluginId, loadGlobalsPluginOptions, store, store, store, store
-
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, 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, 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
-
-
-
-
Field Detail
-
DEFAULT_ALIGN
public static final Align DEFAULT_ALIGN
Default position of the label relative to the anchor point position and orientation,Align.CENTER
.
-
DEFAULT_ANCHOR
public static final Anchor DEFAULT_ANCHOR
Default anchor point, which is defined by an orientation vector and a position on the data element,Anchor.CENTER
.
-
DEFAULT_BACKGROUND_COLOR
public static final String DEFAULT_BACKGROUND_COLOR
Default background color,null
, and uses the background color of dataset.
-
DEFAULT_BORDER_COLOR
public static final String DEFAULT_BORDER_COLOR
Default border color,null
, and uses the border color of dataset.
-
DEFAULT_BORDER_RADIUS
public static final double DEFAULT_BORDER_RADIUS
Default border radius of labels, 0.0.- See Also:
- Constant Field Values
-
DEFAULT_BORDER_WIDTH
public static final int DEFAULT_BORDER_WIDTH
Default border width of labels, 0.- See Also:
- Constant Field Values
-
DEFAULT_CLAMP
public static final boolean DEFAULT_CLAMP
Default to enforce the anchor position to be calculated based on the visible geometry of the associated element, false.- See Also:
- Constant Field Values
-
DEFAULT_CLIP
public static final boolean DEFAULT_CLIP
Default to enforce the part of the label which is outside the chart area will be masked, false.- See Also:
- Constant Field Values
-
DEFAULT_DISPLAY
public static final Display DEFAULT_DISPLAY
Default visibility of labels,Display.TRUE
.
-
DEFAULT_OFFSET
public static final int DEFAULT_OFFSET
Default distance (in pixels) to pull the label away from the anchor point, 4.- See Also:
- Constant Field Values
-
DEFAULT_OPACITY
public static final double DEFAULT_OPACITY
Default opacity, 1.0.- See Also:
- Constant Field Values
-
DEFAULT_ROTATION
public static final double DEFAULT_ROTATION
Default clockwise rotation angle (in degrees) of the label, 0.0.- See Also:
- Constant Field Values
-
DEFAULT_TEXT_ALIGN
public static final TextAlign DEFAULT_TEXT_ALIGN
Default text alignment being used when drawing the label text,TextAlign.START
.
-
DEFAULT_TEXT_STROKE_WIDTH
public static final int DEFAULT_TEXT_STROKE_WIDTH
Default text stroke width, 0.- See Also:
- Constant Field Values
-
DEFAULT_TEXT_SHADOW_BLUR
public static final double DEFAULT_TEXT_SHADOW_BLUR
Default text shadow blur, 0.0.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DataLabelsOptions
public DataLabelsOptions()
Creates newDataLabelsPlugin.ID
plugin options.
-
DataLabelsOptions
public DataLabelsOptions(IsChart chart)
Creates newDataLabelsPlugin.ID
plugin options, relating to chart instance for default.- Parameters:
chart
- chart instance related to the plugin options
-
-
Method Detail
-
applyingDefaults
protected void applyingDefaults()
Description copied from class:AbstractPluginOptions
This is invoked before storing the plugins options as default.- Overrides:
applyingDefaults
in classLabelItem
-
getLabels
public Labels getLabels()
Returns the labels element.- Returns:
- the labels element.
-
getFont
public abstract IsDefaultFont getFont()
Returns the font element.- Returns:
- the font element.
-
getPadding
public abstract IsDefaultPadding getPadding()
Returns the padding element.- Returns:
- the padding element.
-
getListeners
public abstract org.pepstock.charba.client.datalabels.IsDefaultListeners getListeners()
Returns the listeners element.- Returns:
- the listeners element.
-
getAlign
public default Align getAlign()
Returns the position of the label relative to the anchor point position and orientation.- Returns:
- the position of the label relative to the anchor point position and orientation.
-
getAnchor
public default Anchor getAnchor()
Returns the anchor point, which is defined by an orientation vector and a position on the data element- Returns:
- the anchor point, which is defined by an orientation vector and a position on the data element.
-
getBackgroundColorAsString
public default String getBackgroundColorAsString()
Returns the background color as string.- Returns:
- the background color as string. If
null
, it uses the background color of dataset.
-
getBorderColorAsString
public default String getBorderColorAsString()
Returns the border color as string.- Returns:
- the border color as string. If
null
, it uses the border color of dataset.
-
getBorderRadius
public default double getBorderRadius()
Returns the border radius.- Returns:
- the border radius.
-
getBorderWidth
public default int getBorderWidth()
Returns the border width.- Returns:
- the border width.
-
isClamp
public default boolean isClamp()
Returnstrue
to enforce the anchor position to be calculated based on the visible geometry of the associated element (i.e. part inside the chart area).- Returns:
true
to enforce the anchor position to be calculated based on the visible geometry of the associated element (i.e. part inside the chart area).
-
isClip
public default boolean isClip()
When the clip option istrue
, the part of the label which is outside the chart area will be masked.- Returns:
- when the clip option is
true
, the part of the label which is outside the chart area will be masked.
-
getColorAsString
public default String getColorAsString()
Returns the color as string.- Returns:
- the color as string.
-
getDisplay
public default Display getDisplay()
Returns the visibility of labels.- Returns:
- the visibility of labels.
-
getOffset
public default int getOffset()
Returns the distance (in pixels) to pull the label away from the anchor point. This option is not applicable when align is 'center'. Also note that if align is 'start', the label is moved in the opposite direction.- Returns:
- the distance (in pixels) to pull the label away from the anchor point. This option is not applicable when align is 'center'. Also note that if align is 'start', the label is moved in the opposite direction.
-
getOpacity
public default double getOpacity()
Returns the opacity.- Returns:
- the opacity.
-
getRotation
public default double getRotation()
Returns the clockwise rotation angle (in degrees) of the label, the rotation center point being the label center.- Returns:
- the clockwise rotation angle (in degrees) of the label, the rotation center point being the label center.
-
getTextAlign
public default TextAlign getTextAlign()
Returns the text alignment being used when drawing the label text.- Returns:
- the text alignment being used when drawing the label text.
-
getTextStrokeColorAsString
public default String getTextStrokeColorAsString()
Returns the text stroke color as string.- Returns:
- the text stroke color as string.
-
getTextStrokeWidth
public default int getTextStrokeWidth()
Returns the text stroke width.- Returns:
- the text stroke width.
-
getTextShadowBlur
public default double getTextShadowBlur()
Returns the text shadow blur.- Returns:
- the text shadow blur.
-
getTextShadowColorAsString
public default String getTextShadowColorAsString()
Returns the text shadow color as string.- Returns:
- the text shadow color as string.
-
getBackgroundColorCallback
public default ColorCallback<DataLabelsContext> getBackgroundColorCallback()
Returns the background color callback.- Returns:
- the background color callback.
-
getBorderColorCallback
public default ColorCallback<DataLabelsContext> getBorderColorCallback()
Returns the border color callback.- Returns:
- the border color callback.
-
getColorCallback
public default ColorCallback<DataLabelsContext> getColorCallback()
Returns the color callback.- Returns:
- the color callback.
-
getFormatterCallback
public default FormatterCallback getFormatterCallback()
Returns the formatter callback.- Returns:
- the formatter callback.
-
getAlignCallback
public default AlignCallback getAlignCallback()
Returns the align callback.- Returns:
- the align callback.
-
getAnchorCallback
public default AnchorCallback getAnchorCallback()
Returns the anchor callback.- Returns:
- the anchor callback.
-
getBorderRadiusCallback
public default RadiusCallback<DataLabelsContext> getBorderRadiusCallback()
Returns the border radius callback.- Returns:
- the border radius callback.
-
getBorderWidthCallback
public default WidthCallback<DataLabelsContext> getBorderWidthCallback()
Returns the border width callback.- Returns:
- the border width callback.
-
getClampCallback
public default ClampCallback getClampCallback()
Returns the clamp callback.- Returns:
- the clamp callback.
-
getClipCallback
public default ClipCallback getClipCallback()
Returns the clip callback.- Returns:
- the clip callback.
-
getDisplayCallback
public default DisplayCallback<DataLabelsContext> getDisplayCallback()
Returns the display callback.- Returns:
- the display callback.
-
getOffsetCallback
public default OffsetCallback<DataLabelsContext> getOffsetCallback()
Returns the offset callback.- Returns:
- the offset callback.
-
getOpacityCallback
public default OpacityCallback getOpacityCallback()
Returns the opacity callback.- Returns:
- the opacity callback.
-
getRotationCallback
public default RotationCallback<DataLabelsContext> getRotationCallback()
Returns the rotation callback.- Returns:
- the rotation callback.
-
getTextAlignCallback
public default TextAlignCallback<DataLabelsContext> getTextAlignCallback()
Returns the text align callback.- Returns:
- the text align callback.
-
getTextStrokeColorCallback
public default ColorCallback<DataLabelsContext> getTextStrokeColorCallback()
Returns the text stroke color callback.- Returns:
- the text stroke color callback.
-
getTextStrokeWidthCallback
public default WidthCallback<DataLabelsContext> getTextStrokeWidthCallback()
Returns the text stroke width callback.- Returns:
- the text stroke width callback.
-
getTextShadowBlurCallback
public default TextShadowBlurCallback getTextShadowBlurCallback()
Returns the text shadow blur callback.- Returns:
- the text shadow blur callback.
-
getTextShadowColorCallback
public default ColorCallback<DataLabelsContext> getTextShadowColorCallback()
Returns the text shadow color callback.- Returns:
- the text shadow color callback.
-
getFontCallback
public default FontCallback<DataLabelsContext> getFontCallback()
Returns the font callback.- Returns:
- the font callback.
-
getPaddingCallback
public default PaddingCallback<DataLabelsContext> getPaddingCallback()
Returns the padding callback.- Returns:
- the padding callback.
-
-