We have a project where we are working several thousand items through a multi-step process. I want to create a multi-group Sankey diagram to help visualize where we are in the process. This is to run in a browser and is client-side javascript. I followed this demo and have it up and running.
The challenge I face is how to turn my table of data into the links and nodes needed for a Sankey diagram. In that example the data passed to the chart is organized like this:
{ "nodes":[
{"node":0,"name":"node0"},
{"node":1,"name":"node1"},
{"node":2,"name":"node2"},
{"node":3,"name":"node3"},
{"node":4,"name":"node4"}
],
"links":[
{"source":0,"target":2,"value":2},
{"source":1,"target":2,"value":2},
{"source":1,"target":3,"value":2},
{"source":0,"target":4,"value":2},
{"source":2,"target":3,"value":2},
{"source":2,"target":4,"value":2},
{"source":3,"target":4,"value":4}
]}
I'm starting with raw data of an element for each item in our project and each item will have the following (truncated for clarity) list of columns and sample values:
ID Process Owner Decision Status
01 quick group1 retire done
02 standard group2 replace working
03 quick none none hold
04 quick group2 retire working
There are several other columns and values for each one, but I think that gives an idea. It is coming from ajax and in json format (not fixed width columns), but that is the general structure.
How do I convert that to links and nodes?
I found this thread which is asking the same thing (I think) but is for R and I don't have enough experience with that to follow the answer.
I've googled for answers. Most tutorials I found assume you've got the data in the node/links format. And, like the thread above, I found a couple talking about R, php, or SQL for turning the data into nodes and links -- neither of which do I understand.
The data changes hourly-daily and I want to be able to have this just load up for anyone who wants to check at anytime. So I need an automated solution.
I've got the raw data and a model for creating the diagram. I'm just missing how to convert the data programmatically.
EDIT
I already have my raw data into my code. That isn't the problem. The issue is that all of the tutorials assume you've already got nodes and links. I have one row per item. These are not the same thing. I don't need help with json, ajax, or loading files. I appreciate the suggestions, but they are completely in the wrong direction.