我想一个“图表”(HighCharts - 角计)添加到一个流面板。 添加时,出现以下异常
com.google.gwt.event.shared.UmbrellaException: Exception caught: (TypeError) @org.moxieapps.gwt.highcharts.client.BaseChart::nativeRenderChart(Ljava/lang/String;Lcom/google/gwt/core/client/JavaScriptObject;ZZLcom/google/gwt/core/client/JavaScriptObject;Lcom/google/gwt/core/client/JavaScriptObject;Lcom/google/gwt/core/client/JavaScriptObject;Lcom/google/gwt/core/client/JavaScriptObject;Lcom/google/gwt/core/client/JavaScriptObject;Lcom/google/gwt/core/client/JavaScriptObject;Lcom/google/gwt/core/client/JavaScriptObject;Lcom/google/gwt/core/client/JavaScriptObject;Lcom/google/gwt/core/client/JavaScriptObject;Lcom/google/gwt/core/client/JavaScriptObject;)([string: 'Chart', JavaScript object(15907), bool: false, bool: false, JavaScript object(15932), JavaScript object(15933), JavaScript object(15934), JavaScript object(15924), JavaScript object(15928), JavaScript object(15923), JavaScript object(15926), JavaScript object(15927), JavaScript object(15930), JavaScript object(15931)]):
b is undefined at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:129) at com.google.gwt.user.client.ui.Widget.fireEvent(Widget.java:129) at com.google.gwt.event.logical.shared.SelectionEvent.fire(SelectionEvent.java:43) at com.google.gwt.user.client.ui.SuggestBox.fireSuggestionEvent(SuggestBox.java:1166) at com.google.gwt.user.client.ui.SuggestBox.setNewSelection(SuggestBox.java:1190) at com.google.gwt.user.client.ui.SuggestBox.access$7(SuggestBox.java:1185) at com.google.gwt.user.client.ui.SuggestBox$2.onSuggestionSelected(SuggestBox.java:683) at
Caused by: com.google.gwt.core.client.JavaScriptException: (TypeError) @org.moxieapps.gwt.highcharts.client.BaseChart::nativeRenderChart(Ljava/lang/String;Lcom/google/gwt/core/client/JavaScriptObject;ZZLcom/google/gwt/core/client/JavaScriptObject;Lcom/google/gwt/core/client/JavaScriptObject;Lcom/google/gwt/core/client/JavaScriptObject;Lcom/google/gwt/core/client/JavaScriptObject;Lcom/google/gwt/core/client/JavaScriptObject;Lcom/google/gwt/core/client/JavaScriptObject;Lcom/google/gwt/core/client/JavaScriptObject;Lcom/google/gwt/core/client/JavaScriptObject;Lcom/google/gwt/core/client/JavaScriptObject;Lcom/google/gwt/core/client/JavaScriptObject;)([string: 'Chart', JavaScript object(15907), bool: false, bool: false, JavaScript object(15932), JavaScript object(15933), JavaScript object(15934), JavaScript object(15924), JavaScript object(15928), JavaScript object(15923), JavaScript object(15926), JavaScript object(15927), JavaScript object(15930), JavaScript object(15931)]): b is undefined at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:249) at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136) at
.
.
我已经加入进口像highcharts.js,highcharts-more.js和exporting.js 在我的GWT.html
但是它仍然是一个例外。 请帮忙。
伊格纳西奥您好,
感谢您的回复。 我已经调试了它,在highcharts提供的BaseChart类中,我找到了 b ,它是 boolean
这是在BaseChart类中导致异常的行,
chart = nativeRenderChart(
getChartTypeName(),
createNativeOptions(),
toolTip != null && toolTip.getToolTipFormatter() != null,
legend != null && legend.getLabelsFormatter() != null,
chartEventHandlers.getJavaScriptObject(),
seriesEventHandlers.getJavaScriptObject(),
pointEventHandlers.getJavaScriptObject(),
xAxisEventHandlers.getJavaScriptObject(),
yAxisEventHandlers.getJavaScriptObject(),
xAxisLabelFormatters.getJavaScriptObject(),
yAxisLabelFormatters.getJavaScriptObject(),
yAxisStackLabelFormatters.getJavaScriptObject(),
plotOptionsLabelFormatters.getJavaScriptObject(),
seriesLabelFormatters.getJavaScriptObject()
);
这注意到一个JavaScript http://jsfiddle.net/highcharts/EjRLw/
和加入以下 窗格, YAxis(刻度位置,宽度,颜色) GaugePlotOptions(颜色,线宽,堆叠), 系列(点) ToolTip(ValueSuffix)
我正在设置所有内容。 我验证了设置为'nativeRenderChart'方法的所有14个对象都不为空。
仍然出现相同的异常!!!! 不知道在所有:(! 请帮助我。
答案 0 :(得分:0)
这是JS的NullPointerException等效项。您可能会错过一些图表配置,但最终失败。要确切了解正在发生的情况,建议的策略是调试项目(代码服务器)并使用chrome dev-tools“暂停捕获的异常”。这将恰好在该NPE处停止,您应该看到缺少的内容以及什么意思b
。您必须以chrome格式查看所有源代码。 Java,JSNI或从属JS库。
答案 1 :(得分:0)
我已经解决了这个问题。 问题出在下面的代码上,
GaugePlotOptions plotOptions = new GaugePlotOptions();
// plotOptions.setStacking( Stacking.NORMAL ); <<--- CULPRIT
在'GaugePlotOptions'中设置'Stacking'引起了异常。 删除后,图表将显示在面板中。