Class LabelBuilder
- java.lang.Object
-
- org.pepstock.charba.client.labels.LabelBuilder
-
public final class LabelBuilder extends Object
Comfortable object to createLabelsPlugin.ID
plugin LABEL options by a builder.- Author:
- Andrea "Stock" Stocchero
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LabelsOptionsBuilder
getOptionsBuilder()
Returns theLabelsPlugin.ID
label builder.LabelBuilder
setArc(boolean arc)
Sets if draws label in arc.LabelBuilder
setColor(String color)
Sets the font color as string.LabelBuilder
setColor(IsColor color)
Sets the font color as color.LabelBuilder
setFont(FontCallback<LabelsContext> fontColorCallback)
Sets the font color callback.LabelBuilder
setFontFamily(String fontFamily)
Sets the font familyLabelBuilder
setFontSize(int size)
Sets the font size.LabelBuilder
setFontStyle(FontStyle fontStyle)
Sets the font style.LabelBuilder
setImages(Img... images)
Sets the images whenRender
isRender.IMAGE
.LabelBuilder
setOutsidePadding(int outsidePadding)
Sets the padding when position isPosition.OUTSIDE
.LabelBuilder
setOverlap(boolean overlap)
Sets if draws label even it's overlap.LabelBuilder
setPosition(Position position)
+ Sets the position to draw label.LabelBuilder
setPrecision(int precision)
Sets the precision for percentage.LabelBuilder
setRender(RenderCallback renderCallback)
Sets the render callback.LabelBuilder
setRender(Render render)
Sets what data must be showed.LabelBuilder
setShadowBlur(int shadowBlur)
Sets the text shadow intensity.LabelBuilder
setShadowColor(String shadowColor)
Sets the text shadow color as string.LabelBuilder
setShadowColor(IsColor shadowColor)
Sets the text shadow color as color.LabelBuilder
setShadowOffsetX(int shadowOffsetX)
Sets the text shadow X offset.LabelBuilder
setShadowOffsetY(int shadowOffsetY)
Sets the text shadow Y offset.LabelBuilder
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.LabelBuilder
setShowZero(boolean showZero)
Sets whether or not labels of value 0 are displayed.LabelBuilder
setTextMargin(int textMargin)
Sets the margin of text when position isPosition.OUTSIDE
orPosition.BORDER
.LabelBuilder
setTextShadow(boolean textShadow)
Sets if draws text shadows under labels.
-
-
-
Method Detail
-
getOptionsBuilder
public LabelsOptionsBuilder getOptionsBuilder()
Returns theLabelsPlugin.ID
label builder.- Returns:
- the
LabelsPlugin.ID
label builder
-
setRender
public LabelBuilder setRender(Render render)
Sets what data must be showed.- Parameters:
render
- what data must be showed.- Returns:
- builder instance
-
setPrecision
public LabelBuilder setPrecision(int precision)
Sets the precision for percentage.- Parameters:
precision
- the precision for percentage- Returns:
- builder instance
-
setShowZero
public LabelBuilder setShowZero(boolean showZero)
Sets whether or not labels of value 0 are displayed.- Parameters:
showZero
- whether or not labels of value 0 are displayed.- Returns:
- builder instance
-
setFontSize
public LabelBuilder setFontSize(int size)
Sets the font size.- Parameters:
size
- the font size.- Returns:
- builder instance
-
setColor
public LabelBuilder setColor(IsColor color)
Sets the font color as color.- Parameters:
color
- the font color as color.- Returns:
- builder instance
-
setColor
public LabelBuilder setColor(String color)
Sets the font color as string.- Parameters:
color
- the font color as string.- Returns:
- builder instance
-
setFontStyle
public LabelBuilder setFontStyle(FontStyle fontStyle)
Sets the font style.- Parameters:
fontStyle
- the font style.- Returns:
- builder instance
-
setFontFamily
public LabelBuilder setFontFamily(String fontFamily)
Sets the font family- Parameters:
fontFamily
- the font family- Returns:
- builder instance
-
setTextShadow
public LabelBuilder setTextShadow(boolean textShadow)
Sets if draws text shadows under labels.- Parameters:
textShadow
-true
if draws text shadows under labels.- Returns:
- builder instance
-
setShadowBlur
public LabelBuilder setShadowBlur(int shadowBlur)
Sets the text shadow intensity.- Parameters:
shadowBlur
- the text shadow intensity.- Returns:
- builder instance
-
setShadowOffsetX
public LabelBuilder setShadowOffsetX(int shadowOffsetX)
Sets the text shadow X offset.- Parameters:
shadowOffsetX
- the text shadow X offset.- Returns:
- builder instance
-
setShadowOffsetY
public LabelBuilder setShadowOffsetY(int shadowOffsetY)
Sets the text shadow Y offset.- Parameters:
shadowOffsetY
- the text shadow Y offset.- Returns:
- builder instance
-
setShadowColor
public LabelBuilder setShadowColor(IsColor shadowColor)
Sets the text shadow color as color.- Parameters:
shadowColor
- the text shadow color as color.- Returns:
- builder instance
-
setShadowColor
public LabelBuilder setShadowColor(String shadowColor)
Sets the text shadow color as string.- Parameters:
shadowColor
- the text shadow color as string.- Returns:
- builder instance
-
setArc
public LabelBuilder setArc(boolean arc)
Sets if draws label in arc. For bar chart this is ignored.- Parameters:
arc
- if draws label in arc.- Returns:
- builder instance
-
setPosition
public LabelBuilder setPosition(Position position)
+ Sets the position to draw label. For bar chart this is ignored.- Parameters:
position
- the position to draw label.- Returns:
- builder instance
-
setOverlap
public LabelBuilder 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.- Returns:
- builder instance
-
setShowActualPercentages
public LabelBuilder 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.- Returns:
- builder instance
-
setOutsidePadding
public LabelBuilder setOutsidePadding(int outsidePadding)
Sets the padding when position isPosition.OUTSIDE
.- Parameters:
outsidePadding
- the padding when position isPosition.OUTSIDE
.- Returns:
- builder instance
-
setTextMargin
public LabelBuilder setTextMargin(int textMargin)
Sets the margin of text when position isPosition.OUTSIDE
orPosition.BORDER
.- Parameters:
textMargin
- the margin of text when position isPosition.OUTSIDE
orPosition.BORDER
.- Returns:
- builder instance
-
setImages
public LabelBuilder setImages(Img... images)
Sets the images whenRender
isRender.IMAGE
.- Parameters:
images
- images whenRender
isRender.IMAGE
.- Returns:
- builder instance
-
setRender
public LabelBuilder setRender(RenderCallback renderCallback)
Sets the render callback.- Parameters:
renderCallback
- the render callback to set- Returns:
- builder instance
-
setFont
public LabelBuilder setFont(FontCallback<LabelsContext> fontColorCallback)
Sets the font color callback.- Parameters:
fontColorCallback
- the font color callback.- Returns:
- builder instance
-
-