Adding custom images to nodes

2k Views Asked by At

Using Sigma.js I want to add custom images to the graph's nodes. I found a plugin, included nodeShapes.js and plotter.js, then added an image attribute :

var imgUri="somepicture.png"

sigInst.addNode(id,{
                    'x': Math.random(),
                    'y': Math.random(),
                    'label': data.nodes[i].val,
                //  'color': color,                         commenting this line out to add custom images to the nodes              
                    'image':{'url':imgUri},
                    'cluster': clusters['cluster_id']
});

But the graph remains unchanged and I still see the default dots.

1

There are 1 best solutions below

1
On

You should check out the new version of Sigma that came out a few days ago. There you can add custom images on the nodes, but make sure to specify that you use Canvas renderer, otherwise it won't work.