chart = {
const width = 960,
height = 900;
const svg = d3.create("svg")
.attr("viewBox", [50, 50, width-100, height-100]);
var projection = d3
.geoMercator()
.fitSize([width - 50, height - 50], bbox2);
var path1 = d3.geoPath().projection(projection);
var path2 = d3.geoPath().projection(projection);
var path3 = d3.geoPath().projection(projection);
var path4 = d3.geoPath().projection(projection);
var g = svg.append("g").attr("id", "paths");
g.selectAll("path2")
.data(parks.features)
.enter()
.append("path")
.attr('class','outlines')
.attr("d", path2)
.style("fill", "rgb(0,0,0)")
.style('stroke-opacity','1')
.style("stroke-width", '.75')
.style("stroke", "rgb(0,0,0)")
g.selectAll("path3")
.data(bldgs.features)
.enter()
.append("path")
.attr('class','outlines')
.attr("d", path3)
.style("fill", "rgb(240,240,240)")
.style("fill-opacity", ".5")
.style('stroke-opacity','.4')
.style("stroke-width", '.5')
.style("stroke", "rgb(0,0,0)")
var p = svg.selectAll("polyline") //d3 geopath
.data(blobs)
.enter() //there are more data than elements, this selects them
.append("polyline") //appends path to data
.attr("points", function(d) {return d})
.style("stroke","black")
.style("stroke-width","2px")
.style("fill","none")
var t = svg.selectAll("text") //d3 geopath
.data(subSts.features)
.enter() //there are more data than elements, this selects them
.append("text") //appends path to data
.attr("x", function(d) {return path1.centroid(d)[0]})
.attr("y", function(d) {return path1.centroid(d)[1]-4})
.style("font-family","helvetica")
.style("fill","black")
.style("font-weight","600")
.style("font-size","6px")
.style("text-anchor","middle")
.text(function(d) {return d.properties.name})
var c = svg.selectAll("circle") //d3 geopath
.data(subSts.features)
.enter() //there are more data than elements, this selects them
.append("circle") //appends path to data
.attr("cx", function(d) {return path1.centroid(d)[0]})
.attr("cy", function(d) {return path1.centroid(d)[1]})
.attr('r',1.5)
.attr('fill','red')
.style('fill-opacity','1')
.style("stroke", "rgb(0,0,0)")
.style("stroke-width", '1')
c.enter().append("circle")//after the first use of a circle, use this method to add more
.data(donutData)
.enter() //there are more data than elements, this selects them
.append("circle") //appends path to data
.attr("cx", function(d) {return projection([d.long,d.lat])[0]})
.attr("cy", function(d) {return projection([d.long,d.lat])[1]})
.attr('r',"3")
.style('fill','tan')
.style('fill-opacity','1')
.style("stroke", "rgb(0,0,0)")
.style("stroke-width", '1')
.on("mouseover",doughHover)
.on("mouseout",doughRemove)
function doughHover(i,d){
console.log(d.name)
svg.append("text")
.attr("class","dText")
.attr("x","140")
.attr("y","200")
.style("font-family","helvetica")
.style("font-weight","800")
.style("font-size","8px")
.style("text-anchor","end")
.text(d.name)
svg.append("text")
.attr("class","dText")
.attr("x","140")
.attr("y","210")
.style("font-family","helvetica")
.style("font-weight","200")
.style("font-size","7px")
.style("text-anchor","end")
.text(d.description)
var wrap = svg.selectAll("text.dText")
.each(function(d, i) { wrap_text(d3.select(this), 100) });
svg.append("line")
.attr("x1","143")
.attr("y1","197")
.attr("x2",projection([d.long,d.lat])[0])
.attr("y2",projection([d.long,d.lat])[1])
.attr("class","dLine")
.style("stroke","black")
.style("stroke-width","2px")
p.enter().append("polyline") //d3 geopath
.data(seamonster)
.enter() //there are more data than elements, this selects them
.append("polyline") //appends path to data
.attr("class","seamonster")
.attr("points", function(d) {return d})
.style("stroke","black")
.style("stroke-width","2px")
.style("fill","none")
}
function doughRemove(){
svg.selectAll("text.dText").remove()
svg.selectAll("polyline.seamonster").remove()
svg.selectAll("line.dLine").remove()
}
return svg.node();
}