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-radius: 10px;border: 1px solid #dbdbdb;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") format("woff2");
  font-weight: normal;
  font-style: normal;
}

@font-face {
 ...

JavaScript

(input => {

	//-chart one input
  var riskValue = [], steadyvalue = [], opportunityValue = [], dataSeries = [];
  //-chart two input
  var shareLostValue = [], decreaseSpendValue = [], shareGainedValue = [], increaseSpendValue = [], individualSegments = [];
  for (var val = 0; val < input.brands.length; val++){
  	riskValue.push(input.brands[val].grouped.risk);
  	steadyvalue.push(input.brands[val].grouped.steady);  
  	opportunityValue.push(input.brands[val].grouped.Opportunity);
    
  	shareLostValue.push(input.brands[val].ungrouped.shareLost);
  	decreaseSpendValue.push(input.brands[val].ungrouped.decreaseSpend);
  	shareGainedValue.push(input.brands[val].ungrouped.shareGained);
  	increaseSpendValue.push(input.brands[val].ungrouped.increasesSpend);
  }
  		dataSeries.push(riskValue);
      dataSeries.push(steadyvalue);
      dataSeries.push(opportunityValue);  
  
  		individualSegments.push(shareLostValue);
      individualSegments.push(decreaseSpendValue);
      individualSegments.push(shareGainedValue);
      individualSegments.push(increaseSpendValue);
      
      
  
  var chart1boxvalueList = [];
  var chart2boxvalueList = [];
  var Chart1MaxValueList = [Math.max.apply(null, steadyvalue), Math.max.apply(null, riskValue), Math.max.apply(null, opportunityValue)];
  var chart1MaxValue = Math.max.apply(null, Chart1MaxValueList);
  var maxwidth = Math.max.apply(null, steadyvalue) + Math.max.apply(null, riskValue) + Math.max.apply(null, opportunityValue);
  var Chart2MaxValueList = [chart1MaxValue, Math.max.apply(null, shareLostValue), Math.max.apply(null, decreaseSpendValue), Math.max.apply(null, shareGainedValue), Math.max.apply(null, increaseSpendValue)];
  var chart2MaxValue = Math.max.apply(null, Chart2MaxValueList);

  
  var implicitChartwidth, steadyXPosition, scale;
  if (input.brands.length > 6) {
    implicitChartwidth = 265;
    steadyXPosition = 135;
    scale = 48;
  } else if (input.brands.length <= 6 && input.brands.length > 4) {
   ...