So I would like to create a question flowchart like below:
Not sure where the best place to start is... Is this a Directed Graph?
Some of those end up being really spaced out and not looking great for 'flows' like so: https://observablehq.com/@d3/force-directed-graph
The best example I've seen is a non-D3 library (yworks) but it seems to cost $15k:
This is the only related StackOverflow I've seen which just references yworks: Can I create a flow chart (no tree chart) using D3.js
Maybe this dagre-d3 example as well:
http://jsfiddle.net/armyofda12mnkeys/9L50of2c/2/
var g = new dagreD3.graphlib.Graph().setGraph({});
Some cool optional stuff I'd like to add:
*I also want to be able to control the css on the Circles, like some will green some red in certain circumstances based on that node's data.
*Each Edge arrow I'd also like to add onHovers events, so a tooltip comes up to show the actual rule like 'if(Question1 == A || B)'
*Make the nodes/edges draggable or 'bouncy' (where they pop back to orig location if dragged). Sounds gimmicky, but sometimes users may use this feature if the rules get too cramped together (because of the smart auto-layout) and they wanna drag stuff to see what arrows point where.
I think I got it with dagre-d3. Here is my initial jsfiddle: http://jsfiddle.net/armyofda12mnkeys/4gv90qhx/2/
Also here is the same example with popups also on the edges (although I don't like the implementation as much as the node popups) http://jsfiddle.net/armyofda12mnkeys/4gv90qhx/37/
and here is a full example of how I'm using in my project for a Diabetes Questionnaire (I upgraded the code to latest d3.v5+dagre, and made the nodes+edges draggable... lots of initial JSON parsing code to get into a format I can actually loop over, sorry bout that): https://jsfiddle.net/armyofda12mnkeys/1burht5j/44/ Note: this last link may not work if 'cors-anywhere' website Im using is down. Try downloading it then.