天道酬勤,学无止境

vis.js-network

How to clear/reset/refresh vis.js function for selectNode or selectEdge?

Firstly please refer to this issue (Has been solved). Continuous from that issue, I want to use selectNode or selectEdge function at same page and same JS function, however the function is unable to click, why this happen? If I don't use previous function, the selectNode or selectEdge is work as well. So here, anyone know how to clear/delete/refresh previous function prior to clicking the selectNode or selectEdgefunction? Here is the selectNode or selectEdge function. function node(){ // Previous solved issue $("#btnSearchNode").on('click',function () { for (var i = 0;i<test_array_node.length

2022-05-02 13:29:57    分类:问答    jquery   vis.js   vis.js-network

How to highlight Node and it's Label in vis.js?

My objective is to change the node's label background into red and the label is white when the node's is exiting after search. What is happen now the label seems gone. My reference & complete code is here vis.js search function I already follow the code and works but need some modification on the stated issue above. Below are the modification part that I do. $("#btnSearch").on('click',function () { for (var i = 0;i<allNodes.length;i++){ if (allNodes[i].ip.indexOf($("#inputSearch").val()) >=0 && $("#inputSearch").val() != ''){ allNodes[i].color = { border: "#406897" }; allNodes[i].label = { //

2022-05-02 06:30:36    分类:问答    jquery   vis.js-network

How to change node image in vis.js when node clicked?

I am trying to replicate script in vis.js library for grey node when clicked, it is successfully but that is actually for shape type. but my case is I am using image type. What happen is the image is not change. How to implement below code for my case (using image). Let say I have 2 images (Image_A and Image_B), Image_A is for default color image, Image_B is grey image. So when clicked at specific node, the node will use Image_A and other is Image_B. When clicked outside all nodes will use Image_A. Example only: Source link: Grey out other node var network; var allNodes; var highlightActive =

2022-05-02 06:24:40    分类:问答    jquery   vis.js   vis.js-network

How to use vis.js with map

I am trying to build a network visualization with vis.js and display it on a map (similar to Geo-layout in Gephi). Do you happen to know if something already exists to achieve such goal? (I don't even need to use vis.js if you have suggestions) So far I tried/thought of using mapbox but I abandoned the idea of a real map because it it turning out to be fairly complex. I downgraded expectation to doing the following: done: have an image of a map in the background and have some big nodes that I can position manually by tweaking the x and y position I still need to do the following: Make the

2022-04-30 05:37:47    分类:问答    visualization   vis.js   vis.js-network

Vis.js network node customization: cards as nodes

I would like to build a network where the nodes represent information that is structured similarly to cards. With a card I mean a structure composed of two areas: multi-line text area where I can put information that comes from different resources, like a name, a phone number, an address and control area where I can have 2-3 buttons (preferably with icons) that maximize the node, or make the node a root/main one etc. As far as I could see from the vis.js documentation see example here, it is possible to enter paragraph/text as a node label but there is no way to structure a node via Html. Can

2022-04-26 17:13:17    分类:问答    javascript   html   nodes   vis.js   vis.js-network

Stop vis.js physics after nodes load but allow drag-able nodes

问题 我正在尝试绘制 vis.js 网络图并让 vis 加载和定位节点。 然后我希望禁用物理,以便用户可以移动节点。 我已经尝试过了,但它不起作用。 var options = { nodes: { borderWidth:4, size:60, color: { border: '#222222', background: 'grey' }, font:{color:'black'} }, edges: { arrows: { to: {enabled: false, scaleFactor:1}, middle: {enabled: false, scaleFactor:1}, from: {enabled: false, scaleFactor:1} }, color: 'black' }, { physics: enabled: false; }; 有人做过吗? 如果是这样,您能否提供有关实现此目的的最佳方法的示例或建议。 我也阅读了位于此处的解释,但对 java 不太熟悉,我无法弄清楚这些步骤。 谢谢 回答1 // create a network var container = document.getElementById('mynetwork'); var data = { nodes: nodes, edges: edges }; var options = {

2022-04-22 06:08:04    分类:技术分享    javascript   node.js   vis.js   vis.js-network

Plotting huge trees with vis.js

I'm trying to plot a quite huge network (i.e., ~1k nodes and ~1k edges) with vis.js 4.21.0. Here is my options object: var options = { autoResize: true, height: '400px', clickToUse: false, layout: { hierarchical: { direction: 'UD', sortMethod: 'directed', } }, physics: { stabilization: false, barnesHut: { gravitationalConstant: -80000, springConstant: 0.001, springLength: 200 } }, nodes: { shape: 'dot', size: 20, font: { size: 15, color: '#ffffff' }, borderWidth: 2 }, groups: groups, }; The problem is that it takes up to 4 minutes to render (see this simplified JSFiddle). In this example, much

2022-04-06 17:07:06    分类:问答    javascript   charts   vis.js   vis.js-network

Stop vis.js physics after nodes load but allow drag-able nodes

I am trying to draw a vis.js network diagram and have vis load and position the nodes. I then want the physics to be disabled so the nodes can be moved by the user. I have tried this but it is not working. var options = { nodes: { borderWidth:4, size:60, color: { border: '#222222', background: 'grey' }, font:{color:'black'} }, edges: { arrows: { to: {enabled: false, scaleFactor:1}, middle: {enabled: false, scaleFactor:1}, from: {enabled: false, scaleFactor:1} }, color: 'black' }, { physics: enabled: false; }; Has anyone done this? if so can you provide an example or advice on best way to

2022-04-04 09:19:26    分类:问答    javascript   node.js   vis.js   vis.js-network

Unable to fix position of two nodes in vis.js

I am trying to fix the position of two nodes. They should be on top of each other, 400px apart in the y-dimension. var edges = [{ id:"1", fixed: {x:true, y:true}, x:0,y:-200 },{ id:"2", fixed: {x:true, y:true}, x:0,y:200 }, ...]; However, the position are not fixed and wander all over the place. This is the corresponding fiddle. Any ideas?

2022-03-23 04:10:16    分类:问答    javascript   vis.js   vis.js-network