Clean up old codes 2

This commit is contained in:
Pitchaya Boonsarngsuk
2018-01-03 10:35:34 +07:00
parent 0101245e9e
commit b8015d7e14

View File

@@ -109,9 +109,9 @@ function processData(data, error) {
console.log("n =", nodes.length); console.log("n =", nodes.length);
// Calculate normalization arguments and get the list of // Calculate normalization arguments and get the list of
// properties of the nodes. // properties of the nodes.
norm = calculateNormalization(nodes); norm = calculateNormalization(nodes); // Used with distance fn
props = Object.keys(nodes[0]); props = Object.keys(nodes[0]); // Properties to consider by distance fn
COLOR_ATTRIBUTE = props[0]; COLOR_ATTRIBUTE = props[props.length-1];
var opts = document.getElementById('color_attr').options; var opts = document.getElementById('color_attr').options;
@@ -172,7 +172,7 @@ function processData(data, error) {
function ticked() { function ticked() {
// If rendering is selected, then draw at every iteration. // If rendering is selected, then draw at every iteration.
if (rendering === true) { if (rendering === true) {
node node // Each sub-circle in the SVG, update cx and cy
.attr("cx", function (d) { .attr("cx", function (d) {
return d.x; return d.x;
}) })
@@ -187,7 +187,7 @@ function processData(data, error) {
} }
function ended() { function ended() {
if (rendering !== true) { if (rendering !== true) { // Never drawn anything before? Now it's time.
node node
.attr("cx", function (d) { .attr("cx", function (d) {
return d.x; return d.x;
@@ -485,6 +485,7 @@ function startLinkSimulation() {
springForce = false; springForce = false;
simulation.stop(); simulation.stop();
p1 = performance.now(); p1 = performance.now();
let links = [];
// Initialize link array. // Initialize link array.
nodes = simulation.nodes(); nodes = simulation.nodes();