Skip to content

Highcharts Feature: Extending Wicked Charts

Alexander Nedomansky edited this page Mar 27, 2018 · 1 revision

Supported by:


Sometimes you may find some cool feature of Highcharts that is not (yet) supported by Wicked Charts because the Wicked Charts wrapper classes do not contain the fields you expect.

Extending a wrapper class

Let's say for example, that Highcharts has added the (fictional) option "backgroundColor" to the "chart" javascript object (for a documentation of the Highcharts objects see http://api.highcharts.com).

You can simply extend the ChartOptions class like this:

public class MyChartOptions extends ChartOptions {

	private ColorReference backgroundColor;

	@Override
	public ChartOptions setBackgroundColor(final ColorReference backgroundColor) {
		this.backgroundColor = backgroundColor;
		return this;
	}

	@Override
	public ColorReference getBackgroundColor() {
		return this.backgroundColor;
	}
}

If you use your own MyChartOptions class when constructing the options of a chart now, the new field "backgroundColor" will automatically be rendered in Wicked Chart's JSON output.