From 2ca7a61dc73bb87013d4d7754f376271f9279c30 Mon Sep 17 00:00:00 2001
From: Pitchaya Boonsarngsuk <2285135b@student.gla.ac.uk>
Date: Wed, 31 Jan 2018 20:00:31 +0000
Subject: [PATCH] Test readme linking
---
README.md | 13 +++++++++--
.../js/src/neighbourSampling-papaparsing.js | 23 ++++++++++++-------
2 files changed, 26 insertions(+), 10 deletions(-)
diff --git a/README.md b/README.md
index ed6fd3f..d06f9a2 100644
--- a/README.md
+++ b/README.md
@@ -12,9 +12,18 @@ Remigijus Bartasius and Matthew Chalmers
### Reference
- Chalmers, Matthew. ["A linear iteration time layout algorithm for visualising high-dimensional data."](http://dl.acm.org/citation.cfm?id=245035) Proceedings of the 7th conference on Visualization'96. IEEE Computer Society Press, 1996.
-## Installing
+## Usage
-Download the [latest release](https://github.com/sReeper/d3-neighbour-sampling/releases/latest).
+Download the [latest release](releases) and load one of Javascript file alongside [D3 4.0](https://github.com/d3/d3).
+```html
+
+
+
+```
## API Reference
diff --git a/examples/js/src/neighbourSampling-papaparsing.js b/examples/js/src/neighbourSampling-papaparsing.js
index 54c8fc2..bd4edcc 100644
--- a/examples/js/src/neighbourSampling-papaparsing.js
+++ b/examples/js/src/neighbourSampling-papaparsing.js
@@ -118,7 +118,7 @@ function processData(data, error) {
});
opts.selectedIndex = props.length-1;
- props.pop(); //Hide Iris index / last column from distance function
+ //props.pop(); //Hide Iris index / last column from distance function
//Put the nodes in random starting positions
//TODO Change this back
@@ -138,6 +138,8 @@ function processData(data, error) {
simulation
.nodes(nodes)
.stop();
+
+ ticked();
};
function addNodesToDOM(data) {
@@ -152,7 +154,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,6 +173,7 @@ 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()));
@@ -180,13 +183,13 @@ function addNodesToDOM(data) {
node.attr("r", NODE_SIZE).attr("stroke-width", 0);
clickedIndex = -1;
}
- });
+ })*/;
if (selectedData)
unSelectNodes(selectedData);
}
function ticked() {
- console.log("ticked");
+ //console.log("ticked");
alreadyRanIterations++;
// If rendering is selected, then draw at every iteration.
if (rendering === true) {
@@ -236,6 +239,7 @@ function ended() {
}
function brushEnded() {
+ console.log("brushEnded");
var s = d3.event.selection,
results = [];
@@ -269,6 +273,7 @@ function brushEnded() {
* @param {*} node
*/
function formatTooltip(node) {
+ console.log("formatTooltip", node);
var textString = "",
temp = "";
@@ -287,6 +292,7 @@ function formatTooltip(node) {
* Halt the execution.
*/
function stopSimulation() {
+ console.log("stopSimulation");
simulation.stop();
if (typeof hybridSimulation !== 'undefined') {
hybridSimulation.stop();
@@ -299,6 +305,7 @@ 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];
@@ -311,7 +318,7 @@ function getAverage(array) {
* @param {*} data
*/
function unSelectNodes(data) {
-
+ console.log("unSelectNodes", data);
selectedData = data;
if (fileName === data.name && nodes) {
node
@@ -369,7 +376,7 @@ function colorToAttribute() {
/**
* Update the distance range.
- */
+
function updateDistanceRange() {
if (springForce) {
simulation.force(forceName).distanceRange(SELECTED_DISTANCE);
@@ -401,7 +408,7 @@ function pauseUnPause() {
* @param {*} dataNodes
* @param {*} properties
* @param {*} normalization
- */
+
function calculateAverageDistance(dataNodes, properties, normalization) {
var sum = 0,
n = nodes.length;
@@ -418,4 +425,4 @@ function calculateAverageDistance(dataNodes, properties, normalization) {
}
return sum / n;
-}
+}*/