How to set image size in Vis.js network graphic

I am building a network graph using vis.js

The problem is, how do you make all the images the same size ? vis.js network graph (see live example here -> wordpress and drupal comparison )

here's the graph code:

    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);

      

+3


source to share


1 answer


Go for the size node attribute.

Example



nodes:{shape:'image',size:20}

      

Link: http://visjs.org/docs/network/nodes.html

+2


source







All Articles