Skip to content

Commit

Permalink
Fix #129 and add example
Browse files Browse the repository at this point in the history
  • Loading branch information
Darkproduct committed Apr 12, 2022
1 parent c31b826 commit f58091d
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 33 deletions.
30 changes: 1 addition & 29 deletions notebooks/dot.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,35 +59,7 @@ <h1></h1>
},
});

options = Object.assign(options, {
"configure": {
"enabled": false
},
"edges": {
"color": {
"inherit": true
},
"smooth": {
"enabled": true,
"type": "dynamic"
}
},
"interaction": {
"dragNodes": true,
"hideEdgesOnDrag": false,
"hideNodesOnDrag": false
},
"physics": {
"enabled": true,
"stabilization": {
"enabled": true,
"fit": true,
"iterations": 1000,
"onlyDynamicEdges": false,
"updateInterval": 50
}
}
})
options = Object.assign(options, {"physics": {"enabled": true, "barnesHut": {"theta": 0.5, "gravitationalConstant": -2000, "centralGravity": 0.3, "springLength": 200, "springConstant": 0.04, "damping": 0.09, "avoidOverlap": 0}, "maxVelocity": 50, "minVelocity": 0.1, "solver": "barnesHut", "stabilization": {"enabled": true, "iterations": 1000, "updateInterval": 100, "onlyDynamicEdges": false, "fit": true}}})



Expand Down
38 changes: 34 additions & 4 deletions notebooks/example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
" "
],
"text/plain": [
"<IPython.lib.display.IFrame at 0x7f80a49c8ee0>"
"<IPython.lib.display.IFrame at 0x7fbe1d273d30>"
]
},
"execution_count": 2,
Expand Down Expand Up @@ -68,7 +68,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 9,
"metadata": {
"scrolled": true
},
Expand All @@ -87,17 +87,47 @@
" "
],
"text/plain": [
"<IPython.lib.display.IFrame at 0x7f80a49d19a0>"
"<IPython.lib.display.IFrame at 0x7fbe3d2ead00>"
]
},
"execution_count": 3,
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"h = Network(notebook=True)\n",
"h.from_DOT(\"test.dot\")\n",
"\n",
"# All properties have to be enclosed by double quotes and \n",
"# there and there must be no comma at the end of a list.\n",
"# See https://visjs.github.io/vis-network/docs/network/ for all options\n",
"h.set_options(\"\"\"\n",
"var options = {\n",
" \"physics\": {\n",
" \"enabled\": true,\n",
" \"barnesHut\": {\n",
" \"theta\": 0.5,\n",
" \"gravitationalConstant\": -2000,\n",
" \"centralGravity\": 0.3,\n",
" \"springLength\": 200,\n",
" \"springConstant\": 0.04,\n",
" \"damping\": 0.09,\n",
" \"avoidOverlap\": 0\n",
" },\n",
" \"maxVelocity\": 50,\n",
" \"minVelocity\": 0.1,\n",
" \"solver\": \"barnesHut\",\n",
" \"stabilization\": {\n",
" \"enabled\": true,\n",
" \"iterations\": 1000,\n",
" \"updateInterval\": 100,\n",
" \"onlyDynamicEdges\": false,\n",
" \"fit\": true\n",
" }\n",
" }\n",
"}\n",
"\"\"\")\n",
"h.show(\"dot.html\")"
]
},
Expand Down

0 comments on commit f58091d

Please sign in to comment.