您可以使用css"element + element"选择器(直接相邻组合器).假设你需要在元素"first"之后插入元素"second":
d3.select('body') .insert('div', '#first + *') .attr('id', 'second');