You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm wondering the best way to style a node based on its data value/accessor method (if I understand the latter correctly). For example if my node data is structured like this:
With type sometimes set to person and other times place, what is the best way to change a node's color or shape based on the value? I managed to do this for nodeColor:
but it only caters to two possibilities, and would break if I were to introduce a third type (like thing). Is it possible to use something like an if statement? Conditionally changing nodeCanvasObject seemed more complicated and I couldn't wrap my head around, but I'd also like to use different shapes (and sometimes an image) also based on the type value.
Any suggestions are much appreciated!
The text was updated successfully, but these errors were encountered:
I'm wondering the best way to style a node based on its data value/accessor method (if I understand the latter correctly). For example if my node data is structured like this:
With
type
sometimes set toperson
and other timesplace
, what is the best way to change a node's color or shape based on the value? I managed to do this for nodeColor:.nodeColor(d => d.type=="person" ? '#8fccb3' : '#22322c')
but it only caters to two possibilities, and would break if I were to introduce a third
type
(likething
). Is it possible to use something like anif
statement? Conditionally changingnodeCanvasObject
seemed more complicated and I couldn't wrap my head around, but I'd also like to use different shapes (and sometimes an image) also based on thetype
value.Any suggestions are much appreciated!
The text was updated successfully, but these errors were encountered: