For those who stumble over it ... You must remove the series of diagrams from last to first. Also do not forget to redraw in the last series, or your changes will not be displayed :)
function changeChartType(chart, type, redraw) { var seriesOptions = new Array(chart.series.length); for (var i = 0; i < chart.series.length; i++) { var series = chart.series[i]; seriesOptions[i] = { type: type, name: series.name, color: series.color, dashStyle: series.options.dashStyle, lineWidth: series.options.lineWidth, marker: series.options.marker, dataLabels: series.options.dataLabels, enableMouseTracking: series.options.enableMouseTracking, data: series.options.data, isRegressionLine: series.options.isRegressionLine }; } for (var i = chart.series.length - 1; i >= 0; i--) { chart.series[i].destroy(); } for (var i = 0; i < seriesOptions.length; i++) { var newSeries = chart.addSeries(seriesOptions[i], redraw && i == seriesOptions.length - 1); } chart.currentType = type; }
source share