JSFiddle - React, Tailwind, and code Playground

by Kesav Telaprolu

HTML

<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<script src="https://code.highcharts.com/modules/export-data.js"></script>
<head>
    <style>
        /*
 * Legal Disclaimer
 *
    print '\n', 'Note that the webfonts share the TT sources'
 * These Fonts are licensed for unlimited use on domains and their subdomains of The Kantar Group.
 * It is illegal to download or use them on other websites.
 *
 * While the @font-face statements below may be modified by the client, this
 * disclaimer may not be removed.
 *
 * Lineto.com, 2016
 */



@font-face {
    font-family: "KantarBrownWeb-LightItalic";
    src: url("https://riofontstorage.blob.core.windows.net/kantar-fonts/KantarBrownWeb-LightItalic.eot");
    src: url("https://riofontstorage.blob.core.windows.net/kantar-fonts/KantarBrownWeb-LightItalic.eot?#iefix") format("embedded-opentype"),
         url("https://riofontstorage.blob.core.windows.net/kantar-fonts/KantarBrownWeb-LightItalic.woff2") format("woff2"),
         url("https://riofontstorage.blob.core.windows.net/kantar-fonts/KantarBrownWeb-LightItalic.woff") format("woff");
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: "KantarBrownWeb-BoldItalic";
    src: url("https://riofontstorage.blob.core.windows.net/kantar-fonts/KantarBrownWeb-BoldItalic.eot");
    src: url("https://riofontstorage.blob.core.windows.net/kantar-fonts/KantarBrownWeb-BoldItalic.eot?#iefix") format("embedded-opentype"),
         url("https://riofontstorage.blob.core.windows.net/kantar-fonts/KantarBrownWeb-BoldItalic.woff2") format("woff2"),
         url("https://riofontstorage.blob.core.windows.net/kantar-fonts/KantarBrownWeb-BoldItalic.woff") format("woff");
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: "KantarBrownWeb-Italic";
    src:...

JavaScript

( input=>{

var local_data_series = []
var minvalue =[]
var _yOffset;
for(var r=0;r<input.series.length;r++)
  {
      var convertednegativevalue =[];
      var obj ={};
      for(var b=0;b<input.brand_color.length;b++)
      {
         if(input.brand_color[b].name.toLowerCase() == input.series[r].name.toLowerCase())
         {
           obj['color'] = input.brand_color[b].color;
           _yOffset = input.brand_color[b].y;
         }

      }
      if(input.series[r].name.toLowerCase().trim() =="at risk" || input.series[r].name.toLowerCase().trim()=="reduced spend" || input.series[r].name.toLowerCase().trim()=="Defectors".toLowerCase())
      {

         for(var a=0;a<input.series[r].data.length;a++)
         {
            a == 0 ? convertednegativevalue.push("") : convertednegativevalue.push(-input.series[r].data[a]);
         }
         minvalue.push(Math.min.apply(null,convertednegativevalue))
         obj['data'] = convertednegativevalue;
         obj['dataLabels'] = {
                enabled : true,
                y:_yOffset,
                color:'#ffffff',
                formatter: function() {
                return Highcharts.numberFormat(Math.abs(this.y),2)
             },
            }
        obj["stacking"]= 'normal',
        obj["borderWidth"]= 0
       
      }
      else 
      {
        obj['data'] = input.series[r].data
        obj['dataLabels'] = {
                enabled : true,
                y:_yOffset,
                color:'#000000',
                formatter: function() {
                return Highcharts.numberFormat(Math.abs(this.y),2)
             },
            }
            obj["stacking"]= 'normal',
        obj["borderWidth"]= 0
      }
      obj['name']= input.series[r].name
      obj['id']= input.series[r].name.replace(/[^a-zA-Z0-9]/g, '')
     
       local_data_series.push(obj);
  }
  var WithSegmentationorder = ["New Customers","Increased spend","Steady","Reduced Spend","Defectors"] 
  var WithOutSegmentationorder =...