almende / vis

⚠️ This project is not maintained anymore! Please go to https://github.com/visjs
7.85k stars 1.48k forks source link

Network component - chosen label font size issue #4112

Open PrimosK opened 6 years ago

PrimosK commented 6 years ago

Vis.js version: 4.21.0 Browser: all browsers

I've stumbled on the issue where font size of chosen node is not taken into account when following options are set:

var options = {
    edges: {
        font: {
            size: 0 // Works when size is > 4
        },
        chosen: {
            label: function (values, id, selected, hovering) {
                values.size = 14;
            }
        }
    }
}

Note that font size of selected edge is changed properly if initial font size for all edges is > 4..

JSFiddle demonstrating the issue: http://jsfiddle.net/61yjhorx/8/

Label Issue Showcase

What I was trying to achieve: https://stackoverflow.com/questions/32690394/how-to-hide-label-in-edge-in-visjs-graph/52204535#52204535

allofmex commented 5 years ago

Facing same issue. Cannot start with hidden label, and show only if node/edge is selected.

What I noticed: It is working if set from selectNode event!

var options = {
    ....
    font: {    size: 0    },
}
network = new vis.Network(container, data, options);
...

network.on('selectNode', (event, properties, senderId) => {
    ...
    const options = this.body.data.edges._data[edgeId];
    options.font.size = 12;
    network.clustering.updateEdge(edgeId, options);
});

But chosen: { label: function (.... does not work, function gets called but label stays invisible.