JSFiddle - React, Tailwind, and code Playground

HTML

<script src="http://code.highcharts.com/highcharts.js"></script>
<script src="http://code.highcharts.com/modules/exporting.js"></script>
<div id="container" style="min-width: 400px; height: 400px; margin: 0 auto"></div>

<button id="add">ADD</button>
<button id="rm">REMOVE</button>

JavaScript

$(function () {
    var flag = true;
    
    $('#container').highcharts({
        title: {
            text: 'Monthly Average Temperature'
        },
        colors: [
            'red',
            'pink',
            'orange',
            'yellow',
            'green',
            'blue'
        ],
        series: [{
            name: 'Tokyo',
            data: [7.0, 6.9, 9.5, 14.5]
        }, {
            name: 'New York',
            data: [-0.2, 0.8, 5.7, 11.3]
        }, {
            name: 'Berlin',
            data: [-0.9, 0.6, 3.5, 8.4]
        }, {
            name: 'London',
            data: [3.9, 4.2, 5.7, 8.5]
        }, {
            name: 'xyn',
            data: [12.9, 4.2, 5.7, 8.5]
        }]
    });
    
    function setColors(chart){
        var series = chart.series,
                 colors = chart.options.colors,
                 len = series.length-1;
                    
                    
                        $.each(series,function(i,serie){
                            if(i==len) {
                                
                                serie.update({
                                    color: colors[i]
                                },true,true);
                            }
                            else {
                                serie.update({
                                    color: colors[i]
                                },false);
                            }
                        });
                    
    }
    
});