Thanks Iliana,
This is how I remove the series:
function getConfiguration () {
dataService.getGraphConfigurations(that.graphid).then(function (result) {
var configurations = result.data;
var chartOptions = that.chartobject.options;
clearCollection(chartOptions.series);
angular.forEach(configurations, function (config) {
chartOptions.series.push({
categoryField: "date",
name: config.name,
field: config.seriesKey,
type: "line",
markers: {
size: 2
},
tooltip: {
visible: true,
template: getTooltipTemplate(config.formatAs)
}
});
});
refreshData();
that.chartobject.redraw();
});
}
clearCollection(series){
while(series.length > 0){
series.pop();
}
}