在 vis js 中调整节点大小,其中有标签,例如圆形、盒子
Resize nodes in vis js which has label inside e.g. Circle, Box
如何在vis js中设置可以有标签的形状大小?
例如
代码1:
shape: 'circle',
color: {
border: 'black',
background: 'white'
},
borderWidth: 1,
borderWidthSelected: 2,
在上面的代码1中,如果标签中没有任何东西可以放在形状圆圈中,那么我怎么才能increase/decrease相同的大小。
如果形状是标签放在外面的任何东西我们可以增加和减少图标的大小。例如
代码2:
shape: 'icon',
icon: {
face: 'FontAwesome',
code: '\uf1db',
size: 100,
color: '#000000'
}
如上代码2中的图标'size'选项可用。
有没有办法在代码1中使用'size'选项?
文档说明
"...The size is used to determine the size of node shapes that do not
have the label inside of them. These shapes are: image, circularImage,
diamond, dot, star, triangle, triangleDown, square and icon..."
所以答案是否。 (可在此处找到详细信息http://visjs.org/docs/network/nodes)
但作为解决方法,您可以这样做:
shape: 'circle',
scaling: {
label: {
enabled: true,
min: 50,
max: 50
}
},
value: 1
而对于 scaling.label.min
和 scaling.label.max
属性,您可以更改节点的大小。 (但您需要一个 value
作为节点) 希望这对您有所帮助。
如何在vis js中设置可以有标签的形状大小? 例如
代码1:
shape: 'circle',
color: {
border: 'black',
background: 'white'
},
borderWidth: 1,
borderWidthSelected: 2,
在上面的代码1中,如果标签中没有任何东西可以放在形状圆圈中,那么我怎么才能increase/decrease相同的大小。
如果形状是标签放在外面的任何东西我们可以增加和减少图标的大小。例如
代码2:
shape: 'icon',
icon: {
face: 'FontAwesome',
code: '\uf1db',
size: 100,
color: '#000000'
}
如上代码2中的图标'size'选项可用。
有没有办法在代码1中使用'size'选项?
文档说明
"...The size is used to determine the size of node shapes that do not have the label inside of them. These shapes are: image, circularImage, diamond, dot, star, triangle, triangleDown, square and icon..."
所以答案是否。 (可在此处找到详细信息http://visjs.org/docs/network/nodes)
但作为解决方法,您可以这样做:
shape: 'circle',
scaling: {
label: {
enabled: true,
min: 50,
max: 50
}
},
value: 1
而对于 scaling.label.min
和 scaling.label.max
属性,您可以更改节点的大小。 (但您需要一个 value
作为节点) 希望这对您有所帮助。