Browse Source

Merge branch 'develop' into simplified

css_transitions
josdejong 10 years ago
parent
commit
1760598396
65 changed files with 190 additions and 1243 deletions
  1. +0
    -1
      CNAME
  2. +26
    -0
      HISTORY.md
  3. +1
    -1
      bower.json
  4. +0
    -94
      css/style.css
  5. +56
    -431
      dist/vis.js
  6. +10
    -10
      dist/vis.min.js
  7. +5
    -0
      docs/css/style.css
  8. +12
    -0
      docs/graph.html
  9. +18
    -9
      docs/timeline.html
  10. +0
    -1
      examples/graph/22_les_miserables.html
  11. +1
    -9
      examples/graph/25_physics_configuration.html
  12. +1
    -1
      examples/graph/graphviz/graphviz_gallery.html
  13. +1
    -0
      examples/graph/index.html
  14. BIN
      favicon.ico
  15. BIN
      img/external-link-icons/external-link-icon.png
  16. +0
    -40
      img/external-link-icons/license.txt
  17. BIN
      img/forkme_right_darkblue_121621.png
  18. BIN
      img/gallery/graph/01_basic_usage.png
  19. BIN
      img/gallery/graph/02_random_nodes.png
  20. BIN
      img/gallery/graph/03_images.png
  21. BIN
      img/gallery/graph/04_shapes.png
  22. BIN
      img/gallery/graph/05_social_network.png
  23. BIN
      img/gallery/graph/06_groups.png
  24. BIN
      img/gallery/graph/07_selections.png
  25. BIN
      img/gallery/graph/08_mobile_friendly.png
  26. BIN
      img/gallery/graph/09_sizing.png
  27. BIN
      img/gallery/graph/10_multiline_text.png
  28. BIN
      img/gallery/graph/11_custom_style.png
  29. BIN
      img/gallery/graph/12_scalable_images.png
  30. BIN
      img/gallery/graph/13_dashed_lines.png
  31. BIN
      img/gallery/graph/14_dot_language.png
  32. BIN
      img/gallery/graph/15_dot_language_playground.png
  33. BIN
      img/gallery/graph/15_dot_language_playground2.png
  34. BIN
      img/gallery/graph/16_dynamic_data.png
  35. BIN
      img/gallery/graph/17_network_info.png
  36. BIN
      img/gallery/graph/18_fully_random_nodes_clustering.png
  37. BIN
      img/gallery/graph/19_scale_free_graph_clustering.png
  38. BIN
      img/gallery/graph/20_navigation.png
  39. BIN
      img/gallery/graph/21_data_manipulation.png
  40. BIN
      img/gallery/graph/22_les_miserables.png
  41. BIN
      img/gallery/graph/23_hierarchical_layout.png
  42. BIN
      img/gallery/graph/24_hierarchical_layout_predefined.png
  43. BIN
      img/gallery/graph/graphviz_gallery.png
  44. BIN
      img/gallery/timeline/01_basic.png
  45. BIN
      img/gallery/timeline/02_dataset.png
  46. BIN
      img/gallery/timeline/03_much_data.png
  47. BIN
      img/gallery/timeline/04_html_data.png
  48. BIN
      img/gallery/timeline/05_groups.png
  49. +0
    -169
      img/logo/vis.svg
  50. BIN
      img/logo/vis128.png
  51. BIN
      img/logo/vis16.png
  52. BIN
      img/logo/vis256.png
  53. BIN
      img/logo/vis32.ico
  54. BIN
      img/logo/vis32.png
  55. BIN
      img/logo/vis64.png
  56. +0
    -360
      index.html
  57. +1
    -1
      misc/how_to_publish.md
  58. +0
    -0
      package.js
  59. +1
    -1
      package.json
  60. +27
    -5
      src/graph/Edge.js
  61. +6
    -12
      src/graph/Graph.js
  62. +20
    -37
      src/graph/graphMixins/physics/PhysicsMixin.js
  63. +2
    -2
      src/timeline/component/ItemSet.js
  64. +2
    -1
      src/timeline/component/css/item.css
  65. +0
    -58
      updateversion.js

+ 0
- 1
CNAME View File

@ -1 +0,0 @@
visjs.org

+ 26
- 0
HISTORY.md View File

@ -2,6 +2,32 @@ vis.js history
http://visjs.org http://visjs.org
## 2014-03-06, version 0.6.1
### Graph
- Bugfix graphviz examples.
- Bugfix labels position for smooth curves.
- Tweaked graphviz example physics.
- Updated physics documentation to stress importance of configurePhysics.
### Timeline
- Fixed a bug with options `margin.axis` and `margin.item` being ignored when setting them to zero.
- Some clarifications in the documentation.
## 2014-03-05, version 0.6.0
### Graph
- Added Physics Configuration option. This makes tweaking the physics system to suit your needs easier.
- Click and doubleClick events.
- Initial zoom bugfix.
- Directions for Hierarchical layout.
- Refactoring and bugfixes.
## 2014-02-20, version 0.5.1 ## 2014-02-20, version 0.5.1
- Fixed broken bower module. - Fixed broken bower module.

+ 1
- 1
bower.json View File

