chart = {
const width = 960,
height = 900;
const svg = d3.create("svg")
.attr("viewBox", [100, 10, width-150, height-150]);
var projection = d3
.geoMercator()
.fitSize([width - 100, height - 100], bbox);
var path1 = d3.geoPath().projection(projection);
var path2 = d3.geoPath().projection(projection);
var path3 = d3.geoPath().projection(projection);
var g = svg.append("g").attr("id", "paths");
g.selectAll("path2")
.data(lpstreetsdef.features)
.enter()
.append("path")
.attr('class','outlines')
.attr("d", path2)
.style("fill", "none")
.style('stroke-opacity','1')
.style("stroke-width", '1')
.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 c = svg.selectAll("circle")
.data(Spots)
.enter()
.append("circle")
.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)
.attr('fill',colorType)
.attr('fill','green ')
.style('fill-opacity','1')
.style('stroke','black')
.style('stroke-width','.5')
.on('mouseover', spotText)
.on('mouseout', removespotText)
function colorType(d,i){
var color='black'
if(d.type=='Food'){color = 'yellow'}
if(d.type=='Fun'){color = 'Green'}
return color
}
function spotText(event,d){
d3.select(this).attr('fill' , 'yellow')
svg.append('text')
.attr('class','spots')
.attr('x','600')
.attr('y','430')
.attr('font-family','Helvetica')
.attr('font-size','.5cm')
.attr('text-anchor','start')
.attr('font-weight','bold')
.text (d.Name)
svg.append('text')
.attr('class','spots')
.attr('x','600')
.attr('y','460')
.attr('font-family','Helvetica')
.attr('font-size','.3cm')
.attr('text-anchor','start')
.attr('font-weight','normal')
.text (d.description)
svg.append('line')
.attr('class','spotLine')
.attr('x1','600')
.attr('y1','430')
.attr('x2',projection([d.long,d.lat])[0])
.attr('y2','430')
.style('stroke-width','1')
.style('stroke','black')
.style('stroke-dasharray','4 2')
svg.append('line')
.attr('class','spotLine')
.attr('x1',projection([d.long,d.lat])[0])
.attr('y1','430')
.attr('x2',projection([d.long,d.lat])[0])
.attr('y2',projection([d.long,d.lat])[1])
.style('stroke-width','1')
.style('stroke','black')
.style('stroke-dasharray','4 2')
}
function removespotText(event,d)
{d3.select(this).attr('fill','green')
d3.selectAll('text.spots').remove()
d3.selectAll('line.spotLine').remove()
}
return svg.node();
}