Class Label
- java.lang.Object
- 
- org.pepstock.charba.client.commons.NativeObjectContainer
- 
- org.pepstock.charba.client.commons.AbstractNode
- 
- org.pepstock.charba.client.labels.Label
 
 
 
- 
- All Implemented Interfaces:
- IsScriptableFontProvider<LabelsContext>
 
 public final class Label extends AbstractNode implements IsScriptableFontProvider<LabelsContext> This is the object to map theLabelsPlugin.IDplugin options, both at chart and global level.- Author:
- Andrea "Stock" Stocchero
 
- 
- 
Field SummaryFields Modifier and Type Field Description static booleanDEFAULT_ARCDefault to enable drawing label in arc, false.static intDEFAULT_OUTSIDE_PADDINGDefault padding when position isPosition.OUTSIDE, 2.static booleanDEFAULT_OVERLAPDefault to enable drawing label even it's overlap, true.static PositionDEFAULT_POSITIONDefault position to draw label,Position.DEFAULT.static intDEFAULT_PRECISIONDefault the precision for percentage, 0.static RenderDEFAULT_RENDERDefault rendering (what data must be showed),Render.VALUE.static intDEFAULT_SHADOW_BLURDefault text shadow intensity, 6.static StringDEFAULT_SHADOW_COLORDefault text shadow color, "rgba(0,0,0,0.3)".static intDEFAULT_SHADOW_OFFSET_XDefault text shadow X offset, 3.static intDEFAULT_SHADOW_OFFSET_YDefault text shadow Y offset, 3.static booleanDEFAULT_SHOW_ACTUAL_PERCENTAGESDefault to enable showing the real calculated percentages from the values, false.static booleanDEFAULT_SHOW_ZERODefault to enable whether or not labels of value 0 are displayed, false.static intDEFAULT_TEXT_MARGINDefault the margin of text when position isPosition.OUTSIDEorPosition.BORDER, 2.static booleanDEFAULT_TEXT_SHADOWDefault to enable if draws text shadows under labels, false.
 - 
Constructor SummaryConstructors Constructor Description Label()Creates newLabelsPlugin.IDplugin label, using an incremental id.Label(String id)Creates newLabelsPlugin.IDplugin label, using the id passed as argument as label id.Label(LabelId id)Creates newLabelsPlugin.IDplugin label, using the id passed as argument as label id.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description IsColorgetColor()Returns the font color.StringgetColorAsString()Returns the font color as string.ColorCallback<LabelsContext>getColorCallback()Returns the font color callback, if set, otherwisenull.FontgetFont()Returns the font object.FontCallback<LabelsContext>getFontCallback()Returns the font callback, if set, otherwisenull.LabelIdgetId()Returns the id of label.List<Img>getImages()Returns the images whenRenderisRender.IMAGE.intgetOutsidePadding()Returns the padding when position isPosition.OUTSIDE.PositiongetPosition()Returns the position to draw label.intgetPrecision()Returns the precision for percentage.RendergetRender()Returns what data must be showed.RenderCallbackgetRenderCallback()Returns the render callback, if set, otherwisenull.intgetShadowBlur()Returns the text shadow intensity.IsColorgetShadowColor()Returns the text shadow color as color.StringgetShadowColorAsString()Returns the text shadow color as string.intgetShadowOffsetX()Returns the text shadow X offset.intgetShadowOffsetY()Returns the text shadow Y offset.intgetTextMargin()Returns the margin of text when position isPosition.OUTSIDEorPosition.BORDER.booleanisArc()Returns if draws label in arc.booleanisOverlap()Returns if draws label even it's overlap.booleanisShowActualPercentages()Returns if shows the real calculated percentages from the values and don't apply the additional logic to fit the percentages to 100 in total.booleanisShowZero()Returns whether or not labels of value 0 are displayed.booleanisTextShadow()Returns if draws text shadows under labels.voidsetArc(boolean arc)Sets if draws label in arc.voidsetColor(String color)Sets the font color.voidsetColor(ColorCallback<LabelsContext> colorCallback)Sets the font color callback.voidsetColor(NativeCallback colorCallback)Sets the font color callback.voidsetColor(IsColor color)Sets the font color.voidsetFont(FontCallback<LabelsContext> fontCallback)Sets the font callback.voidsetFont(NativeCallback fontCallback)Sets the font callback.voidsetImages(Img... images)Sets the images whenRenderisRender.IMAGE.voidsetOutsidePadding(int outsidePadding)Sets the padding when position isPosition.OUTSIDE.voidsetOverlap(boolean overlap)Sets if draws label even it's overlap.voidsetPosition(Position position)+ Sets the position to draw label.voidsetPrecision(int precision)Sets the precision for percentage.voidsetRender(NativeCallback renderCallback)Sets the render callback.voidsetRender(RenderCallback renderCallback)Sets the render callback.voidsetRender(Render render)Sets what data must be showed.voidsetShadowBlur(int shadowBlur)Sets the text shadow intensity.voidsetShadowColor(String shadowColor)Sets the text shadow color as string.voidsetShadowColor(IsColor shadowColor)Sets the text shadow color as color.voidsetShadowOffsetX(int shadowOffsetX)Sets the text shadow X offset.voidsetShadowOffsetY(int shadowOffsetY)Sets the text shadow Y offset.voidsetShowActualPercentages(boolean showActualPercentages)Sets if shows the real calculated percentages from the values and don't apply the additional logic to fit the percentages to 100 in total.voidsetShowZero(boolean showZero)Sets whether or not labels of value 0 are displayed.voidsetTextMargin(int textMargin)Sets the margin of text when position isPosition.OUTSIDEorPosition.BORDER.voidsetTextShadow(boolean textShadow)Sets if draws text shadows under labels.- 
Methods inherited from class org.pepstock.charba.client.commons.AbstractNodecheckAndAddToParent, 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, setValueAndAddToParent, setValueOrArrayAndAddToParent, setValueOrArrayAndAddToParent, setValueOrArrayAndAddToParent, setValueOrArrayAndAddToParent, setValueOrArrayAndAddToParent, setValueOrArrayAndAddToParent, setValueOrArrayAndAddToParent, setValueOrArrayAndAddToParent, setValueOrArrayAndAddToParent, setValueOrArrayAndAddToParent
 - 
