summaryrefslogtreecommitdiff
path: root/index.html
diff options
context:
space:
mode:
authorschneefux <schneefux+commit@schneefux.xyz>2016-03-31 18:00:21 +0200
committerschneefux <schneefux+commit@schneefux.xyz>2016-03-31 18:00:21 +0200
commit4668e546b33a9cb2ff044af55ba9c1c2c067d6da (patch)
tree12fd75ed69c3a9458f7142c11748865d79ff5efe /index.html
parent255ada131242646baab86b00b85cbf0f12396c71 (diff)
downloadvortrag-knn-4668e546b33a9cb2ff044af55ba9c1c2c067d6da.tar.gz
vortrag-knn-4668e546b33a9cb2ff044af55ba9c1c2c067d6da.zip
click-highlight nodes
Diffstat (limited to 'index.html')
-rw-r--r--index.html32
1 files changed, 31 insertions, 1 deletions
diff --git a/index.html b/index.html
index 823982e..456ad87 100644
--- a/index.html
+++ b/index.html
@@ -24,8 +24,38 @@
.attr("height", "100%")
.attr("fill", bgColor);
var visualizer = new Visualizer(svg);
+
+ var attrFontSize = 20;
+ function placeAttributes() {
+ var inputNodes = d3.selectAll(".layer-1")[0];
+ var attrs = d3.selectAll(".attribute")[0];
+ for (node=0; node<inputNodes.length; node++) {
+ var iNode = d3.select(inputNodes[node]);
+ d3.select(attrs[node])
+ .attr("x", iNode.attr("cx"))
+ .attr("y", Math.floor(parseInt(iNode.attr("cy")) + attrFontSize / 2));
+ }
+ }
+
visualizer.load("data/log.json", function(){
- visualizer.animate(10, 20);
+ var attributeNames =
+ ["CRIM", "ZN", "INDUS", "CHAS", "NOX", "RM", "AGE", "DIS", "RAD", "TAX", "PTRATIO", "B", "LSTAT"];
+ var inputNodes = d3.selectAll(".layer-1")[0];
+ for (node=0; node<inputNodes.length; node++) {
+ var iNode = d3.select(inputNodes[node]);
+ svg
+ .append("text")
+ .attr("class", "attribute")
+ .attr("text-anchor", "middle")
+ .attr("font-weight", "bold")
+ .attr("font-size", attrFontSize + "px")
+ .attr("pointer-events", "none") // disable hovering
+ .attr("cursor", "default")
+ .text(attributeNames[node]);
+ }
+ window.addEventListener("resize", placeAttributes, true);
+ placeAttributes();
+ //visualizer.animate(10, 20);
});
</script>
</body>