javascript - Resize nodes in vis js which has label inside e.g. Circle, Box - Stack Overflow

How to set size of shapes in vis js which can have label inside?e.g.Code1:shape: 'circle',co

How to set size of shapes in vis js which can have label inside? e.g.

Code1:

    shape: 'circle',
    color: {
        border: 'black',
        background: 'white'
    },
    borderWidth: 1,
    borderWidthSelected: 2,

in above Code1, if there is nothing in label to put in shape circle, then how i can increase/decrease the size of same.
If shape is anything for which label is put outside we can increase and decrease the size of icons. e.g.

Code2:

    shape: 'icon',
    icon: {
        face: 'FontAwesome',
        code: '\uf1db',
        size: 100,
        color: '#000000'
    }

As in above Code2 for icon 'size' option is available.
Is there any way to use 'size' option in Code1?

How to set size of shapes in vis js which can have label inside? e.g.

Code1:

    shape: 'circle',
    color: {
        border: 'black',
        background: 'white'
    },
    borderWidth: 1,
    borderWidthSelected: 2,

in above Code1, if there is nothing in label to put in shape circle, then how i can increase/decrease the size of same.
If shape is anything for which label is put outside we can increase and decrease the size of icons. e.g.

Code2:

    shape: 'icon',
    icon: {
        face: 'FontAwesome',
        code: '\uf1db',
        size: 100,
        color: '#000000'
    }

As in above Code2 for icon 'size' option is available.
Is there any way to use 'size' option in Code1?

Share Improve this question edited Dec 27, 2017 at 13:08 YakovL 8,40513 gold badges73 silver badges113 bronze badges asked Apr 11, 2017 at 11:09 tejp124tejp124 3763 silver badges12 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 8

The documentation states

"...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..."

So the answer is no. (Details can be found here https://visjs.github.io/vis-network/docs/network/nodes.html)

But as an workaround you could do something like this:

shape: 'circle',
scaling: {
    label: {
        enabled: true,
        min: 50,
        max: 50
    }
},
value: 1

Where as with the scaling.label.min and scaling.label.max property, you could, change the size of the node. (but you will need a value, for the node) I hope this helps.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744780325a4593297.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信