簡體   English   中英

更改Javascript Infovis Toolit /強制定向圖中的節點形狀

[英]Change Node Shape in Javascript Infovis Toolit/ Force Directed Graph

我正在使用Javascript Infovis工具箱(JIT),並希望將節點的形狀更改為某些圖像。我該怎么做? 默認形狀是圓形,可以進一步更改為矩形,正方形,橢圓形等,但是在我的情況下,我需要將其更改為本地磁盤驅動器上的映像。

他們說可以在“類型”字段中這樣做,但是我們需要添加什么所有方法或查看對...的影響? 請參閱以下鏈接:

http://thejit.org/static/v20/Docs/files/Options/Options-Node-js.html

而我們到底該怎么做呢?

請幫助...

這里有一個很好的群組消息, https://groups.google.com/group/javascript-information-visualization-toolkit/tree/browse_frm/month/2010-10?_done =%2Fgroup%2Fjavascript-information-visualization-toolkit%2Fbrowse_frm %2Fmonth%2F2010-10%3F&

如果要為強制導向圖實現節點類型,請轉到您的jit文件,然后轉到ForceDirected.Plot.NodeTypes

這是我的代碼,但是當我嘗試平移時,標簽仍然跳動。

'icon': { 
             'render': function(node, canvas){ 
                        var ctx = canvas.getCtx(); 
                        var img = new Image(); 
                        var pos = node.getPos(); 
                        img.onload = function() { 
                                ctx.drawImage(img, pos.x-24, pos.y-24); 
                        }; 
                        img.src='../img/icon.png'; 
                }, 
                'contains': function(node,pos){ 
                        var npos = node.pos.getc(true); 
                        dim = node.getData('dim'); 
                        return this.nodeHelper.square.contains(npos, pos, dim); 
                } 
         },

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM