Class LabelBuilder


  • public final class LabelBuilder
    extends Object
    Comfortable object to create LabelsPlugin.ID plugin LABEL options by a builder.
    Author:
    Andrea "Stock" Stocchero
    • Method Detail

      • 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 is Position.OUTSIDE.
        Parameters:
        outsidePadding - the padding when position is Position.OUTSIDE.
        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