我使用VisJS来显示网络图(即路由器和交换机之间的链路),所以对我来说,每个VisJS的边缘都是两个设备之间的链路。单击边缘,我想在边缘的两端显示设备的两个端口,这要归功于它们的连接。
对于实例(以非常精确的图形方式!):
[8] ---------------- [15]
有人能帮我吗?
发布于 2018-06-07 07:05:15
那么,您需要为click
事件使用on
method,如下所示:
network.on('click',function(ev){
if(ev.nodes.length != 0 || ev.edges.length != 1)
return;
var edge = ev.edges[0];
// do what you need for that edge:
// use edge.from and edge.to to get the corresponding nodes,
// get the ports from wherever you have them stored,
// add/show labels
});
https://stackoverflow.com/questions/50349875
复制相似问题