(SOLVED) Help with D3 Force Directed Graph

(SOLVED) Help with D3 Force Directed Graph


I am stuck with this project. I can not get the flag of each country go with the correct node. Instead they stay together.
I have tried everything that has happened to me

This is the part of the count code I think is the problem
var countries = d3.select('.countries').selectAll('img') .data(dataset.nodes) .enter() .append('img') .attr('class', function (d) { return 'flag flag-' + d.code; })

Here is the codepen to see all code
Codepen for D3 Country Borders Force Directed Graph

Thanks in advance


Add to css file
.flag {position : absolute;}

And in html file bootstrap distance between divs make absolute position fail, so i remove the divs above svg