jqvmap-rails 1.1.2.2 → 2.1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/jqvmap-rails/version.rb +1 -1
- data/vendor/assets/javascripts/jquery.vmap.js +1100 -0
- data/vendor/assets/stylesheets/jqvmap.css +56 -0
- metadata +3 -3
- data/vendor/assets/javascripts/jquery-jvectormap.js +0 -8
- data/vendor/assets/stylesheets/jquery-jvectormap.css +0 -37
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 16e6a0aaaace8bd2022dcdcad84a5dc11282331e
|
4
|
+
data.tar.gz: 45979053244bb858927337ae6e701b63ec3fb0d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d63c258a3b78c141b08ccaba2d0c3145ae45aa2aa954fba994c6bab8630ee734f0ce67294fe91e13c2423e3180b771779827fd415d56467c491218a746fd6afb
|
7
|
+
data.tar.gz: 7376dbfeccd3096a739f27ef7de00bc430e405aac784cf039fb88b017ed8b50cce1c94bd5de0df83dcbca0232f9a5454d92b0255fe5c858cfea772cbdea62b15
|
data/README.md
CHANGED
@@ -14,12 +14,12 @@ gem 'jqvmap-rails'
|
|
14
14
|
|
15
15
|
add to your application.js
|
16
16
|
```ruby
|
17
|
-
//= require jquery
|
17
|
+
//= require jquery.vmap
|
18
18
|
```
|
19
19
|
|
20
20
|
add to your application.css
|
21
21
|
```ruby
|
22
|
-
*= require
|
22
|
+
*= require jqvmap
|
23
23
|
```
|
24
24
|
|
25
25
|
jQuery Vector Map
|
data/lib/jqvmap-rails/version.rb
CHANGED
@@ -0,0 +1,1100 @@
|
|
1
|
+
/*!
|
2
|
+
* jQVMap Version 1.0
|
3
|
+
*
|
4
|
+
* http://jqvmap.com
|
5
|
+
*
|
6
|
+
* Copyright 2012, Peter Schmalfeldt <manifestinteractive@gmail.com>
|
7
|
+
* Copyright 2011-2012, Kirill Lebedev
|
8
|
+
* Licensed under the MIT license.
|
9
|
+
*
|
10
|
+
* Fork Me @ https://github.com/manifestinteractive/jqvmap
|
11
|
+
*/
|
12
|
+
(function ($) {
|
13
|
+
|
14
|
+
var apiParams = {
|
15
|
+
colors: 1,
|
16
|
+
values: 1,
|
17
|
+
backgroundColor: 1,
|
18
|
+
scaleColors: 1,
|
19
|
+
normalizeFunction: 1,
|
20
|
+
enableZoom: 1,
|
21
|
+
showTooltip: 1,
|
22
|
+
borderColor: 1,
|
23
|
+
borderWidth: 1,
|
24
|
+
borderOpacity: 1,
|
25
|
+
selectedRegions: 1,
|
26
|
+
multiSelectRegion: 1
|
27
|
+
};
|
28
|
+
|
29
|
+
var apiEvents = {
|
30
|
+
onLabelShow: 'labelShow',
|
31
|
+
onRegionOver: 'regionMouseOver',
|
32
|
+
onRegionOut: 'regionMouseOut',
|
33
|
+
onRegionClick: 'regionClick',
|
34
|
+
onRegionSelect: 'regionSelect',
|
35
|
+
onRegionDeselect: 'regionDeselect'
|
36
|
+
};
|
37
|
+
|
38
|
+
$.fn.vectorMap = function (options) {
|
39
|
+
|
40
|
+
var defaultParams = {
|
41
|
+
map: 'world_en',
|
42
|
+
backgroundColor: '#a5bfdd',
|
43
|
+
color: '#f4f3f0',
|
44
|
+
hoverColor: '#c9dfaf',
|
45
|
+
selectedColor: '#c9dfaf',
|
46
|
+
scaleColors: ['#b6d6ff', '#005ace'],
|
47
|
+
normalizeFunction: 'linear',
|
48
|
+
enableZoom: true,
|
49
|
+
showTooltip: true,
|
50
|
+
borderColor: '#818181',
|
51
|
+
borderWidth: 1,
|
52
|
+
borderOpacity: 0.25,
|
53
|
+
selectedRegions: null,
|
54
|
+
multiSelectRegion: false
|
55
|
+
}, map = this.data('mapObject');
|
56
|
+
|
57
|
+
if (options === 'addMap') {
|
58
|
+
WorldMap.maps[arguments[1]] = arguments[2];
|
59
|
+
} else if (options === 'set' && apiParams[arguments[1]]) {
|
60
|
+
map['set' + arguments[1].charAt(0).toUpperCase() + arguments[1].substr(1)].apply(map, Array.prototype.slice.call(arguments, 2));
|
61
|
+
} else if (typeof options === 'string' &&
|
62
|
+
typeof map[options] === 'function') {
|
63
|
+
return map[options].apply(map, Array.prototype.slice.call(arguments, 1));
|
64
|
+
} else {
|
65
|
+
$.extend(defaultParams, options);
|
66
|
+
defaultParams.container = this;
|
67
|
+
this.css({ position: 'relative', overflow: 'hidden' });
|
68
|
+
|
69
|
+
map = new WorldMap(defaultParams);
|
70
|
+
|
71
|
+
this.data('mapObject', map);
|
72
|
+
|
73
|
+
for (var e in apiEvents) {
|
74
|
+
if (defaultParams[e]) {
|
75
|
+
this.bind(apiEvents[e] + '.jqvmap', defaultParams[e]);
|
76
|
+
}
|
77
|
+
}
|
78
|
+
}
|
79
|
+
};
|
80
|
+
|
81
|
+
var VectorCanvas = function (width, height, params) {
|
82
|
+
this.mode = window.SVGAngle ? 'svg' : 'vml';
|
83
|
+
this.params = params;
|
84
|
+
|
85
|
+
if (this.mode == 'svg') {
|
86
|
+
this.createSvgNode = function (nodeName) {
|
87
|
+
return document.createElementNS(this.svgns, nodeName);
|
88
|
+
};
|
89
|
+
} else {
|
90
|
+
try {
|
91
|
+
if (!document.namespaces.rvml) {
|
92
|
+
document.namespaces.add("rvml", "urn:schemas-microsoft-com:vml");
|
93
|
+
}
|
94
|
+
this.createVmlNode = function (tagName) {
|
95
|
+
return document.createElement('<rvml:' + tagName + ' class="rvml">');
|
96
|
+
};
|
97
|
+
} catch (e) {
|
98
|
+
this.createVmlNode = function (tagName) {
|
99
|
+
return document.createElement('<' + tagName + ' xmlns="urn:schemas-microsoft.com:vml" class="rvml">');
|
100
|
+
};
|
101
|
+
}
|
102
|
+
|
103
|
+
document.createStyleSheet().addRule(".rvml", "behavior:url(#default#VML)");
|
104
|
+
}
|
105
|
+
|
106
|
+
if (this.mode == 'svg') {
|
107
|
+
this.canvas = this.createSvgNode('svg');
|
108
|
+
} else {
|
109
|
+
this.canvas = this.createVmlNode('group');
|
110
|
+
this.canvas.style.position = 'absolute';
|
111
|
+
}
|
112
|
+
|
113
|
+
this.setSize(width, height);
|
114
|
+
};
|
115
|
+
|
116
|
+
VectorCanvas.prototype = {
|
117
|
+
svgns: "http://www.w3.org/2000/svg",
|
118
|
+
mode: 'svg',
|
119
|
+
width: 0,
|
120
|
+
height: 0,
|
121
|
+
canvas: null,
|
122
|
+
|
123
|
+
setSize: function (width, height) {
|
124
|
+
if (this.mode == 'svg') {
|
125
|
+
this.canvas.setAttribute('width', width);
|
126
|
+
this.canvas.setAttribute('height', height);
|
127
|
+
} else {
|
128
|
+
this.canvas.style.width = width + "px";
|
129
|
+
this.canvas.style.height = height + "px";
|
130
|
+
this.canvas.coordsize = width + ' ' + height;
|
131
|
+
this.canvas.coordorigin = "0 0";
|
132
|
+
if (this.rootGroup) {
|
133
|
+
var pathes = this.rootGroup.getElementsByTagName('shape');
|
134
|
+
for (var i = 0, l = pathes.length; i < l; i++) {
|
135
|
+
pathes[i].coordsize = width + ' ' + height;
|
136
|
+
pathes[i].style.width = width + 'px';
|
137
|
+
pathes[i].style.height = height + 'px';
|
138
|
+
}
|
139
|
+
this.rootGroup.coordsize = width + ' ' + height;
|
140
|
+
this.rootGroup.style.width = width + 'px';
|
141
|
+
this.rootGroup.style.height = height + 'px';
|
142
|
+
}
|
143
|
+
}
|
144
|
+
this.width = width;
|
145
|
+
this.height = height;
|
146
|
+
},
|
147
|
+
|
148
|
+
createPath: function (config) {
|
149
|
+
var node;
|
150
|
+
if (this.mode == 'svg') {
|
151
|
+
node = this.createSvgNode('path');
|
152
|
+
node.setAttribute('d', config.path);
|
153
|
+
|
154
|
+
if (this.params.borderColor !== null) {
|
155
|
+
node.setAttribute('stroke', this.params.borderColor);
|
156
|
+
}
|
157
|
+
if (this.params.borderWidth > 0) {
|
158
|
+
node.setAttribute('stroke-width', this.params.borderWidth);
|
159
|
+
node.setAttribute('stroke-linecap', 'round');
|
160
|
+
node.setAttribute('stroke-linejoin', 'round');
|
161
|
+
}
|
162
|
+
if (this.params.borderOpacity > 0) {
|
163
|
+
node.setAttribute('stroke-opacity', this.params.borderOpacity);
|
164
|
+
}
|
165
|
+
|
166
|
+
node.setFill = function (color) {
|
167
|
+
this.setAttribute("fill", color);
|
168
|
+
if (this.getAttribute("original") === null) {
|
169
|
+
this.setAttribute("original", color);
|
170
|
+
}
|
171
|
+
};
|
172
|
+
|
173
|
+
node.getFill = function (color) {
|
174
|
+
return this.getAttribute("fill");
|
175
|
+
};
|
176
|
+
|
177
|
+
node.getOriginalFill = function () {
|
178
|
+
return this.getAttribute("original");
|
179
|
+
};
|
180
|
+
|
181
|
+
node.setOpacity = function (opacity) {
|
182
|
+
this.setAttribute('fill-opacity', opacity);
|
183
|
+
};
|
184
|
+
} else {
|
185
|
+
node = this.createVmlNode('shape');
|
186
|
+
node.coordorigin = "0 0";
|
187
|
+
node.coordsize = this.width + ' ' + this.height;
|
188
|
+
node.style.width = this.width + 'px';
|
189
|
+
node.style.height = this.height + 'px';
|
190
|
+
node.fillcolor = WorldMap.defaultFillColor;
|
191
|
+
node.stroked = false;
|
192
|
+
node.path = VectorCanvas.pathSvgToVml(config.path);
|
193
|
+
|
194
|
+
var scale = this.createVmlNode('skew');
|
195
|
+
scale.on = true;
|
196
|
+
scale.matrix = '0.01,0,0,0.01,0,0';
|
197
|
+
scale.offset = '0,0';
|
198
|
+
|
199
|
+
node.appendChild(scale);
|
200
|
+
|
201
|
+
var fill = this.createVmlNode('fill');
|
202
|
+
node.appendChild(fill);
|
203
|
+
|
204
|
+
node.setFill = function (color) {
|
205
|
+
this.getElementsByTagName('fill')[0].color = color;
|
206
|
+
if (this.getAttribute("original") === null) {
|
207
|
+
this.setAttribute("original", color);
|
208
|
+
}
|
209
|
+
};
|
210
|
+
|
211
|
+
node.getFill = function (color) {
|
212
|
+
return this.getElementsByTagName('fill')[0].color;
|
213
|
+
};
|
214
|
+
node.getOriginalFill = function () {
|
215
|
+
return this.getAttribute("original");
|
216
|
+
};
|
217
|
+
node.setOpacity = function (opacity) {
|
218
|
+
this.getElementsByTagName('fill')[0].opacity = parseInt(opacity * 100, 10) + '%';
|
219
|
+
};
|
220
|
+
}
|
221
|
+
return node;
|
222
|
+
},
|
223
|
+
|
224
|
+
createGroup: function (isRoot) {
|
225
|
+
var node;
|
226
|
+
if (this.mode == 'svg') {
|
227
|
+
node = this.createSvgNode('g');
|
228
|
+
} else {
|
229
|
+
node = this.createVmlNode('group');
|
230
|
+
node.style.width = this.width + 'px';
|
231
|
+
node.style.height = this.height + 'px';
|
232
|
+
node.style.left = '0px';
|
233
|
+
node.style.top = '0px';
|
234
|
+
node.coordorigin = "0 0";
|
235
|
+
node.coordsize = this.width + ' ' + this.height;
|
236
|
+
}
|
237
|
+
|
238
|
+
if (isRoot) {
|
239
|
+
this.rootGroup = node;
|
240
|
+
}
|
241
|
+
return node;
|
242
|
+
},
|
243
|
+
|
244
|
+
applyTransformParams: function (scale, transX, transY) {
|
245
|
+
if (this.mode == 'svg') {
|
246
|
+
this.rootGroup.setAttribute('transform', 'scale(' + scale + ') translate(' + transX + ', ' + transY + ')');
|
247
|
+
} else {
|
248
|
+
this.rootGroup.coordorigin = (this.width - transX) + ',' + (this.height - transY);
|
249
|
+
this.rootGroup.coordsize = this.width / scale + ',' + this.height / scale;
|
250
|
+
}
|
251
|
+
}
|
252
|
+
};
|
253
|
+
|
254
|
+
VectorCanvas.pathSvgToVml = function (path) {
|
255
|
+
var result = '';
|
256
|
+
var cx = 0, cy = 0, ctrlx, ctrly;
|
257
|
+
|
258
|
+
return path.replace(/([MmLlHhVvCcSs])((?:-?(?:\d+)?(?:\.\d+)?,?\s?)+)/g, function (segment, letter, coords, index) {
|
259
|
+
coords = coords.replace(/(\d)-/g, '$1,-').replace(/\s+/g, ',').split(',');
|
260
|
+
if (!coords[0]) {
|
261
|
+
coords.shift();
|
262
|
+
}
|
263
|
+
|
264
|
+
for (var i = 0, l = coords.length; i < l; i++) {
|
265
|
+
coords[i] = Math.round(100 * coords[i]);
|
266
|
+
}
|
267
|
+
|
268
|
+
switch (letter) {
|
269
|
+
case 'm':
|
270
|
+
cx += coords[0];
|
271
|
+
cy += coords[1];
|
272
|
+
return 't' + coords.join(',');
|
273
|
+
break;
|
274
|
+
|
275
|
+
case 'M':
|
276
|
+
cx = coords[0];
|
277
|
+
cy = coords[1];
|
278
|
+
return 'm' + coords.join(',');
|
279
|
+
break;
|
280
|
+
|
281
|
+
case 'l':
|
282
|
+
cx += coords[0];
|
283
|
+
cy += coords[1];
|
284
|
+
return 'r' + coords.join(',');
|
285
|
+
break;
|
286
|
+
|
287
|
+
case 'L':
|
288
|
+
cx = coords[0];
|
289
|
+
cy = coords[1];
|
290
|
+
return 'l' + coords.join(',');
|
291
|
+
break;
|
292
|
+
|
293
|
+
case 'h':
|
294
|
+
cx += coords[0];
|
295
|
+
return 'r' + coords[0] + ',0';
|
296
|
+
break;
|
297
|
+
|
298
|
+
case 'H':
|
299
|
+
cx = coords[0];
|
300
|
+
return 'l' + cx + ',' + cy;
|
301
|
+
break;
|
302
|
+
|
303
|
+
case 'v':
|
304
|
+
cy += coords[0];
|
305
|
+
return 'r0,' + coords[0];
|
306
|
+
break;
|
307
|
+
|
308
|
+
case 'V':
|
309
|
+
cy = coords[0];
|
310
|
+
return 'l' + cx + ',' + cy;
|
311
|
+
break;
|
312
|
+
|
313
|
+
case 'c':
|
314
|
+
ctrlx = cx + coords[coords.length - 4];
|
315
|
+
ctrly = cy + coords[coords.length - 3];
|
316
|
+
cx += coords[coords.length - 2];
|
317
|
+
cy += coords[coords.length - 1];
|
318
|
+
return 'v' + coords.join(',');
|
319
|
+
break;
|
320
|
+
|
321
|
+
case 'C':
|
322
|
+
ctrlx = coords[coords.length - 4];
|
323
|
+
ctrly = coords[coords.length - 3];
|
324
|
+
cx = coords[coords.length - 2];
|
325
|
+
cy = coords[coords.length - 1];
|
326
|
+
return 'c' + coords.join(',');
|
327
|
+
break;
|
328
|
+
|
329
|
+
case 's':
|
330
|
+
coords.unshift(cy - ctrly);
|
331
|
+
coords.unshift(cx - ctrlx);
|
332
|
+
ctrlx = cx + coords[coords.length - 4];
|
333
|
+
ctrly = cy + coords[coords.length - 3];
|
334
|
+
cx += coords[coords.length - 2];
|
335
|
+
cy += coords[coords.length - 1];
|
336
|
+
return 'v' + coords.join(',');
|
337
|
+
break;
|
338
|
+
|
339
|
+
case 'S':
|
340
|
+
coords.unshift(cy + cy - ctrly);
|
341
|
+
coords.unshift(cx + cx - ctrlx);
|
342
|
+
ctrlx = coords[coords.length - 4];
|
343
|
+
ctrly = coords[coords.length - 3];
|
344
|
+
cx = coords[coords.length - 2];
|
345
|
+
cy = coords[coords.length - 1];
|
346
|
+
return 'c' + coords.join(',');
|
347
|
+
break;
|
348
|
+
|
349
|
+
default:
|
350
|
+
return false;
|
351
|
+
break;
|
352
|
+
}
|
353
|
+
|
354
|
+
return '';
|
355
|
+
|
356
|
+
}).replace(/z/g, '');
|
357
|
+
};
|
358
|
+
|
359
|
+
var WorldMap = function (params) {
|
360
|
+
params = params || {};
|
361
|
+
var map = this;
|
362
|
+
var mapData = WorldMap.maps[params.map];
|
363
|
+
|
364
|
+
this.selectedRegions = [];
|
365
|
+
this.multiSelectRegion = params.multiSelectRegion;
|
366
|
+
|
367
|
+
this.container = params.container;
|
368
|
+
|
369
|
+
this.defaultWidth = mapData.width;
|
370
|
+
this.defaultHeight = mapData.height;
|
371
|
+
|
372
|
+
this.color = params.color;
|
373
|
+
this.selectedColor = params.selectedColor;
|
374
|
+
this.hoverColor = params.hoverColor;
|
375
|
+
this.hoverOpacity = params.hoverOpacity;
|
376
|
+
this.setBackgroundColor(params.backgroundColor);
|
377
|
+
|
378
|
+
this.width = params.container.width();
|
379
|
+
this.height = params.container.height();
|
380
|
+
|
381
|
+
this.resize();
|
382
|
+
|
383
|
+
jQuery(window).resize(function () {
|
384
|
+
map.width = params.container.width();
|
385
|
+
map.height = params.container.height();
|
386
|
+
map.resize();
|
387
|
+
map.canvas.setSize(map.width, map.height);
|
388
|
+
map.applyTransform();
|
389
|
+
});
|
390
|
+
|
391
|
+
this.canvas = new VectorCanvas(this.width, this.height, params);
|
392
|
+
params.container.append(this.canvas.canvas);
|
393
|
+
|
394
|
+
this.makeDraggable();
|
395
|
+
|
396
|
+
this.rootGroup = this.canvas.createGroup(true);
|
397
|
+
|
398
|
+
this.index = WorldMap.mapIndex;
|
399
|
+
this.label = jQuery('<div/>').addClass('jqvmap-label').appendTo(jQuery('body')).hide();
|
400
|
+
|
401
|
+
if (params.enableZoom) {
|
402
|
+
jQuery('<div/>').addClass('jqvmap-zoomin').text('+').appendTo(params.container);
|
403
|
+
jQuery('<div/>').addClass('jqvmap-zoomout').html('−').appendTo(params.container);
|
404
|
+
}
|
405
|
+
|
406
|
+
map.countries = [];
|
407
|
+
|
408
|
+
for (var key in mapData.pathes) {
|
409
|
+
var path = this.canvas.createPath({
|
410
|
+
path: mapData.pathes[key].path
|
411
|
+
});
|
412
|
+
|
413
|
+
path.setFill(this.color);
|
414
|
+
path.id = map.getCountryId(key);
|
415
|
+
map.countries[key] = path;
|
416
|
+
|
417
|
+
if (this.canvas.mode == 'svg') {
|
418
|
+
path.setAttribute('class', 'jvectormap-region');
|
419
|
+
} else {
|
420
|
+
jQuery(path).addClass('jvectormap-region');
|
421
|
+
}
|
422
|
+
|
423
|
+
jQuery(this.rootGroup).append(path);
|
424
|
+
}
|
425
|
+
|
426
|
+
jQuery(params.container).delegate(this.canvas.mode == 'svg' ? 'path' : 'shape', 'mouseover mouseout', function (e) {
|
427
|
+
var path = e.target,
|
428
|
+
code = e.target.id.split('_').pop(),
|
429
|
+
labelShowEvent = $.Event('labelShow.jqvmap'),
|
430
|
+
regionMouseOverEvent = $.Event('regionMouseOver.jqvmap');
|
431
|
+
|
432
|
+
if (e.type == 'mouseover') {
|
433
|
+
jQuery(params.container).trigger(regionMouseOverEvent, [code, mapData.pathes[code].name]);
|
434
|
+
if (!regionMouseOverEvent.isDefaultPrevented()) {
|
435
|
+
map.highlight(code, path);
|
436
|
+
}
|
437
|
+
if (params.showTooltip) {
|
438
|
+
map.label.text(mapData.pathes[code].name);
|
439
|
+
jQuery(params.container).trigger(labelShowEvent, [map.label, code]);
|
440
|
+
|
441
|
+
if (!labelShowEvent.isDefaultPrevented()) {
|
442
|
+
map.label.show();
|
443
|
+
map.labelWidth = map.label.width();
|
444
|
+
map.labelHeight = map.label.height();
|
445
|
+
}
|
446
|
+
}
|
447
|
+
} else {
|
448
|
+
map.unhighlight(code, path);
|
449
|
+
|
450
|
+
map.label.hide();
|
451
|
+
jQuery(params.container).trigger('regionMouseOut.jqvmap', [code, mapData.pathes[code].name]);
|
452
|
+
}
|
453
|
+
});
|
454
|
+
|
455
|
+
jQuery(params.container).delegate(this.canvas.mode == 'svg' ? 'path' : 'shape', 'click', function (e) {
|
456
|
+
if (!params.multiSelectRegion) {
|
457
|
+
for (var key in mapData.pathes) {
|
458
|
+
map.countries[key].currentFillColor = map.countries[key].getOriginalFill();
|
459
|
+
map.countries[key].setFill(map.countries[key].getOriginalFill());
|
460
|
+
}
|
461
|
+
}
|
462
|
+
|
463
|
+
var path = e.target;
|
464
|
+
var code = e.target.id.split('_').pop();
|
465
|
+
|
466
|
+
jQuery(params.container).trigger('regionClick.jqvmap', [code, mapData.pathes[code].name]);
|
467
|
+
if (!regionClickEvent.isDefaultPrevented()) {
|
468
|
+
if (map.selectedRegions.indexOf(code) !== -1) {
|
469
|
+
map.deselect(code, path);
|
470
|
+
} else {
|
471
|
+
map.select(code, path);
|
472
|
+
}
|
473
|
+
}
|
474
|
+
|
475
|
+
//console.log(selectedRegions);
|
476
|
+
|
477
|
+
});
|
478
|
+
|
479
|
+
if (params.showTooltip) {
|
480
|
+
params.container.mousemove(function (e) {
|
481
|
+
if (map.label.is(':visible')) {
|
482
|
+
var left = e.pageX - 15 - map.labelWidth;
|
483
|
+
var top = e.pageY - 15 - map.labelHeight;
|
484
|
+
|
485
|
+
if(left < 0)
|
486
|
+
left = e.pageX + 15;
|
487
|
+
if(top < 0)
|
488
|
+
top = e.pageY + 15;
|
489
|
+
|
490
|
+
map.label.css({
|
491
|
+
left: left,
|
492
|
+
top: top
|
493
|
+
});
|
494
|
+
}
|
495
|
+
});
|
496
|
+
}
|
497
|
+
|
498
|
+
this.setColors(params.colors);
|
499
|
+
|
500
|
+
this.canvas.canvas.appendChild(this.rootGroup);
|
501
|
+
|
502
|
+
this.applyTransform();
|
503
|
+
|
504
|
+
this.colorScale = new ColorScale(params.scaleColors, params.normalizeFunction, params.valueMin, params.valueMax);
|
505
|
+
|
506
|
+
if (params.values) {
|
507
|
+
this.values = params.values;
|
508
|
+
this.setValues(params.values);
|
509
|
+
}
|
510
|
+
|
511
|
+
if (params.selectedRegions) {
|
512
|
+
if (params.selectedRegions instanceof Array) {
|
513
|
+
for(var k in params.selectedRegions) {
|
514
|
+
this.select(params.selectedRegions[k].toLowerCase());
|
515
|
+
}
|
516
|
+
} else {
|
517
|
+
this.select(params.selectedRegions.toLowerCase());
|
518
|
+
}
|
519
|
+
}
|
520
|
+
|
521
|
+
this.bindZoomButtons();
|
522
|
+
|
523
|
+
if(params.pins) {
|
524
|
+
/*if(params.pinMode) {
|
525
|
+
if(params.pinMode != "id" && params.pinMode != "content") {
|
526
|
+
params.pinMode = "content";
|
527
|
+
}
|
528
|
+
} else {
|
529
|
+
params.pinMode = "content";
|
530
|
+
}*/
|
531
|
+
this.pinHandlers = false;
|
532
|
+
this.placePins(params.pins, params.pinMode);
|
533
|
+
}
|
534
|
+
|
535
|
+
WorldMap.mapIndex++;
|
536
|
+
};
|
537
|
+
|
538
|
+
WorldMap.prototype = {
|
539
|
+
transX: 0,
|
540
|
+
transY: 0,
|
541
|
+
scale: 1,
|
542
|
+
baseTransX: 0,
|
543
|
+
baseTransY: 0,
|
544
|
+
baseScale: 1,
|
545
|
+
width: 0,
|
546
|
+
height: 0,
|
547
|
+
countries: {},
|
548
|
+
countriesColors: {},
|
549
|
+
countriesData: {},
|
550
|
+
zoomStep: 1.4,
|
551
|
+
zoomMaxStep: 4,
|
552
|
+
zoomCurStep: 1,
|
553
|
+
|
554
|
+
setColors: function (key, color) {
|
555
|
+
if (typeof key == 'string') {
|
556
|
+
this.countries[key].setFill(color);
|
557
|
+
this.countries[key].setAttribute("original", color);
|
558
|
+
} else {
|
559
|
+
var colors = key;
|
560
|
+
|
561
|
+
for (var code in colors) {
|
562
|
+
if (this.countries[code]) {
|
563
|
+
this.countries[code].setFill(colors[code]);
|
564
|
+
this.countries[code].setAttribute("original", colors[code]);
|
565
|
+
}
|
566
|
+
}
|
567
|
+
}
|
568
|
+
},
|
569
|
+
|
570
|
+
setValues: function (values) {
|
571
|
+
var max = 0,
|
572
|
+
min = Number.MAX_VALUE,
|
573
|
+
val;
|
574
|
+
|
575
|
+
for (var cc in values) {
|
576
|
+
val = parseFloat(values[cc]);
|
577
|
+
if (val > max) {
|
578
|
+
max = values[cc];
|
579
|
+
}
|
580
|
+
if (val && val < min) {
|
581
|
+
min = val;
|
582
|
+
}
|
583
|
+
}
|
584
|
+
|
585
|
+
this.colorScale.setMin(min);
|
586
|
+
this.colorScale.setMax(max);
|
587
|
+
|
588
|
+
var colors = {};
|
589
|
+
for (cc in values) {
|
590
|
+
val = parseFloat(values[cc]);
|
591
|
+
if (val) {
|
592
|
+
colors[cc] = this.colorScale.getColor(val);
|
593
|
+
} else {
|
594
|
+
colors[cc] = this.color;
|
595
|
+
}
|
596
|
+
}
|
597
|
+
this.setColors(colors);
|
598
|
+
this.values = values;
|
599
|
+
},
|
600
|
+
|
601
|
+
setBackgroundColor: function (backgroundColor) {
|
602
|
+
this.container.css('background-color', backgroundColor);
|
603
|
+
},
|
604
|
+
|
605
|
+
setScaleColors: function (colors) {
|
606
|
+
this.colorScale.setColors(colors);
|
607
|
+
|
608
|
+
if (this.values) {
|
609
|
+
this.setValues(this.values);
|
610
|
+
}
|
611
|
+
},
|
612
|
+
|
613
|
+
setNormalizeFunction: function (f) {
|
614
|
+
this.colorScale.setNormalizeFunction(f);
|
615
|
+
|
616
|
+
if (this.values) {
|
617
|
+
this.setValues(this.values);
|
618
|
+
}
|
619
|
+
},
|
620
|
+
|
621
|
+
highlight: function (cc, path) {
|
622
|
+
path = path || $('#' + this.getCountryId(cc))[0];
|
623
|
+
if (this.hoverOpacity) {
|
624
|
+
path.setOpacity(this.hoverOpacity);
|
625
|
+
} else if (this.hoverColor) {
|
626
|
+
path.currentFillColor = path.getFill() + '';
|
627
|
+
path.setFill(this.hoverColor);
|
628
|
+
}
|
629
|
+
},
|
630
|
+
|
631
|
+
unhighlight: function (cc, path) {
|
632
|
+
path = path || $('#' + this.getCountryId(cc))[0];
|
633
|
+
path.setOpacity(1);
|
634
|
+
if (path.currentFillColor) {
|
635
|
+
path.setFill(path.currentFillColor);
|
636
|
+
}
|
637
|
+
},
|
638
|
+
|
639
|
+
select: function (cc, path) {
|
640
|
+
path = path || $('#' + this.getCountryId(cc))[0];
|
641
|
+
if(this.selectedRegions.indexOf(cc) < 0) {
|
642
|
+
if (this.multiSelectRegion) {
|
643
|
+
this.selectedRegions.push(cc);
|
644
|
+
} else {
|
645
|
+
this.selectedRegions = [cc];
|
646
|
+
}
|
647
|
+
// MUST BE after the change of selectedRegions
|
648
|
+
// Otherwise, we might loop
|
649
|
+
$(this.container).trigger('regionSelect.jqvmap', [cc]);
|
650
|
+
if (this.selectedColor) {
|
651
|
+
path.currentFillColor = this.selectedColor;
|
652
|
+
path.setFill(this.selectedColor);
|
653
|
+
}
|
654
|
+
}
|
655
|
+
},
|
656
|
+
|
657
|
+
deselect: function (cc, path) {
|
658
|
+
path = path || $('#' + this.getCountryId(cc))[0];
|
659
|
+
if(this.selectedRegions.indexOf(cc) >= 0) {
|
660
|
+
this.selectedRegions.splice(this.selectedRegions.indexOf(cc), 1);
|
661
|
+
// MUST BE after the change of selectedRegions
|
662
|
+
// Otherwise, we might loop
|
663
|
+
$(this.container).trigger('regionDeselect.jqvmap', [cc]);
|
664
|
+
path.currentFillColor = path.getOriginalFill();
|
665
|
+
path.setFill(path.getOriginalFill());
|
666
|
+
}
|
667
|
+
},
|
668
|
+
|
669
|
+
isSelected: function(cc) {
|
670
|
+
return this.selectedRegions.indexOf(cc) >= 0;
|
671
|
+
},
|
672
|
+
|
673
|
+
resize: function () {
|
674
|
+
var curBaseScale = this.baseScale;
|
675
|
+
if (this.width / this.height > this.defaultWidth / this.defaultHeight) {
|
676
|
+
this.baseScale = this.height / this.defaultHeight;
|
677
|
+
this.baseTransX = Math.abs(this.width - this.defaultWidth * this.baseScale) / (2 * this.baseScale);
|
678
|
+
} else {
|
679
|
+
this.baseScale = this.width / this.defaultWidth;
|
680
|
+
this.baseTransY = Math.abs(this.height - this.defaultHeight * this.baseScale) / (2 * this.baseScale);
|
681
|
+
}
|
682
|
+
this.scale *= this.baseScale / curBaseScale;
|
683
|
+
this.transX *= this.baseScale / curBaseScale;
|
684
|
+
this.transY *= this.baseScale / curBaseScale;
|
685
|
+
},
|
686
|
+
|
687
|
+
reset: function () {
|
688
|
+
this.countryTitle.reset();
|
689
|
+
for (var key in this.countries) {
|
690
|
+
this.countries[key].setFill(WorldMap.defaultColor);
|
691
|
+
}
|
692
|
+
this.scale = this.baseScale;
|
693
|
+
this.transX = this.baseTransX;
|
694
|
+
this.transY = this.baseTransY;
|
695
|
+
this.applyTransform();
|
696
|
+
},
|
697
|
+
|
698
|
+
applyTransform: function () {
|
699
|
+
var maxTransX, maxTransY, minTransX, minTransY;
|
700
|
+
if (this.defaultWidth * this.scale <= this.width) {
|
701
|
+
maxTransX = (this.width - this.defaultWidth * this.scale) / (2 * this.scale);
|
702
|
+
minTransX = (this.width - this.defaultWidth * this.scale) / (2 * this.scale);
|
703
|
+
} else {
|
704
|
+
maxTransX = 0;
|
705
|
+
minTransX = (this.width - this.defaultWidth * this.scale) / this.scale;
|
706
|
+
}
|
707
|
+
|
708
|
+
if (this.defaultHeight * this.scale <= this.height) {
|
709
|
+
maxTransY = (this.height - this.defaultHeight * this.scale) / (2 * this.scale);
|
710
|
+
minTransY = (this.height - this.defaultHeight * this.scale) / (2 * this.scale);
|
711
|
+
} else {
|
712
|
+
maxTransY = 0;
|
713
|
+
minTransY = (this.height - this.defaultHeight * this.scale) / this.scale;
|
714
|
+
}
|
715
|
+
|
716
|
+
if (this.transY > maxTransY) {
|
717
|
+
this.transY = maxTransY;
|
718
|
+
}
|
719
|
+
else if (this.transY < minTransY) {
|
720
|
+
this.transY = minTransY;
|
721
|
+
}
|
722
|
+
if (this.transX > maxTransX) {
|
723
|
+
this.transX = maxTransX;
|
724
|
+
}
|
725
|
+
else if (this.transX < minTransX) {
|
726
|
+
this.transX = minTransX;
|
727
|
+
}
|
728
|
+
|
729
|
+
this.canvas.applyTransformParams(this.scale, this.transX, this.transY);
|
730
|
+
},
|
731
|
+
|
732
|
+
makeDraggable: function () {
|
733
|
+
var mouseDown = false;
|
734
|
+
var oldPageX, oldPageY;
|
735
|
+
var self = this;
|
736
|
+
|
737
|
+
self.isMoving = false;
|
738
|
+
self.isMovingTimeout = false;
|
739
|
+
|
740
|
+
this.container.mousemove(function (e) {
|
741
|
+
|
742
|
+
if (mouseDown) {
|
743
|
+
var curTransX = self.transX;
|
744
|
+
var curTransY = self.transY;
|
745
|
+
|
746
|
+
self.transX -= (oldPageX - e.pageX) / self.scale;
|
747
|
+
self.transY -= (oldPageY - e.pageY) / self.scale;
|
748
|
+
|
749
|
+
self.applyTransform();
|
750
|
+
|
751
|
+
oldPageX = e.pageX;
|
752
|
+
oldPageY = e.pageY;
|
753
|
+
|
754
|
+
self.isMoving = true;
|
755
|
+
if (self.isMovingTimeout) {
|
756
|
+
clearTimeout(self.isMovingTimeout);
|
757
|
+
}
|
758
|
+
|
759
|
+
self.container.trigger('drag');
|
760
|
+
}
|
761
|
+
|
762
|
+
return false;
|
763
|
+
|
764
|
+
}).mousedown(function (e) {
|
765
|
+
|
766
|
+
mouseDown = true;
|
767
|
+
oldPageX = e.pageX;
|
768
|
+
oldPageY = e.pageY;
|
769
|
+
|
770
|
+
return false;
|
771
|
+
|
772
|
+
}).mouseup(function () {
|
773
|
+
|
774
|
+
mouseDown = false;
|
775
|
+
|
776
|
+
self.isMovingTimeout = setTimeout(function () {
|
777
|
+
self.isMoving = false;
|
778
|
+
}, 100);
|
779
|
+
|
780
|
+
return false;
|
781
|
+
|
782
|
+
});
|
783
|
+
},
|
784
|
+
|
785
|
+
bindZoomButtons: function () {
|
786
|
+
var map = this;
|
787
|
+
this.container.find('.jqvmap-zoomin').click(function(){
|
788
|
+
map.zoomIn();
|
789
|
+
});
|
790
|
+
this.container.find('.jqvmap-zoomout').click(function(){
|
791
|
+
map.zoomOut();
|
792
|
+
});
|
793
|
+
},
|
794
|
+
|
795
|
+
zoomIn: function () {
|
796
|
+
var map = this;
|
797
|
+
var sliderDelta = (jQuery('#zoom').innerHeight() - 6 * 2 - 15 * 2 - 3 * 2 - 7 - 6) / (this.zoomMaxStep - this.zoomCurStep);
|
798
|
+
|
799
|
+
if (map.zoomCurStep < map.zoomMaxStep) {
|
800
|
+
var curTransX = map.transX;
|
801
|
+
var curTransY = map.transY;
|
802
|
+
var curScale = map.scale;
|
803
|
+
|
804
|
+
map.transX -= (map.width / map.scale - map.width / (map.scale * map.zoomStep)) / 2;
|
805
|
+
map.transY -= (map.height / map.scale - map.height / (map.scale * map.zoomStep)) / 2;
|
806
|
+
map.setScale(map.scale * map.zoomStep);
|
807
|
+
map.zoomCurStep++;
|
808
|
+
|
809
|
+
jQuery('#zoomSlider').css('top', parseInt(jQuery('#zoomSlider').css('top'), 10) - sliderDelta);
|
810
|
+
|
811
|
+
map.container.trigger("zoomIn");
|
812
|
+
}
|
813
|
+
},
|
814
|
+
|
815
|
+
zoomOut: function () {
|
816
|
+
var map = this;
|
817
|
+
var sliderDelta = (jQuery('#zoom').innerHeight() - 6 * 2 - 15 * 2 - 3 * 2 - 7 - 6) / (this.zoomMaxStep - this.zoomCurStep);
|
818
|
+
|
819
|
+
if (map.zoomCurStep > 1) {
|
820
|
+
var curTransX = map.transX;
|
821
|
+
var curTransY = map.transY;
|
822
|
+
var curScale = map.scale;
|
823
|
+
|
824
|
+
map.transX += (map.width / (map.scale / map.zoomStep) - map.width / map.scale) / 2;
|
825
|
+
map.transY += (map.height / (map.scale / map.zoomStep) - map.height / map.scale) / 2;
|
826
|
+
map.setScale(map.scale / map.zoomStep);
|
827
|
+
map.zoomCurStep--;
|
828
|
+
|
829
|
+
jQuery('#zoomSlider').css('top', parseInt(jQuery('#zoomSlider').css('top'), 10) + sliderDelta);
|
830
|
+
|
831
|
+
map.container.trigger("zoomOut");
|
832
|
+
}
|
833
|
+
},
|
834
|
+
|
835
|
+
setScale: function (scale) {
|
836
|
+
this.scale = scale;
|
837
|
+
this.applyTransform();
|
838
|
+
},
|
839
|
+
|
840
|
+
getCountryId: function (cc) {
|
841
|
+
return 'jqvmap' + this.index + '_' + cc;
|
842
|
+
},
|
843
|
+
|
844
|
+
getPinId: function (cc) {
|
845
|
+
return this.getCountryId(cc)+'_pin';
|
846
|
+
},
|
847
|
+
|
848
|
+
placePins: function(pins, pinMode){
|
849
|
+
var map = this;
|
850
|
+
|
851
|
+
if(!pinMode || (pinMode != "content" && pinMode != "id")) {
|
852
|
+
pinMode = "content";
|
853
|
+
}
|
854
|
+
|
855
|
+
if(pinMode == "content") {//treat pin as content
|
856
|
+
jQuery.each(pins, function(index, pin){
|
857
|
+
if(jQuery('#'+map.getCountryId(index)).length == 0){
|
858
|
+
return;
|
859
|
+
}
|
860
|
+
//mapData.pathes[code].name
|
861
|
+
var pinIndex = map.getPinId(index);
|
862
|
+
if(jQuery('#'+pinIndex).length > 0){
|
863
|
+
jQuery('#'+pinIndex).remove();
|
864
|
+
}
|
865
|
+
map.container.append('<div id="' + pinIndex + '" for="'+index+'" class="jqvmap_pin" style="position:absolute">' + pin + '</div>');
|
866
|
+
});
|
867
|
+
} else { //treat pin as id of an html content
|
868
|
+
jQuery.each(pins, function(index, pin){
|
869
|
+
if(jQuery('#'+map.getCountryId(index)).length == 0){
|
870
|
+
return;
|
871
|
+
}
|
872
|
+
var pinIndex = map.getPinId(index);
|
873
|
+
if(jQuery('#'+pinIndex).length > 0){
|
874
|
+
jQuery('#'+pinIndex).remove();
|
875
|
+
}
|
876
|
+
map.container.append('<div id="' + pinIndex + '" for="'+index+'" class="jqvmap_pin" style="position:absolute"></div>');
|
877
|
+
jQuery('#'+pinIndex).append(jQuery('#'+pin));
|
878
|
+
});
|
879
|
+
}
|
880
|
+
|
881
|
+
this.positionPins();
|
882
|
+
if(!this.pinHandlers){
|
883
|
+
this.pinHandlers = true;//do only once
|
884
|
+
var positionFix = function(){
|
885
|
+
map.positionPins();
|
886
|
+
};
|
887
|
+
this.container.bind('zoomIn', positionFix)
|
888
|
+
.bind('zoomOut', positionFix)
|
889
|
+
.bind('drag', positionFix);
|
890
|
+
}
|
891
|
+
},
|
892
|
+
|
893
|
+
positionPins: function(){
|
894
|
+
var map = this;
|
895
|
+
var pins = this.container.find('.jqvmap_pin');
|
896
|
+
jQuery.each(pins, function(index, pinObj){
|
897
|
+
pinObj = jQuery(pinObj);
|
898
|
+
var countryId = map.getCountryId(pinObj.attr('for'));
|
899
|
+
var countryObj = jQuery('#' + countryId);
|
900
|
+
|
901
|
+
var bbox = document.getElementById(countryId).getBBox();
|
902
|
+
var position = countryObj.position();
|
903
|
+
|
904
|
+
var scale = map.scale;
|
905
|
+
|
906
|
+
var left = position.left + (bbox.width / 2) * scale - pinObj.width() / 2,
|
907
|
+
top = position.top + (bbox.height / 2) * scale - pinObj.height() / 2;
|
908
|
+
|
909
|
+
pinObj.css('left',left).css('top',top);
|
910
|
+
});
|
911
|
+
},
|
912
|
+
|
913
|
+
getPin: function(cc){
|
914
|
+
var pinObj = jQuery('#'+this.getPinId(cc));
|
915
|
+
return pinObj.html();
|
916
|
+
},
|
917
|
+
|
918
|
+
getPins: function(){
|
919
|
+
var pins = this.container.find('.jqvmap_pin');
|
920
|
+
var ret = new Object();
|
921
|
+
jQuery.each(pins, function(index, pinObj){
|
922
|
+
pinObj = jQuery(pinObj);
|
923
|
+
var cc = pinObj.attr('for');
|
924
|
+
var pinContent = pinObj.html();
|
925
|
+
eval("ret." + cc + "=pinContent");
|
926
|
+
});
|
927
|
+
return JSON.stringify(ret);
|
928
|
+
},
|
929
|
+
|
930
|
+
removePin: function(cc) {
|
931
|
+
jQuery('#'+this.getPinId(cc)).remove();
|
932
|
+
},
|
933
|
+
|
934
|
+
removePins: function(){
|
935
|
+
this.container.find('.jqvmap_pin').remove();
|
936
|
+
}
|
937
|
+
};
|
938
|
+
|
939
|
+
WorldMap.xlink = "http://www.w3.org/1999/xlink";
|
940
|
+
WorldMap.mapIndex = 1;
|
941
|
+
WorldMap.maps = {};
|
942
|
+
|
943
|
+
var ColorScale = function (colors, normalizeFunction, minValue, maxValue) {
|
944
|
+
if (colors) {
|
945
|
+
this.setColors(colors);
|
946
|
+
}
|
947
|
+
if (normalizeFunction) {
|
948
|
+
this.setNormalizeFunction(normalizeFunction);
|
949
|
+
}
|
950
|
+
if (minValue) {
|
951
|
+
this.setMin(minValue);
|
952
|
+
}
|
953
|
+
if (minValue) {
|
954
|
+
this.setMax(maxValue);
|
955
|
+
}
|
956
|
+
};
|
957
|
+
|
958
|
+
ColorScale.prototype = {
|
959
|
+
colors: [],
|
960
|
+
|
961
|
+
setMin: function (min) {
|
962
|
+
this.clearMinValue = min;
|
963
|
+
|
964
|
+
if (typeof this.normalize === 'function') {
|
965
|
+
this.minValue = this.normalize(min);
|
966
|
+
} else {
|
967
|
+
this.minValue = min;
|
968
|
+
}
|
969
|
+
},
|
970
|
+
|
971
|
+
setMax: function (max) {
|
972
|
+
this.clearMaxValue = max;
|
973
|
+
if (typeof this.normalize === 'function') {
|
974
|
+
this.maxValue = this.normalize(max);
|
975
|
+
} else {
|
976
|
+
this.maxValue = max;
|
977
|
+
}
|
978
|
+
},
|
979
|
+
|
980
|
+
setColors: function (colors) {
|
981
|
+
for (var i = 0; i < colors.length; i++) {
|
982
|
+
colors[i] = ColorScale.rgbToArray(colors[i]);
|
983
|
+
}
|
984
|
+
this.colors = colors;
|
985
|
+
},
|
986
|
+
|
987
|
+
setNormalizeFunction: function (f) {
|
988
|
+
if (f === 'polynomial') {
|
989
|
+
this.normalize = function (value) {
|
990
|
+
return Math.pow(value, 0.2);
|
991
|
+
};
|
992
|
+
}
|
993
|
+
else if (f === 'linear') {
|
994
|
+
delete this.normalize;
|
995
|
+
} else {
|
996
|
+
this.normalize = f;
|
997
|
+
}
|
998
|
+
this.setMin(this.clearMinValue);
|
999
|
+
this.setMax(this.clearMaxValue);
|
1000
|
+
},
|
1001
|
+
|
1002
|
+
getColor: function (value) {
|
1003
|
+
if (typeof this.normalize === 'function') {
|
1004
|
+
value = this.normalize(value);
|
1005
|
+
}
|
1006
|
+
|
1007
|
+
var lengthes = [];
|
1008
|
+
var fullLength = 0;
|
1009
|
+
var l;
|
1010
|
+
|
1011
|
+
for (var i = 0; i < this.colors.length - 1; i++) {
|
1012
|
+
l = this.vectorLength(this.vectorSubtract(this.colors[i + 1], this.colors[i]));
|
1013
|
+
lengthes.push(l);
|
1014
|
+
fullLength += l;
|
1015
|
+
}
|
1016
|
+
|
1017
|
+
var c = (this.maxValue - this.minValue) / fullLength;
|
1018
|
+
|
1019
|
+
for (i = 0; i < lengthes.length; i++) {
|
1020
|
+
lengthes[i] *= c;
|
1021
|
+
}
|
1022
|
+
|
1023
|
+
i = 0;
|
1024
|
+
value -= this.minValue;
|
1025
|
+
|
1026
|
+
while (value - lengthes[i] >= 0) {
|
1027
|
+
value -= lengthes[i];
|
1028
|
+
i++;
|
1029
|
+
}
|
1030
|
+
|
1031
|
+
var color;
|
1032
|
+
if (i == this.colors.length - 1) {
|
1033
|
+
color = this.vectorToNum(this.colors[i]).toString(16);
|
1034
|
+
} else {
|
1035
|
+
color = (this.vectorToNum(this.vectorAdd(this.colors[i], this.vectorMult(this.vectorSubtract(this.colors[i + 1], this.colors[i]), (value) / (lengthes[i]))))).toString(16);
|
1036
|
+
}
|
1037
|
+
|
1038
|
+
while (color.length < 6) {
|
1039
|
+
color = '0' + color;
|
1040
|
+
}
|
1041
|
+
return '#' + color;
|
1042
|
+
},
|
1043
|
+
|
1044
|
+
vectorToNum: function (vector) {
|
1045
|
+
var num = 0;
|
1046
|
+
for (var i = 0; i < vector.length; i++) {
|
1047
|
+
num += Math.round(vector[i]) * Math.pow(256, vector.length - i - 1);
|
1048
|
+
}
|
1049
|
+
return num;
|
1050
|
+
},
|
1051
|
+
|
1052
|
+
vectorSubtract: function (vector1, vector2) {
|
1053
|
+
var vector = [];
|
1054
|
+
for (var i = 0; i < vector1.length; i++) {
|
1055
|
+
vector[i] = vector1[i] - vector2[i];
|
1056
|
+
}
|
1057
|
+
return vector;
|
1058
|
+
},
|
1059
|
+
|
1060
|
+
vectorAdd: function (vector1, vector2) {
|
1061
|
+
var vector = [];
|
1062
|
+
for (var i = 0; i < vector1.length; i++) {
|
1063
|
+
vector[i] = vector1[i] + vector2[i];
|
1064
|
+
}
|
1065
|
+
return vector;
|
1066
|
+
},
|
1067
|
+
|
1068
|
+
vectorMult: function (vector, num) {
|
1069
|
+
var result = [];
|
1070
|
+
for (var i = 0; i < vector.length; i++) {
|
1071
|
+
result[i] = vector[i] * num;
|
1072
|
+
}
|
1073
|
+
return result;
|
1074
|
+
},
|
1075
|
+
|
1076
|
+
vectorLength: function (vector) {
|
1077
|
+
var result = 0;
|
1078
|
+
for (var i = 0; i < vector.length; i++) {
|
1079
|
+
result += vector[i] * vector[i];
|
1080
|
+
}
|
1081
|
+
return Math.sqrt(result);
|
1082
|
+
}
|
1083
|
+
};
|
1084
|
+
|
1085
|
+
ColorScale.arrayToRgb = function (ar) {
|
1086
|
+
var rgb = '#';
|
1087
|
+
var d;
|
1088
|
+
for (var i = 0; i < ar.length; i++) {
|
1089
|
+
d = ar[i].toString(16);
|
1090
|
+
rgb += d.length == 1 ? '0' + d : d;
|
1091
|
+
}
|
1092
|
+
return rgb;
|
1093
|
+
};
|
1094
|
+
|
1095
|
+
ColorScale.rgbToArray = function (rgb) {
|
1096
|
+
rgb = rgb.substr(1);
|
1097
|
+
return [parseInt(rgb.substr(0, 2), 16), parseInt(rgb.substr(2, 2), 16), parseInt(rgb.substr(4, 2), 16)];
|
1098
|
+
};
|
1099
|
+
|
1100
|
+
})(jQuery);
|
@@ -0,0 +1,56 @@
|
|
1
|
+
/*!
|
2
|
+
* jQVMap Version 1.0
|
3
|
+
*
|
4
|
+
* http://jqvmap.com
|
5
|
+
*
|
6
|
+
* Copyright 2012, Peter Schmalfeldt <manifestinteractive@gmail.com>
|
7
|
+
* Licensed under the MIT license.
|
8
|
+
*
|
9
|
+
* Fork Me @ https://github.com/manifestinteractive/jqvmap
|
10
|
+
*/
|
11
|
+
.jqvmap-label
|
12
|
+
{
|
13
|
+
position: absolute;
|
14
|
+
display: none;
|
15
|
+
-webkit-border-radius: 3px;
|
16
|
+
-moz-border-radius: 3px;
|
17
|
+
border-radius: 3px;
|
18
|
+
background: #292929;
|
19
|
+
color: white;
|
20
|
+
font-family: sans-serif, Verdana;
|
21
|
+
font-size: smaller;
|
22
|
+
padding: 3px;
|
23
|
+
}
|
24
|
+
.jqvmap-zoomin, .jqvmap-zoomout
|
25
|
+
{
|
26
|
+
position: absolute;
|
27
|
+
left: 10px;
|
28
|
+
-webkit-border-radius: 3px;
|
29
|
+
-moz-border-radius: 3px;
|
30
|
+
border-radius: 3px;
|
31
|
+
background: #000000;
|
32
|
+
padding: 3px;
|
33
|
+
color: white;
|
34
|
+
width: 10px;
|
35
|
+
height: 10px;
|
36
|
+
cursor: pointer;
|
37
|
+
line-height: 10px;
|
38
|
+
text-align: center;
|
39
|
+
}
|
40
|
+
.jqvmap-zoomin
|
41
|
+
{
|
42
|
+
top: 10px;
|
43
|
+
}
|
44
|
+
.jqvmap-zoomout
|
45
|
+
{
|
46
|
+
top: 30px;
|
47
|
+
}
|
48
|
+
.jqvmap-region
|
49
|
+
{
|
50
|
+
cursor: pointer;
|
51
|
+
}
|
52
|
+
.jqvmap-ajax_response
|
53
|
+
{
|
54
|
+
width: 100%;
|
55
|
+
height: 500px;
|
56
|
+
}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jqvmap-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.1.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Manifest Interactive
|
@@ -57,8 +57,8 @@ files:
|
|
57
57
|
- jqvmap-rails.gemspec
|
58
58
|
- lib/jqvmap-rails.rb
|
59
59
|
- lib/jqvmap-rails/version.rb
|
60
|
-
- vendor/assets/javascripts/jquery
|
61
|
-
- vendor/assets/stylesheets/
|
60
|
+
- vendor/assets/javascripts/jquery.vmap.js
|
61
|
+
- vendor/assets/stylesheets/jqvmap.css
|
62
62
|
homepage: http://jqvmap.com/
|
63
63
|
licenses:
|
64
64
|
- MIT
|
@@ -1,8 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* jVectorMap version 1.2.2
|
3
|
-
*
|
4
|
-
* Copyright 2011-2013, Kirill Lebedev
|
5
|
-
* Licensed under the MIT license.
|
6
|
-
*
|
7
|
-
*/(function(e){var t={set:{colors:1,values:1,backgroundColor:1,scaleColors:1,normalizeFunction:1,focus:1},get:{selectedRegions:1,selectedMarkers:1,mapObject:1,regionName:1}};e.fn.vectorMap=function(e){var n,r,i,n=this.children(".jvectormap-container").data("mapObject");if(e==="addMap")jvm.WorldMap.maps[arguments[1]]=arguments[2];else{if(!(e!=="set"&&e!=="get"||!t[e][arguments[1]]))return r=arguments[1].charAt(0).toUpperCase()+arguments[1].substr(1),n[e+r].apply(n,Array.prototype.slice.call(arguments,2));e=e||{},e.container=this,n=new jvm.WorldMap(e)}return this}})(jQuery),function(e){function r(t){var n=t||window.event,r=[].slice.call(arguments,1),i=0,s=!0,o=0,u=0;return t=e.event.fix(n),t.type="mousewheel",n.wheelDelta&&(i=n.wheelDelta/120),n.detail&&(i=-n.detail/3),u=i,n.axis!==undefined&&n.axis===n.HORIZONTAL_AXIS&&(u=0,o=-1*i),n.wheelDeltaY!==undefined&&(u=n.wheelDeltaY/120),n.wheelDeltaX!==undefined&&(o=-1*n.wheelDeltaX/120),r.unshift(t,i,o,u),(e.event.dispatch||e.event.handle).apply(this,r)}var t=["DOMMouseScroll","mousewheel"];if(e.event.fixHooks)for(var n=t.length;n;)e.event.fixHooks[t[--n]]=e.event.mouseHooks;e.event.special.mousewheel={setup:function(){if(this.addEventListener)for(var e=t.length;e;)this.addEventListener(t[--e],r,!1);else this.onmousewheel=r},teardown:function(){if(this.removeEventListener)for(var e=t.length;e;)this.removeEventListener(t[--e],r,!1);else this.onmousewheel=null}},e.fn.extend({mousewheel:function(e){return e?this.bind("mousewheel",e):this.trigger("mousewheel")},unmousewheel:function(e){return this.unbind("mousewheel",e)}})}(jQuery);var jvm={inherits:function(e,t){function n(){}n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e,e.parentClass=t},mixin:function(e,t){var n;for(n in t.prototype)t.prototype.hasOwnProperty(n)&&(e.prototype[n]=t.prototype[n])},min:function(e){var t=Number.MAX_VALUE,n;if(e instanceof Array)for(n=0;n<e.length;n++)e[n]<t&&(t=e[n]);else for(n in e)e[n]<t&&(t=e[n]);return t},max:function(e){var t=Number.MIN_VALUE,n;if(e instanceof Array)for(n=0;n<e.length;n++)e[n]>t&&(t=e[n]);else for(n in e)e[n]>t&&(t=e[n]);return t},keys:function(e){var t=[],n;for(n in e)t.push(n);return t},values:function(e){var t=[],n,r;for(r=0;r<arguments.length;r++){e=arguments[r];for(n in e)t.push(e[n])}return t}};jvm.$=jQuery,jvm.AbstractElement=function(e,t){this.node=this.createElement(e),this.name=e,this.properties={},t&&this.set(t)},jvm.AbstractElement.prototype.set=function(e,t){var n;if(typeof e=="object")for(n in e)this.properties[n]=e[n],this.applyAttr(n,e[n]);else this.properties[e]=t,this.applyAttr(e,t)},jvm.AbstractElement.prototype.get=function(e){return this.properties[e]},jvm.AbstractElement.prototype.applyAttr=function(e,t){this.node.setAttribute(e,t)},jvm.AbstractElement.prototype.remove=function(){jvm.$(this.node).remove()},jvm.AbstractCanvasElement=function(e,t,n){this.container=e,this.setSize(t,n),this.rootElement=new jvm[this.classPrefix+"GroupElement"],this.node.appendChild(this.rootElement.node),this.container.appendChild(this.node)},jvm.AbstractCanvasElement.prototype.add=function(e,t){t=t||this.rootElement,t.add(e),e.canvas=this},jvm.AbstractCanvasElement.prototype.addPath=function(e,t,n){var r=new jvm[this.classPrefix+"PathElement"](e,t);return this.add(r,n),r},jvm.AbstractCanvasElement.prototype.addCircle=function(e,t,n){var r=new jvm[this.classPrefix+"CircleElement"](e,t);return this.add(r,n),r},jvm.AbstractCanvasElement.prototype.addGroup=function(e){var t=new jvm[this.classPrefix+"GroupElement"];return e?e.node.appendChild(t.node):this.node.appendChild(t.node),t.canvas=this,t},jvm.AbstractShapeElement=function(e,t,n){this.style=n||{},this.style.current={},this.isHovered=!1,this.isSelected=!1,this.updateStyle()},jvm.AbstractShapeElement.prototype.setHovered=function(e){this.isHovered!==e&&(this.isHovered=e,this.updateStyle())},jvm.AbstractShapeElement.prototype.setSelected=function(e){this.isSelected!==e&&(this.isSelected=e,this.updateStyle(),jvm.$(this.node).trigger("selected",[e]))},jvm.AbstractShapeElement.prototype.setStyle=function(e,t){var n={};typeof e=="object"?n=e:n[e]=t,jvm.$.extend(this.style.current,n),this.updateStyle()},jvm.AbstractShapeElement.prototype.updateStyle=function(){var e={};jvm.AbstractShapeElement.mergeStyles(e,this.style.initial),jvm.AbstractShapeElement.mergeStyles(e,this.style.current),this.isHovered&&jvm.AbstractShapeElement.mergeStyles(e,this.style.hover),this.isSelected&&(jvm.AbstractShapeElement.mergeStyles(e,this.style.selected),this.isHovered&&jvm.AbstractShapeElement.mergeStyles(e,this.style.selectedHover)),this.set(e)},jvm.AbstractShapeElement.mergeStyles=function(e,t){var n;t=t||{};for(n in t)t[n]===null?delete e[n]:e[n]=t[n]},jvm.SVGElement=function(e,t){jvm.SVGElement.parentClass.apply(this,arguments)},jvm.inherits(jvm.SVGElement,jvm.AbstractElement),jvm.SVGElement.svgns="http://www.w3.org/2000/svg",jvm.SVGElement.prototype.createElement=function(e){return document.createElementNS(jvm.SVGElement.svgns,e)},jvm.SVGElement.prototype.addClass=function(e){this.node.setAttribute("class",e)},jvm.SVGElement.prototype.getElementCtr=function(e){return jvm["SVG"+e]},jvm.SVGElement.prototype.getBBox=function(){return this.node.getBBox()},jvm.SVGGroupElement=function(){jvm.SVGGroupElement.parentClass.call(this,"g")},jvm.inherits(jvm.SVGGroupElement,jvm.SVGElement),jvm.SVGGroupElement.prototype.add=function(e){this.node.appendChild(e.node)},jvm.SVGCanvasElement=function(e,t,n){this.classPrefix="SVG",jvm.SVGCanvasElement.parentClass.call(this,"svg"),jvm.AbstractCanvasElement.apply(this,arguments)},jvm.inherits(jvm.SVGCanvasElement,jvm.SVGElement),jvm.mixin(jvm.SVGCanvasElement,jvm.AbstractCanvasElement),jvm.SVGCanvasElement.prototype.setSize=function(e,t){this.width=e,this.height=t,this.node.setAttribute("width",e),this.node.setAttribute("height",t)},jvm.SVGCanvasElement.prototype.applyTransformParams=function(e,t,n){this.scale=e,this.transX=t,this.transY=n,this.rootElement.node.setAttribute("transform","scale("+e+") translate("+t+", "+n+")")},jvm.SVGShapeElement=function(e,t,n){jvm.SVGShapeElement.parentClass.call(this,e,t),jvm.AbstractShapeElement.apply(this,arguments)},jvm.inherits(jvm.SVGShapeElement,jvm.SVGElement),jvm.mixin(jvm.SVGShapeElement,jvm.AbstractShapeElement),jvm.SVGPathElement=function(e,t){jvm.SVGPathElement.parentClass.call(this,"path",e,t),this.node.setAttribute("fill-rule","evenodd")},jvm.inherits(jvm.SVGPathElement,jvm.SVGShapeElement),jvm.SVGCircleElement=function(e,t){jvm.SVGCircleElement.parentClass.call(this,"circle",e,t)},jvm.inherits(jvm.SVGCircleElement,jvm.SVGShapeElement),jvm.VMLElement=function(e,t){jvm.VMLElement.VMLInitialized||jvm.VMLElement.initializeVML(),jvm.VMLElement.parentClass.apply(this,arguments)},jvm.inherits(jvm.VMLElement,jvm.AbstractElement),jvm.VMLElement.VMLInitialized=!1,jvm.VMLElement.initializeVML=function(){try{document.namespaces.rvml||document.namespaces.add("rvml","urn:schemas-microsoft-com:vml"),jvm.VMLElement.prototype.createElement=function(e){return document.createElement("<rvml:"+e+' class="rvml">')}}catch(e){jvm.VMLElement.prototype.createElement=function(e){return document.createElement("<"+e+' xmlns="urn:schemas-microsoft.com:vml" class="rvml">')}}document.createStyleSheet().addRule(".rvml","behavior:url(#default#VML)"),jvm.VMLElement.VMLInitialized=!0},jvm.VMLElement.prototype.getElementCtr=function(e){return jvm["VML"+e]},jvm.VMLElement.prototype.addClass=function(e){jvm.$(this.node).addClass(e)},jvm.VMLElement.prototype.applyAttr=function(e,t){this.node[e]=t},jvm.VMLElement.prototype.getBBox=function(){var e=jvm.$(this.node);return{x:e.position().left/this.canvas.scale,y:e.position().top/this.canvas.scale,width:e.width()/this.canvas.scale,height:e.height()/this.canvas.scale}},jvm.VMLGroupElement=function(){jvm.VMLGroupElement.parentClass.call(this,"group"),this.node.style.left="0px",this.node.style.top="0px",this.node.coordorigin="0 0"},jvm.inherits(jvm.VMLGroupElement,jvm.VMLElement),jvm.VMLGroupElement.prototype.add=function(e){this.node.appendChild(e.node)},jvm.VMLCanvasElement=function(e,t,n){this.classPrefix="VML",jvm.VMLCanvasElement.parentClass.call(this,"group"),jvm.AbstractCanvasElement.apply(this,arguments),this.node.style.position="absolute"},jvm.inherits(jvm.VMLCanvasElement,jvm.VMLElement),jvm.mixin(jvm.VMLCanvasElement,jvm.AbstractCanvasElement),jvm.VMLCanvasElement.prototype.setSize=function(e,t){var n,r,i,s;this.width=e,this.height=t,this.node.style.width=e+"px",this.node.style.height=t+"px",this.node.coordsize=e+" "+t,this.node.coordorigin="0 0";if(this.rootElement){n=this.rootElement.node.getElementsByTagName("shape");for(i=0,s=n.length;i<s;i++)n[i].coordsize=e+" "+t,n[i].style.width=e+"px",n[i].style.height=t+"px";r=this.node.getElementsByTagName("group");for(i=0,s=r.length;i<s;i++)r[i].coordsize=e+" "+t,r[i].style.width=e+"px",r[i].style.height=t+"px"}},jvm.VMLCanvasElement.prototype.applyTransformParams=function(e,t,n){this.scale=e,this.transX=t,this.transY=n,this.rootElement.node.coordorigin=this.width-t-this.width/100+","+(this.height-n-this.height/100),this.rootElement.node.coordsize=this.width/e+","+this.height/e},jvm.VMLShapeElement=function(e,t){jvm.VMLShapeElement.parentClass.call(this,e,t),this.fillElement=new jvm.VMLElement("fill"),this.strokeElement=new jvm.VMLElement("stroke"),this.node.appendChild(this.fillElement.node),this.node.appendChild(this.strokeElement.node),this.node.stroked=!1,jvm.AbstractShapeElement.apply(this,arguments)},jvm.inherits(jvm.VMLShapeElement,jvm.VMLElement),jvm.mixin(jvm.VMLShapeElement,jvm.AbstractShapeElement),jvm.VMLShapeElement.prototype.applyAttr=function(e,t){switch(e){case"fill":this.node.fillcolor=t;break;case"fill-opacity":this.fillElement.node.opacity=Math.round(t*100)+"%";break;case"stroke":t==="none"?this.node.stroked=!1:this.node.stroked=!0,this.node.strokecolor=t;break;case"stroke-opacity":this.strokeElement.node.opacity=Math.round(t*100)+"%";break;case"stroke-width":parseInt(t,10)===0?this.node.stroked=!1:this.node.stroked=!0,this.node.strokeweight=t;break;case"d":this.node.path=jvm.VMLPathElement.pathSvgToVml(t);break;default:jvm.VMLShapeElement.parentClass.prototype.applyAttr.apply(this,arguments)}},jvm.VMLPathElement=function(e,t){var n=new jvm.VMLElement("skew");jvm.VMLPathElement.parentClass.call(this,"shape",e,t),this.node.coordorigin="0 0",n.node.on=!0,n.node.matrix="0.01,0,0,0.01,0,0",n.node.offset="0,0",this.node.appendChild(n.node)},jvm.inherits(jvm.VMLPathElement,jvm.VMLShapeElement),jvm.VMLPathElement.prototype.applyAttr=function(e,t){e==="d"?this.node.path=jvm.VMLPathElement.pathSvgToVml(t):jvm.VMLShapeElement.prototype.applyAttr.call(this,e,t)},jvm.VMLPathElement.pathSvgToVml=function(e){var t="",n=0,r=0,i,s;return e=e.replace(/(-?\d+)e(-?\d+)/g,"0"),e.replace(/([MmLlHhVvCcSs])\s*((?:-?\d*(?:\.\d+)?\s*,?\s*)+)/g,function(e,t,o,u){o=o.replace(/(\d)-/g,"$1,-").replace(/^\s+/g,"").replace(/\s+$/g,"").replace(/\s+/g,",").split(","),o[0]||o.shift();for(var a=0,f=o.length;a<f;a++)o[a]=Math.round(100*o[a]);switch(t){case"m":return n+=o[0],r+=o[1],"t"+o.join(",");case"M":return n=o[0],r=o[1],"m"+o.join(",");case"l":return n+=o[0],r+=o[1],"r"+o.join(",");case"L":return n=o[0],r=o[1],"l"+o.join(",");case"h":return n+=o[0],"r"+o[0]+",0";case"H":return n=o[0],"l"+n+","+r;case"v":return r+=o[0],"r0,"+o[0];case"V":return r=o[0],"l"+n+","+r;case"c":return i=n+o[o.length-4],s=r+o[o.length-3],n+=o[o.length-2],r+=o[o.length-1],"v"+o.join(",");case"C":return i=o[o.length-4],s=o[o.length-3],n=o[o.length-2],r=o[o.length-1],"c"+o.join(",");case"s":return o.unshift(r-s),o.unshift(n-i),i=n+o[o.length-4],s=r+o[o.length-3],n+=o[o.length-2],r+=o[o.length-1],"v"+o.join(",");case"S":return o.unshift(r+r-s),o.unshift(n+n-i),i=o[o.length-4],s=o[o.length-3],n=o[o.length-2],r=o[o.length-1],"c"+o.join(",")}return""}).replace(/z/g,"e")},jvm.VMLCircleElement=function(e,t){jvm.VMLCircleElement.parentClass.call(this,"oval",e,t)},jvm.inherits(jvm.VMLCircleElement,jvm.VMLShapeElement),jvm.VMLCircleElement.prototype.applyAttr=function(e,t){switch(e){case"r":this.node.style.width=t*2+"px",this.node.style.height=t*2+"px",this.applyAttr("cx",this.get("cx")||0),this.applyAttr("cy",this.get("cy")||0);break;case"cx":if(!t)return;this.node.style.left=t-(this.get("r")||0)+"px";break;case"cy":if(!t)return;this.node.style.top=t-(this.get("r")||0)+"px";break;default:jvm.VMLCircleElement.parentClass.prototype.applyAttr.call(this,e,t)}},jvm.VectorCanvas=function(e,t,n){return this.mode=window.SVGAngle?"svg":"vml",this.mode=="svg"?this.impl=new jvm.SVGCanvasElement(e,t,n):this.impl=new jvm.VMLCanvasElement(e,t,n),this.impl},jvm.SimpleScale=function(e){this.scale=e},jvm.SimpleScale.prototype.getValue=function(e){return e},jvm.OrdinalScale=function(e){this.scale=e},jvm.OrdinalScale.prototype.getValue=function(e){return this.scale[e]},jvm.NumericScale=function(e,t,n,r){this.scale=[],t=t||"linear",e&&this.setScale(e),t&&this.setNormalizeFunction(t),n&&this.setMin(n),r&&this.setMax(r)},jvm.NumericScale.prototype={setMin:function(e){this.clearMinValue=e,typeof this.normalize=="function"?this.minValue=this.normalize(e):this.minValue=e},setMax:function(e){this.clearMaxValue=e,typeof this.normalize=="function"?this.maxValue=this.normalize(e):this.maxValue=e},setScale:function(e){var t;for(t=0;t<e.length;t++)this.scale[t]=[e[t]]},setNormalizeFunction:function(e){e==="polynomial"?this.normalize=function(e){return Math.pow(e,.2)}:e==="linear"?delete this.normalize:this.normalize=e,this.setMin(this.clearMinValue),this.setMax(this.clearMaxValue)},getValue:function(e){var t=[],n=0,r,i=0,s;typeof this.normalize=="function"&&(e=this.normalize(e));for(i=0;i<this.scale.length-1;i++)r=this.vectorLength(this.vectorSubtract(this.scale[i+1],this.scale[i])),t.push(r),n+=r;s=(this.maxValue-this.minValue)/n;for(i=0;i<t.length;i++)t[i]*=s;i=0,e-=this.minValue;while(e-t[i]>=0)e-=t[i],i++;return i==this.scale.length-1?e=this.vectorToNum(this.scale[i]):e=this.vectorToNum(this.vectorAdd(this.scale[i],this.vectorMult(this.vectorSubtract(this.scale[i+1],this.scale[i]),e/t[i]))),e},vectorToNum:function(e){var t=0,n;for(n=0;n<e.length;n++)t+=Math.round(e[n])*Math.pow(256,e.length-n-1);return t},vectorSubtract:function(e,t){var n=[],r;for(r=0;r<e.length;r++)n[r]=e[r]-t[r];return n},vectorAdd:function(e,t){var n=[],r;for(r=0;r<e.length;r++)n[r]=e[r]+t[r];return n},vectorMult:function(e,t){var n=[],r;for(r=0;r<e.length;r++)n[r]=e[r]*t;return n},vectorLength:function(e){var t=0,n;for(n=0;n<e.length;n++)t+=e[n]*e[n];return Math.sqrt(t)}},jvm.ColorScale=function(e,t,n,r){jvm.ColorScale.parentClass.apply(this,arguments)},jvm.inherits(jvm.ColorScale,jvm.NumericScale),jvm.ColorScale.prototype.setScale=function(e){var t;for(t=0;t<e.length;t++)this.scale[t]=jvm.ColorScale.rgbToArray(e[t])},jvm.ColorScale.prototype.getValue=function(e){return jvm.ColorScale.numToRgb(jvm.ColorScale.parentClass.prototype.getValue.call(this,e))},jvm.ColorScale.arrayToRgb=function(e){var t="#",n,r;for(r=0;r<e.length;r++)n=e[r].toString(16),t+=n.length==1?"0"+n:n;return t},jvm.ColorScale.numToRgb=function(e){e=e.toString(16);while(e.length<6)e="0"+e;return"#"+e},jvm.ColorScale.rgbToArray=function(e){return e=e.substr(1),[parseInt(e.substr(0,2),16),parseInt(e.substr(2,2),16),parseInt(e.substr(4,2),16)]},jvm.DataSeries=function(e,t){var n;e=e||{},e.attribute=e.attribute||"fill",this.elements=t,this.params=e,e.attributes&&this.setAttributes(e.attributes),jvm.$.isArray(e.scale)?(n=e.attribute==="fill"||e.attribute==="stroke"?jvm.ColorScale:jvm.NumericScale,this.scale=new n(e.scale,e.normalizeFunction,e.min,e.max)):e.scale?this.scale=new jvm.OrdinalScale(e.scale):this.scale=new jvm.SimpleScale(e.scale),this.values=e.values||{},this.setValues(this.values)},jvm.DataSeries.prototype={setAttributes:function(e,t){var n=e,r;if(typeof e=="string")this.elements[e]&&this.elements[e].setStyle(this.params.attribute,t);else for(r in n)this.elements[r]&&this.elements[r].element.setStyle(this.params.attribute,n[r])},setValues:function(e){var t=Number.MIN_VALUE,n=Number.MAX_VALUE,r,i,s={};if(this.scale instanceof jvm.OrdinalScale||this.scale instanceof jvm.SimpleScale)for(i in e)e[i]?s[i]=this.scale.getValue(e[i]):s[i]=this.elements[i].element.style.initial[this.params.attribute];else{if(!this.params.min||!this.params.max){for(i in e)r=parseFloat(e[i]),r>t&&(t=e[i]),r<n&&(n=r);this.params.min||this.scale.setMin(n),this.params.max||this.scale.setMax(t),this.params.min=n,this.params.max=t}for(i in e)r=parseFloat(e[i]),isNaN(r)?s[i]=this.elements[i].element.style.initial[this.params.attribute]:s[i]=this.scale.getValue(r)}this.setAttributes(s),jvm.$.extend(this.values,e)},clear:function(){var e,t={};for(e in this.values)this.elements[e]&&(t[e]=this.elements[e].element.style.initial[this.params.attribute]);this.setAttributes(t),this.values={}},setScale:function(e){this.scale.setScale(e),this.values&&this.setValues(this.values)},setNormalizeFunction:function(e){this.scale.setNormalizeFunction(e),this.values&&this.setValues(this.values)}},jvm.Proj={degRad:180/Math.PI,radDeg:Math.PI/180,radius:6381372,sgn:function(e){return e>0?1:e<0?-1:e},mill:function(e,t,n){return{x:this.radius*(t-n)*this.radDeg,y:-this.radius*Math.log(Math.tan((45+.4*e)*this.radDeg))/.8}},mill_inv:function(e,t,n){return{lat:(2.5*Math.atan(Math.exp(.8*t/this.radius))-5*Math.PI/8)*this.degRad,lng:(n*this.radDeg+e/this.radius)*this.degRad}},merc:function(e,t,n){return{x:this.radius*(t-n)*this.radDeg,y:-this.radius*Math.log(Math.tan(Math.PI/4+e*Math.PI/360))}},merc_inv:function(e,t,n){return{lat:(2*Math.atan(Math.exp(t/this.radius))-Math.PI/2)*this.degRad,lng:(n*this.radDeg+e/this.radius)*this.degRad}},aea:function(e,t,n){var r=0,i=n*this.radDeg,s=29.5*this.radDeg,o=45.5*this.radDeg,u=e*this.radDeg,a=t*this.radDeg,f=(Math.sin(s)+Math.sin(o))/2,l=Math.cos(s)*Math.cos(s)+2*f*Math.sin(s),c=f*(a-i),h=Math.sqrt(l-2*f*Math.sin(u))/f,p=Math.sqrt(l-2*f*Math.sin(r))/f;return{x:h*Math.sin(c)*this.radius,y:-(p-h*Math.cos(c))*this.radius}},aea_inv:function(e,t,n){var r=e/this.radius,i=t/this.radius,s=0,o=n*this.radDeg,u=29.5*this.radDeg,a=45.5*this.radDeg,f=(Math.sin(u)+Math.sin(a))/2,l=Math.cos(u)*Math.cos(u)+2*f*Math.sin(u),c=Math.sqrt(l-2*f*Math.sin(s))/f,h=Math.sqrt(r*r+(c-i)*(c-i)),p=Math.atan(r/(c-i));return{lat:Math.asin((l-h*h*f*f)/(2*f))*this.degRad,lng:(o+p/f)*this.degRad}},lcc:function(e,t,n){var r=0,i=n*this.radDeg,s=t*this.radDeg,o=33*this.radDeg,u=45*this.radDeg,a=e*this.radDeg,f=Math.log(Math.cos(o)*(1/Math.cos(u)))/Math.log(Math.tan(Math.PI/4+u/2)*(1/Math.tan(Math.PI/4+o/2))),l=Math.cos(o)*Math.pow(Math.tan(Math.PI/4+o/2),f)/f,c=l*Math.pow(1/Math.tan(Math.PI/4+a/2),f),h=l*Math.pow(1/Math.tan(Math.PI/4+r/2),f);return{x:c*Math.sin(f*(s-i))*this.radius,y:-(h-c*Math.cos(f*(s-i)))*this.radius}},lcc_inv:function(e,t,n){var r=e/this.radius,i=t/this.radius,s=0,o=n*this.radDeg,u=33*this.radDeg,a=45*this.radDeg,f=Math.log(Math.cos(u)*(1/Math.cos(a)))/Math.log(Math.tan(Math.PI/4+a/2)*(1/Math.tan(Math.PI/4+u/2))),l=Math.cos(u)*Math.pow(Math.tan(Math.PI/4+u/2),f)/f,c=l*Math.pow(1/Math.tan(Math.PI/4+s/2),f),h=this.sgn(f)*Math.sqrt(r*r+(c-i)*(c-i)),p=Math.atan(r/(c-i));return{lat:(2*Math.atan(Math.pow(l/h,1/f))-Math.PI/2)*this.degRad,lng:(o+p/f)*this.degRad}}},jvm.WorldMap=function(e){var t=this,n;this.params=jvm.$.extend(!0,{},jvm.WorldMap.defaultParams,e);if(!jvm.WorldMap.maps[this.params.map])throw new Error("Attempt to use map which was not loaded: "+this.params.map);this.mapData=jvm.WorldMap.maps[this.params.map],this.markers={},this.regions={},this.regionsColors={},this.regionsData={},this.container=jvm.$("<div>").css({width:"100%",height:"100%"}).addClass("jvectormap-container"),this.params.container.append(this.container),this.container.data("mapObject",this),this.container.css({position:"relative",overflow:"hidden"}),this.defaultWidth=this.mapData.width,this.defaultHeight=this.mapData.height,this.setBackgroundColor(this.params.backgroundColor),this.onResize=function(){t.setSize()},jvm.$(window).resize(this.onResize);for(n in jvm.WorldMap.apiEvents)this.params[n]&&this.container.bind(jvm.WorldMap.apiEvents[n]+".jvectormap",this.params[n]);this.canvas=new jvm.VectorCanvas(this.container[0],this.width,this.height),"ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch?this.params.bindTouchEvents&&this.bindContainerTouchEvents():this.bindContainerEvents(),this.bindElementEvents(),this.createLabel(),this.params.zoomButtons&&this.bindZoomButtons(),this.createRegions(),this.createMarkers(this.params.markers||{}),this.setSize(),this.params.focusOn&&(typeof this.params.focusOn=="object"?this.setFocus.call(this,this.params.focusOn.scale,this.params.focusOn.x,this.params.focusOn.y):this.setFocus.call(this,this.params.focusOn)),this.params.selectedRegions&&this.setSelectedRegions(this.params.selectedRegions),this.params.selectedMarkers&&this.setSelectedMarkers(this.params.selectedMarkers),this.params.series&&this.createSeries()},jvm.WorldMap.prototype={transX:0,transY:0,scale:1,baseTransX:0,baseTransY:0,baseScale:1,width:0,height:0,setBackgroundColor:function(e){this.container.css("background-color",e)},resize:function(){var e=this.baseScale;this.width/this.height>this.defaultWidth/this.defaultHeight?(this.baseScale=this.height/this.defaultHeight,this.baseTransX=Math.abs(this.width-this.defaultWidth*this.baseScale)/(2*this.baseScale)):(this.baseScale=this.width/this.defaultWidth,this.baseTransY=Math.abs(this.height-this.defaultHeight*this.baseScale)/(2*this.baseScale)),this.scale*=this.baseScale/e,this.transX*=this.baseScale/e,this.transY*=this.baseScale/e},setSize:function(){this.width=this.container.width(),this.height=this.container.height(),this.resize(),this.canvas.setSize(this.width,this.height),this.applyTransform()},reset:function(){var e,t;for(e in this.series)for(t=0;t<this.series[e].length;t++)this.series[e][t].clear();this.scale=this.baseScale,this.transX=this.baseTransX,this.transY=this.baseTransY,this.applyTransform()},applyTransform:function(){var e,t,n,r;this.defaultWidth*this.scale<=this.width?(e=(this.width-this.defaultWidth*this.scale)/(2*this.scale),n=(this.width-this.defaultWidth*this.scale)/(2*this.scale)):(e=0,n=(this.width-this.defaultWidth*this.scale)/this.scale),this.defaultHeight*this.scale<=this.height?(t=(this.height-this.defaultHeight*this.scale)/(2*this.scale),r=(this.height-this.defaultHeight*this.scale)/(2*this.scale)):(t=0,r=(this.height-this.defaultHeight*this.scale)/this.scale),this.transY>t?this.transY=t:this.transY<r&&(this.transY=r),this.transX>e?this.transX=e:this.transX<n&&(this.transX=n),this.canvas.applyTransformParams(this.scale,this.transX,this.transY),this.markers&&this.repositionMarkers(),this.container.trigger("viewportChange",[this.scale/this.baseScale,this.transX,this.transY])},bindContainerEvents:function(){var e=!1,t,n,r=this;this.container.mousemove(function(i){return e&&(r.transX-=(t-i.pageX)/r.scale,r.transY-=(n-i.pageY)/r.scale,r.applyTransform(),t=i.pageX,n=i.pageY),!1}).mousedown(function(r){return e=!0,t=r.pageX,n=r.pageY,!1}),jvm.$("body").mouseup(function(){e=!1}),this.params.zoomOnScroll&&this.container.mousewheel(function(e,t,n,i){var s=jvm.$(r.container).offset(),o=e.pageX-s.left,u=e.pageY-s.top,a=Math.pow(1.3,i);r.label.hide(),r.setScale(r.scale*a,o,u),e.preventDefault()})},bindContainerTouchEvents:function(){var e,t,n=this,r,i,s,o,u,a=function(a){var f=a.originalEvent.touches,l,c,h,p;a.type=="touchstart"&&(u=0),f.length==1?(u==1&&(h=n.transX,p=n.transY,n.transX-=(r-f[0].pageX)/n.scale,n.transY-=(i-f[0].pageY)/n.scale,n.applyTransform(),n.label.hide(),(h!=n.transX||p!=n.transY)&&a.preventDefault()),r=f[0].pageX,i=f[0].pageY):f.length==2&&(u==2?(c=Math.sqrt(Math.pow(f[0].pageX-f[1].pageX,2)+Math.pow(f[0].pageY-f[1].pageY,2))/t,n.setScale(e*c,s,o),n.label.hide(),a.preventDefault()):(l=jvm.$(n.container).offset(),f[0].pageX>f[1].pageX?s=f[1].pageX+(f[0].pageX-f[1].pageX)/2:s=f[0].pageX+(f[1].pageX-f[0].pageX)/2,f[0].pageY>f[1].pageY?o=f[1].pageY+(f[0].pageY-f[1].pageY)/2:o=f[0].pageY+(f[1].pageY-f[0].pageY)/2,s-=l.left,o-=l.top,e=n.scale,t=Math.sqrt(Math.pow(f[0].pageX-f[1].pageX,2)+Math.pow(f[0].pageY-f[1].pageY,2)))),u=f.length};jvm.$(this.container).bind("touchstart",a),jvm.$(this.container).bind("touchmove",a)},bindElementEvents:function(){var e=this,t;this.container.mousemove(function(){t=!0}),this.container.delegate("[class~='jvectormap-element']","mouseover mouseout",function(t){var n=this,r=jvm.$(this).attr("class").baseVal?jvm.$(this).attr("class").baseVal:jvm.$(this).attr("class"),i=r.indexOf("jvectormap-region")===-1?"marker":"region",s=i=="region"?jvm.$(this).attr("data-code"):jvm.$(this).attr("data-index"),o=i=="region"?e.regions[s].element:e.markers[s].element,u=i=="region"?e.mapData.paths[s].name:e.markers[s].config.name||"",a=jvm.$.Event(i+"LabelShow.jvectormap"),f=jvm.$.Event(i+"Over.jvectormap");t.type=="mouseover"?(e.container.trigger(f,[s]),f.isDefaultPrevented()||o.setHovered(!0),e.label.text(u),e.container.trigger(a,[e.label,s]),a.isDefaultPrevented()||(e.label.show(),e.labelWidth=e.label.width(),e.labelHeight=e.label.height())):(o.setHovered(!1),e.label.hide(),e.container.trigger(i+"Out.jvectormap",[s]))}),this.container.delegate("[class~='jvectormap-element']","mousedown",function(e){t=!1}),this.container.delegate("[class~='jvectormap-element']","mouseup",function(n){var r=this,i=jvm.$(this).attr("class").baseVal?jvm.$(this).attr("class").baseVal:jvm.$(this).attr("class"),s=i.indexOf("jvectormap-region")===-1?"marker":"region",o=s=="region"?jvm.$(this).attr("data-code"):jvm.$(this).attr("data-index"),u=jvm.$.Event(s+"Click.jvectormap"),a=s=="region"?e.regions[o].element:e.markers[o].element;if(!t){e.container.trigger(u,[o]);if(s==="region"&&e.params.regionsSelectable||s==="marker"&&e.params.markersSelectable)u.isDefaultPrevented()||(e.params[s+"sSelectableOne"]&&e.clearSelected(s+"s"),a.setSelected(!a.isSelected))}})},bindZoomButtons:function(){var e=this;jvm.$("<div/>").addClass("jvectormap-zoomin").text("+").appendTo(this.container),jvm.$("<div/>").addClass("jvectormap-zoomout").html("−").appendTo(this.container),this.container.find(".jvectormap-zoomin").click(function(){e.setScale(e.scale*e.params.zoomStep,e.width/2,e.height/2)}),this.container.find(".jvectormap-zoomout").click(function(){e.setScale(e.scale/e.params.zoomStep,e.width/2,e.height/2)})},createLabel:function(){var e=this;this.label=jvm.$("<div/>").addClass("jvectormap-label").appendTo(jvm.$("body")),this.container.mousemove(function(t){var n=t.pageX-15-e.labelWidth,r=t.pageY-15-e.labelHeight;n<5&&(n=t.pageX+15),r<5&&(r=t.pageY+15),e.label.is(":visible")&&e.label.css({left:n,top:r})})},setScale:function(e,t,n,r){var i,s=jvm.$.Event("zoom.jvectormap");e>this.params.zoomMax*this.baseScale?e=this.params.zoomMax*this.baseScale:e<this.params.zoomMin*this.baseScale&&(e=this.params.zoomMin*this.baseScale),typeof t!="undefined"&&typeof n!="undefined"&&(i=e/this.scale,r?(this.transX=t+this.defaultWidth*(this.width/(this.defaultWidth*e))/2,this.transY=n+this.defaultHeight*(this.height/(this.defaultHeight*e))/2):(this.transX-=(i-1)/e*t,this.transY-=(i-1)/e*n)),this.scale=e,this.applyTransform(),this.container.trigger(s,[e/this.baseScale])},setFocus:function(e,t,n){var r,i,s,o,u;if(jvm.$.isArray(e)||this.regions[e]){jvm.$.isArray(e)?o=e:o=[e];for(u=0;u<o.length;u++)this.regions[o[u]]&&(i=this.regions[o[u]].element.getBBox(),i&&(typeof r=="undefined"?r=i:(s={x:Math.min(r.x,i.x),y:Math.min(r.y,i.y),width:Math.max(r.x+r.width,i.x+i.width)-Math.min(r.x,i.x),height:Math.max(r.y+r.height,i.y+i.height)-Math.min(r.y,i.y)},r=s)));this.setScale(Math.min(this.width/r.width,this.height/r.height),-(r.x+r.width/2),-(r.y+r.height/2),!0)}else e*=this.baseScale,this.setScale(e,-t*this.defaultWidth,-n*this.defaultHeight,!0)},getSelected:function(e){var t,n=[];for(t in this[e])this[e][t].element.isSelected&&n.push(t);return n},getSelectedRegions:function(){return this.getSelected("regions")},getSelectedMarkers:function(){return this.getSelected("markers")},setSelected:function(e,t){var n;typeof t!="object"&&(t=[t]);if(jvm.$.isArray(t))for(n=0;n<t.length;n++)this[e][t[n]].element.setSelected(!0);else for(n in t)this[e][n].element.setSelected(!!t[n])},setSelectedRegions:function(e){this.setSelected("regions",e)},setSelectedMarkers:function(e){this.setSelected("markers",e)},clearSelected:function(e){var t={},n=this.getSelected(e),r;for(r=0;r<n.length;r++)t[n[r]]=!1;this.setSelected(e,t)},clearSelectedRegions:function(){this.clearSelected("regions")},clearSelectedMarkers:function(){this.clearSelected("markers")},getMapObject:function(){return this},getRegionName:function(e){return this.mapData.paths[e].name},createRegions:function(){var e,t,n=this;for(e in this.mapData.paths)t=this.canvas.addPath({d:this.mapData.paths[e].path,"data-code":e},jvm.$.extend(!0,{},this.params.regionStyle)),jvm.$(t.node).bind("selected",function(e,t){n.container.trigger("regionSelected.jvectormap",[jvm.$(this).attr("data-code"),t,n.getSelectedRegions()])}),t.addClass("jvectormap-region jvectormap-element"),this.regions[e]={element:t,config:this.mapData.paths[e]}},createMarkers:function(e){var t,n,r,i,s,o=this;this.markersGroup=this.markersGroup||this.canvas.addGroup();if(jvm.$.isArray(e)){s=e.slice(),e={};for(t=0;t<s.length;t++)e[t]=s[t]}for(t in e)i=e[t]instanceof Array?{latLng:e[t]}:e[t],r=this.getMarkerPosition(i),r!==!1&&(n=this.canvas.addCircle({"data-index":t,cx:r.x,cy:r.y},jvm.$.extend(!0,{},this.params.markerStyle,{initial:i.style||{}}),this.markersGroup),n.addClass("jvectormap-marker jvectormap-element"),jvm.$(n.node).bind("selected",function(e,t){o.container.trigger("markerSelected.jvectormap",[jvm.$(this).attr("data-index"),t,o.getSelectedMarkers()])}),this.markers[t]&&this.removeMarkers([t]),this.markers[t]={element:n,config:i})},repositionMarkers:function(){var e,t;for(e in this.markers)t=this.getMarkerPosition(this.markers[e].config),t!==!1&&this.markers[e].element.setStyle({cx:t.x,cy:t.y})},getMarkerPosition:function(e){return jvm.WorldMap.maps[this.params.map].projection?this.latLngToPoint.apply(this,e.latLng||[0,0]):{x:e.coords[0]*this.scale+this.transX*this.scale,y:e.coords[1]*this.scale+this.transY*this.scale}},addMarker:function(e,t,n){var r={},i=[],s,o,n=n||[];r[e]=t;for(o=0;o<n.length;o++)s={},s[e]=n[o],i.push(s);this.addMarkers(r,i)},addMarkers:function(e,t){var n;t=t||[],this.createMarkers(e);for(n=0;n<t.length;n++)this.series.markers[n].setValues(t[n]||{})},removeMarkers:function(e){var t;for(t=0;t<e.length;t++)this.markers[e[t]].element.remove(),delete this.markers[e[t]]},removeAllMarkers:function(){var e,t=[];for(e in this.markers)t.push(e);this.removeMarkers(t)},latLngToPoint:function(e,t){var n,r=jvm.WorldMap.maps[this.params.map].projection,i=r.centralMeridian,s=this.width-this.baseTransX*2*this.baseScale,o=this.height-this.baseTransY*2*this.baseScale,u,a,f=this.scale/this.baseScale;return t<-180+i&&(t+=360),n=jvm.Proj[r.type](e,t,i),u=this.getInsetForPoint(n.x,n.y),u?(a=u.bbox,n.x=(n.x-a[0].x)/(a[1].x-a[0].x)*u.width*this.scale,n.y=(n.y-a[0].y)/(a[1].y-a[0].y)*u.height*this.scale,{x:n.x+this.transX*this.scale+u.left*this.scale,y:n.y+this.transY*this.scale+u.top*this.scale}):!1},pointToLatLng:function(e,t){var n=jvm.WorldMap.maps[this.params.map].projection,r=n.centralMeridian,i=jvm.WorldMap.maps[this.params.map].insets,s,o,u,a,f;for(s=0;s<i.length;s++){o=i[s],u=o.bbox,a=e-(this.transX*this.scale+o.left*this.scale),f=t-(this.transY*this.scale+o.top*this.scale),a=a/(o.width*this.scale)*(u[1].x-u[0].x)+u[0].x,f=f/(o.height*this.scale)*(u[1].y-u[0].y)+u[0].y;if(a>u[0].x&&a<u[1].x&&f>u[0].y&&f<u[1].y)return jvm.Proj[n.type+"_inv"](a,-f,r)}return!1},getInsetForPoint:function(e,t){var n=jvm.WorldMap.maps[this.params.map].insets,r,i;for(r=0;r<n.length;r++){i=n[r].bbox;if(e>i[0].x&&e<i[1].x&&t>i[0].y&&t<i[1].y)return n[r]}},createSeries:function(){var e,t;this.series={markers:[],regions:[]};for(t in this.params.series)for(e=0;e<this.params.series[t].length;e++)this.series[t][e]=new jvm.DataSeries(this.params.series[t][e],this[t])},remove:function(){this.label.remove(),this.container.remove(),jvm.$(window).unbind("resize",this.onResize)}},jvm.WorldMap.maps={},jvm.WorldMap.defaultParams={map:"world_mill_en",backgroundColor:"#505050",zoomButtons:!0,zoomOnScroll:!0,zoomMax:8,zoomMin:1,zoomStep:1.6,regionsSelectable:!1,markersSelectable:!1,bindTouchEvents:!0,regionStyle:{initial:{fill:"white","fill-opacity":1,stroke:"none","stroke-width":0,"stroke-opacity":1},hover:{"fill-opacity":.8},selected:{fill:"yellow"},selectedHover
|
8
|
-
:{}},markerStyle:{initial:{fill:"grey",stroke:"#505050","fill-opacity":1,"stroke-width":1,"stroke-opacity":1,r:5},hover:{stroke:"black","stroke-width":2},selected:{fill:"blue"},selectedHover:{}}},jvm.WorldMap.apiEvents={onRegionLabelShow:"regionLabelShow",onRegionOver:"regionOver",onRegionOut:"regionOut",onRegionClick:"regionClick",onRegionSelected:"regionSelected",onMarkerLabelShow:"markerLabelShow",onMarkerOver:"markerOver",onMarkerOut:"markerOut",onMarkerClick:"markerClick",onMarkerSelected:"markerSelected",onViewportChange:"viewportChange"};
|
@@ -1,37 +0,0 @@
|
|
1
|
-
.jvectormap-label {
|
2
|
-
position: absolute;
|
3
|
-
display: none;
|
4
|
-
border: solid 1px #CDCDCD;
|
5
|
-
-webkit-border-radius: 3px;
|
6
|
-
-moz-border-radius: 3px;
|
7
|
-
border-radius: 3px;
|
8
|
-
background: #292929;
|
9
|
-
color: white;
|
10
|
-
font-family: sans-serif, Verdana;
|
11
|
-
font-size: smaller;
|
12
|
-
padding: 3px;
|
13
|
-
}
|
14
|
-
|
15
|
-
.jvectormap-zoomin, .jvectormap-zoomout {
|
16
|
-
position: absolute;
|
17
|
-
left: 10px;
|
18
|
-
-webkit-border-radius: 3px;
|
19
|
-
-moz-border-radius: 3px;
|
20
|
-
border-radius: 3px;
|
21
|
-
background: #292929;
|
22
|
-
padding: 3px;
|
23
|
-
color: white;
|
24
|
-
width: 10px;
|
25
|
-
height: 10px;
|
26
|
-
cursor: pointer;
|
27
|
-
line-height: 10px;
|
28
|
-
text-align: center;
|
29
|
-
}
|
30
|
-
|
31
|
-
.jvectormap-zoomin {
|
32
|
-
top: 10px;
|
33
|
-
}
|
34
|
-
|
35
|
-
.jvectormap-zoomout {
|
36
|
-
top: 30px;
|
37
|
-
}
|