dunnock / react-sigma

Lightweight React library for drawing network graphs built on top of SigmaJS
https://dunnock.github.io/react-sigma/
MIT License
258 stars 43 forks source link

Styling the Graph #102

Closed HamadAli248 closed 3 years ago

HamadAli248 commented 3 years ago

I'm trying to style the graph, I have fetched the data from the backend and passing it in but when I'm trying to style it to give nodes different colours and size it doesn't work, anyone has any ideas how I can customise the graph node colours and sizes for each node? Here's the code I'm using to display the graph:

{Object.keys(graphData).length > 0 && ( <Sigma graph={cloneDeep(graphData)} settings={{ drawEdges: true, clone: false }} > <RelativeSize initialSize={15} /> <RandomizeNodePositions /> </Sigma> )}

Thank You

HamadAli248 commented 3 years ago

If anyone is looking to styling the graph without having to add the colours and sizes in the json, have a look at https://github.com/jacomyal/sigma.js/wiki/Settings

dunnock commented 3 years ago

Thank you