Browse Source

experiment with nodes as images

gh-pages
Alex de Mulder 9 years ago
parent
commit
0ae5f9ca94
3 changed files with 33610 additions and 33486 deletions
  1. +2
    -1
      css/examples.css
  2. +33423
    -33415
      dist/vis.js
  3. +185
    -70
      network_examples.html

+ 2
- 1
css/examples.css View File

@ -72,6 +72,7 @@ a.exampleLink:before {
}
a.exampleLink {
display:block;
padding:15px;
display:inline-block;
text-decoration: underline;
}

+ 33423
- 33415
dist/vis.js
File diff suppressed because it is too large
View File


+ 185
- 70
network_examples.html View File

@ -21,9 +21,121 @@
<script src="./dist/vis.js"></script>
<link href="./dist/vis.css" rel="stylesheet" type="text/css" />
<link href="./css/examples.css" rel="stylesheet" type="text/css" />
<style>
#networkContainer {
margin:0px;
padding:0px;
position:relative;
height: 3083px;
width: 100%;
z-index:0;
}
#contentContainer {
margin:0px;
padding:0px;
position:relative;
margin-top:-3083px;
width: 100%;
z-index:2;
}
</style>
<script>
var network;
function loadVis() {
var exampleContainer = document.getElementById('contentContainer');
var links = exampleContainer.getElementsByTagName('a');
var nodesArray = [];
var edgesArray = [];
var idCounter = 0;
var firstLink = undefined;
for (var i = 0; i < links.length; i++) {
var link = links[i];
if (link.className === 'exampleLink') {
var linkRect = link.getBoundingClientRect();
var linkWidth = linkRect.right - linkRect.left;
if (firstLink === undefined) {
firstLink = link;
}
nodesArray.push({id:idCounter,
x:link.offsetLeft + linkWidth,
y:link.offsetTop,
color:{
background:'rgba(0,0,0,0.0)',
border:'rgba(70,158,255,0)'
},
shape:'dot',
size:10,
fixed:true
});
nodesArray.push({id:idCounter + "image",
// label:link.innerHTML,
x:link.offsetLeft + 400 + 100 + (idCounter % 3) * 150,
y:link.offsetTop,
color:{
border:'rgba(70,158,255,1)'
},
shadow:{
size:2,
x:0,
y:0
},
shape:'image',
image:'./images/exampleScreenshots/network/'+(idCounter+1)+'.png',
size:60
});
edgesArray.push({from: idCounter, to: idCounter+"image"});
idCounter += 1;
}
}
var nodes = new vis.DataSet(nodesArray);
var edges = new vis.DataSet(edgesArray);
var networkContainer = document.getElementById('networkContainer');
var data = {
nodes: nodes,
edges: edges
};
var options = {
edges:{
color:{inherit:'both'},
smooth:{enabled:false,type:'continuous'}
},
physics: false,
interaction:{
zoomView:false,
dragView: false
}
};
network = new vis.Network(networkContainer, data, options);
// get the offset
var firstLinkPos = {x:firstLink.offsetLeft, y:firstLink.offsetTop};
var firstLinkRect = firstLink.getBoundingClientRect();
var firstLinkWidth = firstLinkRect.right - firstLinkRect.left;
var firstLinkHeight = firstLinkRect.bottom - firstLinkRect.top;
var rect = networkContainer.getBoundingClientRect();
var width = rect.right - rect.left;
var height = rect.bottom - rect.top;
var ydiff = exampleContainer.offsetTop - networkContainer.offsetTop;
network.moveTo({
scale: 1,
position: network.getPositions([0])[0],
offset: {
x: -0.5 * width + firstLinkPos.x + firstLinkWidth,
y: -0.5 * height + firstLinkPos.y + ydiff + 0.5 * firstLinkHeight
},
animation: false
});
}
</script>
</head>
<body onload="prettyPrint(); loadVis();">
<body onload="loadVis();">
<div class="navbar-wrapper">
@ -58,75 +170,78 @@
</div>
<div class="contentWrapper">
<h1>Network Examples</h1>
This page contains examples which show how to use Network. For the documentation, please click the button below: <br><br>
<a class="btn btn-primary" href="./docs/network" role="button">View docs »</a>
<h3>basic usage</h3>
<a class='exampleLink' href="examples/network/basic_usage.html">basic usage</a>
<h3>node styles</h3>
<a class='exampleLink' href="examples/network/nodeStyles/colors.html">colors</a>
<a class='exampleLink' href="examples/network/nodeStyles/groups.html">groups</a>
<a class='exampleLink' href="examples/network/nodeStyles/customGroups.html">custom groups</a>
<a class='exampleLink' href="examples/network/nodeStyles/HTML_in_Nodes.html">HTML in nodes</a>
<a class='exampleLink' href="examples/network/nodeStyles/icons.html">icons (Fontawesome and Ionicons)</a>
<a class='exampleLink' href="examples/network/nodeStyles/images.html">images</a>
<a class='exampleLink' href="examples/network/nodeStyles/circular_images.html">circular images</a>
<a class='exampleLink' href="examples/network/nodeStyles/shadows.html">node shadows</a>
<a class='exampleLink' href="examples/network/nodeStyles/shapes.html">node shapes</a>
<h3>edge styles</h3>
<a class='exampleLink' href="examples/network/edgeStyles/arrows.html">arrows (also combined with dashes)</a>
<a class='exampleLink' href="examples/network/edgeStyles/colors.html">different colors</a>
<a class='exampleLink' href="examples/network/edgeStyles/dashes.html">dashes</a>
<a class='exampleLink' href="examples/network/edgeStyles/smooth.html">smooth curves</a>
<a class='exampleLink' href="examples/network/edgeStyles/smoothWorldCup.html">smooth curves in action</a>
<h3>labels</h3>
<a class='exampleLink' href="examples/network/labels/label_alignment.html">label alignment (for edges only)</a>
<a class='exampleLink' href="examples/network/labels/label_background.html">label background</a>
<a class='exampleLink' href="examples/network/labels/label_color_and_size.html">colors and sizes</a>
<a class='exampleLink' href="examples/network/labels/label_stroke.html">label stroke</a>
<a class='exampleLink' href="examples/network/labels/multiline_text.html">multiline text</a>
<h3>layout</h3>
<a class='exampleLink' href="examples/network/layout/hierarchical_layout.html">hierarchical layout</a>
<a class='exampleLink' href="examples/network/layout/hierarchical_layout_methods.html">hierarchical layout - different methods</a>
<a class='exampleLink' href="examples/network/layout/hierarchical_layout_userdefined.html">hierarchical layout - user defined</a>
<a class='exampleLink' href="examples/network/layout/randomSeed.html">set the random seed so every network will be the same</a>
<h3>events</h3>
<a class='exampleLink' href="examples/network/events/interactionEvents.html">interaction events, click, rightclick, drag etc.</a>
<a class='exampleLink' href="examples/network/events/physicsEvents.html">physics events, stabilization etc.</a>
<a class='exampleLink' href="examples/network/events/renderEvents.html">rendering events, use to draw custom items on the canvas.</a>
<h3>dynamic data</h3>
<a class='exampleLink' href="examples/network/data/datasets.html">dataset for dynamic data</a>
<a class='exampleLink' href="examples/network/data/dynamic_data.html">dynamic data, playground</a>
<a class='exampleLink' href="examples/network/data/importing_from_gephi.html">importing data from gephi</a>
<a class='exampleLink' href="examples/network/data/scaling_custom.html">scaling the nodes with the value.</a>
<a class='exampleLink' href="examples/network/data/scaling_nodes_edges.html">scaling the nodes and edges with the value.</a>
<a class='exampleLink' href="examples/network/data/scaling_nodes_edges_labels.html">scaling the nodes, edges and labels with the value.</a>
<h3>physics</h3>
<a class='exampleLink' href="examples/network/physics/physicsConfiguration.html">physics configuration</a>
<h3>example applications</h3>
<a class='exampleLink' href="examples/network/exampleApplications/les_miserables.html">les miserables cast</a>
<a class='exampleLink' href="examples/network/exampleApplications/loadingBar.html">loading bar during stabilization</a>
<a class='exampleLink' href="examples/network/exampleApplications/neighbourhood_highlight.html">neighbourhood heighlight</a>
<a class='exampleLink' href="examples/network/exampleApplications/nodeLegend.html">using nodes as a legend</a>
<a class='exampleLink' href="examples/network/exampleApplications/worldCupPerformance.html">performance test with the worldcup data</a>
<h3>other</h3>
<a class='exampleLink' href="examples/network/other/animationShowcase.html">animation showcase</a>
<a class='exampleLink' href="examples/network/other/clustering.html">clustering possibilities</a>
<a class='exampleLink' href="examples/network/other/clusteringByZoom.html">clustering by zoom</a>
<a class='exampleLink' href="examples/network/other/configuration.html">dynamic configuration</a>
<a class='exampleLink' href="examples/network/other/manipulation.html">manipulation interface and localization</a>
<a class='exampleLink' href="examples/network/other/navigation.html">navigation buttons and keyboard shortcuts</a>
<a class='exampleLink' href="examples/network/other/performance.html">performance test with scale free network, customize the amount of nodes</a>
<div id="networkContainer"></div>
<div id="contentContainer">
<h1>Network Examples</h1>
This page contains examples which show how to use Network. For the documentation, please click the button below: <br><br>
<a class="btn btn-primary" href="./docs/network" role="button">View docs »</a>
<h3>basic usage</h3>
<a class='exampleLink' href="examples/network/basic_usage.html">basic usage</a><br />
<h3>node styles</h3>
<a class='exampleLink' href="examples/network/nodeStyles/colors.html">colors</a><br />
<a class='exampleLink' href="examples/network/nodeStyles/groups.html">groups</a><br />
<a class='exampleLink' href="examples/network/nodeStyles/customGroups.html">custom groups</a><br />
<a class='exampleLink' href="examples/network/nodeStyles/HTML_in_Nodes.html">HTML in nodes</a><br />
<a class='exampleLink' href="examples/network/nodeStyles/icons.html">icons (Fontawesome and Ionicons)</a><br />
<a class='exampleLink' href="examples/network/nodeStyles/images.html">images</a><br />
<a class='exampleLink' href="examples/network/nodeStyles/circular_images.html">circular images</a><br />
<a class='exampleLink' href="examples/network/nodeStyles/shadows.html">node shadows</a><br />
<a class='exampleLink' href="examples/network/nodeStyles/shapes.html">node shapes</a><br />
<h3>edge styles</h3>
<a class='exampleLink' href="examples/network/edgeStyles/arrows.html">arrows (also combined with dashes)</a><br />
<a class='exampleLink' href="examples/network/edgeStyles/colors.html">different colors</a><br />
<a class='exampleLink' href="examples/network/edgeStyles/dashes.html">dashes</a><br />
<a class='exampleLink' href="examples/network/edgeStyles/smooth.html">smooth curves</a><br />
<a class='exampleLink' href="examples/network/edgeStyles/smoothWorldCup.html">smooth curves in action</a><br />
<h3>labels</h3>
<a class='exampleLink' href="examples/network/labels/label_alignment.html">label alignment (for edges only)</a><br />
<a class='exampleLink' href="examples/network/labels/label_background.html">label background</a><br />
<a class='exampleLink' href="examples/network/labels/label_color_and_size.html">colors and sizes</a><br />
<a class='exampleLink' href="examples/network/labels/label_stroke.html">label stroke</a><br />
<a class='exampleLink' href="examples/network/labels/multiline_text.html">multiline text</a><br />
<h3>layout</h3>
<a class='exampleLink' href="examples/network/layout/hierarchical_layout.html">hierarchical layout</a><br />
<a class='exampleLink' href="examples/network/layout/hierarchical_layout_methods.html">hierarchical layout - different methods</a><br />
<a class='exampleLink' href="examples/network/layout/hierarchical_layout_userdefined.html">hierarchical layout - user defined</a><br />
<a class='exampleLink' href="examples/network/layout/randomSeed.html">set the random seed so every network will be the same</a><br />
<h3>events</h3>
<a class='exampleLink' href="examples/network/events/interactionEvents.html">interaction events, click, rightclick, drag etc.</a><br />
<a class='exampleLink' href="examples/network/events/physicsEvents.html">physics events, stabilization etc.</a><br />
<a class='exampleLink' href="examples/network/events/renderEvents.html">rendering events, use to draw custom items on the canvas.</a><br />
<h3>dynamic data</h3>
<a class='exampleLink' href="examples/network/data/datasets.html">dataset for dynamic data</a><br />
<a class='exampleLink' href="examples/network/data/dynamic_data.html">dynamic data, playground</a><br />
<a class='exampleLink' href="examples/network/data/importing_from_gephi.html">importing data from gephi</a><br />
<a class='exampleLink' href="examples/network/data/scaling_custom.html">scaling the nodes with the value.</a><br />
<a class='exampleLink' href="examples/network/data/scaling_nodes_edges.html">scaling the nodes and edges with the value.</a><br />
<a class='exampleLink' href="examples/network/data/scaling_nodes_edges_labels.html">scaling the nodes, edges and labels with the value.</a><br />
<h3>physics</h3>
<a class='exampleLink' href="examples/network/physics/physicsConfiguration.html">physics configuration</a><br />
<h3>example applications</h3>
<a class='exampleLink' href="examples/network/exampleApplications/les_miserables.html">les miserables cast</a><br />
<a class='exampleLink' href="examples/network/exampleApplications/loadingBar.html">loading bar during stabilization</a><br />
<a class='exampleLink' href="examples/network/exampleApplications/neighbourhood_highlight.html">neighbourhood heighlight</a><br />
<a class='exampleLink' href="examples/network/exampleApplications/nodeLegend.html">using nodes as a legend</a><br />
<a class='exampleLink' href="examples/network/exampleApplications/worldCupPerformance.html">performance test with the worldcup data</a><br />
<h3>other</h3>
<a class='exampleLink' href="examples/network/other/animationShowcase.html">animation showcase</a><br />
<a class='exampleLink' href="examples/network/other/clustering.html">clustering possibilities</a><br />
<a class='exampleLink' href="examples/network/other/clusteringByZoom.html">clustering by zoom</a><br />
<a class='exampleLink' href="examples/network/other/configuration.html">dynamic configuration</a><br />
<a class='exampleLink' href="examples/network/other/manipulation.html">manipulation interface and localization</a><br />
<a class='exampleLink' href="examples/network/other/navigation.html">navigation buttons and keyboard shortcuts</a><br />
<a class='exampleLink' href="examples/network/other/performance.html">performance test with scale free network</a><br />
</div>
</div>
<br />
<br />

Loading…
Cancel
Save