Exploring the fusion of hierarchical edge bundling and radial Reingold-Tilford tree visualization techniques with d3.js and data integration

I'm interested in combining the concepts of Hierarchical Edge Bundling and Radial Reingold–Tilford Tree. The end result would resemble this rough sketch:

The visualization I have created showing simple data in HEB can be found here: https://fiddle.jshell.net/d1766z4r/2/

I have already started combining the two types of data, as shown in the code snippet below. Feel free to suggest a better way to merge the data if needed.

var classes = [
{"name":"test.cluster1.item1","children": [
      {"name": "test.cluster1.item4","imports":["test.cluster1.item2","test.cluster1.item3"]},
      {"name": "test.cluster1.item5"}
     ]},
{"name":"test.cluster1.item2","imports":["test.cluster1.item3"]},
{"name":"test.cluster1.item3"}
];

As a beginner in d3.js and javascript, I am unsure how to proceed further, especially when it comes to linking specific subitems. Any guidance on implementing interactive features like collapsible elements similar to the Collapsible Tree example would be appreciated.

In the next steps, I plan to work on toggling the visibility of children nodes on click and potentially expanding upon the hierarchy with additional levels of children nodes.

Please feel free to provide partial solutions or advice as every bit counts towards achieving the desired outcome!

Answer №1

It's possible that I may have misunderstood your question, so please let me know if clarification is needed.

To sum it up: Here is a visual representation based on my interpretation of the query. Additional test data has been included.

Hierarchical Edge Bundling is a technique used to visualize non-hierarchical edges within a graph. If you haven't already seen it, here is the link to the paper detailing its implementation in d3.

In the provided example, only leaf nodes are displayed by filtering out other nodes:

node = node
      .data(nodes.filter(function(n) { return !n.children; }))
    .enter().append("text")
      .attr("class", "node")...

The hierarchical relationships in the demonstration are indicated by dots in names, where cluster1 serves as the parent of item1, item2, and item3. To see the effect of including all nodes without filtering, click here.

Therefore, from what I understand, you wish to utilize Hierarchical Edge Bundling for showing non-hierarchical connections (as shown by imports) and 'Radial Reingold–Tilford' for hierarchical associations.

This can be achieved by following these steps:

The proposed data format adjustments are not necessary. The existing structure suffices:

    var classes = [
        {
            "name": "test.cluster1.item1.item4",
            "imports": ["test.cluster1.item2", "test.cluster1.item3"]
        },
        {
            "name": "test.cluster1.item1.item5",
            "imports": []
        }
]

Implement the packageImports function to derive hierarchical edges from the nodes:

nodes.forEach(function (d) {
            if(d.children && d.name !== "") d.children.forEach(function (i) {
                imports.push({
                    source: map[d.name],
                    target: i
                });
            });
        });

Add the radial diagonal generator sourced from the Radial Reingold–Tilford example:

  var diagonal = d3.svg.diagonal.radial()
                .projection(
                        function(d) {
                            debugger;
                            return [d.y, d.x / 180 * Math.PI];
                        }
                );

Insert the hierarchical edges path:

treeLink = treeLink
            .data(getHeirarchialEdges(nodes))
            .enter().append("path")
            .attr("class", "tree-link")
            .attr("d", diagonal);

I've also incorporated mouseover and mouseout functions to emphasize the hierarchical nodes. Feel free to hover over any parent node to observe the effect.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Update the style of elements on each iteration in Symfony2

I have implemented a collapsible CSS page for FAQs. While static text works fine, I am fetching questions and answers from the database which is causing an issue. In its standard CSS version, the collapsible FAQ appears as follows: <div clas ...

When using equal-width columns in Bootstrap, the columns will be stacked one on top of the other

When I utilize Bootstrap 5, I am encountering an issue where equal width columns are being displayed one underneath the other. To illustrate, here is a simple example directly from the Bootstrap website: <link rel="stylesheet" href="https://cdn.jsd ...

Flashing on objects, Chrome-exclusive, utilizing background-blend-mode exclusively

Our website, www.desirio.com, utilizes a background-image on the body with the following CSS property: background-blend-mode: luminosity An issue we have noticed in Chrome is that when hovering over elements, strange white lines randomly flash on the scr ...

