nowthis / sankeymatic

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

Allow user to set the vertical node order #17

Closed nowthis closed 1 year ago

nowthis commented 8 years ago

Currently the order of nodes is determined by relaxing the graph over several iterations, with nodes usually ordered from largest to smallest (top to bottom).

This is usually fine. However, in some cases it would be nice to give the user an option to set their own ordering for the nodes. (I think this would just mean using the order given in the source rows, not forcing them to drag things around in a list.)

nowthis commented 3 years ago

If anyone's wondering "what will it take for the website to stop saying the tool is in 'BETA'?"...

This issue is it.

I do think that the most intuitive approach to this will be to let the order of the rows in the source data control the vertical order of each column's nodes. (By default, I'll keep the auto-layout algorithm, but this ought to be an option.)

I am sure that there are edge cases I will run into here which will make this difficult, but that's the basic idea I'm planning to try.

nowthis commented 1 year ago

At long last, this one is done in c450a65.

I was right that there would be further wrinkles - two big ones in particular:

  1. The first is that the original algorithm for placing flows inside of nodes produces many more unnecessary flow-crossings when nodes are in places which differ from the automatic layout. Providing the ability to order nodes however you want but then producing a lot of unwanted crossings would have been a pretty poor user experience, so I had to fix both things at the same time. Fixing that flow sorting problem took a lot of tries; my new algorithm is in 3038d612f97a286ac2a8053aaf5116cb8b7e86ee.
  2. Even with both of those changes, the resulting diagrams can be laid out sub-optimally due to the limitations of the 'Spacing' slider. I've concluded that the Spacing parameter is really trying to control 2 distinct things at once: the Node Height and also the Spacing between Nodes. These two things do not have to be locked together in the way that they are today. A UI change to break this single slider into two is coming soon; that change will enable much more aesthetically pleasing diagrams than you can get today.