{
landguzzlers.selectAll(".guzzlerrects")
.data(data)
.join("rect")
.attr("x", 0)
.attr("y", d => 1000-Math.sqrt(Number(d["footprint"]))*(1000/Math.sqrt(1.1)))
.attr("width", d => Math.sqrt(Number(d["footprint"]))*(1000/Math.sqrt(1.1)))
.attr("height", d => Math.sqrt(Number(d["footprint"]))*(1000/Math.sqrt(1.1)))
.style("stroke", "white")
.style("stroke-width", 2)
.style("propertyname", d => d["title"])
.style("fill", (d,i) => colors[i])
.attr("class", "guzzlerrects");
landguzzlers.selectAll(".guzzlertitles")
.data(data)
.join("text")
.text(d => d["title"])
.attr("x", d => Math.sqrt(Number(d["footprint"]))*(1000/Math.sqrt(1.1)) - 5)
.attr("y", d => 1000-Math.sqrt(Number(d["footprint"]))*(1000/Math.sqrt(1.1)) + 30)
.style("text-anchor", d => {if (d.title != "HAMSTER") {return "end"}})
.style("fill","white")
.style("font-size", 35)
.style("font-family", "Ubuntu")
.attr("class", "guzzlertitles");
landguzzlers.selectAll(".guzzlersubtitle1")
.data(data)
.join("text")
.text(d => d["subtitle"])
.attr("x", d => Math.sqrt(Number(d["footprint"]))*(1000/Math.sqrt(1.1)) - 25 )
.attr("y", d => 1000-Math.sqrt(Number(d["footprint"]))*(1000/Math.sqrt(1.1)) + 60)
.style("text-anchor", "end")
.style("fill", "white")
.style("font-size", 18)
.style("font-family", "Ubuntu")
.attr("class", "guzzlersubtitle1");
landguzzlers.selectAll(".guzzlersubtitle2")
.data(data)
.join("text")
.text(d => d["subtitle2"])
.attr("x", d => Math.sqrt(Number(d["footprint"]))*(1000/Math.sqrt(1.1)) - 25 )
.attr("y", d => 1000-Math.sqrt(Number(d["footprint"]))*(1000/Math.sqrt(1.1)) + 80)
.style("text-anchor", "end")
.style("fill", "white")
.style("font-size", 18)
.style("font-family", "Ubuntu")
.attr("class", "guzzlersubtitle2");
landguzzlers.selectAll(".guzzlersubtitle3")
.data(data)
.join("text")
.text(d => d["subtitle3"])
.attr("x", d => Math.sqrt(Number(d["footprint"]))*(1000/Math.sqrt(1.1)) - 25 )
.attr("y", d => 1000-Math.sqrt(Number(d["footprint"]))*(1000/Math.sqrt(1.1)) + 100)
.style("text-anchor", "end")
.style("fill", "white")
.style("font-size", 18)
.style("font-family", "Ubuntu")
.attr("class", "guzzlersubtitle3");
landguzzlers.selectAll(".guzzlerrotatetext")
.data(data)
.join("text")
.text(function(d) {
if (d["title"] === "HAMSTER") {
return `Eco-footprint:
${d["footprint"]} hectares`;
} else {
return "Eco-footprint: " + d["footprint"] + " hectares";
}
})
.attr("transform", function(d) {
if (d["title"] == "HAMSTER") {
return null
} else {
return "translate(" + (Math.sqrt(Number(d['footprint']))*(1000/Math.sqrt(1.1)) - 18) + "," + (1000-Math.sqrt(Number(d['footprint']))*(1000/Math.sqrt(1.1)) + 40) + ") rotate(90)";
}
})
.attr("x", function(d) {
if (d["title"] === "HAMSTER") {
return (Math.sqrt(Number(d["footprint"]))*(1000/Math.sqrt(1.1)) )
} else {
return null;
}
})
.attr("y", function(d) {
if (d["title"] === "HAMSTER") {
return (1000-Math.sqrt(Number(d["footprint"]))*(1000/Math.sqrt(1.1))+60)
} else {
return null;
} })
.style("fill", "white")
.style("font-size", 18)
.style("font-family", "Arial")
.attr("class", "guzzlerrotatetext");
}