问题
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:
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.
来源:https://stackoverflow.com/questions/21002611/adding-custom-images-to-nodes