0👍
private native JavaScriptObject init(Context2d ctx)
/*-{
var data = [];
return $wnd.Chart(e).Pie(data); //<-- *Explodes here*
}-*/;
What is e
? Is it allowed to be undefined at this point when you pass it to the chart?
From just a very quick glance at the linked project, you should be creating that Chart
with new
, and you should be passing the canvas Context2d instance ctx
into it instead of this unknown e
.
It is also very likely due to how canvas works that this will not behave correctly if your canvas is not attached to the dom, and your PieChart
constructor doesn’t attach it before it invokes init
. If that is a requirement, you likely need to not invoke init
until the widget’s attach event goes off or onAttach
is called, but you should learn more about how to wrap this project.
There are GWT compatible chart libraries out there, including Lienzo, GXT, and Highcharts. Full disclosure, I worked with Sencha building GXT for several years, and so have an obvious preference there.