vis-rails 2.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/vis/rails/version.rb +1 -1
- data/vendor/assets/javascripts/vis.js +26 -26
- metadata +16 -85
- data/vendor/assets/vis/DataSet.js +0 -926
- data/vendor/assets/vis/DataView.js +0 -283
- data/vendor/assets/vis/graph/Edge.js +0 -957
- data/vendor/assets/vis/graph/Graph.js +0 -2291
- data/vendor/assets/vis/graph/Groups.js +0 -80
- data/vendor/assets/vis/graph/Images.js +0 -41
- data/vendor/assets/vis/graph/Node.js +0 -966
- data/vendor/assets/vis/graph/Popup.js +0 -132
- data/vendor/assets/vis/graph/css/graph-manipulation.css +0 -128
- data/vendor/assets/vis/graph/css/graph-navigation.css +0 -66
- data/vendor/assets/vis/graph/dotparser.js +0 -829
- data/vendor/assets/vis/graph/graphMixins/ClusterMixin.js +0 -1143
- data/vendor/assets/vis/graph/graphMixins/HierarchicalLayoutMixin.js +0 -311
- data/vendor/assets/vis/graph/graphMixins/ManipulationMixin.js +0 -576
- data/vendor/assets/vis/graph/graphMixins/MixinLoader.js +0 -199
- data/vendor/assets/vis/graph/graphMixins/NavigationMixin.js +0 -205
- data/vendor/assets/vis/graph/graphMixins/SectorsMixin.js +0 -552
- data/vendor/assets/vis/graph/graphMixins/SelectionMixin.js +0 -648
- data/vendor/assets/vis/graph/graphMixins/physics/BarnesHut.js +0 -398
- data/vendor/assets/vis/graph/graphMixins/physics/HierarchialRepulsion.js +0 -64
- data/vendor/assets/vis/graph/graphMixins/physics/PhysicsMixin.js +0 -697
- data/vendor/assets/vis/graph/graphMixins/physics/Repulsion.js +0 -66
- data/vendor/assets/vis/graph/img/acceptDeleteIcon.png +0 -0
- data/vendor/assets/vis/graph/img/addNodeIcon.png +0 -0
- data/vendor/assets/vis/graph/img/backIcon.png +0 -0
- data/vendor/assets/vis/graph/img/connectIcon.png +0 -0
- data/vendor/assets/vis/graph/img/cross.png +0 -0
- data/vendor/assets/vis/graph/img/cross2.png +0 -0
- data/vendor/assets/vis/graph/img/deleteIcon.png +0 -0
- data/vendor/assets/vis/graph/img/downArrow.png +0 -0
- data/vendor/assets/vis/graph/img/editIcon.png +0 -0
- data/vendor/assets/vis/graph/img/leftArrow.png +0 -0
- data/vendor/assets/vis/graph/img/minus.png +0 -0
- data/vendor/assets/vis/graph/img/plus.png +0 -0
- data/vendor/assets/vis/graph/img/rightArrow.png +0 -0
- data/vendor/assets/vis/graph/img/upArrow.png +0 -0
- data/vendor/assets/vis/graph/img/zoomExtends.png +0 -0
- data/vendor/assets/vis/graph/shapes.js +0 -225
- data/vendor/assets/vis/graph3d/Graph3d.js +0 -3306
- data/vendor/assets/vis/module/exports.js +0 -65
- data/vendor/assets/vis/module/header.js +0 -24
- data/vendor/assets/vis/module/imports.js +0 -31
- data/vendor/assets/vis/shim.js +0 -252
- data/vendor/assets/vis/timeline/Range.js +0 -532
- data/vendor/assets/vis/timeline/TimeStep.js +0 -466
- data/vendor/assets/vis/timeline/Timeline.js +0 -851
- data/vendor/assets/vis/timeline/component/Component.js +0 -52
- data/vendor/assets/vis/timeline/component/CurrentTime.js +0 -128
- data/vendor/assets/vis/timeline/component/CustomTime.js +0 -182
- data/vendor/assets/vis/timeline/component/Group.js +0 -470
- data/vendor/assets/vis/timeline/component/ItemSet.js +0 -1332
- data/vendor/assets/vis/timeline/component/TimeAxis.js +0 -389
- data/vendor/assets/vis/timeline/component/css/animation.css +0 -33
- data/vendor/assets/vis/timeline/component/css/currenttime.css +0 -5
- data/vendor/assets/vis/timeline/component/css/customtime.css +0 -6
- data/vendor/assets/vis/timeline/component/css/item.css +0 -107
- data/vendor/assets/vis/timeline/component/css/itemset.css +0 -33
- data/vendor/assets/vis/timeline/component/css/labelset.css +0 -36
- data/vendor/assets/vis/timeline/component/css/panel.css +0 -71
- data/vendor/assets/vis/timeline/component/css/timeaxis.css +0 -48
- data/vendor/assets/vis/timeline/component/css/timeline.css +0 -2
- data/vendor/assets/vis/timeline/component/item/Item.js +0 -139
- data/vendor/assets/vis/timeline/component/item/ItemBox.js +0 -230
- data/vendor/assets/vis/timeline/component/item/ItemPoint.js +0 -190
- data/vendor/assets/vis/timeline/component/item/ItemRange.js +0 -262
- data/vendor/assets/vis/timeline/component/item/ItemRangeOverflow.js +0 -57
- data/vendor/assets/vis/timeline/img/delete.png +0 -0
- data/vendor/assets/vis/timeline/stack.js +0 -112
- data/vendor/assets/vis/util.js +0 -990
@@ -1,697 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Created by Alex on 2/6/14.
|
3
|
-
*/
|
4
|
-
|
5
|
-
|
6
|
-
var physicsMixin = {
|
7
|
-
|
8
|
-
/**
|
9
|
-
* Toggling barnes Hut calculation on and off.
|
10
|
-
*
|
11
|
-
* @private
|
12
|
-
*/
|
13
|
-
_toggleBarnesHut: function () {
|
14
|
-
this.constants.physics.barnesHut.enabled = !this.constants.physics.barnesHut.enabled;
|
15
|
-
this._loadSelectedForceSolver();
|
16
|
-
this.moving = true;
|
17
|
-
this.start();
|
18
|
-
},
|
19
|
-
|
20
|
-
|
21
|
-
/**
|
22
|
-
* This loads the node force solver based on the barnes hut or repulsion algorithm
|
23
|
-
*
|
24
|
-
* @private
|
25
|
-
*/
|
26
|
-
_loadSelectedForceSolver: function () {
|
27
|
-
// this overloads the this._calculateNodeForces
|
28
|
-
if (this.constants.physics.barnesHut.enabled == true) {
|
29
|
-
this._clearMixin(repulsionMixin);
|
30
|
-
this._clearMixin(hierarchalRepulsionMixin);
|
31
|
-
|
32
|
-
this.constants.physics.centralGravity = this.constants.physics.barnesHut.centralGravity;
|
33
|
-
this.constants.physics.springLength = this.constants.physics.barnesHut.springLength;
|
34
|
-
this.constants.physics.springConstant = this.constants.physics.barnesHut.springConstant;
|
35
|
-
this.constants.physics.damping = this.constants.physics.barnesHut.damping;
|
36
|
-
|
37
|
-
this._loadMixin(barnesHutMixin);
|
38
|
-
}
|
39
|
-
else if (this.constants.physics.hierarchicalRepulsion.enabled == true) {
|
40
|
-
this._clearMixin(barnesHutMixin);
|
41
|
-
this._clearMixin(repulsionMixin);
|
42
|
-
|
43
|
-
this.constants.physics.centralGravity = this.constants.physics.hierarchicalRepulsion.centralGravity;
|
44
|
-
this.constants.physics.springLength = this.constants.physics.hierarchicalRepulsion.springLength;
|
45
|
-
this.constants.physics.springConstant = this.constants.physics.hierarchicalRepulsion.springConstant;
|
46
|
-
this.constants.physics.damping = this.constants.physics.hierarchicalRepulsion.damping;
|
47
|
-
|
48
|
-
this._loadMixin(hierarchalRepulsionMixin);
|
49
|
-
}
|
50
|
-
else {
|
51
|
-
this._clearMixin(barnesHutMixin);
|
52
|
-
this._clearMixin(hierarchalRepulsionMixin);
|
53
|
-
this.barnesHutTree = undefined;
|
54
|
-
|
55
|
-
this.constants.physics.centralGravity = this.constants.physics.repulsion.centralGravity;
|
56
|
-
this.constants.physics.springLength = this.constants.physics.repulsion.springLength;
|
57
|
-
this.constants.physics.springConstant = this.constants.physics.repulsion.springConstant;
|
58
|
-
this.constants.physics.damping = this.constants.physics.repulsion.damping;
|
59
|
-
|
60
|
-
this._loadMixin(repulsionMixin);
|
61
|
-
}
|
62
|
-
},
|
63
|
-
|
64
|
-
/**
|
65
|
-
* Before calculating the forces, we check if we need to cluster to keep up performance and we check
|
66
|
-
* if there is more than one node. If it is just one node, we dont calculate anything.
|
67
|
-
*
|
68
|
-
* @private
|
69
|
-
*/
|
70
|
-
_initializeForceCalculation: function () {
|
71
|
-
// stop calculation if there is only one node
|
72
|
-
if (this.nodeIndices.length == 1) {
|
73
|
-
this.nodes[this.nodeIndices[0]]._setForce(0, 0);
|
74
|
-
}
|
75
|
-
else {
|
76
|
-
// if there are too many nodes on screen, we cluster without repositioning
|
77
|
-
if (this.nodeIndices.length > this.constants.clustering.clusterThreshold && this.constants.clustering.enabled == true) {
|
78
|
-
this.clusterToFit(this.constants.clustering.reduceToNodes, false);
|
79
|
-
}
|
80
|
-
|
81
|
-
// we now start the force calculation
|
82
|
-
this._calculateForces();
|
83
|
-
}
|
84
|
-
},
|
85
|
-
|
86
|
-
|
87
|
-
/**
|
88
|
-
* Calculate the external forces acting on the nodes
|
89
|
-
* Forces are caused by: edges, repulsing forces between nodes, gravity
|
90
|
-
* @private
|
91
|
-
*/
|
92
|
-
_calculateForces: function () {
|
93
|
-
// Gravity is required to keep separated groups from floating off
|
94
|
-
// the forces are reset to zero in this loop by using _setForce instead
|
95
|
-
// of _addForce
|
96
|
-
|
97
|
-
this._calculateGravitationalForces();
|
98
|
-
this._calculateNodeForces();
|
99
|
-
|
100
|
-
if (this.constants.smoothCurves == true) {
|
101
|
-
this._calculateSpringForcesWithSupport();
|
102
|
-
}
|
103
|
-
else {
|
104
|
-
this._calculateSpringForces();
|
105
|
-
}
|
106
|
-
},
|
107
|
-
|
108
|
-
|
109
|
-
/**
|
110
|
-
* Smooth curves are created by adding invisible nodes in the center of the edges. These nodes are also
|
111
|
-
* handled in the calculateForces function. We then use a quadratic curve with the center node as control.
|
112
|
-
* This function joins the datanodes and invisible (called support) nodes into one object.
|
113
|
-
* We do this so we do not contaminate this.nodes with the support nodes.
|
114
|
-
*
|
115
|
-
* @private
|
116
|
-
*/
|
117
|
-
_updateCalculationNodes: function () {
|
118
|
-
if (this.constants.smoothCurves == true) {
|
119
|
-
this.calculationNodes = {};
|
120
|
-
this.calculationNodeIndices = [];
|
121
|
-
|
122
|
-
for (var nodeId in this.nodes) {
|
123
|
-
if (this.nodes.hasOwnProperty(nodeId)) {
|
124
|
-
this.calculationNodes[nodeId] = this.nodes[nodeId];
|
125
|
-
}
|
126
|
-
}
|
127
|
-
var supportNodes = this.sectors['support']['nodes'];
|
128
|
-
for (var supportNodeId in supportNodes) {
|
129
|
-
if (supportNodes.hasOwnProperty(supportNodeId)) {
|
130
|
-
if (this.edges.hasOwnProperty(supportNodes[supportNodeId].parentEdgeId)) {
|
131
|
-
this.calculationNodes[supportNodeId] = supportNodes[supportNodeId];
|
132
|
-
}
|
133
|
-
else {
|
134
|
-
supportNodes[supportNodeId]._setForce(0, 0);
|
135
|
-
}
|
136
|
-
}
|
137
|
-
}
|
138
|
-
|
139
|
-
for (var idx in this.calculationNodes) {
|
140
|
-
if (this.calculationNodes.hasOwnProperty(idx)) {
|
141
|
-
this.calculationNodeIndices.push(idx);
|
142
|
-
}
|
143
|
-
}
|
144
|
-
}
|
145
|
-
else {
|
146
|
-
this.calculationNodes = this.nodes;
|
147
|
-
this.calculationNodeIndices = this.nodeIndices;
|
148
|
-
}
|
149
|
-
},
|
150
|
-
|
151
|
-
|
152
|
-
/**
|
153
|
-
* this function applies the central gravity effect to keep groups from floating off
|
154
|
-
*
|
155
|
-
* @private
|
156
|
-
*/
|
157
|
-
_calculateGravitationalForces: function () {
|
158
|
-
var dx, dy, distance, node, i;
|
159
|
-
var nodes = this.calculationNodes;
|
160
|
-
var gravity = this.constants.physics.centralGravity;
|
161
|
-
var gravityForce = 0;
|
162
|
-
|
163
|
-
for (i = 0; i < this.calculationNodeIndices.length; i++) {
|
164
|
-
node = nodes[this.calculationNodeIndices[i]];
|
165
|
-
node.damping = this.constants.physics.damping; // possibly add function to alter damping properties of clusters.
|
166
|
-
// gravity does not apply when we are in a pocket sector
|
167
|
-
if (this._sector() == "default" && gravity != 0) {
|
168
|
-
dx = -node.x;
|
169
|
-
dy = -node.y;
|
170
|
-
distance = Math.sqrt(dx * dx + dy * dy);
|
171
|
-
|
172
|
-
gravityForce = (distance == 0) ? 0 : (gravity / distance);
|
173
|
-
node.fx = dx * gravityForce;
|
174
|
-
node.fy = dy * gravityForce;
|
175
|
-
}
|
176
|
-
else {
|
177
|
-
node.fx = 0;
|
178
|
-
node.fy = 0;
|
179
|
-
}
|
180
|
-
}
|
181
|
-
},
|
182
|
-
|
183
|
-
|
184
|
-
/**
|
185
|
-
* this function calculates the effects of the springs in the case of unsmooth curves.
|
186
|
-
*
|
187
|
-
* @private
|
188
|
-
*/
|
189
|
-
_calculateSpringForces: function () {
|
190
|
-
var edgeLength, edge, edgeId;
|
191
|
-
var dx, dy, fx, fy, springForce, distance;
|
192
|
-
var edges = this.edges;
|
193
|
-
|
194
|
-
// forces caused by the edges, modelled as springs
|
195
|
-
for (edgeId in edges) {
|
196
|
-
if (edges.hasOwnProperty(edgeId)) {
|
197
|
-
edge = edges[edgeId];
|
198
|
-
if (edge.connected) {
|
199
|
-
// only calculate forces if nodes are in the same sector
|
200
|
-
if (this.nodes.hasOwnProperty(edge.toId) && this.nodes.hasOwnProperty(edge.fromId)) {
|
201
|
-
edgeLength = edge.customLength ? edge.length : this.constants.physics.springLength;
|
202
|
-
// this implies that the edges between big clusters are longer
|
203
|
-
edgeLength += (edge.to.clusterSize + edge.from.clusterSize - 2) * this.constants.clustering.edgeGrowth;
|
204
|
-
|
205
|
-
dx = (edge.from.x - edge.to.x);
|
206
|
-
dy = (edge.from.y - edge.to.y);
|
207
|
-
distance = Math.sqrt(dx * dx + dy * dy);
|
208
|
-
|
209
|
-
if (distance == 0) {
|
210
|
-
distance = 0.01;
|
211
|
-
}
|
212
|
-
|
213
|
-
// the 1/distance is so the fx and fy can be calculated without sine or cosine.
|
214
|
-
springForce = this.constants.physics.springConstant * (edgeLength - distance) / distance;
|
215
|
-
|
216
|
-
fx = dx * springForce;
|
217
|
-
fy = dy * springForce;
|
218
|
-
|
219
|
-
edge.from.fx += fx;
|
220
|
-
edge.from.fy += fy;
|
221
|
-
edge.to.fx -= fx;
|
222
|
-
edge.to.fy -= fy;
|
223
|
-
}
|
224
|
-
}
|
225
|
-
}
|
226
|
-
}
|
227
|
-
},
|
228
|
-
|
229
|
-
|
230
|
-
/**
|
231
|
-
* This function calculates the springforces on the nodes, accounting for the support nodes.
|
232
|
-
*
|
233
|
-
* @private
|
234
|
-
*/
|
235
|
-
_calculateSpringForcesWithSupport: function () {
|
236
|
-
var edgeLength, edge, edgeId, combinedClusterSize;
|
237
|
-
var edges = this.edges;
|
238
|
-
|
239
|
-
// forces caused by the edges, modelled as springs
|
240
|
-
for (edgeId in edges) {
|
241
|
-
if (edges.hasOwnProperty(edgeId)) {
|
242
|
-
edge = edges[edgeId];
|
243
|
-
if (edge.connected) {
|
244
|
-
// only calculate forces if nodes are in the same sector
|
245
|
-
if (this.nodes.hasOwnProperty(edge.toId) && this.nodes.hasOwnProperty(edge.fromId)) {
|
246
|
-
if (edge.via != null) {
|
247
|
-
var node1 = edge.to;
|
248
|
-
var node2 = edge.via;
|
249
|
-
var node3 = edge.from;
|
250
|
-
|
251
|
-
edgeLength = edge.customLength ? edge.length : this.constants.physics.springLength;
|
252
|
-
|
253
|
-
combinedClusterSize = node1.clusterSize + node3.clusterSize - 2;
|
254
|
-
|
255
|
-
// this implies that the edges between big clusters are longer
|
256
|
-
edgeLength += combinedClusterSize * this.constants.clustering.edgeGrowth;
|
257
|
-
this._calculateSpringForce(node1, node2, 0.5 * edgeLength);
|
258
|
-
this._calculateSpringForce(node2, node3, 0.5 * edgeLength);
|
259
|
-
}
|
260
|
-
}
|
261
|
-
}
|
262
|
-
}
|
263
|
-
}
|
264
|
-
},
|
265
|
-
|
266
|
-
|
267
|
-
/**
|
268
|
-
* This is the code actually performing the calculation for the function above. It is split out to avoid repetition.
|
269
|
-
*
|
270
|
-
* @param node1
|
271
|
-
* @param node2
|
272
|
-
* @param edgeLength
|
273
|
-
* @private
|
274
|
-
*/
|
275
|
-
_calculateSpringForce: function (node1, node2, edgeLength) {
|
276
|
-
var dx, dy, fx, fy, springForce, distance;
|
277
|
-
|
278
|
-
dx = (node1.x - node2.x);
|
279
|
-
dy = (node1.y - node2.y);
|
280
|
-
distance = Math.sqrt(dx * dx + dy * dy);
|
281
|
-
|
282
|
-
if (distance == 0) {
|
283
|
-
distance = 0.01;
|
284
|
-
}
|
285
|
-
|
286
|
-
// the 1/distance is so the fx and fy can be calculated without sine or cosine.
|
287
|
-
springForce = this.constants.physics.springConstant * (edgeLength - distance) / distance;
|
288
|
-
|
289
|
-
fx = dx * springForce;
|
290
|
-
fy = dy * springForce;
|
291
|
-
|
292
|
-
node1.fx += fx;
|
293
|
-
node1.fy += fy;
|
294
|
-
node2.fx -= fx;
|
295
|
-
node2.fy -= fy;
|
296
|
-
},
|
297
|
-
|
298
|
-
|
299
|
-
/**
|
300
|
-
* Load the HTML for the physics config and bind it
|
301
|
-
* @private
|
302
|
-
*/
|
303
|
-
_loadPhysicsConfiguration: function () {
|
304
|
-
if (this.physicsConfiguration === undefined) {
|
305
|
-
this.backupConstants = {};
|
306
|
-
util.copyObject(this.constants, this.backupConstants);
|
307
|
-
|
308
|
-
var hierarchicalLayoutDirections = ["LR", "RL", "UD", "DU"];
|
309
|
-
this.physicsConfiguration = document.createElement('div');
|
310
|
-
this.physicsConfiguration.className = "PhysicsConfiguration";
|
311
|
-
this.physicsConfiguration.innerHTML = '' +
|
312
|
-
'<table><tr><td><b>Simulation Mode:</b></td></tr>' +
|
313
|
-
'<tr>' +
|
314
|
-
'<td width="120px"><input type="radio" name="graph_physicsMethod" id="graph_physicsMethod1" value="BH" checked="checked">Barnes Hut</td>' +
|
315
|
-
'<td width="120px"><input type="radio" name="graph_physicsMethod" id="graph_physicsMethod2" value="R">Repulsion</td>' +
|
316
|
-
'<td width="120px"><input type="radio" name="graph_physicsMethod" id="graph_physicsMethod3" value="H">Hierarchical</td>' +
|
317
|
-
'</tr>' +
|
318
|
-
'</table>' +
|
319
|
-
'<table id="graph_BH_table" style="display:none">' +
|
320
|
-
'<tr><td><b>Barnes Hut</b></td></tr>' +
|
321
|
-
'<tr>' +
|
322
|
-
'<td width="150px">gravitationalConstant</td><td>0</td><td><input type="range" min="0" 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>' +
|
323
|
-
'</tr>' +
|
324
|
-
'<tr>' +
|
325
|
-
'<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>' +
|
326
|
-
'</tr>' +
|
327
|
-
'<tr>' +
|
328
|
-
'<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>' +
|
329
|
-
'</tr>' +
|
330
|
-
'<tr>' +
|
331
|
-
'<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>' +
|
332
|
-
'</tr>' +
|
333
|
-
'<tr>' +
|
334
|
-
'<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>' +
|
335
|
-
'</tr>' +
|
336
|
-
'</table>' +
|
337
|
-
'<table id="graph_R_table" style="display:none">' +
|
338
|
-
'<tr><td><b>Repulsion</b></td></tr>' +
|
339
|
-
'<tr>' +
|
340
|
-
'<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>' +
|
341
|
-
'</tr>' +
|
342
|
-
'<tr>' +
|
343
|
-
'<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>' +
|
344
|
-
'</tr>' +
|
345
|
-
'<tr>' +
|
346
|
-
'<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>' +
|
347
|
-
'</tr>' +
|
348
|
-
'<tr>' +
|
349
|
-
'<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>' +
|
350
|
-
'</tr>' +
|
351
|
-
'<tr>' +
|
352
|
-
'<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>' +
|
353
|
-
'</tr>' +
|
354
|
-
'</table>' +
|
355
|
-
'<table id="graph_H_table" style="display:none">' +
|
356
|
-
'<tr><td width="150"><b>Hierarchical</b></td></tr>' +
|
357
|
-
'<tr>' +
|
358
|
-
'<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>' +
|
359
|
-
'</tr>' +
|
360
|
-
'<tr>' +
|
361
|
-
'<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>' +
|
362
|
-
'</tr>' +
|
363
|
-
'<tr>' +
|
364
|
-
'<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>' +
|
365
|
-
'</tr>' +
|
366
|
-
'<tr>' +
|
367
|
-
'<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>' +
|
368
|
-
'</tr>' +
|
369
|
-
'<tr>' +
|
370
|
-
'<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>' +
|
371
|
-
'</tr>' +
|
372
|
-
'<tr>' +
|
373
|
-
'<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>' +
|
374
|
-
'</tr>' +
|
375
|
-
'<tr>' +
|
376
|
-
'<td width="150px">levelSeparation</td><td>1</td><td><input type="range" min="0" max="500" value="' + this.constants.hierarchicalLayout.levelSeparation + '" 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>' +
|
377
|
-
'</tr>' +
|
378
|
-
'<tr>' +
|
379
|
-
'<td width="150px">nodeSpacing</td><td>1</td><td><input type="range" min="0" max="500" value="' + this.constants.hierarchicalLayout.nodeSpacing + '" 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>' +
|
380
|
-
'</tr>' +
|
381
|
-
'</table>' +
|
382
|
-
'<table><tr><td><b>Options:</b></td></tr>' +
|
383
|
-
'<tr>' +
|
384
|
-
'<td width="180px"><input type="button" id="graph_toggleSmooth" value="Toggle smoothCurves" style="width:150px"></td>' +
|
385
|
-
'<td width="180px"><input type="button" id="graph_repositionNodes" value="Reinitialize" style="width:150px"></td>' +
|
386
|
-
'<td width="180px"><input type="button" id="graph_generateOptions" value="Generate Options" style="width:150px"></td>' +
|
387
|
-
'</tr>' +
|
388
|
-
'</table>'
|
389
|
-
this.containerElement.parentElement.insertBefore(this.physicsConfiguration, this.containerElement);
|
390
|
-
this.optionsDiv = document.createElement("div");
|
391
|
-
this.optionsDiv.style.fontSize = "14px";
|
392
|
-
this.optionsDiv.style.fontFamily = "verdana";
|
393
|
-
this.containerElement.parentElement.insertBefore(this.optionsDiv, this.containerElement);
|
394
|
-
|
395
|
-
var rangeElement;
|
396
|
-
rangeElement = document.getElementById('graph_BH_gc');
|
397
|
-
rangeElement.onchange = showValueOfRange.bind(this, 'graph_BH_gc', -1, "physics_barnesHut_gravitationalConstant");
|
398
|
-
rangeElement = document.getElementById('graph_BH_cg');
|
399
|
-
rangeElement.onchange = showValueOfRange.bind(this, 'graph_BH_cg', 1, "physics_centralGravity");
|
400
|
-
rangeElement = document.getElementById('graph_BH_sc');
|
401
|
-
rangeElement.onchange = showValueOfRange.bind(this, 'graph_BH_sc', 1, "physics_springConstant");
|
402
|
-
rangeElement = document.getElementById('graph_BH_sl');
|
403
|
-
rangeElement.onchange = showValueOfRange.bind(this, 'graph_BH_sl', 1, "physics_springLength");
|
404
|
-
rangeElement = document.getElementById('graph_BH_damp');
|
405
|
-
rangeElement.onchange = showValueOfRange.bind(this, 'graph_BH_damp', 1, "physics_damping");
|
406
|
-
|
407
|
-
rangeElement = document.getElementById('graph_R_nd');
|
408
|
-
rangeElement.onchange = showValueOfRange.bind(this, 'graph_R_nd', 1, "physics_repulsion_nodeDistance");
|
409
|
-
rangeElement = document.getElementById('graph_R_cg');
|
410
|
-
rangeElement.onchange = showValueOfRange.bind(this, 'graph_R_cg', 1, "physics_centralGravity");
|
411
|
-
rangeElement = document.getElementById('graph_R_sc');
|
412
|
-
rangeElement.onchange = showValueOfRange.bind(this, 'graph_R_sc', 1, "physics_springConstant");
|
413
|
-
rangeElement = document.getElementById('graph_R_sl');
|
414
|
-
rangeElement.onchange = showValueOfRange.bind(this, 'graph_R_sl', 1, "physics_springLength");
|
415
|
-
rangeElement = document.getElementById('graph_R_damp');
|
416
|
-
rangeElement.onchange = showValueOfRange.bind(this, 'graph_R_damp', 1, "physics_damping");
|
417
|
-
|
418
|
-
rangeElement = document.getElementById('graph_H_nd');
|
419
|
-
rangeElement.onchange = showValueOfRange.bind(this, 'graph_H_nd', 1, "physics_hierarchicalRepulsion_nodeDistance");
|
420
|
-
rangeElement = document.getElementById('graph_H_cg');
|
421
|
-
rangeElement.onchange = showValueOfRange.bind(this, 'graph_H_cg', 1, "physics_centralGravity");
|
422
|
-
rangeElement = document.getElementById('graph_H_sc');
|
423
|
-
rangeElement.onchange = showValueOfRange.bind(this, 'graph_H_sc', 1, "physics_springConstant");
|
424
|
-
rangeElement = document.getElementById('graph_H_sl');
|
425
|
-
rangeElement.onchange = showValueOfRange.bind(this, 'graph_H_sl', 1, "physics_springLength");
|
426
|
-
rangeElement = document.getElementById('graph_H_damp');
|
427
|
-
rangeElement.onchange = showValueOfRange.bind(this, 'graph_H_damp', 1, "physics_damping");
|
428
|
-
rangeElement = document.getElementById('graph_H_direction');
|
429
|
-
rangeElement.onchange = showValueOfRange.bind(this, 'graph_H_direction', hierarchicalLayoutDirections, "hierarchicalLayout_direction");
|
430
|
-
rangeElement = document.getElementById('graph_H_levsep');
|
431
|
-
rangeElement.onchange = showValueOfRange.bind(this, 'graph_H_levsep', 1, "hierarchicalLayout_levelSeparation");
|
432
|
-
rangeElement = document.getElementById('graph_H_nspac');
|
433
|
-
rangeElement.onchange = showValueOfRange.bind(this, 'graph_H_nspac', 1, "hierarchicalLayout_nodeSpacing");
|
434
|
-
|
435
|
-
var radioButton1 = document.getElementById("graph_physicsMethod1");
|
436
|
-
var radioButton2 = document.getElementById("graph_physicsMethod2");
|
437
|
-
var radioButton3 = document.getElementById("graph_physicsMethod3");
|
438
|
-
radioButton2.checked = true;
|
439
|
-
if (this.constants.physics.barnesHut.enabled) {
|
440
|
-
radioButton1.checked = true;
|
441
|
-
}
|
442
|
-
if (this.constants.hierarchicalLayout.enabled) {
|
443
|
-
radioButton3.checked = true;
|
444
|
-
}
|
445
|
-
|
446
|
-
var graph_toggleSmooth = document.getElementById("graph_toggleSmooth");
|
447
|
-
var graph_repositionNodes = document.getElementById("graph_repositionNodes");
|
448
|
-
var graph_generateOptions = document.getElementById("graph_generateOptions");
|
449
|
-
|
450
|
-
graph_toggleSmooth.onclick = graphToggleSmoothCurves.bind(this);
|
451
|
-
graph_repositionNodes.onclick = graphRepositionNodes.bind(this);
|
452
|
-
graph_generateOptions.onclick = graphGenerateOptions.bind(this);
|
453
|
-
if (this.constants.smoothCurves == true) {
|
454
|
-
graph_toggleSmooth.style.background = "#A4FF56";
|
455
|
-
}
|
456
|
-
else {
|
457
|
-
graph_toggleSmooth.style.background = "#FF8532";
|
458
|
-
}
|
459
|
-
|
460
|
-
|
461
|
-
switchConfigurations.apply(this);
|
462
|
-
|
463
|
-
radioButton1.onchange = switchConfigurations.bind(this);
|
464
|
-
radioButton2.onchange = switchConfigurations.bind(this);
|
465
|
-
radioButton3.onchange = switchConfigurations.bind(this);
|
466
|
-
}
|
467
|
-
},
|
468
|
-
|
469
|
-
/**
|
470
|
-
* This overwrites the this.constants.
|
471
|
-
*
|
472
|
-
* @param constantsVariableName
|
473
|
-
* @param value
|
474
|
-
* @private
|
475
|
-
*/
|
476
|
-
_overWriteGraphConstants: function (constantsVariableName, value) {
|
477
|
-
var nameArray = constantsVariableName.split("_");
|
478
|
-
if (nameArray.length == 1) {
|
479
|
-
this.constants[nameArray[0]] = value;
|
480
|
-
}
|
481
|
-
else if (nameArray.length == 2) {
|
482
|
-
this.constants[nameArray[0]][nameArray[1]] = value;
|
483
|
-
}
|
484
|
-
else if (nameArray.length == 3) {
|
485
|
-
this.constants[nameArray[0]][nameArray[1]][nameArray[2]] = value;
|
486
|
-
}
|
487
|
-
}
|
488
|
-
};
|
489
|
-
|
490
|
-
/**
|
491
|
-
* this function is bound to the toggle smooth curves button. That is also why it is not in the prototype.
|
492
|
-
*/
|
493
|
-
function graphToggleSmoothCurves () {
|
494
|
-
this.constants.smoothCurves = !this.constants.smoothCurves;
|
495
|
-
var graph_toggleSmooth = document.getElementById("graph_toggleSmooth");
|
496
|
-
if (this.constants.smoothCurves == true) {graph_toggleSmooth.style.background = "#A4FF56";}
|
497
|
-
else {graph_toggleSmooth.style.background = "#FF8532";}
|
498
|
-
|
499
|
-
this._configureSmoothCurves(false);
|
500
|
-
};
|
501
|
-
|
502
|
-
/**
|
503
|
-
* this function is used to scramble the nodes
|
504
|
-
*
|
505
|
-
*/
|
506
|
-
function graphRepositionNodes () {
|
507
|
-
for (var nodeId in this.calculationNodes) {
|
508
|
-
if (this.calculationNodes.hasOwnProperty(nodeId)) {
|
509
|
-
this.calculationNodes[nodeId].vx = 0; this.calculationNodes[nodeId].vy = 0;
|
510
|
-
this.calculationNodes[nodeId].fx = 0; this.calculationNodes[nodeId].fy = 0;
|
511
|
-
}
|
512
|
-
}
|
513
|
-
if (this.constants.hierarchicalLayout.enabled == true) {
|
514
|
-
this._setupHierarchicalLayout();
|
515
|
-
}
|
516
|
-
else {
|
517
|
-
this.repositionNodes();
|
518
|
-
}
|
519
|
-
this.moving = true;
|
520
|
-
this.start();
|
521
|
-
};
|
522
|
-
|
523
|
-
/**
|
524
|
-
* this is used to generate an options file from the playing with physics system.
|
525
|
-
*/
|
526
|
-
function graphGenerateOptions () {
|
527
|
-
var options = "No options are required, default values used.";
|
528
|
-
var optionsSpecific = [];
|
529
|
-
var radioButton1 = document.getElementById("graph_physicsMethod1");
|
530
|
-
var radioButton2 = document.getElementById("graph_physicsMethod2");
|
531
|
-
if (radioButton1.checked == true) {
|
532
|
-
if (this.constants.physics.barnesHut.gravitationalConstant != this.backupConstants.physics.barnesHut.gravitationalConstant) {optionsSpecific.push("gravitationalConstant: " + this.constants.physics.barnesHut.gravitationalConstant);}
|
533
|
-
if (this.constants.physics.centralGravity != this.backupConstants.physics.barnesHut.centralGravity) {optionsSpecific.push("centralGravity: " + this.constants.physics.centralGravity);}
|
534
|
-
if (this.constants.physics.springLength != this.backupConstants.physics.barnesHut.springLength) {optionsSpecific.push("springLength: " + this.constants.physics.springLength);}
|
535
|
-
if (this.constants.physics.springConstant != this.backupConstants.physics.barnesHut.springConstant) {optionsSpecific.push("springConstant: " + this.constants.physics.springConstant);}
|
536
|
-
if (this.constants.physics.damping != this.backupConstants.physics.barnesHut.damping) {optionsSpecific.push("damping: " + this.constants.physics.damping);}
|
537
|
-
if (optionsSpecific.length != 0) {
|
538
|
-
options = "var options = {";
|
539
|
-
options += "physics: {barnesHut: {";
|
540
|
-
for (var i = 0; i < optionsSpecific.length; i++) {
|
541
|
-
options += optionsSpecific[i];
|
542
|
-
if (i < optionsSpecific.length - 1) {
|
543
|
-
options += ", "
|
544
|
-
}
|
545
|
-
}
|
546
|
-
options += '}}'
|
547
|
-
}
|
548
|
-
if (this.constants.smoothCurves != this.backupConstants.smoothCurves) {
|
549
|
-
if (optionsSpecific.length == 0) {options = "var options = {";}
|
550
|
-
else {options += ", "}
|
551
|
-
options += "smoothCurves: " + this.constants.smoothCurves;
|
552
|
-
}
|
553
|
-
if (options != "No options are required, default values used.") {
|
554
|
-
options += '};'
|
555
|
-
}
|
556
|
-
}
|
557
|
-
else if (radioButton2.checked == true) {
|
558
|
-
options = "var options = {";
|
559
|
-
options += "physics: {barnesHut: {enabled: false}";
|
560
|
-
if (this.constants.physics.repulsion.nodeDistance != this.backupConstants.physics.repulsion.nodeDistance) {optionsSpecific.push("nodeDistance: " + this.constants.physics.repulsion.nodeDistance);}
|
561
|
-
if (this.constants.physics.centralGravity != this.backupConstants.physics.repulsion.centralGravity) {optionsSpecific.push("centralGravity: " + this.constants.physics.centralGravity);}
|
562
|
-
if (this.constants.physics.springLength != this.backupConstants.physics.repulsion.springLength) {optionsSpecific.push("springLength: " + this.constants.physics.springLength);}
|
563
|
-
if (this.constants.physics.springConstant != this.backupConstants.physics.repulsion.springConstant) {optionsSpecific.push("springConstant: " + this.constants.physics.springConstant);}
|
564
|
-
if (this.constants.physics.damping != this.backupConstants.physics.repulsion.damping) {optionsSpecific.push("damping: " + this.constants.physics.damping);}
|
565
|
-
if (optionsSpecific.length != 0) {
|
566
|
-
options += ", repulsion: {";
|
567
|
-
for (var i = 0; i < optionsSpecific.length; i++) {
|
568
|
-
options += optionsSpecific[i];
|
569
|
-
if (i < optionsSpecific.length - 1) {
|
570
|
-
options += ", "
|
571
|
-
}
|
572
|
-
}
|
573
|
-
options += '}}'
|
574
|
-
}
|
575
|
-
if (optionsSpecific.length == 0) {options += "}"}
|
576
|
-
if (this.constants.smoothCurves != this.backupConstants.smoothCurves) {
|
577
|
-
options += ", smoothCurves: " + this.constants.smoothCurves;
|
578
|
-
}
|
579
|
-
options += '};'
|
580
|
-
}
|
581
|
-
else {
|
582
|
-
options = "var options = {";
|
583
|
-
if (this.constants.physics.hierarchicalRepulsion.nodeDistance != this.backupConstants.physics.hierarchicalRepulsion.nodeDistance) {optionsSpecific.push("nodeDistance: " + this.constants.physics.hierarchicalRepulsion.nodeDistance);}
|
584
|
-
if (this.constants.physics.centralGravity != this.backupConstants.physics.hierarchicalRepulsion.centralGravity) {optionsSpecific.push("centralGravity: " + this.constants.physics.centralGravity);}
|
585
|
-
if (this.constants.physics.springLength != this.backupConstants.physics.hierarchicalRepulsion.springLength) {optionsSpecific.push("springLength: " + this.constants.physics.springLength);}
|
586
|
-
if (this.constants.physics.springConstant != this.backupConstants.physics.hierarchicalRepulsion.springConstant) {optionsSpecific.push("springConstant: " + this.constants.physics.springConstant);}
|
587
|
-
if (this.constants.physics.damping != this.backupConstants.physics.hierarchicalRepulsion.damping) {optionsSpecific.push("damping: " + this.constants.physics.damping);}
|
588
|
-
if (optionsSpecific.length != 0) {
|
589
|
-
options += "physics: {hierarchicalRepulsion: {";
|
590
|
-
for (var i = 0; i < optionsSpecific.length; i++) {
|
591
|
-
options += optionsSpecific[i];
|
592
|
-
if (i < optionsSpecific.length - 1) {
|
593
|
-
options += ", ";
|
594
|
-
}
|
595
|
-
}
|
596
|
-
options += '}},';
|
597
|
-
}
|
598
|
-
options += 'hierarchicalLayout: {';
|
599
|
-
optionsSpecific = [];
|
600
|
-
if (this.constants.hierarchicalLayout.direction != this.backupConstants.hierarchicalLayout.direction) {optionsSpecific.push("direction: " + this.constants.hierarchicalLayout.direction);}
|
601
|
-
if (Math.abs(this.constants.hierarchicalLayout.levelSeparation) != this.backupConstants.hierarchicalLayout.levelSeparation) {optionsSpecific.push("levelSeparation: " + this.constants.hierarchicalLayout.levelSeparation);}
|
602
|
-
if (this.constants.hierarchicalLayout.nodeSpacing != this.backupConstants.hierarchicalLayout.nodeSpacing) {optionsSpecific.push("nodeSpacing: " + this.constants.hierarchicalLayout.nodeSpacing);}
|
603
|
-
if (optionsSpecific.length != 0) {
|
604
|
-
for (var i = 0; i < optionsSpecific.length; i++) {
|
605
|
-
options += optionsSpecific[i];
|
606
|
-
if (i < optionsSpecific.length - 1) {
|
607
|
-
options += ", "
|
608
|
-
}
|
609
|
-
}
|
610
|
-
options += '}'
|
611
|
-
}
|
612
|
-
else {
|
613
|
-
options += "enabled:true}";
|
614
|
-
}
|
615
|
-
options += '};'
|
616
|
-
}
|
617
|
-
|
618
|
-
|
619
|
-
this.optionsDiv.innerHTML = options;
|
620
|
-
|
621
|
-
};
|
622
|
-
|
623
|
-
/**
|
624
|
-
* this is used to switch between barnesHut, repulsion and hierarchical.
|
625
|
-
*
|
626
|
-
*/
|
627
|
-
function switchConfigurations () {
|
628
|
-
var ids = ["graph_BH_table", "graph_R_table", "graph_H_table"];
|
629
|
-
var radioButton = document.querySelector('input[name="graph_physicsMethod"]:checked').value;
|
630
|
-
var tableId = "graph_" + radioButton + "_table";
|
631
|
-
var table = document.getElementById(tableId);
|
632
|
-
table.style.display = "block";
|
633
|
-
for (var i = 0; i < ids.length; i++) {
|
634
|
-
if (ids[i] != tableId) {
|
635
|
-
table = document.getElementById(ids[i]);
|
636
|
-
table.style.display = "none";
|
637
|
-
}
|
638
|
-
}
|
639
|
-
this._restoreNodes();
|
640
|
-
if (radioButton == "R") {
|
641
|
-
this.constants.hierarchicalLayout.enabled = false;
|
642
|
-
this.constants.physics.hierarchicalRepulsion.enabled = false;
|
643
|
-
this.constants.physics.barnesHut.enabled = false;
|
644
|
-
}
|
645
|
-
else if (radioButton == "H") {
|
646
|
-
if (this.constants.hierarchicalLayout.enabled == false) {
|
647
|
-
this.constants.hierarchicalLayout.enabled = true;
|
648
|
-
this.constants.physics.hierarchicalRepulsion.enabled = true;
|
649
|
-
this.constants.physics.barnesHut.enabled = false;
|
650
|
-
this._setupHierarchicalLayout();
|
651
|
-
}
|
652
|
-
}
|
653
|
-
else {
|
654
|
-
this.constants.hierarchicalLayout.enabled = false;
|
655
|
-
this.constants.physics.hierarchicalRepulsion.enabled = false;
|
656
|
-
this.constants.physics.barnesHut.enabled = true;
|
657
|
-
}
|
658
|
-
this._loadSelectedForceSolver();
|
659
|
-
var graph_toggleSmooth = document.getElementById("graph_toggleSmooth");
|
660
|
-
if (this.constants.smoothCurves == true) {graph_toggleSmooth.style.background = "#A4FF56";}
|
661
|
-
else {graph_toggleSmooth.style.background = "#FF8532";}
|
662
|
-
this.moving = true;
|
663
|
-
this.start();
|
664
|
-
|
665
|
-
}
|
666
|
-
|
667
|
-
|
668
|
-
/**
|
669
|
-
* this generates the ranges depending on the iniital values.
|
670
|
-
*
|
671
|
-
* @param id
|
672
|
-
* @param map
|
673
|
-
* @param constantsVariableName
|
674
|
-
*/
|
675
|
-
function showValueOfRange (id,map,constantsVariableName) {
|
676
|
-
var valueId = id + "_value";
|
677
|
-
var rangeValue = document.getElementById(id).value;
|
678
|
-
|
679
|
-
if (map instanceof Array) {
|
680
|
-
document.getElementById(valueId).value = map[parseInt(rangeValue)];
|
681
|
-
this._overWriteGraphConstants(constantsVariableName,map[parseInt(rangeValue)]);
|
682
|
-
}
|
683
|
-
else {
|
684
|
-
document.getElementById(valueId).value = parseInt(map) * parseFloat(rangeValue);
|
685
|
-
this._overWriteGraphConstants(constantsVariableName, parseInt(map) * parseFloat(rangeValue));
|
686
|
-
}
|
687
|
-
|
688
|
-
if (constantsVariableName == "hierarchicalLayout_direction" ||
|
689
|
-
constantsVariableName == "hierarchicalLayout_levelSeparation" ||
|
690
|
-
constantsVariableName == "hierarchicalLayout_nodeSpacing") {
|
691
|
-
this._setupHierarchicalLayout();
|
692
|
-
}
|
693
|
-
this.moving = true;
|
694
|
-
this.start();
|
695
|
-
};
|
696
|
-
|
697
|
-
|