高图表:动态更改图例项单击上的轴



我正在尝试在单击图例时更改股票图表的两个 yAxis 的大小。我已经试过了,但它们都不起作用:

    plotOptions: {
        series: {
            events: {
                legendItemClick: function(event) {
                    // does not change the height on the y axis
                    chart.yAxis[0].height = 5; 
                    chart.redraw();
                    // changes the size but throws: 
                    // Uncaught TypeError: Cannot read property 'options' of undefined 
                    var chartOptions = chart.options;
                    chartOptions.yAxis[0].height = 5; 
                    chart = new Highcharts.Chart(chartOptions);                                 
                }
            },
        }
    },

在这里摆弄

你可以使用 axis.update(),就像在例子中一样:

$('#up').click(function(){
         chart.yAxis[0].update({
             height:100
        });
});

http://jsfiddle.net/EhRA8/

最新更新