{
const basepointX = 0;
const basepointY = 1000;
const colors = ["#a5620b", "#c29657", "#cc1f5e", "#a71949", "#f7991d", "#231f20"]
landguzzlers.selectAll(".guzzlerrects")
.data(data)
.join("rect")
.attr("x", basepointX)
.attr("y", d => basepointY - (Math.sqrt(d["footprint"]) * 875))
.attr("width", d => Math.sqrt(d["footprint"]) * 875)
.attr("height", d => Math.sqrt(d["footprint"]) * 875)
.style("fill", (d,i) => colors[i])
.attr("class", "guzzlerrects");
landguzzlers.selectAll(".guzzlertitles")
.data(data)
.join("text")
.attr("x", function(d) {
if (d["title"] == "HAMSTER") { return (Math.sqrt(d["footprint"]) * 875) + 5 }
else { return (Math.sqrt(d["footprint"]) * 875) - 5 }
;})
.attr("y", d => basepointY - (Math.sqrt(d["footprint"]) * 875) + 26)
.text(d => d["title"])
.attr("text-anchor", function(d) {
if (d["title"] == "HAMSTER") { return "start" }
else { return "end" }
;})
.attr("class", "guzzlertitles");
landguzzlers.selectAll(".guzzlersubtitle1")
.data(data)
.join("text")
.attr("x", d => (Math.sqrt(d["footprint"]) * 875) - 35)
.attr("y", d => basepointY - (Math.sqrt(d["footprint"]) * 875) + 50)
.text(d => d["subtitle"])
// ...
.attr("text-anchor", "end")
.attr("class", "guzzlersubtitle1");
landguzzlers.selectAll(".guzzlersubtitle2")
.data(data)
.join("text")
.attr("x", d => (Math.sqrt(d["footprint"]) * 875) - 35)
.attr("y", d => basepointY - (Math.sqrt(d["footprint"]) * 875) + 70)
.text(d => d["subtitle2"])
// ...
.attr("text-anchor", "end")
.attr("class", "guzzlersubtitle2");
landguzzlers.selectAll(".guzzlersubtitle3")
.data(data)
.join("text")
.attr("x", d => (Math.sqrt(d["footprint"]) * 875) - 35)
.attr("y", d => basepointY - (Math.sqrt(d["footprint"]) * 875) + 90)
.text(d => d["subtitle3"])
// ...
.attr("text-anchor", "end")
.attr("class", "guzzlersubtitle3");
landguzzlers.selectAll(".guzzlerfootprint")
.data(data)
.join("text")
.attr("x", function(d) {
if (d["title"] == "HAMSTER") { return (Math.sqrt(d["footprint"]) * 875) + 5 }
else { return (Math.sqrt(d["footprint"]) * 875) - 20 }
;})
.attr("y", function(d) {
if (d["title"] == "HAMSTER") { return basepointY - (Math.sqrt(d["footprint"]) * 875) + 47 }
else { return basepointY - (Math.sqrt(d["footprint"]) * 875) + 33 }
;})
.text(function(d) {
if (d["title"] == "HAMSTER") { return "Eco-footprint: \n" }
else { return "Eco-footprint: " + d["footprint"] + " hectares" }
;})
.attr("transform", function(d) {
if (d["title"] == "HAMSTER") { return }
else { return "rotate(90 " + ((Math.sqrt(d["footprint"]) * 875) - 20) + "," + (basepointY - (Math.sqrt(d["footprint"]) * 875) + 33) + ")" }
;})
.attr("class", "guzzlerfootprint");
landguzzlers.selectAll(".guzzlerfootprintHAMSTER")
.data(data)
.join("text")
.attr("x", function(d) {
if (d["title"] == "HAMSTER") { return (Math.sqrt(d["footprint"]) * 875) + 5 }
else { return }
;})
.attr("y", function(d) {
if (d["title"] == "HAMSTER") { return basepointY - (Math.sqrt(d["footprint"]) * 875) + 70 }
else { return }
;})
.text(function(d) {
if (d["title"] == "HAMSTER") { return d["footprint"] + " hectares" }
else { return }
;})
.attr("class", "guzzlerfootprintHAMSTER");
landguzzlers.append('line')
.attr("x1", "510")
.attr("x2", "773")
.attr("y1", "230")
.attr("y2", "230")
.style("");
landguzzlers.append('line')
.attr("x1", "773")
.attr("x2", "773")
.attr("y1", "230")
.attr("y2", "295");
landguzzlers.append('line')
.attr("x1", "240")
.attr("x2", "531")
.attr("y1", "471")
.attr("y2", "471");
landguzzlers.append('line')
.attr("x1", "531")
.attr("x2", "531")
.attr("y1", "471")
.attr("y2", "518");
}