Is it possible to make the label of nodes ahref clickable?
http://visjs.org/docs/network/#modules
This is an old question, but this answer may be of help to anyone who finds it.
You cannot navigate from a label of a visjs node as a label because:
The label is the piece of text shown in or under the node, depending on the shape.
You can however enable navigation from a node itself by declaring an attribute with a URL value on the node and using the global method on() and network events (e.g. double click ).
var nodes = new vis.DataSet([
{id: '1', label: 'Google', shape: 'box', url: 'https://www.google.ie'}
]);
var data = {nodes: nodes};
var container = document.getElementById('vis');
var options = {};
var network = new vis.Network(container, data, options);
network.on("doubleClick", function (params) {
if (params.nodes.length === 1) {
var node = nodes.get(params.nodes[0]);
if(node.url != null) {
window.open(node.url, '_blank');
}
}
});
Your question title is not related to the text of your question as making the nodes "clickable" and making the nodes actually navigate to another page are different questions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With