nowthis / sankeymatic

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

Diagram live editing/updating #45

Closed mattwright324 closed 6 months ago

mattwright324 commented 4 years ago

It would be convenient for the diagram to update live as you make changes to any of the inputs. Currently, without hitting the preview button I have to click outside the form/inputs section for changes to be seen in the diagram.

I realize if the process is browser heavy it makes sense to do processing as infrequent as possible and how it works currently does that. An option to enable live editing would be very helpful.

In the mean time running the following in the browser console does the trick for me

document.getElementById("flows_in").onkeyup = process_sankey;
nowthis commented 3 years ago

(Side note: Just pressing the 'tab' key also ought to trigger an update, then you can shift-tab back to the field you were in without having to use the mouse at all.)

On the main point:

It's not difficult to make it update live, but I would not want it to update with every keystroke, as someone may be typing away speedily and triggering unnecessary error messages & drastic diagram changes from temporarily invalid syntax, when they're about to make it valid with a few more characters.

I do think some sort of update-trigger with a debounce guard would satisfy all parties.. as in, if the user has stopped typing for some brief period of time (say, 0.4 seconds), then it's ok to render an update with the new data.

Marking this medium-priority. I do agree it would be an improvement.