Edit comments

This commit is contained in:
Pitchaya Boonsarngsuk
2018-03-13 01:17:50 +00:00
parent 6df7e225ba
commit 7a267d0de2

View File

@@ -65,7 +65,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);
@@ -82,7 +81,6 @@ function parseFile(evt) {
springForce = false;
fileName = evt.target.files[0].name;
Papa.parse(evt.target.files[0], {
header: true,
dynamicTyping: true,
@@ -105,10 +103,11 @@ function processData(data, error) {
size = nodes.length;
simulation = d3.forceSimulation();
// Calculate normalization arguments and get the list of
// properties of the nodes.
norm = calculateNormalization(nodes); // Used with distance fn
// Calculate normalization parameters for distance fns
norm = calculateNormalization(nodes);
props = Object.keys(nodes[0]); // Properties to consider by distance fn
props.pop(); //Hide Iris index / last column from the distance function
COLOR_ATTRIBUTE = props[props.length-1];
var opts = document.getElementById('color_attr').options;
@@ -118,19 +117,11 @@ function processData(data, error) {
});
opts.selectedIndex = props.length-1;
//props.pop(); //Hide Iris index / last column from distance function
//Put the nodes in random starting positions
//TODO Change this back
//Put the nodes at (0,0)
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);
@@ -189,7 +180,6 @@ function addNodesToDOM(data) {
}
function ticked() {
//console.log("ticked");
alreadyRanIterations++;
// If rendering is selected, then draw at every iteration.
if (rendering === true) {
@@ -201,7 +191,7 @@ function ticked() {
return d.y*MULTIPLIER;
});
}
// Emit the distribution data to allow the drawing of the bar graph
// Legacy: Emit the distribution data to allow the drawing of the bar graph
if (springForce) {
intercom.emit("passedData", simulation.force(forceName).distributionData());
}
@@ -213,7 +203,6 @@ function ticked() {
function ended() {
simulation.stop();
simulation.force(forceName, null);
console.log("ended");
if (rendering !== true) { // Never drawn anything before? Now it's time.
node
.attr("cx", function (d) {
@@ -228,11 +217,6 @@ function ended() {
// Performance time measurement
p2 = performance.now();
console.log("Execution time: " + (p2 - p1));
// Do not calculate stress for data sets bigger than 100 000.
// if (nodes.length <= 100000) {
// console.log("Stress: ", simulation.force(forceName).stress());
// }
// console.log(simulation.force(forceName).nodeNeighbours());
p1 = 0;
p2 = 0;
}
@@ -290,7 +274,6 @@ function formatTooltip(node) {
* Halt the execution.
*/
function stopSimulation() {
console.log("stopSimulation");
simulation.stop();
if (typeof hybridSimulation !== 'undefined') {
hybridSimulation.stop();