Open GoogleCodeExporter opened 9 years ago
I'll look into this.
Original comment by sanjiv.j...@gmail.com
on 11 May 2011 at 3:57
Hi,
Some more feedback.
The following will display the chart (in Chrome) in a nested layout container
(see attached screen shot) but the image is hidden if you re-size the browser
window.
In FF3 the chart is not shown but if you re-size the browser window you can see
it momentarily.
->
public class ContextArea extends VLayout {
private static final String CONTEXT_AREA_WIDTH = "*";
private static String html = "<div id=\"chart_nested_div\" style=\"position: absolute; z-index: 1000000\"> </div>\n";
private HTMLFlow htmlFlow;
private PieChart pie;
public ContextArea() {
super();
Log.debug("init Context Area()...");
this.setWidth(CONTEXT_AREA_WIDTH);
this.setBackgroundColor("#EEEEEE");
htmlFlow = new HTMLFlow(html);
this.addMember(htmlFlow);
loadVisualizationApi();
}
public void loadVisualizationApi() {
Log.debug("loadVisualizationApi()");
// Create a callback to be called when the visualization API has been loaded.
Runnable onLoadCallback = new Runnable() {
public void run() {
Log.debug("onLoadCallback()");
// pie = new PieChart(createTable(), createOptions());
// RootPanel.get("chart_sibling_div").add(pie);
// RootPanel.get("chart_nested_div").add(pie);
drawChart();
}
};
// Load the visualization api, passing the onLoadCallback to be called when loading is complete.
VisualizationUtils.loadVisualizationApi("1.1", onLoadCallback, PieChart.PACKAGE);
}
private native void drawChart() /*-{
// Create our data table.
var dataTable = new $wnd.google.visualization.DataTable();
dataTable.addColumn('string', 'Task');
dataTable.addColumn('number', 'Hours per Day');
dataTable.addRows(5);
dataTable.setValue(0, 0, "Work");
dataTable.setValue(0, 1, 11);
dataTable.setValue(1, 0, "Eat");
dataTable.setValue(1, 1, 2);
dataTable.setValue(2, 0, "Commute");
dataTable.setValue(2, 1, 2);
dataTable.setValue(3, 0, "Watch TV");
dataTable.setValue(3, 1, 2);
dataTable.setValue(4, 0, "Sleep");
dataTable.setValue(4, 1, 7);
// Instantiate and draw our chart, passing in some options.
// var chart = new $wnd.google.visualization.PieChart($doc.getElementById('chart_sibling_div'));
var chart = new $wnd.google.visualization.PieChart($doc.getElementById('chart_nested_div'));
chart.draw(dataTable, {width: 400, height: 240});
}-*/;
...
}
->
Cheers
Rob
Original comment by rob.ferg...@gtempaccount.com
on 12 May 2011 at 1:39
Attachments:
I would also like to add that I tested Rob's code with the modified version of
ContextArea that uses JSNI to create the chart with these libraries:
- SmartGWT 2.5, nightly build from May 15, 2011
- Google Visualization 1.1.1
- GWT 2.2.0
But was able to produce the chart in IE without error. Firefox 3.6.17 was not
able to produce the chart just as Rob outlined. It left the screen blank.
When I used just straight Java to try to create the chart, I produced the
dreaded AssertionError that's been driving me nuts for the past couple weeks in
both Firefox and IE.
Original comment by etblackw...@gmail.com
on 17 May 2011 at 2:11
does anyone have a workaround for it?
Original comment by mail.Sev...@gmail.com
on 29 Aug 2011 at 3:54
This never got fixed?
Original comment by flint.ba...@gmail.com
on 20 Jan 2012 at 2:37
Hi,
I don't think so.
That's why I use gwt-highcharts:
-> http://gwt-cx.com/serendipity/Serendipity.html
Cheers
Rob
Original comment by rob.ferg...@uptick.com.au
on 20 Jan 2012 at 3:53
Is there any workaround to resolve the assertion error other than using the
following
if(GWT.isScript()){
}
Kind regards,
Anoop
Original comment by anoop.si...@gmail.com
on 2 Apr 2012 at 12:38
Original issue reported on code.google.com by
rob.ferg...@gtempaccount.com
on 11 May 2011 at 3:52Attachments: