chart = {
const width = 2660,
height = 1660;
const svg = d3.create("svg")
.attr("viewBox", [400, 615, width-2000, height-945]);
var projection = d3
.geoMercator()
.fitSize([width - 50, height - 50], bbox);
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("path3")
.data(bldgs.features)
.enter()
.append("path")
.attr('class','outlines')
.attr("d", path3)
.style("fill", "rgb(240,240,240)")
.style("fill-opacity", "1")
.style('stroke-opacity','.1')
.style("stroke-width", '.5')
.style("stroke", "black")
g.selectAll("path3")
.data(traffic.features)
.enter()
.append("path")
.attr('class','outlines')
.attr("d", path2)
.style("fill", "none")
.style('stroke-opacity','1')
.style("stroke-width", '1')
.style("stroke", "blue")
g.selectAll("path2")
.data(streets.features)
.enter()
.append("path")
.attr('class','outlines')
.attr("d", path2)
.style("fill", "none")
.style('stroke-opacity','1')
.style("stroke-width", '0.3')
.style("stroke", "red")
var c = svg.selectAll("circle")
.data(mypoints.features)
.enter()
.append("circle")
.attr("cx", function(d) {return path1.centroid(d)[0]})
.attr("cy", function(d) {return path1.centroid(d)[1]})
.attr('r',2)
.style('fill','cyan')
.style('fill-opacity','1')
.on('mouseover',fireText)
.on('mouseout',removefireText)
// var c = svg.selectAll("circle") //d3 geopath
//.data(steak)
//.enter() //there are more data than elements, this selects them
//.append("circle") //appends path to data
//.attr('class','steakPts')
//.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','black')
//.style('fill-opacity','1')
//svg
// .append('line')
//.attr('class','steakLine')
// .attr('x1','125')
// .attr('y1','725')
// .attr('x2','400')
// .attr('y2','725')
// .style('stroke','black')
// .style('stroke-width','1')
// .style('stroke-dasharray', '4,4,8,8')
var p = svg.selectAll("polyline")
.data(barn_test)
.enter()
.append("polyline")
.attr('points',function(d){return d})
.attr('transform','translate(200,300)')
.style('fill','white')
.style('stroke','black')
.style('stroke-width','.5')
//.style('stroke-dasharray', '4,4,8,8')
p.enter().append("polyline")
.data(icon_list)
.enter()
.append("polyline")
.attr('class','icon')
.attr('points',function(d){return d.pts})
.attr('transform',function(d){return 'translate('+projection([d.data.Long,d.data.Lat])[0]+','+projection([d.data.Long,d.data.Lat])[1]+')'})
.style('fill',fillColor)
.style('stroke','black')
.style('stroke-width','.5')
.on('mouseover',steakInfo)//listens for a mousover, and calls function
.on('mouseout',steakInfoOut)
function fillColor(d,i){
var color = 'rgb(0,0,0)'
if(d.data.Rating==5){color = 'rgb(255,255,0)'
console.log("match")}
if(d.data.Rating==4){color = 'rgb(215,215,0)'}
if(d.data.Rating==3){color = 'rgb(175,175,0)'}
if(d.data.Rating==2){color = 'rgb(135,135,0)'}
if(d.data.Rating==1){color = 'rgb(95,95,0)'}
return color
}
function steakInfo(event,d){
d3.select(this).style('fill','red')
svg
.append('text')
.attr('class','steakText')
.attr('x','150')
.attr('y','700')
.style("font-family", "Helvetica")
.style('font-size','.75em')
.style('fill','rgb(0,200,0)')
.style('text-anchor','start')
.text(d.data.Name)
svg
.append('line')
.attr('class','steakLine')
.attr('x1','125')
.attr('y1','725')
.attr('x2','400')
.attr('y2','725')
.style('stroke','black')
.style('stroke-width','1')
var ratingList = []
if(d.data.Rating==2){ratingList = [exclamation,exclamation]}
if(d.data.Rating==3){ratingList = [exclamation,exclamation,exclamation]}
if(d.data.Rating==4){ratingList = [exclamation,exclamation,exclamation,exclamation]}
if(d.data.Rating==5){ratingList = [exclamation,exclamation,exclamation,exclamation,exclamation]}
p.enter().append("polyline")
.data(ratingList)
.enter()
.append("polyline")
.attr('class','icon_rating')
.attr('points',function(d){return d})
.attr('transform',function(d,i){return 'translate('+(150+(i*35))+',200)'})
.style('fill','black')
.style('stroke','none')
//.style('stroke-width','.5')
}
function steakInfoOut(event,d){
d3.selectAll('polyline.icon').style('fill',fillColor)
d3.selectAll('text.steakText').remove()
d3.selectAll('line.steakLine').remove()
d3.selectAll('polyline.icon_rating').remove()
}
/////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////
function fireText(event,d){
console.log(d)
svg
.append("text")
.attr('x','425')
.attr('y','750')
.attr('class','mypoints_position')
.style('font-family','helvetica')
.style('font-size','20px')
.style('font-weight','light')
.text(d.properties.description)
var wrap = svg.selectAll("text.mypoints_position")
.each(function(d, i) { wrap_text(d3.select(this), 100) });
svg
.append("line")
.attr('x1','510')
.attr('y1','790')
.attr('x2', path1.centroid(d)[0])
.attr('y2', path1.centroid(d)[1])
.attr('class','fireLine')
.style("stroke-width", '3')
.style("stroke", "rgb(0,0,0)")
.style('stroke-dasharray', '6 4')
}
function removefireText(){
d3.selectAll('text.mypoints_position').remove()
d3.selectAll('line.fireLine').remove()
}
c.enter().append("circle")
.data(fire)
.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',1)
.style('stroke','black')
.style('stroke-width','1')
.style('fill','cyan')
.style('fill-opacity','1')
var t = svg.selectAll("text")
.data(mypoints.features)
.enter()
.append("text")
.attr("x", function(d) {return path1.centroid(d)[0]})
.attr("y", function(d) {return path1.centroid(d)[1]-10})
.style('font-family','helvetica')
.style('font-size','5px')
.style('text-anchor','middle')
.style('font-weight','bold')
.text(function(d) {return d.properties.name})
var z = svg.selectAll("text")
.data(fire.features)
.enter()
.append("text")
.attr("x", function(d) {return path4.centroid(d)[0]})
.attr("y", function(d) {return path4.centroid(d)[1]-7})
.style('font-family','helvetica')
.style('font-size','3px')
.style('text-anchor','middle')
.style('font-weight','bold')
.text(function(d) {return d.properties.name})
svg
.append("text")
.attr('x','420')
.attr('y','660')
.style('font-family','helvetica')
.style('font-size','35px')
.style('font-weight','bold')
.text('New Orleans')
svg
.append("text")
.attr('x','420')
.attr('y','720')
.style('font-family','helvetica')
.style('font-size','15px')
.style('font-weight','bold')
.text('Place to Visit:')
svg
.append("line")
.attr('x1','420')
.attr('y1','680')
.attr('x2','650')
.attr('y2','680')
.style("stroke-width", '5')
.style("stroke", "rgb(0,0,0)")
return svg.node();
}