如何在缩放图中创建单个链接,即使两个节点之间存在多个链接,但所有链接细节都必须可用

时间:2018-04-06 06:40:38

标签: zoomcharts

var data = {
    "nodes": [{
        "id": "n1",
        "loaded": true,
        "style": {
            "label": "Node1"
        }
    }, {
        "id": "n2",
        "loaded": true,
        "style": {
            "label": "Node2"
        }
    }],
    "links": [{
        "id": "l1",
        "from": "n1",
        "to": "n2",
        "style": {
            "fillColor": "red",
            "toDecoration": "arrow"
        }
    }, {
        "id": "l11",
        "from": "n1",
        "to": "n2",
        "style": {
            "fillColor": "red",
            "toDecoration": "arrow"
        }
    }, {
        "id": "l111",
        "from": "n1",
        "to": "n2",
        "style": {
            "fillColor": "red",
            "toDecoration": "arrow"
        }
    }, {
        "id": "l114",
        "from": "n1",
        "to": "n2",
        "style": {
            "fillColor": "red",
            "toDecoration": "arrow"
        }
    }]
};
var t = new NetChart({
    container: document.getElementById("demo"),
    area: {
        height: 350
    },
    data: {
        preloaded: data
    },
    info: {
        enabled: true,
        linkContentsFunction: function(data, link, callback) {
            return link.id;
        }
    }
});

1 个答案:

答案 0 :(得分:0)

此问题已在zoomcharts论坛上得到解答:

https://forum.zoomcharts.com/t/want-single-link-connection-even-there-are-multiple-links/2072/6

基本上,您可以使用以下四种方法之一:

  1. 使用multiLinkProcessor方法合并链接
  2. 使用linkFilter省略某些链接
  3. 使用linkStyle方法应用某些特定于链接的样式
  4. 使用自定义dataFunction方法预先处理链接/节点数据,然后再将其传递给成功回调。