public final class Label extends AbstractNode implements IsScriptableFontProvider<LabelsContext>
LabelsPlugin.ID
plugin options, both at chart and global level.Modifier and Type | Field and Description |
---|---|
static boolean |
DEFAULT_ARC
Default to enable drawing label in arc, false.
|
static int |
DEFAULT_OUTSIDE_PADDING
Default padding when position is
Position.OUTSIDE , 2. |
static boolean |
DEFAULT_OVERLAP
Default to enable drawing label even it's overlap, true.
|
static Position |
DEFAULT_POSITION
Default position to draw label,
Position.DEFAULT . |
static int |
DEFAULT_PRECISION
Default the precision for percentage, 0.
|
static Render |
DEFAULT_RENDER
Default rendering (what data must be showed),
Render.VALUE . |
static int |
DEFAULT_SHADOW_BLUR
Default text shadow intensity, 6.
|
static String |
DEFAULT_SHADOW_COLOR
Default text shadow color, "rgba(0,0,0,0.3)".
|
static int |
DEFAULT_SHADOW_OFFSET_X
Default text shadow X offset, 3.
|
static int |
DEFAULT_SHADOW_OFFSET_Y
Default text shadow Y offset, 3.
|
static boolean |
DEFAULT_SHOW_ACTUAL_PERCENTAGES
Default to enable showing the real calculated percentages from the values, false.
|
static boolean |
DEFAULT_SHOW_ZERO
Default to enable whether or not labels of value 0 are displayed, false.
|
static int |
DEFAULT_TEXT_MARGIN
Default the margin of text when position is
Position.OUTSIDE or Position.BORDER , 2. |
static boolean |
DEFAULT_TEXT_SHADOW
Default to enable if draws text shadows under labels, false.
|
Constructor and Description |
---|
Label()
Creates new
LabelsPlugin.ID plugin label, using an incremental id. |
Label(LabelId id)
Creates new
LabelsPlugin.ID plugin label, using the id passed as argument as label id. |
Label(String id)
Creates new
LabelsPlugin.ID plugin label, using the id passed as argument as label id. |
Modifier and Type | Method and Description |
---|---|
IsColor |
getColor()
Returns the font color.
|
String |
getColorAsString()
Returns the font color as string.
|
ColorCallback<LabelsContext> |
getColorCallback()
Returns the font color callback, if set, otherwise
null . |
Font |
getFont()
Returns the the font object.
|
FontCallback<LabelsContext> |
getFontCallback()
Returns the font callback, if set, otherwise
null . |
LabelId |
getId()
Returns the id of label.
|
List<Img> |
getImages()
Returns the images when
Render is Render.IMAGE . |
int |
getOutsidePadding()
Returns the padding when position is
Position.OUTSIDE . |
Position |
getPosition()
Returns the position to draw label.
|
int |
getPrecision()
Returns the precision for percentage.
|
Render |
getRender()
Returns what data must be showed.
|
RenderCallback |
getRenderCallback()
Returns the render callback, if set, otherwise
null . |
int |
getShadowBlur()
Returns the text shadow intensity.
|
IsColor |
getShadowColor()
Returns the text shadow color as color.
|
String |
getShadowColorAsString()
Returns the text shadow color as string.
|
int |
getShadowOffsetX()
Returns the text shadow X offset.
|
int |
getShadowOffsetY()
Returns the text shadow Y offset.
|
int |
getTextMargin()
Returns the margin of text when position is
Position.OUTSIDE or Position.BORDER . |
boolean |
isArc()
Returns if draws label in arc.
|
boolean |
isOverlap()
Returns if draws label even it's overlap.
|
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.
|
boolean |
isShowZero()
Returns whether or not labels of value 0 are displayed.
|
boolean |
isTextShadow()
Returns if draws text shadows under labels.
|
void |
setArc(boolean arc)
Sets if draws label in arc.
|
void |
setColor(ColorCallback<LabelsContext> colorCallback)
Sets the font color callback.
|
void |
setColor(IsColor color)
Sets the font color.
|
void |
setColor(NativeCallback colorCallback)
Sets the font color callback.
|
void |
setColor(String color)
Sets the font color.
|
void |
setFont(FontCallback<LabelsContext> fontCallback)
Sets the font callback.
|
void |
setFont(NativeCallback fontCallback)
Sets the font callback.
|
void |
setImages(Img... images)
Sets the images when
Render is Render.IMAGE . |
void |
setOutsidePadding(int outsidePadding)
Sets the padding when position is
Position.OUTSIDE . |
void |
setOverlap(boolean overlap)
Sets if draws label even it's overlap.
|
void |
setPosition(Position position)
+ Sets the position to draw label.
|
void |
setPrecision(int precision)
Sets the precision for percentage.
|
void |
setRender(NativeCallback renderCallback)
Sets the render callback.
|
void |
setRender(Render render)
Sets what data must be showed.
|
void |
setRender(RenderCallback renderCallback)
Sets the render callback.
|
void |
setShadowBlur(int shadowBlur)
Sets the text shadow intensity.
|
void |
setShadowColor(IsColor shadowColor)
Sets the text shadow color as color.
|
void |
setShadowColor(String shadowColor)
Sets the text shadow color as string.
|
void |
setShadowOffsetX(int shadowOffsetX)
Sets the text shadow X offset.
|
void |
setShadowOffsetY(int shadowOffsetY)
Sets the text shadow Y offset.
|
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.
|
void |
setShowZero(boolean showZero)
Sets whether or not labels of value 0 are displayed.
|
void |
setTextMargin(int textMargin)
Sets the margin of text when position is
Position.OUTSIDE or Position.BORDER . |
void |
setTextShadow(boolean textShadow)
Sets if draws text shadows under labels.
|
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
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
public static final Render DEFAULT_RENDER
Render.VALUE
.public static final int DEFAULT_PRECISION
public static final boolean DEFAULT_SHOW_ZERO
public static final boolean DEFAULT_TEXT_SHADOW
public static final int DEFAULT_SHADOW_BLUR
public static final int DEFAULT_SHADOW_OFFSET_X
public static final int DEFAULT_SHADOW_OFFSET_Y
public static final String DEFAULT_SHADOW_COLOR
public static final boolean DEFAULT_ARC
public static final Position DEFAULT_POSITION
Position.DEFAULT
.public static final boolean DEFAULT_OVERLAP
public static final boolean DEFAULT_SHOW_ACTUAL_PERCENTAGES
public static final int DEFAULT_OUTSIDE_PADDING
Position.OUTSIDE
, 2.public static final int DEFAULT_TEXT_MARGIN
Position.OUTSIDE
or Position.BORDER
, 2.public Label()
LabelsPlugin.ID
plugin label, using an incremental id.public Label(String id)
LabelsPlugin.ID
plugin label, using the id passed as argument as label id.id
- id to apply to new label.public Label(LabelId id)
LabelsPlugin.ID
plugin label, using the id passed as argument as label id.id
- id to apply to new label.public LabelId getId()
public Font getFont()
public void setColor(IsColor color)
color
- font color.public void setColor(String color)
color
- font color.public String getColorAsString()
public IsColor getColor()
public void setRender(Render render)
render
- what data must be showed.public Render getRender()
public void setPrecision(int precision)
precision
- the precision for percentagepublic int getPrecision()
public void setShowZero(boolean showZero)
showZero
- whether or not labels of value 0 are displayed.public boolean isShowZero()
public void setTextShadow(boolean textShadow)
textShadow
- true
if draws text shadows under labels.public boolean isTextShadow()
true
if draws text shadows under labels.public void setShadowBlur(int shadowBlur)
shadowBlur
- the text shadow intensity.public int getShadowBlur()
public void setShadowOffsetX(int shadowOffsetX)
shadowOffsetX
- the text shadow X offset.public int getShadowOffsetX()
public void setShadowOffsetY(int shadowOffsetY)
shadowOffsetY
- the text shadow Y offset.public int getShadowOffsetY()
public void setShadowColor(IsColor shadowColor)
shadowColor
- the text shadow color as color.public void setShadowColor(String shadowColor)
shadowColor
- the text shadow color as string.public String getShadowColorAsString()
public IsColor getShadowColor()
public void setArc(boolean arc)
arc
- if draws label in arc.public boolean isArc()
true
if draws label in arc.public void setPosition(Position position)
position
- the position to draw label.public Position getPosition()
public void setOverlap(boolean overlap)
overlap
- if draws label even it's overlap.public boolean isOverlap()
true
if draws label even it's overlap.public void setShowActualPercentages(boolean showActualPercentages)
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.public boolean isShowActualPercentages()
true
if shows the real calculated percentages from the values and don't apply the additional logic to fit the percentages to 100 in total.public void setOutsidePadding(int outsidePadding)
Position.OUTSIDE
.outsidePadding
- the padding when position is Position.OUTSIDE
.public int getOutsidePadding()
Position.OUTSIDE
.Position.OUTSIDE
.public void setTextMargin(int textMargin)
Position.OUTSIDE
or Position.BORDER
.textMargin
- the margin of text when position is Position.OUTSIDE
or Position.BORDER
.public int getTextMargin()
Position.OUTSIDE
or Position.BORDER
.Position.OUTSIDE
or Position.BORDER
.public void setImages(Img... images)
Render
is Render.IMAGE
.images
- images when Render
is Render.IMAGE
.public List<Img> getImages()
Render
is Render.IMAGE
.Render
is Render.IMAGE
or an empty list.public RenderCallback getRenderCallback()
null
.null
public void setRender(RenderCallback renderCallback)
renderCallback
- the render callback to setpublic void setRender(NativeCallback renderCallback)
renderCallback
- the render callback to setpublic FontCallback<LabelsContext> getFontCallback()
null
.getFontCallback
in interface IsScriptableFontProvider<LabelsContext>
null
public void setFont(FontCallback<LabelsContext> fontCallback)
setFont
in interface IsScriptableFontProvider<LabelsContext>
fontCallback
- the font callback.public void setFont(NativeCallback fontCallback)
setFont
in interface IsScriptableFontProvider<LabelsContext>
fontCallback
- the font callback.public ColorCallback<LabelsContext> getColorCallback()
null
.null
public void setColor(ColorCallback<LabelsContext> colorCallback)
colorCallback
- the font color callback.public void setColor(NativeCallback colorCallback)
colorCallback
- the font color callback.