-
Notifications
You must be signed in to change notification settings - Fork 1
/
sectorinvest.html
119 lines (109 loc) · 3.91 KB
/
sectorinvest.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
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="js/d3.v3.min.js"></script>
<script src="js/crossfilter.min.js"></script>
<script src="js/dc.min.js"></script>
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/colorbrewer.js"></script>
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/dc.css" rel="stylesheet">
<link href="css/style (2).css" rel="stylesheet">
<link href="css/font-awesome.min.css" rel="stylesheet">
<link href="css/main.css" rel="stylesheet">
<title>Sectorwise Investment Proposal</title>
</head>
<nav class="menu" id="theMenu">
<div class="menu-wrap">
<h1 class="logo"><a href="index.html#home">HOME</a></h1>
<i class="fa fa-arrow-right menu-close"></i>
<a href="index.html">Home</a>
<a href="dc.html">GSDP of State</a>
<a href="gvis.html">Google Visualisation</a>
<a href="stateinvest.html">Statewise Investment Proposal</a>
<a href="sectorinvest.html">Sectorwise Investment Proposal</a>
<a href="homeasset.html">2013 Census Home Asset</a>
<a href="districtcrime.html">Districtwise IPC crimes in 2013</a>
<a href="statecrop.html">Statewise Crop Production</a>
<a href="kaggletitanic.html">Kaggle Titanic Data</a>
<a href="#contact">Contact</a>
<a href="#"><i class="fa fa-facebook"></i></a>
<a href="#"><i class="fa fa-twitter"></i></a>
<a href="#"><i class="fa fa-dribbble"></i></a>
<a href="#"><i class="fa fa-envelope"></i></a>
</div>
<!-- Menu button -->
<div id="menuToggle"><i class="fa fa-bars"></i></div>
</nav>
<div class="container-fluid">
<div class="row-fluid">
<div class="col-md-12">
<div class="col-md-5" id="bar2"><h1>Sectorwise Split</h1></div>
<div class="col-md-7">
<div class="row-fluid">
<div class="col-md-7" id="bar"><h1>Investments in Cr</h1></div>
<div class="row-fluid">
<div class="col-md-7" id="bar3"><h1>No. of Investments</h1></div>
</div></div></div></div>
</div>
</div>
<script>
var parseDate = d3.time.format("%Y").parse;
var data=d3.csv("data/sectorinvest.csv", function(error, data){
data.forEach(function(d) {
d.year=parseDate(d.Year);
d.nos=d3.round(d.Nos);
d.inv=d3.round(d.Inv);
});
var ndx=crossfilter(data);
var all = ndx.groupAll();
var timeDim = ndx.dimension(function(d){return d.year;});
var inv = timeDim.group().reduceSum(dc.pluck('Inv'));
//Barchart of Proposed Investment
var invbarchart = dc.barChart("#bar");
var minDate = timeDim.bottom(1)[0].year;
var maxDate = timeDim.top(1)[0].year;
invbarchart.xUnits(function(){return 7;}); //manually setting bar width
invbarchart
.width(550).height(350)
.dimension(timeDim)
.group(inv)
.elasticY(true)
.x(d3.time.scale().domain([minDate,maxDate]))
.margins({top: 10, left: 80, right: 20, bottom: 40});
//Rowchart of Statewise split
var stateDim = ndx.dimension(function(d){return d.Indname;});
var stat_tot = stateDim.group().reduceSum(function(d) { return d.Inv; });
var statebar = dc.rowChart("#bar2");
statebar
.margins({ top: 10, left: 10, right: 10, bottom: 120})
.width(490).height(760)
.dimension(stateDim)
.transitionDuration(500)
.group(stat_tot)
.elasticX(true)
.ordering(function(d){return -d.value;})
.turnOnControls()
.colors('purple')
.legend(dc.legend().x(960).y(120).gap(15))
.colorAccessor(function (d) {
return d.value;
});
//Barchart of yearly Nos
var gdpbarchart = dc.barChart("#bar3");
var nos = timeDim.group().reduceSum(dc.pluck('Nos'));
gdpbarchart.xUnits(function(){return 7;}); //manually setting bar width
gdpbarchart
.width(550).height(350)
.dimension(timeDim)
.group(nos)
.elasticY(true)
.x(d3.time.scale().domain([minDate,maxDate]))
.margins({top: 10, left: 80, right: 20, bottom: 40});
dc.renderAll();
});
</script>
<script src="js/main.js"></script>