-
Notifications
You must be signed in to change notification settings - Fork 254
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 multiple orientations? #55
Comments
Seems out of scope for the library. You can center the container vertically. Can you provide any more details? Or a working example where you'd like centering? |
Thank you for your answer. The value attribute of link array's item is set to 1. The result like this image. https://pan.baidu.com/s/1XDIRTNsB0I7CfbLzLruqEA Can the nodes be centered in the y direction? |
@curran I think @limzgiser is asking for a option to display an vertical sankey diagram (But I'm not sure since his image won't load)... I'm building one for a project by simply swapping Also function sankeyLinkVertical () {
return d3.linkVertical()
.source(function(d) { return [d.y0, d.source.x1]; })
.target(function(d) { return [d.y1, d.target.x0]; });
} (Again: swapping |
Yep, you can swap x and y to change the orientation of the Sankey diagram. That said it might be nice for the Sankey diagram to support orientations similar to d3/d3-hierarchy#63, so I’ll re-interpret this issue as that. If you want the nodes to be centered vertically within their columns, that’s not currently supported, but I expect you could just move the nodes into the middle manually by computing the total column size and then the desired node positions. |
Reviewed the PR at a high level. Generally looks good! |
Thanks @curran ! |
Related d3/d3-hierarchy#63. I think I’d follow the approach there (and in d3-axis) and have aliases for the different orientations d3.sankeyUp, d3.sankeyDown, d3.sankeyLeft, d3.sankeyRight with the default d3.sankey = d3.sankeyRight. But, I’m a little busy right now with other stuff so I don’t know when I’ll get a chance to review this. |
@mbostock Great, that makes sense. I've implemented only two orientations ( |
@mbostock @curran Rendering for each of the four cardinal directions is now available in It's not the most elegant implementation and relies on some conditional behaviour -- for bottom-to-top rendering in particular -- and I'd welcome any suggestions for improvements. |
@jayaddison Nice work. Wondering when this will be merged. |
No description provided.
The text was updated successfully, but these errors were encountered: