highstock-rails 1.3.10 → 2.1.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/app/assets/images/highstock/meteogram-symbols-30px.png +0 -0
  4. data/app/assets/javascripts/highstock.js +418 -369
  5. data/app/assets/javascripts/highstock/adapters/standalone-framework.js +12 -12
  6. data/app/assets/javascripts/highstock/adapters/standalone-framework.src.js +635 -0
  7. data/app/assets/javascripts/highstock/highcharts-3d.js +48 -0
  8. data/app/assets/javascripts/highstock/highcharts-3d.src.js +1711 -0
  9. data/app/assets/javascripts/highstock/highcharts-more.js +49 -45
  10. data/app/assets/javascripts/highstock/highstock-all.js +637 -0
  11. data/app/assets/javascripts/highstock/modules/boost.js +12 -0
  12. data/app/assets/javascripts/highstock/modules/boost.src.js +591 -0
  13. data/app/assets/javascripts/highstock/modules/canvas-tools.js +9 -9
  14. data/app/assets/javascripts/highstock/modules/canvas-tools.src.js +3114 -0
  15. data/app/assets/javascripts/highstock/modules/data.js +20 -10
  16. data/app/assets/javascripts/highstock/modules/data.src.js +957 -0
  17. data/app/assets/javascripts/highstock/modules/drilldown.js +17 -14
  18. data/app/assets/javascripts/highstock/modules/drilldown.src.js +717 -0
  19. data/app/assets/javascripts/highstock/modules/exporting.js +17 -15
  20. data/app/assets/javascripts/highstock/modules/exporting.src.js +780 -0
  21. data/app/assets/javascripts/highstock/modules/funnel.js +5 -5
  22. data/app/assets/javascripts/highstock/modules/funnel.src.js +322 -0
  23. data/app/assets/javascripts/highstock/modules/heatmap.js +23 -2
  24. data/app/assets/javascripts/highstock/modules/heatmap.src.js +711 -0
  25. data/app/assets/javascripts/highstock/modules/no-data-to-display.js +4 -4
  26. data/app/assets/javascripts/highstock/modules/no-data-to-display.src.js +143 -0
  27. data/app/assets/javascripts/highstock/modules/offline-exporting.js +14 -0
  28. data/app/assets/javascripts/highstock/modules/offline-exporting.src.js +280 -0
  29. data/app/assets/javascripts/highstock/modules/solid-gauge.js +14 -0
  30. data/app/assets/javascripts/highstock/modules/solid-gauge.src.js +273 -0
  31. data/app/assets/javascripts/highstock/modules/treemap.js +30 -0
  32. data/app/assets/javascripts/highstock/modules/treemap.src.js +868 -0
  33. data/app/assets/javascripts/highstock/themes/dark-blue.js +1 -1
  34. data/app/assets/javascripts/highstock/themes/dark-green.js +1 -1
  35. data/app/assets/javascripts/highstock/themes/dark-unica.js +213 -0
  36. data/app/assets/javascripts/highstock/themes/gray.js +1 -1
  37. data/app/assets/javascripts/highstock/themes/grid-light.js +74 -0
  38. data/app/assets/javascripts/highstock/themes/sand-signika.js +104 -0
  39. data/lib/highstock/rails/version.rb +1 -1
  40. metadata +26 -7
  41. data/app/assets/javascripts/highstock/adapters/mootools-adapter.js +0 -13
  42. data/app/assets/javascripts/highstock/adapters/prototype-adapter.js +0 -15
  43. data/app/assets/javascripts/highstock/modules/annotations.js +0 -7
  44. data/app/assets/javascripts/highstock/modules/map.js +0 -41
@@ -1,18 +1,18 @@
1
1
  /*
2
- Highstock JS v1.3.10 (2014-03-10)
2
+ Highstock JS v2.1.10 (2015-12-07)
3
3
 
4
4
  Standalone Highcharts Framework
5
5
 
6
6
  License: MIT License
7
7
  */
