Test readme linking

This commit is contained in:
Pitchaya Boonsarngsuk
2018-01-31 20:00:31 +00:00
parent f89b3e5e88
commit 2ca7a61dc7
2 changed files with 26 additions and 10 deletions

View File

@@ -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
<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

View File

@@ -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;
}
}*/