-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
343 lines (314 loc) · 10.9 KB
/
index.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
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/main.css">
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
<script src="js/vendor/modernizr-2.6.2.min.js"></script>
<style type="text/css">
.back-link a {
color: #4ca340;
text-decoration: none;
border-bottom: 1px #4ca340 solid;
}
.back-link a:hover,
.back-link a:focus {
color: #408536;
text-decoration: none;
border-bottom: 1px #408536 solid;
}
h1 {
height: 100%;
/* The html and body elements cannot have any padding or margin. */
margin: 0;
font-size: 14px;
font-family: Impact, Charcoal, sans-serif;
color: #1c1d1e;
font-size: 3vw;
margin-bottom: 3px;
}
h2 {
color: #fff;
font-family: Impact, Charcoal, sans-serif;
font-size: 3vw;
font-weight: 100;
}
</style>
</head>
<body class="loading">
<div class="main">
<section id="fadeInAnim">
<div class="section-content">
<div class="copy-container-fade">
<h2> How did you $spend$ your 2018?</h2>
<p>Did you wonder how much money you spend in 2018? <strong>I did.</strong> Here is a little summary of my spendings.</p>
</div>
<img src="img/money.jpg" alt="iPhone" />
<img src="img/money_tree.jpeg" alt='inne' id='moneyTree'/>
<img src="img/coins.gif" alt='gif' id='coins'/>
</div>
</section>
<section id="revealAnim">
<div class="section-content">
<div class="copy-container">
<h2 id="titleWeek">On what day of the week do I spend the most ?</h2>
<p>It seems that friday is a pay day: <strong>I get all the money I deserve! </strong>Wednesday is a shopping spree day.</p>
<img src="img/weekdays.jpg" alt='weekdays' id='weekdays'/>
</div>
<div class="bubbleplot" data-num="0">
<div id="myDiv" class="plot" ></div>
<div class="control-row">
Operations type:
<select class="opdata">
</select>
</div>
</div>
<script>
function changePlot(type) {
if (type=='all') {
Plotly.d3.csv("https://gist.githubusercontent.com/olagacek/700cd56f36a748ef9c28383872c1f41c/raw/f045c20b8230ae527f657b7ff09a84345748c228/all_ops.csv", function(data){
plotWeekdays(data);
})
} else {
Plotly.d3.csv("https://gist.githubusercontent.com/olagacek/714b76715cafe9a8a02a6603768a90b0/raw/e47c99a0f7f3cae0c0157745cd021057ac155eec/only_outcomes.csv", function(data){
plotWeekdays(data);
})
}
}
function plotWeekdays(data) {
var x = [], y = [], standard_deviation = [], z= [];
for (var i=0; i<data.length; i++) {
row = data[i];
x.push( row['weekday'] );
y.push( row['mean_spendings'] );
if (row['mean_spendings'] > 0) {
z.push('rgb(158,202,225)')
} else {
z.push('rgb(165, 42, 42)')
}
}
var dataPlot = [
{
x: x,
y: y,
type: 'bar',
marker: {
color: z,
opacity: 0.6,
line: {
color: 'rgb(8,48,107)',
width: 1.5
}
}
}
];
var layout = {
title: 'Mean value of operations on weekdays',
font:{
family: ' Impact, Charcoal, sans-serif;'
},
showlegend: false,
xaxis: {
tickangle: -45
},
yaxis: {
zeroline: false,
gridwidth: 2
},
width: 800,
height: 600,
bargap :0.05,
paper_bgcolor: '#fffaf0',
yaxis: {
title: {
text: 'Money spent[PLN]',
font: {
size: 18,
color: '#7f7f7f'
}
}},
xaxis: {
title: {
text: 'Day of the week',
font: {
size: 18,
color: '#7f7f7f'
}
}}
};
Plotly.newPlot('myDiv', dataPlot, layout);
}
var innerContainer = document.querySelector('[data-num="0"'),
//plotEl = innerContainer.querySelector('.plot'),
countrySelector = innerContainer.querySelector('.opdata');
function assignOptions(textArray, selector) {
for (var i = 0; i < textArray.length; i++) {
var currentOption = document.createElement('option');
currentOption.text = textArray[i];
selector.appendChild(currentOption);
}
}
function updateCountry(){
if(countrySelector.value=='All operations') {
changePlot('all');
} else {
changePlot('outcomes');
} }
countrySelector.addEventListener('change', updateCountry, false);
assignOptions(['All operations', 'Only outcomes'], countrySelector);
Plotly.d3.csv("https://gist.githubusercontent.com/olagacek/700cd56f36a748ef9c28383872c1f41c/raw/f045c20b8230ae527f657b7ff09a84345748c228/all_ops.csv", function(data){
plotWeekdays(data);
})
</script>
</div>
</section>
<section id="betweenSlidesAnimStart">
<div class="section-content">
<div class="copy-container">
<h2>3 things I could buy for the money spent on the coffee</h2>
<p>I love coffee, but what if I could save the money I spend on it and have something else? Like a few day trip to Paris,
new set of headphones, smart watch or just keep the money in my pocket?.</p>
</div>
<div class="images-container">
<img class="yellow" src="img/watch.jpeg" alt="iPhone" />
<img class="pink" src="img/bsmall.png" alt="iPhone" />
<img class="paris" src="img/eiff5.jpg" alt="paris" />
</div>
</div>
</section>
<section id="betweenSlidesAnimEnd">
<div class="fake-content">
<div class="images-container">
<img class="green" src="img/donald.gif" alt="iPhone" />
</div>
</div>
<div class="section-content">
<div class="copy-container">
<h2>Where did all my money go?</h2>
<p>So, where did my money go? Mainly it was spend on my apartment rent and food :( </p>
</div>
<div class="images-container">
<div class="bubbleplot2" data-num="1">
<div class="control-row">
Operations month:
<select class="opdata">
</select>
<div id="myDiv3" class="plot" ></div>
</div>
</div>
<script>
function changePlotCategories(month) {
if (month=='Whole year') {
Plotly.d3.csv("https://gist.githubusercontent.com/olagacek/4a3c692fa1e319450a3afb233b816b55/raw/8e6d183f1683cd0c48bfb9f8f46805d02650b349/categorized.csv", function(data){
plotCategories(data);
})
} else {
Plotly.d3.csv("https://gist.githubusercontent.com/olagacek/4bad9f88088f157a596e96d9a544048d/raw/2b5f5c64f27d3f756533de92cf5119d3ba1de651/categorized_month.csv", function(data){
console.log(month)
data = data.filter( function(el) {
return el['month'] == month;
})
console.log(data);
plotCategories(data);
})
}
}
function plotCategories(data) {
var x = [], y = [], standard_deviation = [], z= [];
data = data.sort(function(a, b) {
return parseFloat(a['Kwota']) - parseFloat(b['Kwota']);
})
for (var i=0; i<data.length; i++) {
row = data[i];
x.push( row['category'] );
y.push( -row['Kwota'] );
}
var dataPlot = [
{
x: x,
y: y,
type: 'bar',
marker: {
color: 'rgb(158,202,225)',
opacity: 0.6,
line: {
color: 'rgb(8,48,107)',
width: 1.5
}}
}
];
var layout = {
title: 'Sum of operations per category',
font:{
family: ' Impact, Charcoal, sans-serif;'
},
showlegend: false,
xaxis: {
tickangle: -45
},
yaxis: {
zeroline: false,
gridwidth: 2
},
width: 800,
height: 600,
bargap :0.05,
paper_bgcolor: '#fffaf0',
yaxis: {
title: {
text: 'Money spent[PLN]',
font: {
size: 18,
color: '#7f7f7f'
}
}},
xaxis: {
title: {
text: 'Category',
font: {
size: 18,
color: '#7f7f7f'
}
}}
};
Plotly.newPlot('myDiv3', dataPlot, layout);
}
Plotly.d3.csv("https://gist.githubusercontent.com/olagacek/4a3c692fa1e319450a3afb233b816b55/raw/8e6d183f1683cd0c48bfb9f8f46805d02650b349/categorized.csv", function(data){
var innerContainer = document.querySelector('[data-num="1"'),
countrySelector = innerContainer.querySelector('.opdata');
function assignOptions(textArray, selector) {
for (var i = 0; i < textArray.length; i++) {
var currentOption = document.createElement('option');
currentOption.text = textArray[i];
selector.appendChild(currentOption);
}
}
function updateCountry(){
changePlotCategories(countrySelector.value)
}
var x = ["Whole year", "January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December"];
countrySelector.addEventListener('change', updateCountry, false);
assignOptions(x, countrySelector);
plotCategories(data);
})
</script>
</div>
</div>
</section>
</div>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="js/vendor/jquery-1.9.1.min.js"><\/script>')</script>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script type="text/javascript" src="js/onepagescroll/jquery.onepage-scroll.js"></script>
<link href='js/onepagescroll/onepage-scroll.css' rel='stylesheet' type='text/css'>
<script src="js/main.js"></script>
</body>
</html>