Accepted answer

The problem is that no data is bound to the x axis ticks and therefore d is undefined -- you should actually get an error message when running your code.

In this particular case, you can use the index to get the relevant data item like so.

   .attr("id", function(d, i) { return dataset[i].slug; });

Note that this will only work if the number of axis ticks is the same as the number of data items.

Related Query

More Query from same tag