You're passing the entire lineData
array into the lineFunction
but it should just be an individual datum. Since you bound lineData
to the selection, you could do .attr("d", lineFunction)
.
There are some problems with your diagonal
as well. The source
and target
accessors both need to return objects, where in your case they are returning scalar values.
Then, the result objects returned from source
and target
will be subsequently fed into projection
where each should be further converted into a 2 element array describing a point. If your source
and target
return an object with x
and y
defined ({x:, y:}
) you don't need projection
at all because the default will look for these properties.