Browse Source

Allow Node and Edge title values to be the result of a function.

css_transitions
Tim Pettersen 10 years ago
parent
commit
a3b1997df1
6 changed files with 14 additions and 12 deletions
  1. +1
    -1
      README.md
  2. +2
    -2
      dist/vis.js
  3. +2
    -2
      dist/vis.min.js
  4. +7
    -5
      docs/graph.html
  5. +1
    -1
      src/graph/Edge.js
  6. +1
    -1
      src/graph/Node.js

+ 1
- 1
README.md View File

@ -143,7 +143,7 @@ Then, the project can be build running:
## Test
To test teh library, install the project dependencies once:
To test the library, install the project dependencies once:
npm install

+ 2
- 2
dist/vis.js View File

@ -9728,7 +9728,7 @@ Node.prototype._reset = function() {
* has been set.
*/
Node.prototype.getTitle = function() {
return this.title;
return typeof this.title === "function" ? this.title() : this.title;
};
/**
@ -10609,7 +10609,7 @@ Edge.prototype.disconnect = function () {
* has been set.
*/
Edge.prototype.getTitle = function() {
return this.title;
return typeof this.title === "function" ? this.title() : this.title;
};

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


+ 7
- 5
docs/graph.html View File

@ -416,10 +416,11 @@ var nodes = [
<tr>
<td>title</td>
<td>string</td>
<td>string | function</td>
<td>no</td>
<td>Title to be displayed when the user hovers over the node.
The title can contain HTML code.</td>
The title can contain HTML code. If using a function, return a falsey
value to prevent the tooltip from being displayed.</td>
</tr>
<tr>
@ -606,10 +607,11 @@ var edges = [
</tr>
<tr>
<td>title</td>
<td>string</td>
<td>string | function</td>
<td>no</td>
<td>Title to be displayed when the user hovers over the edge.
The title can contain HTML code.</td>
The title can contain HTML code. If using a function, return a falsey
value to prevent the tooltip from being displayed.</td>
</tr>
<tr>
@ -1388,7 +1390,7 @@ 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>
</tr>
</table>
<h4 id="PhysicsConfiguration">Configuration:</h5>
<h4 id="PhysicsConfiguration">Configuration:</h4>
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.

+ 1
- 1
src/graph/Edge.js View File

@ -175,7 +175,7 @@ Edge.prototype.disconnect = function () {
* has been set.
*/
Edge.prototype.getTitle = function() {
return this.title;
return typeof this.title === "function" ? this.title() : this.title;
};

+ 1
- 1
src/graph/Node.js View File

@ -317,7 +317,7 @@ Node.prototype._reset = function() {
* has been set.
*/
Node.prototype.getTitle = function() {
return this.title;
return typeof this.title === "function" ? this.title() : this.title;
};
/**

Loading…
Cancel
Save