Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added html/team2/Reported_By_Gender_Count/.DS_Store
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Year Male Female Adult Not_Adult1991 36 0 37 01992 36 5 41 21993 51 1 52 11994 71 4 75 11995 115 205 320 91996 174 41 218 51997 171 12 188 51998 185 11 199 41999 307 13 323 92000 311 17 333 32001 336 8 352 42002 334 6 343 82003 456 12 474 82004 451 8 464 92005 431 12 446 82006 362 8 374 22007 409 12 427 72008 492 13 513 82009 414 10 433 92010 246 5 255 3
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Type,Count
Male,5388
Female,403
Adult,5867
Not_Adult,105
66 changes: 66 additions & 0 deletions html/team2/Reported_By_Gender_Count/pie_chart.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<!DOCTYPE html>
<body>
<h2>Count of UFO sightings reported on gender basis and on Adult vs Non-Adult basis by year </h2>
<p>We have aggregated the data based on gender and age by utilizing the description which mentions "a Male reported", or "a Female reported" or "2 kids reported" etc. Both male and female categories are merged into Adult Category.</p>
<p><i>Please note the data covered is 9.1 percent of the whole data.</i></p>
</body>
<meta charset="utf-8">
<style>

.arc text {
font: 20px sans-serif;
text-anchor: middle;
}

.arc path {
stroke: #fff;
}

</style>
<svg width="960" height="500"></svg>
<script src="https://d3js.org/d3.v4.min.js"></script>
<script>

//Create a consolidated pie chart from ReportedBy.csv with all 4 types : Man, Female, Adult, Kid
var svg = d3.select("svg"),
width = +svg.attr("width"),
height = +svg.attr("height"),
radius = Math.min(width, height) / 2,
g = svg.append("g").attr("transform", "translate(" + width / 2 + "," + height / 2 + ")");

var color = d3.scaleOrdinal(["#FF3333", "#4CFF33", "#ECFF33", "#3342FF"]);

var pie = d3.pie()
.sort(null)
.value(function(d) { return d.Count; });

var path = d3.arc()
.outerRadius(radius - 10)
.innerRadius(0);

var label = d3.arc()
.outerRadius(radius - 40)
.innerRadius(radius - 40);

d3.csv("ReportedBy_Male_Female_Adult_kid_year_count_total.csv", function(d) {
d.Count = +d.Count;
return d;
}, function(error, data) {
if (error) throw error;

var arc = g.selectAll(".arc")
.data(pie(data))
.enter().append("g")
.attr("class", "arc");

arc.append("path")
.attr("d", path)
.attr("fill", function(d) { return color(d.data.Type); });

arc.append("text")
.attr("transform", function(d) { return "translate(" + label.centroid(d) + ")"; })
.attr("dy", "0.35em")
.text(function(d) { return d.data.Type; });
});

</script>
33 changes: 33 additions & 0 deletions html/team2/Reported_By_Gender_Count/pie_chart_data.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import csv

headers = []
countList = []
count = 1

#Create total count for all 4 types : Man, Female, Adult, Kid
with open("ReportedBy_Male_Female_Adult_kid_year_count.tsv","r", encoding = "ISO-8859-1") as f:
for line in f:
if count == 1:
sp = line.split("\t")
for i in range(1,len(sp)):
headers.append(sp[i].strip())
count = count + 1
continue

sp=line.split("\t")

if len(sp) < 3:
continue
# print(len(sp))
if not countList:
for i in range(1, len(sp)):
countList.append(int(sp[i].strip()))
else:
for i in range(1, len(sp)):
countList[i] = countList[i] + int(sp[i].strip())


fcsv = csv.writer(open("ReportedBy_Male_Female_Adult_kid_year_count_total.csv", "w"))
fcsv.writerow(["Type", "Count"])
for i in range(len(headers)):
fcsv.writerow([headers[i], countList[i]])
Binary file added html/team2/UFO_Sightings_year/.DS_Store
Binary file not shown.
1 change: 1 addition & 0 deletions html/team2/UFO_Sightings_year/UFOSightings_year_count.tsv
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Year No_of_UFO_Sightings1943 101944 121945 121946 121947 391948 101949 161950 281951 221952 521953 351954 521955 381956 421957 741958 451959 511960 671961 441962 591963 791964 831965 1771966 1861967 1941968 2091969 1531970 1421971 1221972 1731973 2201974 2661975 3051976 2721977 2601978 3381979 2461980 2361981 1591982 2111983 1541984 2361985 2291986 2021987 2281988 2241989 2491990 2541991 2331992 2591993 3261994 4221995 13941996 9361997 13381998 19571999 31002000 30492001 34612002 36102003 43422004 46642005 44102006 40422007 45222008 50852009 47382010 2736
Expand Down
67 changes: 67 additions & 0 deletions html/team2/UFO_Sightings_year/UFO_Sightings_line_chart.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<!DOCTYPE html>
<body>
<h2>Count of UFO sightings reported by year </h2>
<p>This visualization helps us understand the rate of growth of UFO sightings reported per year.</p>
</body>

<svg width="960" height="500"></svg>
<script src="https://d3js.org/d3.v4.min.js"></script>
<script>

// A Basic D3 Line chart representing no of sightings every year

var svg = d3.select("svg"),
margin = {top: 20, right: 20, bottom: 30, left: 50},
width = +svg.attr("width") - margin.left - margin.right,
height = +svg.attr("height") - margin.top - margin.bottom,
g = svg.append("g").attr("transform", "translate(" + margin.left + "," + margin.top + ")");

var parseTime = d3.timeParse("%Y");

var x = d3.scaleTime()
.rangeRound([0, width]);

var y = d3.scaleLinear()
.rangeRound([height, 0]);

var line = d3.line()
.x(function(d) { return x(d.Year); })
.y(function(d) { return y(d.No_of_UFO_Sightings); });

d3.tsv("UFOSightings_year_count.tsv", function(d) {
d.Year = parseTime(d.Year);
d.No_of_UFO_Sightings = +d.No_of_UFO_Sightings;
return d;
}, function(error, data) {
if (error) throw error;

x.domain(d3.extent(data, function(d) { return d.Year; }));
y.domain(d3.extent(data, function(d) { return d.No_of_UFO_Sightings; }));

g.append("g")
.attr("transform", "translate(0," + height + ")")
.call(d3.axisBottom(x))
.select(".domain")
.remove();

g.append("g")
.call(d3.axisLeft(y))
.append("text")
.attr("fill", "#000")
.attr("transform", "rotate(-90)")
.attr("y", 6)
.attr("dy", "0.71em")
.attr("text-anchor", "end")
.text("No of UFO Sightings");

g.append("path")
.datum(data)
.attr("fill", "none")
.attr("stroke", "steelblue")
.attr("stroke-linejoin", "round")
.attr("stroke-linecap", "round")
.attr("stroke-width", 1.5)
.attr("d", line);
});

</script>
Binary file added html/team2/Within_25_miles_count/.DS_Store
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Year Within_25Miles Outside_25Miles1790 1 01860 1 01864 1 01871 0 11880 1 01896 1 01899 1 01901 1 01905 1 01906 1 01910 3 01914 1 01916 1 01920 1 01922 1 01925 1 01929 1 01930 1 01931 2 01934 1 01935 1 01936 3 01937 2 01939 2 01941 2 11942 5 01943 6 01944 11 11945 10 11946 10 01947 34 21948 10 01949 15 11950 26 11951 22 01952 46 21953 32 11954 43 51955 33 21956 35 21957 65 21958 40 11959 49 11960 64 21961 43 11962 52 31963 70 31964 75 51965 160 61966 166 121967 172 151968 183 121969 136 81970 126 61971 103 71972 152 71973 199 101974 245 141975 275 111976 239 181977 230 151978 298 181979 216 141980 208 131981 133 101982 167 101983 131 131984 173 61985 184 71986 182 31987 197 161988 194 141989 226 121990 224 161991 206 151992 224 141993 282 241994 368 261995 1260 811996 847 351997 1192 651998 1766 871999 2757 1372000 2790 1352001 3229 1142002 3335 1242003 4003 1792004 4307 1942005 4104 1652006 3724 1732007 4211 1702008 4718 2292009 4445 1772010 2566 100
Expand Down
94 changes: 94 additions & 0 deletions html/team2/Within_25_miles_count/data.tsv
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name value
1964 -5
1965 160
1965 -6
1966 166
1966 -12
1967 172
1967 -15
1968 183
1968 -12
1969 136
1969 -8
1970 126
1970 -6
1971 103
1971 -7
1972 152
1972 -7
1973 199
1973 -10
1974 245
1974 -14
1975 275
1975 -11
1976 239
1976 -18
1977 230
1977 -15
1978 298
1978 -18
1979 216
1979 -14
1980 208
1980 -13
1981 133
1981 -10
1982 167
1982 -10
1983 131
1983 -13
1984 173
1984 -6
1985 184
1985 -7
1986 182
1986 -3
1987 197
1987 -16
1988 194
1988 -14
1989 226
1989 -12
1990 224
1990 -16
1991 206
1991 -15
1992 224
1992 -14
1993 282
1993 -24
1994 368
1994 -26
1995 1260
1995 -81
1996 847
1996 -35
1997 1192
1997 -65
1998 1766
1998 -87
1999 2757
1999 -137
2000 2790
2000 -135
2001 3229
2001 -114
2002 3335
2002 -124
2003 4003
2003 -179
2004 4307
2004 -194
2005 4104
2005 -165
2006 3724
2006 -173
2007 4211
2007 -170
2008 4718
2008 -229
2009 4445
2009 -177
2010 2566
2010 -100
29 changes: 29 additions & 0 deletions html/team2/Within_25_miles_count/neg_barchart_data.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@

dict = {}
count = 1

# Generating TSV to TSV with Within 25 miles as Positive Value and Outside 25 miles as a negative value
with open("Within_25Miles_Otherwise_year_count.tsv","r", encoding = "ISO-8859-1") as f:
for line in f:
if count == 1:
count = count + 1
continue

sp=line.split("\t")

if len(sp) < 3:
continue
# print(len(sp))
if(sp[2].strip() == '0'):
dict[sp[0].strip()] = [sp[1].strip(), sp[2].strip()]
else:
dict[sp[0].strip()] = [sp[1].strip(), "-"+sp[2].strip()]


ftsv = open("data.tsv", "w")
ftsv.write("name\tvalue\n")
for key in dict.keys():
ftsv.write(key.strip() + "\t" + dict[key][0].strip() + "\n")
ftsv.write(key.strip() + "\t" + dict[key][1].strip() + "\n")

ftsv.close()
Loading