Methods inherited from class org.pepstock.charba.client.commons.NativeObjectContainercheckDefaultValuesArgument, 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, setValue, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, toJSON, type
 
- 
 
- 
- 
- 
Field Detail- 
DEFAULT_RENDERpublic static final Render DEFAULT_RENDER Default rendering (what data must be showed),Render.VALUE.
 - 
DEFAULT_PRECISIONpublic static final int DEFAULT_PRECISION Default the precision for percentage, 0.- See Also:
- Constant Field Values
 
 - 
DEFAULT_SHOW_ZEROpublic static final boolean DEFAULT_SHOW_ZERO Default to enable whether or not labels of value 0 are displayed, false.- See Also:
- Constant Field Values
 
 - 
DEFAULT_TEXT_SHADOWpublic static final boolean DEFAULT_TEXT_SHADOW Default to enable if draws text shadows under labels, false.- See Also:
- Constant Field Values
 
 - 
DEFAULT_SHADOW_BLURpublic static final int DEFAULT_SHADOW_BLUR Default text shadow intensity, 6.- See Also:
- Constant Field Values
 
 - 
DEFAULT_SHADOW_OFFSET_Xpublic static final int DEFAULT_SHADOW_OFFSET_X Default text shadow X offset, 3.- See Also:
- Constant Field Values
 
 - 
DEFAULT_SHADOW_OFFSET_Ypublic static final int DEFAULT_SHADOW_OFFSET_Y Default text shadow Y offset, 3.- See Also:
- Constant Field Values
 
 - 
DEFAULT_SHADOW_COLORpublic static final String DEFAULT_SHADOW_COLOR Default text shadow color, "rgba(0,0,0,0.3)".- See Also:
- Constant Field Values
 
 - 
DEFAULT_ARCpublic static final boolean DEFAULT_ARC Default to enable drawing label in arc, false.- See Also:
- Constant Field Values
 
 - 
DEFAULT_POSITIONpublic static final Position DEFAULT_POSITION Default position to draw label,Position.DEFAULT.
 - 
DEFAULT_OVERLAPpublic static final boolean DEFAULT_OVERLAP Default to enable drawing label even it's overlap, true.- See Also:
- Constant Field Values
 
 - 
DEFAULT_SHOW_ACTUAL_PERCENTAGESpublic static final boolean DEFAULT_SHOW_ACTUAL_PERCENTAGES Default to enable showing the real calculated percentages from the values, false.- See Also:
- Constant Field Values
 
 - 
