Roy Tang

Programmer, engineer, scientist, critic, gamer, dreamer, and kid-at-heart.

Blog Notes Photos Links Archives About

Basically the title. The client is complaining that when he zooms in, the text labels for the nodes are quite large. Is there a way to keep the node labels at a fixed font size even when zooming in or out?

From the nodes documentation (http://visjs.org/docs/network/nodes.html), there’s a scaling.label option, but it doesn’t seem to work. I think this is only relevant if I’m using values to scale the nodes.

Comments

As far as I know, there’s no such option. The scaling.label option, if I understand correctly what you mean, is used to set a scaling factor, not disable zooming.

However, you can implement this yourself, namely change scaling of labels on zoom. Fortunately, there’s zoom event: set a handler like

network.on('zoom',rescaleLabels);

and implement rescaleLabels by setting the corresponding scale factor to their labels.