public abstract class Configurable<T> extends Object
setOption(String, Object) method that will allow for a configuration option
to be set at any level.| Constructor and Description |
|---|
Configurable() |
| Modifier and Type | Method and Description |
|---|---|
com.google.gwt.json.client.JSONObject |
getOptions()
Retrieve all of the options that have been configured for this instance
as a JSONObject.
|
T |
setOption(String path,
Object value)
Set an option on the object at any level, using "/" characters to designate which
level of option you'd like to set.
|
public T setOption(String path, Object value)
Chart chart = new Chart();
chart.setOption("/chart/type", "spline");
chart.setOption("/chart/marginRight", 10);
chart.setOption("/title/text", "Nice Chart");
Would result in initializing HighCharts like the following:
new HighCharts.Chart({
chart: {
type: "spline",
marginRight: 10
},
title: {
text: "Nice Chart"
}
});
Note that the beginning "/" is optional, so chart.setOption("/thing", "piglet") is
equivalent to chart.setOption("thing", "piglet").
For details on available options see the Highcharts reference.
Note that, when possible, you'll ideally want to use one of the available type specific setter
methods instead of this general method. E.g. instead of doing this:
series.setOption("type", "spline");
Do this instead:
series.setType(Series.Type.SPLINE);
path - The path to the option to set (e.g. "/title/text");value - The value to set for the option (can be a String, Number, Boolean, or JSONObject)Configurable instance for convenient method chaining.public com.google.gwt.json.client.JSONObject getOptions()
Copyright © 2015. All Rights Reserved.