chart = {
d3.select("svg").remove()
let svg = d3.select(".chart").append("svg").attr("viewBox", [0, 0, width, height]);
svg.append("g").append("path").datum(land).attr("fill", landColor).attr("d", path);
loadSeas(svg)
let colorIndex = -1;
svg.append("g")
.selectAll(".kingdoms")
.data(kingdoms)
.enter()
.append("path")
.attr("id", function(d) {
return d.altName + "_path";
})
.attr("class", function(d) {
return "state"
})
.attr("fill", function(d) {
colorIndex++
return diverging[colorIndex];
})
.attr("fill-opacity", function(d) {
return d.opacity;
})
.attr("stroke", function(d) {
return "grey";
})
.attr("stroke-width", 1)
//.datum(d=>d.datum)
.attr("d", d=>{
return path(d.datum)
});
// svg.append("g")
// .selectAll(".kingdoms")
// .append("path")
// .datum(topojson.feature(uk, uk.objects))
// .attr("d", path);
// svg.append("g")
// .selectAll(".kingdoms")
// .data(topojson.feature(uk, uk.objects)
// .enter()
// .append("path")
// .attr("id", function(d) {
// console.log("*****")
// console.log(d)
// return d.name + "_path";
// })
// .attr("class", function(d) {
// return "state"
// })
// .attr("fill", function(d) {
// return "red";
// })
// // .attr("fill-opacity", function(d) {
// // return d.opacity;
// // })
// .attr("stroke", function(d) {
// return "grey";
// })
// .attr("stroke-width", 1)
// //.datum(d=>d.datum)
// .attr("d", d=>{
// return path(d.objects)
// });
loadUkraine(svg)
return svg.node()
}