Get one element from d3js selection, by index
The most natural way to manipulate just one element is using the filter function: var data = [[0,0,2],[0,23,5],[2,12,5]]; var circleSet = svg.selectAll() .data(data) .enter() .append(‘circle’); var filteredCircleSet = circleSet .filter(function (d, i) { return i === 1;}) // put all your operations on the second element, e.g. .append(‘h1’).text(‘foo’); Note that depending on what you do … Read more