Hi! I'm new with Highcharts and I'm having a problem with this library: in particular I think that the method setSeries() does not work very well. I want to create a chart by selecting players from a form and from ajax call I retrive data (this backend part works well). The first series is added correctly, with all data, but the problem arise when a I want to add a second series omitting a player. Second series's chart is draw without the player that I excluded, and without another player that should be in the chart (this is the problem).
Here is the piece of code that handle this part:
```
for (var j = 0; j < summary_chart.series.length; j++) {
var data = summary_chart.series[j].data;
for (var i = 0; i < data.length; i++) {
var obj = {};
for (var k = 0; k < datapoint_attrs.length; k++) {
var attr = datapoint_attrs[k];
obj[attr] = data[attr];
}
obj.x = mapping[obj.id]; // update x-axis index
new_data.push(obj);
}
new_data.sort((a, b) => (a.x > b.x) ? 1 : ((b.x > a.x) ? -1 : 0));
summary_chart.series[j].setData(new_data, updatePoints=false);
new_data = []
}
```
everything is fine, new_data has all data I want to draw (without who I exclude), until setData() is executed. In fact, after his execution, summary_chart.series[1].data has not a player that should be in a chart.
Now I create a chart and in the second series Di Tommaso lacks but he's in new_data before executing setData():
```
Array(5) [ {…}, {…}, {…}, {…}, {…} ]
0: Object { x: 0, y: 1, name: "BAUDO PIPPO - category: EXERCISE<br/>n.sessions: 1<br/>sessions: 1.00 ", … }
1: Object { x: 1, y: 0, name: "BRYANT KOBE - category: EXERCISE<br/>n.sessions: 0<br/>sessions: 0.00 ", … }
2: Object { x: 2, y: 1, name: "BUONGIORNO MIKE - category: EXERCISE<br/>n.sessions: 1<br/>sessions: 1.00 ", … }
3: Object { x: 3, y: 0, name: "CALLUM BRALEY - category: EXERCISE<br/>n.sessions: 0<br/>sessions: 0.00 ", … }
4: Object { x: 5, y: 2, name: "DI TOMMASO FILIPPO - category: EXERCISE<br/>n.sessions: 2<br/>sessions: 2.00 ", … }
length: 5
```
Any ideas or suggestions? Thanks in advance!