What algorithm is using for nodeAutoColorBy? #525
-
I am working on a project that hopes to have a label bar telling different categories of the nodes get what different color. I assume nodeAutoColorBy is using some hash color method, but how do I find the source code or the specific function for this? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
@dzhai5 if auto-coloring is enabled, nodes that don't already have a color associated get assigned one according to the criteria set in Relevant source code: https://github.com/vasturiano/three-forcegraph/blob/master/src/utils/color-utils.js |
Beta Was this translation helpful? Give feedback.
@dzhai5 if auto-coloring is enabled, nodes that don't already have a color associated get assigned one according to the criteria set in
nodeAutoColorBy
.The colors come from d3's schemePaired.
Relevant source code:
https://github.com/vasturiano/three-forcegraph/blob/d091b6f7d09a0fd35032cad560b19dcbfe76bd3f/src/forcegraph-kapsule.js#L611-L614
https://github.com/vasturiano/three-forcegraph/blob/master/src/utils/color-utils.js