diff --git a/examples/js/src/neighbourSampling-papaparsing.js b/examples/js/src/neighbourSampling-papaparsing.js index 1c9f878..fff9d7b 100644 --- a/examples/js/src/neighbourSampling-papaparsing.js +++ b/examples/js/src/neighbourSampling-papaparsing.js @@ -109,9 +109,9 @@ function processData(data, error) { console.log("n =", nodes.length); // Calculate normalization arguments and get the list of // properties of the nodes. - norm = calculateNormalization(nodes); - props = Object.keys(nodes[0]); - COLOR_ATTRIBUTE = props[0]; + norm = calculateNormalization(nodes); // Used with distance fn + props = Object.keys(nodes[0]); // Properties to consider by distance fn + COLOR_ATTRIBUTE = props[props.length-1]; var opts = document.getElementById('color_attr').options; @@ -172,7 +172,7 @@ function processData(data, error) { function ticked() { // If rendering is selected, then draw at every iteration. if (rendering === true) { - node + node // Each sub-circle in the SVG, update cx and cy .attr("cx", function (d) { return d.x; }) @@ -187,7 +187,7 @@ function processData(data, error) { } function ended() { - if (rendering !== true) { + if (rendering !== true) { // Never drawn anything before? Now it's time. node .attr("cx", function (d) { return d.x; @@ -244,7 +244,7 @@ function brushEnded() { /** * Format the tooltip for the data - * @param {*} node + * @param {*} node */ function formatTooltip(node) { var textString = "", @@ -485,6 +485,7 @@ function startLinkSimulation() { springForce = false; simulation.stop(); p1 = performance.now(); + let links = []; // Initialize link array. nodes = simulation.nodes(); @@ -541,7 +542,7 @@ function getAverage(array) { /** * Deselect the nodes to match the selection from other window. - * @param {*} data + * @param {*} data */ function unSelectNodes(data) { @@ -561,7 +562,7 @@ function unSelectNodes(data) { /** * Highlight the neighbours for neighbour and sampling algorithm - * @param {*} indices + * @param {*} indices */ function highlightNeighbours(indices) { node @@ -583,7 +584,7 @@ function highlightNeighbours(indices) { /** * Highlight all the nodes with the same class on hover - * @param {*} highlighValue + * @param {*} highlighValue */ function highlightOnHover(highlighValue) { node.attr("opacity", function (d) { @@ -632,9 +633,9 @@ function pauseUnPause() { /** * Average distances for each node. - * @param {*} dataNodes - * @param {*} properties - * @param {*} normalization + * @param {*} dataNodes + * @param {*} properties + * @param {*} normalization */ function calculateAverageDistance(dataNodes, properties, normalization) { var sum = 0, @@ -652,4 +653,4 @@ function calculateAverageDistance(dataNodes, properties, normalization) { } return sum / n; -} \ No newline at end of file +}