Pivot near neighbour finding working (reverted from commit 688ce750c7)
This commit is contained in:
@@ -63,13 +63,6 @@ var MULTIPLIER = 50,
|
||||
// Create a color scheme for a range of numbers.
|
||||
var color = d3.scaleOrdinal(d3.schemeCategory10);
|
||||
|
||||
|
||||
$(document).ready(function() {
|
||||
distanceFunction = calculateDistance;
|
||||
d3.select('#startSimulation').on('click', startHybridSimulation);
|
||||
$("#HLParameters").show();
|
||||
});
|
||||
|
||||
/**
|
||||
* Parse the data from the provided csv file using Papa Parse library
|
||||
* @param {file} evt - csv file.
|
||||
@@ -119,16 +112,10 @@ function processData(data, error) {
|
||||
props.pop(); //Hide Iris index / last column from distance function
|
||||
|
||||
//Put the nodes in random starting positions
|
||||
//TODO Change this back
|
||||
nodes.forEach(function (d) {
|
||||
d.x = 0;
|
||||
d.y = 0;
|
||||
});
|
||||
/*
|
||||
nodes.forEach(function (d) {
|
||||
d.x = (Math.random()-0.5) * 100000;
|
||||
d.y = (Math.random()-0.5) * 100000;
|
||||
});*/
|
||||
});
|
||||
|
||||
addNodesToDOM(nodes);
|
||||
|
||||
@@ -152,7 +139,7 @@ function addNodesToDOM(data) {
|
||||
// it is a CLASS property).
|
||||
.attr("fill", function (d) {
|
||||
return color(d[COLOR_ATTRIBUTE]);
|
||||
})/*
|
||||
})
|
||||
.on("mouseover", function (d) {
|
||||
div.transition()
|
||||
.duration(200)
|
||||
@@ -171,7 +158,6 @@ function addNodesToDOM(data) {
|
||||
node.attr("opacity", 1);
|
||||
})
|
||||
.on("click", function (d) {
|
||||
console.log("click", clickedIndex);
|
||||
if (clickedIndex !== d.index) {
|
||||
if (springForce) {
|
||||
highlightNeighbours(Array.from(simulation.force(forceName).nodeNeighbours(d.index).keys()));
|
||||
@@ -181,13 +167,12 @@ function addNodesToDOM(data) {
|
||||
node.attr("r", NODE_SIZE).attr("stroke-width", 0);
|
||||
clickedIndex = -1;
|
||||
}
|
||||
})*/;
|
||||
});
|
||||
if (selectedData)
|
||||
unSelectNodes(selectedData);
|
||||
}
|
||||
|
||||
function ticked() {
|
||||
console.log("ticked");
|
||||
// If rendering is selected, then draw at every iteration.
|
||||
if (rendering === true) {
|
||||
node // Each sub-circle in the SVG, update cx and cy
|
||||
@@ -205,7 +190,6 @@ function ticked() {
|
||||
}
|
||||
|
||||
function ended() {
|
||||
console.log("ended");
|
||||
if (rendering !== true) { // Never drawn anything before? Now it's time.
|
||||
node
|
||||
.attr("cx", function (d) {
|
||||
@@ -231,7 +215,6 @@ function ended() {
|
||||
}
|
||||
|
||||
function brushEnded() {
|
||||
console.log("brushEnded");
|
||||
var s = d3.event.selection,
|
||||
results = [];
|
||||
|
||||
@@ -265,7 +248,6 @@ function brushEnded() {
|
||||
* @param {*} node
|
||||
*/
|
||||
function formatTooltip(node) {
|
||||
console.log("formatTooltip", node);
|
||||
var textString = "",
|
||||
temp = "";
|
||||
|
||||
@@ -284,7 +266,6 @@ function formatTooltip(node) {
|
||||
* Halt the execution.
|
||||
*/
|
||||
function stopSimulation() {
|
||||
console.log("stopSimulation");
|
||||
simulation.stop();
|
||||
if (typeof hybridSimulation !== 'undefined') {
|
||||
hybridSimulation.stop();
|
||||
@@ -297,7 +278,6 @@ function stopSimulation() {
|
||||
* @return {number} the mean of the array.
|
||||
*/
|
||||
function getAverage(array) {
|
||||
console.log("getAverage", array);
|
||||
var total = 0;
|
||||
for (var i = 0; i < array.length; i++) {
|
||||
total += array[i];
|
||||
@@ -310,7 +290,7 @@ function getAverage(array) {
|
||||
* @param {*} data
|
||||
*/
|
||||
function unSelectNodes(data) {
|
||||
console.log("unSelectNodes", data);
|
||||
|
||||
selectedData = data;
|
||||
if (fileName === data.name && nodes) {
|
||||
node
|
||||
@@ -368,7 +348,7 @@ function colorToAttribute() {
|
||||
|
||||
/**
|
||||
* Update the distance range.
|
||||
|
||||
*/
|
||||
function updateDistanceRange() {
|
||||
if (springForce) {
|
||||
simulation.force(forceName).distanceRange(SELECTED_DISTANCE);
|
||||
@@ -400,7 +380,7 @@ function pauseUnPause() {
|
||||
* @param {*} dataNodes
|
||||
* @param {*} properties
|
||||
* @param {*} normalization
|
||||
|
||||
*/
|
||||
function calculateAverageDistance(dataNodes, properties, normalization) {
|
||||
var sum = 0,
|
||||
n = nodes.length;
|
||||
@@ -417,4 +397,4 @@ function calculateAverageDistance(dataNodes, properties, normalization) {
|
||||
}
|
||||
|
||||
return sum / n;
|
||||
}*/
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user