I have a remove[] array which has all the index positions of all the element with 0 in the data array (as below).
data array:
Retail,1,Utilities,1,Fo
Every time you remove one, you're making any further cached indices obsolete because the array from that point forward is reindexed.
As a result, you're removing the wrong items after the first.
You should iterate the remove
array in reverse instead.
var i = remove.length;
while (i--) {
if (remove[i] != undefined)
options.series[0].data.splice(remove[i],1);
}
Additionally, you can improve the performance and get rid of the undefined
test if you simply .push()
each index into the remove
array...
remove.push(index);