ChartJs add-on for Vaadin 14+
ChartJS for Vaadin 14
This is a Vaadin 14 compatible fork of the old ChartJS add-on which provided a fluid Java API with which users could generate ChartJS charts. More info at https://github.com/rudiejd/vaadin-chartjs.
This is currently an alpha version. Not all features from the Vaadin 8 version have been re-implemented, and some have been intentionally deprecated. Check out the README.md on this add-on's Github page for more information.
Sample code
BarChartConfig config = new BarChartConfig(); config .data() .labels("January", "February", "March", "April", "May", "June", "July") .addDataset(new BarDataset().type().label("Dataset 1").backgroundColor("rgba(151,187,205,0.5)").borderColor("white").borderWidth(2)) .addDataset(new LineDataset().type().label("Dataset 2").backgroundColor("rgba(151,187,205,0.5)").borderColor("white").borderWidth(2)) .addDataset(new BarDataset().type().label("Dataset 3").backgroundColor("rgba(220,220,220,0.5)")) .and(); config. options() .responsive(true) .title() .display(true) .position(Position.LEFT) .text("Chart.js Combo Bar Line Chart") .and() .done(); List<String> labels = config.data().getLabels(); for (Dataset<?, ?> ds : config.data().getDatasets()) { List<Double> data = new ArrayList<>(); for (int i = 0; i < labels.size(); i++) { data.add((double) (Math.random() > 0.5 ? 1.0 : -1.0) * Math.round(Math.random() * 100)); } if (ds instanceof BarDataset) { BarDataset bds = (BarDataset) ds; bds.dataAsList(data); } if (ds instanceof LineDataset) { LineDataset lds = (LineDataset) ds; lds.dataAsList(data); } } ChartJs chart = new ChartJs(config); chart.setJsLoggingEnabled(true); return chart;
Links
Compatibility
Was this helpful? Need more help?
Leave a comment or a question below. You can also join
the chat on Discord or
ask questions on StackOverflow.
Version
- Released
- 2023-12-15
- Maturity
- EXPERIMENTAL
- License
- MIT License
Compatibility
- Framework
- Vaadin 10+
- Browser
- N/A
ChartJs add-on for Vaadin 14+ - Vaadin Add-on Directory
ChartJS for Vaadin 14ChartJs add-on for Vaadin 14+ version 0.1.25
ChartJs add-on for Vaadin 14+ version 0.1.26
ChartJs add-on for Vaadin 14+ version 0.1.27
ChartJs add-on for Vaadin 14+ version 0.1.28
ChartJs add-on for Vaadin 14+ version 0.1.29
ChartJs add-on for Vaadin 14+ version 0.1.31
no more javascript connector
ChartJs add-on for Vaadin 14+ version 0.1.32
ChartJs add-on for Vaadin 14+ version 0.1.33
ChartJs add-on for Vaadin 14+ version 0.1.34
tooltips now work
ChartJs add-on for Vaadin 14+ version 0.1.35
ChartJs add-on for Vaadin 14+ version 0.1.36
ChartJs add-on for Vaadin 14+ version 0.1.37