A refactored version of Sara Quigley's Issue Breakdown as a simple example of a Sankey diagram
forked from syntagmatic's block: Issue Breakdown
A refactored version of Sara Quigley's Issue Breakdown as a simple example of a Sankey diagram
forked from syntagmatic's block: Issue Breakdown
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<title>Issue Breakdown</title> | |
<style> | |
body { | |
background: #fcfcfa; | |
width: 944px; | |
margin: 10px; | |
} | |
svg { | |
font: 500 14px "arial", sans-serif; | |
fill: #023848; | |
} | |
.node { | |
transition: opacity 0.25s; | |
} | |
.node rect { | |
fill-opacity: .75; | |
shape-rendering: crispEdges; | |
} | |
.node text { | |
pointer-events: none; | |
font-size: 9px; | |
opacity: 0; | |
transition: opacity 0.25s; | |
} | |
.link { | |
fill: none; | |
stroke: #969696; | |
stroke-opacity: .1; | |
} | |
.link:hover { | |
stroke-opacity: .6; | |
} | |
</style> | |
<body> | |
<script src="http://d3js.org/d3.v3.min.js"></script> | |
<script src="http://bost.ocks.org/mike/sankey/sankey.js"></script> | |
<script> | |
var margin = {top: 1, right: 30, bottom: 1, left: 1}, | |
width = 940 - margin.left - margin.right, | |
height = 480 - margin.top - margin.bottom; | |
var category20b_sq = [ | |
'#393b79', '#5254a3', '#6b6ecf', '#9c9ede', | |
'#8c6d31', '#bd9e39', '#e7ba52', '#e7cb94', | |
'#843c39', '#ad494a', '#d6616b', '#e7969c', | |
'#637939', '#8ca252', '#b5cf6b', '#cedb9c', | |
'#ce6dbd', '#a55194', '#de9ed6', '#7b4173' | |
]; | |
var color = d3.scale.ordinal() | |
.range(category20b_sq); | |
var svg = d3.select("body").append("svg") | |
.attr("width", width + margin.left + margin.right) | |
.attr("height", height + margin.top + margin.bottom) | |
.append("g") | |
.attr("transform", "translate(" + margin.left + "," + margin.top + ")"); | |
var sankey = d3.sankey() | |
.nodeWidth(16) | |
.nodePadding(10) | |
.size([width, height]); | |
var path = sankey.link() | |
.curvature(0.3); | |
d3.json("sankey.json", function(energy) { | |
sankey | |
.nodes(energy.nodes) | |
.links(energy.links) | |
.layout(20); | |
var link = svg.append("g").selectAll(".link") | |
.data(energy.links) | |
.enter().append("path") | |
.attr("class", "link") | |
.attr("d", path) | |
.style("stroke-width", function(d) { return Math.max(1, d.dy); }) | |
.sort(function(a, b) { return b.dy - a.dy; }) | |
.on("mouseover", function(d) { | |
d3.selectAll(".node") | |
.style("opacity", 0.3) | |
.filter(function(p) { | |
return d.source.name == p.name || | |
d.target.name == p.name; | |
}) | |
.style("opacity", 1) | |
.selectAll("text") | |
.style("opacity", 1); | |
}) | |
.on("mouseout", function(d) { | |
d3.selectAll(".node") | |
.style("opacity", null) | |
.selectAll("text") | |
.style("opacity", 0); | |
}); | |
var node = svg.append("g").selectAll(".node") | |
.data(energy.nodes) | |
.enter().append("g") | |
.attr("class", "node") | |
.attr("transform", function(d) { return "translate(" + d.x + "," + d.y + ")"; }); | |
node.append("rect") | |
.attr("height", function(d) { return d.dy; }) | |
.attr("width", sankey.nodeWidth()) | |
.style("fill", function(d) { return color(d.category); }) | |
.append("title") | |
.text(function(d) { return d.name; }); | |
node.append("text") | |
.attr("x", 6 + sankey.nodeWidth()) | |
.attr("y", function(d) { return d.dy / 2; }) | |
.attr("dy", ".35em") | |
.attr("text-anchor", "start") | |
.attr("transform", null) | |
.text(function(d) { return d.name; }) | |
.filter(function(d) { return d.x > width * .9; }) | |
.attr("class", function(d) { return d.category ; }) | |
.attr("text-anchor", "end") | |
.attr("transform", function(d) { return "translate (" + ((d.dy / 2) + 30) + "," + (d.dy / 2) + ") rotate(90)"; }); | |
}); | |
</script> |
{ | |
"nodes": [{"name": "Where is my aid?","category": "myAidIsQuestion"}, | |
{"name": "How much aid am I getting?","category": "myAidIsQuestion"}, | |
{"name": "Why am I not getting more aid?","category": "myAidIsQuestion"}, | |
{"name": "Did my payment go through?","category": "lookingAtMyAccount"}, | |
{"name": "What does T40SFLKOUTSIDE NP SPONSOR1/SP mean?","category": "whatDoesThisMean"}, | |
{"name": "Why do I owe $190 for housing? ","category": "lookingAtMyAccount"}, | |
{"name": "What makes up this large fee amount?","category": "whatDoesThisMean"}, | |
{"name": "How much do I actually owe?","category": "lookingAtMyAccount"}, | |
{"name": "What's the breakdown of my current balance?","category": "whatDoesThisMean"}, | |
{"name": "BearFacts says X, MyFinAid says Y. Which is correct?","category": "lookingAtMyAccount"}, | |
{"name": "Am I registered? Can I enroll in classes?","category": "lookingAtMyAccount"}, | |
{"name": "I need a Financial Aid verification letter","category": "iAmTryingToDoSomething"}, | |
{"name": "Stu is expecting cash","category": "expectingActivity"}, | |
{"name": "Stu has an academic block","category": "blocked"}, | |
{"name": "Stu has an administrative block","category": "blocked"}, | |
{"name": "Stu has a financial block","category": "blocked"}, | |
{"name": "Stu's aid package just changed","category": "whatsHappening"}, | |
{"name": "Stu's aid eligibility changed","category": "whatsHappening"}, | |
{"name": "Stu's aid withheld; missing documentation","category": "expectingActivity"}, | |
{"name": "Stu's aid withheld; aid will pay past charges","category": "whatsHappening"}, | |
{"name": "Stu expects to see a fee remission on account","category": "expectingActivity"}, | |
{"name": "Stu's account has 2 competing awards","category": "whatsHappening"}, | |
{"name": "Stu submitted online payment via Sallie Mae","category": "whatsHappening"}, | |
{"name": "Stu is viewing account","category": "whatsHappening"}, | |
{"name": "3rd party requires Financial Aid eligibility proof","category": "makingARequest"}, | |
{"name": "Awards are not dibursed daily (SuTuTh)","category": "whatsProblematic"}, | |
{"name": "Stus aren't receiving notifications","category": "whatsProblematic"}, | |
{"name": "Stus can't view upcoming refunds","category": "whatsMissing"}, | |
{"name": "Stus can't see previous aid packages","category": "whatsMissing"}, | |
{"name": "Awards paid late in term --> confusing transactions","category": "whatsConfusing"}, | |
{"name": "Confusing to track one's aid & budget/plan ","category": "whatsConfusing"}, | |
{"name": "Confusing to see how awards are applied to charges","category": "whatsConfusing"}, | |
{"name": "Multi-system data flow leads to delays","category": "whatsProblematic"}, | |
{"name": "Competing grad awards result in confusing transactions","category": "whatsConfusing"}, | |
{"name": "Transaction descriptions are cryptic","category": "whatsBaffling"}, | |
{"name": "Stus see aggregated transaction amounts","category": "whatsMissing"}, | |
{"name": "Transaction details are scattered in time & space","category": "whatsConfusing"}, | |
{"name": "Future-due charges are included in account balance","category": "whatsConfusing"}, | |
{"name": "Systems are often a day behind each other","category": "whatsMissing"}, | |
{"name": "Imperfect CARS <--> BearFacts interface","category": "whatsProblematic"}, | |
{"name": "Imperfect GLOW <--> MyFinAid interface","category": "whatsProblematic"}, | |
{"name": "Confusing to know how to release one's block ","category": "whatsBaffling"}, | |
{"name": "Incomplete messaging around Reg status","category": "whatsBaffling"}, | |
{"name": "BearFacts refund data is incomplete","category": "whatsMissing"}, | |
{"name": "Stus request verification letter in-person","category": "whatsProblematic"}, | |
{"name": "No systematic way to release aid despite financial block","category": "whatsProblematic"}, | |
{"name": "Pay awards daily from ProSAM --> CARS","category": "Tech"}, | |
{"name": "Display aid packaging history to students","category": "Tech"}, | |
{"name": "Revise and streamine messaging to students","category": "Design"}, | |
{"name": "Display aid amounts and status wrt budget","category": "Design"}, | |
{"name": "Display how aid/payments were applied to charges/fees","category": "Design"}, | |
{"name": "Improve unapplieds process in CARS","category": "Process"}, | |
{"name": "Clearly indicate pending payments to account balance","category": "Design "}, | |
{"name": "Display clear & descriptive transactions to Students","category": "Design"}, | |
{"name": "Pay all aid to Student AR via a central packaging engine","category": "Process"}, | |
{"name": "Standardize award entry processes & nomenclature","category": "Process"}, | |
{"name": "Display timely Stu account activity detail in one place","category": "Tech"}, | |
{"name": "Display future-dated dept awards to students","category": "Process"}, | |
{"name": "Hide the BearFacts Awards screen","category": "Tech"}, | |
{"name": "Display refund data for prior terms","category": "Tech"}, | |
{"name": "Provide self-service FinAid Verification letter generation","category": "Process"}, | |
{"name": "Reduce the number of interfaces in the data flow","category": "Tech"}, | |
{"name": "Clearly distinguish btw future & current charges","category": "Design"}, | |
{"name": "Release hold due to financial block for select students","category": "Tech"}, | |
{"name": "Display future refunds to Students","category": "Design"}, | |
{"name": "Process","category": "businessProcess"}, | |
{"name": "Design","category": "uiDesign"}, | |
{"name": "Tech","category": "sysInfrastructure"} | |
], | |
"links": [{"source": 0,"target": 12,"value": 240}, | |
{"source": 0,"target": 13,"value": 60}, | |
{"source": 0,"target": 14,"value": 60}, | |
{"source": 0,"target": 15,"value": 100}, | |
{"source": 0,"target": 18,"value": 90}, | |
{"source": 1,"target": 16,"value": 260}, | |
{"source": 1,"target": 17,"value": 60}, | |
{"source": 2,"target": 17,"value": 60}, | |
{"source": 0,"target": 19,"value": 270}, | |
{"source": 0,"target": 20,"value": 110}, | |
{"source": 1,"target": 21,"value": 80}, | |
{"source": 2,"target": 21,"value": 60}, | |
{"source": 3,"target": 22,"value": 60}, | |
{"source": 4,"target": 23,"value": 120}, | |
{"source": 5,"target": 23,"value": 120}, | |
{"source": 6,"target": 23,"value": 120}, | |
{"source": 7,"target": 23,"value": 120}, | |
{"source": 8,"target": 23,"value": 120}, | |
{"source": 9,"target": 23,"value": 120}, | |
{"source": 10,"target": 23,"value": 120}, | |
{"source": 11,"target": 24,"value": 80}, | |
{"source": 12,"target": 25,"value": 80}, | |
{"source": 12,"target": 27,"value": 160}, | |
{"source": 13,"target": 26,"value": 60}, | |
{"source": 13,"target": 41,"value": 60}, | |
{"source": 14,"target": 41,"value": 60}, | |
{"source": 14,"target": 26,"value": 80}, | |
{"source": 15,"target": 41,"value": 60}, | |
{"source": 15,"target": 26,"value": 100}, | |
{"source": 16,"target": 28,"value": 80}, | |
{"source": 16,"target": 29,"value": 260}, | |
{"source": 17,"target": 26,"value": 120}, | |
{"source": 18,"target": 26,"value": 100}, | |
{"source": 19,"target": 30,"value": 200}, | |
{"source": 19,"target": 45,"value": 70}, | |
{"source": 20,"target": 32,"value": 60}, | |
{"source": 20,"target": 31,"value": 60}, | |
{"source": 21,"target": 33,"value": 80}, | |
{"source": 22,"target": 26,"value": 60}, | |
{"source": 23,"target": 34,"value": 200}, | |
{"source": 23,"target": 35,"value": 60}, | |
{"source": 23,"target": 36,"value": 100}, | |
{"source": 23,"target": 37,"value": 60}, | |
{"source": 23,"target": 38,"value": 90}, | |
{"source": 23,"target": 39,"value": 100}, | |
{"source": 23,"target": 40,"value": 60}, | |
{"source": 23,"target": 41,"value": 60}, | |
{"source": 23,"target": 42,"value": 70}, | |
{"source": 23,"target": 43,"value": 60}, | |
{"source": 24,"target": 44,"value": 60}, | |
{"source": 25,"target": 46,"value": 100}, | |
{"source": 26,"target": 48,"value": 400}, | |
{"source": 27,"target": 48,"value": 110}, | |
{"source": 26,"target": 52,"value": 60}, | |
{"source": 27,"target": 64,"value": 110}, | |
{"source": 28,"target": 47,"value": 60}, | |
{"source": 29,"target": 50,"value": 60}, | |
{"source": 29,"target": 53,"value": 60}, | |
{"source": 29,"target": 55,"value": 80}, | |
{"source": 29,"target": 54,"value": 60}, | |
{"source": 30,"target": 49,"value": 200}, | |
{"source": 29,"target": 57,"value": 90}, | |
{"source": 31,"target": 50,"value": 70}, | |
{"source": 32,"target": 61,"value": 110}, | |
{"source": 33,"target": 50,"value": 60}, | |
{"source": 33,"target": 51,"value": 60}, | |
{"source": 33,"target": 54,"value": 60}, | |
{"source": 34,"target": 51,"value": 60}, | |
{"source": 34,"target": 53,"value": 110}, | |
{"source": 34,"target": 55,"value": 60}, | |
{"source": 35,"target": 56,"value": 90}, | |
{"source": 36,"target": 56,"value": 90}, | |
{"source": 37,"target": 62,"value": 70}, | |
{"source": 38,"target": 61,"value": 140}, | |
{"source": 39,"target": 58,"value": 60}, | |
{"source": 40,"target": 54,"value": 80}, | |
{"source": 41,"target": 48,"value": 200}, | |
{"source": 42,"target": 48,"value": 100}, | |
{"source": 43,"target": 59,"value": 60}, | |
{"source": 44,"target": 60,"value": 60}, | |
{"source": 45,"target": 63,"value": 60}, | |
{"source": 46,"target": 67,"value": 100}, | |
{"source": 47,"target": 66,"value": 60}, | |
{"source": 48,"target": 66,"value": 810}, | |
{"source": 49,"target": 66,"value": 200}, | |
{"source": 50,"target": 66,"value": 60}, | |
{"source": 51,"target": 65,"value": 60}, | |
{"source": 51,"target": 67,"value": 60}, | |
{"source": 52,"target": 66,"value": 60}, | |
{"source": 53,"target": 66,"value": 85}, | |
{"source": 53,"target": 65,"value": 85}, | |
{"source": 54,"target": 65,"value": 90}, | |
{"source": 54,"target": 67,"value": 90}, | |
{"source": 55,"target": 65,"value": 140}, | |
{"source": 56,"target": 65,"value": 60}, | |
{"source": 56,"target": 66,"value": 60}, | |
{"source": 56,"target": 67,"value": 60}, | |
{"source": 57,"target": 65,"value": 45}, | |
{"source": 57,"target": 67,"value": 45}, | |
{"source": 58,"target": 67,"value": 30}, | |
{"source": 58,"target": 66,"value": 30}, | |
{"source": 59,"target": 67,"value": 60}, | |
{"source": 60,"target": 65,"value": 20}, | |
{"source": 60,"target": 66,"value": 20}, | |
{"source": 60,"target": 67,"value": 20}, | |
{"source": 61,"target": 65,"value": 80}, | |
{"source": 61,"target": 66,"value": 80}, | |
{"source": 61,"target": 67,"value": 80}, | |
{"source": 62,"target": 66,"value": 70}, | |
{"source": 63,"target": 67,"value": 60}, | |
{"source": 64,"target": 65,"value": 60}, | |
{"source": 64,"target": 66,"value": 50}] | |
} |