question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Make a node double its size on mouseOver

See original GitHub issue

I am having a bit of a hard time understanding how sigma.js handles the size of nodes and edges.

I get that you set a minNodeSize and maxNodesSize in the graph’s setting. Actual display size is then assigned depending on the node’s individual size as well as the level of zoom of the graph. Correct?

What I am trying to achieve is that a node doubles its size on a mouseOver, and shrinks back to the original size on a mouseOut. Here is my code:

var minNodeSize = 1;
var maxNodeSize = 5;

sigma.parsers.json('giantComponent.json', {
      container: 'graph',
      settings: {
        minNodeSize: minNodeSize,
        maxNodeSize: maxNodeSize
      }   

      //Assign same size to all nodes
      var s = sigma.instances()[0];
      var nodes = s.graph.nodes();
      nodes.forEach(function (n) {
          n.size= maxNodeSize/2;
      })
    }
    );

//Function to change a nodes size on mouseOVer
function interactiveNodes () {  
    var s = sigma.instances()[0];
    var nodes = s.graph.nodes();
    s.bind('overNode', function (d) {
        d.data.node.size = maxNodeSize;
        s.refresh();
    })
    s.bind('outNode', function (d) {
        d.data.node.size = maxNodeSize/2;
        s.refresh();
    })
    }

Result: when I hover on a node that node stays the same size while all other nodes shrink to half their size.

Any ideas?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
Yomguitherealcommented, Sep 20, 2016

Try autoRescale: ['nodePosition', 'edgeSize']. It will only rescale position and edge sizes.

0reactions
stale[bot]commented, Oct 8, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Make a node double its size on mouse over in sgma.js
What I am trying to achieve is that a node doubles its size on a mouseOver, and shrinks back to the original size...
Read more >
Mouse over change the scale of node - Northwoods Software
The current issue that I have is, once the node is scale up to 2, the position of the node is changed, then...
Read more >
How hovering over a division element to gradually change the ...
You can use transition property in CSS to make some transition effect as changing the width of an element. The transition effect can...
Read more >
onmouseover Event - W3Schools
The onmouseover event occurs when the mouse pointer enters an element. The onmouseover event is often ... ondblclick, The user double-clicks on an...
Read more >
Make Some Background Hover Effects Using Only CSS
In this article, I'll show you the ways to make some beneficial hover background effects with background-position , background-size and backgroud-image .
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found