livingLegend = {
let hero_num = 12;
let count = 0;
let heroLoc = d3.scaleOrdinal()
.domain([0,1,2,3,4,5,6,7,8,9,10,11, 12, 13, 14])
.range([0, 50,100,150,200,250,300,350,400, 450, 500,550, 600, 650, 700].map(x => x + 80));
let legendLoc = d3.scaleLinear()
.domain([0, 1100])
.range([0, 800]);
let svg = d3.create('svg').style("background-color", 'white').attr("preserveAspectRatio", "none").style("background-color", 'white').attr("viewBox", "0 0 960 830");
var text2 = svg.append("svg:text").attr("class", "title")
.attr("xlink:href", "greblytics.com")
.attr("text-anchor", "middle")
.attr("y", 60)
.attr("x", 963/2)
.attr('style', "font-size: 45px; font-family: 'Bebas Neue';");
;
text2.append("svg:tspan").style("fill", "black").text("Flesh and Blood Living Legend Points");
svg.append("text")
.attr("class", "signature")
.attr("text-anchor", "left")
.attr("y", 2)
.attr("x", 0)
.attr("dy", ".75em")
.attr('style', "font-size: 20px; font-family: 'Bebas Neue';")
.text("Author: Sam Rosenberg").call(addWebFont, 'Bebas Neue', 'https://fonts.gstatic.com/s/bebasneue/v2/JTUSjIg69CK48gW7PXoo9WlhyyTh89Y.woff2').attr('style', d => "font-size: 20px; font-family: 'Bebas Neue';");
for (let i = 0; i < order.length; i++) {
let key = order[i]
console.log(key);
svg.append("rect")
.attr("x", 49)
.attr("y", heroLoc(count)-1)
.attr("width", 47)
.attr("height", 47)
.attr("fill", heroColors[key])
.attr("stroke", "black").attr("opacity", .6);
svg.append("rect")
.attr("x", 49+47)
.attr("y", heroLoc(count)-1)
.attr("width", 800)
.attr("height", 47)
.attr("fill", "white").attr("stroke", "black");
console.log(legendLoc(data.find(h => h.Hero === key)["official_points"]))
svg.append("rect")
.attr("x", 49+47)
.attr("y", heroLoc(count)-1)
.attr("width", legendLoc(calcPoints(data.find(h => h.Hero === key))))
.attr("height", 47)
.attr("fill", heroColors[key])
.attr("stroke", "black").attr("opacity", .3);
console.log(legendLoc(data.find(h => h.Hero === key)["official_points"]))
svg.append("rect")
.attr("x", 49+47)
.attr("y", heroLoc(count)-1)
.attr("width", legendLoc(data.find(h => h.Hero === key)["official_points"]))
.attr("height", 47)
.attr("fill", heroColors[key])
.attr("stroke", "black").attr("opacity", 1);
svg.append("line")
.attr("x1", 96+legendLoc(1000))
.attr("y1", 80)
.attr("x2", 96+legendLoc(1000)).attr("y2", 826)
.attr("stroke", 'black').attr("stroke-width", 1)
svg.append("line")
.attr("x1", 96+legendLoc(1000))
.attr("y1", 80)
.attr("x2", 96+legendLoc(1000)).attr("y2", 826)
.attr("stroke", '#ffda85').attr("stroke-width", 1)
svg.append("text")
.attr("x", 96+legendLoc(1050))
.attr("y", heroLoc(count)-1 + 29)
.text(calcPoints(data.find(h => h.Hero === key)))
.attr("text-anchor", "middle")
svg.append("image")
.attr("xlink:href", heroLinks[key])
.attr("id", "heroIcon")
.attr("x", 50)
.attr("y", heroLoc(count))
.attr("width", 45)
.attr("height", 45);
count++;
}
svg.append("rect")
.attr("x", 800)
.attr("y", 15)
.attr("width", 10)
.attr("height", 10)
.attr("fill", 'black')
.attr("stroke", "black").attr("opacity", .3);
svg.append("text")
.attr("x", 811)
.attr("y", 14)
.text("Official points")
.attr("text-anchor", "left")
.attr('style', "font-size: 12px; font-family: 'Bebas Neue';")
svg.append("rect")
.attr("x", 800)
.attr("y", 5)
.attr("width", 10)
.attr("height", 10)
.attr("fill", 'black')
.attr("stroke", "black").attr("opacity", 1);
svg.append("text")
.attr("x", 811)
.attr("y", 24)
.text("Expected Points not yet Official")
.attr("text-anchor", "left")
.attr('style', "font-size: 12px; font-family: 'Bebas Neue';")
return svg.node();
}