DEFAULT_OUTSIDE_PADDINGpublic static final int DEFAULT_OUTSIDE_PADDING Default padding when position isPosition.OUTSIDE, 2.- See Also:
- Constant Field Values
 
 - 
DEFAULT_TEXT_MARGINpublic static final int DEFAULT_TEXT_MARGIN Default the margin of text when position isPosition.OUTSIDEorPosition.BORDER, 2.- See Also:
- Constant Field Values
 
 
- 
 - 
Constructor Detail- 
Labelpublic Label() Creates newLabelsPlugin.IDplugin label, using an incremental id.
 - 
Labelpublic Label(String id) Creates newLabelsPlugin.IDplugin label, using the id passed as argument as label id.- Parameters:
- id- id to apply to new label.
 
 - 
Labelpublic Label(LabelId id) Creates newLabelsPlugin.IDplugin label, using the id passed as argument as label id.- Parameters:
- id- id to apply to new label.
 
 
- 
 - 
Method Detail- 
getIdpublic LabelId getId() Returns the id of label.- Returns:
- the id of label
 
 - 
getFontpublic Font getFont() Returns the font object.- Returns:
- the font object.
 
 - 
setColorpublic void setColor(IsColor color) Sets the font color.- Parameters:
- color- font color.
 
 - 
setColorpublic void setColor(String color) Sets the font color.- Parameters:
- color- font color.
 
 - 
getColorAsStringpublic String getColorAsString() Returns the font color as string.- Returns:
- font color as string
 
 - 
getColorpublic IsColor getColor() Returns the font color.- Returns:
- font color
 
 - 
setRenderpublic void setRender(Render render) Sets what data must be showed.- Parameters:
- render- what data must be showed.
 
 - 
getRenderpublic Render getRender() Returns what data must be showed.- Returns:
- what data must be showed.
 
 - 
setPrecisionpublic void setPrecision(int precision) Sets the precision for percentage.- Parameters:
- precision- the precision for percentage
 
 - 
getPrecisionpublic int getPrecision() Returns the precision for percentage.- Returns:
- the precision for percentage.
 
 - 
setShowZeropublic void setShowZero(boolean showZero) Sets whether or not labels of value 0 are displayed.- Parameters:
- showZero- whether or not labels of value 0 are displayed.
 
 - 
isShowZeropublic boolean isShowZero() Returns whether or not labels of value 0 are displayed.- Returns:
- whether or not labels of value 0 are displayed.
 
 - 
setTextShadowpublic void setTextShadow(boolean textShadow) Sets if draws text shadows under labels.- Parameters:
- textShadow-- trueif draws text shadows under labels.
 
 - 
isTextShadowpublic boolean isTextShadow() Returns if draws text shadows under labels.- Returns:
- trueif draws text shadows under labels.
 
 - 
setShadowBlurpublic void setShadowBlur(int shadowBlur) Sets the text shadow intensity.- Parameters:
- shadowBlur- the text shadow intensity.
 
 - 
getShadowBlurpublic int getShadowBlur() Returns the text shadow intensity.- Returns:
- the text shadow intensity.
 
 - 
setShadowOffsetXpublic void setShadowOffsetX(int shadowOffsetX) Sets the text shadow X offset.- Parameters:
- shadowOffsetX- the text shadow X offset.
 
 - 
getShadowOffsetXpublic int getShadowOffsetX() Returns the text shadow X offset.- Returns:
- the text shadow X offset.
 
 - 
setShadowOffsetYpublic void setShadowOffsetY(int shadowOffsetY) Sets the text shadow Y offset.- Parameters:
- shadowOffsetY- the text shadow Y offset.
 
 - 
getShadowOffsetYpublic int getShadowOffsetY() Returns the text shadow Y offset.- Returns:
- the text shadow Y offset.
 
 - 
setShadowColorpublic void setShadowColor(IsColor shadowColor) Sets the text shadow color as color.- Parameters:
- shadowColor- the text shadow color as color.
 
 - 
setShadowColorpublic void setShadowColor(String shadowColor) Sets the text shadow color as string.- Parameters:
- shadowColor- the text shadow color as string.
 
 - 
getShadowColorAsStringpublic String getShadowColorAsString() Returns the text shadow color as string.- Returns:
- the text shadow color as string.
 
 - 
getShadowColorpublic IsColor getShadowColor() Returns the text shadow color as color.- Returns:
- the text shadow color as color.
 
 - 
setArcpublic void setArc(boolean arc) Sets if draws label in arc. For bar chart this is ignored.- Parameters:
- arc- if draws label in arc.
 
 - 
