Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Discussion options

Hi. First of all thanks for the amazing package. I had a question about specifying colors for specific nodes when defining the node data of a Sankey diagram. I noticed in the example from https://nivo.rocks/sankey/ that the data itself has a color field but then it seems to be overwritten by the themed color. Is there a way to turn off the themed color and instead just use that specified color on the node itself?

The sankey diagram I am trying to create essentially always has 6 columns of nodes and I'm trying to have all nodes in a single column have the same color but I'm not sure how to do that with theme. An extension of this would be having static flow colors. So for example having the connections be a static grey while assigning the nodes colors when the data is defined.

Sorry if I missed the solution in the docs and thank you in advanced for any assistance.

You must be logged in to vote

Replies: 6 comments · 2 replies

Comment options

In case anyone else stumbles upon this I was able to get it to work but adding the startColor and endColor fields to the links object and keeping enableLinkGradient as true. Then I just set whatever colors I wanted there.

You must be logged in to vote
2 replies
@PulkitBanta
Comment options

This only changes the color for the links and not for the node. Were you able to define a color for the node as well? If yes can you create a sample code snippet?

@mayank-permiso
Comment options

@dupchurch-sedaro , any more props you found which are not mentioned in Nivo documentation but can be given in json? BTW, thanks for the start and end color props, this will help me in changing the link color for each link, as there is no prop that can change each link color.
Also, how did you find these 2 props? Any d3 documentation you read?

Comment options

Hi, I am a physician resident and need a sankey diagram four one of our project. Is there anyone who can provide this sankey diagram professionally? I'll be very happy to contact them separately and will greatly appreciate if you contact me. Thank you!

Cansu

You must be logged in to vote
0 replies
Comment options

i checked their types and found out that there is no color field for data (but their docs show there is one). no wonder why it was not working for node color

You must be logged in to vote
0 replies
Comment options

Hey there,

Any updates on this issue ? I would also really like to set my own node specific colors.
Thanks.

You must be logged in to vote
0 replies
Comment options

The property is colors, and it exists in the types as well.

You must be logged in to vote
0 replies
Comment options

This worked for me-
colors={(rest)=> rest.nodeColor}

Where nodeColors is defined for each node in data json. Yes, it accepts a function. This should have been mentioned in the docs, but I think it is not.

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
7 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.