Browse Source

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

css_transitions
josdejong 10 years ago
parent
commit
df33df984f
6 changed files with 80 additions and 16 deletions
  1. +4
    -1
      HISTORY.md
  2. +27
    -5
      dist/vis.js
  3. +5
    -5
      dist/vis.min.js
  4. +5
    -0
      docs/css/style.css
  5. +12
    -0
      docs/graph.html
  6. +27
    -5
      src/graph/Edge.js

+ 4
- 1
HISTORY.md View File

@ -6,7 +6,10 @@ http://visjs.org
### Graph ### Graph
- Bugfix graphviz examples
- Bugfix graphviz examples.
- Bugfix labels position for smooth curves.
- Tweaked graphviz example physics.
- Updated physics documentation to stress importance of configurePhysics.
## 2014-03-05, version 0.6.0 ## 2014-03-05, version 0.6.0

+ 27
- 5
dist/vis.js View File

@ -10645,14 +10645,21 @@ Edge.prototype._drawLine = function(ctx) {
ctx.strokeStyle = this.color; ctx.strokeStyle = this.color;
ctx.lineWidth = this._getLineWidth(); ctx.lineWidth = this._getLineWidth();
var point;
if (this.from != this.to) { if (this.from != this.to) {
// draw line // draw line
this._line(ctx); this._line(ctx);
// draw label // draw label
var point;
if (this.label) { if (this.label) {
point = this._pointOnLine(0.5);
if (this.smooth == true) {
var midpointX = 0.5*(0.5*(this.from.x + this.via.x) + 0.5*(this.to.x + this.via.x));
var midpointY = 0.5*(0.5*(this.from.y + this.via.y) + 0.5*(this.to.y + this.via.y));
point = {x:midpointX, y:midpointY};
}
else {
point = this._pointOnLine(0.5);
}
this._label(ctx, this.label, point.x, point.y); this._label(ctx, this.label, point.x, point.y);
} }
} }
@ -10835,7 +10842,15 @@ Edge.prototype._drawDashLine = function(ctx) {
// draw label // draw label
if (this.label) { if (this.label) {
var point = this._pointOnLine(0.5);
var point;
if (this.smooth == true) {
var midpointX = 0.5*(0.5*(this.from.x + this.via.x) + 0.5*(this.to.x + this.via.x));
var midpointY = 0.5*(0.5*(this.from.y + this.via.y) + 0.5*(this.to.y + this.via.y));
point = {x:midpointX, y:midpointY};
}
else {
point = this._pointOnLine(0.5);
}
this._label(ctx, this.label, point.x, point.y); this._label(ctx, this.label, point.x, point.y);
} }
}; };
@ -10906,7 +10921,6 @@ Edge.prototype._drawArrowCenter = function(ctx) {
// draw label // draw label
if (this.label) { if (this.label) {
point = this._pointOnLine(0.5);
this._label(ctx, this.label, point.x, point.y); this._label(ctx, this.label, point.x, point.y);
} }
} }
@ -11010,7 +11024,15 @@ Edge.prototype._drawArrow = function(ctx) {
// draw label // draw label
if (this.label) { if (this.label) {
var point = this._pointOnLine(0.5);
var point;
if (this.smooth == true) {
var midpointX = 0.5*(0.5*(this.from.x + this.via.x) + 0.5*(this.to.x + this.via.x));
var midpointY = 0.5*(0.5*(this.from.y + this.via.y) + 0.5*(this.to.y + this.via.y));
point = {x:midpointX, y:midpointY};
}
else {
point = this._pointOnLine(0.5);
}
this._label(ctx, this.label, point.x, point.y); this._label(ctx, this.label, point.x, point.y);
} }
} }

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


+ 5
- 0
docs/css/style.css View File

@ -75,3 +75,8 @@ td {
padding: 5px; padding: 5px;
vertical-align: top; vertical-align: top;
} }
p.important_note {
color: #3a6baa;
font-weight:bold;
}

+ 12
- 0
docs/graph.html View File

