From 89b225b066ef39cbb3b6763fc25dc9fa4a905c48 Mon Sep 17 00:00:00 2001 From: Alex de Mulder Date: Wed, 19 Feb 2014 14:00:47 +0100 Subject: [PATCH] new docs, added fixed parameter to nodes --- docs/graph.html | 18 +++++++++++++++++- examples/graph/17_network_info.html | 10 +++++----- src/graph/Graph.js | 1 + 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/docs/graph.html b/docs/graph.html index 8df62843..461a2841 100644 --- a/docs/graph.html +++ b/docs/graph.html @@ -290,6 +290,14 @@ var nodes = [ the same color schema. + + fixed + Boolean + false + If fixed is true, then the node will not move from its supplied position. + If only an x position has been supplied, it is only fixed in the x-direction. + The same holds for y. If both x and y have been defined, the node will not move. + fontColor String @@ -827,6 +835,14 @@ var options = { "#2B7CE9" Default border color of the node when selected. + + fixed + Boolean + false + If fixed is true, then the node will not move from its supplied position. + If only an x position has been supplied, it is only fixed in the x-direction. + The same holds for y. If both x and y have been defined, the node will not move. + fontColor @@ -1139,7 +1155,7 @@ var nodes = [

Physics

- The physics system has been overhauled to increase performance. The original simulation method was based on particel physics with a repulsion field (potential) around each node, + The original simulation method was based on particel physics with a repulsion field (potential) around each node, and the edges were modelled as springs. The new system employed the Barnes-Hut gravitational simulation model. The edges are still modelled as springs. To unify the physics system, the damping, repulsion distance and edge length have been combined in an physics option. To retain good behaviour, both the old repulsion model and the Barnes-Hut model have their own parameters. If no options for the physics system are supplied, the Barnes-Hut method will be used with the default parameters. diff --git a/examples/graph/17_network_info.html b/examples/graph/17_network_info.html index 0b7e033f..ca97d75a 100644 --- a/examples/graph/17_network_info.html +++ b/examples/graph/17_network_info.html @@ -96,11 +96,11 @@ var x = - mygraph.clientWidth / 2 + 50; var y = - mygraph.clientHeight / 2 + 50; var step = 70; - nodes.push({id: 1000, x: x, y: y, label: 'Internet', group: 'internet', value: 1}); - nodes.push({id: 1001, x: x, y: y + step, label: 'Switch', group: 'switch', value: 1}); - nodes.push({id: 1002, x: x, y: y + 2 * step, label: 'Server', group: 'server', value: 1}); - nodes.push({id: 1003, x: x, y: y + 3 * step, label: 'Computer', group: 'desktop', value: 1}); - nodes.push({id: 1004, x: x, y: y + 4 * step, label: 'Smartphone', group: 'mobile', value: 1}); + nodes.push({id: 1000, x: x, y: y, label: 'Internet', group: 'internet', value: 1, fixed:true}); + nodes.push({id: 1001, x: x, y: y + step, label: 'Switch', group: 'switch', value: 1, fixed:true}); + nodes.push({id: 1002, x: x, y: y + 2 * step, label: 'Server', group: 'server', value: 1, fixed:true}); + nodes.push({id: 1003, x: x, y: y + 3 * step, label: 'Computer', group: 'desktop', value: 1, fixed:true}); + nodes.push({id: 1004, x: x, y: y + 4 * step, label: 'Smartphone', group: 'mobile', value: 1, fixed:true}); // create a graph var container = document.getElementById('mygraph'); diff --git a/src/graph/Graph.js b/src/graph/Graph.js index d0613ece..c27a9674 100644 --- a/src/graph/Graph.js +++ b/src/graph/Graph.js @@ -40,6 +40,7 @@ function Graph (container, data, options) { image: undefined, widthMin: 16, // px widthMax: 64, // px + fixed:false, fontColor: 'black', fontSize: 14, // px fontFace: 'verdana',