d3.js updating svg.path on drag with euclidean distance

429 views Asked by At

So I've hacked together a few examples to get something similar to what I want - I've been extending it more and more to learn the library.

I've run into a problem recently - I can't seem to access a path element on drag. I know what I want to do is update the path.value property with the euclidean distance but I can't find where to access or set that property on drag.

I set the distance of the data object on line 264 of this fiddle

link = {source: source, target: target, left: false, right: false, value: distance};

Where distance is my computed euclidean.

https://jsfiddle.net/p0nqdu1p/2/

Any help would be appreciated.

edit: Reloading the graph with the dataset causes links to scale to their initial source, target length - not the updated length caused by dragging a rectangle they are attached to.

0

There are 0 answers