@ -1185,6 +1185,8 @@ var nodes = [
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. 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. 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. If you want to customize the physics system easily, you can use the configurePhysics option. If no options for the physics system are supplied, the Barnes-Hut method will be used with the default parameters. If you want to customize the physics system easily, you can use the configurePhysics option.
<p class="important_note">Note: if the behaviour of your graph is not the way you want it, use configurePhysics as described <u><a href="#PhysicsConfiguration">below</a></u> or by <u><a href="../examples/graph/25_physics_configuration.html">example 25</a></u>.</p>
</p> </p>
<pre class="prettyprint"> <pre class="prettyprint">
// These variables must be defined in an options object named physics. // These variables must be defined in an options object named physics.
@ -1296,7 +1298,17 @@ var options = {
<td>This is the damping constant. It is used to dissipate energy from the system to have it settle in an equilibrium. More information is available <a href="http://en.wikipedia.org/wiki/Damping" target="_blank">here</a>.</td> <td>This is the damping constant. It is used to dissipate energy from the system to have it settle in an equilibrium. More information is available <a href="http://en.wikipedia.org/wiki/Damping" target="_blank">here</a>.</td>
</tr> </tr>
</table> </table>
<h4 id="PhysicsConfiguration">Configuration:</h5>
Every dataset is different. Nodes can have different sizes based on content, interconnectivity can be high or low etc. Because of this, graph has a special option
that the user can use to explore which settings may be good for him or her. This is ment to be used during the development phase when you are implementing vis.js. Once you have found
settings you are happy with, you can supply them to graph using the physics options as described above.
On start, the default settings will be loaded. Keep in mind that selecting the hierarchical simulation mode <b>disables</b> smooth curves. These will not be enabled again afterwards.
<pre class="prettyprint">
var options = {
configurePhysics:true
}
</pre>
<h3 id="Data_manipulation">Data manipulation</h3> <h3 id="Data_manipulation">Data manipulation</h3>
<p> <p>
By using the data manipulation feature of the graph you can dynamically create nodes, connect nodes with edges, edit nodes or delete nodes and edges. By using the data manipulation feature of the graph you can dynamically create nodes, connect nodes with edges, edit nodes or delete nodes and edges.

+ 27
- 5
src/graph/Edge.js View File

@ -232,14 +232,21 @@ Edge.prototype._drawLine = function(ctx) {
ctx.strokeStyle = this.color; ctx.strokeStyle = this.color;
ctx.lineWidth = this._getLineWidth(); ctx.lineWidth = this._getLineWidth();
var point;
if (this.from != this.to) { if (this.from != this.to) {
// draw line // draw line
this._line(ctx); this._line(ctx);
// draw label // draw label
var point;
if (this.label) { if (this.label) {
point = this._pointOnLine(0.5);
if (this.smooth == true) {
var midpointX = 0.5*(0.5*(this.from.x + this.via.x) + 0.5*(this.to.x + this.via.x));
var midpointY = 0.5*(0.5*(this.from.y + this.via.y) + 0.5*(this.to.y + this.via.y));
point = {x:midpointX, y:midpointY};
}
else {
point = this._pointOnLine(0.5);
}
this._label(ctx, this.label, point.x, point.y); this._label(ctx, this.label, point.x, point.y);
} }
} }
@ -422,7 +429,15 @@ Edge.prototype._drawDashLine = function(ctx) {
// draw label // draw label
if (this.label) { if (this.label) {
var point = this._pointOnLine(0.5);
var point;
if (this.smooth == true) {
var midpointX = 0.5*(0.5*(this.from.x + this.via.x) + 0.5*(this.to.x + this.via.x));
var midpointY = 0.5*(0.5*(this.from.y + this.via.y) + 0.5*(this.to.y + this.via.y));
point = {x:midpointX, y:midpointY};
}
else {
point = this._pointOnLine(0.5);
}
this._label(ctx, this.label, point.x, point.y); this._label(ctx, this.label, point.x, point.y);
} }
}; };
@ -493,7 +508,6 @@ Edge.prototype._drawArrowCenter = function(ctx) {
// draw label // draw label
if (this.label) { if (this.label) {
point = this._pointOnLine(0.5);
this._label(ctx, this.label, point.x, point.y); this._label(ctx, this.label, point.x, point.y);
} }
} }
@ -597,7 +611,15 @@ Edge.prototype._drawArrow = function(ctx) {
// draw label // draw label
if (this.label) { if (this.label) {
var point = this._pointOnLine(0.5);
var point;
if (this.smooth == true) {
var midpointX = 0.5*(0.5*(this.from.x + this.via.x) + 0.5*(this.to.x + this.via.x));
var midpointY = 0.5*(0.5*(this.from.y + this.via.y) + 0.5*(this.to.y + this.via.y));
point = {x:midpointX, y:midpointY};
}
else {
point = this._pointOnLine(0.5);
}
this._label(ctx, this.label, point.x, point.y); this._label(ctx, this.label, point.x, point.y);
} }
} }

Loading…
Cancel
Save