-
Notifications
You must be signed in to change notification settings - Fork 233
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
BUG: NO LINK GETS HIGHLIGHTED WHEN NODE ID IS NON-STIRNG #73
Comments
Hello @iamhosseindhv, you can use type module.exports = {
links: [
{
source: 1,
target: 2
},
{
source: 1,
target: 3
},
{
source: 1,
target: 4
}
],
nodes: [
{
id: 1,
name: 'Node 1'
},
{
id: 2,
name: 'Node 2'
},
{
id: 3,
name: 'Node 3'
},
{
id: 4,
name: 'Node 4'
}
]
}; Also don't forget to set up properly the rd3g config for the highlight behavior, this includes: |
Thanks. But I was using a similar data model with target and source as |
I see.. Do you have a sample code or repository that I can take a look at? It would be much easier to debug. EDIT: No need for it already spotted the error, a fix is on the way for this, thanks for that @iamhosseindhv nice catch! |
My pleasure. Thanks for the great work you put into this project ❤️ |
Should now be fixed with release 1.2.2, closing this. |
Background: All nodes are identified by their
id
. In your SandBox example, a node'sid
is of typestring
. However, I'd like to use a unique number instead ofstring
, since two nodes may have the same name, but it doesn't necessarily mean that they are the same. Currently, if I do use a number, this line causesmainNodeParticipates
to be alwaysfalse
, because of the===
. As a result, no link gets highlighted whenhighlightDegree==1
.You should either replace
===
with==
to allowinteger
ids, or you can add a property to nodes in the graph's config calledidentifierType
(say). So that we can distinguish differentid
types and use a proper method to compare them. The latter seems to be cleaner.react-d3-graph/src/components/graph/graph.helper.js
Line 217 in a8fd7d9
The text was updated successfully, but these errors were encountered: