score:3

Accepted answer

If you split up the data entry block and define a variable for

var links = svg.selectAll('line.link')
    .data(data.link)
    .enter()

You can append multiple different things the selection you have defined as links. You aren't adding more elements to the lines, per se, but rather adding elements to the selections that you are adding the lines to, corresponding to adding shapes to lines in a one to one ratio.

I've modified your fiddle to add a circle to the middle of each line.

If you want to only add elements to the black lines, you can use a filter to do so by creating a new data set and operating on that.


Related Query

More Query from same tag