Package com.oorian.chartjs
Class CjTooltipConfig
java.lang.Object
com.oorian.chartjs.CjTooltipConfig
- All Implemented Interfaces:
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetMode()booleanChecks if this configuration has any values set.voidinitFromJson(com.oorian.json.JsonValue json) setBackgroundColor(String color) Sets the tooltip background color.setBodyColor(String color) Sets the body text color.setBodyFontSize(int size) Sets the body font size.setBorderColor(String color) Sets the border color.setBorderWidth(int width) Sets the border width.setCaretPadding(int padding) Sets the caret padding.setCaretSize(int size) Sets the size of the tooltip caret (arrow).setCornerRadius(int radius) Sets the corner radius.setEnabled(boolean enabled) Sets whether tooltips are enabled.setFooterColor(String color) Sets the footer text color.setFooterFontSize(int size) Sets the footer font size.setIntersect(boolean intersect) Sets whether to only trigger when directly over an element.setMode(InteractionMode mode) Sets the tooltip interaction mode.setPadding(int padding) Sets the tooltip padding.setPosition(String position) Sets the tooltip position mode.setTitleColor(String color) Sets the title text color.setTitleFontSize(int size) Sets the title font size.setTitleFontWeight(String weight) Sets the title font weight.com.oorian.json.JsonValueMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.oorian.json.Jsonable
initFromJson, initFromJson, toJsonString
-
Constructor Details
-
CjTooltipConfig
public CjTooltipConfig()Creates a new tooltip configuration.
-
-
Method Details
-
setEnabled
Sets whether tooltips are enabled.- Parameters:
enabled- True to enable- Returns:
- This instance for method chaining
-
setMode
Sets the tooltip interaction mode.- Parameters:
mode- The interaction mode- Returns:
- This instance for method chaining
-
setIntersect
Sets whether to only trigger when directly over an element.- Parameters:
intersect- True for intersect mode- Returns:
- This instance for method chaining
-
setPosition
Sets the tooltip position mode.- Parameters:
position- "average", "nearest"- Returns:
- This instance for method chaining
-
setBackgroundColor
Sets the tooltip background color.- Parameters:
color- The CSS color value- Returns:
- This instance for method chaining
-
setTitleColor
Sets the title text color.- Parameters:
color- The CSS color value- Returns:
- This instance for method chaining
-
setBodyColor
Sets the body text color.- Parameters:
color- The CSS color value- Returns:
- This instance for method chaining
-
setBorderColor
Sets the border color.- Parameters:
color- The CSS color value- Returns:
- This instance for method chaining
-
setBorderWidth
Sets the border width.- Parameters:
width- The width in pixels- Returns:
- This instance for method chaining
-
setCornerRadius
Sets the corner radius.- Parameters:
radius- The radius in pixels- Returns:
- This instance for method chaining
-
setCaretSize
Sets the size of the tooltip caret (arrow).- Parameters:
size- The size in pixels- Returns:
- This instance for method chaining
-
setCaretPadding
Sets the caret padding.- Parameters:
padding- The padding in pixels- Returns:
- This instance for method chaining
-
setPadding
Sets the tooltip padding.- Parameters:
padding- The padding in pixels- Returns:
- This instance for method chaining
-
setTitleFontSize
Sets the title font size.- Parameters:
size- The font size in pixels- Returns:
- This instance for method chaining
-
setTitleFontWeight
Sets the title font weight.- Parameters:
weight- The font weight- Returns:
- This instance for method chaining
-
setBodyFontSize
Sets the body font size.- Parameters:
size- The font size in pixels- Returns:
- This instance for method chaining
-
getEnabled
-
getMode
-
getIntersect
-
getPosition
-
getBackgroundColor
-
getTitleColor
-
getBodyColor
-
getBorderColor
-
getBorderWidth
-
getCornerRadius
-
getCaretSize
-
getCaretPadding
-
getPadding
-
getTitleFontSize
-
getTitleFontWeight
-
getBodyFontSize
-
initFromJson
public void initFromJson(com.oorian.json.JsonValue json) - Specified by:
initFromJsonin interfacecom.oorian.json.Jsonable
-
toJsonValue
public com.oorian.json.JsonValue toJsonValue()- Specified by:
toJsonValuein interfacecom.oorian.json.Jsonable
-
hasValues
public boolean hasValues()Checks if this configuration has any values set.- Returns:
- True if any property is set
-