Browse Source

Merge remote-tracking branch 'origin/alex_dev' into develop

Conflicts:
	docs/graph.html
css_transitions
josdejong 10 years ago
parent
commit
c769569a0d
3 changed files with 27 additions and 7 deletions
  1. +21
    -2
      docs/graph.html
  2. +5
    -5
      examples/graph/17_network_info.html
  3. +1
    -0
      src/graph/Graph.js

+ 21
- 2
docs/graph.html View File

@ -24,7 +24,7 @@
<p>
The graph visualization works smooth on any modern browser for up to a
few thousand nodes and edges.
few hundred nodes and edges.
</p>
<p>
@ -290,6 +290,14 @@ var nodes = [
the same color schema.</td>
</tr>
<tr>
<td>fixed</td>
<td>Boolean</td>
<td>false</td>
<td>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.</td>
</tr>
<tr>
<td>fontColor</td>
<td>String</td>
@ -827,6 +835,14 @@ var options = {
<td>"#2B7CE9"</td>
<td>Default border color of the node when selected.</td>
</tr>
<tr>
<td>fixed</td>
<td>Boolean</td>
<td>false</td>
<td>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.</td>
</tr>
<tr>
<td>fontColor</td>
@ -1139,7 +1155,10 @@ var nodes = [
<h3 id="Physics">Physics</h3>
<p>
Graph uses a <a href="http://en.wikipedia.org/wiki/Force-directed_graph_drawing">force directed algorithm</a> to layout nodes and edges, and uses the <a href="http://en.wikipedia.org/wiki/Barnes%E2%80%93Hut_simulation">Barnes-Hut</a> gravitational simulation model. There are a number of configuration options available to tune the physics model. Note that wrong configuration can lead to instable behaviour.
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 <a href="http://en.wikipedia.org/wiki/Barnes%E2%80%93Hut_simulation">Barnes-Hut</a> 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.
</p>
<pre class="prettyprint">
// These variables must be defined in an options object named physics.

+ 5
- 5
examples/graph/17_network_info.html View File

@ -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');

+ 1
- 0
src/graph/Graph.js View File

@ -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',

Loading…
Cancel
Save