gpt4 book ai didi

javascript - Infovis力向图,节点上的弹窗

转载 作者:行者123 更新时间:2023-11-30 18:10:18 25 4
gpt4 key购买 nike

嗨,如果那里有任何 infovis 用户,他们可能会提供帮助,我是一个 infovis 菜鸟,我刚刚建立了我的力导向图并运行通过 Json 传入我的节点,无论如何我可以修改每个弹出信息窗口单击标记时可能会在 Google map 上看到的节点,我已经绕了几个小时。

谢谢。

这是我尝试将图像附加到每个节点仍然无法使其工作:

onCreateLabel: function(domElement, node) {
var actionElem;
var link = document.createElement('a');
var frame = document.createElement('div');


actionElem = document.createElement('img');
// http://promote.opera.com/logos/Opera-icon-high-res.png
//actionElem.src = photoUrls[node.id];
actionElem.src = 'http://promote.opera.com/logos/Opera-icon-high-res.png';
actionElem.className = 'profilePicture';

//actionElem.onclick = function() { nodeOnClick(node) };
link.href = '/' + node.id;
link.className = 'link';
link.target = '_blank';
link.innerHTML = node.name;
frame.className = 'detailFrame';
frame.appendChild(actionElem);
frame.appendChild(document.createElement('br'));
frame.appendChild(link);
domElement.appendChild(frame);
},

最佳答案

您可以通过执行以下操作将图像添加到节点:

onCreateLabel: function(label, node){
label.innerHTML = "<div><img src='/images/node.png'/></div>;
}

要添加唯一图像,您可以在 json 中传入图像名称:

onCreateLabel: function(label, node){
label.innerHTML = "<div><img src='/images/"+node.data.image+"'/></div>;
}

关于javascript - Infovis力向图,节点上的弹窗,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14756436/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com