Make a node double its size on mouseOver
See original GitHub issueI 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:
- Created 7 years ago
- Comments:5
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Try
autoRescale: ['nodePosition', 'edgeSize']
. It will only rescale position and edge sizes.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.