remove series by name or id in highcharts

highcharts, javascript

Solution

Ok, I found it myself. I send the series name in a hidden field of a div and when I click the delete button I'm checking if the name matches among the series and if match found I delete it.

var chart = $('#container').highcharts();
                var seriesLength = chart.series.length;
                for(var i = seriesLength - 1; i > -1; i--)
                {
                    //chart.series[i].remove();
                    if(chart.series[i].name ==document.getElementById("series_name").value)
                        chart.series[i].remove();
                }

Problem

Is there anyway to remove a series by name or id? I mean it is possible to remove series by `this.remove()` or ``` var seriesLength = chart.series.length; for(var i = seriesLength - 1; i > -1; i--) { chart.series[i].remove(); } ``` but by name say, `series_name.remove()` is it possible?

Original source