-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathindex.html
175 lines (155 loc) · 4.94 KB
/
index.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
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
<!DOCTYPE html>
<html>
<head>
<title>Navio example: IEEEVIS Publications</title>
<link
rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css"
integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS"
crossorigin="anonymous"
/>
<style>
body {
font-family: sans-serif;
}
table td,
table th {
padding-right: 10px;
}
td.title {
font-size: 9pt;
}
#navio {
overflow-x: scroll;
}
</style>
</head>
<body>
<div class="container-fluid">
<h1>IEEEVIS Publications 1990-2018</h1>
<div>
Try this on
<a href="https://observablehq.com/@john-guerra/navio"
>an observable Notebook</a
>
</div>
<!-- Placeholder for the widget -->
<div class="row">
<div class="col-12" id="navio">
<h3>Loading 5MB of data, please wait.</h3>
</div>
</div>
<div class="row">
<div class="col-9">
<h2>Papers Selected</h2>
<span id="paperCount"></span>
<table>
<tr>
<th>Title</th>
<th>Conference</th>
<th>Year</th>
<th>XPloreCitationCount_02-2019</th>
</tr>
<tbody id="papers"></tbody>
</table>
</div>
<div class="col-3">
<div id="papersByYear"></div>
<div id="citationsByYear"></div>
</div>
</div>
</div>
<!-- Step 0: Load the libraries -->
<script src="https://d3js.org/d3.v7.js"></script>
<script src="https://unpkg.com/[email protected]/dist/umd/popper.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/build/vega.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/build/vega-lite.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/build/vega-embed.js"></script>
<script src="https://unpkg.com/navio/dist/navio.js"></script>
<!-- <script src="../dist/navio.js"></script> -->
<script>
/* global d3, navio */
var color = d3.scaleOrdinal(d3.schemeSet2);
// Step 1. Create a navio passing the selector to place it and the height
var nn = navio(d3.select("#navio"), 400);
// Step 1.5 (Optional) Set parameters
nn.attribWidth = 18;
nn.attribFontSize = 13;
nn.y0 = 150;
// nn.showSelectedAttrib = false;
// nn.showSequenceIDAttrib = false;
d3.csv(
"./IEEE VIS papers 1990-2018 - Main dataset.csv",
d3.autoType
).then(function(data) {
// Step 2. Load your data!
nn.data(data);
// Step 3 Let's add Conference manually, so we can use custom color scale shared with vega
nn.addCategoricalAttrib("Conference", color);
// Step 3.5 Autodetect the remaining attributes
nn.addAllAttribs();
// Step 4 (optional) add a callback for when updating
nn.updateCallback(populateTableAndVis);
populateTableAndVis(data);
});
function populateTableAndVis(data) {
const NumPaperToShow = 20;
d3.select("#paperCount").text(
`Showing ${NumPaperToShow} out of ${data.length}`
);
d3.select("#papers")
.selectAll("tr")
.remove();
let trs = d3
.select("#papers")
.selectAll("tr")
.data(data.slice(0, NumPaperToShow))
.enter()
.append("tr");
trs
.append("td")
.attr("class", "title")
.text(d => d.Title);
trs.append("td").text(d => d.Conference);
trs.append("td").text(d => d.Year);
trs.append("td").text(d => d["XPloreCitationCount_02-2019"]);
var paperByYear = {
data: { values: data },
mark: "line",
title: "Paper counts per year",
encoding: {
x: { field: "Year", type: "quantitative" },
y: { aggregate: "count", type: "quantitative" },
color: {
field: "Conference",
type: "nominal",
scale: {
domain: color.domain(),
range: color.range()
}
}
}
};
var citationsByYear = {
data: { values: data },
mark: "circle",
title: "Paper Year vs Citations",
encoding: {
x: { field: "Year", type: "quantitative", scale: { zero: false } },
y: { field: "XPloreCitationCount_02-2019", type: "quantitative" },
color: {
field: "Conference",
type: "nominal",
scale: {
domain: color.domain(),
range: color.range()
}
}
}
};
vegaEmbed("#papersByYear", paperByYear);
vegaEmbed("#citationsByYear", citationsByYear);
}
</script>
</body>
</html>