public class TestChart implements EntryPoint {
static class YourChart extends Widget {
private static final String HTML_BEGIN = "<html><head></
head><body><script type=\"text/javascript\" src=\"http://
ajax.googleapis.com/ajax/static/modules/gviz/1.0/chart.js\">";
private static final String HTML_END =
"</script></body></html>";
public YourChart(JSONObject userConf) {
this(userConf.toString());
}
public YourChart(String userConf) {
IFrameElement elem =
Document.get().createIFrameElement();
elem.setInnerHTML(HTML_BEGIN + userConf + HTML_END);
setElement(elem);
}
}
@Override
public void onModuleLoad() {
JSONObject conf = new JSONObject(getConf());
RootPanel.get().add(new YourChart(conf));
}
private static native JavaScriptObject getConf() /*-{
return {
"dataSourceUrl": "//location.to.document",
"options": {
"vAxes": [{
"min": null,
"title": "Hits",
"max": null
}],
"cat": false,
"title": "someMetric",
"titleX": "Date",
"backgroundColor": "#FFFFFF",
"legend": "right",
"logScale": false,
"reverseAxis": false,
"hAxis": {
"maxAlternation": 1
},
"hasLabelsColumn": true,
"isStacked": false,
"width": 600,
"height": 371
},
"state": {},
"chartType": "ColumnChart",
"chartName": "Chart 1"
};
}-*/;
}
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.