Access the color palette? #349
-
I have an attribute defined to auto-color the nodes based on a grouping attribute. In d3.js I did the following thing, but I seem to miss how I can access force-graph's color palette. Is there any way to do this?
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
@guerda the auto-color scale is just a quick convenience method for assigning different colors based on a simple logic. If you need anything more sophisticated than that, it's better you use the more appropriate .nodeColor(color) With |
Beta Was this translation helpful? Give feedback.
@guerda the auto-color scale is just a quick convenience method for assigning different colors based on a simple logic. If you need anything more sophisticated than that, it's better you use the more appropriate
nodeColor
method. In fact, if you're already declaring a color scale externally, like you shown above, all you need to do is assign that color scale to the nodes. Something like:With
color
being the color scale you've defined in your code.