-
Notifications
You must be signed in to change notification settings - Fork 39
/
Copy pathVIS.js
175 lines (173 loc) · 5.88 KB
/
VIS.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
/*global d3, utils */
"use strict";
// declaration of global object (modified by dfb().load())
var VIS = {
files: { // what data files to request
info: "data/info.json",
meta: "data/meta.csv.zip", // remove .zip to use uncompressed data
dt: "data/dt.json.zip", // (name the actual file accordingly)
tw: "data/tw.json",
topic_scaled: "data/topic_scaled.csv"
},
aliases: { // simple aliasing in URLs:
yearly: "conditional" // #/model/yearly/... -> #/model/conditional/...
},
default_view: "/model", // specify the part after the #
metadata: {
type: "dfr", // use "base" if meta.csv has a header
spec: {
extra_fields: [ ],// (dfr type only) names for extra columns
date_field: "date"// field(s) to convert to Date type
}
},
condition: { // metadata variable to condition topics on
type: "time", // alternatives: "category" and "continuous"
spec: {
field: "date", // name of metadata field
unit: "year", // unit of time bins
n: 1 // width of time bins
// format: "%Y-%m" // optional display format (strftime)
}
},
// proper: false // are doc-topic weights normalized?
// (set only if dfr-browser guesses wrong)
overview_words: 15, // may need adjustment
model_view: {
plot: {
w: 500, // px: the minimum svg width
aspect: 1.3333, // for calculating height
words: 6, // maximum: may need adjustment
size_range: [7, 18], // points. may need adjustment
name_size: 18, // points
stroke_range: 6 // max. perimeter thickness
// cols: 8 // can explicitly specify # of grid columns
// rows: [4, 5, 4] // OR just list how many circles in each row
// // (must sum to # of topics)
// indents: [ 0.5, 0, 0.5 ] // AND/OR: x origin of each row
},
conditional: {
w: 500, // px: the minimum svg width
aspect: 1.333,
m: {
left: 20,
right: 20,
top: 20,
bottom: 30
},
label_threshold: 40, // px
words: 4,
label_words: 2, // should be <= words
streamgraph: true, // streamgraph or stack areas from x-axis?
ordinal: { // ordinal variable: stacked bars, not areas
bar: 0.4 // bar width as proportion
}
},
list: {
spark: { // same form as topic_view plot parameters below
w: 70,
h: 20,
m: {
left: 2,
right: 2,
top: 2,
bottom: 2
},
time: {
bar: {
unit: "day",
w: 300
}
},
ordinal: {
bar: {
w: 0.25
}
},
continuous: {
bar: {
w: 0.25
}
}
}
}
},
topic_view: {
words: 50,
docs: 20,
w: 400, // minimum in px
aspect: 3,
m: {
left: 40,
right: 20,
top: 20,
bottom: 30
},
time: { // conditional plot x-axis settings: time variable
bar: { // width of bars
unit: "day", // unit is used as d3.time[unit].utc
w: 90
},
ticks: 10 // number of x-axis ticks
// ticks: { // alternatively, can specify interval b/w ticks
// unit: "year",
// n: 10
//}
},
continuous: { // continuous variable: step is calculated automatically
bar: {
w: 0.25, // proportion: how much x-axis bar takes up
},
ticks: 10
},
ordinal: { // categorical variable: step is calculated automatically
bar: {
w: 0.25 // proportion
},
ticks: 10
},
ticks_y: 10, // y axis ticks
tx_duration: 1000 // animated transition time in ms (where applicable)
},
word_view: {
n_min: 10, // words per topic
topic_label_padding: 8, // pt
topic_label_leading: 14, // pt
row_height: 80, // pt
svg_rows: 10, // * row_height gives min. height for svg element
w: 700, // px: minimum width
m: {
left: 100,
right: 40,
top: 20,
bottom: 0
}
},
bib: {
type: "dfr", // use "base" for bare-bones src/bib.js
spec: {
// default if no author delimiter supplied, but note that
// 2014 JSTOR metadata format uses ", " instead
author_delimiter: "\t",
// "et al" is better for real bibliography, but it's
// actually worth being able to search all the multiple authors
et_al: Infinity,
anon: "[Anon]",
}
},
bib_view: {
window_lines: 100,
major: "year", // for bib.type "base", use "all"
minor: "authortitle", // for bib.type "base", use "raw"
dir: "up"
},
tooltip: { // tooltip div parameters
offset: {
x: 10, // px
y: 0
}
},
percent_format: ".1%", // d3.format for percentages
resize_refresh_delay: 100, // ms
hidden_topics: [], // list of 1-based topic numbers to suppress
show_hidden_topics: false
};