Skip to content

Commit e0ccacd

Browse files
committed
Update README.md
1 parent e3a25fc commit e0ccacd

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

README.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,27 @@ This repo extends the abandoned [Chart.java](https://github.com/mdewilde/chart)
1010

1111
> [!NOTE]
1212
> We try our best to implement the ChartJS v4 API however there are a lot of configuration options.<br/>
13-
> Therefore some parts migth still be missing or use the outdated v2 API from the original repo.<br/>
13+
> Therefore some parts might still be missing or use the outdated v2 API from the original repo.<br/>
1414
> If you think you found a missing or incorrect API please open an issue and/or provide a pull request.
1515
16+
## Usage
17+
18+
Configuring a chart is straight forward and follows a builder like pattern:
19+
```java
20+
new BarChart(new BarData()
21+
.addLabels("A", "B")
22+
.addDataset(new BarDataset()
23+
.setLabel("X")
24+
.addData(1)
25+
.addData(2)))
26+
.toJson(); // Do something with the json like sending it to the client
27+
```
28+
29+
If you need more examples:
30+
* Have a look at the [demo](./chartjs-java-model-demo/)
31+
* or checkout how we do it in our [tests](./chartjs-java-model/src/test/java/software/xdev/chartjs/model/)
32+
* there are also [screenshots](./chartjs-java-model/src/test/resources/screenshotReferences/) available
33+
1634
## Installation
1735
[Installation guide for the latest release](https://github.com/xdev-software/chartjs-java-model/releases/latest#Installation)
1836

0 commit comments

Comments
 (0)