0
votes

I'm trying to remove highcharts y-axis dynamically, but i haven't found any method that can help me. I have multiple y-axes, and each axis is related with some line. The problem is when I delete the series from highcharts, the y-axis that is related with these series is not being removed.

My function of removing:

 removeSeries: function(model) {
        var chart = this.chart;
        var id = model.get('id');
        var series = chart.series;
        var index = undefined;
        for (var seriesName in series) {
            var seriesObject = series[seriesName];
            var id = seriesObject.userOptions.id;
            if (id === model.get('id')) {
                seriesObject.remove();
                //index = seriesObject._i;
                break;
            }
        }
        chart.redraw();

    }

Thanks in advance!

1

1 Answers

0
votes

You need to call yAxis.remove() on particular axis, because when series is removed, yAxis is not dropped, defaulty.

http://api.highcharts.com/highcharts#Axis.remove