Test readme linking
This commit is contained in:
13
README.md
13
README.md
@@ -12,9 +12,18 @@ Remigijus Bartasius and Matthew Chalmers
|
|||||||
### Reference
|
### 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.
|
- 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
|
||||||
|
<script src="https://d3js.org/d3.v4.min.js"></script>
|
||||||
|
<script src="d3-spring-model.min.js"></script>
|
||||||
|
<script>
|
||||||
|
|
||||||
|
var simulation = d3.forceSimulation(nodes);
|
||||||
|
|
||||||
|
</script>
|
||||||
|
```
|
||||||
|
|
||||||
## API Reference
|
## API Reference
|
||||||
|
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ function processData(data, error) {
|
|||||||
});
|
});
|
||||||
opts.selectedIndex = props.length-1;
|
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
|
//Put the nodes in random starting positions
|
||||||
//TODO Change this back
|
//TODO Change this back
|
||||||
@@ -138,6 +138,8 @@ function processData(data, error) {
|
|||||||
simulation
|
simulation
|
||||||
.nodes(nodes)
|
.nodes(nodes)
|
||||||
.stop();
|
.stop();
|
||||||
|
|
||||||
|
ticked();
|
||||||
};
|
};
|
||||||
|
|
||||||
function addNodesToDOM(data) {
|
function addNodesToDOM(data) {
|
||||||
@@ -152,7 +154,7 @@ function addNodesToDOM(data) {
|
|||||||
// it is a CLASS property).
|
// it is a CLASS property).
|
||||||
.attr("fill", function (d) {
|
.attr("fill", function (d) {
|
||||||
return color(d[COLOR_ATTRIBUTE]);
|
return color(d[COLOR_ATTRIBUTE]);
|
||||||
})
|
})/*
|
||||||
.on("mouseover", function (d) {
|
.on("mouseover", function (d) {
|
||||||
div.transition()
|
div.transition()
|
||||||
.duration(200)
|
.duration(200)
|
||||||
@@ -171,6 +173,7 @@ function addNodesToDOM(data) {
|
|||||||
node.attr("opacity", 1);
|
node.attr("opacity", 1);
|
||||||
})
|
})
|
||||||
.on("click", function (d) {
|
.on("click", function (d) {
|
||||||
|
console.log("click", clickedIndex);
|
||||||
if (clickedIndex !== d.index) {
|
if (clickedIndex !== d.index) {
|
||||||
if (springForce) {
|
if (springForce) {
|
||||||
highlightNeighbours(Array.from(simulation.force(forceName).nodeNeighbours(d.index).keys()));
|
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);
|
node.attr("r", NODE_SIZE).attr("stroke-width", 0);
|
||||||
clickedIndex = -1;
|
clickedIndex = -1;
|
||||||
}
|
}
|
||||||
});
|
})*/;
|
||||||
if (selectedData)
|
if (selectedData)
|
||||||
unSelectNodes(selectedData);
|
unSelectNodes(selectedData);
|
||||||
}
|
}
|
||||||
|
|
||||||
function ticked() {
|
function ticked() {
|
||||||
console.log("ticked");
|
//console.log("ticked");
|
||||||
alreadyRanIterations++;
|
alreadyRanIterations++;
|
||||||
// If rendering is selected, then draw at every iteration.
|
// If rendering is selected, then draw at every iteration.
|
||||||
if (rendering === true) {
|
if (rendering === true) {
|
||||||
@@ -236,6 +239,7 @@ function ended() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function brushEnded() {
|
function brushEnded() {
|
||||||
|
console.log("brushEnded");
|
||||||
var s = d3.event.selection,
|
var s = d3.event.selection,
|
||||||
results = [];
|
results = [];
|
||||||
|
|
||||||
@@ -269,6 +273,7 @@ function brushEnded() {
|
|||||||
* @param {*} node
|
* @param {*} node
|
||||||
*/
|
*/
|
||||||
function formatTooltip(node) {
|
function formatTooltip(node) {
|
||||||
|
console.log("formatTooltip", node);
|
||||||
var textString = "",
|
var textString = "",
|
||||||
temp = "";
|
temp = "";
|
||||||
|
|
||||||
@@ -287,6 +292,7 @@ function formatTooltip(node) {
|
|||||||
* Halt the execution.
|
* Halt the execution.
|
||||||
*/
|
*/
|
||||||
function stopSimulation() {
|
function stopSimulation() {
|
||||||
|
console.log("stopSimulation");
|
||||||
simulation.stop();
|
simulation.stop();
|
||||||
if (typeof hybridSimulation !== 'undefined') {
|
if (typeof hybridSimulation !== 'undefined') {
|
||||||
hybridSimulation.stop();
|
hybridSimulation.stop();
|
||||||
@@ -299,6 +305,7 @@ function stopSimulation() {
|
|||||||
* @return {number} the mean of the array.
|
* @return {number} the mean of the array.
|
||||||
*/
|
*/
|
||||||
function getAverage(array) {
|
function getAverage(array) {
|
||||||
|
console.log("getAverage", array);
|
||||||
var total = 0;
|
var total = 0;
|
||||||
for (var i = 0; i < array.length; i++) {
|
for (var i = 0; i < array.length; i++) {
|
||||||
total += array[i];
|
total += array[i];
|
||||||
@@ -311,7 +318,7 @@ function getAverage(array) {
|
|||||||
* @param {*} data
|
* @param {*} data
|
||||||
*/
|
*/
|
||||||
function unSelectNodes(data) {
|
function unSelectNodes(data) {
|
||||||
|
console.log("unSelectNodes", data);
|
||||||
selectedData = data;
|
selectedData = data;
|
||||||
if (fileName === data.name && nodes) {
|
if (fileName === data.name && nodes) {
|
||||||
node
|
node
|
||||||
@@ -369,7 +376,7 @@ function colorToAttribute() {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the distance range.
|
* Update the distance range.
|
||||||
*/
|
|
||||||
function updateDistanceRange() {
|
function updateDistanceRange() {
|
||||||
if (springForce) {
|
if (springForce) {
|
||||||
simulation.force(forceName).distanceRange(SELECTED_DISTANCE);
|
simulation.force(forceName).distanceRange(SELECTED_DISTANCE);
|
||||||
@@ -401,7 +408,7 @@ function pauseUnPause() {
|
|||||||
* @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,
|
||||||
n = nodes.length;
|
n = nodes.length;
|
||||||
@@ -418,4 +425,4 @@ function calculateAverageDistance(dataNodes, properties, normalization) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return sum / n;
|
return sum / n;
|
||||||
}
|
}*/
|
||||||
|
|||||||
Reference in New Issue
Block a user