我想知道zoomcharts在最新的更新(1.5.1)中是否有以下功能:
我希望两个节点之间的单个链接能够用两种颜色着色(左半部分为红色,右半部分为黑色)。此外,我希望能够悬停在这两个不同颜色的单拆分链接不同??
如果你只是复制粘贴下面的代码,你可以看到它现在不能完成…
<script>
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"}}
]
};
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;
}}
});
</script>
现在似乎不可能拆分单个链接并将每个部分分别悬停。
但是这里有一个"讨厌"的版本,如何使用lineDash和固定节点位置来制作类似的东西。
<script>
var data = {
"nodes":[
{"id":"n1", "loaded":true, x:100, y:0, "style":{"label":"Node1"}},
{"id":"n2", "loaded":true, x:0, y:0, "style":{"label":"Node2"}}
],
"links":[
{"id":"l1","from":"n1", "to":"n2", "style":{"fillColor":"red", "toDecoration":"arrow", "length":3}},
{"id":"l11","from":"n1", "to":"n2", "style":{"fillColor":"black","lineDash":[100,300]}}
]
};
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;
}},
"style": {
"multilinkSpacing": 0
}
});
</script>