Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support additional link types #174

Closed
techniq opened this issue Oct 12, 2017 · 5 comments
Closed

Support additional link types #174

techniq opened this issue Oct 12, 2017 · 5 comments

Comments

@techniq
Copy link
Collaborator

techniq commented Oct 12, 2017

Creating a separate issue to track, mentioned in #172.

It would be nice to support more link types, similar to vega (see tree example, radial tree example), such as:

Orthogonal

image
image

Curve

also possible

Elbow (45deg)

  • example
  • useful for annotations / call outs
    image

Implementation

I'm not sure if all of these should be separate components like LinkHorizontal, LinkVertical, and LinkRadial (LinkHorizontalOrthogonal ?) or by adding a type prop (or something) such as <LinkHorizontal type="orthogonal" /> where type could be line, diagonal, curve, orthogonal, elbow, etc.

I took a quick look at how vega supports the different linkpath types, which are implemented using simple svg path line/curve commands. I envisioned doing something similar, and is typically how I see other d3 implementations, although this would break canvas support (d3 uses it's context to abstract the canvas/svg from my understanding. It looks like there is an open issue on d3-shape to add orthogonal support, but there hasn't been any response to the original request.

Personally I've only ever used svg with d3, so I would be fine with only support svg. Thinking more about it, I don't see how a react wrapper could produce canvas, except using react-konva or react art.

@techniq
Copy link
Collaborator Author

techniq commented Oct 12, 2017

Looking at d3-shape's curveStep looks to possibly give us a context-agnostic way to create an orthogonal link. Some useful examples to visualize other curve types:

While curveStep is probably what we would want for an orthogonal link, I could see benefit in curveStepAfter and curveStepBefore. Not sure if we would also need a separate horizontal vs vertical version.

@techniq
Copy link
Collaborator Author

techniq commented Oct 24, 2017

@hshoff: some progress https://codesandbox.io/s/n3w687vmqj

Current using <LinkStep />, <LinkStep before /> and <LinkStep after /> although I'm not sure how this should be exposed once we have radial examples like in the original comment (LinkRadialStep?)

image

image

image

@techniq
Copy link
Collaborator Author

techniq commented Oct 29, 2017

@hshoff Take a look at https://n3w687vmqj.codesandbox.io/

We now have step, curve, line, and the existing "diagonal" link types for both cartesian and polar layouts and horizontal or vertical orientations.

image

image

image

I broke them out as Link{Layout}{Type} components, for example LinkVerticalCurve, LinkHorizontalCurve, and LinkRadialCurve similar to our LinkVertical, LinkHorizontal, and LinkRadial.

I'm going to try to find some more time to knock out the elbow type, but I'm pretty happy where things are if not.

@hshoff
Copy link
Member

hshoff commented Nov 1, 2017

@techniq wow! looks great, would love to add these to vx

@techniq
Copy link
Collaborator Author

techniq commented Nov 6, 2017

I've been buried at work lately but I'll try to get a PR soon. I started on the elbow type but having trouble getting the math right. I'll probably wait to implement it until I get a PR for the others out.

techniq added a commit to techniq/vx that referenced this issue Nov 9, 2017
hshoff added a commit that referenced this issue Nov 13, 2017
Add support for step, curve, and line links.  Issue #174
@hshoff hshoff closed this as completed Nov 13, 2017
techniq added a commit to techniq/vx that referenced this issue Jan 22, 2018
…potentially support <canvas> in the future. Expose "source" and "target" props for each as well. Issue airbnb#174.  Issue airbnb#41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants