-
Notifications
You must be signed in to change notification settings - Fork 27
/
Fund_AreaChart_3yrs.html
441 lines (357 loc) · 14.5 KB
/
Fund_AreaChart_3yrs.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
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<title>Fund Analytics</title>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet"
target="_blank" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
<!-- Optional theme -->
<link rel="stylesheet"
target="_blank" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap-theme.min.css">
<!-- Custom Fonts -->
<link
target="_blank" href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css"
rel="stylesheet">
<!-- Custom CSS -->
<link target="_blank" href="css/sb-admin.css" rel="stylesheet">
<script src="http://d3js.org/d3.v3.min.js"></script>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<style>
svg {
font: 10px sans-serif;
}
.area {
fill: steelblue;
clip-path: url(#clip);
}
.axis path,
.axis line {
fill: none;
stroke: #000;
shape-rendering: crispEdges;
}
.brush .extent {
stroke: #fff;
fill-opacity: .125;
shape-rendering: crispEdges;
}
</style>
</head>
<body>
<div id="wrapper">
<!-- Navigation Start-->
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="index.html"> Mutual Fund Predictive Analytics</a>
</div>
<!-- Top Menu Items -->
<ul class="nav navbar-right top-nav">
<li>
<a target="_blank" href="https://github.com/rupeshmore85/cs109_Fund_Analytics/blob/master/README.md">
Python Process Book</a>
</li>
<li>
<a target="_blank" href="https://github.com/rupeshmore85/cs109_Fund_Analytics/tree/master/Fund_Data"> Fund Data</a>
</li>
<li>
<a target="_blank" href="https://www.youtube.com/watch?v=ip4pNSbnFpg&feature=youtu.be"> Screen Cast</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" style="color: white"> Contact Us <i class="fa fa-envelope"></i> <b class="caret"></b></a>
<ul class="dropdown-menu message-dropdown">
<li class="message-preview">
<a href="MAILTO:[email protected]">
<div class="media">
<span class="pull-left">
<img class="media-object" src="/img/rupesh.jpg" alt="Rupesh" height="50" width="50">
</span>
<div class="media-body">
<h5 class="media-heading"><strong>Rupesh More</strong>
</h5>
<p>[email protected]</p>
</div>
</div>
</a>
</li>
<li class="message-preview">
<a href="MAILTO:[email protected]">
<div class="media">
<span class="pull-left">
<img class="media-object" src="/img/ashwini.jpg" alt="Ashwini" height="50" width="50">
</span>
<div class="media-body">
<h5 class="media-heading"><strong>Ashwini Patil</strong>
</h5>
<p>[email protected]</p>
</div>
</div>
</a>
</li>
</ul>
</li>
</ul>
<!-- Sidebar Menu Items - These collapse to the responsive navigation menu on small screens -->
<div class="collapse navbar-collapse navbar-ex1-collapse">
<ul class="nav navbar-nav side-nav">
<li class="active">
<a href="index.html"><i class="fa fa-fw fa-home"></i> Home</a>
</li>
<li>
<a href="RandomForest.html"><i class="fa fa-fw fa-tree"></i> Random Forest Classifier</a>
</li>
<li>
<a href="featureImp.html"><i class="fa fa-fw fa-location-arrow"></i> Feature Importance</a>
</li>
<li>
<a href="javascript:;" data-toggle="collapse" data-target="#demo_3"><i class="fa fa-fw fa-bar-chart-o"></i> 3 Years Investment<i class="fa fa-fw fa-caret-down"></i></a>
<ul id="demo_3" class="collapse in">
<li class="active">
<a href="Top3yrsFund.html">Top Performing Funds</a>
</li>
<li>
<a href="Fund_AreaChart_3yrs.html">Top Funds Area Chart</a>
</li>
<li>
<a href="Portfolio_3yrs.html">Top Fund Portfolio</a>
</li>
</ul>
</li>
<li>
<a href="javascript:;" data-toggle="collapse" data-target="#demo_5"><i class="fa fa-fw fa-bar-chart-o"></i> 5 Years Investment<i class="fa fa-fw fa-caret-down"></i></a>
<ul id="demo_5" class="collapse">
<li class="active">
<a href="Top5yrsFund.html">Top Performing Funds</a>
</li>
<li>
<a href="Fund_AreaChart_5yrs.html">Top Funds Area Chart</a>
</li>
<li>
<a href="Portfolio_5yrs.html">Top Fund Portfolio</a>
</li>
</ul>
</li>
<li>
<a href="javascript:;" data-toggle="collapse" data-target="#demo_10"><i class="fa fa-fw fa-bar-chart-o"></i> 10 Years Investment<i class="fa fa-fw fa-caret-down"></i></a>
<ul id="demo_10" class="collapse">
<li class="active">
<a href="Top10yrsFund.html">Top Performing Funds</a>
</li>
<li>
<a href="Fund_AreaChart_10yrs.html">Top Funds Area Chart</a>
</li>
<li>
<a href="Portfolio_10yrs.html">Top Fund Portfolio</a>
</li>
</ul>
</li>
<li>
<a href="Poor_fund.html"><i class="fa fa-fw fa-file"></i> Poor Performing Funds</a>
</li>
<li>
<a href="ExpenseRatio.html"><i class="fa fa-fw fa-usd"></i>Expense Ratio Vs Return</a>
</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</nav>
<!-- Navigation ends copy till this line to all pages -->
<div id="page-wrapper">
<div class="container-fluid">
<!-- Page Heading -->
<div class="row">
<div class="col-lg-12">
<h3 class="page-header">Area Chart for Top Performing Funds for 3 years Investment
</h3>
</div>
</div>
<!-- /.row -->
<div class="row">
<div class="col-lg-12">
<div class="alert">
We have randomly selected 5 funds from the set of predicted top performing funds for 3 years. We can see their historical NAV values using Area Chart.
Click on a Fun Ticker button to view its historical NAV.
This chart is developed using interactive <a href="http://d3js.org/"> <b>D3 visualization </b> </a>. We can select the draggable area present at the bottom of chart
to view the data for the selective time-frame.
</div>
</div>
</div>
<!-- /.row -->
<!-- Charts Section -->
<div class="row">
<div class="col-md-1">
<button id="FAVAX" type="button" class="btn btn-info">FAVAX</button>
<br><br>
<button id="PIXAX" type="button" class="btn btn-info">PIXAX</button>
<br><br>
<button id="PSPTX" type="button" class="btn btn-info">PSPTX</button>
<br><br>
<button id="PSTKX" type="button" class="btn btn-info">PSTKX</button>
<br><br>
<button id="VQNPX" type="button" class="btn btn-info">VQNPX</button>
</div>
<!-- Plot for 3 years investment -->
<div class="col-md-11">
<div class="panel panel-info">
<div class="panel-heading">
<h3 class="panel-title">
<i class="fa fa-line-chart"></i> Fund Historical NAV values
</h3>
</div>
<div class="panel-body">
<div class="flot-chart" id="d3AreaChart" >
</div>
</div>
</div>
</div>
</div>
</div>
<!-- /.container-fluid -->
</div>
<!-- /#page-wrapper -->
</div>
<!-- /#wrapper -->
<!-- jQuery -->
<!-- Optional: Include the jQuery library -->
<script
src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<!-- Latest compiled and minified JavaScript -->
<script
src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script>
<script>
$( document ).ready(function() {
// Handler for .ready() called.
showAreaChart("FAVAX");
});
$( "#FAVAX" ).click(function() {
showAreaChart("FAVAX");
});
$( "#PSTKX" ).click(function() {
showAreaChart("PSTKX");
});
$( "#PSPTX" ).click(function() {
showAreaChart("PSPTX");
});
$( "#PIXAX" ).click(function() {
showAreaChart("PIXAX");
});
$( "#VQNPX" ).click(function() {
showAreaChart("VQNPX");
});
function showAreaChart(ticker){
d3.selectAll("svg").remove();
var margin = {top: 10, right: 10, bottom: 100, left: 40},
margin2 = {top: 330, right: 10, bottom: 20, left: 40},
width = 960 - margin.left - margin.right,
height = 400 - margin.top - margin.bottom,
height2 = 400 - margin2.top - margin2.bottom;
var parseDate = d3.time.format("%_d-%b-%Y").parse;
var x = d3.time.scale().range([0, width]),
x2 = d3.time.scale().range([0, width]),
y = d3.scale.linear().range([height, 0]),
y2 = d3.scale.linear().range([height2, 0]);
var xAxis = d3.svg.axis().scale(x).orient("bottom"),
xAxis2 = d3.svg.axis().scale(x2).orient("bottom"),
yAxis = d3.svg.axis().scale(y).orient("left");
var brush = d3.svg.brush()
.x(x2)
.on("brush", brushed);
var area = d3.svg.area()
.interpolate("monotone")
.x(function(d) { return x(d.date); })
.y0(height)
.y1(function(d) { return y(d.price); });
var area2 = d3.svg.area()
.interpolate("monotone")
.x(function(d) { return x2(d.date); })
.y0(height2)
.y1(function(d) { return y2(d.price); });
var svg = d3.select("#d3AreaChart").append("svg")
.attr("width", width + margin.left + margin.right)
.attr("height", height + margin.top + margin.bottom);
svg.append("defs").append("clipPath")
.attr("id", "clip")
.append("rect")
.attr("width", width)
.attr("height", height);
var focus = svg.append("g")
.attr("class", "focus")
.attr("transform", "translate(" + margin.left + "," + margin.top + ")");
var context = svg.append("g")
.attr("class", "context")
.attr("transform", "translate(" + margin2.left + "," + margin2.top + ")");
d3.csv("/Fund_Data/Fund_Nav/"+ticker+"_3y.csv", type, function(error, data) {
x.domain(d3.extent(data.map(function(d) { return d.date; })));
y.domain([0, d3.max(data.map(function(d) { return d.price; }))]);
x2.domain(x.domain());
y2.domain(y.domain());
focus.append("path")
.datum(data)
.attr("class", "area")
.attr("d", area);
focus.append("g")
.attr("class", "x axis")
.attr("transform", "translate(0," + height + ")")
.call(xAxis);
focus.append("g")
.attr("class", "y axis")
.call(yAxis);
focus.append("text")
.attr("x", (width / 2))
.attr("y", 2 )
.attr("text-anchor", "middle")
.style("font-size", "12px")
.style("text-decoration", "underline")
.text(ticker+" Nav for 10 Years ");
context.append("path")
.datum(data)
.attr("class", "area")
.attr("d", area2);
context.append("g")
.attr("class", "x axis")
.attr("transform", "translate(0," + height2 + ")")
.call(xAxis2);
context.append("g")
.attr("class", "x brush")
.call(brush)
.selectAll("rect")
.attr("y", -6)
.attr("height", height2 + 7);
context.append("text")
.attr("x", (width / 2))
.attr("y", 2 )
.attr("text-anchor", "middle")
.style("font-size", "12px")
.style("text-decoration", "underline")
.text("Draggable Area");
});
function brushed() {
x.domain(brush.empty() ? x2.domain() : brush.extent());
focus.select(".area").attr("d", area);
focus.select(".x.axis").call(xAxis);
}
function type(d) {
d.date = parseDate(d.date);
d.price = +d.price;
return d;
}
}
</script>
</body>
</html>