lineID = d3.select(this.firstChild).attr('id'); // setting the line id
textID = d3.select(this.lastChild).attr('id'); // setting the text id
在这种情况下,我想行与标签移动它拖时。
所以只有线的x2和y2属性会被更新,并且线的x1和y1应该保持不变。
这里firstChild和lastChild的用法可能不是理想的解决方案。 x1和y1现在硬编码了,我不知道如何动态返回值。
你为什么不简单地翻译'g'元素? – 2014-08-28 08:58:07
@LarsKotthoff他希望'x1','y1'保持不变。如果你翻译'g's,那么这是行不通的(而且他没有它们,可惜...) – Oleg 2014-08-28 09:14:17