Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8779479
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T19:47:51+00:00 2026-06-13T19:47:51+00:00

I have a force-directed graph where on node mouseover the elements which are not

  • 0

I have a force-directed graph where on node mouseover the elements which are not connected to the current node are faded out, based on the following example. The problem is that if the cursor is moved fast and it crosses a link which is not part of the target node’s connections, it is still shown in full opacity since the crossed link mouseover is triggered on the way, but apparently does not have time to complete its mouseout function. For instance you can see this:
fading problem

In the picture the mouse is moved fast from top to bottom and the cursor is stopped at the HSA-MIR-424. The connections to the target node are shown correctly but also three extra links are visible since their mouseover is triggered when the cursor crosses them. If I repeat the top-to-bottom motion slowly to the same node or move bottom-to-top to the node such problem is not seen (since there are no links to be crossed in that direction, in the picture).

How can this problem be avoided?

Relevant parts of the code, link mouseover/mouseout:

    .on("mouseover", function(d) {
      var selection = d3.select(this);
      var initialWidth = Number( selection.style("stroke-width") );
      selection.transition().style("stroke-width", initialWidth + Number(4) )
      .style("stroke-opacity", 1.0);
      //.style("stroke", linkOverColor);
    } )
    .on("mouseout", function(d) {
      var selection = d3.select(this);
      selection.transition().style("stroke-width", getLinkStroke( selection.data()[0] ) )
      .style("stroke-opacity", conf.link_def_opacity);
    })

Node mouseover/mouseout:

    // display closest neighbors and fade others out
    .on("mouseover", fade(0.10) )
    // return to default view
    .on("mouseout", fade(conf.node_def_opacity) );

The fading function:

    function fade(opacity) {
      return function(d) {

        d3.event.stopPropagation();

        var thisOpacity;

        // return to default view
        if( opacity === conf.node_def_opacity )
        {
          d3.selectAll('marker > path').transition().style("opacity", 1);
          nodeGroup.transition().style("opacity", conf.node_def_opacity);
          link.style("stroke-opacity", conf.link_def_opacity);
        }
        else // fade not-neighborhood away
        {
          d3.selectAll('marker > path').transition().style("opacity", 0);
          // d3.selectAll('marker > path').transition().style('display', 'none');
          nodeGroup.transition().style("opacity", function(o)
          {
            thisOpacity = isConnected(d, o) ? conf.node_def_opacity : opacity;
            return thisOpacity; 
          });

          link.style("stroke-opacity", function(o) {
            return o.source === d || o.target === d ? conf.link_def_opacity : opacity;
          });              
        }
      }
    }   
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T19:47:53+00:00Added an answer on June 13, 2026 at 7:47 pm

    This problem was solved by introducing a timer for the node and link mouseover actions. The code is listed in this answer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a d3 force-directed graph that contains a group of nodes: var node
I have a D3 force directed graph which is first displayed with a few
I have a test site where I am building a d3-based force-directed network graph
I have two apps, both of which force the user to use the iPhone
Can d3.js layout.force be used to (re)position non-svg elements like div's? If div's have
I have nodes in a D3 force-directed layout that are set to . fixed
I can't find any way to draw a force directed graph where the weighting
I'm just starting out with D3 and I currently have a force layout with
I have to figure out an algorithm, which finds a solution for the Connect
I am trying to add Tipsy hover-over popups to my simple force-directed graph of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.