GWT Highcharts中的第二个Y轴在股票图表上?

时间:2012-08-22 14:00:33

标签: gwt highcharts highstock

我尝试使用Moxieapps Highcharts包装器将第二个Y轴添加到StockChart,但没有成功。我需要在图表的右侧添加一个新轴,并希望以下代码能够工作:

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轴,这可以告诉我这里我做错了什么?非常感谢提前!

1 个答案:

答案 0 :(得分:1)

我遇到了同样的问题,似乎GWT-HighCharts就是问题所在。您必须通过本机调用手动创建YAxises。这是解决方案;

HighCharts Stock Chart error code 18