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
- How to plot AM,PM labels in HighChart?
- Animate change in piechart start angle with highcharts-ng
- Unable to correctly position the tooltip content in HighCharts
- Highcharts - How to Highlight a specific portion of a line graph?
- Highstock: how to define and make the x and y axes visible?
- HighStock "xRange" chart is not working with older version library(HighStock)
- (kendoUI chart) Possible to reflow its size with a resizing window?
- TypeScript insert record to multi dimension array ( Eg - Array< number | [number, number] | [string, number] )>
- Highcharts: Add multiple colors to area line chart
- highcharter graph with 2 groups in r
- Exporting more than one HighCharts to excel
- Maximum value for gauge being ignored in highcharts
- Javascript not working after renaming asp.net page
- Displaying percentage in Y-axis of Highcharts column chart
- R Markdown - Highcharter - Animate graph when visible, rather on page load?
- Max 2 series visible in hightcharts.js
- Highcharts visualizes chart data incorrectly after zooming or using the navigator
- Render from/to areas in Highcharts line chart
- Empty space above plot lines in Highcharts
- getting 0x03 error when performing chart generation: please check your input data in Highchart
- r - automatically add y axis in highchart
- Unable to programmatically toggle (close only) Highchart's default Context Menu using jQuery.toggle()
- How to refresh pane background when update date on gauge highcharts?
- x-axis minimum value to 2 and tickinterval of 6 months using highcharts
- Display labels in Highcharts 3D scatter plot
- Rendering HighCharts in AngularJS from Json Object
- show data of highcharts from database table laravel
- Negative bar chart of highcharts in chartjs
- Extending Area to full width of Chart with Months on x-axis
- Highcharts - per customer- even small date/range increments must be visible