Affective Memory Potential Series

Ashish Prasad

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;overflow:auto;"></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 => {

var chosenBrandValues = [input.chosenBrand.marketShare, input.chosenBrand.powerInTheMind, input.chosenBrand.equityGap];
var categories = input.dataSeries.map(function (item) {
    if(item.marketFactorGain > 0 && item.marketFactorGLoss > 0)
    return item.brandName;
    else if (item.marketFactorGain > 0)
    return item.brandName;
    else if(item.marketFactorGLoss > 0)
    return item.brandName
    else return 0;
});

categories = categories.filter(e => e !== 0);
var marketShareWidth;
var pimWidth;

var chartArray = [];
chartArray.push(chosenBrandValues[0]);
chartArray.push(chosenBrandValues[1]);
chartArray.sort(function(a, b) {
  return b - a
});

var scale = 105;

for (var i = 0; i < chartArray.length; i++) {
  if (chartArray[i] === chosenBrandValues[0]) {
    if (i === 0) {
      marketShareWidth = scale;
    } else {
      marketShareWidth = (chartArray[i] / chartArray[0]) * scale * scale;
      marketShareWidth = Math.sqrt(marketShareWidth);
    }
  } else if (chartArray[i] === chosenBrandValues[1]) {
    if (i === 0) {
      pimWidth = scale;
    } else {
      pimWidth = (chartArray[i] / chartArray[0]) * scale * scale;
      pimWidth = Math.sqrt(pimWidth);
    }

  }
}

//Calculating relative values
var barMaxHeight;
var chosenBData = input.dataSeries.map(function (item) {
      return item.marketFactorGain > 0  ? item.marketFactorGain :0;
});
var compBData = input.dataSeries.map(function (item) {
       return item.marketFactorGLoss > 0 ? item.marketFactorGLoss :0;
});

var chosenBrandData = input.dataSeries.map(function (item) {
       return item.marketFactorGLoss >0 ? item.marketFactorGLoss :0;
});
var compBrandData = input.dataSeries.map(function (item) {
        return item.marketFactorGain >0 ? item.marketFactorGain : 0;
});


var itemRemoveList=[]

for(var i=0;i<input.dataSeries.length;i++)
{
    if(input.dataSeries[i].marketFactorGLoss <= 0 && input.dataSeries[i].marketFactorGain <= 0 )
    {
       itemRemoveList.push(i);
   ...