Comments (3)
The links generated by this module are made of a central path, connecting the center of the source to the center of the target. Its movement is given by the bump-x curve, and it is painted with a wide stroke. This makes it impossible (to my knowledge) to give it a variable stroke-width.
By contrast, Anneya's method is creating an area (with a fill), where the top and bottom edges are two curves, each determined by a (possibly different) bump-x curve. Maybe you could emulate that approach?
Unfortunately, using two parallel curves like this results in "squeezed" shapes (the ribbons appear smaller in the middle due to shearing), so it can't be the default method. This might be fixed by computing path offsets with path.getTangentAtLength and so on, but it seems like a lot of work.
Refs:
- https://observablehq.com/@fil/sankey-link-paths
- https://www.w3.org/Graphics/SVG/WG/wiki/Proposals/Variable_width_stroke
- https://github.com/rveciana/svg-path-properties
- https://observablehq.com/@meetamit/offset-path
from d3-sankey.
I've added a solution with @rveciana’s svg-path-properties
from d3-sankey.
I've just done this using the approach outlined here:
https://observablehq.com/@enjalot/weird-sankey-links
The only caveat is that I've found an issue here (#92). It may or may not affect you depending on how you use it (we were scaling values either side of a node and so needed to recalculate the link height using the adjacent link positions)
hope this helps
from d3-sankey.
Related Issues (20)
- Support to apply styles to node title HOT 2
- D3 Sankey customization HOT 1
- nodeAlign not aligning the nodes properly HOT 1
- Y coordinates of links control points calculates with error
- Unwanted circle on link path HOT 1
- Distribute or normalize nodes to fill available space
- Documentation image screenshots look strange with github's dark mode
- Uncaught RangeError: Invalid array length computeNodeBreadths
- Reconsider adding maintainers HOT 1
- Is it possible to sort source or target nodes in one column?
- Little to no activity on this plugin HOT 2
- Issues With Zero Values
- Issues with 0 values
- Empty links with a single node does not seem to work
- what algorithm the sankey uses to arrange the node positions
- Unwanted overlap of multiple/parallel links with sankeyLinkHorizontal
- sankey with mouseover links not working with d3@6 HOT 1
- sourceLinks `y0` and `y1` calculated the wrong way round HOT 1
- Setting min height of node to avoid overlap issue HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from d3-sankey.