Package com.oorian.chartjs
Class CjPlugins
java.lang.Object
com.oorian.chartjs.CjPlugins
- All Implemented Interfaces:
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets the legend configuration.Gets the subtitle configuration.getTitle()Gets the title configuration.Gets the tooltip configuration.voidinitFromJson(com.oorian.json.JsonValue json) setLegend(CjLegendConfig config) Sets the legend configuration.setLegendAlign(String align) Sets the legend alignment.setLegendDisplay(boolean display) Sets whether to display the legend.setLegendLabelsColor(String color) Sets the legend labels color.setLegendLabelsFont(int size) Sets the legend labels font size.setLegendPosition(LegendPosition position) Sets the legend position.setLegendReverse(boolean reverse) Sets whether to reverse the legend items.setSubtitle(CjTitleConfig config) Sets the subtitle configuration.setSubtitleColor(String color) Sets the subtitle color.setSubtitleDisplay(boolean display) Sets whether to display the subtitle.setSubtitleText(String text) Sets the subtitle text.setTitle(CjTitleConfig config) Sets the title configuration.setTitleColor(String color) Sets the title color.setTitleDisplay(boolean display) Sets whether to display the title.setTitleFont(int size, String weight) Sets the title font.setTitlePosition(LegendPosition position) Sets the title position.setTitleText(String text) Sets the title text.setTooltip(CjTooltipConfig config) Sets the tooltip configuration.setTooltipBackgroundColor(String color) Sets the tooltip background color.setTooltipBodyColor(String color) Sets the tooltip body color.setTooltipBorderColor(String color) Sets the tooltip border color.setTooltipBorderWidth(int width) Sets the tooltip border width.setTooltipEnabled(boolean enabled) Sets whether tooltips are enabled.Sets the tooltip interaction mode.setTooltipTitleColor(String color) Sets the tooltip title color.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
-
CjPlugins
public CjPlugins()Creates a new plugins configuration.
-
-
Method Details
-
setTitle
Sets the title configuration.- Parameters:
config- The title configuration- Returns:
- This instance for method chaining
-
setSubtitle
Sets the subtitle configuration.- Parameters:
config- The subtitle configuration- Returns:
- This instance for method chaining
-
setLegend
Sets the legend configuration.- Parameters:
config- The legend configuration- Returns:
- This instance for method chaining
-
setTooltip
Sets the tooltip configuration.- Parameters:
config- The tooltip configuration- Returns:
- This instance for method chaining
-
setTitleDisplay
Sets whether to display the title.- Parameters:
display- True to display- Returns:
- This instance for method chaining
-
setTitleText
Sets the title text.- Parameters:
text- The title text- Returns:
- This instance for method chaining
-
setTitlePosition
Sets the title position.- Parameters:
position- The position- Returns:
- This instance for method chaining
-
setTitleColor
Sets the title color.- Parameters:
color- The CSS color value- Returns:
- This instance for method chaining
-
setTitleFont
Sets the title font.- Parameters:
size- The font size in pixelsweight- The font weight (e.g., "bold", "normal")- Returns:
- This instance for method chaining
-
setSubtitleDisplay
Sets whether to display the subtitle.- Parameters:
display- True to display- Returns:
- This instance for method chaining
-
setSubtitleText
Sets the subtitle text.- Parameters:
text- The subtitle text- Returns:
- This instance for method chaining
-
setSubtitleColor
Sets the subtitle color.- Parameters:
color- The CSS color value- Returns:
- This instance for method chaining
-
setLegendDisplay
Sets whether to display the legend.- Parameters:
display- True to display- Returns:
- This instance for method chaining
-
setLegendPosition
Sets the legend position.- Parameters:
position- The position- Returns:
- This instance for method chaining
-
setLegendAlign
Sets the legend alignment.- Parameters:
align- "start", "center", or "end"- Returns:
- This instance for method chaining
-
setLegendReverse
Sets whether to reverse the legend items.- Parameters:
reverse- True to reverse- Returns:
- This instance for method chaining
-
setLegendLabelsColor
Sets the legend labels color.- Parameters:
color- The CSS color value- Returns:
- This instance for method chaining
-
setLegendLabelsFont
Sets the legend labels font size.- Parameters:
size- The font size in pixels- Returns:
- This instance for method chaining
-
setTooltipEnabled
Sets whether tooltips are enabled.- Parameters:
enabled- True to enable- Returns:
- This instance for method chaining
-
setTooltipMode
Sets the tooltip interaction mode.- Parameters:
mode- The interaction mode- Returns:
- This instance for method chaining
-
setTooltipBackgroundColor
Sets the tooltip background color.- Parameters:
color- The CSS color value- Returns:
- This instance for method chaining
-
setTooltipTitleColor
Sets the tooltip title color.- Parameters:
color- The CSS color value- Returns:
- This instance for method chaining
-
setTooltipBodyColor
Sets the tooltip body color.- Parameters:
color- The CSS color value- Returns:
- This instance for method chaining
-
setTooltipBorderColor
Sets the tooltip border color.- Parameters:
color- The CSS color value- Returns:
- This instance for method chaining
-
setTooltipBorderWidth
Sets the tooltip border width.- Parameters:
width- The border width in pixels- Returns:
- This instance for method chaining
-
getTitle
Gets the title configuration.- Returns:
- The title config, or null if not set
-
getSubtitle
Gets the subtitle configuration.- Returns:
- The subtitle config, or null if not set
-
getLegend
Gets the legend configuration.- Returns:
- The legend config, or null if not set
-
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:
initFromJsonin interfacecom.oorian.json.Jsonable
-
toJsonValue
public com.oorian.json.JsonValue toJsonValue()- Specified by:
toJsonValuein interfacecom.oorian.json.Jsonable
-