almende / vis

⚠️ This project is not maintained anymore! Please go to https://github.com/visjs
7.85k stars 1.48k forks source link

One node in two or three cluster #4150

Closed keshav1007 closed 5 years ago

keshav1007 commented 6 years ago

How can I cluster a node in two different clusters?

for example:

var nodes = [
  {id: 4, label: 'Node 4', cid:[1]},
  {id: 5, label: 'Node 5', cid: [2]},
  {id: 6, label: 'Node 6', cid:[1,2]},
  {id: 7, label: 'Node 7', cid:[1]}
]

Node 6 should be present in both cluster 1 and 2. How can i achieve this?

I tried adding joinCondition like below:

var clusterIds = [1,2];
for(var i=0;i<clusterId.length;i++){
    options[i] = {
        joinCondition:function(nodeOptions) {
            return (nodeOptions.cid.indexOf(clusterId[i]) > - 1);
        }
    }
    network.cluster(options[i]);
}

but i am getting the node only in one cluster.

mojoaxel commented 5 years ago

This issue tracker is not supposed to be used for questions on how to use visjs. It is intended to be used for bug reports and feature requests! In case you face yourself with a usage question, then post your question e.g. on stackoverflow tagged with "vis.js".