Quick Start Guide

the highcharts java api

REQUIREMENTS

To use this library your Java web framework must be able to add the generated chart options to your Javascript in your page before sending to the browser.

A valid Highcharts license is also required. Please refer to Highcharts license page for further details.

HOW TO USE THE LIBRARY

Java
Include the HyJavaCharts jar in your project.

Create your chart and get the global and chart options json values.

Highchart hc = new YourBarChart().generate();
String globalOptionsJson = hc.globalOptionsToJson();
String chartOptionsJson = hc.chartOptionsToJson();

The YourBarChart class will look something like this

public class YourBarChart {

 public Highchart generate() {
  Highchart highChart = new Highchart();
  ChartOptions chartOptions = highChart.getChartOptions();

  chartOptions.chart().type(ChartType.BAR);
  chartOptions.title().text("Historic World Population by Region");
  chartOptions.subtitle().text("Source: Wikipedia.org");

  set your options......

  return highChart;
 }

}

Javascript
Include required Javascript on your page as per Highcharts documentation.

Highcharts.setOptions(${globalOptionsJson});
Highcharts.chart('container', ${chartOptionsJson});

Your Java code will generate the json for ${globalOptionsJson} and ${chartOptionsJson}.
Add the options strings to your Javascript.

Thats it. You now have a working Bar chart example.