Total Complexity | 1501 |
Complexity/F | 2.5 |
Lines of Code | 6299 |
Function Count | 600 |
Duplicated Lines | 4 |
Ratio | 0.06 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
Complex classes like src/app/views/templates/diaries/js/ammap.js often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
1 | (function() { |
||
2 | var d; |
||
3 | window.AmCharts ? d = window.AmCharts : (d = {}, window.AmCharts = d, d.themes = {}, d.maps = {}, d.inheriting = {}, d.charts = [], d.onReadyArray = [], d.useUTC = !1, d.updateRate = 60, d.uid = 0, d.lang = {}, d.translations = {}, d.mapTranslations = {}, d.windows = {}, d.initHandlers = [], d.amString = "am", d.pmString = "pm"); |
||
|
|||
4 | d.Class = function(a) { |
||
5 | var b = function() { |
||
6 | arguments[0] !== d.inheriting && (this.events = {}, this.construct.apply(this, arguments)) |
||
7 | }; |
||
8 | a.inherits ? (b.prototype = new a.inherits(d.inheriting), b.base = a.inherits.prototype, delete a.inherits) : (b.prototype.createEvents = function() { |
||
9 | for (var a = 0; a < arguments.length; a++) this.events[arguments[a]] = [] |
||
10 | }, b.prototype.listenTo = function(a, b, c) { |
||
11 | this.removeListener(a, b, c); |
||
12 | a.events[b].push({ |
||
13 | handler: c, |
||
14 | scope: this |
||
15 | }) |
||
16 | }, b.prototype.addListener = function(a, b, c) { |
||
17 | this.removeListener(this, a, b); |
||
18 | a && this.events[a] && this.events[a].push({ |
||
19 | handler: b, |
||
20 | scope: c |
||
21 | }) |
||
22 | }, b.prototype.removeListener = function(a, b, c) { |
||
23 | if (a && a.events && (a = a.events[b])) |
||
24 | for (b = a.length - 1; 0 <= b; b--) a[b].handler === c && a.splice(b, 1) |
||
25 | }, b.prototype.fire = function(a) { |
||
26 | for (var b = this.events[a.type], c = 0; c < b.length; c++) { |
||
27 | var d = b[c]; |
||
28 | d.handler.call(d.scope, a) |
||
29 | } |
||
30 | }); |
||
31 | for (var c in a) b.prototype[c] = a[c]; |
||
32 | return b |
||
33 | }; |
||
34 | d.addChart = function(a) { |
||
35 | window.requestAnimationFrame ? d.animationRequested || (d.animationRequested = !0, window.requestAnimationFrame(d.update)) : d.updateInt || (d.updateInt = setInterval(function() { |
||
36 | d.update() |
||
37 | }, Math.round(1E3 / d.updateRate))); |
||
38 | d.charts.push(a) |
||
39 | }; |
||
40 | d.removeChart = function(a) { |
||
41 | for (var b = d.charts, c = b.length - 1; 0 <= c; c--) b[c] == a && b.splice(c, 1); |
||
42 | 0 === b.length && (d.requestAnimation && (window.cancelAnimationFrame(d.requestAnimation), d.animationRequested = !1), d.updateInt && (clearInterval(d.updateInt), d.updateInt = NaN)) |
||
43 | }; |
||
44 | d.isModern = !0; |
||
45 | d.getIEVersion = function() { |
||
46 | var a = 0, |
||
47 | b, c; |
||
48 | "Microsoft Internet Explorer" == navigator.appName && (b = navigator.userAgent, c = /MSIE ([0-9]{1,}[.0-9]{0,})/, null !== c.exec(b) && (a = parseFloat(RegExp.$1))); |
||
49 | return a |
||
50 | }; |
||
51 | d.applyLang = function(a, b) { |
||
52 | var c = d.translations; |
||
53 | b.dayNames = d.extend({}, d.dayNames); |
||
54 | b.shortDayNames = d.extend({}, d.shortDayNames); |
||
55 | b.monthNames = d.extend({}, d.monthNames); |
||
56 | b.shortMonthNames = d.extend({}, d.shortMonthNames); |
||
57 | b.amString = "am"; |
||
58 | b.pmString = "pm"; |
||
59 | c && (c = c[a]) && (d.lang = c, b.langObj = c, c.monthNames && (b.dayNames = d.extend({}, c.dayNames), b.shortDayNames = d.extend({}, c.shortDayNames), b.monthNames = d.extend({}, c.monthNames), b.shortMonthNames = d.extend({}, c.shortMonthNames)), c.am && (b.amString = c.am), c.pm && (b.pmString = c.pm)); |
||
60 | d.amString = b.amString; |
||
61 | d.pmString = b.pmString |
||
62 | }; |
||
63 | d.IEversion = d.getIEVersion(); |
||
64 | 9 > d.IEversion && 0 < d.IEversion && (d.isModern = !1, d.isIE = !0); |
||
65 | d.dx = 0; |
||
66 | d.dy = 0; |
||
67 | if (document.addEventListener || window.opera) d.isNN = !0, d.isIE = !1, d.dx = .5, d.dy = .5; |
||
68 | document.attachEvent && (d.isNN = !1, d.isIE = !0, d.isModern || (d.dx = 0, d.dy = 0)); |
||
69 | window.chrome && (d.chrome = !0); |
||
70 | d.handleMouseUp = function(a) { |
||
71 | for (var b = d.charts, c = 0; c < b.length; c++) { |
||
72 | var e = b[c]; |
||
73 | e && e.handleReleaseOutside && e.handleReleaseOutside(a) |
||
74 | } |
||
75 | }; |
||
76 | d.handleMouseMove = function(a) { |
||
77 | for (var b = d.charts, c = 0; c < b.length; c++) { |
||
78 | var e = b[c]; |
||
79 | e && e.handleMouseMove && e.handleMouseMove(a) |
||
80 | } |
||
81 | }; |
||
82 | d.handleWheel = function(a) { |
||
83 | for (var b = d.charts, c = 0; c < b.length; c++) { |
||
84 | var e = b[c]; |
||
85 | if (e && e.mouseIsOver) { |
||
86 | (e.mouseWheelScrollEnabled || e.mouseWheelZoomEnabled) && e.handleWheel && e.handleWheel(a); |
||
87 | break |
||
88 | } |
||
89 | } |
||
90 | }; |
||
91 | d.resetMouseOver = function() { |
||
92 | for (var a = d.charts, b = 0; b < a.length; b++) { |
||
93 | var c = a[b]; |
||
94 | c && (c.mouseIsOver = !1) |
||
95 | } |
||
96 | }; |
||
97 | d.ready = function(a) { |
||
98 | d.onReadyArray.push(a) |
||
99 | }; |
||
100 | d.handleLoad = function() { |
||
101 | d.isReady = !0; |
||
102 | for (var a = d.onReadyArray, b = 0; b < a.length; b++) { |
||
103 | var c = a[b]; |
||
104 | isNaN(d.processDelay) ? c() : setTimeout(c, d.processDelay * b) |
||
105 | } |
||
106 | d.onReadyArray = [] |
||
107 | }; |
||
108 | d.addInitHandler = function(a, b) { |
||
109 | d.initHandlers.push({ |
||
110 | method: a, |
||
111 | types: b |
||
112 | }) |
||
113 | }; |
||
114 | d.callInitHandler = function(a) { |
||
115 | var b = d.initHandlers; |
||
116 | if (d.initHandlers) |
||
117 | for (var c = 0; c < b.length; c++) { |
||
118 | var e = b[c]; |
||
119 | e.types ? d.isInArray(e.types, a.type) && e.method(a) : e.method(a) |
||
120 | } |
||
121 | }; |
||
122 | d.getUniqueId = function() { |
||
123 | d.uid++; |
||
124 | return "AmChartsEl-" + d.uid |
||
125 | }; |
||
126 | d.isNN && (document.addEventListener("mousemove", d.handleMouseMove), document.addEventListener("mouseup", d.handleMouseUp, !0), window.addEventListener("load", d.handleLoad, !0)); |
||
127 | d.isIE && (document.attachEvent("onmousemove", d.handleMouseMove), document.attachEvent("onmouseup", d.handleMouseUp), window.attachEvent("onload", d.handleLoad)); |
||
128 | d.addWheelListeners = function() { |
||
129 | d.wheelIsListened || (d.isNN && (window.addEventListener("DOMMouseScroll", d.handleWheel, !0), document.addEventListener("mousewheel", d.handleWheel, !0)), d.isIE && document.attachEvent("onmousewheel", d.handleWheel)); |
||
130 | d.wheelIsListened = !0 |
||
131 | }; |
||
132 | d.clear = function() { |
||
133 | var a = d.charts; |
||
134 | if (a) |
||
135 | for (var b = a.length - 1; 0 <= b; b--) a[b].clear(); |
||
136 | d.updateInt && clearInterval(d.updateInt); |
||
137 | d.requestAnimation && window.cancelAnimationFrame(d.requestAnimation); |
||
138 | d.charts = []; |
||
139 | d.isNN && (document.removeEventListener("mousemove", d.handleMouseMove, !0), document.removeEventListener("mouseup", d.handleMouseUp, !0), window.removeEventListener("load", d.handleLoad, !0), window.removeEventListener("DOMMouseScroll", d.handleWheel, !0), document.removeEventListener("mousewheel", d.handleWheel, !0)); |
||
140 | d.isIE && (document.detachEvent("onmousemove", d.handleMouseMove), document.detachEvent("onmouseup", d.handleMouseUp), window.detachEvent("onload", d.handleLoad)) |
||
141 | }; |
||
142 | d.makeChart = function(a, b, c) { |
||
143 | var e = b.type, |
||
144 | f = b.theme; |
||
145 | d.isString(f) && (f = d.themes[f], b.theme = f); |
||
146 | var g; |
||
147 | switch (e) { |
||
148 | case "serial": |
||
149 | g = new d.AmSerialChart(f); |
||
150 | break; |
||
151 | case "xy": |
||
152 | g = new d.AmXYChart(f); |
||
153 | break; |
||
154 | case "pie": |
||
155 | g = new d.AmPieChart(f); |
||
156 | break; |
||
157 | case "radar": |
||
158 | g = new d.AmRadarChart(f); |
||
159 | break; |
||
160 | case "gauge": |
||
161 | g = new d.AmAngularGauge(f); |
||
162 | break; |
||
163 | case "funnel": |
||
164 | g = new d.AmFunnelChart(f); |
||
165 | break; |
||
166 | case "map": |
||
167 | g = new d.AmMap(f); |
||
168 | break; |
||
169 | case "stock": |
||
170 | g = new d.AmStockChart(f); |
||
171 | break; |
||
172 | case "gantt": |
||
173 | g = new d.AmGanttChart(f) |
||
174 | } |
||
175 | d.extend(g, b); |
||
176 | d.isReady ? isNaN(c) ? g.write(a) : setTimeout(function() { |
||
177 | d.realWrite(g, a) |
||
178 | }, c) : d.ready(function() { |
||
179 | isNaN(c) ? g.write(a) : setTimeout(function() { |
||
180 | d.realWrite(g, a) |
||
181 | }, c) |
||
182 | }); |
||
183 | return g |
||
184 | }; |
||
185 | d.realWrite = function(a, b) { |
||
186 | a.write(b) |
||
187 | }; |
||
188 | d.updateCount = 0; |
||
189 | d.validateAt = Math.round(d.updateRate / 10); |
||
190 | d.update = function() { |
||
191 | var a = d.charts; |
||
192 | d.updateCount++; |
||
193 | var b = !1; |
||
194 | d.updateCount == d.validateAt && (b = !0, d.updateCount = 0); |
||
195 | if (a) |
||
196 | for (var c = a.length - 1; 0 <= c; c--) a[c].update && a[c].update(), b && (a[c].autoResize ? a[c].validateSize && a[c].validateSize() : a[c].premeasure && a[c].premeasure()); |
||
197 | window.requestAnimationFrame && (d.requestAnimation = window.requestAnimationFrame(d.update)) |
||
198 | }; |
||
199 | "complete" == document.readyState && d.handleLoad() |
||
200 | })(); |
||
201 | (function() { |
||
202 | var d = window.AmCharts; |
||
203 | d.toBoolean = function(a, b) { |
||
204 | if (void 0 === a) return b; |
||
205 | switch (String(a).toLowerCase()) { |
||
206 | case "true": |
||
207 | case "yes": |
||
208 | case "1": |
||
209 | return !0; |
||
210 | case "false": |
||
211 | case "no": |
||
212 | case "0": |
||
213 | case null: |
||
214 | return !1; |
||
215 | default: |
||
216 | return !!a |
||
217 | } |
||
218 | }; |
||
219 | d.removeFromArray = function(a, b) { |
||
220 | var c; |
||
221 | if (void 0 !== b && void 0 !== a) |
||
222 | for (c = a.length - 1; 0 <= c; c--) a[c] == b && a.splice(c, 1) |
||
223 | }; |
||
224 | d.getPath = function() { |
||
225 | var a = document.getElementsByTagName("script"); |
||
226 | if (a) |
||
227 | for (var b = 0; b < a.length; b++) { |
||
228 | var c = a[b].src; |
||
229 | if (-1 !== c.search(/\/(amcharts|ammap)\.js/)) return c.replace(/\/(amcharts|ammap)\.js.*/, "/") |
||
230 | } |
||
231 | }; |
||
232 | d.normalizeUrl = function(a) { |
||
233 | return "" !== a && -1 === a.search(/\/$/) ? a + "/" : a |
||
234 | }; |
||
235 | d.isAbsolute = function(a) { |
||
236 | return 0 === a.search(/^http[s]?:|^\//) |
||
237 | }; |
||
238 | d.isInArray = function(a, b) { |
||
239 | for (var c = 0; c < a.length; c++) |
||
240 | if (a[c] == b) return !0; |
||
241 | return !1 |
||
242 | }; |
||
243 | d.getDecimals = function(a) { |
||
244 | var b = 0; |
||
245 | isNaN(a) || (a = String(a), -1 != a.indexOf("e-") ? b = Number(a.split("-")[1]) : -1 != a.indexOf(".") && (b = a.split(".")[1].length)); |
||
246 | return b |
||
247 | }; |
||
248 | d.wordwrap = function(a, b, c, e) { |
||
249 | var f, g, h, k; |
||
250 | a += ""; |
||
251 | if (1 > b) return a; |
||
252 | f = -1; |
||
253 | for (a = (k = a.split(/\r\n|\n|\r/)).length; ++f < a; k[f] += h) { |
||
254 | h = k[f]; |
||
255 | for (k[f] = ""; h.length > b; k[f] += d.trim(h.slice(0, g)) + ((h = h.slice(g)).length ? c : "")) g = 2 == e || (g = h.slice(0, b + 1).match(/\S*(\s)?$/))[1] ? b : g.input.length - g[0].length || 1 == e && b || g.input.length + (g = h.slice(b).match(/^\S*/))[0].length; |
||
256 | h = d.trim(h) |
||
257 | } |
||
258 | return k.join(c) |
||
259 | }; |
||
260 | d.trim = function(a) { |
||
261 | return a.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "") |
||
262 | }; |
||
263 | d.wrappedText = function(a, b, c, e, f, g, h, k) { |
||
264 | var l = d.text(a, b, c, e, f, g, h); |
||
265 | if (l) { |
||
266 | var m = l.getBBox(); |
||
267 | if (m.width > k) { |
||
268 | var n = "\n"; |
||
269 | d.isModern || (n = "<br>"); |
||
270 | k = Math.floor(k / (m.width / |
||
271 | b.length)); |
||
272 | 2 < k && (k -= 2); |
||
273 | b = d.wordwrap(b, k, n, !0); |
||
274 | l.remove(); |
||
275 | l = d.text(a, b, c, e, f, g, h) |
||
276 | } |
||
277 | } |
||
278 | return l |
||
279 | }; |
||
280 | d.getStyle = function(a, b) { |
||
281 | var c = ""; |
||
282 | if (document.defaultView && document.defaultView.getComputedStyle) try { |
||
283 | c = document.defaultView.getComputedStyle(a, "").getPropertyValue(b) |
||
284 | } catch (e) {} else a.currentStyle && (b = b.replace(/\-(\w)/g, function(a, b) { |
||
285 | return b.toUpperCase() |
||
286 | }), c = a.currentStyle[b]); |
||
287 | return c |
||
288 | }; |
||
289 | d.removePx = function(a) { |
||
290 | if (void 0 !== a) return Number(a.substring(0, a.length - 2)) |
||
291 | }; |
||
292 | d.getURL = function(a, b) { |
||
293 | if (a) |
||
294 | if ("_self" != b && b) |
||
295 | if ("_top" == b && window.top) window.top.location.href = a; |
||
296 | else if ("_parent" == b && window.parent) window.parent.location.href = a; |
||
297 | else if ("_blank" == b) window.open(a); |
||
298 | else { |
||
299 | var c = document.getElementsByName(b)[0]; |
||
300 | c ? c.src = a : (c = d.windows[b]) ? c.opener && !c.opener.closed ? c.location.href = a : d.windows[b] = window.open(a) : d.windows[b] = window.open(a) |
||
301 | } else window.location.href = a |
||
302 | }; |
||
303 | d.ifArray = function(a) { |
||
304 | return a && "object" == typeof a && 0 < a.length ? !0 : !1 |
||
305 | }; |
||
306 | d.callMethod = function(a, b) { |
||
307 | var c; |
||
308 | for (c = 0; c < b.length; c++) { |
||
309 | var e = b[c]; |
||
310 | if (e) { |
||
311 | if (e[a]) e[a](); |
||
312 | var d = e.length; |
||
313 | if (0 < d) { |
||
314 | var g; |
||
315 | for (g = 0; g < d; g++) { |
||
316 | var h = e[g]; |
||
317 | if (h && h[a]) h[a]() |
||
318 | } |
||
319 | } |
||
320 | } |
||
321 | } |
||
322 | }; |
||
323 | d.toNumber = function(a) { |
||
324 | return "number" == typeof a ? a : Number(String(a).replace(/[^0-9\-.]+/g, "")) |
||
325 | }; |
||
326 | d.toColor = function(a) { |
||
327 | if ("" !== a && void 0 !== a) |
||
328 | if (-1 != a.indexOf(",")) { |
||
329 | a = a.split(","); |
||
330 | var b; |
||
331 | for (b = 0; b < a.length; b++) { |
||
332 | var c = a[b].substring(a[b].length - 6, a[b].length); |
||
333 | a[b] = "#" + c |
||
334 | } |
||
335 | } else a = a.substring(a.length - 6, a.length), a = "#" + a; |
||
336 | return a |
||
337 | }; |
||
338 | d.toCoordinate = function(a, b, c) { |
||
339 | var e; |
||
340 | void 0 !== a && (a = String(a), c && c < b && (b = c), e = Number(a), -1 != a.indexOf("!") && (e = b - Number(a.substr(1))), -1 != a.indexOf("%") && (e = b * Number(a.substr(0, a.length - 1)) / 100)); |
||
341 | return e |
||
342 | }; |
||
343 | d.fitToBounds = function(a, b, c) { |
||
344 | a < b && (a = b); |
||
345 | a > c && (a = c); |
||
346 | return a |
||
347 | }; |
||
348 | d.isDefined = function(a) { |
||
349 | return void 0 === a ? !1 : !0 |
||
350 | }; |
||
351 | d.stripNumbers = function(a) { |
||
352 | return a.replace(/[0-9]+/g, "") |
||
353 | }; |
||
354 | d.roundTo = function(a, b) { |
||
355 | if (0 > b) return a; |
||
356 | var c = Math.pow(10, b); |
||
357 | return Math.round(a * c) / c |
||
358 | }; |
||
359 | d.toFixed = function(a, b) { |
||
360 | var c = !1; |
||
361 | 0 > a && (c = !0, a = Math.abs(a)); |
||
362 | var e = String(Math.round(a * Math.pow(10, b))); |
||
363 | if (0 < b) { |
||
364 | var d = e.length; |
||
365 | if (d < b) { |
||
366 | var g; |
||
367 | for (g = 0; g < |
||
368 | b - d; g++) e = "0" + e |
||
369 | } |
||
370 | d = e.substring(0, e.length - b); |
||
371 | "" === d && (d = 0); |
||
372 | e = d + "." + e.substring(e.length - b, e.length); |
||
373 | return c ? "-" + e : e |
||
374 | } |
||
375 | return String(e) |
||
376 | }; |
||
377 | d.formatDuration = function(a, b, c, e, f, g) { |
||
378 | var h = d.intervals, |
||
379 | k = g.decimalSeparator; |
||
380 | if (a >= h[b].contains) { |
||
381 | var l = a - Math.floor(a / h[b].contains) * h[b].contains; |
||
382 | "ss" == b ? (l = d.formatNumber(l, g), 1 == l.split(k)[0].length && (l = "0" + l)) : l = d.roundTo(l, g.precision); |
||
383 | ("mm" == b || "hh" == b) && 10 > l && (l = "0" + l); |
||
384 | c = l + "" + e[b] + "" + c; |
||
385 | a = Math.floor(a / h[b].contains); |
||
386 | b = h[b].nextInterval; |
||
387 | return d.formatDuration(a, b, c, e, f, g) |
||
388 | } |
||
389 | "ss" == b && (a = d.formatNumber(a, g), 1 == a.split(k)[0].length && (a = "0" + a)); |
||
390 | "mm" == b && (a = d.roundTo(a, g.precision)); |
||
391 | ("mm" == b || "hh" == b) && 10 > a && (a = "0" + a); |
||
392 | c = a + "" + e[b] + "" + c; |
||
393 | if (h[f].count > h[b].count) |
||
394 | for (a = h[b].count; a < h[f].count; a++) b = h[b].nextInterval, "ss" == b || "mm" == b || "hh" == b ? c = "00" + e[b] + "" + c : "DD" == b && (c = "0" + e[b] + "" + c); |
||
395 | ":" == c.charAt(c.length - 1) && (c = c.substring(0, c.length - 1)); |
||
396 | return c |
||
397 | }; |
||
398 | d.formatNumber = function(a, b, c, e, f) { |
||
399 | a = d.roundTo(a, b.precision); |
||
400 | isNaN(c) && (c = b.precision); |
||
401 | var g = b.decimalSeparator; |
||
402 | b = b.thousandsSeparator; |
||
403 | var h; |
||
404 | h = 0 > a ? "-" : ""; |
||
405 | a = Math.abs(a); |
||
406 | var k = String(a), |
||
407 | l = !1; - 1 != k.indexOf("e") && (l = !0); |
||
408 | 0 <= c && !l && (k = d.toFixed(a, c)); |
||
409 | var m = ""; |
||
410 | if (l) m = k; |
||
411 | else { |
||
412 | var k = k.split("."), |
||
413 | l = String(k[0]), |
||
414 | n; |
||
415 | for (n = l.length; 0 <= n; n -= 3) m = n != l.length ? 0 !== n ? l.substring(n - 3, n) + b + m : l.substring(n - 3, n) + m : l.substring(n - 3, n); |
||
416 | void 0 !== k[1] && (m = m + g + k[1]); |
||
417 | void 0 !== c && 0 < c && "0" != m && (m = d.addZeroes(m, g, c)) |
||
418 | } |
||
419 | m = h + m; |
||
420 | "" === h && !0 === e && 0 !== a && (m = "+" + m); |
||
421 | !0 === f && (m += "%"); |
||
422 | return m |
||
423 | }; |
||
424 | d.addZeroes = function(a, b, c) { |
||
425 | a = a.split(b); |
||
426 | void 0 === a[1] && 0 < c && (a[1] = "0"); |
||
427 | return a[1].length < c ? (a[1] += "0", d.addZeroes(a[0] + b + a[1], b, c)) : void 0 !== a[1] ? a[0] + b + a[1] : a[0] |
||
428 | }; |
||
429 | d.scientificToNormal = function(a) { |
||
430 | var b; |
||
431 | a = String(a).split("e"); |
||
432 | var c; |
||
433 | if ("-" == a[1].substr(0, 1)) { |
||
434 | b = "0."; |
||
435 | for (c = 0; c < Math.abs(Number(a[1])) - 1; c++) b += "0"; |
||
436 | b += a[0].split(".").join("") |
||
437 | } else { |
||
438 | var e = 0; |
||
439 | b = a[0].split("."); |
||
440 | b[1] && (e = b[1].length); |
||
441 | b = a[0].split(".").join(""); |
||
442 | for (c = 0; c < Math.abs(Number(a[1])) - e; c++) b += "0" |
||
443 | } |
||
444 | return b |
||
445 | }; |
||
446 | d.toScientific = function(a, b) { |
||
447 | if (0 === a) return "0"; |
||
448 | var c = Math.floor(Math.log(Math.abs(a)) * Math.LOG10E), |
||
449 | e = String(e).split(".").join(b); |
||
450 | return String(e) + "e" + c |
||
451 | }; |
||
452 | d.randomColor = function() { |
||
453 | return "#" + ("00000" + (16777216 * Math.random() << 0).toString(16)).substr(-6) |
||
454 | }; |
||
455 | d.hitTest = function(a, b, c) { |
||
456 | var e = !1, |
||
457 | f = a.x, |
||
458 | g = a.x + a.width, |
||
459 | h = a.y, |
||
460 | k = a.y + a.height, |
||
461 | l = d.isInRectangle; |
||
462 | e || (e = l(f, h, b)); |
||
463 | e || (e = l(f, k, b)); |
||
464 | e || (e = l(g, h, b)); |
||
465 | e || (e = l(g, k, b)); |
||
466 | e || !0 === c || (e = d.hitTest(b, a, !0)); |
||
467 | return e |
||
468 | }; |
||
469 | d.isInRectangle = function(a, b, c) { |
||
470 | return a >= c.x - 5 && a <= c.x + c.width + 5 && b >= c.y - 5 && b <= c.y + c.height + 5 ? !0 : !1 |
||
471 | }; |
||
472 | d.isPercents = function(a) { |
||
473 | if (-1 != String(a).indexOf("%")) return !0 |
||
474 | }; |
||
475 | d.formatValue = function(a, b, c, e, f, g, h, k) { |
||
476 | if (b) { |
||
477 | void 0 === f && (f = ""); |
||
478 | var l; |
||
479 | for (l = 0; l < c.length; l++) { |
||
480 | var m = c[l], |
||
481 | n = b[m]; |
||
482 | void 0 !== n && (n = g ? d.addPrefix(n, k, h, e) : d.formatNumber(n, e), a = a.replace(new RegExp("\\[\\[" + f + "" + m + "\\]\\]", "g"), n)) |
||
483 | } |
||
484 | } |
||
485 | return a |
||
486 | }; |
||
487 | d.formatDataContextValue = function(a, b) { |
||
488 | if (a) { |
||
489 | var c = a.match(/\[\[.*?\]\]/g), |
||
490 | e; |
||
491 | for (e = 0; e < c.length; e++) { |
||
492 | var d = c[e], |
||
493 | d = d.substr(2, d.length - 4); |
||
494 | void 0 !== b[d] && (a = a.replace(new RegExp("\\[\\[" + d + "\\]\\]", "g"), b[d])) |
||
495 | } |
||
496 | } |
||
497 | return a |
||
498 | }; |
||
499 | d.massReplace = function(a, b) { |
||
500 | for (var c in b) |
||
501 | if (b.hasOwnProperty(c)) { |
||
502 | var e = b[c]; |
||
503 | void 0 === e && (e = ""); |
||
504 | a = a.replace(c, e) |
||
505 | } |
||
506 | return a |
||
507 | }; |
||
508 | d.cleanFromEmpty = function(a) { |
||
509 | return a.replace(/\[\[[^\]]*\]\]/g, "") |
||
510 | }; |
||
511 | d.addPrefix = function(a, b, c, e, f) { |
||
512 | var g = d.formatNumber(a, e), |
||
513 | h = "", |
||
514 | k, l, m; |
||
515 | if (0 === a) return "0"; |
||
516 | 0 > a && (h = "-"); |
||
517 | a = Math.abs(a); |
||
518 | if (1 < a) |
||
519 | for (k = b.length - 1; - 1 < k; k--) { |
||
520 | if (a >= b[k].number && (l = a / b[k].number, m = Number(e.precision), 1 > m && (m = 1), c = d.roundTo(l, m), m = d.formatNumber(c, { |
||
521 | precision: -1, |
||
522 | decimalSeparator: e.decimalSeparator, |
||
523 | thousandsSeparator: e.thousandsSeparator |
||
524 | }), !f || l == c)) { |
||
525 | g = h + "" + m + "" + b[k].prefix; |
||
526 | break |
||
527 | } |
||
528 | } else |
||
529 | for (k = 0; k < c.length; k++) |
||
530 | if (a <= c[k].number) { |
||
531 | l = a / c[k].number; |
||
532 | m = Math.abs(Math.floor(Math.log(l) * Math.LOG10E)); |
||
533 | l = d.roundTo(l, m); |
||
534 | g = h + "" + l + "" + c[k].prefix; |
||
535 | break |
||
536 | } |
||
537 | return g |
||
538 | }; |
||
539 | d.remove = function(a) { |
||
540 | a && a.remove() |
||
541 | }; |
||
542 | d.getEffect = function(a) { |
||
543 | ">" == a && (a = "easeOutSine"); |
||
544 | "<" == a && (a = "easeInSine"); |
||
545 | "elastic" == a && (a = "easeOutElastic"); |
||
546 | return a |
||
547 | }; |
||
548 | d.getObjById = function(a, b) { |
||
549 | var c, e; |
||
550 | for (e = 0; e < a.length; e++) { |
||
551 | var d = a[e]; |
||
552 | if (d.id == b) { |
||
553 | c = d; |
||
554 | break |
||
555 | } |
||
556 | } |
||
557 | return c |
||
558 | }; |
||
559 | d.applyTheme = function(a, b, c) { |
||
560 | b || (b = d.theme); |
||
561 | try { |
||
562 | b = JSON.parse(JSON.stringify(b)) |
||
563 | } catch (e) {} |
||
564 | b && b[c] && d.extend(a, b[c]) |
||
565 | }; |
||
566 | d.isString = function(a) { |
||
567 | return "string" == typeof a ? !0 : !1 |
||
568 | }; |
||
569 | d.extend = function(a, b, c) { |
||
570 | var e; |
||
571 | a || (a = {}); |
||
572 | for (e in b) c ? a.hasOwnProperty(e) || (a[e] = b[e]) : a[e] = b[e]; |
||
573 | return a |
||
574 | }; |
||
575 | d.copyProperties = function(a, b) { |
||
576 | for (var c in a) a.hasOwnProperty(c) && "events" != c && void 0 !== a[c] && "function" != typeof a[c] && "cname" != c && (b[c] = a[c]) |
||
577 | }; |
||
578 | d.processObject = function(a, b, c, e) { |
||
579 | if (!1 === a instanceof b && (a = e ? d.extend(new b(c), a) : d.extend(a, new b(c), !0), a.listeners)) |
||
580 | for (var f in a.listeners) b = a.listeners[f], a.addListener(b.event, b.method); |
||
581 | return a |
||
582 | }; |
||
583 | d.fixNewLines = function(a) { |
||
584 | var b = RegExp("\\n", "g"); |
||
585 | a && (a = a.replace(b, "<br />")); |
||
586 | return a |
||
587 | }; |
||
588 | d.fixBrakes = function(a) { |
||
589 | if (d.isModern) { |
||
590 | var b = RegExp("<br>", "g"); |
||
591 | a && (a = a.replace(b, "\n")) |
||
592 | } else a = d.fixNewLines(a); |
||
593 | return a |
||
594 | }; |
||
595 | d.deleteObject = function(a, b) { |
||
596 | if (a) { |
||
597 | if (void 0 === b || null === b) b = 20; |
||
598 | if (0 !== b) |
||
599 | if ("[object Array]" === Object.prototype.toString.call(a)) |
||
600 | for (var c = 0; c < a.length; c++) d.deleteObject(a[c], b - 1), a[c] = null; |
||
601 | else if (a && !a.tagName) try { |
||
602 | for (c in a.theme = null, a) a[c] && ("object" == typeof a[c] && d.deleteObject(a[c], b - 1), "function" != typeof a[c] && (a[c] = null)) |
||
603 | } catch (e) {} |
||
604 | } |
||
605 | }; |
||
606 | d.bounce = function(a, b, c, e, d) { |
||
607 | return (b /= d) < 1 / 2.75 ? 7.5625 * e * b * b + c : b < 2 / 2.75 ? e * (7.5625 * (b -= 1.5 / 2.75) * b + .75) + c : b < 2.5 / 2.75 ? e * (7.5625 * (b -= 2.25 / 2.75) * b + .9375) + c : e * (7.5625 * (b -= 2.625 / 2.75) * b + .984375) + c |
||
608 | }; |
||
609 | d.easeInOutQuad = function(a, b, c, e, d) { |
||
610 | b /= d / 2; |
||
611 | if (1 > b) return e / 2 * b * b + c; |
||
612 | b--; |
||
613 | return -e / 2 * (b * (b - 2) - 1) + c |
||
614 | }; |
||
615 | d.easeInSine = function(a, b, c, e, d) { |
||
616 | return -e * Math.cos(b / d * (Math.PI / 2)) + e + c |
||
617 | }; |
||
618 | d.easeOutSine = function(a, b, c, e, d) { |
||
619 | return e * Math.sin(b / d * (Math.PI / 2)) + c |
||
620 | }; |
||
621 | d.easeOutElastic = function(a, b, c, e, d) { |
||
622 | a = 1.70158; |
||
623 | var g = 0, |
||
624 | h = e; |
||
625 | if (0 === b) return c; |
||
626 | if (1 == (b /= d)) return c + e; |
||
627 | g || (g = .3 * d); |
||
628 | h < Math.abs(e) ? (h = e, a = g / 4) : a = g / (2 * Math.PI) * Math.asin(e / h); |
||
629 | return h * Math.pow(2, -10 * b) * Math.sin(2 * (b * d - a) * Math.PI / g) + e + c |
||
630 | }; |
||
631 | d.fixStepE = function(a) { |
||
632 | a = a.toExponential(0).split("e"); |
||
633 | var b = Number(a[1]); |
||
634 | 9 == Number(a[0]) && b++; |
||
635 | return d.generateNumber(1, b) |
||
636 | }; |
||
637 | d.generateNumber = function(a, b) { |
||
638 | var c = "", |
||
639 | e; |
||
640 | e = 0 > b ? Math.abs(b) - 1 : Math.abs(b); |
||
641 | var d; |
||
642 | for (d = 0; d < e; d++) c += "0"; |
||
643 | return 0 > b ? Number("0." + c + String(a)) : Number(String(a) + c) |
||
644 | }; |
||
645 | d.setCN = function(a, b, c, e) { |
||
646 | if (a.addClassNames && b && (b = b.node) && c) { |
||
647 | var d = b.getAttribute("class"); |
||
648 | a = a.classNamePrefix + "-"; |
||
649 | e && (a = ""); |
||
650 | d ? b.setAttribute("class", d + " " + a + c) : b.setAttribute("class", a + c) |
||
651 | } |
||
652 | }; |
||
653 | d.removeCN = function(a, b, c) { |
||
654 | b && (b = b.node) && c && (b = b.classList) && b.remove(a.classNamePrefix + "-" + c) |
||
655 | }; |
||
656 | d.parseDefs = function(a, b) { |
||
657 | for (var c in a) { |
||
658 | var e = typeof a[c]; |
||
659 | if (0 < a[c].length && "object" == e) |
||
660 | for (var f = 0; f < a[c].length; f++) e = document.createElementNS(d.SVG_NS, c), b.appendChild(e), d.parseDefs(a[c][f], e); |
||
661 | else "object" == e ? (e = document.createElementNS(d.SVG_NS, c), b.appendChild(e), d.parseDefs(a[c], e)) : b.setAttribute(c, a[c]) |
||
662 | } |
||
663 | } |
||
664 | })(); |
||
665 | (function() { |
||
666 | var d = window.AmCharts; |
||
667 | d.AmDraw = d.Class({ |
||
668 | construct: function(a, b, c, e) { |
||
669 | d.SVG_NS = "http://www.w3.org/2000/svg"; |
||
670 | d.SVG_XLINK = "http://www.w3.org/1999/xlink"; |
||
671 | d.hasSVG = !!document.createElementNS && !!document.createElementNS(d.SVG_NS, "svg").createSVGRect; |
||
672 | 1 > b && (b = 10); |
||
673 | 1 > c && (c = 10); |
||
674 | this.div = a; |
||
675 | this.width = b; |
||
676 | this.height = c; |
||
677 | this.rBin = document.createElement("div"); |
||
678 | d.hasSVG ? (d.SVG = !0, b = this.createSvgElement("svg"), a.appendChild(b), this.container = b, this.addDefs(e), this.R = new d.SVGRenderer(this)) : d.isIE && d.VMLRenderer && (d.VML = !0, d.vmlStyleSheet || (document.namespaces.add("amvml", "urn:schemas-microsoft-com:vml"), 31 > document.styleSheets.length ? (b = document.createStyleSheet(), b.addRule(".amvml", "behavior:url(#default#VML); display:inline-block; antialias:true"), d.vmlStyleSheet = b) : document.styleSheets[0].addRule(".amvml", "behavior:url(#default#VML); display:inline-block; antialias:true")), this.container = a, this.R = new d.VMLRenderer(this, e), this.R.disableSelection(a)) |
||
679 | }, |
||
680 | createSvgElement: function(a) { |
||
681 | return document.createElementNS(d.SVG_NS, a) |
||
682 | }, |
||
683 | circle: function(a, b, c, e) { |
||
684 | var f = new d.AmDObject("circle", this); |
||
685 | f.attr({ |
||
686 | r: c, |
||
687 | cx: a, |
||
688 | cy: b |
||
689 | }); |
||
690 | this.addToContainer(f.node, e); |
||
691 | return f |
||
692 | }, |
||
693 | ellipse: function(a, b, c, e, f) { |
||
694 | var g = new d.AmDObject("ellipse", this); |
||
695 | g.attr({ |
||
696 | rx: c, |
||
697 | ry: e, |
||
698 | cx: a, |
||
699 | cy: b |
||
700 | }); |
||
701 | this.addToContainer(g.node, f); |
||
702 | return g |
||
703 | }, |
||
704 | setSize: function(a, b) { |
||
705 | 0 < a && 0 < b && (this.container.style.width = a + "px", this.container.style.height = b + "px") |
||
706 | }, |
||
707 | rect: function(a, b, c, e, f, g, h) { |
||
708 | var k = new d.AmDObject("rect", this); |
||
709 | d.VML && (f = Math.round(100 * f / Math.min(c, e)), c += 2 * g, e += 2 * g, k.bw = g, k.node.style.marginLeft = -g, k.node.style.marginTop = -g); |
||
710 | 1 > c && (c = 1); |
||
711 | 1 > e && (e = 1); |
||
712 | k.attr({ |
||
713 | x: a, |
||
714 | y: b, |
||
715 | width: c, |
||
716 | height: e, |
||
717 | rx: f, |
||
718 | ry: f, |
||
719 | "stroke-width": g |
||
720 | }); |
||
721 | this.addToContainer(k.node, h); |
||
722 | return k |
||
723 | }, |
||
724 | image: function(a, b, c, e, f, g) { |
||
725 | var h = new d.AmDObject("image", this); |
||
726 | h.attr({ |
||
727 | x: b, |
||
728 | y: c, |
||
729 | width: e, |
||
730 | height: f |
||
731 | }); |
||
732 | this.R.path(h, a); |
||
733 | this.addToContainer(h.node, g); |
||
734 | return h |
||
735 | }, |
||
736 | addToContainer: function(a, b) { |
||
737 | b || (b = this.container); |
||
738 | b.appendChild(a) |
||
739 | }, |
||
740 | text: function(a, b, c) { |
||
741 | return this.R.text(a, b, c) |
||
742 | }, |
||
743 | path: function(a, b, c, e) { |
||
744 | var f = new d.AmDObject("path", this); |
||
745 | e || (e = "100,100"); |
||
746 | f.attr({ |
||
747 | cs: e |
||
748 | }); |
||
749 | c ? f.attr({ |
||
750 | dd: a |
||
751 | }) : f.attr({ |
||
752 | d: a |
||
753 | }); |
||
754 | this.addToContainer(f.node, b); |
||
755 | return f |
||
756 | }, |
||
757 | set: function(a) { |
||
758 | return this.R.set(a) |
||
759 | }, |
||
760 | remove: function(a) { |
||
761 | if (a) { |
||
762 | var b = this.rBin; |
||
763 | b.appendChild(a); |
||
764 | b.innerHTML = "" |
||
765 | } |
||
766 | }, |
||
767 | renderFix: function() { |
||
768 | var a = this.container, |
||
769 | b = a.style; |
||
770 | b.top = "0px"; |
||
771 | b.left = "0px"; |
||
772 | try { |
||
773 | var c = a.getBoundingClientRect(), |
||
774 | e = c.left - Math.round(c.left), |
||
775 | d = c.top - Math.round(c.top); |
||
776 | e && (b.left = e + "px"); |
||
777 | d && (b.top = d + "px") |
||
778 | } catch (g) {} |
||
779 | }, |
||
780 | update: function() { |
||
781 | this.R.update() |
||
782 | }, |
||
783 | addDefs: function(a) { |
||
784 | if (d.hasSVG) { |
||
785 | var b = this.createSvgElement("desc"), |
||
786 | c = this.container; |
||
787 | c.setAttribute("version", "1.1"); |
||
788 | c.style.position = "absolute"; |
||
789 | this.setSize(this.width, this.height); |
||
790 | if (a.accessibleTitle) { |
||
791 | var e = this.createSvgElement("text"); |
||
792 | c.appendChild(e); |
||
793 | e.innerHTML = a.accessibleTitle; |
||
794 | e.style.opacity = 0 |
||
795 | } |
||
796 | d.rtl && (c.setAttribute("direction", "rtl"), c.style.left = "auto", c.style.right = "0px"); |
||
797 | a && (a.addCodeCredits && b.appendChild(document.createTextNode("JavaScript chart by amCharts " + a.version)), c.appendChild(b), a.defs && (b = this.createSvgElement("defs"), c.appendChild(b), d.parseDefs(a.defs, b), this.defs = b)) |
||
798 | } |
||
799 | } |
||
800 | }) |
||
801 | })(); |
||
802 | (function() { |
||
803 | var d = window.AmCharts; |
||
804 | d.AmDObject = d.Class({ |
||
805 | construct: function(a, b) { |
||
806 | this.D = b; |
||
807 | this.R = b.R; |
||
808 | this.node = this.R.create(this, a); |
||
809 | this.y = this.x = 0; |
||
810 | this.scale = 1 |
||
811 | }, |
||
812 | attr: function(a) { |
||
813 | this.R.attr(this, a); |
||
814 | return this |
||
815 | }, |
||
816 | getAttr: function(a) { |
||
817 | return this.node.getAttribute(a) |
||
818 | }, |
||
819 | setAttr: function(a, b) { |
||
820 | this.R.setAttr(this, a, b); |
||
821 | return this |
||
822 | }, |
||
823 | clipRect: function(a, b, c, e) { |
||
824 | this.R.clipRect(this, a, b, c, e) |
||
825 | }, |
||
826 | translate: function(a, b, c, e) { |
||
827 | e || (a = Math.round(a), b = Math.round(b)); |
||
828 | this.R.move(this, a, b, c); |
||
829 | this.x = a; |
||
830 | this.y = b; |
||
831 | this.scale = c; |
||
832 | this.angle && this.rotate(this.angle) |
||
833 | }, |
||
834 | rotate: function(a, b) { |
||
835 | this.R.rotate(this, a, b); |
||
836 | this.angle = a |
||
837 | }, |
||
838 | animate: function(a, b, c) { |
||
839 | for (var e in a) |
||
840 | if (a.hasOwnProperty(e)) { |
||
841 | var f = e, |
||
842 | g = a[e]; |
||
843 | c = d.getEffect(c); |
||
844 | this.R.animate(this, f, g, b, c) |
||
845 | } |
||
846 | }, |
||
847 | push: function(a) { |
||
848 | if (a) { |
||
849 | var b = this.node; |
||
850 | b.appendChild(a.node); |
||
851 | var c = a.clipPath; |
||
852 | c && b.appendChild(c); |
||
853 | (a = a.grad) && b.appendChild(a) |
||
854 | } |
||
855 | }, |
||
856 | text: function(a) { |
||
857 | this.R.setText(this, a) |
||
858 | }, |
||
859 | remove: function() { |
||
860 | this.stop(); |
||
861 | this.R.remove(this) |
||
862 | }, |
||
863 | clear: function() { |
||
864 | var a = this.node; |
||
865 | if (a.hasChildNodes()) |
||
866 | for (; 1 <= a.childNodes.length;) a.removeChild(a.firstChild) |
||
867 | }, |
||
868 | hide: function() { |
||
869 | this.setAttr("visibility", "hidden") |
||
870 | }, |
||
871 | show: function() { |
||
872 | this.setAttr("visibility", "visible") |
||
873 | }, |
||
874 | getBBox: function() { |
||
875 | return this.R.getBBox(this) |
||
876 | }, |
||
877 | toFront: function() { |
||
878 | var a = this.node; |
||
879 | if (a) { |
||
880 | this.prevNextNode = a.nextSibling; |
||
881 | var b = a.parentNode; |
||
882 | b && b.appendChild(a) |
||
883 | } |
||
884 | }, |
||
885 | toPrevious: function() { |
||
886 | var a = this.node; |
||
887 | a && this.prevNextNode && (a = a.parentNode) && a.insertBefore(this.prevNextNode, null) |
||
888 | }, |
||
889 | toBack: function() { |
||
890 | var a = this.node; |
||
891 | if (a) { |
||
892 | this.prevNextNode = a.nextSibling; |
||
893 | var b = a.parentNode; |
||
894 | if (b) { |
||
895 | var c = b.firstChild; |
||
896 | c && b.insertBefore(a, c) |
||
897 | } |
||
898 | } |
||
899 | }, |
||
900 | mouseover: function(a) { |
||
901 | this.R.addListener(this, "mouseover", a); |
||
902 | return this |
||
903 | }, |
||
904 | mouseout: function(a) { |
||
905 | this.R.addListener(this, "mouseout", a); |
||
906 | return this |
||
907 | }, |
||
908 | click: function(a) { |
||
909 | this.R.addListener(this, "click", a); |
||
910 | return this |
||
911 | }, |
||
912 | dblclick: function(a) { |
||
913 | this.R.addListener(this, "dblclick", a); |
||
914 | return this |
||
915 | }, |
||
916 | mousedown: function(a) { |
||
917 | this.R.addListener(this, "mousedown", a); |
||
918 | return this |
||
919 | }, |
||
920 | mouseup: function(a) { |
||
921 | this.R.addListener(this, "mouseup", a); |
||
922 | return this |
||
923 | }, |
||
924 | touchmove: function(a) { |
||
925 | this.R.addListener(this, "touchmove", a); |
||
926 | return this |
||
927 | }, |
||
928 | touchstart: function(a) { |
||
929 | this.R.addListener(this, "touchstart", a); |
||
930 | return this |
||
931 | }, |
||
932 | touchend: function(a) { |
||
933 | this.R.addListener(this, "touchend", a); |
||
934 | return this |
||
935 | }, |
||
936 | keyup: function(a) { |
||
937 | this.R.addListener(this, "keyup", a); |
||
938 | return this |
||
939 | }, |
||
940 | focus: function(a) { |
||
941 | this.R.addListener(this, "focus", a); |
||
942 | return this |
||
943 | }, |
||
944 | blur: function(a) { |
||
945 | this.R.addListener(this, "blur", a); |
||
946 | return this |
||
947 | }, |
||
948 | contextmenu: function(a) { |
||
949 | this.node.addEventListener ? this.node.addEventListener("contextmenu", a, !0) : this.R.addListener(this, "contextmenu", a); |
||
950 | return this |
||
951 | }, |
||
952 | stop: function() { |
||
953 | d.removeFromArray(this.R.animations, this.an_translate); |
||
954 | d.removeFromArray(this.R.animations, this.an_y); |
||
955 | d.removeFromArray(this.R.animations, this.an_x) |
||
956 | }, |
||
957 | length: function() { |
||
958 | return this.node.childNodes.length |
||
959 | }, |
||
960 | gradient: function(a, b, c) { |
||
961 | this.R.gradient(this, a, b, c) |
||
962 | }, |
||
963 | pattern: function(a, b, c) { |
||
964 | a && this.R.pattern(this, a, b, c) |
||
965 | } |
||
966 | }) |
||
967 | })(); |
||
968 | (function() { |
||
969 | var d = window.AmCharts; |
||
970 | d.SVGRenderer = d.Class({ |
||
971 | construct: function(a) { |
||
972 | this.D = a; |
||
973 | this.animations = [] |
||
974 | }, |
||
975 | create: function(a, b) { |
||
976 | return document.createElementNS(d.SVG_NS, b) |
||
977 | }, |
||
978 | attr: function(a, b) { |
||
979 | for (var c in b) b.hasOwnProperty(c) && this.setAttr(a, c, b[c]) |
||
980 | }, |
||
981 | setAttr: function(a, b, c) { |
||
982 | void 0 !== c && a.node.setAttribute(b, c) |
||
983 | }, |
||
984 | animate: function(a, b, c, e, f) { |
||
985 | a.animationFinished = !1; |
||
986 | var g = a.node; |
||
987 | a["an_" + b] && d.removeFromArray(this.animations, a["an_" + b]); |
||
988 | "translate" == b ? (g = (g = g.getAttribute("transform")) ? String(g).substring(10, g.length - 1) : "0,0", g = g.split(", ").join(" "), g = g.split(" ").join(","), 0 === g && (g = "0,0")) : g = Number(g.getAttribute(b)); |
||
989 | c = { |
||
990 | obj: a, |
||
991 | frame: 0, |
||
992 | attribute: b, |
||
993 | from: g, |
||
994 | to: c, |
||
995 | time: e, |
||
996 | effect: f |
||
997 | }; |
||
998 | this.animations.push(c); |
||
999 | a["an_" + b] = c |
||
1000 | }, |
||
1001 | update: function() { |
||
1002 | var a, b = this.animations; |
||
1003 | for (a = b.length - 1; 0 <= a; a--) { |
||
1004 | var c = b[a], |
||
1005 | e = c.time * d.updateRate, |
||
1006 | f = c.frame + 1, |
||
1007 | g = c.obj, |
||
1008 | h = c.attribute, |
||
1009 | k, l, m; |
||
1010 | if (f <= e) { |
||
1011 | c.frame++; |
||
1012 | if ("translate" == h) { |
||
1013 | k = c.from.split(","); |
||
1014 | h = Number(k[0]); |
||
1015 | k = Number(k[1]); |
||
1016 | isNaN(k) && (k = 0); |
||
1017 | l = c.to.split(","); |
||
1018 | m = Number(l[0]); |
||
1019 | l = Number(l[1]); |
||
1020 | m = 0 === m - h ? m : Math.round(d[c.effect](0, f, h, m - h, e)); |
||
1021 | c = 0 === l - k ? l : Math.round(d[c.effect](0, f, k, l - k, e)); |
||
1022 | h = "transform"; |
||
1023 | if (isNaN(m) || isNaN(c)) continue; |
||
1024 | c = "translate(" + m + "," + c + ")" |
||
1025 | } else l = Number(c.from), k = Number(c.to), m = k - l, c = d[c.effect](0, f, l, m, e), isNaN(c) && (c = k), 0 === m && this.animations.splice(a, 1); |
||
1026 | this.setAttr(g, h, c) |
||
1027 | } else "translate" == h ? (l = c.to.split(","), m = Number(l[0]), l = Number(l[1]), g.translate(m, l)) : (k = Number(c.to), this.setAttr(g, h, k)), g.animationFinished = !0, this.animations.splice(a, 1) |
||
1028 | } |
||
1029 | }, |
||
1030 | getBBox: function(a) { |
||
1031 | if (a = a.node) try { |
||
1032 | return a.getBBox() |
||
1033 | } catch (b) {} |
||
1034 | return { |
||
1035 | width: 0, |
||
1036 | height: 0, |
||
1037 | x: 0, |
||
1038 | y: 0 |
||
1039 | } |
||
1040 | }, |
||
1041 | path: function(a, b) { |
||
1042 | a.node.setAttributeNS(d.SVG_XLINK, "xlink:href", b) |
||
1043 | }, |
||
1044 | clipRect: function(a, b, c, e, f) { |
||
1045 | var g = a.node, |
||
1046 | h = a.clipPath; |
||
1047 | h && this.D.remove(h); |
||
1048 | var k = g.parentNode; |
||
1049 | k && (g = document.createElementNS(d.SVG_NS, "clipPath"), h = d.getUniqueId(), g.setAttribute("id", h), this.D.rect(b, c, e, f, 0, 0, g), k.appendChild(g), b = "#", d.baseHref && !d.isIE && (b = this.removeTarget(window.location.href) + b), this.setAttr(a, "clip-path", "url(" + b + h + ")"), this.clipPathC++, a.clipPath = g) |
||
1050 | }, |
||
1051 | text: function(a, b, c) { |
||
1052 | var e = new d.AmDObject("text", this.D); |
||
1053 | a = String(a).split("\n"); |
||
1054 | var f = d.removePx(b["font-size"]), |
||
1055 | g; |
||
1056 | for (g = 0; g < a.length; g++) { |
||
1057 | var h = this.create(null, "tspan"); |
||
1058 | h.appendChild(document.createTextNode(a[g])); |
||
1059 | h.setAttribute("y", (f + 2) * g + Math.round(f / 2)); |
||
1060 | h.setAttribute("x", 0); |
||
1061 | e.node.appendChild(h) |
||
1062 | } |
||
1063 | e.node.setAttribute("y", Math.round(f / 2)); |
||
1064 | this.attr(e, b); |
||
1065 | this.D.addToContainer(e.node, c); |
||
1066 | return e |
||
1067 | }, |
||
1068 | setText: function(a, b) { |
||
1069 | var c = a.node; |
||
1070 | c && (c.removeChild(c.firstChild), c.appendChild(document.createTextNode(b))) |
||
1071 | }, |
||
1072 | move: function(a, b, c, e) { |
||
1073 | isNaN(b) && (b = 0); |
||
1074 | isNaN(c) && (c = 0); |
||
1075 | b = "translate(" + b + "," + c + ")"; |
||
1076 | e && (b = b + " scale(" + e + ")"); |
||
1077 | this.setAttr(a, "transform", b) |
||
1078 | }, |
||
1079 | rotate: function(a, b) { |
||
1080 | var c = a.node.getAttribute("transform"), |
||
1081 | e = "rotate(" + b + ")"; |
||
1082 | c && (e = c + " " + e); |
||
1083 | this.setAttr(a, "transform", e) |
||
1084 | }, |
||
1085 | set: function(a) { |
||
1086 | var b = new d.AmDObject("g", this.D); |
||
1087 | this.D.container.appendChild(b.node); |
||
1088 | if (a) { |
||
1089 | var c; |
||
1090 | for (c = 0; c < a.length; c++) b.push(a[c]) |
||
1091 | } |
||
1092 | return b |
||
1093 | }, |
||
1094 | addListener: function(a, b, c) { |
||
1095 | a.node["on" + b] = c |
||
1096 | }, |
||
1097 | gradient: function(a, b, c, e) { |
||
1098 | var f = a.node, |
||
1099 | g = a.grad; |
||
1100 | g && this.D.remove(g); |
||
1101 | b = document.createElementNS(d.SVG_NS, b); |
||
1102 | g = d.getUniqueId(); |
||
1103 | b.setAttribute("id", g); |
||
1104 | if (!isNaN(e)) { |
||
1105 | var h = 0, |
||
1106 | k = 0, |
||
1107 | l = 0, |
||
1108 | m = 0; |
||
1109 | 90 == e ? l = 100 : 270 == e ? m = 100 : 180 == e ? h = 100 : 0 === e && (k = 100); |
||
1110 | b.setAttribute("x1", h + "%"); |
||
1111 | b.setAttribute("x2", k + "%"); |
||
1112 | b.setAttribute("y1", l + "%"); |
||
1113 | b.setAttribute("y2", m + "%") |
||
1114 | } |
||
1115 | for (e = 0; e < c.length; e++) h = document.createElementNS(d.SVG_NS, "stop"), k = 100 * e / (c.length - 1), 0 === e && (k = 0), h.setAttribute("offset", k + "%"), h.setAttribute("stop-color", c[e]), b.appendChild(h); |
||
1116 | f.parentNode.appendChild(b); |
||
1117 | c = "#"; |
||
1118 | d.baseHref && !d.isIE && (c = this.removeTarget(window.location.href) + c); |
||
1119 | f.setAttribute("fill", "url(" + c + g + ")"); |
||
1120 | a.grad = b |
||
1121 | }, |
||
1122 | removeTarget: function(a) { |
||
1123 | return a.split("#")[0] |
||
1124 | }, |
||
1125 | pattern: function(a, b, c, e) { |
||
1126 | var f = a.node; |
||
1127 | isNaN(c) && (c = 1); |
||
1128 | var g = a.patternNode; |
||
1129 | g && this.D.remove(g); |
||
1130 | var g = document.createElementNS(d.SVG_NS, "pattern"), |
||
1131 | h = d.getUniqueId(), |
||
1132 | k = b; |
||
1133 | b.url && (k = b.url); |
||
1134 | d.isAbsolute(k) || -1 != k.indexOf("data:image") || (k = e + k); |
||
1135 | e = Number(b.width); |
||
1136 | isNaN(e) && (e = 4); |
||
1137 | var l = Number(b.height); |
||
1138 | isNaN(l) && (l = 4); |
||
1139 | e /= c; |
||
1140 | l /= c; |
||
1141 | c = b.x; |
||
1142 | isNaN(c) && (c = 0); |
||
1143 | var m = -Math.random() * Number(b.randomX); |
||
1144 | isNaN(m) || (c = m); |
||
1145 | m = b.y; |
||
1146 | isNaN(m) && (m = 0); |
||
1147 | var n = -Math.random() * Number(b.randomY); |
||
1148 | isNaN(n) || (m = n); |
||
1149 | g.setAttribute("id", h); |
||
1150 | g.setAttribute("width", e); |
||
1151 | g.setAttribute("height", l); |
||
1152 | g.setAttribute("patternUnits", "userSpaceOnUse"); |
||
1153 | g.setAttribute("xlink:href", k); |
||
1154 | b.color && (n = document.createElementNS(d.SVG_NS, "rect"), n.setAttributeNS(null, "height", e), n.setAttributeNS(null, "width", l), n.setAttributeNS(null, "fill", b.color), g.appendChild(n)); |
||
1155 | this.D.image(k, 0, 0, e, l, g).translate(c, m); |
||
1156 | k = "#"; |
||
1157 | d.baseHref && !d.isIE && (k = this.removeTarget(window.location.href) + k); |
||
1158 | f.setAttribute("fill", "url(" + k + h + ")"); |
||
1159 | a.patternNode = g; |
||
1160 | f.parentNode.appendChild(g) |
||
1161 | }, |
||
1162 | remove: function(a) { |
||
1163 | a.clipPath && this.D.remove(a.clipPath); |
||
1164 | a.grad && this.D.remove(a.grad); |
||
1165 | a.patternNode && this.D.remove(a.patternNode); |
||
1166 | this.D.remove(a.node) |
||
1167 | } |
||
1168 | }) |
||
1169 | })(); |
||
1170 | (function() { |
||
1171 | var d = window.AmCharts; |
||
1172 | d.AmChart = d.Class({ |
||
1173 | construct: function(a) { |
||
1174 | this.svgIcons = this.tapToActivate = !0; |
||
1175 | this.theme = a; |
||
1176 | this.classNamePrefix = "amcharts"; |
||
1177 | this.addClassNames = !1; |
||
1178 | this.version = "3.21.6"; |
||
1179 | d.addChart(this); |
||
1180 | this.createEvents("buildStarted", "dataUpdated", "init", "rendered", "drawn", "failed", "resized", "animationFinished"); |
||
1181 | this.height = this.width = "100%"; |
||
1182 | this.dataChanged = !0; |
||
1183 | this.chartCreated = !1; |
||
1184 | this.previousWidth = this.previousHeight = 0; |
||
1185 | this.backgroundColor = "#FFFFFF"; |
||
1186 | this.borderAlpha = this.backgroundAlpha = 0; |
||
1187 | this.color = this.borderColor = "#000000"; |
||
1188 | this.fontFamily = "Verdana"; |
||
1189 | this.fontSize = 16; |
||
1190 | this.usePrefixes = !1; |
||
1191 | this.autoResize = !0; |
||
1192 | this.autoDisplay = !1; |
||
1193 | this.addCodeCredits = this.accessible = !0; |
||
1194 | this.touchStartTime = this.touchClickDuration = 0; |
||
1195 | this.precision = -1; |
||
1196 | this.percentPrecision = 2; |
||
1197 | this.decimalSeparator = "."; |
||
1198 | this.thousandsSeparator = ","; |
||
1199 | this.labels = []; |
||
1200 | this.allLabels = []; |
||
1201 | this.titles = []; |
||
1202 | this.marginRight = this.marginLeft = this.autoMarginOffset = 0; |
||
1203 | this.timeOuts = []; |
||
1204 | this.creditsPosition = "top-left"; |
||
1205 | var b = document.createElement("div"), |
||
1206 | c = b.style; |
||
1207 | c.overflow = "hidden"; |
||
1208 | c.position = "relative"; |
||
1209 | c.textAlign = "left"; |
||
1210 | this.chartDiv = b; |
||
1211 | b = document.createElement("div"); |
||
1212 | c = b.style; |
||
1213 | c.overflow = "hidden"; |
||
1214 | c.position = "relative"; |
||
1215 | c.textAlign = "left"; |
||
1216 | this.legendDiv = b; |
||
1217 | this.titleHeight = 0; |
||
1218 | this.hideBalloonTime = 150; |
||
1219 | this.handDrawScatter = 2; |
||
1220 | this.cssScale = this.handDrawThickness = 1; |
||
1221 | this.cssAngle = 0; |
||
1222 | this.prefixesOfBigNumbers = [{ |
||
1223 | number: 1E3, |
||
1224 | prefix: "k" |
||
1225 | }, { |
||
1226 | number: 1E6, |
||
1227 | prefix: "M" |
||
1228 | }, { |
||
1229 | number: 1E9, |
||
1230 | prefix: "G" |
||
1231 | }, { |
||
1232 | number: 1E12, |
||
1233 | prefix: "T" |
||
1234 | }, { |
||
1235 | number: 1E15, |
||
1236 | prefix: "P" |
||
1237 | }, { |
||
1238 | number: 1E18, |
||
1239 | prefix: "E" |
||
1240 | }, { |
||
1241 | number: 1E21, |
||
1242 | prefix: "Z" |
||
1243 | }, { |
||
1244 | number: 1E24, |
||
1245 | prefix: "Y" |
||
1246 | }]; |
||
1247 | this.prefixesOfSmallNumbers = [{ |
||
1248 | number: 1E-24, |
||
1249 | prefix: "y" |
||
1250 | }, { |
||
1251 | number: 1E-21, |
||
1252 | prefix: "z" |
||
1253 | }, { |
||
1254 | number: 1E-18, |
||
1255 | prefix: "a" |
||
1256 | }, { |
||
1257 | number: 1E-15, |
||
1258 | prefix: "f" |
||
1259 | }, { |
||
1260 | number: 1E-12, |
||
1261 | prefix: "p" |
||
1262 | }, { |
||
1263 | number: 1E-9, |
||
1264 | prefix: "n" |
||
1265 | }, { |
||
1266 | number: 1E-6, |
||
1267 | prefix: "\u03bc" |
||
1268 | }, { |
||
1269 | number: .001, |
||
1270 | prefix: "m" |
||
1271 | }]; |
||
1272 | this.panEventsEnabled = !0; |
||
1273 | this.product = "amcharts"; |
||
1274 | this.animations = []; |
||
1275 | this.balloon = new d.AmBalloon(this.theme); |
||
1276 | this.balloon.chart = this; |
||
1277 | this.processTimeout = 0; |
||
1278 | this.processCount = 1E3; |
||
1279 | this.animatable = []; |
||
1280 | this.langObj = {}; |
||
1281 | d.applyTheme(this, a, "AmChart") |
||
1282 | }, |
||
1283 | drawChart: function() { |
||
1284 | 0 < this.realWidth && 0 < this.realHeight && (this.drawBackground(), this.redrawLabels(), this.drawTitles(), this.brr(), this.renderFix(), this.chartDiv && (this.boundingRect = this.chartDiv.getBoundingClientRect())) |
||
1285 | }, |
||
1286 | makeAccessible: function(a, b, c) { |
||
1287 | this.accessible && a && (c && a.setAttr("role", c), a.setAttr("aria-label", b)) |
||
1288 | }, |
||
1289 | drawBackground: function() { |
||
1290 | d.remove(this.background); |
||
1291 | var a = this.container, |
||
1292 | b = this.backgroundColor, |
||
1293 | c = this.backgroundAlpha, |
||
1294 | e = this.set; |
||
1295 | d.isModern || 0 !== c || (c = .001); |
||
1296 | var f = this.updateWidth(); |
||
1297 | this.realWidth = f; |
||
1298 | var g = this.updateHeight(); |
||
1299 | this.realHeight = g; |
||
1300 | b = d.polygon(a, [0, f - 1, f - 1, 0], [0, 0, g - 1, g - 1], b, c, 1, this.borderColor, this.borderAlpha); |
||
1301 | d.setCN(this, b, "bg"); |
||
1302 | this.background = b; |
||
1303 | e.push(b); |
||
1304 | if (b = this.backgroundImage) a = a.image(b, 0, 0, f, g), d.setCN(this, b, "bg-image"), this.bgImg = a, e.push(a) |
||
1305 | }, |
||
1306 | drawTitles: function(a) { |
||
1307 | var b = this.titles; |
||
1308 | this.titleHeight = 0; |
||
1309 | if (d.ifArray(b)) { |
||
1310 | var c = 20, |
||
1311 | e; |
||
1312 | for (e = 0; e < b.length; e++) { |
||
1313 | var f = b[e], |
||
1314 | f = d.processObject(f, d.Title, this.theme); |
||
1315 | if (!1 !== f.enabled) { |
||
1316 | var g = f.color; |
||
1317 | void 0 === g && (g = this.color); |
||
1318 | var h = f.size; |
||
1319 | isNaN(h) && (h = this.fontSize + 2); |
||
1320 | isNaN(f.alpha); |
||
1321 | var k = this.marginLeft, |
||
1322 | l = !0; |
||
1323 | void 0 !== f.bold && (l = f.bold); |
||
1324 | g = d.wrappedText(this.container, f.text, g, this.fontFamily, h, "middle", l, this.realWidth - 35 - this.marginRight - k); |
||
1325 | g.translate(k + (this.realWidth - this.marginRight - k) / 2, c); |
||
1326 | g.node.style.pointerEvents = "none"; |
||
1327 | f.sprite = g; |
||
1328 | void 0 !== f.tabIndex && g.setAttr("tabindex", f.tabIndex); |
||
1329 | d.setCN(this, g, "title"); |
||
1330 | f.id && d.setCN(this, g, "title-" + f.id); |
||
1331 | g.attr({ |
||
1332 | opacity: f.alpha |
||
1333 | }); |
||
1334 | c += g.getBBox().height + |
||
1335 | 5; |
||
1336 | a ? g.remove() : this.freeLabelsSet.push(g) |
||
1337 | } |
||
1338 | } |
||
1339 | this.titleHeight = c - 10 |
||
1340 | } |
||
1341 | }, |
||
1342 | write: function(a) { |
||
1343 | var b = this; |
||
1344 | if (b.listeners) |
||
1345 | for (var c = 0; c < b.listeners.length; c++) { |
||
1346 | var e = b.listeners[c]; |
||
1347 | b.addListener(e.event, e.method) |
||
1348 | } |
||
1349 | b.fire({ |
||
1350 | type: "buildStarted", |
||
1351 | chart: b |
||
1352 | }); |
||
1353 | b.afterWriteTO && clearTimeout(b.afterWriteTO); |
||
1354 | 0 < b.processTimeout ? b.afterWriteTO = setTimeout(function() { |
||
1355 | b.afterWrite.call(b, a) |
||
1356 | }, b.processTimeout) : b.afterWrite(a) |
||
1357 | }, |
||
1358 | afterWrite: function(a) { |
||
1359 | var b; |
||
1360 | if (b = "object" != typeof a ? document.getElementById(a) : a) { |
||
1361 | for (; b.firstChild;) b.removeChild(b.firstChild); |
||
1362 | this.div = b; |
||
1363 | b.style.overflow = "hidden"; |
||
1364 | b.style.textAlign = "left"; |
||
1365 | a = this.chartDiv; |
||
1366 | var c = this.legendDiv, |
||
1367 | e = this.legend, |
||
1368 | f = c.style, |
||
1369 | g = a.style; |
||
1370 | this.measure(); |
||
1371 | this.previousHeight = this.divRealHeight; |
||
1372 | this.previousWidth = this.divRealWidth; |
||
1373 | var h, k = document.createElement("div"); |
||
1374 | h = k.style; |
||
1375 | h.position = "relative"; |
||
1376 | this.containerDiv = k; |
||
1377 | k.className = this.classNamePrefix + "-main-div"; |
||
1378 | a.className = this.classNamePrefix + "-chart-div"; |
||
1379 | b.appendChild(k); |
||
1380 | (b = this.exportConfig) && d.AmExport && !this.AmExport && (this.AmExport = new d.AmExport(this, b)); |
||
1381 | this.amExport && d.AmExport && (this.AmExport = d.extend(this.amExport, new d.AmExport(this), !0)); |
||
1382 | this.AmExport && this.AmExport.init && this.AmExport.init(); |
||
1383 | if (e) { |
||
1384 | e = this.addLegend(e, e.divId); |
||
1385 | if (e.enabled) switch (f.left = null, f.top = null, f.right = null, g.left = null, g.right = null, g.top = null, f.position = "relative", g.position = "relative", h.width = "100%", h.height = "100%", e.position) { |
||
1386 | case "bottom": |
||
1387 | k.appendChild(a); |
||
1388 | k.appendChild(c); |
||
1389 | break; |
||
1390 | case "top": |
||
1391 | k.appendChild(c); |
||
1392 | k.appendChild(a); |
||
1393 | break; |
||
1394 | case "absolute": |
||
1395 | f.position = "absolute"; |
||
1396 | g.position = "absolute"; |
||
1397 | void 0 !== e.left && (f.left = e.left + "px"); |
||
1398 | void 0 !== e.right && (f.right = e.right + "px"); |
||
1399 | void 0 !== e.top && (f.top = e.top + "px"); |
||
1400 | void 0 !== e.bottom && (f.bottom = e.bottom + "px"); |
||
1401 | e.marginLeft = 0; |
||
1402 | e.marginRight = 0; |
||
1403 | k.appendChild(a); |
||
1404 | k.appendChild(c); |
||
1405 | break; |
||
1406 | case "right": |
||
1407 | f.position = "relative"; |
||
1408 | g.position = "absolute"; |
||
1409 | k.appendChild(a); |
||
1410 | k.appendChild(c); |
||
1411 | break; |
||
1412 | case "left": |
||
1413 | f.position = "absolute"; |
||
1414 | g.position = "relative"; |
||
1415 | k.appendChild(a); |
||
1416 | k.appendChild(c); |
||
1417 | break; |
||
1418 | case "outside": |
||
1419 | k.appendChild(a) |
||
1420 | } else k.appendChild(a); |
||
1421 | this.prevLegendPosition = e.position |
||
1422 | } else k.appendChild(a); |
||
1423 | this.listenersAdded || (this.addListeners(), this.listenersAdded = !0); |
||
1424 | (this.mouseWheelScrollEnabled || this.mouseWheelZoomEnabled) && d.addWheelListeners(); |
||
1425 | this.initChart() |
||
1426 | } |
||
1427 | }, |
||
1428 | createLabelsSet: function() { |
||
1429 | d.remove(this.labelsSet); |
||
1430 | this.labelsSet = this.container.set(); |
||
1431 | this.freeLabelsSet.push(this.labelsSet) |
||
1432 | }, |
||
1433 | initChart: function() { |
||
1434 | this.balloon = d.processObject(this.balloon, d.AmBalloon, this.theme); |
||
1435 | window.AmCharts_path && (this.path = window.AmCharts_path); |
||
1436 | void 0 === this.path && (this.path = d.getPath()); |
||
1437 | void 0 === this.path && (this.path = "amcharts/"); |
||
1438 | this.path = d.normalizeUrl(this.path); |
||
1439 | void 0 === this.pathToImages && (this.pathToImages = this.path + "images/"); |
||
1440 | this.initHC || (d.callInitHandler(this), this.initHC = !0); |
||
1441 | d.applyLang(this.language, this); |
||
1442 | var a = this.numberFormatter; |
||
1443 | a && (isNaN(a.precision) || (this.precision = a.precision), void 0 !== a.thousandsSeparator && (this.thousandsSeparator = a.thousandsSeparator), void 0 !== a.decimalSeparator && (this.decimalSeparator = a.decimalSeparator)); |
||
1444 | (a = this.percentFormatter) && !isNaN(a.precision) && (this.percentPrecision = a.precision); |
||
1445 | this.nf = { |
||
1446 | precision: this.precision, |
||
1447 | thousandsSeparator: this.thousandsSeparator, |
||
1448 | decimalSeparator: this.decimalSeparator |
||
1449 | }; |
||
1450 | this.pf = { |
||
1451 | precision: this.percentPrecision, |
||
1452 | thousandsSeparator: this.thousandsSeparator, |
||
1453 | decimalSeparator: this.decimalSeparator |
||
1454 | }; |
||
1455 | this.destroy(); |
||
1456 | (a = this.container) ? (a.container.innerHTML = "", a.width = this.realWidth, a.height = this.realHeight, a.addDefs(this), this.chartDiv.appendChild(a.container)) : a = new d.AmDraw(this.chartDiv, this.realWidth, this.realHeight, this); |
||
1457 | this.container = a; |
||
1458 | this.extension = ".png"; |
||
1459 | this.svgIcons && d.SVG && (this.extension = ".svg"); |
||
1460 | this.checkDisplay(); |
||
1461 | this.checkTransform(this.div); |
||
1462 | a.chart = this; |
||
1463 | d.VML || d.SVG ? (a.handDrawn = this.handDrawn, a.handDrawScatter = this.handDrawScatter, a.handDrawThickness = this.handDrawThickness, d.remove(this.set), this.set = a.set(), d.remove(this.gridSet), this.gridSet = a.set(), d.remove(this.cursorLineSet), this.cursorLineSet = a.set(), d.remove(this.graphsBehindSet), this.graphsBehindSet = a.set(), d.remove(this.bulletBehindSet), this.bulletBehindSet = a.set(), d.remove(this.columnSet), this.columnSet = a.set(), d.remove(this.graphsSet), this.graphsSet = a.set(), d.remove(this.trendLinesSet), this.trendLinesSet = a.set(), d.remove(this.axesSet), this.axesSet = a.set(), d.remove(this.cursorSet), this.cursorSet = a.set(), d.remove(this.scrollbarsSet), this.scrollbarsSet = a.set(), d.remove(this.bulletSet), this.bulletSet = a.set(), d.remove(this.freeLabelsSet), this.freeLabelsSet = a.set(), d.remove(this.axesLabelsSet), this.axesLabelsSet = a.set(), d.remove(this.balloonsSet), this.balloonsSet = a.set(), d.remove(this.plotBalloonsSet), this.plotBalloonsSet = a.set(), d.remove(this.zoomButtonSet), this.zoomButtonSet = a.set(), d.remove(this.zbSet), this.zbSet = null, d.remove(this.linkSet), this.linkSet = a.set()) : this.fire({ |
||
1464 | type: "failed", |
||
1465 | chart: this |
||
1466 | }) |
||
1467 | }, |
||
1468 | premeasure: function() { |
||
1469 | var a = this.div; |
||
1470 | if (a) { |
||
1471 | try { |
||
1472 | this.boundingRect = this.chartDiv.getBoundingClientRect() |
||
1473 | } catch (e) {} |
||
1474 | var b = a.offsetWidth, |
||
1475 | c = a.offsetHeight; |
||
1476 | a.clientHeight && (b = a.clientWidth, c = a.clientHeight); |
||
1477 | if (b != this.mw || c != this.mh) this.mw = b, this.mh = c, this.measure() |
||
1478 | } |
||
1479 | }, |
||
1480 | measure: function() { |
||
1481 | var a = this.div; |
||
1482 | if (a) { |
||
1483 | var b = this.chartDiv, |
||
1484 | c = a.offsetWidth, |
||
1485 | e = a.offsetHeight, |
||
1486 | f = this.container; |
||
1487 | a.clientHeight && (c = a.clientWidth, e = a.clientHeight); |
||
1488 | var e = Math.round(e), |
||
1489 | c = Math.round(c), |
||
1490 | a = Math.round(d.toCoordinate(this.width, c)), |
||
1491 | g = Math.round(d.toCoordinate(this.height, e)); |
||
1492 | (c != this.previousWidth || e != this.previousHeight) && 0 < a && 0 < g && (b.style.width = a + "px", b.style.height = g + "px", b.style.padding = 0, f && f.setSize(a, g), this.balloon = d.processObject(this.balloon, d.AmBalloon, this.theme)); |
||
1493 | this.balloon && this.balloon.setBounds && this.balloon.setBounds(2, 2, a - 2, g); |
||
1494 | this.updateWidth(); |
||
1495 | this.balloon.chart = this; |
||
1496 | this.realWidth = a; |
||
1497 | this.realHeight = g; |
||
1498 | this.divRealWidth = c; |
||
1499 | this.divRealHeight = e |
||
1500 | } |
||
1501 | }, |
||
1502 | checkDisplay: function() { |
||
1503 | if (this.autoDisplay && this.container) { |
||
1504 | var a = d.rect(this.container, 10, 10), |
||
1505 | b = a.getBBox(); |
||
1506 | 0 === b.width && 0 === b.height && (this.divRealHeight = this.divRealWidth = this.realHeight = this.realWidth = 0, this.previousWidth = this.previousHeight = NaN); |
||
1507 | a.remove() |
||
1508 | } |
||
1509 | }, |
||
1510 | checkTransform: function(a) { |
||
1511 | if (this.autoTransform && window.getComputedStyle && a) { |
||
1512 | if (a.style) { |
||
1513 | var b = window.getComputedStyle(a, null); |
||
1514 | if (b && (b = b.getPropertyValue("-webkit-transform") || b.getPropertyValue("-moz-transform") || b.getPropertyValue("-ms-transform") || b.getPropertyValue("-o-transform") || b.getPropertyValue("transform")) && "none" !== b) { |
||
1515 | var c = b.split("(")[1].split(")")[0].split(","), |
||
1516 | b = c[0], |
||
1517 | c = c[1], |
||
1518 | b = Math.sqrt(b * b + c * c); |
||
1519 | isNaN(b) || (this.cssScale *= b) |
||
1520 | } |
||
1521 | } |
||
1522 | a.parentNode && this.checkTransform(a.parentNode) |
||
1523 | } |
||
1524 | }, |
||
1525 | destroy: function() { |
||
1526 | this.chartDiv.innerHTML = ""; |
||
1527 | this.clearTimeOuts(); |
||
1528 | this.legend && this.legend.destroy() |
||
1529 | }, |
||
1530 | clearTimeOuts: function() { |
||
1531 | var a = this.timeOuts; |
||
1532 | if (a) { |
||
1533 | var b; |
||
1534 | for (b = 0; b < a.length; b++) clearTimeout(a[b]) |
||
1535 | } |
||
1536 | this.timeOuts = [] |
||
1537 | }, |
||
1538 | clear: function(a) { |
||
1539 | try { |
||
1540 | document.removeEventListener("touchstart", this.docfn1, !0), document.removeEventListener("touchend", this.docfn2, !0) |
||
1541 | } catch (b) {} |
||
1542 | d.callMethod("clear", [this.chartScrollbar, this.scrollbarV, this.scrollbarH, this.chartCursor]); |
||
1543 | this.chartCursor = this.scrollbarH = this.scrollbarV = this.chartScrollbar = null; |
||
1544 | this.clearTimeOuts(); |
||
1545 | this.container && (this.container.remove(this.chartDiv), this.container.remove(this.legendDiv)); |
||
1546 | a || d.removeChart(this); |
||
1547 | if (a = this.div) |
||
1548 | for (; a.firstChild;) a.removeChild(a.firstChild); |
||
1549 | this.legend && this.legend.destroy(); |
||
1550 | this.AmExport && this.AmExport.clear && this.AmExport.clear() |
||
1551 | }, |
||
1552 | setMouseCursor: function(a) { |
||
1553 | "auto" == a && d.isNN && (a = "default"); |
||
1554 | this.chartDiv.style.cursor = a; |
||
1555 | this.legendDiv.style.cursor = a |
||
1556 | }, |
||
1557 | redrawLabels: function() { |
||
1558 | this.labels = []; |
||
1559 | var a = this.allLabels; |
||
1560 | this.createLabelsSet(); |
||
1561 | var b; |
||
1562 | for (b = 0; b < a.length; b++) this.drawLabel(a[b]) |
||
1563 | }, |
||
1564 | drawLabel: function(a) { |
||
1565 | var b = this; |
||
1566 | if (b.container && !1 !== a.enabled) { |
||
1567 | a = d.processObject(a, d.Label, b.theme); |
||
1568 | var c = a.y, |
||
1569 | e = a.text, |
||
1570 | f = a.align, |
||
1571 | g = a.size, |
||
1572 | h = a.color, |
||
1573 | k = a.rotation, |
||
1574 | l = a.alpha, |
||
1575 | m = a.bold, |
||
1576 | n = d.toCoordinate(a.x, b.realWidth), |
||
1577 | c = d.toCoordinate(c, b.realHeight); |
||
1578 | n || (n = 0); |
||
1579 | c || (c = 0); |
||
1580 | void 0 === h && (h = b.color); |
||
1581 | isNaN(g) && (g = b.fontSize); |
||
1582 | f || (f = "start"); |
||
1583 | "left" == f && (f = "start"); |
||
1584 | "right" == f && (f = "end"); |
||
1585 | "center" == f && (f = "middle", k ? c = b.realHeight - c + c / 2 : n = b.realWidth / 2 - n); |
||
1586 | void 0 === l && (l = 1); |
||
1587 | void 0 === k && (k = 0); |
||
1588 | c += g / 2; |
||
1589 | e = d.text(b.container, e, h, b.fontFamily, g, f, m, l); |
||
1590 | e.translate(n, c); |
||
1591 | void 0 !== a.tabIndex && e.setAttr("tabindex", a.tabIndex); |
||
1592 | d.setCN(b, e, "label"); |
||
1593 | a.id && d.setCN(b, e, "label-" + a.id); |
||
1594 | 0 !== k && e.rotate(k); |
||
1595 | a.url ? (e.setAttr("cursor", "pointer"), e.click(function() { |
||
1596 | d.getURL(a.url, b.urlTarget) |
||
1597 | })) : e.node.style.pointerEvents = "none"; |
||
1598 | b.labelsSet.push(e); |
||
1599 | b.labels.push(e) |
||
1600 | } |
||
1601 | }, |
||
1602 | addLabel: function(a, b, c, e, d, g, h, k, l, m) { |
||
1603 | a = { |
||
1604 | x: a, |
||
1605 | y: b, |
||
1606 | text: c, |
||
1607 | align: e, |
||
1608 | size: d, |
||
1609 | color: g, |
||
1610 | alpha: k, |
||
1611 | rotation: h, |
||
1612 | bold: l, |
||
1613 | url: m, |
||
1614 | enabled: !0 |
||
1615 | }; |
||
1616 | this.container && this.drawLabel(a); |
||
1617 | this.allLabels.push(a) |
||
1618 | }, |
||
1619 | clearLabels: function() { |
||
1620 | var a = this.labels, |
||
1621 | b; |
||
1622 | for (b = a.length - 1; 0 <= b; b--) a[b].remove(); |
||
1623 | this.labels = []; |
||
1624 | this.allLabels = [] |
||
1625 | }, |
||
1626 | updateHeight: function() { |
||
1627 | var a = this.divRealHeight, |
||
1628 | b = this.legend; |
||
1629 | if (b) { |
||
1630 | var c = this.legendDiv.offsetHeight, |
||
1631 | b = b.position; |
||
1632 | if ("top" == b || "bottom" == b) { |
||
1633 | a -= c; |
||
1634 | if (0 > a || isNaN(a)) a = 0; |
||
1635 | this.chartDiv.style.height = a + "px" |
||
1636 | } |
||
1637 | } |
||
1638 | return a |
||
1639 | }, |
||
1640 | updateWidth: function() { |
||
1641 | var a = this.divRealWidth, |
||
1642 | b = this.divRealHeight, |
||
1643 | c = this.legend; |
||
1644 | if (c) { |
||
1645 | var e = this.legendDiv, |
||
1646 | d = e.offsetWidth; |
||
1647 | isNaN(c.width) || (d = c.width); |
||
1648 | c.ieW && (d = c.ieW); |
||
1649 | var g = e.offsetHeight, |
||
1650 | e = e.style, |
||
1651 | h = this.chartDiv.style, |
||
1652 | k = c.position; |
||
1653 | if (("right" == k || "left" == k) && void 0 === c.divId) { |
||
1654 | a -= d; |
||
1655 | if (0 > a || isNaN(a)) a = 0; |
||
1656 | h.width = a + "px"; |
||
1657 | this.balloon && this.balloon.setBounds && this.balloon.setBounds(2, 2, a - 2, this.realHeight); |
||
1658 | "left" == k ? (h.left = d + "px", e.left = "0px") : (h.left = "0px", e.left = a + "px"); |
||
1659 | b > g && (e.top = (b - g) / 2 + "px") |
||
1660 | } |
||
1661 | } |
||
1662 | return a |
||
1663 | }, |
||
1664 | getTitleHeight: function() { |
||
1665 | this.drawTitles(!0); |
||
1666 | return this.titleHeight |
||
1667 | }, |
||
1668 | addTitle: function(a, b, c, e, d) { |
||
1669 | isNaN(b) && (b = this.fontSize + 2); |
||
1670 | a = { |
||
1671 | text: a, |
||
1672 | size: b, |
||
1673 | color: c, |
||
1674 | alpha: e, |
||
1675 | bold: d, |
||
1676 | enabled: !0 |
||
1677 | }; |
||
1678 | this.titles.push(a); |
||
1679 | return a |
||
1680 | }, |
||
1681 | handleWheel: function(a) { |
||
1682 | var b = 0; |
||
1683 | a || (a = window.event); |
||
1684 | a.wheelDelta ? b = a.wheelDelta / 120 : a.detail && (b = -a.detail / 3); |
||
1685 | b && this.handleWheelReal(b, a.shiftKey); |
||
1686 | a.preventDefault && a.preventDefault() |
||
1687 | }, |
||
1688 | handleWheelReal: function() {}, |
||
1689 | handleDocTouchStart: function() { |
||
1690 | this.handleMouseMove(); |
||
1691 | this.tmx = this.mouseX; |
||
1692 | this.tmy = this.mouseY; |
||
1693 | this.touchStartTime = (new Date).getTime() |
||
1694 | }, |
||
1695 | handleDocTouchEnd: function() { |
||
1696 | -.5 < this.tmx && this.tmx < this.divRealWidth + 1 && 0 < this.tmy && this.tmy < this.divRealHeight ? (this.handleMouseMove(), 4 > Math.abs(this.mouseX - this.tmx) && 4 > Math.abs(this.mouseY - this.tmy) ? (this.tapped = !0, this.panRequired && this.panEventsEnabled && this.chartDiv && (this.chartDiv.style.msTouchAction = "none", this.chartDiv.style.touchAction = "none")) : this.mouseIsOver || this.resetTouchStyle()) : (this.tapped = !1, this.resetTouchStyle()) |
||
1697 | }, |
||
1698 | resetTouchStyle: function() { |
||
1699 | this.panEventsEnabled && this.chartDiv && (this.chartDiv.style.msTouchAction = "auto", this.chartDiv.style.touchAction = "auto") |
||
1700 | }, |
||
1701 | checkTouchDuration: function(a) { |
||
1702 | var b = this, |
||
1703 | c = (new Date).getTime(); |
||
1704 | if (a) |
||
1705 | if (a.touches) b.isTouchEvent = !0; |
||
1706 | else if (!b.isTouchEvent) return !0; |
||
1707 | if (c - b.touchStartTime > b.touchClickDuration) return !0; |
||
1708 | setTimeout(function() { |
||
1709 | b.resetTouchDuration() |
||
1710 | }, 300) |
||
1711 | }, |
||
1712 | resetTouchDuration: function() { |
||
1713 | this.isTouchEvent = !1 |
||
1714 | }, |
||
1715 | checkTouchMoved: function() { |
||
1716 | if (4 < Math.abs(this.mouseX - this.tmx) || 4 < Math.abs(this.mouseY - this.tmy)) return !0 |
||
1717 | }, |
||
1718 | addListeners: function() { |
||
1719 | var a = this, |
||
1720 | b = a.chartDiv; |
||
1721 | document.addEventListener ? ("ontouchstart" in document.documentElement && (b.addEventListener("touchstart", function(b) { |
||
1722 | a.handleTouchStart.call(a, b) |
||
1723 | }, !0), b.addEventListener("touchmove", function(b) { |
||
1724 | a.handleMouseMove.call(a, b) |
||
1725 | }, !0), b.addEventListener("touchend", function(b) { |
||
1726 | a.handleTouchEnd.call(a, b) |
||
1727 | }, !0), a.docfn1 = function(b) { |
||
1728 | a.handleDocTouchStart.call(a, b) |
||
1729 | }, a.docfn2 = function(b) { |
||
1730 | a.handleDocTouchEnd.call(a, b) |
||
1731 | }, document.addEventListener("touchstart", a.docfn1, !0), document.addEventListener("touchend", a.docfn2, !0)), b.addEventListener("mousedown", function(b) { |
||
1732 | a.mouseIsOver = !0; |
||
1733 | a.handleMouseMove.call(a, b); |
||
1734 | a.handleMouseDown.call(a, b); |
||
1735 | a.handleDocTouchStart.call(a, b) |
||
1736 | }, !0), b.addEventListener("mouseover", function(b) { |
||
1737 | a.handleMouseOver.call(a, b) |
||
1738 | }, !0), b.addEventListener("mouseout", function(b) { |
||
1739 | a.handleMouseOut.call(a, b) |
||
1740 | }, !0), b.addEventListener("mouseup", function(b) { |
||
1741 | a.handleDocTouchEnd.call(a, b) |
||
1742 | }, !0)) : (b.attachEvent("onmousedown", function(b) { |
||
1743 | a.handleMouseDown.call(a, b) |
||
1744 | }), b.attachEvent("onmouseover", function(b) { |
||
1745 | a.handleMouseOver.call(a, b) |
||
1746 | }), b.attachEvent("onmouseout", function(b) { |
||
1747 | a.handleMouseOut.call(a, b) |
||
1748 | })) |
||
1749 | }, |
||
1750 | dispDUpd: function() { |
||
1751 | this.skipEvents || (this.dispatchDataUpdated && (this.dispatchDataUpdated = !1, this.fire({ |
||
1752 | type: "dataUpdated", |
||
1753 | chart: this |
||
1754 | })), this.chartCreated || (this.chartCreated = !0, this.fire({ |
||
1755 | type: "init", |
||
1756 | chart: this |
||
1757 | })), this.chartRendered || (this.fire({ |
||
1758 | type: "rendered", |
||
1759 | chart: this |
||
1760 | }), this.chartRendered = !0), this.fire({ |
||
1761 | type: "drawn", |
||
1762 | chart: this |
||
1763 | })); |
||
1764 | this.skipEvents = !1 |
||
1765 | }, |
||
1766 | validateSize: function() { |
||
1767 | var a = this; |
||
1768 | a.premeasure(); |
||
1769 | a.checkDisplay(); |
||
1770 | a.cssScale = 1; |
||
1771 | a.cssAngle = 0; |
||
1772 | a.checkTransform(a.div); |
||
1773 | if (a.divRealWidth != a.previousWidth || a.divRealHeight != a.previousHeight) { |
||
1774 | var b = a.legend; |
||
1775 | if (0 < a.realWidth && 0 < a.realHeight) { |
||
1776 | a.sizeChanged = !0; |
||
1777 | if (b) { |
||
1778 | a.legendInitTO && clearTimeout(a.legendInitTO); |
||
1779 | var c = setTimeout(function() { |
||
1780 | b.invalidateSize() |
||
1781 | }, 10); |
||
1782 | a.timeOuts.push(c); |
||
1783 | a.legendInitTO = c |
||
1784 | } |
||
1785 | a.marginsUpdated = !1; |
||
1786 | clearTimeout(a.initTO); |
||
1787 | c = setTimeout(function() { |
||
1788 | a.initChart() |
||
1789 | }, 10); |
||
1790 | a.timeOuts.push(c); |
||
1791 | a.initTO = c |
||
1792 | } |
||
1793 | a.renderFix(); |
||
1794 | b && b.renderFix && b.renderFix(); |
||
1795 | clearTimeout(a.resizedTO); |
||
1796 | a.resizedTO = setTimeout(function() { |
||
1797 | a.fire({ |
||
1798 | type: "resized", |
||
1799 | chart: a |
||
1800 | }) |
||
1801 | }, 10); |
||
1802 | a.previousHeight = a.divRealHeight; |
||
1803 | a.previousWidth = a.divRealWidth |
||
1804 | } |
||
1805 | }, |
||
1806 | invalidateSize: function() { |
||
1807 | this.previousHeight = this.previousWidth = NaN; |
||
1808 | this.invalidateSizeReal() |
||
1809 | }, |
||
1810 | invalidateSizeReal: function() { |
||
1811 | var a = this; |
||
1812 | a.marginsUpdated = !1; |
||
1813 | clearTimeout(a.validateTO); |
||
1814 | var b = setTimeout(function() { |
||
1815 | a.validateSize() |
||
1816 | }, 5); |
||
1817 | a.timeOuts.push(b); |
||
1818 | a.validateTO = b |
||
1819 | }, |
||
1820 | validateData: function(a) { |
||
1821 | this.chartCreated && (this.dataChanged = !0, this.marginsUpdated = !1, this.initChart(a)) |
||
1822 | }, |
||
1823 | validateNow: function(a, b) { |
||
1824 | this.initTO && clearTimeout(this.initTO); |
||
1825 | a && (this.dataChanged = !0, this.marginsUpdated = !1); |
||
1826 | this.skipEvents = b; |
||
1827 | this.chartRendered = !1; |
||
1828 | var c = this.legend; |
||
1829 | c && c.position != this.prevLegendPosition && (this.previousWidth = this.mw = 0, c.invalidateSize && (c.invalidateSize(), this.validateSize())); |
||
1830 | this.write(this.div) |
||
1831 | }, |
||
1832 | showItem: function(a) { |
||
1833 | a.hidden = !1; |
||
1834 | this.initChart() |
||
1835 | }, |
||
1836 | hideItem: function(a) { |
||
1837 | a.hidden = !0; |
||
1838 | this.initChart() |
||
1839 | }, |
||
1840 | hideBalloon: function() { |
||
1841 | var a = this; |
||
1842 | clearTimeout(a.hoverInt); |
||
1843 | clearTimeout(a.balloonTO); |
||
1844 | a.hoverInt = setTimeout(function() { |
||
1845 | a.hideBalloonReal.call(a) |
||
1846 | }, a.hideBalloonTime) |
||
1847 | }, |
||
1848 | cleanChart: function() {}, |
||
1849 | hideBalloonReal: function() { |
||
1850 | var a = this.balloon; |
||
1851 | a && a.hide && a.hide() |
||
1852 | }, |
||
1853 | showBalloon: function(a, b, c, e, d) { |
||
1854 | var g = this; |
||
1855 | clearTimeout(g.balloonTO); |
||
1856 | clearTimeout(g.hoverInt); |
||
1857 | g.balloonTO = setTimeout(function() { |
||
1858 | g.showBalloonReal.call(g, a, b, c, e, d) |
||
1859 | }, 1) |
||
1860 | }, |
||
1861 | showBalloonReal: function(a, b, c, e, d) { |
||
1862 | this.handleMouseMove(); |
||
1863 | var g = this.balloon; |
||
1864 | g.enabled && (g.followCursor(!1), g.changeColor(b), !c || g.fixedPosition ? (g.setPosition(e, d), isNaN(e) || isNaN(d) ? g.followCursor(!0) : g.followCursor(!1)) : g.followCursor(!0), a && g.showBalloon(a)) |
||
1865 | }, |
||
1866 | handleMouseOver: function() { |
||
1867 | this.outTO && clearTimeout(this.outTO); |
||
1868 | d.resetMouseOver(); |
||
1869 | this.mouseIsOver = !0 |
||
1870 | }, |
||
1871 | handleMouseOut: function() { |
||
1872 | var a = this; |
||
1873 | d.resetMouseOver(); |
||
1874 | a.outTO && clearTimeout(a.outTO); |
||
1875 | a.outTO = setTimeout(function() { |
||
1876 | a.handleMouseOutReal() |
||
1877 | }, 10) |
||
1878 | }, |
||
1879 | handleMouseOutReal: function() { |
||
1880 | this.mouseIsOver = !1 |
||
1881 | }, |
||
1882 | handleMouseMove: function(a) { |
||
1883 | a || (a = window.event); |
||
1884 | this.mouse2Y = this.mouse2X = NaN; |
||
1885 | var b, c, e, d; |
||
1886 | if (a) { |
||
1887 | if (a.touches) { |
||
1888 | var g = a.touches.item(1); |
||
1889 | g && this.panEventsEnabled && this.boundingRect && (e = g.clientX - this.boundingRect.left, d = g.clientY - this.boundingRect.top); |
||
1890 | a = a.touches.item(0); |
||
1891 | if (!a) return |
||
1892 | } else this.wasTouched = !1; |
||
1893 | this.boundingRect && a.clientX && (b = a.clientX - this.boundingRect.left, c = a.clientY - this.boundingRect.top); |
||
1894 | isNaN(e) ? this.mouseX = b : (this.mouseX = Math.min(b, e), this.mouse2X = Math.max(b, e)); |
||
1895 | isNaN(d) ? this.mouseY = c : (this.mouseY = Math.min(c, d), this.mouse2Y = Math.max(c, d)); |
||
1896 | this.autoTransform && (this.mouseX /= this.cssScale, this.mouseY /= this.cssScale) |
||
1897 | } |
||
1898 | }, |
||
1899 | handleTouchStart: function(a) { |
||
1900 | this.hideBalloonReal(); |
||
1901 | a && (a.touches && this.tapToActivate && !this.tapped || !this.panRequired) || (this.handleMouseMove(a), this.handleMouseDown(a)) |
||
1902 | }, |
||
1903 | handleTouchEnd: function(a) { |
||
1904 | this.wasTouched = !0; |
||
1905 | this.handleMouseMove(a); |
||
1906 | d.resetMouseOver(); |
||
1907 | this.handleReleaseOutside(a) |
||
1908 | }, |
||
1909 | handleReleaseOutside: function() { |
||
1910 | this.handleDocTouchEnd.call(this) |
||
1911 | }, |
||
1912 | handleMouseDown: function(a) { |
||
1913 | d.resetMouseOver(); |
||
1914 | this.mouseIsOver = !0; |
||
1915 | a && a.preventDefault && (this.panEventsEnabled ? a.preventDefault() : a.touches || a.preventDefault()) |
||
1916 | }, |
||
1917 | addLegend: function(a, b) { |
||
1918 | a = d.processObject(a, d.AmLegend, this.theme); |
||
1919 | a.divId = b; |
||
1920 | a.ieW = 0; |
||
1921 | var c; |
||
1922 | c = "object" != typeof b && b ? document.getElementById(b) : b; |
||
1923 | this.legend = a; |
||
1924 | a.chart = this; |
||
1925 | c ? (a.div = c, a.position = "outside", a.autoMargins = !1) : a.div = this.legendDiv; |
||
1926 | return a |
||
1927 | }, |
||
1928 | removeLegend: function() { |
||
1929 | this.legend = void 0; |
||
1930 | this.previousWidth = 0; |
||
1931 | this.legendDiv.innerHTML = "" |
||
1932 | }, |
||
1933 | handleResize: function() { |
||
1934 | (d.isPercents(this.width) || d.isPercents(this.height)) && this.invalidateSizeReal(); |
||
1935 | this.renderFix() |
||
1936 | }, |
||
1937 | renderFix: function() { |
||
1938 | if (!d.VML) { |
||
1939 | var a = this.container; |
||
1940 | a && a.renderFix() |
||
1941 | } |
||
1942 | }, |
||
1943 | getSVG: function() { |
||
1944 | if (d.hasSVG) return this.container |
||
1945 | }, |
||
1946 | animate: function(a, b, c, e, f, g, h) { |
||
1947 | a["an_" + b] && d.removeFromArray(this.animations, a["an_" + b]); |
||
1948 | c = { |
||
1949 | obj: a, |
||
1950 | frame: 0, |
||
1951 | attribute: b, |
||
1952 | from: c, |
||
1953 | to: e, |
||
1954 | time: f, |
||
1955 | effect: g, |
||
1956 | suffix: h |
||
1957 | }; |
||
1958 | a["an_" + b] = c; |
||
1959 | this.animations.push(c); |
||
1960 | return c |
||
1961 | }, |
||
1962 | setLegendData: function(a) { |
||
1963 | var b = this.legend; |
||
1964 | b && b.setData(a) |
||
1965 | }, |
||
1966 | stopAnim: function(a) { |
||
1967 | d.removeFromArray(this.animations, a) |
||
1968 | }, |
||
1969 | updateAnimations: function() { |
||
1970 | var a; |
||
1971 | this.container && this.container.update(); |
||
1972 | if (this.animations) |
||
1973 | for (a = this.animations.length - 1; 0 <= a; a--) { |
||
1974 | var b = this.animations[a], |
||
1975 | c = d.updateRate * b.time, |
||
1976 | e = b.frame + 1, |
||
1977 | f = b.obj, |
||
1978 | g = b.attribute; |
||
1979 | if (e <= c) { |
||
1980 | b.frame++; |
||
1981 | var h = Number(b.from), |
||
1982 | k = Number(b.to) - h, |
||
1983 | c = d[b.effect](0, e, h, k, c); |
||
1984 | 0 === k ? (this.animations.splice(a, 1), f.node.style[g] = Number(b.to) + b.suffix) : f.node.style[g] = c + b.suffix |
||
1985 | } else f.node.style[g] = Number(b.to) + b.suffix, f.animationFinished = !0, this.animations.splice(a, 1) |
||
1986 | } |
||
1987 | }, |
||
1988 | update: function() { |
||
1989 | this.updateAnimations(); |
||
1990 | var a = this.animatable; |
||
1991 | if (0 < a.length) { |
||
1992 | for (var b = !0, c = a.length - 1; 0 <= c; c--) { |
||
1993 | var e = a[c]; |
||
1994 | e && (e.animationFinished ? a.splice(c, 1) : b = !1) |
||
1995 | } |
||
1996 | b && (this.fire({ |
||
1997 | type: "animationFinished", |
||
1998 | chart: this |
||
1999 | }), this.animatable = []) |
||
2000 | } |
||
2001 | }, |
||
2002 | inIframe: function() { |
||
2003 | try { |
||
2004 | return window.self !== window.top |
||
2005 | } catch (a) { |
||
2006 | return !0 |
||
2007 | } |
||
2008 | }, |
||
2009 | brr: function() { |
||
2010 | if (!this.hideCredits) { |
||
2011 | var a = "amcharts.com", |
||
2012 | b = window.location.hostname.split("."), |
||
2013 | c; |
||
2014 | 2 <= b.length && (c = b[b.length - 2] + "." + b[b.length - 1]); |
||
2015 | this.amLink && (b = this.amLink.parentNode) && b.removeChild(this.amLink); |
||
2016 | b = this.creditsPosition; |
||
2017 | if (c != a || !0 === this.inIframe()) { |
||
2018 | var a = "http://www." + a, |
||
2019 | e = c = 0, |
||
2020 | d = this.realWidth, |
||
2021 | g = this.realHeight, |
||
2022 | h = this.type; |
||
2023 | if ("serial" == h || "xy" == h || "gantt" == h) c = this.marginLeftReal, e = this.marginTopReal, d = c + this.plotAreaWidth, g = e + this.plotAreaHeight; |
||
2024 | var h = a + "/javascript-charts/", |
||
2025 | k = "JavaScript charts", |
||
2026 | l = "Felicity"; |
||
2027 | "ammap" == this.product && (h = "https://felicity.iiit.ac.in/", k = "Felicity", l = "Felicity"); |
||
2028 | a = document.createElement("a"); |
||
2029 | l = document.createTextNode(l); |
||
2030 | a.setAttribute("href", h); |
||
2031 | a.setAttribute("title", k); |
||
2032 | this.urlTarget && a.setAttribute("target", this.urlTarget); |
||
2033 | a.appendChild(l); |
||
2034 | this.chartDiv.appendChild(a); |
||
2035 | this.amLink = a; |
||
2036 | h = a.style; |
||
2037 | h.position = "absolute"; |
||
2038 | h.textDecoration = "none"; |
||
2039 | h.color = this.color; |
||
2040 | h.fontFamily = this.fontFamily; |
||
2041 | h.fontSize = "11px"; |
||
2042 | h.opacity = .7; |
||
2043 | h.display = "block"; |
||
2044 | var k = a.offsetWidth, |
||
2045 | a = a.offsetHeight, |
||
2046 | l = 5 + c, |
||
2047 | m = e + 5; |
||
2048 | "bottom-left" == b && (l = 5 + c, m = g - a - 3); |
||
2049 | "bottom-right" == b && (l = d - k - 5, m = g - a - 3); |
||
2050 | "top-right" == b && (l = d - k - 5, m = e + 5); |
||
2051 | h.left = l + "px"; |
||
2052 | h.top = m + "px" |
||
2053 | } |
||
2054 | } |
||
2055 | } |
||
2056 | }); |
||
2057 | d.Slice = d.Class({ |
||
2058 | construct: function() {} |
||
2059 | }); |
||
2060 | d.SerialDataItem = d.Class({ |
||
2061 | construct: function() {} |
||
2062 | }); |
||
2063 | d.GraphDataItem = d.Class({ |
||
2064 | construct: function() {} |
||
2065 | }); |
||
2066 | d.Guide = d.Class({ |
||
2067 | construct: function(a) { |
||
2068 | this.cname = "Guide"; |
||
2069 | d.applyTheme(this, a, this.cname) |
||
2070 | } |
||
2071 | }); |
||
2072 | d.Title = d.Class({ |
||
2073 | construct: function(a) { |
||
2074 | this.cname = "Title"; |
||
2075 | d.applyTheme(this, a, this.cname) |
||
2076 | } |
||
2077 | }); |
||
2078 | d.Label = d.Class({ |
||
2079 | construct: function(a) { |
||
2080 | this.cname = "Label"; |
||
2081 | d.applyTheme(this, a, this.cname) |
||
2082 | } |
||
2083 | }) |
||
2084 | })(); |
||
2085 | (function() { |
||
2086 | var d = window.AmCharts; |
||
2087 | d.AmBalloon = d.Class({ |
||
2088 | construct: function(a) { |
||
2089 | this.cname = "AmBalloon"; |
||
2090 | this.enabled = !0; |
||
2091 | this.fillColor = "#FFFFFF"; |
||
2092 | this.fillAlpha = .8; |
||
2093 | this.borderThickness = 2; |
||
2094 | this.borderColor = "#FFFFFF"; |
||
2095 | this.borderAlpha = 1; |
||
2096 | this.cornerRadius = 0; |
||
2097 | this.maxWidth = 220; |
||
2098 | this.horizontalPadding = 8; |
||
2099 | this.verticalPadding = 4; |
||
2100 | this.pointerWidth = 6; |
||
2101 | this.pointerOrientation = "V"; |
||
2102 | this.color = "#000000"; |
||
2103 | this.adjustBorderColor = !0; |
||
2104 | this.show = this.follow = this.showBullet = !1; |
||
2105 | this.bulletSize = 3; |
||
2106 | this.shadowAlpha = .4; |
||
2107 | this.shadowColor = "#000000"; |
||
2108 | this.fadeOutDuration = this.animationDuration = .3; |
||
2109 | this.fixedPosition = !0; |
||
2110 | this.offsetY = 6; |
||
2111 | this.offsetX = 1; |
||
2112 | this.textAlign = "center"; |
||
2113 | this.disableMouseEvents = !0; |
||
2114 | this.deltaSignX = this.deltaSignY = 1; |
||
2115 | d.isModern || (this.offsetY *= 1.5); |
||
2116 | this.sdy = this.sdx = 0; |
||
2117 | d.applyTheme(this, a, this.cname) |
||
2118 | }, |
||
2119 | draw: function() { |
||
2120 | var a = this.pointToX, |
||
2121 | b = this.pointToY; |
||
2122 | d.isModern || (this.drop = !1); |
||
2123 | var c = this.chart; |
||
2124 | d.VML && (this.fadeOutDuration = 0); |
||
2125 | this.xAnim && c.stopAnim(this.xAnim); |
||
2126 | this.yAnim && c.stopAnim(this.yAnim); |
||
2127 | this.sdy = this.sdx = 0; |
||
2128 | if (!isNaN(a)) { |
||
2129 | var e = this.follow, |
||
2130 | f = c.container, |
||
2131 | g = this.set; |
||
2132 | d.remove(g); |
||
2133 | this.removeDiv(); |
||
2134 | g = f.set(); |
||
2135 | g.node.style.pointerEvents = "none"; |
||
2136 | this.set = g; |
||
2137 | this.mainSet ? (this.mainSet.push(this.set), this.sdx = this.mainSet.x, this.sdy = this.mainSet.y) : c.balloonsSet.push(g); |
||
2138 | if (this.show) { |
||
2139 | var h = this.l, |
||
2140 | k = this.t, |
||
2141 | l = this.r, |
||
2142 | m = this.b, |
||
2143 | n = this.balloonColor, |
||
2144 | p = this.fillColor, |
||
2145 | r = this.borderColor, |
||
2146 | t = p; |
||
2147 | void 0 != n && (this.adjustBorderColor ? t = r = n : p = n); |
||
2148 | var q = this.horizontalPadding, |
||
2149 | y = this.verticalPadding, |
||
2150 | B = this.pointerWidth, |
||
2151 | u = this.pointerOrientation, |
||
2152 | w = this.cornerRadius, |
||
2153 | v = c.fontFamily, |
||
2154 | A = this.fontSize; |
||
2155 | void 0 == A && (A = c.fontSize); |
||
2156 | var n = document.createElement("div"), |
||
2157 | C = c.classNamePrefix; |
||
2158 | n.className = C + "-balloon-div"; |
||
2159 | this.className && (n.className = n.className + " " + C + "-balloon-div-" + this.className); |
||
2160 | C = n.style; |
||
2161 | this.disableMouseEvents && (C.pointerEvents = "none"); |
||
2162 | C.position = "absolute"; |
||
2163 | var x = this.minWidth, |
||
2164 | z = document.createElement("div"); |
||
2165 | n.appendChild(z); |
||
2166 | var F = z.style; |
||
2167 | isNaN(x) || (F.minWidth = x - 2 * q + "px"); |
||
2168 | F.textAlign = this.textAlign; |
||
2169 | F.maxWidth = this.maxWidth + "px"; |
||
2170 | F.fontSize = A + "px"; |
||
2171 | F.color = this.color; |
||
2172 | F.fontFamily = v; |
||
2173 | z.innerHTML = this.text; |
||
2174 | c.chartDiv.appendChild(n); |
||
2175 | this.textDiv = n; |
||
2176 | var F = n.offsetWidth, |
||
2177 | E = n.offsetHeight; |
||
2178 | n.clientHeight && (F = n.clientWidth, E = n.clientHeight); |
||
2179 | v = E + 2 * y; |
||
2180 | z = F + 2 * q; |
||
2181 | !isNaN(x) && z < x && (z = x); |
||
2182 | window.opera && (v += 2); |
||
2183 | var H = !1, |
||
2184 | A = this.offsetY; |
||
2185 | c.handDrawn && (A += c.handDrawScatter + 2); |
||
2186 | "H" != u ? (x = a - z / 2, b < k + v + 10 && "down" != u ? (H = !0, e && (b += A), A = b + B, this.deltaSignY = -1) : (e && (b -= A), A = b - v - B, this.deltaSignY = 1)) : (2 * B > v && (B = v / 2), A = b - v / 2, a < h + (l - h) / 2 ? (x = a + B, this.deltaSignX = -1) : (x = a - z - B, this.deltaSignX = |
||
2187 | 1)); |
||
2188 | A + v >= m && (A = m - v); |
||
2189 | A < k && (A = k); |
||
2190 | x < h && (x = h); |
||
2191 | x + z > l && (x = l - z); |
||
2192 | var k = A + y, |
||
2193 | m = x + q, |
||
2194 | G = this.shadowAlpha, |
||
2195 | D = this.shadowColor, |
||
2196 | q = this.borderThickness, |
||
2197 | K = this.bulletSize, |
||
2198 | J, y = this.fillAlpha, |
||
2199 | L = this.borderAlpha; |
||
2200 | this.showBullet && (J = d.circle(f, K, t, y), g.push(J)); |
||
2201 | this.drop ? (h = z / 1.6, l = 0, "V" == u && (u = "down"), "H" == u && (u = "left"), "down" == u && (x = a + 1, A = b - h - h / 3), "up" == u && (l = 180, x = a + 1, A = b + h + h / 3), "left" == u && (l = 270, x = a + h + h / 3 + 2, A = b), "right" == u && (l = 90, x = a - h - h / 3 + 2, A = b), k = A - E / 2 + 1, m = x - F / 2 - 1, p = d.drop(f, h, l, p, y, q, r, L)) : 0 < w || 0 === B ? (0 < G && (a = d.rect(f, z, v, p, 0, q + 1, D, G, w), d.isModern ? a.translate(1, 1) : a.translate(4, 4), g.push(a)), p = d.rect(f, z, v, p, y, q, r, L, w)) : (t = [], w = [], "H" != u ? (h = a - x, h > z - B && (h = z - B), h < B && (h = B), t = [0, h - B, a - x, h + B, z, z, 0, 0], w = H ? [0, 0, b - A, 0, 0, v, v, 0] : [v, v, b - A, v, v, 0, 0, v]) : (u = b - A, u > v - B && (u = v - B), u < B && (u = B), w = [0, u - B, b - A, u + B, v, v, 0, 0], t = a < h + (l - h) / 2 ? [0, 0, x < a ? 0 : a - x, 0, 0, z, z, 0] : [z, z, x + z > a ? z : a - x, z, z, 0, 0, z]), 0 < G && (a = d.polygon(f, t, w, p, 0, q, D, G), a.translate(1, 1), g.push(a)), p = d.polygon(f, t, w, p, y, q, r, L)); |
||
2202 | this.bg = p; |
||
2203 | g.push(p); |
||
2204 | p.toFront(); |
||
2205 | d.setCN(c, p, "balloon-bg"); |
||
2206 | this.className && d.setCN(c, p, "balloon-bg-" + this.className); |
||
2207 | f = 1 * this.deltaSignX; |
||
2208 | m += this.sdx; |
||
2209 | k += this.sdy; |
||
2210 | C.left = m + "px"; |
||
2211 | C.top = k + "px"; |
||
2212 | g.translate(x - f, A, 1, !0); |
||
2213 | p = p.getBBox(); |
||
2214 | this.bottom = A + v + 1; |
||
2215 | this.yPos = p.y + A; |
||
2216 | J && J.translate(this.pointToX - x + f, b - A); |
||
2217 | b = this.animationDuration; |
||
2218 | 0 < this.animationDuration && !e && !isNaN(this.prevX) && (g.translate(this.prevX, this.prevY, NaN, !0), g.animate({ |
||
2219 | translate: x - f + "," + A |
||
2220 | }, b, "easeOutSine"), n && (C.left = this.prevTX + "px", C.top = this.prevTY + "px", this.xAnim = c.animate({ |
||
2221 | node: n |
||
2222 | }, "left", this.prevTX, m, b, "easeOutSine", "px"), this.yAnim = c.animate({ |
||
2223 | node: n |
||
2224 | }, "top", this.prevTY, k, b, "easeOutSine", "px"))); |
||
2225 | this.prevX = x - f; |
||
2226 | this.prevY = A; |
||
2227 | this.prevTX = m; |
||
2228 | this.prevTY = k |
||
2229 | } |
||
2230 | } |
||
2231 | }, |
||
2232 | fixPrevious: function() { |
||
2233 | this.rPrevX = this.prevX; |
||
2234 | this.rPrevY = this.prevY; |
||
2235 | this.rPrevTX = this.prevTX; |
||
2236 | this.rPrevTY = this.prevTY |
||
2237 | }, |
||
2238 | restorePrevious: function() { |
||
2239 | this.prevX = this.rPrevX; |
||
2240 | this.prevY = this.rPrevY; |
||
2241 | this.prevTX = this.rPrevTX; |
||
2242 | this.prevTY = this.rPrevTY |
||
2243 | }, |
||
2244 | followMouse: function() { |
||
2245 | if (this.follow && this.show) { |
||
2246 | var a = this.chart.mouseX - this.offsetX * this.deltaSignX - |
||
2247 | this.sdx, |
||
2248 | b = this.chart.mouseY - this.sdy; |
||
2249 | this.pointToX = a; |
||
2250 | this.pointToY = b; |
||
2251 | if (a != this.previousX || b != this.previousY) |
||
2252 | if (this.previousX = a, this.previousY = b, 0 === this.cornerRadius) this.draw(); |
||
2253 | else { |
||
2254 | var c = this.set; |
||
2255 | if (c) { |
||
2256 | var e = c.getBBox(), |
||
2257 | a = a - e.width / 2, |
||
2258 | d = b - e.height - 10; |
||
2259 | a < this.l && (a = this.l); |
||
2260 | a > this.r - e.width && (a = this.r - e.width); |
||
2261 | d < this.t && (d = b + 10); |
||
2262 | c.translate(a, d); |
||
2263 | b = this.textDiv.style; |
||
2264 | b.left = a + this.horizontalPadding + "px"; |
||
2265 | b.top = d + this.verticalPadding + "px" |
||
2266 | } |
||
2267 | } |
||
2268 | } |
||
2269 | }, |
||
2270 | changeColor: function(a) { |
||
2271 | this.balloonColor = a |
||
2272 | }, |
||
2273 | setBounds: function(a, b, c, e) { |
||
2274 | this.l = a; |
||
2275 | this.t = b; |
||
2276 | this.r = c; |
||
2277 | this.b = e; |
||
2278 | this.destroyTO && clearTimeout(this.destroyTO) |
||
2279 | }, |
||
2280 | showBalloon: function(a) { |
||
2281 | if (this.text != a || this.positionChanged) this.text = a, this.isHiding = !1, this.show = !0, this.destroyTO && clearTimeout(this.destroyTO), a = this.chart, this.fadeAnim1 && a.stopAnim(this.fadeAnim1), this.fadeAnim2 && a.stopAnim(this.fadeAnim2), this.draw(), this.positionChanged = !1 |
||
2282 | }, |
||
2283 | hide: function(a) { |
||
2284 | var b = this; |
||
2285 | b.text = void 0; |
||
2286 | isNaN(a) && (a = b.fadeOutDuration); |
||
2287 | var c = b.chart; |
||
2288 | if (0 < a && !b.isHiding) { |
||
2289 | b.isHiding = !0; |
||
2290 | b.destroyTO && clearTimeout(b.destroyTO); |
||
2291 | b.destroyTO = setTimeout(function() { |
||
2292 | b.destroy.call(b) |
||
2293 | }, 1E3 * a); |
||
2294 | b.follow = !1; |
||
2295 | b.show = !1; |
||
2296 | var e = b.set; |
||
2297 | e && (e.setAttr("opacity", b.fillAlpha), b.fadeAnim1 = e.animate({ |
||
2298 | opacity: 0 |
||
2299 | }, a, "easeInSine")); |
||
2300 | b.textDiv && (b.fadeAnim2 = c.animate({ |
||
2301 | node: b.textDiv |
||
2302 | }, "opacity", 1, 0, a, "easeInSine", "")) |
||
2303 | } else b.show = !1, b.follow = !1, b.destroy() |
||
2304 | }, |
||
2305 | setPosition: function(a, b) { |
||
2306 | if (a != this.pointToX || b != this.pointToY) this.previousX = this.pointToX, this.previousY = this.pointToY, this.pointToX = a, this.pointToY = b, this.positionChanged = !0 |
||
2307 | }, |
||
2308 | followCursor: function(a) { |
||
2309 | var b = this; |
||
2310 | b.follow = a; |
||
2311 | clearInterval(b.interval); |
||
2312 | var c = b.chart.mouseX - b.sdx, |
||
2313 | e = b.chart.mouseY - b.sdy; |
||
2314 | !isNaN(c) && a && (b.pointToX = c - b.offsetX * b.deltaSignX, b.pointToY = e, b.followMouse(), b.interval = setInterval(function() { |
||
2315 | b.followMouse.call(b) |
||
2316 | }, 40)) |
||
2317 | }, |
||
2318 | removeDiv: function() { |
||
2319 | if (this.textDiv) { |
||
2320 | var a = this.textDiv.parentNode; |
||
2321 | a && a.removeChild(this.textDiv) |
||
2322 | } |
||
2323 | }, |
||
2324 | destroy: function() { |
||
2325 | clearInterval(this.interval); |
||
2326 | d.remove(this.set); |
||
2327 | this.removeDiv(); |
||
2328 | this.set = null |
||
2329 | } |
||
2330 | }) |
||
2331 | })(); |
||
2332 | (function() { |
||
2333 | var d = window.AmCharts; |
||
2334 | d.circle = function(a, b, c, e, f, g, h, k, l) { |
||
2335 | 0 >= b && (b = .001); |
||
2336 | if (void 0 == f || 0 === f) f = .01; |
||
2337 | void 0 === g && (g = "#000000"); |
||
2338 | void 0 === h && (h = 0); |
||
2339 | e = { |
||
2340 | fill: c, |
||
2341 | stroke: g, |
||
2342 | "fill-opacity": e, |
||
2343 | "stroke-width": f, |
||
2344 | "stroke-opacity": h |
||
2345 | }; |
||
2346 | a = isNaN(l) ? a.circle(0, 0, b).attr(e) : a.ellipse(0, 0, b, l).attr(e); |
||
2347 | k && a.gradient("radialGradient", [c, d.adjustLuminosity(c, -.6)]); |
||
2348 | return a |
||
2349 | }; |
||
2350 | d.text = function(a, b, c, e, f, g, h, k) { |
||
2351 | g || (g = "middle"); |
||
2352 | "right" == g && (g = "end"); |
||
2353 | "left" == g && (g = "start"); |
||
2354 | isNaN(k) && (k = 1); |
||
2355 | void 0 !== b && (b = String(b), d.isIE && !d.isModern && (b = b.replace("&", "&"), b = b.replace("&", "&"))); |
||
2356 | c = { |
||
2357 | fill: c, |
||
2358 | "font-family": e, |
||
2359 | "font-size": f + "px", |
||
2360 | opacity: k |
||
2361 | }; |
||
2362 | !0 === h && (c["font-weight"] = "bold"); |
||
2363 | c["text-anchor"] = g; |
||
2364 | return a.text(b, c) |
||
2365 | }; |
||
2366 | d.polygon = function(a, b, c, e, f, g, h, k, l, m, n) { |
||
2367 | isNaN(g) && (g = .01); |
||
2368 | isNaN(k) && (k = f); |
||
2369 | var p = e, |
||
2370 | r = !1; |
||
2371 | "object" == typeof p && 1 < p.length && (r = !0, p = p[0]); |
||
2372 | void 0 === h && (h = p); |
||
2373 | f = { |
||
2374 | fill: p, |
||
2375 | stroke: h, |
||
2376 | "fill-opacity": f, |
||
2377 | "stroke-width": g, |
||
2378 | "stroke-opacity": k |
||
2379 | }; |
||
2380 | void 0 !== n && 0 < n && (f["stroke-dasharray"] = n); |
||
2381 | n = d.dx; |
||
2382 | g = d.dy; |
||
2383 | a.handDrawn && (c = d.makeHD(b, c, a.handDrawScatter), b = c[0], c = c[1]); |
||
2384 | h = Math.round; |
||
2385 | m && (h = Number); |
||
2386 | k = "M" + (h(b[0]) + n) + "," + (h(c[0]) + g); |
||
2387 | for (p = 1; p < b.length; p++) m && (b[p] = d.roundTo(b[p], 5), c[p] = d.roundTo(c[p], 5)), k += " L" + (h(b[p]) + n) + "," + (h(c[p]) + g); |
||
2388 | a = a.path(k + " Z").attr(f); |
||
2389 | r && a.gradient("linearGradient", e, l); |
||
2390 | return a |
||
2391 | }; |
||
2392 | d.rect = function(a, b, c, e, f, g, h, k, l, m, n) { |
||
2393 | if (isNaN(b) || isNaN(c)) return a.set(); |
||
2394 | isNaN(g) && (g = 0); |
||
2395 | void 0 === l && (l = 0); |
||
2396 | void 0 === m && (m = 270); |
||
2397 | isNaN(f) && (f = 0); |
||
2398 | var p = e, |
||
2399 | r = !1; |
||
2400 | "object" == typeof p && (p = p[0], r = !0); |
||
2401 | void 0 === h && (h = p); |
||
2402 | void 0 === k && (k = f); |
||
2403 | b = Math.round(b); |
||
2404 | c = Math.round(c); |
||
2405 | var t = 0, |
||
2406 | q = 0; |
||
2407 | 0 > b && (b = Math.abs(b), t = -b); |
||
2408 | 0 > c && (c = Math.abs(c), q = -c); |
||
2409 | t += d.dx; |
||
2410 | q += d.dy; |
||
2411 | f = { |
||
2412 | fill: p, |
||
2413 | stroke: h, |
||
2414 | "fill-opacity": f, |
||
2415 | "stroke-opacity": k |
||
2416 | }; |
||
2417 | void 0 !== n && 0 < n && (f["stroke-dasharray"] = n); |
||
2418 | a = a.rect(t, q, b, c, l, g).attr(f); |
||
2419 | r && a.gradient("linearGradient", e, m); |
||
2420 | return a |
||
2421 | }; |
||
2422 | d.bullet = function(a, b, c, e, f, g, h, k, l, m, n, p, r) { |
||
2423 | var t; |
||
2424 | "circle" == b && (b = "round"); |
||
2425 | switch (b) { |
||
2426 | case "round": |
||
2427 | t = d.circle(a, c / 2, e, f, g, h, k); |
||
2428 | break; |
||
2429 | case "square": |
||
2430 | t = d.polygon(a, [-c / 2, c / 2, c / 2, -c / 2], [c / 2, c / 2, -c / 2, -c / 2], e, f, g, h, k, m - 180, void 0, r); |
||
2431 | break; |
||
2432 | case "rectangle": |
||
2433 | t = d.polygon(a, [-c, c, c, -c], [c / 2, c / 2, -c / 2, -c / 2], e, f, g, h, k, m - 180, void 0, r); |
||
2434 | break; |
||
2435 | case "diamond": |
||
2436 | t = d.polygon(a, [-c / 2, 0, c / 2, 0], [0, -c / 2, 0, c / 2], e, f, g, h, k); |
||
2437 | break; |
||
2438 | case "triangleUp": |
||
2439 | t = d.triangle(a, c, 0, e, f, g, h, k); |
||
2440 | break; |
||
2441 | case "triangleDown": |
||
2442 | t = d.triangle(a, c, 180, e, f, g, h, k); |
||
2443 | break; |
||
2444 | case "triangleLeft": |
||
2445 | t = d.triangle(a, c, 270, e, f, g, h, k); |
||
2446 | break; |
||
2447 | case "triangleRight": |
||
2448 | t = d.triangle(a, c, 90, e, f, g, h, k); |
||
2449 | break; |
||
2450 | case "bubble": |
||
2451 | t = d.circle(a, c / 2, e, f, g, h, k, !0); |
||
2452 | break; |
||
2453 | case "line": |
||
2454 | t = d.line(a, [-c / |
||
2455 | 2, c / 2 |
||
2456 | ], [0, 0], e, f, g, h, k); |
||
2457 | break; |
||
2458 | case "yError": |
||
2459 | t = a.set(); |
||
2460 | t.push(d.line(a, [0, 0], [-c / 2, c / 2], e, f, g)); |
||
2461 | t.push(d.line(a, [-l, l], [-c / 2, -c / 2], e, f, g)); |
||
2462 | t.push(d.line(a, [-l, l], [c / 2, c / 2], e, f, g)); |
||
2463 | break; |
||
2464 | case "xError": |
||
2465 | t = a.set(), t.push(d.line(a, [-c / 2, c / 2], [0, 0], e, f, g)), t.push(d.line(a, [-c / 2, -c / 2], [-l, l], e, f, g)), t.push(d.line(a, [c / 2, c / 2], [-l, l], e, f, g)) |
||
2466 | } |
||
2467 | t && t.pattern(n, NaN, p); |
||
2468 | return t |
||
2469 | }; |
||
2470 | d.triangle = function(a, b, c, e, d, g, h, k) { |
||
2471 | if (void 0 === g || 0 === g) g = 1; |
||
2472 | void 0 === h && (h = "#000"); |
||
2473 | void 0 === k && (k = 0); |
||
2474 | e = { |
||
2475 | fill: e, |
||
2476 | stroke: h, |
||
2477 | "fill-opacity": d, |
||
2478 | "stroke-width": g, |
||
2479 | "stroke-opacity": k |
||
2480 | }; |
||
2481 | b /= 2; |
||
2482 | var l; |
||
2483 | 0 === c && (l = " M" + -b + "," + b + " L0," + -b + " L" + b + "," + b + " Z"); |
||
2484 | 180 == c && (l = " M" + -b + "," + -b + " L0," + b + " L" + b + "," + -b + " Z"); |
||
2485 | 90 == c && (l = " M" + -b + "," + -b + " L" + b + ",0 L" + -b + "," + b + " Z"); |
||
2486 | 270 == c && (l = " M" + -b + ",0 L" + b + "," + b + " L" + b + "," + -b + " Z"); |
||
2487 | return a.path(l).attr(e) |
||
2488 | }; |
||
2489 | d.line = function(a, b, c, e, f, g, h, k, l, m, n) { |
||
2490 | if (a.handDrawn && !n) return d.handDrawnLine(a, b, c, e, f, g, h, k, l, m, n); |
||
2491 | g = { |
||
2492 | fill: "none", |
||
2493 | "stroke-width": g |
||
2494 | }; |
||
2495 | void 0 !== h && 0 < h && (g["stroke-dasharray"] = h); |
||
2496 | isNaN(f) || (g["stroke-opacity"] = f); |
||
2497 | e && (g.stroke = e); |
||
2498 | e = Math.round; |
||
2499 | m && (e = Number, b[0] = d.roundTo(b[0], 5), c[0] = d.roundTo(c[0], 5)); |
||
2500 | m = d.dx; |
||
2501 | f = d.dy; |
||
2502 | h = "M" + (e(b[0]) + m) + "," + (e(c[0]) + f); |
||
2503 | for (k = 1; k < b.length; k++) b[k] = d.roundTo(b[k], 5), c[k] = d.roundTo(c[k], 5), h += " L" + (e(b[k]) + m) + "," + (e(c[k]) + f); |
||
2504 | if (d.VML) return a.path(h, void 0, !0).attr(g); |
||
2505 | l && (h += " M0,0 L0,0"); |
||
2506 | return a.path(h).attr(g) |
||
2507 | }; |
||
2508 | d.makeHD = function(a, b, c) { |
||
2509 | for (var e = [], d = [], g = 1; g < a.length; g++) |
||
2510 | for (var h = Number(a[g - 1]), k = Number(b[g - 1]), l = Number(a[g]), m = Number(b[g]), n = Math.round(Math.sqrt(Math.pow(l - |
||
2511 | h, 2) + Math.pow(m - k, 2)) / 50) + 1, l = (l - h) / n, m = (m - k) / n, p = 0; p <= n; p++) { |
||
2512 | var r = k + p * m + Math.random() * c; |
||
2513 | e.push(h + p * l + Math.random() * c); |
||
2514 | d.push(r) |
||
2515 | } |
||
2516 | return [e, d] |
||
2517 | }; |
||
2518 | d.handDrawnLine = function(a, b, c, e, f, g, h, k, l, m) { |
||
2519 | var n, p = a.set(); |
||
2520 | for (n = 1; n < b.length; n++) |
||
2521 | for (var r = [b[n - 1], b[n]], t = [c[n - 1], c[n]], t = d.makeHD(r, t, a.handDrawScatter), r = t[0], t = t[1], q = 1; q < r.length; q++) p.push(d.line(a, [r[q - 1], r[q]], [t[q - 1], t[q]], e, f, g + Math.random() * a.handDrawThickness - a.handDrawThickness / 2, h, k, l, m, !0)); |
||
2522 | return p |
||
2523 | }; |
||
2524 | d.doNothing = function(a) { |
||
2525 | return a |
||
2526 | }; |
||
2527 | d.drop = |
||
2528 | function(a, b, c, e, d, g, h, k) { |
||
2529 | var l = 1 / 180 * Math.PI, |
||
2530 | m = c - 20, |
||
2531 | n = Math.sin(m * l) * b, |
||
2532 | p = Math.cos(m * l) * b, |
||
2533 | r = Math.sin((m + 40) * l) * b, |
||
2534 | t = Math.cos((m + 40) * l) * b, |
||
2535 | q = .8 * b, |
||
2536 | y = -b / 3, |
||
2537 | B = b / 3; |
||
2538 | 0 === c && (y = -y, B = 0); |
||
2539 | 180 == c && (B = 0); |
||
2540 | 90 == c && (y = 0); |
||
2541 | 270 == c && (y = 0, B = -B); |
||
2542 | c = { |
||
2543 | fill: e, |
||
2544 | stroke: h, |
||
2545 | "stroke-width": g, |
||
2546 | "stroke-opacity": k, |
||
2547 | "fill-opacity": d |
||
2548 | }; |
||
2549 | b = "M" + n + "," + p + " A" + b + "," + b + ",0,1,1," + r + "," + t + (" A" + q + "," + q + ",0,0,0," + (Math.sin((m + 20) * l) * b + B) + "," + (Math.cos((m + 20) * l) * b + y)); |
||
2550 | b += " A" + q + "," + q + ",0,0,0," + n + "," + p; |
||
2551 | return a.path(b, void 0, void 0, "1000,1000").attr(c) |
||
2552 | }; |
||
2553 | d.wedge = function(a, b, c, e, f, g, h, k, l, m, n, p, r, t) { |
||
2554 | var q = Math.round; |
||
2555 | g = q(g); |
||
2556 | h = q(h); |
||
2557 | k = q(k); |
||
2558 | var y = q(h / g * k), |
||
2559 | B = d.VML, |
||
2560 | u = 359.5 + g / 100; |
||
2561 | 359.94 < u && (u = 359.94); |
||
2562 | f >= u && (f = u); |
||
2563 | var w = 1 / 180 * Math.PI, |
||
2564 | u = b + Math.sin(e * w) * k, |
||
2565 | v = c - Math.cos(e * w) * y, |
||
2566 | A = b + Math.sin(e * w) * g, |
||
2567 | C = c - Math.cos(e * w) * h, |
||
2568 | x = b + Math.sin((e + f) * w) * g, |
||
2569 | z = c - Math.cos((e + f) * w) * h, |
||
2570 | F = b + Math.sin((e + f) * w) * k, |
||
2571 | w = c - Math.cos((e + f) * w) * y, |
||
2572 | E = { |
||
2573 | fill: d.adjustLuminosity(m.fill, -.2), |
||
2574 | "stroke-opacity": 0, |
||
2575 | "fill-opacity": m["fill-opacity"] |
||
2576 | }, |
||
2577 | H = 0; |
||
2578 | 180 < Math.abs(f) && (H = 1); |
||
2579 | e = a.set(); |
||
2580 | var G; |
||
2581 | B && (u = q(10 * u), A = q(10 * A), x = q(10 * x), F = q(10 * F), v = q(10 * v), C = q(10 * C), z = q(10 * z), w = q(10 * w), b = q(10 * b), l = q(10 * l), c = q(10 * c), g *= 10, h *= 10, k *= 10, y *= 10, 1 > Math.abs(f) && 1 >= Math.abs(x - A) && 1 >= Math.abs(z - C) && (G = !0)); |
||
2582 | f = ""; |
||
2583 | var D; |
||
2584 | p && (E["fill-opacity"] = 0, E["stroke-opacity"] = m["stroke-opacity"] / 2, E.stroke = m.stroke); |
||
2585 | if (0 < l) { |
||
2586 | D = " M" + u + "," + (v + l) + " L" + A + "," + (C + l); |
||
2587 | B ? (G || (D += " A" + (b - g) + "," + (l + c - h) + "," + (b + g) + "," + (l + c + h) + "," + A + "," + (C + l) + "," + x + "," + (z + l)), D += " L" + F + "," + (w + l), 0 < k && (G || (D += " B" + (b - k) + "," + (l + c - y) + "," + (b + k) + "," + (l + c + y) + "," + F + "," + (l + w) + "," + u + "," + (l + v)))) : (D += " A" + g + "," + h + ",0," + H + ",1," + x + "," + (z + l) + " L" + F + "," + (w + l), 0 < k && (D += " A" + k + "," + y + ",0," + H + ",0," + u + "," + (v + l))); |
||
2588 | D += " Z"; |
||
2589 | var K = l; |
||
2590 | B && (K /= 10); |
||
2591 | for (var J = 0; J < K; J += 10) { |
||
2592 | var L = a.path(D, void 0, void 0, "1000,1000").attr(E); |
||
2593 | e.push(L); |
||
2594 | L.translate(0, -J) |
||
2595 | } |
||
2596 | D = a.path(" M" + u + "," + v + " L" + u + "," + (v + l) + " L" + A + "," + (C + l) + " L" + A + "," + C + " L" + u + "," + v + " Z", void 0, void 0, "1000,1000").attr(E); |
||
2597 | l = a.path(" M" + x + "," + z + " L" + x + "," + (z + l) + " L" + F + "," + (w + l) + " L" + F + "," + w + " L" + x + "," + z + " Z", void 0, void 0, "1000,1000").attr(E); |
||
2598 | e.push(D); |
||
2599 | e.push(l) |
||
2600 | } |
||
2601 | B ? (G || (f = " A" + q(b - g) + "," + q(c - h) + "," + q(b + g) + "," + q(c + h) + "," + q(A) + "," + q(C) + "," + q(x) + "," + q(z)), h = " M" + q(u) + "," + q(v) + " L" + q(A) + "," + q(C) + f + " L" + q(F) + "," + q(w)) : h = " M" + u + "," + v + " L" + A + "," + C + (" A" + g + "," + h + ",0," + H + ",1," + x + "," + z) + " L" + F + "," + w; |
||
2602 | 0 < k && (B ? G || (h += " B" + (b - k) + "," + (c - y) + "," + (b + k) + "," + (c + y) + "," + F + "," + w + "," + u + "," + v) : h += " A" + k + "," + y + ",0," + H + ",0," + u + "," + v); |
||
2603 | a.handDrawn && (k = d.line(a, [u, A], [v, C], m.stroke, m.thickness * Math.random() * a.handDrawThickness, m["stroke-opacity"]), e.push(k)); |
||
2604 | a = a.path(h + " Z", void 0, void 0, "1000,1000").attr(m); |
||
2605 | if (n) { |
||
2606 | k = []; |
||
2607 | for (y = 0; y < n.length; y++) k.push(d.adjustLuminosity(m.fill, n[y])); |
||
2608 | "radial" != t || d.isModern || (k = []); |
||
2609 | 0 < k.length && a.gradient(t + "Gradient", k) |
||
2610 | } |
||
2611 | d.isModern && "radial" == t && a.grad && (a.grad.setAttribute("gradientUnits", "userSpaceOnUse"), a.grad.setAttribute("r", g), a.grad.setAttribute("cx", b), a.grad.setAttribute("cy", c)); |
||
2612 | a.pattern(p, NaN, r); |
||
2613 | e.wedge = a; |
||
2614 | e.push(a); |
||
2615 | return e |
||
2616 | }; |
||
2617 | d.rgb2hex = function(a) { |
||
2618 | return (a = a.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i)) && 4 === a.length ? "#" + ("0" + parseInt(a[1], 10).toString(16)).slice(-2) + ("0" + parseInt(a[2], 10).toString(16)).slice(-2) + ("0" + parseInt(a[3], 10).toString(16)).slice(-2) : "" |
||
2619 | }; |
||
2620 | d.adjustLuminosity = function(a, b) { |
||
2621 | a && -1 != a.indexOf("rgb") && (a = d.rgb2hex(a)); |
||
2622 | a = String(a).replace(/[^0-9a-f]/gi, ""); |
||
2623 | 6 > a.length && (a = String(a[0]) + String(a[0]) + String(a[1]) + String(a[1]) + String(a[2]) + String(a[2])); |
||
2624 | b = b || 0; |
||
2625 | var c = "#", |
||
2626 | e, f; |
||
2627 | for (f = 0; 3 > f; f++) e = parseInt(a.substr(2 * f, 2), 16), e = Math.round(Math.min(Math.max(0, e + e * b), 255)).toString(16), c += ("00" + |
||
2628 | e).substr(e.length); |
||
2629 | return c |
||
2630 | } |
||
2631 | })(); |
||
2632 | (function() { |
||
2633 | var d = window.AmCharts; |
||
2634 | d.AmLegend = d.Class({ |
||
2635 | construct: function(a) { |
||
2636 | this.enabled = !0; |
||
2637 | this.cname = "AmLegend"; |
||
2638 | this.createEvents("rollOverMarker", "rollOverItem", "rollOutMarker", "rollOutItem", "showItem", "hideItem", "clickMarker", "clickLabel"); |
||
2639 | this.position = "bottom"; |
||
2640 | this.borderColor = this.color = "#000000"; |
||
2641 | this.borderAlpha = 0; |
||
2642 | this.markerLabelGap = 5; |
||
2643 | this.verticalGap = 10; |
||
2644 | this.align = "left"; |
||
2645 | this.horizontalGap = 0; |
||
2646 | this.spacing = 10; |
||
2647 | this.markerDisabledColor = "#AAB3B3"; |
||
2648 | this.markerType = "square"; |
||
2649 | this.markerSize = 16; |
||
2650 | this.markerBorderThickness = this.markerBorderAlpha = 1; |
||
2651 | this.marginBottom = this.marginTop = 0; |
||
2652 | this.marginLeft = this.marginRight = 20; |
||
2653 | this.autoMargins = !0; |
||
2654 | this.valueWidth = 50; |
||
2655 | this.switchable = !0; |
||
2656 | this.switchType = "x"; |
||
2657 | this.switchColor = "#FFFFFF"; |
||
2658 | this.rollOverColor = "#CC0000"; |
||
2659 | this.reversedOrder = !1; |
||
2660 | this.labelText = "[[title]]"; |
||
2661 | this.valueText = "[[value]]"; |
||
2662 | this.accessibleLabel = "[[title]]"; |
||
2663 | this.useMarkerColorForLabels = !1; |
||
2664 | this.rollOverGraphAlpha = 1; |
||
2665 | this.textClickEnabled = !1; |
||
2666 | this.equalWidths = !0; |
||
2667 | this.backgroundColor = "#FFFFFF"; |
||
2668 | this.backgroundAlpha = 0; |
||
2669 | this.useGraphSettings = !1; |
||
2670 | this.showEntries = !0; |
||
2671 | this.labelDx = 0; |
||
2672 | d.applyTheme(this, a, this.cname) |
||
2673 | }, |
||
2674 | setData: function(a) { |
||
2675 | this.legendData = a; |
||
2676 | this.invalidateSize() |
||
2677 | }, |
||
2678 | invalidateSize: function() { |
||
2679 | this.destroy(); |
||
2680 | this.entries = []; |
||
2681 | this.valueLabels = []; |
||
2682 | var a = this.legendData; |
||
2683 | this.enabled && (d.ifArray(a) || d.ifArray(this.data)) && this.drawLegend() |
||
2684 | }, |
||
2685 | drawLegend: function() { |
||
2686 | var a = this.chart, |
||
2687 | b = this.position, |
||
2688 | c = this.width, |
||
2689 | e = a.divRealWidth, |
||
2690 | f = a.divRealHeight, |
||
2691 | g = this.div, |
||
2692 | h = this.legendData; |
||
2693 | this.data && (h = this.combineLegend ? this.legendData.concat(this.data) : this.data); |
||
2694 | isNaN(this.fontSize) && (this.fontSize = a.fontSize); |
||
2695 | this.maxColumnsReal = this.maxColumns; |
||
2696 | if ("right" == b || "left" == b) this.maxColumnsReal = 1, this.autoMargins && (this.marginLeft = this.marginRight = 10); |
||
2697 | else if (this.autoMargins) { |
||
2698 | this.marginRight = a.marginRight; |
||
2699 | this.marginLeft = a.marginLeft; |
||
2700 | var k = a.autoMarginOffset; |
||
2701 | "bottom" == b ? (this.marginBottom = k, this.marginTop = 0) : (this.marginTop = k, this.marginBottom = 0) |
||
2702 | } |
||
2703 | c = void 0 !== c ? d.toCoordinate(c, e) : "right" != b && "left" != b ? a.realWidth : 0 < this.ieW ? this.ieW : a.realWidth; |
||
2704 | "outside" == b ? (c = g.offsetWidth, f = g.offsetHeight, g.clientHeight && (c = g.clientWidth, f = g.clientHeight)) : (isNaN(c) || (g.style.width = c + "px"), g.className = "amChartsLegend " + a.classNamePrefix + "-legend-div"); |
||
2705 | this.divWidth = c; |
||
2706 | (b = this.container) ? (b.container.innerHTML = "", g.appendChild(b.container), b.width = c, b.height = f, b.setSize(c, f), b.addDefs(a)) : b = new d.AmDraw(g, c, f, a); |
||
2707 | this.container = b; |
||
2708 | this.lx = 0; |
||
2709 | this.ly = 8; |
||
2710 | f = this.markerSize; |
||
2711 | f > this.fontSize && (this.ly = f / 2 - 1); |
||
2712 | 0 < f && (this.lx += f + this.markerLabelGap); |
||
2713 | this.titleWidth = 0; |
||
2714 | if (f = this.title) f = d.text(this.container, f, this.color, a.fontFamily, this.fontSize, "start", !0), d.setCN(a, f, "legend-title"), f.translate(this.marginLeft, this.marginTop + this.verticalGap + this.ly + 1), a = f.getBBox(), this.titleWidth = a.width + 15, this.titleHeight = a.height + 6; |
||
2715 | this.index = this.maxLabelWidth = 0; |
||
2716 | if (this.showEntries) { |
||
2717 | for (a = 0; a < h.length; a++) this.createEntry(h[a]); |
||
2718 | for (a = this.index = 0; a < h.length; a++) this.createValue(h[a]) |
||
2719 | } |
||
2720 | this.arrangeEntries(); |
||
2721 | this.updateValues() |
||
2722 | }, |
||
2723 | arrangeEntries: function() { |
||
2724 | var a = this.position, |
||
2725 | b = this.marginLeft + |
||
2726 | this.titleWidth, |
||
2727 | c = this.marginRight, |
||
2728 | e = this.marginTop, |
||
2729 | f = this.marginBottom, |
||
2730 | g = this.horizontalGap, |
||
2731 | h = this.div, |
||
2732 | k = this.divWidth, |
||
2733 | l = this.maxColumnsReal, |
||
2734 | m = this.verticalGap, |
||
2735 | n = this.spacing, |
||
2736 | p = k - c - b, |
||
2737 | r = 0, |
||
2738 | t = 0, |
||
2739 | q = this.container; |
||
2740 | this.set && this.set.remove(); |
||
2741 | var y = q.set(); |
||
2742 | this.set = y; |
||
2743 | var B = q.set(); |
||
2744 | y.push(B); |
||
2745 | var u = this.entries, |
||
2746 | w, v; |
||
2747 | for (v = 0; v < u.length; v++) { |
||
2748 | w = u[v].getBBox(); |
||
2749 | var A = w.width; |
||
2750 | A > r && (r = A); |
||
2751 | w = w.height; |
||
2752 | w > t && (t = w) |
||
2753 | } |
||
2754 | var A = t = 0, |
||
2755 | C = g, |
||
2756 | x = 0, |
||
2757 | z = 0; |
||
2758 | for (v = 0; v < u.length; v++) { |
||
2759 | var F = u[v]; |
||
2760 | this.reversedOrder && (F = u[u.length - v - 1]); |
||
2761 | w = F.getBBox(); |
||
2762 | var E; |
||
2763 | this.equalWidths ? E = A * (r + n + this.markerLabelGap) : (E = C, C = C + w.width + g + n); |
||
2764 | E + w.width > p && 0 < v && 0 !== A && (t++, E = A = 0, C = E + w.width + g + n, x = x + z + m, z = 0); |
||
2765 | w.height > z && (z = w.height); |
||
2766 | F.translate(E, x); |
||
2767 | A++; |
||
2768 | !isNaN(l) && A >= l && (A = 0, t++, x = x + z + m, C = g, z = 0); |
||
2769 | B.push(F) |
||
2770 | } |
||
2771 | w = B.getBBox(); |
||
2772 | l = w.height + 2 * m - 1; |
||
2773 | "left" == a || "right" == a ? (n = w.width + 2 * g, k = n + b + c, h.style.width = k + "px", this.ieW = k) : n = k - b - c - 1; |
||
2774 | c = d.polygon(this.container, [0, n, n, 0], [0, 0, l, l], this.backgroundColor, this.backgroundAlpha, 1, this.borderColor, this.borderAlpha); |
||
2775 | d.setCN(this.chart, c, "legend-bg"); |
||
2776 | y.push(c); |
||
2777 | y.translate(b, e); |
||
2778 | c.toBack(); |
||
2779 | b = g; |
||
2780 | if ("top" == a || "bottom" == a || "absolute" == a || "outside" == a) "center" == this.align ? b = g + (n - w.width) / 2 : "right" == this.align && (b = g + n - w.width); |
||
2781 | B.translate(b, m + 1); |
||
2782 | this.titleHeight > l && (l = this.titleHeight); |
||
2783 | e = l + e + f + 1; |
||
2784 | 0 > e && (e = 0); |
||
2785 | "absolute" != a && "outside" != a && e > this.chart.divRealHeight && (h.style.top = "0px"); |
||
2786 | h.style.height = Math.round(e) + "px"; |
||
2787 | q.setSize(this.divWidth, e) |
||
2788 | }, |
||
2789 | createEntry: function(a) { |
||
2790 | if (!1 !== a.visibleInLegend && !a.hideFromLegend) { |
||
2791 | var b = this, |
||
2792 | c = b.chart, |
||
2793 | e = b.useGraphSettings, |
||
2794 | f = a.markerType; |
||
2795 | f && (e = !1); |
||
2796 | a.legendEntryWidth = b.markerSize; |
||
2797 | f || (f = b.markerType); |
||
2798 | var g = a.color, |
||
2799 | h = a.alpha; |
||
2800 | a.legendKeyColor && (g = a.legendKeyColor()); |
||
2801 | a.legendKeyAlpha && (h = a.legendKeyAlpha()); |
||
2802 | var k; |
||
2803 | !0 === a.hidden && (k = g = b.markerDisabledColor); |
||
2804 | var l = a.pattern, |
||
2805 | m, n = a.customMarker; |
||
2806 | n || (n = b.customMarker); |
||
2807 | var p = b.container, |
||
2808 | r = b.markerSize, |
||
2809 | t = 0, |
||
2810 | q = 0, |
||
2811 | y = r / 2; |
||
2812 | if (e) { |
||
2813 | e = a.type; |
||
2814 | b.switchType = void 0; |
||
2815 | if ("line" == e || "step" == e || "smoothedLine" == e || "ohlc" == e) m = p.set(), a.hidden || (g = a.lineColorR, k = a.bulletBorderColorR), t = d.line(p, [0, 2 * r], [r / 2, r / 2], g, a.lineAlpha, a.lineThickness, a.dashLength), d.setCN(c, t, "graph-stroke"), m.push(t), a.bullet && (a.hidden || (g = a.bulletColorR), t = d.bullet(p, a.bullet, a.bulletSize, g, a.bulletAlpha, a.bulletBorderThickness, k, a.bulletBorderAlpha)) && (d.setCN(c, t, "graph-bullet"), t.translate(r + 1, r / 2), m.push(t)), y = 0, t = r, q = r / 3; |
||
2816 | else { |
||
2817 | a.getGradRotation && (m = a.getGradRotation(), 0 === m && (m = 180)); |
||
2818 | t = a.fillColorsR; |
||
2819 | !0 === a.hidden && (t = g); |
||
2820 | if (m = b.createMarker("rectangle", t, a.fillAlphas, a.lineThickness, g, a.lineAlpha, m, l, a.dashLength)) y = r, m.translate(y, r / 2); |
||
2821 | t = r |
||
2822 | } |
||
2823 | d.setCN(c, m, "graph-" + e); |
||
2824 | d.setCN(c, m, "graph-" + a.id) |
||
2825 | } else if (n) m = p.image(n, 0, 0, r, r); |
||
2826 | else { |
||
2827 | var B; |
||
2828 | isNaN(b.gradientRotation) || (B = 180 + b.gradientRotation); |
||
2829 | (m = b.createMarker(f, g, h, void 0, void 0, void 0, B, l)) && m.translate(r / 2, r / 2) |
||
2830 | } |
||
2831 | d.setCN(c, m, "legend-marker"); |
||
2832 | b.addListeners(m, a); |
||
2833 | p = p.set([m]); |
||
2834 | b.switchable && a.switchable && p.setAttr("cursor", "pointer"); |
||
2835 | void 0 !== a.id && d.setCN(c, p, "legend-item-" + a.id); |
||
2836 | d.setCN(c, p, a.className, !0); |
||
2837 | k = b.switchType; |
||
2838 | var u; |
||
2839 | k && "none" != k && 0 < r && ("x" == k ? (u = b.createX(), u.translate(r / 2, r / 2)) : u = b.createV(), u.dItem = a, !0 !== a.hidden ? "x" == k ? u.hide() : u.show() : "x" != k && u.hide(), b.switchable || u.hide(), b.addListeners(u, a), a.legendSwitch = u, p.push(u), d.setCN(c, u, "legend-switch")); |
||
2840 | k = b.color; |
||
2841 | a.showBalloon && b.textClickEnabled && void 0 !== b.selectedColor && (k = b.selectedColor); |
||
2842 | b.useMarkerColorForLabels && !l && (k = g); |
||
2843 | !0 === a.hidden && (k = b.markerDisabledColor); |
||
2844 | g = d.massReplace(b.labelText, { |
||
2845 | "[[title]]": a.title |
||
2846 | }); |
||
2847 | void 0 !== b.tabIndex && (p.setAttr("tabindex", b.tabIndex), p.setAttr("role", "menuitem"), p.keyup(function(c) { |
||
2848 | 13 == c.keyCode && b.clickMarker(a, c) |
||
2849 | })); |
||
2850 | c.accessible && b.accessibleLabel && (l = d.massReplace(b.accessibleLabel, { |
||
2851 | "[[title]]": a.title |
||
2852 | }), c.makeAccessible(p, l)); |
||
2853 | l = b.fontSize; |
||
2854 | m && (r <= l && (r = r / 2 + b.ly - l / 2 + (l + 2 - r) / 2 - q, m.translate(y, r), u && u.translate(u.x, r)), a.legendEntryWidth = m.getBBox().width); |
||
2855 | var w; |
||
2856 | g && (g = d.fixBrakes(g), a.legendTextReal = g, w = b.labelWidth, w = isNaN(w) ? d.text(b.container, g, k, c.fontFamily, l, "start") : d.wrappedText(b.container, g, k, c.fontFamily, l, "start", !1, w, 0), d.setCN(c, w, "legend-label"), |
||
2857 | w.translate(b.lx + t, b.ly), p.push(w), b.labelDx = t, c = w.getBBox().width, b.maxLabelWidth < c && (b.maxLabelWidth = c)); |
||
2858 | b.entries[b.index] = p; |
||
2859 | a.legendEntry = b.entries[b.index]; |
||
2860 | a.legendMarker = m; |
||
2861 | a.legendLabel = w; |
||
2862 | b.index++ |
||
2863 | } |
||
2864 | }, |
||
2865 | addListeners: function(a, b) { |
||
2866 | var c = this; |
||
2867 | a && a.mouseover(function(a) { |
||
2868 | c.rollOverMarker(b, a) |
||
2869 | }).mouseout(function(a) { |
||
2870 | c.rollOutMarker(b, a) |
||
2871 | }).click(function(a) { |
||
2872 | c.clickMarker(b, a) |
||
2873 | }) |
||
2874 | }, |
||
2875 | rollOverMarker: function(a, b) { |
||
2876 | this.switchable && this.dispatch("rollOverMarker", a, b); |
||
2877 | this.dispatch("rollOverItem", a, b) |
||
2878 | }, |
||
2879 | rollOutMarker: function(a, b) { |
||
2880 | this.switchable && this.dispatch("rollOutMarker", a, b); |
||
2881 | this.dispatch("rollOutItem", a, b) |
||
2882 | }, |
||
2883 | clickMarker: function(a, b) { |
||
2884 | this.switchable && (!0 === a.hidden ? this.dispatch("showItem", a, b) : this.dispatch("hideItem", a, b)); |
||
2885 | this.dispatch("clickMarker", a, b) |
||
2886 | }, |
||
2887 | rollOverLabel: function(a, b) { |
||
2888 | a.hidden || this.textClickEnabled && a.legendLabel && a.legendLabel.attr({ |
||
2889 | fill: this.rollOverColor |
||
2890 | }); |
||
2891 | this.dispatch("rollOverItem", a, b) |
||
2892 | }, |
||
2893 | rollOutLabel: function(a, b) { |
||
2894 | if (!a.hidden && this.textClickEnabled && a.legendLabel) { |
||
2895 | var c = this.color; |
||
2896 | void 0 !== this.selectedColor && a.showBalloon && (c = this.selectedColor); |
||
2897 | this.useMarkerColorForLabels && (c = a.lineColor, void 0 === c && (c = a.color)); |
||
2898 | a.legendLabel.attr({ |
||
2899 | fill: c |
||
2900 | }) |
||
2901 | } |
||
2902 | this.dispatch("rollOutItem", a, b) |
||
2903 | }, |
||
2904 | clickLabel: function(a, b) { |
||
2905 | this.textClickEnabled ? a.hidden || this.dispatch("clickLabel", a, b) : this.switchable && (!0 === a.hidden ? this.dispatch("showItem", a, b) : this.dispatch("hideItem", a, b)) |
||
2906 | }, |
||
2907 | dispatch: function(a, b, c) { |
||
2908 | a = { |
||
2909 | type: a, |
||
2910 | dataItem: b, |
||
2911 | target: this, |
||
2912 | event: c, |
||
2913 | chart: this.chart |
||
2914 | }; |
||
2915 | this.chart && this.chart.handleLegendEvent(a); |
||
2916 | this.fire(a) |
||
2917 | }, |
||
2918 | createValue: function(a) { |
||
2919 | var b = this, |
||
2920 | c = b.fontSize, |
||
2921 | e = b.chart; |
||
2922 | if (!1 !== a.visibleInLegend && !a.hideFromLegend) { |
||
2923 | var f = b.maxLabelWidth; |
||
2924 | b.forceWidth && (f = b.labelWidth); |
||
2925 | b.equalWidths || (b.valueAlign = "left"); |
||
2926 | "left" == b.valueAlign && a.legendLabel && (f = a.legendLabel.getBBox().width); |
||
2927 | var g = f; |
||
2928 | if (b.valueText && 0 < b.valueWidth) { |
||
2929 | var h = b.color; |
||
2930 | b.useMarkerColorForValues && (h = a.color, a.legendKeyColor && (h = a.legendKeyColor())); |
||
2931 | !0 === a.hidden && (h = b.markerDisabledColor); |
||
2932 | var k = b.valueText, |
||
2933 | f = f + b.lx + b.labelDx + b.markerLabelGap + |
||
2934 | b.valueWidth, |
||
2935 | l = "end"; |
||
2936 | "left" == b.valueAlign && (f -= b.valueWidth, l = "start"); |
||
2937 | h = d.text(b.container, k, h, b.chart.fontFamily, c, l); |
||
2938 | d.setCN(e, h, "legend-value"); |
||
2939 | h.translate(f, b.ly); |
||
2940 | b.entries[b.index].push(h); |
||
2941 | g += b.valueWidth + 2 * b.markerLabelGap; |
||
2942 | h.dItem = a; |
||
2943 | b.valueLabels.push(h) |
||
2944 | } |
||
2945 | b.index++; |
||
2946 | e = b.markerSize; |
||
2947 | e < c + 7 && (e = c + 7, d.VML && (e += 3)); |
||
2948 | c = b.container.rect(a.legendEntryWidth, 0, g, e, 0, 0).attr({ |
||
2949 | stroke: "none", |
||
2950 | fill: "#fff", |
||
2951 | "fill-opacity": .005 |
||
2952 | }); |
||
2953 | c.dItem = a; |
||
2954 | b.entries[b.index - 1].push(c); |
||
2955 | c.mouseover(function(c) { |
||
2956 | b.rollOverLabel(a, c) |
||
2957 | }).mouseout(function(c) { |
||
2958 | b.rollOutLabel(a, c) |
||
2959 | }).click(function(c) { |
||
2960 | b.clickLabel(a, c) |
||
2961 | }) |
||
2962 | } |
||
2963 | }, |
||
2964 | createV: function() { |
||
2965 | var a = this.markerSize; |
||
2966 | return d.polygon(this.container, [a / 5, a / 2, a - a / 5, a / 2], [a / 3, a - a / 5, a / 5, a / 1.7], this.switchColor) |
||
2967 | }, |
||
2968 | createX: function() { |
||
2969 | var a = (this.markerSize - 4) / 2, |
||
2970 | b = { |
||
2971 | stroke: this.switchColor, |
||
2972 | "stroke-width": 3 |
||
2973 | }, |
||
2974 | c = this.container, |
||
2975 | e = d.line(c, [-a, a], [-a, a]).attr(b), |
||
2976 | a = d.line(c, [-a, a], [a, -a]).attr(b); |
||
2977 | return this.container.set([e, a]) |
||
2978 | }, |
||
2979 | createMarker: function(a, b, c, e, f, g, h, k, l) { |
||
2980 | var m = this.markerSize, |
||
2981 | n = this.container; |
||
2982 | f || (f = this.markerBorderColor); |
||
2983 | f || |
||
2984 | (f = b); |
||
2985 | isNaN(e) && (e = this.markerBorderThickness); |
||
2986 | isNaN(g) && (g = this.markerBorderAlpha); |
||
2987 | return d.bullet(n, a, m, b, c, e, f, g, m, h, k, this.chart.path, l) |
||
2988 | }, |
||
2989 | validateNow: function() { |
||
2990 | this.invalidateSize() |
||
2991 | }, |
||
2992 | updateValues: function() { |
||
2993 | var a = this.valueLabels, |
||
2994 | b = this.chart, |
||
2995 | c, e = this.data; |
||
2996 | if (a) |
||
2997 | for (c = 0; c < a.length; c++) { |
||
2998 | var f = a[c], |
||
2999 | g = f.dItem; |
||
3000 | g.periodDataItem = void 0; |
||
3001 | g.periodPercentDataItem = void 0; |
||
3002 | var h = " "; |
||
3003 | if (e) g.value ? f.text(g.value) : f.text(""); |
||
3004 | else { |
||
3005 | var k = null; |
||
3006 | if (void 0 !== g.type) { |
||
3007 | var k = g.currentDataItem, |
||
3008 | l = this.periodValueText; |
||
3009 | g.legendPeriodValueText && (l = g.legendPeriodValueText); |
||
3010 | g.legendPeriodValueTextR && (l = g.legendPeriodValueTextR); |
||
3011 | k ? (h = this.valueText, g.legendValueText && (h = g.legendValueText), g.legendValueTextR && (h = g.legendValueTextR), h = b.formatString(h, k)) : l && b.formatPeriodString && (l = d.massReplace(l, { |
||
3012 | "[[title]]": g.title |
||
3013 | }), h = b.formatPeriodString(l, g)) |
||
3014 | } else h = b.formatString(this.valueText, g); |
||
3015 | l = g; |
||
3016 | k && (l = k); |
||
3017 | var m = this.valueFunction; |
||
3018 | m && (h = m(l, h, b.periodDataItem)); |
||
3019 | var n; |
||
3020 | this.useMarkerColorForLabels && !k && g.lastDataItem && (k = g.lastDataItem); |
||
3021 | k ? n = b.getBalloonColor(g, k) : g.legendKeyColor && (n = g.legendKeyColor()); |
||
3022 | g.legendColorFunction && (n = g.legendColorFunction(l, h, g.periodDataItem, g.periodPercentDataItem)); |
||
3023 | f.text(h); |
||
3024 | if (!g.pattern && (this.useMarkerColorForValues && f.setAttr("fill", n), this.useMarkerColorForLabels)) { |
||
3025 | if (f = g.legendMarker) f.setAttr("fill", n), f.setAttr("stroke", n); |
||
3026 | (f = g.legendLabel) && (g.hidden ? f.setAttr("fill", this.markerDisabledColor) : f.setAttr("fill", n)) |
||
3027 | } |
||
3028 | } |
||
3029 | } |
||
3030 | }, |
||
3031 | renderFix: function() { |
||
3032 | if (!d.VML && this.enabled) { |
||
3033 | var a = this.container; |
||
3034 | a && a.renderFix() |
||
3035 | } |
||
3036 | }, |
||
3037 | destroy: function() { |
||
3038 | this.div.innerHTML = ""; |
||
3039 | d.remove(this.set) |
||
3040 | } |
||
3041 | }) |
||
3042 | })(); |
||
3043 | (function() { |
||
3044 | var d = window.AmCharts; |
||
3045 | d.AmMap = d.Class({ |
||
3046 | inherits: d.AmChart, |
||
3047 | construct: function(a) { |
||
3048 | this.cname = "AmMap"; |
||
3049 | this.type = "map"; |
||
3050 | this.theme = a; |
||
3051 | this.svgNotSupported = "This browser doesn't support SVG. Use Chrome, Firefox, Internet Explorer 9 or later."; |
||
3052 | this.createEvents("rollOverMapObject", "rollOutMapObject", "clickMapObject", "mouseDownMapObject", "selectedObjectChanged", "homeButtonClicked", "zoomCompleted", "dragCompleted", "positionChanged", "writeDevInfo", "click", "descriptionClosed"); |
||
3053 | this.zoomDuration = .6; |
||
3054 | this.zoomControl = new d.ZoomControl(a); |
||
3055 | this.fitMapToContainer = !0; |
||
3056 | this.mouseWheelZoomEnabled = this.backgroundZoomsToTop = !1; |
||
3057 | this.allowClickOnSelectedObject = this.useHandCursorOnClickableOjects = this.showBalloonOnSelectedObject = !0; |
||
3058 | this.showObjectsAfterZoom = this.wheelBusy = !1; |
||
3059 | this.zoomOnDoubleClick = this.useObjectColorForBalloon = !0; |
||
3060 | this.allowMultipleDescriptionWindows = !1; |
||
3061 | // this.dragMap = this.centerMap = this.linesAboveImages = !0; |
||
3062 | this.colorSteps = 5; |
||
3063 | this.forceNormalize = !1; |
||
3064 | this.showAreasInList = !0; |
||
3065 | this.showLinesInList = this.showImagesInList = !1; |
||
3066 | this.areasProcessor = new d.AreasProcessor(this); |
||
3067 | this.areasSettings = new d.AreasSettings(a); |
||
3068 | this.imagesProcessor = new d.ImagesProcessor(this); |
||
3069 | this.imagesSettings = new d.ImagesSettings(a); |
||
3070 | this.linesProcessor = new d.LinesProcessor(this); |
||
3071 | this.linesSettings = new d.LinesSettings(a); |
||
3072 | this.initialTouchZoom = 1; |
||
3073 | this.showDescriptionOnHover = !1; |
||
3074 | d.AmMap.base.construct.call(this, a); |
||
3075 | this.creditsPosition = "bottom-left"; |
||
3076 | this.product = "ammap"; |
||
3077 | this.areasClasses = {}; |
||
3078 | this.updatableImages = []; |
||
3079 | d.applyTheme(this, a, this.cname) |
||
3080 | }, |
||
3081 | initChart: function() { |
||
3082 | this.zoomInstantly = !0; |
||
3083 | var a = this.container; |
||
3084 | this.panRequired = !0; |
||
3085 | if (this.sizeChanged && d.hasSVG && this.chartCreated) { |
||
3086 | this.updatableImages = []; |
||
3087 | this.freeLabelsSet && this.freeLabelsSet.remove(); |
||
3088 | this.freeLabelsSet = a.set(); |
||
3089 | this.container.setSize(this.realWidth, this.realHeight); |
||
3090 | this.resizeMap(); |
||
3091 | this.drawBackground(); |
||
3092 | this.redrawLabels(); |
||
3093 | this.drawTitles(); |
||
3094 | this.processObjects(!0); |
||
3095 | this.rescaleObjects(); |
||
3096 | this.zoomControl.init(this, a); |
||
3097 | this.drawBg(); |
||
3098 | var b = this.smallMap; |
||
3099 | b && b.init(this, a); |
||
3100 | (b = this.valueLegend) && b.init(this, a); |
||
3101 | this.sizeChanged = !1; |
||
3102 | this.zoomToLongLat(this.zLevelTemp, this.zLongTemp, this.zLatTemp, !0); |
||
3103 | this.previousWidth = this.realWidth; |
||
3104 | this.previousHeight = this.realHeight; |
||
3105 | this.updateSmallMap(); |
||
3106 | this.linkSet.toFront(); |
||
3107 | this.zoomControl.update && this.zoomControl.update() |
||
3108 | } else(d.AmMap.base.initChart.call(this), d.hasSVG) ? (this.dataChanged && (this.parseData(), this.dispatchDataUpdated = !0, this.dataChanged = !1, a = this.legend) && (a.position = "absolute", a.invalidateSize()), this.createDescriptionsDiv(), this.svgAreas = [], this.svgAreasById = {}, this.drawChart()) : (this.chartDiv.style.textAlign = "", this.chartDiv.setAttribute("class", "ammapAlert"), this.chartDiv.innerHTML = this.svgNotSupported, this.fire({ |
||
3109 | type: "failed", |
||
3110 | chart: this |
||
3111 | })) |
||
3112 | }, |
||
3113 | storeTemp: function() { |
||
3114 | if (d.hasSVG && 0 < this.realWidth && 0 < this.realHeight) { |
||
3115 | var a = this.mapContainer.getBBox(); |
||
3116 | 0 < a.width && 0 < a.height && (a = this.zoomLongitude(), isNaN(a) || (this.zLongTemp = a), a = this.zoomLatitude(), isNaN(a) || (this.zLatTemp = a), a = this.zoomLevel(), isNaN(a) || (this.zLevelTemp = a)) |
||
3117 | } |
||
3118 | }, |
||
3119 | invalidateSize: function() { |
||
3120 | this.storeTemp(); |
||
3121 | d.AmMap.base.invalidateSize.call(this) |
||
3122 | }, |
||
3123 | validateSize: function() { |
||
3124 | this.storeTemp(); |
||
3125 | d.AmMap.base.validateSize.call(this) |
||
3126 | }, |
||
3127 | handleWheelReal: function(a) { |
||
3128 | if (!this.wheelBusy) { |
||
3129 | this.stopAnimation(); |
||
3130 | var b = this.zoomLevel(), |
||
3131 | c = this.zoomControl, |
||
3132 | e = c.zoomFactor; |
||
3133 | this.wheelBusy = !0; |
||
3134 | a = d.fitToBounds(0 < a ? b * e : b / e, c.minZoomLevel, c.maxZoomLevel); |
||
3135 | e = this.mouseX / this.mapWidth; |
||
3136 | c = this.mouseY / this.mapHeight; |
||
3137 | e = (this.zoomX() - e) * (a / b) + e; |
||
3138 | b = (this.zoomY() - c) * (a / b) + c; |
||
3139 | this.zoomTo(a, e, b) |
||
3140 | } |
||
3141 | }, |
||
3142 | addLegend: function(a, b) { |
||
3143 | a.position = "absolute"; |
||
3144 | a.autoMargins = !1; |
||
3145 | a.valueWidth = 0; |
||
3146 | a.switchable = !1; |
||
3147 | d.AmMap.base.addLegend.call(this, a, b); |
||
3148 | void 0 === a.enabled && (a.enabled = !0); |
||
3149 | return a |
||
3150 | }, |
||
3151 | handleLegendEvent: function() {}, |
||
3152 | createDescriptionsDiv: function() { |
||
3153 | if (!this.descriptionsDiv) { |
||
3154 | var a = document.createElement("div"), |
||
3155 | b = a.style; |
||
3156 | b.position = "absolute"; |
||
3157 | b.left = "0px"; |
||
3158 | b.top = "0px"; |
||
3159 | this.descriptionsDiv = a |
||
3160 | } |
||
3161 | this.containerDiv.appendChild(this.descriptionsDiv) |
||
3162 | }, |
||
3163 | drawChart: function() { |
||
3164 | d.AmMap.base.drawChart.call(this); |
||
3165 | var a = this.dataProvider; |
||
3166 | this.dataProvider = a = d.extend(a, new d.MapData, !0); |
||
3167 | this.areasSettings = d.processObject(this.areasSettings, d.AreasSettings, this.theme); |
||
3168 | this.imagesSettings = d.processObject(this.imagesSettings, d.ImagesSettings, this.theme); |
||
3169 | this.linesSettings = d.processObject(this.linesSettings, d.LinesSettings, this.theme); |
||
3170 | var b = this.container; |
||
3171 | this.mapContainer && this.mapContainer.remove(); |
||
3172 | this.mapContainer = b.set(); |
||
3173 | this.graphsSet.push(this.mapContainer); |
||
3174 | var c; |
||
3175 | a.map && (c = d.maps[a.map]); |
||
3176 | a.mapVar && (c = a.mapVar); |
||
3177 | c ? (this.svgData = c.svg, this.getBounds(), this.buildEverything()) : (a = a.mapURL) && this.loadXml(a); |
||
3178 | this.balloonsSet.toFront() |
||
3179 | }, |
||
3180 | drawBg: function() { |
||
3181 | var a = this; |
||
3182 | a.background.click(function() { |
||
3183 | a.handleBackgroundClick() |
||
3184 | }); |
||
3185 | a.background.mouseover(function() { |
||
3186 | a.rollOutMapObject(a.previouslyHovered) |
||
3187 | }) |
||
3188 | }, |
||
3189 | buildEverything: function() { |
||
3190 | if (0 < this.realWidth && 0 < this.realHeight) { |
||
3191 | var a = this.container, |
||
3192 | b = this.dataProvider; |
||
3193 | this.projection || (this.projection = b.projection, this.projection || (this.projection = "equirectangular")); |
||
3194 | this.updatableImages = []; |
||
3195 | var c = this.projection; |
||
3196 | c && (this.projectionFunction = d[c]); |
||
3197 | this.projectionFunction || (this.projectionFunction = d.equirectangular); |
||
3198 | this.dpProjectionFunction = d[b.projection]; |
||
3199 | this.dpProjectionFunction || (this.dpProjectionFunction = d.equirectangular); |
||
3200 | this.zoomControl = d.processObject(this.zoomControl, d.ZoomControl, this.theme); |
||
3201 | this.zoomControl.init(this, a); |
||
3202 | this.drawBg(); |
||
3203 | this.buildSVGMap(); |
||
3204 | this.projectionFunction && c != b.projection || this.forceNormalize ? (this.normalizeMap(), this.changeProjection()) : this.fixMapPosition(); |
||
3205 | if (c = this.smallMap) c = d.processObject(c, d.SmallMap, this.theme), c.init(this, a), this.smallMap = c; |
||
3206 | isNaN(b.zoomX) && isNaN(b.zoomY) && isNaN(b.zoomLatitude) && isNaN(b.zoomLongitude) && (this.centerMap ? (c = this.xyToCoordinates(this.mapWidth / 2, this.mapHeight / 2), b.zoomLongitudeC = c.longitude, b.zoomLatitudeC = c.latitude) : (b.zoomX = 0, b.zoomY = 0), this.zoomInstantly = !0); |
||
3207 | this.selectObject(this.dataProvider); |
||
3208 | this.processAreas(); |
||
3209 | if (b = this.valueLegend) this.valueLegend = b = d.processObject(b, d.ValueLegend, this.theme), b.init(this, a); |
||
3210 | this.objectList && (a = this.objectList = d.processObject(this.objectList, d.ObjectList)) && (this.clearObjectList(), a.init(this)); |
||
3211 | this.dispDUpd(); |
||
3212 | this.updateSmallMap(); |
||
3213 | this.linkSet.toFront() |
||
3214 | } else this.cleanChart() |
||
3215 | }, |
||
3216 | hideGroup: function(a) { |
||
3217 | this.showHideGroup(a, !1) |
||
3218 | }, |
||
3219 | showGroup: function(a) { |
||
3220 | this.showHideGroup(a, !0) |
||
3221 | }, |
||
3222 | showHideGroup: function(a, b) { |
||
3223 | this.showHideReal(this.imagesProcessor.allObjects, a, b); |
||
3224 | this.showHideReal(this.areasProcessor.allObjects, a, b); |
||
3225 | this.showHideReal(this.linesProcessor.allObjects, a, b) |
||
3226 | }, |
||
3227 | showHideReal: function(a, b, c) { |
||
3228 | var e; |
||
3229 | for (e = 0; e < a.length; e++) { |
||
3230 | var d = a[e]; |
||
3231 | if (d.groupId == b) { |
||
3232 | var g = d.displayObject; |
||
3233 | g && (c ? (d.hidden = !1, g.show()) : (d.hidden = !0, g.hide())) |
||
3234 | } |
||
3235 | } |
||
3236 | }, |
||
3237 | makeObjectAccessible: function(a) { |
||
3238 | if (a.accessibleLabel) { |
||
3239 | var b = this.formatString(a.accessibleLabel, a); |
||
3240 | a.displayObject && this.makeAccessible(a.displayObject, b, "menuitem") |
||
3241 | } |
||
3242 | }, |
||
3243 | update: function() { |
||
3244 | if (d.hasSVG) { |
||
3245 | d.AmMap.base.update.call(this); |
||
3246 | this.zoomControl && this.zoomControl.update && this.zoomControl.update(); |
||
3247 | for (var a = 0, b = this.updatableImages.length; a < b; a++) this.updatableImages[a].update() |
||
3248 | } |
||
3249 | }, |
||
3250 | animateMap: function() { |
||
3251 | var a = this; |
||
3252 | a.totalFrames = a.zoomDuration * d.updateRate; |
||
3253 | a.totalFrames += 1; |
||
3254 | a.frame = 0; |
||
3255 | a.tweenPercent = 0; |
||
3256 | a.balloon.hide(0); |
||
3257 | setTimeout(function() { |
||
3258 | a.updateSize.call(a) |
||
3259 | }, 1E3 / d.updateRate) |
||
3260 | }, |
||
3261 | updateSize: function() { |
||
3262 | var a = this, |
||
3263 | b = a.totalFrames; |
||
3264 | a.preventHover = !0; |
||
3265 | a.frame <= b ? (a.frame++, b = d.easeOutSine(0, a.frame, 0, 1, b), 1 <= b ? (b = 1, a.preventHover = !1, a.wheelBusy = !1) : window.requestAnimationFrame ? window.requestAnimationFrame(function() { |
||
3266 | a.updateSize.call(a) |
||
3267 | }) : setTimeout(function() { |
||
3268 | a.updateSize.call(a) |
||
3269 | }, 1E3 / d.updateRate), .8 < b && (a.preventHover = !1)) : (b = 1, a.preventHover = !1, a.wheelBusy = !1); |
||
3270 | a.tweenPercent = b; |
||
3271 | a.rescaleMapAndObjects() |
||
3272 | }, |
||
3273 | rescaleMapAndObjects: function() { |
||
3274 | var a = this.initialScale, |
||
3275 | b = this.initialX, |
||
3276 | c = this.initialY, |
||
3277 | e = this.tweenPercent, |
||
3278 | a = a + (this.finalScale - a) * e; |
||
3279 | this.mapContainer.translate(b + (this.finalX - b) * e, c + (this.finalY - c) * e, a, !0); |
||
3280 | if (this.areasSettings.adjustOutlineThickness) { |
||
3281 | for (var b = this.svgAreas, d = 0; d < b.length; d++)(c = b[d]) && c.setAttr("stroke-width", this.areasSettings.outlineThickness / a / this.mapScale); |
||
3282 | if (b = this.dataProvider.areas) |
||
3283 | for (d = 0; d < b.length; d++) { |
||
3284 | var c = b[d], |
||
3285 | g = c.displayObject; |
||
3286 | g && g.setAttr("stroke-width", c.outlineThicknessReal / a / this.mapScale) |
||
3287 | } |
||
3288 | } |
||
3289 | this.rescaleObjects(); |
||
3290 | this.positionChanged(); |
||
3291 | this.updateSmallMap(); |
||
3292 | 1 == e && this.fire({ |
||
3293 | type: "zoomCompleted", |
||
3294 | chart: this |
||
3295 | }) |
||
3296 | }, |
||
3297 | updateSmallMap: function() { |
||
3298 | this.smallMap && this.smallMap.update() |
||
3299 | }, |
||
3300 | rescaleObjects: function() { |
||
3301 | var a = this.mapContainer.scale, |
||
3302 | b = this.imagesProcessor.objectsToResize, |
||
3303 | c; |
||
3304 | for (c = 0; c < b.length; c++) { |
||
3305 | var d = b[c].image, |
||
3306 | f = b[c].scale, |
||
3307 | g = b[c].mapImage; |
||
3308 | isNaN(g.selectedScaleReal) || g != this.selectedObject || (g.tempScale = f, f *= g.selectedScaleReal); |
||
3309 | d.translate(d.x, d.y, f / a, !0) |
||
3310 | } |
||
3311 | b = this.imagesProcessor.labelsToReposition; |
||
3312 | for (c = 0; c < b.length; c++) d = b[c], d.imageLabel && this.imagesProcessor.positionLabel(d.imageLabel, d, d.labelPositionReal); |
||
3313 | b = this.linesProcessor; |
||
3314 | if (d = b.linesToResize) |
||
3315 | for (c = 0; c < d.length; c++) f = d[c], f.line.setAttr("stroke-width", f.thickness / a); |
||
3316 | b = b.objectsToResize; |
||
3317 | for (c = 0; c < b.length; c++) d = b[c], d.translate(d.x, d.y, 1 / a, !0) |
||
3318 | }, |
||
3319 | handleTouchEnd: function(a) { |
||
3320 | this.initialDistance = NaN; |
||
3321 | this.mouseIsDown = this.isDragging = !1; |
||
3322 | d.AmMap.base.handleTouchEnd.call(this, a) |
||
3323 | }, |
||
3324 | handleMouseDown: function(a) { |
||
3325 | d.resetMouseOver(); |
||
3326 | this.mouseIsDown = this.mouseIsOver = !0; |
||
3327 | this.balloon.hide(0); |
||
3328 | a && this.mouseIsOver && a.preventDefault && this.panEventsEnabled && a.preventDefault(); |
||
3329 | if (this.chartCreated && !this.preventHover && (this.initialTouchZoom = this.zoomLevel(), this.dragMap && (this.stopAnimation(), this.mapContainerClickX = this.mapContainer.x, this.mapContainerClickY = this.mapContainer.y), a || (a = window.event), a.shiftKey && !0 === this.developerMode && this.getDevInfo(), a && a.touches)) { |
||
3330 | var b = this.mouseX, |
||
3331 | c = this.mouseY, |
||
3332 | e = a.touches.item(1); |
||
3333 | e && this.panEventsEnabled && this.boundingRect && (a = e.clientX - this.boundingRect.left, e = e.clientY - this.boundingRect.top, this.middleXP = (b + (a - b) / 2) / this.realWidth, this.middleYP = (c + (e - c) / 2) / this.realHeight, this.initialDistance = Math.sqrt(Math.pow(a - b, 2) + Math.pow(e - c, 2))) |
||
3334 | } |
||
3335 | }, |
||
3336 | stopDrag: function() { |
||
3337 | this.isDragging = !1 |
||
3338 | }, |
||
3339 | handleReleaseOutside: function() { |
||
3340 | if (d.isModern) { |
||
3341 | var a = this; |
||
3342 | d.AmMap.base.handleReleaseOutside.call(a); |
||
3343 | a.mouseIsDown = !1; |
||
3344 | setTimeout(function() { |
||
3345 | a.resetPinch.call(a) |
||
3346 | }, 100); |
||
3347 | if (!a.preventHover) { |
||
3348 | a.stopDrag(); |
||
3349 | var b = a.zoomControl; |
||
3350 | b && b.draggerUp && b.draggerUp(); |
||
3351 | a.mapWasDragged = !1; |
||
3352 | var b = a.mapContainer, |
||
3353 | c = a.mapContainerClickX, |
||
3354 | e = a.mapContainerClickY; |
||
3355 | isNaN(c) || isNaN(e) || !(3 < Math.abs(b.x - c) || 3 < Math.abs(b.y - e)) || (a.mapWasDragged = !0, b = { |
||
3356 | type: "dragCompleted", |
||
3357 | zoomX: a.zoomX(), |
||
3358 | zoomY: a.zoomY(), |
||
3359 | zoomLevel: a.zoomLevel(), |
||
3360 | chart: a |
||
3361 | }, a.fire(b)); |
||
3362 | (a.mouseIsOver && !a.mapWasDragged && !a.skipClick || a.wasTouched && 3 > Math.abs(a.mouseX - a.tmx) && 3 > Math.abs(a.mouseY - a.tmy)) && a.fire({ |
||
3363 | type: "click", |
||
3364 | x: a.mouseX, |
||
3365 | y: a.mouseY, |
||
3366 | chart: a |
||
3367 | }); |
||
3368 | a.mapContainerClickX = NaN; |
||
3369 | a.mapContainerClickY = NaN; |
||
3370 | a.objectWasClicked = !1; |
||
3371 | a.zoomOnDoubleClick && a.mouseIsOver && (b = (new Date).getTime(), 200 > b - a.previousClickTime && 40 < b - a.previousClickTime && a.doDoubleClickZoom(), a.previousClickTime = b) |
||
3372 | } |
||
3373 | a.wasTouched = !1 |
||
3374 | } |
||
3375 | }, |
||
3376 | resetPinch: function() { |
||
3377 | this.mapWasPinched = !1 |
||
3378 | }, |
||
3379 | handleMouseMove: function(a) { |
||
3380 | var b = this; |
||
3381 | d.AmMap.base.handleMouseMove.call(b, a); |
||
3382 | if (!a || !a.touches || !b.tapToActivate || b.tapped) { |
||
3383 | b.panEventsEnabled && b.mouseIsOver && a && a.preventDefault && a.preventDefault(); |
||
3384 | var c = b.previuosMouseX, |
||
3385 | e = b.previuosMouseY, |
||
3386 | f = b.mouseX, |
||
3387 | g = b.mouseY, |
||
3388 | h = b.zoomControl; |
||
3389 | isNaN(c) && (c = f); |
||
3390 | isNaN(e) && (e = g); |
||
3391 | b.mouse2X = NaN; |
||
3392 | b.mouse2Y = NaN; |
||
3393 | a && a.touches && (a = a.touches.item(1)) && b.panEventsEnabled && b.boundingRect && (b.mouse2X = a.clientX - b.boundingRect.left, b.mouse2Y = a.clientY - b.boundingRect.top); |
||
3394 | if (a = b.mapContainer) { |
||
3395 | var k = b.mouse2X, |
||
3396 | l = b.mouse2Y; |
||
3397 | b.pinchTO && clearTimeout(b.pinchTO); |
||
3398 | b.pinchTO = setTimeout(function() { |
||
3399 | b.resetPinch.call(b) |
||
3400 | }, 1E3); |
||
3401 | var m = b.realHeight, |
||
3402 | n = b.realWidth, |
||
3403 | p = b.mapWidth, |
||
3404 | r = b.mapHeight; |
||
3405 | b.mouseIsDown && b.dragMap && (3 < Math.abs(b.previuosMouseX - b.mouseX) || 3 < Math.abs(b.previuosMouseY - b.mouseY)) && (b.isDragging = !0); |
||
3406 | if (!isNaN(k)) { |
||
3407 | b.stopDrag(); |
||
3408 | var t = Math.sqrt(Math.pow(k - f, 2) + Math.pow(l - g, 2)), |
||
3409 | q = b.initialDistance; |
||
3410 | isNaN(q) && (q = Math.sqrt(Math.pow(k - f, 2) + Math.pow(l - g, 2))); |
||
3411 | if (!isNaN(q)) { |
||
3412 | var k = b.initialTouchZoom * t / q, |
||
3413 | k = d.fitToBounds(k, h.minZoomLevel, h.maxZoomLevel), |
||
3414 | h = b.zoomLevel(), |
||
3415 | q = b.middleXP, |
||
3416 | l = b.middleYP, |
||
3417 | t = m / r, |
||
3418 | y = n / p, |
||
3419 | q = (b.zoomX() - q * y) * (k / h) + q * y, |
||
3420 | l = (b.zoomY() - |
||
3421 | l * t) * (k / h) + l * t; |
||
3422 | .1 < Math.abs(k - h) && (b.zoomTo(k, q, l, !0), b.mapWasPinched = !0, clearTimeout(b.pinchTO)) |
||
3423 | } |
||
3424 | } |
||
3425 | k = a.scale; |
||
3426 | b.isDragging && (b.balloon.hide(0), b.positionChanged(), c = a.x + (f - c), e = a.y + (g - e), b.preventDragOut && (r = -r * k + m / 2 - b.diffY * b.mapScale * k, m = m / 2 - b.diffY * b.mapScale * k, c = d.fitToBounds(c, -p * k + n / 2, n / 2), e = d.fitToBounds(e, r, m)), isNaN(c) || isNaN(e) || (a.translate(c, e, k, !0), b.updateSmallMap())); |
||
3427 | b.previuosMouseX = f; |
||
3428 | b.previuosMouseY = g |
||
3429 | } |
||
3430 | } |
||
3431 | }, |
||
3432 | selectObject: function(a, b) { |
||
3433 | var c = this; |
||
3434 | a || (a = c.dataProvider); |
||
3435 | a.isOver = !1; |
||
3436 | var e = a.linkToObject; |
||
3437 | d.isString(e) && (e = c.getObjectById(e)); |
||
3438 | a.useTargetsZoomValues && e && (a.zoomX = e.zoomX, a.zoomY = e.zoomY, a.zoomLatitude = e.zoomLatitude, a.zoomLongitude = e.zoomLongitude, a.zoomLevel = e.zoomLevel); |
||
3439 | var f = c.selectedObject; |
||
3440 | f && c.returnInitialColor(f); |
||
3441 | c.selectedObject = a; |
||
3442 | var g = !1, |
||
3443 | h, k; |
||
3444 | "MapArea" == a.objectType && (a.autoZoomReal && (g = !0), h = c.areasSettings.selectedOutlineColor, k = c.areasSettings.selectedOutlineThickness); |
||
3445 | if (e && !g && (d.isString(e) && (e = c.getObjectById(e)), isNaN(a.zoomLevel) && isNaN(a.zoomX) && isNaN(a.zoomY))) { |
||
3446 | if (c.extendMapData(e)) return; |
||
3447 | c.selectObject(e); |
||
3448 | return |
||
3449 | } |
||
3450 | c.allowMultipleDescriptionWindows || c.closeAllDescriptions(); |
||
3451 | clearTimeout(c.selectedObjectTimeOut); |
||
3452 | clearTimeout(c.processObjectsTimeOut); |
||
3453 | e = c.zoomDuration; |
||
3454 | !g && isNaN(a.zoomLevel) && isNaN(a.zoomX) && isNaN(a.zoomY) ? (c.showDescriptionAndGetUrl(), b || c.processObjects()) : (c.selectedObjectTimeOut = setTimeout(function() { |
||
3455 | c.showDescriptionAndGetUrl.call(c) |
||
3456 | }, 1E3 * e + 200), c.showObjectsAfterZoom) ? b || (c.processObjectsTimeOut = setTimeout(function() { |
||
3457 | c.processObjects.call(c) |
||
3458 | }, 1E3 * e + 200)) : b || c.processObjects(); |
||
3459 | e = a.displayObject; |
||
3460 | g = a.selectedColorReal; |
||
3461 | if ("MapImage" == a.objectType) { |
||
3462 | h = c.imagesSettings.selectedOutlineColor; |
||
3463 | k = c.imagesSettings.selectedOutlineThickness; |
||
3464 | var e = a.image, |
||
3465 | l = a.selectedScaleReal; |
||
3466 | if (!isNaN(l) && 1 != l) { |
||
3467 | var m = a.scale; |
||
3468 | isNaN(a.tempScale) || (m = a.tempScale); |
||
3469 | isNaN(m) && (m = 1); |
||
3470 | a.tempScale = m; |
||
3471 | var n = a.displayObject; |
||
3472 | n.translate(n.x, n.y, m * l, !0) |
||
3473 | } |
||
3474 | } |
||
3475 | if (e) { |
||
3476 | if (d.removeCN(c, e, "selected-object"), d.setCN(c, e, "selected-object"), a.bringForwardOnHover && a.displayObject.toFront(), c.outlinesToFront(), !a.preserveOriginalAttributes) { |
||
3477 | e.setAttr("stroke", a.outlineColorReal); |
||
3478 | void 0 !== g && e.setAttr("fill", g); |
||
3479 | void 0 !== h && e.setAttr("stroke", h); |
||
3480 | void 0 !== k && e.setAttr("stroke-width", k); |
||
3481 | "MapLine" == a.objectType && ((l = a.lineSvg) && l.setAttr("stroke", g), l = a.arrowSvg) && (l.setAttr("fill", g), l.setAttr("stroke", g)); |
||
3482 | if (l = a.imageLabel) m = a.selectedLabelColorReal, void 0 !== m && l.setAttr("fill", m); |
||
3483 | a.selectable || (e.setAttr("cursor", "default"), l && l.setAttr("cursor", "default")) |
||
3484 | } |
||
3485 | } else c.returnInitialColorReal(a); |
||
3486 | if (e = a.groupId) |
||
3487 | for (l = a.groupArray, l || (l = c.getGroupById(e), a.groupArray = l), m = 0; m < l.length; m++) |
||
3488 | if (n = l[m], n.isOver = !1, e = n.displayObject, "MapImage" == n.objectType && (e = n.image), e) { |
||
3489 | var p = n.selectedColorReal; |
||
3490 | void 0 !== p && e.setAttr("fill", p); |
||
3491 | void 0 !== h && e.setAttr("stroke", h); |
||
3492 | void 0 !== k && e.setAttr("stroke-width", k); |
||
3493 | "MapLine" == n.objectType && ((e = n.lineSvg) && e.setAttr("stroke", g), e = n.arrowSvg) && (e.setAttr("fill", g), e.setAttr("stroke", g)) |
||
3494 | } |
||
3495 | c.rescaleObjects(); |
||
3496 | c.zoomToSelectedObject(); |
||
3497 | f != a && c.fire({ |
||
3498 | type: "selectedObjectChanged", |
||
3499 | chart: c |
||
3500 | }) |
||
3501 | }, |
||
3502 | returnInitialColor: function(a, b) { |
||
3503 | this.returnInitialColorReal(a); |
||
3504 | b && (a.isFirst = !1); |
||
3505 | if (this.selectedObject.bringForwardOnHover) { |
||
3506 | var c = this.selectedObject.displayObject; |
||
3507 | c && c.toFront() |
||
3508 | } |
||
3509 | if (c = a.groupId) { |
||
3510 | var c = this.getGroupById(c), |
||
3511 | d; |
||
3512 | for (d = 0; d < c.length; d++) this.returnInitialColorReal(c[d]), b && (c[d].isFirst = !1) |
||
3513 | } |
||
3514 | this.outlinesToFront() |
||
3515 | }, |
||
3516 | outlinesToFront: function() { |
||
3517 | if (this.outlines) |
||
3518 | for (var a = 0; a < this.outlines.length; a++) this.outlines[a].toFront() |
||
3519 | }, |
||
3520 | closeAllDescriptions: function() { |
||
3521 | this.descriptionsDiv.innerHTML = "" |
||
3522 | }, |
||
3523 | fireClosed: function() { |
||
3524 | this.fire({ |
||
3525 | type: "descriptionClosed", |
||
3526 | chart: this |
||
3527 | }) |
||
3528 | }, |
||
3529 | returnInitialColorReal: function(a) { |
||
3530 | a.isOver = !1; |
||
3531 | var b = a.displayObject; |
||
3532 | if (b) { |
||
3533 | d.removeCN(this, b, "selected-object"); |
||
3534 | b.toPrevious(); |
||
3535 | if ("MapImage" == a.objectType) { |
||
3536 | var c = a.tempScale; |
||
3537 | isNaN(c) || b.translate(b.x, b.y, c, !0); |
||
3538 | a.tempScale = NaN; |
||
3539 | b = a.image |
||
3540 | } |
||
3541 | c = a.colorReal; |
||
3542 | if ("MapLine" == a.objectType) { |
||
3543 | var e = a.lineSvg; |
||
3544 | e && e.setAttr("stroke", c); |
||
3545 | if (e = a.arrowSvg) { |
||
3546 | var f = a.arrowColor; |
||
3547 | void 0 === f && (f = c); |
||
3548 | e.setAttr("fill", f); |
||
3549 | e.setAttr("stroke", f) |
||
3550 | } |
||
3551 | } |
||
3552 | var e = a.alphaReal, |
||
3553 | f = a.outlineAlphaReal, |
||
3554 | g = a.outlineThicknessReal, |
||
3555 | h = a.outlineColorReal; |
||
3556 | if (a.showAsSelected) { |
||
3557 | var c = a.selectedColorReal, |
||
3558 | k, l; |
||
3559 | "MapImage" == a.objectType && (k = this.imagesSettings.selectedOutlineColor, l = this.imagesSettings.selectedOutlineThickness); |
||
3560 | "MapArea" == a.objectType && (k = this.areasSettings.selectedOutlineColor, l = this.areasSettings.selectedOutlineThickness); |
||
3561 | void 0 !== k && (h = k); |
||
3562 | void 0 !== l && (g = l) |
||
3563 | } |
||
3564 | "bubble" == a.type && (c = void 0); |
||
3565 | void 0 !== c && b.setAttr("fill", c); |
||
3566 | if (k = a.image) k.setAttr("fill", c), k.setAttr("stroke", h), k.setAttr("stroke-width", g), k.setAttr("fill-opacity", e), k.setAttr("stroke-opacity", f); |
||
3567 | "MapArea" == a.objectType && (c = 1, this.areasSettings.adjustOutlineThickness && (c = this.zoomLevel() * this.mapScale), b.setAttr("stroke", h), b.setAttr("stroke-width", g / c), b.setAttr("fill-opacity", e), b.setAttr("stroke-opacity", f)); |
||
3568 | (c = a.pattern) && b.pattern(c, this.mapScale, this.path); |
||
3569 | (b = a.imageLabel) && !a.labelInactive && (a.showAsSelected && void 0 !== a.selectedLabelColor ? b.setAttr("fill", a.selectedLabelColor) : b.setAttr("fill", a.labelColorReal)) |
||
3570 | } |
||
3571 | }, |
||
3572 | zoomToRectangle: function(a, b, c, e) { |
||
3573 | var f = this.realWidth, |
||
3574 | g = this.realHeight, |
||
3575 | h = this.mapSet.scale, |
||
3576 | k = this.zoomControl, |
||
3577 | f = d.fitToBounds(c / f > e / g ? .8 * f / (c * h) : .8 * g / (e * h), k.minZoomLevel, k.maxZoomLevel); |
||
3578 | this.zoomToMapXY(f, (a + c / 2) * h, (b + e / 2) * h) |
||
3579 | }, |
||
3580 | zoomToLatLongRectangle: function(a, b, c, e) { |
||
3581 | var f = this.dataProvider, |
||
3582 | g = this.zoomControl, |
||
3583 | h = Math.abs(c - a), |
||
3584 | k = Math.abs(b - e), |
||
3585 | l = Math.abs(f.rightLongitude - f.leftLongitude), |
||
3586 | f = Math.abs(f.topLatitude - f.bottomLatitude), |
||
3587 | g = d.fitToBounds(h / l > k / f ? .8 * l / h : .8 * f / k, g.minZoomLevel, g.maxZoomLevel); |
||
3588 | this.zoomToLongLat(g, a + (c - a) / 2, e + (b - e) / 2) |
||
3589 | }, |
||
3590 | getGroupById: function(a) { |
||
3591 | var b = []; |
||
3592 | this.getGroup(this.imagesProcessor.allObjects, a, b); |
||
3593 | this.getGroup(this.linesProcessor.allObjects, a, b); |
||
3594 | this.getGroup(this.areasProcessor.allObjects, a, b); |
||
3595 | return b |
||
3596 | }, |
||
3597 | zoomToGroup: function(a) { |
||
3598 | a = "object" == typeof a ? a : this.getGroupById(a); |
||
3599 | var b, c, d, f, g; |
||
3600 | for (g = 0; g < a.length; g++) { |
||
3601 | var h = a[g].displayObject; |
||
3602 | if (h) { |
||
3603 | var k = h.getBBox(), |
||
3604 | h = k.y, |
||
3605 | l = k.y + k.height, |
||
3606 | m = k.x, |
||
3607 | k = k.x + k.width; |
||
3608 | if (h < b || isNaN(b)) b = h; |
||
3609 | if (l > f || isNaN(f)) f = l; |
||
3610 | if (m < c || isNaN(c)) c = m; |
||
3611 | if (k > d || isNaN(d)) d = k |
||
3612 | } |
||
3613 | } |
||
3614 | c += this.diffX; |
||
3615 | d += this.diffX; |
||
3616 | f += this.diffY; |
||
3617 | b += this.diffY; |
||
3618 | this.zoomToRectangle(c, b, d - c, f - b) |
||
3619 | }, |
||
3620 | getGroup: function(a, b, c) { |
||
3621 | if (a) { |
||
3622 | var d; |
||
3623 | for (d = 0; d < a.length; d++) { |
||
3624 | var f = a[d]; |
||
3625 | f.groupId == b && c.push(f) |
||
3626 | } |
||
3627 | } |
||
3628 | }, |
||
3629 | zoomToStageXY: function(a, b, c, e) { |
||
3630 | if (!this.objectWasClicked) { |
||
3631 | var f = this.zoomControl; |
||
3632 | a = d.fitToBounds(a, f.minZoomLevel, f.maxZoomLevel); |
||
3633 | var f = this.zoomLevel(), |
||
3634 | g = this.mapSet.getBBox(); |
||
3635 | b = this.xyToCoordinates((b - this.mapContainer.x) / f - g.x * this.mapScale, (c - this.mapContainer.y) / f - g.y * this.mapScale); |
||
3636 | this.zoomToLongLat(a, b.longitude, b.latitude, e) |
||
3637 | } |
||
3638 | }, |
||
3639 | zoomToLongLat: function(a, b, c, |
||
3640 | d) { |
||
3641 | b = this.coordinatesToXY(b, c); |
||
3642 | this.zoomToMapXY(a, b.x, b.y, d) |
||
3643 | }, |
||
3644 | zoomToMapXY: function(a, b, c, d) { |
||
3645 | var f = this.mapWidth, |
||
3646 | g = this.mapHeight; |
||
3647 | this.zoomTo(a, -(b / f) * a + this.realWidth / f / 2, -(c / g) * a + this.realHeight / g / 2, d) |
||
3648 | }, |
||
3649 | zoomToObject: function(a) { |
||
3650 | if (a) { |
||
3651 | var b = a.zoomLatitude, |
||
3652 | c = a.zoomLongitude; |
||
3653 | isNaN(a.zoomLatitudeC) || (b = a.zoomLatitudeC); |
||
3654 | isNaN(a.zoomLongitudeC) || (c = a.zoomLongitudeC); |
||
3655 | var e = a.zoomLevel, |
||
3656 | f = this.zoomInstantly, |
||
3657 | g = a.zoomX, |
||
3658 | h = a.zoomY, |
||
3659 | k = this.realWidth, |
||
3660 | l = this.realHeight; |
||
3661 | isNaN(e) || (isNaN(b) || isNaN(c) ? this.zoomTo(e, g, h, f) : this.zoomToLongLat(e, c, b, f)); |
||
3662 | this.zoomInstantly = !1; |
||
3663 | "MapImage" == a.objectType && isNaN(a.zoomX) && isNaN(a.zoomY) && isNaN(a.zoomLatitude) && isNaN(a.zoomLongitude) && !isNaN(a.latitude) && !isNaN(a.longitude) && this.zoomToLongLat(a.zoomLevel, a.longitude, a.latitude); |
||
3664 | "MapArea" == a.objectType && (f = a.displayObject.getBBox(), g = this.mapScale, b = (f.x + this.diffX) * g, c = (f.y + this.diffY) * g, e = f.width * g, f = f.height * g, k = a.autoZoomReal && isNaN(a.zoomLevel) ? e / k > f / l ? .8 * k / e : .8 * l / f : a.zoomLevel, l = this.zoomControl, k = d.fitToBounds(k, l.minZoomLevel, l.maxZoomLevel), isNaN(a.zoomX) && isNaN(a.zoomY) && isNaN(a.zoomLatitude) && isNaN(a.zoomLongitude) && this.zoomToMapXY(k, b + e / 2, c + f / 2)); |
||
3665 | this.zoomControl.update() |
||
3666 | } |
||
3667 | }, |
||
3668 | zoomToSelectedObject: function() { |
||
3669 | this.zoomToObject(this.selectedObject) |
||
3670 | }, |
||
3671 | zoomTo: function(a, b, c, e) { |
||
3672 | var f = this.zoomControl; |
||
3673 | a = d.fitToBounds(a, f.minZoomLevel, f.maxZoomLevel); |
||
3674 | f = this.zoomLevel(); |
||
3675 | isNaN(b) && (b = this.realWidth / this.mapWidth, b = (this.zoomX() - .5 * b) * (a / f) + .5 * b); |
||
3676 | isNaN(c) && (c = this.realHeight / this.mapHeight, c = (this.zoomY() - .5 * c) * (a / f) + .5 * c); |
||
3677 | this.stopAnimation(); |
||
3678 | isNaN(a) || (f = this.mapContainer, this.initialX = f.x, this.initialY = f.y, this.initialScale = f.scale, this.finalX = this.mapWidth * b, this.finalY = this.mapHeight * c, this.finalScale = a, this.finalX != this.initialX || this.finalY != this.initialY || this.finalScale != this.initialScale ? e ? (this.tweenPercent = 1, this.rescaleMapAndObjects(), this.wheelBusy = !1) : this.animateMap() : this.wheelBusy = !1) |
||
3679 | }, |
||
3680 | loadXml: function(a) { |
||
3681 | var b; |
||
3682 | window.XMLHttpRequest && (b = new XMLHttpRequest); |
||
3683 | b.overrideMimeType && b.overrideMimeType("text/xml"); |
||
3684 | b.open("GET", a, !1); |
||
3685 | b.send(); |
||
3686 | this.parseXMLObject(b.responseXML); |
||
3687 | this.svgData && this.buildEverything() |
||
3688 | }, |
||
3689 | stopAnimation: function() { |
||
3690 | this.frame = this.totalFrames |
||
3691 | }, |
||
3692 | processObjects: function(a) { |
||
3693 | var b = this.selectedObject; |
||
3694 | if (0 < b.images.length || 0 < b.areas.length || 0 < b.lines.length || b == this.dataProvider || a) { |
||
3695 | a = this.container; |
||
3696 | var c = this.stageImagesContainer; |
||
3697 | c && c.remove(); |
||
3698 | this.stageImagesContainer = c = a.set(); |
||
3699 | this.trendLinesSet.push(c); |
||
3700 | var d = this.stageLinesContainer; |
||
3701 | d && d.remove(); |
||
3702 | this.stageLinesContainer = d = a.set(); |
||
3703 | this.trendLinesSet.push(d); |
||
3704 | var f = this.mapImagesContainer; |
||
3705 | f && f.remove(); |
||
3706 | this.mapImagesContainer = f = a.set(); |
||
3707 | this.mapContainer.push(f); |
||
3708 | var g = this.mapLinesContainer; |
||
3709 | g && g.remove(); |
||
3710 | this.mapLinesContainer = g = a.set(); |
||
3711 | this.mapContainer.push(g); |
||
3712 | this.linesAboveImages ? (f.toFront(), c.toFront(), g.toFront(), d.toFront()) : (g.toFront(), d.toFront(), f.toFront(), c.toFront()); |
||
3713 | b && (this.imagesProcessor.reset(), this.linesProcessor.reset(), this.linesAboveImages ? (this.imagesProcessor.process(b), this.linesProcessor.process(b)) : (this.linesProcessor.process(b), this.imagesProcessor.process(b))); |
||
3714 | this.rescaleObjects() |
||
3715 | } |
||
3716 | }, |
||
3717 | processAreas: function() { |
||
3718 | this.areasProcessor.process(this.dataProvider) |
||
3719 | }, |
||
3720 | buildSVGMap: function() { |
||
3721 | d.remove(this.mapSet); |
||
3722 | var a = this.svgData.g.path, |
||
3723 | b = this.container, |
||
3724 | c = b.set(); |
||
3725 | this.svgAreas = []; |
||
3726 | this.svgAreasById = {}; |
||
3727 | void 0 === a.length && (a = [a]); |
||
3728 | var e; |
||
3729 | for (e = 0; e < a.length; e++) { |
||
3730 | var f = a[e], |
||
3731 | g = f.d, |
||
3732 | h = f.title; |
||
3733 | f.titleTr && (h = f.titleTr); |
||
3734 | var k = b.path(g); |
||
3735 | k.id = f.id; |
||
3736 | if (this.areasSettings.preserveOriginalAttributes) { |
||
3737 | k.customAttr = {}; |
||
3738 | for (var l in f) "d" != l && "id" != l && "title" != l && (k.customAttr[l] = f[l]) |
||
3739 | } |
||
3740 | f.outline && (k.outline = !0); |
||
3741 | k.path = g; |
||
3742 | this.svgAreasById[f.id] = { |
||
3743 | area: k, |
||
3744 | title: h, |
||
3745 | className: f["class"] |
||
3746 | }; |
||
3747 | this.svgAreas.push(k); |
||
3748 | c.push(k) |
||
3749 | } |
||
3750 | this.mapSet = c; |
||
3751 | this.mapContainer.push(c); |
||
3752 | this.resizeMap() |
||
3753 | }, |
||
3754 | centerAlign: function() {}, |
||
3755 | setProjection: function(a) { |
||
3756 | this.projection = a; |
||
3757 | this.chartCreated = !1; |
||
3758 | this.buildEverything() |
||
3759 | }, |
||
3760 | addObjectEventListeners: function(a, b) { |
||
3761 | var c = this; |
||
3762 | a.mousedown(function(a) { |
||
3763 | c.mouseDownMapObject(b, a) |
||
3764 | }).mouseup(function(a) { |
||
3765 | c.clickMapObject(b, a) |
||
3766 | }).mouseover(function(a) { |
||
3767 | c.balloonX = NaN; |
||
3768 | c.rollOverMapObject(b, !0, a) |
||
3769 | }).mouseout(function(a) { |
||
3770 | c.balloonX = NaN; |
||
3771 | c.rollOutMapObject(b, a) |
||
3772 | }).touchend(function(a) { |
||
3773 | 4 > Math.abs(c.mouseX - c.tmx) && 4 > Math.abs(c.mouseY - c.tmy) && (c.tapped = !0); |
||
3774 | c.tapToActivate && !c.tapped || c.mapWasDragged || c.mapWasPinched || (c.balloonX = NaN, c.rollOverMapObject(b, !0, a), c.clickMapObject(b, a)) |
||
3775 | }).touchstart(function(a) { |
||
3776 | c.tmx = c.mouseX; |
||
3777 | c.tmy = c.mouseY; |
||
3778 | c.mouseDownMapObject(b, a) |
||
3779 | }).keyup(function(a) { |
||
3780 | 13 == a.keyCode && c.clickMapObject(b, a) |
||
3781 | }) |
||
3782 | }, |
||
3783 | checkIfSelected: function(a) { |
||
3784 | var b = this.selectedObject; |
||
3785 | if (b == a) return !0; |
||
3786 | if (b = b.groupId) { |
||
3787 | var b = this.getGroupById(b), |
||
3788 | c; |
||
3789 | for (c = 0; c < b.length; c++) |
||
3790 | if (b[c] == a) return !0 |
||
3791 | } |
||
3792 | return !1 |
||
3793 | }, |
||
3794 | clearMap: function() { |
||
3795 | this.chartDiv.innerHTML = ""; |
||
3796 | this.clearObjectList() |
||
3797 | }, |
||
3798 | clearObjectList: function() { |
||
3799 | var a = this.objectList; |
||
3800 | a && a.div && (a.div.innerHTML = "") |
||
3801 | }, |
||
3802 | checkIfLast: function(a) { |
||
3803 | if (a) { |
||
3804 | var b = a.parentNode; |
||
3805 | if (b && b.lastChild == a) return !0 |
||
3806 | } |
||
3807 | return !1 |
||
3808 | }, |
||
3809 | showAsRolledOver: function(a) { |
||
3810 | var b = a.displayObject; |
||
3811 | // console.log(a); |
||
3812 | a.rollOverColorReal = "#b30000"; |
||
3813 | a.rollOverScaleReal = 2; |
||
3814 | a.balloonTextReal = "[[title]]"; |
||
3815 | // a.images = ["https://pixel.nymag.com/imgs/daily/intelligencer/2016/04/13/13-kobe-bryant-2016.w710.h473.2x.jpg"] |
||
3816 | if (!a.showAsSelected && b && !a.isOver) { |
||
3817 | b.node.onmouseout = function() {}; |
||
3818 | b.node.onmouseover = function() {}; |
||
3819 | // b.node.onclick = function() {window.location.href = "./" + a.contest}; |
||
3820 | // b.node.onclick = function() { |
||
3821 | // window.location.href = "./" + a.contest ; |
||
3822 | // }; |
||
3823 | |||
3824 | !a.isFirst && a.bringForwardOnHover && (b.toFront(), a.isFirst = !0); |
||
3825 | var c = a.rollOverColorReal, |
||
3826 | e; |
||
3827 | a.preserveOriginalAttributes && (c = void 0); |
||
3828 | "bubble" == a.type && (c = void 0); |
||
3829 | void 0 == c && (isNaN(a.rollOverBrightnessReal) || (c = d.adjustLuminosity(a.colorReal, a.rollOverBrightnessReal / 100))); |
||
3830 | if (void 0 != c) |
||
3831 | if ("MapImage" == a.objectType)(e = a.image) && e.setAttr("fill", c); |
||
3832 | else if ("MapLine" == a.objectType) { |
||
3833 | if ((e = a.lineSvg) && e.setAttr("stroke", c), e = a.arrowSvg) e.setAttr("fill", c), e.setAttr("stroke", c) |
||
3834 | } else b.setAttr("fill", c); |
||
3835 | (c = a.imageLabel) && !a.labelInactive && (e = a.labelRollOverColorReal, void 0 != e && c.setAttr("fill", e)); |
||
3836 | c = a.rollOverOutlineColorReal; |
||
3837 | void 0 != c && ("MapImage" == a.objectType ? (e = a.image) && e.setAttr("stroke", c) : b.setAttr("stroke", c)); |
||
3838 | "MapImage" == a.objectType ? (c = this.imagesSettings.rollOverOutlineThickness, (e = a.image) && (isNaN(c) || e.setAttr("stroke-width", c))) : (c = this.areasSettings.rollOverOutlineThickness, isNaN(c) || b.setAttr("stroke-width", c)); |
||
3839 | if ("MapArea" == a.objectType) { |
||
3840 | c = this.areasSettings; |
||
3841 | e = a.rollOverAlphaReal; |
||
3842 | isNaN(e) || b.setAttr("fill-opacity", e); |
||
3843 | e = c.rollOverOutlineAlpha; |
||
3844 | isNaN(e) || b.setAttr("stroke-opacity", e); |
||
3845 | e = 1; |
||
3846 | this.areasSettings.adjustOutlineThickness && (e = this.zoomLevel() * this.mapScale); |
||
3847 | var f = c.rollOverOutlineThickness; |
||
3848 | isNaN(f) || b.setAttr("stroke-width", f / e); |
||
3849 | (c = c.rollOverPattern) && b.pattern(c, this.mapScale, this.path) |
||
3850 | } |
||
3851 | "MapImage" == a.objectType && (c = a.rollOverScaleReal, isNaN(c) || 1 == c || (e = b.scale, isNaN(e) && (e = 1), a.tempScale = e, b.translate(b.x, b.y, e * c, !0))); |
||
3852 | this.useHandCursorOnClickableOjects && this.checkIfClickable(a) && b.setAttr("cursor", "pointer"); |
||
3853 | a.mouseEnabled && this.addObjectEventListeners(b, a); |
||
3854 | a.isOver = !0 |
||
3855 | } |
||
3856 | this.outlinesToFront() |
||
3857 | }, |
||
3858 | rollOverMapObject: function(a, b, c) { |
||
3859 | if (this.chartCreated) { |
||
3860 | this.handleMouseMove(); |
||
3861 | var d = this.previouslyHovered; |
||
3862 | d && d != a ? (!1 === this.checkIfSelected(d) && (this.returnInitialColor(d, !0), this.previouslyHovered = null), this.balloon.hide(0)) : clearTimeout(this.hoverInt); |
||
3863 | if (!this.preventHover) { |
||
3864 | if (!1 === this.checkIfSelected(a)) { |
||
3865 | if (d = a.groupId) { |
||
3866 | var d = this.getGroupById(d), |
||
3867 | f; |
||
3868 | for (f = 0; f < d.length; f++) d[f] != a && this.showAsRolledOver(d[f]) |
||
3869 | } |
||
3870 | this.showAsRolledOver(a) |
||
3871 | } else(d = a.displayObject) && (this.allowClickOnSelectedObject ? d.setAttr("cursor", "pointer") : d.setAttr("cursor", "default")); |
||
3872 | this.showDescriptionOnHover ? this.showDescription(a) : !this.showBalloonOnSelectedObject && this.checkIfSelected(a) || !1 === b || (f = this.balloon, this.balloon.fixedPosition = !1, b = a.colorReal, d = "", void 0 !== b && this.useObjectColorForBalloon || (b = f.fillColor), (f = a.balloonTextReal) && (d = this.formatString(f, a)), this.balloonLabelFunction && (d = this.balloonLabelFunction(a, this)), d && "" !== d && this.showBalloon(d, b, !1, this.balloonX, this.balloonY)); |
||
3873 | this.fire({ |
||
3874 | type: "rollOverMapObject", |
||
3875 | mapObject: a, |
||
3876 | chart: this, |
||
3877 | event: c |
||
3878 | }); |
||
3879 | this.previouslyHovered = a |
||
3880 | } |
||
3881 | } |
||
3882 | }, |
||
3883 | longitudeToX: function(a) { |
||
3884 | return (this.longitudeToCoordinate(a) + this.diffX * this.mapScale) * this.zoomLevel() + this.mapContainer.x |
||
3885 | }, |
||
3886 | latitudeToY: function(a) { |
||
3887 | return (this.latitudeToCoordinate(a) + this.diffY * this.mapScale) * this.zoomLevel() + this.mapContainer.y |
||
3888 | }, |
||
3889 | latitudeToStageY: function(a) { |
||
3890 | return this.latitudeToCoordinate(a) * this.zoomLevel() + |
||
3891 | this.mapContainer.y + this.diffY * this.mapScale |
||
3892 | }, |
||
3893 | longitudeToStageX: function(a) { |
||
3894 | return this.longitudeToCoordinate(a) * this.zoomLevel() + this.mapContainer.x + this.diffX * this.mapScale |
||
3895 | }, |
||
3896 | stageXToLongitude: function(a) { |
||
3897 | a = (a - this.mapContainer.x) / this.zoomLevel(); |
||
3898 | return this.coordinateToLongitude(a) |
||
3899 | }, |
||
3900 | stageYToLatitude: function(a) { |
||
3901 | a = (a - this.mapContainer.y) / this.zoomLevel(); |
||
3902 | return this.coordinateToLatitude(a) |
||
3903 | }, |
||
3904 | rollOutMapObject: function(a, b) { |
||
3905 | this.hideBalloon(); |
||
3906 | a && this.chartCreated && a.isOver && (this.checkIfSelected(a) || |
||
3907 | this.returnInitialColor(a), this.fire({ |
||
3908 | type: "rollOutMapObject", |
||
3909 | mapObject: a, |
||
3910 | chart: this, |
||
3911 | event: b |
||
3912 | })) |
||
3913 | }, |
||
3914 | formatString: function(a, b) { |
||
3915 | var c = this.nf, |
||
3916 | e = this.pf, |
||
3917 | f = b.title; |
||
3918 | b.titleTr && (f = b.titleTr); |
||
3919 | void 0 == f && (f = ""); |
||
3920 | var g = b.value, |
||
3921 | g = isNaN(g) ? "" : d.formatNumber(g, c), |
||
3922 | c = b.percents, |
||
3923 | c = isNaN(c) ? "" : d.formatNumber(c, e), |
||
3924 | e = b.description; |
||
3925 | void 0 == e && (e = ""); |
||
3926 | var h = b.customData; |
||
3927 | void 0 == h && (h = ""); |
||
3928 | return a = d.massReplace(a, { |
||
3929 | "[[title]]": f, |
||
3930 | "[[value]]": g, |
||
3931 | "[[percent]]": c, |
||
3932 | "[[description]]": e, |
||
3933 | "[[customData]]": h |
||
3934 | }) |
||
3935 | }, |
||
3936 | mouseDownMapObject: function(a, b) { |
||
3937 | this.fire({ |
||
3938 | type: "mouseDownMapObject", |
||
3939 | mapObject: a, |
||
3940 | chart: this, |
||
3941 | event: b |
||
3942 | }) |
||
3943 | }, |
||
3944 | clickMapObject: function(a, b) { |
||
3945 | var c = this; |
||
3946 | b && (b.touches || isNaN(a.zoomLevel) && isNaN(a.zoomX) && isNaN(a.zoomY) || c.hideBalloon()); |
||
3947 | if (c.chartCreated && !c.preventHover && c.checkTouchDuration(b) && !c.mapWasDragged && c.checkIfClickable(a) && !c.mapWasPinched) { |
||
3948 | c.selectObject(a); |
||
3949 | var d = c.zoomLevel(), |
||
3950 | f = c.mapSet.getBBox(), |
||
3951 | d = c.xyToCoordinates((c.mouseX - c.mapContainer.x) / d - f.x * c.mapScale, (c.mouseY - c.mapContainer.y) / d - f.y * c.mapScale); |
||
3952 | c.clickLatitude = |
||
3953 | d.latitude; |
||
3954 | c.clickLongitude = d.longitude; |
||
3955 | b && b.touches && setTimeout(function() { |
||
3956 | c.showBalloonAfterZoom.call(c) |
||
3957 | }, 1E3 * c.zoomDuration); |
||
3958 | c.fire({ |
||
3959 | type: "clickMapObject", |
||
3960 | mapObject: a, |
||
3961 | chart: c, |
||
3962 | event: b |
||
3963 | }); |
||
3964 | c.objectWasClicked = !0 |
||
3965 | } |
||
3966 | }, |
||
3967 | showBalloonAfterZoom: function() { |
||
3968 | var a = this.clickLongitude, |
||
3969 | b = this.clickLatitude, |
||
3970 | c = this.selectedObject; |
||
3971 | "MapImage" != c.objectType || isNaN(c.longitude) || (a = c.longitude, b = c.latitude); |
||
3972 | a = this.coordinatesToStageXY(a, b); |
||
3973 | this.balloonX = a.x; |
||
3974 | this.balloonY = a.y; |
||
3975 | this.rollOverMapObject(this.selectedObject, !0) |
||
3976 | }, |
||
3977 | checkIfClickable: function(a) { |
||
3978 | var b = this.allowClickOnSelectedObject; |
||
3979 | return this.selectedObject == a && b ? !0 : this.selectedObject != a || b ? !0 === a.selectable || "MapArea" == a.objectType && a.autoZoomReal || a.url || a.linkToObject || 0 < a.images.length || 0 < a.lines.length || !isNaN(a.zoomLevel) || !isNaN(a.zoomX) || !isNaN(a.zoomY) || a.description ? !0 : !1 : !1 |
||
3980 | }, |
||
3981 | resizeMap: function() { |
||
3982 | var a = this.mapSet; |
||
3983 | if (a) { |
||
3984 | var b = 1, |
||
3985 | c = a.getBBox(), |
||
3986 | d = this.realWidth, |
||
3987 | f = this.realHeight, |
||
3988 | g = c.width, |
||
3989 | c = c.height; |
||
3990 | 0 < g && 0 < c && (this.fitMapToContainer && (b = g / d > c / f ? d / g : f / c), a.translate(0, 0, b, !0), this.mapScale = b, this.mapHeight = c * b, this.mapWidth = g * b) |
||
3991 | } |
||
3992 | }, |
||
3993 | zoomIn: function() { |
||
3994 | var a = this.zoomLevel() * this.zoomControl.zoomFactor; |
||
3995 | this.zoomTo(a) |
||
3996 | }, |
||
3997 | zoomOut: function() { |
||
3998 | var a = this.zoomLevel() / this.zoomControl.zoomFactor; |
||
3999 | this.zoomTo(a) |
||
4000 | }, |
||
4001 | moveLeft: function() { |
||
4002 | var a = this.zoomX() + this.zoomControl.panStepSize; |
||
4003 | this.zoomTo(this.zoomLevel(), a, this.zoomY()) |
||
4004 | }, |
||
4005 | moveRight: function() { |
||
4006 | var a = this.zoomX() - this.zoomControl.panStepSize; |
||
4007 | this.zoomTo(this.zoomLevel(), a, this.zoomY()) |
||
4008 | }, |
||
4009 | moveUp: function() { |
||
4010 | var a = |
||
4011 | this.zoomY() + this.zoomControl.panStepSize; |
||
4012 | this.zoomTo(this.zoomLevel(), this.zoomX(), a) |
||
4013 | }, |
||
4014 | moveDown: function() { |
||
4015 | var a = this.zoomY() - this.zoomControl.panStepSize; |
||
4016 | this.zoomTo(this.zoomLevel(), this.zoomX(), a) |
||
4017 | }, |
||
4018 | zoomX: function() { |
||
4019 | return this.mapSet ? Math.round(1E4 * this.mapContainer.x / this.mapWidth) / 1E4 : NaN |
||
4020 | }, |
||
4021 | zoomY: function() { |
||
4022 | return this.mapSet ? Math.round(1E4 * this.mapContainer.y / this.mapHeight) / 1E4 : NaN |
||
4023 | }, |
||
4024 | goHome: function() { |
||
4025 | this.selectObject(this.dataProvider); |
||
4026 | this.fire({ |
||
4027 | type: "homeButtonClicked", |
||
4028 | chart: this |
||
4029 | }) |
||
4030 | }, |
||
4031 | zoomLevel: function() { |
||
4032 | return Math.round(1E5 * |
||
4033 | this.mapContainer.scale) / 1E5 |
||
4034 | }, |
||
4035 | showDescriptionAndGetUrl: function() { |
||
4036 | var a = this.selectedObject; |
||
4037 | if (a) { |
||
4038 | this.showDescription(); |
||
4039 | var b = a.url; |
||
4040 | if (b) d.getURL(b, a.urlTarget); |
||
4041 | else if (b = a.linkToObject) { |
||
4042 | if (d.isString(b)) { |
||
4043 | var c = this.getObjectById(b); |
||
4044 | if (c) { |
||
4045 | this.selectObject(c); |
||
4046 | return |
||
4047 | } |
||
4048 | } |
||
4049 | b && a.passZoomValuesToTarget && (b.zoomLatitude = this.zoomLatitude(), b.zoomLongitude = this.zoomLongitude(), b.zoomLevel = this.zoomLevel()); |
||
4050 | this.extendMapData(b) || this.selectObject(b) |
||
4051 | } |
||
4052 | } |
||
4053 | }, |
||
4054 | extendMapData: function(a) { |
||
4055 | var b = a.objectType; |
||
4056 | if ("MapImage" != |
||
4057 | b && "MapArea" != b && "MapLine" != b) return d.extend(a, new d.MapData, !0), this.dataProvider = a, this.zoomInstantly = !0, this.validateData(), !0 |
||
4058 | }, |
||
4059 | showDescription: function(a) { |
||
4060 | a || (a = this.selectedObject); |
||
4061 | this.allowMultipleDescriptionWindows || this.closeAllDescriptions(); |
||
4062 | if (a.description) { |
||
4063 | var b = a.descriptionWindow; |
||
4064 | b && b.close(); |
||
4065 | b = new d.DescriptionWindow; |
||
4066 | a.descriptionWindow = b; |
||
4067 | var c = a.descriptionWindowWidth, |
||
4068 | e = a.descriptionWindowHeight, |
||
4069 | f = a.descriptionWindowLeft, |
||
4070 | g = a.descriptionWindowTop, |
||
4071 | h = a.descriptionWindowRight, |
||
4072 | k = a.descriptionWindowBottom; |
||
4073 | isNaN(h) || (f = this.realWidth - h); |
||
4074 | isNaN(k) || (g = this.realHeight - k); |
||
4075 | var l = a.descriptionWindowX; |
||
4076 | isNaN(l) || (f = l); |
||
4077 | l = a.descriptionWindowY; |
||
4078 | isNaN(l) || (g = l); |
||
4079 | isNaN(f) && (f = this.mouseX, f = f > this.realWidth / 2 ? f - c - 20 : f + 20); |
||
4080 | isNaN(g) && (g = this.mouseY); |
||
4081 | b.maxHeight = e; |
||
4082 | l = a.title; |
||
4083 | a.titleTr && (l = a.titleTr); |
||
4084 | b.show(this, this.descriptionsDiv, a.description, l); |
||
4085 | a = b.div.style; |
||
4086 | a.position = "absolute"; |
||
4087 | a.width = c + "px"; |
||
4088 | a.maxHeight = e + "px"; |
||
4089 | isNaN(k) || (g -= b.div.offsetHeight); |
||
4090 | isNaN(h) || (f -= b.div.offsetWidth); |
||
4091 | a.left = f + "px"; |
||
4092 | a.top = g + "px" |
||
4093 | } |
||
4094 | }, |
||
4095 | parseXMLObject: function(a) { |
||
4096 | var b = { |
||
4097 | root: {} |
||
4098 | }; |
||
4099 | this.parseXMLNode(b, "root", a); |
||
4100 | this.svgData = b.root.svg; |
||
4101 | this.getBounds() |
||
4102 | }, |
||
4103 | getBounds: function() { |
||
4104 | var a = this.dataProvider; |
||
4105 | try { |
||
4106 | var b = this.svgData.defs["amcharts:ammap"]; |
||
4107 | a.leftLongitude = Number(b.leftLongitude); |
||
4108 | a.rightLongitude = Number(b.rightLongitude); |
||
4109 | a.topLatitude = Number(b.topLatitude); |
||
4110 | a.bottomLatitude = Number(b.bottomLatitude); |
||
4111 | a.projection = b.projection; |
||
4112 | var c = b.wrappedLongitudes; |
||
4113 | c && (a.rightLongitude += 360); |
||
4114 | a.wrappedLongitudes = c |
||
4115 | } catch (d) {} |
||
4116 | }, |
||
4117 | recalcLongitude: function(a) { |
||
4118 | return this.dataProvider.wrappedLongitudes ? a < this.dataProvider.leftLongitude ? Number(a) + 360 : a : a |
||
4119 | }, |
||
4120 | latitudeToCoordinate: function(a) { |
||
4121 | var b, c = this.dataProvider; |
||
4122 | if (this.mapSet) { |
||
4123 | b = c.topLatitude; |
||
4124 | var d = c.bottomLatitude; |
||
4125 | "mercator" == c.projection && (a = this.mercatorLatitudeToCoordinate(a), b = this.mercatorLatitudeToCoordinate(b), d = this.mercatorLatitudeToCoordinate(d)); |
||
4126 | b = (a - b) / (d - b) * this.mapHeight |
||
4127 | } |
||
4128 | return b |
||
4129 | }, |
||
4130 | longitudeToCoordinate: function(a) { |
||
4131 | a = this.recalcLongitude(a); |
||
4132 | var b, c = this.dataProvider; |
||
4133 | this.mapSet && (b = c.leftLongitude, b = (a - b) / (c.rightLongitude - b) * this.mapWidth); |
||
4134 | return b |
||
4135 | }, |
||
4136 | mercatorLatitudeToCoordinate: function(a) { |
||
4137 | 89.5 < a && (a = 89.5); - 89.5 > a && (a = -89.5); |
||
4138 | a = d.degreesToRadians(a); |
||
4139 | return d.radiansToDegrees(.5 * Math.log((1 + Math.sin(a)) / (1 - Math.sin(a))) / 2) |
||
4140 | }, |
||
4141 | zoomLatitude: function() { |
||
4142 | if (this.mapContainer) { |
||
4143 | var a = this.mapSet.getBBox(), |
||
4144 | b = (-this.mapContainer.x + this.previousWidth / 2) / this.zoomLevel() - a.x * this.mapScale, |
||
4145 | a = (-this.mapContainer.y + this.previousHeight / 2) / this.zoomLevel() - a.y * this.mapScale; |
||
4146 | return this.xyToCoordinates(b, a).latitude |
||
4147 | } |
||
4148 | }, |
||
4149 | zoomLongitude: function() { |
||
4150 | if (this.mapContainer) { |
||
4151 | var a = |
||
4152 | this.mapSet.getBBox(), |
||
4153 | b = (-this.mapContainer.x + this.previousWidth / 2) / this.zoomLevel() - a.x * this.mapScale, |
||
4154 | a = (-this.mapContainer.y + this.previousHeight / 2) / this.zoomLevel() - a.y * this.mapScale; |
||
4155 | return this.xyToCoordinates(b, a).longitude |
||
4156 | } |
||
4157 | }, |
||
4158 | getAreaCenterLatitude: function(a) { |
||
4159 | a = a.displayObject.getBBox(); |
||
4160 | var b = this.mapScale, |
||
4161 | c = this.mapSet.getBBox(); |
||
4162 | return this.xyToCoordinates((a.x + a.width / 2 + this.diffX) * b - c.x * b, (a.y + a.height / 2 + this.diffY) * b - c.y * b).latitude |
||
4163 | }, |
||
4164 | getAreaCenterLongitude: function(a) { |
||
4165 | a = a.displayObject.getBBox(); |
||
4166 | var b = this.mapScale, |
||
4167 | c = this.mapSet.getBBox(); |
||
4168 | return this.xyToCoordinates((a.x + a.width / 2 + this.diffX) * b - c.x * b, (a.y + a.height / 2 + this.diffY) * b - c.y * b).longitude |
||
4169 | }, |
||
4170 | milesToPixels: function(a) { |
||
4171 | var b = this.dataProvider; |
||
4172 | return this.mapWidth / (b.rightLongitude - b.leftLongitude) * a / 69.172 |
||
4173 | }, |
||
4174 | kilometersToPixels: function(a) { |
||
4175 | var b = this.dataProvider; |
||
4176 | return this.mapWidth / (b.rightLongitude - b.leftLongitude) * a / 111.325 |
||
4177 | }, |
||
4178 | handleBackgroundClick: function() { |
||
4179 | if (this.backgroundZoomsToTop && !this.mapWasDragged) { |
||
4180 | var a = this.dataProvider; |
||
4181 | if (this.checkIfClickable(a)) this.clickMapObject(a); |
||
4182 | else { |
||
4183 | var b = a.zoomX, |
||
4184 | c = a.zoomY, |
||
4185 | d = a.zoomLongitude, |
||
4186 | f = a.zoomLatitude, |
||
4187 | a = a.zoomLevel; |
||
4188 | isNaN(b) || isNaN(c) || this.zoomTo(a, b, c); |
||
4189 | isNaN(d) || isNaN(f) || this.zoomToLongLat(a, d, f, !0) |
||
4190 | } |
||
4191 | } |
||
4192 | }, |
||
4193 | parseXMLNode: function(a, b, c, d) { |
||
4194 | void 0 === d && (d = ""); |
||
4195 | var f, g, h; |
||
4196 | if (c) { |
||
4197 | var k = c.childNodes.length; |
||
4198 | for (f = 0; f < k; f++) { |
||
4199 | g = c.childNodes[f]; |
||
4200 | var l = g.nodeName, |
||
4201 | m = g.nodeValue ? this.trim(g.nodeValue) : "", |
||
4202 | n = !1; |
||
4203 | g.attributes && 0 < g.attributes.length && (n = !0); |
||
4204 | if (0 !== g.childNodes.length || "" !== m || !1 !== n) |
||
4205 | if (3 == g.nodeType || 4 == g.nodeType) { |
||
4206 | if ("" !== m) { |
||
4207 | g = 0; |
||
4208 | for (h in a[b]) a[b].hasOwnProperty(h) && g++; |
||
4209 | g ? a[b]["#text"] = m : a[b] = m |
||
4210 | } |
||
4211 | } else if (1 == g.nodeType) { |
||
4212 | var p; |
||
4213 | void 0 !== a[b][l] ? void 0 === a[b][l].length ? (p = a[b][l], a[b][l] = [], a[b][l].push(p), a[b][l].push({}), p = a[b][l][1]) : "object" == typeof a[b][l] && (a[b][l].push({}), p = a[b][l][a[b][l].length - 1]) : (a[b][l] = {}, p = a[b][l]); |
||
4214 | if (g.attributes && g.attributes.length) |
||
4215 | for (m = 0; m < g.attributes.length; m++) p[g.attributes[m].name] = g.attributes[m].value; |
||
4216 | void 0 !== a[b][l].length ? this.parseXMLNode(a[b][l], a[b][l].length - 1, g, d + " ") : this.parseXMLNode(a[b], l, g, d + " ") |
||
4217 | } |
||
4218 | } |
||
4219 | g = 0; |
||
4220 | c = ""; |
||
4221 | for (h in a[b]) "#text" == h ? c = a[b][h] : g++; |
||
4222 | 0 === g && void 0 === a[b].length && (a[b] = c) |
||
4223 | } |
||
4224 | }, |
||
4225 | doDoubleClickZoom: function() { |
||
4226 | /* if (!this.mapWasDragged) { |
||
4227 | var a = this.zoomLevel() * this.zoomControl.zoomFactor; |
||
4228 | this.zoomToStageXY(a, this.mouseX, this.mouseY) |
||
4229 | }*/ |
||
4230 | }, |
||
4231 | getDevInfo: function() { |
||
4232 | var a = this.zoomLevel(), |
||
4233 | b = this.mapSet.getBBox(), |
||
4234 | b = this.xyToCoordinates((this.mouseX - this.mapContainer.x) / a - b.x * this.mapScale, (this.mouseY - this.mapContainer.y) / a - b.y * this.mapScale), |
||
4235 | a = { |
||
4236 | chart: this, |
||
4237 | type: "writeDevInfo", |
||
4238 | zoomLevel: a, |
||
4239 | zoomX: this.zoomX(), |
||
4240 | zoomY: this.zoomY(), |
||
4241 | zoomLatitude: this.zoomLatitude(), |
||
4242 | zoomLongitude: this.zoomLongitude(), |
||
4243 | latitude: b.latitude, |
||
4244 | longitude: b.longitude, |
||
4245 | left: this.mouseX, |
||
4246 | top: this.mouseY, |
||
4247 | right: this.realWidth - this.mouseX, |
||
4248 | bottom: this.realHeight - this.mouseY, |
||
4249 | percentLeft: Math.round(this.mouseX / this.realWidth * 100) + "%", |
||
4250 | percentTop: Math.round(this.mouseY / this.realHeight * 100) + "%", |
||
4251 | percentRight: Math.round((this.realWidth - this.mouseX) / this.realWidth * 100) + "%", |
||
4252 | percentBottom: Math.round((this.realHeight - |
||
4253 | this.mouseY) / this.realHeight * 100) + "%" |
||
4254 | }, |
||
4255 | b = "zoomLevel:" + a.zoomLevel + ", zoomLongitude:" + a.zoomLongitude + ", zoomLatitude:" + a.zoomLatitude + "\n", |
||
4256 | b = b + ("zoomX:" + a.zoomX + ", zoomY:" + a.zoomY + "\n"), |
||
4257 | b = b + ("latitude:" + a.latitude + ", longitude:" + a.longitude + "\n"), |
||
4258 | b = b + ("left:" + a.left + ", top:" + a.top + "\n"), |
||
4259 | b = b + ("right:" + a.right + ", bottom:" + a.bottom + "\n"), |
||
4260 | b = b + ("left:" + a.percentLeft + ", top:" + a.percentTop + "\n"), |
||
4261 | b = b + ("right:" + a.percentRight + ", bottom:" + a.percentBottom + "\n"); |
||
4262 | a.str = b; |
||
4263 | this.fire(a); |
||
4264 | return a |
||
4265 | }, |
||
4266 | getXY: function(a, |
||
4267 | b, c) { |
||
4268 | void 0 !== a && (-1 != String(a).indexOf("%") ? (a = Number(a.split("%").join("")), c && (a = 100 - a), a = Number(a) * b / 100) : c && (a = b - a)); |
||
4269 | return a |
||
4270 | }, |
||
4271 | getObjectById: function(a) { |
||
4272 | var b = this.dataProvider; |
||
4273 | if (b.areas) { |
||
4274 | var c = this.getObject(a, b.areas); |
||
4275 | if (c) return c |
||
4276 | } |
||
4277 | if (c = this.getObject(a, b.images)) return c; |
||
4278 | if (a = this.getObject(a, b.lines)) return a |
||
4279 | }, |
||
4280 | getObject: function(a, b) { |
||
4281 | if (b) { |
||
4282 | var c; |
||
4283 | for (c = 0; c < b.length; c++) { |
||
4284 | var d = b[c]; |
||
4285 | if (d.id == a) return d; |
||
4286 | if (d.areas) { |
||
4287 | var f = this.getObject(a, d.areas); |
||
4288 | if (f) return f |
||
4289 | } |
||
4290 | if (f = this.getObject(a, d.images)) return f; |
||
4291 | if (d = this.getObject(a, d.lines)) return d |
||
4292 | } |
||
4293 | } |
||
4294 | }, |
||
4295 | parseData: function() { |
||
4296 | var a = this.dataProvider; |
||
4297 | this.processObject(a.areas, a, "area"); |
||
4298 | this.processObject(a.images, a, "image"); |
||
4299 | this.processObject(a.lines, a, "line") |
||
4300 | }, |
||
4301 | processObject: function(a, b, c) { |
||
4302 | if (a) { |
||
4303 | var e; |
||
4304 | for (e = 0; e < a.length; e++) { |
||
4305 | var f = a[e]; |
||
4306 | f.parentObject = b; |
||
4307 | "area" == c && d.extend(f, new d.MapArea(this.theme), !0); |
||
4308 | "image" == c && (f = d.extend(f, new d.MapImage(this.theme), !0)); |
||
4309 | "line" == c && (f = d.extend(f, new d.MapLine(this.theme), !0)); |
||
4310 | a[e] = f; |
||
4311 | f.areas && this.processObject(f.areas, f, "area"); |
||
4312 | f.images && this.processObject(f.images, f, "image"); |
||
4313 | f.lines && this.processObject(f.lines, f, "line") |
||
4314 | } |
||
4315 | } |
||
4316 | }, |
||
4317 | positionChanged: function() { |
||
4318 | var a = { |
||
4319 | type: "positionChanged", |
||
4320 | zoomX: this.zoomX(), |
||
4321 | zoomY: this.zoomY(), |
||
4322 | zoomLevel: this.zoomLevel(), |
||
4323 | chart: this |
||
4324 | }; |
||
4325 | this.fire(a) |
||
4326 | }, |
||
4327 | getX: function(a, b) { |
||
4328 | return this.getXY(a, this.realWidth, b) |
||
4329 | }, |
||
4330 | getY: function(a, b) { |
||
4331 | return this.getXY(a, this.realHeight, b) |
||
4332 | }, |
||
4333 | trim: function(a) { |
||
4334 | if (a) { |
||
4335 | var b; |
||
4336 | for (b = 0; b < a.length; b++) |
||
4337 | if (-1 === " \n\r\t\f\x0B\u00a0\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u3000".indexOf(a.charAt(b))) { |
||
4338 | a = a.substring(b); |
||
4339 | break |
||
4340 | } |
||
4341 | for (b = a.length - 1; 0 <= b; b--) |
||
4342 | if (-1 === " \n\r\t\f\x0B\u00a0\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u3000".indexOf(a.charAt(b))) { |
||
4343 | a = a.substring(0, b + 1); |
||
4344 | break |
||
4345 | } |
||
4346 | return -1 === " \n\r\t\f\x0B\u00a0\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u3000".indexOf(a.charAt(0)) ? a : "" |
||
4347 | } |
||
4348 | }, |
||
4349 | destroy: function() { |
||
4350 | d.AmMap.base.destroy.call(this) |
||
4351 | }, |
||
4352 | x2c: function(a) { |
||
4353 | var b = this.dataProvider.leftLongitude; |
||
4354 | return Math.round(this.unscaledMapWidth * (a - b) / (this.dataProvider.rightLongitude - b) * 100) / 100 |
||
4355 | }, |
||
4356 | y2c: function(a) { |
||
4357 | var b = this.dataProvider.topLatitude; |
||
4358 | return Math.round(this.unscaledMapHeight * (a - b) / (this.dataProvider.bottomLatitude - b) * 100) / 100 |
||
4359 | }, |
||
4360 | normalize: function(a) { |
||
4361 | if (!a.pathsArray) { |
||
4362 | var b; |
||
4363 | if (a.normalized) b = a.normalized; |
||
4364 | else { |
||
4365 | var c = d.normalizePath(a.node); |
||
4366 | b = a.node.getAttribute("d"); |
||
4367 | a.normalized = b; |
||
4368 | c.maxX > this.maxMapX && (this.maxMapX = c.maxX); |
||
4369 | c.minX < this.minMapX && (this.minMapX = c.minX); |
||
4370 | c.maxY > this.maxMapY && (this.maxMapY = c.maxY); |
||
4371 | c.minY < this.minMapY && |
||
4372 | (this.minMapY = c.minY) |
||
4373 | } |
||
4374 | a.node.setAttribute("d", b) |
||
4375 | } |
||
4376 | }, |
||
4377 | redraw: function(a) { |
||
4378 | var b = a.normalized, |
||
4379 | b = b.split(" Z").join(""), |
||
4380 | b = b.split("M"); |
||
4381 | a.pathsArray = []; |
||
4382 | for (var c = 0; c < b.length; c++) { |
||
4383 | var d = b[c]; |
||
4384 | if (d) { |
||
4385 | for (var d = d.split("L"), f = [], g = 0; g < d.length; g++) |
||
4386 | if (d[g]) { |
||
4387 | var h = d[g].split(" "), |
||
4388 | h = this.xyToCoordinates(Number(h[1]) - this.minMapX, Number(h[2]) - this.minMapY, this.dpProjectionFunction, this.sourceMapWidth, this.sourceMapHeight); |
||
4389 | f.push([h.longitude, h.latitude]) |
||
4390 | } |
||
4391 | a.pathsArray.push(f) |
||
4392 | } |
||
4393 | } |
||
4394 | b = ""; |
||
4395 | for (c = 0; c < a.pathsArray.length; c++) b += this.redrawArea(a.pathsArray[c]); |
||
4396 | a.node.setAttribute("d", b); |
||
4397 | a.path = b |
||
4398 | }, |
||
4399 | redrawArea: function(a) { |
||
4400 | for (var b = !1, c = "", e = 0; e < a.length; e++) { |
||
4401 | var f = a[e][0], |
||
4402 | g = a[e][1], |
||
4403 | h = d.degreesToRadians(a[e][0]), |
||
4404 | k = d.degreesToRadians(a[e][1]), |
||
4405 | k = this.projectionFunction(h, k), |
||
4406 | h = d.roundTo(this.x2c(d.radiansToDegrees(k[0])), 3), |
||
4407 | k = d.roundTo(this.y2c(d.radiansToDegrees(k[1])), 3); |
||
4408 | h < this.minMapXX && (this.minMapXX = h, this.leftLongLat = { |
||
4409 | longitude: f, |
||
4410 | latitude: g |
||
4411 | }); |
||
4412 | h > this.maxMapXX && (this.maxMapXX = h, this.rightLongLat = { |
||
4413 | longitude: f, |
||
4414 | latitude: g |
||
4415 | }); |
||
4416 | k < this.minMapYY && (this.minMapYY = k, this.topLongLat = { |
||
4417 | longitude: f, |
||
4418 | latitude: g |
||
4419 | }); |
||
4420 | k > this.maxMapYY && (this.maxMapYY = k, this.bottomLongLat = { |
||
4421 | longitude: f, |
||
4422 | latitude: g |
||
4423 | }); |
||
4424 | b ? c += " L " : (c += " M ", b = !0); |
||
4425 | c += h + " " + k |
||
4426 | } |
||
4427 | return c + " Z " |
||
4428 | }, |
||
4429 | normalizeMap: function() { |
||
4430 | var a = d.degreesToRadians(this.dataProvider.leftLongitude), |
||
4431 | b = d.degreesToRadians(this.dataProvider.rightLongitude), |
||
4432 | c = d.degreesToRadians(this.dataProvider.topLatitude), |
||
4433 | e = d.degreesToRadians(this.dataProvider.bottomLatitude), |
||
4434 | f = a + (b - a) / 2, |
||
4435 | g = c + (e - c) / 2, |
||
4436 | h = this.dpProjectionFunction(f, |
||
4437 | c)[1], |
||
4438 | k = this.dpProjectionFunction(f, e)[1], |
||
4439 | l = this.dpProjectionFunction(a, g)[0], |
||
4440 | m = this.dpProjectionFunction(b, g)[0], |
||
4441 | c = d.equirectangular(f, c), |
||
4442 | e = d.equirectangular(f, e), |
||
4443 | h = (c[1] - e[1]) / (h - k), |
||
4444 | a = d.equirectangular(a, g), |
||
4445 | b = d.equirectangular(b, g), |
||
4446 | l = (a[0] - b[0]) / (l - m); |
||
4447 | this.minMapX = Infinity; |
||
4448 | this.maxMapX = -Infinity; |
||
4449 | this.minMapY = Infinity; |
||
4450 | this.maxMapY = -Infinity; |
||
4451 | for (m = 0; m < this.svgAreas.length; m++) this.normalize(this.svgAreas[m]); |
||
4452 | this.sourceMapHeight = Math.abs(this.maxMapY - this.minMapY); |
||
4453 | this.sourceMapWidth = Math.abs(this.maxMapX - |
||
4454 | this.minMapX); |
||
4455 | this.unscaledMapWidth = this.sourceMapWidth * l; |
||
4456 | this.unscaledMapHeight = this.sourceMapHeight * h; |
||
4457 | this.diffY = this.diffX = 0 |
||
4458 | }, |
||
4459 | fixMapPosition: function() { |
||
4460 | var a = d.degreesToRadians(this.dataProvider.leftLongitude), |
||
4461 | b = d.degreesToRadians(this.dataProvider.rightLongitude), |
||
4462 | c = d.degreesToRadians(this.dataProvider.topLatitude), |
||
4463 | e = d.degreesToRadians(this.dataProvider.bottomLatitude), |
||
4464 | f = a + (b - a) / 2, |
||
4465 | g = c + (e - c) / 2, |
||
4466 | h = this.dpProjectionFunction(f, c)[1], |
||
4467 | k = this.dpProjectionFunction(f, e)[1], |
||
4468 | l = this.dpProjectionFunction(a, |
||
4469 | g)[0], |
||
4470 | m = this.dpProjectionFunction(b, g)[0]; |
||
4471 | this.sourceMapHeight = this.mapHeight / this.mapScale; |
||
4472 | this.sourceMapWidth = this.mapWidth / this.mapScale; |
||
4473 | this.unscaledMapWidth = (a - b) / (l - m) * this.sourceMapWidth; |
||
4474 | this.unscaledMapHeight = (c - e) / (h - k) * this.sourceMapHeight; |
||
4475 | b = this.coordinatesToXY(d.radiansToDegrees(f), d.radiansToDegrees(c)); |
||
4476 | a = this.coordinatesToXY(d.radiansToDegrees(a), d.radiansToDegrees(g)); |
||
4477 | c = g = Infinity; |
||
4478 | for (e = 0; e < this.svgAreas.length; e++) f = this.svgAreas[e].getBBox(), f.y < g && (g = f.y), f.x < c && (c = f.x); |
||
4479 | this.diffY = |
||
4480 | b.y / this.mapScale - g; |
||
4481 | this.diffX = a.x / this.mapScale - c; |
||
4482 | for (e = 0; e < this.svgAreas.length; e++) this.svgAreas[e].translate(this.diffX, this.diffY) |
||
4483 | }, |
||
4484 | changeProjection: function() { |
||
4485 | this.minMapXX = Infinity; |
||
4486 | this.maxMapXX = -Infinity; |
||
4487 | this.minMapYY = Infinity; |
||
4488 | this.maxMapYY = -Infinity; |
||
4489 | this.projectionChanged = !1; |
||
4490 | for (var a = 0; a < this.svgAreas.length; a++) this.redraw(this.svgAreas[a]); |
||
4491 | this.projectionChanged = !0; |
||
4492 | this.resizeMap() |
||
4493 | }, |
||
4494 | coordinatesToXY: function(a, b) { |
||
4495 | var c, e; |
||
4496 | c = !1; |
||
4497 | this.dataProvider && (c = this.dataProvider.wrappedLongitudes) && (a = this.recalcLongitude(a)); |
||
4498 | this.projectionFunction ? (e = this.projectionFunction(d.degreesToRadians(a), d.degreesToRadians(b)), c = this.mapScale * d.roundTo(this.x2c(d.radiansToDegrees(e[0])), 3), e = this.mapScale * d.roundTo(this.y2c(d.radiansToDegrees(e[1])), 3)) : (c = this.longitudeToCoordinate(a), e = this.latitudeToCoordinate(b)); |
||
4499 | return { |
||
4500 | x: c, |
||
4501 | y: e |
||
4502 | } |
||
4503 | }, |
||
4504 | coordinatesToStageXY: function(a, b) { |
||
4505 | var c = this.coordinatesToXY(a, b), |
||
4506 | d = c.x * this.zoomLevel() + this.mapContainer.x, |
||
4507 | c = c.y * this.zoomLevel() + this.mapContainer.y; |
||
4508 | return { |
||
4509 | x: d, |
||
4510 | y: c |
||
4511 | } |
||
4512 | }, |
||
4513 | stageXYToCoordinates: function(a, b) { |
||
4514 | var c = this.mapSet.getBBox(), |
||
4515 | d = (a - this.mapContainer.x) / this.zoomLevel() - c.x * this.mapScale, |
||
4516 | c = (b - this.mapContainer.y) / this.zoomLevel() - c.y * this.mapScale; |
||
4517 | return this.xyToCoordinates(d, c) |
||
4518 | }, |
||
4519 | xyToCoordinates: function(a, b, c, e, f) { |
||
4520 | var g; |
||
4521 | isNaN(e) && (e = this.mapWidth); |
||
4522 | isNaN(f) && (f = this.mapHeight); |
||
4523 | c || (c = this.projectionFunction); |
||
4524 | if (g = c.invert) { |
||
4525 | var h = this.dataProvider.leftLongitude, |
||
4526 | k = this.dataProvider.rightLongitude, |
||
4527 | l = this.dataProvider.topLatitude, |
||
4528 | m = this.dataProvider.bottomLatitude, |
||
4529 | n = h + (k - h) / 2, |
||
4530 | p = l + (m - l) / 2, |
||
4531 | l = d.radiansToDegrees(c(d.degreesToRadians(n), d.degreesToRadians(l))[1]), |
||
4532 | m = d.radiansToDegrees(c(d.degreesToRadians(n), d.degreesToRadians(m))[1]), |
||
4533 | h = d.radiansToDegrees(c(d.degreesToRadians(h), d.degreesToRadians(p))[0]), |
||
4534 | k = d.radiansToDegrees(c(d.degreesToRadians(k), d.degreesToRadians(p))[0]); |
||
4535 | this.projectionChanged && (l = d.radiansToDegrees(c(d.degreesToRadians(this.topLongLat.longitude), d.degreesToRadians(this.topLongLat.latitude))[1]), m = d.radiansToDegrees(c(d.degreesToRadians(this.bottomLongLat.longitude), |
||
4536 | d.degreesToRadians(this.bottomLongLat.latitude))[1]), h = d.radiansToDegrees(c(d.degreesToRadians(this.leftLongLat.longitude), d.degreesToRadians(this.leftLongLat.latitude))[0]), k = d.radiansToDegrees(c(d.degreesToRadians(this.rightLongLat.longitude), d.degreesToRadians(this.rightLongLat.latitude))[0])); |
||
4537 | a = d.degreesToRadians(a / e * (k - h) + h); |
||
4538 | b = d.degreesToRadians(b / f * (m - l) + l); |
||
4539 | b = g(a, b); |
||
4540 | g = d.radiansToDegrees(b[0]); |
||
4541 | b = d.radiansToDegrees(b[1]) |
||
4542 | } else g = this.coordinateToLongitude(a), b = this.coordinateToLatitude(b); |
||
4543 | return { |
||
4544 | longitude: d.roundTo(g, 4), |
||
4545 | latitude: d.roundTo(b, 4) |
||
4546 | } |
||
4547 | }, |
||
4548 | coordinateToLatitude: function(a, b) { |
||
4549 | var c; |
||
4550 | void 0 === b && (b = this.mapHeight); |
||
4551 | if (this.mapSet) { |
||
4552 | var e = this.dataProvider, |
||
4553 | f = e.bottomLatitude; |
||
4554 | c = e.topLatitude; |
||
4555 | "mercator" == e.projection ? (e = this.mercatorLatitudeToCoordinate(f), c = this.mercatorLatitudeToCoordinate(c), c = 2 * d.degreesToRadians(a * (e - c) / b + c), c = d.radiansToDegrees(2 * Math.atan(Math.exp(c)) - .5 * Math.PI)) : c = a / b * (f - c) + c |
||
4556 | } |
||
4557 | return Math.round(1E6 * c) / 1E6 |
||
4558 | }, |
||
4559 | coordinateToLongitude: function(a, b) { |
||
4560 | var c, d = this.dataProvider; |
||
4561 | void 0 === b && (b = this.mapWidth); |
||
4562 | this.mapSet && (c = a / b * (d.rightLongitude - d.leftLongitude) + d.leftLongitude); |
||
4563 | return Math.round(1E6 * c) / 1E6 |
||
4564 | } |
||
4565 | }) |
||
4566 | })(); |
||
4567 | (function() { |
||
4568 | var d = window.AmCharts; |
||
4569 | d.ZoomControl = d.Class({ |
||
4570 | construct: function(a) { |
||
4571 | this.cname = "ZoomControl"; |
||
4572 | this.panStepSize = .1; |
||
4573 | this.zoomFactor = 2; |
||
4574 | this.maxZoomLevel = 64; |
||
4575 | this.minZoomLevel = 1; |
||
4576 | this.panControlEnabled = !1; |
||
4577 | this.zoomControlEnabled = !0; |
||
4578 | this.buttonRollOverColor = "#DADADA"; |
||
4579 | this.buttonFillColor = "#FFFFFF"; |
||
4580 | this.buttonFillAlpha = 1; |
||
4581 | this.buttonBorderColor = "#000000"; |
||
4582 | this.buttonBorderAlpha = .1; |
||
4583 | this.buttonIconAlpha = this.buttonBorderThickness = 1; |
||
4584 | this.gridColor = this.buttonIconColor = "#000000"; |
||
4585 | this.homeIconFile = "homeIcon.gif"; |
||
4586 | this.gridBackgroundColor = "#000000"; |
||
4587 | this.draggerAlpha = this.gridAlpha = this.gridBackgroundAlpha = 0; |
||
4588 | this.draggerSize = this.buttonSize = 31; |
||
4589 | this.iconSize = 11; |
||
4590 | this.homeButtonEnabled = !0; |
||
4591 | this.buttonCornerRadius = 2; |
||
4592 | this.gridHeight = 5; |
||
4593 | this.roundButtons = !0; |
||
4594 | this.top = this.left = 10; |
||
4595 | d.applyTheme(this, a, this.cname) |
||
4596 | }, |
||
4597 | init: function(a, b) { |
||
4598 | var c = this; |
||
4599 | c.chart = a; |
||
4600 | c.zoomControlEnabled = false; |
||
4601 | c.homeButtonEnabled = false; |
||
4602 | c.minZoomLevel = 1; |
||
4603 | c.maxZoomLevel = 1; |
||
4604 | c.zoomFactor = 1; |
||
4605 | d.remove(c.set); |
||
4606 | var e = b.set(); |
||
4607 | d.setCN(a, e, "zoom-control"); |
||
4608 | c.panControlEnabled = false; |
||
4609 | var f = c.buttonSize, |
||
4610 | g = c.zoomControlEnabled, |
||
4611 | h = c.panControlEnabled, |
||
4612 | k = c.buttonFillColor, |
||
4613 | l = c.buttonFillAlpha, |
||
4614 | m = c.buttonBorderThickness, |
||
4615 | n = c.buttonBorderColor, |
||
4616 | p = c.buttonBorderAlpha, |
||
4617 | r = c.buttonCornerRadius, |
||
4618 | t = c.buttonRollOverColor, |
||
4619 | q = c.gridHeight, |
||
4620 | y = c.zoomFactor, |
||
4621 | B = c.minZoomLevel, |
||
4622 | u = c.maxZoomLevel, |
||
4623 | w = c.buttonIconAlpha, |
||
4624 | v = c.buttonIconColor, |
||
4625 | A = c.roundButtons, |
||
4626 | C = a.svgIcons, |
||
4627 | x = a.getX(c.left), |
||
4628 | z = a.getY(c.top); |
||
4629 | isNaN(c.right) || (x = a.getX(c.right, !0), x = h ? x - 3 * f : x - f); |
||
4630 | isNaN(c.bottom) || (z = a.getY(c.bottom, !0), g && (z -= q + 3 * f), z = h ? z - 3 * f : c.homeButtonEnabled ? z - .5 * f : z + f); |
||
4631 | e.translate(x, z); |
||
4632 | c.previousDY = NaN; |
||
4633 | var F, x = f / 4 - 1; |
||
4634 | if (g) { |
||
4635 | F = b.set(); |
||
4636 | d.setCN(a, F, "zoom-control-zoom"); |
||
4637 | e.push(F); |
||
4638 | c.set = e; |
||
4639 | c.zoomSet = F; |
||
4640 | 5 < q && (g = d.rect(b, f + 6, q + 2 * f + 6, c.gridBackgroundColor, c.gridBackgroundAlpha, 0, "#000000", 0, 4), d.setCN(a, g, "zoom-bg"), g.translate(-3, -3), g.mouseup(function() { |
||
4641 | c.handleBgUp() |
||
4642 | }).touchend(function() { |
||
4643 | c.handleBgUp() |
||
4644 | }), F.push(g)); |
||
4645 | var E = f; |
||
4646 | A && (E = f / 1.5); |
||
4647 | c.draggerSize = E; |
||
4648 | var H = Math.log(u / B) / Math.log(y) + 1; |
||
4649 | 1E3 < H && (H = 1E3); |
||
4650 | var g = q / H, |
||
4651 | G, D = b.set(); |
||
4652 | D.translate((f - E) / 2 + 1, 1, NaN, !0); |
||
4653 | F.push(D); |
||
4654 | for (G = 1; G < H; G++) z = f + G * g, z = d.line(b, [1, E - 2], [z, z], c.gridColor, c.gridAlpha, 1), d.setCN(a, z, "zoom-grid"), D.push(z); |
||
4655 | z = new d.SimpleButton; |
||
4656 | z.setDownHandler(c.draggerDown, c); |
||
4657 | z.setClickHandler(c.draggerUp, c); |
||
4658 | z.init(b, E, g, k, l, m, n, p, r, t); |
||
4659 | // d.setCN(a, z.set, "zoom-dragger"); |
||
4660 | F.push(z.set); |
||
4661 | z.set.setAttr("opacity", c.draggerAlpha); |
||
4662 | c.dragger = z.set; |
||
4663 | c.previousY = NaN; |
||
4664 | z = new d.SimpleButton; |
||
4665 | C ? (E = b.set(), H = d.line(b, [-x, x], [0, 0], v, w, 1), G = d.line(b, [0, 0], [-x, x], v, w, 1), E.push(H), E.push(G), z.svgIcon = E) : z.setIcon(a.pathToImages + "plus.gif", c.iconSize); |
||
4666 | z.setClickHandler(a.zoomIn, a); |
||
4667 | z.init(b, f, f, k, l, m, n, p, r, t, w, v, A); |
||
4668 | // d.setCN(a, z.set, "zoom-in"); |
||
4669 | F.push(z.set); |
||
4670 | z = new d.SimpleButton; |
||
4671 | C ? z.svgIcon = d.line(b, [-x, x], [0, 0], v, w, 1) : z.setIcon(a.pathToImages + "minus.gif", c.iconSize); |
||
4672 | z.setClickHandler(a.zoomOut, a); |
||
4673 | z.init(b, f, f, k, l, m, n, p, r, t, w, v, A); |
||
4674 | z.set.translate(0, q + f); |
||
4675 | d.setCN(a, z.set, "zoom-out"); |
||
4676 | F.push(z.set); |
||
4677 | q -= g; |
||
4678 | u = Math.log(u / 100) / Math.log(y); |
||
4679 | c.realStepSize = q / (u - Math.log(B / 100) / Math.log(y)); |
||
4680 | c.realGridHeight = q; |
||
4681 | c.stepMax = u |
||
4682 | } |
||
4683 | h && (h = b.set(), d.setCN(a, h, "zoom-control-pan"), e.push(h), F && F.translate(f, 4 * f), y = new d.SimpleButton, C ? y.svgIcon = d.line(b, [x / 5, -x + x / 5, |
||
4684 | x / 5 |
||
4685 | ], [-x, 0, x], v, w, 1) : y.setIcon(a.pathToImages + "panLeft.gif", c.iconSize), y.setClickHandler(a.moveLeft, a), y.init(b, f, f, k, l, m, n, p, r, t, w, v, A), y.set.translate(0, f), d.setCN(a, y.set, "pan-left"), h.push(y.set), y = new d.SimpleButton, C ? y.svgIcon = d.line(b, [-x / 5, x - x / 5, -x / 5], [-x, 0, x], v, w, 1) : y.setIcon(a.pathToImages + "panRight.gif", c.iconSize), y.setClickHandler(a.moveRight, a), y.init(b, f, f, k, l, m, n, p, r, t, w, v, A), y.set.translate(2 * f, f), d.setCN(a, y.set, "pan-right"), h.push(y.set), y = new d.SimpleButton, C ? y.svgIcon = d.line(b, [-x, 0, x], [x / 5, -x + x / 5, x / 5], v, w, 1) : y.setIcon(a.pathToImages + "panUp.gif", c.iconSize), y.setClickHandler(a.moveUp, a), y.init(b, f, f, k, l, m, n, p, r, t, w, v, A), y.set.translate(f, 0), d.setCN(a, y.set, "pan-up"), h.push(y.set), y = new d.SimpleButton, C ? y.svgIcon = d.line(b, [-x, 0, x], [-x / 5, x - x / 5, -x / 5], v, w, 1) : y.setIcon(a.pathToImages + "panDown.gif", c.iconSize), y.setClickHandler(a.moveDown, a), y.init(b, f, f, k, l, m, n, p, r, t, w, v, A), y.set.translate(f, 2 * f), d.setCN(a, y.set, "pan-down"), h.push(y.set), e.push(h)); |
||
4686 | c.homeButtonEnabled && (h = new d.SimpleButton, C ? h.svgIcon = d.polygon(b, [-x, 0, x, x - 1, x - 1, 2, 2, -2, -2, -x + 1, -x + 1], [0, -x, 0, 0, x - 1, x - 1, 2, 2, x - 1, x - 1, 0], v, w, 1, v, w) : h.setIcon(a.pathToImages + c.homeIconFile, c.iconSize), h.setClickHandler(a.goHome, a), c.panControlEnabled && (p = l = 0), h.init(b, f, f, k, l, m, n, p, r, t, w, v, A), c.panControlEnabled ? h.set.translate(f, f) : F && F.translate(0, 1.5 * f), d.setCN(a, h.set, "pan-home"), e.push(h.set)); |
||
4687 | c.update() |
||
4688 | }, |
||
4689 | draggerDown: function() { |
||
4690 | this.chart.stopDrag(); |
||
4691 | this.isDragging = !0 |
||
4692 | }, |
||
4693 | draggerUp: function() { |
||
4694 | this.isDragging = !1 |
||
4695 | }, |
||
4696 | handleBgUp: function() { |
||
4697 | var a = this.chart; |
||
4698 | a.zoomTo(100 * Math.pow(this.zoomFactor, this.stepMax - (a.mouseY - this.zoomSet.y - this.set.y - this.buttonSize - this.realStepSize / 2) / this.realStepSize)) |
||
4699 | }, |
||
4700 | update: function() { |
||
4701 | var a; |
||
4702 | a = this.zoomFactor; |
||
4703 | var b = this.realStepSize, |
||
4704 | c = this.stepMax, |
||
4705 | e = this.dragger, |
||
4706 | f = this.buttonSize, |
||
4707 | g, h = this.chart; |
||
4708 | h && (this.isDragging ? (h.stopDrag(), g = e.y + (h.mouseY - this.previousY), g = d.fitToBounds(g, f, this.realGridHeight + f), h.zoomTo(100 * Math.pow(a, c - (g - f) / b), NaN, NaN, !0)) : (a = Math.log(h.zoomLevel() / 100) / Math.log(a), g = (c - a) * b + f), this.previousY = |
||
4709 | h.mouseY, this.previousDY != g && e && (e.translate((this.buttonSize - this.draggerSize) / 2, g), this.previousDY = g)) |
||
4710 | } |
||
4711 | }) |
||
4712 | })(); |
||
4713 | (function() { |
||
4714 | var d = window.AmCharts; |
||
4715 | d.SimpleButton = d.Class({ |
||
4716 | construct: function() {}, |
||
4717 | init: function(a, b, c, e, f, g, h, k, l, m, n, p, r) { |
||
4718 | var t = this; |
||
4719 | t.rollOverColor = m; |
||
4720 | t.color = e; |
||
4721 | t.container = a; |
||
4722 | m = a.set(); |
||
4723 | t.set = m; |
||
4724 | r ? (b /= 2, e = d.circle(a, b, e, f, g, h, k), e.translate(b, b)) : e = d.rect(a, b, c, e, f, g, h, k, l); |
||
4725 | m.push(e); |
||
4726 | f = t.iconPath; |
||
4727 | var q; |
||
4728 | f && (q = t.iconSize, g = (b - q) / 2, r && (g = (2 * b - q) / 2), q = a.image(f, g, (c - q) / 2, q, q)); |
||
4729 | t.svgIcon && (q = t.svgIcon, r ? q.translate(b, b) : q.translate(b / 2, b / 2)); |
||
4730 | m.setAttr("cursor", "pointer"); |
||
4731 | q && (m.push(q), q.setAttr("opacity", |
||
4732 | n), q.node.style.pointerEvents = "none"); |
||
4733 | e.mousedown(function() { |
||
4734 | t.handleDown() |
||
4735 | }).touchstart(function() { |
||
4736 | t.handleDown() |
||
4737 | }).mouseup(function() { |
||
4738 | t.handleUp() |
||
4739 | }).touchend(function() { |
||
4740 | t.handleUp() |
||
4741 | }).mouseover(function() { |
||
4742 | t.handleOver() |
||
4743 | }).mouseout(function() { |
||
4744 | t.handleOut() |
||
4745 | }); |
||
4746 | t.bg = e |
||
4747 | }, |
||
4748 | setIcon: function(a, b) { |
||
4749 | this.iconPath = a; |
||
4750 | this.iconSize = b |
||
4751 | }, |
||
4752 | setClickHandler: function(a, b) { |
||
4753 | this.clickHandler = a; |
||
4754 | this.scope = b |
||
4755 | }, |
||
4756 | setDownHandler: function(a, b) { |
||
4757 | this.downHandler = a; |
||
4758 | this.scope = b |
||
4759 | }, |
||
4760 | handleUp: function() { |
||
4761 | var a = this.clickHandler; |
||
4762 | a && a.call(this.scope) |
||
4763 | }, |
||
4764 | handleDown: function() { |
||
4765 | var a = this.downHandler; |
||
4766 | a && a.call(this.scope) |
||
4767 | }, |
||
4768 | handleOver: function() { |
||
4769 | this.container.chart.skipClick = !0; |
||
4770 | this.bg.setAttr("fill", this.rollOverColor) |
||
4771 | }, |
||
4772 | handleOut: function() { |
||
4773 | this.container.chart.skipClick = !1; |
||
4774 | this.bg.setAttr("fill", this.color) |
||
4775 | } |
||
4776 | }) |
||
4777 | })(); |
||
4778 | (function() { |
||
4779 | var d = window.AmCharts; |
||
4780 | d.SmallMap = d.Class({ |
||
4781 | construct: function(a) { |
||
4782 | this.cname = "SmallMap"; |
||
4783 | this.mapColor = "#e6e6e6"; |
||
4784 | this.rectangleColor = "#FFFFFF"; |
||
4785 | this.top = this.right = 10; |
||
4786 | this.minimizeButtonWidth = 23; |
||
4787 | this.backgroundColor = "#9A9A9A"; |
||
4788 | this.backgroundAlpha = 1; |
||
4789 | this.borderColor = "#FFFFFF"; |
||
4790 | this.iconColor = "#000000"; |
||
4791 | this.borderThickness = 3; |
||
4792 | this.borderAlpha = 1; |
||
4793 | this.size = .2; |
||
4794 | this.enabled = !0; |
||
4795 | d.applyTheme(this, a, this.cname) |
||
4796 | }, |
||
4797 | init: function(a, b) { |
||
4798 | var c = this; |
||
4799 | if (c.enabled) { |
||
4800 | c.chart = a; |
||
4801 | c.container = b; |
||
4802 | c.width = a.realWidth * c.size; |
||
4803 | c.height = a.realHeight * c.size; |
||
4804 | d.remove(c.mapSet); |
||
4805 | d.remove(c.allSet); |
||
4806 | d.remove(c.set); |
||
4807 | var e = b.set(); |
||
4808 | c.set = e; |
||
4809 | d.setCN(a, e, "small-map"); |
||
4810 | var f = b.set(); |
||
4811 | c.allSet = f; |
||
4812 | e.push(f); |
||
4813 | c.buildSVGMap(); |
||
4814 | var g = c.borderThickness, |
||
4815 | h = c.borderColor, |
||
4816 | k = d.rect(b, c.width + g, c.height + g, c.backgroundColor, c.backgroundAlpha, g, h, c.borderAlpha); |
||
4817 | d.setCN(a, k, "small-map-bg"); |
||
4818 | k.translate(-g / 2, -g / 2); |
||
4819 | f.push(k); |
||
4820 | k.toBack(); |
||
4821 | var l, m, k = c.minimizeButtonWidth, |
||
4822 | n = new d.SimpleButton, |
||
4823 | p = k / 2; |
||
4824 | a.svgIcons ? n.svgIcon = d.line(b, [-p / 2, 0, p / 2], [-p / 4, p / 4, -p / |
||
4825 | 4 |
||
4826 | ], c.iconColor, 1, 1) : n.setIcon(a.pathToImages + "arrowDown.gif", k); |
||
4827 | n.setClickHandler(c.minimize, c); |
||
4828 | n.init(b, k, k, h, 1, 1, h, 1); |
||
4829 | d.setCN(a, n.set, "small-map-down"); |
||
4830 | n = n.set; |
||
4831 | c.downButtonSet = n; |
||
4832 | e.push(n); |
||
4833 | var r = new d.SimpleButton; |
||
4834 | a.svgIcons ? r.svgIcon = d.line(b, [-p / 2, 0, p / 2], [p / 4, -p / 4, p / 4], c.iconColor, 1, 1) : r.setIcon(a.pathToImages + "arrowUp.gif", k); |
||
4835 | r.setClickHandler(c.maximize, c); |
||
4836 | r.init(b, k, k, h, 1, 1, h, 1); |
||
4837 | d.setCN(a, r.set, "small-map-up"); |
||
4838 | h = r.set; |
||
4839 | c.upButtonSet = h; |
||
4840 | h.hide(); |
||
4841 | e.push(h); |
||
4842 | var t, q; |
||
4843 | isNaN(c.top) || (l = a.getY(c.top) + |
||
4844 | g, q = 0); |
||
4845 | isNaN(c.bottom) || (l = a.getY(c.bottom, !0) - c.height - g, q = c.height - k + g / 2); |
||
4846 | isNaN(c.left) || (m = a.getX(c.left) + g, t = -g / 2); |
||
4847 | isNaN(c.right) || (m = a.getX(c.right, !0) - c.width - g, t = c.width - k + g / 2); |
||
4848 | g = b.set(); |
||
4849 | g.clipRect(1, 1, c.width, c.height); |
||
4850 | f.push(g); |
||
4851 | c.rectangleC = g; |
||
4852 | e.translate(m, l); |
||
4853 | n.translate(t, q); |
||
4854 | h.translate(t, q); |
||
4855 | f.mouseup(function() { |
||
4856 | c.handleMouseUp() |
||
4857 | }); |
||
4858 | c.drawRectangle() |
||
4859 | } else d.remove(c.allSet), d.remove(c.downButtonSet), d.remove(c.upButtonSet) |
||
4860 | }, |
||
4861 | minimize: function() { |
||
4862 | this.downButtonSet.hide(); |
||
4863 | this.upButtonSet.show(); |
||
4864 | this.allSet.hide() |
||
4865 | }, |
||
4866 | maximize: function() { |
||
4867 | this.downButtonSet.show(); |
||
4868 | this.upButtonSet.hide(); |
||
4869 | this.allSet.show() |
||
4870 | }, |
||
4871 | buildSVGMap: function() { |
||
4872 | var a = this.chart, |
||
4873 | b = { |
||
4874 | fill: this.mapColor, |
||
4875 | stroke: this.mapColor, |
||
4876 | "stroke-opacity": 1 |
||
4877 | }, |
||
4878 | c = this.container, |
||
4879 | e = c.set(); |
||
4880 | d.setCN(a, e, "small-map-image"); |
||
4881 | var f; |
||
4882 | for (f = 0; f < a.svgAreas.length; f++) { |
||
4883 | var g = c.path(a.svgAreas[f].path).attr(b); |
||
4884 | e.push(g) |
||
4885 | } |
||
4886 | this.allSet.push(e); |
||
4887 | b = e.getBBox(); |
||
4888 | c = this.size * a.mapScale; |
||
4889 | f = -b.x * c; |
||
4890 | var g = -b.y * c, |
||
4891 | h = 0, |
||
4892 | k = 0; |
||
4893 | a.centerMap && (h = (this.width - b.width * c) / 2, k = (this.height - |
||
4894 | b.height * c) / 2); |
||
4895 | this.mapWidth = b.width * c; |
||
4896 | this.mapHeight = b.height * c; |
||
4897 | f += h; |
||
4898 | g += k; |
||
4899 | this.dx = h; |
||
4900 | this.dy = k; |
||
4901 | e.translate(f, g, c); |
||
4902 | this.mapSet = e; |
||
4903 | this.mapX = f; |
||
4904 | this.mapY = g |
||
4905 | }, |
||
4906 | update: function() { |
||
4907 | var a = this.chart; |
||
4908 | if (a) { |
||
4909 | var b = a.zoomLevel(), |
||
4910 | c = this.width, |
||
4911 | d = this.height, |
||
4912 | f = c / (a.realWidth * b), |
||
4913 | g = a.mapContainer.getBBox(), |
||
4914 | c = c / b, |
||
4915 | d = d / b, |
||
4916 | h = this.rectangle; |
||
4917 | h.translate(-(a.mapContainer.x + g.x * b) * f + this.dx, -(a.mapContainer.y + g.y * b) * f + this.dy); |
||
4918 | 0 < c && 0 < d && (h.setAttr("width", Math.ceil(c + 1)), h.setAttr("height", Math.ceil(d + 1))); |
||
4919 | this.rWidth = c; |
||
4920 | this.rHeight = |
||
4921 | d |
||
4922 | } |
||
4923 | }, |
||
4924 | drawRectangle: function() { |
||
4925 | var a = this.rectangle; |
||
4926 | d.remove(a); |
||
4927 | a = d.rect(this.container, 10, 10, "#000", 0, 1, this.rectangleColor, 1); |
||
4928 | d.setCN(this.chart, a, "small-map-rectangle"); |
||
4929 | this.rectangleC.push(a); |
||
4930 | this.rectangle = a |
||
4931 | }, |
||
4932 | handleMouseUp: function() { |
||
4933 | var a = this.chart, |
||
4934 | b = a.zoomLevel(); |
||
4935 | a.zoomToMapXY(b, (a.mouseX - this.set.x - this.mapX) / this.size + a.diffX * a.mapScale, (a.mouseY - this.set.y - this.mapY) / this.size + a.diffY * a.mapScale) |
||
4936 | } |
||
4937 | }) |
||
4938 | })(); |
||
4939 | (function() { |
||
4940 | var d = window.AmCharts; |
||
4941 | d.AreasProcessor = d.Class({ |
||
4942 | construct: function(a) { |
||
4943 | this.chart = a |
||
4944 | }, |
||
4945 | process: function(a) { |
||
4946 | this.updateAllAreas(); |
||
4947 | this.allObjects = []; |
||
4948 | a = a.areas; |
||
4949 | var b = this.chart; |
||
4950 | b.outlines = []; |
||
4951 | var c = a.length, |
||
4952 | d, f, g = 0, |
||
4953 | h = !1, |
||
4954 | k = !1, |
||
4955 | l = 0; |
||
4956 | for (d = 0; d < c; d++) |
||
4957 | if (f = a[d], f.value = Number(f.value), f = f.value, !isNaN(f)) { |
||
4958 | if (!1 === h || h < f) h = f; |
||
4959 | if (!1 === k || k > f) k = f; |
||
4960 | g += Math.abs(f); |
||
4961 | l++ |
||
4962 | } |
||
4963 | this.minValue = k; |
||
4964 | this.maxValue = h; |
||
4965 | isNaN(b.minValue) || (this.minValue = b.minValue); |
||
4966 | isNaN(b.maxValue) || (this.maxValue = b.maxValue); |
||
4967 | b.maxValueReal = |
||
4968 | h; |
||
4969 | b.minValueReal = k; |
||
4970 | for (d = 0; d < c; d++) f = a[d], isNaN(f.value) ? f.percents = void 0 : (f.percents = (f.value - k) / g * 100, k == h && (f.percents = 100)); |
||
4971 | for (d = 0; d < c; d++) f = a[d], this.createArea(f); |
||
4972 | b.outlinesToFront() |
||
4973 | }, |
||
4974 | updateAllAreas: function() { |
||
4975 | var a = this.chart, |
||
4976 | b = a.areasSettings, |
||
4977 | c = b.unlistedAreasColor, |
||
4978 | e = b.unlistedAreasAlpha, |
||
4979 | f = b.unlistedAreasOutlineColor, |
||
4980 | g = b.unlistedAreasOutlineAlpha, |
||
4981 | h = a.svgAreas, |
||
4982 | k = a.dataProvider, |
||
4983 | l = k.areas, |
||
4984 | m = {}, |
||
4985 | n; |
||
4986 | for (n = 0; n < l.length; n++) m[l[n].id] = l[n]; |
||
4987 | for (n = 0; n < h.length; n++) { |
||
4988 | l = h[n]; |
||
4989 | if (b.preserveOriginalAttributes) { |
||
4990 | if (l.customAttr) |
||
4991 | for (var p in l.customAttr) l.setAttr(p, |
||
4992 | l.customAttr[p]) |
||
4993 | } else { |
||
4994 | void 0 != c && l.setAttr("fill", c); |
||
4995 | isNaN(e) || l.setAttr("fill-opacity", e); |
||
4996 | void 0 != f && l.setAttr("stroke", f); |
||
4997 | isNaN(g) || l.setAttr("stroke-opacity", g); |
||
4998 | var r = b.outlineThickness; |
||
4999 | b.adjustOutlineThickness && (r = r / a.zoomLevel() / a.mapScale); |
||
5000 | l.setAttr("stroke-width", r) |
||
5001 | } |
||
5002 | d.setCN(a, l, "map-area-unlisted"); |
||
5003 | k.getAreasFromMap && !m[l.id] && (r = new d.MapArea(a.theme), r.parentObject = k, r.id = l.id, r.outline = l.outline, k.areas.push(r)) |
||
5004 | } |
||
5005 | }, |
||
5006 | createArea: function(a) { |
||
5007 | var b = this.chart, |
||
5008 | c = b.svgAreasById[a.id], |
||
5009 | e = b.areasSettings; |
||
5010 | if (c && c.className) { |
||
5011 | var f = b.areasClasses[c.className]; |
||
5012 | f && (e = d.processObject(f, d.AreasSettings, b.theme)) |
||
5013 | } |
||
5014 | var g = e.color, |
||
5015 | h = e.alpha, |
||
5016 | k = e.outlineThickness, |
||
5017 | l = e.rollOverColor, |
||
5018 | m = e.selectedColor, |
||
5019 | n = e.rollOverAlpha, |
||
5020 | p = e.rollOverBrightness, |
||
5021 | r = e.outlineColor, |
||
5022 | t = e.outlineAlpha, |
||
5023 | q = e.balloonText, |
||
5024 | y = e.selectable, |
||
5025 | B = e.pattern, |
||
5026 | u = e.rollOverOutlineColor, |
||
5027 | w = e.bringForwardOnHover, |
||
5028 | v = e.preserveOriginalAttributes; |
||
5029 | this.allObjects.push(a); |
||
5030 | a.chart = b; |
||
5031 | a.baseSettings = e; |
||
5032 | a.autoZoomReal = void 0 == a.autoZoom ? e.autoZoom : a.autoZoom; |
||
5033 | f = a.color; |
||
5034 | void 0 == f && (f = g); |
||
5035 | var A = a.alpha; |
||
5036 | isNaN(A) && (A = h); |
||
5037 | h = a.rollOverAlpha; |
||
5038 | isNaN(h) && (h = n); |
||
5039 | isNaN(h) && (h = A); |
||
5040 | n = a.rollOverColor; |
||
5041 | void 0 == n && (n = l); |
||
5042 | l = a.pattern; |
||
5043 | void 0 == l && (l = B); |
||
5044 | B = a.selectedColor; |
||
5045 | void 0 == B && (B = m); |
||
5046 | m = a.balloonText; |
||
5047 | void 0 === m && (m = q); |
||
5048 | void 0 == e.colorSolid || isNaN(a.value) || (q = Math.floor((a.value - this.minValue) / ((this.maxValue - this.minValue) / b.colorSteps)), q == b.colorSteps && q--, q *= 1 / (b.colorSteps - 1), this.maxValue == this.minValue && (q = 1), a.colorReal = d.getColorFade(f, e.colorSolid, q)); |
||
5049 | void 0 != a.color && (a.colorReal = a.color); |
||
5050 | void 0 == a.selectable && (a.selectable = y); |
||
5051 | void 0 == a.colorReal && (a.colorReal = g); |
||
5052 | g = a.outlineColor; |
||
5053 | void 0 == g && (g = r); |
||
5054 | r = a.outlineAlpha; |
||
5055 | isNaN(r) && (r = t); |
||
5056 | t = a.outlineThickness; |
||
5057 | isNaN(t) && (t = k); |
||
5058 | k = a.rollOverOutlineColor; |
||
5059 | void 0 == k && (k = u); |
||
5060 | u = a.rollOverBrightness; |
||
5061 | void 0 == u && (u = p); |
||
5062 | void 0 == a.bringForwardOnHover && (a.bringForwardOnHover = w); |
||
5063 | void 0 == a.preserveOriginalAttributes && (a.preserveOriginalAttributes = v); |
||
5064 | isNaN(e.selectedBrightness) || (B = d.adjustLuminosity(a.colorReal, e.selectedBrightness / 100)); |
||
5065 | a.alphaReal = A; |
||
5066 | a.rollOverColorReal = n; |
||
5067 | a.rollOverAlphaReal = h; |
||
5068 | a.balloonTextReal = m; |
||
5069 | a.selectedColorReal = B; |
||
5070 | a.outlineColorReal = g; |
||
5071 | a.outlineAlphaReal = r; |
||
5072 | a.rollOverOutlineColorReal = k; |
||
5073 | a.outlineThicknessReal = t; |
||
5074 | a.patternReal = l; |
||
5075 | a.rollOverBrightnessReal = u; |
||
5076 | a.accessibleLabel || (a.accessibleLabel = e.accessibleLabel); |
||
5077 | d.processDescriptionWindow(e, a); |
||
5078 | if (c && (p = c.area, w = c.title, a.enTitle = c.title, w && !a.title && (a.title = w), (c = b.language) ? (w = d.mapTranslations) && (c = w[c]) && c[a.enTitle] && (a.titleTr = c[a.enTitle]) : a.titleTr = void 0, p)) { |
||
5079 | c = a.tabIndex; |
||
5080 | void 0 === c && (c = e.tabIndex); |
||
5081 | void 0 !== c && p.setAttr("tabindex", c); |
||
5082 | a.displayObject = p; |
||
5083 | a.outline && (A = 0, a.alphaReal = 0, a.rollOverAlphaReal = 0, a.mouseEnabled = !1, b.outlines.push(p), p.node.setAttribute("pointer-events", "none")); |
||
5084 | a.mouseEnabled && b.addObjectEventListeners(p, a); |
||
5085 | var C; |
||
5086 | void 0 != f && (C = f); |
||
5087 | void 0 != a.colorReal && (C = a.showAsSelected || b.selectedObject == a ? a.selectedColorReal : a.colorReal); |
||
5088 | p.node.setAttribute("class", ""); |
||
5089 | d.setCN(b, p, "map-area"); |
||
5090 | d.setCN(b, p, "map-area-" + p.id); |
||
5091 | e.adjustOutlineThickness && (t = t / b.zoomLevel() / b.mapScale); |
||
5092 | a.preserveOriginalAttributes || |
||
5093 | (p.setAttr("fill", C), p.setAttr("stroke", g), p.setAttr("stroke-opacity", r), p.setAttr("stroke-width", t), p.setAttr("fill-opacity", A)); |
||
5094 | b.makeObjectAccessible(a); |
||
5095 | l && p.pattern(l, b.mapScale, b.path); |
||
5096 | a.hidden && p.hide() |
||
5097 | } |
||
5098 | } |
||
5099 | }) |
||
5100 | })(); |
||
5101 | (function() { |
||
5102 | var d = window.AmCharts; |
||
5103 | d.AreasSettings = d.Class({ |
||
5104 | construct: function(a) { |
||
5105 | this.cname = "AreasSettings"; |
||
5106 | this.alpha = 1; |
||
5107 | this.autoZoom = !1; |
||
5108 | this.balloonText = "[[title]]"; |
||
5109 | this.color = "#FFCC00"; |
||
5110 | this.colorSolid = "#990000"; |
||
5111 | this.unlistedAreasAlpha = 1; |
||
5112 | this.unlistedAreasColor = "#DDDDDD"; |
||
5113 | this.outlineColor = "#FFFFFF"; |
||
5114 | this.outlineThickness = this.outlineAlpha = 1; |
||
5115 | this.selectedColor = this.rollOverOutlineColor = "#CC0000"; |
||
5116 | this.unlistedAreasOutlineColor = "#FFFFFF"; |
||
5117 | this.unlistedAreasOutlineAlpha = 1; |
||
5118 | this.descriptionWindowWidth = 250; |
||
5119 | this.bringForwardOnHover = this.adjustOutlineThickness = !0; |
||
5120 | this.accessibleLabel = "[[title]] [[value]] [[description]]"; |
||
5121 | d.applyTheme(this, a, this.cname) |
||
5122 | } |
||
5123 | }) |
||
5124 | })(); |
||
5125 | (function() { |
||
5126 | var d = window.AmCharts; |
||
5127 | d.ImagesProcessor = d.Class({ |
||
5128 | construct: function(a) { |
||
5129 | this.chart = a; |
||
5130 | this.reset() |
||
5131 | }, |
||
5132 | process: function(a) { |
||
5133 | var b = a.images, |
||
5134 | c; |
||
5135 | for (c = b.length - 1; 0 <= c; c--) { |
||
5136 | var d = b[c]; |
||
5137 | this.createImage(d, c); |
||
5138 | d.parentArray = b |
||
5139 | } |
||
5140 | this.counter = c; |
||
5141 | a.parentObject && a.remainVisible && this.process(a.parentObject) |
||
5142 | }, |
||
5143 | createImage: function(a, b) { |
||
5144 | a = d.processObject(a, d.MapImage); |
||
5145 | a.arrays = []; |
||
5146 | isNaN(b) && (this.counter++, b = this.counter); |
||
5147 | var c = this.chart, |
||
5148 | e = c.container, |
||
5149 | f = c.mapImagesContainer, |
||
5150 | g = c.stageImagesContainer, |
||
5151 | h = c.imagesSettings; |
||
5152 | a.remove && a.remove(); |
||
5153 | var k = h.color, |
||
5154 | l = h.alpha, |
||
5155 | m = h.rollOverColor, |
||
5156 | n = h.rollOverOutlineColor, |
||
5157 | p = h.selectedColor, |
||
5158 | r = h.balloonText, |
||
5159 | t = h.outlineColor, |
||
5160 | q = h.outlineAlpha, |
||
5161 | y = h.outlineThickness, |
||
5162 | B = h.selectedScale, |
||
5163 | u = h.rollOverScale, |
||
5164 | w = h.selectable, |
||
5165 | v = h.labelPosition, |
||
5166 | A = h.labelColor, |
||
5167 | C = h.labelFontSize, |
||
5168 | x = h.bringForwardOnHover, |
||
5169 | z = h.labelRollOverColor, |
||
5170 | F = h.rollOverBrightness, |
||
5171 | E = h.selectedLabelColor; |
||
5172 | a.index = b; |
||
5173 | a.chart = c; |
||
5174 | a.baseSettings = c.imagesSettings; |
||
5175 | var H = e.set(); |
||
5176 | a.displayObject = H; |
||
5177 | var G = a.color; |
||
5178 | void 0 == G && (G = k); |
||
5179 | k = a.alpha; |
||
5180 | isNaN(k) && (k = l); |
||
5181 | void 0 == a.bringForwardOnHover && (a.bringForwardOnHover = x); |
||
5182 | l = a.outlineAlpha; |
||
5183 | isNaN(l) && (l = q); |
||
5184 | q = a.rollOverColor; |
||
5185 | void 0 == q && (q = m); |
||
5186 | m = a.selectedColor; |
||
5187 | void 0 == m && (m = p); |
||
5188 | p = a.balloonText; |
||
5189 | void 0 === p && (p = r); |
||
5190 | r = a.outlineColor; |
||
5191 | void 0 == r && (r = t); |
||
5192 | a.outlineColorReal = r; |
||
5193 | t = a.outlineThickness; |
||
5194 | isNaN(t) && (t = y); |
||
5195 | (y = a.labelPosition) || (y = v); |
||
5196 | v = a.labelColor; |
||
5197 | void 0 == v && (v = A); |
||
5198 | A = a.labelRollOverColor; |
||
5199 | void 0 == A && (A = z); |
||
5200 | z = a.selectedLabelColor; |
||
5201 | void 0 == z && (z = E); |
||
5202 | E = a.labelFontSize; |
||
5203 | isNaN(E) && (E = C); |
||
5204 | C = a.selectedScale; |
||
5205 | isNaN(C) && (C = B); |
||
5206 | B = a.rollOverScale; |
||
5207 | isNaN(B) && (B = u); |
||
5208 | u = a.rollOverBrightness; |
||
5209 | void 0 == u && (u = F); |
||
5210 | void 0 == a.selectable && (a.selectable = w); |
||
5211 | a.colorReal = G; |
||
5212 | isNaN(h.selectedBrightness) || (m = d.adjustLuminosity(a.colorReal, h.selectedBrightness / 100)); |
||
5213 | a.alphaReal = k; |
||
5214 | a.rollOverColorReal = q; |
||
5215 | a.balloonTextReal = p; |
||
5216 | a.selectedColorReal = m; |
||
5217 | a.labelColorReal = v; |
||
5218 | a.labelRollOverColorReal = A; |
||
5219 | a.selectedLabelColorReal = z; |
||
5220 | a.labelFontSizeReal = E; |
||
5221 | a.labelPositionReal = y; |
||
5222 | a.selectedScaleReal = C; |
||
5223 | a.rollOverScaleReal = B; |
||
5224 | a.rollOverOutlineColorReal = n; |
||
5225 | a.rollOverBrightnessReal = u; |
||
5226 | a.accessibleLabel || (a.accessibleLabel = h.accessibleLabel); |
||
5227 | d.processDescriptionWindow(h, a); |
||
5228 | a.centeredReal = void 0 == a.centered ? h.centered : a.centered; |
||
5229 | n = a.type; |
||
5230 | u = a.imageURL; |
||
5231 | B = a.svgPath; |
||
5232 | C = a.width; |
||
5233 | E = a.height; |
||
5234 | w = a.scale; |
||
5235 | isNaN(a.percentWidth) || (C = a.percentWidth / 100 * c.realWidth); |
||
5236 | isNaN(a.percentHeight) || (E = a.percentHeight / 100 * c.realHeight); |
||
5237 | var D; |
||
5238 | u || n || B || (n = "circle", C = 1, l = k = 0); |
||
5239 | q = F = 0; |
||
5240 | h = a.selectedColorReal; |
||
5241 | if (n) { |
||
5242 | isNaN(C) && (C = 10); |
||
5243 | isNaN(E) && (E = 10); |
||
5244 | "kilometers" == a.widthAndHeightUnits && (C = c.kilometersToPixels(a.width), E = c.kilometersToPixels(a.height)); |
||
5245 | "miles" == a.widthAndHeightUnits && (C = c.milesToPixels(a.width), E = c.milesToPixels(a.height)); |
||
5246 | if ("circle" == n || "bubble" == n) E = C; |
||
5247 | D = this.createPredefinedImage(G, r, t, n, C, E); |
||
5248 | q = F = 0; |
||
5249 | a.centeredReal ? (isNaN(a.right) || (F = C * w), isNaN(a.bottom) || (q = E * w)) : (F = C * w / 2, q = E * w / 2); |
||
5250 | D.translate(F, q, w, !0) |
||
5251 | } else u ? (isNaN(C) && (C = 10), isNaN(E) && (E = 10), D = e.image(u, 0, 0, C, E), D.node.setAttribute("preserveAspectRatio", "none"), D.setAttr("opacity", k), a.centeredReal && (F = isNaN(a.right) ? -C / 2 : C / 2, q = isNaN(a.bottom) ? -E / 2 : E / 2, D.translate(F, q, NaN, !0))) : B && (D = e.path(B), u = D.getBBox(), a.centeredReal ? (F = -u.x * w - u.width * w / 2, isNaN(a.right) || (F = -F), q = -u.y * w - u.height * w / 2, isNaN(a.bottom) || (q = -q)) : F = q = 0, D.translate(F, q, w, !0), D.x = F, D.y = q); |
||
5252 | D && (H.push(D), a.image = D, D.setAttr("stroke-opacity", l), D.setAttr("stroke-width", t), D.setAttr("stroke", r), D.setAttr("fill-opacity", k), "bubble" != n && D.setAttr("fill", G), d.setCN(c, D, "map-image"), void 0 != a.id && d.setCN(c, D, "map-image-" + a.id)); |
||
5253 | G = a.labelColorReal; |
||
5254 | !a.showAsSelected && c.selectedObject != a || void 0 == h || (D && D.setAttr("fill", h), G = a.selectedLabelColorReal); |
||
5255 | D = null; |
||
5256 | void 0 !== a.label && (D = d.text(e, a.label, G, c.fontFamily, a.labelFontSizeReal, a.labelAlign), d.setCN(c, D, "map-image-label"), void 0 !== a.id && d.setCN(c, D, "map-image-label-" + a.id), G = a.labelBackgroundAlpha, (k = a.labelBackgroundColor) && 0 < G && (l = D.getBBox(), e = d.rect(e, l.width + 16, l.height + 10, k, G), d.setCN(c, e, "map-image-label-background"), void 0 != a.id && d.setCN(c, e, "map-image-label-background-" + a.id), H.push(e), a.labelBG = e), a.imageLabel = D, H.push(D), d.setCN(c, H, "map-image-container"), void 0 != a.id && d.setCN(c, H, "map-image-container-" + a.id), this.labelsToReposition.push(a), a.arrays.push({ |
||
5257 | arr: this.labelsToReposition, |
||
5258 | el: a |
||
5259 | })); |
||
5260 | e = isNaN(a.latitude) || isNaN(a.longitude) ? !0 : !1; |
||
5261 | a.lineId && (D = this.chart.getObjectById(a.lineId)) && 0 < D.longitudes.length && (e = !1); |
||
5262 | e ? g.push(H) : f.push(H); |
||
5263 | H.toBack(); |
||
5264 | H && (H.rotation = a.rotation, isNaN(a.rotation) || H.rotate(a.rotation), a.arrays.push({ |
||
5265 | arr: this.allSvgObjects, |
||
5266 | el: H |
||
5267 | }), this.allSvgObjects.push(H)); |
||
5268 | this.allObjects.push(a); |
||
5269 | c.makeObjectAccessible(a); |
||
5270 | f = a.tabIndex; |
||
5271 | void 0 === f && (f = c.imagesSettings.tabIndex); |
||
5272 | void 0 !== f && H.setAttr("tabindex", f); |
||
5273 | a.arrays.push({ |
||
5274 | arr: this.allObjects, |
||
5275 | el: a |
||
5276 | }); |
||
5277 | isNaN(a.longitude) || isNaN(a.latitude) || !a.fixedSize || (a.objToResize = { |
||
5278 | image: H, |
||
5279 | mapImage: a, |
||
5280 | scale: 1 |
||
5281 | }, this.objectsToResize.push(a.objToResize), a.arrays.push({ |
||
5282 | arr: this.objectsToResize, |
||
5283 | el: a.objToResize |
||
5284 | })); |
||
5285 | this.updateSizeAndPosition(a); |
||
5286 | a.mouseEnabled && c.addObjectEventListeners(H, a); |
||
5287 | a.hidden && H.hide(); |
||
5288 | d.removeFromArray(c.updatableImages, a); |
||
5289 | a.animateAlongLine && (c.updatableImages.push(a), a.delayAnimateAlong()); |
||
5290 | return a |
||
5291 | }, |
||
5292 | updateSizeAndPosition: function(a) { |
||
5293 | var b = this.chart, |
||
5294 | c = a.displayObject, |
||
5295 | e = b.getX(a.left), |
||
5296 | f = b.getY(a.top), |
||
5297 | g, h = a.image.getBBox(); |
||
5298 | isNaN(a.right) || (e = b.getX(a.right, !0) - h.width * a.scale); |
||
5299 | isNaN(a.bottom) || (f = b.getY(a.bottom, !0) - h.height * a.scale); |
||
5300 | var k = a.longitude, |
||
5301 | l = a.latitude, |
||
5302 | m = a.positionOnLine, |
||
5303 | h = a.imageLabel, |
||
5304 | n = this.chart.zoomLevel(), |
||
5305 | p, r; |
||
5306 | a.lineId && (a.line = this.chart.getObjectById(a.lineId)); |
||
5307 | if (a.line && a.line.getCoordinates) { |
||
5308 | a.line.chart = b; |
||
5309 | var t = a.line.getCoordinates(m, a.lineSegment); |
||
5310 | t && (k = b.coordinateToLongitude(t.x), l = b.coordinateToLatitude(t.y), p = t.x, r = t.y, a.animateAngle && (g = d.radiansToDegrees(t.angle))) |
||
5311 | } |
||
5312 | isNaN(g) || c.rotate(g + a.extraAngle); |
||
5313 | if (!isNaN(e) && !isNaN(f)) c.translate(e, f, NaN, !0); |
||
5314 | else if (!isNaN(l) && !isNaN(k)) |
||
5315 | if (f = b.coordinatesToXY(k, l), e = f.x, f = f.y, isNaN(p) || (e = p), isNaN(r) || (f = r), a.fixedSize) { |
||
5316 | p = a.positionScale; |
||
5317 | isNaN(p) ? p = 0 : (--p, p *= 1 - 2 * Math.abs(m - .5)); |
||
5318 | if (m = a.objectToResize) m.scale = 1 + p; |
||
5319 | c.translate(e, f, 1 / n + p, !0) |
||
5320 | } else c.translate(e, f, NaN, !0); |
||
5321 | this.positionLabel(h, a, a.labelPositionReal) |
||
5322 | }, |
||
5323 | positionLabel: function(a, b, c) { |
||
5324 | if (a) { |
||
5325 | var d = b.image, |
||
5326 | f = 0, |
||
5327 | g = 0, |
||
5328 | h = 0, |
||
5329 | k = 0; |
||
5330 | d && (k = d.getBBox(), g = d.y + k.y, f = d.x + k.x, h = k.width, k = k.height, b.svgPath && (h *= b.scale, k *= b.scale)); |
||
5331 | var d = a.getBBox(), |
||
5332 | l = d.width, |
||
5333 | m = d.height; |
||
5334 | "right" == c && (f += h + l / 2 + 5, g += k / 2 - 2); |
||
5335 | "left" == c && (f += -l / 2 - 5, g += k / 2 - 2); |
||
5336 | "top" == c && (g -= m / 2 + 3, f += h / 2); |
||
5337 | "bottom" == c && (g += k + m / 2, f += h / 2); |
||
5338 | "middle" == c && (f += h / 2, g += k / 2); |
||
5339 | a.translate(f + b.labelShiftX, g + b.labelShiftY, NaN, !0); |
||
5340 | a = b.labelFontSizeReal; |
||
5341 | b.labelBG && b.labelBG.translate(f - d.width / 2 + b.labelShiftX - 9, g - a / 2 + b.labelShiftY - |
||
5342 | 4, NaN, !0) |
||
5343 | } |
||
5344 | }, |
||
5345 | createPredefinedImage: function(a, b, c, e, f, g) { |
||
5346 | var h = this.chart.container, |
||
5347 | k; |
||
5348 | switch (e) { |
||
5349 | case "circle": |
||
5350 | k = d.circle(h, f / 2, a, 1, c, b, 1); |
||
5351 | break; |
||
5352 | case "rectangle": |
||
5353 | k = d.polygon(h, [-f / 2, f / 2, f / 2, -f / 2], [g / 2, g / 2, -g / 2, -g / 2], a, 1, c, b, 1, 0, !0); |
||
5354 | break; |
||
5355 | case "bubble": |
||
5356 | k = d.circle(h, f / 2, a, 1, c, b, 1, !0); |
||
5357 | break; |
||
5358 | case "hexagon": |
||
5359 | f /= Math.sqrt(3), k = d.polygon(h, [.866 * f, 0 * f, -.866 * f, -.866 * f, 0 * f, .866 * f], [.5 * f, 1 * f, .5 * f, -.5 * f, -1 * f, -.5 * f], a, 1, c, b, 1) |
||
5360 | } |
||
5361 | return k |
||
5362 | }, |
||
5363 | reset: function() { |
||
5364 | this.objectsToResize = []; |
||
5365 | this.allSvgObjects = []; |
||
5366 | this.allObjects = []; |
||
5367 | this.allLabels = []; |
||
5368 | this.labelsToReposition = [] |
||
5369 | } |
||
5370 | }) |
||
5371 | })(); |
||
5372 | (function() { |
||
5373 | var d = window.AmCharts; |
||
5374 | d.ImagesSettings = d.Class({ |
||
5375 | construct: function(a) { |
||
5376 | this.cname = "ImagesSettings"; |
||
5377 | this.balloonText = "[[title]]"; |
||
5378 | this.alpha = 1; |
||
5379 | this.borderAlpha = 0; |
||
5380 | this.borderThickness = 1; |
||
5381 | this.labelPosition = "right"; |
||
5382 | this.labelColor = "#000000"; |
||
5383 | this.labelFontSize = 11; |
||
5384 | this.color = "#000000"; |
||
5385 | this.labelRollOverColor = "#00CC00"; |
||
5386 | this.centered = !0; |
||
5387 | this.rollOverScale = this.selectedScale = 1; |
||
5388 | this.descriptionWindowWidth = 250; |
||
5389 | this.bringForwardOnHover = !0; |
||
5390 | this.outlineColor = "transparent"; |
||
5391 | this.adjustAnimationSpeed = !1; |
||
5392 | this.baseAnimationDistance = 500; |
||
5393 | this.pauseDuration = 0; |
||
5394 | this.easingFunction = d.easeInOutQuad; |
||
5395 | this.animationDuration = 3; |
||
5396 | this.positionScale = 1; |
||
5397 | this.accessibleLabel = "[[title]] [[description]]"; |
||
5398 | d.applyTheme(this, a, this.cname) |
||
5399 | } |
||
5400 | }) |
||
5401 | })(); |
||
5402 | (function() { |
||
5403 | var d = window.AmCharts; |
||
5404 | d.LinesProcessor = d.Class({ |
||
5405 | construct: function(a) { |
||
5406 | this.chart = a; |
||
5407 | this.reset() |
||
5408 | }, |
||
5409 | process: function(a) { |
||
5410 | var b = a.lines, |
||
5411 | c; |
||
5412 | for (c = 0; c < b.length; c++) { |
||
5413 | var d = b[c]; |
||
5414 | this.createLine(d, c); |
||
5415 | d.parentArray = b |
||
5416 | } |
||
5417 | this.counter = c; |
||
5418 | a.parentObject && a.remainVisible && this.process(a.parentObject) |
||
5419 | }, |
||
5420 | createLine: function(a, b) { |
||
5421 | a = d.processObject(a, d.MapLine); |
||
5422 | isNaN(b) && (this.counter++, b = this.counter); |
||
5423 | a.index = b; |
||
5424 | a.remove && a.remove(); |
||
5425 | var c = this.chart, |
||
5426 | e = c.linesSettings, |
||
5427 | f = this.objectsToResize, |
||
5428 | g = c.mapLinesContainer, |
||
5429 | h = c.stageLinesContainer, |
||
5430 | k = e.thickness, |
||
5431 | l = e.dashLength, |
||
5432 | m = e.arrow, |
||
5433 | n = e.arrowSize, |
||
5434 | p = e.arrowColor, |
||
5435 | r = e.arrowAlpha, |
||
5436 | t = e.color, |
||
5437 | q = e.alpha, |
||
5438 | y = e.rollOverColor, |
||
5439 | B = e.selectedColor, |
||
5440 | u = e.rollOverAlpha, |
||
5441 | w = e.balloonText, |
||
5442 | v = e.bringForwardOnHover, |
||
5443 | A = e.arc, |
||
5444 | C = e.rollOverBrightness, |
||
5445 | x = c.container; |
||
5446 | a.chart = c; |
||
5447 | a.baseSettings = e; |
||
5448 | var z = x.set(); |
||
5449 | a.displayObject = z; |
||
5450 | var F = a.tabIndex; |
||
5451 | void 0 === F && (F = e.tabIndex); |
||
5452 | void 0 !== F && z.setAttr("tabindex", F); |
||
5453 | this.allSvgObjects.push(z); |
||
5454 | a.arrays.push({ |
||
5455 | arr: this.allSvgObjects, |
||
5456 | el: z |
||
5457 | }); |
||
5458 | this.allObjects.push(a); |
||
5459 | a.arrays.push({ |
||
5460 | arr: this.allObjects, |
||
5461 | el: a |
||
5462 | }); |
||
5463 | a.mouseEnabled && c.addObjectEventListeners(z, a); |
||
5464 | if (a.remainVisible || c.selectedObject == a.parentObject) { |
||
5465 | F = a.thickness; |
||
5466 | isNaN(F) && (F = k); |
||
5467 | k = a.dashLength; |
||
5468 | isNaN(k) && (k = l); |
||
5469 | l = a.color; |
||
5470 | void 0 == l && (l = t); |
||
5471 | t = a.alpha; |
||
5472 | isNaN(t) && (t = q); |
||
5473 | q = a.rollOverAlpha; |
||
5474 | isNaN(q) && (q = u); |
||
5475 | isNaN(q) && (q = t); |
||
5476 | u = a.rollOverColor; |
||
5477 | void 0 == u && (u = y); |
||
5478 | y = a.selectedColor; |
||
5479 | void 0 == y && (y = B); |
||
5480 | B = a.balloonText; |
||
5481 | void 0 === B && (B = w); |
||
5482 | w = a.arc; |
||
5483 | isNaN(w) && (w = A); |
||
5484 | A = a.arrow; |
||
5485 | if (!A || "none" == A && "none" != m) A = m; |
||
5486 | m = a.arrowColor; |
||
5487 | void 0 == m && (m = p); |
||
5488 | void 0 == m && (m = l); |
||
5489 | p = a.arrowAlpha; |
||
5490 | isNaN(p) && (p = r); |
||
5491 | isNaN(p) && (p = t); |
||
5492 | r = a.arrowSize; |
||
5493 | isNaN(r) && (r = n); |
||
5494 | n = a.rollOverBrightness; |
||
5495 | void 0 == n && (n = C); |
||
5496 | a.colorReal = l; |
||
5497 | a.arrowColor = m; |
||
5498 | isNaN(e.selectedBrightness) || (y = d.adjustLuminosity(a.colorReal, e.selectedBrightness / 100)); |
||
5499 | a.alphaReal = t; |
||
5500 | a.rollOverColorReal = u; |
||
5501 | a.rollOverAlphaReal = q; |
||
5502 | a.balloonTextReal = B; |
||
5503 | a.selectedColorReal = y; |
||
5504 | a.thicknessReal = F; |
||
5505 | a.rollOverBrightnessReal = n; |
||
5506 | a.accessibleLabel || (a.accessibleLabel = e.accessibleLabel); |
||
5507 | void 0 === a.shiftArrow && (a.shiftArrow = e.shiftArrow); |
||
5508 | void 0 == a.bringForwardOnHover && (a.bringForwardOnHover = v); |
||
5509 | d.processDescriptionWindow(e, a); |
||
5510 | v = this.processCoordinates(a.x, c.realWidth); |
||
5511 | C = this.processCoordinates(a.y, c.realHeight); |
||
5512 | n = a.longitudes; |
||
5513 | e = a.latitudes; |
||
5514 | q = n.length; |
||
5515 | if (0 < q) |
||
5516 | for (v = [], C = [], u = 0; u < q; u++) B = c.coordinatesToXY(n[u], e[u]), v.push(B.x), C.push(B.y); |
||
5517 | if (0 < v.length) { |
||
5518 | a.segments = v.length; |
||
5519 | d.dx = 0; |
||
5520 | d.dy = 0; |
||
5521 | var E, H, G, q = 10 * (1 - Math.abs(w)); |
||
5522 | 10 <= q && (q = NaN); |
||
5523 | 1 > q && (q = 1); |
||
5524 | a.arcRadius = []; |
||
5525 | a.distances = []; |
||
5526 | n = c.mapContainer.scale; |
||
5527 | if (isNaN(q)) { |
||
5528 | for (q = 0; q < v.length - 1; q++) H = Math.sqrt(Math.pow(v[q + 1] - v[q], 2) + Math.pow(C[q + 1] - C[q], 2)), a.distances[q] = H; |
||
5529 | q = d.line(x, v, C, l, 1, F / n, k, !1, !1, !0); |
||
5530 | l = d.line(x, v, C, l, .001, 5 / n, k, !1, !1, !0); |
||
5531 | q.setAttr("stroke-linecap", "round") |
||
5532 | } else { |
||
5533 | u = 1; |
||
5534 | 0 > w && (u = 0); |
||
5535 | B = { |
||
5536 | fill: "none", |
||
5537 | stroke: l, |
||
5538 | "stroke-opacity": 1, |
||
5539 | "stroke-width": F / n, |
||
5540 | "fill-opacity": 0, |
||
5541 | "stroke-linecap": "round" |
||
5542 | }; |
||
5543 | void 0 !== k && 0 < k && (B["stroke-dasharray"] = k); |
||
5544 | for (var k = "", D = 0; D < v.length - 1; D++) { |
||
5545 | var K = v[D], |
||
5546 | J = v[D + 1], |
||
5547 | L = C[D], |
||
5548 | O = C[D + 1]; |
||
5549 | H = Math.sqrt(Math.pow(J - K, 2) + Math.pow(O - L, 2)); |
||
5550 | G = H / 2 * q; |
||
5551 | E = 270 + 180 * Math.acos(H / 2 / |
||
5552 | G) / Math.PI; |
||
5553 | isNaN(E) && (E = 270); |
||
5554 | if (K < J) { |
||
5555 | var P = K, |
||
5556 | K = J, |
||
5557 | J = P, |
||
5558 | P = L, |
||
5559 | L = O, |
||
5560 | O = P; |
||
5561 | E = -E |
||
5562 | } |
||
5563 | 0 < w && (E = -E); |
||
5564 | k += "M" + K + "," + L + "A" + G + "," + G + ",0,0," + u + "," + J + "," + O; |
||
5565 | a.arcRadius[D] = G; |
||
5566 | a.distances[D] = H |
||
5567 | } |
||
5568 | q = x.path(k).attr(B); |
||
5569 | l = x.path(k).attr({ |
||
5570 | "fill-opacity": 0, |
||
5571 | stroke: l, |
||
5572 | "stroke-width": 5 / n, |
||
5573 | //neal opacity |
||
5574 | "stroke-opacity": 0.1, |
||
5575 | fill: "none" |
||
5576 | }) |
||
5577 | } |
||
5578 | d.setCN(c, q, "map-line"); |
||
5579 | void 0 != a.id && d.setCN(c, q, "map-line-" + a.id); |
||
5580 | d.dx = .5; |
||
5581 | d.dy = .5; |
||
5582 | z.push(q); |
||
5583 | z.push(l); |
||
5584 | q.setAttr("opacity", t); |
||
5585 | if ("none" != A) { |
||
5586 | var I, M, N; |
||
5587 | View Code Duplication | if ("end" == A || "both" == A) u = v[v.length - 1], D = C[C.length - 1], 1 < v.length ? |
|
5588 | (B = v[v.length - 2], I = C[C.length - 2]) : (B = u, I = D), I = 180 * Math.atan((D - I) / (u - B)) / Math.PI, isNaN(E) || (I += E), M = u, N = D, I = 0 > u - B ? I - 90 : I + 90; |
||
5589 | t = [-r / 2 - .5, -.5, r / 2 - .5]; |
||
5590 | k = [r, -.5, r]; |
||
5591 | a.shiftArrow && "middle" != A && (k = [0, 1.2 * -r, 0]); |
||
5592 | "both" == A && (r = d.polygon(x, t, k, m, p, 1, m, p, void 0, !0), z.push(r), r.translate(M, N, 1 / n, !0), isNaN(I) || r.rotate(I), d.setCN(c, q, "map-line-arrow"), void 0 != a.id && d.setCN(c, q, "map-line-arrow-" + a.id), a.fixedSize && f.push(r)); |
||
5593 | View Code Duplication | if ("start" == A || "both" == A) r = v[0], N = C[0], 1 < v.length ? (u = v[1], M = C[1]) : (u = r, M = N), I = 180 * Math.atan((N - |
|
5594 | M) / (r - u)) / Math.PI, isNaN(E) || (I -= E), M = r, I = 0 > r - u ? I - 90 : I + 90; |
||
5595 | "middle" == A && (u = v[v.length - 1], D = C[C.length - 1], 1 < v.length ? (B = v[v.length - 2], I = C[C.length - 2]) : (B = u, I = D), M = B + (u - B) / 2, N = I + (D - I) / 2, I = 180 * Math.atan((D - I) / (u - B)) / Math.PI, isNaN(E) || (E = H / 2, G -= Math.sqrt(G * G - E * E), 0 > w && (G = -G), E = Math.sin(I / 180 * Math.PI), -1 == E && (E = 1), M -= E * G, N += Math.cos(I / 180 * Math.PI) * G), I = 0 > u - B ? I - 90 : I + 90); |
||
5596 | r = d.polygon(x, t, k, m, p, 1, m, p, void 0, !0); |
||
5597 | d.setCN(c, q, "map-line-arrow"); |
||
5598 | void 0 != a.id && d.setCN(c, q, "map-line-arrow-" + a.id); |
||
5599 | z.push(r); |
||
5600 | r.translate(M, |
||
5601 | N, 1 / n, !0); |
||
5602 | isNaN(I) || r.rotate(I); |
||
5603 | a.fixedSize && (f.push(r), a.arrays.push({ |
||
5604 | arr: f, |
||
5605 | el: r |
||
5606 | })); |
||
5607 | a.arrowSvg = r |
||
5608 | } |
||
5609 | a.fixedSize && q && (f = { |
||
5610 | line: q, |
||
5611 | //neal stroke width |
||
5612 | thickness: 3 |
||
5613 | }, this.linesToResize.push(f), a.arrays.push({ |
||
5614 | arr: this.linesToResize, |
||
5615 | el: f |
||
5616 | }), f = { |
||
5617 | line: l, |
||
5618 | thickness: 5 |
||
5619 | }, this.linesToResize.push(f), a.arrays.push({ |
||
5620 | arr: this.linesToResize, |
||
5621 | el: f |
||
5622 | })); |
||
5623 | a.lineSvg = q; |
||
5624 | a.showAsSelected && !isNaN(y) && q.setAttr("stroke", y); |
||
5625 | 0 < e.length ? g.push(z) : h.push(z); |
||
5626 | a.hidden && z.hide(); |
||
5627 | c.makeObjectAccessible(a) |
||
5628 | } |
||
5629 | } |
||
5630 | }, |
||
5631 | processCoordinates: function(a, b) { |
||
5632 | var c = [], |
||
5633 | d; |
||
5634 | for (d = 0; d < a.length; d++) { |
||
5635 | var f = a[d], |
||
5636 | g = Number(f); |
||
5637 | isNaN(g) && (g = Number(f.replace("%", "")) * b / 100); |
||
5638 | isNaN(g) || c.push(g) |
||
5639 | } |
||
5640 | return c |
||
5641 | }, |
||
5642 | reset: function() { |
||
5643 | this.objectsToResize = []; |
||
5644 | this.allSvgObjects = []; |
||
5645 | this.allObjects = []; |
||
5646 | this.linesToResize = [] |
||
5647 | } |
||
5648 | }) |
||
5649 | })(); |
||
5650 | (function() { |
||
5651 | var d = window.AmCharts; |
||
5652 | d.LinesSettings = d.Class({ |
||
5653 | construct: function(a) { |
||
5654 | this.cname = "LinesSettings"; |
||
5655 | this.balloonText = "[[title]]"; |
||
5656 | this.thickness = 1; |
||
5657 | this.dashLength = 0; |
||
5658 | this.arrowSize = 10; |
||
5659 | this.arrowAlpha = 1; |
||
5660 | this.arrow = "none"; |
||
5661 | this.color = "#990000"; |
||
5662 | this.descriptionWindowWidth = 250; |
||
5663 | this.bringForwardOnHover = !0; |
||
5664 | d.applyTheme(this, a, this.cname) |
||
5665 | } |
||
5666 | }) |
||
5667 | })(); |
||
5668 | (function() { |
||
5669 | var d = window.AmCharts; |
||
5670 | d.MapObject = d.Class({ |
||
5671 | construct: function(a) { |
||
5672 | this.fixedSize = this.mouseEnabled = !0; |
||
5673 | this.images = []; |
||
5674 | this.lines = []; |
||
5675 | this.areas = []; |
||
5676 | this.remainVisible = !0; |
||
5677 | this.passZoomValuesToTarget = !1; |
||
5678 | this.objectType = this.cname; |
||
5679 | d.applyTheme(this, a, "MapObject"); |
||
5680 | this.arrays = [] |
||
5681 | }, |
||
5682 | deleteObject: function() { |
||
5683 | this.remove(); |
||
5684 | this.parentArray && d.removeFromArray(this.parentArray, this); |
||
5685 | if (this.arrays) |
||
5686 | for (var a = 0; a < this.arrays.length; a++) d.removeFromArray(this.arrays[a].arr, this.arrays[a].el); |
||
5687 | this.arrays = [] |
||
5688 | } |
||
5689 | }) |
||
5690 | })(); |
||
5691 | (function() { |
||
5692 | var d = window.AmCharts; |
||
5693 | d.MapArea = d.Class({ |
||
5694 | inherits: d.MapObject, |
||
5695 | construct: function(a) { |
||
5696 | this.cname = "MapArea"; |
||
5697 | d.MapArea.base.construct.call(this, a); |
||
5698 | d.applyTheme(this, a, this.cname) |
||
5699 | }, |
||
5700 | validate: function() { |
||
5701 | this.chart.areasProcessor.createArea(this) |
||
5702 | } |
||
5703 | }) |
||
5704 | })(); |
||
5705 | (function() { |
||
5706 | var d = window.AmCharts; |
||
5707 | d.MapLine = d.Class({ |
||
5708 | inherits: d.MapObject, |
||
5709 | construct: function(a) { |
||
5710 | this.cname = "MapLine"; |
||
5711 | this.longitudes = []; |
||
5712 | this.latitudes = []; |
||
5713 | this.x = []; |
||
5714 | this.y = []; |
||
5715 | this.segments = 0; |
||
5716 | this.arrow = "none"; |
||
5717 | d.MapLine.base.construct.call(this, a); |
||
5718 | d.applyTheme(this, a, this.cname) |
||
5719 | }, |
||
5720 | validate: function() { |
||
5721 | this.chart.linesProcessor.createLine(this) |
||
5722 | }, |
||
5723 | remove: function() { |
||
5724 | var a = this.displayObject; |
||
5725 | a && a.remove() |
||
5726 | }, |
||
5727 | getCoordinates: function(a, b) { |
||
5728 | isNaN(b) && (b = 0); |
||
5729 | isNaN(this.arc) || this.isValid || (this.isValid = !0, this.validate()); |
||
5730 | if (!isNaN(a)) { |
||
5731 | var c, e, f, g, h, k; |
||
5732 | if (1 < this.longitudes.length) { |
||
5733 | e = this.chart.coordinatesToXY(this.longitudes[b], this.latitudes[b]); |
||
5734 | var l = this.chart.coordinatesToXY(this.longitudes[b + 1], this.latitudes[b + 1]); |
||
5735 | c = e.x; |
||
5736 | f = l.x; |
||
5737 | e = e.y; |
||
5738 | g = l.y |
||
5739 | } else 1 < this.x.length && (c = this.x[b], f = this.x[b + 1], e = this.y[b], g = this.y[b + 1]); |
||
5740 | l = Math.sqrt(Math.pow(f - c, 2) + Math.pow(g - e, 2)); |
||
5741 | c < f && !isNaN(this.arc) && 0 !== this.arc && (a = 1 - a); |
||
5742 | h = c + (f - c) * a; |
||
5743 | k = e + (g - e) * a; |
||
5744 | var m = Math.atan2(g - e, f - c); |
||
5745 | if (!isNaN(this.arc) && 0 !== this.arc && this.arcRadius) { |
||
5746 | var n = 0; |
||
5747 | c < f && (n = c, c = f, f = n, n = e, e = g, g = n, n = Math.PI); |
||
5748 | k = this.arcRadius[b]; |
||
5749 | 0 > this.arc && (l = -l); |
||
5750 | h = c + (f - c) / 2 + Math.sqrt(k * k - l / 2 * (l / 2)) * (e - g) / l; |
||
5751 | var p = e + (g - e) / 2 + Math.sqrt(k * k - l / 2 * (l / 2)) * (f - c) / l; |
||
5752 | c = 180 * Math.atan2(e - p, c - h) / Math.PI; |
||
5753 | f = 180 * Math.atan2(g - p, f - h) / Math.PI; |
||
5754 | 180 < f - c && (f -= 360); |
||
5755 | m = d.degreesToRadians(c + (f - c) * a); |
||
5756 | h += k * Math.cos(m); |
||
5757 | k = p + k * Math.sin(m); |
||
5758 | m = 0 < this.arc ? m + Math.PI / 2 : m - Math.PI / 2; |
||
5759 | m += n |
||
5760 | } |
||
5761 | this.distance = l; |
||
5762 | return { |
||
5763 | x: h, |
||
5764 | y: k, |
||
5765 | angle: m |
||
5766 | } |
||
5767 | } |
||
5768 | }, |
||
5769 | fixToStage: function() { |
||
5770 | if (0 < this.latitudes.length) { |
||
5771 | this.y = []; |
||
5772 | for (var a = 0; a < this.latitudes.length; a++) { |
||
5773 | var b = |
||
5774 | this.chart.coordinatesToStageXY(this.longitudes[a], this.latitudes[a]); |
||
5775 | this.y.push(b.y); |
||
5776 | this.x.push(b.x) |
||
5777 | } |
||
5778 | this.latitudes = []; |
||
5779 | this.longitudes = [] |
||
5780 | } |
||
5781 | this.validate() |
||
5782 | }, |
||
5783 | fixToMap: function() { |
||
5784 | if (0 < this.y.length) { |
||
5785 | this.latitudes = []; |
||
5786 | for (var a = 0; a < this.y.length; a++) { |
||
5787 | var b = this.chart.stageXYToCoordinates(this.x[a], this.y[a]); |
||
5788 | this.latitudes.push(b.latitude); |
||
5789 | this.longitudes.push(b.longitude) |
||
5790 | } |
||
5791 | this.y = []; |
||
5792 | this.x = [] |
||
5793 | } |
||
5794 | this.validate() |
||
5795 | } |
||
5796 | }) |
||
5797 | })(); |
||
5798 | (function() { |
||
5799 | var d = window.AmCharts; |
||
5800 | d.MapImage = d.Class({ |
||
5801 | inherits: d.MapObject, |
||
5802 | construct: function(a) { |
||
5803 | this.cname = "MapImage"; |
||
5804 | this.scale = 1; |
||
5805 | this.widthAndHeightUnits = "pixels"; |
||
5806 | this.labelShiftY = this.labelShiftX = 0; |
||
5807 | this.positionOnLine = .5; |
||
5808 | this.direction = 1; |
||
5809 | this.lineSegment = this.extraAngle = 0; |
||
5810 | this.animateAngle = !0; |
||
5811 | this.createEvents("animationStart", "animationEnd"); |
||
5812 | d.MapImage.base.construct.call(this, a); |
||
5813 | d.applyTheme(this, a, this.cname); |
||
5814 | this.delayCounter = 0 |
||
5815 | }, |
||
5816 | validate: function() { |
||
5817 | this.chart.imagesProcessor.createImage(this) |
||
5818 | }, |
||
5819 | updatePosition: function() { |
||
5820 | this.chart.imagesProcessor.updateSizeAndPosition(this) |
||
5821 | }, |
||
5822 | remove: function() { |
||
5823 | var a = this.displayObject; |
||
5824 | a && a.remove(); |
||
5825 | (a = this.imageLabel) && a.remove() |
||
5826 | }, |
||
5827 | animateTo: function(a, b, c, d) { |
||
5828 | isNaN(c) || (this.animationDuration = c); |
||
5829 | d && (this.easingFunction = d); |
||
5830 | this.finalX = a; |
||
5831 | this.finalY = b; |
||
5832 | isNaN(this.longitude) || (this.initialX = this.longitude); |
||
5833 | isNaN(this.left) || (this.initialX = this.left); |
||
5834 | isNaN(this.right) || (this.initialX = this.right); |
||
5835 | isNaN(this.latitude) || (this.initialY = this.latitude); |
||
5836 | isNaN(this.top) || (this.initialY = this.top); |
||
5837 | isNaN(this.bottom) || (this.initialY = this.bottom); |
||
5838 | this.animatingAlong = !1; |
||
5839 | this.animate() |
||
5840 | }, |
||
5841 | animateAlong: function(a, b, c) { |
||
5842 | 1 == this.positionOnLine && this.flipDirection && (this.direction = -1, this.extraAngle = 180); |
||
5843 | isNaN(b) || (this.animationDuration = b); |
||
5844 | c && (this.easingFunction = c); |
||
5845 | a && (this.line = this.chart.getObjectById(a)); |
||
5846 | this.animateAlongLine = this.line; |
||
5847 | this.animatingAlong = !0; |
||
5848 | this.animate() |
||
5849 | }, |
||
5850 | animate: function() { |
||
5851 | var a = this.chart.imagesSettings, |
||
5852 | b = this.animationDuration; |
||
5853 | isNaN(b) && (b = a.animationDuration); |
||
5854 | this.totalFrames = b * d.updateRate; |
||
5855 | b = 1; |
||
5856 | this.line && a.adjustAnimationSpeed && (this.line.distances && (b = this.line.distances[this.lineSegment] * this.chart.zoomLevel(), b = Math.abs(b / a.baseAnimationDistance)), this.totalFrames = Math.round(b * this.totalFrames)); |
||
5857 | this.frame = 0; |
||
5858 | this.fire({ |
||
5859 | type: "animationStart", |
||
5860 | chart: this.chart, |
||
5861 | image: this, |
||
5862 | lineSegment: this.lineSegment, |
||
5863 | direction: this.direction |
||
5864 | }) |
||
5865 | }, |
||
5866 | update: function() { |
||
5867 | var a = this.totalFrames; |
||
5868 | this.frame++; |
||
5869 | this.delayCounter--; |
||
5870 | 0 === this.delayCounter && this.animateAlong(); |
||
5871 | if (!(0 < this.delayCounter)) |
||
5872 | if (this.frame <= a) { |
||
5873 | this.updatePosition(); |
||
5874 | var b = this.chart.imagesSettings, |
||
5875 | c = this.easingFunction; |
||
5876 | c || (c = b.easingFunction); |
||
5877 | a = c(0, this.frame, 0, 1, a); - 1 == this.direction && (a = 1 - a); |
||
5878 | this.animatingAlong ? this.positionOnLine = a : (b = this.initialX + (this.finalX - this.initialX) * a, isNaN(this.longitude) || (this.longitude = b), isNaN(this.left) || (this.left = b), isNaN(this.right) || (this.right = b), a = this.initialY + (this.finalY - this.initialY) * a, isNaN(this.latitude) || (this.latitude = a), isNaN(this.top) || (this.top = a), isNaN(this.bottom) || (this.bottom = a)) |
||
5879 | } else this.frame == a + 1 && (this.fire({ |
||
5880 | type: "animationEnd", |
||
5881 | chart: this.chart, |
||
5882 | image: this, |
||
5883 | lineSegment: this.lineSegment, |
||
5884 | direction: this.direction |
||
5885 | }), this.line && this.animatingAlong && (1 == this.direction ? this.lineSegment < this.line.segments - 2 ? (this.lineSegment++, this.delayAnimateAlong(), this.positionOnLine = 0) : this.flipDirection ? (this.direction = -1, this.extraAngle = 180, this.delayAnimateAlong()) : this.loop && (this.delayAnimateAlong(), this.lineSegment = 0) : 0 < this.lineSegment ? (this.lineSegment--, this.delayAnimateAlong(), this.positionOnLine = 0) : this.loop && this.flipDirection ? (this.direction = 1, this.extraAngle = 0, this.delayAnimateAlong()) : this.loop && this.delayAnimateAlong())) |
||
5886 | }, |
||
5887 | delayAnimateAlong: function() { |
||
5888 | this.animateAlongLine && (this.delayCounter = this.chart.imagesSettings.pauseDuration * d.updateRate) |
||
5889 | }, |
||
5890 | fixToStage: function() { |
||
5891 | if (!isNaN(this.longitude)) { |
||
5892 | var a = this.chart.coordinatesToStageXY(this.longitude, this.latitude); |
||
5893 | this.left = a.x; |
||
5894 | this.top = a.y; |
||
5895 | this.latitude = this.longitude = void 0 |
||
5896 | } |
||
5897 | this.validate() |
||
5898 | }, |
||
5899 | fixToMap: function() { |
||
5900 | if (!isNaN(this.left)) { |
||
5901 | var a = this.chart.stageXYToCoordinates(this.left, this.top); |
||
5902 | this.longitude = a.longitude; |
||
5903 | this.latitude = a.latitude; |
||
5904 | this.top = this.left = void 0 |
||
5905 | } |
||
5906 | this.validate() |
||
5907 | } |
||
5908 | }) |
||
5909 | })(); |
||
5910 | (function() { |
||
5911 | var d = window.AmCharts; |
||
5912 | d.degreesToRadians = function(a) { |
||
5913 | return a / 180 * Math.PI |
||
5914 | }; |
||
5915 | d.radiansToDegrees = function(a) { |
||
5916 | return a / Math.PI * 180 |
||
5917 | }; |
||
5918 | d.getColorFade = function(a, b, c) { |
||
5919 | var e = d.hex2RGB(b); |
||
5920 | b = e[0]; |
||
5921 | var f = e[1], |
||
5922 | e = e[2], |
||
5923 | g = d.hex2RGB(a); |
||
5924 | a = g[0]; |
||
5925 | var h = g[1], |
||
5926 | g = g[2]; |
||
5927 | a += Math.round((b - a) * c); |
||
5928 | h += Math.round((f - h) * c); |
||
5929 | g += Math.round((e - g) * c); |
||
5930 | return "rgb(" + a + "," + h + "," + g + ")" |
||
5931 | }; |
||
5932 | d.hex2RGB = function(a) { |
||
5933 | return [parseInt(a.substring(1, 3), 16), parseInt(a.substring(3, 5), 16), parseInt(a.substring(5, 7), 16)] |
||
5934 | }; |
||
5935 | d.processDescriptionWindow = function(a, b) { |
||
5936 | isNaN(b.descriptionWindowX) && (b.descriptionWindowX = a.descriptionWindowX); |
||
5937 | isNaN(b.descriptionWindowY) && (b.descriptionWindowY = a.descriptionWindowY); |
||
5938 | isNaN(b.descriptionWindowLeft) && (b.descriptionWindowLeft = a.descriptionWindowLeft); |
||
5939 | isNaN(b.descriptionWindowRight) && (b.descriptionWindowRight = a.descriptionWindowRight); |
||
5940 | isNaN(b.descriptionWindowTop) && (b.descriptionWindowTop = a.descriptionWindowTop); |
||
5941 | isNaN(b.descriptionWindowBottom) && (b.descriptionWindowBottom = a.descriptionWindowBottom); |
||
5942 | isNaN(b.descriptionWindowWidth) && (b.descriptionWindowWidth = a.descriptionWindowWidth); |
||
5943 | isNaN(b.descriptionWindowHeight) && (b.descriptionWindowHeight = a.descriptionWindowHeight) |
||
5944 | }; |
||
5945 | d.normalizePath = function(a) { |
||
5946 | for (var b = "", c = d.parsePath(a.getAttribute("d")), e, f, g = Infinity, h = -Infinity, k = Infinity, l = -Infinity, m = 0; m < c.length; m++) { |
||
5947 | var n = c[m], |
||
5948 | p = n.letter, |
||
5949 | r = n.x, |
||
5950 | n = n.y; |
||
5951 | "h" == p && (p = "L", r += e, n = f); |
||
5952 | "H" == p && (p = "L", n = f); |
||
5953 | "v" == p && (p = "L", r = e, n += f); |
||
5954 | "V" == p && (p = "L", r = e); |
||
5955 | if ("m" === p || "l" === p) p = p.toUpperCase(), r += e, n += f; |
||
5956 | r = d.roundTo(r, 3); |
||
5957 | n = d.roundTo(n, 3); |
||
5958 | e = r; |
||
5959 | f = n; |
||
5960 | r > h && (h = r); |
||
5961 | r < g && (g = r); |
||
5962 | n > l && (l = n); |
||
5963 | n < k && (k = n); |
||
5964 | b = "z" == p.toLowerCase() ? b + "Z " : b + (p + " " + r + " " + n + " ") |
||
5965 | } |
||
5966 | a.setAttribute("d", b); |
||
5967 | return { |
||
5968 | minX: g, |
||
5969 | maxX: h, |
||
5970 | minY: k, |
||
5971 | maxY: l |
||
5972 | } |
||
5973 | }; |
||
5974 | d.mercatorLatitudeToRadians = function(a) { |
||
5975 | return Math.log(Math.tan(Math.PI / 4 + d.degreesToRadians(a) / 2)) |
||
5976 | }; |
||
5977 | d.parsePath = function(a) { |
||
5978 | a = a.match(/([MmLlHhVvZz]{1}[0-9.,\-\s]*)/g); |
||
5979 | for (var b = [], c = 0; c < a.length; c++) { |
||
5980 | var d = a[c].match(/([MmLlHhVvZz]{1})|([0-9.\-]+)/g), |
||
5981 | f = { |
||
5982 | letter: d[0] |
||
5983 | }; |
||
5984 | switch (d[0]) { |
||
5985 | case "Z": |
||
5986 | case "Z": |
||
5987 | case "z": |
||
5988 | break; |
||
5989 | case "V": |
||
5990 | case "v": |
||
5991 | f.y = Number(d[1]); |
||
5992 | break; |
||
5993 | case "H": |
||
5994 | case "h": |
||
5995 | f.x = Number(d[1]); |
||
5996 | break; |
||
5997 | default: |
||
5998 | f.x = Number(d[1]), f.y = Number(d[2]) |
||
5999 | } |
||
6000 | b.push(f) |
||
6001 | } |
||
6002 | return b |
||
6003 | }; |
||
6004 | d.acos = function(a) { |
||
6005 | return 1 < a ? 0 : -1 > a ? Math.PI : Math.acos(a) |
||
6006 | }; |
||
6007 | d.asin = function(a) { |
||
6008 | return 1 < a ? Math.PI / 2 : -1 > a ? -Math.PI / 2 : Math.asin(a) |
||
6009 | }; |
||
6010 | d.sinci = function(a) { |
||
6011 | return a ? a / Math.sin(a) : 1 |
||
6012 | }; |
||
6013 | d.asqrt = function(a) { |
||
6014 | return 0 < a ? Math.sqrt(a) : 0 |
||
6015 | }; |
||
6016 | d.winkel3 = function(a, b) { |
||
6017 | var c = d.aitoff(a, b); |
||
6018 | return [(c[0] + a / Math.PI * 2) / 2, (c[1] + b) / 2] |
||
6019 | }; |
||
6020 | d.winkel3.invert = function(a, b) { |
||
6021 | var c = a, |
||
6022 | e = b, |
||
6023 | f = 25, |
||
6024 | g = Math.PI / 2; |
||
6025 | do var h = Math.cos(e), |
||
6026 | k = Math.sin(e), |
||
6027 | l = Math.sin(2 * e), |
||
6028 | m = k * k, |
||
6029 | n = h * h, |
||
6030 | p = Math.sin(c), |
||
6031 | r = Math.cos(c / 2), |
||
6032 | t = Math.sin(c / 2), |
||
6033 | q = t * t, |
||
6034 | y = 1 - n * r * r, |
||
6035 | B = y ? d.acos(h * r) * Math.sqrt(u = 1 / y) : u = 0, |
||
6036 | u, y = .5 * (2 * B * h * t + c / g) - a, |
||
6037 | w = .5 * (B * k + e) - b, |
||
6038 | v = .5 * u * (n * q + B * h * r * m) + .5 / g, |
||
6039 | A = u * (p * l / 4 - B * k * t), |
||
6040 | k = .125 * u * (l * t - B * k * n * p), |
||
6041 | m = .5 * u * (m * r + B * q * h) + .5, |
||
6042 | h = A * k - m * v, |
||
6043 | A = (w * A - y * m) / h, |
||
6044 | y = (y * k - w * v) / h, |
||
6045 | c = c - A, |
||
6046 | e = e - y; while ((1E-6 < Math.abs(A) || 1E-6 < Math.abs(y)) && 0 < --f); |
||
6047 | return [c, e] |
||
6048 | }; |
||
6049 | d.aitoff = function(a, b) { |
||
6050 | var c = Math.cos(b), |
||
6051 | e = d.sinci(d.acos(c * Math.cos(a /= 2))); |
||
6052 | return [2 * c * Math.sin(a) * e, Math.sin(b) * e] |
||
6053 | }; |
||
6054 | d.orthographic = |
||
6055 | function(a, b) { |
||
6056 | return [Math.cos(b) * Math.sin(a), Math.sin(b)] |
||
6057 | }; |
||
6058 | d.equirectangular = function(a, b) { |
||
6059 | return [a, b] |
||
6060 | }; |
||
6061 | d.equirectangular.invert = function(a, b) { |
||
6062 | return [a, b] |
||
6063 | }; |
||
6064 | d.eckert5 = function(a, b) { |
||
6065 | var c = Math.PI; |
||
6066 | return [a * (1 + Math.cos(b)) / Math.sqrt(2 + c), 2 * b / Math.sqrt(2 + c)] |
||
6067 | }; |
||
6068 | d.eckert5.invert = function(a, b) { |
||
6069 | var c = Math.sqrt(2 + Math.PI), |
||
6070 | d = b * c / 2; |
||
6071 | return [c * a / (1 + Math.cos(d)), d] |
||
6072 | }; |
||
6073 | d.eckert6 = function(a, b) { |
||
6074 | for (var c = Math.PI, d = (1 + c / 2) * Math.sin(b), f = 0, g = Infinity; 10 > f && 1E-5 < Math.abs(g); f++) b -= g = (b + Math.sin(b) - d) / (1 + Math.cos(b)); |
||
6075 | d = Math.sqrt(2 + |
||
6076 | c); |
||
6077 | return [a * (1 + Math.cos(b)) / d, 2 * b / d] |
||
6078 | }; |
||
6079 | d.eckert6.invert = function(a, b) { |
||
6080 | var c = 1 + Math.PI / 2, |
||
6081 | e = Math.sqrt(c / 2); |
||
6082 | return [2 * a * e / (1 + Math.cos(b *= e)), d.asin((b + Math.sin(b)) / c)] |
||
6083 | }; |
||
6084 | d.mercator = function(a, b) { |
||
6085 | b >= Math.PI / 2 - .02 && (b = Math.PI / 2 - .02); |
||
6086 | b <= -Math.PI / 2 + .02 && (b = -Math.PI / 2 + .02); |
||
6087 | return [a, Math.log(Math.tan(Math.PI / 4 + b / 2))] |
||
6088 | }; |
||
6089 | d.mercator.invert = function(a, b) { |
||
6090 | return [a, 2 * Math.atan(Math.exp(b)) - Math.PI / 2] |
||
6091 | }; |
||
6092 | d.miller = function(a, b) { |
||
6093 | return [a, 1.25 * Math.log(Math.tan(Math.PI / 4 + .4 * b))] |
||
6094 | }; |
||
6095 | d.miller.invert = function(a, b) { |
||
6096 | return [a, 2.5 * |
||
6097 | Math.atan(Math.exp(.8 * b)) - .625 * Math.PI |
||
6098 | ] |
||
6099 | }; |
||
6100 | d.eckert3 = function(a, b) { |
||
6101 | var c = Math.PI, |
||
6102 | d = Math.sqrt(c * (4 + c)); |
||
6103 | return [2 / d * a * (1 + Math.sqrt(1 - 4 * b * b / (c * c))), 4 / d * b] |
||
6104 | }; |
||
6105 | d.eckert3.invert = function(a, b) { |
||
6106 | var c = Math.PI, |
||
6107 | e = Math.sqrt(c * (4 + c)) / 2; |
||
6108 | return [a * e / (1 + d.asqrt(1 - b * b * (4 + c) / (4 * c))), b * e / 2] |
||
6109 | } |
||
6110 | })(); |
||
6111 | (function() { |
||
6112 | var d = window.AmCharts; |
||
6113 | d.MapData = d.Class({ |
||
6114 | inherits: d.MapObject, |
||
6115 | construct: function() { |
||
6116 | this.cname = "MapData"; |
||
6117 | d.MapData.base.construct.call(this); |
||
6118 | this.projection = "mercator"; |
||
6119 | this.topLatitude = 90; |
||
6120 | this.bottomLatitude = -90; |
||
6121 | this.leftLongitude = -180; |
||
6122 | this.rightLongitude = 180; |
||
6123 | this.zoomLevel = 1; |
||
6124 | this.getAreasFromMap = !1 |
||
6125 | } |
||
6126 | }) |
||
6127 | })(); |
||
6128 | (function() { |
||
6129 | var d = window.AmCharts; |
||
6130 | d.DescriptionWindow = d.Class({ |
||
6131 | construct: function() {}, |
||
6132 | show: function(a, b, c, d) { |
||
6133 | var f = this; |
||
6134 | f.chart = a; |
||
6135 | var g = document.createElement("div"); |
||
6136 | g.style.position = "absolute"; |
||
6137 | var h = a.classNamePrefix + "-description-"; |
||
6138 | g.className = "ammapDescriptionWindow " + h + "div"; |
||
6139 | f.div = g; |
||
6140 | b.appendChild(g); |
||
6141 | var k = ".gif"; |
||
6142 | a.svgIcons && (k = ".svg"); |
||
6143 | var l = document.createElement("img"); |
||
6144 | l.className = "ammapDescriptionWindowCloseButton " + h + "close-img"; |
||
6145 | l.src = a.pathToImages + "xIcon" + k; |
||
6146 | l.style.cssFloat = "right"; |
||
6147 | l.style.cursor = |
||
6148 | "pointer"; |
||
6149 | l.onclick = function() { |
||
6150 | f.close() |
||
6151 | }; |
||
6152 | l.onmouseover = function() { |
||
6153 | l.src = a.pathToImages + "xIconH" + k |
||
6154 | }; |
||
6155 | l.onmouseout = function() { |
||
6156 | l.src = a.pathToImages + "xIcon" + k |
||
6157 | }; |
||
6158 | g.appendChild(l); |
||
6159 | b = document.createElement("div"); |
||
6160 | b.className = "ammapDescriptionTitle " + h + "title-div"; |
||
6161 | b.onmousedown = function() { |
||
6162 | f.div.style.zIndex = 1E3 |
||
6163 | }; |
||
6164 | g.appendChild(b); |
||
6165 | b.innerHTML = d; |
||
6166 | d = b.offsetHeight; |
||
6167 | b = document.createElement("div"); |
||
6168 | b.className = "ammapDescriptionText " + h + "text-div"; |
||
6169 | b.style.maxHeight = f.maxHeight - d - 20 + "px"; |
||
6170 | g.appendChild(b); |
||
6171 | b.innerHTML = c |
||
6172 | }, |
||
6173 | close: function() { |
||
6174 | try { |
||
6175 | this.div.parentNode.removeChild(this.div), this.chart.fireClosed() |
||
6176 | } catch (a) {} |
||
6177 | } |
||
6178 | }) |
||
6179 | })(); |
||
6180 | (function() { |
||
6181 | var d = window.AmCharts; |
||
6182 | d.ValueLegend = d.Class({ |
||
6183 | construct: function(a) { |
||
6184 | this.cname = "ValueLegend"; |
||
6185 | this.enabled = !0; |
||
6186 | this.showAsGradient = !1; |
||
6187 | this.minValue = 0; |
||
6188 | this.height = 12; |
||
6189 | this.width = 200; |
||
6190 | this.bottom = this.left = 10; |
||
6191 | this.borderColor = "#FFFFFF"; |
||
6192 | this.borderAlpha = this.borderThickness = 1; |
||
6193 | this.color = "#000000"; |
||
6194 | this.fontSize = 11; |
||
6195 | d.applyTheme(this, a, this.cname) |
||
6196 | }, |
||
6197 | init: function(a, b) { |
||
6198 | if (this.enabled) { |
||
6199 | var c = a.areasSettings.color, |
||
6200 | e = a.areasSettings.colorSolid, |
||
6201 | f = a.colorSteps; |
||
6202 | d.remove(this.set); |
||
6203 | var g = b.set(); |
||
6204 | this.set = g; |
||
6205 | d.setCN(a, g, "value-legend"); |
||
6206 | var h = 0, |
||
6207 | k = this.minValue, |
||
6208 | l = this.fontSize, |
||
6209 | m = a.fontFamily, |
||
6210 | n = this.color, |
||
6211 | p = { |
||
6212 | precision: a.precision, |
||
6213 | decimalSeparator: a.decimalSeparator, |
||
6214 | thousandsSeparator: a.thousandsSeparator |
||
6215 | }; |
||
6216 | void 0 == k && (k = d.formatNumber(a.minValueReal, p)); |
||
6217 | void 0 !== k && (h = d.text(b, k, n, m, l, "left"), h.translate(0, l / 2 - 1), d.setCN(a, h, "value-legend-min-label"), g.push(h), h = h.getBBox().height); |
||
6218 | k = this.maxValue; |
||
6219 | void 0 === k && (k = d.formatNumber(a.maxValueReal, p)); |
||
6220 | void 0 !== k && (h = d.text(b, k, n, m, l, "right"), h.translate(this.width, l / 2 - 1), d.setCN(a, h, "value-legend-max-label"), g.push(h), h = h.getBBox().height); |
||
6221 | if (this.showAsGradient) c = d.rect(b, this.width, this.height, [c, e], 1, this.borderThickness, this.borderColor, 1, 0, 0), d.setCN(a, c, "value-legend-gradient"), c.translate(0, h), g.push(c); |
||
6222 | else |
||
6223 | for (l = this.width / f, m = 0; m < f; m++) n = d.getColorFade(c, e, 1 * m / (f - 1)), n = d.rect(b, l, this.height, n, 1, this.borderThickness, this.borderColor, 1), d.setCN(a, n, "value-legend-color"), d.setCN(a, n, "value-legend-color-" + m), n.translate(l * m, h), g.push(n); |
||
6224 | e = c = 0; |
||
6225 | f = g.getBBox(); |
||
6226 | h = a.getY(this.bottom, !0); |
||
6227 | l = a.getY(this.top); |
||
6228 | m = a.getX(this.right, !0); |
||
6229 | n = a.getX(this.left); |
||
6230 | isNaN(l) || (c = l); |
||
6231 | isNaN(h) || (c = h - f.height); |
||
6232 | isNaN(n) || (e = n); |
||
6233 | isNaN(m) || (e = m - f.width); |
||
6234 | g.translate(e, c) |
||
6235 | } else d.remove(this.set) |
||
6236 | } |
||
6237 | }) |
||
6238 | })(); |
||
6239 | (function() { |
||
6240 | var d = window.AmCharts; |
||
6241 | d.ObjectList = d.Class({ |
||
6242 | construct: function(a) { |
||
6243 | this.divId = a |
||
6244 | }, |
||
6245 | init: function(a) { |
||
6246 | this.chart = a; |
||
6247 | var b = this.divId; |
||
6248 | this.container && (b = this.container); |
||
6249 | this.div = "object" != typeof b ? document.getElementById(b) : b; |
||
6250 | b = document.createElement("div"); |
||
6251 | b.className = "ammapObjectList " + a.classNamePrefix + "-object-list-div"; |
||
6252 | this.div.appendChild(b); |
||
6253 | this.addObjects(a.dataProvider, b) |
||
6254 | }, |
||
6255 | addObjects: function(a, b) { |
||
6256 | var c = this.chart, |
||
6257 | d = document.createElement("ul"); |
||
6258 | d.className = c.classNamePrefix + "-object-list-ul"; |
||
6259 | var f; |
||
6260 | if (a.areas) |
||
6261 | for (f = 0; f < a.areas.length; f++) { |
||
6262 | var g = a.areas[f]; |
||
6263 | void 0 === g.showInList && (g.showInList = c.showAreasInList); |
||
6264 | this.addObject(g, d) |
||
6265 | } |
||
6266 | if (a.images) |
||
6267 | for (f = 0; f < a.images.length; f++) g = a.images[f], void 0 === g.showInList && (g.showInList = c.showImagesInList), this.addObject(g, d); |
||
6268 | if (a.lines) |
||
6269 | for (f = 0; f < a.lines.length; f++) g = a.lines[f], void 0 === g.showInList && (g.showInList = c.showLinesInList), this.addObject(g, d); |
||
6270 | 0 < d.childNodes.length && b.appendChild(d) |
||
6271 | }, |
||
6272 | addObject: function(a, b) { |
||
6273 | var c = this; |
||
6274 | if (a.showInList && void 0 !== a.title) { |
||
6275 | var d = c.chart, |
||
6276 | f = document.createElement("li"); |
||
6277 | f.className = d.classNamePrefix + "-object-list-li"; |
||
6278 | var g = a.titleTr; |
||
6279 | g || (g = a.title); |
||
6280 | var g = document.createTextNode(g), |
||
6281 | h = document.createElement("a"); |
||
6282 | h.className = d.classNamePrefix + "-object-list-a"; |
||
6283 | h.appendChild(g); |
||
6284 | f.appendChild(h); |
||
6285 | b.appendChild(f); |
||
6286 | this.addObjects(a, f); |
||
6287 | h.onmouseover = function() { |
||
6288 | c.chart.rollOverMapObject(a, !1) |
||
6289 | }; |
||
6290 | h.onmouseout = function() { |
||
6291 | c.chart.rollOutMapObject(a) |
||
6292 | }; |
||
6293 | h.onclick = function() { |
||
6294 | c.chart.clickMapObject(a) |
||
6295 | } |
||
6296 | } |
||
6297 | } |
||
6298 | }) |
||
6299 | })(); |
||
6300 |
The sequence or comma operator allows the inclusion of multiple expressions where only is permitted. The result of the sequence is the value of the last expression.
This operator is most often used in
for
statements.Used in another places it can make code hard to read, especially when people do not realize it even exists as a seperate operator.
This check looks for usage of the sequence operator in locations where it is not necessary and could be replaced by a series of expressions or statements.
could just as well be written as:
To learn more about the sequence operator, please refer to the MDN.