forked from emeryberger/CSrankings
-
Notifications
You must be signed in to change notification settings - Fork 0
/
csrankings.js
829 lines (826 loc) · 30.4 KB
/
csrankings.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
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
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
/*
CSrankings.ts
@author Emery Berger <[email protected]> http://www.emeryberger.com
*/
/// <reference path="./typescript/jquery.d.ts" />
/// <reference path="./typescript/papaparse.d.ts" />
/// <reference path="./typescript/set.d.ts" />
/// <reference path="./typescript/d3.d.ts" />
/// <reference path="./typescript/d3pie.d.ts" />
var coauthorFile = "faculty-coauthors.csv";
var authorinfoFile = "generated-author-info.csv";
var countryinfoFile = "country-info.csv";
var aliasFile = "dblp-aliases.csv";
var homepagesFile = "homepages.csv";
var allowRankingChange = false; /* Can we change the kind of rankings being used? */
var showCoauthors = false;
var maxCoauthors = 30; /* Max co-authors to display. */
var useArithmeticMean = false;
var useGeometricMean = true; /* This is the default and arguably only principled choice. */
var useHarmonicMean = false;
var useDenseRankings = false; /* Set to true for "dense rankings" vs. "competition rankings". */
/* All the areas, in order by their 'field_' number (the checkboxes) in index.html. */
var areas = ["ai", "vision", "mlmining", "nlp", "web",
"arch", "networks", "security", "database", "highperf", "mobile", "metrics", "opsys", "proglang", "softeng",
"theory", "crypto", "logic",
"graphics", "hci", "robotics"];
var areaNames = ["AI", "Vision", "ML", "NLP", "Web & IR",
"Arch", "Networks", "Security", "DB", "HPC", "Mobile", "Metrics", "OS", "PL", "SE",
"Theory", "Crypto", "Logic",
"Graphics", "HCI", "Robotics"];
var areaDict = {};
var areaPosition = {};
/* Colors for all areas. */
var color = ["#f30000", "#0600f3", "#00b109", "#14e4b4", "#0fe7fb", "#67f200", "#ff7e00", "#8fe4fa", "#ff5300", "#640000", "#3854d1", "#d00ed8", "#7890ff", "#01664d", "#04231b", "#e9f117", "#f3228e", "#7ce8ca", "#ff5300", "#ff5300", "#7eff30", "#9a8cf6", "#79aff9", "#bfbfbf", "#56b510", "#00e2f6", "#ff4141", "#61ff41"];
var RightTriangle = "►"; // right-facing triangle symbol (collapsed view)
var DownTriangle = "▼"; // downward-facing triangle symbol (expanded view)
var PieChart = "◕"; // symbol that looks close enough to a pie chart
/* Build the areaDict dictionary: areas -> names used in pie charts
and areaPosition dictionary: areas -> position in area array
*/
function initAreaDict() {
for (var i = 0; i < areaNames.length; i++) {
areaDict[areas[i]] = areaNames[i];
areaPosition[areas[i]] = i;
}
}
;
;
;
;
;
var authors = []; /* The data which will hold the parsed CSV of author info. */
var coauthors = []; /* The data which will hold the parsed CSV of co-author info. */
var countryInfo = {}; /* Maps institutions to (non-US) regions. */
var aliases = {}; /* Maps aliases to canonical author name. */
var homepages = {}; /* Maps names to home pages. */
var authorAreas = {};
/* Maps authors to the areas they have published in (for pie chart display). */
/* Create the prologue that we preface each generated HTML page with (the results). */
function makePrologue() {
var s = "<html>"
+ "<head>"
+ '<style type="text/css">'
+ ' body { font-family: "Helvetica", "Arial"; }'
+ " table td { vertical-align: top; }"
+ "</style>"
+ "</head>"
+ "<body>"
+ '<div class="row">'
+ '<div class="table" style="overflow:auto; height: 650px;">'
+ '<table class="table-sm table-striped"'
+ 'id="ranking" valign="top">';
return s;
}
/* from http://hubrik.com/2015/11/16/sort-by-last-name-with-javascript/ */
function compareNames(a, b) {
//split the names as strings into arrays
var aName = a.split(" ");
var bName = b.split(" ");
// get the last names by selecting
// the last element in the name arrays
// using array.length - 1 since full names
// may also have a middle name or initial
var aLastName = aName[aName.length - 1];
var bLastName = bName[bName.length - 1];
// compare the names and return either
// a negative number, positive number
// or zero.
if (aLastName < bLastName)
return -1;
if (aLastName > bLastName)
return 1;
return 0;
}
function redisplay(str) {
jQuery("#success").html(str);
}
/* Create a pie chart */
function makeChart(name) {
console.assert(color.length >= areas.length, "Houston, we have a problem.");
var data = [];
var keys = areas;
for (var i = 0; i < keys.length; i++) {
data.push({ "label": areaDict[keys[i]],
"value": authorAreas[unescape(name)][keys[i]],
"color": color[i] });
}
var pie = new d3pie(name + "-chart", {
"header": {
"title": {
"text": unescape(name),
"fontSize": 24,
"font": "open sans"
},
"subtitle": {
"text": "Publication Profile",
"color": "#999999",
"fontSize": 14,
"font": "open sans"
},
"titleSubtitlePadding": 9
},
"size": {
"canvasHeight": 500,
"canvasWidth": 500,
"pieInnerRadius": "38%",
"pieOuterRadius": "83%"
},
"data": {
"content": data,
"smallSegmentGrouping": {
"enabled": true,
"value": 1
}
},
"labels": {
"outer": {
"pieDistance": 32
},
"inner": {
"format": "value",
"hideWhenLessThanPercentage": 2
},
"mainLabel": {
"fontSize": 12
},
"percentage": {
"color": "#ffffff",
"decimalPlaces": 0
},
"value": {
"color": "#ffffff",
"fontSize": 10
},
"lines": {
"enabled": true
},
"truncation": {
"enabled": true
}
},
"effects": {
"load": {
"effect": "none"
},
"pullOutSegmentOnClick": {
"effect": "linear",
"speed": 400,
"size": 8
}
},
"misc": {
"gradient": {
"enabled": true,
"percentage": 100
}
}
});
}
/* Turn the chart display on or off. */
function toggleChart(name) {
var chart = document.getElementById(name + "-chart");
var widget = document.getElementById(name + "-widget");
if (chart.style.display == 'block') {
chart.style.display = 'none';
chart.innerHTML = '';
}
else {
chart.style.display = 'block';
makeChart(name);
}
}
/* Expand or collape the view of all faculty in a department. */
function toggleFaculty(dept) {
var e = document.getElementById(dept + "-faculty");
var widget = document.getElementById(dept + "-widget");
if (e.style.display == 'block') {
e.style.display = 'none';
widget.innerHTML = RightTriangle;
}
else {
e.style.display = 'block';
widget.innerHTML = DownTriangle;
}
}
/* Set all checkboxes to true. */
function setAllCheckboxes() {
for (var i = 1; i <= areas.length; i++) {
var str = 'input[name=field_' + i + ']';
jQuery(str).prop('checked', true);
}
}
/* A convenience function for ending a pipeline of function calls executed in continuation-passing style. */
function nop() { }
function loadCoauthors(cont) {
Papa.parse(coauthorFile, {
download: true,
header: true,
complete: function (results) {
var data = results.data;
coauthors = data;
cont();
}
});
}
function loadAliases(cont) {
Papa.parse(aliasFile, {
header: true,
download: true,
complete: function (results) {
var data = results.data;
var d = data;
for (var i = 0; i < d.length; i++) {
aliases[d[i].alias] = d[i].name;
}
cont();
}
});
}
function loadCountryInfo(cont) {
Papa.parse(countryinfoFile, {
header: true,
download: true,
complete: function (results) {
var data = results.data;
var ci = data;
for (var i = 0; i < ci.length; i++) {
countryInfo[ci[i].institution] = ci[i].region;
}
cont();
}
});
}
function loadAuthorInfo(cont) {
Papa.parse(authorinfoFile, {
download: true,
header: true,
complete: function (results) {
var data = results.data;
authors = data;
for (var i = 1; i <= areas.length; i++) {
var str = 'input[name=field_' + i + ']';
(function (s) {
jQuery(s).click(function () {
rank();
});
})(str);
}
cont();
/* rank(); */
}
});
}
function loadHomepages(cont) {
Papa.parse(homepagesFile, {
header: true,
download: true,
complete: function (results) {
var data = results.data;
var d = data;
for (var i = 0; i < d.length; i++) {
homepages[d[i].name] = d[i].homepage;
}
cont();
}
});
}
function init() {
jQuery(document).ready(function () {
setAllCheckboxes();
initAreaDict();
loadAliases(function () {
loadHomepages(function () {
loadAuthorInfo(function () {
loadCountryInfo(rank);
});
});
});
});
}
function activateAll(value) {
if (value === undefined) {
value = true;
}
for (var i = 1; i <= areas.length; i++) {
var str = "input[name=field_" + i + "]";
jQuery(str).prop('checked', value);
}
rank();
return false;
}
function activateNone() {
return activateAll(false);
}
function activateFields(value, fields) {
if (value === undefined) {
value = true;
}
for (var i = 0; i <= fields.length; i++) {
var str = "input[name=field_" + fields[i] + "]";
jQuery(str).prop('checked', value);
}
rank();
return false;
}
function activateSystems(value) {
var systemsFields = [6, 7, 8, 9, 10, 11, 12, 13, 14, 15];
return activateFields(value, systemsFields);
}
function activateAI(value) {
var aiFields = [1, 2, 3, 4, 5];
return activateFields(value, aiFields);
}
function activateTheory(value) {
var theoryFields = [16, 17, 18];
return activateFields(value, theoryFields);
}
function activateOthers(value) {
var otherFields = [19, 20, 21];
return activateFields(value, otherFields);
}
function deactivateSystems() {
return activateSystems(false);
}
function deactivateAI() {
return activateAI(false);
}
function deactivateTheory() {
return activateTheory(false);
}
function deactivateOthers() {
return activateOthers(false);
}
function toggleAI(cb) {
if (cb.checked) {
activateAI(false);
}
else {
activateAI(true);
}
return false;
}
function sortIndex(univagg) {
var keys = Object.keys(univagg);
keys.sort(function (a, b) {
if (univagg[a] > univagg[b]) {
return -1;
}
if (univagg[b] > univagg[a]) {
return 1;
}
if (a < b) {
return -1;
}
if (b < a) {
return 1;
}
return 0;
});
return keys;
}
function computeCoauthors(coauthors, startyear, endyear, weights) {
var coauthorList = {};
for (var c in coauthors) {
var author = coauthors[c].author;
var coauthor = coauthors[c].coauthor;
var year = coauthors[c].year;
var area = coauthors[c].area;
if (!(author in coauthorList)) {
coauthorList[author] = new Set([]);
}
if ((weights[area] == 0) || (year < startyear) || (year > endyear)) {
continue;
}
coauthorList[author].add(coauthor);
}
return coauthorList;
}
function countAuthorAreas(areacount, authors, startyear, endyear, weights) {
/* Delete everything from authorAreas. */
// Build up an associative array of depts.
var depts = {};
for (var r in authors) {
// If we haven't seen this dept yet, add it.
var dept = authors[r].dept;
if (!depts.hasOwnProperty(dept)) {
depts[dept] = 1;
}
// Now trash the existing name entry.
var name_1 = authors[r].name;
if (authorAreas.hasOwnProperty(name_1)) {
delete authorAreas[name_1];
}
}
// Clean up department entries, too.
for (var d in depts) {
if (authorAreas.hasOwnProperty(d)) {
delete authorAreas[d];
}
}
/* Now rebuild. */
for (var r in authors) {
var dept = authors[r].dept;
var area_1 = authors[r].area;
var count = parseFloat(authors[r].count);
var name = authors[r].name;
if (name in aliases) {
name = aliases[name];
}
var year = authors[r].year;
if ((weights[area_1] == 0) || (year < startyear) || (year > endyear)) {
continue;
}
if (!(name in authorAreas)) {
authorAreas[name] = {};
for (var area in areas) {
authorAreas[name][area_1] = 0;
}
}
if (!(dept in authorAreas)) {
authorAreas[dept] = {};
for (var area in areas) {
authorAreas[dept][area_1] = 0;
}
}
if (!(area_1 in authorAreas[name])) {
authorAreas[name][area_1] = 0;
}
if (!(area_1 in authorAreas[dept])) {
authorAreas[dept][area_1] = 0;
}
authorAreas[name][area_1] += count;
authorAreas[dept][area_1] += count;
}
}
function countPapers(areacount, areaAdjustedCount, areaDeptAdjustedCount, authors, startyear, endyear, weights) {
/* Count the total number of papers (raw and adjusted) in each area. */
for (var r in authors) {
var area = authors[r].area;
var dept = authors[r].dept;
var year = authors[r].year;
var areaDept = area + dept;
areaDeptAdjustedCount[areaDept] = 0;
if ((weights[area] == 0) || (year < startyear) || (year > endyear)) {
continue;
}
var count = parseFloat(authors[r].count);
var adjustedCount = parseFloat(authors[r].adjustedcount);
areacount[area] += count;
areaAdjustedCount[area] += adjustedCount;
}
}
function buildDepartments(areaDeptAdjustedCount, deptCounts, deptNames, facultycount, facultyAdjustedCount, authors, startyear, endyear, weights, regions) {
/* Build the dictionary of departments (and count) to be ranked. */
var visited = {}; /* contains an author name if that author has been processed. */
for (var r in authors) {
var area = authors[r].area;
var dept = authors[r].dept;
switch (regions) {
case "USA":
if (dept in countryInfo) {
continue;
}
break;
case "europe":
if (!(dept in countryInfo)) {
continue;
}
if (countryInfo[dept] != "europe") {
continue;
}
break;
case "canada":
if (!(dept in countryInfo)) {
continue;
}
if (countryInfo[dept] != "canada") {
continue;
}
break;
case "australasia":
if (!(dept in countryInfo)) {
continue;
}
if (countryInfo[dept] != "australasia") {
continue;
}
break;
case "world":
break;
}
var areaDept = area + dept;
if (!(areaDept in areaDeptAdjustedCount)) {
areaDeptAdjustedCount[areaDept] = 0;
}
if (weights[area] == 0) {
continue;
}
var name_2 = authors[r].name;
var count = parseInt(authors[r].count);
var adjustedCount = parseFloat(authors[r].adjustedcount);
var year = authors[r].year;
if ((year >= startyear) && (year <= endyear)) {
areaDeptAdjustedCount[areaDept] += adjustedCount;
/* Is this the first time we have seen this person? */
if (!(name_2 in visited)) {
visited[name_2] = true;
facultycount[name_2 + dept] = 0;
facultyAdjustedCount[name_2 + dept] = 0;
if (!(dept in deptCounts)) {
deptCounts[dept] = 0;
deptNames[dept] = [];
}
deptNames[dept].push(name_2);
deptCounts[dept] += 1;
}
facultycount[name_2 + dept] += count;
facultyAdjustedCount[name_2 + dept] += adjustedCount;
}
}
}
/* Compute aggregate statistics. */
function computeStats(deptNames, areaAdjustedCount, areaDeptAdjustedCount, areas, numAreas, displayPercentages, weights) {
var univagg = {};
for (var dept in deptNames) {
if (displayPercentages) {
if (useArithmeticMean) {
univagg[dept] = 0;
}
if (useGeometricMean) {
univagg[dept] = 1;
}
if (useHarmonicMean) {
univagg[dept] = 0;
}
}
else {
univagg[dept] = 0;
}
for (var ind = 0; ind < areas.length; ind++) {
var area = areas[ind];
var areaDept = area + dept;
if (!(areaDept in areaDeptAdjustedCount)) {
areaDeptAdjustedCount[areaDept] = 0;
}
if (weights[area] != 0) {
if (displayPercentages) {
if (areaDeptAdjustedCount[areaDept] != 0) {
if (useArithmeticMean) {
univagg[dept] += areaDeptAdjustedCount[areaDept] / areaAdjustedCount[area];
}
if (useGeometricMean) {
univagg[dept] *= areaDeptAdjustedCount[areaDept];
}
if (useHarmonicMean) {
univagg[dept] += areaAdjustedCount[area] / areaDeptAdjustedCount[areaDept];
}
}
else {
}
}
else {
univagg[dept] += areaDeptAdjustedCount[areaDept];
}
}
}
if (displayPercentages) {
if (useArithmeticMean) {
univagg[dept] = univagg[dept] / numAreas;
}
if (useGeometricMean) {
univagg[dept] = Math.pow(univagg[dept], 1 / numAreas);
}
if (useHarmonicMean) {
univagg[dept] = numAreas / univagg[dept];
}
}
}
return univagg;
}
function rank() {
var form = document.getElementById("rankform");
var s = "";
var deptNames = {}; /* names of departments. */
var deptCounts = {}; /* number of faculty in each department. */
var facultycount = {}; /* name + dept -> raw count of pubs per name / department */
var facultyAdjustedCount = {}; /* name + dept -> adjusted count of pubs per name / department */
var weights = {}; /* array to hold 1 or 0, depending on if the area is checked or not. */
var areacount = {}; /* raw number of papers in each area */
var areaAdjustedCount = {}; /* adjusted number of papers in each area (split among faculty authors). */
var areaDeptAdjustedCount = {}; /* as above, but for area+dept. */
var startyear = parseInt(jQuery("#startyear").find(":selected").text());
var endyear = parseInt(jQuery("#endyear").find(":selected").text());
var displayPercentages = Boolean(parseInt(jQuery("#displayPercent").find(":selected").val()));
/* Show the top N (with more if tied at the end) */
var minToRank = parseInt(jQuery("#minToRank").find(":selected").val());
var whichRegions = jQuery("#regions").find(":selected").val();
var numAreas = 0; /* Total number of areas checked */
/* Update the 'weights' of each area from the checkboxes. */
for (var ind = 0; ind < areas.length; ind++) {
weights[areas[ind]] = jQuery('input[name=field_' + (ind + 1) + ']').prop('checked') ? 1 : 0;
if (weights[areas[ind]] == 1) {
/* One more area checked. */
numAreas++;
}
areacount[areas[ind]] = 0;
areaAdjustedCount[areas[ind]] = 0;
}
var coauthorList = {};
if (showCoauthors) {
coauthorList = computeCoauthors(coauthors, startyear, endyear, weights);
}
countPapers(areacount, areaAdjustedCount, areaDeptAdjustedCount, authors, startyear, endyear, weights);
countAuthorAreas(areacount, authors, startyear, endyear, weights);
buildDepartments(areaDeptAdjustedCount, deptCounts, deptNames, facultycount, facultyAdjustedCount, authors, startyear, endyear, weights, whichRegions);
/* (university, total or average number of papers) */
var univagg = computeStats(deptNames, areaAdjustedCount, areaDeptAdjustedCount, areas, numAreas, displayPercentages, weights);
var univtext = {};
/* Canonicalize names. */
for (dept in deptNames) {
for (var ind = 0; ind < deptNames[dept].length; ind++) {
name = deptNames[dept][ind];
if (name in aliases) {
deptNames[dept][ind] = aliases[name];
if (!(aliases[name] + dept in facultycount)) {
facultycount[aliases[name] + dept] = facultycount[name + dept];
facultyAdjustedCount[aliases[name] + dept] = facultyAdjustedCount[name + dept];
}
else {
facultycount[aliases[name] + dept] += facultycount[name + dept];
facultyAdjustedCount[aliases[name] + dept] += facultyAdjustedCount[name + dept];
}
}
}
}
/* Build drop down for faculty names and paper counts. */
for (dept in deptNames) {
var p = '<div class="row"><div class="table"><table class="table-striped" width="100%"><thead><th></th><td><small><em><abbr title="Click on an author\'s name to go to their home page.">Faculty</abbr></em></small></td><td align="right"><small><em> <abbr title="Total number of publications (click for DBLP entry).">Raw \# Pubs</abbr></em></small></td><td align="right"><small><em> <abbr title="Count divided by number of co-authors">Adjusted \#</abbr></em></small></td></thead><tbody>';
/* Build a dict of just faculty from this department for sorting purposes. */
var fc = {};
for (var ind = 0; ind < deptNames[dept].length; ind++) {
name = deptNames[dept][ind];
fc[name] = facultycount[name + dept];
}
var keys = Object.keys(fc);
keys.sort(function (a, b) { return fc[b] - fc[a]; });
for (var ind = 0; ind < keys.length; ind++) {
name = keys[ind];
if (showCoauthors) {
/* Build up text for co-authors. */
var coauthorStr = "";
if ((!(name in coauthorList)) || (coauthorList[name].size == 0)) {
coauthorList[name] = new Set([]);
coauthorStr = "(no senior co-authors on these papers)";
}
else {
coauthorStr = "Senior co-authors on these papers:\n";
}
/* Sort it by last name. */
var l = [];
coauthorList[name].forEach(function (item, coauthors) {
l.push(item);
});
if (l.length > maxCoauthors) {
coauthorStr = "(more than " + maxCoauthors + " senior co-authors)";
}
else {
l.sort(compareNames);
l.forEach(function (item, coauthors) {
coauthorStr += item + "\n";
});
/* Trim off the trailing newline. */
coauthorStr = coauthorStr.slice(0, coauthorStr.length - 1);
}
}
p += "<tr><td> </td><td><small>"
+ '<a title="Click for author\'s home page." target="_blank" href="'
+ encodeURI(homepages[name])
+ '">'
+ name
+ '</a> '
+ "<span onclick=\"toggleChart('"
+ escape(name)
+ "')\" class=\"hovertip\" ><font color=\"blue\">" + PieChart + "</font></span>"
+ '</small>'
+ '</td><td align="right"><small>'
+ '<a title="Click for author\'s DBLP entry." target="_blank" href="http://dblp.uni-trier.de/search?q=' + encodeURI(name) + '">'
+ facultycount[name + dept]
+ '</a>'
+ "</small></td>"
+ '</a></small></td><td align="right"><small>'
+ (Math.floor(10.0 * facultyAdjustedCount[name + dept]) / 10.0).toFixed(1)
+ "</small></td></tr>"
+ "<tr><td colspan=\"4\">"
+ '<div style="display:none;" id="' + escape(name) + "-chart" + '">'
+ '</div>'
+ "</td></tr>";
}
p += "</tbody></table></div></div>";
univtext[dept] = p;
}
/* Start building up the string to output. */
var s = makePrologue();
if (displayPercentages) {
s = s + '<thead><tr><th align="left">Rank </th><th align="right">Institution </th><th align="right"><abbr title="Geometric mean number of papers published across all areas.">Average Count</abbr></th><th align="right"> <abbr title="Number of faculty who have published in these areas.">Faculty</abbr></th></th></tr></thead>';
}
else {
s = s + '<thead><tr><th align="left">Rank </th><th align="right">Institution </th><th align="right">Adjusted Pub Count</th><th align="right"> Faculty</th></tr></thead>';
}
s = s + "<tbody>";
/* As long as there is at least one thing selected, compute and display a ranking. */
if (numAreas > 0) {
var ties = 1; /* number of tied entries so far (1 = no tie yet); used to implement "competition rankings" */
var rank = 0; /* index */
var oldv = null; /* old number - to track ties */
/* Sort the university aggregate count from largest to smallest. */
var keys2 = sortIndex(univagg);
/* Display rankings until we have shown `minToRank` items or
while there is a tie (those all get the same rank). */
for (var ind = 0; ind < keys2.length; ind++) {
var dept = keys2[ind];
var v = univagg[dept];
if (useArithmeticMean || useHarmonicMean) {
v = (Math.floor(10000.0 * v) / (100.0));
}
if (useGeometricMean) {
v = (Math.floor(10.0 * v) / 10.0);
}
if ((ind >= minToRank) && (v != oldv)) {
break;
}
if (v === 0.0) {
break;
}
if (oldv != v) {
if (useDenseRankings) {
rank = rank + 1;
}
else {
rank = rank + ties;
ties = 0;
}
}
s += "\n<tr><td>" + rank + "</td>";
s += "<font color=\"blue\"><td><span onclick=\"toggleFaculty('" + dept + "')\" class=\"hovertip\" id=\"" + dept + "-widget\">" + RightTriangle + "</span></font> " + dept;
s += " <font color=\"blue\">" + "<span onclick=\"toggleChart('"
+ escape(dept)
+ "')\" class=\"hovertip\" id=\""
+ escape(dept)
+ "-widget\">" + PieChart + "</span></font>";
// s += '<div style="display:none;" style="width: 100%; height: 350px;" id="' + escape(dept) + '">' + '</div>';
s += "</td>";
if (displayPercentages) {
/* Show average */
if (useArithmeticMean || useHarmonicMean) {
s += '<td align="right">' + (Math.floor(10000.0 * v) / (100.0)).toPrecision(2) + "%</td>";
}
if (useGeometricMean) {
s += '<td align="right">' + (Math.floor(10.0 * v) / 10.0).toFixed(1) + "</td>";
}
}
else {
/* Show count */
s += '<td align="right">' + (Math.floor(100.0 * v) / 100.0) + "</td>";
}
s += '<td align="right">' + deptCounts[dept] + "<br />"; /* number of faculty */
s += "</td>";
s += "</tr>\n";
s += '<tr><td colspan="4"><div style="display:none;" style="width: 100%; height: 350px;" id="'
+ escape(dept)
+ '-chart">' + '</div></td></tr>';
s += '<tr><td colspan="4"><div style="display:none;" id="' + dept + '-faculty">' + univtext[dept] + '</div></td></tr>';
ties++;
oldv = v;
}
s += "</tbody>" + "</table>" + "<br />";
if (allowRankingChange) {
/* Disable option to change ranking approach for now. */
if (useDenseRankings) {
s += '<em><a class="only_these_areas" onClick="deactivateDenseRankings(); return false;"><font color="blue"><b>Using dense rankings. Click to use competition rankings.</b></font></a><em>';
}
else {
s += '<em><a class="only_these_areas" onClick="activateDenseRankings(); return false;"><font color="blue"><b>Using competition rankings. Click to use dense rankings.</b></font></a></em>';
}
}
s += "</div>" + "</div>" + "\n";
s += "<br>" + "</body>" + "</html>";
}
else {
/* Nothing selected. */
s = "<h4>Please select at least one area.</h4>";
}
setTimeout((function (str) { redisplay(str); })(s), 0);
return false;
}
function activateDenseRankings() {
useDenseRankings = true;
rank();
return false;
}
function deactivateDenseRankings() {
useDenseRankings = false;
rank();
return false;
}
window.onload = init;