This is a quick migration of old tests using D3js.
Using the same json file
{
"name": "Carte des services informatiques",
"children": [
{
"name": "Services utilisateurs",
"children" : [
{
"name": "Comptes et accès",
"children" : [
{ "name": "Régles générales", "size": 500},
{ "name": "Création compte", "size": 500},
{ "name": "Supression compte", "size": 500},
{ "name": "Modification du mot de passe", "size": 500},
{ "name": "Modification des informations personnelles", "size": 500}
]
},
[...]
I wrote some simple D3js javascript code following a tutorial
var diameter = 960;
var tree_r = d3.layout.tree()
.size([360, diameter / 2 - 120])
.separation(function(a, b) { return (a.parent == b.parent ? 1 : 2) / a.depth; });
var diagonal_r = d3.svg.diagonal.radial()
.projection(function(d) { return [d.y, d.x / 180 * Math.PI]; });
var svg_r = d3.select(".d3-1").append("svg")
.attr("width", diameter)
.attr("height", diameter - 150)
.append("g")
.attr("transform", "translate(" + diameter / 2 + "," + diameter / 2 + ")");
d3.json("ias.json", function(error, root) {
var nodes = tree_r.nodes(root),
links = tree_r.links(nodes);
var link_r = svg_r.selectAll(".link")
.data(links)
.enter().append("path")
.attr("class", "link")
.attr("d", diagonal_r);
var node_r = svg_r.selectAll(".node")
.data(nodes)
.enter().append("g")
.attr("class", "node")
.attr("transform", function(d) { return "rotate(" + (d.x - 90) + ")translate(" + d.y + ")"; })
node_r.append("circle")
.attr("r", 4.5);
node_r.append("text")
.attr("dy", ".31em")
.attr("text-anchor", function(d) { return d.x < 180 ? "start" : "end"; })
.attr("transform", function(d) { return d.x < 180 ? "translate(8)" : "rotate(180)translate(-8)"; })
.text(function(d) { return d.name; });
});
d3.select(".d3-1").style("height", diameter - 150 + "px");
And putting everything back to pelican_dynamic div, magic happens :
and following the D3js tutorials :
or even with a bit of dynamics :