我正在尝试使用 Moxieapps Highcharts 包装器向 StockChart 添加第二个 Y 轴,但没有成功。我需要在图表的右侧添加一个新轴,并希望以下代码能够正常工作:
StockChart chart = new StockChart();
YAxis firstYAxis = chart.getYAxis(0);
firstYAxis.setAxisTitleText("First Y axis");
Series firstSeries = chart.createSeries();
firstSeries.setPoints(/* Imagine lots of points. */);
firstSeries.setYAxis(0); // Not required since 0 is the default Y axis.
chart.addSeries(firstSeries);
YAxis secondYAxis = chart.getYAxis(1);
secondAxis.setOpposite(true); // *Should* put the axis on the right side.
secondYAxis.setAxisTitleText("Second Y axis");
Series secondSeries = chart.createSeries();
secondSeries.setPoints(/* Imagine lots of points. */);
secondSeries.setYAxis(1); // *Should* add the series to the second Y axis.
chart.addSeries(secondSeries);
// Somehow the second series ends up being in the navigator...
chart.setOption("navigator/enabled", true);
chart.setOption("scrollbar/enabled", true);
add(chart);
第二个 Y 轴甚至不渲染。如果我不将第二个系列添加到第二个 Y 轴,它会(如预期)显示为第一个 Y 轴上的值。
有没有人在 StockChart 上成功添加了多个 Y 轴,这可以告诉我我在这里做错了什么?提前非常感谢!