Aswitha
Aswitha

Reputation: 1

how to create single link in zoomcharts even though there are multiiple links between two nodes but all the link details must be available

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;
        }
    }
});

Upvotes: 0

Views: 57

Answers (1)

jancha
jancha

Reputation: 4977

This question has been answered on zoomcharts forum:

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

Basically, you can use one of four methods:

  1. use multiLinkProcessor method to merge the links
  2. use linkFilter to omit certain links
  3. use linkStyle method to apply certain link-specific styles
  4. use custom dataFunction method to pre-process the link/node data before passing it to the success callback.

Upvotes: 0

Related Questions