-
Notifications
You must be signed in to change notification settings - Fork 0
/
index_old.html
224 lines (214 loc) · 11.3 KB
/
index_old.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
<!DOCTYPE html>
<html>
<head>
<style>
html {
scroll-behavior: smooth;
}
body {
margin-bottom: 0px;
}
.error {
color: red;
}
#wrapper {
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
font-family: monospace !important;
}
#header, #about {
width: 80%;
/*padding-left: 200px;
padding-right: 200px;*/
display: flex;
justify-content: center;
/*align-items: center;*/
flex-direction: column;
padding-bottom: 25px;
}
#top-bar {
display: flex;
flex-direction: row;
vertical-align: middle;
}
#about {
padding-bottom: 0px !important;
}
#page-title {
font-size: 3em;
}
.description {
font-size: 1.5em;
padding-bottom: 25px;
}
.description-top {
/*vertical-align: middle;
display: flex;
justify-content: center;
align-items: center;*/
padding-bottom: 0px !important;
}
.container {
display: flex;
flex-wrap: wrap;
}
.top-left {
flex: 50%;
}
.top-right {
/*flex: 50%;*/
text-align: right;
vertical-align: middle;
display: flex;
justify-content: center;
align-items: center;
padding-bottom: 0px !important;
}
.bottom-left {
flex: 50%;
}
.bottom-right {
flex: 50%;
text-align: right;
}
#spacer {
color: black;
border-style: inset;
border-width: 1px;
margin: 0.5em auto;
margin-left: 0;
margin-right: 0;
width: 100%;
}
#yoda {
width: 30%;
}
#vis {
display: flex;
justify-content: center;
align-items: center;
}
#myBtn {
display: none;
position: fixed;
bottom: 20px;
right: 30px;
z-index: 99;
font-size: 18px;
border: none;
outline: none;
background-color: gray;
color: white;
cursor: pointer;
padding: 15px;
border-radius: 4px;
font-family: monospace !important;
}
#myBtn:hover {
background-color: #555;
}
</style>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm//vega@5"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm//vega-lite@4.8.1"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm//vega-embed@6"></script>
<link rel="apple-touch-icon" sizes="180x180" href="favicon_io/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="favicon_io/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="favicon_io/favicon-16x16.png">
<link rel="manifest" href="favicon_io/site.webmanifest">
<title>Video Game Sales | 6.859 A4 Spring 2021</title>
</head>
<body>
<div id="wrapper">
<button onclick="topFunction()" id="myBtn" title="Go to top">back to top ⬆️</button>
<div id="header">
<div class="container">
<div class="top-left">
<h1 id="page-title">🎮 Video Game Sales 🎮</h1>
</div>
<div class="top-right">
<p class="description description-top"><a href="#vis">Visualization</a> | <a href="#about">About</a></p>
</div>
</div>
<div id="top-bar">
</div>
<p class="description">
🎮 Video games sales have taken off since they came onto the scene in the 1980s. 🚀
<br>
<br>
🖱️ <b>Click through the charts below</b> to explore your favorite games, and learn about some games you've never even heard of!
<br>
<br>
⇧+🖱️ <b>Shift + Click to select multiple items in bar charts. 📊</b>
<br>
<br>
🖱️+ ↔️ <b>Click and drag in the scatter plot</b> to select specific years for a given game name.
</p>
<hr id="spacer">
</div>
<div id="vis"></div>
<div id="about">
<hr id="spacer">
<p class="description">
🔗 <b>Useful Links</b>
<br>
<br>
📈 <a href="https://www.kaggle.com/arslanali4343/sales-of-video-games" target="_blank"> Original Kaggle Dataset</a>
<br>
💻 <a href="https://github.com/6859-sp21/a4-video-game-sales" target="_blank">GitHub Repository</a>
<br>
📄 <a href="https://altair-viz.github.io/" target="_blank">Altair Visualization Software</a>
<br>
✏️ <a href="http://vis.mit.edu/classes/6.859/" target="_blank">6.859 Home</a>
<br>
<br>
📊 <b>Authors</b>
<br>
<br>
- Christian Moroney {cmoroney}
<br>
- Jackson Bernatchez {jrbernat}
<br>
- Kevin Lyons {kalyons}
</p>
<img id="yoda" src="yoda.jpeg">
</div>
</div>
<script>
(function(vegaEmbed) {
var spec = {"config": {"view": {"continuousWidth": 400, "continuousHeight": 300, "strokeWidth": 0}, "axis": {"labelFont": "monospace", "labelFontSize": 12, "titleFont": "monospace", "titleFontSize": 16, "titlePadding": 20}, "padding": {"left": 200, "top": 5, "right": 5, "bottom": 1000}, "title": {"font": "monospace", "fontSize": 18}}, "vconcat": [{"hconcat": [{"mark": {"type": "area", "dx": -50}, "encoding": {"color": {"type": "nominal", "field": "Genre", "legend": null, "scale": {"scheme": "tableau20"}}, "opacity": {"condition": {"value": 1, "selection": "selector196"}, "value": 0.2}, "x": {"type": "ordinal", "field": "Year"}, "y": {"type": "quantitative", "aggregate": "sum", "field": "Global_Sales", "title": "Total Global Sales"}}, "selection": {"selector196": {"type": "single", "fields": ["Genre"], "empty": "none"}}, "title": "Total Global Sales by Release Year"}, {"mark": "point", "encoding": {"color": {"type": "nominal", "field": "Genre"}, "y": {"type": "nominal", "axis": {"orient": "right"}, "field": "Genre"}}, "selection": {"selector196": {"type": "single", "fields": ["Genre"], "empty": "none"}}}]}, {"mark": {"type": "text", "dx": 0, "dy": -20, "font": "monospace", "size": 20}, "encoding": {"color": {"type": "nominal", "field": "Genre"}, "text": {"type": "nominal", "field": "Genre"}}, "transform": [{"filter": {"selection": "selector196"}}]}, {"mark": "bar", "encoding": {"color": {"type": "nominal", "field": "Publisher"}, "opacity": {"condition": {"value": 1, "selection": "selector197"}, "value": 0.2}, "x": {"type": "quantitative", "field": "sum_of_global_sales", "title": "Total Global Sales (USD, millions)"}, "y": {"type": "nominal", "field": "Publisher", "sort": "-x"}}, "selection": {"selector197": {"type": "multi", "fields": ["Publisher"], "empty": "none"}}, "title": "Sales by Top 10 Publishers for Selected Genre", "transform": [{"filter": {"selection": "selector196"}}, {"aggregate": [{"op": "sum", "field": "Global_Sales", "as": "sum_of_global_sales"}], "groupby": ["Publisher"]}, {"window": [{"op": "rank", "field": "sum_of_global_sales", "as": "rank"}], "sort": [{"field": "sum_of_global_sales", "order": "descending"}]}, {"filter": "(datum.rank < 10)"}]}, {"mark": {"type": "text", "dx": 0, "dy": 0, "font": "monospace", "size": 20}, "encoding": {"color": {"type": "nominal", "field": "Publisher"}, "text": {"type": "nominal", "field": "Publisher"}, "y": {"type": "nominal", "axis": {"domainOpacity": 0, "grid": false, "labels": false}, "field": "Publisher", "title": ""}}, "transform": [{"filter": {"selection": "selector197"}}]}, {"mark": {"type": "point", "width": 2}, "encoding": {"color": {"type": "nominal", "field": "Publisher"}, "x": {"type": "ordinal", "field": "Year"}, "y": {"type": "quantitative", "aggregate": "sum", "field": "Global_Sales", "title": "Total Global Sales (USD, millions)"}}, "selection": {"selector198": {"type": "interval", "encodings": ["x"]}}, "title": "Global Sales over Time for Selected Publishers", "transform": [{"filter": {"selection": "selector196"}}, {"filter": {"selection": "selector197"}}]}, {"mark": "bar", "encoding": {"color": {"type": "nominal", "field": "Name"}, "opacity": {"condition": {"value": 1, "selection": "selector199"}, "value": 0.2}, "x": {"type": "quantitative", "field": "sum_of_global_sales", "title": "Total Global Sales (USD, millions)"}, "y": {"type": "nominal", "field": "Name", "sort": "-x"}}, "selection": {"selector199": {"type": "multi", "fields": ["Name"], "empty": "none"}}, "title": "Top 10 Games for Selected Publishers and Time Range", "transform": [{"filter": {"selection": "selector196"}}, {"filter": {"selection": "selector197"}}, {"filter": {"selection": "selector198"}}, {"aggregate": [{"op": "sum", "field": "Global_Sales", "as": "sum_of_global_sales"}], "groupby": ["Name"]}, {"window": [{"op": "rank", "field": "sum_of_global_sales", "as": "rank"}], "sort": [{"field": "sum_of_global_sales", "order": "descending"}]}, {"filter": "(datum.rank < 10)"}]}, {"mark": {"type": "text", "dx": 0, "dy": 0, "font": "monospace", "size": 20}, "encoding": {"color": {"type": "nominal", "field": "Name"}, "text": {"type": "nominal", "field": "Name"}, "y": {"type": "nominal", "axis": {"domainOpacity": 0, "grid": false, "labels": false}, "field": "Name", "title": ""}}, "transform": [{"filter": {"selection": "selector199"}}]}, {"mark": "bar", "encoding": {"color": {"type": "nominal", "field": "Name"}, "x": {"type": "quantitative", "field": "sum_of_global_sales", "title": "Total Global Sales (USD, millions)"}, "y": {"type": "nominal", "field": "Platform", "sort": "-x", "title": "Platform"}}, "title": "Top Platforms for Selected Games", "transform": [{"filter": {"selection": "selector196"}}, {"filter": {"selection": "selector197"}}, {"filter": {"selection": "selector198"}}, {"filter": {"selection": "selector199"}}, {"aggregate": [{"op": "sum", "field": "Global_Sales", "as": "sum_of_global_sales"}], "groupby": ["Platform", "Name"]}, {"window": [{"op": "rank", "field": "sum_of_global_sales", "as": "rank"}], "sort": [{"field": "sum_of_global_sales", "order": "descending"}]}, {"filter": "(datum.rank < 10)"}]}], "data": {"url": "https://raw.githubusercontent.com/6859-sp21/a4-video-game-sales/main/vgsales_clean_2.json"}, "$schema": "https://vega.github.io/schema/vega-lite/v4.8.1.json"};
var embedOpt = {"mode": "vega-lite"};
function showError(el, error){
el.innerHTML = ('<div class="error" style="color:red;">'
+ '<p>JavaScript Error: ' + error.message + '</p>'
+ "<p>This usually means there's a typo in your chart specification. "
+ "See the javascript console for the full traceback.</p>"
+ '</div>');
throw error;
}
const el = document.getElementById('vis');
vegaEmbed("#vis", spec, embedOpt)
.catch(error => showError(el, error));
})(vegaEmbed);
</script>
<script>
//Get the button
var mybutton = document.getElementById("myBtn");
// When the user scrolls down 20px from the top of the document, show the button
window.onscroll = function() {scrollFunction()};
function scrollFunction() {
if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) {
mybutton.style.display = "block";
} else {
mybutton.style.display = "none";
}
}
// When the user clicks on the button, scroll to the top of the document
function topFunction() {
document.body.scrollTop = 0;
document.documentElement.scrollTop = 0;
}
</script>
</body>
</html>