score:2
Accepted answer
Looks like your code is modifying the array that is being iterated over. Try this and observe the logs.
$.each(chart.series, function(i,ser) {
console.log(i + " / " + chart.series.length);
ser.remove();
});
Observe how the current index i
is increasing and your series length is decreasing after each iteration.
0 / 4
1 / 3
2 / 2 << chart.series[2] becomes undefined for chart.series.length=2
At the third iteration, i=2
& chart.series.length=2
=> ser=undefined
Proper way to remove all series data from a highcharts chart? provides the right way of doing this. Always remove the series at index 0
if it exists.
while(chart.series.length > 0)
chart.series[0].remove(true);
Source: stackoverflow.com
Related Query
- Highcharts - Remove first marker from Area chart in every series
- highcharts chart showing only last element in series
- Show only some series in HighCharts spline chart
- Javascript Highcharts rename or remove series label in chart
- Highcharts - series.remove(); 4 series in chart, only 2 removed
- Highcharts remove legend and series from chart on legendItemClick
- Highcharts bar chart animation only working on 1 series
- How to render a bar chart with different series with only one entry per category in HighCharts
- HighCharts Dynamic multiseries Column Chart showing only 1 set of series at a time
- Proper way to remove all series data from a highcharts chart?
- remove series by name or id in highcharts
- Filtering legend of a Highcharts by only visible series
- Disable Print Chart option only from HighCharts
- highcharts - chart names for multiple pie chart series in one chart
- Highcharts - best way to handle and display zero (or negative) values in a line chart series with logarithmic Y axis
- Highcharts Column chart with drilldown, remove hyperlink like formatting from x-axis labels
- Highcharts - How can I remove starting and ending padding from area chart
- Highcharts - Scatter chart with a line connecting the dots in the series
- How to remove the halo/glow around a marker upon hovering a series in Highcharts
- Highcharts 3.0, area chart with stacked and unstacked series - how to fix?
- HighCharts : How to add or remove "chart context menu" from chart container?
- Highcharts - remove points from series
- Highcharts - Area Chart - Stacking with series containing negative and positive values
- unable to get series id in HighCharts chart
- Change chart type and redraw with multiple series in Highcharts
- HighCharts Stock Chart error code 18
- How to remove a series in Highcharts by name
- adding series from existing highcharts chart
- HighCharts - Remove space between series on stacked bar
- $.each only shows one series highcharts
More Query from same tag
- Custom colors in Highcharter are not mapping correctly to the legend
- Highcharts - Enable border for 1 column/bar only?
- rCharts - Data label for Highcharts bubble chart
- Highchart's highstock tickPositions on multiple y axis
- Highcharts exceeding width of parent on Chrome only
- Donut Chart : Trigger legend or pie click event while selecting outside filter state change
- Is there a way to limit legends on a horizontal layout on specific amount of rows during export?
- issues with HighCharts
- Insert data into jquery highcharts fail
- How can I get proper object through loop using javascript for Bubble Charts of Highcharts
- how to place the chart in the centre while using django-chartit?
- Highcharts time series combo graph where few months data is null
- Highcharts tooltip formatter using jquery replace
- highcharts on top of google map
- Highmaps logo string rendering invalid copyright character
- Highcharts Tooltip At Column Chart
- drilldown not working in piecharts in reactjs
- How to remove cirlce,line,square symbol from highchart
- How to decrease sensitivity of automatic axis adjustment in Highcharts when dragging points
- Multiple tooltip with numericsymbols (date turns timestamp) in R
- How to Show Highchart on popup page [triggered by button]
- Symfony2 Highcharts-Bundle with dynamic update
- High charts tooltip location issues
- how to change highcarts sunburst slice/level without clicking levels
- Hide data labels of a HIChart's Pie chart using Swift 5.0
- How to remove category label margins of highchart?
- highcharts : set title on exporting
- HighCharts: how to update bar color when updating the point value
- JSQuery.load Highchart
- Highchart shiny R scatter plot - how to define individual point colors