JSFiddle - React, Tailwind, and code Playground

by amit6june

HTML

<script src="http://code.highcharts.com/highcharts.js"></script>
<script src="http://code.highcharts.com/modules/exporting.js"></script>
<select id="ChType">
    <option value="1">Promo Behavioural Clusters</option>
    <option value="2">Gender</option>
    <option value="3">Age</option>
</select>
<div id="container" style="min-width: 310px; height: 400px; max-width: 600px; margin: 0 auto"></div>

JavaScript

$(function () {
    var chart;
    
    
$('#ChType').change(function(){
//                    alert(this.value)
                         changeType(this.value);
                   })


function changeType(series) {
    
    
     var chart = $('#container').highcharts();
         //chart.redraw();
    var item = chart.series[0];
    //alert("item"+item)
    //item.options.showInLegend = false;
   // item.legendItem = null;
   // chart.legend.destroyItem(item);
   // chart.legend.render();
     var options = chart.options;
            options.series[0].showInLegend = false;    
          
         //  chart.legend.allItems[0].destroy(); 
          //  chart.legend.allItems[1].destroy(); 
    var chart = $('#container').highcharts();
            var item = chart.series[1];
  //              alert("hi"+series)
                        var dataArray = [],
                            points = series.data;

                         $.ajax({
                             url: 'http://echo.jsontest.com/uid/12345/value/nuno_bettencourt',
			    type: 'GET',
			    dataType: "json",
			    success: function (data) {
			    chart.series[0].setData([
                            ['Group12', 45.0],
                            ['Group21', 26.8], 
                            ['Group32', 8.5],
                            ['Group43', 6.2],
                            ['Group54', 0.7]
                                           ]);	
			   
			       
			    }
			  });
         
                    }

var chart;    

    $(document).ready(function () {

        
        chart = new Highcharts.Chart({
            chart: {
                renderTo: 'container',
                plotBackgroundColor: null,
                plotBorderWidth: null,
                plotShadow: false,
                events: {
	        	load: function() {
	        	//	alert ('Chart has loaded');
                    
                     for (var i in legend.allItems) {
                      
                    ...