Class CjLegendConfig

java.lang.Object
com.oorian.chartjs.CjLegendConfig
All Implemented Interfaces:
com.oorian.json.Jsonable

public class CjLegendConfig extends Object implements com.oorian.json.Jsonable
Configuration for Chart.js legend plugin.

Usage:


 CjLegendConfig legend = new CjLegendConfig()
     .setPosition(LegendPosition.BOTTOM)
     .setAlign("center")
     .setLabelsColor("#666")
     .setLabelsFontSize(12);
 
  • Constructor Details

    • CjLegendConfig

      public CjLegendConfig()
      Creates a new legend configuration.
  • Method Details

    • setDisplay

      public CjLegendConfig setDisplay(boolean display)
      Sets whether to display the legend.
      Parameters:
      display - True to display
      Returns:
      This instance for method chaining
    • setPosition

      public CjLegendConfig setPosition(LegendPosition position)
      Sets the legend position.
      Parameters:
      position - The position
      Returns:
      This instance for method chaining
    • setAlign

      public CjLegendConfig setAlign(String align)
      Sets the legend alignment.
      Parameters:
      align - "start", "center", or "end"
      Returns:
      This instance for method chaining
    • setReverse

      public CjLegendConfig setReverse(boolean reverse)
      Sets whether to reverse the legend items.
      Parameters:
      reverse - True to reverse
      Returns:
      This instance for method chaining
    • setRtl

      public CjLegendConfig setRtl(boolean rtl)
      Sets whether to render the legend in right-to-left mode.
      Parameters:
      rtl - True for RTL
      Returns:
      This instance for method chaining
    • setLabelsColor

      public CjLegendConfig setLabelsColor(String color)
      Sets the label text color.
      Parameters:
      color - The CSS color value
      Returns:
      This instance for method chaining
    • setLabelsFontSize

      public CjLegendConfig setLabelsFontSize(int size)
      Sets the label font size.
      Parameters:
      size - The font size in pixels
      Returns:
      This instance for method chaining
    • setLabelsFontWeight

      public CjLegendConfig setLabelsFontWeight(String weight)
      Sets the label font weight.
      Parameters:
      weight - The font weight
      Returns:
      This instance for method chaining
    • setLabelsFontFamily

      public CjLegendConfig setLabelsFontFamily(String family)
      Sets the label font family.
      Parameters:
      family - The font family
      Returns:
      This instance for method chaining
    • setLabelsBoxWidth

      public CjLegendConfig setLabelsBoxWidth(int width)
      Sets the width of the color box.
      Parameters:
      width - The width in pixels
      Returns:
      This instance for method chaining
    • setLabelsBoxHeight

      public CjLegendConfig setLabelsBoxHeight(int height)
      Sets the height of the color box.
      Parameters:
      height - The height in pixels
      Returns:
      This instance for method chaining
    • setLabelsPadding

      public CjLegendConfig setLabelsPadding(int padding)
      Sets the padding between legend items.
      Parameters:
      padding - The padding in pixels
      Returns:
      This instance for method chaining
    • setLabelsUsePointStyle

      public CjLegendConfig setLabelsUsePointStyle(boolean usePointStyle)
      Sets whether to use point style instead of boxes.
      Parameters:
      usePointStyle - True to use point style
      Returns:
      This instance for method chaining
    • getDisplay

      public Boolean getDisplay()
    • getPosition

      public LegendPosition getPosition()
    • getAlign

      public String getAlign()
    • getReverse

      public Boolean getReverse()
    • getRtl

      public Boolean getRtl()
    • getLabelsColor

      public String getLabelsColor()
    • getLabelsFontSize

      public Integer getLabelsFontSize()
    • getLabelsFontWeight

      public String getLabelsFontWeight()
    • getLabelsFontFamily

      public String getLabelsFontFamily()
    • getLabelsBoxWidth

      public Integer getLabelsBoxWidth()
    • getLabelsBoxHeight

      public Integer getLabelsBoxHeight()
    • getLabelsPadding

      public Integer getLabelsPadding()
    • getLabelsUsePointStyle

      public Boolean getLabelsUsePointStyle()
    • initFromJson

      public void initFromJson(com.oorian.json.JsonValue json)
      Specified by:
      initFromJson in interface com.oorian.json.Jsonable
    • toJsonValue

      public com.oorian.json.JsonValue toJsonValue()
      Specified by:
      toJsonValue in interface com.oorian.json.Jsonable
    • hasValues

      public boolean hasValues()
      Checks if this configuration has any values set.
      Returns:
      True if any property is set