将自定义图像添加到节点 [英] Adding custom images to nodes
本文介绍了将自定义图像添加到节点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用Sigma.js,我想向图的节点添加自定义图像.我找到了插件,其中包含nodeShapes.js和plotter.js,然后添加了图片属性:
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.
推荐答案
您应该查看几天前发布的Sigma新版本.在那里,您可以在节点上添加自定义图像,但是请确保指定使用Canvas渲染器,否则它将无法正常工作.
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.
这篇关于将自定义图像添加到节点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文