-
Notifications
You must be signed in to change notification settings - Fork 1
/
homeasset.html
103 lines (94 loc) · 3.48 KB
/
homeasset.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
<!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/main.css" rel="stylesheet">
<link href="css/font-awesome.min.css" rel="stylesheet">
</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-6" id="bar2"><h1>Statewise Split</h1></div>
<div class="col-md-6">
<div class="row-fluid">
<div class="col-md-6" id="bar"><h1>Asset</h1></div>
<div class="row-fluid">
<div class="col-md-6" id="ring"></div>
</div></div></div></div>
</div>
</div>
<script>
var nformat = d3.format('.2f');
var data=d3.csv("data/homeassetmelt.csv", function(error, data){
var ndx=crossfilter(data);
var stateDim = ndx.dimension(function(d){return d.State;});
var stat_tot = stateDim.group().reduceSum(function(d) { return d.household; });
var staterow = dc.rowChart("#bar2");
staterow
.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')
.colorAccessor(function (d) {
return d.value;
});
//Barchart of Asset
var assetDim = ndx.dimension(function(d){return d.Asset;});
var asset_tot = assetDim.group().reduceSum(function(d) { return d.household; });
var assetbarchart = dc.barChart("#bar");
//assetbarchart.xUnits(function(){return 9;}); //manually setting bar width
assetbarchart.xUnits(dc.units.ordinal);
assetbarchart
.width(600).height(350)
.dimension(assetDim)
.x(d3.scale.ordinal().domain(data.map(function (d) {return d.Asset; })))
.group(asset_tot)
.elasticY(true)
.margins({top: 10, left: 40, right: 20, bottom: 120})
.renderlet(function (chart) {
chart.selectAll("g.x text")
.attr('dx', '-65')
.attr('dy', '-5')
.attr('transform', "rotate(-70)");
});;
dc.renderAll();
});
</script>
<script src="js/main.js"></script>