How to display overNode label in Sigma.Js programmatically?

1.7k Views Asked by At

I'm using Sigma.Js library to display graph visualization in my Node.Js app.

There's an overNode event, which displays the label of the node in a white rectangle when you hover over it.

I want to display this label rectangle when the node is clicked, does anybody know how to do it?

1

There are 1 best solutions below

0
On

Here is the solution:

  1. download the source code ( as it is hard to modify the minified version ) from github
  2. find the file sigma.misc.bindEvents.js inside this path : sigma.js-master\sigma.js-master\src\misc
  3. Open this file using a good code editor ( sublime text for example ).
  4. Navigate to line 494
  5. Find this code:

// Bind events:

      captor.bind('click', onClick);
      captor.bind('mousedown', onMove);
      captor.bind('mouseup', onMove);
      captor.bind('mousemove', onMove);
      captor.bind('mouseout', onOut);
      captor.bind('doubleclick', onDoubleClick);
      captor.bind('rightclick', onRightClick);
      self.bind('render', onMove);
  1. change both events "click" & "move" to be as follows:

// Bind events:

      captor.bind('click', onMove);
      captor.bind('mousedown', onMove);
      captor.bind('mouseup', onMove);
      //captor.bind('mousemove', onMove);
      captor.bind('mouseout', onOut);
      captor.bind('doubleclick', onDoubleClick);
      captor.bind('rightclick', onRightClick);
      self.bind('render', onMove);
  1. save your js file , and now try for example testing sigma.js-master\sigma.js-master\examples\basic.html in your browser.

Here is an Example