chart = {
const width = 1250,
height = 1250;
const svg = d3.create("svg")
.attr("viewBox", [0, 0, width, height]);
var g = svg.append("g").attr("id", "paths");
var p = svg.selectAll("polyline")
.data(outlines)
.enter()
.append("polyline")
.attr("points", function(d) {return d.pts})
.style("stroke","black")
.style("stroke-width","3px")
.style("fill","rgb(255,0,0)")
.on("mouseover",polyHover)
.on("mouseout",polyHoverOut)
function polyHover(event,d){
if (d.E_M2 === 0) {
d3.select(this).style("fill","blue");
} else {
d3.select(this).style("fill","yellow")
}
svg
.append("text")
.attr("x","100")
.attr("y","100")
.attr("class","hoverText")
.text("Square Feet " + d.sf)
svg
.append("text")
.attr("x","100")
.attr("y","115")
.attr("class","hoverText")
.text("Meters Squared M2 " + d.M2)
svg
.append("text")
.attr("x","100")
.attr("y","130")
.attr("class","hoverText")
.text("Energy per M2 " + d.E_M2)
svg
.append("text")
.attr("x","100")
.attr("y","145")
.attr("class","hoverText")
.text()
svg
.append("text")
.attr("x","50")
.attr("y","50")
.attr("class","hoverText")
.text('Energy per M2 times Meters: '+(d.E_M2) * Pop)
svg
.append("text")
.attr("x","50")
.attr("y","75")
.attr("class","hoverText")
.text('Addess: ' + d.id)
}
function polyHoverOut(){
d3.select(this).style("fill","red")
svg.selectAll("text.hoverText").remove()
}
return svg.node();
}