|
<!DOCTYPE html> |
|
<html> |
|
<head> |
|
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/> |
|
<title>Chord Diagram - ICTS globaal</title> |
|
<script src="http://d3js.org/d3.v3.min.js"></script> |
|
<!-- jQuery --> |
|
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> |
|
<!-- Bootstrap 3 --> |
|
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css"> |
|
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script> |
|
|
|
<style> |
|
body { |
|
/*background: url(http://mbostock.github.io/d3/talk/20111018/texture-noise.png);*/ |
|
overflow: hidden; |
|
margin: 0; |
|
font-size: 14px; |
|
font-family: "Helvetica Neue", Helvetica; |
|
} |
|
|
|
#footer { |
|
position: absolute; |
|
top: 0; |
|
z-index: 1; |
|
display: block; |
|
font-size: 36px; |
|
font-weight: 300; |
|
text-shadow: 0 1px 0 #fff; |
|
top: 640px; |
|
right: 140px; |
|
text-align: right; |
|
} |
|
|
|
line { |
|
stroke: #000; |
|
stroke-width: 1.px; |
|
} |
|
|
|
.hint { |
|
position: absolute; |
|
right: 0; |
|
width: 350px; |
|
font-size: 12px; |
|
color: #999; |
|
} |
|
|
|
text { |
|
font-size: 10px; |
|
} |
|
|
|
.titles{ |
|
font-size: 14px; |
|
} |
|
|
|
path.chord { |
|
fill-opacity: .80; |
|
} |
|
</style> |
|
</head> |
|
<body> |
|
<br><br> |
|
<div id="cont" class="container-fluid"> |
|
<div class="row text-center"> |
|
<div class="col-sm-12 column"><div id="chart"></div></div> |
|
</div> |
|
</div> |
|
|
|
<script type="text/javascript"> |
|
|
|
var NameProvider = ["domein HR","Domein ICTS","Logistiek en Financien","Domein ISP-ES","Domein onderwijs","Domein Studenten","CRM","Domein Onderzoek","O.PC-Klassen","O.Lokale infrastructuur","Systeembeheer Lokale infrastructuur","AIX","Linux","Windows","Datacenter","Netwerken","Fac. Inter-intranet","Fac. Onderwijs","Fac. Onderzoek","Fac. Communicatie en Samenwerking","CCIS","CCBI","Beveiligingscoordinator","Klanten- en Servicebeheer","Communicatie en Opleiding","Aankoopadvies","Servicepunt"]; |
|
|
|
var matrix = [ |
|
[2.7907, 0.0137, 0.0068, 0, 0.0034, 0.0137, 0.0017, 0.0051, 0, 0.0068, 0, 0, 0, 0, 0, 0, 0.024, 0, 0, 0.0034, 0.0291, 0.0034, 0, 0, 0, 0, 0.0822], //domein HR |
|
[0.0171, 0.928, 0, 0, 0.0171, 0.0017, 0.0017, 0.0034, 0, 0.0017, 0, 0.0017, 0, 0, 0, 0, 0, 0, 0, 0.0034, 0, 0.0017, 0, 0, 0, 0, 0.0017], //domein ICTS |
|
[0.0034, 0.0188, 2.575, 0, 0.0017, 0.0103, 0, 0.0479, 0, 0.012, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.0017, 0, 0, 0, 0, 0, 0, 0.0017], //LoFi |
|
[0, 0, 0, 1.4553, 0.0805, 0.0839, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.0171, 0, 0, 0, 0, 0.0017], //Domein ISP-ES |
|
[0.0103, 0.0325, 0.0051, 0.1181, 1.2019, 0.0788, 0.0017, 0, 0, 0.0051, 0, 0, 0, 0, 0, 0, 0.0428, 0.012, 0, 0, 0.0051, 0.0068, 0, 0.0017, 0, 0, 0.0103], //Domein Onderwijs |
|
[0.0034, 0.0171, 0.0086, 0.1301, 0.0479, 2.6212, 0.0017, 0, 0, 0.012, 0, 0, 0, 0, 0, 0, 0.0051, 0, 0, 0, 0.012, 0.0051, 0, 0, 0, 0, 0.0017], //Domein Studenten |
|
[0.0017, 0.0051, 0.0017, 0, 0, 0.0017, 1.3799, 0, 0, 0.0034, 0.0154, 0, 0, 0, 0, 0, 0.0017, 0, 0, 0.0051, 0.0051, 0.0051, 0.0017, 0, 0.0017, 0, 0.0017], //CRM |
|
[0.0086, 0.0017, 0.0377, 0.0017, 0, 0.0394, 0, 1.3594, 0, 0, 0, 0, 0, 0, 0, 0, 0.0034, 0, 0, 0, 0, 0.0017, 0, 0, 0, 0, 0.0034], //Domein Onderzoek |
|
[0, 0, 0, 0, 0, 0, 0, 0, 1.4193, 0, 0, 0, 0, 0, 0, 0.0034, 0, 0, 0, 0.0017, 0.0017, 0, 0, 0.0017, 0, 0, 0], //O. PC-Klassen |
|
[0, 0, 0, 0, 0, 0, 0, 0, 0.0017, 0.9314, 0.0034, 0, 0.0017, 0, 0, 0.0137, 0.0017, 0, 0, 0.0086, 0, 0, 0, 0, 0, 0, 0.0017], //O. lokale infrastructuur |
|
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.0017, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.0017, 0, 0, 0, 0, 0, 0], //Sys. lokale infrastructuur |
|
[0, 0.0017, 0.0017, 0, 0, 0, 0, 0, 0, 0, 0, 0.0017, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], //AIX |
|
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.0925, 0, 0, 0.0051, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], //Linux |
|
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.0394, 0, 0.0017, 0, 0, 0, 0, 0.0034, 0, 0, 0, 0, 0, 0], //Windows |
|
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.3561, 0.0034, 0, 0, 0, 0, 0, 0, 0, 0.0017, 0, 0, 0], //Datacenter |
|
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0.0017, 0.0017, 0, 0, 0.0017, 0, 1.1985, 0.0017, 0, 0, 0.0017, 0.012, 0, 0.0068, 0.0017, 0, 0, 0.0034], //Netwerken |
|
[0, 0.0017, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.7773, 0.0017, 0, 0, 0.0017, 0, 0, 0.0017, 0, 0, 0], //Fac.interintranet |
|
[0, 0, 0, 0.0034, 0, 0.0051, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.0103, 2.5082, 0, 0.0017, 0.0068, 0, 0, 0, 0, 0, 0.0017], //Fac.Onderwijs |
|
[0.0017, 0, 0, 0, 0, 0, 0.0034, 0, 0, 0, 0, 0, 0.0034, 0, 0, 0.0017, 0, 0, 5.8451, 0, 0, 0, 0.0017, 0.2774, 0.0017, 0.0017, 0.0017], //Fac.Onderzoek |
|
[0.0086, 0, 0, 0, 0, 0, 0, 0, 0, 0.0068, 0, 0, 0.0017, 0, 0, 0.0086, 0.0017, 0.0051, 0, 1.154, 0.0034, 0, 0.0034, 0, 0, 0, 0], //Fac.CommSamenw |
|
[0.0137, 0, 0.0017, 0, 0, 0.0034, 0, 0.0017, 0, 0, 0.0017, 0, 0, 0, 0, 0.0017, 0.0034, 0, 0, 0.0068, 0.2859, 0, 0, 0, 0, 0, 0.0325], //CCIS |
|
[0, 0, 0.0051, 0.0017, 0, 0.0051, 0.0017, 0.0017, 0, 0.0017, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.0017, 1.0957, 0, 0, 0, 0, 0], //CCBI |
|
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], //Beveiligingscoördinator |
|
[0, 0, 0, 0, 0.0034, 0, 0, 0, 0.0257, 0.0325, 0.0103, 0, 0.0223, 0.0154, 0.2551, 0.1798, 0.2123, 0, 0.1318, 0.0257, 0.0514, 0, 0.0017, 2.3969, 0.0017, 0.969, 0.0548], //Klanten- en Servicebeheer |
|
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.0034, 0.0223, 0, 0.012, 0.0017, 0.0017, 0, 0.0034, 0.0034, 0.0188, 0.0017, 0.0188], //Communicatie & Opleiding |
|
[0, 0.0034, 0.012, 0, 0, 0, 0, 0, 0, 0.0137, 0, 0, 0, 0, 0.0017, 0.0017, 0, 0, 0.0154, 0.0137, 0.0051, 0, 0, 0.2397, 0, 13.8098, 0.0616], //Aankoopadvies |
|
[0.529, 0.1558, 1.1625, 0.6146, 0.3065, 0.8304, 0.214, 0.303, 0.3647, 5.2304, 0.3373, 0.0034, 0.0685, 0.0599, 0.125, 1.2036, 1.0838, 1.0067, 1.5084, 1.4228, 0.6386, 0.0753, 0.6951, 0.2277, 0.1883, 1.5409, 29.6312], //Servicepunt |
|
|
|
]; |
|
|
|
var colors = ["#C4C4C4","#919191","#4f4f4f","#EC1D25","#C8125C","#a912c3","#10218B","#2dc3fe","#9cf16e","#24d613","#0d9a2c","#2dc3fe","#9cf16e","#24d613","#0d9a2c","#bde3f8","#bde3f8"]; |
|
|
|
var chord = d3.layout.chord() |
|
.padding(.04) |
|
.sortSubgroups(d3.descending) //sort the chords inside an arc from high to low |
|
.sortChords(d3.descending) //which chord should be shown on top when chords cross. Now the biggest chord is at the bottom |
|
.matrix(matrix); |
|
|
|
var width = 1000, |
|
height = 1000, |
|
innerRadius = Math.min(width, height) * .41, |
|
outerRadius = innerRadius * 1.05; |
|
|
|
var fill = d3.scale.ordinal() |
|
.domain(d3.range(NameProvider.length)) |
|
.range(colors); |
|
|
|
var arc = d3.svg.arc() |
|
.innerRadius(innerRadius) |
|
.outerRadius(outerRadius); |
|
|
|
var svg = d3.select("#chart").append("svg:svg") |
|
.attr("width", width) |
|
.attr("height", height+50) |
|
.append("svg:g") |
|
.attr("transform", "translate(" + width / 2 + "," + (height / 2+30) + ")"); |
|
|
|
//////////////////////////////////////////////////////////// |
|
////////////////// Draw outer Arcs ///////////////////////// |
|
//////////////////////////////////////////////////////////// |
|
|
|
var g = svg.selectAll("g.group") |
|
.data(chord.groups) |
|
.enter().append("svg:g") |
|
.attr("class", "group") |
|
.on("mouseover", fade(.02)) |
|
.on("mouseout", fade(.80)); |
|
|
|
g.append("svg:path") |
|
.style("stroke", function(d) { return fill(d.index); }) |
|
.style("fill", function(d) { return fill(d.index); }) |
|
.attr("d", arc); |
|
|
|
//////////////////////////////////////////////////////////// |
|
////////////////// Append Ticks //////////////////////////// |
|
//////////////////////////////////////////////////////////// |
|
|
|
var ticks = svg.append("svg:g").selectAll("g.ticks") |
|
.data(chord.groups) |
|
.enter().append("svg:g").selectAll("g.ticks") |
|
.attr("class", "ticks") |
|
.data(groupTicks) |
|
.enter().append("svg:g") |
|
.attr("transform", function(d) { |
|
return "rotate(" + (d.angle * 180 / Math.PI - 90) + ")" |
|
+ "translate(" + outerRadius+40 + ",0)"; |
|
}); |
|
|
|
ticks.append("svg:line") |
|
.attr("x1", 1) |
|
.attr("y1", 0) |
|
.attr("x2", 5) |
|
.attr("y2", 0) |
|
.style("stroke", "#000"); |
|
|
|
ticks.append("svg:text") |
|
.attr("x", 8) |
|
.attr("dy", ".35em") |
|
.attr("transform", function(d) { return d.angle > Math.PI ? "rotate(180)translate(-16)" : null; }) |
|
.style("text-anchor", function(d) { return d.angle > Math.PI ? "end" : null; }) |
|
.text(function(d) { return d.label; }); |
|
|
|
//////////////////////////////////////////////////////////// |
|
////////////////// Append Names //////////////////////////// |
|
//////////////////////////////////////////////////////////// |
|
|
|
g.append("svg:text") |
|
.each(function(d) { d.angle = (d.startAngle + d.endAngle) / 2; }) |
|
.attr("dy", ".35em") |
|
.attr("class", "titles") |
|
.attr("text-anchor", function(d) { return d.angle > Math.PI ? "end" : null; }) |
|
.attr("transform", function(d) { |
|
return "rotate(" + (d.angle * 180 / Math.PI - 90) + ")" |
|
+ "translate(" + (innerRadius + 55) + ")" |
|
+ (d.angle > Math.PI ? "rotate(180)" : ""); |
|
}) |
|
.text(function(d,i) { return NameProvider[i]; }); |
|
|
|
//////////////////////////////////////////////////////////// |
|
////////////////// Draw inner chords /////////////////////// |
|
//////////////////////////////////////////////////////////// |
|
|
|
svg.selectAll("path.chord") |
|
.data(chord.chords) |
|
.enter().append("svg:path") |
|
.attr("class", "chord") |
|
.style("stroke", function(d) { return d3.rgb(fill(d.source.index)).darker(); }) |
|
.style("fill", function(d) { return fill(d.source.index); }) |
|
.attr("d", d3.svg.chord().radius(innerRadius)); |
|
|
|
//////////////////////////////////////////////////////////// |
|
////////////////// Extra Functions ///////////////////////// |
|
//////////////////////////////////////////////////////////// |
|
|
|
// Returns an event handler for fading a given chord group. |
|
function fade(opacity) { |
|
return function(d, i) { |
|
svg.selectAll("path.chord") |
|
.filter(function(d) { return d.source.index != i && d.target.index != i; }) |
|
.transition() |
|
.style("stroke-opacity", opacity) |
|
.style("fill-opacity", opacity); |
|
}; |
|
}//fade |
|
|
|
// Returns an array of tick angles and labels, given a group. |
|
function groupTicks(d) { |
|
var k = (d.endAngle - d.startAngle) / d.value; |
|
return d3.range(0, d.value, 1).map(function(v, i) { |
|
return { |
|
angle: v * k + d.startAngle, |
|
label: i % 5 ? null : v + "%" |
|
}; |
|
}); |
|
}//groupTicks |
|
|
|
</script> |
|
</body> |
|
</html> |