Class LabelBuilder
- java.lang.Object
-
- org.pepstock.charba.client.labels.LabelBuilder
-
public final class LabelBuilder extends Object
Comfortable object to createLabelsPlugin.IDplugin LABEL options by a builder.- Author:
- Andrea "Stock" Stocchero
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LabelsOptionsBuildergetOptionsBuilder()Returns theLabelsPlugin.IDlabel builder.LabelBuildersetArc(boolean arc)Sets if draws label in arc.LabelBuildersetColor(String color)Sets the font color as string.LabelBuildersetColor(IsColor color)Sets the font color as color.LabelBuildersetFont(FontCallback<LabelsContext> fontColorCallback)Sets the font color callback.LabelBuildersetFontFamily(String fontFamily)Sets the font familyLabelBuildersetFontSize(int size)Sets the font size.LabelBuildersetFontStyle(FontStyle fontStyle)Sets the font style.LabelBuildersetImages(Img... images)Sets the images whenRenderisRender.IMAGE.LabelBuildersetOutsidePadding(int outsidePadding)Sets the padding when position isPosition.OUTSIDE.LabelBuildersetOverlap(boolean overlap)Sets if draws label even it's overlap.LabelBuildersetPosition(Position position)+ Sets the position to draw label.LabelBuildersetPrecision(int precision)Sets the precision for percentage.LabelBuildersetRender(RenderCallback renderCallback)Sets the render callback.LabelBuildersetRender(Render render)Sets what data must be showed.LabelBuildersetShadowBlur(int shadowBlur)Sets the text shadow intensity.LabelBuildersetShadowColor(String shadowColor)Sets the text shadow color as string.LabelBuildersetShadowColor(IsColor shadowColor)Sets the text shadow color as color.LabelBuildersetShadowOffsetX(int shadowOffsetX)Sets the text shadow X offset.LabelBuildersetShadowOffsetY(int shadowOffsetY)Sets the text shadow Y offset.LabelBuildersetShowActualPercentages(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.LabelBuildersetShowZero(boolean showZero)Sets whether or not labels of value 0 are displayed.LabelBuildersetTextMargin(int textMargin)Sets the margin of text when position isPosition.OUTSIDEorPosition.BORDER.LabelBuildersetTextShadow(boolean textShadow)Sets if draws text shadows under labels.
-
-
-
Method Detail
-
getOptionsBuilder
public LabelsOptionsBuilder getOptionsBuilder()
Returns theLabelsPlugin.IDlabel builder.- Returns:
- the
LabelsPlugin.IDlabel 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-trueif 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.OUTSIDEorPosition.BORDER.- Parameters:
textMargin- the margin of text when position isPosition.OUTSIDEorPosition.BORDER.- Returns:
- builder instance
-
setImages
public LabelBuilder setImages(Img... images)
Sets the images whenRenderisRender.IMAGE.- Parameters:
images- images whenRenderisRender.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
-
-