Browse Source

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

fixDataView
jos 9 years ago
parent
commit
603d155e04
8 changed files with 1610 additions and 1515 deletions
  1. +2
    -0
      HISTORY.md
  2. +1508
    -1465
      dist/vis.js
  3. +1
    -1
      docs/timeline/index.html
  4. +1
    -0
      lib/network/modules/components/Edge.js
  5. +2
    -0
      lib/network/modules/components/Node.js
  6. +13
    -2
      lib/network/modules/components/edges/BezierEdgeDynamic.js
  7. +1
    -0
      lib/network/modules/components/edges/util/EdgeBase.js
  8. +82
    -47
      test/networkTest.html

+ 2
- 0
HISTORY.md View File

@ -12,6 +12,8 @@ http://visjs.org
### Network ### Network
- Fixed #1343: Connected edges are now deselected too when deselecting a node. - Fixed #1343: Connected edges are now deselected too when deselecting a node.
- Fixed #1398: Support nodes start with the correct positions.
- Fixed #1324: Labels now scale again.
### Timeline ### Timeline

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


+ 1
- 1
docs/timeline/index.html View File

@ -115,7 +115,7 @@
<h2 id="Example">Example</h2> <h2 id="Example">Example</h2>
<p> <p>
The following code shows how to create a Timeline and provide it with data. The following code shows how to create a Timeline and provide it with data.
More examples can be found in the <a href="../examples">examples</a> directory.
More examples can be found in the <a href="../../timeline_examples.html">timeline examples</a> page.
</p> </p>
<pre class="prettyprint lang-html">&lt;!DOCTYPE HTML&gt; <pre class="prettyprint lang-html">&lt;!DOCTYPE HTML&gt;

+ 1
- 0
lib/network/modules/components/Edge.js View File

@ -344,6 +344,7 @@ class Edge {
} }
this._setInteractionWidths(); this._setInteractionWidths();
this.updateLabelModule();
} }
_setInteractionWidths() { _setInteractionWidths() {

+ 2
- 0
lib/network/modules/components/Node.js View File

@ -381,6 +381,8 @@ class Node {
this.options.size = this.baseSize; this.options.size = this.baseSize;
this.options.font.size = this.baseFontSize; this.options.font.size = this.baseFontSize;
} }
this.updateLabelModule();
} }

+ 13
- 2
lib/network/modules/components/edges/BezierEdgeDynamic.js View File

@ -9,16 +9,27 @@ class BezierEdgeDynamic extends BezierEdgeBase {
} }
setOptions(options) { setOptions(options) {
// check if the physics has changed.
let physicsChange = false;
if (this.options.physics !== options.physics) {
physicsChange = true;
}
// set the options and the to and from nodes
this.options = options; this.options = options;
this.id = this.options.id; this.id = this.options.id;
this.from = this.body.nodes[this.options.from];
this.to = this.body.nodes[this.options.to];
// setup the support node and connect
this.setupSupportNode(); this.setupSupportNode();
this.connect();
// when we change the physics state of the edge, we reposition the support node. // when we change the physics state of the edge, we reposition the support node.
if (this.options.physics !== options.physics) {
if (physicsChange === true) {
this.via.setOptions({physics: this.options.physics}) this.via.setOptions({physics: this.options.physics})
this.positionBezierNode(); this.positionBezierNode();
} }
this.connect();
} }
connect() { connect() {

+ 1
- 0
lib/network/modules/components/edges/util/EdgeBase.js View File

@ -4,6 +4,7 @@ class EdgeBase {
constructor(options, body, labelModule) { constructor(options, body, labelModule) {
this.body = body; this.body = body;
this.labelModule = labelModule; this.labelModule = labelModule;
this.options = {};
this.setOptions(options); this.setOptions(options);
this.colorDirty = true; this.colorDirty = true;
this.color = {}; this.color = {};

+ 82
- 47
test/networkTest.html View File

@ -1,60 +1,95 @@
<!doctype html>
<!DOCTYPE html>
<html> <html>
<head> <head>
<title>Network | Basic usage</title>
<script src="../dist/vis.js"></script>
<link type="text/css" rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/vis/4.9.0/vis.min.css">
<script type="text/javascript" src="../dist/vis.js"></script>
<link href="../dist/vis.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<style>
#mynetwork { #mynetwork {
width: 600px;
height: 400px;
border: 1px solid lightgray;
width: 1400px;
height: 800px;
border: 1px solid gray;
} }
</style> </style>
</head> </head>
<body>
<body onload="draw();">
<script src="https://rawgit.com/Tooa/6e17f2d7b8e34ef94719/raw/a10096a6b88c992c57d032b1ed3079d7cc4b1f51/data.js"></script>
<div id="mynetwork"></div>
<script>
<p>
Create a simple network with some nodes and edges.
</p>
for (var i = 0; i < nodes.length; i++) {
nodes[i].mass = Math.ceil(2000* nodes[i].value);
}
<div id="mynetwork"></div>
var nodesDataset = new vis.DataSet(nodes);
var edgesDataset = new vis.DataSet(edges);
<script type="text/javascript">
// create an array with nodes
var nodes = new vis.DataSet([
{id: 1, label: 'Node 1'},
{id: 2, label: 'Node 2'},
{id: 3, label: 'Node 3'},
{id: 4, label: 'Node 4'},
{id: 5, label: 'Node 5'}
]);
// create an array with edges
var edges = new vis.DataSet([
{from: 1, to: 3},
{from: 1, to: 2},
{from: 2, to: 4},
{from: 2, to: 5}
]);
// create a network
var container = document.getElementById('mynetwork');
var data = {
nodes: nodes,
edges: edges
};
var options = {manipulation:{
initiallyActive:true,
addNode: false,
// addEdge: false
// editNode: true
}};
var network = new vis.Network(container, data, options);
</script>
function redrawAll() {
var container = document.getElementById('mynetwork');
var options = {
nodes: {
borderWidth:4,
color: {
border: '#406897',
background: '#6AAFFF'
},
scaling: {
min: 10,
max: 200,
label: {
min: 50,
max: 100,
drawThreshold: 10,
maxVisible: 60
}
},
font: {
size: 20,
color:'#000000'
},
shapeProperties: {
useBorderWithImage: true
},
},
edges: {
scaling: {
min: 2,
max: 50
},
color: { inherit: 'from' },
smooth: {
type: 'continuous'
}
},
physics: {
"barnesHut": {
"gravitationalConstant": -19050,
"centralGravity": 1.3,
"springLength": 170,
"springConstant": 0.035,
"damping": 0.23
},
"minVelocity": 0.75,
stabilization: {
enabled: false,
iterations: 2000,
updateInterval: 25
}
},
configure:'physics',
interaction: {
tooltipDelay: 200,
hideEdgesOnDrag: true
},
layout:{improvedLayout:false}
};
<script src="../googleAnalytics.js"></script>
network = new vis.Network(container, {nodes: nodesDataset, edges: edgesDataset}, options);
}
redrawAll();
</script>
</body> </body>
</html> </html>

Loading…
Cancel
Save