Class CjPlugins

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

public class CjPlugins extends Object implements com.oorian.json.Jsonable
Plugin configuration for Chart.js charts.

Configures title, subtitle, legend, and tooltip plugins using typed configuration objects.

Usage with config objects:


 CjPlugins plugins = new CjPlugins()
     .setTitle(new CjTitleConfig("Monthly Sales Report")
         .setColor("#333")
         .setFontSize(18))
     .setLegend(new CjLegendConfig()
         .setPosition(LegendPosition.BOTTOM))
     .setTooltip(new CjTooltipConfig()
         .setEnabled(true)
         .setMode(InteractionMode.INDEX));
 

Usage with convenience methods:


 CjPlugins plugins = new CjPlugins()
     .setTitleText("Monthly Sales Report")
     .setLegendPosition(LegendPosition.BOTTOM)
     .setTooltipEnabled(true);
 
  • Constructor Details

    • CjPlugins

      public CjPlugins()
      Creates a new plugins configuration.
  • Method Details

    • setTitle

      public CjPlugins setTitle(CjTitleConfig config)
      Sets the title configuration.
      Parameters:
      config - The title configuration
      Returns:
      This instance for method chaining
    • setSubtitle

      public CjPlugins setSubtitle(CjTitleConfig config)
      Sets the subtitle configuration.
      Parameters:
      config - The subtitle configuration
      Returns:
      This instance for method chaining
    • setLegend

      public CjPlugins setLegend(CjLegendConfig config)
      Sets the legend configuration.
      Parameters:
      config - The legend configuration
      Returns:
      This instance for method chaining
    • setTooltip

      public CjPlugins setTooltip(CjTooltipConfig config)
      Sets the tooltip configuration.
      Parameters:
      config - The tooltip configuration
      Returns:
      This instance for method chaining
    • setTitleDisplay

      public CjPlugins setTitleDisplay(boolean display)
      Sets whether to display the title.
      Parameters:
      display - True to display
      Returns:
      This instance for method chaining
    • setTitleText

      public CjPlugins setTitleText(String text)
      Sets the title text.
      Parameters:
      text - The title text
      Returns:
      This instance for method chaining
    • setTitlePosition

      public CjPlugins setTitlePosition(LegendPosition position)
      Sets the title position.
      Parameters:
      position - The position
      Returns:
      This instance for method chaining
    • setTitleColor

      public CjPlugins setTitleColor(String color)
      Sets the title color.
      Parameters:
      color - The CSS color value
      Returns:
      This instance for method chaining
    • setTitleFont

      public CjPlugins setTitleFont(int size, String weight)
      Sets the title font.
      Parameters:
      size - The font size in pixels
      weight - The font weight (e.g., "bold", "normal")
      Returns:
      This instance for method chaining
    • setSubtitleDisplay

      public CjPlugins setSubtitleDisplay(boolean display)
      Sets whether to display the subtitle.
      Parameters:
      display - True to display
      Returns:
      This instance for method chaining
    • setSubtitleText

      public CjPlugins setSubtitleText(String text)
      Sets the subtitle text.
      Parameters:
      text - The subtitle text
      Returns:
      This instance for method chaining
    • setSubtitleColor

      public CjPlugins setSubtitleColor(String color)
      Sets the subtitle color.
      Parameters:
      color - The CSS color value
      Returns:
      This instance for method chaining
    • setLegendDisplay

      public CjPlugins setLegendDisplay(boolean display)
      Sets whether to display the legend.
      Parameters:
      display - True to display
      Returns:
      This instance for method chaining
    • setLegendPosition

      public CjPlugins setLegendPosition(LegendPosition position)
      Sets the legend position.
      Parameters:
      position - The position
      Returns:
      This instance for method chaining
    • setLegendAlign

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

      public CjPlugins setLegendReverse(boolean reverse)
      Sets whether to reverse the legend items.
      Parameters:
      reverse - True to reverse
      Returns:
      This instance for method chaining
    • setLegendLabelsColor

      public CjPlugins setLegendLabelsColor(String color)
      Sets the legend labels color.
      Parameters:
      color - The CSS color value
      Returns:
      This instance for method chaining
    • setLegendLabelsFont

      public CjPlugins setLegendLabelsFont(int size)
      Sets the legend labels font size.
      Parameters:
      size - The font size in pixels
      Returns:
      This instance for method chaining
    • setTooltipEnabled

      public CjPlugins setTooltipEnabled(boolean enabled)
      Sets whether tooltips are enabled.
      Parameters:
      enabled - True to enable
      Returns:
      This instance for method chaining
    • setTooltipMode

      public CjPlugins setTooltipMode(InteractionMode mode)
      Sets the tooltip interaction mode.
      Parameters:
      mode - The interaction mode
      Returns:
      This instance for method chaining
    • setTooltipBackgroundColor

      public CjPlugins setTooltipBackgroundColor(String color)
      Sets the tooltip background color.
      Parameters:
      color - The CSS color value
      Returns:
      This instance for method chaining
    • setTooltipTitleColor

      public CjPlugins setTooltipTitleColor(String color)
      Sets the tooltip title color.
      Parameters:
      color - The CSS color value
      Returns:
      This instance for method chaining
    • setTooltipBodyColor

      public CjPlugins setTooltipBodyColor(String color)
      Sets the tooltip body color.
      Parameters:
      color - The CSS color value
      Returns:
      This instance for method chaining
    • setTooltipBorderColor

      public CjPlugins setTooltipBorderColor(String color)
      Sets the tooltip border color.
      Parameters:
      color - The CSS color value
      Returns:
      This instance for method chaining
    • setTooltipBorderWidth

      public CjPlugins setTooltipBorderWidth(int width)
      Sets the tooltip border width.
      Parameters:
      width - The border width in pixels
      Returns:
      This instance for method chaining
    • getTitle

      public CjTitleConfig getTitle()
      Gets the title configuration.
      Returns:
      The title config, or null if not set
    • getSubtitle

      public CjTitleConfig getSubtitle()
      Gets the subtitle configuration.
      Returns:
      The subtitle config, or null if not set
    • getLegend

      public CjLegendConfig getLegend()
      Gets the legend configuration.
      Returns:
      The legend config, or null if not set
    • getTooltip

      public CjTooltipConfig getTooltip()
      Gets the tooltip configuration.
      Returns:
      The tooltip config, or null if not set
    • 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