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:
IsScriptableFontProvider<DataLabelsContext>,IsScriptablePaddingProvider<DataLabelsContext>
public final class DataLabelsOptions extends LabelItem
This is theDataLabelsPlugin.IDplugin 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.IDplugin 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 AlignDEFAULT_ALIGNDefault position of the label relative to the anchor point position and orientation,Align.CENTER.static AnchorDEFAULT_ANCHORDefault anchor point, which is defined by an orientation vector and a position on the data element,Anchor.CENTER.static StringDEFAULT_BACKGROUND_COLORDefault background color,null, and uses the background color of dataset.static StringDEFAULT_BORDER_COLORDefault border color,null, and uses the border color of dataset.static doubleDEFAULT_BORDER_RADIUSDefault border radius of labels, 0.0.static intDEFAULT_BORDER_WIDTHDefault border width of labels, 0.static booleanDEFAULT_CLAMPDefault to enforce the anchor position to be calculated based on the visible geometry of the associated element, false.static booleanDEFAULT_CLIPDefault to enforce the part of the label which is outside the chart area will be masked, false.static DisplayDEFAULT_DISPLAYDefault visibility of labels,Display.TRUE.static intDEFAULT_OFFSETDefault distance (in pixels) to pull the label away from the anchor point, 4.static doubleDEFAULT_OPACITYDefault opacity, 1.0.static doubleDEFAULT_ROTATIONDefault clockwise rotation angle (in degrees) of the label, 0.0.static TextAlignDEFAULT_TEXT_ALIGNDefault text alignment being used when drawing the label text,TextAlign.START.static doubleDEFAULT_TEXT_SHADOW_BLURDefault text shadow blur, 0.0.static intDEFAULT_TEXT_STROKE_WIDTHDefault text stroke width, 0.
-
Constructor Summary
Constructors Constructor Description DataLabelsOptions()Creates newDataLabelsPlugin.IDplugin options.DataLabelsOptions(IsChart chart)Creates newDataLabelsPlugin.IDplugin 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 voidapplyingDefaults()This is invoked before storing the plugins options as default.default AligngetAlign()Returns the position of the label relative to the anchor point position and orientation.default AlignCallbackgetAlignCallback()Returns the align callback.default AnchorgetAnchor()Returns the anchor point, which is defined by an orientation vector and a position on the data elementdefault AnchorCallbackgetAnchorCallback()Returns the anchor callback.default StringgetBackgroundColorAsString()Returns the background color as string.default ColorCallback<DataLabelsContext>getBackgroundColorCallback()Returns the background color callback.default StringgetBorderColorAsString()Returns the border color as string.default ColorCallback<DataLabelsContext>getBorderColorCallback()Returns the border color callback.default doublegetBorderRadius()Returns the border radius.default RadiusCallback<DataLabelsContext>getBorderRadiusCallback()Returns the border radius callback.default intgetBorderWidth()Returns the border width.default WidthCallback<DataLabelsContext>getBorderWidthCallback()Returns the border width callback.default ClampCallbackgetClampCallback()Returns the clamp callback.default ClipCallbackgetClipCallback()Returns the clip callback.default StringgetColorAsString()Returns the color as string.default ColorCallback<DataLabelsContext>getColorCallback()Returns the color callback.default DisplaygetDisplay()Returns the visibility of labels.default DisplayCallbackgetDisplayCallback()Returns the display callback.IsDefaultFontgetFont()Returns the font element.default FontCallback<DataLabelsContext>getFontCallback()Returns the font callback.default FormatterCallbackgetFormatterCallback()Returns the formatter callback.LabelsgetLabels()Returns the labels element.org.pepstock.charba.client.datalabels.IsDefaultListenersgetListeners()Returns the listeners element.default intgetOffset()Returns the distance (in pixels) to pull the label away from the anchor point.default OffsetCallback<DataLabelsContext>getOffsetCallback()Returns the offset callback.default doublegetOpacity()Returns the opacity.default OpacityCallbackgetOpacityCallback()Returns the opacity callback.IsDefaultPaddinggetPadding()Returns the padding element.default PaddingCallback<DataLabelsContext>getPaddingCallback()Returns the padding callback.default doublegetRotation()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 TextAligngetTextAlign()Returns the text alignment being used when drawing the label text.default TextAlignCallback<DataLabelsContext>getTextAlignCallback()Returns the text align callback.default doublegetTextShadowBlur()Returns the text shadow blur.default TextShadowBlurCallbackgetTextShadowBlurCallback()Returns the text shadow blur callback.default StringgetTextShadowColorAsString()Returns the text shadow color as string.default ColorCallback<DataLabelsContext>getTextShadowColorCallback()Returns the text shadow color callback.default StringgetTextStrokeColorAsString()Returns the text stroke color as string.default ColorCallback<DataLabelsContext>getTextStrokeColorCallback()Returns the text stroke color callback.default intgetTextStrokeWidth()Returns the text stroke width.default WidthCallback<DataLabelsContext>getTextStrokeWidthCallback()Returns the text stroke width callback.default booleanisClamp()Returnstrueto enforce the anchor position to be calculated based on the visible geometry of the associated element (i.e.default booleanisClip()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, getEvents, getId, getPluginId, loadGlobalsPluginOptions, setEvents, setEvents, store, store, store, store
-
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, 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, 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.IDplugin options.
-
DataLabelsOptions
public DataLabelsOptions(IsChart chart)
Creates newDataLabelsPlugin.IDplugin 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:AbstractPluginOptionsThis is invoked before storing the plugins options as default.- Overrides:
applyingDefaultsin 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()
Returnstrueto enforce the anchor position to be calculated based on the visible geometry of the associated element (i.e. part inside the chart area).- Returns:
trueto 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 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.
-
-