-
Notifications
You must be signed in to change notification settings - Fork 15
/
housing-indicators.html
287 lines (222 loc) · 10.7 KB
/
housing-indicators.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
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
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
---
layout: page
permalink: housing-indicators.html
title: Housing Indicators
---
This page contains broad housing indicators covering the DC housing market as a whole. For information on efforts to preserve and protect affordable housing in the District, please visit the <a href="http://dcgov.github.io/economic-intelligence/affordable-production-preservation.html">Affordable Housing Production and Preservation</a> tab.
<br><br>
<hr style="width: 454px; margin:1em 0">
<div class='tableauPlaceholder' style='width: 454px; height: 369px;'>
<noscript>
<a href='#'><img alt='*Median Rents ' src='https://public.tableau.com/static/images/Me/MedianMonthlyRents/MedianRents/1_rss.png' style='border: none' /></a>
</noscript>
<object class='tableauViz' width='454' height='369' style='display:none;'>
<param name='host_url' value='https%3A%2F%2Fpublic.tableau.com%2F' />
<param name='site_root' value='' />
<param name='name' value='MedianMonthlyRents/MedianRents' />
<param name='tabs' value='no' />
<param name='toolbar' value='yes' />
<param name='static_image' value='https://public.tableau.com/static/images/Me/MedianMonthlyRents/MedianRents/1.png' />
<param name='animate_transition' value='yes' />
<param name='display_static_image' value='yes' />
<param name='display_spinner' value='yes' />
<param name='display_overlay' value='yes' />
<param name='display_count' value='yes' />
<param name='showVizHome' value='no' />
<param name='showTabs' value='y' />
<param name='bootstrapWhenNotified' value='true' />
</object>
</div>
<hr style="width: 454px; margin:1em 0">
<div class='tableauPlaceholder' style='width: 454px; height: 369px;'>
<noscript>
<a href='#'><img alt='*EI Dash Home Sales ' src='https://public.tableau.com/static/images/Ho/HomeSales_2/EIDashHomeSales/1_rss.png' style='border: none' /></a>
</noscript>
<object class='tableauViz' width='454' height='369' style='display:none;'>
<param name='host_url' value='https%3A%2F%2Fpublic.tableau.com%2F' />
<param name='embed_code_version' value='3' />
<param name='site_root' value='' />
<param name='name' value='HomeSales_2/EIDashHomeSales' />
<param name='tabs' value='no' />
<param name='toolbar' value='yes' />
<param name='static_image' value='https://public.tableau.com/static/images/Ho/HomeSales_2/EIDashHomeSales/1.png' />
<param name='animate_transition' value='yes' />
<param name='display_static_image' value='yes' />
<param name='display_spinner' value='yes' />
<param name='display_overlay' value='yes' />
<param name='display_count' value='yes' />
<param name='filter' value='publish=yes' />
</object>
</div>
<br>
<script src="assets/js/d3.js"></script>
<div class="svg1">
<script type="text/javascript">
var outerWidth = 475;
var outerHeight = 350;
var margin = { left: 75, top: 30, right: 0, bottom: 60 };
var padding = 100;
var barPadding = 0.2;
var barPaddingOuter = 0.1;
var xColumn = "Percentage";
var yColumn = "LabelD3";
var xAxisLabelOffset = 75;
var innerWidth = outerWidth - margin.left - margin.right;
var innerHeight = outerHeight - margin.top - margin.bottom;
var svg = d3.select("div.svg1")
.append("svg")
.attr("width", outerWidth)
.attr("height", outerHeight)
.attr("viewBox", "0 0 " + outerWidth + " " + outerHeight);
var g = svg.append("g")
.attr("transform", "translate(" + margin.left + "," + margin.top + ")");
var xAxisG = g.append("g")
.attr("class", "x axis")
.attr("transform", "translate(0," + innerHeight + ")")
var yAxisG = g.append("g")
.attr("class", "y axis");
var xScale = d3.scale.linear()
.range([0, innerWidth - margin.right - margin.left], .1);
var yScale = d3.scale.ordinal()
.rangeRoundBands([innerHeight , 13], barPadding, barPaddingOuter);
var xAxis = d3.svg.axis().scale(xScale).orient("bottom")
.ticks(7)
.tickFormat(function(d) {return d + "%"});
var yAxis = d3.svg.axis().scale(yScale).orient("left");
function render(data){
xScale.domain([0, d3.max(data, function(d) { return Math.ceil (d[xColumn]); })]);
yScale.domain(data.map( function(d) { return d[yColumn]; }));
xAxisG.call(xAxis);
yAxisG.call(yAxis);
var bars = g.selectAll("rect").data(data);
bars.enter().append("rect")
.attr("height", yScale.rangeBand());
bars
.attr("x", 0)
.attr("class", "bar1")
.attr("y", function (d){ return yScale(d[yColumn]); })
.attr("width", function (d){ return xScale(d[xColumn]); });
// horizontal bar labels
svg.append("g")
.attr("transform", "translate(" + margin.left + "," + margin.top + ")")
.selectAll(".rightlabel")
.data(data)
.enter()
.append("text")
.attr("class", "rightlabel")
.style("font-family", "Arial")
.attr("x", function(d){ return xScale(parseFloat(d["Percentage"])) ; })
.attr("y", function(d){ return yScale(d["LabelD3"]) + yScale.rangeBand()/2; })
.text(function(d){ return (d["Percentage"] + "%"); });
// X-axis labels
svg.append("text")
.attr("text-anchor", "middle")
.style("font-size", "13px")
.style("color", "#333333")
.attr("transform", "translate("+ (outerWidth/2) + "," +(outerHeight-(padding/4)) + ")")
.text("% of Households")
.style("font-family", "Arial");
//title for the chart
svg.append("text")
.attr("text-anchor", "middle")
.style("font-size", "16px")
.style("color", "#333333")
.attr("transform", "translate("+ (outerWidth/3.78) + "," +(outerHeight/30) + ")")
.text("Housing Tenure of DC Residents")
.style("font-family", "Arial");
//source
svg.append("text")
.attr("text-anchor", "middle")
.style("font-size", "13px")
.style("color", "#333333")
.attr("transform", "translate("+ (outerWidth/3.2) + "," +(outerHeight/1) + ")")
.text("Source: US Census ACS 5-year 2010-2014")
.style("font-family", "Arial")
svg.append("text")
.attr("text-anchor", "left")
.style("font-size", "13px")
.style("color", "#333333")
.attr("transform", "translate("+ (outerWidth/50) + "," +(outerHeight/12) + ")")
.text("2014")
.style("font-family", "Arial")
bars.exit().remove();
}
function type(d){
d.Percentage = +d.Percentage;
return d;
}
d3.csv("assets/data/Housing.csv", type, render);
</script>
</div>
<hr style="width: 454px; margin:1em 0">
<script type='text/javascript' src='https://public.tableau.com/javascripts/api/viz_v1.js'></script>
<div class='tableauPlaceholder' style='width: 454px; height: 369px;'>
<noscript>
<a href='#'><img alt='*TotalUnits ' src='https://public.tableau.com/static/images/To/TotalUnits/TotalUnits/1_rss.png' style='border: none' /></a>
</noscript>
<object class='tableauViz' width='454' height='369' style='display:none;'>
<param name='host_url' value='https%3A%2F%2Fpublic.tableau.com%2F' />
<param name='site_root' value='' /><param name='name' value='TotalUnits/TotalUnits' />
<param name='tabs' value='no' /><param name='toolbar' value='yes' />
<param name='static_image' value='https://public.tableau.com/static/images/To/TotalUnits/TotalUnits/1.png' />
<param name='animate_transition' value='yes' />
<param name='display_static_image' value='yes' />
<param name='display_spinner' value='yes' />
<param name='display_overlay' value='yes' />
<param name='display_count' value='yes' />
<param name='showVizHome' value='no' />
<param name='showTabs' value='y' />
<param name='bootstrapWhenNotified' value='true' />
</object>
</div>
<hr style="width: 454px; margin:1em 0">
<div class='tableauPlaceholder' style='width: 454px; height: 369px;'>
<noscript>
<a href='#'><img alt='*Inventory ' src='https://public.tableau.com/static/images/Fo/For-saleHousingInventory/Inventory_1/1_rss.png' style='border: none' /></a>
</noscript>
<object class='tableauViz' width='454' height='369' style='display:none;'>
<param name='host_url' value='https%3A%2F%2Fpublic.tableau.com%2F' />
<param name='site_root' value='' />
<param name='name' value='For-saleHousingInventory/Inventory_1' />
<param name='tabs' value='no' /><param name='toolbar' value='yes' />
<param name='static_image' value='https://public.tableau.com/static/images/Fo/For-saleHousingInventory/Inventory_1/1.png' />
<param name='animate_transition' value='yes' />
<param name='display_static_image' value='yes' />
<param name='display_spinner' value='yes' />
<param name='display_overlay' value='yes' />
<param name='display_count' value='yes' />
<param name='showVizHome' value='no' />
<param name='showTabs' value='y' />
<param name='bootstrapWhenNotified' value='true' />
</object>
</div>
<hr style="width: 454px; margin:1em 0">
<div class='tableauPlaceholder' style='width: 454px; height: 369px;'>
<noscript>
<a href='#'><img alt='*Home Sales ' src='https://public.tableau.com/static/images/Ho/HomeSales_2/HomeSales/1_rss.png' style='border: none' /></a>
</noscript>
<object class='tableauViz' width='454' height='369' style='display:none;'>
<param name='host_url' value='https%3A%2F%2Fpublic.tableau.com%2F' />
<param name='site_root' value='' />
<param name='name' value='HomeSales_2/HomeSales' />
<param name='tabs' value='no' />
<param name='toolbar' value='yes' />
<param name='static_image' value='https://public.tableau.com/static/images/Ho/HomeSales_2/HomeSales/1.png' />
<param name='animate_transition' value='yes' />
<param name='display_static_image' value='yes' />
<param name='display_spinner' value='yes' />
<param name='display_overlay' value='yes' />
<param name='display_count' value='yes' />
<param name='showVizHome' value='no' />
<param name='showTabs' value='y' />
<param name='bootstrapWhenNotified' value='true' />
</object>
</div>
<hr style="width: 454px; margin:1em 0">
<p style="font-size: 0.8em; color: #919395">
<sup>1</sup> ACS housing tenure data available via American FactFinder <a href='http://factfinder.census.gov/faces/nav/jsf/pages/index.xhtml'>here</a>.
<br>
<sup>2</sup> Zillow Group for-sale inventory and median rents data available <a href='http://www.zillow.com/research/data/'>here</a>.
<br>
<sup>3</sup> GMU home sales data available <a href='http://cra.gmu.edu/data/'>here</a>.
</p>