Skip to content

Commit

Permalink
Compiled js files
Browse files Browse the repository at this point in the history
  • Loading branch information
minsukkahng committed Sep 25, 2021
1 parent 497672e commit f1c800d
Show file tree
Hide file tree
Showing 2 changed files with 118 additions and 150 deletions.
141 changes: 54 additions & 87 deletions csrankings.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
};
/// <reference path="./typescript/he/index.d.ts" />
/// <reference path="./typescript/jquery.d.ts" />
/// <reference path="./typescript/vega-embed.d.ts" />
/// <reference path="./typescript/papaparse.d.ts" />
/// <reference path="./typescript/d3.d.ts" />
/// <reference path="./typescript/d3pie.d.ts" />
/// <reference path="./typescript/navigo.d.ts" />
/// <reference path="./typescript/continents.d.ts" />
;
Expand Down Expand Up @@ -149,9 +148,9 @@ class CSRankings {
//,{ area : "cse", title : "CSEd" }
];
this.aiAreas = ["ai", "vision", "mlmining", "nlp", "ir"];
this.systemsAreas = ["arch", "comm", "sec", "mod", "hpc", "mobile", "metrics", "ops", "plan", "soft", "da", "bed"];
this.systemsAreas = ["arch", "comm", "sec", "mod", "da", "bed", "hpc", "mobile", "metrics", "ops", "plan", "soft"];
this.theoryAreas = ["act", "crypt", "log"];
this.interdisciplinaryAreas = ["graph", "chi", "robotics", "bio", "visualization", "ecom"];
this.interdisciplinaryAreas = ["bio", "graph", "ecom", "chi", "robotics", "visualization"];
this.areaNames = [];
this.fields = [];
this.aiFields = [];
Expand Down Expand Up @@ -192,8 +191,8 @@ class CSRankings {
this.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"];
this.RightTriangle = "&#9658;"; // right-facing triangle symbol (collapsed view)
this.DownTriangle = "&#9660;"; // downward-facing triangle symbol (expanded view)
this.PieChart = "<img alt='closed piechart' src='png/piechart.png'>"; // pie chart image
this.OpenPieChart = "<img alt='opened piechart' src='png/piechart-open.png'>"; // opened pie chart image
this.BarChart = "<img alt='closed barchart' src='png/barchart.png'>"; // bar chart image
this.OpenBarChart = "<img alt='opened barchart' src='png/barchart-open.png'>"; // opened bar chart image
CSRankings.theInstance = this;
this.navigoRouter = new Navigo(null, true);
/* Build the areaDict dictionary: areas -> names used in pie charts
Expand Down Expand Up @@ -452,6 +451,13 @@ class CSRankings {
let datadict = {};
const keys = CSRankings.topTierAreas;
const uname = unescape(name);
const areas = [
...this.aiAreas.map(key => ({ key: key, label: this.areaDict[key], color: "#8da0cb" })),
...this.systemsAreas.map(key => ({ key: key, label: this.areaDict[key], color: "#fc8d62" })),
...this.theoryAreas.map(key => ({ key: key, label: this.areaDict[key], color: "#66c2a5" })),
...this.interdisciplinaryAreas.map(key => ({ key: key, label: this.areaDict[key], color: "#e78ac3" }))
];
areas.forEach(area => datadict[area.key] = 0);
for (let key in keys) { // i = 0; i < keys.length; i++) {
// let key = keys[i];
if (!(uname in this.authorAreas)) {
Expand Down Expand Up @@ -480,92 +486,53 @@ class CSRankings {
if (key in CSRankings.parentMap) {
key = CSRankings.parentMap[key];
}
if (!(key in datadict)) {
datadict[key] = 0;
}
datadict[key] += value;
}
}
for (let key in datadict) {
areas.forEach(area => {
let newSlice = {
"label": this.areaDict[key],
"value": Math.round(datadict[key] * 10) / 10,
"color": this.color[CSRankings.parentIndex[key]]
"area": this.areaDict[area.key],
"value": Math.round(datadict[area.key] * 10) / 10
};
data.push(newSlice);
}
new d3pie(name + "-chart", {
"header": {
"title": {
"text": uname,
"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
},
area.label = this.areaDict[area.key];
});
const colors = areas.sort((a, b) => a.label > b.label ? 1 : (a.label < b.label ? -1 : 0)).map(area => area.color);
const vegaLiteSpec = {
$schema: "https://vega.github.io/schema/vega-lite/v5.json",
data: {
values: data
},
"labels": {
"outer": {
"pieDistance": 32
},
"inner": {
//"format": "percentage", // "value",
//"hideWhenLessThanPercentage": 0 // 2 // 100 // 2
"format": "value",
"hideWhenLessThanPercentage": 5 // 100 // 2
},
"mainLabel": {
"fontSize": 10.5
mark: "bar",
encoding: {
x: {
field: "area",
type: "nominal",
sort: null,
axis: { title: null }
},
"percentage": {
"color": "#ffffff",
"decimalPlaces": 0
y: {
field: "value",
type: "quantitative",
axis: { title: null }
},
"value": {
"color": "#ffffff",
"fontSize": 10
},
"lines": {
"enabled": true
},
"truncation": {
"enabled": true
tooltip: [
{ "field": "area", "type": "nominal", "title": "Area" },
{ "field": "value", "type": "quantitative", "title": "Count" }
],
color: {
field: "area",
type: "nominal",
scale: { "range": colors },
legend: null
}
},
"effects": {
"load": {
"effect": "none"
},
"pullOutSegmentOnClick": {
"effect": "linear",
"speed": 400,
"size": 8
}
},
"misc": {
"gradient": {
"enabled": true,
"percentage": 100
}
}
width: 420,
height: 80,
padding: { left: 25, top: 3 }
};
vegaEmbed(`div[id="${name}-chart"]`, vegaLiteSpec, {
actions: false,
});
}
displayProgress(step) {
Expand Down Expand Up @@ -1024,7 +991,7 @@ class CSRankings {
p += '<img alt="DBLP" src="dblp.png">'
+ '</a>';
p += `<span onclick='csr.toggleChart("${escape(name)}");' title="Click for author's publication profile." class="hovertip" id="${escape(name) + '-chartwidget'}">`;
p += "<span class='piechart'>" + this.PieChart + "</span></span>"
p += this.BarChart + "</span>"
+ '</small>'
+ '</td><td align="right"><small>'
+ '<a title="Click for author\'s DBLP entry." target="_blank" href="'
Expand All @@ -1041,7 +1008,7 @@ class CSRankings {
+ (Math.round(10.0 * facultyAdjustedCount[name]) / 10.0).toFixed(1)
+ "</small></td></tr>"
+ "<tr><td colspan=\"4\">"
+ '<div class="csr-piechart" id="' + escape(name) + "-chart" + '">'
+ '<div class="csr-barchart" id="' + escape(name) + "-chart" + '">'
+ '</div>'
+ "</td></tr>";
}
Expand Down Expand Up @@ -1108,14 +1075,14 @@ class CSRankings {
}
s += "&nbsp;" + dept + `&nbsp;<img src="/flags/${abbrv}.png">&nbsp;`
+ "<span class=\"hovertip\" onclick=\"csr.toggleChart('" + esc + "');\" id=\"" + esc + "-chartwidget\">"
+ this.PieChart + "</span>";
+ this.BarChart + "</span>";
s += "</td>";
s += '<td align="right">' + (Math.round(10.0 * v) / 10.0).toFixed(1) + "</td>";
s += '<td align="right">' + deptCounts[dept]; /* number of faculty */
s += "</td>";
s += "</tr>\n";
// style="width: 100%; height: 350px;"
s += '<tr><td colspan="4"><div class="csr-piechart" id="'
s += '<tr><td colspan="4"><div class="csr-barchart" id="'
+ esc + '-chart">' + '</div></td></tr>';
s += '<tr><td colspan="4"><div style="display:none;" id="' + esc + '-faculty">' + univtext[dept] + '</div></td></tr>';
ties++;
Expand Down Expand Up @@ -1215,12 +1182,12 @@ class CSRankings {
if (chart.style.display === 'block') {
chart.style.display = 'none';
chart.innerHTML = '';
chartwidget.innerHTML = this.PieChart;
chartwidget.innerHTML = this.BarChart;
}
else {
chart.style.display = 'block';
this.makeChart(name);
chartwidget.innerHTML = this.OpenPieChart;
chartwidget.innerHTML = this.OpenBarChart;
}
}
/* Expand or collape the view of conferences in a given area. */
Expand Down
Loading

0 comments on commit f1c800d

Please sign in to comment.