Package com.oorian.chartjs
Class CjLegendConfig
java.lang.Object
com.oorian.chartjs.CjLegendConfig
- All Implemented Interfaces:
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetAlign()getRtl()booleanChecks if this configuration has any values set.voidinitFromJson(com.oorian.json.JsonValue json) Sets the legend alignment.setDisplay(boolean display) Sets whether to display the legend.setLabelsBoxHeight(int height) Sets the height of the color box.setLabelsBoxWidth(int width) Sets the width of the color box.setLabelsColor(String color) Sets the label text color.setLabelsFontFamily(String family) Sets the label font family.setLabelsFontSize(int size) Sets the label font size.setLabelsFontWeight(String weight) Sets the label font weight.setLabelsPadding(int padding) Sets the padding between legend items.setLabelsUsePointStyle(boolean usePointStyle) Sets whether to use point style instead of boxes.setPosition(LegendPosition position) Sets the legend position.setReverse(boolean reverse) Sets whether to reverse the legend items.setRtl(boolean rtl) Sets whether to render the legend in right-to-left mode.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
-
CjLegendConfig
public CjLegendConfig()Creates a new legend configuration.
-
-
Method Details
-
setDisplay
Sets whether to display the legend.- Parameters:
display- True to display- Returns:
- This instance for method chaining
-
setPosition
Sets the legend position.- Parameters:
position- The position- Returns:
- This instance for method chaining
-
setAlign
Sets the legend alignment.- Parameters:
align- "start", "center", or "end"- Returns:
- This instance for method chaining
-
setReverse
Sets whether to reverse the legend items.- Parameters:
reverse- True to reverse- Returns:
- This instance for method chaining
-
setRtl
Sets whether to render the legend in right-to-left mode.- Parameters:
rtl- True for RTL- Returns:
- This instance for method chaining
-
setLabelsColor
Sets the label text color.- Parameters:
color- The CSS color value- Returns:
- This instance for method chaining
-
setLabelsFontSize
Sets the label font size.- Parameters:
size- The font size in pixels- Returns:
- This instance for method chaining
-
setLabelsFontWeight
Sets the label font weight.- Parameters:
weight- The font weight- Returns:
- This instance for method chaining
-
setLabelsFontFamily
Sets the label font family.- Parameters:
family- The font family- Returns:
- This instance for method chaining
-
setLabelsBoxWidth
Sets the width of the color box.- Parameters:
width- The width in pixels- Returns:
- This instance for method chaining
-
setLabelsBoxHeight
Sets the height of the color box.- Parameters:
height- The height in pixels- Returns:
- This instance for method chaining
-
setLabelsPadding
Sets the padding between legend items.- Parameters:
padding- The padding in pixels- Returns:
- This instance for method chaining
-
setLabelsUsePointStyle
Sets whether to use point style instead of boxes.- Parameters:
usePointStyle- True to use point style- Returns:
- This instance for method chaining
-
getDisplay
-
getPosition
-
getAlign
-
getReverse
-
getRtl
-
getLabelsColor
-
getLabelsFontSize
-
getLabelsFontWeight
-
getLabelsFontFamily
-
getLabelsBoxWidth
-
getLabelsBoxHeight
-
getLabelsPadding
-
getLabelsUsePointStyle
-
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
-