Svg 如何反转此JSFIDLE中显示的箭头方向http://jsfiddle.net/5qaL886d/1/

Svg 如何反转此JSFIDLE中显示的箭头方向http://jsfiddle.net/5qaL886d/1/,svg,d3.js,Svg,D3.js,此代码段中的箭头是手动绘制的,即箭头点是手动计算的。因此,您需要做的是重新计算它们,以便它们位于不同的一端。通常情况下,箭头应该使用defs创建,这要容易得多,但在这种情况下,它们似乎会导致IE10出现问题,因此需要手动绘制。无论如何,这里是代码段的更新版本,箭头已反转,但没有反转输入数据。您只需在这里或那里更改标志: I an not understanding which attributes to change to do so. Thanks in advance.. 您应该在这里添加

此代码段中的箭头是手动绘制的,即箭头点是手动计算的。因此,您需要做的是重新计算它们,以便它们位于不同的一端。通常情况下,箭头应该使用defs创建,这要容易得多,但在这种情况下,它们似乎会导致IE10出现问题,因此需要手动绘制。无论如何,这里是代码段的更新版本,箭头已反转,但没有反转输入数据。您只需在这里或那里更改标志:

I an not understanding which attributes to change to do so.
Thanks in advance..

您应该在这里添加与问题相关的代码的相关部分,而不仅仅是JSFIDLE链接。在输入数据中交换源和目标?谢谢torazaburo。这个交换想法很有效。但是如果有人能找到逆转箭头的方法,请告诉我。非常感谢尼古拉。这是我能找到的最好的解决方案..再次强调:
I an not understanding which attributes to change to do so.
Thanks in advance..
var dx = d.target.x - d.source.x,
    dy = d.target.y - d.source.y,
    dr = Math.sqrt(dx * dx + dy * dy),
    theta = Math.atan2(dy, dx) - Math.PI / 7.85,
    d90 = Math.PI / 2,
    dtxs = d.source.x + 6 * Math.cos(theta),
    dtys = d.source.y + 6 * Math.sin(theta);

return "M" + d.source.x + "," + d.source.y + 
    "A" + dr + "," + dr + " 0 0 1," + d.target.x + "," + d.target.y + 
    "A" + dr + "," + dr + " 0 0 0," + d.source.x + "," + d.source.y + 
     "M" + dtxs + "," + dtys +  
     "l" + (3.5 * Math.cos(d90 - theta) + 10 * Math.cos(theta)) + 
     "," + (-3.5 * Math.sin(d90 - theta) + 10 * Math.sin(theta)) + 
     "L" + (dtxs - 3.5 * Math.cos(d90 - theta) + 10 * Math.cos(theta)) + 
     "," + (dtys + 3.5 * Math.sin(d90 - theta) + 10 * Math.sin(theta)) + 
    "z";