-
Notifications
You must be signed in to change notification settings - Fork 256
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 custom X-axis positioning of the nodes #78
Comments
@bella-kpler fyi |
Thanks for the advice! To add to this answer, this is how I did it: sankey = d3.sankey()
/* ... */
.nodeAlign((node, n)=>{
return node.customX ? node.customX : d3.sankeyJustify(node, n) // sankeyJustify can be changed to any nodeAlign() functions
})
/* ... */ |
Unfortunatelly it doesn't seem to work if your custom scale for whatever reason extends beyond the already calculated max depth (passed as “n” into the alignment function). I'll keep experimenting, but seems like at the very least after the alignment is done max depth should be updated for the chart to be drawn properly. This would provide more flexibility to the calling code. |
node.customX ? could lead to an issue because if node.customX = 0 then this would jump into the else branch too
var x = 0; x === true; ==> false
|
Hi, thank you for this great library.
For a specific use case, we'd need to position nodes on the X-axis according to a D3 time scale. It does not seem possible as of now considering the horizontal positioning of the nodes is governed by the nodes' depth.
Would it be in the scope of this library to support such use case? If not, would you have any hints/suggestions towards implementing a solution?
We are willing to help working on a solution. 😃
The text was updated successfully, but these errors were encountered: