chart = {
const width = 600,
height = 725;
const svg = d3.create("svg")
.attr("viewBox", [-20, 10, width, height]);
var projection = d3
.geoMercator()
.fitSize([width - 50, height - 5], inglewood);
var path = d3.geoPath().projection(projection);
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 c = svg.selectAll("circle");
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", "rgb(225,225,225)")
.style('fill-opacity','.75')
.style("stroke-width", "0")
.style("stroke", "#ccc")
g.selectAll("path3")
.data(Pacific.features)
.enter()
.append("path")
.attr('class','outlines')
.attr("d", path)
.style("fill", "rgb(135,206,250)")
.style('fill-opacity','0.9')
.style("stroke-width", "1.5")
.style("stroke", "rgb(135,206,250)")
.style('stroke-opacity','0.9')
g.selectAll("path3")
.data(parks3.features)
.enter()
.append("path")
.attr('class','outlines')
.attr("d", path)
.style("fill", "green")
.style('fill-opacity','0.15')
.style("stroke-width", "0.2")
.style("stroke", "black")
g.selectAll("path3")
.data(Cemetary.features)
.enter()
.append("path")
.attr('class','outlines')
.attr("d", path)
.style("fill", "green")
.style('fill-opacity','0.15')
.style("stroke-width", "0.2")
.style("stroke", "black")
g.selectAll("path3")
.data(LAHighways.features)
.enter()
.append("path")
.attr('class','outlines')
.attr("d", path)
.style('fill-opacity','0')
.style("stroke-width", "2")
.style("stroke", "rgb(225,165,0)")
.style('stroke-opacity','0.5')
g.selectAll("path3")
.data(LAMainRoads.features)
.enter()
.append("path")
.attr('class','outlines')
.attr("d", path)
.style('fill-opacity','0')
.style("stroke-width", "1")
.style("stroke", "white")
.style('stroke-opacity','0.9')
g.selectAll("path3")
.data(streets.features)
.enter()
.append("path")
.attr('class','outlines')
.attr("d", path)
.style('fill-opacity','0')
.style("stroke-width", "0.5")
.style("stroke", "white")
.style('stroke-opacity','0.9')
g.selectAll("path3")
.data(rivers.features)
.enter()
.append("path")
.attr('class','outlines')
.attr("d", path)
.style('fill-opacity','0')
.style("stroke-width", "3")
.style("stroke", "rgb(135,206,250)")
.style('stroke-opacity','0.9')
g.selectAll("path3")
.data(Buildings.features)
.enter()
.append("path")
.attr('class','outlines')
.attr("d", path)
.style("fill", "rgb(200,200,200)")
.style('fill-opacity','0.75')
.style("stroke-width", "0.15")
.style("stroke", "black")
var t = svg.selectAll("text")
.data(stations.features)
.enter()
.append("text")
.attr("x", function(d) {return path1.centroid(d)[0]})
.attr("y", function(d) {return path1.centroid(d)[1]-5})
.attr('font-family','helvetica')
.attr('font-size','.45em')
.attr('font-weight','550')
.style("fill", "rgb(50,50,50)")
.attr('text-anchor','left')
.text(function(d) {return d.properties.Name})
g.selectAll("path3")
.data(NewLine.features)
.enter()
.append("path")
.attr('class','outlines')
.attr("d", path)
.style('fill-opacity','0')
.style("stroke-width", ".75")
.style("stroke", "rgb(255,20,147)")
.style('stroke-opacity','0.75')
.attr('stroke-dasharray', 3.5)
g.selectAll("path3")
.data(MetroC.features)
.enter()
.append("path")
.attr('class','outlines')
.attr("d", path)
.style('fill-opacity','0')
.style("stroke-width", ".5")
.style("stroke", "rgb(50,205,50)")
.style('stroke-opacity','0.75')
var c = svg.selectAll('circle')
c.enter().append('circle')
.data(stations.features)
.enter()
.append("circle")
.attr('cx',function(d) {return path.centroid(d)[0]})
.attr("cy", function(d) {return path.centroid(d)[1]})
.attr('r',2.5)
.attr("fill", "rgb(128,128,128)")
.style('fill-opacity','1')
c.enter().append('circle')
.data(olympics.features)
.enter()
.append("circle")
.attr('cx',function(d) {return path.centroid(d)[0]})
.attr("cy", function(d) {return path.centroid(d)[1]})
.attr('r',3)
.attr("fill", "rgb(148,0,211)")
.style('fill-opacity','1')
.style("stroke-width", ".5")
.style("stroke", "rgb(0,0,0)")
.on('mouseover', addOlympic)
.on('mouseout', removeOlympic)
var tooltip = svg.append("g");
function addOlympic(event, d) {
var centroid = path.centroid(d);
tooltip.call(
callout,
`2028 Summer Olympics
Location: ${d.properties.name}
Events: ${d.properties.description} `
);
tooltip.attr("transform", "translate(" + centroid + ")");
}
function removeOlympic(event, d)
{tooltip.call(callout,null)
}
g.selectAll("path3")
.data(Arbor.features)
.enter()
.append("path")
.attr('class','outlines')
.attr("d", path)
.style('fill-opacity','.5')
.style('fill','white')
.style("stroke-width", ".5")
.style("stroke", "rgb(0,0,139)")
.style('stroke-opacity','0.75')
svg
.append("text")
.attr('class','title')
.attr('x','45')
.attr('y','300')
.attr('font-family','helvetica')
.attr('font-size','.35em')
.attr('font-weight','500')
.style("fill", "rgb(0,0,0)")
.text('Arbor Park Northwest')
g.selectAll("path3")
.data(DTIW.features)
.enter()
.append("path")
.attr('class','outlines')
.attr("d", path)
.style('fill-opacity','.5')
.style('fill','white')
.style("stroke-width", ".5")
.style("stroke", "rgb(0,0,255)")
.style('stroke-opacity','0.75')
svg
.append("text")
.attr('class','title')
.attr('x','155')
.attr('y','290')
.attr('font-family','helvetica')
.attr('font-size','.35em')
.attr('font-weight','500')
.style("fill", "rgb(0,0,0)")
.text('Downtown')
svg
.append("text")
.attr('class','title')
.attr('x','155')
.attr('y','295')
.attr('font-family','helvetica')
.attr('font-size','.35em')
.attr('font-weight','500')
.style("fill", "rgb(0,0,0)")
.text('Inglewood West')
g.selectAll("path3")
.data(EHardy.features)
.enter()
.append("path")
.attr('class','outlines')
.attr("d", path)
.style('fill-opacity','.5')
.style('fill','white')
.style("stroke-width", ".5")
.style("stroke", "rgb(65,105,225)")
.style('stroke-opacity','0.75')
svg
.append("text")
.attr('class','title')
.attr('x','245')
.attr('y','400')
.attr('font-family','helvetica')
.attr('font-size','.35em')
.attr('font-weight','500')
.style("fill", "rgb(0,0,0)")
.text('E Hardy St/S Myrtle Ave')
g.selectAll("path3")
.data(PeopleMover.features)
.enter()
.append("path")
.attr('class','outlines')
.attr("d", path)
.style('fill-opacity','0')
.style("stroke-width", "1")
.style("stroke", "rgb(100,149,237)")
.style('stroke-opacity','1')
.attr('stroke-dasharray', '2,1')
svg
.append("text")
.attr('class','title')
.attr('x','325')
.attr('y','350')
.attr('font-family','helvetica')
.attr('font-size','.35em')
.attr('font-weight','550')
.style("fill", "rgb(0,0,0)")
.text('Proposed')
svg
.append("text")
.attr('class','title')
.attr('x','325')
.attr('y','356')
.attr('font-family','helvetica')
.attr('font-size','.35em')
.attr('font-weight','550')
.style("fill", "rgb(0,0,0)")
.text('People Mover')
svg
.append("line")
.attr('x1','316')
.attr('y1','348')
.attr('x2','323')
.attr('y2','348')
.attr('stroke-width','.65')
.attr('stroke','rgb(0,0,0)')
c.enter().append('circle')
.data(BusStops.features)
.enter()
.append("circle")
.attr('cx',function(d) {return path.centroid(d)[0]})
.attr("cy", function(d) {return path.centroid(d)[1]})
.attr('r',1.5)
.attr("fill", "rgb(255,255,255)")
.style('fill-opacity','1')
.style("stroke-width", ".25")
.style("stroke", "rgb(0,0,0)")
.on('mouseover', addBus)
.on('mouseout', removeBus)
var tooltip = svg.append("g");
function addBus(event, d) {
var centroid = path.centroid(d);
tooltip.call(
callout,
`Bus Stop: ${d.properties.STOPNAME} `
);
tooltip.attr("transform", "translate(" + centroid + ")");
}
function removeBus(event, d)
{tooltip.call(callout,null)
}
c.enter().append('circle')
.data(PMStops.features)
.enter()
.append("circle")
.attr('cx',function(d) {return path.centroid(d)[0]})
.attr("cy", function(d) {return path.centroid(d)[1]})
.attr('r',2)
.attr("fill", "rgb(100,149,237)")
.style('fill-opacity','1')
.style("stroke-width", ".5")
.style("stroke", "rgb(0,0,0)")
.on('mouseover', addStops)
.on('mouseout', removeStops)
var tooltip = svg.append("g");
function addStops(event, d) {
var centroid = path.centroid(d);
tooltip.call(
callout,
`People Mover Stop: ${d.properties.name} `
);
tooltip.attr("transform", "translate(" + centroid + ")");
}
function removeStops(event, d)
{tooltip.call(callout,null)
}
c.enter().append('circle')
.data(NewStations.features)
.enter()
.append("circle")
.attr('cx',function(d) {return path.centroid(d)[0]})
.attr("cy", function(d) {return path.centroid(d)[1]})
.attr('r',2.5)
.attr("fill", "rgb(255,20,147)")
.style('fill-opacity','1')
.style("stroke-width", ".5")
.style("stroke", "rgb(0,0,0)")
.on('mouseover', addNew)
.on('mouseout', removeNew)
var tooltip = svg.append("g");
function addNew(event, d) {
var centroid = path.centroid(d);
tooltip.call(
callout,
`Metro Station: ${d.properties.Layer} `
);
tooltip.attr("transform", "translate(" + centroid + ")");
}
function removeNew(event, d)
{tooltip.call(callout,null)
}
var t = svg.selectAll("text")
.data(olympics.features)
.enter()
.append("text")
.attr("x", function(d) {return path1.centroid(d)[0]})
.attr("y", function(d) {return path1.centroid(d)[1]-5})
.attr('font-family','helvetica')
.attr('font-size','.4em')
.attr('font-weight','450')
.style("fill", "rgb(0,0,0)")
.attr('text-anchor','middle')
.text(function(d) {return d.properties.name})
svg
.append("text")
.attr('class','title')
.attr('x','45')
.attr('y','550')
.attr('font-family','helvetica')
.attr('font-size','.7em')
.attr('font-weight','400')
.style("fill", "rgb(0,0,0)")
.text('2028 Addition')
svg
.append("text")
.attr('class','title')
.attr('x','45')
.attr('y','560')
.attr('font-family','helvetica')
.attr('font-size','.5em')
.attr('font-weight','400')
.style("fill", "rgb(0,0,0)")
.text('Crenshaw/LAX')
svg
.append("line")
.attr('x1','15')
.attr('y1','545')
.attr('x2','40')
.attr('y2','545')
.attr('stroke-width','.75')
.attr('stroke','rgb(0,0,0)')
scaleBar
.projection(projection)
.size([width, height]);
svg.append("g")
.call(scaleBar);
return svg.node();
}