-
Notifications
You must be signed in to change notification settings - Fork 127
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 upstream volume to be auto-calculated from sum of downstream volumes #21
Comments
I'm not sure I follow - the Sankey algorithm from d3 already adds up all the inputs to a node to determine its total size. Can you provide a sample SankeyMATIC input that doesn't work the way you want it to? Example -- given:
the node A will automatically have size 12. |
True.. but it only works for one level. Consider this, I have a three level stream (grandparent, parent, child) and all I specify are the amounts that each child needs. It looks like this:
Calculating the amount X and Y is not automated. Here I would need to hardcode X=6 and Y=14. Instead I'd like not to have to specify the amounts in X and Y and let it be auto calculated. This is super important for doing a bottom-up flow rather than a top-down flow. Doing a bottom up flow allows you to first enter the flows required at the leaf nodes and then based on the tree we can easily tell what flow each parent node needs. |
Aha, I think I understand now. So, it would be nice to have a syntax that lets you say 'this flow should adopt the size of the mentioned target node'. My first thought was, using a wildcard character (*) would make some sense:
However, that might be too simple -- I could easily see someone thinking a catch-all grandchild node would be just as useful as a grandparent node, but if that is possible, then
So maybe a directional hint would help:
So that would make the syntax for your example:
Does that seem like a viable/good-enough syntax? I think that's a reasonable feature to add sometime. Unfortunately, I have several features queued up in front of it, so it may be a while. Patches are welcome, however. |
Good news - an auto-calculation syntax is now implemented:
So revising the example from above:
can now produce this output on the site: Here's a public link with this diagram already loaded if anyone wants to play with it. In addition: Any time there are calculations to perform, SankeyMATIC will now add a Console section below the diagram which will log any calculation results in the order they were performed. This can make it easier to trace complex calculations if they come out unexpectedly. The console output for the above diagram looks like: |
This is huge. Thank you so much for implementing this! I use SankeyMatic to make a monthly budget overview and this new features takes out all of the extra addition and subtraction that has to happen up the entire chain when I make a change to a category. |
Excellent! Thank you for persisting through |
Example flow
Here, if only 3 and 9 were specified, then sankeymatic calculates the 12.
The text was updated successfully, but these errors were encountered: