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 node.renderLabel available at node level

See original GitHub issue

Describe the bug I’d like to show the label information only when the user hovers over the nodes. Since there is already a renderLabel property on the nodes, I tried to change it in combination with onMouseOverNode and onMouseOutNode but unfortunately, the labels are not shown.

To Reproduce Steps to reproduce the behavior:

  1. Create a graph
  2. Add some node data, set renderLabel in the global node config to false
  3. Implement onMouseOverNode and onMouseOutNode (size is changed for reference)
  onMouseOverNode = function(nodeId) {
    const data = this.state.data;
    data.nodes = data.nodes.map(node => {
      if (node.id === nodeId) {
        node.renderLabel = true;
        node.size = 1000;
      }
      return node;
    });
    this.setState({ data });
  };

  onMouseOutNode = function(nodeId) {
    const data = this.state.data;
    data.nodes = data.nodes.map(node => {
      if (node.id === nodeId) {
        node.renderLabel = false;
        node.size = 400;
      }
      return node;
    });
    this.setState({ data });
  };
  1. See that the size is changed on hovering but the labels are not shown

Expected behavior The labels of the currently hovered node should be visible and the node size should be changed

Screenshots image

Environment:

  • OS: Win10 1803
  • Browser: Chrome
  • Version: 73.0.3683
  • Node version: 11.13
  • react-d3-graph version 2.0.1
  • d3 version: d3-force 2.0.1
  • react version: 16.4.1

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:11 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
gopherinecommented, Nov 11, 2019

sorry for the delay i got busy with university 😃 i will dive back into it today or tommorow

1reaction
henzesbergercommented, Apr 11, 2019

Thank you very much, looking forward to have this feature. It would be also great to have the same behavior for links.

Read more comments on GitHub >

github_iconTop Results From Across the Web

react-d3-graph 0.3.0 | Docs
These properties can be defined in the graph payload at a node level. ... will be applied to the node if no color...
Read more >
Universal abstract-level database for Node.js and browsers.
This is a convenience package that exports classic-level in Node.js and browser-level in ... If a key was not found, the relevant value...
Read more >
Features and behavior - Storybook
Features and behavior ; showRoots, Boolean, Display the top-level nodes as a "root" in the sidebar ; collapsedRoots, Array, Set of root node...
Read more >
Top-level await is available in Node.js modules - Stefan Judis
Node.js is a beautiful tool to write quick utility scripts. I use it in many of my build processes. Renaming files, downloading data, ......
Read more >
Node.js 18 is now available!
New globally available browser-compatible APIs · Test runner module (experimental) · Toolchain and Compiler Upgrades · Build-time user-land ...
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