chart = {
const width = 900,
height = 660;
const svg = d3.create("svg")
.attr("viewBox", [25, -25, width-100, height-50]);
var projection = d3
.geoMercator()
.fitSize([width - 100, height - 100], boundingBox);
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");
var t = svg.selectAll("text")
.data(londonBoroughsActual1.features)
.enter()
.append("text")
.attr("x", function(d) {return path1.centroid(d)[0]})
.attr("y", function(d) {return path1.centroid(d)[1]-5})
.style('font-family','montserrat')
.style('font-size','12px')
.style('text-anchor','middle')
.style('font-weight','light')
.text(function(d){return d.properties.name})
.on('mouseover', addInfo)
.on('mouseleave', removeInfo)
function addInfo(event, d){
for (let index = 0; index < length; ++index) {
}
var path8 = d3.geoPath().projection(projection);
for (let i = 0; i < londonSpreadsheetSheet1.length; i++) {
if(d.properties.objectid == londonSpreadsheetSheet1[i].objectid){
console.log(event)
svg
.append("text")
.attr('x',path8.centroid(d)[0])
.attr('y',path8.centroid(d)[1]+10)
.attr('class','hoverText')
.style('font-family','montserrat')
.style('font-size','12px')
.style('font-weight','bold')
.style('text-anchor','middle')
.text(londonSpreadsheetSheet1[i].BoroughRecyclingRates)
svg
.append("text")
.attr('x',650)
.attr('y',path8.centroid(d)[1]+20)
.attr('class','hoverText')
.style('font-family','montserrat')
.style('font-size','12px')
.style('font-weight','bold')
.text(londonSpreadsheetSheet1[i].BoroughFoodWasteRecycling)
}
}
}
function removeInfo(){
svg.selectAll("text.hoverText").remove()
}
svg
.append("text")
.attr('x','75')
.attr('y','30')
.style('font-family','montserrat')
.style('font-size','32px')
.style('font-weight','bold')
.text('LONDON MAP')
svg
.append("text")
.attr('x','75')
.attr('y','50')
.style('font-family','montserrat')
.style('font-size','12px')
.style('font-weight','light')
.text('INITIAL FOOD WASTE DATA WITHIN BOROUGHS OF LONDON')
svg
.append("text")
.attr('x','75')
.attr('y','500')
.style('font-family','montserrat')
.style('font-size','12px')
.style('font-weight','light')
.text('9.5 MILLION TONNES OF FOOD WASTE')
svg
.append("text")
.attr('x','75')
.attr('y','520')
.style('font-family','montserrat')
.style('font-size','12px')
.style('font-weight','light')
.text('COMES FROM THE UK')
svg
.append("text")
.attr('x','75')
.attr('y','560')
.style('font-family','montserrat')
.style('font-size','12px')
.style('font-weight','light')
.text('2 MILLION TONNES OF FOOD WASTE')
svg
.append("text")
.attr('x','75')
.attr('y','580')
.style('font-family','montserrat')
.style('font-size','12px')
.style('font-weight','light')
.text('COMES FROM LONDON')
g.selectAll("path1")
.data(londonBoroughsActual1.features)
.enter()
.append("path")
.attr('class','outlines')
.attr("d", path2)
.style("fill", "Cornsilk")
.style('stroke-opacity','.3')
.style("stroke-width", '0.75')
.style("stroke", "DarkOrange")
return svg.node();
}