0

When I call series[0].remove() in a while loop, the shadow of the cursor is never cleaned. The code is called on a area-stacked click.

plotOptions: {
    area: {
      stacking: 'percent',
      trackByArea: true,
      events: {
        click: function () {
          var chart = $('#container').highcharts();
          while(chart.series[0]) {
            chart.series[0].remove();
          }
        }
     }
   }
}

JSFiddle : http://jsfiddle.net/4sV5g/

Any idea on how to avoid that ?

doobdargent
  • 630
  • 5
  • 14

1 Answers1

0

Found the solution here : https://stackoverflow.com/a/18659064/1456184

for(var i = chart.series.length - 1; i > -1; i--) {
     if(chart.series[i].name !== 'Navigator') {
          chart.series[i].remove(false);
     }
}

Using remove(false) and then a redraw() will not have artifacts. And I'm not removing the navigator series so there is no bug there too. I should probably update it like in this fiddle : http://jsfiddle.net/engemasa/WcLQc/

Community
  • 1
  • 1
doobdargent
  • 630
  • 5
  • 14