Package com.oorian.chartjs
Class CjChartData
java.lang.Object
com.oorian.chartjs.CjChartData
- All Implemented Interfaces:
com.oorian.json.Jsonable
Data configuration for Chart.js charts.
Contains labels and datasets for the chart.
Usage:
CjChartData data = new CjChartData()
.setLabels("Jan", "Feb", "Mar")
.addDataset(new CjDataset("Sales").setData(10, 20, 30));
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddDataset(CjDataset dataset) Adds a dataset to the chart.Gets the datasets.Gets the chart labels.voidinitFromJson(com.oorian.json.JsonValue json) setDatasets(List<CjDataset> datasetList) Sets all datasets at once.Sets the chart labels (x-axis categories).Sets the chart labels from a list.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
-
CjChartData
public CjChartData()Creates a new chart data configuration.
-
-
Method Details
-
setLabels
Sets the chart labels (x-axis categories).- Parameters:
labelValues- The label values- Returns:
- This instance for method chaining
-
setLabels
Sets the chart labels from a list.- Parameters:
labelValues- The label values- Returns:
- This instance for method chaining
-
getLabels
Gets the chart labels.- Returns:
- The labels list
-
addDataset
Adds a dataset to the chart.- Parameters:
dataset- The dataset to add- Returns:
- This instance for method chaining
-
setDatasets
Sets all datasets at once.- Parameters:
datasetList- The list of datasets- Returns:
- This instance for method chaining
-
getDatasets
Gets the datasets.- Returns:
- The datasets list
-
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
-