Last active
August 29, 2015 13:59
-
-
Save MHenderson/10667009 to your computer and use it in GitHub Desktop.
Demonstration of vis.js options.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<title>vis.js Options Demo</title> | |
<script src="http://visjs.org/dist/vis.js"></script> | |
<link href="http://visjs.org/dist/vis.css" rel="stylesheet" type="text/css" /> | |
<style type="text/css"> | |
#graph { | |
width: 600px; | |
height: 600px; | |
border: 1px solid lightgray; | |
} | |
</style> | |
<script src="options.js"></script> | |
</head> | |
<body > | |
<div id="graph"></div> | |
<script> | |
var nodes = [ | |
{id: 0, label: 'a'}, | |
{id: 1, label: 'b'}, | |
{id: 2, label: 'c'}, | |
{id: 3, label: 'd'}, | |
{id: 4, label: 'e'}, | |
]; | |
var edges = [ | |
{from: 0, to: 1}, | |
{from: 0, to: 2}, | |
{from: 1, to: 2}, | |
{from: 1, to: 3}, | |
{from: 2, to: 4}, | |
]; | |
var container = document.getElementById('graph'); | |
var data = { | |
nodes: nodes, | |
edges: edges, | |
}; | |
var graph = new vis.Graph(container, data, options); | |
zoomExtent(); | |
</script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
options.js: options.coffee | |
coffee --bare --compile options.coffee |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
options = | |
navigation: true | |
smoothCurves: false | |
physics: | |
barnesHut: | |
enabled: false | |
edges: | |
width: 3 | |
style: 'line' | |
color: | |
color: 'black' | |
highlight: 'grey' | |
nodes: | |
shape: 'circle' | |
fontColor: 'black' | |
color: | |
border: 'black' | |
background: 'black' | |
highlight: | |
border: 'grey' | |
background: 'grey' | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Generated by CoffeeScript 1.6.3 | |
var options; | |
options = { | |
navigation: true, | |
smoothCurves: false, | |
physics: { | |
barnesHut: { | |
enabled: false | |
} | |
}, | |
edges: { | |
width: 3, | |
style: 'line', | |
color: { | |
color: 'black', | |
highlight: 'grey' | |
} | |
}, | |
nodes: { | |
shape: 'circle', | |
fontColor: 'black', | |
color: { | |
border: 'black', | |
background: 'black', | |
highlight: { | |
border: 'grey', | |
background: 'grey' | |
} | |
} | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment