Adding custom images to nodes

强颜欢笑 提交于 2019-12-22 15:49:15

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!