|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.moxieapps.gwt.highcharts.client.Configurable<T>
public abstract class Configurable<T>
A common base class that any of the objects which support configuration options will
extend to allow the caller to set the options on them. Provides a convenient
setOption(String, Object)
method that will allow for a configuration option
to be set at any level.
Constructor Summary | |
---|---|
Configurable()
|
Method Summary | |
---|---|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Configurable()
Method Detail |
---|
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()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |