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
- can we make nested donut charts in highcharts?
- Highcharts: Combo Dual Axes with DrillDown
- Conflict with GSAP and Highcharts on the same page
- Can't display another Highcharts chart on my HTML page - Django
- Highchart time interval in x-Axis
- Set Custom icon to context menu for multiple charts (Highcharts)
- R Highcharter - X-axis names turning to index in graph
- Switch between pie charts and bar chart in highcharts
- Highcharts - how to put bubble chart in straight line?
- X coordinates of each yAxis in HighStock chart
- Range Selector in Are Graph of High Chart
- Highcharts - Column width not responsive
- How to show the json data in Pie chart HighChart?
- How to draw multiple segments overlapping and non overlapping in high-charts?
- How to remove Hyper Link in XAxis name in Highcharts?
- Highcharts Speedometer add image background
- EmberJS Component With Graph
- Can you show/hide series in sunburst diagrams?
- Highcharts gantt chart : Task progress indicator need to show a single task for various status like completed,inprogress etc with different colors
- react-highcharts alignThreshold
- Displaying multiple Highcharts from single json
- Export highcharts animation as video
- Two legend styles for two stacked chart styles in highchart
- Exception when converting to image from Base-64 string
- How to place highcharter objects at same horizontal level using rmarkdown?
- How to align HighCharts (bar chart) bars to the top/front?
- remove Highchart.com link from the chart
- Highcharts drilldown with more than one series
- Can't show the color in interactive highchart choropleth map
- To serialize the object into JSON