Skip to content

Commit c3301b4

Browse files
committed
Add showcase with model to usage section
1 parent f9a5b56 commit c3301b4

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,20 @@ For more and detailed usage examples please have a look at [the demo](./vaadin-c
1818

1919
```java
2020
// Assumes that this code is in some kind of Vaadin component or view
21-
2221
ChartContainer chart = new ChartContainer();
2322
this.add(chart);
2423

2524
chart.showChart(
2625
"{\"data\":{\"labels\":[\"A\",\"B\"],\"datasets\":[{\"data\":[1,2],\"label\":\"X\"}]},\"type\":\"bar\"}");
26+
27+
// Or utilizing chartjs-java-model
28+
chart.showChart(new BarChart(new BarData()
29+
.addLabels("A", "B")
30+
.addDataset(new BarDataset()
31+
.setLabel("X")
32+
.addData(1)
33+
.addData(2)))
34+
.toJson());
2735
```
2836

2937
### Recommended

0 commit comments

Comments
 (0)