nowthis / sankeymatic

Make Beautiful Flow Diagrams
http://sankeymatic.com/build/
ISC License
841 stars 122 forks source link

Sub-categories now use output instead of input values for labels #61

Open GoodnessJSON opened 1 year ago

GoodnessJSON commented 1 year ago

Hi there,

I have a sample Sankey example such as the below:

Expenditures [200] Shopping

Shopping [150] Homewares Shopping [150] Electronics

Originally the label for shopping would show as 200 since that is the INPUT. Recently however it seems this behaviour has changed and the label now displays the automatic sum from the OUTPUT, so it now displays 300. Would it be possible to make this a configuration option to choose whether the input or output value is displayed?

This would be invaluable for certain use-cases where you're more focussed on a strictly defined input and the outputs are less reliable.

nowthis commented 1 year ago

The logic for deciding what value to use to label a node has not changed; a node is always sized to the maximum amount of its inflows & outflows, and the value shown in a label always uses that amount.

I think what may be different is the default placement of the labels -- that has changed recently. You can get back the old labeling style fairly easily, though.

Here's what it looks like today with your sample input and the newer default label placement: labels-before

By default, labels now appear before their nodes. English speakers read left-to-right; this gives people a label as the first thing they need to process rather than presenting them with some blank rectangles first (& hoping they notice the labels on the other side of the nodes).

You can customize the label placement under "Labels & Units" > "Position". To restore the appearance which used to be the default, you would:

  1. Set "Place the first labels:" to "After the node".
  2. If you also want the last labels to be 'inside' their nodes instead of after them, then move the "Place labels on the other side" slider leftward to make the end labels appear before their nodes. (That slider controls the column at which this label-flipping starts; it defaults to no flipping at all.)

With those two changes, this is what those same inputs look like: labels-inside

Is that the output you're looking for?

If not, do you have an example of an older diagram behaving as you describe? I'm not sure what else the issue might be.

rshorst commented 1 year ago

I have been searching around everywhere and can't seem to find this case. It would be helpful to have an option that did not add up the totals of homewares and electronics, but instead visualized them as part of a set whole of expenditures. so Expenditures is set at 200 and 150/200 goes to homewares and another 150/200 goes to electronics... does that make sense?