chart = {
const width = 500,
height = 500;
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","4px")
.style("fill","rgb(255,0,0)")
.on("mouseover",polyHover)
.on("mouseout",polyHoverout)
function polyHover(event,d) {
d3.select(this).style("fill", "purple")
svg
.append("text")
.attr("x", "100")
.attr("y","100")
.attr("class", "hoverText")
.text(d.Sq)
svg
.append("text")
.attr("x", "100")
.attr("y","20")
.attr("class", "hoverText")
.text(d.occ)
}
function polyHoverout() {
svg.selectAll("text.hoverText").remove()
d3.select(this).style("fill", "red")
}
return svg.node();
}