D3.js Adding links between elements in a radial tree (Hierarchical edge bundling elements)

ساخت وبلاگ

Vote count: 0

A couple of months ago, I tried combining Hierarchical Edge Bundling and Radial Reingold–Tilford Tree using d3.js

enter image description here

I started from the HEB and tried to make it into a tree. Things have not worked out the way I wanted, and I realized it might be better to start from a collapsible radial tree (not Reingold Tilford), with a different angle.

enter image description here

Here is a JSFiddle of the radial tree

The data model has also changed, as elements now have a name, children and imports (links).

var flare =
{ "name": "root", "children": [ { "name": "test1.parent1","children": [ {"name": "test1.child11","children": [ {"name": "test1.child111"}, {"name": "test1.child112"} ]} ],"imports": ["test2.parent2","test3.parent3","test4.parent4"] }, { "name": "test2.parent2","children": [ {"name": "test2.child21"}, {"name": "test2.child22"}, {"name": "test2.child28","children":[ {"name": "test2.child281"}, {"name": "test2.child282"} ]} ],"imports": ["test3.parent3"] }, {"name": "test3.parent3","imports": ["test4.parent4"]}, { "name": "test4.parent4","children": [ {"name": "test4.child41"}, {"name": "test4.child42"} ] } ]
};

To start slowly, I would like to combine the non-interactive Hierarchical edge bundling from Mike Bostock with the current JSFiddle, but keeping in mind that the interactions will be part of it later on.

Also, only the first level has to have links (parent-parent link) as shown below (the result that I want):

enter image description here

My biggest issue currently is that the HEB has no "root", but the tree starts with a single item. So everything I have tried so far has led to a big mess at the center of the tree.

Note that there is a circle at the center of the tree to cover the root to level 1 links, so the tree starts at level 1 (parents).

var circle = svg.append("circle") .attr("cx", 0) .attr("cy", 0) .attr("r", diameter - 725.3) .style("fill", "#F3F5F6") .style("stroke-width", 0.2) .style("stroke", "black");

The links between parents have to update when a level is (un)collapsed, like it does for the nodes and the links between levels. Also, the data template might change if necessary, but all 3 pieces of information are important (name, children and imports)

asked 15 secs ago

back soft...
ما را در سایت back soft دنبال می کنید

برچسب : d3 js add links,d3 js append link, نویسنده : استخدام کار backsoft بازدید : 366 تاريخ : چهارشنبه 5 آبان 1395 ساعت: 8:54