Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make node.renderLabel available at node level #192

Closed
henzesberger opened this issue Apr 9, 2019 · 11 comments
Closed

Make node.renderLabel available at node level #192

henzesberger opened this issue Apr 9, 2019 · 11 comments
Assignees
Labels
enhancement improving existent functionality or performance related feature request good first issue Hacktoberfest Hacktoberfest label priority normal

Comments

@henzesberger
Copy link

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
@danielcaldas
Copy link
Owner

Hi @henzesberger,

node.renderLabel boolean (default true) | when set to false no labels will appear along side nodes in the graph.

This is not possible to achieve as you can see in the documentation node.renderLabel does not have the symbol 🔍🔍🔍. This symbol indicates that the config is granular at node level, meaning that you can pass it within the node as you have in your code node.renderLabel = true. If you look at the size you can see that it has the 🔍🔍🔍 symbol, meaning that you can actually have different sizes per node, that's why your assignment node.size = 400 works.

I'll tag this as a feature request and enhancement since it already exists in the global scope of the config.

@danielcaldas danielcaldas added enhancement improving existent functionality or performance related feature request labels Apr 10, 2019
@henzesberger
Copy link
Author

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

@stale stale bot added the wontfix label May 21, 2019
Repository owner deleted a comment from stale bot May 27, 2019
@stale stale bot removed the wontfix label May 27, 2019
@stale stale bot added the wontfix label Jul 6, 2019
Repository owner deleted a comment from stale bot Jul 6, 2019
@stale stale bot removed the wontfix label Jul 6, 2019
@danielcaldas danielcaldas added the Hacktoberfest Hacktoberfest label label Sep 29, 2019
@danielcaldas
Copy link
Owner

This issue is very similar to #234 and the others linked under the same issue.

@ashish10677
Copy link

Is this issue still open? I am a newbie and would like to contribute. Please let me know.

@danielcaldas
Copy link
Owner

Hey, @ashish10677 this issue is up for grabs, I'll assign it to you.

@danielcaldas danielcaldas changed the title Node renderLabel is not updated Make node.renderLabel available at node level Oct 22, 2019
@gopherine
Copy link
Contributor

if this is not yet done i will take it up also if possible can i get the list of all these local global changes i will implement them at once i see similar issues in here regarding the same

@ashish-param
Copy link

@gopherine you can take up the issue. I'm travelling this week and won't be able to do anything. @danielcaldas can you assign it to @gopherine

@danielcaldas
Copy link
Owner

Hey @gopherine go ahead I'll assign this to you 🙂

@gopherine
Copy link
Contributor

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

@danielcaldas
Copy link
Owner

np @gopherine! Thanks a lot for following up on this issue!

@danielcaldas
Copy link
Owner

danielcaldas commented Nov 30, 2019

Implemented in #267

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement improving existent functionality or performance related feature request good first issue Hacktoberfest Hacktoberfest label priority normal
Projects
None yet
Development

No branches or pull requests

5 participants