Vis.js网络:复选框和隐藏功能

时间:2018-11-13 11:55:51

标签: javascript vis.js vis.js-network

创建了一个网络,并希望在勾选时使用复选框隐藏组。当前已设置它以将它们聚类,但是为了可视化目的而希望隐藏它们。如何合并隐藏功能?

checkbox.onclick = (function(x) {
  return function () {
    let checkbox = document.getElementById('chk' + x);

    if (checkbox.checked == true) {
      network.clustering.cluster({
        joincondition: function(nodeOptions) {return nodeOptions.group === x;},
        clusterNodeProperties: {id: x, shape: 'square', size: 60, title: x, name: x}
      });
    } else {
      console.log('opening: ' + x);
      network.clustering.openCluster(x);
    }
  };
}(agroup))

checkbox.checked = false;

var label = document.createElement('label')
label.htmlFor = "chk" + agroup;
label.appendChild(document.creatTextNode(agroup));

container.appendChild(checkbox);
container.appendChild(label);
container.appendChild(document.createElement("br"))
}
}

这是该复选框的当前代码。这适用于将它们聚类,但是我不想在网络上聚类,而只想对网络隐藏该组。

0 个答案:

没有答案