-
Notifications
You must be signed in to change notification settings - Fork 0
/
treemap.html
112 lines (102 loc) · 3.7 KB
/
treemap.html
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="favicon.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>S&P 500 Historical Stats</title>
<link rel="stylesheet" href="./style.css" />
<style>
div {
margin-bottom: 10px;
}
label {
display: inline-block;
width: 110px;
height: 20px;
color: #777777;
}
input {
padding: 5px 10px;
}
</style>
</head>
<body>
<h2>S&P 500 Historical Treemap</h2>
<div id="d3-div"></div>
<div id="vega-div"></div>
<div class="output" id="text-div"></div>
<label for="selectButton">Select Category</label>
<select id="selectButton"></select>
<br>
<label for="from-month">From</label>
<input type="month" id="from-month" value="1871-01" min="1871-01" max="2018-03">
<br>
<label for="to-month">To</label>
<input type="month" id="to-month" value="2018-03" min="1871-01" max="2018-03">
<br>
<input type="button" id="update" value="Update">
<svg id='legend' width = "500px">
<g>
<rect class="legend-item" x="10" y="10" width="40" height="40" fill="orange"></rect>
<text x="30" y="60" fill="white"
transform = "rotate(90 30,60)">Communication Services</text>
</g>
<g>
<rect class="legend-item" x="50" y="10" width="40" height="40" fill="lightgreen"></rect>
<text x="70" y="60" fill="white"
transform = "rotate(90 70,60)">Utilities</text>
</g>
<g>
<rect class="legend-item" x="90" y="10" width="40" height="40" fill="crimson"></rect>
<text x="110" y="60" fill="white"
transform = "rotate(90 110,60)">Industrails</text>
</g>
<g>
<rect class="legend-item" x="130" y="10" width="40" height="40" fill="steelblue"></rect>
<text x="150" y="60" fill="white"
transform = "rotate(90 150,60)">Consumer Staples</text>
</g>
<g>
<rect class="legend-item" x="170" y="10" width="40" height="40" fill="pink"></rect>
<text x="190" y="60" fill="white"
transform = "rotate(90 190,60)">Financials</text>
</g>
<g>
<rect class="legend-item" x="210" y="10" width="40" height="40" fill="khaki"></rect>
<text x="230" y="60" fill="white"
transform = "rotate(90 230,60)">Information Technology</text>
</g>
<g>
<rect class="legend-item" x="250" y="10" width="40" height="40" fill="tan"></rect>
<text x="270" y="60" fill="white"
transform = "rotate(90 270,60)">Materials</text>
</g>
<g>
<rect class="legend-item" x="290" y="10" width="40" height="40" fill="tan"></rect>
<text x="310" y="60" fill="white"
transform = "rotate(90 310,60)">Real Estate</text>
</g>
<g>
<rect class="legend-item" x="330" y="10" width="40" height="40" fill="tan"></rect>
<text x="350" y="60" fill="white"
transform = "rotate(90 350,60)">Comsumer Discretionary</text>
</g>
<g>
<rect class="legend-item" x="370" y="10" width="40" height="40" fill="tan"></rect>
<text x="390" y="60" fill="white"
transform = "rotate(90 390,60)">Health Care</text>
</g>
<g>
<rect class="legend-item" x="410" y="10" width="40" height="40" fill="black"></rect>
<text x="430" y="60" fill="white"
transform = "rotate(90 430,60)">Energy</text>
</g>
</svg>
<div class="output" id="data-div"></div>
<div class="output" id="svg-div"></div>
<svg id="canvas"></svg>
<script type="module" src="./treemap.js"></script>
<div id='tooltip'></div>div>
</body>
</html>