(function() { var win = window, legacy = !!win.$merge $extend = win.$extend || function() { return Object.append.apply(Object, arguments) }; win.HighchartsAdapter = { init: function() { var fxProto = Fx.prototype, fxStart = fxProto.start, morphProto = Fx.Morph.prototype, morphCompute = morphProto.compute; fxProto.start = function(from, to) { var fx = this, elem = fx.element; if (from.d) { fx.paths = Highcharts.pathAnim.init( elem, elem.d, fx.toD ); } fxStart.apply(fx, arguments); }; morphProto.compute = function(from, to, delta) { var fx = this, paths = fx.paths; if (paths) { fx.element.attr( 'd', Highcharts.pathAnim.step(paths[0], paths[1], delta, fx.toD) ); } else { return morphCompute.apply(fx, arguments); } }; }, animate: function (el, params, options) { var isSVGElement = el.attr, effect, complete = options && options.complete; if (isSVGElement && !el.setStyle) { el.getStyle = el.attr; el.setStyle = function() { var args = arguments; el.attr.call(el, args[0], args[1][0]); } el.$family = el.uid = true; } HighchartsAdapter.stop(el); effect = new Fx.Morph( isSVGElement ? el : $(el), $extend({ transition: Fx.Transitions.Quad.easeInOut }, options) ); if (params.d) { effect.toD = params.d; } if (complete) { effect.addEvent('complete', complete); } effect.start(params); el.fx = effect; }, each: function(arr, fn) { return legacy ? $each(arr, fn) : arr.each(fn); }, map: function (arr, fn){ return arr.map(fn); }, grep: function(arr, fn) { return arr.filter(fn); }, merge: function() { var args = arguments, args13 = [{}], i = args.length, ret; if (legacy) { ret = $merge.apply(null, args); } else { while (i--) { args13[i + 1] = args[i]; } ret = Object.merge.apply(Object, args13); } return ret; }, hyphenate: function (str){ return str.hyphenate(); }, addEvent: function (el, type, fn) { if (typeof type == 'string') { if (type == 'unload') { type = 'beforeunload'; } if (!el.addEvent) { if (el.nodeName) { el = $(el); } else { $extend(el, new Events()); } } el.addEvent(type, fn); } }, removeEvent: function(el, type, fn) { if (type) { if (type == 'unload') { type = 'beforeunload'; } el.removeEvent(type, fn); } }, fireEvent: function(el, event, eventArguments, defaultFunction) { m_event = new Event({ type: event, target: el }); m_event = $extend(event, eventArguments); m_event.preventDefault = function() { defaultFunction = null; }; if (el.fireEvent) { el.fireEvent(m_event.type, m_event); } if (defaultFunction) { defaultFunction(m_event); } }, stop: function (el) { if (el.fx) { el.fx.cancel(); } } } })();