{
landguzzlers.selectAll(".guzzlerrects")
.data(data)
.join("rect")
.attr("x", 0)
.attr("y", d => 800 - (600* Math.sqrt(+d['footprint'])))
.attr("width", d => 600 * Math.sqrt(+d['footprint']))
.attr("height", d => 600 * Math.sqrt(+d['footprint']))
.style("propertyname", d => d['title'])
.style("fill", (d,i) => ["#a5620b", "#c29657", "#cc1f5e", "#a71949", "#f7991d", "#231f20"][i])
.style("opacity", 1.0)
.style("stroke-width", 2)
.style("stroke", "white")
.attr("class", "guzzlerrects");
landguzzlers.selectAll(".guzzlertitles")
.data(data)
.join("text")
.text(d => d['title'])
.attr("x", d => {
if (d['title'] != 'HAMSTER') {
return -5 +(600* Math.sqrt(+d['footprint']))
}
else {
return 110 + (600* Math.sqrt(+d['footprint']))
}
})
.attr("y", d => 820 - (600* Math.sqrt(+d['footprint'])))
.style("text-anchor", "end")
.style("font-size", 22)
.style("fill", "white")
.attr("class", "guzzlertitles");
landguzzlers.selectAll(".guzzlersubtitles")
.data(data)
.join("text")
.text(d=> d['subtitle'])
.attr("x", d => -15 + (600* Math.sqrt(+d['footprint'])))
.attr("y", d => 835 - (600* Math.sqrt(+d['footprint'])))
.style("text-anchor", "end")
.style("font-size", 12)
.style("fill", "white")
.attr("class", "guzzlersubtitles");
landguzzlers.selectAll(".guzzlersubtitles2")
.data(data)
.join("text")
.text(d=> d['subtitle2'])
.attr("x", d => -15 + (600* Math.sqrt(+d['footprint'])))
.attr("y", d => 850 - (600* Math.sqrt(+d['footprint'])))
.style("text-anchor", "end")
.style("font-size", 12)
.style("fill", "white")
.attr("class", "guzzlersubtitles2");
landguzzlers.selectAll(".guzzlersubtitles3")
.data(data)
.join("text")
.text(d=> d['subtitle3'])
.attr("x", d => -15 + (600* Math.sqrt(+d['footprint'])))
.attr("y", d => 865 - (600* Math.sqrt(+d['footprint'])))
.style("text-anchor", "end")
.style("font-size", 12)
.style("fill", "white")
.attr("class", "guzzlersubtitles3");
landguzzlers.selectAll(".guzzlerfootprint")
.data(data)
.join("text")
.text(d=> "Eco-footprint: " + d['footprint'] + " hectares")
.attr("x", d => {
if (d['title'] != 'HAMSTER') {
return -12 + (600* Math.sqrt(+d['footprint']))
}
else {
return 3 +(600* Math.sqrt(+d['footprint']))
}
})
.attr("y", d => 830 - (600* Math.sqrt(+d['footprint'])))
.style("text-anchor", "start")
.style("font-size", 12)
.style("fill", "white")
.attr("transform", d => {
if (d['title'] != 'HAMSTER') {
return "rotate(90 " + (-12 + (600* Math.sqrt(+d['footprint']))) + "," + (830 - (600* Math.sqrt(+d['footprint']))) + ")"
}
else {
return "rotate(0 " + (-12 + (600* Math.sqrt(+d['footprint']))) + "," + (830 - (600* Math.sqrt(+d['footprint']))) + ")"
}
})
.attr("class", "guzzlerfootprint");
landguzzlers.selectAll(".guzzlerlines")
.data(data)
.join("line")
.attr("x1", d => {
if (d["title"] == "TOYOTA LAND CRUISER" || d["title"] == "MEDIUM-SIZED DOG") {
return 0.5* (600* Math.sqrt(+d['footprint']))
}
else {
return 1000
}
})
.attr("x2", d => {
if (d["title"] == "TOYOTA LAND CRUISER" || d["title"] == "MEDIUM-SIZED DOG") {
return (600* Math.sqrt(+d['footprint']))
}
else {
return 1000
}
})
.attr("y1", d => {
if (d["title"] == "TOYOTA LAND CRUISER" || d["title"] == "MEDIUM-SIZED DOG")
return 800 - (600* Math.sqrt(+d['footprint']))
else {
return 1000
}
})
.attr("y2", d => {
if (d["title"] == "TOYOTA LAND CRUISER" || d["title"] == "MEDIUM-SIZED DOG")
return 800 - (600* Math.sqrt(+d['footprint']))
else {
return 1000
}
})
.style("stroke", "white")
.style("stroke-width", 0.2)
.attr("class", "guzzlerlines");
}