isArcpublic boolean isArc() Returns if draws label in arc.- Returns:
- trueif draws label in arc.
 
 - 
setPositionpublic void setPosition(Position position) + Sets the position to draw label. For bar chart this is ignored.- Parameters:
- position- the position to draw label.
 
 - 
getPositionpublic Position getPosition() Returns the position to draw label.- Returns:
- the position to draw label.
 
 - 
setOverlappublic void setOverlap(boolean overlap) Sets if draws label even it's overlap. For bar chart this is ignored.- Parameters:
- overlap- if draws label even it's overlap.
 
 - 
isOverlappublic boolean isOverlap() Returns if draws label even it's overlap.- Returns:
- trueif draws label even it's overlap.
 
 - 
setShowActualPercentagespublic void setShowActualPercentages(boolean showActualPercentages) Sets if shows the real calculated percentages from the values and don't apply the additional logic to fit the percentages to 100 in total.- Parameters:
- showActualPercentages- if shows the real calculated percentages from the values and don't apply the additional logic to fit the percentages to 100 in total.
 
 - 
isShowActualPercentagespublic boolean isShowActualPercentages() Returns if shows the real calculated percentages from the values and don't apply the additional logic to fit the percentages to 100 in total.- Returns:
- trueif shows the real calculated percentages from the values and don't apply the additional logic to fit the percentages to 100 in total.
 
 - 
setOutsidePaddingpublic void setOutsidePadding(int outsidePadding) Sets the padding when position isPosition.OUTSIDE.- Parameters:
- outsidePadding- the padding when position is- Position.OUTSIDE.
 
 - 
getOutsidePaddingpublic int getOutsidePadding() Returns the padding when position isPosition.OUTSIDE.- Returns:
- the padding when position is Position.OUTSIDE.
 
 - 
setTextMarginpublic void setTextMargin(int textMargin) Sets the margin of text when position isPosition.OUTSIDEorPosition.BORDER.- Parameters:
- textMargin- the margin of text when position is- Position.OUTSIDEor- Position.BORDER.
 
 - 
getTextMarginpublic int getTextMargin() Returns the margin of text when position isPosition.OUTSIDEorPosition.BORDER.- Returns:
- the margin of text when position is Position.OUTSIDEorPosition.BORDER.
 
 - 
setImagespublic void setImages(Img... images) Sets the images whenRenderisRender.IMAGE.- Parameters:
- images- images when- Renderis- Render.IMAGE.
 
 - 
getImagespublic List<Img> getImages() Returns the images whenRenderisRender.IMAGE.- Returns:
- the images when RenderisRender.IMAGEor an empty list.
 
 - 
getRenderCallbackpublic RenderCallback getRenderCallback() Returns the render callback, if set, otherwisenull.- Returns:
- the render callback, if set, otherwise null
 
 - 
setRenderpublic void setRender(RenderCallback renderCallback) Sets the render callback.- Parameters:
- renderCallback- the render callback to set
 
 - 
setRenderpublic void setRender(NativeCallback renderCallback) Sets the render callback.- Parameters:
- renderCallback- the render callback to set
 
 - 
getFontCallbackpublic FontCallback<LabelsContext> getFontCallback() Returns the font callback, if set, otherwisenull.- Specified by:
- getFontCallbackin interface- IsScriptableFontProvider<LabelsContext>
- Returns:
- the font callback, if set, otherwise null
 
 - 
setFontpublic void setFont(FontCallback<LabelsContext> fontCallback) Sets the font callback.- Specified by:
- setFontin interface- IsScriptableFontProvider<LabelsContext>
- Parameters:
- fontCallback- the font callback.
 
 - 
setFontpublic void setFont(NativeCallback fontCallback) Sets the font callback.- Specified by:
- setFontin interface- IsScriptableFontProvider<LabelsContext>
- Parameters:
- fontCallback- the font callback.
 
 - 
getColorCallbackpublic ColorCallback<LabelsContext> getColorCallback() Returns the font color callback, if set, otherwisenull.- Returns:
- the font color callback, if set, otherwise null
 
 - 
setColorpublic void setColor(ColorCallback<LabelsContext> colorCallback) Sets the font color callback.- Parameters:
- colorCallback- the font color callback.
 
 - 
setColorpublic void setColor(NativeCallback colorCallback) Sets the font color callback.- Parameters:
- colorCallback- the font color callback.
 
 
- 
 
-