summaryrefslogtreecommitdiff
path: root/index.html
blob: 456ad87f863aecfaf68fd19a2babae54a8bd54e1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<!DOCTYPE html>
<html lang="de">
<head>
    <meta charset="UTF-8">
    <title></title>
    <link rel="stylesheet" href="index.css">
    <link rel="stylesheet" href="dep/material-icons.css">
    <link rel="stylesheet" href="dep/material.deep_purple-blue.min.css">
</head>
<body>
    <script src="dep/d3.js" type="text/javascript"></script>
    <script src="dep/material.min.js"></script>

    <script src="code/weightvis.js" type="text/javascript"></script>

    <div id="visContainer" />
    <script type="text/javascript">
        var svg = d3.select("#visContainer").append("svg");
        svg
            .attr("width", "100%")
            .attr("height", "100%");
        svg.append("rect")
            .attr("width", "100%")
            .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(){
            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>
</html>