@ -1,6 +1,6 @@
{ {
"name": "vis", "name": "vis",
"version": "0.6.0-SNAPSHOT",
"version": "0.7.0-SNAPSHOT",
"description": "A dynamic, browser-based visualization library.", "description": "A dynamic, browser-based visualization library.",
"homepage": "http://visjs.org/", "homepage": "http://visjs.org/",
"repository": { "repository": {

+ 0
- 94
css/style.css View File

@ -1,94 +0,0 @@
#menu {
position: absolute;
left: -170px;
top: 35px;
background-color: #a7c8f9;
padding: 15px;
border-radius: 3px;
}
#forkme {
position: fixed;
top: 0;
right: 0;
border: 0;
}
div.nav {
text-align: center;
}
div.nav ul {
text-decoration: none;
text-transform: uppercase;
margin-bottom: 30px;
padding-left: 0;
}
li.nav {
}
div.nav ul li {
text-decoration: none;
text-transform: uppercase;
font-weight: normal;
font-size: 11pt;
list-style: none;
margin-top: 5px;
}
div.nav ul li ul li {
text-decoration: none;
text-transform: none;
font-weight: normal;
font-size: 11pt;
color: #4D4D4D;
list-style: none;
}
div.nav a {
color: #2B7CE9;
color: white;
font-weight: bold;
}
.subtitle {
color: gray;
text-transform: uppercase;
font-size: 11pt;
}
.download td {
border: none;
padding: 5px 20px 5px 0;
}
.gallery .thumb {
display: inline-block;
text-align: center;
margin-right: 10px;
margin-bottom: 20px;
}
.gallery .thumb img {
border: 1px solid white;
border-radius: 5px;
height: 90px;
margin: 0;
}
.gallery .thumb a:hover img {
border-color: lightgray;
}
.gallery .thumb div {
margin: 0;
}
img {
border: 0;
}

+ 56
- 431
dist/vis.js View File

@ -4,8 +4,8 @@
* *
* A dynamic, browser-based visualization library. * A dynamic, browser-based visualization library.
* *
* @version 0.6.0-SNAPSHOT
* @date 2014-03-03
* @version 0.7.0-SNAPSHOT
* @date 2014-03-05
* *
* @license * @license
* Copyright (C) 2011-2014 Almende B.V, http://almende.com * Copyright (C) 2011-2014 Almende B.V, http://almende.com
@ -2350,380 +2350,6 @@ DataView.prototype._trigger = DataSet.prototype._trigger;
DataView.prototype.subscribe = DataView.prototype.on; DataView.prototype.subscribe = DataView.prototype.on;
DataView.prototype.unsubscribe = DataView.prototype.off; DataView.prototype.unsubscribe = DataView.prototype.off;
/**
* Created by Alex on 2/27/14.
*/
function SvgAxis (range,mainId, constants) {
this.svgId = mainId;
this.range = range;
this.constants = constants;
this.duration = this.range.end - this.range.start; // in milliseconds
this.minColumnWidth = 100;
this._drawElements();
this._update();
}
SvgAxis.prototype._drawElements = function() {
d3.select(this.svgId)
.append("rect")
.attr("id","bars")
.attr("x",0)
.attr("y",0)
.attr("width", this.constants.width)
.attr("height",this.constants.barHeight)
.style("stroke", "rgb(6,120,155)");
this.leftText = d3.select(this.svgId)
.append("text")
.attr("x", 5)
.attr("y", 20)
.attr("font-size", 14)
.text(moment(this.range.start));
this.rightText = d3.select(this.svgId)
.append("text")
.attr("y", 20)
.attr("font-size", 14)
.text(moment(this.range.end))
this.rightText.attr("x", this.constants.width - 5 - this.rightText.node().getBBox().width);
this.dateLabels = {};
this.markerLines = {};
}
SvgAxis.prototype._createMarkerLine = function(index) {
this.markerLines[index] = {svg:d3.select("svg#main").append("line")
.attr('y1',0)
.attr('y2',this.constants.height)
.style("stroke", "rgb(220,220,220)")
}
}
SvgAxis.prototype._createDateLabel = function(index) {
this.dateLabels[index] = {svg:d3.select(this.svgId)
.append("text")
.attr("font-size",12)
, active:false};
}
SvgAxis.prototype._update = function() {
this.duration = this.range.end - this.range.start; // in milliseconds
this.leftText.text(moment(this.range.start).format("DD-MM-YYYY HH:mm:ss"))
this.rightText.text(moment(this.range.end).format("DD-MM-YYYY"))
this.rightText.attr("x", this.constants.width - 5 - this.rightText.node().getBBox().width);
this.msPerPixel = this.duration / this.constants.width;
this.columnDuration = this.minColumnWidth * this.msPerPixel;
var milliSecondScale = [1,10,50,100,250,500];
var secondScale = [1,5,15,30];
var minuteScale = [1,5,15,30];
var hourScale = [1,3,6,12];
var dayScale = [1,2,3,5,10,15];
var monthScale = [1,2,3,4,5,6];
var yearScale = [1,2,3,4,5,6,7,8,9,10,15,20,25,50,75,100,150,250,500,1000];
var multipliers = [1,1000,60000,3600000,24*3600000,30*24*3600000,365*24*3600000];
var scales = [milliSecondScale,secondScale,minuteScale,hourScale,dayScale,monthScale,yearScale]
var formats = ["SSS","mm:ss","hh:mm:ss","DD HH:mm","DD-MM","MM-YYYY","YYYY"]
var indices = this._getAppropriateScale(scales,multipliers);
var scale = scales[indices[0]][indices[1]] * multipliers[indices[0]];
var dateCorrection = (this.range.start.valueOf() % scale) +3600000;
for (var i = 0; i < 30; i++) {
var date = this.range.start + i*scale - dateCorrection;
if (((i+1)*scale - dateCorrection)/this.msPerPixel > this.constants.width + 200) {
if (this.dateLabels.hasOwnProperty(i)) {
this.dateLabels[i].svg.remove();
delete this.dateLabels[i]
}
if (this.markerLines.hasOwnProperty(i)) {
this.markerLines[i].svg.remove();
delete this.markerLines[i]
}
}
else {
if (!this.dateLabels.hasOwnProperty(i)) {
this._createDateLabel(i);
}
if (!this.markerLines.hasOwnProperty(i)) {
this._createMarkerLine(i);
}
this.dateLabels[i].svg.text(moment(date).format(formats[indices[0]]))
.attr("x",(i*scale - dateCorrection)/this.msPerPixel)
.attr("y",50)
this.markerLines[i].svg.attr("x1",(i*scale - dateCorrection)/this.msPerPixel)
.attr("x2",(i*scale - dateCorrection)/this.msPerPixel)
}
}
}
SvgAxis.prototype._getAppropriateScale = function(scales,multipliers) {
for (var i = 0; i < scales.length; i++) {
for (var j = 0; j < scales[i].length; j++) {
if (scales[i][j] * multipliers[i] > this.columnDuration) {
return [i,j]
}
}
}
}
/**
* @constructor SvgTimeline
* Create a graph visualization, displaying nodes and edges.
*
* @param {Element} container The DOM element in which the Graph will
* be created. Normally a div element.
* @param {Object} items An object containing parameters
* {Array} nodes
* {Array} edges
* @param {Object} options Options
*/
function SvgTimeline (container, items, options) {
this.constants = {
width:1400,
height:400,
barHeight: 60
}
var now = moment().hours(0).minutes(0).seconds(0).milliseconds(0);
this.range = {
start:now.clone().add('days', -3).valueOf(),
end: now.clone().add('days', 4).valueOf()
}
this.items = {};
this.sortedItems = [];
this.activeItems = {};
this.sortedActiveItems = [];
this._createItems(items);
this.container = container;
this._createSVG();
this.axis = new SvgAxis(this.range,"svg#main",this.constants);
var me = this;
this.hammer = Hammer(document.getElementById("main"), {
prevent_default: true
});
this.hammer.on('tap', me._onTap.bind(me) );
this.hammer.on('doubletap', me._onDoubleTap.bind(me) );
this.hammer.on('hold', me._onHold.bind(me) );
this.hammer.on('pinch', me._onPinch.bind(me) );
this.hammer.on('touch', me._onTouch.bind(me) );
this.hammer.on('dragstart', me._onDragStart.bind(me) );
this.hammer.on('drag', me._onDrag.bind(me) );
this.hammer.on('dragend', me._onDragEnd.bind(me) );
this.hammer.on('release', me._onRelease.bind(me) );
this.hammer.on('mousewheel',me._onMouseWheel.bind(me) );
this.hammer.on('DOMMouseScroll',me._onMouseWheel.bind(me) ); // for FF
this.hammer.on('mousemove', me._onMouseMoveTitle.bind(me) );
//this._drawLines();
this._update();
}
SvgTimeline.prototype._createSVG = function() {
d3.select("div#visualization")
.append("svg").attr("id","main")
.attr("width",this.constants.width)
.attr("height",this.constants.height)
.attr("style","border:1px solid black")
};
SvgTimeline.prototype._createItems = function (items) {
for (var i = 0; i < items.length; i++) {
this.items[items[i].id] = new Item(items[i], this.constants);
this.sortedItems.push(this.items[items[i].id]);
}
this._sortItems(this.sortedItems);
}
SvgTimeline.prototype._sortItems = function (items) {
items.sort(function(a,b) {return a.start - b.start});
}
SvgTimeline.prototype._getPointer = function (touch) {
return {
x: touch.pageX,
y: touch.pageY
};
};
SvgTimeline.prototype._onTap = function() {};
SvgTimeline.prototype._onDoubleTap = function() {};
SvgTimeline.prototype._onHold = function() {};
SvgTimeline.prototype._onPinch = function() {};
SvgTimeline.prototype._onTouch = function(event) {};
SvgTimeline.prototype._onDragStart = function(event) {
this.initialDragPos = this._getPointer(event.gesture.center);
};
SvgTimeline.prototype._onDrag = function(event) {
var pointer = this._getPointer(event.gesture.center);
var diffX = pointer.x - this.initialDragPos.x;
// var diffY = pointer.y - this.initialDragPos.y;
this.initialDragPos = pointer;
this.range.start -= diffX * this.axis.msPerPixel;
this.range.end -= diffX * this.axis.msPerPixel;
this._update();
};
SvgTimeline.prototype._onDragEnd = function() {};
SvgTimeline.prototype._onRelease = function() {};
SvgTimeline.prototype._onMouseWheel = function(event) {
var delta = 0;
if (event.wheelDelta) { /* IE/Opera. */
delta = event.wheelDelta/120;
}
else if (event.detail) { /* Mozilla case. */
// In Mozilla, sign of delta is different than in IE.
// Also, delta is multiple of 3.
delta = -event.detail/3;
}
if (delta) {
var pointer = {x:event.x, y:event.y}
var center = this.range.start + this.axis.duration * 0.5;
var zoomSpeed = 0.1;
var scrollSpeed = 0.1;
this.range.start = center - 0.5*(this.axis.duration * (1 - delta*zoomSpeed));
this.range.end = this.range.start + (this.axis.duration * (1 - delta*zoomSpeed));
var diffX = delta*(pointer.x - 0.5*this.constants.width);
// var diffY = pointer.y - this.initialDragPos.y;
this.range.start -= diffX * this.axis.msPerPixel * scrollSpeed;
this.range.end -= diffX * this.axis.msPerPixel * scrollSpeed;
this._update();
}
};
SvgTimeline.prototype._onMouseMoveTitle = function() {};
SvgTimeline.prototype._update = function() {
this.axis._update();
this._getActiveItems();
this._updateItems();
};
SvgTimeline.prototype._getActiveItems = function() {
// reset all currently active items to inactive
for (var itemId in this.activeItems) {
if (this.activeItems.hasOwnProperty(itemId)) {
this.activeItems[itemId].active = false;
}
}
this.sortedActiveItems = []
var rangeStart = this.range.start-200*this.axis.msPerPixel
var rangeEnd = (this.range.end+200*this.axis.msPerPixel)
for (var itemId in this.items) {
if (this.items.hasOwnProperty(itemId)) {
if (this.items[itemId].start >= rangeStart && this.items[itemId].start < rangeEnd ||
this.items[itemId].end >= rangeStart && this.items[itemId].end < rangeEnd) {
if (this.items[itemId].active == false) {
this.activeItems[itemId] = this.items[itemId];
}
this.activeItems[itemId].active = true;
this.sortedActiveItems.push(this.activeItems[itemId]);
}
}
}
this._sortItems(this.sortedActiveItems);
// cleanup
for (var itemId in this.activeItems) {
if (this.activeItems.hasOwnProperty(itemId)) {
if (this.activeItems[itemId].active == false) {
this.activeItems[itemId].svg.remove();
this.activeItems[itemId].svg = null;
this.activeItems[itemId].svgLine.remove();
this.activeItems[itemId].svgLine = null;
delete this.activeItems[itemId];
}
}
}
};
SvgTimeline.prototype._updateItems = function() {
for (var i = 0; i < this.sortedActiveItems.length; i++) {
var item = this.sortedActiveItems[i];
if (item.svg == null) {
// item.svg = d3.select("svg#main")
// .append("rect")
// .attr("class","item")
// .style("stroke", "rgb(6,120,155)")
// .style("fill", "rgb(6,120,155)");
item.svg = d3.select("svg#main")
.append("foreignObject")
item.svgContent = item.svg.append("xhtml:body")
.style("font", "14px 'Helvetica Neue'")
.style("background-color", "#ff00ff")
.html("<h1>An HTML Foreign Object in SVG</h1><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec eu enim quam. Quisque nisi risus, sagittis quis tempor nec, aliquam eget neque. Nulla bibendum semper lorem non ullamcorper. Nulla non ligula lorem. Praesent porttitor, tellus nec suscipit aliquam, enim elit posuere lorem, at laoreet enim ligula sed tortor. Ut sodales, urna a aliquam semper, nibh diam gravida sapien, sit amet fermentum purus lacus eget massa. Donec ac arcu vel magna consequat pretium et vel ligula. Donec sit amet erat elit. Vivamus eu metus eget est hendrerit rutrum. Curabitur vitae orci et leo interdum egestas ut sit amet dui. In varius enim ut sem posuere in tristique metus ultrices.<p>Integer mollis massa at orci porta vestibulum. Pellentesque dignissim turpis ut tortor ultricies condimentum et quis nibh. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer euismod lorem vulputate dui pharetra luctus. Sed vulputate, nunc quis porttitor scelerisque, dui est varius ipsum, eu blandit mauris nibh pellentesque tortor. Vivamus ultricies ante eget ipsum pulvinar ac tempor turpis mollis. Morbi tortor orci, euismod vel sagittis ac, lobortis nec est. Quisque euismod venenatis felis at dapibus. Vestibulum dignissim nulla ut nisi tristique porttitor. Proin et nunc id arcu cursus dapibus non quis libero. Nunc ligula mi, bibendum non mattis nec, luctus id neque. Suspendisse ut eros lacus. Praesent eget lacus eget risus congue vestibulum. Morbi tincidunt pulvinar lacus sed faucibus. Phasellus sed vestibulum sapien.");
if (item.end == 0) {
item.svgLine = d3.select("svg#main")
.append("line")
.attr("y1",this.constants.barHeight)
.style("stroke", "rgb(200,200,255)")
.style("stroke-width", 3)
}
}
item.svg.attr('width',item.getLength(this.axis.msPerPixel))
.attr("x",this._getXforItem(item))
.attr("y",this._getYforItem(item, i))
.attr('height',25)
if (item.end == 0) {
item.svgLine.attr('y2',item.y)
.attr('x1',item.timeX)
.attr('x2',item.timeX)
}
}
};
SvgTimeline.prototype._getXforItem = function(item) {
item.timeX = (item.start - this.range.start)/this.axis.msPerPixel;
if (item.end == 0) {
item.drawX = item.timeX - item.width * 0.5;
}
else {
item.drawX = item.timeX;
}
return item.drawX;
}
SvgTimeline.prototype._getYforItem = function(item, index) {
var bounds = 10;
var startIndex = Math.max(0,index-bounds);
item.level = 0;
for (var i = startIndex; i < index; i++) {
var item2 = this.sortedActiveItems[i];
if (item.drawX <= (item2.drawX + item2.width + 5) && item2.level == item.level) {
item.level += 1;
}
}
item.y = 100 + 50*item.level;
return item.y;
}
/** /**
* @constructor TimeStep * @constructor TimeStep
* The class TimeStep is an iterator for dates. You provide a start date and an * The class TimeStep is an iterator for dates. You provide a start date and an
@ -11019,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);
} }
} }
@ -11209,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);
} }
}; };
@ -11280,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);
} }
} }
@ -11384,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);
} }
} }
@ -12048,6 +11696,7 @@ var physicsMixin = {
*/ */
_loadPhysicsConfiguration : function() { _loadPhysicsConfiguration : function() {
if (this.physicsConfiguration === undefined) { if (this.physicsConfiguration === undefined) {
var hierarchicalLayoutDirections = ["LR","RL","UD","DU"];
this.physicsConfiguration = document.createElement('div'); this.physicsConfiguration = document.createElement('div');
this.physicsConfiguration.className = "PhysicsConfiguration"; this.physicsConfiguration.className = "PhysicsConfiguration";
this.physicsConfiguration.innerHTML = '' + this.physicsConfiguration.innerHTML = '' +
@ -12061,127 +11710,109 @@ var physicsMixin = {
'<table id="graph_BH_table" style="display:none">'+ '<table id="graph_BH_table" style="display:none">'+
'<tr><td><b>Barnes Hut</b></td></tr>'+ '<tr><td><b>Barnes Hut</b></td></tr>'+
'<tr>'+ '<tr>'+
'<td width="150px">gravitationalConstant</td><td>0</td><td><input type="range" min="500" max="20000" value="2000" step="25" style="width:300px" id="graph_BH_gc"></td><td width="50px">-20000</td><td><input value="-2000" id="graph_BH_gc_value" style="width:60px"></td>'+
'<td width="150px">gravitationalConstant</td><td>0</td><td><input type="range" min="500" max="20000" value="' + (-1* this.constants.physics.barnesHut.gravitationalConstant) + '" step="25" style="width:300px" id="graph_BH_gc"></td><td width="50px">-20000</td><td><input value="' + (-1* this.constants.physics.barnesHut.gravitationalConstant) + '" id="graph_BH_gc_value" style="width:60px"></td>'+
'</tr>'+ '</tr>'+
'<tr>'+ '<tr>'+
'<td width="150px">centralGravity</td><td>0</td><td><input type="range" min="0" max="3" value="0.3" step="0.05" style="width:300px" id="graph_BH_cg"></td><td>3</td><td><input value="0.03" id="graph_BH_cg_value" style="width:60px"></td>'+
'<td width="150px">centralGravity</td><td>0</td><td><input type="range" min="0" max="3" value="' + this.constants.physics.barnesHut.centralGravity + '" step="0.05" style="width:300px" id="graph_BH_cg"></td><td>3</td><td><input value="' + this.constants.physics.barnesHut.centralGravity + '" id="graph_BH_cg_value" style="width:60px"></td>'+
'</tr>'+ '</tr>'+
'<tr>'+ '<tr>'+
'<td width="150px">springLength</td><td>0</td><td><input type="range" min="0" max="500" value="100" step="1" style="width:300px" id="graph_BH_sl"></td><td>500</td><td><input value="100" id="graph_BH_sl_value" style="width:60px"></td>'+
'<td width="150px">springLength</td><td>0</td><td><input type="range" min="0" max="500" value="' + this.constants.physics.barnesHut.springLength + '" step="1" style="width:300px" id="graph_BH_sl"></td><td>500</td><td><input value="' + this.constants.physics.barnesHut.springLength + '" id="graph_BH_sl_value" style="width:60px"></td>'+
'</tr>'+ '</tr>'+
'<tr>'+ '<tr>'+
'<td width="150px">springConstant</td><td>0</td><td><input type="range" min="0" max="0.5" value="0.05" step="0.005" style="width:300px" id="graph_BH_sc"></td><td>0.5</td><td><input value="0.05" id="graph_BH_sc_value" style="width:60px"></td>'+
'<td width="150px">springConstant</td><td>0</td><td><input type="range" min="0" max="0.5" value="' + this.constants.physics.barnesHut.springConstant + '" step="0.001" style="width:300px" id="graph_BH_sc"></td><td>0.5</td><td><input value="' + this.constants.physics.barnesHut.springConstant + '" id="graph_BH_sc_value" style="width:60px"></td>'+
'</tr>'+ '</tr>'+
'<tr>'+ '<tr>'+
'<td width="150px">damping</td><td>0</td><td><input type="range" min="0" max="0.3" value="0.09" step="0.005" style="width:300px" id="graph_BH_damp"></td><td>0.3</td><td><input value="0.09" id="graph_BH_damp_value" style="width:60px"></td>'+
'<td width="150px">damping</td><td>0</td><td><input type="range" min="0" max="0.3" value="' + this.constants.physics.barnesHut.damping + '" step="0.005" style="width:300px" id="graph_BH_damp"></td><td>0.3</td><td><input value="' + this.constants.physics.barnesHut.damping + '" id="graph_BH_damp_value" style="width:60px"></td>'+
'</tr>'+ '</tr>'+
'</table>'+ '</table>'+
'<table id="graph_R_table" style="display:none">'+ '<table id="graph_R_table" style="display:none">'+
'<tr><td><b>Repulsion</b></td></tr>'+ '<tr><td><b>Repulsion</b></td></tr>'+
'<tr>'+ '<tr>'+
'<td width="150px">nodeDistance</td><td>0</td><td><input type="range" min="0" max="300" value="100" step="1" style="width:300px" id="graph_R_nd"></td><td width="50px">300</td><td><input value="100" id="graph_R_nd_value" style="width:60px"></td>'+
'<td width="150px">nodeDistance</td><td>0</td><td><input type="range" min="0" max="300" value="' + this.constants.physics.repulsion.nodeDistance + '" step="1" style="width:300px" id="graph_R_nd"></td><td width="50px">300</td><td><input value="' + this.constants.physics.repulsion.nodeDistance + '" id="graph_R_nd_value" style="width:60px"></td>'+
'</tr>'+ '</tr>'+
'<tr>'+ '<tr>'+
'<td width="150px">centralGravity</td><td>0</td><td><input type="range" min="0" max="3" value="0.1" step="0.05" style="width:300px" id="graph_R_cg"></td><td>3</td><td><input value="0.01" id="graph_R_cg_value" style="width:60px"></td>'+
'<td width="150px">centralGravity</td><td>0</td><td><input type="range" min="0" max="3" value="' + this.constants.physics.repulsion.centralGravity + '" step="0.05" style="width:300px" id="graph_R_cg"></td><td>3</td><td><input value="' + this.constants.physics.repulsion.centralGravity + '" id="graph_R_cg_value" style="width:60px"></td>'+
'</tr>'+ '</tr>'+
'<tr>'+ '<tr>'+
'<td width="150px">springLength</td><td>0</td><td><input type="range" min="0" max="500" value="200" step="1" style="width:300px" id="graph_R_sl"></td><td>500</td><td><input value="200" id="graph_R_sl_value" style="width:60px"></td>'+
'<td width="150px">springLength</td><td>0</td><td><input type="range" min="0" max="500" value="' + this.constants.physics.repulsion.springLength + '" step="1" style="width:300px" id="graph_R_sl"></td><td>500</td><td><input value="' + this.constants.physics.repulsion.springLength + '" id="graph_R_sl_value" style="width:60px"></td>'+
'</tr>'+ '</tr>'+
'<tr>'+ '<tr>'+
'<td width="150px">springConstant</td><td>0</td><td><input type="range" min="0" max="0.5" value="0.05" step="0.005" style="width:300px" id="graph_R_sc"></td><td>0.5</td><td><input value="0.05" id="graph_R_sc_value" style="width:60px"></td>'+
'<td width="150px">springConstant</td><td>0</td><td><input type="range" min="0" max="0.5" value="' + this.constants.physics.repulsion.springConstant + '" step="0.001" style="width:300px" id="graph_R_sc"></td><td>0.5</td><td><input value="' + this.constants.physics.repulsion.springConstant + '" id="graph_R_sc_value" style="width:60px"></td>'+
'</tr>'+ '</tr>'+
'<tr>'+ '<tr>'+
'<td width="150px">damping</td><td>0</td><td><input type="range" min="0" max="0.3" value="0.09" step="0.005" style="width:300px" id="graph_R_damp"></td><td>0.3</td><td><input value="0.09" id="graph_R_damp_value" style="width:60px"></td>'+
'<td width="150px">damping</td><td>0</td><td><input type="range" min="0" max="0.3" value="' + this.constants.physics.repulsion.damping + '" step="0.005" style="width:300px" id="graph_R_damp"></td><td>0.3</td><td><input value="' + this.constants.physics.repulsion.damping + '" id="graph_R_damp_value" style="width:60px"></td>'+
'</tr>'+ '</tr>'+
'</table>'+ '</table>'+
'<table id="graph_H_table" style="display:none">'+ '<table id="graph_H_table" style="display:none">'+
'<tr><td width="150"><b>Hierarchical</b></td></tr>'+ '<tr><td width="150"><b>Hierarchical</b></td></tr>'+
'<tr>'+ '<tr>'+
'<td width="150px">nodeDistance</td><td>0</td><td><input type="range" min="0" max="300" value="60" step="1" style="width:300px" id="graph_H_nd"></td><td width="50px">300</td><td><input value="60" id="graph_H_nd_value" style="width:60px"></td>'+
'<td width="150px">nodeDistance</td><td>0</td><td><input type="range" min="0" max="300" value="' + this.constants.physics.hierarchicalRepulsion.nodeDistance + '" step="1" style="width:300px" id="graph_H_nd"></td><td width="50px">300</td><td><input value="' + this.constants.physics.hierarchicalRepulsion.nodeDistance + '" id="graph_H_nd_value" style="width:60px"></td>'+
'</tr>'+ '</tr>'+
'<tr>'+ '<tr>'+
'<td width="150px">centralGravity</td><td>0</td><td><input type="range" min="0" max="3" value="0" step="0.05" style="width:300px" id="graph_H_cg"></td><td>3</td><td><input value="0" id="graph_H_cg_value" style="width:60px"></td>'+
'<td width="150px">centralGravity</td><td>0</td><td><input type="range" min="0" max="3" value="' + this.constants.physics.hierarchicalRepulsion.centralGravity + '" step="0.05" style="width:300px" id="graph_H_cg"></td><td>3</td><td><input value="' + this.constants.physics.hierarchicalRepulsion.centralGravity + '" id="graph_H_cg_value" style="width:60px"></td>'+
'</tr>'+ '</tr>'+
'<tr>'+ '<tr>'+
'<td width="150px">springLength</td><td>0</td><td><input type="range" min="0" max="500" value="100" step="1" style="width:300px" id="graph_H_sl"></td><td>500</td><td><input value="100" id="graph_H_sl_value" style="width:60px"></td>'+
'<td width="150px">springLength</td><td>0</td><td><input type="range" min="0" max="500" value="' + this.constants.physics.hierarchicalRepulsion.springLength + '" step="1" style="width:300px" id="graph_H_sl"></td><td>500</td><td><input value="' + this.constants.physics.hierarchicalRepulsion.springLength + '" id="graph_H_sl_value" style="width:60px"></td>'+
'</tr>'+ '</tr>'+
'<tr>'+ '<tr>'+
'<td width="150px">springConstant</td><td>0</td><td><input type="range" min="0" max="0.5" value="0.01" step="0.005" style="width:300px" id="graph_H_sc"></td><td>0.5</td><td><input value="0.01" id="graph_H_sc_value" style="width:60px"></td>'+
'<td width="150px">springConstant</td><td>0</td><td><input type="range" min="0" max="0.5" value="' + this.constants.physics.hierarchicalRepulsion.springConstant + '" step="0.001" style="width:300px" id="graph_H_sc"></td><td>0.5</td><td><input value="' + this.constants.physics.hierarchicalRepulsion.springConstant + '" id="graph_H_sc_value" style="width:60px"></td>'+
'</tr>'+ '</tr>'+
'<tr>'+ '<tr>'+
'<td width="150px">damping</td><td>0</td><td><input type="range" min="0" max="0.3" value="0.09" step="0.005" style="width:300px" id="graph_H_damp"></td><td>0.3</td><td><input value="0.09" id="graph_H_damp_value" style="width:60px"></td>'+
'<td width="150px">damping</td><td>0</td><td><input type="range" min="0" max="0.3" value="' + this.constants.physics.hierarchicalRepulsion.damping + '" step="0.005" style="width:300px" id="graph_H_damp"></td><td>0.3</td><td><input value="' + this.constants.physics.hierarchicalRepulsion.damping + '" id="graph_H_damp_value" style="width:60px"></td>'+
'</tr>'+ '</tr>'+
'<tr>'+ '<tr>'+
'<td width="150px">direction</td><td>1</td><td><input type="range" min="0" max="3" value="0" step="1" style="width:300px" id="graph_H_direction"></td><td>4</td><td><input value="LR" id="graph_H_direction_value" style="width:60px"></td>'+
'<td width="150px">direction</td><td>1</td><td><input type="range" min="0" max="3" value="' + hierarchicalLayoutDirections.indexOf(this.constants.hierarchicalLayout.direction) + '" step="1" style="width:300px" id="graph_H_direction"></td><td>4</td><td><input value="' + this.constants.hierarchicalLayout.direction + '" id="graph_H_direction_value" style="width:60px"></td>'+
'</tr>'+ '</tr>'+
'<tr>'+ '<tr>'+
'<td width="150px">levelSeparation</td><td>1</td><td><input type="range" min="0" max="500" value="150" step="1" style="width:300px" id="graph_H_levsep"></td><td>500</td><td><input value="150" id="graph_H_levsep_value" style="width:60px"></td>'+
'<td width="150px">levelSeparation</td><td>1</td><td><input type="range" min="0" max="' + this.constants.hierarchicalLayout.levelSeparation + '" value="150" step="1" style="width:300px" id="graph_H_levsep"></td><td>500</td><td><input value="' + this.constants.hierarchicalLayout.levelSeparation + '" id="graph_H_levsep_value" style="width:60px"></td>'+
'</tr>'+ '</tr>'+
'<tr>'+ '<tr>'+
'<td width="150px">nodeSpacing</td><td>1</td><td><input type="range" min="0" max="500" value="100" step="1" style="width:300px" id="graph_H_nspac"></td><td>500</td><td><input value="100" id="graph_H_nspac_value" style="width:60px"></td>'+
'<td width="150px">nodeSpacing</td><td>1</td><td><input type="range" min="0" max="' + this.constants.hierarchicalLayout.nodeSpacing + '" value="100" step="1" style="width:300px" id="graph_H_nspac"></td><td>500</td><td><input value="' + this.constants.hierarchicalLayout.nodeSpacing + '" id="graph_H_nspac_value" style="width:60px"></td>'+
'</tr>'+ '</tr>'+
'</table>' '</table>'
this.containerElement.parentElement.insertBefore(this.physicsConfiguration,this.containerElement); this.containerElement.parentElement.insertBefore(this.physicsConfiguration,this.containerElement);
var hierarchicalLayoutDirections = ["LR","RL","UD","DU"];
var rangeElement; var rangeElement;
rangeElement = document.getElementById('graph_BH_gc'); rangeElement = document.getElementById('graph_BH_gc');
rangeElement.innerHTML = this.constants.physics.barnesHut.gravitationalConstant;
rangeElement.onchange = showValueOfRange.bind(this,'graph_BH_gc',-1,"physics_barnesHut_gravitationalConstant"); rangeElement.onchange = showValueOfRange.bind(this,'graph_BH_gc',-1,"physics_barnesHut_gravitationalConstant");
rangeElement = document.getElementById('graph_BH_cg'); rangeElement = document.getElementById('graph_BH_cg');
rangeElement.innerHTML = this.constants.physics.barnesHut.centralGravity;
rangeElement.onchange = showValueOfRange.bind(this,'graph_BH_cg',1,"physics_centralGravity"); rangeElement.onchange = showValueOfRange.bind(this,'graph_BH_cg',1,"physics_centralGravity");
rangeElement = document.getElementById('graph_BH_sc'); rangeElement = document.getElementById('graph_BH_sc');
rangeElement.innerHTML = this.constants.physics.barnesHut.springConstant;
rangeElement.onchange = showValueOfRange.bind(this,'graph_BH_sc',1,"physics_springConstant"); rangeElement.onchange = showValueOfRange.bind(this,'graph_BH_sc',1,"physics_springConstant");
rangeElement = document.getElementById('graph_BH_sl'); rangeElement = document.getElementById('graph_BH_sl');
rangeElement.innerHTML = this.constants.physics.barnesHut.springLength;
rangeElement.onchange = showValueOfRange.bind(this,'graph_BH_sl',1,"physics_springLength"); rangeElement.onchange = showValueOfRange.bind(this,'graph_BH_sl',1,"physics_springLength");
rangeElement = document.getElementById('graph_BH_damp'); rangeElement = document.getElementById('graph_BH_damp');
rangeElement.innerHTML = this.constants.physics.barnesHut.damping;
rangeElement.onchange = showValueOfRange.bind(this,'graph_BH_damp',1,"physics_damping"); rangeElement.onchange = showValueOfRange.bind(this,'graph_BH_damp',1,"physics_damping");
rangeElement = document.getElementById('graph_R_nd'); rangeElement = document.getElementById('graph_R_nd');
rangeElement.innerHTML = this.constants.physics.repulsion.nodeDistance;
rangeElement.onchange = showValueOfRange.bind(this,'graph_R_nd',1,"physics_repulsion_nodeDistance"); rangeElement.onchange = showValueOfRange.bind(this,'graph_R_nd',1,"physics_repulsion_nodeDistance");
rangeElement = document.getElementById('graph_R_cg'); rangeElement = document.getElementById('graph_R_cg');
rangeElement.innerHTML = this.constants.physics.repulsion.centralGravity;
rangeElement.onchange = showValueOfRange.bind(this,'graph_R_cg',1,"physics_centralGravity"); rangeElement.onchange = showValueOfRange.bind(this,'graph_R_cg',1,"physics_centralGravity");
rangeElement = document.getElementById('graph_R_sc'); rangeElement = document.getElementById('graph_R_sc');
rangeElement.innerHTML = this.constants.physics.repulsion.springConstant;
rangeElement.onchange = showValueOfRange.bind(this,'graph_R_sc',1,"physics_springConstant"); rangeElement.onchange = showValueOfRange.bind(this,'graph_R_sc',1,"physics_springConstant");
rangeElement = document.getElementById('graph_R_sl'); rangeElement = document.getElementById('graph_R_sl');
rangeElement.innerHTML = this.constants.physics.repulsion.springLength;
rangeElement.onchange = showValueOfRange.bind(this,'graph_R_sl',1,"physics_springLength"); rangeElement.onchange = showValueOfRange.bind(this,'graph_R_sl',1,"physics_springLength");
rangeElement = document.getElementById('graph_R_damp'); rangeElement = document.getElementById('graph_R_damp');
rangeElement.innerHTML = this.constants.physics.repulsion.damping;
rangeElement.onchange = showValueOfRange.bind(this,'graph_R_damp',1,"physics_damping"); rangeElement.onchange = showValueOfRange.bind(this,'graph_R_damp',1,"physics_damping");
rangeElement = document.getElementById('graph_H_nd'); rangeElement = document.getElementById('graph_H_nd');
rangeElement.innerHTML = this.constants.physics.hierarchicalRepulsion.nodeDistance;
rangeElement.onchange = showValueOfRange.bind(this,'graph_H_nd',1,"physics_hierarchicalRepulsion_nodeDistance"); rangeElement.onchange = showValueOfRange.bind(this,'graph_H_nd',1,"physics_hierarchicalRepulsion_nodeDistance");
rangeElement = document.getElementById('graph_H_cg'); rangeElement = document.getElementById('graph_H_cg');
rangeElement.innerHTML = this.constants.physics.hierarchicalRepulsion.centralGravity;
rangeElement.onchange = showValueOfRange.bind(this,'graph_H_cg',1,"physics_centralGravity"); rangeElement.onchange = showValueOfRange.bind(this,'graph_H_cg',1,"physics_centralGravity");
rangeElement = document.getElementById('graph_H_sc'); rangeElement = document.getElementById('graph_H_sc');
rangeElement.innerHTML = this.constants.physics.hierarchicalRepulsion.springConstant;
rangeElement.onchange = showValueOfRange.bind(this,'graph_H_sc',1,"physics_springConstant"); rangeElement.onchange = showValueOfRange.bind(this,'graph_H_sc',1,"physics_springConstant");
rangeElement = document.getElementById('graph_H_sl'); rangeElement = document.getElementById('graph_H_sl');
rangeElement.innerHTML = this.constants.physics.hierarchicalRepulsion.springLength;
rangeElement.onchange = showValueOfRange.bind(this,'graph_H_sl',1,"physics_springLength"); rangeElement.onchange = showValueOfRange.bind(this,'graph_H_sl',1,"physics_springLength");
rangeElement = document.getElementById('graph_H_damp'); rangeElement = document.getElementById('graph_H_damp');
rangeElement.innerHTML = this.constants.physics.hierarchicalRepulsion.damping;
rangeElement.onchange = showValueOfRange.bind(this,'graph_H_damp',1,"physics_damping"); rangeElement.onchange = showValueOfRange.bind(this,'graph_H_damp',1,"physics_damping");
rangeElement = document.getElementById('graph_H_direction'); rangeElement = document.getElementById('graph_H_direction');
rangeElement.innerHTML = hierarchicalLayoutDirections.indexOf(this.constants.hierarchicalLayout.direction);
rangeElement.onchange = showValueOfRange.bind(this,'graph_H_direction',hierarchicalLayoutDirections,"hierarchicalLayout_direction"); rangeElement.onchange = showValueOfRange.bind(this,'graph_H_direction',hierarchicalLayoutDirections,"hierarchicalLayout_direction");
rangeElement = document.getElementById('graph_H_levsep'); rangeElement = document.getElementById('graph_H_levsep');
rangeElement.innerHTML = this.constants.hierarchicalLayout.levelSeparation;
rangeElement.onchange = showValueOfRange.bind(this,'graph_H_levsep',1,"hierarchicalLayout_levelSeparation"); rangeElement.onchange = showValueOfRange.bind(this,'graph_H_levsep',1,"hierarchicalLayout_levelSeparation");
rangeElement = document.getElementById('graph_H_nspac'); rangeElement = document.getElementById('graph_H_nspac');
rangeElement.innerHTML = this.constants.hierarchicalLayout.nodeSpacing;
rangeElement.onchange = showValueOfRange.bind(this,'graph_H_nspac',1,"hierarchicalLayout_nodeSpacing"); rangeElement.onchange = showValueOfRange.bind(this,'graph_H_nspac',1,"hierarchicalLayout_nodeSpacing");
var radioButton1 = document.getElementById("graph_physicsMethod1"); var radioButton1 = document.getElementById("graph_physicsMethod1");
@ -16524,8 +16155,6 @@ Graph.prototype.zoomExtent = function(initialZoom, disableStart) {
} }
this.pinch.mousewheelScale = zoomLevel;
this._setScale(zoomLevel); this._setScale(zoomLevel);
this._centerGraph(range); this._centerGraph(range);
if (disableStart == false) { if (disableStart == false) {
@ -17127,7 +16756,6 @@ Graph.prototype._zoom = function(scale, pointer) {
this.areaCenter = {"x" : this._canvasToX(pointer.x), this.areaCenter = {"x" : this._canvasToX(pointer.x),
"y" : this._canvasToY(pointer.y)}; "y" : this._canvasToY(pointer.y)};
this.pinch.mousewheelScale = scale;
this._setScale(scale); this._setScale(scale);
this._setTranslation(tx, ty); this._setTranslation(tx, ty);
this.updateClustersDefault(); this.updateClustersDefault();
@ -17159,12 +16787,9 @@ Graph.prototype._onMouseWheel = function(event) {
// Basically, delta is now positive if wheel was scrolled up, // Basically, delta is now positive if wheel was scrolled up,
// and negative, if wheel was scrolled down. // and negative, if wheel was scrolled down.
if (delta) { if (delta) {
if (!('mousewheelScale' in this.pinch)) {
this.pinch.mousewheelScale = 1;
}
// calculate the new scale // calculate the new scale
var scale = this.pinch.mousewheelScale;
var scale = this._getScale();
var zoom = delta / 10; var zoom = delta / 10;
if (delta < 0) { if (delta < 0) {
zoom = zoom / (1 - zoom); zoom = zoom / (1 - zoom);
@ -17177,9 +16802,6 @@ Graph.prototype._onMouseWheel = function(event) {
// apply the new scale // apply the new scale
this._zoom(scale, pointer); this._zoom(scale, pointer);
// store the new, applied scale -- this is now done in _zoom
// this.pinch.mousewheelScale = scale;
} }
// Prevent default actions caused by mouse wheel. // Prevent default actions caused by mouse wheel.
@ -17324,7 +16946,7 @@ Graph.prototype.setSize = function(width, height) {
this.manipulationDiv.style.width = this.frame.canvas.clientWidth; this.manipulationDiv.style.width = this.frame.canvas.clientWidth;
} }
this.emit('frameResize', {width:this.frame.canvas.width,height:this.frame.canvas.height});
this.emit('resize', {width:this.frame.canvas.width,height:this.frame.canvas.height});
}; };
/** /**
@ -17953,6 +17575,9 @@ Graph.prototype._animationStep = function() {
}; };
window.requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame ||
window.webkitRequestAnimationFrame || window.msRequestAnimationFrame;
/** /**
* Schedule a animation step with the refreshrate interval. * Schedule a animation step with the refreshrate interval.
* *
@ -17960,8 +17585,8 @@ Graph.prototype._animationStep = function() {
*/ */
Graph.prototype.start = function() { Graph.prototype.start = function() {
if (this.moving || this.xIncrement != 0 || this.yIncrement != 0 || this.zoomIncrement != 0) { if (this.moving || this.xIncrement != 0 || this.yIncrement != 0 || this.zoomIncrement != 0) {
if (!this.timer) {
this.timer = window.setTimeout(this._animationStep.bind(this), this.renderTimestep); // wait this.renderTimeStep milliseconds and perform the animation step function
if (!this.timer) {
this.timer = window.requestAnimationFrame(this._animationStep.bind(this), this.renderTimestep); // wait this.renderTimeStep milliseconds and perform the animation step function
} }
} }
else { else {

+ 10
- 10
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.

+ 18
- 9
docs/timeline.html View File

@ -216,13 +216,13 @@ var items = [
<td>no</td> <td>no</td>
<td>This field is optional. A className can be used to give items <td>This field is optional. A className can be used to give items
an individual css style. For example, when an item has className an individual css style. For example, when an item has className
'red', one can define a css style
<code>
.red {
background-color: red;
border-color: dark-red;
}
</code>.
'red', one can define a css style like:
<pre class="prettyprint lang-css">
.vis.timeline .red {
color: white;
background-color: red;
border-color: darkred;
}</pre>
More details on how to style items can be found in the section More details on how to style items can be found in the section
<a href="#Styles">Styles</a>. <a href="#Styles">Styles</a>.
</td> </td>
@ -310,7 +310,10 @@ var groups = [
<pre class="prettyprint lang-js"> <pre class="prettyprint lang-js">
var options = { var options = {
width: '100%', width: '100%',
height: '30px'
height: '30px',
margin: {
item: 20
}
}; };
</pre> </pre>
@ -476,7 +479,13 @@ var options = {
<td>Number</td> <td>Number</td>
<td>5</td> <td>5</td>
<td>The padding of items, needed to correctly calculate the size <td>The padding of items, needed to correctly calculate the size
of item ranges. Must correspond with the css of item ranges.</td>
of item ranges. Must correspond with the css of items, for example when setting <code>options.padding=10</code>, corresponding css is:
<pre class="prettyprint lang-css">
.vis.timeline .item {
padding: 10px;
}
</pre>
</td>
</tr> </tr>
<tr> <tr>

+ 0
- 1
examples/graph/22_les_miserables.html View File

@ -359,7 +359,6 @@
var data = { var data = {
nodes: nodes, nodes: nodes,
edges: edges edges: edges
}; };
var options = {nodes: {shape:'circle'},stabilize: false}; var options = {nodes: {shape:'circle'},stabilize: false};
var graph = new vis.Graph(container, data, options); var graph = new vis.Graph(container, data, options);

+ 1
- 9
examples/graph/25_physics_configuration.html View File

@ -27,7 +27,7 @@
var connectionCount = []; var connectionCount = [];
// randomly create some nodes and edges // randomly create some nodes and edges
var nodeCount = document.getElementById('nodeCount').value;
var nodeCount = 60;
for (var i = 0; i < nodeCount; i++) { for (var i = 0; i < nodeCount; i++) {
nodes.push({ nodes.push({
id: i, id: i,
@ -103,14 +103,6 @@
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. 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.
</div> </div>
<br /> <br />
<form onsubmit="draw(); return false;">
<label for="nodeCount">Number of nodes:</label>
<input id="nodeCount" type="text" value="25" style="width: 50px;">
<input type="submit" value="Go">
</form>
<br>
<div id="mygraph"></div> <div id="mygraph"></div>
<p id="selection"></p> <p id="selection"></p>

+ 1
- 1
examples/graph/graphviz/graphviz_gallery.html View File

@ -65,7 +65,7 @@
<script type="text/javascript"> <script type="text/javascript">
var container = document.getElementById('mygraph'); var container = document.getElementById('mygraph');
var url = document.getElementById('url'); var url = document.getElementById('url');
var graph = new vis.Graph(container);
var graph = new vis.Graph(container,{},{physics:{barnesHut:{springLength:75,springConstant:0.015}}});
function loadData () { function loadData () {
$.ajax({ $.ajax({

+ 1
- 0
examples/graph/index.html View File

@ -36,6 +36,7 @@
<p><a href="22_les_miserables.html">22_les_miserables.html</a></p> <p><a href="22_les_miserables.html">22_les_miserables.html</a></p>
<p><a href="23_hierarchical_layout.html">23_hierarchical_layout.html</a></p> <p><a href="23_hierarchical_layout.html">23_hierarchical_layout.html</a></p>
<p><a href="24_hierarchical_layout_userdefined.html">24_hierarchical_layout_userdefined.html</a></p> <p><a href="24_hierarchical_layout_userdefined.html">24_hierarchical_layout_userdefined.html</a></p>
<p><a href="25_physics_configuration.html">25_physics_configuration.html</a></p>
<p><a href="graphviz/graphviz_gallery.html">graphviz_gallery.html</a></p> <p><a href="graphviz/graphviz_gallery.html">graphviz_gallery.html</a></p>
</div> </div>

BIN
favicon.ico View File

Before After

BIN
img/external-link-icons/external-link-icon.png View File

Before After
Width: 9  |  Height: 9  |  Size: 194 B

+ 0
- 40
img/external-link-icons/license.txt View File

@ -1,40 +0,0 @@
/**************************************\
Shapes4FREE License
http://www.shapes4free.com/ - visit us to get free photoshop shapes, read our easy-to-understand shapes tutorials and tips, and view beautiful examples of using shapes in all kinds of design
More about the license: http://www.shapes4free.com/license/
\**************************************/
This resource was created by Oksana Khristenko
This resource has been downloaded from Shapes4FREE.com and is free for personal or commercial projects. You may use it for web and print design.
No attribution or backlinks are required, but we would certainly appreciate it if you bookmarked www.shapes4free.com and shared the link to it with your friends:
www.shapes4free.com - free photoshop shapes
You may not resell or distribute this resource. Uploading it to another website
or offering them for download on another website is not allowed. If you would like to feature this resource on
your website or share them with friends, do not link directly to the resource files,
please link to the appropriate page on Shapes4FREE.com where it is possible to download the freebie.
/**************************************\
Shapes4FREE Ëèöåíçèÿ
http://www.shapes4free.com/ - áåñïëàòíûå ôèãóðû äëÿ Ôîòîøîïà, óðîêè è ïîäñêàçêè, à òàêæå êðàñèâûå ïðèìåðû èñïîëüçîâàíèÿ ôèãóð âî âñåõ âèäàõ äèçàéíà
Ëèöåíçèÿ: http://www.shapes4free.com/license-ru/
\**************************************/
Àâòîð: Îêñàíà Õðèñòåíêî
Âñå áåñïëàòíûå ðåñóðñû êîòîðûå ìîæíî ñêà÷àòü íà Shapes4FREE.com, âêëþ÷àÿ ïðîèçâîëüíûå ôèãóðû äëÿ Ôîòîøîïà
(photoshop custom shapes) áåñïëàòíû äëÿ èñïîëüçîâàíèÿ â ëè÷íûõ è êîììåð÷åñêèõ ïðîåêòàõ. Ðàçðåøåíî èñïîëüçîâàòü
áåñïëàòíûå ðåñóðñû Shapes4FREE â âåá äèçàéíå è ïå÷àòíûõ ìàòåðèàëàõ.
Ññûëêà íà ñàéò Shapes4FREE.com íå òðåáóåòñÿ íî ïðèâåòñòâóåòñÿ. Ìû áóäåì ðàäû åñëè âû ðàññêàæåòå î íàñ äðóçüÿì:
www.shapes4free.com - áåñïëàòíûå ôèãóðû äëÿ Ôîòîøîïà
Çàïðåùåíî ïðîäàâàòü èëè ðàñïðîñòðàíÿòü áåñïëàòíûå ðåñóðñû ñîçäàííûå Shapes4FREE.
Çàïðåùåíî çàãðóæàòü èõ íà äðóãèå ñàéòû è ïîçâîëÿòü ïîëüçîâàòåëÿì èõ ñêà÷èâàòü. Åñëè âû õîòèòå ðàññêàçàòü î íàøåì
áåñïëàòíîì ðåñóðñå íà ñàéòå èëè ïîäåëèòüñÿ ñ äðóçüÿìè, íå ñîçäàâàéòå ïðÿìûõ ññûëîê íà ôàéë, ñîçäàéòå ññûëêó íà
ñîîòâåòñòâóþùóþ ñòðàíèöó ñàéòà Shapes4FREE.com ãäå ìîæíî áóäåò ñêà÷àòü ýòîò ðåñóðñ.

BIN
img/forkme_right_darkblue_121621.png View File

Before After
Width: 149  |  Height: 149  |  Size: 7.6 KiB

BIN
img/gallery/graph/01_basic_usage.png View File

Before After
Width: 400  |  Height: 400  |  Size: 21 KiB

BIN
img/gallery/graph/02_random_nodes.png View File

Before After
Width: 600  |  Height: 600  |  Size: 58 KiB

BIN
img/gallery/graph/03_images.png View File

Before After
Width: 600  |  Height: 600  |  Size: 88 KiB

BIN
img/gallery/graph/04_shapes.png View File

Before After
Width: 797  |  Height: 600  |  Size: 50 KiB

BIN
img/gallery/graph/05_social_network.png View File

Before After
Width: 600  |  Height: 600  |  Size: 76 KiB

BIN
img/gallery/graph/06_groups.png View File

Before After
Width: 600  |  Height: 600  |  Size: 40 KiB

BIN
img/gallery/graph/07_selections.png View File

Before After
Width: 400  |  Height: 400  |  Size: 14 KiB

BIN
img/gallery/graph/08_mobile_friendly.png View File

Before After
Width: 605  |  Height: 551  |  Size: 45 KiB

BIN
img/gallery/graph/09_sizing.png View File

Before After
Width: 600  |  Height: 600  |  Size: 27 KiB

BIN
img/gallery/graph/10_multiline_text.png View File

Before After
Width: 600  |  Height: 600  |  Size: 40 KiB

BIN
img/gallery/graph/11_custom_style.png View File

Before After
Width: 600  |  Height: 600  |  Size: 59 KiB

BIN
img/gallery/graph/12_scalable_images.png View File

Before After
Width: 600  |  Height: 600  |  Size: 104 KiB

BIN
img/gallery/graph/13_dashed_lines.png View File

Before After
Width: 600  |  Height: 600  |  Size: 26 KiB

BIN
img/gallery/graph/14_dot_language.png View File

Before After
Width: 381  |  Height: 330  |  Size: 13 KiB

BIN
img/gallery/graph/15_dot_language_playground.png View File

Before After
Width: 429  |  Height: 384  |  Size: 31 KiB

BIN
img/gallery/graph/15_dot_language_playground2.png View File

Before After
Width: 842  |  Height: 595  |  Size: 41 KiB

BIN
img/gallery/graph/16_dynamic_data.png View File

Before After
Width: 504  |  Height: 370  |  Size: 17 KiB

BIN
img/gallery/graph/17_network_info.png View File

Before After
Width: 871  |  Height: 648  |  Size: 60 KiB

BIN
img/gallery/graph/18_fully_random_nodes_clustering.png View File

Before After
Width: 92  |  Height: 92  |  Size: 19 KiB

BIN
img/gallery/graph/19_scale_free_graph_clustering.png View File

Before After
Width: 92  |  Height: 92  |  Size: 19 KiB

BIN
img/gallery/graph/20_navigation.png View File

Before After
Width: 92  |  Height: 92  |  Size: 19 KiB

BIN
img/gallery/graph/21_data_manipulation.png View File

Before After
Width: 92  |  Height: 92  |  Size: 20 KiB

BIN
img/gallery/graph/22_les_miserables.png View File

Before After
Width: 92  |  Height: 92  |  Size: 25 KiB

BIN
img/gallery/graph/23_hierarchical_layout.png View File

Before After
Width: 92  |  Height: 92  |  Size: 20 KiB

BIN
img/gallery/graph/24_hierarchical_layout_predefined.png View File

Before After
Width: 92  |  Height: 92  |  Size: 18 KiB

BIN
img/gallery/graph/graphviz_gallery.png View File

Before After
Width: 1237  |  Height: 729  |  Size: 262 KiB

BIN
img/gallery/timeline/01_basic.png View File

Before After
Width: 544  |  Height: 195  |  Size: 9.0 KiB

BIN
img/gallery/timeline/02_dataset.png View File

Before After
Width: 544  |  Height: 195  |  Size: 9.0 KiB

BIN
img/gallery/timeline/03_much_data.png View File

Before After
Width: 544  |  Height: 263  |  Size: 14 KiB

BIN
img/gallery/timeline/04_html_data.png View File

Before After
Width: 544  |  Height: 248  |  Size: 16 KiB

BIN
img/gallery/timeline/05_groups.png View File

Before After
Width: 711  |  Height: 459  |  Size: 24 KiB

+ 0
- 169
img/logo/vis.svg View File

@ -1,169 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="128"
height="128"
id="svg2"
version="1.1"
inkscape:version="0.48.3.1 r9886"
sodipodi:docname="vis.svg"
inkscape:export-filename="/home/jos/projects/vis-pages/img/logo/vis256.png"
inkscape:export-xdpi="180"
inkscape:export-ydpi="180">
<defs
id="defs4">
<filter
inkscape:collect="always"
id="filter3765">
<feGaussianBlur
inkscape:collect="always"
stdDeviation="0.098994946"
id="feGaussianBlur3767" />
</filter>
<filter
color-interpolation-filters="sRGB"
inkscape:collect="always"
id="filter3765-8">
<feGaussianBlur
inkscape:collect="always"
stdDeviation="0.098994946"
id="feGaussianBlur3767-2" />
</filter>
<filter
color-interpolation-filters="sRGB"
inkscape:collect="always"
id="filter3765-8-3">
<feGaussianBlur
inkscape:collect="always"
stdDeviation="0.098994946"
id="feGaussianBlur3767-2-9" />
</filter>
<filter
color-interpolation-filters="sRGB"
inkscape:collect="always"
id="filter3765-3">
<feGaussianBlur
inkscape:collect="always"
stdDeviation="0.098994946"
id="feGaussianBlur3767-3" />
</filter>
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="2.8284271"
inkscape:cx="13.788283"
inkscape:cy="60.335199"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:snap-global="true"
inkscape:window-width="1600"
inkscape:window-height="850"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:showpageshadow="false"
borderlayer="false"
showborder="true">
<inkscape:grid
type="xygrid"
id="grid2987"
empspacing="5"
visible="true"
enabled="true"
snapvisiblegridlinesonly="true" />
</sodipodi:namedview>
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,-924.36217)">
<path
sodipodi:type="arc"
style="fill:#109618;fill-opacity:1;stroke:none;opacity:0.01587302"
id="path4104"
sodipodi:cx="64.25"
sodipodi:cy="64.5"
sodipodi:rx="63.75"
sodipodi:ry="64"
d="m 128,64.5 a 63.75,64 0 1 1 -127.5,0 63.75,64 0 1 1 127.5,0 z"
transform="matrix(0.93139646,0,0,0.83984375,-189.81956,958.94835)" />
<path
style="fill:#ffcf00;fill-opacity:1;stroke:#ffcf00;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
d="M 3.3795626,993.2579 C 22.563164,969.55671 64.941101,938.83212 101.8906,932.98778 c 15.01437,32.97153 15.80482,65.24066 11.89745,97.27812 -53.04371,-1.7716 -84.489701,-14.912 -110.4084874,-37.008 z"
id="path2991"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccc" />
<path
style="fill:#109618;fill-opacity:1;stroke:#109618;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
d="m 4.586161,1010.1966 c 29.519439,19.0948 61.669847,32.8593 114.396079,29.9232 6.98138,-4.9614 5.91066,-11.2031 3.61936,-17.6388 -37.656342,4.9772 -79.514689,1.6063 -118.015439,-12.2844 z"
id="path3761"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccc" />
<path
sodipodi:type="arc"
style="fill:#ff9900;fill-opacity:1;stroke:none;filter:url(#filter3765-8)"
id="path3763-6"
sodipodi:cx="66.998367"
sodipodi:cy="63.476505"
sodipodi:rx="10.429825"
sodipodi:ry="9.3691645"
d="m 77.428192,63.476505 a 10.429825,9.3691645 0 1 1 -20.85965,0 10.429825,9.3691645 0 1 1 20.85965,0 z"
transform="matrix(3.7791753,0,0,4.159068,-180.52628,715.8869)" />
<path
sodipodi:type="arc"
style="fill:#dc3912;fill-opacity:1;stroke:none;filter:url(#filter3765-8-3)"
id="path3763-6-3"
sodipodi:cx="66.998367"
sodipodi:cy="63.476505"
sodipodi:rx="10.429825"
sodipodi:ry="9.3691645"
d="m 77.428192,63.476505 a 10.429825,9.3691645 0 1 1 -20.85965,0 10.429825,9.3691645 0 1 1 20.85965,0 z"
transform="matrix(2.1560756,0,0,2.3930971,-65.92105,839.4416)" />
<path
sodipodi:type="arc"
style="fill:#ffffff;fill-opacity:1;stroke:none;filter:url(#filter3765)"
id="path3763"
sodipodi:cx="66.998367"
sodipodi:cy="63.476505"
sodipodi:rx="10.429825"
sodipodi:ry="9.3691645"
d="m 77.428192,63.476505 a 10.429825,9.3691645 0 1 1 -20.85965,0 10.429825,9.3691645 0 1 1 20.85965,0 z"
transform="matrix(1.369772,0,0,1.5215787,-11.897888,900.22297)" />
<path
sodipodi:type="arc"
style="fill:#4d4d4d;fill-opacity:1;stroke:none;filter:url(#filter3765-3)"
id="path3763-9"
sodipodi:cx="66.998367"
sodipodi:cy="63.476505"
sodipodi:rx="10.429825"
sodipodi:ry="9.3691645"
d="m 77.428192,63.476505 a 10.429825,9.3691645 0 1 1 -20.85965,0 10.429825,9.3691645 0 1 1 20.85965,0 z"
transform="matrix(0.68506744,0,0,0.76063592,38.273417,952.729)" />
</g>
</svg>

BIN
img/logo/vis128.png View File

Before After
Width: 128  |  Height: 128  |  Size: 5.5 KiB

BIN
img/logo/vis16.png View File

Before After
Width: 16  |  Height: 16  |  Size: 660 B

BIN
img/logo/vis256.png View File

Before After
Width: 256  |  Height: 256  |  Size: 13 KiB

BIN
img/logo/vis32.ico View File

Before After

BIN
img/logo/vis32.png View File

Before After
Width: 32  |  Height: 32  |  Size: 1.4 KiB

BIN
img/logo/vis64.png View File

Before After
Width: 64  |  Height: 64  |  Size: 2.9 KiB

+ 0
- 360
index.html View File

@ -1,360 +0,0 @@
<!doctype html>
<html>
<head>
<title>vis.js | a dynamic, browser-based visualization library</title>
<meta charset='utf-8' />
<meta name="title" content="vis.js">
<meta name="description" content="vis.js is a dynamic, browser-based visualization library" />
<meta name="keywords" content="vis, visualization, javascript, browser based, web based, chart, linechart, timeline, graph, network, browser" />
<meta name="author" content="Almende B.V.">
<link href="docs/css/prettify.css" type="text/css" rel="stylesheet" />
<link href='docs/css/style.css' type='text/css' rel='stylesheet'>
<link href="css/style.css" type="text/css" rel="stylesheet" >
<script type="text/javascript" src="docs/lib/prettify/prettify.js"></script>
</head>
<body onload="prettyPrint();">
<div id="container">
<div id="menu">
<a href="http://visjs.org/"><img src="img/logo/vis128.png" alt="logo"></a>
<div class="nav">
<ul>
<li><a href="#install">Install</a></li>
<li><a href="#example">Example</a></li>
<li><a href="#gallery">Gallery</a></li>
<li>
<a href="docs/index.html" target="_blank">
Docs
<img src="img/external-link-icons/external-link-icon.png" style="vertical-align: text-top;" title="Docs will open in a new window">
</a>
</li>
<li><a href="#license">License</a></li>
</ul>
</div>
</div>
<h1>
vis.js<br>
<span class="subtitle">a visual interaction system</span>
</h1>
<p>
Vis.js is a dynamic, browser based visualization library.
The library is designed to be easy to use, to handle large amounts
of dynamic data, and to enable manipulation of and interaction with the data.
The library consists of the components DataSet, Timeline, and Graph.
</p>
<p>
The vis.js library is developed by <a href="http://almende.com" target="_blank">Almende B.V</a>,
as part of the <a href="http://chap.almende.com/" target="_blank">CHAP</a>.
</p>
<h2 id="install">Install</h2>
<h3>npm</h3>
<pre class="prettyprint">
npm install vis
</pre>
<h3>bower</h3>
<pre class="prettyprint">
bower install vis
</pre>
<h3>download</h3>
<a href="download/vis.zip">Click here to download vis.js</a>
(version <span class="version">0.4.0</span>)
<h2 id="example">Example</h2>
<p>
A basic example demonstrating how to use the vis.js timeline is shown below.
See the <a href="#gallery">gallery</a> below for more examples.
</p>
<pre class="prettyprint lang-html">&lt;!doctype html&gt;
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Timeline | Basic demo&lt;/title&gt;
&lt;script src="http://visjs.org/dist/vis.js"&gt;&lt;/script&gt;
&lt;link href="http://visjs.org/dist/vis.css" rel="stylesheet" type="text/css" /&gt;
&lt;style type="text/css"&gt;
body, html {
font-family: sans-serif;
}
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div id="mytimeline"&gt;&lt;/div&gt;
&lt;script type="text/javascript"&gt;
var container = document.getElementById('mytimeline');
var data = [
{id: 1, content: 'item 1', start: '2013-04-20'},
{id: 2, content: 'item 2', start: '2013-04-14'},
{id: 3, content: 'item 3', start: '2013-04-18'},
{id: 4, content: 'item 4', start: '2013-04-16', end: '2013-04-19'},
{id: 5, content: 'item 5', start: '2013-04-25'},
{id: 6, content: 'item 6', start: '2013-04-27'}
];
var options = {};
var timeline = new vis.Timeline(container, data, options);
&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<h2 id="gallery">Gallery</h2>
This gallery gives an idea of the features and possibilities of the library.
The source code of the examples can be found in the
<a href="https://github.com/almende/vis/tree/master/examples" target="_blank">examples directory</a>.
<h3 id="timeline">Timeline</h3>
<p>
The timeline from vis.js displays different types of data on a timeline.
</p>
<div class="gallery">
<div class="thumb">
<a href="examples/timeline/01_basic.html">
<img src="img/gallery/timeline/01_basic.png">
<div>basic usage</div>
</a>
</div>
<div class="thumb">
<a href="examples/timeline/02_dataset.html">
<img src="img/gallery/timeline/02_dataset.png">
<div>dataset</div>
</a>
</div>
<div class="thumb">
<a href="examples/timeline/03_much_data.html">
<img src="img/gallery/timeline/03_much_data.png">
<div>much data</div>
</a>
</div>
<div class="thumb">
<a href="examples/timeline/04_html_data.html">
<img src="img/gallery/timeline/04_html_data.png">
<div>html data</div>
</a>
</div>
<div class="thumb">
<a href="examples/timeline/05_groups.html">
<img src="img/gallery/timeline/05_groups.png">
<div>groups</div>
</a>
</div>
</div>
<h3 id="graph">Graph</h3>
<p>
The graph from vis.js visualizes graphs and networks with
customizable styles.
</p>
<div class="gallery">
<div class="thumb">
<a href="examples/graph/01_basic_usage.html">
<img src="img/gallery/graph/01_basic_usage.png">
<div>basic usage</div>
</a>
</div>
<div class="thumb">
<a href="examples/graph/02_random_nodes.html">
<img src="img/gallery/graph/02_random_nodes.png">
<div>random nodes</div>
</a>
</div>
<div class="thumb">
<a href="examples/graph/03_images.html">
<img src="img/gallery/graph/03_images.png">
<div>images</div>
</a>
</div>
<div class="thumb">
<a href="examples/graph/04_shapes.html">
<img src="img/gallery/graph/04_shapes.png">
<div>shapes</div>
</a>
</div>
<div class="thumb">
<a href="examples/graph/05_social_network.html">
<img src="img/gallery/graph/05_social_network.png">
<div>social network</div>
</a>
</div>
<div class="thumb">
<a href="examples/graph/06_groups.html">
<img src="img/gallery/graph/06_groups.png">
<div>groups</div>
</a>
</div>
<div class="thumb">
<a href="examples/graph/07_selections.html">
<img src="img/gallery/graph/07_selections.png">
<div>selections</div>
</a>
</div>
<div class="thumb">
<a href="examples/graph/08_mobile_friendly.html">
<img src="img/gallery/graph/08_mobile_friendly.png">
<div>mobile friendly</div>
</a>
</div>
<div class="thumb">
<a href="examples/graph/09_sizing.html">
<img src="img/gallery/graph/09_sizing.png">
<div>sizing</div>
</a>
</div>
<div class="thumb">
<a href="examples/graph/10_multiline_text.html">
<img src="img/gallery/graph/10_multiline_text.png">
<div>multiline text</div>
</a>
</div>
<div class="thumb">
<a href="examples/graph/11_custom_style.html">
<img src="img/gallery/graph/11_custom_style.png">
<div>custom style</div>
</a>
</div>
<div class="thumb">
<a href="examples/graph/12_scalable_images.html">
<img src="img/gallery/graph/12_scalable_images.png">
<div>scalable images</div>
</a>
</div>
<div class="thumb">
<a href="examples/graph/13_dashed_lines.html">
<img src="img/gallery/graph/13_dashed_lines.png">
<div>dashed lines</div>
</a>
</div>
<div class="thumb">
<a href="examples/graph/14_dot_language.html">
<img src="img/gallery/graph/14_dot_language.png">
<div>dot language</div>
</a>
</div>
<div class="thumb">
<a href="examples/graph/15_dot_language_playground.html">
<img src="img/gallery/graph/15_dot_language_playground.png">
<div>playground</div>
</a>
</div>
<div class="thumb">
<a href="examples/graph/16_dynamic_data.html">
<img src="img/gallery/graph/16_dynamic_data.png">
<div>dynamic data</div>
</a>
</div>
<div class="thumb">
<a href="examples/graph/17_network_info.html">
<img src="img/gallery/graph/17_network_info.png">
<div>network info</div>
</a>
</div>
<div class="thumb">
<a href="examples/graph/18_fully_random_nodes_clustering.html">
<img src="img/gallery/graph/18_fully_random_nodes_clustering.png">
<div>random clustering</div>
</a>
</div>
<div class="thumb">
<a href="examples/graph/19_scale_free_graph_clustering.html">
<img src="img/gallery/graph/19_scale_free_graph_clustering.png">
<div>scale-free clustering</div>
</a>
</div>
<div class="thumb">
<a href="examples/graph/20_navigation.html">
<img src="img/gallery/graph/20_navigation.png">
<div>navigation</div>
</a>
</div>
<div class="thumb">
<a href="examples/graph/21_data_manipulation.html">
<img src="img/gallery/graph/21_data_manipulation.png">
<div>data manipulation</div>
</a>
</div>
<div class="thumb">
<a href="examples/graph/22_les_miserables.html">
<img src="img/gallery/graph/22_les_miserables.png">
<div>les miserables</div>
</a>
</div>
<div class="thumb">
<a href="examples/graph/23_hierarchical_layout.html">
<img src="img/gallery/graph/23_hierarchical_layout.png">
<div>autmatic hierarchy</div>
</a>
</div>
<div class="thumb">
<a href="examples/graph/24_hierarchical_layout_userdefined.html">
<img src="img/gallery/graph/24_hierarchical_layout_predefined.png">
<div>user-defined hierarchy</div>
</a>
</div>
<div class="thumb">
<a href="examples/graph/graphviz/graphviz_gallery.html">
<img src="img/gallery/graph/graphviz_gallery.png">
<div>graphviz gallery</div>
</a>
</div>
</div>
<h2 id="docs">Docs</h2>
<p>
Documentation is available here:
<a href="docs/index.html" target="_blank">Documentation</a>
</p>
<h2 id="license">License</h2>
<p>
Copyright (C) 2010-2014 Almende B.V.
</p>
<p>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
</p>
<p>
http://www.apache.org/licenses/LICENSE-2.0
</p>
<p>
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
</p>
<a id="forkme" href="https://github.com/almende/vis/" target="_blank">
<img src="img/forkme_right_darkblue_121621.png" alt="Fork me on GitHub" >
</a>
</div>
</body>
</html>

+ 1
- 1
misc/how_to_publish.md View File

@ -28,7 +28,7 @@ This generates the vis.js library in the folder `./dist`.
- Commit the changes to the `develop` branch. - Commit the changes to the `develop` branch.
- Merge the `develop` branch into the `master` branch. - Merge the `develop` branch into the `master` branch.
- Push the brances to github
- Push the branches to github
- Create a version tag (with the new version number) and push it to github: - Create a version tag (with the new version number) and push it to github:
git tag v0.3.0 git tag v0.3.0

+ 0
- 0
package.js View File


+ 1
- 1
package.json View File

@ -1,6 +1,6 @@
{ {
"name": "vis", "name": "vis",
"version": "0.6.0-SNAPSHOT",
"version": "0.7.0-SNAPSHOT",
"description": "A dynamic, browser-based visualization library.", "description": "A dynamic, browser-based visualization library.",
"homepage": "http://visjs.org/", "homepage": "http://visjs.org/",
"repository": { "repository": {

+ 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);
} }
} }

+ 6
- 12
src/graph/Graph.js View File

@ -386,8 +386,6 @@ Graph.prototype.zoomExtent = function(initialZoom, disableStart) {
} }
this.pinch.mousewheelScale = zoomLevel;
this._setScale(zoomLevel); this._setScale(zoomLevel);
this._centerGraph(range); this._centerGraph(range);
if (disableStart == false) { if (disableStart == false) {
@ -989,7 +987,6 @@ Graph.prototype._zoom = function(scale, pointer) {
this.areaCenter = {"x" : this._canvasToX(pointer.x), this.areaCenter = {"x" : this._canvasToX(pointer.x),
"y" : this._canvasToY(pointer.y)}; "y" : this._canvasToY(pointer.y)};
this.pinch.mousewheelScale = scale;
this._setScale(scale); this._setScale(scale);
this._setTranslation(tx, ty); this._setTranslation(tx, ty);
this.updateClustersDefault(); this.updateClustersDefault();
@ -1021,12 +1018,9 @@ Graph.prototype._onMouseWheel = function(event) {
// Basically, delta is now positive if wheel was scrolled up, // Basically, delta is now positive if wheel was scrolled up,
// and negative, if wheel was scrolled down. // and negative, if wheel was scrolled down.
if (delta) { if (delta) {
if (!('mousewheelScale' in this.pinch)) {
this.pinch.mousewheelScale = 1;
}
// calculate the new scale // calculate the new scale
var scale = this.pinch.mousewheelScale;
var scale = this._getScale();
var zoom = delta / 10; var zoom = delta / 10;
if (delta < 0) { if (delta < 0) {
zoom = zoom / (1 - zoom); zoom = zoom / (1 - zoom);
@ -1039,9 +1033,6 @@ Graph.prototype._onMouseWheel = function(event) {
// apply the new scale // apply the new scale
this._zoom(scale, pointer); this._zoom(scale, pointer);
// store the new, applied scale -- this is now done in _zoom
// this.pinch.mousewheelScale = scale;
} }
// Prevent default actions caused by mouse wheel. // Prevent default actions caused by mouse wheel.
@ -1815,6 +1806,9 @@ Graph.prototype._animationStep = function() {
}; };
window.requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame ||
window.webkitRequestAnimationFrame || window.msRequestAnimationFrame;
/** /**
* Schedule a animation step with the refreshrate interval. * Schedule a animation step with the refreshrate interval.
* *
@ -1822,8 +1816,8 @@ Graph.prototype._animationStep = function() {
*/ */
Graph.prototype.start = function() { Graph.prototype.start = function() {
if (this.moving || this.xIncrement != 0 || this.yIncrement != 0 || this.zoomIncrement != 0) { if (this.moving || this.xIncrement != 0 || this.yIncrement != 0 || this.zoomIncrement != 0) {
if (!this.timer) {
this.timer = window.setTimeout(this._animationStep.bind(this), this.renderTimestep); // wait this.renderTimeStep milliseconds and perform the animation step function
if (!this.timer) {
this.timer = window.requestAnimationFrame(this._animationStep.bind(this), this.renderTimestep); // wait this.renderTimeStep milliseconds and perform the animation step function
} }
} }
else { else {

+ 20
- 37
src/graph/graphMixins/physics/PhysicsMixin.js View File

@ -302,6 +302,7 @@ var physicsMixin = {
*/ */
_loadPhysicsConfiguration : function() { _loadPhysicsConfiguration : function() {
if (this.physicsConfiguration === undefined) { if (this.physicsConfiguration === undefined) {
var hierarchicalLayoutDirections = ["LR","RL","UD","DU"];
this.physicsConfiguration = document.createElement('div'); this.physicsConfiguration = document.createElement('div');
this.physicsConfiguration.className = "PhysicsConfiguration"; this.physicsConfiguration.className = "PhysicsConfiguration";
this.physicsConfiguration.innerHTML = '' + this.physicsConfiguration.innerHTML = '' +
@ -315,127 +316,109 @@ var physicsMixin = {
'<table id="graph_BH_table" style="display:none">'+ '<table id="graph_BH_table" style="display:none">'+
'<tr><td><b>Barnes Hut</b></td></tr>'+ '<tr><td><b>Barnes Hut</b></td></tr>'+
'<tr>'+ '<tr>'+
'<td width="150px">gravitationalConstant</td><td>0</td><td><input type="range" min="500" max="20000" value="2000" step="25" style="width:300px" id="graph_BH_gc"></td><td width="50px">-20000</td><td><input value="-2000" id="graph_BH_gc_value" style="width:60px"></td>'+
'<td width="150px">gravitationalConstant</td><td>0</td><td><input type="range" min="500" max="20000" value="' + (-1* this.constants.physics.barnesHut.gravitationalConstant) + '" step="25" style="width:300px" id="graph_BH_gc"></td><td width="50px">-20000</td><td><input value="' + (-1* this.constants.physics.barnesHut.gravitationalConstant) + '" id="graph_BH_gc_value" style="width:60px"></td>'+
'</tr>'+ '</tr>'+
'<tr>'+ '<tr>'+
'<td width="150px">centralGravity</td><td>0</td><td><input type="range" min="0" max="3" value="0.3" step="0.05" style="width:300px" id="graph_BH_cg"></td><td>3</td><td><input value="0.03" id="graph_BH_cg_value" style="width:60px"></td>'+
'<td width="150px">centralGravity</td><td>0</td><td><input type="range" min="0" max="3" value="' + this.constants.physics.barnesHut.centralGravity + '" step="0.05" style="width:300px" id="graph_BH_cg"></td><td>3</td><td><input value="' + this.constants.physics.barnesHut.centralGravity + '" id="graph_BH_cg_value" style="width:60px"></td>'+
'</tr>'+ '</tr>'+
'<tr>'+ '<tr>'+
'<td width="150px">springLength</td><td>0</td><td><input type="range" min="0" max="500" value="100" step="1" style="width:300px" id="graph_BH_sl"></td><td>500</td><td><input value="100" id="graph_BH_sl_value" style="width:60px"></td>'+
'<td width="150px">springLength</td><td>0</td><td><input type="range" min="0" max="500" value="' + this.constants.physics.barnesHut.springLength + '" step="1" style="width:300px" id="graph_BH_sl"></td><td>500</td><td><input value="' + this.constants.physics.barnesHut.springLength + '" id="graph_BH_sl_value" style="width:60px"></td>'+
'</tr>'+ '</tr>'+
'<tr>'+ '<tr>'+
'<td width="150px">springConstant</td><td>0</td><td><input type="range" min="0" max="0.5" value="0.05" step="0.005" style="width:300px" id="graph_BH_sc"></td><td>0.5</td><td><input value="0.05" id="graph_BH_sc_value" style="width:60px"></td>'+
'<td width="150px">springConstant</td><td>0</td><td><input type="range" min="0" max="0.5" value="' + this.constants.physics.barnesHut.springConstant + '" step="0.001" style="width:300px" id="graph_BH_sc"></td><td>0.5</td><td><input value="' + this.constants.physics.barnesHut.springConstant + '" id="graph_BH_sc_value" style="width:60px"></td>'+
'</tr>'+ '</tr>'+
'<tr>'+ '<tr>'+
'<td width="150px">damping</td><td>0</td><td><input type="range" min="0" max="0.3" value="0.09" step="0.005" style="width:300px" id="graph_BH_damp"></td><td>0.3</td><td><input value="0.09" id="graph_BH_damp_value" style="width:60px"></td>'+
'<td width="150px">damping</td><td>0</td><td><input type="range" min="0" max="0.3" value="' + this.constants.physics.barnesHut.damping + '" step="0.005" style="width:300px" id="graph_BH_damp"></td><td>0.3</td><td><input value="' + this.constants.physics.barnesHut.damping + '" id="graph_BH_damp_value" style="width:60px"></td>'+
'</tr>'+ '</tr>'+
'</table>'+ '</table>'+
'<table id="graph_R_table" style="display:none">'+ '<table id="graph_R_table" style="display:none">'+
'<tr><td><b>Repulsion</b></td></tr>'+ '<tr><td><b>Repulsion</b></td></tr>'+
'<tr>'+ '<tr>'+
'<td width="150px">nodeDistance</td><td>0</td><td><input type="range" min="0" max="300" value="100" step="1" style="width:300px" id="graph_R_nd"></td><td width="50px">300</td><td><input value="100" id="graph_R_nd_value" style="width:60px"></td>'+
'<td width="150px">nodeDistance</td><td>0</td><td><input type="range" min="0" max="300" value="' + this.constants.physics.repulsion.nodeDistance + '" step="1" style="width:300px" id="graph_R_nd"></td><td width="50px">300</td><td><input value="' + this.constants.physics.repulsion.nodeDistance + '" id="graph_R_nd_value" style="width:60px"></td>'+
'</tr>'+ '</tr>'+
'<tr>'+ '<tr>'+
'<td width="150px">centralGravity</td><td>0</td><td><input type="range" min="0" max="3" value="0.1" step="0.05" style="width:300px" id="graph_R_cg"></td><td>3</td><td><input value="0.01" id="graph_R_cg_value" style="width:60px"></td>'+
'<td width="150px">centralGravity</td><td>0</td><td><input type="range" min="0" max="3" value="' + this.constants.physics.repulsion.centralGravity + '" step="0.05" style="width:300px" id="graph_R_cg"></td><td>3</td><td><input value="' + this.constants.physics.repulsion.centralGravity + '" id="graph_R_cg_value" style="width:60px"></td>'+
'</tr>'+ '</tr>'+
'<tr>'+ '<tr>'+
'<td width="150px">springLength</td><td>0</td><td><input type="range" min="0" max="500" value="200" step="1" style="width:300px" id="graph_R_sl"></td><td>500</td><td><input value="200" id="graph_R_sl_value" style="width:60px"></td>'+
'<td width="150px">springLength</td><td>0</td><td><input type="range" min="0" max="500" value="' + this.constants.physics.repulsion.springLength + '" step="1" style="width:300px" id="graph_R_sl"></td><td>500</td><td><input value="' + this.constants.physics.repulsion.springLength + '" id="graph_R_sl_value" style="width:60px"></td>'+
'</tr>'+ '</tr>'+
'<tr>'+ '<tr>'+
'<td width="150px">springConstant</td><td>0</td><td><input type="range" min="0" max="0.5" value="0.05" step="0.005" style="width:300px" id="graph_R_sc"></td><td>0.5</td><td><input value="0.05" id="graph_R_sc_value" style="width:60px"></td>'+
'<td width="150px">springConstant</td><td>0</td><td><input type="range" min="0" max="0.5" value="' + this.constants.physics.repulsion.springConstant + '" step="0.001" style="width:300px" id="graph_R_sc"></td><td>0.5</td><td><input value="' + this.constants.physics.repulsion.springConstant + '" id="graph_R_sc_value" style="width:60px"></td>'+
'</tr>'+ '</tr>'+
'<tr>'+ '<tr>'+
'<td width="150px">damping</td><td>0</td><td><input type="range" min="0" max="0.3" value="0.09" step="0.005" style="width:300px" id="graph_R_damp"></td><td>0.3</td><td><input value="0.09" id="graph_R_damp_value" style="width:60px"></td>'+
'<td width="150px">damping</td><td>0</td><td><input type="range" min="0" max="0.3" value="' + this.constants.physics.repulsion.damping + '" step="0.005" style="width:300px" id="graph_R_damp"></td><td>0.3</td><td><input value="' + this.constants.physics.repulsion.damping + '" id="graph_R_damp_value" style="width:60px"></td>'+
'</tr>'+ '</tr>'+
'</table>'+ '</table>'+
'<table id="graph_H_table" style="display:none">'+ '<table id="graph_H_table" style="display:none">'+
'<tr><td width="150"><b>Hierarchical</b></td></tr>'+ '<tr><td width="150"><b>Hierarchical</b></td></tr>'+
'<tr>'+ '<tr>'+
'<td width="150px">nodeDistance</td><td>0</td><td><input type="range" min="0" max="300" value="60" step="1" style="width:300px" id="graph_H_nd"></td><td width="50px">300</td><td><input value="60" id="graph_H_nd_value" style="width:60px"></td>'+
'<td width="150px">nodeDistance</td><td>0</td><td><input type="range" min="0" max="300" value="' + this.constants.physics.hierarchicalRepulsion.nodeDistance + '" step="1" style="width:300px" id="graph_H_nd"></td><td width="50px">300</td><td><input value="' + this.constants.physics.hierarchicalRepulsion.nodeDistance + '" id="graph_H_nd_value" style="width:60px"></td>'+
'</tr>'+ '</tr>'+
'<tr>'+ '<tr>'+
'<td width="150px">centralGravity</td><td>0</td><td><input type="range" min="0" max="3" value="0" step="0.05" style="width:300px" id="graph_H_cg"></td><td>3</td><td><input value="0" id="graph_H_cg_value" style="width:60px"></td>'+
'<td width="150px">centralGravity</td><td>0</td><td><input type="range" min="0" max="3" value="' + this.constants.physics.hierarchicalRepulsion.centralGravity + '" step="0.05" style="width:300px" id="graph_H_cg"></td><td>3</td><td><input value="' + this.constants.physics.hierarchicalRepulsion.centralGravity + '" id="graph_H_cg_value" style="width:60px"></td>'+
'</tr>'+ '</tr>'+
'<tr>'+ '<tr>'+
'<td width="150px">springLength</td><td>0</td><td><input type="range" min="0" max="500" value="100" step="1" style="width:300px" id="graph_H_sl"></td><td>500</td><td><input value="100" id="graph_H_sl_value" style="width:60px"></td>'+
'<td width="150px">springLength</td><td>0</td><td><input type="range" min="0" max="500" value="' + this.constants.physics.hierarchicalRepulsion.springLength + '" step="1" style="width:300px" id="graph_H_sl"></td><td>500</td><td><input value="' + this.constants.physics.hierarchicalRepulsion.springLength + '" id="graph_H_sl_value" style="width:60px"></td>'+
'</tr>'+ '</tr>'+
'<tr>'+ '<tr>'+
'<td width="150px">springConstant</td><td>0</td><td><input type="range" min="0" max="0.5" value="0.01" step="0.005" style="width:300px" id="graph_H_sc"></td><td>0.5</td><td><input value="0.01" id="graph_H_sc_value" style="width:60px"></td>'+
'<td width="150px">springConstant</td><td>0</td><td><input type="range" min="0" max="0.5" value="' + this.constants.physics.hierarchicalRepulsion.springConstant + '" step="0.001" style="width:300px" id="graph_H_sc"></td><td>0.5</td><td><input value="' + this.constants.physics.hierarchicalRepulsion.springConstant + '" id="graph_H_sc_value" style="width:60px"></td>'+
'</tr>'+ '</tr>'+
'<tr>'+ '<tr>'+
'<td width="150px">damping</td><td>0</td><td><input type="range" min="0" max="0.3" value="0.09" step="0.005" style="width:300px" id="graph_H_damp"></td><td>0.3</td><td><input value="0.09" id="graph_H_damp_value" style="width:60px"></td>'+
'<td width="150px">damping</td><td>0</td><td><input type="range" min="0" max="0.3" value="' + this.constants.physics.hierarchicalRepulsion.damping + '" step="0.005" style="width:300px" id="graph_H_damp"></td><td>0.3</td><td><input value="' + this.constants.physics.hierarchicalRepulsion.damping + '" id="graph_H_damp_value" style="width:60px"></td>'+
'</tr>'+ '</tr>'+
'<tr>'+ '<tr>'+
'<td width="150px">direction</td><td>1</td><td><input type="range" min="0" max="3" value="0" step="1" style="width:300px" id="graph_H_direction"></td><td>4</td><td><input value="LR" id="graph_H_direction_value" style="width:60px"></td>'+
'<td width="150px">direction</td><td>1</td><td><input type="range" min="0" max="3" value="' + hierarchicalLayoutDirections.indexOf(this.constants.hierarchicalLayout.direction) + '" step="1" style="width:300px" id="graph_H_direction"></td><td>4</td><td><input value="' + this.constants.hierarchicalLayout.direction + '" id="graph_H_direction_value" style="width:60px"></td>'+
'</tr>'+ '</tr>'+
'<tr>'+ '<tr>'+
'<td width="150px">levelSeparation</td><td>1</td><td><input type="range" min="0" max="500" value="150" step="1" style="width:300px" id="graph_H_levsep"></td><td>500</td><td><input value="150" id="graph_H_levsep_value" style="width:60px"></td>'+
'<td width="150px">levelSeparation</td><td>1</td><td><input type="range" min="0" max="' + this.constants.hierarchicalLayout.levelSeparation + '" value="150" step="1" style="width:300px" id="graph_H_levsep"></td><td>500</td><td><input value="' + this.constants.hierarchicalLayout.levelSeparation + '" id="graph_H_levsep_value" style="width:60px"></td>'+
'</tr>'+ '</tr>'+
'<tr>'+ '<tr>'+
'<td width="150px">nodeSpacing</td><td>1</td><td><input type="range" min="0" max="500" value="100" step="1" style="width:300px" id="graph_H_nspac"></td><td>500</td><td><input value="100" id="graph_H_nspac_value" style="width:60px"></td>'+
'<td width="150px">nodeSpacing</td><td>1</td><td><input type="range" min="0" max="' + this.constants.hierarchicalLayout.nodeSpacing + '" value="100" step="1" style="width:300px" id="graph_H_nspac"></td><td>500</td><td><input value="' + this.constants.hierarchicalLayout.nodeSpacing + '" id="graph_H_nspac_value" style="width:60px"></td>'+
'</tr>'+ '</tr>'+
'</table>' '</table>'
this.containerElement.parentElement.insertBefore(this.physicsConfiguration,this.containerElement); this.containerElement.parentElement.insertBefore(this.physicsConfiguration,this.containerElement);
var hierarchicalLayoutDirections = ["LR","RL","UD","DU"];
var rangeElement; var rangeElement;
rangeElement = document.getElementById('graph_BH_gc'); rangeElement = document.getElementById('graph_BH_gc');
rangeElement.innerHTML = this.constants.physics.barnesHut.gravitationalConstant;
rangeElement.onchange = showValueOfRange.bind(this,'graph_BH_gc',-1,"physics_barnesHut_gravitationalConstant"); rangeElement.onchange = showValueOfRange.bind(this,'graph_BH_gc',-1,"physics_barnesHut_gravitationalConstant");
rangeElement = document.getElementById('graph_BH_cg'); rangeElement = document.getElementById('graph_BH_cg');
rangeElement.innerHTML = this.constants.physics.barnesHut.centralGravity;
rangeElement.onchange = showValueOfRange.bind(this,'graph_BH_cg',1,"physics_centralGravity"); rangeElement.onchange = showValueOfRange.bind(this,'graph_BH_cg',1,"physics_centralGravity");
rangeElement = document.getElementById('graph_BH_sc'); rangeElement = document.getElementById('graph_BH_sc');
rangeElement.innerHTML = this.constants.physics.barnesHut.springConstant;
rangeElement.onchange = showValueOfRange.bind(this,'graph_BH_sc',1,"physics_springConstant"); rangeElement.onchange = showValueOfRange.bind(this,'graph_BH_sc',1,"physics_springConstant");
rangeElement = document.getElementById('graph_BH_sl'); rangeElement = document.getElementById('graph_BH_sl');
rangeElement.innerHTML = this.constants.physics.barnesHut.springLength;
rangeElement.onchange = showValueOfRange.bind(this,'graph_BH_sl',1,"physics_springLength"); rangeElement.onchange = showValueOfRange.bind(this,'graph_BH_sl',1,"physics_springLength");
rangeElement = document.getElementById('graph_BH_damp'); rangeElement = document.getElementById('graph_BH_damp');
rangeElement.innerHTML = this.constants.physics.barnesHut.damping;
rangeElement.onchange = showValueOfRange.bind(this,'graph_BH_damp',1,"physics_damping"); rangeElement.onchange = showValueOfRange.bind(this,'graph_BH_damp',1,"physics_damping");
rangeElement = document.getElementById('graph_R_nd'); rangeElement = document.getElementById('graph_R_nd');
rangeElement.innerHTML = this.constants.physics.repulsion.nodeDistance;
rangeElement.onchange = showValueOfRange.bind(this,'graph_R_nd',1,"physics_repulsion_nodeDistance"); rangeElement.onchange = showValueOfRange.bind(this,'graph_R_nd',1,"physics_repulsion_nodeDistance");
rangeElement = document.getElementById('graph_R_cg'); rangeElement = document.getElementById('graph_R_cg');
rangeElement.innerHTML = this.constants.physics.repulsion.centralGravity;
rangeElement.onchange = showValueOfRange.bind(this,'graph_R_cg',1,"physics_centralGravity"); rangeElement.onchange = showValueOfRange.bind(this,'graph_R_cg',1,"physics_centralGravity");
rangeElement = document.getElementById('graph_R_sc'); rangeElement = document.getElementById('graph_R_sc');
rangeElement.innerHTML = this.constants.physics.repulsion.springConstant;
rangeElement.onchange = showValueOfRange.bind(this,'graph_R_sc',1,"physics_springConstant"); rangeElement.onchange = showValueOfRange.bind(this,'graph_R_sc',1,"physics_springConstant");
rangeElement = document.getElementById('graph_R_sl'); rangeElement = document.getElementById('graph_R_sl');
rangeElement.innerHTML = this.constants.physics.repulsion.springLength;
rangeElement.onchange = showValueOfRange.bind(this,'graph_R_sl',1,"physics_springLength"); rangeElement.onchange = showValueOfRange.bind(this,'graph_R_sl',1,"physics_springLength");
rangeElement = document.getElementById('graph_R_damp'); rangeElement = document.getElementById('graph_R_damp');
rangeElement.innerHTML = this.constants.physics.repulsion.damping;
rangeElement.onchange = showValueOfRange.bind(this,'graph_R_damp',1,"physics_damping"); rangeElement.onchange = showValueOfRange.bind(this,'graph_R_damp',1,"physics_damping");
rangeElement = document.getElementById('graph_H_nd'); rangeElement = document.getElementById('graph_H_nd');
rangeElement.innerHTML = this.constants.physics.hierarchicalRepulsion.nodeDistance;
rangeElement.onchange = showValueOfRange.bind(this,'graph_H_nd',1,"physics_hierarchicalRepulsion_nodeDistance"); rangeElement.onchange = showValueOfRange.bind(this,'graph_H_nd',1,"physics_hierarchicalRepulsion_nodeDistance");
rangeElement = document.getElementById('graph_H_cg'); rangeElement = document.getElementById('graph_H_cg');
rangeElement.innerHTML = this.constants.physics.hierarchicalRepulsion.centralGravity;
rangeElement.onchange = showValueOfRange.bind(this,'graph_H_cg',1,"physics_centralGravity"); rangeElement.onchange = showValueOfRange.bind(this,'graph_H_cg',1,"physics_centralGravity");
rangeElement = document.getElementById('graph_H_sc'); rangeElement = document.getElementById('graph_H_sc');
rangeElement.innerHTML = this.constants.physics.hierarchicalRepulsion.springConstant;
rangeElement.onchange = showValueOfRange.bind(this,'graph_H_sc',1,"physics_springConstant"); rangeElement.onchange = showValueOfRange.bind(this,'graph_H_sc',1,"physics_springConstant");
rangeElement = document.getElementById('graph_H_sl'); rangeElement = document.getElementById('graph_H_sl');
rangeElement.innerHTML = this.constants.physics.hierarchicalRepulsion.springLength;
rangeElement.onchange = showValueOfRange.bind(this,'graph_H_sl',1,"physics_springLength"); rangeElement.onchange = showValueOfRange.bind(this,'graph_H_sl',1,"physics_springLength");
rangeElement = document.getElementById('graph_H_damp'); rangeElement = document.getElementById('graph_H_damp');
rangeElement.innerHTML = this.constants.physics.hierarchicalRepulsion.damping;
rangeElement.onchange = showValueOfRange.bind(this,'graph_H_damp',1,"physics_damping"); rangeElement.onchange = showValueOfRange.bind(this,'graph_H_damp',1,"physics_damping");
rangeElement = document.getElementById('graph_H_direction'); rangeElement = document.getElementById('graph_H_direction');
rangeElement.innerHTML = hierarchicalLayoutDirections.indexOf(this.constants.hierarchicalLayout.direction);
rangeElement.onchange = showValueOfRange.bind(this,'graph_H_direction',hierarchicalLayoutDirections,"hierarchicalLayout_direction"); rangeElement.onchange = showValueOfRange.bind(this,'graph_H_direction',hierarchicalLayoutDirections,"hierarchicalLayout_direction");
rangeElement = document.getElementById('graph_H_levsep'); rangeElement = document.getElementById('graph_H_levsep');
rangeElement.innerHTML = this.constants.hierarchicalLayout.levelSeparation;
rangeElement.onchange = showValueOfRange.bind(this,'graph_H_levsep',1,"hierarchicalLayout_levelSeparation"); rangeElement.onchange = showValueOfRange.bind(this,'graph_H_levsep',1,"hierarchicalLayout_levelSeparation");
rangeElement = document.getElementById('graph_H_nspac'); rangeElement = document.getElementById('graph_H_nspac');
rangeElement.innerHTML = this.constants.hierarchicalLayout.nodeSpacing;
rangeElement.onchange = showValueOfRange.bind(this,'graph_H_nspac',1,"hierarchicalLayout_nodeSpacing"); rangeElement.onchange = showValueOfRange.bind(this,'graph_H_nspac',1,"hierarchicalLayout_nodeSpacing");
var radioButton1 = document.getElementById("graph_physicsMethod1"); var radioButton1 = document.getElementById("graph_physicsMethod1");

+ 2
- 2
src/timeline/component/ItemSet.js View File

@ -390,8 +390,8 @@ ItemSet.prototype.getAxis = function getAxis() {
ItemSet.prototype.reflow = function reflow () { ItemSet.prototype.reflow = function reflow () {
var changed = 0, var changed = 0,
options = this.options, options = this.options,
marginAxis = options.margin && options.margin.axis || this.defaultOptions.margin.axis,
marginItem = options.margin && options.margin.item || this.defaultOptions.margin.item,
marginAxis = (options.margin && 'axis' in options.margin) ? options.margin.axis : this.defaultOptions.margin.axis,
marginItem = (options.margin && 'item' in options.margin) ? options.margin.item : this.defaultOptions.margin.item,
update = util.updateProperty, update = util.updateProperty,
asNumber = util.option.asNumber, asNumber = util.option.asNumber,
asSize = util.option.asSize, asSize = util.option.asSize,

+ 2
- 1
src/timeline/component/css/item.css View File

@ -50,7 +50,8 @@
background: none; background: none;
} }
.vis.timeline .dot {
.vis.timeline .dot,
.vis.timeline .item.dot {
padding: 0; padding: 0;
border: 5px solid #97B0F8; border: 5px solid #97B0F8;
position: absolute; position: absolute;

+ 0
- 58
updateversion.js View File

@ -1,58 +0,0 @@
// Update the version numbers and library sizes in index.html
var fs = require('fs'),
zlib = require('zlib');
var VIS_ZIP = './dist/vis.js',
INDEX = 'index.html';
// read version from dist/vis.js
function version(callback) {
fs.readFile(VIS_ZIP, function (err, data) {
if (!err) {
var match = /@version\s*([\w\.-]*)/i.exec(data);
var version = undefined;
if (match) {
version = match[1];
}
callback(null, version);
}
else {
callback(err);
}
});
}
// update version and library sizes in index.md
function updateVersion(version, callback) {
fs.readFile(INDEX, function (err, data) {
if (!err) {
data = String(data);
data = data.replace(/<span class="version">([\w\.-]*)<\/span>/g,
'<span class="version">' + version + '</span>');
fs.writeFile(INDEX, data, callback);
}
else {
callback(err);
}
});
}
version(function (err, version) {
console.log('version: ' + version);
if (version) {
updateVersion(version, function (err, res) {
if (err) {
console.log(err);
}
else {
console.log('done');
}
});
}
else {
}
});

Loading…
Cancel
Save