dc-js / dc.graph.js

interactive network visualization
Apache License 2.0
98 stars 24 forks source link

clip splines don't dash them #95

Open gordonwoodhull opened 5 years ago

gordonwoodhull commented 5 years ago

Using stroke-dasharray and stroke-dashoffset in order to leave space for arrowheads/arrowtails is clever and maybe efficient.

But it's still buggy, especially during animations, and of course it breaks use of nodeStrokeDashArray irretrievably (duh!)

We should probably just break the spline. Currently we don't have a good function to break a spline at a certain length, only t. getPointAtLength is neat but doesn't provide the spline pieces.

We do bisection in order to find a point at an certain distance (should be close to the same thing) for the marker orientation, and bezier_point just discards the split spline. So that's probably where to grow.

A further complication is that we should consider the possibility that there may be a bezier segment shorter than the arrowhead (more likely with compound/multiple arrowheads).

gordonwoodhull commented 5 years ago

This is fixed on the chop-splines branch, except for the last case. I'm wary of bisection but everything I've read seems to indicate that numerical methods are the best you can do. Technically it is more exact since we can do the straight-line distance, and the arrowhead is straight. It still spooks me though, so I'm holding it for the next release.