Using JSON data to populate the jQuery UI Datepicker

Is it possible to populate this jQuery UI datepicker calendar with data from a JSON file containing all non-working days for the years 2017 and 2018? P.S. return [!(month == 8 && day == 27), 'highlight', highlight]; - This example demons ...

Updating the parent's data by modifying data in the child component in VueJS

When I use multiple components together for reusability, the main component performs an AJAX call to retrieve data. This data is then passed down through different components in a chain of events. <input-clone endpoint="/api/website/{{ $website->id ...

Showcasing a JavaScript array retrieved through JSON on a web page

Apologies if I am causing any inconvenience again =x Thanks to the assistance from everyone, especially Scott Harwell, I successfully passed my php array to a js array using the code below: var horse_array = <?php echo json_encode($horse_info);?>; ...

If all input values within every li element are equal to zero in jQuery

Currently, I am facing an issue that I need to solve. I have multiple inputs and my goal is to check if each input has a value of 0 and is also checked. After spending an entire day searching for a solution, I am still clueless about how to proceed. I att ...

Converting a string to JSON using Poco/JSON or rapidjson libraries

Is there a way to convert the given std::string message into a JSON object for easier traversal and key/value pair retrieval? I am considering using either rapidjson or Poco::JSON for this task. std::string request; std::cout << request << st ...

Tips for using jQuery to add several image source URLs to an array

My JavaScript code uses jQuery to collect all image sources on document load and store them in an array: var sliderImg = []; sliderImg.push($('.thumbnail').children('img').attr('src')); Then, I have a click event set up to a ...

Sending an array from JavaScript to Ruby using Sinatra

My goal is to transfer a 2D array from JavaScript to something that Ruby can interpret. All elements in the array are strings. I have been using gon-sinatra, but it doesn't fulfill all my requirements. I tried storing the string I want to pass in &ap ...

There are currently no results available through the pixabay API

My attempts to utilize the Pixabay API have been unsuccessful as I am not receiving any results. After checking with console.log, it seems that the API is not sending any data. Any assistance would be greatly appreciated. Thank you. Below is my code utili ...

Display partial content in Ruby on Rails 5 using link_to without the need to refresh the view

I want to display a partial when a button is clicked without refreshing the page. This is what I attempted in my exploitation_controller: def show_content respond_to do |format| format.js end end In routes.rb: get '/exploi ...

Integrating new components into JSON data

I started by creating a JSON document in my code using the following syntax: let jsonData = []; To populate this document, I utilized the '.push()' method to add elements in this manner: jsonData.push({type: "example", value: "123"}); Eventua ...

Enter the specified text in the input field

My challenge involves dynamically changing a string value that needs to be inserted into an input field. (async () => { let index = 1004327; let browser = await puppeteer.launch({ headless: true, }); let page = await browser.newPage(); ...

Transferring information between app.js and HTML files

My initial route with Node.js and Express is responsible for determining the client's language : var express = require('express'), app = module.exports = express(), server = require('http').createServer(app), io = requ ...

NodeJS - session information lost after building ReactJavaScript application

I've created a NodeJS web application with basic functionality for user login and pulling data from MySql based on session information. The app is functioning as intended (Link). However, when I implement the client-side in React, the session data is ...

Is it possible to use ngFor with an object instead of an array?

Encountering this console error: Unable to locate a supporting object '[object Object]' of type 'object'. NgFor specifically requires binding to Iterables like Arrays. services.ts private url = "https://api.iextrading.com ...

What is the process of obtaining the Album ID?

Can someone help me identify the unique identifier in this URL? I don't need to use any coding, I just require the number for a JSON script that is already functional. Although I am able to extract the correct number from other pages, I can't s ...

Issue encountered while installing semantic-ui-react and semantic-ui-css with React using npm

Issue encountered during the semantic UI installation via npm install Any solutions for this problem? ...

Adding multiple text as label and sublabel in a React MUI Tooltip can be achieved by utilizing the appropriate

I'm struggling to incorporate a MaterialUI Tooltip into my React application with two separate text lines. The first line should serve as the main title, while the second line functions as a sublabel. In this screenshot provided, you can see where I ...