I am not familiar with either of these. I am happy to email you the JS file though.
// initially all arrows occupy the same spot in the top left of the screen
var linkArrow = vis.selectAll(".linkArrow").data(data.links)
linkArrow.enter().append("polygon").attr("class","linkArrow")
.attr("points","0,0 5,10 0,20 -5,10").attr("style","fill:black;stroke:black;stroke-width:1")
// in the tick event of the force diagram
.force.on("tick", function (a)
{
// add a transform to each of the diamonds/(arrows) created above
linkArrow.attr("transform", function(d)
{
// get the x and y points of the source and destination nodes
// calculate dx and dy
var dx=tx-sx; var dy=ty-sy;
// calculate the gradient of the line
var gradient=dy/dx;
// calculate the angle of the line
var theta=Math.atan(gradient)
// the diamond is going to be three quarters of the way along the line (an arbitary design decision)
// calculate the x and y of where this diamond needs to translated to
// as well as translating the diamond to the correct position, we also need to rotate it so that it aligns with the link line
// the angle was calculated in radians initially so not convert it to degrees
var angle=(theta*(180/Math.PI))-270
// we are not interested in anything over 360 degrees so modulo divide by 360 to get the remainder
angle = angle%360
// we now have all the info we need to first translate the diamond to the correct position
// and then rotate it to the appropriate angle such that it aligns with the link
return "translate("+x+" "+y+") rotate("+angle+" 0 0)"
}
}
With a bit more work, this can be added to to work on arrows rather than diamonds. Using the above on arrows however, sometimes the arrow faces the wrong way. I "cheated" by using a diamond (two arrows back to back) so that there is no "wrong way". The problem is to do with the fact that in normal maths, the y increases as you go up, whereas of course in html, y increases as you go down.
I hope this helps. I shall investigate hosting my source somewhere.