forked from idescat/visual
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvisual.setup.js
350 lines (337 loc) · 12.8 KB
/
visual.setup.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
/*
Copyright (c) 2013 Institut d'Estadistica de Catalunya (Idescat)
http://www.idescat.cat (https://github.com/idescat/visual)
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
VisualJS.setup={
//Colors for maps and series
colors: {
map: {
max: 100,
base: "#09111a"
},
series: ["#2b527b", "#a52a2a", "#008000", "#ffbf00"]
},
//Default options (They can be dynamically modified thru visual().)
canvas: {
unit : {
label: "",
symbol: "",
position: "end"
},
legend: true,
grid: {
width: 0
}, //grid width
axis: { //show axes?
x: true,
y: true
},
dec: null, //Show only needed decimals (remove ending zeros) unless (recommended) valid dec has been specified by user
autoheading: true,
filter: 0.05 //Used in color assignation in maps
},
//Internationalization options
i18n: {
lang: "ca", //default lang when no lang is specified
text: {
dec: { //decimal separator
ca: ",",
es: ",",
en: "."
},
k: { //thousands separator
ca: ".",
es: ".",
en: ","
},
month: { //Month axis labels
ca: ["Gen", "Feb", "Mar", "Abr", "Mai", "Jun", "Jul", "Ago", "Set", "Oct", "Nov", "Des"],
es: ["Ene", "Feb", "Mar", "Abr", "May", "Jun", "Jul", "Ago", "Sep", "Oct", "Nov", "Dic"],
en: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
},
quarter: { //Quarter axis labels
ca: ["I", "II", "III", "IV"],
es: ["I", "II", "III", "IV"],
en: ["Q1", "Q2", "Q3", "Q4"]
},
na: { //text in tooltip when value is not available
ca: "Valor no disponible",
es: "Valor no disponible",
en: "Value not available"
},
oldbrowser: { //Warning message when IE<9 (maps)
ca: "Per visualitzar el mapa cal un navegador més modern.",
es: "Para visualizar el mapa es preciso un navegador más moderno.",
en: "To view the map you must use a modern browser."
}
}
},
//Classes and ids of elements created by visual
id: "visual", //id to style the container
clas: "visual", //class to style the container
tooltipid: "VisualJSTooltip", //id to style the tooltip
nowrapclass: "VisualJSnw", //class to define blocks of wrappable content in the title
canvasclass: "VisualJScanvas", //canvas container (Flot)
areaclass: "VisualJSarea", //svg:g class (D3 maps)
legendclass: "VisualJSlegend", //svg:g class (D3 maps)
normal: "VisualJSnormal", //visualitzation's normal size class
mini: "VisualJSmini", //visualitzation's small size class
//Markup created by visual
html: {
heading: "h1",
footer: "p" //"footer" element not supported by IE8
},
//Libraries: path and existence function
main: { //Do not use relative paths for main files in production: they'll be relative to the path where VisualJS.iframe is executed.
visual: "../visual.js",
setup: "../visual.setup.js",
lazy: "../lib/lazyload.js"
},
lib: {
d3: {
js: "../lib/d3.v3.js",
exists: function(){ return typeof d3==="object"; },
},
jquery: {
js: "../lib/jquery.1.8.3.js",
exists: function(){ return typeof jQuery==="function"; },
flot: {
js: "../lib/jquery.flot.js",
exists: function(){ return typeof jQuery.plot==="function"; },
stack: {
js: "../lib/jquery.flot.stack.js",
exists: function(){ return typeof jQuery.plot.plugins==="object" && typeof jQuery.plot.plugins[0]==="object" && jQuery.plot.plugins[0].name==="stack"; }//De moment no s'utilitza simultàniament amb cap altre plugin de Flot per tant és el primer.
},
orderbars: {
js: "../lib/jquery.flot.orderbars.js",
exists: function(){ return typeof jQuery.plot.plugins==="object" && typeof jQuery.plot.plugins[0]==="object" && jQuery.plot.plugins[0].name==="orderBars"; }//De moment no s'utilitza simultàniament amb cap altre plugin de Flot per tant és el primer.
},
pyramid: {
js: "../lib/jquery.flot.pyramid.js",
exists: function(){ return typeof FlotPyramid==="object"; }
},
categories: {
js: "../lib/jquery.flot.categories.js",
exists: function(){ return typeof jQuery.plot.plugins==="object" && typeof jQuery.plot.plugins[0]==="object" && jQuery.plot.plugins[0].name==="categories"; } //De moment no s'utilitza simultàniament amb cap altre plugin de Flot per tant és el primer.
}
}
},
maps: {
js: "../maps/visual.maps.js",
exists: function(){ return typeof VisualJS.func.colors==="function" && typeof VisualJS.func.legend==="function";}
},
excanvas: {
js: "../lib/excanvas.js",
exists: function(){ return typeof G_vmlCanvasManager!=="undefined"; }
}
},
//Maps: path and existence function
map: {
mun: {
js: "../maps/cat2013mun.js",
exists: function(){ return typeof VisualJS.map.mun!=="undefined" && VisualJS.map.mun.id==="MUNICIPI"; }
},
com: {
js: "../maps/cat2013com.js",
exists: function(){ return typeof VisualJS.map.com!=="undefined" && VisualJS.map.com.id==="COMARCA"; }
},
prov: {
js: "../maps/cat2013prov.js",
exists: function(){ return typeof VisualJS.map.prov!=="undefined" && VisualJS.map.prov.id==="PROVINCIA"; }
},
usastates: {
js: "../maps/usa2013states.js",
exists: function(){ return typeof VisualJS.map.usastates!=="undefined" && VisualJS.map.usastates.id==="STATE"; }
},
com01: {
js: "../maps/com012013mun.js",
exists: function(){ return typeof VisualJS.map.com01!=="undefined" && VisualJS.map.com01.id==="MUNICIPI"; }
},
com02: {
js: "../maps/com022013mun.js",
exists: function(){ return typeof VisualJS.map.com02!=="undefined" && VisualJS.map.com02.id==="MUNICIPI"; }
},
com03: {
js: "../maps/com032013mun.js",
exists: function(){ return typeof VisualJS.map.com03!=="undefined" && VisualJS.map.com03.id==="MUNICIPI"; }
},
com04: {
js: "../maps/com042013mun.js",
exists: function(){ return typeof VisualJS.map.com04!=="undefined" && VisualJS.map.com04.id==="MUNICIPI"; }
},
com05: {
js: "../maps/com052013mun.js",
exists: function(){ return typeof VisualJS.map.com05!=="undefined" && VisualJS.map.com05.id==="MUNICIPI"; }
},
com06: {
js: "../maps/com062013mun.js",
exists: function(){ return typeof VisualJS.map.com06!=="undefined" && VisualJS.map.com06.id==="MUNICIPI"; }
},
com07: {
js: "../maps/com072013mun.js",
exists: function(){ return typeof VisualJS.map.com07!=="undefined" && VisualJS.map.com07.id==="MUNICIPI"; }
},
com08: {
js: "../maps/com082013mun.js",
exists: function(){ return typeof VisualJS.map.com08!=="undefined" && VisualJS.map.com08.id==="MUNICIPI"; }
},
com09: {
js: "../maps/com092013mun.js",
exists: function(){ return typeof VisualJS.map.com09!=="undefined" && VisualJS.map.com09.id==="MUNICIPI"; }
},
com10: {
js: "../maps/com102013mun.js",
exists: function(){ return typeof VisualJS.map.com10!=="undefined" && VisualJS.map.com10.id==="MUNICIPI"; }
},
com11: {
js: "../maps/com112013mun.js",
exists: function(){ return typeof VisualJS.map.com11!=="undefined" && VisualJS.map.com11.id==="MUNICIPI"; }
},
com12: {
js: "../maps/com122013mun.js",
exists: function(){ return typeof VisualJS.map.com12!=="undefined" && VisualJS.map.com12.id==="MUNICIPI"; }
},
com13: {
js: "../maps/com132013mun.js",
exists: function(){ return typeof VisualJS.map.com13!=="undefined" && VisualJS.map.com13.id==="MUNICIPI"; }
},
com14: {
js: "../maps/com142013mun.js",
exists: function(){ return typeof VisualJS.map.com14!=="undefined" && VisualJS.map.com14.id==="MUNICIPI"; }
},
com15: {
js: "../maps/com152013mun.js",
exists: function(){ return typeof VisualJS.map.com15!=="undefined" && VisualJS.map.com15.id==="MUNICIPI"; }
},
com16: {
js: "../maps/com162013mun.js",
exists: function(){ return typeof VisualJS.map.com16!=="undefined" && VisualJS.map.com16.id==="MUNICIPI"; }
},
com17: {
js: "../maps/com172013mun.js",
exists: function(){ return typeof VisualJS.map.com17!=="undefined" && VisualJS.map.com17.id==="MUNICIPI"; }
},
com18: {
js: "../maps/com182013mun.js",
exists: function(){ return typeof VisualJS.map.com18!=="undefined" && VisualJS.map.com18.id==="MUNICIPI"; }
},
com19: {
js: "../maps/com192013mun.js",
exists: function(){ return typeof VisualJS.map.com19!=="undefined" && VisualJS.map.com19.id==="MUNICIPI"; }
},
com20: {
js: "../maps/com202013mun.js",
exists: function(){ return typeof VisualJS.map.com20!=="undefined" && VisualJS.map.com20.id==="MUNICIPI"; }
},
com21: {
js: "../maps/com212013mun.js",
exists: function(){ return typeof VisualJS.map.com21!=="undefined" && VisualJS.map.com21.id==="MUNICIPI"; }
},
com22: {
js: "../maps/com222013mun.js",
exists: function(){ return typeof VisualJS.map.com22!=="undefined" && VisualJS.map.com22.id==="MUNICIPI"; }
},
com23: {
js: "../maps/com232013mun.js",
exists: function(){ return typeof VisualJS.map.com23!=="undefined" && VisualJS.map.com23.id==="MUNICIPI"; }
},
com24: {
js: "../maps/com242013mun.js",
exists: function(){ return typeof VisualJS.map.com24!=="undefined" && VisualJS.map.com24.id==="MUNICIPI"; }
},
com25: {
js: "../maps/com252013mun.js",
exists: function(){ return typeof VisualJS.map.com25!=="undefined" && VisualJS.map.com25.id==="MUNICIPI"; }
},
com26: {
js: "../maps/com262013mun.js",
exists: function(){ return typeof VisualJS.map.com26!=="undefined" && VisualJS.map.com26.id==="MUNICIPI"; }
},
com27: {
js: "../maps/com272013mun.js",
exists: function(){ return typeof VisualJS.map.com27!=="undefined" && VisualJS.map.com27.id==="MUNICIPI"; }
},
com28: {
js: "../maps/com282013mun.js",
exists: function(){ return typeof VisualJS.map.com28!=="undefined" && VisualJS.map.com28.id==="MUNICIPI"; }
},
com29: {
js: "../maps/com292013mun.js",
exists: function(){ return typeof VisualJS.map.com29!=="undefined" && VisualJS.map.com29.id==="MUNICIPI"; }
},
com30: {
js: "../maps/com302013mun.js",
exists: function(){ return typeof VisualJS.map.com30!=="undefined" && VisualJS.map.com30.id==="MUNICIPI"; }
},
com31: {
js: "../maps/com312013mun.js",
exists: function(){ return typeof VisualJS.map.com31!=="undefined" && VisualJS.map.com31.id==="MUNICIPI"; }
},
com32: {
js: "../maps/com322013mun.js",
exists: function(){ return typeof VisualJS.map.com32!=="undefined" && VisualJS.map.com32.id==="MUNICIPI"; }
},
com33: {
js: "../maps/com332013mun.js",
exists: function(){ return typeof VisualJS.map.com33!=="undefined" && VisualJS.map.com33.id==="MUNICIPI"; }
},
com34: {
js: "../maps/com342013mun.js",
exists: function(){ return typeof VisualJS.map.com34!=="undefined" && VisualJS.map.com34.id==="MUNICIPI"; }
},
com35: {
js: "../maps/com352013mun.js",
exists: function(){ return typeof VisualJS.map.com35!=="undefined" && VisualJS.map.com35.id==="MUNICIPI"; }
},
com36: {
js: "../maps/com362013mun.js",
exists: function(){ return typeof VisualJS.map.com36!=="undefined" && VisualJS.map.com36.id==="MUNICIPI"; }
},
com37: {
js: "../maps/com372013mun.js",
exists: function(){ return typeof VisualJS.map.com37!=="undefined" && VisualJS.map.com37.id==="MUNICIPI"; }
},
com38: {
js: "../maps/com382013mun.js",
exists: function(){ return typeof VisualJS.map.com38!=="undefined" && VisualJS.map.com38.id==="MUNICIPI"; }
},
com39: {
js: "../maps/com392013mun.js",
exists: function(){ return typeof VisualJS.map.com39!=="undefined" && VisualJS.map.com39.id==="MUNICIPI"; }
},
com40: {
js: "../maps/com402013mun.js",
exists: function(){ return typeof VisualJS.map.com40!=="undefined" && VisualJS.map.com40.id==="MUNICIPI"; }
},
com41: {
js: "../maps/com412013mun.js",
exists: function(){ return typeof VisualJS.map.com41!=="undefined" && VisualJS.map.com41.id==="MUNICIPI"; }
}
},
//IE check
func: {
old: function(ie) { return RegExp("(^|\\s)lt-"+ie+"(\\s|$)").test(document.documentElement.className); }
},
//Margins and paddings used in container
margin: 10,
padding: {
w: 30,
h: 45
}
};