【问题标题】:Get incoming links number for graph element in jointJS获取jointJS中图形元素的传入链接数
【发布时间】:2016-09-26 12:50:39
【问题描述】:

在jointJS中,我希望每个元素检查传入连接链接的数量。所以这是我根据文档制作的代码,但它不起作用:

 _.each(this.graph.getElements(), function(element) {

    var inboundLinksCount = this.graph.getConnectedLinks(element, {inbound: true}).length;
    alert(inboundLinksCount); 
    }

这是getConnectedLinks在jointJS中的文档: http://resources.jointjs.com/docs/jointjs/v1.0/joint.html#dia.Graph.prototype.getConnectedLinks

有什么想法吗?

【问题讨论】:

    标签: jquery graph element jointjs rappid


    【解决方案1】:

    请尝试以下 而不是 this.graph,您可以在“this.graph”所在的两个地方使用您的图形变量名称。如果在控制台上写入任何输出,请尝试使用 console.log(graph.getElements) 和 graphe.getConnectedLinks(element)) 进行调试。

    _.each(this.graph.getElements(), function(element) {
    
        var inboundLinksCount = this.graph.getConnectedLinks(element, {inbound: true});
        alert(inboundLinksCount); 
        }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多