public final class DataLabelsOptions extends AbstractPluginCachedOptions
DataLabelsPlugin.ID
plugin options where to set all the configuration needed to the plugin.DataLabelsPlugin.ID
plugin is highly customizable CHART.JS plugin that displays labels on data for any type of
charts.Modifier and Type | Field and 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 double |
DEFAULT_OFFSET
Default distance (in pixels) to pull the label away from the anchor point, 4.0.
|
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 and Description |
---|
DataLabelsOptions()
Creates new
DataLabelsPlugin.ID plugin options. |
DataLabelsOptions(IsChart chart)
Creates new
DataLabelsPlugin.ID plugin options, relating to chart instance for default. |
Modifier and Type | Method and Description |
---|---|
Align |
getAlign()
Returns the position of the label relative to the anchor point position and orientation.
|
AlignCallback |
getAlignCallback()
Returns the align callback, if set, otherwise
null . |
Anchor |
getAnchor()
Returns the anchor point, which is defined by an orientation vector and a position on the data element.
|
AnchorCallback |
getAnchorCallback()
Returns the anchor callback, if set, otherwise
null . |
IsColor |
getBackgroundColor()
Returns the background color.
|
String |
getBackgroundColorAsString()
Returns the background color as string.
|
BackgroundColorCallback |
getBackgroundColorCallback()
Returns the background color callback, if set, otherwise
null . |
IsColor |
getBorderColor()
Returns the border color.
|
String |
getBorderColorAsString()
Returns the border color as string.
|
BorderColorCallback |
getBorderColorCallback()
Returns the border color callback, if set, otherwise
null . |
double |
getBorderRadius()
Returns the border radius.
|
RadiusCallback |
getBorderRadiusCallback()
Returns the border radius callback, if set, otherwise
null . |
int |
getBorderWidth()
Returns the border width.
|
BorderWidthCallback |
getBorderWidthCallback()
Returns the border width callback, if set, otherwise
null . |
ClampCallback |
getClampCallback()
Returns the clamp callback, if set, otherwise
null . |
ClipCallback |
getClipCallback()
Returns the clip callback, if set, otherwise
null . |
IsColor |
getColor()
Returns the color.
|
String |
getColorAsString()
Returns the color as string.
|
ColorCallback |
getColorCallback()
Returns the color callback, if set, otherwise
null . |
Display |
getDisplay()
Returns the visibility of labels.
|
DisplayCallback |
getDisplayCallback()
Returns the display callback, if set, otherwise
null . |
Font |
getFont()
Returns the font element.
|
FontCallback |
getFontCallback()
Returns the font callback, if set, otherwise
null . |
FormatterCallback |
getFormatterCallback()
Returns the formatter callback, if set, otherwise
null . |
protected Collection<AbstractPluginCachedOptions> |
getInnerOptions()
Returns a collection of inner options of the main one.
Must be override if inner options must be removed from cache. |
Labels |
getLabels()
Returns the labels element.
|
Listeners |
getListeners()
Returns the listeners element.
|
double |
getOffset()
Returns the distance (in pixels) to pull the label away from the anchor point.
|
OffsetCallback |
getOffsetCallback()
Returns the offset callback, if set, otherwise
null . |
double |
getOpacity()
Returns the opacity.
|
OpacityCallback |
getOpacityCallback()
Returns the opacity callback, if set, otherwise
null . |
Padding |
getPadding()
Returns the padding element.
|
PaddingCallback |
getPaddingCallback()
Returns the padding callback, if set, otherwise
null . |
double |
getRotation()
Returns the clockwise rotation angle (in degrees) of the label, the rotation center point being the label center.
|
RotationCallback |
getRotationCallback()
Returns the rotation callback, if set, otherwise
null . |
TextAlign |
getTextAlign()
Returns the text alignment being used when drawing the label text.
|
TextAlignCallback |
getTextAlignCallback()
Returns the text align callback, if set, otherwise
null . |
double |
getTextShadowBlur()
Returns the text shadow blur.
|
TextShadowBlurCallback |
getTextShadowBlurCallback()
Returns the text shadow blur callback, if set, otherwise
null . |
IsColor |
getTextShadowColor()
Returns the text shadow color.
|
String |
getTextShadowColorAsString()
Returns the text shadow color as string.
|
TextShadowColorCallback |
getTextShadowColorCallback()
Returns the text shadow color callback, if set, otherwise
null . |
IsColor |
getTextStrokeColor()
Returns the text stroke color.
|
String |
getTextStrokeColorAsString()
Returns the text stroke color as string.
|
TextStrokeColorCallback |
getTextStrokeColorCallback()
Returns the text stroke color callback, if set, otherwise
null . |
int |
getTextStrokeWidth()
Returns the text stroke width.
|
TextStrokeWidthCallback |
getTextStrokeWidthCallback()
Returns the text stroke width callback, if set, otherwise
null . |
boolean |
isClamp()
Returns
true to enforce the anchor position to be calculated based on the visible geometry of the associated
element (i.e. |
boolean |
isClip()
When the clip option is
true , the part of the label which is outside the chart area will be masked. |
void |
setAlign(Align align)
Sets the position of the label relative to the anchor point position and orientation.
|
void |
setAlign(AlignCallback alignCallback)
Sets the align callback.
|
void |
setAnchor(Anchor anchor)
Sets the anchor point, which is defined by an orientation vector and a position on the data element.
|
void |
setAnchor(AnchorCallback anchorCallback)
Sets the anchor callback.
|
void |
setBackgroundColor(BackgroundColorCallback backgroundColorCallback)
Sets the background color callback.
|
void |
setBackgroundColor(IsColor color)
Sets the background color.
|
void |
setBackgroundColor(String color)
Sets the background color.
|
void |
setBorderColor(BorderColorCallback borderColorCallback)
Sets the border color callback.
|
void |
setBorderColor(IsColor color)
Sets the border color.
|
void |
setBorderColor(String color)
Sets the border color.
|
void |
setBorderRadius(double radius)
Sets the border radius.
|
void |
setBorderRadius(RadiusCallback borderRadiusCallback)
Sets the border radius callback.
|
void |
setBorderWidth(BorderWidthCallback borderWidthCallback)
Sets the border width callback.
|
void |
setBorderWidth(int width)
Sets the border width.
|
void |
setClamp(boolean clamp)
Sets
true to enforce the anchor position to be calculated based on the visible geometry of the associated
element (i.e. |
void |
setClamp(ClampCallback clampCallback)
Sets the clamp callback.
|
void |
setClip(boolean clip)
When the clip option is
true , the part of the label which is outside the chart area will be masked. |
void |
setClip(ClipCallback clipCallback)
Sets the clip callback.
|
void |
setColor(ColorCallback colorCallback)
Sets the color callback.
|
void |
setColor(IsColor color)
Sets the color.
|
void |
setColor(String color)
Sets the color.
|
void |
setDisplay(boolean display)
Sets the visibility of labels.
|
void |
setDisplay(Display display)
Sets the visibility of labels.
|
void |
setDisplay(DisplayCallback displayCallback)
Sets the display callback.
|
void |
setFont(FontCallback fontCallback)
Sets the the font callback.
|
void |
setFormatter(FormatterCallback formatterCallback)
Sets the formatter callback.
|
void |
setListenersHandler(AbstractEventHandler handler)
Adds a event handler instance as listener for all events.
|
void |
setOffset(double offset)
Sets the distance (in pixels) to pull the label away from the anchor point.
|
void |
setOffset(OffsetCallback offsetCallback)
Sets the offset callback.
|
void |
setOpacity(double opacity)
Sets the opacity.
|
void |
setOpacity(OpacityCallback opacityCallback)
Sets the opacity callback.
|
void |
setPadding(PaddingCallback paddingCallback)
Sets the padding callback.
|
void |
setRotation(double rotation)
Sets the clockwise rotation angle (in degrees) of the label, the rotation center point being the label center.
|
void |
setRotation(RotationCallback rotationCallback)
Sets the rotation callback.
|
void |
setTextAlign(TextAlign textAlign)
Sets the text alignment being used when drawing the label text.
|
void |
setTextAlign(TextAlignCallback textAlignCallback)
Sets the text align callback.
|
void |
setTextShadowBlur(double textShadowBlur)
Sets the text shadow blur.
|
void |
setTextShadowBlur(TextShadowBlurCallback textShadowBlurCallback)
Sets the text shadow blur callback.
|
void |
setTextShadowColor(IsColor color)
Sets the text shadow color color.
|
void |
setTextShadowColor(String color)
Sets the text shadow color color.
|
void |
setTextShadowColor(TextShadowColorCallback textShadowColorCallback)
Sets the text shadow color callback.
|
void |
setTextStrokeColor(IsColor color)
Sets the text stroke color.
|
void |
setTextStrokeColor(String color)
Sets the text stroke color.
|
void |
setTextStrokeColor(TextStrokeColorCallback textStrokeColorCallback)
Sets the text stroke color callback.
|
void |
setTextStrokeWidth(int textStrokeWidth)
Sets the text stroke width.
|
void |
setTextStrokeWidth(TextStrokeWidthCallback textStrokeWidthCallback)
Sets the text stroke width callback.
|
getReferences, register
getId, getPluginId, loadGlobalsPluginOptions, store, store, store, store
checkValue, empty, getArrayValue, getNativeObject, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValueForMultipleKeyTypes, getValueForMultipleKeyTypes, getValueForMultipleKeyTypes, getValueOrArray, getValueOrArray, getValueOrArray, getValueOrArray, getValueOrArray, getValueOrArray, getValueOrArray, has, has, keys, remove, remove, removeIfExists, setArrayValue, setArrayValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, toJSON, type
public static final Align DEFAULT_ALIGN
Align.CENTER
.public static final Anchor DEFAULT_ANCHOR
Anchor.CENTER
.public static final String DEFAULT_BACKGROUND_COLOR
null
, and uses the background color of dataset.public static final String DEFAULT_BORDER_COLOR
null
, and uses the border color of dataset.public static final double DEFAULT_BORDER_RADIUS
public static final int DEFAULT_BORDER_WIDTH
public static final boolean DEFAULT_CLAMP
public static final boolean DEFAULT_CLIP
public static final Display DEFAULT_DISPLAY
Display.TRUE
.public static final double DEFAULT_OFFSET
public static final double DEFAULT_OPACITY
public static final double DEFAULT_ROTATION
public static final TextAlign DEFAULT_TEXT_ALIGN
TextAlign.START
.public static final int DEFAULT_TEXT_STROKE_WIDTH
public static final double DEFAULT_TEXT_SHADOW_BLUR
public DataLabelsOptions()
DataLabelsPlugin.ID
plugin options.public DataLabelsOptions(IsChart chart)
DataLabelsPlugin.ID
plugin options, relating to chart instance for default.chart
- chart instance related to the plugin optionsprotected Collection<AbstractPluginCachedOptions> getInnerOptions()
AbstractPluginCachedOptions
getInnerOptions
in class AbstractPluginCachedOptions
public Labels getLabels()
public Padding getPadding()
public Font getFont()
public Listeners getListeners()
public void setListenersHandler(AbstractEventHandler handler)
handler
- event handler instance as listener for all events.public void setAlign(Align align)
align
- the position of the label relative to the anchor point position and orientation.public Align getAlign()
public void setAnchor(Anchor anchor)
anchor
- the anchor point, which is defined by an orientation vector and a position on the data element.public Anchor getAnchor()
public void setBackgroundColor(IsColor color)
color
- the background colorpublic void setBackgroundColor(String color)
color
- the background colorpublic String getBackgroundColorAsString()
public IsColor getBackgroundColor()
public void setBorderColor(IsColor color)
color
- the border colorpublic void setBorderColor(String color)
color
- the border colorpublic String getBorderColorAsString()
public IsColor getBorderColor()
public void setBorderRadius(double radius)
radius
- the border radius.public double getBorderRadius()
public void setBorderWidth(int width)
width
- the border width.public int getBorderWidth()
public void setClamp(boolean clamp)
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).clamp
- 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).public boolean isClamp()
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).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).public void setClip(boolean clip)
true
, the part of the label which is outside the chart area will be masked.clip
- when the clip option is true
, the part of the label which is outside the chart area will be
masked.public boolean isClip()
true
, the part of the label which is outside the chart area will be masked.true
, the part of the label which is outside the chart area will be masked.public void setColor(IsColor color)
color
- the colorpublic void setColor(String color)
color
- the colorpublic String getColorAsString()
public IsColor getColor()
public void setDisplay(boolean display)
display
- the visibility of labels.public void setDisplay(Display display)
display
- the visibility of labels.public Display getDisplay()
public void setOffset(double offset)
offset
- 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.public double getOffset()
public void setOpacity(double opacity)
opacity
- the opacity.public double getOpacity()
public void setRotation(double rotation)
rotation
- the clockwise rotation angle (in degrees) of the label, the rotation center point being the label center.public double getRotation()
public void setTextAlign(TextAlign textAlign)
textAlign
- the text alignment being used when drawing the label text.public TextAlign getTextAlign()
public void setTextStrokeColor(IsColor color)
color
- the text stroke colorpublic void setTextStrokeColor(String color)
color
- the text stroke color.public String getTextStrokeColorAsString()
public IsColor getTextStrokeColor()
public void setTextStrokeWidth(int textStrokeWidth)
textStrokeWidth
- the text stroke width.public int getTextStrokeWidth()
public void setTextShadowBlur(double textShadowBlur)
textShadowBlur
- the text shadow blur.public double getTextShadowBlur()
public void setTextShadowColor(IsColor color)
color
- the text shadow color colorpublic void setTextShadowColor(String color)
color
- the text shadow color color.public String getTextShadowColorAsString()
public IsColor getTextShadowColor()
public BackgroundColorCallback getBackgroundColorCallback()
null
.null
.public void setBackgroundColor(BackgroundColorCallback backgroundColorCallback)
backgroundColorCallback
- the background color callback.public BorderColorCallback getBorderColorCallback()
null
.null
.public void setBorderColor(BorderColorCallback borderColorCallback)
borderColorCallback
- the border color callback.public ColorCallback getColorCallback()
null
.null
.public void setColor(ColorCallback colorCallback)
colorCallback
- the color callback.public FormatterCallback getFormatterCallback()
null
.null
.public void setFormatter(FormatterCallback formatterCallback)
formatterCallback
- the formatter callback to setpublic AlignCallback getAlignCallback()
null
.null
.public void setAlign(AlignCallback alignCallback)
alignCallback
- the align callback to setpublic AnchorCallback getAnchorCallback()
null
.null
.public void setAnchor(AnchorCallback anchorCallback)
anchorCallback
- the anchor callback to setpublic RadiusCallback getBorderRadiusCallback()
null
.null
.public void setBorderRadius(RadiusCallback borderRadiusCallback)
borderRadiusCallback
- the border radius callback to setpublic BorderWidthCallback getBorderWidthCallback()
null
.null
.public void setBorderWidth(BorderWidthCallback borderWidthCallback)
borderWidthCallback
- the border width callback to setpublic ClampCallback getClampCallback()
null
.null
.public void setClamp(ClampCallback clampCallback)
clampCallback
- the clamp callback to setpublic ClipCallback getClipCallback()
null
.null
.public void setClip(ClipCallback clipCallback)
clipCallback
- the clip callback to setpublic DisplayCallback getDisplayCallback()
null
.null
.public void setDisplay(DisplayCallback displayCallback)
displayCallback
- the display callback to setpublic OffsetCallback getOffsetCallback()
null
.null
.public void setOffset(OffsetCallback offsetCallback)
offsetCallback
- the offset callback to setpublic OpacityCallback getOpacityCallback()
null
.null
.public void setOpacity(OpacityCallback opacityCallback)
opacityCallback
- the opacity callback to setpublic RotationCallback getRotationCallback()
null
.null
.public void setRotation(RotationCallback rotationCallback)
rotationCallback
- the rotation callback to setpublic TextAlignCallback getTextAlignCallback()
null
.null
.public void setTextAlign(TextAlignCallback textAlignCallback)
textAlignCallback
- the text align callback to setpublic TextStrokeColorCallback getTextStrokeColorCallback()
null
.null
.public void setTextStrokeColor(TextStrokeColorCallback textStrokeColorCallback)
textStrokeColorCallback
- the text stroke color callback to setpublic TextStrokeWidthCallback getTextStrokeWidthCallback()
null
.null
.public void setTextStrokeWidth(TextStrokeWidthCallback textStrokeWidthCallback)
textStrokeWidthCallback
- the text stroke width callback to setpublic TextShadowBlurCallback getTextShadowBlurCallback()
null
.null
.public void setTextShadowBlur(TextShadowBlurCallback textShadowBlurCallback)
textShadowBlurCallback
- the text shadow blur callback to setpublic TextShadowColorCallback getTextShadowColorCallback()
null
.null
.public void setTextShadowColor(TextShadowColorCallback textShadowColorCallback)
textShadowColorCallback
- the text shadow color callback to setpublic FontCallback getFontCallback()
null
.null
.public void setFont(FontCallback fontCallback)
fontCallback
- the font callback to setpublic PaddingCallback getPaddingCallback()
null
.null
.public void setPadding(PaddingCallback paddingCallback)
paddingCallback
- the padding callback to set