chart = {
const width = 960,
height = 900;
const svg = d3.create("svg")
.attr("viewBox", [-60, 0, width, height]);
var projection = d3
.geoMercator()
.fitSize([width - 60, height - 60], zips);
var path = 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("path")
.data(zips.features)
.enter()
.append("path")
.attr('class','outlines')
.attr("d", path)
.style("fill", "white")
.style('fill-opacity','.25')
.style("stroke-width", "1")
.style("stroke", "black")
var g = svg.append("g").attr("id", "paths");
g.selectAll("path")
//svg
//.selectAll('path')
.data(district2.features) //get data to define path
.enter() //there are more data than elements, this selects them
.append("path") //appends path to data
.attr('class','outlines')
.attr("d", path) //The d attribute defines a path to be drawn, only applies to appended elements
.attr("fill", d => color(d.properties.pop_dense))
.style('fill-opacity','0.6')
.style("stroke-width", "1")
.style("stroke", "black")
.on('mouseover', addBox2)
.on('mouseout', removeBox2)
var tooltip = svg.append("g");
//add district names tool tip
var tooltip = svg.append("g");
function addBox2(event, d) {
var centroid = path.centroid(d);
tooltip.call(
callout,
`${d.properties.dname_e}
${d.properties.num_pop}`
);
tooltip.attr("transform", "translate(" + centroid + ")");
}
function removeBox2(event, d) {
tooltip.call(callout,null)
}
g.selectAll("path3") //d3 geopath
//svg
//.selectAll('path')
.data(river5.features) //get data to define path
.enter() //there are more data than elements, this selects them
.append("path") //appends path to data
.attr('class','outlines')
.attr("d", path) //The d attribute defines a path to be drawn, only applies to appended elements
.style("fill", "rgb(0, 0, 212)")
.style('fill-opacity','.7')
.style("stroke-width", "1")
.style("stroke", "black")
//insert markets into map
g.selectAll("circle2") //d3 geopath
//svg
//.selectAll('path')
.data(market.features) //get data to define path
.enter() //there are more data than elements, this selects them
.append("circle") //appends path to data
.attr('cx',function(d) {return path.centroid(d)[0]})
.attr("cy", function(d) {return path.centroid(d)[1]})
.attr('r',3)
.attr("fill", "rgb(121, 55, 212)")
.style('fill-opacity','0.7')
//insert community housing into map
g.selectAll("circle3") //d3 geopath
//svg
//.selectAll('path')
.data(housing.features) //get data to define path
.enter() //there are more data than elements, this selects them
.append("circle") //appends path to data
.attr('cx',function(d) {return path.centroid(d)[0]})
.attr("cy", function(d) {return path.centroid(d)[1]})
.attr('r',1)
.attr("fill", "black")
.style('fill-opacity','1')
return svg.node();
}