Skip to content

Add linkCurveRotation to adjust self-loop angles on curved links #396

Description

@Geoc2022

Is your feature request related to a problem? Please describe.
I've been having some problems with self edges overlapping the rest of the graph and wanted to be able to be able to rotate them instead of putting them in the top right quadrant.

Example:
https://george.chemmala.com/finite-automaton-autograder/fa_create?fa=eyJub2RlcyI6W3sibmFtZSI6InFfMCIsImdyb3VwIjoibm9ybWFsIn0seyJuYW1lIjoicV8xIiwiZ3JvdXAiOiJub3JtYWwifSx7Im5hbWUiOiJxXzQiLCJncm91cCI6Im5vcm1hbCJ9XSwibGlua3MiOlt7InNvdXJjZSI6InFfMCIsInRhcmdldCI6InFfMSIsImxhYmVsIjoiIn0seyJzb3VyY2UiOiJxXzAiLCJ0YXJnZXQiOiJxXzQiLCJsYWJlbCI6IiJ9LHsic291cmNlIjoicV8wIiwidGFyZ2V0IjoicV8wIiwibGFiZWwiOiIifSx7InNvdXJjZSI6InFfMSIsInRhcmdldCI6InFfMSIsImxhYmVsIjoiIn0seyJzb3VyY2UiOiJxXzQiLCJ0YXJnZXQiOiJxXzQiLCJsYWJlbCI6IiJ9LHsic291cmNlIjoicV8xIiwidGFyZ2V0IjoicV80IiwibGFiZWwiOiIifV19

Describe the solution you'd like
Add a linkCurveRotation that accepts a number (in radians), a string, or a function, similar to linkCurvature. This property would allow each link’s curvature axis to be rotated independently, so self-links can be displayed at different angles, reducing visual overlap and improving readability.

I have a demo here trying this out: https://github.com/Geoc2022/force-graph/blob/master/example/curved-links-with-rotation/index.html

Describe alternatives you've considered
I'm not sure there are good alternatives other than changing linkCurvature for overlapping links.

Additional context
I've created a fork here: https://github.com/Geoc2022/force-graph and a PR (#397)

Example of the demo:
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions