-
Notifications
You must be signed in to change notification settings - Fork 15
/
income-wages-taxes.html
307 lines (235 loc) · 10 KB
/
income-wages-taxes.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
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
---
layout: page
permalink: income-wages-taxes.html
title: Income, Wages, and Taxes
---
<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='*Personal Income ' src='https://public.tableau.com/static/images/Pe/PersonalIncome_0/PersonalIncome_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='PersonalIncome_0/PersonalIncome_1' />
<param name='tabs' value='no' /><param name='toolbar' value='yes' />
<param name='static_image' value='https://public.tableau.com/static/images/Pe/PersonalIncome_0/PersonalIncome_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='*Hourly Wages ' src='https://public.tableau.com/static/images/Av/AverageHourlyWages/HourlyWages/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='AverageHourlyWages/HourlyWages' />
<param name='tabs' value='no' />
<param name='toolbar' value='yes' />
<param name='static_image' value='https://public.tableau.com/static/images/Av/AverageHourlyWages/HourlyWages/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='*Taxes Monthly ' src='https://public.tableau.com/static/images/Mo/MonthlyTaxCollections/TaxesMonthly/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='MonthlyTaxCollections/TaxesMonthly' />
<param name='tabs' value='no' />
<param name='toolbar' value='yes' />
<param name='static_image' value='https://public.tableau.com/static/images/Mo/MonthlyTaxCollections/TaxesMonthly/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">
<script src="assets/js/d3.js"></script>
<div class="svg4">
<script type="text/javascript">
var margin = {top: 20, right: 0, bottom: 60, left: 60},
width = 454;
height = 350;
padding = 100;
// Adds the svg canvas
var svg = d3.select("div.svg4")
.append("svg")
.attr("width", width + margin.left + margin.right)
.attr("height", height + margin.top + margin.bottom)
.append("g")
.attr("viewBox", "0 0 " + width + " " + height);
var g = svg.append("g")
.attr("transform", "translate(" + margin.left + "," + margin.top + ")");
var div = d3.select("body").append("div")
.attr("class", "tooltip")
.style("opacity", 0);
// Parse the date / time
var parseDate = d3.time.format("%m/%d/%y").parse;
var formatTax = d3.format(",.2f");
var formatTime = d3.time.format("%Y");
// Set the ranges
var x = d3.time.scale()
.range([0, width - margin.right - margin.left], .1)
.nice();
var y = d3.scale.linear()
.range([height - margin.top - margin.bottom, 20])
.nice();
// Define the axes
var xAxis = d3.svg.axis()
.scale(x)
.orient("bottom")
.ticks(5);
var yAxis = d3.svg.axis()
.scale(y)
.orient("left")
.tickFormat(function(d) {return "$" + d + "B"});
// Define the line
var valueline = d3.svg.line()
.x(function(d) { return x(d.Date); })
.y(function(d) { return y(d["Tax Collections"]); });
// Get the data
d3.csv("assets/data/Yearly Tax Collections.csv", function(error, data) {
data.forEach(function(d) {
d.Date = parseDate(d.Date);
d["Tax Collections"] = formatTax(+d["Tax Collections"]/1000000000);
});
// Scale the range of the data
x.domain(d3.extent(data, function(d) { return d.Date; }));
y.domain([0, d3.max(data, function(d) { return Math.ceil (d["Tax Collections"]); })
]);
svg.selectAll("dot")
.data(data)
.enter()
.append("circle")
.attr("r", 5)
.attr("cx", function(d) { return (x(d.Date)); })
.attr("cy", function(d) { return y(d["Tax Collections"]); })
.style("fill", "white")
.attr("transform", "translate(" + margin.left + "," + margin.top + ")")
.on("mouseover", function(d) {
div.transition()
.duration(200)
.style("opacity", .9);
div .html(formatTime(d.Date) + "<br/>" + "$" + d["Tax Collections"] + "B")
.style("left", (d3.event.pageX) + "px")
.style("top", (d3.event.pageY - 28) + "px");
})
.on("mouseout", function(d) {
div.transition()
.duration(500)
.style("opacity", 0.9);
});
// Add the valueline path.
svg.append("path")
.attr("class", "line")
.attr("transform", "translate(" + margin.left + "," + margin.top + ")")
.attr("d", valueline(data));
// Add the X Axis
svg.append("g")
.attr("class", "x axis")
.attr("transform", "translate(" + margin.left + "," + (height - margin.bottom) + ")")
.call(xAxis);
// Add the Y Axis
svg.append("g")
.attr("class", "y axis")
.attr("transform", "translate(" + margin.left + "," + margin.top + ")")
.call(yAxis);
// Y-axis labels
svg.append("text")
.attr("text-anchor", "middle")
.style("font-size", "13px")
.style("color", "#333333")
.attr("transform", "translate ("+ (padding/4) + "," +(height/2)+") rotate(-90)")
.text("Tax Revenue")
.style("font-family", "Arial");
// X-axis labels
svg.append("text")
.attr("text-anchor", "middle")
.style("font-size", "13px")
.style("color", "#333333")
.attr("transform", "translate("+ (width/2) + "," +(height-(padding/4)) + ")")
.text("Fiscal Year")
.style("font-family", "Arial");
//source
svg.append("text")
.attr("text-anchor", "middle")
.style("font-size", "13px")
.style("color", "#333333")
.attr("transform", "translate("+ (width/4.5) + "," +(height/1) + ")")
.text("Source: DC OCFO")
.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("+ (width/3) + "," +(height/30) + ")")
.text("DC Total Tax Revenues by Fiscal Year")
.style("font-family", "Arial");
svg.append("text")
.attr("text-anchor", "left")
.style("font-size", "13px")
.style("color", "#333333")
.attr("transform", "translate("+ (width/20) + "," +(height/12) + ")")
.text("2000 to 2015")
.style("font-family", "Arial")
//line labels
svg.append('g')
.classed('labels-group', true)
.selectAll('text')
.data(data)
.enter()
.append('text')
.filter(function(d, i) { return i === 0||i === (data.length - 1) })
.classed('label',true)
.style("font-size", "13px")
.style("font-family", "Arial")
.classed('label',true)
.attr({
'x':function(d,i) {
return x(d.Date);
},
'y':function(d,i) {
return y(d["Tax Collections"]);
}
})
.text(function(d,i){
return "$" + d["Tax Collections"] + "B";
})
.attr("transform", "translate(" + 60 + "," + 33 + ")")
});
</script>
</div>
<div style="max-width: 454px"> For more insights from DC's OCFO, visit <a href='http://districtmeasured.com'>District, Measured</a>, the blog of the District’s Office of Revenue Analysis. </div>
<hr style="width: 454px; margin:1em 0">
<p style="font-size: 0.8em; color: #919395">
<sup>1</sup> BEA Personal Income and State GDP available <a href='http://www.bea.gov/iTable/index_regional.cfm'>here</a>.
<br>
<sup>2</sup> BLS Hourly Wage data available for DC <a href='http://beta.bls.gov/dataViewer/view/timeseries/SMU11000000500000003'>here</a> and for the US <a href='http://beta.bls.gov/dataViewer/view/timeseries/CEU0500000003'>here</a>.
<br>
<sup>3</sup> OCFO tax collections and tax revenue data available <a href='http://cfo.dc.gov/page/dc-revenue-reports'>here</a>.
</p>