【发布时间】:2019-07-05 06:48:44
【问题描述】:
我正在使用 Zoomchart 库的 NetChart 类来形成 netchart。但我面临链接问题。并且无法找到任何解决方案。
以下是我想要实现的情况:-
假设我们有两个节点 A 和 B。这里 A 是卖方,B 是买方。
Seller A -> B
Buyer B -> A
我正在动态加载数据。当我们最初加载 A 时,我们将 B 作为 A 的买家。这形成了一个类似 A -> B 的链接。但是,当 B 加载其相关数据时,它会获得 A,因为它正在从它 (A) 购买数据。 这形成了两个链接节点:-
{
"from": "A",
"to": "B"
}
{
"from": "B",
"to": "A"
}
它正在创建一个这样的图表:-
但它应该是单个链接。下面是代码:-
this.chartObject = new NetChart({
container: document.getElementById('sellerBuyersLinkingChart'),
area: { height: null },
navigation:{
focusNodeExpansionRadius: 1,
initialNodes: ["n-1"],
mode:"focusnodes"
},
data: {
dataFunction: (nodeList, success, error) => {
$.ajax({
url:url+'?nodes='+nodeList.toString(),
success: (response, textStatus, jqXHR) => {
success(response, textStatus, jqXHR);
},
error: error
});
},
requestMaxUnits: 1
},
style: {
nodeStyleFunction: (node) => {
},
linkStyleFunction: (link) => {
let type = link.data['extra']['type'];
if(type == 'sellers') {
link['fromDecoration'] = "arrow";
link['fillColor'] = "rgba(47,195,47,0.8)";
link['direction'] = "L";
} else {
link['toDecoration'] = "arrow";
link['fillColor'] = "rgba(236,46,46,0.8)";
link['direction'] = "R";
}
},
nodeFocused: {
fillColor: 'rgba(232,189,43,1)'
}
}
});
期望:有什么方法可以发送到带有 URL 的链接 ID。通过这种方式,我可以从链接中删除相同的节点。
这个图表应该创建这样的节点:-
【问题讨论】:
标签: javascript angularjs zoomcharts netchart