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

allow dashed links #344

Conversation

marcopiii
Copy link
Contributor

@marcopiii marcopiii commented Jul 7, 2020

Closes #343

This little change gives the user more control on the appearance of the links, adding support for stroke-dasharray, stroke-dashoffset and stroke-linecap svg attributes.
As for already supported attributes, they can be defined on single links or globally.

Copy link
Owner

@danielcaldas danielcaldas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! Looking forward to seeing this in the live sandbox in action. To check if your changes are producing the desired effect I would advise running npm run dev so that you can see the new properties in the configurations panel, and check whether they are producing the desired effect in the graph.

@@ -524,6 +524,9 @@ const graph = {
This is how link strokeWidth will be calculated:`javascript strokeWidth += (linkValue * strokeWidth) / 10;` (optional, default `false`)
- `link.strokeWidth` **[number][181]** <a id="link-stroke-width" href="#link-stroke-width">🔗</a> 🔍🔍🔍 strokeWidth for all links. By default the actual value is obtain by the
following expression:`javascript link.strokeWidth * (1 / transform); // transform is a zoom delta Δ value` (optional, default `1.5`)
- `link.strokeDasharray` **[string][183]** <a id="link-stroke-dasharray" href="#link-stroke-dasharray">🔗</a> 🔍🔍🔍 strokeDasharray for all links.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please drop these changes. Documentation is only updated upon releasing a new version. You can reuse these lines of documentation to add it on graph.config.js

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also please make sure to wrap each one of the properties (e.g. strokeDasharray) with a link to the respective MDN page. example:

<a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-dasharray">strokeDasharray</a>

This is extremely valuable for navigability and to make sure other developers don't mix this with something else.

@@ -94,6 +94,9 @@ function buildLinkProps(link, nodes, links, config, linkCallbacks, highlightedNo
}

let strokeWidth = (link.strokeWidth || config.link.strokeWidth) * (1 / transform);
let strokeDasharray = link.strokeDasharray || config.link.strokeDasharray;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we have const instead, for all these new variables?

@@ -143,6 +146,9 @@ function buildLinkProps(link, nodes, links, config, linkCallbacks, highlightedNo
source,
stroke,
strokeWidth,
strokeDasharray,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes look good, but without adding the new configs to the graph.config we won't be able to use them.

Please make sure you change the graph.config.js with these new properties and add the proper default values for each one of them.

@stale
Copy link

stale bot commented Oct 11, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enhance control on links appearance - support dashed links
2 participants