如何在Vis.js网络图中设置图像大小 [英] How to set the image size in Vis.js network graph
本文介绍了如何在Vis.js网络图中设置图像大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用vis.js构建网络图
I am building a network graph using vis.js
问题是,如何使所有图像的大小相同?
(参见此处的实例 - > wordpress& drupal的比较)
这里是图形代码:
var nodes = [];
nodes.push({
id: 7,
shape: 'image',
image: '/static/windows8_icons/PNG/Industry/circuit/circuit-26.png',
label: 'sharepoint',
widthMin: 20,
widthMax: 20
});
edges.push({
from: 1,
to: 7,
length: 100
});
var data = {
nodes: nodes,
edges: edges
};
var options = {
smoothCurves: false,
stabilize: false,
nodes: {
shape: 'image',
radius: 24,
fontSize: 18,
widthMin: 20,
widthMax: 20
},
edges: {
width: 2
}
};
network = new vis.Network(container, data, options);
推荐答案
寻找节点的大小属性。
示例
nodes:{shape:'image',size:20}
参考: http://visjs.org/docs/network/nodes.html
这篇关于如何在Vis.js网络图中设置图像大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文