8
- var HighchartsAdapter=function(){function o(c){function b(b,a,d){b.removeEventListener(a,d,!1)}function d(b,a,d){d=b.HCProxiedMethods[d.toString()];b.detachEvent("on"+a,d)}function a(a,c){var f=a.HCEvents,i,g,k,j;if(a.removeEventListener)i=b;else if(a.attachEvent)i=d;else return;c?(g={},g[c]=!0):g=f;for(j in g)if(f[j])for(k=f[j].length;k--;)i(a,j,f[j][k])}c.HCExtended||Highcharts.extend(c,{HCExtended:!0,HCEvents:{},bind:function(b,a){var d=this,c=this.HCEvents,g;if(d.addEventListener)d.addEventListener(b,
9
- a,!1);else if(d.attachEvent){g=function(b){a.call(d,b)};if(!d.HCProxiedMethods)d.HCProxiedMethods={};d.HCProxiedMethods[a.toString()]=g;d.attachEvent("on"+b,g)}c[b]===r&&(c[b]=[]);c[b].push(a)},unbind:function(c,h){var f,i;c?(f=this.HCEvents[c]||[],h?(i=HighchartsAdapter.inArray(h,f),i>-1&&(f.splice(i,1),this.HCEvents[c]=f),this.removeEventListener?b(this,c,h):this.attachEvent&&d(this,c,h)):(a(this,c),this.HCEvents[c]=[])):(a(this),this.HCEvents={})},trigger:function(b,a){var d=this.HCEvents[b]||
10
- [],c=d.length,g,k,j;k=function(){a.defaultPrevented=!0};for(g=0;g<c;g++){j=d[g];if(a.stopped)break;a.preventDefault=k;a.target=this;if(!a.type)a.type=b;j.call(this,a)===!1&&a.preventDefault()}}});return c}var r,l=document,p=[],m=[],q,n;Math.easeInOutSine=function(c,b,d,a){return-d/2*(Math.cos(Math.PI*c/a)-1)+b};return{init:function(c){if(!l.defaultView)this._getStyle=function(b,d){var a;return b.style[d]?b.style[d]:(d==="opacity"&&(d="filter"),a=b.currentStyle[d.replace(/\-(\w)/g,function(a,b){return b.toUpperCase()})],
11
- d==="filter"&&(a=a.replace(/alpha\(opacity=([0-9]+)\)/,function(a,b){return b/100})),a===""?1:a)},this.adapterRun=function(b,d){var a={width:"clientWidth",height:"clientHeight"}[d];if(a)return b.style.zoom=1,b[a]-2*parseInt(HighchartsAdapter._getStyle(b,"padding"),10)};if(!Array.prototype.forEach)this.each=function(b,d){for(var a=0,c=b.length;a<c;a++)if(d.call(b[a],b[a],a,b)===!1)return a};if(!Array.prototype.indexOf)this.inArray=function(b,d){var a,c=0;if(d)for(a=d.length;c<a;c++)if(d[c]===b)return c;
12
- return-1};if(!Array.prototype.filter)this.grep=function(b,d){for(var a=[],c=0,h=b.length;c<h;c++)d(b[c],c)&&a.push(b[c]);return a};n=function(b,c,a){this.options=c;this.elem=b;this.prop=a};n.prototype={update:function(){var b;b=this.paths;var d=this.elem,a=d.element;b&&a?d.attr("d",c.step(b[0],b[1],this.now,this.toD)):d.attr?a&&d.attr(this.prop,this.now):(b={},b[this.prop]=this.now+this.unit,Highcharts.css(d,b));this.options.step&&this.options.step.call(this.elem,this.now,this)},custom:function(b,
13
- c,a){var e=this,h=function(a){return e.step(a)},f;this.startTime=+new Date;this.start=b;this.end=c;this.unit=a;this.now=this.start;this.pos=this.state=0;h.elem=this.elem;h()&&m.push(h)===1&&(q=setInterval(function(){for(f=0;f<m.length;f++)m[f]()||m.splice(f--,1);m.length||clearInterval(q)},13))},step:function(b){var c=+new Date,a;a=this.options;var e=this.elem,h;if(e.stopAnimation||e.attr&&!e.element)a=!1;else if(b||c>=a.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();
14
- b=this.options.curAnim[this.prop]=!0;for(h in a.curAnim)a.curAnim[h]!==!0&&(b=!1);b&&a.complete&&a.complete.call(e);a=!1}else e=c-this.startTime,this.state=e/a.duration,this.pos=a.easing(e,0,1,a.duration),this.now=this.start+(this.end-this.start)*this.pos,this.update(),a=!0;return a}};this.animate=function(b,d,a){var e,h="",f,i,g;b.stopAnimation=!1;if(typeof a!=="object"||a===null)e=arguments,a={duration:e[2],easing:e[3],complete:e[4]};if(typeof a.duration!=="number")a.duration=400;a.easing=Math[a.easing]||
15
- Math.easeInOutSine;a.curAnim=Highcharts.extend({},d);for(g in d)i=new n(b,a,g),f=null,g==="d"?(i.paths=c.init(b,b.d,d.d),i.toD=d.d,e=0,f=1):b.attr?e=b.attr(g):(e=parseFloat(HighchartsAdapter._getStyle(b,g))||0,g!=="opacity"&&(h="px")),f||(f=parseFloat(d[g])),i.custom(e,f,h)}},_getStyle:function(c,b){return window.getComputedStyle(c).getPropertyValue(b)},getScript:function(c,b){var d=l.getElementsByTagName("head")[0],a=l.createElement("script");a.type="text/javascript";a.src=c;a.onload=b;d.appendChild(a)},
16
- inArray:function(c,b){return b.indexOf?b.indexOf(c):p.indexOf.call(b,c)},adapterRun:function(c,b){return parseInt(HighchartsAdapter._getStyle(c,b),10)},grep:function(c,b){return p.filter.call(c,b)},map:function(c,b){for(var d=[],a=0,e=c.length;a<e;a++)d[a]=b.call(c[a],c[a],a,c);return d},offset:function(c){var b=document.documentElement,c=c.getBoundingClientRect();return{top:c.top+(window.pageYOffset||b.scrollTop)-(b.clientTop||0),left:c.left+(window.pageXOffset||b.scrollLeft)-(b.clientLeft||0)}},
17
- addEvent:function(c,b,d){o(c).bind(b,d)},removeEvent:function(c,b,d){o(c).unbind(b,d)},fireEvent:function(c,b,d,a){var e;l.createEvent&&(c.dispatchEvent||c.fireEvent)?(e=l.createEvent("Events"),e.initEvent(b,!0,!0),e.target=c,Highcharts.extend(e,d),c.dispatchEvent?c.dispatchEvent(e):c.fireEvent(b,e)):c.HCExtended===!0&&(d=d||{},c.trigger(b,d));d&&d.defaultPrevented&&(a=null);a&&a(d)},washMouseEvent:function(c){return c},stop:function(c){c.stopAnimation=!0},each:function(c,b){return Array.prototype.forEach.call(c,
18
- b)}}}();
8
+ (function(j,l){typeof module==="object"&&module.exports?module.exports=j.document?l(j):function(j){return l(j)}:j.HighchartsAdapter=l()})(typeof window!=="undefined"?window:this,function(j){function l(c){function a(a,b,d){a.removeEventListener(b,d,!1)}function d(a,b,d){d=a.HCProxiedMethods[d.toString()];a.detachEvent("on"+b,d)}function b(b,c){var f=b.HCEvents,k,h,p,g;if(b.removeEventListener)k=a;else if(b.attachEvent)k=d;else return;c?(h={},h[c]=!0):h=f;for(g in h)if(f[g])for(p=f[g].length;p--;)k(b,
9
+ g,f[g][p])}if(!c.HCExtended)c.HCExtended=!0,c.HCEvents={},c.bind=function(a,b){var d=this,c=this.HCEvents,h;if(d.addEventListener)d.addEventListener(a,b,!1);else if(d.attachEvent){h=function(a){a.target=a.srcElement||m;b.call(d,a)};if(!d.HCProxiedMethods)d.HCProxiedMethods={};d.HCProxiedMethods[b.toString()]=h;d.attachEvent("on"+a,h)}c[a]===u&&(c[a]=[]);c[a].push(b)},c.unbind=function(c,i){var f,k;c?(f=this.HCEvents[c]||[],i?(k=s.inArray(i,f),k>-1&&(f.splice(k,1),this.HCEvents[c]=f),this.removeEventListener?
10
+ a(this,c,i):this.attachEvent&&d(this,c,i)):(b(this,c),this.HCEvents[c]=[])):(b(this),this.HCEvents={})},c.trigger=function(a,b){var d=this.HCEvents[a]||[],c=d.length,h,g,j;g=function(){b.defaultPrevented=!0};for(h=0;h<c;h++){j=d[h];if(b.stopped)break;b.preventDefault=g;b.target=this;if(!b.type)b.type=a;j.call(this,b)===!1&&b.preventDefault()}};return c}var u,m=j||window,n=m.document,t=[],o,g=[],q={},s,r;Math.easeInOutSine=function(c,a,d,b){return-d/2*(Math.cos(Math.PI*c/b)-1)+a};o=function(c,a){var d=
11
+ m.getComputedStyle(c,void 0);return d&&d.getPropertyValue(a)};return s={init:function(c){if(!n.defaultView)o=function(a,d){var b;if(a.style[d])return a.style[d];d==="opacity"&&(d="filter");b=a.currentStyle[d.replace(/\-(\w)/g,function(a,b){return b.toUpperCase()})];d==="filter"&&(b=b.replace(/alpha\(opacity=([0-9]+)\)/,function(a,b){return b/100}));return b===""?1:b},this.adapterRun=function(a,d){var b={width:"clientWidth",height:"clientHeight"}[d];if(b)return a.style.zoom=1,a[b]-2*parseInt(o(a,"padding"),
12
+ 10)};if(!Array.prototype.forEach)this.each=function(a,d){for(var b=0,c=a.length;b<c;b++)if(d.call(a[b],a[b],b,a)===!1)return b};if(!Array.prototype.indexOf)this.inArray=function(a,d){var b,c=0;if(d)for(b=d.length;c<b;c++)if(d[c]===a)return c;return-1};if(!Array.prototype.filter)this.grep=function(a,d){for(var b=[],c=0,i=a.length;c<i;c++)d(a[c],c)&&b.push(a[c]);return b};r=function(a,c,b){this.options=c;this.elem=a;this.prop=b};r.prototype={update:function(){var a;a=this.paths;var d=this.elem,b=d.element,
13
+ e;if(q[this.prop])q[this.prop](this);else if(a&&b)d.attr("d",c.step(a[0],a[1],this.now,this.toD));else if(d.attr)b&&d.attr(this.prop,this.now);else for(e in a={},a[this.prop]=this.now+this.unit,a)d.style[e]=a[e];this.options.step&&this.options.step.call(this.elem,this.now,this)},custom:function(a,c,b){var e=this,i=function(a){return e.step(a)},f;this.startTime=+new Date;this.start=a;this.end=c;this.unit=b;this.now=this.start;this.pos=this.state=0;i.elem=this.elem;if(i()&&g.push(i)===1)i.timerId=setInterval(function(){for(f=
14
+ 0;f<g.length;f++)g[f]()||g.splice(f--,1);g.length||clearInterval(i.timerId)},13)},step:function(a){var c=+new Date,b;b=this.options;var e=this.elem,i;if(e.attr&&!e.element)b=!1;else if(a||c>=b.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();a=this.options.curAnim[this.prop]=!0;for(i in b.curAnim)b.curAnim[i]!==!0&&(a=!1);a&&b.complete&&b.complete.call(e);b=!1}else e=c-this.startTime,this.state=e/b.duration,this.pos=b.easing(e,0,1,b.duration),this.now=this.start+(this.end-
15
+ this.start)*this.pos,this.update(),b=!0;return b}};this.animate=function(a,d,b){var e,i="",f,g,h;if(typeof b!=="object"||b===null)e=arguments,b={duration:e[2],easing:e[3],complete:e[4]};if(typeof b.duration!=="number")b.duration=400;b.easing=Math[b.easing]||Math.easeInOutSine;b.curAnim={};for(f in d)b.curAnim[f]=d[f];for(h in d)g=new r(a,b,h),f=null,h==="d"?(g.paths=c.init(a,a.d,d.d),g.toD=d.d,e=0,f=1):a.attr?e=a.attr(h):(e=parseFloat(o(a,h))||0,h!=="opacity"&&(i="px")),f||(f=d[h]),f.match&&f.match("px")&&
16
+ (f=f.replace(/px/g,"")),g.custom(e,f,i)}},addAnimSetter:function(c,a){q[c]=a},getScript:function(c,a){var d=n.getElementsByTagName("head")[0],b=n.createElement("script");b.type="text/javascript";b.src=c;b.onload=a;d.appendChild(b)},inArray:function(c,a){return a.indexOf?a.indexOf(c):t.indexOf.call(a,c)},adapterRun:function(c,a){return parseInt(o(c,a),10)},grep:function(c,a){return t.filter.call(c,a)},map:function(c,a){for(var d=[],b=0,e=c.length;b<e;b++)d[b]=a.call(c[b],c[b],b,c);return d},offset:function(c){var a=
17
+ document.documentElement,c=c.getBoundingClientRect();return{top:c.top+(m.pageYOffset||a.scrollTop)-(a.clientTop||0),left:c.left+(m.pageXOffset||a.scrollLeft)-(a.clientLeft||0)}},addEvent:function(c,a,d){l(c).bind(a,d)},removeEvent:function(c,a,d){l(c).unbind(a,d)},fireEvent:function(c,a,d,b){var e,g;if(n.createEvent&&(c.dispatchEvent||c.fireEvent)){e=n.createEvent("Events");e.initEvent(a,!0,!0);e.target=c;for(g in d)e[g]=d[g];c.dispatchEvent?c.dispatchEvent(e):c.fireEvent(a,e)}else c.HCExtended===
18
+ !0&&(d=d||{},c.trigger(a,d));d&&d.defaultPrevented&&(b=null);b&&b(d)},washMouseEvent:function(c){return c},stop:function(c){for(var a=g.length,d;a--;)d=g[a],d.elem===c&&g.splice(a,1)},each:function(c,a){return Array.prototype.forEach.call(c,a)}}});
@@ -0,0 +1,635 @@
1
+ /**
2
+ * @license Highstock JS v2.1.10 (2015-12-07)
3
+ *
4
+ * Standalone Highcharts Framework
5
+ *
6
+ * License: MIT License
7
+ */
8
+
9
+ (function (root, factory) {
10
+ if (typeof module === 'object' && module.exports) {
11
+ module.exports = root.document ?
12
+ factory(root) :
13
+ function (w) {
14
+ return factory(w);
15
+ };
16
+ } else {
17
+ root.HighchartsAdapter = factory();
18
+ }
19
+ }(typeof window !== 'undefined' ? window : this, function (w) {
20
+
21
+ var UNDEFINED,
22
+ win = w || window,
23
+ doc = win.document,
24
+ emptyArray = [],
25
+ _getStyle,
26
+ timers = [],
27
+ animSetters = {},
28
+ HighchartsAdapter,
29
+ Fx;
30
+
31
+ Math.easeInOutSine = function (t, b, c, d) {
32
+ return -c / 2 * (Math.cos(Math.PI * t / d) - 1) + b;
33
+ };
34
+
35
+ /**
36
+ * Internal method to return CSS value for given element and property
37
+ */
38
+ _getStyle = function (el, prop) {
39
+ var style = win.getComputedStyle(el, undefined);
40
+ return style && style.getPropertyValue(prop);
41
+ };
42
+
43
+
44
+ /**
45
+ * Extend given object with custom events
46
+ */
47
+ function augment(obj) {
48
+ function removeOneEvent(el, type, fn) {
49
+ el.removeEventListener(type, fn, false);
50
+ }
51
+
52
+ function IERemoveOneEvent(el, type, fn) {
53
+ fn = el.HCProxiedMethods[fn.toString()];
54
+ el.detachEvent('on' + type, fn);
55
+ }
56
+
57
+ function removeAllEvents(el, type) {
58
+ var events = el.HCEvents,
59
+ remove,
60
+ types,
61
+ len,
62
+ n;
63
+
64
+ if (el.removeEventListener) {
65
+ remove = removeOneEvent;
66
+ } else if (el.attachEvent) {
67
+ remove = IERemoveOneEvent;
68
+ } else {
69
+ return; // break on non-DOM events
70
+ }
71
+
72
+
73
+ if (type) {
74
+ types = {};
75
+ types[type] = true;
76
+ } else {
77
+ types = events;
78
+ }
79
+
80
+ for (n in types) {
81
+ if (events[n]) {
82
+ len = events[n].length;
83
+ while (len--) {
84
+ remove(el, n, events[n][len]);
85
+ }
86
+ }
87
+ }
88
+ }
89
+
90
+ if (!obj.HCExtended) {
91
+ obj.HCExtended = true;
92
+
93
+ obj.HCEvents = {};
94
+
95
+ obj.bind = function (name, fn) {
96
+ var el = this,
97
+ events = this.HCEvents,
98
+ wrappedFn;
99
+
100
+ // handle DOM events in modern browsers
101
+ if (el.addEventListener) {
102
+ el.addEventListener(name, fn, false);
103
+
104
+ // handle old IE implementation
105
+ } else if (el.attachEvent) {
106
+
107
+ wrappedFn = function (e) {
108
+ e.target = e.srcElement || win; // #2820
109
+ fn.call(el, e);
110
+ };
111
+
112
+ if (!el.HCProxiedMethods) {
113
+ el.HCProxiedMethods = {};
114
+ }
115
+
116
+ // link wrapped fn with original fn, so we can get this in removeEvent
117
+ el.HCProxiedMethods[fn.toString()] = wrappedFn;
118
+
119
+ el.attachEvent('on' + name, wrappedFn);
120
+ }
121
+
122
+
123
+ if (events[name] === UNDEFINED) {
124
+ events[name] = [];
125
+ }
126
+
127
+ events[name].push(fn);
128
+ };
129
+
130
+ obj.unbind = function (name, fn) {
131
+ var events,
132
+ index;
133
+
134
+ if (name) {
135
+ events = this.HCEvents[name] || [];
136
+ if (fn) {
137
+ index = HighchartsAdapter.inArray(fn, events);
138
+ if (index > -1) {
139
+ events.splice(index, 1);
140
+ this.HCEvents[name] = events;
141
+ }
142
+ if (this.removeEventListener) {
143
+ removeOneEvent(this, name, fn);
144
+ } else if (this.attachEvent) {
145
+ IERemoveOneEvent(this, name, fn);
146
+ }
147
+ } else {
148
+ removeAllEvents(this, name);
149
+ this.HCEvents[name] = [];
150
+ }
151
+ } else {
152
+ removeAllEvents(this);
153
+ this.HCEvents = {};
154
+ }
155
+ };
156
+
157
+ obj.trigger = function (name, args) {
158
+ var events = this.HCEvents[name] || [],
159
+ target = this,
160
+ len = events.length,
161
+ i,
162
+ preventDefault,
163
+ fn;
164
+
165
+ // Attach a simple preventDefault function to skip default handler if called
166
+ preventDefault = function () {
167
+ args.defaultPrevented = true;
168
+ };
169
+
170
+ for (i = 0; i < len; i++) {
171
+ fn = events[i];
172
+
173
+ // args is never null here
174
+ if (args.stopped) {
175
+ return;
176
+ }
177
+
178
+ args.preventDefault = preventDefault;
179
+ args.target = target;
180
+
181
+ // If the type is not set, we're running a custom event (#2297). If it is set,
182
+ // we're running a browser event, and setting it will cause en error in
183
+ // IE8 (#2465).
184
+ if (!args.type) {
185
+ args.type = name;
186
+ }
187
+
188
+
189
+
190
+ // If the event handler return false, prevent the default handler from executing
191
+ if (fn.call(this, args) === false) {
192
+ args.preventDefault();
193
+ }
194
+ }
195
+ };
196
+ }
197
+
198
+ return obj;
199
+ }
200
+
201
+
202
+ HighchartsAdapter = {
203
+
204
+ /**
205
+ * Initialize the adapter. This is run once as Highcharts is first run.
206
+ */
207
+ init: function (pathAnim) {
208
+
209
+ /**
210
+ * Compatibility section to add support for legacy IE. This can be removed if old IE
211
+ * support is not needed.
212
+ */
213
+ if (!doc.defaultView) {
214
+ _getStyle = function (el, prop) {
215
+ var val;
216
+ if (el.style[prop]) {
217
+ return el.style[prop];
218
+ }
219
+ if (prop === 'opacity') {
220
+ prop = 'filter';
221
+ }
222
+
223
+ val = el.currentStyle[prop.replace(/\-(\w)/g, function (a, b) {
224
+ return b.toUpperCase();
225
+ })];
226
+ if (prop === 'filter') {
227
+ val = val.replace(
228
+ /alpha\(opacity=([0-9]+)\)/,
229
+ function (a, b) {
230
+ return b / 100;
231
+ }
232
+ );
233
+ }
234
+
235
+ return val === '' ? 1 : val;
236
+ };
237
+ this.adapterRun = function (elem, method) {
238
+ var alias = { width: 'clientWidth', height: 'clientHeight' }[method];
239
+
240
+ if (alias) {
241
+ elem.style.zoom = 1;
242
+ return elem[alias] - 2 * parseInt(_getStyle(elem, 'padding'), 10);
243
+ }
244
+ };
245
+ }
246
+
247
+ if (!Array.prototype.forEach) {
248
+ this.each = function (arr, fn) { // legacy
249
+ var i = 0,
250
+ len = arr.length;
251
+ for (; i < len; i++) {
252
+ if (fn.call(arr[i], arr[i], i, arr) === false) {
253
+ return i;
254
+ }
255
+ }
256
+ };
257
+ }
258
+
259
+ if (!Array.prototype.indexOf) {
260
+ this.inArray = function (item, arr) {
261
+ var len,
262
+ i = 0;
263
+
264
+ if (arr) {
265
+ len = arr.length;
266
+
267
+ for (; i < len; i++) {
268
+ if (arr[i] === item) {
269
+ return i;
270
+ }
271
+ }
272
+ }
273
+
274
+ return -1;
275
+ };
276
+ }
277
+
278
+ if (!Array.prototype.filter) {
279
+ this.grep = function (elements, fn) {
280
+ var ret = [],
281
+ i = 0,
282
+ length = elements.length;
283
+
284
+ for (; i < length; i++) {
285
+ if (!!fn(elements[i], i)) {
286
+ ret.push(elements[i]);
287
+ }
288
+ }
289
+
290
+ return ret;
291
+ };
292
+ }
293
+
294
+ //--- End compatibility section ---
295
+
296
+
297
+ /**
298
+ * Start of animation specific code
299
+ */
300
+ Fx = function (elem, options, prop) {
301
+ this.options = options;
302
+ this.elem = elem;
303
+ this.prop = prop;
304
+ };
305
+ Fx.prototype = {
306
+
307
+ update: function () {
308
+ var styles,
309
+ paths = this.paths,
310
+ elem = this.elem,
311
+ elemelem = elem.element,
312
+ prop; // if destroyed, it is null
313
+
314
+ // Animation setter defined from outside
315
+ if (animSetters[this.prop]) {
316
+ animSetters[this.prop](this);
317
+
318
+ // Animating a path definition on SVGElement
319
+ } else if (paths && elemelem) {
320
+ elem.attr('d', pathAnim.step(paths[0], paths[1], this.now, this.toD));
321
+
322
+ // Other animations on SVGElement
323
+ } else if (elem.attr) {
324
+ if (elemelem) {
325
+ elem.attr(this.prop, this.now);
326
+ }
327
+
328
+ // HTML styles, raw HTML content like container size
329
+ } else {
330
+ styles = {};
331
+ styles[this.prop] = this.now + this.unit;
332
+ for (prop in styles) {
333
+ elem.style[prop] = styles[prop];
334
+ }
335
+ }
336
+
337
+ if (this.options.step) {
338
+ this.options.step.call(this.elem, this.now, this);
339
+ }
340
+
341
+ },
342
+ custom: function (from, to, unit) {
343
+ var self = this,
344
+ t = function (gotoEnd) {
345
+ return self.step(gotoEnd);
346
+ },
347
+ i;
348
+
349
+ this.startTime = +new Date();
350
+ this.start = from;
351
+ this.end = to;
352
+ this.unit = unit;
353
+ this.now = this.start;
354
+ this.pos = this.state = 0;
355
+
356
+ t.elem = this.elem;
357
+
358
+ if (t() && timers.push(t) === 1) {
359
+ t.timerId = setInterval(function () {
360
+
361
+ for (i = 0; i < timers.length; i++) {
362
+ if (!timers[i]()) {
363
+ timers.splice(i--, 1);
364
+ }
365
+ }
366
+
367
+ if (!timers.length) {
368
+ clearInterval(t.timerId);
369
+ }
370
+ }, 13);
371
+ }
372
+ },
373
+
374
+ step: function (gotoEnd) {
375
+ var t = +new Date(),
376
+ ret,
377
+ done,
378
+ options = this.options,
379
+ elem = this.elem,
380
+ i;
381
+
382
+ if (elem.attr && !elem.element) { // #2616, element including flag is destroyed
383
+ ret = false;
384
+
385
+ } else if (gotoEnd || t >= options.duration + this.startTime) {
386
+ this.now = this.end;
387
+ this.pos = this.state = 1;
388
+ this.update();
389
+
390
+ this.options.curAnim[this.prop] = true;
391
+
392
+ done = true;
393
+ for (i in options.curAnim) {
394
+ if (options.curAnim[i] !== true) {
395
+ done = false;
396
+ }
397
+ }
398
+
399
+ if (done) {
400
+ if (options.complete) {
401
+ options.complete.call(elem);
402
+ }
403
+ }
404
+ ret = false;
405
+
406
+ } else {
407
+ var n = t - this.startTime;
408
+ this.state = n / options.duration;
409
+ this.pos = options.easing(n, 0, 1, options.duration);
410
+ this.now = this.start + ((this.end - this.start) * this.pos);
411
+ this.update();
412
+ ret = true;
413
+ }
414
+ return ret;
415
+ }
416
+ };
417
+
418
+ /**
419
+ * The adapter animate method
420
+ */
421
+ this.animate = function (el, prop, opt) {
422
+ var start,
423
+ unit = '',
424
+ end,
425
+ fx,
426
+ args,
427
+ name,
428
+ key,
429
+ PX = 'px';
430
+
431
+ if (typeof opt !== 'object' || opt === null) {
432
+ args = arguments;
433
+ opt = {
434
+ duration: args[2],
435
+ easing: args[3],
436
+ complete: args[4]
437
+ };
438
+ }
439
+ if (typeof opt.duration !== 'number') {
440
+ opt.duration = 400;
441
+ }
442
+ opt.easing = Math[opt.easing] || Math.easeInOutSine;
443
+ opt.curAnim = {};
444
+ for (key in prop) {
445
+ opt.curAnim[key] = prop[key];
446
+ }
447
+
448
+ for (name in prop) {
449
+ fx = new Fx(el, opt, name);
450
+ end = null;
451
+
452
+ if (name === 'd') {
453
+ fx.paths = pathAnim.init(
454
+ el,
455
+ el.d,
456
+ prop.d
457
+ );
458
+ fx.toD = prop.d;
459
+ start = 0;
460
+ end = 1;
461
+ } else if (el.attr) {
462
+ start = el.attr(name);
463
+ } else {
464
+ start = parseFloat(_getStyle(el, name)) || 0;
465
+ if (name !== 'opacity') {
466
+ unit = PX;
467
+ }
468
+ }
469
+
470
+ if (!end) {
471
+ end = prop[name];
472
+ }
473
+ if (end.match && end.match(PX)) {
474
+ end = end.replace(/px/g, ''); // #4351
475
+ }
476
+ fx.custom(start, end, unit);
477
+ }
478
+ };
479
+ },
480
+
481
+ /**
482
+ * Add an animation setter for a specific property
483
+ */
484
+ addAnimSetter: function (prop, fn) {
485
+ animSetters[prop] = fn;
486
+ },
487
+
488
+ /**
489
+ * Downloads a script and executes a callback when done.
490
+ * @param {String} scriptLocation
491
+ * @param {Function} callback
492
+ */
493
+ getScript: function (scriptLocation, callback) {
494
+ // We cannot assume that Assets class from mootools-more is available so instead insert a script tag to download script.
495
+ var head = doc.getElementsByTagName('head')[0],
496
+ script = doc.createElement('script');
497
+
498
+ script.type = 'text/javascript';
499
+ script.src = scriptLocation;
500
+ script.onload = callback;
501
+
502
+ head.appendChild(script);
503
+ },
504
+
505
+ /**
506
+ * Return the index of an item in an array, or -1 if not found
507
+ */
508
+ inArray: function (item, arr) {
509
+ return arr.indexOf ? arr.indexOf(item) : emptyArray.indexOf.call(arr, item);
510
+ },
511
+
512
+
513
+ /**
514
+ * A direct link to adapter methods
515
+ */
516
+ adapterRun: function (elem, method) {
517
+ return parseInt(_getStyle(elem, method), 10);
518
+ },
519
+
520
+ /**
521
+ * Filter an array
522
+ */
523
+ grep: function (elements, callback) {
524
+ return emptyArray.filter.call(elements, callback);
525
+ },
526
+
527
+ /**
528
+ * Map an array
529
+ */
530
+ map: function (arr, fn) {
531
+ var results = [], i = 0, len = arr.length;
532
+
533
+ for (; i < len; i++) {
534
+ results[i] = fn.call(arr[i], arr[i], i, arr);
535
+ }
536
+
537
+ return results;
538
+ },
539
+
540
+ /**
541
+ * Get the element's offset position, corrected by overflow:auto. Loosely based on jQuery's offset method.
542
+ */
543
+ offset: function (el) {
544
+ var docElem = document.documentElement,
545
+ box = el.getBoundingClientRect();
546
+
547
+ return {
548
+ top: box.top + (win.pageYOffset || docElem.scrollTop) - (docElem.clientTop || 0),
549
+ left: box.left + (win.pageXOffset || docElem.scrollLeft) - (docElem.clientLeft || 0)
550
+ };
551
+ },
552
+
553
+ /**
554
+ * Add an event listener
555
+ */
556
+ addEvent: function (el, type, fn) {
557
+ augment(el).bind(type, fn);
558
+ },
559
+
560
+ /**
561
+ * Remove event added with addEvent
562
+ */
563
+ removeEvent: function (el, type, fn) {
564
+ augment(el).unbind(type, fn);
565
+ },
566
+
567
+ /**
568
+ * Fire an event on a custom object
569
+ */
570
+ fireEvent: function (el, type, eventArguments, defaultFunction) {
571
+ var e,
572
+ key;
573
+
574
+ if (doc.createEvent && (el.dispatchEvent || el.fireEvent)) {
575
+ e = doc.createEvent('Events');
576
+ e.initEvent(type, true, true);
577
+ e.target = el;
578
+
579
+ for (key in eventArguments) {
580
+ e[key] = eventArguments[key];
581
+ }
582
+
583
+ if (el.dispatchEvent) {
584
+ el.dispatchEvent(e);
585
+ } else {
586
+ el.fireEvent(type, e);
587
+ }
588
+
589
+ } else if (el.HCExtended === true) {
590
+ eventArguments = eventArguments || {};
591
+ el.trigger(type, eventArguments);
592
+ }
593
+
594
+ if (eventArguments && eventArguments.defaultPrevented) {
595
+ defaultFunction = null;
596
+ }
597
+
598
+ if (defaultFunction) {
599
+ defaultFunction(eventArguments);
600
+ }
601
+ },
602
+
603
+ washMouseEvent: function (e) {
604
+ return e;
605
+ },
606
+
607
+
608
+ /**
609
+ * Stop running animation
610
+ */
611
+ stop: function (el) {
612
+
613
+ var i = timers.length,
614
+ timer;
615
+
616
+ // Remove timers related to this element (#4519)
617
+ while (i--) {
618
+ timer = timers[i];
619
+ if (timer.elem === el) {
620
+ timers.splice(i, 1);
621
+ }
622
+ }
623
+ },
624
+
625
+ /**
626
+ * Utility for iterating over an array. Parameters are reversed compared to jQuery.
627
+ * @param {Array} arr
628
+ * @param {Function} fn
629
+ */
630
+ each: function (arr, fn) { // modern browsers
631
+ return Array.prototype.forEach.call(arr, fn);
632
+ }
633
+ };
634
+ return HighchartsAdapter;
635
+ }));