Column Chart with HyJavaApex

the java api for apexcharts

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;
	}
	
}

The Java API’s fully support all chart types and chart options in Highcharts v5.x, v6.x, v7.x, v8.x, v9.x;  Highcharts Stock v8.x, v9.x and ApexCharts v3.x.


Current versions supported are:

HyJavaCharts

HyJavaStock

HyJavaApex

Explore a demo Java web application using the HyJavaCharts v12.x library


Explore a demo Java web application using the HyJavaStock v12.x library


Explore a demo Java web application using the HyJavaApex v4.x library


Explore a demo Java web application using the HyJavaImages v2.x library