Problem
nodeRelSize currently only accepts a static number:
This makes it impossible to size nodes dynamically based on node data. Other APIs like nodeColor already support function accessors.
Desired Usage
Allow nodeRelSize to accept a function:
graph.nodeRelSize(node => node.importance || 4);
Required Changes
-
README
Update documentation to indicate nodeRelSize accepts ([num or fn])
https://github.com/vasturiano/force-graph/blob/master/README.md#L99
-
Core logic
Update nodeRelSize to use an accessor function
https://github.com/vasturiano/force-graph/blob/master/src/force-graph.js#L306
-
Canvas renderer
Apply the same accessor logic here:
Problem
nodeRelSizecurrently only accepts a static number:This makes it impossible to size nodes dynamically based on node data. Other APIs like
nodeColoralready support function accessors.Desired Usage
Allow
nodeRelSizeto accept a function:Required Changes
README
Update documentation to indicate
nodeRelSizeaccepts([num or fn])https://github.com/vasturiano/force-graph/blob/master/README.md#L99
Core logic
Update
nodeRelSizeto use an accessor functionhttps://github.com/vasturiano/force-graph/blob/master/src/force-graph.js#L306
Canvas renderer
Apply the same accessor logic here: