Javascript Vis JS Edge:显示起点和终点的标签
我使用VisJS显示网络地图(即路由器和交换机之间的链接),因此每个VisJS的边缘对我来说都是两个设备之间的链接。 单击边缘,我想在边缘的两端显示设备的两个端口,这要归功于它们的连接 对于距离(以非常精确的图形方式!):Javascript Vis JS Edge:显示起点和终点的标签,javascript,vis.js-network,vis.js,Javascript,Vis.js Network,Vis.js,我使用VisJS显示网络地图(即路由器和交换机之间的链接),因此每个VisJS的边缘对我来说都是两个设备之间的链接。 单击边缘,我想在边缘的两端显示设备的两个端口,这要归功于它们的连接 对于距离(以非常精确的图形方式!): 有人能帮我吗?好吧,你需要的是使用上的来进行这样的活动: network.on('click',function(ev){ if(ev.nodes.length != 0 || ev.edges.length != 1) return; var
有人能帮我吗?好吧,你需要的是使用上的
来进行这样的活动:
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
});
与此同时,我发现了一些有趣的事情。无论如何尝试使用它,我都将所有标签折叠并覆盖。
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
});