将自定义图像添加到节点

时间:2014-01-08 17:34:51

标签: javascript sigma.js

使用Sigma.js我想将自定义图像添加到图形的节点中。我找到a plugin,包括nodeShapes.js和plotter.js,然后添加了一个图像属性:

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']
});

但图表保持不变,我仍然看到默认点。

1 个答案:

答案 0 :(得分:0)

您应该查看几天前发布的新版Sigma。您可以在节点上添加自定义图像,但请确保指定使用Canvas渲染器,否则它将无效。

相关问题