JSFiddle - React, Tailwind, and code Playground

by Kesav Telaprolu

HTML

<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<div id="container" style="width: 1240px;height:688px;border:1px solid #dbdbdb;border-radius:10px;position:relative"></div>

CSS

/*
 * 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: url("https://riofontstorage.blob.core.windows.net/kantar-fonts/KantarBrownWeb-Italic.eot");
    src: url("https://riofontstorage.blob.core.windows.net/kantar-fonts/KantarBrownWeb-Italic.eot?#iefix") format("embedded-opentype"),
         url("https://riofontstorage.blob.core.windows.net/kantar-fonts/KantarBrownWeb-Italic.woff2")...

JavaScript

(input => {
       
    function NullHandling(currval)
    {
        if(currval == null || currval == "")
              return 0;
        else 
              return isNaN(currval) ? 0 : currval;
    }
   
    for(var item =0;item<input.cmpBrands.length;item++){
        if(item == 0){
            input.chosenBrand.equityGap = NullHandling(input.chosenBrand.equityGap)
            input.chosenBrand.marketShare = NullHandling(input.chosenBrand.marketShare)
            input.chosenBrand.powerInTheMind = NullHandling(input.chosenBrand.powerInTheMind)
        }
        input.cmpBrands[item].equityGap = NullHandling(input.cmpBrands[item].equityGap);
        input.cmpBrands[item].marketShare = NullHandling(input.cmpBrands[item].marketShare);
        input.cmpBrands[item].powerInTheMind = NullHandling(input.cmpBrands[item].powerInTheMind);
    }
    for(var hitem =0 ;hitem < input.HighLightedBrands.length;hitem++)
    { //HighLightedBrands
        input.HighLightedBrands[hitem].equityGap = NullHandling(input.HighLightedBrands[hitem].equityGap);
        input.HighLightedBrands[hitem].marketShare = NullHandling(input.HighLightedBrands[hitem].marketShare);
        input.HighLightedBrands[hitem].powerInTheMind = NullHandling(input.HighLightedBrands[hitem].powerInTheMind);
    }
    var defaultHeight = 45;
    var rectPoints = [];

    var chartWrapper = $("<div></div>").appendTo("#container")
        .attr("id", "chart_wrapper");

    var chartDiv = $("<div></div>").appendTo("#chart_wrapper")
        .attr("id", "chart_div");

    var msv = input.cmpBrands.map(function (item) {
        return item.marketShare;
    })

    var pim = input.cmpBrands.map(function (item) {
        return item.powerInTheMind;
    })
    var choosenHighligtherBrands = [];
    if (input.HighLightedBrands && input.HighLightedBrands.length > 0) {
        choosenHighligtherBrands = input.HighLightedBrands.slice();
    }

    choosenHighligtherBrands.unshift(input.chosenBrand);


    var Choosenpim =...