JSFiddle - React, Tailwind, and code Playground
by Kesav Telaprolu
HTML
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="https://code.highcharts.com/6.2.0/highcharts.js"></script>
<div id="container" style="height:688px;width:1240px;overflow:auto;border-radius:6px;border:1px solid #dbdbdb;"></div>
CSS
@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 {
font-family: "KantarBrownWeb-Thin";
src: url("https://riofontstorage.blob.core.windows.net/kantar-fonts/KantarBrownWeb-Thin.eot");
src: url("https://riofontstorage.blob.core.windows.net/kantar-fonts/KantarBrownWeb-Thin.eot?#iefix") format("embedded-opentype"),
...
JavaScript
(input => {
$('head').append(`<style>
/* Use for 3 lines of text before truncation */
.mle-3 {
overflow: hidden;
position: relative;
line-height: 1.1em;
max-height: 2.7em;
text-align: justify;
padding: 1em 1em 0.4em 0em;
}
.mle-3:before {
content: '...';
position: absolute;
right: 0;
bottom: 0;
}
.mle-3:after {
content: '';
position: absolute;
right: 0;
width: 1em;
height: 2em;
margin-top: 0em;
background: #FFFFFF;
}
.concepts {
font-weight:700;
width:96px;
font-family:KantarBrownWeb-Bold;
font-size:17px;
color:#000000;
white-space: normal;
word-wrap:break-word;
z-index:-1;
}
/* Use for 6 lines of text before truncation */
.mle-6 {
overflow: hidden;
position: relative;
line-height: 1em;
max-height: 5.4em;
text-align: justify;
padding: 1em 1em 0.4em 0em;
margin: 0px;
}
.mle-6:before {
content: '...';
position: absolute;
right: 0;
bottom: 0;
}
.mle-6:after {
content: '';
position: absolute;
right: 0;
width: 1em;
height: 1em;
margin-top: 0.2em;
background: #FFFFFF;
}
.concepts1 {
font-weight:700;
width:96px;
font-family:KantarBrownWeb-Bold;
font-size:17px;
color:#000000;
white-space: normal;
word-wrap:break-word;
z-index:-1;
}
</style>`);
var CurrentShareValues = input.chartData.marketShare;
var projectedValues = input.chartData.powerInTheMind;
var DifferenceValues = input.chartData.equityGap;
var chosenBrandValues = input.chartData.chosenBrand;
var chosenBrandName = "";
var CmpBrandNames = input.cmpBrandNames;
var marketShareWidth;
var pimWidth;
var allBrandmarketShareWidth;
var allBrandPimWidth;
var chartArray = [];
chartArray.push(chosenBrandValues[0]);
chartArray.push(chosenBrandValues[1]);
chartArray.push(CurrentShareValues[0]);
chartArray.push(projectedValues[0]);
chartArray.sort(function (a, b) { return b - a });
var scale = 110;
for (var i = 0; i...