score:2

Accepted answer

You will need to sum up your values:

So if your data is having multiple "American Samoa" then you need to sum up all the drones, which sums up to 12.

To do that make use of d3 nest to group and sum up its registration.

  var data_sum = d3.nest()
  .key(function(d) { return d.Country; })//group by country
  .rollup(function(v) { return d3.sum(v, function(d) { return d.Registration; }); })//roll up all resgistrations
  .entries(data);

Now this will give you the summed up data, which can be used to make the bar chart just as this example.

working code here


Related Query

More Query from same tag