-
Notifications
You must be signed in to change notification settings - Fork 1
/
sortgr.js
154 lines (123 loc) · 36.7 KB
/
sortgr.js
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
var datafg=[
[{'letter':'AE','frequency':0.52},{'letter':'AG','frequency':0.54},{'letter':'AR','frequency':0.57},{'letter':'BT','frequency':0.57},{'letter':'CE','frequency':0.59},{'letter':'CH','frequency':0.62},{'letter':'CSE','frequency':0.64},{'letter':'ECE','frequency':0.68},{'letter':'EE','frequency':0.53},{'letter':'GG','frequency':0.56},{'letter':'HS','frequency':0.61},{'letter':'IM','frequency':0.62},{'letter':'MA','frequency':0.53},{'letter':'ME','frequency':0.59},{'letter':'MI','frequency':0.5},{'letter':'MT','frequency':0.54},{'letter':'NA','frequency':0.51},{'letter':'PH','frequency':0.57}],
[{'letter':'AE','frequency':0.57},{'letter':'AG','frequency':0.53},{'letter':'AR','frequency':0.56},{'letter':'BT','frequency':0.63},{'letter':'CE','frequency':0.54},{'letter':'CH','frequency':0.54},{'letter':'CSE','frequency':0.55},{'letter':'ECE','frequency':0.63},{'letter':'EE','frequency':0.57},{'letter':'GG','frequency':0.62},{'letter':'HS','frequency':0.56},{'letter':'IM','frequency':0.59},{'letter':'MA','frequency':0.55},{'letter':'ME','frequency':0.53},{'letter':'MI','frequency':0.47},{'letter':'MT','frequency':0.55},{'letter':'NA','frequency':0.52},{'letter':'PH','frequency':0.57}],
[{'letter':'AE','frequency':0.63},{'letter':'AG','frequency':0.66},{'letter':'AR','frequency':0.64},{'letter':'BT','frequency':0.73},{'letter':'CE','frequency':0.67},{'letter':'CH','frequency':0.65},{'letter':'CSE','frequency':0.61},{'letter':'ECE','frequency':0.7},{'letter':'EE','frequency':0.65},{'letter':'GG','frequency':0.68},{'letter':'HS','frequency':0.71},{'letter':'IM','frequency':0.63},{'letter':'MA','frequency':0.63},{'letter':'ME','frequency':0.66},{'letter':'MI','frequency':0.54},{'letter':'MT','frequency':0.6},{'letter':'NA','frequency':0.58},{'letter':'PH','frequency':0.66}],
[{'letter':'AE','frequency':0.67},{'letter':'AG','frequency':0.6},{'letter':'AR','frequency':0.62},{'letter':'BT','frequency':0.59},{'letter':'CE','frequency':0.6},{'letter':'CH','frequency':0.63},{'letter':'CSE','frequency':0.58},{'letter':'ECE','frequency':0.71},{'letter':'EE','frequency':0.62},{'letter':'GG','frequency':0.7},{'letter':'HS','frequency':0.68},{'letter':'IM','frequency':0.55},{'letter':'MA','frequency':0.62},{'letter':'ME','frequency':0.63},{'letter':'MI','frequency':0.5},{'letter':'MT','frequency':0.6},{'letter':'NA','frequency':0.51},{'letter':'PH','frequency':0.6}],
[{'letter':'AE','frequency':0.56},{'letter':'AG','frequency':0.53},{'letter':'AR','frequency':0.69},{'letter':'BT','frequency':0.63},{'letter':'CE','frequency':0.56},{'letter':'CH','frequency':0.67},{'letter':'CSE','frequency':0.78},{'letter':'ECE','frequency':0.67},{'letter':'EE','frequency':0.53},{'letter':'GG','frequency':0.6},{'letter':'HS','frequency':0.73},{'letter':'IM','frequency':0.59},{'letter':'MA','frequency':0.69},{'letter':'ME','frequency':0.64},{'letter':'MI','frequency':0.45},{'letter':'MT','frequency':0.56},{'letter':'NA','frequency':0.45},{'letter':'PH','frequency':0.71}],
[{'letter':'AE','frequency':0.71},{'letter':'AG','frequency':0.74},{'letter':'AR','frequency':0.71},{'letter':'BT','frequency':0.67},{'letter':'CE','frequency':0.69},{'letter':'CH','frequency':0.78},{'letter':'CSE','frequency':0.71},{'letter':'ECE','frequency':0.73},{'letter':'EE','frequency':0.74},{'letter':'GG','frequency':0.76},{'letter':'HS','frequency':0.79},{'letter':'IM','frequency':0.7},{'letter':'MA','frequency':0.7},{'letter':'ME','frequency':0.73},{'letter':'MI','frequency':0.66},{'letter':'MT','frequency':0.58},{'letter':'NA','frequency':0.62},{'letter':'PH','frequency':0.69}],
[{'letter':'AE','frequency':0.71},{'letter':'AG','frequency':0.82},{'letter':'AR','frequency':0.81},{'letter':'BT','frequency':0.79},{'letter':'CE','frequency':0.76},{'letter':'CH','frequency':0.79},{'letter':'CSE','frequency':0.77},{'letter':'ECE','frequency':0.78},{'letter':'EE','frequency':0.78},{'letter':'GG','frequency':0.73},{'letter':'HS','frequency':0.81},{'letter':'IM','frequency':0.77},{'letter':'MA','frequency':0.79},{'letter':'ME','frequency':0.78},{'letter':'MI','frequency':0.7},{'letter':'MT','frequency':0.7},{'letter':'NA','frequency':0.73},{'letter':'PH','frequency':0.72}]
];
var payf=[[{'letter':'AE','frequency':0.103448275862069},{'letter':'AG','frequency':0.32},{'letter':'AR','frequency':0.14},{'letter':'BT','frequency':0.2},{'letter':'CE','frequency':0.186046511627907},{'letter':'CH','frequency':0.159090909090909},{'letter':'CSE','frequency':0.1375},{'letter':'ECE','frequency':0.16},{'letter':'EE','frequency':0.152542372881356},{'letter':'GG','frequency':0.173913043478261},{'letter':'HS','frequency':0.1875},{'letter':'IM','frequency':0.172413793103448},{'letter':'MA','frequency':0.133333333333333},{'letter':'ME','frequency':0.108695652173913},{'letter':'MI','frequency':0.0625},{'letter':'MT','frequency':0.153846153846154},{'letter':'NA','frequency':0.2},{'letter':'PH','frequency':0.538461538461538}],[{'letter':'AE','frequency':0},{'letter':'AG','frequency':0},{'letter':'AR','frequency':0.06},{'letter':'BT','frequency':0.0666666666666667},{'letter':'CE','frequency':0},{'letter':'CH','frequency':0},{'letter':'CSE','frequency':0},{'letter':'ECE','frequency':0.04},{'letter':'EE','frequency':0.0169491525423729},{'letter':'GG','frequency':0},{'letter':'HS','frequency':0},{'letter':'IM','frequency':0.0344827586206897},{'letter':'MA','frequency':0},{'letter':'ME','frequency':0.0108695652173913},{'letter':'MI','frequency':0.03125},{'letter':'MT','frequency':0.0769230769230769},{'letter':'NA','frequency':0.0666666666666667},{'letter':'PH','frequency':0.0384615384615385}],[{'letter':'AE','frequency':0.0344827586206897},{'letter':'AG','frequency':0.04},{'letter':'AR','frequency':0.08},{'letter':'BT','frequency':0},{'letter':'CE','frequency':0.0465116279069767},{'letter':'CH','frequency':0.0681818181818182},{'letter':'CSE','frequency':0.0375},{'letter':'ECE','frequency':0.02},{'letter':'EE','frequency':0.0847457627118644},{'letter':'GG','frequency':0.0434782608695652},{'letter':'HS','frequency':0},{'letter':'IM','frequency':0.0689655172413793},{'letter':'MA','frequency':0.0666666666666667},{'letter':'ME','frequency':0.0543478260869565},{'letter':'MI','frequency':0.03125},{'letter':'MT','frequency':0.0769230769230769},{'letter':'NA','frequency':0.0666666666666667},{'letter':'PH','frequency':0.0769230769230769}],[{'letter':'AE','frequency':0.275862068965517},{'letter':'AG','frequency':0.16},{'letter':'AR','frequency':0.18},{'letter':'BT','frequency':0.0666666666666667},{'letter':'CE','frequency':0.116279069767442},{'letter':'CH','frequency':0.113636363636364},{'letter':'CSE','frequency':0.0375},{'letter':'ECE','frequency':0.04},{'letter':'EE','frequency':0.135593220338983},{'letter':'GG','frequency':0.217391304347826},{'letter':'HS','frequency':0},{'letter':'IM','frequency':0.103448275862069},{'letter':'MA','frequency':0.0333333333333333},{'letter':'ME','frequency':0.108695652173913},{'letter':'MI','frequency':0.15625},{'letter':'MT','frequency':0.0769230769230769},{'letter':'NA','frequency':0.166666666666667},{'letter':'PH','frequency':0.0769230769230769}],[{'letter':'AE','frequency':0.413793103448276},{'letter':'AG','frequency':0.24},{'letter':'AR','frequency':0.24},{'letter':'BT','frequency':0.4},{'letter':'CE','frequency':0.348837209302326},{'letter':'CH','frequency':0.25},{'letter':'CSE','frequency':0.0625},{'letter':'ECE','frequency':0.24},{'letter':'EE','frequency':0.23728813559322},{'letter':'GG','frequency':0.304347826086957},{'letter':'HS','frequency':0.125},{'letter':'IM','frequency':0.310344827586207},{'letter':'MA','frequency':0.3},{'letter':'ME','frequency':0.315217391304348},{'letter':'MI','frequency':0.46875},{'letter':'MT','frequency':0.384615384615385},{'letter':'NA','frequency':0.233333333333333},{'letter':'PH','frequency':0.153846153846154}],[{'letter':'AE','frequency':0.103448275862069},{'letter':'AG','frequency':0.2},{'letter':'AR','frequency':0.18},{'letter':'BT','frequency':0.2},{'letter':'CE','frequency':0.116279069767442},{'letter':'CH','frequency':0.318181818181818},{'letter':'CSE','frequency':0.2375},{'letter':'ECE','frequency':0.28},{'letter':'EE','frequency':0.203389830508475},{'letter':'GG','frequency':0.173913043478261},{'letter':'HS','frequency':0.3125},{'letter':'IM','frequency':0.172413793103448},{'letter':'MA','frequency':0.233333333333333},{'letter':'ME','frequency':0.195652173913043},{'letter':'MI','frequency':0.21875},{'letter':'MT','frequency':0.115384615384615},{'letter':'NA','frequency':0.133333333333333},{'letter':'PH','frequency':0.0384615384615385}],[{'letter':'AE','frequency':0},{'letter':'AG','frequency':0.04},{'letter':'AR','frequency':0.06},{'letter':'BT','frequency':0},{'letter':'CE','frequency':0.116279069767442},{'letter':'CH','frequency':0.0681818181818182},{'letter':'CSE','frequency':0.3375},{'letter':'ECE','frequency':0.18},{'letter':'EE','frequency':0.135593220338983},{'letter':'GG','frequency':0.0434782608695652},{'letter':'HS','frequency':0.3125},{'letter':'IM','frequency':0.137931034482759},{'letter':'MA','frequency':0.2},{'letter':'ME','frequency':0.152173913043478},{'letter':'MI','frequency':0.03125},{'letter':'MT','frequency':0.0769230769230769},{'letter':'NA','frequency':0.133333333333333},{'letter':'PH','frequency':0.0384615384615385}],[{'letter':'AE','frequency':0.0689655172413793},{'letter':'AG','frequency':0},{'letter':'AR','frequency':0.06},{'letter':'BT','frequency':0.0666666666666667},{'letter':'CE','frequency':0.0697674418604651},{'letter':'CH','frequency':0.0227272727272727},{'letter':'CSE','frequency':0.15},{'letter':'ECE','frequency':0},{'letter':'EE','frequency':0.04},{'letter':'GG','frequency':0.0338983050847458},{'letter':'HS','frequency':0.0434782608695652},{'letter':'IM','frequency':0.0625},{'letter':'MA','frequency':0},{'letter':'ME','frequency':0.0333333333333333},{'letter':'MI','frequency':0.0543478260869565},{'letter':'MT','frequency':0},{'letter':'NA','frequency':0.0384615384615385},{'letter':'PH','frequency':0}]];
var payproshno=["Placements don't matter to me.","I am okay with a package below 6 lpa.","I need a package between 6 to 8 lpa to be happy.","I need a package between 8 to 10 lpa to be happy.","I want a package between 10 to 15 lpa to be happy.","I want a package between 15 to 20 lpa to be happy.","I want a package between 20 to 50 lpa to be happy.","I want a package above 50 lpa to be happy."]
var socii=[[{"letter":"No Society","frequency":0.57},{"letter":"Encore","frequency":0.59},{"letter":"Pravaah","frequency":0.46},{"letter":"Druheen","frequency":0.58},{"letter":"Prasthanam","frequency":0.51},{"letter":"Communique","frequency":0.49},{"letter":"AIESEC","frequency":0.66},{"letter":"KRSSG","frequency":0.68},{"letter":"TFPS","frequency":0.68},{"letter":"Spectra","frequency":0.59},{"letter":"Quiz Club","frequency":0.59},{"letter":"Bclub","frequency":0.61},{"letter":"Ecell","frequency":0.53},{"letter":"DebSoc","frequency":0.57},{"letter":"TDS","frequency":0.54},{"letter":"ETMS","frequency":0.45},{"letter":"WTMS","frequency":0.48},{"letter":"Awaaz","frequency":0.6},{"letter":"TSA","frequency":0.68},{"letter":"GYWS","frequency":0.48},{"letter":"KDAG","frequency":0.48},{"letter":"TRS","frequency":0.71},{"letter":"KGTS","frequency":0.47}],[{"letter":"No Society","frequency":0.57},{"letter":"Encore","frequency":0.67},{"letter":"Pravaah","frequency":0.45},{"letter":"Druheen","frequency":0.57},{"letter":"Prasthanam","frequency":0.57},{"letter":"Communique","frequency":0.5},{"letter":"AIESEC","frequency":0.62},{"letter":"KRSSG","frequency":0.62},{"letter":"TFPS","frequency":0.6},{"letter":"Spectra","frequency":0.63},{"letter":"Quiz Club","frequency":0.61},{"letter":"Bclub","frequency":0.52},{"letter":"Ecell","frequency":0.6},{"letter":"DebSoc","frequency":0.53},{"letter":"TDS","frequency":0.62},{"letter":"ETMS","frequency":0.63},{"letter":"WTMS","frequency":0.61},{"letter":"Awaaz","frequency":0.6},{"letter":"TSA","frequency":0.54},{"letter":"GYWS","frequency":0.62},{"letter":"KDAG","frequency":0.68},{"letter":"TRS","frequency":0.71},{"letter":"KGTS","frequency":0.37}],[{"letter":"No Society","frequency":0.69},{"letter":"Encore","frequency":0.73},{"letter":"Pravaah","frequency":0.73},{"letter":"Druheen","frequency":0.67},{"letter":"Prasthanam","frequency":0.68},{"letter":"Communique","frequency":0.64},{"letter":"AIESEC","frequency":0.73},{"letter":"KRSSG","frequency":0.75},{"letter":"TFPS","frequency":0.76},{"letter":"Spectra","frequency":0.73},{"letter":"Quiz Club","frequency":0.7},{"letter":"Bclub","frequency":0.7},{"letter":"Ecell","frequency":0.65},{"letter":"DebSoc","frequency":0.66},{"letter":"TDS","frequency":0.68},{"letter":"ETMS","frequency":0.64},{"letter":"WTMS","frequency":0.62},{"letter":"Awaaz","frequency":0.68},{"letter":"TSA","frequency":0.65},{"letter":"GYWS","frequency":0.75},{"letter":"KDAG","frequency":0.68},{"letter":"TRS","frequency":0.82},{"letter":"KGTS","frequency":0.55}],[{"letter":"No Society","frequency":0.65},{"letter":"Encore","frequency":0.74},{"letter":"Pravaah","frequency":0.58},{"letter":"Druheen","frequency":0.72},{"letter":"Prasthanam","frequency":0.66},{"letter":"Communique","frequency":0.61},{"letter":"AIESEC","frequency":0.67},{"letter":"KRSSG","frequency":0.67},{"letter":"TFPS","frequency":0.71},{"letter":"Spectra","frequency":0.65},{"letter":"Quiz Club","frequency":0.71},{"letter":"Bclub","frequency":0.55},{"letter":"Ecell","frequency":0.71},{"letter":"DebSoc","frequency":0.57},{"letter":"TDS","frequency":0.72},{"letter":"ETMS","frequency":0.64},{"letter":"WTMS","frequency":0.78},{"letter":"Awaaz","frequency":0.6},{"letter":"TSA","frequency":0.6},{"letter":"GYWS","frequency":0.62},{"letter":"KDAG","frequency":0.8},{"letter":"TRS","frequency":0.87},{"letter":"KGTS","frequency":0.6}],[{"letter":"No Society","frequency":0.65},{"letter":"Encore","frequency":0.68},{"letter":"Pravaah","frequency":0.54},{"letter":"Druheen","frequency":0.57},{"letter":"Prasthanam","frequency":0.56},{"letter":"Communique","frequency":0.5},{"letter":"AIESEC","frequency":0.69},{"letter":"KRSSG","frequency":0.63},{"letter":"TFPS","frequency":0.75},{"letter":"Spectra","frequency":0.63},{"letter":"Quiz Club","frequency":0.66},{"letter":"Bclub","frequency":0.73},{"letter":"Ecell","frequency":0.68},{"letter":"DebSoc","frequency":0.59},{"letter":"TDS","frequency":0.66},{"letter":"ETMS","frequency":0.74},{"letter":"WTMS","frequency":0.76},{"letter":"Awaaz","frequency":0.62},{"letter":"TSA","frequency":0.56},{"letter":"GYWS","frequency":0.68},{"letter":"KDAG","frequency":0.74},{"letter":"TRS","frequency":0.55},{"letter":"KGTS","frequency":0.6}],[{"letter":"No Society","frequency":0.73},{"letter":"Encore","frequency":0.78},{"letter":"Pravaah","frequency":0.71},{"letter":"Druheen","frequency":0.67},{"letter":"Prasthanam","frequency":0.65},{"letter":"Communique","frequency":0.61},{"letter":"AIESEC","frequency":0.8},{"letter":"KRSSG","frequency":0.76},{"letter":"TFPS","frequency":0.81},{"letter":"Spectra","frequency":0.71},{"letter":"Quiz Club","frequency":0.76},{"letter":"Bclub","frequency":0.7},{"letter":"Ecell","frequency":0.74},{"letter":"DebSoc","frequency":0.68},{"letter":"TDS","frequency":0.75},{"letter":"ETMS","frequency":0.78},{"letter":"WTMS","frequency":0.78},{"letter":"Awaaz","frequency":0.7},{"letter":"TSA","frequency":0.68},{"letter":"GYWS","frequency":0.73},{"letter":"KDAG","frequency":0.72},{"letter":"TRS","frequency":0.72},{"letter":"KGTS","frequency":0.62}],[{"letter":"No Society","frequency":0.78},{"letter":"Encore","frequency":0.82},{"letter":"Pravaah","frequency":0.78},{"letter":"Druheen","frequency":0.81},{"letter":"Prasthanam","frequency":0.72},{"letter":"Communique","frequency":0.67},{"letter":"AIESEC","frequency":0.83},{"letter":"KRSSG","frequency":0.82},{"letter":"TFPS","frequency":0.77},{"letter":"Spectra","frequency":0.89},{"letter":"Quiz Club","frequency":0.82},{"letter":"Bclub","frequency":0.74},{"letter":"Ecell","frequency":0.8},{"letter":"DebSoc","frequency":0.76},{"letter":"TDS","frequency":0.78},{"letter":"ETMS","frequency":0.8},{"letter":"WTMS","frequency":0.7},{"letter":"Awaaz","frequency":0.84},{"letter":"TSA","frequency":0.74},{"letter":"GYWS","frequency":0.81},{"letter":"KDAG","frequency":0.72},{"letter":"TRS","frequency":0.83},{"letter":"KGTS","frequency":0.7}]];
var hallii=[[{"letter":"Azad","frequency":0.57},{"letter":"HJB | JCB","frequency":0.6},{"letter":"LBS","frequency":0.55},{"letter":"LLR","frequency":0.5},{"letter":"MMM","frequency":0.61},{"letter":"MS","frequency":0.59},{"letter":"MT","frequency":0.51},{"letter":"Nehru","frequency":0.52},{"letter":"Patel","frequency":0.52},{"letter":"RK","frequency":0.61},{"letter":"RP","frequency":0.63},{"letter":"SN","frequency":0.56}],[{"letter":"Azad","frequency":0.54},{"letter":"HJB | JCB","frequency":0.55},{"letter":"LBS","frequency":0.55},{"letter":"LLR","frequency":0.5},{"letter":"MMM","frequency":0.58},{"letter":"MS","frequency":0.59},{"letter":"MT","frequency":0.6},{"letter":"Nehru","frequency":0.55},{"letter":"Patel","frequency":0.53},{"letter":"RK","frequency":0.58},{"letter":"RP","frequency":0.54},{"letter":"SN","frequency":0.49}],[{"letter":"Azad","frequency":0.64},{"letter":"HJB | JCB","frequency":0.68},{"letter":"LBS","frequency":0.63},{"letter":"LLR","frequency":0.59},{"letter":"MMM","frequency":0.58},{"letter":"MS","frequency":0.62},{"letter":"MT","frequency":0.66},{"letter":"Nehru","frequency":0.57},{"letter":"Patel","frequency":0.61},{"letter":"RK","frequency":0.67},{"letter":"RP","frequency":0.66},{"letter":"SN","frequency":0.68}],[{"letter":"Azad","frequency":0.63},{"letter":"HJB | JCB","frequency":0.71},{"letter":"LBS","frequency":0.54},{"letter":"LLR","frequency":0.55},{"letter":"MMM","frequency":0.42},{"letter":"MS","frequency":0.59},{"letter":"MT","frequency":0.56},{"letter":"Nehru","frequency":0.57},{"letter":"Patel","frequency":0.62},{"letter":"RK","frequency":0.68},{"letter":"RP","frequency":0.69},{"letter":"SN","frequency":0.58}],[{"letter":"Azad","frequency":0.6},{"letter":"HJB | JCB","frequency":0.63},{"letter":"LBS","frequency":0.64},{"letter":"LLR","frequency":0.59},{"letter":"MMM","frequency":0.69},{"letter":"MS","frequency":0.61},{"letter":"MT","frequency":0.65},{"letter":"Nehru","frequency":0.63},{"letter":"Patel","frequency":0.57},{"letter":"RK","frequency":0.61},{"letter":"RP","frequency":0.64},{"letter":"SN","frequency":0.62}],[{"letter":"Azad","frequency":0.74},{"letter":"HJB | JCB","frequency":0.7},{"letter":"LBS","frequency":0.76},{"letter":"LLR","frequency":0.62},{"letter":"MMM","frequency":0.7},{"letter":"MS","frequency":0.73},{"letter":"MT","frequency":0.71},{"letter":"Nehru","frequency":0.68},{"letter":"Patel","frequency":0.72},{"letter":"RK","frequency":0.62},{"letter":"RP","frequency":0.75},{"letter":"SN","frequency":0.67}],[{"letter":"Azad","frequency":0.75},{"letter":"HJB | JCB","frequency":0.75},{"letter":"LBS","frequency":0.78},{"letter":"LLR","frequency":0.77},{"letter":"MMM","frequency":0.7},{"letter":"MS","frequency":0.75},{"letter":"MT","frequency":0.73},{"letter":"Nehru","frequency":0.72},{"letter":"Patel","frequency":0.76},{"letter":"RK","frequency":0.76},{"letter":"RP","frequency":0.81},{"letter":"SN","frequency":0.75}]];
var yii=[[{"letter":"Second Year","frequency":0.57},{"letter":"Third Year","frequency":0.5},{"letter":"Fourth Year","frequency":0.59},{"letter":"Fifth Year","frequency":0.64}],[{"letter":"Second Year","frequency":0.51},{"letter":"Third Year","frequency":0.56},{"letter":"Fourth Year","frequency":0.57},{"letter":"Fifth Year","frequency":0.56}],[{"letter":"Second Year","frequency":0.61},{"letter":"Third Year","frequency":0.64},{"letter":"Fourth Year","frequency":0.64},{"letter":"Fifth Year","frequency":0.67}],[{"letter":"Second Year","frequency":0.57},{"letter":"Third Year","frequency":0.62},{"letter":"Fourth Year","frequency":0.6},{"letter":"Fifth Year","frequency":0.64}],[{"letter":"Second Year","frequency":0.68},{"letter":"Third Year","frequency":0.59},{"letter":"Fourth Year","frequency":0.63},{"letter":"Fifth Year","frequency":0.57}],[{"letter":"Second Year","frequency":0.69},{"letter":"Third Year","frequency":0.7},{"letter":"Fourth Year","frequency":0.69},{"letter":"Fifth Year","frequency":0.75}],[{"letter":"Second Year","frequency":0.75},{"letter":"Third Year","frequency":0.76},{"letter":"Fourth Year","frequency":0.75},{"letter":"Fifth Year","frequency":0.79}]];
var gii=[[{"letter":"Bisexual M","frequency":0.44},{"letter":"Straight F","frequency":0.58},{"letter":"Straight M","frequency":0.57},{"letter":"Lesbian","frequency":0.35},{"letter":"Gay","frequency":0.57},{"letter":"Queer F","frequency":0.7},{"letter":"Queer M","frequency":0.68},{"letter":"Questioning M","frequency":0.58}],[{"letter":"Bisexual M","frequency":0.45},{"letter":"Straight F","frequency":0.58},{"letter":"Straight M","frequency":0.55},{"letter":"Lesbian","frequency":0.35},{"letter":"Gay","frequency":0.63},{"letter":"Queer F","frequency":0.65},{"letter":"Queer M","frequency":0.51},{"letter":"Questioning M","frequency":0.6}],[{"letter":"Bisexual M","frequency":0.54},{"letter":"Straight F","frequency":0.71},{"letter":"Straight M","frequency":0.63},{"letter":"Lesbian","frequency":0.52},{"letter":"Gay","frequency":0.67},{"letter":"Queer F","frequency":0.7},{"letter":"Queer M","frequency":0.58},{"letter":"Questioning M","frequency":0.72}],[{"letter":"Bisexual M","frequency":0.55},{"letter":"Straight F","frequency":0.6},{"letter":"Straight M","frequency":0.61},{"letter":"Lesbian","frequency":0.42},{"letter":"Gay","frequency":0.67},{"letter":"Queer F","frequency":0.67},{"letter":"Queer M","frequency":0.6},{"letter":"Questioning M","frequency":0.62}],[{"letter":"Bisexual M","frequency":0.7},{"letter":"Straight F","frequency":0.67},{"letter":"Straight M","frequency":0.61},{"letter":"Lesbian","frequency":0.55},{"letter":"Gay","frequency":0.65},{"letter":"Queer F","frequency":0.67},{"letter":"Queer M","frequency":0.58},{"letter":"Questioning M","frequency":0.57}],[{"letter":"Bisexual M","frequency":0.64},{"letter":"Straight F","frequency":0.73},{"letter":"Straight M","frequency":0.7},{"letter":"Lesbian","frequency":0.55},{"letter":"Gay","frequency":0.75},{"letter":"Queer F","frequency":0.72},{"letter":"Queer M","frequency":0.77},{"letter":"Questioning M","frequency":0.7}],[{"letter":"Bisexual M","frequency":0.55},{"letter":"Straight F","frequency":0.77},{"letter":"Straight M","frequency":0.77},{"letter":"Lesbian","frequency":0.57},{"letter":"Gay","frequency":0.79},{"letter":"Queer F","frequency":0.55},{"letter":"Queer M","frequency":0.75},{"letter":"Questioning M","frequency":0.78}]];
var rii=[[{"letter":"No Relationship","frequency":0.57},{"letter":"One","frequency":0.6},{"letter":"Two","frequency":0.62},{"letter":"Three or More","frequency":0.62}],[{"letter":"No Relationship","frequency":0.56},{"letter":"One","frequency":0.58},{"letter":"Two","frequency":0.56},{"letter":"Three or More","frequency":0.62}],[{"letter":"No Relationship","frequency":0.63},{"letter":"One","frequency":0.68},{"letter":"Two","frequency":0.7},{"letter":"Three or More","frequency":0.85}],[{"letter":"No Relationship","frequency":0.61},{"letter":"One","frequency":0.62},{"letter":"Two","frequency":0.56},{"letter":"Three or More","frequency":0.62}],[{"letter":"No Relationship","frequency":0.6},{"letter":"One","frequency":0.62},{"letter":"Two","frequency":0.59},{"letter":"Three or More","frequency":0.72}],[{"letter":"No Relationship","frequency":0.66},{"letter":"One","frequency":0.72},{"letter":"Two","frequency":0.71},{"letter":"Three or More","frequency":0.77}],[{"letter":"No Relationship","frequency":0.71},{"letter":"One","frequency":0.79},{"letter":"Two","frequency":0.81},{"letter":"Three or More","frequency":0.87}]];
var fii=[[{"letter":"No Friends","frequency":0.5},{"letter":"One","frequency":0.32},{"letter":"Two","frequency":0.64},{"letter":"Three","frequency":0.57},{"letter":"Four","frequency":0.6},{"letter":"Five","frequency":0.63},{"letter":"Six","frequency":0.57},{"letter":"Seven","frequency":0.52},{"letter":"Eight","frequency":0.56},{"letter":"Nine","frequency":0.61},{"letter":"Ten or More","frequency":0.56}],[{"letter":"No Friends","frequency":0.51},{"letter":"One","frequency":0.47},{"letter":"Two","frequency":0.53},{"letter":"Three","frequency":0.52},{"letter":"Four","frequency":0.59},{"letter":"Five","frequency":0.58},{"letter":"Six","frequency":0.59},{"letter":"Seven","frequency":0.52},{"letter":"Eight","frequency":0.49},{"letter":"Nine","frequency":0.6},{"letter":"Ten or More","frequency":0.54}],[{"letter":"No Friends","frequency":0.48},{"letter":"One","frequency":0.42},{"letter":"Two","frequency":0.57},{"letter":"Three","frequency":0.55},{"letter":"Four","frequency":0.68},{"letter":"Five","frequency":0.7},{"letter":"Six","frequency":0.72},{"letter":"Seven","frequency":0.71},{"letter":"Eight","frequency":0.65},{"letter":"Nine","frequency":0.77},{"letter":"Ten or More","frequency":0.68}],[{"letter":"No Friends","frequency":0.58},{"letter":"One","frequency":0.48},{"letter":"Two","frequency":0.54},{"letter":"Three","frequency":0.55},{"letter":"Four","frequency":0.63},{"letter":"Five","frequency":0.63},{"letter":"Six","frequency":0.65},{"letter":"Seven","frequency":0.59},{"letter":"Eight","frequency":0.56},{"letter":"Nine","frequency":0.57},{"letter":"Ten or More","frequency":0.7}],[{"letter":"No Friends","frequency":0.54},{"letter":"One","frequency":0.45},{"letter":"Two","frequency":0.61},{"letter":"Three","frequency":0.61},{"letter":"Four","frequency":0.66},{"letter":"Five","frequency":0.64},{"letter":"Six","frequency":0.69},{"letter":"Seven","frequency":0.55},{"letter":"Eight","frequency":0.62},{"letter":"Nine","frequency":0.8},{"letter":"Ten or More","frequency":0.63}],[{"letter":"No Friends","frequency":0.55},{"letter":"One","frequency":0.43},{"letter":"Two","frequency":0.71},{"letter":"Three","frequency":0.68},{"letter":"Four","frequency":0.71},{"letter":"Five","frequency":0.76},{"letter":"Six","frequency":0.76},{"letter":"Seven","frequency":0.66},{"letter":"Eight","frequency":0.75},{"letter":"Nine","frequency":0.83},{"letter":"Ten or More","frequency":0.77}],[{"letter":"No Friends","frequency":0.52},{"letter":"One","frequency":0.46},{"letter":"Two","frequency":0.63},{"letter":"Three","frequency":0.73},{"letter":"Four","frequency":0.82},{"letter":"Five","frequency":0.82},{"letter":"Six","frequency":0.82},{"letter":"Seven","frequency":0.82},{"letter":"Eight","frequency":0.82},{"letter":"Nine","frequency":0.93},{"letter":"Ten or More","frequency":0.87}]];
var aii=[[{"letter":"No Addiction","frequency":0.57},{"letter":"Occasional Weed","frequency":0.59},{"letter":"Frequent Weed","frequency":0.55},{"letter":"Occasional Alcohol","frequency":0.59},{"letter":"Frequent Alcohol","frequency":0.66},{"letter":"Occasional Smoke","frequency":0.64},{"letter":"Frequent Smoke","frequency":0.55}],[{"letter":"No Addiction","frequency":0.56},{"letter":"Occasional Weed","frequency":0.57},{"letter":"Frequent Weed","frequency":0.65},{"letter":"Occasional Alcohol","frequency":0.56},{"letter":"Frequent Alcohol","frequency":0.63},{"letter":"Occasional Smoke","frequency":0.65},{"letter":"Frequent Smoke","frequency":0.61}],[{"letter":"No Addiction","frequency":0.6},{"letter":"Occasional Weed","frequency":0.67},{"letter":"Frequent Weed","frequency":0.72},{"letter":"Occasional Alcohol","frequency":0.7},{"letter":"Frequent Alcohol","frequency":0.77},{"letter":"Occasional Smoke","frequency":0.72},{"letter":"Frequent Smoke","frequency":0.68}],[{"letter":"No Addiction","frequency":0.57},{"letter":"Occasional Weed","frequency":0.65},{"letter":"Frequent Weed","frequency":0.75},{"letter":"Occasional Alcohol","frequency":0.66},{"letter":"Frequent Alcohol","frequency":0.7},{"letter":"Occasional Smoke","frequency":0.6},{"letter":"Frequent Smoke","frequency":0.69}],[{"letter":"No Addiction","frequency":0.63},{"letter":"Occasional Weed","frequency":0.61},{"letter":"Frequent Weed","frequency":0.58},{"letter":"Occasional Alcohol","frequency":0.63},{"letter":"Frequent Alcohol","frequency":0.57},{"letter":"Occasional Smoke","frequency":0.57},{"letter":"Frequent Smoke","frequency":0.62}],[{"letter":"No Addiction","frequency":0.7},{"letter":"Occasional Weed","frequency":0.73},{"letter":"Frequent Weed","frequency":0.65},{"letter":"Occasional Alcohol","frequency":0.73},{"letter":"Frequent Alcohol","frequency":0.67},{"letter":"Occasional Smoke","frequency":0.73},{"letter":"Frequent Smoke","frequency":0.72}],[{"letter":"No Addiction","frequency":0.73},{"letter":"Occasional Weed","frequency":0.79},{"letter":"Frequent Weed","frequency":0.78},{"letter":"Occasional Alcohol","frequency":0.81},{"letter":"Frequent Alcohol","frequency":0.83},{"letter":"Occasional Smoke","frequency":0.77},{"letter":"Frequent Smoke","frequency":0.79}]];
var nii=[[{"letter":"AP","frequency":0.53},{"letter":"Bihar","frequency":0.6},{"letter":"Delhi","frequency":0.65},{"letter":"Gujarat","frequency":0.62},{"letter":"Haryana","frequency":0.62},{"letter":"Karnataka","frequency":0.64},{"letter":"Kerala","frequency":0.53},{"letter":"MH","frequency":0.56},{"letter":"MP","frequency":0.52},{"letter":"Odisha","frequency":0.59},{"letter":"Punjab","frequency":0.68},{"letter":"Rajasthan","frequency":0.47},{"letter":"TN","frequency":0.63},{"letter":"UP","frequency":0.55},{"letter":"WB","frequency":0.66}],[{"letter":"AP","frequency":0.58},{"letter":"Bihar","frequency":0.57},{"letter":"Delhi","frequency":0.68},{"letter":"Gujarat","frequency":0.59},{"letter":"Haryana","frequency":0.51},{"letter":"Karnataka","frequency":0.63},{"letter":"Kerala","frequency":0.55},{"letter":"MH","frequency":0.51},{"letter":"MP","frequency":0.56},{"letter":"Odisha","frequency":0.44},{"letter":"Punjab","frequency":0.71},{"letter":"Rajasthan","frequency":0.56},{"letter":"TN","frequency":0.57},{"letter":"UP","frequency":0.55},{"letter":"WB","frequency":0.54}],[{"letter":"AP","frequency":0.64},{"letter":"Bihar","frequency":0.68},{"letter":"Delhi","frequency":0.85},{"letter":"Gujarat","frequency":0.52},{"letter":"Haryana","frequency":0.59},{"letter":"Karnataka","frequency":0.62},{"letter":"Kerala","frequency":0.67},{"letter":"MH","frequency":0.64},{"letter":"MP","frequency":0.69},{"letter":"Odisha","frequency":0.55},{"letter":"Punjab","frequency":0.71},{"letter":"Rajasthan","frequency":0.68},{"letter":"TN","frequency":0.51},{"letter":"UP","frequency":0.63},{"letter":"WB","frequency":0.62}],[{"letter":"AP","frequency":0.62},{"letter":"Bihar","frequency":0.64},{"letter":"Delhi","frequency":0.75},{"letter":"Gujarat","frequency":0.52},{"letter":"Haryana","frequency":0.5},{"letter":"Karnataka","frequency":0.67},{"letter":"Kerala","frequency":0.63},{"letter":"MH","frequency":0.62},{"letter":"MP","frequency":0.66},{"letter":"Odisha","frequency":0.46},{"letter":"Punjab","frequency":0.59},{"letter":"Rajasthan","frequency":0.66},{"letter":"TN","frequency":0.4},{"letter":"UP","frequency":0.57},{"letter":"WB","frequency":0.6}],[{"letter":"AP","frequency":0.6},{"letter":"Bihar","frequency":0.67},{"letter":"Delhi","frequency":0.71},{"letter":"Gujarat","frequency":0.62},{"letter":"Haryana","frequency":0.68},{"letter":"Karnataka","frequency":0.62},{"letter":"Kerala","frequency":0.68},{"letter":"MH","frequency":0.6},{"letter":"MP","frequency":0.68},{"letter":"Odisha","frequency":0.61},{"letter":"Punjab","frequency":0.52},{"letter":"Rajasthan","frequency":0.58},{"letter":"TN","frequency":0.62},{"letter":"UP","frequency":0.55},{"letter":"WB","frequency":0.61}],[{"letter":"AP","frequency":0.7},{"letter":"Bihar","frequency":0.71},{"letter":"Delhi","frequency":0.8},{"letter":"Gujarat","frequency":0.65},{"letter":"Haryana","frequency":0.7},{"letter":"Karnataka","frequency":0.62},{"letter":"Kerala","frequency":0.75},{"letter":"MH","frequency":0.66},{"letter":"MP","frequency":0.72},{"letter":"Odisha","frequency":0.73},{"letter":"Punjab","frequency":0.65},{"letter":"Rajasthan","frequency":0.73},{"letter":"TN","frequency":0.66},{"letter":"UP","frequency":0.72},{"letter":"WB","frequency":0.71}],[{"letter":"AP","frequency":0.77},{"letter":"Bihar","frequency":0.74},{"letter":"Delhi","frequency":0.87},{"letter":"Gujarat","frequency":0.77},{"letter":"Haryana","frequency":0.7},{"letter":"Karnataka","frequency":0.78},{"letter":"Kerala","frequency":0.8},{"letter":"MH","frequency":0.74},{"letter":"MP","frequency":0.81},{"letter":"Odisha","frequency":0.68},{"letter":"Punjab","frequency":0.76},{"letter":"Rajasthan","frequency":0.8},{"letter":"TN","frequency":0.67},{"letter":"UP","frequency":0.79},{"letter":"WB","frequency":0.75}]];
var proshno=["How satisfied are you with your CGPA?","How satisfied are you with your Department?","How satisfied are you with IIT?","How satisfied are you with your Hall?",
"How satisfied are you with your Social Life?","How comfortable are you with your Body Image?","How satisfied are you with your Friend Circle?"];
var datea=[{'letter':'op','frequency':0.9}];
var foopay=[{'letter':'op','frequency':0.7}];
visualize(datafg,"div.dephpindtxt",proshno,"div.dephpar","button.depsort","button.depnxt",datea,"dso","Happiness Index");
visualize(payf,"div.paydeptxt",payproshno,"div.paydeparea","button.paydepsrt","button.paydepnxt",foopay,"dsogp","Percentage of Students");
visualize(socii,"div.sochpindtxt",proshno,"div.sochpar","button.socsort","button.socnxt",datea,"sso","Happiness Index");
visualize(hallii,"div.hallhpindtxt",proshno,"div.hallhpar","button.hallsort","button.hallnxt",datea,"hso","Happiness Index");
visualize(yii,"div.yrhpindtxt",proshno,"div.yrhpar","button.yrsort","button.yrnxt",datea,"yso","Happiness Index");
visualize(gii,"div.gdrhpindtxt",proshno,"div.gdrhpar","button.gdrsort","button.gdrnxt",datea,"gso","Happiness Index");
visualize(rii,"div.relhpindtxt",proshno,"div.relhpar","button.relsort","button.relnxt",datea,"rso","Happiness Index");
visualize(fii,"div.frhpindtxt",proshno,"div.frhpar","button.frsort","button.frnxt",datea,"fso","Happiness Index");
visualize(aii,"div.adhpindtxt",proshno,"div.adhpar","button.adsort","button.adnxt",datea,"aso","Happiness Index");
visualize(nii,"div.nvhpindtxt",proshno,"div.nvhpar","button.nvsort","button.nvnxt",datea,"nso","Happiness Index");
function visualize(dataf,tgttxt,qstnarray,tgtdiv,btnsrt,btnnxt,pseudodata,btnid,labee){
var data=dataf[0];
var sortcoun=0;
var counter=0;
d3.select(tgttxt).text(qstnarray[0]);
var margin = {top: 20, right: 20, bottom: 70, left: 40},
width = 960 - margin.left - margin.right,
height = 400 - margin.top - margin.bottom;
var formatPercent = d3.format(".0%");
var x = d3.scale.ordinal()
.rangeRoundBands([0, width], .1, 1);
var y = d3.scale.linear()
.range([height, 0]);
var xAxis = d3.svg.axis()
.scale(x)
.orient("bottom");
var yAxis = d3.svg.axis()
.scale(y)
.orient("left")
.tickFormat(formatPercent);
var svgd1 = d3.select(tgtdiv).append("svg")
.attr("width", width + margin.left + margin.right)
.attr("height", height + margin.top + margin.bottom)
.append("g")
.attr("transform", "translate(" + margin.left + "," + margin.top + ")");
data.forEach(function(d) {
d.frequency = +d.frequency;
});
x.domain(data.map(function(d) { return d.letter; }));
y.domain([0, d3.max(pseudodata, function(d) { return d.frequency; })]);
svgd1.append("g")
.attr("class", "x axis")
.attr("transform", "translate(0," + height + ")")
.call(xAxis);
svgd1.append("g")
.attr("class", "y axis")
.call(yAxis)
.append("text")
.attr("transform", "rotate(-90)")
.attr("y", 6)
.attr("dy", ".71em")
.style("text-anchor", "end")
.text(labee);
svgd1.selectAll(".barf")
.data(data)
.enter().append("rect")
.attr("class", "barf")
.attr("x", function(d) { return x(d.letter); })
.attr("width", x.rangeBand())
.attr("y", function(d) { return y(d.frequency); })
.attr("height", function(d) { return height - y(d.frequency); });
d3.select(btnsrt)
.on("click", function() {
sortcoun++;
var btnval=sortcoun%2==1?"Unsort":"Sort";
document.getElementById(btnid).innerHTML=btnval;
// Copy-on-write since tweens are evaluated after a delay.
var x0 = x.domain(data.sort(sortcoun%2==1
? function(a, b) { return b.frequency - a.frequency; }
: function(a, b) { return d3.ascending(a.letter, b.letter); })
.map(function(d) { return d.letter; }))
.copy();
svgd1.selectAll(".barf")
.sort(function(a, b) { return x0(a.letter) - x0(b.letter); });
var transition = svgd1.transition().duration(750),
delay = function(d, i) { return i * 50; };
transition.selectAll(".barf")
.delay(delay)
.attr("x", function(d) { return x0(d.letter); });
transition.select(".x.axis")
.call(xAxis)
.selectAll("g")
.delay(delay);
});
d3.select(btnnxt)
.on("click", function() {
counter++;
sortcoun=0;
d3.select(tgttxt).text(qstnarray[counter%(dataf.length)]);
document.getElementById(btnid).innerHTML="Sort";
data=dataf[counter%dataf.length];
svgd1.selectAll(".barf")
.data(data)
.transition()
.attr("x", function(d) { return x(d.letter); })
.attr("width", x.rangeBand())
.attr("y", function(d) { return y(d.frequency); })
.attr("height", function(d) { return height - y(d.frequency); });
});
};