Clean up old codes 2
This commit is contained in:
@@ -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;
|
||||||
@@ -244,7 +244,7 @@ function brushEnded() {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Format the tooltip for the data
|
* Format the tooltip for the data
|
||||||
* @param {*} node
|
* @param {*} node
|
||||||
*/
|
*/
|
||||||
function formatTooltip(node) {
|
function formatTooltip(node) {
|
||||||
var textString = "",
|
var textString = "",
|
||||||
@@ -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();
|
||||||
@@ -541,7 +542,7 @@ function getAverage(array) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Deselect the nodes to match the selection from other window.
|
* Deselect the nodes to match the selection from other window.
|
||||||
* @param {*} data
|
* @param {*} data
|
||||||
*/
|
*/
|
||||||
function unSelectNodes(data) {
|
function unSelectNodes(data) {
|
||||||
|
|
||||||
@@ -561,7 +562,7 @@ function unSelectNodes(data) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Highlight the neighbours for neighbour and sampling algorithm
|
* Highlight the neighbours for neighbour and sampling algorithm
|
||||||
* @param {*} indices
|
* @param {*} indices
|
||||||
*/
|
*/
|
||||||
function highlightNeighbours(indices) {
|
function highlightNeighbours(indices) {
|
||||||
node
|
node
|
||||||
@@ -583,7 +584,7 @@ function highlightNeighbours(indices) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Highlight all the nodes with the same class on hover
|
* Highlight all the nodes with the same class on hover
|
||||||
* @param {*} highlighValue
|
* @param {*} highlighValue
|
||||||
*/
|
*/
|
||||||
function highlightOnHover(highlighValue) {
|
function highlightOnHover(highlighValue) {
|
||||||
node.attr("opacity", function (d) {
|
node.attr("opacity", function (d) {
|
||||||
@@ -632,9 +633,9 @@ function pauseUnPause() {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Average distances for each node.
|
* Average distances for each node.
|
||||||
* @param {*} dataNodes
|
* @param {*} dataNodes
|
||||||
* @param {*} properties
|
* @param {*} properties
|
||||||
* @param {*} normalization
|
* @param {*} normalization
|
||||||
*/
|
*/
|
||||||
function calculateAverageDistance(dataNodes, properties, normalization) {
|
function calculateAverageDistance(dataNodes, properties, normalization) {
|
||||||
var sum = 0,
|
var sum = 0,
|
||||||
@@ -652,4 +653,4 @@ function calculateAverageDistance(dataNodes, properties, normalization) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return sum / n;
|
return sum / n;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user