This is the full code of the demo
public interface JQueryBundle extends JsniBundle {
public void initJQuery();
}
public static abstract class HighCharts implements JsniBundle {
@LibrarySource("js/highcharts.src.js")
public abstract void initHighcharts();
public void drawChart(String id, JavaScriptObject props) {
JavaScriptObject $container = JsUtils.runJavascriptFunction(window, "$", "#" + id);
JsUtils.runJavascriptFunction($container, "highcharts", props);
}
}
private JavaScriptObject charProps = $$("title: {text: 'Monthly Average Temperature'},"
+ "xAxis: {categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun']},"
+ "yAxis: {title: {text: 'Temperature (°C)'},},"
+ "series: [{name: 'Tokyo', data: [7.0, 6.9, 9.5, 14.5, 18.2, 21.5]},"
+ "{name: 'New York', data: [-0.2, 0.8, 5.7, 11.3, 17.0, 22.0]},"
+ "{name: 'London',data: [3.9, 4.2, 5.7, 8.5, 11.9, 15.2]}]");
public void testHighCharts() {
$("<div id='chart'>").appendTo(document);
// @include: JQueryBundle// @include: HighCharts
JQueryBundle jQuery = GWT.create(JQueryBundle.class);
HighCharts highCharts = GWT.create(HighCharts.class);
//
jQuery.initJQuery();
highCharts.initHighcharts();
highCharts.drawChart("chart", charProps);
}