我想使用gwt-highchart(使用最新的gwt-highchart 1.6.0和Highstock 2.3.4版本)添加系列到我的图表应用程序。一切似乎都很好,直到第三个系列。当我尝试添加第三个我得到这个错误:HighCharts股票图表错误代码18
com.google.gwt.core.client.JavaScriptException: (String)
@org.moxieapps.gwt.highcharts.client.BaseChart::nativeAddSeries(Lcom/google/gwt/core
/client/JavaScriptObject;Lcom/google/gwt/core/client/JavaScriptObject;ZZ)([JavaScript
object(4953), JavaScript object(5135), bool: true, bool: true]): Highcharts error #18:
www.highcharts.com/errors/18
这里是我的代码(内循环运行):
// Create a new serie with a new yAxis
Series newSeries = chart.createSeries().setYAxis(index).setPlotOptions(new LinePlotOptions().setColor(tag.getColor()));
// Set new yAxis options
chart.getYAxis(index).setPlotLines(chart.getYAxis(index).createPlotLine().setValue(0).setWidth(1).setColor(tag.getColor())).setLabels(new YAxisLabels().setEnabled(false)).setTickLength(0).setOffset(60).setStartOnTick(false)
.setEndOnTick(false).setGridLineWidth(0).setMaxPadding(DEFAULT_YAXIS_MAX_PADDING).setMinPadding(DEFAULT_YAXIS_MIN_PADDING)
.setAxisTitle(new AxisTitle().setText(null).setStyle(new Style().setColor(tag.getColor())));
// Add the serie to the chart
chart.addSeries(newSeries.setName("Test " + index));
前两个系列都OK,因为我之前,但三分之一的人说一个抛出上面的异常(当我调试应用程序时,我可以看到新创建的yAxis引用)。
这里是会抛出异常的行:
chart.addSeries(newSeries.setName("Test " + index));
感谢
如果您不添加第3个系列,您是否得到图表? Highcharts错误#18:请求的轴不存在。你在同一行中调用两次'.setPlotLines()'。一旦选择了,另一次没有。这可以吗? –
感谢@AntoJurković为你的超级快速评论:)如果我不添加第3个系列,它几乎没有问题(但有时我会看到范围选择栏中的第二个系列!)顺便说一句,我删除了无参数调用'.setPlotLines()'但没有任何改变。 – ngc4151