nxt3AT / sankeydiagram.net

sankeydiagram.net is an easy-to-use webapp for generating Sankey Diagrams to visualize flows and budgets.
Other
79 stars 15 forks source link

feature request: add 'fill available' option #27

Open ldunkum opened 2 years ago

ldunkum commented 2 years ago

It'd be nice to have the option to automatically fill a target with the remaining value of a source.

source [500] target
target [400] rent 
target [%] savings // automatically fills to 100 and ideally refreshes when other values are changed 

I can try to do it myself, but some pointers would be nice

JonasDoesThings commented 2 years ago

Great idea!

Parsing the [?] value currently happens in sankey-builder.js#L248 so checking for [%] should probably also happen there.

Calculating the remaining value will be a bit tricky, but it could work by parsing the linksList list after it is fully populated with all the other links.

Sadly I currently don't have enough time on my hands to implement it by myself, but I would be happy to review any Pull Requests implementing this feature!

jfaltis commented 2 years ago

I would suggest using a different string than '%' maybe even just 'fill', 'remaining' or a clever character representation. '%' could be used later on for percentage distribution if it is a wanted feature.

JonasDoesThings commented 2 years ago

@jfaltis good objection, I have to agree with that!

ldunkum commented 2 years ago

@k4ds3 Thanks for the pointers, I'll take a look when I've got some time on my hands.

@jfaltis yeah, for sure, "fill" was actually my first idea too, I was just trying to simplify it to some common symbol :)