Class CjTooltipConfig

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

public class CjTooltipConfig extends Object implements com.oorian.json.Jsonable
Configuration for Chart.js tooltip plugin.

Usage:


 CjTooltipConfig tooltip = new CjTooltipConfig()
     .setEnabled(true)
     .setMode(InteractionMode.INDEX)
     .setBackgroundColor("rgba(0,0,0,0.8)")
     .setTitleColor("#fff")
     .setBodyColor("#fff");
 
  • Constructor Details

    • CjTooltipConfig

      public CjTooltipConfig()
      Creates a new tooltip configuration.
  • Method Details

    • setEnabled

      public CjTooltipConfig setEnabled(boolean enabled)
      Sets whether tooltips are enabled.
      Parameters:
      enabled - True to enable
      Returns:
      This instance for method chaining
    • setMode

      public CjTooltipConfig setMode(InteractionMode mode)
      Sets the tooltip interaction mode.
      Parameters:
      mode - The interaction mode
      Returns:
      This instance for method chaining
    • setIntersect

      public CjTooltipConfig setIntersect(boolean intersect)
      Sets whether to only trigger when directly over an element.
      Parameters:
      intersect - True for intersect mode
      Returns:
      This instance for method chaining
    • setPosition

      public CjTooltipConfig setPosition(String position)
      Sets the tooltip position mode.
      Parameters:
      position - "average", "nearest"
      Returns:
      This instance for method chaining
    • setBackgroundColor

      public CjTooltipConfig setBackgroundColor(String color)
      Sets the tooltip background color.
      Parameters:
      color - The CSS color value
      Returns:
      This instance for method chaining
    • setTitleColor

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

      public CjTooltipConfig setBodyColor(String color)
      Sets the body text color.
      Parameters:
      color - The CSS color value
      Returns:
      This instance for method chaining
    • setFooterColor

      public CjTooltipConfig setFooterColor(String color)
      Sets the footer text color.
      Parameters:
      color - The CSS color value
      Returns:
      This instance for method chaining
    • setBorderColor

      public CjTooltipConfig setBorderColor(String color)
      Sets the border color.
      Parameters:
      color - The CSS color value
      Returns:
      This instance for method chaining
    • setBorderWidth

      public CjTooltipConfig setBorderWidth(int width)
      Sets the border width.
      Parameters:
      width - The width in pixels
      Returns:
      This instance for method chaining
    • setCornerRadius

      public CjTooltipConfig setCornerRadius(int radius)
      Sets the corner radius.
      Parameters:
      radius - The radius in pixels
      Returns:
      This instance for method chaining
    • setCaretSize

      public CjTooltipConfig setCaretSize(int size)
      Sets the size of the tooltip caret (arrow).
      Parameters:
      size - The size in pixels
      Returns:
      This instance for method chaining
    • setCaretPadding

      public CjTooltipConfig setCaretPadding(int padding)
      Sets the caret padding.
      Parameters:
      padding - The padding in pixels
      Returns:
      This instance for method chaining
    • setPadding

      public CjTooltipConfig setPadding(int padding)
      Sets the tooltip padding.
      Parameters:
      padding - The padding in pixels
      Returns:
      This instance for method chaining
    • setTitleFontSize

      public CjTooltipConfig setTitleFontSize(int size)
      Sets the title font size.
      Parameters:
      size - The font size in pixels
      Returns:
      This instance for method chaining
    • setTitleFontWeight

      public CjTooltipConfig setTitleFontWeight(String weight)
      Sets the title font weight.
      Parameters:
      weight - The font weight
      Returns:
      This instance for method chaining
    • setBodyFontSize

      public CjTooltipConfig setBodyFontSize(int size)
      Sets the body font size.
      Parameters:
      size - The font size in pixels
      Returns:
      This instance for method chaining
    • setFooterFontSize

      public CjTooltipConfig setFooterFontSize(int size)
      Sets the footer font size.
      Parameters:
      size - The font size in pixels
      Returns:
      This instance for method chaining
    • getEnabled

      public Boolean getEnabled()
    • getMode

      public InteractionMode getMode()
    • getIntersect

      public Boolean getIntersect()
    • getPosition

      public String getPosition()
    • getBackgroundColor

      public String getBackgroundColor()
    • getTitleColor

      public String getTitleColor()
    • getBodyColor

      public String getBodyColor()
    • getFooterColor

      public String getFooterColor()
    • getBorderColor

      public String getBorderColor()
    • getBorderWidth

      public Integer getBorderWidth()
    • getCornerRadius

      public Integer getCornerRadius()
    • getCaretSize

      public Integer getCaretSize()
    • getCaretPadding

      public Integer getCaretPadding()
    • getPadding

      public Integer getPadding()
    • getTitleFontSize

      public Integer getTitleFontSize()
    • getTitleFontWeight

      public String getTitleFontWeight()
    • getBodyFontSize

      public Integer getBodyFontSize()
    • getFooterFontSize

      public Integer getFooterFontSize()
    • 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