Below is the Java code needed to create the ApexCharts Basic Column demo chart from their website.
This example chart is also viewable in the HyJavaApex demo web application available on the demo page.
public class ApexChartsBasicColumn {
public Apexchart configure() {
Apexchart apexchart = new Apexchart();
ChartOptions chartOptions = apexchart.getChartOptions();
chartOptions.getChart().setType(ChartType.BAR);
chartOptions.getPlotOptions().getBar()
.setHorizontal(false).setBorderRadius(5).setBorderRadiusApplication(BorderRadiusApplication.END).setColumnWidth("55%");
chartOptions.getDataLabels().setEnabled(false);
chartOptions.getStroke().setShow(true).setWidth(2).getColors().add(new Color("transparent"));
chartOptions.getXaxis()
.setCategoriesAsArrayString(Arrays.asList("Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct"));
chartOptions.getYaxisSingle().getTitle().setText("$ (thousands)");
chartOptions.getFill().setOpacity(1);
chartOptions.getTooltip().getY().setFormatter(new Function("return \"$ \" + val + \" thousands\"", "val"));
Series series = new Series();
series.setName("Net Profit");
series.setDataAsArrayNumber(Arrays.asList(44, 55, 57, 56, 61, 58, 63, 60, 66));
chartOptions.getSeries().add(series);
series = new Series();
series.setName("Revenue");
series.setDataAsArrayNumber(Arrays.asList(76, 85, 101, 98, 87, 105, 91, 114, 94));
chartOptions.getSeries().add(series);
series = new Series();
series.setName("Free Cash Flow");
series.setDataAsArrayNumber(Arrays.asList(35, 41, 36, 26, 45, 48, 52, 53, 41));
chartOptions.getSeries().add(series);
return apexchart;
}
}