初始html如下
<svg>
<g id="groupOfPaths">
<path id="foo_1" d="M 80,40 Q 200,85 245,205" stroke="red" stroke-width="2"/>
<path id="foo_2" d="M 150,40 Q 200,85 245,205" stroke="red" stroke-width="2" />
</g></svg>
使用d3如何将textpath附加到所有现有路径标记,以便输出如下
<svg>
<g id="groupOfPaths">
<path id="foo_1" d="M 80,40 Q 200,85 245,205" stroke="red" stroke-width="2"/>
<path id="foo_2" d="M 150,40 Q 200,85 245,205" stroke="red" stroke-width="2" />
<!--extra added tags-->
<text fill="red">
<textPath xlink:href="foo_1">1 path text follow</textPath>
</text>
<text fill="red">
<textPath xlink:href="foo_2">101 path text follow</textPath>
</text>
</g></svg>
编辑了为每条路径包含ID的问题