-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsettings_explorerjs.js
More file actions
335 lines (259 loc) · 13.3 KB
/
settings_explorerjs.js
File metadata and controls
335 lines (259 loc) · 13.3 KB
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
'use strict;'
var TW = {}
TW.conf = (function(TW){
let TWConf = {}
TWConf.branding = {
'name': 'ProjectExplorer', // <--- name displayed in upper left
'link': 'http://iscpif.fr', // home link
'video': 'https://player.vimeo.com/video/38383946' // video link
}
// ==========================
// TINA POSSIBLE DATA SOURCES
// ==========================
// Graph data source
// -----------------
// the graph input depends on TWConf.sourcemode (or manual url arg 'sourcemode')
TWConf.sourcemode = "servermenu" // accepted: "api" | "serverfile" | "servermenu" | "localfile"
// ...or remote bridge to default source api ajax queries
TWConf.sourceAPI={}
TWConf.sourceAPI["nodetypes"] = {"node0": "Keywords", "node1": "Scholars" }
TWConf.sourceAPI["forNormalQuery"] = "services/api/graph"
TWConf.sourceAPI["forFilteredQuery"] = "services/api/graph"
// Related documents (topPapers) data source
// -----------------------------------------
TWConf.getRelatedDocs = true
TWConf.relatedDocsMax = 10
// fallback type (if no detailed source-by-source conf from db.json)
TWConf.relatedDocsType = "csv" // accepted: "twitter" | "csv" | "CortextDB"
// POSSible: "elastic"
// routes by corresponding type
TWConf.relatedDocsAPIS = {
"twitter": "/twitter_search",
"CortextDB": "twbackends/phpAPI",
"csv": "twbackends/phpAPI"
}
// fallback topPapers API if none found by type
TWConf.relatedDocsAPI = "twbackends/phpAPI"
// =======================
// DATA FACETS AND LEGENDS
// =======================
// to process node attributes values from data
// => colors (continuous numeric attributes)
// => clusters (discrete numeric or str attributes)
// cf. also "Configuring facets" in the doc under Introduction/project_config
// create facets ?
TWConf.scanAttributes = true
// use a facet for default color
TWConf.defaultColoring = "clust_louvain"
// facetOptions: choose here the default visual result of your node attributes
// ---------------------------------------------------------------------------
// (values overridden by data/myproject/project_conf.json "facets" if present)
TWConf.defaultFacetOptions = {
// attr title coloring fun nbins binning strategy label in menus
'auto-size' : {'col': "gradient", 'n': 6, 'binmode': 'samerange', 'legend': 'Auto Size' },
'auto-degree' : {'col': "heatmap", 'n': 7, 'binmode': 'samepop', 'legend': 'Auto Degree'},
'auto-indegree' : {'col': "heatmap", 'n': 7, 'binmode': 'samepop', 'legend': 'Auto InDegree'},
'auto-outdegree' : {'col': "heatmap", 'n': 7, 'binmode': 'samepop', 'legend': 'Auto OutDegree'},
'cluster_index' : {'col': "cluster" , 'binmode': 'off' },
'clust_louvain' : {'col': "cluster" , 'binmode': 'off',
'legend':'Louvain clustering', 'titlingMetric': 'auto-size'},
'country':{
'col':"cluster" ,
'binmode': 'off',
'legend': 'Country',
'titlingMetric': 'off'
},
'total_occurrences':{
'col':"heatmap" ,
'binmode': 'samerange',
'n': 3,
'legend': 'Total occurrences'
}
}
// NB automatic cases with no binning:
// - if data type is not numeric
// - if there is less than distinct values that maxDiscreteValues
// NB for heatmapColoring:
// - if number of bins is even, the 2 classes in the middle get white
// - the maximum number of bins is 24
// when coloring method is "cluster", should the colors change each time ?
TWConf.randomizeClusterColors = true
// default clustering attribute (<---> used for initial node colors)
TWConf.nodeClusAtt = "modularity_class"
// for binning decision and nbins (fallbacks if attr is not in facetOptions)
TWConf.maxDiscreteValues = 15
TWConf.legendsBins = 7
// to normalize node sizes (larger range max-min increases visual size difference)
// (larger min increases overall visual size)
TWConf.desirableNodeSizeMin=3000;
TWConf.desirableNodeSizeMax=3010;
// =============
// TINA BEHAVIOR
// =============
// Node typology: categories (resp. 0 and 1) will get these default labels
TWConf.catSem = "NGram";
TWConf.catSoc = "Document";
// NB: these labels may be superseded by:
// - the input data's node types values cf. sortNodeTypes()
// - in project_conf.md the node0 & node1 properties
// Modules path
// ------------
TWConf.paths = {
'ourlibs': 'twlibs',
'modules': 'twmodules',
'templates': 'twlibs/default_hit_templates', // some default templates
'sourceFile': null, // server: 1 default gexf|json graph source
'sourceMenu': "server_menu.json" // ...or server: a gexf|json sources list
}
// Active modules
// --------------
TWConf.ModulesFlags = {} ;
// flag name is div class to be removed if false
// *and* subdirectory of modules path to import if true
// see also activateModules()
TWConf.ModulesFlags["multivacV1HistogramModule"] = true ;
// cf. twmodules/multivacV2HistogramModule/multivacV2Settings.js for settings
TWConf.ModulesFlags["multivacV2HistogramModule"] = false ;
// cf. twmodules/crowdsourcingModule/README.md to initialize the associated db
TWConf.ModulesFlags["crowdsourcingModule"] = true ;
// create the automated exploration instance (in 'demo' var)
TWConf.ModulesFlags["demoFSAModule"] = true ;
// Other GUI options
// ------------------
TWConf.sidePanelSize = "400px" // width of the side panel (def: 400px)
TWConf.filterSliders = true // show sliders for nodes/edges subsets
TWConf.colorByAtt = true; // show "Set colors" menu
TWConf.tuningPanel = true; // show "Tune settings" menu button
TWConf.dragNodesAvailable = true; // allow dragging nodes with CTRL+click
TWConf.deselectOnClickStage = false // click on background remove selection?
// (except when dragging)
TWConf.deselectOnDoubleClickStage = true // idem double click on background
TWConf.histogramStartThreshold = 10 ; // for daily histo module
// (from how many docs are significant)
// £TODO these exist only in git branches
// (geomap: ademe, timeline: tweetoscope)
// ==> ask if need to be restored
// TW.geomap = false;
// TW.twittertimeline = false;
TWConf.maxPastStates = 15 ; // number of TW.states to remember (~CTRL-Z)
// Layout options
// --------------
TWConf.disperseAvailable=true; // show/hide disperseButton
TWConf.fa2Available=true; // show/hide fa2Button
// if fa2Available, the auto-run config:
TWConf.fa2Enabled= true; // fa2 auto-run at start and after graph modified ?
TWConf.fa2Milliseconds=900; // constant factor in duration of auto-run
TWConf.fa2AdaptDuration=true; // duration of auto-run proportional log(nEdges)
TWConf.minNodesForAutoFA2 = 5 // graph size threshold to auto-run
TWConf.fa2SlowerMeso = true // slow down meso if few nodes
// Full-text search
// ----------------
TWConf.maxSearchResults = 10 // how many "top papers" to display
TWConf.minLengthAutoComplete = 1 // how many chars to type for autocomp
TWConf.maxSuggestionsAutoComplete = 10 // how many suggestions by autocomp
TWConf.strSearchBar = "Select topics"
// ===================
// RENDERING SETTINGS
// ===================
TWConf.twRendering = true ; // false: use sigma "stock" rendering
// true: use our rendering customizations
// (nodes with borders,
// edges with curves,
// better labels, etc)
TWConf.overSampling = true // hi-def rendering (true => pixelRatio x 2)
// (/!\ costly)
TWConf.stablePositions = true // remember overall positions for all types
// (and when layouts are called,
// all types are moving together
// even when some are hidden)
TWConf.independantTypes = true // if stablePositions, types are not moving together
TWConf.colorTheme = "24DivergingZeileis" // color palette for clusters
// - "9CBrewerSet1"
// - "12CBrewerPaired",
// - "22Kelly"
// - "24DivergingZeileis"
// - "24ContrastedPastel"
// - "50Fluo"
// - "50Pastel"
// - "80Pastel"
// - "128Tina"
// sigma rendering settings
// ------------------------
TWConf.sigmaJsDrawingProperties = {
// nodes
defaultNodeColor: "#ddd",
twNodeRendBorderSize: 1, // node borders (only iff ourRendering)
twNodeRendBorderColor: "#222",
// edges
minEdgeSize: 1, // in fact used in tina as edge size
defaultEdgeType: 'curve', // 'curve' or 'line' (curve only iff ourRendering)
twEdgeDefaultOpacity: 0.4, // initial opacity added to src/tgt colors
// labels
font: "Droid Sans", // font params
fontStyle: "bold",
defaultLabelColor: '#000', // labels text color
labelSizeRatio: 1, // label size in ratio of node size
labelThreshold: 4, // min node cam size to start showing label
// (old tina: showLabelsIfZoom)
// hovered nodes
// -------------
twDefaultBGBoxColor: '#fff', // common value for hovered/selected
// label box bg def color
defaultHoverLabelColor: '#000',
borderSize: 2.5, // for ex, bigger border when hover
nodeBorderColor: "node", // choices: 'default' color vs. node color
defaultNodeBorderColor: "black", // <- if nodeBorderColor = 'default'
labelHoverBGColor: "default", // "node" for a label bg like the node color,
// "default" for a bg with defaultBGBoxColor
// selected nodes
// --------------
twSelectedBGColor: "default", // "node" for a label bg like the node color,
// "default" for a bg with defaultBGBoxColor
// not selected <=> (1-greyness)
twNodesGreyOpacity: .5, // smaller value: more grey
twBorderGreyColor: "rgba(100, 100, 100, 0.5)",
twEdgeGreyColor: "rgba(100, 100, 100, 0.25)",
};
// NB: sigmaJsDrawingProperties are available as 'settings' in all renderers
// cf. https://github.com/jacomyal/sigma.js/wiki/Settings#renderers-settings
// tina environment rendering settings
// -----------------------------------
// normal and meso level background colors
TWConf.normalBackground = '#fff' // <= should match css default
TWConf.mesoBackground = '#fcfcd5'
// mouse captor zoom limits
TWConf.zoomMin = 1/64 // for zoom IN (ex: 1/64 to allow zoom x64)
TWConf.zoomMax = 8 // for zoom OUT
// NB these "inverted" semantics are based on sigma's own zoomMin and zoomMax
// cf. https://github.com/jacomyal/sigma.js/wiki/Settings#captors-settings
// circle selection cursor
TWConf.circleSizeMin = 0;
TWConf.circleSizeMax = 200;
TWConf.moreLabelsUnderArea = true; // show 3x more labels under area (/!\ costly)
// em size range for neighbor nodes "tagcloud" (1 = "normal size")
TWConf.tagcloudFontsizeMin = .8 ;
TWConf.tagcloudFontsizeMax = 1.5 ;
TWConf.tagcloudSameLimit = 50 // max displayed neighbors of the same type
TWConf.tagcloudOpposLimit = 50 // max displayed neighbors of the opposite type
// relative sizes (iff ChangeType == both nodetypes)
TWConf.sizeMult = [];
TWConf.sizeMult[0] = 2.0; // ie for node type 0 (<=> sem)
TWConf.sizeMult[1] = 1.0; // ie for node type 1 (<=> soc)
// ===========
// DEBUG FLAGS
// ===========
TWConf.debug = {
initialShowAll: false, // show all nodes on bipartite case init (docs + terms in one view)
// show verbose console logs...
logFetchers: false, // ...about ajax/fetching of graph data
logParsers: false, // ...about parsing said data
logFacets: false, // ...about parsing node attribute:value facets
logSettings: false, // ...about settings at Tina and Sigma init time
logStates: false, // ...about TW.states array
logSelections: false
}
Object.freeze(TWConf.paths) // /!\ to prevent path modification before load
Object.freeze(TWConf.branding) // idem
return TWConf
})()
console.log("TW.conf load OK")