geo_map = (width = 900, g) => {
let height = width - 100
let margin = { top: 10, right: 10, bottom: 10, left: 10 };
let W = width - margin.left - margin.right,
H = height - margin.top - margin.bottom;
var colorExtent = d3.extent(data_ofyear.map(d => d[qualite_selected(qualites1)]))
var color = d3.scaleSequential(d3.interpolateOrRd).domain(colorExtent)
let projection = d3geo.geoKavrayskiy7()
.fitSize([W*1.2, H-margin.bottom*3], countries)
.translate([W*0.46, W*2/3*0.6])
let path = d3.geoPath(projection)
const svg = g || d3.create("svg")
.attr("viewBox", [0, 0, width, height])
.attr("width", width)
.attr("height", height);
svg.append("g").selectAll("path")
.data(features)
.enter()
.append("path")
.attr("d", path)
.style('fill-opacity', 1)
.style('fill',d=>color(countriesObj_byCode.get(d.id)))
.attr("name-country", d => {
return countries_hash.get(d.id)
})
.on("mouseenter",(e,d) =>{
svg.append("text")
.attr("class","legend")
.attr("x",width/3 - self.length)
.attr("y",height - margin.bottom*1.75 )
.text(countries_hash.get(d.id))
svg.append("text")
.attr("class","legend")
.attr("x",width/3 - self.length)
.attr("y",height - margin.bottom*0.5 )
.text(qualites1 + " : "+ countriesObj_byCode.get(d.id))
}).on("mouseleave",(e,d) =>{
svg.selectAll(".legend").remove()
})
return svg.node()
}