Chart.java enables integration with the excellent Chart.js library from within a Java application.
In Java:
BarDatasetdataset = newBarDataset() .setLabel("sample chart") .setData(65, 59, 80, 81, 56, 55, 40) .addBackgroundColors(Color.RED, Color.GREEN, Color.BLUE, Color.YELLOW, Color.ORANGE, Color.GRAY, Color.BLACK) .setBorderWidth(2); BarDatadata = newBarData() .addLabels("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday") .addDataset(dataset); returnnewBarChart(data).toJson();In JavaScript:
varctx=document.getElementById('canvasId');newChart(ctx,json);| Chart.js | Chart.java |
|---|---|
| 1.x | 0.9.x |
| 2.x | 2.x |
See example charts by running the included unit tests:
mvn clean compile testBrowse this project's javadoc at javadoc.io.
Include this project directly from Maven Central
<dependency> <groupId>be.ceau</groupId> <artifactId>chart</artifactId> <version>2.6.0</version> </dependency>Downloads for this project at Maven Central.
The docs for Chart.js are a helpful source of info on what's possible and how to achieve it.
Verify signature files with my GnuPG public key.
Chart.java is licensed under the Apache 2.0 license.