-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
228 lines (193 loc) · 6.96 KB
/
Copy pathindex.html
File metadata and controls
228 lines (193 loc) · 6.96 KB
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Causes Heat Map with Toolbox and Aggrgate Selection and Drilling.</title>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script src="http://d3js.org/colorbrewer.v1.min.js"></script>
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script type="text/javascript" src="jsCode/addCommaScript.js"></script>
<script type="text/javascript" src="jsCode/heatMap.js"></script>
<script type="text/javascript" src="jsCode/CustomTooltip.js"></script>
<link rel="stylesheet" type="text/css" href="css/style59Representation.css">
<style type="text/css">
#diseaseTooltip {
position: absolute;
display: none;
top: 100px;
left: 100px;
-moz-border-radius:5px;
border-radius: 5px;
border: 2px solid #000;
/* background: #222222; */
background: #fff;
opacity: .9;
/* color: #eeeeee; */
color: black;
padding: 10px;
width: 200px;
font-size: 12px;
z-index: 10;
}
#diseaseNameTooltip {
position: absolute;
display: none;
top: 10px;
left: 10px;
-moz-border-radius:10px;
border-radius: 10px;
/* border: 1px solid #000;*/
/* background: #222222; */
/*background: #fff;*/
opacity: .9;
/* color: #eeeeee; */
color: black;
padding: 5px;
width: 200px;
font-size: 12px;
z-index: 10;
}
#diseaseNameTooltip .value{
font-weight:bold;
color: white;
}
.tooltip .title {
font-size: 13px;
}
.tooltip .name {
font-weight:bold;
}
h1{
text-align:center;
color:black;
font-size: 34px;
display: block;
}
#vis{
display: block;
margin-top: 10px;
}
</style>
</head>
<body>
<div id = "buttonsUnit">
<div class = "unit-button">
<input type="radio" name="unit" id ="button4" checked onclick = "setUnitPercent()">
<label for = "button4" unselectable> %</label>
</div>
<div class = "unit-button">
<input type="radio" name="unit" id ="button5" onclick = "setUnitRate()">
<label for = "button5" unselectable> Rate</label>
</div>
<div class = "unit-button">
<input type="radio" name="unit" id ="button6" onclick = "setUnitNum()">
<label for = "button6" unselectable> #</label>
</div>
</div>
<form>
<select id="menuYear" onchange="setYear(this.form.menuYear)">
<option>2000</option>
<option>2001</option>
<option>2002</option>
<option>2003</option>
<option>2004</option>
<option>2005</option>
<option>2006</option>
<option>2007</option>
<option>2008</option>
<option>2009</option>
</select>
</form>
<div id= "title"><h1></h1></div>
<div id = "popBar"> </div>
<div id="vis"></div>
<div class='tooltip' id="diseaseTooltip"></div>
<div class="tooltip" id="diseaseNameTooltip"></div>
<script type = "text/javascript">
//Borders, margins and sizes
var margin = {top: 20, right: 20, bottom: 20, left: 20};
var legend = {top: 50, right: 10, bottom: 50, left: 50};
var widthWhole = 1050 - (margin.right + margin.left);
var heightWhole = 600 - (margin.bottom+ margin.top);
var width = 550 - (margin.right+ margin.left + legend.right + legend.left);
var height = 485 - (margin.top +margin.bottom+ legend.top + legend.bottom);
var legendBarSpace = 15, labelBarSpace = 15;
var widthBar = 130 - labelBarSpace;//widthWhole - width - 2*(margin.left+margin.right) -50; //around250
var heightBar = 100 - legendBarSpace;
var legendLeft = legend.left;
var legendTop = legend.top;
var legendBottom = legend.bottom;
var buckets = 10;
//THE SCALES
var space = .03;
var xScale = d3.scale
.ordinal()
.rangeRoundBands([0, width],space);
var yScale = d3.scale
.ordinal()
.rangeRoundBands([0, height], space);
var colorScale = d3.scale
.quantile()
.range(["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"]) //GnBu
.range(colorbrewer.YlGnBu[buckets - 1])
.range(colorbrewer.YlOrBr[buckets - 1]);
var colorScaleBar = d3.scale
.ordinal()
.range(["red", "blue"]);
//SCALES FOR THE BAR GRAPH
var spaceBar = .1,spaceBarInner = 0.1;
var xScaleBar = d3.scale
.ordinal() //is this the pixel, we should translate the whole part of it
.rangeRoundBands([0, widthBar],spaceBar);
var xScaleBarInner = d3.scale
.ordinal();
var yScaleBar = d3.scale
.linear()
.range([5, heightBar], spaceBar);
//GLOBAL VARIABLE FOR THE DATA
var currentCause = "Other causes of death";
var currentAge = "60 to 64 years";
var currentYear = 2000;
var currentUnit = "Number";
var filteredDatasetBAR = [];
var dataset = [];
var filteredDatasetHM = [];
//selected =new Object();
var selected = {};
//SVG ELEMENT
var svg = d3.select("#vis")
.append("svg")
.attr("width", widthWhole)
.attr("height", heightWhole);
var heatMap = svg.append("g")
.attr("class", "heatmap")
.attr("transform", "translate(" + legendLeft + ", "+ legendTop + ")");
var legendHM = svg.append("g")
.attr("class", "legend");
var labelHM = svg.append("g")
.attr("class", "label");
var svgPop = d3.select("#popBar")
.append("svg")
.attr("width", widthBar + labelBarSpace)
.attr("height", heightBar + legendBarSpace);
var barChart = svgPop.append("g")
.attr("class", "barChart");
var barHeaderLabel = svgPop.append("g")
.attr("class", "barHeaderLabel")
.attr("transform", "translate(60,5)");
var legendB = svgPop.append("g")
.attr("class", "legend");
var labelB = svgPop.append("g")
.attr("class", "label")
.attr("id", "labelBar");
//THIS IS WHERE WE NEED TO PICK UP.
var barYAxis = d3.svg.axis()
.scale(yScaleBar)
.orient("left")
.tickFormat(d3.format(".2s"));
var tooltip = CustomTooltip("diseaseTooltip", 200);
var nameTooltip = CustomTooltip("diseaseNameTooltip", 400);
</script>
</body>
</html>