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 => {
    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 =[]
    for(var i=0;i<input.HighLightedBrands.length;i++)
    {   var obj= {};
        if(i==0)
        {
            obj["name"] = input.chosenBrand[0].name,
            obj["equityGap"] = input.chosenBrand[0].equityGap,
            obj["marketShare"] = input.chosenBrand[0].marketShare,
            obj["powerInTheMind"] = input.chosenBrand[0].powerInTheMind
            choosenHighligtherBrands.push(obj);
            obj={};
        }
            obj["name"] = input.HighLightedBrands[i].name,
            obj["equityGap"] = input.HighLightedBrands[i].equityGap,
            obj["marketShare"] = input.HighLightedBrands[i].marketShare,
            obj["powerInTheMind"] = input.HighLightedBrands[i].powerInTheMind
            choosenHighligtherBrands.push(obj);

    } 

    var Choosenpim = choosenHighligtherBrands.map(function (item) {
        return item.powerInTheMind;
    })
    var Choosenms = choosenHighligtherBrands.map(function (item) {
        return item.marketShare;
    })
    var Chooseneq = choosenHighligtherBrands.map(function (item) {
        return item.equityGap;
    })
    
  
    var maxpimbrand = Math.max.apply(null, Choosenpim);
    var maxmsbrand = Math.max.apply(null,Choosenms);
    var maxequ = Math.max.apply(null,Chooseneq);
  
    var maxChosenBrand = Math.max.apply(null, [maxpimbrand,maxmsbrand,maxequ]);
    var maxMSCmpBrands = Math.max.apply(null, msv);
    var maxProjectedCmpBrands = Math.max.apply(null, pim);
    var MaxBrandValue = Math.max(maxMSCmpBrands,...