(function(_global){
var require, define;
(function () {
var mods = {};
define = function (id, deps, factory) {
mods[id] = {
id: id,
deps: deps,
factory: factory,
defined: 0,
exports: {},
require: createRequire(id)
};
};
require = createRequire('');
function normalize(id, baseId) {
if (!baseId) {
return id;
}
if (id.indexOf('.') === 0) {
var basePath = baseId.split('/');
var namePath = id.split('/');
var baseLen = basePath.length - 1;
var nameLen = namePath.length;
var cutBaseTerms = 0;
var cutNameTerms = 0;
pathLoop: for (var i = 0; i < nameLen; i++) {
switch (namePath[i]) {
case '..':
if (cutBaseTerms < baseLen) {
cutBaseTerms++;
cutNameTerms++;
}
else {
break pathLoop;
}
break;
case '.':
cutNameTerms++;
break;
default:
break pathLoop;
}
}
basePath.length = baseLen - cutBaseTerms;
namePath = namePath.slice(cutNameTerms);
return basePath.concat(namePath).join('/');
}
return id;
}
function createRequire(baseId) {
var cacheMods = {};
function localRequire(id, callback) {
if (typeof id === 'string') {
var exports = cacheMods[id];
if (!exports) {
exports = getModExports(normalize(id, baseId));
cacheMods[id] = exports;
}
return exports;
}
else if (id instanceof Array) {
callback = callback || function () {};
callback.apply(this, getModsExports(id, callback, baseId));
}
};
return localRequire;
}
function getModsExports(ids, factory, baseId) {
var es = [];
var mod = mods[baseId];
for (var i = 0, l = Math.min(ids.length, factory.length); i < l; i++) {
var id = normalize(ids[i], baseId);
var arg;
switch (id) {
case 'require':
arg = (mod && mod.require) || require;
break;
case 'exports':
arg = mod.exports;
break;
case 'module':
arg = mod;
break;
default:
arg = getModExports(id);
}
es.push(arg);
}
return es;
}
function getModExports(id) {
var mod = mods[id];
if (!mod) {
throw new Error('No ' + id);
}
if (!mod.defined) {
var factory = mod.factory;
var factoryReturn = factory.apply(
this,
getModsExports(mod.deps || [], factory, id)
);
if (typeof factoryReturn !== 'undefined') {
mod.exports = factoryReturn;
}
mod.defined = 1;
}
return mod.exports;
}
}());
define('echarts', ['echarts/echarts'], function (main) {return main;});
define('echarts/echarts', [
'require',
'./config',
'zrender/tool/util',
'zrender/tool/event',
'zrender/tool/env',
'zrender',
'zrender/config',
'./chart/island',
'./component/toolbox',
'./component',
'./component/title',
'./component/tooltip',
'./component/legend',
'./util/ecData',
'./chart',
'zrender/tool/color',
'./component/timeline',
'zrender/shape/Image',
'zrender/loadingEffect/Bar',
'zrender/loadingEffect/Bubble',
'zrender/loadingEffect/DynamicLine',
'zrender/loadingEffect/Ring',
'zrender/loadingEffect/Spin',
'zrender/loadingEffect/Whirling',
'./theme/macarons',
'./theme/infographic'
], function (require) {
var ecConfig = require('./config');
var zrUtil = require('zrender/tool/util');
var zrEvent = require('zrender/tool/event');
var self = {};
var _canvasSupported = require('zrender/tool/env').canvasSupported;
var _idBase = new Date() - 0;
var _instances = {};
var DOM_ATTRIBUTE_KEY = '_echarts_instance_';
self.version = '2.2.4';
self.dependencies = { zrender: '2.0.9' };
self.init = function (dom, theme) {
var zrender = require('zrender');
if (zrender.version.replace('.', '') - 0 < self.dependencies.zrender.replace('.', '') - 0) {
console.error('ZRender ' + zrender.version + ' is too old for ECharts ' + self.version + '. Current version need ZRender ' + self.dependencies.zrender + '+');
}
dom = dom instanceof Array ? dom[0] : dom;
var key = dom.getAttribute(DOM_ATTRIBUTE_KEY);
if (!key) {
key = _idBase++;
dom.setAttribute(DOM_ATTRIBUTE_KEY, key);
}
if (_instances[key]) {
_instances[key].dispose();
}
_instances[key] = new Echarts(dom);
_instances[key].id = key;
_instances[key].canvasSupported = _canvasSupported;
_instances[key].setTheme(theme);
return _instances[key];
};
self.getInstanceById = function (key) {
return _instances[key];
};
function MessageCenter() {
zrEvent.Dispatcher.call(this);
}
zrUtil.merge(MessageCenter.prototype, zrEvent.Dispatcher.prototype, true);
function Echarts(dom) {
dom.innerHTML = '';
this._themeConfig = {};
this.dom = dom;
this._connected = false;
this._status = {
dragIn: false,
dragOut: false,
needRefresh: false
};
this._curEventType = false;
this._chartList = [];
this._messageCenter = new MessageCenter();
this._messageCenterOutSide = new MessageCenter();
this.resize = this.resize();
this._init();
}
var ZR_EVENT = require('zrender/config').EVENT;
var ZR_EVENT_LISTENS = [
'CLICK',
'DBLCLICK',
'MOUSEOVER',
'CONTEXTMENU',
'MOUSEOUT',
'DRAGSTART',
'DRAGEND',
'DRAGENTER',
'DRAGOVER',
'DRAGLEAVE',
'DROP'
];
function callChartListMethodReverse(ecInstance, methodName, arg0, arg1, arg2) {
var chartList = ecInstance._chartList;
var len = chartList.length;
while (len--) {
var chart = chartList[len];
if (typeof chart[methodName] === 'function') {
chart[methodName](arg0, arg1, arg2);
}
}
}
Echarts.prototype = {
_init: function () {
var self = this;
var _zr = require('zrender').init(this.dom);
this._zr = _zr;
this._messageCenter.dispatch = function (type, event, eventPackage, that) {
eventPackage = eventPackage || {};
eventPackage.type = type;
eventPackage.event = event;
self._messageCenter.dispatchWithContext(type, eventPackage, that);
self._messageCenterOutSide.dispatchWithContext(type, eventPackage, that);
};
this._onevent = function (param) {
return self.__onevent(param);
};
for (var e in ecConfig.EVENT) {
if (e != 'CLICK' && e != 'DBLCLICK' && e != 'HOVER' && e != 'MOUSEOUT' && e != 'MAP_ROAM') {
this._messageCenter.bind(ecConfig.EVENT[e], this._onevent, this);
}
}
var eventBehaviors = {};