the java api for highcharts

Unfortunately it seems your spam filter blocks all contact via email. We have tried everything we can including different accounts.

Formatter Issue

We don’t know another way other than “formatter” to meet your requirement.

It seems the Highcharts call back functions like “formatter” are not strict JSON. JSON doesn’t allow inline functions.

The only real way to do this is to treat the functions as strings. They can then be serialised/deserialised.
Of course Highcharts will not work like that as Highcharts expects a function.

We can also provide some JavaScript that will convert them back before rendering the chart.
If the below is of interest to you, let us know. We can also release a v9.3.3.1 with these changes.

We will be making the following changes in the next v10.x.x release.

There will be a new methods on the Function class.
.setEmitAsString(boolean emitAsString) – will emit the function as a string

There will be a JavaScript function that converts the options back. You would need to include in your Javascript.

There will also be a new static methods on the Highchart class. Allows for all Functions to be emitted as strings.
.setEmitFunctionAsString(boolean emitFunctionAsString) – will emit all functions as a string

Your code would look like:
chartOptions.getPlotOptions().getBar().getDataLabels().setEnabled(true).setFormatter(new Function(“yourfunctionbody”).setEmitAsString(true)); // just this function is effected
Highchart.setEmitFunctionAsString(true); // All functions are effected

You can actually try it out now with your current version of HyJavaCharts using GenericOptions with the following:

.add(new GenericOption()
.setPropertyValue(“\”_fn_function(){var color = this.y !== 0 ? ‘red’: ‘#000000’; var underline = this.y !== 0 ? ‘underline’: ‘none’; var pointer =this.y !== 0 ? ‘pointer’: ‘cursor’; return ‘‘ + this.y + ‘‘;}\””));

You would also need to have this function call in your js to convert back to a function: hyJavaChartsInflateFunctions(yourChartConfig);

You can download the js function from here.

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:




Start the HyJavaCharts demo Java web application

Start the HyJavaStock demo Java web application

Start the HyJavaApex demo Java web application

Start the HyJavaImages demo Java web application