-
Notifications
You must be signed in to change notification settings - Fork 232
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
Link Colors not used when adding to graph #169
Comments
Hi @wendymungovan! Thanks a lot for reporting this. Could you please provide your environment information (such as node version, react and d3 versions). |
Sorry about that. "react": "^15.6.2", |
Thank you for your detailed report, @wendymungovan ! Having the steps to reproduce the issue will come in handy. I'll take a look at this and let you know as soon as I find out what's going on. :) |
Thank you for looking into it. If we need to change what versions of node components we are using to make this work better please let me know. |
Don't mention it! That's what we're here for! 😉 I found the problem and it's a bug in the library, so there's no need for you to do anything with your other dependencies. I'll submit a pull request with the fix soon, so @danielcaldas can review it. When a next release of |
When a new link was added in real time by updating an existing graph instance, if it was configured to have a custom color with the 'link.color' property, that value was ignored and the default color was displayed instead. This issue was reported in #169. The source of the problem was that, when generating a d3Link instance in the '_mapDataLinkToD3Link' method, the value of the color property was not kept. Only the source and target values were being added to the d3Link which would actually be rendered in the graph, and the color property was completely lost by the time the graph was to be drawn on the screen. The issue could be solved by adding a color property to the d3Link object.
Thank you! |
* fix: Add link with custom color in existing graph When a new link was added in real time by updating an existing graph instance, if it was configured to have a custom color with the 'link.color' property, that value was ignored and the default color was displayed instead. This issue was reported in #169. The source of the problem was that, when generating a d3Link instance in the '_mapDataLinkToD3Link' method, the value of the color property was not kept. Only the source and target values were being added to the d3Link which would actually be rendered in the graph, and the color property was completely lost by the time the graph was to be drawn on the screen. The issue could be solved by adding a color property to the d3Link object. * Whitelist new exposed props * Make _mapDataLinkToD3Link work properly by picking custom props
Closed with #170 |
Describe the bug
When you add new links to a graph with the link color specified. The default color is used instead of the link.color field. This ONLY happens when you are updating an existing graph not creating a new one.
To Reproduce
Steps to reproduce the behaviour:
Create a new graph with nodes and links of different colors
add a new link to Graph's data
var links = this.state.graphData.links;
//add a new link
{source:"A", target:"B", color:"red"}
var newState = {
graphData: { nodes: nodes, links: links}
};
this.setState( newState);
the color of the link is the default link color instead of red.
Expected behavior
The link color to be the color specified in the link.color property. (in example red) Instead the default link color is used.
The text was updated successfully, but these errors were encountered: