diff --git a/dist/echarts.common.js b/dist/echarts.common.js index 7560f46779..d05d8ec579 100644 --- a/dist/echarts.common.js +++ b/dist/echarts.common.js @@ -59,24 +59,25 @@ return /******/ (function(modules) { // webpackBootstrap */ module.exports = __webpack_require__(1); - __webpack_require__(100); - __webpack_require__(134); - __webpack_require__(141); - __webpack_require__(150); - __webpack_require__(292); - __webpack_require__(299); - __webpack_require__(293); - - __webpack_require__(113); - __webpack_require__(328); - - __webpack_require__(358); - __webpack_require__(364); - __webpack_require__(367); - __webpack_require__(329); + __webpack_require__(112); + __webpack_require__(148); + __webpack_require__(155); + __webpack_require__(164); + __webpack_require__(308); + __webpack_require__(315); + __webpack_require__(142); + __webpack_require__(309); + + __webpack_require__(122); + __webpack_require__(349); + __webpack_require__(379); + __webpack_require__(385); + __webpack_require__(388); + __webpack_require__(350); + __webpack_require__(400); - __webpack_require__(391); + __webpack_require__(412); /***/ }, /* 1 */ @@ -122,8 +123,8 @@ return /******/ (function(modules) { // webpackBootstrap var SeriesModel = __webpack_require__(28); var ComponentView = __webpack_require__(29); - var ChartView = __webpack_require__(42); - var graphic = __webpack_require__(43); + var ChartView = __webpack_require__(43); + var graphic = __webpack_require__(44); var modelUtil = __webpack_require__(5); var throttle = __webpack_require__(81); @@ -180,7 +181,7 @@ return /******/ (function(modules) { // webpackBootstrap /** * @module echarts~ECharts */ - function ECharts (dom, theme, opts) { + function ECharts(dom, theme, opts) { opts = opts || {}; // Get theme by name @@ -251,16 +252,16 @@ return /******/ (function(modules) { // webpackBootstrap this._componentsMap = {}; /** - * @type {module:echarts/ExtensionAPI} + * @type {module:echarts/CoordinateSystem} * @private */ - this._api = new ExtensionAPI(this); + this._coordSysMgr = new CoordinateSystemManager(); /** - * @type {module:echarts/CoordinateSystem} + * @type {module:echarts/ExtensionAPI} * @private */ - this._coordSysMgr = new CoordinateSystemManager(); + this._api = new ExtensionAPI(this, this._coordSysMgr); Eventful.call(this); @@ -286,6 +287,9 @@ return /******/ (function(modules) { // webpackBootstrap timsort(dataProcessorFuncs, prioritySortFunc); zr.animation.on('frame', this._onframe, this); + + // ECharts instance can be used as value. + zrUtil.setAsPrimitive(this); } var echartsProto = ECharts.prototype; @@ -364,7 +368,7 @@ return /******/ (function(modules) { // webpackBootstrap mainType !== 'graphic' && (this.__lastOnlyGraphic = false); }, this); - this._model.setOption(option, optionPreprocessorFuncs); + this._model.setOption(option, optionPreprocessorFuncs, this.__lastOnlyGraphic); if (lazyUpdate) { this[OPTION_UPDATED] = {silent: silent}; @@ -419,6 +423,13 @@ return /******/ (function(modules) { // webpackBootstrap return this._zr.getHeight(); }; + /** + * @return {number} + */ + echartsProto.getDevicePixelRatio = function () { + return this._zr.painter.dpr || window.devicePixelRatio || 1; + }; + /** * Get canvas which has all thing rendered * @param {Object} opts @@ -622,7 +633,7 @@ return /******/ (function(modules) { // webpackBootstrap * geoIndex / geoId / geoName, * bmapIndex / bmapId / bmapName, * xAxisIndex / xAxisId / xAxisName, - * yAxisIndex / yAxisId / yAxisName + * yAxisIndex / yAxisId / yAxisName, * gridIndex / gridId / gridName, * ... (can be extended) * } @@ -707,6 +718,24 @@ return /******/ (function(modules) { // webpackBootstrap : data.getVisual(visualType); }; + /** + * Get view of corresponding component model + * @param {module:echarts/model/Component} componentModel + * @return {module:echarts/view/Component} + */ + echartsProto.getViewOfComponentModel = function (componentModel) { + return this._componentsMap[componentModel.__viewId]; + }; + + /** + * Get view of corresponding series model + * @param {module:echarts/model/Series} seriesModel + * @return {module:echarts/view/Chart} + */ + echartsProto.getViewOfSeriesModel = function (seriesModel) { + return this._chartsMap[seriesModel.__viewId]; + }; + var updateMethods = { @@ -715,7 +744,7 @@ return /******/ (function(modules) { // webpackBootstrap * @private */ update: function (payload) { - // console.time && console.time('update'); + // console.profile && console.profile('update'); var ecModel = this._model; var api = this._api; @@ -788,7 +817,11 @@ return /******/ (function(modules) { // webpackBootstrap } } - // console.time && console.timeEnd('update'); + each(postUpdateFuncs, function (func) { + func(ecModel, api); + }); + + // console.profile && console.profileEnd('update'); }, /** @@ -884,6 +917,13 @@ return /******/ (function(modules) { // webpackBootstrap */ function updateDirectly(ecIns, method, payload, mainType, subType) { var ecModel = ecIns._model; + + // broadcast + if (!mainType) { + each(ecIns._componentsViews.concat(ecIns._chartsViews), callView); + return; + } + var query = {}; query[mainType + 'Id'] = payload[mainType + 'Id']; query[mainType + 'Index'] = payload[mainType + 'Index']; @@ -894,13 +934,16 @@ return /******/ (function(modules) { // webpackBootstrap // If dispatchAction before setOption, do nothing. ecModel && ecModel.eachComponent(condition, function (model, index) { - var view = ecIns[ + callView(ecIns[ mainType === 'series' ? '_chartsMap' : '_componentsMap' - ][model.__viewId]; - if (view && view.__alive) { - view[method](model, ecModel, ecIns._api, payload); - } + ][model.__viewId]); }, ecIns); + + function callView(view) { + view && view.__alive && view[method] && view[method]( + view.__model, ecModel, ecIns._api, payload + ); + } } /** @@ -1001,14 +1044,6 @@ return /******/ (function(modules) { // webpackBootstrap return; } - // if (__DEV__) { - // zrUtil.assert( - // !this[IN_MAIN_PROCESS], - // '`dispatchAction` should not be called during main process.' - // + 'unless updateMathod is "none".' - // ); - // } - // May dispatchAction in rendering procedure if (this[IN_MAIN_PROCESS]) { this._pendingActions.push(payload); @@ -1036,12 +1071,13 @@ return /******/ (function(modules) { // webpackBootstrap function doDispatchAction(payload, silent) { var payloadType = payload.type; + var escapeConnect = payload.escapeConnect; var actionWrap = actions[payloadType]; var actionInfo = actionWrap.actionInfo; var cptType = (actionInfo.update || 'update').split(':'); var updateMethod = cptType.pop(); - cptType = cptType[0] && parseClassType(cptType[0]); + cptType = cptType[0] != null && parseClassType(cptType[0]); this[IN_MAIN_PROCESS] = true; @@ -1061,10 +1097,9 @@ return /******/ (function(modules) { // webpackBootstrap var eventObj; var isHighDown = payloadType === 'highlight' || payloadType === 'downplay'; - for (var i = 0; i < payloads.length; i++) { - var batchItem = payloads[i]; + each(payloads, function (batchItem) { // Action can specify the event by return it. - eventObj = actionWrap.action(batchItem, this._model); + eventObj = actionWrap.action(batchItem, this._model, this._api); // Emit event outside eventObj = eventObj || zrUtil.extend({}, batchItem); // Convert type to eventType @@ -1079,7 +1114,7 @@ return /******/ (function(modules) { // webpackBootstrap else if (cptType) { updateDirectly(this, updateMethod, batchItem, cptType.main, cptType.sub); } - } + }, this); if (updateMethod !== 'none' && !isHighDown && !cptType) { // Still dirty @@ -1097,6 +1132,7 @@ return /******/ (function(modules) { // webpackBootstrap if (batched) { eventObj = { type: actionInfo.event || payloadType, + escapeConnect: escapeConnect, batch: eventObjBatch }; } @@ -1156,6 +1192,11 @@ return /******/ (function(modules) { // webpackBootstrap // If use hover layer updateHoverLayerStatus(this._zr, ecModel); + + // Post render + each(postUpdateFuncs, function (func) { + func(ecModel, api); + }); } /** @@ -1492,10 +1533,10 @@ return /******/ (function(modules) { // webpackBootstrap }); } /** - * @type {Array.} + * @type {Object} key: actionType. * @inner */ - var actions = []; + var actions = {}; /** * Map eventType to actionType @@ -1516,6 +1557,12 @@ return /******/ (function(modules) { // webpackBootstrap */ var optionPreprocessorFuncs = []; + /** + * @type {Array.} + * @inner + */ + var postUpdateFuncs = []; + /** * Visual encoding functions of each stage * @type {Array.>} @@ -1546,27 +1593,32 @@ return /******/ (function(modules) { // webpackBootstrap /** * @type {number} */ - version: '3.4.0', + version: '3.5.0', dependencies: { - zrender: '3.3.0' + zrender: '3.4.0' } }; function enableConnect(chart) { - var STATUS_PENDING = 0; var STATUS_UPDATING = 1; var STATUS_UPDATED = 2; var STATUS_KEY = '__connectUpdateStatus'; + function updateConnectedChartsStatus(charts, status) { for (var i = 0; i < charts.length; i++) { var otherChart = charts[i]; otherChart[STATUS_KEY] = status; } } + zrUtil.each(eventActionMap, function (actionType, eventType) { chart._messageCenter.on(eventType, function (event) { if (connectedGroups[chart.group] && chart[STATUS_KEY] !== STATUS_PENDING) { + if (event && event.escapeConnect) { + return; + } + var action = chart.makeActionFromEvent(event); var otherCharts = []; @@ -1586,8 +1638,8 @@ return /******/ (function(modules) { // webpackBootstrap } }); }); - } + /** * @param {HTMLDomElement} dom * @param {Object} [theme] @@ -1613,7 +1665,13 @@ return /******/ (function(modules) { // webpackBootstrap if (!dom) { throw new Error('Initialize failed: invalid dom.'); } - if (zrUtil.isDom(dom) && dom.nodeName.toUpperCase() !== 'CANVAS' && (!dom.clientWidth || !dom.clientHeight)) { + if (zrUtil.isDom(dom) + && dom.nodeName.toUpperCase() !== 'CANVAS' + && ( + (!dom.clientWidth && (!opts || opts.width == null)) + || (!dom.clientHeight && (!opts || opts.height == null)) + ) + ) { console.warn('Can\'t get dom width or height'); } } @@ -1654,12 +1712,18 @@ return /******/ (function(modules) { // webpackBootstrap }; /** + * @DEPRECATED * @return {string} groupId */ echarts.disConnect = function (groupId) { connectedGroups[groupId] = false; }; + /** + * @return {string} groupId + */ + echarts.disconnect = echarts.disConnect; + /** * Dispose a chart instance * @param {module:echarts~ECharts|HTMLDomElement|string} chart @@ -1727,6 +1791,14 @@ return /******/ (function(modules) { // webpackBootstrap }); }; + /** + * Register postUpdater + * @param {Function} postUpdateFunc + */ + echarts.registerPostUpdate = function (postUpdateFunc) { + postUpdateFuncs.push(postUpdateFunc); + }; + /** * Usage: * registerAction('someAction', 'someEvent', function () { ... }); @@ -1921,11 +1993,14 @@ return /******/ (function(modules) { // webpackBootstrap // -------- // Exports // -------- - // + echarts.zrender = zrender; + echarts.List = __webpack_require__(98); echarts.Model = __webpack_require__(12); - echarts.graphic = __webpack_require__(43); + echarts.Axis = __webpack_require__(100); + + echarts.graphic = __webpack_require__(44); echarts.number = __webpack_require__(7); echarts.format = __webpack_require__(6); echarts.throttle = throttle.throttle; @@ -1937,13 +2012,16 @@ return /******/ (function(modules) { // webpackBootstrap each([ 'map', 'each', 'filter', 'indexOf', 'inherits', 'reduce', 'filter', 'bind', 'curry', 'isArray', 'isString', 'isObject', 'isFunction', - 'extend', 'defaults', 'clone' + 'extend', 'defaults', 'clone', 'merge' ], function (name) { echarts.util[name] = zrUtil[name]; } ); + echarts.helper = __webpack_require__(101); + + // PRIORITY echarts.PRIORITY = { PROCESSOR: { @@ -2165,7 +2243,7 @@ return /******/ (function(modules) { // webpackBootstrap this._optionManager = optionManager; }, - setOption: function (option, optionPreprocessorFuncs) { + setOption: function (option, optionPreprocessorFuncs, onlyGraphic) { zrUtil.assert( !(OPTION_INNER_KEY in option), 'please use chart.getOption()' @@ -2173,7 +2251,7 @@ return /******/ (function(modules) { // webpackBootstrap this._optionManager.setOption(option, optionPreprocessorFuncs); - this.resetOption(); + this.resetOption(null, onlyGraphic); }, /** @@ -2183,7 +2261,7 @@ return /******/ (function(modules) { // webpackBootstrap * 'media': only reset media query option * @return {boolean} Whether option changed. */ - resetOption: function (type) { + resetOption: function (type, onlyGraphic) { var optionChanged = false; var optionManager = this._optionManager; @@ -2194,7 +2272,11 @@ return /******/ (function(modules) { // webpackBootstrap initBase.call(this, baseOption); } else { - this.restoreData(); + // If only graphic, other series and component will not + // go through update process, data should not be restored. + // Otherwise grphic els mounted on data will be eliminated + // and downplay will not work. + !onlyGraphic && this.restoreData(); this.mergeOption(baseOption); } optionChanged = true; @@ -2435,7 +2517,7 @@ return /******/ (function(modules) { // webpackBootstrap } else { // Return all components with mainType - result = cpts; + result = cpts.slice(); } return filterBySubType(result, condition); @@ -2714,10 +2796,12 @@ return /******/ (function(modules) { // webpackBootstrap this.option[OPTION_INNER_KEY] = 1; /** + * Init with series: [], in case of calling findSeries method + * before series initialized. * @type {Object.>} * @private */ - this._componentsMap = {}; + this._componentsMap = {series: []}; /** * Mapping between filtered series list and raw series list. @@ -2884,7 +2968,7 @@ return /******/ (function(modules) { // webpackBootstrap else if (TYPED_ARRAY[typeStr]) { result = source.constructor.from(source); } - else if (!BUILTIN_OBJECT[typeStr] && !isDom(source)) { + else if (!BUILTIN_OBJECT[typeStr] && !isPrimitive(source) && !isDom(source)) { result = {}; for (var key in source) { if (source.hasOwnProperty(key)) { @@ -2920,8 +3004,10 @@ return /******/ (function(modules) { // webpackBootstrap && !isArray(targetProp) && !isDom(sourceProp) && !isDom(targetProp) - && !isBuildInObject(sourceProp) - && !isBuildInObject(targetProp) + && !isBuiltInObject(sourceProp) + && !isBuiltInObject(targetProp) + && !isPrimitive(sourceProp) + && !isPrimitive(targetProp) ) { // 如果需要递归覆盖,就递归调用merge merge(targetProp, sourceProp, overwrite); @@ -3248,7 +3334,7 @@ return /******/ (function(modules) { // webpackBootstrap * @param {*} value * @return {boolean} */ - function isBuildInObject(value) { + function isBuiltInObject(value) { return !!BUILTIN_OBJECT[objToString.call(value)]; } @@ -3307,6 +3393,18 @@ return /******/ (function(modules) { // webpackBootstrap } } + var primitiveKey = '__ec_primitive__'; + /** + * Set an object as primitive to be ignored traversing children in clone or merge + */ + function setAsPrimitive(obj) { + obj[primitiveKey] = true; + } + + function isPrimitive(obj) { + return obj[primitiveKey]; + } + var util = { inherits: inherits, mixin: mixin, @@ -3331,11 +3429,12 @@ return /******/ (function(modules) { // webpackBootstrap isString: isString, isObject: isObject, isFunction: isFunction, - isBuildInObject: isBuildInObject, + isBuiltInObject: isBuiltInObject, isDom: isDom, eqNaN: eqNaN, retrieve: retrieve, assert: assert, + setAsPrimitive: setAsPrimitive, noop: function () {} }; module.exports = util; @@ -3440,7 +3539,12 @@ return /******/ (function(modules) { // webpackBootstrap return value; } - if (dimType === 'time' && !isFinite(value) && value != null && value !== '-') { + if (dimType === 'time' + // spead up when using timestamp + && typeof value !== 'number' + && value != null + && value !== '-' + ) { value = +nubmerUtil.parseDate(value); } @@ -3484,10 +3588,6 @@ return /******/ (function(modules) { // webpackBootstrap */ getDataParams: function (dataIndex, dataType) { var data = this.getData(dataType); - - var seriesIndex = this.seriesIndex; - var seriesName = this.name; - var rawValue = this.getRawValue(dataIndex, dataType); var rawDataIndex = data.getRawIndex(dataIndex); var name = data.getName(dataIndex, true); @@ -3497,8 +3597,9 @@ return /******/ (function(modules) { // webpackBootstrap componentType: this.mainType, componentSubType: this.subType, seriesType: this.mainType === 'series' ? this.subType : null, - seriesIndex: seriesIndex, - seriesName: seriesName, + seriesIndex: this.seriesIndex, + seriesId: this.id, + seriesName: this.name, name: name, dataIndex: rawDataIndex, data: itemOpt, @@ -3716,7 +3817,7 @@ return /******/ (function(modules) { // webpackBootstrap ? opt.name + '' : existCpt ? existCpt.name - : '\0-'; + : '\0-'; // name may be displayed on screen, so use '-'. if (existCpt) { keyInfo.id = existCpt.id; @@ -3831,6 +3932,30 @@ return /******/ (function(modules) { // webpackBootstrap } }; + /** + * Enable property storage to any host object. + * Notice: Serialization is not supported. + * + * For example: + * var get = modelUitl.makeGetter(); + * + * function some(hostObj) { + * get(hostObj)._someProperty = 1212; + * ... + * } + * + * @return {Function} + */ + modelUtil.makeGetter = (function () { + var index = 0; + return function () { + var key = '\0__ec_prop_getter_' + index++; + return function (hostObj) { + return hostObj[key] || (hostObj[key] = {}); + }; + }; + })(); + /** * @param {module:echarts/model/Global} ecModel * @param {string|Object} finder @@ -3838,7 +3963,7 @@ return /******/ (function(modules) { // webpackBootstrap * If Object, could contain some of these properties below: * { * seriesIndex, seriesId, seriesName, - * geoIndex, geoId, goeName, + * geoIndex, geoId, geoName, * bmapIndex, bmapId, bmapName, * xAxisIndex, xAxisId, xAxisName, * yAxisIndex, yAxisId, yAxisName, @@ -3852,8 +3977,11 @@ return /******/ (function(modules) { // webpackBootstrap * geoId: ['aa', 'cc'], * gridName: ['xx', 'rr'] * } + * xxxIndex can be set as 'all' (means all xxx) or 'none' (means not specify) + * If nothing or null/undefined specified, return nothing. * @param {Object} [opt] * @param {string} [opt.defaultMainType] + * @param {Array.} [opt.includeMainTypes] * @return {Object} result like: * { * seriesModels: [seriesModel1, seriesModel2], @@ -3892,14 +4020,22 @@ return /******/ (function(modules) { // webpackBootstrap var parsedKey = key.match(/^(\w+)(Index|Id|Name)$/) || []; var mainType = parsedKey[1]; - var queryType = parsedKey[2]; + var queryType = (parsedKey[2] || '').toLowerCase(); - if (!mainType || !queryType) { + if (!mainType + || !queryType + || value == null + || (queryType === 'index' && value === 'none') + || (opt && opt.includeMainTypes && zrUtil.indexOf(opt.includeMainTypes, mainType) < 0) + ) { return; } var queryParam = {mainType: mainType}; - queryParam[queryType.toLowerCase()] = value; + if (queryType !== 'index' || value !== 'all') { + queryParam[queryType] = value; + } + var models = ecModel.queryComponents(queryParam); result[mainType + 'Models'] = models; result[mainType + 'Model'] = models[0]; @@ -3915,6 +4051,7 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = modelUtil; + /***/ }, /* 6 */ /***/ function(module, exports, __webpack_require__) { @@ -4030,6 +4167,24 @@ return /******/ (function(modules) { // webpackBootstrap return tpl; }; + /** + * simple Template formatter + * + * @param {string} tpl + * @param {Object} param + * @param {boolean} [encode=false] + * @return {string} + */ + formatUtil.formatTplSimple = function (tpl, param, encode) { + zrUtil.each(param, function (value, key) { + tpl = tpl.replace( + '{' + key + '}', + encode ? encodeHTML(value) : value + ); + }); + return tpl; + }; + /** * @param {string} str @@ -4044,9 +4199,15 @@ return /******/ (function(modules) { // webpackBootstrap * ISO Date format * @param {string} tpl * @param {number} value + * @param {boolean} [isLocal=false] Default use UTC + * Why default UTC? In most case, time provided by user is + * understood in UTC. For example, new Date('2012-01-01') + * or a string '2012-01-01' or a timestamp. So it is + * recommended to format time in UTC. + * (see `echarts/util/number.js#parseDate`); * @inner */ - formatUtil.formatTime = function (tpl, value) { + formatUtil.formatTime = function (tpl, value, isLocal) { if (tpl === 'week' || tpl === 'month' || tpl === 'quarter' @@ -4057,12 +4218,13 @@ return /******/ (function(modules) { // webpackBootstrap } var date = numberUtil.parseDate(value); - var y = date.getFullYear(); - var M = date.getMonth() + 1; - var d = date.getDate(); - var h = date.getHours(); - var m = date.getMinutes(); - var s = date.getSeconds(); + var utc = isLocal ? '' : 'UTC'; + var y = date['get' + utc + 'FullYear'](); + var M = date['get' + utc + 'Month']() + 1; + var d = date['get' + utc + 'Date'](); + var h = date['get' + utc + 'Hours'](); + var m = date['get' + utc + 'Minutes'](); + var s = date['get' + utc + 'Seconds'](); tpl = tpl.replace('MM', s2d(M)) .toLowerCase() @@ -4094,6 +4256,7 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = formatUtil; + /***/ }, /* 7 */ /***/ function(module, exports) { @@ -4204,15 +4367,18 @@ return /******/ (function(modules) { // webpackBootstrap /** * Fix rounding error of float numbers * @param {number} x - * @return {number} + * @param {number} [precision] + * @param {boolean} [returnStr] + * @return {number|string} */ - number.round = function (x, precision) { + number.round = function (x, precision, returnStr) { if (precision == null) { precision = 10; } // Avoid range error precision = Math.min(Math.max(0, precision), 20); - return +(+x).toFixed(precision); + x = (+x).toFixed(precision); + return returnStr ? x : +x; }; number.asc = function (arr) { @@ -4290,8 +4456,22 @@ return /******/ (function(modules) { // webpackBootstrap return val > -RADIAN_EPSILON && val < RADIAN_EPSILON; }; + var TIME_REG = /^(?:(\d{4})(?:[-\/](\d{1,2})(?:[-\/](\d{1,2})(?:[T ](\d{1,2})(?::(\d\d)(?::(\d\d)(?:[.,](\d+))?)?)?(?:Z|([\+\-]\d\d):?\d\d)?)?)?)?)?$/; // jshint ignore:line + var TIMEZONE_OFFSET = (new Date()).getTimezoneOffset(); + /** - * @param {string|Date|number} value + * @param {string|Date|number} value These values can be accepted: + * + An instance of Date, represent a time in its own time zone. + * + Or string in a subset of ISO 8601, only including: + * + only year, month, date: '2012-03', '2012-03-01', '2012-03-01 05', '2012-03-01 05:06', + * + separated with T or space: '2012-03-01T12:22:33.123', '2012-03-01 12:22:33.123', + * + time zone: '2012-03-01T12:22:33Z', '2012-03-01T12:22:33+8000', '2012-03-01T12:22:33-05:00', + * all of which will be treated as they reperent a time in UTC + * if time zone is not specified. + * + Or other string format, including: + * '2012', '2012-3-1', '2012/3/1', '2012/03/01', + * '2009/6/12 2:00', '2009/6/12 2:05:08', '2009/6/12 2:05:08.123' + * + a timestamp, which represent a time in UTC. * @return {Date} date */ number.parseDate = function (value) { @@ -4299,13 +4479,32 @@ return /******/ (function(modules) { // webpackBootstrap return value; } else if (typeof value === 'string') { - // Treat as ISO format. See issue #3623 - var ret = new Date(value); - if (isNaN(+ret)) { - // FIXME new Date('1970-01-01') is UTC, new Date('1970/01/01') is local - ret = new Date(new Date(value.replace(/-/g, '/')) - new Date('1970/01/01')); - } - return ret; + // Different browsers parse date in different way, so we parse it manually. + // Some other issues: + // new Date('1970-01-01') is UTC, + // new Date('1970/01/01') and new Date('1970-1-01') is local. + // See issue #3623 + var match = TIME_REG.exec(value); + + if (!match) { + // return Invalid Date. + return new Date(NaN); + } + + // match[n] can only be string or undefined. + // But take care of '12' + 1 => '121'. + return new Date( + +match[1], + +(match[2] || 1) - 1, + +match[3] || 1, + +match[4] || 0, + +(match[5] || 0) - (match[8] || 0) * 60 - TIMEZONE_OFFSET, + +match[6] || 0, + +match[7] || 0 + ); + } + else if (value == null) { + return new Date(NaN); } return new Date(Math.round(value)); @@ -5606,6 +5805,7 @@ return /******/ (function(modules) { // webpackBootstrap }; /** + * Notice, parseClassType('') should returns {main: '', sub: ''} * @public */ var parseClassType = clazz.parseClassType = function (componentType) { @@ -5889,11 +6089,13 @@ return /******/ (function(modules) { // webpackBootstrap properties[i][1] = properties[i][0]; } } - return function (excludes) { + return function (excludes, includes) { var style = {}; for (var i = 0; i < properties.length; i++) { var propName = properties[i][1]; - if (excludes && zrUtil.indexOf(excludes, propName) >= 0) { + if ((excludes && zrUtil.indexOf(excludes, propName) >= 0) + || (includes && zrUtil.indexOf(includes, propName) < 0) + ) { continue; } var val = this.getShallow(propName); @@ -6001,8 +6203,8 @@ return /******/ (function(modules) { // webpackBootstrap ] ); module.exports = { - getItemStyle: function (excludes) { - var style = getItemStyle.call(this, excludes); + getItemStyle: function (excludes, includes) { + var style = getItemStyle.call(this, excludes, includes); var lineDash = this.getBorderLineDash(); lineDash && (style.lineDash = lineDash); return style; @@ -6413,10 +6615,21 @@ return /******/ (function(modules) { // webpackBootstrap var layout = {}; + /** + * @public + */ var LOCATION_PARAMS = layout.LOCATION_PARAMS = [ 'left', 'right', 'top', 'bottom', 'width', 'height' ]; + /** + * @public + */ + var HV_NAMES = layout.HV_NAMES = [ + ['width', 'left', 'right'], + ['height', 'top', 'bottom'] + ]; + function boxLayout(orient, group, gap, maxWidth, maxHeight) { var x = 0; var y = 0; @@ -6732,6 +6945,15 @@ return /******/ (function(modules) { // webpackBootstrap el.attr('position', boundingMode === 'raw' ? [dx, dy] : [elPos[0] + dx, elPos[1] + dy]); }; + /** + * @param {Object} option Contains some of the properties in HV_NAMES. + * @param {number} hvIdx 0: horizontal; 1: vertical. + */ + layout.sizeCalculable = function (option, hvIdx) { + return option[HV_NAMES[hvIdx][0]] != null + || (option[HV_NAMES[hvIdx][1]] != null && option[HV_NAMES[hvIdx][2]] != null); + }; + /** * Consider Case: * When defulat option has {left: 0, width: 100}, and we set {right: 0} @@ -6754,24 +6976,26 @@ return /******/ (function(modules) { // webpackBootstrap * @param {Object} targetOption * @param {Object} newOption * @param {Object|string} [opt] - * @param {boolean} [opt.ignoreSize=false] Some component must has width and height. + * @param {boolean|Array.} [opt.ignoreSize=false] Some component must has width and height. */ layout.mergeLayoutParam = function (targetOption, newOption, opt) { !zrUtil.isObject(opt) && (opt = {}); - var hNames = ['width', 'left', 'right']; // Order by priority. - var vNames = ['height', 'top', 'bottom']; // Order by priority. - var hResult = merge(hNames); - var vResult = merge(vNames); - copy(hNames, targetOption, hResult); - copy(vNames, targetOption, vResult); + var ignoreSize = opt.ignoreSize; + !zrUtil.isArray(ignoreSize) && (ignoreSize = [ignoreSize, ignoreSize]); - function merge(names) { + var hResult = merge(HV_NAMES[0], 0); + var vResult = merge(HV_NAMES[1], 1); + + copy(HV_NAMES[0], targetOption, hResult); + copy(HV_NAMES[1], targetOption, vResult); + + function merge(names, hvIdx) { var newParams = {}; var newValueCount = 0; var merged = {}; var mergedValueCount = 0; - var enoughParamNumber = opt.ignoreSize ? 1 : 2; + var enoughParamNumber = 2; each(names, function (name) { merged[name] = targetOption[name]; @@ -6784,6 +7008,13 @@ return /******/ (function(modules) { // webpackBootstrap hasValue(merged, name) && mergedValueCount++; }); + if (ignoreSize[hvIdx]) { + // Only one of left/height is premitted to exist. + hasValue(newOption, names[2]) && (merged[names[1]] = null); + hasValue(newOption, names[1]) && (merged[names[2]] = null); + return merged; + } + // Case: newOption: {width: ..., right: ...}, // or targetOption: {right: ...} and newOption: {width: ...}, // There is no conflict when merged only has params count @@ -6799,7 +7030,6 @@ return /******/ (function(modules) { // webpackBootstrap } else { // Chose another param from targetOption by priority. - // When 'ignoreSize', enoughParamNumber is 1 and those will not happen. for (var i = 0; i < names.length; i++) { var name = names[i]; if (!hasProp(newParams, name) && hasProp(targetOption, name)) { @@ -6850,6 +7080,7 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = layout; + /***/ }, /* 22 */ /***/ function(module, exports) { @@ -6911,7 +7142,7 @@ return /******/ (function(modules) { // webpackBootstrap // Default is source-over blendMode: null, - animation: true, + animation: 'auto', animationDuration: 1000, animationDurationUpdate: 300, animationEasing: 'exponentialOut', @@ -6980,14 +7211,18 @@ return /******/ (function(modules) { // webpackBootstrap var zrUtil = __webpack_require__(4); var echartsAPIList = [ - 'getDom', 'getZr', 'getWidth', 'getHeight', 'dispatchAction', 'isDisposed', - 'on', 'off', 'getDataURL', 'getConnectedDataURL', 'getModel', 'getOption' + 'getDom', 'getZr', 'getWidth', 'getHeight', 'getDevicePixelRatio', 'dispatchAction', 'isDisposed', + 'on', 'off', 'getDataURL', 'getConnectedDataURL', 'getModel', 'getOption', + 'getViewOfComponentModel', 'getViewOfSeriesModel' ]; - function ExtensionAPI(chartInstance) { + function ExtensionAPI(chartInstance, coordSysMgr) { zrUtil.each(echartsAPIList, function (name) { this[name] = zrUtil.bind(chartInstance[name], chartInstance); }, this); + + // Inject getCoordinateSystems to ecModel + this.getCoordinateSystems = zrUtil.bind(coordSysMgr.getCoordinateSystems, coordSysMgr); } module.exports = ExtensionAPI; @@ -7002,34 +7237,6 @@ return /******/ (function(modules) { // webpackBootstrap var zrUtil = __webpack_require__(4); - /** - * Interface of Coordinate System Class - * - * create: - * @param {module:echarts/model/Global} ecModel - * @param {module:echarts/ExtensionAPI} api - * @return {Object} coordinate system instance - * - * update: - * @param {module:echarts/model/Global} ecModel - * @param {module:echarts/ExtensionAPI} api - * - * convertToPixel: - * convertFromPixel: - * These two methods is also responsible for determine whether this - * coodinate system is applicable to the given `finder`. - * Each coordinate system will be tried, util one returns none - * null/undefined value. - * @param {module:echarts/model/Global} ecModel - * @param {Object} finder - * @param {Array|number} value - * @return {Array|number} convert result. - * - * containPoint: - * @param {Array.} point In pixel coordinate system. - * @return {boolean} - */ - var coordinateSystemCreators = {}; function CoordinateSystemManager() { @@ -7583,11 +7790,15 @@ return /******/ (function(modules) { // webpackBootstrap this.mergeDefaultAndTheme(option, ecModel); + var data = this.getInitialData(option, ecModel); + if (true) { + zrUtil.assert(data, 'getInitialData returned invalid data.'); + } /** * @type {module:echarts/data/List|module:echarts/data/Tree|module:echarts/data/Graph} * @private */ - set(this, 'dataBeforeProcessed', this.getInitialData(option, ecModel)); + set(this, 'dataBeforeProcessed', data); // If we reverse the order (make data firstly, and then make // dataBeforeProcessed by cloneShallow), cloneShallow will @@ -7824,9 +8035,9 @@ return /******/ (function(modules) { // webpackBootstrap * @param {Array.|string} dim * @param {Array.} value * @param {module:echarts/coord/single/SingleAxis} baseAxis - * @return {Array.} data indices. + * @return {Object} {dataIndices, nestestValue}. */ - getAxisTooltipDataIndex: null, + getAxisTooltipData: null, /** * See tooltip. @@ -9083,7 +9294,7 @@ return /******/ (function(modules) { // webpackBootstrap var isString = util.isString; var isFunction = util.isFunction; var isObject = util.isObject; - var log = __webpack_require__(40); + var log = __webpack_require__(41); /** * @alias modue:zrender/mixin/Animatable @@ -9860,6 +10071,24 @@ return /******/ (function(modules) { // webpackBootstrap return this; }, + pause: function () { + for (var i = 0; i < this._clipList.length; i++) { + this._clipList[i].pause(); + } + this._paused = true; + }, + + resume: function () { + for (var i = 0; i < this._clipList.length; i++) { + this._clipList[i].resume(); + } + this._paused = false; + }, + + isPaused: function () { + return !!this._paused; + }, + _doneCallback: function () { // Clear all tracks this._tracks = {}; @@ -10022,13 +10251,16 @@ return /******/ (function(modules) { // webpackBootstrap this.onframe = options.onframe; this.ondestroy = options.ondestroy; this.onrestart = options.onrestart; + + this._pausedTime = 0; + this._paused = false; } Clip.prototype = { constructor: Clip, - step: function (globalTime) { + step: function (globalTime, deltaTime) { // Set startTime on first step, or _startTime may has milleseconds different between clips // PENDING if (!this._initialized) { @@ -10036,7 +10268,12 @@ return /******/ (function(modules) { // webpackBootstrap this._initialized = true; } - var percent = (globalTime - this._startTime) / this._life; + if (this._paused) { + this._pausedTime += deltaTime; + return; + } + + var percent = (globalTime - this._startTime - this._pausedTime) / this._life; // 还没开始 if (percent < 0) { @@ -10072,17 +10309,26 @@ return /******/ (function(modules) { // webpackBootstrap }, restart: function (globalTime) { - var remainder = (globalTime - this._startTime) % this._life; + var remainder = (globalTime - this._startTime - this._pausedTime) % this._life; this._startTime = globalTime - remainder + this.gap; + this._pausedTime = 0; this._needsRemove = false; }, - fire: function(eventType, arg) { + fire: function (eventType, arg) { eventType = 'on' + eventType; if (this[eventType]) { this[eventType](this._target, arg); } + }, + + pause: function () { + this._paused = true; + }, + + resume: function () { + this._paused = false; } }; @@ -10443,13 +10689,15 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, /* 39 */ -/***/ function(module, exports) { +/***/ function(module, exports, __webpack_require__) { /** * @module zrender/tool/color */ + var LRU = __webpack_require__(40); + var kCSSColorTable = { 'transparent': [0,0,0,0], 'aliceblue': [240,248,255,1], 'antiquewhite': [250,235,215,1], 'aqua': [0,255,255,1], @@ -10579,15 +10827,40 @@ return /******/ (function(modules) { // webpackBootstrap return a + (b - a) * p; } + function setRgba(out, r, g, b, a) { + out[0] = r; out[1] = g; out[2] = b; out[3] = a; + return out; + } + function copyRgba(out, a) { + out[0] = a[0]; out[1] = a[1]; out[2] = a[2]; out[3] = a[3]; + return out; + } + var colorCache = new LRU(20); + var lastRemovedArr = null; + function putToCache(colorStr, rgbaArr) { + // Reuse removed array + if (lastRemovedArr) { + copyRgba(lastRemovedArr, rgbaArr); + } + lastRemovedArr = colorCache.put(colorStr, lastRemovedArr || (rgbaArr.slice())); + } /** * @param {string} colorStr + * @param {Array.} out * @return {Array.} * @memberOf module:zrender/util/color */ - function parse(colorStr) { + function parse(colorStr, rgbaArr) { if (!colorStr) { return; } + rgbaArr = rgbaArr || []; + + var cached = colorCache.get(colorStr); + if (cached) { + return copyRgba(rgbaArr, cached); + } + // colorStr may be not string colorStr = colorStr + ''; // Remove all whitespace, not compliant, but should just be more accepting. @@ -10595,7 +10868,9 @@ return /******/ (function(modules) { // webpackBootstrap // Color keywords (and transparent) lookup. if (str in kCSSColorTable) { - return kCSSColorTable[str].slice(); // dup. + copyRgba(rgbaArr, kCSSColorTable[str]); + putToCache(colorStr, rgbaArr); + return rgbaArr; } // #abc and #abc123 syntax. @@ -10603,26 +10878,32 @@ return /******/ (function(modules) { // webpackBootstrap if (str.length === 4) { var iv = parseInt(str.substr(1), 16); // TODO(deanm): Stricter parsing. if (!(iv >= 0 && iv <= 0xfff)) { + setRgba(rgbaArr, 0, 0, 0, 1); return; // Covers NaN. } - return [ + setRgba(rgbaArr, ((iv & 0xf00) >> 4) | ((iv & 0xf00) >> 8), (iv & 0xf0) | ((iv & 0xf0) >> 4), (iv & 0xf) | ((iv & 0xf) << 4), 1 - ]; + ); + putToCache(colorStr, rgbaArr); + return rgbaArr; } else if (str.length === 7) { var iv = parseInt(str.substr(1), 16); // TODO(deanm): Stricter parsing. if (!(iv >= 0 && iv <= 0xffffff)) { + setRgba(rgbaArr, 0, 0, 0, 1); return; // Covers NaN. } - return [ + setRgba(rgbaArr, (iv & 0xff0000) >> 16, (iv & 0xff00) >> 8, iv & 0xff, 1 - ]; + ); + putToCache(colorStr, rgbaArr); + return rgbaArr; } return; @@ -10635,44 +10916,56 @@ return /******/ (function(modules) { // webpackBootstrap switch (fname) { case 'rgba': if (params.length !== 4) { + setRgba(rgbaArr, 0, 0, 0, 1); return; } alpha = parseCssFloat(params.pop()); // jshint ignore:line // Fall through. case 'rgb': if (params.length !== 3) { + setRgba(rgbaArr, 0, 0, 0, 1); return; } - return [ + setRgba(rgbaArr, parseCssInt(params[0]), parseCssInt(params[1]), parseCssInt(params[2]), alpha - ]; + ); + putToCache(colorStr, rgbaArr); + return rgbaArr; case 'hsla': if (params.length !== 4) { + setRgba(rgbaArr, 0, 0, 0, 1); return; } params[3] = parseCssFloat(params[3]); - return hsla2rgba(params); + hsla2rgba(params, rgbaArr); + putToCache(colorStr, rgbaArr); + return rgbaArr; case 'hsl': if (params.length !== 3) { + setRgba(rgbaArr, 0, 0, 0, 1); return; } - return hsla2rgba(params); + hsla2rgba(params, rgbaArr); + putToCache(colorStr, rgbaArr); + return rgbaArr; default: return; } } + setRgba(rgbaArr, 0, 0, 0, 1); return; } /** * @param {Array.} hsla + * @param {Array.} rgba * @return {Array.} rgba */ - function hsla2rgba(hsla) { + function hsla2rgba(hsla, rgba) { var h = (((parseFloat(hsla[0]) % 360) + 360) % 360) / 360; // 0 .. 1 // NOTE(deanm): According to the CSS spec s/l should only be // percentages, but we don't bother and let float or percentage. @@ -10681,11 +10974,13 @@ return /******/ (function(modules) { // webpackBootstrap var m2 = l <= 0.5 ? l * (s + 1) : l + s - l * s; var m1 = l * 2 - m2; - var rgba = [ + rgba = rgba || []; + setRgba(rgba, clampCssByte(cssHueToRgb(m1, m2, h + 1 / 3) * 255), clampCssByte(cssHueToRgb(m1, m2, h) * 255), - clampCssByte(cssHueToRgb(m1, m2, h - 1 / 3) * 255) - ]; + clampCssByte(cssHueToRgb(m1, m2, h - 1 / 3) * 255), + 1 + ); if (hsla.length === 4) { rgba[3] = hsla[3]; @@ -10801,12 +11096,12 @@ return /******/ (function(modules) { // webpackBootstrap * @return {Array.} */ function fastMapToColor(normalizedValue, colors, out) { + out = out || [0, 0, 0, 0]; if (!(colors && colors.length) || !(normalizedValue >= 0 && normalizedValue <= 1) ) { - return; + return out; } - out = out || [0, 0, 0, 0]; var value = normalizedValue * (colors.length - 1); var leftIndex = Math.floor(value); var rightIndex = Math.ceil(value); @@ -10900,9 +11195,12 @@ return /******/ (function(modules) { // webpackBootstrap /** * @param {Array.} colors Color list. * @param {string} type 'rgba', 'hsva', ... - * @return {string} Result color. + * @return {string} Result color. (If input illegal, return undefined). */ function stringify(arrColor, type) { + if (!arrColor) { + return; + } var colorStr = arrColor[0] + ',' + arrColor[1] + ',' + arrColor[2]; if (type === 'rgba' || type === 'hsva' || type === 'hsla') { colorStr += ',' + arrColor[3]; @@ -10926,10 +11224,212 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, /* 40 */ +/***/ function(module, exports) { + + // Simple LRU cache use doubly linked list + // @module zrender/core/LRU + + + /** + * Simple double linked list. Compared with array, it has O(1) remove operation. + * @constructor + */ + var LinkedList = function () { + + /** + * @type {module:zrender/core/LRU~Entry} + */ + this.head = null; + + /** + * @type {module:zrender/core/LRU~Entry} + */ + this.tail = null; + + this._len = 0; + }; + + var linkedListProto = LinkedList.prototype; + /** + * Insert a new value at the tail + * @param {} val + * @return {module:zrender/core/LRU~Entry} + */ + linkedListProto.insert = function (val) { + var entry = new Entry(val); + this.insertEntry(entry); + return entry; + }; + + /** + * Insert an entry at the tail + * @param {module:zrender/core/LRU~Entry} entry + */ + linkedListProto.insertEntry = function (entry) { + if (!this.head) { + this.head = this.tail = entry; + } + else { + this.tail.next = entry; + entry.prev = this.tail; + entry.next = null; + this.tail = entry; + } + this._len++; + }; + + /** + * Remove entry. + * @param {module:zrender/core/LRU~Entry} entry + */ + linkedListProto.remove = function (entry) { + var prev = entry.prev; + var next = entry.next; + if (prev) { + prev.next = next; + } + else { + // Is head + this.head = next; + } + if (next) { + next.prev = prev; + } + else { + // Is tail + this.tail = prev; + } + entry.next = entry.prev = null; + this._len--; + }; + + /** + * @return {number} + */ + linkedListProto.len = function () { + return this._len; + }; + + /** + * Clear list + */ + linkedListProto.clear = function () { + this.head = this.tail = null; + this._len = 0; + }; + + /** + * @constructor + * @param {} val + */ + var Entry = function (val) { + /** + * @type {} + */ + this.value = val; + + /** + * @type {module:zrender/core/LRU~Entry} + */ + this.next; + + /** + * @type {module:zrender/core/LRU~Entry} + */ + this.prev; + }; + + /** + * LRU Cache + * @constructor + * @alias module:zrender/core/LRU + */ + var LRU = function (maxSize) { + + this._list = new LinkedList(); + + this._map = {}; + + this._maxSize = maxSize || 10; + + this._lastRemovedEntry = null; + }; + + var LRUProto = LRU.prototype; + + /** + * @param {string} key + * @param {} value + * @return {} Removed value + */ + LRUProto.put = function (key, value) { + var list = this._list; + var map = this._map; + var removed = null; + if (map[key] == null) { + var len = list.len(); + // Reuse last removed entry + var entry = this._lastRemovedEntry; + + if (len >= this._maxSize && len > 0) { + // Remove the least recently used + var leastUsedEntry = list.head; + list.remove(leastUsedEntry); + delete map[leastUsedEntry.key]; + + removed = leastUsedEntry.value; + this._lastRemovedEntry = leastUsedEntry; + } + + if (entry) { + entry.value = value; + } + else { + entry = new Entry(value); + } + entry.key = key; + list.insertEntry(entry); + map[key] = entry; + } + + return removed; + }; + + /** + * @param {string} key + * @return {} + */ + LRUProto.get = function (key) { + var entry = this._map[key]; + var list = this._list; + if (entry != null) { + // Put the latest used entry in the tail + if (entry !== list.tail) { + list.remove(entry); + list.insertEntry(entry); + } + + return entry.value; + } + }; + + /** + * Clear the cache + */ + LRUProto.clear = function () { + this._list.clear(); + this._map = {}; + }; + + module.exports = LRU; + + +/***/ }, +/* 41 */ /***/ function(module, exports, __webpack_require__) { - var config = __webpack_require__(41); + var config = __webpack_require__(42); /** * @exports zrender/tool/log @@ -10963,7 +11463,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 41 */ +/* 42 */ /***/ function(module, exports) { @@ -10995,7 +11495,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 42 */ +/* 43 */ /***/ function(module, exports, __webpack_require__) { @@ -11143,7 +11643,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 43 */ +/* 44 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -11151,9 +11651,9 @@ return /******/ (function(modules) { // webpackBootstrap var zrUtil = __webpack_require__(4); - var pathTool = __webpack_require__(44); + var pathTool = __webpack_require__(45); var round = Math.round; - var Path = __webpack_require__(45); + var Path = __webpack_require__(46); var colorTool = __webpack_require__(39); var matrix = __webpack_require__(11); var vector = __webpack_require__(10); @@ -11162,7 +11662,7 @@ return /******/ (function(modules) { // webpackBootstrap graphic.Group = __webpack_require__(30); - graphic.Image = __webpack_require__(61); + graphic.Image = __webpack_require__(62); graphic.Text = __webpack_require__(63); @@ -11496,7 +11996,8 @@ return /******/ (function(modules) { // webpackBootstrap } /** - * Set hover style of element + * Set hover style of element. + * This method can be called repeatly without side-effects. * @param {module:zrender/Element} el * @param {Object} [hoverStyle] * @param {Object} [opt] @@ -11729,14 +12230,14 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 44 */ +/* 45 */ /***/ function(module, exports, __webpack_require__) { - var Path = __webpack_require__(45); - var PathProxy = __webpack_require__(49); - var transformPath = __webpack_require__(60); + var Path = __webpack_require__(46); + var PathProxy = __webpack_require__(50); + var transformPath = __webpack_require__(61); var matrix = __webpack_require__(11); // command chars @@ -12137,7 +12638,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 45 */ +/* 46 */ /***/ function(module, exports, __webpack_require__) { /** @@ -12147,12 +12648,12 @@ return /******/ (function(modules) { // webpackBootstrap - var Displayable = __webpack_require__(46); + var Displayable = __webpack_require__(47); var zrUtil = __webpack_require__(4); - var PathProxy = __webpack_require__(49); - var pathContain = __webpack_require__(52); + var PathProxy = __webpack_require__(50); + var pathContain = __webpack_require__(53); - var Pattern = __webpack_require__(59); + var Pattern = __webpack_require__(60); var getCanvasPattern = Pattern.prototype.getCanvasPattern; var abs = Math.abs; @@ -12502,7 +13003,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 46 */ +/* 47 */ /***/ function(module, exports, __webpack_require__) { /** @@ -12515,10 +13016,10 @@ return /******/ (function(modules) { // webpackBootstrap var zrUtil = __webpack_require__(4); - var Style = __webpack_require__(47); + var Style = __webpack_require__(48); var Element = __webpack_require__(31); - var RectText = __webpack_require__(48); + var RectText = __webpack_require__(49); // var Stateful = require('./mixin/Stateful'); /** @@ -12776,7 +13277,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 47 */ +/* 48 */ /***/ function(module, exports) { /** @@ -13098,7 +13599,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 48 */ +/* 49 */ /***/ function(module, exports, __webpack_require__) { /** @@ -13240,8 +13741,9 @@ return /******/ (function(modules) { // webpackBootstrap } for (var i = 0; i < textLines.length; i++) { - textFill && ctx.fillText(textLines[i], x, y); + // Fill after stroke so the outline will not cover the main part. textStroke && ctx.strokeText(textLines[i], x, y); + textFill && ctx.fillText(textLines[i], x, y); y += textRect.lineHeight; } @@ -13253,7 +13755,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 49 */ +/* 50 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -13268,11 +13770,11 @@ return /******/ (function(modules) { // webpackBootstrap // TODO getTotalLength, getPointAtLength - var curve = __webpack_require__(50); + var curve = __webpack_require__(51); var vec2 = __webpack_require__(10); - var bbox = __webpack_require__(51); + var bbox = __webpack_require__(52); var BoundingRect = __webpack_require__(9); - var dpr = __webpack_require__(41).devicePixelRatio; + var dpr = __webpack_require__(42).devicePixelRatio; var CMD = { M: 1, @@ -14028,7 +14530,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 50 */ +/* 51 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -14574,7 +15076,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 51 */ +/* 52 */ /***/ function(module, exports, __webpack_require__) { /** @@ -14583,7 +15085,7 @@ return /******/ (function(modules) { // webpackBootstrap var vec2 = __webpack_require__(10); - var curve = __webpack_require__(50); + var curve = __webpack_require__(51); var bbox = {}; var mathMin = Math.min; @@ -14810,21 +15312,21 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 52 */ +/* 53 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; - var CMD = __webpack_require__(49).CMD; - var line = __webpack_require__(53); - var cubic = __webpack_require__(54); - var quadratic = __webpack_require__(55); - var arc = __webpack_require__(56); - var normalizeRadian = __webpack_require__(57).normalizeRadian; - var curve = __webpack_require__(50); + var CMD = __webpack_require__(50).CMD; + var line = __webpack_require__(54); + var cubic = __webpack_require__(55); + var quadratic = __webpack_require__(56); + var arc = __webpack_require__(57); + var normalizeRadian = __webpack_require__(58).normalizeRadian; + var curve = __webpack_require__(51); - var windingLine = __webpack_require__(58); + var windingLine = __webpack_require__(59); var containStroke = line.containStroke; @@ -15216,7 +15718,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 53 */ +/* 54 */ /***/ function(module, exports) { @@ -15264,12 +15766,12 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 54 */ +/* 55 */ /***/ function(module, exports, __webpack_require__) { - var curve = __webpack_require__(50); + var curve = __webpack_require__(51); module.exports = { /** @@ -15311,12 +15813,12 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 55 */ +/* 56 */ /***/ function(module, exports, __webpack_require__) { - var curve = __webpack_require__(50); + var curve = __webpack_require__(51); module.exports = { /** @@ -15356,12 +15858,12 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 56 */ +/* 57 */ /***/ function(module, exports, __webpack_require__) { - var normalizeRadian = __webpack_require__(57).normalizeRadian; + var normalizeRadian = __webpack_require__(58).normalizeRadian; var PI2 = Math.PI * 2; module.exports = { @@ -15422,7 +15924,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 57 */ +/* 58 */ /***/ function(module, exports) { @@ -15440,7 +15942,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 58 */ +/* 59 */ /***/ function(module, exports) { @@ -15467,7 +15969,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 59 */ +/* 60 */ /***/ function(module, exports) { @@ -15490,12 +15992,12 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 60 */ +/* 61 */ /***/ function(module, exports, __webpack_require__) { - var CMD = __webpack_require__(49).CMD; + var CMD = __webpack_require__(50).CMD; var vec2 = __webpack_require__(10); var v2ApplyTransform = vec2.applyTransform; @@ -15591,7 +16093,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 61 */ +/* 62 */ /***/ function(module, exports, __webpack_require__) { /** @@ -15601,11 +16103,11 @@ return /******/ (function(modules) { // webpackBootstrap - var Displayable = __webpack_require__(46); + var Displayable = __webpack_require__(47); var BoundingRect = __webpack_require__(9); var zrUtil = __webpack_require__(4); - var LRU = __webpack_require__(62); + var LRU = __webpack_require__(40); var globalImageCache = new LRU(50); /** * @alias zrender/graphic/Image @@ -15680,19 +16182,30 @@ return /******/ (function(modules) { // webpackBootstrap // } // Else is canvas - var width = style.width || image.width; - var height = style.height || image.height; var x = style.x || 0; var y = style.y || 0; // 图片加载失败 if (!image.width || !image.height) { return; } + var width = style.width; + var height = style.height; + var aspect = image.width / image.height; + if (width == null && height != null) { + // Keep image/height ratio + width = height * aspect; + } + else if (height == null && width != null) { + height = width / aspect; + } + else if (width == null && height == null) { + width = image.width; + height = image.height; + } // 设置transform this.setTransform(ctx); - if (style.sWidth && style.sHeight) { var sx = style.sx || 0; var sy = style.sy || 0; @@ -15717,14 +16230,6 @@ return /******/ (function(modules) { // webpackBootstrap ctx.drawImage(image, x, y, width, height); } - // 如果没设置宽和高的话自动根据图片宽高设置 - if (style.width == null) { - style.width = width; - } - if (style.height == null) { - style.height = height; - } - this.restoreTransform(ctx); // Draw rect text @@ -15751,181 +16256,6 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = ZImage; -/***/ }, -/* 62 */ -/***/ function(module, exports) { - - // Simple LRU cache use doubly linked list - // @module zrender/core/LRU - - - /** - * Simple double linked list. Compared with array, it has O(1) remove operation. - * @constructor - */ - var LinkedList = function() { - - /** - * @type {module:zrender/core/LRU~Entry} - */ - this.head = null; - - /** - * @type {module:zrender/core/LRU~Entry} - */ - this.tail = null; - - this._len = 0; - }; - - var linkedListProto = LinkedList.prototype; - /** - * Insert a new value at the tail - * @param {} val - * @return {module:zrender/core/LRU~Entry} - */ - linkedListProto.insert = function(val) { - var entry = new Entry(val); - this.insertEntry(entry); - return entry; - }; - - /** - * Insert an entry at the tail - * @param {module:zrender/core/LRU~Entry} entry - */ - linkedListProto.insertEntry = function(entry) { - if (!this.head) { - this.head = this.tail = entry; - } - else { - this.tail.next = entry; - entry.prev = this.tail; - this.tail = entry; - } - this._len++; - }; - - /** - * Remove entry. - * @param {module:zrender/core/LRU~Entry} entry - */ - linkedListProto.remove = function(entry) { - var prev = entry.prev; - var next = entry.next; - if (prev) { - prev.next = next; - } - else { - // Is head - this.head = next; - } - if (next) { - next.prev = prev; - } - else { - // Is tail - this.tail = prev; - } - entry.next = entry.prev = null; - this._len--; - }; - - /** - * @return {number} - */ - linkedListProto.len = function() { - return this._len; - }; - - /** - * @constructor - * @param {} val - */ - var Entry = function(val) { - /** - * @type {} - */ - this.value = val; - - /** - * @type {module:zrender/core/LRU~Entry} - */ - this.next; - - /** - * @type {module:zrender/core/LRU~Entry} - */ - this.prev; - }; - - /** - * LRU Cache - * @constructor - * @alias module:zrender/core/LRU - */ - var LRU = function(maxSize) { - - this._list = new LinkedList(); - - this._map = {}; - - this._maxSize = maxSize || 10; - }; - - var LRUProto = LRU.prototype; - - /** - * @param {string} key - * @param {} value - */ - LRUProto.put = function(key, value) { - var list = this._list; - var map = this._map; - if (map[key] == null) { - var len = list.len(); - if (len >= this._maxSize && len > 0) { - // Remove the least recently used - var leastUsedEntry = list.head; - list.remove(leastUsedEntry); - delete map[leastUsedEntry.key]; - } - - var entry = list.insert(value); - entry.key = key; - map[key] = entry; - } - }; - - /** - * @param {string} key - * @return {} - */ - LRUProto.get = function(key) { - var entry = this._map[key]; - var list = this._list; - if (entry != null) { - // Put the latest used entry in the tail - if (entry !== list.tail) { - list.remove(entry); - list.insertEntry(entry); - } - - return entry.value; - } - }; - - /** - * Clear the cache - */ - LRUProto.clear = function() { - this._list.clear(); - this._map = {}; - }; - - module.exports = LRU; - - /***/ }, /* 63 */ /***/ function(module, exports, __webpack_require__) { @@ -15941,7 +16271,7 @@ return /******/ (function(modules) { // webpackBootstrap - var Displayable = __webpack_require__(46); + var Displayable = __webpack_require__(47); var zrUtil = __webpack_require__(4); var textContain = __webpack_require__(8); @@ -16009,6 +16339,7 @@ return /******/ (function(modules) { // webpackBootstrap if (ctx.textAlign !== textAlign) { ctx.textAlign = 'left'; } + // FIXME in text contain default is top ctx.textBaseline = textBaseline || 'alphabetic'; // Use canvas default alphabetic baseline if (ctx.textBaseline !== textBaseline) { @@ -16019,8 +16350,9 @@ return /******/ (function(modules) { // webpackBootstrap var textLines = text.split('\n'); for (var i = 0; i < textLines.length; i++) { - style.hasFill() && ctx.fillText(textLines[i], x, y); + // Fill after stroke so the outline will not cover the main part. style.hasStroke() && ctx.strokeText(textLines[i], x, y); + style.hasFill() && ctx.fillText(textLines[i], x, y); y += lineHeight; } @@ -16029,8 +16361,8 @@ return /******/ (function(modules) { // webpackBootstrap }, getBoundingRect: function () { + var style = this.style; if (!this._rect) { - var style = this.style; var textVerticalAlign = style.textVerticalAlign; var rect = textContain.getBoundingRect( style.text + '', style.textFont || style.font, style.textAlign, @@ -16046,8 +16378,16 @@ return /******/ (function(modules) { // webpackBootstrap } rect.x += style.x || 0; rect.y += style.y || 0; + if (style.hasStroke()) { + var w = style.lineWidth; + rect.x -= w / 2; + rect.y -= w / 2; + rect.width += w; + rect.height += w; + } this._rect = rect; } + return this._rect; } }; @@ -16069,7 +16409,7 @@ return /******/ (function(modules) { // webpackBootstrap - module.exports = __webpack_require__(45).extend({ + module.exports = __webpack_require__(46).extend({ type: 'circle', @@ -16106,7 +16446,7 @@ return /******/ (function(modules) { // webpackBootstrap var env = __webpack_require__(2); - var Path = __webpack_require__(45); + var Path = __webpack_require__(46); var shadowTemp = [ ['shadowBlur', 0], @@ -16223,7 +16563,7 @@ return /******/ (function(modules) { // webpackBootstrap */ - module.exports = __webpack_require__(45).extend({ + module.exports = __webpack_require__(46).extend({ type: 'ring', @@ -16259,7 +16599,7 @@ return /******/ (function(modules) { // webpackBootstrap var polyHelper = __webpack_require__(68); - module.exports = __webpack_require__(45).extend({ + module.exports = __webpack_require__(46).extend({ type: 'polygon', @@ -16518,7 +16858,7 @@ return /******/ (function(modules) { // webpackBootstrap var polyHelper = __webpack_require__(68); - module.exports = __webpack_require__(45).extend({ + module.exports = __webpack_require__(46).extend({ type: 'polyline', @@ -16554,7 +16894,7 @@ return /******/ (function(modules) { // webpackBootstrap var roundRectHelper = __webpack_require__(73); - module.exports = __webpack_require__(45).extend({ + module.exports = __webpack_require__(46).extend({ type: 'rect', @@ -16694,7 +17034,7 @@ return /******/ (function(modules) { // webpackBootstrap * @module zrender/graphic/shape/Line */ - module.exports = __webpack_require__(45).extend({ + module.exports = __webpack_require__(46).extend({ type: 'line', @@ -16761,7 +17101,7 @@ return /******/ (function(modules) { // webpackBootstrap */ - var curveTool = __webpack_require__(50); + var curveTool = __webpack_require__(51); var vec2 = __webpack_require__(10); var quadraticSubdivide = curveTool.quadraticSubdivide; var cubicSubdivide = curveTool.cubicSubdivide; @@ -16788,7 +17128,7 @@ return /******/ (function(modules) { // webpackBootstrap ]; } } - module.exports = __webpack_require__(45).extend({ + module.exports = __webpack_require__(46).extend({ type: 'bezier-curve', @@ -16901,7 +17241,7 @@ return /******/ (function(modules) { // webpackBootstrap */ - module.exports = __webpack_require__(45).extend({ + module.exports = __webpack_require__(46).extend({ type: 'arc', @@ -16952,7 +17292,7 @@ return /******/ (function(modules) { // webpackBootstrap // CompoundPath to improve performance - var Path = __webpack_require__(45); + var Path = __webpack_require__(46); module.exports = Path.extend({ type: 'compound', @@ -17313,7 +17653,7 @@ return /******/ (function(modules) { // webpackBootstrap /** * @type {string} */ - zrender.version = '3.3.0'; + zrender.version = '3.4.0'; /** * Initializing a zrender instance @@ -17400,6 +17740,7 @@ return /******/ (function(modules) { // webpackBootstrap var storage = new Storage(); var rendererType = opts.renderer; + // TODO WebGL if (useVML) { if (!painterCtors.vml) { throw new Error('You need to require \'zrender/vml/vml\' to support IE8'); @@ -17630,9 +17971,8 @@ return /******/ (function(modules) { // webpackBootstrap * @param {number} width * @param {number} height */ - pathToImage: function(e, width, height) { - var id = guid(); - return this.painter.pathToImage(id, e, width, height); + pathToImage: function(e, dpr) { + return this.painter.pathToImage(e, dpr); }, /** @@ -19189,7 +19529,7 @@ return /******/ (function(modules) { // webpackBootstrap var deferredClips = []; for (var i = 0; i < len; i++) { var clip = clips[i]; - var e = clip.step(time); + var e = clip.step(time, delta); // Throw out the events need to be called after // stage.update, like destroy if (e) { @@ -20012,9 +20352,9 @@ return /******/ (function(modules) { // webpackBootstrap */ - var config = __webpack_require__(41); + var config = __webpack_require__(42); var util = __webpack_require__(4); - var log = __webpack_require__(40); + var log = __webpack_require__(41); var BoundingRect = __webpack_require__(9); var timsort = __webpack_require__(86); @@ -20037,7 +20377,7 @@ return /******/ (function(modules) { // webpackBootstrap return false; } - if (layer.isBuildin) { + if (layer.__builtin__) { return true; } @@ -20191,6 +20531,12 @@ return /******/ (function(modules) { // webpackBootstrap root.appendChild(domRoot); } else { + if (opts.width != null) { + root.width = opts.width; + } + if (opts.height != null) { + root.height = opts.height; + } // Use canvas width and height directly var width = root.width; var height = root.height; @@ -20209,8 +20555,6 @@ return /******/ (function(modules) { // webpackBootstrap this._domRoot = root; } - this.pathToImage = this._createPathToImage(); - // Layers for progressive rendering this._progressiveLayers = []; @@ -20257,7 +20601,7 @@ return /******/ (function(modules) { // webpackBootstrap for (var i = 0; i < zlevelList.length; i++) { var z = zlevelList[i]; var layer = this._layers[z]; - if (!layer.isBuildin && layer.refresh) { + if (!layer.__builtin__ && layer.refresh) { layer.refresh(); } } @@ -20400,11 +20744,11 @@ return /******/ (function(modules) { // webpackBootstrap this._clearProgressive(); - this.eachBuildinLayer(preProcessLayer); + this.eachBuiltinLayer(preProcessLayer); this._doPaintList(list, paintAll); - this.eachBuildinLayer(postProcessLayer); + this.eachBuiltinLayer(postProcessLayer); }, _doPaintList: function (list, paintAll) { @@ -20460,7 +20804,7 @@ return /******/ (function(modules) { // webpackBootstrap currentZLevel = elZLevel; currentLayer = this.getLayer(currentZLevel); - if (!currentLayer.isBuildin) { + if (!currentLayer.__builtin__) { log( 'ZLevel ' + currentZLevel + ' has been used by unkown layer ' + currentLayer.id @@ -20605,7 +20949,7 @@ return /******/ (function(modules) { // webpackBootstrap if (!layer) { // Create a new layer layer = new Layer('zr_' + zlevel, this, this.dpr); - layer.isBuildin = true; + layer.__builtin__ = true; if (this._layerConfig[zlevel]) { util.merge(layer, this._layerConfig[zlevel], true); @@ -20653,28 +20997,33 @@ return /******/ (function(modules) { // webpackBootstrap } zlevelList.splice(i + 1, 0, zlevel); - if (prevLayer) { - var prevDom = prevLayer.dom; - if (prevDom.nextSibling) { - domRoot.insertBefore( - layer.dom, - prevDom.nextSibling - ); - } - else { - domRoot.appendChild(layer.dom); - } - } - else { - if (domRoot.firstChild) { - domRoot.insertBefore(layer.dom, domRoot.firstChild); + layersMap[zlevel] = layer; + + // Vitual layer will not directly show on the screen. + // (It can be a WebGL layer and assigned to a ZImage element) + // But it still under management of zrender. + if (!layer.virtual) { + if (prevLayer) { + var prevDom = prevLayer.dom; + if (prevDom.nextSibling) { + domRoot.insertBefore( + layer.dom, + prevDom.nextSibling + ); + } + else { + domRoot.appendChild(layer.dom); + } } else { - domRoot.appendChild(layer.dom); + if (domRoot.firstChild) { + domRoot.insertBefore(layer.dom, domRoot.firstChild); + } + else { + domRoot.appendChild(layer.dom); + } } } - - layersMap[zlevel] = layer; }, // Iterate each layer @@ -20689,7 +21038,7 @@ return /******/ (function(modules) { // webpackBootstrap }, // Iterate each buildin layer - eachBuildinLayer: function (cb, context) { + eachBuiltinLayer: function (cb, context) { var zlevelList = this._zlevelList; var layer; var z; @@ -20697,7 +21046,7 @@ return /******/ (function(modules) { // webpackBootstrap for (i = 0; i < zlevelList.length; i++) { z = zlevelList[i]; layer = this._layers[z]; - if (layer.isBuildin) { + if (layer.__builtin__) { cb.call(context, layer, z); } } @@ -20712,7 +21061,7 @@ return /******/ (function(modules) { // webpackBootstrap for (i = 0; i < zlevelList.length; i++) { z = zlevelList[i]; layer = this._layers[z]; - if (! layer.isBuildin) { + if (!layer.__builtin__) { cb.call(context, layer, z); } } @@ -20734,7 +21083,7 @@ return /******/ (function(modules) { // webpackBootstrap var elCountsLastFrame = {}; var progressiveElCountsLastFrame = {}; - this.eachBuildinLayer(function (layer, z) { + this.eachBuiltinLayer(function (layer, z) { elCountsLastFrame[z] = layer.elCount; layer.elCount = 0; layer.__dirty = false; @@ -20808,7 +21157,7 @@ return /******/ (function(modules) { // webpackBootstrap } // 层中的元素数量有发生变化 - this.eachBuildinLayer(function (layer, z) { + this.eachBuiltinLayer(function (layer, z) { if (elCountsLastFrame[z] !== layer.elCount) { layer.__dirty = true; } @@ -20829,7 +21178,7 @@ return /******/ (function(modules) { // webpackBootstrap * 清除hover层外所有内容 */ clear: function () { - this.eachBuildinLayer(this._clearLayer); + this.eachBuiltinLayer(this._clearLayer); return this; }, @@ -21009,30 +21358,47 @@ return /******/ (function(modules) { // webpackBootstrap ) | 0; }, - _pathToImage: function (id, path, width, height, dpr) { + pathToImage: function (path, dpr) { + dpr = dpr || this.dpr; + var canvas = document.createElement('canvas'); var ctx = canvas.getContext('2d'); + var rect = path.getBoundingRect(); + var style = path.style; + var shadowBlurSize = style.shadowBlur; + var shadowOffsetX = style.shadowOffsetX; + var shadowOffsetY = style.shadowOffsetY; + var lineWidth = style.hasStroke() ? style.lineWidth : 0; + + var leftMargin = Math.max(lineWidth / 2, -shadowOffsetX + shadowBlurSize); + var rightMargin = Math.max(lineWidth / 2, shadowOffsetX + shadowBlurSize); + var topMargin = Math.max(lineWidth / 2, -shadowOffsetY + shadowBlurSize); + var bottomMargin = Math.max(lineWidth / 2, shadowOffsetY + shadowBlurSize); + var width = rect.width + leftMargin + rightMargin; + var height = rect.height + topMargin + bottomMargin; canvas.width = width * dpr; canvas.height = height * dpr; - ctx.clearRect(0, 0, width * dpr, height * dpr); + ctx.scale(dpr, dpr); + ctx.clearRect(0, 0, width, height); + ctx.dpr = dpr; var pathTransform = { position: path.position, rotation: path.rotation, scale: path.scale }; - path.position = [0, 0, 0]; + path.position = [leftMargin - rect.x, topMargin - rect.y]; path.rotation = 0; path.scale = [1, 1]; + path.updateTransform(); if (path) { path.brush(ctx); } - var ImageShape = __webpack_require__(61); + var ImageShape = __webpack_require__(62); var imgShape = new ImageShape({ - id: id, style: { x: 0, y: 0, @@ -21053,16 +21419,6 @@ return /******/ (function(modules) { // webpackBootstrap } return imgShape; - }, - - _createPathToImage: function () { - var me = this; - - return function (id, e, width, height) { - return me._pathToImage( - id, e, width, height, me.dpr - ); - }; } }; @@ -21081,9 +21437,9 @@ return /******/ (function(modules) { // webpackBootstrap var util = __webpack_require__(4); - var config = __webpack_require__(41); - var Style = __webpack_require__(47); - var Pattern = __webpack_require__(59); + var config = __webpack_require__(42); + var Style = __webpack_require__(48); + var Pattern = __webpack_require__(60); function returnFalse() { return false; @@ -21542,7 +21898,7 @@ return /******/ (function(modules) { // webpackBootstrap - var graphic = __webpack_require__(43); + var graphic = __webpack_require__(44); var zrUtil = __webpack_require__(4); var PI = Math.PI; /** @@ -21690,8 +22046,9 @@ return /******/ (function(modules) { // webpackBootstrap * @constructor * @alias module:echarts/data/List * - * @param {Array.} dimensions - * Dimensions should be concrete names like x, y, z, lng, lat, angle, radius + * @param {Array.} dimensions + * For example, ['someDimName', {name: 'someDimName', type: 'someDimType'}, ...]. + * Dimensions should be concrete names like x, y, z, lng, lat, angle, radius * @param {module:echarts/model/Model} hostModel */ var List = function (dimensions, hostModel) { @@ -22191,37 +22548,39 @@ return /******/ (function(modules) { // webpackBootstrap * @param {number} value * @param {boolean} stack If given value is after stacked * @param {number} [maxDistance=Infinity] - * @return {number} + * @return {Array.} Considere multiple points has the same value. */ listProto.indexOfNearest = function (dim, value, stack, maxDistance) { var storage = this._storage; var dimData = storage[dim]; + var nearestIndices = []; + + if (!dimData) { + return nearestIndices; + } if (maxDistance == null) { maxDistance = Infinity; } - var nearestIdx = -1; - if (dimData) { - var minDist = Number.MAX_VALUE; - for (var i = 0, len = this.count(); i < len; i++) { - var diff = value - this.get(dim, i, stack); - var dist = Math.abs(diff); - if ( - diff <= maxDistance - && (dist < minDist - // For the case of two data are same on xAxis, which has sequence data. - // Show the nearest index - // https://github.com/ecomfe/echarts/issues/2869 - || (dist === minDist && diff > 0) - ) - ) { + var minDist = Number.MAX_VALUE; + var minDiff = -1; + for (var i = 0, len = this.count(); i < len; i++) { + var diff = value - this.get(dim, i, stack); + var dist = Math.abs(diff); + if (diff <= maxDistance && dist <= minDist) { + // For the case of two data are same on xAxis, which has sequence data. + // Show the nearest index + // https://github.com/ecomfe/echarts/issues/2869 + if (dist < minDist || (diff >= 0 && minDiff < 0)) { minDist = dist; - nearestIdx = i; + minDiff = diff; + nearestIndices.length = 0; } + nearestIndices.push(i); } } - return nearestIdx; + return nearestIndices; }; /** @@ -22923,118 +23282,320 @@ return /******/ (function(modules) { // webpackBootstrap + var numberUtil = __webpack_require__(7); + var linearMap = numberUtil.linearMap; var zrUtil = __webpack_require__(4); - var echarts = __webpack_require__(1); - var PRIORITY = echarts.PRIORITY; - __webpack_require__(101); - __webpack_require__(104); + function fixExtentWithBands(extent, nTick) { + var size = extent[1] - extent[0]; + var len = nTick; + var margin = size / len / 2; + extent[0] += margin; + extent[1] -= margin; + } - echarts.registerVisual(zrUtil.curry( - __webpack_require__(110), 'line', 'circle', 'line' - )); - echarts.registerLayout(zrUtil.curry( - __webpack_require__(111), 'line' - )); + var normalizedExtent = [0, 1]; + /** + * @name module:echarts/coord/CartesianAxis + * @constructor + */ + var Axis = function (dim, scale, extent) { - // Down sample after filter - echarts.registerProcessor(PRIORITY.PROCESSOR.STATISTIC, zrUtil.curry( - __webpack_require__(112), 'line' - )); + /** + * Axis dimension. Such as 'x', 'y', 'z', 'angle', 'radius' + * @type {string} + */ + this.dim = dim; - // In case developer forget to include grid component - __webpack_require__(113); + /** + * Axis scale + * @type {module:echarts/coord/scale/*} + */ + this.scale = scale; + /** + * @type {Array.} + * @private + */ + this._extent = extent || [0, 0]; -/***/ }, -/* 101 */ -/***/ function(module, exports, __webpack_require__) { + /** + * @type {boolean} + */ + this.inverse = false; - 'use strict'; + /** + * Usually true when axis has a ordinal scale + * @type {boolean} + */ + this.onBand = false; + }; + Axis.prototype = { - var createListFromArray = __webpack_require__(102); - var SeriesModel = __webpack_require__(28); + constructor: Axis, - module.exports = SeriesModel.extend({ + /** + * If axis extent contain given coord + * @param {number} coord + * @return {boolean} + */ + contain: function (coord) { + var extent = this._extent; + var min = Math.min(extent[0], extent[1]); + var max = Math.max(extent[0], extent[1]); + return coord >= min && coord <= max; + }, - type: 'series.line', + /** + * If axis extent contain given data + * @param {number} data + * @return {boolean} + */ + containData: function (data) { + return this.contain(this.dataToCoord(data)); + }, - dependencies: ['grid', 'polar'], + /** + * Get coord extent. + * @return {Array.} + */ + getExtent: function () { + var ret = this._extent.slice(); + return ret; + }, - getInitialData: function (option, ecModel) { - if (true) { - var coordSys = option.coordinateSystem; - if (coordSys !== 'polar' && coordSys !== 'cartesian2d') { - throw new Error('Line not support coordinateSystem besides cartesian and polar'); - } + /** + * Get precision used for formatting + * @param {Array.} [dataExtent] + * @return {number} + */ + getPixelPrecision: function (dataExtent) { + return numberUtil.getPixelPrecision( + dataExtent || this.scale.getExtent(), + this._extent + ); + }, + + /** + * Set coord extent + * @param {number} start + * @param {number} end + */ + setExtent: function (start, end) { + var extent = this._extent; + extent[0] = start; + extent[1] = end; + }, + + /** + * Convert data to coord. Data is the rank if it has a ordinal scale + * @param {number} data + * @param {boolean} clamp + * @return {number} + */ + dataToCoord: function (data, clamp) { + var extent = this._extent; + var scale = this.scale; + data = scale.normalize(data); + + if (this.onBand && scale.type === 'ordinal') { + extent = extent.slice(); + fixExtentWithBands(extent, scale.count()); } - return createListFromArray(option.data, this, ecModel); + + return linearMap(data, normalizedExtent, extent, clamp); }, - defaultOption: { - zlevel: 0, // 一级层叠 - z: 2, // 二级层叠 - coordinateSystem: 'cartesian2d', - legendHoverLink: true, + /** + * Convert coord to data. Data is the rank if it has a ordinal scale + * @param {number} coord + * @param {boolean} clamp + * @return {number} + */ + coordToData: function (coord, clamp) { + var extent = this._extent; + var scale = this.scale; - hoverAnimation: true, - // stack: null - // xAxisIndex: 0, - // yAxisIndex: 0, + if (this.onBand && scale.type === 'ordinal') { + extent = extent.slice(); + fixExtentWithBands(extent, scale.count()); + } - // polarIndex: 0, + var t = linearMap(coord, extent, normalizedExtent, clamp); - // If clip the overflow value - clipOverflow: true, + return this.scale.scale(t); + }, - label: { - normal: { - position: 'top' + /** + * Convert pixel point to data in axis + * @param {Array.} point + * @param {boolean} clamp + * @return {number} data + */ + pointToData: function (point, clamp) { + // Should be implemented in derived class if necessary. + }, + + /** + * @return {Array.} + */ + getTicksCoords: function (alignWithLabel) { + if (this.onBand && !alignWithLabel) { + var bands = this.getBands(); + var coords = []; + for (var i = 0; i < bands.length; i++) { + coords.push(bands[i][0]); } - }, - // itemStyle: { - // normal: {}, - // emphasis: {} - // }, - lineStyle: { - normal: { - width: 2, - type: 'solid' + if (bands[i - 1]) { + coords.push(bands[i - 1][1]); } - }, - // areaStyle: {}, - // false, 'start', 'end', 'middle' - step: false, + return coords; + } + else { + return zrUtil.map(this.scale.getTicks(), this.dataToCoord, this); + } + }, - // Disabled if step is true - smooth: false, - smoothMonotone: null, - // 拐点图形类型 - symbol: 'emptyCircle', - // 拐点图形大小 - symbolSize: 4, - // 拐点图形旋转控制 - symbolRotate: null, + /** + * Coords of labels are on the ticks or on the middle of bands + * @return {Array.} + */ + getLabelsCoords: function () { + return zrUtil.map(this.scale.getTicks(), this.dataToCoord, this); + }, - // 是否显示 symbol, 只有在 tooltip hover 的时候显示 - showSymbol: true, - // 标志图形默认只有主轴显示(随主轴标签间隔隐藏策略) - showAllSymbol: false, + /** + * Get bands. + * + * If axis has labels [1, 2, 3, 4]. Bands on the axis are + * |---1---|---2---|---3---|---4---|. + * + * @return {Array} + */ + // FIXME Situation when labels is on ticks + getBands: function () { + var extent = this.getExtent(); + var bands = []; + var len = this.scale.count(); + var start = extent[0]; + var end = extent[1]; + var span = end - start; - // 是否连接断点 - connectNulls: false, + for (var i = 0; i < len; i++) { + bands.push([ + span * i / len + start, + span * (i + 1) / len + start + ]); + } + return bands; + }, - // 数据过滤,'average', 'max', 'min', 'sum' - sampling: 'none', + /** + * Get width of band + * @return {number} + */ + getBandWidth: function () { + var axisExtent = this._extent; + var dataExtent = this.scale.getExtent(); - animationEasing: 'linear', + var len = dataExtent[1] - dataExtent[0] + (this.onBand ? 1 : 0); + // Fix #2728, avoid NaN when only one data. + len === 0 && (len = 1); - // Disable progressive - progressive: 0, - hoverLayerThreshold: Infinity + var size = Math.abs(axisExtent[1] - axisExtent[0]); + + return Math.abs(size) / len; } - }); + + }; + + module.exports = Axis; + + +/***/ }, +/* 101 */ +/***/ function(module, exports, __webpack_require__) { + + + + var createListFromArray = __webpack_require__(102); + var symbolUtil = __webpack_require__(104); + var axisHelper = __webpack_require__(105); + var axisModelCommonMixin = __webpack_require__(111); + var Model = __webpack_require__(12); + var util = __webpack_require__(4); + + module.exports = { + /** + * Create a muti dimension List structure from seriesModel. + * @param {module:echarts/model/Model} seriesModel + * @return {module:echarts/data/List} list + */ + createList: function (seriesModel) { + var data = seriesModel.get('data'); + return createListFromArray(data, seriesModel, seriesModel.ecModel); + }, + + /** + * Complete the dimensions array guessed from the data structure. + * @param {Array.} dimensions Necessary dimensions, like ['x', 'y'] + * @param {Array} data Data list. [[1, 2, 3], [2, 3, 4]] + * @param {Object} [opt] + * @param {Array.} [opt.defaultNames] Default names to fill not necessary dimensions, like ['value'] + * @param {string} [opt.extraPrefix] Prefix of name when filling the left dimensions. + * @param {number} [opt.dimCount] If not specified, guess by the first data item. + * @return {Array.} + */ + completeDimensions: __webpack_require__(103), + + /** + * Create a symbol element with given symbol configuration: shape, x, y, width, height, color + * @see http://echarts.baidu.com/option.html#series-scatter.symbol + * @param {string} symbolDesc + * @param {number} x + * @param {number} y + * @param {number} w + * @param {number} h + * @param {string} color + */ + createSymbol: symbolUtil.createSymbol, + + /** + * Create scale + * @param {Array.} dataExtent + * @param {Object|module:echarts/Model} option + */ + createScale: function (dataExtent, option) { + var axisModel = option; + if (!(option instanceof Model)) { + axisModel = new Model(option); + util.mixin(axisModel, axisModelCommonMixin); + } + + var scale = axisHelper.createScaleByModel(axisModel); + scale.setExtent(dataExtent[0], dataExtent[1]); + + axisHelper.niceScaleExtent(scale, axisModel); + return scale; + }, + + /** + * Mixin common methods to axis model, + * + * Inlcude methods + * `getFormattedLabels() => Array.` + * `getCategories() => Array.` + * `getMin(origin: boolean) => number` + * `getMax(origin: boolean) => number` + * `getNeedCrossZero() => boolean` + * `setRange(start: number, end: number)` + * `resetRange()` + */ + mixinAxisModelCommonMethods: function (Model) { + util.mixin(Model, axisModelCommonMixin); + } + }; /***/ }, @@ -23086,9 +23647,14 @@ return /******/ (function(modules) { // webpackBootstrap var dimensions = axesInfo && axesInfo.dimensions; if (!dimensions) { // Get dimensions from registered coordinate system - dimensions = (registeredCoordSys && registeredCoordSys.dimensions) || ['x', 'y']; - dimensions = completeDimensions(dimensions, data, dimensions.concat(['value'])); + dimensions = (registeredCoordSys && ( + registeredCoordSys.getDimensionsInfo + ? registeredCoordSys.getDimensionsInfo() + : registeredCoordSys.dimensions.slice() + )) || ['x', 'y']; + dimensions = completeDimensions(dimensions, data, {defaultNames: dimensions.concat(['value'])}); } + var categoryIndex = axesInfo ? axesInfo.categoryIndex : -1; var list = new List(dimensions, seriesModel); @@ -23205,7 +23771,7 @@ return /******/ (function(modules) { // webpackBootstrap var isXAxisCateogry = xAxisType === 'category'; var isYAxisCategory = yAxisType === 'category'; - completeDimensions(dimensions, data, ['x', 'y', 'z']); + completeDimensions(dimensions, data, {defaultNames: ['x', 'y', 'z']}); var categoryAxesModels = {}; if (isXAxisCateogry) { @@ -23295,7 +23861,7 @@ return /******/ (function(modules) { // webpackBootstrap var isAngleAxisCateogry = angleAxisType === 'category'; var isRadiusAxisCateogry = radiusAxisType === 'category'; - completeDimensions(dimensions, data, ['radius', 'angle', 'value']); + completeDimensions(dimensions, data, {defaultNames: ['radius', 'angle', 'value']}); var categoryAxesModels = {}; if (isRadiusAxisCateogry) { @@ -23318,7 +23884,7 @@ return /******/ (function(modules) { // webpackBootstrap dimensions: completeDimensions([ {name: 'lng'}, {name: 'lat'} - ], data, ['lng', 'lat', 'value']) + ], data, {defaultNames: ['lng', 'lat', 'value']}) }; } }; @@ -23373,23 +23939,30 @@ return /******/ (function(modules) { // webpackBootstrap /** * Complete the dimensions array guessed from the data structure. - * @param {Array.} dimensions Necessary dimensions, like ['x', 'y'] - * @param {Array} data Data list. [[1, 2, 3], [2, 3, 4]] - * @param {Array.} [defaultNames] Default names to fill not necessary dimensions, like ['value'] - * @param {string} [extraPrefix] Prefix of name when filling the left dimensions. + * @param {Array.} dimensions Necessary dimensions, like ['x', 'y'] + * @param {Array} data Data list. [[1, 2, 3], [2, 3, 4]] + * @param {Object} [opt] + * @param {Array.} [opt.defaultNames] Default names to fill not necessary dimensions, like ['value'] + * @param {string} [opt.extraPrefix] Prefix of name when filling the left dimensions. + * @param {number} [opt.dimCount] If not specified, guess by the first data item. * @return {Array.} */ - function completeDimensions(dimensions, data, defaultNames, extraPrefix) { + function completeDimensions(dimensions, data, opt) { if (!data) { return dimensions; } - var value0 = retrieveValue(data[0]); - var dimSize = zrUtil.isArray(value0) && value0.length || 1; + opt = opt || {}; - defaultNames = defaultNames || []; - extraPrefix = extraPrefix || 'extra'; - for (var i = 0; i < dimSize; i++) { + var dimCount = opt.dimCount; + if (dimCount == null) { + var value0 = retrieveValue(data[0]); + dimCount = zrUtil.isArray(value0) && value0.length || 1; + } + + var defaultNames = opt.defaultNames || []; + var extraPrefix = opt.extraPrefix || 'extra'; + for (var i = 0; i < dimCount; i++) { if (!dimensions[i]) { var name = defaultNames[i] || (extraPrefix + (i - defaultNames.length)); dimensions[i] = guessOrdinal(data, i) @@ -23435,94 +24008,1804 @@ return /******/ (function(modules) { // webpackBootstrap /***/ function(module, exports, __webpack_require__) { 'use strict'; - // FIXME step not support polar + // Symbol factory - var zrUtil = __webpack_require__(4); - var SymbolDraw = __webpack_require__(105); - var Symbol = __webpack_require__(106); - var lineAnimationDiff = __webpack_require__(108); - var graphic = __webpack_require__(43); - var modelUtil = __webpack_require__(5); - var polyHelper = __webpack_require__(109); - var ChartView = __webpack_require__(42); + var graphic = __webpack_require__(44); + var BoundingRect = __webpack_require__(9); - function isPointsSame(points1, points2) { - if (points1.length !== points2.length) { - return; + /** + * Triangle shape + * @inner + */ + var Triangle = graphic.extendShape({ + type: 'triangle', + shape: { + cx: 0, + cy: 0, + width: 0, + height: 0 + }, + buildPath: function (path, shape) { + var cx = shape.cx; + var cy = shape.cy; + var width = shape.width / 2; + var height = shape.height / 2; + path.moveTo(cx, cy - height); + path.lineTo(cx + width, cy + height); + path.lineTo(cx - width, cy + height); + path.closePath(); } - for (var i = 0; i < points1.length; i++) { - var p1 = points1[i]; - var p2 = points2[i]; - if (p1[0] !== p2[0] || p1[1] !== p2[1]) { - return; - } + }); + /** + * Diamond shape + * @inner + */ + var Diamond = graphic.extendShape({ + type: 'diamond', + shape: { + cx: 0, + cy: 0, + width: 0, + height: 0 + }, + buildPath: function (path, shape) { + var cx = shape.cx; + var cy = shape.cy; + var width = shape.width / 2; + var height = shape.height / 2; + path.moveTo(cx, cy - height); + path.lineTo(cx + width, cy); + path.lineTo(cx, cy + height); + path.lineTo(cx - width, cy); + path.closePath(); } - return true; - } + }); - function getSmooth(smooth) { - return typeof (smooth) === 'number' ? smooth : (smooth ? 0.3 : 0); - } + /** + * Pin shape + * @inner + */ + var Pin = graphic.extendShape({ + type: 'pin', + shape: { + // x, y on the cusp + x: 0, + y: 0, + width: 0, + height: 0 + }, - function getAxisExtentWithGap(axis) { - var extent = axis.getGlobalExtent(); - if (axis.onBand) { - // Remove extra 1px to avoid line miter in clipped edge - var halfBandWidth = axis.getBandWidth() / 2 - 1; - var dir = extent[1] > extent[0] ? 1 : -1; - extent[0] += dir * halfBandWidth; - extent[1] -= dir * halfBandWidth; + buildPath: function (path, shape) { + var x = shape.x; + var y = shape.y; + var w = shape.width / 5 * 3; + // Height must be larger than width + var h = Math.max(w, shape.height); + var r = w / 2; + + // Dist on y with tangent point and circle center + var dy = r * r / (h - r); + var cy = y - h + r + dy; + var angle = Math.asin(dy / r); + // Dist on x with tangent point and circle center + var dx = Math.cos(angle) * r; + + var tanX = Math.sin(angle); + var tanY = Math.cos(angle); + + path.arc( + x, cy, r, + Math.PI - angle, + Math.PI * 2 + angle + ); + + var cpLen = r * 0.6; + var cpLen2 = r * 0.7; + path.bezierCurveTo( + x + dx - tanX * cpLen, cy + dy + tanY * cpLen, + x, y - cpLen2, + x, y + ); + path.bezierCurveTo( + x, y - cpLen2, + x - dx + tanX * cpLen, cy + dy + tanY * cpLen, + x - dx, cy + dy + ); + path.closePath(); } - return extent; - } + }); - function sign(val) { - return val >= 0 ? 1 : -1; - } /** - * @param {module:echarts/coord/cartesian/Cartesian2D|module:echarts/coord/polar/Polar} coordSys - * @param {module:echarts/data/List} data - * @param {Array.>} points - * @private + * Arrow shape + * @inner */ - function getStackedOnPoints(coordSys, data) { - var baseAxis = coordSys.getBaseAxis(); - var valueAxis = coordSys.getOtherAxis(baseAxis); - var valueStart = baseAxis.onZero - ? 0 : valueAxis.scale.getExtent()[0]; + var Arrow = graphic.extendShape({ - var valueDim = valueAxis.dim; + type: 'arrow', - var baseDataOffset = valueDim === 'x' || valueDim === 'radius' ? 1 : 0; + shape: { + x: 0, + y: 0, + width: 0, + height: 0 + }, - return data.mapArray([valueDim], function (val, idx) { - var stackedOnSameSign; - var stackedOn = data.stackedOn; - // Find first stacked value with same sign - while (stackedOn && - sign(stackedOn.get(valueDim, idx)) === sign(val) - ) { - stackedOnSameSign = stackedOn; - break; - } - var stackedData = []; - stackedData[baseDataOffset] = data.get(baseAxis.dim, idx); - stackedData[1 - baseDataOffset] = stackedOnSameSign - ? stackedOnSameSign.get(valueDim, idx, true) : valueStart; + buildPath: function (ctx, shape) { + var height = shape.height; + var width = shape.width; + var x = shape.x; + var y = shape.y; + var dx = width / 3 * 2; + ctx.moveTo(x, y); + ctx.lineTo(x + dx, y + height); + ctx.lineTo(x, y + height / 4 * 3); + ctx.lineTo(x - dx, y + height); + ctx.lineTo(x, y); + ctx.closePath(); + } + }); - return coordSys.dataToPoint(stackedData); - }, true); - } + /** + * Map of path contructors + * @type {Object.} + */ + var symbolCtors = { + line: graphic.Line, - function createGridClipShape(cartesian, hasAnimation, seriesModel) { - var xExtent = getAxisExtentWithGap(cartesian.getAxis('x')); - var yExtent = getAxisExtentWithGap(cartesian.getAxis('y')); - var isHorizontal = cartesian.getBaseAxis().isHorizontal(); + rect: graphic.Rect, - var x = Math.min(xExtent[0], xExtent[1]); - var y = Math.min(yExtent[0], yExtent[1]); - var width = Math.max(xExtent[0], xExtent[1]) - x; + roundRect: graphic.Rect, + + square: graphic.Rect, + + circle: graphic.Circle, + + diamond: Diamond, + + pin: Pin, + + arrow: Arrow, + + triangle: Triangle + }; + + var symbolShapeMakers = { + + line: function (x, y, w, h, shape) { + // FIXME + shape.x1 = x; + shape.y1 = y + h / 2; + shape.x2 = x + w; + shape.y2 = y + h / 2; + }, + + rect: function (x, y, w, h, shape) { + shape.x = x; + shape.y = y; + shape.width = w; + shape.height = h; + }, + + roundRect: function (x, y, w, h, shape) { + shape.x = x; + shape.y = y; + shape.width = w; + shape.height = h; + shape.r = Math.min(w, h) / 4; + }, + + square: function (x, y, w, h, shape) { + var size = Math.min(w, h); + shape.x = x; + shape.y = y; + shape.width = size; + shape.height = size; + }, + + circle: function (x, y, w, h, shape) { + // Put circle in the center of square + shape.cx = x + w / 2; + shape.cy = y + h / 2; + shape.r = Math.min(w, h) / 2; + }, + + diamond: function (x, y, w, h, shape) { + shape.cx = x + w / 2; + shape.cy = y + h / 2; + shape.width = w; + shape.height = h; + }, + + pin: function (x, y, w, h, shape) { + shape.x = x + w / 2; + shape.y = y + h / 2; + shape.width = w; + shape.height = h; + }, + + arrow: function (x, y, w, h, shape) { + shape.x = x + w / 2; + shape.y = y + h / 2; + shape.width = w; + shape.height = h; + }, + + triangle: function (x, y, w, h, shape) { + shape.cx = x + w / 2; + shape.cy = y + h / 2; + shape.width = w; + shape.height = h; + } + }; + + var symbolBuildProxies = {}; + for (var name in symbolCtors) { + if (symbolCtors.hasOwnProperty(name)) { + symbolBuildProxies[name] = new symbolCtors[name](); + } + } + + var Symbol = graphic.extendShape({ + + type: 'symbol', + + shape: { + symbolType: '', + x: 0, + y: 0, + width: 0, + height: 0 + }, + + beforeBrush: function () { + var style = this.style; + var shape = this.shape; + // FIXME + if (shape.symbolType === 'pin' && style.textPosition === 'inside') { + style.textPosition = ['50%', '40%']; + style.textAlign = 'center'; + style.textVerticalAlign = 'middle'; + } + }, + + buildPath: function (ctx, shape, inBundle) { + var symbolType = shape.symbolType; + var proxySymbol = symbolBuildProxies[symbolType]; + if (shape.symbolType !== 'none') { + if (!proxySymbol) { + // Default rect + symbolType = 'rect'; + proxySymbol = symbolBuildProxies[symbolType]; + } + symbolShapeMakers[symbolType]( + shape.x, shape.y, shape.width, shape.height, proxySymbol.shape + ); + proxySymbol.buildPath(ctx, proxySymbol.shape, inBundle); + } + } + }); + + // Provide setColor helper method to avoid determine if set the fill or stroke outside + var symbolPathSetColor = function (color) { + if (this.type !== 'image') { + var symbolStyle = this.style; + var symbolShape = this.shape; + if (symbolShape && symbolShape.symbolType === 'line') { + symbolStyle.stroke = color; + } + else if (this.__isEmptyBrush) { + symbolStyle.stroke = color; + symbolStyle.fill = '#fff'; + } + else { + // FIXME 判断图形默认是填充还是描边,使用 onlyStroke ? + symbolStyle.fill && (symbolStyle.fill = color); + symbolStyle.stroke && (symbolStyle.stroke = color); + } + this.dirty(false); + } + }; + + var symbolUtil = { + /** + * Create a symbol element with given symbol configuration: shape, x, y, width, height, color + * @param {string} symbolType + * @param {number} x + * @param {number} y + * @param {number} w + * @param {number} h + * @param {string} color + */ + createSymbol: function (symbolType, x, y, w, h, color) { + // TODO Support image object, DynamicImage. + + var isEmpty = symbolType.indexOf('empty') === 0; + if (isEmpty) { + symbolType = symbolType.substr(5, 1).toLowerCase() + symbolType.substr(6); + } + var symbolPath; + + if (symbolType.indexOf('image://') === 0) { + symbolPath = new graphic.Image({ + style: { + image: symbolType.slice(8), + x: x, + y: y, + width: w, + height: h + } + }); + } + else if (symbolType.indexOf('path://') === 0) { + symbolPath = graphic.makePath(symbolType.slice(7), {}, new BoundingRect(x, y, w, h)); + } + else { + symbolPath = new Symbol({ + shape: { + symbolType: symbolType, + x: x, + y: y, + width: w, + height: h + } + }); + } + + symbolPath.__isEmptyBrush = isEmpty; + + symbolPath.setColor = symbolPathSetColor; + + symbolPath.setColor(color); + + return symbolPath; + } + }; + + module.exports = symbolUtil; + + +/***/ }, +/* 105 */ +/***/ function(module, exports, __webpack_require__) { + + + + var OrdinalScale = __webpack_require__(106); + var IntervalScale = __webpack_require__(108); + __webpack_require__(109); + __webpack_require__(110); + var Scale = __webpack_require__(107); + + var numberUtil = __webpack_require__(7); + var zrUtil = __webpack_require__(4); + var textContain = __webpack_require__(8); + var axisHelper = {}; + + /** + * Get axis scale extent before niced. + * Item of returned array can only be number (including Infinity and NaN). + */ + axisHelper.getScaleExtent = function (scale, model) { + var scaleType = scale.type; + + var min = model.getMin(); + var max = model.getMax(); + var fixMin = min != null; + var fixMax = max != null; + var originalExtent = scale.getExtent(); + + var axisDataLen; + var boundaryGap; + var span; + if (scaleType === 'ordinal') { + axisDataLen = (model.get('data') || []).length; + } + else { + boundaryGap = model.get('boundaryGap'); + if (!zrUtil.isArray(boundaryGap)) { + boundaryGap = [boundaryGap || 0, boundaryGap || 0]; + } + boundaryGap[0] = numberUtil.parsePercent(boundaryGap[0], 1); + boundaryGap[1] = numberUtil.parsePercent(boundaryGap[1], 1); + span = originalExtent[1] - originalExtent[0]; + } + + if (min == null) { + min = scaleType === 'ordinal' + ? (axisDataLen ? 0 : NaN) + : originalExtent[0] - boundaryGap[0] * span; + } + if (max == null) { + max = scaleType === 'ordinal' + ? (axisDataLen ? axisDataLen - 1 : NaN) + : originalExtent[1] + boundaryGap[1] * span; + } + + if (min === 'dataMin') { + min = originalExtent[0]; + } + if (max === 'dataMax') { + max = originalExtent[1]; + } + + (min == null || !isFinite(min)) && (min = NaN); + (max == null || !isFinite(max)) && (max = NaN); + + scale.setBlank(zrUtil.eqNaN(min) || zrUtil.eqNaN(max)); + + // Evaluate if axis needs cross zero + if (model.getNeedCrossZero()) { + // Axis is over zero and min is not set + if (min > 0 && max > 0 && !fixMin) { + min = 0; + } + // Axis is under zero and max is not set + if (min < 0 && max < 0 && !fixMax) { + max = 0; + } + } + + return [min, max]; + }; + + axisHelper.niceScaleExtent = function (scale, model) { + var extent = axisHelper.getScaleExtent(scale, model); + var fixMin = model.getMin() != null; + var fixMax = model.getMax() != null; + var splitNumber = model.get('splitNumber'); + + if (scale.type === 'log') { + scale.base = model.get('logBase'); + } + + scale.setExtent(extent[0], extent[1]); + scale.niceExtent(splitNumber, fixMin, fixMax); + + // Use minInterval to constraint the calculated interval. + // If calculated interval is less than minInterval. increase the interval quantity until + // it is larger than minInterval. + // For example: + // minInterval is 1, calculated interval is 0.2, so increase it to be 1. In this way we can get + // an integer axis. + var minInterval = model.get('minInterval'); + if (isFinite(minInterval) && !fixMin && !fixMax && scale.type === 'interval') { + var interval = scale.getInterval(); + var intervalScale = Math.max(Math.abs(interval), minInterval) / interval; + // while (interval < minInterval) { + // var quantity = numberUtil.quantity(interval); + // interval = quantity * 10; + // scaleQuantity *= 10; + // } + extent = scale.getExtent(); + var origin = (extent[1] + extent[0]) / 2; + scale.setExtent( + intervalScale * (extent[0] - origin) + origin, + intervalScale * (extent[1] - origin) + origin + ); + scale.niceExtent(splitNumber); + } + + // If some one specified the min, max. And the default calculated interval + // is not good enough. He can specify the interval. It is often appeared + // in angle axis with angle 0 - 360. Interval calculated in interval scale is hard + // to be 60. + // FIXME + var interval = model.get('interval'); + if (interval != null) { + scale.setInterval && scale.setInterval(interval); + } + }; + + /** + * @param {module:echarts/model/Model} model + * @param {string} [axisType] Default retrieve from model.type + * @return {module:echarts/scale/*} + */ + axisHelper.createScaleByModel = function(model, axisType) { + axisType = axisType || model.get('type'); + if (axisType) { + switch (axisType) { + // Buildin scale + case 'category': + return new OrdinalScale( + model.getCategories(), [Infinity, -Infinity] + ); + case 'value': + return new IntervalScale(); + // Extended scale, like time and log + default: + return (Scale.getClass(axisType) || IntervalScale).create(model); + } + } + }; + + /** + * Check if the axis corss 0 + */ + axisHelper.ifAxisCrossZero = function (axis) { + var dataExtent = axis.scale.getExtent(); + var min = dataExtent[0]; + var max = dataExtent[1]; + return !((min > 0 && max > 0) || (min < 0 && max < 0)); + }; + + /** + * @param {Array.} tickCoords In axis self coordinate. + * @param {Array.} labels + * @param {string} font + * @param {boolean} isAxisHorizontal + * @return {number} + */ + axisHelper.getAxisLabelInterval = function (tickCoords, labels, font, isAxisHorizontal) { + // FIXME + // 不同角的axis和label,不只是horizontal和vertical. + + var textSpaceTakenRect; + var autoLabelInterval = 0; + var accumulatedLabelInterval = 0; + + var step = 1; + if (labels.length > 40) { + // Simple optimization for large amount of labels + step = Math.floor(labels.length / 40); + } + + for (var i = 0; i < tickCoords.length; i += step) { + var tickCoord = tickCoords[i]; + var rect = textContain.getBoundingRect( + labels[i], font, 'center', 'top' + ); + rect[isAxisHorizontal ? 'x' : 'y'] += tickCoord; + // FIXME Magic number 1.5 + rect[isAxisHorizontal ? 'width' : 'height'] *= 1.3; + if (!textSpaceTakenRect) { + textSpaceTakenRect = rect.clone(); + } + // There is no space for current label; + else if (textSpaceTakenRect.intersect(rect)) { + accumulatedLabelInterval++; + autoLabelInterval = Math.max(autoLabelInterval, accumulatedLabelInterval); + } + else { + textSpaceTakenRect.union(rect); + // Reset + accumulatedLabelInterval = 0; + } + } + if (autoLabelInterval === 0 && step > 1) { + return step; + } + return (autoLabelInterval + 1) * step - 1; + }; + + /** + * @param {Object} axis + * @param {Function} labelFormatter + * @return {Array.} + */ + axisHelper.getFormattedLabels = function (axis, labelFormatter) { + var scale = axis.scale; + var labels = scale.getTicksLabels(); + var ticks = scale.getTicks(); + if (typeof labelFormatter === 'string') { + labelFormatter = (function (tpl) { + return function (val) { + return tpl.replace('{value}', val != null ? val : ''); + }; + })(labelFormatter); + // Consider empty array + return zrUtil.map(labels, labelFormatter); + } + else if (typeof labelFormatter === 'function') { + return zrUtil.map(ticks, function (tick, idx) { + return labelFormatter( + axisHelper.getAxisRawValue(axis, tick), + idx + ); + }, this); + } + else { + return labels; + } + }; + + axisHelper.getAxisRawValue = function (axis, value) { + // In category axis with data zoom, tick is not the original + // index of axis.data. So tick should not be exposed to user + // in category axis. + return axis.type === 'category' ? axis.scale.getLabel(value) : value; + }; + + module.exports = axisHelper; + + +/***/ }, +/* 106 */ +/***/ function(module, exports, __webpack_require__) { + + /** + * Linear continuous scale + * @module echarts/coord/scale/Ordinal + * + * http://en.wikipedia.org/wiki/Level_of_measurement + */ + + // FIXME only one data + + + var zrUtil = __webpack_require__(4); + var Scale = __webpack_require__(107); + + var scaleProto = Scale.prototype; + + var OrdinalScale = Scale.extend({ + + type: 'ordinal', + + init: function (data, extent) { + this._data = data; + this._extent = extent || [0, data.length - 1]; + }, + + parse: function (val) { + return typeof val === 'string' + ? zrUtil.indexOf(this._data, val) + // val might be float. + : Math.round(val); + }, + + contain: function (rank) { + rank = this.parse(rank); + return scaleProto.contain.call(this, rank) + && this._data[rank] != null; + }, + + /** + * Normalize given rank or name to linear [0, 1] + * @param {number|string} [val] + * @return {number} + */ + normalize: function (val) { + return scaleProto.normalize.call(this, this.parse(val)); + }, + + scale: function (val) { + return Math.round(scaleProto.scale.call(this, val)); + }, + + /** + * @return {Array} + */ + getTicks: function () { + var ticks = []; + var extent = this._extent; + var rank = extent[0]; + + while (rank <= extent[1]) { + ticks.push(rank); + rank++; + } + + return ticks; + }, + + /** + * Get item on rank n + * @param {number} n + * @return {string} + */ + getLabel: function (n) { + return this._data[n]; + }, + + /** + * @return {number} + */ + count: function () { + return this._extent[1] - this._extent[0] + 1; + }, + + /** + * @override + */ + unionExtentFromData: function (data, dim) { + this.unionExtent(data.getDataExtent(dim, false)); + }, + + niceTicks: zrUtil.noop, + niceExtent: zrUtil.noop + }); + + /** + * @return {module:echarts/scale/Time} + */ + OrdinalScale.create = function () { + return new OrdinalScale(); + }; + + module.exports = OrdinalScale; + + +/***/ }, +/* 107 */ +/***/ function(module, exports, __webpack_require__) { + + /** + * // Scale class management + * @module echarts/scale/Scale + */ + + + var clazzUtil = __webpack_require__(13); + + function Scale() { + /** + * Extent + * @type {Array.} + * @protected + */ + this._extent = [Infinity, -Infinity]; + + /** + * Step is calculated in adjustExtent + * @type {Array.} + * @protected + */ + this._interval = 0; + + this.init && this.init.apply(this, arguments); + } + + var scaleProto = Scale.prototype; + + /** + * Parse input val to valid inner number. + * @param {*} val + * @return {number} + */ + scaleProto.parse = function (val) { + // Notice: This would be a trap here, If the implementation + // of this method depends on extent, and this method is used + // before extent set (like in dataZoom), it would be wrong. + // Nevertheless, parse does not depend on extent generally. + return val; + }; + + scaleProto.contain = function (val) { + var extent = this._extent; + return val >= extent[0] && val <= extent[1]; + }; + + /** + * Normalize value to linear [0, 1], return 0.5 if extent span is 0 + * @param {number} val + * @return {number} + */ + scaleProto.normalize = function (val) { + var extent = this._extent; + if (extent[1] === extent[0]) { + return 0.5; + } + return (val - extent[0]) / (extent[1] - extent[0]); + }; + + /** + * Scale normalized value + * @param {number} val + * @return {number} + */ + scaleProto.scale = function (val) { + var extent = this._extent; + return val * (extent[1] - extent[0]) + extent[0]; + }; + + /** + * Set extent from data + * @param {Array.} other + */ + scaleProto.unionExtent = function (other) { + var extent = this._extent; + other[0] < extent[0] && (extent[0] = other[0]); + other[1] > extent[1] && (extent[1] = other[1]); + // not setExtent because in log axis it may transformed to power + // this.setExtent(extent[0], extent[1]); + }; + + /** + * Set extent from data + * @param {module:echarts/data/List} data + * @param {string} dim + */ + scaleProto.unionExtentFromData = function (data, dim) { + this.unionExtent(data.getDataExtent(dim, true)); + }; + + /** + * Get extent + * @return {Array.} + */ + scaleProto.getExtent = function () { + return this._extent.slice(); + }; + + /** + * Set extent + * @param {number} start + * @param {number} end + */ + scaleProto.setExtent = function (start, end) { + var thisExtent = this._extent; + if (!isNaN(start)) { + thisExtent[0] = start; + } + if (!isNaN(end)) { + thisExtent[1] = end; + } + }; + + /** + * @return {Array.} + */ + scaleProto.getTicksLabels = function () { + var labels = []; + var ticks = this.getTicks(); + for (var i = 0; i < ticks.length; i++) { + labels.push(this.getLabel(ticks[i])); + } + return labels; + }; + + /** + * When axis extent depends on data and no data exists, + * axis ticks should not be drawn, which is named 'blank'. + */ + scaleProto.isBlank = function () { + return this._isBlank; + }, + + /** + * When axis extent depends on data and no data exists, + * axis ticks should not be drawn, which is named 'blank'. + */ + scaleProto.setBlank = function (isBlank) { + this._isBlank = isBlank; + }; + + + clazzUtil.enableClassExtend(Scale); + clazzUtil.enableClassManagement(Scale, { + registerWhenExtend: true + }); + + module.exports = Scale; + + +/***/ }, +/* 108 */ +/***/ function(module, exports, __webpack_require__) { + + /** + * Interval scale + * @module echarts/scale/Interval + */ + + + + var numberUtil = __webpack_require__(7); + var formatUtil = __webpack_require__(6); + var Scale = __webpack_require__(107); + + var mathFloor = Math.floor; + var mathCeil = Math.ceil; + + var getPrecisionSafe = numberUtil.getPrecisionSafe; + var roundingErrorFix = numberUtil.round; + /** + * @alias module:echarts/coord/scale/Interval + * @constructor + */ + var IntervalScale = Scale.extend({ + + type: 'interval', + + _interval: 0, + + _intervalPrecision: 2, + + setExtent: function (start, end) { + var thisExtent = this._extent; + //start,end may be a Number like '25',so... + if (!isNaN(start)) { + thisExtent[0] = parseFloat(start); + } + if (!isNaN(end)) { + thisExtent[1] = parseFloat(end); + } + }, + + unionExtent: function (other) { + var extent = this._extent; + other[0] < extent[0] && (extent[0] = other[0]); + other[1] > extent[1] && (extent[1] = other[1]); + + // unionExtent may called by it's sub classes + IntervalScale.prototype.setExtent.call(this, extent[0], extent[1]); + }, + /** + * Get interval + */ + getInterval: function () { + if (!this._interval) { + this.niceTicks(); + } + return this._interval; + }, + + /** + * Set interval + */ + setInterval: function (interval) { + this._interval = interval; + // Dropped auto calculated niceExtent and use user setted extent + // We assume user wan't to set both interval, min, max to get a better result + this._niceExtent = this._extent.slice(); + }, + + /** + * @return {Array.} + */ + getTicks: function () { + if (!this._interval) { + this.niceTicks(); + } + var interval = this._interval; + var extent = this._extent; + var ticks = []; + + // Consider this case: using dataZoom toolbox, zoom and zoom. + var safeLimit = 10000; + + if (interval) { + var niceExtent = this._niceExtent; + var precision = this._intervalPrecision = getPrecisionSafe(interval); + // FIXME + precision += 2; + + if (extent[0] < niceExtent[0]) { + ticks.push(extent[0]); + } + var tick = niceExtent[0]; + + while (tick <= niceExtent[1]) { + ticks.push(tick); + // Avoid rounding error + tick = roundingErrorFix(tick + interval, precision); + if (ticks.length > safeLimit) { + return []; + } + } + // Consider this case: the last item of ticks is smaller + // than niceExtent[1] and niceExtent[1] === extent[1]. + if (extent[1] > (ticks.length ? ticks[ticks.length - 1] : niceExtent[1])) { + ticks.push(extent[1]); + } + } + + return ticks; + }, + + /** + * @return {Array.} + */ + getTicksLabels: function () { + var labels = []; + var ticks = this.getTicks(); + for (var i = 0; i < ticks.length; i++) { + labels.push(this.getLabel(ticks[i])); + } + return labels; + }, + + /** + * @param {number} data + * @param {Object} [opt] + * @param {number|string} [opt.precision] If 'auto', use nice presision. + * @param {boolean} [opt.pad] returns 1.50 but not 1.5 if precision is 2. + * @return {number} + */ + getLabel: function (data, opt) { + var precision = opt && opt.precision; + if (data != null && precision != null) { + // Should be more precise then tick. + precision === 'auto' && (precision = this._intervalPrecision + 2); + data = roundingErrorFix(data, precision, opt && opt.pad); + } + return formatUtil.addCommas(data); + }, + + /** + * Update interval and extent of intervals for nice ticks + * + * @param {number} [splitNumber = 5] Desired number of ticks + */ + niceTicks: function (splitNumber) { + splitNumber = splitNumber || 5; + var extent = this._extent; + var span = extent[1] - extent[0]; + if (!isFinite(span)) { + return; + } + // User may set axis min 0 and data are all negative + // FIXME If it needs to reverse ? + if (span < 0) { + span = -span; + extent.reverse(); + } + + // From "Nice Numbers for Graph Labels" of Graphic Gems + // var niceSpan = numberUtil.nice(span, false); + var step = roundingErrorFix( + numberUtil.nice(span / splitNumber, true), + Math.max( + getPrecisionSafe(extent[0]), + getPrecisionSafe(extent[1]) + // extent may be [0, 1], and step should have 1 more digits. + // To make it safe we add 2 more digits + ) + 2 + ); + + var precision = getPrecisionSafe(step) + 2; + // Niced extent inside original extent + var niceExtent = [ + roundingErrorFix(mathCeil(extent[0] / step) * step, precision), + roundingErrorFix(mathFloor(extent[1] / step) * step, precision) + ]; + + this._interval = step; + this._niceExtent = niceExtent; + }, + + /** + * Nice extent. + * @param {number} [splitNumber = 5] Given approx tick number + * @param {boolean} [fixMin=false] + * @param {boolean} [fixMax=false] + */ + niceExtent: function (splitNumber, fixMin, fixMax) { + var extent = this._extent; + // If extent start and end are same, expand them + if (extent[0] === extent[1]) { + if (extent[0] !== 0) { + // Expand extent + var expandSize = extent[0]; + // In the fowllowing case + // Axis has been fixed max 100 + // Plus data are all 100 and axis extent are [100, 100]. + // Extend to the both side will cause expanded max is larger than fixed max. + // So only expand to the smaller side. + if (!fixMax) { + extent[1] += expandSize / 2; + extent[0] -= expandSize / 2; + } + else { + extent[0] -= expandSize / 2; + } + } + else { + extent[1] = 1; + } + } + var span = extent[1] - extent[0]; + // If there are no data and extent are [Infinity, -Infinity] + if (!isFinite(span)) { + extent[0] = 0; + extent[1] = 1; + } + + this.niceTicks(splitNumber); + + // var extent = this._extent; + var interval = this._interval; + + if (!fixMin) { + extent[0] = roundingErrorFix(mathFloor(extent[0] / interval) * interval); + } + if (!fixMax) { + extent[1] = roundingErrorFix(mathCeil(extent[1] / interval) * interval); + } + } + }); + + /** + * @return {module:echarts/scale/Time} + */ + IntervalScale.create = function () { + return new IntervalScale(); + }; + + module.exports = IntervalScale; + + + +/***/ }, +/* 109 */ +/***/ function(module, exports, __webpack_require__) { + + /** + * Interval scale + * @module echarts/coord/scale/Time + */ + + + + var zrUtil = __webpack_require__(4); + var numberUtil = __webpack_require__(7); + var formatUtil = __webpack_require__(6); + + var IntervalScale = __webpack_require__(108); + + var intervalScaleProto = IntervalScale.prototype; + + var mathCeil = Math.ceil; + var mathFloor = Math.floor; + var ONE_SECOND = 1000; + var ONE_MINUTE = ONE_SECOND * 60; + var ONE_HOUR = ONE_MINUTE * 60; + var ONE_DAY = ONE_HOUR * 24; + + // FIXME 公用? + var bisect = function (a, x, lo, hi) { + while (lo < hi) { + var mid = lo + hi >>> 1; + if (a[mid][2] < x) { + lo = mid + 1; + } + else { + hi = mid; + } + } + return lo; + }; + + /** + * @alias module:echarts/coord/scale/Time + * @constructor + */ + var TimeScale = IntervalScale.extend({ + type: 'time', + + // Overwrite + getLabel: function (val) { + var stepLvl = this._stepLvl; + + var date = new Date(val); + + return formatUtil.formatTime(stepLvl[0], date); + }, + + // Overwrite + niceExtent: function (approxTickNum, fixMin, fixMax) { + var extent = this._extent; + // If extent start and end are same, expand them + if (extent[0] === extent[1]) { + // Expand extent + extent[0] -= ONE_DAY; + extent[1] += ONE_DAY; + } + // If there are no data and extent are [Infinity, -Infinity] + if (extent[1] === -Infinity && extent[0] === Infinity) { + var d = new Date(); + extent[1] = new Date(d.getFullYear(), d.getMonth(), d.getDate()); + extent[0] = extent[1] - ONE_DAY; + } + + this.niceTicks(approxTickNum); + + // var extent = this._extent; + var interval = this._interval; + + if (!fixMin) { + extent[0] = numberUtil.round(mathFloor(extent[0] / interval) * interval); + } + if (!fixMax) { + extent[1] = numberUtil.round(mathCeil(extent[1] / interval) * interval); + } + }, + + // Overwrite + niceTicks: function (approxTickNum) { + approxTickNum = approxTickNum || 10; + + var extent = this._extent; + var span = extent[1] - extent[0]; + var approxInterval = span / approxTickNum; + var scaleLevelsLen = scaleLevels.length; + var idx = bisect(scaleLevels, approxInterval, 0, scaleLevelsLen); + + var level = scaleLevels[Math.min(idx, scaleLevelsLen - 1)]; + var interval = level[2]; + // Same with interval scale if span is much larger than 1 year + if (level[0] === 'year') { + var yearSpan = span / interval; + + // From "Nice Numbers for Graph Labels" of Graphic Gems + // var niceYearSpan = numberUtil.nice(yearSpan, false); + var yearStep = numberUtil.nice(yearSpan / approxTickNum, true); + + interval *= yearStep; + } + + var niceExtent = [ + mathCeil(extent[0] / interval) * interval, + mathFloor(extent[1] / interval) * interval + ]; + + this._stepLvl = level; + // Interval will be used in getTicks + this._interval = interval; + this._niceExtent = niceExtent; + }, + + parse: function (val) { + // val might be float. + return +numberUtil.parseDate(val); + } + }); + + zrUtil.each(['contain', 'normalize'], function (methodName) { + TimeScale.prototype[methodName] = function (val) { + return intervalScaleProto[methodName].call(this, this.parse(val)); + }; + }); + + // Steps from d3 + var scaleLevels = [ + // Format step interval + ['hh:mm:ss', 1, ONE_SECOND], // 1s + ['hh:mm:ss', 5, ONE_SECOND * 5], // 5s + ['hh:mm:ss', 10, ONE_SECOND * 10], // 10s + ['hh:mm:ss', 15, ONE_SECOND * 15], // 15s + ['hh:mm:ss', 30, ONE_SECOND * 30], // 30s + ['hh:mm\nMM-dd',1, ONE_MINUTE], // 1m + ['hh:mm\nMM-dd',5, ONE_MINUTE * 5], // 5m + ['hh:mm\nMM-dd',10, ONE_MINUTE * 10], // 10m + ['hh:mm\nMM-dd',15, ONE_MINUTE * 15], // 15m + ['hh:mm\nMM-dd',30, ONE_MINUTE * 30], // 30m + ['hh:mm\nMM-dd',1, ONE_HOUR], // 1h + ['hh:mm\nMM-dd',2, ONE_HOUR * 2], // 2h + ['hh:mm\nMM-dd',6, ONE_HOUR * 6], // 6h + ['hh:mm\nMM-dd',12, ONE_HOUR * 12], // 12h + ['MM-dd\nyyyy', 1, ONE_DAY], // 1d + ['week', 7, ONE_DAY * 7], // 7d + ['month', 1, ONE_DAY * 31], // 1M + ['quarter', 3, ONE_DAY * 380 / 4], // 3M + ['half-year', 6, ONE_DAY * 380 / 2], // 6M + ['year', 1, ONE_DAY * 380] // 1Y + ]; + + /** + * @return {module:echarts/scale/Time} + */ + TimeScale.create = function () { + return new TimeScale(); + }; + + module.exports = TimeScale; + + +/***/ }, +/* 110 */ +/***/ function(module, exports, __webpack_require__) { + + /** + * Log scale + * @module echarts/scale/Log + */ + + + var zrUtil = __webpack_require__(4); + var Scale = __webpack_require__(107); + var numberUtil = __webpack_require__(7); + + // Use some method of IntervalScale + var IntervalScale = __webpack_require__(108); + + var scaleProto = Scale.prototype; + var intervalScaleProto = IntervalScale.prototype; + + var getPrecisionSafe = numberUtil.getPrecisionSafe; + var roundingErrorFix = numberUtil.round; + + var mathFloor = Math.floor; + var mathCeil = Math.ceil; + var mathPow = Math.pow; + + var mathLog = Math.log; + + var LogScale = Scale.extend({ + + type: 'log', + + base: 10, + + $constructor: function () { + Scale.apply(this, arguments); + this._originalScale = new IntervalScale(); + }, + + /** + * @return {Array.} + */ + getTicks: function () { + var originalScale = this._originalScale; + var extent = this._extent; + var originalExtent = originalScale.getExtent(); + + return zrUtil.map(intervalScaleProto.getTicks.call(this), function (val) { + var powVal = numberUtil.round(mathPow(this.base, val)); + + // Fix #4158 + powVal = (val === extent[0] && originalScale.__fixMin) + ? fixRoundingError(powVal, originalExtent[0]) + : powVal; + powVal = (val === extent[1] && originalScale.__fixMax) + ? fixRoundingError(powVal, originalExtent[1]) + : powVal; + + return powVal; + }, this); + }, + + /** + * @param {number} val + * @return {string} + */ + getLabel: intervalScaleProto.getLabel, + + /** + * @param {number} val + * @return {number} + */ + scale: function (val) { + val = scaleProto.scale.call(this, val); + return mathPow(this.base, val); + }, + + /** + * @param {number} start + * @param {number} end + */ + setExtent: function (start, end) { + var base = this.base; + start = mathLog(start) / mathLog(base); + end = mathLog(end) / mathLog(base); + intervalScaleProto.setExtent.call(this, start, end); + }, + + /** + * @return {number} end + */ + getExtent: function () { + var base = this.base; + var extent = scaleProto.getExtent.call(this); + extent[0] = mathPow(base, extent[0]); + extent[1] = mathPow(base, extent[1]); + + // Fix #4158 + var originalScale = this._originalScale; + var originalExtent = originalScale.getExtent(); + originalScale.__fixMin && (extent[0] = fixRoundingError(extent[0], originalExtent[0])); + originalScale.__fixMax && (extent[1] = fixRoundingError(extent[1], originalExtent[1])); + + return extent; + }, + + /** + * @param {Array.} extent + */ + unionExtent: function (extent) { + this._originalScale.unionExtent(extent); + + var base = this.base; + extent[0] = mathLog(extent[0]) / mathLog(base); + extent[1] = mathLog(extent[1]) / mathLog(base); + scaleProto.unionExtent.call(this, extent); + }, + + /** + * @override + */ + unionExtentFromData: function (data, dim) { + this.unionExtent(data.getDataExtent(dim, true, function (val) { + return val > 0; + })); + }, + + /** + * Update interval and extent of intervals for nice ticks + * @param {number} [approxTickNum = 10] Given approx tick number + */ + niceTicks: function (approxTickNum) { + approxTickNum = approxTickNum || 10; + var extent = this._extent; + var span = extent[1] - extent[0]; + if (span === Infinity || span <= 0) { + return; + } + + var interval = numberUtil.quantity(span); + var err = approxTickNum / span * interval; + + // Filter ticks to get closer to the desired count. + if (err <= 0.5) { + interval *= 10; + } + + // Interval should be integer + while (!isNaN(interval) && Math.abs(interval) < 1 && Math.abs(interval) > 0) { + interval *= 10; + } + + var niceExtent = [ + numberUtil.round(mathCeil(extent[0] / interval) * interval), + numberUtil.round(mathFloor(extent[1] / interval) * interval) + ]; + + this._interval = interval; + this._niceExtent = niceExtent; + }, + + /** + * Nice extent. + * @param {number} [approxTickNum = 10] Given approx tick number + * @param {boolean} [fixMin=false] + * @param {boolean} [fixMax=false] + */ + niceExtent: function (splitNumber, fixMin, fixMax) { + intervalScaleProto.niceExtent.call(this, splitNumber, fixMin, fixMax); + + var originalScale = this._originalScale; + originalScale.__fixMin = fixMin; + originalScale.__fixMax = fixMax; + } + + }); + + zrUtil.each(['contain', 'normalize'], function (methodName) { + LogScale.prototype[methodName] = function (val) { + val = mathLog(val) / mathLog(this.base); + return scaleProto[methodName].call(this, val); + }; + }); + + LogScale.create = function () { + return new LogScale(); + }; + + function fixRoundingError(val, originalVal) { + return roundingErrorFix(val, getPrecisionSafe(originalVal)); + } + + module.exports = LogScale; + + +/***/ }, +/* 111 */ +/***/ function(module, exports, __webpack_require__) { + + + + var zrUtil = __webpack_require__(4); + var axisHelper = __webpack_require__(105); + + function getName(obj) { + if (zrUtil.isObject(obj) && obj.value != null) { + return obj.value; + } + else { + return obj; + } + } + + module.exports = { + + /** + * Format labels + * @return {Array.} + */ + getFormattedLabels: function () { + return axisHelper.getFormattedLabels( + this.axis, + this.get('axisLabel.formatter') + ); + }, + + /** + * Get categories + */ + getCategories: function () { + return this.get('type') === 'category' + && zrUtil.map(this.get('data'), getName); + }, + + /** + * @param {boolean} origin + * @return {number|string} min value or 'dataMin' or null/undefined (means auto) or NaN + */ + getMin: function (origin) { + var option = this.option; + var min = (!origin && option.rangeStart != null) + ? option.rangeStart : option.min; + + if (this.axis && min != null && min !== 'dataMin' && !zrUtil.eqNaN(min)) { + min = this.axis.scale.parse(min); + } + return min; + }, + + /** + * @param {boolean} origin + * @return {number|string} max value or 'dataMax' or null/undefined (means auto) or NaN + */ + getMax: function (origin) { + var option = this.option; + var max = (!origin && option.rangeEnd != null) + ? option.rangeEnd : option.max; + + if (this.axis && max != null && max !== 'dataMax' && !zrUtil.eqNaN(max)) { + max = this.axis.scale.parse(max); + } + return max; + }, + + /** + * @return {boolean} + */ + getNeedCrossZero: function () { + var option = this.option; + return (option.rangeStart != null || option.rangeEnd != null) + ? false : !option.scale; + }, + + /** + * Should be implemented by each axis model if necessary. + * @return {module:echarts/model/Component} coordinate system model + */ + getCoordSysModel: zrUtil.noop, + + /** + * @param {number} rangeStart Can only be finite number or null/undefined or NaN. + * @param {number} rangeEnd Can only be finite number or null/undefined or NaN. + */ + setRange: function (rangeStart, rangeEnd) { + this.option.rangeStart = rangeStart; + this.option.rangeEnd = rangeEnd; + }, + + /** + * Reset range + */ + resetRange: function () { + // rangeStart and rangeEnd is readonly. + this.option.rangeStart = this.option.rangeEnd = null; + } + }; + + +/***/ }, +/* 112 */ +/***/ function(module, exports, __webpack_require__) { + + + + var zrUtil = __webpack_require__(4); + var echarts = __webpack_require__(1); + var PRIORITY = echarts.PRIORITY; + + __webpack_require__(113); + __webpack_require__(114); + + echarts.registerVisual(zrUtil.curry( + __webpack_require__(119), 'line', 'circle', 'line' + )); + echarts.registerLayout(zrUtil.curry( + __webpack_require__(120), 'line' + )); + + // Down sample after filter + echarts.registerProcessor(PRIORITY.PROCESSOR.STATISTIC, zrUtil.curry( + __webpack_require__(121), 'line' + )); + + // In case developer forget to include grid component + __webpack_require__(122); + + +/***/ }, +/* 113 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + + var createListFromArray = __webpack_require__(102); + var SeriesModel = __webpack_require__(28); + + module.exports = SeriesModel.extend({ + + type: 'series.line', + + dependencies: ['grid', 'polar'], + + getInitialData: function (option, ecModel) { + if (true) { + var coordSys = option.coordinateSystem; + if (coordSys !== 'polar' && coordSys !== 'cartesian2d') { + throw new Error('Line not support coordinateSystem besides cartesian and polar'); + } + } + return createListFromArray(option.data, this, ecModel); + }, + + defaultOption: { + zlevel: 0, // 一级层叠 + z: 2, // 二级层叠 + coordinateSystem: 'cartesian2d', + legendHoverLink: true, + + hoverAnimation: true, + // stack: null + // xAxisIndex: 0, + // yAxisIndex: 0, + + // polarIndex: 0, + + // If clip the overflow value + clipOverflow: true, + + label: { + normal: { + position: 'top' + } + }, + // itemStyle: { + // normal: {}, + // emphasis: {} + // }, + lineStyle: { + normal: { + width: 2, + type: 'solid' + } + }, + // areaStyle: {}, + // false, 'start', 'end', 'middle' + step: false, + + // Disabled if step is true + smooth: false, + smoothMonotone: null, + // 拐点图形类型 + symbol: 'emptyCircle', + // 拐点图形大小 + symbolSize: 4, + // 拐点图形旋转控制 + symbolRotate: null, + + // 是否显示 symbol, 只有在 tooltip hover 的时候显示 + showSymbol: true, + // 标志图形默认只有主轴显示(随主轴标签间隔隐藏策略) + showAllSymbol: false, + + // 是否连接断点 + connectNulls: false, + + // 数据过滤,'average', 'max', 'min', 'sum' + sampling: 'none', + + animationEasing: 'linear', + + // Disable progressive + progressive: 0, + hoverLayerThreshold: Infinity + } + }); + + +/***/ }, +/* 114 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + // FIXME step not support polar + + + var zrUtil = __webpack_require__(4); + var SymbolDraw = __webpack_require__(115); + var Symbol = __webpack_require__(116); + var lineAnimationDiff = __webpack_require__(117); + var graphic = __webpack_require__(44); + var modelUtil = __webpack_require__(5); + var polyHelper = __webpack_require__(118); + var ChartView = __webpack_require__(43); + + function isPointsSame(points1, points2) { + if (points1.length !== points2.length) { + return; + } + for (var i = 0; i < points1.length; i++) { + var p1 = points1[i]; + var p2 = points2[i]; + if (p1[0] !== p2[0] || p1[1] !== p2[1]) { + return; + } + } + return true; + } + + function getSmooth(smooth) { + return typeof (smooth) === 'number' ? smooth : (smooth ? 0.3 : 0); + } + + function getAxisExtentWithGap(axis) { + var extent = axis.getGlobalExtent(); + if (axis.onBand) { + // Remove extra 1px to avoid line miter in clipped edge + var halfBandWidth = axis.getBandWidth() / 2 - 1; + var dir = extent[1] > extent[0] ? 1 : -1; + extent[0] += dir * halfBandWidth; + extent[1] -= dir * halfBandWidth; + } + return extent; + } + + function sign(val) { + return val >= 0 ? 1 : -1; + } + /** + * @param {module:echarts/coord/cartesian/Cartesian2D|module:echarts/coord/polar/Polar} coordSys + * @param {module:echarts/data/List} data + * @param {Array.>} points + * @private + */ + function getStackedOnPoints(coordSys, data) { + var baseAxis = coordSys.getBaseAxis(); + var valueAxis = coordSys.getOtherAxis(baseAxis); + var valueStart = baseAxis.onZero + ? 0 : valueAxis.scale.getExtent()[0]; + + var valueDim = valueAxis.dim; + + var baseDataOffset = valueDim === 'x' || valueDim === 'radius' ? 1 : 0; + + return data.mapArray([valueDim], function (val, idx) { + var stackedOnSameSign; + var stackedOn = data.stackedOn; + // Find first stacked value with same sign + while (stackedOn && + sign(stackedOn.get(valueDim, idx)) === sign(val) + ) { + stackedOnSameSign = stackedOn; + break; + } + var stackedData = []; + stackedData[baseDataOffset] = data.get(baseAxis.dim, idx); + stackedData[1 - baseDataOffset] = stackedOnSameSign + ? stackedOnSameSign.get(valueDim, idx, true) : valueStart; + + return coordSys.dataToPoint(stackedData); + }, true); + } + + function createGridClipShape(cartesian, hasAnimation, seriesModel) { + var xExtent = getAxisExtentWithGap(cartesian.getAxis('x')); + var yExtent = getAxisExtentWithGap(cartesian.getAxis('y')); + var isHorizontal = cartesian.getBaseAxis().isHorizontal(); + + var x = Math.min(xExtent[0], xExtent[1]); + var y = Math.min(yExtent[0], yExtent[1]); + var width = Math.max(xExtent[0], xExtent[1]) - x; var height = Math.max(yExtent[0], yExtent[1]) - y; var lineWidth = seriesModel.get('lineStyle.normal.width') || 2; // Expand clip shape to avoid clipping when line value exceeds axis @@ -23965,6 +26248,8 @@ return /******/ (function(modules) { // webpackBootstrap } } else { + // FIXME + // can not downplay completely. // Downplay whole series ChartView.prototype.downplay.call( this, seriesModel, ecModel, api, payload @@ -24137,7 +26422,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 105 */ +/* 115 */ /***/ function(module, exports, __webpack_require__) { /** @@ -24145,8 +26430,8 @@ return /******/ (function(modules) { // webpackBootstrap */ - var graphic = __webpack_require__(43); - var Symbol = __webpack_require__(106); + var graphic = __webpack_require__(44); + var Symbol = __webpack_require__(116); /** * @constructor @@ -24269,7 +26554,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 106 */ +/* 116 */ /***/ function(module, exports, __webpack_require__) { /** @@ -24278,8 +26563,8 @@ return /******/ (function(modules) { // webpackBootstrap var zrUtil = __webpack_require__(4); - var symbolUtil = __webpack_require__(107); - var graphic = __webpack_require__(43); + var symbolUtil = __webpack_require__(104); + var graphic = __webpack_require__(44); var numberUtil = __webpack_require__(7); function getSymbolSize(data, idx) { @@ -24415,6 +26700,7 @@ return /******/ (function(modules) { // webpackBootstrap } else { var symbolPath = this.childAt(0); + symbolPath.silent = false; graphic.updateProps(symbolPath, { scale: getScale(symbolSize) }, seriesModel, idx); @@ -24559,7 +26845,7 @@ return /******/ (function(modules) { // webpackBootstrap symbolProto.fadeOut = function (cb) { var symbolPath = this.childAt(0); // Avoid mistaken hover when fading out - this.silent = true; + this.silent = symbolPath.silent = true; // Not show text when animating symbolPath.style.text = ''; graphic.updateProps(symbolPath, { @@ -24573,367 +26859,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 107 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - // Symbol factory - - - var graphic = __webpack_require__(43); - var BoundingRect = __webpack_require__(9); - - /** - * Triangle shape - * @inner - */ - var Triangle = graphic.extendShape({ - type: 'triangle', - shape: { - cx: 0, - cy: 0, - width: 0, - height: 0 - }, - buildPath: function (path, shape) { - var cx = shape.cx; - var cy = shape.cy; - var width = shape.width / 2; - var height = shape.height / 2; - path.moveTo(cx, cy - height); - path.lineTo(cx + width, cy + height); - path.lineTo(cx - width, cy + height); - path.closePath(); - } - }); - /** - * Diamond shape - * @inner - */ - var Diamond = graphic.extendShape({ - type: 'diamond', - shape: { - cx: 0, - cy: 0, - width: 0, - height: 0 - }, - buildPath: function (path, shape) { - var cx = shape.cx; - var cy = shape.cy; - var width = shape.width / 2; - var height = shape.height / 2; - path.moveTo(cx, cy - height); - path.lineTo(cx + width, cy); - path.lineTo(cx, cy + height); - path.lineTo(cx - width, cy); - path.closePath(); - } - }); - - /** - * Pin shape - * @inner - */ - var Pin = graphic.extendShape({ - type: 'pin', - shape: { - // x, y on the cusp - x: 0, - y: 0, - width: 0, - height: 0 - }, - - buildPath: function (path, shape) { - var x = shape.x; - var y = shape.y; - var w = shape.width / 5 * 3; - // Height must be larger than width - var h = Math.max(w, shape.height); - var r = w / 2; - - // Dist on y with tangent point and circle center - var dy = r * r / (h - r); - var cy = y - h + r + dy; - var angle = Math.asin(dy / r); - // Dist on x with tangent point and circle center - var dx = Math.cos(angle) * r; - - var tanX = Math.sin(angle); - var tanY = Math.cos(angle); - - path.arc( - x, cy, r, - Math.PI - angle, - Math.PI * 2 + angle - ); - - var cpLen = r * 0.6; - var cpLen2 = r * 0.7; - path.bezierCurveTo( - x + dx - tanX * cpLen, cy + dy + tanY * cpLen, - x, y - cpLen2, - x, y - ); - path.bezierCurveTo( - x, y - cpLen2, - x - dx + tanX * cpLen, cy + dy + tanY * cpLen, - x - dx, cy + dy - ); - path.closePath(); - } - }); - - /** - * Arrow shape - * @inner - */ - var Arrow = graphic.extendShape({ - - type: 'arrow', - - shape: { - x: 0, - y: 0, - width: 0, - height: 0 - }, - - buildPath: function (ctx, shape) { - var height = shape.height; - var width = shape.width; - var x = shape.x; - var y = shape.y; - var dx = width / 3 * 2; - ctx.moveTo(x, y); - ctx.lineTo(x + dx, y + height); - ctx.lineTo(x, y + height / 4 * 3); - ctx.lineTo(x - dx, y + height); - ctx.lineTo(x, y); - ctx.closePath(); - } - }); - - /** - * Map of path contructors - * @type {Object.} - */ - var symbolCtors = { - line: graphic.Line, - - rect: graphic.Rect, - - roundRect: graphic.Rect, - - square: graphic.Rect, - - circle: graphic.Circle, - - diamond: Diamond, - - pin: Pin, - - arrow: Arrow, - - triangle: Triangle - }; - - var symbolShapeMakers = { - - line: function (x, y, w, h, shape) { - // FIXME - shape.x1 = x; - shape.y1 = y + h / 2; - shape.x2 = x + w; - shape.y2 = y + h / 2; - }, - - rect: function (x, y, w, h, shape) { - shape.x = x; - shape.y = y; - shape.width = w; - shape.height = h; - }, - - roundRect: function (x, y, w, h, shape) { - shape.x = x; - shape.y = y; - shape.width = w; - shape.height = h; - shape.r = Math.min(w, h) / 4; - }, - - square: function (x, y, w, h, shape) { - var size = Math.min(w, h); - shape.x = x; - shape.y = y; - shape.width = size; - shape.height = size; - }, - - circle: function (x, y, w, h, shape) { - // Put circle in the center of square - shape.cx = x + w / 2; - shape.cy = y + h / 2; - shape.r = Math.min(w, h) / 2; - }, - - diamond: function (x, y, w, h, shape) { - shape.cx = x + w / 2; - shape.cy = y + h / 2; - shape.width = w; - shape.height = h; - }, - - pin: function (x, y, w, h, shape) { - shape.x = x + w / 2; - shape.y = y + h / 2; - shape.width = w; - shape.height = h; - }, - - arrow: function (x, y, w, h, shape) { - shape.x = x + w / 2; - shape.y = y + h / 2; - shape.width = w; - shape.height = h; - }, - - triangle: function (x, y, w, h, shape) { - shape.cx = x + w / 2; - shape.cy = y + h / 2; - shape.width = w; - shape.height = h; - } - }; - - var symbolBuildProxies = {}; - for (var name in symbolCtors) { - if (symbolCtors.hasOwnProperty(name)) { - symbolBuildProxies[name] = new symbolCtors[name](); - } - } - - var Symbol = graphic.extendShape({ - - type: 'symbol', - - shape: { - symbolType: '', - x: 0, - y: 0, - width: 0, - height: 0 - }, - - beforeBrush: function () { - var style = this.style; - var shape = this.shape; - // FIXME - if (shape.symbolType === 'pin' && style.textPosition === 'inside') { - style.textPosition = ['50%', '40%']; - style.textAlign = 'center'; - style.textVerticalAlign = 'middle'; - } - }, - - buildPath: function (ctx, shape, inBundle) { - var symbolType = shape.symbolType; - var proxySymbol = symbolBuildProxies[symbolType]; - if (shape.symbolType !== 'none') { - if (!proxySymbol) { - // Default rect - symbolType = 'rect'; - proxySymbol = symbolBuildProxies[symbolType]; - } - symbolShapeMakers[symbolType]( - shape.x, shape.y, shape.width, shape.height, proxySymbol.shape - ); - proxySymbol.buildPath(ctx, proxySymbol.shape, inBundle); - } - } - }); - - // Provide setColor helper method to avoid determine if set the fill or stroke outside - var symbolPathSetColor = function (color) { - if (this.type !== 'image') { - var symbolStyle = this.style; - var symbolShape = this.shape; - if (symbolShape && symbolShape.symbolType === 'line') { - symbolStyle.stroke = color; - } - else if (this.__isEmptyBrush) { - symbolStyle.stroke = color; - symbolStyle.fill = '#fff'; - } - else { - // FIXME 判断图形默认是填充还是描边,使用 onlyStroke ? - symbolStyle.fill && (symbolStyle.fill = color); - symbolStyle.stroke && (symbolStyle.stroke = color); - } - this.dirty(false); - } - }; - - var symbolUtil = { - /** - * Create a symbol element with given symbol configuration: shape, x, y, width, height, color - * @param {string} symbolType - * @param {number} x - * @param {number} y - * @param {number} w - * @param {number} h - * @param {string} color - */ - createSymbol: function (symbolType, x, y, w, h, color) { - var isEmpty = symbolType.indexOf('empty') === 0; - if (isEmpty) { - symbolType = symbolType.substr(5, 1).toLowerCase() + symbolType.substr(6); - } - var symbolPath; - - if (symbolType.indexOf('image://') === 0) { - symbolPath = new graphic.Image({ - style: { - image: symbolType.slice(8), - x: x, - y: y, - width: w, - height: h - } - }); - } - else if (symbolType.indexOf('path://') === 0) { - symbolPath = graphic.makePath(symbolType.slice(7), {}, new BoundingRect(x, y, w, h)); - } - else { - symbolPath = new Symbol({ - shape: { - symbolType: symbolType, - x: x, - y: y, - width: w, - height: h - } - }); - } - - symbolPath.__isEmptyBrush = isEmpty; - - symbolPath.setColor = symbolPathSetColor; - - symbolPath.setColor(color); - - return symbolPath; - } - }; - - module.exports = symbolUtil; - - -/***/ }, -/* 108 */ +/* 117 */ /***/ function(module, exports) { @@ -25147,13 +27073,13 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 109 */ +/* 118 */ /***/ function(module, exports, __webpack_require__) { // Poly path support NaN point - var Path = __webpack_require__(45); + var Path = __webpack_require__(46); var vec2 = __webpack_require__(10); var vec2Min = vec2.min; @@ -25402,7 +27328,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 110 */ +/* 119 */ /***/ function(module, exports) { @@ -25451,7 +27377,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 111 */ +/* 120 */ /***/ function(module, exports) { @@ -25464,13 +27390,13 @@ return /******/ (function(modules) { // webpackBootstrap if (coordSys) { var dims = coordSys.dimensions; - if (coordSys.type === 'singleAxis') { + if (dims.length === 1) { data.each(dims[0], function (x, idx) { // Also {Array.}, not undefined to avoid if...else... statement data.setItemLayout(idx, isNaN(x) ? [NaN, NaN] : coordSys.dataToPoint(x)); }); } - else { + else if (dims.length === 2) { data.each(dims, function (x, y, idx) { // Also {Array.}, not undefined to avoid if...else... statement data.setItemLayout( @@ -25483,8 +27409,9 @@ return /******/ (function(modules) { // webpackBootstrap }; + /***/ }, -/* 112 */ +/* 121 */ /***/ function(module, exports) { @@ -25567,19 +27494,31 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 113 */ +/* 122 */ +/***/ function(module, exports, __webpack_require__) { + + + + __webpack_require__(123); + + __webpack_require__(142); + + + +/***/ }, +/* 123 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; - var graphic = __webpack_require__(43); + var graphic = __webpack_require__(44); var zrUtil = __webpack_require__(4); var echarts = __webpack_require__(1); - __webpack_require__(114); + __webpack_require__(124); - __webpack_require__(131); + __webpack_require__(133); // Grid view echarts.extendComponentView({ @@ -25611,7 +27550,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 114 */ +/* 124 */ /***/ function(module, exports, __webpack_require__) { /** @@ -25622,11 +27561,11 @@ return /******/ (function(modules) { // webpackBootstrap var factory = exports; var layout = __webpack_require__(21); - var axisHelper = __webpack_require__(115); + var axisHelper = __webpack_require__(105); var zrUtil = __webpack_require__(4); - var Cartesian2D = __webpack_require__(121); - var Axis2D = __webpack_require__(123); + var Cartesian2D = __webpack_require__(125); + var Axis2D = __webpack_require__(127); var each = zrUtil.each; @@ -25634,7 +27573,7 @@ return /******/ (function(modules) { // webpackBootstrap var niceScaleExtent = axisHelper.niceScaleExtent; // 依赖 GridModel, AxisModel 做预处理 - __webpack_require__(126); + __webpack_require__(129); /** * Check if the axis is used in the specified grid @@ -25692,13 +27631,15 @@ return /******/ (function(modules) { // webpackBootstrap this._initCartesian(gridModel, ecModel, api); - this._model = gridModel; + this.model = gridModel; } var gridProto = Grid.prototype; gridProto.type = 'grid'; + gridProto.axisPointerEnabled = true; + gridProto.getRect = function () { return this._rect; }; @@ -25707,7 +27648,7 @@ return /******/ (function(modules) { // webpackBootstrap var axesMap = this._axesMap; - this._updateScale(ecModel, this._model); + this._updateScale(ecModel, this.model); function ifAxisCanNotOnZero(otherAxisDim) { var axes = axesMap[otherAxisDim]; @@ -25723,10 +27664,10 @@ return /******/ (function(modules) { // webpackBootstrap } each(axesMap.x, function (xAxis) { - niceScaleExtent(xAxis, xAxis.model); + niceScaleExtent(xAxis.scale, xAxis.model); }); each(axesMap.y, function (yAxis) { - niceScaleExtent(yAxis, yAxis.model); + niceScaleExtent(yAxis.scale, yAxis.model); }); // Fix configuration each(axesMap.x, function (xAxis) { @@ -25745,7 +27686,7 @@ return /******/ (function(modules) { // webpackBootstrap // Resize again if containLabel is enabled // FIXME It may cause getting wrong grid size in data processing stage - this.resize(this._model, api); + this.resize(this.model, api); }; /** @@ -25819,23 +27760,47 @@ return /******/ (function(modules) { // webpackBootstrap } }; + /** + * @return {Array.} + */ + gridProto.getAxes = function () { + return this._axesList.slice(); + }; + + /** + * Usage: + * grid.getCartesian(xAxisIndex, yAxisIndex); + * grid.getCartesian(xAxisIndex); + * grid.getCartesian(null, yAxisIndex); + * grid.getCartesian({xAxisIndex: ..., yAxisIndex: ...}); + * + * @param {number|Object} [xAxisIndex] + * @param {number} [yAxisIndex] + */ gridProto.getCartesian = function (xAxisIndex, yAxisIndex) { if (xAxisIndex != null && yAxisIndex != null) { var key = 'x' + xAxisIndex + 'y' + yAxisIndex; return this._coordsMap[key]; } - else { - // When only xAxisIndex or yAxisIndex given, find its first cartesian. - for (var i = 0, coordList = this._coordsList; i < coordList.length; i++) { - if (coordList[i].getAxis('x').index === xAxisIndex - || coordList[i].getAxis('y').index === yAxisIndex - ) { - return coordList[i]; - } + + if (zrUtil.isObject(xAxisIndex)) { + yAxisIndex = xAxisIndex.yAxisIndex; + xAxisIndex = xAxisIndex.xAxisIndex; + } + // When only xAxisIndex or yAxisIndex given, find its first cartesian. + for (var i = 0, coordList = this._coordsList; i < coordList.length; i++) { + if (coordList[i].getAxis('x').index === xAxisIndex + || coordList[i].getAxis('y').index === yAxisIndex + ) { + return coordList[i]; } } }; + gridProto.getCartesians = function () { + return this._coordsList.slice(); + }; + /** * @implements * see {module:echarts/CoodinateSystem} @@ -25954,6 +27919,7 @@ return /******/ (function(modules) { // webpackBootstrap var cartesian = new Cartesian2D(key); cartesian.grid = this; + cartesian.model = gridModel; this._coordsMap[key] = cartesian; this._coordsList.push(cartesian); @@ -26069,2521 +28035,3008 @@ return /******/ (function(modules) { // webpackBootstrap }; /** - * @inner + * @param {string} [dim] 'x' or 'y' or 'auto' or null/undefined + * @return {Object} {baseAxes: [], otherAxes: []} */ - function updateAxisTransfrom(axis, coordBase) { - var axisExtent = axis.getExtent(); - var axisExtentSum = axisExtent[0] + axisExtent[1]; - - // Fast transform - axis.toGlobalCoord = axis.dim === 'x' - ? function (coord) { - return coord + coordBase; - } - : function (coord) { - return axisExtentSum - coord + coordBase; - }; - axis.toLocalCoord = axis.dim === 'x' - ? function (coord) { - return coord - coordBase; - } - : function (coord) { - return axisExtentSum - coord + coordBase; - }; - } + gridProto.getTooltipAxes = function (dim) { + var baseAxes = []; + var otherAxes = []; - var axesTypes = ['xAxis', 'yAxis']; - /** - * @inner - */ - function findAxesModels(seriesModel, ecModel) { - return zrUtil.map(axesTypes, function (axisType) { - var axisModel = seriesModel.getReferringComponents(axisType)[0]; - - if (true) { - if (!axisModel) { - throw new Error(axisType + ' "' + zrUtil.retrieve( - seriesModel.get(axisType + 'Index'), - seriesModel.get(axisType + 'Id'), - 0 - ) + '" not found'); - } - } - return axisModel; - }); - } - - /** - * @inner - */ - function isCartesian2D(seriesModel) { - return seriesModel.get('coordinateSystem') === 'cartesian2d'; - } - - Grid.create = function (ecModel, api) { - var grids = []; - ecModel.eachComponent('grid', function (gridModel, idx) { - var grid = new Grid(gridModel, ecModel, api); - grid.name = 'grid_' + idx; - grid.resize(gridModel, api); - - gridModel.coordinateSystem = grid; - - grids.push(grid); - }); - - // Inject the coordinateSystems into seriesModel - ecModel.eachSeries(function (seriesModel) { - if (!isCartesian2D(seriesModel)) { - return; - } - - var axesModels = findAxesModels(seriesModel, ecModel); - var xAxisModel = axesModels[0]; - var yAxisModel = axesModels[1]; - - var gridModel = xAxisModel.getCoordSysModel(); - - if (true) { - if (!gridModel) { - throw new Error( - 'Grid "' + zrUtil.retrieve( - xAxisModel.get('gridIndex'), - xAxisModel.get('gridId'), - 0 - ) + '" not found' - ); - } - if (xAxisModel.getCoordSysModel() !== yAxisModel.getCoordSysModel()) { - throw new Error('xAxis and yAxis must use the same grid'); - } - } - - var grid = gridModel.coordinateSystem; - - seriesModel.coordinateSystem = grid.getCartesian( - xAxisModel.componentIndex, yAxisModel.componentIndex - ); + each(this.getCartesians(), function (cartesian) { + var baseAxis = (dim != null && dim !== 'auto') + ? cartesian.getAxis(dim) : cartesian.getBaseAxis(); + var otherAxis = cartesian.getOtherAxis(baseAxis); + zrUtil.indexOf(baseAxes, baseAxis) < 0 && baseAxes.push(baseAxis); + zrUtil.indexOf(otherAxes, otherAxis) < 0 && otherAxes.push(otherAxis); }); - return grids; + return {baseAxes: baseAxes, otherAxes: otherAxes}; }; - // For deciding which dimensions to use when creating list data - Grid.dimensions = Cartesian2D.prototype.dimensions; - - __webpack_require__(26).register('cartesian2d', Grid); - - module.exports = Grid; - - -/***/ }, -/* 115 */ -/***/ function(module, exports, __webpack_require__) { - - - - var OrdinalScale = __webpack_require__(116); - var IntervalScale = __webpack_require__(118); - __webpack_require__(119); - __webpack_require__(120); - var Scale = __webpack_require__(117); - - var numberUtil = __webpack_require__(7); - var zrUtil = __webpack_require__(4); - var textContain = __webpack_require__(8); - var axisHelper = {}; - /** - * Get axis scale extent before niced. - * Item of returned array can only be number (including Infinity and NaN). + * @inner */ - axisHelper.getScaleExtent = function (axis, model) { - var scale = axis.scale; - var scaleType = scale.type; - - var min = model.getMin(); - var max = model.getMax(); - var fixMin = min != null; - var fixMax = max != null; - var originalExtent = scale.getExtent(); - - var axisDataLen; - var boundaryGap; - var span; - if (scaleType === 'ordinal') { - axisDataLen = (model.get('data') || []).length; - } - else { - boundaryGap = model.get('boundaryGap'); - if (!zrUtil.isArray(boundaryGap)) { - boundaryGap = [boundaryGap || 0, boundaryGap || 0]; - } - boundaryGap[0] = numberUtil.parsePercent(boundaryGap[0], 1); - boundaryGap[1] = numberUtil.parsePercent(boundaryGap[1], 1); - span = originalExtent[1] - originalExtent[0]; - } - - if (min == null) { - min = scaleType === 'ordinal' - ? (axisDataLen ? 0 : NaN) - : originalExtent[0] - boundaryGap[0] * span; - } - if (max == null) { - max = scaleType === 'ordinal' - ? (axisDataLen ? axisDataLen - 1 : NaN) - : originalExtent[1] + boundaryGap[1] * span; - } - - if (min === 'dataMin') { - min = originalExtent[0]; - } - if (max === 'dataMax') { - max = originalExtent[1]; - } - - (min == null || !isFinite(min)) && (min = NaN); - (max == null || !isFinite(max)) && (max = NaN); - - axis.setBlank(zrUtil.eqNaN(min) || zrUtil.eqNaN(max)); - - // Evaluate if axis needs cross zero - if (model.getNeedCrossZero()) { - // Axis is over zero and min is not set - if (min > 0 && max > 0 && !fixMin) { - min = 0; - } - // Axis is under zero and max is not set - if (min < 0 && max < 0 && !fixMax) { - max = 0; - } - } - - return [min, max]; - }; - - axisHelper.niceScaleExtent = function (axis, model) { - var scale = axis.scale; - var extent = axisHelper.getScaleExtent(axis, model); - var fixMin = model.getMin() != null; - var fixMax = model.getMax() != null; - var splitNumber = model.get('splitNumber'); - - if (scale.type === 'log') { - scale.base = model.get('logBase'); - } - - scale.setExtent(extent[0], extent[1]); - scale.niceExtent(splitNumber, fixMin, fixMax); - - // Use minInterval to constraint the calculated interval. - // If calculated interval is less than minInterval. increase the interval quantity until - // it is larger than minInterval. - // For example: - // minInterval is 1, calculated interval is 0.2, so increase it to be 1. In this way we can get - // an integer axis. - var minInterval = model.get('minInterval'); - if (isFinite(minInterval) && !fixMin && !fixMax && scale.type === 'interval') { - var interval = scale.getInterval(); - var intervalScale = Math.max(Math.abs(interval), minInterval) / interval; - // while (interval < minInterval) { - // var quantity = numberUtil.quantity(interval); - // interval = quantity * 10; - // scaleQuantity *= 10; - // } - extent = scale.getExtent(); - var origin = (extent[1] + extent[0]) / 2; - scale.setExtent( - intervalScale * (extent[0] - origin) + origin, - intervalScale * (extent[1] - origin) + origin - ); - scale.niceExtent(splitNumber); - } - - // If some one specified the min, max. And the default calculated interval - // is not good enough. He can specify the interval. It is often appeared - // in angle axis with angle 0 - 360. Interval calculated in interval scale is hard - // to be 60. - // FIXME - var interval = model.get('interval'); - if (interval != null) { - scale.setInterval && scale.setInterval(interval); - } - }; + function updateAxisTransfrom(axis, coordBase) { + var axisExtent = axis.getExtent(); + var axisExtentSum = axisExtent[0] + axisExtent[1]; - /** - * @param {module:echarts/model/Model} model - * @param {string} [axisType] Default retrieve from model.type - * @return {module:echarts/scale/*} - */ - axisHelper.createScaleByModel = function(model, axisType) { - axisType = axisType || model.get('type'); - if (axisType) { - switch (axisType) { - // Buildin scale - case 'category': - return new OrdinalScale( - model.getCategories(), [Infinity, -Infinity] - ); - case 'value': - return new IntervalScale(); - // Extended scale, like time and log - default: - return (Scale.getClass(axisType) || IntervalScale).create(model); + // Fast transform + axis.toGlobalCoord = axis.dim === 'x' + ? function (coord) { + return coord + coordBase; } - } - }; + : function (coord) { + return axisExtentSum - coord + coordBase; + }; + axis.toLocalCoord = axis.dim === 'x' + ? function (coord) { + return coord - coordBase; + } + : function (coord) { + return axisExtentSum - coord + coordBase; + }; + } + var axesTypes = ['xAxis', 'yAxis']; /** - * Check if the axis corss 0 + * @inner */ - axisHelper.ifAxisCrossZero = function (axis) { - var dataExtent = axis.scale.getExtent(); - var min = dataExtent[0]; - var max = dataExtent[1]; - return !((min > 0 && max > 0) || (min < 0 && max < 0)); - }; + function findAxesModels(seriesModel, ecModel) { + return zrUtil.map(axesTypes, function (axisType) { + var axisModel = seriesModel.getReferringComponents(axisType)[0]; + + if (true) { + if (!axisModel) { + throw new Error(axisType + ' "' + zrUtil.retrieve( + seriesModel.get(axisType + 'Index'), + seriesModel.get(axisType + 'Id'), + 0 + ) + '" not found'); + } + } + return axisModel; + }); + } /** - * @param {Array.} tickCoords In axis self coordinate. - * @param {Array.} labels - * @param {string} font - * @param {boolean} isAxisHorizontal - * @return {number} + * @inner */ - axisHelper.getAxisLabelInterval = function (tickCoords, labels, font, isAxisHorizontal) { - // FIXME - // 不同角的axis和label,不只是horizontal和vertical. + function isCartesian2D(seriesModel) { + return seriesModel.get('coordinateSystem') === 'cartesian2d'; + } - var textSpaceTakenRect; - var autoLabelInterval = 0; - var accumulatedLabelInterval = 0; + Grid.create = function (ecModel, api) { + var grids = []; + ecModel.eachComponent('grid', function (gridModel, idx) { + var grid = new Grid(gridModel, ecModel, api); + grid.name = 'grid_' + idx; + grid.resize(gridModel, api); - var step = 1; - if (labels.length > 40) { - // Simple optimization for large amount of labels - step = Math.floor(labels.length / 40); - } + gridModel.coordinateSystem = grid; - for (var i = 0; i < tickCoords.length; i += step) { - var tickCoord = tickCoords[i]; - var rect = textContain.getBoundingRect( - labels[i], font, 'center', 'top' - ); - rect[isAxisHorizontal ? 'x' : 'y'] += tickCoord; - // FIXME Magic number 1.5 - rect[isAxisHorizontal ? 'width' : 'height'] *= 1.3; - if (!textSpaceTakenRect) { - textSpaceTakenRect = rect.clone(); - } - // There is no space for current label; - else if (textSpaceTakenRect.intersect(rect)) { - accumulatedLabelInterval++; - autoLabelInterval = Math.max(autoLabelInterval, accumulatedLabelInterval); + grids.push(grid); + }); + + // Inject the coordinateSystems into seriesModel + ecModel.eachSeries(function (seriesModel) { + if (!isCartesian2D(seriesModel)) { + return; } - else { - textSpaceTakenRect.union(rect); - // Reset - accumulatedLabelInterval = 0; + + var axesModels = findAxesModels(seriesModel, ecModel); + var xAxisModel = axesModels[0]; + var yAxisModel = axesModels[1]; + + var gridModel = xAxisModel.getCoordSysModel(); + + if (true) { + if (!gridModel) { + throw new Error( + 'Grid "' + zrUtil.retrieve( + xAxisModel.get('gridIndex'), + xAxisModel.get('gridId'), + 0 + ) + '" not found' + ); + } + if (xAxisModel.getCoordSysModel() !== yAxisModel.getCoordSysModel()) { + throw new Error('xAxis and yAxis must use the same grid'); + } } - } - if (autoLabelInterval === 0 && step > 1) { - return step; - } - return (autoLabelInterval + 1) * step - 1; - }; - /** - * @param {Object} axis - * @param {Function} labelFormatter - * @return {Array.} - */ - axisHelper.getFormattedLabels = function (axis, labelFormatter) { - var scale = axis.scale; - var labels = scale.getTicksLabels(); - var ticks = scale.getTicks(); - if (typeof labelFormatter === 'string') { - labelFormatter = (function (tpl) { - return function (val) { - return tpl.replace('{value}', val != null ? val : ''); - }; - })(labelFormatter); - // Consider empty array - return zrUtil.map(labels, labelFormatter); - } - else if (typeof labelFormatter === 'function') { - return zrUtil.map(ticks, function (tick, idx) { - return labelFormatter( - axis.type === 'category' ? scale.getLabel(tick) : tick, - idx - ); - }, this); - } - else { - return labels; - } + var grid = gridModel.coordinateSystem; + + seriesModel.coordinateSystem = grid.getCartesian( + xAxisModel.componentIndex, yAxisModel.componentIndex + ); + }); + + return grids; }; - module.exports = axisHelper; + // For deciding which dimensions to use when creating list data + Grid.dimensions = Grid.prototype.dimensions = Cartesian2D.prototype.dimensions; + + __webpack_require__(26).register('cartesian2d', Grid); + + module.exports = Grid; /***/ }, -/* 116 */ +/* 125 */ /***/ function(module, exports, __webpack_require__) { - /** - * Linear continuous scale - * @module echarts/coord/scale/Ordinal - * - * http://en.wikipedia.org/wiki/Level_of_measurement - */ - - // FIXME only one data + 'use strict'; var zrUtil = __webpack_require__(4); - var Scale = __webpack_require__(117); + var Cartesian = __webpack_require__(126); - var scaleProto = Scale.prototype; + function Cartesian2D(name) { - var OrdinalScale = Scale.extend({ + Cartesian.call(this, name); + } - type: 'ordinal', + Cartesian2D.prototype = { - init: function (data, extent) { - this._data = data; - this._extent = extent || [0, data.length - 1]; - }, + constructor: Cartesian2D, - parse: function (val) { - return typeof val === 'string' - ? zrUtil.indexOf(this._data, val) - // val might be float. - : Math.round(val); - }, + type: 'cartesian2d', - contain: function (rank) { - rank = this.parse(rank); - return scaleProto.contain.call(this, rank) - && this._data[rank] != null; - }, + /** + * @type {Array.} + * @readOnly + */ + dimensions: ['x', 'y'], /** - * Normalize given rank or name to linear [0, 1] - * @param {number|string} [val] - * @return {number} + * Base axis will be used on stacking. + * + * @return {module:echarts/coord/cartesian/Axis2D} */ - normalize: function (val) { - return scaleProto.normalize.call(this, this.parse(val)); + getBaseAxis: function () { + return this.getAxesByScale('ordinal')[0] + || this.getAxesByScale('time')[0] + || this.getAxis('x'); }, - scale: function (val) { - return Math.round(scaleProto.scale.call(this, val)); + /** + * If contain point + * @param {Array.} point + * @return {boolean} + */ + containPoint: function (point) { + var axisX = this.getAxis('x'); + var axisY = this.getAxis('y'); + return axisX.contain(axisX.toLocalCoord(point[0])) + && axisY.contain(axisY.toLocalCoord(point[1])); }, /** - * @return {Array} + * If contain data + * @param {Array.} data + * @return {boolean} */ - getTicks: function () { - var ticks = []; - var extent = this._extent; - var rank = extent[0]; - - while (rank <= extent[1]) { - ticks.push(rank); - rank++; - } - - return ticks; + containData: function (data) { + return this.getAxis('x').containData(data[0]) + && this.getAxis('y').containData(data[1]); }, /** - * Get item on rank n - * @param {number} n - * @return {string} + * Convert series data to an array of points + * @param {module:echarts/data/List} data + * @param {boolean} stack + * @return {Array} + * Return array of points. For example: + * `[[10, 10], [20, 20], [30, 30]]` */ - getLabel: function (n) { - return this._data[n]; + dataToPoints: function (data, stack) { + return data.mapArray(['x', 'y'], function (x, y) { + return this.dataToPoint([x, y]); + }, stack, this); }, /** - * @return {number} + * @param {Array.} data + * @param {boolean} [clamp=false] + * @return {Array.} */ - count: function () { - return this._extent[1] - this._extent[0] + 1; + dataToPoint: function (data, clamp) { + var xAxis = this.getAxis('x'); + var yAxis = this.getAxis('y'); + return [ + xAxis.toGlobalCoord(xAxis.dataToCoord(data[0], clamp)), + yAxis.toGlobalCoord(yAxis.dataToCoord(data[1], clamp)) + ]; }, /** - * @override + * @param {Array.} point + * @param {boolean} [clamp=false] + * @return {Array.} */ - unionExtentFromData: function (data, dim) { - this.unionExtent(data.getDataExtent(dim, false)); + pointToData: function (point, clamp) { + var xAxis = this.getAxis('x'); + var yAxis = this.getAxis('y'); + return [ + xAxis.coordToData(xAxis.toLocalCoord(point[0]), clamp), + yAxis.coordToData(yAxis.toLocalCoord(point[1]), clamp) + ]; }, - niceTicks: zrUtil.noop, - niceExtent: zrUtil.noop - }); - - /** - * @return {module:echarts/scale/Time} - */ - OrdinalScale.create = function () { - return new OrdinalScale(); + /** + * Get other axis + * @param {module:echarts/coord/cartesian/Axis2D} axis + */ + getOtherAxis: function (axis) { + return this.getAxis(axis.dim === 'x' ? 'y' : 'x'); + } }; - module.exports = OrdinalScale; + zrUtil.inherits(Cartesian2D, Cartesian); + + module.exports = Cartesian2D; /***/ }, -/* 117 */ +/* 126 */ /***/ function(module, exports, __webpack_require__) { + 'use strict'; /** - * // Scale class management - * @module echarts/scale/Scale + * Cartesian coordinate system + * @module echarts/coord/Cartesian + * */ - var clazzUtil = __webpack_require__(13); + var zrUtil = __webpack_require__(4); + + function dimAxisMapper(dim) { + return this._axes[dim]; + } + + /** + * @alias module:echarts/coord/Cartesian + * @constructor + */ + var Cartesian = function (name) { + this._axes = {}; + + this._dimList = []; - function Scale() { /** - * Extent - * @type {Array.} - * @protected + * @type {string} */ - this._extent = [Infinity, -Infinity]; + this.name = name || ''; + }; + + Cartesian.prototype = { + + constructor: Cartesian, + + type: 'cartesian', /** - * Step is calculated in adjustExtent - * @type {Array.} - * @protected + * Get axis + * @param {number|string} dim + * @return {module:echarts/coord/Cartesian~Axis} */ - this._interval = 0; + getAxis: function (dim) { + return this._axes[dim]; + }, - this.init && this.init.apply(this, arguments); - } + /** + * Get axes list + * @return {Array.} + */ + getAxes: function () { + return zrUtil.map(this._dimList, dimAxisMapper, this); + }, - var scaleProto = Scale.prototype; + /** + * Get axes list by given scale type + */ + getAxesByScale: function (scaleType) { + scaleType = scaleType.toLowerCase(); + return zrUtil.filter( + this.getAxes(), + function (axis) { + return axis.scale.type === scaleType; + } + ); + }, - /** - * Parse input val to valid inner number. - * @param {*} val - * @return {number} - */ - scaleProto.parse = function (val) { - // Notice: This would be a trap here, If the implementation - // of this method depends on extent, and this method is used - // before extent set (like in dataZoom), it would be wrong. - // Nevertheless, parse does not depend on extent generally. - return val; - }; + /** + * Add axis + * @param {module:echarts/coord/Cartesian.Axis} + */ + addAxis: function (axis) { + var dim = axis.dim; - scaleProto.contain = function (val) { - var extent = this._extent; - return val >= extent[0] && val <= extent[1]; - }; + this._axes[dim] = axis; - /** - * Normalize value to linear [0, 1], return 0.5 if extent span is 0 - * @param {number} val - * @return {number} - */ - scaleProto.normalize = function (val) { - var extent = this._extent; - if (extent[1] === extent[0]) { - return 0.5; - } - return (val - extent[0]) / (extent[1] - extent[0]); - }; + this._dimList.push(dim); + }, - /** - * Scale normalized value - * @param {number} val - * @return {number} - */ - scaleProto.scale = function (val) { - var extent = this._extent; - return val * (extent[1] - extent[0]) + extent[0]; - }; + /** + * Convert data to coord in nd space + * @param {Array.|Object.} val + * @return {Array.|Object.} + */ + dataToCoord: function (val) { + return this._dataCoordConvert(val, 'dataToCoord'); + }, - /** - * Set extent from data - * @param {Array.} other - */ - scaleProto.unionExtent = function (other) { - var extent = this._extent; - other[0] < extent[0] && (extent[0] = other[0]); - other[1] > extent[1] && (extent[1] = other[1]); - // not setExtent because in log axis it may transformed to power - // this.setExtent(extent[0], extent[1]); - }; + /** + * Convert coord in nd space to data + * @param {Array.|Object.} val + * @return {Array.|Object.} + */ + coordToData: function (val) { + return this._dataCoordConvert(val, 'coordToData'); + }, - /** - * Set extent from data - * @param {module:echarts/data/List} data - * @param {string} dim - */ - scaleProto.unionExtentFromData = function (data, dim) { - this.unionExtent(data.getDataExtent(dim, true)); - }; + _dataCoordConvert: function (input, method) { + var dimList = this._dimList; - /** - * Get extent - * @return {Array.} - */ - scaleProto.getExtent = function () { - return this._extent.slice(); - }; + var output = input instanceof Array ? [] : {}; - /** - * Set extent - * @param {number} start - * @param {number} end - */ - scaleProto.setExtent = function (start, end) { - var thisExtent = this._extent; - if (!isNaN(start)) { - thisExtent[0] = start; - } - if (!isNaN(end)) { - thisExtent[1] = end; - } - }; + for (var i = 0; i < dimList.length; i++) { + var dim = dimList[i]; + var axis = this._axes[dim]; - /** - * @return {Array.} - */ - scaleProto.getTicksLabels = function () { - var labels = []; - var ticks = this.getTicks(); - for (var i = 0; i < ticks.length; i++) { - labels.push(this.getLabel(ticks[i])); + output[dim] = axis[method](input[dim]); + } + + return output; } - return labels; }; - clazzUtil.enableClassExtend(Scale); - clazzUtil.enableClassManagement(Scale, { - registerWhenExtend: true - }); - - module.exports = Scale; + module.exports = Cartesian; /***/ }, -/* 118 */ +/* 127 */ /***/ function(module, exports, __webpack_require__) { - /** - * Interval scale - * @module echarts/scale/Interval - */ - - - - var numberUtil = __webpack_require__(7); - var formatUtil = __webpack_require__(6); - var Scale = __webpack_require__(117); - - var mathFloor = Math.floor; - var mathCeil = Math.ceil; + + + var zrUtil = __webpack_require__(4); + var Axis = __webpack_require__(100); + var axisLabelInterval = __webpack_require__(128); - var getPrecisionSafe = numberUtil.getPrecisionSafe; - var roundingErrorFix = numberUtil.round; /** - * @alias module:echarts/coord/scale/Interval - * @constructor + * Extend axis 2d + * @constructor module:echarts/coord/cartesian/Axis2D + * @extends {module:echarts/coord/cartesian/Axis} + * @param {string} dim + * @param {*} scale + * @param {Array.} coordExtent + * @param {string} axisType + * @param {string} position */ - var IntervalScale = Scale.extend({ - - type: 'interval', + var Axis2D = function (dim, scale, coordExtent, axisType, position) { + Axis.call(this, dim, scale, coordExtent); + /** + * Axis type + * - 'category' + * - 'value' + * - 'time' + * - 'log' + * @type {string} + */ + this.type = axisType || 'value'; - _interval: 0, + /** + * Axis position + * - 'top' + * - 'bottom' + * - 'left' + * - 'right' + */ + this.position = position || 'bottom'; + }; - setExtent: function (start, end) { - var thisExtent = this._extent; - //start,end may be a Number like '25',so... - if (!isNaN(start)) { - thisExtent[0] = parseFloat(start); - } - if (!isNaN(end)) { - thisExtent[1] = parseFloat(end); - } - }, + Axis2D.prototype = { - unionExtent: function (other) { - var extent = this._extent; - other[0] < extent[0] && (extent[0] = other[0]); - other[1] > extent[1] && (extent[1] = other[1]); + constructor: Axis2D, - // unionExtent may called by it's sub classes - IntervalScale.prototype.setExtent.call(this, extent[0], extent[1]); - }, /** - * Get interval + * Index of axis, can be used as key */ - getInterval: function () { - if (!this._interval) { - this.niceTicks(); - } - return this._interval; - }, + index: 0, + /** + * If axis is on the zero position of the other axis + * @type {boolean} + */ + onZero: false, /** - * Set interval + * Axis model + * @param {module:echarts/coord/cartesian/AxisModel} */ - setInterval: function (interval) { - this._interval = interval; - // Dropped auto calculated niceExtent and use user setted extent - // We assume user wan't to set both interval, min, max to get a better result - this._niceExtent = this._extent.slice(); + model: null, + + isHorizontal: function () { + var position = this.position; + return position === 'top' || position === 'bottom'; }, /** + * Each item cooresponds to this.getExtent(), which + * means globalExtent[0] may greater than globalExtent[1], + * unless `asc` is input. + * + * @param {boolean} [asc] * @return {Array.} */ - getTicks: function () { - if (!this._interval) { - this.niceTicks(); - } - var interval = this._interval; - var extent = this._extent; - var ticks = []; - - // Consider this case: using dataZoom toolbox, zoom and zoom. - var safeLimit = 10000; - - if (interval) { - var niceExtent = this._niceExtent; - var precision = getPrecisionSafe(interval) + 2; - - if (extent[0] < niceExtent[0]) { - ticks.push(extent[0]); - } - var tick = niceExtent[0]; - - while (tick <= niceExtent[1]) { - ticks.push(tick); - // Avoid rounding error - tick = roundingErrorFix(tick + interval, precision); - if (ticks.length > safeLimit) { - return []; - } - } - // Consider this case: the last item of ticks is smaller - // than niceExtent[1] and niceExtent[1] === extent[1]. - if (extent[1] > (ticks.length ? ticks[ticks.length - 1] : niceExtent[1])) { - ticks.push(extent[1]); - } - } + getGlobalExtent: function (asc) { + var ret = this.getExtent(); + ret[0] = this.toGlobalCoord(ret[0]); + ret[1] = this.toGlobalCoord(ret[1]); + asc && ret[0] > ret[1] && ret.reverse(); + return ret; + }, - return ticks; + getOtherAxis: function () { + this.grid.getOtherAxis(); }, /** - * @return {Array.} + * @return {number} */ - getTicksLabels: function () { - var labels = []; - var ticks = this.getTicks(); - for (var i = 0; i < ticks.length; i++) { - labels.push(this.getLabel(ticks[i])); + getLabelInterval: function () { + var labelInterval = this._labelInterval; + if (!labelInterval) { + labelInterval = this._labelInterval = axisLabelInterval(this); } - return labels; + return labelInterval; }, /** - * @param {number} n - * @return {number} + * If label is ignored. + * Automatically used when axis is category and label can not be all shown + * @param {number} idx + * @return {boolean} */ - getLabel: function (data) { - return formatUtil.addCommas(data); + isLabelIgnored: function (idx) { + if (this.type === 'category') { + var labelInterval = this.getLabelInterval(); + return ((typeof labelInterval === 'function') + && !labelInterval(idx, this.scale.getLabel(idx))) + || idx % (labelInterval + 1); + } }, /** - * Update interval and extent of intervals for nice ticks - * - * @param {number} [splitNumber = 5] Desired number of ticks + * @override */ - niceTicks: function (splitNumber) { - splitNumber = splitNumber || 5; - var extent = this._extent; - var span = extent[1] - extent[0]; - if (!isFinite(span)) { - return; - } - // User may set axis min 0 and data are all negative - // FIXME If it needs to reverse ? - if (span < 0) { - span = -span; - extent.reverse(); - } - - // From "Nice Numbers for Graph Labels" of Graphic Gems - // var niceSpan = numberUtil.nice(span, false); - var step = roundingErrorFix( - numberUtil.nice(span / splitNumber, true), - Math.max( - getPrecisionSafe(extent[0]), - getPrecisionSafe(extent[1]) - // extent may be [0, 1], and step should have 1 more digits. - // To make it safe we add 2 more digits - ) + 2 - ); - - var precision = getPrecisionSafe(step) + 2; - // Niced extent inside original extent - var niceExtent = [ - roundingErrorFix(mathCeil(extent[0] / step) * step, precision), - roundingErrorFix(mathFloor(extent[1] / step) * step, precision) - ]; - - this._interval = step; - this._niceExtent = niceExtent; + pointToData: function (point, clamp) { + return this.coordToData(this.toLocalCoord(point[this.dim === 'x' ? 0 : 1]), clamp); }, /** - * Nice extent. - * @param {number} [splitNumber = 5] Given approx tick number - * @param {boolean} [fixMin=false] - * @param {boolean} [fixMax=false] + * Transform global coord to local coord, + * i.e. var localCoord = axis.toLocalCoord(80); + * designate by module:echarts/coord/cartesian/Grid. + * @type {Function} */ - niceExtent: function (splitNumber, fixMin, fixMax) { - var extent = this._extent; - // If extent start and end are same, expand them - if (extent[0] === extent[1]) { - if (extent[0] !== 0) { - // Expand extent - var expandSize = extent[0]; - // In the fowllowing case - // Axis has been fixed max 100 - // Plus data are all 100 and axis extent are [100, 100]. - // Extend to the both side will cause expanded max is larger than fixed max. - // So only expand to the smaller side. - if (!fixMax) { - extent[1] += expandSize / 2; - extent[0] -= expandSize / 2; - } - else { - extent[0] -= expandSize / 2; - } - } - else { - extent[1] = 1; - } - } - var span = extent[1] - extent[0]; - // If there are no data and extent are [Infinity, -Infinity] - if (!isFinite(span)) { - extent[0] = 0; - extent[1] = 1; - } - - this.niceTicks(splitNumber); - - // var extent = this._extent; - var interval = this._interval; + toLocalCoord: null, - if (!fixMin) { - extent[0] = roundingErrorFix(mathFloor(extent[0] / interval) * interval); - } - if (!fixMax) { - extent[1] = roundingErrorFix(mathCeil(extent[1] / interval) * interval); - } - } - }); + /** + * Transform global coord to local coord, + * i.e. var globalCoord = axis.toLocalCoord(40); + * designate by module:echarts/coord/cartesian/Grid. + * @type {Function} + */ + toGlobalCoord: null - /** - * @return {module:echarts/scale/Time} - */ - IntervalScale.create = function () { - return new IntervalScale(); }; + zrUtil.inherits(Axis2D, Axis); - module.exports = IntervalScale; - + module.exports = Axis2D; /***/ }, -/* 119 */ +/* 128 */ /***/ function(module, exports, __webpack_require__) { + 'use strict'; /** - * Interval scale - * @module echarts/coord/scale/Time + * Helper function for axisLabelInterval calculation */ var zrUtil = __webpack_require__(4); - var numberUtil = __webpack_require__(7); - var formatUtil = __webpack_require__(6); + var axisHelper = __webpack_require__(105); - var IntervalScale = __webpack_require__(118); + module.exports = function (axis) { + var axisModel = axis.model; + var labelModel = axisModel.getModel('axisLabel'); + var labelInterval = labelModel.get('interval'); + if (!(axis.type === 'category' && labelInterval === 'auto')) { + return labelInterval === 'auto' ? 0 : labelInterval; + } - var intervalScaleProto = IntervalScale.prototype; + return axisHelper.getAxisLabelInterval( + zrUtil.map(axis.scale.getTicks(), axis.dataToCoord, axis), + axisModel.getFormattedLabels(), + labelModel.getModel('textStyle').getFont(), + axis.isHorizontal() + ); + }; - var mathCeil = Math.ceil; - var mathFloor = Math.floor; - var ONE_SECOND = 1000; - var ONE_MINUTE = ONE_SECOND * 60; - var ONE_HOUR = ONE_MINUTE * 60; - var ONE_DAY = ONE_HOUR * 24; - // FIXME 公用? - var bisect = function (a, x, lo, hi) { - while (lo < hi) { - var mid = lo + hi >>> 1; - if (a[mid][2] < x) { - lo = mid + 1; - } - else { - hi = mid; - } - } - return lo; - }; +/***/ }, +/* 129 */ +/***/ function(module, exports, __webpack_require__) { - /** - * @alias module:echarts/coord/scale/Time - * @constructor - */ - var TimeScale = IntervalScale.extend({ - type: 'time', + 'use strict'; + // Grid 是在有直角坐标系的时候必须要存在的 + // 所以这里也要被 Cartesian2D 依赖 - // Overwrite - getLabel: function (val) { - var stepLvl = this._stepLvl; - var date = new Date(val); + __webpack_require__(130); - return formatUtil.formatTime(stepLvl[0], date); - }, + var ComponentModel = __webpack_require__(19); - // Overwrite - niceExtent: function (approxTickNum, fixMin, fixMax) { - var extent = this._extent; - // If extent start and end are same, expand them - if (extent[0] === extent[1]) { - // Expand extent - extent[0] -= ONE_DAY; - extent[1] += ONE_DAY; - } - // If there are no data and extent are [Infinity, -Infinity] - if (extent[1] === -Infinity && extent[0] === Infinity) { - var d = new Date(); - extent[1] = new Date(d.getFullYear(), d.getMonth(), d.getDate()); - extent[0] = extent[1] - ONE_DAY; - } + module.exports = ComponentModel.extend({ - this.niceTicks(approxTickNum); + type: 'grid', - // var extent = this._extent; - var interval = this._interval; + dependencies: ['xAxis', 'yAxis'], - if (!fixMin) { - extent[0] = numberUtil.round(mathFloor(extent[0] / interval) * interval); - } - if (!fixMax) { - extent[1] = numberUtil.round(mathCeil(extent[1] / interval) * interval); - } - }, + layoutMode: 'box', - // Overwrite - niceTicks: function (approxTickNum) { - approxTickNum = approxTickNum || 10; + /** + * @type {module:echarts/coord/cartesian/Grid} + */ + coordinateSystem: null, - var extent = this._extent; - var span = extent[1] - extent[0]; - var approxInterval = span / approxTickNum; - var scaleLevelsLen = scaleLevels.length; - var idx = bisect(scaleLevels, approxInterval, 0, scaleLevelsLen); + defaultOption: { + show: false, + zlevel: 0, + z: 0, + left: '10%', + top: 60, + right: '10%', + bottom: 60, + // If grid size contain label + containLabel: false, + // width: {totalWidth} - left - right, + // height: {totalHeight} - top - bottom, + backgroundColor: 'rgba(0,0,0,0)', + borderWidth: 1, + borderColor: '#ccc' + } + }); - var level = scaleLevels[Math.min(idx, scaleLevelsLen - 1)]; - var interval = level[2]; - // Same with interval scale if span is much larger than 1 year - if (level[0] === 'year') { - var yearSpan = span / interval; - // From "Nice Numbers for Graph Labels" of Graphic Gems - // var niceYearSpan = numberUtil.nice(yearSpan, false); - var yearStep = numberUtil.nice(yearSpan / approxTickNum, true); +/***/ }, +/* 130 */ +/***/ function(module, exports, __webpack_require__) { - interval *= yearStep; - } + 'use strict'; - var niceExtent = [ - mathCeil(extent[0] / interval) * interval, - mathFloor(extent[1] / interval) * interval - ]; - this._stepLvl = level; - // Interval will be used in getTicks - this._interval = interval; - this._niceExtent = niceExtent; + var ComponentModel = __webpack_require__(19); + var zrUtil = __webpack_require__(4); + var axisModelCreator = __webpack_require__(131); + + var AxisModel = ComponentModel.extend({ + + type: 'cartesian2dAxis', + + /** + * @type {module:echarts/coord/cartesian/Axis2D} + */ + axis: null, + + /** + * @override + */ + init: function () { + AxisModel.superApply(this, 'init', arguments); + this.resetRange(); }, - parse: function (val) { - // val might be float. - return +numberUtil.parseDate(val); + /** + * @override + */ + mergeOption: function () { + AxisModel.superApply(this, 'mergeOption', arguments); + this.resetRange(); + }, + + /** + * @override + */ + restoreData: function () { + AxisModel.superApply(this, 'restoreData', arguments); + this.resetRange(); + }, + + /** + * @override + * @return {module:echarts/model/Component} + */ + getCoordSysModel: function () { + return this.ecModel.queryComponents({ + mainType: 'grid', + index: this.option.gridIndex, + id: this.option.gridId + })[0]; } - }); - zrUtil.each(['contain', 'normalize'], function (methodName) { - TimeScale.prototype[methodName] = function (val) { - return intervalScaleProto[methodName].call(this, this.parse(val)); - }; }); - // Steps from d3 - var scaleLevels = [ - // Format step interval - ['hh:mm:ss', 1, ONE_SECOND], // 1s - ['hh:mm:ss', 5, ONE_SECOND * 5], // 5s - ['hh:mm:ss', 10, ONE_SECOND * 10], // 10s - ['hh:mm:ss', 15, ONE_SECOND * 15], // 15s - ['hh:mm:ss', 30, ONE_SECOND * 30], // 30s - ['hh:mm\nMM-dd',1, ONE_MINUTE], // 1m - ['hh:mm\nMM-dd',5, ONE_MINUTE * 5], // 5m - ['hh:mm\nMM-dd',10, ONE_MINUTE * 10], // 10m - ['hh:mm\nMM-dd',15, ONE_MINUTE * 15], // 15m - ['hh:mm\nMM-dd',30, ONE_MINUTE * 30], // 30m - ['hh:mm\nMM-dd',1, ONE_HOUR], // 1h - ['hh:mm\nMM-dd',2, ONE_HOUR * 2], // 2h - ['hh:mm\nMM-dd',6, ONE_HOUR * 6], // 6h - ['hh:mm\nMM-dd',12, ONE_HOUR * 12], // 12h - ['MM-dd\nyyyy', 1, ONE_DAY], // 1d - ['week', 7, ONE_DAY * 7], // 7d - ['month', 1, ONE_DAY * 31], // 1M - ['quarter', 3, ONE_DAY * 380 / 4], // 3M - ['half-year', 6, ONE_DAY * 380 / 2], // 6M - ['year', 1, ONE_DAY * 380] // 1Y - ]; + function getAxisType(axisDim, option) { + // Default axis with data is category axis + return option.type || (option.data ? 'category' : 'value'); + } - /** - * @return {module:echarts/scale/Time} - */ - TimeScale.create = function () { - return new TimeScale(); + zrUtil.merge(AxisModel.prototype, __webpack_require__(111)); + + var extraOption = { + // gridIndex: 0, + // gridId: '', + + // Offset is for multiple axis on the same position + offset: 0 }; - module.exports = TimeScale; + axisModelCreator('x', AxisModel, getAxisType, extraOption); + axisModelCreator('y', AxisModel, getAxisType, extraOption); + + module.exports = AxisModel; /***/ }, -/* 120 */ +/* 131 */ /***/ function(module, exports, __webpack_require__) { - /** - * Log scale - * @module echarts/scale/Log - */ - + + var axisDefault = __webpack_require__(132); var zrUtil = __webpack_require__(4); - var Scale = __webpack_require__(117); - var numberUtil = __webpack_require__(7); + var ComponentModel = __webpack_require__(19); + var layout = __webpack_require__(21); + + // FIXME axisType is fixed ? + var AXIS_TYPES = ['value', 'category', 'time', 'log']; - // Use some method of IntervalScale - var IntervalScale = __webpack_require__(118); + /** + * Generate sub axis model class + * @param {string} axisName 'x' 'y' 'radius' 'angle' 'parallel' + * @param {module:echarts/model/Component} BaseAxisModelClass + * @param {Function} axisTypeDefaulter + * @param {Object} [extraDefaultOption] + */ + module.exports = function (axisName, BaseAxisModelClass, axisTypeDefaulter, extraDefaultOption) { - var scaleProto = Scale.prototype; - var intervalScaleProto = IntervalScale.prototype; + zrUtil.each(AXIS_TYPES, function (axisType) { - var getPrecisionSafe = numberUtil.getPrecisionSafe; - var roundingErrorFix = numberUtil.round; + BaseAxisModelClass.extend({ - var mathFloor = Math.floor; - var mathCeil = Math.ceil; - var mathPow = Math.pow; + type: axisName + 'Axis.' + axisType, - var mathLog = Math.log; + mergeDefaultAndTheme: function (option, ecModel) { + var layoutMode = this.layoutMode; + var inputPositionParams = layoutMode + ? layout.getLayoutParams(option) : {}; - var LogScale = Scale.extend({ + var themeModel = ecModel.getTheme(); + zrUtil.merge(option, themeModel.get(axisType + 'Axis')); + zrUtil.merge(option, this.getDefaultOption()); - type: 'log', + option.type = axisTypeDefaulter(axisName, option); - base: 10, + if (layoutMode) { + layout.mergeLayoutParam(option, inputPositionParams, layoutMode); + } + }, - $constructor: function () { - Scale.apply(this, arguments); - this._originalScale = new IntervalScale(); - }, + defaultOption: zrUtil.mergeAll( + [ + {}, + axisDefault[axisType + 'Axis'], + extraDefaultOption + ], + true + ) + }); + }); - /** - * @return {Array.} - */ - getTicks: function () { - var originalScale = this._originalScale; - var extent = this._extent; - var originalExtent = originalScale.getExtent(); + ComponentModel.registerSubTypeDefaulter( + axisName + 'Axis', + zrUtil.curry(axisTypeDefaulter, axisName) + ); + }; - return zrUtil.map(intervalScaleProto.getTicks.call(this), function (val) { - var powVal = numberUtil.round(mathPow(this.base, val)); - // Fix #4158 - powVal = (val === extent[0] && originalScale.__fixMin) - ? fixRoundingError(powVal, originalExtent[0]) - : powVal; - powVal = (val === extent[1] && originalScale.__fixMax) - ? fixRoundingError(powVal, originalExtent[1]) - : powVal; +/***/ }, +/* 132 */ +/***/ function(module, exports, __webpack_require__) { - return powVal; - }, this); - }, + - /** - * @param {number} val - * @return {string} - */ - getLabel: intervalScaleProto.getLabel, + var zrUtil = __webpack_require__(4); - /** - * @param {number} val - * @return {number} - */ - scale: function (val) { - val = scaleProto.scale.call(this, val); - return mathPow(this.base, val); - }, + var defaultOption = { + show: true, + zlevel: 0, // 一级层叠 + z: 0, // 二级层叠 + // 反向坐标轴 + inverse: false, - /** - * @param {number} start - * @param {number} end - */ - setExtent: function (start, end) { - var base = this.base; - start = mathLog(start) / mathLog(base); - end = mathLog(end) / mathLog(base); - intervalScaleProto.setExtent.call(this, start, end); + // 坐标轴名字,默认为空 + name: '', + // 坐标轴名字位置,支持'start' | 'middle' | 'end' + nameLocation: 'end', + // 坐标轴名字旋转,degree。 + nameRotate: null, // Adapt to axis rotate, when nameLocation is 'middle'. + nameTruncate: { + maxWidth: null, + ellipsis: '...', + placeholder: '.' }, + // 坐标轴文字样式,默认取全局样式 + nameTextStyle: {}, + // 文字与轴线距离 + nameGap: 15, - /** - * @return {number} end - */ - getExtent: function () { - var base = this.base; - var extent = scaleProto.getExtent.call(this); - extent[0] = mathPow(base, extent[0]); - extent[1] = mathPow(base, extent[1]); - - // Fix #4158 - var originalScale = this._originalScale; - var originalExtent = originalScale.getExtent(); - originalScale.__fixMin && (extent[0] = fixRoundingError(extent[0], originalExtent[0])); - originalScale.__fixMax && (extent[1] = fixRoundingError(extent[1], originalExtent[1])); + silent: false, // Default false to support tooltip. + triggerEvent: false, // Default false to avoid legacy user event listener fail. - return extent; + tooltip: { + show: false }, - /** - * @param {Array.} extent - */ - unionExtent: function (extent) { - this._originalScale.unionExtent(extent); + axisPointer: {}, - var base = this.base; - extent[0] = mathLog(extent[0]) / mathLog(base); - extent[1] = mathLog(extent[1]) / mathLog(base); - scaleProto.unionExtent.call(this, extent); + // 坐标轴线 + axisLine: { + // 默认显示,属性show控制显示与否 + show: true, + onZero: true, + // 属性lineStyle控制线条样式 + lineStyle: { + color: '#333', + width: 1, + type: 'solid' + } }, - - /** - * @override - */ - unionExtentFromData: function (data, dim) { - this.unionExtent(data.getDataExtent(dim, true, function (val) { - return val > 0; - })); + // 坐标轴小标记 + axisTick: { + // 属性show控制显示与否,默认显示 + show: true, + // 控制小标记是否在grid里 + inside: false, + // 属性length控制线长 + length: 5, + // 属性lineStyle控制线条样式 + lineStyle: { + width: 1 + } }, - - /** - * Update interval and extent of intervals for nice ticks - * @param {number} [approxTickNum = 10] Given approx tick number - */ - niceTicks: function (approxTickNum) { - approxTickNum = approxTickNum || 10; - var extent = this._extent; - var span = extent[1] - extent[0]; - if (span === Infinity || span <= 0) { - return; + // 坐标轴文本标签,详见axis.axisLabel + axisLabel: { + show: true, + // 控制文本标签是否在grid里 + inside: false, + rotate: 0, + margin: 8, + // formatter: null, + // 其余属性默认使用全局文本样式,详见TEXTSTYLE + textStyle: { + fontSize: 12 } - - var interval = numberUtil.quantity(span); - var err = approxTickNum / span * interval; - - // Filter ticks to get closer to the desired count. - if (err <= 0.5) { - interval *= 10; + }, + // 分隔线 + splitLine: { + // 默认显示,属性show控制显示与否 + show: true, + // 属性lineStyle(详见lineStyle)控制线条样式 + lineStyle: { + color: ['#ccc'], + width: 1, + type: 'solid' } - - // Interval should be integer - while (!isNaN(interval) && Math.abs(interval) < 1 && Math.abs(interval) > 0) { - interval *= 10; + }, + // 分隔区域 + splitArea: { + // 默认不显示,属性show控制显示与否 + show: false, + // 属性areaStyle(详见areaStyle)控制区域样式 + areaStyle: { + color: ['rgba(250,250,250,0.3)','rgba(200,200,200,0.3)'] } + } + }; - var niceExtent = [ - numberUtil.round(mathCeil(extent[0] / interval) * interval), - numberUtil.round(mathFloor(extent[1] / interval) * interval) - ]; - - this._interval = interval; - this._niceExtent = niceExtent; + var categoryAxis = zrUtil.merge({ + // 类目起始和结束两端空白策略 + boundaryGap: true, + // splitArea: { + // show: false + // }, + splitLine: { + show: false }, - - /** - * Nice extent. - * @param {number} [approxTickNum = 10] Given approx tick number - * @param {boolean} [fixMin=false] - * @param {boolean} [fixMax=false] - */ - niceExtent: function (splitNumber, fixMin, fixMax) { - intervalScaleProto.niceExtent.call(this, splitNumber, fixMin, fixMax); - - var originalScale = this._originalScale; - originalScale.__fixMin = fixMin; - originalScale.__fixMax = fixMax; + // 坐标轴小标记 + axisTick: { + // If tick is align with label when boundaryGap is true + alignWithLabel: false, + interval: 'auto' + }, + // 坐标轴文本标签,详见axis.axisLabel + axisLabel: { + interval: 'auto' } + }, defaultOption); - }); + var valueAxis = zrUtil.merge({ + // 数值起始和结束两端空白策略 + boundaryGap: [0, 0], + // 最小值, 设置成 'dataMin' 则从数据中计算最小值 + // min: null, + // 最大值,设置成 'dataMax' 则从数据中计算最大值 + // max: null, + // Readonly prop, specifies start value of the range when using data zoom. + // rangeStart: null + // Readonly prop, specifies end value of the range when using data zoom. + // rangeEnd: null + // 脱离0值比例,放大聚焦到最终_min,_max区间 + // scale: false, + // 分割段数,默认为5 + splitNumber: 5 + // Minimum interval + // minInterval: null + }, defaultOption); - zrUtil.each(['contain', 'normalize'], function (methodName) { - LogScale.prototype[methodName] = function (val) { - val = mathLog(val) / mathLog(this.base); - return scaleProto[methodName].call(this, val); - }; - }); + // FIXME + var timeAxis = zrUtil.defaults({ + scale: true, + min: 'dataMin', + max: 'dataMax' + }, valueAxis); + var logAxis = zrUtil.defaults({ + logBase: 10 + }, valueAxis); + logAxis.scale = true; - LogScale.create = function () { - return new LogScale(); + module.exports = { + categoryAxis: categoryAxis, + valueAxis: valueAxis, + timeAxis: timeAxis, + logAxis: logAxis }; - function fixRoundingError(val, originalVal) { - return roundingErrorFix(val, getPrecisionSafe(originalVal)); - } - - module.exports = LogScale; - /***/ }, -/* 121 */ +/* 133 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; + // TODO boundaryGap - var zrUtil = __webpack_require__(4); - var Cartesian = __webpack_require__(122); + __webpack_require__(130); - function Cartesian2D(name) { + __webpack_require__(134); - Cartesian.call(this, name); - } - Cartesian2D.prototype = { +/***/ }, +/* 134 */ +/***/ function(module, exports, __webpack_require__) { - constructor: Cartesian2D, + - type: 'cartesian2d', + var zrUtil = __webpack_require__(4); + var graphic = __webpack_require__(44); + var AxisBuilder = __webpack_require__(135); + var CartesianAxisPointer = __webpack_require__(136); + var AxisView = __webpack_require__(141); + var cartesianAxisHelper = __webpack_require__(140); + var ifIgnoreOnTick = AxisBuilder.ifIgnoreOnTick; + var getInterval = AxisBuilder.getInterval; - /** - * @type {Array.} - * @readOnly - */ - dimensions: ['x', 'y'], + var axisBuilderAttrs = [ + 'axisLine', 'axisLabel', 'axisTick', 'axisName' + ]; + var selfBuilderAttrs = [ + 'splitArea', 'splitLine' + ]; - /** - * Base axis will be used on stacking. - * - * @return {module:echarts/coord/cartesian/Axis2D} - */ - getBaseAxis: function () { - return this.getAxesByScale('ordinal')[0] - || this.getAxesByScale('time')[0] - || this.getAxis('x'); - }, + // function getAlignWithLabel(model, axisModel) { + // var alignWithLabel = model.get('alignWithLabel'); + // if (alignWithLabel === 'auto') { + // alignWithLabel = axisModel.get('axisTick.alignWithLabel'); + // } + // return alignWithLabel; + // } - /** - * If contain point - * @param {Array.} point - * @return {boolean} - */ - containPoint: function (point) { - var axisX = this.getAxis('x'); - var axisY = this.getAxis('y'); - return axisX.contain(axisX.toLocalCoord(point[0])) - && axisY.contain(axisY.toLocalCoord(point[1])); - }, + var CartesianAxisView = AxisView.extend({ - /** - * If contain data - * @param {Array.} data - * @return {boolean} - */ - containData: function (data) { - return this.getAxis('x').containData(data[0]) - && this.getAxis('y').containData(data[1]); - }, + type: 'cartesianAxis', - /** - * Convert series data to an array of points - * @param {module:echarts/data/List} data - * @param {boolean} stack - * @return {Array} - * Return array of points. For example: - * `[[10, 10], [20, 20], [30, 30]]` - */ - dataToPoints: function (data, stack) { - return data.mapArray(['x', 'y'], function (x, y) { - return this.dataToPoint([x, y]); - }, stack, this); - }, + axisPointerClass: CartesianAxisPointer, /** - * @param {Array.} data - * @param {boolean} [clamp=false] - * @return {Array.} + * @override */ - dataToPoint: function (data, clamp) { - var xAxis = this.getAxis('x'); - var yAxis = this.getAxis('y'); - return [ - xAxis.toGlobalCoord(xAxis.dataToCoord(data[0], clamp)), - yAxis.toGlobalCoord(yAxis.dataToCoord(data[1], clamp)) - ]; - }, + render: function (axisModel, ecModel, api, payload) { - /** - * @param {Array.} point - * @param {boolean} [clamp=false] - * @return {Array.} - */ - pointToData: function (point, clamp) { - var xAxis = this.getAxis('x'); - var yAxis = this.getAxis('y'); - return [ - xAxis.coordToData(xAxis.toLocalCoord(point[0]), clamp), - yAxis.coordToData(yAxis.toLocalCoord(point[1]), clamp) - ]; - }, + this.group.removeAll(); - /** - * Get other axis - * @param {module:echarts/coord/cartesian/Axis2D} axis - */ - getOtherAxis: function (axis) { - return this.getAxis(axis.dim === 'x' ? 'y' : 'x'); - } - }; + var oldAxisGroup = this._axisGroup; + this._axisGroup = new graphic.Group(); - zrUtil.inherits(Cartesian2D, Cartesian); + this.group.add(this._axisGroup); - module.exports = Cartesian2D; + if (!axisModel.get('show')) { + return; + } + var gridModel = axisModel.getCoordSysModel(); -/***/ }, -/* 122 */ -/***/ function(module, exports, __webpack_require__) { + var layout = cartesianAxisHelper.layout(gridModel, axisModel); - 'use strict'; - /** - * Cartesian coordinate system - * @module echarts/coord/Cartesian - * - */ + var axisBuilder = new AxisBuilder(axisModel, layout); + zrUtil.each(axisBuilderAttrs, axisBuilder.add, axisBuilder); - var zrUtil = __webpack_require__(4); + this._axisGroup.add(axisBuilder.getGroup()); - function dimAxisMapper(dim) { - return this._axes[dim]; - } + zrUtil.each(selfBuilderAttrs, function (name) { + if (axisModel.get(name + '.show')) { + this['_' + name](axisModel, gridModel, layout.labelInterval); + } + }, this); - /** - * @alias module:echarts/coord/Cartesian - * @constructor - */ - var Cartesian = function (name) { - this._axes = {}; + graphic.groupTransition(oldAxisGroup, this._axisGroup, axisModel); - this._dimList = []; + CartesianAxisView.superCall(this, 'render', axisModel, ecModel, api, payload); + }, /** - * @type {string} + * @param {module:echarts/coord/cartesian/AxisModel} axisModel + * @param {module:echarts/coord/cartesian/GridModel} gridModel + * @param {number|Function} labelInterval + * @private */ - this.name = name || ''; - }; + _splitLine: function (axisModel, gridModel, labelInterval) { + var axis = axisModel.axis; - Cartesian.prototype = { + if (axis.scale.isBlank()) { + return; + } + + var splitLineModel = axisModel.getModel('splitLine'); + var lineStyleModel = splitLineModel.getModel('lineStyle'); + var lineColors = lineStyleModel.get('color'); + + var lineInterval = getInterval(splitLineModel, labelInterval); + + lineColors = zrUtil.isArray(lineColors) ? lineColors : [lineColors]; + + var gridRect = gridModel.coordinateSystem.getRect(); + var isHorizontal = axis.isHorizontal(); + + var lineCount = 0; + + var ticksCoords = axis.getTicksCoords( + // splitLineModel.get('alignWithLabel') + ); + var ticks = axis.scale.getTicks(); + + var p1 = []; + var p2 = []; + // Simple optimization + // Batching the lines if color are the same + var lineStyle = lineStyleModel.getLineStyle(); + for (var i = 0; i < ticksCoords.length; i++) { + if (ifIgnoreOnTick(axis, i, lineInterval)) { + continue; + } + + var tickCoord = axis.toGlobalCoord(ticksCoords[i]); - constructor: Cartesian, + if (isHorizontal) { + p1[0] = tickCoord; + p1[1] = gridRect.y; + p2[0] = tickCoord; + p2[1] = gridRect.y + gridRect.height; + } + else { + p1[0] = gridRect.x; + p1[1] = tickCoord; + p2[0] = gridRect.x + gridRect.width; + p2[1] = tickCoord; + } - type: 'cartesian', + var colorIndex = (lineCount++) % lineColors.length; + this._axisGroup.add(new graphic.Line(graphic.subPixelOptimizeLine({ + anid: 'line_' + ticks[i], - /** - * Get axis - * @param {number|string} dim - * @return {module:echarts/coord/Cartesian~Axis} - */ - getAxis: function (dim) { - return this._axes[dim]; + shape: { + x1: p1[0], + y1: p1[1], + x2: p2[0], + y2: p2[1] + }, + style: zrUtil.defaults({ + stroke: lineColors[colorIndex] + }, lineStyle), + silent: true + }))); + } }, /** - * Get axes list - * @return {Array.} + * @param {module:echarts/coord/cartesian/AxisModel} axisModel + * @param {module:echarts/coord/cartesian/GridModel} gridModel + * @param {number|Function} labelInterval + * @private */ - getAxes: function () { - return zrUtil.map(this._dimList, dimAxisMapper, this); - }, + _splitArea: function (axisModel, gridModel, labelInterval) { + var axis = axisModel.axis; - /** - * Get axes list by given scale type - */ - getAxesByScale: function (scaleType) { - scaleType = scaleType.toLowerCase(); - return zrUtil.filter( - this.getAxes(), - function (axis) { - return axis.scale.type === scaleType; - } + if (axis.scale.isBlank()) { + return; + } + + var splitAreaModel = axisModel.getModel('splitArea'); + var areaStyleModel = splitAreaModel.getModel('areaStyle'); + var areaColors = areaStyleModel.get('color'); + + var gridRect = gridModel.coordinateSystem.getRect(); + + var ticksCoords = axis.getTicksCoords( + // splitAreaModel.get('alignWithLabel') ); - }, + var ticks = axis.scale.getTicks(); - /** - * Add axis - * @param {module:echarts/coord/Cartesian.Axis} - */ - addAxis: function (axis) { - var dim = axis.dim; + var prevX = axis.toGlobalCoord(ticksCoords[0]); + var prevY = axis.toGlobalCoord(ticksCoords[0]); - this._axes[dim] = axis; + var count = 0; - this._dimList.push(dim); - }, + var areaInterval = getInterval(splitAreaModel, labelInterval); - /** - * Convert data to coord in nd space - * @param {Array.|Object.} val - * @return {Array.|Object.} - */ - dataToCoord: function (val) { - return this._dataCoordConvert(val, 'dataToCoord'); - }, + var areaStyle = areaStyleModel.getAreaStyle(); + areaColors = zrUtil.isArray(areaColors) ? areaColors : [areaColors]; - /** - * Convert coord in nd space to data - * @param {Array.|Object.} val - * @return {Array.|Object.} - */ - coordToData: function (val) { - return this._dataCoordConvert(val, 'coordToData'); - }, + for (var i = 1; i < ticksCoords.length; i++) { + if (ifIgnoreOnTick(axis, i, areaInterval)) { + continue; + } - _dataCoordConvert: function (input, method) { - var dimList = this._dimList; + var tickCoord = axis.toGlobalCoord(ticksCoords[i]); - var output = input instanceof Array ? [] : {}; + var x; + var y; + var width; + var height; + if (axis.isHorizontal()) { + x = prevX; + y = gridRect.y; + width = tickCoord - x; + height = gridRect.height; + } + else { + x = gridRect.x; + y = prevY; + width = gridRect.width; + height = tickCoord - y; + } - for (var i = 0; i < dimList.length; i++) { - var dim = dimList[i]; - var axis = this._axes[dim]; + var colorIndex = (count++) % areaColors.length; + this._axisGroup.add(new graphic.Rect({ + anid: 'area_' + ticks[i], - output[dim] = axis[method](input[dim]); - } + shape: { + x: x, + y: y, + width: width, + height: height + }, + style: zrUtil.defaults({ + fill: areaColors[colorIndex] + }, areaStyle), + silent: true + })); - return output; + prevX = x + width; + prevY = y + height; + } } - }; + }); + + CartesianAxisView.extend({ + type: 'xAxis' + }); + CartesianAxisView.extend({ + type: 'yAxis' + }); - module.exports = Cartesian; /***/ }, -/* 123 */ +/* 135 */ /***/ function(module, exports, __webpack_require__) { var zrUtil = __webpack_require__(4); - var Axis = __webpack_require__(124); - var axisLabelInterval = __webpack_require__(125); + var formatUtil = __webpack_require__(6); + var graphic = __webpack_require__(44); + var Model = __webpack_require__(12); + var numberUtil = __webpack_require__(7); + var remRadian = numberUtil.remRadian; + var isRadianAroundZero = numberUtil.isRadianAroundZero; + var vec2 = __webpack_require__(10); + var v2ApplyTransform = vec2.applyTransform; + var retrieve = zrUtil.retrieve; + + var PI = Math.PI; + + function makeAxisEventDataBase(axisModel) { + var eventData = { + componentType: axisModel.mainType + }; + eventData[axisModel.mainType + 'Index'] = axisModel.componentIndex; + return eventData; + } /** - * Extend axis 2d - * @constructor module:echarts/coord/cartesian/Axis2D - * @extends {module:echarts/coord/cartesian/Axis} - * @param {string} dim - * @param {*} scale - * @param {Array.} coordExtent - * @param {string} axisType - * @param {string} position + * A final axis is translated and rotated from a "standard axis". + * So opt.position and opt.rotation is required. + * + * A standard axis is and axis from [0, 0] to [0, axisExtent[1]], + * for example: (0, 0) ------------> (0, 50) + * + * nameDirection or tickDirection or labelDirection is 1 means tick + * or label is below the standard axis, whereas is -1 means above + * the standard axis. labelOffset means offset between label and axis, + * which is useful when 'onZero', where axisLabel is in the grid and + * label in outside grid. + * + * Tips: like always, + * positive rotation represents anticlockwise, and negative rotation + * represents clockwise. + * The direction of position coordinate is the same as the direction + * of screen coordinate. + * + * Do not need to consider axis 'inverse', which is auto processed by + * axis extent. + * + * @param {module:zrender/container/Group} group + * @param {Object} axisModel + * @param {Object} opt Standard axis parameters. + * @param {Array.} opt.position [x, y] + * @param {number} opt.rotation by radian + * @param {number} [opt.nameDirection=1] 1 or -1 Used when nameLocation is 'middle'. + * @param {number} [opt.tickDirection=1] 1 or -1 + * @param {number} [opt.labelDirection=1] 1 or -1 + * @param {number} [opt.labelOffset=0] Usefull when onZero. + * @param {string} [opt.axisLabelShow] default get from axisModel. + * @param {string} [opt.axisName] default get from axisModel. + * @param {number} [opt.axisNameAvailableWidth] + * @param {number} [opt.labelRotate] by degree, default get from axisModel. + * @param {number} [opt.labelInterval] Default label interval when label + * interval from model is null or 'auto'. + * @param {number} [opt.strokeContainThreshold] Default label interval when label */ - var Axis2D = function (dim, scale, coordExtent, axisType, position) { - Axis.call(this, dim, scale, coordExtent); + var AxisBuilder = function (axisModel, opt) { + /** - * Axis type - * - 'category' - * - 'value' - * - 'time' - * - 'log' - * @type {string} + * @readOnly */ - this.type = axisType || 'value'; + this.opt = opt; /** - * Axis position - * - 'top' - * - 'bottom' - * - 'left' - * - 'right' + * @readOnly */ - this.position = position || 'bottom'; - }; - - Axis2D.prototype = { + this.axisModel = axisModel; - constructor: Axis2D, + // Default value + zrUtil.defaults( + opt, + { + labelOffset: 0, + nameDirection: 1, + tickDirection: 1, + labelDirection: 1, + silent: true + } + ); /** - * Index of axis, can be used as key - */ - index: 0, - /** - * If axis is on the zero position of the other axis - * @type {boolean} + * @readOnly */ - onZero: false, + this.group = new graphic.Group(); - /** - * Axis model - * @param {module:echarts/coord/cartesian/AxisModel} - */ - model: null, + // FIXME Not use a seperate text group? + var dumbGroup = new graphic.Group({ + position: opt.position.slice(), + rotation: opt.rotation + }); - isHorizontal: function () { - var position = this.position; - return position === 'top' || position === 'bottom'; - }, + // this.group.add(dumbGroup); + // this._dumbGroup = dumbGroup; - getGlobalExtent: function () { - var ret = this.getExtent(); - ret[0] = this.toGlobalCoord(ret[0]); - ret[1] = this.toGlobalCoord(ret[1]); - return ret; - }, + dumbGroup.updateTransform(); + this._transform = dumbGroup.transform; - /** - * @return {number} - */ - getLabelInterval: function () { - var labelInterval = this._labelInterval; - if (!labelInterval) { - labelInterval = this._labelInterval = axisLabelInterval(this); - } - return labelInterval; - }, + this._dumbGroup = dumbGroup; + }; - /** - * If label is ignored. - * Automatically used when axis is category and label can not be all shown - * @param {number} idx - * @return {boolean} - */ - isLabelIgnored: function (idx) { - if (this.type === 'category') { - var labelInterval = this.getLabelInterval(); - return ((typeof labelInterval === 'function') - && !labelInterval(idx, this.scale.getLabel(idx))) - || idx % (labelInterval + 1); - } + AxisBuilder.prototype = { + + constructor: AxisBuilder, + + hasBuilder: function (name) { + return !!builders[name]; }, - /** - * Transform global coord to local coord, - * i.e. var localCoord = axis.toLocalCoord(80); - * designate by module:echarts/coord/cartesian/Grid. - * @type {Function} - */ - toLocalCoord: null, + add: function (name) { + builders[name].call(this); + }, - /** - * Transform global coord to local coord, - * i.e. var globalCoord = axis.toLocalCoord(40); - * designate by module:echarts/coord/cartesian/Grid. - * @type {Function} - */ - toGlobalCoord: null + getGroup: function () { + return this.group; + } }; - zrUtil.inherits(Axis2D, Axis); - - module.exports = Axis2D; + var builders = { -/***/ }, -/* 124 */ -/***/ function(module, exports, __webpack_require__) { + /** + * @private + */ + axisLine: function () { + var opt = this.opt; + var axisModel = this.axisModel; - + if (!axisModel.get('axisLine.show')) { + return; + } - var numberUtil = __webpack_require__(7); - var linearMap = numberUtil.linearMap; - var zrUtil = __webpack_require__(4); + var extent = this.axisModel.axis.getExtent(); - function fixExtentWithBands(extent, nTick) { - var size = extent[1] - extent[0]; - var len = nTick; - var margin = size / len / 2; - extent[0] += margin; - extent[1] -= margin; - } + var matrix = this._transform; + var pt1 = [extent[0], 0]; + var pt2 = [extent[1], 0]; + if (matrix) { + v2ApplyTransform(pt1, pt1, matrix); + v2ApplyTransform(pt2, pt2, matrix); + } - var normalizedExtent = [0, 1]; - /** - * @name module:echarts/coord/CartesianAxis - * @constructor - */ - var Axis = function (dim, scale, extent) { + this.group.add(new graphic.Line(graphic.subPixelOptimizeLine({ - /** - * Axis dimension. Such as 'x', 'y', 'z', 'angle', 'radius' - * @type {string} - */ - this.dim = dim; + // Id for animation + anid: 'line', - /** - * Axis scale - * @type {module:echarts/coord/scale/*} - */ - this.scale = scale; + shape: { + x1: pt1[0], + y1: pt1[1], + x2: pt2[0], + y2: pt2[1] + }, + style: zrUtil.extend( + {lineCap: 'round'}, + axisModel.getModel('axisLine.lineStyle').getLineStyle() + ), + strokeContainThreshold: opt.strokeContainThreshold || 5, + silent: true, + z2: 1 + }))); + }, /** - * @type {Array.} * @private */ - this._extent = extent || [0, 0]; + axisTick: function () { + var axisModel = this.axisModel; + var axis = axisModel.axis; - /** - * @type {boolean} - */ - this.inverse = false; + if (!axisModel.get('axisTick.show') || axis.scale.isBlank()) { + return; + } - /** - * Usually true when axis has a ordinal scale - * @type {boolean} - */ - this.onBand = false; - }; + var tickModel = axisModel.getModel('axisTick'); + var opt = this.opt; - Axis.prototype = { + var lineStyleModel = tickModel.getModel('lineStyle'); + var tickLen = tickModel.get('length'); - constructor: Axis, + var tickInterval = getInterval(tickModel, opt.labelInterval); + var ticksCoords = axis.getTicksCoords(tickModel.get('alignWithLabel')); + var ticks = axis.scale.getTicks(); - /** - * If axis extent contain given coord - * @param {number} coord - * @return {boolean} - */ - contain: function (coord) { - var extent = this._extent; - var min = Math.min(extent[0], extent[1]); - var max = Math.max(extent[0], extent[1]); - return coord >= min && coord <= max; - }, + var pt1 = []; + var pt2 = []; + var matrix = this._transform; - /** - * If axis extent contain given data - * @param {number} data - * @return {boolean} - */ - containData: function (data) { - return this.contain(this.dataToCoord(data)); - }, + for (var i = 0; i < ticksCoords.length; i++) { + // Only ordinal scale support tick interval + if (ifIgnoreOnTick(axis, i, tickInterval)) { + continue; + } - /** - * Get coord extent. - * @return {Array.} - */ - getExtent: function () { - var ret = this._extent.slice(); - return ret; - }, + var tickCoord = ticksCoords[i]; - /** - * Get precision used for formatting - * @param {Array.} [dataExtent] - * @return {number} - */ - getPixelPrecision: function (dataExtent) { - return numberUtil.getPixelPrecision( - dataExtent || this.scale.getExtent(), - this._extent - ); - }, + pt1[0] = tickCoord; + pt1[1] = 0; + pt2[0] = tickCoord; + pt2[1] = opt.tickDirection * tickLen; - /** - * Set coord extent - * @param {number} start - * @param {number} end - */ - setExtent: function (start, end) { - var extent = this._extent; - extent[0] = start; - extent[1] = end; + if (matrix) { + v2ApplyTransform(pt1, pt1, matrix); + v2ApplyTransform(pt2, pt2, matrix); + } + // Tick line, Not use group transform to have better line draw + this.group.add(new graphic.Line(graphic.subPixelOptimizeLine({ + + // Id for animation + anid: 'tick_' + ticks[i], + + shape: { + x1: pt1[0], + y1: pt1[1], + x2: pt2[0], + y2: pt2[1] + }, + style: zrUtil.defaults( + lineStyleModel.getLineStyle(), + { + stroke: axisModel.get('axisLine.lineStyle.color') + } + ), + z2: 2, + silent: true + }))); + } }, /** - * Convert data to coord. Data is the rank if it has a ordinal scale - * @param {number} data - * @param {boolean} clamp - * @return {number} + * @param {module:echarts/coord/cartesian/AxisModel} axisModel + * @param {module:echarts/coord/cartesian/GridModel} gridModel + * @private */ - dataToCoord: function (data, clamp) { - var extent = this._extent; - var scale = this.scale; - data = scale.normalize(data); + axisLabel: function () { + var opt = this.opt; + var axisModel = this.axisModel; + var axis = axisModel.axis; + var show = retrieve(opt.axisLabelShow, axisModel.get('axisLabel.show')); - if (this.onBand && scale.type === 'ordinal') { - extent = extent.slice(); - fixExtentWithBands(extent, scale.count()); + if (!show || axis.scale.isBlank()) { + return; } - return linearMap(data, normalizedExtent, extent, clamp); - }, + var labelModel = axisModel.getModel('axisLabel'); + var textStyleModel = labelModel.getModel('textStyle'); + var labelMargin = labelModel.get('margin'); + var ticks = axis.scale.getTicks(); + var labels = axisModel.getFormattedLabels(); - /** - * Convert coord to data. Data is the rank if it has a ordinal scale - * @param {number} coord - * @param {boolean} clamp - * @return {number} - */ - coordToData: function (coord, clamp) { - var extent = this._extent; - var scale = this.scale; + // Special label rotate. + var labelRotation = ( + retrieve(opt.labelRotate, labelModel.get('rotate')) || 0 + ) * PI / 180; - if (this.onBand && scale.type === 'ordinal') { - extent = extent.slice(); - fixExtentWithBands(extent, scale.count()); - } + var labelLayout = innerTextLayout(opt.rotation, labelRotation, opt.labelDirection); + var categoryData = axisModel.get('data'); - var t = linearMap(coord, extent, normalizedExtent, clamp); + var textEls = []; + var silent = isSilent(axisModel); + var triggerEvent = axisModel.get('triggerEvent'); - return this.scale.scale(t); - }, - /** - * @return {Array.} - */ - getTicksCoords: function (alignWithLabel) { - if (this.onBand && !alignWithLabel) { - var bands = this.getBands(); - var coords = []; - for (var i = 0; i < bands.length; i++) { - coords.push(bands[i][0]); + zrUtil.each(ticks, function (tickVal, index) { + if (ifIgnoreOnTick(axis, index, opt.labelInterval)) { + return; } - if (bands[i - 1]) { - coords.push(bands[i - 1][1]); + + var itemTextStyleModel = textStyleModel; + if (categoryData && categoryData[tickVal] && categoryData[tickVal].textStyle) { + itemTextStyleModel = new Model( + categoryData[tickVal].textStyle, textStyleModel, axisModel.ecModel + ); + } + var textColor = itemTextStyleModel.getTextColor() + || axisModel.get('axisLine.lineStyle.color'); + + var tickCoord = axis.dataToCoord(tickVal); + var pos = [ + tickCoord, + opt.labelOffset + opt.labelDirection * labelMargin + ]; + var labelStr = axis.scale.getLabel(tickVal); + + var textEl = new graphic.Text({ + + // Id for animation + anid: 'label_' + tickVal, + + style: { + text: labels[index], + textAlign: itemTextStyleModel.get('align', true) || labelLayout.textAlign, + textVerticalAlign: itemTextStyleModel.get('baseline', true) || labelLayout.textVerticalAlign, + textFont: itemTextStyleModel.getFont(), + fill: typeof textColor === 'function' + ? textColor( + // (1) In category axis with data zoom, tick is not the original + // index of axis.data. So tick should not be exposed to user + // in category axis. + // (2) Compatible with previous version, which always returns labelStr. + // But in interval scale labelStr is like '223,445', which maked + // user repalce ','. So we modify it to return original val but remain + // it as 'string' to avoid error in replacing. + axis.type === 'category' ? labelStr : axis.type === 'value' ? tickVal + '' : tickVal, + index + ) + : textColor + }, + position: pos, + rotation: labelLayout.rotation, + silent: silent, + z2: 10 + }); + + // Pack data for mouse event + if (triggerEvent) { + textEl.eventData = makeAxisEventDataBase(axisModel); + textEl.eventData.targetType = 'axisLabel'; + textEl.eventData.value = labelStr; + } + + // FIXME + this._dumbGroup.add(textEl); + textEl.updateTransform(); + + textEls.push(textEl); + this.group.add(textEl); + + textEl.decomposeTransform(); + + }, this); + + function isTwoLabelOverlapped(current, next) { + var firstRect = current && current.getBoundingRect().clone(); + var nextRect = next && next.getBoundingRect().clone(); + if (firstRect && nextRect) { + firstRect.applyTransform(current.getLocalTransform()); + nextRect.applyTransform(next.getLocalTransform()); + return firstRect.intersect(nextRect); } - return coords; } - else { - return zrUtil.map(this.scale.getTicks(), this.dataToCoord, this); + + // If min or max are user set, we need to check + // If the tick on min(max) are overlap on their neighbour tick + // If they are overlapped, we need to hide the min(max) tick label + if (axisModel.getMin() != null) { + var firstLabel = textEls[0]; + var nextLabel = textEls[1]; + if (isTwoLabelOverlapped(firstLabel, nextLabel)) { + firstLabel.ignore = true; + } + } + if (axisModel.getMax() != null) { + var lastLabel = textEls[textEls.length - 1]; + var prevLabel = textEls[textEls.length - 2]; + if (isTwoLabelOverlapped(prevLabel, lastLabel)) { + lastLabel.ignore = true; + } } }, /** - * Coords of labels are on the ticks or on the middle of bands - * @return {Array.} + * @private */ - getLabelsCoords: function () { - return zrUtil.map(this.scale.getTicks(), this.dataToCoord, this); - }, + axisName: function () { + var opt = this.opt; + var axisModel = this.axisModel; + var name = retrieve(opt.axisName, axisModel.get('name')); - /** - * Get bands. - * - * If axis has labels [1, 2, 3, 4]. Bands on the axis are - * |---1---|---2---|---3---|---4---|. - * - * @return {Array} - */ - // FIXME Situation when labels is on ticks - getBands: function () { - var extent = this.getExtent(); - var bands = []; - var len = this.scale.count(); - var start = extent[0]; - var end = extent[1]; - var span = end - start; + if (!name) { + return; + } - for (var i = 0; i < len; i++) { - bands.push([ - span * i / len + start, - span * (i + 1) / len + start - ]); + var nameLocation = axisModel.get('nameLocation'); + var nameDirection = opt.nameDirection; + var textStyleModel = axisModel.getModel('nameTextStyle'); + var gap = axisModel.get('nameGap') || 0; + + var extent = this.axisModel.axis.getExtent(); + var gapSignal = extent[0] > extent[1] ? -1 : 1; + var pos = [ + nameLocation === 'start' + ? extent[0] - gapSignal * gap + : nameLocation === 'end' + ? extent[1] + gapSignal * gap + : (extent[0] + extent[1]) / 2, // 'middle' + // Reuse labelOffset. + nameLocation === 'middle' ? opt.labelOffset + nameDirection * gap : 0 + ]; + + var labelLayout; + + var nameRotation = axisModel.get('nameRotate'); + if (nameRotation != null) { + nameRotation = nameRotation * PI / 180; // To radian. } - return bands; - }, - /** - * Get width of band - * @return {number} - */ - getBandWidth: function () { - var axisExtent = this._extent; - var dataExtent = this.scale.getExtent(); + var axisNameAvailableWidth; - var len = dataExtent[1] - dataExtent[0] + (this.onBand ? 1 : 0); - // Fix #2728, avoid NaN when only one data. - len === 0 && (len = 1); + if (nameLocation === 'middle') { + labelLayout = innerTextLayout( + opt.rotation, + nameRotation != null ? nameRotation : opt.rotation, // Adapt to axis. + nameDirection + ); + } + else { + labelLayout = endTextLayout( + opt, nameLocation, nameRotation || 0, extent + ); - var size = Math.abs(axisExtent[1] - axisExtent[0]); + axisNameAvailableWidth = opt.axisNameAvailableWidth; + if (axisNameAvailableWidth != null) { + axisNameAvailableWidth = Math.abs( + axisNameAvailableWidth / Math.sin(labelLayout.rotation) + ); + !isFinite(axisNameAvailableWidth) && (axisNameAvailableWidth = null); + } + } - return Math.abs(size) / len; - }, + var textFont = textStyleModel.getFont(); - /** - * When axis extent depends on data and no data exists, - * axis ticks should not be drawn, which is named 'blank'. - */ - isBlank: function () { - return this._isBlank; - }, + var truncateOpt = axisModel.get('nameTruncate', true) || {}; + var ellipsis = truncateOpt.ellipsis; + var maxWidth = retrieve(truncateOpt.maxWidth, axisNameAvailableWidth); + var truncatedText = (ellipsis != null && maxWidth != null) + ? formatUtil.truncateText( + name, maxWidth, textFont, ellipsis, + {minChar: 2, placeholder: truncateOpt.placeholder} + ) + : name; - /** - * When axis extent depends on data and no data exists, - * axis ticks should not be drawn, which is named 'blank'. - */ - setBlank: function (isBlank) { - this._isBlank = isBlank; - } + var tooltipOpt = axisModel.get('tooltip', true); - }; + var mainType = axisModel.mainType; + var formatterParams = { + componentType: mainType, + name: name, + $vars: ['name'] + }; + formatterParams[mainType + 'Index'] = axisModel.componentIndex; - module.exports = Axis; + var textEl = new graphic.Text({ + // Id for animation + anid: 'name', -/***/ }, -/* 125 */ -/***/ function(module, exports, __webpack_require__) { + __fullText: name, + __truncatedText: truncatedText, - 'use strict'; - /** - * Helper function for axisLabelInterval calculation - */ + style: { + text: truncatedText, + textFont: textFont, + fill: textStyleModel.getTextColor() + || axisModel.get('axisLine.lineStyle.color'), + textAlign: labelLayout.textAlign, + textVerticalAlign: labelLayout.textVerticalAlign + }, + position: pos, + rotation: labelLayout.rotation, + silent: isSilent(axisModel), + z2: 1, + tooltip: (tooltipOpt && tooltipOpt.show) + ? zrUtil.extend({ + content: name, + formatter: function () { + return name; + }, + formatterParams: formatterParams + }, tooltipOpt) + : null + }); + if (axisModel.get('triggerEvent')) { + textEl.eventData = makeAxisEventDataBase(axisModel); + textEl.eventData.targetType = 'axisName'; + textEl.eventData.name = name; + } + // FIXME + this._dumbGroup.add(textEl); + textEl.updateTransform(); - var zrUtil = __webpack_require__(4); - var axisHelper = __webpack_require__(115); + this.group.add(textEl); - module.exports = function (axis) { - var axisModel = axis.model; - var labelModel = axisModel.getModel('axisLabel'); - var labelInterval = labelModel.get('interval'); - if (!(axis.type === 'category' && labelInterval === 'auto')) { - return labelInterval === 'auto' ? 0 : labelInterval; + textEl.decomposeTransform(); } - return axisHelper.getAxisLabelInterval( - zrUtil.map(axis.scale.getTicks(), axis.dataToCoord, axis), - axisModel.getFormattedLabels(), - labelModel.getModel('textStyle').getFont(), - axis.isHorizontal() - ); }; + /** + * @public + * @static + * @param {Object} opt + * @param {number} axisRotation in radian + * @param {number} textRotation in radian + * @param {number} direction + * @return {Object} { + * rotation, // according to axis + * textAlign, + * textVerticalAlign + * } + */ + var innerTextLayout = AxisBuilder.innerTextLayout = function (axisRotation, textRotation, direction) { + var rotationDiff = remRadian(textRotation - axisRotation); + var textAlign; + var textVerticalAlign; -/***/ }, -/* 126 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - // Grid 是在有直角坐标系的时候必须要存在的 - // 所以这里也要被 Cartesian2D 依赖 + if (isRadianAroundZero(rotationDiff)) { // Label is parallel with axis line. + textVerticalAlign = direction > 0 ? 'top' : 'bottom'; + textAlign = 'center'; + } + else if (isRadianAroundZero(rotationDiff - PI)) { // Label is inverse parallel with axis line. + textVerticalAlign = direction > 0 ? 'bottom' : 'top'; + textAlign = 'center'; + } + else { + textVerticalAlign = 'middle'; + if (rotationDiff > 0 && rotationDiff < PI) { + textAlign = direction > 0 ? 'right' : 'left'; + } + else { + textAlign = direction > 0 ? 'left' : 'right'; + } + } - __webpack_require__(127); - var ComponentModel = __webpack_require__(19); + return { + rotation: rotationDiff, + textAlign: textAlign, + textVerticalAlign: textVerticalAlign + }; + }; - module.exports = ComponentModel.extend({ + /** + * @inner + */ + function endTextLayout(opt, textPosition, textRotate, extent) { + var rotationDiff = remRadian(textRotate - opt.rotation); + var textAlign; + var textVerticalAlign; + var inverse = extent[0] > extent[1]; + var onLeft = (textPosition === 'start' && !inverse) + || (textPosition !== 'start' && inverse); - type: 'grid', + if (isRadianAroundZero(rotationDiff - PI / 2)) { + textVerticalAlign = onLeft ? 'bottom' : 'top'; + textAlign = 'center'; + } + else if (isRadianAroundZero(rotationDiff - PI * 1.5)) { + textVerticalAlign = onLeft ? 'top' : 'bottom'; + textAlign = 'center'; + } + else { + textVerticalAlign = 'middle'; + if (rotationDiff < PI * 1.5 && rotationDiff > PI / 2) { + textAlign = onLeft ? 'left' : 'right'; + } + else { + textAlign = onLeft ? 'right' : 'left'; + } + } - dependencies: ['xAxis', 'yAxis'], + return { + rotation: rotationDiff, + textAlign: textAlign, + textVerticalAlign: textVerticalAlign + }; + } - layoutMode: 'box', + /** + * @inner + */ + function isSilent(axisModel) { + var tooltipOpt = axisModel.get('tooltip'); + return axisModel.get('silent') + // Consider mouse cursor, add these restrictions. + || !( + axisModel.get('triggerEvent') || (tooltipOpt && tooltipOpt.show) + ); + } - /** - * @type {module:echarts/coord/cartesian/Grid} - */ - coordinateSystem: null, + /** + * @static + */ + var ifIgnoreOnTick = AxisBuilder.ifIgnoreOnTick = function (axis, i, interval) { + var rawTick; + var scale = axis.scale; + return scale.type === 'ordinal' + && ( + typeof interval === 'function' + ? ( + rawTick = scale.getTicks()[i], + !interval(rawTick, scale.getLabel(rawTick)) + ) + : i % (interval + 1) + ); + }; - defaultOption: { - show: false, - zlevel: 0, - z: 0, - left: '10%', - top: 60, - right: '10%', - bottom: 60, - // If grid size contain label - containLabel: false, - // width: {totalWidth} - left - right, - // height: {totalHeight} - top - bottom, - backgroundColor: 'rgba(0,0,0,0)', - borderWidth: 1, - borderColor: '#ccc' + /** + * @static + */ + var getInterval = AxisBuilder.getInterval = function (model, labelInterval) { + var interval = model.get('interval'); + if (interval == null || interval == 'auto') { + interval = labelInterval; } - }); + return interval; + }; + + module.exports = AxisBuilder; + /***/ }, -/* 127 */ +/* 136 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; - var ComponentModel = __webpack_require__(19); - var zrUtil = __webpack_require__(4); - var axisModelCreator = __webpack_require__(128); - - var AxisModel = ComponentModel.extend({ - - type: 'cartesian2dAxis', + var graphic = __webpack_require__(44); + var BaseAxisPointer = __webpack_require__(137); + var viewHelper = __webpack_require__(139); + var cartesianAxisHelper = __webpack_require__(140); - /** - * @type {module:echarts/coord/cartesian/Axis2D} - */ - axis: null, + var CartesianAxisPointer = BaseAxisPointer.extend({ /** * @override */ - init: function () { - AxisModel.superApply(this, 'init', arguments); - this.resetRange(); - }, + makeElOption: function (elOption, value, axisModel, axisPointerModel, api) { + var axis = axisModel.axis; + var grid = axis.grid; + var axisPointerType = axisPointerModel.get('type'); + var otherExtent = getCartesian(grid, axis).getOtherAxis(axis).getGlobalExtent(); + var pixelValue = axis.toGlobalCoord(axis.dataToCoord(value, true)); - /** - * @override - */ - mergeOption: function () { - AxisModel.superApply(this, 'mergeOption', arguments); - this.resetRange(); + var elStyle = viewHelper.buildElStyle(axisPointerModel); + var pointerOption = pointerShapeBuilder[axisPointerType](axis, pixelValue, otherExtent, elStyle); + pointerOption.style = elStyle; + + elOption.graphicKey = pointerOption.type; + elOption.pointer = pointerOption; + + var layoutInfo = cartesianAxisHelper.layout(grid.model, axisModel); + viewHelper.buildCartesianSingleLabelElOption( + value, elOption, layoutInfo, axisModel, axisPointerModel, api + ); }, /** * @override */ - restoreData: function () { - AxisModel.superApply(this, 'restoreData', arguments); - this.resetRange(); + getHandleTransform: function (value, axisModel, axisPointerModel) { + var layoutInfo = cartesianAxisHelper.layout(axisModel.axis.grid.model, axisModel, { + labelInside: false + }); + layoutInfo.labelMargin = axisPointerModel.get('handle.margin'); + return { + position: viewHelper.getTransformedPosition(axisModel.axis, value, layoutInfo), + rotation: layoutInfo.rotation + (layoutInfo.labelDirection < 0 ? Math.PI : 0) + }; }, /** * @override - * @return {module:echarts/model/Component} */ - getCoordSysModel: function () { - return this.ecModel.queryComponents({ - mainType: 'grid', - index: this.option.gridIndex, - id: this.option.gridId - })[0]; + updateHandleTransform: function (transform, delta, axisModel, axisPointerModel) { + var axis = axisModel.axis; + var grid = axis.grid; + var axisExtent = axis.getGlobalExtent(true); + var otherExtent = getCartesian(grid, axis).getOtherAxis(axis).getGlobalExtent(); + var dimIndex = axis.dim === 'x' ? 0 : 1; + + var currPosition = transform.position; + currPosition[dimIndex] += delta[dimIndex]; + currPosition[dimIndex] = Math.min(axisExtent[1], currPosition[dimIndex]); + currPosition[dimIndex] = Math.max(axisExtent[0], currPosition[dimIndex]); + + var cursorOtherValue = (otherExtent[1] + otherExtent[0]) / 2; + var cursorPoint = [cursorOtherValue, cursorOtherValue]; + cursorPoint[dimIndex] = currPosition[dimIndex]; + + // Make tooltip do not overlap axisPointer and in the middle of the grid. + var tooltipOptions = [{verticalAlign: 'middle'}, {align: 'center'}]; + + return { + position: currPosition, + rotation: transform.rotation, + cursorPoint: cursorPoint, + tooltipOption: tooltipOptions[dimIndex] + }; } }); - function getAxisType(axisDim, option) { - // Default axis with data is category axis - return option.type || (option.data ? 'category' : 'value'); + function getCartesian(grid, axis) { + var opt = {}; + opt[axis.dim + 'AxisIndex'] = axis.index; + return grid.getCartesian(opt); } - zrUtil.merge(AxisModel.prototype, __webpack_require__(130)); + var pointerShapeBuilder = { - var extraOption = { - // gridIndex: 0, - // gridId: '', + line: function (axis, pixelValue, otherExtent, elStyle) { + var targetShape = viewHelper.makeLineShape( + [pixelValue, otherExtent[0]], + [pixelValue, otherExtent[1]], + getAxisDimIndex(axis) + ); + graphic.subPixelOptimizeLine({ + shape: targetShape, + style: elStyle + }); + return { + type: 'Line', + shape: targetShape + }; + }, - // Offset is for multiple axis on the same position - offset: 0 + shadow: function (axis, pixelValue, otherExtent, elStyle) { + var bandWidth = axis.getBandWidth(); + var span = otherExtent[1] - otherExtent[0]; + return { + type: 'Rect', + shape: viewHelper.makeRectShape( + [pixelValue - bandWidth / 2, otherExtent[0]], + [bandWidth, span], + getAxisDimIndex(axis) + ) + }; + } }; - axisModelCreator('x', AxisModel, getAxisType, extraOption); - axisModelCreator('y', AxisModel, getAxisType, extraOption); + function getAxisDimIndex(axis) { + return axis.dim === 'x' ? 0 : 1; + } - module.exports = AxisModel; + module.exports = CartesianAxisPointer; /***/ }, -/* 128 */ +/* 137 */ /***/ function(module, exports, __webpack_require__) { - + 'use strict'; + - var axisDefault = __webpack_require__(129); var zrUtil = __webpack_require__(4); - var ComponentModel = __webpack_require__(19); - var layout = __webpack_require__(21); + var clazzUtil = __webpack_require__(13); + var graphic = __webpack_require__(44); + var get = __webpack_require__(5).makeGetter(); + var axisPointerModelHelper = __webpack_require__(138); + var eventTool = __webpack_require__(88); + var throttle = __webpack_require__(81); - // FIXME axisType is fixed ? - var AXIS_TYPES = ['value', 'category', 'time', 'log']; + var clone = zrUtil.clone; + var bind = zrUtil.bind; /** - * Generate sub axis model class - * @param {string} axisName 'x' 'y' 'radius' 'angle' 'parallel' - * @param {module:echarts/model/Component} BaseAxisModelClass - * @param {Function} axisTypeDefaulter - * @param {Object} [extraDefaultOption] + * Base axis pointer class in 2D. + * Implemenents {module:echarts/component/axis/IAxisPointer}. */ - module.exports = function (axisName, BaseAxisModelClass, axisTypeDefaulter, extraDefaultOption) { + function BaseAxisPointer () { + } - zrUtil.each(AXIS_TYPES, function (axisType) { + BaseAxisPointer.prototype = { - BaseAxisModelClass.extend({ + /** + * @private + */ + _group: null, - type: axisName + 'Axis.' + axisType, + /** + * @private + */ + _lastGraphicKey: null, - mergeDefaultAndTheme: function (option, ecModel) { - var layoutMode = this.layoutMode; - var inputPositionParams = layoutMode - ? layout.getLayoutParams(option) : {}; + /** + * @private + */ + _handle: null, - var themeModel = ecModel.getTheme(); - zrUtil.merge(option, themeModel.get(axisType + 'Axis')); - zrUtil.merge(option, this.getDefaultOption()); + /** + * @private + */ + _dragging: false, - option.type = axisTypeDefaulter(axisName, option); + /** + * @private + */ + _lastValue: null, - if (layoutMode) { - layout.mergeLayoutParam(option, inputPositionParams, layoutMode); - } - }, + /** + * @private + */ + _lastStatus: null, - defaultOption: zrUtil.mergeAll( - [ - {}, - axisDefault[axisType + 'Axis'], - extraDefaultOption - ], - true - ) - }); - }); + /** + * @private + */ + _payloadInfo: null, - ComponentModel.registerSubTypeDefaulter( - axisName + 'Axis', - zrUtil.curry(axisTypeDefaulter, axisName) - ); - }; + /** + * In px, arbitrary value. Do not set too small, + * no animation is ok for most cases. + * @protected + */ + animationThreshold: 15, + /** + * @implement + */ + render: function (axisModel, axisPointerModel, api, forceRender) { + var value = axisPointerModel.get('value'); + var status = axisPointerModel.get('status'); -/***/ }, -/* 129 */ -/***/ function(module, exports, __webpack_require__) { + // Bind them to `this`, not in closure, otherwise they will not + // be replaced when user calling setOption in not merge mode. + this._axisModel = axisModel; + this._axisPointerModel = axisPointerModel; + this._api = api; - + // Optimize: `render` will be called repeatly during mouse move. + // So it is power consuming if performing `render` each time, + // especially on mobile device. + if (!forceRender + && this._lastValue === value + && this._lastStatus === status + ) { + return; + } + this._lastValue = value; + this._lastStatus = status; - var zrUtil = __webpack_require__(4); + var group = this._group; + var handle = this._handle; - var defaultOption = { - show: true, - zlevel: 0, // 一级层叠 - z: 0, // 二级层叠 - // 反向坐标轴 - inverse: false, + if (!status || status === 'hide') { + // Do not clear here, for animation better. + group && group.hide(); + handle && handle.hide(); + return; + } + group && group.show(); + handle && handle.show(); - // 坐标轴名字,默认为空 - name: '', - // 坐标轴名字位置,支持'start' | 'middle' | 'end' - nameLocation: 'end', - // 坐标轴名字旋转,degree。 - nameRotate: null, // Adapt to axis rotate, when nameLocation is 'middle'. - nameTruncate: { - maxWidth: null, - ellipsis: '...', - placeholder: '.' + // Otherwise status is 'show' + var elOption = {}; + this.makeElOption(elOption, value, axisModel, axisPointerModel, api); + + // Enable change axis pointer type. + var graphicKey = elOption.graphicKey; + if (graphicKey !== this._lastGraphicKey) { + this.clear(api); + } + this._lastGraphicKey = graphicKey; + + var moveAnimation = this._moveAnimation = + this.determineAnimation(axisModel, axisPointerModel); + + if (!group) { + group = this._group = new graphic.Group(); + this.createPointerEl(group, elOption, axisModel, axisPointerModel); + this.createLabelEl(group, elOption, axisModel, axisPointerModel); + api.getZr().add(group); + } + else { + var doUpdateProps = zrUtil.curry(updateProps, axisPointerModel, moveAnimation); + this.updatePointerEl(group, elOption, doUpdateProps, axisPointerModel); + this.updateLabelEl(group, elOption, doUpdateProps, axisPointerModel); + } + + updateMandatoryProps(group, axisPointerModel, true); + + this._renderHandle(value); }, - // 坐标轴文字样式,默认取全局样式 - nameTextStyle: {}, - // 文字与轴线距离 - nameGap: 15, - silent: false, // Default false to support tooltip. - triggerEvent: false, // Default false to avoid legacy user event listener fail. + /** + * @implement + */ + remove: function (api) { + this.clear(api); + }, - tooltip: { - show: false + /** + * @implement + */ + dispose: function (api) { + this.clear(api); }, - // 坐标轴线 - axisLine: { - // 默认显示,属性show控制显示与否 - show: true, - onZero: true, - // 属性lineStyle控制线条样式 - lineStyle: { - color: '#333', - width: 1, - type: 'solid' + /** + * @protected + */ + determineAnimation: function (axisModel, axisPointerModel) { + var animation = axisPointerModel.get('animation'); + var axis = axisModel.axis; + var isCategoryAxis = axis.type === 'category'; + var useSnap = axisPointerModel.get('snap'); + + // Value axis without snap always do not snap. + if (!useSnap && !isCategoryAxis) { + return false; } - }, - // 坐标轴小标记 - axisTick: { - // 属性show控制显示与否,默认显示 - show: true, - // 控制小标记是否在grid里 - inside: false, - // 属性length控制线长 - length: 5, - // 属性lineStyle控制线条样式 - lineStyle: { - width: 1 + + if (animation === 'auto' || animation == null) { + var animationThreshold = this.animationThreshold; + if (isCategoryAxis && axis.getBandWidth() > animationThreshold) { + return true; + } + + // It is important to auto animation when snap used. Consider if there is + // a dataZoom, animation will be disabled when too many points exist, while + // it will be enabled for better visual effect when little points exist. + if (useSnap) { + var seriesDataCount = axisPointerModelHelper.getAxisInfo(axisModel).seriesDataCount; + var axisExtent = axis.getExtent(); + // Approximate band width + return Math.abs(axisExtent[0] - axisExtent[1]) / seriesDataCount > animationThreshold; + } + + return false; } + + return animation === true; }, - // 坐标轴文本标签,详见axis.axisLabel - axisLabel: { - show: true, - // 控制文本标签是否在grid里 - inside: false, - rotate: 0, - margin: 8, - // formatter: null, - // 其余属性默认使用全局文本样式,详见TEXTSTYLE - textStyle: { - fontSize: 12 - } + + /** + * add {pointer, label, graphicKey} to elOption + * @protected + */ + makeElOption: function (elOption, value, axisModel, axisPointerModel, api) { + // Shoule be implemenented by sub-class. }, - // 分隔线 - splitLine: { - // 默认显示,属性show控制显示与否 - show: true, - // 属性lineStyle(详见lineStyle)控制线条样式 - lineStyle: { - color: ['#ccc'], - width: 1, - type: 'solid' - } + + /** + * @protected + */ + createPointerEl: function (group, elOption, axisModel, axisPointerModel) { + var pointerOption = elOption.pointer; + var pointerEl = get(group).pointerEl = new graphic[pointerOption.type]( + clone(elOption.pointer) + ); + group.add(pointerEl); }, - // 分隔区域 - splitArea: { - // 默认不显示,属性show控制显示与否 - show: false, - // 属性areaStyle(详见areaStyle)控制区域样式 - areaStyle: { - color: ['rgba(250,250,250,0.3)','rgba(200,200,200,0.3)'] - } - } - }; - var categoryAxis = zrUtil.merge({ - // 类目起始和结束两端空白策略 - boundaryGap: true, - // splitArea: { - // show: false - // }, - splitLine: { - show: false + /** + * @protected + */ + createLabelEl: function (group, elOption, axisModel, axisPointerModel) { + var labelEl = get(group).labelEl = new graphic.Rect( + clone(elOption.label) + ); + + group.add(labelEl); + updateLabelShowHide(labelEl, axisPointerModel); }, - // 坐标轴小标记 - axisTick: { - // If tick is align with label when boundaryGap is true - // Default with axisTick - alignWithLabel: false, - interval: 'auto' + + /** + * @protected + */ + updatePointerEl: function (group, elOption, updateProps) { + var pointerEl = get(group).pointerEl; + if (pointerEl) { + pointerEl.setStyle(elOption.pointer.style); + updateProps(pointerEl, {shape: elOption.pointer.shape}); + } }, - // 坐标轴文本标签,详见axis.axisLabel - axisLabel: { - interval: 'auto' - } - }, defaultOption); - var valueAxis = zrUtil.merge({ - // 数值起始和结束两端空白策略 - boundaryGap: [0, 0], - // 最小值, 设置成 'dataMin' 则从数据中计算最小值 - // min: null, - // 最大值,设置成 'dataMax' 则从数据中计算最大值 - // max: null, - // Readonly prop, specifies start value of the range when using data zoom. - // rangeStart: null - // Readonly prop, specifies end value of the range when using data zoom. - // rangeEnd: null - // 脱离0值比例,放大聚焦到最终_min,_max区间 - // scale: false, - // 分割段数,默认为5 - splitNumber: 5 - // Minimum interval - // minInterval: null - }, defaultOption); + /** + * @protected + */ + updateLabelEl: function (group, elOption, updateProps, axisPointerModel) { + var labelEl = get(group).labelEl; + if (labelEl) { + labelEl.setStyle(elOption.label.style); + updateProps(labelEl, { + // Consider text length change in vertical axis, animation should + // be used on shape, otherwise the effect will be weird. + shape: elOption.label.shape, + position: elOption.label.position + }); - // FIXME - var timeAxis = zrUtil.defaults({ - scale: true, - min: 'dataMin', - max: 'dataMax' - }, valueAxis); - var logAxis = zrUtil.defaults({ - logBase: 10 - }, valueAxis); - logAxis.scale = true; + updateLabelShowHide(labelEl, axisPointerModel); + } + }, - module.exports = { - categoryAxis: categoryAxis, - valueAxis: valueAxis, - timeAxis: timeAxis, - logAxis: logAxis - }; + /** + * @private + */ + _renderHandle: function (value) { + if (this._dragging || !this.updateHandleTransform) { + return; + } + var axisPointerModel = this._axisPointerModel; + var zr = this._api.getZr(); + var handle = this._handle; + var handleModel = axisPointerModel.getModel('handle'); -/***/ }, -/* 130 */ -/***/ function(module, exports, __webpack_require__) { + var status = axisPointerModel.get('status'); + if (!handleModel.get('show') || !status || status === 'hide') { + handle && zr.remove(handle); + this._handle = null; + return; + } - + var isInit; + if (!this._handle) { + isInit = true; + handle = this._handle = createIcon(handleModel, { + onmousemove: function (e) { + // Fot mobile devicem, prevent screen slider on the button. + eventTool.stop(e.event); + }, + onmousedown: bind(this._onHandleDragMove, this, 0, 0), + drift: bind(this._onHandleDragMove, this), + ondragend: bind(this._onHandleDragEnd, this) + }); + zr.add(handle); + } - var zrUtil = __webpack_require__(4); - var axisHelper = __webpack_require__(115); + updateMandatoryProps(handle, axisPointerModel, false); - function getName(obj) { - if (zrUtil.isObject(obj) && obj.value != null) { - return obj.value; - } - else { - return obj; - } - } + // update style + var includeStyles = [ + 'color', 'borderColor', 'borderWidth', 'opacity', + 'shadowColor', 'shadowBlur', 'shadowOffsetX', 'shadowOffsetY' + ]; + handle.setStyle(handleModel.getItemStyle(null, includeStyles)); - module.exports = { + // update position + var handleSize = handleModel.get('size'); + if (!zrUtil.isArray(handleSize)) { + handleSize = [handleSize, handleSize]; + } + handle.attr('scale', [handleSize[0] / 2, handleSize[1] / 2]); + + throttle.createOrUpdate( + this, + '_doDispatchAxisPointer', + handleModel.get('throttle') || 0, + 'fixRate' + ); + + this._moveHandleToValue(value, isInit); + }, /** - * Format labels - * @return {Array.} + * @private */ - getFormattedLabels: function () { - return axisHelper.getFormattedLabels( - this.axis, - this.get('axisLabel.formatter') + _moveHandleToValue: function (value, isInit) { + updateProps( + this._axisPointerModel, + !isInit && this._moveAnimation, + this._handle, + getHandleTransProps(this.getHandleTransform( + value, this._axisModel, this._axisPointerModel + )) ); }, /** - * Get categories + * @private */ - getCategories: function () { - return this.get('type') === 'category' - && zrUtil.map(this.get('data'), getName); + _onHandleDragMove: function (dx, dy) { + var handle = this._handle; + if (!handle) { + return; + } + + this._dragging = true; + + // Persistent for throttle. + var trans = this.updateHandleTransform( + getHandleTransProps(handle), + [dx, dy], + this._axisModel, + this._axisPointerModel + ); + this._payloadInfo = trans; + + handle.stopAnimation(); + handle.attr(getHandleTransProps(trans)); + get(handle).lastProp = null; + + this._doDispatchAxisPointer(); }, /** - * @param {boolean} origin - * @return {number|string} min value or 'dataMin' or null/undefined (means auto) or NaN + * Throttled method. + * @private */ - getMin: function (origin) { - var option = this.option; - var min = (!origin && option.rangeStart != null) - ? option.rangeStart : option.min; - - if (min != null && min !== 'dataMin' && !zrUtil.eqNaN(min)) { - min = this.axis.scale.parse(min); + _doDispatchAxisPointer: function () { + var handle = this._handle; + if (!handle) { + return; } - return min; + + var payloadInfo = this._payloadInfo; + var payload = { + type: 'updateAxisPointer', + x: payloadInfo.cursorPoint[0], + y: payloadInfo.cursorPoint[1], + tooltipOption: payloadInfo.tooltipOption, + highDownKey: 'axisPointerHandle' + }; + var axis = this._axisModel.axis; + payload[axis.dim + 'AxisId'] = this._axisModel.id; + this._api.dispatchAction(payload); }, /** - * @param {boolean} origin - * @return {number|string} max value or 'dataMax' or null/undefined (means auto) or NaN + * @private */ - getMax: function (origin) { - var option = this.option; - var max = (!origin && option.rangeEnd != null) - ? option.rangeEnd : option.max; - - if (max != null && max !== 'dataMax' && !zrUtil.eqNaN(max)) { - max = this.axis.scale.parse(max); + _onHandleDragEnd: function (moveAnimation) { + this._dragging = false; + var handle = this._handle; + if (!handle) { + return; } - return max; + + var value = this._axisPointerModel.get('value'); + // Consider snap or categroy axis, handle may be not consistent with + // axisPointer. So move handle to align the exact value position when + // drag ended. + this._moveHandleToValue(value); + + // For the effect: tooltip will be shown when finger holding on handle + // button, and will be hidden after finger left handle button. + this._api.dispatchAction({ + type: 'hideTip' + }); }, /** - * @return {boolean} + * Should be implemenented by sub-class if support `handle`. + * @protected + * @param {number} value + * @param {module:echarts/model/Model} axisModel + * @param {module:echarts/model/Model} axisPointerModel + * @return {Object} {position: [x, y], rotation: 0} */ - getNeedCrossZero: function () { - var option = this.option; - return (option.rangeStart != null || option.rangeEnd != null) - ? false : !option.scale; - }, + getHandleTransform: null, /** - * Should be implemented by each axis model if necessary. - * @return {module:echarts/model/Component} coordinate system model + * * Should be implemenented by sub-class if support `handle`. + * @protected + * @param {Object} transform {position, rotation} + * @param {Array.} delta [dx, dy] + * @param {module:echarts/model/Model} axisModel + * @param {module:echarts/model/Model} axisPointerModel + * @return {Object} {position: [x, y], rotation: 0, cursorPoint: [x, y]} */ - getCoordSysModel: zrUtil.noop, + updateHandleTransform: null, /** - * @param {number} rangeStart Can only be finite number or null/undefined or NaN. - * @param {number} rangeEnd Can only be finite number or null/undefined or NaN. + * @private */ - setRange: function (rangeStart, rangeEnd) { - this.option.rangeStart = rangeStart; - this.option.rangeEnd = rangeEnd; + clear: function (api) { + this._lastValue = null; + this._lastStatus = null; + + var zr = api.getZr(); + var group = this._group; + var handle = this._handle; + if (zr && group) { + this._lastGraphicKey = null; + group && zr.remove(group); + handle && zr.remove(handle); + this._group = null; + this._handle = null; + this._payloadInfo = null; + } }, /** - * Reset range + * @protected */ - resetRange: function () { - // rangeStart and rangeEnd is readonly. - this.option.rangeStart = this.option.rangeEnd = null; + doClear: function () { + // Implemented by sub-class if necessary. + }, + + /** + * @protected + * @param {Array.} xy + * @param {Array.} wh + * @param {number} [xDimIndex=0] or 1 + */ + buildLabel: function (xy, wh, xDimIndex) { + xDimIndex = xDimIndex || 0; + return { + x: xy[xDimIndex], + y: xy[1 - xDimIndex], + width: wh[xDimIndex], + height: wh[1 - xDimIndex] + }; } }; + BaseAxisPointer.prototype.constructor = BaseAxisPointer; -/***/ }, -/* 131 */ -/***/ function(module, exports, __webpack_require__) { - 'use strict'; - // TODO boundaryGap + function updateProps(animationModel, moveAnimation, el, props) { + // Animation optimize. + if (!propsEqual(get(el).lastProp, props)) { + get(el).lastProp = props; + moveAnimation + ? graphic.updateProps(el, props, animationModel) + : (el.stopAnimation(), el.attr(props)); + } + } + + function propsEqual(lastProps, newProps) { + if (zrUtil.isObject(lastProps) && zrUtil.isObject(newProps)) { + var equals = true; + zrUtil.each(newProps, function (item, key) { + equals &= propsEqual(lastProps[key], item); + }); + return !!equals; + } + else { + return lastProps === newProps; + } + } + + function updateLabelShowHide(labelEl, axisPointerModel) { + labelEl[axisPointerModel.get('label.show') ? 'show' : 'hide'](); + } + + function getHandleTransProps(trans) { + return { + position: trans.position.slice(), + rotation: trans.rotation || 0 + }; + } + + function createIcon(handleModel, handlers) { + var iconStr = handleModel.get('icon'); + var style = { + x: -1, y: -1, width: 2, height: 2 + }; + var opt = zrUtil.extend({ + style: { + strokeNoScale: true + }, + rectHover: true, + cursor: 'move', + draggable: true + }, handlers); + + return iconStr.indexOf('image://') === 0 + ? ( + style.image = iconStr.slice(8), + opt.style = style, + new graphic.Image(opt) + ) + : graphic.makePath( + iconStr.replace('path://', ''), + opt, + style, + 'center' + ); + } + function updateMandatoryProps(group, axisPointerModel, silent) { + var z = axisPointerModel.get('z'); + var zlevel = axisPointerModel.get('zlevel'); + + group && group.traverse(function (el) { + if (el.type !== 'group') { + z != null && (el.z = z); + zlevel != null && (el.zlevel = zlevel); + el.silent = silent; + } + }); + } - __webpack_require__(127); + clazzUtil.enableClassExtend(BaseAxisPointer); - __webpack_require__(132); + module.exports = BaseAxisPointer; /***/ }, -/* 132 */ +/* 138 */ /***/ function(module, exports, __webpack_require__) { var zrUtil = __webpack_require__(4); - var graphic = __webpack_require__(43); - var AxisBuilder = __webpack_require__(133); - var ifIgnoreOnTick = AxisBuilder.ifIgnoreOnTick; - var getInterval = AxisBuilder.getInterval; + var Model = __webpack_require__(12); + var each = zrUtil.each; + var curry = zrUtil.curry; + + var helper = {}; + + // Build axisPointerModel, mergin tooltip.axisPointer model for each axis. + // allAxesInfo should be updated when setOption performed. + helper.collect = function (ecModel, api) { + var result = { + /** + * key: makeKey(axis.model) + * value: { + * axis, + * coordSys, + * axisPointerModel, + * triggerTooltip, + * involveSeries, + * snap, + * seriesModels, + * seriesDataCount + * } + */ + axesInfo: {}, + seriesInvolved: false, + /** + * key: makeKey(coordSys.model) + * value: Object: key makeKey(axis.model), value: axisInfo + */ + coordSysAxesInfo: {}, + coordSysMap: {} + }; + + collectAxesInfo(result, ecModel, api); + + // Check seriesInvolved for performance, in case too many series in some chart. + result.seriesInvolved && collectSeriesInfo(result, ecModel); + + return result; + }; + + function collectAxesInfo(result, ecModel, api) { + var globalTooltipModel = ecModel.getComponent('tooltip'); + var globalAxisPointerModel = ecModel.getComponent('axisPointer'); + // links can only be set on global. + var linksOption = globalAxisPointerModel.get('link', true) || []; + var linkGroups = []; + + // Collect axes info. + each(api.getCoordinateSystems(), function (coordSys) { + // Some coordinate system do not support axes, like geo. + if (!coordSys.axisPointerEnabled) { + return; + } + + var coordSysKey = makeKey(coordSys.model); + var axesInfoInCoordSys = result.coordSysAxesInfo[coordSysKey] = {}; + result.coordSysMap[coordSysKey] = coordSys; + + // Set tooltip (like 'cross') is a convienent way to show axisPointer + // for user. So we enable seting tooltip on coordSys model. + var coordSysModel = coordSys.model; + var baseTooltipModel = coordSysModel.getModel('tooltip', globalTooltipModel); + + each(coordSys.getAxes(), curry(saveTooltipAxisInfo, false, null)); + + // If axis tooltip used, choose tooltip axis for each coordSys. + // Notice this case: coordSys is `grid` but not `cartesian2D` here. + if (coordSys.getTooltipAxes + && globalTooltipModel + // If tooltip.showContent is set as false, tooltip will not + // show but axisPointer will show as normal. + && baseTooltipModel.get('show') + ) { + // Compatible with previous logic. But series.tooltip.trigger: 'axis' + // or series.data[n].tooltip.trigger: 'axis' are not support any more. + var triggerAxis = baseTooltipModel.get('trigger') === 'axis'; + var cross = baseTooltipModel.get('axisPointer.type') === 'cross'; + var tooltipAxes = coordSys.getTooltipAxes(baseTooltipModel.get('axisPointer.axis')); + if (triggerAxis || cross) { + each(tooltipAxes.baseAxes, curry( + saveTooltipAxisInfo, cross ? 'cross' : true, triggerAxis + )); + } + if (cross) { + each(tooltipAxes.otherAxes, curry(saveTooltipAxisInfo, 'cross', false)); + } + } + + // fromTooltip: true | false | 'cross' + // triggerTooltip: true | false | null + function saveTooltipAxisInfo(fromTooltip, triggerTooltip, axis) { + var axisPointerModel = axis.model.getModel('axisPointer', globalAxisPointerModel); + + var axisPointerShow = axisPointerModel.get('show'); + if (!axisPointerShow || ( + axisPointerShow === 'auto' + && !fromTooltip + && !isHandleTrigger(axisPointerModel) + )) { + return; + } + + if (triggerTooltip == null) { + triggerTooltip = axisPointerModel.get('triggerTooltip'); + } + + axisPointerModel = fromTooltip + ? makeAxisPointerModel( + axis, baseTooltipModel, globalAxisPointerModel, ecModel, + fromTooltip, triggerTooltip + ) + : axisPointerModel; + + var snap = axisPointerModel.get('snap'); + var key = makeKey(axis.model); + var involveSeries = triggerTooltip || snap || axis.type === 'category'; + + // If result.axesInfo[key] exist, override it (tooltip has higher priority). + var axisInfo = result.axesInfo[key] = { + key: key, + axis: axis, + coordSys: coordSys, + axisPointerModel: axisPointerModel, + triggerTooltip: triggerTooltip, + involveSeries: involveSeries, + snap: snap, + useHandle: isHandleTrigger(axisPointerModel), + seriesModels: [] + }; + axesInfoInCoordSys[key] = axisInfo; + result.seriesInvolved |= involveSeries; + + var groupIndex = getLinkGroupIndex(linksOption, axis); + if (groupIndex != null) { + var linkGroup = linkGroups[groupIndex] || (linkGroups[groupIndex] = {axesInfo: {}}); + linkGroup.axesInfo[key] = axisInfo; + linkGroup.mapper = linksOption[groupIndex].mapper; + axisInfo.linkGroup = linkGroup; + } + } + }); + } + + function makeAxisPointerModel( + axis, baseTooltipModel, globalAxisPointerModel, ecModel, fromTooltip, triggerTooltip + ) { + var tooltipAxisPointerModel = baseTooltipModel.getModel('axisPointer'); + var volatileOption = {}; + + each( + [ + 'type', 'snap', 'lineStyle', 'shadowStyle', 'label', + 'animation', 'animationDurationUpdate', 'animationEasingUpdate', 'z' + ], + function (field) { + volatileOption[field] = zrUtil.clone(tooltipAxisPointerModel.get(field)); + } + ); + + // category axis do not auto snap, otherwise some tick that do not + // has value can not be hovered. value/time/log axis default snap if + // triggered from tooltip and trigger tooltip. + volatileOption.snap = axis.type !== 'category' && !!triggerTooltip; + + // Compatibel with previous behavior, tooltip axis do not show label by default. + // Only these properties can be overrided from tooltip to axisPointer. + if (tooltipAxisPointerModel.get('type') === 'cross') { + volatileOption.type = 'line'; + } + var labelOption = volatileOption.label || (volatileOption.label = {}); + // Follow the convention, do not show label when triggered by tooltip by default. + labelOption.show == null && (labelOption.show = false); + + if (fromTooltip === 'cross') { + // When 'cross', both axes show labels. + labelOption.show = true; + // If triggerTooltip, this is a base axis, which should better not use cross style + // (cross style is dashed by default) + if (!triggerTooltip) { + var crossStyle = volatileOption.lineStyle = tooltipAxisPointerModel.get('crossStyle'); + crossStyle && zrUtil.defaults( + labelOption.textStyle || (labelOption.textStyle = {}), + crossStyle.textStyle + ); + } + } + + return axis.model.getModel( + 'axisPointer', + new Model(volatileOption, globalAxisPointerModel, ecModel) + ); + } + + function collectSeriesInfo(result, ecModel) { + // Prepare data for axis trigger + ecModel.eachSeries(function (seriesModel) { + + // Notice this case: this coordSys is `cartesian2D` but not `grid`. + var coordSys = seriesModel.coordinateSystem; + var seriesTooltipTrigger = seriesModel.get('tooltip.trigger', true); + if (!coordSys + || seriesTooltipTrigger === 'none' + || seriesTooltipTrigger === false + || seriesTooltipTrigger === 'item' + || seriesModel.get('axisPointer.show', true) === false + ) { + return; + } + + each(result.coordSysAxesInfo[makeKey(coordSys.model)], function (axisInfo) { + var axis = axisInfo.axis; + if (coordSys.getAxis(axis.dim) === axis) { + axisInfo.seriesModels.push(seriesModel); + axisInfo.seriesDataCount == null && (axisInfo.seriesDataCount = 0); + axisInfo.seriesDataCount += seriesModel.getData().count(); + } + }); + + }, this); + } + + /** + * For example: + * { + * axisPointer: { + * links: [{ + * xAxisIndex: [2, 4], + * yAxisIndex: 'all' + * }, { + * xAxisId: ['a5', 'a7'], + * xAxisName: 'xxx' + * }] + * } + * } + */ + function getLinkGroupIndex(linksOption, axis) { + var axisModel = axis.model; + var dim = axis.dim; + for (var i = 0; i < linksOption.length; i++) { + var linkOption = linksOption[i] || {}; + if (checkPropInLink(linkOption[dim + 'AxisId'], axisModel.id) + || checkPropInLink(linkOption[dim + 'AxisIndex'], axisModel.componentIndex) + || checkPropInLink(linkOption[dim + 'AxisName'], axisModel.name) + ) { + return i; + } + } + } - var axisBuilderAttrs = [ - 'axisLine', 'axisLabel', 'axisTick', 'axisName' - ]; - var selfBuilderAttrs = [ - 'splitArea', 'splitLine' - ]; + function checkPropInLink(linkPropValue, axisPropValue) { + return linkPropValue === 'all' + || (zrUtil.isArray(linkPropValue) && zrUtil.indexOf(linkPropValue, axisPropValue) >= 0) + || linkPropValue === axisPropValue; + } - // function getAlignWithLabel(model, axisModel) { - // var alignWithLabel = model.get('alignWithLabel'); - // if (alignWithLabel === 'auto') { - // alignWithLabel = axisModel.get('axisTick.alignWithLabel'); - // } - // return alignWithLabel; - // } + helper.fixValue = function (axisModel) { + var axisInfo = helper.getAxisInfo(axisModel); + if (!axisInfo) { + return; + } - var AxisView = __webpack_require__(1).extendComponentView({ + var axisPointerModel = axisInfo.axisPointerModel; + var scale = axisInfo.axis.scale; + var option = axisPointerModel.option; + var status = axisPointerModel.get('status'); + var value = axisPointerModel.get('value'); - type: 'axis', + // Parse init value for category and time axis. + if (value != null) { + value = scale.parse(value); + } - render: function (axisModel, ecModel) { + var useHandle = isHandleTrigger(axisPointerModel); + // If `handle` used, `axisPointer` will always be displayed, so value + // and status should be initialized. + if (status == null) { + option.status = useHandle ? 'show' : 'hide'; + } - this.group.removeAll(); + var extent = scale.getExtent().slice(); + extent[0] > extent[1] && extent.reverse(); - var oldAxisGroup = this._axisGroup; - this._axisGroup = new graphic.Group(); + if (// Pick a value on axis when initializing. + value == null + // If both `handle` and `dataZoom` are used, value may be out of axis extent, + // where we should re-pick a value to keep `handle` displaying normally. + || value > extent[1] + ) { + // Make handle displayed on the end of the axis when init, which looks better. + value = extent[1]; + } + if (value < extent[0]) { + value = extent[0]; + } - this.group.add(this._axisGroup); + option.value = value; - if (!axisModel.get('show')) { - return; - } + if (useHandle) { + option.status = axisInfo.axis.scale.isBlank() ? 'hide' : 'show'; + } + }; - var gridModel = axisModel.getCoordSysModel(); + helper.getAxisInfo = function (axisModel) { + var coordSysAxesInfo = axisModel.ecModel.getComponent('axisPointer').coordSysAxesInfo; + return coordSysAxesInfo && coordSysAxesInfo.axesInfo[makeKey(axisModel)]; + }; - var layout = layoutAxis(gridModel, axisModel); + helper.getAxisPointerModel = function (axisModel) { + var axisInfo = helper.getAxisInfo(axisModel); + return axisInfo && axisInfo.axisPointerModel; + }; - var axisBuilder = new AxisBuilder(axisModel, layout); + function isHandleTrigger(axisPointerModel) { + return !!axisPointerModel.get('handle.show'); + } - zrUtil.each(axisBuilderAttrs, axisBuilder.add, axisBuilder); + /** + * @param {module:echarts/model/Model} model + * @return {string} unique key + */ + var makeKey = helper.makeKey = function (model) { + return model.type + '||' + model.id; + }; - this._axisGroup.add(axisBuilder.getGroup()); + module.exports = helper; - zrUtil.each(selfBuilderAttrs, function (name) { - if (axisModel.get(name + '.show')) { - this['_' + name](axisModel, gridModel, layout.labelInterval); - } - }, this); - graphic.groupTransition(oldAxisGroup, this._axisGroup, axisModel); - }, - /** - * @param {module:echarts/coord/cartesian/AxisModel} axisModel - * @param {module:echarts/coord/cartesian/GridModel} gridModel - * @param {number|Function} labelInterval - * @private - */ - _splitLine: function (axisModel, gridModel, labelInterval) { - var axis = axisModel.axis; +/***/ }, +/* 139 */ +/***/ function(module, exports, __webpack_require__) { - if (axis.isBlank()) { - return; - } + 'use strict'; - var splitLineModel = axisModel.getModel('splitLine'); - var lineStyleModel = splitLineModel.getModel('lineStyle'); - var lineColors = lineStyleModel.get('color'); - var lineInterval = getInterval(splitLineModel, labelInterval); + var zrUtil = __webpack_require__(4); + var graphic = __webpack_require__(44); + var textContain = __webpack_require__(8); + var formatUtil = __webpack_require__(6); + var matrix = __webpack_require__(11); + var axisHelper = __webpack_require__(105); + var AxisBuilder = __webpack_require__(135); - lineColors = zrUtil.isArray(lineColors) ? lineColors : [lineColors]; + var helper = {}; - var gridRect = gridModel.coordinateSystem.getRect(); - var isHorizontal = axis.isHorizontal(); + /** + * @param {module:echarts/model/Model} axisPointerModel + */ + helper.buildElStyle = function (axisPointerModel) { + var axisPointerType = axisPointerModel.get('type'); + var styleModel = axisPointerModel.getModel(axisPointerType + 'Style'); + var style; + if (axisPointerType === 'line') { + style = styleModel.getLineStyle(); + style.fill = null; + } + else if (axisPointerType === 'shadow') { + style = styleModel.getAreaStyle(); + style.stroke = null; + } + return style; + }; - var lineCount = 0; + /** + * @param {Function} labelPos {align, verticalAlign, position} + */ + helper.buildLabelElOption = function ( + elOption, axisModel, axisPointerModel, api, labelPos + ) { + var value = axisPointerModel.get('value'); + var text = helper.getValueLabel( + value, axisModel.axis, axisModel.ecModel, + axisPointerModel.get('seriesDataIndices'), + { + precision: axisPointerModel.get('label.precision'), + formatter: axisPointerModel.get('label.formatter') + } + ); + var labelModel = axisPointerModel.getModel('label'); + var textStyleModel = labelModel.getModel('textStyle'); + var paddings = formatUtil.normalizeCssArray(labelModel.get('padding') || 0); - var ticksCoords = axis.getTicksCoords( - // splitLineModel.get('alignWithLabel') - ); - var ticks = axis.scale.getTicks(); + var font = textStyleModel.getFont(); + var textRect = textContain.getBoundingRect( + text, font, labelPos.textAlign, labelPos.textBaseline + ); - var p1 = []; - var p2 = []; - // Simple optimization - // Batching the lines if color are the same - var lineStyle = lineStyleModel.getLineStyle(); - for (var i = 0; i < ticksCoords.length; i++) { - if (ifIgnoreOnTick(axis, i, lineInterval)) { - continue; - } + var position = labelPos.position; + var width = textRect.width + paddings[1] + paddings[3]; + var height = textRect.height + paddings[0] + paddings[2]; - var tickCoord = axis.toGlobalCoord(ticksCoords[i]); + // Adjust by align. + var align = labelPos.align; + align === 'right' && (position[0] -= width); + align === 'center' && (position[0] -= width / 2); + var verticalAlign = labelPos.verticalAlign; + verticalAlign === 'bottom' && (position[1] -= height); + verticalAlign === 'middle' && (position[1] -= height / 2); - if (isHorizontal) { - p1[0] = tickCoord; - p1[1] = gridRect.y; - p2[0] = tickCoord; - p2[1] = gridRect.y + gridRect.height; - } - else { - p1[0] = gridRect.x; - p1[1] = tickCoord; - p2[0] = gridRect.x + gridRect.width; - p2[1] = tickCoord; - } + // Not overflow ec container + confineInContainer(position, width, height, api); - var colorIndex = (lineCount++) % lineColors.length; - this._axisGroup.add(new graphic.Line(graphic.subPixelOptimizeLine({ - anid: 'line_' + ticks[i], + var bgColor = labelModel.get('backgroundColor'); + if (!bgColor || bgColor === 'auto') { + bgColor = axisModel.get('axisLine.lineStyle.color'); + } - shape: { - x1: p1[0], - y1: p1[1], - x2: p2[0], - y2: p2[1] - }, - style: zrUtil.defaults({ - stroke: lineColors[colorIndex] - }, lineStyle), - silent: true - }))); + elOption.label = { + shape: {x: 0, y: 0, width: width, height: height, r: labelModel.get('borderRadius')}, + position: position.slice(), + style: { + text: text, + textFont: font, + textFill: textStyleModel.getTextColor(), + textPosition: 'inside', + fill: bgColor, + stroke: labelModel.get('borderColor') || 'transparent', + lineWidth: labelModel.get('borderWidth') || 0, + shadowBlur: labelModel.get('shadowBlur'), + shadowColor: labelModel.get('shadowColor'), + shadowOffsetX: labelModel.get('shadowOffsetX'), + shadowOffsetY: labelModel.get('shadowOffsetY') } - }, + }; + }; - /** - * @param {module:echarts/coord/cartesian/AxisModel} axisModel - * @param {module:echarts/coord/cartesian/GridModel} gridModel - * @param {number|Function} labelInterval - * @private - */ - _splitArea: function (axisModel, gridModel, labelInterval) { - var axis = axisModel.axis; + // Do not overflow ec container + function confineInContainer(position, width, height, api) { + var viewWidth = api.getWidth(); + var viewHeight = api.getHeight(); + position[0] = Math.min(position[0] + width, viewWidth) - width; + position[1] = Math.min(position[1] + height, viewHeight) - height; + position[0] = Math.max(position[0], 0); + position[1] = Math.max(position[1], 0); + } - if (axis.isBlank()) { - return; - } + /** + * @param {number} value + * @param {module:echarts/coord/Axis} axis + * @param {module:echarts/model/Global} ecModel + * @param {Object} opt + * @param {Array.} seriesDataIndices + * @param {number|string} opt.precision 'auto' or a number + * @param {string|Function} opt.formatter label formatter + */ + helper.getValueLabel = function (value, axis, ecModel, seriesDataIndices, opt) { + var text = axis.scale.getLabel( + // Use 'pad' to try to fix width, which helps to debounce when when moving label. + value, {precision: opt.precision, pad: true} + ); + var formatter = opt.formatter; - var splitAreaModel = axisModel.getModel('splitArea'); - var areaStyleModel = splitAreaModel.getModel('areaStyle'); - var areaColors = areaStyleModel.get('color'); + if (formatter) { + var params = { + value: axisHelper.getAxisRawValue(axis, value), + seriesData: [] + }; + zrUtil.each(seriesDataIndices, function (idxItem) { + var series = ecModel.getSeriesByIndex(idxItem.seriesIndex); + var dataIndex = idxItem.dataIndexInside; + var dataParams = series && series.getDataParams(dataIndex); + dataParams && params.seriesData.push(dataParams); + }); - var gridRect = gridModel.coordinateSystem.getRect(); + if (zrUtil.isString(formatter)) { + text = formatter.replace('{value}', text); + } + else if (zrUtil.isFunction(formatter)) { + text = formatter(params); + } + } - var ticksCoords = axis.getTicksCoords( - // splitAreaModel.get('alignWithLabel') - ); - var ticks = axis.scale.getTicks(); + return text; + }; - var prevX = axis.toGlobalCoord(ticksCoords[0]); - var prevY = axis.toGlobalCoord(ticksCoords[0]); + /** + * @param {module:echarts/coord/Axis} axis + * @param {number} value + * @param {Object} layoutInfo { + * rotation, position, labelOffset, labelDirection, labelMargin + * } + */ + helper.getTransformedPosition = function (axis, value, layoutInfo) { + var transform = matrix.create(); + matrix.rotate(transform, transform, layoutInfo.rotation); + matrix.translate(transform, transform, layoutInfo.position); - var count = 0; + return graphic.applyTransform([ + axis.dataToCoord(value), + (layoutInfo.labelOffset || 0) + + (layoutInfo.labelDirection || 1) * (layoutInfo.labelMargin || 0) + ], transform); + }; - var areaInterval = getInterval(splitAreaModel, labelInterval); + helper.buildCartesianSingleLabelElOption = function ( + value, elOption, layoutInfo, axisModel, axisPointerModel, api + ) { + var textLayout = AxisBuilder.innerTextLayout( + layoutInfo.rotation, 0, layoutInfo.labelDirection + ); + layoutInfo.labelMargin = axisPointerModel.get('label.margin'); + helper.buildLabelElOption(elOption, axisModel, axisPointerModel, api, { + position: helper.getTransformedPosition(axisModel.axis, value, layoutInfo), + align: textLayout.textAlign, + verticalAlign: textLayout.textVerticalAlign + }); + }; - var areaStyle = areaStyleModel.getAreaStyle(); - areaColors = zrUtil.isArray(areaColors) ? areaColors : [areaColors]; + /** + * @param {Array.} p1 + * @param {Array.} p2 + * @param {number} [xDimIndex=0] or 1 + */ + helper.makeLineShape = function (p1, p2, xDimIndex) { + xDimIndex = xDimIndex || 0; + return { + x1: p1[xDimIndex], + y1: p1[1 - xDimIndex], + x2: p2[xDimIndex], + y2: p2[1 - xDimIndex] + }; + }; - for (var i = 1; i < ticksCoords.length; i++) { - if (ifIgnoreOnTick(axis, i, areaInterval)) { - continue; - } + /** + * @param {Array.} xy + * @param {Array.} wh + * @param {number} [xDimIndex=0] or 1 + */ + helper.makeRectShape = function (xy, wh, xDimIndex) { + xDimIndex = xDimIndex || 0; + return { + x: xy[xDimIndex], + y: xy[1 - xDimIndex], + width: wh[xDimIndex], + height: wh[1 - xDimIndex] + }; + }; - var tickCoord = axis.toGlobalCoord(ticksCoords[i]); + helper.makeSectorShape = function (cx, cy, r0, r, startAngle, endAngle) { + return { + cx: cx, + cy: cy, + r0: r0, + r: r, + startAngle: startAngle, + endAngle: endAngle, + clockwise: true + }; + }; - var x; - var y; - var width; - var height; - if (axis.isHorizontal()) { - x = prevX; - y = gridRect.y; - width = tickCoord - x; - height = gridRect.height; - } - else { - x = gridRect.x; - y = prevY; - width = gridRect.width; - height = tickCoord - y; - } + module.exports = helper; - var colorIndex = (count++) % areaColors.length; - this._axisGroup.add(new graphic.Rect({ - anid: 'area_' + ticks[i], - shape: { - x: x, - y: y, - width: width, - height: height - }, - style: zrUtil.defaults({ - fill: areaColors[colorIndex] - }, areaStyle), - silent: true - })); +/***/ }, +/* 140 */ +/***/ function(module, exports, __webpack_require__) { - prevX = x + width; - prevY = y + height; - } - } - }); + - AxisView.extend({ - type: 'xAxis' - }); - AxisView.extend({ - type: 'yAxis' - }); + var zrUtil = __webpack_require__(4); + + var helper = {}; /** - * @inner + * @param {Object} opt {labelInside} + * @return {Object} { + * position, rotation, labelDirection, labelOffset, + * tickDirection, labelRotate, labelInterval, z2 + * } */ - function layoutAxis(gridModel, axisModel) { + helper.layout = function (gridModel, axisModel, opt) { + opt = opt || {}; var grid = gridModel.coordinateSystem; var axis = axisModel.axis; var layout = {}; @@ -28624,20 +31077,18 @@ return /******/ (function(modules) { // webpackBootstrap var dirMap = {top: -1, bottom: 1, left: -1, right: 1}; layout.labelDirection = layout.tickDirection = layout.nameDirection = dirMap[rawAxisPosition]; - if (axis.onZero) { - layout.labelOffset = posMap[axisDim][rawAxisPosition] - posMap[axisDim].onZero; - } + layout.labelOffset = axis.onZero ? posMap[axisDim][rawAxisPosition] - posMap[axisDim].onZero : 0; - if (axisModel.getModel('axisTick').get('inside')) { + if (axisModel.get('axisTick.inside')) { layout.tickDirection = -layout.tickDirection; } - if (axisModel.getModel('axisLabel').get('inside')) { + if (zrUtil.retrieve(opt.labelInside, axisModel.get('axisLabel.inside'))) { layout.labelDirection = -layout.labelDirection; } // Special label rotation - var labelRotation = axisModel.getModel('axisLabel').get('rotate'); - layout.labelRotation = axisPosition === 'top' ? -labelRotation : labelRotation; + var labelRotate = axisModel.get('axisLabel.rotate'); + layout.labelRotate = axisPosition === 'top' ? -labelRotate : labelRotate; // label interval when auto mode. layout.labelInterval = axis.getLabelInterval(); @@ -28646,623 +31097,902 @@ return /******/ (function(modules) { // webpackBootstrap layout.z2 = 1; return layout; - } + }; + + module.exports = helper; + /***/ }, -/* 133 */ +/* 141 */ /***/ function(module, exports, __webpack_require__) { - var zrUtil = __webpack_require__(4); - var formatUtil = __webpack_require__(6); - var graphic = __webpack_require__(43); - var Model = __webpack_require__(12); - var numberUtil = __webpack_require__(7); - var remRadian = numberUtil.remRadian; - var isRadianAroundZero = numberUtil.isRadianAroundZero; - var vec2 = __webpack_require__(10); - var v2ApplyTransform = vec2.applyTransform; - var retrieve = zrUtil.retrieve; - - var PI = Math.PI; - - function makeAxisEventDataBase(axisModel) { - var eventData = { - componentType: axisModel.mainType - }; - eventData[axisModel.mainType + 'Index'] = axisModel.componentIndex; - return eventData; - } + var axisPointerModelHelper = __webpack_require__(138); /** - * A final axis is translated and rotated from a "standard axis". - * So opt.position and opt.rotation is required. - * - * A standard axis is and axis from [0, 0] to [0, axisExtent[1]], - * for example: (0, 0) ------------> (0, 50) - * - * nameDirection or tickDirection or labelDirection is 1 means tick - * or label is below the standard axis, whereas is -1 means above - * the standard axis. labelOffset means offset between label and axis, - * which is useful when 'onZero', where axisLabel is in the grid and - * label in outside grid. - * - * Tips: like always, - * positive rotation represents anticlockwise, and negative rotation - * represents clockwise. - * The direction of position coordinate is the same as the direction - * of screen coordinate. - * - * Do not need to consider axis 'inverse', which is auto processed by - * axis extent. - * - * @param {module:zrender/container/Group} group - * @param {Object} axisModel - * @param {Object} opt Standard axis parameters. - * @param {Array.} opt.position [x, y] - * @param {number} opt.rotation by radian - * @param {number} [opt.nameDirection=1] 1 or -1 Used when nameLocation is 'middle'. - * @param {number} [opt.tickDirection=1] 1 or -1 - * @param {number} [opt.labelDirection=1] 1 or -1 - * @param {number} [opt.labelOffset=0] Usefull when onZero. - * @param {string} [opt.axisLabelShow] default get from axisModel. - * @param {string} [opt.axisName] default get from axisModel. - * @param {number} [opt.axisNameAvailableWidth] - * @param {number} [opt.labelRotation] by degree, default get from axisModel. - * @param {number} [opt.labelInterval] Default label interval when label - * interval from model is null or 'auto'. - * @param {number} [opt.strokeContainThreshold] Default label interval when label + * Base class of AxisView. */ - var AxisBuilder = function (axisModel, opt) { + var AxisView = __webpack_require__(1).extendComponentView({ + + type: 'axis', /** - * @readOnly + * @private */ - this.opt = opt; + _axisPointer: null, + + axisPointerClass: null, /** - * @readOnly + * @override */ - this.axisModel = axisModel; + render: function (axisModel, ecModel, api, payload) { + // FIXME + // This process should proformed after coordinate systems updated + // (axis scale updated), and should be performed each time update. + // So put it here temporarily, although it is not appropriate to + // put a model-writing procedure in `view`. + axisPointerModelHelper.fixValue(axisModel); - // Default value - zrUtil.defaults( - opt, - { - labelOffset: 0, - nameDirection: 1, - tickDirection: 1, - labelDirection: 1, - silent: true - } - ); + AxisView.superApply(this, 'render', arguments); + updateAxisPointer(this, axisModel, ecModel, api, payload, true); + }, /** - * @readOnly + * Action handler. + * @public + * @param {module:echarts/coord/cartesian/AxisModel} axisModel + * @param {module:echarts/model/Global} ecModel + * @param {module:echarts/ExtensionAPI} api + * @param {Object} payload */ - this.group = new graphic.Group(); + updateAxisPointer: function (axisModel, ecModel, api, payload, force) { + updateAxisPointer(this, axisModel, ecModel, api, payload, false); + }, - // FIXME Not use a seperate text group? - var dumbGroup = new graphic.Group({ - position: opt.position.slice(), - rotation: opt.rotation + /** + * @override + */ + remove: function (ecModel, api) { + var axisPointer = this._axisPointer; + axisPointer && axisPointer.remove(api); + AxisView.superApply(this, 'remove', arguments); + }, + + /** + * @override + */ + dispose: function (ecModel, api) { + disposeAxisPointer(this, api); + AxisView.superApply(this, 'dispose', arguments); + } + + }); + + function updateAxisPointer(axisView, axisModel, ecModel, api, payload, forceRender) { + if (!axisView.axisPointerClass) { + return; + } + var axisPointerModel = axisPointerModelHelper.getAxisPointerModel(axisModel); + axisPointerModel + ? (axisView._axisPointer || (axisView._axisPointer = new axisView.axisPointerClass())) + .render(axisModel, axisPointerModel, api, forceRender) + : disposeAxisPointer(axisView, api); + } + + function disposeAxisPointer(axisView, ecModel, api) { + var axisPointer = axisView._axisPointer; + axisPointer && axisPointer.dispose(ecModel, api); + axisView._axisPointer = null; + } + + module.exports = AxisView; + + +/***/ }, +/* 142 */ +/***/ function(module, exports, __webpack_require__) { + + + + var echarts = __webpack_require__(1); + var axisPointerModelHelper = __webpack_require__(138); + var axisTrigger = __webpack_require__(143); + var zrUtil = __webpack_require__(4); + + __webpack_require__(145); + __webpack_require__(146); + + echarts.registerPreprocessor(function (option) { + // Always has a global axisPointerModel for default setting. + if (option) { + (!option.axisPointer || option.axisPointer.length === 0) + && (option.axisPointer = {}); + + var link = option.axisPointer.link; + // Normalize to array to avoid object mergin. But if link + // is not set, remain null/undefined, otherwise it will + // override existent link setting. + if (link && !zrUtil.isArray(link)) { + option.axisPointer.link = [link]; + } + } + }); + + // This process should proformed after coordinate systems created + // and series data processed. So put it on statistic processing stage. + echarts.registerProcessor(echarts.PRIORITY.PROCESSOR.STATISTIC, function (ecModel, api) { + // Build axisPointerModel, mergin tooltip.axisPointer model for each axis. + // allAxesInfo should be updated when setOption performed. + ecModel.getComponent('axisPointer').coordSysAxesInfo + = axisPointerModelHelper.collect(ecModel, api); + }); + + // Broadcast to all views. + echarts.registerAction({ + type: 'updateAxisPointer', + event: 'updateAxisPointer', + update: ':updateAxisPointer' + }, function (payload, ecModel, api) { + var outputFinder = axisTrigger( + ecModel.getComponent('axisPointer').coordSysAxesInfo, + payload.currTrigger, + payload, + payload.dispatchAction || zrUtil.bind(api.dispatchAction, api), + ecModel, + api, + payload.tooltipOption, + payload.highDownKey + ); + + return outputFinder; + }); + + + +/***/ }, +/* 143 */ +/***/ function(module, exports, __webpack_require__) { + + + + var zrUtil = __webpack_require__(4); + var modelUtil = __webpack_require__(5); + var modelHelper = __webpack_require__(138); + var findPointFromSeries = __webpack_require__(144); + + var each = zrUtil.each; + var curry = zrUtil.curry; + var get = modelUtil.makeGetter(); + + /** + * Basic logic: check all axis, if they do not demand show/highlight, + * then hide/downplay them. + * + * @param {Object} coordSysAxesInfo + * @param {string} currTrigger 'click' | 'mousemove' | 'leave' + * @param {Object} finder {x, y, xAxisId: ...[], yAxisName: ...[], angleAxisIndex: ...[]} + * x and y, which are mandatory, specify a point to tigger axisPointer and tooltip. + * other properties, which are optional, restrict target axes. + * @param {Function} dispatchAction + * @param {module:echarts/ExtensionAPI} api + * @param {Object} tooltipOption + * @param {string} [highDownKey] + * @return {Object} content of event obj for echarts.connect. + */ + function axisTrigger( + coordSysAxesInfo, currTrigger, finder, dispatchAction, + ecModel, api, tooltipOption, highDownKey + ) { + var point = []; + if (finder.x != null && finder.y != null) { + point = [finder.x, finder.y]; + } + else { + point = findPointFromSeries({ + seriesIndex: finder.seriesIndex, + // Do not use dataIndexInside from other ec instance. + // FIXME: auto detect it? + dataIndex: finder.dataIndex + }, ecModel).point; + } + + var axesInfo = coordSysAxesInfo.axesInfo; + var shouldHide = currTrigger === 'leave' || illegalPoint(point); + var outputFinder = {}; + + var showValueMap = {}; + var dataByCoordSys = {list: [], map: {}}; + var highlightBatch = []; + var updaters = { + showPointer: curry(showPointer, showValueMap), + showTooltip: curry(showTooltip, dataByCoordSys), + highlight: curry(highlight, highlightBatch) + }; + + // Process for triggered axes. + each(coordSysAxesInfo.coordSysMap, function (coordSys, coordSysKey) { + var coordSysContainsPoint = coordSys.containPoint(point); + + each(coordSysAxesInfo.coordSysAxesInfo[coordSysKey], function (axisInfo, key) { + var axis = axisInfo.axis; + if (!shouldHide && coordSysContainsPoint && !notTargetAxis(finder, axis)) { + processOnAxis(axisInfo, axis.pointToData(point), updaters, false, outputFinder); + } + }); }); - // this.group.add(dumbGroup); - // this._dumbGroup = dumbGroup; + // Process for linked axes. + each(axesInfo, function (tarAxisInfo, tarKey) { + var linkGroup = tarAxisInfo.linkGroup; + + // If axis has been triggered in the previous stage, it should not be triggered by link. + linkGroup && !showValueMap[tarKey] && each(linkGroup.axesInfo, function (srcAxisInfo, srcKey) { + var srcValItem = showValueMap[srcKey]; + // If srcValItem exist, source axis is triggered, so link to target axis. + if (srcAxisInfo !== tarAxisInfo && srcValItem) { + var val = srcValItem.value; + linkGroup.mapper && (val = tarAxisInfo.axis.scale.parse(linkGroup.mapper( + val, makeMapperParam(srcAxisInfo), makeMapperParam(tarAxisInfo) + ))); + processOnAxis(tarAxisInfo, val, updaters, true, outputFinder); + } + }); + }); - dumbGroup.updateTransform(); - this._transform = dumbGroup.transform; + updateModelActually(showValueMap, axesInfo); + dispatchTooltipActually(dataByCoordSys, point, tooltipOption, dispatchAction); + dispatchHighDownActually(highlightBatch, dispatchAction, api, highDownKey); - this._dumbGroup = dumbGroup; - }; + return outputFinder; + } - AxisBuilder.prototype = { + function processOnAxis(axisInfo, newValue, updaters, dontSnap, outputFinder) { + var axis = axisInfo.axis; - constructor: AxisBuilder, + if (axis.scale.isBlank() || !axis.containData(newValue)) { + return; + } - hasBuilder: function (name) { - return !!builders[name]; - }, + if (!axisInfo.involveSeries) { + updaters.showPointer(axisInfo, newValue); + return; + } + + // Heavy calculation. So put it after axis.containData checking. + var payloadInfo = buildPayloadsBySeries(newValue, axisInfo); + var payloadBatch = payloadInfo.payloadBatch; + var snapToValue = payloadInfo.snapToValue; + + // Fill content of event obj for echarts.connect. + // By defualt use the first involved series data as a sample to connect. + if (payloadBatch[0] && outputFinder.seriesIndex == null) { + zrUtil.extend(outputFinder, payloadBatch[0]); + } + + // If no linkSource input, this process is for collecting link + // target, where snap should not be accepted. + if (!dontSnap && axisInfo.snap) { + if (axis.containData(snapToValue) && snapToValue != null) { + newValue = snapToValue; + } + } + + updaters.highlight('highlight', payloadBatch); + updaters.showPointer(axisInfo, newValue, payloadBatch); + // Tooltip should always be snapToValue, otherwise there will be + // incorrect "axis value ~ series value" mapping displayed in tooltip. + updaters.showTooltip(axisInfo, payloadInfo, snapToValue); + } + + function buildPayloadsBySeries(value, axisInfo) { + var axis = axisInfo.axis; + var dim = axis.dim; + var snapToValue = value; + var payloadBatch = []; + var minDist = Number.MAX_VALUE; + var minDiff = -1; + + each(axisInfo.seriesModels, function (series, idx) { + var dataDim = series.coordDimToDataDim(dim); + var seriesNestestValue; + var dataIndices; + + if (series.getAxisTooltipData) { + var result = series.getAxisTooltipData(dataDim, value, axis); + dataIndices = result.dataIndices; + seriesNestestValue = result.nestestValue; + } + else { + dataIndices = series.getData().indexOfNearest( + dataDim[0], + value, + // Add a threshold to avoid find the wrong dataIndex + // when data length is not same. + false, axis.type === 'category' ? 0.5 : null + ); + if (!dataIndices.length) { + return; + } + seriesNestestValue = series.getData().get(dataDim[0], dataIndices[0]); + } + + if (seriesNestestValue == null || !isFinite(seriesNestestValue)) { + return; + } + + var diff = value - seriesNestestValue; + var dist = Math.abs(diff); + // Consider category case + if (dist <= minDist) { + if (dist < minDist || (diff >= 0 && minDiff < 0)) { + minDist = dist; + minDiff = diff; + snapToValue = seriesNestestValue; + payloadBatch.length = 0; + } + each(dataIndices, function (dataIndex) { + payloadBatch.push({ + seriesIndex: series.seriesIndex, + dataIndexInside: dataIndex, + dataIndex: series.getData().getRawIndex(dataIndex) + }); + }); + } + }); + + return { + payloadBatch: payloadBatch, + snapToValue: snapToValue + }; + } + + function showPointer(showValueMap, axisInfo, value, payloadBatch) { + showValueMap[axisInfo.key] = {value: value, payloadBatch: payloadBatch}; + } + + function showTooltip(dataByCoordSys, axisInfo, payloadInfo, value) { + var payloadBatch = payloadInfo.payloadBatch; + var axis = axisInfo.axis; + var axisModel = axis.model; + var axisPointerModel = axisInfo.axisPointerModel; + + // If no data, do not create anything in dataByCoordSys, + // whose length will be used to judge whether dispatch action. + if (!axisInfo.triggerTooltip || !payloadBatch.length) { + return; + } + + var coordSysModel = axisInfo.coordSys.model; + var coordSysKey = modelHelper.makeKey(coordSysModel); + var coordSysItem = dataByCoordSys.map[coordSysKey]; + if (!coordSysItem) { + coordSysItem = dataByCoordSys.map[coordSysKey] = { + coordSysId: coordSysModel.id, + coordSysIndex: coordSysModel.componentIndex, + coordSysType: coordSysModel.type, + coordSysMainType: coordSysModel.mainType, + dataByAxis: [] + }; + dataByCoordSys.list.push(coordSysItem); + } + + coordSysItem.dataByAxis.push({ + axisDim: axis.dim, + axisIndex: axisModel.componentIndex, + axisType: axisModel.type, + axisId: axisModel.id, + value: value, + // Caustion: viewHelper.getValueLabel is actually on "view stage", which + // depends that all models have been updated. So it should not be performed + // here. Considering axisPointerModel used here is volatile, which is hard + // to be retrieve in TooltipView, we prepare parameters here. + valueLabelOpt: { + precision: axisPointerModel.get('label.precision'), + formatter: axisPointerModel.get('label.formatter') + }, + seriesDataIndices: payloadBatch.slice() + }); + } + + function highlight(highlightBatch, actionType, batch) { + highlightBatch.push.apply(highlightBatch, batch); + } + + function updateModelActually(showValueMap, axesInfo) { + // Basic logic: If no 'show' required, 'hide' this axisPointer. + each(axesInfo, function (axisInfo, key) { + var option = axisInfo.axisPointerModel.option; + var valItem = showValueMap[key]; + + if (valItem) { + !axisInfo.useHandle && (option.status = 'show'); + option.value = valItem.value; + // For label formatter param. + option.seriesDataIndices = (valItem.payloadBatch || []).slice(); + } + // When always show (e.g., handle used), remain + // original value and status. + else { + // If hide, value still need to be set, consider + // click legend to toggle axis blank. + !axisInfo.useHandle && (option.status = 'hide'); + } + }); + } + + function dispatchTooltipActually(dataByCoordSys, point, tooltipOption, dispatchAction) { + // Basic logic: If no showTip required, hideTip will be dispatched. + if (illegalPoint(point) || !dataByCoordSys.list.length) { + dispatchAction({type: 'hideTip'}); + return; + } + + // In most case only one axis (or event one series is used). It is + // convinient to fetch payload.seriesIndex and payload.dataIndex + // dirtectly. So put the first seriesIndex and dataIndex of the first + // axis on the payload. + var sampleItem = ((dataByCoordSys.list[0].dataByAxis[0] || {}).seriesDataIndices || [])[0] || {}; + + dispatchAction({ + type: 'showTip', + escapeConnect: true, + x: point[0], + y: point[1], + tooltipOption: tooltipOption, + dataIndexInside: sampleItem.dataIndexInside, + dataIndex: sampleItem.dataIndex, + seriesIndex: sampleItem.seriesIndex, + dataByCoordSys: dataByCoordSys.list + }); + } + + function dispatchHighDownActually(highlightBatch, dispatchAction, api, highDownKey) { + // Basic logic: If nothing highlighted, should downplay all highlighted items. + // This case will occur when mouse leave coordSys. + + // FIXME + // (1) highlight status shoule be managemented in series.getData()? + // (2) If axisPointer A triggerOn 'handle' and axisPointer B triggerOn + // 'mousemove', items highlighted by A will be downplayed by B. + // It will not be fixed until someone requires this scenario. + + // Consider items area hightlighted by 'handle', and globalListener may + // downplay all items (including just highlighted ones) when mousemove. + // So we use a highDownKey to separate them as a temporary solution. + var zr = api.getZr(); + highDownKey = 'lastHighlights' + (highDownKey || ''); + var lastHighlights = get(zr)[highDownKey] || {}; + var newHighlights = get(zr)[highDownKey] = {}; + + // Build hash map and remove duplicate incidentally. + zrUtil.each(highlightBatch, function (batchItem) { + var key = batchItem.seriesIndex + ' | ' + batchItem.dataIndex; + newHighlights[key] = batchItem; + }); + + // Diff. + var toHighlight = []; + var toDownplay = []; + zrUtil.each(lastHighlights, function (batchItem, key) { + !newHighlights[key] && toDownplay.push(batchItem); + }); + zrUtil.each(newHighlights, function (batchItem, key) { + !lastHighlights[key] && toHighlight.push(batchItem); + }); - add: function (name) { - builders[name].call(this); - }, + toDownplay.length && api.dispatchAction({ + type: 'downplay', escapeConnect: true, batch: toDownplay + }); + toHighlight.length && api.dispatchAction({ + type: 'highlight', escapeConnect: true, batch: toHighlight + }); + } - getGroup: function () { - return this.group; - } + function notTargetAxis(finder, axis) { + var isTarget = 1; + // If none of xxxAxisId and xxxAxisName and xxxAxisIndex exists in finder, + // no axis is not target axis. + each(finder, function (value, propName) { + isTarget &= !(/^.+(AxisId|AxisName|AxisIndex)$/.test(propName)); + }); + !isTarget && each( + [['AxisId', 'id'], ['AxisIndex', 'componentIndex'], ['AxisName', 'name']], + function (prop) { + var vals = modelUtil.normalizeToArray(finder[axis.dim + prop[0]]); + isTarget |= zrUtil.indexOf(vals, axis.model[prop[1]]) >= 0; + } + ); + return !isTarget; + } - }; + function makeMapperParam(axisInfo) { + var axisModel = axisInfo.axis.model; + var item = {}; + var dim = item.axisDim = axisInfo.axis.dim; + item.axisIndex = item[dim + 'AxisIndex'] = axisModel.componentIndex; + item.axisName = item[dim + 'AxisName'] = axisModel.name; + item.axisId = item[dim + 'AxisId'] = axisModel.id; + return item; + } - var builders = { + function illegalPoint(point) { + return point[0] == null || isNaN(point[0]) || point[1] == null || isNaN(point[1]); + } - /** - * @private - */ - axisLine: function () { - var opt = this.opt; - var axisModel = this.axisModel; + module.exports = axisTrigger; - if (!axisModel.get('axisLine.show')) { - return; - } - var extent = this.axisModel.axis.getExtent(); +/***/ }, +/* 144 */ +/***/ function(module, exports, __webpack_require__) { - var matrix = this._transform; - var pt1 = [extent[0], 0]; - var pt2 = [extent[1], 0]; - if (matrix) { - v2ApplyTransform(pt1, pt1, matrix); - v2ApplyTransform(pt2, pt2, matrix); - } + - this.group.add(new graphic.Line(graphic.subPixelOptimizeLine({ + var zrUtil = __webpack_require__(4); + var modelUtil = __webpack_require__(5); - // Id for animation - anid: 'line', + /** + * @param {Object} finder contains {seriesIndex, dataIndex, dataIndexInside} + * @param {module:echarts/model/Global} ecModel + * @return {Object} {point: [x, y], el: ...} point Will not be null. + */ + module.exports = function (finder, ecModel) { + var point = []; + var seriesIndex = finder.seriesIndex; + var seriesModel; + if (seriesIndex == null || !( + seriesModel = ecModel.getSeriesByIndex(seriesIndex) + )) { + return {point: []}; + } - shape: { - x1: pt1[0], - y1: pt1[1], - x2: pt2[0], - y2: pt2[1] - }, - style: zrUtil.extend( - {lineCap: 'round'}, - axisModel.getModel('axisLine.lineStyle').getLineStyle() - ), - strokeContainThreshold: opt.strokeContainThreshold || 5, - silent: true, - z2: 1 - }))); - }, + var data = seriesModel.getData(); + var dataIndex = modelUtil.queryDataIndex(data, finder); + if (dataIndex == null || zrUtil.isArray(dataIndex)) { + return {point: []}; + } - /** - * @private - */ - axisTick: function () { - var axisModel = this.axisModel; - var axis = axisModel.axis; + var el = data.getItemGraphicEl(dataIndex); + var coordSys = seriesModel.coordinateSystem; - if (!axisModel.get('axisTick.show') || axis.isBlank()) { - return; - } + if (seriesModel.getTooltipPosition) { + point = seriesModel.getTooltipPosition(dataIndex) || []; + } + else if (coordSys && coordSys.dataToPoint) { + point = coordSys.dataToPoint( + data.getValues( + zrUtil.map(coordSys.dimensions, function (dim) { + return seriesModel.coordDimToDataDim(dim)[0]; + }), dataIndex, true + ) + ) || []; + } + else if (el) { + // Use graphic bounding rect + var rect = el.getBoundingRect().clone(); + rect.applyTransform(el.transform); + point = [ + rect.x + rect.width / 2, + rect.y + rect.height / 2 + ]; + } - var tickModel = axisModel.getModel('axisTick'); - var opt = this.opt; + return {point: point, el: el}; + }; - var lineStyleModel = tickModel.getModel('lineStyle'); - var tickLen = tickModel.get('length'); - var tickInterval = getInterval(tickModel, opt.labelInterval); - var ticksCoords = axis.getTicksCoords(tickModel.get('alignWithLabel')); - var ticks = axis.scale.getTicks(); - var pt1 = []; - var pt2 = []; - var matrix = this._transform; - for (var i = 0; i < ticksCoords.length; i++) { - // Only ordinal scale support tick interval - if (ifIgnoreOnTick(axis, i, tickInterval)) { - continue; - } +/***/ }, +/* 145 */ +/***/ function(module, exports, __webpack_require__) { - var tickCoord = ticksCoords[i]; + - pt1[0] = tickCoord; - pt1[1] = 0; - pt2[0] = tickCoord; - pt2[1] = opt.tickDirection * tickLen; + var echarts = __webpack_require__(1); - if (matrix) { - v2ApplyTransform(pt1, pt1, matrix); - v2ApplyTransform(pt2, pt2, matrix); - } - // Tick line, Not use group transform to have better line draw - this.group.add(new graphic.Line(graphic.subPixelOptimizeLine({ + var AxisPointerModel = echarts.extendComponentModel({ - // Id for animation - anid: 'tick_' + ticks[i], + type: 'axisPointer', - shape: { - x1: pt1[0], - y1: pt1[1], - x2: pt2[0], - y2: pt2[1] - }, - style: zrUtil.defaults( - lineStyleModel.getLineStyle(), - { - stroke: axisModel.get('axisLine.lineStyle.color') - } - ), - z2: 2, - silent: true - }))); - } - }, + coordSysAxesInfo: null, - /** - * @param {module:echarts/coord/cartesian/AxisModel} axisModel - * @param {module:echarts/coord/cartesian/GridModel} gridModel - * @private - */ - axisLabel: function () { - var opt = this.opt; - var axisModel = this.axisModel; - var axis = axisModel.axis; - var show = retrieve(opt.axisLabelShow, axisModel.get('axisLabel.show')); + defaultOption: { + // 'auto' means that show when triggered by tooltip or handle. + show: 'auto', + // 'click' | 'mousemove' | 'none' + triggerOn: null, // set default in AxisPonterView.js - if (!show || axis.isBlank()) { - return; - } + zlevel: 0, + z: 50, + + type: 'line', + // axispointer triggered by tootip determine snap automatically, + // see `modelHelper`. + snap: false, + triggerTooltip: true, + + value: null, + status: null, // Init value depends on whether handle is used. + + // [group0, group1, ...] + // Each group can be: { + // mapper: function () {}, + // singleTooltip: 'multiple', // 'multiple' or 'single' + // xAxisId: ..., + // yAxisName: ..., + // angleAxisIndex: ... + // } + // mapper: can be ignored. + // input: {axisInfo, value} + // output: {axisInfo, value} + link: [], - var labelModel = axisModel.getModel('axisLabel'); - var textStyleModel = labelModel.getModel('textStyle'); - var labelMargin = labelModel.get('margin'); - var ticks = axis.scale.getTicks(); - var labels = axisModel.getFormattedLabels(); + // Do not set 'auto' here, otherwise global animation: false + // will not effect at this axispointer. + animation: null, + animationDurationUpdate: 200, - // Special label rotate. - var labelRotation = retrieve(opt.labelRotation, labelModel.get('rotate')) || 0; - // To radian. - labelRotation = labelRotation * PI / 180; + lineStyle: { + color: '#aaa', + width: 1, + type: 'solid' + }, - var labelLayout = innerTextLayout(opt, labelRotation, opt.labelDirection); - var categoryData = axisModel.get('data'); + shadowStyle: { + color: 'rgba(150,150,150,0.3)' + }, - var textEls = []; - var silent = isSilent(axisModel); - var triggerEvent = axisModel.get('triggerEvent'); + label: { + show: true, + formatter: null, // string | Function + precision: 'auto', // Or a number like 0, 1, 2 ... + margin: 3, + textStyle: { + color: '#fff' + }, + padding: [5, 7, 5, 7], + backgroundColor: 'auto', // default: axis line color + borderColor: null, + borderWidth: 0, + shadowBlur: 3, + shadowColor: '#aaa' + // Considering applicability, common style should + // better not have shadowOffset. + // shadowOffsetX: 0, + // shadowOffsetY: 2 + }, - zrUtil.each(ticks, function (tickVal, index) { - if (ifIgnoreOnTick(axis, index, opt.labelInterval)) { - return; - } + handle: { + show: false, + icon: 'M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4h1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7V23h6.6V24.4z M13.3,19.6H6.7v-1.4h6.6V19.6z', // jshint ignore:line + size: 45, + // handle margin is from symbol center to axis, which is stable when circular move. + margin: 50, + // color: '#1b8bbd' + // color: '#2f4554' + color: '#333', + shadowBlur: 3, + shadowColor: '#aaa', + shadowOffsetX: 0, + shadowOffsetY: 2, - var itemTextStyleModel = textStyleModel; - if (categoryData && categoryData[tickVal] && categoryData[tickVal].textStyle) { - itemTextStyleModel = new Model( - categoryData[tickVal].textStyle, textStyleModel, axisModel.ecModel - ); - } - var textColor = itemTextStyleModel.getTextColor() - || axisModel.get('axisLine.lineStyle.color'); + // For mobile performance + throttle: 40 + } + } - var tickCoord = axis.dataToCoord(tickVal); - var pos = [ - tickCoord, - opt.labelOffset + opt.labelDirection * labelMargin - ]; - var labelBeforeFormat = axis.scale.getLabel(tickVal); + }); - var textEl = new graphic.Text({ + module.exports = AxisPointerModel; - // Id for animation - anid: 'label_' + tickVal, - style: { - text: labels[index], - textAlign: itemTextStyleModel.get('align', true) || labelLayout.textAlign, - textVerticalAlign: itemTextStyleModel.get('baseline', true) || labelLayout.verticalAlign, - textFont: itemTextStyleModel.getFont(), - fill: typeof textColor === 'function' ? textColor(labelBeforeFormat) : textColor - }, - position: pos, - rotation: labelLayout.rotation, - silent: silent, - z2: 10 - }); - // Pack data for mouse event - if (triggerEvent) { - textEl.eventData = makeAxisEventDataBase(axisModel); - textEl.eventData.targetType = 'axisLabel'; - textEl.eventData.value = labelBeforeFormat; - } +/***/ }, +/* 146 */ +/***/ function(module, exports, __webpack_require__) { - // FIXME - this._dumbGroup.add(textEl); - textEl.updateTransform(); + - textEls.push(textEl); - this.group.add(textEl); + var globalListener = __webpack_require__(147); - textEl.decomposeTransform(); + var AxisPonterView = __webpack_require__(1).extendComponentView({ - }, this); + type: 'axisPointer', - function isTwoLabelOverlapped(current, next) { - var firstRect = current && current.getBoundingRect().clone(); - var nextRect = next && next.getBoundingRect().clone(); - if (firstRect && nextRect) { - firstRect.applyTransform(current.getLocalTransform()); - nextRect.applyTransform(next.getLocalTransform()); - return firstRect.intersect(nextRect); - } - } + render: function (globalAxisPointerModel, ecModel, api) { + var globalTooltipModel = ecModel.getComponent('tooltip'); + var triggerOn = globalAxisPointerModel.get('triggerOn') + || (globalTooltipModel && globalTooltipModel.get('triggerOn') || 'mousemove|click'); - // If min or max are user set, we need to check - // If the tick on min(max) are overlap on their neighbour tick - // If they are overlapped, we need to hide the min(max) tick label - if (axisModel.getMin() != null) { - var firstLabel = textEls[0]; - var nextLabel = textEls[1]; - if (isTwoLabelOverlapped(firstLabel, nextLabel)) { - firstLabel.ignore = true; - } - } - if (axisModel.getMax() != null) { - var lastLabel = textEls[textEls.length - 1]; - var prevLabel = textEls[textEls.length - 2]; - if (isTwoLabelOverlapped(prevLabel, lastLabel)) { - lastLabel.ignore = true; + // Register global listener in AxisPointerView to enable + // AxisPointerView to be independent to Tooltip. + globalListener.register( + 'axisPointer', + api, + function (currTrigger, e, dispatchAction) { + // If 'none', it is not controlled by mouse totally. + if (triggerOn !== 'none' + && (currTrigger === 'leave' || triggerOn.indexOf(currTrigger) >= 0) + ) { + dispatchAction({ + type: 'updateAxisPointer', + currTrigger: currTrigger, + x: e && e.offsetX, + y: e && e.offsetY + }); + } } - } + ); }, /** - * @private + * @override */ - axisName: function () { - var opt = this.opt; - var axisModel = this.axisModel; - var name = retrieve(opt.axisName, axisModel.get('name')); - - if (!name) { - return; - } + remove: function (ecModel, api) { + globalListener.disopse(api.getZr(), 'axisPointer'); + AxisPonterView.superApply(this._model, 'remove', arguments); + }, - var nameLocation = axisModel.get('nameLocation'); - var nameDirection = opt.nameDirection; - var textStyleModel = axisModel.getModel('nameTextStyle'); - var gap = axisModel.get('nameGap') || 0; + /** + * @override + */ + dispose: function (ecModel, api) { + globalListener.unregister('axisPointer', api); + AxisPonterView.superApply(this._model, 'dispose', arguments); + } - var extent = this.axisModel.axis.getExtent(); - var gapSignal = extent[0] > extent[1] ? -1 : 1; - var pos = [ - nameLocation === 'start' - ? extent[0] - gapSignal * gap - : nameLocation === 'end' - ? extent[1] + gapSignal * gap - : (extent[0] + extent[1]) / 2, // 'middle' - // Reuse labelOffset. - nameLocation === 'middle' ? opt.labelOffset + nameDirection * gap : 0 - ]; + }); - var labelLayout; - var nameRotation = axisModel.get('nameRotate'); - if (nameRotation != null) { - nameRotation = nameRotation * PI / 180; // To radian. - } - var axisNameAvailableWidth; +/***/ }, +/* 147 */ +/***/ function(module, exports, __webpack_require__) { - if (nameLocation === 'middle') { - labelLayout = innerTextLayout( - opt, - nameRotation != null ? nameRotation : opt.rotation, // Adapt to axis. - nameDirection - ); - } - else { - labelLayout = endTextLayout( - opt, nameLocation, nameRotation || 0, extent - ); + - axisNameAvailableWidth = opt.axisNameAvailableWidth; - if (axisNameAvailableWidth != null) { - axisNameAvailableWidth = Math.abs( - axisNameAvailableWidth / Math.sin(labelLayout.rotation) - ); - !isFinite(axisNameAvailableWidth) && (axisNameAvailableWidth = null); - } - } + var env = __webpack_require__(2); + var zrUtil = __webpack_require__(4); + var get = __webpack_require__(5).makeGetter(); - var textFont = textStyleModel.getFont(); + var each = zrUtil.each; - var truncateOpt = axisModel.get('nameTruncate', true) || {}; - var ellipsis = truncateOpt.ellipsis; - var maxWidth = retrieve(truncateOpt.maxWidth, axisNameAvailableWidth); - var truncatedText = (ellipsis != null && maxWidth != null) - ? formatUtil.truncateText( - name, maxWidth, textFont, ellipsis, - {minChar: 2, placeholder: truncateOpt.placeholder} - ) - : name; + var globalListener = {}; - var tooltipOpt = axisModel.get('tooltip', true); + /** + * @param {string} key + * @param {module:echarts/ExtensionAPI} api + * @param {Function} handler + * param: {string} currTrigger + * param: {Array.} point + */ + globalListener.register = function (key, api, handler) { + if (env.node) { + return; + } - var mainType = axisModel.mainType; - var formatterParams = { - componentType: mainType, - name: name, - $vars: ['name'] - }; - formatterParams[mainType + 'Index'] = axisModel.componentIndex; + var zr = api.getZr(); + get(zr).records || (get(zr).records = {}); - var textEl = new graphic.Text({ + initGlobalListeners(zr, api); - // Id for animation - anid: 'name', + var record = get(zr).records[key] || (get(zr).records[key] = {}); + record.handler = handler; + }; - __fullText: name, - __truncatedText: truncatedText, + function initGlobalListeners(zr, api) { + if (get(zr).initialized) { + return; + } - style: { - text: truncatedText, - textFont: textFont, - fill: textStyleModel.getTextColor() - || axisModel.get('axisLine.lineStyle.color'), - textAlign: labelLayout.textAlign, - textVerticalAlign: labelLayout.verticalAlign - }, - position: pos, - rotation: labelLayout.rotation, - silent: isSilent(axisModel), - z2: 1, - tooltip: (tooltipOpt && tooltipOpt.show) - ? zrUtil.extend({ - content: name, - formatter: function () { - return name; - }, - formatterParams: formatterParams - }, tooltipOpt) - : null - }); + get(zr).initialized = true; - if (axisModel.get('triggerEvent')) { - textEl.eventData = makeAxisEventDataBase(axisModel); - textEl.eventData.targetType = 'axisName'; - textEl.eventData.name = name; - } + useHandler('click', zrUtil.curry(doEnter, 'click')); + useHandler('mousemove', zrUtil.curry(doEnter, 'mousemove')); + // useHandler('mouseout', onLeave); + useHandler('globalout', onLeave); - // FIXME - this._dumbGroup.add(textEl); - textEl.updateTransform(); + function useHandler(eventType, cb) { + zr.on(eventType, function (e) { + var dis = makeDispatchAction(api); - this.group.add(textEl); + each(get(zr).records, function (record) { + record && cb(record, e, dis.dispatchAction); + }); - textEl.decomposeTransform(); + dispatchTooltipFinally(dis.pendings, api); + }); } + } - }; - - /** - * @inner - */ - function innerTextLayout(opt, textRotation, direction) { - var rotationDiff = remRadian(textRotation - opt.rotation); - var textAlign; - var verticalAlign; + function dispatchTooltipFinally(pendings, api) { + var showLen = pendings.showTip.length; + var hideLen = pendings.hideTip.length; - if (isRadianAroundZero(rotationDiff)) { // Label is parallel with axis line. - verticalAlign = direction > 0 ? 'top' : 'bottom'; - textAlign = 'center'; + var actuallyPayload; + if (showLen) { + actuallyPayload = pendings.showTip[showLen - 1]; } - else if (isRadianAroundZero(rotationDiff - PI)) { // Label is inverse parallel with axis line. - verticalAlign = direction > 0 ? 'bottom' : 'top'; - textAlign = 'center'; + else if (hideLen) { + actuallyPayload = pendings.hideTip[hideLen - 1]; } - else { - verticalAlign = 'middle'; - - if (rotationDiff > 0 && rotationDiff < PI) { - textAlign = direction > 0 ? 'right' : 'left'; - } - else { - textAlign = direction > 0 ? 'left' : 'right'; - } + if (actuallyPayload) { + actuallyPayload.dispatchAction = null; + api.dispatchAction(actuallyPayload); } + } - return { - rotation: rotationDiff, - textAlign: textAlign, - verticalAlign: verticalAlign - }; + function onLeave(record, e, dispatchAction) { + record.handler('leave', null, dispatchAction); } - /** - * @inner - */ - function endTextLayout(opt, textPosition, textRotate, extent) { - var rotationDiff = remRadian(textRotate - opt.rotation); - var textAlign; - var verticalAlign; - var inverse = extent[0] > extent[1]; - var onLeft = (textPosition === 'start' && !inverse) - || (textPosition !== 'start' && inverse); + function doEnter(currTrigger, record, e, dispatchAction) { + record.handler(currTrigger, e, dispatchAction); + } - if (isRadianAroundZero(rotationDiff - PI / 2)) { - verticalAlign = onLeft ? 'bottom' : 'top'; - textAlign = 'center'; - } - else if (isRadianAroundZero(rotationDiff - PI * 1.5)) { - verticalAlign = onLeft ? 'top' : 'bottom'; - textAlign = 'center'; - } - else { - verticalAlign = 'middle'; - if (rotationDiff < PI * 1.5 && rotationDiff > PI / 2) { - textAlign = onLeft ? 'left' : 'right'; + function makeDispatchAction(api) { + var pendings = { + showTip: [], + hideTip: [] + }; + // FIXME + // better approach? + // 'showTip' and 'hideTip' can be triggered by axisPointer and tooltip, + // which may be conflict, (axisPointer call showTip but tooltip call hideTip); + // So we have to add "final stage" to merge those dispatched actions. + var dispatchAction = function (payload) { + var pendingList = pendings[payload.type]; + if (pendingList) { + pendingList.push(payload); } else { - textAlign = onLeft ? 'right' : 'left'; + payload.dispatchAction = dispatchAction; + api.dispatchAction(payload); } - } + }; return { - rotation: rotationDiff, - textAlign: textAlign, - verticalAlign: verticalAlign + dispatchAction: dispatchAction, + pendings: pendings }; } /** - * @inner - */ - function isSilent(axisModel) { - var tooltipOpt = axisModel.get('tooltip'); - return axisModel.get('silent') - // Consider mouse cursor, add these restrictions. - || !( - axisModel.get('triggerEvent') || (tooltipOpt && tooltipOpt.show) - ); - } - - /** - * @static - */ - var ifIgnoreOnTick = AxisBuilder.ifIgnoreOnTick = function (axis, i, interval) { - var rawTick; - var scale = axis.scale; - return scale.type === 'ordinal' - && ( - typeof interval === 'function' - ? ( - rawTick = scale.getTicks()[i], - !interval(rawTick, scale.getLabel(rawTick)) - ) - : i % (interval + 1) - ); - }; - - /** - * @static + * @param {string} key + * @param {module:echarts/ExtensionAPI} api */ - var getInterval = AxisBuilder.getInterval = function (model, labelInterval) { - var interval = model.get('interval'); - if (interval == null || interval == 'auto') { - interval = labelInterval; + globalListener.unregister = function (key, api) { + if (env.node) { + return; + } + var zr = api.getZr(); + var record = (get(zr).records || {})[key]; + if (record) { + get(zr).records[key] = null; } - return interval; }; - module.exports = AxisBuilder; - + module.exports = globalListener; /***/ }, -/* 134 */ +/* 148 */ /***/ function(module, exports, __webpack_require__) { var zrUtil = __webpack_require__(4); - __webpack_require__(114); + __webpack_require__(124); - __webpack_require__(135); - __webpack_require__(137); + __webpack_require__(149); + __webpack_require__(151); - var barLayoutGrid = __webpack_require__(140); + var barLayoutGrid = __webpack_require__(154); var echarts = __webpack_require__(1); echarts.registerLayout(zrUtil.curry(barLayoutGrid, 'bar')); @@ -29275,16 +32005,16 @@ return /******/ (function(modules) { // webpackBootstrap }); // In case developer forget to include grid component - __webpack_require__(113); + __webpack_require__(122); /***/ }, -/* 135 */ +/* 149 */ /***/ function(module, exports, __webpack_require__) { - module.exports = __webpack_require__(136).extend({ + module.exports = __webpack_require__(150).extend({ type: 'series.bar', @@ -29295,7 +32025,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 136 */ +/* 150 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -29370,21 +32100,21 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 137 */ +/* 151 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var zrUtil = __webpack_require__(4); - var graphic = __webpack_require__(43); - var helper = __webpack_require__(138); + var graphic = __webpack_require__(44); + var helper = __webpack_require__(152); var BAR_BORDER_WIDTH_QUERY = ['itemStyle', 'normal', 'barBorderWidth']; // FIXME // Just for compatible with ec2. - zrUtil.extend(__webpack_require__(12).prototype, __webpack_require__(139)); + zrUtil.extend(__webpack_require__(12).prototype, __webpack_require__(153)); var BarView = __webpack_require__(1).extendChartView({ @@ -29558,13 +32288,13 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 138 */ +/* 152 */ /***/ function(module, exports, __webpack_require__) { var zrUtil = __webpack_require__(4); - var graphic = __webpack_require__(43); + var graphic = __webpack_require__(44); var helper = {}; @@ -29615,7 +32345,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 139 */ +/* 153 */ /***/ function(module, exports, __webpack_require__) { @@ -29649,7 +32379,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 140 */ +/* 154 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -29901,7 +32631,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 141 */ +/* 155 */ /***/ function(module, exports, __webpack_require__) { @@ -29909,10 +32639,10 @@ return /******/ (function(modules) { // webpackBootstrap var zrUtil = __webpack_require__(4); var echarts = __webpack_require__(1); - __webpack_require__(142); - __webpack_require__(144); + __webpack_require__(156); + __webpack_require__(158); - __webpack_require__(145)('pie', [{ + __webpack_require__(159)('pie', [{ type: 'pieToggleSelect', event: 'pieselectchanged', method: 'toggleSelected' @@ -29926,17 +32656,17 @@ return /******/ (function(modules) { // webpackBootstrap method: 'unSelect' }]); - echarts.registerVisual(zrUtil.curry(__webpack_require__(146), 'pie')); + echarts.registerVisual(zrUtil.curry(__webpack_require__(160), 'pie')); echarts.registerLayout(zrUtil.curry( - __webpack_require__(147), 'pie' + __webpack_require__(161), 'pie' )); - echarts.registerProcessor(zrUtil.curry(__webpack_require__(149), 'pie')); + echarts.registerProcessor(zrUtil.curry(__webpack_require__(163), 'pie')); /***/ }, -/* 142 */ +/* 156 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -29947,7 +32677,7 @@ return /******/ (function(modules) { // webpackBootstrap var modelUtil = __webpack_require__(5); var completeDimensions = __webpack_require__(103); - var dataSelectableMixin = __webpack_require__(143); + var dataSelectableMixin = __webpack_require__(157); var PieSeries = __webpack_require__(1).extendSeriesModel({ @@ -30086,7 +32816,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 143 */ +/* 157 */ /***/ function(module, exports, __webpack_require__) { /** @@ -30156,12 +32886,12 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 144 */ +/* 158 */ /***/ function(module, exports, __webpack_require__) { - var graphic = __webpack_require__(43); + var graphic = __webpack_require__(44); var zrUtil = __webpack_require__(4); /** @@ -30439,7 +33169,7 @@ return /******/ (function(modules) { // webpackBootstrap // Pie view - var Pie = __webpack_require__(42).extend({ + var Pie = __webpack_require__(43).extend({ type: 'pie', @@ -30562,7 +33292,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 145 */ +/* 159 */ /***/ function(module, exports, __webpack_require__) { @@ -30602,7 +33332,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 146 */ +/* 160 */ /***/ function(module, exports) { // Pick color from palette for each data item. @@ -30653,7 +33383,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 147 */ +/* 161 */ /***/ function(module, exports, __webpack_require__) { // TODO minAngle @@ -30662,7 +33392,7 @@ return /******/ (function(modules) { // webpackBootstrap var numberUtil = __webpack_require__(7); var parsePercent = numberUtil.parsePercent; - var labelLayout = __webpack_require__(148); + var labelLayout = __webpack_require__(162); var zrUtil = __webpack_require__(4); var PI2 = Math.PI * 2; @@ -30799,7 +33529,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 148 */ +/* 162 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -31030,7 +33760,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 149 */ +/* 163 */ /***/ function(module, exports) { @@ -31058,7 +33788,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 150 */ +/* 164 */ /***/ function(module, exports, __webpack_require__) { @@ -31066,22 +33796,22 @@ return /******/ (function(modules) { // webpackBootstrap var zrUtil = __webpack_require__(4); var echarts = __webpack_require__(1); - __webpack_require__(151); - __webpack_require__(152); + __webpack_require__(165); + __webpack_require__(166); echarts.registerVisual(zrUtil.curry( - __webpack_require__(110), 'scatter', 'circle', null + __webpack_require__(119), 'scatter', 'circle', null )); echarts.registerLayout(zrUtil.curry( - __webpack_require__(111), 'scatter' + __webpack_require__(120), 'scatter' )); // In case developer forget to include grid component - __webpack_require__(113); + __webpack_require__(122); /***/ }, -/* 151 */ +/* 165 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -31094,7 +33824,7 @@ return /******/ (function(modules) { // webpackBootstrap type: 'series.scatter', - dependencies: ['grid', 'polar'], + dependencies: ['grid', 'polar', 'geo', 'singleAxis'], getInitialData: function (option, ecModel) { var list = createListFromArray(option.data, this, ecModel); @@ -31150,13 +33880,13 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 152 */ +/* 166 */ /***/ function(module, exports, __webpack_require__) { - var SymbolDraw = __webpack_require__(105); - var LargeSymbolDraw = __webpack_require__(153); + var SymbolDraw = __webpack_require__(115); + var LargeSymbolDraw = __webpack_require__(167); __webpack_require__(1).extendChartView({ @@ -31199,15 +33929,15 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 153 */ +/* 167 */ /***/ function(module, exports, __webpack_require__) { // TODO Batch by color - var graphic = __webpack_require__(43); - var symbolUtil = __webpack_require__(107); + var graphic = __webpack_require__(44); + var symbolUtil = __webpack_require__(104); var LargeSymbolPath = graphic.extendShape({ @@ -31350,20 +34080,6 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 154 */, -/* 155 */, -/* 156 */, -/* 157 */, -/* 158 */, -/* 159 */, -/* 160 */, -/* 161 */, -/* 162 */, -/* 163 */, -/* 164 */, -/* 165 */, -/* 166 */, -/* 167 */, /* 168 */, /* 169 */, /* 170 */, @@ -31373,7 +34089,21 @@ return /******/ (function(modules) { // webpackBootstrap /* 174 */, /* 175 */, /* 176 */, -/* 177 */ +/* 177 */, +/* 178 */, +/* 179 */, +/* 180 */, +/* 181 */, +/* 182 */, +/* 183 */, +/* 184 */, +/* 185 */, +/* 186 */, +/* 187 */, +/* 188 */, +/* 189 */, +/* 190 */, +/* 191 */ /***/ function(module, exports, __webpack_require__) { /** @@ -31385,7 +34115,7 @@ return /******/ (function(modules) { // webpackBootstrap var Eventful = __webpack_require__(33); var zrUtil = __webpack_require__(4); var eventTool = __webpack_require__(88); - var interactionMutex = __webpack_require__(178); + var interactionMutex = __webpack_require__(192); function mousedown(e) { if (e.target && e.target.draggable) { @@ -31446,6 +34176,10 @@ return /******/ (function(modules) { // webpackBootstrap } function mousewheel(e) { + // wheelDelta maybe -0 in chrome mac. + if (e.wheelDelta === 0) { + return; + } // Convenience: // Mac and VM Windows on Mac: scroll up: zoom out. // Windows: scroll up: zoom in. @@ -31607,7 +34341,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 178 */ +/* 192 */ /***/ function(module, exports, __webpack_require__) { @@ -31655,20 +34389,6 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 179 */, -/* 180 */, -/* 181 */, -/* 182 */, -/* 183 */, -/* 184 */, -/* 185 */, -/* 186 */, -/* 187 */, -/* 188 */, -/* 189 */, -/* 190 */, -/* 191 */, -/* 192 */, /* 193 */, /* 194 */, /* 195 */, @@ -31678,7 +34398,21 @@ return /******/ (function(modules) { // webpackBootstrap /* 199 */, /* 200 */, /* 201 */, -/* 202 */ +/* 202 */, +/* 203 */, +/* 204 */, +/* 205 */, +/* 206 */, +/* 207 */, +/* 208 */, +/* 209 */, +/* 210 */, +/* 211 */, +/* 212 */, +/* 213 */, +/* 214 */, +/* 215 */, +/* 216 */ /***/ function(module, exports, __webpack_require__) { /** @@ -31686,8 +34420,8 @@ return /******/ (function(modules) { // webpackBootstrap */ - var graphic = __webpack_require__(43); - var LineGroup = __webpack_require__(203); + var graphic = __webpack_require__(44); + var LineGroup = __webpack_require__(217); function isPointNaN(pt) { @@ -31777,7 +34511,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 203 */ +/* 217 */ /***/ function(module, exports, __webpack_require__) { /** @@ -31785,11 +34519,11 @@ return /******/ (function(modules) { // webpackBootstrap */ - var symbolUtil = __webpack_require__(107); + var symbolUtil = __webpack_require__(104); var vector = __webpack_require__(10); // var matrix = require('zrender/lib/core/matrix'); - var LinePath = __webpack_require__(204); - var graphic = __webpack_require__(43); + var LinePath = __webpack_require__(218); + var graphic = __webpack_require__(44); var zrUtil = __webpack_require__(4); var numberUtil = __webpack_require__(7); @@ -32149,14 +34883,14 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 204 */ +/* 218 */ /***/ function(module, exports, __webpack_require__) { /** * Line path for bezier and straight line draw */ - var graphic = __webpack_require__(43); + var graphic = __webpack_require__(44); var vec2 = __webpack_require__(10); var straightLineProto = graphic.Line.prototype; @@ -32206,20 +34940,6 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 205 */, -/* 206 */, -/* 207 */, -/* 208 */, -/* 209 */, -/* 210 */, -/* 211 */, -/* 212 */, -/* 213 */, -/* 214 */, -/* 215 */, -/* 216 */, -/* 217 */, -/* 218 */, /* 219 */, /* 220 */, /* 221 */, @@ -32237,7 +34957,21 @@ return /******/ (function(modules) { // webpackBootstrap /* 233 */, /* 234 */, /* 235 */, -/* 236 */ +/* 236 */, +/* 237 */, +/* 238 */, +/* 239 */, +/* 240 */, +/* 241 */, +/* 242 */, +/* 243 */, +/* 244 */, +/* 245 */, +/* 246 */, +/* 247 */, +/* 248 */, +/* 249 */, +/* 250 */ /***/ function(module, exports, __webpack_require__) { /** @@ -32251,8 +34985,8 @@ return /******/ (function(modules) { // webpackBootstrap var Eventful = __webpack_require__(33); var zrUtil = __webpack_require__(4); var BoundingRect = __webpack_require__(9); - var graphic = __webpack_require__(43); - var interactionMutex = __webpack_require__(178); + var graphic = __webpack_require__(44); + var interactionMutex = __webpack_require__(192); var DataDiffer = __webpack_require__(99); var curry = zrUtil.curry; @@ -32333,6 +35067,9 @@ return /******/ (function(modules) { // webpackBootstrap /** * Only for drawing (after enabledBrush). + * 'line', 'rect', 'polygon' or false + * If passing false/null/undefined, disable brush. + * If passing 'auto', determined by panel.defaultBrushType * @private * @type {string} */ @@ -32340,6 +35077,7 @@ return /******/ (function(modules) { // webpackBootstrap /** * Only for drawing (after enabledBrush). + * * @private * @type {Object} */ @@ -32420,7 +35158,9 @@ return /******/ (function(modules) { // webpackBootstrap * If set to null/undefined/false, select disabled. * @param {Object} brushOption * @param {string|boolean} brushOption.brushType 'line', 'rect', 'polygon' or false - * If pass false/null/undefined, disable brush. + * If passing false/null/undefined, disable brush. + * If passing 'auto', determined by panel.defaultBrushType. + * ('auto' can not be used in global panel) * @param {number} [brushOption.brushMode='single'] 'single' or 'multiple' * @param {boolean} [brushOption.transformable=true] * @param {boolean} [brushOption.removeOnClick=false] @@ -32443,7 +35183,11 @@ return /******/ (function(modules) { // webpackBootstrap /** * @param {Array.} panelOpts If not pass, it is global brush. - * Each items: {panelId, rect} + * Each items: { + * panelId, // mandatory. + * rect, // mandatory. + * defaultBrushType // optional, only used when brushType is 'auto'. + * } */ setPanels: function (panelOpts) { var oldPanels = this._panels || {}; @@ -32469,6 +35213,7 @@ return /******/ (function(modules) { // webpackBootstrap panel.attr('shape', rect.plain()); panel.__brushPanelId = panelId; + panel.__defaultBrushType = panelOpt.defaultBrushType; newPanels[panelId] = panel; oldPanels[panelId] = null; }); @@ -32520,7 +35265,7 @@ return /******/ (function(modules) { // webpackBootstrap * {id: 'yy', brushType: 'rect', range: [[23, 44], [23, 54]]}, * ... * ] - * `brushType` is required in each cover info. + * `brushType` is required in each cover info. (can not be 'auto') * `id` is not mandatory. * `brushStyle`, `transformable` is not mandatory, use DEFAULT_BRUSH_OPT by default. * If brushOptionList is null/undefined, all covers removed. @@ -32583,6 +35328,12 @@ return /******/ (function(modules) { // webpackBootstrap }, unmount: function () { + if (true) { + if (!this._mounted) { + return; + } + } + this.enableBrush(false); // container may 'removeAll' outside. @@ -33006,13 +35757,14 @@ return /******/ (function(modules) { // webpackBootstrap if (panel && !creatingCover) { thisBrushOption.brushMode === 'single' && clearCovers(controller); var brushOption = zrUtil.clone(thisBrushOption); + brushOption.brushType = determineBrushType(brushOption.brushType, panel); brushOption.panelId = panel === true ? null : panel.__brushPanelId; creatingCover = controller._creatingCover = createCover(controller, brushOption); controller._covers.push(creatingCover); } if (creatingCover) { - var coverRenderer = coverRenderers[controller._brushType]; + var coverRenderer = coverRenderers[determineBrushType(controller._brushType, panel)]; var coverBrushOption = creatingCover.__brushOption; coverBrushOption.range = coverRenderer.getCreatingRange( @@ -33047,6 +35799,19 @@ return /******/ (function(modules) { // webpackBootstrap return eventParams; } + function determineBrushType(brushType, panel) { + if (brushType === 'auto') { + if (true) { + zrUtil.assert( + panel && panel.__defaultBrushType, + 'MUST have defaultBrushType when brushType is "atuo"' + ); + } + return panel.__defaultBrushType; + } + return brushType; + } + var mouseHandlers = { mousedown: function (e) { @@ -33244,20 +36009,6 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 237 */, -/* 238 */, -/* 239 */, -/* 240 */, -/* 241 */, -/* 242 */, -/* 243 */, -/* 244 */, -/* 245 */, -/* 246 */, -/* 247 */, -/* 248 */, -/* 249 */, -/* 250 */, /* 251 */, /* 252 */, /* 253 */, @@ -33296,7 +36047,23 @@ return /******/ (function(modules) { // webpackBootstrap /* 286 */, /* 287 */, /* 288 */, -/* 289 */ +/* 289 */, +/* 290 */, +/* 291 */, +/* 292 */, +/* 293 */, +/* 294 */, +/* 295 */, +/* 296 */, +/* 297 */, +/* 298 */, +/* 299 */, +/* 300 */, +/* 301 */, +/* 302 */, +/* 303 */, +/* 304 */, +/* 305 */ /***/ function(module, exports) { // shim for using process in browser @@ -33482,9 +36249,9 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 290 */, -/* 291 */, -/* 292 */ +/* 306 */, +/* 307 */, +/* 308 */ /***/ function(module, exports, __webpack_require__) { @@ -33492,7 +36259,7 @@ return /******/ (function(modules) { // webpackBootstrap var echarts = __webpack_require__(1); var zrUtil = __webpack_require__(4); var modelUtil = __webpack_require__(5); - var graphicUtil = __webpack_require__(43); + var graphicUtil = __webpack_require__(44); var layoutUtil = __webpack_require__(21); // ------------- @@ -33500,7 +36267,7 @@ return /******/ (function(modules) { // webpackBootstrap // ------------- echarts.registerPreprocessor(function (option) { - var graphicOption = option && option.graphic; + var graphicOption = option.graphic; // Convert // {graphic: [{left: 10, type: 'circle'}, ...]} @@ -33602,12 +36369,11 @@ return /******/ (function(modules) { // webpackBootstrap var elOptionsToUpdate = this._elOptionsToUpdate = []; zrUtil.each(mappingResult, function (resultItem, index) { - var existElOption = resultItem.exist; var newElOption = resultItem.option; if (true) { zrUtil.assert( - zrUtil.isObject(newElOption) || existElOption, + zrUtil.isObject(newElOption) || resultItem.exist, 'Empty graphic option definition' ); } @@ -33616,69 +36382,13 @@ return /******/ (function(modules) { // webpackBootstrap return; } - // Set id and parent id after id assigned. - newElOption.id = resultItem.keyInfo.id; - var newElParentId = newElOption.parentId; - var newElParentOption = newElOption.parentOption; - var existElParentId = existElOption && existElOption.parentId; - !newElOption.type && existElOption && (newElOption.type = existElOption.type); - newElOption.parentId = newElParentId // parent id specified - ? newElParentId - : newElParentOption - ? newElParentOption.id - : existElParentId // parent not specified - ? existElParentId - : null; - newElOption.parentOption = null; // Clear elOptionsToUpdate.push(newElOption); - // Update existing options, for `getOption` feature. - var newElOptCopy = zrUtil.extend({}, newElOption); - var $action = newElOption.$action; - if (!$action || $action === 'merge') { - if (existElOption) { + setKeyInfoToNewElOption(resultItem, newElOption); - if (true) { - var newType = newElOption.type; - zrUtil.assert( - !newType || existElOption.type === newType, - 'Please set $action: "replace" to change `type`' - ); - } - - // We can ensure that newElOptCopy and existElOption are not - // the same object, so `merge` will not change newElOptCopy. - zrUtil.merge(existElOption, newElOptCopy, true); - // Rigid body, use ignoreSize. - layoutUtil.mergeLayoutParam(existElOption, newElOptCopy, {ignoreSize: true}); - // Will be used in render. - layoutUtil.copyLayoutParams(newElOption, existElOption); - } - else { - existList[index] = newElOptCopy; - } - } - else if ($action === 'replace') { - existList[index] = newElOptCopy; - } - else if ($action === 'remove') { - // null will be cleaned later. - existElOption && (existList[index] = null); - } + mergeNewElOptionToExist(existList, index, newElOption); - if (existList[index]) { - existList[index].hv = newElOption.hv = [ - // Rigid body, dont care `width`. - isSetLoc(newElOption, ['left', 'right']), - // Rigid body, dont care `height`. - isSetLoc(newElOption, ['top', 'bottom']) - ]; - // Give default group size. Otherwise layout error may occur. - if (existList[index].type === 'group') { - existList[index].width == null && (existList[index].width = newElOption.width = 0); - existList[index].height == null && (existList[index].height = newElOption.height = 0); - } - } + setLayoutInfoToExist(existList[index], newElOption); }, this); @@ -33716,20 +36426,22 @@ return /******/ (function(modules) { // webpackBootstrap */ _flatten: function (optionList, result, parentOption) { zrUtil.each(optionList, function (option) { - if (option) { - if (parentOption) { - option.parentOption = parentOption; - } + if (!option) { + return; + } - result.push(option); + if (parentOption) { + option.parentOption = parentOption; + } - var children = option.children; - if (option.type === 'group' && children) { - this._flatten(children, result, option); - } - // Deleting for JSON output, and for not affecting group creation. - delete option.children; + result.push(option); + + var children = option.children; + if (option.type === 'group' && children) { + this._flatten(children, result, option); } + // Deleting for JSON output, and for not affecting group creation. + delete option.children; }, this); }, @@ -33966,10 +36678,87 @@ return /******/ (function(modules) { // webpackBootstrap return isSet; } + function setKeyInfoToNewElOption(resultItem, newElOption) { + var existElOption = resultItem.exist; + + // Set id and type after id assigned. + newElOption.id = resultItem.keyInfo.id; + !newElOption.type && existElOption && (newElOption.type = existElOption.type); + + // Set parent id if not specified + if (newElOption.parentId == null) { + var newElParentOption = newElOption.parentOption; + if (newElParentOption) { + newElOption.parentId = newElParentOption.id; + } + else if (existElOption) { + newElOption.parentId = existElOption.parentId; + } + } + + // Clear + newElOption.parentOption = null; + } + + function mergeNewElOptionToExist(existList, index, newElOption) { + // Update existing options, for `getOption` feature. + var newElOptCopy = zrUtil.extend({}, newElOption); + var existElOption = existList[index]; + + var $action = newElOption.$action || 'merge'; + if ($action === 'merge') { + if (existElOption) { + + if (true) { + var newType = newElOption.type; + zrUtil.assert( + !newType || existElOption.type === newType, + 'Please set $action: "replace" to change `type`' + ); + } + + // We can ensure that newElOptCopy and existElOption are not + // the same object, so `merge` will not change newElOptCopy. + zrUtil.merge(existElOption, newElOptCopy, true); + // Rigid body, use ignoreSize. + layoutUtil.mergeLayoutParam(existElOption, newElOptCopy, {ignoreSize: true}); + // Will be used in render. + layoutUtil.copyLayoutParams(newElOption, existElOption); + } + else { + existList[index] = newElOptCopy; + } + } + else if ($action === 'replace') { + existList[index] = newElOptCopy; + } + else if ($action === 'remove') { + // null will be cleaned later. + existElOption && (existList[index] = null); + } + } + + function setLayoutInfoToExist(existItem, newElOption) { + if (!existItem) { + return; + } + existItem.hv = newElOption.hv = [ + // Rigid body, dont care `width`. + isSetLoc(newElOption, ['left', 'right']), + // Rigid body, dont care `height`. + isSetLoc(newElOption, ['top', 'bottom']) + ]; + // Give default group size. Otherwise layout error may occur. + if (existItem.type === 'group') { + existItem.width == null && (existItem.width = newElOption.width = 0); + existItem.height == null && (existItem.height = newElOption.height = 0); + } + } + /***/ }, -/* 293 */ +/* 309 */ /***/ function(module, exports, __webpack_require__) { /** @@ -33977,17 +36766,17 @@ return /******/ (function(modules) { // webpackBootstrap */ - __webpack_require__(294); - __webpack_require__(295); - __webpack_require__(296); + __webpack_require__(310); + __webpack_require__(311); + __webpack_require__(312); var echarts = __webpack_require__(1); // Series Filter - echarts.registerProcessor(__webpack_require__(298)); + echarts.registerProcessor(__webpack_require__(314)); /***/ }, -/* 294 */ +/* 310 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -34184,7 +36973,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 295 */ +/* 311 */ /***/ function(module, exports, __webpack_require__) { /** @@ -34271,15 +37060,15 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 296 */ +/* 312 */ /***/ function(module, exports, __webpack_require__) { var zrUtil = __webpack_require__(4); - var symbolCreator = __webpack_require__(107); - var graphic = __webpack_require__(43); - var listComponentHelper = __webpack_require__(297); + var symbolCreator = __webpack_require__(104); + var graphic = __webpack_require__(44); + var listComponentHelper = __webpack_require__(313); var curry = zrUtil.curry; @@ -34541,14 +37330,14 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 297 */ +/* 313 */ /***/ function(module, exports, __webpack_require__) { // List layout var layout = __webpack_require__(21); var formatUtil = __webpack_require__(6); - var graphic = __webpack_require__(43); + var graphic = __webpack_require__(44); function positionGroup(group, model, api) { layout.positionElement( @@ -34611,7 +37400,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 298 */ +/* 314 */ /***/ function(module, exports) { @@ -34635,15 +37424,18 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 299 */ +/* 315 */ /***/ function(module, exports, __webpack_require__) { // FIXME Better way to pack data in graphic element - __webpack_require__(300); + __webpack_require__(142); + + __webpack_require__(316); + + __webpack_require__(317); - __webpack_require__(301); // Show tip action /** @@ -34676,7 +37468,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 300 */ +/* 316 */ /***/ function(module, exports, __webpack_require__) { @@ -34685,6 +37477,8 @@ return /******/ (function(modules) { // webpackBootstrap type: 'tooltip', + dependencies: ['axisPointer'], + defaultOption: { zlevel: 0, @@ -34695,17 +37489,22 @@ return /******/ (function(modules) { // webpackBootstrap // tooltip主体内容 showContent: true, - // 触发类型,默认数据触发,见下图,可选为:'item' ¦ 'axis' + // 'trigger' only works on coordinate system. + // 'item' | 'axis' | 'none' trigger: 'item', - // 触发条件,支持 'click' | 'mousemove' | 'none' - triggerOn: 'mousemove', + // 'click' | 'mousemove' | 'none' + triggerOn: 'mousemove|click', - // 是否永远显示 content alwaysShowContent: false, + displayMode: 'single', // 'single' | 'multipleByCoordSys' + // 位置 {Array} | {Function} // position: null + // Consider triggered from axisPointer handle, verticalAlign should be 'middle' + // align: null, + // verticalAlign: null, // 是否约束 content 在 viewRect 中。默认 false 是为了兼容以前版本。 confine: false, @@ -34754,30 +37553,21 @@ return /******/ (function(modules) { // webpackBootstrap // 极坐标系会默认选择 angle 轴 axis: 'auto', - animation: true, + animation: 'auto', animationDurationUpdate: 200, animationEasingUpdate: 'exponentialOut', - // 直线指示器样式设置 - lineStyle: { - color: '#555', - width: 1, - type: 'solid' - }, - crossStyle: { - color: '#555', + color: '#999', width: 1, type: 'dashed', // TODO formatter textStyle: {} - }, - - // 阴影指示器样式设置 - shadowStyle: { - color: 'rgba(150,150,150,0.3)' } + + // lineStyle and shadowStyle should not be specified here, + // otherwise it will always override those styles on option.axisPointer. }, textStyle: { color: '#fff', @@ -34787,201 +37577,33 @@ return /******/ (function(modules) { // webpackBootstrap }); -/***/ }, -/* 301 */ -/***/ function(module, exports, __webpack_require__) { - - - - var TooltipContent = __webpack_require__(302); - var graphic = __webpack_require__(43); - var zrUtil = __webpack_require__(4); - var formatUtil = __webpack_require__(6); - var numberUtil = __webpack_require__(7); - var modelUtil = __webpack_require__(5); - var parsePercent = numberUtil.parsePercent; - var env = __webpack_require__(2); - var Model = __webpack_require__(12); - - function dataEqual(a, b) { - if (!a || !b) { - return false; - } - var round = numberUtil.round; - return round(a[0]) === round(b[0]) - && round(a[1]) === round(b[1]); - } - /** - * @inner - */ - function makeLineShape(x1, y1, x2, y2) { - return { - x1: x1, - y1: y1, - x2: x2, - y2: y2 - }; - } - - /** - * @inner - */ - function makeRectShape(x, y, width, height) { - return { - x: x, - y: y, - width: width, - height: height - }; - } - - /** - * @inner - */ - function makeSectorShape(cx, cy, r0, r, startAngle, endAngle) { - return { - cx: cx, - cy: cy, - r0: r0, - r: r, - startAngle: startAngle, - endAngle: endAngle, - clockwise: true - }; - } - - function refixTooltipPosition(x, y, el, viewWidth, viewHeight) { - var width = el.clientWidth; - var height = el.clientHeight; - var gap = 20; - - if (x + width + gap > viewWidth) { - x -= width + gap; - } - else { - x += gap; - } - if (y + height + gap > viewHeight) { - y -= height + gap; - } - else { - y += gap; - } - return [x, y]; - } - - function confineTooltipPosition(x, y, el, viewWidth, viewHeight) { - var width = el.clientWidth; - var height = el.clientHeight; - - x = Math.min(x + width, viewWidth) - width; - y = Math.min(y + height, viewHeight) - height; - x = Math.max(x, 0); - y = Math.max(y, 0); - - return [x, y]; - } - - function calcTooltipPosition(position, rect, dom) { - var domWidth = dom.clientWidth; - var domHeight = dom.clientHeight; - var gap = 5; - var x = 0; - var y = 0; - var rectWidth = rect.width; - var rectHeight = rect.height; - switch (position) { - case 'inside': - x = rect.x + rectWidth / 2 - domWidth / 2; - y = rect.y + rectHeight / 2 - domHeight / 2; - break; - case 'top': - x = rect.x + rectWidth / 2 - domWidth / 2; - y = rect.y - domHeight - gap; - break; - case 'bottom': - x = rect.x + rectWidth / 2 - domWidth / 2; - y = rect.y + rectHeight + gap; - break; - case 'left': - x = rect.x - domWidth - gap; - y = rect.y + rectHeight / 2 - domHeight / 2; - break; - case 'right': - x = rect.x + rectWidth + gap; - y = rect.y + rectHeight / 2 - domHeight / 2; - } - return [x, y]; - } - - /** - * @param {string|Function|Array.} positionExpr - * @param {number} x Mouse x - * @param {number} y Mouse y - * @param {boolean} confine Whether confine tooltip content in view rect. - * @param {module:echarts/component/tooltip/TooltipContent} content - * @param {Object|} params - * @param {module:zrender/Element} el target element - * @param {module:echarts/ExtensionAPI} api - * @return {Array.} - */ - function updatePosition(positionExpr, x, y, confine, content, params, el, api) { - var viewWidth = api.getWidth(); - var viewHeight = api.getHeight(); - - var rect = el && el.getBoundingRect().clone(); - el && rect.applyTransform(el.transform); - if (typeof positionExpr === 'function') { - // Callback of position can be an array or a string specify the position - positionExpr = positionExpr([x, y], params, content.el, rect); - } - - if (zrUtil.isArray(positionExpr)) { - x = parsePercent(positionExpr[0], viewWidth); - y = parsePercent(positionExpr[1], viewHeight); - } - // Specify tooltip position by string 'top' 'bottom' 'left' 'right' around graphic element - else if (typeof positionExpr === 'string' && el) { - var pos = calcTooltipPosition( - positionExpr, rect, content.el - ); - x = pos[0]; - y = pos[1]; - } - else { - var pos = refixTooltipPosition( - x, y, content.el, viewWidth, viewHeight - ); - x = pos[0]; - y = pos[1]; - } - - if (confine) { - var pos = confineTooltipPosition( - x, y, content.el, viewWidth, viewHeight - ); - x = pos[0]; - y = pos[1]; - } +/***/ }, +/* 317 */ +/***/ function(module, exports, __webpack_require__) { - content.moveTo(x, y); - } + + + var TooltipContent = __webpack_require__(318); + var zrUtil = __webpack_require__(4); + var formatUtil = __webpack_require__(6); + var numberUtil = __webpack_require__(7); + var findPointFromSeries = __webpack_require__(144); + var layoutUtil = __webpack_require__(21); + var env = __webpack_require__(2); + var Model = __webpack_require__(12); + var globalListener = __webpack_require__(147); + var axisHelper = __webpack_require__(105); + var axisPointerViewHelper = __webpack_require__(139); + + var bind = zrUtil.bind; + var each = zrUtil.each; + var parsePercent = numberUtil.parsePercent; - function ifSeriesSupportAxisTrigger(seriesModel) { - var coordSys = seriesModel.coordinateSystem; - var trigger = seriesModel.get('tooltip.trigger', true); - // Ignore series use item tooltip trigger and series coordinate system is not cartesian or - return !(!coordSys - || (coordSys.type !== 'cartesian2d' && coordSys.type !== 'polar' && coordSys.type !== 'singleAxis') - || trigger === 'item'); - } __webpack_require__(1).extendComponentView({ type: 'tooltip', - _axisPointers: {}, - init: function (ecModel, api) { if (env.node) { return; @@ -34998,12 +37620,6 @@ return /******/ (function(modules) { // webpackBootstrap // Reset this.group.removeAll(); - /** - * @type {Object} - * @private - */ - this._axisPointers = {}; - /** * @private * @type {module:echarts/component/tooltip/TooltipModel} @@ -35023,40 +37639,59 @@ return /******/ (function(modules) { // webpackBootstrap this._api = api; /** - * @type {Object} * @private + * @type {Array.>} */ - this._lastHover = { - // data - // payloadBatch - }; + this._lastDataByCoordSys; + + /** + * @private + * @type {boolean} + */ + this._alwaysShowContent = tooltipModel.get('alwaysShowContent'); var tooltipContent = this._tooltipContent; tooltipContent.update(); - tooltipContent.enterable = tooltipModel.get('enterable'); - this._alwaysShowContent = tooltipModel.get('alwaysShowContent'); + tooltipContent.setEnterable(tooltipModel.get('enterable')); - /** - * @type {Object.} - */ - this._seriesGroupByAxis = this._prepareAxisTriggerData( - tooltipModel, ecModel - ); + this._initGlobalListener(); - var crossText = this._crossText; - if (crossText) { - this.group.add(crossText); - } + this._keepShow(); + }, + _initGlobalListener: function () { + var tooltipModel = this._tooltipModel; var triggerOn = tooltipModel.get('triggerOn'); + globalListener.register( + 'itemTooltip', + this._api, + bind(function (currTrigger, e, dispatchAction) { + // If 'none', it is not controlled by mouse totally. + if (triggerOn !== 'none') { + if (triggerOn.indexOf(currTrigger) >= 0) { + this._tryShow(e, dispatchAction); + } + else if (currTrigger === 'leave') { + this._hide(dispatchAction); + } + } + }, this) + ); + }, + + _keepShow: function () { + var tooltipModel = this._tooltipModel; + var ecModel = this._ecModel; + var api = this._api; + // Try to keep the tooltip show when refreshing if (this._lastX != null && this._lastY != null // When user is willing to control tooltip totally using API, // self.manuallyShowTip({x, y}) might cause tooltip hide, // which is not expected. - && triggerOn !== 'none' + && tooltipModel.get('triggerOn') !== 'none' ) { var self = this; clearTimeout(this._refreshUpdateTimeout); @@ -35070,37 +37705,6 @@ return /******/ (function(modules) { // webpackBootstrap }); }); } - - var zr = this._api.getZr(); - zr.off('click', this._tryShow); - zr.off('mousemove', this._mousemove); - zr.off('mouseout', this._hide); - zr.off('globalout', this._hide); - - if (triggerOn === 'click') { - zr.on('click', this._tryShow, this); - } - else if (triggerOn === 'mousemove') { - zr.on('mousemove', this._mousemove, this); - zr.on('mouseout', this._hide, this); - zr.on('globalout', this._hide, this); - } - // else triggerOn is 'none', which enable user - // to control tooltip totally using API. - }, - - _mousemove: function (e) { - var showDelay = this._tooltipModel.get('showDelay'); - var self = this; - clearTimeout(this._showTimeout); - if (showDelay > 0) { - this._showTimeout = setTimeout(function () { - self._tryShow(e); - }, showDelay); - } - else { - this._tryShow(e); - } }, /** @@ -35120,164 +37724,71 @@ return /******/ (function(modules) { // webpackBootstrap * TODO Batch */ manuallyShowTip: function (tooltipModel, ecModel, api, payload) { - // From self - if (payload.from === this.uid) { + if (payload.from === this.uid || env.node) { return; } - var ecModel = this._ecModel; - var seriesIndex = payload.seriesIndex; - var seriesModel = ecModel.getSeriesByIndex(seriesIndex); - var api = this._api; - - var isTriggerAxis = this._tooltipModel.get('trigger') === 'axis'; - function seriesHaveDataOnIndex(_series) { - var data = _series.getData(); - var dataIndex = modelUtil.queryDataIndex(data, payload); - // Have single dataIndex - if (dataIndex != null && !zrUtil.isArray(dataIndex) - && data.hasValue(dataIndex) - ) { - return true; - } - } + var dispatchAction = makeDispatchAction(payload, api); - if (payload.x == null || payload.y == null) { - if (isTriggerAxis) { - // Find another series. - if (seriesModel && !seriesHaveDataOnIndex(seriesModel)) { - seriesModel = null; - } - if (!seriesModel) { - // Find the first series can use axis trigger And data is not null - ecModel.eachSeries(function (_series) { - if (ifSeriesSupportAxisTrigger(_series) && !seriesModel) { - if (seriesHaveDataOnIndex(_series)) { - seriesModel = _series; - } - } - }); - } - } - else { - // Use the first series by default. - seriesModel = seriesModel || ecModel.getSeriesByIndex(0); - } - if (seriesModel) { - var data = seriesModel.getData(); - var dataIndex = modelUtil.queryDataIndex(data, payload); + // Reset ticket + this._ticket = ''; - if (dataIndex == null || zrUtil.isArray(dataIndex)) { - return; - } + var seriesIndex = payload.seriesIndex; + var dataByCoordSys = payload.dataByCoordSys; - var el = data.getItemGraphicEl(dataIndex); - var cx; - var cy; - // Try to get the point in coordinate system - var coordSys = seriesModel.coordinateSystem; - if (seriesModel.getTooltipPosition) { - var point = seriesModel.getTooltipPosition(dataIndex) || []; - cx = point[0]; - cy = point[1]; - } - else if (coordSys && coordSys.dataToPoint) { - var point = coordSys.dataToPoint( - data.getValues( - zrUtil.map(coordSys.dimensions, function (dim) { - return seriesModel.coordDimToDataDim(dim)[0]; - }), dataIndex, true - ) - ); - cx = point && point[0]; - cy = point && point[1]; - } - else if (el) { - // Use graphic bounding rect - var rect = el.getBoundingRect().clone(); - rect.applyTransform(el.transform); - cx = rect.x + rect.width / 2; - cy = rect.y + rect.height / 2; - } - - if (cx != null && cy != null) { - this._tryShow({ - offsetX: cx, - offsetY: cy, - position: payload.position, - target: el, - event: {} - }); - } - } - } - else { - var el = api.getZr().handler.findHover(payload.x, payload.y); + // When triggered from axisPointer. + if (dataByCoordSys) { + this._tryShow({ + offsetX: payload.x, + offsetY: payload.y, + position: payload.position, + event: {}, + dataByCoordSys: payload.dataByCoordSys, + tooltipOption: payload.tooltipOption + }, dispatchAction); + } + else if (seriesIndex != null) { + var pointInfo = findPointFromSeries(payload, ecModel); + var cx = pointInfo.point[0]; + var cy = pointInfo.point[1]; + if (cx != null && cy != null) { + this._tryShow({ + offsetX: cx, + offsetY: cy, + position: payload.position, + target: pointInfo.el, + event: {} + }, dispatchAction); + } + } + else if (payload.x != null && payload.y != null) { this._tryShow({ offsetX: payload.x, offsetY: payload.y, position: payload.position, - target: el, + target: api.getZr().handler.findHover(payload.x, payload.y), event: {} - }); + }, dispatchAction); } }, manuallyHideTip: function (tooltipModel, ecModel, api, payload) { - if (payload.from === this.uid) { - return; - } - - this._hide(); - }, - - _prepareAxisTriggerData: function (tooltipModel, ecModel) { - // Prepare data for axis trigger - var seriesGroupByAxis = {}; - ecModel.eachSeries(function (seriesModel) { - if (ifSeriesSupportAxisTrigger(seriesModel)) { - var coordSys = seriesModel.coordinateSystem; - var baseAxis; - var key; + var tooltipContent = this._tooltipContent; - // Only cartesian2d, polar and single support axis trigger - if (coordSys.type === 'cartesian2d') { - // FIXME `axisPointer.axis` is not baseAxis - baseAxis = coordSys.getBaseAxis(); - key = baseAxis.dim + baseAxis.index; - } - else if (coordSys.type === 'singleAxis') { - baseAxis = coordSys.getAxis(); - key = baseAxis.dim + baseAxis.type; - } - else { - baseAxis = coordSys.getBaseAxis(); - key = baseAxis.dim + coordSys.name; - } + if (!this._alwaysShowContent) { + tooltipContent.hideLater(this._tooltipModel.get('hideDelay')); + } - seriesGroupByAxis[key] = seriesGroupByAxis[key] || { - coordSys: [], - series: [] - }; - seriesGroupByAxis[key].coordSys.push(coordSys); - seriesGroupByAxis[key].series.push(seriesModel); - } - }, this); + this._lastX = this._lastY = null; - return seriesGroupByAxis; + if (payload.from !== this.uid) { + this._hide(makeDispatchAction(payload, api)); + } }, - /** - * mousemove handler - * @param {Object} e - * @private - */ - _tryShow: function (e) { + _tryShow: function (e, dispatchAction) { var el = e.target; var tooltipModel = this._tooltipModel; - var globalTrigger = tooltipModel.get('trigger'); - var ecModel = this._ecModel; - var api = this._api; if (!tooltipModel) { return; @@ -35287,778 +37798,491 @@ return /******/ (function(modules) { // webpackBootstrap this._lastX = e.offsetX; this._lastY = e.offsetY; + var dataByCoordSys = e.dataByCoordSys; + if (dataByCoordSys && dataByCoordSys.length) { + this._showAxisTooltip(dataByCoordSys, e); + } // Always show item tooltip if mouse is on the element with dataIndex - if (el && el.dataIndex != null) { - // Use dataModel in element if possible - // Used when mouseover on a element like markPoint or edge - // In which case, the data is not main data in series. - var dataModel = el.dataModel || ecModel.getSeriesByIndex(el.seriesIndex); - var dataIndex = el.dataIndex; - var data = dataModel.getData(); - var itemModel = data.getItemModel(dataIndex); - // Series or single data may use item trigger when global is axis trigger - if ((itemModel.get('tooltip.trigger') || globalTrigger) === 'axis') { - this._showAxisTooltip(tooltipModel, ecModel, e); - } - else { - // Reset ticket - this._ticket = ''; - // If either single data or series use item trigger - this._hideAxisPointer(); - // Reset last hover and dispatch downplay action - this._resetLastHover(); - - this._showItemTooltipContent(dataModel, dataIndex, el.dataType, e); - } - - api.dispatchAction({ - type: 'showTip', - from: this.uid, - dataIndexInside: dataIndex, - dataIndex: data.getRawIndex(dataIndex), // expose to user. - seriesIndex: el.seriesIndex - }); + else if (el && el.dataIndex != null) { + this._lastDataByCoordSys = null; + this._showSeriesItemTooltip(e, el, dispatchAction); } - // Tooltip provided directly. Like legend + // Tooltip provided directly. Like legend. else if (el && el.tooltip) { - var tooltipOpt = el.tooltip; - if (typeof tooltipOpt === 'string') { - var content = tooltipOpt; - tooltipOpt = { - content: content, - // Fixed formatter - formatter: content - }; - } - var subTooltipModel = new Model(tooltipOpt, tooltipModel); - var defaultHtml = subTooltipModel.get('content'); - var asyncTicket = Math.random(); - this._showTooltipContent( - // TODO params - subTooltipModel, defaultHtml, subTooltipModel.get('formatterParams') || {}, - asyncTicket, e.offsetX, e.offsetY, e.position, el, api - ); + this._lastDataByCoordSys = null; + this._showComponentItemTooltip(e, el, dispatchAction); } else { - if (globalTrigger === 'item') { - this._hide(); - } - else { - // Try show axis tooltip - this._showAxisTooltip(tooltipModel, ecModel, e); - } - - // Action of cross pointer - // other pointer types will trigger action in _dispatchAndShowSeriesTooltipContent method - if (tooltipModel.get('axisPointer.type') === 'cross') { - api.dispatchAction({ - type: 'showTip', - from: this.uid, - x: e.offsetX, - y: e.offsetY - }); - } + this._lastDataByCoordSys = null; + this._hide(dispatchAction); } }, - /** - * Show tooltip on axis - * @param {module:echarts/component/tooltip/TooltipModel} tooltipModel - * @param {module:echarts/model/Global} ecModel - * @param {Object} e - * @private - */ - _showAxisTooltip: function (tooltipModel, ecModel, e) { - var axisPointerModel = tooltipModel.getModel('axisPointer'); - var axisPointerType = axisPointerModel.get('type'); - - if (axisPointerType === 'cross') { - var el = e.target; - if (el && el.dataIndex != null) { - var seriesModel = ecModel.getSeriesByIndex(el.seriesIndex); - var dataIndex = el.dataIndex; - this._showItemTooltipContent(seriesModel, dataIndex, el.dataType, e); - } - } - - this._showAxisPointer(); - var allNotShow = true; - zrUtil.each(this._seriesGroupByAxis, function (seriesCoordSysSameAxis) { - // Try show the axis pointer - var allCoordSys = seriesCoordSysSameAxis.coordSys; - var coordSys = allCoordSys[0]; - - // If mouse position is not in the grid or polar - var point = [e.offsetX, e.offsetY]; - - if (!coordSys.containPoint(point)) { - // Hide axis pointer - this._hideAxisPointer(coordSys.name); - return; - } - - allNotShow = false; - // Make sure point is discrete on cateogry axis - var dimensions = coordSys.dimensions; - var value = coordSys.pointToData(point, true); - point = coordSys.dataToPoint(value); - - var baseAxis = coordSys.getBaseAxis(); - var axisType = axisPointerModel.get('axis'); - if (axisType === 'auto') { - axisType = baseAxis.dim; - } - - if (baseAxis.isBlank() || zrUtil.eqNaN(point[0]) || zrUtil.eqNaN(point[1])) { - this._hideAxisPointer(coordSys.name); - return; - } - - var contentNotChange = false; - var lastHover = this._lastHover; - if (axisPointerType === 'cross') { - // If hover data not changed - // Possible when two axes are all category - if (dataEqual(lastHover.data, value)) { - contentNotChange = true; - } - lastHover.data = value; - } - else { - var valIndex = zrUtil.indexOf(dimensions, axisType); - - // If hover data not changed on the axis dimension - if (lastHover.data === value[valIndex]) { - contentNotChange = true; - } - lastHover.data = value[valIndex]; - } - - var enableAnimation = tooltipModel.get('animation'); - - if (coordSys.type === 'cartesian2d' && !contentNotChange) { - this._showCartesianPointer( - axisPointerModel, coordSys, axisType, point, enableAnimation - ); - } - else if (coordSys.type === 'polar' && !contentNotChange) { - this._showPolarPointer( - axisPointerModel, coordSys, axisType, point, enableAnimation - ); - } - else if (coordSys.type === 'singleAxis' && !contentNotChange) { - this._showSinglePointer( - axisPointerModel, coordSys, axisType, point, enableAnimation - ); - } - - if (axisPointerType !== 'cross') { - this._dispatchAndShowSeriesTooltipContent( - coordSys, seriesCoordSysSameAxis.series, point, value, contentNotChange, e.position - ); - } - }, this); - - if (!this._tooltipModel.get('show')) { - this._hideAxisPointer(); - } - - if (allNotShow) { - this._hide(); - } + _showOrMove: function (tooltipModel, cb) { + // showDelay is used in this case: tooltip.enterable is set + // as true. User intent to move mouse into tooltip and click + // something. `showDelay` makes it easyer to enter the content + // but tooltip do not move immediately. + var delay = tooltipModel.get('showDelay'); + cb = zrUtil.bind(cb, this); + clearTimeout(this._showTimout); + delay > 0 + ? (this._showTimout = setTimeout(cb, delay)) + : cb(); }, - /** - * Show tooltip on axis of cartesian coordinate - * @param {module:echarts/model/Model} axisPointerModel - * @param {module:echarts/coord/cartesian/Cartesian2D} cartesians - * @param {string} axisType - * @param {Array.} point - * @private - */ - _showCartesianPointer: function (axisPointerModel, cartesian, axisType, point, enableAnimation) { - var self = this; - - var axisPointerType = axisPointerModel.get('type'); - var baseAxis = cartesian.getBaseAxis(); - var moveAnimation = enableAnimation - && axisPointerType !== 'cross' - && baseAxis.type === 'category' - && baseAxis.getBandWidth() > 20; - - if (axisPointerType === 'cross') { - moveGridLine('x', point, cartesian.getAxis('y').getGlobalExtent()); - moveGridLine('y', point, cartesian.getAxis('x').getGlobalExtent()); + _showAxisTooltip: function (dataByCoordSys, e) { + var ecModel = this._ecModel; + var globalTooltipModel = this._tooltipModel; + var point = [e.offsetX, e.offsetY]; + var singleDefaultHTML = []; + var singleParamsList = []; + var singleTooltipModel = buildTooltipModel([ + e.tooltipOption, + globalTooltipModel + ]); - this._updateCrossText(cartesian, point, axisPointerModel); - } - else { - var otherAxis = cartesian.getAxis(axisType === 'x' ? 'y' : 'x'); - var otherExtent = otherAxis.getGlobalExtent(); + each(dataByCoordSys, function (itemCoordSys) { + // var coordParamList = []; + // var coordDefaultHTML = []; + // var coordTooltipModel = buildTooltipModel([ + // e.tooltipOption, + // itemCoordSys.tooltipOption, + // ecModel.getComponent(itemCoordSys.coordSysMainType, itemCoordSys.coordSysIndex), + // globalTooltipModel + // ]); + // var displayMode = coordTooltipModel.get('displayMode'); + // var paramsList = displayMode === 'single' ? singleParamsList : []; + + each(itemCoordSys.dataByAxis, function (item) { + var axisModel = ecModel.getComponent(item.axisDim + 'Axis', item.axisIndex); + var axisValue = item.value; + var seriesDefaultHTML = []; + + if (!axisModel || axisValue == null) { + return; + } - if (cartesian.type === 'cartesian2d') { - (axisPointerType === 'line' ? moveGridLine : moveGridShadow)( - axisType, point, otherExtent + var valueLabel = axisPointerViewHelper.getValueLabel( + axisValue, axisModel.axis, ecModel, + item.seriesDataIndices, + item.valueLabelOpt ); - } - } - - /** - * @inner - */ - function moveGridLine(axisType, point, otherExtent) { - var targetShape = axisType === 'x' - ? makeLineShape(point[0], otherExtent[0], point[0], otherExtent[1]) - : makeLineShape(otherExtent[0], point[1], otherExtent[1], point[1]); - - var pointerEl = self._getPointerElement( - cartesian, axisPointerModel, axisType, targetShape - ); - graphic.subPixelOptimizeLine({ - shape: targetShape, - style: pointerEl.style - }); - - moveAnimation - ? graphic.updateProps(pointerEl, { - shape: targetShape - }, axisPointerModel) - : pointerEl.attr({ - shape: targetShape - }); - } - - /** - * @inner - */ - function moveGridShadow(axisType, point, otherExtent) { - var axis = cartesian.getAxis(axisType); - var bandWidth = axis.getBandWidth(); - var span = otherExtent[1] - otherExtent[0]; - var targetShape = axisType === 'x' - ? makeRectShape(point[0] - bandWidth / 2, otherExtent[0], bandWidth, span) - : makeRectShape(otherExtent[0], point[1] - bandWidth / 2, span, bandWidth); - - var pointerEl = self._getPointerElement( - cartesian, axisPointerModel, axisType, targetShape - ); - moveAnimation - ? graphic.updateProps(pointerEl, { - shape: targetShape - }, axisPointerModel) - : pointerEl.attr({ - shape: targetShape - }); - } - }, - - _showSinglePointer: function (axisPointerModel, single, axisType, point, enableAnimation) { - var self = this; - var axisPointerType = axisPointerModel.get('type'); - var moveAnimation = - enableAnimation - && axisPointerType !== 'cross' - && single.getBaseAxis().type === 'category'; - var rect = single.getRect(); - var otherExtent = [rect.y, rect.y + rect.height]; - - moveSingleLine(axisType, point, otherExtent); - - /** - * @inner - */ - function moveSingleLine(axisType, point, otherExtent) { - var axis = single.getAxis(); - var orient = axis.orient; - - var targetShape = orient === 'horizontal' - ? makeLineShape(point[0], otherExtent[0], point[0], otherExtent[1]) - : makeLineShape(otherExtent[0], point[1], otherExtent[1], point[1]); - - var pointerEl = self._getPointerElement( - single, axisPointerModel, axisType, targetShape - ); - moveAnimation - ? graphic.updateProps(pointerEl, { - shape: targetShape - }, axisPointerModel) - : pointerEl.attr({ - shape: targetShape - }); - } - - }, - - /** - * Show tooltip on axis of polar coordinate - * @param {module:echarts/model/Model} axisPointerModel - * @param {Array.} polar - * @param {string} axisType - * @param {Array.} point - */ - _showPolarPointer: function (axisPointerModel, polar, axisType, point, enableAnimation) { - var self = this; - - var axisPointerType = axisPointerModel.get('type'); - - var angleAxis = polar.getAngleAxis(); - var radiusAxis = polar.getRadiusAxis(); - - var moveAnimation = enableAnimation - && axisPointerType !== 'cross' - && polar.getBaseAxis().type === 'category'; - - if (axisPointerType === 'cross') { - movePolarLine('angle', point, radiusAxis.getExtent()); - movePolarLine('radius', point, angleAxis.getExtent()); - - this._updateCrossText(polar, point, axisPointerModel); - } - else { - var otherAxis = polar.getAxis(axisType === 'radius' ? 'angle' : 'radius'); - var otherExtent = otherAxis.getExtent(); - - (axisPointerType === 'line' ? movePolarLine : movePolarShadow)( - axisType, point, otherExtent - ); - } - /** - * @inner - */ - function movePolarLine(axisType, point, otherExtent) { - var mouseCoord = polar.pointToCoord(point); - - var targetShape; - - if (axisType === 'angle') { - var p1 = polar.coordToPoint([otherExtent[0], mouseCoord[1]]); - var p2 = polar.coordToPoint([otherExtent[1], mouseCoord[1]]); - targetShape = makeLineShape(p1[0], p1[1], p2[0], p2[1]); - } - else { - targetShape = { - cx: polar.cx, - cy: polar.cy, - r: mouseCoord[0] - }; - } - var pointerEl = self._getPointerElement( - polar, axisPointerModel, axisType, targetShape - ); - - moveAnimation - ? graphic.updateProps(pointerEl, { - shape: targetShape - }, axisPointerModel) - : pointerEl.attr({ - shape: targetShape + zrUtil.each(item.seriesDataIndices, function (idxItem) { + var series = ecModel.getSeriesByIndex(idxItem.seriesIndex); + var dataIndex = idxItem.dataIndexInside; + var dataParams = series && series.getDataParams(dataIndex); + dataParams.axisDim = item.axisDim; + dataParams.axisIndex = item.axisIndex; + dataParams.axisType = item.axisType; + dataParams.axisId = item.axisId; + dataParams.axisValue = axisHelper.getAxisRawValue(axisModel.axis, axisValue); + dataParams.axisValueLabel = valueLabel; + + if (dataParams) { + singleParamsList.push(dataParams); + seriesDefaultHTML.push(series.formatTooltip(dataIndex, true)); + } }); - } - - /** - * @inner - */ - function movePolarShadow(axisType, point, otherExtent) { - var axis = polar.getAxis(axisType); - var bandWidth = axis.getBandWidth(); - - var mouseCoord = polar.pointToCoord(point); - var targetShape; - - var radian = Math.PI / 180; - - if (axisType === 'angle') { - targetShape = makeSectorShape( - polar.cx, polar.cy, - otherExtent[0], otherExtent[1], - // In ECharts y is negative if angle is positive - (-mouseCoord[1] - bandWidth / 2) * radian, - (-mouseCoord[1] + bandWidth / 2) * radian - ); - } - else { - targetShape = makeSectorShape( - polar.cx, polar.cy, - mouseCoord[0] - bandWidth / 2, - mouseCoord[0] + bandWidth / 2, - 0, Math.PI * 2 + // Default tooltip content + // FIXME + // (1) shold be the first data which has name? + // (2) themeRiver, firstDataIndex is array, and first line is unnecessary. + var firstLine = valueLabel; + singleDefaultHTML.push( + (firstLine ? formatUtil.encodeHTML(firstLine) + '
' : '') + + seriesDefaultHTML.join('
') ); - } - - var pointerEl = self._getPointerElement( - polar, axisPointerModel, axisType, targetShape - ); - moveAnimation - ? graphic.updateProps(pointerEl, { - shape: targetShape - }, axisPointerModel) - : pointerEl.attr({ - shape: targetShape - }); - } - }, - - _updateCrossText: function (coordSys, point, axisPointerModel) { - var crossStyleModel = axisPointerModel.getModel('crossStyle'); - var textStyleModel = crossStyleModel.getModel('textStyle'); - - var tooltipModel = this._tooltipModel; - - var text = this._crossText; - if (!text) { - text = this._crossText = new graphic.Text({ - style: { - textAlign: 'left', - textVerticalAlign: 'bottom' - } }); - this.group.add(text); - } + }, this); - var value = coordSys.pointToData(point); + // In most case, the second axis is shown upper than the first one. + singleDefaultHTML.reverse(); + singleDefaultHTML = singleDefaultHTML.join('

'); - var dims = coordSys.dimensions; - value = zrUtil.map(value, function (val, idx) { - var axis = coordSys.getAxis(dims[idx]); - if (axis.type === 'category' || axis.type === 'time') { - val = axis.scale.getLabel(val); + var positionExpr = e.position; + this._showOrMove(singleTooltipModel, function () { + if (this._updateContentNotChangedOnAxis(dataByCoordSys)) { + this._updatePosition( + singleTooltipModel, + positionExpr, + point[0], point[1], + this._tooltipContent, + singleParamsList + ); } else { - val = formatUtil.addCommas( - val.toFixed(axis.getPixelPrecision()) + this._showTooltipContent( + singleTooltipModel, singleDefaultHTML, singleParamsList, Math.random(), + point[0], point[1], positionExpr ); } - return val; - }); - - text.setStyle({ - fill: textStyleModel.getTextColor() || crossStyleModel.get('color'), - textFont: textStyleModel.getFont(), - text: value.join(', '), - x: point[0] + 5, - y: point[1] - 5 - }); - text.z = tooltipModel.get('z'); - text.zlevel = tooltipModel.get('zlevel'); - }, - - _getPointerElement: function (coordSys, pointerModel, axisType, initShape) { - var tooltipModel = this._tooltipModel; - var z = tooltipModel.get('z'); - var zlevel = tooltipModel.get('zlevel'); - var axisPointers = this._axisPointers; - var coordSysName = coordSys.name; - axisPointers[coordSysName] = axisPointers[coordSysName] || {}; - if (axisPointers[coordSysName][axisType]) { - return axisPointers[coordSysName][axisType]; - } - - // Create if not exists - var pointerType = pointerModel.get('type'); - var styleModel = pointerModel.getModel(pointerType + 'Style'); - var isShadow = pointerType === 'shadow'; - var style = styleModel[isShadow ? 'getAreaStyle' : 'getLineStyle'](); - - var elementType = coordSys.type === 'polar' - ? (isShadow ? 'Sector' : (axisType === 'radius' ? 'Circle' : 'Line')) - : (isShadow ? 'Rect' : 'Line'); - - isShadow ? (style.stroke = null) : (style.fill = null); - - var el = axisPointers[coordSysName][axisType] = new graphic[elementType]({ - style: style, - z: z, - zlevel: zlevel, - silent: true, - shape: initShape }); - this.group.add(el); - return el; + // Do not trigger events here, because this branch only be entered + // from dispatchAction. }, - /** - * Dispatch actions and show tooltip on series - * @param {Array.} seriesList - * @param {Array.} point - * @param {Array.} value - * @param {boolean} contentNotChange - * @param {Array.|string|Function} [positionExpr] - */ - _dispatchAndShowSeriesTooltipContent: function ( - coordSys, seriesList, point, value, contentNotChange, positionExpr - ) { - - var rootTooltipModel = this._tooltipModel; + _showSeriesItemTooltip: function (e, el, dispatchAction) { + var ecModel = this._ecModel; + // Use dataModel in element if possible + // Used when mouseover on a element like markPoint or edge + // In which case, the data is not main data in series. + var seriesIndex = el.seriesIndex; + var seriesModel = ecModel.getSeriesByIndex(seriesIndex); - var baseAxis = coordSys.getBaseAxis(); - var baseDimIndex = ({x: 1, radius: 1, single: 1})[baseAxis.dim] ? 0 : 1; + // For example, graph link. + var dataModel = el.dataModel || seriesModel; + var dataIndex = el.dataIndex; + var dataType = el.dataType; + var data = dataModel.getData(); + + var tooltipModel = buildTooltipModel([ + data.getItemModel(dataIndex), + dataModel, + seriesModel && (seriesModel.coordinateSystem || {}).model, + this._tooltipModel + ]); - if (!seriesList.length) { + var tooltipTrigger = tooltipModel.get('trigger'); + if (tooltipTrigger != null && tooltipTrigger !== 'item') { return; } - var payloadBatch = zrUtil.map(seriesList, function (series) { - return { - seriesIndex: series.seriesIndex, - dataIndexInside: series.getAxisTooltipDataIndex - ? series.getAxisTooltipDataIndex(series.coordDimToDataDim(baseAxis.dim), value, baseAxis) - : series.getData().indexOfNearest( - series.coordDimToDataDim(baseAxis.dim)[0], - value[baseDimIndex], - // Add a threshold to avoid find the wrong dataIndex when data length is not same - false, baseAxis.type === 'category' ? 0.5 : null - ) - }; - }); - var sampleSeriesIndex; - zrUtil.each(payloadBatch, function (payload, idx) { - if (seriesList[idx].getData().hasValue(payload.dataIndexInside)) { - sampleSeriesIndex = idx; - } + var params = dataModel.getDataParams(dataIndex, dataType); + var defaultHtml = dataModel.formatTooltip(dataIndex, false, dataType); + var asyncTicket = 'item_' + dataModel.name + '_' + dataIndex; + + this._showOrMove(tooltipModel, function () { + this._showTooltipContent( + tooltipModel, defaultHtml, params, asyncTicket, + e.offsetX, e.offsetY, e.position, e.target + ); }); - // Fallback to 0. - sampleSeriesIndex = sampleSeriesIndex || 0; - var lastHover = this._lastHover; - var api = this._api; - // Dispatch downplay action - if (lastHover.payloadBatch && !contentNotChange) { - api.dispatchAction({ - type: 'downplay', - batch: lastHover.payloadBatch - }); - } - // Dispatch highlight action - if (!contentNotChange) { - api.dispatchAction({ - type: 'highlight', - batch: payloadBatch - }); - lastHover.payloadBatch = payloadBatch; - } - // Dispatch showTip action - var dataIndex = payloadBatch[sampleSeriesIndex].dataIndexInside; - api.dispatchAction({ + // FIXME + // duplicated showtip if manuallyShowTip is called from dispatchAction. + dispatchAction({ type: 'showTip', dataIndexInside: dataIndex, - // expose to user. - dataIndex: seriesList[sampleSeriesIndex].getData().getRawIndex(dataIndex), - seriesIndex: payloadBatch[sampleSeriesIndex].seriesIndex, + dataIndex: data.getRawIndex(dataIndex), + seriesIndex: seriesIndex, from: this.uid }); - - if (baseAxis && rootTooltipModel.get('showContent') && rootTooltipModel.get('show')) { - var paramsList = zrUtil.map(seriesList, function (series, index) { - return series.getDataParams(payloadBatch[index].dataIndexInside); - }); - - if (!contentNotChange) { - // Update html content - var firstDataIndex = payloadBatch[sampleSeriesIndex].dataIndexInside; - - // Default tooltip content - // FIXME - // (1) shold be the first data which has name? - // (2) themeRiver, firstDataIndex is array, and first line is unnecessary. - var firstLine = baseAxis.type === 'time' - ? baseAxis.scale.getLabel(value[baseDimIndex]) - : seriesList[sampleSeriesIndex].getData().getName(firstDataIndex); - var defaultHtml = (firstLine ? formatUtil.encodeHTML(firstLine) + '
' : '') - + zrUtil.map(seriesList, function (series, index) { - return series.formatTooltip(payloadBatch[index].dataIndexInside, true); - }).join('
'); - - var asyncTicket = 'axis_' + coordSys.name + '_' + firstDataIndex; - - this._showTooltipContent( - rootTooltipModel, defaultHtml, paramsList, asyncTicket, - point[0], point[1], positionExpr, null, api - ); - } - else { - updatePosition( - positionExpr || rootTooltipModel.get('position'), - point[0], point[1], - rootTooltipModel.get('confine'), - this._tooltipContent, paramsList, null, api - ); - } - } }, - /** - * Show tooltip on item - * @param {module:echarts/model/Series} seriesModel - * @param {number} dataIndex - * @param {string} dataType - * @param {Object} e - */ - _showItemTooltipContent: function (seriesModel, dataIndex, dataType, e) { - // FIXME Graph data - var api = this._api; - var data = seriesModel.getData(dataType); - var itemModel = data.getItemModel(dataIndex); - - var tooltipOpt = itemModel.get('tooltip', true); + _showComponentItemTooltip: function (e, el, dispatchAction) { + var tooltipOpt = el.tooltip; if (typeof tooltipOpt === 'string') { - // In each data item tooltip can be simply write: - // { - // value: 10, - // tooltip: 'Something you need to know' - // } - var tooltipContent = tooltipOpt; + var content = tooltipOpt; tooltipOpt = { - formatter: tooltipContent + content: content, + // Fixed formatter + formatter: content }; } - var rootTooltipModel = this._tooltipModel; - var seriesTooltipModel = seriesModel.getModel( - 'tooltip', rootTooltipModel - ); - var tooltipModel = new Model(tooltipOpt, seriesTooltipModel, seriesTooltipModel.ecModel); + var subTooltipModel = new Model(tooltipOpt, this._tooltipModel, this._ecModel); + var defaultHtml = subTooltipModel.get('content'); + var asyncTicket = Math.random(); - var params = seriesModel.getDataParams(dataIndex, dataType); - var defaultHtml = seriesModel.formatTooltip(dataIndex, false, dataType); + // Do not check whether `trigger` is 'none' here, because `trigger` + // only works on cooridinate system. In fact, we have not found case + // that requires setting `trigger` nothing on component yet. - var asyncTicket = 'item_' + seriesModel.name + '_' + dataIndex; + this._showOrMove(subTooltipModel, function () { + this._showTooltipContent( + subTooltipModel, defaultHtml, subTooltipModel.get('formatterParams') || {}, + asyncTicket, e.offsetX, e.offsetY, e.position, el + ); + }); - this._showTooltipContent( - tooltipModel, defaultHtml, params, asyncTicket, - e.offsetX, e.offsetY, e.position, e.target, api - ); + // If not dispatch showTip, tip may be hide triggered by axis. + dispatchAction({ + type: 'showTip', + from: this.uid + }); }, _showTooltipContent: function ( - tooltipModel, defaultHtml, params, asyncTicket, x, y, positionExpr, target, api + tooltipModel, defaultHtml, params, asyncTicket, x, y, positionExpr, el ) { // Reset ticket this._ticket = ''; - if (tooltipModel.get('showContent') && tooltipModel.get('show')) { - var tooltipContent = this._tooltipContent; - var confine = tooltipModel.get('confine'); - - var formatter = tooltipModel.get('formatter'); - positionExpr = positionExpr || tooltipModel.get('position'); - var html = defaultHtml; - - if (formatter) { - if (typeof formatter === 'string') { - html = formatUtil.formatTpl(formatter, params, true); - } - else if (typeof formatter === 'function') { - var self = this; - var ticket = asyncTicket; - var callback = function (cbTicket, html) { - if (cbTicket === self._ticket) { - tooltipContent.setContent(html); - - updatePosition( - positionExpr, x, y, confine, - tooltipContent, params, target, api - ); - } - }; - self._ticket = ticket; - html = formatter(params, ticket, callback); - } - } + if (!tooltipModel.get('showContent') || !tooltipModel.get('show')) { + return; + } - tooltipContent.show(tooltipModel); - tooltipContent.setContent(html); + var tooltipContent = this._tooltipContent; - updatePosition( - positionExpr, x, y, confine, - tooltipContent, params, target, api - ); + var formatter = tooltipModel.get('formatter'); + positionExpr = positionExpr || tooltipModel.get('position'); + var html = defaultHtml; + + if (formatter && typeof formatter === 'string') { + html = formatUtil.formatTpl(formatter, params, true); + } + else if (typeof formatter === 'function') { + var callback = bind(function (cbTicket, html) { + if (cbTicket === this._ticket) { + tooltipContent.setContent(html); + this._updatePosition( + tooltipModel, positionExpr, x, y, tooltipContent, params, el + ); + } + }, this); + this._ticket = asyncTicket; + html = formatter(params, asyncTicket, callback); } + + tooltipContent.setContent(html); + tooltipContent.show(tooltipModel); + + this._updatePosition( + tooltipModel, positionExpr, x, y, tooltipContent, params, el + ); }, /** - * Show axis pointer - * @param {string} [coordSysName] + * @param {string|Function|Array.} positionExpr + * @param {number} x Mouse x + * @param {number} y Mouse y + * @param {boolean} confine Whether confine tooltip content in view rect. + * @param {Object|} params + * @param {module:zrender/Element} el target element + * @param {module:echarts/ExtensionAPI} api + * @return {Array.} */ - _showAxisPointer: function (coordSysName) { - if (coordSysName) { - var axisPointers = this._axisPointers[coordSysName]; - axisPointers && zrUtil.each(axisPointers, function (el) { - el.show(); - }); - } - else { - this.group.eachChild(function (child) { - child.show(); + _updatePosition: function (tooltipModel, positionExpr, x, y, content, params, el) { + var viewWidth = this._api.getWidth(); + var viewHeight = this._api.getHeight(); + positionExpr = positionExpr || tooltipModel.get('position'); + + var contentSize = content.getSize(); + var align = tooltipModel.get('align'); + var vAlign = tooltipModel.get('verticalAlign'); + var rect = el && el.getBoundingRect().clone(); + el && rect.applyTransform(el.transform); + + if (typeof positionExpr === 'function') { + // Callback of position can be an array or a string specify the position + positionExpr = positionExpr([x, y], params, content.el, rect, { + viewSize: [viewWidth, viewHeight], + contentSize: contentSize.slice() }); - this.group.show(); } - }, - _resetLastHover: function () { - var lastHover = this._lastHover; - if (lastHover.payloadBatch) { - this._api.dispatchAction({ - type: 'downplay', - batch: lastHover.payloadBatch - }); + if (zrUtil.isArray(positionExpr)) { + x = parsePercent(positionExpr[0], viewWidth); + y = parsePercent(positionExpr[1], viewHeight); } - // Reset lastHover - this._lastHover = {}; - }, - /** - * Hide axis pointer - * @param {string} [coordSysName] - */ - _hideAxisPointer: function (coordSysName) { - if (coordSysName) { - var axisPointers = this._axisPointers[coordSysName]; - axisPointers && zrUtil.each(axisPointers, function (el) { - el.hide(); - }); + else if (zrUtil.isObject(positionExpr)) { + positionExpr.width = contentSize[0]; + positionExpr.height = contentSize[1]; + var layoutRect = layoutUtil.getLayoutRect( + positionExpr, {width: viewWidth, height: viewHeight} + ); + x = layoutRect.x; + y = layoutRect.y; + align = null; + // When positionExpr is left/top/right/bottom, + // align and verticalAlign will not work. + vAlign = null; + } + // Specify tooltip position by string 'top' 'bottom' 'left' 'right' around graphic element + else if (typeof positionExpr === 'string' && el) { + var pos = calcTooltipPosition( + positionExpr, rect, contentSize + ); + x = pos[0]; + y = pos[1]; } else { - if (this.group.children().length) { - this.group.hide(); - } + var pos = refixTooltipPosition( + x, y, content.el, viewWidth, viewHeight, align ? 0 : 20, vAlign ? 0 : 20 + ); + x = pos[0]; + y = pos[1]; } - }, - _hide: function () { - clearTimeout(this._showTimeout); + align && (x -= isCenterAlign(align) ? contentSize[0] / 2 : align === 'right' ? contentSize[0] : 0); + vAlign && (y -= isCenterAlign(vAlign) ? contentSize[1] / 2 : vAlign === 'bottom' ? contentSize[1] : 0); - this._hideAxisPointer(); - this._resetLastHover(); - if (!this._alwaysShowContent) { - this._tooltipContent.hideLater(this._tooltipModel.get('hideDelay')); + if (tooltipModel.get('confine')) { + var pos = confineTooltipPosition( + x, y, content.el, viewWidth, viewHeight + ); + x = pos[0]; + y = pos[1]; } - this._api.dispatchAction({ + content.moveTo(x, y); + }, + + // FIXME + // Should we remove this but leave this to user? + _updateContentNotChangedOnAxis: function (dataByCoordSys) { + var lastCoordSys = this._lastDataByCoordSys; + var contentNotChanged = !!lastCoordSys + && lastCoordSys.length === dataByCoordSys.length; + + each(lastCoordSys, function (lastItemCoordSys, indexCoordSys) { + var lastDataByAxis = lastItemCoordSys.dataByAxis || {}; + var thisItemCoordSys = dataByCoordSys[indexCoordSys] || {}; + var thisDataByAxis = thisItemCoordSys.dataByAxis || []; + contentNotChanged &= lastDataByAxis.length === thisDataByAxis.length; + + each(lastDataByAxis, function (lastItem, indexAxis) { + var thisItem = thisDataByAxis[indexAxis] || {}; + var lastIndices = lastItem.seriesDataIndices || []; + var newIndices = thisItem.seriesDataIndices || []; + + contentNotChanged &= + lastItem.value === thisItem.value + && lastItem.axisType === thisItem.axisType + && lastItem.axisId === thisItem.axisId + && lastIndices.length === newIndices.length; + + each(lastIndices, function (lastIdxItem, j) { + var newIdxItem = newIndices[j]; + contentNotChanged &= + lastIdxItem.seriesIndex === newIdxItem.seriesIndex + && lastIdxItem.dataIndex === newIdxItem.dataIndex; + }); + }); + }); + + this._lastDataByCoordSys = dataByCoordSys; + + return !!contentNotChanged; + }, + + _hide: function (dispatchAction) { + // Do not directly hideLater here, because this behavior may be prevented + // in dispatchAction when showTip is dispatched. + + // FIXME + // duplicated hideTip if manuallyHideTip is called from dispatchAction. + this._lastDataByCoordSys = null; + dispatchAction({ type: 'hideTip', from: this.uid }); - - this._lastX = this._lastY = null; }, dispose: function (ecModel, api) { if (env.node) { return; } - var zr = api.getZr(); this._tooltipContent.hide(); - - zr.off('click', this._tryShow); - zr.off('mousemove', this._mousemove); - zr.off('mouseout', this._hide); - zr.off('globalout', this._hide); + globalListener.unregister('itemTooltip', api); } }); + /** + * @param {Array.} modelCascade + * From top to bottom. (the last one should be globalTooltipModel); + */ + function buildTooltipModel(modelCascade) { + var resultModel = modelCascade.pop(); + while (modelCascade.length) { + var tooltipOpt = modelCascade.pop(); + if (tooltipOpt) { + if (tooltipOpt instanceof Model) { + tooltipOpt = tooltipOpt.get('tooltip', true); + } + // In each data item tooltip can be simply write: + // { + // value: 10, + // tooltip: 'Something you need to know' + // } + if (typeof tooltipOpt === 'string') { + tooltipOpt = {formatter: tooltipOpt}; + } + resultModel = new Model(tooltipOpt, resultModel, resultModel.ecModel); + } + } + return resultModel; + } + + function makeDispatchAction(payload, api) { + return payload.dispatchAction || zrUtil.bind(api.dispatchAction, api); + } + + function refixTooltipPosition(x, y, el, viewWidth, viewHeight, gapH, gapV) { + var width = el.clientWidth; + var height = el.clientHeight; + + if (x + width + gapH > viewWidth) { + x -= width + gapH; + } + else { + x += gapH; + } + if (y + height + gapV > viewHeight) { + y -= height + gapV; + } + else { + y += gapV; + } + return [x, y]; + } + + function confineTooltipPosition(x, y, el, viewWidth, viewHeight) { + var width = el.clientWidth; + var height = el.clientHeight; + + x = Math.min(x + width, viewWidth) - width; + y = Math.min(y + height, viewHeight) - height; + x = Math.max(x, 0); + y = Math.max(y, 0); + + return [x, y]; + } + + function calcTooltipPosition(position, rect, contentSize) { + var domWidth = contentSize[0]; + var domHeight = contentSize[1]; + var gap = 5; + var x = 0; + var y = 0; + var rectWidth = rect.width; + var rectHeight = rect.height; + switch (position) { + case 'inside': + x = rect.x + rectWidth / 2 - domWidth / 2; + y = rect.y + rectHeight / 2 - domHeight / 2; + break; + case 'top': + x = rect.x + rectWidth / 2 - domWidth / 2; + y = rect.y - domHeight - gap; + break; + case 'bottom': + x = rect.x + rectWidth / 2 - domWidth / 2; + y = rect.y + rectHeight + gap; + break; + case 'left': + x = rect.x - domWidth - gap; + y = rect.y + rectHeight / 2 - domHeight / 2; + break; + case 'right': + x = rect.x + rectWidth + gap; + y = rect.y + rectHeight / 2 - domHeight / 2; + } + return [x, y]; + } + + function isCenterAlign(align) { + return align === 'center' || align === 'middle'; + } + + + /***/ }, -/* 302 */ +/* 318 */ /***/ function(module, exports, __webpack_require__) { /** @@ -36125,8 +38349,6 @@ return /******/ (function(modules) { // webpackBootstrap */ function assembleCssText(tooltipModel) { - tooltipModel = tooltipModel; - var cssText = []; var transitionDuration = tooltipModel.get('transitionDuration'); @@ -36134,7 +38356,7 @@ return /******/ (function(modules) { // webpackBootstrap var textStyleModel = tooltipModel.getModel('textStyle'); var padding = tooltipModel.get('padding'); - // Animation transition + // Animation transition. Do not animate when transitionDuration is 0. transitionDuration && cssText.push(assembleTransition(transitionDuration)); @@ -36177,7 +38399,7 @@ return /******/ (function(modules) { // webpackBootstrap */ function TooltipContent(container, api) { var el = document.createElement('div'); - var zr = api.getZr(); + var zr = this._zr = api.getZr(); this.el = el; @@ -36198,7 +38420,7 @@ return /******/ (function(modules) { // webpackBootstrap var self = this; el.onmouseenter = function () { // clear the timeout in hideLater and keep showing tooltip - if (self.enterable) { + if (self._enterable) { clearTimeout(self._hideTimeout); self._show = true; } @@ -36206,7 +38428,7 @@ return /******/ (function(modules) { // webpackBootstrap }; el.onmousemove = function (e) { e = e || window.event; - if (!self.enterable) { + if (!self._enterable) { // Try trigger zrender event to avoid mouse // in and out shape too frequently var handler = zr.handler; @@ -36215,7 +38437,7 @@ return /******/ (function(modules) { // webpackBootstrap } }; el.onmouseleave = function () { - if (self.enterable) { + if (self._enterable) { if (self._show) { self.hideLater(self._hideDelay); } @@ -36228,12 +38450,18 @@ return /******/ (function(modules) { // webpackBootstrap constructor: TooltipContent, - enterable: true, + /** + * @private + * @type {boolean} + */ + _enterable: true, /** * Update when tooltip is rendered */ update: function () { + // FIXME + // Move this logic to ec main? var container = this._container; var stl = container.currentStyle || document.defaultView.getComputedStyle(container); @@ -36261,12 +38489,29 @@ return /******/ (function(modules) { // webpackBootstrap }, setContent: function (content) { + this.el.innerHTML = content; + }, + + setEnterable: function (enterable) { + this._enterable = enterable; + }, + + getSize: function () { var el = this.el; - el.innerHTML = content; - el.style.display = content ? 'block' : 'none'; + return [el.clientWidth, el.clientHeight]; }, moveTo: function (x, y) { + // xy should be based on canvas root. But tooltipContent is + // the sibling of canvas root. So padding of ec container + // should be considered here. + var zr = this._zr; + var viewportRoot; + if (zr && zr.painter && (viewportRoot = zr.painter.getViewportRoot())) { + x += viewportRoot.offsetLeft || 0; + y += viewportRoot.offsetTop || 0; + } + var style = this.el.style; style.left = x + 'px'; style.top = y + 'px'; @@ -36280,10 +38525,8 @@ return /******/ (function(modules) { // webpackBootstrap this._show = false; }, - // showLater: function () - hideLater: function (time) { - if (this._show && !(this._inContent && this.enterable)) { + if (this._show && !(this._inContent && this._enterable)) { if (time) { this._hideDelay = time; // Set show false to avoid invoke hideLater mutiple times @@ -36305,264 +38548,471 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 303 */, -/* 304 */, -/* 305 */, -/* 306 */, -/* 307 */, -/* 308 */, -/* 309 */, -/* 310 */, -/* 311 */, -/* 312 */, -/* 313 */, -/* 314 */, -/* 315 */, -/* 316 */, -/* 317 */, -/* 318 */, /* 319 */, /* 320 */, /* 321 */, -/* 322 */ +/* 322 */, +/* 323 */, +/* 324 */, +/* 325 */, +/* 326 */, +/* 327 */, +/* 328 */, +/* 329 */, +/* 330 */, +/* 331 */, +/* 332 */, +/* 333 */, +/* 334 */, +/* 335 */, +/* 336 */, +/* 337 */, +/* 338 */, +/* 339 */ /***/ function(module, exports, __webpack_require__) { var zrUtil = __webpack_require__(4); - var graphic = __webpack_require__(43); + var graphic = __webpack_require__(44); + var modelUtil = __webpack_require__(5); var each = zrUtil.each; + var indexOf = zrUtil.indexOf; + var curry = zrUtil.curry; - var helper = {}; - - var COMPONENT_NAMES = ['geo', 'xAxis', 'yAxis']; - var PANEL_ID_SPLIT = '--'; var COORD_CONVERTS = ['dataToPoint', 'pointToData']; - helper.parseOutputRanges = function (areas, coordInfoList, ecModel, rangesCoordInfo) { - each(areas, function (area, index) { - var panelId = area.panelId; + // FIXME + // how to genarialize to more coordinate systems. + var INCLUDE_FINDER_MAIN_TYPES = [ + 'grid', 'xAxis', 'yAxis', 'geo', 'graph', + 'polar', 'radiusAxis', 'angleAxis', 'bmap' + ]; + + /** + * [option in constructor]: + * { + * Index/Id/Name of geo, xAxis, yAxis, grid: See util/model#parseFinder. + * } + * + * + * [targetInfo]: + * + * There can be multiple axes in a single targetInfo. Consider the case + * of `grid` component, a targetInfo represents a grid which contains one or more + * cartesian and one or more axes. And consider the case of parallel system, + * which has multiple axes in a coordinate system. + * Can be { + * panelId: ..., + * coordSys: , + * coordSyses: all cartesians. + * gridModel: + * xAxes: correspond to coordSyses on index + * yAxes: correspond to coordSyses on index + * } + * or { + * panelId: ..., + * coordSys: + * coordSyses: [] + * geoModel: + * } + * + * + * [panelOpt]: + * + * Make from targetInfo. Input to BrushController. + * { + * panelId: ..., + * rect: ... + * } + * + * + * [area]: + * + * Generated by BrushController or user input. + * { + * panelId: Used to locate coordInfo directly. If user inpput, no panelId. + * brushType: determine how to convert to/from coord('rect' or 'polygon' or 'lineX/Y'). + * Index/Id/Name of geo, xAxis, yAxis, grid: See util/model#parseFinder. + * range: pixel range. + * coordRange: representitive coord range (the first one of coordRanges). + * coordRanges: coord ranges, used in multiple cartesian in one grid. + * } + */ + + /** + * @param {Object} option contains Index/Id/Name of xAxis/yAxis/geo/grid + * Each can be {number|Array.}. like: {xAxisIndex: [3, 4]} + * @param {module:echarts/model/Global} ecModel + * @param {Object} [opt] + * @param {Array.} [opt.include] include coordinate system types. + */ + function BrushTargetManager(option, ecModel, opt) { + /** + * @private + * @type {Array.} + */ + var targetInfoList = this._targetInfoList = []; + var info = {}; + var foundCpts = parseFinder(ecModel, option); + + each(targetInfoBuilders, function (builder, type) { + if (!opt || !opt.include || indexOf(opt.include, type) >= 0) { + builder(foundCpts, targetInfoList, info); + } + }); + } - if (panelId) { - panelId = panelId.split(PANEL_ID_SPLIT); + var proto = BrushTargetManager.prototype; + + proto.setOutputRanges = function (areas, ecModel) { + this.matchOutputRanges(areas, ecModel, function (area, coordRange, coordSys) { + (area.coordRanges || (area.coordRanges = [])).push(coordRange); + // area.coordRange is the first of area.coordRanges + if (!area.coordRange) { + area.coordRange = coordRange; + // In 'category' axis, coord to pixel is not reversible, so we can not + // rebuild range by coordRange accrately, which may bring trouble when + // brushing only one item. So we use __rangeOffset to rebuilding range + // by coordRange. And this it only used in brush component so it is no + // need to be adapted to coordRanges. + var result = coordConvert[area.brushType](0, coordSys, coordRange); + area.__rangeOffset = { + offset: diffProcessor[area.brushType](result.values, area.range, [1, 1]), + xyMinMax: result.xyMinMax + }; + } + }); + }; - area[panelId[0] + 'Index'] = +panelId[1]; + proto.matchOutputRanges = function (areas, ecModel, cb) { + each(areas, function (area) { + var targetInfo = this.findTargetInfo(area, ecModel); - var coordInfo = findCoordInfo(area, coordInfoList); - area.coordRange = coordConvert[area.brushType]( - 1, coordInfo, area.range + if (targetInfo && targetInfo !== true) { + zrUtil.each( + targetInfo.coordSyses, + function (coordSys) { + var result = coordConvert[area.brushType](1, coordSys, area.range); + cb(area, result.values, coordSys, ecModel); + } ); - rangesCoordInfo && (rangesCoordInfo[index] = coordInfo); } - }); + }, this); }; - helper.parseInputRanges = function (brushModel, ecModel) { - each(brushModel.areas, function (area) { - var coordInfo = findCoordInfo(area, brushModel.coordInfoList); + proto.setInputRanges = function (areas, ecModel) { + each(areas, function (area) { + var targetInfo = this.findTargetInfo(area, ecModel); if (true) { zrUtil.assert( - !coordInfo || coordInfo === true || area.coordRange, + !targetInfo || targetInfo === true || area.coordRange, 'coordRange must be specified when coord index specified.' ); zrUtil.assert( - !coordInfo || coordInfo !== true || area.range, - 'range must be specified.' + !targetInfo || targetInfo !== true || area.range, + 'range must be specified in global brush.' ); } area.range = area.range || []; // convert coordRange to global range and set panelId. - if (coordInfo && coordInfo !== true) { - area.range = coordConvert[area.brushType]( - 0, coordInfo, area.coordRange - ); - area.panelId = coordInfo.panelId; + if (targetInfo && targetInfo !== true) { + area.panelId = targetInfo.panelId; + // (1) area.range shoule always be calculate from coordRange but does + // not keep its original value, for the sake of the dataZoom scenario, + // where area.coordRange remains unchanged but area.range may be changed. + // (2) Only support converting one coordRange to pixel range in brush + // component. So do not consider `coordRanges`. + // (3) About __rangeOffset, see comment above. + var result = coordConvert[area.brushType](0, targetInfo.coordSys, area.coordRange); + var rangeOffset = area.__rangeOffset; + area.range = rangeOffset + ? diffProcessor[area.brushType]( + result.values, + rangeOffset.offset, + getScales(result.xyMinMax, rangeOffset.xyMinMax) + ) + : result.values; } - }); + }, this); }; - helper.makePanelOpts = function (coordInfoList) { - var panelOpts = []; - - each(coordInfoList, function (coordInfo) { - var coordSys = coordInfo.coordSys; - var rect; - - if (coordInfo.geoIndex >= 0) { - rect = coordSys.getBoundingRect().clone(); - // geo roam and zoom transform - rect.applyTransform(graphic.getTransform(coordSys)); - } - else { // xAxis or yAxis - // grid is not Transformable. - rect = coordSys.grid.getRect().clone(); - } - - panelOpts.push({panelId: coordInfo.panelId, rect: rect}); + proto.makePanelOpts = function (getDefaultBrushType) { + return zrUtil.map(this._targetInfoList, function (targetInfo) { + return { + panelId: targetInfo.panelId, + rect: targetInfo.getPanelRect(), + defaultBrushType: getDefaultBrushType && getDefaultBrushType(targetInfo) + }; }); + }; - return panelOpts; + proto.controlSeries = function (area, seriesModel, ecModel) { + // Check whether area is bound in coord, and series do not belong to that coord. + // If do not do this check, some brush (like lineX) will controll all axes. + var targetInfo = this.findTargetInfo(area, ecModel); + return targetInfo === true || ( + targetInfo && indexOf(targetInfo.coordSyses, seriesModel.coordinateSystem) >= 0 + ); }; /** - * @param {Object} option {xAxisIndex, yAxisIndex, geoIndex} - * @param {module:echarts/model/Global} ecModel - * @return {Array.} coordInfoList + * If return Object, a coord found. + * If reutrn true, global found. + * Otherwise nothing found. + * + * @param {Object} area + * @param {Array} targetInfoList + * @return {Obejct|boolean} */ - helper.makeCoordInfoList = function (option, ecModel) { - var coordInfoList = []; + proto.findTargetInfo = function (area, ecModel) { + var targetInfoList = this._targetInfoList; + var foundCpts = parseFinder(ecModel, area); - each(COMPONENT_NAMES, function (componentName) { - var componentIndices = option[componentName + 'Index']; - if (componentIndices == null || componentIndices === 'none') { - return; + for (var i = 0; i < targetInfoList.length; i++) { + var targetInfo = targetInfoList[i]; + var areaPanelId = area.panelId; + if (areaPanelId) { + if (targetInfo.panelId === areaPanelId) { + return targetInfo; + } } - if (componentIndices !== 'all' && !zrUtil.isArray(componentIndices)) { - componentIndices = [componentIndices]; + else { + for (var i = 0; i < targetInfoMatchers.length; i++) { + if (targetInfoMatchers[i](foundCpts, targetInfo)) { + return targetInfo; + } + } } + } - ecModel.eachComponent({mainType: componentName}, function (componentModel, index) { - if (componentIndices !== 'all' && zrUtil.indexOf(componentIndices, index) < 0) { - return; - } + return true; + }; - var grid; - var coordSys; + function formatMinMax(minMax) { + minMax[0] > minMax[1] && minMax.reverse(); + return minMax; + } - (componentName === 'xAxis' || componentName === 'yAxis') - ? (grid = componentModel.axis.grid) - : (coordSys = componentModel.coordinateSystem); // geo + function parseFinder(ecModel, option) { + return modelUtil.parseFinder( + ecModel, option, {includeMainTypes: INCLUDE_FINDER_MAIN_TYPES} + ); + } - var coordInfo; + var targetInfoBuilders = { - // Check duplicate and find cartesian when tranval to yAxis. - for (var i = 0, len = coordInfoList.length; i < len; i++) { - var cInfo = coordInfoList[i]; - if (true) { - zrUtil.assert( - cInfo[componentName + 'Index'] != index, - 'Coord should not be defined duplicately: ' + componentName + index - ); - } - // CoordSys is always required for `rect brush` or `polygon brush`. - // If both xAxisIndex and yAxisIndex specified, fetch cartesian by them. - if (componentName === 'yAxis' && !cInfo.yAxis && cInfo.xAxis) { - var aCoordSys = grid.getCartesian(cInfo.xAxisIndex, index); - if (aCoordSys) { // The yAxis and xAxis are in the same cartesian. - coordSys = aCoordSys; - coordInfo = cInfo; - break; - } - } - } + grid: function (foundCpts, targetInfoList) { + var xAxisModels = foundCpts.xAxisModels; + var yAxisModels = foundCpts.yAxisModels; + var gridModels = foundCpts.gridModels; + // Remove duplicated. + var gridModelMap = {}; + var xAxesHas = {}; + var yAxesHas = {}; - !coordInfo && coordInfoList.push(coordInfo = {}); + if (!xAxisModels && !yAxisModels && !gridModels) { + return; + } + + each(xAxisModels, function (axisModel) { + var gridModel = axisModel.axis.grid.model; + gridModelMap[gridModel.id] = gridModel; + xAxesHas[gridModel.id] = true; + }); + each(yAxisModels, function (axisModel) { + var gridModel = axisModel.axis.grid.model; + gridModelMap[gridModel.id] = gridModel; + yAxesHas[gridModel.id] = true; + }); + each(gridModels, function (gridModel) { + gridModelMap[gridModel.id] = gridModel; + xAxesHas[gridModel.id] = true; + yAxesHas[gridModel.id] = true; + }); - coordInfo[componentName] = componentModel; - coordInfo[componentName + 'Index'] = index; - // If both xAxisIndex and yAxisIndex specified, panelId only use yAxisIndex, - // which is enough to index panel. - coordInfo.panelId = componentName + PANEL_ID_SPLIT + index; - coordInfo.coordSys = coordSys - // If only xAxisIndex or only yAxisIndex specified, find its first cartesian. - || grid.getCartesian(coordInfo.xAxisIndex, coordInfo.yAxisIndex); + each(gridModelMap, function (gridModel) { + var grid = gridModel.coordinateSystem; + var cartesians = []; - coordInfo.coordSys - ? (coordInfoList[componentName + 'Has'] = true) - : coordInfoList.pop(); // If a coordInfo exists originally, existance of coordSys is ensured. + each(grid.getCartesians(), function (cartesian, index) { + if (indexOf(xAxisModels, cartesian.getAxis('x').model) >= 0 + || indexOf(yAxisModels, cartesian.getAxis('y').model) >= 0 + ) { + cartesians.push(cartesian); + } + }); + targetInfoList.push({ + panelId: 'grid--' + gridModel.id, + gridModel: gridModel, + // Use the first one as the representitive coordSys. + coordSys: cartesians[0], + coordSyses: cartesians, + getPanelRect: panelRectBuilder.grid, + xAxisDeclared: xAxesHas[gridModel.id], + yAxisDeclared: yAxesHas[gridModel.id] + }); }); - }); + }, - return coordInfoList; + geo: function (foundCpts, targetInfoList) { + each(foundCpts.geoModels, function (geoModel) { + var coordSys = geoModel.coordinateSystem; + targetInfoList.push({ + panelId: 'geo--' + geoModel.id, + geoModel: geoModel, + coordSys: coordSys, + coordSyses: [coordSys], + getPanelRect: panelRectBuilder.geo + }); + }); + } }; - helper.controlSeries = function (area, brushModel, seriesModel) { - // Check whether area is bound in coord, and series do not belong to that coord. - // If do not do this check, some brush (like lineX) will controll all axes. - var coordInfo = findCoordInfo(area, brushModel.coordInfoList); - return coordInfo === true || (coordInfo && coordInfo.coordSys === seriesModel.coordinateSystem); - }; + var targetInfoMatchers = [ - function formatMinMax(minMax) { - minMax[0] > minMax[1] && minMax.reverse(); - return minMax; - } + // grid + function (foundCpts, targetInfo) { + var xAxisModel = foundCpts.xAxisModel; + var yAxisModel = foundCpts.yAxisModel; + var gridModel = foundCpts.gridModel; - /** - * If return Object, a coord found. - * If reutrn true, global found. - * Otherwise nothing found. - * - * @param {Object} area {Index} - * @param {Array} coordInfoList - * @return {Obejct|boolean} - */ - function findCoordInfo(area, coordInfoList) { - var isGlobal = true; - for (var j = 0; j < COMPONENT_NAMES.length; j++) { - var indexAttr = COMPONENT_NAMES[j] + 'Index'; - if (area[indexAttr] >= 0) { - isGlobal = false; - for (var i = 0; i < coordInfoList.length; i++) { - if (coordInfoList[i][indexAttr] === area[indexAttr]) { - return coordInfoList[i]; - } - } - } + !gridModel && xAxisModel && (gridModel = xAxisModel.axis.grid.model); + !gridModel && yAxisModel && (gridModel = yAxisModel.axis.grid.model); + + return gridModel && gridModel === targetInfo.gridModel; + }, + + // geo + function (foundCpts, targetInfo) { + var geoModel = foundCpts.geoModel; + return geoModel && geoModel === targetInfo.geoModel; } - return isGlobal; - } + ]; - function axisConvert(axisName, to, coordInfo, coordRange) { - var axis = coordInfo.coordSys.getAxis(axisName); + var panelRectBuilder = { + grid: function () { + // grid is not Transformable. + return this.coordSys.grid.getRect().clone(); + }, + + geo: function () { + var coordSys = this.coordSys; + var rect = coordSys.getBoundingRect().clone(); + // geo roam and zoom transform + rect.applyTransform(graphic.getTransform(coordSys)); + return rect; + } + }; + + var coordConvert = { + + lineX: curry(axisConvert, 0), + + lineY: curry(axisConvert, 1), + + rect: function (to, coordSys, rangeOrCoordRange) { + var xminymin = coordSys[COORD_CONVERTS[to]]([rangeOrCoordRange[0][0], rangeOrCoordRange[1][0]]); + var xmaxymax = coordSys[COORD_CONVERTS[to]]([rangeOrCoordRange[0][1], rangeOrCoordRange[1][1]]); + var values = [ + formatMinMax([xminymin[0], xmaxymax[0]]), + formatMinMax([xminymin[1], xmaxymax[1]]) + ]; + return {values: values, xyMinMax: values}; + }, + + polygon: function (to, coordSys, rangeOrCoordRange) { + var xyMinMax = [[Infinity, -Infinity], [Infinity, -Infinity]]; + var values = zrUtil.map(rangeOrCoordRange, function (item) { + var p = coordSys[COORD_CONVERTS[to]](item); + xyMinMax[0][0] = Math.min(xyMinMax[0][0], p[0]); + xyMinMax[1][0] = Math.min(xyMinMax[1][0], p[1]); + xyMinMax[0][1] = Math.max(xyMinMax[0][1], p[0]); + xyMinMax[1][1] = Math.max(xyMinMax[1][1], p[1]); + return p; + }); + return {values: values, xyMinMax: xyMinMax}; + } + }; + + function axisConvert(axisNameIndex, to, coordSys, rangeOrCoordRange) { if (true) { - zrUtil.assert(axis, 'line brush is only available in cartesian (grid).'); + zrUtil.assert( + coordSys.type === 'cartesian2d', + 'lineX/lineY brush is available only in cartesian2d.' + ); } - return formatMinMax(zrUtil.map([0, 1], function (i) { + var axis = coordSys.getAxis(['x', 'y'][axisNameIndex]); + var values = formatMinMax(zrUtil.map([0, 1], function (i) { return to - ? axis.coordToData(axis.toLocalCoord(coordRange[i])) - : axis.toGlobalCoord(axis.dataToCoord(coordRange[i])); + ? axis.coordToData(axis.toLocalCoord(rangeOrCoordRange[i])) + : axis.toGlobalCoord(axis.dataToCoord(rangeOrCoordRange[i])); })); - } + var xyMinMax = []; + xyMinMax[axisNameIndex] = values; + xyMinMax[1 - axisNameIndex] = [NaN, NaN]; - var coordConvert = { + return {values: values, xyMinMax: xyMinMax}; + } - lineX: zrUtil.curry(axisConvert, 'x'), + var diffProcessor = { + lineX: curry(axisDiffProcessor, 0), - lineY: zrUtil.curry(axisConvert, 'y'), + lineY: curry(axisDiffProcessor, 1), - rect: function (to, coordInfo, coordRange) { - var coordSys = coordInfo.coordSys; - var xminymin = coordSys[COORD_CONVERTS[to]]([coordRange[0][0], coordRange[1][0]]); - var xmaxymax = coordSys[COORD_CONVERTS[to]]([coordRange[0][1], coordRange[1][1]]); + rect: function (values, refer, scales) { return [ - formatMinMax([xminymin[0], xmaxymax[0]]), - formatMinMax([xminymin[1], xmaxymax[1]]) + [values[0][0] - scales[0] * refer[0][0], values[0][1] - scales[0] * refer[0][1]], + [values[1][0] - scales[1] * refer[1][0], values[1][1] - scales[1] * refer[1][1]] ]; }, - polygon: function (to, coordInfo, coordRange) { - var coordSys = coordInfo.coordSys; - return zrUtil.map(coordRange, coordSys[COORD_CONVERTS[to]], coordSys); + polygon: function (values, refer, scales) { + return zrUtil.map(values, function (item, idx) { + return [item[0] - scales[0] * refer[idx][0], item[1] - scales[1] * refer[idx][1]]; + }); } }; - module.exports = helper; + function axisDiffProcessor(axisNameIndex, values, refer, scales) { + return [ + values[0] - scales[axisNameIndex] * refer[0], + values[1] - scales[axisNameIndex] * refer[1] + ]; + } + + // We have to process scale caused by dataZoom manually, + // although it might be not accurate. + function getScales(xyMinMaxCurr, xyMinMaxOrigin) { + var sizeCurr = getSize(xyMinMaxCurr); + var sizeOrigin = getSize(xyMinMaxOrigin); + var scales = [sizeCurr[0] / sizeOrigin[0], sizeCurr[1] / sizeOrigin[1]]; + isNaN(scales[0]) && (scales[0] = 1); + isNaN(scales[1]) && (scales[1] = 1); + return scales; + } + + function getSize(xyMinMax) { + return xyMinMax + ? [xyMinMax[0][1] - xyMinMax[0][0], xyMinMax[1][1] - xyMinMax[1][0]] + : [NaN, NaN]; + } + module.exports = BrushTargetManager; /***/ }, -/* 323 */, -/* 324 */, -/* 325 */, -/* 326 */, -/* 327 */ +/* 340 */, +/* 341 */, +/* 342 */, +/* 343 */, +/* 344 */ /***/ function(module, exports) { 'use strict'; @@ -36582,14 +39032,18 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 328 */ +/* 345 */, +/* 346 */, +/* 347 */, +/* 348 */, +/* 349 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var echarts = __webpack_require__(1); - var graphic = __webpack_require__(43); + var graphic = __webpack_require__(44); var layout = __webpack_require__(21); // Model @@ -36796,7 +39250,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 329 */ +/* 350 */ /***/ function(module, exports, __webpack_require__) { /** @@ -36804,24 +39258,24 @@ return /******/ (function(modules) { // webpackBootstrap */ - __webpack_require__(330); + __webpack_require__(351); - __webpack_require__(331); - __webpack_require__(334); + __webpack_require__(352); + __webpack_require__(355); - __webpack_require__(335); - __webpack_require__(336); + __webpack_require__(356); + __webpack_require__(357); - __webpack_require__(338); - __webpack_require__(339); + __webpack_require__(359); + __webpack_require__(360); - __webpack_require__(341); - __webpack_require__(342); + __webpack_require__(362); + __webpack_require__(363); /***/ }, -/* 330 */ +/* 351 */ /***/ function(module, exports, __webpack_require__) { @@ -36834,7 +39288,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 331 */ +/* 352 */ /***/ function(module, exports, __webpack_require__) { /** @@ -36846,8 +39300,8 @@ return /******/ (function(modules) { // webpackBootstrap var env = __webpack_require__(2); var echarts = __webpack_require__(1); var modelUtil = __webpack_require__(5); - var helper = __webpack_require__(332); - var AxisProxy = __webpack_require__(333); + var helper = __webpack_require__(353); + var AxisProxy = __webpack_require__(354); var each = zrUtil.each; var eachAxisDim = helper.eachAxisDim; @@ -36922,6 +39376,12 @@ return /******/ (function(modules) { // webpackBootstrap */ this._autoThrottle = true; + /** + * 'percent' or 'value' + * @private + */ + this._rangePropMode = ['percent', 'percent']; + var rawOption = retrieveRaw(option); this.mergeDefaultAndTheme(option, ecModel); @@ -36954,8 +39414,17 @@ return /******/ (function(modules) { // webpackBootstrap this._setDefaultThrottle(rawOption); - processRangeProp('start', 'startValue', rawOption, thisOption); - processRangeProp('end', 'endValue', rawOption, thisOption); + updateRangeUse(this, rawOption); + + each([['start', 'startValue'], ['end', 'endValue']], function (names, index) { + // start/end has higher priority over startValue/endValue if they + // both set, but we should make chart.setOption({endValue: 1000}) + // effective, rather than chart.setOption({endValue: 1000, end: null}). + if (this._rangePropMode[index] === 'value') { + thisOption[names[0]] = null; + } + // Otherwise do nothing and use the merge result. + }, this); this.textStyleModel = this.getModel('textStyle'); @@ -37219,10 +39688,25 @@ return /******/ (function(modules) { // webpackBootstrap }, this); }, + /** + * @param {string} dimName + * @param {number} axisIndex + * @return {module:echarts/component/dataZoom/AxisProxy} If not found, return null/undefined. + */ getAxisProxy: function (dimName, axisIndex) { return this._axisProxies[dimName + '_' + axisIndex]; }, + /** + * @param {string} dimName + * @param {number} axisIndex + * @return {module:echarts/model/Model} If not found, return null/undefined. + */ + getAxisModel: function (dimName, axisIndex) { + var axisProxy = this.getAxisProxy(dimName, axisIndex); + return axisProxy && axisProxy.getAxisModel(); + }, + /** * If not specified, set to undefined. * @@ -37232,14 +39716,17 @@ return /******/ (function(modules) { // webpackBootstrap * @param {number} [opt.end] * @param {number} [opt.startValue] * @param {number} [opt.endValue] + * @param {boolean} [ignoreUpdateRangeUsg=false] */ - setRawRange: function (opt) { + setRawRange: function (opt, ignoreUpdateRangeUsg) { each(['start', 'end', 'startValue', 'endValue'], function (name) { // If any of those prop is null/undefined, we should alos set // them, because only one pair between start/end and // startValue/endValue can work. this.option[name] = opt[name]; }, this); + + !ignoreUpdateRangeUsg && updateRangeUse(this, opt); }, /** @@ -37296,8 +39783,14 @@ return /******/ (function(modules) { // webpackBootstrap return axisProxies[key]; } } - } + }, + /** + * @return {Array.} + */ + getRangePropMode: function () { + return this._rangePropMode.slice(); + } }); function retrieveRaw(option) { @@ -37311,14 +39804,17 @@ return /******/ (function(modules) { // webpackBootstrap return ret; } - function processRangeProp(percentProp, valueProp, rawOption, thisOption) { - // start/end has higher priority over startValue/endValue, - // but we should make chart.setOption({endValue: 1000}) effective, - // rather than chart.setOption({endValue: 1000, end: null}). - if (rawOption[valueProp] != null && rawOption[percentProp] == null) { - thisOption[percentProp] = null; - } - // Otherwise do nothing and use the merge result. + function updateRangeUse(dataZoomModel, rawOption) { + each([['start', 'startValue'], ['end', 'endValue']], function (names, index) { + var rangePropMode = dataZoomModel._rangePropMode; + if (rawOption[names[0]] != null) { + rangePropMode[index] = 'percent'; + } + else if (rawOption[names[1]] != null) { + rangePropMode[index] = 'value'; + } + // else remain its original setting. + }); } module.exports = DataZoomModel; @@ -37326,7 +39822,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 332 */ +/* 353 */ /***/ function(module, exports, __webpack_require__) { @@ -37464,7 +39960,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 333 */ +/* 354 */ /***/ function(module, exports, __webpack_require__) { /** @@ -37474,7 +39970,7 @@ return /******/ (function(modules) { // webpackBootstrap var zrUtil = __webpack_require__(4); var numberUtil = __webpack_require__(7); - var helper = __webpack_require__(332); + var helper = __webpack_require__(353); var each = zrUtil.each; var asc = numberUtil.asc; @@ -37629,6 +40125,7 @@ return /******/ (function(modules) { // webpackBootstrap var dataExtent = this._dataExtent; var axisModel = this.getAxisModel(); var scale = axisModel.axis.scale; + var rangePropMode = this._dataZoomModel.getRangePropMode(); var percentExtent = [0, 100]; var percentWindow = [ opt.start, @@ -37636,12 +40133,6 @@ return /******/ (function(modules) { // webpackBootstrap ]; var valueWindow = []; - // In percent range is used and axis min/max/scale is set, - // window should be based on min/max/0, but should not be - // based on the extent of filtered data. - dataExtent = dataExtent.slice(); - fixExtentByAxis(dataExtent, axisModel); - each(['startValue', 'endValue'], function (prop) { valueWindow.push(opt[prop] != null ? scale.parse(opt[prop]) : null); }); @@ -37651,11 +40142,19 @@ return /******/ (function(modules) { // webpackBootstrap var boundValue = valueWindow[idx]; var boundPercent = percentWindow[idx]; - // start/end has higher priority over startValue/endValue, - // because start/end can be consistent among different type - // of axis but startValue/endValue not. - - if (boundPercent != null || boundValue == null) { + // Notice: dataZoom is based either on `percentProp` ('start', 'end') or + // on `valueProp` ('startValue', 'endValue'). The former one is suitable + // for cases that a dataZoom component controls multiple axes with different + // unit or extent, and the latter one is suitable for accurate zoom by pixel + // (e.g., in dataZoomSelect). `valueProp` can be calculated from `percentProp`, + // but it is awkward that `percentProp` can not be obtained from `valueProp` + // accurately (because all of values that are overflow the `dataExtent` will + // be calculated to percent '100%'). So we have to use + // `dataZoom.getRangePropMode()` to mark which prop is used. + // `rangePropMode` is updated only when setOption or dispatchAction, otherwise + // it remains its original value. + + if (rangePropMode[idx] === 'percent') { if (boundPercent == null) { boundPercent = percentExtent[idx]; } @@ -37664,11 +40163,15 @@ return /******/ (function(modules) { // webpackBootstrap boundPercent, percentExtent, dataExtent, true )); } - else { // boundPercent == null && boundValue != null + else { + // Calculating `percent` from `value` may be not accurate, because + // This calculation can not be inversed, because all of values that + // are overflow the `dataExtent` will be calculated to percent '100%' boundPercent = numberUtil.linearMap( boundValue, dataExtent, percentExtent, true ); } + // valueWindow[idx] = round(boundValue); // percentWindow[idx] = round(boundPercent); valueWindow[idx] = boundValue; @@ -37695,9 +40198,11 @@ return /******/ (function(modules) { // webpackBootstrap // Culculate data window and data extent, and record them. this._dataExtent = calculateDataExtent( - this._dimName, this.getTargetSeriesModels() + this, this._dimName, this.getTargetSeriesModels() ); + var dataWindow = this.calculateDataWindow(dataZoomModel.option); + this._valueWindow = dataWindow.valueWindow; this._percentWindow = dataWindow.percentWindow; @@ -37770,7 +40275,7 @@ return /******/ (function(modules) { // webpackBootstrap } }; - function calculateDataExtent(axisDim, seriesModels) { + function calculateDataExtent(axisProxy, axisDim, seriesModels) { var dataExtent = [Infinity, -Infinity]; each(seriesModels, function (seriesModel) { @@ -37782,30 +40287,60 @@ return /******/ (function(modules) { // webpackBootstrap seriesExtent[1] > dataExtent[1] && (dataExtent[1] = seriesExtent[1]); }); } - }, this); + }); if (dataExtent[1] < dataExtent[0]) { dataExtent = [NaN, NaN]; } + // It is important to get "consistent" extent when more then one axes is + // controlled by a `dataZoom`, otherwise those axes will not be synchronized + // when zooming. But it is difficult to know what is "consistent", considering + // axes have different type or even different meanings (For example, two + // time axes are used to compare data of the same date in different years). + // So basically dataZoom just obtains extent by series.data (in category axis + // extent can be obtained from axis.data). + // Nevertheless, user can set min/max/scale on axes to make extent of axes + // consistent. + fixExtentByAxis(axisProxy, dataExtent); + return dataExtent; } - function fixExtentByAxis(dataExtent, axisModel) { + function fixExtentByAxis(axisProxy, dataExtent) { + var axisModel = axisProxy.getAxisModel(); var min = axisModel.getMin(true); + + // For category axis, if min/max/scale are not set, extent is determined + // by axis.data by default. + var isCategoryAxis = axisModel.get('type') === 'category'; + var axisDataLen = isCategoryAxis && (axisModel.get('data') || []).length; + if (min != null && min !== 'dataMin') { dataExtent[0] = min; } + else if (isCategoryAxis) { + dataExtent[0] = axisDataLen > 0 ? 0 : NaN; + } + var max = axisModel.getMax(true); if (max != null && max !== 'dataMax') { dataExtent[1] = max; } + else if (isCategoryAxis) { + dataExtent[1] = axisDataLen > 0 ? axisDataLen - 1 : NaN; + } if (!axisModel.get('scale', true)) { dataExtent[0] > 0 && (dataExtent[0] = 0); dataExtent[1] < 0 && (dataExtent[1] = 0); } + // For value axis, if min/max/scale are not set, we just use the extent obtained + // by series data, which may be a little different from the extent calculated by + // `axisHelper.getScaleExtent`. But the different just affects the experience a + // little when zooming. So it will not be fixed until some users require it strongly. + return dataExtent; } @@ -37835,7 +40370,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 334 */ +/* 355 */ /***/ function(module, exports, __webpack_require__) { @@ -37912,7 +40447,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 335 */ +/* 356 */ /***/ function(module, exports, __webpack_require__) { /** @@ -37920,7 +40455,7 @@ return /******/ (function(modules) { // webpackBootstrap */ - var DataZoomModel = __webpack_require__(331); + var DataZoomModel = __webpack_require__(352); var SliderZoomModel = DataZoomModel.extend({ @@ -37991,20 +40526,22 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 336 */ +/* 357 */ /***/ function(module, exports, __webpack_require__) { var zrUtil = __webpack_require__(4); - var graphic = __webpack_require__(43); + var graphic = __webpack_require__(44); var throttle = __webpack_require__(81); - var DataZoomView = __webpack_require__(334); + var DataZoomView = __webpack_require__(355); var Rect = graphic.Rect; var numberUtil = __webpack_require__(7); var linearMap = numberUtil.linearMap; var layout = __webpack_require__(21); - var sliderMove = __webpack_require__(337); + var sliderMove = __webpack_require__(358); + var eventTool = __webpack_require__(88); + var asc = numberUtil.asc; var bind = zrUtil.bind; // var mathMax = Math.max; @@ -38411,6 +40948,10 @@ return /******/ (function(modules) { // webpackBootstrap draggable: true, cursor: 'move', drift: bind(this._onDragMove, this, 'all'), + onmousemove: function (e) { + // Fot mobile devicem, prevent screen slider on the button. + eventTool.stop(e.event); + }, ondragstart: bind(this._showDataInfo, this, true), ondragend: bind(this._onDragEnd, this), onmouseover: bind(this._showDataInfo, this, true), @@ -38448,6 +40989,10 @@ return /******/ (function(modules) { // webpackBootstrap cursor: this._orient === 'vertical' ? 'ns-resize' : 'ew-resize', draggable: true, drift: bind(this._onDragMove, this, handleIndex), + onmousemove: function (e) { + // Fot mobile devicem, prevent screen slider on the button. + eventTool.stop(e.event); + }, ondragend: bind(this._onDragEnd, this), onmouseover: bind(this._showDataInfo, this, true), onmouseout: bind(this._showDataInfo, this, false) @@ -38751,7 +41296,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 337 */ +/* 358 */ /***/ function(module, exports) { @@ -38810,7 +41355,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 338 */ +/* 359 */ /***/ function(module, exports, __webpack_require__) { /** @@ -38818,7 +41363,7 @@ return /******/ (function(modules) { // webpackBootstrap */ - module.exports = __webpack_require__(331).extend({ + module.exports = __webpack_require__(352).extend({ type: 'dataZoom.inside', @@ -38833,15 +41378,15 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 339 */ +/* 360 */ /***/ function(module, exports, __webpack_require__) { - var DataZoomView = __webpack_require__(334); + var DataZoomView = __webpack_require__(355); var zrUtil = __webpack_require__(4); - var sliderMove = __webpack_require__(337); - var roams = __webpack_require__(340); + var sliderMove = __webpack_require__(358); + var roams = __webpack_require__(361); var bind = zrUtil.bind; var InsideZoomView = DataZoomView.extend({ @@ -39069,7 +41614,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 340 */ +/* 361 */ /***/ function(module, exports, __webpack_require__) { /** @@ -39084,7 +41629,7 @@ return /******/ (function(modules) { // webpackBootstrap // components. var zrUtil = __webpack_require__(4); - var RoamController = __webpack_require__(177); + var RoamController = __webpack_require__(191); var throttle = __webpack_require__(81); var curry = zrUtil.curry; @@ -39264,7 +41809,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 341 */ +/* 362 */ /***/ function(module, exports, __webpack_require__) { /** @@ -39311,7 +41856,7 @@ return /******/ (function(modules) { // webpackBootstrap end: percentRange[1], startValue: valueRange[0], endValue: valueRange[1] - }); + }, true); }); }); @@ -39327,7 +41872,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 342 */ +/* 363 */ /***/ function(module, exports, __webpack_require__) { /** @@ -39336,7 +41881,7 @@ return /******/ (function(modules) { // webpackBootstrap var zrUtil = __webpack_require__(4); - var helper = __webpack_require__(332); + var helper = __webpack_require__(353); var echarts = __webpack_require__(1); @@ -39375,29 +41920,29 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 343 */, -/* 344 */, -/* 345 */, -/* 346 */, -/* 347 */, -/* 348 */, -/* 349 */, -/* 350 */, -/* 351 */, -/* 352 */, -/* 353 */, -/* 354 */, -/* 355 */, -/* 356 */, -/* 357 */, -/* 358 */ +/* 364 */, +/* 365 */, +/* 366 */, +/* 367 */, +/* 368 */, +/* 369 */, +/* 370 */, +/* 371 */, +/* 372 */, +/* 373 */, +/* 374 */, +/* 375 */, +/* 376 */, +/* 377 */, +/* 378 */, +/* 379 */ /***/ function(module, exports, __webpack_require__) { // HINT Markpoint can't be used too much - __webpack_require__(359); - __webpack_require__(361); + __webpack_require__(380); + __webpack_require__(382); __webpack_require__(1).registerPreprocessor(function (opt) { // Make sure markPoint component is enabled @@ -39406,12 +41951,12 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 359 */ +/* 380 */ /***/ function(module, exports, __webpack_require__) { - module.exports = __webpack_require__(360).extend({ + module.exports = __webpack_require__(381).extend({ type: 'markPoint', @@ -39444,7 +41989,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 360 */ +/* 381 */ /***/ function(module, exports, __webpack_require__) { @@ -39582,18 +42127,18 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 361 */ +/* 382 */ /***/ function(module, exports, __webpack_require__) { - var SymbolDraw = __webpack_require__(105); + var SymbolDraw = __webpack_require__(115); var zrUtil = __webpack_require__(4); var numberUtil = __webpack_require__(7); var List = __webpack_require__(98); - var markerHelper = __webpack_require__(362); + var markerHelper = __webpack_require__(383); function updateMarkerLayout(mpData, seriesModel, api) { var coordSys = seriesModel.coordinateSystem; @@ -39631,7 +42176,7 @@ return /******/ (function(modules) { // webpackBootstrap }); } - __webpack_require__(363).extend({ + __webpack_require__(384).extend({ type: 'markPoint', @@ -39743,7 +42288,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 362 */ +/* 383 */ /***/ function(module, exports, __webpack_require__) { @@ -39781,7 +42326,7 @@ return /******/ (function(modules) { // webpackBootstrap var coordArr = []; var value = numCalculate(data, targetDataDim, mlType); - var dataIndex = data.indexOfNearest(targetDataDim, value, true); + var dataIndex = data.indexOfNearest(targetDataDim, value, true)[0]; coordArr[otherCoordIndex] = data.get(otherDataDim, dataIndex, true); coordArr[targetCoordIndex] = data.get(targetDataDim, dataIndex, true); @@ -39947,7 +42492,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 363 */ +/* 384 */ /***/ function(module, exports, __webpack_require__) { @@ -39991,13 +42536,13 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 364 */ +/* 385 */ /***/ function(module, exports, __webpack_require__) { - __webpack_require__(365); - __webpack_require__(366); + __webpack_require__(386); + __webpack_require__(387); __webpack_require__(1).registerPreprocessor(function (opt) { // Make sure markLine component is enabled @@ -40006,12 +42551,12 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 365 */ +/* 386 */ /***/ function(module, exports, __webpack_require__) { - module.exports = __webpack_require__(360).extend({ + module.exports = __webpack_require__(381).extend({ type: 'markLine', @@ -40051,7 +42596,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 366 */ +/* 387 */ /***/ function(module, exports, __webpack_require__) { @@ -40060,9 +42605,9 @@ return /******/ (function(modules) { // webpackBootstrap var List = __webpack_require__(98); var numberUtil = __webpack_require__(7); - var markerHelper = __webpack_require__(362); + var markerHelper = __webpack_require__(383); - var LineDraw = __webpack_require__(202); + var LineDraw = __webpack_require__(216); var markLineTransform = function (seriesModel, coordSys, mlModel, item) { var data = seriesModel.getData(); @@ -40232,7 +42777,7 @@ return /******/ (function(modules) { // webpackBootstrap data.setItemLayout(idx, point); } - __webpack_require__(363).extend({ + __webpack_require__(384).extend({ type: 'markLine', @@ -40411,13 +42956,13 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 367 */ +/* 388 */ /***/ function(module, exports, __webpack_require__) { - __webpack_require__(368); - __webpack_require__(369); + __webpack_require__(389); + __webpack_require__(390); __webpack_require__(1).registerPreprocessor(function (opt) { // Make sure markArea component is enabled @@ -40426,12 +42971,12 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 368 */ +/* 389 */ /***/ function(module, exports, __webpack_require__) { - module.exports = __webpack_require__(360).extend({ + module.exports = __webpack_require__(381).extend({ type: 'markArea', @@ -40467,7 +43012,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 369 */ +/* 390 */ /***/ function(module, exports, __webpack_require__) { // TODO Better on polar @@ -40476,10 +43021,10 @@ return /******/ (function(modules) { // webpackBootstrap var zrUtil = __webpack_require__(4); var List = __webpack_require__(98); var numberUtil = __webpack_require__(7); - var graphic = __webpack_require__(43); + var graphic = __webpack_require__(44); var colorUtil = __webpack_require__(39); - var markerHelper = __webpack_require__(362); + var markerHelper = __webpack_require__(383); var markAreaTransform = function (seriesModel, coordSys, maModel, item) { var lt = markerHelper.dataTransform(seriesModel, item[0]); @@ -40599,7 +43144,7 @@ return /******/ (function(modules) { // webpackBootstrap var dimPermutations = [['x0', 'y0'], ['x1', 'y0'], ['x1', 'y1'], ['x0', 'y1']]; - __webpack_require__(363).extend({ + __webpack_require__(384).extend({ type: 'markArea', @@ -40789,37 +43334,37 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 370 */, -/* 371 */, -/* 372 */, -/* 373 */, -/* 374 */, -/* 375 */, -/* 376 */, -/* 377 */, -/* 378 */, -/* 379 */ +/* 391 */, +/* 392 */, +/* 393 */, +/* 394 */, +/* 395 */, +/* 396 */, +/* 397 */, +/* 398 */, +/* 399 */, +/* 400 */ /***/ function(module, exports, __webpack_require__) { - __webpack_require__(380); - __webpack_require__(381); + __webpack_require__(401); + __webpack_require__(402); - __webpack_require__(382); - __webpack_require__(383); - __webpack_require__(384); - __webpack_require__(385); - __webpack_require__(390); + __webpack_require__(403); + __webpack_require__(404); + __webpack_require__(405); + __webpack_require__(406); + __webpack_require__(411); /***/ }, -/* 380 */ +/* 401 */ /***/ function(module, exports, __webpack_require__) { - var featureManager = __webpack_require__(327); + var featureManager = __webpack_require__(344); var zrUtil = __webpack_require__(4); var ToolboxModel = __webpack_require__(1).extendComponentModel({ @@ -40890,17 +43435,17 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 381 */ +/* 402 */ /***/ function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(process) { - var featureManager = __webpack_require__(327); + var featureManager = __webpack_require__(344); var zrUtil = __webpack_require__(4); - var graphic = __webpack_require__(43); + var graphic = __webpack_require__(44); var Model = __webpack_require__(12); var DataDiffer = __webpack_require__(99); - var listComponentHelper = __webpack_require__(297); + var listComponentHelper = __webpack_require__(313); var textContain = __webpack_require__(8); module.exports = __webpack_require__(1).extendComponentView({ @@ -41142,10 +43687,10 @@ return /******/ (function(modules) { // webpackBootstrap } - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(289))) + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(305))) /***/ }, -/* 382 */ +/* 403 */ /***/ function(module, exports, __webpack_require__) { @@ -41209,7 +43754,7 @@ return /******/ (function(modules) { // webpackBootstrap } }; - __webpack_require__(327).register( + __webpack_require__(344).register( 'saveAsImage', SaveAsImage ); @@ -41217,7 +43762,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 383 */ +/* 404 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -41391,13 +43936,13 @@ return /******/ (function(modules) { // webpackBootstrap ecModel.mergeOption(payload.newOption); }); - __webpack_require__(327).register('magicType', MagicType); + __webpack_require__(344).register('magicType', MagicType); module.exports = MagicType; /***/ }, -/* 384 */ +/* 405 */ /***/ function(module, exports, __webpack_require__) { /** @@ -41708,7 +44253,7 @@ return /******/ (function(modules) { // webpackBootstrap var viewMain = document.createElement('div'); var textarea = document.createElement('textarea'); - viewMain.style.cssText = 'display:block;width:100%;overflow:hidden;'; + viewMain.style.cssText = 'display:block;width:100%;overflow:auto;'; var optionToContent = model.get('optionToContent'); var contentToOption = model.get('contentToOption'); @@ -41844,7 +44389,7 @@ return /******/ (function(modules) { // webpackBootstrap }); } - __webpack_require__(327).register('dataView', DataView); + __webpack_require__(344).register('dataView', DataView); __webpack_require__(1).registerAction({ type: 'changeDataView', @@ -41880,21 +44425,21 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 385 */ +/* 406 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var zrUtil = __webpack_require__(4); - var BrushController = __webpack_require__(236); - var brushHelper = __webpack_require__(322); - var history = __webpack_require__(386); + var BrushController = __webpack_require__(250); + var BrushTargetManager = __webpack_require__(339); + var history = __webpack_require__(407); var each = zrUtil.each; // Use dataZoomSelect - __webpack_require__(387); + __webpack_require__(408); // Spectial component id start with \0ec\0, see echarts/model/Global.js~hasInnerId var DATA_ZOOM_ID_BASE = '\0_ec_\0toolbox-dataZoom_'; @@ -41984,57 +44529,44 @@ return /******/ (function(modules) { // webpackBootstrap this._brushController.updateCovers([]); // remove cover - var coordInfoList = brushHelper.makeCoordInfoList( - retrieveAxisSetting(this.model.option), ecModel + var brushTargetManager = new BrushTargetManager( + retrieveAxisSetting(this.model.option), ecModel, {include: ['grid']} ); - var rangesCoordInfoList = []; - brushHelper.parseOutputRanges(areas, coordInfoList, ecModel, rangesCoordInfoList); - - var area = areas[0]; // dataZoom can not multiple area. - var coordInfo = rangesCoordInfoList[0]; - var coordRange = area.coordRange; - var brushType = area.brushType; + brushTargetManager.matchOutputRanges(areas, ecModel, function (area, coordRange, coordSys) { + if (coordSys.type !== 'cartesian2d') { + return; + } - if (coordInfo && coordRange) { + var brushType = area.brushType; if (brushType === 'rect') { - setBatch('xAxis', coordRange[0], coordInfo); - setBatch('yAxis', coordRange[1], coordInfo); + setBatch('x', coordSys, coordRange[0]); + setBatch('y', coordSys, coordRange[1]); } else { - var axisNames = {lineX: 'xAxis', lineY: 'yAxis'}; - setBatch(axisNames[brushType], coordRange, coordInfo); + setBatch(({lineX: 'x', lineY: 'y'})[brushType], coordSys, coordRange); } - } + }); history.push(ecModel, snapshot); this._dispatchZoomAction(snapshot); - function setBatch(axisName, minMax, coordInfo) { - var dataZoomModel = findDataZoom(axisName, coordInfo[axisName], ecModel); - if (dataZoomModel) { - snapshot[dataZoomModel.id] = { - dataZoomId: dataZoomModel.id, - startValue: minMax[0], - endValue: minMax[1] - }; - } + function setBatch(dimName, coordSys, minMax) { + var dataZoomModel = findDataZoom(dimName, coordSys.getAxis(dimName).model, ecModel); + dataZoomModel && (snapshot[dataZoomModel.id] = { + dataZoomId: dataZoomModel.id, + startValue: minMax[0], + endValue: minMax[1] + }); } - function findDataZoom(axisName, axisModel, ecModel) { - var dataZoomModel; - ecModel.eachComponent( - {mainType: 'dataZoom', subType: 'select'}, - function (dzModel, dataZoomIndex) { - var axisIndex = dzModel.get(axisName + 'Index'); - if (axisIndex != null - && ecModel.getComponent(axisName, axisIndex) === axisModel - ) { - dataZoomModel = dzModel; - } - } - ); - return dataZoomModel; + function findDataZoom(dimName, axisModel, ecModel) { + var found; + ecModel.eachComponent({mainType: 'dataZoom', subType: 'select'}, function (dzModel) { + var has = dzModel.getAxisModel(dimName, axisModel.componentIndex); + has && (found = dzModel); + }); + return found; } }; @@ -42086,24 +44618,25 @@ return /******/ (function(modules) { // webpackBootstrap featureModel.setIconStatus('zoom', zoomActive ? 'emphasis' : 'normal'); - var coordInfoList = brushHelper.makeCoordInfoList( - retrieveAxisSetting(featureModel.option), ecModel + var brushTargetManager = new BrushTargetManager( + retrieveAxisSetting(featureModel.option), ecModel, {include: ['grid']} ); - var brushType = (coordInfoList.xAxisHas && !coordInfoList.yAxisHas) - ? 'lineX' - : (!coordInfoList.xAxisHas && coordInfoList.yAxisHas) - ? 'lineY' - : 'rect'; view._brushController - .setPanels(brushHelper.makePanelOpts(coordInfoList)) + .setPanels(brushTargetManager.makePanelOpts(function (targetInfo) { + return (targetInfo.xAxisDeclared && !targetInfo.yAxisDeclared) + ? 'lineX' + : (!targetInfo.xAxisDeclared && targetInfo.yAxisDeclared) + ? 'lineY' + : 'rect'; + })) .enableBrush( zoomActive ? { - brushType: brushType, - brushStyle: { // FIXME user customized? + brushType: 'auto', + brushStyle: { + // FIXME user customized? lineWidth: 0, - // stroke: '#333', fill: 'rgba(0,0,0,0.2)' } } @@ -42112,7 +44645,7 @@ return /******/ (function(modules) { // webpackBootstrap } - __webpack_require__(327).register('dataZoom', DataZoom); + __webpack_require__(344).register('dataZoom', DataZoom); // Create special dataZoom option for select @@ -42188,7 +44721,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 386 */ +/* 407 */ /***/ function(module, exports, __webpack_require__) { /** @@ -42302,7 +44835,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 387 */ +/* 408 */ /***/ function(module, exports, __webpack_require__) { /** @@ -42310,21 +44843,21 @@ return /******/ (function(modules) { // webpackBootstrap */ - __webpack_require__(330); + __webpack_require__(351); - __webpack_require__(331); - __webpack_require__(334); + __webpack_require__(352); + __webpack_require__(355); - __webpack_require__(388); - __webpack_require__(389); + __webpack_require__(409); + __webpack_require__(410); - __webpack_require__(341); - __webpack_require__(342); + __webpack_require__(362); + __webpack_require__(363); /***/ }, -/* 388 */ +/* 409 */ /***/ function(module, exports, __webpack_require__) { /** @@ -42332,7 +44865,7 @@ return /******/ (function(modules) { // webpackBootstrap */ - var DataZoomModel = __webpack_require__(331); + var DataZoomModel = __webpack_require__(352); module.exports = DataZoomModel.extend({ @@ -42343,12 +44876,12 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 389 */ +/* 410 */ /***/ function(module, exports, __webpack_require__) { - module.exports = __webpack_require__(334).extend({ + module.exports = __webpack_require__(355).extend({ type: 'dataZoom.select' @@ -42357,13 +44890,13 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 390 */ +/* 411 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; - var history = __webpack_require__(386); + var history = __webpack_require__(407); function Restore(model) { this.model = model; @@ -42387,7 +44920,7 @@ return /******/ (function(modules) { // webpackBootstrap }; - __webpack_require__(327).register('restore', Restore); + __webpack_require__(344).register('restore', Restore); __webpack_require__(1).registerAction( @@ -42401,16 +44934,16 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 391 */ +/* 412 */ /***/ function(module, exports, __webpack_require__) { - __webpack_require__(392); - __webpack_require__(82).registerPainter('vml', __webpack_require__(394)); + __webpack_require__(413); + __webpack_require__(82).registerPainter('vml', __webpack_require__(415)); /***/ }, -/* 392 */ +/* 413 */ /***/ function(module, exports, __webpack_require__) { // http://www.w3.org/TR/NOTE-VML @@ -42420,18 +44953,18 @@ return /******/ (function(modules) { // webpackBootstrap if (!__webpack_require__(2).canvasSupported) { var vec2 = __webpack_require__(10); var BoundingRect = __webpack_require__(9); - var CMD = __webpack_require__(49).CMD; + var CMD = __webpack_require__(50).CMD; var colorTool = __webpack_require__(39); var textContain = __webpack_require__(8); - var RectText = __webpack_require__(48); - var Displayable = __webpack_require__(46); - var ZImage = __webpack_require__(61); + var RectText = __webpack_require__(49); + var Displayable = __webpack_require__(47); + var ZImage = __webpack_require__(62); var Text = __webpack_require__(63); - var Path = __webpack_require__(45); + var Path = __webpack_require__(46); var Gradient = __webpack_require__(79); - var vmlCore = __webpack_require__(393); + var vmlCore = __webpack_require__(414); var round = Math.round; var sqrt = Math.sqrt; @@ -43470,7 +46003,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 393 */ +/* 414 */ /***/ function(module, exports, __webpack_require__) { @@ -43523,7 +46056,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 394 */ +/* 415 */ /***/ function(module, exports, __webpack_require__) { /** @@ -43534,8 +46067,8 @@ return /******/ (function(modules) { // webpackBootstrap - var zrLog = __webpack_require__(40); - var vmlCore = __webpack_require__(393); + var zrLog = __webpack_require__(41); + var vmlCore = __webpack_require__(414); function parseInt10(val) { return parseInt(val, 10); @@ -43709,7 +46242,7 @@ return /******/ (function(modules) { // webpackBootstrap } var notSupportedMethods = [ - 'getLayer', 'insertLayer', 'eachLayer', 'eachBuildinLayer', 'eachOtherLayer', 'getLayers', + 'getLayer', 'insertLayer', 'eachLayer', 'eachBuiltinLayer', 'eachOtherLayer', 'getLayers', 'modLayer', 'delLayer', 'clearLayer', 'toDataURL', 'pathToImage' ]; diff --git a/dist/echarts.common.min.js b/dist/echarts.common.min.js index 98fff8b456..a8edd26c11 100644 --- a/dist/echarts.common.min.js +++ b/dist/echarts.common.min.js @@ -1,4 +1,4 @@ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.echarts=e():t.echarts=e()}(this,function(){return function(t){function e(n){if(i[n])return i[n].exports;var r=i[n]={exports:{},id:n,loaded:!1};return t[n].call(r.exports,r,r.exports,e),r.loaded=!0,r.exports}var i={};return e.m=t,e.c=i,e.p="",e(0)}([function(t,e,i){t.exports=i(2),i(100),i(94),i(104),i(178),i(191),i(215),i(192),i(31),i(206),i(199),i(198),i(197),i(181),i(207),i(222)},function(t,e){function i(t){if(null==t||"object"!=typeof t)return t;var e=t,n=O.call(t);if("[object Array]"===n){e=[];for(var r=0,o=t.length;re.get("hoverLayerThreshold")&&!w.node&&i.traverse(function(t){t.isGroup||(t.useHoverLayer=!0)})}function x(t,e){var i=0;e.group.traverse(function(t){"group"===t.type||t.ignore||i++});var n=+t.get("progressive"),r=i>t.get("progressiveThreshold")&&n&&!w.node;r&&e.group.traverse(function(t){t.isGroup||(t.progressive=r?Math.floor(i++/n):-1,r&&t.stopAnimation(!0))});var o=t.get("blendMode")||null;e.group.traverse(function(t){t.isGroup||t.setStyle("blend",o)})}function _(t,e){var i=t.get("z"),n=t.get("zlevel");e.group.traverse(function(t){"group"!==t.type&&(null!=i&&(t.z=i),null!=n&&(t.zlevel=n))})}function b(t){function e(t,e){for(var i=0;ie.get("hoverLayerThreshold")&&!w.node&&i.traverse(function(t){t.isGroup||(t.useHoverLayer=!0)})}function x(t,e){var i=0;e.group.traverse(function(t){"group"===t.type||t.ignore||i++});var n=+t.get("progressive"),r=i>t.get("progressiveThreshold")&&n&&!w.node;r&&e.group.traverse(function(t){t.isGroup||(t.progressive=r?Math.floor(i++/n):-1,r&&t.stopAnimation(!0))});var o=t.get("blendMode")||null;e.group.traverse(function(t){t.isGroup||t.setStyle("blend",o)})}function _(t,e){var i=t.get("z"),n=t.get("zlevel");e.group.traverse(function(t){"group"!==t.type&&(null!=i&&(t.z=i),null!=n&&(t.zlevel=n))})}function b(t){function e(t,e){for(var i=0;i=0&&E.each(t,function(t){var r=t.coordinateSystem;if(r&&r.containPoint)i|=!!r.containPoint(e);else if("seriesModels"===n){var o=this._chartsMap[t.__viewId];o&&o.containPoint&&(i|=o.containPoint(e,t))}},this)},this),!!i},K.getVisual=function(t,e){var i=this._model;t=D.parseFinder(i,t,{defaultMainType:"series"});var n=t.seriesModel,r=n.getData(),o=t.hasOwnProperty("dataIndexInside")?t.dataIndexInside:t.hasOwnProperty("dataIndex")?r.indexOfRawIndex(t.dataIndex):null;return null!=o?r.getItemVisual(o,e):r.getVisual(e)};var J={update:function(t){var e=this._model,i=this._api,n=this._coordSysMgr,r=this._zr;if(e){e.restoreData(),n.create(this._model,this._api),f.call(this,e,i),p.call(this,e),n.update(e,i),m.call(this,e,t),v.call(this,e,t);var o=e.get("backgroundColor")||"transparent",a=r.painter;if(a.isSingleCanvas&&a.isSingleCanvas())r.configLayer(0,{clearColor:o});else{if(!w.canvasSupported){var s=N.parse(o);o=N.stringify(s,"rgb"),0===s[3]&&(o="transparent")}o.colorStops||o.image?(r.configLayer(0,{clearColor:o}),this[Y]=!0,this._dom.style.background="transparent"):(this[Y]&&r.configLayer(0,{clearColor:null}),this[Y]=!1,this._dom.style.background=o)}}},updateView:function(t){var e=this._model;e&&(e.eachSeries(function(t){t.getData().clearAllVisual()}),m.call(this,e,t),c.call(this,"updateView",e,t))},updateVisual:function(t){var e=this._model;e&&(e.eachSeries(function(t){t.getData().clearAllVisual()}),m.call(this,e,t,!0),c.call(this,"updateVisual",e,t))},updateLayout:function(t){var e=this._model;e&&(g.call(this,e,t),c.call(this,"updateLayout",e,t))},prepareAndUpdate:function(t){var e=this._model;d.call(this,"component",e),d.call(this,"chart",e),this.__lastOnlyGraphic?(V(this._componentsViews,function(i){var n=i.__model;n&&"graphic"===n.mainType&&(i.render(n,e,this._api,t),_(n,i))},this),this.__lastOnlyGraphic=!1):J.update.call(this,t)}};K.resize=function(t){this[X]=!0,this._zr.resize(t);var e=this._model&&this._model.resetOption("media"),i=e?"prepareAndUpdate":"update";J[i].call(this),this._loadingFX&&this._loadingFX.resize(),this[X]=!1;var n=t&&t.silent;h.call(this,n),u.call(this,n)},K.showLoading=function(t,e){if(E.isObject(t)&&(e=t,t=""),t=t||"default",this.hideLoading(),st[t]){var i=st[t](this._api,e),n=this._zr;this._loadingFX=i,n.add(i)}},K.hideLoading=function(){this._loadingFX&&this._zr.remove(this._loadingFX),this._loadingFX=null},K.makeActionFromEvent=function(t){var e=E.extend({},t);return e.type=it[t.type],e},K.dispatchAction=function(t,e){if(E.isObject(e)||(e={silent:!!e}),et[t.type]){if(this[X])return void this._pendingActions.push(t);l.call(this,t,e.silent),e.flush?this._zr.flush(!0):e.flush!==!1&&w.browser.weChat&&this._throttledZrFlush(),h.call(this,e.silent),u.call(this,e.silent)}},K.on=n("on"),K.off=n("off"),K.one=n("one");var tt=["click","dblclick","mouseover","mouseout","mousemove","mousedown","mouseup","globalout","contextmenu"];K._initEvents=function(){V(tt,function(t){this._zr.on(t,function(e){var i,n=this.getModel(),r=e.target;if("globalout"===t)i={};else if(r&&null!=r.dataIndex){var o=r.dataModel||n.getSeriesByIndex(r.seriesIndex);i=o&&o.getDataParams(r.dataIndex,r.dataType)||{}}else r&&r.eventData&&(i=E.extend({},r.eventData));i&&(i.event=e,i.type=t,this.trigger(t,i))},this)},this),V(it,function(t,e){this._messageCenter.on(e,function(t){this.trigger(e,t)},this)},this)},K.isDisposed=function(){return this._disposed},K.clear=function(){this.setOption({series:[]},!0)},K.dispose=function(){if(!this._disposed){this._disposed=!0;var t=this._api,e=this._model;V(this._componentsViews,function(i){i.dispose(e,t)}),V(this._chartsViews,function(i){i.dispose(e,t)}),this._zr.dispose(),delete lt[this.id]}},E.mixin(o,R);var et=[],it={},nt=[],rt=[],ot=[],at={},st={},lt={},ht={},ut=new Date-0,ct=new Date-0,dt="_echarts_instance_",ft={version:"3.4.0",dependencies:{zrender:"3.3.0"}};ft.init=function(t,e,i){var n=new o(t,e,i);return n.id="ec_"+ut++,lt[n.id]=n,t.setAttribute&&t.setAttribute(dt,n.id),b(n),n},ft.connect=function(t){if(E.isArray(t)){var e=t;t=null,E.each(e,function(e){null!=e.group&&(t=e.group)}),t=t||"g_"+ct++,E.each(e,function(e){e.group=t})}return ht[t]=!0,t},ft.disConnect=function(t){ht[t]=!1},ft.dispose=function(t){E.isDom(t)?t=ft.getInstanceByDom(t):"string"==typeof t&&(t=lt[t]),t instanceof o&&!t.isDisposed()&&t.dispose()},ft.getInstanceByDom=function(t){var e=t.getAttribute(dt);return lt[e]},ft.getInstanceById=function(t){return lt[t]},ft.registerTheme=function(t,e){at[t]=e},ft.registerPreprocessor=function(t){rt.push(t)},ft.registerProcessor=function(t,e){"function"==typeof t&&(e=t,t=G),nt.push({prio:t,func:e})},ft.registerAction=function(t,e,i){"function"==typeof e&&(i=e,e="");var n=E.isObject(t)?t.type:[t,t={event:e}][0];t.event=(t.event||n).toLowerCase(),e=t.event,E.assert(Q.test(n)&&Q.test(e)),et[n]||(et[n]={action:i,actionInfo:t}),it[e]=n},ft.registerCoordinateSystem=function(t,e){T.register(t,e)},ft.registerLayout=function(t,e){"function"==typeof t&&(e=t,t=W),ot.push({prio:t,func:e,isLayout:!0})},ft.registerVisual=function(t,e){"function"==typeof t&&(e=t,t=q),ot.push({prio:t,func:e})},ft.registerLoading=function(t,e){st[t]=e},ft.extendComponentModel=function(t){return I.extend(t)},ft.extendComponentView=function(t){return k.extend(t)},ft.extendSeriesModel=function(t){return C.extend(t)},ft.extendChartView=function(t){return L.extend(t)},ft.setCanvasCreator=function(t){E.createCanvas=t},ft.registerVisual(Z,i(139)),ft.registerPreprocessor(i(133)),ft.registerLoading("default",i(124)),ft.registerAction({type:"highlight",event:"highlight",update:"highlight"},E.noop),ft.registerAction({type:"downplay",event:"downplay",update:"downplay"},E.noop),ft.List=i(14),ft.Model=i(11),ft.graphic=i(3),ft.number=i(4),ft.format=i(8),ft.throttle=O.throttle,ft.matrix=i(20),ft.vector=i(5),ft.color=i(19),ft.util={},V(["map","each","filter","indexOf","inherits","reduce","filter","bind","curry","isArray","isString","isObject","isFunction","extend","defaults","clone"],function(t){ft.util[t]=E[t]}),ft.PRIORITY={PROCESSOR:{FILTER:G,STATISTIC:H},VISUAL:{LAYOUT:W,GLOBAL:Z,CHART:q,COMPONENT:j,BRUSH:U}},t.exports=ft},function(t,e,i){"use strict";function n(t){return null!=t&&"none"!=t}function r(t){return"string"==typeof t?_.lift(t,-.1):t}function o(t){if(t.__hoverStlDirty){var e=t.style.stroke,i=t.style.fill,o=t.__hoverStl;o.fill=o.fill||(n(i)?r(i):null),o.stroke=o.stroke||(n(e)?r(e):null);var a={};for(var s in o)o.hasOwnProperty(s)&&(a[s]=t.style[s]);t.__normalStl=a,t.__hoverStlDirty=!1}}function a(t){t.__isHover||(o(t),t.useHoverLayer?t.__zr&&t.__zr.addHover(t,t.__hoverStl):(t.setStyle(t.__hoverStl),t.z2+=1),t.__isHover=!0)}function s(t){if(t.__isHover){var e=t.__normalStl;t.useHoverLayer?t.__zr&&t.__zr.removeHover(t):(e&&t.setStyle(e),t.z2-=1),t.__isHover=!1}}function l(t){"group"===t.type?t.traverse(function(t){"group"!==t.type&&a(t)}):a(t)}function h(t){"group"===t.type?t.traverse(function(t){"group"!==t.type&&s(t)}):s(t)}function u(t,e){t.__hoverStl=t.hoverStyle||e||{},t.__hoverStlDirty=!0,t.__isHover&&o(t)}function c(t){this.__hoverSilentOnTouch&&t.zrByTouch||!this.__isEmphasis&&l(this)}function d(t){this.__hoverSilentOnTouch&&t.zrByTouch||!this.__isEmphasis&&h(this)}function f(){this.__isEmphasis=!0,l(this)}function p(){this.__isEmphasis=!1,h(this)}function g(t,e,i,n,r,o){"function"==typeof r&&(o=r,r=null);var a=n&&n.isAnimationEnabled();if(a){var s=t?"Update":"",l=n.getShallow("animationDuration"+s),h=n.getShallow("animationEasing"+s),u=n.getShallow("animationDelay"+s);"function"==typeof u&&(u=u(r,n.getAnimationDelayParams?n.getAnimationDelayParams(e,r):null)),"function"==typeof l&&(l=l(r)),l>0?e.animateTo(i,l,u||0,h,o):(e.attr(i),o&&o())}else e.attr(i),o&&o()}var m=i(1),v=i(169),y=Math.round,x=i(7),_=i(19),b=i(20),w=i(5),M={};M.Group=i(34),M.Image=i(49),M.Text=i(76),M.Circle=i(160),M.Sector=i(166),M.Ring=i(165),M.Polygon=i(162),M.Polyline=i(163),M.Rect=i(164),M.Line=i(161),M.BezierCurve=i(159),M.Arc=i(158),M.CompoundPath=i(153),M.LinearGradient=i(91),M.RadialGradient=i(154),M.BoundingRect=i(9),M.extendShape=function(t){return x.extend(t)},M.extendPath=function(t,e){return v.extendFromString(t,e)},M.makePath=function(t,e,i,n){var r=v.createFromString(t,e),o=r.getBoundingRect();if(i){var a=o.width/o.height;if("center"===n){var s,l=i.height*a;l<=i.width?s=i.height:(l=i.width,s=l/a);var h=i.x+i.width/2,u=i.y+i.height/2;i.x=h-l/2,i.y=u-s/2,i.width=l,i.height=s}M.resizePath(r,i)}return r},M.mergePath=v.mergePath,M.resizePath=function(t,e){if(t.applyTransform){var i=t.getBoundingRect(),n=i.calculateTransform(e);t.applyTransform(n)}},M.subPixelOptimizeLine=function(t){var e=M.subPixelOptimize,i=t.shape,n=t.style.lineWidth;return y(2*i.x1)===y(2*i.x2)&&(i.x1=i.x2=e(i.x1,n,!0)),y(2*i.y1)===y(2*i.y2)&&(i.y1=i.y2=e(i.y1,n,!0)),t},M.subPixelOptimizeRect=function(t){var e=M.subPixelOptimize,i=t.shape,n=t.style.lineWidth,r=i.x,o=i.y,a=i.width,s=i.height;return i.x=e(i.x,n,!0),i.y=e(i.y,n,!0),i.width=Math.max(e(r+a,n,!1)-i.x,0===a?0:1),i.height=Math.max(e(o+s,n,!1)-i.y,0===s?0:1),t},M.subPixelOptimize=function(t,e,i){var n=y(2*t);return(n+y(e))%2===0?n/2:(n+(i?1:-1))/2},M.setHoverStyle=function(t,e,i){t.__hoverSilentOnTouch=i&&i.hoverSilentOnTouch,"group"===t.type?t.traverse(function(t){"group"!==t.type&&u(t,e)}):u(t,e),t.on("mouseover",c).on("mouseout",d),t.on("emphasis",f).on("normal",p)},M.setText=function(t,e,i){var n=e.getShallow("position")||"inside",r=e.getShallow("offset"),o=n.indexOf("inside")>=0?"white":i,a=e.getModel("textStyle");m.extend(t,{textDistance:e.getShallow("distance")||5,textFont:a.getFont(),textPosition:n,textOffset:r,textFill:a.getTextColor()||o})},M.updateProps=function(t,e,i,n,r){g(!0,t,e,i,n,r)},M.initProps=function(t,e,i,n,r){g(!1,t,e,i,n,r)},M.getTransform=function(t,e){for(var i=b.identity([]);t&&t!==e;)b.mul(i,t.getLocalTransform(),i),t=t.parent;return i},M.applyTransform=function(t,e,i){return i&&(e=b.invert([],e)),w.applyTransform([],t,e)},M.transformDirection=function(t,e,i){var n=0===e[4]||0===e[5]||0===e[0]?1:Math.abs(2*e[4]/e[0]),r=0===e[4]||0===e[5]||0===e[2]?1:Math.abs(2*e[4]/e[2]),o=["left"===t?-n:"right"===t?n:0,"top"===t?-r:"bottom"===t?r:0];return o=M.applyTransform(o,e,i),Math.abs(o[0])>Math.abs(o[1])?o[0]>0?"right":"left":o[1]>0?"bottom":"top"},M.groupTransition=function(t,e,i,n){function r(t){var e={};return t.traverse(function(t){!t.isGroup&&t.anid&&(e[t.anid]=t)}),e}function o(t){var e={position:w.clone(t.position),rotation:t.rotation};return t.shape&&(e.shape=m.extend({},t.shape)),e}if(t&&e){var a=r(t);e.traverse(function(t){if(!t.isGroup&&t.anid){var e=a[t.anid];if(e){var n=o(t);t.attr(o(e)),M.updateProps(t,n,i,t.dataIndex)}}})}},t.exports=M},function(t,e){function i(t){return t.replace(/^\s+/,"").replace(/\s+$/,"")}var n={},r=1e-4;n.linearMap=function(t,e,i,n){var r=e[1]-e[0],o=i[1]-i[0];if(0===r)return 0===o?i[0]:(i[0]+i[1])/2;if(n)if(r>0){if(t<=e[0])return i[0];if(t>=e[1])return i[1]}else{if(t>=e[0])return i[0];if(t<=e[1])return i[1]}else{if(t===e[0])return i[0];if(t===e[1])return i[1]}return(t-e[0])/r*o+i[0]},n.parsePercent=function(t,e){switch(t){case"center":case"middle":t="50%";break;case"left":case"top":t="0%";break;case"right":case"bottom":t="100%"}return"string"==typeof t?i(t).match(/%$/)?parseFloat(t)/100*e:parseFloat(t):null==t?NaN:+t},n.round=function(t,e){return null==e&&(e=10),e=Math.min(Math.max(0,e),20),+(+t).toFixed(e)},n.asc=function(t){return t.sort(function(t,e){return t-e}),t},n.getPrecision=function(t){if(t=+t,isNaN(t))return 0;for(var e=1,i=0;Math.round(t*e)/e!==t;)e*=10,i++;return i},n.getPrecisionSafe=function(t){var e=t.toString(),i=e.indexOf(".");return i<0?0:e.length-1-i},n.getPixelPrecision=function(t,e){var i=Math.log,n=Math.LN10,r=Math.floor(i(t[1]-t[0])/n),o=Math.round(i(Math.abs(e[1]-e[0]))/n),a=Math.min(Math.max(-r+o,0),20);return isFinite(a)?a:20},n.MAX_SAFE_INTEGER=9007199254740991,n.remRadian=function(t){var e=2*Math.PI;return(t%e+e)%e},n.isRadianAroundZero=function(t){return t>-r&&t=0},t.exports=n},function(t,e){var i="undefined"==typeof Float32Array?Array:Float32Array,n={create:function(t,e){var n=new i(2);return null==t&&(t=0),null==e&&(e=0),n[0]=t,n[1]=e,n},copy:function(t,e){return t[0]=e[0],t[1]=e[1],t},clone:function(t){var e=new i(2);return e[0]=t[0],e[1]=t[1],e},set:function(t,e,i){return t[0]=e,t[1]=i,t},add:function(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t},scaleAndAdd:function(t,e,i,n){return t[0]=e[0]+i[0]*n,t[1]=e[1]+i[1]*n,t},sub:function(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t},len:function(t){return Math.sqrt(this.lenSquare(t))},lenSquare:function(t){return t[0]*t[0]+t[1]*t[1]},mul:function(t,e,i){return t[0]=e[0]*i[0],t[1]=e[1]*i[1],t},div:function(t,e,i){return t[0]=e[0]/i[0],t[1]=e[1]/i[1],t},dot:function(t,e){return t[0]*e[0]+t[1]*e[1]},scale:function(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t},normalize:function(t,e){var i=n.len(e);return 0===i?(t[0]=0,t[1]=0):(t[0]=e[0]/i,t[1]=e[1]/i),t},distance:function(t,e){return Math.sqrt((t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1]))},distanceSquare:function(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])},negate:function(t,e){return t[0]=-e[0],t[1]=-e[1],t},lerp:function(t,e,i,n){return t[0]=e[0]+n*(i[0]-e[0]),t[1]=e[1]+n*(i[1]-e[1]),t},applyTransform:function(t,e,i){var n=e[0],r=e[1];return t[0]=i[0]*n+i[2]*r+i[4],t[1]=i[1]*n+i[3]*r+i[5],t},min:function(t,e,i){return t[0]=Math.min(e[0],i[0]),t[1]=Math.min(e[1],i[1]),t},max:function(t,e,i){return t[0]=Math.max(e[0],i[0]),t[1]=Math.max(e[1],i[1]),t}};n.length=n.len,n.lengthSquare=n.lenSquare,n.dist=n.distance,n.distSquare=n.distanceSquare,t.exports=n},function(t,e,i){function n(t,e){return t&&t.hasOwnProperty(e)}var r=i(8),o=i(4),a=i(11),s=i(1),l=s.each,h=s.isObject,u={};u.normalizeToArray=function(t){return t instanceof Array?t:null==t?[]:[t]},u.defaultEmphasis=function(t,e){if(t){var i=t.emphasis=t.emphasis||{},n=t.normal=t.normal||{};l(e,function(t){var e=s.retrieve(i[t],n[t]);null!=e&&(i[t]=e)})}},u.LABEL_OPTIONS=["position","offset","show","textStyle","distance","formatter"],u.getDataItemValue=function(t){return t&&(null==t.value?t:t.value)},u.isDataItemOption=function(t){return h(t)&&!(t instanceof Array)},u.converDataValue=function(t,e){var i=e&&e.type;return"ordinal"===i?t:("time"!==i||isFinite(t)||null==t||"-"===t||(t=+o.parseDate(t)),null==t||""===t?NaN:+t)},u.createDataFormatModel=function(t,e){var i=new a;return s.mixin(i,u.dataFormatMixin),i.seriesIndex=e.seriesIndex,i.name=e.name||"",i.mainType=e.mainType,i.subType=e.subType,i.getData=function(){return t},i},u.dataFormatMixin={getDataParams:function(t,e){var i=this.getData(e),n=this.seriesIndex,r=this.name,o=this.getRawValue(t,e),a=i.getRawIndex(t),s=i.getName(t,!0),l=i.getRawDataItem(t);return{componentType:this.mainType,componentSubType:this.subType,seriesType:"series"===this.mainType?this.subType:null,seriesIndex:n,seriesName:r,name:s,dataIndex:a,data:l,dataType:e,value:o,color:i.getItemVisual(t,"color"),$vars:["seriesName","name","value"]}},getFormattedLabel:function(t,e,i,n){e=e||"normal";var o=this.getData(i),a=o.getItemModel(t),s=this.getDataParams(t,i);null!=n&&s.value instanceof Array&&(s.value=s.value[n]);var l=a.get(["label",e,"formatter"]);return"function"==typeof l?(s.status=e,l(s)):"string"==typeof l?r.formatTpl(l,s):void 0},getRawValue:function(t,e){var i=this.getData(e),n=i.getRawDataItem(t);if(null!=n)return!h(n)||n instanceof Array?n:n.value},formatTooltip:s.noop},u.mappingToExists=function(t,e){e=(e||[]).slice();var i=s.map(t||[],function(t,e){return{exist:t}});return l(e,function(t,n){if(h(t)){for(var r=0;r=i.length&&i.push({option:t})}}),i},u.makeIdAndName=function(t){var e={};l(t,function(t,i){var n=t.exist;n&&(e[n.id]=t)}),l(t,function(t,i){var n=t.option;s.assert(!n||null==n.id||!e[n.id]||e[n.id]===t,"id duplicates: "+(n&&n.id)),n&&null!=n.id&&(e[n.id]=t),!t.keyInfo&&(t.keyInfo={})}),l(t,function(t,i){var n=t.exist,r=t.option,o=t.keyInfo;if(h(r)){if(o.name=null!=r.name?r.name+"":n?n.name:"\0-",n)o.id=n.id;else if(null!=r.id)o.id=r.id+"";else{var a=0;do o.id="\0"+o.name+"\0"+a++;while(e[o.id])}e[o.id]=t}})},u.isIdInner=function(t){return h(t)&&t.id&&0===(t.id+"").indexOf("\0_ec_\0")},u.compressBatches=function(t,e){function i(t,e,i){for(var n=0,r=t.length;n1e-10&&(r.width+=o/a,r.height+=o/a,r.x-=o/a/2,r.y-=o/a/2)}return r}return t},contain:function(t,e){var i=this.transformCoordToLocal(t,e),n=this.getBoundingRect(),r=this.style;if(t=i[0],e=i[1],n.contain(t,e)){var o=this.path.data;if(r.hasStroke()){var a=r.lineWidth,l=r.strokeNoScale?this.getLineScale():1;if(l>1e-10&&(r.hasFill()||(a=Math.max(a,this.strokeContainThreshold)),s.containStroke(o,a/l,t,e)))return!0}if(r.hasFill())return s.contain(o,t,e)}return!1},dirty:function(t){null==t&&(t=!0),t&&(this.__dirtyPath=t,this._rect=null),this.__dirty=!0,this.__zr&&this.__zr.refresh(),this.__clipTarget&&this.__clipTarget.dirty()},animateShape:function(t){return this.animate("shape",t)},attrKV:function(t,e){"shape"===t?(this.setShape(e),this.__dirtyPath=!0,this._rect=null):r.prototype.attrKV.call(this,t,e)},setShape:function(t,e){var i=this.shape;if(i){if(o.isObject(t))for(var n in t)t.hasOwnProperty(n)&&(i[n]=t[n]);else i[t]=e;this.dirty(!0)}return this},getLineScale:function(){var t=this.transform;return t&&u(t[0]-1)>1e-10&&u(t[3]-1)>1e-10?Math.sqrt(u(t[0]*t[3]-t[2]*t[1])):1}},n.extend=function(t){var e=function(e){n.call(this,e),t.style&&this.style.extendFrom(t.style,!1);var i=t.shape;if(i){this.shape=this.shape||{};var r=this.shape;for(var o in i)!r.hasOwnProperty(o)&&i.hasOwnProperty(o)&&(r[o]=i[o])}t.init&&t.init.call(this,e)};o.inherits(e,n);for(var i in t)"style"!==i&&"shape"!==i&&(e.prototype[i]=t[i]);return e},o.inherits(n,r),t.exports=n},function(t,e,i){var n=i(1),r=i(4),o=i(17),a={};a.addCommas=function(t){return isNaN(t)?"-":(t=(t+"").split("."),t[0].replace(/(\d{1,3})(?=(?:\d{3})+(?!\d))/g,"$1,")+(t.length>1?"."+t[1]:""))},a.toCamelCase=function(t,e){return t=(t||"").toLowerCase().replace(/-(.)/g,function(t,e){return e.toUpperCase()}),e&&t&&(t=t.charAt(0).toUpperCase()+t.slice(1)),t},a.normalizeCssArray=function(t){var e=t.length;return"number"==typeof t?[t,t,t,t]:2===e?[t[0],t[1],t[0],t[1]]:3===e?[t[0],t[1],t[2],t[1]]:t};var s=a.encodeHTML=function(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")},l=["a","b","c","d","e","f","g"],h=function(t,e){return"{"+t+(null==e?"":e)+"}"};a.formatTpl=function(t,e,i){n.isArray(e)||(e=[e]);var r=e.length;if(!r)return"";for(var o=e[0].$vars||[],a=0;a=i.x&&t<=i.x+i.width&&e>=i.y&&e<=i.y+i.height},clone:function(){return new n(this.x,this.y,this.width,this.height)},copy:function(t){this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height},plain:function(){return{x:this.x,y:this.y,width:this.width,height:this.height}}},n.create=function(t){return new n(t.x,t.y,t.width,t.height)},t.exports=n},function(t,e){function i(t){var e={},i={},n=t.match(/Firefox\/([\d.]+)/),r=t.match(/MSIE\s([\d.]+)/)||t.match(/Trident\/.+?rv:(([\d.]+))/),o=t.match(/Edge\/([\d.]+)/),a=/micromessenger/i.test(t);return n&&(i.firefox=!0,i.version=n[1]),r&&(i.ie=!0,i.version=r[1]),o&&(i.edge=!0,i.version=o[1]),a&&(i.weChat=!0),{browser:i,os:e,node:!1,canvasSupported:!!document.createElement("canvas").getContext,touchEventsSupported:"ontouchstart"in window&&!i.ie&&!i.edge,pointerEventsSupported:"onpointerdown"in window&&(i.edge||i.ie&&i.version>=11)}}var n={};n="undefined"==typeof navigator?{browser:{},os:{},node:!0,canvasSupported:!0}:i(navigator.userAgent),t.exports=n},function(t,e,i){function n(t,e,i){this.parentModel=e,this.ecModel=i,this.option=t}function r(t,e,i){for(var n=0;nn||l.newline?(o=0,u=m,a+=s+i,s=f.height):s=Math.max(s,f.height)}else{var v=f.height+(g?-g.y+f.y:0);c=a+v,c>r||l.newline?(o+=s+i,a=0,c=v,s=f.width):s=Math.max(s,f.width)}l.newline||(d[0]=o,d[1]=a,"horizontal"===t?o=u+i:a=c+i)})}var r=i(1),o=i(9),a=i(4),s=i(8),l=a.parsePercent,h=r.each,u={},c=u.LOCATION_PARAMS=["left","right","top","bottom","width","height"];u.box=n,u.vbox=r.curry(n,"vertical"),u.hbox=r.curry(n,"horizontal"),u.getAvailableSize=function(t,e,i){var n=e.width,r=e.height,o=l(t.x,n),a=l(t.y,r),h=l(t.x2,n),u=l(t.y2,r);return(isNaN(o)||isNaN(parseFloat(t.x)))&&(o=0),(isNaN(h)||isNaN(parseFloat(t.x2)))&&(h=n),(isNaN(a)||isNaN(parseFloat(t.y)))&&(a=0),(isNaN(u)||isNaN(parseFloat(t.y2)))&&(u=r),i=s.normalizeCssArray(i||0),{width:Math.max(h-o-i[1]-i[3],0),height:Math.max(u-a-i[0]-i[2],0)}},u.getLayoutRect=function(t,e,i){i=s.normalizeCssArray(i||0);var n=e.width,r=e.height,a=l(t.left,n),h=l(t.top,r),u=l(t.right,n),c=l(t.bottom,r),d=l(t.width,n),f=l(t.height,r),p=i[2]+i[0],g=i[1]+i[3],m=t.aspect;switch(isNaN(d)&&(d=n-u-g-a),isNaN(f)&&(f=r-c-p-h),isNaN(d)&&isNaN(f)&&(m>n/r?d=.8*n:f=.8*r),null!=m&&(isNaN(d)&&(d=m*f),isNaN(f)&&(f=d/m)),isNaN(a)&&(a=n-u-d-g),isNaN(h)&&(h=r-c-f-p),t.left||t.right){case"center":a=n/2-d/2-i[3];break;case"right":a=n-d-g}switch(t.top||t.bottom){case"middle":case"center":h=r/2-f/2-i[0];break;case"bottom":h=r-f-p}a=a||0,h=h||0,isNaN(d)&&(d=n-a-(u||0)),isNaN(f)&&(f=r-h-(c||0));var v=new o(a+i[3],h+i[0],d,f);return v.margin=i,v},u.positionElement=function(t,e,i,n,a){var s=!a||!a.hv||a.hv[0],l=!a||!a.hv||a.hv[1],h=a&&a.boundingMode||"all";if(s||l){var c;if("raw"===h)c="group"===t.type?new o(0,0,+e.width||0,+e.height||0):t.getBoundingRect();else if(c=t.getBoundingRect(),t.needLocalTransform()){var d=t.getLocalTransform();c=c.clone(),c.applyTransform(d)}e=u.getLayoutRect(r.defaults({width:c.width, -height:c.height},e),i,n);var f=t.position,p=s?e.x-c.x:0,g=l?e.y-c.y:0;t.attr("position","raw"===h?[p,g]:[f[0]+p,f[1]+g])}},u.mergeLayoutParam=function(t,e,i){function n(n){var r={},s=0,l={},u=0,c=i.ignoreSize?1:2;if(h(n,function(e){l[e]=t[e]}),h(n,function(t){o(e,t)&&(r[t]=l[t]=e[t]),a(r,t)&&s++,a(l,t)&&u++}),u!==c&&s){if(s>=c)return r;for(var d=0;d=0;r--)n=o.merge(n,t[r],!0);l.set(this,"__defaultOption",n)}return l.get(this,"__defaultOption")},getReferringComponents:function(t){return this.ecModel.queryComponents({mainType:t,index:this.get(t+"Index",!0),id:this.get(t+"Id",!0)})}});l.enableClassManagement(u,{registerWhenExtend:!0}),s.enableSubTypeDefaulter(u),s.enableTopologicalTravel(u,n),o.mixin(u,i(129)),t.exports=u},function(t,e,i){(function(e){function n(t){return d.isArray(t)||(t=[t]),t}function r(t,e){var i=t.dimensions,n=new v(d.map(i,t.getDimensionInfo,t),t.hostModel);m(n,t);for(var r=n._storage={},o=t._storage,a=0;a=0?r[s]=new l.constructor(o[s].length):r[s]=o[s]}return n}var o="undefined",a="undefined"==typeof window?e:window,s=typeof a.Float64Array===o?Array:a.Float64Array,l=typeof a.Int32Array===o?Array:a.Int32Array,h={"float":s,"int":l,ordinal:Array,number:Array,time:Array},u=i(11),c=i(43),d=i(1),f=i(6),p=d.isObject,g=["stackedOn","hasItemOption","_nameList","_idList","_rawData"],m=function(t,e){d.each(g.concat(e.__wrappedMethods||[]),function(i){e.hasOwnProperty(i)&&(t[i]=e[i])}),t.__wrappedMethods=e.__wrappedMethods},v=function(t,e){t=t||["x","y"];for(var i={},n=[],r=0;r0&&(w+="__ec__"+u[b]),u[b]++),w&&(l[c]=w)}this._nameList=e,this._idList=l},y.count=function(){return this.indices.length},y.get=function(t,e,i){var n=this._storage,r=this.indices[e];if(null==r)return NaN;var o=n[t]&&n[t][r];if(i){var a=this._dimensionInfos[t];if(a&&a.stackable)for(var s=this.stackedOn;s;){var l=s.get(t,e);(o>=0&&l>0||o<=0&&l<0)&&(o+=l),s=s.stackedOn}}return o},y.getValues=function(t,e,i){var n=[];d.isArray(t)||(i=e,e=t,t=this.dimensions);for(var r=0,o=t.length;rl&&(l=o));return this._extent[t+!!e]=[s,l]}return[1/0,-(1/0)]},y.getSum=function(t,e){var i=this._storage[t],n=0;if(i)for(var r=0,o=this.count();rt))return o;r=o-1}}return-1},y.indexOfNearest=function(t,e,i,n){var r=this._storage,o=r[t];null==n&&(n=1/0);var a=-1;if(o)for(var s=Number.MAX_VALUE,l=0,h=this.count();l0)&&(s=c,a=l)}return a},y.getRawIndex=function(t){var e=this.indices[t];return null==e?-1:e},y.getRawDataItem=function(t){return this._rawData[this.getRawIndex(t)]},y.getName=function(t){return this._nameList[this.indices[t]]||""},y.getId=function(t){return this._idList[this.indices[t]]||this.getRawIndex(t)+""},y.each=function(t,e,i,r){"function"==typeof t&&(r=i,i=e,e=t,t=[]),t=d.map(n(t),this.getDimension,this);var o=[],a=t.length,s=this.indices;r=r||this;for(var l=0;lp-g&&(d=p-g,u.length=d);for(var m=0;m',g=this.name;return"\0-"===g&&(g=""),e?c+f(this.name)+" : "+l:(g&&f(g)+"
")+c+(h?f(h)+" : "+l:l)},isAnimationEnabled:function(){if(h.node)return!1;var t=this.getShallow("animation");return t&&this.getData().count()>this.getShallow("animationThreshold")&&(t=!1),t},restoreData:function(){c(this,"data",d(this,"dataBeforeProcessed").cloneShallow())},getColorFromPalette:function(t,e){var i=this.ecModel,n=l.getColorFromPalette.call(this,t,e);return n||(n=i.getColorFromPalette(t,e)),n},getAxisTooltipDataIndex:null,getTooltipPosition:null});n.mixin(g,a.dataFormatMixin),n.mixin(g,l),t.exports=g},function(t,e,i){function n(t,e){var i=t+":"+e;if(l[i])return l[i];for(var n=(t+"").split("\n"),r=0,o=0,a=n.length;ou&&(h=0,l={}),h++,l[i]=r,r}function r(t,e,i,r){var o=((t||"")+"").split("\n").length,a=n(t,e),s=n("国",e),l=o*s,h=new d(0,0,a,l);switch(h.lineHeight=s,r){case"bottom":case"alphabetic":h.y-=s;break;case"middle":h.y-=s/2}switch(i){case"end":case"right":h.x-=h.width;break;case"center":h.x-=h.width/2}return h}function o(t,e,i,n){var r=e.x,o=e.y,a=e.height,s=e.width,l=i.height,h=a/2-l/2,u="left";switch(t){case"left":r-=n,o+=h,u="right";break;case"right":r+=n+s,o+=h,u="left";break;case"top":r+=s/2,o-=n+l,u="center";break;case"bottom":r+=s/2,o+=a+n,u="center";break;case"inside":r+=s/2,o+=h,u="center";break;case"insideLeft":r+=n,o+=h,u="left";break;case"insideRight":r+=s-n,o+=h,u="right";break;case"insideTop":r+=s/2,o+=n,u="center";break;case"insideBottom":r+=s/2,o+=a-l-n,u="center";break;case"insideTopLeft":r+=n,o+=n,u="left";break;case"insideTopRight":r+=s-n,o+=n,u="right";break;case"insideBottomLeft":r+=n,o+=a-l-n;break;case"insideBottomRight":r+=s-n,o+=a-l-n,u="right"}return{x:r,y:o,textAlign:u,textBaseline:"top"}}function a(t,e,i,r,o){if(!e)return"";o=o||{},r=f(r,"...");for(var a=f(o.maxIterations,2),l=f(o.minChar,0),h=n("国",i),u=n("a",i),c=f(o.placeholder,""),d=e=Math.max(0,e-1),p=0;p=u;p++)d-=u;var g=n(r);g>d&&(r="",g=0),d=e-g;for(var m=(t+"").split("\n"),p=0,v=m.length;p=a){y+=r;break}var b=0===_?s(y,d,u,h):x>0?Math.floor(y.length*d/x):0;y=y.substr(0,b),x=n(y,i)}""===y&&(y=c),m[p]=y}}return m.join("\n")}function s(t,e,i,n){for(var r=0,o=0,a=t.length;o-w&&tw||t<-w}function o(t,e,i,n,r){var o=1-r;return o*o*(o*t+3*r*e)+r*r*(r*n+3*o*i)}function a(t,e,i,n,r){var o=1-r;return 3*(((e-t)*o+2*(i-e)*r)*o+(n-i)*r*r)}function s(t,e,i,r,o,a){var s=r+3*(e-i)-t,l=3*(i-2*e+t),h=3*(e-t),u=t-o,c=l*l-3*s*h,d=l*h-9*s*u,f=h*h-3*l*u,p=0;if(n(c)&&n(d))if(n(l))a[0]=0;else{var g=-h/l;g>=0&&g<=1&&(a[p++]=g)}else{var m=d*d-4*c*f;if(n(m)){var v=d/c,g=-l/s+v,y=-v/2;g>=0&&g<=1&&(a[p++]=g),y>=0&&y<=1&&(a[p++]=y)}else if(m>0){var x=b(m),w=c*l+1.5*s*(-d+x),M=c*l+1.5*s*(-d-x);w=w<0?-_(-w,T):_(w,T),M=M<0?-_(-M,T):_(M,T);var g=(-l-(w+M))/(3*s);g>=0&&g<=1&&(a[p++]=g)}else{var A=(2*c*l-3*s*d)/(2*b(c*c*c)),I=Math.acos(A)/3,C=b(c),k=Math.cos(I),g=(-l-2*C*k)/(3*s),y=(-l+C*(k+S*Math.sin(I)))/(3*s),L=(-l+C*(k-S*Math.sin(I)))/(3*s);g>=0&&g<=1&&(a[p++]=g),y>=0&&y<=1&&(a[p++]=y),L>=0&&L<=1&&(a[p++]=L)}}return p}function l(t,e,i,o,a){var s=6*i-12*e+6*t,l=9*e+3*o-3*t-9*i,h=3*e-3*t,u=0;if(n(l)){if(r(s)){var c=-h/s;c>=0&&c<=1&&(a[u++]=c)}}else{var d=s*s-4*l*h;if(n(d))a[0]=-s/(2*l);else if(d>0){var f=b(d),c=(-s+f)/(2*l),p=(-s-f)/(2*l);c>=0&&c<=1&&(a[u++]=c),p>=0&&p<=1&&(a[u++]=p)}}return u}function h(t,e,i,n,r,o){var a=(e-t)*r+t,s=(i-e)*r+e,l=(n-i)*r+i,h=(s-a)*r+a,u=(l-s)*r+s,c=(u-h)*r+h;o[0]=t,o[1]=a,o[2]=h,o[3]=c,o[4]=c,o[5]=u,o[6]=l,o[7]=n}function u(t,e,i,n,r,a,s,l,h,u,c){var d,f,p,g,m,v=.005,y=1/0;A[0]=h,A[1]=u;for(var _=0;_<1;_+=.05)I[0]=o(t,i,r,s,_),I[1]=o(e,n,a,l,_),g=x(A,I),g=0&&g=0&&c<=1&&(a[u++]=c)}}else{var d=l*l-4*s*h;if(n(d)){var c=-l/(2*s);c>=0&&c<=1&&(a[u++]=c)}else if(d>0){var f=b(d),c=(-l+f)/(2*s),p=(-l-f)/(2*s);c>=0&&c<=1&&(a[u++]=c),p>=0&&p<=1&&(a[u++]=p)}}return u}function p(t,e,i){var n=t+i-2*e;return 0===n?.5:(t-e)/n}function g(t,e,i,n,r){var o=(e-t)*n+t,a=(i-e)*n+e,s=(a-o)*n+o;r[0]=t,r[1]=o,r[2]=s,r[3]=s,r[4]=a,r[5]=i}function m(t,e,i,n,r,o,a,s,l){var h,u=.005,d=1/0;A[0]=a,A[1]=s;for(var f=0;f<1;f+=.05){I[0]=c(t,i,r,f),I[1]=c(e,n,o,f);var p=x(A,I);p=0&&p255?255:t}function n(t){return t=Math.round(t),t<0?0:t>360?360:t}function r(t){return t<0?0:t>1?1:t}function o(t){return i(t.length&&"%"===t.charAt(t.length-1)?parseFloat(t)/100*255:parseInt(t,10))}function a(t){return r(t.length&&"%"===t.charAt(t.length-1)?parseFloat(t)/100:parseFloat(t))}function s(t,e,i){return i<0?i+=1:i>1&&(i-=1),6*i<1?t+(e-t)*i*6:2*i<1?e:3*i<2?t+(e-t)*(2/3-i)*6:t}function l(t,e,i){return t+(e-t)*i}function h(t){if(t){t+="";var e=t.replace(/ /g,"").toLowerCase();if(e in x)return x[e].slice();if("#"!==e.charAt(0)){var i=e.indexOf("("),n=e.indexOf(")");if(i!==-1&&n+1===e.length){var r=e.substr(0,i),s=e.substr(i+1,n-(i+1)).split(","),l=1;switch(r){case"rgba":if(4!==s.length)return;l=a(s.pop());case"rgb":if(3!==s.length)return;return[o(s[0]),o(s[1]),o(s[2]),l];case"hsla":if(4!==s.length)return;return s[3]=a(s[3]),u(s);case"hsl":if(3!==s.length)return;return u(s);default:return}}}else{if(4===e.length){var h=parseInt(e.substr(1),16);if(!(h>=0&&h<=4095))return;return[(3840&h)>>4|(3840&h)>>8,240&h|(240&h)>>4,15&h|(15&h)<<4,1]}if(7===e.length){var h=parseInt(e.substr(1),16);if(!(h>=0&&h<=16777215))return;return[(16711680&h)>>16,(65280&h)>>8,255&h,1]}}}}function u(t){var e=(parseFloat(t[0])%360+360)%360/360,n=a(t[1]),r=a(t[2]),o=r<=.5?r*(n+1):r+n-r*n,l=2*r-o,h=[i(255*s(l,o,e+1/3)),i(255*s(l,o,e)),i(255*s(l,o,e-1/3))];return 4===t.length&&(h[3]=t[3]),h}function c(t){if(t){var e,i,n=t[0]/255,r=t[1]/255,o=t[2]/255,a=Math.min(n,r,o),s=Math.max(n,r,o),l=s-a,h=(s+a)/2;if(0===l)e=0,i=0;else{i=h<.5?l/(s+a):l/(2-s-a);var u=((s-n)/6+l/2)/l,c=((s-r)/6+l/2)/l,d=((s-o)/6+l/2)/l;n===s?e=d-c:r===s?e=1/3+u-d:o===s&&(e=2/3+c-u),e<0&&(e+=1),e>1&&(e-=1)}var f=[360*e,i,h];return null!=t[3]&&f.push(t[3]),f}}function d(t,e){var i=h(t);if(i){for(var n=0;n<3;n++)e<0?i[n]=i[n]*(1-e)|0:i[n]=(255-i[n])*e+i[n]|0;return y(i,4===i.length?"rgba":"rgb")}}function f(t,e){var i=h(t);if(i)return((1<<24)+(i[0]<<16)+(i[1]<<8)+ +i[2]).toString(16).slice(1)}function p(t,e,n){if(e&&e.length&&t>=0&&t<=1){n=n||[0,0,0,0];var r=t*(e.length-1),o=Math.floor(r),a=Math.ceil(r),s=e[o],h=e[a],u=r-o;return n[0]=i(l(s[0],h[0],u)),n[1]=i(l(s[1],h[1],u)),n[2]=i(l(s[2],h[2],u)),n[3]=i(l(s[3],h[3],u)),n}}function g(t,e,n){if(e&&e.length&&t>=0&&t<=1){var o=t*(e.length-1),a=Math.floor(o),s=Math.ceil(o),u=h(e[a]),c=h(e[s]),d=o-a,f=y([i(l(u[0],c[0],d)),i(l(u[1],c[1],d)),i(l(u[2],c[2],d)),r(l(u[3],c[3],d))],"rgba");return n?{color:f,leftIndex:a,rightIndex:s,value:o}:f}}function m(t,e,i,r){if(t=h(t))return t=c(t),null!=e&&(t[0]=n(e)),null!=i&&(t[1]=a(i)),null!=r&&(t[2]=a(r)),y(u(t),"rgba")}function v(t,e){if(t=h(t),t&&null!=e)return t[3]=r(e),y(t,"rgba")}function y(t,e){var i=t[0]+","+t[1]+","+t[2];return"rgba"!==e&&"hsva"!==e&&"hsla"!==e||(i+=","+t[3]),e+"("+i+")"}var x={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};t.exports={parse:h,lift:d,toHex:f,fastMapToColor:p,mapToColor:g,modifyHSL:m,modifyAlpha:v,stringify:y}},function(t,e){var i="undefined"==typeof Float32Array?Array:Float32Array,n={create:function(){var t=new i(6);return n.identity(t),t},identity:function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t},copy:function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t},mul:function(t,e,i){var n=e[0]*i[0]+e[2]*i[1],r=e[1]*i[0]+e[3]*i[1],o=e[0]*i[2]+e[2]*i[3],a=e[1]*i[2]+e[3]*i[3],s=e[0]*i[4]+e[2]*i[5]+e[4],l=e[1]*i[4]+e[3]*i[5]+e[5];return t[0]=n,t[1]=r,t[2]=o,t[3]=a,t[4]=s,t[5]=l,t},translate:function(t,e,i){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4]+i[0],t[5]=e[5]+i[1],t},rotate:function(t,e,i){var n=e[0],r=e[2],o=e[4],a=e[1],s=e[3],l=e[5],h=Math.sin(i),u=Math.cos(i);return t[0]=n*u+a*h,t[1]=-n*h+a*u,t[2]=r*u+s*h,t[3]=-r*h+u*s,t[4]=u*o+h*l,t[5]=u*l-h*o,t},scale:function(t,e,i){var n=i[0],r=i[1];return t[0]=e[0]*n,t[1]=e[1]*r,t[2]=e[2]*n,t[3]=e[3]*r,t[4]=e[4]*n,t[5]=e[5]*r,t},invert:function(t,e){var i=e[0],n=e[2],r=e[4],o=e[1],a=e[3],s=e[5],l=i*a-o*n;return l?(l=1/l,t[0]=a*l,t[1]=-o*l,t[2]=-n*l,t[3]=i*l,t[4]=(n*s-a*r)*l,t[5]=(o*r-i*s)*l,t):null}};t.exports=n},function(t,e){var i=Array.prototype.slice,n=function(){this._$handlers={}};n.prototype={constructor:n,one:function(t,e,i){var n=this._$handlers;if(!e||!t)return this;n[t]||(n[t]=[]);for(var r=0;r3&&(e=i.call(e,1));for(var r=this._$handlers[t],o=r.length,a=0;a4&&(e=i.call(e,1,e.length-1));for(var r=e[e.length-1],o=this._$handlers[t],a=o.length,s=0;s0&&u>0&&!c&&(h=0),h<0&&u<0&&!d&&(u=0)),[h,u]},h.niceScaleExtent=function(t,e){var i=t.scale,n=h.getScaleExtent(t,e),r=null!=e.getMin(),o=null!=e.getMax(),a=e.get("splitNumber");"log"===i.type&&(i.base=e.get("logBase")),i.setExtent(n[0],n[1]),i.niceExtent(a,r,o);var s=e.get("minInterval");if(isFinite(s)&&!r&&!o&&"interval"===i.type){var l=i.getInterval(),u=Math.max(Math.abs(l),s)/l;n=i.getExtent();var c=(n[1]+n[0])/2;i.setExtent(u*(n[0]-c)+c,u*(n[1]-c)+c),i.niceExtent(a)}var l=e.get("interval");null!=l&&i.setInterval&&i.setInterval(l)},h.createScaleByModel=function(t,e){if(e=e||t.get("type"))switch(e){case"category":return new n(t.getCategories(),[1/0,-(1/0)]);case"value":return new r;default:return(o.getClass(e)||r).create(t)}},h.ifAxisCrossZero=function(t){var e=t.scale.getExtent(),i=e[0],n=e[1];return!(i>0&&n>0||i<0&&n<0)},h.getAxisLabelInterval=function(t,e,i,n){var r,o=0,a=0,s=1;e.length>40&&(s=Math.floor(e.length/40));for(var h=0;h1?s:(o+1)*s-1},h.getFormattedLabels=function(t,e){var i=t.scale,n=i.getTicksLabels(),r=i.getTicks();return"string"==typeof e?(e=function(t){return function(e){return t.replace("{value}",null!=e?e:"")}}(e),s.map(n,e)):"function"==typeof e?s.map(r,function(n,r){return e("category"===t.type?i.getLabel(n):n,r)},this):n},t.exports=h},function(t,e,i){"use strict";function n(){this._coordinateSystems=[]}var r=i(1),o={};n.prototype={constructor:n,create:function(t,e){var i=[];r.each(o,function(n,r){var o=n.create(t,e);i=i.concat(o||[])}),this._coordinateSystems=i},update:function(t,e){r.each(this._coordinateSystems,function(i){i.update&&i.update(t,e)})},getCoordinateSystems:function(){return this._coordinateSystems.slice()}},n.register=function(t,e){o[t]=e},n.get=function(t){return o[t]},t.exports=n},function(t,e,i){"use strict";var n=i(3),r=i(9),o=n.extendShape({type:"triangle", -shape:{cx:0,cy:0,width:0,height:0},buildPath:function(t,e){var i=e.cx,n=e.cy,r=e.width/2,o=e.height/2;t.moveTo(i,n-o),t.lineTo(i+r,n+o),t.lineTo(i-r,n+o),t.closePath()}}),a=n.extendShape({type:"diamond",shape:{cx:0,cy:0,width:0,height:0},buildPath:function(t,e){var i=e.cx,n=e.cy,r=e.width/2,o=e.height/2;t.moveTo(i,n-o),t.lineTo(i+r,n),t.lineTo(i,n+o),t.lineTo(i-r,n),t.closePath()}}),s=n.extendShape({type:"pin",shape:{x:0,y:0,width:0,height:0},buildPath:function(t,e){var i=e.x,n=e.y,r=e.width/5*3,o=Math.max(r,e.height),a=r/2,s=a*a/(o-a),l=n-o+a+s,h=Math.asin(s/a),u=Math.cos(h)*a,c=Math.sin(h),d=Math.cos(h);t.arc(i,l,a,Math.PI-h,2*Math.PI+h);var f=.6*a,p=.7*a;t.bezierCurveTo(i+u-c*f,l+s+d*f,i,n-p,i,n),t.bezierCurveTo(i,n-p,i-u+c*f,l+s+d*f,i-u,l+s),t.closePath()}}),l=n.extendShape({type:"arrow",shape:{x:0,y:0,width:0,height:0},buildPath:function(t,e){var i=e.height,n=e.width,r=e.x,o=e.y,a=n/3*2;t.moveTo(r,o),t.lineTo(r+a,o+i),t.lineTo(r,o+i/4*3),t.lineTo(r-a,o+i),t.lineTo(r,o),t.closePath()}}),h={line:n.Line,rect:n.Rect,roundRect:n.Rect,square:n.Rect,circle:n.Circle,diamond:a,pin:s,arrow:l,triangle:o},u={line:function(t,e,i,n,r){r.x1=t,r.y1=e+n/2,r.x2=t+i,r.y2=e+n/2},rect:function(t,e,i,n,r){r.x=t,r.y=e,r.width=i,r.height=n},roundRect:function(t,e,i,n,r){r.x=t,r.y=e,r.width=i,r.height=n,r.r=Math.min(i,n)/4},square:function(t,e,i,n,r){var o=Math.min(i,n);r.x=t,r.y=e,r.width=o,r.height=o},circle:function(t,e,i,n,r){r.cx=t+i/2,r.cy=e+n/2,r.r=Math.min(i,n)/2},diamond:function(t,e,i,n,r){r.cx=t+i/2,r.cy=e+n/2,r.width=i,r.height=n},pin:function(t,e,i,n,r){r.x=t+i/2,r.y=e+n/2,r.width=i,r.height=n},arrow:function(t,e,i,n,r){r.x=t+i/2,r.y=e+n/2,r.width=i,r.height=n},triangle:function(t,e,i,n,r){r.cx=t+i/2,r.cy=e+n/2,r.width=i,r.height=n}},c={};for(var d in h)h.hasOwnProperty(d)&&(c[d]=new h[d]);var f=n.extendShape({type:"symbol",shape:{symbolType:"",x:0,y:0,width:0,height:0},beforeBrush:function(){var t=this.style,e=this.shape;"pin"===e.symbolType&&"inside"===t.textPosition&&(t.textPosition=["50%","40%"],t.textAlign="center",t.textVerticalAlign="middle")},buildPath:function(t,e,i){var n=e.symbolType,r=c[n];"none"!==e.symbolType&&(r||(n="rect",r=c[n]),u[n](e.x,e.y,e.width,e.height,r.shape),r.buildPath(t,r.shape,i))}}),p=function(t){if("image"!==this.type){var e=this.style,i=this.shape;i&&"line"===i.symbolType?e.stroke=t:this.__isEmptyBrush?(e.stroke=t,e.fill="#fff"):(e.fill&&(e.fill=t),e.stroke&&(e.stroke=t)),this.dirty(!1)}},g={createSymbol:function(t,e,i,o,a,s){var l=0===t.indexOf("empty");l&&(t=t.substr(5,1).toLowerCase()+t.substr(6));var h;return h=0===t.indexOf("image://")?new n.Image({style:{image:t.slice(8),x:e,y:i,width:o,height:a}}):0===t.indexOf("path://")?n.makePath(t.slice(7),{},new r(e,i,o,a)):new f({shape:{symbolType:t,x:e,y:i,width:o,height:a}}),h.__isEmptyBrush=l,h.setColor=p,h.setColor(s),h}};t.exports=g},function(t,e,i){"use strict";function n(t){return t.getBoundingClientRect?t.getBoundingClientRect():{left:0,top:0}}function r(t,e,i,n){return i=i||{},n||!u.canvasSupported?o(t,e,i):u.browser.firefox&&null!=e.layerX&&e.layerX!==e.offsetX?(i.zrX=e.layerX,i.zrY=e.layerY):null!=e.offsetX?(i.zrX=e.offsetX,i.zrY=e.offsetY):o(t,e,i),i}function o(t,e,i){var r=n(t);i.zrX=e.clientX-r.left,i.zrY=e.clientY-r.top}function a(t,e,i){if(e=e||window.event,null!=e.zrX)return e;var n=e.type,o=n&&n.indexOf("touch")>=0;if(o){var a="touchend"!=n?e.targetTouches[0]:e.changedTouches[0];a&&r(t,a,e,i)}else r(t,e,e,i),e.zrDelta=e.wheelDelta?e.wheelDelta/120:-(e.detail||0)/3;return e}function s(t,e,i){c?t.addEventListener(e,i):t.attachEvent("on"+e,i)}function l(t,e,i){c?t.removeEventListener(e,i):t.detachEvent("on"+e,i)}var h=i(21),u=i(10),c="undefined"!=typeof window&&!!window.addEventListener,d=c?function(t){t.preventDefault(),t.stopPropagation(),t.cancelBubble=!0}:function(t){t.returnValue=!1,t.cancelBubble=!0};t.exports={clientToLocal:r,normalizeEvent:a,addEventListener:s,removeEventListener:l,stop:d,Dispatcher:h}},function(t,e){"use strict";var i={};t.exports={register:function(t,e){i[t]=e},get:function(t){return i[t]}}},function(t,e,i){function n(t,e,i,n){if(!e)return t;var s=r(e[0]),l=o.isArray(s)&&s.length||1;i=i||[],n=n||"extra";for(var h=0;hthis._ux||y(e-this._yi)>this._uy||this._len<5;return this.addData(l.L,t,e),this._ctx&&i&&(this._needsDash()?this._dashedLineTo(t,e):this._ctx.lineTo(t,e)),i&&(this._xi=t,this._yi=e),this},bezierCurveTo:function(t,e,i,n,r,o){return this.addData(l.C,t,e,i,n,r,o),this._ctx&&(this._needsDash()?this._dashedBezierTo(t,e,i,n,r,o):this._ctx.bezierCurveTo(t,e,i,n,r,o)),this._xi=r,this._yi=o,this},quadraticCurveTo:function(t,e,i,n){return this.addData(l.Q,t,e,i,n),this._ctx&&(this._needsDash()?this._dashedQuadraticTo(t,e,i,n):this._ctx.quadraticCurveTo(t,e,i,n)),this._xi=i,this._yi=n,this},arc:function(t,e,i,n,r,o){return this.addData(l.A,t,e,i,i,n,r-n,0,o?0:1),this._ctx&&this._ctx.arc(t,e,i,n,r,o),this._xi=g(r)*i+t,this._yi=m(r)*i+t,this},arcTo:function(t,e,i,n,r){return this._ctx&&this._ctx.arcTo(t,e,i,n,r),this},rect:function(t,e,i,n){return this._ctx&&this._ctx.rect(t,e,i,n),this.addData(l.R,t,e,i,n),this},closePath:function(){this.addData(l.Z);var t=this._ctx,e=this._x0,i=this._y0;return t&&(this._needsDash()&&this._dashedLineTo(e,i),t.closePath()),this._xi=e,this._yi=i,this},fill:function(t){t&&t.fill(),this.toStatic()},stroke:function(t){t&&t.stroke(),this.toStatic()},setLineDash:function(t){if(t instanceof Array){this._lineDash=t,this._dashIdx=0;for(var e=0,i=0;ie.length&&(this._expandData(),e=this.data);for(var i=0;i0&&g<=t||u<0&&g>=t||0==u&&(c>0&&m<=e||c<0&&m>=e);)n=this._dashIdx,i=a[n],g+=u*i,m+=c*i,this._dashIdx=(n+1)%y,u>0&&gl||c>0&&mh||s[n%2?"moveTo":"lineTo"](u>=0?f(g,t):p(g,t),c>=0?f(m,e):p(m,e));u=g-t,c=m-e,this._dashOffset=-v(u*u+c*c)},_dashedBezierTo:function(t,e,i,r,o,a){var s,l,h,u,c,d=this._dashSum,f=this._dashOffset,p=this._lineDash,g=this._ctx,m=this._xi,y=this._yi,x=n.cubicAt,_=0,b=this._dashIdx,w=p.length,M=0;for(f<0&&(f=d+f),f%=d,s=0;s<1;s+=.1)l=x(m,t,i,o,s+.1)-x(m,t,i,o,s),h=x(y,e,r,a,s+.1)-x(y,e,r,a,s),_+=v(l*l+h*h);for(;bf));b++);for(s=(M-f)/_;s<=1;)u=x(m,t,i,o,s),c=x(y,e,r,a,s),b%2?g.moveTo(u,c):g.lineTo(u,c),s+=p[b]/_,b=(b+1)%w;b%2!==0&&g.lineTo(o,a),l=o-u,h=a-c,this._dashOffset=-v(l*l+h*h)},_dashedQuadraticTo:function(t,e,i,n){var r=i,o=n;i=(i+2*t)/3,n=(n+2*e)/3,t=(this._xi+2*t)/3,e=(this._yi+2*e)/3,this._dashedBezierTo(t,e,i,n,r,o)},toStatic:function(){var t=this.data;t instanceof Array&&(t.length=this._len,x&&(this.data=new Float32Array(t)))},getBoundingRect:function(){h[0]=h[1]=c[0]=c[1]=Number.MAX_VALUE,u[0]=u[1]=d[0]=d[1]=-Number.MAX_VALUE;for(var t=this.data,e=0,i=0,n=0,s=0,f=0;fh||y(a-r)>u||d===c-1)&&(t.lineTo(o,a),n=o,r=a);break;case l.C:t.bezierCurveTo(s[d++],s[d++],s[d++],s[d++],s[d++],s[d++]),n=s[d-2],r=s[d-1];break;case l.Q:t.quadraticCurveTo(s[d++],s[d++],s[d++],s[d++]),n=s[d-2],r=s[d-1];break;case l.A:var p=s[d++],v=s[d++],x=s[d++],_=s[d++],b=s[d++],w=s[d++],M=s[d++],S=s[d++],T=x>_?x:_,A=x>_?1:x/_,I=x>_?_/x:1,C=Math.abs(x-_)>.001,k=b+w;C?(t.translate(p,v),t.rotate(M),t.scale(A,I),t.arc(0,0,T,b,k,1-S),t.scale(1/A,1/I),t.rotate(-M),t.translate(-p,-v)):t.arc(p,v,T,b,k,1-S),1==d&&(e=g(b)*x+p,i=m(b)*_+v),n=g(k)*x+p,r=m(k)*_+v;break;case l.R:e=n=s[d],i=r=s[d+1],t.rect(s[d++],s[d++],s[d++],s[d++]);break;case l.Z:t.closePath(),n=e,r=i}}}},_.CMD=l,t.exports=_},function(t,e,i){var n=i(1);t.exports=function(t){for(var e=0;e=0)){var a=this.getShallow(o);null!=a&&(i[t[r][0]]=a)}}return i}}},function(t,e,i){"use strict";var n=i(3),r=i(1),o=i(2);i(53),i(109),o.extendComponentView({type:"grid",render:function(t,e){this.group.removeAll(),t.get("show")&&this.group.add(new n.Rect({shape:t.coordinateSystem.getRect(),style:r.defaults({fill:t.get("backgroundColor")},t.getItemStyle()),silent:!0,z2:-1}))}}),o.registerPreprocessor(function(t){t.xAxis&&t.yAxis&&!t.grid&&(t.grid={})})},function(t,e,i){function n(){this._extent=[1/0,-(1/0)],this._interval=0,this.init&&this.init.apply(this,arguments)}var r=i(15),o=n.prototype;o.parse=function(t){return t},o.contain=function(t){var e=this._extent;return t>=e[0]&&t<=e[1]},o.normalize=function(t){var e=this._extent;return e[1]===e[0]?.5:(t-e[0])/(e[1]-e[0])},o.scale=function(t){var e=this._extent;return t*(e[1]-e[0])+e[0]},o.unionExtent=function(t){var e=this._extent;t[0]e[1]&&(e[1]=t[1])},o.unionExtentFromData=function(t,e){this.unionExtent(t.getDataExtent(e,!0))},o.getExtent=function(){return this._extent.slice()},o.setExtent=function(t,e){var i=this._extent;isNaN(t)||(i[0]=t),isNaN(e)||(i[1]=e)},o.getTicksLabels=function(){for(var t=[],e=this.getTicks(),i=0;i=0&&(i.splice(n,0,t),this._doAdd(t))}return this},_doAdd:function(t){t.parent&&t.parent.remove(t),t.parent=this;var e=this.__storage,i=this.__zr;e&&e!==t.__storage&&(e.addToMap(t),t instanceof a&&t.addChildrenToStorage(e)),i&&i.refresh()},remove:function(t){var e=this.__zr,i=this.__storage,r=this._children,o=n.indexOf(r,t);return o<0?this:(r.splice(o,1),t.parent=null,i&&(i.delFromMap(t.id),t instanceof a&&t.delChildrenFromStorage(i)),e&&e.refresh(),this)},removeAll:function(){var t,e,i=this._children,n=this.__storage;for(e=0;e=0&&r(t)?function(t,e,i,n){return d.isDataItemOption(t)&&(x.hasItemOption=!0),n===y?i:g(p(t),v[n])}:function(t,e,i,n){var r=p(t),o=g(r&&r[n],v[n]);d.isDataItemOption(t)&&(x.hasItemOption=!0);var a=s&&s.categoryAxesModels;return a&&a[e]&&"string"==typeof o&&(b[e]=b[e]||a[e].getCategories(),o=c.indexOf(b[e],o),o<0&&!isNaN(o)&&(o=+o)),o};return x.hasItemOption=!1,x.initData(t,_,w),x}function a(t){return"category"!==t&&"time"!==t}function s(t){return"category"===t?"ordinal":"time"===t?"time":"float"}function l(t,e){var i,n=[],r=t&&t.dimensions[t.categoryIndex];if(r&&(i=t.categoryAxesModels[r.name]),i){var o=i.getCategories();if(o){var a=e.length;if(c.isArray(e[0])&&e[0].length>1){n=[];for(var s=0;se[1]&&(e[1]=t[1]),u.prototype.setExtent.call(this,e[0],e[1])},getInterval:function(){return this._interval||this.niceTicks(),this._interval},setInterval:function(t){this._interval=t,this._niceExtent=this._extent.slice()},getTicks:function(){this._interval||this.niceTicks();var t=this._interval,e=this._extent,i=[],n=1e4;if(t){var r=this._niceExtent,o=l(t)+2;e[0]n)return[];e[1]>(i.length?i[i.length-1]:r[1])&&i.push(e[1])}return i},getTicksLabels:function(){for(var t=[],e=this.getTicks(),i=0;i0?100:20}},getFirstTargetAxisModel:function(){var t;return d(function(e){if(null==t){var i=this.get(e.axisIndex);i.length&&(t=this.dependentModels[e.axis][i[0]])}},this),t},eachTargetAxis:function(t,e){var i=this.ecModel;d(function(n){c(this.get(n.axisIndex),function(r){t.call(e,n,r,this,i)},this)},this)},getAxisProxy:function(t,e){return this._axisProxies[t+"_"+e]},setRawRange:function(t){c(["start","end","startValue","endValue"],function(e){this.option[e]=t[e]},this)},getPercentRange:function(){var t=this.findRepresentativeAxisProxy();if(t)return t.getDataPercentWindow()},getValueRange:function(t,e){if(null!=t||null!=e)return this.getAxisProxy(t,e).getDataValueWindow();var i=this.findRepresentativeAxisProxy();return i?i.getDataValueWindow():void 0},findRepresentativeAxisProxy:function(){var t=this._axisProxies;for(var e in t)if(t.hasOwnProperty(e)&&t[e].hostedBy(this))return t[e];for(var e in t)if(t.hasOwnProperty(e)&&!t[e].hostedBy(this))return t[e]}});t.exports=f},function(t,e,i){var n=i(59);t.exports=n.extend({type:"dataZoom",render:function(t,e,i,n){this.dataZoomModel=t,this.ecModel=e,this.api=i},getTargetCoordInfo:function(){function t(t,e,i,n){for(var r,o=0;o=i&&t<=n},containData:function(t){return this.contain(this.dataToCoord(t))},getExtent:function(){var t=this._extent.slice();return t},getPixelPrecision:function(t){return r.getPixelPrecision(t||this.scale.getExtent(),this._extent)},setExtent:function(t,e){var i=this._extent;i[0]=t,i[1]=e},dataToCoord:function(t,e){var i=this._extent,r=this.scale;return t=r.normalize(t),this.onBand&&"ordinal"===r.type&&(i=i.slice(),n(i,r.count())),o(t,s,i,e)},coordToData:function(t,e){var i=this._extent,r=this.scale;this.onBand&&"ordinal"===r.type&&(i=i.slice(),n(i,r.count()));var a=o(t,i,s,e);return this.scale.scale(a)},getTicksCoords:function(t){if(this.onBand&&!t){for(var e=this.getBands(),i=[],n=0;n=0&&i.push(t)}),i}t.topologicalTravel=function(t,e,r,o){function a(t){h[t].entryCount--,0===h[t].entryCount&&u.push(t)}function s(t){c[t]=!0,a(t)}if(t.length){var l=i(e),h=l.graph,u=l.noEntryList,c={};for(n.each(t,function(t){c[t]=!0});u.length;){var d=u.pop(),f=h[d],p=!!c[d];p&&(r.call(o,d,f.originalDeps.slice()),delete c[d]),n.each(f.successor,p?s:a)}n.each(c,function(){throw new Error("Circle dependency may exists")})}}},t.exports=s},function(t,e){t.exports=function(t,e,i,n,r){n.eachRawSeriesByType(t,function(t){var r=t.getData(),o=t.get("symbol")||e,a=t.get("symbolSize");r.setVisual({legendSymbol:i||o,symbol:o,symbolSize:a}),n.isSeriesFiltered(t)||("function"==typeof a&&r.each(function(e){var i=t.getRawValue(e),n=t.getDataParams(e);r.setItemVisual(e,"symbolSize",a(i,n))}),r.each(function(t){var e=r.getItemModel(t),i=e.getShallow("symbol",!0),n=e.getShallow("symbolSize",!0);null!=i&&r.setItemVisual(t,"symbol",i),null!=n&&r.setItemVisual(t,"symbolSize",n)}))})}},function(t,e){function i(t){for(var e=0;t>=u;)e|=1&t,t>>=1;return t+e}function n(t,e,i,n){var o=e+1;if(o===i)return 1;if(n(t[o++],t[e])<0){for(;o=0;)o++;return o-e}function r(t,e,i){for(i--;e>>1,r(a,t[o])<0?l=o:s=o+1;var h=n-s;switch(h){case 3:t[s+3]=t[s+2];case 2:t[s+2]=t[s+1];case 1:t[s+1]=t[s];break;default:for(;h>0;)t[s+h]=t[s+h-1],h--}t[s]=a}}function a(t,e,i,n,r,o){var a=0,s=0,l=1;if(o(t,e[i+r])>0){for(s=n-r;l0;)a=l,l=(l<<1)+1,l<=0&&(l=s);l>s&&(l=s),a+=r,l+=r}else{for(s=r+1;ls&&(l=s);var h=a;a=r-l,l=r-h}for(a++;a>>1);o(t,e[i+u])>0?a=u+1:l=u}return l}function s(t,e,i,n,r,o){var a=0,s=0,l=1;if(o(t,e[i+r])<0){for(s=r+1;ls&&(l=s);var h=a;a=r-l,l=r-h}else{for(s=n-r;l=0;)a=l,l=(l<<1)+1,l<=0&&(l=s);l>s&&(l=s),a+=r,l+=r}for(a++;a>>1);o(t,e[i+u])<0?l=u:a=u+1}return l}function l(t,e){function i(t,e){u[y]=t,f[y]=e,y+=1}function n(){for(;y>1;){var t=y-2;if(t>=1&&f[t-1]<=f[t]+f[t+1]||t>=2&&f[t-2]<=f[t]+f[t-1])f[t-1]f[t+1])break;o(t)}}function r(){for(;y>1;){var t=y-2;t>0&&f[t-1]=c||g>=c);if(m)break;v<0&&(v=0),v+=2}if(p=v,p<1&&(p=1),1===n){for(l=0;l=0;l--)t[g+l]=t[f+l];return void(t[d]=x[u])}for(var m=p;;){var v=0,y=0,_=!1;do if(e(x[u],t[h])<0){if(t[d--]=t[h--],v++,y=0,0===--n){_=!0;break}}else if(t[d--]=x[u--],y++,v=0,1===--o){_=!0;break}while((v|y)=0;l--)t[g+l]=t[f+l];if(0===n){_=!0;break}}if(t[d--]=x[u--],1===--o){_=!0;break}if(y=o-a(t[h],x,0,o,o-1,e),0!==y){for(d-=y,u-=y,o-=y,g=d+1,f=u+1,l=0;l=c||y>=c);if(_)break;m<0&&(m=0),m+=2}if(p=m,p<1&&(p=1),1===o){for(d-=n,h-=n,g=d+1,f=h+1,l=n-1;l>=0;l--)t[g+l]=t[f+l];t[d]=x[u]}else{if(0===o)throw new Error;for(f=d-(o-1),l=0;l>>1);var x=[];v=g<120?5:g<1542?10:g<119151?19:40,u=[],f=[],this.mergeRuns=n,this.forceMergeRuns=r,this.pushRun=i}function h(t,e,r,a){r||(r=0),a||(a=t.length);var s=a-r;if(!(s<2)){var h=0;if(sd&&(f=d),o(t,r,r+f,r+h,e),h=f}c.pushRun(r,h),c.mergeRuns(),s-=h,r+=h}while(0!==s);c.forceMergeRuns()}}var u=32,c=7,d=256;t.exports=h},function(t,e){var i={},n="\0__throttleOriginMethod",r="\0__throttleRate",o="\0__throttleType";i.throttle=function(t,e,i){function n(){h=(new Date).getTime(),u=null,t.apply(a,s||[])}var r,o,a,s,l=0,h=0,u=null;e=e||0;var c=function(){r=(new Date).getTime(),a=this,s=arguments,o=r-(i?l:h)-e,clearTimeout(u),i?u=setTimeout(n,e):o>=0?n():u=setTimeout(n,-o),l=r};return c.clear=function(){u&&(clearTimeout(u),u=null)},c},i.createOrUpdate=function(t,e,a,s){var l=t[e];if(l){var h=l[n]||l,u=l[o],c=l[r];if(c!==a||u!==s){if(null==a||!s)return t[e]=h;l=t[e]=i.throttle(h,a,"debounce"===s),l[n]=h,l[o]=s,l[r]=a}return l}},i.clear=function(t,e){var i=t[e];i&&i[n]&&(t[e]=i[n])},t.exports=i},function(t,e,i){var n=i(33);t.exports=function(){if(0!==n.debugMode)if(1==n.debugMode)for(var t in arguments)throw new Error(arguments[t]);else if(n.debugMode>1)for(var t in arguments)console.log(arguments[t])}},function(t,e,i){function n(t){r.call(this,t)}var r=i(36),o=i(9),a=i(1),s=i(151),l=new s(50);n.prototype={constructor:n,type:"image",brush:function(t,e){var i,n=this.style,r=n.image;if(n.bind(t,this,e),i="string"==typeof r?this._image:r,!i&&r){var o=l.get(r);if(!o)return i=new Image,i.onload=function(){i.onload=null;for(var t=0;t0?"top":"bottom",n="center"):f(o-v)?(r=i>0?"bottom":"top",n="center"):(r="middle",n=o>0&&o0?"right":"left":i>0?"left":"right"),{rotation:o,textAlign:n,verticalAlign:r}}function o(t,e,i,n){var r,o,a=d(i-t.rotation),s=n[0]>n[1],l="start"===e&&!s||"start"!==e&&s;return f(a-v/2)?(o=l?"bottom":"top",r="center"):f(a-1.5*v)?(o=l?"top":"bottom",r="center"):(o="middle",r=a<1.5*v&&a>v/2?l?"left":"right":l?"right":"left"),{rotation:a,textAlign:r,verticalAlign:o}}function a(t){var e=t.get("tooltip");return t.get("silent")||!(t.get("triggerEvent")||e&&e.show)}var s=i(1),l=i(8),h=i(3),u=i(11),c=i(4),d=c.remRadian,f=c.isRadianAroundZero,p=i(5),g=p.applyTransform,m=s.retrieve,v=Math.PI,y=function(t,e){this.opt=e,this.axisModel=t,s.defaults(e,{labelOffset:0,nameDirection:1,tickDirection:1,labelDirection:1,silent:!0}),this.group=new h.Group;var i=new h.Group({position:e.position.slice(),rotation:e.rotation});i.updateTransform(),this._transform=i.transform,this._dumbGroup=i};y.prototype={constructor:y,hasBuilder:function(t){return!!x[t]},add:function(t){x[t].call(this)},getGroup:function(){return this.group}};var x={axisLine:function(){var t=this.opt,e=this.axisModel;if(e.get("axisLine.show")){var i=this.axisModel.axis.getExtent(),n=this._transform,r=[i[0],0],o=[i[1],0];n&&(g(r,r,n),g(o,o,n)),this.group.add(new h.Line(h.subPixelOptimizeLine({anid:"line",shape:{x1:r[0],y1:r[1],x2:o[0],y2:o[1]},style:s.extend({lineCap:"round"},e.getModel("axisLine.lineStyle").getLineStyle()),strokeContainThreshold:t.strokeContainThreshold||5,silent:!0,z2:1})))}},axisTick:function(){var t=this.axisModel,e=t.axis;if(t.get("axisTick.show")&&!e.isBlank())for(var i=t.getModel("axisTick"),n=this.opt,r=i.getModel("lineStyle"),o=i.get("length"),a=b(i,n.labelInterval),l=e.getTicksCoords(i.get("alignWithLabel")),u=e.scale.getTicks(),c=[],d=[],f=this._transform,p=0;pg[1]?-1:1,x=["start"===c?g[0]-y*p:"end"===c?g[1]+y*p:(g[0]+g[1])/2,"middle"===c?t.labelOffset+d*p:0],_=e.get("nameRotate");null!=_&&(_=_*v/180);var b;"middle"===c?u=r(t,null!=_?_:t.rotation,d):(u=o(t,c,_||0,g),b=t.axisNameAvailableWidth,null!=b&&(b=Math.abs(b/Math.sin(u.rotation)),!isFinite(b)&&(b=null)));var w=f.getFont(),M=e.get("nameTruncate",!0)||{},S=M.ellipsis,T=m(M.maxWidth,b),A=null!=S&&null!=T?l.truncateText(i,T,w,S,{minChar:2,placeholder:M.placeholder}):i,I=e.get("tooltip",!0),C=e.mainType,k={componentType:C,name:i,$vars:["name"]};k[C+"Index"]=e.componentIndex;var L=new h.Text({anid:"name",__fullText:i,__truncatedText:A,style:{text:A,textFont:w,fill:f.getTextColor()||e.get("axisLine.lineStyle.color"),textAlign:u.textAlign,textVerticalAlign:u.verticalAlign},position:x,rotation:u.rotation,silent:a(e),z2:1,tooltip:I&&I.show?s.extend({content:i,formatter:function(){return i},formatterParams:k},I):null});e.get("triggerEvent")&&(L.eventData=n(e),L.eventData.targetType="axisName",L.eventData.name=i),this._dumbGroup.add(L),L.updateTransform(),this.group.add(L),L.decomposeTransform()}}},_=y.ifIgnoreOnTick=function(t,e,i){var n,r=t.scale;return"ordinal"===r.type&&("function"==typeof i?(n=r.getTicks()[e],!i(n,r.getLabel(n))):e%(i+1))},b=y.getInterval=function(t,e){var i=t.get("interval");return null!=i&&"auto"!=i||(i=e),i};t.exports=y},function(t,e,i){function n(t){return r.isObject(t)&&null!=t.value?t.value:t}var r=i(1),o=i(22);t.exports={getFormattedLabels:function(){return o.getFormattedLabels(this.axis,this.get("axisLabel.formatter"))},getCategories:function(){return"category"===this.get("type")&&r.map(this.get("data"),n)},getMin:function(t){var e=this.option,i=t||null==e.rangeStart?e.min:e.rangeStart;return null==i||"dataMin"===i||r.eqNaN(i)||(i=this.axis.scale.parse(i)),i},getMax:function(t){var e=this.option,i=t||null==e.rangeEnd?e.max:e.rangeEnd;return null==i||"dataMax"===i||r.eqNaN(i)||(i=this.axis.scale.parse(i)),i},getNeedCrossZero:function(){var t=this.option;return null==t.rangeStart&&null==t.rangeEnd&&!t.scale},getCoordSysModel:r.noop,setRange:function(t,e){this.option.rangeStart=t,this.option.rangeEnd=e},resetRange:function(){this.option.rangeStart=this.option.rangeEnd=null}}},function(t,e,i){function n(t,e,i){return t.getCoordSysModel()===e}function r(t){var e,i=t.model,n=i.getFormattedLabels(),r=i.getModel("axisLabel.textStyle"),o=1,a=n.length;a>40&&(o=Math.ceil(a/40));for(var s=0;s.5?e:t}function s(t,e,i,n,r){var a=t.length;if(1==r)for(var s=0;sr;if(o)t.length=r;else for(var a=n;a=0&&!(A[i]<=e);i--);i=Math.min(i,x-2)}else{for(i=F;ie);i++);i=Math.min(i-1,x-2)}F=i,G=e;var n=A[i+1]-A[i];if(0!==n)if(E=(e-A[i])/n,v)if(R=I[i],N=I[0===i?i:i-1],B=I[i>x-2?x-1:i+1],V=I[i>x-3?x-1:i+2],w)u(N,R,B,V,E,E*E,E*E*E,d(t,r),T);else{var l;if(M)l=u(N,R,B,V,E,E*E,E*E*E,H,1),l=f(H);else{if(S)return a(R,B,E);l=c(N,R,B,V,E,E*E,E*E*E)}p(t,r,l)}else if(w)s(I[i],I[i+1],E,d(t,r),T);else{var l;if(M)s(I[i],I[i+1],E,H,1),l=f(H);else{if(S)return a(I[i],I[i+1],E);l=o(I[i],I[i+1],E)}p(t,r,l)}},Z=new g({target:t._target,life:_,loop:t._loop,delay:t._delay,onframe:W,ondestroy:i});return e&&"spline"!==e&&(Z.easing=e),Z}}}var g=i(145),m=i(19),v=i(1),y=v.isArrayLike,x=Array.prototype.slice,_=function(t,e,i,o){this._tracks={},this._target=t,this._loop=e||!1,this._getter=i||n,this._setter=o||r,this._clipCount=0,this._delay=0,this._doneList=[],this._onframeList=[],this._clipList=[]};_.prototype={when:function(t,e){var i=this._tracks;for(var n in e)if(e.hasOwnProperty(n)){if(!i[n]){i[n]=[];var r=this._getter(this._target,n);if(null==r)continue;0!==t&&i[n].push({time:0,value:d(r)})}i[n].push({time:t,value:e[n]})}return this},during:function(t){return this._onframeList.push(t),this},_doneCallback:function(){this._tracks={},this._clipList.length=0;for(var t=this._doneList,e=t.length,i=0;i0},extendFrom:function(t,e){if(t){var i=this;for(var n in t)!t.hasOwnProperty(n)||!e&&i.hasOwnProperty(n)||(i[n]=t[n])}},set:function(t,e){"string"==typeof t?this[t]=e:this.extendFrom(t,!0)},clone:function(){var t=new this.constructor;return t.extendFrom(this,!0),t},getGradient:function(t,e,r){for(var o="radial"===e.type?n:i,a=o(t,e,r),s=e.colorStops,l=0;l=2){if(a&&"spline"!==a){var s=r(o,a,i,e.smoothConstraint);t.moveTo(o[0][0],o[0][1]);for(var l=o.length,h=0;h<(i?l:l-1);h++){var u=s[2*h],c=s[2*h+1],d=o[(h+1)%l];t.bezierCurveTo(u[0],u[1],c[0],c[1],d[0],d[1])}}else{"spline"===a&&(o=n(o,i)),t.moveTo(o[0][0],o[0][1]);for(var h=1,f=o.length;h=0},o.createNameEach=function(t,e){t=t.slice();var i=r.map(t,n.capitalFirst);e=(e||[]).slice();var o=r.map(e,n.capitalFirst);return function(n,a){r.each(t,function(t,r){for(var s={name:t,capital:i[r]},l=0;l=0}function o(t,n){var o=!1;return e(function(e){r.each(i(t,e)||[],function(t){n.records[e.name][t]&&(o=!0)})}),o}function a(t,n){n.nodes.push(t),e(function(e){r.each(i(t,e)||[],function(t){n.records[e.name][t]=!0})})}return function(i){function r(t){!n(t,s)&&o(t,s)&&(a(t,s),l=!0)}var s={nodes:[],records:{}};if(e(function(t){s.records[t.name]={}}),!i)return s;a(i,s);var l;do l=!1,t(r);while(l);return s}},t.exports=o},function(t,e,i){var n=i(1);t.exports={updateSelectedMap:function(t){this._selectTargetMap=n.reduce(t||[],function(t,e){return t[e.name]=e,t},{})},select:function(t){var e=this._selectTargetMap,i=e[t],r=this.get("selectedMode"); -"single"===r&&n.each(e,function(t){t.selected=!1}),i&&(i.selected=!0)},unSelect:function(t){var e=this._selectTargetMap[t];e&&(e.selected=!1)},toggleSelected:function(t){var e=this._selectTargetMap[t];if(null!=e)return this[e.selected?"unSelect":"select"](t),e.selected},isSelected:function(t){var e=this._selectTargetMap[t];return e&&e.selected}}},function(t,e,i){function n(t){r.defaultEmphasis(t.label,r.LABEL_OPTIONS)}var r=i(6),o=i(1),a=i(10),s=i(8),l=s.addCommas,h=s.encodeHTML,u=i(2).extendComponentModel({type:"marker",dependencies:["series","grid","polar","geo"],init:function(t,e,i,n){this.mergeDefaultAndTheme(t,i),this.mergeOption(t,i,n.createdBySelf,!0)},isAnimationEnabled:function(){if(a.node)return!1;var t=this.__hostSeries;return this.getShallow("animation")&&t&&t.isAnimationEnabled()},mergeOption:function(t,e,i,r){var a=this.constructor,s=this.mainType+"Model";i||e.eachSeries(function(t){var i=t.get(this.mainType),l=t[s];return i&&i.data?(l?l.mergeOption(i,e,!0):(r&&n(i),o.each(i.data,function(t){t instanceof Array?(n(t[0]),n(t[1])):n(t)}),l=new a(i,this,e),o.extend(l,{mainType:this.mainType,seriesIndex:t.seriesIndex,name:t.name,createdBySelf:!0}),l.__hostSeries=t),void(t[s]=l)):void(t[s]=null)},this)},formatTooltip:function(t){var e=this.getData(),i=this.getRawValue(t),n=o.isArray(i)?o.map(i,l).join(", "):l(i),r=e.getName(t),a=h(this.name);return(null!=i||r)&&(a+="
"),r&&(a+=h(r),null!=i&&(a+=" : ")),null!=i&&(a+=h(n)),a},getData:function(){return this._data},setData:function(t){this._data=t}});o.mixin(u,r.dataFormatMixin),t.exports=u},function(t,e,i){t.exports=i(2).extendComponentView({type:"marker",init:function(){this.markerGroupMap={}},render:function(t,e,i){var n=this.markerGroupMap;for(var r in n)n.hasOwnProperty(r)&&(n[r].__keep=!1);var o=this.type+"Model";e.eachSeries(function(t){var n=t[o];n&&this.renderSeries(t,n,e,i)},this);for(var r in n)n.hasOwnProperty(r)&&!n[r].__keep&&this.group.remove(n[r].group)},renderSeries:function(){}})},function(t,e,i){function n(t){return!(isNaN(parseFloat(t.x))&&isNaN(parseFloat(t.y)))}function r(t){return!isNaN(parseFloat(t.x))&&!isNaN(parseFloat(t.y))}function o(t,e,i){var n=-1;do n=Math.max(l.getPrecision(t.get(e,i)),n),t=t.stackedOn;while(t);return n}function a(t,e,i,n,r,a){var s=[],l=m(e,n,t),h=e.indexOfNearest(n,l,!0);s[r]=e.get(i,h,!0),s[a]=e.get(n,h,!0);var u=o(e,n,h);return u>=0&&(s[a]=+s[a].toFixed(u)),s}var s=i(1),l=i(4),h=s.indexOf,u=s.curry,c={min:u(a,"min"),max:u(a,"max"),average:u(a,"average")},d=function(t,e){var i=t.getData(),n=t.coordinateSystem;if(e&&!r(e)&&!s.isArray(e.coord)&&n){var o=n.dimensions,a=f(e,i,n,t);if(e=s.clone(e),e.type&&c[e.type]&&a.baseAxis&&a.valueAxis){var l=h(o,a.baseAxis.dim),u=h(o,a.valueAxis.dim);e.coord=c[e.type](i,a.baseDataDim,a.valueDataDim,l,u),e.value=e.coord[u]}else{for(var d=[null!=e.xAxis?e.xAxis:e.radiusAxis,null!=e.yAxis?e.yAxis:e.angleAxis],p=0;p<2;p++)if(c[d[p]]){var g=t.coordDimToDataDim(o[p])[0];d[p]=m(i,g,d[p])}e.coord=d}}return e},f=function(t,e,i,n){var r={};return null!=t.valueIndex||null!=t.valueDim?(r.valueDataDim=null!=t.valueIndex?e.getDimension(t.valueIndex):t.valueDim,r.valueAxis=i.getAxis(n.dataDimToCoordDim(r.valueDataDim)),r.baseAxis=i.getOtherAxis(r.valueAxis),r.baseDataDim=n.coordDimToDataDim(r.baseAxis.dim)[0]):(r.baseAxis=n.getBaseAxis(),r.valueAxis=i.getOtherAxis(r.baseAxis),r.baseDataDim=n.coordDimToDataDim(r.baseAxis.dim)[0],r.valueDataDim=n.coordDimToDataDim(r.valueAxis.dim)[0]),r},p=function(t,e){return!(t&&t.containData&&e.coord&&!n(e))||t.containData(e.coord)},g=function(t,e,i,n){return n<2?t.coord&&t.coord[n]:t.value},m=function(t,e,i){if("average"===i){var n=0,r=0;return t.each(e,function(t,e){isNaN(t)||(n+=t,r++)},!0),n/r}return t.getDataExtent(e,!0)["max"===i?1:0]};t.exports={dataTransform:d,dataFilter:p,dimValueGetter:g,getAxisInfo:f,numCalculate:m}},,function(t,e){t.exports=function(t,e){var i={};e.eachRawSeriesByType(t,function(t){var n=t.getRawData(),r={};if(!e.isSeriesFiltered(t)){var o=t.getData();o.each(function(t){var e=o.getRawIndex(t);r[e]=t}),n.each(function(e){var a=r[e],s=null!=a&&o.getItemVisual(a,"color",!0);if(s)n.setItemVisual(e,"color",s);else{var l=n.getItemModel(e),h=l.get("itemStyle.normal.color")||t.getColorFromPalette(n.getName(e),i);n.setItemVisual(e,"color",h),null!=a&&o.setItemVisual(a,"color",h)}})}})}},function(t,e,i){var n=i(5),r=i(18),o={},a=Math.min,s=Math.max,l=Math.sin,h=Math.cos,u=n.create(),c=n.create(),d=n.create(),f=2*Math.PI;o.fromPoints=function(t,e,i){if(0!==t.length){var n,r=t[0],o=r[0],l=r[0],h=r[1],u=r[1];for(n=1;n1e-4)return p[0]=t-i,p[1]=e-r,g[0]=t+i,void(g[1]=e+r);if(u[0]=h(o)*i+t,u[1]=l(o)*r+e,c[0]=h(a)*i+t,c[1]=l(a)*r+e,m(p,u,c),v(g,u,c),o%=f,o<0&&(o+=f),a%=f,a<0&&(a+=f),o>a&&!s?a+=f:oo&&(d[0]=h(_)*i+t,d[1]=l(_)*r+e,m(p,d,p),v(g,d,g))},t.exports=o},function(t,e,i){var n=i(36),r=i(1),o=i(17),a=function(t){n.call(this,t)};a.prototype={constructor:a,type:"text",brush:function(t,e){var i=this.style,n=i.x||0,r=i.y||0,a=i.text;if(null!=a&&(a+=""),i.bind(t,this,e),a){this.setTransform(t);var s,l=i.textAlign,h=i.textFont||i.font;if(i.textVerticalAlign){var u=o.getBoundingRect(a,h,i.textAlign,"top");switch(s="middle",i.textVerticalAlign){case"middle":r-=u.height/2-u.lineHeight/2;break;case"bottom":r-=u.height-u.lineHeight/2;break;default:r+=u.lineHeight/2}}else s=i.textBaseline;t.font=h||"12px sans-serif",t.textAlign=l||"left",t.textAlign!==l&&(t.textAlign="left"),t.textBaseline=s||"alphabetic",t.textBaseline!==s&&(t.textBaseline="alphabetic");for(var c=o.measureText("国",t.font).width,d=a.split("\n"),f=0;f=0?parseFloat(t)/100*e:parseFloat(t):t}var r=i(17),o=i(9),a=new o,s=function(){};s.prototype={constructor:s,drawRectText:function(t,e,i){var o=this.style,s=o.text;if(null!=s&&(s+=""),s){t.save();var l,h,u=o.textPosition,c=o.textOffset,d=o.textDistance,f=o.textAlign,p=o.textFont||o.font,g=o.textBaseline,m=o.textVerticalAlign;i=i||r.getBoundingRect(s,p,f,g);var v=this.transform;if(o.textTransform?this.setTransform(t):v&&(a.copy(e),a.applyTransform(v),e=a),u instanceof Array){if(l=e.x+n(u[0],e.width),h=e.y+n(u[1],e.height),f=f||"left",g=g||"top",m){switch(m){case"middle":h-=i.height/2-i.lineHeight/2;break;case"bottom":h-=i.height-i.lineHeight/2;break;default:h+=i.lineHeight/2}g="middle"}}else{var y=r.adjustTextPositionOnRect(u,e,i,d);l=y.x,h=y.y,f=f||y.textAlign,g=g||y.textBaseline}c&&(l+=c[0],h+=c[1]),t.textAlign=f||"left",t.textBaseline=g||"alphabetic";var x=o.textFill,_=o.textStroke;x&&(t.fillStyle=x),_&&(t.strokeStyle=_),t.font=p||"12px sans-serif",t.shadowBlur=o.textShadowBlur,t.shadowColor=o.textShadowColor||"transparent",t.shadowOffsetX=o.textShadowOffsetX,t.shadowOffsetY=o.textShadowOffsetY;var b=s.split("\n");o.textRotation&&(v&&t.translate(v[4],v[5]),t.rotate(o.textRotation),v&&t.translate(-v[4],-v[5]));for(var w=0;w=0&&E.each(t,function(t){var r=t.coordinateSystem;if(r&&r.containPoint)i|=!!r.containPoint(e);else if("seriesModels"===n){var o=this._chartsMap[t.__viewId];o&&o.containPoint&&(i|=o.containPoint(e,t))}},this)},this),!!i},Q.getVisual=function(t,e){var i=this._model;t=D.parseFinder(i,t,{defaultMainType:"series"});var n=t.seriesModel,r=n.getData(),o=t.hasOwnProperty("dataIndexInside")?t.dataIndexInside:t.hasOwnProperty("dataIndex")?r.indexOfRawIndex(t.dataIndex):null;return null!=o?r.getItemVisual(o,e):r.getVisual(e)},Q.getViewOfComponentModel=function(t){return this._componentsMap[t.__viewId]},Q.getViewOfSeriesModel=function(t){return this._chartsMap[t.__viewId]};var J={update:function(t){var e=this._model,i=this._api,n=this._coordSysMgr,r=this._zr;if(e){e.restoreData(),n.create(this._model,this._api),f.call(this,e,i),p.call(this,e),n.update(e,i),m.call(this,e,t),v.call(this,e,t);var o=e.get("backgroundColor")||"transparent",a=r.painter;if(a.isSingleCanvas&&a.isSingleCanvas())r.configLayer(0,{clearColor:o});else{if(!w.canvasSupported){var s=N.parse(o);o=N.stringify(s,"rgb"),0===s[3]&&(o="transparent")}o.colorStops||o.image?(r.configLayer(0,{clearColor:o}),this[Y]=!0,this._dom.style.background="transparent"):(this[Y]&&r.configLayer(0,{clearColor:null}),this[Y]=!1,this._dom.style.background=o)}V(ot,function(t){t(e,i)})}},updateView:function(t){var e=this._model;e&&(e.eachSeries(function(t){t.getData().clearAllVisual()}),m.call(this,e,t),c.call(this,"updateView",e,t))},updateVisual:function(t){var e=this._model;e&&(e.eachSeries(function(t){t.getData().clearAllVisual()}),m.call(this,e,t,!0),c.call(this,"updateVisual",e,t))},updateLayout:function(t){var e=this._model;e&&(g.call(this,e,t),c.call(this,"updateLayout",e,t))},prepareAndUpdate:function(t){var e=this._model;d.call(this,"component",e),d.call(this,"chart",e),this.__lastOnlyGraphic?(V(this._componentsViews,function(i){var n=i.__model;n&&"graphic"===n.mainType&&(i.render(n,e,this._api,t),_(n,i))},this),this.__lastOnlyGraphic=!1):J.update.call(this,t)}};Q.resize=function(t){this[X]=!0,this._zr.resize(t);var e=this._model&&this._model.resetOption("media"),i=e?"prepareAndUpdate":"update";J[i].call(this),this._loadingFX&&this._loadingFX.resize(),this[X]=!1;var n=t&&t.silent;u.call(this,n),h.call(this,n)},Q.showLoading=function(t,e){if(E.isObject(t)&&(e=t,t=""),t=t||"default",this.hideLoading(),lt[t]){var i=lt[t](this._api,e),n=this._zr;this._loadingFX=i,n.add(i)}},Q.hideLoading=function(){this._loadingFX&&this._zr.remove(this._loadingFX),this._loadingFX=null},Q.makeActionFromEvent=function(t){var e=E.extend({},t);return e.type=it[t.type],e},Q.dispatchAction=function(t,e){if(E.isObject(e)||(e={silent:!!e}),et[t.type]){if(this[X])return void this._pendingActions.push(t);l.call(this,t,e.silent),e.flush?this._zr.flush(!0):e.flush!==!1&&w.browser.weChat&&this._throttledZrFlush(),u.call(this,e.silent),h.call(this,e.silent)}},Q.on=n("on"),Q.off=n("off"),Q.one=n("one");var tt=["click","dblclick","mouseover","mouseout","mousemove","mousedown","mouseup","globalout","contextmenu"];Q._initEvents=function(){V(tt,function(t){this._zr.on(t,function(e){var i,n=this.getModel(),r=e.target;if("globalout"===t)i={};else if(r&&null!=r.dataIndex){var o=r.dataModel||n.getSeriesByIndex(r.seriesIndex);i=o&&o.getDataParams(r.dataIndex,r.dataType)||{}}else r&&r.eventData&&(i=E.extend({},r.eventData));i&&(i.event=e,i.type=t,this.trigger(t,i))},this)},this),V(it,function(t,e){this._messageCenter.on(e,function(t){this.trigger(e,t)},this)},this)},Q.isDisposed=function(){return this._disposed},Q.clear=function(){this.setOption({series:[]},!0)},Q.dispose=function(){if(!this._disposed){this._disposed=!0;var t=this._api,e=this._model;V(this._componentsViews,function(i){i.dispose(e,t)}),V(this._chartsViews,function(i){i.dispose(e,t)}),this._zr.dispose(),delete ut[this.id]}},E.mixin(o,R);var et={},it={},nt=[],rt=[],ot=[],at=[],st={},lt={},ut={},ht={},ct=new Date-0,dt=new Date-0,ft="_echarts_instance_",pt={version:"3.5.0",dependencies:{zrender:"3.4.0"}};pt.init=function(t,e,i){var n=new o(t,e,i);return n.id="ec_"+ct++,ut[n.id]=n,t.setAttribute&&t.setAttribute(ft,n.id),b(n),n},pt.connect=function(t){if(E.isArray(t)){var e=t;t=null,E.each(e,function(e){null!=e.group&&(t=e.group)}),t=t||"g_"+dt++,E.each(e,function(e){e.group=t})}return ht[t]=!0,t},pt.disConnect=function(t){ht[t]=!1},pt.disconnect=pt.disConnect,pt.dispose=function(t){E.isDom(t)?t=pt.getInstanceByDom(t):"string"==typeof t&&(t=ut[t]),t instanceof o&&!t.isDisposed()&&t.dispose()},pt.getInstanceByDom=function(t){var e=t.getAttribute(ft);return ut[e]},pt.getInstanceById=function(t){return ut[t]},pt.registerTheme=function(t,e){st[t]=e},pt.registerPreprocessor=function(t){rt.push(t)},pt.registerProcessor=function(t,e){"function"==typeof t&&(e=t,t=G),nt.push({prio:t,func:e})},pt.registerPostUpdate=function(t){ot.push(t)},pt.registerAction=function(t,e,i){"function"==typeof e&&(i=e,e="");var n=E.isObject(t)?t.type:[t,t={event:e}][0];t.event=(t.event||n).toLowerCase(),e=t.event,E.assert(K.test(n)&&K.test(e)),et[n]||(et[n]={action:i,actionInfo:t}),it[e]=n},pt.registerCoordinateSystem=function(t,e){T.register(t,e)},pt.registerLayout=function(t,e){"function"==typeof t&&(e=t,t=W),at.push({prio:t,func:e,isLayout:!0})},pt.registerVisual=function(t,e){"function"==typeof t&&(e=t,t=q),at.push({prio:t,func:e})},pt.registerLoading=function(t,e){lt[t]=e},pt.extendComponentModel=function(t){return I.extend(t)},pt.extendComponentView=function(t){return P.extend(t)},pt.extendSeriesModel=function(t){return C.extend(t)},pt.extendChartView=function(t){return k.extend(t)},pt.setCanvasCreator=function(t){E.createCanvas=t},pt.registerVisual(Z,i(153)),pt.registerPreprocessor(i(147)),pt.registerLoading("default",i(138)),pt.registerAction({type:"highlight",event:"highlight",update:"highlight"},E.noop),pt.registerAction({type:"downplay",event:"downplay",update:"downplay"},E.noop),pt.zrender=z,pt.List=i(14),pt.Model=i(10),pt.Axis=i(33),pt.graphic=i(3),pt.number=i(4),pt.format=i(7),pt.throttle=O.throttle,pt.matrix=i(19),pt.vector=i(6),pt.color=i(22),pt.util={},V(["map","each","filter","indexOf","inherits","reduce","filter","bind","curry","isArray","isString","isObject","isFunction","extend","defaults","clone","merge"],function(t){pt.util[t]=E[t]}),pt.helper=i(137),pt.PRIORITY={PROCESSOR:{FILTER:G,STATISTIC:H},VISUAL:{LAYOUT:W,GLOBAL:Z,CHART:q,COMPONENT:j,BRUSH:U}},t.exports=pt},function(t,e,i){"use strict";function n(t){return null!=t&&"none"!=t}function r(t){return"string"==typeof t?_.lift(t,-.1):t}function o(t){if(t.__hoverStlDirty){var e=t.style.stroke,i=t.style.fill,o=t.__hoverStl;o.fill=o.fill||(n(i)?r(i):null),o.stroke=o.stroke||(n(e)?r(e):null);var a={};for(var s in o)o.hasOwnProperty(s)&&(a[s]=t.style[s]);t.__normalStl=a,t.__hoverStlDirty=!1}}function a(t){t.__isHover||(o(t),t.useHoverLayer?t.__zr&&t.__zr.addHover(t,t.__hoverStl):(t.setStyle(t.__hoverStl),t.z2+=1),t.__isHover=!0)}function s(t){if(t.__isHover){var e=t.__normalStl;t.useHoverLayer?t.__zr&&t.__zr.removeHover(t):(e&&t.setStyle(e),t.z2-=1),t.__isHover=!1}}function l(t){"group"===t.type?t.traverse(function(t){"group"!==t.type&&a(t)}):a(t)}function u(t){"group"===t.type?t.traverse(function(t){"group"!==t.type&&s(t)}):s(t)}function h(t,e){t.__hoverStl=t.hoverStyle||e||{},t.__hoverStlDirty=!0,t.__isHover&&o(t)}function c(t){this.__hoverSilentOnTouch&&t.zrByTouch||!this.__isEmphasis&&l(this)}function d(t){this.__hoverSilentOnTouch&&t.zrByTouch||!this.__isEmphasis&&u(this)}function f(){this.__isEmphasis=!0,l(this)}function p(){this.__isEmphasis=!1,u(this)}function g(t,e,i,n,r,o){"function"==typeof r&&(o=r,r=null);var a=n&&n.isAnimationEnabled();if(a){var s=t?"Update":"",l=n.getShallow("animationDuration"+s),u=n.getShallow("animationEasing"+s),h=n.getShallow("animationDelay"+s);"function"==typeof h&&(h=h(r,n.getAnimationDelayParams?n.getAnimationDelayParams(e,r):null)),"function"==typeof l&&(l=l(r)),l>0?e.animateTo(i,l,h||0,u,o):(e.attr(i),o&&o())}else e.attr(i),o&&o()}var m=i(1),v=i(182),y=Math.round,x=i(8),_=i(22),b=i(19),w=i(6),M={};M.Group=i(36),M.Image=i(53),M.Text=i(85),M.Circle=i(173),M.Sector=i(179),M.Ring=i(178),M.Polygon=i(175),M.Polyline=i(176),M.Rect=i(177),M.Line=i(174),M.BezierCurve=i(172),M.Arc=i(171),M.CompoundPath=i(166),M.LinearGradient=i(101),M.RadialGradient=i(167),M.BoundingRect=i(11),M.extendShape=function(t){return x.extend(t)},M.extendPath=function(t,e){return v.extendFromString(t,e)},M.makePath=function(t,e,i,n){var r=v.createFromString(t,e),o=r.getBoundingRect();if(i){var a=o.width/o.height;if("center"===n){var s,l=i.height*a;l<=i.width?s=i.height:(l=i.width,s=l/a);var u=i.x+i.width/2,h=i.y+i.height/2;i.x=u-l/2,i.y=h-s/2,i.width=l,i.height=s}M.resizePath(r,i)}return r},M.mergePath=v.mergePath,M.resizePath=function(t,e){if(t.applyTransform){var i=t.getBoundingRect(),n=i.calculateTransform(e);t.applyTransform(n)}},M.subPixelOptimizeLine=function(t){var e=M.subPixelOptimize,i=t.shape,n=t.style.lineWidth;return y(2*i.x1)===y(2*i.x2)&&(i.x1=i.x2=e(i.x1,n,!0)),y(2*i.y1)===y(2*i.y2)&&(i.y1=i.y2=e(i.y1,n,!0)),t},M.subPixelOptimizeRect=function(t){var e=M.subPixelOptimize,i=t.shape,n=t.style.lineWidth,r=i.x,o=i.y,a=i.width,s=i.height;return i.x=e(i.x,n,!0),i.y=e(i.y,n,!0),i.width=Math.max(e(r+a,n,!1)-i.x,0===a?0:1),i.height=Math.max(e(o+s,n,!1)-i.y,0===s?0:1),t},M.subPixelOptimize=function(t,e,i){var n=y(2*t);return(n+y(e))%2===0?n/2:(n+(i?1:-1))/2},M.setHoverStyle=function(t,e,i){t.__hoverSilentOnTouch=i&&i.hoverSilentOnTouch,"group"===t.type?t.traverse(function(t){"group"!==t.type&&h(t,e)}):h(t,e),t.on("mouseover",c).on("mouseout",d),t.on("emphasis",f).on("normal",p)},M.setText=function(t,e,i){var n=e.getShallow("position")||"inside",r=e.getShallow("offset"),o=n.indexOf("inside")>=0?"white":i,a=e.getModel("textStyle");m.extend(t,{textDistance:e.getShallow("distance")||5,textFont:a.getFont(),textPosition:n,textOffset:r,textFill:a.getTextColor()||o})},M.updateProps=function(t,e,i,n,r){g(!0,t,e,i,n,r)},M.initProps=function(t,e,i,n,r){g(!1,t,e,i,n,r)},M.getTransform=function(t,e){for(var i=b.identity([]);t&&t!==e;)b.mul(i,t.getLocalTransform(),i),t=t.parent;return i},M.applyTransform=function(t,e,i){return i&&(e=b.invert([],e)),w.applyTransform([],t,e)},M.transformDirection=function(t,e,i){var n=0===e[4]||0===e[5]||0===e[0]?1:Math.abs(2*e[4]/e[0]),r=0===e[4]||0===e[5]||0===e[2]?1:Math.abs(2*e[4]/e[2]),o=["left"===t?-n:"right"===t?n:0,"top"===t?-r:"bottom"===t?r:0];return o=M.applyTransform(o,e,i),Math.abs(o[0])>Math.abs(o[1])?o[0]>0?"right":"left":o[1]>0?"bottom":"top"},M.groupTransition=function(t,e,i,n){function r(t){var e={};return t.traverse(function(t){!t.isGroup&&t.anid&&(e[t.anid]=t)}),e}function o(t){var e={position:w.clone(t.position),rotation:t.rotation};return t.shape&&(e.shape=m.extend({},t.shape)),e}if(t&&e){var a=r(t);e.traverse(function(t){if(!t.isGroup&&t.anid){var e=a[t.anid];if(e){var n=o(t);t.attr(o(e)),M.updateProps(t,n,i,t.dataIndex)}}})}},t.exports=M},function(t,e){function i(t){return t.replace(/^\s+/,"").replace(/\s+$/,"")}var n={},r=1e-4;n.linearMap=function(t,e,i,n){var r=e[1]-e[0],o=i[1]-i[0];if(0===r)return 0===o?i[0]:(i[0]+i[1])/2;if(n)if(r>0){if(t<=e[0])return i[0];if(t>=e[1])return i[1]}else{if(t>=e[0])return i[0];if(t<=e[1])return i[1]}else{if(t===e[0])return i[0];if(t===e[1])return i[1]}return(t-e[0])/r*o+i[0]},n.parsePercent=function(t,e){switch(t){case"center":case"middle":t="50%";break;case"left":case"top":t="0%";break;case"right":case"bottom":t="100%"}return"string"==typeof t?i(t).match(/%$/)?parseFloat(t)/100*e:parseFloat(t):null==t?NaN:+t},n.round=function(t,e,i){return null==e&&(e=10),e=Math.min(Math.max(0,e),20),t=(+t).toFixed(e),i?t:+t},n.asc=function(t){return t.sort(function(t,e){return t-e}),t},n.getPrecision=function(t){if(t=+t,isNaN(t))return 0;for(var e=1,i=0;Math.round(t*e)/e!==t;)e*=10,i++;return i},n.getPrecisionSafe=function(t){var e=t.toString(),i=e.indexOf(".");return i<0?0:e.length-1-i},n.getPixelPrecision=function(t,e){var i=Math.log,n=Math.LN10,r=Math.floor(i(t[1]-t[0])/n),o=Math.round(i(Math.abs(e[1]-e[0]))/n),a=Math.min(Math.max(-r+o,0),20);return isFinite(a)?a:20},n.MAX_SAFE_INTEGER=9007199254740991,n.remRadian=function(t){var e=2*Math.PI;return(t%e+e)%e},n.isRadianAroundZero=function(t){return t>-r&&t=0},t.exports=n},function(t,e,i){function n(t,e){return t&&t.hasOwnProperty(e)}var r=i(7),o=i(4),a=i(10),s=i(1),l=s.each,u=s.isObject,h={};h.normalizeToArray=function(t){return t instanceof Array?t:null==t?[]:[t]},h.defaultEmphasis=function(t,e){if(t){var i=t.emphasis=t.emphasis||{},n=t.normal=t.normal||{};l(e,function(t){var e=s.retrieve(i[t],n[t]);null!=e&&(i[t]=e)})}},h.LABEL_OPTIONS=["position","offset","show","textStyle","distance","formatter"],h.getDataItemValue=function(t){return t&&(null==t.value?t:t.value)},h.isDataItemOption=function(t){return u(t)&&!(t instanceof Array)},h.converDataValue=function(t,e){var i=e&&e.type;return"ordinal"===i?t:("time"===i&&"number"!=typeof t&&null!=t&&"-"!==t&&(t=+o.parseDate(t)),null==t||""===t?NaN:+t)},h.createDataFormatModel=function(t,e){var i=new a;return s.mixin(i,h.dataFormatMixin),i.seriesIndex=e.seriesIndex,i.name=e.name||"",i.mainType=e.mainType,i.subType=e.subType,i.getData=function(){return t},i},h.dataFormatMixin={getDataParams:function(t,e){var i=this.getData(e),n=this.getRawValue(t,e),r=i.getRawIndex(t),o=i.getName(t,!0),a=i.getRawDataItem(t);return{componentType:this.mainType,componentSubType:this.subType,seriesType:"series"===this.mainType?this.subType:null,seriesIndex:this.seriesIndex,seriesId:this.id,seriesName:this.name,name:o,dataIndex:r,data:a,dataType:e,value:n,color:i.getItemVisual(t,"color"),$vars:["seriesName","name","value"]}},getFormattedLabel:function(t,e,i,n){e=e||"normal";var o=this.getData(i),a=o.getItemModel(t),s=this.getDataParams(t,i);null!=n&&s.value instanceof Array&&(s.value=s.value[n]);var l=a.get(["label",e,"formatter"]);return"function"==typeof l?(s.status=e,l(s)):"string"==typeof l?r.formatTpl(l,s):void 0},getRawValue:function(t,e){var i=this.getData(e),n=i.getRawDataItem(t);if(null!=n)return!u(n)||n instanceof Array?n:n.value},formatTooltip:s.noop},h.mappingToExists=function(t,e){e=(e||[]).slice();var i=s.map(t||[],function(t,e){return{exist:t}});return l(e,function(t,n){if(u(t)){for(var r=0;r=i.length&&i.push({option:t})}}),i},h.makeIdAndName=function(t){var e={};l(t,function(t,i){var n=t.exist;n&&(e[n.id]=t)}),l(t,function(t,i){var n=t.option;s.assert(!n||null==n.id||!e[n.id]||e[n.id]===t,"id duplicates: "+(n&&n.id)),n&&null!=n.id&&(e[n.id]=t),!t.keyInfo&&(t.keyInfo={})}),l(t,function(t,i){var n=t.exist,r=t.option,o=t.keyInfo;if(u(r)){if(o.name=null!=r.name?r.name+"":n?n.name:"\0-",n)o.id=n.id;else if(null!=r.id)o.id=r.id+"";else{var a=0;do o.id="\0"+o.name+"\0"+a++;while(e[o.id])}e[o.id]=t}})},h.isIdInner=function(t){return u(t)&&t.id&&0===(t.id+"").indexOf("\0_ec_\0")},h.compressBatches=function(t,e){function i(t,e,i){for(var n=0,r=t.length;n1?"."+t[1]:""))},a.toCamelCase=function(t,e){return t=(t||"").toLowerCase().replace(/-(.)/g,function(t,e){return e.toUpperCase()}),e&&t&&(t=t.charAt(0).toUpperCase()+t.slice(1)),t},a.normalizeCssArray=function(t){var e=t.length;return"number"==typeof t?[t,t,t,t]:2===e?[t[0],t[1],t[0],t[1]]:3===e?[t[0],t[1],t[2],t[1]]:t};var s=a.encodeHTML=function(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")},l=["a","b","c","d","e","f","g"],u=function(t,e){return"{"+t+(null==e?"":e)+"}"};a.formatTpl=function(t,e,i){n.isArray(e)||(e=[e]);var r=e.length;if(!r)return"";for(var o=e[0].$vars||[],a=0;a1e-10&&(r.width+=o/a,r.height+=o/a,r.x-=o/a/2,r.y-=o/a/2)}return r}return t},contain:function(t,e){var i=this.transformCoordToLocal(t,e),n=this.getBoundingRect(),r=this.style;if(t=i[0],e=i[1],n.contain(t,e)){var o=this.path.data;if(r.hasStroke()){var a=r.lineWidth,l=r.strokeNoScale?this.getLineScale():1;if(l>1e-10&&(r.hasFill()||(a=Math.max(a,this.strokeContainThreshold)),s.containStroke(o,a/l,t,e)))return!0}if(r.hasFill())return s.contain(o,t,e)}return!1},dirty:function(t){null==t&&(t=!0),t&&(this.__dirtyPath=t,this._rect=null),this.__dirty=!0,this.__zr&&this.__zr.refresh(),this.__clipTarget&&this.__clipTarget.dirty()},animateShape:function(t){return this.animate("shape",t)},attrKV:function(t,e){"shape"===t?(this.setShape(e),this.__dirtyPath=!0,this._rect=null):r.prototype.attrKV.call(this,t,e)},setShape:function(t,e){var i=this.shape;if(i){if(o.isObject(t))for(var n in t)t.hasOwnProperty(n)&&(i[n]=t[n]);else i[t]=e;this.dirty(!0)}return this},getLineScale:function(){var t=this.transform;return t&&h(t[0]-1)>1e-10&&h(t[3]-1)>1e-10?Math.sqrt(h(t[0]*t[3]-t[2]*t[1])):1}},n.extend=function(t){var e=function(e){n.call(this,e),t.style&&this.style.extendFrom(t.style,!1);var i=t.shape;if(i){this.shape=this.shape||{};var r=this.shape;for(var o in i)!r.hasOwnProperty(o)&&i.hasOwnProperty(o)&&(r[o]=i[o])}t.init&&t.init.call(this,e)};o.inherits(e,n);for(var i in t)"style"!==i&&"shape"!==i&&(e.prototype[i]=t[i]);return e},o.inherits(n,r),t.exports=n},function(t,e){function i(t){var e={},i={},n=t.match(/Firefox\/([\d.]+)/),r=t.match(/MSIE\s([\d.]+)/)||t.match(/Trident\/.+?rv:(([\d.]+))/),o=t.match(/Edge\/([\d.]+)/),a=/micromessenger/i.test(t);return n&&(i.firefox=!0,i.version=n[1]),r&&(i.ie=!0,i.version=r[1]),o&&(i.edge=!0,i.version=o[1]),a&&(i.weChat=!0),{browser:i,os:e,node:!1,canvasSupported:!!document.createElement("canvas").getContext,touchEventsSupported:"ontouchstart"in window&&!i.ie&&!i.edge,pointerEventsSupported:"onpointerdown"in window&&(i.edge||i.ie&&i.version>=11)}}var n={};n="undefined"==typeof navigator?{browser:{},os:{},node:!0,canvasSupported:!0}:i(navigator.userAgent),t.exports=n},function(t,e,i){function n(t,e,i){this.parentModel=e,this.ecModel=i,this.option=t}function r(t,e,i){for(var n=0;n=i.x&&t<=i.x+i.width&&e>=i.y&&e<=i.y+i.height},clone:function(){return new n(this.x,this.y,this.width,this.height)},copy:function(t){this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height},plain:function(){return{x:this.x,y:this.y,width:this.width,height:this.height}}},n.create=function(t){return new n(t.x,t.y,t.width,t.height)},t.exports=n},function(t,e,i){"use strict";function n(t,e,i,n,r){var o=0,a=0;null==n&&(n=1/0),null==r&&(r=1/0);var s=0;e.eachChild(function(l,u){var h,c,d=l.position,f=l.getBoundingRect(),p=e.childAt(u+1),g=p&&p.getBoundingRect();if("horizontal"===t){var m=f.width+(g?-g.x+f.x:0);h=o+m,h>n||l.newline?(o=0,h=m,a+=s+i,s=f.height):s=Math.max(s,f.height)}else{var v=f.height+(g?-g.y+f.y:0);c=a+v,c>r||l.newline?(o+=s+i,a=0,c=v,s=f.width):s=Math.max(s,f.width)}l.newline||(d[0]=o,d[1]=a,"horizontal"===t?o=h+i:a=c+i)})}var r=i(1),o=i(11),a=i(4),s=i(7),l=a.parsePercent,u=r.each,h={},c=h.LOCATION_PARAMS=["left","right","top","bottom","width","height"],d=h.HV_NAMES=[["width","left","right"],["height","top","bottom"]];h.box=n,h.vbox=r.curry(n,"vertical"),h.hbox=r.curry(n,"horizontal"),h.getAvailableSize=function(t,e,i){var n=e.width,r=e.height,o=l(t.x,n),a=l(t.y,r),u=l(t.x2,n),h=l(t.y2,r);return(isNaN(o)||isNaN(parseFloat(t.x)))&&(o=0),(isNaN(u)||isNaN(parseFloat(t.x2)))&&(u=n),(isNaN(a)||isNaN(parseFloat(t.y)))&&(a=0),(isNaN(h)||isNaN(parseFloat(t.y2)))&&(h=r), +i=s.normalizeCssArray(i||0),{width:Math.max(u-o-i[1]-i[3],0),height:Math.max(h-a-i[0]-i[2],0)}},h.getLayoutRect=function(t,e,i){i=s.normalizeCssArray(i||0);var n=e.width,r=e.height,a=l(t.left,n),u=l(t.top,r),h=l(t.right,n),c=l(t.bottom,r),d=l(t.width,n),f=l(t.height,r),p=i[2]+i[0],g=i[1]+i[3],m=t.aspect;switch(isNaN(d)&&(d=n-h-g-a),isNaN(f)&&(f=r-c-p-u),isNaN(d)&&isNaN(f)&&(m>n/r?d=.8*n:f=.8*r),null!=m&&(isNaN(d)&&(d=m*f),isNaN(f)&&(f=d/m)),isNaN(a)&&(a=n-h-d-g),isNaN(u)&&(u=r-c-f-p),t.left||t.right){case"center":a=n/2-d/2-i[3];break;case"right":a=n-d-g}switch(t.top||t.bottom){case"middle":case"center":u=r/2-f/2-i[0];break;case"bottom":u=r-f-p}a=a||0,u=u||0,isNaN(d)&&(d=n-a-(h||0)),isNaN(f)&&(f=r-u-(c||0));var v=new o(a+i[3],u+i[0],d,f);return v.margin=i,v},h.positionElement=function(t,e,i,n,a){var s=!a||!a.hv||a.hv[0],l=!a||!a.hv||a.hv[1],u=a&&a.boundingMode||"all";if(s||l){var c;if("raw"===u)c="group"===t.type?new o(0,0,+e.width||0,+e.height||0):t.getBoundingRect();else if(c=t.getBoundingRect(),t.needLocalTransform()){var d=t.getLocalTransform();c=c.clone(),c.applyTransform(d)}e=h.getLayoutRect(r.defaults({width:c.width,height:c.height},e),i,n);var f=t.position,p=s?e.x-c.x:0,g=l?e.y-c.y:0;t.attr("position","raw"===u?[p,g]:[f[0]+p,f[1]+g])}},h.sizeCalculable=function(t,e){return null!=t[d[e][0]]||null!=t[d[e][1]]&&null!=t[d[e][2]]},h.mergeLayoutParam=function(t,e,i){function n(i,n){var r={},s=0,h={},c=0,d=2;if(u(i,function(e){h[e]=t[e]}),u(i,function(t){o(e,t)&&(r[t]=h[t]=e[t]),a(r,t)&&s++,a(h,t)&&c++}),l[n])return a(e,i[2])&&(h[i[1]]=null),a(e,i[1])&&(h[i[2]]=null),h;if(c!==d&&s){if(s>=d)return r;for(var f=0;f=0;r--)n=o.merge(n,t[r],!0);l.set(this,"__defaultOption",n)}return l.get(this,"__defaultOption")},getReferringComponents:function(t){return this.ecModel.queryComponents({mainType:t,index:this.get(t+"Index",!0),id:this.get(t+"Id",!0)})}});l.enableClassManagement(h,{registerWhenExtend:!0}),s.enableSubTypeDefaulter(h),s.enableTopologicalTravel(h,n),o.mixin(h,i(143)),t.exports=h},function(t,e,i){(function(e){function n(t){return d.isArray(t)||(t=[t]),t}function r(t,e){var i=t.dimensions,n=new v(d.map(i,t.getDimensionInfo,t),t.hostModel);m(n,t);for(var r=n._storage={},o=t._storage,a=0;a=0?r[s]=new l.constructor(o[s].length):r[s]=o[s]}return n}var o="undefined",a="undefined"==typeof window?e:window,s=typeof a.Float64Array===o?Array:a.Float64Array,l=typeof a.Int32Array===o?Array:a.Int32Array,u={"float":s,"int":l,ordinal:Array,number:Array,time:Array},h=i(10),c=i(48),d=i(1),f=i(5),p=d.isObject,g=["stackedOn","hasItemOption","_nameList","_idList","_rawData"],m=function(t,e){d.each(g.concat(e.__wrappedMethods||[]),function(i){e.hasOwnProperty(i)&&(t[i]=e[i])}),t.__wrappedMethods=e.__wrappedMethods},v=function(t,e){t=t||["x","y"];for(var i={},n=[],r=0;r0&&(w+="__ec__"+h[b]),h[b]++),w&&(l[c]=w)}this._nameList=e,this._idList=l},y.count=function(){return this.indices.length},y.get=function(t,e,i){var n=this._storage,r=this.indices[e];if(null==r)return NaN;var o=n[t]&&n[t][r];if(i){var a=this._dimensionInfos[t];if(a&&a.stackable)for(var s=this.stackedOn;s;){var l=s.get(t,e);(o>=0&&l>0||o<=0&&l<0)&&(o+=l),s=s.stackedOn}}return o},y.getValues=function(t,e,i){var n=[];d.isArray(t)||(i=e,e=t,t=this.dimensions);for(var r=0,o=t.length;rl&&(l=o));return this._extent[t+!!e]=[s,l]}return[1/0,-(1/0)]},y.getSum=function(t,e){var i=this._storage[t],n=0;if(i)for(var r=0,o=this.count();rt))return o;r=o-1}}return-1},y.indexOfNearest=function(t,e,i,n){var r=this._storage,o=r[t],a=[];if(!o)return a;null==n&&(n=1/0);for(var s=Number.MAX_VALUE,l=-1,u=0,h=this.count();u=0&&l<0)&&(s=d,l=c,a.length=0),a.push(u))}return a},y.getRawIndex=function(t){var e=this.indices[t];return null==e?-1:e},y.getRawDataItem=function(t){return this._rawData[this.getRawIndex(t)]},y.getName=function(t){return this._nameList[this.indices[t]]||""},y.getId=function(t){return this._idList[this.indices[t]]||this.getRawIndex(t)+""},y.each=function(t,e,i,r){"function"==typeof t&&(r=i,i=e,e=t,t=[]),t=d.map(n(t),this.getDimension,this);var o=[],a=t.length,s=this.indices;r=r||this;for(var l=0;lp-g&&(d=p-g,h.length=d);for(var m=0;mh&&(u=0,l={}),u++,l[i]=r,r}function r(t,e,i,r){var o=((t||"")+"").split("\n").length,a=n(t,e),s=n("国",e),l=o*s,u=new d(0,0,a,l);switch(u.lineHeight=s,r){case"bottom":case"alphabetic":u.y-=s;break;case"middle":u.y-=s/2}switch(i){case"end":case"right":u.x-=u.width;break;case"center":u.x-=u.width/2}return u}function o(t,e,i,n){var r=e.x,o=e.y,a=e.height,s=e.width,l=i.height,u=a/2-l/2,h="left";switch(t){case"left":r-=n,o+=u,h="right";break;case"right":r+=n+s,o+=u,h="left";break;case"top":r+=s/2,o-=n+l,h="center";break;case"bottom":r+=s/2,o+=a+n,h="center";break;case"inside":r+=s/2,o+=u,h="center";break;case"insideLeft":r+=n,o+=u,h="left";break;case"insideRight":r+=s-n,o+=u,h="right";break;case"insideTop":r+=s/2,o+=n,h="center";break;case"insideBottom":r+=s/2,o+=a-l-n,h="center";break;case"insideTopLeft":r+=n,o+=n,h="left";break;case"insideTopRight":r+=s-n,o+=n,h="right";break;case"insideBottomLeft":r+=n,o+=a-l-n;break;case"insideBottomRight":r+=s-n,o+=a-l-n,h="right"}return{x:r,y:o,textAlign:h,textBaseline:"top"}}function a(t,e,i,r,o){if(!e)return"";o=o||{},r=f(r,"...");for(var a=f(o.maxIterations,2),l=f(o.minChar,0),u=n("国",i),h=n("a",i),c=f(o.placeholder,""),d=e=Math.max(0,e-1),p=0;p=h;p++)d-=h;var g=n(r);g>d&&(r="",g=0),d=e-g;for(var m=(t+"").split("\n"),p=0,v=m.length;p=a){y+=r;break}var b=0===_?s(y,d,h,u):x>0?Math.floor(y.length*d/x):0;y=y.substr(0,b),x=n(y,i)}""===y&&(y=c),m[p]=y}}return m.join("\n")}function s(t,e,i,n){for(var r=0,o=0,a=t.length;o0&&u>0&&!h&&(l=0),l<0&&u<0&&!c&&(u=0)),[l,u]},u.niceScaleExtent=function(t,e){var i=u.getScaleExtent(t,e),n=null!=e.getMin(),r=null!=e.getMax(),o=e.get("splitNumber");"log"===t.type&&(t.base=e.get("logBase")),t.setExtent(i[0],i[1]),t.niceExtent(o,n,r);var a=e.get("minInterval");if(isFinite(a)&&!n&&!r&&"interval"===t.type){var s=t.getInterval(),l=Math.max(Math.abs(s),a)/s;i=t.getExtent();var h=(i[1]+i[0])/2;t.setExtent(l*(i[0]-h)+h,l*(i[1]-h)+h),t.niceExtent(o)}var s=e.get("interval");null!=s&&t.setInterval&&t.setInterval(s)},u.createScaleByModel=function(t,e){if(e=e||t.get("type"))switch(e){case"category":return new n(t.getCategories(),[1/0,-(1/0)]);case"value":return new r;default:return(o.getClass(e)||r).create(t)}},u.ifAxisCrossZero=function(t){var e=t.scale.getExtent(),i=e[0],n=e[1];return!(i>0&&n>0||i<0&&n<0)},u.getAxisLabelInterval=function(t,e,i,n){var r,o=0,a=0,s=1;e.length>40&&(s=Math.floor(e.length/40));for(var u=0;u1?s:(o+1)*s-1},u.getFormattedLabels=function(t,e){var i=t.scale,n=i.getTicksLabels(),r=i.getTicks();return"string"==typeof e?(e=function(t){return function(e){return t.replace("{value}",null!=e?e:"")}}(e),s.map(n,e)):"function"==typeof e?s.map(r,function(i,n){return e(u.getAxisRawValue(t,i),n)},this):n},u.getAxisRawValue=function(t,e){return"category"===t.type?t.scale.getLabel(e):e},t.exports=u},function(t,e,i){"use strict";var n=i(1),r=i(7),o=i(15),a=i(5),s=i(13),l=i(62),u=i(9),h=i(12),c=o.set,d=o.get,f=r.encodeHTML,p=r.addCommas,g=s.extend({type:"series.__base__",seriesIndex:0,coordinateSystem:null,defaultOption:null,legendDataProvider:null,visualColorAccessPath:"itemStyle.normal.color",layoutMode:null,init:function(t,e,i,n){this.seriesIndex=this.componentIndex,this.mergeDefaultAndTheme(t,i);var r=this.getInitialData(t,i);c(this,"dataBeforeProcessed",r),this.restoreData()},mergeDefaultAndTheme:function(t,e){var i=this.layoutMode,r=i?h.getLayoutParams(t):{};n.merge(t,e.getTheme().get(this.subType)),n.merge(t,this.getDefaultOption()),a.defaultEmphasis(t.label,a.LABEL_OPTIONS),this.fillDataTextStyle(t.data),i&&h.mergeLayoutParam(t,r,i)},mergeOption:function(t,e){t=n.merge(this.option,t,!0),this.fillDataTextStyle(t.data);var i=this.layoutMode;i&&h.mergeLayoutParam(this.option,t,i);var r=this.getInitialData(t,e);r&&(c(this,"data",r),c(this,"dataBeforeProcessed",r.cloneShallow()))},fillDataTextStyle:function(t){if(t)for(var e=0;e',g=this.name;return"\0-"===g&&(g=""),e?c+f(this.name)+" : "+l:(g&&f(g)+"
")+c+(u?f(u)+" : "+l:l)},isAnimationEnabled:function(){if(u.node)return!1;var t=this.getShallow("animation");return t&&this.getData().count()>this.getShallow("animationThreshold")&&(t=!1),t},restoreData:function(){c(this,"data",d(this,"dataBeforeProcessed").cloneShallow())},getColorFromPalette:function(t,e){var i=this.ecModel,n=l.getColorFromPalette.call(this,t,e);return n||(n=i.getColorFromPalette(t,e)),n},getAxisTooltipData:null,getTooltipPosition:null});n.mixin(g,a.dataFormatMixin),n.mixin(g,l),t.exports=g},function(t,e){var i="undefined"==typeof Float32Array?Array:Float32Array,n={create:function(){var t=new i(6);return n.identity(t),t},identity:function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t},copy:function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t},mul:function(t,e,i){var n=e[0]*i[0]+e[2]*i[1],r=e[1]*i[0]+e[3]*i[1],o=e[0]*i[2]+e[2]*i[3],a=e[1]*i[2]+e[3]*i[3],s=e[0]*i[4]+e[2]*i[5]+e[4],l=e[1]*i[4]+e[3]*i[5]+e[5];return t[0]=n,t[1]=r,t[2]=o,t[3]=a,t[4]=s,t[5]=l,t},translate:function(t,e,i){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4]+i[0],t[5]=e[5]+i[1],t},rotate:function(t,e,i){var n=e[0],r=e[2],o=e[4],a=e[1],s=e[3],l=e[5],u=Math.sin(i),h=Math.cos(i);return t[0]=n*h+a*u,t[1]=-n*u+a*h,t[2]=r*h+s*u,t[3]=-r*u+h*s,t[4]=h*o+u*l,t[5]=h*l-u*o,t},scale:function(t,e,i){var n=i[0],r=i[1];return t[0]=e[0]*n,t[1]=e[1]*r,t[2]=e[2]*n,t[3]=e[3]*r,t[4]=e[4]*n,t[5]=e[5]*r,t},invert:function(t,e){var i=e[0],n=e[2],r=e[4],o=e[1],a=e[3],s=e[5],l=i*a-o*n;return l?(l=1/l,t[0]=a*l,t[1]=-o*l,t[2]=-n*l,t[3]=i*l,t[4]=(n*s-a*r)*l,t[5]=(o*r-i*s)*l,t):null}};t.exports=n},function(t,e,i){"use strict";function n(t){return t.getBoundingClientRect?t.getBoundingClientRect():{left:0,top:0}}function r(t,e,i,n){return i=i||{},n||!h.canvasSupported?o(t,e,i):h.browser.firefox&&null!=e.layerX&&e.layerX!==e.offsetX?(i.zrX=e.layerX,i.zrY=e.layerY):null!=e.offsetX?(i.zrX=e.offsetX,i.zrY=e.offsetY):o(t,e,i),i}function o(t,e,i){var r=n(t);i.zrX=e.clientX-r.left,i.zrY=e.clientY-r.top}function a(t,e,i){if(e=e||window.event,null!=e.zrX)return e;var n=e.type,o=n&&n.indexOf("touch")>=0;if(o){var a="touchend"!=n?e.targetTouches[0]:e.changedTouches[0];a&&r(t,a,e,i)}else r(t,e,e,i),e.zrDelta=e.wheelDelta?e.wheelDelta/120:-(e.detail||0)/3;return e}function s(t,e,i){c?t.addEventListener(e,i):t.attachEvent("on"+e,i)}function l(t,e,i){c?t.removeEventListener(e,i):t.detachEvent("on"+e,i)}var u=i(23),h=i(9),c="undefined"!=typeof window&&!!window.addEventListener,d=c?function(t){t.preventDefault(),t.stopPropagation(),t.cancelBubble=!0}:function(t){t.returnValue=!1,t.cancelBubble=!0};t.exports={clientToLocal:r,normalizeEvent:a,addEventListener:s,removeEventListener:l,stop:d,Dispatcher:u}},function(t,e,i){"use strict";function n(t){return t>-w&&tw||t<-w}function o(t,e,i,n,r){var o=1-r;return o*o*(o*t+3*r*e)+r*r*(r*n+3*o*i)}function a(t,e,i,n,r){var o=1-r;return 3*(((e-t)*o+2*(i-e)*r)*o+(n-i)*r*r)}function s(t,e,i,r,o,a){var s=r+3*(e-i)-t,l=3*(i-2*e+t),u=3*(e-t),h=t-o,c=l*l-3*s*u,d=l*u-9*s*h,f=u*u-3*l*h,p=0;if(n(c)&&n(d))if(n(l))a[0]=0;else{var g=-u/l;g>=0&&g<=1&&(a[p++]=g)}else{var m=d*d-4*c*f;if(n(m)){var v=d/c,g=-l/s+v,y=-v/2;g>=0&&g<=1&&(a[p++]=g),y>=0&&y<=1&&(a[p++]=y)}else if(m>0){var x=b(m),w=c*l+1.5*s*(-d+x),M=c*l+1.5*s*(-d-x);w=w<0?-_(-w,T):_(w,T),M=M<0?-_(-M,T):_(M,T);var g=(-l-(w+M))/(3*s);g>=0&&g<=1&&(a[p++]=g)}else{var A=(2*c*l-3*s*d)/(2*b(c*c*c)),I=Math.acos(A)/3,C=b(c),P=Math.cos(I),g=(-l-2*C*P)/(3*s),y=(-l+C*(P+S*Math.sin(I)))/(3*s),k=(-l+C*(P-S*Math.sin(I)))/(3*s);g>=0&&g<=1&&(a[p++]=g),y>=0&&y<=1&&(a[p++]=y),k>=0&&k<=1&&(a[p++]=k)}}return p}function l(t,e,i,o,a){var s=6*i-12*e+6*t,l=9*e+3*o-3*t-9*i,u=3*e-3*t,h=0;if(n(l)){if(r(s)){var c=-u/s;c>=0&&c<=1&&(a[h++]=c)}}else{var d=s*s-4*l*u;if(n(d))a[0]=-s/(2*l);else if(d>0){var f=b(d),c=(-s+f)/(2*l),p=(-s-f)/(2*l);c>=0&&c<=1&&(a[h++]=c),p>=0&&p<=1&&(a[h++]=p)}}return h}function u(t,e,i,n,r,o){var a=(e-t)*r+t,s=(i-e)*r+e,l=(n-i)*r+i,u=(s-a)*r+a,h=(l-s)*r+s,c=(h-u)*r+u;o[0]=t,o[1]=a,o[2]=u,o[3]=c,o[4]=c,o[5]=h,o[6]=l,o[7]=n}function h(t,e,i,n,r,a,s,l,u,h,c){var d,f,p,g,m,v=.005,y=1/0;A[0]=u,A[1]=h;for(var _=0;_<1;_+=.05)I[0]=o(t,i,r,s,_),I[1]=o(e,n,a,l,_),g=x(A,I),g=0&&g=0&&c<=1&&(a[h++]=c)}}else{var d=l*l-4*s*u;if(n(d)){var c=-l/(2*s);c>=0&&c<=1&&(a[h++]=c)}else if(d>0){var f=b(d),c=(-l+f)/(2*s),p=(-l-f)/(2*s);c>=0&&c<=1&&(a[h++]=c),p>=0&&p<=1&&(a[h++]=p)}}return h}function p(t,e,i){var n=t+i-2*e;return 0===n?.5:(t-e)/n}function g(t,e,i,n,r){var o=(e-t)*n+t,a=(i-e)*n+e,s=(a-o)*n+o;r[0]=t,r[1]=o,r[2]=s,r[3]=s,r[4]=a,r[5]=i}function m(t,e,i,n,r,o,a,s,l){var u,h=.005,d=1/0;A[0]=a,A[1]=s;for(var f=0;f<1;f+=.05){I[0]=c(t,i,r,f),I[1]=c(e,n,o,f);var p=x(A,I);p=0&&p255?255:t}function r(t){return t=Math.round(t),t<0?0:t>360?360:t}function o(t){return t<0?0:t>1?1:t}function a(t){return n(t.length&&"%"===t.charAt(t.length-1)?parseFloat(t)/100*255:parseInt(t,10))}function s(t){return o(t.length&&"%"===t.charAt(t.length-1)?parseFloat(t)/100:parseFloat(t))}function l(t,e,i){return i<0?i+=1:i>1&&(i-=1),6*i<1?t+(e-t)*i*6:2*i<1?e:3*i<2?t+(e-t)*(2/3-i)*6:t}function u(t,e,i){return t+(e-t)*i}function h(t,e,i,n,r){return t[0]=e,t[1]=i,t[2]=n,t[3]=r,t}function c(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function d(t,e){A&&c(A,e),A=T.put(t,A||e.slice())}function f(t,e){if(t){e=e||[];var i=T.get(t);if(i)return c(e,i);t+="";var n=t.replace(/ /g,"").toLowerCase();if(n in S)return c(e,S[n]),d(t,e),e;if("#"!==n.charAt(0)){var r=n.indexOf("("),o=n.indexOf(")");if(r!==-1&&o+1===n.length){var l=n.substr(0,r),u=n.substr(r+1,o-(r+1)).split(","),f=1;switch(l){case"rgba":if(4!==u.length)return void h(e,0,0,0,1);f=s(u.pop());case"rgb":return 3!==u.length?void h(e,0,0,0,1):(h(e,a(u[0]),a(u[1]),a(u[2]),f),d(t,e),e);case"hsla":return 4!==u.length?void h(e,0,0,0,1):(u[3]=s(u[3]),p(u,e),d(t,e),e);case"hsl":return 3!==u.length?void h(e,0,0,0,1):(p(u,e),d(t,e),e);default:return}}h(e,0,0,0,1)}else{if(4===n.length){var g=parseInt(n.substr(1),16);return g>=0&&g<=4095?(h(e,(3840&g)>>4|(3840&g)>>8,240&g|(240&g)>>4,15&g|(15&g)<<4,1),d(t,e),e):void h(e,0,0,0,1)}if(7===n.length){var g=parseInt(n.substr(1),16);return g>=0&&g<=16777215?(h(e,(16711680&g)>>16,(65280&g)>>8,255&g,1),d(t,e),e):void h(e,0,0,0,1)}}}}function p(t,e){var i=(parseFloat(t[0])%360+360)%360/360,r=s(t[1]),o=s(t[2]),a=o<=.5?o*(r+1):o+r-o*r,u=2*o-a;return e=e||[],h(e,n(255*l(u,a,i+1/3)),n(255*l(u,a,i)),n(255*l(u,a,i-1/3)),1),4===t.length&&(e[3]=t[3]),e}function g(t){if(t){var e,i,n=t[0]/255,r=t[1]/255,o=t[2]/255,a=Math.min(n,r,o),s=Math.max(n,r,o),l=s-a,u=(s+a)/2;if(0===l)e=0,i=0;else{i=u<.5?l/(s+a):l/(2-s-a);var h=((s-n)/6+l/2)/l,c=((s-r)/6+l/2)/l,d=((s-o)/6+l/2)/l;n===s?e=d-c:r===s?e=1/3+h-d:o===s&&(e=2/3+c-h),e<0&&(e+=1),e>1&&(e-=1)}var f=[360*e,i,u];return null!=t[3]&&f.push(t[3]),f}}function m(t,e){var i=f(t);if(i){for(var n=0;n<3;n++)e<0?i[n]=i[n]*(1-e)|0:i[n]=(255-i[n])*e+i[n]|0;return w(i,4===i.length?"rgba":"rgb")}}function v(t,e){var i=f(t);if(i)return((1<<24)+(i[0]<<16)+(i[1]<<8)+ +i[2]).toString(16).slice(1)}function y(t,e,i){if(i=i||[0,0,0,0],!e||!e.length||!(t>=0&&t<=1))return i;var r=t*(e.length-1),o=Math.floor(r),a=Math.ceil(r),s=e[o],l=e[a],h=r-o;return i[0]=n(u(s[0],l[0],h)),i[1]=n(u(s[1],l[1],h)),i[2]=n(u(s[2],l[2],h)),i[3]=n(u(s[3],l[3],h)),i}function x(t,e,i){if(e&&e.length&&t>=0&&t<=1){var r=t*(e.length-1),a=Math.floor(r),s=Math.ceil(r),l=f(e[a]),h=f(e[s]),c=r-a,d=w([n(u(l[0],h[0],c)),n(u(l[1],h[1],c)),n(u(l[2],h[2],c)),o(u(l[3],h[3],c))],"rgba");return i?{color:d,leftIndex:a,rightIndex:s,value:r}:d}}function _(t,e,i,n){if(t=f(t))return t=g(t),null!=e&&(t[0]=r(e)),null!=i&&(t[1]=s(i)),null!=n&&(t[2]=s(n)),w(p(t),"rgba")}function b(t,e){if(t=f(t),t&&null!=e)return t[3]=o(e),w(t,"rgba")}function w(t,e){if(t){var i=t[0]+","+t[1]+","+t[2];return"rgba"!==e&&"hsva"!==e&&"hsla"!==e||(i+=","+t[3]),e+"("+i+")"}}var M=i(69),S={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1], +plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]},T=new M(20),A=null;t.exports={parse:f,lift:m,toHex:v,fastMapToColor:y,mapToColor:x,modifyHSL:_,modifyAlpha:b,stringify:w}},function(t,e){var i=Array.prototype.slice,n=function(){this._$handlers={}};n.prototype={constructor:n,one:function(t,e,i){var n=this._$handlers;if(!e||!t)return this;n[t]||(n[t]=[]);for(var r=0;r3&&(e=i.call(e,1));for(var r=this._$handlers[t],o=r.length,a=0;a4&&(e=i.call(e,1,e.length-1));for(var r=e[e.length-1],o=this._$handlers[t],a=o.length,s=0;s=0&&r(t)?function(t,e,i,n){return d.isDataItemOption(t)&&(x.hasItemOption=!0),n===y?i:g(p(t),v[n])}:function(t,e,i,n){var r=p(t),o=g(r&&r[n],v[n]);d.isDataItemOption(t)&&(x.hasItemOption=!0);var a=s&&s.categoryAxesModels;return a&&a[e]&&"string"==typeof o&&(b[e]=b[e]||a[e].getCategories(),o=c.indexOf(b[e],o),o<0&&!isNaN(o)&&(o=+o)),o};return x.hasItemOption=!1,x.initData(t,_,w),x}function a(t){return"category"!==t&&"time"!==t}function s(t){return"category"===t?"ordinal":"time"===t?"time":"float"}function l(t,e){var i,n=[],r=t&&t.dimensions[t.categoryIndex];if(r&&(i=t.categoryAxesModels[r.name]),i){var o=i.getCategories();if(o){var a=e.length;if(c.isArray(e[0])&&e[0].length>1){n=[];for(var s=0;sthis._ux||y(e-this._yi)>this._uy||this._len<5;return this.addData(l.L,t,e),this._ctx&&i&&(this._needsDash()?this._dashedLineTo(t,e):this._ctx.lineTo(t,e)),i&&(this._xi=t,this._yi=e),this},bezierCurveTo:function(t,e,i,n,r,o){return this.addData(l.C,t,e,i,n,r,o),this._ctx&&(this._needsDash()?this._dashedBezierTo(t,e,i,n,r,o):this._ctx.bezierCurveTo(t,e,i,n,r,o)),this._xi=r,this._yi=o,this},quadraticCurveTo:function(t,e,i,n){return this.addData(l.Q,t,e,i,n),this._ctx&&(this._needsDash()?this._dashedQuadraticTo(t,e,i,n):this._ctx.quadraticCurveTo(t,e,i,n)),this._xi=i,this._yi=n,this},arc:function(t,e,i,n,r,o){return this.addData(l.A,t,e,i,i,n,r-n,0,o?0:1),this._ctx&&this._ctx.arc(t,e,i,n,r,o),this._xi=g(r)*i+t,this._yi=m(r)*i+t,this},arcTo:function(t,e,i,n,r){return this._ctx&&this._ctx.arcTo(t,e,i,n,r),this},rect:function(t,e,i,n){return this._ctx&&this._ctx.rect(t,e,i,n),this.addData(l.R,t,e,i,n),this},closePath:function(){this.addData(l.Z);var t=this._ctx,e=this._x0,i=this._y0;return t&&(this._needsDash()&&this._dashedLineTo(e,i),t.closePath()),this._xi=e,this._yi=i,this},fill:function(t){t&&t.fill(),this.toStatic()},stroke:function(t){t&&t.stroke(),this.toStatic()},setLineDash:function(t){if(t instanceof Array){this._lineDash=t,this._dashIdx=0;for(var e=0,i=0;ie.length&&(this._expandData(),e=this.data);for(var i=0;i0&&g<=t||h<0&&g>=t||0==h&&(c>0&&m<=e||c<0&&m>=e);)n=this._dashIdx,i=a[n],g+=h*i,m+=c*i,this._dashIdx=(n+1)%y,h>0&&gl||c>0&&mu||s[n%2?"moveTo":"lineTo"](h>=0?f(g,t):p(g,t),c>=0?f(m,e):p(m,e));h=g-t,c=m-e,this._dashOffset=-v(h*h+c*c)},_dashedBezierTo:function(t,e,i,r,o,a){var s,l,u,h,c,d=this._dashSum,f=this._dashOffset,p=this._lineDash,g=this._ctx,m=this._xi,y=this._yi,x=n.cubicAt,_=0,b=this._dashIdx,w=p.length,M=0;for(f<0&&(f=d+f),f%=d,s=0;s<1;s+=.1)l=x(m,t,i,o,s+.1)-x(m,t,i,o,s),u=x(y,e,r,a,s+.1)-x(y,e,r,a,s),_+=v(l*l+u*u);for(;bf));b++);for(s=(M-f)/_;s<=1;)h=x(m,t,i,o,s),c=x(y,e,r,a,s),b%2?g.moveTo(h,c):g.lineTo(h,c),s+=p[b]/_,b=(b+1)%w;b%2!==0&&g.lineTo(o,a),l=o-h,u=a-c,this._dashOffset=-v(l*l+u*u)},_dashedQuadraticTo:function(t,e,i,n){var r=i,o=n;i=(i+2*t)/3,n=(n+2*e)/3,t=(this._xi+2*t)/3,e=(this._yi+2*e)/3,this._dashedBezierTo(t,e,i,n,r,o)},toStatic:function(){var t=this.data;t instanceof Array&&(t.length=this._len,x&&(this.data=new Float32Array(t)))},getBoundingRect:function(){u[0]=u[1]=c[0]=c[1]=Number.MAX_VALUE,h[0]=h[1]=d[0]=d[1]=-Number.MAX_VALUE;for(var t=this.data,e=0,i=0,n=0,s=0,f=0;fu||y(a-r)>h||d===c-1)&&(t.lineTo(o,a),n=o,r=a);break;case l.C:t.bezierCurveTo(s[d++],s[d++],s[d++],s[d++],s[d++],s[d++]),n=s[d-2],r=s[d-1];break;case l.Q:t.quadraticCurveTo(s[d++],s[d++],s[d++],s[d++]),n=s[d-2],r=s[d-1];break;case l.A:var p=s[d++],v=s[d++],x=s[d++],_=s[d++],b=s[d++],w=s[d++],M=s[d++],S=s[d++],T=x>_?x:_,A=x>_?1:x/_,I=x>_?_/x:1,C=Math.abs(x-_)>.001,P=b+w;C?(t.translate(p,v),t.rotate(M),t.scale(A,I),t.arc(0,0,T,b,P,1-S),t.scale(1/A,1/I),t.rotate(-M),t.translate(-p,-v)):t.arc(p,v,T,b,P,1-S),1==d&&(e=g(b)*x+p,i=m(b)*_+v),n=g(P)*x+p,r=m(P)*_+v;break;case l.R:e=n=s[d],i=r=s[d+1],t.rect(s[d++],s[d++],s[d++],s[d++]);break;case l.Z:t.closePath(),n=e,r=i}}}},_.CMD=l,t.exports=_},function(t,e,i){var n=i(1);t.exports=function(t){for(var e=0;e=0||i&&n.indexOf(i,a)<0)){var s=this.getShallow(a);null!=s&&(r[t[o][0]]=s)}}return r}}},function(t,e,i){function n(t,e,i){var n=e.getComponent("tooltip"),o=e.getComponent("axisPointer"),s=o.get("link",!0)||[],u=[];c(i.getCoordinateSystems(),function(i){function h(n,h,c){var d=c.model.getModel("axisPointer",o),f=d.get("show");if(f&&("auto"!==f||n||l(d))){null==h&&(h=d.get("triggerTooltip")),d=n?r(c,v,o,e,n,h):d;var m=d.get("snap"),y=p(c.model),x=h||m||"category"===c.type,_=t.axesInfo[y]={key:y,axis:c,coordSys:i,axisPointerModel:d,triggerTooltip:h,involveSeries:x,snap:m,useHandle:l(d),seriesModels:[]};g[y]=_,t.seriesInvolved|=x;var b=a(s,c);if(null!=b){var w=u[b]||(u[b]={axesInfo:{}});w.axesInfo[y]=_,w.mapper=s[b].mapper,_.linkGroup=w}}}if(i.axisPointerEnabled){var f=p(i.model),g=t.coordSysAxesInfo[f]={};t.coordSysMap[f]=i;var m=i.model,v=m.getModel("tooltip",n);if(c(i.getAxes(),d(h,!1,null)),i.getTooltipAxes&&n&&v.get("show")){var y="axis"===v.get("trigger"),x="cross"===v.get("axisPointer.type"),_=i.getTooltipAxes(v.get("axisPointer.axis"));(y||x)&&c(_.baseAxes,d(h,!x||"cross",y)),x&&c(_.otherAxes,d(h,"cross",!1))}}})}function r(t,e,i,n,r,o){var a=e.getModel("axisPointer"),s={};c(["type","snap","lineStyle","shadowStyle","label","animation","animationDurationUpdate","animationEasingUpdate","z"],function(t){s[t]=u.clone(a.get(t))}),s.snap="category"!==t.type&&!!o,"cross"===a.get("type")&&(s.type="line");var l=s.label||(s.label={});if(null==l.show&&(l.show=!1),"cross"===r&&(l.show=!0,!o)){var d=s.lineStyle=a.get("crossStyle");d&&u.defaults(l.textStyle||(l.textStyle={}),d.textStyle)}return t.model.getModel("axisPointer",new h(s,i,n))}function o(t,e){e.eachSeries(function(e){var i=e.coordinateSystem,n=e.get("tooltip.trigger",!0);i&&"none"!==n&&n!==!1&&"item"!==n&&e.get("axisPointer.show",!0)!==!1&&c(t.coordSysAxesInfo[p(i.model)],function(t){var n=t.axis;i.getAxis(n.dim)===n&&(t.seriesModels.push(e),null==t.seriesDataCount&&(t.seriesDataCount=0),t.seriesDataCount+=e.getData().count())})},this)}function a(t,e){for(var i=e.model,n=e.dim,r=0;r=0||t===e}function l(t){return!!t.get("handle.show")}var u=i(1),h=i(10),c=u.each,d=u.curry,f={};f.collect=function(t,e){var i={axesInfo:{},seriesInvolved:!1,coordSysAxesInfo:{},coordSysMap:{}};return n(i,t,e),i.seriesInvolved&&o(i,t),i},f.fixValue=function(t){var e=f.getAxisInfo(t);if(e){var i=e.axisPointerModel,n=e.axis.scale,r=i.option,o=i.get("status"),a=i.get("value");null!=a&&(a=n.parse(a));var s=l(i);null==o&&(r.status=s?"show":"hide");var u=n.getExtent().slice();u[0]>u[1]&&u.reverse(),(null==a||a>u[1])&&(a=u[1]),a=i&&t<=n},containData:function(t){return this.contain(this.dataToCoord(t))},getExtent:function(){var t=this._extent.slice();return t},getPixelPrecision:function(t){return r.getPixelPrecision(t||this.scale.getExtent(),this._extent)},setExtent:function(t,e){var i=this._extent;i[0]=t,i[1]=e},dataToCoord:function(t,e){var i=this._extent,r=this.scale;return t=r.normalize(t),this.onBand&&"ordinal"===r.type&&(i=i.slice(),n(i,r.count())),o(t,s,i,e)},coordToData:function(t,e){var i=this._extent,r=this.scale;this.onBand&&"ordinal"===r.type&&(i=i.slice(),n(i,r.count()));var a=o(t,i,s,e);return this.scale.scale(a)},pointToData:function(t,e){},getTicksCoords:function(t){if(this.onBand&&!t){for(var e=this.getBands(),i=[],n=0;n=e[0]&&t<=e[1]},o.normalize=function(t){var e=this._extent;return e[1]===e[0]?.5:(t-e[0])/(e[1]-e[0])},o.scale=function(t){var e=this._extent;return t*(e[1]-e[0])+e[0]},o.unionExtent=function(t){var e=this._extent;t[0]e[1]&&(e[1]=t[1])},o.unionExtentFromData=function(t,e){this.unionExtent(t.getDataExtent(e,!0))},o.getExtent=function(){return this._extent.slice()},o.setExtent=function(t,e){var i=this._extent;isNaN(t)||(i[0]=t),isNaN(e)||(i[1]=e)},o.getTicksLabels=function(){for(var t=[],e=this.getTicks(),i=0;i=0&&(i.splice(n,0,t),this._doAdd(t))}return this},_doAdd:function(t){t.parent&&t.parent.remove(t),t.parent=this;var e=this.__storage,i=this.__zr;e&&e!==t.__storage&&(e.addToMap(t),t instanceof a&&t.addChildrenToStorage(e)),i&&i.refresh()},remove:function(t){var e=this.__zr,i=this.__storage,r=this._children,o=n.indexOf(r,t);return o<0?this:(r.splice(o,1),t.parent=null,i&&(i.delFromMap(t.id),t instanceof a&&t.delChildrenFromStorage(i)),e&&e.refresh(),this)},removeAll:function(){var t,e,i=this._children,n=this.__storage;for(e=0;en[1],l="start"===e&&!s||"start"!==e&&s;return d(a-m/2)?(o=l?"bottom":"top",r="center"):d(a-1.5*m)?(o=l?"top":"bottom",r="center"):(o="middle",r=a<1.5*m&&a>m/2?l?"left":"right":l?"right":"left"),{rotation:a,textAlign:r,textVerticalAlign:o}}function o(t){var e=t.get("tooltip");return t.get("silent")||!(t.get("triggerEvent")||e&&e.show)}var a=i(1),s=i(7),l=i(3),u=i(10),h=i(4),c=h.remRadian,d=h.isRadianAroundZero,f=i(6),p=f.applyTransform,g=a.retrieve,m=Math.PI,v=function(t,e){this.opt=e,this.axisModel=t,a.defaults(e,{labelOffset:0,nameDirection:1,tickDirection:1,labelDirection:1,silent:!0}),this.group=new l.Group;var i=new l.Group({position:e.position.slice(),rotation:e.rotation});i.updateTransform(),this._transform=i.transform,this._dumbGroup=i};v.prototype={constructor:v,hasBuilder:function(t){return!!y[t]},add:function(t){y[t].call(this)},getGroup:function(){return this.group}};var y={axisLine:function(){var t=this.opt,e=this.axisModel;if(e.get("axisLine.show")){var i=this.axisModel.axis.getExtent(),n=this._transform,r=[i[0],0],o=[i[1],0];n&&(p(r,r,n),p(o,o,n)),this.group.add(new l.Line(l.subPixelOptimizeLine({anid:"line",shape:{x1:r[0],y1:r[1],x2:o[0],y2:o[1]},style:a.extend({lineCap:"round"},e.getModel("axisLine.lineStyle").getLineStyle()),strokeContainThreshold:t.strokeContainThreshold||5,silent:!0,z2:1})))}},axisTick:function(){var t=this.axisModel,e=t.axis;if(t.get("axisTick.show")&&!e.scale.isBlank())for(var i=t.getModel("axisTick"),n=this.opt,r=i.getModel("lineStyle"),o=i.get("length"),s=b(i,n.labelInterval),u=e.getTicksCoords(i.get("alignWithLabel")),h=e.scale.getTicks(),c=[],d=[],f=this._transform,g=0;gp[1]?-1:1,y=["start"===h?p[0]-v*f:"end"===h?p[1]+v*f:(p[0]+p[1])/2,"middle"===h?t.labelOffset+c*f:0],_=e.get("nameRotate");null!=_&&(_=_*m/180);var b;"middle"===h?u=x(t.rotation,null!=_?_:t.rotation,c):(u=r(t,h,_||0,p),b=t.axisNameAvailableWidth,null!=b&&(b=Math.abs(b/Math.sin(u.rotation)),!isFinite(b)&&(b=null)));var w=d.getFont(),M=e.get("nameTruncate",!0)||{},S=M.ellipsis,T=g(M.maxWidth,b),A=null!=S&&null!=T?s.truncateText(i,T,w,S,{minChar:2,placeholder:M.placeholder}):i,I=e.get("tooltip",!0),C=e.mainType,P={componentType:C,name:i,$vars:["name"]};P[C+"Index"]=e.componentIndex;var k=new l.Text({anid:"name",__fullText:i,__truncatedText:A,style:{text:A,textFont:w,fill:d.getTextColor()||e.get("axisLine.lineStyle.color"),textAlign:u.textAlign,textVerticalAlign:u.textVerticalAlign},position:y,rotation:u.rotation,silent:o(e),z2:1,tooltip:I&&I.show?a.extend({content:i,formatter:function(){return i},formatterParams:P},I):null});e.get("triggerEvent")&&(k.eventData=n(e),k.eventData.targetType="axisName",k.eventData.name=i),this._dumbGroup.add(k),k.updateTransform(),this.group.add(k),k.decomposeTransform()}}},x=v.innerTextLayout=function(t,e,i){var n,r,o=c(e-t);return d(o)?(r=i>0?"top":"bottom",n="center"):d(o-m)?(r=i>0?"bottom":"top",n="center"):(r="middle",n=o>0&&o0?"right":"left":i>0?"left":"right"),{rotation:o,textAlign:n,textVerticalAlign:r}},_=v.ifIgnoreOnTick=function(t,e,i){var n,r=t.scale;return"ordinal"===r.type&&("function"==typeof i?(n=r.getTicks()[e],!i(n,r.getLabel(n))):e%(i+1))},b=v.getInterval=function(t,e){var i=t.get("interval");return null!=i&&"auto"!=i||(i=e),i};t.exports=v},function(t,e,i){i(93),i(45)},function(t,e){var i={},n="\0__throttleOriginMethod",r="\0__throttleRate",o="\0__throttleType";i.throttle=function(t,e,i){function n(){u=(new Date).getTime(),h=null,t.apply(a,s||[])}var r,o,a,s,l=0,u=0,h=null;e=e||0;var c=function(){r=(new Date).getTime(),a=this,s=arguments,o=r-(i?l:u)-e,clearTimeout(h),i?h=setTimeout(n,e):o>=0?n():h=setTimeout(n,-o),l=r};return c.clear=function(){h&&(clearTimeout(h),h=null)},c},i.createOrUpdate=function(t,e,a,s){var l=t[e];if(l){var u=l[n]||l,h=l[o],c=l[r];if(c!==a||h!==s){if(null==a||!s)return t[e]=u;l=t[e]=i.throttle(u,a,"debounce"===s),l[n]=u,l[o]=s,l[r]=a}return l}},i.clear=function(t,e){var i=t[e];i&&i[n]&&(t[e]=i[n])},t.exports=i},function(t,e,i){function n(t){t=t||{},a.call(this,t);for(var e in t)t.hasOwnProperty(e)&&"style"!==e&&(this[e]=t[e]);this.style=new o(t.style),this._rect=null,this.__clipPaths=[]}var r=i(1),o=i(72),a=i(65),s=i(86);n.prototype={constructor:n,type:"displayable",__dirty:!0,invisible:!1,z:0,z2:0,zlevel:0,draggable:!1,dragging:!1,silent:!1,culling:!1,cursor:"pointer",rectHover:!1,progressive:-1,beforeBrush:function(t){},afterBrush:function(t){},brush:function(t,e){},getBoundingRect:function(){},contain:function(t,e){return this.rectContain(t,e)},traverse:function(t,e){t.call(e,this)},rectContain:function(t,e){var i=this.transformCoordToLocal(t,e),n=this.getBoundingRect();return n.contain(i[0],i[1])},dirty:function(){this.__dirty=!0,this._rect=null,this.__zr&&this.__zr.refresh()},animateStyle:function(t){return this.animate("style",t)},attrKV:function(t,e){"style"!==t?a.prototype.attrKV.call(this,t,e):this.style.set(e)},setStyle:function(t,e){return this.style.set(t,e),this.dirty(!1),this},useStyle:function(t){return this.style=new o(t),this.dirty(!1),this}},r.inherits(n,a),r.mixin(n,s),t.exports=n},function(t,e){var i=function(t){this.colorStops=t||[]};i.prototype={constructor:i,addColorStop:function(t,e){this.colorStops.push({offset:t,color:e})}},t.exports=i},function(t,e,i){function n(t){return r.isObject(t)&&null!=t.value?t.value:t}var r=i(1),o=i(17);t.exports={getFormattedLabels:function(){ +return o.getFormattedLabels(this.axis,this.get("axisLabel.formatter"))},getCategories:function(){return"category"===this.get("type")&&r.map(this.get("data"),n)},getMin:function(t){var e=this.option,i=t||null==e.rangeStart?e.min:e.rangeStart;return this.axis&&null!=i&&"dataMin"!==i&&!r.eqNaN(i)&&(i=this.axis.scale.parse(i)),i},getMax:function(t){var e=this.option,i=t||null==e.rangeEnd?e.max:e.rangeEnd;return this.axis&&null!=i&&"dataMax"!==i&&!r.eqNaN(i)&&(i=this.axis.scale.parse(i)),i},getNeedCrossZero:function(){var t=this.option;return null==t.rangeStart&&null==t.rangeEnd&&!t.scale},getCoordSysModel:r.noop,setRange:function(t,e){this.option.rangeStart=t,this.option.rangeEnd=e},resetRange:function(){this.option.rangeStart=this.option.rangeEnd=null}}},function(t,e,i){var n=i(4),r=i(7),o=i(34),a=Math.floor,s=Math.ceil,l=n.getPrecisionSafe,u=n.round,h=o.extend({type:"interval",_interval:0,_intervalPrecision:2,setExtent:function(t,e){var i=this._extent;isNaN(t)||(i[0]=parseFloat(t)),isNaN(e)||(i[1]=parseFloat(e))},unionExtent:function(t){var e=this._extent;t[0]e[1]&&(e[1]=t[1]),h.prototype.setExtent.call(this,e[0],e[1])},getInterval:function(){return this._interval||this.niceTicks(),this._interval},setInterval:function(t){this._interval=t,this._niceExtent=this._extent.slice()},getTicks:function(){this._interval||this.niceTicks();var t=this._interval,e=this._extent,i=[],n=1e4;if(t){var r=this._niceExtent,o=this._intervalPrecision=l(t);o+=2,e[0]n)return[];e[1]>(i.length?i[i.length-1]:r[1])&&i.push(e[1])}return i},getTicksLabels:function(){for(var t=[],e=this.getTicks(),i=0;i0?100:20}},getFirstTargetAxisModel:function(){var t;return d(function(e){if(null==t){var i=this.get(e.axisIndex);i.length&&(t=this.dependentModels[e.axis][i[0]])}},this),t},eachTargetAxis:function(t,e){var i=this.ecModel;d(function(n){c(this.get(n.axisIndex),function(r){t.call(e,n,r,this,i)},this)},this)},getAxisProxy:function(t,e){return this._axisProxies[t+"_"+e]},getAxisModel:function(t,e){var i=this.getAxisProxy(t,e);return i&&i.getAxisModel()},setRawRange:function(t,e){c(["start","end","startValue","endValue"],function(e){this.option[e]=t[e]},this),!e&&r(this,t)},getPercentRange:function(){var t=this.findRepresentativeAxisProxy();if(t)return t.getDataPercentWindow()},getValueRange:function(t,e){if(null!=t||null!=e)return this.getAxisProxy(t,e).getDataValueWindow();var i=this.findRepresentativeAxisProxy();return i?i.getDataValueWindow():void 0},findRepresentativeAxisProxy:function(){var t=this._axisProxies;for(var e in t)if(t.hasOwnProperty(e)&&t[e].hostedBy(this))return t[e];for(var e in t)if(t.hasOwnProperty(e)&&!t[e].hostedBy(this))return t[e]},getRangePropMode:function(){return this._rangePropMode.slice()}});t.exports=f},function(t,e,i){var n=i(64);t.exports=n.extend({type:"dataZoom",render:function(t,e,i,n){this.dataZoomModel=t,this.ecModel=e,this.api=i},getTargetCoordInfo:function(){function t(t,e,i,n){for(var r,o=0;o=0&&i.push(t)}),i}t.topologicalTravel=function(t,e,r,o){function a(t){u[t].entryCount--,0===u[t].entryCount&&h.push(t)}function s(t){c[t]=!0,a(t)}if(t.length){var l=i(e),u=l.graph,h=l.noEntryList,c={};for(n.each(t,function(t){c[t]=!0});h.length;){var d=h.pop(),f=u[d],p=!!c[d];p&&(r.call(o,d,f.originalDeps.slice()),delete c[d]),n.each(f.successor,p?s:a)}n.each(c,function(){throw new Error("Circle dependency may exists")})}}},t.exports=s},function(t,e){t.exports=function(t,e,i,n,r){n.eachRawSeriesByType(t,function(t){var r=t.getData(),o=t.get("symbol")||e,a=t.get("symbolSize");r.setVisual({legendSymbol:i||o,symbol:o,symbolSize:a}),n.isSeriesFiltered(t)||("function"==typeof a&&r.each(function(e){var i=t.getRawValue(e),n=t.getDataParams(e);r.setItemVisual(e,"symbolSize",a(i,n))}),r.each(function(t){var e=r.getItemModel(t),i=e.getShallow("symbol",!0),n=e.getShallow("symbolSize",!0);null!=i&&r.setItemVisual(t,"symbol",i),null!=n&&r.setItemVisual(t,"symbolSize",n)}))})}},function(t,e){function i(t){for(var e=0;t>=h;)e|=1&t,t>>=1;return t+e}function n(t,e,i,n){var o=e+1;if(o===i)return 1;if(n(t[o++],t[e])<0){for(;o=0;)o++;return o-e}function r(t,e,i){for(i--;e>>1,r(a,t[o])<0?l=o:s=o+1;var u=n-s;switch(u){case 3:t[s+3]=t[s+2];case 2:t[s+2]=t[s+1];case 1:t[s+1]=t[s];break;default:for(;u>0;)t[s+u]=t[s+u-1],u--}t[s]=a}}function a(t,e,i,n,r,o){var a=0,s=0,l=1;if(o(t,e[i+r])>0){for(s=n-r;l0;)a=l,l=(l<<1)+1,l<=0&&(l=s);l>s&&(l=s),a+=r,l+=r}else{for(s=r+1;ls&&(l=s);var u=a;a=r-l,l=r-u}for(a++;a>>1);o(t,e[i+h])>0?a=h+1:l=h}return l}function s(t,e,i,n,r,o){var a=0,s=0,l=1;if(o(t,e[i+r])<0){for(s=r+1;ls&&(l=s);var u=a;a=r-l,l=r-u}else{for(s=n-r;l=0;)a=l,l=(l<<1)+1,l<=0&&(l=s);l>s&&(l=s),a+=r,l+=r}for(a++;a>>1);o(t,e[i+h])<0?l=h:a=h+1}return l}function l(t,e){function i(t,e){h[y]=t,f[y]=e,y+=1}function n(){for(;y>1;){var t=y-2;if(t>=1&&f[t-1]<=f[t]+f[t+1]||t>=2&&f[t-2]<=f[t]+f[t-1])f[t-1]f[t+1])break;o(t)}}function r(){for(;y>1;){var t=y-2;t>0&&f[t-1]=c||g>=c);if(m)break;v<0&&(v=0),v+=2}if(p=v,p<1&&(p=1),1===n){for(l=0;l=0;l--)t[g+l]=t[f+l];return void(t[d]=x[h])}for(var m=p;;){var v=0,y=0,_=!1;do if(e(x[h],t[u])<0){if(t[d--]=t[u--],v++,y=0,0===--n){_=!0;break}}else if(t[d--]=x[h--],y++,v=0,1===--o){_=!0;break}while((v|y)=0;l--)t[g+l]=t[f+l];if(0===n){_=!0;break}}if(t[d--]=x[h--],1===--o){_=!0;break}if(y=o-a(t[u],x,0,o,o-1,e),0!==y){for(d-=y,h-=y,o-=y,g=d+1,f=h+1,l=0;l=c||y>=c);if(_)break;m<0&&(m=0),m+=2}if(p=m,p<1&&(p=1),1===o){for(d-=n,u-=n,g=d+1,f=u+1,l=n-1;l>=0;l--)t[g+l]=t[f+l];t[d]=x[h]}else{if(0===o)throw new Error;for(f=d-(o-1),l=0;l>>1);var x=[];v=g<120?5:g<1542?10:g<119151?19:40,h=[],f=[],this.mergeRuns=n,this.forceMergeRuns=r,this.pushRun=i}function u(t,e,r,a){r||(r=0),a||(a=t.length);var s=a-r;if(!(s<2)){var u=0;if(sd&&(f=d),o(t,r,r+f,r+u,e),u=f}c.pushRun(r,u),c.mergeRuns(),s-=u,r+=u}while(0!==s);c.forceMergeRuns()}}var h=32,c=7,d=256;t.exports=u},function(t,e,i){var n=i(35);t.exports=function(){if(0!==n.debugMode)if(1==n.debugMode)for(var t in arguments)throw new Error(arguments[t]);else if(n.debugMode>1)for(var t in arguments)console.log(arguments[t])}},function(t,e,i){function n(t){r.call(this,t)}var r=i(40),o=i(11),a=i(1),s=i(69),l=new s(50);n.prototype={constructor:n,type:"image",brush:function(t,e){var i,n=this.style,r=n.image;if(n.bind(t,this,e),i="string"==typeof r?this._image:r,!i&&r){var o=l.get(r);if(!o)return i=new Image,i.onload=function(){i.onload=null;for(var t=0;t40&&(o=Math.ceil(a/40));for(var s=0;s.5?e:t}function s(t,e,i,n,r){var a=t.length;if(1==r)for(var s=0;sr;if(o)t.length=r;else for(var a=n;a=0&&!(A[i]<=e);i--);i=Math.min(i,x-2)}else{for(i=F;ie);i++);i=Math.min(i-1,x-2)}F=i,G=e;var n=A[i+1]-A[i];if(0!==n)if(E=(e-A[i])/n,v)if(R=I[i],N=I[0===i?i:i-1],B=I[i>x-2?x-1:i+1],V=I[i>x-3?x-1:i+2],w)h(N,R,B,V,E,E*E,E*E*E,d(t,r),T);else{var l;if(M)l=h(N,R,B,V,E,E*E,E*E*E,H,1),l=f(H);else{if(S)return a(R,B,E);l=c(N,R,B,V,E,E*E,E*E*E)}p(t,r,l)}else if(w)s(I[i],I[i+1],E,d(t,r),T);else{var l;if(M)s(I[i],I[i+1],E,H,1),l=f(H);else{if(S)return a(I[i],I[i+1],E);l=o(I[i],I[i+1],E)}p(t,r,l)}},Z=new g({target:t._target,life:_,loop:t._loop,delay:t._delay,onframe:W,ondestroy:i});return e&&"spline"!==e&&(Z.easing=e),Z}}}var g=i(159),m=i(22),v=i(1),y=v.isArrayLike,x=Array.prototype.slice,_=function(t,e,i,o){this._tracks={},this._target=t,this._loop=e||!1,this._getter=i||n,this._setter=o||r,this._clipCount=0,this._delay=0,this._doneList=[],this._onframeList=[],this._clipList=[]};_.prototype={when:function(t,e){var i=this._tracks;for(var n in e)if(e.hasOwnProperty(n)){if(!i[n]){i[n]=[];var r=this._getter(this._target,n);if(null==r)continue;0!==t&&i[n].push({time:0,value:d(r)})}i[n].push({time:t,value:e[n]})}return this},during:function(t){return this._onframeList.push(t),this},pause:function(){for(var t=0;t=this._maxSize&&a>0){var l=i.head;i.remove(l),delete n[l.key],o=l.value,this._lastRemovedEntry=l}s?s.value=e:s=new r(e),s.key=t,i.insertEntry(s),n[t]=s}return o},a.get=function(t){var e=this._map[t],i=this._list;if(null!=e)return e!==i.tail&&(i.remove(e),i.insertEntry(e)),e.value},a.clear=function(){this._list.clear(),this._map={}},t.exports=o},function(t,e){var i=2311;t.exports=function(){return i++}},function(t,e){var i=function(t,e){this.image=t,this.repeat=e,this.type="pattern"};i.prototype.getCanvasPattern=function(t){return this._canvasPattern||(this._canvasPattern=t.createPattern(this.image,this.repeat))},t.exports=i},function(t,e){function i(t,e,i){var n=e.x,r=e.x2,o=e.y,a=e.y2;e.global||(n=n*i.width+i.x,r=r*i.width+i.x,o=o*i.height+i.y,a=a*i.height+i.y);var s=t.createLinearGradient(n,o,r,a);return s}function n(t,e,i){var n=i.width,r=i.height,o=Math.min(n,r),a=e.x,s=e.y,l=e.r;e.global||(a=a*n+i.x,s=s*r+i.y,l*=o);var u=t.createRadialGradient(a,s,0,a,s,l);return u}var r=[["shadowBlur",0],["shadowOffsetX",0],["shadowOffsetY",0],["shadowColor","#000"],["lineCap","butt"],["lineJoin","miter"],["miterLimit",10]],o=function(t){this.extendFrom(t)};o.prototype={constructor:o,fill:"#000000",stroke:null,opacity:1,lineDash:null,lineDashOffset:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,lineWidth:1,strokeNoScale:!1,text:null,textFill:"#000",textStroke:null,textPosition:"inside",textOffset:null,textBaseline:null,textAlign:null,textVerticalAlign:null,textDistance:5,textShadowBlur:0,textShadowOffsetX:0,textShadowOffsetY:0,textTransform:!1,textRotation:0,blend:null,bind:function(t,e,i){for(var n=this,o=i&&i.style,a=!o,s=0;s0},extendFrom:function(t,e){if(t){var i=this;for(var n in t)!t.hasOwnProperty(n)||!e&&i.hasOwnProperty(n)||(i[n]=t[n])}},set:function(t,e){"string"==typeof t?this[t]=e:this.extendFrom(t,!0)},clone:function(){var t=new this.constructor;return t.extendFrom(this,!0),t},getGradient:function(t,e,r){for(var o="radial"===e.type?n:i,a=o(t,e,r),s=e.colorStops,l=0;l=2){if(a&&"spline"!==a){var s=r(o,a,i,e.smoothConstraint);t.moveTo(o[0][0],o[0][1]);for(var l=o.length,u=0;u<(i?l:l-1);u++){var h=s[2*u],c=s[2*u+1],d=o[(u+1)%l];t.bezierCurveTo(h[0],h[1],c[0],c[1],d[0],d[1])}}else{"spline"===a&&(o=n(o,i)),t.moveTo(o[0][0],o[0][1]);for(var u=1,f=o.length;ua)return!0;if(o){var s=p.getAxisInfo(t).seriesDataCount,l=n.getExtent();return Math.abs(l[0]-l[1])/s>a}return!1}return i===!0},makeElOption:function(t,e,i,n,r){},createPointerEl:function(t,e,i,n){var r=e.pointer,o=f(t).pointerEl=new d[r.type](v(e.pointer));t.add(o)},createLabelEl:function(t,e,i,n){var r=f(t).labelEl=new d.Rect(v(e.label));t.add(r),a(r,n)},updatePointerEl:function(t,e,i){var n=f(t).pointerEl;n&&(n.setStyle(e.pointer.style),i(n,{shape:e.pointer.shape}))},updateLabelEl:function(t,e,i,n){var r=f(t).labelEl;r&&(r.setStyle(e.label.style),i(r,{shape:e.label.shape,position:e.label.position}),a(r,n))},_renderHandle:function(t){if(!this._dragging&&this.updateHandleTransform){var e=this._axisPointerModel,i=this._api.getZr(),n=this._handle,r=e.getModel("handle"),o=e.get("status");if(!r.get("show")||!o||"hide"===o)return n&&i.remove(n),void(this._handle=null);var a;this._handle||(a=!0,n=this._handle=l(r,{onmousemove:function(t){g.stop(t.event)},onmousedown:y(this._onHandleDragMove,this,0,0),drift:y(this._onHandleDragMove,this),ondragend:y(this._onHandleDragEnd,this)}),i.add(n)),u(n,e,!1);var s=["color","borderColor","borderWidth","opacity","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY"];n.setStyle(r.getItemStyle(null,s));var c=r.get("size");h.isArray(c)||(c=[c,c]),n.attr("scale",[c[0]/2,c[1]/2]),m.createOrUpdate(this,"_doDispatchAxisPointer",r.get("throttle")||0,"fixRate"),this._moveHandleToValue(t,a)}},_moveHandleToValue:function(t,e){r(this._axisPointerModel,!e&&this._moveAnimation,this._handle,s(this.getHandleTransform(t,this._axisModel,this._axisPointerModel)))},_onHandleDragMove:function(t,e){var i=this._handle;if(i){this._dragging=!0;var n=this.updateHandleTransform(s(i),[t,e],this._axisModel,this._axisPointerModel);this._payloadInfo=n,i.stopAnimation(),i.attr(s(n)),f(i).lastProp=null,this._doDispatchAxisPointer()}},_doDispatchAxisPointer:function(){var t=this._handle;if(t){var e=this._payloadInfo,i={type:"updateAxisPointer",x:e.cursorPoint[0],y:e.cursorPoint[1],tooltipOption:e.tooltipOption,highDownKey:"axisPointerHandle"},n=this._axisModel.axis;i[n.dim+"AxisId"]=this._axisModel.id,this._api.dispatchAction(i)}},_onHandleDragEnd:function(t){this._dragging=!1;var e=this._handle;if(e){var i=this._axisPointerModel.get("value");this._moveHandleToValue(i),this._api.dispatchAction({type:"hideTip"})}},getHandleTransform:null,updateHandleTransform:null,clear:function(t){this._lastValue=null,this._lastStatus=null;var e=t.getZr(),i=this._group,n=this._handle;e&&i&&(this._lastGraphicKey=null,i&&e.remove(i),n&&e.remove(n),this._group=null,this._handle=null,this._payloadInfo=null)},doClear:function(){},buildLabel:function(t,e,i){return i=i||0,{x:t[i],y:t[1-i],width:e[i],height:e[1-i]}}},n.prototype.constructor=n,c.enableClassExtend(n),t.exports=n},function(t,e,i){var n=i(1),r=i(5);t.exports=function(t,e){var i,o=[],a=t.seriesIndex;if(null==a||!(i=e.getSeriesByIndex(a)))return{point:[]};var s=i.getData(),l=r.queryDataIndex(s,t);if(null==l||n.isArray(l))return{point:[]};var u=s.getItemGraphicEl(l),h=i.coordinateSystem;if(i.getTooltipPosition)o=i.getTooltipPosition(l)||[];else if(h&&h.dataToPoint)o=h.dataToPoint(s.getValues(n.map(h.dimensions,function(t){return i.coordDimToDataDim(t)[0]}),l,!0))||[];else if(u){var c=u.getBoundingRect().clone();c.applyTransform(u.transform),o=[c.x+c.width/2,c.y+c.height/2]}return{point:o,el:u}}},function(t,e,i){function n(t,e){function i(i,n){t.on(i,function(i){var o=s(e);c(h(t).records,function(t){t&&n(t,i,o.dispatchAction)}),r(o.pendings,e)})}h(t).initialized||(h(t).initialized=!0,i("click",u.curry(a,"click")),i("mousemove",u.curry(a,"mousemove")),i("globalout",o))}function r(t,e){var i,n=t.showTip.length,r=t.hideTip.length;n?i=t.showTip[n-1]:r&&(i=t.hideTip[r-1]),i&&(i.dispatchAction=null,e.dispatchAction(i))}function o(t,e,i){t.handler("leave",null,i)}function a(t,e,i,n){e.handler(t,i,n)}function s(t){var e={showTip:[],hideTip:[]},i=function(n){var r=e[n.type];r?r.push(n):(n.dispatchAction=i,t.dispatchAction(n))};return{dispatchAction:i,pendings:e}}var l=i(9),u=i(1),h=i(5).makeGetter(),c=u.each,d={};d.register=function(t,e,i){if(!l.node){var r=e.getZr();h(r).records||(h(r).records={}),n(r,e);var o=h(r).records[t]||(h(r).records[t]={});o.handler=i}},d.unregister=function(t,e){if(!l.node){var i=e.getZr(),n=(h(i).records||{})[t];n&&(h(i).records[t]=null)}},t.exports=d},function(t,e,i){var n=i(7),r=i(1),o={},a=["x","y","z","radius","angle","single"],s=["cartesian2d","polar","singleAxis"];o.isCoordSupported=function(t){return r.indexOf(s,t)>=0},o.createNameEach=function(t,e){t=t.slice();var i=r.map(t,n.capitalFirst);e=(e||[]).slice();var o=r.map(e,n.capitalFirst);return function(n,a){r.each(t,function(t,r){for(var s={name:t,capital:i[r]},l=0;l=0}function o(t,n){var o=!1;return e(function(e){r.each(i(t,e)||[],function(t){n.records[e.name][t]&&(o=!0)})}),o}function a(t,n){n.nodes.push(t),e(function(e){r.each(i(t,e)||[],function(t){n.records[e.name][t]=!0})})}return function(i){function r(t){!n(t,s)&&o(t,s)&&(a(t,s),l=!0)}var s={nodes:[],records:{}};if(e(function(t){s.records[t.name]={}}),!i)return s;a(i,s);var l;do l=!1,t(r);while(l);return s}},t.exports=o},function(t,e,i){var n=i(1);t.exports={updateSelectedMap:function(t){this._selectTargetMap=n.reduce(t||[],function(t,e){return t[e.name]=e,t},{})},select:function(t){var e=this._selectTargetMap,i=e[t],r=this.get("selectedMode");"single"===r&&n.each(e,function(t){t.selected=!1}),i&&(i.selected=!0)},unSelect:function(t){var e=this._selectTargetMap[t];e&&(e.selected=!1)},toggleSelected:function(t){var e=this._selectTargetMap[t];if(null!=e)return this[e.selected?"unSelect":"select"](t),e.selected},isSelected:function(t){var e=this._selectTargetMap[t];return e&&e.selected}}},function(t,e,i){function n(t){r.defaultEmphasis(t.label,r.LABEL_OPTIONS)}var r=i(5),o=i(1),a=i(9),s=i(7),l=s.addCommas,u=s.encodeHTML,h=i(2).extendComponentModel({type:"marker",dependencies:["series","grid","polar","geo"],init:function(t,e,i,n){this.mergeDefaultAndTheme(t,i),this.mergeOption(t,i,n.createdBySelf,!0)},isAnimationEnabled:function(){if(a.node)return!1;var t=this.__hostSeries;return this.getShallow("animation")&&t&&t.isAnimationEnabled()},mergeOption:function(t,e,i,r){var a=this.constructor,s=this.mainType+"Model";i||e.eachSeries(function(t){var i=t.get(this.mainType),l=t[s];return i&&i.data?(l?l.mergeOption(i,e,!0):(r&&n(i),o.each(i.data,function(t){t instanceof Array?(n(t[0]),n(t[1])):n(t)}),l=new a(i,this,e),o.extend(l,{mainType:this.mainType,seriesIndex:t.seriesIndex,name:t.name,createdBySelf:!0}),l.__hostSeries=t),void(t[s]=l)):void(t[s]=null)},this)},formatTooltip:function(t){var e=this.getData(),i=this.getRawValue(t),n=o.isArray(i)?o.map(i,l).join(", "):l(i),r=e.getName(t),a=u(this.name);return(null!=i||r)&&(a+="
"),r&&(a+=u(r),null!=i&&(a+=" : ")),null!=i&&(a+=u(n)),a},getData:function(){return this._data},setData:function(t){this._data=t}});o.mixin(h,r.dataFormatMixin),t.exports=h},function(t,e,i){t.exports=i(2).extendComponentView({type:"marker",init:function(){this.markerGroupMap={}},render:function(t,e,i){var n=this.markerGroupMap;for(var r in n)n.hasOwnProperty(r)&&(n[r].__keep=!1);var o=this.type+"Model";e.eachSeries(function(t){var n=t[o];n&&this.renderSeries(t,n,e,i)},this);for(var r in n)n.hasOwnProperty(r)&&!n[r].__keep&&this.group.remove(n[r].group)},renderSeries:function(){}})},function(t,e,i){function n(t){return!(isNaN(parseFloat(t.x))&&isNaN(parseFloat(t.y)))}function r(t){return!isNaN(parseFloat(t.x))&&!isNaN(parseFloat(t.y))}function o(t,e,i){var n=-1;do n=Math.max(l.getPrecision(t.get(e,i)),n),t=t.stackedOn;while(t);return n}function a(t,e,i,n,r,a){var s=[],l=m(e,n,t),u=e.indexOfNearest(n,l,!0)[0];s[r]=e.get(i,u,!0),s[a]=e.get(n,u,!0);var h=o(e,n,u);return h>=0&&(s[a]=+s[a].toFixed(h)),s}var s=i(1),l=i(4),u=s.indexOf,h=s.curry,c={min:h(a,"min"),max:h(a,"max"),average:h(a,"average")},d=function(t,e){var i=t.getData(),n=t.coordinateSystem;if(e&&!r(e)&&!s.isArray(e.coord)&&n){var o=n.dimensions,a=f(e,i,n,t);if(e=s.clone(e),e.type&&c[e.type]&&a.baseAxis&&a.valueAxis){var l=u(o,a.baseAxis.dim),h=u(o,a.valueAxis.dim);e.coord=c[e.type](i,a.baseDataDim,a.valueDataDim,l,h),e.value=e.coord[h]}else{for(var d=[null!=e.xAxis?e.xAxis:e.radiusAxis,null!=e.yAxis?e.yAxis:e.angleAxis],p=0;p<2;p++)if(c[d[p]]){var g=t.coordDimToDataDim(o[p])[0];d[p]=m(i,g,d[p])}e.coord=d}}return e},f=function(t,e,i,n){var r={};return null!=t.valueIndex||null!=t.valueDim?(r.valueDataDim=null!=t.valueIndex?e.getDimension(t.valueIndex):t.valueDim,r.valueAxis=i.getAxis(n.dataDimToCoordDim(r.valueDataDim)),r.baseAxis=i.getOtherAxis(r.valueAxis),r.baseDataDim=n.coordDimToDataDim(r.baseAxis.dim)[0]):(r.baseAxis=n.getBaseAxis(),r.valueAxis=i.getOtherAxis(r.baseAxis),r.baseDataDim=n.coordDimToDataDim(r.baseAxis.dim)[0],r.valueDataDim=n.coordDimToDataDim(r.valueAxis.dim)[0]),r},p=function(t,e){return!(t&&t.containData&&e.coord&&!n(e))||t.containData(e.coord)},g=function(t,e,i,n){return n<2?t.coord&&t.coord[n]:t.value},m=function(t,e,i){if("average"===i){var n=0,r=0;return t.each(e,function(t,e){isNaN(t)||(n+=t,r++)},!0),n/r}return t.getDataExtent(e,!0)["max"===i?1:0]};t.exports={dataTransform:d,dataFilter:p,dimValueGetter:g,getAxisInfo:f,numCalculate:m}},,function(t,e){t.exports=function(t,e){var i={};e.eachRawSeriesByType(t,function(t){var n=t.getRawData(),r={};if(!e.isSeriesFiltered(t)){var o=t.getData();o.each(function(t){var e=o.getRawIndex(t);r[e]=t}),n.each(function(e){var a=r[e],s=null!=a&&o.getItemVisual(a,"color",!0);if(s)n.setItemVisual(e,"color",s);else{var l=n.getItemModel(e),u=l.get("itemStyle.normal.color")||t.getColorFromPalette(n.getName(e),i);n.setItemVisual(e,"color",u),null!=a&&o.setItemVisual(a,"color",u)}})}})}},function(t,e,i){var n=i(6),r=i(21),o={},a=Math.min,s=Math.max,l=Math.sin,u=Math.cos,h=n.create(),c=n.create(),d=n.create(),f=2*Math.PI;o.fromPoints=function(t,e,i){if(0!==t.length){var n,r=t[0],o=r[0],l=r[0],u=r[1],h=r[1];for(n=1;n1e-4)return p[0]=t-i,p[1]=e-r,g[0]=t+i,void(g[1]=e+r);if(h[0]=u(o)*i+t,h[1]=l(o)*r+e,c[0]=u(a)*i+t,c[1]=l(a)*r+e,m(p,h,c),v(g,h,c),o%=f,o<0&&(o+=f),a%=f,a<0&&(a+=f),o>a&&!s?a+=f:oo&&(d[0]=u(_)*i+t,d[1]=l(_)*r+e,m(p,d,p),v(g,d,g))},t.exports=o},function(t,e,i){var n=i(40),r=i(1),o=i(16),a=function(t){n.call(this,t)};a.prototype={constructor:a,type:"text",brush:function(t,e){var i=this.style,n=i.x||0,r=i.y||0,a=i.text;if(null!=a&&(a+=""),i.bind(t,this,e),a){this.setTransform(t);var s,l=i.textAlign,u=i.textFont||i.font;if(i.textVerticalAlign){var h=o.getBoundingRect(a,u,i.textAlign,"top");switch(s="middle",i.textVerticalAlign){case"middle":r-=h.height/2-h.lineHeight/2;break;case"bottom":r-=h.height-h.lineHeight/2;break;default:r+=h.lineHeight/2}}else s=i.textBaseline;t.font=u||"12px sans-serif",t.textAlign=l||"left",t.textAlign!==l&&(t.textAlign="left"),t.textBaseline=s||"alphabetic",t.textBaseline!==s&&(t.textBaseline="alphabetic");for(var c=o.measureText("国",t.font).width,d=a.split("\n"),f=0;f=0?parseFloat(t)/100*e:parseFloat(t):t}var r=i(16),o=i(11),a=new o,s=function(){};s.prototype={constructor:s,drawRectText:function(t,e,i){var o=this.style,s=o.text;if(null!=s&&(s+=""),s){t.save();var l,u,h=o.textPosition,c=o.textOffset,d=o.textDistance,f=o.textAlign,p=o.textFont||o.font,g=o.textBaseline,m=o.textVerticalAlign;i=i||r.getBoundingRect(s,p,f,g);var v=this.transform;if(o.textTransform?this.setTransform(t):v&&(a.copy(e),a.applyTransform(v),e=a),h instanceof Array){if(l=e.x+n(h[0],e.width),u=e.y+n(h[1],e.height),f=f||"left",g=g||"top",m){switch(m){case"middle":u-=i.height/2-i.lineHeight/2;break;case"bottom":u-=i.height-i.lineHeight/2;break;default:u+=i.lineHeight/2}g="middle"}}else{var y=r.adjustTextPositionOnRect(h,e,i,d);l=y.x,u=y.y,f=f||y.textAlign,g=g||y.textBaseline}c&&(l+=c[0],u+=c[1]),t.textAlign=f||"left",t.textBaseline=g||"alphabetic";var x=o.textFill,_=o.textStroke;x&&(t.fillStyle=x),_&&(t.strokeStyle=_),t.font=p||"12px sans-serif",t.shadowBlur=o.textShadowBlur,t.shadowColor=o.textShadowColor||"transparent",t.shadowOffsetX=o.textShadowOffsetX,t.shadowOffsetY=o.textShadowOffsetY;var b=s.split("\n");o.textRotation&&(v&&t.translate(v[4],v[5]),t.rotate(o.textRotation),v&&t.translate(-v[4],-v[5]));for(var w=0;ws&&(l=s);var h=a;a=r-l,l=r-h}for(a++;a=o||b<0)break;if(n(M)){if(x){b+=a;continue}break}if(b===i)t[a>0?"moveTo":"lineTo"](M[0],M[1]),c(f,M);else if(v>0){var S=b+a,T=e[S];if(x)for(;T&&n(e[S]);)S+=a,T=e[S];var A=.5,I=e[_],T=e[S];if(!T||n(T))c(p,M);else{n(T)&&!x&&(T=M),s.sub(d,T,I);var C,k;if("x"===y||"y"===y){var L="x"===y?0:1;C=Math.abs(M[L]-I[L]),k=Math.abs(M[L]-T[L])}else C=s.dist(M,I),k=s.dist(M,T);A=k/(k+C),u(p,M,d,-v*(1-A))}l(f,f,m),h(f,f,g),l(p,p,m),h(p,p,g),t.bezierCurveTo(f[0],f[1],p[0],p[1],M[0],M[1]),u(f,M,d,v*A)}else t.lineTo(M[0],M[1]);_=b,b+=a}return w}function o(t,e){var i=[1/0,1/0],n=[-(1/0),-(1/0)];if(e)for(var r=0;rn[0]&&(n[0]=o[0]),o[1]>n[1]&&(n[1]=o[1])}return{min:e?i:n,max:e?n:i}}var a=i(7),s=i(5),l=s.min,h=s.max,u=s.scaleAndAdd,c=s.copy,d=[],f=[],p=[];t.exports={Polyline:a.extend({type:"ec-polyline",shape:{points:[],smooth:0,smoothConstraint:!0,smoothMonotone:null,connectNulls:!1},style:{fill:null,stroke:"#000"},buildPath:function(t,e){var i=e.points,a=0,s=i.length,l=o(i,e.smoothConstraint);if(e.connectNulls){for(;s>0&&n(i[s-1]);s--);for(;a0&&n(i[l-1]);l--);for(;s0?1.1:1/1.1;l.call(this,t,e,t.offsetX,t.offsetY)}function s(t){if(!f.isTaken(this._zr,"globalPan")){var e=t.pinchScale>1?1.1:1/1.1;l.call(this,t,e,t.pinchX,t.pinchY)}}function l(t,e,i,n){if(this.containsPoint&&this.containsPoint(i,n)){d.stop(t.event);var r=this.target,o=this.zoomLimit;if(r){var a=r.position,s=r.scale,l=this.zoom=this.zoom||1;if(l*=e,o){var h=o.min||0,u=o.max||1/0;l=Math.max(Math.min(u,l),h)}var c=l/this.zoom;this.zoom=l,a[0]-=(i-a[0])*(c-1),a[1]-=(n-a[1])*(c-1),s[0]*=c,s[1]*=c,r.dirty()}this.trigger("zoom",e,i,n)}}function h(t,e){this.target=e,this.containsPoint,this.zoomLimit,this.zoom,this._zr=t;var i=c.bind,l=i(n,this),h=i(r,this),d=i(o,this),f=i(a,this),p=i(s,this);u.call(this),this.setContainsPoint=function(t){this.containsPoint=t},this.enable=function(e){this.disable(),null==e&&(e=!0),e!==!0&&"move"!==e&&"pan"!==e||(t.on("mousedown",l),t.on("mousemove",h),t.on("mouseup",d)),e!==!0&&"scale"!==e&&"zoom"!==e||(t.on("mousewheel",f),t.on("pinch",p))},this.disable=function(){t.off("mousedown",l),t.off("mousemove",h),t.off("mouseup",d),t.off("mousewheel",f),t.off("pinch",p)},this.dispose=this.disable,this.isDragging=function(){return this._dragging},this.isPinching=function(){return this._pinching}}var u=i(21),c=i(1),d=i(25),f=i(117);c.mixin(h,u),t.exports=h},function(t,e){t.exports=function(t,e,i,n,r){function o(t,e,i){var n=e.length?e.slice():[e,e];return e[0]>e[1]&&n.reverse(),t<0&&n[0]+t0&&n[1]+t>i[1]&&(t=i[1]-n[1]),t}return t?("rigid"===n?(t=o(t,e,i),e[0]+=t,e[1]+=t):(t=o(t,e[r],i),e[r]+=t,"push"===n&&e[0]>e[1]&&(e[1-r]=e[r])),e):e}},function(t,e,i){var n=i(1),r={show:!0,zlevel:0,z:0,inverse:!1,name:"",nameLocation:"end",nameRotate:null,nameTruncate:{maxWidth:null,ellipsis:"...",placeholder:"."},nameTextStyle:{},nameGap:15,silent:!1,triggerEvent:!1,tooltip:{show:!1},axisLine:{show:!0,onZero:!0,lineStyle:{color:"#333",width:1,type:"solid"}},axisTick:{show:!0,inside:!1,length:5,lineStyle:{width:1}},axisLabel:{show:!0,inside:!1,rotate:0,margin:8,textStyle:{fontSize:12}},splitLine:{show:!0,lineStyle:{color:["#ccc"],width:1,type:"solid"}},splitArea:{show:!1,areaStyle:{color:["rgba(250,250,250,0.3)","rgba(200,200,200,0.3)"]}}},o=n.merge({boundaryGap:!0,splitLine:{show:!1},axisTick:{alignWithLabel:!1,interval:"auto"},axisLabel:{interval:"auto"}},r),a=n.merge({boundaryGap:[0,0],splitNumber:5},r),s=n.defaults({scale:!0,min:"dataMin",max:"dataMax"},a),l=n.defaults({logBase:10},a);l.scale=!0,t.exports={categoryAxis:o,valueAxis:a,timeAxis:s,logAxis:l}},function(t,e,i){"use strict";function n(t){return t.get("stack")||"__ec_stack_"+t.seriesIndex}function r(t){return t.dim+t.index}function o(t,e){var i={};s.each(t,function(t,e){var o=t.getData(),a=t.coordinateSystem,s=a.getBaseAxis(),l=s.getExtent(),u="category"===s.type?s.getBandWidth():Math.abs(l[1]-l[0])/o.count(),c=i[r(s)]||{bandWidth:u,remainedWidth:u,autoWidthCount:0,categoryGap:"20%",gap:"30%",stacks:{}},d=c.stacks;i[r(s)]=c;var f=n(t);d[f]||c.autoWidthCount++,d[f]=d[f]||{width:0,maxWidth:0};var p=h(t.get("barWidth"),u),g=h(t.get("barMaxWidth"),u),m=t.get("barGap"),v=t.get("barCategoryGap");p&&!d[f].width&&(p=Math.min(c.remainedWidth,p),d[f].width=p,c.remainedWidth-=p),g&&(d[f].maxWidth=g),null!=m&&(c.gap=m),null!=v&&(c.categoryGap=v)});var o={};return s.each(i,function(t,e){o[e]={};var i=t.stacks,n=t.bandWidth,r=h(t.categoryGap,n),a=h(t.gap,1),l=t.remainedWidth,u=t.autoWidthCount,c=(l-r)/(u+(u-1)*a);c=Math.max(c,0),s.each(i,function(t,e){var i=t.maxWidth;!t.width&&i&&i=0?"p":"n",v=m[i],y=l[s][i][u],x=h[s][i][u];f.isHorizontal()?(n=y,r=v[1]+c,o=v[0]-x,a=d,h[s][i][u]+=o,Math.abs(o)e+s&&a>n+s||at+s&&o>i+s||oe+u&&h>r+u&&h>a+u||ht+u&&l>i+u&&l>o+u||le&&o>n||or?a:0}},function(t,e,i){"use strict";var n=i(1),r=i(37),o=function(t,e,i,n,o,a){this.x=null==t?0:t,this.y=null==e?0:e,this.x2=null==i?1:i,this.y2=null==n?0:n,this.type="linear",this.global=a||!1,r.call(this,o)};o.prototype={constructor:o},n.inherits(o,r),t.exports=o},function(t,e,i){"use strict";function n(t){return t>s||t<-s}var r=i(20),o=i(5),a=r.identity,s=5e-5,l=function(t){t=t||{},t.position||(this.position=[0,0]),null==t.rotation&&(this.rotation=0),t.scale||(this.scale=[1,1]),this.origin=this.origin||null},h=l.prototype;h.transform=null,h.needLocalTransform=function(){return n(this.rotation)||n(this.position[0])||n(this.position[1])||n(this.scale[0]-1)||n(this.scale[1]-1)},h.updateTransform=function(){var t=this.parent,e=t&&t.transform,i=this.needLocalTransform(),n=this.transform;return i||e?(n=n||r.create(),i?this.getLocalTransform(n):a(n),e&&(i?r.mul(n,t.transform,n):r.copy(n,t.transform)),this.transform=n,this.invTransform=this.invTransform||r.create(),void r.invert(this.invTransform,n)):void(n&&a(n))},h.getLocalTransform=function(t){t=t||[],a(t);var e=this.origin,i=this.scale,n=this.rotation,o=this.position;return e&&(t[4]-=e[0],t[5]-=e[1]),r.scale(t,t,i),n&&r.rotate(t,t,n),e&&(t[4]+=e[0],t[5]+=e[1]),t[4]+=o[0],t[5]+=o[1],t},h.setTransform=function(t){var e=this.transform,i=t.dpr||1;e?t.setTransform(i*e[0],i*e[1],i*e[2],i*e[3],i*e[4],i*e[5]):t.setTransform(i,0,0,i,0,0)},h.restoreTransform=function(t){var e=(this.transform,t.dpr||1);t.setTransform(e,0,0,e,0,0)};var u=[];h.decomposeTransform=function(){if(this.transform){var t=this.parent,e=this.transform;t&&t.transform&&(r.mul(u,t.invTransform,e),e=u);var i=e[0]*e[0]+e[1]*e[1],o=e[2]*e[2]+e[3]*e[3],a=this.position,s=this.scale;n(i-1)&&(i=Math.sqrt(i)),n(o-1)&&(o=Math.sqrt(o)),e[0]<0&&(i=-i),e[3]<0&&(o=-o),a[0]=e[4],a[1]=e[5],s[0]=i,s[1]=o,this.rotation=Math.atan2(-e[1]/o,e[0]/i)}},h.getGlobalScale=function(){var t=this.transform;if(!t)return[1,1];var e=Math.sqrt(t[0]*t[0]+t[1]*t[1]),i=Math.sqrt(t[2]*t[2]+t[3]*t[3]);return t[0]<0&&(e=-e),t[3]<0&&(i=-i),[e,i]},h.transformCoordToLocal=function(t,e){var i=[t,e],n=this.invTransform;return n&&o.applyTransform(i,i,n),i},h.transformCoordToGlobal=function(t,e){var i=[t,e],n=this.transform;return n&&o.applyTransform(i,i,n),i},t.exports=l},function(t,e,i){"use strict";function n(t){r.each(o,function(e){this[e]=r.bind(t[e],t)},this)}var r=i(1),o=["getDom","getZr","getWidth","getHeight","dispatchAction","isDisposed","on","off","getDataURL","getConnectedDataURL","getModel","getOption"];t.exports=n},function(t,e,i){var n=i(1);i(53),i(95),i(96);var r=i(87),o=i(2);o.registerLayout(n.curry(r,"bar")),o.registerVisual(function(t){t.eachSeriesByType("bar",function(t){var e=t.getData();e.setVisual("legendSymbol","roundRect")})}),i(31)},function(t,e,i){t.exports=i(80).extend({type:"series.bar",dependencies:["grid","polar"],brushSelector:"rect"})},function(t,e,i){"use strict";function n(t,e,i,n,r,o,a){var s=new h.Rect({shape:l.extend({},n)});if(o){var u=s.shape,c=r?"height":"width",d={};u[c]=0,d[c]=n[c],h[a?"updateProps":"initProps"](s,{shape:d},o,e)}return s}function r(t,e,i){i.style.text="",h.updateProps(i,{shape:{width:0}},e,t,function(){i.parent&&i.parent.remove(i)})}function o(t,e,i){var n=t.getItemLayout(e),r=s(i,n),o=n.width>0?1:-1,a=n.height>0?1:-1;return{x:n.x+o*r/2,y:n.y+a*r/2,width:n.width-o*r,height:n.height-a*r}}function a(t,e,i,n,r,o,a){var s=e.getItemVisual(i,"color"),c=e.getItemVisual(i,"opacity"),d=n.getModel("itemStyle.normal"),f=n.getModel("itemStyle.emphasis").getBarItemStyle();t.setShape("r",d.get("barBorderRadius")||0),t.useStyle(l.defaults({fill:s,opacity:c},d.getBarItemStyle()));var p=a?r.height>0?"bottom":"top":r.width>0?"left":"right";u.setLabel(t.style,f,n,s,o,i,p),h.setHoverStyle(t,f)}function s(t,e){var i=t.get(c)||0;return Math.min(i,Math.abs(e.width),Math.abs(e.height))}var l=i(1),h=i(3),u=i(81),c=["itemStyle","normal","barBorderWidth"];l.extend(i(11).prototype,i(97));var d=i(2).extendChartView({type:"bar",render:function(t,e,i){var n=t.get("coordinateSystem");return"cartesian2d"===n&&this._renderOnCartesian(t,e,i),this.group},dispose:l.noop,_renderOnCartesian:function(t,e,i){var s=this.group,l=t.getData(),u=this._data,c=t.coordinateSystem,d=c.getBaseAxis(),f=d.isHorizontal(),p=t.isAnimationEnabled()?t:null;l.diff(u).add(function(e){if(l.hasValue(e)){var i=l.getItemModel(e),r=o(l,e,i),h=n(l,e,i,r,f,p);l.setItemGraphicEl(e,h),s.add(h),a(h,l,e,i,r,t,f)}}).update(function(e,i){var r=u.getItemGraphicEl(i);if(!l.hasValue(e))return void s.remove(r);var c=l.getItemModel(e),d=o(l,e,c);r?h.updateProps(r,{shape:d},p,e):r=n(l,e,c,d,f,p,!0),l.setItemGraphicEl(e,r),s.add(r),a(r,l,e,c,d,t,f)}).remove(function(t){var e=u.getItemGraphicEl(t);e&&r(t,p,e)}).execute(),this._data=l},remove:function(t,e){var i=this.group,n=this._data;t.get("animation")?n&&n.eachItemGraphicEl(function(e){r(e.dataIndex,t,e)}):i.removeAll()}});t.exports=d},function(t,e,i){var n=i(30)([["fill","color"],["stroke","borderColor"],["lineWidth","borderWidth"],["stroke","barBorderColor"],["lineWidth","barBorderWidth"],["opacity"],["shadowBlur"],["shadowOffsetX"],["shadowOffsetY"],["shadowColor"]]);t.exports={getBarItemStyle:function(t){var e=n.call(this,t);if(this.getBorderLineDash){var i=this.getBorderLineDash();i&&(e.lineDash=i)}return e}}},function(t,e,i){function n(t){return"_"+t+"Type"}function r(t,e,i){var n=e.getItemVisual(i,"color"),r=e.getItemVisual(i,t),o=e.getItemVisual(i,t+"Size");if(r&&"none"!==r){f.isArray(o)||(o=[o,o]);var a=h.createSymbol(r,-o[0]/2,-o[1]/2,o[0],o[1],n);return a.name=t,a}}function o(t){var e=new c({name:"line"});return a(e.shape,t),e}function a(t,e){var i=e[0],n=e[1],r=e[2];t.x1=i[0],t.y1=i[1],t.x2=n[0],t.y2=n[1],t.percent=1,r?(t.cpx1=r[0],t.cpy1=r[1]):(t.cpx1=NaN,t.cpy1=NaN)}function s(){var t=this,e=t.childOfName("fromSymbol"),i=t.childOfName("toSymbol"),n=t.childOfName("label");if(e||i||!n.ignore){for(var r=1,o=this.parent;o;)o.scale&&(r/=o.scale[0]),o=o.parent;var a=t.childOfName("line");if(this.__dirty||a.__dirty){var s=a.shape.percent,l=a.pointAt(0),h=a.pointAt(s),c=u.sub([],h,l);if(u.normalize(c,c),e){e.attr("position",l);var d=a.tangentAt(0);e.attr("rotation",Math.PI/2-Math.atan2(d[1],d[0])),e.attr("scale",[r*s,r*s])}if(i){i.attr("position",h);var d=a.tangentAt(1);i.attr("rotation",-Math.PI/2-Math.atan2(d[1],d[0])),i.attr("scale",[r*s,r*s])}if(!n.ignore){n.attr("position",h);var f,p,g,m=5*r;if("end"===n.__position)f=[c[0]*m+h[0],c[1]*m+h[1]],p=c[0]>.8?"left":c[0]<-.8?"right":"center",g=c[1]>.8?"top":c[1]<-.8?"bottom":"middle";else if("middle"===n.__position){var v=s/2,d=a.tangentAt(v),y=[d[1],-d[0]],x=a.pointAt(v);y[1]>0&&(y[0]=-y[0],y[1]=-y[1]),f=[x[0]+y[0]*m,x[1]+y[1]*m],p="center",g="bottom";var _=-Math.atan2(d[1],d[0]);h[0].8?"right":c[0]<-.8?"left":"center",g=c[1]>.8?"bottom":c[1]<-.8?"top":"middle";n.attr({style:{textVerticalAlign:n.__verticalAlign||g,textAlign:n.__textAlign||p},position:f,scale:[r,r]})}}}}function l(t,e,i){d.Group.call(this),this._createLine(t,e,i)}var h=i(24),u=i(5),c=i(177),d=i(3),f=i(1),p=i(4),g=["fromSymbol","toSymbol"],m=l.prototype;m.beforeUpdate=s,m._createLine=function(t,e,i){var a=t.hostModel,s=t.getItemLayout(e),l=o(s);l.shape.percent=0,d.initProps(l,{shape:{percent:1}},a,e),this.add(l);var h=new d.Text({name:"label"});this.add(h),f.each(g,function(i){var o=r(i,t,e);this.add(o),this[n(i)]=t.getItemVisual(e,i)},this),this._updateCommonStl(t,e,i)},m.updateData=function(t,e,i){var o=t.hostModel,s=this.childOfName("line"),l=t.getItemLayout(e),h={shape:{}};a(h.shape,l),d.updateProps(s,h,o,e),f.each(g,function(i){var o=t.getItemVisual(e,i),a=n(i);if(this[a]!==o){this.remove(this.childOfName(i));var s=r(i,t,e);this.add(s)}this[a]=o},this),this._updateCommonStl(t,e,i)},m._updateCommonStl=function(t,e,i){var n=t.hostModel,r=this.childOfName("line"),o=i&&i.lineStyle,a=i&&i.hoverLineStyle,s=i&&i.labelModel,l=i&&i.hoverLabelModel;if(!i||t.hasItemOption){var h=t.getItemModel(e);o=h.getModel("lineStyle.normal").getLineStyle(),a=h.getModel("lineStyle.emphasis").getLineStyle(),s=h.getModel("label.normal"),l=h.getModel("label.emphasis")}var u=t.getItemVisual(e,"color"),c=f.retrieve(t.getItemVisual(e,"opacity"),o.opacity,1);r.useStyle(f.defaults({strokeNoScale:!0,fill:"none",stroke:u,opacity:c},o)),r.hoverStyle=a,f.each(g,function(t){var e=this.childOfName(t);e&&(e.setColor(u),e.setStyle({opacity:c}))},this);var m,v,y=s.getShallow("show"),x=l.getShallow("show"),_=this.childOfName("label");if(y||x){var b=n.getRawValue(e);v=null==b?v=t.getName(e):isFinite(b)?p.round(b):b,m=u||"#000"}if(y){var w=s.getModel("textStyle");_.setStyle({text:f.retrieve(n.getFormattedLabel(e,"normal",t.dataType),v),textFont:w.getFont(),fill:w.getTextColor()||m}),_.__textAlign=w.get("align"),_.__verticalAlign=w.get("baseline"),_.__position=s.get("position")}else _.setStyle("text","");if(x){var M=l.getModel("textStyle");_.hoverStyle={text:f.retrieve(n.getFormattedLabel(e,"emphasis",t.dataType),v),textFont:M.getFont(),fill:M.getTextColor()||m}}else _.hoverStyle={text:""};_.ignore=!y&&!x,d.setHoverStyle(this)},m.updateLayout=function(t,e){this.setLinePoints(t.getItemLayout(e))},m.setLinePoints=function(t){var e=this.childOfName("line");a(e.shape,t),e.dirty()},f.inherits(l,d.Group),t.exports=l},function(t,e,i){function n(t){return isNaN(t[0])||isNaN(t[1])}function r(t){return!n(t[0])&&!n(t[1])}function o(t){this._ctor=t||s,this.group=new a.Group}var a=i(3),s=i(98),l=o.prototype;l.updateData=function(t){var e=this._lineData,i=this.group,n=this._ctor,o=t.hostModel,a={lineStyle:o.getModel("lineStyle.normal").getLineStyle(),hoverLineStyle:o.getModel("lineStyle.emphasis").getLineStyle(),labelModel:o.getModel("label.normal"),hoverLabelModel:o.getModel("label.emphasis")};t.diff(e).add(function(e){if(r(t.getItemLayout(e))){var o=new n(t,e,a);t.setItemGraphicEl(e,o),i.add(o)}}).update(function(o,s){var l=e.getItemGraphicEl(s);return r(t.getItemLayout(o))?(l?l.updateData(t,o,a):l=new n(t,o,a),t.setItemGraphicEl(o,l),void i.add(l)):void i.remove(l)}).remove(function(t){i.remove(e.getItemGraphicEl(t))}).execute(),this._lineData=t},l.updateLayout=function(){var t=this._lineData;t.eachItemGraphicEl(function(e,i){e.updateLayout(t,i)},this)},l.remove=function(){this.group.removeAll()},t.exports=o},function(t,e,i){var n=i(1),r=i(2),o=r.PRIORITY;i(101),i(102),r.registerVisual(n.curry(i(45),"line","circle","line")),r.registerLayout(n.curry(i(56),"line")),r.registerProcessor(o.PROCESSOR.STATISTIC,n.curry(i(135),"line")),i(31)},function(t,e,i){"use strict";var n=i(35),r=i(16);t.exports=r.extend({type:"series.line",dependencies:["grid","polar"],getInitialData:function(t,e){return n(t.data,this,e)},defaultOption:{zlevel:0,z:2,coordinateSystem:"cartesian2d",legendHoverLink:!0,hoverAnimation:!0,clipOverflow:!0,label:{normal:{position:"top"}},lineStyle:{normal:{width:2,type:"solid"}},step:!1,smooth:!1,smoothMonotone:null,symbol:"emptyCircle",symbolSize:4,symbolRotate:null,showSymbol:!0,showAllSymbol:!1,connectNulls:!1,sampling:"none",animationEasing:"linear",progressive:0,hoverLayerThreshold:1/0}})},function(t,e,i){"use strict";function n(t,e){if(t.length===e.length){for(var i=0;ie[0]?1:-1;e[0]+=n*i,e[1]-=n*i}return e}function a(t){return t>=0?1:-1}function s(t,e){var i=t.getBaseAxis(),n=t.getOtherAxis(i),r=i.onZero?0:n.scale.getExtent()[0],o=n.dim,s="x"===o||"radius"===o?1:0;return e.mapArray([o],function(n,l){for(var h,u=e.stackedOn;u&&a(u.get(o,l))===a(n);){h=u;break}var c=[];return c[s]=e.get(i.dim,l),c[1-s]=h?h.get(o,l,!0):r,t.dataToPoint(c)},!0)}function l(t,e,i){var n=o(t.getAxis("x")),r=o(t.getAxis("y")),a=t.getBaseAxis().isHorizontal(),s=Math.min(n[0],n[1]),l=Math.min(r[0],r[1]),h=Math.max(n[0],n[1])-s,u=Math.max(r[0],r[1])-l,c=i.get("lineStyle.normal.width")||2,d=i.get("clipOverflow")?c/2:Math.max(h,u);a?(l-=d,u+=2*d):(s-=d,h+=2*d);var f=new v.Rect({shape:{x:s,y:l,width:h,height:u}});return e&&(f.shape[a?"width":"height"]=0,v.initProps(f,{shape:{width:h,height:u}},i)),f}function h(t,e,i){var n=t.getAngleAxis(),r=t.getRadiusAxis(),o=r.getExtent(),a=n.getExtent(),s=Math.PI/180,l=new v.Sector({shape:{cx:t.cx,cy:t.cy,r0:o[0],r:o[1],startAngle:-a[0]*s,endAngle:-a[1]*s,clockwise:n.inverse}});return e&&(l.shape.endAngle=-a[0]*s,v.initProps(l,{shape:{endAngle:-a[1]*s}},i)),l}function u(t,e,i){return"polar"===t.type?h(t,e,i):l(t,e,i)}function c(t,e,i){for(var n=e.getBaseAxis(),r="x"===n.dim||"radius"===n.dim?0:1,o=[],a=0;a=0;r--)if(i[r].dimension<2){n=i[r];break}if(n&&"cartesian2d"===e.type){var o=n.dimension,a=t.dimensions[o],s=e.getAxis(a),l=f.map(n.stops,function(t){return{coord:s.toGlobalCoord(s.dataToCoord(t.value)),color:t.color}}),h=l.length,u=n.outerColors.slice();h&&l[0].coord>l[h-1].coord&&(l.reverse(),u.reverse());var c=10,d=l[0].coord-c,p=l[h-1].coord+c,g=p-d;if(g<.001)return"transparent";f.each(l,function(t){t.offset=(t.coord-d)/g}),l.push({offset:h?l[h-1].offset:.5,color:u[1]||"transparent"}),l.unshift({offset:h?l[0].offset:.5,color:u[0]||"transparent"});var m=new v.LinearGradient(0,0,0,0,l,(!0));return m[a]=d,m[a+"2"]=p,m}}}var f=i(1),p=i(39),g=i(50),m=i(103),v=i(3),y=i(6),x=i(82),_=i(28);t.exports=_.extend({type:"line",init:function(){var t=new v.Group,e=new p;this.group.add(e.group),this._symbolDraw=e,this._lineGroup=t},render:function(t,e,i){var o=t.coordinateSystem,a=this.group,l=t.getData(),h=t.getModel("lineStyle.normal"),p=t.getModel("areaStyle.normal"),g=l.mapArray(l.getItemLayout,!0),m="polar"===o.type,v=this._coordSys,y=this._symbolDraw,x=this._polyline,_=this._polygon,b=this._lineGroup,w=t.get("animation"),M=!p.isEmpty(),S=s(o,l),T=t.get("showSymbol"),A=T&&!m&&!t.get("showAllSymbol")&&this._getSymbolIgnoreFunc(l,o),I=this._data;I&&I.eachItemGraphicEl(function(t,e){t.__temp&&(a.remove(t),I.setItemGraphicEl(e,null))}),T||y.remove(),a.add(b);var C=!m&&t.get("step");x&&v.type===o.type&&C===this._step?(M&&!_?_=this._newPolygon(g,S,o,w):_&&!M&&(b.remove(_),_=this._polygon=null),b.setClipPath(u(o,!1,t)),T&&y.updateData(l,A),l.eachItemGraphicEl(function(t){t.stopAnimation(!0)}),n(this._stackedOnPoints,S)&&n(this._points,g)||(w?this._updateAnimation(l,S,o,i,C):(C&&(g=c(g,o,C),S=c(S,o,C)),x.setShape({points:g}),_&&_.setShape({points:g,stackedOnPoints:S})))):(T&&y.updateData(l,A),C&&(g=c(g,o,C),S=c(S,o,C)),x=this._newPolyline(g,o,w),M&&(_=this._newPolygon(g,S,o,w)),b.setClipPath(u(o,!0,t)));var k=d(l,o)||l.getVisual("color");x.useStyle(f.defaults(h.getLineStyle(),{fill:"none",stroke:k,lineJoin:"bevel"}));var L=t.get("smooth");if(L=r(t.get("smooth")),x.setShape({smooth:L,smoothMonotone:t.get("smoothMonotone"),connectNulls:t.get("connectNulls")}),_){var P=l.stackedOn,D=0;if(_.useStyle(f.defaults(p.getAreaStyle(),{fill:k,opacity:.7,lineJoin:"bevel"})),P){var O=P.hostModel;D=r(O.get("smooth"))}_.setShape({smooth:L,stackedOnSmooth:D,smoothMonotone:t.get("smoothMonotone"),connectNulls:t.get("connectNulls")})}this._data=l,this._coordSys=o,this._stackedOnPoints=S,this._points=g,this._step=C},dispose:function(){},highlight:function(t,e,i,n){var r=t.getData(),o=y.queryDataIndex(r,n);if(!(o instanceof Array)&&null!=o&&o>=0){var a=r.getItemGraphicEl(o);if(!a){var s=r.getItemLayout(o);if(!s)return;a=new g(r,o),a.position=s,a.setZ(t.get("zlevel"),t.get("z")),a.ignore=isNaN(s[0])||isNaN(s[1]),a.__temp=!0,r.setItemGraphicEl(o,a),a.stopSymbolAnimation(!0),this.group.add(a)}a.highlight()}else _.prototype.highlight.call(this,t,e,i,n)},downplay:function(t,e,i,n){var r=t.getData(),o=y.queryDataIndex(r,n);if(null!=o&&o>=0){var a=r.getItemGraphicEl(o);a&&(a.__temp?(r.setItemGraphicEl(o,null),this.group.remove(a)):a.downplay())}else _.prototype.downplay.call(this,t,e,i,n)},_newPolyline:function(t){var e=this._polyline;return e&&this._lineGroup.remove(e),e=new x.Polyline({shape:{points:t},silent:!0,z2:10}),this._lineGroup.add(e),this._polyline=e,e},_newPolygon:function(t,e){var i=this._polygon;return i&&this._lineGroup.remove(i),i=new x.Polygon({shape:{points:t,stackedOnPoints:e},silent:!0}),this._lineGroup.add(i),this._polygon=i,i},_getSymbolIgnoreFunc:function(t,e){var i=e.getAxesByScale("ordinal")[0];if(i&&i.isLabelIgnored)return f.bind(i.isLabelIgnored,i)},_updateAnimation:function(t,e,i,n,r){var o=this._polyline,a=this._polygon,s=t.hostModel,l=m(this._data,t,this._stackedOnPoints,e,this._coordSys,i),h=l.current,u=l.stackedOnCurrent,d=l.next,f=l.stackedOnNext;r&&(h=c(l.current,i,r),u=c(l.stackedOnCurrent,i,r),d=c(l.next,i,r),f=c(l.stackedOnNext,i,r)),o.shape.__points=l.current,o.shape.points=h,v.updateProps(o,{shape:{points:d}},s),a&&(a.setShape({points:h,stackedOnPoints:u}),v.updateProps(a,{shape:{points:d,stackedOnPoints:f}},s));for(var p=[],g=l.status,y=0;y=0?1:-1}function n(t,e,n){for(var r,o=t.getBaseAxis(),a=t.getOtherAxis(o),s=o.onZero?0:a.scale.getExtent()[0],l=a.dim,h="x"===l||"radius"===l?1:0,u=e.stackedOn,c=e.get(l,n);u&&i(u.get(l,n))===i(c);){r=u;break}var d=[];return d[h]=e.get(o.dim,n),d[1-h]=r?r.get(l,n,!0):s,t.dataToPoint(d)}function r(t,e){var i=[];return e.diff(t).add(function(t){i.push({cmd:"+",idx:t})}).update(function(t,e){i.push({cmd:"=",idx:e,idx1:t})}).remove(function(t){i.push({cmd:"-",idx:t})}).execute(),i}t.exports=function(t,e,i,o,a,s){for(var l=r(t,e),h=[],u=[],c=[],d=[],f=[],p=[],g=[],m=s.dimensions,v=0;v0&&"scale"!==d){var g=a.getItemLayout(0),m=Math.max(i.getWidth(),i.getHeight())/2,v=l.bind(h.removeClipPath,h);h.setClipPath(this._createClipPath(g.cx,g.cy,m,g.startAngle,g.clockwise,v,t))}this._data=a}},dispose:function(){},_createClipPath:function(t,e,i,n,r,o,a){var l=new s.Sector({shape:{cx:t,cy:e,r0:0,r:i,startAngle:n,endAngle:n,clockwise:r}});return s.initProps(l,{shape:{endAngle:n+(r?1:-1)*Math.PI*2}},a,o),l},containPoint:function(t,e){var i=e.getData(),n=i.getItemLayout(0);if(n){var r=t[0]-n.cx,o=t[1]-n.cy,a=Math.sqrt(r*r+o*o);return a<=n.r&&a>=n.r0}}});t.exports=u},function(t,e,i){"use strict";function n(t,e,i,n,r,o,a){function s(e,i,n,r){for(var o=e;oe&&o+1t[o].y+t[o].height)return void l(o,n/2);l(i-1,n/2)}function l(e,i){for(var n=e;n>=0&&(t[n].y-=i,!(n>0&&t[n].y>t[n-1].y+t[n-1].height));n--);}function h(t,e,i,n,r,o){for(var a=o>0?e?Number.MAX_VALUE:0:e?Number.MAX_VALUE:0,s=0,l=t.length;s=a&&(d=a-10),!e&&d<=a&&(d=a+10),t[s].x=i+d*o,a=d}}t.sort(function(t,e){return t.y-e.y});for(var u,c=0,d=t.length,f=[],p=[],g=0;g=i?p.push(t[g]):f.push(t[g]);h(f,!1,e,i,n,r),h(p,!0,e,i,n,r)}function r(t,e,i,r,o,a){for(var s=[],l=[],h=0;h0?"left":"right"}var L=g.getModel("textStyle").getFont(),P=g.get("rotate")?b<0?-_+Math.PI:-_:0,D=t.getFormattedLabel(i,"normal")||l.getName(i),O=o.getBoundingRect(D,L,d,"top");u=!!P,f.label={x:n,y:r,position:m,height:O.height,len:y,len2:x,linePoints:c,textAlign:d,verticalAlign:"middle",font:L,rotation:P},M||h.push(f.label)}),!u&&t.get("avoidLabelOverlap")&&r(h,a,s,e,i,n)}},function(t,e,i){var n=i(4),r=n.parsePercent,o=i(107),a=i(1),s=2*Math.PI,l=Math.PI/180;t.exports=function(t,e,i,h){e.eachSeriesByType(t,function(t){var e=t.get("center"),h=t.get("radius");a.isArray(h)||(h=[0,h]),a.isArray(e)||(e=[e,e]);var u=i.getWidth(),c=i.getHeight(),d=Math.min(u,c),f=r(e[0],u),p=r(e[1],c),g=r(h[0],d/2),m=r(h[1],d/2),v=t.getData(),y=-t.get("startAngle")*l,x=t.get("minAngle")*l,_=v.getSum("value"),b=Math.PI/(_||v.count())*2,w=t.get("clockwise"),M=t.get("roseType"),S=t.get("stillShowZeroSum"),T=v.getDataExtent("value");T[0]=0;var A=s,I=0,C=y,k=w?1:-1;if(v.each("value",function(t,e){var i;if(isNaN(t))return void v.setItemLayout(e,{angle:NaN,startAngle:NaN,endAngle:NaN,clockwise:w,cx:f,cy:p,r0:g,r:M?NaN:m});i="area"!==M?0===_&&S?b:t*b:s/(v.count()||1),i=0;r--){var o=i[r];if(o[n])break}if(r<0){var a=t.queryComponents({mainType:"dataZoom",subType:"select",id:n})[0];if(a){var s=a.getPercentRange();i[0][n]={dataZoomId:n,start:s[0],end:s[1]}}}}),i.push(e)},pop:function(t){var e=n(t),i=e[e.length-1];e.length>1&&e.pop();var r={};return o(i,function(t,i){for(var n=e.length-1;n>=0;n--){var t=e[n][i];if(t){r[i]=t;break}}}),r},clear:function(t){t[a]=null},count:function(t){return n(t).length}};t.exports=s},function(t,e,i){i(13).registerSubTypeDefaulter("dataZoom",function(t){return"slider"})},function(t,e,i){function n(t){R.call(this),this._zr=t,this.group=new F.Group,this._brushType,this._brushOption,this._panels,this._track=[],this._dragging,this._covers=[],this._creatingCover,this._creatingPanel,this._enableGlobalPan,this._uid="brushController_"+it++,this._handlers={},Z(nt,function(t,e){this._handlers[e]=B.bind(t,this)},this)}function r(t,e){var i=t._zr;t._enableGlobalPan||G.take(i,K,t._uid),Z(t._handlers,function(t,e){i.on(e,t)}),t._brushType=e.brushType,t._brushOption=B.merge(B.clone(et),e,!0)}function o(t){var e=t._zr;G.release(e,K,t._uid),Z(t._handlers,function(t,i){e.off(i,t)}),t._brushType=t._brushOption=null}function a(t,e){var i=rt[e.brushType].createCover(t,e);return h(i),i.__brushOption=e,t.group.add(i),i}function s(t,e){var i=c(e);return i.endCreating&&(i.endCreating(t,e),h(e)),e}function l(t,e){var i=e.__brushOption;c(e).updateCoverShape(t,e,i.range,i)}function h(t){t.traverse(function(t){t.z=Y,t.z2=Y})}function u(t,e){c(e).updateCommon(t,e),l(t,e)}function c(t){return rt[t.__brushOption.brushType]}function d(t,e,i){var n=t._panels;if(!n)return!0;var r;return Z(n,function(t){t.contain(e,i)&&(r=t)}),r}function f(t,e){var i=t._panels;if(!i)return!0;var n=e.__brushOption.panelId;return null==n||i[n]}function p(t){var e=t._covers,i=e.length;return Z(e,function(e){t.group.remove(e)},t),e.length=0,!!i}function g(t,e){var i=q(t._covers,function(t){var e=t.__brushOption,i=B.clone(e.range);return{brushType:e.brushType,panelId:e.panelId,range:i}});t.trigger("brush",i,{isEnd:!!e.isEnd,removeOnClick:!!e.removeOnClick})}function m(t){var e=t._track;if(!e.length)return!1;var i=e[e.length-1],n=e[0],r=i[0]-n[0],o=i[1]-n[1],a=X(r*r+o*o,.5);return a>$}function v(t){var e=t.length-1;return e<0&&(e=0),[t[0],t[e]]}function y(t,e,i,n){var r=new F.Group;return r.add(new F.Rect({name:"main",style:w(i),silent:!0,draggable:!0,cursor:"move",drift:W(t,e,r,"nswe"),ondragend:W(g,e,{isEnd:!0})})),Z(n,function(i){r.add(new F.Rect({name:i,style:{opacity:0},draggable:!0,silent:!0,invisible:!0,drift:W(t,e,r,i),ondragend:W(g,e,{isEnd:!0})}))}),r}function x(t,e,i,n){var r=n.brushStyle.lineWidth||0,o=U(r,Q),a=i[0][0],s=i[1][0],l=a-r/2,h=s-r/2,u=i[0][1],c=i[1][1],d=u-o+r/2,f=c-o+r/2,p=u-a,g=c-s,m=p+r,v=g+r;b(t,e,"main",a,s,p,g),n.transformable&&(b(t,e,"w",l,h,o,v),b(t,e,"e",d,h,o,v),b(t,e,"n",l,h,m,o),b(t,e,"s",l,f,m,o),b(t,e,"nw",l,h,o,o),b(t,e,"ne",d,h,o,o),b(t,e,"sw",l,f,o,o),b(t,e,"se",d,f,o,o))}function _(t,e){var i=e.__brushOption,n=i.transformable,r=e.childAt(0);r.useStyle(w(i)),r.attr({silent:!n,cursor:n?"move":"default"}),Z(["w","e","n","s","se","sw","ne","nw"],function(i){var r=e.childOfName(i),o=T(t,i);r&&r.attr({silent:!n,invisible:!n,cursor:n?tt[o]+"-resize":null})})}function b(t,e,i,n,r,o,a){var s=e.childOfName(i);s&&s.setShape(L(k(t,e,[[n,r],[n+o,r+a]])))}function w(t){return B.defaults({strokeNoScale:!0},t.brushStyle)}function M(t,e,i,n){var r=[j(t,i),j(e,n)],o=[U(t,i),U(e,n)];return[[r[0],o[0]],[r[1],o[1]]]}function S(t){return F.getTransform(t.group)}function T(t,e){if(e.length>1){e=e.split("");var i=[T(t,e[0]),T(t,e[1])];return("e"===i[0]||"w"===i[0])&&i.reverse(),i.join("")}var n={w:"left",e:"right",n:"top",s:"bottom"},r={left:"w",right:"e",top:"n",bottom:"s"},i=F.transformDirection(n[e],S(t));return r[i]}function A(t,e,i,n,r,o,a,s){var l=n.__brushOption,h=t(l.range),c=C(i,o,a);Z(r.split(""),function(t){var e=J[t];h[e[0]][e[1]]+=c[e[0]]}),l.range=e(M(h[0][0],h[1][0],h[0][1],h[1][1])),u(i,n),g(i,{isEnd:!1})}function I(t,e,i,n,r){var o=e.__brushOption.range,a=C(t,i,n);Z(o,function(t){t[0]+=a[0],t[1]+=a[1]}),u(t,e),g(t,{isEnd:!1})}function C(t,e,i){var n=t.group,r=n.transformCoordToLocal(e,i),o=n.transformCoordToLocal(0,0);return[r[0]-o[0],r[1]-o[1]]}function k(t,e,i){var n=f(t,e);if(n===!0)return B.clone(i);var r=n.getBoundingRect();return B.map(i,function(t){var e=t[0];e=U(e,r.x),e=j(e,r.x+r.width);var i=t[1];return i=U(i,r.y),i=j(i,r.y+r.height),[e,i]})}function L(t){var e=j(t[0][0],t[1][0]),i=j(t[0][1],t[1][1]),n=U(t[0][0],t[1][0]),r=U(t[0][1],t[1][1]);return{x:e,y:i,width:n-e,height:r-i}}function P(t,e){var i=e.offsetX,n=e.offsetY,r=t._zr;if(t._brushType){for(var o,a=t._panels,s=t._covers,l=0;lt[1]&&t.reverse(),t}function r(t,e){for(var i=!0,n=0;n=0){i=!1;for(var o=0;o=0?(i=n.getBoundingRect().clone(),i.applyTransform(s.getTransform(n))):i=n.grid.getRect().clone(),e.push({panelId:t.panelId,rect:i})}),e},h.makeCoordInfoList=function(t,e){var i=[];return l(u,function(n){var r=t[n+"Index"];null!=r&&"none"!==r&&("all"===r||a.isArray(r)||(r=[r]),e.eachComponent({mainType:n},function(t,e){if(!("all"!==r&&a.indexOf(r,e)<0)){var o,s;"xAxis"===n||"yAxis"===n?o=t.axis.grid:s=t.coordinateSystem;for(var l,h=0,u=i.length;h=0;n--)c.isIdInner(e[n])&&e.splice(n,1);t[i]=e}}),delete t[b],t},getTheme:function(){return this._theme},getComponent:function(t,e){var i=this._componentsMap[t];if(i)return i[e||0]},queryComponents:function(t){var e=t.mainType;if(!e)return[];var i=t.index,n=t.id,r=t.name,o=this._componentsMap[e];if(!o||!o.length)return[];var a;if(null!=i)m(i)||(i=[i]),a=p(g(i,function(t){ -return o[t]}),function(t){return!!t});else if(null!=n){var s=m(n);a=p(o,function(t){return s&&v(n,t.id)>=0||!s&&t.id===n})}else if(null!=r){var h=m(r);a=p(o,function(t){return h&&v(r,t.name)>=0||!h&&t.name===r})}else a=o;return l(a,t)},findComponents:function(t){function e(t){var e=r+"Index",i=r+"Id",n=r+"Name";return!t||null==t[e]&&null==t[i]&&null==t[n]?null:{mainType:r,index:t[e],id:t[i],name:t[n]}}function i(e){return t.filter?p(e,t.filter):e}var n=t.query,r=t.mainType,o=e(n),a=o?this.queryComponents(o):this._componentsMap[r];return i(l(a,t))},eachComponent:function(t,e,i){var n=this._componentsMap;if("function"==typeof t)i=e,e=t,f(n,function(t,n){f(t,function(t,r){e.call(i,n,t,r)})});else if(u.isString(t))f(n[t],e,i);else if(y(t)){var r=this.findComponents(t);f(r,e,i)}},getSeriesByName:function(t){var e=this._componentsMap.series;return p(e,function(e){return e.name===t})},getSeriesByIndex:function(t){return this._componentsMap.series[t]},getSeriesByType:function(t){var e=this._componentsMap.series;return p(e,function(e){return e.subType===t})},getSeries:function(){return this._componentsMap.series.slice()},eachSeries:function(t,e){h(this),f(this._seriesIndices,function(i){var n=this._componentsMap.series[i];t.call(e,n,i)},this)},eachRawSeries:function(t,e){f(this._componentsMap.series,t,e)},eachSeriesByType:function(t,e,i){h(this),f(this._seriesIndices,function(n){var r=this._componentsMap.series[n];r.subType===t&&e.call(i,r,n)},this)},eachRawSeriesByType:function(t,e,i){return f(this.getSeriesByType(t),e,i)},isSeriesFiltered:function(t){return h(this),u.indexOf(this._seriesIndices,t.componentIndex)<0},filterSeries:function(t,e){h(this);var i=p(this._componentsMap.series,t,e);this._seriesIndices=s(i)},restoreData:function(){var t=this._componentsMap;this._seriesIndices=s(t.series);var e=[];f(t,function(t,i){e.push(i)}),x.topologicalTravel(e,x.getAllClassMainTypes(),function(e,i){f(t[e],function(t){t.restoreData()})})}});u.mixin(w,i(57)),t.exports=w},function(t,e,i){function n(t){this._api=t,this._timelineOptions=[],this._mediaList=[],this._mediaDefault,this._currentMediaIndices=[],this._optionBackup,this._newBaseOption}function r(t,e,i){var n,r,o=[],a=[],s=t.timeline;if(t.baseOption&&(r=t.baseOption),(s||t.options)&&(r=r||{},o=(t.options||[]).slice()),t.media){r=r||{};var l=t.media;d(l,function(t){t&&t.option&&(t.query?a.push(t):n||(n=t))})}return r||(r=t),r.timeline||(r.timeline=s),d([r].concat(o).concat(h.map(a,function(t){return t.option})),function(t){d(e,function(e){e(t,i)})}),{baseOption:r,timelineOptions:o,mediaDefault:n,mediaList:a}}function o(t,e,i){var n={width:e,height:i,aspectratio:e/i},r=!0;return h.each(t,function(t,e){var i=e.match(m);if(i&&i[1]&&i[2]){var o=i[1],s=i[2].toLowerCase();a(n[s],t,o)||(r=!1)}}),r}function a(t,e,i){return"min"===i?t>=e:"max"===i?t<=e:t===e}function s(t,e){return t.join(",")===e.join(",")}function l(t,e){e=e||{},d(e,function(e,i){if(null!=e){var n=t[i];if(c.hasClass(i)){e=u.normalizeToArray(e),n=u.normalizeToArray(n);var r=u.mappingToExists(n,e);t[i]=p(r,function(t){return t.option&&t.exist?g(t.exist,t.option,!0):t.exist||t.option})}else t[i]=g(n,e,!0)}})}var h=i(1),u=i(6),c=i(13),d=h.each,f=h.clone,p=h.map,g=h.merge,m=/^(min|max)?(.+)$/;n.prototype={constructor:n,setOption:function(t,e){t=f(t,!0);var i=this._optionBackup,n=r.call(this,t,e,!i);this._newBaseOption=n.baseOption,i?(l(i.baseOption,n.baseOption),n.timelineOptions.length&&(i.timelineOptions=n.timelineOptions),n.mediaList.length&&(i.mediaList=n.mediaList),n.mediaDefault&&(i.mediaDefault=n.mediaDefault)):this._optionBackup=n},mountOption:function(t){var e=this._optionBackup;return this._timelineOptions=p(e.timelineOptions,f),this._mediaList=p(e.mediaList,f),this._mediaDefault=f(e.mediaDefault),this._currentMediaIndices=[],f(t?e.baseOption:this._newBaseOption)},getTimelineOption:function(t){var e,i=this._timelineOptions;if(i.length){var n=t.getComponent("timeline");n&&(e=f(i[n.getCurrentIndex()],!0))}return e},getMediaOption:function(t){var e=this._api.getWidth(),i=this._api.getHeight(),n=this._mediaList,r=this._mediaDefault,a=[],l=[];if(!n.length&&!r)return l;for(var h=0,u=n.length;he&&(e=t[i]);return e},min:function(t){for(var e=1/0,i=0;i1){var c;"string"==typeof r?c=i[r]:"function"==typeof r&&(c=r),c&&(e=e.downSample(s.dim,1/u,c,n),t.setData(e))}}},this)}},function(t,e,i){function n(t,e){return c(t,u(e))}var r=i(1),o=i(32),a=i(4),s=i(38),l=o.prototype,h=s.prototype,u=a.getPrecisionSafe,c=a.round,d=Math.floor,f=Math.ceil,p=Math.pow,g=Math.log,m=o.extend({type:"log",base:10,$constructor:function(){o.apply(this,arguments),this._originalScale=new s},getTicks:function(){var t=this._originalScale,e=this._extent,i=t.getExtent();return r.map(h.getTicks.call(this),function(r){var o=a.round(p(this.base,r));return o=r===e[0]&&t.__fixMin?n(o,i[0]):o,o=r===e[1]&&t.__fixMax?n(o,i[1]):o},this)},getLabel:h.getLabel,scale:function(t){return t=l.scale.call(this,t),p(this.base,t)},setExtent:function(t,e){var i=this.base;t=g(t)/g(i),e=g(e)/g(i),h.setExtent.call(this,t,e)},getExtent:function(){var t=this.base,e=l.getExtent.call(this);e[0]=p(t,e[0]),e[1]=p(t,e[1]);var i=this._originalScale,r=i.getExtent();return i.__fixMin&&(e[0]=n(e[0],r[0])),i.__fixMax&&(e[1]=n(e[1],r[1])),e},unionExtent:function(t){this._originalScale.unionExtent(t);var e=this.base;t[0]=g(t[0])/g(e),t[1]=g(t[1])/g(e),l.unionExtent.call(this,t)},unionExtentFromData:function(t,e){this.unionExtent(t.getDataExtent(e,!0,function(t){return t>0}))},niceTicks:function(t){t=t||10;var e=this._extent,i=e[1]-e[0];if(!(i===1/0||i<=0)){var n=a.quantity(i),r=t/i*n;for(r<=.5&&(n*=10);!isNaN(n)&&Math.abs(n)<1&&Math.abs(n)>0;)n*=10;var o=[a.round(f(e[0]/n)*n),a.round(d(e[1]/n)*n)];this._interval=n,this._niceExtent=o}},niceExtent:function(t,e,i){h.niceExtent.call(this,t,e,i);var n=this._originalScale;n.__fixMin=e,n.__fixMax=i}});r.each(["contain","normalize"],function(t){m.prototype[t]=function(e){return e=g(e)/g(this.base),l[t].call(this,e)}}),m.create=function(){return new m},t.exports=m},function(t,e,i){var n=i(1),r=i(32),o=r.prototype,a=r.extend({type:"ordinal",init:function(t,e){this._data=t,this._extent=e||[0,t.length-1]},parse:function(t){return"string"==typeof t?n.indexOf(this._data,t):Math.round(t)},contain:function(t){return t=this.parse(t),o.contain.call(this,t)&&null!=this._data[t]},normalize:function(t){return o.normalize.call(this,this.parse(t))},scale:function(t){return Math.round(o.scale.call(this,t))},getTicks:function(){for(var t=[],e=this._extent,i=e[0];i<=e[1];)t.push(i),i++;return t},getLabel:function(t){return this._data[t]},count:function(){return this._extent[1]-this._extent[0]+1},unionExtentFromData:function(t,e){this.unionExtent(t.getDataExtent(e,!1))},niceTicks:n.noop,niceExtent:n.noop});a.create=function(){return new a},t.exports=a},function(t,e,i){var n=i(1),r=i(4),o=i(8),a=i(38),s=a.prototype,l=Math.ceil,h=Math.floor,u=1e3,c=60*u,d=60*c,f=24*d,p=function(t,e,i,n){for(;i>>1;t[r][2]=0;r--)if(!n[r].silent&&n[r]!==i&&!n[r].ignore&&o(n[r],t,e))return n[r]}},a.each(["click","mousedown","mouseup","mousewheel","dblclick","contextmenu"],function(t){u.prototype[t]=function(e){var i=this.findHover(e.zrX,e.zrY,null);if("mousedown"===t)this._downel=i,this._upel=i;else if("mosueup"===t)this._upel=i;else if("click"===t&&this._downel!==this._upel)return;this.dispatchToElement(i,t,e)}}),a.mixin(u,l),a.mixin(u,s),t.exports=u},function(t,e,i){function n(){return!1}function r(t,e,i,n){var r=document.createElement(e),o=i.getWidth(),a=i.getHeight(),s=r.style;return s.position="absolute",s.left=0,s.top=0,s.width=o+"px",s.height=a+"px",r.width=o*n,r.height=a*n,r.setAttribute("data-zr-dom-id",t),r}var o=i(1),a=i(33),s=i(66),l=i(65),h=function(t,e,i){var s;i=i||a.devicePixelRatio,"string"==typeof t?s=r(t,"canvas",e,i):o.isObject(t)&&(s=t,t=s.id),this.id=t,this.dom=s;var l=s.style;l&&(s.onselectstart=n,l["-webkit-user-select"]="none",l["user-select"]="none",l["-webkit-touch-callout"]="none",l["-webkit-tap-highlight-color"]="rgba(0,0,0,0)",l.padding=0,l.margin=0,l["border-width"]=0),this.domBack=null,this.ctxBack=null,this.painter=e,this.config=null,this.clearColor=0,this.motionBlur=!1,this.lastFrameAlpha=.7,this.dpr=i};h.prototype={constructor:h,elCount:0,__dirty:!0,initContext:function(){this.ctx=this.dom.getContext("2d"),this.ctx.dpr=this.dpr},createBackBuffer:function(){var t=this.dpr;this.domBack=r("back-"+this.id,"canvas",this.painter,t),this.ctxBack=this.domBack.getContext("2d"),1!=t&&this.ctxBack.scale(t,t)},resize:function(t,e){var i=this.dpr,n=this.dom,r=n.style,o=this.domBack;r.width=t+"px",r.height=e+"px",n.width=t*i,n.height=e*i,o&&(o.width=t*i,o.height=e*i,1!=i&&this.ctxBack.scale(i,i))},clear:function(t){var e=this.dom,i=this.ctx,n=e.width,r=e.height,o=this.clearColor,a=this.motionBlur&&!t,h=this.lastFrameAlpha,u=this.dpr;if(a&&(this.domBack||this.createBackBuffer(),this.ctxBack.globalCompositeOperation="copy",this.ctxBack.drawImage(e,0,0,n/u,r/u)),i.clearRect(0,0,n,r),o){var c;o.colorStops?(c=o.__canvasGradient||s.getGradient(i,o,{x:0,y:0,width:n,height:r}),o.__canvasGradient=c):o.image&&(c=l.prototype.getCanvasPattern.call(o,i)),i.save(),i.fillStyle=c||o,i.fillRect(0,0,n,r),i.restore()}if(a){var d=this.domBack;i.save(),i.globalAlpha=h,i.drawImage(d,0,0,n,r),i.restore()}}},t.exports=h},function(t,e,i){"use strict";function n(t){return parseInt(t,10)}function r(t){return!!t&&(!!t.isBuildin||"function"==typeof t.resize&&"function"==typeof t.refresh)}function o(t){t.__unusedCount++}function a(t){1==t.__unusedCount&&t.clear()}function s(t,e,i){return x.copy(t.getBoundingRect()),t.transform&&x.applyTransform(t.transform),_.width=e,_.height=i,!x.intersect(_)}function l(t,e){if(t==e)return!1;if(!t||!e||t.length!==e.length)return!0;for(var i=0;i=0&&i.splice(n,1),t.__hoverMir=null},clearHover:function(t){for(var e=this._hoverElements,i=0;i=0){if(!s){if(s=this._progressiveLayers[Math.min(h++,y-1)],s.ctx.save(),s.renderScope={},s&&s.__progress>s.__maxProgress){g=s.__nextIdxNotProg-1;continue}l=s.__progress,s.__dirty||(p=l),s.__progress=p+1}_===p&&this._doPaintEl(v,s,!0,s.renderScope)}else this._doPaintEl(v,n,e,a);v.__dirty=!1}}s&&i(s),o&&o.restore(),this._furtherProgressive=!1,d.each(this._progressiveLayers,function(t){t.__maxProgress>=t.__progress&&(this._furtherProgressive=!0)},this)},_doPaintEl:function(t,e,i,n){var r=e.ctx,o=t.transform;if((e.__dirty||i)&&!t.invisible&&0!==t.style.opacity&&(!o||o[0]||o[3])&&(!t.culling||!s(t,this._width,this._height))){var a=t.__clipPaths;(n.prevClipLayer!==e||l(a,n.prevElClipPaths))&&(n.prevElClipPaths&&(n.prevClipLayer.ctx.restore(),n.prevClipLayer=n.prevElClipPaths=null,n.prevEl=null),a&&(r.save(),h(a,r),n.prevClipLayer=e,n.prevElClipPaths=a)),t.beforeBrush&&t.beforeBrush(r),t.brush(r,n.prevEl||null),n.prevEl=t,t.afterBrush&&t.afterBrush(r)}},getLayer:function(t){if(this._singleCanvas)return this._layers[0];var e=this._layers[t];return e||(e=new m("zr_"+t,this,this.dpr),e.isBuildin=!0,this._layerConfig[t]&&d.merge(e,this._layerConfig[t],!0),this.insertLayer(t,e),e.initContext()),e},insertLayer:function(t,e){var i=this._layers,n=this._zlevelList,o=n.length,a=null,s=-1,l=this._domRoot;if(i[t])return void f("ZLevel "+t+" has been used already");if(!r(e))return void f("Layer of zlevel "+t+" is not valid");if(o>0&&t>n[0]){for(s=0;st);s++);a=i[n[s]]}if(n.splice(s+1,0,t),a){var h=a.dom;h.nextSibling?l.insertBefore(e.dom,h.nextSibling):l.appendChild(e.dom)}else l.firstChild?l.insertBefore(e.dom,l.firstChild):l.appendChild(e.dom);i[t]=e},eachLayer:function(t,e){var i,n,r=this._zlevelList;for(n=0;n=0){a!==g&&(a=g,l++);var v=c.__frame=l-1;if(!o){var x=Math.min(s,y-1);o=i[x],o||(o=i[x]=new m("progressive",this,this.dpr),o.initContext()),o.__maxProgress=0}o.__dirty=o.__dirty||c.__dirty,o.elCount++,o.__maxProgress=Math.max(o.__maxProgress,v),o.__maxProgress>=o.__progress&&(p.__dirty=!0)}else c.__frame=-1,o&&(o.__nextIdxNotProg=h,s++,o=null)}o&&(s++,o.__nextIdxNotProg=h),this.eachBuildinLayer(function(t,e){n[e]!==t.elCount&&(t.__dirty=!0)}),i.length=Math.min(s,y),d.each(i,function(t,e){r[e]!==t.elCount&&(c.__dirty=!0),t.__dirty&&(t.__progress=0)})},clear:function(){return this.eachBuildinLayer(this._clearLayer),this},_clearLayer:function(t){t.clear()},configLayer:function(t,e){if(e){var i=this._layerConfig;i[t]?d.merge(i[t],e,!0):i[t]=e;var n=this._layers[t];n&&d.merge(n,i[t],!0)}},delLayer:function(t){var e=this._layers,i=this._zlevelList,n=e[t];n&&(n.dom.parentNode.removeChild(n.dom),delete e[t],i.splice(d.indexOf(i,t),1))},resize:function(t,e){var i=this._domRoot;i.style.display="none";var n=this._opts;if(null!=t&&(n.width=t),null!=e&&(n.height=e),t=this._getSize(0),e=this._getSize(1),i.style.display="",this._width!=t||e!=this._height){i.style.width=t+"px",i.style.height=e+"px";for(var r in this._layers)this._layers.hasOwnProperty(r)&&this._layers[r].resize(t,e);d.each(this._progressiveLayers,function(i){i.resize(t,e)}),this.refresh(!0)}return this._width=t,this._height=e,this},clearLayer:function(t){var e=this._layers[t];e&&e.clear()},dispose:function(){this.root.innerHTML="",this.root=this.storage=this._domRoot=this._layers=null},getRenderedCanvas:function(t){if(t=t||{},this._singleCanvas)return this._layers[0].dom;var e=new m("image",this,t.pixelRatio||this.dpr);e.initContext(),e.clearColor=t.backgroundColor,e.clear();for(var i=this.storage.getDisplayList(!0),n={},r=0;r=0&&(this.delFromMap(o.id),this._roots.splice(s,1),o instanceof a&&o.delChildrenFromStorage(this))}},addToMap:function(t){return t instanceof a&&(t.__storage=this),t.dirty(!1),this._elements[t.id]=t,this},get:function(t){return this._elements[t]},delFromMap:function(t){var e=this._elements,i=e[t];return i&&(delete e[t],i instanceof a&&(i.__storage=null)),this},dispose:function(){this._elements=this._renderList=this._roots=null},displayableSortFunc:n},t.exports=l},function(t,e,i){"use strict";var n=i(1),r=i(25).Dispatcher,o=i(62),a=i(61),s=function(t){t=t||{},this.stage=t.stage||{},this.onframe=t.onframe||function(){},this._clips=[],this._running=!1,this._time,this._pausedTime,this._pauseStart,this._paused=!1,r.call(this)};s.prototype={constructor:s,addClip:function(t){this._clips.push(t)},addAnimator:function(t){t.animation=this;for(var e=t.getClips(),i=0;i=0&&this._clips.splice(e,1)},removeAnimator:function(t){for(var e=t.getClips(),i=0;ii||d+ca&&(a+=r);var p=Math.atan2(u,h);return p<0&&(p+=r),p>=o&&p<=a||p+r>=o&&p+r<=a}}},function(t,e,i){var n=i(18);t.exports={containStroke:function(t,e,i,r,o,a,s,l,h,u,c){if(0===h)return!1;var d=h;if(c>e+d&&c>r+d&&c>a+d&&c>l+d||ct+d&&u>i+d&&u>o+d&&u>s+d||ue&&u>n&&u>a&&u>l||u1&&r(),d=g.cubicAt(e,n,a,l,b[0]),m>1&&(f=g.cubicAt(e,n,a,l,b[1]))),p+=2==m?ye&&s>n&&s>o||s=0&&h<=1){for(var u=0,c=g.quadraticAt(e,n,o,h),d=0;di||s<-i)return 0;var l=Math.sqrt(i*i-s*s);_[0]=-l,_[1]=l;var h=Math.abs(n-r);if(h<1e-4)return 0;if(h%y<1e-4){n=0,r=y;var u=o?1:-1;return a>=_[0]+t&&a<=_[1]+t?u:0}if(o){var l=n;n=p(r),r=p(l)}else n=p(n),r=p(r);n>r&&(r+=y);for(var c=0,d=0;d<2;d++){var f=_[d];if(f+t>a){var g=Math.atan2(s,f),u=o?1:-1;g<0&&(g=y+g),(g>=n&&g<=r||g+y>=n&&g+y<=r)&&(g>Math.PI/2&&g<1.5*Math.PI&&(u=-u),c+=u)}}return c}function l(t,e,i,r,l){for(var u=0,p=0,g=0,y=0,x=0,_=0;_1&&(i||(u+=m(p,g,y,x,r,l))),1==_&&(p=t[_],g=t[_+1],y=p,x=g),b){case h.M:y=t[_++],x=t[_++],p=y,g=x;break;case h.L:if(i){if(v(p,g,t[_],t[_+1],e,r,l))return!0}else u+=m(p,g,t[_],t[_+1],r,l)||0;p=t[_++],g=t[_++];break;case h.C:if(i){if(c.containStroke(p,g,t[_++],t[_++],t[_++],t[_++],t[_],t[_+1],e,r,l))return!0}else u+=o(p,g,t[_++],t[_++],t[_++],t[_++],t[_],t[_+1],r,l)||0;p=t[_++],g=t[_++];break;case h.Q:if(i){if(d.containStroke(p,g,t[_++],t[_++],t[_],t[_+1],e,r,l))return!0}else u+=a(p,g,t[_++],t[_++],t[_],t[_+1],r,l)||0;p=t[_++],g=t[_++];break;case h.A:var w=t[_++],M=t[_++],S=t[_++],T=t[_++],A=t[_++],I=t[_++],C=(t[_++],1-t[_++]),k=Math.cos(A)*S+w,L=Math.sin(A)*T+M;_>1?u+=m(p,g,k,L,r,l):(y=k,x=L);var P=(r-w)*T/S+w;if(i){if(f.containStroke(w,M,T,A,A+I,C,e,P,l))return!0}else u+=s(w,M,T,A,A+I,C,P,l);p=Math.cos(A+I)*S+w,g=Math.sin(A+I)*T+M;break;case h.R:y=p=t[_++],x=g=t[_++];var D=t[_++],O=t[_++],k=y+D,L=x+O;if(i){if(v(y,x,k,x,e,r,l)||v(k,x,k,L,e,r,l)||v(k,L,y,L,e,r,l)||v(y,L,y,x,e,r,l))return!0}else u+=m(k,x,k,L,r,l),u+=m(y,L,y,x,r,l);break;case h.Z:if(i){if(v(p,g,y,x,e,r,l))return!0}else u+=m(p,g,y,x,r,l);p=y,g=x}}return i||n(g,x)||(u+=m(p,g,y,x,r,l)||0),0!==u}var h=i(29).CMD,u=i(88),c=i(148),d=i(89),f=i(147),p=i(63).normalizeRadian,g=i(18),m=i(90),v=u.containStroke,y=2*Math.PI,x=1e-4,_=[-1,-1,-1],b=[-1,-1];t.exports={contain:function(t,e,i){return l(t,0,!1,e,i)},containStroke:function(t,e,i,n){return l(t,e,!0,i,n)}}},function(t,e,i){"use strict";function n(t){var e=t[1][0]-t[0][0],i=t[1][1]-t[0][1];return Math.sqrt(e*e+i*i)}function r(t){return[(t[0][0]+t[1][0])/2,(t[0][1]+t[1][1])/2]}var o=i(25),a=function(){this._track=[]};a.prototype={constructor:a,recognize:function(t,e,i){return this._doTrack(t,e,i),this._recognize(t)},clear:function(){return this._track.length=0,this},_doTrack:function(t,e,i){var n=t.touches;if(n){for(var r={points:[],touches:[],target:e,event:t},a=0,s=n.length;a1&&o&&o.length>1){var s=n(o)/n(a);!isFinite(s)&&(s=1),e.pinchScale=s;var l=r(o);return e.pinchX=l[0],e.pinchY=l[1],{type:"pinch",target:t[0].target,event:e}}}}};t.exports=a},function(t,e){var i=function(){this.head=null,this.tail=null,this._len=0},n=i.prototype;n.insert=function(t){var e=new r(t);return this.insertEntry(e),e},n.insertEntry=function(t){this.head?(this.tail.next=t,t.prev=this.tail,this.tail=t):this.head=this.tail=t,this._len++},n.remove=function(t){var e=t.prev,i=t.next;e?e.next=i:this.head=i,i?i.prev=e:this.tail=e,t.next=t.prev=null,this._len--},n.len=function(){return this._len};var r=function(t){this.value=t,this.next,this.prev},o=function(t){this._list=new i,this._map={},this._maxSize=t||10},a=o.prototype;a.put=function(t,e){var i=this._list,n=this._map;if(null==n[t]){var r=i.len();if(r>=this._maxSize&&r>0){var o=i.head;i.remove(o),delete n[o.key]}var a=i.insert(e);a.key=t,n[t]=a}},a.get=function(t){var e=this._map[t],i=this._list;if(null!=e)return e!==i.tail&&(i.remove(e),i.insertEntry(e)),e.value},a.clear=function(){this._list.clear(),this._map={}},t.exports=o},function(t,e,i){function n(t){return"mousewheel"===t&&d.browser.firefox?"DOMMouseScroll":t}function r(t,e,i){var n=t._gestureMgr;"start"===i&&n.clear();var r=n.recognize(e,t.handler.findHover(e.zrX,e.zrY,null),t.dom);if("end"===i&&n.clear(),r){var o=r.type;e.gestureEvent=o,t.handler.dispatchToElement(r.target,o,r.event)}}function o(t){t._touching=!0,clearTimeout(t._touchTimer),t._touchTimer=setTimeout(function(){t._touching=!1},700)}function a(t){var e=t.pointerType;return"pen"===e||"touch"===e}function s(t){function e(t,e){return function(){if(!e._touching)return t.apply(e,arguments)}}u.each(x,function(e){t._handlers[e]=u.bind(w[e],t)}),u.each(b,function(e){t._handlers[e]=u.bind(w[e],t)}),u.each(y,function(i){t._handlers[i]=e(w[i],t)})}function l(t){function e(e,i){u.each(e,function(e){p(t,n(e),i._handlers[e])},i)}c.call(this),this.dom=t,this._touching=!1,this._touchTimer,this._gestureMgr=new f,this._handlers={},s(this),d.pointerEventsSupported?e(b,this):(d.touchEventsSupported&&e(x,this),e(y,this))}var h=i(25),u=i(1),c=i(21),d=i(10),f=i(150),p=h.addEventListener,g=h.removeEventListener,m=h.normalizeEvent,v=300,y=["click","dblclick","mousewheel","mouseout","mouseup","mousedown","mousemove","contextmenu"],x=["touchstart","touchend","touchmove"],_={pointerdown:1,pointerup:1,pointermove:1,pointerout:1},b=u.map(y,function(t){var e=t.replace("mouse","pointer");return _[e]?e:t}),w={mousemove:function(t){t=m(this.dom,t),this.trigger("mousemove",t)},mouseout:function(t){t=m(this.dom,t);var e=t.toElement||t.relatedTarget;if(e!=this.dom)for(;e&&9!=e.nodeType;){if(e===this.dom)return;e=e.parentNode}this.trigger("mouseout",t)},touchstart:function(t){t=m(this.dom,t),t.zrByTouch=!0,this._lastTouchMoment=new Date,r(this,t,"start"),w.mousemove.call(this,t),w.mousedown.call(this,t),o(this)},touchmove:function(t){t=m(this.dom,t),t.zrByTouch=!0,r(this,t,"change"),w.mousemove.call(this,t),o(this)},touchend:function(t){t=m(this.dom,t),t.zrByTouch=!0,r(this,t,"end"),w.mouseup.call(this,t),+new Date-this._lastTouchMomentl&&(c=i+n,i*=l/c,n*=l/c),r+o>l&&(c=r+o,r*=l/c,o*=l/c),n+r>h&&(c=n+r,n*=h/c,r*=h/c),i+o>h&&(c=i+o,i*=h/c,o*=h/c),t.moveTo(a+i,s),t.lineTo(a+l-n,s),0!==n&&t.quadraticCurveTo(a+l,s,a+l,s+n),t.lineTo(a+l,s+h-r),0!==r&&t.quadraticCurveTo(a+l,s+h,a+l-r,s+h),t.lineTo(a+o,s+h),0!==o&&t.quadraticCurveTo(a,s+h,a,s+h-o),t.lineTo(a,s+i),0!==i&&t.quadraticCurveTo(a,s,a+i,s)}}},function(t,e,i){var n=i(5),r=n.min,o=n.max,a=n.scale,s=n.distance,l=n.add;t.exports=function(t,e,i,h){var u,c,d,f,p=[],g=[],m=[],v=[];if(h){d=[1/0,1/0],f=[-(1/0),-(1/0)];for(var y=0,x=t.length;yi-2?i-1:f+1],c=t[f>i-3?i-1:f+2]);var m=p*p,v=p*m;o.push([n(h[0],g[0],u[0],c[0],p,m,v),n(h[1],g[1],u[1],c[1],p,m,v)])}return o}},function(t,e,i){t.exports=i(7).extend({type:"arc",shape:{cx:0,cy:0,r:0,startAngle:0,endAngle:2*Math.PI,clockwise:!0},style:{stroke:"#000",fill:null},buildPath:function(t,e){var i=e.cx,n=e.cy,r=Math.max(e.r,0),o=e.startAngle,a=e.endAngle,s=e.clockwise,l=Math.cos(o),h=Math.sin(o);t.moveTo(l*r+i,h*r+n),t.arc(i,n,r,o,a,!s)}})},function(t,e,i){"use strict";function n(t,e,i){var n=t.cpx2,r=t.cpy2;return null===n||null===r?[(i?c:h)(t.x1,t.cpx1,t.cpx2,t.x2,e),(i?c:h)(t.y1,t.cpy1,t.cpy2,t.y2,e)]:[(i?u:l)(t.x1,t.cpx1,t.x2,e),(i?u:l)(t.y1,t.cpy1,t.y2,e)]}var r=i(18),o=i(5),a=r.quadraticSubdivide,s=r.cubicSubdivide,l=r.quadraticAt,h=r.cubicAt,u=r.quadraticDerivativeAt,c=r.cubicDerivativeAt,d=[];t.exports=i(7).extend({type:"bezier-curve",shape:{x1:0,y1:0,x2:0,y2:0,cpx1:0,cpy1:0,percent:1},style:{stroke:"#000",fill:null},buildPath:function(t,e){var i=e.x1,n=e.y1,r=e.x2,o=e.y2,l=e.cpx1,h=e.cpy1,u=e.cpx2,c=e.cpy2,f=e.percent;0!==f&&(t.moveTo(i,n),null==u||null==c?(f<1&&(a(i,l,r,f,d),l=d[1],r=d[2],a(n,h,o,f,d),h=d[1],o=d[2]),t.quadraticCurveTo(l,h,r,o)):(f<1&&(s(i,l,u,r,f,d),l=d[1],u=d[2],r=d[3],s(n,h,c,o,f,d),h=d[1],c=d[2],o=d[3]),t.bezierCurveTo(l,h,u,c,r,o)))},pointAt:function(t){return n(this.shape,t,!1)},tangentAt:function(t){var e=n(this.shape,t,!0);return o.normalize(e,e)}})},function(t,e,i){"use strict";t.exports=i(7).extend({type:"circle",shape:{cx:0,cy:0,r:0},buildPath:function(t,e,i){i&&t.moveTo(e.cx+e.r,e.cy),t.arc(e.cx,e.cy,e.r,0,2*Math.PI,!0)}})},function(t,e,i){t.exports=i(7).extend({type:"line",shape:{x1:0,y1:0,x2:0,y2:0,percent:1},style:{stroke:"#000",fill:null},buildPath:function(t,e){var i=e.x1,n=e.y1,r=e.x2,o=e.y2,a=e.percent;0!==a&&(t.moveTo(i,n),a<1&&(r=i*(1-a)+r*a,o=n*(1-a)+o*a),t.lineTo(r,o))},pointAt:function(t){var e=this.shape;return[e.x1*(1-t)+e.x2*t,e.y1*(1-t)+e.y2*t]}})},function(t,e,i){var n=i(67);t.exports=i(7).extend({type:"polygon",shape:{points:null,smooth:!1,smoothConstraint:null},buildPath:function(t,e){n.buildPath(t,e,!0)}})},function(t,e,i){var n=i(67);t.exports=i(7).extend({type:"polyline",shape:{points:null,smooth:!1,smoothConstraint:null},style:{stroke:"#000",fill:null},buildPath:function(t,e){n.buildPath(t,e,!1)}})},function(t,e,i){var n=i(155);t.exports=i(7).extend({type:"rect",shape:{r:0,x:0,y:0,width:0,height:0},buildPath:function(t,e){var i=e.x,r=e.y,o=e.width,a=e.height;e.r?n.buildPath(t,e):t.rect(i,r,o,a),t.closePath()}})},function(t,e,i){t.exports=i(7).extend({type:"ring",shape:{cx:0,cy:0,r:0,r0:0},buildPath:function(t,e){var i=e.cx,n=e.cy,r=2*Math.PI;t.moveTo(i+e.r,n),t.arc(i,n,e.r,0,r,!1),t.moveTo(i+e.r0,n),t.arc(i,n,e.r0,0,r,!0)}})},function(t,e,i){var n=i(10),r=i(7),o=[["shadowBlur",0],["shadowColor","#000"],["shadowOffsetX",0],["shadowOffsetY",0]];t.exports=r.extend({type:"sector",shape:{cx:0,cy:0,r0:0,r:0,startAngle:0,endAngle:2*Math.PI,clockwise:!0},brush:n.browser.ie&&n.browser.version>=11?function(){var t,e=this.__clipPaths,i=this.style;if(e)for(var n=0;n0&&this.animate(t,!1).when(null==n?500:n,a).delay(o||0),this}},t.exports=h},function(t,e){function i(){this.on("mousedown",this._dragStart,this),this.on("mousemove",this._drag,this),this.on("mouseup",this._dragEnd,this),this.on("globalout",this._dragEnd,this)}i.prototype={constructor:i,_dragStart:function(t){var e=t.target;e&&e.draggable&&(this._draggingTarget=e,e.dragging=!0,this._x=t.offsetX,this._y=t.offsetY,this.dispatchToElement(e,"dragstart",t.event))},_drag:function(t){var e=this._draggingTarget;if(e){var i=t.offsetX,n=t.offsetY,r=i-this._x,o=n-this._y;this._x=i,this._y=n,e.drift(r,o,t),this.dispatchToElement(e,"drag",t.event);var a=this.findHover(i,n,e),s=this._dropTarget;this._dropTarget=a,e!==a&&(s&&a!==s&&this.dispatchToElement(s,"dragleave",t.event),a&&a!==s&&this.dispatchToElement(a,"dragenter",t.event))}},_dragEnd:function(t){var e=this._draggingTarget;e&&(e.dragging=!1),this.dispatchToElement(e,"dragend",t.event),this._dropTarget&&this.dispatchToElement(this._dropTarget,"drop",t.event),this._draggingTarget=null,this._dropTarget=null}},t.exports=i},function(t,e,i){function n(t,e,i,n,r,o,a,s,l,h,u){var g=l*(p/180),y=f(g)*(t-i)/2+d(g)*(e-n)/2,x=-1*d(g)*(t-i)/2+f(g)*(e-n)/2,_=y*y/(a*a)+x*x/(s*s);_>1&&(a*=c(_),s*=c(_));var b=(r===o?-1:1)*c((a*a*(s*s)-a*a*(x*x)-s*s*(y*y))/(a*a*(x*x)+s*s*(y*y)))||0,w=b*a*x/s,M=b*-s*y/a,S=(t+i)/2+f(g)*w-d(g)*M,T=(e+n)/2+d(g)*w+f(g)*M,A=v([1,0],[(y-w)/a,(x-M)/s]),I=[(y-w)/a,(x-M)/s],C=[(-1*y-w)/a,(-1*x-M)/s],k=v(I,C);m(I,C)<=-1&&(k=p),m(I,C)>=1&&(k=0),0===o&&k>0&&(k-=2*p),1===o&&k<0&&(k+=2*p),u.addData(h,S,T,a,s,A,k,g,o)}function r(t){if(!t)return[];var e,i=t.replace(/-/g," -").replace(/ /g," ").replace(/ /g,",").replace(/,,/g,",");for(e=0;e0&&""===m[0]&&m.shift();for(var v=0;v')}}catch(l){n=function(t){return a.createElement("<"+t+' xmlns="'+r+'" class="zrvml">')}}var h=function(){if(!s){s=!0;var t=a.styleSheets;t.length<31?a.createStyleSheet().addRule(".zrvml","behavior:url(#default#VML)"):t[0].addRule(".zrvml","behavior:url(#default#VML)")}};t.exports={doc:a,initVML:h,createNode:n}}},,,,function(t,e){function i(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}function r(t){if(u===setTimeout)return setTimeout(t,0);if((u===i||!u)&&setTimeout)return u=setTimeout,setTimeout(t,0);try{return u(t,0)}catch(e){try{return u.call(null,t,0)}catch(e){return u.call(this,t,0)}}}function o(t){if(c===clearTimeout)return clearTimeout(t);if((c===n||!c)&&clearTimeout)return c=clearTimeout,clearTimeout(t);try{return c(t)}catch(e){try{return c.call(null,t)}catch(e){return c.call(this,t)}}}function a(){g&&f&&(g=!1,f.length?p=f.concat(p):m=-1,p.length&&s())}function s(){if(!g){var t=r(a);g=!0;for(var e=p.length;e;){for(f=p,p=[];++m1)for(var i=1;i=0;o--){var a=n[o],s=r[o],l=a[0]-s[0]/2,h=a[1]-s[1]/2;if(t>=l&&e>=h&&t<=l+s[0]&&e<=h+s[1])return o}return-1}}),s=n.prototype;s.updateData=function(t){this.group.removeAll();var e=this._symbolEl,i=t.hostModel;e.setShape({points:t.mapArray(t.getItemLayout),sizes:t.mapArray(function(e){var i=t.getItemVisual(e,"symbolSize");return i instanceof Array||(i=[i,i]),i})}),e.symbolProxy=o.createSymbol(t.getVisual("symbol"),0,0,0,0),e.setColor=e.symbolProxy.setColor,e.useStyle(i.getModel("itemStyle.normal").getItemStyle(["color"]));var n=t.getVisual("color");n&&e.setColor(n),e.seriesIndex=i.seriesIndex,e.on("mousemove",function(t){e.dataIndex=null;var i=e.findDataIndex(t.offsetX,t.offsetY);i>0&&(e.dataIndex=i)}),this.group.add(e)},s.updateLayout=function(t){var e=t.getData();this._symbolEl.setShape({points:e.mapArray(e.getItemLayout)})},s.remove=function(){this.group.removeAll()},t.exports=n},function(t,e,i){function n(t){return isNaN(+t.cpx1)||isNaN(+t.cpy1)}var r=i(3),o=i(5),a=r.Line.prototype,s=r.BezierCurve.prototype;t.exports=r.extendShape({type:"ec-line",style:{stroke:"#000",fill:null},shape:{x1:0,y1:0,x2:0,y2:0,percent:1,cpx1:null,cpy1:null},buildPath:function(t,e){(n(e)?a:s).buildPath(t,e)},pointAt:function(t){return n(this.shape)?a.pointAt.call(this,t):s.pointAt.call(this,t)},tangentAt:function(t){var e=this.shape,i=n(e)?[e.x2-e.x1,e.y2-e.y1]:s.tangentAt.call(this,t);return o.normalize(i,i)}})},function(t,e,i){var n=i(1),r=i(2);i(179),i(180),r.registerVisual(n.curry(i(45),"scatter","circle",null)),r.registerLayout(n.curry(i(56),"scatter")),i(31)},function(t,e,i){"use strict";var n=i(35),r=i(16);t.exports=r.extend({type:"series.scatter",dependencies:["grid","polar"],getInitialData:function(t,e){var i=n(t.data,this,e);return i},brushSelector:"point",defaultOption:{coordinateSystem:"cartesian2d",zlevel:0,z:2,legendHoverLink:!0,hoverAnimation:!0,symbolSize:10,large:!1,largeThreshold:2e3,itemStyle:{normal:{opacity:.8}}}})},function(t,e,i){var n=i(39),r=i(176);i(2).extendChartView({type:"scatter",init:function(){this._normalSymbolDraw=new n,this._largeSymbolDraw=new r},render:function(t,e,i){var n=t.getData(),r=this._largeSymbolDraw,o=this._normalSymbolDraw,a=this.group,s=t.get("large")&&n.count()>t.get("largeThreshold")?r:o;this._symbolDraw=s,s.updateData(n),a.add(s.group),a.remove(s===r?o.group:r.group)},updateLayout:function(t){this._symbolDraw.updateLayout(t)},remove:function(t,e){this._symbolDraw&&this._symbolDraw.remove(e,!0)},dispose:function(){}})},function(t,e,i){i(114),i(40),i(41),i(187),i(188),i(183),i(184),i(112),i(111)},function(t,e,i){function n(t,e){var i=[1/0,-(1/0)];return h(e,function(e){var n=e.getData();n&&h(e.coordDimToDataDim(t),function(t){var e=n.getDataExtent(t);e[0]i[1]&&(i[1]=e[1])})},this),i[1]0&&(t[0]=0),t[1]<0&&(t[1]=0)),t}function o(t,e){var i=t.getAxisModel(),n=t._percentWindow,r=t._valueWindow;if(n){var o=s.getPixelPrecision(r,[0,500]),a=e||0===n[0]&&100===n[1];i.setRange(a?null:+r[0].toFixed(o),a?null:+r[1].toFixed(o))}}var a=i(1),s=i(4),l=i(68),h=a.each,u=s.asc,c=function(t,e,i,n){this._dimName=t,this._axisIndex=e,this._valueWindow,this._percentWindow,this._dataExtent,this.ecModel=n,this._dataZoomModel=i};c.prototype={constructor:c,hostedBy:function(t){return this._dataZoomModel===t},getDataValueWindow:function(){return this._valueWindow.slice()},getDataPercentWindow:function(){return this._percentWindow.slice()},getTargetSeriesModels:function(){var t=[],e=this.ecModel;return e.eachSeries(function(i){if(l.isCoordSupported(i.get("coordinateSystem"))){var n=this._dimName,r=e.queryComponents({mainType:n+"Axis",index:i.get(n+"AxisIndex"),id:i.get(n+"AxisId")})[0];this._axisIndex===(r&&r.componentIndex)&&t.push(i)}},this),t},getAxisModel:function(){return this.ecModel.getComponent(this._dimName+"Axis",this._axisIndex)},getOtherAxisModel:function(){var t,e,i=this._dimName,n=this.ecModel,r=this.getAxisModel(),o="x"===i||"y"===i;o?(e="gridIndex",t="x"===i?"y":"x"):(e="polarIndex",t="angle"===i?"radius":"angle");var a;return n.eachComponent(t+"Axis",function(t){(t.get(e)||0)===(r.get(e)||0)&&(a=t)}),a},calculateDataWindow:function(t){var e=this._dataExtent,i=this.getAxisModel(),n=i.axis.scale,o=[0,100],a=[t.start,t.end],l=[];return e=e.slice(),r(e,i),h(["startValue","endValue"],function(e){l.push(null!=t[e]?n.parse(t[e]):null)}),h([0,1],function(t){var i=l[t],r=a[t];null!=r||null==i?(null==r&&(r=o[t]),i=n.parse(s.linearMap(r,o,e,!0))):r=s.linearMap(i,e,o,!0),l[t]=i,a[t]=r}),{valueWindow:u(l),percentWindow:u(a)}},reset:function(t){if(t===this._dataZoomModel){this._dataExtent=n(this._dimName,this.getTargetSeriesModels());var e=this.calculateDataWindow(t.option);this._valueWindow=e.valueWindow,this._percentWindow=e.percentWindow,o(this)}},restore:function(t){t===this._dataZoomModel&&(this._valueWindow=this._percentWindow=null,o(this,!0))},filterData:function(t){function e(t){return t>=o[0]&&t<=o[1]}if(t===this._dataZoomModel){var i=this._dimName,n=this.getTargetSeriesModels(),r=t.get("filterMode"),o=this._valueWindow,a=this.getOtherAxisModel();t.get("$fromToolbox")&&a&&"category"===a.get("type")&&(r="empty"),h(n,function(t){var n=t.getData();n&&h(t.coordDimToDataDim(i),function(i){"empty"===r?t.setData(n.map(i,function(t){return e(t)?t:NaN})):n.filterSelf(i,e)})})}}},t.exports=c},function(t,e,i){t.exports=i(40).extend({type:"dataZoom.inside",defaultOption:{disabled:!1,zoomLock:!1}})},function(t,e,i){function n(t){var e=[0,100];return!(t[0]<=e[1])&&(t[0]=e[1]),!(t[1]<=e[1])&&(t[1]=e[1]),!(t[0]>=e[0])&&(t[0]=e[0]),!(t[1]>=e[0])&&(t[1]=e[0]), -t}var r=i(41),o=i(1),a=i(85),s=i(189),l=o.bind,h=r.extend({type:"dataZoom.inside",init:function(t,e){this._range},render:function(t,e,i,n){h.superApply(this,"render",arguments),s.shouldRecordRange(n,t.id)&&(this._range=t.getPercentRange()),o.each(this.getTargetCoordInfo(),function(e,n){var r=o.map(e,function(t){return s.generateCoordId(t.model)});o.each(e,function(e){var o=e.model;s.register(i,{coordId:s.generateCoordId(o),allCoordIds:r,containsPoint:function(t,e){return o.coordinateSystem.containPoint([t,e])},dataZoomId:t.id,throttleRate:t.get("throttle",!0),panGetRange:l(this._onPan,this,e,n),zoomGetRange:l(this._onZoom,this,e,n)})},this)},this)},dispose:function(){s.unregister(this.api,this.dataZoomModel.id),h.superApply(this,"dispose",arguments),this._range=null},_onPan:function(t,e,i,n,r,o,s,l,h){if(this.dataZoomModel.option.disabled)return this._range;var c=this._range.slice(),d=t.axisModels[0];if(d){var f=u[e]([o,s],[l,h],d,i,t),p=f.signal*(c[1]-c[0])*f.pixel/f.pixelLength;return a(p,c,[0,100],"rigid"),this._range=c}},_onZoom:function(t,e,i,r,o,a){var s=this.dataZoomModel.option;if(s.disabled||s.zoomLock)return this._range;var l=this._range.slice(),h=t.axisModels[0];if(h){var c=u[e](null,[o,a],h,i,t),d=(c.pixel-c.pixelStart)/c.pixelLength*(l[1]-l[0])+l[0];return r=Math.max(1/r,0),l[0]=(l[0]-d)*r+d,l[1]=(l[1]-d)*r+d,this._range=n(l)}}}),u={grid:function(t,e,i,n,r){var o=i.axis,a={},s=r.model.coordinateSystem.getRect();return t=t||[0,0],"x"===o.dim?(a.pixel=e[0]-t[0],a.pixelLength=s.width,a.pixelStart=s.x,a.signal=o.inverse?1:-1):(a.pixel=e[1]-t[1],a.pixelLength=s.height,a.pixelStart=s.y,a.signal=o.inverse?-1:1),a},polar:function(t,e,i,n,r){var o=i.axis,a={},s=r.model.coordinateSystem,l=s.getRadiusAxis().getExtent(),h=s.getAngleAxis().getExtent();return t=t?s.pointToCoord(t):[0,0],e=s.pointToCoord(e),"radiusAxis"===i.mainType?(a.pixel=e[0]-t[0],a.pixelLength=l[1]-l[0],a.pixelStart=l[0],a.signal=o.inverse?1:-1):(a.pixel=e[1]-t[1],a.pixelLength=h[1]-h[0],a.pixelStart=h[0],a.signal=o.inverse?-1:1),a},singleAxis:function(t,e,i,n,r){var o=i.axis,a=r.model.coordinateSystem.getRect(),s={};return t=t||[0,0],"horizontal"===o.orient?(s.pixel=e[0]-t[0],s.pixelLength=a.width,s.pixelStart=a.x,s.signal=o.inverse?1:-1):(s.pixel=e[1]-t[1],s.pixelLength=a.height,s.pixelStart=a.y,s.signal=o.inverse?-1:1),s}};t.exports=h},function(t,e,i){var n=i(40);t.exports=n.extend({type:"dataZoom.select"})},function(t,e,i){t.exports=i(41).extend({type:"dataZoom.select"})},function(t,e,i){var n=i(40),r=n.extend({type:"dataZoom.slider",layoutMode:"box",defaultOption:{show:!0,right:"ph",top:"ph",width:"ph",height:"ph",left:null,bottom:null,backgroundColor:"rgba(47,69,84,0)",dataBackground:{lineStyle:{color:"#2f4554",width:.5,opacity:.3},areaStyle:{color:"rgba(47,69,84,0.3)",opacity:.3}},borderColor:"#ddd",fillerColor:"rgba(167,183,204,0.4)",handleIcon:"M8.2,13.6V3.9H6.3v9.7H3.1v14.9h3.3v9.7h1.8v-9.7h3.3V13.6H8.2z M9.7,24.4H4.8v-1.4h4.9V24.4z M9.7,19.1H4.8v-1.4h4.9V19.1z",handleSize:"100%",handleStyle:{color:"#a7b7cc"},labelPrecision:null,labelFormatter:null,showDetail:!0,showDataShadow:"auto",realtime:!0,zoomLock:!1,textStyle:{color:"#333"}}});t.exports=r},function(t,e,i){function n(t){var e={x:"y",y:"x",radius:"angle",angle:"radius"};return e[t]}var r=i(1),o=i(3),a=i(47),s=i(41),l=o.Rect,h=i(4),u=h.linearMap,c=i(12),d=i(85),f=h.asc,p=r.bind,g=r.each,m=7,v=1,y=30,x="horizontal",_="vertical",b=5,w=["line","bar","candlestick","scatter"],M=s.extend({type:"dataZoom.slider",init:function(t,e){this._displayables={},this._orient,this._range,this._handleEnds,this._size,this._handleWidth,this._handleHeight,this._location,this._dragging,this._dataShadowInfo,this.api=e},render:function(t,e,i,n){return M.superApply(this,"render",arguments),a.createOrUpdate(this,"_dispatchZoomAction",this.dataZoomModel.get("throttle"),"fixRate"),this._orient=t.get("orient"),this.dataZoomModel.get("show")===!1?void this.group.removeAll():(n&&"dataZoom"===n.type&&n.from===this.uid||this._buildView(),void this._updateView())},remove:function(){M.superApply(this,"remove",arguments),a.clear(this,"_dispatchZoomAction")},dispose:function(){M.superApply(this,"dispose",arguments),a.clear(this,"_dispatchZoomAction")},_buildView:function(){var t=this.group;t.removeAll(),this._resetLocation(),this._resetInterval();var e=this._displayables.barGroup=new o.Group;this._renderBackground(),this._renderHandle(),this._renderDataShadow(),t.add(e),this._positionGroup()},_resetLocation:function(){var t=this.dataZoomModel,e=this.api,i=this._findCoordRect(),n={width:e.getWidth(),height:e.getHeight()},o=this._orient===x?{right:n.width-i.x-i.width,top:n.height-y-m,width:i.width,height:y}:{right:m,top:i.y,width:y,height:i.height},a=c.getLayoutParams(t.option);r.each(["right","top","width","height"],function(t){"ph"===a[t]&&(a[t]=o[t])});var s=c.getLayoutRect(a,n,t.padding);this._location={x:s.x,y:s.y},this._size=[s.width,s.height],this._orient===_&&this._size.reverse()},_positionGroup:function(){var t=this.group,e=this._location,i=this._orient,n=this.dataZoomModel.getFirstTargetAxisModel(),r=n&&n.get("inverse"),o=this._displayables.barGroup,a=(this._dataShadowInfo||{}).otherAxisInverse;o.attr(i!==x||r?i===x&&r?{scale:a?[-1,1]:[-1,-1]}:i!==_||r?{scale:a?[-1,-1]:[-1,1],rotation:Math.PI/2}:{scale:a?[1,-1]:[1,1],rotation:Math.PI/2}:{scale:a?[1,1]:[1,-1]});var s=t.getBoundingRect([o]);t.attr("position",[e.x-s.x,e.y-s.y])},_getViewExtent:function(){return[0,this._size[0]]},_renderBackground:function(){var t=this.dataZoomModel,e=this._size;this._displayables.barGroup.add(new l({silent:!0,shape:{x:0,y:0,width:e[0],height:e[1]},style:{fill:t.get("backgroundColor")},z2:-40}))},_renderDataShadow:function(){var t=this._dataShadowInfo=this._prepareDataShadowInfo();if(t){var e=this._size,i=t.series,n=i.getRawData(),a=i.getShadowDim?i.getShadowDim():t.otherDim;if(null!=a){var s=n.getDataExtent(a),l=.3*(s[1]-s[0]);s=[s[0]-l,s[1]+l];var h,c=[0,e[1]],d=[0,e[0]],f=[[e[0],0],[0,0]],p=[],g=d[1]/(n.count()-1),m=0,v=Math.round(n.count()/e[0]);n.each([a],function(t,e){if(v>0&&e%v)return void(m+=g);var i=null==t||isNaN(t)||""===t,n=i?0:u(t,s,c,!0);i&&!h&&e?(f.push([f[f.length-1][0],0]),p.push([p[p.length-1][0],0])):!i&&h&&(f.push([m,0]),p.push([m,0])),f.push([m,n]),p.push([m,n]),m+=g,h=i});var y=this.dataZoomModel;this._displayables.barGroup.add(new o.Polygon({shape:{points:f},style:r.defaults({fill:y.get("dataBackgroundColor")},y.getModel("dataBackground.areaStyle").getAreaStyle()),silent:!0,z2:-20})),this._displayables.barGroup.add(new o.Polyline({shape:{points:p},style:y.getModel("dataBackground.lineStyle").getLineStyle(),silent:!0,z2:-19}))}}},_prepareDataShadowInfo:function(){var t=this.dataZoomModel,e=t.get("showDataShadow");if(e!==!1){var i,o=this.ecModel;return t.eachTargetAxis(function(a,s){var l=t.getAxisProxy(a.name,s).getTargetSeriesModels();r.each(l,function(t){if(!(i||e!==!0&&r.indexOf(w,t.get("type"))<0)){var l,h=o.getComponent(a.axis,s).axis,u=n(a.name),c=t.coordinateSystem;null!=u&&c.getOtherAxis&&(l=c.getOtherAxis(h).inverse),i={thisAxis:h,series:t,thisDim:a.name,otherDim:u,otherAxisInverse:l}}},this)},this),i}},_renderHandle:function(){var t=this._displayables,e=t.handles=[],i=t.handleLabels=[],n=this._displayables.barGroup,r=this._size,a=this.dataZoomModel;n.add(t.filler=new l({draggable:!0,cursor:"move",drift:p(this._onDragMove,this,"all"),ondragstart:p(this._showDataInfo,this,!0),ondragend:p(this._onDragEnd,this),onmouseover:p(this._showDataInfo,this,!0),onmouseout:p(this._showDataInfo,this,!1),style:{fill:a.get("fillerColor"),textPosition:"inside"}})),n.add(new l(o.subPixelOptimizeRect({silent:!0,shape:{x:0,y:0,width:r[0],height:r[1]},style:{stroke:a.get("dataBackgroundColor")||a.get("borderColor"),lineWidth:v,fill:"rgba(0,0,0,0)"}})));var s=a.get("handleIcon");g([0,1],function(t){var r=o.makePath(s,{style:{strokeNoScale:!0},rectHover:!0,cursor:"vertical"===this._orient?"ns-resize":"ew-resize",draggable:!0,drift:p(this._onDragMove,this,t),ondragend:p(this._onDragEnd,this),onmouseover:p(this._showDataInfo,this,!0),onmouseout:p(this._showDataInfo,this,!1)},{x:-.5,y:0,width:1,height:1},"center"),l=r.getBoundingRect();this._handleHeight=h.parsePercent(a.get("handleSize"),this._size[1]),this._handleWidth=l.width/l.height*this._handleHeight,r.setStyle(a.getModel("handleStyle").getItemStyle());var u=a.get("handleColor");null!=u&&(r.style.fill=u),n.add(e[t]=r);var c=a.textStyleModel;this.group.add(i[t]=new o.Text({silent:!0,invisible:!0,style:{x:0,y:0,text:"",textVerticalAlign:"middle",textAlign:"center",fill:c.getTextColor(),textFont:c.getFont()},z2:10}))},this)},_resetInterval:function(){var t=this._range=this.dataZoomModel.getPercentRange(),e=this._getViewExtent();this._handleEnds=[u(t[0],[0,100],e,!0),u(t[1],[0,100],e,!0)]},_updateInterval:function(t,e){var i=this._handleEnds,n=this._getViewExtent();d(e,i,n,"all"===t||this.dataZoomModel.get("zoomLock")?"rigid":"cross",t),this._range=f([u(i[0],n,[0,100],!0),u(i[1],n,[0,100],!0)])},_updateView:function(t){var e=this._displayables,i=this._handleEnds,n=f(i.slice()),r=this._size;g([0,1],function(t){var n=e.handles[t],o=this._handleHeight;n.attr({scale:[o,o],position:[i[t],r[1]/2-o/2]})},this),e.filler.setShape({x:n[0],y:0,width:n[1]-n[0],height:r[1]}),this._updateDataInfo(t)},_updateDataInfo:function(t){function e(t){var e=o.getTransform(n.handles[t].parent,this.group),i=o.transformDirection(0===t?"right":"left",e),l=this._handleWidth/2+b,h=o.applyTransform([d[t]+(0===t?-l:l),this._size[1]/2],e);r[t].setStyle({x:h[0],y:h[1],textVerticalAlign:a===x?"middle":i,textAlign:a===x?i:"center",text:s[t]})}var i=this.dataZoomModel,n=this._displayables,r=n.handleLabels,a=this._orient,s=["",""];if(i.get("showDetail")){var l=i.findRepresentativeAxisProxy();if(l){var h=l.getAxisModel().axis,u=this._range,c=t?l.calculateDataWindow({start:u[0],end:u[1]}).valueWindow:l.getDataValueWindow();s=[this._formatLabel(c[0],h),this._formatLabel(c[1],h)]}}var d=f(this._handleEnds.slice());e.call(this,0),e.call(this,1)},_formatLabel:function(t,e){var i=this.dataZoomModel,n=i.get("labelFormatter"),o=i.get("labelPrecision");null!=o&&"auto"!==o||(o=e.getPixelPrecision());var a=null==t||isNaN(t)?"":"category"===e.type||"time"===e.type?e.scale.getLabel(Math.round(t)):t.toFixed(Math.min(o,20));return r.isFunction(n)?n(t,a):r.isString(n)?n.replace("{value}",a):a},_showDataInfo:function(t){t=this._dragging||t;var e=this._displayables.handleLabels;e[0].attr("invisible",!t),e[1].attr("invisible",!t)},_onDragMove:function(t,e,i){this._dragging=!0;var n=this._applyBarTransform([e,i],!0);this._updateInterval(t,n[0]);var r=this.dataZoomModel.get("realtime");this._updateView(!r),r&&r&&this._dispatchZoomAction()},_onDragEnd:function(){this._dragging=!1,this._showDataInfo(!1),this._dispatchZoomAction()},_dispatchZoomAction:function(){var t=this._range;this.api.dispatchAction({type:"dataZoom",from:this.uid,dataZoomId:this.dataZoomModel.id,start:t[0],end:t[1]})},_applyBarTransform:function(t,e){var i=this._displayables.barGroup.getLocalTransform();return o.applyTransform(t,i,e)},_findCoordRect:function(){var t;if(g(this.getTargetCoordInfo(),function(e){if(!t&&e.length){var i=e[0].model.coordinateSystem;t=i.getRect&&i.getRect()}}),!t){var e=this.api.getWidth(),i=this.api.getHeight();t={x:.2*e,y:.2*i,width:.6*e,height:.6*i}}return t}});t.exports=M},function(t,e,i){function n(t){var e=t.getZr();return e[p]||(e[p]={})}function r(t,e,i){var n=new c(t.getZr());return n.enable(),n.on("pan",f(a,i)),n.on("zoom",f(s,i)),n}function o(t){u.each(t,function(e,i){e.count||(e.controller.dispose(),delete t[i])})}function a(t,e,i,n,r,o,a){l(t,function(s){return s.panGetRange(t.controller,e,i,n,r,o,a)})}function s(t,e,i,n){l(t,function(r){return r.zoomGetRange(t.controller,e,i,n)})}function l(t,e){var i=[];u.each(t.dataZoomInfos,function(t){var n=e(t);n&&i.push({dataZoomId:t.dataZoomId,start:n[0],end:n[1]})}),t.dispatchAction(i)}function h(t,e){t.dispatchAction({type:"dataZoom",batch:e})}var u=i(1),c=i(84),d=i(47),f=u.curry,p="\0_ec_dataZoom_roams",g={register:function(t,e){var i=n(t),a=e.dataZoomId,s=e.coordId;u.each(i,function(t,i){var n=t.dataZoomInfos;n[a]&&u.indexOf(e.allCoordIds,s)<0&&(delete n[a],t.count--)}),o(i);var l=i[s];l||(l=i[s]={coordId:s,dataZoomInfos:{},count:0},l.controller=r(t,e,l),l.dispatchAction=u.curry(h,t)),l.controller.setContainsPoint(e.containsPoint),d.createOrUpdate(l,"dispatchAction",e.throttleRate,"fixRate"),!l.dataZoomInfos[a]&&l.count++,l.dataZoomInfos[a]=e},unregister:function(t,e){var i=n(t);u.each(i,function(t){t.controller.dispose();var i=t.dataZoomInfos;i[e]&&(delete i[e],t.count--)}),o(i)},shouldRecordRange:function(t,e){if(t&&"dataZoom"===t.type&&t.batch)for(var i=0,n=t.batch.length;i=0;d--)null==r[d]?r.splice(d,1):delete r[d].$action},_flatten:function(t,e,i){l.each(t,function(t){if(t){i&&(t.parentOption=i),e.push(t);var n=t.children;"group"===t.type&&n&&this._flatten(n,e,t),delete t.children}},this)},useElOptionsToUpdate:function(){var t=this._elOptionsToUpdate;return this._elOptionsToUpdate=null,t}});s.extendComponentView({type:"graphic",init:function(t,e){this._elMap={},this._lastGraphicModel},render:function(t,e,i){t!==this._lastGraphicModel&&this._clear(),this._lastGraphicModel=t,this._updateElements(t,i),this._relocate(t,i)},_updateElements:function(t,e){var i=t.useElOptionsToUpdate();if(i){var a=this._elMap,s=this.group;l.each(i,function(t){var e=t.$action,i=t.id,h=a[i],u=t.parentId,c=null!=u?a[u]:s;t.hv&&t.hv[1]&&"text"===t.type&&(t.style=l.defaults({textBaseline:"middle"},t.style),t.style.textVerticalAlign=null);var d=o(t);e&&"merge"!==e?"replace"===e?(r(h,a),n(i,c,d,a)):"remove"===e&&r(h,a):h?h.attr(d):n(i,c,d,a),a[i]&&(a[i].__ecGraphicWidth=t.width,a[i].__ecGraphicHeight=t.height)})}},_relocate:function(t,e){for(var i=t.option.elements,n=this.group,r=this._elMap,o=i.length-1;o>=0;o--){var a=i[o],s=r[a.id];if(s){var l=s.parent,h=l===n?{width:e.getWidth(),height:e.getHeight()}:{width:l.__ecGraphicWidth||0,height:l.__ecGraphicHeight||0};c.positionElement(s,a,h,null,{hv:a.hv,boundingMode:a.bounding})}}},_clear:function(){var t=this._elMap;l.each(t,function(e){r(e,t)}),this._elMap={}},dispose:function(){this._clear()}})},function(t,e,i){i(193),i(195),i(194);var n=i(2);n.registerProcessor(i(196))},function(t,e,i){"use strict";var n=i(1),r=i(11),o=i(2).extendComponentModel({type:"legend",dependencies:["series"],layoutMode:{type:"box",ignoreSize:!0},init:function(t,e,i){this.mergeDefaultAndTheme(t,i),t.selected=t.selected||{}},mergeOption:function(t){o.superCall(this,"mergeOption",t)},optionUpdated:function(){this._updateData(this.ecModel);var t=this._data;if(t[0]&&"single"===this.get("selectedMode")){for(var e=!1,i=0;i=0},defaultOption:{zlevel:0,z:4,show:!0,orient:"horizontal",left:"center",top:"top",align:"auto",backgroundColor:"rgba(0,0,0,0)",borderColor:"#ccc",borderWidth:0,padding:5,itemGap:10,itemWidth:25,itemHeight:14,inactiveColor:"#ccc",textStyle:{color:"#333"},selectedMode:!0,tooltip:{show:!1}}});t.exports=o},function(t,e,i){function n(t,e){e.dispatchAction({type:"legendToggleSelect",name:t})}function r(t,e,i){var n=i.getZr().storage.getDisplayList()[0];n&&n.useHoverLayer||t.get("legendHoverLink")&&i.dispatchAction({type:"highlight",seriesName:t.name,name:e})}function o(t,e,i){var n=i.getZr().storage.getDisplayList()[0];n&&n.useHoverLayer||t.get("legendHoverLink")&&i.dispatchAction({type:"downplay",seriesName:t.name,name:e})}var a=i(1),s=i(24),l=i(3),h=i(118),u=a.curry;t.exports=i(2).extendComponentView({type:"legend",init:function(){this._symbolTypeStore={}},render:function(t,e,i){var s=this.group;if(s.removeAll(),t.get("show")){var c=t.get("selectedMode"),d=t.get("align");"auto"===d&&(d="right"===t.get("left")&&"vertical"===t.get("orient")?"right":"left");var f={};a.each(t.getData(),function(a){var h=a.get("name");if(""===h||"\n"===h)return void s.add(new l.Group({newline:!0}));var p=e.getSeriesByName(h)[0];if(!f[h])if(p){var g=p.getData(),m=g.getVisual("color");"function"==typeof m&&(m=m(p.getDataParams(0)));var v=g.getVisual("legendSymbol")||"roundRect",y=g.getVisual("symbol"),x=this._createItem(h,a,t,v,y,d,m,c);x.on("click",u(n,h,i)).on("mouseover",u(r,p,null,i)).on("mouseout",u(o,p,null,i)),f[h]=!0}else e.eachRawSeries(function(e){if(!f[h]&&e.legendDataProvider){var s=e.legendDataProvider(),l=s.indexOfName(h);if(l<0)return;var p=s.getItemVisual(l,"color"),g="roundRect",m=this._createItem(h,a,t,g,null,d,p,c);m.on("click",u(n,h,i)).on("mouseover",u(r,e,h,i)).on("mouseout",u(o,e,h,i)),f[h]=!0}},this)},this),h.layout(s,t,i),h.addBackground(s,t)}},_createItem:function(t,e,i,n,r,o,h,u){var c=i.get("itemWidth"),d=i.get("itemHeight"),f=i.get("inactiveColor"),p=i.isSelected(t),g=new l.Group,m=e.getModel("textStyle"),v=e.get("icon"),y=e.getModel("tooltip"),x=y.parentModel;if(n=v||n,g.add(s.createSymbol(n,0,0,c,d,p?h:f)),!v&&r&&(r!==n||"none"==r)){var _=.8*d;"none"===r&&(r="circle"),g.add(s.createSymbol(r,(c-_)/2,(d-_)/2,_,_,p?h:f))}var b="left"===o?c+5:-5,w=o,M=i.get("formatter"),S=t;"string"==typeof M&&M?S=M.replace("{name}",null!=t?t:""):"function"==typeof M&&(S=M(t));var T=new l.Text({style:{text:S,x:b,y:d/2,fill:p?m.getTextColor():f,textFont:m.getFont(),textAlign:w,textVerticalAlign:"middle"}});g.add(T);var A=new l.Rect({shape:g.getBoundingRect(),invisible:!0,tooltip:y.get("show")?a.extend({content:t,formatter:x.get("formatter",!0)||function(){return t},formatterParams:{componentType:"legend",legendIndex:i.componentIndex,name:t,$vars:["name"]}},y.option):null});return g.add(A),g.eachChild(function(t){t.silent=!0}),A.silent=!u,this.group.add(g),l.setHoverStyle(g),g}})},function(t,e,i){function n(t,e,i){var n,r={},a="toggleSelected"===t;return i.eachComponent("legend",function(i){a&&null!=n?i[n?"select":"unSelect"](e.name):(i[t](e.name),n=i.isSelected(e.name));var s=i.getData();o.each(s,function(t){var e=t.get("name");if("\n"!==e&&""!==e){var n=i.isSelected(e);e in r?r[e]=r[e]&&n:r[e]=n}})}),{name:e.name,selected:r}}var r=i(2),o=i(1);r.registerAction("legendToggleSelect","legendselectchanged",o.curry(n,"toggleSelected")),r.registerAction("legendSelect","legendselected",o.curry(n,"select")),r.registerAction("legendUnSelect","legendunselected",o.curry(n,"unSelect"))},function(t,e){t.exports=function(t){var e=t.findComponents({mainType:"legend"});e&&e.length&&t.filterSeries(function(t){for(var i=0;i=0&&"number"==typeof h&&(h=+h.toFixed(m)),p.coord[d]=g.coord[d]=h,n=[p,g,{type:o,valueIndex:n.valueIndex,value:h}]}return n=[c.dataTransform(t,n[0]),c.dataTransform(t,n[1]),l.extend({},n[2])],n[2].type=n[2].type||"",l.merge(n[2],n[0]),l.merge(n[2],n[1]),n};i(71).extend({type:"markLine",updateLayout:function(t,e,i){e.eachSeries(function(t){var e=t.markLineModel;if(e){var n=e.getData(),r=e.__from,o=e.__to;r.each(function(e){a(r,e,!0,t,i),a(o,e,!1,t,i)}),n.each(function(t){n.setItemLayout(t,[r.getItemLayout(t),o.getItemLayout(t)])}),this.markerGroupMap[t.name].updateLayout()}},this)},renderSeries:function(t,e,i,n){function r(e,i,r){var o=e.getItemModel(i);a(e,i,r,t,n),e.setItemVisual(i,{symbolSize:o.get("symbolSize")||x[r?0:1],symbol:o.get("symbol",!0)||y[r?0:1],color:o.get("itemStyle.normal.color")||u.getVisual("color")})}var o=t.coordinateSystem,h=t.name,u=t.getData(),c=this.markerGroupMap,f=c[h];f||(f=c[h]=new d),this.group.add(f.group);var p=s(o,t,e),g=p.from,m=p.to,v=p.line;e.__from=g,e.__to=m,e.setData(v);var y=e.get("symbol"),x=e.get("symbolSize");l.isArray(y)||(y=[y,y]),"number"==typeof x&&(x=[x,x]),p.from.each(function(t){r(g,t,!0),r(m,t,!1)}),v.each(function(t){var e=v.getItemModel(t).get("lineStyle.normal.color");v.setItemVisual(t,{color:e||g.getItemVisual(t,"color")}),v.setItemLayout(t,[g.getItemLayout(t),m.getItemLayout(t)]),v.setItemVisual(t,{fromSymbolSize:g.getItemVisual(t,"symbolSize"),fromSymbol:g.getItemVisual(t,"symbol"),toSymbolSize:m.getItemVisual(t,"symbolSize"),toSymbol:m.getItemVisual(t,"symbol")})}),f.updateData(v),p.line.eachItemGraphicEl(function(t,i){t.traverse(function(t){t.dataModel=e})}),f.__keep=!0,f.group.silent=e.get("silent")||t.get("silent")}})},function(t,e,i){t.exports=i(70).extend({type:"markPoint",defaultOption:{zlevel:0,z:5,symbol:"pin",symbolSize:50,tooltip:{trigger:"item"},label:{normal:{show:!0,position:"inside"},emphasis:{show:!0}},itemStyle:{normal:{borderWidth:2}}}})},function(t,e,i){function n(t,e,i){var n=e.coordinateSystem;t.each(function(r){var o,a=t.getItemModel(r),l=s.parsePercent(a.get("x"),i.getWidth()),h=s.parsePercent(a.get("y"),i.getHeight());if(isNaN(l)||isNaN(h)){if(e.getMarkerPosition)o=e.getMarkerPosition(t.getValues(t.dimensions,r));else if(n){var u=t.get(n.dimensions[0],r),c=t.get(n.dimensions[1],r);o=n.dataToPoint([u,c])}}else o=[l,h];isNaN(l)||(o[0]=l),isNaN(h)||(o[1]=h),t.setItemLayout(r,o)})}function r(t,e,i){var n;n=t?a.map(t&&t.dimensions,function(t){var i=e.getData().getDimensionInfo(e.coordDimToDataDim(t)[0])||{};return i.name=t,i}):[{name:"value",type:"float"}];var r=new l(n,i),o=a.map(i.get("data"),a.curry(h.dataTransform,e));return t&&(o=a.filter(o,a.curry(h.dataFilter,t))),r.initData(o,null,t?h.dimValueGetter:function(t){return t.value}),r}var o=i(39),a=i(1),s=i(4),l=i(14),h=i(72);i(71).extend({type:"markPoint",updateLayout:function(t,e,i){e.eachSeries(function(t){var e=t.markPointModel;e&&(n(e.getData(),t,i),this.markerGroupMap[t.name].updateLayout(e))},this)},renderSeries:function(t,e,i,a){var s=t.coordinateSystem,l=t.name,h=t.getData(),u=this.markerGroupMap,c=u[l];c||(c=u[l]=new o);var d=r(s,t,e);e.setData(d),n(e.getData(),t,a),d.each(function(t){var i=d.getItemModel(t),n=i.getShallow("symbolSize");"function"==typeof n&&(n=n(e.getRawValue(t),e.getDataParams(t))),d.setItemVisual(t,{symbolSize:n,color:i.get("itemStyle.normal.color")||h.getVisual("color"),symbol:i.getShallow("symbol")})}),c.updateData(d),this.group.add(c.group),d.eachItemGraphicEl(function(t){t.traverse(function(t){t.dataModel=e})}),c.__keep=!0,c.group.silent=e.get("silent")||t.get("silent")}})},function(t,e,i){"use strict";var n=i(2),r=i(3),o=i(12);n.extendComponentModel({type:"title",layoutMode:{type:"box",ignoreSize:!0},defaultOption:{zlevel:0,z:6,show:!0,text:"",target:"blank",subtext:"",subtarget:"blank",left:0,top:0,backgroundColor:"rgba(0,0,0,0)",borderColor:"#ccc",borderWidth:0,padding:5,itemGap:10,textStyle:{fontSize:18,fontWeight:"bolder",color:"#333"},subtextStyle:{color:"#aaa"}}}),n.extendComponentView({type:"title",render:function(t,e,i){if(this.group.removeAll(),t.get("show")){var n=this.group,a=t.getModel("textStyle"),s=t.getModel("subtextStyle"),l=t.get("textAlign"),h=t.get("textBaseline"),u=new r.Text({ -style:{text:t.get("text"),textFont:a.getFont(),fill:a.getTextColor()},z2:10}),c=u.getBoundingRect(),d=t.get("subtext"),f=new r.Text({style:{text:d,textFont:s.getFont(),fill:s.getTextColor(),y:c.height+t.get("itemGap"),textBaseline:"top"},z2:10}),p=t.get("link"),g=t.get("sublink");u.silent=!p,f.silent=!g,p&&u.on("click",function(){window.open(p,"_"+t.get("target"))}),g&&f.on("click",function(){window.open(g,"_"+t.get("subtarget"))}),n.add(u),d&&n.add(f);var m=n.getBoundingRect(),v=t.getBoxLayoutParams();v.width=m.width,v.height=m.height;var y=o.getLayoutRect(v,{width:i.getWidth(),height:i.getHeight()},t.get("padding"));l||(l=t.get("left")||t.get("right"),"middle"===l&&(l="center"),"right"===l?y.x+=y.width:"center"===l&&(y.x+=y.width/2)),h||(h=t.get("top")||t.get("bottom"),"center"===h&&(h="middle"),"bottom"===h?y.y+=y.height:"middle"===h&&(y.y+=y.height/2),h=h||"top"),n.attr("position",[y.x,y.y]);var x={textAlign:l,textVerticalAlign:h};u.setStyle(x),f.setStyle(x),m=n.getBoundingRect();var _=y.margin,b=t.getItemStyle(["color","opacity"]);b.fill=t.get("backgroundColor");var w=new r.Rect({shape:{x:m.x-_[3],y:m.y-_[0],width:m.width+_[1]+_[3],height:m.height+_[0]+_[2]},style:b,silent:!0});r.subPixelOptimizeRect(w),n.add(w)}}})},function(t,e,i){i(208),i(209),i(214),i(212),i(210),i(211),i(213)},function(t,e,i){var n=i(26),r=i(1),o=i(2).extendComponentModel({type:"toolbox",layoutMode:{type:"box",ignoreSize:!0},mergeDefaultAndTheme:function(t){o.superApply(this,"mergeDefaultAndTheme",arguments),r.each(this.option.feature,function(t,e){var i=n.get(e);i&&r.merge(t,i.defaultOption)})},defaultOption:{show:!0,z:6,zlevel:0,orient:"horizontal",left:"right",top:"top",backgroundColor:"transparent",borderColor:"#ccc",borderWidth:0,padding:5,itemSize:15,itemGap:8,showTitle:!0,iconStyle:{normal:{borderColor:"#666",color:"none"},emphasis:{borderColor:"#3E98C5"}}}});t.exports=o},function(t,e,i){(function(e){function n(t){return 0===t.indexOf("my")}var r=i(26),o=i(1),a=i(3),s=i(11),l=i(43),h=i(118),u=i(17);t.exports=i(2).extendComponentView({type:"toolbox",render:function(t,e,i,c){function d(o,a){var l,h=y[o],u=y[a],d=m[h],p=new s(d,t,t.ecModel);if(h&&!u){if(n(h))l={model:p,onclick:p.option.onclick,featureName:h};else{var g=r.get(h);if(!g)return;l=new g(p,e,i)}v[h]=l}else{if(l=v[u],!l)return;l.model=p,l.ecModel=e,l.api=i}return!h&&u?void(l.dispose&&l.dispose(e,i)):!p.get("show")||l.unusable?void(l.remove&&l.remove(e,i)):(f(p,l,h),p.setIconStatus=function(t,e){var i=this.option,n=this.iconPaths;i.iconStatus=i.iconStatus||{},i.iconStatus[t]=e,n[t]&&n[t].trigger(e)},void(l.render&&l.render(p,e,i,c)))}function f(n,r,s){var l=n.getModel("iconStyle"),h=r.getIcons?r.getIcons():n.get("icon"),u=n.get("title")||{};if("string"==typeof h){var c=h,d=u;h={},u={},h[s]=c,u[s]=d}var f=n.iconPaths={};o.each(h,function(s,h){var c=l.getModel("normal").getItemStyle(),d=l.getModel("emphasis").getItemStyle(),m={x:-g/2,y:-g/2,width:g,height:g},v=0===s.indexOf("image://")?(m.image=s.slice(8),new a.Image({style:m})):a.makePath(s.replace("path://",""),{style:c,hoverStyle:d,rectHover:!0},m,"center");a.setHoverStyle(v),t.get("showTitle")&&(v.__title=u[h],v.on("mouseover",function(){var t=l.getModel("emphasis").getItemStyle();v.setStyle({text:u[h],textPosition:t.textPosition||"bottom",textFill:t.fill||t.stroke||"#000",textAlign:t.textAlign||"center"})}).on("mouseout",function(){v.setStyle({textFill:null})})),v.trigger(n.get("iconStatus."+h)||"normal"),p.add(v),v.on("click",o.bind(r.onclick,r,e,i,h)),f[h]=v})}var p=this.group;if(p.removeAll(),t.get("show")){var g=+t.get("itemSize"),m=t.get("feature")||{},v=this._features||(this._features={}),y=[];o.each(m,function(t,e){y.push(e)}),new l(this._featureNames||[],y).add(d).update(d).remove(o.curry(d,null)).execute(),this._featureNames=y,h.layout(p,t,i),h.addBackground(p,t),p.eachChild(function(t){var e=t.__title,n=t.hoverStyle;if(n&&e){var r=u.getBoundingRect(e,n.font),o=t.position[0]+p.position[0],a=t.position[1]+p.position[1]+g,s=!1;a+r.height>i.getHeight()&&(n.textPosition="top",s=!0);var l=s?-5-r.height:g+8;o+r.width/2>i.getWidth()?(n.textPosition=["100%",l],n.textAlign="right"):o-r.width/2<0&&(n.textPosition=[0,l],n.textAlign="left")}})}},updateView:function(t,e,i,n){o.each(this._features,function(t){t.updateView&&t.updateView(t.model,e,i,n)})},updateLayout:function(t,e,i,n){o.each(this._features,function(t){t.updateLayout&&t.updateLayout(t.model,e,i,n)})},remove:function(t,e){o.each(this._features,function(i){i.remove&&i.remove(t,e)}),this.group.removeAll()},dispose:function(t,e){o.each(this._features,function(i){i.dispose&&i.dispose(t,e)})}})}).call(e,i(175))},function(t,e,i){function n(t){var e={},i=[],n=[];return t.eachRawSeries(function(t){var r=t.coordinateSystem;if(!r||"cartesian2d"!==r.type&&"polar"!==r.type)i.push(t);else{var o=r.getBaseAxis();if("category"===o.type){var a=o.dim+"_"+o.index;e[a]||(e[a]={categoryAxis:o,valueAxis:r.getOtherAxis(o),series:[]},n.push({axisDim:o.dim,axisIndex:o.index})),e[a].series.push(t)}else i.push(t)}}),{seriesGroupByCategoryAxis:e,other:i,meta:n}}function r(t){var e=[];return p.each(t,function(t,i){var n=t.categoryAxis,r=t.valueAxis,o=r.dim,a=[" "].concat(p.map(t.series,function(t){return t.name})),s=[n.model.getCategories()];p.each(t.series,function(t){s.push(t.getRawData().mapArray(o,function(t){return t}))});for(var l=[a.join(v)],h=0;h=0)return!0}function h(t){for(var e=t.split(/\n+/g),i=s(e.shift()).split(y),n=[],r=p.map(i,function(t){return{name:t,data:[]}}),o=0;o1?"emphasis":"normal")}function a(t,e,i,n){var o=i._isZoomActive;n&&"takeGlobalCursor"===n.type&&(o="dataZoomSelect"===n.key&&n.dataZoomSelectActive),i._isZoomActive=o,t.setIconStatus("zoom",o?"emphasis":"normal");var a=h.makeCoordInfoList(r(t.option),e),s=a.xAxisHas&&!a.yAxisHas?"lineX":!a.xAxisHas&&a.yAxisHas?"lineY":"rect";i._brushController.setPanels(h.makePanelOpts(a)).enableBrush(!!o&&{brushType:s,brushStyle:{lineWidth:0,fill:"rgba(0,0,0,0.2)"}})}var s=i(1),l=i(115),h=i(116),u=i(113),c=s.each;i(190);var d="\0_ec_\0toolbox-dataZoom_";n.defaultOption={show:!0,icon:{zoom:"M0,13.5h26.9 M13.5,26.9V0 M32.1,13.5H58V58H13.5 V32.1",back:"M22,1.4L9.9,13.5l12.3,12.3 M10.3,13.5H54.9v44.6 H10.3v-26"},title:{zoom:"区域缩放",back:"区域缩放还原"}};var f=n.prototype;f.render=function(t,e,i,n){this.model=t,this.ecModel=e,this.api=i,a(t,e,this,n),o(t,e)},f.onclick=function(t,e,i){p[i].call(this)},f.remove=function(t,e){this._brushController.unmount()},f.dispose=function(t,e){this._brushController.dispose()};var p={zoom:function(){var t=!this._isZoomActive;this.api.dispatchAction({type:"takeGlobalCursor",key:"dataZoomSelect",dataZoomSelectActive:t})},back:function(){this._dispatchZoomAction(u.pop(this.ecModel))}};f._onBrush=function(t,e){function i(t,e,i){var r=n(t,i[t],a);r&&(o[r.id]={dataZoomId:r.id,startValue:e[0],endValue:e[1]})}function n(t,e,i){var n;return i.eachComponent({mainType:"dataZoom",subType:"select"},function(r,o){var a=r.get(t+"Index");null!=a&&i.getComponent(t,a)===e&&(n=r)}),n}if(e.isEnd&&t.length){var o={},a=this.ecModel;this._brushController.updateCovers([]);var s=h.makeCoordInfoList(r(this.model.option),a),l=[];h.parseOutputRanges(t,s,a,l);var c=t[0],d=l[0],f=c.coordRange,p=c.brushType;if(d&&f)if("rect"===p)i("xAxis",f[0],d),i("yAxis",f[1],d);else{var g={lineX:"xAxis",lineY:"yAxis"};i(g[p],f,d)}u.push(a,o),this._dispatchZoomAction(o)}},f._dispatchZoomAction=function(t){var e=[];c(t,function(t,i){e.push(s.clone(t))}),e.length&&this.api.dispatchAction({type:"dataZoom",from:this.uid,batch:e})},i(26).register("dataZoom",n),i(2).registerPreprocessor(function(t){function e(t,e){if(e){var r=t+"Index",o=e[r];null==o||"all"==o||s.isArray(o)||(o=o===!1||"none"===o?[]:[o]),i(t,function(e,i){if(null==o||"all"==o||s.indexOf(o,i)!==-1){var a={type:"select",$fromToolbox:!0,id:d+t+i};a[r]=i,n.push(a)}})}}function i(e,i){var n=t[e];s.isArray(n)||(n=n?[n]:[]),c(n,i)}if(t){var n=t.dataZoom||(t.dataZoom=[]);s.isArray(n)||(t.dataZoom=n=[n]);var r=t.toolbox;if(r&&(s.isArray(r)&&(r=r[0]),r&&r.feature)){var o=r.feature.dataZoom;e("xAxis",o),e("yAxis",o)}}}),t.exports=n},function(t,e,i){"use strict";function n(t){this.model=t}var r=i(1);n.defaultOption={show:!0,type:[],icon:{line:"M4.1,28.9h7.1l9.3-22l7.4,38l9.7-19.7l3,12.8h14.9M4.1,58h51.4",bar:"M6.7,22.9h10V48h-10V22.9zM24.9,13h10v35h-10V13zM43.2,2h10v46h-10V2zM3.1,58h53.7",stack:"M8.2,38.4l-8.4,4.1l30.6,15.3L60,42.5l-8.1-4.1l-21.5,11L8.2,38.4z M51.9,30l-8.1,4.2l-13.4,6.9l-13.9-6.9L8.2,30l-8.4,4.2l8.4,4.2l22.2,11l21.5-11l8.1-4.2L51.9,30z M51.9,21.7l-8.1,4.2L35.7,30l-5.3,2.8L24.9,30l-8.4-4.1l-8.3-4.2l-8.4,4.2L8.2,30l8.3,4.2l13.9,6.9l13.4-6.9l8.1-4.2l8.1-4.1L51.9,21.7zM30.4,2.2L-0.2,17.5l8.4,4.1l8.3,4.2l8.4,4.2l5.5,2.7l5.3-2.7l8.1-4.2l8.1-4.2l8.1-4.1L30.4,2.2z",tiled:"M2.3,2.2h22.8V25H2.3V2.2z M35,2.2h22.8V25H35V2.2zM2.3,35h22.8v22.8H2.3V35z M35,35h22.8v22.8H35V35z"},title:{line:"切换为折线图",bar:"切换为柱状图",stack:"切换为堆叠",tiled:"切换为平铺"},option:{},seriesIndex:{}};var o=n.prototype;o.getIcons=function(){var t=this.model,e=t.get("icon"),i={};return r.each(t.get("type"),function(t){e[t]&&(i[t]=e[t])}),i};var a={line:function(t,e,i,n){if("bar"===t)return r.merge({id:e,type:"line",data:i.get("data"),stack:i.get("stack"),markPoint:i.get("markPoint"),markLine:i.get("markLine")},n.get("option.line")||{},!0)},bar:function(t,e,i,n){if("line"===t)return r.merge({id:e,type:"bar",data:i.get("data"),stack:i.get("stack"),markPoint:i.get("markPoint"),markLine:i.get("markLine")},n.get("option.bar")||{},!0)},stack:function(t,e,i,n){if("line"===t||"bar"===t)return r.merge({id:e,stack:"__ec_magicType_stack__"},n.get("option.stack")||{},!0)},tiled:function(t,e,i,n){if("line"===t||"bar"===t)return r.merge({id:e,stack:""},n.get("option.tiled")||{},!0)}},s=[["line","bar"],["stack","tiled"]];o.onclick=function(t,e,i){var n=this.model,o=n.get("seriesIndex."+i);if(a[i]){var l={series:[]},h=function(e){var o=e.subType,s=e.id,h=a[i](o,s,e,n);h&&(r.defaults(h,e.option),l.series.push(h));var u=e.coordinateSystem;if(u&&"cartesian2d"===u.type&&("line"===i||"bar"===i)){var c=u.getAxesByScale("ordinal")[0];if(c){var d=c.dim,f=d+"Axis",p=t.queryComponents({mainType:f,index:e.get(name+"Index"),id:e.get(name+"Id")})[0],g=p.componentIndex;l[f]=l[f]||[];for(var m=0;m<=g;m++)l[f][g]=l[f][g]||{};l[f][g].boundaryGap="bar"===i}}};r.each(s,function(t){r.indexOf(t,i)>=0&&r.each(t,function(t){n.setIconStatus(t,"normal")})}),n.setIconStatus(i,"emphasis"),t.eachComponent({mainType:"series",query:null==o?null:{seriesIndex:o}},h),e.dispatchAction({type:"changeMagicType",currentType:i,newOption:l})}};var l=i(2);l.registerAction({type:"changeMagicType",event:"magicTypeChanged",update:"prepareAndUpdate"},function(t,e){e.mergeOption(t.newOption)}),i(26).register("magicType",n),t.exports=n},function(t,e,i){"use strict";function n(t){this.model=t}var r=i(113);n.defaultOption={show:!0,icon:"M3.8,33.4 M47,18.9h9.8V8.7 M56.3,20.1 C52.1,9,40.5,0.6,26.8,2.1C12.6,3.7,1.6,16.2,2.1,30.6 M13,41.1H3.1v10.2 M3.7,39.9c4.2,11.1,15.8,19.5,29.5,18 c14.2-1.6,25.2-14.1,24.7-28.5",title:"还原"};var o=n.prototype;o.onclick=function(t,e,i){r.clear(t),e.dispatchAction({type:"restore",from:this.uid})},i(26).register("restore",n),i(2).registerAction({type:"restore",event:"restore",update:"prepareAndUpdate"},function(t,e){e.resetOption("recreate")}),t.exports=n},function(t,e,i){function n(t){this.model=t}var r=i(10);n.defaultOption={show:!0,icon:"M4.7,22.9L29.3,45.5L54.7,23.4M4.6,43.6L4.6,58L53.8,58L53.8,43.6M29.2,45.1L29.2,0",title:"保存为图片",type:"png",name:"",excludeComponents:["toolbox"],pixelRatio:1,lang:["右键另存为图片"]},n.prototype.unusable=!r.canvasSupported;var o=n.prototype;o.onclick=function(t,e){var i=this.model,n=i.get("name")||t.get("title.0.text")||"echarts",o=document.createElement("a"),a=i.get("type",!0)||"png";o.download=n+"."+a,o.target="_blank";var s=e.getConnectedDataURL({type:a,backgroundColor:i.get("backgroundColor",!0)||t.get("backgroundColor")||"#fff",excludeComponents:i.get("excludeComponents"),pixelRatio:i.get("pixelRatio")});if(o.href=s,"function"!=typeof MouseEvent||r.browser.ie||r.browser.edge){var l=i.get("lang"),h='',u=window.open();u.document.write(h)}else{var c=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!1});o.dispatchEvent(c)}},i(26).register("saveAsImage",n),t.exports=n},function(t,e,i){i(217),i(218),i(2).registerAction({type:"showTip",event:"showTip",update:"tooltip:manuallyShowTip"},function(){}),i(2).registerAction({type:"hideTip",event:"hideTip",update:"tooltip:manuallyHideTip"},function(){})},function(t,e,i){function n(t){var e="cubic-bezier(0.23, 1, 0.32, 1)",i="left "+t+"s "+e+",top "+t+"s "+e;return s.map(p,function(t){return t+"transition:"+i}).join(";")}function r(t){var e=[],i=t.get("fontSize"),n=t.getTextColor();return n&&e.push("color:"+n),e.push("font:"+t.getFont()),i&&e.push("line-height:"+Math.round(3*i/2)+"px"),c(["decoration","align"],function(i){var n=t.get(i);n&&e.push("text-"+i+":"+n)}),e.join(";")}function o(t){t=t;var e=[],i=t.get("transitionDuration"),o=t.get("backgroundColor"),a=t.getModel("textStyle"),s=t.get("padding");return i&&e.push(n(i)),o&&(f.canvasSupported?e.push("background-Color:"+o):(e.push("background-Color:#"+l.toHex(o)),e.push("filter:alpha(opacity=70)"))),c(["width","color","radius"],function(i){var n="border-"+i,r=d(n),o=t.get(r);null!=o&&e.push(n+":"+o+("color"===i?"":"px"))}),e.push(r(a)),null!=s&&e.push("padding:"+u.normalizeCssArray(s).join("px ")+"px"),e.join(";")+";"}function a(t,e){var i=document.createElement("div"),n=e.getZr();this.el=i,this._x=e.getWidth()/2,this._y=e.getHeight()/2,t.appendChild(i),this._container=t,this._show=!1,this._hideTimeout;var r=this;i.onmouseenter=function(){r.enterable&&(clearTimeout(r._hideTimeout),r._show=!0),r._inContent=!0},i.onmousemove=function(e){if(e=e||window.event,!r.enterable){var i=n.handler;h.normalizeEvent(t,e,!0),i.dispatch("mousemove",e)}},i.onmouseleave=function(){r.enterable&&r._show&&r.hideLater(r._hideDelay),r._inContent=!1}}var s=i(1),l=i(19),h=i(25),u=i(8),c=s.each,d=u.toCamelCase,f=i(10),p=["","-webkit-","-moz-","-o-"],g="position:absolute;display:block;border-style:solid;white-space:nowrap;z-index:9999999;";a.prototype={constructor:a,enterable:!0,update:function(){var t=this._container,e=t.currentStyle||document.defaultView.getComputedStyle(t),i=t.style;"absolute"!==i.position&&"absolute"!==e.position&&(i.position="relative")},show:function(t){clearTimeout(this._hideTimeout);var e=this.el;e.style.cssText=g+o(t)+";left:"+this._x+"px;top:"+this._y+"px;"+(t.get("extraCssText")||""),e.style.display=e.innerHTML?"block":"none",this._show=!0},setContent:function(t){var e=this.el;e.innerHTML=t,e.style.display=t?"block":"none"},moveTo:function(t,e){var i=this.el.style;i.left=t+"px",i.top=e+"px",this._x=t,this._y=e},hide:function(){this.el.style.display="none",this._show=!1},hideLater:function(t){!this._show||this._inContent&&this.enterable||(t?(this._hideDelay=t,this._show=!1,this._hideTimeout=setTimeout(s.bind(this.hide,this),t)):this.hide())},isShow:function(){return this._show}},t.exports=a},function(t,e,i){i(2).extendComponentModel({type:"tooltip",defaultOption:{zlevel:0,z:8,show:!0,showContent:!0,trigger:"item",triggerOn:"mousemove",alwaysShowContent:!1,confine:!1,showDelay:0,hideDelay:100,transitionDuration:.4,enterable:!1,backgroundColor:"rgba(50,50,50,0.7)",borderColor:"#333",borderRadius:4,borderWidth:0,padding:5,extraCssText:"",axisPointer:{type:"line",axis:"auto",animation:!0,animationDurationUpdate:200,animationEasingUpdate:"exponentialOut",lineStyle:{color:"#555",width:1,type:"solid"},crossStyle:{color:"#555",width:1,type:"dashed",textStyle:{}},shadowStyle:{color:"rgba(150,150,150,0.3)"}},textStyle:{color:"#fff",fontSize:14}}})},function(t,e,i){function n(t,e){if(!t||!e)return!1;var i=m.round;return i(t[0])===i(e[0])&&i(t[1])===i(e[1])}function r(t,e,i,n){return{x1:t,y1:e,x2:i,y2:n}}function o(t,e,i,n){return{x:t,y:e,width:i,height:n}}function a(t,e,i,n,r,o){return{cx:t,cy:e,r0:i,r:n,startAngle:r,endAngle:o,clockwise:!0}}function s(t,e,i,n,r){var o=i.clientWidth,a=i.clientHeight,s=20;return t+o+s>n?t-=o+s:t+=s,e+a+s>r?e-=a+s:e+=s,[t,e]}function l(t,e,i,n,r){var o=i.clientWidth,a=i.clientHeight;return t=Math.min(t+o,n)-o,e=Math.min(e+a,r)-a,t=Math.max(t,0),e=Math.max(e,0),[t,e]}function h(t,e,i){var n=i.clientWidth,r=i.clientHeight,o=5,a=0,s=0,l=e.width,h=e.height;switch(t){case"inside":a=e.x+l/2-n/2,s=e.y+h/2-r/2;break;case"top":a=e.x+l/2-n/2,s=e.y-r-o;break;case"bottom":a=e.x+l/2-n/2,s=e.y+h+o;break;case"left":a=e.x-n-o,s=e.y+h/2-r/2;break;case"right":a=e.x+l+o,s=e.y+h/2-r/2}return[a,s]}function u(t,e,i,n,r,o,a,u){var c=u.getWidth(),d=u.getHeight(),f=a&&a.getBoundingRect().clone();if(a&&f.applyTransform(a.transform),"function"==typeof t&&(t=t([e,i],o,r.el,f)),p.isArray(t))e=y(t[0],c),i=y(t[1],d);else if("string"==typeof t&&a){var g=h(t,f,r.el);e=g[0],i=g[1]}else{var g=s(e,i,r.el,c,d);e=g[0],i=g[1]}if(n){var g=l(e,i,r.el,c,d);e=g[0],i=g[1]}r.moveTo(e,i)}function c(t){var e=t.coordinateSystem,i=t.get("tooltip.trigger",!0);return!(!e||"cartesian2d"!==e.type&&"polar"!==e.type&&"singleAxis"!==e.type||"item"===i)}var d=i(216),f=i(3),p=i(1),g=i(8),m=i(4),v=i(6),y=m.parsePercent,x=i(10),_=i(11);i(2).extendComponentView({type:"tooltip",_axisPointers:{},init:function(t,e){if(!x.node){var i=new d(e.getDom(),e);this._tooltipContent=i}},render:function(t,e,i){if(!x.node){this.group.removeAll(),this._axisPointers={},this._tooltipModel=t,this._ecModel=e,this._api=i,this._lastHover={};var n=this._tooltipContent;n.update(),n.enterable=t.get("enterable"),this._alwaysShowContent=t.get("alwaysShowContent"),this._seriesGroupByAxis=this._prepareAxisTriggerData(t,e);var r=this._crossText;r&&this.group.add(r);var o=t.get("triggerOn");if(null!=this._lastX&&null!=this._lastY&&"none"!==o){var a=this;clearTimeout(this._refreshUpdateTimeout),this._refreshUpdateTimeout=setTimeout(function(){a.manuallyShowTip(t,e,i,{x:a._lastX,y:a._lastY})})}var s=this._api.getZr();s.off("click",this._tryShow),s.off("mousemove",this._mousemove),s.off("mouseout",this._hide),s.off("globalout",this._hide),"click"===o?s.on("click",this._tryShow,this):"mousemove"===o&&(s.on("mousemove",this._mousemove,this),s.on("mouseout",this._hide,this),s.on("globalout",this._hide,this))}},_mousemove:function(t){var e=this._tooltipModel.get("showDelay"),i=this;clearTimeout(this._showTimeout),e>0?this._showTimeout=setTimeout(function(){i._tryShow(t)},e):this._tryShow(t)},manuallyShowTip:function(t,e,i,n){function r(t){var e=t.getData(),i=v.queryDataIndex(e,n);if(null!=i&&!p.isArray(i)&&e.hasValue(i))return!0}if(n.from!==this.uid){var e=this._ecModel,o=n.seriesIndex,a=e.getSeriesByIndex(o),i=this._api,s="axis"===this._tooltipModel.get("trigger");if(null==n.x||null==n.y){if(s?(a&&!r(a)&&(a=null),a||e.eachSeries(function(t){c(t)&&!a&&r(t)&&(a=t)})):a=a||e.getSeriesByIndex(0),a){var l=a.getData(),h=v.queryDataIndex(l,n);if(null==h||p.isArray(h))return;var u,d,f=l.getItemGraphicEl(h),g=a.coordinateSystem;if(a.getTooltipPosition){var m=a.getTooltipPosition(h)||[];u=m[0],d=m[1]}else if(g&&g.dataToPoint){var m=g.dataToPoint(l.getValues(p.map(g.dimensions,function(t){return a.coordDimToDataDim(t)[0]}),h,!0));u=m&&m[0],d=m&&m[1]}else if(f){var y=f.getBoundingRect().clone();y.applyTransform(f.transform),u=y.x+y.width/2,d=y.y+y.height/2}null!=u&&null!=d&&this._tryShow({offsetX:u,offsetY:d,position:n.position,target:f,event:{}})}}else{var f=i.getZr().handler.findHover(n.x,n.y);this._tryShow({offsetX:n.x,offsetY:n.y,position:n.position,target:f,event:{}})}}},manuallyHideTip:function(t,e,i,n){n.from!==this.uid&&this._hide()},_prepareAxisTriggerData:function(t,e){var i={};return e.eachSeries(function(t){if(c(t)){var e,n,r=t.coordinateSystem;"cartesian2d"===r.type?(e=r.getBaseAxis(),n=e.dim+e.index):"singleAxis"===r.type?(e=r.getAxis(),n=e.dim+e.type):(e=r.getBaseAxis(),n=e.dim+r.name),i[n]=i[n]||{coordSys:[],series:[]},i[n].coordSys.push(r),i[n].series.push(t)}},this),i},_tryShow:function(t){var e=t.target,i=this._tooltipModel,n=i.get("trigger"),r=this._ecModel,o=this._api;if(i)if(this._lastX=t.offsetX,this._lastY=t.offsetY,e&&null!=e.dataIndex){var a=e.dataModel||r.getSeriesByIndex(e.seriesIndex),s=e.dataIndex,l=a.getData(),h=l.getItemModel(s);"axis"===(h.get("tooltip.trigger")||n)?this._showAxisTooltip(i,r,t):(this._ticket="",this._hideAxisPointer(),this._resetLastHover(),this._showItemTooltipContent(a,s,e.dataType,t)),o.dispatchAction({type:"showTip",from:this.uid,dataIndexInside:s,dataIndex:l.getRawIndex(s),seriesIndex:e.seriesIndex})}else if(e&&e.tooltip){var u=e.tooltip;if("string"==typeof u){var c=u;u={content:c,formatter:c}}var d=new _(u,i),f=d.get("content"),p=Math.random();this._showTooltipContent(d,f,d.get("formatterParams")||{},p,t.offsetX,t.offsetY,t.position,e,o)}else"item"===n?this._hide():this._showAxisTooltip(i,r,t),"cross"===i.get("axisPointer.type")&&o.dispatchAction({type:"showTip",from:this.uid,x:t.offsetX,y:t.offsetY})},_showAxisTooltip:function(t,e,i){var r=t.getModel("axisPointer"),o=r.get("type");if("cross"===o){var a=i.target;if(a&&null!=a.dataIndex){var s=e.getSeriesByIndex(a.seriesIndex),l=a.dataIndex;this._showItemTooltipContent(s,l,a.dataType,i)}}this._showAxisPointer();var h=!0;p.each(this._seriesGroupByAxis,function(e){var a=e.coordSys,s=a[0],l=[i.offsetX,i.offsetY];if(!s.containPoint(l))return void this._hideAxisPointer(s.name);h=!1;var u=s.dimensions,c=s.pointToData(l,!0);l=s.dataToPoint(c);var d=s.getBaseAxis(),f=r.get("axis");if("auto"===f&&(f=d.dim),d.isBlank()||p.eqNaN(l[0])||p.eqNaN(l[1]))return void this._hideAxisPointer(s.name);var g=!1,m=this._lastHover;if("cross"===o)n(m.data,c)&&(g=!0),m.data=c;else{var v=p.indexOf(u,f);m.data===c[v]&&(g=!0),m.data=c[v]}var y=t.get("animation");"cartesian2d"!==s.type||g?"polar"!==s.type||g?"singleAxis"!==s.type||g||this._showSinglePointer(r,s,f,l,y):this._showPolarPointer(r,s,f,l,y):this._showCartesianPointer(r,s,f,l,y),"cross"!==o&&this._dispatchAndShowSeriesTooltipContent(s,e.series,l,c,g,i.position)},this),this._tooltipModel.get("show")||this._hideAxisPointer(),h&&this._hide()},_showCartesianPointer:function(t,e,i,n,a){function s(i,n,o){var a="x"===i?r(n[0],o[0],n[0],o[1]):r(o[0],n[1],o[1],n[1]),s=h._getPointerElement(e,t,i,a);f.subPixelOptimizeLine({shape:a,style:s.style}),d?f.updateProps(s,{shape:a},t):s.attr({shape:a})}function l(i,n,r){var a=e.getAxis(i),s=a.getBandWidth(),l=r[1]-r[0],u="x"===i?o(n[0]-s/2,r[0],s,l):o(r[0],n[1]-s/2,l,s),c=h._getPointerElement(e,t,i,u);d?f.updateProps(c,{shape:u},t):c.attr({shape:u})}var h=this,u=t.get("type"),c=e.getBaseAxis(),d=a&&"cross"!==u&&"category"===c.type&&c.getBandWidth()>20;if("cross"===u)s("x",n,e.getAxis("y").getGlobalExtent()),s("y",n,e.getAxis("x").getGlobalExtent()),this._updateCrossText(e,n,t);else{var p=e.getAxis("x"===i?"y":"x"),g=p.getGlobalExtent();"cartesian2d"===e.type&&("line"===u?s:l)(i,n,g)}},_showSinglePointer:function(t,e,i,n,o){function a(i,n,o){var a=e.getAxis(),l=a.orient,u="horizontal"===l?r(n[0],o[0],n[0],o[1]):r(o[0],n[1],o[1],n[1]),c=s._getPointerElement(e,t,i,u);h?f.updateProps(c,{shape:u},t):c.attr({shape:u})}var s=this,l=t.get("type"),h=o&&"cross"!==l&&"category"===e.getBaseAxis().type,u=e.getRect(),c=[u.y,u.y+u.height];a(i,n,c)},_showPolarPointer:function(t,e,i,n,o){function s(i,n,o){var a,s=e.pointToCoord(n);if("angle"===i){var l=e.coordToPoint([o[0],s[1]]),u=e.coordToPoint([o[1],s[1]]);a=r(l[0],l[1],u[0],u[1])}else a={cx:e.cx,cy:e.cy,r:s[0]};var c=h._getPointerElement(e,t,i,a);p?f.updateProps(c,{shape:a},t):c.attr({shape:a})}function l(i,n,r){var o,s=e.getAxis(i),l=s.getBandWidth(),u=e.pointToCoord(n),c=Math.PI/180;o="angle"===i?a(e.cx,e.cy,r[0],r[1],(-u[1]-l/2)*c,(-u[1]+l/2)*c):a(e.cx,e.cy,u[0]-l/2,u[0]+l/2,0,2*Math.PI);var d=h._getPointerElement(e,t,i,o);p?f.updateProps(d,{shape:o},t):d.attr({shape:o})}var h=this,u=t.get("type"),c=e.getAngleAxis(),d=e.getRadiusAxis(),p=o&&"cross"!==u&&"category"===e.getBaseAxis().type;if("cross"===u)s("angle",n,d.getExtent()),s("radius",n,c.getExtent()),this._updateCrossText(e,n,t);else{var g=e.getAxis("radius"===i?"angle":"radius"),m=g.getExtent();("line"===u?s:l)(i,n,m)}},_updateCrossText:function(t,e,i){var n=i.getModel("crossStyle"),r=n.getModel("textStyle"),o=this._tooltipModel,a=this._crossText;a||(a=this._crossText=new f.Text({style:{textAlign:"left",textVerticalAlign:"bottom"}}),this.group.add(a));var s=t.pointToData(e),l=t.dimensions;s=p.map(s,function(e,i){var n=t.getAxis(l[i]);return e="category"===n.type||"time"===n.type?n.scale.getLabel(e):g.addCommas(e.toFixed(n.getPixelPrecision()))}),a.setStyle({fill:r.getTextColor()||n.get("color"),textFont:r.getFont(),text:s.join(", "),x:e[0]+5,y:e[1]-5}),a.z=o.get("z"),a.zlevel=o.get("zlevel")},_getPointerElement:function(t,e,i,n){var r=this._tooltipModel,o=r.get("z"),a=r.get("zlevel"),s=this._axisPointers,l=t.name;if(s[l]=s[l]||{},s[l][i])return s[l][i];var h=e.get("type"),u=e.getModel(h+"Style"),c="shadow"===h,d=u[c?"getAreaStyle":"getLineStyle"](),p="polar"===t.type?c?"Sector":"radius"===i?"Circle":"Line":c?"Rect":"Line";c?d.stroke=null:d.fill=null;var g=s[l][i]=new f[p]({style:d,z:o,zlevel:a,silent:!0,shape:n});return this.group.add(g),g},_dispatchAndShowSeriesTooltipContent:function(t,e,i,n,r,o){var a=this._tooltipModel,s=t.getBaseAxis(),l={x:1,radius:1,single:1}[s.dim]?0:1;if(e.length){var h,c=p.map(e,function(t){return{seriesIndex:t.seriesIndex,dataIndexInside:t.getAxisTooltipDataIndex?t.getAxisTooltipDataIndex(t.coordDimToDataDim(s.dim),n,s):t.getData().indexOfNearest(t.coordDimToDataDim(s.dim)[0],n[l],!1,"category"===s.type?.5:null)}});p.each(c,function(t,i){e[i].getData().hasValue(t.dataIndexInside)&&(h=i)}),h=h||0;var d=this._lastHover,f=this._api;d.payloadBatch&&!r&&f.dispatchAction({type:"downplay",batch:d.payloadBatch}),r||(f.dispatchAction({type:"highlight",batch:c}),d.payloadBatch=c);var m=c[h].dataIndexInside;if(f.dispatchAction({type:"showTip",dataIndexInside:m,dataIndex:e[h].getData().getRawIndex(m),seriesIndex:c[h].seriesIndex,from:this.uid}),s&&a.get("showContent")&&a.get("show")){var v=p.map(e,function(t,e){return t.getDataParams(c[e].dataIndexInside)});if(r)u(o||a.get("position"),i[0],i[1],a.get("confine"),this._tooltipContent,v,null,f);else{var y=c[h].dataIndexInside,x="time"===s.type?s.scale.getLabel(n[l]):e[h].getData().getName(y),_=(x?g.encodeHTML(x)+"
":"")+p.map(e,function(t,e){return t.formatTooltip(c[e].dataIndexInside,!0)}).join("
"),b="axis_"+t.name+"_"+y;this._showTooltipContent(a,_,v,b,i[0],i[1],o,null,f)}}}},_showItemTooltipContent:function(t,e,i,n){var r=this._api,o=t.getData(i),a=o.getItemModel(e),s=a.get("tooltip",!0);if("string"==typeof s){var l=s;s={formatter:l}}var h=this._tooltipModel,u=t.getModel("tooltip",h),c=new _(s,u,u.ecModel),d=t.getDataParams(e,i),f=t.formatTooltip(e,!1,i),p="item_"+t.name+"_"+e; -this._showTooltipContent(c,f,d,p,n.offsetX,n.offsetY,n.position,n.target,r)},_showTooltipContent:function(t,e,i,n,r,o,a,s,l){if(this._ticket="",t.get("showContent")&&t.get("show")){var h=this._tooltipContent,c=t.get("confine"),d=t.get("formatter");a=a||t.get("position");var f=e;if(d)if("string"==typeof d)f=g.formatTpl(d,i,!0);else if("function"==typeof d){var p=this,m=n,v=function(t,e){t===p._ticket&&(h.setContent(e),u(a,r,o,c,h,i,s,l))};p._ticket=m,f=d(i,m,v)}h.show(t),h.setContent(f),u(a,r,o,c,h,i,s,l)}},_showAxisPointer:function(t){if(t){var e=this._axisPointers[t];e&&p.each(e,function(t){t.show()})}else this.group.eachChild(function(t){t.show()}),this.group.show()},_resetLastHover:function(){var t=this._lastHover;t.payloadBatch&&this._api.dispatchAction({type:"downplay",batch:t.payloadBatch}),this._lastHover={}},_hideAxisPointer:function(t){if(t){var e=this._axisPointers[t];e&&p.each(e,function(t){t.hide()})}else this.group.children().length&&this.group.hide()},_hide:function(){clearTimeout(this._showTimeout),this._hideAxisPointer(),this._resetLastHover(),this._alwaysShowContent||this._tooltipContent.hideLater(this._tooltipModel.get("hideDelay")),this._api.dispatchAction({type:"hideTip",from:this.uid}),this._lastX=this._lastY=null},dispose:function(t,e){if(!x.node){var i=e.getZr();this._tooltipContent.hide(),i.off("click",this._tryShow),i.off("mousemove",this._mousemove),i.off("mouseout",this._hide),i.off("globalout",this._hide)}}})},,function(t,e,i){function n(t){return parseInt(t,10)}function r(t,e){s.initVML(),this.root=t,this.storage=e;var i=document.createElement("div"),n=document.createElement("div");i.style.cssText="display:inline-block;overflow:hidden;position:relative;width:300px;height:150px;",n.style.cssText="position:absolute;left:0;top:0;",t.appendChild(i),this._vmlRoot=n,this._vmlViewport=i,this.resize();var r=e.delFromMap,o=e.addToMap;e.delFromMap=function(t){var i=e.get(t);r.call(e,t),i&&i.onRemove&&i.onRemove(n)},e.addToMap=function(t){t.onAdd&&t.onAdd(n),o.call(e,t)},this._firstPaint=!0}function o(t){return function(){a('In IE8.0 VML mode painter not support method "'+t+'"')}}var a=i(48),s=i(171);r.prototype={constructor:r,getViewportRoot:function(){return this._vmlViewport},refresh:function(){var t=this.storage.getDisplayList(!0,!0);this._paintList(t)},_paintList:function(t){for(var e=this._vmlRoot,i=0;i=0?parseFloat(t)/100*e:parseFloat(t):t},E=function(t,e,i){var n=a.parse(e);i=+i,isNaN(i)&&(i=1),n&&(t.color=L(n[0],n[1],n[2]),t.opacity=i*n[3])},N=function(t){var e=a.parse(t);return[L(e[0],e[1],e[2]),e[3]]},R=function(t,e,i){var n=e.fill;if(null!=n)if(n instanceof f){var r,o=0,a=[0,0],s=0,l=1,h=i.getBoundingRect(),u=h.width,c=h.height;if("linear"===n.type){r="gradient";var d=i.transform,p=[n.x*u,n.y*c],g=[n.x2*u,n.y2*c];d&&(b(p,p,d),b(g,g,d));var m=g[0]-p[0],v=g[1]-p[1];o=180*Math.atan2(m,v)/Math.PI,o<0&&(o+=360),o<1e-6&&(o=0)}else{r="gradientradial";var p=[n.x*u,n.y*c],d=i.transform,y=i.scale,x=u,w=c;a=[(p[0]-h.x)/x,(p[1]-h.y)/w],d&&b(p,p,d),x/=y[0]*S,w/=y[1]*S;var M=_(x,w);s=0/M,l=2*n.r/M-s}var T=n.colorStops.slice();T.sort(function(t,e){return t.offset-e.offset});for(var A=T.length,I=[],C=[],k=0;k=2){var D=I[0][0],O=I[1][0],z=I[0][1]*e.opacity,R=I[1][1]*e.opacity;t.type=r,t.method="none",t.focus="100%",t.angle=o,t.color=D,t.color2=O,t.colors=C.join(","),t.opacity=R,t.opacity2=z}"radial"===r&&(t.focusposition=a.join(","))}else E(t,n,e.opacity)},B=function(t,e){null!=e.lineDash&&(t.dashstyle=e.lineDash.join(" ")),null==e.stroke||e.stroke instanceof f||E(t,e.stroke,e.opacity)},V=function(t,e,i,n){var r="fill"==e,o=t.getElementsByTagName(e)[0];null!=i[e]&&"none"!==i[e]&&(r||!r&&i.lineWidth)?(t[r?"filled":"stroked"]="true",i[e]instanceof f&&D(t,o),o||(o=p.createNode(e)),r?R(o,i,n):B(o,i),P(t,o)):(t[r?"filled":"stroked"]="false",D(t,o))},F=[[],[],[]],G=function(t,e){var i,n,r,a,s,l,h=o.M,u=o.C,c=o.L,d=o.A,f=o.Q,p=[];for(a=0;a.01?G&&(H+=270/S):Math.abs(W-E)<1e-4?G&&Hz?A-=270/S:A+=270/S:G&&WE?M+=270/S:M-=270/S),p.push(Z,g(((z-N)*P+k)*S-T),w,g(((E-R)*D+L)*S-T),w,g(((z+N)*P+k)*S-T),w,g(((E+R)*D+L)*S-T),w,g((H*P+k)*S-T),w,g((W*D+L)*S-T),w,g((M*P+k)*S-T),w,g((A*D+L)*S-T)),s=M,l=A;break;case o.R:var q=F[0],j=F[1];q[0]=t[a++],q[1]=t[a++],j[0]=q[0]+t[a++],j[1]=q[1]+t[a++],e&&(b(q,q,e),b(j,j,e)),q[0]=g(q[0]*S-T),j[0]=g(j[0]*S-T),q[1]=g(q[1]*S-T),j[1]=g(j[1]*S-T),p.push(" m ",q[0],w,q[1]," l ",j[0],w,q[1]," l ",j[0],w,j[1]," l ",q[0],w,j[1]);break;case o.Z:p.push(" x ")}if(i>0){p.push(n);for(var U=0;UU&&(j=0,q={});var i,n=X.style;try{n.font=t,i=n.fontFamily.split(",")[0]}catch(r){}e={style:n.fontStyle||Z,variant:n.fontVariant||Z,weight:n.fontWeight||Z,size:0|parseFloat(n.fontSize||12),family:i||"Microsoft YaHei"},q[t]=e,j++}return e};s.measureText=function(t,e){var i=p.doc;W||(W=i.createElement("div"),W.style.cssText="position:absolute;top:-20000px;left:0;padding:0;margin:0;border:none;white-space:pre;",p.doc.body.appendChild(W));try{W.style.font=e}catch(n){}return W.innerHTML="",W.appendChild(i.createTextNode(t)),{width:W.offsetWidth}};for(var $=new r,Q=function(t,e,i,n){var r=this.style,o=r.text;if(null!=o&&(o+=""),o){var a,l,h=r.textAlign,u=Y(r.textFont),c=u.style+" "+u.variant+" "+u.weight+" "+u.size+'px "'+u.family+'"',d=r.textBaseline,f=r.textVerticalAlign;i=i||s.getBoundingRect(o,c,h,d);var m=this.transform;if(m&&!n&&($.copy(e),$.applyTransform(m),e=$),n)a=e.x,l=e.y;else{var v=r.textPosition,y=r.textDistance;if(v instanceof Array)a=e.x+z(v[0],e.width),l=e.y+z(v[1],e.height),h=h||"left",d=d||"top";else{var x=s.adjustTextPositionOnRect(v,e,i,y);a=x.x,l=x.y,h=h||x.textAlign,d=d||x.textBaseline}}if(f){switch(f){case"middle":l-=i.height/2;break;case"bottom":l-=i.height}d="top"}var _=u.size;switch(d){case"hanging":case"top":l+=_/1.75;break;case"middle":break;default:l-=_/2.25}switch(h){case"left":break;case"center":a-=i.width/2;break;case"right":a-=i.width}var M,S,T,A=p.createNode,I=this._textVmlEl;I?(T=I.firstChild,M=T.nextSibling,S=M.nextSibling):(I=A("line"),M=A("path"),S=A("textpath"),T=A("skew"),S.style["v-text-align"]="left",C(I),M.textpathok=!0,S.on=!0,I.from="0 0",I.to="1000 0.05",P(I,T),P(I,M),P(I,S),this._textVmlEl=I);var L=[a,l],D=I.style;m&&n?(b(L,L,m),T.on=!0,T.matrix=m[0].toFixed(3)+w+m[2].toFixed(3)+w+m[1].toFixed(3)+w+m[3].toFixed(3)+",0,0",T.offset=(g(L[0])||0)+","+(g(L[1])||0),T.origin="0 0",D.left="0px",D.top="0px"):(T.on=!1,D.left=g(a)+"px",D.top=g(l)+"px"),S.string=k(o);try{S.style.font=c}catch(E){}V(I,"fill",{fill:n?r.fill:r.textFill,opacity:r.opacity},this),V(I,"stroke",{stroke:n?r.stroke:r.textStroke,opacity:r.opacity,lineDash:r.lineDash},this),I.style.zIndex=O(this.zlevel,this.z,this.z2),P(t,I)}},K=function(t){D(t,this._textVmlEl),this._textVmlEl=null},J=function(t){P(t,this._textVmlEl)},tt=[l,h,u,d,c],et=0;et=o||b<0)break;if(n(M)){if(x){b+=a;continue}break}if(b===i)t[a>0?"moveTo":"lineTo"](M[0],M[1]),c(f,M);else if(v>0){var S=b+a,T=e[S];if(x)for(;T&&n(e[S]);)S+=a,T=e[S];var A=.5,I=e[_],T=e[S];if(!T||n(T))c(p,M);else{n(T)&&!x&&(T=M),s.sub(d,T,I);var C,P;if("x"===y||"y"===y){var k="x"===y?0:1;C=Math.abs(M[k]-I[k]),P=Math.abs(M[k]-T[k])}else C=s.dist(M,I),P=s.dist(M,T);A=P/(P+C),h(p,M,d,-v*(1-A))}l(f,f,m),u(f,f,g),l(p,p,m),u(p,p,g),t.bezierCurveTo(f[0],f[1],p[0],p[1],M[0],M[1]),h(f,M,d,v*A)}else t.lineTo(M[0],M[1]);_=b,b+=a}return w}function o(t,e){var i=[1/0,1/0],n=[-(1/0),-(1/0)];if(e)for(var r=0;rn[0]&&(n[0]=o[0]),o[1]>n[1]&&(n[1]=o[1])}return{min:e?i:n,max:e?n:i}}var a=i(8),s=i(6),l=s.min,u=s.max,h=s.scaleAndAdd,c=s.copy,d=[],f=[],p=[];t.exports={Polyline:a.extend({type:"ec-polyline",shape:{points:[],smooth:0,smoothConstraint:!0,smoothMonotone:null,connectNulls:!1},style:{fill:null,stroke:"#000"},buildPath:function(t,e){var i=e.points,a=0,s=i.length,l=o(i,e.smoothConstraint);if(e.connectNulls){for(;s>0&&n(i[s-1]);s--);for(;a0&&n(i[l-1]);l--);for(;s0?1.1:1/1.1;l.call(this,t,e,t.offsetX,t.offsetY)}}function s(t){if(!f.isTaken(this._zr,"globalPan")){var e=t.pinchScale>1?1.1:1/1.1;l.call(this,t,e,t.pinchX,t.pinchY)}}function l(t,e,i,n){if(this.containsPoint&&this.containsPoint(i,n)){d.stop(t.event);var r=this.target,o=this.zoomLimit;if(r){var a=r.position,s=r.scale,l=this.zoom=this.zoom||1;if(l*=e,o){var u=o.min||0,h=o.max||1/0;l=Math.max(Math.min(h,l),u)}var c=l/this.zoom;this.zoom=l,a[0]-=(i-a[0])*(c-1),a[1]-=(n-a[1])*(c-1),s[0]*=c,s[1]*=c,r.dirty()}this.trigger("zoom",e,i,n)}}function u(t,e){this.target=e,this.containsPoint,this.zoomLimit,this.zoom,this._zr=t;var i=c.bind,l=i(n,this),u=i(r,this),d=i(o,this),f=i(a,this),p=i(s,this);h.call(this),this.setContainsPoint=function(t){this.containsPoint=t},this.enable=function(e){this.disable(),null==e&&(e=!0),e!==!0&&"move"!==e&&"pan"!==e||(t.on("mousedown",l),t.on("mousemove",u),t.on("mouseup",d)),e!==!0&&"scale"!==e&&"zoom"!==e||(t.on("mousewheel",f),t.on("pinch",p))},this.disable=function(){t.off("mousedown",l),t.off("mousemove",u),t.off("mouseup",d),t.off("mousewheel",f),t.off("pinch",p)},this.dispose=this.disable,this.isDragging=function(){return this._dragging},this.isPinching=function(){return this._pinching}}var h=i(23),c=i(1),d=i(20),f=i(130);c.mixin(u,h),t.exports=u},function(t,e){t.exports=function(t,e,i,n,r){function o(t,e,i){var n=e.length?e.slice():[e,e];return e[0]>e[1]&&n.reverse(),t<0&&n[0]+t0&&n[1]+t>i[1]&&(t=i[1]-n[1]),t}return t?("rigid"===n?(t=o(t,e,i),e[0]+=t,e[1]+=t):(t=o(t,e[r],i),e[r]+=t,"push"===n&&e[0]>e[1]&&(e[1-r]=e[r])),e):e}},function(t,e,i){var n=i(1),r={show:!0,zlevel:0,z:0,inverse:!1,name:"",nameLocation:"end",nameRotate:null,nameTruncate:{maxWidth:null,ellipsis:"...",placeholder:"."},nameTextStyle:{},nameGap:15,silent:!1,triggerEvent:!1,tooltip:{show:!1},axisPointer:{},axisLine:{show:!0,onZero:!0,lineStyle:{color:"#333",width:1,type:"solid"}},axisTick:{show:!0,inside:!1,length:5,lineStyle:{width:1}},axisLabel:{show:!0,inside:!1,rotate:0,margin:8,textStyle:{fontSize:12}},splitLine:{show:!0,lineStyle:{color:["#ccc"],width:1,type:"solid"}},splitArea:{show:!1,areaStyle:{color:["rgba(250,250,250,0.3)","rgba(200,200,200,0.3)"]}}},o=n.merge({boundaryGap:!0,splitLine:{show:!1},axisTick:{alignWithLabel:!1,interval:"auto"},axisLabel:{interval:"auto"}},r),a=n.merge({boundaryGap:[0,0],splitNumber:5},r),s=n.defaults({scale:!0,min:"dataMin",max:"dataMax"},a),l=n.defaults({logBase:10},a);l.scale=!0,t.exports={categoryAxis:o,valueAxis:a,timeAxis:s,logAxis:l}},function(t,e,i){"use strict";function n(t){return t.get("stack")||"__ec_stack_"+t.seriesIndex}function r(t){return t.dim+t.index}function o(t,e){var i={};s.each(t,function(t,e){var o=t.getData(),a=t.coordinateSystem,s=a.getBaseAxis(),l=s.getExtent(),h="category"===s.type?s.getBandWidth():Math.abs(l[1]-l[0])/o.count(),c=i[r(s)]||{bandWidth:h,remainedWidth:h,autoWidthCount:0,categoryGap:"20%",gap:"30%",stacks:{}},d=c.stacks;i[r(s)]=c;var f=n(t);d[f]||c.autoWidthCount++,d[f]=d[f]||{width:0,maxWidth:0};var p=u(t.get("barWidth"),h),g=u(t.get("barMaxWidth"),h),m=t.get("barGap"),v=t.get("barCategoryGap");p&&!d[f].width&&(p=Math.min(c.remainedWidth,p),d[f].width=p,c.remainedWidth-=p),g&&(d[f].maxWidth=g),null!=m&&(c.gap=m),null!=v&&(c.categoryGap=v)});var o={};return s.each(i,function(t,e){o[e]={};var i=t.stacks,n=t.bandWidth,r=u(t.categoryGap,n),a=u(t.gap,1),l=t.remainedWidth,h=t.autoWidthCount,c=(l-r)/(h+(h-1)*a);c=Math.max(c,0),s.each(i,function(t,e){var i=t.maxWidth;!t.width&&i&&i=0?"p":"n",v=m[i],y=l[s][i][h],x=u[s][i][h];f.isHorizontal()?(n=y,r=v[1]+c,o=v[0]-x,a=d,u[s][i][h]+=o,Math.abs(o)e+s&&a>n+s||at+s&&o>i+s||oe+h&&u>r+h&&u>a+h||ut+h&&l>i+h&&l>o+h||le&&o>n||or?a:0}},function(t,e,i){"use strict";var n=i(1),r=i(41),o=function(t,e,i,n,o,a){this.x=null==t?0:t,this.y=null==e?0:e,this.x2=null==i?1:i,this.y2=null==n?0:n,this.type="linear",this.global=a||!1,r.call(this,o)};o.prototype={constructor:o},n.inherits(o,r),t.exports=o},function(t,e,i){"use strict";function n(t){return t>s||t<-s}var r=i(19),o=i(6),a=r.identity,s=5e-5,l=function(t){t=t||{},t.position||(this.position=[0,0]),null==t.rotation&&(this.rotation=0),t.scale||(this.scale=[1,1]),this.origin=this.origin||null},u=l.prototype;u.transform=null,u.needLocalTransform=function(){return n(this.rotation)||n(this.position[0])||n(this.position[1])||n(this.scale[0]-1)||n(this.scale[1]-1)},u.updateTransform=function(){var t=this.parent,e=t&&t.transform,i=this.needLocalTransform(),n=this.transform;return i||e?(n=n||r.create(),i?this.getLocalTransform(n):a(n),e&&(i?r.mul(n,t.transform,n):r.copy(n,t.transform)),this.transform=n,this.invTransform=this.invTransform||r.create(),void r.invert(this.invTransform,n)):void(n&&a(n))},u.getLocalTransform=function(t){t=t||[],a(t);var e=this.origin,i=this.scale,n=this.rotation,o=this.position;return e&&(t[4]-=e[0],t[5]-=e[1]),r.scale(t,t,i),n&&r.rotate(t,t,n),e&&(t[4]+=e[0],t[5]+=e[1]),t[4]+=o[0],t[5]+=o[1],t},u.setTransform=function(t){var e=this.transform,i=t.dpr||1;e?t.setTransform(i*e[0],i*e[1],i*e[2],i*e[3],i*e[4],i*e[5]):t.setTransform(i,0,0,i,0,0)},u.restoreTransform=function(t){var e=(this.transform,t.dpr||1);t.setTransform(e,0,0,e,0,0)};var h=[];u.decomposeTransform=function(){if(this.transform){var t=this.parent,e=this.transform;t&&t.transform&&(r.mul(h,t.invTransform,e),e=h);var i=e[0]*e[0]+e[1]*e[1],o=e[2]*e[2]+e[3]*e[3],a=this.position,s=this.scale;n(i-1)&&(i=Math.sqrt(i)),n(o-1)&&(o=Math.sqrt(o)),e[0]<0&&(i=-i),e[3]<0&&(o=-o),a[0]=e[4],a[1]=e[5],s[0]=i,s[1]=o,this.rotation=Math.atan2(-e[1]/o,e[0]/i)}},u.getGlobalScale=function(){var t=this.transform;if(!t)return[1,1];var e=Math.sqrt(t[0]*t[0]+t[1]*t[1]),i=Math.sqrt(t[2]*t[2]+t[3]*t[3]);return t[0]<0&&(e=-e),t[3]<0&&(i=-i),[e,i]},u.transformCoordToLocal=function(t,e){var i=[t,e],n=this.invTransform;return n&&o.applyTransform(i,i,n),i},u.transformCoordToGlobal=function(t,e){var i=[t,e],n=this.transform;return n&&o.applyTransform(i,i,n),i},t.exports=l},function(t,e,i){"use strict";function n(t,e){r.each(o,function(e){this[e]=r.bind(t[e],t)},this),this.getCoordinateSystems=r.bind(e.getCoordinateSystems,e)}var r=i(1),o=["getDom","getZr","getWidth","getHeight","getDevicePixelRatio","dispatchAction","isDisposed","on","off","getDataURL","getConnectedDataURL","getModel","getOption","getViewOfComponentModel","getViewOfSeriesModel"];t.exports=n},function(t,e,i){var n=i(1);i(56),i(105),i(106);var r=i(97),o=i(2);o.registerLayout(n.curry(r,"bar")),o.registerVisual(function(t){t.eachSeriesByType("bar",function(t){var e=t.getData();e.setVisual("legendSymbol","roundRect")})}),i(38)},function(t,e,i){t.exports=i(89).extend({type:"series.bar",dependencies:["grid","polar"],brushSelector:"rect"})},function(t,e,i){"use strict";function n(t,e,i,n,r,o,a){var s=new u.Rect({shape:l.extend({},n)});if(o){var h=s.shape,c=r?"height":"width",d={};h[c]=0,d[c]=n[c],u[a?"updateProps":"initProps"](s,{shape:d},o,e)}return s}function r(t,e,i){i.style.text="",u.updateProps(i,{shape:{width:0}},e,t,function(){i.parent&&i.parent.remove(i)})}function o(t,e,i){var n=t.getItemLayout(e),r=s(i,n),o=n.width>0?1:-1,a=n.height>0?1:-1;return{x:n.x+o*r/2,y:n.y+a*r/2,width:n.width-o*r,height:n.height-a*r}}function a(t,e,i,n,r,o,a){var s=e.getItemVisual(i,"color"),c=e.getItemVisual(i,"opacity"),d=n.getModel("itemStyle.normal"),f=n.getModel("itemStyle.emphasis").getBarItemStyle();t.setShape("r",d.get("barBorderRadius")||0),t.useStyle(l.defaults({fill:s,opacity:c},d.getBarItemStyle()));var p=a?r.height>0?"bottom":"top":r.width>0?"left":"right";h.setLabel(t.style,f,n,s,o,i,p),u.setHoverStyle(t,f)}function s(t,e){var i=t.get(c)||0;return Math.min(i,Math.abs(e.width),Math.abs(e.height))}var l=i(1),u=i(3),h=i(90),c=["itemStyle","normal","barBorderWidth"];l.extend(i(10).prototype,i(107));var d=i(2).extendChartView({type:"bar",render:function(t,e,i){var n=t.get("coordinateSystem");return"cartesian2d"===n&&this._renderOnCartesian(t,e,i),this.group},dispose:l.noop,_renderOnCartesian:function(t,e,i){var s=this.group,l=t.getData(),h=this._data,c=t.coordinateSystem,d=c.getBaseAxis(),f=d.isHorizontal(),p=t.isAnimationEnabled()?t:null;l.diff(h).add(function(e){if(l.hasValue(e)){var i=l.getItemModel(e),r=o(l,e,i),u=n(l,e,i,r,f,p);l.setItemGraphicEl(e,u),s.add(u),a(u,l,e,i,r,t,f)}}).update(function(e,i){var r=h.getItemGraphicEl(i);if(!l.hasValue(e))return void s.remove(r);var c=l.getItemModel(e),d=o(l,e,c);r?u.updateProps(r,{shape:d},p,e):r=n(l,e,c,d,f,p,!0),l.setItemGraphicEl(e,r),s.add(r),a(r,l,e,c,d,t,f)}).remove(function(t){var e=h.getItemGraphicEl(t);e&&r(t,p,e)}).execute(),this._data=l},remove:function(t,e){var i=this.group,n=this._data;t.get("animation")?n&&n.eachItemGraphicEl(function(e){r(e.dataIndex,t,e)}):i.removeAll()}});t.exports=d},function(t,e,i){var n=i(31)([["fill","color"],["stroke","borderColor"],["lineWidth","borderWidth"],["stroke","barBorderColor"],["lineWidth","barBorderWidth"],["opacity"],["shadowBlur"],["shadowOffsetX"],["shadowOffsetY"],["shadowColor"]]);t.exports={getBarItemStyle:function(t){var e=n.call(this,t);if(this.getBorderLineDash){var i=this.getBorderLineDash();i&&(e.lineDash=i)}return e}}},function(t,e,i){function n(t){return"_"+t+"Type"}function r(t,e,i){var n=e.getItemVisual(i,"color"),r=e.getItemVisual(i,t),o=e.getItemVisual(i,t+"Size");if(r&&"none"!==r){f.isArray(o)||(o=[o,o]);var a=u.createSymbol(r,-o[0]/2,-o[1]/2,o[0],o[1],n);return a.name=t,a}}function o(t){var e=new c({name:"line"});return a(e.shape,t),e}function a(t,e){var i=e[0],n=e[1],r=e[2];t.x1=i[0],t.y1=i[1],t.x2=n[0],t.y2=n[1],t.percent=1,r?(t.cpx1=r[0],t.cpy1=r[1]):(t.cpx1=NaN,t.cpy1=NaN)}function s(){var t=this,e=t.childOfName("fromSymbol"),i=t.childOfName("toSymbol"),n=t.childOfName("label");if(e||i||!n.ignore){for(var r=1,o=this.parent;o;)o.scale&&(r/=o.scale[0]),o=o.parent;var a=t.childOfName("line");if(this.__dirty||a.__dirty){var s=a.shape.percent,l=a.pointAt(0),u=a.pointAt(s),c=h.sub([],u,l);if(h.normalize(c,c),e){e.attr("position",l);var d=a.tangentAt(0);e.attr("rotation",Math.PI/2-Math.atan2(d[1],d[0])),e.attr("scale",[r*s,r*s])}if(i){i.attr("position",u);var d=a.tangentAt(1);i.attr("rotation",-Math.PI/2-Math.atan2(d[1],d[0])),i.attr("scale",[r*s,r*s])}if(!n.ignore){n.attr("position",u);var f,p,g,m=5*r;if("end"===n.__position)f=[c[0]*m+u[0],c[1]*m+u[1]],p=c[0]>.8?"left":c[0]<-.8?"right":"center",g=c[1]>.8?"top":c[1]<-.8?"bottom":"middle";else if("middle"===n.__position){var v=s/2,d=a.tangentAt(v),y=[d[1],-d[0]],x=a.pointAt(v);y[1]>0&&(y[0]=-y[0],y[1]=-y[1]),f=[x[0]+y[0]*m,x[1]+y[1]*m],p="center",g="bottom";var _=-Math.atan2(d[1],d[0]);u[0].8?"right":c[0]<-.8?"left":"center",g=c[1]>.8?"bottom":c[1]<-.8?"top":"middle";n.attr({style:{textVerticalAlign:n.__verticalAlign||g,textAlign:n.__textAlign||p},position:f,scale:[r,r]})}}}}function l(t,e,i){d.Group.call(this),this._createLine(t,e,i)}var u=i(24),h=i(6),c=i(191),d=i(3),f=i(1),p=i(4),g=["fromSymbol","toSymbol"],m=l.prototype;m.beforeUpdate=s,m._createLine=function(t,e,i){var a=t.hostModel,s=t.getItemLayout(e),l=o(s);l.shape.percent=0,d.initProps(l,{shape:{percent:1}},a,e),this.add(l);var u=new d.Text({name:"label"});this.add(u),f.each(g,function(i){var o=r(i,t,e);this.add(o),this[n(i)]=t.getItemVisual(e,i)},this),this._updateCommonStl(t,e,i)},m.updateData=function(t,e,i){var o=t.hostModel,s=this.childOfName("line"),l=t.getItemLayout(e),u={shape:{}};a(u.shape,l),d.updateProps(s,u,o,e),f.each(g,function(i){var o=t.getItemVisual(e,i),a=n(i);if(this[a]!==o){this.remove(this.childOfName(i));var s=r(i,t,e);this.add(s)}this[a]=o},this),this._updateCommonStl(t,e,i)},m._updateCommonStl=function(t,e,i){var n=t.hostModel,r=this.childOfName("line"),o=i&&i.lineStyle,a=i&&i.hoverLineStyle,s=i&&i.labelModel,l=i&&i.hoverLabelModel;if(!i||t.hasItemOption){var u=t.getItemModel(e);o=u.getModel("lineStyle.normal").getLineStyle(),a=u.getModel("lineStyle.emphasis").getLineStyle(),s=u.getModel("label.normal"),l=u.getModel("label.emphasis")}var h=t.getItemVisual(e,"color"),c=f.retrieve(t.getItemVisual(e,"opacity"),o.opacity,1);r.useStyle(f.defaults({strokeNoScale:!0,fill:"none",stroke:h,opacity:c},o)),r.hoverStyle=a,f.each(g,function(t){var e=this.childOfName(t);e&&(e.setColor(h),e.setStyle({opacity:c}))},this);var m,v,y=s.getShallow("show"),x=l.getShallow("show"),_=this.childOfName("label");if(y||x){var b=n.getRawValue(e);v=null==b?v=t.getName(e):isFinite(b)?p.round(b):b,m=h||"#000"}if(y){var w=s.getModel("textStyle");_.setStyle({text:f.retrieve(n.getFormattedLabel(e,"normal",t.dataType),v),textFont:w.getFont(),fill:w.getTextColor()||m}),_.__textAlign=w.get("align"),_.__verticalAlign=w.get("baseline"),_.__position=s.get("position")}else _.setStyle("text","");if(x){var M=l.getModel("textStyle");_.hoverStyle={text:f.retrieve(n.getFormattedLabel(e,"emphasis",t.dataType),v),textFont:M.getFont(),fill:M.getTextColor()||m}}else _.hoverStyle={text:""};_.ignore=!y&&!x,d.setHoverStyle(this)},m.updateLayout=function(t,e){this.setLinePoints(t.getItemLayout(e))},m.setLinePoints=function(t){var e=this.childOfName("line");a(e.shape,t),e.dirty()},f.inherits(l,d.Group),t.exports=l},function(t,e,i){function n(t){return isNaN(t[0])||isNaN(t[1])}function r(t){return!n(t[0])&&!n(t[1])}function o(t){this._ctor=t||s,this.group=new a.Group}var a=i(3),s=i(108),l=o.prototype;l.updateData=function(t){var e=this._lineData,i=this.group,n=this._ctor,o=t.hostModel,a={lineStyle:o.getModel("lineStyle.normal").getLineStyle(),hoverLineStyle:o.getModel("lineStyle.emphasis").getLineStyle(),labelModel:o.getModel("label.normal"),hoverLabelModel:o.getModel("label.emphasis")};t.diff(e).add(function(e){if(r(t.getItemLayout(e))){var o=new n(t,e,a);t.setItemGraphicEl(e,o),i.add(o)}}).update(function(o,s){var l=e.getItemGraphicEl(s);return r(t.getItemLayout(o))?(l?l.updateData(t,o,a):l=new n(t,o,a),t.setItemGraphicEl(o,l),void i.add(l)):void i.remove(l)}).remove(function(t){i.remove(e.getItemGraphicEl(t))}).execute(),this._lineData=t},l.updateLayout=function(){var t=this._lineData;t.eachItemGraphicEl(function(e,i){e.updateLayout(t,i)},this)},l.remove=function(){this.group.removeAll()},t.exports=o},function(t,e,i){var n=i(1),r=i(2),o=r.PRIORITY;i(111),i(112),r.registerVisual(n.curry(i(50),"line","circle","line")),r.registerLayout(n.curry(i(61),"line")),r.registerProcessor(o.PROCESSOR.STATISTIC,n.curry(i(149),"line")),i(38)},function(t,e,i){"use strict";var n=i(27),r=i(18);t.exports=r.extend({type:"series.line",dependencies:["grid","polar"],getInitialData:function(t,e){return n(t.data,this,e)},defaultOption:{zlevel:0,z:2,coordinateSystem:"cartesian2d",legendHoverLink:!0,hoverAnimation:!0,clipOverflow:!0,label:{normal:{position:"top"}},lineStyle:{normal:{width:2,type:"solid"}},step:!1,smooth:!1,smoothMonotone:null,symbol:"emptyCircle",symbolSize:4,symbolRotate:null,showSymbol:!0,showAllSymbol:!1,connectNulls:!1,sampling:"none",animationEasing:"linear",progressive:0,hoverLayerThreshold:1/0}})},function(t,e,i){"use strict";function n(t,e){if(t.length===e.length){for(var i=0;ie[0]?1:-1;e[0]+=n*i,e[1]-=n*i}return e}function a(t){return t>=0?1:-1}function s(t,e){var i=t.getBaseAxis(),n=t.getOtherAxis(i),r=i.onZero?0:n.scale.getExtent()[0],o=n.dim,s="x"===o||"radius"===o?1:0;return e.mapArray([o],function(n,l){for(var u,h=e.stackedOn;h&&a(h.get(o,l))===a(n);){u=h;break}var c=[];return c[s]=e.get(i.dim,l),c[1-s]=u?u.get(o,l,!0):r,t.dataToPoint(c)},!0)}function l(t,e,i){var n=o(t.getAxis("x")),r=o(t.getAxis("y")),a=t.getBaseAxis().isHorizontal(),s=Math.min(n[0],n[1]),l=Math.min(r[0],r[1]),u=Math.max(n[0],n[1])-s,h=Math.max(r[0],r[1])-l,c=i.get("lineStyle.normal.width")||2,d=i.get("clipOverflow")?c/2:Math.max(u,h);a?(l-=d,h+=2*d):(s-=d,u+=2*d);var f=new v.Rect({shape:{x:s,y:l,width:u,height:h}});return e&&(f.shape[a?"width":"height"]=0,v.initProps(f,{shape:{width:u,height:h}},i)),f}function u(t,e,i){var n=t.getAngleAxis(),r=t.getRadiusAxis(),o=r.getExtent(),a=n.getExtent(),s=Math.PI/180,l=new v.Sector({shape:{cx:t.cx,cy:t.cy,r0:o[0],r:o[1],startAngle:-a[0]*s,endAngle:-a[1]*s,clockwise:n.inverse}});return e&&(l.shape.endAngle=-a[0]*s,v.initProps(l,{shape:{endAngle:-a[1]*s}},i)),l}function h(t,e,i){return"polar"===t.type?u(t,e,i):l(t,e,i)}function c(t,e,i){for(var n=e.getBaseAxis(),r="x"===n.dim||"radius"===n.dim?0:1,o=[],a=0;a=0;r--)if(i[r].dimension<2){n=i[r];break}if(n&&"cartesian2d"===e.type){var o=n.dimension,a=t.dimensions[o],s=e.getAxis(a),l=f.map(n.stops,function(t){return{coord:s.toGlobalCoord(s.dataToCoord(t.value)),color:t.color}}),u=l.length,h=n.outerColors.slice();u&&l[0].coord>l[u-1].coord&&(l.reverse(),h.reverse());var c=10,d=l[0].coord-c,p=l[u-1].coord+c,g=p-d;if(g<.001)return"transparent";f.each(l,function(t){t.offset=(t.coord-d)/g}),l.push({offset:u?l[u-1].offset:.5,color:h[1]||"transparent"}),l.unshift({offset:u?l[0].offset:.5,color:h[0]||"transparent"});var m=new v.LinearGradient(0,0,0,0,l,(!0));return m[a]=d,m[a+"2"]=p,m}}}var f=i(1),p=i(44),g=i(54),m=i(113),v=i(3),y=i(5),x=i(91),_=i(29);t.exports=_.extend({type:"line",init:function(){var t=new v.Group,e=new p;this.group.add(e.group),this._symbolDraw=e,this._lineGroup=t},render:function(t,e,i){var o=t.coordinateSystem,a=this.group,l=t.getData(),u=t.getModel("lineStyle.normal"),p=t.getModel("areaStyle.normal"),g=l.mapArray(l.getItemLayout,!0),m="polar"===o.type,v=this._coordSys,y=this._symbolDraw,x=this._polyline,_=this._polygon,b=this._lineGroup,w=t.get("animation"),M=!p.isEmpty(),S=s(o,l),T=t.get("showSymbol"),A=T&&!m&&!t.get("showAllSymbol")&&this._getSymbolIgnoreFunc(l,o),I=this._data;I&&I.eachItemGraphicEl(function(t,e){t.__temp&&(a.remove(t),I.setItemGraphicEl(e,null))}),T||y.remove(),a.add(b);var C=!m&&t.get("step");x&&v.type===o.type&&C===this._step?(M&&!_?_=this._newPolygon(g,S,o,w):_&&!M&&(b.remove(_),_=this._polygon=null),b.setClipPath(h(o,!1,t)),T&&y.updateData(l,A),l.eachItemGraphicEl(function(t){t.stopAnimation(!0)}),n(this._stackedOnPoints,S)&&n(this._points,g)||(w?this._updateAnimation(l,S,o,i,C):(C&&(g=c(g,o,C),S=c(S,o,C)),x.setShape({points:g}),_&&_.setShape({points:g,stackedOnPoints:S})))):(T&&y.updateData(l,A),C&&(g=c(g,o,C),S=c(S,o,C)),x=this._newPolyline(g,o,w),M&&(_=this._newPolygon(g,S,o,w)),b.setClipPath(h(o,!0,t)));var P=d(l,o)||l.getVisual("color");x.useStyle(f.defaults(u.getLineStyle(),{fill:"none",stroke:P,lineJoin:"bevel"}));var k=t.get("smooth");if(k=r(t.get("smooth")),x.setShape({smooth:k,smoothMonotone:t.get("smoothMonotone"),connectNulls:t.get("connectNulls")}),_){var L=l.stackedOn,D=0;if(_.useStyle(f.defaults(p.getAreaStyle(),{fill:P,opacity:.7,lineJoin:"bevel"})),L){var O=L.hostModel;D=r(O.get("smooth"))}_.setShape({smooth:k,stackedOnSmooth:D,smoothMonotone:t.get("smoothMonotone"),connectNulls:t.get("connectNulls")})}this._data=l,this._coordSys=o,this._stackedOnPoints=S,this._points=g,this._step=C},dispose:function(){},highlight:function(t,e,i,n){var r=t.getData(),o=y.queryDataIndex(r,n);if(!(o instanceof Array)&&null!=o&&o>=0){var a=r.getItemGraphicEl(o);if(!a){var s=r.getItemLayout(o);if(!s)return;a=new g(r,o),a.position=s,a.setZ(t.get("zlevel"),t.get("z")),a.ignore=isNaN(s[0])||isNaN(s[1]),a.__temp=!0,r.setItemGraphicEl(o,a),a.stopSymbolAnimation(!0),this.group.add(a)}a.highlight()}else _.prototype.highlight.call(this,t,e,i,n)},downplay:function(t,e,i,n){var r=t.getData(),o=y.queryDataIndex(r,n);if(null!=o&&o>=0){var a=r.getItemGraphicEl(o);a&&(a.__temp?(r.setItemGraphicEl(o,null),this.group.remove(a)):a.downplay())}else _.prototype.downplay.call(this,t,e,i,n)},_newPolyline:function(t){var e=this._polyline;return e&&this._lineGroup.remove(e),e=new x.Polyline({shape:{points:t},silent:!0,z2:10}),this._lineGroup.add(e),this._polyline=e,e},_newPolygon:function(t,e){var i=this._polygon;return i&&this._lineGroup.remove(i),i=new x.Polygon({shape:{points:t,stackedOnPoints:e},silent:!0}),this._lineGroup.add(i),this._polygon=i,i},_getSymbolIgnoreFunc:function(t,e){var i=e.getAxesByScale("ordinal")[0];if(i&&i.isLabelIgnored)return f.bind(i.isLabelIgnored,i)},_updateAnimation:function(t,e,i,n,r){var o=this._polyline,a=this._polygon,s=t.hostModel,l=m(this._data,t,this._stackedOnPoints,e,this._coordSys,i),u=l.current,h=l.stackedOnCurrent,d=l.next,f=l.stackedOnNext;r&&(u=c(l.current,i,r),h=c(l.stackedOnCurrent,i,r),d=c(l.next,i,r),f=c(l.stackedOnNext,i,r)),o.shape.__points=l.current,o.shape.points=u,v.updateProps(o,{shape:{points:d}},s),a&&(a.setShape({points:u,stackedOnPoints:h}),v.updateProps(a,{shape:{points:d,stackedOnPoints:f}},s));for(var p=[],g=l.status,y=0;y=0?1:-1}function n(t,e,n){for(var r,o=t.getBaseAxis(),a=t.getOtherAxis(o),s=o.onZero?0:a.scale.getExtent()[0],l=a.dim,u="x"===l||"radius"===l?1:0,h=e.stackedOn,c=e.get(l,n);h&&i(h.get(l,n))===i(c);){r=h;break}var d=[];return d[u]=e.get(o.dim,n),d[1-u]=r?r.get(l,n,!0):s,t.dataToPoint(d)}function r(t,e){var i=[];return e.diff(t).add(function(t){i.push({cmd:"+",idx:t})}).update(function(t,e){i.push({cmd:"=",idx:e,idx1:t})}).remove(function(t){i.push({cmd:"-",idx:t})}).execute(),i}t.exports=function(t,e,i,o,a,s){for(var l=r(t,e),u=[],h=[],c=[],d=[],f=[],p=[],g=[],m=s.dimensions,v=0;v0&&"scale"!==d){var g=a.getItemLayout(0),m=Math.max(i.getWidth(),i.getHeight())/2,v=l.bind(u.removeClipPath,u);u.setClipPath(this._createClipPath(g.cx,g.cy,m,g.startAngle,g.clockwise,v,t))}this._data=a}},dispose:function(){},_createClipPath:function(t,e,i,n,r,o,a){var l=new s.Sector({shape:{cx:t,cy:e,r0:0,r:i,startAngle:n,endAngle:n,clockwise:r}});return s.initProps(l,{shape:{endAngle:n+(r?1:-1)*Math.PI*2}},a,o),l},containPoint:function(t,e){var i=e.getData(),n=i.getItemLayout(0);if(n){var r=t[0]-n.cx,o=t[1]-n.cy,a=Math.sqrt(r*r+o*o);return a<=n.r&&a>=n.r0}}});t.exports=h},function(t,e,i){"use strict";function n(t,e,i,n,r,o,a){function s(e,i,n,r){for(var o=e;oe&&o+1t[o].y+t[o].height)return void l(o,n/2);l(i-1,n/2)}function l(e,i){for(var n=e;n>=0&&(t[n].y-=i,!(n>0&&t[n].y>t[n-1].y+t[n-1].height));n--);}function u(t,e,i,n,r,o){for(var a=o>0?e?Number.MAX_VALUE:0:e?Number.MAX_VALUE:0,s=0,l=t.length;s=a&&(d=a-10),!e&&d<=a&&(d=a+10),t[s].x=i+d*o,a=d}}t.sort(function(t,e){return t.y-e.y});for(var h,c=0,d=t.length,f=[],p=[],g=0;g=i?p.push(t[g]):f.push(t[g]);u(f,!1,e,i,n,r),u(p,!0,e,i,n,r)}function r(t,e,i,r,o,a){for(var s=[],l=[],u=0;u0?"left":"right"}var k=g.getModel("textStyle").getFont(),L=g.get("rotate")?b<0?-_+Math.PI:-_:0,D=t.getFormattedLabel(i,"normal")||l.getName(i),O=o.getBoundingRect(D,k,d,"top");h=!!L,f.label={x:n,y:r,position:m,height:O.height,len:y,len2:x,linePoints:c,textAlign:d,verticalAlign:"middle",font:k,rotation:L},M||u.push(f.label)}),!h&&t.get("avoidLabelOverlap")&&r(u,a,s,e,i,n)}},function(t,e,i){var n=i(4),r=n.parsePercent,o=i(117),a=i(1),s=2*Math.PI,l=Math.PI/180;t.exports=function(t,e,i,u){e.eachSeriesByType(t,function(t){var e=t.get("center"),u=t.get("radius");a.isArray(u)||(u=[0,u]),a.isArray(e)||(e=[e,e]);var h=i.getWidth(),c=i.getHeight(),d=Math.min(h,c),f=r(e[0],h),p=r(e[1],c),g=r(u[0],d/2),m=r(u[1],d/2),v=t.getData(),y=-t.get("startAngle")*l,x=t.get("minAngle")*l,_=v.getSum("value"),b=Math.PI/(_||v.count())*2,w=t.get("clockwise"),M=t.get("roseType"),S=t.get("stillShowZeroSum"),T=v.getDataExtent("value");T[0]=0;var A=s,I=0,C=y,P=w?1:-1;if(v.each("value",function(t,e){var i;if(isNaN(t))return void v.setItemLayout(e,{angle:NaN,startAngle:NaN,endAngle:NaN,clockwise:w,cx:f,cy:p,r0:g,r:M?NaN:m});i="area"!==M?0===_&&S?b:t*b:s/(v.count()||1),i=0)&&i({type:"updateAxisPointer",currTrigger:t,x:e&&e.offsetX,y:e&&e.offsetY})})},remove:function(t,e){n.disopse(e.getZr(),"axisPointer"),r.superApply(this._model,"remove",arguments)},dispose:function(t,e){n.unregister("axisPointer",e),r.superApply(this._model,"dispose",arguments)}})},function(t,e,i){"use strict";function n(t,e){var i={};return i[e.dim+"AxisIndex"]=e.index,t.getCartesian(i)}function r(t){return"x"===t.dim?0:1}var o=i(3),a=i(74),s=i(55),l=i(58),u=a.extend({makeElOption:function(t,e,i,r,o){var a=i.axis,u=a.grid,c=r.get("type"),d=n(u,a).getOtherAxis(a).getGlobalExtent(),f=a.toGlobalCoord(a.dataToCoord(e,!0)),p=s.buildElStyle(r),g=h[c](a,f,d,p);g.style=p,t.graphicKey=g.type,t.pointer=g;var m=l.layout(u.model,i);s.buildCartesianSingleLabelElOption(e,t,m,i,r,o)},getHandleTransform:function(t,e,i){var n=l.layout(e.axis.grid.model,e,{labelInside:!1});return n.labelMargin=i.get("handle.margin"),{position:s.getTransformedPosition(e.axis,t,n),rotation:n.rotation+(n.labelDirection<0?Math.PI:0)}},updateHandleTransform:function(t,e,i,r){var o=i.axis,a=o.grid,s=o.getGlobalExtent(!0),l=n(a,o).getOtherAxis(o).getGlobalExtent(),u="x"===o.dim?0:1,h=t.position;h[u]+=e[u],h[u]=Math.min(s[1],h[u]),h[u]=Math.max(s[0],h[u]);var c=(l[1]+l[0])/2,d=[c,c];d[u]=h[u];var f=[{verticalAlign:"middle"},{align:"center"}];return{position:h,rotation:t.rotation,cursorPoint:d,tooltipOption:f[u]}}}),h={line:function(t,e,i,n){var a=s.makeLineShape([e,i[0]],[e,i[1]],r(t));return o.subPixelOptimizeLine({shape:a,style:n}),{type:"Line",shape:a}},shadow:function(t,e,i,n){var o=t.getBandWidth(),a=i[1]-i[0];return{type:"Rect",shape:s.makeRectShape([e-o/2,i[0]],[o,a],r(t))}}};t.exports=u},function(t,e,i){function n(t,e,i,n,o,g,m,v){var b=[];b=null!=i.x&&null!=i.y?[i.x,i.y]:y({seriesIndex:i.seriesIndex,dataIndex:i.dataIndex},o).point;var w=t.axesInfo,M="leave"===e||p(b),S={},T={},A={list:[],map:{}},I=[],C={showPointer:_(a,T),showTooltip:_(s,A),highlight:_(l,I)};return x(t.coordSysMap,function(e,n){var o=e.containPoint(b);x(t.coordSysAxesInfo[n],function(t,e){var n=t.axis;M||!o||d(i,n)||r(t,n.pointToData(b),C,!1,S)})}),x(w,function(t,e){var i=t.linkGroup;i&&!T[e]&&x(i.axesInfo,function(e,n){var o=T[n];if(e!==t&&o){var a=o.value;i.mapper&&(a=t.axis.scale.parse(i.mapper(a,f(e),f(t)))),r(t,a,C,!0,S)}})}),u(T,w),h(A,b,m,n),c(I,n,g,v),S}function r(t,e,i,n,r){var a=t.axis;if(!a.scale.isBlank()&&a.containData(e)){if(!t.involveSeries)return void i.showPointer(t,e);var s=o(e,t),l=s.payloadBatch,u=s.snapToValue;l[0]&&null==r.seriesIndex&&g.extend(r,l[0]),!n&&t.snap&&a.containData(u)&&null!=u&&(e=u),i.highlight("highlight",l),i.showPointer(t,e,l),i.showTooltip(t,s,u)}}function o(t,e){var i=e.axis,n=i.dim,r=t,o=[],a=Number.MAX_VALUE,s=-1;return x(e.seriesModels,function(e,l){var u,h,c=e.coordDimToDataDim(n);if(e.getAxisTooltipData){var d=e.getAxisTooltipData(c,t,i);h=d.dataIndices,u=d.nestestValue}else{if(h=e.getData().indexOfNearest(c[0],t,!1,"category"===i.type?.5:null),!h.length)return;u=e.getData().get(c[0],h[0])}if(null!=u&&isFinite(u)){var f=t-u,p=Math.abs(f);p<=a&&((p=0&&s<0)&&(a=p,s=f,r=u,o.length=0),x(h,function(t){o.push({seriesIndex:e.seriesIndex,dataIndexInside:t,dataIndex:e.getData().getRawIndex(t)})}))}}),{payloadBatch:o,snapToValue:r}}function a(t,e,i,n){t[e.key]={value:i,payloadBatch:n}}function s(t,e,i,n){var r=i.payloadBatch,o=e.axis,a=o.model,s=e.axisPointerModel;if(e.triggerTooltip&&r.length){var l=e.coordSys.model,u=v.makeKey(l),h=t.map[u];h||(h=t.map[u]={coordSysId:l.id,coordSysIndex:l.componentIndex,coordSysType:l.type,coordSysMainType:l.mainType,dataByAxis:[]},t.list.push(h)),h.dataByAxis.push({axisDim:o.dim,axisIndex:a.componentIndex,axisType:a.type,axisId:a.id,value:n,valueLabelOpt:{precision:s.get("label.precision"),formatter:s.get("label.formatter")},seriesDataIndices:r.slice()})}}function l(t,e,i){t.push.apply(t,i)}function u(t,e){x(e,function(e,i){var n=e.axisPointerModel.option,r=t[i];r?(!e.useHandle&&(n.status="show"),n.value=r.value,n.seriesDataIndices=(r.payloadBatch||[]).slice()):!e.useHandle&&(n.status="hide")})}function h(t,e,i,n){if(p(e)||!t.list.length)return void n({type:"hideTip"});var r=((t.list[0].dataByAxis[0]||{}).seriesDataIndices||[])[0]||{};n({type:"showTip",escapeConnect:!0,x:e[0],y:e[1],tooltipOption:i,dataIndexInside:r.dataIndexInside,dataIndex:r.dataIndex,seriesIndex:r.seriesIndex,dataByCoordSys:t.list})}function c(t,e,i,n){var r=i.getZr();n="lastHighlights"+(n||"");var o=b(r)[n]||{},a=b(r)[n]={};g.each(t,function(t){var e=t.seriesIndex+" | "+t.dataIndex;a[e]=t});var s=[],l=[];g.each(o,function(t,e){!a[e]&&l.push(t)}),g.each(a,function(t,e){!o[e]&&s.push(t)}),l.length&&i.dispatchAction({type:"downplay",escapeConnect:!0,batch:l}),s.length&&i.dispatchAction({type:"highlight",escapeConnect:!0,batch:s})}function d(t,e){var i=1;return x(t,function(t,e){i&=!/^.+(AxisId|AxisName|AxisIndex)$/.test(e)}),!i&&x([["AxisId","id"],["AxisIndex","componentIndex"],["AxisName","name"]],function(n){var r=m.normalizeToArray(t[e.dim+n[0]]);i|=g.indexOf(r,e.model[n[1]])>=0}),!i}function f(t){var e=t.axis.model,i={},n=i.axisDim=t.axis.dim;return i.axisIndex=i[n+"AxisIndex"]=e.componentIndex,i.axisName=i[n+"AxisName"]=e.name,i.axisId=i[n+"AxisId"]=e.id,i}function p(t){return null==t[0]||isNaN(t[0])||null==t[1]||isNaN(t[1])}var g=i(1),m=i(5),v=i(32),y=i(75),x=g.each,_=g.curry,b=m.makeGetter();t.exports=n},function(t,e,i){var n=i(1),r=i(77),o=i(2);o.registerAction("dataZoom",function(t,e){var i=r.createLinkedNodesFinder(n.bind(e.eachComponent,e,"dataZoom"),r.eachAxisDim,function(t,e){return t.get(e.axisIndex)}),o=[];e.eachComponent({mainType:"dataZoom",query:t},function(t,e){o.push.apply(o,i(t).nodes)}),n.each(o,function(e,i){e.setRawRange({start:t.start,end:t.end,startValue:t.startValue,endValue:t.endValue})})})},function(t,e,i){function n(t,e,i){i.getAxisProxy(t.name,e).reset(i)}function r(t,e,i){i.getAxisProxy(t.name,e).filterData(i)}var o=i(2);o.registerProcessor(function(t,e){t.eachComponent("dataZoom",function(t){t.eachTargetAxis(n),t.eachTargetAxis(r)}),t.eachComponent("dataZoom",function(t){var e=t.findRepresentativeAxisProxy(),i=e.getDataPercentWindow(),n=e.getDataValueWindow();t.setRawRange({start:i[0],end:i[1],startValue:n[0],endValue:n[1]},!0)})})},function(t,e,i){function n(t){var e=t[a];return e||(e=t[a]=[{}]),e}var r=i(1),o=r.each,a="\0_ec_hist_store",s={push:function(t,e){var i=n(t);o(e,function(e,n){for(var r=i.length-1;r>=0;r--){var o=i[r];if(o[n])break}if(r<0){var a=t.queryComponents({mainType:"dataZoom",subType:"select",id:n})[0];if(a){var s=a.getPercentRange();i[0][n]={dataZoomId:n,start:s[0],end:s[1]}}}}),i.push(e)},pop:function(t){var e=n(t),i=e[e.length-1];e.length>1&&e.pop();var r={};return o(i,function(t,i){for(var n=e.length-1;n>=0;n--){var t=e[n][i];if(t){r[i]=t;break}}}),r},clear:function(t){t[a]=null},count:function(t){return n(t).length}};t.exports=s},function(t,e,i){i(13).registerSubTypeDefaulter("dataZoom",function(t){return"slider"})},function(t,e,i){function n(t){B.call(this),this._zr=t,this.group=new G.Group,this._brushType,this._brushOption,this._panels,this._track=[],this._dragging,this._covers=[],this._creatingCover,this._creatingPanel,this._enableGlobalPan,this._uid="brushController_"+nt++,this._handlers={},q(rt,function(t,e){this._handlers[e]=V.bind(t,this)},this)}function r(t,e){var i=t._zr;t._enableGlobalPan||H.take(i,J,t._uid),q(t._handlers,function(t,e){i.on(e,t)}),t._brushType=e.brushType,t._brushOption=V.merge(V.clone(it),e,!0)}function o(t){var e=t._zr;H.release(e,J,t._uid),q(t._handlers,function(t,i){e.off(i,t)}),t._brushType=t._brushOption=null}function a(t,e){var i=ot[e.brushType].createCover(t,e);return u(i),i.__brushOption=e,t.group.add(i),i}function s(t,e){var i=c(e);return i.endCreating&&(i.endCreating(t,e),u(e)),e}function l(t,e){var i=e.__brushOption;c(e).updateCoverShape(t,e,i.range,i)}function u(t){t.traverse(function(t){t.z=$,t.z2=$})}function h(t,e){c(e).updateCommon(t,e),l(t,e)}function c(t){return ot[t.__brushOption.brushType]}function d(t,e,i){var n=t._panels;if(!n)return!0;var r;return q(n,function(t){t.contain(e,i)&&(r=t)}),r}function f(t,e){var i=t._panels;if(!i)return!0;var n=e.__brushOption.panelId;return null==n||i[n]}function p(t){var e=t._covers,i=e.length;return q(e,function(e){t.group.remove(e)},t),e.length=0,!!i}function g(t,e){var i=j(t._covers,function(t){var e=t.__brushOption,i=V.clone(e.range);return{brushType:e.brushType,panelId:e.panelId,range:i}});t.trigger("brush",i,{isEnd:!!e.isEnd,removeOnClick:!!e.removeOnClick})}function m(t){var e=t._track;if(!e.length)return!1;var i=e[e.length-1],n=e[0],r=i[0]-n[0],o=i[1]-n[1],a=Y(r*r+o*o,.5);return a>K}function v(t){var e=t.length-1;return e<0&&(e=0),[t[0],t[e]]}function y(t,e,i,n){var r=new G.Group;return r.add(new G.Rect({name:"main",style:w(i),silent:!0,draggable:!0,cursor:"move",drift:Z(t,e,r,"nswe"),ondragend:Z(g,e,{isEnd:!0})})),q(n,function(i){r.add(new G.Rect({name:i,style:{opacity:0},draggable:!0,silent:!0,invisible:!0,drift:Z(t,e,r,i),ondragend:Z(g,e,{isEnd:!0})}))}),r}function x(t,e,i,n){var r=n.brushStyle.lineWidth||0,o=X(r,Q),a=i[0][0],s=i[1][0],l=a-r/2,u=s-r/2,h=i[0][1],c=i[1][1],d=h-o+r/2,f=c-o+r/2,p=h-a,g=c-s,m=p+r,v=g+r;b(t,e,"main",a,s,p,g),n.transformable&&(b(t,e,"w",l,u,o,v),b(t,e,"e",d,u,o,v),b(t,e,"n",l,u,m,o),b(t,e,"s",l,f,m,o),b(t,e,"nw",l,u,o,o),b(t,e,"ne",d,u,o,o),b(t,e,"sw",l,f,o,o),b(t,e,"se",d,f,o,o))}function _(t,e){var i=e.__brushOption,n=i.transformable,r=e.childAt(0);r.useStyle(w(i)),r.attr({silent:!n,cursor:n?"move":"default"}),q(["w","e","n","s","se","sw","ne","nw"],function(i){var r=e.childOfName(i),o=T(t,i);r&&r.attr({silent:!n,invisible:!n,cursor:n?et[o]+"-resize":null})})}function b(t,e,i,n,r,o,a){var s=e.childOfName(i);s&&s.setShape(k(P(t,e,[[n,r],[n+o,r+a]])))}function w(t){return V.defaults({strokeNoScale:!0},t.brushStyle)}function M(t,e,i,n){var r=[U(t,i),U(e,n)],o=[X(t,i),X(e,n)];return[[r[0],o[0]],[r[1],o[1]]]}function S(t){return G.getTransform(t.group)}function T(t,e){if(e.length>1){e=e.split("");var i=[T(t,e[0]),T(t,e[1])];return("e"===i[0]||"w"===i[0])&&i.reverse(),i.join("")}var n={w:"left",e:"right",n:"top",s:"bottom"},r={left:"w",right:"e",top:"n",bottom:"s"},i=G.transformDirection(n[e],S(t));return r[i]}function A(t,e,i,n,r,o,a,s){var l=n.__brushOption,u=t(l.range),c=C(i,o,a);q(r.split(""),function(t){var e=tt[t];u[e[0]][e[1]]+=c[e[0]]}),l.range=e(M(u[0][0],u[1][0],u[0][1],u[1][1])),h(i,n),g(i,{isEnd:!1})}function I(t,e,i,n,r){var o=e.__brushOption.range,a=C(t,i,n);q(o,function(t){t[0]+=a[0],t[1]+=a[1]}),h(t,e),g(t,{isEnd:!1})}function C(t,e,i){var n=t.group,r=n.transformCoordToLocal(e,i),o=n.transformCoordToLocal(0,0);return[r[0]-o[0],r[1]-o[1]]}function P(t,e,i){var n=f(t,e);if(n===!0)return V.clone(i);var r=n.getBoundingRect();return V.map(i,function(t){var e=t[0];e=X(e,r.x),e=U(e,r.x+r.width);var i=t[1];return i=X(i,r.y),i=U(i,r.y+r.height),[e,i]})}function k(t){var e=U(t[0][0],t[1][0]),i=U(t[0][1],t[1][1]),n=X(t[0][0],t[1][0]),r=X(t[0][1],t[1][1]);return{x:e,y:i,width:n-e,height:r-i}}function L(t,e){var i=e.offsetX,n=e.offsetY,r=t._zr;if(t._brushType){for(var o,a=t._panels,s=t._covers,l=0;le[1]&&e.reverse(),e},getOtherAxis:function(){this.grid.getOtherAxis()},getLabelInterval:function(){var t=this._labelInterval;return t||(t=this._labelInterval=o(this)),t},isLabelIgnored:function(t){if("category"===this.type){var e=this.getLabelInterval();return"function"==typeof e&&!e(t,this.scale.getLabel(t))||t%(e+1)}},pointToData:function(t,e){return this.coordToData(this.toLocalCoord(t["x"===this.dim?0:1]),e)},toLocalCoord:null,toGlobalCoord:null},n.inherits(a,r),t.exports=a},function(t,e,i){"use strict";function n(t){return this._axes[t]}var r=i(1),o=function(t){this._axes={},this._dimList=[],this.name=t||""};o.prototype={constructor:o,type:"cartesian",getAxis:function(t){return this._axes[t]},getAxes:function(){return r.map(this._dimList,n,this)},getAxesByScale:function(t){return t=t.toLowerCase(),r.filter(this.getAxes(),function(e){return e.scale.type===t})},addAxis:function(t){var e=t.dim;this._axes[e]=t,this._dimList.push(e)},dataToCoord:function(t){return this._dataCoordConvert(t,"dataToCoord")},coordToData:function(t){return this._dataCoordConvert(t,"coordToData")},_dataCoordConvert:function(t,e){for(var i=this._dimList,n=t instanceof Array?[]:{},r=0;r=0;n--)c.isIdInner(e[n])&&e.splice(n,1);t[i]=e}}),delete t[b],t},getTheme:function(){return this._theme},getComponent:function(t,e){var i=this._componentsMap[t];if(i)return i[e||0]},queryComponents:function(t){var e=t.mainType;if(!e)return[];var i=t.index,n=t.id,r=t.name,o=this._componentsMap[e];if(!o||!o.length)return[];var a;if(null!=i)m(i)||(i=[i]),a=p(g(i,function(t){return o[t]}),function(t){return!!t});else if(null!=n){var s=m(n);a=p(o,function(t){return s&&v(n,t.id)>=0||!s&&t.id===n})}else if(null!=r){var u=m(r);a=p(o,function(t){return u&&v(r,t.name)>=0||!u&&t.name===r})}else a=o.slice();return l(a,t)},findComponents:function(t){function e(t){var e=r+"Index",i=r+"Id",n=r+"Name";return!t||null==t[e]&&null==t[i]&&null==t[n]?null:{mainType:r,index:t[e],id:t[i],name:t[n]}}function i(e){return t.filter?p(e,t.filter):e}var n=t.query,r=t.mainType,o=e(n),a=o?this.queryComponents(o):this._componentsMap[r];return i(l(a,t))},eachComponent:function(t,e,i){var n=this._componentsMap;if("function"==typeof t)i=e,e=t,f(n,function(t,n){f(t,function(t,r){e.call(i,n,t,r)})});else if(h.isString(t))f(n[t],e,i);else if(y(t)){var r=this.findComponents(t);f(r,e,i)}},getSeriesByName:function(t){var e=this._componentsMap.series;return p(e,function(e){return e.name===t})},getSeriesByIndex:function(t){return this._componentsMap.series[t]},getSeriesByType:function(t){var e=this._componentsMap.series;return p(e,function(e){return e.subType===t})},getSeries:function(){return this._componentsMap.series.slice()},eachSeries:function(t,e){u(this),f(this._seriesIndices,function(i){var n=this._componentsMap.series[i];t.call(e,n,i)},this)},eachRawSeries:function(t,e){f(this._componentsMap.series,t,e)},eachSeriesByType:function(t,e,i){u(this),f(this._seriesIndices,function(n){var r=this._componentsMap.series[n];r.subType===t&&e.call(i,r,n)},this)},eachRawSeriesByType:function(t,e,i){return f(this.getSeriesByType(t),e,i)},isSeriesFiltered:function(t){return u(this),h.indexOf(this._seriesIndices,t.componentIndex)<0},filterSeries:function(t,e){u(this);var i=p(this._componentsMap.series,t,e);this._seriesIndices=s(i)},restoreData:function(){var t=this._componentsMap;this._seriesIndices=s(t.series);var e=[];f(t,function(t,i){e.push(i)}),x.topologicalTravel(e,x.getAllClassMainTypes(),function(e,i){f(t[e],function(t){t.restoreData()})})}});h.mixin(w,i(62)),t.exports=w},function(t,e,i){function n(t){this._api=t,this._timelineOptions=[],this._mediaList=[],this._mediaDefault,this._currentMediaIndices=[],this._optionBackup,this._newBaseOption}function r(t,e,i){var n,r,o=[],a=[],s=t.timeline;if(t.baseOption&&(r=t.baseOption),(s||t.options)&&(r=r||{},o=(t.options||[]).slice()),t.media){r=r||{};var l=t.media;d(l,function(t){t&&t.option&&(t.query?a.push(t):n||(n=t))})}return r||(r=t),r.timeline||(r.timeline=s),d([r].concat(o).concat(u.map(a,function(t){return t.option})),function(t){d(e,function(e){e(t,i)})}),{baseOption:r,timelineOptions:o,mediaDefault:n,mediaList:a}}function o(t,e,i){var n={width:e,height:i,aspectratio:e/i},r=!0;return u.each(t,function(t,e){var i=e.match(m);if(i&&i[1]&&i[2]){var o=i[1],s=i[2].toLowerCase();a(n[s],t,o)||(r=!1)}}),r}function a(t,e,i){return"min"===i?t>=e:"max"===i?t<=e:t===e}function s(t,e){return t.join(",")===e.join(",")}function l(t,e){e=e||{},d(e,function(e,i){if(null!=e){var n=t[i];if(c.hasClass(i)){e=h.normalizeToArray(e),n=h.normalizeToArray(n);var r=h.mappingToExists(n,e);t[i]=p(r,function(t){return t.option&&t.exist?g(t.exist,t.option,!0):t.exist||t.option})}else t[i]=g(n,e,!0)}})}var u=i(1),h=i(5),c=i(13),d=u.each,f=u.clone,p=u.map,g=u.merge,m=/^(min|max)?(.+)$/;n.prototype={constructor:n,setOption:function(t,e){t=f(t,!0);var i=this._optionBackup,n=r.call(this,t,e,!i);this._newBaseOption=n.baseOption,i?(l(i.baseOption,n.baseOption),n.timelineOptions.length&&(i.timelineOptions=n.timelineOptions),n.mediaList.length&&(i.mediaList=n.mediaList),n.mediaDefault&&(i.mediaDefault=n.mediaDefault)):this._optionBackup=n},mountOption:function(t){var e=this._optionBackup;return this._timelineOptions=p(e.timelineOptions,f),this._mediaList=p(e.mediaList,f),this._mediaDefault=f(e.mediaDefault),this._currentMediaIndices=[],f(t?e.baseOption:this._newBaseOption)},getTimelineOption:function(t){var e,i=this._timelineOptions;if(i.length){var n=t.getComponent("timeline");n&&(e=f(i[n.getCurrentIndex()],!0))}return e},getMediaOption:function(t){var e=this._api.getWidth(),i=this._api.getHeight(),n=this._mediaList,r=this._mediaDefault,a=[],l=[];if(!n.length&&!r)return l;for(var u=0,h=n.length;ue&&(e=t[i]);return e},min:function(t){for(var e=1/0,i=0;i1){var c;"string"==typeof r?c=i[r]:"function"==typeof r&&(c=r),c&&(e=e.downSample(s.dim,1/h,c,n),t.setData(e))}}},this)}},function(t,e,i){function n(t,e){return c(t,h(e))}var r=i(1),o=i(34),a=i(4),s=i(43),l=o.prototype,u=s.prototype,h=a.getPrecisionSafe,c=a.round,d=Math.floor,f=Math.ceil,p=Math.pow,g=Math.log,m=o.extend({type:"log",base:10,$constructor:function(){o.apply(this,arguments),this._originalScale=new s},getTicks:function(){var t=this._originalScale,e=this._extent,i=t.getExtent();return r.map(u.getTicks.call(this),function(r){var o=a.round(p(this.base,r));return o=r===e[0]&&t.__fixMin?n(o,i[0]):o,o=r===e[1]&&t.__fixMax?n(o,i[1]):o},this)},getLabel:u.getLabel,scale:function(t){return t=l.scale.call(this,t),p(this.base,t)},setExtent:function(t,e){var i=this.base;t=g(t)/g(i),e=g(e)/g(i),u.setExtent.call(this,t,e)},getExtent:function(){var t=this.base,e=l.getExtent.call(this);e[0]=p(t,e[0]),e[1]=p(t,e[1]);var i=this._originalScale,r=i.getExtent();return i.__fixMin&&(e[0]=n(e[0],r[0])),i.__fixMax&&(e[1]=n(e[1],r[1])),e},unionExtent:function(t){this._originalScale.unionExtent(t);var e=this.base;t[0]=g(t[0])/g(e),t[1]=g(t[1])/g(e),l.unionExtent.call(this,t)},unionExtentFromData:function(t,e){this.unionExtent(t.getDataExtent(e,!0,function(t){return t>0}))},niceTicks:function(t){t=t||10;var e=this._extent,i=e[1]-e[0];if(!(i===1/0||i<=0)){var n=a.quantity(i),r=t/i*n;for(r<=.5&&(n*=10);!isNaN(n)&&Math.abs(n)<1&&Math.abs(n)>0;)n*=10;var o=[a.round(f(e[0]/n)*n),a.round(d(e[1]/n)*n)];this._interval=n,this._niceExtent=o}},niceExtent:function(t,e,i){u.niceExtent.call(this,t,e,i);var n=this._originalScale;n.__fixMin=e,n.__fixMax=i}});r.each(["contain","normalize"],function(t){m.prototype[t]=function(e){return e=g(e)/g(this.base),l[t].call(this,e)}}),m.create=function(){return new m},t.exports=m},function(t,e,i){var n=i(1),r=i(34),o=r.prototype,a=r.extend({type:"ordinal",init:function(t,e){this._data=t,this._extent=e||[0,t.length-1]},parse:function(t){return"string"==typeof t?n.indexOf(this._data,t):Math.round(t)},contain:function(t){return t=this.parse(t),o.contain.call(this,t)&&null!=this._data[t]},normalize:function(t){return o.normalize.call(this,this.parse(t))},scale:function(t){return Math.round(o.scale.call(this,t))},getTicks:function(){for(var t=[],e=this._extent,i=e[0];i<=e[1];)t.push(i),i++;return t},getLabel:function(t){return this._data[t]},count:function(){return this._extent[1]-this._extent[0]+1},unionExtentFromData:function(t,e){this.unionExtent(t.getDataExtent(e,!1))},niceTicks:n.noop,niceExtent:n.noop});a.create=function(){return new a},t.exports=a},function(t,e,i){var n=i(1),r=i(4),o=i(7),a=i(43),s=a.prototype,l=Math.ceil,u=Math.floor,h=1e3,c=60*h,d=60*c,f=24*d,p=function(t,e,i,n){for(;i>>1;t[r][2]=0;r--)if(!n[r].silent&&n[r]!==i&&!n[r].ignore&&o(n[r],t,e))return n[r]}},a.each(["click","mousedown","mouseup","mousewheel","dblclick","contextmenu"],function(t){h.prototype[t]=function(e){var i=this.findHover(e.zrX,e.zrY,null);if("mousedown"===t)this._downel=i,this._upel=i;else if("mosueup"===t)this._upel=i;else if("click"===t&&this._downel!==this._upel)return;this.dispatchToElement(i,t,e)}}),a.mixin(h,l),a.mixin(h,s),t.exports=h},function(t,e,i){function n(){return!1}function r(t,e,i,n){var r=document.createElement(e),o=i.getWidth(),a=i.getHeight(),s=r.style;return s.position="absolute",s.left=0,s.top=0,s.width=o+"px",s.height=a+"px",r.width=o*n,r.height=a*n,r.setAttribute("data-zr-dom-id",t),r}var o=i(1),a=i(35),s=i(72),l=i(71),u=function(t,e,i){var s;i=i||a.devicePixelRatio,"string"==typeof t?s=r(t,"canvas",e,i):o.isObject(t)&&(s=t,t=s.id),this.id=t,this.dom=s;var l=s.style;l&&(s.onselectstart=n,l["-webkit-user-select"]="none",l["user-select"]="none",l["-webkit-touch-callout"]="none",l["-webkit-tap-highlight-color"]="rgba(0,0,0,0)",l.padding=0,l.margin=0,l["border-width"]=0),this.domBack=null,this.ctxBack=null,this.painter=e,this.config=null,this.clearColor=0,this.motionBlur=!1,this.lastFrameAlpha=.7,this.dpr=i};u.prototype={constructor:u,elCount:0,__dirty:!0,initContext:function(){this.ctx=this.dom.getContext("2d"),this.ctx.dpr=this.dpr},createBackBuffer:function(){var t=this.dpr;this.domBack=r("back-"+this.id,"canvas",this.painter,t),this.ctxBack=this.domBack.getContext("2d"),1!=t&&this.ctxBack.scale(t,t)},resize:function(t,e){var i=this.dpr,n=this.dom,r=n.style,o=this.domBack;r.width=t+"px",r.height=e+"px",n.width=t*i,n.height=e*i,o&&(o.width=t*i,o.height=e*i,1!=i&&this.ctxBack.scale(i,i))},clear:function(t){var e=this.dom,i=this.ctx,n=e.width,r=e.height,o=this.clearColor,a=this.motionBlur&&!t,u=this.lastFrameAlpha,h=this.dpr;if(a&&(this.domBack||this.createBackBuffer(),this.ctxBack.globalCompositeOperation="copy",this.ctxBack.drawImage(e,0,0,n/h,r/h)),i.clearRect(0,0,n,r),o){var c;o.colorStops?(c=o.__canvasGradient||s.getGradient(i,o,{x:0,y:0,width:n,height:r}),o.__canvasGradient=c):o.image&&(c=l.prototype.getCanvasPattern.call(o,i)),i.save(),i.fillStyle=c||o,i.fillRect(0,0,n,r),i.restore()}if(a){var d=this.domBack;i.save(),i.globalAlpha=u,i.drawImage(d,0,0,n,r),i.restore()}}},t.exports=u},function(t,e,i){"use strict";function n(t){return parseInt(t,10)}function r(t){return!!t&&(!!t.__builtin__||"function"==typeof t.resize&&"function"==typeof t.refresh)}function o(t){t.__unusedCount++}function a(t){1==t.__unusedCount&&t.clear()}function s(t,e,i){return x.copy(t.getBoundingRect()),t.transform&&x.applyTransform(t.transform),_.width=e,_.height=i,!x.intersect(_)}function l(t,e){if(t==e)return!1;if(!t||!e||t.length!==e.length)return!0;for(var i=0;i=0&&i.splice(n,1),t.__hoverMir=null},clearHover:function(t){for(var e=this._hoverElements,i=0;i=0){if(!s){if(s=this._progressiveLayers[Math.min(u++,y-1)],s.ctx.save(),s.renderScope={},s&&s.__progress>s.__maxProgress){g=s.__nextIdxNotProg-1;continue}l=s.__progress,s.__dirty||(p=l),s.__progress=p+1}_===p&&this._doPaintEl(v,s,!0,s.renderScope)}else this._doPaintEl(v,n,e,a);v.__dirty=!1}}s&&i(s),o&&o.restore(),this._furtherProgressive=!1,d.each(this._progressiveLayers,function(t){t.__maxProgress>=t.__progress&&(this._furtherProgressive=!0)},this)},_doPaintEl:function(t,e,i,n){var r=e.ctx,o=t.transform;if((e.__dirty||i)&&!t.invisible&&0!==t.style.opacity&&(!o||o[0]||o[3])&&(!t.culling||!s(t,this._width,this._height))){var a=t.__clipPaths;(n.prevClipLayer!==e||l(a,n.prevElClipPaths))&&(n.prevElClipPaths&&(n.prevClipLayer.ctx.restore(),n.prevClipLayer=n.prevElClipPaths=null,n.prevEl=null),a&&(r.save(),u(a,r),n.prevClipLayer=e,n.prevElClipPaths=a)),t.beforeBrush&&t.beforeBrush(r),t.brush(r,n.prevEl||null),n.prevEl=t,t.afterBrush&&t.afterBrush(r)}},getLayer:function(t){if(this._singleCanvas)return this._layers[0];var e=this._layers[t];return e||(e=new m("zr_"+t,this,this.dpr),e.__builtin__=!0,this._layerConfig[t]&&d.merge(e,this._layerConfig[t],!0),this.insertLayer(t,e),e.initContext()),e},insertLayer:function(t,e){var i=this._layers,n=this._zlevelList,o=n.length,a=null,s=-1,l=this._domRoot;if(i[t])return void f("ZLevel "+t+" has been used already");if(!r(e))return void f("Layer of zlevel "+t+" is not valid");if(o>0&&t>n[0]){for(s=0;st);s++);a=i[n[s]]}if(n.splice(s+1,0,t),i[t]=e,!e.virtual)if(a){var u=a.dom;u.nextSibling?l.insertBefore(e.dom,u.nextSibling):l.appendChild(e.dom)}else l.firstChild?l.insertBefore(e.dom,l.firstChild):l.appendChild(e.dom)},eachLayer:function(t,e){var i,n,r=this._zlevelList;for(n=0;n=0){a!==g&&(a=g,l++);var v=c.__frame=l-1;if(!o){var x=Math.min(s,y-1);o=i[x],o||(o=i[x]=new m("progressive",this,this.dpr),o.initContext()),o.__maxProgress=0}o.__dirty=o.__dirty||c.__dirty,o.elCount++,o.__maxProgress=Math.max(o.__maxProgress,v),o.__maxProgress>=o.__progress&&(p.__dirty=!0)}else c.__frame=-1,o&&(o.__nextIdxNotProg=u,s++,o=null)}o&&(s++,o.__nextIdxNotProg=u),this.eachBuiltinLayer(function(t,e){n[e]!==t.elCount&&(t.__dirty=!0)}),i.length=Math.min(s,y),d.each(i,function(t,e){r[e]!==t.elCount&&(c.__dirty=!0),t.__dirty&&(t.__progress=0)})},clear:function(){return this.eachBuiltinLayer(this._clearLayer),this},_clearLayer:function(t){t.clear()},configLayer:function(t,e){if(e){var i=this._layerConfig;i[t]?d.merge(i[t],e,!0):i[t]=e;var n=this._layers[t];n&&d.merge(n,i[t],!0)}},delLayer:function(t){var e=this._layers,i=this._zlevelList,n=e[t];n&&(n.dom.parentNode.removeChild(n.dom),delete e[t],i.splice(d.indexOf(i,t),1))},resize:function(t,e){var i=this._domRoot;i.style.display="none";var n=this._opts;if(null!=t&&(n.width=t),null!=e&&(n.height=e),t=this._getSize(0),e=this._getSize(1),i.style.display="",this._width!=t||e!=this._height){i.style.width=t+"px",i.style.height=e+"px";for(var r in this._layers)this._layers.hasOwnProperty(r)&&this._layers[r].resize(t,e);d.each(this._progressiveLayers,function(i){i.resize(t,e)}),this.refresh(!0)}return this._width=t,this._height=e,this},clearLayer:function(t){var e=this._layers[t];e&&e.clear()},dispose:function(){this.root.innerHTML="",this.root=this.storage=this._domRoot=this._layers=null},getRenderedCanvas:function(t){if(t=t||{},this._singleCanvas)return this._layers[0].dom;var e=new m("image",this,t.pixelRatio||this.dpr);e.initContext(),e.clearColor=t.backgroundColor,e.clear();for(var i=this.storage.getDisplayList(!0),n={},r=0;r=0&&(this.delFromMap(o.id),this._roots.splice(s,1),o instanceof a&&o.delChildrenFromStorage(this))}},addToMap:function(t){return t instanceof a&&(t.__storage=this),t.dirty(!1),this._elements[t.id]=t,this},get:function(t){return this._elements[t]},delFromMap:function(t){var e=this._elements,i=e[t];return i&&(delete e[t],i instanceof a&&(i.__storage=null)),this},dispose:function(){this._elements=this._renderList=this._roots=null},displayableSortFunc:n},t.exports=l},function(t,e,i){"use strict";var n=i(1),r=i(20).Dispatcher,o=i(67),a=i(66),s=function(t){t=t||{},this.stage=t.stage||{},this.onframe=t.onframe||function(){},this._clips=[],this._running=!1,this._time,this._pausedTime,this._pauseStart,this._paused=!1,r.call(this)};s.prototype={constructor:s,addClip:function(t){this._clips.push(t)},addAnimator:function(t){t.animation=this;for(var e=t.getClips(),i=0;i=0&&this._clips.splice(e,1)},removeAnimator:function(t){for(var e=t.getClips(),i=0;ii||d+ca&&(a+=r);var p=Math.atan2(h,u);return p<0&&(p+=r),p>=o&&p<=a||p+r>=o&&p+r<=a}}},function(t,e,i){var n=i(21);t.exports={containStroke:function(t,e,i,r,o,a,s,l,u,h,c){if(0===u)return!1;var d=u;if(c>e+d&&c>r+d&&c>a+d&&c>l+d||ct+d&&h>i+d&&h>o+d&&h>s+d||he&&h>n&&h>a&&h>l||h1&&r(),d=g.cubicAt(e,n,a,l,b[0]),m>1&&(f=g.cubicAt(e,n,a,l,b[1]))),p+=2==m?ye&&s>n&&s>o||s=0&&u<=1){for(var h=0,c=g.quadraticAt(e,n,o,u),d=0;di||s<-i)return 0;var l=Math.sqrt(i*i-s*s);_[0]=-l,_[1]=l;var u=Math.abs(n-r);if(u<1e-4)return 0;if(u%y<1e-4){n=0,r=y;var h=o?1:-1;return a>=_[0]+t&&a<=_[1]+t?h:0}if(o){var l=n;n=p(r),r=p(l)}else n=p(n),r=p(r);n>r&&(r+=y);for(var c=0,d=0;d<2;d++){var f=_[d];if(f+t>a){var g=Math.atan2(s,f),h=o?1:-1;g<0&&(g=y+g),(g>=n&&g<=r||g+y>=n&&g+y<=r)&&(g>Math.PI/2&&g<1.5*Math.PI&&(h=-h),c+=h)}}return c}function l(t,e,i,r,l){for(var h=0,p=0,g=0,y=0,x=0,_=0;_1&&(i||(h+=m(p,g,y,x,r,l))),1==_&&(p=t[_],g=t[_+1],y=p,x=g),b){case u.M:y=t[_++],x=t[_++],p=y,g=x;break;case u.L:if(i){if(v(p,g,t[_],t[_+1],e,r,l))return!0}else h+=m(p,g,t[_],t[_+1],r,l)||0;p=t[_++],g=t[_++];break;case u.C:if(i){if(c.containStroke(p,g,t[_++],t[_++],t[_++],t[_++],t[_],t[_+1],e,r,l))return!0}else h+=o(p,g,t[_++],t[_++],t[_++],t[_++],t[_],t[_+1],r,l)||0;p=t[_++],g=t[_++];break;case u.Q:if(i){if(d.containStroke(p,g,t[_++],t[_++],t[_],t[_+1],e,r,l))return!0}else h+=a(p,g,t[_++],t[_++],t[_],t[_+1],r,l)||0;p=t[_++],g=t[_++];break;case u.A:var w=t[_++],M=t[_++],S=t[_++],T=t[_++],A=t[_++],I=t[_++],C=(t[_++],1-t[_++]),P=Math.cos(A)*S+w,k=Math.sin(A)*T+M;_>1?h+=m(p,g,P,k,r,l):(y=P,x=k);var L=(r-w)*T/S+w;if(i){if(f.containStroke(w,M,T,A,A+I,C,e,L,l))return!0}else h+=s(w,M,T,A,A+I,C,L,l);p=Math.cos(A+I)*S+w,g=Math.sin(A+I)*T+M;break;case u.R:y=p=t[_++],x=g=t[_++];var D=t[_++],O=t[_++],P=y+D,k=x+O;if(i){if(v(y,x,P,x,e,r,l)||v(P,x,P,k,e,r,l)||v(P,k,y,k,e,r,l)||v(y,k,y,x,e,r,l))return!0}else h+=m(P,x,P,k,r,l),h+=m(y,k,y,x,r,l);break;case u.Z:if(i){if(v(p,g,y,x,e,r,l))return!0}else h+=m(p,g,y,x,r,l);p=y,g=x}}return i||n(g,x)||(h+=m(p,g,y,x,r,l)||0),0!==h}var u=i(30).CMD,h=i(98),c=i(162),d=i(99),f=i(161),p=i(68).normalizeRadian,g=i(21),m=i(100),v=h.containStroke,y=2*Math.PI,x=1e-4,_=[-1,-1,-1],b=[-1,-1];t.exports={contain:function(t,e,i){return l(t,0,!1,e,i)},containStroke:function(t,e,i,n){return l(t,e,!0,i,n)}}},function(t,e,i){"use strict";function n(t){var e=t[1][0]-t[0][0],i=t[1][1]-t[0][1];return Math.sqrt(e*e+i*i)}function r(t){return[(t[0][0]+t[1][0])/2,(t[0][1]+t[1][1])/2]}var o=i(20),a=function(){this._track=[]};a.prototype={constructor:a,recognize:function(t,e,i){return this._doTrack(t,e,i),this._recognize(t)},clear:function(){return this._track.length=0,this},_doTrack:function(t,e,i){var n=t.touches;if(n){for(var r={points:[],touches:[],target:e,event:t},a=0,s=n.length;a1&&o&&o.length>1){var s=n(o)/n(a);!isFinite(s)&&(s=1),e.pinchScale=s;var l=r(o);return e.pinchX=l[0],e.pinchY=l[1],{type:"pinch",target:t[0].target,event:e}}}}};t.exports=a},function(t,e,i){function n(t){return"mousewheel"===t&&d.browser.firefox?"DOMMouseScroll":t}function r(t,e,i){var n=t._gestureMgr;"start"===i&&n.clear();var r=n.recognize(e,t.handler.findHover(e.zrX,e.zrY,null),t.dom);if("end"===i&&n.clear(),r){var o=r.type;e.gestureEvent=o,t.handler.dispatchToElement(r.target,o,r.event)}}function o(t){t._touching=!0,clearTimeout(t._touchTimer),t._touchTimer=setTimeout(function(){t._touching=!1},700)}function a(t){var e=t.pointerType;return"pen"===e||"touch"===e}function s(t){function e(t,e){return function(){if(!e._touching)return t.apply(e,arguments)}}h.each(x,function(e){t._handlers[e]=h.bind(w[e],t)}),h.each(b,function(e){t._handlers[e]=h.bind(w[e],t)}),h.each(y,function(i){t._handlers[i]=e(w[i],t)})}function l(t){function e(e,i){h.each(e,function(e){p(t,n(e),i._handlers[e])},i)}c.call(this),this.dom=t,this._touching=!1,this._touchTimer,this._gestureMgr=new f,this._handlers={},s(this),d.pointerEventsSupported?e(b,this):(d.touchEventsSupported&&e(x,this),e(y,this))}var u=i(20),h=i(1),c=i(23),d=i(9),f=i(164),p=u.addEventListener,g=u.removeEventListener,m=u.normalizeEvent,v=300,y=["click","dblclick","mousewheel","mouseout","mouseup","mousedown","mousemove","contextmenu"],x=["touchstart","touchend","touchmove"],_={pointerdown:1,pointerup:1,pointermove:1,pointerout:1},b=h.map(y,function(t){var e=t.replace("mouse","pointer");return _[e]?e:t}),w={mousemove:function(t){t=m(this.dom,t),this.trigger("mousemove",t)},mouseout:function(t){t=m(this.dom,t);var e=t.toElement||t.relatedTarget;if(e!=this.dom)for(;e&&9!=e.nodeType;){if(e===this.dom)return;e=e.parentNode}this.trigger("mouseout",t)},touchstart:function(t){t=m(this.dom,t),t.zrByTouch=!0,this._lastTouchMoment=new Date,r(this,t,"start"),w.mousemove.call(this,t),w.mousedown.call(this,t),o(this)},touchmove:function(t){t=m(this.dom,t),t.zrByTouch=!0,r(this,t,"change"),w.mousemove.call(this,t),o(this)},touchend:function(t){t=m(this.dom,t),t.zrByTouch=!0,r(this,t,"end"),w.mouseup.call(this,t),+new Date-this._lastTouchMomentl&&(c=i+n,i*=l/c,n*=l/c),r+o>l&&(c=r+o,r*=l/c,o*=l/c),n+r>u&&(c=n+r,n*=u/c,r*=u/c),i+o>u&&(c=i+o,i*=u/c,o*=u/c),t.moveTo(a+i,s),t.lineTo(a+l-n,s),0!==n&&t.quadraticCurveTo(a+l,s,a+l,s+n),t.lineTo(a+l,s+u-r),0!==r&&t.quadraticCurveTo(a+l,s+u,a+l-r,s+u),t.lineTo(a+o,s+u),0!==o&&t.quadraticCurveTo(a,s+u,a,s+u-o),t.lineTo(a,s+i),0!==i&&t.quadraticCurveTo(a,s,a+i,s)}}},function(t,e,i){var n=i(6),r=n.min,o=n.max,a=n.scale,s=n.distance,l=n.add;t.exports=function(t,e,i,u){var h,c,d,f,p=[],g=[],m=[],v=[];if(u){d=[1/0,1/0],f=[-(1/0),-(1/0)];for(var y=0,x=t.length;yi-2?i-1:f+1],c=t[f>i-3?i-1:f+2]);var m=p*p,v=p*m;o.push([n(u[0],g[0],h[0],c[0],p,m,v),n(u[1],g[1],h[1],c[1],p,m,v)])}return o}},function(t,e,i){t.exports=i(8).extend({type:"arc",shape:{cx:0,cy:0,r:0,startAngle:0,endAngle:2*Math.PI,clockwise:!0},style:{stroke:"#000",fill:null},buildPath:function(t,e){var i=e.cx,n=e.cy,r=Math.max(e.r,0),o=e.startAngle,a=e.endAngle,s=e.clockwise,l=Math.cos(o),u=Math.sin(o);t.moveTo(l*r+i,u*r+n),t.arc(i,n,r,o,a,!s)}})},function(t,e,i){"use strict";function n(t,e,i){var n=t.cpx2,r=t.cpy2;return null===n||null===r?[(i?c:u)(t.x1,t.cpx1,t.cpx2,t.x2,e),(i?c:u)(t.y1,t.cpy1,t.cpy2,t.y2,e)]:[(i?h:l)(t.x1,t.cpx1,t.x2,e),(i?h:l)(t.y1,t.cpy1,t.y2,e)]}var r=i(21),o=i(6),a=r.quadraticSubdivide,s=r.cubicSubdivide,l=r.quadraticAt,u=r.cubicAt,h=r.quadraticDerivativeAt,c=r.cubicDerivativeAt,d=[];t.exports=i(8).extend({type:"bezier-curve",shape:{x1:0,y1:0,x2:0,y2:0,cpx1:0,cpy1:0,percent:1},style:{stroke:"#000",fill:null},buildPath:function(t,e){var i=e.x1,n=e.y1,r=e.x2,o=e.y2,l=e.cpx1,u=e.cpy1,h=e.cpx2,c=e.cpy2,f=e.percent;0!==f&&(t.moveTo(i,n),null==h||null==c?(f<1&&(a(i,l,r,f,d),l=d[1],r=d[2],a(n,u,o,f,d),u=d[1],o=d[2]),t.quadraticCurveTo(l,u,r,o)):(f<1&&(s(i,l,h,r,f,d),l=d[1],h=d[2],r=d[3],s(n,u,c,o,f,d),u=d[1],c=d[2],o=d[3]),t.bezierCurveTo(l,u,h,c,r,o)))},pointAt:function(t){return n(this.shape,t,!1)},tangentAt:function(t){var e=n(this.shape,t,!0);return o.normalize(e,e)}})},function(t,e,i){"use strict";t.exports=i(8).extend({type:"circle",shape:{cx:0,cy:0,r:0},buildPath:function(t,e,i){i&&t.moveTo(e.cx+e.r,e.cy),t.arc(e.cx,e.cy,e.r,0,2*Math.PI,!0)}})},function(t,e,i){t.exports=i(8).extend({type:"line",shape:{x1:0,y1:0,x2:0,y2:0,percent:1},style:{stroke:"#000",fill:null},buildPath:function(t,e){var i=e.x1,n=e.y1,r=e.x2,o=e.y2,a=e.percent;0!==a&&(t.moveTo(i,n),a<1&&(r=i*(1-a)+r*a,o=n*(1-a)+o*a),t.lineTo(r,o))},pointAt:function(t){var e=this.shape;return[e.x1*(1-t)+e.x2*t,e.y1*(1-t)+e.y2*t]}})},function(t,e,i){var n=i(73);t.exports=i(8).extend({type:"polygon",shape:{points:null,smooth:!1,smoothConstraint:null},buildPath:function(t,e){n.buildPath(t,e,!0)}})},function(t,e,i){var n=i(73);t.exports=i(8).extend({type:"polyline",shape:{points:null,smooth:!1,smoothConstraint:null},style:{stroke:"#000",fill:null},buildPath:function(t,e){n.buildPath(t,e,!1)}})},function(t,e,i){var n=i(168);t.exports=i(8).extend({type:"rect",shape:{r:0,x:0,y:0,width:0,height:0},buildPath:function(t,e){var i=e.x,r=e.y,o=e.width,a=e.height;e.r?n.buildPath(t,e):t.rect(i,r,o,a),t.closePath()}})},function(t,e,i){t.exports=i(8).extend({type:"ring",shape:{cx:0,cy:0,r:0,r0:0},buildPath:function(t,e){var i=e.cx,n=e.cy,r=2*Math.PI;t.moveTo(i+e.r,n),t.arc(i,n,e.r,0,r,!1),t.moveTo(i+e.r0,n),t.arc(i,n,e.r0,0,r,!0)}})},function(t,e,i){var n=i(9),r=i(8),o=[["shadowBlur",0],["shadowColor","#000"],["shadowOffsetX",0],["shadowOffsetY",0]];t.exports=r.extend({type:"sector",shape:{cx:0,cy:0,r0:0,r:0,startAngle:0,endAngle:2*Math.PI,clockwise:!0},brush:n.browser.ie&&n.browser.version>=11?function(){var t,e=this.__clipPaths,i=this.style;if(e)for(var n=0;n0&&this.animate(t,!1).when(null==n?500:n,a).delay(o||0),this}},t.exports=u},function(t,e){function i(){this.on("mousedown",this._dragStart,this),this.on("mousemove",this._drag,this),this.on("mouseup",this._dragEnd,this),this.on("globalout",this._dragEnd,this)}i.prototype={constructor:i,_dragStart:function(t){var e=t.target;e&&e.draggable&&(this._draggingTarget=e,e.dragging=!0,this._x=t.offsetX,this._y=t.offsetY,this.dispatchToElement(e,"dragstart",t.event))},_drag:function(t){var e=this._draggingTarget;if(e){var i=t.offsetX,n=t.offsetY,r=i-this._x,o=n-this._y;this._x=i,this._y=n,e.drift(r,o,t),this.dispatchToElement(e,"drag",t.event);var a=this.findHover(i,n,e),s=this._dropTarget;this._dropTarget=a,e!==a&&(s&&a!==s&&this.dispatchToElement(s,"dragleave",t.event),a&&a!==s&&this.dispatchToElement(a,"dragenter",t.event))}},_dragEnd:function(t){var e=this._draggingTarget;e&&(e.dragging=!1),this.dispatchToElement(e,"dragend",t.event),this._dropTarget&&this.dispatchToElement(this._dropTarget,"drop",t.event),this._draggingTarget=null,this._dropTarget=null}},t.exports=i},function(t,e,i){function n(t,e,i,n,r,o,a,s,l,u,h){var g=l*(p/180),y=f(g)*(t-i)/2+d(g)*(e-n)/2,x=-1*d(g)*(t-i)/2+f(g)*(e-n)/2,_=y*y/(a*a)+x*x/(s*s);_>1&&(a*=c(_),s*=c(_));var b=(r===o?-1:1)*c((a*a*(s*s)-a*a*(x*x)-s*s*(y*y))/(a*a*(x*x)+s*s*(y*y)))||0,w=b*a*x/s,M=b*-s*y/a,S=(t+i)/2+f(g)*w-d(g)*M,T=(e+n)/2+d(g)*w+f(g)*M,A=v([1,0],[(y-w)/a,(x-M)/s]),I=[(y-w)/a,(x-M)/s],C=[(-1*y-w)/a,(-1*x-M)/s],P=v(I,C);m(I,C)<=-1&&(P=p),m(I,C)>=1&&(P=0),0===o&&P>0&&(P-=2*p),1===o&&P<0&&(P+=2*p),h.addData(u,S,T,a,s,A,P,g,o)}function r(t){if(!t)return[];var e,i=t.replace(/-/g," -").replace(/ /g," ").replace(/ /g,",").replace(/,,/g,",");for(e=0;e0&&""===m[0]&&m.shift();for(var v=0;v')}}catch(l){n=function(t){return a.createElement("<"+t+' xmlns="'+r+'" class="zrvml">')}}var u=function(){if(!s){s=!0;var t=a.styleSheets;t.length<31?a.createStyleSheet().addRule(".zrvml","behavior:url(#default#VML)"):t[0].addRule(".zrvml","behavior:url(#default#VML)")}};t.exports={doc:a,initVML:u,createNode:n}}},,function(t,e,i){function n(t,e,i){var n=this._targetInfoList=[],r={},a=o(e,t);f(x,function(t,e){(!i||!i.include||p(i.include,e)>=0)&&t(a,n,r)})}function r(t){return t[0]>t[1]&&t.reverse(),t}function o(t,e){return d.parseFinder(t,e,{includeMainTypes:v})}function a(t,e,i,n){var o=i.getAxis(["x","y"][t]),a=r(h.map([0,1],function(t){return e?o.coordToData(o.toLocalCoord(n[t])):o.toGlobalCoord(o.dataToCoord(n[t]))})),s=[];return s[t]=a,s[1-t]=[NaN,NaN],{values:a,xyMinMax:s}}function s(t,e,i,n){return[e[0]-n[t]*i[0],e[1]-n[t]*i[1]]}function l(t,e){var i=u(t),n=u(e),r=[i[0]/n[0],i[1]/n[1]];return isNaN(r[0])&&(r[0]=1),isNaN(r[1])&&(r[1]=1),r}function u(t){return t?[t[0][1]-t[0][0],t[1][1]-t[1][0]]:[NaN,NaN]}var h=i(1),c=i(3),d=i(5),f=h.each,p=h.indexOf,g=h.curry,m=["dataToPoint","pointToData"],v=["grid","xAxis","yAxis","geo","graph","polar","radiusAxis","angleAxis","bmap"],y=n.prototype;y.setOutputRanges=function(t,e){this.matchOutputRanges(t,e,function(t,e,i){if((t.coordRanges||(t.coordRanges=[])).push(e),!t.coordRange){t.coordRange=e;var n=w[t.brushType](0,i,e);t.__rangeOffset={offset:M[t.brushType](n.values,t.range,[1,1]),xyMinMax:n.xyMinMax}}})},y.matchOutputRanges=function(t,e,i){f(t,function(t){var n=this.findTargetInfo(t,e);n&&n!==!0&&h.each(n.coordSyses,function(n){var r=w[t.brushType](1,n,t.range);i(t,r.values,n,e)})},this)},y.setInputRanges=function(t,e){f(t,function(t){var i=this.findTargetInfo(t,e);if(t.range=t.range||[],i&&i!==!0){t.panelId=i.panelId;var n=w[t.brushType](0,i.coordSys,t.coordRange),r=t.__rangeOffset;t.range=r?M[t.brushType](n.values,r.offset,l(n.xyMinMax,r.xyMinMax)):n.values}},this)},y.makePanelOpts=function(t){return h.map(this._targetInfoList,function(e){return{panelId:e.panelId,rect:e.getPanelRect(),defaultBrushType:t&&t(e)}})},y.controlSeries=function(t,e,i){var n=this.findTargetInfo(t,i);return n===!0||n&&p(n.coordSyses,e.coordinateSystem)>=0},y.findTargetInfo=function(t,e){for(var i=this._targetInfoList,n=o(e,t),r=0;r=0||p(n,t.getAxis("y").model)>=0)&&o.push(t)}),e.push({panelId:"grid--"+t.id,gridModel:t,coordSys:o[0],coordSyses:o,getPanelRect:b.grid,xAxisDeclared:a[t.id],yAxisDeclared:s[t.id]})}))},geo:function(t,e){f(t.geoModels,function(t){var i=t.coordinateSystem;e.push({panelId:"geo--"+t.id,geoModel:t,coordSys:i,coordSyses:[i],getPanelRect:b.geo})})}},_=[function(t,e){var i=t.xAxisModel,n=t.yAxisModel,r=t.gridModel;return!r&&i&&(r=i.axis.grid.model),!r&&n&&(r=n.axis.grid.model),r&&r===e.gridModel},function(t,e){var i=t.geoModel;return i&&i===e.geoModel}],b={grid:function(){return this.coordSys.grid.getRect().clone()},geo:function(){var t=this.coordSys,e=t.getBoundingRect().clone();return e.applyTransform(c.getTransform(t)),e}},w={lineX:g(a,0),lineY:g(a,1),rect:function(t,e,i){var n=e[m[t]]([i[0][0],i[1][0]]),o=e[m[t]]([i[0][1],i[1][1]]),a=[r([n[0],o[0]]),r([n[1],o[1]])];return{values:a,xyMinMax:a}}, +polygon:function(t,e,i){var n=[[1/0,-(1/0)],[1/0,-(1/0)]],r=h.map(i,function(i){var r=e[m[t]](i);return n[0][0]=Math.min(n[0][0],r[0]),n[1][0]=Math.min(n[1][0],r[1]),n[0][1]=Math.max(n[0][1],r[0]),n[1][1]=Math.max(n[1][1],r[1]),r});return{values:r,xyMinMax:n}}},M={lineX:g(s,0),lineY:g(s,1),rect:function(t,e,i){return[[t[0][0]-i[0]*e[0][0],t[0][1]-i[0]*e[0][1]],[t[1][0]-i[1]*e[1][0],t[1][1]-i[1]*e[1][1]]]},polygon:function(t,e,i){return h.map(t,function(t,n){return[t[0]-i[0]*e[n][0],t[1]-i[1]*e[n][1]]})}};t.exports=n},,,function(t,e){function i(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}function r(t){if(h===setTimeout)return setTimeout(t,0);if((h===i||!h)&&setTimeout)return h=setTimeout,setTimeout(t,0);try{return h(t,0)}catch(e){try{return h.call(null,t,0)}catch(e){return h.call(this,t,0)}}}function o(t){if(c===clearTimeout)return clearTimeout(t);if((c===n||!c)&&clearTimeout)return c=clearTimeout,clearTimeout(t);try{return c(t)}catch(e){try{return c.call(null,t)}catch(e){return c.call(this,t)}}}function a(){g&&f&&(g=!1,f.length?p=f.concat(p):m=-1,p.length&&s())}function s(){if(!g){var t=r(a);g=!0;for(var e=p.length;e;){for(f=p,p=[];++m1)for(var i=1;i=0;o--){var a=n[o],s=r[o],l=a[0]-s[0]/2,u=a[1]-s[1]/2;if(t>=l&&e>=u&&t<=l+s[0]&&e<=u+s[1])return o}return-1}}),s=n.prototype;s.updateData=function(t){this.group.removeAll();var e=this._symbolEl,i=t.hostModel;e.setShape({points:t.mapArray(t.getItemLayout),sizes:t.mapArray(function(e){var i=t.getItemVisual(e,"symbolSize");return i instanceof Array||(i=[i,i]),i})}),e.symbolProxy=o.createSymbol(t.getVisual("symbol"),0,0,0,0),e.setColor=e.symbolProxy.setColor,e.useStyle(i.getModel("itemStyle.normal").getItemStyle(["color"]));var n=t.getVisual("color");n&&e.setColor(n),e.seriesIndex=i.seriesIndex,e.on("mousemove",function(t){e.dataIndex=null;var i=e.findDataIndex(t.offsetX,t.offsetY);i>0&&(e.dataIndex=i)}),this.group.add(e)},s.updateLayout=function(t){var e=t.getData();this._symbolEl.setShape({points:e.mapArray(e.getItemLayout)})},s.remove=function(){this.group.removeAll()},t.exports=n},function(t,e,i){function n(t){return isNaN(+t.cpx1)||isNaN(+t.cpy1)}var r=i(3),o=i(6),a=r.Line.prototype,s=r.BezierCurve.prototype;t.exports=r.extendShape({type:"ec-line",style:{stroke:"#000",fill:null},shape:{x1:0,y1:0,x2:0,y2:0,percent:1,cpx1:null,cpy1:null},buildPath:function(t,e){(n(e)?a:s).buildPath(t,e)},pointAt:function(t){return n(this.shape)?a.pointAt.call(this,t):s.pointAt.call(this,t)},tangentAt:function(t){var e=this.shape,i=n(e)?[e.x2-e.x1,e.y2-e.y1]:s.tangentAt.call(this,t);return o.normalize(i,i)}})},function(t,e,i){var n=i(1),r=i(2);i(193),i(194),r.registerVisual(n.curry(i(50),"scatter","circle",null)),r.registerLayout(n.curry(i(61),"scatter")),i(38)},function(t,e,i){"use strict";var n=i(27),r=i(18);t.exports=r.extend({type:"series.scatter",dependencies:["grid","polar","geo","singleAxis"],getInitialData:function(t,e){var i=n(t.data,this,e);return i},brushSelector:"point",defaultOption:{coordinateSystem:"cartesian2d",zlevel:0,z:2,legendHoverLink:!0,hoverAnimation:!0,symbolSize:10,large:!1,largeThreshold:2e3,itemStyle:{normal:{opacity:.8}}}})},function(t,e,i){var n=i(44),r=i(190);i(2).extendChartView({type:"scatter",init:function(){this._normalSymbolDraw=new n,this._largeSymbolDraw=new r},render:function(t,e,i){var n=t.getData(),r=this._largeSymbolDraw,o=this._normalSymbolDraw,a=this.group,s=t.get("large")&&n.count()>t.get("largeThreshold")?r:o;this._symbolDraw=s,s.updateData(n),a.add(s.group),a.remove(s===r?o.group:r.group)},updateLayout:function(t){this._symbolDraw.updateLayout(t)},remove:function(t,e){this._symbolDraw&&this._symbolDraw.remove(e,!0)},dispose:function(){}})},function(t,e,i){i(128),i(46),i(47),i(201),i(202),i(197),i(198),i(126),i(125)},function(t,e,i){function n(t,e,i){var n=[1/0,-(1/0)];return u(i,function(t){var i=t.getData();i&&u(t.coordDimToDataDim(e),function(t){var e=i.getDataExtent(t);e[0]n[1]&&(n[1]=e[1])})}),n[1]0?0:NaN);var a=i.getMax(!0);return null!=a&&"dataMax"!==a?e[1]=a:r&&(e[1]=o>0?o-1:NaN),i.get("scale",!0)||(e[0]>0&&(e[0]=0),e[1]<0&&(e[1]=0)),e}function o(t,e){var i=t.getAxisModel(),n=t._percentWindow,r=t._valueWindow;if(n){var o=s.getPixelPrecision(r,[0,500]),a=e||0===n[0]&&100===n[1];i.setRange(a?null:+r[0].toFixed(o),a?null:+r[1].toFixed(o))}}var a=i(1),s=i(4),l=i(77),u=a.each,h=s.asc,c=function(t,e,i,n){this._dimName=t,this._axisIndex=e,this._valueWindow,this._percentWindow,this._dataExtent,this.ecModel=n,this._dataZoomModel=i};c.prototype={constructor:c,hostedBy:function(t){return this._dataZoomModel===t},getDataValueWindow:function(){return this._valueWindow.slice()},getDataPercentWindow:function(){return this._percentWindow.slice()},getTargetSeriesModels:function(){var t=[],e=this.ecModel;return e.eachSeries(function(i){if(l.isCoordSupported(i.get("coordinateSystem"))){var n=this._dimName,r=e.queryComponents({mainType:n+"Axis",index:i.get(n+"AxisIndex"),id:i.get(n+"AxisId")})[0];this._axisIndex===(r&&r.componentIndex)&&t.push(i)}},this),t},getAxisModel:function(){return this.ecModel.getComponent(this._dimName+"Axis",this._axisIndex)},getOtherAxisModel:function(){var t,e,i=this._dimName,n=this.ecModel,r=this.getAxisModel(),o="x"===i||"y"===i;o?(e="gridIndex",t="x"===i?"y":"x"):(e="polarIndex",t="angle"===i?"radius":"angle");var a;return n.eachComponent(t+"Axis",function(t){(t.get(e)||0)===(r.get(e)||0)&&(a=t)}),a},calculateDataWindow:function(t){var e=this._dataExtent,i=this.getAxisModel(),n=i.axis.scale,r=this._dataZoomModel.getRangePropMode(),o=[0,100],a=[t.start,t.end],l=[];return u(["startValue","endValue"],function(e){l.push(null!=t[e]?n.parse(t[e]):null)}),u([0,1],function(t){var i=l[t],u=a[t];"percent"===r[t]?(null==u&&(u=o[t]),i=n.parse(s.linearMap(u,o,e,!0))):u=s.linearMap(i,e,o,!0),l[t]=i,a[t]=u}),{valueWindow:h(l),percentWindow:h(a)}},reset:function(t){if(t===this._dataZoomModel){this._dataExtent=n(this,this._dimName,this.getTargetSeriesModels());var e=this.calculateDataWindow(t.option);this._valueWindow=e.valueWindow,this._percentWindow=e.percentWindow,o(this)}},restore:function(t){t===this._dataZoomModel&&(this._valueWindow=this._percentWindow=null,o(this,!0))},filterData:function(t){function e(t){return t>=o[0]&&t<=o[1]}if(t===this._dataZoomModel){var i=this._dimName,n=this.getTargetSeriesModels(),r=t.get("filterMode"),o=this._valueWindow,a=this.getOtherAxisModel();t.get("$fromToolbox")&&a&&"category"===a.get("type")&&(r="empty"),u(n,function(t){var n=t.getData();n&&u(t.coordDimToDataDim(i),function(i){"empty"===r?t.setData(n.map(i,function(t){return e(t)?t:NaN})):n.filterSelf(i,e)})})}}},t.exports=c},function(t,e,i){t.exports=i(46).extend({type:"dataZoom.inside",defaultOption:{disabled:!1,zoomLock:!1}})},function(t,e,i){function n(t){var e=[0,100];return!(t[0]<=e[1])&&(t[0]=e[1]),!(t[1]<=e[1])&&(t[1]=e[1]),!(t[0]>=e[0])&&(t[0]=e[0]),!(t[1]>=e[0])&&(t[1]=e[0]),t}var r=i(47),o=i(1),a=i(95),s=i(203),l=o.bind,u=r.extend({type:"dataZoom.inside",init:function(t,e){this._range},render:function(t,e,i,n){u.superApply(this,"render",arguments),s.shouldRecordRange(n,t.id)&&(this._range=t.getPercentRange()),o.each(this.getTargetCoordInfo(),function(e,n){var r=o.map(e,function(t){return s.generateCoordId(t.model)});o.each(e,function(e){var o=e.model;s.register(i,{coordId:s.generateCoordId(o),allCoordIds:r,containsPoint:function(t,e){return o.coordinateSystem.containPoint([t,e])},dataZoomId:t.id,throttleRate:t.get("throttle",!0),panGetRange:l(this._onPan,this,e,n),zoomGetRange:l(this._onZoom,this,e,n)})},this)},this)},dispose:function(){s.unregister(this.api,this.dataZoomModel.id),u.superApply(this,"dispose",arguments),this._range=null},_onPan:function(t,e,i,n,r,o,s,l,u){if(this.dataZoomModel.option.disabled)return this._range;var c=this._range.slice(),d=t.axisModels[0];if(d){var f=h[e]([o,s],[l,u],d,i,t),p=f.signal*(c[1]-c[0])*f.pixel/f.pixelLength;return a(p,c,[0,100],"rigid"),this._range=c}},_onZoom:function(t,e,i,r,o,a){var s=this.dataZoomModel.option;if(s.disabled||s.zoomLock)return this._range;var l=this._range.slice(),u=t.axisModels[0];if(u){var c=h[e](null,[o,a],u,i,t),d=(c.pixel-c.pixelStart)/c.pixelLength*(l[1]-l[0])+l[0];return r=Math.max(1/r,0),l[0]=(l[0]-d)*r+d,l[1]=(l[1]-d)*r+d,this._range=n(l)}}}),h={grid:function(t,e,i,n,r){var o=i.axis,a={},s=r.model.coordinateSystem.getRect();return t=t||[0,0],"x"===o.dim?(a.pixel=e[0]-t[0],a.pixelLength=s.width,a.pixelStart=s.x,a.signal=o.inverse?1:-1):(a.pixel=e[1]-t[1],a.pixelLength=s.height,a.pixelStart=s.y,a.signal=o.inverse?-1:1),a},polar:function(t,e,i,n,r){var o=i.axis,a={},s=r.model.coordinateSystem,l=s.getRadiusAxis().getExtent(),u=s.getAngleAxis().getExtent();return t=t?s.pointToCoord(t):[0,0],e=s.pointToCoord(e),"radiusAxis"===i.mainType?(a.pixel=e[0]-t[0],a.pixelLength=l[1]-l[0],a.pixelStart=l[0],a.signal=o.inverse?1:-1):(a.pixel=e[1]-t[1],a.pixelLength=u[1]-u[0],a.pixelStart=u[0],a.signal=o.inverse?-1:1),a},singleAxis:function(t,e,i,n,r){var o=i.axis,a=r.model.coordinateSystem.getRect(),s={};return t=t||[0,0],"horizontal"===o.orient?(s.pixel=e[0]-t[0],s.pixelLength=a.width,s.pixelStart=a.x,s.signal=o.inverse?1:-1):(s.pixel=e[1]-t[1],s.pixelLength=a.height,s.pixelStart=a.y,s.signal=o.inverse?-1:1),s}};t.exports=u},function(t,e,i){var n=i(46);t.exports=n.extend({type:"dataZoom.select"})},function(t,e,i){t.exports=i(47).extend({type:"dataZoom.select"})},function(t,e,i){var n=i(46),r=n.extend({type:"dataZoom.slider",layoutMode:"box",defaultOption:{show:!0,right:"ph",top:"ph",width:"ph",height:"ph",left:null,bottom:null,backgroundColor:"rgba(47,69,84,0)",dataBackground:{lineStyle:{color:"#2f4554",width:.5,opacity:.3},areaStyle:{color:"rgba(47,69,84,0.3)",opacity:.3}},borderColor:"#ddd",fillerColor:"rgba(167,183,204,0.4)",handleIcon:"M8.2,13.6V3.9H6.3v9.7H3.1v14.9h3.3v9.7h1.8v-9.7h3.3V13.6H8.2z M9.7,24.4H4.8v-1.4h4.9V24.4z M9.7,19.1H4.8v-1.4h4.9V19.1z",handleSize:"100%",handleStyle:{color:"#a7b7cc"},labelPrecision:null,labelFormatter:null,showDetail:!0,showDataShadow:"auto",realtime:!0,zoomLock:!1,textStyle:{color:"#333"}}});t.exports=r},function(t,e,i){function n(t){var e={x:"y",y:"x",radius:"angle",angle:"radius"};return e[t]}var r=i(1),o=i(3),a=i(39),s=i(47),l=o.Rect,u=i(4),h=u.linearMap,c=i(12),d=i(95),f=i(20),p=u.asc,g=r.bind,m=r.each,v=7,y=1,x=30,_="horizontal",b="vertical",w=5,M=["line","bar","candlestick","scatter"],S=s.extend({type:"dataZoom.slider",init:function(t,e){this._displayables={},this._orient,this._range,this._handleEnds,this._size,this._handleWidth,this._handleHeight,this._location,this._dragging,this._dataShadowInfo,this.api=e},render:function(t,e,i,n){return S.superApply(this,"render",arguments),a.createOrUpdate(this,"_dispatchZoomAction",this.dataZoomModel.get("throttle"),"fixRate"),this._orient=t.get("orient"),this.dataZoomModel.get("show")===!1?void this.group.removeAll():(n&&"dataZoom"===n.type&&n.from===this.uid||this._buildView(),void this._updateView())},remove:function(){S.superApply(this,"remove",arguments),a.clear(this,"_dispatchZoomAction")},dispose:function(){S.superApply(this,"dispose",arguments),a.clear(this,"_dispatchZoomAction")},_buildView:function(){var t=this.group;t.removeAll(),this._resetLocation(),this._resetInterval();var e=this._displayables.barGroup=new o.Group;this._renderBackground(),this._renderHandle(),this._renderDataShadow(),t.add(e),this._positionGroup()},_resetLocation:function(){var t=this.dataZoomModel,e=this.api,i=this._findCoordRect(),n={width:e.getWidth(),height:e.getHeight()},o=this._orient===_?{right:n.width-i.x-i.width,top:n.height-x-v,width:i.width,height:x}:{right:v,top:i.y,width:x,height:i.height},a=c.getLayoutParams(t.option);r.each(["right","top","width","height"],function(t){"ph"===a[t]&&(a[t]=o[t])});var s=c.getLayoutRect(a,n,t.padding);this._location={x:s.x,y:s.y},this._size=[s.width,s.height],this._orient===b&&this._size.reverse()},_positionGroup:function(){var t=this.group,e=this._location,i=this._orient,n=this.dataZoomModel.getFirstTargetAxisModel(),r=n&&n.get("inverse"),o=this._displayables.barGroup,a=(this._dataShadowInfo||{}).otherAxisInverse;o.attr(i!==_||r?i===_&&r?{scale:a?[-1,1]:[-1,-1]}:i!==b||r?{scale:a?[-1,-1]:[-1,1],rotation:Math.PI/2}:{scale:a?[1,-1]:[1,1],rotation:Math.PI/2}:{scale:a?[1,1]:[1,-1]});var s=t.getBoundingRect([o]);t.attr("position",[e.x-s.x,e.y-s.y])},_getViewExtent:function(){return[0,this._size[0]]},_renderBackground:function(){var t=this.dataZoomModel,e=this._size;this._displayables.barGroup.add(new l({silent:!0,shape:{x:0,y:0,width:e[0],height:e[1]},style:{fill:t.get("backgroundColor")},z2:-40}))},_renderDataShadow:function(){var t=this._dataShadowInfo=this._prepareDataShadowInfo();if(t){var e=this._size,i=t.series,n=i.getRawData(),a=i.getShadowDim?i.getShadowDim():t.otherDim;if(null!=a){var s=n.getDataExtent(a),l=.3*(s[1]-s[0]);s=[s[0]-l,s[1]+l];var u,c=[0,e[1]],d=[0,e[0]],f=[[e[0],0],[0,0]],p=[],g=d[1]/(n.count()-1),m=0,v=Math.round(n.count()/e[0]);n.each([a],function(t,e){if(v>0&&e%v)return void(m+=g);var i=null==t||isNaN(t)||""===t,n=i?0:h(t,s,c,!0);i&&!u&&e?(f.push([f[f.length-1][0],0]),p.push([p[p.length-1][0],0])):!i&&u&&(f.push([m,0]),p.push([m,0])),f.push([m,n]),p.push([m,n]),m+=g,u=i});var y=this.dataZoomModel;this._displayables.barGroup.add(new o.Polygon({shape:{points:f},style:r.defaults({fill:y.get("dataBackgroundColor")},y.getModel("dataBackground.areaStyle").getAreaStyle()),silent:!0,z2:-20})),this._displayables.barGroup.add(new o.Polyline({shape:{points:p},style:y.getModel("dataBackground.lineStyle").getLineStyle(),silent:!0,z2:-19}))}}},_prepareDataShadowInfo:function(){var t=this.dataZoomModel,e=t.get("showDataShadow");if(e!==!1){var i,o=this.ecModel;return t.eachTargetAxis(function(a,s){var l=t.getAxisProxy(a.name,s).getTargetSeriesModels();r.each(l,function(t){if(!(i||e!==!0&&r.indexOf(M,t.get("type"))<0)){var l,u=o.getComponent(a.axis,s).axis,h=n(a.name),c=t.coordinateSystem;null!=h&&c.getOtherAxis&&(l=c.getOtherAxis(u).inverse),i={thisAxis:u,series:t,thisDim:a.name,otherDim:h,otherAxisInverse:l}}},this)},this),i}},_renderHandle:function(){var t=this._displayables,e=t.handles=[],i=t.handleLabels=[],n=this._displayables.barGroup,r=this._size,a=this.dataZoomModel;n.add(t.filler=new l({draggable:!0,cursor:"move",drift:g(this._onDragMove,this,"all"),onmousemove:function(t){f.stop(t.event)},ondragstart:g(this._showDataInfo,this,!0),ondragend:g(this._onDragEnd,this),onmouseover:g(this._showDataInfo,this,!0),onmouseout:g(this._showDataInfo,this,!1),style:{fill:a.get("fillerColor"),textPosition:"inside"}})),n.add(new l(o.subPixelOptimizeRect({silent:!0,shape:{x:0,y:0,width:r[0],height:r[1]},style:{stroke:a.get("dataBackgroundColor")||a.get("borderColor"),lineWidth:y,fill:"rgba(0,0,0,0)"}})));var s=a.get("handleIcon");m([0,1],function(t){var r=o.makePath(s,{style:{strokeNoScale:!0},rectHover:!0,cursor:"vertical"===this._orient?"ns-resize":"ew-resize",draggable:!0,drift:g(this._onDragMove,this,t),onmousemove:function(t){f.stop(t.event)},ondragend:g(this._onDragEnd,this),onmouseover:g(this._showDataInfo,this,!0),onmouseout:g(this._showDataInfo,this,!1)},{x:-.5,y:0,width:1,height:1},"center"),l=r.getBoundingRect();this._handleHeight=u.parsePercent(a.get("handleSize"),this._size[1]),this._handleWidth=l.width/l.height*this._handleHeight,r.setStyle(a.getModel("handleStyle").getItemStyle());var h=a.get("handleColor");null!=h&&(r.style.fill=h),n.add(e[t]=r);var c=a.textStyleModel;this.group.add(i[t]=new o.Text({silent:!0,invisible:!0,style:{x:0,y:0,text:"",textVerticalAlign:"middle",textAlign:"center",fill:c.getTextColor(),textFont:c.getFont()},z2:10}))},this)},_resetInterval:function(){var t=this._range=this.dataZoomModel.getPercentRange(),e=this._getViewExtent();this._handleEnds=[h(t[0],[0,100],e,!0),h(t[1],[0,100],e,!0)]},_updateInterval:function(t,e){var i=this._handleEnds,n=this._getViewExtent();d(e,i,n,"all"===t||this.dataZoomModel.get("zoomLock")?"rigid":"cross",t),this._range=p([h(i[0],n,[0,100],!0),h(i[1],n,[0,100],!0)])},_updateView:function(t){var e=this._displayables,i=this._handleEnds,n=p(i.slice()),r=this._size;m([0,1],function(t){var n=e.handles[t],o=this._handleHeight;n.attr({scale:[o,o],position:[i[t],r[1]/2-o/2]})},this),e.filler.setShape({x:n[0],y:0,width:n[1]-n[0],height:r[1]}),this._updateDataInfo(t)},_updateDataInfo:function(t){function e(t){var e=o.getTransform(n.handles[t].parent,this.group),i=o.transformDirection(0===t?"right":"left",e),l=this._handleWidth/2+w,u=o.applyTransform([d[t]+(0===t?-l:l),this._size[1]/2],e);r[t].setStyle({x:u[0],y:u[1],textVerticalAlign:a===_?"middle":i,textAlign:a===_?i:"center",text:s[t]})}var i=this.dataZoomModel,n=this._displayables,r=n.handleLabels,a=this._orient,s=["",""];if(i.get("showDetail")){var l=i.findRepresentativeAxisProxy();if(l){var u=l.getAxisModel().axis,h=this._range,c=t?l.calculateDataWindow({start:h[0],end:h[1]}).valueWindow:l.getDataValueWindow();s=[this._formatLabel(c[0],u),this._formatLabel(c[1],u)]}}var d=p(this._handleEnds.slice());e.call(this,0),e.call(this,1)},_formatLabel:function(t,e){var i=this.dataZoomModel,n=i.get("labelFormatter"),o=i.get("labelPrecision");null!=o&&"auto"!==o||(o=e.getPixelPrecision());var a=null==t||isNaN(t)?"":"category"===e.type||"time"===e.type?e.scale.getLabel(Math.round(t)):t.toFixed(Math.min(o,20));return r.isFunction(n)?n(t,a):r.isString(n)?n.replace("{value}",a):a},_showDataInfo:function(t){t=this._dragging||t;var e=this._displayables.handleLabels;e[0].attr("invisible",!t),e[1].attr("invisible",!t)},_onDragMove:function(t,e,i){this._dragging=!0;var n=this._applyBarTransform([e,i],!0);this._updateInterval(t,n[0]);var r=this.dataZoomModel.get("realtime");this._updateView(!r),r&&r&&this._dispatchZoomAction()},_onDragEnd:function(){this._dragging=!1,this._showDataInfo(!1),this._dispatchZoomAction()},_dispatchZoomAction:function(){var t=this._range;this.api.dispatchAction({type:"dataZoom",from:this.uid,dataZoomId:this.dataZoomModel.id,start:t[0],end:t[1]})},_applyBarTransform:function(t,e){var i=this._displayables.barGroup.getLocalTransform();return o.applyTransform(t,i,e)},_findCoordRect:function(){var t;if(m(this.getTargetCoordInfo(),function(e){if(!t&&e.length){var i=e[0].model.coordinateSystem;t=i.getRect&&i.getRect()}}),!t){var e=this.api.getWidth(),i=this.api.getHeight();t={x:.2*e,y:.2*i,width:.6*e,height:.6*i}}return t}});t.exports=S},function(t,e,i){function n(t){var e=t.getZr();return e[p]||(e[p]={})}function r(t,e,i){var n=new c(t.getZr());return n.enable(),n.on("pan",f(a,i)),n.on("zoom",f(s,i)),n}function o(t){h.each(t,function(e,i){e.count||(e.controller.dispose(),delete t[i])})}function a(t,e,i,n,r,o,a){l(t,function(s){return s.panGetRange(t.controller,e,i,n,r,o,a)})}function s(t,e,i,n){l(t,function(r){return r.zoomGetRange(t.controller,e,i,n)})}function l(t,e){var i=[];h.each(t.dataZoomInfos,function(t){var n=e(t);n&&i.push({dataZoomId:t.dataZoomId,start:n[0],end:n[1]})}),t.dispatchAction(i)}function u(t,e){t.dispatchAction({type:"dataZoom",batch:e})}var h=i(1),c=i(94),d=i(39),f=h.curry,p="\0_ec_dataZoom_roams",g={register:function(t,e){var i=n(t),a=e.dataZoomId,s=e.coordId;h.each(i,function(t,i){var n=t.dataZoomInfos;n[a]&&h.indexOf(e.allCoordIds,s)<0&&(delete n[a],t.count--)}),o(i);var l=i[s];l||(l=i[s]={coordId:s,dataZoomInfos:{},count:0},l.controller=r(t,e,l),l.dispatchAction=h.curry(u,t)),l.controller.setContainsPoint(e.containsPoint),d.createOrUpdate(l,"dispatchAction",e.throttleRate,"fixRate"),!l.dataZoomInfos[a]&&l.count++,l.dataZoomInfos[a]=e},unregister:function(t,e){var i=n(t);h.each(i,function(t){t.controller.dispose();var i=t.dataZoomInfos;i[e]&&(delete i[e],t.count--)}),o(i)},shouldRecordRange:function(t,e){if(t&&"dataZoom"===t.type&&t.batch)for(var i=0,n=t.batch.length;i=0;f--)null==r[f]?r.splice(f,1):delete r[f].$action},_flatten:function(t,e,i){c.each(t,function(t){if(t){i&&(t.parentOption=i),e.push(t);var n=t.children;"group"===t.type&&n&&this._flatten(n,e,t),delete t.children}},this)},useElOptionsToUpdate:function(){var t=this._elOptionsToUpdate;return this._elOptionsToUpdate=null,t}});h.extendComponentView({type:"graphic",init:function(t,e){this._elMap={},this._lastGraphicModel},render:function(t,e,i){t!==this._lastGraphicModel&&this._clear(),this._lastGraphicModel=t,this._updateElements(t,i),this._relocate(t,i)},_updateElements:function(t,e){var i=t.useElOptionsToUpdate();if(i){var a=this._elMap,s=this.group;c.each(i,function(t){var e=t.$action,i=t.id,l=a[i],u=t.parentId,h=null!=u?a[u]:s;t.hv&&t.hv[1]&&"text"===t.type&&(t.style=c.defaults({textBaseline:"middle"},t.style),t.style.textVerticalAlign=null);var d=o(t);e&&"merge"!==e?"replace"===e?(r(l,a),n(i,h,d,a)):"remove"===e&&r(l,a):l?l.attr(d):n(i,h,d,a),a[i]&&(a[i].__ecGraphicWidth=t.width,a[i].__ecGraphicHeight=t.height)})}},_relocate:function(t,e){for(var i=t.option.elements,n=this.group,r=this._elMap,o=i.length-1;o>=0;o--){var a=i[o],s=r[a.id];if(s){var l=s.parent,u=l===n?{width:e.getWidth(),height:e.getHeight()}:{width:l.__ecGraphicWidth||0,height:l.__ecGraphicHeight||0};p.positionElement(s,a,u,null,{hv:a.hv,boundingMode:a.bounding})}}},_clear:function(){var t=this._elMap;c.each(t,function(e){r(e,t)}),this._elMap={}},dispose:function(){this._clear()}})},function(t,e,i){i(207),i(209),i(208);var n=i(2);n.registerProcessor(i(210))},function(t,e,i){"use strict";var n=i(1),r=i(10),o=i(2).extendComponentModel({type:"legend",dependencies:["series"],layoutMode:{type:"box",ignoreSize:!0},init:function(t,e,i){this.mergeDefaultAndTheme(t,i),t.selected=t.selected||{}},mergeOption:function(t){o.superCall(this,"mergeOption",t)},optionUpdated:function(){this._updateData(this.ecModel);var t=this._data;if(t[0]&&"single"===this.get("selectedMode")){for(var e=!1,i=0;i=0},defaultOption:{zlevel:0,z:4,show:!0,orient:"horizontal",left:"center",top:"top",align:"auto",backgroundColor:"rgba(0,0,0,0)",borderColor:"#ccc",borderWidth:0,padding:5,itemGap:10,itemWidth:25,itemHeight:14,inactiveColor:"#ccc",textStyle:{color:"#333"},selectedMode:!0,tooltip:{show:!1}}});t.exports=o},function(t,e,i){function n(t,e){e.dispatchAction({type:"legendToggleSelect",name:t})}function r(t,e,i){var n=i.getZr().storage.getDisplayList()[0];n&&n.useHoverLayer||t.get("legendHoverLink")&&i.dispatchAction({type:"highlight",seriesName:t.name,name:e})}function o(t,e,i){var n=i.getZr().storage.getDisplayList()[0];n&&n.useHoverLayer||t.get("legendHoverLink")&&i.dispatchAction({type:"downplay",seriesName:t.name,name:e})}var a=i(1),s=i(24),l=i(3),u=i(131),h=a.curry;t.exports=i(2).extendComponentView({type:"legend",init:function(){this._symbolTypeStore={}},render:function(t,e,i){var s=this.group;if(s.removeAll(),t.get("show")){var c=t.get("selectedMode"),d=t.get("align");"auto"===d&&(d="right"===t.get("left")&&"vertical"===t.get("orient")?"right":"left");var f={};a.each(t.getData(),function(a){var u=a.get("name");if(""===u||"\n"===u)return void s.add(new l.Group({newline:!0}));var p=e.getSeriesByName(u)[0];if(!f[u])if(p){var g=p.getData(),m=g.getVisual("color");"function"==typeof m&&(m=m(p.getDataParams(0)));var v=g.getVisual("legendSymbol")||"roundRect",y=g.getVisual("symbol"),x=this._createItem(u,a,t,v,y,d,m,c);x.on("click",h(n,u,i)).on("mouseover",h(r,p,null,i)).on("mouseout",h(o,p,null,i)),f[u]=!0}else e.eachRawSeries(function(e){if(!f[u]&&e.legendDataProvider){var s=e.legendDataProvider(),l=s.indexOfName(u);if(l<0)return;var p=s.getItemVisual(l,"color"),g="roundRect",m=this._createItem(u,a,t,g,null,d,p,c);m.on("click",h(n,u,i)).on("mouseover",h(r,e,u,i)).on("mouseout",h(o,e,u,i)),f[u]=!0}},this)},this),u.layout(s,t,i),u.addBackground(s,t)}},_createItem:function(t,e,i,n,r,o,u,h){var c=i.get("itemWidth"),d=i.get("itemHeight"),f=i.get("inactiveColor"),p=i.isSelected(t),g=new l.Group,m=e.getModel("textStyle"),v=e.get("icon"),y=e.getModel("tooltip"),x=y.parentModel;if(n=v||n,g.add(s.createSymbol(n,0,0,c,d,p?u:f)),!v&&r&&(r!==n||"none"==r)){var _=.8*d;"none"===r&&(r="circle"),g.add(s.createSymbol(r,(c-_)/2,(d-_)/2,_,_,p?u:f))}var b="left"===o?c+5:-5,w=o,M=i.get("formatter"),S=t;"string"==typeof M&&M?S=M.replace("{name}",null!=t?t:""):"function"==typeof M&&(S=M(t));var T=new l.Text({style:{text:S,x:b,y:d/2,fill:p?m.getTextColor():f,textFont:m.getFont(),textAlign:w,textVerticalAlign:"middle"}});g.add(T);var A=new l.Rect({shape:g.getBoundingRect(),invisible:!0,tooltip:y.get("show")?a.extend({content:t,formatter:x.get("formatter",!0)||function(){return t},formatterParams:{componentType:"legend",legendIndex:i.componentIndex,name:t,$vars:["name"]}},y.option):null});return g.add(A),g.eachChild(function(t){t.silent=!0}),A.silent=!h,this.group.add(g),l.setHoverStyle(g),g}})},function(t,e,i){function n(t,e,i){var n,r={},a="toggleSelected"===t;return i.eachComponent("legend",function(i){a&&null!=n?i[n?"select":"unSelect"](e.name):(i[t](e.name),n=i.isSelected(e.name));var s=i.getData();o.each(s,function(t){var e=t.get("name");if("\n"!==e&&""!==e){var n=i.isSelected(e);e in r?r[e]=r[e]&&n:r[e]=n}})}),{name:e.name,selected:r}}var r=i(2),o=i(1);r.registerAction("legendToggleSelect","legendselectchanged",o.curry(n,"toggleSelected")),r.registerAction("legendSelect","legendselected",o.curry(n,"select")),r.registerAction("legendUnSelect","legendunselected",o.curry(n,"unSelect"))},function(t,e){t.exports=function(t){var e=t.findComponents({mainType:"legend"});e&&e.length&&t.filterSeries(function(t){for(var i=0;i=0&&"number"==typeof u&&(u=+u.toFixed(m)),p.coord[d]=g.coord[d]=u,n=[p,g,{type:o,valueIndex:n.valueIndex,value:u}]}return n=[c.dataTransform(t,n[0]),c.dataTransform(t,n[1]),l.extend({},n[2])],n[2].type=n[2].type||"",l.merge(n[2],n[0]),l.merge(n[2],n[1]),n};i(80).extend({type:"markLine",updateLayout:function(t,e,i){e.eachSeries(function(t){var e=t.markLineModel;if(e){var n=e.getData(),r=e.__from,o=e.__to;r.each(function(e){a(r,e,!0,t,i),a(o,e,!1,t,i)}),n.each(function(t){n.setItemLayout(t,[r.getItemLayout(t),o.getItemLayout(t)])}),this.markerGroupMap[t.name].updateLayout()}},this)},renderSeries:function(t,e,i,n){function r(e,i,r){var o=e.getItemModel(i);a(e,i,r,t,n),e.setItemVisual(i,{symbolSize:o.get("symbolSize")||x[r?0:1],symbol:o.get("symbol",!0)||y[r?0:1],color:o.get("itemStyle.normal.color")||h.getVisual("color")})}var o=t.coordinateSystem,u=t.name,h=t.getData(),c=this.markerGroupMap,f=c[u];f||(f=c[u]=new d),this.group.add(f.group);var p=s(o,t,e),g=p.from,m=p.to,v=p.line;e.__from=g,e.__to=m,e.setData(v);var y=e.get("symbol"),x=e.get("symbolSize");l.isArray(y)||(y=[y,y]),"number"==typeof x&&(x=[x,x]),p.from.each(function(t){r(g,t,!0),r(m,t,!1)}),v.each(function(t){var e=v.getItemModel(t).get("lineStyle.normal.color");v.setItemVisual(t,{color:e||g.getItemVisual(t,"color")}),v.setItemLayout(t,[g.getItemLayout(t),m.getItemLayout(t)]),v.setItemVisual(t,{fromSymbolSize:g.getItemVisual(t,"symbolSize"),fromSymbol:g.getItemVisual(t,"symbol"),toSymbolSize:m.getItemVisual(t,"symbolSize"),toSymbol:m.getItemVisual(t,"symbol")})}),f.updateData(v),p.line.eachItemGraphicEl(function(t,i){t.traverse(function(t){t.dataModel=e})}),f.__keep=!0,f.group.silent=e.get("silent")||t.get("silent")}})},function(t,e,i){t.exports=i(79).extend({type:"markPoint",defaultOption:{zlevel:0,z:5,symbol:"pin",symbolSize:50,tooltip:{trigger:"item"},label:{normal:{show:!0,position:"inside"},emphasis:{show:!0}},itemStyle:{normal:{borderWidth:2}}}})},function(t,e,i){function n(t,e,i){var n=e.coordinateSystem;t.each(function(r){var o,a=t.getItemModel(r),l=s.parsePercent(a.get("x"),i.getWidth()),u=s.parsePercent(a.get("y"),i.getHeight());if(isNaN(l)||isNaN(u)){if(e.getMarkerPosition)o=e.getMarkerPosition(t.getValues(t.dimensions,r));else if(n){var h=t.get(n.dimensions[0],r),c=t.get(n.dimensions[1],r);o=n.dataToPoint([h,c])}}else o=[l,u];isNaN(l)||(o[0]=l),isNaN(u)||(o[1]=u),t.setItemLayout(r,o)})}function r(t,e,i){var n;n=t?a.map(t&&t.dimensions,function(t){var i=e.getData().getDimensionInfo(e.coordDimToDataDim(t)[0])||{};return i.name=t,i}):[{name:"value",type:"float"}];var r=new l(n,i),o=a.map(i.get("data"),a.curry(u.dataTransform,e));return t&&(o=a.filter(o,a.curry(u.dataFilter,t))),r.initData(o,null,t?u.dimValueGetter:function(t){return t.value}),r}var o=i(44),a=i(1),s=i(4),l=i(14),u=i(81);i(80).extend({type:"markPoint",updateLayout:function(t,e,i){e.eachSeries(function(t){var e=t.markPointModel;e&&(n(e.getData(),t,i),this.markerGroupMap[t.name].updateLayout(e))},this)},renderSeries:function(t,e,i,a){var s=t.coordinateSystem,l=t.name,u=t.getData(),h=this.markerGroupMap,c=h[l];c||(c=h[l]=new o);var d=r(s,t,e);e.setData(d),n(e.getData(),t,a),d.each(function(t){var i=d.getItemModel(t),n=i.getShallow("symbolSize");"function"==typeof n&&(n=n(e.getRawValue(t),e.getDataParams(t))),d.setItemVisual(t,{symbolSize:n,color:i.get("itemStyle.normal.color")||u.getVisual("color"),symbol:i.getShallow("symbol")})}),c.updateData(d),this.group.add(c.group),d.eachItemGraphicEl(function(t){t.traverse(function(t){t.dataModel=e})}),c.__keep=!0,c.group.silent=e.get("silent")||t.get("silent")}})},function(t,e,i){"use strict";var n=i(2),r=i(3),o=i(12);n.extendComponentModel({type:"title",layoutMode:{type:"box",ignoreSize:!0},defaultOption:{zlevel:0,z:6,show:!0,text:"",target:"blank",subtext:"",subtarget:"blank",left:0,top:0,backgroundColor:"rgba(0,0,0,0)",borderColor:"#ccc",borderWidth:0,padding:5,itemGap:10,textStyle:{fontSize:18,fontWeight:"bolder",color:"#333"},subtextStyle:{color:"#aaa"}}}),n.extendComponentView({type:"title",render:function(t,e,i){if(this.group.removeAll(),t.get("show")){var n=this.group,a=t.getModel("textStyle"),s=t.getModel("subtextStyle"),l=t.get("textAlign"),u=t.get("textBaseline"),h=new r.Text({style:{text:t.get("text"),textFont:a.getFont(),fill:a.getTextColor()},z2:10}),c=h.getBoundingRect(),d=t.get("subtext"),f=new r.Text({style:{text:d,textFont:s.getFont(),fill:s.getTextColor(),y:c.height+t.get("itemGap"),textBaseline:"top"},z2:10}),p=t.get("link"),g=t.get("sublink");h.silent=!p,f.silent=!g,p&&h.on("click",function(){window.open(p,"_"+t.get("target"))}),g&&f.on("click",function(){window.open(g,"_"+t.get("subtarget"))}),n.add(h),d&&n.add(f);var m=n.getBoundingRect(),v=t.getBoxLayoutParams();v.width=m.width,v.height=m.height;var y=o.getLayoutRect(v,{width:i.getWidth(),height:i.getHeight()},t.get("padding"));l||(l=t.get("left")||t.get("right"),"middle"===l&&(l="center"),"right"===l?y.x+=y.width:"center"===l&&(y.x+=y.width/2)),u||(u=t.get("top")||t.get("bottom"),"center"===u&&(u="middle"),"bottom"===u?y.y+=y.height:"middle"===u&&(y.y+=y.height/2),u=u||"top"),n.attr("position",[y.x,y.y]);var x={textAlign:l,textVerticalAlign:u};h.setStyle(x),f.setStyle(x),m=n.getBoundingRect();var _=y.margin,b=t.getItemStyle(["color","opacity"]);b.fill=t.get("backgroundColor");var w=new r.Rect({shape:{x:m.x-_[3],y:m.y-_[0],width:m.width+_[1]+_[3],height:m.height+_[0]+_[2]},style:b,silent:!0});r.subPixelOptimizeRect(w),n.add(w)}}})},function(t,e,i){i(222),i(223),i(228),i(226),i(224),i(225),i(227)},function(t,e,i){var n=i(28),r=i(1),o=i(2).extendComponentModel({type:"toolbox",layoutMode:{type:"box",ignoreSize:!0},mergeDefaultAndTheme:function(t){o.superApply(this,"mergeDefaultAndTheme",arguments),r.each(this.option.feature,function(t,e){var i=n.get(e);i&&r.merge(t,i.defaultOption)})},defaultOption:{show:!0,z:6,zlevel:0,orient:"horizontal",left:"right",top:"top",backgroundColor:"transparent",borderColor:"#ccc",borderWidth:0,padding:5,itemSize:15,itemGap:8,showTitle:!0,iconStyle:{normal:{borderColor:"#666",color:"none"},emphasis:{borderColor:"#3E98C5"}}}});t.exports=o},function(t,e,i){(function(e){function n(t){return 0===t.indexOf("my")}var r=i(28),o=i(1),a=i(3),s=i(10),l=i(48),u=i(131),h=i(16);t.exports=i(2).extendComponentView({type:"toolbox",render:function(t,e,i,c){function d(o,a){var l,u=y[o],h=y[a],d=m[u],p=new s(d,t,t.ecModel);if(u&&!h){if(n(u))l={model:p,onclick:p.option.onclick,featureName:u};else{var g=r.get(u);if(!g)return;l=new g(p,e,i)}v[u]=l}else{if(l=v[h],!l)return;l.model=p,l.ecModel=e,l.api=i}return!u&&h?void(l.dispose&&l.dispose(e,i)):!p.get("show")||l.unusable?void(l.remove&&l.remove(e,i)):(f(p,l,u),p.setIconStatus=function(t,e){var i=this.option,n=this.iconPaths;i.iconStatus=i.iconStatus||{},i.iconStatus[t]=e,n[t]&&n[t].trigger(e)},void(l.render&&l.render(p,e,i,c)))}function f(n,r,s){var l=n.getModel("iconStyle"),u=r.getIcons?r.getIcons():n.get("icon"),h=n.get("title")||{};if("string"==typeof u){var c=u,d=h;u={},h={},u[s]=c,h[s]=d}var f=n.iconPaths={};o.each(u,function(s,u){var c=l.getModel("normal").getItemStyle(),d=l.getModel("emphasis").getItemStyle(),m={x:-g/2,y:-g/2,width:g,height:g},v=0===s.indexOf("image://")?(m.image=s.slice(8),new a.Image({style:m})):a.makePath(s.replace("path://",""),{style:c,hoverStyle:d,rectHover:!0},m,"center");a.setHoverStyle(v),t.get("showTitle")&&(v.__title=h[u],v.on("mouseover",function(){var t=l.getModel("emphasis").getItemStyle();v.setStyle({text:h[u],textPosition:t.textPosition||"bottom",textFill:t.fill||t.stroke||"#000",textAlign:t.textAlign||"center"})}).on("mouseout",function(){v.setStyle({textFill:null})})),v.trigger(n.get("iconStatus."+u)||"normal"),p.add(v),v.on("click",o.bind(r.onclick,r,e,i,u)),f[u]=v})}var p=this.group;if(p.removeAll(),t.get("show")){var g=+t.get("itemSize"),m=t.get("feature")||{},v=this._features||(this._features={}),y=[];o.each(m,function(t,e){y.push(e)}),new l(this._featureNames||[],y).add(d).update(d).remove(o.curry(d,null)).execute(),this._featureNames=y,u.layout(p,t,i),u.addBackground(p,t),p.eachChild(function(t){var e=t.__title,n=t.hoverStyle;if(n&&e){var r=h.getBoundingRect(e,n.font),o=t.position[0]+p.position[0],a=t.position[1]+p.position[1]+g,s=!1;a+r.height>i.getHeight()&&(n.textPosition="top",s=!0);var l=s?-5-r.height:g+8;o+r.width/2>i.getWidth()?(n.textPosition=["100%",l],n.textAlign="right"):o-r.width/2<0&&(n.textPosition=[0,l],n.textAlign="left")}})}},updateView:function(t,e,i,n){o.each(this._features,function(t){t.updateView&&t.updateView(t.model,e,i,n)})},updateLayout:function(t,e,i,n){o.each(this._features,function(t){t.updateLayout&&t.updateLayout(t.model,e,i,n)})},remove:function(t,e){o.each(this._features,function(i){i.remove&&i.remove(t,e)}),this.group.removeAll()},dispose:function(t,e){o.each(this._features,function(i){i.dispose&&i.dispose(t,e)})}})}).call(e,i(189))},function(t,e,i){function n(t){var e={},i=[],n=[];return t.eachRawSeries(function(t){var r=t.coordinateSystem;if(!r||"cartesian2d"!==r.type&&"polar"!==r.type)i.push(t);else{var o=r.getBaseAxis();if("category"===o.type){var a=o.dim+"_"+o.index;e[a]||(e[a]={categoryAxis:o,valueAxis:r.getOtherAxis(o),series:[]},n.push({axisDim:o.dim,axisIndex:o.index})),e[a].series.push(t)}else i.push(t)}}),{seriesGroupByCategoryAxis:e,other:i,meta:n}}function r(t){var e=[];return p.each(t,function(t,i){var n=t.categoryAxis,r=t.valueAxis,o=r.dim,a=[" "].concat(p.map(t.series,function(t){return t.name})),s=[n.model.getCategories()];p.each(t.series,function(t){s.push(t.getRawData().mapArray(o,function(t){return t}))});for(var l=[a.join(v)],u=0;u=0)return!0}function u(t){for(var e=t.split(/\n+/g),i=s(e.shift()).split(y),n=[],r=p.map(i,function(t){return{name:t,data:[]}}),o=0;o1?"emphasis":"normal")}function a(t,e,i,n){var o=i._isZoomActive;n&&"takeGlobalCursor"===n.type&&(o="dataZoomSelect"===n.key&&n.dataZoomSelectActive),i._isZoomActive=o,t.setIconStatus("zoom",o?"emphasis":"normal");var a=new u(r(t.option),e,{include:["grid"]});i._brushController.setPanels(a.makePanelOpts(function(t){return t.xAxisDeclared&&!t.yAxisDeclared?"lineX":!t.xAxisDeclared&&t.yAxisDeclared?"lineY":"rect"})).enableBrush(!!o&&{brushType:"auto",brushStyle:{lineWidth:0,fill:"rgba(0,0,0,0.2)"}})}var s=i(1),l=i(129),u=i(186),h=i(127),c=s.each;i(204);var d="\0_ec_\0toolbox-dataZoom_";n.defaultOption={show:!0,icon:{zoom:"M0,13.5h26.9 M13.5,26.9V0 M32.1,13.5H58V58H13.5 V32.1",back:"M22,1.4L9.9,13.5l12.3,12.3 M10.3,13.5H54.9v44.6 H10.3v-26"},title:{zoom:"区域缩放",back:"区域缩放还原"}};var f=n.prototype;f.render=function(t,e,i,n){this.model=t,this.ecModel=e,this.api=i,a(t,e,this,n),o(t,e)},f.onclick=function(t,e,i){p[i].call(this)},f.remove=function(t,e){this._brushController.unmount()},f.dispose=function(t,e){this._brushController.dispose()};var p={zoom:function(){var t=!this._isZoomActive;this.api.dispatchAction({type:"takeGlobalCursor",key:"dataZoomSelect",dataZoomSelectActive:t})},back:function(){this._dispatchZoomAction(h.pop(this.ecModel))}};f._onBrush=function(t,e){function i(t,e,i){var r=n(t,e.getAxis(t).model,a);r&&(o[r.id]={dataZoomId:r.id,startValue:i[0],endValue:i[1]})}function n(t,e,i){var n;return i.eachComponent({mainType:"dataZoom",subType:"select"},function(i){var r=i.getAxisModel(t,e.componentIndex);r&&(n=i)}),n}if(e.isEnd&&t.length){var o={},a=this.ecModel;this._brushController.updateCovers([]);var s=new u(r(this.model.option),a,{include:["grid"]});s.matchOutputRanges(t,a,function(t,e,n){if("cartesian2d"===n.type){var r=t.brushType;"rect"===r?(i("x",n,e[0]),i("y",n,e[1])):i({lineX:"x",lineY:"y"}[r],n,e)}}),h.push(a,o),this._dispatchZoomAction(o)}},f._dispatchZoomAction=function(t){var e=[];c(t,function(t,i){e.push(s.clone(t))}),e.length&&this.api.dispatchAction({type:"dataZoom",from:this.uid,batch:e})},i(28).register("dataZoom",n),i(2).registerPreprocessor(function(t){function e(t,e){if(e){var r=t+"Index",o=e[r];null==o||"all"==o||s.isArray(o)||(o=o===!1||"none"===o?[]:[o]),i(t,function(e,i){if(null==o||"all"==o||s.indexOf(o,i)!==-1){var a={type:"select",$fromToolbox:!0,id:d+t+i};a[r]=i,n.push(a)}})}}function i(e,i){var n=t[e];s.isArray(n)||(n=n?[n]:[]),c(n,i)}if(t){var n=t.dataZoom||(t.dataZoom=[]);s.isArray(n)||(t.dataZoom=n=[n]);var r=t.toolbox;if(r&&(s.isArray(r)&&(r=r[0]),r&&r.feature)){var o=r.feature.dataZoom;e("xAxis",o),e("yAxis",o)}}}),t.exports=n},function(t,e,i){"use strict";function n(t){this.model=t}var r=i(1);n.defaultOption={show:!0,type:[],icon:{line:"M4.1,28.9h7.1l9.3-22l7.4,38l9.7-19.7l3,12.8h14.9M4.1,58h51.4",bar:"M6.7,22.9h10V48h-10V22.9zM24.9,13h10v35h-10V13zM43.2,2h10v46h-10V2zM3.1,58h53.7",stack:"M8.2,38.4l-8.4,4.1l30.6,15.3L60,42.5l-8.1-4.1l-21.5,11L8.2,38.4z M51.9,30l-8.1,4.2l-13.4,6.9l-13.9-6.9L8.2,30l-8.4,4.2l8.4,4.2l22.2,11l21.5-11l8.1-4.2L51.9,30z M51.9,21.7l-8.1,4.2L35.7,30l-5.3,2.8L24.9,30l-8.4-4.1l-8.3-4.2l-8.4,4.2L8.2,30l8.3,4.2l13.9,6.9l13.4-6.9l8.1-4.2l8.1-4.1L51.9,21.7zM30.4,2.2L-0.2,17.5l8.4,4.1l8.3,4.2l8.4,4.2l5.5,2.7l5.3-2.7l8.1-4.2l8.1-4.2l8.1-4.1L30.4,2.2z",tiled:"M2.3,2.2h22.8V25H2.3V2.2z M35,2.2h22.8V25H35V2.2zM2.3,35h22.8v22.8H2.3V35z M35,35h22.8v22.8H35V35z"},title:{line:"切换为折线图",bar:"切换为柱状图",stack:"切换为堆叠",tiled:"切换为平铺"},option:{},seriesIndex:{}};var o=n.prototype;o.getIcons=function(){var t=this.model,e=t.get("icon"),i={};return r.each(t.get("type"),function(t){e[t]&&(i[t]=e[t])}),i};var a={line:function(t,e,i,n){if("bar"===t)return r.merge({id:e,type:"line",data:i.get("data"),stack:i.get("stack"),markPoint:i.get("markPoint"),markLine:i.get("markLine")},n.get("option.line")||{},!0)},bar:function(t,e,i,n){if("line"===t)return r.merge({id:e,type:"bar",data:i.get("data"),stack:i.get("stack"),markPoint:i.get("markPoint"),markLine:i.get("markLine")},n.get("option.bar")||{},!0)},stack:function(t,e,i,n){if("line"===t||"bar"===t)return r.merge({id:e,stack:"__ec_magicType_stack__"},n.get("option.stack")||{},!0)},tiled:function(t,e,i,n){if("line"===t||"bar"===t)return r.merge({id:e,stack:""},n.get("option.tiled")||{},!0)}},s=[["line","bar"],["stack","tiled"]];o.onclick=function(t,e,i){var n=this.model,o=n.get("seriesIndex."+i);if(a[i]){var l={series:[]},u=function(e){var o=e.subType,s=e.id,u=a[i](o,s,e,n);u&&(r.defaults(u,e.option),l.series.push(u));var h=e.coordinateSystem;if(h&&"cartesian2d"===h.type&&("line"===i||"bar"===i)){var c=h.getAxesByScale("ordinal")[0];if(c){var d=c.dim,f=d+"Axis",p=t.queryComponents({mainType:f,index:e.get(name+"Index"),id:e.get(name+"Id")})[0],g=p.componentIndex;l[f]=l[f]||[];for(var m=0;m<=g;m++)l[f][g]=l[f][g]||{};l[f][g].boundaryGap="bar"===i}}};r.each(s,function(t){r.indexOf(t,i)>=0&&r.each(t,function(t){n.setIconStatus(t,"normal")})}),n.setIconStatus(i,"emphasis"),t.eachComponent({mainType:"series",query:null==o?null:{seriesIndex:o}},u),e.dispatchAction({type:"changeMagicType",currentType:i,newOption:l})}};var l=i(2);l.registerAction({type:"changeMagicType",event:"magicTypeChanged",update:"prepareAndUpdate"},function(t,e){e.mergeOption(t.newOption)}),i(28).register("magicType",n),t.exports=n},function(t,e,i){"use strict";function n(t){this.model=t}var r=i(127);n.defaultOption={show:!0,icon:"M3.8,33.4 M47,18.9h9.8V8.7 M56.3,20.1 C52.1,9,40.5,0.6,26.8,2.1C12.6,3.7,1.6,16.2,2.1,30.6 M13,41.1H3.1v10.2 M3.7,39.9c4.2,11.1,15.8,19.5,29.5,18 c14.2-1.6,25.2-14.1,24.7-28.5",title:"还原"};var o=n.prototype;o.onclick=function(t,e,i){r.clear(t),e.dispatchAction({type:"restore",from:this.uid})},i(28).register("restore",n),i(2).registerAction({type:"restore",event:"restore",update:"prepareAndUpdate"},function(t,e){e.resetOption("recreate")}),t.exports=n},function(t,e,i){function n(t){this.model=t}var r=i(9);n.defaultOption={show:!0,icon:"M4.7,22.9L29.3,45.5L54.7,23.4M4.6,43.6L4.6,58L53.8,58L53.8,43.6M29.2,45.1L29.2,0",title:"保存为图片",type:"png",name:"",excludeComponents:["toolbox"],pixelRatio:1,lang:["右键另存为图片"]},n.prototype.unusable=!r.canvasSupported;var o=n.prototype;o.onclick=function(t,e){var i=this.model,n=i.get("name")||t.get("title.0.text")||"echarts",o=document.createElement("a"),a=i.get("type",!0)||"png";o.download=n+"."+a,o.target="_blank";var s=e.getConnectedDataURL({type:a,backgroundColor:i.get("backgroundColor",!0)||t.get("backgroundColor")||"#fff",excludeComponents:i.get("excludeComponents"),pixelRatio:i.get("pixelRatio")});if(o.href=s,"function"!=typeof MouseEvent||r.browser.ie||r.browser.edge){var l=i.get("lang"),u='',h=window.open();h.document.write(u)}else{var c=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!1});o.dispatchEvent(c)}},i(28).register("saveAsImage",n),t.exports=n},function(t,e,i){i(45),i(231),i(232),i(2).registerAction({type:"showTip",event:"showTip",update:"tooltip:manuallyShowTip"},function(){}),i(2).registerAction({type:"hideTip",event:"hideTip",update:"tooltip:manuallyHideTip"},function(){})},function(t,e,i){function n(t){var e="cubic-bezier(0.23, 1, 0.32, 1)",i="left "+t+"s "+e+",top "+t+"s "+e;return s.map(p,function(t){return t+"transition:"+i}).join(";")}function r(t){var e=[],i=t.get("fontSize"),n=t.getTextColor();return n&&e.push("color:"+n),e.push("font:"+t.getFont()),i&&e.push("line-height:"+Math.round(3*i/2)+"px"),c(["decoration","align"],function(i){var n=t.get(i);n&&e.push("text-"+i+":"+n)}),e.join(";")}function o(t){var e=[],i=t.get("transitionDuration"),o=t.get("backgroundColor"),a=t.getModel("textStyle"),s=t.get("padding");return i&&e.push(n(i)),o&&(f.canvasSupported?e.push("background-Color:"+o):(e.push("background-Color:#"+l.toHex(o)),e.push("filter:alpha(opacity=70)"))),c(["width","color","radius"],function(i){var n="border-"+i,r=d(n),o=t.get(r);null!=o&&e.push(n+":"+o+("color"===i?"":"px"))}),e.push(r(a)),null!=s&&e.push("padding:"+h.normalizeCssArray(s).join("px ")+"px"),e.join(";")+";"}function a(t,e){var i=document.createElement("div"),n=this._zr=e.getZr();this.el=i,this._x=e.getWidth()/2,this._y=e.getHeight()/2,t.appendChild(i),this._container=t,this._show=!1,this._hideTimeout;var r=this;i.onmouseenter=function(){r._enterable&&(clearTimeout(r._hideTimeout),r._show=!0),r._inContent=!0},i.onmousemove=function(e){if(e=e||window.event,!r._enterable){var i=n.handler;u.normalizeEvent(t,e,!0),i.dispatch("mousemove",e)}},i.onmouseleave=function(){r._enterable&&r._show&&r.hideLater(r._hideDelay),r._inContent=!1}}var s=i(1),l=i(22),u=i(20),h=i(7),c=s.each,d=h.toCamelCase,f=i(9),p=["","-webkit-","-moz-","-o-"],g="position:absolute;display:block;border-style:solid;white-space:nowrap;z-index:9999999;";a.prototype={constructor:a,_enterable:!0,update:function(){var t=this._container,e=t.currentStyle||document.defaultView.getComputedStyle(t),i=t.style;"absolute"!==i.position&&"absolute"!==e.position&&(i.position="relative")},show:function(t){clearTimeout(this._hideTimeout);var e=this.el;e.style.cssText=g+o(t)+";left:"+this._x+"px;top:"+this._y+"px;"+(t.get("extraCssText")||""),e.style.display=e.innerHTML?"block":"none",this._show=!0},setContent:function(t){this.el.innerHTML=t},setEnterable:function(t){this._enterable=t},getSize:function(){var t=this.el;return[t.clientWidth,t.clientHeight]},moveTo:function(t,e){var i,n=this._zr;n&&n.painter&&(i=n.painter.getViewportRoot())&&(t+=i.offsetLeft||0,e+=i.offsetTop||0);var r=this.el.style;r.left=t+"px",r.top=e+"px",this._x=t,this._y=e},hide:function(){this.el.style.display="none",this._show=!1},hideLater:function(t){!this._show||this._inContent&&this._enterable||(t?(this._hideDelay=t,this._show=!1,this._hideTimeout=setTimeout(s.bind(this.hide,this),t)):this.hide())},isShow:function(){return this._show}},t.exports=a},function(t,e,i){i(2).extendComponentModel({type:"tooltip",dependencies:["axisPointer"],defaultOption:{zlevel:0,z:8,show:!0,showContent:!0,trigger:"item",triggerOn:"mousemove|click",alwaysShowContent:!1,displayMode:"single",confine:!1,showDelay:0,hideDelay:100,transitionDuration:.4,enterable:!1,backgroundColor:"rgba(50,50,50,0.7)",borderColor:"#333",borderRadius:4,borderWidth:0,padding:5,extraCssText:"",axisPointer:{type:"line",axis:"auto",animation:"auto",animationDurationUpdate:200,animationEasingUpdate:"exponentialOut",crossStyle:{color:"#999",width:1,type:"dashed",textStyle:{}}},textStyle:{color:"#fff",fontSize:14}}})},function(t,e,i){function n(t){for(var e=t.pop();t.length;){var i=t.pop();i&&(i instanceof m&&(i=i.get("tooltip",!0)),"string"==typeof i&&(i={formatter:i}),e=new m(i,e,e.ecModel))}return e}function r(t,e){return t.dispatchAction||h.bind(e.dispatchAction,e)}function o(t,e,i,n,r,o,a){var s=i.clientWidth,l=i.clientHeight;return t+s+o>n?t-=s+o:t+=o,e+l+a>r?e-=l+a:e+=a,[t,e]}function a(t,e,i,n,r){var o=i.clientWidth,a=i.clientHeight;return t=Math.min(t+o,n)-o,e=Math.min(e+a,r)-a,t=Math.max(t,0),e=Math.max(e,0),[t,e]}function s(t,e,i){var n=i[0],r=i[1],o=5,a=0,s=0,l=e.width,u=e.height;switch(t){case"inside":a=e.x+l/2-n/2,s=e.y+u/2-r/2;break;case"top":a=e.x+l/2-n/2,s=e.y-r-o;break;case"bottom":a=e.x+l/2-n/2,s=e.y+u+o;break;case"left":a=e.x-n-o,s=e.y+u/2-r/2;break;case"right":a=e.x+l+o,s=e.y+u/2-r/2}return[a,s]}function l(t){return"center"===t||"middle"===t}var u=i(230),h=i(1),c=i(7),d=i(4),f=i(75),p=i(12),g=i(9),m=i(10),v=i(76),y=i(17),x=i(55),_=h.bind,b=h.each,w=d.parsePercent;i(2).extendComponentView({type:"tooltip",init:function(t,e){if(!g.node){var i=new u(e.getDom(),e);this._tooltipContent=i}},render:function(t,e,i){if(!g.node){this.group.removeAll(),this._tooltipModel=t,this._ecModel=e,this._api=i,this._lastDataByCoordSys,this._alwaysShowContent=t.get("alwaysShowContent");var n=this._tooltipContent;n.update(),n.setEnterable(t.get("enterable")),this._initGlobalListener(),this._keepShow()}},_initGlobalListener:function(){var t=this._tooltipModel,e=t.get("triggerOn");v.register("itemTooltip",this._api,_(function(t,i,n){"none"!==e&&(e.indexOf(t)>=0?this._tryShow(i,n):"leave"===t&&this._hide(n))},this))},_keepShow:function(){var t=this._tooltipModel,e=this._ecModel,i=this._api;if(null!=this._lastX&&null!=this._lastY&&"none"!==t.get("triggerOn")){var n=this;clearTimeout(this._refreshUpdateTimeout),this._refreshUpdateTimeout=setTimeout(function(){n.manuallyShowTip(t,e,i,{x:n._lastX,y:n._lastY})})}},manuallyShowTip:function(t,e,i,n){if(n.from!==this.uid&&!g.node){var o=r(n,i);this._ticket="";var a=n.seriesIndex,s=n.dataByCoordSys;if(s)this._tryShow({offsetX:n.x,offsetY:n.y,position:n.position,event:{},dataByCoordSys:n.dataByCoordSys, +tooltipOption:n.tooltipOption},o);else if(null!=a){var l=f(n,e),u=l.point[0],h=l.point[1];null!=u&&null!=h&&this._tryShow({offsetX:u,offsetY:h,position:n.position,target:l.el,event:{}},o)}else null!=n.x&&null!=n.y&&this._tryShow({offsetX:n.x,offsetY:n.y,position:n.position,target:i.getZr().handler.findHover(n.x,n.y),event:{}},o)}},manuallyHideTip:function(t,e,i,n){var o=this._tooltipContent;this._alwaysShowContent||o.hideLater(this._tooltipModel.get("hideDelay")),this._lastX=this._lastY=null,n.from!==this.uid&&this._hide(r(n,i))},_tryShow:function(t,e){var i=t.target,n=this._tooltipModel;if(n){this._lastX=t.offsetX,this._lastY=t.offsetY;var r=t.dataByCoordSys;r&&r.length?this._showAxisTooltip(r,t):i&&null!=i.dataIndex?(this._lastDataByCoordSys=null,this._showSeriesItemTooltip(t,i,e)):i&&i.tooltip?(this._lastDataByCoordSys=null,this._showComponentItemTooltip(t,i,e)):(this._lastDataByCoordSys=null,this._hide(e))}},_showOrMove:function(t,e){var i=t.get("showDelay");e=h.bind(e,this),clearTimeout(this._showTimout),i>0?this._showTimout=setTimeout(e,i):e()},_showAxisTooltip:function(t,e){var i=this._ecModel,r=this._tooltipModel,o=[e.offsetX,e.offsetY],a=[],s=[],l=n([e.tooltipOption,r]);b(t,function(t){b(t.dataByAxis,function(t){var e=i.getComponent(t.axisDim+"Axis",t.axisIndex),n=t.value,r=[];if(e&&null!=n){var o=x.getValueLabel(n,e.axis,i,t.seriesDataIndices,t.valueLabelOpt);h.each(t.seriesDataIndices,function(a){var l=i.getSeriesByIndex(a.seriesIndex),u=a.dataIndexInside,h=l&&l.getDataParams(u);h.axisDim=t.axisDim,h.axisIndex=t.axisIndex,h.axisType=t.axisType,h.axisId=t.axisId,h.axisValue=y.getAxisRawValue(e.axis,n),h.axisValueLabel=o,h&&(s.push(h),r.push(l.formatTooltip(u,!0)))});var l=o;a.push((l?c.encodeHTML(l)+"
":"")+r.join("
"))}})},this),a.reverse(),a=a.join("

");var u=e.position;this._showOrMove(l,function(){this._updateContentNotChangedOnAxis(t)?this._updatePosition(l,u,o[0],o[1],this._tooltipContent,s):this._showTooltipContent(l,a,s,Math.random(),o[0],o[1],u)})},_showSeriesItemTooltip:function(t,e,i){var r=this._ecModel,o=e.seriesIndex,a=r.getSeriesByIndex(o),s=e.dataModel||a,l=e.dataIndex,u=e.dataType,h=s.getData(),c=n([h.getItemModel(l),s,a&&(a.coordinateSystem||{}).model,this._tooltipModel]),d=c.get("trigger");if(null==d||"item"===d){var f=s.getDataParams(l,u),p=s.formatTooltip(l,!1,u),g="item_"+s.name+"_"+l;this._showOrMove(c,function(){this._showTooltipContent(c,p,f,g,t.offsetX,t.offsetY,t.position,t.target)}),i({type:"showTip",dataIndexInside:l,dataIndex:h.getRawIndex(l),seriesIndex:o,from:this.uid})}},_showComponentItemTooltip:function(t,e,i){var n=e.tooltip;if("string"==typeof n){var r=n;n={content:r,formatter:r}}var o=new m(n,this._tooltipModel,this._ecModel),a=o.get("content"),s=Math.random();this._showOrMove(o,function(){this._showTooltipContent(o,a,o.get("formatterParams")||{},s,t.offsetX,t.offsetY,t.position,e)}),i({type:"showTip",from:this.uid})},_showTooltipContent:function(t,e,i,n,r,o,a,s){if(this._ticket="",t.get("showContent")&&t.get("show")){var l=this._tooltipContent,u=t.get("formatter");a=a||t.get("position");var h=e;if(u&&"string"==typeof u)h=c.formatTpl(u,i,!0);else if("function"==typeof u){var d=_(function(e,n){e===this._ticket&&(l.setContent(n),this._updatePosition(t,a,r,o,l,i,s))},this);this._ticket=n,h=u(i,n,d)}l.setContent(h),l.show(t),this._updatePosition(t,a,r,o,l,i,s)}},_updatePosition:function(t,e,i,n,r,u,c){var d=this._api.getWidth(),f=this._api.getHeight();e=e||t.get("position");var g=r.getSize(),m=t.get("align"),v=t.get("verticalAlign"),y=c&&c.getBoundingRect().clone();if(c&&y.applyTransform(c.transform),"function"==typeof e&&(e=e([i,n],u,r.el,y,{viewSize:[d,f],contentSize:g.slice()})),h.isArray(e))i=w(e[0],d),n=w(e[1],f);else if(h.isObject(e)){e.width=g[0],e.height=g[1];var x=p.getLayoutRect(e,{width:d,height:f});i=x.x,n=x.y,m=null,v=null}else if("string"==typeof e&&c){var _=s(e,y,g);i=_[0],n=_[1]}else{var _=o(i,n,r.el,d,f,m?0:20,v?0:20);i=_[0],n=_[1]}if(m&&(i-=l(m)?g[0]/2:"right"===m?g[0]:0),v&&(n-=l(v)?g[1]/2:"bottom"===v?g[1]:0),t.get("confine")){var _=a(i,n,r.el,d,f);i=_[0],n=_[1]}r.moveTo(i,n)},_updateContentNotChangedOnAxis:function(t){var e=this._lastDataByCoordSys,i=!!e&&e.length===t.length;return b(e,function(e,n){var r=e.dataByAxis||{},o=t[n]||{},a=o.dataByAxis||[];i&=r.length===a.length,b(r,function(t,e){var n=a[e]||{},r=t.seriesDataIndices||[],o=n.seriesDataIndices||[];i&=t.value===n.value&&t.axisType===n.axisType&&t.axisId===n.axisId&&r.length===o.length,b(r,function(t,e){var n=o[e];i&=t.seriesIndex===n.seriesIndex&&t.dataIndex===n.dataIndex})})}),this._lastDataByCoordSys=t,!!i},_hide:function(t){this._lastDataByCoordSys=null,t({type:"hideTip",from:this.uid})},dispose:function(t,e){g.node||(this._tooltipContent.hide(),v.unregister("itemTooltip",e))}})},,function(t,e,i){function n(t){return parseInt(t,10)}function r(t,e){s.initVML(),this.root=t,this.storage=e;var i=document.createElement("div"),n=document.createElement("div");i.style.cssText="display:inline-block;overflow:hidden;position:relative;width:300px;height:150px;",n.style.cssText="position:absolute;left:0;top:0;",t.appendChild(i),this._vmlRoot=n,this._vmlViewport=i,this.resize();var r=e.delFromMap,o=e.addToMap;e.delFromMap=function(t){var i=e.get(t);r.call(e,t),i&&i.onRemove&&i.onRemove(n)},e.addToMap=function(t){t.onAdd&&t.onAdd(n),o.call(e,t)},this._firstPaint=!0}function o(t){return function(){a('In IE8.0 VML mode painter not support method "'+t+'"')}}var a=i(52),s=i(184);r.prototype={constructor:r,getViewportRoot:function(){return this._vmlViewport},refresh:function(){var t=this.storage.getDisplayList(!0,!0);this._paintList(t)},_paintList:function(t){for(var e=this._vmlRoot,i=0;i=0?parseFloat(t)/100*e:parseFloat(t):t},E=function(t,e,i){var n=a.parse(e);i=+i,isNaN(i)&&(i=1),n&&(t.color=k(n[0],n[1],n[2]),t.opacity=i*n[3])},N=function(t){var e=a.parse(t);return[k(e[0],e[1],e[2]),e[3]]},R=function(t,e,i){var n=e.fill;if(null!=n)if(n instanceof f){var r,o=0,a=[0,0],s=0,l=1,u=i.getBoundingRect(),h=u.width,c=u.height;if("linear"===n.type){r="gradient";var d=i.transform,p=[n.x*h,n.y*c],g=[n.x2*h,n.y2*c];d&&(b(p,p,d),b(g,g,d));var m=g[0]-p[0],v=g[1]-p[1];o=180*Math.atan2(m,v)/Math.PI,o<0&&(o+=360),o<1e-6&&(o=0)}else{r="gradientradial";var p=[n.x*h,n.y*c],d=i.transform,y=i.scale,x=h,w=c;a=[(p[0]-u.x)/x,(p[1]-u.y)/w],d&&b(p,p,d),x/=y[0]*S,w/=y[1]*S;var M=_(x,w);s=0/M,l=2*n.r/M-s}var T=n.colorStops.slice();T.sort(function(t,e){return t.offset-e.offset});for(var A=T.length,I=[],C=[],P=0;P=2){var D=I[0][0],O=I[1][0],z=I[0][1]*e.opacity,R=I[1][1]*e.opacity;t.type=r,t.method="none",t.focus="100%",t.angle=o,t.color=D,t.color2=O,t.colors=C.join(","),t.opacity=R,t.opacity2=z}"radial"===r&&(t.focusposition=a.join(","))}else E(t,n,e.opacity)},B=function(t,e){null!=e.lineDash&&(t.dashstyle=e.lineDash.join(" ")),null==e.stroke||e.stroke instanceof f||E(t,e.stroke,e.opacity)},V=function(t,e,i,n){var r="fill"==e,o=t.getElementsByTagName(e)[0];null!=i[e]&&"none"!==i[e]&&(r||!r&&i.lineWidth)?(t[r?"filled":"stroked"]="true",i[e]instanceof f&&D(t,o),o||(o=p.createNode(e)),r?R(o,i,n):B(o,i),L(t,o)):(t[r?"filled":"stroked"]="false",D(t,o))},F=[[],[],[]],G=function(t,e){var i,n,r,a,s,l,u=o.M,h=o.C,c=o.L,d=o.A,f=o.Q,p=[];for(a=0;a.01?G&&(H+=270/S):Math.abs(W-E)<1e-4?G&&Hz?A-=270/S:A+=270/S:G&&WE?M+=270/S:M-=270/S),p.push(Z,g(((z-N)*L+P)*S-T),w,g(((E-R)*D+k)*S-T),w,g(((z+N)*L+P)*S-T),w,g(((E+R)*D+k)*S-T),w,g((H*L+P)*S-T),w,g((W*D+k)*S-T),w,g((M*L+P)*S-T),w,g((A*D+k)*S-T)),s=M,l=A;break;case o.R:var q=F[0],j=F[1];q[0]=t[a++],q[1]=t[a++],j[0]=q[0]+t[a++],j[1]=q[1]+t[a++],e&&(b(q,q,e),b(j,j,e)),q[0]=g(q[0]*S-T),j[0]=g(j[0]*S-T),q[1]=g(q[1]*S-T),j[1]=g(j[1]*S-T),p.push(" m ",q[0],w,q[1]," l ",j[0],w,q[1]," l ",j[0],w,j[1]," l ",q[0],w,j[1]);break;case o.Z:p.push(" x ")}if(i>0){p.push(n);for(var U=0;UU&&(j=0,q={});var i,n=X.style;try{n.font=t,i=n.fontFamily.split(",")[0]}catch(r){}e={style:n.fontStyle||Z,variant:n.fontVariant||Z,weight:n.fontWeight||Z,size:0|parseFloat(n.fontSize||12),family:i||"Microsoft YaHei"},q[t]=e,j++}return e};s.measureText=function(t,e){var i=p.doc;W||(W=i.createElement("div"),W.style.cssText="position:absolute;top:-20000px;left:0;padding:0;margin:0;border:none;white-space:pre;",p.doc.body.appendChild(W));try{W.style.font=e}catch(n){}return W.innerHTML="",W.appendChild(i.createTextNode(t)),{width:W.offsetWidth}};for(var $=new r,K=function(t,e,i,n){var r=this.style,o=r.text;if(null!=o&&(o+=""),o){var a,l,u=r.textAlign,h=Y(r.textFont),c=h.style+" "+h.variant+" "+h.weight+" "+h.size+'px "'+h.family+'"',d=r.textBaseline,f=r.textVerticalAlign;i=i||s.getBoundingRect(o,c,u,d);var m=this.transform;if(m&&!n&&($.copy(e),$.applyTransform(m),e=$),n)a=e.x,l=e.y;else{var v=r.textPosition,y=r.textDistance;if(v instanceof Array)a=e.x+z(v[0],e.width),l=e.y+z(v[1],e.height),u=u||"left",d=d||"top";else{var x=s.adjustTextPositionOnRect(v,e,i,y);a=x.x,l=x.y,u=u||x.textAlign,d=d||x.textBaseline}}if(f){switch(f){case"middle":l-=i.height/2;break;case"bottom":l-=i.height}d="top"}var _=h.size;switch(d){case"hanging":case"top":l+=_/1.75;break;case"middle":break;default:l-=_/2.25}switch(u){case"left":break;case"center":a-=i.width/2;break;case"right":a-=i.width}var M,S,T,A=p.createNode,I=this._textVmlEl;I?(T=I.firstChild,M=T.nextSibling,S=M.nextSibling):(I=A("line"),M=A("path"),S=A("textpath"),T=A("skew"),S.style["v-text-align"]="left",C(I),M.textpathok=!0,S.on=!0,I.from="0 0",I.to="1000 0.05",L(I,T),L(I,M),L(I,S),this._textVmlEl=I);var k=[a,l],D=I.style;m&&n?(b(k,k,m),T.on=!0,T.matrix=m[0].toFixed(3)+w+m[2].toFixed(3)+w+m[1].toFixed(3)+w+m[3].toFixed(3)+",0,0",T.offset=(g(k[0])||0)+","+(g(k[1])||0),T.origin="0 0",D.left="0px",D.top="0px"):(T.on=!1,D.left=g(a)+"px",D.top=g(l)+"px"),S.string=P(o);try{S.style.font=c}catch(E){}V(I,"fill",{fill:n?r.fill:r.textFill,opacity:r.opacity},this),V(I,"stroke",{stroke:n?r.stroke:r.textStroke,opacity:r.opacity,lineDash:r.lineDash},this),I.style.zIndex=O(this.zlevel,this.z,this.z2),L(t,I)}},Q=function(t){D(t,this._textVmlEl),this._textVmlEl=null},J=function(t){L(t,this._textVmlEl)},tt=[l,u,h,d,c],et=0;et} + * @type {Object} key: actionType. * @inner */ - var actions = []; + var actions = {}; /** * Map eventType to actionType @@ -1544,6 +1586,12 @@ return /******/ (function(modules) { // webpackBootstrap */ var optionPreprocessorFuncs = []; + /** + * @type {Array.} + * @inner + */ + var postUpdateFuncs = []; + /** * Visual encoding functions of each stage * @type {Array.>} @@ -1574,27 +1622,32 @@ return /******/ (function(modules) { // webpackBootstrap /** * @type {number} */ - version: '3.4.0', + version: '3.5.0', dependencies: { - zrender: '3.3.0' + zrender: '3.4.0' } }; function enableConnect(chart) { - var STATUS_PENDING = 0; var STATUS_UPDATING = 1; var STATUS_UPDATED = 2; var STATUS_KEY = '__connectUpdateStatus'; + function updateConnectedChartsStatus(charts, status) { for (var i = 0; i < charts.length; i++) { var otherChart = charts[i]; otherChart[STATUS_KEY] = status; } } + zrUtil.each(eventActionMap, function (actionType, eventType) { chart._messageCenter.on(eventType, function (event) { if (connectedGroups[chart.group] && chart[STATUS_KEY] !== STATUS_PENDING) { + if (event && event.escapeConnect) { + return; + } + var action = chart.makeActionFromEvent(event); var otherCharts = []; @@ -1614,8 +1667,8 @@ return /******/ (function(modules) { // webpackBootstrap } }); }); - } + /** * @param {HTMLDomElement} dom * @param {Object} [theme] @@ -1641,7 +1694,13 @@ return /******/ (function(modules) { // webpackBootstrap if (!dom) { throw new Error('Initialize failed: invalid dom.'); } - if (zrUtil.isDom(dom) && dom.nodeName.toUpperCase() !== 'CANVAS' && (!dom.clientWidth || !dom.clientHeight)) { + if (zrUtil.isDom(dom) + && dom.nodeName.toUpperCase() !== 'CANVAS' + && ( + (!dom.clientWidth && (!opts || opts.width == null)) + || (!dom.clientHeight && (!opts || opts.height == null)) + ) + ) { console.warn('Can\'t get dom width or height'); } } @@ -1682,12 +1741,18 @@ return /******/ (function(modules) { // webpackBootstrap }; /** + * @DEPRECATED * @return {string} groupId */ echarts.disConnect = function (groupId) { connectedGroups[groupId] = false; }; + /** + * @return {string} groupId + */ + echarts.disconnect = echarts.disConnect; + /** * Dispose a chart instance * @param {module:echarts~ECharts|HTMLDomElement|string} chart @@ -1755,6 +1820,14 @@ return /******/ (function(modules) { // webpackBootstrap }); }; + /** + * Register postUpdater + * @param {Function} postUpdateFunc + */ + echarts.registerPostUpdate = function (postUpdateFunc) { + postUpdateFuncs.push(postUpdateFunc); + }; + /** * Usage: * registerAction('someAction', 'someEvent', function () { ... }); @@ -1949,11 +2022,14 @@ return /******/ (function(modules) { // webpackBootstrap // -------- // Exports // -------- - // + echarts.zrender = zrender; + echarts.List = __webpack_require__(98); echarts.Model = __webpack_require__(12); - echarts.graphic = __webpack_require__(43); + echarts.Axis = __webpack_require__(100); + + echarts.graphic = __webpack_require__(44); echarts.number = __webpack_require__(7); echarts.format = __webpack_require__(6); echarts.throttle = throttle.throttle; @@ -1965,13 +2041,16 @@ return /******/ (function(modules) { // webpackBootstrap each([ 'map', 'each', 'filter', 'indexOf', 'inherits', 'reduce', 'filter', 'bind', 'curry', 'isArray', 'isString', 'isObject', 'isFunction', - 'extend', 'defaults', 'clone' + 'extend', 'defaults', 'clone', 'merge' ], function (name) { echarts.util[name] = zrUtil[name]; } ); + echarts.helper = __webpack_require__(101); + + // PRIORITY echarts.PRIORITY = { PROCESSOR: { @@ -2193,7 +2272,7 @@ return /******/ (function(modules) { // webpackBootstrap this._optionManager = optionManager; }, - setOption: function (option, optionPreprocessorFuncs) { + setOption: function (option, optionPreprocessorFuncs, onlyGraphic) { zrUtil.assert( !(OPTION_INNER_KEY in option), 'please use chart.getOption()' @@ -2201,7 +2280,7 @@ return /******/ (function(modules) { // webpackBootstrap this._optionManager.setOption(option, optionPreprocessorFuncs); - this.resetOption(); + this.resetOption(null, onlyGraphic); }, /** @@ -2211,7 +2290,7 @@ return /******/ (function(modules) { // webpackBootstrap * 'media': only reset media query option * @return {boolean} Whether option changed. */ - resetOption: function (type) { + resetOption: function (type, onlyGraphic) { var optionChanged = false; var optionManager = this._optionManager; @@ -2222,7 +2301,11 @@ return /******/ (function(modules) { // webpackBootstrap initBase.call(this, baseOption); } else { - this.restoreData(); + // If only graphic, other series and component will not + // go through update process, data should not be restored. + // Otherwise grphic els mounted on data will be eliminated + // and downplay will not work. + !onlyGraphic && this.restoreData(); this.mergeOption(baseOption); } optionChanged = true; @@ -2463,7 +2546,7 @@ return /******/ (function(modules) { // webpackBootstrap } else { // Return all components with mainType - result = cpts; + result = cpts.slice(); } return filterBySubType(result, condition); @@ -2742,10 +2825,12 @@ return /******/ (function(modules) { // webpackBootstrap this.option[OPTION_INNER_KEY] = 1; /** + * Init with series: [], in case of calling findSeries method + * before series initialized. * @type {Object.>} * @private */ - this._componentsMap = {}; + this._componentsMap = {series: []}; /** * Mapping between filtered series list and raw series list. @@ -2912,7 +2997,7 @@ return /******/ (function(modules) { // webpackBootstrap else if (TYPED_ARRAY[typeStr]) { result = source.constructor.from(source); } - else if (!BUILTIN_OBJECT[typeStr] && !isDom(source)) { + else if (!BUILTIN_OBJECT[typeStr] && !isPrimitive(source) && !isDom(source)) { result = {}; for (var key in source) { if (source.hasOwnProperty(key)) { @@ -2948,8 +3033,10 @@ return /******/ (function(modules) { // webpackBootstrap && !isArray(targetProp) && !isDom(sourceProp) && !isDom(targetProp) - && !isBuildInObject(sourceProp) - && !isBuildInObject(targetProp) + && !isBuiltInObject(sourceProp) + && !isBuiltInObject(targetProp) + && !isPrimitive(sourceProp) + && !isPrimitive(targetProp) ) { // 如果需要递归覆盖,就递归调用merge merge(targetProp, sourceProp, overwrite); @@ -3276,7 +3363,7 @@ return /******/ (function(modules) { // webpackBootstrap * @param {*} value * @return {boolean} */ - function isBuildInObject(value) { + function isBuiltInObject(value) { return !!BUILTIN_OBJECT[objToString.call(value)]; } @@ -3335,6 +3422,18 @@ return /******/ (function(modules) { // webpackBootstrap } } + var primitiveKey = '__ec_primitive__'; + /** + * Set an object as primitive to be ignored traversing children in clone or merge + */ + function setAsPrimitive(obj) { + obj[primitiveKey] = true; + } + + function isPrimitive(obj) { + return obj[primitiveKey]; + } + var util = { inherits: inherits, mixin: mixin, @@ -3359,11 +3458,12 @@ return /******/ (function(modules) { // webpackBootstrap isString: isString, isObject: isObject, isFunction: isFunction, - isBuildInObject: isBuildInObject, + isBuiltInObject: isBuiltInObject, isDom: isDom, eqNaN: eqNaN, retrieve: retrieve, assert: assert, + setAsPrimitive: setAsPrimitive, noop: function () {} }; module.exports = util; @@ -3468,7 +3568,12 @@ return /******/ (function(modules) { // webpackBootstrap return value; } - if (dimType === 'time' && !isFinite(value) && value != null && value !== '-') { + if (dimType === 'time' + // spead up when using timestamp + && typeof value !== 'number' + && value != null + && value !== '-' + ) { value = +nubmerUtil.parseDate(value); } @@ -3512,10 +3617,6 @@ return /******/ (function(modules) { // webpackBootstrap */ getDataParams: function (dataIndex, dataType) { var data = this.getData(dataType); - - var seriesIndex = this.seriesIndex; - var seriesName = this.name; - var rawValue = this.getRawValue(dataIndex, dataType); var rawDataIndex = data.getRawIndex(dataIndex); var name = data.getName(dataIndex, true); @@ -3525,8 +3626,9 @@ return /******/ (function(modules) { // webpackBootstrap componentType: this.mainType, componentSubType: this.subType, seriesType: this.mainType === 'series' ? this.subType : null, - seriesIndex: seriesIndex, - seriesName: seriesName, + seriesIndex: this.seriesIndex, + seriesId: this.id, + seriesName: this.name, name: name, dataIndex: rawDataIndex, data: itemOpt, @@ -3744,7 +3846,7 @@ return /******/ (function(modules) { // webpackBootstrap ? opt.name + '' : existCpt ? existCpt.name - : '\0-'; + : '\0-'; // name may be displayed on screen, so use '-'. if (existCpt) { keyInfo.id = existCpt.id; @@ -3859,6 +3961,30 @@ return /******/ (function(modules) { // webpackBootstrap } }; + /** + * Enable property storage to any host object. + * Notice: Serialization is not supported. + * + * For example: + * var get = modelUitl.makeGetter(); + * + * function some(hostObj) { + * get(hostObj)._someProperty = 1212; + * ... + * } + * + * @return {Function} + */ + modelUtil.makeGetter = (function () { + var index = 0; + return function () { + var key = '\0__ec_prop_getter_' + index++; + return function (hostObj) { + return hostObj[key] || (hostObj[key] = {}); + }; + }; + })(); + /** * @param {module:echarts/model/Global} ecModel * @param {string|Object} finder @@ -3866,7 +3992,7 @@ return /******/ (function(modules) { // webpackBootstrap * If Object, could contain some of these properties below: * { * seriesIndex, seriesId, seriesName, - * geoIndex, geoId, goeName, + * geoIndex, geoId, geoName, * bmapIndex, bmapId, bmapName, * xAxisIndex, xAxisId, xAxisName, * yAxisIndex, yAxisId, yAxisName, @@ -3880,8 +4006,11 @@ return /******/ (function(modules) { // webpackBootstrap * geoId: ['aa', 'cc'], * gridName: ['xx', 'rr'] * } + * xxxIndex can be set as 'all' (means all xxx) or 'none' (means not specify) + * If nothing or null/undefined specified, return nothing. * @param {Object} [opt] * @param {string} [opt.defaultMainType] + * @param {Array.} [opt.includeMainTypes] * @return {Object} result like: * { * seriesModels: [seriesModel1, seriesModel2], @@ -3920,14 +4049,22 @@ return /******/ (function(modules) { // webpackBootstrap var parsedKey = key.match(/^(\w+)(Index|Id|Name)$/) || []; var mainType = parsedKey[1]; - var queryType = parsedKey[2]; + var queryType = (parsedKey[2] || '').toLowerCase(); - if (!mainType || !queryType) { + if (!mainType + || !queryType + || value == null + || (queryType === 'index' && value === 'none') + || (opt && opt.includeMainTypes && zrUtil.indexOf(opt.includeMainTypes, mainType) < 0) + ) { return; } var queryParam = {mainType: mainType}; - queryParam[queryType.toLowerCase()] = value; + if (queryType !== 'index' || value !== 'all') { + queryParam[queryType] = value; + } + var models = ecModel.queryComponents(queryParam); result[mainType + 'Models'] = models; result[mainType + 'Model'] = models[0]; @@ -3943,6 +4080,7 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = modelUtil; + /***/ }, /* 6 */ /***/ function(module, exports, __webpack_require__) { @@ -4058,6 +4196,24 @@ return /******/ (function(modules) { // webpackBootstrap return tpl; }; + /** + * simple Template formatter + * + * @param {string} tpl + * @param {Object} param + * @param {boolean} [encode=false] + * @return {string} + */ + formatUtil.formatTplSimple = function (tpl, param, encode) { + zrUtil.each(param, function (value, key) { + tpl = tpl.replace( + '{' + key + '}', + encode ? encodeHTML(value) : value + ); + }); + return tpl; + }; + /** * @param {string} str @@ -4072,9 +4228,15 @@ return /******/ (function(modules) { // webpackBootstrap * ISO Date format * @param {string} tpl * @param {number} value + * @param {boolean} [isLocal=false] Default use UTC + * Why default UTC? In most case, time provided by user is + * understood in UTC. For example, new Date('2012-01-01') + * or a string '2012-01-01' or a timestamp. So it is + * recommended to format time in UTC. + * (see `echarts/util/number.js#parseDate`); * @inner */ - formatUtil.formatTime = function (tpl, value) { + formatUtil.formatTime = function (tpl, value, isLocal) { if (tpl === 'week' || tpl === 'month' || tpl === 'quarter' @@ -4085,12 +4247,13 @@ return /******/ (function(modules) { // webpackBootstrap } var date = numberUtil.parseDate(value); - var y = date.getFullYear(); - var M = date.getMonth() + 1; - var d = date.getDate(); - var h = date.getHours(); - var m = date.getMinutes(); - var s = date.getSeconds(); + var utc = isLocal ? '' : 'UTC'; + var y = date['get' + utc + 'FullYear'](); + var M = date['get' + utc + 'Month']() + 1; + var d = date['get' + utc + 'Date'](); + var h = date['get' + utc + 'Hours'](); + var m = date['get' + utc + 'Minutes'](); + var s = date['get' + utc + 'Seconds'](); tpl = tpl.replace('MM', s2d(M)) .toLowerCase() @@ -4122,6 +4285,7 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = formatUtil; + /***/ }, /* 7 */ /***/ function(module, exports) { @@ -4232,15 +4396,18 @@ return /******/ (function(modules) { // webpackBootstrap /** * Fix rounding error of float numbers * @param {number} x - * @return {number} + * @param {number} [precision] + * @param {boolean} [returnStr] + * @return {number|string} */ - number.round = function (x, precision) { + number.round = function (x, precision, returnStr) { if (precision == null) { precision = 10; } // Avoid range error precision = Math.min(Math.max(0, precision), 20); - return +(+x).toFixed(precision); + x = (+x).toFixed(precision); + return returnStr ? x : +x; }; number.asc = function (arr) { @@ -4318,8 +4485,22 @@ return /******/ (function(modules) { // webpackBootstrap return val > -RADIAN_EPSILON && val < RADIAN_EPSILON; }; + var TIME_REG = /^(?:(\d{4})(?:[-\/](\d{1,2})(?:[-\/](\d{1,2})(?:[T ](\d{1,2})(?::(\d\d)(?::(\d\d)(?:[.,](\d+))?)?)?(?:Z|([\+\-]\d\d):?\d\d)?)?)?)?)?$/; // jshint ignore:line + var TIMEZONE_OFFSET = (new Date()).getTimezoneOffset(); + /** - * @param {string|Date|number} value + * @param {string|Date|number} value These values can be accepted: + * + An instance of Date, represent a time in its own time zone. + * + Or string in a subset of ISO 8601, only including: + * + only year, month, date: '2012-03', '2012-03-01', '2012-03-01 05', '2012-03-01 05:06', + * + separated with T or space: '2012-03-01T12:22:33.123', '2012-03-01 12:22:33.123', + * + time zone: '2012-03-01T12:22:33Z', '2012-03-01T12:22:33+8000', '2012-03-01T12:22:33-05:00', + * all of which will be treated as they reperent a time in UTC + * if time zone is not specified. + * + Or other string format, including: + * '2012', '2012-3-1', '2012/3/1', '2012/03/01', + * '2009/6/12 2:00', '2009/6/12 2:05:08', '2009/6/12 2:05:08.123' + * + a timestamp, which represent a time in UTC. * @return {Date} date */ number.parseDate = function (value) { @@ -4327,13 +4508,32 @@ return /******/ (function(modules) { // webpackBootstrap return value; } else if (typeof value === 'string') { - // Treat as ISO format. See issue #3623 - var ret = new Date(value); - if (isNaN(+ret)) { - // FIXME new Date('1970-01-01') is UTC, new Date('1970/01/01') is local - ret = new Date(new Date(value.replace(/-/g, '/')) - new Date('1970/01/01')); - } - return ret; + // Different browsers parse date in different way, so we parse it manually. + // Some other issues: + // new Date('1970-01-01') is UTC, + // new Date('1970/01/01') and new Date('1970-1-01') is local. + // See issue #3623 + var match = TIME_REG.exec(value); + + if (!match) { + // return Invalid Date. + return new Date(NaN); + } + + // match[n] can only be string or undefined. + // But take care of '12' + 1 => '121'. + return new Date( + +match[1], + +(match[2] || 1) - 1, + +match[3] || 1, + +match[4] || 0, + +(match[5] || 0) - (match[8] || 0) * 60 - TIMEZONE_OFFSET, + +match[6] || 0, + +match[7] || 0 + ); + } + else if (value == null) { + return new Date(NaN); } return new Date(Math.round(value)); @@ -5634,6 +5834,7 @@ return /******/ (function(modules) { // webpackBootstrap }; /** + * Notice, parseClassType('') should returns {main: '', sub: ''} * @public */ var parseClassType = clazz.parseClassType = function (componentType) { @@ -5917,11 +6118,13 @@ return /******/ (function(modules) { // webpackBootstrap properties[i][1] = properties[i][0]; } } - return function (excludes) { + return function (excludes, includes) { var style = {}; for (var i = 0; i < properties.length; i++) { var propName = properties[i][1]; - if (excludes && zrUtil.indexOf(excludes, propName) >= 0) { + if ((excludes && zrUtil.indexOf(excludes, propName) >= 0) + || (includes && zrUtil.indexOf(includes, propName) < 0) + ) { continue; } var val = this.getShallow(propName); @@ -6029,8 +6232,8 @@ return /******/ (function(modules) { // webpackBootstrap ] ); module.exports = { - getItemStyle: function (excludes) { - var style = getItemStyle.call(this, excludes); + getItemStyle: function (excludes, includes) { + var style = getItemStyle.call(this, excludes, includes); var lineDash = this.getBorderLineDash(); lineDash && (style.lineDash = lineDash); return style; @@ -6441,10 +6644,21 @@ return /******/ (function(modules) { // webpackBootstrap var layout = {}; + /** + * @public + */ var LOCATION_PARAMS = layout.LOCATION_PARAMS = [ 'left', 'right', 'top', 'bottom', 'width', 'height' ]; + /** + * @public + */ + var HV_NAMES = layout.HV_NAMES = [ + ['width', 'left', 'right'], + ['height', 'top', 'bottom'] + ]; + function boxLayout(orient, group, gap, maxWidth, maxHeight) { var x = 0; var y = 0; @@ -6760,6 +6974,15 @@ return /******/ (function(modules) { // webpackBootstrap el.attr('position', boundingMode === 'raw' ? [dx, dy] : [elPos[0] + dx, elPos[1] + dy]); }; + /** + * @param {Object} option Contains some of the properties in HV_NAMES. + * @param {number} hvIdx 0: horizontal; 1: vertical. + */ + layout.sizeCalculable = function (option, hvIdx) { + return option[HV_NAMES[hvIdx][0]] != null + || (option[HV_NAMES[hvIdx][1]] != null && option[HV_NAMES[hvIdx][2]] != null); + }; + /** * Consider Case: * When defulat option has {left: 0, width: 100}, and we set {right: 0} @@ -6782,24 +7005,26 @@ return /******/ (function(modules) { // webpackBootstrap * @param {Object} targetOption * @param {Object} newOption * @param {Object|string} [opt] - * @param {boolean} [opt.ignoreSize=false] Some component must has width and height. + * @param {boolean|Array.} [opt.ignoreSize=false] Some component must has width and height. */ layout.mergeLayoutParam = function (targetOption, newOption, opt) { !zrUtil.isObject(opt) && (opt = {}); - var hNames = ['width', 'left', 'right']; // Order by priority. - var vNames = ['height', 'top', 'bottom']; // Order by priority. - var hResult = merge(hNames); - var vResult = merge(vNames); - copy(hNames, targetOption, hResult); - copy(vNames, targetOption, vResult); + var ignoreSize = opt.ignoreSize; + !zrUtil.isArray(ignoreSize) && (ignoreSize = [ignoreSize, ignoreSize]); + + var hResult = merge(HV_NAMES[0], 0); + var vResult = merge(HV_NAMES[1], 1); + + copy(HV_NAMES[0], targetOption, hResult); + copy(HV_NAMES[1], targetOption, vResult); - function merge(names) { + function merge(names, hvIdx) { var newParams = {}; var newValueCount = 0; var merged = {}; var mergedValueCount = 0; - var enoughParamNumber = opt.ignoreSize ? 1 : 2; + var enoughParamNumber = 2; each(names, function (name) { merged[name] = targetOption[name]; @@ -6812,6 +7037,13 @@ return /******/ (function(modules) { // webpackBootstrap hasValue(merged, name) && mergedValueCount++; }); + if (ignoreSize[hvIdx]) { + // Only one of left/height is premitted to exist. + hasValue(newOption, names[2]) && (merged[names[1]] = null); + hasValue(newOption, names[1]) && (merged[names[2]] = null); + return merged; + } + // Case: newOption: {width: ..., right: ...}, // or targetOption: {right: ...} and newOption: {width: ...}, // There is no conflict when merged only has params count @@ -6827,7 +7059,6 @@ return /******/ (function(modules) { // webpackBootstrap } else { // Chose another param from targetOption by priority. - // When 'ignoreSize', enoughParamNumber is 1 and those will not happen. for (var i = 0; i < names.length; i++) { var name = names[i]; if (!hasProp(newParams, name) && hasProp(targetOption, name)) { @@ -6878,6 +7109,7 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = layout; + /***/ }, /* 22 */ /***/ function(module, exports) { @@ -6939,7 +7171,7 @@ return /******/ (function(modules) { // webpackBootstrap // Default is source-over blendMode: null, - animation: true, + animation: 'auto', animationDuration: 1000, animationDurationUpdate: 300, animationEasing: 'exponentialOut', @@ -7008,14 +7240,18 @@ return /******/ (function(modules) { // webpackBootstrap var zrUtil = __webpack_require__(4); var echartsAPIList = [ - 'getDom', 'getZr', 'getWidth', 'getHeight', 'dispatchAction', 'isDisposed', - 'on', 'off', 'getDataURL', 'getConnectedDataURL', 'getModel', 'getOption' + 'getDom', 'getZr', 'getWidth', 'getHeight', 'getDevicePixelRatio', 'dispatchAction', 'isDisposed', + 'on', 'off', 'getDataURL', 'getConnectedDataURL', 'getModel', 'getOption', + 'getViewOfComponentModel', 'getViewOfSeriesModel' ]; - function ExtensionAPI(chartInstance) { + function ExtensionAPI(chartInstance, coordSysMgr) { zrUtil.each(echartsAPIList, function (name) { this[name] = zrUtil.bind(chartInstance[name], chartInstance); }, this); + + // Inject getCoordinateSystems to ecModel + this.getCoordinateSystems = zrUtil.bind(coordSysMgr.getCoordinateSystems, coordSysMgr); } module.exports = ExtensionAPI; @@ -7030,34 +7266,6 @@ return /******/ (function(modules) { // webpackBootstrap var zrUtil = __webpack_require__(4); - /** - * Interface of Coordinate System Class - * - * create: - * @param {module:echarts/model/Global} ecModel - * @param {module:echarts/ExtensionAPI} api - * @return {Object} coordinate system instance - * - * update: - * @param {module:echarts/model/Global} ecModel - * @param {module:echarts/ExtensionAPI} api - * - * convertToPixel: - * convertFromPixel: - * These two methods is also responsible for determine whether this - * coodinate system is applicable to the given `finder`. - * Each coordinate system will be tried, util one returns none - * null/undefined value. - * @param {module:echarts/model/Global} ecModel - * @param {Object} finder - * @param {Array|number} value - * @return {Array|number} convert result. - * - * containPoint: - * @param {Array.} point In pixel coordinate system. - * @return {boolean} - */ - var coordinateSystemCreators = {}; function CoordinateSystemManager() { @@ -7611,11 +7819,15 @@ return /******/ (function(modules) { // webpackBootstrap this.mergeDefaultAndTheme(option, ecModel); + var data = this.getInitialData(option, ecModel); + if (true) { + zrUtil.assert(data, 'getInitialData returned invalid data.'); + } /** * @type {module:echarts/data/List|module:echarts/data/Tree|module:echarts/data/Graph} * @private */ - set(this, 'dataBeforeProcessed', this.getInitialData(option, ecModel)); + set(this, 'dataBeforeProcessed', data); // If we reverse the order (make data firstly, and then make // dataBeforeProcessed by cloneShallow), cloneShallow will @@ -7852,9 +8064,9 @@ return /******/ (function(modules) { // webpackBootstrap * @param {Array.|string} dim * @param {Array.} value * @param {module:echarts/coord/single/SingleAxis} baseAxis - * @return {Array.} data indices. + * @return {Object} {dataIndices, nestestValue}. */ - getAxisTooltipDataIndex: null, + getAxisTooltipData: null, /** * See tooltip. @@ -9111,7 +9323,7 @@ return /******/ (function(modules) { // webpackBootstrap var isString = util.isString; var isFunction = util.isFunction; var isObject = util.isObject; - var log = __webpack_require__(40); + var log = __webpack_require__(41); /** * @alias modue:zrender/mixin/Animatable @@ -9888,6 +10100,24 @@ return /******/ (function(modules) { // webpackBootstrap return this; }, + pause: function () { + for (var i = 0; i < this._clipList.length; i++) { + this._clipList[i].pause(); + } + this._paused = true; + }, + + resume: function () { + for (var i = 0; i < this._clipList.length; i++) { + this._clipList[i].resume(); + } + this._paused = false; + }, + + isPaused: function () { + return !!this._paused; + }, + _doneCallback: function () { // Clear all tracks this._tracks = {}; @@ -10050,13 +10280,16 @@ return /******/ (function(modules) { // webpackBootstrap this.onframe = options.onframe; this.ondestroy = options.ondestroy; this.onrestart = options.onrestart; + + this._pausedTime = 0; + this._paused = false; } Clip.prototype = { constructor: Clip, - step: function (globalTime) { + step: function (globalTime, deltaTime) { // Set startTime on first step, or _startTime may has milleseconds different between clips // PENDING if (!this._initialized) { @@ -10064,7 +10297,12 @@ return /******/ (function(modules) { // webpackBootstrap this._initialized = true; } - var percent = (globalTime - this._startTime) / this._life; + if (this._paused) { + this._pausedTime += deltaTime; + return; + } + + var percent = (globalTime - this._startTime - this._pausedTime) / this._life; // 还没开始 if (percent < 0) { @@ -10100,17 +10338,26 @@ return /******/ (function(modules) { // webpackBootstrap }, restart: function (globalTime) { - var remainder = (globalTime - this._startTime) % this._life; + var remainder = (globalTime - this._startTime - this._pausedTime) % this._life; this._startTime = globalTime - remainder + this.gap; + this._pausedTime = 0; this._needsRemove = false; }, - fire: function(eventType, arg) { + fire: function (eventType, arg) { eventType = 'on' + eventType; if (this[eventType]) { this[eventType](this._target, arg); } + }, + + pause: function () { + this._paused = true; + }, + + resume: function () { + this._paused = false; } }; @@ -10471,13 +10718,15 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, /* 39 */ -/***/ function(module, exports) { +/***/ function(module, exports, __webpack_require__) { /** * @module zrender/tool/color */ + var LRU = __webpack_require__(40); + var kCSSColorTable = { 'transparent': [0,0,0,0], 'aliceblue': [240,248,255,1], 'antiquewhite': [250,235,215,1], 'aqua': [0,255,255,1], @@ -10607,15 +10856,40 @@ return /******/ (function(modules) { // webpackBootstrap return a + (b - a) * p; } + function setRgba(out, r, g, b, a) { + out[0] = r; out[1] = g; out[2] = b; out[3] = a; + return out; + } + function copyRgba(out, a) { + out[0] = a[0]; out[1] = a[1]; out[2] = a[2]; out[3] = a[3]; + return out; + } + var colorCache = new LRU(20); + var lastRemovedArr = null; + function putToCache(colorStr, rgbaArr) { + // Reuse removed array + if (lastRemovedArr) { + copyRgba(lastRemovedArr, rgbaArr); + } + lastRemovedArr = colorCache.put(colorStr, lastRemovedArr || (rgbaArr.slice())); + } /** * @param {string} colorStr + * @param {Array.} out * @return {Array.} * @memberOf module:zrender/util/color */ - function parse(colorStr) { + function parse(colorStr, rgbaArr) { if (!colorStr) { return; } + rgbaArr = rgbaArr || []; + + var cached = colorCache.get(colorStr); + if (cached) { + return copyRgba(rgbaArr, cached); + } + // colorStr may be not string colorStr = colorStr + ''; // Remove all whitespace, not compliant, but should just be more accepting. @@ -10623,7 +10897,9 @@ return /******/ (function(modules) { // webpackBootstrap // Color keywords (and transparent) lookup. if (str in kCSSColorTable) { - return kCSSColorTable[str].slice(); // dup. + copyRgba(rgbaArr, kCSSColorTable[str]); + putToCache(colorStr, rgbaArr); + return rgbaArr; } // #abc and #abc123 syntax. @@ -10631,26 +10907,32 @@ return /******/ (function(modules) { // webpackBootstrap if (str.length === 4) { var iv = parseInt(str.substr(1), 16); // TODO(deanm): Stricter parsing. if (!(iv >= 0 && iv <= 0xfff)) { + setRgba(rgbaArr, 0, 0, 0, 1); return; // Covers NaN. } - return [ + setRgba(rgbaArr, ((iv & 0xf00) >> 4) | ((iv & 0xf00) >> 8), (iv & 0xf0) | ((iv & 0xf0) >> 4), (iv & 0xf) | ((iv & 0xf) << 4), 1 - ]; + ); + putToCache(colorStr, rgbaArr); + return rgbaArr; } else if (str.length === 7) { var iv = parseInt(str.substr(1), 16); // TODO(deanm): Stricter parsing. if (!(iv >= 0 && iv <= 0xffffff)) { + setRgba(rgbaArr, 0, 0, 0, 1); return; // Covers NaN. } - return [ + setRgba(rgbaArr, (iv & 0xff0000) >> 16, (iv & 0xff00) >> 8, iv & 0xff, 1 - ]; + ); + putToCache(colorStr, rgbaArr); + return rgbaArr; } return; @@ -10663,44 +10945,56 @@ return /******/ (function(modules) { // webpackBootstrap switch (fname) { case 'rgba': if (params.length !== 4) { + setRgba(rgbaArr, 0, 0, 0, 1); return; } alpha = parseCssFloat(params.pop()); // jshint ignore:line // Fall through. case 'rgb': if (params.length !== 3) { + setRgba(rgbaArr, 0, 0, 0, 1); return; } - return [ + setRgba(rgbaArr, parseCssInt(params[0]), parseCssInt(params[1]), parseCssInt(params[2]), alpha - ]; + ); + putToCache(colorStr, rgbaArr); + return rgbaArr; case 'hsla': if (params.length !== 4) { + setRgba(rgbaArr, 0, 0, 0, 1); return; } params[3] = parseCssFloat(params[3]); - return hsla2rgba(params); + hsla2rgba(params, rgbaArr); + putToCache(colorStr, rgbaArr); + return rgbaArr; case 'hsl': if (params.length !== 3) { + setRgba(rgbaArr, 0, 0, 0, 1); return; } - return hsla2rgba(params); + hsla2rgba(params, rgbaArr); + putToCache(colorStr, rgbaArr); + return rgbaArr; default: return; } } + setRgba(rgbaArr, 0, 0, 0, 1); return; } /** * @param {Array.} hsla + * @param {Array.} rgba * @return {Array.} rgba */ - function hsla2rgba(hsla) { + function hsla2rgba(hsla, rgba) { var h = (((parseFloat(hsla[0]) % 360) + 360) % 360) / 360; // 0 .. 1 // NOTE(deanm): According to the CSS spec s/l should only be // percentages, but we don't bother and let float or percentage. @@ -10709,11 +11003,13 @@ return /******/ (function(modules) { // webpackBootstrap var m2 = l <= 0.5 ? l * (s + 1) : l + s - l * s; var m1 = l * 2 - m2; - var rgba = [ + rgba = rgba || []; + setRgba(rgba, clampCssByte(cssHueToRgb(m1, m2, h + 1 / 3) * 255), clampCssByte(cssHueToRgb(m1, m2, h) * 255), - clampCssByte(cssHueToRgb(m1, m2, h - 1 / 3) * 255) - ]; + clampCssByte(cssHueToRgb(m1, m2, h - 1 / 3) * 255), + 1 + ); if (hsla.length === 4) { rgba[3] = hsla[3]; @@ -10829,12 +11125,12 @@ return /******/ (function(modules) { // webpackBootstrap * @return {Array.} */ function fastMapToColor(normalizedValue, colors, out) { + out = out || [0, 0, 0, 0]; if (!(colors && colors.length) || !(normalizedValue >= 0 && normalizedValue <= 1) ) { - return; + return out; } - out = out || [0, 0, 0, 0]; var value = normalizedValue * (colors.length - 1); var leftIndex = Math.floor(value); var rightIndex = Math.ceil(value); @@ -10928,9 +11224,12 @@ return /******/ (function(modules) { // webpackBootstrap /** * @param {Array.} colors Color list. * @param {string} type 'rgba', 'hsva', ... - * @return {string} Result color. + * @return {string} Result color. (If input illegal, return undefined). */ function stringify(arrColor, type) { + if (!arrColor) { + return; + } var colorStr = arrColor[0] + ',' + arrColor[1] + ',' + arrColor[2]; if (type === 'rgba' || type === 'hsva' || type === 'hsla') { colorStr += ',' + arrColor[3]; @@ -10954,10 +11253,212 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, /* 40 */ +/***/ function(module, exports) { + + // Simple LRU cache use doubly linked list + // @module zrender/core/LRU + + + /** + * Simple double linked list. Compared with array, it has O(1) remove operation. + * @constructor + */ + var LinkedList = function () { + + /** + * @type {module:zrender/core/LRU~Entry} + */ + this.head = null; + + /** + * @type {module:zrender/core/LRU~Entry} + */ + this.tail = null; + + this._len = 0; + }; + + var linkedListProto = LinkedList.prototype; + /** + * Insert a new value at the tail + * @param {} val + * @return {module:zrender/core/LRU~Entry} + */ + linkedListProto.insert = function (val) { + var entry = new Entry(val); + this.insertEntry(entry); + return entry; + }; + + /** + * Insert an entry at the tail + * @param {module:zrender/core/LRU~Entry} entry + */ + linkedListProto.insertEntry = function (entry) { + if (!this.head) { + this.head = this.tail = entry; + } + else { + this.tail.next = entry; + entry.prev = this.tail; + entry.next = null; + this.tail = entry; + } + this._len++; + }; + + /** + * Remove entry. + * @param {module:zrender/core/LRU~Entry} entry + */ + linkedListProto.remove = function (entry) { + var prev = entry.prev; + var next = entry.next; + if (prev) { + prev.next = next; + } + else { + // Is head + this.head = next; + } + if (next) { + next.prev = prev; + } + else { + // Is tail + this.tail = prev; + } + entry.next = entry.prev = null; + this._len--; + }; + + /** + * @return {number} + */ + linkedListProto.len = function () { + return this._len; + }; + + /** + * Clear list + */ + linkedListProto.clear = function () { + this.head = this.tail = null; + this._len = 0; + }; + + /** + * @constructor + * @param {} val + */ + var Entry = function (val) { + /** + * @type {} + */ + this.value = val; + + /** + * @type {module:zrender/core/LRU~Entry} + */ + this.next; + + /** + * @type {module:zrender/core/LRU~Entry} + */ + this.prev; + }; + + /** + * LRU Cache + * @constructor + * @alias module:zrender/core/LRU + */ + var LRU = function (maxSize) { + + this._list = new LinkedList(); + + this._map = {}; + + this._maxSize = maxSize || 10; + + this._lastRemovedEntry = null; + }; + + var LRUProto = LRU.prototype; + + /** + * @param {string} key + * @param {} value + * @return {} Removed value + */ + LRUProto.put = function (key, value) { + var list = this._list; + var map = this._map; + var removed = null; + if (map[key] == null) { + var len = list.len(); + // Reuse last removed entry + var entry = this._lastRemovedEntry; + + if (len >= this._maxSize && len > 0) { + // Remove the least recently used + var leastUsedEntry = list.head; + list.remove(leastUsedEntry); + delete map[leastUsedEntry.key]; + + removed = leastUsedEntry.value; + this._lastRemovedEntry = leastUsedEntry; + } + + if (entry) { + entry.value = value; + } + else { + entry = new Entry(value); + } + entry.key = key; + list.insertEntry(entry); + map[key] = entry; + } + + return removed; + }; + + /** + * @param {string} key + * @return {} + */ + LRUProto.get = function (key) { + var entry = this._map[key]; + var list = this._list; + if (entry != null) { + // Put the latest used entry in the tail + if (entry !== list.tail) { + list.remove(entry); + list.insertEntry(entry); + } + + return entry.value; + } + }; + + /** + * Clear the cache + */ + LRUProto.clear = function () { + this._list.clear(); + this._map = {}; + }; + + module.exports = LRU; + + +/***/ }, +/* 41 */ /***/ function(module, exports, __webpack_require__) { - var config = __webpack_require__(41); + var config = __webpack_require__(42); /** * @exports zrender/tool/log @@ -10991,7 +11492,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 41 */ +/* 42 */ /***/ function(module, exports) { @@ -11023,7 +11524,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 42 */ +/* 43 */ /***/ function(module, exports, __webpack_require__) { @@ -11171,7 +11672,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 43 */ +/* 44 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -11179,9 +11680,9 @@ return /******/ (function(modules) { // webpackBootstrap var zrUtil = __webpack_require__(4); - var pathTool = __webpack_require__(44); + var pathTool = __webpack_require__(45); var round = Math.round; - var Path = __webpack_require__(45); + var Path = __webpack_require__(46); var colorTool = __webpack_require__(39); var matrix = __webpack_require__(11); var vector = __webpack_require__(10); @@ -11190,7 +11691,7 @@ return /******/ (function(modules) { // webpackBootstrap graphic.Group = __webpack_require__(30); - graphic.Image = __webpack_require__(61); + graphic.Image = __webpack_require__(62); graphic.Text = __webpack_require__(63); @@ -11524,7 +12025,8 @@ return /******/ (function(modules) { // webpackBootstrap } /** - * Set hover style of element + * Set hover style of element. + * This method can be called repeatly without side-effects. * @param {module:zrender/Element} el * @param {Object} [hoverStyle] * @param {Object} [opt] @@ -11757,14 +12259,14 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 44 */ +/* 45 */ /***/ function(module, exports, __webpack_require__) { - var Path = __webpack_require__(45); - var PathProxy = __webpack_require__(49); - var transformPath = __webpack_require__(60); + var Path = __webpack_require__(46); + var PathProxy = __webpack_require__(50); + var transformPath = __webpack_require__(61); var matrix = __webpack_require__(11); // command chars @@ -12165,7 +12667,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 45 */ +/* 46 */ /***/ function(module, exports, __webpack_require__) { /** @@ -12175,12 +12677,12 @@ return /******/ (function(modules) { // webpackBootstrap - var Displayable = __webpack_require__(46); + var Displayable = __webpack_require__(47); var zrUtil = __webpack_require__(4); - var PathProxy = __webpack_require__(49); - var pathContain = __webpack_require__(52); + var PathProxy = __webpack_require__(50); + var pathContain = __webpack_require__(53); - var Pattern = __webpack_require__(59); + var Pattern = __webpack_require__(60); var getCanvasPattern = Pattern.prototype.getCanvasPattern; var abs = Math.abs; @@ -12530,7 +13032,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 46 */ +/* 47 */ /***/ function(module, exports, __webpack_require__) { /** @@ -12543,10 +13045,10 @@ return /******/ (function(modules) { // webpackBootstrap var zrUtil = __webpack_require__(4); - var Style = __webpack_require__(47); + var Style = __webpack_require__(48); var Element = __webpack_require__(31); - var RectText = __webpack_require__(48); + var RectText = __webpack_require__(49); // var Stateful = require('./mixin/Stateful'); /** @@ -12804,7 +13306,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 47 */ +/* 48 */ /***/ function(module, exports) { /** @@ -13126,7 +13628,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 48 */ +/* 49 */ /***/ function(module, exports, __webpack_require__) { /** @@ -13268,8 +13770,9 @@ return /******/ (function(modules) { // webpackBootstrap } for (var i = 0; i < textLines.length; i++) { - textFill && ctx.fillText(textLines[i], x, y); + // Fill after stroke so the outline will not cover the main part. textStroke && ctx.strokeText(textLines[i], x, y); + textFill && ctx.fillText(textLines[i], x, y); y += textRect.lineHeight; } @@ -13281,7 +13784,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 49 */ +/* 50 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -13296,11 +13799,11 @@ return /******/ (function(modules) { // webpackBootstrap // TODO getTotalLength, getPointAtLength - var curve = __webpack_require__(50); + var curve = __webpack_require__(51); var vec2 = __webpack_require__(10); - var bbox = __webpack_require__(51); + var bbox = __webpack_require__(52); var BoundingRect = __webpack_require__(9); - var dpr = __webpack_require__(41).devicePixelRatio; + var dpr = __webpack_require__(42).devicePixelRatio; var CMD = { M: 1, @@ -14056,7 +14559,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 50 */ +/* 51 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -14602,7 +15105,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 51 */ +/* 52 */ /***/ function(module, exports, __webpack_require__) { /** @@ -14611,7 +15114,7 @@ return /******/ (function(modules) { // webpackBootstrap var vec2 = __webpack_require__(10); - var curve = __webpack_require__(50); + var curve = __webpack_require__(51); var bbox = {}; var mathMin = Math.min; @@ -14838,21 +15341,21 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 52 */ +/* 53 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; - var CMD = __webpack_require__(49).CMD; - var line = __webpack_require__(53); - var cubic = __webpack_require__(54); - var quadratic = __webpack_require__(55); - var arc = __webpack_require__(56); - var normalizeRadian = __webpack_require__(57).normalizeRadian; - var curve = __webpack_require__(50); + var CMD = __webpack_require__(50).CMD; + var line = __webpack_require__(54); + var cubic = __webpack_require__(55); + var quadratic = __webpack_require__(56); + var arc = __webpack_require__(57); + var normalizeRadian = __webpack_require__(58).normalizeRadian; + var curve = __webpack_require__(51); - var windingLine = __webpack_require__(58); + var windingLine = __webpack_require__(59); var containStroke = line.containStroke; @@ -15244,7 +15747,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 53 */ +/* 54 */ /***/ function(module, exports) { @@ -15292,12 +15795,12 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 54 */ +/* 55 */ /***/ function(module, exports, __webpack_require__) { - var curve = __webpack_require__(50); + var curve = __webpack_require__(51); module.exports = { /** @@ -15339,12 +15842,12 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 55 */ +/* 56 */ /***/ function(module, exports, __webpack_require__) { - var curve = __webpack_require__(50); + var curve = __webpack_require__(51); module.exports = { /** @@ -15384,12 +15887,12 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 56 */ +/* 57 */ /***/ function(module, exports, __webpack_require__) { - var normalizeRadian = __webpack_require__(57).normalizeRadian; + var normalizeRadian = __webpack_require__(58).normalizeRadian; var PI2 = Math.PI * 2; module.exports = { @@ -15450,7 +15953,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 57 */ +/* 58 */ /***/ function(module, exports) { @@ -15468,7 +15971,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 58 */ +/* 59 */ /***/ function(module, exports) { @@ -15495,7 +15998,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 59 */ +/* 60 */ /***/ function(module, exports) { @@ -15518,12 +16021,12 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 60 */ +/* 61 */ /***/ function(module, exports, __webpack_require__) { - var CMD = __webpack_require__(49).CMD; + var CMD = __webpack_require__(50).CMD; var vec2 = __webpack_require__(10); var v2ApplyTransform = vec2.applyTransform; @@ -15619,7 +16122,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 61 */ +/* 62 */ /***/ function(module, exports, __webpack_require__) { /** @@ -15629,11 +16132,11 @@ return /******/ (function(modules) { // webpackBootstrap - var Displayable = __webpack_require__(46); + var Displayable = __webpack_require__(47); var BoundingRect = __webpack_require__(9); var zrUtil = __webpack_require__(4); - var LRU = __webpack_require__(62); + var LRU = __webpack_require__(40); var globalImageCache = new LRU(50); /** * @alias zrender/graphic/Image @@ -15708,19 +16211,30 @@ return /******/ (function(modules) { // webpackBootstrap // } // Else is canvas - var width = style.width || image.width; - var height = style.height || image.height; var x = style.x || 0; var y = style.y || 0; // 图片加载失败 if (!image.width || !image.height) { return; } + var width = style.width; + var height = style.height; + var aspect = image.width / image.height; + if (width == null && height != null) { + // Keep image/height ratio + width = height * aspect; + } + else if (height == null && width != null) { + height = width / aspect; + } + else if (width == null && height == null) { + width = image.width; + height = image.height; + } // 设置transform this.setTransform(ctx); - if (style.sWidth && style.sHeight) { var sx = style.sx || 0; var sy = style.sy || 0; @@ -15745,14 +16259,6 @@ return /******/ (function(modules) { // webpackBootstrap ctx.drawImage(image, x, y, width, height); } - // 如果没设置宽和高的话自动根据图片宽高设置 - if (style.width == null) { - style.width = width; - } - if (style.height == null) { - style.height = height; - } - this.restoreTransform(ctx); // Draw rect text @@ -15779,181 +16285,6 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = ZImage; -/***/ }, -/* 62 */ -/***/ function(module, exports) { - - // Simple LRU cache use doubly linked list - // @module zrender/core/LRU - - - /** - * Simple double linked list. Compared with array, it has O(1) remove operation. - * @constructor - */ - var LinkedList = function() { - - /** - * @type {module:zrender/core/LRU~Entry} - */ - this.head = null; - - /** - * @type {module:zrender/core/LRU~Entry} - */ - this.tail = null; - - this._len = 0; - }; - - var linkedListProto = LinkedList.prototype; - /** - * Insert a new value at the tail - * @param {} val - * @return {module:zrender/core/LRU~Entry} - */ - linkedListProto.insert = function(val) { - var entry = new Entry(val); - this.insertEntry(entry); - return entry; - }; - - /** - * Insert an entry at the tail - * @param {module:zrender/core/LRU~Entry} entry - */ - linkedListProto.insertEntry = function(entry) { - if (!this.head) { - this.head = this.tail = entry; - } - else { - this.tail.next = entry; - entry.prev = this.tail; - this.tail = entry; - } - this._len++; - }; - - /** - * Remove entry. - * @param {module:zrender/core/LRU~Entry} entry - */ - linkedListProto.remove = function(entry) { - var prev = entry.prev; - var next = entry.next; - if (prev) { - prev.next = next; - } - else { - // Is head - this.head = next; - } - if (next) { - next.prev = prev; - } - else { - // Is tail - this.tail = prev; - } - entry.next = entry.prev = null; - this._len--; - }; - - /** - * @return {number} - */ - linkedListProto.len = function() { - return this._len; - }; - - /** - * @constructor - * @param {} val - */ - var Entry = function(val) { - /** - * @type {} - */ - this.value = val; - - /** - * @type {module:zrender/core/LRU~Entry} - */ - this.next; - - /** - * @type {module:zrender/core/LRU~Entry} - */ - this.prev; - }; - - /** - * LRU Cache - * @constructor - * @alias module:zrender/core/LRU - */ - var LRU = function(maxSize) { - - this._list = new LinkedList(); - - this._map = {}; - - this._maxSize = maxSize || 10; - }; - - var LRUProto = LRU.prototype; - - /** - * @param {string} key - * @param {} value - */ - LRUProto.put = function(key, value) { - var list = this._list; - var map = this._map; - if (map[key] == null) { - var len = list.len(); - if (len >= this._maxSize && len > 0) { - // Remove the least recently used - var leastUsedEntry = list.head; - list.remove(leastUsedEntry); - delete map[leastUsedEntry.key]; - } - - var entry = list.insert(value); - entry.key = key; - map[key] = entry; - } - }; - - /** - * @param {string} key - * @return {} - */ - LRUProto.get = function(key) { - var entry = this._map[key]; - var list = this._list; - if (entry != null) { - // Put the latest used entry in the tail - if (entry !== list.tail) { - list.remove(entry); - list.insertEntry(entry); - } - - return entry.value; - } - }; - - /** - * Clear the cache - */ - LRUProto.clear = function() { - this._list.clear(); - this._map = {}; - }; - - module.exports = LRU; - - /***/ }, /* 63 */ /***/ function(module, exports, __webpack_require__) { @@ -15969,7 +16300,7 @@ return /******/ (function(modules) { // webpackBootstrap - var Displayable = __webpack_require__(46); + var Displayable = __webpack_require__(47); var zrUtil = __webpack_require__(4); var textContain = __webpack_require__(8); @@ -16037,6 +16368,7 @@ return /******/ (function(modules) { // webpackBootstrap if (ctx.textAlign !== textAlign) { ctx.textAlign = 'left'; } + // FIXME in text contain default is top ctx.textBaseline = textBaseline || 'alphabetic'; // Use canvas default alphabetic baseline if (ctx.textBaseline !== textBaseline) { @@ -16047,8 +16379,9 @@ return /******/ (function(modules) { // webpackBootstrap var textLines = text.split('\n'); for (var i = 0; i < textLines.length; i++) { - style.hasFill() && ctx.fillText(textLines[i], x, y); + // Fill after stroke so the outline will not cover the main part. style.hasStroke() && ctx.strokeText(textLines[i], x, y); + style.hasFill() && ctx.fillText(textLines[i], x, y); y += lineHeight; } @@ -16057,8 +16390,8 @@ return /******/ (function(modules) { // webpackBootstrap }, getBoundingRect: function () { + var style = this.style; if (!this._rect) { - var style = this.style; var textVerticalAlign = style.textVerticalAlign; var rect = textContain.getBoundingRect( style.text + '', style.textFont || style.font, style.textAlign, @@ -16074,8 +16407,16 @@ return /******/ (function(modules) { // webpackBootstrap } rect.x += style.x || 0; rect.y += style.y || 0; + if (style.hasStroke()) { + var w = style.lineWidth; + rect.x -= w / 2; + rect.y -= w / 2; + rect.width += w; + rect.height += w; + } this._rect = rect; } + return this._rect; } }; @@ -16097,7 +16438,7 @@ return /******/ (function(modules) { // webpackBootstrap - module.exports = __webpack_require__(45).extend({ + module.exports = __webpack_require__(46).extend({ type: 'circle', @@ -16134,7 +16475,7 @@ return /******/ (function(modules) { // webpackBootstrap var env = __webpack_require__(2); - var Path = __webpack_require__(45); + var Path = __webpack_require__(46); var shadowTemp = [ ['shadowBlur', 0], @@ -16251,7 +16592,7 @@ return /******/ (function(modules) { // webpackBootstrap */ - module.exports = __webpack_require__(45).extend({ + module.exports = __webpack_require__(46).extend({ type: 'ring', @@ -16287,7 +16628,7 @@ return /******/ (function(modules) { // webpackBootstrap var polyHelper = __webpack_require__(68); - module.exports = __webpack_require__(45).extend({ + module.exports = __webpack_require__(46).extend({ type: 'polygon', @@ -16546,7 +16887,7 @@ return /******/ (function(modules) { // webpackBootstrap var polyHelper = __webpack_require__(68); - module.exports = __webpack_require__(45).extend({ + module.exports = __webpack_require__(46).extend({ type: 'polyline', @@ -16582,7 +16923,7 @@ return /******/ (function(modules) { // webpackBootstrap var roundRectHelper = __webpack_require__(73); - module.exports = __webpack_require__(45).extend({ + module.exports = __webpack_require__(46).extend({ type: 'rect', @@ -16722,7 +17063,7 @@ return /******/ (function(modules) { // webpackBootstrap * @module zrender/graphic/shape/Line */ - module.exports = __webpack_require__(45).extend({ + module.exports = __webpack_require__(46).extend({ type: 'line', @@ -16789,7 +17130,7 @@ return /******/ (function(modules) { // webpackBootstrap */ - var curveTool = __webpack_require__(50); + var curveTool = __webpack_require__(51); var vec2 = __webpack_require__(10); var quadraticSubdivide = curveTool.quadraticSubdivide; var cubicSubdivide = curveTool.cubicSubdivide; @@ -16816,7 +17157,7 @@ return /******/ (function(modules) { // webpackBootstrap ]; } } - module.exports = __webpack_require__(45).extend({ + module.exports = __webpack_require__(46).extend({ type: 'bezier-curve', @@ -16929,7 +17270,7 @@ return /******/ (function(modules) { // webpackBootstrap */ - module.exports = __webpack_require__(45).extend({ + module.exports = __webpack_require__(46).extend({ type: 'arc', @@ -16980,7 +17321,7 @@ return /******/ (function(modules) { // webpackBootstrap // CompoundPath to improve performance - var Path = __webpack_require__(45); + var Path = __webpack_require__(46); module.exports = Path.extend({ type: 'compound', @@ -17341,7 +17682,7 @@ return /******/ (function(modules) { // webpackBootstrap /** * @type {string} */ - zrender.version = '3.3.0'; + zrender.version = '3.4.0'; /** * Initializing a zrender instance @@ -17428,6 +17769,7 @@ return /******/ (function(modules) { // webpackBootstrap var storage = new Storage(); var rendererType = opts.renderer; + // TODO WebGL if (useVML) { if (!painterCtors.vml) { throw new Error('You need to require \'zrender/vml/vml\' to support IE8'); @@ -17658,9 +18000,8 @@ return /******/ (function(modules) { // webpackBootstrap * @param {number} width * @param {number} height */ - pathToImage: function(e, width, height) { - var id = guid(); - return this.painter.pathToImage(id, e, width, height); + pathToImage: function(e, dpr) { + return this.painter.pathToImage(e, dpr); }, /** @@ -19217,7 +19558,7 @@ return /******/ (function(modules) { // webpackBootstrap var deferredClips = []; for (var i = 0; i < len; i++) { var clip = clips[i]; - var e = clip.step(time); + var e = clip.step(time, delta); // Throw out the events need to be called after // stage.update, like destroy if (e) { @@ -20040,9 +20381,9 @@ return /******/ (function(modules) { // webpackBootstrap */ - var config = __webpack_require__(41); + var config = __webpack_require__(42); var util = __webpack_require__(4); - var log = __webpack_require__(40); + var log = __webpack_require__(41); var BoundingRect = __webpack_require__(9); var timsort = __webpack_require__(86); @@ -20065,7 +20406,7 @@ return /******/ (function(modules) { // webpackBootstrap return false; } - if (layer.isBuildin) { + if (layer.__builtin__) { return true; } @@ -20219,6 +20560,12 @@ return /******/ (function(modules) { // webpackBootstrap root.appendChild(domRoot); } else { + if (opts.width != null) { + root.width = opts.width; + } + if (opts.height != null) { + root.height = opts.height; + } // Use canvas width and height directly var width = root.width; var height = root.height; @@ -20237,8 +20584,6 @@ return /******/ (function(modules) { // webpackBootstrap this._domRoot = root; } - this.pathToImage = this._createPathToImage(); - // Layers for progressive rendering this._progressiveLayers = []; @@ -20285,7 +20630,7 @@ return /******/ (function(modules) { // webpackBootstrap for (var i = 0; i < zlevelList.length; i++) { var z = zlevelList[i]; var layer = this._layers[z]; - if (!layer.isBuildin && layer.refresh) { + if (!layer.__builtin__ && layer.refresh) { layer.refresh(); } } @@ -20428,11 +20773,11 @@ return /******/ (function(modules) { // webpackBootstrap this._clearProgressive(); - this.eachBuildinLayer(preProcessLayer); + this.eachBuiltinLayer(preProcessLayer); this._doPaintList(list, paintAll); - this.eachBuildinLayer(postProcessLayer); + this.eachBuiltinLayer(postProcessLayer); }, _doPaintList: function (list, paintAll) { @@ -20488,7 +20833,7 @@ return /******/ (function(modules) { // webpackBootstrap currentZLevel = elZLevel; currentLayer = this.getLayer(currentZLevel); - if (!currentLayer.isBuildin) { + if (!currentLayer.__builtin__) { log( 'ZLevel ' + currentZLevel + ' has been used by unkown layer ' + currentLayer.id @@ -20633,7 +20978,7 @@ return /******/ (function(modules) { // webpackBootstrap if (!layer) { // Create a new layer layer = new Layer('zr_' + zlevel, this, this.dpr); - layer.isBuildin = true; + layer.__builtin__ = true; if (this._layerConfig[zlevel]) { util.merge(layer, this._layerConfig[zlevel], true); @@ -20681,28 +21026,33 @@ return /******/ (function(modules) { // webpackBootstrap } zlevelList.splice(i + 1, 0, zlevel); - if (prevLayer) { - var prevDom = prevLayer.dom; - if (prevDom.nextSibling) { - domRoot.insertBefore( - layer.dom, - prevDom.nextSibling - ); - } - else { - domRoot.appendChild(layer.dom); - } - } - else { - if (domRoot.firstChild) { - domRoot.insertBefore(layer.dom, domRoot.firstChild); + layersMap[zlevel] = layer; + + // Vitual layer will not directly show on the screen. + // (It can be a WebGL layer and assigned to a ZImage element) + // But it still under management of zrender. + if (!layer.virtual) { + if (prevLayer) { + var prevDom = prevLayer.dom; + if (prevDom.nextSibling) { + domRoot.insertBefore( + layer.dom, + prevDom.nextSibling + ); + } + else { + domRoot.appendChild(layer.dom); + } } else { - domRoot.appendChild(layer.dom); + if (domRoot.firstChild) { + domRoot.insertBefore(layer.dom, domRoot.firstChild); + } + else { + domRoot.appendChild(layer.dom); + } } } - - layersMap[zlevel] = layer; }, // Iterate each layer @@ -20717,7 +21067,7 @@ return /******/ (function(modules) { // webpackBootstrap }, // Iterate each buildin layer - eachBuildinLayer: function (cb, context) { + eachBuiltinLayer: function (cb, context) { var zlevelList = this._zlevelList; var layer; var z; @@ -20725,7 +21075,7 @@ return /******/ (function(modules) { // webpackBootstrap for (i = 0; i < zlevelList.length; i++) { z = zlevelList[i]; layer = this._layers[z]; - if (layer.isBuildin) { + if (layer.__builtin__) { cb.call(context, layer, z); } } @@ -20740,7 +21090,7 @@ return /******/ (function(modules) { // webpackBootstrap for (i = 0; i < zlevelList.length; i++) { z = zlevelList[i]; layer = this._layers[z]; - if (! layer.isBuildin) { + if (!layer.__builtin__) { cb.call(context, layer, z); } } @@ -20762,7 +21112,7 @@ return /******/ (function(modules) { // webpackBootstrap var elCountsLastFrame = {}; var progressiveElCountsLastFrame = {}; - this.eachBuildinLayer(function (layer, z) { + this.eachBuiltinLayer(function (layer, z) { elCountsLastFrame[z] = layer.elCount; layer.elCount = 0; layer.__dirty = false; @@ -20836,7 +21186,7 @@ return /******/ (function(modules) { // webpackBootstrap } // 层中的元素数量有发生变化 - this.eachBuildinLayer(function (layer, z) { + this.eachBuiltinLayer(function (layer, z) { if (elCountsLastFrame[z] !== layer.elCount) { layer.__dirty = true; } @@ -20857,7 +21207,7 @@ return /******/ (function(modules) { // webpackBootstrap * 清除hover层外所有内容 */ clear: function () { - this.eachBuildinLayer(this._clearLayer); + this.eachBuiltinLayer(this._clearLayer); return this; }, @@ -21037,30 +21387,47 @@ return /******/ (function(modules) { // webpackBootstrap ) | 0; }, - _pathToImage: function (id, path, width, height, dpr) { + pathToImage: function (path, dpr) { + dpr = dpr || this.dpr; + var canvas = document.createElement('canvas'); var ctx = canvas.getContext('2d'); + var rect = path.getBoundingRect(); + var style = path.style; + var shadowBlurSize = style.shadowBlur; + var shadowOffsetX = style.shadowOffsetX; + var shadowOffsetY = style.shadowOffsetY; + var lineWidth = style.hasStroke() ? style.lineWidth : 0; + + var leftMargin = Math.max(lineWidth / 2, -shadowOffsetX + shadowBlurSize); + var rightMargin = Math.max(lineWidth / 2, shadowOffsetX + shadowBlurSize); + var topMargin = Math.max(lineWidth / 2, -shadowOffsetY + shadowBlurSize); + var bottomMargin = Math.max(lineWidth / 2, shadowOffsetY + shadowBlurSize); + var width = rect.width + leftMargin + rightMargin; + var height = rect.height + topMargin + bottomMargin; canvas.width = width * dpr; canvas.height = height * dpr; - ctx.clearRect(0, 0, width * dpr, height * dpr); + ctx.scale(dpr, dpr); + ctx.clearRect(0, 0, width, height); + ctx.dpr = dpr; var pathTransform = { position: path.position, rotation: path.rotation, scale: path.scale }; - path.position = [0, 0, 0]; + path.position = [leftMargin - rect.x, topMargin - rect.y]; path.rotation = 0; path.scale = [1, 1]; + path.updateTransform(); if (path) { path.brush(ctx); } - var ImageShape = __webpack_require__(61); + var ImageShape = __webpack_require__(62); var imgShape = new ImageShape({ - id: id, style: { x: 0, y: 0, @@ -21081,16 +21448,6 @@ return /******/ (function(modules) { // webpackBootstrap } return imgShape; - }, - - _createPathToImage: function () { - var me = this; - - return function (id, e, width, height) { - return me._pathToImage( - id, e, width, height, me.dpr - ); - }; } }; @@ -21109,9 +21466,9 @@ return /******/ (function(modules) { // webpackBootstrap var util = __webpack_require__(4); - var config = __webpack_require__(41); - var Style = __webpack_require__(47); - var Pattern = __webpack_require__(59); + var config = __webpack_require__(42); + var Style = __webpack_require__(48); + var Pattern = __webpack_require__(60); function returnFalse() { return false; @@ -21570,7 +21927,7 @@ return /******/ (function(modules) { // webpackBootstrap - var graphic = __webpack_require__(43); + var graphic = __webpack_require__(44); var zrUtil = __webpack_require__(4); var PI = Math.PI; /** @@ -21718,8 +22075,9 @@ return /******/ (function(modules) { // webpackBootstrap * @constructor * @alias module:echarts/data/List * - * @param {Array.} dimensions - * Dimensions should be concrete names like x, y, z, lng, lat, angle, radius + * @param {Array.} dimensions + * For example, ['someDimName', {name: 'someDimName', type: 'someDimType'}, ...]. + * Dimensions should be concrete names like x, y, z, lng, lat, angle, radius * @param {module:echarts/model/Model} hostModel */ var List = function (dimensions, hostModel) { @@ -22219,37 +22577,39 @@ return /******/ (function(modules) { // webpackBootstrap * @param {number} value * @param {boolean} stack If given value is after stacked * @param {number} [maxDistance=Infinity] - * @return {number} + * @return {Array.} Considere multiple points has the same value. */ listProto.indexOfNearest = function (dim, value, stack, maxDistance) { var storage = this._storage; var dimData = storage[dim]; + var nearestIndices = []; + + if (!dimData) { + return nearestIndices; + } if (maxDistance == null) { maxDistance = Infinity; } - var nearestIdx = -1; - if (dimData) { - var minDist = Number.MAX_VALUE; - for (var i = 0, len = this.count(); i < len; i++) { - var diff = value - this.get(dim, i, stack); - var dist = Math.abs(diff); - if ( - diff <= maxDistance - && (dist < minDist - // For the case of two data are same on xAxis, which has sequence data. - // Show the nearest index - // https://github.com/ecomfe/echarts/issues/2869 - || (dist === minDist && diff > 0) - ) - ) { + var minDist = Number.MAX_VALUE; + var minDiff = -1; + for (var i = 0, len = this.count(); i < len; i++) { + var diff = value - this.get(dim, i, stack); + var dist = Math.abs(diff); + if (diff <= maxDistance && dist <= minDist) { + // For the case of two data are same on xAxis, which has sequence data. + // Show the nearest index + // https://github.com/ecomfe/echarts/issues/2869 + if (dist < minDist || (diff >= 0 && minDiff < 0)) { minDist = dist; - nearestIdx = i; + minDiff = diff; + nearestIndices.length = 0; } + nearestIndices.push(i); } } - return nearestIdx; + return nearestIndices; }; /** @@ -22951,118 +23311,320 @@ return /******/ (function(modules) { // webpackBootstrap + var numberUtil = __webpack_require__(7); + var linearMap = numberUtil.linearMap; var zrUtil = __webpack_require__(4); - var echarts = __webpack_require__(1); - var PRIORITY = echarts.PRIORITY; - __webpack_require__(101); - __webpack_require__(104); + function fixExtentWithBands(extent, nTick) { + var size = extent[1] - extent[0]; + var len = nTick; + var margin = size / len / 2; + extent[0] += margin; + extent[1] -= margin; + } - echarts.registerVisual(zrUtil.curry( - __webpack_require__(110), 'line', 'circle', 'line' - )); - echarts.registerLayout(zrUtil.curry( - __webpack_require__(111), 'line' - )); + var normalizedExtent = [0, 1]; + /** + * @name module:echarts/coord/CartesianAxis + * @constructor + */ + var Axis = function (dim, scale, extent) { - // Down sample after filter - echarts.registerProcessor(PRIORITY.PROCESSOR.STATISTIC, zrUtil.curry( - __webpack_require__(112), 'line' - )); + /** + * Axis dimension. Such as 'x', 'y', 'z', 'angle', 'radius' + * @type {string} + */ + this.dim = dim; - // In case developer forget to include grid component - __webpack_require__(113); + /** + * Axis scale + * @type {module:echarts/coord/scale/*} + */ + this.scale = scale; + /** + * @type {Array.} + * @private + */ + this._extent = extent || [0, 0]; -/***/ }, -/* 101 */ -/***/ function(module, exports, __webpack_require__) { + /** + * @type {boolean} + */ + this.inverse = false; - 'use strict'; + /** + * Usually true when axis has a ordinal scale + * @type {boolean} + */ + this.onBand = false; + }; + Axis.prototype = { - var createListFromArray = __webpack_require__(102); - var SeriesModel = __webpack_require__(28); + constructor: Axis, - module.exports = SeriesModel.extend({ + /** + * If axis extent contain given coord + * @param {number} coord + * @return {boolean} + */ + contain: function (coord) { + var extent = this._extent; + var min = Math.min(extent[0], extent[1]); + var max = Math.max(extent[0], extent[1]); + return coord >= min && coord <= max; + }, - type: 'series.line', + /** + * If axis extent contain given data + * @param {number} data + * @return {boolean} + */ + containData: function (data) { + return this.contain(this.dataToCoord(data)); + }, - dependencies: ['grid', 'polar'], + /** + * Get coord extent. + * @return {Array.} + */ + getExtent: function () { + var ret = this._extent.slice(); + return ret; + }, - getInitialData: function (option, ecModel) { - if (true) { - var coordSys = option.coordinateSystem; - if (coordSys !== 'polar' && coordSys !== 'cartesian2d') { - throw new Error('Line not support coordinateSystem besides cartesian and polar'); - } + /** + * Get precision used for formatting + * @param {Array.} [dataExtent] + * @return {number} + */ + getPixelPrecision: function (dataExtent) { + return numberUtil.getPixelPrecision( + dataExtent || this.scale.getExtent(), + this._extent + ); + }, + + /** + * Set coord extent + * @param {number} start + * @param {number} end + */ + setExtent: function (start, end) { + var extent = this._extent; + extent[0] = start; + extent[1] = end; + }, + + /** + * Convert data to coord. Data is the rank if it has a ordinal scale + * @param {number} data + * @param {boolean} clamp + * @return {number} + */ + dataToCoord: function (data, clamp) { + var extent = this._extent; + var scale = this.scale; + data = scale.normalize(data); + + if (this.onBand && scale.type === 'ordinal') { + extent = extent.slice(); + fixExtentWithBands(extent, scale.count()); } - return createListFromArray(option.data, this, ecModel); + + return linearMap(data, normalizedExtent, extent, clamp); }, - defaultOption: { - zlevel: 0, // 一级层叠 - z: 2, // 二级层叠 - coordinateSystem: 'cartesian2d', - legendHoverLink: true, + /** + * Convert coord to data. Data is the rank if it has a ordinal scale + * @param {number} coord + * @param {boolean} clamp + * @return {number} + */ + coordToData: function (coord, clamp) { + var extent = this._extent; + var scale = this.scale; - hoverAnimation: true, - // stack: null - // xAxisIndex: 0, - // yAxisIndex: 0, + if (this.onBand && scale.type === 'ordinal') { + extent = extent.slice(); + fixExtentWithBands(extent, scale.count()); + } - // polarIndex: 0, + var t = linearMap(coord, extent, normalizedExtent, clamp); - // If clip the overflow value - clipOverflow: true, + return this.scale.scale(t); + }, - label: { - normal: { - position: 'top' + /** + * Convert pixel point to data in axis + * @param {Array.} point + * @param {boolean} clamp + * @return {number} data + */ + pointToData: function (point, clamp) { + // Should be implemented in derived class if necessary. + }, + + /** + * @return {Array.} + */ + getTicksCoords: function (alignWithLabel) { + if (this.onBand && !alignWithLabel) { + var bands = this.getBands(); + var coords = []; + for (var i = 0; i < bands.length; i++) { + coords.push(bands[i][0]); } - }, - // itemStyle: { - // normal: {}, - // emphasis: {} - // }, - lineStyle: { - normal: { - width: 2, - type: 'solid' + if (bands[i - 1]) { + coords.push(bands[i - 1][1]); } - }, - // areaStyle: {}, - // false, 'start', 'end', 'middle' - step: false, + return coords; + } + else { + return zrUtil.map(this.scale.getTicks(), this.dataToCoord, this); + } + }, - // Disabled if step is true - smooth: false, - smoothMonotone: null, - // 拐点图形类型 - symbol: 'emptyCircle', - // 拐点图形大小 - symbolSize: 4, - // 拐点图形旋转控制 - symbolRotate: null, + /** + * Coords of labels are on the ticks or on the middle of bands + * @return {Array.} + */ + getLabelsCoords: function () { + return zrUtil.map(this.scale.getTicks(), this.dataToCoord, this); + }, - // 是否显示 symbol, 只有在 tooltip hover 的时候显示 - showSymbol: true, - // 标志图形默认只有主轴显示(随主轴标签间隔隐藏策略) - showAllSymbol: false, + /** + * Get bands. + * + * If axis has labels [1, 2, 3, 4]. Bands on the axis are + * |---1---|---2---|---3---|---4---|. + * + * @return {Array} + */ + // FIXME Situation when labels is on ticks + getBands: function () { + var extent = this.getExtent(); + var bands = []; + var len = this.scale.count(); + var start = extent[0]; + var end = extent[1]; + var span = end - start; - // 是否连接断点 - connectNulls: false, + for (var i = 0; i < len; i++) { + bands.push([ + span * i / len + start, + span * (i + 1) / len + start + ]); + } + return bands; + }, - // 数据过滤,'average', 'max', 'min', 'sum' - sampling: 'none', + /** + * Get width of band + * @return {number} + */ + getBandWidth: function () { + var axisExtent = this._extent; + var dataExtent = this.scale.getExtent(); - animationEasing: 'linear', + var len = dataExtent[1] - dataExtent[0] + (this.onBand ? 1 : 0); + // Fix #2728, avoid NaN when only one data. + len === 0 && (len = 1); - // Disable progressive - progressive: 0, - hoverLayerThreshold: Infinity + var size = Math.abs(axisExtent[1] - axisExtent[0]); + + return Math.abs(size) / len; } - }); + + }; + + module.exports = Axis; + + +/***/ }, +/* 101 */ +/***/ function(module, exports, __webpack_require__) { + + + + var createListFromArray = __webpack_require__(102); + var symbolUtil = __webpack_require__(104); + var axisHelper = __webpack_require__(105); + var axisModelCommonMixin = __webpack_require__(111); + var Model = __webpack_require__(12); + var util = __webpack_require__(4); + + module.exports = { + /** + * Create a muti dimension List structure from seriesModel. + * @param {module:echarts/model/Model} seriesModel + * @return {module:echarts/data/List} list + */ + createList: function (seriesModel) { + var data = seriesModel.get('data'); + return createListFromArray(data, seriesModel, seriesModel.ecModel); + }, + + /** + * Complete the dimensions array guessed from the data structure. + * @param {Array.} dimensions Necessary dimensions, like ['x', 'y'] + * @param {Array} data Data list. [[1, 2, 3], [2, 3, 4]] + * @param {Object} [opt] + * @param {Array.} [opt.defaultNames] Default names to fill not necessary dimensions, like ['value'] + * @param {string} [opt.extraPrefix] Prefix of name when filling the left dimensions. + * @param {number} [opt.dimCount] If not specified, guess by the first data item. + * @return {Array.} + */ + completeDimensions: __webpack_require__(103), + + /** + * Create a symbol element with given symbol configuration: shape, x, y, width, height, color + * @see http://echarts.baidu.com/option.html#series-scatter.symbol + * @param {string} symbolDesc + * @param {number} x + * @param {number} y + * @param {number} w + * @param {number} h + * @param {string} color + */ + createSymbol: symbolUtil.createSymbol, + + /** + * Create scale + * @param {Array.} dataExtent + * @param {Object|module:echarts/Model} option + */ + createScale: function (dataExtent, option) { + var axisModel = option; + if (!(option instanceof Model)) { + axisModel = new Model(option); + util.mixin(axisModel, axisModelCommonMixin); + } + + var scale = axisHelper.createScaleByModel(axisModel); + scale.setExtent(dataExtent[0], dataExtent[1]); + + axisHelper.niceScaleExtent(scale, axisModel); + return scale; + }, + + /** + * Mixin common methods to axis model, + * + * Inlcude methods + * `getFormattedLabels() => Array.` + * `getCategories() => Array.` + * `getMin(origin: boolean) => number` + * `getMax(origin: boolean) => number` + * `getNeedCrossZero() => boolean` + * `setRange(start: number, end: number)` + * `resetRange()` + */ + mixinAxisModelCommonMethods: function (Model) { + util.mixin(Model, axisModelCommonMixin); + } + }; /***/ }, @@ -23114,9 +23676,14 @@ return /******/ (function(modules) { // webpackBootstrap var dimensions = axesInfo && axesInfo.dimensions; if (!dimensions) { // Get dimensions from registered coordinate system - dimensions = (registeredCoordSys && registeredCoordSys.dimensions) || ['x', 'y']; - dimensions = completeDimensions(dimensions, data, dimensions.concat(['value'])); + dimensions = (registeredCoordSys && ( + registeredCoordSys.getDimensionsInfo + ? registeredCoordSys.getDimensionsInfo() + : registeredCoordSys.dimensions.slice() + )) || ['x', 'y']; + dimensions = completeDimensions(dimensions, data, {defaultNames: dimensions.concat(['value'])}); } + var categoryIndex = axesInfo ? axesInfo.categoryIndex : -1; var list = new List(dimensions, seriesModel); @@ -23233,7 +23800,7 @@ return /******/ (function(modules) { // webpackBootstrap var isXAxisCateogry = xAxisType === 'category'; var isYAxisCategory = yAxisType === 'category'; - completeDimensions(dimensions, data, ['x', 'y', 'z']); + completeDimensions(dimensions, data, {defaultNames: ['x', 'y', 'z']}); var categoryAxesModels = {}; if (isXAxisCateogry) { @@ -23323,7 +23890,7 @@ return /******/ (function(modules) { // webpackBootstrap var isAngleAxisCateogry = angleAxisType === 'category'; var isRadiusAxisCateogry = radiusAxisType === 'category'; - completeDimensions(dimensions, data, ['radius', 'angle', 'value']); + completeDimensions(dimensions, data, {defaultNames: ['radius', 'angle', 'value']}); var categoryAxesModels = {}; if (isRadiusAxisCateogry) { @@ -23346,7 +23913,7 @@ return /******/ (function(modules) { // webpackBootstrap dimensions: completeDimensions([ {name: 'lng'}, {name: 'lat'} - ], data, ['lng', 'lat', 'value']) + ], data, {defaultNames: ['lng', 'lat', 'value']}) }; } }; @@ -23401,23 +23968,30 @@ return /******/ (function(modules) { // webpackBootstrap /** * Complete the dimensions array guessed from the data structure. - * @param {Array.} dimensions Necessary dimensions, like ['x', 'y'] - * @param {Array} data Data list. [[1, 2, 3], [2, 3, 4]] - * @param {Array.} [defaultNames] Default names to fill not necessary dimensions, like ['value'] - * @param {string} [extraPrefix] Prefix of name when filling the left dimensions. + * @param {Array.} dimensions Necessary dimensions, like ['x', 'y'] + * @param {Array} data Data list. [[1, 2, 3], [2, 3, 4]] + * @param {Object} [opt] + * @param {Array.} [opt.defaultNames] Default names to fill not necessary dimensions, like ['value'] + * @param {string} [opt.extraPrefix] Prefix of name when filling the left dimensions. + * @param {number} [opt.dimCount] If not specified, guess by the first data item. * @return {Array.} */ - function completeDimensions(dimensions, data, defaultNames, extraPrefix) { + function completeDimensions(dimensions, data, opt) { if (!data) { return dimensions; } - var value0 = retrieveValue(data[0]); - var dimSize = zrUtil.isArray(value0) && value0.length || 1; + opt = opt || {}; + + var dimCount = opt.dimCount; + if (dimCount == null) { + var value0 = retrieveValue(data[0]); + dimCount = zrUtil.isArray(value0) && value0.length || 1; + } - defaultNames = defaultNames || []; - extraPrefix = extraPrefix || 'extra'; - for (var i = 0; i < dimSize; i++) { + var defaultNames = opt.defaultNames || []; + var extraPrefix = opt.extraPrefix || 'extra'; + for (var i = 0; i < dimCount; i++) { if (!dimensions[i]) { var name = defaultNames[i] || (extraPrefix + (i - defaultNames.length)); dimensions[i] = guessOrdinal(data, i) @@ -23463,5453 +24037,5068 @@ return /******/ (function(modules) { // webpackBootstrap /***/ function(module, exports, __webpack_require__) { 'use strict'; - // FIXME step not support polar + // Symbol factory - var zrUtil = __webpack_require__(4); - var SymbolDraw = __webpack_require__(105); - var Symbol = __webpack_require__(106); - var lineAnimationDiff = __webpack_require__(108); - var graphic = __webpack_require__(43); - var modelUtil = __webpack_require__(5); - var polyHelper = __webpack_require__(109); - var ChartView = __webpack_require__(42); + var graphic = __webpack_require__(44); + var BoundingRect = __webpack_require__(9); - function isPointsSame(points1, points2) { - if (points1.length !== points2.length) { - return; + /** + * Triangle shape + * @inner + */ + var Triangle = graphic.extendShape({ + type: 'triangle', + shape: { + cx: 0, + cy: 0, + width: 0, + height: 0 + }, + buildPath: function (path, shape) { + var cx = shape.cx; + var cy = shape.cy; + var width = shape.width / 2; + var height = shape.height / 2; + path.moveTo(cx, cy - height); + path.lineTo(cx + width, cy + height); + path.lineTo(cx - width, cy + height); + path.closePath(); } - for (var i = 0; i < points1.length; i++) { - var p1 = points1[i]; - var p2 = points2[i]; - if (p1[0] !== p2[0] || p1[1] !== p2[1]) { - return; - } + }); + /** + * Diamond shape + * @inner + */ + var Diamond = graphic.extendShape({ + type: 'diamond', + shape: { + cx: 0, + cy: 0, + width: 0, + height: 0 + }, + buildPath: function (path, shape) { + var cx = shape.cx; + var cy = shape.cy; + var width = shape.width / 2; + var height = shape.height / 2; + path.moveTo(cx, cy - height); + path.lineTo(cx + width, cy); + path.lineTo(cx, cy + height); + path.lineTo(cx - width, cy); + path.closePath(); } - return true; - } + }); - function getSmooth(smooth) { - return typeof (smooth) === 'number' ? smooth : (smooth ? 0.3 : 0); - } + /** + * Pin shape + * @inner + */ + var Pin = graphic.extendShape({ + type: 'pin', + shape: { + // x, y on the cusp + x: 0, + y: 0, + width: 0, + height: 0 + }, - function getAxisExtentWithGap(axis) { - var extent = axis.getGlobalExtent(); - if (axis.onBand) { - // Remove extra 1px to avoid line miter in clipped edge - var halfBandWidth = axis.getBandWidth() / 2 - 1; - var dir = extent[1] > extent[0] ? 1 : -1; - extent[0] += dir * halfBandWidth; - extent[1] -= dir * halfBandWidth; + buildPath: function (path, shape) { + var x = shape.x; + var y = shape.y; + var w = shape.width / 5 * 3; + // Height must be larger than width + var h = Math.max(w, shape.height); + var r = w / 2; + + // Dist on y with tangent point and circle center + var dy = r * r / (h - r); + var cy = y - h + r + dy; + var angle = Math.asin(dy / r); + // Dist on x with tangent point and circle center + var dx = Math.cos(angle) * r; + + var tanX = Math.sin(angle); + var tanY = Math.cos(angle); + + path.arc( + x, cy, r, + Math.PI - angle, + Math.PI * 2 + angle + ); + + var cpLen = r * 0.6; + var cpLen2 = r * 0.7; + path.bezierCurveTo( + x + dx - tanX * cpLen, cy + dy + tanY * cpLen, + x, y - cpLen2, + x, y + ); + path.bezierCurveTo( + x, y - cpLen2, + x - dx + tanX * cpLen, cy + dy + tanY * cpLen, + x - dx, cy + dy + ); + path.closePath(); } - return extent; - } + }); - function sign(val) { - return val >= 0 ? 1 : -1; - } /** - * @param {module:echarts/coord/cartesian/Cartesian2D|module:echarts/coord/polar/Polar} coordSys - * @param {module:echarts/data/List} data - * @param {Array.>} points - * @private + * Arrow shape + * @inner */ - function getStackedOnPoints(coordSys, data) { - var baseAxis = coordSys.getBaseAxis(); - var valueAxis = coordSys.getOtherAxis(baseAxis); - var valueStart = baseAxis.onZero - ? 0 : valueAxis.scale.getExtent()[0]; + var Arrow = graphic.extendShape({ - var valueDim = valueAxis.dim; + type: 'arrow', - var baseDataOffset = valueDim === 'x' || valueDim === 'radius' ? 1 : 0; + shape: { + x: 0, + y: 0, + width: 0, + height: 0 + }, - return data.mapArray([valueDim], function (val, idx) { - var stackedOnSameSign; - var stackedOn = data.stackedOn; - // Find first stacked value with same sign - while (stackedOn && - sign(stackedOn.get(valueDim, idx)) === sign(val) - ) { - stackedOnSameSign = stackedOn; - break; - } - var stackedData = []; - stackedData[baseDataOffset] = data.get(baseAxis.dim, idx); - stackedData[1 - baseDataOffset] = stackedOnSameSign - ? stackedOnSameSign.get(valueDim, idx, true) : valueStart; + buildPath: function (ctx, shape) { + var height = shape.height; + var width = shape.width; + var x = shape.x; + var y = shape.y; + var dx = width / 3 * 2; + ctx.moveTo(x, y); + ctx.lineTo(x + dx, y + height); + ctx.lineTo(x, y + height / 4 * 3); + ctx.lineTo(x - dx, y + height); + ctx.lineTo(x, y); + ctx.closePath(); + } + }); - return coordSys.dataToPoint(stackedData); - }, true); - } + /** + * Map of path contructors + * @type {Object.} + */ + var symbolCtors = { + line: graphic.Line, - function createGridClipShape(cartesian, hasAnimation, seriesModel) { - var xExtent = getAxisExtentWithGap(cartesian.getAxis('x')); - var yExtent = getAxisExtentWithGap(cartesian.getAxis('y')); - var isHorizontal = cartesian.getBaseAxis().isHorizontal(); + rect: graphic.Rect, - var x = Math.min(xExtent[0], xExtent[1]); - var y = Math.min(yExtent[0], yExtent[1]); - var width = Math.max(xExtent[0], xExtent[1]) - x; - var height = Math.max(yExtent[0], yExtent[1]) - y; - var lineWidth = seriesModel.get('lineStyle.normal.width') || 2; - // Expand clip shape to avoid clipping when line value exceeds axis - var expandSize = seriesModel.get('clipOverflow') ? lineWidth / 2 : Math.max(width, height); - if (isHorizontal) { - y -= expandSize; - height += expandSize * 2; - } - else { - x -= expandSize; - width += expandSize * 2; - } + roundRect: graphic.Rect, - var clipPath = new graphic.Rect({ - shape: { - x: x, - y: y, - width: width, - height: height - } - }); + square: graphic.Rect, - if (hasAnimation) { - clipPath.shape[isHorizontal ? 'width' : 'height'] = 0; - graphic.initProps(clipPath, { - shape: { - width: width, - height: height - } - }, seriesModel); - } + circle: graphic.Circle, - return clipPath; - } + diamond: Diamond, - function createPolarClipShape(polar, hasAnimation, seriesModel) { - var angleAxis = polar.getAngleAxis(); - var radiusAxis = polar.getRadiusAxis(); + pin: Pin, - var radiusExtent = radiusAxis.getExtent(); - var angleExtent = angleAxis.getExtent(); + arrow: Arrow, - var RADIAN = Math.PI / 180; + triangle: Triangle + }; - var clipPath = new graphic.Sector({ - shape: { - cx: polar.cx, - cy: polar.cy, - r0: radiusExtent[0], - r: radiusExtent[1], - startAngle: -angleExtent[0] * RADIAN, - endAngle: -angleExtent[1] * RADIAN, - clockwise: angleAxis.inverse - } - }); + var symbolShapeMakers = { - if (hasAnimation) { - clipPath.shape.endAngle = -angleExtent[0] * RADIAN; - graphic.initProps(clipPath, { - shape: { - endAngle: -angleExtent[1] * RADIAN - } - }, seriesModel); + line: function (x, y, w, h, shape) { + // FIXME + shape.x1 = x; + shape.y1 = y + h / 2; + shape.x2 = x + w; + shape.y2 = y + h / 2; + }, + + rect: function (x, y, w, h, shape) { + shape.x = x; + shape.y = y; + shape.width = w; + shape.height = h; + }, + + roundRect: function (x, y, w, h, shape) { + shape.x = x; + shape.y = y; + shape.width = w; + shape.height = h; + shape.r = Math.min(w, h) / 4; + }, + + square: function (x, y, w, h, shape) { + var size = Math.min(w, h); + shape.x = x; + shape.y = y; + shape.width = size; + shape.height = size; + }, + + circle: function (x, y, w, h, shape) { + // Put circle in the center of square + shape.cx = x + w / 2; + shape.cy = y + h / 2; + shape.r = Math.min(w, h) / 2; + }, + + diamond: function (x, y, w, h, shape) { + shape.cx = x + w / 2; + shape.cy = y + h / 2; + shape.width = w; + shape.height = h; + }, + + pin: function (x, y, w, h, shape) { + shape.x = x + w / 2; + shape.y = y + h / 2; + shape.width = w; + shape.height = h; + }, + + arrow: function (x, y, w, h, shape) { + shape.x = x + w / 2; + shape.y = y + h / 2; + shape.width = w; + shape.height = h; + }, + + triangle: function (x, y, w, h, shape) { + shape.cx = x + w / 2; + shape.cy = y + h / 2; + shape.width = w; + shape.height = h; } + }; - return clipPath; + var symbolBuildProxies = {}; + for (var name in symbolCtors) { + if (symbolCtors.hasOwnProperty(name)) { + symbolBuildProxies[name] = new symbolCtors[name](); + } } - function createClipShape(coordSys, hasAnimation, seriesModel) { - return coordSys.type === 'polar' - ? createPolarClipShape(coordSys, hasAnimation, seriesModel) - : createGridClipShape(coordSys, hasAnimation, seriesModel); - } + var Symbol = graphic.extendShape({ - function turnPointsIntoStep(points, coordSys, stepTurnAt) { - var baseAxis = coordSys.getBaseAxis(); - var baseIndex = baseAxis.dim === 'x' || baseAxis.dim === 'radius' ? 0 : 1; + type: 'symbol', - var stepPoints = []; - for (var i = 0; i < points.length - 1; i++) { - var nextPt = points[i + 1]; - var pt = points[i]; - stepPoints.push(pt); + shape: { + symbolType: '', + x: 0, + y: 0, + width: 0, + height: 0 + }, - var stepPt = []; - switch (stepTurnAt) { - case 'end': - stepPt[baseIndex] = nextPt[baseIndex]; - stepPt[1 - baseIndex] = pt[1 - baseIndex]; - // default is start - stepPoints.push(stepPt); - break; - case 'middle': - // default is start - var middle = (pt[baseIndex] + nextPt[baseIndex]) / 2; - var stepPt2 = []; - stepPt[baseIndex] = stepPt2[baseIndex] = middle; - stepPt[1 - baseIndex] = pt[1 - baseIndex]; - stepPt2[1 - baseIndex] = nextPt[1 - baseIndex]; - stepPoints.push(stepPt); - stepPoints.push(stepPt2); - break; - default: - stepPt[baseIndex] = pt[baseIndex]; - stepPt[1 - baseIndex] = nextPt[1 - baseIndex]; - // default is start - stepPoints.push(stepPt); + beforeBrush: function () { + var style = this.style; + var shape = this.shape; + // FIXME + if (shape.symbolType === 'pin' && style.textPosition === 'inside') { + style.textPosition = ['50%', '40%']; + style.textAlign = 'center'; + style.textVerticalAlign = 'middle'; } - } - // Last points - points[i] && stepPoints.push(points[i]); - return stepPoints; - } + }, - function getVisualGradient(data, coordSys) { - var visualMetaList = data.getVisual('visualMeta'); - if (!visualMetaList || !visualMetaList.length || !data.count()) { - // When data.count() is 0, gradient range can not be calculated. - return; + buildPath: function (ctx, shape, inBundle) { + var symbolType = shape.symbolType; + var proxySymbol = symbolBuildProxies[symbolType]; + if (shape.symbolType !== 'none') { + if (!proxySymbol) { + // Default rect + symbolType = 'rect'; + proxySymbol = symbolBuildProxies[symbolType]; + } + symbolShapeMakers[symbolType]( + shape.x, shape.y, shape.width, shape.height, proxySymbol.shape + ); + proxySymbol.buildPath(ctx, proxySymbol.shape, inBundle); + } } + }); - var visualMeta; - for (var i = visualMetaList.length - 1; i >= 0; i--) { - // Can only be x or y - if (visualMetaList[i].dimension < 2) { - visualMeta = visualMetaList[i]; - break; + // Provide setColor helper method to avoid determine if set the fill or stroke outside + var symbolPathSetColor = function (color) { + if (this.type !== 'image') { + var symbolStyle = this.style; + var symbolShape = this.shape; + if (symbolShape && symbolShape.symbolType === 'line') { + symbolStyle.stroke = color; } - } - if (!visualMeta || coordSys.type !== 'cartesian2d') { - if (true) { - console.warn('Visual map on line style only support x or y dimension.'); + else if (this.__isEmptyBrush) { + symbolStyle.stroke = color; + symbolStyle.fill = '#fff'; } - return; + else { + // FIXME 判断图形默认是填充还是描边,使用 onlyStroke ? + symbolStyle.fill && (symbolStyle.fill = color); + symbolStyle.stroke && (symbolStyle.stroke = color); + } + this.dirty(false); } + }; - // If the area to be rendered is bigger than area defined by LinearGradient, - // the canvas spec prescribes that the color of the first stop and the last - // stop should be used. But if two stops are added at offset 0, in effect - // browsers use the color of the second stop to render area outside - // LinearGradient. So we can only infinitesimally extend area defined in - // LinearGradient to render `outerColors`. + var symbolUtil = { + /** + * Create a symbol element with given symbol configuration: shape, x, y, width, height, color + * @param {string} symbolType + * @param {number} x + * @param {number} y + * @param {number} w + * @param {number} h + * @param {string} color + */ + createSymbol: function (symbolType, x, y, w, h, color) { + // TODO Support image object, DynamicImage. - var dimension = visualMeta.dimension; - var dimName = data.dimensions[dimension]; - var axis = coordSys.getAxis(dimName); + var isEmpty = symbolType.indexOf('empty') === 0; + if (isEmpty) { + symbolType = symbolType.substr(5, 1).toLowerCase() + symbolType.substr(6); + } + var symbolPath; - // dataToCoor mapping may not be linear, but must be monotonic. - var colorStops = zrUtil.map(visualMeta.stops, function (stop) { - return { - coord: axis.toGlobalCoord(axis.dataToCoord(stop.value)), - color: stop.color - }; - }); - var stopLen = colorStops.length; - var outerColors = visualMeta.outerColors.slice(); + if (symbolType.indexOf('image://') === 0) { + symbolPath = new graphic.Image({ + style: { + image: symbolType.slice(8), + x: x, + y: y, + width: w, + height: h + } + }); + } + else if (symbolType.indexOf('path://') === 0) { + symbolPath = graphic.makePath(symbolType.slice(7), {}, new BoundingRect(x, y, w, h)); + } + else { + symbolPath = new Symbol({ + shape: { + symbolType: symbolType, + x: x, + y: y, + width: w, + height: h + } + }); + } - if (stopLen && colorStops[0].coord > colorStops[stopLen - 1].coord) { - colorStops.reverse(); - outerColors.reverse(); - } + symbolPath.__isEmptyBrush = isEmpty; - var tinyExtent = 10; // Arbitrary value: 10px - var minCoord = colorStops[0].coord - tinyExtent; - var maxCoord = colorStops[stopLen - 1].coord + tinyExtent; - var coordSpan = maxCoord - minCoord; + symbolPath.setColor = symbolPathSetColor; - if (coordSpan < 1e-3) { - return 'transparent'; + symbolPath.setColor(color); + + return symbolPath; } + }; - zrUtil.each(colorStops, function (stop) { - stop.offset = (stop.coord - minCoord) / coordSpan; - }); - colorStops.push({ - offset: stopLen ? colorStops[stopLen - 1].offset : 0.5, - color: outerColors[1] || 'transparent' - }); - colorStops.unshift({ // notice colorStops.length have been changed. - offset: stopLen ? colorStops[0].offset : 0.5, - color: outerColors[0] || 'transparent' - }); + module.exports = symbolUtil; - // zrUtil.each(colorStops, function (colorStop) { - // // Make sure each offset has rounded px to avoid not sharp edge - // colorStop.offset = (Math.round(colorStop.offset * (end - start) + start) - start) / (end - start); - // }); - var gradient = new graphic.LinearGradient(0, 0, 0, 0, colorStops, true); - gradient[dimName] = minCoord; - gradient[dimName + '2'] = maxCoord; +/***/ }, +/* 105 */ +/***/ function(module, exports, __webpack_require__) { - return gradient; - } + - module.exports = ChartView.extend({ + var OrdinalScale = __webpack_require__(106); + var IntervalScale = __webpack_require__(108); + __webpack_require__(109); + __webpack_require__(110); + var Scale = __webpack_require__(107); - type: 'line', + var numberUtil = __webpack_require__(7); + var zrUtil = __webpack_require__(4); + var textContain = __webpack_require__(8); + var axisHelper = {}; - init: function () { - var lineGroup = new graphic.Group(); + /** + * Get axis scale extent before niced. + * Item of returned array can only be number (including Infinity and NaN). + */ + axisHelper.getScaleExtent = function (scale, model) { + var scaleType = scale.type; - var symbolDraw = new SymbolDraw(); - this.group.add(symbolDraw.group); + var min = model.getMin(); + var max = model.getMax(); + var fixMin = min != null; + var fixMax = max != null; + var originalExtent = scale.getExtent(); - this._symbolDraw = symbolDraw; - this._lineGroup = lineGroup; - }, + var axisDataLen; + var boundaryGap; + var span; + if (scaleType === 'ordinal') { + axisDataLen = (model.get('data') || []).length; + } + else { + boundaryGap = model.get('boundaryGap'); + if (!zrUtil.isArray(boundaryGap)) { + boundaryGap = [boundaryGap || 0, boundaryGap || 0]; + } + boundaryGap[0] = numberUtil.parsePercent(boundaryGap[0], 1); + boundaryGap[1] = numberUtil.parsePercent(boundaryGap[1], 1); + span = originalExtent[1] - originalExtent[0]; + } - render: function (seriesModel, ecModel, api) { - var coordSys = seriesModel.coordinateSystem; - var group = this.group; - var data = seriesModel.getData(); - var lineStyleModel = seriesModel.getModel('lineStyle.normal'); - var areaStyleModel = seriesModel.getModel('areaStyle.normal'); + if (min == null) { + min = scaleType === 'ordinal' + ? (axisDataLen ? 0 : NaN) + : originalExtent[0] - boundaryGap[0] * span; + } + if (max == null) { + max = scaleType === 'ordinal' + ? (axisDataLen ? axisDataLen - 1 : NaN) + : originalExtent[1] + boundaryGap[1] * span; + } - var points = data.mapArray(data.getItemLayout, true); + if (min === 'dataMin') { + min = originalExtent[0]; + } + if (max === 'dataMax') { + max = originalExtent[1]; + } - var isCoordSysPolar = coordSys.type === 'polar'; - var prevCoordSys = this._coordSys; + (min == null || !isFinite(min)) && (min = NaN); + (max == null || !isFinite(max)) && (max = NaN); - var symbolDraw = this._symbolDraw; - var polyline = this._polyline; - var polygon = this._polygon; + scale.setBlank(zrUtil.eqNaN(min) || zrUtil.eqNaN(max)); - var lineGroup = this._lineGroup; + // Evaluate if axis needs cross zero + if (model.getNeedCrossZero()) { + // Axis is over zero and min is not set + if (min > 0 && max > 0 && !fixMin) { + min = 0; + } + // Axis is under zero and max is not set + if (min < 0 && max < 0 && !fixMax) { + max = 0; + } + } - var hasAnimation = seriesModel.get('animation'); + return [min, max]; + }; - var isAreaChart = !areaStyleModel.isEmpty(); - var stackedOnPoints = getStackedOnPoints(coordSys, data); + axisHelper.niceScaleExtent = function (scale, model) { + var extent = axisHelper.getScaleExtent(scale, model); + var fixMin = model.getMin() != null; + var fixMax = model.getMax() != null; + var splitNumber = model.get('splitNumber'); - var showSymbol = seriesModel.get('showSymbol'); + if (scale.type === 'log') { + scale.base = model.get('logBase'); + } - var isSymbolIgnore = showSymbol && !isCoordSysPolar && !seriesModel.get('showAllSymbol') - && this._getSymbolIgnoreFunc(data, coordSys); + scale.setExtent(extent[0], extent[1]); + scale.niceExtent(splitNumber, fixMin, fixMax); - // Remove temporary symbols - var oldData = this._data; - oldData && oldData.eachItemGraphicEl(function (el, idx) { - if (el.__temp) { - group.remove(el); - oldData.setItemGraphicEl(idx, null); - } - }); + // Use minInterval to constraint the calculated interval. + // If calculated interval is less than minInterval. increase the interval quantity until + // it is larger than minInterval. + // For example: + // minInterval is 1, calculated interval is 0.2, so increase it to be 1. In this way we can get + // an integer axis. + var minInterval = model.get('minInterval'); + if (isFinite(minInterval) && !fixMin && !fixMax && scale.type === 'interval') { + var interval = scale.getInterval(); + var intervalScale = Math.max(Math.abs(interval), minInterval) / interval; + // while (interval < minInterval) { + // var quantity = numberUtil.quantity(interval); + // interval = quantity * 10; + // scaleQuantity *= 10; + // } + extent = scale.getExtent(); + var origin = (extent[1] + extent[0]) / 2; + scale.setExtent( + intervalScale * (extent[0] - origin) + origin, + intervalScale * (extent[1] - origin) + origin + ); + scale.niceExtent(splitNumber); + } - // Remove previous created symbols if showSymbol changed to false - if (!showSymbol) { - symbolDraw.remove(); - } + // If some one specified the min, max. And the default calculated interval + // is not good enough. He can specify the interval. It is often appeared + // in angle axis with angle 0 - 360. Interval calculated in interval scale is hard + // to be 60. + // FIXME + var interval = model.get('interval'); + if (interval != null) { + scale.setInterval && scale.setInterval(interval); + } + }; - group.add(lineGroup); + /** + * @param {module:echarts/model/Model} model + * @param {string} [axisType] Default retrieve from model.type + * @return {module:echarts/scale/*} + */ + axisHelper.createScaleByModel = function(model, axisType) { + axisType = axisType || model.get('type'); + if (axisType) { + switch (axisType) { + // Buildin scale + case 'category': + return new OrdinalScale( + model.getCategories(), [Infinity, -Infinity] + ); + case 'value': + return new IntervalScale(); + // Extended scale, like time and log + default: + return (Scale.getClass(axisType) || IntervalScale).create(model); + } + } + }; - // FIXME step not support polar - var step = !isCoordSysPolar && seriesModel.get('step'); - // Initialization animation or coordinate system changed - if ( - !(polyline && prevCoordSys.type === coordSys.type && step === this._step) - ) { - showSymbol && symbolDraw.updateData(data, isSymbolIgnore); + /** + * Check if the axis corss 0 + */ + axisHelper.ifAxisCrossZero = function (axis) { + var dataExtent = axis.scale.getExtent(); + var min = dataExtent[0]; + var max = dataExtent[1]; + return !((min > 0 && max > 0) || (min < 0 && max < 0)); + }; - if (step) { - // TODO If stacked series is not step - points = turnPointsIntoStep(points, coordSys, step); - stackedOnPoints = turnPointsIntoStep(stackedOnPoints, coordSys, step); - } + /** + * @param {Array.} tickCoords In axis self coordinate. + * @param {Array.} labels + * @param {string} font + * @param {boolean} isAxisHorizontal + * @return {number} + */ + axisHelper.getAxisLabelInterval = function (tickCoords, labels, font, isAxisHorizontal) { + // FIXME + // 不同角的axis和label,不只是horizontal和vertical. - polyline = this._newPolyline(points, coordSys, hasAnimation); - if (isAreaChart) { - polygon = this._newPolygon( - points, stackedOnPoints, - coordSys, hasAnimation - ); - } - lineGroup.setClipPath(createClipShape(coordSys, true, seriesModel)); + var textSpaceTakenRect; + var autoLabelInterval = 0; + var accumulatedLabelInterval = 0; + + var step = 1; + if (labels.length > 40) { + // Simple optimization for large amount of labels + step = Math.floor(labels.length / 40); + } + + for (var i = 0; i < tickCoords.length; i += step) { + var tickCoord = tickCoords[i]; + var rect = textContain.getBoundingRect( + labels[i], font, 'center', 'top' + ); + rect[isAxisHorizontal ? 'x' : 'y'] += tickCoord; + // FIXME Magic number 1.5 + rect[isAxisHorizontal ? 'width' : 'height'] *= 1.3; + if (!textSpaceTakenRect) { + textSpaceTakenRect = rect.clone(); + } + // There is no space for current label; + else if (textSpaceTakenRect.intersect(rect)) { + accumulatedLabelInterval++; + autoLabelInterval = Math.max(autoLabelInterval, accumulatedLabelInterval); } else { - if (isAreaChart && !polygon) { - // If areaStyle is added - polygon = this._newPolygon( - points, stackedOnPoints, - coordSys, hasAnimation - ); - } - else if (polygon && !isAreaChart) { - // If areaStyle is removed - lineGroup.remove(polygon); - polygon = this._polygon = null; - } + textSpaceTakenRect.union(rect); + // Reset + accumulatedLabelInterval = 0; + } + } + if (autoLabelInterval === 0 && step > 1) { + return step; + } + return (autoLabelInterval + 1) * step - 1; + }; - // Update clipPath - lineGroup.setClipPath(createClipShape(coordSys, false, seriesModel)); + /** + * @param {Object} axis + * @param {Function} labelFormatter + * @return {Array.} + */ + axisHelper.getFormattedLabels = function (axis, labelFormatter) { + var scale = axis.scale; + var labels = scale.getTicksLabels(); + var ticks = scale.getTicks(); + if (typeof labelFormatter === 'string') { + labelFormatter = (function (tpl) { + return function (val) { + return tpl.replace('{value}', val != null ? val : ''); + }; + })(labelFormatter); + // Consider empty array + return zrUtil.map(labels, labelFormatter); + } + else if (typeof labelFormatter === 'function') { + return zrUtil.map(ticks, function (tick, idx) { + return labelFormatter( + axisHelper.getAxisRawValue(axis, tick), + idx + ); + }, this); + } + else { + return labels; + } + }; - // Always update, or it is wrong in the case turning on legend - // because points are not changed - showSymbol && symbolDraw.updateData(data, isSymbolIgnore); + axisHelper.getAxisRawValue = function (axis, value) { + // In category axis with data zoom, tick is not the original + // index of axis.data. So tick should not be exposed to user + // in category axis. + return axis.type === 'category' ? axis.scale.getLabel(value) : value; + }; - // Stop symbol animation and sync with line points - // FIXME performance? - data.eachItemGraphicEl(function (el) { - el.stopAnimation(true); - }); + module.exports = axisHelper; - // In the case data zoom triggerred refreshing frequently - // Data may not change if line has a category axis. So it should animate nothing - if (!isPointsSame(this._stackedOnPoints, stackedOnPoints) - || !isPointsSame(this._points, points) - ) { - if (hasAnimation) { - this._updateAnimation( - data, stackedOnPoints, coordSys, api, step - ); - } - else { - // Not do it in update with animation - if (step) { - // TODO If stacked series is not step - points = turnPointsIntoStep(points, coordSys, step); - stackedOnPoints = turnPointsIntoStep(stackedOnPoints, coordSys, step); - } - polyline.setShape({ - points: points - }); - polygon && polygon.setShape({ - points: points, - stackedOnPoints: stackedOnPoints - }); - } - } - } +/***/ }, +/* 106 */ +/***/ function(module, exports, __webpack_require__) { - var visualColor = getVisualGradient(data, coordSys) || data.getVisual('color'); + /** + * Linear continuous scale + * @module echarts/coord/scale/Ordinal + * + * http://en.wikipedia.org/wiki/Level_of_measurement + */ - polyline.useStyle(zrUtil.defaults( - // Use color in lineStyle first - lineStyleModel.getLineStyle(), - { - fill: 'none', - stroke: visualColor, - lineJoin: 'bevel' - } - )); + // FIXME only one data - var smooth = seriesModel.get('smooth'); - smooth = getSmooth(seriesModel.get('smooth')); - polyline.setShape({ - smooth: smooth, - smoothMonotone: seriesModel.get('smoothMonotone'), - connectNulls: seriesModel.get('connectNulls') - }); - if (polygon) { - var stackedOn = data.stackedOn; - var stackedOnSmooth = 0; + var zrUtil = __webpack_require__(4); + var Scale = __webpack_require__(107); - polygon.useStyle(zrUtil.defaults( - areaStyleModel.getAreaStyle(), - { - fill: visualColor, - opacity: 0.7, - lineJoin: 'bevel' - } - )); + var scaleProto = Scale.prototype; - if (stackedOn) { - var stackedOnSeries = stackedOn.hostModel; - stackedOnSmooth = getSmooth(stackedOnSeries.get('smooth')); - } + var OrdinalScale = Scale.extend({ - polygon.setShape({ - smooth: smooth, - stackedOnSmooth: stackedOnSmooth, - smoothMonotone: seriesModel.get('smoothMonotone'), - connectNulls: seriesModel.get('connectNulls') - }); - } + type: 'ordinal', + init: function (data, extent) { this._data = data; - // Save the coordinate system for transition animation when data changed - this._coordSys = coordSys; - this._stackedOnPoints = stackedOnPoints; - this._points = points; - this._step = step; + this._extent = extent || [0, data.length - 1]; }, - dispose: function () {}, - - highlight: function (seriesModel, ecModel, api, payload) { - var data = seriesModel.getData(); - var dataIndex = modelUtil.queryDataIndex(data, payload); - - if (!(dataIndex instanceof Array) && dataIndex != null && dataIndex >= 0) { - var symbol = data.getItemGraphicEl(dataIndex); - if (!symbol) { - // Create a temporary symbol if it is not exists - var pt = data.getItemLayout(dataIndex); - if (!pt) { - // Null data - return; - } - symbol = new Symbol(data, dataIndex); - symbol.position = pt; - symbol.setZ( - seriesModel.get('zlevel'), - seriesModel.get('z') - ); - symbol.ignore = isNaN(pt[0]) || isNaN(pt[1]); - symbol.__temp = true; - data.setItemGraphicEl(dataIndex, symbol); - - // Stop scale animation - symbol.stopSymbolAnimation(true); - - this.group.add(symbol); - } - symbol.highlight(); - } - else { - // Highlight whole series - ChartView.prototype.highlight.call( - this, seriesModel, ecModel, api, payload - ); - } + parse: function (val) { + return typeof val === 'string' + ? zrUtil.indexOf(this._data, val) + // val might be float. + : Math.round(val); }, - downplay: function (seriesModel, ecModel, api, payload) { - var data = seriesModel.getData(); - var dataIndex = modelUtil.queryDataIndex(data, payload); - if (dataIndex != null && dataIndex >= 0) { - var symbol = data.getItemGraphicEl(dataIndex); - if (symbol) { - if (symbol.__temp) { - data.setItemGraphicEl(dataIndex, null); - this.group.remove(symbol); - } - else { - symbol.downplay(); - } - } - } - else { - // Downplay whole series - ChartView.prototype.downplay.call( - this, seriesModel, ecModel, api, payload - ); - } + contain: function (rank) { + rank = this.parse(rank); + return scaleProto.contain.call(this, rank) + && this._data[rank] != null; }, /** - * @param {module:zrender/container/Group} group - * @param {Array.>} points - * @private + * Normalize given rank or name to linear [0, 1] + * @param {number|string} [val] + * @return {number} */ - _newPolyline: function (points) { - var polyline = this._polyline; - // Remove previous created polyline - if (polyline) { - this._lineGroup.remove(polyline); - } - - polyline = new polyHelper.Polyline({ - shape: { - points: points - }, - silent: true, - z2: 10 - }); - - this._lineGroup.add(polyline); - - this._polyline = polyline; + normalize: function (val) { + return scaleProto.normalize.call(this, this.parse(val)); + }, - return polyline; + scale: function (val) { + return Math.round(scaleProto.scale.call(this, val)); }, /** - * @param {module:zrender/container/Group} group - * @param {Array.>} stackedOnPoints - * @param {Array.>} points - * @private + * @return {Array} */ - _newPolygon: function (points, stackedOnPoints) { - var polygon = this._polygon; - // Remove previous created polygon - if (polygon) { - this._lineGroup.remove(polygon); - } - - polygon = new polyHelper.Polygon({ - shape: { - points: points, - stackedOnPoints: stackedOnPoints - }, - silent: true - }); + getTicks: function () { + var ticks = []; + var extent = this._extent; + var rank = extent[0]; - this._lineGroup.add(polygon); + while (rank <= extent[1]) { + ticks.push(rank); + rank++; + } - this._polygon = polygon; - return polygon; + return ticks; }, + /** - * @private + * Get item on rank n + * @param {number} n + * @return {string} */ - _getSymbolIgnoreFunc: function (data, coordSys) { - var categoryAxis = coordSys.getAxesByScale('ordinal')[0]; - // `getLabelInterval` is provided by echarts/component/axis - if (categoryAxis && categoryAxis.isLabelIgnored) { - return zrUtil.bind(categoryAxis.isLabelIgnored, categoryAxis); - } + getLabel: function (n) { + return this._data[n]; }, /** - * @private + * @return {number} */ - // FIXME Two value axis - _updateAnimation: function (data, stackedOnPoints, coordSys, api, step) { - var polyline = this._polyline; - var polygon = this._polygon; - var seriesModel = data.hostModel; - - var diff = lineAnimationDiff( - this._data, data, - this._stackedOnPoints, stackedOnPoints, - this._coordSys, coordSys - ); - - var current = diff.current; - var stackedOnCurrent = diff.stackedOnCurrent; - var next = diff.next; - var stackedOnNext = diff.stackedOnNext; - if (step) { - // TODO If stacked series is not step - current = turnPointsIntoStep(diff.current, coordSys, step); - stackedOnCurrent = turnPointsIntoStep(diff.stackedOnCurrent, coordSys, step); - next = turnPointsIntoStep(diff.next, coordSys, step); - stackedOnNext = turnPointsIntoStep(diff.stackedOnNext, coordSys, step); - } - // `diff.current` is subset of `current` (which should be ensured by - // turnPointsIntoStep), so points in `__points` can be updated when - // points in `current` are update during animation. - polyline.shape.__points = diff.current; - polyline.shape.points = current; - - graphic.updateProps(polyline, { - shape: { - points: next - } - }, seriesModel); - - if (polygon) { - polygon.setShape({ - points: current, - stackedOnPoints: stackedOnCurrent - }); - graphic.updateProps(polygon, { - shape: { - points: next, - stackedOnPoints: stackedOnNext - } - }, seriesModel); - } - - var updatedDataInfo = []; - var diffStatus = diff.status; - - for (var i = 0; i < diffStatus.length; i++) { - var cmd = diffStatus[i].cmd; - if (cmd === '=') { - var el = data.getItemGraphicEl(diffStatus[i].idx1); - if (el) { - updatedDataInfo.push({ - el: el, - ptIdx: i // Index of points - }); - } - } - } - - if (polyline.animators && polyline.animators.length) { - polyline.animators[0].during(function () { - for (var i = 0; i < updatedDataInfo.length; i++) { - var el = updatedDataInfo[i].el; - el.attr('position', polyline.shape.__points[updatedDataInfo[i].ptIdx]); - } - }); - } + count: function () { + return this._extent[1] - this._extent[0] + 1; }, - remove: function (ecModel) { - var group = this.group; - var oldData = this._data; - this._lineGroup.removeAll(); - this._symbolDraw.remove(true); - // Remove temporary created elements when highlighting - oldData && oldData.eachItemGraphicEl(function (el, idx) { - if (el.__temp) { - group.remove(el); - oldData.setItemGraphicEl(idx, null); - } - }); + /** + * @override + */ + unionExtentFromData: function (data, dim) { + this.unionExtent(data.getDataExtent(dim, false)); + }, - this._polyline = - this._polygon = - this._coordSys = - this._points = - this._stackedOnPoints = - this._data = null; - } + niceTicks: zrUtil.noop, + niceExtent: zrUtil.noop }); + /** + * @return {module:echarts/scale/Time} + */ + OrdinalScale.create = function () { + return new OrdinalScale(); + }; + + module.exports = OrdinalScale; + /***/ }, -/* 105 */ +/* 107 */ /***/ function(module, exports, __webpack_require__) { /** - * @module echarts/chart/helper/SymbolDraw + * // Scale class management + * @module echarts/scale/Scale */ - var graphic = __webpack_require__(43); - var Symbol = __webpack_require__(106); + var clazzUtil = __webpack_require__(13); - /** - * @constructor - * @alias module:echarts/chart/helper/SymbolDraw - * @param {module:zrender/graphic/Group} [symbolCtor] - */ - function SymbolDraw(symbolCtor) { - this.group = new graphic.Group(); + function Scale() { + /** + * Extent + * @type {Array.} + * @protected + */ + this._extent = [Infinity, -Infinity]; - this._symbolCtor = symbolCtor || Symbol; + /** + * Step is calculated in adjustExtent + * @type {Array.} + * @protected + */ + this._interval = 0; + + this.init && this.init.apply(this, arguments); } - var symbolDrawProto = SymbolDraw.prototype; + var scaleProto = Scale.prototype; - function symbolNeedsDraw(data, idx, isIgnore) { - var point = data.getItemLayout(idx); - // Is an object - // if (point && point.hasOwnProperty('point')) { - // point = point.point; - // } - return point && !isNaN(point[0]) && !isNaN(point[1]) && !(isIgnore && isIgnore(idx)) - && data.getItemVisual(idx, 'symbol') !== 'none'; - } /** - * Update symbols draw by new data - * @param {module:echarts/data/List} data - * @param {Array.} [isIgnore] + * Parse input val to valid inner number. + * @param {*} val + * @return {number} */ - symbolDrawProto.updateData = function (data, isIgnore) { - var group = this.group; - var seriesModel = data.hostModel; - var oldData = this._data; - - var SymbolCtor = this._symbolCtor; - - var seriesScope = { - itemStyle: seriesModel.getModel('itemStyle.normal').getItemStyle(['color']), - hoverItemStyle: seriesModel.getModel('itemStyle.emphasis').getItemStyle(), - symbolRotate: seriesModel.get('symbolRotate'), - symbolOffset: seriesModel.get('symbolOffset'), - hoverAnimation: seriesModel.get('hoverAnimation'), - - labelModel: seriesModel.getModel('label.normal'), - hoverLabelModel: seriesModel.getModel('label.emphasis') - }; - - data.diff(oldData) - .add(function (newIdx) { - var point = data.getItemLayout(newIdx); - if (symbolNeedsDraw(data, newIdx, isIgnore)) { - var symbolEl = new SymbolCtor(data, newIdx, seriesScope); - symbolEl.attr('position', point); - data.setItemGraphicEl(newIdx, symbolEl); - group.add(symbolEl); - } - }) - .update(function (newIdx, oldIdx) { - var symbolEl = oldData.getItemGraphicEl(oldIdx); - var point = data.getItemLayout(newIdx); - if (!symbolNeedsDraw(data, newIdx, isIgnore)) { - group.remove(symbolEl); - return; - } - if (!symbolEl) { - symbolEl = new SymbolCtor(data, newIdx); - symbolEl.attr('position', point); - } - else { - symbolEl.updateData(data, newIdx, seriesScope); - graphic.updateProps(symbolEl, { - position: point - }, seriesModel); - } - - // Add back - group.add(symbolEl); - - data.setItemGraphicEl(newIdx, symbolEl); - }) - .remove(function (oldIdx) { - var el = oldData.getItemGraphicEl(oldIdx); - el && el.fadeOut(function () { - group.remove(el); - }); - }) - .execute(); - - this._data = data; + scaleProto.parse = function (val) { + // Notice: This would be a trap here, If the implementation + // of this method depends on extent, and this method is used + // before extent set (like in dataZoom), it would be wrong. + // Nevertheless, parse does not depend on extent generally. + return val; }; - symbolDrawProto.updateLayout = function () { - var data = this._data; - if (data) { - // Not use animation - data.eachItemGraphicEl(function (el, idx) { - var point = data.getItemLayout(idx); - el.attr('position', point); - }); - } + scaleProto.contain = function (val) { + var extent = this._extent; + return val >= extent[0] && val <= extent[1]; }; - symbolDrawProto.remove = function (enableAnimation) { - var group = this.group; - var data = this._data; - if (data) { - if (enableAnimation) { - data.eachItemGraphicEl(function (el) { - el.fadeOut(function () { - group.remove(el); - }); - }); - } - else { - group.removeAll(); - } + /** + * Normalize value to linear [0, 1], return 0.5 if extent span is 0 + * @param {number} val + * @return {number} + */ + scaleProto.normalize = function (val) { + var extent = this._extent; + if (extent[1] === extent[0]) { + return 0.5; } + return (val - extent[0]) / (extent[1] - extent[0]); }; - module.exports = SymbolDraw; - - -/***/ }, -/* 106 */ -/***/ function(module, exports, __webpack_require__) { - - /** - * @module echarts/chart/helper/Symbol - */ - - - var zrUtil = __webpack_require__(4); - var symbolUtil = __webpack_require__(107); - var graphic = __webpack_require__(43); - var numberUtil = __webpack_require__(7); - - function getSymbolSize(data, idx) { - var symbolSize = data.getItemVisual(idx, 'symbolSize'); - return symbolSize instanceof Array - ? symbolSize.slice() - : [+symbolSize, +symbolSize]; - } - - function getScale(symbolSize) { - return [symbolSize[0] / 2, symbolSize[1] / 2]; - } - /** - * @constructor - * @alias {module:echarts/chart/helper/Symbol} - * @param {module:echarts/data/List} data - * @param {number} idx - * @extends {module:zrender/graphic/Group} + * Scale normalized value + * @param {number} val + * @return {number} */ - function Symbol(data, idx, seriesScope) { - graphic.Group.call(this); - - this.updateData(data, idx, seriesScope); - } - - var symbolProto = Symbol.prototype; - - function driftSymbol(dx, dy) { - this.parent.drift(dx, dy); - } - - symbolProto._createSymbol = function (symbolType, data, idx, symbolSize) { - // Remove paths created before - this.removeAll(); - - var seriesModel = data.hostModel; - var color = data.getItemVisual(idx, 'color'); - - // var symbolPath = symbolUtil.createSymbol( - // symbolType, -0.5, -0.5, 1, 1, color - // ); - // If width/height are set too small (e.g., set to 1) on ios10 - // and macOS Sierra, a circle stroke become a rect, no matter what - // the scale is set. So we set width/height as 2. See #4150. - var symbolPath = symbolUtil.createSymbol( - symbolType, -1, -1, 2, 2, color - ); - - symbolPath.attr({ - z2: 100, - culling: true, - scale: [0, 0] - }); - // Rewrite drift method - symbolPath.drift = driftSymbol; - - graphic.initProps(symbolPath, { - scale: getScale(symbolSize) - }, seriesModel, idx); - this._symbolType = symbolType; - - this.add(symbolPath); + scaleProto.scale = function (val) { + var extent = this._extent; + return val * (extent[1] - extent[0]) + extent[0]; }; /** - * Stop animation - * @param {boolean} toLastFrame + * Set extent from data + * @param {Array.} other */ - symbolProto.stopSymbolAnimation = function (toLastFrame) { - this.childAt(0).stopAnimation(toLastFrame); + scaleProto.unionExtent = function (other) { + var extent = this._extent; + other[0] < extent[0] && (extent[0] = other[0]); + other[1] > extent[1] && (extent[1] = other[1]); + // not setExtent because in log axis it may transformed to power + // this.setExtent(extent[0], extent[1]); }; /** - * Get symbol path element + * Set extent from data + * @param {module:echarts/data/List} data + * @param {string} dim */ - symbolProto.getSymbolPath = function () { - return this.childAt(0); + scaleProto.unionExtentFromData = function (data, dim) { + this.unionExtent(data.getDataExtent(dim, true)); }; /** - * Get scale(aka, current symbol size). - * Including the change caused by animation + * Get extent + * @return {Array.} */ - symbolProto.getScale = function () { - return this.childAt(0).scale; + scaleProto.getExtent = function () { + return this._extent.slice(); }; /** - * Highlight symbol + * Set extent + * @param {number} start + * @param {number} end */ - symbolProto.highlight = function () { - this.childAt(0).trigger('emphasis'); + scaleProto.setExtent = function (start, end) { + var thisExtent = this._extent; + if (!isNaN(start)) { + thisExtent[0] = start; + } + if (!isNaN(end)) { + thisExtent[1] = end; + } }; /** - * Downplay symbol + * @return {Array.} */ - symbolProto.downplay = function () { - this.childAt(0).trigger('normal'); + scaleProto.getTicksLabels = function () { + var labels = []; + var ticks = this.getTicks(); + for (var i = 0; i < ticks.length; i++) { + labels.push(this.getLabel(ticks[i])); + } + return labels; }; /** - * @param {number} zlevel - * @param {number} z + * When axis extent depends on data and no data exists, + * axis ticks should not be drawn, which is named 'blank'. */ - symbolProto.setZ = function (zlevel, z) { - var symbolPath = this.childAt(0); - symbolPath.zlevel = zlevel; - symbolPath.z = z; - }; - - symbolProto.setDraggable = function (draggable) { - var symbolPath = this.childAt(0); - symbolPath.draggable = draggable; - symbolPath.cursor = draggable ? 'move' : 'pointer'; - }; + scaleProto.isBlank = function () { + return this._isBlank; + }, /** - * Update symbol properties - * @param {module:echarts/data/List} data - * @param {number} idx + * When axis extent depends on data and no data exists, + * axis ticks should not be drawn, which is named 'blank'. */ - symbolProto.updateData = function (data, idx, seriesScope) { - this.silent = false; - - var symbolType = data.getItemVisual(idx, 'symbol') || 'circle'; - var seriesModel = data.hostModel; - var symbolSize = getSymbolSize(data, idx); - - if (symbolType !== this._symbolType) { - this._createSymbol(symbolType, data, idx, symbolSize); - } - else { - var symbolPath = this.childAt(0); - graphic.updateProps(symbolPath, { - scale: getScale(symbolSize) - }, seriesModel, idx); - } - this._updateCommon(data, idx, symbolSize, seriesScope); - this._seriesModel = seriesModel; + scaleProto.setBlank = function (isBlank) { + this._isBlank = isBlank; }; - // Update common properties - var normalStyleAccessPath = ['itemStyle', 'normal']; - var emphasisStyleAccessPath = ['itemStyle', 'emphasis']; - var normalLabelAccessPath = ['label', 'normal']; - var emphasisLabelAccessPath = ['label', 'emphasis']; - - symbolProto._updateCommon = function (data, idx, symbolSize, seriesScope) { - var symbolPath = this.childAt(0); - var seriesModel = data.hostModel; - var color = data.getItemVisual(idx, 'color'); - - // Reset style - if (symbolPath.type !== 'image') { - symbolPath.useStyle({ - strokeNoScale: true - }); - } - - seriesScope = seriesScope || null; - - var itemStyle = seriesScope && seriesScope.itemStyle; - var hoverItemStyle = seriesScope && seriesScope.hoverItemStyle; - var symbolRotate = seriesScope && seriesScope.symbolRotate; - var symbolOffset = seriesScope && seriesScope.symbolOffset; - var labelModel = seriesScope && seriesScope.labelModel; - var hoverLabelModel = seriesScope && seriesScope.hoverLabelModel; - var hoverAnimation = seriesScope && seriesScope.hoverAnimation; - - if (!seriesScope || data.hasItemOption) { - var itemModel = data.getItemModel(idx); - // Color must be excluded. - // Because symbol provide setColor individually to set fill and stroke - itemStyle = itemModel.getModel(normalStyleAccessPath).getItemStyle(['color']); - hoverItemStyle = itemModel.getModel(emphasisStyleAccessPath).getItemStyle(); + clazzUtil.enableClassExtend(Scale); + clazzUtil.enableClassManagement(Scale, { + registerWhenExtend: true + }); - symbolRotate = itemModel.getShallow('symbolRotate'); - symbolOffset = itemModel.getShallow('symbolOffset'); + module.exports = Scale; - labelModel = itemModel.getModel(normalLabelAccessPath); - hoverLabelModel = itemModel.getModel(emphasisLabelAccessPath); - hoverAnimation = itemModel.getShallow('hoverAnimation'); - } - else { - hoverItemStyle = zrUtil.extend({}, hoverItemStyle); - } - var elStyle = symbolPath.style; +/***/ }, +/* 108 */ +/***/ function(module, exports, __webpack_require__) { - symbolPath.attr('rotation', (symbolRotate || 0) * Math.PI / 180 || 0); + /** + * Interval scale + * @module echarts/scale/Interval + */ - if (symbolOffset) { - symbolPath.attr('position', [ - numberUtil.parsePercent(symbolOffset[0], symbolSize[0]), - numberUtil.parsePercent(symbolOffset[1], symbolSize[1]) - ]); - } - // PENDING setColor before setStyle!!! - symbolPath.setColor(color); - symbolPath.setStyle(itemStyle); + var numberUtil = __webpack_require__(7); + var formatUtil = __webpack_require__(6); + var Scale = __webpack_require__(107); - var opacity = data.getItemVisual(idx, 'opacity'); - if (opacity != null) { - elStyle.opacity = opacity; - } + var mathFloor = Math.floor; + var mathCeil = Math.ceil; - // Get last value dim - var dimensions = data.dimensions.slice(); - var valueDim; - var dataType; - while (dimensions.length && ( - valueDim = dimensions.pop(), - dataType = data.getDimensionInfo(valueDim).type, - dataType === 'ordinal' || dataType === 'time' - )) {} // jshint ignore:line + var getPrecisionSafe = numberUtil.getPrecisionSafe; + var roundingErrorFix = numberUtil.round; + /** + * @alias module:echarts/coord/scale/Interval + * @constructor + */ + var IntervalScale = Scale.extend({ - if (valueDim != null && labelModel.getShallow('show')) { - graphic.setText(elStyle, labelModel, color); - elStyle.text = zrUtil.retrieve( - seriesModel.getFormattedLabel(idx, 'normal'), - data.get(valueDim, idx) - ); - } - else { - elStyle.text = ''; - } + type: 'interval', - if (valueDim != null && hoverLabelModel.getShallow('show')) { - graphic.setText(hoverItemStyle, hoverLabelModel, color); - hoverItemStyle.text = zrUtil.retrieve( - seriesModel.getFormattedLabel(idx, 'emphasis'), - data.get(valueDim, idx) - ); - } - else { - hoverItemStyle.text = ''; - } + _interval: 0, - symbolPath.off('mouseover') - .off('mouseout') - .off('emphasis') - .off('normal'); + _intervalPrecision: 2, - symbolPath.hoverStyle = hoverItemStyle; + setExtent: function (start, end) { + var thisExtent = this._extent; + //start,end may be a Number like '25',so... + if (!isNaN(start)) { + thisExtent[0] = parseFloat(start); + } + if (!isNaN(end)) { + thisExtent[1] = parseFloat(end); + } + }, - graphic.setHoverStyle(symbolPath); + unionExtent: function (other) { + var extent = this._extent; + other[0] < extent[0] && (extent[0] = other[0]); + other[1] > extent[1] && (extent[1] = other[1]); - var scale = getScale(symbolSize); + // unionExtent may called by it's sub classes + IntervalScale.prototype.setExtent.call(this, extent[0], extent[1]); + }, + /** + * Get interval + */ + getInterval: function () { + if (!this._interval) { + this.niceTicks(); + } + return this._interval; + }, - if (hoverAnimation && seriesModel.isAnimationEnabled()) { - var onEmphasis = function() { - var ratio = scale[1] / scale[0]; - this.animateTo({ - scale: [ - Math.max(scale[0] * 1.1, scale[0] + 3), - Math.max(scale[1] * 1.1, scale[1] + 3 * ratio) - ] - }, 400, 'elasticOut'); - }; - var onNormal = function() { - this.animateTo({ - scale: scale - }, 400, 'elasticOut'); - }; - symbolPath.on('mouseover', onEmphasis) - .on('mouseout', onNormal) - .on('emphasis', onEmphasis) - .on('normal', onNormal); - } - }; + /** + * Set interval + */ + setInterval: function (interval) { + this._interval = interval; + // Dropped auto calculated niceExtent and use user setted extent + // We assume user wan't to set both interval, min, max to get a better result + this._niceExtent = this._extent.slice(); + }, - symbolProto.fadeOut = function (cb) { - var symbolPath = this.childAt(0); - // Avoid mistaken hover when fading out - this.silent = true; - // Not show text when animating - symbolPath.style.text = ''; - graphic.updateProps(symbolPath, { - scale: [0, 0] - }, this._seriesModel, this.dataIndex, cb); - }; + /** + * @return {Array.} + */ + getTicks: function () { + if (!this._interval) { + this.niceTicks(); + } + var interval = this._interval; + var extent = this._extent; + var ticks = []; - zrUtil.inherits(Symbol, graphic.Group); + // Consider this case: using dataZoom toolbox, zoom and zoom. + var safeLimit = 10000; - module.exports = Symbol; + if (interval) { + var niceExtent = this._niceExtent; + var precision = this._intervalPrecision = getPrecisionSafe(interval); + // FIXME + precision += 2; + if (extent[0] < niceExtent[0]) { + ticks.push(extent[0]); + } + var tick = niceExtent[0]; -/***/ }, -/* 107 */ -/***/ function(module, exports, __webpack_require__) { + while (tick <= niceExtent[1]) { + ticks.push(tick); + // Avoid rounding error + tick = roundingErrorFix(tick + interval, precision); + if (ticks.length > safeLimit) { + return []; + } + } + // Consider this case: the last item of ticks is smaller + // than niceExtent[1] and niceExtent[1] === extent[1]. + if (extent[1] > (ticks.length ? ticks[ticks.length - 1] : niceExtent[1])) { + ticks.push(extent[1]); + } + } - 'use strict'; - // Symbol factory + return ticks; + }, + /** + * @return {Array.} + */ + getTicksLabels: function () { + var labels = []; + var ticks = this.getTicks(); + for (var i = 0; i < ticks.length; i++) { + labels.push(this.getLabel(ticks[i])); + } + return labels; + }, - var graphic = __webpack_require__(43); - var BoundingRect = __webpack_require__(9); + /** + * @param {number} data + * @param {Object} [opt] + * @param {number|string} [opt.precision] If 'auto', use nice presision. + * @param {boolean} [opt.pad] returns 1.50 but not 1.5 if precision is 2. + * @return {number} + */ + getLabel: function (data, opt) { + var precision = opt && opt.precision; + if (data != null && precision != null) { + // Should be more precise then tick. + precision === 'auto' && (precision = this._intervalPrecision + 2); + data = roundingErrorFix(data, precision, opt && opt.pad); + } + return formatUtil.addCommas(data); + }, - /** - * Triangle shape - * @inner - */ - var Triangle = graphic.extendShape({ - type: 'triangle', - shape: { - cx: 0, - cy: 0, - width: 0, - height: 0 - }, - buildPath: function (path, shape) { - var cx = shape.cx; - var cy = shape.cy; - var width = shape.width / 2; - var height = shape.height / 2; - path.moveTo(cx, cy - height); - path.lineTo(cx + width, cy + height); - path.lineTo(cx - width, cy + height); - path.closePath(); - } - }); - /** - * Diamond shape - * @inner - */ - var Diamond = graphic.extendShape({ - type: 'diamond', - shape: { - cx: 0, - cy: 0, - width: 0, - height: 0 - }, - buildPath: function (path, shape) { - var cx = shape.cx; - var cy = shape.cy; - var width = shape.width / 2; - var height = shape.height / 2; - path.moveTo(cx, cy - height); - path.lineTo(cx + width, cy); - path.lineTo(cx, cy + height); - path.lineTo(cx - width, cy); - path.closePath(); - } - }); + /** + * Update interval and extent of intervals for nice ticks + * + * @param {number} [splitNumber = 5] Desired number of ticks + */ + niceTicks: function (splitNumber) { + splitNumber = splitNumber || 5; + var extent = this._extent; + var span = extent[1] - extent[0]; + if (!isFinite(span)) { + return; + } + // User may set axis min 0 and data are all negative + // FIXME If it needs to reverse ? + if (span < 0) { + span = -span; + extent.reverse(); + } - /** - * Pin shape - * @inner - */ - var Pin = graphic.extendShape({ - type: 'pin', - shape: { - // x, y on the cusp - x: 0, - y: 0, - width: 0, - height: 0 - }, + // From "Nice Numbers for Graph Labels" of Graphic Gems + // var niceSpan = numberUtil.nice(span, false); + var step = roundingErrorFix( + numberUtil.nice(span / splitNumber, true), + Math.max( + getPrecisionSafe(extent[0]), + getPrecisionSafe(extent[1]) + // extent may be [0, 1], and step should have 1 more digits. + // To make it safe we add 2 more digits + ) + 2 + ); - buildPath: function (path, shape) { - var x = shape.x; - var y = shape.y; - var w = shape.width / 5 * 3; - // Height must be larger than width - var h = Math.max(w, shape.height); - var r = w / 2; + var precision = getPrecisionSafe(step) + 2; + // Niced extent inside original extent + var niceExtent = [ + roundingErrorFix(mathCeil(extent[0] / step) * step, precision), + roundingErrorFix(mathFloor(extent[1] / step) * step, precision) + ]; - // Dist on y with tangent point and circle center - var dy = r * r / (h - r); - var cy = y - h + r + dy; - var angle = Math.asin(dy / r); - // Dist on x with tangent point and circle center - var dx = Math.cos(angle) * r; + this._interval = step; + this._niceExtent = niceExtent; + }, - var tanX = Math.sin(angle); - var tanY = Math.cos(angle); + /** + * Nice extent. + * @param {number} [splitNumber = 5] Given approx tick number + * @param {boolean} [fixMin=false] + * @param {boolean} [fixMax=false] + */ + niceExtent: function (splitNumber, fixMin, fixMax) { + var extent = this._extent; + // If extent start and end are same, expand them + if (extent[0] === extent[1]) { + if (extent[0] !== 0) { + // Expand extent + var expandSize = extent[0]; + // In the fowllowing case + // Axis has been fixed max 100 + // Plus data are all 100 and axis extent are [100, 100]. + // Extend to the both side will cause expanded max is larger than fixed max. + // So only expand to the smaller side. + if (!fixMax) { + extent[1] += expandSize / 2; + extent[0] -= expandSize / 2; + } + else { + extent[0] -= expandSize / 2; + } + } + else { + extent[1] = 1; + } + } + var span = extent[1] - extent[0]; + // If there are no data and extent are [Infinity, -Infinity] + if (!isFinite(span)) { + extent[0] = 0; + extent[1] = 1; + } - path.arc( - x, cy, r, - Math.PI - angle, - Math.PI * 2 + angle - ); + this.niceTicks(splitNumber); - var cpLen = r * 0.6; - var cpLen2 = r * 0.7; - path.bezierCurveTo( - x + dx - tanX * cpLen, cy + dy + tanY * cpLen, - x, y - cpLen2, - x, y - ); - path.bezierCurveTo( - x, y - cpLen2, - x - dx + tanX * cpLen, cy + dy + tanY * cpLen, - x - dx, cy + dy - ); - path.closePath(); + // var extent = this._extent; + var interval = this._interval; + + if (!fixMin) { + extent[0] = roundingErrorFix(mathFloor(extent[0] / interval) * interval); + } + if (!fixMax) { + extent[1] = roundingErrorFix(mathCeil(extent[1] / interval) * interval); + } } }); /** - * Arrow shape - * @inner + * @return {module:echarts/scale/Time} */ - var Arrow = graphic.extendShape({ + IntervalScale.create = function () { + return new IntervalScale(); + }; - type: 'arrow', + module.exports = IntervalScale; - shape: { - x: 0, - y: 0, - width: 0, - height: 0 - }, - buildPath: function (ctx, shape) { - var height = shape.height; - var width = shape.width; - var x = shape.x; - var y = shape.y; - var dx = width / 3 * 2; - ctx.moveTo(x, y); - ctx.lineTo(x + dx, y + height); - ctx.lineTo(x, y + height / 4 * 3); - ctx.lineTo(x - dx, y + height); - ctx.lineTo(x, y); - ctx.closePath(); - } - }); - /** - * Map of path contructors - * @type {Object.} - */ - var symbolCtors = { - line: graphic.Line, +/***/ }, +/* 109 */ +/***/ function(module, exports, __webpack_require__) { - rect: graphic.Rect, + /** + * Interval scale + * @module echarts/coord/scale/Time + */ - roundRect: graphic.Rect, - square: graphic.Rect, - circle: graphic.Circle, + var zrUtil = __webpack_require__(4); + var numberUtil = __webpack_require__(7); + var formatUtil = __webpack_require__(6); - diamond: Diamond, + var IntervalScale = __webpack_require__(108); - pin: Pin, + var intervalScaleProto = IntervalScale.prototype; - arrow: Arrow, + var mathCeil = Math.ceil; + var mathFloor = Math.floor; + var ONE_SECOND = 1000; + var ONE_MINUTE = ONE_SECOND * 60; + var ONE_HOUR = ONE_MINUTE * 60; + var ONE_DAY = ONE_HOUR * 24; - triangle: Triangle + // FIXME 公用? + var bisect = function (a, x, lo, hi) { + while (lo < hi) { + var mid = lo + hi >>> 1; + if (a[mid][2] < x) { + lo = mid + 1; + } + else { + hi = mid; + } + } + return lo; }; - var symbolShapeMakers = { + /** + * @alias module:echarts/coord/scale/Time + * @constructor + */ + var TimeScale = IntervalScale.extend({ + type: 'time', - line: function (x, y, w, h, shape) { - // FIXME - shape.x1 = x; - shape.y1 = y + h / 2; - shape.x2 = x + w; - shape.y2 = y + h / 2; - }, + // Overwrite + getLabel: function (val) { + var stepLvl = this._stepLvl; - rect: function (x, y, w, h, shape) { - shape.x = x; - shape.y = y; - shape.width = w; - shape.height = h; - }, + var date = new Date(val); - roundRect: function (x, y, w, h, shape) { - shape.x = x; - shape.y = y; - shape.width = w; - shape.height = h; - shape.r = Math.min(w, h) / 4; + return formatUtil.formatTime(stepLvl[0], date); }, - square: function (x, y, w, h, shape) { - var size = Math.min(w, h); - shape.x = x; - shape.y = y; - shape.width = size; - shape.height = size; - }, + // Overwrite + niceExtent: function (approxTickNum, fixMin, fixMax) { + var extent = this._extent; + // If extent start and end are same, expand them + if (extent[0] === extent[1]) { + // Expand extent + extent[0] -= ONE_DAY; + extent[1] += ONE_DAY; + } + // If there are no data and extent are [Infinity, -Infinity] + if (extent[1] === -Infinity && extent[0] === Infinity) { + var d = new Date(); + extent[1] = new Date(d.getFullYear(), d.getMonth(), d.getDate()); + extent[0] = extent[1] - ONE_DAY; + } - circle: function (x, y, w, h, shape) { - // Put circle in the center of square - shape.cx = x + w / 2; - shape.cy = y + h / 2; - shape.r = Math.min(w, h) / 2; - }, + this.niceTicks(approxTickNum); - diamond: function (x, y, w, h, shape) { - shape.cx = x + w / 2; - shape.cy = y + h / 2; - shape.width = w; - shape.height = h; - }, + // var extent = this._extent; + var interval = this._interval; - pin: function (x, y, w, h, shape) { - shape.x = x + w / 2; - shape.y = y + h / 2; - shape.width = w; - shape.height = h; + if (!fixMin) { + extent[0] = numberUtil.round(mathFloor(extent[0] / interval) * interval); + } + if (!fixMax) { + extent[1] = numberUtil.round(mathCeil(extent[1] / interval) * interval); + } }, - arrow: function (x, y, w, h, shape) { - shape.x = x + w / 2; - shape.y = y + h / 2; - shape.width = w; - shape.height = h; - }, + // Overwrite + niceTicks: function (approxTickNum) { + approxTickNum = approxTickNum || 10; - triangle: function (x, y, w, h, shape) { - shape.cx = x + w / 2; - shape.cy = y + h / 2; - shape.width = w; - shape.height = h; - } - }; + var extent = this._extent; + var span = extent[1] - extent[0]; + var approxInterval = span / approxTickNum; + var scaleLevelsLen = scaleLevels.length; + var idx = bisect(scaleLevels, approxInterval, 0, scaleLevelsLen); - var symbolBuildProxies = {}; - for (var name in symbolCtors) { - if (symbolCtors.hasOwnProperty(name)) { - symbolBuildProxies[name] = new symbolCtors[name](); - } - } + var level = scaleLevels[Math.min(idx, scaleLevelsLen - 1)]; + var interval = level[2]; + // Same with interval scale if span is much larger than 1 year + if (level[0] === 'year') { + var yearSpan = span / interval; - var Symbol = graphic.extendShape({ + // From "Nice Numbers for Graph Labels" of Graphic Gems + // var niceYearSpan = numberUtil.nice(yearSpan, false); + var yearStep = numberUtil.nice(yearSpan / approxTickNum, true); - type: 'symbol', + interval *= yearStep; + } - shape: { - symbolType: '', - x: 0, - y: 0, - width: 0, - height: 0 - }, + var niceExtent = [ + mathCeil(extent[0] / interval) * interval, + mathFloor(extent[1] / interval) * interval + ]; - beforeBrush: function () { - var style = this.style; - var shape = this.shape; - // FIXME - if (shape.symbolType === 'pin' && style.textPosition === 'inside') { - style.textPosition = ['50%', '40%']; - style.textAlign = 'center'; - style.textVerticalAlign = 'middle'; - } + this._stepLvl = level; + // Interval will be used in getTicks + this._interval = interval; + this._niceExtent = niceExtent; }, - buildPath: function (ctx, shape, inBundle) { - var symbolType = shape.symbolType; - var proxySymbol = symbolBuildProxies[symbolType]; - if (shape.symbolType !== 'none') { - if (!proxySymbol) { - // Default rect - symbolType = 'rect'; - proxySymbol = symbolBuildProxies[symbolType]; - } - symbolShapeMakers[symbolType]( - shape.x, shape.y, shape.width, shape.height, proxySymbol.shape - ); - proxySymbol.buildPath(ctx, proxySymbol.shape, inBundle); - } + parse: function (val) { + // val might be float. + return +numberUtil.parseDate(val); } }); - // Provide setColor helper method to avoid determine if set the fill or stroke outside - var symbolPathSetColor = function (color) { - if (this.type !== 'image') { - var symbolStyle = this.style; - var symbolShape = this.shape; - if (symbolShape && symbolShape.symbolType === 'line') { - symbolStyle.stroke = color; - } - else if (this.__isEmptyBrush) { - symbolStyle.stroke = color; - symbolStyle.fill = '#fff'; - } - else { - // FIXME 判断图形默认是填充还是描边,使用 onlyStroke ? - symbolStyle.fill && (symbolStyle.fill = color); - symbolStyle.stroke && (symbolStyle.stroke = color); - } - this.dirty(false); - } - }; + zrUtil.each(['contain', 'normalize'], function (methodName) { + TimeScale.prototype[methodName] = function (val) { + return intervalScaleProto[methodName].call(this, this.parse(val)); + }; + }); - var symbolUtil = { - /** - * Create a symbol element with given symbol configuration: shape, x, y, width, height, color - * @param {string} symbolType - * @param {number} x - * @param {number} y - * @param {number} w - * @param {number} h - * @param {string} color - */ - createSymbol: function (symbolType, x, y, w, h, color) { - var isEmpty = symbolType.indexOf('empty') === 0; - if (isEmpty) { - symbolType = symbolType.substr(5, 1).toLowerCase() + symbolType.substr(6); - } - var symbolPath; + // Steps from d3 + var scaleLevels = [ + // Format step interval + ['hh:mm:ss', 1, ONE_SECOND], // 1s + ['hh:mm:ss', 5, ONE_SECOND * 5], // 5s + ['hh:mm:ss', 10, ONE_SECOND * 10], // 10s + ['hh:mm:ss', 15, ONE_SECOND * 15], // 15s + ['hh:mm:ss', 30, ONE_SECOND * 30], // 30s + ['hh:mm\nMM-dd',1, ONE_MINUTE], // 1m + ['hh:mm\nMM-dd',5, ONE_MINUTE * 5], // 5m + ['hh:mm\nMM-dd',10, ONE_MINUTE * 10], // 10m + ['hh:mm\nMM-dd',15, ONE_MINUTE * 15], // 15m + ['hh:mm\nMM-dd',30, ONE_MINUTE * 30], // 30m + ['hh:mm\nMM-dd',1, ONE_HOUR], // 1h + ['hh:mm\nMM-dd',2, ONE_HOUR * 2], // 2h + ['hh:mm\nMM-dd',6, ONE_HOUR * 6], // 6h + ['hh:mm\nMM-dd',12, ONE_HOUR * 12], // 12h + ['MM-dd\nyyyy', 1, ONE_DAY], // 1d + ['week', 7, ONE_DAY * 7], // 7d + ['month', 1, ONE_DAY * 31], // 1M + ['quarter', 3, ONE_DAY * 380 / 4], // 3M + ['half-year', 6, ONE_DAY * 380 / 2], // 6M + ['year', 1, ONE_DAY * 380] // 1Y + ]; - if (symbolType.indexOf('image://') === 0) { - symbolPath = new graphic.Image({ - style: { - image: symbolType.slice(8), - x: x, - y: y, - width: w, - height: h - } - }); - } - else if (symbolType.indexOf('path://') === 0) { - symbolPath = graphic.makePath(symbolType.slice(7), {}, new BoundingRect(x, y, w, h)); - } - else { - symbolPath = new Symbol({ - shape: { - symbolType: symbolType, - x: x, - y: y, - width: w, - height: h - } - }); - } + /** + * @return {module:echarts/scale/Time} + */ + TimeScale.create = function () { + return new TimeScale(); + }; - symbolPath.__isEmptyBrush = isEmpty; + module.exports = TimeScale; - symbolPath.setColor = symbolPathSetColor; - symbolPath.setColor(color); - - return symbolPath; - } - }; - - module.exports = symbolUtil; +/***/ }, +/* 110 */ +/***/ function(module, exports, __webpack_require__) { + /** + * Log scale + * @module echarts/scale/Log + */ -/***/ }, -/* 108 */ -/***/ function(module, exports) { - + var zrUtil = __webpack_require__(4); + var Scale = __webpack_require__(107); + var numberUtil = __webpack_require__(7); - // var arrayDiff = require('zrender/lib/core/arrayDiff'); - // 'zrender/core/arrayDiff' has been used before, but it did - // not do well in performance when roam with fixed dataZoom window. + // Use some method of IntervalScale + var IntervalScale = __webpack_require__(108); - function sign(val) { - return val >= 0 ? 1 : -1; - } + var scaleProto = Scale.prototype; + var intervalScaleProto = IntervalScale.prototype; - function getStackedOnPoint(coordSys, data, idx) { - var baseAxis = coordSys.getBaseAxis(); - var valueAxis = coordSys.getOtherAxis(baseAxis); - var valueStart = baseAxis.onZero - ? 0 : valueAxis.scale.getExtent()[0]; + var getPrecisionSafe = numberUtil.getPrecisionSafe; + var roundingErrorFix = numberUtil.round; - var valueDim = valueAxis.dim; - var baseDataOffset = valueDim === 'x' || valueDim === 'radius' ? 1 : 0; + var mathFloor = Math.floor; + var mathCeil = Math.ceil; + var mathPow = Math.pow; - var stackedOnSameSign; - var stackedOn = data.stackedOn; - var val = data.get(valueDim, idx); - // Find first stacked value with same sign - while (stackedOn && - sign(stackedOn.get(valueDim, idx)) === sign(val) - ) { - stackedOnSameSign = stackedOn; - break; - } - var stackedData = []; - stackedData[baseDataOffset] = data.get(baseAxis.dim, idx); - stackedData[1 - baseDataOffset] = stackedOnSameSign - ? stackedOnSameSign.get(valueDim, idx, true) : valueStart; + var mathLog = Math.log; - return coordSys.dataToPoint(stackedData); - } + var LogScale = Scale.extend({ - // function convertToIntId(newIdList, oldIdList) { - // // Generate int id instead of string id. - // // Compare string maybe slow in score function of arrDiff + type: 'log', - // // Assume id in idList are all unique - // var idIndicesMap = {}; - // var idx = 0; - // for (var i = 0; i < newIdList.length; i++) { - // idIndicesMap[newIdList[i]] = idx; - // newIdList[i] = idx++; - // } - // for (var i = 0; i < oldIdList.length; i++) { - // var oldId = oldIdList[i]; - // // Same with newIdList - // if (idIndicesMap[oldId]) { - // oldIdList[i] = idIndicesMap[oldId]; - // } - // else { - // oldIdList[i] = idx++; - // } - // } - // } + base: 10, - function diffData(oldData, newData) { - var diffResult = []; + $constructor: function () { + Scale.apply(this, arguments); + this._originalScale = new IntervalScale(); + }, - newData.diff(oldData) - .add(function (idx) { - diffResult.push({cmd: '+', idx: idx}); - }) - .update(function (newIdx, oldIdx) { - diffResult.push({cmd: '=', idx: oldIdx, idx1: newIdx}); - }) - .remove(function (idx) { - diffResult.push({cmd: '-', idx: idx}); - }) - .execute(); + /** + * @return {Array.} + */ + getTicks: function () { + var originalScale = this._originalScale; + var extent = this._extent; + var originalExtent = originalScale.getExtent(); - return diffResult; - } + return zrUtil.map(intervalScaleProto.getTicks.call(this), function (val) { + var powVal = numberUtil.round(mathPow(this.base, val)); - module.exports = function ( - oldData, newData, - oldStackedOnPoints, newStackedOnPoints, - oldCoordSys, newCoordSys - ) { - var diff = diffData(oldData, newData); + // Fix #4158 + powVal = (val === extent[0] && originalScale.__fixMin) + ? fixRoundingError(powVal, originalExtent[0]) + : powVal; + powVal = (val === extent[1] && originalScale.__fixMax) + ? fixRoundingError(powVal, originalExtent[1]) + : powVal; - // var newIdList = newData.mapArray(newData.getId); - // var oldIdList = oldData.mapArray(oldData.getId); + return powVal; + }, this); + }, - // convertToIntId(newIdList, oldIdList); + /** + * @param {number} val + * @return {string} + */ + getLabel: intervalScaleProto.getLabel, - // // FIXME One data ? - // diff = arrayDiff(oldIdList, newIdList); + /** + * @param {number} val + * @return {number} + */ + scale: function (val) { + val = scaleProto.scale.call(this, val); + return mathPow(this.base, val); + }, - var currPoints = []; - var nextPoints = []; - // Points for stacking base line - var currStackedPoints = []; - var nextStackedPoints = []; + /** + * @param {number} start + * @param {number} end + */ + setExtent: function (start, end) { + var base = this.base; + start = mathLog(start) / mathLog(base); + end = mathLog(end) / mathLog(base); + intervalScaleProto.setExtent.call(this, start, end); + }, - var status = []; - var sortedIndices = []; - var rawIndices = []; - var dims = newCoordSys.dimensions; - for (var i = 0; i < diff.length; i++) { - var diffItem = diff[i]; - var pointAdded = true; + /** + * @return {number} end + */ + getExtent: function () { + var base = this.base; + var extent = scaleProto.getExtent.call(this); + extent[0] = mathPow(base, extent[0]); + extent[1] = mathPow(base, extent[1]); - // FIXME, animation is not so perfect when dataZoom window moves fast - // Which is in case remvoing or add more than one data in the tail or head - switch (diffItem.cmd) { - case '=': - var currentPt = oldData.getItemLayout(diffItem.idx); - var nextPt = newData.getItemLayout(diffItem.idx1); - // If previous data is NaN, use next point directly - if (isNaN(currentPt[0]) || isNaN(currentPt[1])) { - currentPt = nextPt.slice(); - } - currPoints.push(currentPt); - nextPoints.push(nextPt); + // Fix #4158 + var originalScale = this._originalScale; + var originalExtent = originalScale.getExtent(); + originalScale.__fixMin && (extent[0] = fixRoundingError(extent[0], originalExtent[0])); + originalScale.__fixMax && (extent[1] = fixRoundingError(extent[1], originalExtent[1])); - currStackedPoints.push(oldStackedOnPoints[diffItem.idx]); - nextStackedPoints.push(newStackedOnPoints[diffItem.idx1]); + return extent; + }, - rawIndices.push(newData.getRawIndex(diffItem.idx1)); - break; - case '+': - var idx = diffItem.idx; - currPoints.push( - oldCoordSys.dataToPoint([ - newData.get(dims[0], idx, true), newData.get(dims[1], idx, true) - ]) - ); + /** + * @param {Array.} extent + */ + unionExtent: function (extent) { + this._originalScale.unionExtent(extent); - nextPoints.push(newData.getItemLayout(idx).slice()); + var base = this.base; + extent[0] = mathLog(extent[0]) / mathLog(base); + extent[1] = mathLog(extent[1]) / mathLog(base); + scaleProto.unionExtent.call(this, extent); + }, - currStackedPoints.push( - getStackedOnPoint(oldCoordSys, newData, idx) - ); - nextStackedPoints.push(newStackedOnPoints[idx]); + /** + * @override + */ + unionExtentFromData: function (data, dim) { + this.unionExtent(data.getDataExtent(dim, true, function (val) { + return val > 0; + })); + }, - rawIndices.push(newData.getRawIndex(idx)); - break; - case '-': - var idx = diffItem.idx; - var rawIndex = oldData.getRawIndex(idx); - // Data is replaced. In the case of dynamic data queue - // FIXME FIXME FIXME - if (rawIndex !== idx) { - currPoints.push(oldData.getItemLayout(idx)); - nextPoints.push(newCoordSys.dataToPoint([ - oldData.get(dims[0], idx, true), oldData.get(dims[1], idx, true) - ])); + /** + * Update interval and extent of intervals for nice ticks + * @param {number} [approxTickNum = 10] Given approx tick number + */ + niceTicks: function (approxTickNum) { + approxTickNum = approxTickNum || 10; + var extent = this._extent; + var span = extent[1] - extent[0]; + if (span === Infinity || span <= 0) { + return; + } - currStackedPoints.push(oldStackedOnPoints[idx]); - nextStackedPoints.push( - getStackedOnPoint( - newCoordSys, oldData, idx - ) - ); + var interval = numberUtil.quantity(span); + var err = approxTickNum / span * interval; - rawIndices.push(rawIndex); - } - else { - pointAdded = false; - } + // Filter ticks to get closer to the desired count. + if (err <= 0.5) { + interval *= 10; } - // Original indices - if (pointAdded) { - status.push(diffItem); - sortedIndices.push(sortedIndices.length); + // Interval should be integer + while (!isNaN(interval) && Math.abs(interval) < 1 && Math.abs(interval) > 0) { + interval *= 10; } - } - - // Diff result may be crossed if all items are changed - // Sort by data index - sortedIndices.sort(function (a, b) { - return rawIndices[a] - rawIndices[b]; - }); - - var sortedCurrPoints = []; - var sortedNextPoints = []; - var sortedCurrStackedPoints = []; - var sortedNextStackedPoints = []; + var niceExtent = [ + numberUtil.round(mathCeil(extent[0] / interval) * interval), + numberUtil.round(mathFloor(extent[1] / interval) * interval) + ]; - var sortedStatus = []; - for (var i = 0; i < sortedIndices.length; i++) { - var idx = sortedIndices[i]; - sortedCurrPoints[i] = currPoints[idx]; - sortedNextPoints[i] = nextPoints[idx]; + this._interval = interval; + this._niceExtent = niceExtent; + }, - sortedCurrStackedPoints[i] = currStackedPoints[idx]; - sortedNextStackedPoints[i] = nextStackedPoints[idx]; + /** + * Nice extent. + * @param {number} [approxTickNum = 10] Given approx tick number + * @param {boolean} [fixMin=false] + * @param {boolean} [fixMax=false] + */ + niceExtent: function (splitNumber, fixMin, fixMax) { + intervalScaleProto.niceExtent.call(this, splitNumber, fixMin, fixMax); - sortedStatus[i] = status[idx]; + var originalScale = this._originalScale; + originalScale.__fixMin = fixMin; + originalScale.__fixMax = fixMax; } - return { - current: sortedCurrPoints, - next: sortedNextPoints, - - stackedOnCurrent: sortedCurrStackedPoints, - stackedOnNext: sortedNextStackedPoints, + }); - status: sortedStatus + zrUtil.each(['contain', 'normalize'], function (methodName) { + LogScale.prototype[methodName] = function (val) { + val = mathLog(val) / mathLog(this.base); + return scaleProto[methodName].call(this, val); }; + }); + + LogScale.create = function () { + return new LogScale(); }; + function fixRoundingError(val, originalVal) { + return roundingErrorFix(val, getPrecisionSafe(originalVal)); + } + + module.exports = LogScale; + /***/ }, -/* 109 */ +/* 111 */ /***/ function(module, exports, __webpack_require__) { - // Poly path support NaN point + + var zrUtil = __webpack_require__(4); + var axisHelper = __webpack_require__(105); - var Path = __webpack_require__(45); - var vec2 = __webpack_require__(10); + function getName(obj) { + if (zrUtil.isObject(obj) && obj.value != null) { + return obj.value; + } + else { + return obj; + } + } - var vec2Min = vec2.min; - var vec2Max = vec2.max; + module.exports = { - var scaleAndAdd = vec2.scaleAndAdd; - var v2Copy = vec2.copy; + /** + * Format labels + * @return {Array.} + */ + getFormattedLabels: function () { + return axisHelper.getFormattedLabels( + this.axis, + this.get('axisLabel.formatter') + ); + }, - // Temporary variable - var v = []; - var cp0 = []; - var cp1 = []; + /** + * Get categories + */ + getCategories: function () { + return this.get('type') === 'category' + && zrUtil.map(this.get('data'), getName); + }, - function isPointNull(p) { - return isNaN(p[0]) || isNaN(p[1]); - } + /** + * @param {boolean} origin + * @return {number|string} min value or 'dataMin' or null/undefined (means auto) or NaN + */ + getMin: function (origin) { + var option = this.option; + var min = (!origin && option.rangeStart != null) + ? option.rangeStart : option.min; - function drawSegment( - ctx, points, start, segLen, allLen, - dir, smoothMin, smoothMax, smooth, smoothMonotone, connectNulls - ) { - var prevIdx = 0; - var idx = start; - for (var k = 0; k < segLen; k++) { - var p = points[idx]; - if (idx >= allLen || idx < 0) { - break; - } - if (isPointNull(p)) { - if (connectNulls) { - idx += dir; - continue; - } - break; + if (this.axis && min != null && min !== 'dataMin' && !zrUtil.eqNaN(min)) { + min = this.axis.scale.parse(min); } + return min; + }, - if (idx === start) { - ctx[dir > 0 ? 'moveTo' : 'lineTo'](p[0], p[1]); - v2Copy(cp0, p); + /** + * @param {boolean} origin + * @return {number|string} max value or 'dataMax' or null/undefined (means auto) or NaN + */ + getMax: function (origin) { + var option = this.option; + var max = (!origin && option.rangeEnd != null) + ? option.rangeEnd : option.max; + + if (this.axis && max != null && max !== 'dataMax' && !zrUtil.eqNaN(max)) { + max = this.axis.scale.parse(max); } - else { - if (smooth > 0) { - var nextIdx = idx + dir; - var nextP = points[nextIdx]; - if (connectNulls) { - // Find next point not null - while (nextP && isPointNull(points[nextIdx])) { - nextIdx += dir; - nextP = points[nextIdx]; - } - } + return max; + }, - var ratioNextSeg = 0.5; - var prevP = points[prevIdx]; - var nextP = points[nextIdx]; - // Last point - if (!nextP || isPointNull(nextP)) { - v2Copy(cp1, p); - } - else { - // If next data is null in not connect case - if (isPointNull(nextP) && !connectNulls) { - nextP = p; - } + /** + * @return {boolean} + */ + getNeedCrossZero: function () { + var option = this.option; + return (option.rangeStart != null || option.rangeEnd != null) + ? false : !option.scale; + }, - vec2.sub(v, nextP, prevP); + /** + * Should be implemented by each axis model if necessary. + * @return {module:echarts/model/Component} coordinate system model + */ + getCoordSysModel: zrUtil.noop, - var lenPrevSeg; - var lenNextSeg; - if (smoothMonotone === 'x' || smoothMonotone === 'y') { - var dim = smoothMonotone === 'x' ? 0 : 1; - lenPrevSeg = Math.abs(p[dim] - prevP[dim]); - lenNextSeg = Math.abs(p[dim] - nextP[dim]); - } - else { - lenPrevSeg = vec2.dist(p, prevP); - lenNextSeg = vec2.dist(p, nextP); - } + /** + * @param {number} rangeStart Can only be finite number or null/undefined or NaN. + * @param {number} rangeEnd Can only be finite number or null/undefined or NaN. + */ + setRange: function (rangeStart, rangeEnd) { + this.option.rangeStart = rangeStart; + this.option.rangeEnd = rangeEnd; + }, - // Use ratio of seg length - ratioNextSeg = lenNextSeg / (lenNextSeg + lenPrevSeg); + /** + * Reset range + */ + resetRange: function () { + // rangeStart and rangeEnd is readonly. + this.option.rangeStart = this.option.rangeEnd = null; + } + }; - scaleAndAdd(cp1, p, v, -smooth * (1 - ratioNextSeg)); - } - // Smooth constraint - vec2Min(cp0, cp0, smoothMax); - vec2Max(cp0, cp0, smoothMin); - vec2Min(cp1, cp1, smoothMax); - vec2Max(cp1, cp1, smoothMin); - ctx.bezierCurveTo( - cp0[0], cp0[1], - cp1[0], cp1[1], - p[0], p[1] - ); - // cp0 of next segment - scaleAndAdd(cp0, p, v, smooth * ratioNextSeg); - } - else { - ctx.lineTo(p[0], p[1]); - } - } +/***/ }, +/* 112 */ +/***/ function(module, exports, __webpack_require__) { - prevIdx = idx; - idx += dir; - } + - return k; - } + var zrUtil = __webpack_require__(4); + var echarts = __webpack_require__(1); + var PRIORITY = echarts.PRIORITY; - function getBoundingBox(points, smoothConstraint) { - var ptMin = [Infinity, Infinity]; - var ptMax = [-Infinity, -Infinity]; - if (smoothConstraint) { - for (var i = 0; i < points.length; i++) { - var pt = points[i]; - if (pt[0] < ptMin[0]) { ptMin[0] = pt[0]; } - if (pt[1] < ptMin[1]) { ptMin[1] = pt[1]; } - if (pt[0] > ptMax[0]) { ptMax[0] = pt[0]; } - if (pt[1] > ptMax[1]) { ptMax[1] = pt[1]; } - } - } - return { - min: smoothConstraint ? ptMin : ptMax, - max: smoothConstraint ? ptMax : ptMin - }; - } - - module.exports = { - - Polyline: Path.extend({ + __webpack_require__(113); + __webpack_require__(114); - type: 'ec-polyline', + echarts.registerVisual(zrUtil.curry( + __webpack_require__(119), 'line', 'circle', 'line' + )); + echarts.registerLayout(zrUtil.curry( + __webpack_require__(120), 'line' + )); - shape: { - points: [], + // Down sample after filter + echarts.registerProcessor(PRIORITY.PROCESSOR.STATISTIC, zrUtil.curry( + __webpack_require__(121), 'line' + )); - smooth: 0, + // In case developer forget to include grid component + __webpack_require__(122); - smoothConstraint: true, - smoothMonotone: null, +/***/ }, +/* 113 */ +/***/ function(module, exports, __webpack_require__) { - connectNulls: false - }, + 'use strict'; - style: { - fill: null, - stroke: '#000' - }, + var createListFromArray = __webpack_require__(102); + var SeriesModel = __webpack_require__(28); - buildPath: function (ctx, shape) { - var points = shape.points; + module.exports = SeriesModel.extend({ - var i = 0; - var len = points.length; + type: 'series.line', - var result = getBoundingBox(points, shape.smoothConstraint); + dependencies: ['grid', 'polar'], - if (shape.connectNulls) { - // Must remove first and last null values avoid draw error in polygon - for (; len > 0; len--) { - if (!isPointNull(points[len - 1])) { - break; - } - } - for (; i < len; i++) { - if (!isPointNull(points[i])) { - break; - } - } - } - while (i < len) { - i += drawSegment( - ctx, points, i, len, len, - 1, result.min, result.max, shape.smooth, - shape.smoothMonotone, shape.connectNulls - ) + 1; + getInitialData: function (option, ecModel) { + if (true) { + var coordSys = option.coordinateSystem; + if (coordSys !== 'polar' && coordSys !== 'cartesian2d') { + throw new Error('Line not support coordinateSystem besides cartesian and polar'); } } - }), - - Polygon: Path.extend({ - - type: 'ec-polygon', - - shape: { - points: [], - - // Offset between stacked base points and points - stackedOnPoints: [], + return createListFromArray(option.data, this, ecModel); + }, - smooth: 0, + defaultOption: { + zlevel: 0, // 一级层叠 + z: 2, // 二级层叠 + coordinateSystem: 'cartesian2d', + legendHoverLink: true, - stackedOnSmooth: 0, + hoverAnimation: true, + // stack: null + // xAxisIndex: 0, + // yAxisIndex: 0, - smoothConstraint: true, + // polarIndex: 0, - smoothMonotone: null, + // If clip the overflow value + clipOverflow: true, - connectNulls: false + label: { + normal: { + position: 'top' + } + }, + // itemStyle: { + // normal: {}, + // emphasis: {} + // }, + lineStyle: { + normal: { + width: 2, + type: 'solid' + } }, + // areaStyle: {}, + // false, 'start', 'end', 'middle' + step: false, - buildPath: function (ctx, shape) { - var points = shape.points; - var stackedOnPoints = shape.stackedOnPoints; + // Disabled if step is true + smooth: false, + smoothMonotone: null, + // 拐点图形类型 + symbol: 'emptyCircle', + // 拐点图形大小 + symbolSize: 4, + // 拐点图形旋转控制 + symbolRotate: null, - var i = 0; - var len = points.length; - var smoothMonotone = shape.smoothMonotone; - var bbox = getBoundingBox(points, shape.smoothConstraint); - var stackedOnBBox = getBoundingBox(stackedOnPoints, shape.smoothConstraint); + // 是否显示 symbol, 只有在 tooltip hover 的时候显示 + showSymbol: true, + // 标志图形默认只有主轴显示(随主轴标签间隔隐藏策略) + showAllSymbol: false, - if (shape.connectNulls) { - // Must remove first and last null values avoid draw error in polygon - for (; len > 0; len--) { - if (!isPointNull(points[len - 1])) { - break; - } - } - for (; i < len; i++) { - if (!isPointNull(points[i])) { - break; - } - } - } - while (i < len) { - var k = drawSegment( - ctx, points, i, len, len, - 1, bbox.min, bbox.max, shape.smooth, - smoothMonotone, shape.connectNulls - ); - drawSegment( - ctx, stackedOnPoints, i + k - 1, k, len, - -1, stackedOnBBox.min, stackedOnBBox.max, shape.stackedOnSmooth, - smoothMonotone, shape.connectNulls - ); - i += k + 1; + // 是否连接断点 + connectNulls: false, - ctx.closePath(); - } - } - }) - }; + // 数据过滤,'average', 'max', 'min', 'sum' + sampling: 'none', + animationEasing: 'linear', -/***/ }, -/* 110 */ -/***/ function(module, exports) { + // Disable progressive + progressive: 0, + hoverLayerThreshold: Infinity + } + }); - - module.exports = function (seriesType, defaultSymbolType, legendSymbol, ecModel, api) { +/***/ }, +/* 114 */ +/***/ function(module, exports, __webpack_require__) { - // Encoding visual for all series include which is filtered for legend drawing - ecModel.eachRawSeriesByType(seriesType, function (seriesModel) { - var data = seriesModel.getData(); + 'use strict'; + // FIXME step not support polar - var symbolType = seriesModel.get('symbol') || defaultSymbolType; - var symbolSize = seriesModel.get('symbolSize'); - data.setVisual({ - legendSymbol: legendSymbol || symbolType, - symbol: symbolType, - symbolSize: symbolSize - }); + var zrUtil = __webpack_require__(4); + var SymbolDraw = __webpack_require__(115); + var Symbol = __webpack_require__(116); + var lineAnimationDiff = __webpack_require__(117); + var graphic = __webpack_require__(44); + var modelUtil = __webpack_require__(5); + var polyHelper = __webpack_require__(118); + var ChartView = __webpack_require__(43); - // Only visible series has each data be visual encoded - if (!ecModel.isSeriesFiltered(seriesModel)) { - if (typeof symbolSize === 'function') { - data.each(function (idx) { - var rawValue = seriesModel.getRawValue(idx); - // FIXME - var params = seriesModel.getDataParams(idx); - data.setItemVisual(idx, 'symbolSize', symbolSize(rawValue, params)); - }); - } - data.each(function (idx) { - var itemModel = data.getItemModel(idx); - var itemSymbolType = itemModel.getShallow('symbol', true); - var itemSymbolSize = itemModel.getShallow('symbolSize', true); - // If has item symbol - if (itemSymbolType != null) { - data.setItemVisual(idx, 'symbol', itemSymbolType); - } - if (itemSymbolSize != null) { - // PENDING Transform symbolSize ? - data.setItemVisual(idx, 'symbolSize', itemSymbolSize); - } - }); + function isPointsSame(points1, points2) { + if (points1.length !== points2.length) { + return; + } + for (var i = 0; i < points1.length; i++) { + var p1 = points1[i]; + var p2 = points2[i]; + if (p1[0] !== p2[0] || p1[1] !== p2[1]) { + return; } - }); - }; + } + return true; + } + function getSmooth(smooth) { + return typeof (smooth) === 'number' ? smooth : (smooth ? 0.3 : 0); + } -/***/ }, -/* 111 */ -/***/ function(module, exports) { + function getAxisExtentWithGap(axis) { + var extent = axis.getGlobalExtent(); + if (axis.onBand) { + // Remove extra 1px to avoid line miter in clipped edge + var halfBandWidth = axis.getBandWidth() / 2 - 1; + var dir = extent[1] > extent[0] ? 1 : -1; + extent[0] += dir * halfBandWidth; + extent[1] -= dir * halfBandWidth; + } + return extent; + } - + function sign(val) { + return val >= 0 ? 1 : -1; + } + /** + * @param {module:echarts/coord/cartesian/Cartesian2D|module:echarts/coord/polar/Polar} coordSys + * @param {module:echarts/data/List} data + * @param {Array.>} points + * @private + */ + function getStackedOnPoints(coordSys, data) { + var baseAxis = coordSys.getBaseAxis(); + var valueAxis = coordSys.getOtherAxis(baseAxis); + var valueStart = baseAxis.onZero + ? 0 : valueAxis.scale.getExtent()[0]; - module.exports = function (seriesType, ecModel) { - ecModel.eachSeriesByType(seriesType, function (seriesModel) { - var data = seriesModel.getData(); - var coordSys = seriesModel.coordinateSystem; + var valueDim = valueAxis.dim; - if (coordSys) { - var dims = coordSys.dimensions; + var baseDataOffset = valueDim === 'x' || valueDim === 'radius' ? 1 : 0; - if (coordSys.type === 'singleAxis') { - data.each(dims[0], function (x, idx) { - // Also {Array.}, not undefined to avoid if...else... statement - data.setItemLayout(idx, isNaN(x) ? [NaN, NaN] : coordSys.dataToPoint(x)); - }); - } - else { - data.each(dims, function (x, y, idx) { - // Also {Array.}, not undefined to avoid if...else... statement - data.setItemLayout( - idx, (isNaN(x) || isNaN(y)) ? [NaN, NaN] : coordSys.dataToPoint([x, y]) - ); - }, true); - } + return data.mapArray([valueDim], function (val, idx) { + var stackedOnSameSign; + var stackedOn = data.stackedOn; + // Find first stacked value with same sign + while (stackedOn && + sign(stackedOn.get(valueDim, idx)) === sign(val) + ) { + stackedOnSameSign = stackedOn; + break; } - }); - }; + var stackedData = []; + stackedData[baseDataOffset] = data.get(baseAxis.dim, idx); + stackedData[1 - baseDataOffset] = stackedOnSameSign + ? stackedOnSameSign.get(valueDim, idx, true) : valueStart; + return coordSys.dataToPoint(stackedData); + }, true); + } -/***/ }, -/* 112 */ -/***/ function(module, exports) { + function createGridClipShape(cartesian, hasAnimation, seriesModel) { + var xExtent = getAxisExtentWithGap(cartesian.getAxis('x')); + var yExtent = getAxisExtentWithGap(cartesian.getAxis('y')); + var isHorizontal = cartesian.getBaseAxis().isHorizontal(); - - var samplers = { - average: function (frame) { - var sum = 0; - var count = 0; - for (var i = 0; i < frame.length; i++) { - if (!isNaN(frame[i])) { - sum += frame[i]; - count++; - } - } - // Return NaN if count is 0 - return count === 0 ? NaN : sum / count; - }, - sum: function (frame) { - var sum = 0; - for (var i = 0; i < frame.length; i++) { - // Ignore NaN - sum += frame[i] || 0; - } - return sum; - }, - max: function (frame) { - var max = -Infinity; - for (var i = 0; i < frame.length; i++) { - frame[i] > max && (max = frame[i]); - } - return max; - }, - min: function (frame) { - var min = Infinity; - for (var i = 0; i < frame.length; i++) { - frame[i] < min && (min = frame[i]); - } - return min; - }, - // TODO - // Median - nearest: function (frame) { - return frame[0]; + var x = Math.min(xExtent[0], xExtent[1]); + var y = Math.min(yExtent[0], yExtent[1]); + var width = Math.max(xExtent[0], xExtent[1]) - x; + var height = Math.max(yExtent[0], yExtent[1]) - y; + var lineWidth = seriesModel.get('lineStyle.normal.width') || 2; + // Expand clip shape to avoid clipping when line value exceeds axis + var expandSize = seriesModel.get('clipOverflow') ? lineWidth / 2 : Math.max(width, height); + if (isHorizontal) { + y -= expandSize; + height += expandSize * 2; + } + else { + x -= expandSize; + width += expandSize * 2; } - }; - var indexSampler = function (frame, value) { - return Math.round(frame.length / 2); - }; - module.exports = function (seriesType, ecModel, api) { - ecModel.eachSeriesByType(seriesType, function (seriesModel) { - var data = seriesModel.getData(); - var sampling = seriesModel.get('sampling'); - var coordSys = seriesModel.coordinateSystem; - // Only cartesian2d support down sampling - if (coordSys.type === 'cartesian2d' && sampling) { - var baseAxis = coordSys.getBaseAxis(); - var valueAxis = coordSys.getOtherAxis(baseAxis); - var extent = baseAxis.getExtent(); - // Coordinste system has been resized - var size = extent[1] - extent[0]; - var rate = Math.round(data.count() / size); - if (rate > 1) { - var sampler; - if (typeof sampling === 'string') { - sampler = samplers[sampling]; - } - else if (typeof sampling === 'function') { - sampler = sampling; - } - if (sampler) { - data = data.downSample( - valueAxis.dim, 1 / rate, sampler, indexSampler - ); - seriesModel.setData(data); - } - } + var clipPath = new graphic.Rect({ + shape: { + x: x, + y: y, + width: width, + height: height } - }, this); - }; - - -/***/ }, -/* 113 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - + }); - var graphic = __webpack_require__(43); - var zrUtil = __webpack_require__(4); - var echarts = __webpack_require__(1); + if (hasAnimation) { + clipPath.shape[isHorizontal ? 'width' : 'height'] = 0; + graphic.initProps(clipPath, { + shape: { + width: width, + height: height + } + }, seriesModel); + } - __webpack_require__(114); + return clipPath; + } - __webpack_require__(131); + function createPolarClipShape(polar, hasAnimation, seriesModel) { + var angleAxis = polar.getAngleAxis(); + var radiusAxis = polar.getRadiusAxis(); - // Grid view - echarts.extendComponentView({ + var radiusExtent = radiusAxis.getExtent(); + var angleExtent = angleAxis.getExtent(); - type: 'grid', + var RADIAN = Math.PI / 180; - render: function (gridModel, ecModel) { - this.group.removeAll(); - if (gridModel.get('show')) { - this.group.add(new graphic.Rect({ - shape: gridModel.coordinateSystem.getRect(), - style: zrUtil.defaults({ - fill: gridModel.get('backgroundColor') - }, gridModel.getItemStyle()), - silent: true, - z2: -1 - })); + var clipPath = new graphic.Sector({ + shape: { + cx: polar.cx, + cy: polar.cy, + r0: radiusExtent[0], + r: radiusExtent[1], + startAngle: -angleExtent[0] * RADIAN, + endAngle: -angleExtent[1] * RADIAN, + clockwise: angleAxis.inverse } - } - - }); + }); - echarts.registerPreprocessor(function (option) { - // Only create grid when need - if (option.xAxis && option.yAxis && !option.grid) { - option.grid = {}; + if (hasAnimation) { + clipPath.shape.endAngle = -angleExtent[0] * RADIAN; + graphic.initProps(clipPath, { + shape: { + endAngle: -angleExtent[1] * RADIAN + } + }, seriesModel); } - }); + return clipPath; + } -/***/ }, -/* 114 */ -/***/ function(module, exports, __webpack_require__) { + function createClipShape(coordSys, hasAnimation, seriesModel) { + return coordSys.type === 'polar' + ? createPolarClipShape(coordSys, hasAnimation, seriesModel) + : createGridClipShape(coordSys, hasAnimation, seriesModel); + } - /** - * Grid is a region which contains at most 4 cartesian systems - * - * TODO Default cartesian - */ - var factory = exports; + function turnPointsIntoStep(points, coordSys, stepTurnAt) { + var baseAxis = coordSys.getBaseAxis(); + var baseIndex = baseAxis.dim === 'x' || baseAxis.dim === 'radius' ? 0 : 1; - var layout = __webpack_require__(21); - var axisHelper = __webpack_require__(115); + var stepPoints = []; + for (var i = 0; i < points.length - 1; i++) { + var nextPt = points[i + 1]; + var pt = points[i]; + stepPoints.push(pt); - var zrUtil = __webpack_require__(4); - var Cartesian2D = __webpack_require__(121); - var Axis2D = __webpack_require__(123); + var stepPt = []; + switch (stepTurnAt) { + case 'end': + stepPt[baseIndex] = nextPt[baseIndex]; + stepPt[1 - baseIndex] = pt[1 - baseIndex]; + // default is start + stepPoints.push(stepPt); + break; + case 'middle': + // default is start + var middle = (pt[baseIndex] + nextPt[baseIndex]) / 2; + var stepPt2 = []; + stepPt[baseIndex] = stepPt2[baseIndex] = middle; + stepPt[1 - baseIndex] = pt[1 - baseIndex]; + stepPt2[1 - baseIndex] = nextPt[1 - baseIndex]; + stepPoints.push(stepPt); + stepPoints.push(stepPt2); + break; + default: + stepPt[baseIndex] = pt[baseIndex]; + stepPt[1 - baseIndex] = nextPt[1 - baseIndex]; + // default is start + stepPoints.push(stepPt); + } + } + // Last points + points[i] && stepPoints.push(points[i]); + return stepPoints; + } - var each = zrUtil.each; + function getVisualGradient(data, coordSys) { + var visualMetaList = data.getVisual('visualMeta'); + if (!visualMetaList || !visualMetaList.length || !data.count()) { + // When data.count() is 0, gradient range can not be calculated. + return; + } - var ifAxisCrossZero = axisHelper.ifAxisCrossZero; - var niceScaleExtent = axisHelper.niceScaleExtent; + var visualMeta; + for (var i = visualMetaList.length - 1; i >= 0; i--) { + // Can only be x or y + if (visualMetaList[i].dimension < 2) { + visualMeta = visualMetaList[i]; + break; + } + } + if (!visualMeta || coordSys.type !== 'cartesian2d') { + if (true) { + console.warn('Visual map on line style only support x or y dimension.'); + } + return; + } - // 依赖 GridModel, AxisModel 做预处理 - __webpack_require__(126); + // If the area to be rendered is bigger than area defined by LinearGradient, + // the canvas spec prescribes that the color of the first stop and the last + // stop should be used. But if two stops are added at offset 0, in effect + // browsers use the color of the second stop to render area outside + // LinearGradient. So we can only infinitesimally extend area defined in + // LinearGradient to render `outerColors`. - /** - * Check if the axis is used in the specified grid - * @inner - */ - function isAxisUsedInTheGrid(axisModel, gridModel, ecModel) { - return axisModel.getCoordSysModel() === gridModel; - } + var dimension = visualMeta.dimension; + var dimName = data.dimensions[dimension]; + var axis = coordSys.getAxis(dimName); - function getLabelUnionRect(axis) { - var axisModel = axis.model; - var labels = axisModel.getFormattedLabels(); - var textStyleModel = axisModel.getModel('axisLabel.textStyle'); - var rect; - var step = 1; - var labelCount = labels.length; - if (labelCount > 40) { - // Simple optimization for large amount of labels - step = Math.ceil(labelCount / 40); - } - for (var i = 0; i < labelCount; i += step) { - if (!axis.isLabelIgnored(i)) { - var singleRect = textStyleModel.getTextRect(labels[i]); - // FIXME consider label rotate - rect ? rect.union(singleRect) : (rect = singleRect); - } + // dataToCoor mapping may not be linear, but must be monotonic. + var colorStops = zrUtil.map(visualMeta.stops, function (stop) { + return { + coord: axis.toGlobalCoord(axis.dataToCoord(stop.value)), + color: stop.color + }; + }); + var stopLen = colorStops.length; + var outerColors = visualMeta.outerColors.slice(); + + if (stopLen && colorStops[0].coord > colorStops[stopLen - 1].coord) { + colorStops.reverse(); + outerColors.reverse(); } - return rect; - } - function Grid(gridModel, ecModel, api) { - /** - * @type {Object.} - * @private - */ - this._coordsMap = {}; + var tinyExtent = 10; // Arbitrary value: 10px + var minCoord = colorStops[0].coord - tinyExtent; + var maxCoord = colorStops[stopLen - 1].coord + tinyExtent; + var coordSpan = maxCoord - minCoord; - /** - * @type {Array.} - * @private - */ - this._coordsList = []; + if (coordSpan < 1e-3) { + return 'transparent'; + } - /** - * @type {Object.} - * @private - */ - this._axesMap = {}; + zrUtil.each(colorStops, function (stop) { + stop.offset = (stop.coord - minCoord) / coordSpan; + }); + colorStops.push({ + offset: stopLen ? colorStops[stopLen - 1].offset : 0.5, + color: outerColors[1] || 'transparent' + }); + colorStops.unshift({ // notice colorStops.length have been changed. + offset: stopLen ? colorStops[0].offset : 0.5, + color: outerColors[0] || 'transparent' + }); - /** - * @type {Array.} - * @private - */ - this._axesList = []; + // zrUtil.each(colorStops, function (colorStop) { + // // Make sure each offset has rounded px to avoid not sharp edge + // colorStop.offset = (Math.round(colorStop.offset * (end - start) + start) - start) / (end - start); + // }); - this._initCartesian(gridModel, ecModel, api); + var gradient = new graphic.LinearGradient(0, 0, 0, 0, colorStops, true); + gradient[dimName] = minCoord; + gradient[dimName + '2'] = maxCoord; - this._model = gridModel; + return gradient; } - var gridProto = Grid.prototype; + module.exports = ChartView.extend({ - gridProto.type = 'grid'; + type: 'line', - gridProto.getRect = function () { - return this._rect; - }; + init: function () { + var lineGroup = new graphic.Group(); - gridProto.update = function (ecModel, api) { + var symbolDraw = new SymbolDraw(); + this.group.add(symbolDraw.group); - var axesMap = this._axesMap; + this._symbolDraw = symbolDraw; + this._lineGroup = lineGroup; + }, - this._updateScale(ecModel, this._model); + render: function (seriesModel, ecModel, api) { + var coordSys = seriesModel.coordinateSystem; + var group = this.group; + var data = seriesModel.getData(); + var lineStyleModel = seriesModel.getModel('lineStyle.normal'); + var areaStyleModel = seriesModel.getModel('areaStyle.normal'); - function ifAxisCanNotOnZero(otherAxisDim) { - var axes = axesMap[otherAxisDim]; - for (var idx in axes) { - if (axes.hasOwnProperty(idx)) { - var axis = axes[idx]; - if (axis && (axis.type === 'category' || !ifAxisCrossZero(axis))) { - return true; - } - } - } - return false; - } + var points = data.mapArray(data.getItemLayout, true); - each(axesMap.x, function (xAxis) { - niceScaleExtent(xAxis, xAxis.model); - }); - each(axesMap.y, function (yAxis) { - niceScaleExtent(yAxis, yAxis.model); - }); - // Fix configuration - each(axesMap.x, function (xAxis) { - // onZero can not be enabled in these two situations - // 1. When any other axis is a category axis - // 2. When any other axis not across 0 point - if (ifAxisCanNotOnZero('y')) { - xAxis.onZero = false; - } - }); - each(axesMap.y, function (yAxis) { - if (ifAxisCanNotOnZero('x')) { - yAxis.onZero = false; - } - }); + var isCoordSysPolar = coordSys.type === 'polar'; + var prevCoordSys = this._coordSys; - // Resize again if containLabel is enabled - // FIXME It may cause getting wrong grid size in data processing stage - this.resize(this._model, api); - }; + var symbolDraw = this._symbolDraw; + var polyline = this._polyline; + var polygon = this._polygon; - /** - * Resize the grid - * @param {module:echarts/coord/cartesian/GridModel} gridModel - * @param {module:echarts/ExtensionAPI} api - */ - gridProto.resize = function (gridModel, api) { + var lineGroup = this._lineGroup; - var gridRect = layout.getLayoutRect( - gridModel.getBoxLayoutParams(), { - width: api.getWidth(), - height: api.getHeight() - }); + var hasAnimation = seriesModel.get('animation'); - this._rect = gridRect; + var isAreaChart = !areaStyleModel.isEmpty(); + var stackedOnPoints = getStackedOnPoints(coordSys, data); - var axesList = this._axesList; + var showSymbol = seriesModel.get('showSymbol'); - adjustAxes(); + var isSymbolIgnore = showSymbol && !isCoordSysPolar && !seriesModel.get('showAllSymbol') + && this._getSymbolIgnoreFunc(data, coordSys); - // Minus label size - if (gridModel.get('containLabel')) { - each(axesList, function (axis) { - if (!axis.model.get('axisLabel.inside')) { - var labelUnionRect = getLabelUnionRect(axis); - if (labelUnionRect) { - var dim = axis.isHorizontal() ? 'height' : 'width'; - var margin = axis.model.get('axisLabel.margin'); - gridRect[dim] -= labelUnionRect[dim] + margin; - if (axis.position === 'top') { - gridRect.y += labelUnionRect.height + margin; - } - else if (axis.position === 'left') { - gridRect.x += labelUnionRect.width + margin; - } - } + // Remove temporary symbols + var oldData = this._data; + oldData && oldData.eachItemGraphicEl(function (el, idx) { + if (el.__temp) { + group.remove(el); + oldData.setItemGraphicEl(idx, null); } }); - adjustAxes(); - } + // Remove previous created symbols if showSymbol changed to false + if (!showSymbol) { + symbolDraw.remove(); + } - function adjustAxes() { - each(axesList, function (axis) { - var isHorizontal = axis.isHorizontal(); - var extent = isHorizontal ? [0, gridRect.width] : [0, gridRect.height]; - var idx = axis.inverse ? 1 : 0; - axis.setExtent(extent[idx], extent[1 - idx]); - updateAxisTransfrom(axis, isHorizontal ? gridRect.x : gridRect.y); - }); - } - }; + group.add(lineGroup); - /** - * @param {string} axisType - * @param {ndumber} [axisIndex] - */ - gridProto.getAxis = function (axisType, axisIndex) { - var axesMapOnDim = this._axesMap[axisType]; - if (axesMapOnDim != null) { - if (axisIndex == null) { - // Find first axis - for (var name in axesMapOnDim) { - if (axesMapOnDim.hasOwnProperty(name)) { - return axesMapOnDim[name]; - } + // FIXME step not support polar + var step = !isCoordSysPolar && seriesModel.get('step'); + // Initialization animation or coordinate system changed + if ( + !(polyline && prevCoordSys.type === coordSys.type && step === this._step) + ) { + showSymbol && symbolDraw.updateData(data, isSymbolIgnore); + + if (step) { + // TODO If stacked series is not step + points = turnPointsIntoStep(points, coordSys, step); + stackedOnPoints = turnPointsIntoStep(stackedOnPoints, coordSys, step); } - } - return axesMapOnDim[axisIndex]; - } - }; - gridProto.getCartesian = function (xAxisIndex, yAxisIndex) { - if (xAxisIndex != null && yAxisIndex != null) { - var key = 'x' + xAxisIndex + 'y' + yAxisIndex; - return this._coordsMap[key]; - } - else { - // When only xAxisIndex or yAxisIndex given, find its first cartesian. - for (var i = 0, coordList = this._coordsList; i < coordList.length; i++) { - if (coordList[i].getAxis('x').index === xAxisIndex - || coordList[i].getAxis('y').index === yAxisIndex - ) { - return coordList[i]; + polyline = this._newPolyline(points, coordSys, hasAnimation); + if (isAreaChart) { + polygon = this._newPolygon( + points, stackedOnPoints, + coordSys, hasAnimation + ); } + lineGroup.setClipPath(createClipShape(coordSys, true, seriesModel)); } - } - }; - - /** - * @implements - * see {module:echarts/CoodinateSystem} - */ - gridProto.convertToPixel = function (ecModel, finder, value) { - var target = this._findConvertTarget(ecModel, finder); + else { + if (isAreaChart && !polygon) { + // If areaStyle is added + polygon = this._newPolygon( + points, stackedOnPoints, + coordSys, hasAnimation + ); + } + else if (polygon && !isAreaChart) { + // If areaStyle is removed + lineGroup.remove(polygon); + polygon = this._polygon = null; + } - return target.cartesian - ? target.cartesian.dataToPoint(value) - : target.axis - ? target.axis.toGlobalCoord(target.axis.dataToCoord(value)) - : null; - }; + // Update clipPath + lineGroup.setClipPath(createClipShape(coordSys, false, seriesModel)); - /** - * @implements - * see {module:echarts/CoodinateSystem} - */ - gridProto.convertFromPixel = function (ecModel, finder, value) { - var target = this._findConvertTarget(ecModel, finder); + // Always update, or it is wrong in the case turning on legend + // because points are not changed + showSymbol && symbolDraw.updateData(data, isSymbolIgnore); - return target.cartesian - ? target.cartesian.pointToData(value) - : target.axis - ? target.axis.coordToData(target.axis.toLocalCoord(value)) - : null; - }; + // Stop symbol animation and sync with line points + // FIXME performance? + data.eachItemGraphicEl(function (el) { + el.stopAnimation(true); + }); - /** - * @inner - */ - gridProto._findConvertTarget = function (ecModel, finder) { - var seriesModel = finder.seriesModel; - var xAxisModel = finder.xAxisModel - || (seriesModel && seriesModel.getReferringComponents('xAxis')[0]); - var yAxisModel = finder.yAxisModel - || (seriesModel && seriesModel.getReferringComponents('yAxis')[0]); - var gridModel = finder.gridModel; - var coordsList = this._coordsList; - var cartesian; - var axis; + // In the case data zoom triggerred refreshing frequently + // Data may not change if line has a category axis. So it should animate nothing + if (!isPointsSame(this._stackedOnPoints, stackedOnPoints) + || !isPointsSame(this._points, points) + ) { + if (hasAnimation) { + this._updateAnimation( + data, stackedOnPoints, coordSys, api, step + ); + } + else { + // Not do it in update with animation + if (step) { + // TODO If stacked series is not step + points = turnPointsIntoStep(points, coordSys, step); + stackedOnPoints = turnPointsIntoStep(stackedOnPoints, coordSys, step); + } - if (seriesModel) { - cartesian = seriesModel.coordinateSystem; - zrUtil.indexOf(coordsList, cartesian) < 0 && (cartesian = null); - } - else if (xAxisModel && yAxisModel) { - cartesian = this.getCartesian(xAxisModel.componentIndex, yAxisModel.componentIndex); - } - else if (xAxisModel) { - axis = this.getAxis('x', xAxisModel.componentIndex); - } - else if (yAxisModel) { - axis = this.getAxis('y', yAxisModel.componentIndex); - } - // Lowest priority. - else if (gridModel) { - var grid = gridModel.coordinateSystem; - if (grid === this) { - cartesian = this._coordsList[0]; + polyline.setShape({ + points: points + }); + polygon && polygon.setShape({ + points: points, + stackedOnPoints: stackedOnPoints + }); + } + } } - } - - return {cartesian: cartesian, axis: axis}; - }; - - /** - * @implements - * see {module:echarts/CoodinateSystem} - */ - gridProto.containPoint = function (point) { - var coord = this._coordsList[0]; - if (coord) { - return coord.containPoint(point); - } - }; - /** - * Initialize cartesian coordinate systems - * @private - */ - gridProto._initCartesian = function (gridModel, ecModel, api) { - var axisPositionUsed = { - left: false, - right: false, - top: false, - bottom: false - }; + var visualColor = getVisualGradient(data, coordSys) || data.getVisual('color'); - var axesMap = { - x: {}, - y: {} - }; - var axesCount = { - x: 0, - y: 0 - }; + polyline.useStyle(zrUtil.defaults( + // Use color in lineStyle first + lineStyleModel.getLineStyle(), + { + fill: 'none', + stroke: visualColor, + lineJoin: 'bevel' + } + )); - /// Create axis - ecModel.eachComponent('xAxis', createAxisCreator('x'), this); - ecModel.eachComponent('yAxis', createAxisCreator('y'), this); + var smooth = seriesModel.get('smooth'); + smooth = getSmooth(seriesModel.get('smooth')); + polyline.setShape({ + smooth: smooth, + smoothMonotone: seriesModel.get('smoothMonotone'), + connectNulls: seriesModel.get('connectNulls') + }); - if (!axesCount.x || !axesCount.y) { - // Roll back when there no either x or y axis - this._axesMap = {}; - this._axesList = []; - return; - } + if (polygon) { + var stackedOn = data.stackedOn; + var stackedOnSmooth = 0; - this._axesMap = axesMap; + polygon.useStyle(zrUtil.defaults( + areaStyleModel.getAreaStyle(), + { + fill: visualColor, + opacity: 0.7, + lineJoin: 'bevel' + } + )); - /// Create cartesian2d - each(axesMap.x, function (xAxis, xAxisIndex) { - each(axesMap.y, function (yAxis, yAxisIndex) { - var key = 'x' + xAxisIndex + 'y' + yAxisIndex; - var cartesian = new Cartesian2D(key); + if (stackedOn) { + var stackedOnSeries = stackedOn.hostModel; + stackedOnSmooth = getSmooth(stackedOnSeries.get('smooth')); + } - cartesian.grid = this; + polygon.setShape({ + smooth: smooth, + stackedOnSmooth: stackedOnSmooth, + smoothMonotone: seriesModel.get('smoothMonotone'), + connectNulls: seriesModel.get('connectNulls') + }); + } - this._coordsMap[key] = cartesian; - this._coordsList.push(cartesian); + this._data = data; + // Save the coordinate system for transition animation when data changed + this._coordSys = coordSys; + this._stackedOnPoints = stackedOnPoints; + this._points = points; + this._step = step; + }, - cartesian.addAxis(xAxis); - cartesian.addAxis(yAxis); - }, this); - }, this); + dispose: function () {}, - function createAxisCreator(axisType) { - return function (axisModel, idx) { - if (!isAxisUsedInTheGrid(axisModel, gridModel, ecModel)) { - return; - } + highlight: function (seriesModel, ecModel, api, payload) { + var data = seriesModel.getData(); + var dataIndex = modelUtil.queryDataIndex(data, payload); - var axisPosition = axisModel.get('position'); - if (axisType === 'x') { - // Fix position - if (axisPosition !== 'top' && axisPosition !== 'bottom') { - // Default bottom of X - axisPosition = 'bottom'; - if (axisPositionUsed[axisPosition]) { - axisPosition = axisPosition === 'top' ? 'bottom' : 'top'; - } + if (!(dataIndex instanceof Array) && dataIndex != null && dataIndex >= 0) { + var symbol = data.getItemGraphicEl(dataIndex); + if (!symbol) { + // Create a temporary symbol if it is not exists + var pt = data.getItemLayout(dataIndex); + if (!pt) { + // Null data + return; } + symbol = new Symbol(data, dataIndex); + symbol.position = pt; + symbol.setZ( + seriesModel.get('zlevel'), + seriesModel.get('z') + ); + symbol.ignore = isNaN(pt[0]) || isNaN(pt[1]); + symbol.__temp = true; + data.setItemGraphicEl(dataIndex, symbol); + + // Stop scale animation + symbol.stopSymbolAnimation(true); + + this.group.add(symbol); } - else { - // Fix position - if (axisPosition !== 'left' && axisPosition !== 'right') { - // Default left of Y - axisPosition = 'left'; - if (axisPositionUsed[axisPosition]) { - axisPosition = axisPosition === 'left' ? 'right' : 'left'; - } + symbol.highlight(); + } + else { + // Highlight whole series + ChartView.prototype.highlight.call( + this, seriesModel, ecModel, api, payload + ); + } + }, + + downplay: function (seriesModel, ecModel, api, payload) { + var data = seriesModel.getData(); + var dataIndex = modelUtil.queryDataIndex(data, payload); + if (dataIndex != null && dataIndex >= 0) { + var symbol = data.getItemGraphicEl(dataIndex); + if (symbol) { + if (symbol.__temp) { + data.setItemGraphicEl(dataIndex, null); + this.group.remove(symbol); + } + else { + symbol.downplay(); } } - axisPositionUsed[axisPosition] = true; - - var axis = new Axis2D( - axisType, axisHelper.createScaleByModel(axisModel), - [0, 0], - axisModel.get('type'), - axisPosition + } + else { + // FIXME + // can not downplay completely. + // Downplay whole series + ChartView.prototype.downplay.call( + this, seriesModel, ecModel, api, payload ); + } + }, - var isCategory = axis.type === 'category'; - axis.onBand = isCategory && axisModel.get('boundaryGap'); - axis.inverse = axisModel.get('inverse'); + /** + * @param {module:zrender/container/Group} group + * @param {Array.>} points + * @private + */ + _newPolyline: function (points) { + var polyline = this._polyline; + // Remove previous created polyline + if (polyline) { + this._lineGroup.remove(polyline); + } - axis.onZero = axisModel.get('axisLine.onZero'); + polyline = new polyHelper.Polyline({ + shape: { + points: points + }, + silent: true, + z2: 10 + }); - // Inject axis into axisModel - axisModel.axis = axis; + this._lineGroup.add(polyline); - // Inject axisModel into axis - axis.model = axisModel; + this._polyline = polyline; - // Inject grid info axis - axis.grid = this; + return polyline; + }, - // Index of axis, can be used as key - axis.index = idx; + /** + * @param {module:zrender/container/Group} group + * @param {Array.>} stackedOnPoints + * @param {Array.>} points + * @private + */ + _newPolygon: function (points, stackedOnPoints) { + var polygon = this._polygon; + // Remove previous created polygon + if (polygon) { + this._lineGroup.remove(polygon); + } - this._axesList.push(axis); + polygon = new polyHelper.Polygon({ + shape: { + points: points, + stackedOnPoints: stackedOnPoints + }, + silent: true + }); - axesMap[axisType][idx] = axis; - axesCount[axisType]++; - }; - } - }; + this._lineGroup.add(polygon); - /** - * Update cartesian properties from series - * @param {module:echarts/model/Option} option - * @private - */ - gridProto._updateScale = function (ecModel, gridModel) { - // Reset scale - zrUtil.each(this._axesList, function (axis) { - axis.scale.setExtent(Infinity, -Infinity); - }); - ecModel.eachSeries(function (seriesModel) { - if (isCartesian2D(seriesModel)) { - var axesModels = findAxesModels(seriesModel, ecModel); - var xAxisModel = axesModels[0]; - var yAxisModel = axesModels[1]; + this._polygon = polygon; + return polygon; + }, + /** + * @private + */ + _getSymbolIgnoreFunc: function (data, coordSys) { + var categoryAxis = coordSys.getAxesByScale('ordinal')[0]; + // `getLabelInterval` is provided by echarts/component/axis + if (categoryAxis && categoryAxis.isLabelIgnored) { + return zrUtil.bind(categoryAxis.isLabelIgnored, categoryAxis); + } + }, - if (!isAxisUsedInTheGrid(xAxisModel, gridModel, ecModel) - || !isAxisUsedInTheGrid(yAxisModel, gridModel, ecModel) - ) { - return; + /** + * @private + */ + // FIXME Two value axis + _updateAnimation: function (data, stackedOnPoints, coordSys, api, step) { + var polyline = this._polyline; + var polygon = this._polygon; + var seriesModel = data.hostModel; + + var diff = lineAnimationDiff( + this._data, data, + this._stackedOnPoints, stackedOnPoints, + this._coordSys, coordSys + ); + + var current = diff.current; + var stackedOnCurrent = diff.stackedOnCurrent; + var next = diff.next; + var stackedOnNext = diff.stackedOnNext; + if (step) { + // TODO If stacked series is not step + current = turnPointsIntoStep(diff.current, coordSys, step); + stackedOnCurrent = turnPointsIntoStep(diff.stackedOnCurrent, coordSys, step); + next = turnPointsIntoStep(diff.next, coordSys, step); + stackedOnNext = turnPointsIntoStep(diff.stackedOnNext, coordSys, step); + } + // `diff.current` is subset of `current` (which should be ensured by + // turnPointsIntoStep), so points in `__points` can be updated when + // points in `current` are update during animation. + polyline.shape.__points = diff.current; + polyline.shape.points = current; + + graphic.updateProps(polyline, { + shape: { + points: next } + }, seriesModel); - var cartesian = this.getCartesian( - xAxisModel.componentIndex, yAxisModel.componentIndex - ); - var data = seriesModel.getData(); - var xAxis = cartesian.getAxis('x'); - var yAxis = cartesian.getAxis('y'); + if (polygon) { + polygon.setShape({ + points: current, + stackedOnPoints: stackedOnCurrent + }); + graphic.updateProps(polygon, { + shape: { + points: next, + stackedOnPoints: stackedOnNext + } + }, seriesModel); + } - if (data.type === 'list') { - unionExtent(data, xAxis, seriesModel); - unionExtent(data, yAxis, seriesModel); + var updatedDataInfo = []; + var diffStatus = diff.status; + + for (var i = 0; i < diffStatus.length; i++) { + var cmd = diffStatus[i].cmd; + if (cmd === '=') { + var el = data.getItemGraphicEl(diffStatus[i].idx1); + if (el) { + updatedDataInfo.push({ + el: el, + ptIdx: i // Index of points + }); + } } } - }, this); - function unionExtent(data, axis, seriesModel) { - each(seriesModel.coordDimToDataDim(axis.dim), function (dim) { - axis.scale.unionExtentFromData(data, dim); + if (polyline.animators && polyline.animators.length) { + polyline.animators[0].during(function () { + for (var i = 0; i < updatedDataInfo.length; i++) { + var el = updatedDataInfo[i].el; + el.attr('position', polyline.shape.__points[updatedDataInfo[i].ptIdx]); + } + }); + } + }, + + remove: function (ecModel) { + var group = this.group; + var oldData = this._data; + this._lineGroup.removeAll(); + this._symbolDraw.remove(true); + // Remove temporary created elements when highlighting + oldData && oldData.eachItemGraphicEl(function (el, idx) { + if (el.__temp) { + group.remove(el); + oldData.setItemGraphicEl(idx, null); + } }); + + this._polyline = + this._polygon = + this._coordSys = + this._points = + this._stackedOnPoints = + this._data = null; } - }; + }); - /** - * @inner - */ - function updateAxisTransfrom(axis, coordBase) { - var axisExtent = axis.getExtent(); - var axisExtentSum = axisExtent[0] + axisExtent[1]; - // Fast transform - axis.toGlobalCoord = axis.dim === 'x' - ? function (coord) { - return coord + coordBase; - } - : function (coord) { - return axisExtentSum - coord + coordBase; - }; - axis.toLocalCoord = axis.dim === 'x' - ? function (coord) { - return coord - coordBase; - } - : function (coord) { - return axisExtentSum - coord + coordBase; - }; - } +/***/ }, +/* 115 */ +/***/ function(module, exports, __webpack_require__) { - var axesTypes = ['xAxis', 'yAxis']; - /** - * @inner - */ - function findAxesModels(seriesModel, ecModel) { - return zrUtil.map(axesTypes, function (axisType) { - var axisModel = seriesModel.getReferringComponents(axisType)[0]; + /** + * @module echarts/chart/helper/SymbolDraw + */ - if (true) { - if (!axisModel) { - throw new Error(axisType + ' "' + zrUtil.retrieve( - seriesModel.get(axisType + 'Index'), - seriesModel.get(axisType + 'Id'), - 0 - ) + '" not found'); - } - } - return axisModel; - }); - } + + var graphic = __webpack_require__(44); + var Symbol = __webpack_require__(116); /** - * @inner + * @constructor + * @alias module:echarts/chart/helper/SymbolDraw + * @param {module:zrender/graphic/Group} [symbolCtor] */ - function isCartesian2D(seriesModel) { - return seriesModel.get('coordinateSystem') === 'cartesian2d'; - } + function SymbolDraw(symbolCtor) { + this.group = new graphic.Group(); - Grid.create = function (ecModel, api) { - var grids = []; - ecModel.eachComponent('grid', function (gridModel, idx) { - var grid = new Grid(gridModel, ecModel, api); - grid.name = 'grid_' + idx; - grid.resize(gridModel, api); + this._symbolCtor = symbolCtor || Symbol; + } - gridModel.coordinateSystem = grid; + var symbolDrawProto = SymbolDraw.prototype; - grids.push(grid); - }); + function symbolNeedsDraw(data, idx, isIgnore) { + var point = data.getItemLayout(idx); + // Is an object + // if (point && point.hasOwnProperty('point')) { + // point = point.point; + // } + return point && !isNaN(point[0]) && !isNaN(point[1]) && !(isIgnore && isIgnore(idx)) + && data.getItemVisual(idx, 'symbol') !== 'none'; + } + /** + * Update symbols draw by new data + * @param {module:echarts/data/List} data + * @param {Array.} [isIgnore] + */ + symbolDrawProto.updateData = function (data, isIgnore) { + var group = this.group; + var seriesModel = data.hostModel; + var oldData = this._data; - // Inject the coordinateSystems into seriesModel - ecModel.eachSeries(function (seriesModel) { - if (!isCartesian2D(seriesModel)) { - return; - } + var SymbolCtor = this._symbolCtor; - var axesModels = findAxesModels(seriesModel, ecModel); - var xAxisModel = axesModels[0]; - var yAxisModel = axesModels[1]; + var seriesScope = { + itemStyle: seriesModel.getModel('itemStyle.normal').getItemStyle(['color']), + hoverItemStyle: seriesModel.getModel('itemStyle.emphasis').getItemStyle(), + symbolRotate: seriesModel.get('symbolRotate'), + symbolOffset: seriesModel.get('symbolOffset'), + hoverAnimation: seriesModel.get('hoverAnimation'), - var gridModel = xAxisModel.getCoordSysModel(); + labelModel: seriesModel.getModel('label.normal'), + hoverLabelModel: seriesModel.getModel('label.emphasis') + }; - if (true) { - if (!gridModel) { - throw new Error( - 'Grid "' + zrUtil.retrieve( - xAxisModel.get('gridIndex'), - xAxisModel.get('gridId'), - 0 - ) + '" not found' - ); + data.diff(oldData) + .add(function (newIdx) { + var point = data.getItemLayout(newIdx); + if (symbolNeedsDraw(data, newIdx, isIgnore)) { + var symbolEl = new SymbolCtor(data, newIdx, seriesScope); + symbolEl.attr('position', point); + data.setItemGraphicEl(newIdx, symbolEl); + group.add(symbolEl); } - if (xAxisModel.getCoordSysModel() !== yAxisModel.getCoordSysModel()) { - throw new Error('xAxis and yAxis must use the same grid'); + }) + .update(function (newIdx, oldIdx) { + var symbolEl = oldData.getItemGraphicEl(oldIdx); + var point = data.getItemLayout(newIdx); + if (!symbolNeedsDraw(data, newIdx, isIgnore)) { + group.remove(symbolEl); + return; + } + if (!symbolEl) { + symbolEl = new SymbolCtor(data, newIdx); + symbolEl.attr('position', point); + } + else { + symbolEl.updateData(data, newIdx, seriesScope); + graphic.updateProps(symbolEl, { + position: point + }, seriesModel); } - } - var grid = gridModel.coordinateSystem; + // Add back + group.add(symbolEl); - seriesModel.coordinateSystem = grid.getCartesian( - xAxisModel.componentIndex, yAxisModel.componentIndex - ); - }); + data.setItemGraphicEl(newIdx, symbolEl); + }) + .remove(function (oldIdx) { + var el = oldData.getItemGraphicEl(oldIdx); + el && el.fadeOut(function () { + group.remove(el); + }); + }) + .execute(); - return grids; + this._data = data; }; - // For deciding which dimensions to use when creating list data - Grid.dimensions = Cartesian2D.prototype.dimensions; + symbolDrawProto.updateLayout = function () { + var data = this._data; + if (data) { + // Not use animation + data.eachItemGraphicEl(function (el, idx) { + var point = data.getItemLayout(idx); + el.attr('position', point); + }); + } + }; - __webpack_require__(26).register('cartesian2d', Grid); + symbolDrawProto.remove = function (enableAnimation) { + var group = this.group; + var data = this._data; + if (data) { + if (enableAnimation) { + data.eachItemGraphicEl(function (el) { + el.fadeOut(function () { + group.remove(el); + }); + }); + } + else { + group.removeAll(); + } + } + }; - module.exports = Grid; + module.exports = SymbolDraw; /***/ }, -/* 115 */ +/* 116 */ /***/ function(module, exports, __webpack_require__) { - + /** + * @module echarts/chart/helper/Symbol + */ - var OrdinalScale = __webpack_require__(116); - var IntervalScale = __webpack_require__(118); - __webpack_require__(119); - __webpack_require__(120); - var Scale = __webpack_require__(117); - var numberUtil = __webpack_require__(7); var zrUtil = __webpack_require__(4); - var textContain = __webpack_require__(8); - var axisHelper = {}; + var symbolUtil = __webpack_require__(104); + var graphic = __webpack_require__(44); + var numberUtil = __webpack_require__(7); + + function getSymbolSize(data, idx) { + var symbolSize = data.getItemVisual(idx, 'symbolSize'); + return symbolSize instanceof Array + ? symbolSize.slice() + : [+symbolSize, +symbolSize]; + } + + function getScale(symbolSize) { + return [symbolSize[0] / 2, symbolSize[1] / 2]; + } /** - * Get axis scale extent before niced. - * Item of returned array can only be number (including Infinity and NaN). + * @constructor + * @alias {module:echarts/chart/helper/Symbol} + * @param {module:echarts/data/List} data + * @param {number} idx + * @extends {module:zrender/graphic/Group} */ - axisHelper.getScaleExtent = function (axis, model) { - var scale = axis.scale; - var scaleType = scale.type; - - var min = model.getMin(); - var max = model.getMax(); - var fixMin = min != null; - var fixMax = max != null; - var originalExtent = scale.getExtent(); - - var axisDataLen; - var boundaryGap; - var span; - if (scaleType === 'ordinal') { - axisDataLen = (model.get('data') || []).length; - } - else { - boundaryGap = model.get('boundaryGap'); - if (!zrUtil.isArray(boundaryGap)) { - boundaryGap = [boundaryGap || 0, boundaryGap || 0]; - } - boundaryGap[0] = numberUtil.parsePercent(boundaryGap[0], 1); - boundaryGap[1] = numberUtil.parsePercent(boundaryGap[1], 1); - span = originalExtent[1] - originalExtent[0]; - } - - if (min == null) { - min = scaleType === 'ordinal' - ? (axisDataLen ? 0 : NaN) - : originalExtent[0] - boundaryGap[0] * span; - } - if (max == null) { - max = scaleType === 'ordinal' - ? (axisDataLen ? axisDataLen - 1 : NaN) - : originalExtent[1] + boundaryGap[1] * span; - } + function Symbol(data, idx, seriesScope) { + graphic.Group.call(this); - if (min === 'dataMin') { - min = originalExtent[0]; - } - if (max === 'dataMax') { - max = originalExtent[1]; - } + this.updateData(data, idx, seriesScope); + } - (min == null || !isFinite(min)) && (min = NaN); - (max == null || !isFinite(max)) && (max = NaN); + var symbolProto = Symbol.prototype; - axis.setBlank(zrUtil.eqNaN(min) || zrUtil.eqNaN(max)); + function driftSymbol(dx, dy) { + this.parent.drift(dx, dy); + } - // Evaluate if axis needs cross zero - if (model.getNeedCrossZero()) { - // Axis is over zero and min is not set - if (min > 0 && max > 0 && !fixMin) { - min = 0; - } - // Axis is under zero and max is not set - if (min < 0 && max < 0 && !fixMax) { - max = 0; - } - } + symbolProto._createSymbol = function (symbolType, data, idx, symbolSize) { + // Remove paths created before + this.removeAll(); - return [min, max]; - }; + var seriesModel = data.hostModel; + var color = data.getItemVisual(idx, 'color'); - axisHelper.niceScaleExtent = function (axis, model) { - var scale = axis.scale; - var extent = axisHelper.getScaleExtent(axis, model); - var fixMin = model.getMin() != null; - var fixMax = model.getMax() != null; - var splitNumber = model.get('splitNumber'); + // var symbolPath = symbolUtil.createSymbol( + // symbolType, -0.5, -0.5, 1, 1, color + // ); + // If width/height are set too small (e.g., set to 1) on ios10 + // and macOS Sierra, a circle stroke become a rect, no matter what + // the scale is set. So we set width/height as 2. See #4150. + var symbolPath = symbolUtil.createSymbol( + symbolType, -1, -1, 2, 2, color + ); - if (scale.type === 'log') { - scale.base = model.get('logBase'); - } + symbolPath.attr({ + z2: 100, + culling: true, + scale: [0, 0] + }); + // Rewrite drift method + symbolPath.drift = driftSymbol; - scale.setExtent(extent[0], extent[1]); - scale.niceExtent(splitNumber, fixMin, fixMax); + graphic.initProps(symbolPath, { + scale: getScale(symbolSize) + }, seriesModel, idx); + this._symbolType = symbolType; - // Use minInterval to constraint the calculated interval. - // If calculated interval is less than minInterval. increase the interval quantity until - // it is larger than minInterval. - // For example: - // minInterval is 1, calculated interval is 0.2, so increase it to be 1. In this way we can get - // an integer axis. - var minInterval = model.get('minInterval'); - if (isFinite(minInterval) && !fixMin && !fixMax && scale.type === 'interval') { - var interval = scale.getInterval(); - var intervalScale = Math.max(Math.abs(interval), minInterval) / interval; - // while (interval < minInterval) { - // var quantity = numberUtil.quantity(interval); - // interval = quantity * 10; - // scaleQuantity *= 10; - // } - extent = scale.getExtent(); - var origin = (extent[1] + extent[0]) / 2; - scale.setExtent( - intervalScale * (extent[0] - origin) + origin, - intervalScale * (extent[1] - origin) + origin - ); - scale.niceExtent(splitNumber); - } + this.add(symbolPath); + }; - // If some one specified the min, max. And the default calculated interval - // is not good enough. He can specify the interval. It is often appeared - // in angle axis with angle 0 - 360. Interval calculated in interval scale is hard - // to be 60. - // FIXME - var interval = model.get('interval'); - if (interval != null) { - scale.setInterval && scale.setInterval(interval); - } + /** + * Stop animation + * @param {boolean} toLastFrame + */ + symbolProto.stopSymbolAnimation = function (toLastFrame) { + this.childAt(0).stopAnimation(toLastFrame); }; /** - * @param {module:echarts/model/Model} model - * @param {string} [axisType] Default retrieve from model.type - * @return {module:echarts/scale/*} + * Get symbol path element */ - axisHelper.createScaleByModel = function(model, axisType) { - axisType = axisType || model.get('type'); - if (axisType) { - switch (axisType) { - // Buildin scale - case 'category': - return new OrdinalScale( - model.getCategories(), [Infinity, -Infinity] - ); - case 'value': - return new IntervalScale(); - // Extended scale, like time and log - default: - return (Scale.getClass(axisType) || IntervalScale).create(model); - } - } + symbolProto.getSymbolPath = function () { + return this.childAt(0); }; /** - * Check if the axis corss 0 + * Get scale(aka, current symbol size). + * Including the change caused by animation */ - axisHelper.ifAxisCrossZero = function (axis) { - var dataExtent = axis.scale.getExtent(); - var min = dataExtent[0]; - var max = dataExtent[1]; - return !((min > 0 && max > 0) || (min < 0 && max < 0)); + symbolProto.getScale = function () { + return this.childAt(0).scale; }; /** - * @param {Array.} tickCoords In axis self coordinate. - * @param {Array.} labels - * @param {string} font - * @param {boolean} isAxisHorizontal - * @return {number} + * Highlight symbol */ - axisHelper.getAxisLabelInterval = function (tickCoords, labels, font, isAxisHorizontal) { - // FIXME - // 不同角的axis和label,不只是horizontal和vertical. + symbolProto.highlight = function () { + this.childAt(0).trigger('emphasis'); + }; - var textSpaceTakenRect; - var autoLabelInterval = 0; - var accumulatedLabelInterval = 0; + /** + * Downplay symbol + */ + symbolProto.downplay = function () { + this.childAt(0).trigger('normal'); + }; - var step = 1; - if (labels.length > 40) { - // Simple optimization for large amount of labels - step = Math.floor(labels.length / 40); - } + /** + * @param {number} zlevel + * @param {number} z + */ + symbolProto.setZ = function (zlevel, z) { + var symbolPath = this.childAt(0); + symbolPath.zlevel = zlevel; + symbolPath.z = z; + }; - for (var i = 0; i < tickCoords.length; i += step) { - var tickCoord = tickCoords[i]; - var rect = textContain.getBoundingRect( - labels[i], font, 'center', 'top' - ); - rect[isAxisHorizontal ? 'x' : 'y'] += tickCoord; - // FIXME Magic number 1.5 - rect[isAxisHorizontal ? 'width' : 'height'] *= 1.3; - if (!textSpaceTakenRect) { - textSpaceTakenRect = rect.clone(); - } - // There is no space for current label; - else if (textSpaceTakenRect.intersect(rect)) { - accumulatedLabelInterval++; - autoLabelInterval = Math.max(autoLabelInterval, accumulatedLabelInterval); - } - else { - textSpaceTakenRect.union(rect); - // Reset - accumulatedLabelInterval = 0; - } - } - if (autoLabelInterval === 0 && step > 1) { - return step; - } - return (autoLabelInterval + 1) * step - 1; + symbolProto.setDraggable = function (draggable) { + var symbolPath = this.childAt(0); + symbolPath.draggable = draggable; + symbolPath.cursor = draggable ? 'move' : 'pointer'; }; /** - * @param {Object} axis - * @param {Function} labelFormatter - * @return {Array.} + * Update symbol properties + * @param {module:echarts/data/List} data + * @param {number} idx */ - axisHelper.getFormattedLabels = function (axis, labelFormatter) { - var scale = axis.scale; - var labels = scale.getTicksLabels(); - var ticks = scale.getTicks(); - if (typeof labelFormatter === 'string') { - labelFormatter = (function (tpl) { - return function (val) { - return tpl.replace('{value}', val != null ? val : ''); - }; - })(labelFormatter); - // Consider empty array - return zrUtil.map(labels, labelFormatter); - } - else if (typeof labelFormatter === 'function') { - return zrUtil.map(ticks, function (tick, idx) { - return labelFormatter( - axis.type === 'category' ? scale.getLabel(tick) : tick, - idx - ); - }, this); + symbolProto.updateData = function (data, idx, seriesScope) { + this.silent = false; + + var symbolType = data.getItemVisual(idx, 'symbol') || 'circle'; + var seriesModel = data.hostModel; + var symbolSize = getSymbolSize(data, idx); + + if (symbolType !== this._symbolType) { + this._createSymbol(symbolType, data, idx, symbolSize); } else { - return labels; + var symbolPath = this.childAt(0); + symbolPath.silent = false; + graphic.updateProps(symbolPath, { + scale: getScale(symbolSize) + }, seriesModel, idx); } + this._updateCommon(data, idx, symbolSize, seriesScope); + this._seriesModel = seriesModel; }; - module.exports = axisHelper; + // Update common properties + var normalStyleAccessPath = ['itemStyle', 'normal']; + var emphasisStyleAccessPath = ['itemStyle', 'emphasis']; + var normalLabelAccessPath = ['label', 'normal']; + var emphasisLabelAccessPath = ['label', 'emphasis']; + symbolProto._updateCommon = function (data, idx, symbolSize, seriesScope) { + var symbolPath = this.childAt(0); + var seriesModel = data.hostModel; + var color = data.getItemVisual(idx, 'color'); -/***/ }, -/* 116 */ -/***/ function(module, exports, __webpack_require__) { + // Reset style + if (symbolPath.type !== 'image') { + symbolPath.useStyle({ + strokeNoScale: true + }); + } - /** - * Linear continuous scale - * @module echarts/coord/scale/Ordinal - * - * http://en.wikipedia.org/wiki/Level_of_measurement - */ + seriesScope = seriesScope || null; - // FIXME only one data + var itemStyle = seriesScope && seriesScope.itemStyle; + var hoverItemStyle = seriesScope && seriesScope.hoverItemStyle; + var symbolRotate = seriesScope && seriesScope.symbolRotate; + var symbolOffset = seriesScope && seriesScope.symbolOffset; + var labelModel = seriesScope && seriesScope.labelModel; + var hoverLabelModel = seriesScope && seriesScope.hoverLabelModel; + var hoverAnimation = seriesScope && seriesScope.hoverAnimation; + if (!seriesScope || data.hasItemOption) { + var itemModel = data.getItemModel(idx); - var zrUtil = __webpack_require__(4); - var Scale = __webpack_require__(117); + // Color must be excluded. + // Because symbol provide setColor individually to set fill and stroke + itemStyle = itemModel.getModel(normalStyleAccessPath).getItemStyle(['color']); + hoverItemStyle = itemModel.getModel(emphasisStyleAccessPath).getItemStyle(); - var scaleProto = Scale.prototype; + symbolRotate = itemModel.getShallow('symbolRotate'); + symbolOffset = itemModel.getShallow('symbolOffset'); - var OrdinalScale = Scale.extend({ + labelModel = itemModel.getModel(normalLabelAccessPath); + hoverLabelModel = itemModel.getModel(emphasisLabelAccessPath); + hoverAnimation = itemModel.getShallow('hoverAnimation'); + } + else { + hoverItemStyle = zrUtil.extend({}, hoverItemStyle); + } - type: 'ordinal', + var elStyle = symbolPath.style; - init: function (data, extent) { - this._data = data; - this._extent = extent || [0, data.length - 1]; - }, + symbolPath.attr('rotation', (symbolRotate || 0) * Math.PI / 180 || 0); - parse: function (val) { - return typeof val === 'string' - ? zrUtil.indexOf(this._data, val) - // val might be float. - : Math.round(val); - }, + if (symbolOffset) { + symbolPath.attr('position', [ + numberUtil.parsePercent(symbolOffset[0], symbolSize[0]), + numberUtil.parsePercent(symbolOffset[1], symbolSize[1]) + ]); + } - contain: function (rank) { - rank = this.parse(rank); - return scaleProto.contain.call(this, rank) - && this._data[rank] != null; - }, + // PENDING setColor before setStyle!!! + symbolPath.setColor(color); - /** - * Normalize given rank or name to linear [0, 1] - * @param {number|string} [val] - * @return {number} - */ - normalize: function (val) { - return scaleProto.normalize.call(this, this.parse(val)); - }, + symbolPath.setStyle(itemStyle); - scale: function (val) { - return Math.round(scaleProto.scale.call(this, val)); - }, + var opacity = data.getItemVisual(idx, 'opacity'); + if (opacity != null) { + elStyle.opacity = opacity; + } - /** - * @return {Array} - */ - getTicks: function () { - var ticks = []; - var extent = this._extent; - var rank = extent[0]; + // Get last value dim + var dimensions = data.dimensions.slice(); + var valueDim; + var dataType; + while (dimensions.length && ( + valueDim = dimensions.pop(), + dataType = data.getDimensionInfo(valueDim).type, + dataType === 'ordinal' || dataType === 'time' + )) {} // jshint ignore:line - while (rank <= extent[1]) { - ticks.push(rank); - rank++; - } + if (valueDim != null && labelModel.getShallow('show')) { + graphic.setText(elStyle, labelModel, color); + elStyle.text = zrUtil.retrieve( + seriesModel.getFormattedLabel(idx, 'normal'), + data.get(valueDim, idx) + ); + } + else { + elStyle.text = ''; + } - return ticks; - }, + if (valueDim != null && hoverLabelModel.getShallow('show')) { + graphic.setText(hoverItemStyle, hoverLabelModel, color); + hoverItemStyle.text = zrUtil.retrieve( + seriesModel.getFormattedLabel(idx, 'emphasis'), + data.get(valueDim, idx) + ); + } + else { + hoverItemStyle.text = ''; + } - /** - * Get item on rank n - * @param {number} n - * @return {string} - */ - getLabel: function (n) { - return this._data[n]; - }, + symbolPath.off('mouseover') + .off('mouseout') + .off('emphasis') + .off('normal'); - /** - * @return {number} - */ - count: function () { - return this._extent[1] - this._extent[0] + 1; - }, + symbolPath.hoverStyle = hoverItemStyle; - /** - * @override - */ - unionExtentFromData: function (data, dim) { - this.unionExtent(data.getDataExtent(dim, false)); - }, + graphic.setHoverStyle(symbolPath); - niceTicks: zrUtil.noop, - niceExtent: zrUtil.noop - }); + var scale = getScale(symbolSize); - /** - * @return {module:echarts/scale/Time} - */ - OrdinalScale.create = function () { - return new OrdinalScale(); + if (hoverAnimation && seriesModel.isAnimationEnabled()) { + var onEmphasis = function() { + var ratio = scale[1] / scale[0]; + this.animateTo({ + scale: [ + Math.max(scale[0] * 1.1, scale[0] + 3), + Math.max(scale[1] * 1.1, scale[1] + 3 * ratio) + ] + }, 400, 'elasticOut'); + }; + var onNormal = function() { + this.animateTo({ + scale: scale + }, 400, 'elasticOut'); + }; + symbolPath.on('mouseover', onEmphasis) + .on('mouseout', onNormal) + .on('emphasis', onEmphasis) + .on('normal', onNormal); + } }; - module.exports = OrdinalScale; - + symbolProto.fadeOut = function (cb) { + var symbolPath = this.childAt(0); + // Avoid mistaken hover when fading out + this.silent = symbolPath.silent = true; + // Not show text when animating + symbolPath.style.text = ''; + graphic.updateProps(symbolPath, { + scale: [0, 0] + }, this._seriesModel, this.dataIndex, cb); + }; -/***/ }, -/* 117 */ -/***/ function(module, exports, __webpack_require__) { + zrUtil.inherits(Symbol, graphic.Group); - /** - * // Scale class management - * @module echarts/scale/Scale - */ + module.exports = Symbol; - var clazzUtil = __webpack_require__(13); +/***/ }, +/* 117 */ +/***/ function(module, exports) { - function Scale() { - /** - * Extent - * @type {Array.} - * @protected - */ - this._extent = [Infinity, -Infinity]; + - /** - * Step is calculated in adjustExtent - * @type {Array.} - * @protected - */ - this._interval = 0; + // var arrayDiff = require('zrender/lib/core/arrayDiff'); + // 'zrender/core/arrayDiff' has been used before, but it did + // not do well in performance when roam with fixed dataZoom window. - this.init && this.init.apply(this, arguments); + function sign(val) { + return val >= 0 ? 1 : -1; } - var scaleProto = Scale.prototype; - - /** - * Parse input val to valid inner number. - * @param {*} val - * @return {number} - */ - scaleProto.parse = function (val) { - // Notice: This would be a trap here, If the implementation - // of this method depends on extent, and this method is used - // before extent set (like in dataZoom), it would be wrong. - // Nevertheless, parse does not depend on extent generally. - return val; - }; - - scaleProto.contain = function (val) { - var extent = this._extent; - return val >= extent[0] && val <= extent[1]; - }; - - /** - * Normalize value to linear [0, 1], return 0.5 if extent span is 0 - * @param {number} val - * @return {number} - */ - scaleProto.normalize = function (val) { - var extent = this._extent; - if (extent[1] === extent[0]) { - return 0.5; - } - return (val - extent[0]) / (extent[1] - extent[0]); - }; - - /** - * Scale normalized value - * @param {number} val - * @return {number} - */ - scaleProto.scale = function (val) { - var extent = this._extent; - return val * (extent[1] - extent[0]) + extent[0]; - }; - - /** - * Set extent from data - * @param {Array.} other - */ - scaleProto.unionExtent = function (other) { - var extent = this._extent; - other[0] < extent[0] && (extent[0] = other[0]); - other[1] > extent[1] && (extent[1] = other[1]); - // not setExtent because in log axis it may transformed to power - // this.setExtent(extent[0], extent[1]); - }; - - /** - * Set extent from data - * @param {module:echarts/data/List} data - * @param {string} dim - */ - scaleProto.unionExtentFromData = function (data, dim) { - this.unionExtent(data.getDataExtent(dim, true)); - }; - - /** - * Get extent - * @return {Array.} - */ - scaleProto.getExtent = function () { - return this._extent.slice(); - }; + function getStackedOnPoint(coordSys, data, idx) { + var baseAxis = coordSys.getBaseAxis(); + var valueAxis = coordSys.getOtherAxis(baseAxis); + var valueStart = baseAxis.onZero + ? 0 : valueAxis.scale.getExtent()[0]; - /** - * Set extent - * @param {number} start - * @param {number} end - */ - scaleProto.setExtent = function (start, end) { - var thisExtent = this._extent; - if (!isNaN(start)) { - thisExtent[0] = start; - } - if (!isNaN(end)) { - thisExtent[1] = end; - } - }; + var valueDim = valueAxis.dim; + var baseDataOffset = valueDim === 'x' || valueDim === 'radius' ? 1 : 0; - /** - * @return {Array.} - */ - scaleProto.getTicksLabels = function () { - var labels = []; - var ticks = this.getTicks(); - for (var i = 0; i < ticks.length; i++) { - labels.push(this.getLabel(ticks[i])); + var stackedOnSameSign; + var stackedOn = data.stackedOn; + var val = data.get(valueDim, idx); + // Find first stacked value with same sign + while (stackedOn && + sign(stackedOn.get(valueDim, idx)) === sign(val) + ) { + stackedOnSameSign = stackedOn; + break; } - return labels; - }; - - clazzUtil.enableClassExtend(Scale); - clazzUtil.enableClassManagement(Scale, { - registerWhenExtend: true - }); + var stackedData = []; + stackedData[baseDataOffset] = data.get(baseAxis.dim, idx); + stackedData[1 - baseDataOffset] = stackedOnSameSign + ? stackedOnSameSign.get(valueDim, idx, true) : valueStart; - module.exports = Scale; + return coordSys.dataToPoint(stackedData); + } + // function convertToIntId(newIdList, oldIdList) { + // // Generate int id instead of string id. + // // Compare string maybe slow in score function of arrDiff -/***/ }, -/* 118 */ -/***/ function(module, exports, __webpack_require__) { + // // Assume id in idList are all unique + // var idIndicesMap = {}; + // var idx = 0; + // for (var i = 0; i < newIdList.length; i++) { + // idIndicesMap[newIdList[i]] = idx; + // newIdList[i] = idx++; + // } + // for (var i = 0; i < oldIdList.length; i++) { + // var oldId = oldIdList[i]; + // // Same with newIdList + // if (idIndicesMap[oldId]) { + // oldIdList[i] = idIndicesMap[oldId]; + // } + // else { + // oldIdList[i] = idx++; + // } + // } + // } - /** - * Interval scale - * @module echarts/scale/Interval - */ + function diffData(oldData, newData) { + var diffResult = []; + newData.diff(oldData) + .add(function (idx) { + diffResult.push({cmd: '+', idx: idx}); + }) + .update(function (newIdx, oldIdx) { + diffResult.push({cmd: '=', idx: oldIdx, idx1: newIdx}); + }) + .remove(function (idx) { + diffResult.push({cmd: '-', idx: idx}); + }) + .execute(); + return diffResult; + } - var numberUtil = __webpack_require__(7); - var formatUtil = __webpack_require__(6); - var Scale = __webpack_require__(117); + module.exports = function ( + oldData, newData, + oldStackedOnPoints, newStackedOnPoints, + oldCoordSys, newCoordSys + ) { + var diff = diffData(oldData, newData); - var mathFloor = Math.floor; - var mathCeil = Math.ceil; + // var newIdList = newData.mapArray(newData.getId); + // var oldIdList = oldData.mapArray(oldData.getId); - var getPrecisionSafe = numberUtil.getPrecisionSafe; - var roundingErrorFix = numberUtil.round; - /** - * @alias module:echarts/coord/scale/Interval - * @constructor - */ - var IntervalScale = Scale.extend({ + // convertToIntId(newIdList, oldIdList); - type: 'interval', + // // FIXME One data ? + // diff = arrayDiff(oldIdList, newIdList); - _interval: 0, + var currPoints = []; + var nextPoints = []; + // Points for stacking base line + var currStackedPoints = []; + var nextStackedPoints = []; - setExtent: function (start, end) { - var thisExtent = this._extent; - //start,end may be a Number like '25',so... - if (!isNaN(start)) { - thisExtent[0] = parseFloat(start); - } - if (!isNaN(end)) { - thisExtent[1] = parseFloat(end); - } - }, + var status = []; + var sortedIndices = []; + var rawIndices = []; + var dims = newCoordSys.dimensions; + for (var i = 0; i < diff.length; i++) { + var diffItem = diff[i]; + var pointAdded = true; - unionExtent: function (other) { - var extent = this._extent; - other[0] < extent[0] && (extent[0] = other[0]); - other[1] > extent[1] && (extent[1] = other[1]); + // FIXME, animation is not so perfect when dataZoom window moves fast + // Which is in case remvoing or add more than one data in the tail or head + switch (diffItem.cmd) { + case '=': + var currentPt = oldData.getItemLayout(diffItem.idx); + var nextPt = newData.getItemLayout(diffItem.idx1); + // If previous data is NaN, use next point directly + if (isNaN(currentPt[0]) || isNaN(currentPt[1])) { + currentPt = nextPt.slice(); + } + currPoints.push(currentPt); + nextPoints.push(nextPt); - // unionExtent may called by it's sub classes - IntervalScale.prototype.setExtent.call(this, extent[0], extent[1]); - }, - /** - * Get interval - */ - getInterval: function () { - if (!this._interval) { - this.niceTicks(); - } - return this._interval; - }, + currStackedPoints.push(oldStackedOnPoints[diffItem.idx]); + nextStackedPoints.push(newStackedOnPoints[diffItem.idx1]); - /** - * Set interval - */ - setInterval: function (interval) { - this._interval = interval; - // Dropped auto calculated niceExtent and use user setted extent - // We assume user wan't to set both interval, min, max to get a better result - this._niceExtent = this._extent.slice(); - }, + rawIndices.push(newData.getRawIndex(diffItem.idx1)); + break; + case '+': + var idx = diffItem.idx; + currPoints.push( + oldCoordSys.dataToPoint([ + newData.get(dims[0], idx, true), newData.get(dims[1], idx, true) + ]) + ); - /** - * @return {Array.} - */ - getTicks: function () { - if (!this._interval) { - this.niceTicks(); - } - var interval = this._interval; - var extent = this._extent; - var ticks = []; + nextPoints.push(newData.getItemLayout(idx).slice()); - // Consider this case: using dataZoom toolbox, zoom and zoom. - var safeLimit = 10000; + currStackedPoints.push( + getStackedOnPoint(oldCoordSys, newData, idx) + ); + nextStackedPoints.push(newStackedOnPoints[idx]); - if (interval) { - var niceExtent = this._niceExtent; - var precision = getPrecisionSafe(interval) + 2; + rawIndices.push(newData.getRawIndex(idx)); + break; + case '-': + var idx = diffItem.idx; + var rawIndex = oldData.getRawIndex(idx); + // Data is replaced. In the case of dynamic data queue + // FIXME FIXME FIXME + if (rawIndex !== idx) { + currPoints.push(oldData.getItemLayout(idx)); + nextPoints.push(newCoordSys.dataToPoint([ + oldData.get(dims[0], idx, true), oldData.get(dims[1], idx, true) + ])); - if (extent[0] < niceExtent[0]) { - ticks.push(extent[0]); - } - var tick = niceExtent[0]; + currStackedPoints.push(oldStackedOnPoints[idx]); + nextStackedPoints.push( + getStackedOnPoint( + newCoordSys, oldData, idx + ) + ); - while (tick <= niceExtent[1]) { - ticks.push(tick); - // Avoid rounding error - tick = roundingErrorFix(tick + interval, precision); - if (ticks.length > safeLimit) { - return []; + rawIndices.push(rawIndex); + } + else { + pointAdded = false; } - } - // Consider this case: the last item of ticks is smaller - // than niceExtent[1] and niceExtent[1] === extent[1]. - if (extent[1] > (ticks.length ? ticks[ticks.length - 1] : niceExtent[1])) { - ticks.push(extent[1]); - } - } - - return ticks; - }, - - /** - * @return {Array.} - */ - getTicksLabels: function () { - var labels = []; - var ticks = this.getTicks(); - for (var i = 0; i < ticks.length; i++) { - labels.push(this.getLabel(ticks[i])); } - return labels; - }, - - /** - * @param {number} n - * @return {number} - */ - getLabel: function (data) { - return formatUtil.addCommas(data); - }, - /** - * Update interval and extent of intervals for nice ticks - * - * @param {number} [splitNumber = 5] Desired number of ticks - */ - niceTicks: function (splitNumber) { - splitNumber = splitNumber || 5; - var extent = this._extent; - var span = extent[1] - extent[0]; - if (!isFinite(span)) { - return; - } - // User may set axis min 0 and data are all negative - // FIXME If it needs to reverse ? - if (span < 0) { - span = -span; - extent.reverse(); + // Original indices + if (pointAdded) { + status.push(diffItem); + sortedIndices.push(sortedIndices.length); } + } - // From "Nice Numbers for Graph Labels" of Graphic Gems - // var niceSpan = numberUtil.nice(span, false); - var step = roundingErrorFix( - numberUtil.nice(span / splitNumber, true), - Math.max( - getPrecisionSafe(extent[0]), - getPrecisionSafe(extent[1]) - // extent may be [0, 1], and step should have 1 more digits. - // To make it safe we add 2 more digits - ) + 2 - ); - - var precision = getPrecisionSafe(step) + 2; - // Niced extent inside original extent - var niceExtent = [ - roundingErrorFix(mathCeil(extent[0] / step) * step, precision), - roundingErrorFix(mathFloor(extent[1] / step) * step, precision) - ]; + // Diff result may be crossed if all items are changed + // Sort by data index + sortedIndices.sort(function (a, b) { + return rawIndices[a] - rawIndices[b]; + }); - this._interval = step; - this._niceExtent = niceExtent; - }, + var sortedCurrPoints = []; + var sortedNextPoints = []; - /** - * Nice extent. - * @param {number} [splitNumber = 5] Given approx tick number - * @param {boolean} [fixMin=false] - * @param {boolean} [fixMax=false] - */ - niceExtent: function (splitNumber, fixMin, fixMax) { - var extent = this._extent; - // If extent start and end are same, expand them - if (extent[0] === extent[1]) { - if (extent[0] !== 0) { - // Expand extent - var expandSize = extent[0]; - // In the fowllowing case - // Axis has been fixed max 100 - // Plus data are all 100 and axis extent are [100, 100]. - // Extend to the both side will cause expanded max is larger than fixed max. - // So only expand to the smaller side. - if (!fixMax) { - extent[1] += expandSize / 2; - extent[0] -= expandSize / 2; - } - else { - extent[0] -= expandSize / 2; - } - } - else { - extent[1] = 1; - } - } - var span = extent[1] - extent[0]; - // If there are no data and extent are [Infinity, -Infinity] - if (!isFinite(span)) { - extent[0] = 0; - extent[1] = 1; - } + var sortedCurrStackedPoints = []; + var sortedNextStackedPoints = []; - this.niceTicks(splitNumber); + var sortedStatus = []; + for (var i = 0; i < sortedIndices.length; i++) { + var idx = sortedIndices[i]; + sortedCurrPoints[i] = currPoints[idx]; + sortedNextPoints[i] = nextPoints[idx]; - // var extent = this._extent; - var interval = this._interval; + sortedCurrStackedPoints[i] = currStackedPoints[idx]; + sortedNextStackedPoints[i] = nextStackedPoints[idx]; - if (!fixMin) { - extent[0] = roundingErrorFix(mathFloor(extent[0] / interval) * interval); - } - if (!fixMax) { - extent[1] = roundingErrorFix(mathCeil(extent[1] / interval) * interval); - } + sortedStatus[i] = status[idx]; } - }); - /** - * @return {module:echarts/scale/Time} - */ - IntervalScale.create = function () { - return new IntervalScale(); - }; + return { + current: sortedCurrPoints, + next: sortedNextPoints, - module.exports = IntervalScale; + stackedOnCurrent: sortedCurrStackedPoints, + stackedOnNext: sortedNextStackedPoints, + status: sortedStatus + }; + }; /***/ }, -/* 119 */ +/* 118 */ /***/ function(module, exports, __webpack_require__) { - /** - * Interval scale - * @module echarts/coord/scale/Time - */ + // Poly path support NaN point + var Path = __webpack_require__(46); + var vec2 = __webpack_require__(10); - var zrUtil = __webpack_require__(4); - var numberUtil = __webpack_require__(7); - var formatUtil = __webpack_require__(6); + var vec2Min = vec2.min; + var vec2Max = vec2.max; - var IntervalScale = __webpack_require__(118); + var scaleAndAdd = vec2.scaleAndAdd; + var v2Copy = vec2.copy; - var intervalScaleProto = IntervalScale.prototype; + // Temporary variable + var v = []; + var cp0 = []; + var cp1 = []; - var mathCeil = Math.ceil; - var mathFloor = Math.floor; - var ONE_SECOND = 1000; - var ONE_MINUTE = ONE_SECOND * 60; - var ONE_HOUR = ONE_MINUTE * 60; - var ONE_DAY = ONE_HOUR * 24; + function isPointNull(p) { + return isNaN(p[0]) || isNaN(p[1]); + } - // FIXME 公用? - var bisect = function (a, x, lo, hi) { - while (lo < hi) { - var mid = lo + hi >>> 1; - if (a[mid][2] < x) { - lo = mid + 1; + function drawSegment( + ctx, points, start, segLen, allLen, + dir, smoothMin, smoothMax, smooth, smoothMonotone, connectNulls + ) { + var prevIdx = 0; + var idx = start; + for (var k = 0; k < segLen; k++) { + var p = points[idx]; + if (idx >= allLen || idx < 0) { + break; } - else { - hi = mid; + if (isPointNull(p)) { + if (connectNulls) { + idx += dir; + continue; + } + break; } - } - return lo; - }; - - /** - * @alias module:echarts/coord/scale/Time - * @constructor - */ - var TimeScale = IntervalScale.extend({ - type: 'time', - - // Overwrite - getLabel: function (val) { - var stepLvl = this._stepLvl; - - var date = new Date(val); - - return formatUtil.formatTime(stepLvl[0], date); - }, - // Overwrite - niceExtent: function (approxTickNum, fixMin, fixMax) { - var extent = this._extent; - // If extent start and end are same, expand them - if (extent[0] === extent[1]) { - // Expand extent - extent[0] -= ONE_DAY; - extent[1] += ONE_DAY; - } - // If there are no data and extent are [Infinity, -Infinity] - if (extent[1] === -Infinity && extent[0] === Infinity) { - var d = new Date(); - extent[1] = new Date(d.getFullYear(), d.getMonth(), d.getDate()); - extent[0] = extent[1] - ONE_DAY; + if (idx === start) { + ctx[dir > 0 ? 'moveTo' : 'lineTo'](p[0], p[1]); + v2Copy(cp0, p); } + else { + if (smooth > 0) { + var nextIdx = idx + dir; + var nextP = points[nextIdx]; + if (connectNulls) { + // Find next point not null + while (nextP && isPointNull(points[nextIdx])) { + nextIdx += dir; + nextP = points[nextIdx]; + } + } - this.niceTicks(approxTickNum); - - // var extent = this._extent; - var interval = this._interval; - - if (!fixMin) { - extent[0] = numberUtil.round(mathFloor(extent[0] / interval) * interval); - } - if (!fixMax) { - extent[1] = numberUtil.round(mathCeil(extent[1] / interval) * interval); - } - }, + var ratioNextSeg = 0.5; + var prevP = points[prevIdx]; + var nextP = points[nextIdx]; + // Last point + if (!nextP || isPointNull(nextP)) { + v2Copy(cp1, p); + } + else { + // If next data is null in not connect case + if (isPointNull(nextP) && !connectNulls) { + nextP = p; + } - // Overwrite - niceTicks: function (approxTickNum) { - approxTickNum = approxTickNum || 10; + vec2.sub(v, nextP, prevP); - var extent = this._extent; - var span = extent[1] - extent[0]; - var approxInterval = span / approxTickNum; - var scaleLevelsLen = scaleLevels.length; - var idx = bisect(scaleLevels, approxInterval, 0, scaleLevelsLen); + var lenPrevSeg; + var lenNextSeg; + if (smoothMonotone === 'x' || smoothMonotone === 'y') { + var dim = smoothMonotone === 'x' ? 0 : 1; + lenPrevSeg = Math.abs(p[dim] - prevP[dim]); + lenNextSeg = Math.abs(p[dim] - nextP[dim]); + } + else { + lenPrevSeg = vec2.dist(p, prevP); + lenNextSeg = vec2.dist(p, nextP); + } - var level = scaleLevels[Math.min(idx, scaleLevelsLen - 1)]; - var interval = level[2]; - // Same with interval scale if span is much larger than 1 year - if (level[0] === 'year') { - var yearSpan = span / interval; + // Use ratio of seg length + ratioNextSeg = lenNextSeg / (lenNextSeg + lenPrevSeg); - // From "Nice Numbers for Graph Labels" of Graphic Gems - // var niceYearSpan = numberUtil.nice(yearSpan, false); - var yearStep = numberUtil.nice(yearSpan / approxTickNum, true); + scaleAndAdd(cp1, p, v, -smooth * (1 - ratioNextSeg)); + } + // Smooth constraint + vec2Min(cp0, cp0, smoothMax); + vec2Max(cp0, cp0, smoothMin); + vec2Min(cp1, cp1, smoothMax); + vec2Max(cp1, cp1, smoothMin); - interval *= yearStep; + ctx.bezierCurveTo( + cp0[0], cp0[1], + cp1[0], cp1[1], + p[0], p[1] + ); + // cp0 of next segment + scaleAndAdd(cp0, p, v, smooth * ratioNextSeg); + } + else { + ctx.lineTo(p[0], p[1]); + } } - var niceExtent = [ - mathCeil(extent[0] / interval) * interval, - mathFloor(extent[1] / interval) * interval - ]; + prevIdx = idx; + idx += dir; + } - this._stepLvl = level; - // Interval will be used in getTicks - this._interval = interval; - this._niceExtent = niceExtent; - }, + return k; + } - parse: function (val) { - // val might be float. - return +numberUtil.parseDate(val); + function getBoundingBox(points, smoothConstraint) { + var ptMin = [Infinity, Infinity]; + var ptMax = [-Infinity, -Infinity]; + if (smoothConstraint) { + for (var i = 0; i < points.length; i++) { + var pt = points[i]; + if (pt[0] < ptMin[0]) { ptMin[0] = pt[0]; } + if (pt[1] < ptMin[1]) { ptMin[1] = pt[1]; } + if (pt[0] > ptMax[0]) { ptMax[0] = pt[0]; } + if (pt[1] > ptMax[1]) { ptMax[1] = pt[1]; } + } } - }); - - zrUtil.each(['contain', 'normalize'], function (methodName) { - TimeScale.prototype[methodName] = function (val) { - return intervalScaleProto[methodName].call(this, this.parse(val)); + return { + min: smoothConstraint ? ptMin : ptMax, + max: smoothConstraint ? ptMax : ptMin }; - }); + } - // Steps from d3 - var scaleLevels = [ - // Format step interval - ['hh:mm:ss', 1, ONE_SECOND], // 1s - ['hh:mm:ss', 5, ONE_SECOND * 5], // 5s - ['hh:mm:ss', 10, ONE_SECOND * 10], // 10s - ['hh:mm:ss', 15, ONE_SECOND * 15], // 15s - ['hh:mm:ss', 30, ONE_SECOND * 30], // 30s - ['hh:mm\nMM-dd',1, ONE_MINUTE], // 1m - ['hh:mm\nMM-dd',5, ONE_MINUTE * 5], // 5m - ['hh:mm\nMM-dd',10, ONE_MINUTE * 10], // 10m - ['hh:mm\nMM-dd',15, ONE_MINUTE * 15], // 15m - ['hh:mm\nMM-dd',30, ONE_MINUTE * 30], // 30m - ['hh:mm\nMM-dd',1, ONE_HOUR], // 1h - ['hh:mm\nMM-dd',2, ONE_HOUR * 2], // 2h - ['hh:mm\nMM-dd',6, ONE_HOUR * 6], // 6h - ['hh:mm\nMM-dd',12, ONE_HOUR * 12], // 12h - ['MM-dd\nyyyy', 1, ONE_DAY], // 1d - ['week', 7, ONE_DAY * 7], // 7d - ['month', 1, ONE_DAY * 31], // 1M - ['quarter', 3, ONE_DAY * 380 / 4], // 3M - ['half-year', 6, ONE_DAY * 380 / 2], // 6M - ['year', 1, ONE_DAY * 380] // 1Y - ]; + module.exports = { - /** - * @return {module:echarts/scale/Time} - */ - TimeScale.create = function () { - return new TimeScale(); - }; + Polyline: Path.extend({ - module.exports = TimeScale; + type: 'ec-polyline', + shape: { + points: [], -/***/ }, -/* 120 */ -/***/ function(module, exports, __webpack_require__) { + smooth: 0, - /** - * Log scale - * @module echarts/scale/Log - */ + smoothConstraint: true, + smoothMonotone: null, - var zrUtil = __webpack_require__(4); - var Scale = __webpack_require__(117); - var numberUtil = __webpack_require__(7); + connectNulls: false + }, - // Use some method of IntervalScale - var IntervalScale = __webpack_require__(118); + style: { + fill: null, - var scaleProto = Scale.prototype; - var intervalScaleProto = IntervalScale.prototype; + stroke: '#000' + }, - var getPrecisionSafe = numberUtil.getPrecisionSafe; - var roundingErrorFix = numberUtil.round; + buildPath: function (ctx, shape) { + var points = shape.points; - var mathFloor = Math.floor; - var mathCeil = Math.ceil; - var mathPow = Math.pow; + var i = 0; + var len = points.length; - var mathLog = Math.log; + var result = getBoundingBox(points, shape.smoothConstraint); - var LogScale = Scale.extend({ + if (shape.connectNulls) { + // Must remove first and last null values avoid draw error in polygon + for (; len > 0; len--) { + if (!isPointNull(points[len - 1])) { + break; + } + } + for (; i < len; i++) { + if (!isPointNull(points[i])) { + break; + } + } + } + while (i < len) { + i += drawSegment( + ctx, points, i, len, len, + 1, result.min, result.max, shape.smooth, + shape.smoothMonotone, shape.connectNulls + ) + 1; + } + } + }), - type: 'log', + Polygon: Path.extend({ - base: 10, + type: 'ec-polygon', - $constructor: function () { - Scale.apply(this, arguments); - this._originalScale = new IntervalScale(); - }, + shape: { + points: [], - /** - * @return {Array.} - */ - getTicks: function () { - var originalScale = this._originalScale; - var extent = this._extent; - var originalExtent = originalScale.getExtent(); + // Offset between stacked base points and points + stackedOnPoints: [], - return zrUtil.map(intervalScaleProto.getTicks.call(this), function (val) { - var powVal = numberUtil.round(mathPow(this.base, val)); + smooth: 0, - // Fix #4158 - powVal = (val === extent[0] && originalScale.__fixMin) - ? fixRoundingError(powVal, originalExtent[0]) - : powVal; - powVal = (val === extent[1] && originalScale.__fixMax) - ? fixRoundingError(powVal, originalExtent[1]) - : powVal; + stackedOnSmooth: 0, - return powVal; - }, this); - }, + smoothConstraint: true, - /** - * @param {number} val - * @return {string} - */ - getLabel: intervalScaleProto.getLabel, + smoothMonotone: null, - /** - * @param {number} val - * @return {number} - */ - scale: function (val) { - val = scaleProto.scale.call(this, val); - return mathPow(this.base, val); - }, + connectNulls: false + }, - /** - * @param {number} start - * @param {number} end - */ - setExtent: function (start, end) { - var base = this.base; - start = mathLog(start) / mathLog(base); - end = mathLog(end) / mathLog(base); - intervalScaleProto.setExtent.call(this, start, end); - }, + buildPath: function (ctx, shape) { + var points = shape.points; + var stackedOnPoints = shape.stackedOnPoints; - /** - * @return {number} end - */ - getExtent: function () { - var base = this.base; - var extent = scaleProto.getExtent.call(this); - extent[0] = mathPow(base, extent[0]); - extent[1] = mathPow(base, extent[1]); + var i = 0; + var len = points.length; + var smoothMonotone = shape.smoothMonotone; + var bbox = getBoundingBox(points, shape.smoothConstraint); + var stackedOnBBox = getBoundingBox(stackedOnPoints, shape.smoothConstraint); - // Fix #4158 - var originalScale = this._originalScale; - var originalExtent = originalScale.getExtent(); - originalScale.__fixMin && (extent[0] = fixRoundingError(extent[0], originalExtent[0])); - originalScale.__fixMax && (extent[1] = fixRoundingError(extent[1], originalExtent[1])); + if (shape.connectNulls) { + // Must remove first and last null values avoid draw error in polygon + for (; len > 0; len--) { + if (!isPointNull(points[len - 1])) { + break; + } + } + for (; i < len; i++) { + if (!isPointNull(points[i])) { + break; + } + } + } + while (i < len) { + var k = drawSegment( + ctx, points, i, len, len, + 1, bbox.min, bbox.max, shape.smooth, + smoothMonotone, shape.connectNulls + ); + drawSegment( + ctx, stackedOnPoints, i + k - 1, k, len, + -1, stackedOnBBox.min, stackedOnBBox.max, shape.stackedOnSmooth, + smoothMonotone, shape.connectNulls + ); + i += k + 1; - return extent; - }, + ctx.closePath(); + } + } + }) + }; - /** - * @param {Array.} extent - */ - unionExtent: function (extent) { - this._originalScale.unionExtent(extent); - var base = this.base; - extent[0] = mathLog(extent[0]) / mathLog(base); - extent[1] = mathLog(extent[1]) / mathLog(base); - scaleProto.unionExtent.call(this, extent); - }, +/***/ }, +/* 119 */ +/***/ function(module, exports) { - /** - * @override - */ - unionExtentFromData: function (data, dim) { - this.unionExtent(data.getDataExtent(dim, true, function (val) { - return val > 0; - })); - }, + - /** - * Update interval and extent of intervals for nice ticks - * @param {number} [approxTickNum = 10] Given approx tick number - */ - niceTicks: function (approxTickNum) { - approxTickNum = approxTickNum || 10; - var extent = this._extent; - var span = extent[1] - extent[0]; - if (span === Infinity || span <= 0) { - return; - } + module.exports = function (seriesType, defaultSymbolType, legendSymbol, ecModel, api) { - var interval = numberUtil.quantity(span); - var err = approxTickNum / span * interval; + // Encoding visual for all series include which is filtered for legend drawing + ecModel.eachRawSeriesByType(seriesType, function (seriesModel) { + var data = seriesModel.getData(); - // Filter ticks to get closer to the desired count. - if (err <= 0.5) { - interval *= 10; - } + var symbolType = seriesModel.get('symbol') || defaultSymbolType; + var symbolSize = seriesModel.get('symbolSize'); - // Interval should be integer - while (!isNaN(interval) && Math.abs(interval) < 1 && Math.abs(interval) > 0) { - interval *= 10; - } + data.setVisual({ + legendSymbol: legendSymbol || symbolType, + symbol: symbolType, + symbolSize: symbolSize + }); - var niceExtent = [ - numberUtil.round(mathCeil(extent[0] / interval) * interval), - numberUtil.round(mathFloor(extent[1] / interval) * interval) - ]; + // Only visible series has each data be visual encoded + if (!ecModel.isSeriesFiltered(seriesModel)) { + if (typeof symbolSize === 'function') { + data.each(function (idx) { + var rawValue = seriesModel.getRawValue(idx); + // FIXME + var params = seriesModel.getDataParams(idx); + data.setItemVisual(idx, 'symbolSize', symbolSize(rawValue, params)); + }); + } + data.each(function (idx) { + var itemModel = data.getItemModel(idx); + var itemSymbolType = itemModel.getShallow('symbol', true); + var itemSymbolSize = itemModel.getShallow('symbolSize', true); + // If has item symbol + if (itemSymbolType != null) { + data.setItemVisual(idx, 'symbol', itemSymbolType); + } + if (itemSymbolSize != null) { + // PENDING Transform symbolSize ? + data.setItemVisual(idx, 'symbolSize', itemSymbolSize); + } + }); + } + }); + }; - this._interval = interval; - this._niceExtent = niceExtent; - }, - /** - * Nice extent. - * @param {number} [approxTickNum = 10] Given approx tick number - * @param {boolean} [fixMin=false] - * @param {boolean} [fixMax=false] - */ - niceExtent: function (splitNumber, fixMin, fixMax) { - intervalScaleProto.niceExtent.call(this, splitNumber, fixMin, fixMax); +/***/ }, +/* 120 */ +/***/ function(module, exports) { - var originalScale = this._originalScale; - originalScale.__fixMin = fixMin; - originalScale.__fixMax = fixMax; - } + - }); + module.exports = function (seriesType, ecModel) { + ecModel.eachSeriesByType(seriesType, function (seriesModel) { + var data = seriesModel.getData(); + var coordSys = seriesModel.coordinateSystem; - zrUtil.each(['contain', 'normalize'], function (methodName) { - LogScale.prototype[methodName] = function (val) { - val = mathLog(val) / mathLog(this.base); - return scaleProto[methodName].call(this, val); - }; - }); + if (coordSys) { + var dims = coordSys.dimensions; - LogScale.create = function () { - return new LogScale(); + if (dims.length === 1) { + data.each(dims[0], function (x, idx) { + // Also {Array.}, not undefined to avoid if...else... statement + data.setItemLayout(idx, isNaN(x) ? [NaN, NaN] : coordSys.dataToPoint(x)); + }); + } + else if (dims.length === 2) { + data.each(dims, function (x, y, idx) { + // Also {Array.}, not undefined to avoid if...else... statement + data.setItemLayout( + idx, (isNaN(x) || isNaN(y)) ? [NaN, NaN] : coordSys.dataToPoint([x, y]) + ); + }, true); + } + } + }); }; - function fixRoundingError(val, originalVal) { - return roundingErrorFix(val, getPrecisionSafe(originalVal)); - } - - module.exports = LogScale; /***/ }, /* 121 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - - var zrUtil = __webpack_require__(4); - var Cartesian = __webpack_require__(122); - - function Cartesian2D(name) { - - Cartesian.call(this, name); - } - - Cartesian2D.prototype = { +/***/ function(module, exports) { - constructor: Cartesian2D, - - type: 'cartesian2d', - - /** - * @type {Array.} - * @readOnly - */ - dimensions: ['x', 'y'], - - /** - * Base axis will be used on stacking. - * - * @return {module:echarts/coord/cartesian/Axis2D} - */ - getBaseAxis: function () { - return this.getAxesByScale('ordinal')[0] - || this.getAxesByScale('time')[0] - || this.getAxis('x'); - }, - - /** - * If contain point - * @param {Array.} point - * @return {boolean} - */ - containPoint: function (point) { - var axisX = this.getAxis('x'); - var axisY = this.getAxis('y'); - return axisX.contain(axisX.toLocalCoord(point[0])) - && axisY.contain(axisY.toLocalCoord(point[1])); - }, - - /** - * If contain data - * @param {Array.} data - * @return {boolean} - */ - containData: function (data) { - return this.getAxis('x').containData(data[0]) - && this.getAxis('y').containData(data[1]); + + var samplers = { + average: function (frame) { + var sum = 0; + var count = 0; + for (var i = 0; i < frame.length; i++) { + if (!isNaN(frame[i])) { + sum += frame[i]; + count++; + } + } + // Return NaN if count is 0 + return count === 0 ? NaN : sum / count; }, - - /** - * Convert series data to an array of points - * @param {module:echarts/data/List} data - * @param {boolean} stack - * @return {Array} - * Return array of points. For example: - * `[[10, 10], [20, 20], [30, 30]]` - */ - dataToPoints: function (data, stack) { - return data.mapArray(['x', 'y'], function (x, y) { - return this.dataToPoint([x, y]); - }, stack, this); + sum: function (frame) { + var sum = 0; + for (var i = 0; i < frame.length; i++) { + // Ignore NaN + sum += frame[i] || 0; + } + return sum; }, - - /** - * @param {Array.} data - * @param {boolean} [clamp=false] - * @return {Array.} - */ - dataToPoint: function (data, clamp) { - var xAxis = this.getAxis('x'); - var yAxis = this.getAxis('y'); - return [ - xAxis.toGlobalCoord(xAxis.dataToCoord(data[0], clamp)), - yAxis.toGlobalCoord(yAxis.dataToCoord(data[1], clamp)) - ]; + max: function (frame) { + var max = -Infinity; + for (var i = 0; i < frame.length; i++) { + frame[i] > max && (max = frame[i]); + } + return max; }, - - /** - * @param {Array.} point - * @param {boolean} [clamp=false] - * @return {Array.} - */ - pointToData: function (point, clamp) { - var xAxis = this.getAxis('x'); - var yAxis = this.getAxis('y'); - return [ - xAxis.coordToData(xAxis.toLocalCoord(point[0]), clamp), - yAxis.coordToData(yAxis.toLocalCoord(point[1]), clamp) - ]; + min: function (frame) { + var min = Infinity; + for (var i = 0; i < frame.length; i++) { + frame[i] < min && (min = frame[i]); + } + return min; }, - - /** - * Get other axis - * @param {module:echarts/coord/cartesian/Axis2D} axis - */ - getOtherAxis: function (axis) { - return this.getAxis(axis.dim === 'x' ? 'y' : 'x'); + // TODO + // Median + nearest: function (frame) { + return frame[0]; } }; - zrUtil.inherits(Cartesian2D, Cartesian); - - module.exports = Cartesian2D; + var indexSampler = function (frame, value) { + return Math.round(frame.length / 2); + }; + module.exports = function (seriesType, ecModel, api) { + ecModel.eachSeriesByType(seriesType, function (seriesModel) { + var data = seriesModel.getData(); + var sampling = seriesModel.get('sampling'); + var coordSys = seriesModel.coordinateSystem; + // Only cartesian2d support down sampling + if (coordSys.type === 'cartesian2d' && sampling) { + var baseAxis = coordSys.getBaseAxis(); + var valueAxis = coordSys.getOtherAxis(baseAxis); + var extent = baseAxis.getExtent(); + // Coordinste system has been resized + var size = extent[1] - extent[0]; + var rate = Math.round(data.count() / size); + if (rate > 1) { + var sampler; + if (typeof sampling === 'string') { + sampler = samplers[sampling]; + } + else if (typeof sampling === 'function') { + sampler = sampling; + } + if (sampler) { + data = data.downSample( + valueAxis.dim, 1 / rate, sampler, indexSampler + ); + seriesModel.setData(data); + } + } + } + }, this); + }; /***/ }, /* 122 */ /***/ function(module, exports, __webpack_require__) { - 'use strict'; - /** - * Cartesian coordinate system - * @module echarts/coord/Cartesian - * - */ - - - var zrUtil = __webpack_require__(4); - - function dimAxisMapper(dim) { - return this._axes[dim]; - } - - /** - * @alias module:echarts/coord/Cartesian - * @constructor - */ - var Cartesian = function (name) { - this._axes = {}; - - this._dimList = []; - - /** - * @type {string} - */ - this.name = name || ''; - }; - - Cartesian.prototype = { - - constructor: Cartesian, + - type: 'cartesian', + __webpack_require__(123); - /** - * Get axis - * @param {number|string} dim - * @return {module:echarts/coord/Cartesian~Axis} - */ - getAxis: function (dim) { - return this._axes[dim]; - }, + __webpack_require__(142); - /** - * Get axes list - * @return {Array.} - */ - getAxes: function () { - return zrUtil.map(this._dimList, dimAxisMapper, this); - }, - /** - * Get axes list by given scale type - */ - getAxesByScale: function (scaleType) { - scaleType = scaleType.toLowerCase(); - return zrUtil.filter( - this.getAxes(), - function (axis) { - return axis.scale.type === scaleType; - } - ); - }, - /** - * Add axis - * @param {module:echarts/coord/Cartesian.Axis} - */ - addAxis: function (axis) { - var dim = axis.dim; +/***/ }, +/* 123 */ +/***/ function(module, exports, __webpack_require__) { - this._axes[dim] = axis; + 'use strict'; - this._dimList.push(dim); - }, - /** - * Convert data to coord in nd space - * @param {Array.|Object.} val - * @return {Array.|Object.} - */ - dataToCoord: function (val) { - return this._dataCoordConvert(val, 'dataToCoord'); - }, + var graphic = __webpack_require__(44); + var zrUtil = __webpack_require__(4); + var echarts = __webpack_require__(1); - /** - * Convert coord in nd space to data - * @param {Array.|Object.} val - * @return {Array.|Object.} - */ - coordToData: function (val) { - return this._dataCoordConvert(val, 'coordToData'); - }, + __webpack_require__(124); - _dataCoordConvert: function (input, method) { - var dimList = this._dimList; + __webpack_require__(133); - var output = input instanceof Array ? [] : {}; + // Grid view + echarts.extendComponentView({ - for (var i = 0; i < dimList.length; i++) { - var dim = dimList[i]; - var axis = this._axes[dim]; + type: 'grid', - output[dim] = axis[method](input[dim]); + render: function (gridModel, ecModel) { + this.group.removeAll(); + if (gridModel.get('show')) { + this.group.add(new graphic.Rect({ + shape: gridModel.coordinateSystem.getRect(), + style: zrUtil.defaults({ + fill: gridModel.get('backgroundColor') + }, gridModel.getItemStyle()), + silent: true, + z2: -1 + })); } - - return output; } - }; - module.exports = Cartesian; + }); + + echarts.registerPreprocessor(function (option) { + // Only create grid when need + if (option.xAxis && option.yAxis && !option.grid) { + option.grid = {}; + } + }); /***/ }, -/* 123 */ +/* 124 */ /***/ function(module, exports, __webpack_require__) { - + /** + * Grid is a region which contains at most 4 cartesian systems + * + * TODO Default cartesian + */ + var factory = exports; + + var layout = __webpack_require__(21); + var axisHelper = __webpack_require__(105); var zrUtil = __webpack_require__(4); - var Axis = __webpack_require__(124); - var axisLabelInterval = __webpack_require__(125); + var Cartesian2D = __webpack_require__(125); + var Axis2D = __webpack_require__(127); + + var each = zrUtil.each; + + var ifAxisCrossZero = axisHelper.ifAxisCrossZero; + var niceScaleExtent = axisHelper.niceScaleExtent; + + // 依赖 GridModel, AxisModel 做预处理 + __webpack_require__(129); /** - * Extend axis 2d - * @constructor module:echarts/coord/cartesian/Axis2D - * @extends {module:echarts/coord/cartesian/Axis} - * @param {string} dim - * @param {*} scale - * @param {Array.} coordExtent - * @param {string} axisType - * @param {string} position + * Check if the axis is used in the specified grid + * @inner */ - var Axis2D = function (dim, scale, coordExtent, axisType, position) { - Axis.call(this, dim, scale, coordExtent); - /** - * Axis type - * - 'category' - * - 'value' - * - 'time' - * - 'log' - * @type {string} - */ - this.type = axisType || 'value'; + function isAxisUsedInTheGrid(axisModel, gridModel, ecModel) { + return axisModel.getCoordSysModel() === gridModel; + } + + function getLabelUnionRect(axis) { + var axisModel = axis.model; + var labels = axisModel.getFormattedLabels(); + var textStyleModel = axisModel.getModel('axisLabel.textStyle'); + var rect; + var step = 1; + var labelCount = labels.length; + if (labelCount > 40) { + // Simple optimization for large amount of labels + step = Math.ceil(labelCount / 40); + } + for (var i = 0; i < labelCount; i += step) { + if (!axis.isLabelIgnored(i)) { + var singleRect = textStyleModel.getTextRect(labels[i]); + // FIXME consider label rotate + rect ? rect.union(singleRect) : (rect = singleRect); + } + } + return rect; + } + function Grid(gridModel, ecModel, api) { /** - * Axis position - * - 'top' - * - 'bottom' - * - 'left' - * - 'right' + * @type {Object.} + * @private */ - this.position = position || 'bottom'; - }; - - Axis2D.prototype = { - - constructor: Axis2D, + this._coordsMap = {}; /** - * Index of axis, can be used as key + * @type {Array.} + * @private */ - index: 0, + this._coordsList = []; + /** - * If axis is on the zero position of the other axis - * @type {boolean} + * @type {Object.} + * @private */ - onZero: false, + this._axesMap = {}; /** - * Axis model - * @param {module:echarts/coord/cartesian/AxisModel} + * @type {Array.} + * @private */ - model: null, - - isHorizontal: function () { - var position = this.position; - return position === 'top' || position === 'bottom'; - }, + this._axesList = []; - getGlobalExtent: function () { - var ret = this.getExtent(); - ret[0] = this.toGlobalCoord(ret[0]); - ret[1] = this.toGlobalCoord(ret[1]); - return ret; - }, + this._initCartesian(gridModel, ecModel, api); - /** - * @return {number} - */ - getLabelInterval: function () { - var labelInterval = this._labelInterval; - if (!labelInterval) { - labelInterval = this._labelInterval = axisLabelInterval(this); - } - return labelInterval; - }, + this.model = gridModel; + } - /** - * If label is ignored. - * Automatically used when axis is category and label can not be all shown - * @param {number} idx - * @return {boolean} - */ - isLabelIgnored: function (idx) { - if (this.type === 'category') { - var labelInterval = this.getLabelInterval(); - return ((typeof labelInterval === 'function') - && !labelInterval(idx, this.scale.getLabel(idx))) - || idx % (labelInterval + 1); - } - }, + var gridProto = Grid.prototype; - /** - * Transform global coord to local coord, - * i.e. var localCoord = axis.toLocalCoord(80); - * designate by module:echarts/coord/cartesian/Grid. - * @type {Function} - */ - toLocalCoord: null, + gridProto.type = 'grid'; - /** - * Transform global coord to local coord, - * i.e. var globalCoord = axis.toLocalCoord(40); - * designate by module:echarts/coord/cartesian/Grid. - * @type {Function} - */ - toGlobalCoord: null + gridProto.axisPointerEnabled = true; + gridProto.getRect = function () { + return this._rect; }; - zrUtil.inherits(Axis2D, Axis); - module.exports = Axis2D; + gridProto.update = function (ecModel, api) { + var axesMap = this._axesMap; -/***/ }, -/* 124 */ -/***/ function(module, exports, __webpack_require__) { + this._updateScale(ecModel, this.model); - + function ifAxisCanNotOnZero(otherAxisDim) { + var axes = axesMap[otherAxisDim]; + for (var idx in axes) { + if (axes.hasOwnProperty(idx)) { + var axis = axes[idx]; + if (axis && (axis.type === 'category' || !ifAxisCrossZero(axis))) { + return true; + } + } + } + return false; + } - var numberUtil = __webpack_require__(7); - var linearMap = numberUtil.linearMap; - var zrUtil = __webpack_require__(4); + each(axesMap.x, function (xAxis) { + niceScaleExtent(xAxis.scale, xAxis.model); + }); + each(axesMap.y, function (yAxis) { + niceScaleExtent(yAxis.scale, yAxis.model); + }); + // Fix configuration + each(axesMap.x, function (xAxis) { + // onZero can not be enabled in these two situations + // 1. When any other axis is a category axis + // 2. When any other axis not across 0 point + if (ifAxisCanNotOnZero('y')) { + xAxis.onZero = false; + } + }); + each(axesMap.y, function (yAxis) { + if (ifAxisCanNotOnZero('x')) { + yAxis.onZero = false; + } + }); - function fixExtentWithBands(extent, nTick) { - var size = extent[1] - extent[0]; - var len = nTick; - var margin = size / len / 2; - extent[0] += margin; - extent[1] -= margin; - } + // Resize again if containLabel is enabled + // FIXME It may cause getting wrong grid size in data processing stage + this.resize(this.model, api); + }; - var normalizedExtent = [0, 1]; /** - * @name module:echarts/coord/CartesianAxis - * @constructor + * Resize the grid + * @param {module:echarts/coord/cartesian/GridModel} gridModel + * @param {module:echarts/ExtensionAPI} api */ - var Axis = function (dim, scale, extent) { + gridProto.resize = function (gridModel, api) { - /** - * Axis dimension. Such as 'x', 'y', 'z', 'angle', 'radius' - * @type {string} - */ - this.dim = dim; + var gridRect = layout.getLayoutRect( + gridModel.getBoxLayoutParams(), { + width: api.getWidth(), + height: api.getHeight() + }); - /** - * Axis scale - * @type {module:echarts/coord/scale/*} - */ - this.scale = scale; + this._rect = gridRect; - /** - * @type {Array.} - * @private - */ - this._extent = extent || [0, 0]; - - /** - * @type {boolean} - */ - this.inverse = false; - - /** - * Usually true when axis has a ordinal scale - * @type {boolean} - */ - this.onBand = false; - }; - - Axis.prototype = { - - constructor: Axis, - - /** - * If axis extent contain given coord - * @param {number} coord - * @return {boolean} - */ - contain: function (coord) { - var extent = this._extent; - var min = Math.min(extent[0], extent[1]); - var max = Math.max(extent[0], extent[1]); - return coord >= min && coord <= max; - }, - - /** - * If axis extent contain given data - * @param {number} data - * @return {boolean} - */ - containData: function (data) { - return this.contain(this.dataToCoord(data)); - }, + var axesList = this._axesList; - /** - * Get coord extent. - * @return {Array.} - */ - getExtent: function () { - var ret = this._extent.slice(); - return ret; - }, + adjustAxes(); - /** - * Get precision used for formatting - * @param {Array.} [dataExtent] - * @return {number} - */ - getPixelPrecision: function (dataExtent) { - return numberUtil.getPixelPrecision( - dataExtent || this.scale.getExtent(), - this._extent - ); - }, + // Minus label size + if (gridModel.get('containLabel')) { + each(axesList, function (axis) { + if (!axis.model.get('axisLabel.inside')) { + var labelUnionRect = getLabelUnionRect(axis); + if (labelUnionRect) { + var dim = axis.isHorizontal() ? 'height' : 'width'; + var margin = axis.model.get('axisLabel.margin'); + gridRect[dim] -= labelUnionRect[dim] + margin; + if (axis.position === 'top') { + gridRect.y += labelUnionRect.height + margin; + } + else if (axis.position === 'left') { + gridRect.x += labelUnionRect.width + margin; + } + } + } + }); - /** - * Set coord extent - * @param {number} start - * @param {number} end - */ - setExtent: function (start, end) { - var extent = this._extent; - extent[0] = start; - extent[1] = end; - }, + adjustAxes(); + } - /** - * Convert data to coord. Data is the rank if it has a ordinal scale - * @param {number} data - * @param {boolean} clamp - * @return {number} - */ - dataToCoord: function (data, clamp) { - var extent = this._extent; - var scale = this.scale; - data = scale.normalize(data); + function adjustAxes() { + each(axesList, function (axis) { + var isHorizontal = axis.isHorizontal(); + var extent = isHorizontal ? [0, gridRect.width] : [0, gridRect.height]; + var idx = axis.inverse ? 1 : 0; + axis.setExtent(extent[idx], extent[1 - idx]); + updateAxisTransfrom(axis, isHorizontal ? gridRect.x : gridRect.y); + }); + } + }; - if (this.onBand && scale.type === 'ordinal') { - extent = extent.slice(); - fixExtentWithBands(extent, scale.count()); + /** + * @param {string} axisType + * @param {ndumber} [axisIndex] + */ + gridProto.getAxis = function (axisType, axisIndex) { + var axesMapOnDim = this._axesMap[axisType]; + if (axesMapOnDim != null) { + if (axisIndex == null) { + // Find first axis + for (var name in axesMapOnDim) { + if (axesMapOnDim.hasOwnProperty(name)) { + return axesMapOnDim[name]; + } + } } + return axesMapOnDim[axisIndex]; + } + }; - return linearMap(data, normalizedExtent, extent, clamp); - }, - - /** - * Convert coord to data. Data is the rank if it has a ordinal scale - * @param {number} coord - * @param {boolean} clamp - * @return {number} - */ - coordToData: function (coord, clamp) { - var extent = this._extent; - var scale = this.scale; - - if (this.onBand && scale.type === 'ordinal') { - extent = extent.slice(); - fixExtentWithBands(extent, scale.count()); - } + /** + * @return {Array.} + */ + gridProto.getAxes = function () { + return this._axesList.slice(); + }; - var t = linearMap(coord, extent, normalizedExtent, clamp); + /** + * Usage: + * grid.getCartesian(xAxisIndex, yAxisIndex); + * grid.getCartesian(xAxisIndex); + * grid.getCartesian(null, yAxisIndex); + * grid.getCartesian({xAxisIndex: ..., yAxisIndex: ...}); + * + * @param {number|Object} [xAxisIndex] + * @param {number} [yAxisIndex] + */ + gridProto.getCartesian = function (xAxisIndex, yAxisIndex) { + if (xAxisIndex != null && yAxisIndex != null) { + var key = 'x' + xAxisIndex + 'y' + yAxisIndex; + return this._coordsMap[key]; + } - return this.scale.scale(t); - }, - /** - * @return {Array.} - */ - getTicksCoords: function (alignWithLabel) { - if (this.onBand && !alignWithLabel) { - var bands = this.getBands(); - var coords = []; - for (var i = 0; i < bands.length; i++) { - coords.push(bands[i][0]); - } - if (bands[i - 1]) { - coords.push(bands[i - 1][1]); - } - return coords; - } - else { - return zrUtil.map(this.scale.getTicks(), this.dataToCoord, this); + if (zrUtil.isObject(xAxisIndex)) { + yAxisIndex = xAxisIndex.yAxisIndex; + xAxisIndex = xAxisIndex.xAxisIndex; + } + // When only xAxisIndex or yAxisIndex given, find its first cartesian. + for (var i = 0, coordList = this._coordsList; i < coordList.length; i++) { + if (coordList[i].getAxis('x').index === xAxisIndex + || coordList[i].getAxis('y').index === yAxisIndex + ) { + return coordList[i]; } - }, + } + }; - /** - * Coords of labels are on the ticks or on the middle of bands - * @return {Array.} - */ - getLabelsCoords: function () { - return zrUtil.map(this.scale.getTicks(), this.dataToCoord, this); - }, + gridProto.getCartesians = function () { + return this._coordsList.slice(); + }; - /** - * Get bands. - * - * If axis has labels [1, 2, 3, 4]. Bands on the axis are - * |---1---|---2---|---3---|---4---|. - * - * @return {Array} - */ - // FIXME Situation when labels is on ticks - getBands: function () { - var extent = this.getExtent(); - var bands = []; - var len = this.scale.count(); - var start = extent[0]; - var end = extent[1]; - var span = end - start; + /** + * @implements + * see {module:echarts/CoodinateSystem} + */ + gridProto.convertToPixel = function (ecModel, finder, value) { + var target = this._findConvertTarget(ecModel, finder); - for (var i = 0; i < len; i++) { - bands.push([ - span * i / len + start, - span * (i + 1) / len + start - ]); - } - return bands; - }, + return target.cartesian + ? target.cartesian.dataToPoint(value) + : target.axis + ? target.axis.toGlobalCoord(target.axis.dataToCoord(value)) + : null; + }; - /** - * Get width of band - * @return {number} - */ - getBandWidth: function () { - var axisExtent = this._extent; - var dataExtent = this.scale.getExtent(); + /** + * @implements + * see {module:echarts/CoodinateSystem} + */ + gridProto.convertFromPixel = function (ecModel, finder, value) { + var target = this._findConvertTarget(ecModel, finder); - var len = dataExtent[1] - dataExtent[0] + (this.onBand ? 1 : 0); - // Fix #2728, avoid NaN when only one data. - len === 0 && (len = 1); + return target.cartesian + ? target.cartesian.pointToData(value) + : target.axis + ? target.axis.coordToData(target.axis.toLocalCoord(value)) + : null; + }; - var size = Math.abs(axisExtent[1] - axisExtent[0]); + /** + * @inner + */ + gridProto._findConvertTarget = function (ecModel, finder) { + var seriesModel = finder.seriesModel; + var xAxisModel = finder.xAxisModel + || (seriesModel && seriesModel.getReferringComponents('xAxis')[0]); + var yAxisModel = finder.yAxisModel + || (seriesModel && seriesModel.getReferringComponents('yAxis')[0]); + var gridModel = finder.gridModel; + var coordsList = this._coordsList; + var cartesian; + var axis; - return Math.abs(size) / len; - }, + if (seriesModel) { + cartesian = seriesModel.coordinateSystem; + zrUtil.indexOf(coordsList, cartesian) < 0 && (cartesian = null); + } + else if (xAxisModel && yAxisModel) { + cartesian = this.getCartesian(xAxisModel.componentIndex, yAxisModel.componentIndex); + } + else if (xAxisModel) { + axis = this.getAxis('x', xAxisModel.componentIndex); + } + else if (yAxisModel) { + axis = this.getAxis('y', yAxisModel.componentIndex); + } + // Lowest priority. + else if (gridModel) { + var grid = gridModel.coordinateSystem; + if (grid === this) { + cartesian = this._coordsList[0]; + } + } - /** - * When axis extent depends on data and no data exists, - * axis ticks should not be drawn, which is named 'blank'. - */ - isBlank: function () { - return this._isBlank; - }, + return {cartesian: cartesian, axis: axis}; + }; - /** - * When axis extent depends on data and no data exists, - * axis ticks should not be drawn, which is named 'blank'. - */ - setBlank: function (isBlank) { - this._isBlank = isBlank; + /** + * @implements + * see {module:echarts/CoodinateSystem} + */ + gridProto.containPoint = function (point) { + var coord = this._coordsList[0]; + if (coord) { + return coord.containPoint(point); } - }; - module.exports = Axis; + /** + * Initialize cartesian coordinate systems + * @private + */ + gridProto._initCartesian = function (gridModel, ecModel, api) { + var axisPositionUsed = { + left: false, + right: false, + top: false, + bottom: false + }; + var axesMap = { + x: {}, + y: {} + }; + var axesCount = { + x: 0, + y: 0 + }; -/***/ }, -/* 125 */ -/***/ function(module, exports, __webpack_require__) { + /// Create axis + ecModel.eachComponent('xAxis', createAxisCreator('x'), this); + ecModel.eachComponent('yAxis', createAxisCreator('y'), this); - 'use strict'; - /** - * Helper function for axisLabelInterval calculation - */ + if (!axesCount.x || !axesCount.y) { + // Roll back when there no either x or y axis + this._axesMap = {}; + this._axesList = []; + return; + } + this._axesMap = axesMap; + /// Create cartesian2d + each(axesMap.x, function (xAxis, xAxisIndex) { + each(axesMap.y, function (yAxis, yAxisIndex) { + var key = 'x' + xAxisIndex + 'y' + yAxisIndex; + var cartesian = new Cartesian2D(key); - var zrUtil = __webpack_require__(4); - var axisHelper = __webpack_require__(115); + cartesian.grid = this; + cartesian.model = gridModel; - module.exports = function (axis) { - var axisModel = axis.model; - var labelModel = axisModel.getModel('axisLabel'); - var labelInterval = labelModel.get('interval'); - if (!(axis.type === 'category' && labelInterval === 'auto')) { - return labelInterval === 'auto' ? 0 : labelInterval; - } + this._coordsMap[key] = cartesian; + this._coordsList.push(cartesian); - return axisHelper.getAxisLabelInterval( - zrUtil.map(axis.scale.getTicks(), axis.dataToCoord, axis), - axisModel.getFormattedLabels(), - labelModel.getModel('textStyle').getFont(), - axis.isHorizontal() - ); - }; + cartesian.addAxis(xAxis); + cartesian.addAxis(yAxis); + }, this); + }, this); + function createAxisCreator(axisType) { + return function (axisModel, idx) { + if (!isAxisUsedInTheGrid(axisModel, gridModel, ecModel)) { + return; + } -/***/ }, -/* 126 */ -/***/ function(module, exports, __webpack_require__) { + var axisPosition = axisModel.get('position'); + if (axisType === 'x') { + // Fix position + if (axisPosition !== 'top' && axisPosition !== 'bottom') { + // Default bottom of X + axisPosition = 'bottom'; + if (axisPositionUsed[axisPosition]) { + axisPosition = axisPosition === 'top' ? 'bottom' : 'top'; + } + } + } + else { + // Fix position + if (axisPosition !== 'left' && axisPosition !== 'right') { + // Default left of Y + axisPosition = 'left'; + if (axisPositionUsed[axisPosition]) { + axisPosition = axisPosition === 'left' ? 'right' : 'left'; + } + } + } + axisPositionUsed[axisPosition] = true; - 'use strict'; - // Grid 是在有直角坐标系的时候必须要存在的 - // 所以这里也要被 Cartesian2D 依赖 + var axis = new Axis2D( + axisType, axisHelper.createScaleByModel(axisModel), + [0, 0], + axisModel.get('type'), + axisPosition + ); + var isCategory = axis.type === 'category'; + axis.onBand = isCategory && axisModel.get('boundaryGap'); + axis.inverse = axisModel.get('inverse'); - __webpack_require__(127); - var ComponentModel = __webpack_require__(19); + axis.onZero = axisModel.get('axisLine.onZero'); - module.exports = ComponentModel.extend({ + // Inject axis into axisModel + axisModel.axis = axis; - type: 'grid', + // Inject axisModel into axis + axis.model = axisModel; - dependencies: ['xAxis', 'yAxis'], + // Inject grid info axis + axis.grid = this; - layoutMode: 'box', + // Index of axis, can be used as key + axis.index = idx; - /** - * @type {module:echarts/coord/cartesian/Grid} - */ - coordinateSystem: null, + this._axesList.push(axis); - defaultOption: { - show: false, - zlevel: 0, - z: 0, - left: '10%', - top: 60, - right: '10%', - bottom: 60, - // If grid size contain label - containLabel: false, - // width: {totalWidth} - left - right, - // height: {totalHeight} - top - bottom, - backgroundColor: 'rgba(0,0,0,0)', - borderWidth: 1, - borderColor: '#ccc' + axesMap[axisType][idx] = axis; + axesCount[axisType]++; + }; } - }); - + }; -/***/ }, -/* 127 */ -/***/ function(module, exports, __webpack_require__) { + /** + * Update cartesian properties from series + * @param {module:echarts/model/Option} option + * @private + */ + gridProto._updateScale = function (ecModel, gridModel) { + // Reset scale + zrUtil.each(this._axesList, function (axis) { + axis.scale.setExtent(Infinity, -Infinity); + }); + ecModel.eachSeries(function (seriesModel) { + if (isCartesian2D(seriesModel)) { + var axesModels = findAxesModels(seriesModel, ecModel); + var xAxisModel = axesModels[0]; + var yAxisModel = axesModels[1]; - 'use strict'; + if (!isAxisUsedInTheGrid(xAxisModel, gridModel, ecModel) + || !isAxisUsedInTheGrid(yAxisModel, gridModel, ecModel) + ) { + return; + } + var cartesian = this.getCartesian( + xAxisModel.componentIndex, yAxisModel.componentIndex + ); + var data = seriesModel.getData(); + var xAxis = cartesian.getAxis('x'); + var yAxis = cartesian.getAxis('y'); - var ComponentModel = __webpack_require__(19); - var zrUtil = __webpack_require__(4); - var axisModelCreator = __webpack_require__(128); + if (data.type === 'list') { + unionExtent(data, xAxis, seriesModel); + unionExtent(data, yAxis, seriesModel); + } + } + }, this); - var AxisModel = ComponentModel.extend({ + function unionExtent(data, axis, seriesModel) { + each(seriesModel.coordDimToDataDim(axis.dim), function (dim) { + axis.scale.unionExtentFromData(data, dim); + }); + } + }; - type: 'cartesian2dAxis', + /** + * @param {string} [dim] 'x' or 'y' or 'auto' or null/undefined + * @return {Object} {baseAxes: [], otherAxes: []} + */ + gridProto.getTooltipAxes = function (dim) { + var baseAxes = []; + var otherAxes = []; - /** - * @type {module:echarts/coord/cartesian/Axis2D} - */ - axis: null, + each(this.getCartesians(), function (cartesian) { + var baseAxis = (dim != null && dim !== 'auto') + ? cartesian.getAxis(dim) : cartesian.getBaseAxis(); + var otherAxis = cartesian.getOtherAxis(baseAxis); + zrUtil.indexOf(baseAxes, baseAxis) < 0 && baseAxes.push(baseAxis); + zrUtil.indexOf(otherAxes, otherAxis) < 0 && otherAxes.push(otherAxis); + }); - /** - * @override - */ - init: function () { - AxisModel.superApply(this, 'init', arguments); - this.resetRange(); - }, + return {baseAxes: baseAxes, otherAxes: otherAxes}; + }; - /** - * @override - */ - mergeOption: function () { - AxisModel.superApply(this, 'mergeOption', arguments); - this.resetRange(); - }, - - /** - * @override - */ - restoreData: function () { - AxisModel.superApply(this, 'restoreData', arguments); - this.resetRange(); - }, - - /** - * @override - * @return {module:echarts/model/Component} - */ - getCoordSysModel: function () { - return this.ecModel.queryComponents({ - mainType: 'grid', - index: this.option.gridIndex, - id: this.option.gridId - })[0]; - } - - }); + /** + * @inner + */ + function updateAxisTransfrom(axis, coordBase) { + var axisExtent = axis.getExtent(); + var axisExtentSum = axisExtent[0] + axisExtent[1]; - function getAxisType(axisDim, option) { - // Default axis with data is category axis - return option.type || (option.data ? 'category' : 'value'); + // Fast transform + axis.toGlobalCoord = axis.dim === 'x' + ? function (coord) { + return coord + coordBase; + } + : function (coord) { + return axisExtentSum - coord + coordBase; + }; + axis.toLocalCoord = axis.dim === 'x' + ? function (coord) { + return coord - coordBase; + } + : function (coord) { + return axisExtentSum - coord + coordBase; + }; } - zrUtil.merge(AxisModel.prototype, __webpack_require__(130)); - - var extraOption = { - // gridIndex: 0, - // gridId: '', - - // Offset is for multiple axis on the same position - offset: 0 - }; - - axisModelCreator('x', AxisModel, getAxisType, extraOption); - axisModelCreator('y', AxisModel, getAxisType, extraOption); - - module.exports = AxisModel; - - -/***/ }, -/* 128 */ -/***/ function(module, exports, __webpack_require__) { - - - - var axisDefault = __webpack_require__(129); - var zrUtil = __webpack_require__(4); - var ComponentModel = __webpack_require__(19); - var layout = __webpack_require__(21); - - // FIXME axisType is fixed ? - var AXIS_TYPES = ['value', 'category', 'time', 'log']; - + var axesTypes = ['xAxis', 'yAxis']; /** - * Generate sub axis model class - * @param {string} axisName 'x' 'y' 'radius' 'angle' 'parallel' - * @param {module:echarts/model/Component} BaseAxisModelClass - * @param {Function} axisTypeDefaulter - * @param {Object} [extraDefaultOption] + * @inner */ - module.exports = function (axisName, BaseAxisModelClass, axisTypeDefaulter, extraDefaultOption) { - - zrUtil.each(AXIS_TYPES, function (axisType) { - - BaseAxisModelClass.extend({ - - type: axisName + 'Axis.' + axisType, + function findAxesModels(seriesModel, ecModel) { + return zrUtil.map(axesTypes, function (axisType) { + var axisModel = seriesModel.getReferringComponents(axisType)[0]; - mergeDefaultAndTheme: function (option, ecModel) { - var layoutMode = this.layoutMode; - var inputPositionParams = layoutMode - ? layout.getLayoutParams(option) : {}; + if (true) { + if (!axisModel) { + throw new Error(axisType + ' "' + zrUtil.retrieve( + seriesModel.get(axisType + 'Index'), + seriesModel.get(axisType + 'Id'), + 0 + ) + '" not found'); + } + } + return axisModel; + }); + } - var themeModel = ecModel.getTheme(); - zrUtil.merge(option, themeModel.get(axisType + 'Axis')); - zrUtil.merge(option, this.getDefaultOption()); + /** + * @inner + */ + function isCartesian2D(seriesModel) { + return seriesModel.get('coordinateSystem') === 'cartesian2d'; + } - option.type = axisTypeDefaulter(axisName, option); + Grid.create = function (ecModel, api) { + var grids = []; + ecModel.eachComponent('grid', function (gridModel, idx) { + var grid = new Grid(gridModel, ecModel, api); + grid.name = 'grid_' + idx; + grid.resize(gridModel, api); - if (layoutMode) { - layout.mergeLayoutParam(option, inputPositionParams, layoutMode); - } - }, + gridModel.coordinateSystem = grid; - defaultOption: zrUtil.mergeAll( - [ - {}, - axisDefault[axisType + 'Axis'], - extraDefaultOption - ], - true - ) - }); + grids.push(grid); }); - ComponentModel.registerSubTypeDefaulter( - axisName + 'Axis', - zrUtil.curry(axisTypeDefaulter, axisName) - ); - }; - - -/***/ }, -/* 129 */ -/***/ function(module, exports, __webpack_require__) { - - + // Inject the coordinateSystems into seriesModel + ecModel.eachSeries(function (seriesModel) { + if (!isCartesian2D(seriesModel)) { + return; + } - var zrUtil = __webpack_require__(4); + var axesModels = findAxesModels(seriesModel, ecModel); + var xAxisModel = axesModels[0]; + var yAxisModel = axesModels[1]; - var defaultOption = { - show: true, - zlevel: 0, // 一级层叠 - z: 0, // 二级层叠 - // 反向坐标轴 - inverse: false, + var gridModel = xAxisModel.getCoordSysModel(); - // 坐标轴名字,默认为空 - name: '', - // 坐标轴名字位置,支持'start' | 'middle' | 'end' - nameLocation: 'end', - // 坐标轴名字旋转,degree。 - nameRotate: null, // Adapt to axis rotate, when nameLocation is 'middle'. - nameTruncate: { - maxWidth: null, - ellipsis: '...', - placeholder: '.' - }, - // 坐标轴文字样式,默认取全局样式 - nameTextStyle: {}, - // 文字与轴线距离 - nameGap: 15, + if (true) { + if (!gridModel) { + throw new Error( + 'Grid "' + zrUtil.retrieve( + xAxisModel.get('gridIndex'), + xAxisModel.get('gridId'), + 0 + ) + '" not found' + ); + } + if (xAxisModel.getCoordSysModel() !== yAxisModel.getCoordSysModel()) { + throw new Error('xAxis and yAxis must use the same grid'); + } + } - silent: false, // Default false to support tooltip. - triggerEvent: false, // Default false to avoid legacy user event listener fail. + var grid = gridModel.coordinateSystem; - tooltip: { - show: false - }, + seriesModel.coordinateSystem = grid.getCartesian( + xAxisModel.componentIndex, yAxisModel.componentIndex + ); + }); - // 坐标轴线 - axisLine: { - // 默认显示,属性show控制显示与否 - show: true, - onZero: true, - // 属性lineStyle控制线条样式 - lineStyle: { - color: '#333', - width: 1, - type: 'solid' - } - }, - // 坐标轴小标记 - axisTick: { - // 属性show控制显示与否,默认显示 - show: true, - // 控制小标记是否在grid里 - inside: false, - // 属性length控制线长 - length: 5, - // 属性lineStyle控制线条样式 - lineStyle: { - width: 1 - } - }, - // 坐标轴文本标签,详见axis.axisLabel - axisLabel: { - show: true, - // 控制文本标签是否在grid里 - inside: false, - rotate: 0, - margin: 8, - // formatter: null, - // 其余属性默认使用全局文本样式,详见TEXTSTYLE - textStyle: { - fontSize: 12 - } - }, - // 分隔线 - splitLine: { - // 默认显示,属性show控制显示与否 - show: true, - // 属性lineStyle(详见lineStyle)控制线条样式 - lineStyle: { - color: ['#ccc'], - width: 1, - type: 'solid' - } - }, - // 分隔区域 - splitArea: { - // 默认不显示,属性show控制显示与否 - show: false, - // 属性areaStyle(详见areaStyle)控制区域样式 - areaStyle: { - color: ['rgba(250,250,250,0.3)','rgba(200,200,200,0.3)'] - } - } + return grids; }; - var categoryAxis = zrUtil.merge({ - // 类目起始和结束两端空白策略 - boundaryGap: true, - // splitArea: { - // show: false - // }, - splitLine: { - show: false - }, - // 坐标轴小标记 - axisTick: { - // If tick is align with label when boundaryGap is true - // Default with axisTick - alignWithLabel: false, - interval: 'auto' - }, - // 坐标轴文本标签,详见axis.axisLabel - axisLabel: { - interval: 'auto' - } - }, defaultOption); - - var valueAxis = zrUtil.merge({ - // 数值起始和结束两端空白策略 - boundaryGap: [0, 0], - // 最小值, 设置成 'dataMin' 则从数据中计算最小值 - // min: null, - // 最大值,设置成 'dataMax' 则从数据中计算最大值 - // max: null, - // Readonly prop, specifies start value of the range when using data zoom. - // rangeStart: null - // Readonly prop, specifies end value of the range when using data zoom. - // rangeEnd: null - // 脱离0值比例,放大聚焦到最终_min,_max区间 - // scale: false, - // 分割段数,默认为5 - splitNumber: 5 - // Minimum interval - // minInterval: null - }, defaultOption); + // For deciding which dimensions to use when creating list data + Grid.dimensions = Grid.prototype.dimensions = Cartesian2D.prototype.dimensions; - // FIXME - var timeAxis = zrUtil.defaults({ - scale: true, - min: 'dataMin', - max: 'dataMax' - }, valueAxis); - var logAxis = zrUtil.defaults({ - logBase: 10 - }, valueAxis); - logAxis.scale = true; + __webpack_require__(26).register('cartesian2d', Grid); - module.exports = { - categoryAxis: categoryAxis, - valueAxis: valueAxis, - timeAxis: timeAxis, - logAxis: logAxis - }; + module.exports = Grid; /***/ }, -/* 130 */ +/* 125 */ /***/ function(module, exports, __webpack_require__) { - + 'use strict'; + var zrUtil = __webpack_require__(4); - var axisHelper = __webpack_require__(115); + var Cartesian = __webpack_require__(126); - function getName(obj) { - if (zrUtil.isObject(obj) && obj.value != null) { - return obj.value; - } - else { - return obj; - } + function Cartesian2D(name) { + + Cartesian.call(this, name); } - module.exports = { + Cartesian2D.prototype = { + + constructor: Cartesian2D, + + type: 'cartesian2d', /** - * Format labels - * @return {Array.} + * @type {Array.} + * @readOnly */ - getFormattedLabels: function () { - return axisHelper.getFormattedLabels( - this.axis, - this.get('axisLabel.formatter') - ); - }, + dimensions: ['x', 'y'], /** - * Get categories + * Base axis will be used on stacking. + * + * @return {module:echarts/coord/cartesian/Axis2D} */ - getCategories: function () { - return this.get('type') === 'category' - && zrUtil.map(this.get('data'), getName); + getBaseAxis: function () { + return this.getAxesByScale('ordinal')[0] + || this.getAxesByScale('time')[0] + || this.getAxis('x'); }, /** - * @param {boolean} origin - * @return {number|string} min value or 'dataMin' or null/undefined (means auto) or NaN + * If contain point + * @param {Array.} point + * @return {boolean} */ - getMin: function (origin) { - var option = this.option; - var min = (!origin && option.rangeStart != null) - ? option.rangeStart : option.min; - - if (min != null && min !== 'dataMin' && !zrUtil.eqNaN(min)) { - min = this.axis.scale.parse(min); - } - return min; + containPoint: function (point) { + var axisX = this.getAxis('x'); + var axisY = this.getAxis('y'); + return axisX.contain(axisX.toLocalCoord(point[0])) + && axisY.contain(axisY.toLocalCoord(point[1])); }, /** - * @param {boolean} origin - * @return {number|string} max value or 'dataMax' or null/undefined (means auto) or NaN + * If contain data + * @param {Array.} data + * @return {boolean} */ - getMax: function (origin) { - var option = this.option; - var max = (!origin && option.rangeEnd != null) - ? option.rangeEnd : option.max; - - if (max != null && max !== 'dataMax' && !zrUtil.eqNaN(max)) { - max = this.axis.scale.parse(max); - } - return max; + containData: function (data) { + return this.getAxis('x').containData(data[0]) + && this.getAxis('y').containData(data[1]); }, /** - * @return {boolean} + * Convert series data to an array of points + * @param {module:echarts/data/List} data + * @param {boolean} stack + * @return {Array} + * Return array of points. For example: + * `[[10, 10], [20, 20], [30, 30]]` */ - getNeedCrossZero: function () { - var option = this.option; - return (option.rangeStart != null || option.rangeEnd != null) - ? false : !option.scale; + dataToPoints: function (data, stack) { + return data.mapArray(['x', 'y'], function (x, y) { + return this.dataToPoint([x, y]); + }, stack, this); }, /** - * Should be implemented by each axis model if necessary. - * @return {module:echarts/model/Component} coordinate system model + * @param {Array.} data + * @param {boolean} [clamp=false] + * @return {Array.} */ - getCoordSysModel: zrUtil.noop, + dataToPoint: function (data, clamp) { + var xAxis = this.getAxis('x'); + var yAxis = this.getAxis('y'); + return [ + xAxis.toGlobalCoord(xAxis.dataToCoord(data[0], clamp)), + yAxis.toGlobalCoord(yAxis.dataToCoord(data[1], clamp)) + ]; + }, /** - * @param {number} rangeStart Can only be finite number or null/undefined or NaN. - * @param {number} rangeEnd Can only be finite number or null/undefined or NaN. + * @param {Array.} point + * @param {boolean} [clamp=false] + * @return {Array.} */ - setRange: function (rangeStart, rangeEnd) { - this.option.rangeStart = rangeStart; - this.option.rangeEnd = rangeEnd; + pointToData: function (point, clamp) { + var xAxis = this.getAxis('x'); + var yAxis = this.getAxis('y'); + return [ + xAxis.coordToData(xAxis.toLocalCoord(point[0]), clamp), + yAxis.coordToData(yAxis.toLocalCoord(point[1]), clamp) + ]; }, /** - * Reset range + * Get other axis + * @param {module:echarts/coord/cartesian/Axis2D} axis */ - resetRange: function () { - // rangeStart and rangeEnd is readonly. - this.option.rangeStart = this.option.rangeEnd = null; + getOtherAxis: function (axis) { + return this.getAxis(axis.dim === 'x' ? 'y' : 'x'); } }; + zrUtil.inherits(Cartesian2D, Cartesian); + + module.exports = Cartesian2D; + /***/ }, -/* 131 */ +/* 126 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; - // TODO boundaryGap - - - __webpack_require__(127); + /** + * Cartesian coordinate system + * @module echarts/coord/Cartesian + * + */ - __webpack_require__(132); + var zrUtil = __webpack_require__(4); -/***/ }, -/* 132 */ -/***/ function(module, exports, __webpack_require__) { + function dimAxisMapper(dim) { + return this._axes[dim]; + } - + /** + * @alias module:echarts/coord/Cartesian + * @constructor + */ + var Cartesian = function (name) { + this._axes = {}; - var zrUtil = __webpack_require__(4); - var graphic = __webpack_require__(43); - var AxisBuilder = __webpack_require__(133); - var ifIgnoreOnTick = AxisBuilder.ifIgnoreOnTick; - var getInterval = AxisBuilder.getInterval; + this._dimList = []; - var axisBuilderAttrs = [ - 'axisLine', 'axisLabel', 'axisTick', 'axisName' - ]; - var selfBuilderAttrs = [ - 'splitArea', 'splitLine' - ]; + /** + * @type {string} + */ + this.name = name || ''; + }; - // function getAlignWithLabel(model, axisModel) { - // var alignWithLabel = model.get('alignWithLabel'); - // if (alignWithLabel === 'auto') { - // alignWithLabel = axisModel.get('axisTick.alignWithLabel'); - // } - // return alignWithLabel; - // } + Cartesian.prototype = { - var AxisView = __webpack_require__(1).extendComponentView({ + constructor: Cartesian, - type: 'axis', + type: 'cartesian', - render: function (axisModel, ecModel) { + /** + * Get axis + * @param {number|string} dim + * @return {module:echarts/coord/Cartesian~Axis} + */ + getAxis: function (dim) { + return this._axes[dim]; + }, - this.group.removeAll(); + /** + * Get axes list + * @return {Array.} + */ + getAxes: function () { + return zrUtil.map(this._dimList, dimAxisMapper, this); + }, - var oldAxisGroup = this._axisGroup; - this._axisGroup = new graphic.Group(); + /** + * Get axes list by given scale type + */ + getAxesByScale: function (scaleType) { + scaleType = scaleType.toLowerCase(); + return zrUtil.filter( + this.getAxes(), + function (axis) { + return axis.scale.type === scaleType; + } + ); + }, - this.group.add(this._axisGroup); + /** + * Add axis + * @param {module:echarts/coord/Cartesian.Axis} + */ + addAxis: function (axis) { + var dim = axis.dim; - if (!axisModel.get('show')) { - return; - } + this._axes[dim] = axis; - var gridModel = axisModel.getCoordSysModel(); + this._dimList.push(dim); + }, - var layout = layoutAxis(gridModel, axisModel); + /** + * Convert data to coord in nd space + * @param {Array.|Object.} val + * @return {Array.|Object.} + */ + dataToCoord: function (val) { + return this._dataCoordConvert(val, 'dataToCoord'); + }, - var axisBuilder = new AxisBuilder(axisModel, layout); + /** + * Convert coord in nd space to data + * @param {Array.|Object.} val + * @return {Array.|Object.} + */ + coordToData: function (val) { + return this._dataCoordConvert(val, 'coordToData'); + }, - zrUtil.each(axisBuilderAttrs, axisBuilder.add, axisBuilder); + _dataCoordConvert: function (input, method) { + var dimList = this._dimList; - this._axisGroup.add(axisBuilder.getGroup()); + var output = input instanceof Array ? [] : {}; - zrUtil.each(selfBuilderAttrs, function (name) { - if (axisModel.get(name + '.show')) { - this['_' + name](axisModel, gridModel, layout.labelInterval); - } - }, this); + for (var i = 0; i < dimList.length; i++) { + var dim = dimList[i]; + var axis = this._axes[dim]; - graphic.groupTransition(oldAxisGroup, this._axisGroup, axisModel); - }, + output[dim] = axis[method](input[dim]); + } - /** - * @param {module:echarts/coord/cartesian/AxisModel} axisModel - * @param {module:echarts/coord/cartesian/GridModel} gridModel - * @param {number|Function} labelInterval - * @private - */ - _splitLine: function (axisModel, gridModel, labelInterval) { - var axis = axisModel.axis; + return output; + } + }; - if (axis.isBlank()) { - return; - } + module.exports = Cartesian; - var splitLineModel = axisModel.getModel('splitLine'); - var lineStyleModel = splitLineModel.getModel('lineStyle'); - var lineColors = lineStyleModel.get('color'); - var lineInterval = getInterval(splitLineModel, labelInterval); +/***/ }, +/* 127 */ +/***/ function(module, exports, __webpack_require__) { - lineColors = zrUtil.isArray(lineColors) ? lineColors : [lineColors]; + - var gridRect = gridModel.coordinateSystem.getRect(); - var isHorizontal = axis.isHorizontal(); + var zrUtil = __webpack_require__(4); + var Axis = __webpack_require__(100); + var axisLabelInterval = __webpack_require__(128); - var lineCount = 0; + /** + * Extend axis 2d + * @constructor module:echarts/coord/cartesian/Axis2D + * @extends {module:echarts/coord/cartesian/Axis} + * @param {string} dim + * @param {*} scale + * @param {Array.} coordExtent + * @param {string} axisType + * @param {string} position + */ + var Axis2D = function (dim, scale, coordExtent, axisType, position) { + Axis.call(this, dim, scale, coordExtent); + /** + * Axis type + * - 'category' + * - 'value' + * - 'time' + * - 'log' + * @type {string} + */ + this.type = axisType || 'value'; - var ticksCoords = axis.getTicksCoords( - // splitLineModel.get('alignWithLabel') - ); - var ticks = axis.scale.getTicks(); + /** + * Axis position + * - 'top' + * - 'bottom' + * - 'left' + * - 'right' + */ + this.position = position || 'bottom'; + }; - var p1 = []; - var p2 = []; - // Simple optimization - // Batching the lines if color are the same - var lineStyle = lineStyleModel.getLineStyle(); - for (var i = 0; i < ticksCoords.length; i++) { - if (ifIgnoreOnTick(axis, i, lineInterval)) { - continue; - } + Axis2D.prototype = { - var tickCoord = axis.toGlobalCoord(ticksCoords[i]); + constructor: Axis2D, - if (isHorizontal) { - p1[0] = tickCoord; - p1[1] = gridRect.y; - p2[0] = tickCoord; - p2[1] = gridRect.y + gridRect.height; - } - else { - p1[0] = gridRect.x; - p1[1] = tickCoord; - p2[0] = gridRect.x + gridRect.width; - p2[1] = tickCoord; - } + /** + * Index of axis, can be used as key + */ + index: 0, + /** + * If axis is on the zero position of the other axis + * @type {boolean} + */ + onZero: false, - var colorIndex = (lineCount++) % lineColors.length; - this._axisGroup.add(new graphic.Line(graphic.subPixelOptimizeLine({ - anid: 'line_' + ticks[i], + /** + * Axis model + * @param {module:echarts/coord/cartesian/AxisModel} + */ + model: null, - shape: { - x1: p1[0], - y1: p1[1], - x2: p2[0], - y2: p2[1] - }, - style: zrUtil.defaults({ - stroke: lineColors[colorIndex] - }, lineStyle), - silent: true - }))); - } + isHorizontal: function () { + var position = this.position; + return position === 'top' || position === 'bottom'; }, /** - * @param {module:echarts/coord/cartesian/AxisModel} axisModel - * @param {module:echarts/coord/cartesian/GridModel} gridModel - * @param {number|Function} labelInterval - * @private + * Each item cooresponds to this.getExtent(), which + * means globalExtent[0] may greater than globalExtent[1], + * unless `asc` is input. + * + * @param {boolean} [asc] + * @return {Array.} */ - _splitArea: function (axisModel, gridModel, labelInterval) { - var axis = axisModel.axis; + getGlobalExtent: function (asc) { + var ret = this.getExtent(); + ret[0] = this.toGlobalCoord(ret[0]); + ret[1] = this.toGlobalCoord(ret[1]); + asc && ret[0] > ret[1] && ret.reverse(); + return ret; + }, - if (axis.isBlank()) { - return; + getOtherAxis: function () { + this.grid.getOtherAxis(); + }, + + /** + * @return {number} + */ + getLabelInterval: function () { + var labelInterval = this._labelInterval; + if (!labelInterval) { + labelInterval = this._labelInterval = axisLabelInterval(this); } + return labelInterval; + }, - var splitAreaModel = axisModel.getModel('splitArea'); - var areaStyleModel = splitAreaModel.getModel('areaStyle'); - var areaColors = areaStyleModel.get('color'); + /** + * If label is ignored. + * Automatically used when axis is category and label can not be all shown + * @param {number} idx + * @return {boolean} + */ + isLabelIgnored: function (idx) { + if (this.type === 'category') { + var labelInterval = this.getLabelInterval(); + return ((typeof labelInterval === 'function') + && !labelInterval(idx, this.scale.getLabel(idx))) + || idx % (labelInterval + 1); + } + }, - var gridRect = gridModel.coordinateSystem.getRect(); + /** + * @override + */ + pointToData: function (point, clamp) { + return this.coordToData(this.toLocalCoord(point[this.dim === 'x' ? 0 : 1]), clamp); + }, - var ticksCoords = axis.getTicksCoords( - // splitAreaModel.get('alignWithLabel') - ); - var ticks = axis.scale.getTicks(); + /** + * Transform global coord to local coord, + * i.e. var localCoord = axis.toLocalCoord(80); + * designate by module:echarts/coord/cartesian/Grid. + * @type {Function} + */ + toLocalCoord: null, - var prevX = axis.toGlobalCoord(ticksCoords[0]); - var prevY = axis.toGlobalCoord(ticksCoords[0]); + /** + * Transform global coord to local coord, + * i.e. var globalCoord = axis.toLocalCoord(40); + * designate by module:echarts/coord/cartesian/Grid. + * @type {Function} + */ + toGlobalCoord: null - var count = 0; + }; + zrUtil.inherits(Axis2D, Axis); - var areaInterval = getInterval(splitAreaModel, labelInterval); + module.exports = Axis2D; - var areaStyle = areaStyleModel.getAreaStyle(); - areaColors = zrUtil.isArray(areaColors) ? areaColors : [areaColors]; - for (var i = 1; i < ticksCoords.length; i++) { - if (ifIgnoreOnTick(axis, i, areaInterval)) { - continue; - } +/***/ }, +/* 128 */ +/***/ function(module, exports, __webpack_require__) { - var tickCoord = axis.toGlobalCoord(ticksCoords[i]); + 'use strict'; + /** + * Helper function for axisLabelInterval calculation + */ - var x; - var y; - var width; - var height; - if (axis.isHorizontal()) { - x = prevX; - y = gridRect.y; - width = tickCoord - x; - height = gridRect.height; - } - else { - x = gridRect.x; - y = prevY; - width = gridRect.width; - height = tickCoord - y; - } - var colorIndex = (count++) % areaColors.length; - this._axisGroup.add(new graphic.Rect({ - anid: 'area_' + ticks[i], - shape: { - x: x, - y: y, - width: width, - height: height - }, - style: zrUtil.defaults({ - fill: areaColors[colorIndex] - }, areaStyle), - silent: true - })); + var zrUtil = __webpack_require__(4); + var axisHelper = __webpack_require__(105); - prevX = x + width; - prevY = y + height; - } + module.exports = function (axis) { + var axisModel = axis.model; + var labelModel = axisModel.getModel('axisLabel'); + var labelInterval = labelModel.get('interval'); + if (!(axis.type === 'category' && labelInterval === 'auto')) { + return labelInterval === 'auto' ? 0 : labelInterval; } - }); - AxisView.extend({ - type: 'xAxis' - }); - AxisView.extend({ - type: 'yAxis' - }); + return axisHelper.getAxisLabelInterval( + zrUtil.map(axis.scale.getTicks(), axis.dataToCoord, axis), + axisModel.getFormattedLabels(), + labelModel.getModel('textStyle').getFont(), + axis.isHorizontal() + ); + }; - /** - * @inner - */ - function layoutAxis(gridModel, axisModel) { - var grid = gridModel.coordinateSystem; - var axis = axisModel.axis; - var layout = {}; - var rawAxisPosition = axis.position; - var axisPosition = axis.onZero ? 'onZero' : rawAxisPosition; - var axisDim = axis.dim; +/***/ }, +/* 129 */ +/***/ function(module, exports, __webpack_require__) { - // [left, right, top, bottom] - var rect = grid.getRect(); - var rectBound = [rect.x, rect.x + rect.width, rect.y, rect.y + rect.height]; + 'use strict'; + // Grid 是在有直角坐标系的时候必须要存在的 + // 所以这里也要被 Cartesian2D 依赖 - var axisOffset = axisModel.get('offset') || 0; - var posMap = { - x: { top: rectBound[2] - axisOffset, bottom: rectBound[3] + axisOffset }, - y: { left: rectBound[0] - axisOffset, right: rectBound[1] + axisOffset } - }; + __webpack_require__(130); - posMap.x.onZero = Math.max(Math.min(getZero('y'), posMap.x.bottom), posMap.x.top); - posMap.y.onZero = Math.max(Math.min(getZero('x'), posMap.y.right), posMap.y.left); + var ComponentModel = __webpack_require__(19); - function getZero(dim, val) { - var theAxis = grid.getAxis(dim); - return theAxis.toGlobalCoord(theAxis.dataToCoord(0)); - } + module.exports = ComponentModel.extend({ - // Axis position - layout.position = [ - axisDim === 'y' ? posMap.y[axisPosition] : rectBound[0], - axisDim === 'x' ? posMap.x[axisPosition] : rectBound[3] - ]; + type: 'grid', - // Axis rotation - layout.rotation = Math.PI / 2 * (axisDim === 'x' ? 0 : 1); + dependencies: ['xAxis', 'yAxis'], - // Tick and label direction, x y is axisDim - var dirMap = {top: -1, bottom: 1, left: -1, right: 1}; + layoutMode: 'box', - layout.labelDirection = layout.tickDirection = layout.nameDirection = dirMap[rawAxisPosition]; - if (axis.onZero) { - layout.labelOffset = posMap[axisDim][rawAxisPosition] - posMap[axisDim].onZero; - } + /** + * @type {module:echarts/coord/cartesian/Grid} + */ + coordinateSystem: null, - if (axisModel.getModel('axisTick').get('inside')) { - layout.tickDirection = -layout.tickDirection; - } - if (axisModel.getModel('axisLabel').get('inside')) { - layout.labelDirection = -layout.labelDirection; + defaultOption: { + show: false, + zlevel: 0, + z: 0, + left: '10%', + top: 60, + right: '10%', + bottom: 60, + // If grid size contain label + containLabel: false, + // width: {totalWidth} - left - right, + // height: {totalHeight} - top - bottom, + backgroundColor: 'rgba(0,0,0,0)', + borderWidth: 1, + borderColor: '#ccc' } - - // Special label rotation - var labelRotation = axisModel.getModel('axisLabel').get('rotate'); - layout.labelRotation = axisPosition === 'top' ? -labelRotation : labelRotation; - - // label interval when auto mode. - layout.labelInterval = axis.getLabelInterval(); - - // Over splitLine and splitArea - layout.z2 = 1; - - return layout; - } + }); /***/ }, -/* 133 */ +/* 130 */ /***/ function(module, exports, __webpack_require__) { - + 'use strict'; - var zrUtil = __webpack_require__(4); - var formatUtil = __webpack_require__(6); - var graphic = __webpack_require__(43); - var Model = __webpack_require__(12); - var numberUtil = __webpack_require__(7); - var remRadian = numberUtil.remRadian; - var isRadianAroundZero = numberUtil.isRadianAroundZero; - var vec2 = __webpack_require__(10); - var v2ApplyTransform = vec2.applyTransform; - var retrieve = zrUtil.retrieve; - var PI = Math.PI; + var ComponentModel = __webpack_require__(19); + var zrUtil = __webpack_require__(4); + var axisModelCreator = __webpack_require__(131); - function makeAxisEventDataBase(axisModel) { - var eventData = { - componentType: axisModel.mainType - }; - eventData[axisModel.mainType + 'Index'] = axisModel.componentIndex; - return eventData; - } + var AxisModel = ComponentModel.extend({ - /** - * A final axis is translated and rotated from a "standard axis". - * So opt.position and opt.rotation is required. - * - * A standard axis is and axis from [0, 0] to [0, axisExtent[1]], - * for example: (0, 0) ------------> (0, 50) - * - * nameDirection or tickDirection or labelDirection is 1 means tick - * or label is below the standard axis, whereas is -1 means above - * the standard axis. labelOffset means offset between label and axis, - * which is useful when 'onZero', where axisLabel is in the grid and - * label in outside grid. - * - * Tips: like always, - * positive rotation represents anticlockwise, and negative rotation - * represents clockwise. - * The direction of position coordinate is the same as the direction - * of screen coordinate. - * - * Do not need to consider axis 'inverse', which is auto processed by - * axis extent. - * - * @param {module:zrender/container/Group} group - * @param {Object} axisModel - * @param {Object} opt Standard axis parameters. - * @param {Array.} opt.position [x, y] - * @param {number} opt.rotation by radian - * @param {number} [opt.nameDirection=1] 1 or -1 Used when nameLocation is 'middle'. - * @param {number} [opt.tickDirection=1] 1 or -1 - * @param {number} [opt.labelDirection=1] 1 or -1 - * @param {number} [opt.labelOffset=0] Usefull when onZero. - * @param {string} [opt.axisLabelShow] default get from axisModel. - * @param {string} [opt.axisName] default get from axisModel. - * @param {number} [opt.axisNameAvailableWidth] - * @param {number} [opt.labelRotation] by degree, default get from axisModel. - * @param {number} [opt.labelInterval] Default label interval when label - * interval from model is null or 'auto'. - * @param {number} [opt.strokeContainThreshold] Default label interval when label - */ - var AxisBuilder = function (axisModel, opt) { + type: 'cartesian2dAxis', /** - * @readOnly + * @type {module:echarts/coord/cartesian/Axis2D} */ - this.opt = opt; + axis: null, /** - * @readOnly + * @override */ - this.axisModel = axisModel; - - // Default value - zrUtil.defaults( - opt, - { - labelOffset: 0, - nameDirection: 1, - tickDirection: 1, - labelDirection: 1, - silent: true - } - ); + init: function () { + AxisModel.superApply(this, 'init', arguments); + this.resetRange(); + }, /** - * @readOnly + * @override */ - this.group = new graphic.Group(); + mergeOption: function () { + AxisModel.superApply(this, 'mergeOption', arguments); + this.resetRange(); + }, - // FIXME Not use a seperate text group? - var dumbGroup = new graphic.Group({ - position: opt.position.slice(), - rotation: opt.rotation - }); + /** + * @override + */ + restoreData: function () { + AxisModel.superApply(this, 'restoreData', arguments); + this.resetRange(); + }, - // this.group.add(dumbGroup); - // this._dumbGroup = dumbGroup; + /** + * @override + * @return {module:echarts/model/Component} + */ + getCoordSysModel: function () { + return this.ecModel.queryComponents({ + mainType: 'grid', + index: this.option.gridIndex, + id: this.option.gridId + })[0]; + } - dumbGroup.updateTransform(); - this._transform = dumbGroup.transform; + }); - this._dumbGroup = dumbGroup; + function getAxisType(axisDim, option) { + // Default axis with data is category axis + return option.type || (option.data ? 'category' : 'value'); + } + + zrUtil.merge(AxisModel.prototype, __webpack_require__(111)); + + var extraOption = { + // gridIndex: 0, + // gridId: '', + + // Offset is for multiple axis on the same position + offset: 0 }; - AxisBuilder.prototype = { + axisModelCreator('x', AxisModel, getAxisType, extraOption); + axisModelCreator('y', AxisModel, getAxisType, extraOption); - constructor: AxisBuilder, + module.exports = AxisModel; - hasBuilder: function (name) { - return !!builders[name]; + +/***/ }, +/* 131 */ +/***/ function(module, exports, __webpack_require__) { + + + + var axisDefault = __webpack_require__(132); + var zrUtil = __webpack_require__(4); + var ComponentModel = __webpack_require__(19); + var layout = __webpack_require__(21); + + // FIXME axisType is fixed ? + var AXIS_TYPES = ['value', 'category', 'time', 'log']; + + /** + * Generate sub axis model class + * @param {string} axisName 'x' 'y' 'radius' 'angle' 'parallel' + * @param {module:echarts/model/Component} BaseAxisModelClass + * @param {Function} axisTypeDefaulter + * @param {Object} [extraDefaultOption] + */ + module.exports = function (axisName, BaseAxisModelClass, axisTypeDefaulter, extraDefaultOption) { + + zrUtil.each(AXIS_TYPES, function (axisType) { + + BaseAxisModelClass.extend({ + + type: axisName + 'Axis.' + axisType, + + mergeDefaultAndTheme: function (option, ecModel) { + var layoutMode = this.layoutMode; + var inputPositionParams = layoutMode + ? layout.getLayoutParams(option) : {}; + + var themeModel = ecModel.getTheme(); + zrUtil.merge(option, themeModel.get(axisType + 'Axis')); + zrUtil.merge(option, this.getDefaultOption()); + + option.type = axisTypeDefaulter(axisName, option); + + if (layoutMode) { + layout.mergeLayoutParam(option, inputPositionParams, layoutMode); + } + }, + + defaultOption: zrUtil.mergeAll( + [ + {}, + axisDefault[axisType + 'Axis'], + extraDefaultOption + ], + true + ) + }); + }); + + ComponentModel.registerSubTypeDefaulter( + axisName + 'Axis', + zrUtil.curry(axisTypeDefaulter, axisName) + ); + }; + + +/***/ }, +/* 132 */ +/***/ function(module, exports, __webpack_require__) { + + + + var zrUtil = __webpack_require__(4); + + var defaultOption = { + show: true, + zlevel: 0, // 一级层叠 + z: 0, // 二级层叠 + // 反向坐标轴 + inverse: false, + + // 坐标轴名字,默认为空 + name: '', + // 坐标轴名字位置,支持'start' | 'middle' | 'end' + nameLocation: 'end', + // 坐标轴名字旋转,degree。 + nameRotate: null, // Adapt to axis rotate, when nameLocation is 'middle'. + nameTruncate: { + maxWidth: null, + ellipsis: '...', + placeholder: '.' }, + // 坐标轴文字样式,默认取全局样式 + nameTextStyle: {}, + // 文字与轴线距离 + nameGap: 15, - add: function (name) { - builders[name].call(this); + silent: false, // Default false to support tooltip. + triggerEvent: false, // Default false to avoid legacy user event listener fail. + + tooltip: { + show: false }, - getGroup: function () { - return this.group; + axisPointer: {}, + + // 坐标轴线 + axisLine: { + // 默认显示,属性show控制显示与否 + show: true, + onZero: true, + // 属性lineStyle控制线条样式 + lineStyle: { + color: '#333', + width: 1, + type: 'solid' + } + }, + // 坐标轴小标记 + axisTick: { + // 属性show控制显示与否,默认显示 + show: true, + // 控制小标记是否在grid里 + inside: false, + // 属性length控制线长 + length: 5, + // 属性lineStyle控制线条样式 + lineStyle: { + width: 1 + } + }, + // 坐标轴文本标签,详见axis.axisLabel + axisLabel: { + show: true, + // 控制文本标签是否在grid里 + inside: false, + rotate: 0, + margin: 8, + // formatter: null, + // 其余属性默认使用全局文本样式,详见TEXTSTYLE + textStyle: { + fontSize: 12 + } + }, + // 分隔线 + splitLine: { + // 默认显示,属性show控制显示与否 + show: true, + // 属性lineStyle(详见lineStyle)控制线条样式 + lineStyle: { + color: ['#ccc'], + width: 1, + type: 'solid' + } + }, + // 分隔区域 + splitArea: { + // 默认不显示,属性show控制显示与否 + show: false, + // 属性areaStyle(详见areaStyle)控制区域样式 + areaStyle: { + color: ['rgba(250,250,250,0.3)','rgba(200,200,200,0.3)'] + } + } + }; + + var categoryAxis = zrUtil.merge({ + // 类目起始和结束两端空白策略 + boundaryGap: true, + // splitArea: { + // show: false + // }, + splitLine: { + show: false + }, + // 坐标轴小标记 + axisTick: { + // If tick is align with label when boundaryGap is true + alignWithLabel: false, + interval: 'auto' + }, + // 坐标轴文本标签,详见axis.axisLabel + axisLabel: { + interval: 'auto' } + }, defaultOption); + + var valueAxis = zrUtil.merge({ + // 数值起始和结束两端空白策略 + boundaryGap: [0, 0], + // 最小值, 设置成 'dataMin' 则从数据中计算最小值 + // min: null, + // 最大值,设置成 'dataMax' 则从数据中计算最大值 + // max: null, + // Readonly prop, specifies start value of the range when using data zoom. + // rangeStart: null + // Readonly prop, specifies end value of the range when using data zoom. + // rangeEnd: null + // 脱离0值比例,放大聚焦到最终_min,_max区间 + // scale: false, + // 分割段数,默认为5 + splitNumber: 5 + // Minimum interval + // minInterval: null + }, defaultOption); + + // FIXME + var timeAxis = zrUtil.defaults({ + scale: true, + min: 'dataMin', + max: 'dataMax' + }, valueAxis); + var logAxis = zrUtil.defaults({ + logBase: 10 + }, valueAxis); + logAxis.scale = true; + module.exports = { + categoryAxis: categoryAxis, + valueAxis: valueAxis, + timeAxis: timeAxis, + logAxis: logAxis }; - var builders = { + +/***/ }, +/* 133 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + // TODO boundaryGap + + + __webpack_require__(130); + + __webpack_require__(134); + + +/***/ }, +/* 134 */ +/***/ function(module, exports, __webpack_require__) { + + + + var zrUtil = __webpack_require__(4); + var graphic = __webpack_require__(44); + var AxisBuilder = __webpack_require__(135); + var CartesianAxisPointer = __webpack_require__(136); + var AxisView = __webpack_require__(141); + var cartesianAxisHelper = __webpack_require__(140); + var ifIgnoreOnTick = AxisBuilder.ifIgnoreOnTick; + var getInterval = AxisBuilder.getInterval; + + var axisBuilderAttrs = [ + 'axisLine', 'axisLabel', 'axisTick', 'axisName' + ]; + var selfBuilderAttrs = [ + 'splitArea', 'splitLine' + ]; + + // function getAlignWithLabel(model, axisModel) { + // var alignWithLabel = model.get('alignWithLabel'); + // if (alignWithLabel === 'auto') { + // alignWithLabel = axisModel.get('axisTick.alignWithLabel'); + // } + // return alignWithLabel; + // } + + var CartesianAxisView = AxisView.extend({ + + type: 'cartesianAxis', + + axisPointerClass: CartesianAxisPointer, /** - * @private + * @override */ - axisLine: function () { - var opt = this.opt; - var axisModel = this.axisModel; + render: function (axisModel, ecModel, api, payload) { - if (!axisModel.get('axisLine.show')) { + this.group.removeAll(); + + var oldAxisGroup = this._axisGroup; + this._axisGroup = new graphic.Group(); + + this.group.add(this._axisGroup); + + if (!axisModel.get('show')) { return; } - var extent = this.axisModel.axis.getExtent(); + var gridModel = axisModel.getCoordSysModel(); - var matrix = this._transform; - var pt1 = [extent[0], 0]; - var pt2 = [extent[1], 0]; - if (matrix) { - v2ApplyTransform(pt1, pt1, matrix); - v2ApplyTransform(pt2, pt2, matrix); - } + var layout = cartesianAxisHelper.layout(gridModel, axisModel); - this.group.add(new graphic.Line(graphic.subPixelOptimizeLine({ + var axisBuilder = new AxisBuilder(axisModel, layout); - // Id for animation - anid: 'line', + zrUtil.each(axisBuilderAttrs, axisBuilder.add, axisBuilder); - shape: { - x1: pt1[0], - y1: pt1[1], - x2: pt2[0], - y2: pt2[1] - }, - style: zrUtil.extend( - {lineCap: 'round'}, - axisModel.getModel('axisLine.lineStyle').getLineStyle() - ), - strokeContainThreshold: opt.strokeContainThreshold || 5, - silent: true, - z2: 1 - }))); + this._axisGroup.add(axisBuilder.getGroup()); + + zrUtil.each(selfBuilderAttrs, function (name) { + if (axisModel.get(name + '.show')) { + this['_' + name](axisModel, gridModel, layout.labelInterval); + } + }, this); + + graphic.groupTransition(oldAxisGroup, this._axisGroup, axisModel); + + CartesianAxisView.superCall(this, 'render', axisModel, ecModel, api, payload); }, /** + * @param {module:echarts/coord/cartesian/AxisModel} axisModel + * @param {module:echarts/coord/cartesian/GridModel} gridModel + * @param {number|Function} labelInterval * @private */ - axisTick: function () { - var axisModel = this.axisModel; + _splitLine: function (axisModel, gridModel, labelInterval) { var axis = axisModel.axis; - if (!axisModel.get('axisTick.show') || axis.isBlank()) { + if (axis.scale.isBlank()) { return; } - var tickModel = axisModel.getModel('axisTick'); - var opt = this.opt; + var splitLineModel = axisModel.getModel('splitLine'); + var lineStyleModel = splitLineModel.getModel('lineStyle'); + var lineColors = lineStyleModel.get('color'); - var lineStyleModel = tickModel.getModel('lineStyle'); - var tickLen = tickModel.get('length'); + var lineInterval = getInterval(splitLineModel, labelInterval); - var tickInterval = getInterval(tickModel, opt.labelInterval); - var ticksCoords = axis.getTicksCoords(tickModel.get('alignWithLabel')); - var ticks = axis.scale.getTicks(); + lineColors = zrUtil.isArray(lineColors) ? lineColors : [lineColors]; - var pt1 = []; - var pt2 = []; - var matrix = this._transform; + var gridRect = gridModel.coordinateSystem.getRect(); + var isHorizontal = axis.isHorizontal(); + var lineCount = 0; + + var ticksCoords = axis.getTicksCoords( + // splitLineModel.get('alignWithLabel') + ); + var ticks = axis.scale.getTicks(); + + var p1 = []; + var p2 = []; + // Simple optimization + // Batching the lines if color are the same + var lineStyle = lineStyleModel.getLineStyle(); for (var i = 0; i < ticksCoords.length; i++) { - // Only ordinal scale support tick interval - if (ifIgnoreOnTick(axis, i, tickInterval)) { - continue; + if (ifIgnoreOnTick(axis, i, lineInterval)) { + continue; } - var tickCoord = ticksCoords[i]; - - pt1[0] = tickCoord; - pt1[1] = 0; - pt2[0] = tickCoord; - pt2[1] = opt.tickDirection * tickLen; + var tickCoord = axis.toGlobalCoord(ticksCoords[i]); - if (matrix) { - v2ApplyTransform(pt1, pt1, matrix); - v2ApplyTransform(pt2, pt2, matrix); + if (isHorizontal) { + p1[0] = tickCoord; + p1[1] = gridRect.y; + p2[0] = tickCoord; + p2[1] = gridRect.y + gridRect.height; + } + else { + p1[0] = gridRect.x; + p1[1] = tickCoord; + p2[0] = gridRect.x + gridRect.width; + p2[1] = tickCoord; } - // Tick line, Not use group transform to have better line draw - this.group.add(new graphic.Line(graphic.subPixelOptimizeLine({ - // Id for animation - anid: 'tick_' + ticks[i], + var colorIndex = (lineCount++) % lineColors.length; + this._axisGroup.add(new graphic.Line(graphic.subPixelOptimizeLine({ + anid: 'line_' + ticks[i], shape: { - x1: pt1[0], - y1: pt1[1], - x2: pt2[0], - y2: pt2[1] + x1: p1[0], + y1: p1[1], + x2: p2[0], + y2: p2[1] }, - style: zrUtil.defaults( - lineStyleModel.getLineStyle(), - { - stroke: axisModel.get('axisLine.lineStyle.color') - } - ), - z2: 2, + style: zrUtil.defaults({ + stroke: lineColors[colorIndex] + }, lineStyle), silent: true }))); } @@ -28918,68 +29107,407 @@ return /******/ (function(modules) { // webpackBootstrap /** * @param {module:echarts/coord/cartesian/AxisModel} axisModel * @param {module:echarts/coord/cartesian/GridModel} gridModel + * @param {number|Function} labelInterval * @private */ - axisLabel: function () { - var opt = this.opt; - var axisModel = this.axisModel; + _splitArea: function (axisModel, gridModel, labelInterval) { var axis = axisModel.axis; - var show = retrieve(opt.axisLabelShow, axisModel.get('axisLabel.show')); - if (!show || axis.isBlank()) { + if (axis.scale.isBlank()) { return; } - var labelModel = axisModel.getModel('axisLabel'); - var textStyleModel = labelModel.getModel('textStyle'); - var labelMargin = labelModel.get('margin'); + var splitAreaModel = axisModel.getModel('splitArea'); + var areaStyleModel = splitAreaModel.getModel('areaStyle'); + var areaColors = areaStyleModel.get('color'); + + var gridRect = gridModel.coordinateSystem.getRect(); + + var ticksCoords = axis.getTicksCoords( + // splitAreaModel.get('alignWithLabel') + ); var ticks = axis.scale.getTicks(); - var labels = axisModel.getFormattedLabels(); - // Special label rotate. - var labelRotation = retrieve(opt.labelRotation, labelModel.get('rotate')) || 0; - // To radian. - labelRotation = labelRotation * PI / 180; + var prevX = axis.toGlobalCoord(ticksCoords[0]); + var prevY = axis.toGlobalCoord(ticksCoords[0]); - var labelLayout = innerTextLayout(opt, labelRotation, opt.labelDirection); - var categoryData = axisModel.get('data'); + var count = 0; - var textEls = []; - var silent = isSilent(axisModel); - var triggerEvent = axisModel.get('triggerEvent'); + var areaInterval = getInterval(splitAreaModel, labelInterval); - zrUtil.each(ticks, function (tickVal, index) { - if (ifIgnoreOnTick(axis, index, opt.labelInterval)) { - return; - } + var areaStyle = areaStyleModel.getAreaStyle(); + areaColors = zrUtil.isArray(areaColors) ? areaColors : [areaColors]; - var itemTextStyleModel = textStyleModel; - if (categoryData && categoryData[tickVal] && categoryData[tickVal].textStyle) { - itemTextStyleModel = new Model( - categoryData[tickVal].textStyle, textStyleModel, axisModel.ecModel - ); + for (var i = 1; i < ticksCoords.length; i++) { + if (ifIgnoreOnTick(axis, i, areaInterval)) { + continue; } - var textColor = itemTextStyleModel.getTextColor() - || axisModel.get('axisLine.lineStyle.color'); - var tickCoord = axis.dataToCoord(tickVal); - var pos = [ - tickCoord, - opt.labelOffset + opt.labelDirection * labelMargin - ]; - var labelBeforeFormat = axis.scale.getLabel(tickVal); + var tickCoord = axis.toGlobalCoord(ticksCoords[i]); - var textEl = new graphic.Text({ + var x; + var y; + var width; + var height; + if (axis.isHorizontal()) { + x = prevX; + y = gridRect.y; + width = tickCoord - x; + height = gridRect.height; + } + else { + x = gridRect.x; + y = prevY; + width = gridRect.width; + height = tickCoord - y; + } - // Id for animation - anid: 'label_' + tickVal, + var colorIndex = (count++) % areaColors.length; + this._axisGroup.add(new graphic.Rect({ + anid: 'area_' + ticks[i], - style: { + shape: { + x: x, + y: y, + width: width, + height: height + }, + style: zrUtil.defaults({ + fill: areaColors[colorIndex] + }, areaStyle), + silent: true + })); + + prevX = x + width; + prevY = y + height; + } + } + }); + + CartesianAxisView.extend({ + type: 'xAxis' + }); + CartesianAxisView.extend({ + type: 'yAxis' + }); + + + +/***/ }, +/* 135 */ +/***/ function(module, exports, __webpack_require__) { + + + + var zrUtil = __webpack_require__(4); + var formatUtil = __webpack_require__(6); + var graphic = __webpack_require__(44); + var Model = __webpack_require__(12); + var numberUtil = __webpack_require__(7); + var remRadian = numberUtil.remRadian; + var isRadianAroundZero = numberUtil.isRadianAroundZero; + var vec2 = __webpack_require__(10); + var v2ApplyTransform = vec2.applyTransform; + var retrieve = zrUtil.retrieve; + + var PI = Math.PI; + + function makeAxisEventDataBase(axisModel) { + var eventData = { + componentType: axisModel.mainType + }; + eventData[axisModel.mainType + 'Index'] = axisModel.componentIndex; + return eventData; + } + + /** + * A final axis is translated and rotated from a "standard axis". + * So opt.position and opt.rotation is required. + * + * A standard axis is and axis from [0, 0] to [0, axisExtent[1]], + * for example: (0, 0) ------------> (0, 50) + * + * nameDirection or tickDirection or labelDirection is 1 means tick + * or label is below the standard axis, whereas is -1 means above + * the standard axis. labelOffset means offset between label and axis, + * which is useful when 'onZero', where axisLabel is in the grid and + * label in outside grid. + * + * Tips: like always, + * positive rotation represents anticlockwise, and negative rotation + * represents clockwise. + * The direction of position coordinate is the same as the direction + * of screen coordinate. + * + * Do not need to consider axis 'inverse', which is auto processed by + * axis extent. + * + * @param {module:zrender/container/Group} group + * @param {Object} axisModel + * @param {Object} opt Standard axis parameters. + * @param {Array.} opt.position [x, y] + * @param {number} opt.rotation by radian + * @param {number} [opt.nameDirection=1] 1 or -1 Used when nameLocation is 'middle'. + * @param {number} [opt.tickDirection=1] 1 or -1 + * @param {number} [opt.labelDirection=1] 1 or -1 + * @param {number} [opt.labelOffset=0] Usefull when onZero. + * @param {string} [opt.axisLabelShow] default get from axisModel. + * @param {string} [opt.axisName] default get from axisModel. + * @param {number} [opt.axisNameAvailableWidth] + * @param {number} [opt.labelRotate] by degree, default get from axisModel. + * @param {number} [opt.labelInterval] Default label interval when label + * interval from model is null or 'auto'. + * @param {number} [opt.strokeContainThreshold] Default label interval when label + */ + var AxisBuilder = function (axisModel, opt) { + + /** + * @readOnly + */ + this.opt = opt; + + /** + * @readOnly + */ + this.axisModel = axisModel; + + // Default value + zrUtil.defaults( + opt, + { + labelOffset: 0, + nameDirection: 1, + tickDirection: 1, + labelDirection: 1, + silent: true + } + ); + + /** + * @readOnly + */ + this.group = new graphic.Group(); + + // FIXME Not use a seperate text group? + var dumbGroup = new graphic.Group({ + position: opt.position.slice(), + rotation: opt.rotation + }); + + // this.group.add(dumbGroup); + // this._dumbGroup = dumbGroup; + + dumbGroup.updateTransform(); + this._transform = dumbGroup.transform; + + this._dumbGroup = dumbGroup; + }; + + AxisBuilder.prototype = { + + constructor: AxisBuilder, + + hasBuilder: function (name) { + return !!builders[name]; + }, + + add: function (name) { + builders[name].call(this); + }, + + getGroup: function () { + return this.group; + } + + }; + + var builders = { + + /** + * @private + */ + axisLine: function () { + var opt = this.opt; + var axisModel = this.axisModel; + + if (!axisModel.get('axisLine.show')) { + return; + } + + var extent = this.axisModel.axis.getExtent(); + + var matrix = this._transform; + var pt1 = [extent[0], 0]; + var pt2 = [extent[1], 0]; + if (matrix) { + v2ApplyTransform(pt1, pt1, matrix); + v2ApplyTransform(pt2, pt2, matrix); + } + + this.group.add(new graphic.Line(graphic.subPixelOptimizeLine({ + + // Id for animation + anid: 'line', + + shape: { + x1: pt1[0], + y1: pt1[1], + x2: pt2[0], + y2: pt2[1] + }, + style: zrUtil.extend( + {lineCap: 'round'}, + axisModel.getModel('axisLine.lineStyle').getLineStyle() + ), + strokeContainThreshold: opt.strokeContainThreshold || 5, + silent: true, + z2: 1 + }))); + }, + + /** + * @private + */ + axisTick: function () { + var axisModel = this.axisModel; + var axis = axisModel.axis; + + if (!axisModel.get('axisTick.show') || axis.scale.isBlank()) { + return; + } + + var tickModel = axisModel.getModel('axisTick'); + var opt = this.opt; + + var lineStyleModel = tickModel.getModel('lineStyle'); + var tickLen = tickModel.get('length'); + + var tickInterval = getInterval(tickModel, opt.labelInterval); + var ticksCoords = axis.getTicksCoords(tickModel.get('alignWithLabel')); + var ticks = axis.scale.getTicks(); + + var pt1 = []; + var pt2 = []; + var matrix = this._transform; + + for (var i = 0; i < ticksCoords.length; i++) { + // Only ordinal scale support tick interval + if (ifIgnoreOnTick(axis, i, tickInterval)) { + continue; + } + + var tickCoord = ticksCoords[i]; + + pt1[0] = tickCoord; + pt1[1] = 0; + pt2[0] = tickCoord; + pt2[1] = opt.tickDirection * tickLen; + + if (matrix) { + v2ApplyTransform(pt1, pt1, matrix); + v2ApplyTransform(pt2, pt2, matrix); + } + // Tick line, Not use group transform to have better line draw + this.group.add(new graphic.Line(graphic.subPixelOptimizeLine({ + + // Id for animation + anid: 'tick_' + ticks[i], + + shape: { + x1: pt1[0], + y1: pt1[1], + x2: pt2[0], + y2: pt2[1] + }, + style: zrUtil.defaults( + lineStyleModel.getLineStyle(), + { + stroke: axisModel.get('axisLine.lineStyle.color') + } + ), + z2: 2, + silent: true + }))); + } + }, + + /** + * @param {module:echarts/coord/cartesian/AxisModel} axisModel + * @param {module:echarts/coord/cartesian/GridModel} gridModel + * @private + */ + axisLabel: function () { + var opt = this.opt; + var axisModel = this.axisModel; + var axis = axisModel.axis; + var show = retrieve(opt.axisLabelShow, axisModel.get('axisLabel.show')); + + if (!show || axis.scale.isBlank()) { + return; + } + + var labelModel = axisModel.getModel('axisLabel'); + var textStyleModel = labelModel.getModel('textStyle'); + var labelMargin = labelModel.get('margin'); + var ticks = axis.scale.getTicks(); + var labels = axisModel.getFormattedLabels(); + + // Special label rotate. + var labelRotation = ( + retrieve(opt.labelRotate, labelModel.get('rotate')) || 0 + ) * PI / 180; + + var labelLayout = innerTextLayout(opt.rotation, labelRotation, opt.labelDirection); + var categoryData = axisModel.get('data'); + + var textEls = []; + var silent = isSilent(axisModel); + var triggerEvent = axisModel.get('triggerEvent'); + + zrUtil.each(ticks, function (tickVal, index) { + if (ifIgnoreOnTick(axis, index, opt.labelInterval)) { + return; + } + + var itemTextStyleModel = textStyleModel; + if (categoryData && categoryData[tickVal] && categoryData[tickVal].textStyle) { + itemTextStyleModel = new Model( + categoryData[tickVal].textStyle, textStyleModel, axisModel.ecModel + ); + } + var textColor = itemTextStyleModel.getTextColor() + || axisModel.get('axisLine.lineStyle.color'); + + var tickCoord = axis.dataToCoord(tickVal); + var pos = [ + tickCoord, + opt.labelOffset + opt.labelDirection * labelMargin + ]; + var labelStr = axis.scale.getLabel(tickVal); + + var textEl = new graphic.Text({ + + // Id for animation + anid: 'label_' + tickVal, + + style: { text: labels[index], textAlign: itemTextStyleModel.get('align', true) || labelLayout.textAlign, - textVerticalAlign: itemTextStyleModel.get('baseline', true) || labelLayout.verticalAlign, + textVerticalAlign: itemTextStyleModel.get('baseline', true) || labelLayout.textVerticalAlign, textFont: itemTextStyleModel.getFont(), - fill: typeof textColor === 'function' ? textColor(labelBeforeFormat) : textColor + fill: typeof textColor === 'function' + ? textColor( + // (1) In category axis with data zoom, tick is not the original + // index of axis.data. So tick should not be exposed to user + // in category axis. + // (2) Compatible with previous version, which always returns labelStr. + // But in interval scale labelStr is like '223,445', which maked + // user repalce ','. So we modify it to return original val but remain + // it as 'string' to avoid error in replacing. + axis.type === 'category' ? labelStr : axis.type === 'value' ? tickVal + '' : tickVal, + index + ) + : textColor }, position: pos, rotation: labelLayout.rotation, @@ -28991,7 +29519,7 @@ return /******/ (function(modules) { // webpackBootstrap if (triggerEvent) { textEl.eventData = makeAxisEventDataBase(axisModel); textEl.eventData.targetType = 'axisLabel'; - textEl.eventData.value = labelBeforeFormat; + textEl.eventData.value = labelStr; } // FIXME @@ -29074,7 +29602,7 @@ return /******/ (function(modules) { // webpackBootstrap if (nameLocation === 'middle') { labelLayout = innerTextLayout( - opt, + opt.rotation, nameRotation != null ? nameRotation : opt.rotation, // Adapt to axis. nameDirection ); @@ -29129,7 +29657,7 @@ return /******/ (function(modules) { // webpackBootstrap fill: textStyleModel.getTextColor() || axisModel.get('axisLine.lineStyle.color'), textAlign: labelLayout.textAlign, - textVerticalAlign: labelLayout.verticalAlign + textVerticalAlign: labelLayout.textVerticalAlign }, position: pos, rotation: labelLayout.rotation, @@ -29164,23 +29692,33 @@ return /******/ (function(modules) { // webpackBootstrap }; /** - * @inner + * @public + * @static + * @param {Object} opt + * @param {number} axisRotation in radian + * @param {number} textRotation in radian + * @param {number} direction + * @return {Object} { + * rotation, // according to axis + * textAlign, + * textVerticalAlign + * } */ - function innerTextLayout(opt, textRotation, direction) { - var rotationDiff = remRadian(textRotation - opt.rotation); + var innerTextLayout = AxisBuilder.innerTextLayout = function (axisRotation, textRotation, direction) { + var rotationDiff = remRadian(textRotation - axisRotation); var textAlign; - var verticalAlign; + var textVerticalAlign; if (isRadianAroundZero(rotationDiff)) { // Label is parallel with axis line. - verticalAlign = direction > 0 ? 'top' : 'bottom'; + textVerticalAlign = direction > 0 ? 'top' : 'bottom'; textAlign = 'center'; } else if (isRadianAroundZero(rotationDiff - PI)) { // Label is inverse parallel with axis line. - verticalAlign = direction > 0 ? 'bottom' : 'top'; + textVerticalAlign = direction > 0 ? 'bottom' : 'top'; textAlign = 'center'; } else { - verticalAlign = 'middle'; + textVerticalAlign = 'middle'; if (rotationDiff > 0 && rotationDiff < PI) { textAlign = direction > 0 ? 'right' : 'left'; @@ -29193,9 +29731,9 @@ return /******/ (function(modules) { // webpackBootstrap return { rotation: rotationDiff, textAlign: textAlign, - verticalAlign: verticalAlign + textVerticalAlign: textVerticalAlign }; - } + }; /** * @inner @@ -29203,21 +29741,21 @@ return /******/ (function(modules) { // webpackBootstrap function endTextLayout(opt, textPosition, textRotate, extent) { var rotationDiff = remRadian(textRotate - opt.rotation); var textAlign; - var verticalAlign; + var textVerticalAlign; var inverse = extent[0] > extent[1]; var onLeft = (textPosition === 'start' && !inverse) || (textPosition !== 'start' && inverse); if (isRadianAroundZero(rotationDiff - PI / 2)) { - verticalAlign = onLeft ? 'bottom' : 'top'; + textVerticalAlign = onLeft ? 'bottom' : 'top'; textAlign = 'center'; } else if (isRadianAroundZero(rotationDiff - PI * 1.5)) { - verticalAlign = onLeft ? 'top' : 'bottom'; + textVerticalAlign = onLeft ? 'top' : 'bottom'; textAlign = 'center'; } else { - verticalAlign = 'middle'; + textVerticalAlign = 'middle'; if (rotationDiff < PI * 1.5 && rotationDiff > PI / 2) { textAlign = onLeft ? 'left' : 'right'; } @@ -29229,7 +29767,7 @@ return /******/ (function(modules) { // webpackBootstrap return { rotation: rotationDiff, textAlign: textAlign, - verticalAlign: verticalAlign + textVerticalAlign: textVerticalAlign }; } @@ -29278,12777 +29816,16189 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 134 */ +/* 136 */ /***/ function(module, exports, __webpack_require__) { - + 'use strict'; - var zrUtil = __webpack_require__(4); - __webpack_require__(114); + var graphic = __webpack_require__(44); + var BaseAxisPointer = __webpack_require__(137); + var viewHelper = __webpack_require__(139); + var cartesianAxisHelper = __webpack_require__(140); - __webpack_require__(135); - __webpack_require__(137); + var CartesianAxisPointer = BaseAxisPointer.extend({ - var barLayoutGrid = __webpack_require__(140); - var echarts = __webpack_require__(1); + /** + * @override + */ + makeElOption: function (elOption, value, axisModel, axisPointerModel, api) { + var axis = axisModel.axis; + var grid = axis.grid; + var axisPointerType = axisPointerModel.get('type'); + var otherExtent = getCartesian(grid, axis).getOtherAxis(axis).getGlobalExtent(); + var pixelValue = axis.toGlobalCoord(axis.dataToCoord(value, true)); - echarts.registerLayout(zrUtil.curry(barLayoutGrid, 'bar')); - // Visual coding for legend - echarts.registerVisual(function (ecModel) { - ecModel.eachSeriesByType('bar', function (seriesModel) { - var data = seriesModel.getData(); - data.setVisual('legendSymbol', 'roundRect'); - }); - }); + var elStyle = viewHelper.buildElStyle(axisPointerModel); + var pointerOption = pointerShapeBuilder[axisPointerType](axis, pixelValue, otherExtent, elStyle); + pointerOption.style = elStyle; - // In case developer forget to include grid component - __webpack_require__(113); + elOption.graphicKey = pointerOption.type; + elOption.pointer = pointerOption; + var layoutInfo = cartesianAxisHelper.layout(grid.model, axisModel); + viewHelper.buildCartesianSingleLabelElOption( + value, elOption, layoutInfo, axisModel, axisPointerModel, api + ); + }, -/***/ }, -/* 135 */ -/***/ function(module, exports, __webpack_require__) { + /** + * @override + */ + getHandleTransform: function (value, axisModel, axisPointerModel) { + var layoutInfo = cartesianAxisHelper.layout(axisModel.axis.grid.model, axisModel, { + labelInside: false + }); + layoutInfo.labelMargin = axisPointerModel.get('handle.margin'); + return { + position: viewHelper.getTransformedPosition(axisModel.axis, value, layoutInfo), + rotation: layoutInfo.rotation + (layoutInfo.labelDirection < 0 ? Math.PI : 0) + }; + }, - + /** + * @override + */ + updateHandleTransform: function (transform, delta, axisModel, axisPointerModel) { + var axis = axisModel.axis; + var grid = axis.grid; + var axisExtent = axis.getGlobalExtent(true); + var otherExtent = getCartesian(grid, axis).getOtherAxis(axis).getGlobalExtent(); + var dimIndex = axis.dim === 'x' ? 0 : 1; - module.exports = __webpack_require__(136).extend({ + var currPosition = transform.position; + currPosition[dimIndex] += delta[dimIndex]; + currPosition[dimIndex] = Math.min(axisExtent[1], currPosition[dimIndex]); + currPosition[dimIndex] = Math.max(axisExtent[0], currPosition[dimIndex]); - type: 'series.bar', + var cursorOtherValue = (otherExtent[1] + otherExtent[0]) / 2; + var cursorPoint = [cursorOtherValue, cursorOtherValue]; + cursorPoint[dimIndex] = currPosition[dimIndex]; - dependencies: ['grid', 'polar'], + // Make tooltip do not overlap axisPointer and in the middle of the grid. + var tooltipOptions = [{verticalAlign: 'middle'}, {align: 'center'}]; + + return { + position: currPosition, + rotation: transform.rotation, + cursorPoint: cursorPoint, + tooltipOption: tooltipOptions[dimIndex] + }; + } - brushSelector: 'rect' }); + function getCartesian(grid, axis) { + var opt = {}; + opt[axis.dim + 'AxisIndex'] = axis.index; + return grid.getCartesian(opt); + } + + var pointerShapeBuilder = { + + line: function (axis, pixelValue, otherExtent, elStyle) { + var targetShape = viewHelper.makeLineShape( + [pixelValue, otherExtent[0]], + [pixelValue, otherExtent[1]], + getAxisDimIndex(axis) + ); + graphic.subPixelOptimizeLine({ + shape: targetShape, + style: elStyle + }); + return { + type: 'Line', + shape: targetShape + }; + }, + + shadow: function (axis, pixelValue, otherExtent, elStyle) { + var bandWidth = axis.getBandWidth(); + var span = otherExtent[1] - otherExtent[0]; + return { + type: 'Rect', + shape: viewHelper.makeRectShape( + [pixelValue - bandWidth / 2, otherExtent[0]], + [bandWidth, span], + getAxisDimIndex(axis) + ) + }; + } + }; + + function getAxisDimIndex(axis) { + return axis.dim === 'x' ? 0 : 1; + } + + module.exports = CartesianAxisPointer; + /***/ }, -/* 136 */ +/* 137 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; - var SeriesModel = __webpack_require__(28); - var createListFromArray = __webpack_require__(102); + var zrUtil = __webpack_require__(4); + var clazzUtil = __webpack_require__(13); + var graphic = __webpack_require__(44); + var get = __webpack_require__(5).makeGetter(); + var axisPointerModelHelper = __webpack_require__(138); + var eventTool = __webpack_require__(88); + var throttle = __webpack_require__(81); - module.exports = SeriesModel.extend({ + var clone = zrUtil.clone; + var bind = zrUtil.bind; - type: 'series.__base_bar__', + /** + * Base axis pointer class in 2D. + * Implemenents {module:echarts/component/axis/IAxisPointer}. + */ + function BaseAxisPointer () { + } - getInitialData: function (option, ecModel) { - if (true) { - var coordSys = option.coordinateSystem; - if (coordSys !== 'cartesian2d') { - throw new Error('Bar only support cartesian2d coordinateSystem'); - } - } - return createListFromArray(option.data, this, ecModel); - }, + BaseAxisPointer.prototype = { - getMarkerPosition: function (value) { - var coordSys = this.coordinateSystem; - if (coordSys) { - // PENDING if clamp ? - var pt = coordSys.dataToPoint(value, true); - var data = this.getData(); - var offset = data.getLayout('offset'); - var size = data.getLayout('size'); - var offsetIndex = coordSys.getBaseAxis().isHorizontal() ? 0 : 1; - pt[offsetIndex] += offset + size / 2; - return pt; - } - return [NaN, NaN]; - }, + /** + * @private + */ + _group: null, - defaultOption: { - zlevel: 0, // 一级层叠 - z: 2, // 二级层叠 - coordinateSystem: 'cartesian2d', - legendHoverLink: true, - // stack: null + /** + * @private + */ + _lastGraphicKey: null, - // Cartesian coordinate system - // xAxisIndex: 0, - // yAxisIndex: 0, + /** + * @private + */ + _handle: null, - // 最小高度改为0 - barMinHeight: 0, + /** + * @private + */ + _dragging: false, - // barMaxWidth: null, - // 默认自适应 - // barWidth: null, - // 柱间距离,默认为柱形宽度的30%,可设固定值 - // barGap: '30%', - // 类目间柱形距离,默认为类目间距的20%,可设固定值 - // barCategoryGap: '20%', - // label: { - // normal: { - // show: false - // } - // }, - itemStyle: { - normal: { - // color: '各异' - }, - emphasis: {} - } - } - }); + /** + * @private + */ + _lastValue: null, + /** + * @private + */ + _lastStatus: null, -/***/ }, -/* 137 */ -/***/ function(module, exports, __webpack_require__) { + /** + * @private + */ + _payloadInfo: null, - 'use strict'; + /** + * In px, arbitrary value. Do not set too small, + * no animation is ok for most cases. + * @protected + */ + animationThreshold: 15, + /** + * @implement + */ + render: function (axisModel, axisPointerModel, api, forceRender) { + var value = axisPointerModel.get('value'); + var status = axisPointerModel.get('status'); - var zrUtil = __webpack_require__(4); - var graphic = __webpack_require__(43); - var helper = __webpack_require__(138); + // Bind them to `this`, not in closure, otherwise they will not + // be replaced when user calling setOption in not merge mode. + this._axisModel = axisModel; + this._axisPointerModel = axisPointerModel; + this._api = api; - var BAR_BORDER_WIDTH_QUERY = ['itemStyle', 'normal', 'barBorderWidth']; + // Optimize: `render` will be called repeatly during mouse move. + // So it is power consuming if performing `render` each time, + // especially on mobile device. + if (!forceRender + && this._lastValue === value + && this._lastStatus === status + ) { + return; + } + this._lastValue = value; + this._lastStatus = status; - // FIXME - // Just for compatible with ec2. - zrUtil.extend(__webpack_require__(12).prototype, __webpack_require__(139)); + var group = this._group; + var handle = this._handle; - var BarView = __webpack_require__(1).extendChartView({ + if (!status || status === 'hide') { + // Do not clear here, for animation better. + group && group.hide(); + handle && handle.hide(); + return; + } + group && group.show(); + handle && handle.show(); - type: 'bar', + // Otherwise status is 'show' + var elOption = {}; + this.makeElOption(elOption, value, axisModel, axisPointerModel, api); - render: function (seriesModel, ecModel, api) { - var coordinateSystemType = seriesModel.get('coordinateSystem'); + // Enable change axis pointer type. + var graphicKey = elOption.graphicKey; + if (graphicKey !== this._lastGraphicKey) { + this.clear(api); + } + this._lastGraphicKey = graphicKey; - if (coordinateSystemType === 'cartesian2d') { - this._renderOnCartesian(seriesModel, ecModel, api); + var moveAnimation = this._moveAnimation = + this.determineAnimation(axisModel, axisPointerModel); + + if (!group) { + group = this._group = new graphic.Group(); + this.createPointerEl(group, elOption, axisModel, axisPointerModel); + this.createLabelEl(group, elOption, axisModel, axisPointerModel); + api.getZr().add(group); + } + else { + var doUpdateProps = zrUtil.curry(updateProps, axisPointerModel, moveAnimation); + this.updatePointerEl(group, elOption, doUpdateProps, axisPointerModel); + this.updateLabelEl(group, elOption, doUpdateProps, axisPointerModel); } - return this.group; + updateMandatoryProps(group, axisPointerModel, true); + + this._renderHandle(value); }, - dispose: zrUtil.noop, + /** + * @implement + */ + remove: function (api) { + this.clear(api); + }, - _renderOnCartesian: function (seriesModel, ecModel, api) { - var group = this.group; - var data = seriesModel.getData(); - var oldData = this._data; + /** + * @implement + */ + dispose: function (api) { + this.clear(api); + }, - var cartesian = seriesModel.coordinateSystem; - var baseAxis = cartesian.getBaseAxis(); - var isHorizontal = baseAxis.isHorizontal(); - var animationModel = seriesModel.isAnimationEnabled() ? seriesModel : null; + /** + * @protected + */ + determineAnimation: function (axisModel, axisPointerModel) { + var animation = axisPointerModel.get('animation'); + var axis = axisModel.axis; + var isCategoryAxis = axis.type === 'category'; + var useSnap = axisPointerModel.get('snap'); - data.diff(oldData) - .add(function (dataIndex) { - if (!data.hasValue(dataIndex)) { - return; - } + // Value axis without snap always do not snap. + if (!useSnap && !isCategoryAxis) { + return false; + } - var itemModel = data.getItemModel(dataIndex); - var layout = getRectItemLayout(data, dataIndex, itemModel); - var el = createRect(data, dataIndex, itemModel, layout, isHorizontal, animationModel); - data.setItemGraphicEl(dataIndex, el); - group.add(el); + if (animation === 'auto' || animation == null) { + var animationThreshold = this.animationThreshold; + if (isCategoryAxis && axis.getBandWidth() > animationThreshold) { + return true; + } - updateStyle(el, data, dataIndex, itemModel, layout, seriesModel, isHorizontal); - }) - .update(function (newIndex, oldIndex) { - var el = oldData.getItemGraphicEl(oldIndex); + // It is important to auto animation when snap used. Consider if there is + // a dataZoom, animation will be disabled when too many points exist, while + // it will be enabled for better visual effect when little points exist. + if (useSnap) { + var seriesDataCount = axisPointerModelHelper.getAxisInfo(axisModel).seriesDataCount; + var axisExtent = axis.getExtent(); + // Approximate band width + return Math.abs(axisExtent[0] - axisExtent[1]) / seriesDataCount > animationThreshold; + } - if (!data.hasValue(newIndex)) { - group.remove(el); - return; - } + return false; + } - var itemModel = data.getItemModel(newIndex); - var layout = getRectItemLayout(data, newIndex, itemModel); + return animation === true; + }, - if (el) { - graphic.updateProps(el, {shape: layout}, animationModel, newIndex); - } - else { - el = createRect(data, newIndex, itemModel, layout, isHorizontal, animationModel, true); - } + /** + * add {pointer, label, graphicKey} to elOption + * @protected + */ + makeElOption: function (elOption, value, axisModel, axisPointerModel, api) { + // Shoule be implemenented by sub-class. + }, - data.setItemGraphicEl(newIndex, el); - // Add back - group.add(el); + /** + * @protected + */ + createPointerEl: function (group, elOption, axisModel, axisPointerModel) { + var pointerOption = elOption.pointer; + var pointerEl = get(group).pointerEl = new graphic[pointerOption.type]( + clone(elOption.pointer) + ); + group.add(pointerEl); + }, - updateStyle(el, data, newIndex, itemModel, layout, seriesModel, isHorizontal); - }) - .remove(function (dataIndex) { - var el = oldData.getItemGraphicEl(dataIndex); - el && removeRect(dataIndex, animationModel, el); - }) - .execute(); + /** + * @protected + */ + createLabelEl: function (group, elOption, axisModel, axisPointerModel) { + var labelEl = get(group).labelEl = new graphic.Rect( + clone(elOption.label) + ); - this._data = data; + group.add(labelEl); + updateLabelShowHide(labelEl, axisPointerModel); }, - remove: function (ecModel, api) { - var group = this.group; - var data = this._data; - if (ecModel.get('animation')) { - if (data) { - data.eachItemGraphicEl(function (el) { - removeRect(el.dataIndex, ecModel, el); - }); - } + /** + * @protected + */ + updatePointerEl: function (group, elOption, updateProps) { + var pointerEl = get(group).pointerEl; + if (pointerEl) { + pointerEl.setStyle(elOption.pointer.style); + updateProps(pointerEl, {shape: elOption.pointer.shape}); } - else { - group.removeAll(); + }, + + /** + * @protected + */ + updateLabelEl: function (group, elOption, updateProps, axisPointerModel) { + var labelEl = get(group).labelEl; + if (labelEl) { + labelEl.setStyle(elOption.label.style); + updateProps(labelEl, { + // Consider text length change in vertical axis, animation should + // be used on shape, otherwise the effect will be weird. + shape: elOption.label.shape, + position: elOption.label.position + }); + + updateLabelShowHide(labelEl, axisPointerModel); } - } - }); + }, - function createRect(data, dataIndex, itemModel, layout, isHorizontal, animationModel, isUpdate) { - var rect = new graphic.Rect({shape: zrUtil.extend({}, layout)}); + /** + * @private + */ + _renderHandle: function (value) { + if (this._dragging || !this.updateHandleTransform) { + return; + } - // Animation - if (animationModel) { - var rectShape = rect.shape; - var animateProperty = isHorizontal ? 'height' : 'width'; - var animateTarget = {}; - rectShape[animateProperty] = 0; - animateTarget[animateProperty] = layout[animateProperty]; - graphic[isUpdate ? 'updateProps' : 'initProps'](rect, { - shape: animateTarget - }, animationModel, dataIndex); - } + var axisPointerModel = this._axisPointerModel; + var zr = this._api.getZr(); + var handle = this._handle; + var handleModel = axisPointerModel.getModel('handle'); - return rect; - } + var status = axisPointerModel.get('status'); + if (!handleModel.get('show') || !status || status === 'hide') { + handle && zr.remove(handle); + this._handle = null; + return; + } - function removeRect(dataIndex, animationModel, el) { - // Not show text when animating - el.style.text = ''; - graphic.updateProps(el, { - shape: { - width: 0 + var isInit; + if (!this._handle) { + isInit = true; + handle = this._handle = createIcon(handleModel, { + onmousemove: function (e) { + // Fot mobile devicem, prevent screen slider on the button. + eventTool.stop(e.event); + }, + onmousedown: bind(this._onHandleDragMove, this, 0, 0), + drift: bind(this._onHandleDragMove, this), + ondragend: bind(this._onHandleDragEnd, this) + }); + zr.add(handle); } - }, animationModel, dataIndex, function () { - el.parent && el.parent.remove(el); - }); - } - function getRectItemLayout(data, dataIndex, itemModel) { - var layout = data.getItemLayout(dataIndex); - var fixedLineWidth = getLineWidth(itemModel, layout); + updateMandatoryProps(handle, axisPointerModel, false); - // fix layout with lineWidth - var signX = layout.width > 0 ? 1 : -1; - var signY = layout.height > 0 ? 1 : -1; - return { - x: layout.x + signX * fixedLineWidth / 2, - y: layout.y + signY * fixedLineWidth / 2, - width: layout.width - signX * fixedLineWidth, - height: layout.height - signY * fixedLineWidth - }; - } + // update style + var includeStyles = [ + 'color', 'borderColor', 'borderWidth', 'opacity', + 'shadowColor', 'shadowBlur', 'shadowOffsetX', 'shadowOffsetY' + ]; + handle.setStyle(handleModel.getItemStyle(null, includeStyles)); - function updateStyle(el, data, dataIndex, itemModel, layout, seriesModel, isHorizontal) { - var color = data.getItemVisual(dataIndex, 'color'); - var opacity = data.getItemVisual(dataIndex, 'opacity'); - var itemStyleModel = itemModel.getModel('itemStyle.normal'); - var hoverStyle = itemModel.getModel('itemStyle.emphasis').getBarItemStyle(); + // update position + var handleSize = handleModel.get('size'); + if (!zrUtil.isArray(handleSize)) { + handleSize = [handleSize, handleSize]; + } + handle.attr('scale', [handleSize[0] / 2, handleSize[1] / 2]); - el.setShape('r', itemStyleModel.get('barBorderRadius') || 0); + throttle.createOrUpdate( + this, + '_doDispatchAxisPointer', + handleModel.get('throttle') || 0, + 'fixRate' + ); - el.useStyle(zrUtil.defaults( - { - fill: color, - opacity: opacity - }, - itemStyleModel.getBarItemStyle() - )); + this._moveHandleToValue(value, isInit); + }, - var labelPositionOutside = isHorizontal - ? (layout.height > 0 ? 'bottom' : 'top') - : (layout.width > 0 ? 'left' : 'right'); + /** + * @private + */ + _moveHandleToValue: function (value, isInit) { + updateProps( + this._axisPointerModel, + !isInit && this._moveAnimation, + this._handle, + getHandleTransProps(this.getHandleTransform( + value, this._axisModel, this._axisPointerModel + )) + ); + }, - helper.setLabel( - el.style, hoverStyle, itemModel, color, - seriesModel, dataIndex, labelPositionOutside - ); + /** + * @private + */ + _onHandleDragMove: function (dx, dy) { + var handle = this._handle; + if (!handle) { + return; + } - graphic.setHoverStyle(el, hoverStyle); - } + this._dragging = true; - // In case width or height are too small. - function getLineWidth(itemModel, rawLayout) { - var lineWidth = itemModel.get(BAR_BORDER_WIDTH_QUERY) || 0; - return Math.min(lineWidth, Math.abs(rawLayout.width), Math.abs(rawLayout.height)); - } + // Persistent for throttle. + var trans = this.updateHandleTransform( + getHandleTransProps(handle), + [dx, dy], + this._axisModel, + this._axisPointerModel + ); + this._payloadInfo = trans; - module.exports = BarView; + handle.stopAnimation(); + handle.attr(getHandleTransProps(trans)); + get(handle).lastProp = null; + this._doDispatchAxisPointer(); + }, -/***/ }, -/* 138 */ -/***/ function(module, exports, __webpack_require__) { + /** + * Throttled method. + * @private + */ + _doDispatchAxisPointer: function () { + var handle = this._handle; + if (!handle) { + return; + } - + var payloadInfo = this._payloadInfo; + var payload = { + type: 'updateAxisPointer', + x: payloadInfo.cursorPoint[0], + y: payloadInfo.cursorPoint[1], + tooltipOption: payloadInfo.tooltipOption, + highDownKey: 'axisPointerHandle' + }; + var axis = this._axisModel.axis; + payload[axis.dim + 'AxisId'] = this._axisModel.id; + this._api.dispatchAction(payload); + }, - var zrUtil = __webpack_require__(4); - var graphic = __webpack_require__(43); + /** + * @private + */ + _onHandleDragEnd: function (moveAnimation) { + this._dragging = false; + var handle = this._handle; + if (!handle) { + return; + } - var helper = {}; + var value = this._axisPointerModel.get('value'); + // Consider snap or categroy axis, handle may be not consistent with + // axisPointer. So move handle to align the exact value position when + // drag ended. + this._moveHandleToValue(value); - helper.setLabel = function ( - normalStyle, hoverStyle, itemModel, color, seriesModel, dataIndex, labelPositionOutside - ) { - var labelModel = itemModel.getModel('label.normal'); - var hoverLabelModel = itemModel.getModel('label.emphasis'); + // For the effect: tooltip will be shown when finger holding on handle + // button, and will be hidden after finger left handle button. + this._api.dispatchAction({ + type: 'hideTip' + }); + }, - if (labelModel.get('show')) { - setLabel( - normalStyle, labelModel, color, - zrUtil.retrieve( - seriesModel.getFormattedLabel(dataIndex, 'normal'), - seriesModel.getRawValue(dataIndex) - ), - labelPositionOutside - ); + /** + * Should be implemenented by sub-class if support `handle`. + * @protected + * @param {number} value + * @param {module:echarts/model/Model} axisModel + * @param {module:echarts/model/Model} axisPointerModel + * @return {Object} {position: [x, y], rotation: 0} + */ + getHandleTransform: null, + + /** + * * Should be implemenented by sub-class if support `handle`. + * @protected + * @param {Object} transform {position, rotation} + * @param {Array.} delta [dx, dy] + * @param {module:echarts/model/Model} axisModel + * @param {module:echarts/model/Model} axisPointerModel + * @return {Object} {position: [x, y], rotation: 0, cursorPoint: [x, y]} + */ + updateHandleTransform: null, + + /** + * @private + */ + clear: function (api) { + this._lastValue = null; + this._lastStatus = null; + + var zr = api.getZr(); + var group = this._group; + var handle = this._handle; + if (zr && group) { + this._lastGraphicKey = null; + group && zr.remove(group); + handle && zr.remove(handle); + this._group = null; + this._handle = null; + this._payloadInfo = null; + } + }, + + /** + * @protected + */ + doClear: function () { + // Implemented by sub-class if necessary. + }, + + /** + * @protected + * @param {Array.} xy + * @param {Array.} wh + * @param {number} [xDimIndex=0] or 1 + */ + buildLabel: function (xy, wh, xDimIndex) { + xDimIndex = xDimIndex || 0; + return { + x: xy[xDimIndex], + y: xy[1 - xDimIndex], + width: wh[xDimIndex], + height: wh[1 - xDimIndex] + }; } - else { - normalStyle.text = ''; + }; + + BaseAxisPointer.prototype.constructor = BaseAxisPointer; + + + function updateProps(animationModel, moveAnimation, el, props) { + // Animation optimize. + if (!propsEqual(get(el).lastProp, props)) { + get(el).lastProp = props; + moveAnimation + ? graphic.updateProps(el, props, animationModel) + : (el.stopAnimation(), el.attr(props)); } + } - if (hoverLabelModel.get('show')) { - setLabel( - hoverStyle, hoverLabelModel, color, - zrUtil.retrieve( - seriesModel.getFormattedLabel(dataIndex, 'emphasis'), - seriesModel.getRawValue(dataIndex) - ), - labelPositionOutside - ); + function propsEqual(lastProps, newProps) { + if (zrUtil.isObject(lastProps) && zrUtil.isObject(newProps)) { + var equals = true; + zrUtil.each(newProps, function (item, key) { + equals &= propsEqual(lastProps[key], item); + }); + return !!equals; } else { - hoverStyle.text = ''; - } - }; - - function setLabel(style, model, color, labelText, labelPositionOutside) { - graphic.setText(style, model, color); - style.text = labelText; - if (style.textPosition === 'outside') { - style.textPosition = labelPositionOutside; + return lastProps === newProps; } } - module.exports = helper; + function updateLabelShowHide(labelEl, axisPointerModel) { + labelEl[axisPointerModel.get('label.show') ? 'show' : 'hide'](); + } + function getHandleTransProps(trans) { + return { + position: trans.position.slice(), + rotation: trans.rotation || 0 + }; + } -/***/ }, -/* 139 */ -/***/ function(module, exports, __webpack_require__) { + function createIcon(handleModel, handlers) { + var iconStr = handleModel.get('icon'); + var style = { + x: -1, y: -1, width: 2, height: 2 + }; + var opt = zrUtil.extend({ + style: { + strokeNoScale: true + }, + rectHover: true, + cursor: 'move', + draggable: true + }, handlers); - + return iconStr.indexOf('image://') === 0 + ? ( + style.image = iconStr.slice(8), + opt.style = style, + new graphic.Image(opt) + ) + : graphic.makePath( + iconStr.replace('path://', ''), + opt, + style, + 'center' + ); + } + function updateMandatoryProps(group, axisPointerModel, silent) { + var z = axisPointerModel.get('z'); + var zlevel = axisPointerModel.get('zlevel'); - var getBarItemStyle = __webpack_require__(15)( - [ - ['fill', 'color'], - ['stroke', 'borderColor'], - ['lineWidth', 'borderWidth'], - // Compatitable with 2 - ['stroke', 'barBorderColor'], - ['lineWidth', 'barBorderWidth'], - ['opacity'], - ['shadowBlur'], - ['shadowOffsetX'], - ['shadowOffsetY'], - ['shadowColor'] - ] - ); - module.exports = { - getBarItemStyle: function (excludes) { - var style = getBarItemStyle.call(this, excludes); - if (this.getBorderLineDash) { - var lineDash = this.getBorderLineDash(); - lineDash && (style.lineDash = lineDash); + group && group.traverse(function (el) { + if (el.type !== 'group') { + z != null && (el.z = z); + zlevel != null && (el.zlevel = zlevel); + el.silent = silent; } - return style; - } - }; + }); + } + + clazzUtil.enableClassExtend(BaseAxisPointer); + + module.exports = BaseAxisPointer; /***/ }, -/* 140 */ +/* 138 */ /***/ function(module, exports, __webpack_require__) { - 'use strict'; - + var zrUtil = __webpack_require__(4); - var numberUtil = __webpack_require__(7); - var parsePercent = numberUtil.parsePercent; - - function getSeriesStackId(seriesModel) { - return seriesModel.get('stack') || '__ec_stack_' + seriesModel.seriesIndex; - } + var Model = __webpack_require__(12); + var each = zrUtil.each; + var curry = zrUtil.curry; - function getAxisKey(axis) { - return axis.dim + axis.index; - } + var helper = {}; - function calBarWidthAndOffset(barSeries, api) { - // Columns info on each category axis. Key is cartesian name - var columnsMap = {}; + // Build axisPointerModel, mergin tooltip.axisPointer model for each axis. + // allAxesInfo should be updated when setOption performed. + helper.collect = function (ecModel, api) { + var result = { + /** + * key: makeKey(axis.model) + * value: { + * axis, + * coordSys, + * axisPointerModel, + * triggerTooltip, + * involveSeries, + * snap, + * seriesModels, + * seriesDataCount + * } + */ + axesInfo: {}, + seriesInvolved: false, + /** + * key: makeKey(coordSys.model) + * value: Object: key makeKey(axis.model), value: axisInfo + */ + coordSysAxesInfo: {}, + coordSysMap: {} + }; - zrUtil.each(barSeries, function (seriesModel, idx) { - var data = seriesModel.getData(); - var cartesian = seriesModel.coordinateSystem; + collectAxesInfo(result, ecModel, api); - var baseAxis = cartesian.getBaseAxis(); - var axisExtent = baseAxis.getExtent(); - var bandWidth = baseAxis.type === 'category' - ? baseAxis.getBandWidth() - : (Math.abs(axisExtent[1] - axisExtent[0]) / data.count()); + // Check seriesInvolved for performance, in case too many series in some chart. + result.seriesInvolved && collectSeriesInfo(result, ecModel); - var columnsOnAxis = columnsMap[getAxisKey(baseAxis)] || { - bandWidth: bandWidth, - remainedWidth: bandWidth, - autoWidthCount: 0, - categoryGap: '20%', - gap: '30%', - stacks: {} - }; - var stacks = columnsOnAxis.stacks; - columnsMap[getAxisKey(baseAxis)] = columnsOnAxis; + return result; + }; - var stackId = getSeriesStackId(seriesModel); + function collectAxesInfo(result, ecModel, api) { + var globalTooltipModel = ecModel.getComponent('tooltip'); + var globalAxisPointerModel = ecModel.getComponent('axisPointer'); + // links can only be set on global. + var linksOption = globalAxisPointerModel.get('link', true) || []; + var linkGroups = []; - if (!stacks[stackId]) { - columnsOnAxis.autoWidthCount++; + // Collect axes info. + each(api.getCoordinateSystems(), function (coordSys) { + // Some coordinate system do not support axes, like geo. + if (!coordSys.axisPointerEnabled) { + return; } - stacks[stackId] = stacks[stackId] || { - width: 0, - maxWidth: 0 - }; - - var barWidth = parsePercent( - seriesModel.get('barWidth'), bandWidth - ); - var barMaxWidth = parsePercent( - seriesModel.get('barMaxWidth'), bandWidth - ); - var barGap = seriesModel.get('barGap'); - var barCategoryGap = seriesModel.get('barCategoryGap'); - // Caution: In a single coordinate system, these barGrid attributes - // will be shared by series. Consider that they have default values, - // only the attributes set on the last series will work. - // Do not change this fact unless there will be a break change. + var coordSysKey = makeKey(coordSys.model); + var axesInfoInCoordSys = result.coordSysAxesInfo[coordSysKey] = {}; + result.coordSysMap[coordSysKey] = coordSys; - // TODO - if (barWidth && !stacks[stackId].width) { - barWidth = Math.min(columnsOnAxis.remainedWidth, barWidth); - stacks[stackId].width = barWidth; - columnsOnAxis.remainedWidth -= barWidth; - } + // Set tooltip (like 'cross') is a convienent way to show axisPointer + // for user. So we enable seting tooltip on coordSys model. + var coordSysModel = coordSys.model; + var baseTooltipModel = coordSysModel.getModel('tooltip', globalTooltipModel); - barMaxWidth && (stacks[stackId].maxWidth = barMaxWidth); - (barGap != null) && (columnsOnAxis.gap = barGap); - (barCategoryGap != null) && (columnsOnAxis.categoryGap = barCategoryGap); - }); + each(coordSys.getAxes(), curry(saveTooltipAxisInfo, false, null)); - var result = {}; + // If axis tooltip used, choose tooltip axis for each coordSys. + // Notice this case: coordSys is `grid` but not `cartesian2D` here. + if (coordSys.getTooltipAxes + && globalTooltipModel + // If tooltip.showContent is set as false, tooltip will not + // show but axisPointer will show as normal. + && baseTooltipModel.get('show') + ) { + // Compatible with previous logic. But series.tooltip.trigger: 'axis' + // or series.data[n].tooltip.trigger: 'axis' are not support any more. + var triggerAxis = baseTooltipModel.get('trigger') === 'axis'; + var cross = baseTooltipModel.get('axisPointer.type') === 'cross'; + var tooltipAxes = coordSys.getTooltipAxes(baseTooltipModel.get('axisPointer.axis')); + if (triggerAxis || cross) { + each(tooltipAxes.baseAxes, curry( + saveTooltipAxisInfo, cross ? 'cross' : true, triggerAxis + )); + } + if (cross) { + each(tooltipAxes.otherAxes, curry(saveTooltipAxisInfo, 'cross', false)); + } + } - zrUtil.each(columnsMap, function (columnsOnAxis, coordSysName) { + // fromTooltip: true | false | 'cross' + // triggerTooltip: true | false | null + function saveTooltipAxisInfo(fromTooltip, triggerTooltip, axis) { + var axisPointerModel = axis.model.getModel('axisPointer', globalAxisPointerModel); - result[coordSysName] = {}; + var axisPointerShow = axisPointerModel.get('show'); + if (!axisPointerShow || ( + axisPointerShow === 'auto' + && !fromTooltip + && !isHandleTrigger(axisPointerModel) + )) { + return; + } - var stacks = columnsOnAxis.stacks; - var bandWidth = columnsOnAxis.bandWidth; - var categoryGap = parsePercent(columnsOnAxis.categoryGap, bandWidth); - var barGapPercent = parsePercent(columnsOnAxis.gap, 1); + if (triggerTooltip == null) { + triggerTooltip = axisPointerModel.get('triggerTooltip'); + } - var remainedWidth = columnsOnAxis.remainedWidth; - var autoWidthCount = columnsOnAxis.autoWidthCount; - var autoWidth = (remainedWidth - categoryGap) - / (autoWidthCount + (autoWidthCount - 1) * barGapPercent); - autoWidth = Math.max(autoWidth, 0); + axisPointerModel = fromTooltip + ? makeAxisPointerModel( + axis, baseTooltipModel, globalAxisPointerModel, ecModel, + fromTooltip, triggerTooltip + ) + : axisPointerModel; + + var snap = axisPointerModel.get('snap'); + var key = makeKey(axis.model); + var involveSeries = triggerTooltip || snap || axis.type === 'category'; + + // If result.axesInfo[key] exist, override it (tooltip has higher priority). + var axisInfo = result.axesInfo[key] = { + key: key, + axis: axis, + coordSys: coordSys, + axisPointerModel: axisPointerModel, + triggerTooltip: triggerTooltip, + involveSeries: involveSeries, + snap: snap, + useHandle: isHandleTrigger(axisPointerModel), + seriesModels: [] + }; + axesInfoInCoordSys[key] = axisInfo; + result.seriesInvolved |= involveSeries; - // Find if any auto calculated bar exceeded maxBarWidth - zrUtil.each(stacks, function (column, stack) { - var maxWidth = column.maxWidth; - if (!column.width && maxWidth && maxWidth < autoWidth) { - maxWidth = Math.min(maxWidth, remainedWidth); - remainedWidth -= maxWidth; - column.width = maxWidth; - autoWidthCount--; + var groupIndex = getLinkGroupIndex(linksOption, axis); + if (groupIndex != null) { + var linkGroup = linkGroups[groupIndex] || (linkGroups[groupIndex] = {axesInfo: {}}); + linkGroup.axesInfo[key] = axisInfo; + linkGroup.mapper = linksOption[groupIndex].mapper; + axisInfo.linkGroup = linkGroup; } - }); + } + }); + } - // Recalculate width again - autoWidth = (remainedWidth - categoryGap) - / (autoWidthCount + (autoWidthCount - 1) * barGapPercent); - autoWidth = Math.max(autoWidth, 0); + function makeAxisPointerModel( + axis, baseTooltipModel, globalAxisPointerModel, ecModel, fromTooltip, triggerTooltip + ) { + var tooltipAxisPointerModel = baseTooltipModel.getModel('axisPointer'); + var volatileOption = {}; - var widthSum = 0; - var lastColumn; - zrUtil.each(stacks, function (column, idx) { - if (!column.width) { - column.width = autoWidth; - } - lastColumn = column; - widthSum += column.width * (1 + barGapPercent); - }); - if (lastColumn) { - widthSum -= lastColumn.width * barGapPercent; + each( + [ + 'type', 'snap', 'lineStyle', 'shadowStyle', 'label', + 'animation', 'animationDurationUpdate', 'animationEasingUpdate', 'z' + ], + function (field) { + volatileOption[field] = zrUtil.clone(tooltipAxisPointerModel.get(field)); } + ); - var offset = -widthSum / 2; - zrUtil.each(stacks, function (column, stackId) { - result[coordSysName][stackId] = result[coordSysName][stackId] || { - offset: offset, - width: column.width - }; + // category axis do not auto snap, otherwise some tick that do not + // has value can not be hovered. value/time/log axis default snap if + // triggered from tooltip and trigger tooltip. + volatileOption.snap = axis.type !== 'category' && !!triggerTooltip; + + // Compatibel with previous behavior, tooltip axis do not show label by default. + // Only these properties can be overrided from tooltip to axisPointer. + if (tooltipAxisPointerModel.get('type') === 'cross') { + volatileOption.type = 'line'; + } + var labelOption = volatileOption.label || (volatileOption.label = {}); + // Follow the convention, do not show label when triggered by tooltip by default. + labelOption.show == null && (labelOption.show = false); + + if (fromTooltip === 'cross') { + // When 'cross', both axes show labels. + labelOption.show = true; + // If triggerTooltip, this is a base axis, which should better not use cross style + // (cross style is dashed by default) + if (!triggerTooltip) { + var crossStyle = volatileOption.lineStyle = tooltipAxisPointerModel.get('crossStyle'); + crossStyle && zrUtil.defaults( + labelOption.textStyle || (labelOption.textStyle = {}), + crossStyle.textStyle + ); + } + } - offset += column.width * (1 + barGapPercent); + return axis.model.getModel( + 'axisPointer', + new Model(volatileOption, globalAxisPointerModel, ecModel) + ); + } + + function collectSeriesInfo(result, ecModel) { + // Prepare data for axis trigger + ecModel.eachSeries(function (seriesModel) { + + // Notice this case: this coordSys is `cartesian2D` but not `grid`. + var coordSys = seriesModel.coordinateSystem; + var seriesTooltipTrigger = seriesModel.get('tooltip.trigger', true); + if (!coordSys + || seriesTooltipTrigger === 'none' + || seriesTooltipTrigger === false + || seriesTooltipTrigger === 'item' + || seriesModel.get('axisPointer.show', true) === false + ) { + return; + } + + each(result.coordSysAxesInfo[makeKey(coordSys.model)], function (axisInfo) { + var axis = axisInfo.axis; + if (coordSys.getAxis(axis.dim) === axis) { + axisInfo.seriesModels.push(seriesModel); + axisInfo.seriesDataCount == null && (axisInfo.seriesDataCount = 0); + axisInfo.seriesDataCount += seriesModel.getData().count(); + } }); - }); - return result; + }, this); } /** - * @param {string} seriesType - * @param {module:echarts/model/Global} ecModel - * @param {module:echarts/ExtensionAPI} api + * For example: + * { + * axisPointer: { + * links: [{ + * xAxisIndex: [2, 4], + * yAxisIndex: 'all' + * }, { + * xAxisId: ['a5', 'a7'], + * xAxisName: 'xxx' + * }] + * } + * } */ - function barLayoutGrid(seriesType, ecModel, api) { + function getLinkGroupIndex(linksOption, axis) { + var axisModel = axis.model; + var dim = axis.dim; + for (var i = 0; i < linksOption.length; i++) { + var linkOption = linksOption[i] || {}; + if (checkPropInLink(linkOption[dim + 'AxisId'], axisModel.id) + || checkPropInLink(linkOption[dim + 'AxisIndex'], axisModel.componentIndex) + || checkPropInLink(linkOption[dim + 'AxisName'], axisModel.name) + ) { + return i; + } + } + } - var barWidthAndOffset = calBarWidthAndOffset( - zrUtil.filter( - ecModel.getSeriesByType(seriesType), - function (seriesModel) { - return !ecModel.isSeriesFiltered(seriesModel) - && seriesModel.coordinateSystem - && seriesModel.coordinateSystem.type === 'cartesian2d'; - } - ) - ); - - var lastStackCoords = {}; - var lastStackCoordsOrigin = {}; - - ecModel.eachSeriesByType(seriesType, function (seriesModel) { + function checkPropInLink(linkPropValue, axisPropValue) { + return linkPropValue === 'all' + || (zrUtil.isArray(linkPropValue) && zrUtil.indexOf(linkPropValue, axisPropValue) >= 0) + || linkPropValue === axisPropValue; + } - var data = seriesModel.getData(); - var cartesian = seriesModel.coordinateSystem; - var baseAxis = cartesian.getBaseAxis(); + helper.fixValue = function (axisModel) { + var axisInfo = helper.getAxisInfo(axisModel); + if (!axisInfo) { + return; + } - var stackId = getSeriesStackId(seriesModel); - var columnLayoutInfo = barWidthAndOffset[getAxisKey(baseAxis)][stackId]; - var columnOffset = columnLayoutInfo.offset; - var columnWidth = columnLayoutInfo.width; - var valueAxis = cartesian.getOtherAxis(baseAxis); + var axisPointerModel = axisInfo.axisPointerModel; + var scale = axisInfo.axis.scale; + var option = axisPointerModel.option; + var status = axisPointerModel.get('status'); + var value = axisPointerModel.get('value'); - var barMinHeight = seriesModel.get('barMinHeight') || 0; + // Parse init value for category and time axis. + if (value != null) { + value = scale.parse(value); + } - var valueAxisStart = baseAxis.onZero - ? valueAxis.toGlobalCoord(valueAxis.dataToCoord(0)) - : valueAxis.getGlobalExtent()[0]; + var useHandle = isHandleTrigger(axisPointerModel); + // If `handle` used, `axisPointer` will always be displayed, so value + // and status should be initialized. + if (status == null) { + option.status = useHandle ? 'show' : 'hide'; + } - var coords = cartesian.dataToPoints(data, true); - lastStackCoords[stackId] = lastStackCoords[stackId] || []; - lastStackCoordsOrigin[stackId] = lastStackCoordsOrigin[stackId] || []; // Fix #4243 + var extent = scale.getExtent().slice(); + extent[0] > extent[1] && extent.reverse(); - data.setLayout({ - offset: columnOffset, - size: columnWidth - }); + if (// Pick a value on axis when initializing. + value == null + // If both `handle` and `dataZoom` are used, value may be out of axis extent, + // where we should re-pick a value to keep `handle` displaying normally. + || value > extent[1] + ) { + // Make handle displayed on the end of the axis when init, which looks better. + value = extent[1]; + } + if (value < extent[0]) { + value = extent[0]; + } - data.each(valueAxis.dim, function (value, idx) { - if (isNaN(value)) { - return; - } + option.value = value; - if (!lastStackCoords[stackId][idx]) { - lastStackCoords[stackId][idx] = { - p: valueAxisStart, // Positive stack - n: valueAxisStart // Negative stack - }; - lastStackCoordsOrigin[stackId][idx] = { - p: valueAxisStart, // Positive stack - n: valueAxisStart // Negative stack - }; - } - var sign = value >= 0 ? 'p' : 'n'; - var coord = coords[idx]; - var lastCoord = lastStackCoords[stackId][idx][sign]; - var lastCoordOrigin = lastStackCoordsOrigin[stackId][idx][sign]; - var x; - var y; - var width; - var height; + if (useHandle) { + option.status = axisInfo.axis.scale.isBlank() ? 'hide' : 'show'; + } + }; - if (valueAxis.isHorizontal()) { - x = lastCoord; - y = coord[1] + columnOffset; - width = coord[0] - lastCoordOrigin; - height = columnWidth; + helper.getAxisInfo = function (axisModel) { + var coordSysAxesInfo = axisModel.ecModel.getComponent('axisPointer').coordSysAxesInfo; + return coordSysAxesInfo && coordSysAxesInfo.axesInfo[makeKey(axisModel)]; + }; - lastStackCoordsOrigin[stackId][idx][sign] += width; - if (Math.abs(width) < barMinHeight) { - width = (width < 0 ? -1 : 1) * barMinHeight; - } - lastStackCoords[stackId][idx][sign] += width; - } - else { - x = coord[0] + columnOffset; - y = lastCoord; - width = columnWidth; - height = coord[1] - lastCoordOrigin; + helper.getAxisPointerModel = function (axisModel) { + var axisInfo = helper.getAxisInfo(axisModel); + return axisInfo && axisInfo.axisPointerModel; + }; - lastStackCoordsOrigin[stackId][idx][sign] += height; - if (Math.abs(height) < barMinHeight) { - // Include zero to has a positive bar - height = (height <= 0 ? -1 : 1) * barMinHeight; - } - lastStackCoords[stackId][idx][sign] += height; - } + function isHandleTrigger(axisPointerModel) { + return !!axisPointerModel.get('handle.show'); + } - data.setItemLayout(idx, { - x: x, - y: y, - width: width, - height: height - }); - }, true); + /** + * @param {module:echarts/model/Model} model + * @return {string} unique key + */ + var makeKey = helper.makeKey = function (model) { + return model.type + '||' + model.id; + }; - }, this); - } + module.exports = helper; - module.exports = barLayoutGrid; /***/ }, -/* 141 */ +/* 139 */ /***/ function(module, exports, __webpack_require__) { - + 'use strict'; + var zrUtil = __webpack_require__(4); - var echarts = __webpack_require__(1); + var graphic = __webpack_require__(44); + var textContain = __webpack_require__(8); + var formatUtil = __webpack_require__(6); + var matrix = __webpack_require__(11); + var axisHelper = __webpack_require__(105); + var AxisBuilder = __webpack_require__(135); - __webpack_require__(142); - __webpack_require__(144); + var helper = {}; - __webpack_require__(145)('pie', [{ - type: 'pieToggleSelect', - event: 'pieselectchanged', - method: 'toggleSelected' - }, { - type: 'pieSelect', - event: 'pieselected', - method: 'select' - }, { - type: 'pieUnSelect', - event: 'pieunselected', - method: 'unSelect' - }]); + /** + * @param {module:echarts/model/Model} axisPointerModel + */ + helper.buildElStyle = function (axisPointerModel) { + var axisPointerType = axisPointerModel.get('type'); + var styleModel = axisPointerModel.getModel(axisPointerType + 'Style'); + var style; + if (axisPointerType === 'line') { + style = styleModel.getLineStyle(); + style.fill = null; + } + else if (axisPointerType === 'shadow') { + style = styleModel.getAreaStyle(); + style.stroke = null; + } + return style; + }; - echarts.registerVisual(zrUtil.curry(__webpack_require__(146), 'pie')); + /** + * @param {Function} labelPos {align, verticalAlign, position} + */ + helper.buildLabelElOption = function ( + elOption, axisModel, axisPointerModel, api, labelPos + ) { + var value = axisPointerModel.get('value'); + var text = helper.getValueLabel( + value, axisModel.axis, axisModel.ecModel, + axisPointerModel.get('seriesDataIndices'), + { + precision: axisPointerModel.get('label.precision'), + formatter: axisPointerModel.get('label.formatter') + } + ); + var labelModel = axisPointerModel.getModel('label'); + var textStyleModel = labelModel.getModel('textStyle'); + var paddings = formatUtil.normalizeCssArray(labelModel.get('padding') || 0); - echarts.registerLayout(zrUtil.curry( - __webpack_require__(147), 'pie' - )); + var font = textStyleModel.getFont(); + var textRect = textContain.getBoundingRect( + text, font, labelPos.textAlign, labelPos.textBaseline + ); - echarts.registerProcessor(zrUtil.curry(__webpack_require__(149), 'pie')); + var position = labelPos.position; + var width = textRect.width + paddings[1] + paddings[3]; + var height = textRect.height + paddings[0] + paddings[2]; + // Adjust by align. + var align = labelPos.align; + align === 'right' && (position[0] -= width); + align === 'center' && (position[0] -= width / 2); + var verticalAlign = labelPos.verticalAlign; + verticalAlign === 'bottom' && (position[1] -= height); + verticalAlign === 'middle' && (position[1] -= height / 2); -/***/ }, -/* 142 */ -/***/ function(module, exports, __webpack_require__) { + // Not overflow ec container + confineInContainer(position, width, height, api); - 'use strict'; + var bgColor = labelModel.get('backgroundColor'); + if (!bgColor || bgColor === 'auto') { + bgColor = axisModel.get('axisLine.lineStyle.color'); + } + elOption.label = { + shape: {x: 0, y: 0, width: width, height: height, r: labelModel.get('borderRadius')}, + position: position.slice(), + style: { + text: text, + textFont: font, + textFill: textStyleModel.getTextColor(), + textPosition: 'inside', + fill: bgColor, + stroke: labelModel.get('borderColor') || 'transparent', + lineWidth: labelModel.get('borderWidth') || 0, + shadowBlur: labelModel.get('shadowBlur'), + shadowColor: labelModel.get('shadowColor'), + shadowOffsetX: labelModel.get('shadowOffsetX'), + shadowOffsetY: labelModel.get('shadowOffsetY') + } + }; + }; - var List = __webpack_require__(98); - var zrUtil = __webpack_require__(4); - var modelUtil = __webpack_require__(5); - var completeDimensions = __webpack_require__(103); + // Do not overflow ec container + function confineInContainer(position, width, height, api) { + var viewWidth = api.getWidth(); + var viewHeight = api.getHeight(); + position[0] = Math.min(position[0] + width, viewWidth) - width; + position[1] = Math.min(position[1] + height, viewHeight) - height; + position[0] = Math.max(position[0], 0); + position[1] = Math.max(position[1], 0); + } - var dataSelectableMixin = __webpack_require__(143); + /** + * @param {number} value + * @param {module:echarts/coord/Axis} axis + * @param {module:echarts/model/Global} ecModel + * @param {Object} opt + * @param {Array.} seriesDataIndices + * @param {number|string} opt.precision 'auto' or a number + * @param {string|Function} opt.formatter label formatter + */ + helper.getValueLabel = function (value, axis, ecModel, seriesDataIndices, opt) { + var text = axis.scale.getLabel( + // Use 'pad' to try to fix width, which helps to debounce when when moving label. + value, {precision: opt.precision, pad: true} + ); + var formatter = opt.formatter; - var PieSeries = __webpack_require__(1).extendSeriesModel({ + if (formatter) { + var params = { + value: axisHelper.getAxisRawValue(axis, value), + seriesData: [] + }; + zrUtil.each(seriesDataIndices, function (idxItem) { + var series = ecModel.getSeriesByIndex(idxItem.seriesIndex); + var dataIndex = idxItem.dataIndexInside; + var dataParams = series && series.getDataParams(dataIndex); + dataParams && params.seriesData.push(dataParams); + }); - type: 'series.pie', + if (zrUtil.isString(formatter)) { + text = formatter.replace('{value}', text); + } + else if (zrUtil.isFunction(formatter)) { + text = formatter(params); + } + } - // Overwrite - init: function (option) { - PieSeries.superApply(this, 'init', arguments); + return text; + }; - // Enable legend selection for each data item - // Use a function instead of direct access because data reference may changed - this.legendDataProvider = function () { - return this.getRawData(); - }; + /** + * @param {module:echarts/coord/Axis} axis + * @param {number} value + * @param {Object} layoutInfo { + * rotation, position, labelOffset, labelDirection, labelMargin + * } + */ + helper.getTransformedPosition = function (axis, value, layoutInfo) { + var transform = matrix.create(); + matrix.rotate(transform, transform, layoutInfo.rotation); + matrix.translate(transform, transform, layoutInfo.position); - this.updateSelectedMap(option.data); + return graphic.applyTransform([ + axis.dataToCoord(value), + (layoutInfo.labelOffset || 0) + + (layoutInfo.labelDirection || 1) * (layoutInfo.labelMargin || 0) + ], transform); + }; - this._defaultLabelLine(option); - }, + helper.buildCartesianSingleLabelElOption = function ( + value, elOption, layoutInfo, axisModel, axisPointerModel, api + ) { + var textLayout = AxisBuilder.innerTextLayout( + layoutInfo.rotation, 0, layoutInfo.labelDirection + ); + layoutInfo.labelMargin = axisPointerModel.get('label.margin'); + helper.buildLabelElOption(elOption, axisModel, axisPointerModel, api, { + position: helper.getTransformedPosition(axisModel.axis, value, layoutInfo), + align: textLayout.textAlign, + verticalAlign: textLayout.textVerticalAlign + }); + }; - // Overwrite - mergeOption: function (newOption) { - PieSeries.superCall(this, 'mergeOption', newOption); - this.updateSelectedMap(this.option.data); - }, + /** + * @param {Array.} p1 + * @param {Array.} p2 + * @param {number} [xDimIndex=0] or 1 + */ + helper.makeLineShape = function (p1, p2, xDimIndex) { + xDimIndex = xDimIndex || 0; + return { + x1: p1[xDimIndex], + y1: p1[1 - xDimIndex], + x2: p2[xDimIndex], + y2: p2[1 - xDimIndex] + }; + }; - getInitialData: function (option, ecModel) { - var dimensions = completeDimensions(['value'], option.data); - var list = new List(dimensions, this); - list.initData(option.data); - return list; - }, + /** + * @param {Array.} xy + * @param {Array.} wh + * @param {number} [xDimIndex=0] or 1 + */ + helper.makeRectShape = function (xy, wh, xDimIndex) { + xDimIndex = xDimIndex || 0; + return { + x: xy[xDimIndex], + y: xy[1 - xDimIndex], + width: wh[xDimIndex], + height: wh[1 - xDimIndex] + }; + }; - // Overwrite - getDataParams: function (dataIndex) { - var data = this.getData(); - var params = PieSeries.superCall(this, 'getDataParams', dataIndex); - var sum = data.getSum('value'); - // FIXME toFixed? - // - // Percent is 0 if sum is 0 - params.percent = !sum ? 0 : +(data.get('value', dataIndex) / sum * 100).toFixed(2); + helper.makeSectorShape = function (cx, cy, r0, r, startAngle, endAngle) { + return { + cx: cx, + cy: cy, + r0: r0, + r: r, + startAngle: startAngle, + endAngle: endAngle, + clockwise: true + }; + }; - params.$vars.push('percent'); - return params; - }, + module.exports = helper; - _defaultLabelLine: function (option) { - // Extend labelLine emphasis - modelUtil.defaultEmphasis(option.labelLine, ['show']); - var labelLineNormalOpt = option.labelLine.normal; - var labelLineEmphasisOpt = option.labelLine.emphasis; - // Not show label line if `label.normal.show = false` - labelLineNormalOpt.show = labelLineNormalOpt.show - && option.label.normal.show; - labelLineEmphasisOpt.show = labelLineEmphasisOpt.show - && option.label.emphasis.show; - }, +/***/ }, +/* 140 */ +/***/ function(module, exports, __webpack_require__) { - defaultOption: { - zlevel: 0, - z: 2, - legendHoverLink: true, + - hoverAnimation: true, - // 默认全局居中 - center: ['50%', '50%'], - radius: [0, '75%'], - // 默认顺时针 - clockwise: true, - startAngle: 90, - // 最小角度改为0 - minAngle: 0, - // 选中是扇区偏移量 - selectedOffset: 10, + var zrUtil = __webpack_require__(4); - // If use strategy to avoid label overlapping - avoidLabelOverlap: true, - // 选择模式,默认关闭,可选single,multiple - // selectedMode: false, - // 南丁格尔玫瑰图模式,'radius'(半径) | 'area'(面积) - // roseType: null, + var helper = {}; - // If still show when all data zero. - stillShowZeroSum: true, + /** + * @param {Object} opt {labelInside} + * @return {Object} { + * position, rotation, labelDirection, labelOffset, + * tickDirection, labelRotate, labelInterval, z2 + * } + */ + helper.layout = function (gridModel, axisModel, opt) { + opt = opt || {}; + var grid = gridModel.coordinateSystem; + var axis = axisModel.axis; + var layout = {}; - label: { - normal: { - // If rotate around circle - rotate: false, - show: true, - // 'outer', 'inside', 'center' - position: 'outer' - // formatter: 标签文本格式器,同Tooltip.formatter,不支持异步回调 - // textStyle: null // 默认使用全局文本样式,详见TEXTSTYLE - // distance: 当position为inner时有效,为label位置到圆心的距离与圆半径(环状图为内外半径和)的比例系数 - }, - emphasis: {} - }, - // Enabled when label.normal.position is 'outer' - labelLine: { - normal: { - show: true, - // 引导线两段中的第一段长度 - length: 15, - // 引导线两段中的第二段长度 - length2: 15, - smooth: false, - lineStyle: { - // color: 各异, - width: 1, - type: 'solid' - } - } - }, - itemStyle: { - normal: { - borderWidth: 1 - }, - emphasis: {} - }, + var rawAxisPosition = axis.position; + var axisPosition = axis.onZero ? 'onZero' : rawAxisPosition; + var axisDim = axis.dim; - // Animation type canbe expansion, scale - animationType: 'expansion', + // [left, right, top, bottom] + var rect = grid.getRect(); + var rectBound = [rect.x, rect.x + rect.width, rect.y, rect.y + rect.height]; - animationEasing: 'cubicOut', + var axisOffset = axisModel.get('offset') || 0; - data: [] + var posMap = { + x: { top: rectBound[2] - axisOffset, bottom: rectBound[3] + axisOffset }, + y: { left: rectBound[0] - axisOffset, right: rectBound[1] + axisOffset } + }; + + posMap.x.onZero = Math.max(Math.min(getZero('y'), posMap.x.bottom), posMap.x.top); + posMap.y.onZero = Math.max(Math.min(getZero('x'), posMap.y.right), posMap.y.left); + + function getZero(dim, val) { + var theAxis = grid.getAxis(dim); + return theAxis.toGlobalCoord(theAxis.dataToCoord(0)); } - }); - zrUtil.mixin(PieSeries, dataSelectableMixin); + // Axis position + layout.position = [ + axisDim === 'y' ? posMap.y[axisPosition] : rectBound[0], + axisDim === 'x' ? posMap.x[axisPosition] : rectBound[3] + ]; + + // Axis rotation + layout.rotation = Math.PI / 2 * (axisDim === 'x' ? 0 : 1); + + // Tick and label direction, x y is axisDim + var dirMap = {top: -1, bottom: 1, left: -1, right: 1}; + + layout.labelDirection = layout.tickDirection = layout.nameDirection = dirMap[rawAxisPosition]; + layout.labelOffset = axis.onZero ? posMap[axisDim][rawAxisPosition] - posMap[axisDim].onZero : 0; + + if (axisModel.get('axisTick.inside')) { + layout.tickDirection = -layout.tickDirection; + } + if (zrUtil.retrieve(opt.labelInside, axisModel.get('axisLabel.inside'))) { + layout.labelDirection = -layout.labelDirection; + } + + // Special label rotation + var labelRotate = axisModel.get('axisLabel.rotate'); + layout.labelRotate = axisPosition === 'top' ? -labelRotate : labelRotate; + + // label interval when auto mode. + layout.labelInterval = axis.getLabelInterval(); + + // Over splitLine and splitArea + layout.z2 = 1; + + return layout; + }; + + module.exports = helper; - module.exports = PieSeries; /***/ }, -/* 143 */ +/* 141 */ /***/ function(module, exports, __webpack_require__) { - /** - * Data selectable mixin for chart series. - * To eanble data select, option of series must have `selectedMode`. - * And each data item will use `selected` to toggle itself selected status - * - * @module echarts/chart/helper/DataSelectable - */ + + var axisPointerModelHelper = __webpack_require__(138); - var zrUtil = __webpack_require__(4); + /** + * Base class of AxisView. + */ + var AxisView = __webpack_require__(1).extendComponentView({ - module.exports = { + type: 'axis', - updateSelectedMap: function (targetList) { - this._selectTargetMap = zrUtil.reduce(targetList || [], function (targetMap, target) { - targetMap[target.name] = target; - return targetMap; - }, {}); - }, /** - * @param {string} name + * @private */ - // PENGING If selectedMode is null ? - select: function (name) { - var targetMap = this._selectTargetMap; - var target = targetMap[name]; - var selectedMode = this.get('selectedMode'); - if (selectedMode === 'single') { - zrUtil.each(targetMap, function (target) { - target.selected = false; - }); - } - target && (target.selected = true); + _axisPointer: null, + + axisPointerClass: null, + + /** + * @override + */ + render: function (axisModel, ecModel, api, payload) { + // FIXME + // This process should proformed after coordinate systems updated + // (axis scale updated), and should be performed each time update. + // So put it here temporarily, although it is not appropriate to + // put a model-writing procedure in `view`. + axisPointerModelHelper.fixValue(axisModel); + + AxisView.superApply(this, 'render', arguments); + updateAxisPointer(this, axisModel, ecModel, api, payload, true); }, /** - * @param {string} name + * Action handler. + * @public + * @param {module:echarts/coord/cartesian/AxisModel} axisModel + * @param {module:echarts/model/Global} ecModel + * @param {module:echarts/ExtensionAPI} api + * @param {Object} payload */ - unSelect: function (name) { - var target = this._selectTargetMap[name]; - // var selectedMode = this.get('selectedMode'); - // selectedMode !== 'single' && target && (target.selected = false); - target && (target.selected = false); + updateAxisPointer: function (axisModel, ecModel, api, payload, force) { + updateAxisPointer(this, axisModel, ecModel, api, payload, false); }, /** - * @param {string} name + * @override */ - toggleSelected: function (name) { - var target = this._selectTargetMap[name]; - if (target != null) { - this[target.selected ? 'unSelect' : 'select'](name); - return target.selected; - } + remove: function (ecModel, api) { + var axisPointer = this._axisPointer; + axisPointer && axisPointer.remove(api); + AxisView.superApply(this, 'remove', arguments); }, /** - * @param {string} name + * @override */ - isSelected: function (name) { - var target = this._selectTargetMap[name]; - return target && target.selected; + dispose: function (ecModel, api) { + disposeAxisPointer(this, api); + AxisView.superApply(this, 'dispose', arguments); } - }; + + }); + + function updateAxisPointer(axisView, axisModel, ecModel, api, payload, forceRender) { + if (!axisView.axisPointerClass) { + return; + } + var axisPointerModel = axisPointerModelHelper.getAxisPointerModel(axisModel); + axisPointerModel + ? (axisView._axisPointer || (axisView._axisPointer = new axisView.axisPointerClass())) + .render(axisModel, axisPointerModel, api, forceRender) + : disposeAxisPointer(axisView, api); + } + + function disposeAxisPointer(axisView, ecModel, api) { + var axisPointer = axisView._axisPointer; + axisPointer && axisPointer.dispose(ecModel, api); + axisView._axisPointer = null; + } + + module.exports = AxisView; /***/ }, -/* 144 */ +/* 142 */ /***/ function(module, exports, __webpack_require__) { - var graphic = __webpack_require__(43); + var echarts = __webpack_require__(1); + var axisPointerModelHelper = __webpack_require__(138); + var axisTrigger = __webpack_require__(143); var zrUtil = __webpack_require__(4); - /** - * @param {module:echarts/model/Series} seriesModel - * @param {boolean} hasAnimation - * @inner - */ - function updateDataSelected(uid, seriesModel, hasAnimation, api) { - var data = seriesModel.getData(); - var dataIndex = this.dataIndex; - var name = data.getName(dataIndex); - var selectedOffset = seriesModel.get('selectedOffset'); + __webpack_require__(145); + __webpack_require__(146); - api.dispatchAction({ - type: 'pieToggleSelect', - from: uid, - name: name, - seriesId: seriesModel.id - }); + echarts.registerPreprocessor(function (option) { + // Always has a global axisPointerModel for default setting. + if (option) { + (!option.axisPointer || option.axisPointer.length === 0) + && (option.axisPointer = {}); - data.each(function (idx) { - toggleItemSelected( - data.getItemGraphicEl(idx), - data.getItemLayout(idx), - seriesModel.isSelected(data.getName(idx)), - selectedOffset, - hasAnimation - ); - }); - } + var link = option.axisPointer.link; + // Normalize to array to avoid object mergin. But if link + // is not set, remain null/undefined, otherwise it will + // override existent link setting. + if (link && !zrUtil.isArray(link)) { + option.axisPointer.link = [link]; + } + } + }); - /** - * @param {module:zrender/graphic/Sector} el - * @param {Object} layout - * @param {boolean} isSelected - * @param {number} selectedOffset - * @param {boolean} hasAnimation - * @inner - */ - function toggleItemSelected(el, layout, isSelected, selectedOffset, hasAnimation) { - var midAngle = (layout.startAngle + layout.endAngle) / 2; + // This process should proformed after coordinate systems created + // and series data processed. So put it on statistic processing stage. + echarts.registerProcessor(echarts.PRIORITY.PROCESSOR.STATISTIC, function (ecModel, api) { + // Build axisPointerModel, mergin tooltip.axisPointer model for each axis. + // allAxesInfo should be updated when setOption performed. + ecModel.getComponent('axisPointer').coordSysAxesInfo + = axisPointerModelHelper.collect(ecModel, api); + }); - var dx = Math.cos(midAngle); - var dy = Math.sin(midAngle); + // Broadcast to all views. + echarts.registerAction({ + type: 'updateAxisPointer', + event: 'updateAxisPointer', + update: ':updateAxisPointer' + }, function (payload, ecModel, api) { + var outputFinder = axisTrigger( + ecModel.getComponent('axisPointer').coordSysAxesInfo, + payload.currTrigger, + payload, + payload.dispatchAction || zrUtil.bind(api.dispatchAction, api), + ecModel, + api, + payload.tooltipOption, + payload.highDownKey + ); - var offset = isSelected ? selectedOffset : 0; - var position = [dx * offset, dy * offset]; + return outputFinder; + }); - hasAnimation - // animateTo will stop revious animation like update transition - ? el.animate() - .when(200, { - position: position - }) - .start('bounceOut') - : el.attr('position', position); - } + + +/***/ }, +/* 143 */ +/***/ function(module, exports, __webpack_require__) { + + + + var zrUtil = __webpack_require__(4); + var modelUtil = __webpack_require__(5); + var modelHelper = __webpack_require__(138); + var findPointFromSeries = __webpack_require__(144); + + var each = zrUtil.each; + var curry = zrUtil.curry; + var get = modelUtil.makeGetter(); /** - * Piece of pie including Sector, Label, LabelLine - * @constructor - * @extends {module:zrender/graphic/Group} + * Basic logic: check all axis, if they do not demand show/highlight, + * then hide/downplay them. + * + * @param {Object} coordSysAxesInfo + * @param {string} currTrigger 'click' | 'mousemove' | 'leave' + * @param {Object} finder {x, y, xAxisId: ...[], yAxisName: ...[], angleAxisIndex: ...[]} + * x and y, which are mandatory, specify a point to tigger axisPointer and tooltip. + * other properties, which are optional, restrict target axes. + * @param {Function} dispatchAction + * @param {module:echarts/ExtensionAPI} api + * @param {Object} tooltipOption + * @param {string} [highDownKey] + * @return {Object} content of event obj for echarts.connect. */ - function PiePiece(data, idx) { + function axisTrigger( + coordSysAxesInfo, currTrigger, finder, dispatchAction, + ecModel, api, tooltipOption, highDownKey + ) { + var point = []; + if (finder.x != null && finder.y != null) { + point = [finder.x, finder.y]; + } + else { + point = findPointFromSeries({ + seriesIndex: finder.seriesIndex, + // Do not use dataIndexInside from other ec instance. + // FIXME: auto detect it? + dataIndex: finder.dataIndex + }, ecModel).point; + } + + var axesInfo = coordSysAxesInfo.axesInfo; + var shouldHide = currTrigger === 'leave' || illegalPoint(point); + var outputFinder = {}; + + var showValueMap = {}; + var dataByCoordSys = {list: [], map: {}}; + var highlightBatch = []; + var updaters = { + showPointer: curry(showPointer, showValueMap), + showTooltip: curry(showTooltip, dataByCoordSys), + highlight: curry(highlight, highlightBatch) + }; - graphic.Group.call(this); + // Process for triggered axes. + each(coordSysAxesInfo.coordSysMap, function (coordSys, coordSysKey) { + var coordSysContainsPoint = coordSys.containPoint(point); - var sector = new graphic.Sector({ - z2: 2 + each(coordSysAxesInfo.coordSysAxesInfo[coordSysKey], function (axisInfo, key) { + var axis = axisInfo.axis; + if (!shouldHide && coordSysContainsPoint && !notTargetAxis(finder, axis)) { + processOnAxis(axisInfo, axis.pointToData(point), updaters, false, outputFinder); + } + }); }); - var polyline = new graphic.Polyline(); - var text = new graphic.Text(); - this.add(sector); - this.add(polyline); - this.add(text); - this.updateData(data, idx, true); + // Process for linked axes. + each(axesInfo, function (tarAxisInfo, tarKey) { + var linkGroup = tarAxisInfo.linkGroup; + + // If axis has been triggered in the previous stage, it should not be triggered by link. + linkGroup && !showValueMap[tarKey] && each(linkGroup.axesInfo, function (srcAxisInfo, srcKey) { + var srcValItem = showValueMap[srcKey]; + // If srcValItem exist, source axis is triggered, so link to target axis. + if (srcAxisInfo !== tarAxisInfo && srcValItem) { + var val = srcValItem.value; + linkGroup.mapper && (val = tarAxisInfo.axis.scale.parse(linkGroup.mapper( + val, makeMapperParam(srcAxisInfo), makeMapperParam(tarAxisInfo) + ))); + processOnAxis(tarAxisInfo, val, updaters, true, outputFinder); + } + }); + }); - // Hover to change label and labelLine - function onEmphasis() { - polyline.ignore = polyline.hoverIgnore; - text.ignore = text.hoverIgnore; + updateModelActually(showValueMap, axesInfo); + dispatchTooltipActually(dataByCoordSys, point, tooltipOption, dispatchAction); + dispatchHighDownActually(highlightBatch, dispatchAction, api, highDownKey); + + return outputFinder; + } + + function processOnAxis(axisInfo, newValue, updaters, dontSnap, outputFinder) { + var axis = axisInfo.axis; + + if (axis.scale.isBlank() || !axis.containData(newValue)) { + return; } - function onNormal() { - polyline.ignore = polyline.normalIgnore; - text.ignore = text.normalIgnore; + + if (!axisInfo.involveSeries) { + updaters.showPointer(axisInfo, newValue); + return; } - this.on('emphasis', onEmphasis) - .on('normal', onNormal) - .on('mouseover', onEmphasis) - .on('mouseout', onNormal); + + // Heavy calculation. So put it after axis.containData checking. + var payloadInfo = buildPayloadsBySeries(newValue, axisInfo); + var payloadBatch = payloadInfo.payloadBatch; + var snapToValue = payloadInfo.snapToValue; + + // Fill content of event obj for echarts.connect. + // By defualt use the first involved series data as a sample to connect. + if (payloadBatch[0] && outputFinder.seriesIndex == null) { + zrUtil.extend(outputFinder, payloadBatch[0]); + } + + // If no linkSource input, this process is for collecting link + // target, where snap should not be accepted. + if (!dontSnap && axisInfo.snap) { + if (axis.containData(snapToValue) && snapToValue != null) { + newValue = snapToValue; + } + } + + updaters.highlight('highlight', payloadBatch); + updaters.showPointer(axisInfo, newValue, payloadBatch); + // Tooltip should always be snapToValue, otherwise there will be + // incorrect "axis value ~ series value" mapping displayed in tooltip. + updaters.showTooltip(axisInfo, payloadInfo, snapToValue); } - var piePieceProto = PiePiece.prototype; + function buildPayloadsBySeries(value, axisInfo) { + var axis = axisInfo.axis; + var dim = axis.dim; + var snapToValue = value; + var payloadBatch = []; + var minDist = Number.MAX_VALUE; + var minDiff = -1; + + each(axisInfo.seriesModels, function (series, idx) { + var dataDim = series.coordDimToDataDim(dim); + var seriesNestestValue; + var dataIndices; + + if (series.getAxisTooltipData) { + var result = series.getAxisTooltipData(dataDim, value, axis); + dataIndices = result.dataIndices; + seriesNestestValue = result.nestestValue; + } + else { + dataIndices = series.getData().indexOfNearest( + dataDim[0], + value, + // Add a threshold to avoid find the wrong dataIndex + // when data length is not same. + false, axis.type === 'category' ? 0.5 : null + ); + if (!dataIndices.length) { + return; + } + seriesNestestValue = series.getData().get(dataDim[0], dataIndices[0]); + } + + if (seriesNestestValue == null || !isFinite(seriesNestestValue)) { + return; + } + + var diff = value - seriesNestestValue; + var dist = Math.abs(diff); + // Consider category case + if (dist <= minDist) { + if (dist < minDist || (diff >= 0 && minDiff < 0)) { + minDist = dist; + minDiff = diff; + snapToValue = seriesNestestValue; + payloadBatch.length = 0; + } + each(dataIndices, function (dataIndex) { + payloadBatch.push({ + seriesIndex: series.seriesIndex, + dataIndexInside: dataIndex, + dataIndex: series.getData().getRawIndex(dataIndex) + }); + }); + } + }); - function getLabelStyle(data, idx, state, labelModel, labelPosition) { - var textStyleModel = labelModel.getModel('textStyle'); - var isLabelInside = labelPosition === 'inside' || labelPosition === 'inner'; return { - fill: textStyleModel.getTextColor() - || (isLabelInside ? '#fff' : data.getItemVisual(idx, 'color')), - opacity: data.getItemVisual(idx, 'opacity'), - textFont: textStyleModel.getFont(), - text: zrUtil.retrieve( - data.hostModel.getFormattedLabel(idx, state), data.getName(idx) - ) + payloadBatch: payloadBatch, + snapToValue: snapToValue }; } - piePieceProto.updateData = function (data, idx, firstCreate) { + function showPointer(showValueMap, axisInfo, value, payloadBatch) { + showValueMap[axisInfo.key] = {value: value, payloadBatch: payloadBatch}; + } - var sector = this.childAt(0); + function showTooltip(dataByCoordSys, axisInfo, payloadInfo, value) { + var payloadBatch = payloadInfo.payloadBatch; + var axis = axisInfo.axis; + var axisModel = axis.model; + var axisPointerModel = axisInfo.axisPointerModel; - var seriesModel = data.hostModel; - var itemModel = data.getItemModel(idx); - var layout = data.getItemLayout(idx); - var sectorShape = zrUtil.extend({}, layout); - sectorShape.label = null; + // If no data, do not create anything in dataByCoordSys, + // whose length will be used to judge whether dispatch action. + if (!axisInfo.triggerTooltip || !payloadBatch.length) { + return; + } - if (firstCreate) { - sector.setShape(sectorShape); + var coordSysModel = axisInfo.coordSys.model; + var coordSysKey = modelHelper.makeKey(coordSysModel); + var coordSysItem = dataByCoordSys.map[coordSysKey]; + if (!coordSysItem) { + coordSysItem = dataByCoordSys.map[coordSysKey] = { + coordSysId: coordSysModel.id, + coordSysIndex: coordSysModel.componentIndex, + coordSysType: coordSysModel.type, + coordSysMainType: coordSysModel.mainType, + dataByAxis: [] + }; + dataByCoordSys.list.push(coordSysItem); + } + + coordSysItem.dataByAxis.push({ + axisDim: axis.dim, + axisIndex: axisModel.componentIndex, + axisType: axisModel.type, + axisId: axisModel.id, + value: value, + // Caustion: viewHelper.getValueLabel is actually on "view stage", which + // depends that all models have been updated. So it should not be performed + // here. Considering axisPointerModel used here is volatile, which is hard + // to be retrieve in TooltipView, we prepare parameters here. + valueLabelOpt: { + precision: axisPointerModel.get('label.precision'), + formatter: axisPointerModel.get('label.formatter') + }, + seriesDataIndices: payloadBatch.slice() + }); + } - var animationType = seriesModel.getShallow('animationType'); - if (animationType === 'scale') { - sector.shape.r = layout.r0; - graphic.initProps(sector, { - shape: { - r: layout.r - } - }, seriesModel, idx); + function highlight(highlightBatch, actionType, batch) { + highlightBatch.push.apply(highlightBatch, batch); + } + + function updateModelActually(showValueMap, axesInfo) { + // Basic logic: If no 'show' required, 'hide' this axisPointer. + each(axesInfo, function (axisInfo, key) { + var option = axisInfo.axisPointerModel.option; + var valItem = showValueMap[key]; + + if (valItem) { + !axisInfo.useHandle && (option.status = 'show'); + option.value = valItem.value; + // For label formatter param. + option.seriesDataIndices = (valItem.payloadBatch || []).slice(); } - // Expansion + // When always show (e.g., handle used), remain + // original value and status. else { - sector.shape.endAngle = layout.startAngle; - graphic.updateProps(sector, { - shape: { - endAngle: layout.endAngle - } - }, seriesModel, idx); + // If hide, value still need to be set, consider + // click legend to toggle axis blank. + !axisInfo.useHandle && (option.status = 'hide'); } + }); + } - } - else { - graphic.updateProps(sector, { - shape: sectorShape - }, seriesModel, idx); + function dispatchTooltipActually(dataByCoordSys, point, tooltipOption, dispatchAction) { + // Basic logic: If no showTip required, hideTip will be dispatched. + if (illegalPoint(point) || !dataByCoordSys.list.length) { + dispatchAction({type: 'hideTip'}); + return; } - // Update common style - var itemStyleModel = itemModel.getModel('itemStyle'); - var visualColor = data.getItemVisual(idx, 'color'); + // In most case only one axis (or event one series is used). It is + // convinient to fetch payload.seriesIndex and payload.dataIndex + // dirtectly. So put the first seriesIndex and dataIndex of the first + // axis on the payload. + var sampleItem = ((dataByCoordSys.list[0].dataByAxis[0] || {}).seriesDataIndices || [])[0] || {}; - sector.useStyle( - zrUtil.defaults( - { - lineJoin: 'bevel', - fill: visualColor - }, - itemStyleModel.getModel('normal').getItemStyle() - ) - ); - sector.hoverStyle = itemStyleModel.getModel('emphasis').getItemStyle(); + dispatchAction({ + type: 'showTip', + escapeConnect: true, + x: point[0], + y: point[1], + tooltipOption: tooltipOption, + dataIndexInside: sampleItem.dataIndexInside, + dataIndex: sampleItem.dataIndex, + seriesIndex: sampleItem.seriesIndex, + dataByCoordSys: dataByCoordSys.list + }); + } - // Toggle selected - toggleItemSelected( - this, - data.getItemLayout(idx), - itemModel.get('selected'), - seriesModel.get('selectedOffset'), - seriesModel.get('animation') - ); + function dispatchHighDownActually(highlightBatch, dispatchAction, api, highDownKey) { + // Basic logic: If nothing highlighted, should downplay all highlighted items. + // This case will occur when mouse leave coordSys. - function onEmphasis() { - // Sector may has animation of updating data. Force to move to the last frame - // Or it may stopped on the wrong shape - sector.stopAnimation(true); - sector.animateTo({ - shape: { - r: layout.r + 10 - } - }, 300, 'elasticOut'); - } - function onNormal() { - sector.stopAnimation(true); - sector.animateTo({ - shape: { - r: layout.r - } - }, 300, 'elasticOut'); - } - sector.off('mouseover').off('mouseout').off('emphasis').off('normal'); - if (itemModel.get('hoverAnimation') && seriesModel.isAnimationEnabled()) { - sector - .on('mouseover', onEmphasis) - .on('mouseout', onNormal) - .on('emphasis', onEmphasis) - .on('normal', onNormal); - } + // FIXME + // (1) highlight status shoule be managemented in series.getData()? + // (2) If axisPointer A triggerOn 'handle' and axisPointer B triggerOn + // 'mousemove', items highlighted by A will be downplayed by B. + // It will not be fixed until someone requires this scenario. + + // Consider items area hightlighted by 'handle', and globalListener may + // downplay all items (including just highlighted ones) when mousemove. + // So we use a highDownKey to separate them as a temporary solution. + var zr = api.getZr(); + highDownKey = 'lastHighlights' + (highDownKey || ''); + var lastHighlights = get(zr)[highDownKey] || {}; + var newHighlights = get(zr)[highDownKey] = {}; + + // Build hash map and remove duplicate incidentally. + zrUtil.each(highlightBatch, function (batchItem) { + var key = batchItem.seriesIndex + ' | ' + batchItem.dataIndex; + newHighlights[key] = batchItem; + }); - this._updateLabel(data, idx); + // Diff. + var toHighlight = []; + var toDownplay = []; + zrUtil.each(lastHighlights, function (batchItem, key) { + !newHighlights[key] && toDownplay.push(batchItem); + }); + zrUtil.each(newHighlights, function (batchItem, key) { + !lastHighlights[key] && toHighlight.push(batchItem); + }); - graphic.setHoverStyle(this); - }; + toDownplay.length && api.dispatchAction({ + type: 'downplay', escapeConnect: true, batch: toDownplay + }); + toHighlight.length && api.dispatchAction({ + type: 'highlight', escapeConnect: true, batch: toHighlight + }); + } - piePieceProto._updateLabel = function (data, idx) { + function notTargetAxis(finder, axis) { + var isTarget = 1; + // If none of xxxAxisId and xxxAxisName and xxxAxisIndex exists in finder, + // no axis is not target axis. + each(finder, function (value, propName) { + isTarget &= !(/^.+(AxisId|AxisName|AxisIndex)$/.test(propName)); + }); + !isTarget && each( + [['AxisId', 'id'], ['AxisIndex', 'componentIndex'], ['AxisName', 'name']], + function (prop) { + var vals = modelUtil.normalizeToArray(finder[axis.dim + prop[0]]); + isTarget |= zrUtil.indexOf(vals, axis.model[prop[1]]) >= 0; + } + ); + return !isTarget; + } - var labelLine = this.childAt(1); - var labelText = this.childAt(2); + function makeMapperParam(axisInfo) { + var axisModel = axisInfo.axis.model; + var item = {}; + var dim = item.axisDim = axisInfo.axis.dim; + item.axisIndex = item[dim + 'AxisIndex'] = axisModel.componentIndex; + item.axisName = item[dim + 'AxisName'] = axisModel.name; + item.axisId = item[dim + 'AxisId'] = axisModel.id; + return item; + } - var seriesModel = data.hostModel; - var itemModel = data.getItemModel(idx); - var layout = data.getItemLayout(idx); - var labelLayout = layout.label; - var visualColor = data.getItemVisual(idx, 'color'); + function illegalPoint(point) { + return point[0] == null || isNaN(point[0]) || point[1] == null || isNaN(point[1]); + } - graphic.updateProps(labelLine, { - shape: { - points: labelLayout.linePoints || [ - [labelLayout.x, labelLayout.y], [labelLayout.x, labelLayout.y], [labelLayout.x, labelLayout.y] - ] - } - }, seriesModel, idx); + module.exports = axisTrigger; - graphic.updateProps(labelText, { - style: { - x: labelLayout.x, - y: labelLayout.y - } - }, seriesModel, idx); - labelText.attr({ - style: { - textVerticalAlign: labelLayout.verticalAlign, - textAlign: labelLayout.textAlign, - textFont: labelLayout.font - }, - rotation: labelLayout.rotation, - origin: [labelLayout.x, labelLayout.y], - z2: 10 - }); - var labelModel = itemModel.getModel('label.normal'); - var labelHoverModel = itemModel.getModel('label.emphasis'); - var labelLineModel = itemModel.getModel('labelLine.normal'); - var labelLineHoverModel = itemModel.getModel('labelLine.emphasis'); - var labelPosition = labelModel.get('position') || labelHoverModel.get('position'); +/***/ }, +/* 144 */ +/***/ function(module, exports, __webpack_require__) { - labelText.setStyle(getLabelStyle(data, idx, 'normal', labelModel, labelPosition)); + - labelText.ignore = labelText.normalIgnore = !labelModel.get('show'); - labelText.hoverIgnore = !labelHoverModel.get('show'); + var zrUtil = __webpack_require__(4); + var modelUtil = __webpack_require__(5); - labelLine.ignore = labelLine.normalIgnore = !labelLineModel.get('show'); - labelLine.hoverIgnore = !labelLineHoverModel.get('show'); + /** + * @param {Object} finder contains {seriesIndex, dataIndex, dataIndexInside} + * @param {module:echarts/model/Global} ecModel + * @return {Object} {point: [x, y], el: ...} point Will not be null. + */ + module.exports = function (finder, ecModel) { + var point = []; + var seriesIndex = finder.seriesIndex; + var seriesModel; + if (seriesIndex == null || !( + seriesModel = ecModel.getSeriesByIndex(seriesIndex) + )) { + return {point: []}; + } - // Default use item visual color - labelLine.setStyle({ - stroke: visualColor, - opacity: data.getItemVisual(idx, 'opacity') - }); - labelLine.setStyle(labelLineModel.getModel('lineStyle').getLineStyle()); + var data = seriesModel.getData(); + var dataIndex = modelUtil.queryDataIndex(data, finder); + if (dataIndex == null || zrUtil.isArray(dataIndex)) { + return {point: []}; + } - labelText.hoverStyle = getLabelStyle(data, idx, 'emphasis', labelHoverModel, labelPosition); - labelLine.hoverStyle = labelLineHoverModel.getModel('lineStyle').getLineStyle(); + var el = data.getItemGraphicEl(dataIndex); + var coordSys = seriesModel.coordinateSystem; - var smooth = labelLineModel.get('smooth'); - if (smooth && smooth === true) { - smooth = 0.4; + if (seriesModel.getTooltipPosition) { + point = seriesModel.getTooltipPosition(dataIndex) || []; + } + else if (coordSys && coordSys.dataToPoint) { + point = coordSys.dataToPoint( + data.getValues( + zrUtil.map(coordSys.dimensions, function (dim) { + return seriesModel.coordDimToDataDim(dim)[0]; + }), dataIndex, true + ) + ) || []; + } + else if (el) { + // Use graphic bounding rect + var rect = el.getBoundingRect().clone(); + rect.applyTransform(el.transform); + point = [ + rect.x + rect.width / 2, + rect.y + rect.height / 2 + ]; } - labelLine.setShape({ - smooth: smooth - }); - }; - zrUtil.inherits(PiePiece, graphic.Group); + return {point: point, el: el}; + }; - // Pie view - var Pie = __webpack_require__(42).extend({ - type: 'pie', - init: function () { - var sectorGroup = new graphic.Group(); - this._sectorGroup = sectorGroup; - }, +/***/ }, +/* 145 */ +/***/ function(module, exports, __webpack_require__) { - render: function (seriesModel, ecModel, api, payload) { - if (payload && (payload.from === this.uid)) { - return; - } + - var data = seriesModel.getData(); - var oldData = this._data; - var group = this.group; + var echarts = __webpack_require__(1); - var hasAnimation = ecModel.get('animation'); - var isFirstRender = !oldData; - var animationType = seriesModel.get('animationType'); + var AxisPointerModel = echarts.extendComponentModel({ - var onSectorClick = zrUtil.curry( - updateDataSelected, this.uid, seriesModel, hasAnimation, api - ); + type: 'axisPointer', - var selectedMode = seriesModel.get('selectedMode'); + coordSysAxesInfo: null, - data.diff(oldData) - .add(function (idx) { - var piePiece = new PiePiece(data, idx); - // Default expansion animation - if (isFirstRender && animationType !== 'scale') { - piePiece.eachChild(function (child) { - child.stopAnimation(true); - }); - } + defaultOption: { + // 'auto' means that show when triggered by tooltip or handle. + show: 'auto', + // 'click' | 'mousemove' | 'none' + triggerOn: null, // set default in AxisPonterView.js - selectedMode && piePiece.on('click', onSectorClick); + zlevel: 0, + z: 50, + + type: 'line', + // axispointer triggered by tootip determine snap automatically, + // see `modelHelper`. + snap: false, + triggerTooltip: true, + + value: null, + status: null, // Init value depends on whether handle is used. + + // [group0, group1, ...] + // Each group can be: { + // mapper: function () {}, + // singleTooltip: 'multiple', // 'multiple' or 'single' + // xAxisId: ..., + // yAxisName: ..., + // angleAxisIndex: ... + // } + // mapper: can be ignored. + // input: {axisInfo, value} + // output: {axisInfo, value} + link: [], - data.setItemGraphicEl(idx, piePiece); + // Do not set 'auto' here, otherwise global animation: false + // will not effect at this axispointer. + animation: null, + animationDurationUpdate: 200, - group.add(piePiece); - }) - .update(function (newIdx, oldIdx) { - var piePiece = oldData.getItemGraphicEl(oldIdx); + lineStyle: { + color: '#aaa', + width: 1, + type: 'solid' + }, - piePiece.updateData(data, newIdx); + shadowStyle: { + color: 'rgba(150,150,150,0.3)' + }, - piePiece.off('click'); - selectedMode && piePiece.on('click', onSectorClick); - group.add(piePiece); - data.setItemGraphicEl(newIdx, piePiece); - }) - .remove(function (idx) { - var piePiece = oldData.getItemGraphicEl(idx); - group.remove(piePiece); - }) - .execute(); + label: { + show: true, + formatter: null, // string | Function + precision: 'auto', // Or a number like 0, 1, 2 ... + margin: 3, + textStyle: { + color: '#fff' + }, + padding: [5, 7, 5, 7], + backgroundColor: 'auto', // default: axis line color + borderColor: null, + borderWidth: 0, + shadowBlur: 3, + shadowColor: '#aaa' + // Considering applicability, common style should + // better not have shadowOffset. + // shadowOffsetX: 0, + // shadowOffsetY: 2 + }, - if ( - hasAnimation && isFirstRender && data.count() > 0 - // Default expansion animation - && animationType !== 'scale' - ) { - var shape = data.getItemLayout(0); - var r = Math.max(api.getWidth(), api.getHeight()) / 2; + handle: { + show: false, + icon: 'M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4h1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7V23h6.6V24.4z M13.3,19.6H6.7v-1.4h6.6V19.6z', // jshint ignore:line + size: 45, + // handle margin is from symbol center to axis, which is stable when circular move. + margin: 50, + // color: '#1b8bbd' + // color: '#2f4554' + color: '#333', + shadowBlur: 3, + shadowColor: '#aaa', + shadowOffsetX: 0, + shadowOffsetY: 2, - var removeClipPath = zrUtil.bind(group.removeClipPath, group); - group.setClipPath(this._createClipPath( - shape.cx, shape.cy, r, shape.startAngle, shape.clockwise, removeClipPath, seriesModel - )); + // For mobile performance + throttle: 40 } + } - this._data = data; - }, + }); - dispose: function () {}, + module.exports = AxisPointerModel; - _createClipPath: function ( - cx, cy, r, startAngle, clockwise, cb, seriesModel - ) { - var clipPath = new graphic.Sector({ - shape: { - cx: cx, - cy: cy, - r0: 0, - r: r, - startAngle: startAngle, - endAngle: startAngle, - clockwise: clockwise - } - }); - graphic.initProps(clipPath, { - shape: { - endAngle: startAngle + (clockwise ? 1 : -1) * Math.PI * 2 + +/***/ }, +/* 146 */ +/***/ function(module, exports, __webpack_require__) { + + + + var globalListener = __webpack_require__(147); + + var AxisPonterView = __webpack_require__(1).extendComponentView({ + + type: 'axisPointer', + + render: function (globalAxisPointerModel, ecModel, api) { + var globalTooltipModel = ecModel.getComponent('tooltip'); + var triggerOn = globalAxisPointerModel.get('triggerOn') + || (globalTooltipModel && globalTooltipModel.get('triggerOn') || 'mousemove|click'); + + // Register global listener in AxisPointerView to enable + // AxisPointerView to be independent to Tooltip. + globalListener.register( + 'axisPointer', + api, + function (currTrigger, e, dispatchAction) { + // If 'none', it is not controlled by mouse totally. + if (triggerOn !== 'none' + && (currTrigger === 'leave' || triggerOn.indexOf(currTrigger) >= 0) + ) { + dispatchAction({ + type: 'updateAxisPointer', + currTrigger: currTrigger, + x: e && e.offsetX, + y: e && e.offsetY + }); + } } - }, seriesModel, cb); + ); + }, - return clipPath; + /** + * @override + */ + remove: function (ecModel, api) { + globalListener.disopse(api.getZr(), 'axisPointer'); + AxisPonterView.superApply(this._model, 'remove', arguments); }, /** - * @implement + * @override */ - containPoint: function (point, seriesModel) { - var data = seriesModel.getData(); - var itemLayout = data.getItemLayout(0); - if (itemLayout) { - var dx = point[0] - itemLayout.cx; - var dy = point[1] - itemLayout.cy; - var radius = Math.sqrt(dx * dx + dy * dy); - return radius <= itemLayout.r && radius >= itemLayout.r0; - } + dispose: function (ecModel, api) { + globalListener.unregister('axisPointer', api); + AxisPonterView.superApply(this._model, 'dispose', arguments); } }); - module.exports = Pie; /***/ }, -/* 145 */ +/* 147 */ /***/ function(module, exports, __webpack_require__) { - var echarts = __webpack_require__(1); + + var env = __webpack_require__(2); var zrUtil = __webpack_require__(4); - module.exports = function (seriesType, actionInfos) { - zrUtil.each(actionInfos, function (actionInfo) { - actionInfo.update = 'updateView'; - /** - * @payload - * @property {string} seriesName - * @property {string} name - */ - echarts.registerAction(actionInfo, function (payload, ecModel) { - var selected = {}; - ecModel.eachComponent( - {mainType: 'series', subType: seriesType, query: payload}, - function (seriesModel) { - if (seriesModel[actionInfo.method]) { - seriesModel[actionInfo.method](payload.name); - } - var data = seriesModel.getData(); - // Create selected map - data.each(function (idx) { - var name = data.getName(idx); - selected[name] = seriesModel.isSelected(name) || false; - }); - } - ); - return { - name: payload.name, - selected: selected - }; - }); - }); - }; + var get = __webpack_require__(5).makeGetter(); + var each = zrUtil.each; -/***/ }, -/* 146 */ -/***/ function(module, exports) { + var globalListener = {}; - // Pick color from palette for each data item. - // Applicable for charts that require applying color palette - // in data level (like pie, funnel, chord). + /** + * @param {string} key + * @param {module:echarts/ExtensionAPI} api + * @param {Function} handler + * param: {string} currTrigger + * param: {Array.} point + */ + globalListener.register = function (key, api, handler) { + if (env.node) { + return; + } + var zr = api.getZr(); + get(zr).records || (get(zr).records = {}); - module.exports = function (seriesType, ecModel) { - // Pie and funnel may use diferrent scope - var paletteScope = {}; - ecModel.eachRawSeriesByType(seriesType, function (seriesModel) { - var dataAll = seriesModel.getRawData(); - var idxMap = {}; - if (!ecModel.isSeriesFiltered(seriesModel)) { - var data = seriesModel.getData(); - data.each(function (idx) { - var rawIdx = data.getRawIndex(idx); - idxMap[rawIdx] = idx; - }); - dataAll.each(function (rawIdx) { - var filteredIdx = idxMap[rawIdx]; + initGlobalListeners(zr, api); - // If series.itemStyle.normal.color is a function. itemVisual may be encoded - var singleDataColor = filteredIdx != null - && data.getItemVisual(filteredIdx, 'color', true); + var record = get(zr).records[key] || (get(zr).records[key] = {}); + record.handler = handler; + }; - if (!singleDataColor) { - // FIXME Performance - var itemModel = dataAll.getItemModel(rawIdx); - var color = itemModel.get('itemStyle.normal.color') - || seriesModel.getColorFromPalette(dataAll.getName(rawIdx), paletteScope); - // Legend may use the visual info in data before processed - dataAll.setItemVisual(rawIdx, 'color', color); + function initGlobalListeners(zr, api) { + if (get(zr).initialized) { + return; + } - // Data is not filtered - if (filteredIdx != null) { - data.setItemVisual(filteredIdx, 'color', color); - } - } - else { - // Set data all color for legend - dataAll.setItemVisual(rawIdx, 'color', singleDataColor); - } - }); - } - }); - }; + get(zr).initialized = true; + useHandler('click', zrUtil.curry(doEnter, 'click')); + useHandler('mousemove', zrUtil.curry(doEnter, 'mousemove')); + // useHandler('mouseout', onLeave); + useHandler('globalout', onLeave); -/***/ }, -/* 147 */ -/***/ function(module, exports, __webpack_require__) { + function useHandler(eventType, cb) { + zr.on(eventType, function (e) { + var dis = makeDispatchAction(api); - // TODO minAngle + each(get(zr).records, function (record) { + record && cb(record, e, dis.dispatchAction); + }); + dispatchTooltipFinally(dis.pendings, api); + }); + } + } + function dispatchTooltipFinally(pendings, api) { + var showLen = pendings.showTip.length; + var hideLen = pendings.hideTip.length; - var numberUtil = __webpack_require__(7); - var parsePercent = numberUtil.parsePercent; - var labelLayout = __webpack_require__(148); - var zrUtil = __webpack_require__(4); - - var PI2 = Math.PI * 2; - var RADIAN = Math.PI / 180; - - module.exports = function (seriesType, ecModel, api, payload) { - ecModel.eachSeriesByType(seriesType, function (seriesModel) { - var center = seriesModel.get('center'); - var radius = seriesModel.get('radius'); - - if (!zrUtil.isArray(radius)) { - radius = [0, radius]; - } - if (!zrUtil.isArray(center)) { - center = [center, center]; - } - - var width = api.getWidth(); - var height = api.getHeight(); - var size = Math.min(width, height); - var cx = parsePercent(center[0], width); - var cy = parsePercent(center[1], height); - var r0 = parsePercent(radius[0], size / 2); - var r = parsePercent(radius[1], size / 2); - - var data = seriesModel.getData(); - - var startAngle = -seriesModel.get('startAngle') * RADIAN; - - var minAngle = seriesModel.get('minAngle') * RADIAN; - - var sum = data.getSum('value'); - // Sum may be 0 - var unitRadian = Math.PI / (sum || data.count()) * 2; - - var clockwise = seriesModel.get('clockwise'); - - var roseType = seriesModel.get('roseType'); - var stillShowZeroSum = seriesModel.get('stillShowZeroSum'); - - // [0...max] - var extent = data.getDataExtent('value'); - extent[0] = 0; - - // In the case some sector angle is smaller than minAngle - var restAngle = PI2; - var valueSumLargerThanMinAngle = 0; - - var currentAngle = startAngle; - - var dir = clockwise ? 1 : -1; - data.each('value', function (value, idx) { - var angle; - if (isNaN(value)) { - data.setItemLayout(idx, { - angle: NaN, - startAngle: NaN, - endAngle: NaN, - clockwise: clockwise, - cx: cx, - cy: cy, - r0: r0, - r: roseType - ? NaN - : r - }); - return; - } - - // FIXME 兼容 2.0 但是 roseType 是 area 的时候才是这样? - if (roseType !== 'area') { - angle = (sum === 0 && stillShowZeroSum) - ? unitRadian : (value * unitRadian); - } - else { - angle = PI2 / (data.count() || 1); - } - - if (angle < minAngle) { - angle = minAngle; - restAngle -= minAngle; - } - else { - valueSumLargerThanMinAngle += value; - } - - var endAngle = currentAngle + dir * angle; - data.setItemLayout(idx, { - angle: angle, - startAngle: currentAngle, - endAngle: endAngle, - clockwise: clockwise, - cx: cx, - cy: cy, - r0: r0, - r: roseType - ? numberUtil.linearMap(value, extent, [r0, r]) - : r - }); - - currentAngle = endAngle; - }, true); - - // Some sector is constrained by minAngle - // Rest sectors needs recalculate angle - if (restAngle < PI2) { - // Average the angle if rest angle is not enough after all angles is - // Constrained by minAngle - if (restAngle <= 1e-3) { - var angle = PI2 / data.count(); - data.each(function (idx) { - var layout = data.getItemLayout(idx); - layout.startAngle = startAngle + dir * idx * angle; - layout.endAngle = startAngle + dir * (idx + 1) * angle; - }); - } - else { - unitRadian = restAngle / valueSumLargerThanMinAngle; - currentAngle = startAngle; - data.each('value', function (value, idx) { - var layout = data.getItemLayout(idx); - var angle = layout.angle === minAngle - ? minAngle : value * unitRadian; - layout.startAngle = currentAngle; - layout.endAngle = currentAngle + dir * angle; - currentAngle += dir * angle; - }); - } - } - - labelLayout(seriesModel, r, width, height); - }); - }; - - -/***/ }, -/* 148 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - // FIXME emphasis label position is not same with normal label position - - - var textContain = __webpack_require__(8); - - function adjustSingleSide(list, cx, cy, r, dir, viewWidth, viewHeight) { - list.sort(function (a, b) { - return a.y - b.y; - }); - - // 压 - function shiftDown(start, end, delta, dir) { - for (var j = start; j < end; j++) { - list[j].y += delta; - if (j > start - && j + 1 < end - && list[j + 1].y > list[j].y + list[j].height - ) { - shiftUp(j, delta / 2); - return; - } - } - - shiftUp(end - 1, delta / 2); + var actuallyPayload; + if (showLen) { + actuallyPayload = pendings.showTip[showLen - 1]; } - - // 弹 - function shiftUp(end, delta) { - for (var j = end; j >= 0; j--) { - list[j].y -= delta; - if (j > 0 - && list[j].y > list[j - 1].y + list[j - 1].height - ) { - break; - } - } + else if (hideLen) { + actuallyPayload = pendings.hideTip[hideLen - 1]; } - - function changeX(list, isDownList, cx, cy, r, dir) { - var lastDeltaX = dir > 0 - ? isDownList // 右侧 - ? Number.MAX_VALUE // 下 - : 0 // 上 - : isDownList // 左侧 - ? Number.MAX_VALUE // 下 - : 0; // 上 - - for (var i = 0, l = list.length; i < l; i++) { - // Not change x for center label - if (list[i].position === 'center') { - continue; - } - var deltaY = Math.abs(list[i].y - cy); - var length = list[i].len; - var length2 = list[i].len2; - var deltaX = (deltaY < r + length) - ? Math.sqrt( - (r + length + length2) * (r + length + length2) - - deltaY * deltaY - ) - : Math.abs(list[i].x - cx); - if (isDownList && deltaX >= lastDeltaX) { - // 右下,左下 - deltaX = lastDeltaX - 10; - } - if (!isDownList && deltaX <= lastDeltaX) { - // 右上,左上 - deltaX = lastDeltaX + 10; - } - - list[i].x = cx + deltaX * dir; - lastDeltaX = deltaX; - } + if (actuallyPayload) { + actuallyPayload.dispatchAction = null; + api.dispatchAction(actuallyPayload); } + } - var lastY = 0; - var delta; - var len = list.length; - var upList = []; - var downList = []; - for (var i = 0; i < len; i++) { - delta = list[i].y - lastY; - if (delta < 0) { - shiftDown(i, len, -delta, dir); - } - lastY = list[i].y + list[i].height; - } - if (viewHeight - lastY < 0) { - shiftUp(len - 1, lastY - viewHeight); - } - for (var i = 0; i < len; i++) { - if (list[i].y >= cy) { - downList.push(list[i]); - } - else { - upList.push(list[i]); - } - } - changeX(upList, false, cx, cy, r, dir); - changeX(downList, true, cx, cy, r, dir); + function onLeave(record, e, dispatchAction) { + record.handler('leave', null, dispatchAction); } - function avoidOverlap(labelLayoutList, cx, cy, r, viewWidth, viewHeight) { - var leftList = []; - var rightList = []; - for (var i = 0; i < labelLayoutList.length; i++) { - if (labelLayoutList[i].x < cx) { - leftList.push(labelLayoutList[i]); + function doEnter(currTrigger, record, e, dispatchAction) { + record.handler(currTrigger, e, dispatchAction); + } + + function makeDispatchAction(api) { + var pendings = { + showTip: [], + hideTip: [] + }; + // FIXME + // better approach? + // 'showTip' and 'hideTip' can be triggered by axisPointer and tooltip, + // which may be conflict, (axisPointer call showTip but tooltip call hideTip); + // So we have to add "final stage" to merge those dispatched actions. + var dispatchAction = function (payload) { + var pendingList = pendings[payload.type]; + if (pendingList) { + pendingList.push(payload); } else { - rightList.push(labelLayoutList[i]); + payload.dispatchAction = dispatchAction; + api.dispatchAction(payload); } - } - - adjustSingleSide(rightList, cx, cy, r, 1, viewWidth, viewHeight); - adjustSingleSide(leftList, cx, cy, r, -1, viewWidth, viewHeight); + }; - for (var i = 0; i < labelLayoutList.length; i++) { - var linePoints = labelLayoutList[i].linePoints; - if (linePoints) { - var dist = linePoints[1][0] - linePoints[2][0]; - if (labelLayoutList[i].x < cx) { - linePoints[2][0] = labelLayoutList[i].x + 3; - } - else { - linePoints[2][0] = labelLayoutList[i].x - 3; - } - linePoints[1][1] = linePoints[2][1] = labelLayoutList[i].y; - linePoints[1][0] = linePoints[2][0] + dist; - } - } + return { + dispatchAction: dispatchAction, + pendings: pendings + }; } - module.exports = function (seriesModel, r, viewWidth, viewHeight) { - var data = seriesModel.getData(); - var labelLayoutList = []; - var cx; - var cy; - var hasLabelRotate = false; - - data.each(function (idx) { - var layout = data.getItemLayout(idx); - - var itemModel = data.getItemModel(idx); - var labelModel = itemModel.getModel('label.normal'); - // Use position in normal or emphasis - var labelPosition = labelModel.get('position') || itemModel.get('label.emphasis.position'); - - var labelLineModel = itemModel.getModel('labelLine.normal'); - var labelLineLen = labelLineModel.get('length'); - var labelLineLen2 = labelLineModel.get('length2'); - - var midAngle = (layout.startAngle + layout.endAngle) / 2; - var dx = Math.cos(midAngle); - var dy = Math.sin(midAngle); + /** + * @param {string} key + * @param {module:echarts/ExtensionAPI} api + */ + globalListener.unregister = function (key, api) { + if (env.node) { + return; + } + var zr = api.getZr(); + var record = (get(zr).records || {})[key]; + if (record) { + get(zr).records[key] = null; + } + }; - var textX; - var textY; - var linePoints; - var textAlign; + module.exports = globalListener; - cx = layout.cx; - cy = layout.cy; - var isLabelInside = labelPosition === 'inside' || labelPosition === 'inner'; - if (labelPosition === 'center') { - textX = layout.cx; - textY = layout.cy; - textAlign = 'center'; - } - else { - var x1 = (isLabelInside ? (layout.r + layout.r0) / 2 * dx : layout.r * dx) + cx; - var y1 = (isLabelInside ? (layout.r + layout.r0) / 2 * dy : layout.r * dy) + cy; +/***/ }, +/* 148 */ +/***/ function(module, exports, __webpack_require__) { - textX = x1 + dx * 3; - textY = y1 + dy * 3; + - if (!isLabelInside) { - // For roseType - var x2 = x1 + dx * (labelLineLen + r - layout.r); - var y2 = y1 + dy * (labelLineLen + r - layout.r); - var x3 = x2 + ((dx < 0 ? -1 : 1) * labelLineLen2); - var y3 = y2; + var zrUtil = __webpack_require__(4); - textX = x3 + (dx < 0 ? -5 : 5); - textY = y3; - linePoints = [[x1, y1], [x2, y2], [x3, y3]]; - } + __webpack_require__(124); - textAlign = isLabelInside ? 'center' : (dx > 0 ? 'left' : 'right'); - } - var font = labelModel.getModel('textStyle').getFont(); + __webpack_require__(149); + __webpack_require__(151); - var labelRotate = labelModel.get('rotate') - ? (dx < 0 ? -midAngle + Math.PI : -midAngle) : 0; - var text = seriesModel.getFormattedLabel(idx, 'normal') - || data.getName(idx); - var textRect = textContain.getBoundingRect( - text, font, textAlign, 'top' - ); - hasLabelRotate = !!labelRotate; - layout.label = { - x: textX, - y: textY, - position: labelPosition, - height: textRect.height, - len: labelLineLen, - len2: labelLineLen2, - linePoints: linePoints, - textAlign: textAlign, - verticalAlign: 'middle', - font: font, - rotation: labelRotate - }; + var barLayoutGrid = __webpack_require__(154); + var echarts = __webpack_require__(1); - // Not layout the inside label - if (!isLabelInside) { - labelLayoutList.push(layout.label); - } + echarts.registerLayout(zrUtil.curry(barLayoutGrid, 'bar')); + // Visual coding for legend + echarts.registerVisual(function (ecModel) { + ecModel.eachSeriesByType('bar', function (seriesModel) { + var data = seriesModel.getData(); + data.setVisual('legendSymbol', 'roundRect'); }); - if (!hasLabelRotate && seriesModel.get('avoidLabelOverlap')) { - avoidOverlap(labelLayoutList, cx, cy, r, viewWidth, viewHeight); - } - }; - - -/***/ }, -/* 149 */ -/***/ function(module, exports) { + }); - - module.exports = function (seriesType, ecModel) { - var legendModels = ecModel.findComponents({ - mainType: 'legend' - }); - if (!legendModels || !legendModels.length) { - return; - } - ecModel.eachSeriesByType(seriesType, function (series) { - var data = series.getData(); - data.filterSelf(function (idx) { - var name = data.getName(idx); - // If in any legend component the status is not selected. - for (var i = 0; i < legendModels.length; i++) { - if (!legendModels[i].isSelected(name)) { - return false; - } - } - return true; - }, this); - }, this); - }; + // In case developer forget to include grid component + __webpack_require__(122); /***/ }, -/* 150 */ +/* 149 */ /***/ function(module, exports, __webpack_require__) { - var zrUtil = __webpack_require__(4); - var echarts = __webpack_require__(1); + module.exports = __webpack_require__(150).extend({ - __webpack_require__(151); - __webpack_require__(152); + type: 'series.bar', - echarts.registerVisual(zrUtil.curry( - __webpack_require__(110), 'scatter', 'circle', null - )); - echarts.registerLayout(zrUtil.curry( - __webpack_require__(111), 'scatter' - )); + dependencies: ['grid', 'polar'], - // In case developer forget to include grid component - __webpack_require__(113); + brushSelector: 'rect' + }); /***/ }, -/* 151 */ +/* 150 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; - var createListFromArray = __webpack_require__(102); var SeriesModel = __webpack_require__(28); + var createListFromArray = __webpack_require__(102); module.exports = SeriesModel.extend({ - type: 'series.scatter', - - dependencies: ['grid', 'polar'], + type: 'series.__base_bar__', getInitialData: function (option, ecModel) { - var list = createListFromArray(option.data, this, ecModel); - return list; + if (true) { + var coordSys = option.coordinateSystem; + if (coordSys !== 'cartesian2d') { + throw new Error('Bar only support cartesian2d coordinateSystem'); + } + } + return createListFromArray(option.data, this, ecModel); }, - brushSelector: 'point', + getMarkerPosition: function (value) { + var coordSys = this.coordinateSystem; + if (coordSys) { + // PENDING if clamp ? + var pt = coordSys.dataToPoint(value, true); + var data = this.getData(); + var offset = data.getLayout('offset'); + var size = data.getLayout('size'); + var offsetIndex = coordSys.getBaseAxis().isHorizontal() ? 0 : 1; + pt[offsetIndex] += offset + size / 2; + return pt; + } + return [NaN, NaN]; + }, defaultOption: { + zlevel: 0, // 一级层叠 + z: 2, // 二级层叠 coordinateSystem: 'cartesian2d', - zlevel: 0, - z: 2, legendHoverLink: true, + // stack: null - hoverAnimation: true, // Cartesian coordinate system // xAxisIndex: 0, // yAxisIndex: 0, - // Polar coordinate system - // polarIndex: 0, - - // Geo coordinate system - // geoIndex: 0, - - // symbol: null, // 图形类型 - symbolSize: 10, // 图形大小,半宽(半径)参数,当图形为方向或菱形则总宽度为symbolSize * 2 - // symbolRotate: null, // 图形旋转控制 - - large: false, - // Available when large is true - largeThreshold: 2000, + // 最小高度改为0 + barMinHeight: 0, + // barMaxWidth: null, + // 默认自适应 + // barWidth: null, + // 柱间距离,默认为柱形宽度的30%,可设固定值 + // barGap: '30%', + // 类目间柱形距离,默认为类目间距的20%,可设固定值 + // barCategoryGap: '20%', // label: { - // normal: { - // show: false - // distance: 5, - // formatter: 标签文本格式器,同Tooltip.formatter,不支持异步回调 - // position: 默认自适应,水平布局为'top',垂直布局为'right',可选为 - // 'inside'|'left'|'right'|'top'|'bottom' - // textStyle: null // 默认使用全局文本样式,详见TEXTSTYLE + // normal: { + // show: false // } // }, itemStyle: { normal: { - opacity: 0.8 - // color: 各异 - } + // color: '各异' + }, + emphasis: {} } } - }); /***/ }, -/* 152 */ +/* 151 */ /***/ function(module, exports, __webpack_require__) { - + 'use strict'; - var SymbolDraw = __webpack_require__(105); - var LargeSymbolDraw = __webpack_require__(153); - __webpack_require__(1).extendChartView({ + var zrUtil = __webpack_require__(4); + var graphic = __webpack_require__(44); + var helper = __webpack_require__(152); - type: 'scatter', + var BAR_BORDER_WIDTH_QUERY = ['itemStyle', 'normal', 'barBorderWidth']; - init: function () { - this._normalSymbolDraw = new SymbolDraw(); - this._largeSymbolDraw = new LargeSymbolDraw(); - }, + // FIXME + // Just for compatible with ec2. + zrUtil.extend(__webpack_require__(12).prototype, __webpack_require__(153)); + + var BarView = __webpack_require__(1).extendChartView({ + + type: 'bar', render: function (seriesModel, ecModel, api) { - var data = seriesModel.getData(); - var largeSymbolDraw = this._largeSymbolDraw; - var normalSymbolDraw = this._normalSymbolDraw; - var group = this.group; - - var symbolDraw = seriesModel.get('large') && data.count() > seriesModel.get('largeThreshold') - ? largeSymbolDraw : normalSymbolDraw; - - this._symbolDraw = symbolDraw; - symbolDraw.updateData(data); - group.add(symbolDraw.group); - - group.remove( - symbolDraw === largeSymbolDraw - ? normalSymbolDraw.group : largeSymbolDraw.group - ); - }, + var coordinateSystemType = seriesModel.get('coordinateSystem'); - updateLayout: function (seriesModel) { - this._symbolDraw.updateLayout(seriesModel); - }, + if (coordinateSystemType === 'cartesian2d') { + this._renderOnCartesian(seriesModel, ecModel, api); + } - remove: function (ecModel, api) { - this._symbolDraw && this._symbolDraw.remove(api, true); + return this.group; }, - dispose: function () {} - }); - + dispose: zrUtil.noop, -/***/ }, -/* 153 */ -/***/ function(module, exports, __webpack_require__) { + _renderOnCartesian: function (seriesModel, ecModel, api) { + var group = this.group; + var data = seriesModel.getData(); + var oldData = this._data; - // TODO Batch by color + var cartesian = seriesModel.coordinateSystem; + var baseAxis = cartesian.getBaseAxis(); + var isHorizontal = baseAxis.isHorizontal(); + var animationModel = seriesModel.isAnimationEnabled() ? seriesModel : null; + data.diff(oldData) + .add(function (dataIndex) { + if (!data.hasValue(dataIndex)) { + return; + } + var itemModel = data.getItemModel(dataIndex); + var layout = getRectItemLayout(data, dataIndex, itemModel); + var el = createRect(data, dataIndex, itemModel, layout, isHorizontal, animationModel); + data.setItemGraphicEl(dataIndex, el); + group.add(el); - var graphic = __webpack_require__(43); - var symbolUtil = __webpack_require__(107); + updateStyle(el, data, dataIndex, itemModel, layout, seriesModel, isHorizontal); + }) + .update(function (newIndex, oldIndex) { + var el = oldData.getItemGraphicEl(oldIndex); - var LargeSymbolPath = graphic.extendShape({ + if (!data.hasValue(newIndex)) { + group.remove(el); + return; + } - shape: { - points: null, - sizes: null - }, + var itemModel = data.getItemModel(newIndex); + var layout = getRectItemLayout(data, newIndex, itemModel); - symbolProxy: null, + if (el) { + graphic.updateProps(el, {shape: layout}, animationModel, newIndex); + } + else { + el = createRect(data, newIndex, itemModel, layout, isHorizontal, animationModel, true); + } - buildPath: function (path, shape) { - var points = shape.points; - var sizes = shape.sizes; + data.setItemGraphicEl(newIndex, el); + // Add back + group.add(el); - var symbolProxy = this.symbolProxy; - var symbolProxyShape = symbolProxy.shape; - for (var i = 0; i < points.length; i++) { - var pt = points[i]; - var size = sizes[i]; - if (size[0] < 4) { - // Optimize for small symbol - path.rect( - pt[0] - size[0] / 2, pt[1] - size[1] / 2, - size[0], size[1] - ); - } - else { - symbolProxyShape.x = pt[0] - size[0] / 2; - symbolProxyShape.y = pt[1] - size[1] / 2; - symbolProxyShape.width = size[0]; - symbolProxyShape.height = size[1]; + updateStyle(el, data, newIndex, itemModel, layout, seriesModel, isHorizontal); + }) + .remove(function (dataIndex) { + var el = oldData.getItemGraphicEl(dataIndex); + el && removeRect(dataIndex, animationModel, el); + }) + .execute(); - symbolProxy.buildPath(path, symbolProxyShape, true); - } - } + this._data = data; }, - findDataIndex: function (x, y) { - var shape = this.shape; - var points = shape.points; - var sizes = shape.sizes; - - // Not consider transform - // Treat each element as a rect - // top down traverse - for (var i = points.length - 1; i >= 0; i--) { - var pt = points[i]; - var size = sizes[i]; - var x0 = pt[0] - size[0] / 2; - var y0 = pt[1] - size[1] / 2; - if (x >= x0 && y >= y0 && x <= x0 + size[0] && y <= y0 + size[1]) { - // i is dataIndex - return i; + remove: function (ecModel, api) { + var group = this.group; + var data = this._data; + if (ecModel.get('animation')) { + if (data) { + data.eachItemGraphicEl(function (el) { + removeRect(el.dataIndex, ecModel, el); + }); } } - - return -1; + else { + group.removeAll(); + } } }); - function LargeSymbolDraw() { - this.group = new graphic.Group(); + function createRect(data, dataIndex, itemModel, layout, isHorizontal, animationModel, isUpdate) { + var rect = new graphic.Rect({shape: zrUtil.extend({}, layout)}); - this._symbolEl = new LargeSymbolPath({ - // rectHover: true, - // cursor: 'default' + // Animation + if (animationModel) { + var rectShape = rect.shape; + var animateProperty = isHorizontal ? 'height' : 'width'; + var animateTarget = {}; + rectShape[animateProperty] = 0; + animateTarget[animateProperty] = layout[animateProperty]; + graphic[isUpdate ? 'updateProps' : 'initProps'](rect, { + shape: animateTarget + }, animationModel, dataIndex); + } + + return rect; + } + + function removeRect(dataIndex, animationModel, el) { + // Not show text when animating + el.style.text = ''; + graphic.updateProps(el, { + shape: { + width: 0 + } + }, animationModel, dataIndex, function () { + el.parent && el.parent.remove(el); }); } - var largeSymbolProto = LargeSymbolDraw.prototype; + function getRectItemLayout(data, dataIndex, itemModel) { + var layout = data.getItemLayout(dataIndex); + var fixedLineWidth = getLineWidth(itemModel, layout); - /** - * Update symbols draw by new data - * @param {module:echarts/data/List} data - */ - largeSymbolProto.updateData = function (data) { - this.group.removeAll(); + // fix layout with lineWidth + var signX = layout.width > 0 ? 1 : -1; + var signY = layout.height > 0 ? 1 : -1; + return { + x: layout.x + signX * fixedLineWidth / 2, + y: layout.y + signY * fixedLineWidth / 2, + width: layout.width - signX * fixedLineWidth, + height: layout.height - signY * fixedLineWidth + }; + } - var symbolEl = this._symbolEl; + function updateStyle(el, data, dataIndex, itemModel, layout, seriesModel, isHorizontal) { + var color = data.getItemVisual(dataIndex, 'color'); + var opacity = data.getItemVisual(dataIndex, 'opacity'); + var itemStyleModel = itemModel.getModel('itemStyle.normal'); + var hoverStyle = itemModel.getModel('itemStyle.emphasis').getBarItemStyle(); - var seriesModel = data.hostModel; + el.setShape('r', itemStyleModel.get('barBorderRadius') || 0); - symbolEl.setShape({ - points: data.mapArray(data.getItemLayout), - sizes: data.mapArray( - function (idx) { - var size = data.getItemVisual(idx, 'symbolSize'); - if (!(size instanceof Array)) { - size = [size, size]; - } - return size; - } - ) - }); + el.useStyle(zrUtil.defaults( + { + fill: color, + opacity: opacity + }, + itemStyleModel.getBarItemStyle() + )); - // Create symbolProxy to build path for each data - symbolEl.symbolProxy = symbolUtil.createSymbol( - data.getVisual('symbol'), 0, 0, 0, 0 - ); - // Use symbolProxy setColor method - symbolEl.setColor = symbolEl.symbolProxy.setColor; + var labelPositionOutside = isHorizontal + ? (layout.height > 0 ? 'bottom' : 'top') + : (layout.width > 0 ? 'left' : 'right'); - symbolEl.useStyle( - seriesModel.getModel('itemStyle.normal').getItemStyle(['color']) + helper.setLabel( + el.style, hoverStyle, itemModel, color, + seriesModel, dataIndex, labelPositionOutside ); - var visualColor = data.getVisual('color'); - if (visualColor) { - symbolEl.setColor(visualColor); - } - - // Enable tooltip - // PENDING May have performance issue when path is extremely large - symbolEl.seriesIndex = seriesModel.seriesIndex; - symbolEl.on('mousemove', function (e) { - symbolEl.dataIndex = null; - var dataIndex = symbolEl.findDataIndex(e.offsetX, e.offsetY); - if (dataIndex > 0) { - // Provide dataIndex for tooltip - symbolEl.dataIndex = dataIndex; - } - }); - - // Add back - this.group.add(symbolEl); - }; - - largeSymbolProto.updateLayout = function (seriesModel) { - var data = seriesModel.getData(); - this._symbolEl.setShape({ - points: data.mapArray(data.getItemLayout) - }); - }; + graphic.setHoverStyle(el, hoverStyle); + } - largeSymbolProto.remove = function () { - this.group.removeAll(); - }; + // In case width or height are too small. + function getLineWidth(itemModel, rawLayout) { + var lineWidth = itemModel.get(BAR_BORDER_WIDTH_QUERY) || 0; + return Math.min(lineWidth, Math.abs(rawLayout.width), Math.abs(rawLayout.height)); + } - module.exports = LargeSymbolDraw; + module.exports = BarView; /***/ }, -/* 154 */ +/* 152 */ /***/ function(module, exports, __webpack_require__) { var zrUtil = __webpack_require__(4); - var echarts = __webpack_require__(1); + var graphic = __webpack_require__(44); - // Must use radar component - __webpack_require__(155); + var helper = {}; - __webpack_require__(160); - __webpack_require__(161); + helper.setLabel = function ( + normalStyle, hoverStyle, itemModel, color, seriesModel, dataIndex, labelPositionOutside + ) { + var labelModel = itemModel.getModel('label.normal'); + var hoverLabelModel = itemModel.getModel('label.emphasis'); - echarts.registerVisual(zrUtil.curry(__webpack_require__(146), 'radar')); - echarts.registerVisual(zrUtil.curry( - __webpack_require__(110), 'radar', 'circle', null - )); - echarts.registerLayout(__webpack_require__(162)); + if (labelModel.get('show')) { + setLabel( + normalStyle, labelModel, color, + zrUtil.retrieve( + seriesModel.getFormattedLabel(dataIndex, 'normal'), + seriesModel.getRawValue(dataIndex) + ), + labelPositionOutside + ); + } + else { + normalStyle.text = ''; + } - echarts.registerProcessor( - zrUtil.curry(__webpack_require__(149), 'radar') - ); + if (hoverLabelModel.get('show')) { + setLabel( + hoverStyle, hoverLabelModel, color, + zrUtil.retrieve( + seriesModel.getFormattedLabel(dataIndex, 'emphasis'), + seriesModel.getRawValue(dataIndex) + ), + labelPositionOutside + ); + } + else { + hoverStyle.text = ''; + } + }; + + function setLabel(style, model, color, labelText, labelPositionOutside) { + graphic.setText(style, model, color); + style.text = labelText; + if (style.textPosition === 'outside') { + style.textPosition = labelPositionOutside; + } + } - echarts.registerPreprocessor(__webpack_require__(163)); + module.exports = helper; /***/ }, -/* 155 */ +/* 153 */ /***/ function(module, exports, __webpack_require__) { - __webpack_require__(156); - __webpack_require__(158); - __webpack_require__(159); + var getBarItemStyle = __webpack_require__(15)( + [ + ['fill', 'color'], + ['stroke', 'borderColor'], + ['lineWidth', 'borderWidth'], + // Compatitable with 2 + ['stroke', 'barBorderColor'], + ['lineWidth', 'barBorderWidth'], + ['opacity'], + ['shadowBlur'], + ['shadowOffsetX'], + ['shadowOffsetY'], + ['shadowColor'] + ] + ); + module.exports = { + getBarItemStyle: function (excludes) { + var style = getBarItemStyle.call(this, excludes); + if (this.getBorderLineDash) { + var lineDash = this.getBorderLineDash(); + lineDash && (style.lineDash = lineDash); + } + return style; + } + }; /***/ }, -/* 156 */ +/* 154 */ /***/ function(module, exports, __webpack_require__) { - // TODO clockwise + 'use strict'; var zrUtil = __webpack_require__(4); - var IndicatorAxis = __webpack_require__(157); - var IntervalScale = __webpack_require__(118); var numberUtil = __webpack_require__(7); - var axisHelper = __webpack_require__(115); - - function Radar(radarModel, ecModel, api) { + var parsePercent = numberUtil.parsePercent; - this._model = radarModel; - /** - * Radar dimensions - * @type {Array.} - */ - this.dimensions = []; + function getSeriesStackId(seriesModel) { + return seriesModel.get('stack') || '__ec_stack_' + seriesModel.seriesIndex; + } - this._indicatorAxes = zrUtil.map(radarModel.getIndicatorModels(), function (indicatorModel, idx) { - var dim = 'indicator_' + idx; - var indicatorAxis = new IndicatorAxis(dim, new IntervalScale()); - indicatorAxis.name = indicatorModel.get('name'); - // Inject model and axis - indicatorAxis.model = indicatorModel; - indicatorModel.axis = indicatorAxis; - this.dimensions.push(dim); - return indicatorAxis; - }, this); + function getAxisKey(axis) { + return axis.dim + axis.index; + } - this.resize(radarModel, api); + function calBarWidthAndOffset(barSeries, api) { + // Columns info on each category axis. Key is cartesian name + var columnsMap = {}; - /** - * @type {number} - * @readOnly - */ - this.cx; - /** - * @type {number} - * @readOnly - */ - this.cy; - /** - * @type {number} - * @readOnly - */ - this.r; - /** - * @type {number} - * @readOnly - */ - this.startAngle; - } + zrUtil.each(barSeries, function (seriesModel, idx) { + var data = seriesModel.getData(); + var cartesian = seriesModel.coordinateSystem; - Radar.prototype.getIndicatorAxes = function () { - return this._indicatorAxes; - }; + var baseAxis = cartesian.getBaseAxis(); + var axisExtent = baseAxis.getExtent(); + var bandWidth = baseAxis.type === 'category' + ? baseAxis.getBandWidth() + : (Math.abs(axisExtent[1] - axisExtent[0]) / data.count()); - Radar.prototype.dataToPoint = function (value, indicatorIndex) { - var indicatorAxis = this._indicatorAxes[indicatorIndex]; + var columnsOnAxis = columnsMap[getAxisKey(baseAxis)] || { + bandWidth: bandWidth, + remainedWidth: bandWidth, + autoWidthCount: 0, + categoryGap: '20%', + gap: '30%', + stacks: {} + }; + var stacks = columnsOnAxis.stacks; + columnsMap[getAxisKey(baseAxis)] = columnsOnAxis; - return this.coordToPoint(indicatorAxis.dataToCoord(value), indicatorIndex); - }; + var stackId = getSeriesStackId(seriesModel); - Radar.prototype.coordToPoint = function (coord, indicatorIndex) { - var indicatorAxis = this._indicatorAxes[indicatorIndex]; - var angle = indicatorAxis.angle; - var x = this.cx + coord * Math.cos(angle); - var y = this.cy - coord * Math.sin(angle); - return [x, y]; - }; + if (!stacks[stackId]) { + columnsOnAxis.autoWidthCount++; + } + stacks[stackId] = stacks[stackId] || { + width: 0, + maxWidth: 0 + }; - Radar.prototype.pointToData = function (pt) { - var dx = pt[0] - this.cx; - var dy = pt[1] - this.cy; - var radius = Math.sqrt(dx * dx + dy * dy); - dx /= radius; - dy /= radius; + var barWidth = parsePercent( + seriesModel.get('barWidth'), bandWidth + ); + var barMaxWidth = parsePercent( + seriesModel.get('barMaxWidth'), bandWidth + ); + var barGap = seriesModel.get('barGap'); + var barCategoryGap = seriesModel.get('barCategoryGap'); - var radian = Math.atan2(-dy, dx); + // Caution: In a single coordinate system, these barGrid attributes + // will be shared by series. Consider that they have default values, + // only the attributes set on the last series will work. + // Do not change this fact unless there will be a break change. - // Find the closest angle - // FIXME index can calculated directly - var minRadianDiff = Infinity; - var closestAxis; - var closestAxisIdx = -1; - for (var i = 0; i < this._indicatorAxes.length; i++) { - var indicatorAxis = this._indicatorAxes[i]; - var diff = Math.abs(radian - indicatorAxis.angle); - if (diff < minRadianDiff) { - closestAxis = indicatorAxis; - closestAxisIdx = i; - minRadianDiff = diff; + // TODO + if (barWidth && !stacks[stackId].width) { + barWidth = Math.min(columnsOnAxis.remainedWidth, barWidth); + stacks[stackId].width = barWidth; + columnsOnAxis.remainedWidth -= barWidth; } - } - return [closestAxisIdx, +(closestAxis && closestAxis.coodToData(radius))]; - }; + barMaxWidth && (stacks[stackId].maxWidth = barMaxWidth); + (barGap != null) && (columnsOnAxis.gap = barGap); + (barCategoryGap != null) && (columnsOnAxis.categoryGap = barCategoryGap); + }); - Radar.prototype.resize = function (radarModel, api) { - var center = radarModel.get('center'); - var viewWidth = api.getWidth(); - var viewHeight = api.getHeight(); - var viewSize = Math.min(viewWidth, viewHeight) / 2; - this.cx = numberUtil.parsePercent(center[0], viewWidth); - this.cy = numberUtil.parsePercent(center[1], viewHeight); + var result = {}; - this.startAngle = radarModel.get('startAngle') * Math.PI / 180; + zrUtil.each(columnsMap, function (columnsOnAxis, coordSysName) { - this.r = numberUtil.parsePercent(radarModel.get('radius'), viewSize); + result[coordSysName] = {}; - zrUtil.each(this._indicatorAxes, function (indicatorAxis, idx) { - indicatorAxis.setExtent(0, this.r); - var angle = (this.startAngle + idx * Math.PI * 2 / this._indicatorAxes.length); - // Normalize to [-PI, PI] - angle = Math.atan2(Math.sin(angle), Math.cos(angle)); - indicatorAxis.angle = angle; - }, this); - }; + var stacks = columnsOnAxis.stacks; + var bandWidth = columnsOnAxis.bandWidth; + var categoryGap = parsePercent(columnsOnAxis.categoryGap, bandWidth); + var barGapPercent = parsePercent(columnsOnAxis.gap, 1); - Radar.prototype.update = function (ecModel, api) { - var indicatorAxes = this._indicatorAxes; - var radarModel = this._model; - zrUtil.each(indicatorAxes, function (indicatorAxis) { - indicatorAxis.scale.setExtent(Infinity, -Infinity); - }); - ecModel.eachSeriesByType('radar', function (radarSeries, idx) { - if (radarSeries.get('coordinateSystem') !== 'radar' - || ecModel.getComponent('radar', radarSeries.get('radarIndex')) !== radarModel - ) { - return; - } - var data = radarSeries.getData(); - zrUtil.each(indicatorAxes, function (indicatorAxis) { - indicatorAxis.scale.unionExtentFromData(data, indicatorAxis.dim); + var remainedWidth = columnsOnAxis.remainedWidth; + var autoWidthCount = columnsOnAxis.autoWidthCount; + var autoWidth = (remainedWidth - categoryGap) + / (autoWidthCount + (autoWidthCount - 1) * barGapPercent); + autoWidth = Math.max(autoWidth, 0); + + // Find if any auto calculated bar exceeded maxBarWidth + zrUtil.each(stacks, function (column, stack) { + var maxWidth = column.maxWidth; + if (!column.width && maxWidth && maxWidth < autoWidth) { + maxWidth = Math.min(maxWidth, remainedWidth); + remainedWidth -= maxWidth; + column.width = maxWidth; + autoWidthCount--; + } }); - }, this); - var splitNumber = radarModel.get('splitNumber'); + // Recalculate width again + autoWidth = (remainedWidth - categoryGap) + / (autoWidthCount + (autoWidthCount - 1) * barGapPercent); + autoWidth = Math.max(autoWidth, 0); - function increaseInterval(interval) { - var exp10 = Math.pow(10, Math.floor(Math.log(interval) / Math.LN10)); - // Increase interval - var f = interval / exp10; - if (f === 2) { - f = 5; - } - else { // f is 2 or 5 - f *= 2; + var widthSum = 0; + var lastColumn; + zrUtil.each(stacks, function (column, idx) { + if (!column.width) { + column.width = autoWidth; + } + lastColumn = column; + widthSum += column.width * (1 + barGapPercent); + }); + if (lastColumn) { + widthSum -= lastColumn.width * barGapPercent; } - return f * exp10; - } - // Force all the axis fixing the maxSplitNumber. - zrUtil.each(indicatorAxes, function (indicatorAxis, idx) { - var rawExtent = axisHelper.getScaleExtent(indicatorAxis, indicatorAxis.model); - axisHelper.niceScaleExtent(indicatorAxis, indicatorAxis.model); - - var axisModel = indicatorAxis.model; - var scale = indicatorAxis.scale; - var fixedMin = axisModel.getMin(); - var fixedMax = axisModel.getMax(); - var interval = scale.getInterval(); - if (fixedMin != null && fixedMax != null) { - // User set min, max, divide to get new interval - // FIXME precision - scale.setInterval( - (fixedMax - fixedMin) / splitNumber - ); - } - else if (fixedMin != null) { - var max; - // User set min, expand extent on the other side - do { - max = fixedMin + interval * splitNumber; - scale.setExtent(+fixedMin, max); - // Interval must been set after extent - // FIXME - scale.setInterval(interval); + var offset = -widthSum / 2; + zrUtil.each(stacks, function (column, stackId) { + result[coordSysName][stackId] = result[coordSysName][stackId] || { + offset: offset, + width: column.width + }; - interval = increaseInterval(interval); - } while (max < rawExtent[1] && isFinite(max) && isFinite(rawExtent[1])); - } - else if (fixedMax != null) { - var min; - // User set min, expand extent on the other side - do { - min = fixedMax - interval * splitNumber; - scale.setExtent(min, +fixedMax); - scale.setInterval(interval); - interval = increaseInterval(interval); - } while (min > rawExtent[0] && isFinite(min) && isFinite(rawExtent[0])); - } - else { - var nicedSplitNumber = scale.getTicks().length - 1; - if (nicedSplitNumber > splitNumber) { - interval = increaseInterval(interval); - } - // PENDING - var center = Math.round((rawExtent[0] + rawExtent[1]) / 2 / interval) * interval; - var halfSplitNumber = Math.round(splitNumber / 2); - scale.setExtent( - numberUtil.round(center - halfSplitNumber * interval), - numberUtil.round(center + (splitNumber - halfSplitNumber) * interval) - ); - scale.setInterval(interval); - } + offset += column.width * (1 + barGapPercent); + }); }); - }; + + return result; + } /** - * Radar dimensions is based on the data - * @type {Array} + * @param {string} seriesType + * @param {module:echarts/model/Global} ecModel + * @param {module:echarts/ExtensionAPI} api */ - Radar.dimensions = []; + function barLayoutGrid(seriesType, ecModel, api) { - Radar.create = function (ecModel, api) { - var radarList = []; - ecModel.eachComponent('radar', function (radarModel) { - var radar = new Radar(radarModel, ecModel, api); - radarList.push(radar); - radarModel.coordinateSystem = radar; - }); - ecModel.eachSeriesByType('radar', function (radarSeries) { - if (radarSeries.get('coordinateSystem') === 'radar') { - // Inject coordinate system - radarSeries.coordinateSystem = radarList[radarSeries.get('radarIndex') || 0]; - } - }); - return radarList; - }; + var barWidthAndOffset = calBarWidthAndOffset( + zrUtil.filter( + ecModel.getSeriesByType(seriesType), + function (seriesModel) { + return !ecModel.isSeriesFiltered(seriesModel) + && seriesModel.coordinateSystem + && seriesModel.coordinateSystem.type === 'cartesian2d'; + } + ) + ); - __webpack_require__(26).register('radar', Radar); - module.exports = Radar; + var lastStackCoords = {}; + var lastStackCoordsOrigin = {}; + ecModel.eachSeriesByType(seriesType, function (seriesModel) { -/***/ }, -/* 157 */ -/***/ function(module, exports, __webpack_require__) { + var data = seriesModel.getData(); + var cartesian = seriesModel.coordinateSystem; + var baseAxis = cartesian.getBaseAxis(); - + var stackId = getSeriesStackId(seriesModel); + var columnLayoutInfo = barWidthAndOffset[getAxisKey(baseAxis)][stackId]; + var columnOffset = columnLayoutInfo.offset; + var columnWidth = columnLayoutInfo.width; + var valueAxis = cartesian.getOtherAxis(baseAxis); - var zrUtil = __webpack_require__(4); - var Axis = __webpack_require__(124); + var barMinHeight = seriesModel.get('barMinHeight') || 0; - function IndicatorAxis(dim, scale, radiusExtent) { - Axis.call(this, dim, scale, radiusExtent); + var valueAxisStart = baseAxis.onZero + ? valueAxis.toGlobalCoord(valueAxis.dataToCoord(0)) + : valueAxis.getGlobalExtent()[0]; - /** - * Axis type - * - 'category' - * - 'value' - * - 'time' - * - 'log' - * @type {string} - */ - this.type = 'value'; + var coords = cartesian.dataToPoints(data, true); + lastStackCoords[stackId] = lastStackCoords[stackId] || []; + lastStackCoordsOrigin[stackId] = lastStackCoordsOrigin[stackId] || []; // Fix #4243 - this.angle = 0; + data.setLayout({ + offset: columnOffset, + size: columnWidth + }); - /** - * Indicator name - * @type {string} - */ - this.name = ''; - /** - * @type {module:echarts/model/Model} - */ - this.model; - } + data.each(valueAxis.dim, function (value, idx) { + if (isNaN(value)) { + return; + } - zrUtil.inherits(IndicatorAxis, Axis); + if (!lastStackCoords[stackId][idx]) { + lastStackCoords[stackId][idx] = { + p: valueAxisStart, // Positive stack + n: valueAxisStart // Negative stack + }; + lastStackCoordsOrigin[stackId][idx] = { + p: valueAxisStart, // Positive stack + n: valueAxisStart // Negative stack + }; + } + var sign = value >= 0 ? 'p' : 'n'; + var coord = coords[idx]; + var lastCoord = lastStackCoords[stackId][idx][sign]; + var lastCoordOrigin = lastStackCoordsOrigin[stackId][idx][sign]; + var x; + var y; + var width; + var height; - module.exports = IndicatorAxis; + if (valueAxis.isHorizontal()) { + x = lastCoord; + y = coord[1] + columnOffset; + width = coord[0] - lastCoordOrigin; + height = columnWidth; + + lastStackCoordsOrigin[stackId][idx][sign] += width; + if (Math.abs(width) < barMinHeight) { + width = (width < 0 ? -1 : 1) * barMinHeight; + } + lastStackCoords[stackId][idx][sign] += width; + } + else { + x = coord[0] + columnOffset; + y = lastCoord; + width = columnWidth; + height = coord[1] - lastCoordOrigin; + + lastStackCoordsOrigin[stackId][idx][sign] += height; + if (Math.abs(height) < barMinHeight) { + // Include zero to has a positive bar + height = (height <= 0 ? -1 : 1) * barMinHeight; + } + lastStackCoords[stackId][idx][sign] += height; + } + + data.setItemLayout(idx, { + x: x, + y: y, + width: width, + height: height + }); + }, true); + + }, this); + } + + module.exports = barLayoutGrid; /***/ }, -/* 158 */ +/* 155 */ /***/ function(module, exports, __webpack_require__) { - - var axisDefault = __webpack_require__(129); - var valueAxisDefault = axisDefault.valueAxis; - var Model = __webpack_require__(12); var zrUtil = __webpack_require__(4); + var echarts = __webpack_require__(1); - var axisModelCommonMixin = __webpack_require__(130); + __webpack_require__(156); + __webpack_require__(158); - function defaultsShow(opt, show) { - return zrUtil.defaults({ - show: show - }, opt); - } + __webpack_require__(159)('pie', [{ + type: 'pieToggleSelect', + event: 'pieselectchanged', + method: 'toggleSelected' + }, { + type: 'pieSelect', + event: 'pieselected', + method: 'select' + }, { + type: 'pieUnSelect', + event: 'pieunselected', + method: 'unSelect' + }]); - var RadarModel = __webpack_require__(1).extendComponentModel({ + echarts.registerVisual(zrUtil.curry(__webpack_require__(160), 'pie')); - type: 'radar', + echarts.registerLayout(zrUtil.curry( + __webpack_require__(161), 'pie' + )); - optionUpdated: function () { - var boundaryGap = this.get('boundaryGap'); - var splitNumber = this.get('splitNumber'); - var scale = this.get('scale'); - var axisLine = this.get('axisLine'); - var axisTick = this.get('axisTick'); - var axisLabel = this.get('axisLabel'); - var nameTextStyle = this.get('name.textStyle'); - var showName = this.get('name.show'); - var nameFormatter = this.get('name.formatter'); - var nameGap = this.get('nameGap'); - var triggerEvent = this.get('triggerEvent'); + echarts.registerProcessor(zrUtil.curry(__webpack_require__(163), 'pie')); - var indicatorModels = zrUtil.map(this.get('indicator') || [], function (indicatorOpt) { - // PENDING - if (indicatorOpt.max != null && indicatorOpt.max > 0 && !indicatorOpt.min) { - indicatorOpt.min = 0; - } - else if (indicatorOpt.min != null && indicatorOpt.min < 0 && !indicatorOpt.max) { - indicatorOpt.max = 0; - } - // Use same configuration - indicatorOpt = zrUtil.merge(zrUtil.clone(indicatorOpt), { - boundaryGap: boundaryGap, - splitNumber: splitNumber, - scale: scale, - axisLine: axisLine, - axisTick: axisTick, - axisLabel: axisLabel, - // Competitable with 2 and use text - name: indicatorOpt.text, - nameLocation: 'end', - nameGap: nameGap, - // min: 0, - nameTextStyle: nameTextStyle, - triggerEvent: triggerEvent - }, false); - if (!showName) { - indicatorOpt.name = ''; - } - if (typeof nameFormatter === 'string') { - var indName = indicatorOpt.name; - indicatorOpt.name = nameFormatter.replace('{value}', indName != null ? indName : ''); - } - else if (typeof nameFormatter === 'function') { - indicatorOpt.name = nameFormatter( - indicatorOpt.name, indicatorOpt - ); - } - var model = zrUtil.extend( - new Model(indicatorOpt, null, this.ecModel), - axisModelCommonMixin - ); - // For triggerEvent. - model.mainType = 'radar'; - model.componentIndex = this.componentIndex; +/***/ }, +/* 156 */ +/***/ function(module, exports, __webpack_require__) { - return model; - }, this); + 'use strict'; - this.getIndicatorModels = function () { - return indicatorModels; + + var List = __webpack_require__(98); + var zrUtil = __webpack_require__(4); + var modelUtil = __webpack_require__(5); + var completeDimensions = __webpack_require__(103); + + var dataSelectableMixin = __webpack_require__(157); + + var PieSeries = __webpack_require__(1).extendSeriesModel({ + + type: 'series.pie', + + // Overwrite + init: function (option) { + PieSeries.superApply(this, 'init', arguments); + + // Enable legend selection for each data item + // Use a function instead of direct access because data reference may changed + this.legendDataProvider = function () { + return this.getRawData(); }; - }, - defaultOption: { + this.updateSelectedMap(option.data); - zlevel: 0, + this._defaultLabelLine(option); + }, - z: 0, + // Overwrite + mergeOption: function (newOption) { + PieSeries.superCall(this, 'mergeOption', newOption); + this.updateSelectedMap(this.option.data); + }, - center: ['50%', '50%'], + getInitialData: function (option, ecModel) { + var dimensions = completeDimensions(['value'], option.data); + var list = new List(dimensions, this); + list.initData(option.data); + return list; + }, - radius: '75%', + // Overwrite + getDataParams: function (dataIndex) { + var data = this.getData(); + var params = PieSeries.superCall(this, 'getDataParams', dataIndex); + var sum = data.getSum('value'); + // FIXME toFixed? + // + // Percent is 0 if sum is 0 + params.percent = !sum ? 0 : +(data.get('value', dataIndex) / sum * 100).toFixed(2); - startAngle: 90, + params.$vars.push('percent'); + return params; + }, - name: { - show: true - // formatter: null - // textStyle: {} - }, + _defaultLabelLine: function (option) { + // Extend labelLine emphasis + modelUtil.defaultEmphasis(option.labelLine, ['show']); - boundaryGap: [0, 0], + var labelLineNormalOpt = option.labelLine.normal; + var labelLineEmphasisOpt = option.labelLine.emphasis; + // Not show label line if `label.normal.show = false` + labelLineNormalOpt.show = labelLineNormalOpt.show + && option.label.normal.show; + labelLineEmphasisOpt.show = labelLineEmphasisOpt.show + && option.label.emphasis.show; + }, - splitNumber: 5, + defaultOption: { + zlevel: 0, + z: 2, + legendHoverLink: true, - nameGap: 15, + hoverAnimation: true, + // 默认全局居中 + center: ['50%', '50%'], + radius: [0, '75%'], + // 默认顺时针 + clockwise: true, + startAngle: 90, + // 最小角度改为0 + minAngle: 0, + // 选中是扇区偏移量 + selectedOffset: 10, - scale: false, + // If use strategy to avoid label overlapping + avoidLabelOverlap: true, + // 选择模式,默认关闭,可选single,multiple + // selectedMode: false, + // 南丁格尔玫瑰图模式,'radius'(半径) | 'area'(面积) + // roseType: null, - // Polygon or circle - shape: 'polygon', + // If still show when all data zero. + stillShowZeroSum: true, - axisLine: zrUtil.merge( - { + label: { + normal: { + // If rotate around circle + rotate: false, + show: true, + // 'outer', 'inside', 'center' + position: 'outer' + // formatter: 标签文本格式器,同Tooltip.formatter,不支持异步回调 + // textStyle: null // 默认使用全局文本样式,详见TEXTSTYLE + // distance: 当position为inner时有效,为label位置到圆心的距离与圆半径(环状图为内外半径和)的比例系数 + }, + emphasis: {} + }, + // Enabled when label.normal.position is 'outer' + labelLine: { + normal: { + show: true, + // 引导线两段中的第一段长度 + length: 15, + // 引导线两段中的第二段长度 + length2: 15, + smooth: false, lineStyle: { - color: '#bbb' + // color: 各异, + width: 1, + type: 'solid' } + } + }, + itemStyle: { + normal: { + borderWidth: 1 }, - valueAxisDefault.axisLine - ), - axisLabel: defaultsShow(valueAxisDefault.axisLabel, false), - axisTick: defaultsShow(valueAxisDefault.axisTick, false), - splitLine: defaultsShow(valueAxisDefault.splitLine, true), - splitArea: defaultsShow(valueAxisDefault.splitArea, true), + emphasis: {} + }, - // {text, min, max} - indicator: [] + // Animation type canbe expansion, scale + animationType: 'expansion', + + animationEasing: 'cubicOut', + + data: [] } }); - module.exports = RadarModel; + zrUtil.mixin(PieSeries, dataSelectableMixin); + + module.exports = PieSeries; /***/ }, -/* 159 */ +/* 157 */ /***/ function(module, exports, __webpack_require__) { - - - var AxisBuilder = __webpack_require__(133); - var zrUtil = __webpack_require__(4); - var graphic = __webpack_require__(43); - - var axisBuilderAttrs = [ + /** + * Data selectable mixin for chart series. + * To eanble data select, option of series must have `selectedMode`. + * And each data item will use `selected` to toggle itself selected status + * + * @module echarts/chart/helper/DataSelectable + */ + + + var zrUtil = __webpack_require__(4); + + module.exports = { + + updateSelectedMap: function (targetList) { + this._selectTargetMap = zrUtil.reduce(targetList || [], function (targetMap, target) { + targetMap[target.name] = target; + return targetMap; + }, {}); + }, + /** + * @param {string} name + */ + // PENGING If selectedMode is null ? + select: function (name) { + var targetMap = this._selectTargetMap; + var target = targetMap[name]; + var selectedMode = this.get('selectedMode'); + if (selectedMode === 'single') { + zrUtil.each(targetMap, function (target) { + target.selected = false; + }); + } + target && (target.selected = true); + }, + + /** + * @param {string} name + */ + unSelect: function (name) { + var target = this._selectTargetMap[name]; + // var selectedMode = this.get('selectedMode'); + // selectedMode !== 'single' && target && (target.selected = false); + target && (target.selected = false); + }, + + /** + * @param {string} name + */ + toggleSelected: function (name) { + var target = this._selectTargetMap[name]; + if (target != null) { + this[target.selected ? 'unSelect' : 'select'](name); + return target.selected; + } + }, + + /** + * @param {string} name + */ + isSelected: function (name) { + var target = this._selectTargetMap[name]; + return target && target.selected; + } + }; + + +/***/ }, +/* 158 */ +/***/ function(module, exports, __webpack_require__) { + + + + var graphic = __webpack_require__(44); + var zrUtil = __webpack_require__(4); + + /** + * @param {module:echarts/model/Series} seriesModel + * @param {boolean} hasAnimation + * @inner + */ + function updateDataSelected(uid, seriesModel, hasAnimation, api) { + var data = seriesModel.getData(); + var dataIndex = this.dataIndex; + var name = data.getName(dataIndex); + var selectedOffset = seriesModel.get('selectedOffset'); + + api.dispatchAction({ + type: 'pieToggleSelect', + from: uid, + name: name, + seriesId: seriesModel.id + }); + + data.each(function (idx) { + toggleItemSelected( + data.getItemGraphicEl(idx), + data.getItemLayout(idx), + seriesModel.isSelected(data.getName(idx)), + selectedOffset, + hasAnimation + ); + }); + } + + /** + * @param {module:zrender/graphic/Sector} el + * @param {Object} layout + * @param {boolean} isSelected + * @param {number} selectedOffset + * @param {boolean} hasAnimation + * @inner + */ + function toggleItemSelected(el, layout, isSelected, selectedOffset, hasAnimation) { + var midAngle = (layout.startAngle + layout.endAngle) / 2; + + var dx = Math.cos(midAngle); + var dy = Math.sin(midAngle); + + var offset = isSelected ? selectedOffset : 0; + var position = [dx * offset, dy * offset]; + + hasAnimation + // animateTo will stop revious animation like update transition + ? el.animate() + .when(200, { + position: position + }) + .start('bounceOut') + : el.attr('position', position); + } + + /** + * Piece of pie including Sector, Label, LabelLine + * @constructor + * @extends {module:zrender/graphic/Group} + */ + function PiePiece(data, idx) { + + graphic.Group.call(this); + + var sector = new graphic.Sector({ + z2: 2 + }); + var polyline = new graphic.Polyline(); + var text = new graphic.Text(); + this.add(sector); + this.add(polyline); + this.add(text); + + this.updateData(data, idx, true); + + // Hover to change label and labelLine + function onEmphasis() { + polyline.ignore = polyline.hoverIgnore; + text.ignore = text.hoverIgnore; + } + function onNormal() { + polyline.ignore = polyline.normalIgnore; + text.ignore = text.normalIgnore; + } + this.on('emphasis', onEmphasis) + .on('normal', onNormal) + .on('mouseover', onEmphasis) + .on('mouseout', onNormal); + } + + var piePieceProto = PiePiece.prototype; + + function getLabelStyle(data, idx, state, labelModel, labelPosition) { + var textStyleModel = labelModel.getModel('textStyle'); + var isLabelInside = labelPosition === 'inside' || labelPosition === 'inner'; + return { + fill: textStyleModel.getTextColor() + || (isLabelInside ? '#fff' : data.getItemVisual(idx, 'color')), + opacity: data.getItemVisual(idx, 'opacity'), + textFont: textStyleModel.getFont(), + text: zrUtil.retrieve( + data.hostModel.getFormattedLabel(idx, state), data.getName(idx) + ) + }; + } + + piePieceProto.updateData = function (data, idx, firstCreate) { + + var sector = this.childAt(0); + + var seriesModel = data.hostModel; + var itemModel = data.getItemModel(idx); + var layout = data.getItemLayout(idx); + var sectorShape = zrUtil.extend({}, layout); + sectorShape.label = null; + + if (firstCreate) { + sector.setShape(sectorShape); + + var animationType = seriesModel.getShallow('animationType'); + if (animationType === 'scale') { + sector.shape.r = layout.r0; + graphic.initProps(sector, { + shape: { + r: layout.r + } + }, seriesModel, idx); + } + // Expansion + else { + sector.shape.endAngle = layout.startAngle; + graphic.updateProps(sector, { + shape: { + endAngle: layout.endAngle + } + }, seriesModel, idx); + } + + } + else { + graphic.updateProps(sector, { + shape: sectorShape + }, seriesModel, idx); + } + + // Update common style + var itemStyleModel = itemModel.getModel('itemStyle'); + var visualColor = data.getItemVisual(idx, 'color'); + + sector.useStyle( + zrUtil.defaults( + { + lineJoin: 'bevel', + fill: visualColor + }, + itemStyleModel.getModel('normal').getItemStyle() + ) + ); + sector.hoverStyle = itemStyleModel.getModel('emphasis').getItemStyle(); + + // Toggle selected + toggleItemSelected( + this, + data.getItemLayout(idx), + itemModel.get('selected'), + seriesModel.get('selectedOffset'), + seriesModel.get('animation') + ); + + function onEmphasis() { + // Sector may has animation of updating data. Force to move to the last frame + // Or it may stopped on the wrong shape + sector.stopAnimation(true); + sector.animateTo({ + shape: { + r: layout.r + 10 + } + }, 300, 'elasticOut'); + } + function onNormal() { + sector.stopAnimation(true); + sector.animateTo({ + shape: { + r: layout.r + } + }, 300, 'elasticOut'); + } + sector.off('mouseover').off('mouseout').off('emphasis').off('normal'); + if (itemModel.get('hoverAnimation') && seriesModel.isAnimationEnabled()) { + sector + .on('mouseover', onEmphasis) + .on('mouseout', onNormal) + .on('emphasis', onEmphasis) + .on('normal', onNormal); + } + + this._updateLabel(data, idx); + + graphic.setHoverStyle(this); + }; + + piePieceProto._updateLabel = function (data, idx) { + + var labelLine = this.childAt(1); + var labelText = this.childAt(2); + + var seriesModel = data.hostModel; + var itemModel = data.getItemModel(idx); + var layout = data.getItemLayout(idx); + var labelLayout = layout.label; + var visualColor = data.getItemVisual(idx, 'color'); + + graphic.updateProps(labelLine, { + shape: { + points: labelLayout.linePoints || [ + [labelLayout.x, labelLayout.y], [labelLayout.x, labelLayout.y], [labelLayout.x, labelLayout.y] + ] + } + }, seriesModel, idx); + + graphic.updateProps(labelText, { + style: { + x: labelLayout.x, + y: labelLayout.y + } + }, seriesModel, idx); + labelText.attr({ + style: { + textVerticalAlign: labelLayout.verticalAlign, + textAlign: labelLayout.textAlign, + textFont: labelLayout.font + }, + rotation: labelLayout.rotation, + origin: [labelLayout.x, labelLayout.y], + z2: 10 + }); + + var labelModel = itemModel.getModel('label.normal'); + var labelHoverModel = itemModel.getModel('label.emphasis'); + var labelLineModel = itemModel.getModel('labelLine.normal'); + var labelLineHoverModel = itemModel.getModel('labelLine.emphasis'); + var labelPosition = labelModel.get('position') || labelHoverModel.get('position'); + + labelText.setStyle(getLabelStyle(data, idx, 'normal', labelModel, labelPosition)); + + labelText.ignore = labelText.normalIgnore = !labelModel.get('show'); + labelText.hoverIgnore = !labelHoverModel.get('show'); + + labelLine.ignore = labelLine.normalIgnore = !labelLineModel.get('show'); + labelLine.hoverIgnore = !labelLineHoverModel.get('show'); + + // Default use item visual color + labelLine.setStyle({ + stroke: visualColor, + opacity: data.getItemVisual(idx, 'opacity') + }); + labelLine.setStyle(labelLineModel.getModel('lineStyle').getLineStyle()); + + labelText.hoverStyle = getLabelStyle(data, idx, 'emphasis', labelHoverModel, labelPosition); + labelLine.hoverStyle = labelLineHoverModel.getModel('lineStyle').getLineStyle(); + + var smooth = labelLineModel.get('smooth'); + if (smooth && smooth === true) { + smooth = 0.4; + } + labelLine.setShape({ + smooth: smooth + }); + }; + + zrUtil.inherits(PiePiece, graphic.Group); + + + // Pie view + var Pie = __webpack_require__(43).extend({ + + type: 'pie', + + init: function () { + var sectorGroup = new graphic.Group(); + this._sectorGroup = sectorGroup; + }, + + render: function (seriesModel, ecModel, api, payload) { + if (payload && (payload.from === this.uid)) { + return; + } + + var data = seriesModel.getData(); + var oldData = this._data; + var group = this.group; + + var hasAnimation = ecModel.get('animation'); + var isFirstRender = !oldData; + var animationType = seriesModel.get('animationType'); + + var onSectorClick = zrUtil.curry( + updateDataSelected, this.uid, seriesModel, hasAnimation, api + ); + + var selectedMode = seriesModel.get('selectedMode'); + + data.diff(oldData) + .add(function (idx) { + var piePiece = new PiePiece(data, idx); + // Default expansion animation + if (isFirstRender && animationType !== 'scale') { + piePiece.eachChild(function (child) { + child.stopAnimation(true); + }); + } + + selectedMode && piePiece.on('click', onSectorClick); + + data.setItemGraphicEl(idx, piePiece); + + group.add(piePiece); + }) + .update(function (newIdx, oldIdx) { + var piePiece = oldData.getItemGraphicEl(oldIdx); + + piePiece.updateData(data, newIdx); + + piePiece.off('click'); + selectedMode && piePiece.on('click', onSectorClick); + group.add(piePiece); + data.setItemGraphicEl(newIdx, piePiece); + }) + .remove(function (idx) { + var piePiece = oldData.getItemGraphicEl(idx); + group.remove(piePiece); + }) + .execute(); + + if ( + hasAnimation && isFirstRender && data.count() > 0 + // Default expansion animation + && animationType !== 'scale' + ) { + var shape = data.getItemLayout(0); + var r = Math.max(api.getWidth(), api.getHeight()) / 2; + + var removeClipPath = zrUtil.bind(group.removeClipPath, group); + group.setClipPath(this._createClipPath( + shape.cx, shape.cy, r, shape.startAngle, shape.clockwise, removeClipPath, seriesModel + )); + } + + this._data = data; + }, + + dispose: function () {}, + + _createClipPath: function ( + cx, cy, r, startAngle, clockwise, cb, seriesModel + ) { + var clipPath = new graphic.Sector({ + shape: { + cx: cx, + cy: cy, + r0: 0, + r: r, + startAngle: startAngle, + endAngle: startAngle, + clockwise: clockwise + } + }); + + graphic.initProps(clipPath, { + shape: { + endAngle: startAngle + (clockwise ? 1 : -1) * Math.PI * 2 + } + }, seriesModel, cb); + + return clipPath; + }, + + /** + * @implement + */ + containPoint: function (point, seriesModel) { + var data = seriesModel.getData(); + var itemLayout = data.getItemLayout(0); + if (itemLayout) { + var dx = point[0] - itemLayout.cx; + var dy = point[1] - itemLayout.cy; + var radius = Math.sqrt(dx * dx + dy * dy); + return radius <= itemLayout.r && radius >= itemLayout.r0; + } + } + + }); + + module.exports = Pie; + + +/***/ }, +/* 159 */ +/***/ function(module, exports, __webpack_require__) { + + + var echarts = __webpack_require__(1); + var zrUtil = __webpack_require__(4); + module.exports = function (seriesType, actionInfos) { + zrUtil.each(actionInfos, function (actionInfo) { + actionInfo.update = 'updateView'; + /** + * @payload + * @property {string} seriesName + * @property {string} name + */ + echarts.registerAction(actionInfo, function (payload, ecModel) { + var selected = {}; + ecModel.eachComponent( + {mainType: 'series', subType: seriesType, query: payload}, + function (seriesModel) { + if (seriesModel[actionInfo.method]) { + seriesModel[actionInfo.method](payload.name); + } + var data = seriesModel.getData(); + // Create selected map + data.each(function (idx) { + var name = data.getName(idx); + selected[name] = seriesModel.isSelected(name) || false; + }); + } + ); + return { + name: payload.name, + selected: selected + }; + }); + }); + }; + + +/***/ }, +/* 160 */ +/***/ function(module, exports) { + + // Pick color from palette for each data item. + // Applicable for charts that require applying color palette + // in data level (like pie, funnel, chord). + + + module.exports = function (seriesType, ecModel) { + // Pie and funnel may use diferrent scope + var paletteScope = {}; + ecModel.eachRawSeriesByType(seriesType, function (seriesModel) { + var dataAll = seriesModel.getRawData(); + var idxMap = {}; + if (!ecModel.isSeriesFiltered(seriesModel)) { + var data = seriesModel.getData(); + data.each(function (idx) { + var rawIdx = data.getRawIndex(idx); + idxMap[rawIdx] = idx; + }); + dataAll.each(function (rawIdx) { + var filteredIdx = idxMap[rawIdx]; + + // If series.itemStyle.normal.color is a function. itemVisual may be encoded + var singleDataColor = filteredIdx != null + && data.getItemVisual(filteredIdx, 'color', true); + + if (!singleDataColor) { + // FIXME Performance + var itemModel = dataAll.getItemModel(rawIdx); + var color = itemModel.get('itemStyle.normal.color') + || seriesModel.getColorFromPalette(dataAll.getName(rawIdx), paletteScope); + // Legend may use the visual info in data before processed + dataAll.setItemVisual(rawIdx, 'color', color); + + // Data is not filtered + if (filteredIdx != null) { + data.setItemVisual(filteredIdx, 'color', color); + } + } + else { + // Set data all color for legend + dataAll.setItemVisual(rawIdx, 'color', singleDataColor); + } + }); + } + }); + }; + + +/***/ }, +/* 161 */ +/***/ function(module, exports, __webpack_require__) { + + // TODO minAngle + + + + var numberUtil = __webpack_require__(7); + var parsePercent = numberUtil.parsePercent; + var labelLayout = __webpack_require__(162); + var zrUtil = __webpack_require__(4); + + var PI2 = Math.PI * 2; + var RADIAN = Math.PI / 180; + + module.exports = function (seriesType, ecModel, api, payload) { + ecModel.eachSeriesByType(seriesType, function (seriesModel) { + var center = seriesModel.get('center'); + var radius = seriesModel.get('radius'); + + if (!zrUtil.isArray(radius)) { + radius = [0, radius]; + } + if (!zrUtil.isArray(center)) { + center = [center, center]; + } + + var width = api.getWidth(); + var height = api.getHeight(); + var size = Math.min(width, height); + var cx = parsePercent(center[0], width); + var cy = parsePercent(center[1], height); + var r0 = parsePercent(radius[0], size / 2); + var r = parsePercent(radius[1], size / 2); + + var data = seriesModel.getData(); + + var startAngle = -seriesModel.get('startAngle') * RADIAN; + + var minAngle = seriesModel.get('minAngle') * RADIAN; + + var sum = data.getSum('value'); + // Sum may be 0 + var unitRadian = Math.PI / (sum || data.count()) * 2; + + var clockwise = seriesModel.get('clockwise'); + + var roseType = seriesModel.get('roseType'); + var stillShowZeroSum = seriesModel.get('stillShowZeroSum'); + + // [0...max] + var extent = data.getDataExtent('value'); + extent[0] = 0; + + // In the case some sector angle is smaller than minAngle + var restAngle = PI2; + var valueSumLargerThanMinAngle = 0; + + var currentAngle = startAngle; + + var dir = clockwise ? 1 : -1; + data.each('value', function (value, idx) { + var angle; + if (isNaN(value)) { + data.setItemLayout(idx, { + angle: NaN, + startAngle: NaN, + endAngle: NaN, + clockwise: clockwise, + cx: cx, + cy: cy, + r0: r0, + r: roseType + ? NaN + : r + }); + return; + } + + // FIXME 兼容 2.0 但是 roseType 是 area 的时候才是这样? + if (roseType !== 'area') { + angle = (sum === 0 && stillShowZeroSum) + ? unitRadian : (value * unitRadian); + } + else { + angle = PI2 / (data.count() || 1); + } + + if (angle < minAngle) { + angle = minAngle; + restAngle -= minAngle; + } + else { + valueSumLargerThanMinAngle += value; + } + + var endAngle = currentAngle + dir * angle; + data.setItemLayout(idx, { + angle: angle, + startAngle: currentAngle, + endAngle: endAngle, + clockwise: clockwise, + cx: cx, + cy: cy, + r0: r0, + r: roseType + ? numberUtil.linearMap(value, extent, [r0, r]) + : r + }); + + currentAngle = endAngle; + }, true); + + // Some sector is constrained by minAngle + // Rest sectors needs recalculate angle + if (restAngle < PI2) { + // Average the angle if rest angle is not enough after all angles is + // Constrained by minAngle + if (restAngle <= 1e-3) { + var angle = PI2 / data.count(); + data.each(function (idx) { + var layout = data.getItemLayout(idx); + layout.startAngle = startAngle + dir * idx * angle; + layout.endAngle = startAngle + dir * (idx + 1) * angle; + }); + } + else { + unitRadian = restAngle / valueSumLargerThanMinAngle; + currentAngle = startAngle; + data.each('value', function (value, idx) { + var layout = data.getItemLayout(idx); + var angle = layout.angle === minAngle + ? minAngle : value * unitRadian; + layout.startAngle = currentAngle; + layout.endAngle = currentAngle + dir * angle; + currentAngle += dir * angle; + }); + } + } + + labelLayout(seriesModel, r, width, height); + }); + }; + + +/***/ }, +/* 162 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + // FIXME emphasis label position is not same with normal label position + + + var textContain = __webpack_require__(8); + + function adjustSingleSide(list, cx, cy, r, dir, viewWidth, viewHeight) { + list.sort(function (a, b) { + return a.y - b.y; + }); + + // 压 + function shiftDown(start, end, delta, dir) { + for (var j = start; j < end; j++) { + list[j].y += delta; + if (j > start + && j + 1 < end + && list[j + 1].y > list[j].y + list[j].height + ) { + shiftUp(j, delta / 2); + return; + } + } + + shiftUp(end - 1, delta / 2); + } + + // 弹 + function shiftUp(end, delta) { + for (var j = end; j >= 0; j--) { + list[j].y -= delta; + if (j > 0 + && list[j].y > list[j - 1].y + list[j - 1].height + ) { + break; + } + } + } + + function changeX(list, isDownList, cx, cy, r, dir) { + var lastDeltaX = dir > 0 + ? isDownList // 右侧 + ? Number.MAX_VALUE // 下 + : 0 // 上 + : isDownList // 左侧 + ? Number.MAX_VALUE // 下 + : 0; // 上 + + for (var i = 0, l = list.length; i < l; i++) { + // Not change x for center label + if (list[i].position === 'center') { + continue; + } + var deltaY = Math.abs(list[i].y - cy); + var length = list[i].len; + var length2 = list[i].len2; + var deltaX = (deltaY < r + length) + ? Math.sqrt( + (r + length + length2) * (r + length + length2) + - deltaY * deltaY + ) + : Math.abs(list[i].x - cx); + if (isDownList && deltaX >= lastDeltaX) { + // 右下,左下 + deltaX = lastDeltaX - 10; + } + if (!isDownList && deltaX <= lastDeltaX) { + // 右上,左上 + deltaX = lastDeltaX + 10; + } + + list[i].x = cx + deltaX * dir; + lastDeltaX = deltaX; + } + } + + var lastY = 0; + var delta; + var len = list.length; + var upList = []; + var downList = []; + for (var i = 0; i < len; i++) { + delta = list[i].y - lastY; + if (delta < 0) { + shiftDown(i, len, -delta, dir); + } + lastY = list[i].y + list[i].height; + } + if (viewHeight - lastY < 0) { + shiftUp(len - 1, lastY - viewHeight); + } + for (var i = 0; i < len; i++) { + if (list[i].y >= cy) { + downList.push(list[i]); + } + else { + upList.push(list[i]); + } + } + changeX(upList, false, cx, cy, r, dir); + changeX(downList, true, cx, cy, r, dir); + } + + function avoidOverlap(labelLayoutList, cx, cy, r, viewWidth, viewHeight) { + var leftList = []; + var rightList = []; + for (var i = 0; i < labelLayoutList.length; i++) { + if (labelLayoutList[i].x < cx) { + leftList.push(labelLayoutList[i]); + } + else { + rightList.push(labelLayoutList[i]); + } + } + + adjustSingleSide(rightList, cx, cy, r, 1, viewWidth, viewHeight); + adjustSingleSide(leftList, cx, cy, r, -1, viewWidth, viewHeight); + + for (var i = 0; i < labelLayoutList.length; i++) { + var linePoints = labelLayoutList[i].linePoints; + if (linePoints) { + var dist = linePoints[1][0] - linePoints[2][0]; + if (labelLayoutList[i].x < cx) { + linePoints[2][0] = labelLayoutList[i].x + 3; + } + else { + linePoints[2][0] = labelLayoutList[i].x - 3; + } + linePoints[1][1] = linePoints[2][1] = labelLayoutList[i].y; + linePoints[1][0] = linePoints[2][0] + dist; + } + } + } + + module.exports = function (seriesModel, r, viewWidth, viewHeight) { + var data = seriesModel.getData(); + var labelLayoutList = []; + var cx; + var cy; + var hasLabelRotate = false; + + data.each(function (idx) { + var layout = data.getItemLayout(idx); + + var itemModel = data.getItemModel(idx); + var labelModel = itemModel.getModel('label.normal'); + // Use position in normal or emphasis + var labelPosition = labelModel.get('position') || itemModel.get('label.emphasis.position'); + + var labelLineModel = itemModel.getModel('labelLine.normal'); + var labelLineLen = labelLineModel.get('length'); + var labelLineLen2 = labelLineModel.get('length2'); + + var midAngle = (layout.startAngle + layout.endAngle) / 2; + var dx = Math.cos(midAngle); + var dy = Math.sin(midAngle); + + var textX; + var textY; + var linePoints; + var textAlign; + + cx = layout.cx; + cy = layout.cy; + + var isLabelInside = labelPosition === 'inside' || labelPosition === 'inner'; + if (labelPosition === 'center') { + textX = layout.cx; + textY = layout.cy; + textAlign = 'center'; + } + else { + var x1 = (isLabelInside ? (layout.r + layout.r0) / 2 * dx : layout.r * dx) + cx; + var y1 = (isLabelInside ? (layout.r + layout.r0) / 2 * dy : layout.r * dy) + cy; + + textX = x1 + dx * 3; + textY = y1 + dy * 3; + + if (!isLabelInside) { + // For roseType + var x2 = x1 + dx * (labelLineLen + r - layout.r); + var y2 = y1 + dy * (labelLineLen + r - layout.r); + var x3 = x2 + ((dx < 0 ? -1 : 1) * labelLineLen2); + var y3 = y2; + + textX = x3 + (dx < 0 ? -5 : 5); + textY = y3; + linePoints = [[x1, y1], [x2, y2], [x3, y3]]; + } + + textAlign = isLabelInside ? 'center' : (dx > 0 ? 'left' : 'right'); + } + var font = labelModel.getModel('textStyle').getFont(); + + var labelRotate = labelModel.get('rotate') + ? (dx < 0 ? -midAngle + Math.PI : -midAngle) : 0; + var text = seriesModel.getFormattedLabel(idx, 'normal') + || data.getName(idx); + var textRect = textContain.getBoundingRect( + text, font, textAlign, 'top' + ); + hasLabelRotate = !!labelRotate; + layout.label = { + x: textX, + y: textY, + position: labelPosition, + height: textRect.height, + len: labelLineLen, + len2: labelLineLen2, + linePoints: linePoints, + textAlign: textAlign, + verticalAlign: 'middle', + font: font, + rotation: labelRotate + }; + + // Not layout the inside label + if (!isLabelInside) { + labelLayoutList.push(layout.label); + } + }); + if (!hasLabelRotate && seriesModel.get('avoidLabelOverlap')) { + avoidOverlap(labelLayoutList, cx, cy, r, viewWidth, viewHeight); + } + }; + + +/***/ }, +/* 163 */ +/***/ function(module, exports) { + + + module.exports = function (seriesType, ecModel) { + var legendModels = ecModel.findComponents({ + mainType: 'legend' + }); + if (!legendModels || !legendModels.length) { + return; + } + ecModel.eachSeriesByType(seriesType, function (series) { + var data = series.getData(); + data.filterSelf(function (idx) { + var name = data.getName(idx); + // If in any legend component the status is not selected. + for (var i = 0; i < legendModels.length; i++) { + if (!legendModels[i].isSelected(name)) { + return false; + } + } + return true; + }, this); + }, this); + }; + + +/***/ }, +/* 164 */ +/***/ function(module, exports, __webpack_require__) { + + + + var zrUtil = __webpack_require__(4); + var echarts = __webpack_require__(1); + + __webpack_require__(165); + __webpack_require__(166); + + echarts.registerVisual(zrUtil.curry( + __webpack_require__(119), 'scatter', 'circle', null + )); + echarts.registerLayout(zrUtil.curry( + __webpack_require__(120), 'scatter' + )); + + // In case developer forget to include grid component + __webpack_require__(122); + + +/***/ }, +/* 165 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + + var createListFromArray = __webpack_require__(102); + var SeriesModel = __webpack_require__(28); + + module.exports = SeriesModel.extend({ + + type: 'series.scatter', + + dependencies: ['grid', 'polar', 'geo', 'singleAxis'], + + getInitialData: function (option, ecModel) { + var list = createListFromArray(option.data, this, ecModel); + return list; + }, + + brushSelector: 'point', + + defaultOption: { + coordinateSystem: 'cartesian2d', + zlevel: 0, + z: 2, + legendHoverLink: true, + + hoverAnimation: true, + // Cartesian coordinate system + // xAxisIndex: 0, + // yAxisIndex: 0, + + // Polar coordinate system + // polarIndex: 0, + + // Geo coordinate system + // geoIndex: 0, + + // symbol: null, // 图形类型 + symbolSize: 10, // 图形大小,半宽(半径)参数,当图形为方向或菱形则总宽度为symbolSize * 2 + // symbolRotate: null, // 图形旋转控制 + + large: false, + // Available when large is true + largeThreshold: 2000, + + // label: { + // normal: { + // show: false + // distance: 5, + // formatter: 标签文本格式器,同Tooltip.formatter,不支持异步回调 + // position: 默认自适应,水平布局为'top',垂直布局为'right',可选为 + // 'inside'|'left'|'right'|'top'|'bottom' + // textStyle: null // 默认使用全局文本样式,详见TEXTSTYLE + // } + // }, + itemStyle: { + normal: { + opacity: 0.8 + // color: 各异 + } + } + } + + }); + + +/***/ }, +/* 166 */ +/***/ function(module, exports, __webpack_require__) { + + + + var SymbolDraw = __webpack_require__(115); + var LargeSymbolDraw = __webpack_require__(167); + + __webpack_require__(1).extendChartView({ + + type: 'scatter', + + init: function () { + this._normalSymbolDraw = new SymbolDraw(); + this._largeSymbolDraw = new LargeSymbolDraw(); + }, + + render: function (seriesModel, ecModel, api) { + var data = seriesModel.getData(); + var largeSymbolDraw = this._largeSymbolDraw; + var normalSymbolDraw = this._normalSymbolDraw; + var group = this.group; + + var symbolDraw = seriesModel.get('large') && data.count() > seriesModel.get('largeThreshold') + ? largeSymbolDraw : normalSymbolDraw; + + this._symbolDraw = symbolDraw; + symbolDraw.updateData(data); + group.add(symbolDraw.group); + + group.remove( + symbolDraw === largeSymbolDraw + ? normalSymbolDraw.group : largeSymbolDraw.group + ); + }, + + updateLayout: function (seriesModel) { + this._symbolDraw.updateLayout(seriesModel); + }, + + remove: function (ecModel, api) { + this._symbolDraw && this._symbolDraw.remove(api, true); + }, + + dispose: function () {} + }); + + +/***/ }, +/* 167 */ +/***/ function(module, exports, __webpack_require__) { + + // TODO Batch by color + + + + var graphic = __webpack_require__(44); + var symbolUtil = __webpack_require__(104); + + var LargeSymbolPath = graphic.extendShape({ + + shape: { + points: null, + sizes: null + }, + + symbolProxy: null, + + buildPath: function (path, shape) { + var points = shape.points; + var sizes = shape.sizes; + + var symbolProxy = this.symbolProxy; + var symbolProxyShape = symbolProxy.shape; + for (var i = 0; i < points.length; i++) { + var pt = points[i]; + var size = sizes[i]; + if (size[0] < 4) { + // Optimize for small symbol + path.rect( + pt[0] - size[0] / 2, pt[1] - size[1] / 2, + size[0], size[1] + ); + } + else { + symbolProxyShape.x = pt[0] - size[0] / 2; + symbolProxyShape.y = pt[1] - size[1] / 2; + symbolProxyShape.width = size[0]; + symbolProxyShape.height = size[1]; + + symbolProxy.buildPath(path, symbolProxyShape, true); + } + } + }, + + findDataIndex: function (x, y) { + var shape = this.shape; + var points = shape.points; + var sizes = shape.sizes; + + // Not consider transform + // Treat each element as a rect + // top down traverse + for (var i = points.length - 1; i >= 0; i--) { + var pt = points[i]; + var size = sizes[i]; + var x0 = pt[0] - size[0] / 2; + var y0 = pt[1] - size[1] / 2; + if (x >= x0 && y >= y0 && x <= x0 + size[0] && y <= y0 + size[1]) { + // i is dataIndex + return i; + } + } + + return -1; + } + }); + + function LargeSymbolDraw() { + this.group = new graphic.Group(); + + this._symbolEl = new LargeSymbolPath({ + // rectHover: true, + // cursor: 'default' + }); + } + + var largeSymbolProto = LargeSymbolDraw.prototype; + + /** + * Update symbols draw by new data + * @param {module:echarts/data/List} data + */ + largeSymbolProto.updateData = function (data) { + this.group.removeAll(); + + var symbolEl = this._symbolEl; + + var seriesModel = data.hostModel; + + symbolEl.setShape({ + points: data.mapArray(data.getItemLayout), + sizes: data.mapArray( + function (idx) { + var size = data.getItemVisual(idx, 'symbolSize'); + if (!(size instanceof Array)) { + size = [size, size]; + } + return size; + } + ) + }); + + // Create symbolProxy to build path for each data + symbolEl.symbolProxy = symbolUtil.createSymbol( + data.getVisual('symbol'), 0, 0, 0, 0 + ); + // Use symbolProxy setColor method + symbolEl.setColor = symbolEl.symbolProxy.setColor; + + symbolEl.useStyle( + seriesModel.getModel('itemStyle.normal').getItemStyle(['color']) + ); + + var visualColor = data.getVisual('color'); + if (visualColor) { + symbolEl.setColor(visualColor); + } + + // Enable tooltip + // PENDING May have performance issue when path is extremely large + symbolEl.seriesIndex = seriesModel.seriesIndex; + symbolEl.on('mousemove', function (e) { + symbolEl.dataIndex = null; + var dataIndex = symbolEl.findDataIndex(e.offsetX, e.offsetY); + if (dataIndex > 0) { + // Provide dataIndex for tooltip + symbolEl.dataIndex = dataIndex; + } + }); + + // Add back + this.group.add(symbolEl); + }; + + largeSymbolProto.updateLayout = function (seriesModel) { + var data = seriesModel.getData(); + this._symbolEl.setShape({ + points: data.mapArray(data.getItemLayout) + }); + }; + + largeSymbolProto.remove = function () { + this.group.removeAll(); + }; + + module.exports = LargeSymbolDraw; + + +/***/ }, +/* 168 */ +/***/ function(module, exports, __webpack_require__) { + + + + var zrUtil = __webpack_require__(4); + var echarts = __webpack_require__(1); + + // Must use radar component + __webpack_require__(169); + + __webpack_require__(174); + __webpack_require__(175); + + echarts.registerVisual(zrUtil.curry(__webpack_require__(160), 'radar')); + echarts.registerVisual(zrUtil.curry( + __webpack_require__(119), 'radar', 'circle', null + )); + echarts.registerLayout(__webpack_require__(176)); + + echarts.registerProcessor( + zrUtil.curry(__webpack_require__(163), 'radar') + ); + + echarts.registerPreprocessor(__webpack_require__(177)); + + +/***/ }, +/* 169 */ +/***/ function(module, exports, __webpack_require__) { + + + + __webpack_require__(170); + __webpack_require__(172); + + __webpack_require__(173); + + +/***/ }, +/* 170 */ +/***/ function(module, exports, __webpack_require__) { + + // TODO clockwise + + + var zrUtil = __webpack_require__(4); + var IndicatorAxis = __webpack_require__(171); + var IntervalScale = __webpack_require__(108); + var numberUtil = __webpack_require__(7); + var axisHelper = __webpack_require__(105); + + function Radar(radarModel, ecModel, api) { + + this._model = radarModel; + /** + * Radar dimensions + * @type {Array.} + */ + this.dimensions = []; + + this._indicatorAxes = zrUtil.map(radarModel.getIndicatorModels(), function (indicatorModel, idx) { + var dim = 'indicator_' + idx; + var indicatorAxis = new IndicatorAxis(dim, new IntervalScale()); + indicatorAxis.name = indicatorModel.get('name'); + // Inject model and axis + indicatorAxis.model = indicatorModel; + indicatorModel.axis = indicatorAxis; + this.dimensions.push(dim); + return indicatorAxis; + }, this); + + this.resize(radarModel, api); + + /** + * @type {number} + * @readOnly + */ + this.cx; + /** + * @type {number} + * @readOnly + */ + this.cy; + /** + * @type {number} + * @readOnly + */ + this.r; + /** + * @type {number} + * @readOnly + */ + this.startAngle; + } + + Radar.prototype.getIndicatorAxes = function () { + return this._indicatorAxes; + }; + + Radar.prototype.dataToPoint = function (value, indicatorIndex) { + var indicatorAxis = this._indicatorAxes[indicatorIndex]; + + return this.coordToPoint(indicatorAxis.dataToCoord(value), indicatorIndex); + }; + + Radar.prototype.coordToPoint = function (coord, indicatorIndex) { + var indicatorAxis = this._indicatorAxes[indicatorIndex]; + var angle = indicatorAxis.angle; + var x = this.cx + coord * Math.cos(angle); + var y = this.cy - coord * Math.sin(angle); + return [x, y]; + }; + + Radar.prototype.pointToData = function (pt) { + var dx = pt[0] - this.cx; + var dy = pt[1] - this.cy; + var radius = Math.sqrt(dx * dx + dy * dy); + dx /= radius; + dy /= radius; + + var radian = Math.atan2(-dy, dx); + + // Find the closest angle + // FIXME index can calculated directly + var minRadianDiff = Infinity; + var closestAxis; + var closestAxisIdx = -1; + for (var i = 0; i < this._indicatorAxes.length; i++) { + var indicatorAxis = this._indicatorAxes[i]; + var diff = Math.abs(radian - indicatorAxis.angle); + if (diff < minRadianDiff) { + closestAxis = indicatorAxis; + closestAxisIdx = i; + minRadianDiff = diff; + } + } + + return [closestAxisIdx, +(closestAxis && closestAxis.coodToData(radius))]; + }; + + Radar.prototype.resize = function (radarModel, api) { + var center = radarModel.get('center'); + var viewWidth = api.getWidth(); + var viewHeight = api.getHeight(); + var viewSize = Math.min(viewWidth, viewHeight) / 2; + this.cx = numberUtil.parsePercent(center[0], viewWidth); + this.cy = numberUtil.parsePercent(center[1], viewHeight); + + this.startAngle = radarModel.get('startAngle') * Math.PI / 180; + + this.r = numberUtil.parsePercent(radarModel.get('radius'), viewSize); + + zrUtil.each(this._indicatorAxes, function (indicatorAxis, idx) { + indicatorAxis.setExtent(0, this.r); + var angle = (this.startAngle + idx * Math.PI * 2 / this._indicatorAxes.length); + // Normalize to [-PI, PI] + angle = Math.atan2(Math.sin(angle), Math.cos(angle)); + indicatorAxis.angle = angle; + }, this); + }; + + Radar.prototype.update = function (ecModel, api) { + var indicatorAxes = this._indicatorAxes; + var radarModel = this._model; + zrUtil.each(indicatorAxes, function (indicatorAxis) { + indicatorAxis.scale.setExtent(Infinity, -Infinity); + }); + ecModel.eachSeriesByType('radar', function (radarSeries, idx) { + if (radarSeries.get('coordinateSystem') !== 'radar' + || ecModel.getComponent('radar', radarSeries.get('radarIndex')) !== radarModel + ) { + return; + } + var data = radarSeries.getData(); + zrUtil.each(indicatorAxes, function (indicatorAxis) { + indicatorAxis.scale.unionExtentFromData(data, indicatorAxis.dim); + }); + }, this); + + var splitNumber = radarModel.get('splitNumber'); + + function increaseInterval(interval) { + var exp10 = Math.pow(10, Math.floor(Math.log(interval) / Math.LN10)); + // Increase interval + var f = interval / exp10; + if (f === 2) { + f = 5; + } + else { // f is 2 or 5 + f *= 2; + } + return f * exp10; + } + // Force all the axis fixing the maxSplitNumber. + zrUtil.each(indicatorAxes, function (indicatorAxis, idx) { + var rawExtent = axisHelper.getScaleExtent(indicatorAxis.scale, indicatorAxis.model); + axisHelper.niceScaleExtent(indicatorAxis.scale, indicatorAxis.model); + + var axisModel = indicatorAxis.model; + var scale = indicatorAxis.scale; + var fixedMin = axisModel.getMin(); + var fixedMax = axisModel.getMax(); + var interval = scale.getInterval(); + + if (fixedMin != null && fixedMax != null) { + // User set min, max, divide to get new interval + // FIXME precision + scale.setInterval( + (fixedMax - fixedMin) / splitNumber + ); + } + else if (fixedMin != null) { + var max; + // User set min, expand extent on the other side + do { + max = fixedMin + interval * splitNumber; + scale.setExtent(+fixedMin, max); + // Interval must been set after extent + // FIXME + scale.setInterval(interval); + + interval = increaseInterval(interval); + } while (max < rawExtent[1] && isFinite(max) && isFinite(rawExtent[1])); + } + else if (fixedMax != null) { + var min; + // User set min, expand extent on the other side + do { + min = fixedMax - interval * splitNumber; + scale.setExtent(min, +fixedMax); + scale.setInterval(interval); + interval = increaseInterval(interval); + } while (min > rawExtent[0] && isFinite(min) && isFinite(rawExtent[0])); + } + else { + var nicedSplitNumber = scale.getTicks().length - 1; + if (nicedSplitNumber > splitNumber) { + interval = increaseInterval(interval); + } + // PENDING + var center = Math.round((rawExtent[0] + rawExtent[1]) / 2 / interval) * interval; + var halfSplitNumber = Math.round(splitNumber / 2); + scale.setExtent( + numberUtil.round(center - halfSplitNumber * interval), + numberUtil.round(center + (splitNumber - halfSplitNumber) * interval) + ); + scale.setInterval(interval); + } + }); + }; + + /** + * Radar dimensions is based on the data + * @type {Array} + */ + Radar.dimensions = []; + + Radar.create = function (ecModel, api) { + var radarList = []; + ecModel.eachComponent('radar', function (radarModel) { + var radar = new Radar(radarModel, ecModel, api); + radarList.push(radar); + radarModel.coordinateSystem = radar; + }); + ecModel.eachSeriesByType('radar', function (radarSeries) { + if (radarSeries.get('coordinateSystem') === 'radar') { + // Inject coordinate system + radarSeries.coordinateSystem = radarList[radarSeries.get('radarIndex') || 0]; + } + }); + return radarList; + }; + + __webpack_require__(26).register('radar', Radar); + module.exports = Radar; + + +/***/ }, +/* 171 */ +/***/ function(module, exports, __webpack_require__) { + + + + var zrUtil = __webpack_require__(4); + var Axis = __webpack_require__(100); + + function IndicatorAxis(dim, scale, radiusExtent) { + Axis.call(this, dim, scale, radiusExtent); + + /** + * Axis type + * - 'category' + * - 'value' + * - 'time' + * - 'log' + * @type {string} + */ + this.type = 'value'; + + this.angle = 0; + + /** + * Indicator name + * @type {string} + */ + this.name = ''; + /** + * @type {module:echarts/model/Model} + */ + this.model; + } + + zrUtil.inherits(IndicatorAxis, Axis); + + module.exports = IndicatorAxis; + + +/***/ }, +/* 172 */ +/***/ function(module, exports, __webpack_require__) { + + + + + var axisDefault = __webpack_require__(132); + var valueAxisDefault = axisDefault.valueAxis; + var Model = __webpack_require__(12); + var zrUtil = __webpack_require__(4); + + var axisModelCommonMixin = __webpack_require__(111); + + function defaultsShow(opt, show) { + return zrUtil.defaults({ + show: show + }, opt); + } + + var RadarModel = __webpack_require__(1).extendComponentModel({ + + type: 'radar', + + optionUpdated: function () { + var boundaryGap = this.get('boundaryGap'); + var splitNumber = this.get('splitNumber'); + var scale = this.get('scale'); + var axisLine = this.get('axisLine'); + var axisTick = this.get('axisTick'); + var axisLabel = this.get('axisLabel'); + var nameTextStyle = this.get('name.textStyle'); + var showName = this.get('name.show'); + var nameFormatter = this.get('name.formatter'); + var nameGap = this.get('nameGap'); + var triggerEvent = this.get('triggerEvent'); + + var indicatorModels = zrUtil.map(this.get('indicator') || [], function (indicatorOpt) { + // PENDING + if (indicatorOpt.max != null && indicatorOpt.max > 0 && !indicatorOpt.min) { + indicatorOpt.min = 0; + } + else if (indicatorOpt.min != null && indicatorOpt.min < 0 && !indicatorOpt.max) { + indicatorOpt.max = 0; + } + // Use same configuration + indicatorOpt = zrUtil.merge(zrUtil.clone(indicatorOpt), { + boundaryGap: boundaryGap, + splitNumber: splitNumber, + scale: scale, + axisLine: axisLine, + axisTick: axisTick, + axisLabel: axisLabel, + // Competitable with 2 and use text + name: indicatorOpt.text, + nameLocation: 'end', + nameGap: nameGap, + // min: 0, + nameTextStyle: nameTextStyle, + triggerEvent: triggerEvent + }, false); + if (!showName) { + indicatorOpt.name = ''; + } + if (typeof nameFormatter === 'string') { + var indName = indicatorOpt.name; + indicatorOpt.name = nameFormatter.replace('{value}', indName != null ? indName : ''); + } + else if (typeof nameFormatter === 'function') { + indicatorOpt.name = nameFormatter( + indicatorOpt.name, indicatorOpt + ); + } + var model = zrUtil.extend( + new Model(indicatorOpt, null, this.ecModel), + axisModelCommonMixin + ); + + // For triggerEvent. + model.mainType = 'radar'; + model.componentIndex = this.componentIndex; + + return model; + }, this); + + this.getIndicatorModels = function () { + return indicatorModels; + }; + }, + + defaultOption: { + + zlevel: 0, + + z: 0, + + center: ['50%', '50%'], + + radius: '75%', + + startAngle: 90, + + name: { + show: true + // formatter: null + // textStyle: {} + }, + + boundaryGap: [0, 0], + + splitNumber: 5, + + nameGap: 15, + + scale: false, + + // Polygon or circle + shape: 'polygon', + + axisLine: zrUtil.merge( + { + lineStyle: { + color: '#bbb' + } + }, + valueAxisDefault.axisLine + ), + axisLabel: defaultsShow(valueAxisDefault.axisLabel, false), + axisTick: defaultsShow(valueAxisDefault.axisTick, false), + splitLine: defaultsShow(valueAxisDefault.splitLine, true), + splitArea: defaultsShow(valueAxisDefault.splitArea, true), + + // {text, min, max} + indicator: [] + } + }); + + module.exports = RadarModel; + + +/***/ }, +/* 173 */ +/***/ function(module, exports, __webpack_require__) { + + + + var AxisBuilder = __webpack_require__(135); + var zrUtil = __webpack_require__(4); + var graphic = __webpack_require__(44); + + var axisBuilderAttrs = [ 'axisLine', 'axisLabel', 'axisTick', 'axisName' ]; - module.exports = __webpack_require__(1).extendComponentView({ + module.exports = __webpack_require__(1).extendComponentView({ + + type: 'radar', + + render: function (radarModel, ecModel, api) { + var group = this.group; + group.removeAll(); + + this._buildAxes(radarModel); + this._buildSplitLineAndArea(radarModel); + }, + + _buildAxes: function (radarModel) { + var radar = radarModel.coordinateSystem; + var indicatorAxes = radar.getIndicatorAxes(); + var axisBuilders = zrUtil.map(indicatorAxes, function (indicatorAxis) { + var axisBuilder = new AxisBuilder(indicatorAxis.model, { + position: [radar.cx, radar.cy], + rotation: indicatorAxis.angle, + labelDirection: -1, + tickDirection: -1, + nameDirection: 1 + }); + return axisBuilder; + }); + + zrUtil.each(axisBuilders, function (axisBuilder) { + zrUtil.each(axisBuilderAttrs, axisBuilder.add, axisBuilder); + this.group.add(axisBuilder.getGroup()); + }, this); + }, + + _buildSplitLineAndArea: function (radarModel) { + var radar = radarModel.coordinateSystem; + var indicatorAxes = radar.getIndicatorAxes(); + if (!indicatorAxes.length) { + return; + } + var shape = radarModel.get('shape'); + var splitLineModel = radarModel.getModel('splitLine'); + var splitAreaModel = radarModel.getModel('splitArea'); + var lineStyleModel = splitLineModel.getModel('lineStyle'); + var areaStyleModel = splitAreaModel.getModel('areaStyle'); + + var showSplitLine = splitLineModel.get('show'); + var showSplitArea = splitAreaModel.get('show'); + var splitLineColors = lineStyleModel.get('color'); + var splitAreaColors = areaStyleModel.get('color'); + + splitLineColors = zrUtil.isArray(splitLineColors) ? splitLineColors : [splitLineColors]; + splitAreaColors = zrUtil.isArray(splitAreaColors) ? splitAreaColors : [splitAreaColors]; + + var splitLines = []; + var splitAreas = []; + + function getColorIndex(areaOrLine, areaOrLineColorList, idx) { + var colorIndex = idx % areaOrLineColorList.length; + areaOrLine[colorIndex] = areaOrLine[colorIndex] || []; + return colorIndex; + } + + if (shape === 'circle') { + var ticksRadius = indicatorAxes[0].getTicksCoords(); + var cx = radar.cx; + var cy = radar.cy; + for (var i = 0; i < ticksRadius.length; i++) { + if (showSplitLine) { + var colorIndex = getColorIndex(splitLines, splitLineColors, i); + splitLines[colorIndex].push(new graphic.Circle({ + shape: { + cx: cx, + cy: cy, + r: ticksRadius[i] + } + })); + } + if (showSplitArea && i < ticksRadius.length - 1) { + var colorIndex = getColorIndex(splitAreas, splitAreaColors, i); + splitAreas[colorIndex].push(new graphic.Ring({ + shape: { + cx: cx, + cy: cy, + r0: ticksRadius[i], + r: ticksRadius[i + 1] + } + })); + } + } + } + // Polyyon + else { + var realSplitNumber = -1; + var axesTicksPoints = zrUtil.map(indicatorAxes, function (indicatorAxis, idx) { + var ticksCoords = indicatorAxis.getTicksCoords(); + realSplitNumber = Math.max(ticksCoords.length - 1, realSplitNumber); + return zrUtil.map(ticksCoords, function (tickCoord) { + return radar.coordToPoint(tickCoord, idx); + }); + }); + + var prevPoints = []; + for (var i = 0; i <= realSplitNumber; i++) { + var points = []; + for (var j = 0; j < indicatorAxes.length; j++) { + points.push(axesTicksPoints[j][i]); + } + // Close + if (points[0]) { + points.push(points[0].slice()); + } + else { + if (true) { + console.error('Can\'t draw value axis ' + i); + } + } + if (showSplitLine) { + var colorIndex = getColorIndex(splitLines, splitLineColors, i); + splitLines[colorIndex].push(new graphic.Polyline({ + shape: { + points: points + } + })); + } + if (showSplitArea && prevPoints) { + var colorIndex = getColorIndex(splitAreas, splitAreaColors, i - 1); + splitAreas[colorIndex].push(new graphic.Polygon({ + shape: { + points: points.concat(prevPoints) + } + })); + } + prevPoints = points.slice().reverse(); + } + } + + var lineStyle = lineStyleModel.getLineStyle(); + var areaStyle = areaStyleModel.getAreaStyle(); + // Add splitArea before splitLine + zrUtil.each(splitAreas, function (splitAreas, idx) { + this.group.add(graphic.mergePath( + splitAreas, { + style: zrUtil.defaults({ + stroke: 'none', + fill: splitAreaColors[idx % splitAreaColors.length] + }, areaStyle), + silent: true + } + )); + }, this); + + zrUtil.each(splitLines, function (splitLines, idx) { + this.group.add(graphic.mergePath( + splitLines, { + style: zrUtil.defaults({ + fill: 'none', + stroke: splitLineColors[idx % splitLineColors.length] + }, lineStyle), + silent: true + } + )); + }, this); + + } + }); + + +/***/ }, +/* 174 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + + var SeriesModel = __webpack_require__(28); + var List = __webpack_require__(98); + var completeDimensions = __webpack_require__(103); + var zrUtil = __webpack_require__(4); + var encodeHTML = __webpack_require__(6).encodeHTML; + + var RadarSeries = SeriesModel.extend({ + + type: 'series.radar', + + dependencies: ['radar'], + + + // Overwrite + init: function (option) { + RadarSeries.superApply(this, 'init', arguments); + + // Enable legend selection for each data item + // Use a function instead of direct access because data reference may changed + this.legendDataProvider = function () { + return this.getRawData(); + }; + }, + + getInitialData: function (option, ecModel) { + var data = option.data || []; + var dimensions = completeDimensions( + [], data, {extraPrefix: 'indicator_'} + ); + var list = new List(dimensions, this); + list.initData(data); + return list; + }, + + formatTooltip: function (dataIndex) { + var value = this.getRawValue(dataIndex); + var coordSys = this.coordinateSystem; + var indicatorAxes = coordSys.getIndicatorAxes(); + var name = this.getData().getName(dataIndex); + return encodeHTML(name === '' ? this.name : name) + '
' + + zrUtil.map(indicatorAxes, function (axis, idx) { + return encodeHTML(axis.name + ' : ' + value[idx]); + }).join('
'); + }, + + defaultOption: { + zlevel: 0, + z: 2, + coordinateSystem: 'radar', + legendHoverLink: true, + radarIndex: 0, + lineStyle: { + normal: { + width: 2, + type: 'solid' + } + }, + label: { + normal: { + position: 'top' + } + }, + // areaStyle: { + // }, + // itemStyle: {} + symbol: 'emptyCircle', + symbolSize: 4 + // symbolRotate: null + } + }); + + module.exports = RadarSeries; + + +/***/ }, +/* 175 */ +/***/ function(module, exports, __webpack_require__) { + + + + var graphic = __webpack_require__(44); + var zrUtil = __webpack_require__(4); + var symbolUtil = __webpack_require__(104); + + function normalizeSymbolSize(symbolSize) { + if (!zrUtil.isArray(symbolSize)) { + symbolSize = [+symbolSize, +symbolSize]; + } + return symbolSize; + } + module.exports = __webpack_require__(1).extendChartView({ + type: 'radar', + + render: function (seriesModel, ecModel, api) { + var polar = seriesModel.coordinateSystem; + var group = this.group; + + var data = seriesModel.getData(); + var oldData = this._data; + + function createSymbol(data, idx) { + var symbolType = data.getItemVisual(idx, 'symbol') || 'circle'; + var color = data.getItemVisual(idx, 'color'); + if (symbolType === 'none') { + return; + } + var symbolPath = symbolUtil.createSymbol( + symbolType, -0.5, -0.5, 1, 1, color + ); + symbolPath.attr({ + style: { + strokeNoScale: true + }, + z2: 100, + scale: normalizeSymbolSize(data.getItemVisual(idx, 'symbolSize')) + }); + return symbolPath; + } + + function updateSymbols(oldPoints, newPoints, symbolGroup, data, idx, isInit) { + // Simply rerender all + symbolGroup.removeAll(); + for (var i = 0; i < newPoints.length - 1; i++) { + var symbolPath = createSymbol(data, idx); + if (symbolPath) { + symbolPath.__dimIdx = i; + if (oldPoints[i]) { + symbolPath.attr('position', oldPoints[i]); + graphic[isInit ? 'initProps' : 'updateProps']( + symbolPath, { + position: newPoints[i] + }, seriesModel, idx + ); + } + else { + symbolPath.attr('position', newPoints[i]); + } + symbolGroup.add(symbolPath); + } + } + } + + function getInitialPoints(points) { + return zrUtil.map(points, function (pt) { + return [polar.cx, polar.cy]; + }); + } + data.diff(oldData) + .add(function (idx) { + var points = data.getItemLayout(idx); + if (!points) { + return; + } + var polygon = new graphic.Polygon(); + var polyline = new graphic.Polyline(); + var target = { + shape: { + points: points + } + }; + polygon.shape.points = getInitialPoints(points); + polyline.shape.points = getInitialPoints(points); + graphic.initProps(polygon, target, seriesModel, idx); + graphic.initProps(polyline, target, seriesModel, idx); + + var itemGroup = new graphic.Group(); + var symbolGroup = new graphic.Group(); + itemGroup.add(polyline); + itemGroup.add(polygon); + itemGroup.add(symbolGroup); + + updateSymbols( + polyline.shape.points, points, symbolGroup, data, idx, true + ); + + data.setItemGraphicEl(idx, itemGroup); + }) + .update(function (newIdx, oldIdx) { + var itemGroup = oldData.getItemGraphicEl(oldIdx); + var polyline = itemGroup.childAt(0); + var polygon = itemGroup.childAt(1); + var symbolGroup = itemGroup.childAt(2); + var target = { + shape: { + points: data.getItemLayout(newIdx) + } + }; + if (!target.shape.points) { + return; + } + updateSymbols( + polyline.shape.points, target.shape.points, symbolGroup, data, newIdx, false + ); + + graphic.updateProps(polyline, target, seriesModel); + graphic.updateProps(polygon, target, seriesModel); + + data.setItemGraphicEl(newIdx, itemGroup); + }) + .remove(function (idx) { + group.remove(oldData.getItemGraphicEl(idx)); + }) + .execute(); + + data.eachItemGraphicEl(function (itemGroup, idx) { + var itemModel = data.getItemModel(idx); + var polyline = itemGroup.childAt(0); + var polygon = itemGroup.childAt(1); + var symbolGroup = itemGroup.childAt(2); + var color = data.getItemVisual(idx, 'color'); + + group.add(itemGroup); + + polyline.useStyle( + zrUtil.defaults( + itemModel.getModel('lineStyle.normal').getLineStyle(), + { + fill: 'none', + stroke: color + } + ) + ); + polyline.hoverStyle = itemModel.getModel('lineStyle.emphasis').getLineStyle(); + + var areaStyleModel = itemModel.getModel('areaStyle.normal'); + var hoverAreaStyleModel = itemModel.getModel('areaStyle.emphasis'); + var polygonIgnore = areaStyleModel.isEmpty() && areaStyleModel.parentModel.isEmpty(); + var hoverPolygonIgnore = hoverAreaStyleModel.isEmpty() && hoverAreaStyleModel.parentModel.isEmpty(); + + hoverPolygonIgnore = hoverPolygonIgnore && polygonIgnore; + polygon.ignore = polygonIgnore; + + polygon.useStyle( + zrUtil.defaults( + areaStyleModel.getAreaStyle(), + { + fill: color, + opacity: 0.7 + } + ) + ); + polygon.hoverStyle = hoverAreaStyleModel.getAreaStyle(); + + var itemStyle = itemModel.getModel('itemStyle.normal').getItemStyle(['color']); + var itemHoverStyle = itemModel.getModel('itemStyle.emphasis').getItemStyle(); + var labelModel = itemModel.getModel('label.normal'); + var labelHoverModel = itemModel.getModel('label.emphasis'); + symbolGroup.eachChild(function (symbolPath) { + symbolPath.setStyle(itemStyle); + symbolPath.hoverStyle = zrUtil.clone(itemHoverStyle); + + var defaultText = data.get(data.dimensions[symbolPath.__dimIdx], idx); + graphic.setText(symbolPath.style, labelModel, color); + symbolPath.setStyle({ + text: labelModel.get('show') ? zrUtil.retrieve( + seriesModel.getFormattedLabel( + idx, 'normal', null, symbolPath.__dimIdx + ), + defaultText + ) : '' + }); + + graphic.setText(symbolPath.hoverStyle, labelHoverModel, color); + symbolPath.hoverStyle.text = labelHoverModel.get('show') ? zrUtil.retrieve( + seriesModel.getFormattedLabel( + idx, 'emphasis', null, symbolPath.__dimIdx + ), + defaultText + ) : ''; + }); + + function onEmphasis() { + polygon.attr('ignore', hoverPolygonIgnore); + } + + function onNormal() { + polygon.attr('ignore', polygonIgnore); + } + + itemGroup.off('mouseover').off('mouseout').off('normal').off('emphasis'); + itemGroup.on('emphasis', onEmphasis) + .on('mouseover', onEmphasis) + .on('normal', onNormal) + .on('mouseout', onNormal); + + graphic.setHoverStyle(itemGroup); + }); + + this._data = data; + }, + + remove: function () { + this.group.removeAll(); + this._data = null; + }, + + dispose: function () {} + }); + + +/***/ }, +/* 176 */ +/***/ function(module, exports) { + + + + module.exports = function (ecModel) { + ecModel.eachSeriesByType('radar', function (seriesModel) { + var data = seriesModel.getData(); + var points = []; + var coordSys = seriesModel.coordinateSystem; + if (!coordSys) { + return; + } + + function pointsConverter(val, idx) { + points[idx] = points[idx] || []; + points[idx][i] = coordSys.dataToPoint(val, i); + } + for (var i = 0; i < coordSys.getIndicatorAxes().length; i++) { + var dim = data.dimensions[i]; + data.each(dim, pointsConverter); + } + + data.each(function (idx) { + // Close polygon + points[idx][0] && points[idx].push(points[idx][0].slice()); + data.setItemLayout(idx, points[idx]); + }); + }); + }; + + +/***/ }, +/* 177 */ +/***/ function(module, exports, __webpack_require__) { + + // Backward compat for radar chart in 2 + + + var zrUtil = __webpack_require__(4); + + module.exports = function (option) { + var polarOptArr = option.polar; + if (polarOptArr) { + if (!zrUtil.isArray(polarOptArr)) { + polarOptArr = [polarOptArr]; + } + var polarNotRadar = []; + zrUtil.each(polarOptArr, function (polarOpt, idx) { + if (polarOpt.indicator) { + if (polarOpt.type && !polarOpt.shape) { + polarOpt.shape = polarOpt.type; + } + option.radar = option.radar || []; + if (!zrUtil.isArray(option.radar)) { + option.radar = [option.radar]; + } + option.radar.push(polarOpt); + } + else { + polarNotRadar.push(polarOpt); + } + }); + option.polar = polarNotRadar; + } + zrUtil.each(option.series, function (seriesOpt) { + if (seriesOpt.type === 'radar' && seriesOpt.polarIndex) { + seriesOpt.radarIndex = seriesOpt.polarIndex; + } + }); + }; + + +/***/ }, +/* 178 */ +/***/ function(module, exports, __webpack_require__) { + + + + var echarts = __webpack_require__(1); + var PRIORITY = echarts.PRIORITY; + + __webpack_require__(179); + + __webpack_require__(189); + + __webpack_require__(193); + + __webpack_require__(180); + + echarts.registerLayout(__webpack_require__(195)); + + echarts.registerVisual(__webpack_require__(196)); + + echarts.registerProcessor(PRIORITY.PROCESSOR.STATISTIC, __webpack_require__(197)); + + echarts.registerPreprocessor(__webpack_require__(198)); + + __webpack_require__(159)('map', [{ + type: 'mapToggleSelect', + event: 'mapselectchanged', + method: 'toggleSelected' + }, { + type: 'mapSelect', + event: 'mapselected', + method: 'select' + }, { + type: 'mapUnSelect', + event: 'mapunselected', + method: 'unSelect' + }]); + + +/***/ }, +/* 179 */ +/***/ function(module, exports, __webpack_require__) { + + + + var List = __webpack_require__(98); + var SeriesModel = __webpack_require__(28); + var zrUtil = __webpack_require__(4); + var completeDimensions = __webpack_require__(103); + + var formatUtil = __webpack_require__(6); + var encodeHTML = formatUtil.encodeHTML; + var addCommas = formatUtil.addCommas; + + var dataSelectableMixin = __webpack_require__(157); + + var geoCreator = __webpack_require__(180); + + var MapSeries = SeriesModel.extend({ + + type: 'series.map', + + dependencies: ['geo'], + + layoutMode: 'box', + + /** + * Only first map series of same mapType will drawMap + * @type {boolean} + */ + needsDrawMap: false, + + /** + * Group of all map series with same mapType + * @type {boolean} + */ + seriesGroup: [], + + init: function (option) { + + option = this._fillOption(option, this.getMapType()); + this.option = option; + + MapSeries.superApply(this, 'init', arguments); + + this.updateSelectedMap(option.data); + }, + + getInitialData: function (option) { + var dimensions = completeDimensions(['value'], option.data || []); + + var list = new List(dimensions, this); + + list.initData(option.data); + + return list; + }, + + mergeOption: function (newOption) { + if (newOption.data) { + newOption = this._fillOption(newOption, this.getMapType()); + } + + MapSeries.superCall(this, 'mergeOption', newOption); + + this.updateSelectedMap(this.option.data); + }, + + /** + * If no host geo model, return null, which means using a + * inner exclusive geo model. + */ + getHostGeoModel: function () { + var geoIndex = this.option.geoIndex; + return geoIndex != null + ? this.dependentModels.geo[geoIndex] + : null; + }, + + getMapType: function () { + return (this.getHostGeoModel() || this).option.map; + }, + + _fillOption: function (option, mapName) { + // Shallow clone + option = zrUtil.extend({}, option); + + option.data = geoCreator.getFilledRegions(option.data, mapName); + + return option; + }, + + getRawValue: function (dataIndex) { + // Use value stored in data instead because it is calculated from multiple series + // FIXME Provide all value of multiple series ? + return this.getData().get('value', dataIndex); + }, + + /** + * Get model of region + * @param {string} name + * @return {module:echarts/model/Model} + */ + getRegionModel: function (regionName) { + var data = this.getData(); + return data.getItemModel(data.indexOfName(regionName)); + }, + + /** + * Map tooltip formatter + * + * @param {number} dataIndex + */ + formatTooltip: function (dataIndex) { + // FIXME orignalData and data is a bit confusing + var data = this.getData(); + var formattedValue = addCommas(this.getRawValue(dataIndex)); + var name = data.getName(dataIndex); + + var seriesGroup = this.seriesGroup; + var seriesNames = []; + for (var i = 0; i < seriesGroup.length; i++) { + var otherIndex = seriesGroup[i].originalData.indexOfName(name); + if (!isNaN(seriesGroup[i].originalData.get('value', otherIndex))) { + seriesNames.push( + encodeHTML(seriesGroup[i].name) + ); + } + } - type: 'radar', + return seriesNames.join(', ') + '
' + + encodeHTML(name + ' : ' + formattedValue); + }, - render: function (radarModel, ecModel, api) { - var group = this.group; - group.removeAll(); + /** + * @implement + */ + getTooltipPosition: function (dataIndex) { + if (dataIndex != null) { + var name = this.getData().getName(dataIndex); + var geo = this.coordinateSystem; + var region = geo.getRegion(name); - this._buildAxes(radarModel); - this._buildSplitLineAndArea(radarModel); + return region && geo.dataToPoint(region.center); + } }, - _buildAxes: function (radarModel) { - var radar = radarModel.coordinateSystem; - var indicatorAxes = radar.getIndicatorAxes(); - var axisBuilders = zrUtil.map(indicatorAxes, function (indicatorAxis) { - var axisBuilder = new AxisBuilder(indicatorAxis.model, { - position: [radar.cx, radar.cy], - rotation: indicatorAxis.angle, - labelDirection: -1, - tickDirection: -1, - nameDirection: 1 - }); - return axisBuilder; - }); + setZoom: function (zoom) { + this.option.zoom = zoom; + }, - zrUtil.each(axisBuilders, function (axisBuilder) { - zrUtil.each(axisBuilderAttrs, axisBuilder.add, axisBuilder); - this.group.add(axisBuilder.getGroup()); - }, this); + setCenter: function (center) { + this.option.center = center; }, - _buildSplitLineAndArea: function (radarModel) { - var radar = radarModel.coordinateSystem; - var indicatorAxes = radar.getIndicatorAxes(); - if (!indicatorAxes.length) { - return; - } - var shape = radarModel.get('shape'); - var splitLineModel = radarModel.getModel('splitLine'); - var splitAreaModel = radarModel.getModel('splitArea'); - var lineStyleModel = splitLineModel.getModel('lineStyle'); - var areaStyleModel = splitAreaModel.getModel('areaStyle'); + defaultOption: { + // 一级层叠 + zlevel: 0, + // 二级层叠 + z: 2, - var showSplitLine = splitLineModel.get('show'); - var showSplitArea = splitAreaModel.get('show'); - var splitLineColors = lineStyleModel.get('color'); - var splitAreaColors = areaStyleModel.get('color'); + coordinateSystem: 'geo', - splitLineColors = zrUtil.isArray(splitLineColors) ? splitLineColors : [splitLineColors]; - splitAreaColors = zrUtil.isArray(splitAreaColors) ? splitAreaColors : [splitAreaColors]; + // map should be explicitly specified since ec3. + map: '', - var splitLines = []; - var splitAreas = []; + // If `geoIndex` is not specified, a exclusive geo will be + // created. Otherwise use the specified geo component, and + // `map` and `mapType` are ignored. + // geoIndex: 0, - function getColorIndex(areaOrLine, areaOrLineColorList, idx) { - var colorIndex = idx % areaOrLineColorList.length; - areaOrLine[colorIndex] = areaOrLine[colorIndex] || []; - return colorIndex; - } + // 'center' | 'left' | 'right' | 'x%' | {number} + left: 'center', + // 'center' | 'top' | 'bottom' | 'x%' | {number} + top: 'center', + // right + // bottom + // width: + // height - if (shape === 'circle') { - var ticksRadius = indicatorAxes[0].getTicksCoords(); - var cx = radar.cx; - var cy = radar.cy; - for (var i = 0; i < ticksRadius.length; i++) { - if (showSplitLine) { - var colorIndex = getColorIndex(splitLines, splitLineColors, i); - splitLines[colorIndex].push(new graphic.Circle({ - shape: { - cx: cx, - cy: cy, - r: ticksRadius[i] - } - })); + // Aspect is width / height. Inited to be geoJson bbox aspect + // This parameter is used for scale this aspect + aspectScale: 0.75, + + ///// Layout with center and size + // If you wan't to put map in a fixed size box with right aspect ratio + // This two properties may more conveninet + // layoutCenter: [50%, 50%] + // layoutSize: 100 + + + // 数值合并方式,默认加和,可选为: + // 'sum' | 'average' | 'max' | 'min' + // mapValueCalculation: 'sum', + // 地图数值计算结果小数精度 + // mapValuePrecision: 0, + + + // 显示图例颜色标识(系列标识的小圆点),图例开启时有效 + showLegendSymbol: true, + // 选择模式,默认关闭,可选single,multiple + // selectedMode: false, + dataRangeHoverLink: true, + // 是否开启缩放及漫游模式 + // roam: false, + + // Define left-top, right-bottom coords to control view + // For example, [ [180, 90], [-180, -90] ], + // higher priority than center and zoom + boundingCoords: null, + + // Default on center of map + center: null, + + zoom: 1, + + scaleLimit: null, + + label: { + normal: { + show: false, + textStyle: { + color: '#000' } - if (showSplitArea && i < ticksRadius.length - 1) { - var colorIndex = getColorIndex(splitAreas, splitAreaColors, i); - splitAreas[colorIndex].push(new graphic.Ring({ - shape: { - cx: cx, - cy: cy, - r0: ticksRadius[i], - r: ticksRadius[i + 1] - } - })); + }, + emphasis: { + show: true, + textStyle: { + color: 'rgb(100,0,0)' } } + }, + // scaleLimit: null, + itemStyle: { + normal: { + // color: 各异, + borderWidth: 0.5, + borderColor: '#444', + areaColor: '#eee' + }, + // 也是选中样式 + emphasis: { + areaColor: 'rgba(255,215,0,0.8)' + } + } + } + + }); + + zrUtil.mixin(MapSeries, dataSelectableMixin); + + module.exports = MapSeries; + + +/***/ }, +/* 180 */ +/***/ function(module, exports, __webpack_require__) { + + + + var Geo = __webpack_require__(181); + + var layout = __webpack_require__(21); + var zrUtil = __webpack_require__(4); + var numberUtil = __webpack_require__(7); + + var mapDataStores = {}; + + /** + * Resize method bound to the geo + * @param {module:echarts/coord/geo/GeoModel|module:echarts/chart/map/MapModel} geoModel + * @param {module:echarts/ExtensionAPI} api + */ + function resizeGeo (geoModel, api) { + + var boundingCoords = geoModel.get('boundingCoords'); + if (boundingCoords != null) { + var leftTop = boundingCoords[0]; + var rightBottom = boundingCoords[1]; + if (isNaN(leftTop[0]) || isNaN(leftTop[1]) || isNaN(rightBottom[0]) || isNaN(rightBottom[1])) { + if (true) { + console.error('Invalid boundingCoords'); + } } - // Polyyon else { - var realSplitNumber = -1; - var axesTicksPoints = zrUtil.map(indicatorAxes, function (indicatorAxis, idx) { - var ticksCoords = indicatorAxis.getTicksCoords(); - realSplitNumber = Math.max(ticksCoords.length - 1, realSplitNumber); - return zrUtil.map(ticksCoords, function (tickCoord) { - return radar.coordToPoint(tickCoord, idx); - }); - }); + this.setBoundingRect(leftTop[0], leftTop[1], rightBottom[0] - leftTop[0], rightBottom[1] - leftTop[1]); + } + } - var prevPoints = []; - for (var i = 0; i <= realSplitNumber; i++) { - var points = []; - for (var j = 0; j < indicatorAxes.length; j++) { - points.push(axesTicksPoints[j][i]); - } - // Close - if (points[0]) { - points.push(points[0].slice()); - } - else { - if (true) { - console.error('Can\'t draw value axis ' + i); - } - } - if (showSplitLine) { - var colorIndex = getColorIndex(splitLines, splitLineColors, i); - splitLines[colorIndex].push(new graphic.Polyline({ - shape: { - points: points - } - })); - } - if (showSplitArea && prevPoints) { - var colorIndex = getColorIndex(splitAreas, splitAreaColors, i - 1); - splitAreas[colorIndex].push(new graphic.Polygon({ - shape: { - points: points.concat(prevPoints) - } - })); - } - prevPoints = points.slice().reverse(); + var rect = this.getBoundingRect(); + + var boxLayoutOption; + + var center = geoModel.get('layoutCenter'); + var size = geoModel.get('layoutSize'); + + var viewWidth = api.getWidth(); + var viewHeight = api.getHeight(); + + var aspectScale = geoModel.get('aspectScale') || 0.75; + var aspect = rect.width / rect.height * aspectScale; + + var useCenterAndSize = false; + + if (center && size) { + center = [ + numberUtil.parsePercent(center[0], viewWidth), + numberUtil.parsePercent(center[1], viewHeight) + ]; + size = numberUtil.parsePercent(size, Math.min(viewWidth, viewHeight)); + + if (!isNaN(center[0]) && !isNaN(center[1]) && !isNaN(size)) { + useCenterAndSize = true; + } + else { + if (true) { + console.warn('Given layoutCenter or layoutSize data are invalid. Use left/top/width/height instead.'); } } + } - var lineStyle = lineStyleModel.getLineStyle(); - var areaStyle = areaStyleModel.getAreaStyle(); - // Add splitArea before splitLine - zrUtil.each(splitAreas, function (splitAreas, idx) { - this.group.add(graphic.mergePath( - splitAreas, { - style: zrUtil.defaults({ - stroke: 'none', - fill: splitAreaColors[idx % splitAreaColors.length] - }, areaStyle), - silent: true - } - )); - }, this); + var viewRect; + if (useCenterAndSize) { + var viewRect = {}; + if (aspect > 1) { + // Width is same with size + viewRect.width = size; + viewRect.height = size / aspect; + } + else { + viewRect.height = size; + viewRect.width = size * aspect; + } + viewRect.y = center[1] - viewRect.height / 2; + viewRect.x = center[0] - viewRect.width / 2; + } + else { + // Use left/top/width/height + boxLayoutOption = geoModel.getBoxLayoutParams(); - zrUtil.each(splitLines, function (splitLines, idx) { - this.group.add(graphic.mergePath( - splitLines, { - style: zrUtil.defaults({ - fill: 'none', - stroke: splitLineColors[idx % splitLineColors.length] - }, lineStyle), - silent: true - } - )); - }, this); + // 0.75 rate + boxLayoutOption.aspect = aspect; + viewRect = layout.getLayoutRect(boxLayoutOption, { + width: viewWidth, + height: viewHeight + }); } - }); + this.setViewRect(viewRect.x, viewRect.y, viewRect.width, viewRect.height); -/***/ }, -/* 160 */ -/***/ function(module, exports, __webpack_require__) { + this.setCenter(geoModel.get('center')); + this.setZoom(geoModel.get('zoom')); + } - 'use strict'; + /** + * @param {module:echarts/coord/Geo} geo + * @param {module:echarts/model/Model} model + * @inner + */ + function setGeoCoords(geo, model) { + zrUtil.each(model.get('geoCoord'), function (geoCoord, name) { + geo.addGeoCoord(name, geoCoord); + }); + } + if (true) { + var mapNotExistsError = function (name) { + console.error('Map ' + name + ' not exists. You can download map file on http://echarts.baidu.com/download-map.html'); + }; + } - var SeriesModel = __webpack_require__(28); - var List = __webpack_require__(98); - var completeDimensions = __webpack_require__(103); - var zrUtil = __webpack_require__(4); - var encodeHTML = __webpack_require__(6).encodeHTML; + var geoCreator = { - var RadarSeries = SeriesModel.extend({ + // For deciding which dimensions to use when creating list data + dimensions: Geo.prototype.dimensions, - type: 'series.radar', + create: function (ecModel, api) { + var geoList = []; - dependencies: ['radar'], + // FIXME Create each time may be slow + ecModel.eachComponent('geo', function (geoModel, idx) { + var name = geoModel.get('map'); + var mapData = mapDataStores[name]; + if (true) { + if (!mapData) { + mapNotExistsError(name); + } + } + var geo = new Geo( + name + idx, name, + mapData && mapData.geoJson, mapData && mapData.specialAreas, + geoModel.get('nameMap') + ); + geo.zoomLimit = geoModel.get('scaleLimit'); + geoList.push(geo); + setGeoCoords(geo, geoModel); - // Overwrite - init: function (option) { - RadarSeries.superApply(this, 'init', arguments); + geoModel.coordinateSystem = geo; + geo.model = geoModel; - // Enable legend selection for each data item - // Use a function instead of direct access because data reference may changed - this.legendDataProvider = function () { - return this.getRawData(); - }; + // Inject resize method + geo.resize = resizeGeo; + + geo.resize(geoModel, api); + }); + + ecModel.eachSeries(function (seriesModel) { + var coordSys = seriesModel.get('coordinateSystem'); + if (coordSys === 'geo') { + var geoIndex = seriesModel.get('geoIndex') || 0; + seriesModel.coordinateSystem = geoList[geoIndex]; + } + }); + + // If has map series + var mapModelGroupBySeries = {}; + + ecModel.eachSeriesByType('map', function (seriesModel) { + if (!seriesModel.getHostGeoModel()) { + var mapType = seriesModel.getMapType(); + mapModelGroupBySeries[mapType] = mapModelGroupBySeries[mapType] || []; + mapModelGroupBySeries[mapType].push(seriesModel); + } + }); + + zrUtil.each(mapModelGroupBySeries, function (mapSeries, mapType) { + var mapData = mapDataStores[mapType]; + if (true) { + if (!mapData) { + mapNotExistsError(mapSeries[0].get('map')); + } + } + + var nameMapList = zrUtil.map(mapSeries, function (singleMapSeries) { + return singleMapSeries.get('nameMap'); + }); + var geo = new Geo( + mapType, mapType, + mapData && mapData.geoJson, mapData && mapData.specialAreas, + zrUtil.mergeAll(nameMapList) + ); + geo.zoomLimit = zrUtil.retrieve.apply(null, zrUtil.map(mapSeries, function (singleMapSeries) { + return singleMapSeries.get('scaleLimit'); + })); + geoList.push(geo); + + // Inject resize method + geo.resize = resizeGeo; + + geo.resize(mapSeries[0], api); + + zrUtil.each(mapSeries, function (singleMapSeries) { + singleMapSeries.coordinateSystem = geo; + + setGeoCoords(geo, singleMapSeries); + }); + }); + + return geoList; }, - getInitialData: function (option, ecModel) { - var data = option.data || []; - var dimensions = completeDimensions( - [], data, [], 'indicator_' - ); - var list = new List(dimensions, this); - list.initData(data); - return list; + /** + * @param {string} mapName + * @param {Object|string} geoJson + * @param {Object} [specialAreas] + * + * @example + * $.get('USA.json', function (geoJson) { + * echarts.registerMap('USA', geoJson); + * // Or + * echarts.registerMap('USA', { + * geoJson: geoJson, + * specialAreas: {} + * }) + * }); + */ + registerMap: function (mapName, geoJson, specialAreas) { + if (geoJson.geoJson && !geoJson.features) { + specialAreas = geoJson.specialAreas; + geoJson = geoJson.geoJson; + } + if (typeof geoJson === 'string') { + geoJson = (typeof JSON !== 'undefined' && JSON.parse) + ? JSON.parse(geoJson) : (new Function('return (' + geoJson + ');'))(); + } + mapDataStores[mapName] = { + geoJson: geoJson, + specialAreas: specialAreas + }; }, - formatTooltip: function (dataIndex) { - var value = this.getRawValue(dataIndex); - var coordSys = this.coordinateSystem; - var indicatorAxes = coordSys.getIndicatorAxes(); - var name = this.getData().getName(dataIndex); - return encodeHTML(name === '' ? this.name : name) + '
' - + zrUtil.map(indicatorAxes, function (axis, idx) { - return encodeHTML(axis.name + ' : ' + value[idx]); - }).join('
'); + /** + * @param {string} mapName + * @return {Object} + */ + getMap: function (mapName) { + return mapDataStores[mapName]; }, - defaultOption: { - zlevel: 0, - z: 2, - coordinateSystem: 'radar', - legendHoverLink: true, - radarIndex: 0, - lineStyle: { - normal: { - width: 2, - type: 'solid' + /** + * Fill given regions array + * @param {Array.} originRegionArr + * @param {string} mapName + * @return {Array} + */ + getFilledRegions: function (originRegionArr, mapName) { + // Not use the original + var regionsArr = (originRegionArr || []).slice(); + + var map = geoCreator.getMap(mapName); + var geoJson = map && map.geoJson; + if (!geoJson) { + if (true) { + mapNotExistsError(mapName); } - }, - label: { - normal: { - position: 'top' + return originRegionArr; + } + + var dataNameMap = {}; + var features = geoJson.features; + for (var i = 0; i < regionsArr.length; i++) { + dataNameMap[regionsArr[i].name] = regionsArr[i]; + } + + for (var i = 0; i < features.length; i++) { + var name = features[i].properties.name; + if (!dataNameMap[name]) { + regionsArr.push({ + name: name + }); } - }, - // areaStyle: { - // }, - // itemStyle: {} - symbol: 'emptyCircle', - symbolSize: 4 - // symbolRotate: null + } + return regionsArr; } - }); + }; - module.exports = RadarSeries; + // Inject methods into echarts + var echarts = __webpack_require__(1); + echarts.registerMap = geoCreator.registerMap; -/***/ }, -/* 161 */ -/***/ function(module, exports, __webpack_require__) { + echarts.getMap = geoCreator.getMap; - + echarts.parseGeoJSON = __webpack_require__(182); - var graphic = __webpack_require__(43); - var zrUtil = __webpack_require__(4); - var symbolUtil = __webpack_require__(107); + // TODO + echarts.loadMap = function () {}; - function normalizeSymbolSize(symbolSize) { - if (!zrUtil.isArray(symbolSize)) { - symbolSize = [+symbolSize, +symbolSize]; - } - return symbolSize; - } - module.exports = __webpack_require__(1).extendChartView({ - type: 'radar', + echarts.registerCoordinateSystem('geo', geoCreator); - render: function (seriesModel, ecModel, api) { - var polar = seriesModel.coordinateSystem; - var group = this.group; + module.exports = geoCreator; - var data = seriesModel.getData(); - var oldData = this._data; - function createSymbol(data, idx) { - var symbolType = data.getItemVisual(idx, 'symbol') || 'circle'; - var color = data.getItemVisual(idx, 'color'); - if (symbolType === 'none') { - return; - } - var symbolPath = symbolUtil.createSymbol( - symbolType, -0.5, -0.5, 1, 1, color - ); - symbolPath.attr({ - style: { - strokeNoScale: true - }, - z2: 100, - scale: normalizeSymbolSize(data.getItemVisual(idx, 'symbolSize')) - }); - return symbolPath; - } +/***/ }, +/* 181 */ +/***/ function(module, exports, __webpack_require__) { - function updateSymbols(oldPoints, newPoints, symbolGroup, data, idx, isInit) { - // Simply rerender all - symbolGroup.removeAll(); - for (var i = 0; i < newPoints.length - 1; i++) { - var symbolPath = createSymbol(data, idx); - if (symbolPath) { - symbolPath.__dimIdx = i; - if (oldPoints[i]) { - symbolPath.attr('position', oldPoints[i]); - graphic[isInit ? 'initProps' : 'updateProps']( - symbolPath, { - position: newPoints[i] - }, seriesModel, idx - ); - } - else { - symbolPath.attr('position', newPoints[i]); - } - symbolGroup.add(symbolPath); - } - } - } + - function getInitialPoints(points) { - return zrUtil.map(points, function (pt) { - return [polar.cx, polar.cy]; - }); - } - data.diff(oldData) - .add(function (idx) { - var points = data.getItemLayout(idx); - if (!points) { - return; - } - var polygon = new graphic.Polygon(); - var polyline = new graphic.Polyline(); - var target = { - shape: { - points: points - } - }; - polygon.shape.points = getInitialPoints(points); - polyline.shape.points = getInitialPoints(points); - graphic.initProps(polygon, target, seriesModel, idx); - graphic.initProps(polyline, target, seriesModel, idx); + var parseGeoJson = __webpack_require__(182); - var itemGroup = new graphic.Group(); - var symbolGroup = new graphic.Group(); - itemGroup.add(polyline); - itemGroup.add(polygon); - itemGroup.add(symbolGroup); + var zrUtil = __webpack_require__(4); - updateSymbols( - polyline.shape.points, points, symbolGroup, data, idx, true - ); + var BoundingRect = __webpack_require__(9); - data.setItemGraphicEl(idx, itemGroup); - }) - .update(function (newIdx, oldIdx) { - var itemGroup = oldData.getItemGraphicEl(oldIdx); - var polyline = itemGroup.childAt(0); - var polygon = itemGroup.childAt(1); - var symbolGroup = itemGroup.childAt(2); - var target = { - shape: { - points: data.getItemLayout(newIdx) - } - }; - if (!target.shape.points) { - return; - } - updateSymbols( - polyline.shape.points, target.shape.points, symbolGroup, data, newIdx, false - ); + var View = __webpack_require__(185); - graphic.updateProps(polyline, target, seriesModel); - graphic.updateProps(polygon, target, seriesModel); - data.setItemGraphicEl(newIdx, itemGroup); - }) - .remove(function (idx) { - group.remove(oldData.getItemGraphicEl(idx)); - }) - .execute(); + // Geo fix functions + var geoFixFuncs = [ + __webpack_require__(186), + __webpack_require__(187), + __webpack_require__(188) + ]; - data.eachItemGraphicEl(function (itemGroup, idx) { - var itemModel = data.getItemModel(idx); - var polyline = itemGroup.childAt(0); - var polygon = itemGroup.childAt(1); - var symbolGroup = itemGroup.childAt(2); - var color = data.getItemVisual(idx, 'color'); + /** + * [Geo description] + * @param {string} name Geo name + * @param {string} map Map type + * @param {Object} geoJson + * @param {Object} [specialAreas] + * Specify the positioned areas by left, top, width, height + * @param {Object.} [nameMap] + * Specify name alias + */ + function Geo(name, map, geoJson, specialAreas, nameMap) { - group.add(itemGroup); + View.call(this, name); - polyline.useStyle( - zrUtil.defaults( - itemModel.getModel('lineStyle.normal').getLineStyle(), - { - fill: 'none', - stroke: color - } - ) - ); - polyline.hoverStyle = itemModel.getModel('lineStyle.emphasis').getLineStyle(); + /** + * Map type + * @type {string} + */ + this.map = map; - var areaStyleModel = itemModel.getModel('areaStyle.normal'); - var hoverAreaStyleModel = itemModel.getModel('areaStyle.emphasis'); - var polygonIgnore = areaStyleModel.isEmpty() && areaStyleModel.parentModel.isEmpty(); - var hoverPolygonIgnore = hoverAreaStyleModel.isEmpty() && hoverAreaStyleModel.parentModel.isEmpty(); + this._nameCoordMap = {}; - hoverPolygonIgnore = hoverPolygonIgnore && polygonIgnore; - polygon.ignore = polygonIgnore; + this.loadGeoJson(geoJson, specialAreas, nameMap); + } - polygon.useStyle( - zrUtil.defaults( - areaStyleModel.getAreaStyle(), - { - fill: color, - opacity: 0.7 - } - ) - ); - polygon.hoverStyle = hoverAreaStyleModel.getAreaStyle(); + Geo.prototype = { - var itemStyle = itemModel.getModel('itemStyle.normal').getItemStyle(['color']); - var itemHoverStyle = itemModel.getModel('itemStyle.emphasis').getItemStyle(); - var labelModel = itemModel.getModel('label.normal'); - var labelHoverModel = itemModel.getModel('label.emphasis'); - symbolGroup.eachChild(function (symbolPath) { - symbolPath.setStyle(itemStyle); - symbolPath.hoverStyle = zrUtil.clone(itemHoverStyle); + constructor: Geo, - var defaultText = data.get(data.dimensions[symbolPath.__dimIdx], idx); - graphic.setText(symbolPath.style, labelModel, color); - symbolPath.setStyle({ - text: labelModel.get('show') ? zrUtil.retrieve( - seriesModel.getFormattedLabel( - idx, 'normal', null, symbolPath.__dimIdx - ), - defaultText - ) : '' - }); + type: 'geo', - graphic.setText(symbolPath.hoverStyle, labelHoverModel, color); - symbolPath.hoverStyle.text = labelHoverModel.get('show') ? zrUtil.retrieve( - seriesModel.getFormattedLabel( - idx, 'emphasis', null, symbolPath.__dimIdx - ), - defaultText - ) : ''; - }); + /** + * @param {Array.} + * @readOnly + */ + dimensions: ['lng', 'lat'], - function onEmphasis() { - polygon.attr('ignore', hoverPolygonIgnore); + /** + * If contain given lng,lat coord + * @param {Array.} + * @readOnly + */ + containCoord: function (coord) { + var regions = this.regions; + for (var i = 0; i < regions.length; i++) { + if (regions[i].contain(coord)) { + return true; } + } + return false; + }, + /** + * @param {Object} geoJson + * @param {Object} [specialAreas] + * Specify the positioned areas by left, top, width, height + * @param {Object.} [nameMap] + * Specify name alias + */ + loadGeoJson: function (geoJson, specialAreas, nameMap) { + // https://jsperf.com/try-catch-performance-overhead + try { + this.regions = geoJson ? parseGeoJson(geoJson) : []; + } + catch (e) { + throw 'Invalid geoJson format\n' + e.message; + } + specialAreas = specialAreas || {}; + nameMap = nameMap || {}; + var regions = this.regions; + var regionsMap = {}; + for (var i = 0; i < regions.length; i++) { + var regionName = regions[i].name; + // Try use the alias in nameMap + regionName = nameMap[regionName] || regionName; + regions[i].name = regionName; - function onNormal() { - polygon.attr('ignore', polygonIgnore); - } + regionsMap[regionName] = regions[i]; + // Add geoJson + this.addGeoCoord(regionName, regions[i].center); - itemGroup.off('mouseover').off('mouseout').off('normal').off('emphasis'); - itemGroup.on('emphasis', onEmphasis) - .on('mouseover', onEmphasis) - .on('normal', onNormal) - .on('mouseout', onNormal); + // Some area like Alaska in USA map needs to be tansformed + // to look better + var specialArea = specialAreas[regionName]; + if (specialArea) { + regions[i].transformTo( + specialArea.left, specialArea.top, specialArea.width, specialArea.height + ); + } + } - graphic.setHoverStyle(itemGroup); - }); + this._regionsMap = regionsMap; - this._data = data; - }, + this._rect = null; - remove: function () { - this.group.removeAll(); - this._data = null; + zrUtil.each(geoFixFuncs, function (fixFunc) { + fixFunc(this); + }, this); }, - dispose: function () {} - }); - - -/***/ }, -/* 162 */ -/***/ function(module, exports) { - - + // Overwrite + transformTo: function (x, y, width, height) { + var rect = this.getBoundingRect(); - module.exports = function (ecModel) { - ecModel.eachSeriesByType('radar', function (seriesModel) { - var data = seriesModel.getData(); - var points = []; - var coordSys = seriesModel.coordinateSystem; - if (!coordSys) { - return; - } + rect = rect.clone(); + // Longitute is inverted + rect.y = -rect.y - rect.height; - function pointsConverter(val, idx) { - points[idx] = points[idx] || []; - points[idx][i] = coordSys.dataToPoint(val, i); - } - for (var i = 0; i < coordSys.getIndicatorAxes().length; i++) { - var dim = data.dimensions[i]; - data.each(dim, pointsConverter); - } + var viewTransform = this._viewTransform; - data.each(function (idx) { - // Close polygon - points[idx][0] && points[idx].push(points[idx][0].slice()); - data.setItemLayout(idx, points[idx]); - }); - }); - }; + viewTransform.transform = rect.calculateTransform( + new BoundingRect(x, y, width, height) + ); + viewTransform.decomposeTransform(); -/***/ }, -/* 163 */ -/***/ function(module, exports, __webpack_require__) { + var scale = viewTransform.scale; + scale[1] = -scale[1]; - // Backward compat for radar chart in 2 + viewTransform.updateTransform(); + this._updateTransform(); + }, - var zrUtil = __webpack_require__(4); + /** + * @param {string} name + * @return {module:echarts/coord/geo/Region} + */ + getRegion: function (name) { + return this._regionsMap[name]; + }, - module.exports = function (option) { - var polarOptArr = option.polar; - if (polarOptArr) { - if (!zrUtil.isArray(polarOptArr)) { - polarOptArr = [polarOptArr]; - } - var polarNotRadar = []; - zrUtil.each(polarOptArr, function (polarOpt, idx) { - if (polarOpt.indicator) { - if (polarOpt.type && !polarOpt.shape) { - polarOpt.shape = polarOpt.type; - } - option.radar = option.radar || []; - if (!zrUtil.isArray(option.radar)) { - option.radar = [option.radar]; - } - option.radar.push(polarOpt); - } - else { - polarNotRadar.push(polarOpt); + getRegionByCoord: function (coord) { + var regions = this.regions; + for (var i = 0; i < regions.length; i++) { + if (regions[i].contain(coord)) { + return regions[i]; } - }); - option.polar = polarNotRadar; - } - zrUtil.each(option.series, function (seriesOpt) { - if (seriesOpt.type === 'radar' && seriesOpt.polarIndex) { - seriesOpt.radarIndex = seriesOpt.polarIndex; } - }); - }; + }, + /** + * Add geoCoord for indexing by name + * @param {string} name + * @param {Array.} geoCoord + */ + addGeoCoord: function (name, geoCoord) { + this._nameCoordMap[name] = geoCoord; + }, -/***/ }, -/* 164 */ -/***/ function(module, exports, __webpack_require__) { + /** + * Get geoCoord by name + * @param {string} name + * @return {Array.} + */ + getGeoCoord: function (name) { + return this._nameCoordMap[name]; + }, - + // Overwrite + getBoundingRect: function () { + if (this._rect) { + return this._rect; + } + var rect; - var echarts = __webpack_require__(1); - var PRIORITY = echarts.PRIORITY; + var regions = this.regions; + for (var i = 0; i < regions.length; i++) { + var regionRect = regions[i].getBoundingRect(); + rect = rect || regionRect.clone(); + rect.union(regionRect); + } + // FIXME Always return new ? + return (this._rect = rect || new BoundingRect(0, 0, 0, 0)); + }, - __webpack_require__(165); + /** + * Convert series data to a list of points + * @param {module:echarts/data/List} data + * @param {boolean} stack + * @return {Array} + * Return list of points. For example: + * `[[10, 10], [20, 20], [30, 30]]` + */ + dataToPoints: function (data) { + var item = []; + return data.mapArray(['lng', 'lat'], function (lon, lat) { + item[0] = lon; + item[1] = lat; + return this.dataToPoint(item); + }, this); + }, - __webpack_require__(175); + // Overwrite + /** + * @param {string|Array.} data + * @return {Array.} + */ + dataToPoint: function (data) { + if (typeof data === 'string') { + // Map area name to geoCoord + data = this.getGeoCoord(data); + } + if (data) { + return View.prototype.dataToPoint.call(this, data); + } + }, - __webpack_require__(179); + /** + * @override + * @implements + * see {module:echarts/CoodinateSystem} + */ + convertToPixel: zrUtil.curry(doConvert, 'dataToPoint'), - __webpack_require__(166); + /** + * @override + * @implements + * see {module:echarts/CoodinateSystem} + */ + convertFromPixel: zrUtil.curry(doConvert, 'pointToData') + + }; - echarts.registerLayout(__webpack_require__(181)); + zrUtil.mixin(Geo, View); - echarts.registerVisual(__webpack_require__(182)); + function doConvert(methodName, ecModel, finder, value) { + var geoModel = finder.geoModel; + var seriesModel = finder.seriesModel; - echarts.registerProcessor(PRIORITY.PROCESSOR.STATISTIC, __webpack_require__(183)); + var coordSys = geoModel + ? geoModel.coordinateSystem + : seriesModel + ? ( + seriesModel.coordinateSystem // For map. + || (seriesModel.getReferringComponents('geo')[0] || {}).coordinateSystem + ) + : null; - echarts.registerPreprocessor(__webpack_require__(184)); + return coordSys === this ? coordSys[methodName](value) : null; + } - __webpack_require__(145)('map', [{ - type: 'mapToggleSelect', - event: 'mapselectchanged', - method: 'toggleSelected' - }, { - type: 'mapSelect', - event: 'mapselected', - method: 'select' - }, { - type: 'mapUnSelect', - event: 'mapunselected', - method: 'unSelect' - }]); + module.exports = Geo; /***/ }, -/* 165 */ +/* 182 */ /***/ function(module, exports, __webpack_require__) { - + /** + * Parse and decode geo json + * @module echarts/coord/geo/parseGeoJson + */ + - var List = __webpack_require__(98); - var SeriesModel = __webpack_require__(28); var zrUtil = __webpack_require__(4); - var completeDimensions = __webpack_require__(103); - var formatUtil = __webpack_require__(6); - var encodeHTML = formatUtil.encodeHTML; - var addCommas = formatUtil.addCommas; + var Region = __webpack_require__(183); - var dataSelectableMixin = __webpack_require__(143); + function decode(json) { + if (!json.UTF8Encoding) { + return json; + } + var features = json.features; - var geoCreator = __webpack_require__(166); + for (var f = 0; f < features.length; f++) { + var feature = features[f]; + var geometry = feature.geometry; + var coordinates = geometry.coordinates; + var encodeOffsets = geometry.encodeOffsets; - var MapSeries = SeriesModel.extend({ + for (var c = 0; c < coordinates.length; c++) { + var coordinate = coordinates[c]; - type: 'series.map', + if (geometry.type === 'Polygon') { + coordinates[c] = decodePolygon( + coordinate, + encodeOffsets[c] + ); + } + else if (geometry.type === 'MultiPolygon') { + for (var c2 = 0; c2 < coordinate.length; c2++) { + var polygon = coordinate[c2]; + coordinate[c2] = decodePolygon( + polygon, + encodeOffsets[c][c2] + ); + } + } + } + } + // Has been decoded + json.UTF8Encoding = false; + return json; + } - dependencies: ['geo'], + function decodePolygon(coordinate, encodeOffsets) { + var result = []; + var prevX = encodeOffsets[0]; + var prevY = encodeOffsets[1]; - layoutMode: 'box', + for (var i = 0; i < coordinate.length; i += 2) { + var x = coordinate.charCodeAt(i) - 64; + var y = coordinate.charCodeAt(i + 1) - 64; + // ZigZag decoding + x = (x >> 1) ^ (-(x & 1)); + y = (y >> 1) ^ (-(y & 1)); + // Delta deocding + x += prevX; + y += prevY; - /** - * Only first map series of same mapType will drawMap - * @type {boolean} - */ - needsDrawMap: false, + prevX = x; + prevY = y; + // Dequantize + result.push([x / 1024, y / 1024]); + } - /** - * Group of all map series with same mapType - * @type {boolean} - */ - seriesGroup: [], + return result; + } - init: function (option) { + /** + * @alias module:echarts/coord/geo/parseGeoJson + * @param {Object} geoJson + * @return {module:zrender/container/Group} + */ + module.exports = function (geoJson) { - option = this._fillOption(option, this.getMapType()); - this.option = option; + decode(geoJson); - MapSeries.superApply(this, 'init', arguments); + return zrUtil.map(zrUtil.filter(geoJson.features, function (featureObj) { + // Output of mapshaper may have geometry null + return featureObj.geometry + && featureObj.properties + && featureObj.geometry.coordinates.length > 0; + }), function (featureObj) { + var properties = featureObj.properties; + var geo = featureObj.geometry; + + var coordinates = geo.coordinates; + + var geometries = []; + if (geo.type === 'Polygon') { + geometries.push({ + type: 'polygon', + // According to the GeoJSON specification. + // First must be exterior, and the rest are all interior(holes). + exterior: coordinates[0], + interiors: coordinates.slice(1) + }); + } + if (geo.type === 'MultiPolygon') { + zrUtil.each(coordinates, function (item) { + if (item[0]) { + geometries.push({ + type: 'polygon', + exterior: item[0], + interiors: item.slice(1) + }); + } + }); + } - this.updateSelectedMap(option.data); - }, + var region = new Region( + properties.name, + geometries, + properties.cp + ); + region.properties = properties; + return region; + }); + }; - getInitialData: function (option) { - var dimensions = completeDimensions(['value'], option.data || []); - var list = new List(dimensions, this); +/***/ }, +/* 183 */ +/***/ function(module, exports, __webpack_require__) { - list.initData(option.data); + /** + * @module echarts/coord/geo/Region + */ - return list; - }, - mergeOption: function (newOption) { - if (newOption.data) { - newOption = this._fillOption(newOption, this.getMapType()); - } + var polygonContain = __webpack_require__(184); - MapSeries.superCall(this, 'mergeOption', newOption); + var BoundingRect = __webpack_require__(9); - this.updateSelectedMap(this.option.data); - }, + var bbox = __webpack_require__(52); + var vec2 = __webpack_require__(10); + + /** + * @param {string} name + * @param {Array} geometries + * @param {Array.} cp + */ + function Region(name, geometries, cp) { /** - * If no host geo model, return null, which means using a - * inner exclusive geo model. + * @type {string} + * @readOnly */ - getHostGeoModel: function () { - var geoIndex = this.option.geoIndex; - return geoIndex != null - ? this.dependentModels.geo[geoIndex] - : null; - }, - - getMapType: function () { - return (this.getHostGeoModel() || this).option.map; - }, + this.name = name; - _fillOption: function (option, mapName) { - // Shallow clone - option = zrUtil.extend({}, option); + /** + * @type {Array.} + * @readOnly + */ + this.geometries = geometries; - option.data = geoCreator.getFilledRegions(option.data, mapName); + if (!cp) { + var rect = this.getBoundingRect(); + cp = [ + rect.x + rect.width / 2, + rect.y + rect.height / 2 + ]; + } + else { + cp = [cp[0], cp[1]]; + } + /** + * @type {Array.} + */ + this.center = cp; + } - return option; - }, + Region.prototype = { - getRawValue: function (dataIndex) { - // Use value stored in data instead because it is calculated from multiple series - // FIXME Provide all value of multiple series ? - return this.getData().get('value', dataIndex); - }, + constructor: Region, - /** - * Get model of region - * @param {string} name - * @return {module:echarts/model/Model} - */ - getRegionModel: function (regionName) { - var data = this.getData(); - return data.getItemModel(data.indexOfName(regionName)); - }, + properties: null, /** - * Map tooltip formatter - * - * @param {number} dataIndex + * @return {module:zrender/core/BoundingRect} */ - formatTooltip: function (dataIndex) { - // FIXME orignalData and data is a bit confusing - var data = this.getData(); - var formattedValue = addCommas(this.getRawValue(dataIndex)); - var name = data.getName(dataIndex); + getBoundingRect: function () { + var rect = this._rect; + if (rect) { + return rect; + } - var seriesGroup = this.seriesGroup; - var seriesNames = []; - for (var i = 0; i < seriesGroup.length; i++) { - var otherIndex = seriesGroup[i].originalData.indexOfName(name); - if (!isNaN(seriesGroup[i].originalData.get('value', otherIndex))) { - seriesNames.push( - encodeHTML(seriesGroup[i].name) - ); + var MAX_NUMBER = Number.MAX_VALUE; + var min = [MAX_NUMBER, MAX_NUMBER]; + var max = [-MAX_NUMBER, -MAX_NUMBER]; + var min2 = []; + var max2 = []; + var geometries = this.geometries; + for (var i = 0; i < geometries.length; i++) { + // Only support polygon + if (geometries[i].type !== 'polygon') { + continue; } + // Doesn't consider hole + var exterior = geometries[i].exterior; + bbox.fromPoints(exterior, min2, max2); + vec2.min(min, min, min2); + vec2.max(max, max, max2); + } + // No data + if (i === 0) { + min[0] = min[1] = max[0] = max[1] = 0; } - return seriesNames.join(', ') + '
' - + encodeHTML(name + ' : ' + formattedValue); + return (this._rect = new BoundingRect( + min[0], min[1], max[0] - min[0], max[1] - min[1] + )); }, /** - * @implement + * @param {} coord + * @return {boolean} */ - getTooltipPosition: function (dataIndex) { - if (dataIndex != null) { - var name = this.getData().getName(dataIndex); - var geo = this.coordinateSystem; - var region = geo.getRegion(name); - - return region && geo.dataToPoint(region.center); + contain: function (coord) { + var rect = this.getBoundingRect(); + var geometries = this.geometries; + if (!rect.contain(coord[0], coord[1])) { + return false; } + loopGeo: for (var i = 0, len = geometries.length; i < len; i++) { + // Only support polygon. + if (geometries[i].type !== 'polygon') { + continue; + } + var exterior = geometries[i].exterior; + var interiors = geometries[i].interiors; + if (polygonContain.contain(exterior, coord[0], coord[1])) { + // Not in the region if point is in the hole. + for (var k = 0; k < (interiors ? interiors.length : 0); k++) { + if (polygonContain.contain(interiors[k])) { + continue loopGeo; + } + } + return true; + } + } + return false; }, - setZoom: function (zoom) { - this.option.zoom = zoom; - }, - - setCenter: function (center) { - this.option.center = center; - }, - - defaultOption: { - // 一级层叠 - zlevel: 0, - // 二级层叠 - z: 2, - - coordinateSystem: 'geo', - - // map should be explicitly specified since ec3. - map: '', - - // If `geoIndex` is not specified, a exclusive geo will be - // created. Otherwise use the specified geo component, and - // `map` and `mapType` are ignored. - // geoIndex: 0, + transformTo: function (x, y, width, height) { + var rect = this.getBoundingRect(); + var aspect = rect.width / rect.height; + if (!width) { + width = aspect * height; + } + else if (!height) { + height = width / aspect ; + } + var target = new BoundingRect(x, y, width, height); + var transform = rect.calculateTransform(target); + var geometries = this.geometries; + for (var i = 0; i < geometries.length; i++) { + // Only support polygon. + if (geometries[i].type !== 'polygon') { + continue; + } + var exterior = geometries[i].exterior; + var interiors = geometries[i].interiors; + for (var p = 0; p < exterior.length; p++) { + vec2.applyTransform(exterior[p], exterior[p], transform); + } + for (var h = 0; h < (interiors ? interiors.length : 0); h++) { + for (var p = 0; p < interiors[h].length; p++) { + vec2.applyTransform(interiors[h][p], interiors[h][p], transform); + } + } + } + rect = this._rect; + rect.copy(target); + // Update center + this.center = [ + rect.x + rect.width / 2, + rect.y + rect.height / 2 + ]; + } + }; - // 'center' | 'left' | 'right' | 'x%' | {number} - left: 'center', - // 'center' | 'top' | 'bottom' | 'x%' | {number} - top: 'center', - // right - // bottom - // width: - // height + module.exports = Region; - // Aspect is width / height. Inited to be geoJson bbox aspect - // This parameter is used for scale this aspect - aspectScale: 0.75, - ///// Layout with center and size - // If you wan't to put map in a fixed size box with right aspect ratio - // This two properties may more conveninet - // layoutCenter: [50%, 50%] - // layoutSize: 100 +/***/ }, +/* 184 */ +/***/ function(module, exports, __webpack_require__) { + - // 数值合并方式,默认加和,可选为: - // 'sum' | 'average' | 'max' | 'min' - // mapValueCalculation: 'sum', - // 地图数值计算结果小数精度 - // mapValuePrecision: 0, + var windingLine = __webpack_require__(59); + var EPSILON = 1e-8; - // 显示图例颜色标识(系列标识的小圆点),图例开启时有效 - showLegendSymbol: true, - // 选择模式,默认关闭,可选single,multiple - // selectedMode: false, - dataRangeHoverLink: true, - // 是否开启缩放及漫游模式 - // roam: false, + function isAroundEqual(a, b) { + return Math.abs(a - b) < EPSILON; + } - // Default on center of map - center: null, + function contain(points, x, y) { + var w = 0; + var p = points[0]; - zoom: 1, + if (!p) { + return false; + } - scaleLimit: null, + for (var i = 1; i < points.length; i++) { + var p2 = points[i]; + w += windingLine(p[0], p[1], p2[0], p2[1], x, y); + p = p2; + } - label: { - normal: { - show: false, - textStyle: { - color: '#000' - } - }, - emphasis: { - show: true, - textStyle: { - color: 'rgb(100,0,0)' - } - } - }, - // scaleLimit: null, - itemStyle: { - normal: { - // color: 各异, - borderWidth: 0.5, - borderColor: '#444', - areaColor: '#eee' - }, - // 也是选中样式 - emphasis: { - areaColor: 'rgba(255,215,0,0.8)' - } - } + // Close polygon + var p0 = points[0]; + if (!isAroundEqual(p[0], p0[0]) || !isAroundEqual(p[1], p0[1])) { + w += windingLine(p[0], p[1], p0[0], p0[1], x, y); } - }); + return w !== 0; + } - zrUtil.mixin(MapSeries, dataSelectableMixin); - module.exports = MapSeries; + module.exports = { + contain: contain + }; /***/ }, -/* 166 */ +/* 185 */ /***/ function(module, exports, __webpack_require__) { - + /** + * Simple view coordinate system + * Mapping given x, y to transformd view x, y + */ - var Geo = __webpack_require__(167); - var layout = __webpack_require__(21); + var vector = __webpack_require__(10); + var matrix = __webpack_require__(11); + + var Transformable = __webpack_require__(34); var zrUtil = __webpack_require__(4); - var numberUtil = __webpack_require__(7); - var mapDataStores = {}; + var BoundingRect = __webpack_require__(9); - /** - * Resize method bound to the geo - * @param {module:echarts/coord/geo/GeoModel|module:echarts/chart/map/MapModel} geoModel - * @param {module:echarts/ExtensionAPI} api - */ - function resizeGeo (geoModel, api) { - var rect = this.getBoundingRect(); + var v2ApplyTransform = vector.applyTransform; - var boxLayoutOption; + // Dummy transform node + function TransformDummy() { + Transformable.call(this); + } + zrUtil.mixin(TransformDummy, Transformable); - var center = geoModel.get('layoutCenter'); - var size = geoModel.get('layoutSize'); + function View(name) { + /** + * @type {string} + */ + this.name = name; - var viewWidth = api.getWidth(); - var viewHeight = api.getHeight(); + /** + * @type {Object} + */ + this.zoomLimit; - var aspectScale = geoModel.get('aspectScale') || 0.75; - var aspect = rect.width / rect.height * aspectScale; + Transformable.call(this); - var useCenterAndSize = false; - if (center && size) { - center = [ - numberUtil.parsePercent(center[0], viewWidth), - numberUtil.parsePercent(center[1], viewHeight) - ]; - size = numberUtil.parsePercent(size, Math.min(viewWidth, viewHeight)); + this._roamTransform = new TransformDummy(); - if (!isNaN(center[0]) && !isNaN(center[1]) && !isNaN(size)) { - useCenterAndSize = true; - } - else { - if (true) { - console.warn('Given layoutCenter or layoutSize data are invalid. Use left/top/width/height instead.'); - } - } - } + this._viewTransform = new TransformDummy(); - var viewRect; - if (useCenterAndSize) { - var viewRect = {}; - if (aspect > 1) { - // Width is same with size - viewRect.width = size; - viewRect.height = size / aspect; - } - else { - viewRect.height = size; - viewRect.width = size * aspect; - } - viewRect.y = center[1] - viewRect.height / 2; - viewRect.x = center[0] - viewRect.width / 2; - } - else { - // Use left/top/width/height - boxLayoutOption = geoModel.getBoxLayoutParams(); + this._center; + this._zoom; + } - // 0.75 rate - boxLayoutOption.aspect = aspect; + View.prototype = { - viewRect = layout.getLayoutRect(boxLayoutOption, { - width: viewWidth, - height: viewHeight - }); - } + constructor: View, + + type: 'view', - this.setViewRect(viewRect.x, viewRect.y, viewRect.width, viewRect.height); + /** + * @param {Array.} + * @readOnly + */ + dimensions: ['x', 'y'], - this.setCenter(geoModel.get('center')); - this.setZoom(geoModel.get('zoom')); - } + /** + * Set bounding rect + * @param {number} x + * @param {number} y + * @param {number} width + * @param {number} height + */ - /** - * @param {module:echarts/coord/Geo} geo - * @param {module:echarts/model/Model} model - * @inner - */ - function setGeoCoords(geo, model) { - zrUtil.each(model.get('geoCoord'), function (geoCoord, name) { - geo.addGeoCoord(name, geoCoord); - }); - } + // PENDING to getRect + setBoundingRect: function (x, y, width, height) { + this._rect = new BoundingRect(x, y, width, height); + return this._rect; + }, - if (true) { - var mapNotExistsError = function (name) { - console.error('Map ' + name + ' not exists. You can download map file on http://echarts.baidu.com/download-map.html'); - }; - } + /** + * @return {module:zrender/core/BoundingRect} + */ + // PENDING to getRect + getBoundingRect: function () { + return this._rect; + }, - var geoCreator = { + /** + * @param {number} x + * @param {number} y + * @param {number} width + * @param {number} height + */ + setViewRect: function (x, y, width, height) { + this.transformTo(x, y, width, height); + this._viewRect = new BoundingRect(x, y, width, height); + }, - // For deciding which dimensions to use when creating list data - dimensions: Geo.prototype.dimensions, + /** + * Transformed to particular position and size + * @param {number} x + * @param {number} y + * @param {number} width + * @param {number} height + */ + transformTo: function (x, y, width, height) { + var rect = this.getBoundingRect(); + var viewTransform = this._viewTransform; - create: function (ecModel, api) { - var geoList = []; + viewTransform.transform = rect.calculateTransform( + new BoundingRect(x, y, width, height) + ); - // FIXME Create each time may be slow - ecModel.eachComponent('geo', function (geoModel, idx) { - var name = geoModel.get('map'); - var mapData = mapDataStores[name]; - if (true) { - if (!mapData) { - mapNotExistsError(name); - } - } - var geo = new Geo( - name + idx, name, - mapData && mapData.geoJson, mapData && mapData.specialAreas, - geoModel.get('nameMap') - ); - geo.zoomLimit = geoModel.get('scaleLimit'); - geoList.push(geo); + viewTransform.decomposeTransform(); - setGeoCoords(geo, geoModel); + this._updateTransform(); + }, - geoModel.coordinateSystem = geo; - geo.model = geoModel; + /** + * Set center of view + * @param {Array.} [centerCoord] + */ + setCenter: function (centerCoord) { + if (!centerCoord) { + return; + } + this._center = centerCoord; - // Inject resize method - geo.resize = resizeGeo; + this._updateCenterAndZoom(); + }, - geo.resize(geoModel, api); - }); + /** + * @param {number} zoom + */ + setZoom: function (zoom) { + zoom = zoom || 1; - ecModel.eachSeries(function (seriesModel) { - var coordSys = seriesModel.get('coordinateSystem'); - if (coordSys === 'geo') { - var geoIndex = seriesModel.get('geoIndex') || 0; - seriesModel.coordinateSystem = geoList[geoIndex]; + var zoomLimit = this.zoomLimit; + if (zoomLimit) { + if (zoomLimit.max != null) { + zoom = Math.min(zoomLimit.max, zoom); } - }); + if (zoomLimit.min != null) { + zoom = Math.max(zoomLimit.min, zoom); + } + } + this._zoom = zoom; - // If has map series - var mapModelGroupBySeries = {}; + this._updateCenterAndZoom(); + }, - ecModel.eachSeriesByType('map', function (seriesModel) { - if (!seriesModel.getHostGeoModel()) { - var mapType = seriesModel.getMapType(); - mapModelGroupBySeries[mapType] = mapModelGroupBySeries[mapType] || []; - mapModelGroupBySeries[mapType].push(seriesModel); - } - }); + /** + * Get default center without roam + */ + getDefaultCenter: function () { + // Rect before any transform + var rawRect = this.getBoundingRect(); + var cx = rawRect.x + rawRect.width / 2; + var cy = rawRect.y + rawRect.height / 2; - zrUtil.each(mapModelGroupBySeries, function (mapSeries, mapType) { - var mapData = mapDataStores[mapType]; - if (true) { - if (!mapData) { - mapNotExistsError(mapSeries[0].get('map')); - } - } + return [cx, cy]; + }, - var nameMapList = zrUtil.map(mapSeries, function (singleMapSeries) { - return singleMapSeries.get('nameMap'); - }); - var geo = new Geo( - mapType, mapType, - mapData && mapData.geoJson, mapData && mapData.specialAreas, - zrUtil.mergeAll(nameMapList) - ); - geo.zoomLimit = zrUtil.retrieve.apply(null, zrUtil.map(mapSeries, function (singleMapSeries) { - return singleMapSeries.get('scaleLimit'); - })); - geoList.push(geo); + getCenter: function () { + return this._center || this.getDefaultCenter(); + }, - // Inject resize method - geo.resize = resizeGeo; + getZoom: function () { + return this._zoom || 1; + }, - geo.resize(mapSeries[0], api); + /** + * @return {Array.} originRegionArr - * @param {string} mapName - * @return {Array} + * Get view rect after roam transform + * @return {module:zrender/core/BoundingRect} */ - getFilledRegions: function (originRegionArr, mapName) { - // Not use the original - var regionsArr = (originRegionArr || []).slice(); + getViewRectAfterRoam: function () { + var rect = this.getBoundingRect().clone(); + rect.applyTransform(this.transform); + return rect; + }, - var map = geoCreator.getMap(mapName); - var geoJson = map && map.geoJson; - if (!geoJson) { - if (true) { - mapNotExistsError(mapName); - } - return originRegionArr; - } + /** + * Convert a single (lon, lat) data item to (x, y) point. + * @param {Array.} data + * @return {Array.} + */ + dataToPoint: function (data) { + var transform = this.transform; + return transform + ? v2ApplyTransform([], data, transform) + : [data[0], data[1]]; + }, - var dataNameMap = {}; - var features = geoJson.features; - for (var i = 0; i < regionsArr.length; i++) { - dataNameMap[regionsArr[i].name] = regionsArr[i]; - } + /** + * Convert a (x, y) point to (lon, lat) data + * @param {Array.} point + * @return {Array.} + */ + pointToData: function (point) { + var invTransform = this.invTransform; + return invTransform + ? v2ApplyTransform([], point, invTransform) + : [point[0], point[1]]; + }, - for (var i = 0; i < features.length; i++) { - var name = features[i].properties.name; - if (!dataNameMap[name]) { - regionsArr.push({ - name: name - }); - } - } - return regionsArr; - } - }; + /** + * @implements + * see {module:echarts/CoodinateSystem} + */ + convertToPixel: zrUtil.curry(doConvert, 'dataToPoint'), - // Inject methods into echarts - var echarts = __webpack_require__(1); + /** + * @implements + * see {module:echarts/CoodinateSystem} + */ + convertFromPixel: zrUtil.curry(doConvert, 'pointToData'), - echarts.registerMap = geoCreator.registerMap; + /** + * @implements + * see {module:echarts/CoodinateSystem} + */ + containPoint: function (point) { + return this.getViewRectAfterRoam().contain(point[0], point[1]); + } - echarts.getMap = geoCreator.getMap; + /** + * @return {number} + */ + // getScalarScale: function () { + // // Use determinant square root of transform to mutiply scalar + // var m = this.transform; + // var det = Math.sqrt(Math.abs(m[0] * m[3] - m[2] * m[1])); + // return det; + // } + }; - // TODO - echarts.loadMap = function () {}; + zrUtil.mixin(View, Transformable); - echarts.registerCoordinateSystem('geo', geoCreator); + function doConvert(methodName, ecModel, finder, value) { + var seriesModel = finder.seriesModel; + var coordSys = seriesModel ? seriesModel.coordinateSystem : null; // e.g., graph. + return coordSys === this ? coordSys[methodName](value) : null; + } - module.exports = geoCreator; + module.exports = View; /***/ }, -/* 167 */ +/* 186 */ /***/ function(module, exports, __webpack_require__) { - + // Fix for 南海诸岛 - var parseGeoJson = __webpack_require__(168); + var Region = __webpack_require__(183); var zrUtil = __webpack_require__(4); - var BoundingRect = __webpack_require__(9); - - var View = __webpack_require__(171); - + var geoCoord = [126, 25]; - // Geo fix functions - var geoFixFuncs = [ - __webpack_require__(172), - __webpack_require__(173), - __webpack_require__(174) + var points = [ + [[0,3.5],[7,11.2],[15,11.9],[30,7],[42,0.7],[52,0.7], + [56,7.7],[59,0.7],[64,0.7],[64,0],[5,0],[0,3.5]], + [[13,16.1],[19,14.7],[16,21.7],[11,23.1],[13,16.1]], + [[12,32.2],[14,38.5],[15,38.5],[13,32.2],[12,32.2]], + [[16,47.6],[12,53.2],[13,53.2],[18,47.6],[16,47.6]], + [[6,64.4],[8,70],[9,70],[8,64.4],[6,64.4]], + [[23,82.6],[29,79.8],[30,79.8],[25,82.6],[23,82.6]], + [[37,70.7],[43,62.3],[44,62.3],[39,70.7],[37,70.7]], + [[48,51.1],[51,45.5],[53,45.5],[50,51.1],[48,51.1]], + [[51,35],[51,28.7],[53,28.7],[53,35],[51,35]], + [[52,22.4],[55,17.5],[56,17.5],[53,22.4],[52,22.4]], + [[58,12.6],[62,7],[63,7],[60,12.6],[58,12.6]], + [[0,3.5],[0,93.1],[64,93.1],[64,0],[63,0],[63,92.4], + [1,92.4],[1,3.5],[0,3.5]] ]; + for (var i = 0; i < points.length; i++) { + for (var k = 0; k < points[i].length; k++) { + points[i][k][0] /= 10.5; + points[i][k][1] /= -10.5 / 0.75; - /** - * [Geo description] - * @param {string} name Geo name - * @param {string} map Map type - * @param {Object} geoJson - * @param {Object} [specialAreas] - * Specify the positioned areas by left, top, width, height - * @param {Object.} [nameMap] - * Specify name alias - */ - function Geo(name, map, geoJson, specialAreas, nameMap) { + points[i][k][0] += geoCoord[0]; + points[i][k][1] += geoCoord[1]; + } + } + module.exports = function (geo) { + if (geo.map === 'china') { + geo.regions.push(new Region( + '南海诸岛', + zrUtil.map(points, function (exterior) { + return { + type: 'polygon', + exterior: exterior + }; + }), geoCoord + )); + } + }; - View.call(this, name); - /** - * Map type - * @type {string} - */ - this.map = map; +/***/ }, +/* 187 */ +/***/ function(module, exports, __webpack_require__) { - this._nameCoordMap = {}; + - this.loadGeoJson(geoJson, specialAreas, nameMap); - } + var zrUtil = __webpack_require__(4); - Geo.prototype = { + var coordsOffsetMap = { + '南海诸岛' : [32, 80], + // 全国 + '广东': [0, -10], + '香港': [10, 5], + '澳门': [-10, 10], + //'北京': [-10, 0], + '天津': [5, 5] + }; - constructor: Geo, + module.exports = function (geo) { + zrUtil.each(geo.regions, function (region) { + var coordFix = coordsOffsetMap[region.name]; + if (coordFix) { + var cp = region.center; + cp[0] += coordFix[0] / 10.5; + cp[1] += -coordFix[1] / (10.5 / 0.75); + } + }); + }; - type: 'geo', - /** - * @param {Array.} - * @readOnly - */ - dimensions: ['lng', 'lat'], +/***/ }, +/* 188 */ +/***/ function(module, exports, __webpack_require__) { - /** - * If contain given lng,lat coord - * @param {Array.} - * @readOnly - */ - containCoord: function (coord) { - var regions = this.regions; - for (var i = 0; i < regions.length; i++) { - if (regions[i].contain(coord)) { - return true; - } - } - return false; - }, - /** - * @param {Object} geoJson - * @param {Object} [specialAreas] - * Specify the positioned areas by left, top, width, height - * @param {Object.} [nameMap] - * Specify name alias - */ - loadGeoJson: function (geoJson, specialAreas, nameMap) { - // https://jsperf.com/try-catch-performance-overhead - try { - this.regions = geoJson ? parseGeoJson(geoJson) : []; - } - catch (e) { - throw 'Invalid geoJson format\n' + e; - } - specialAreas = specialAreas || {}; - nameMap = nameMap || {}; - var regions = this.regions; - var regionsMap = {}; - for (var i = 0; i < regions.length; i++) { - var regionName = regions[i].name; - // Try use the alias in nameMap - regionName = nameMap[regionName] || regionName; - regions[i].name = regionName; + - regionsMap[regionName] = regions[i]; - // Add geoJson - this.addGeoCoord(regionName, regions[i].center); + var zrUtil = __webpack_require__(4); - // Some area like Alaska in USA map needs to be tansformed - // to look better - var specialArea = specialAreas[regionName]; - if (specialArea) { - regions[i].transformTo( - specialArea.left, specialArea.top, specialArea.width, specialArea.height - ); - } + var geoCoordMap = { + 'Russia': [100, 60], + 'United States': [-99, 38], + 'United States of America': [-99, 38] + }; + + module.exports = function (geo) { + zrUtil.each(geo.regions, function (region) { + var geoCoord = geoCoordMap[region.name]; + if (geoCoord) { + var cp = region.center; + cp[0] = geoCoord[0]; + cp[1] = geoCoord[1]; } + }); + }; - this._regionsMap = regionsMap; - this._rect = null; +/***/ }, +/* 189 */ +/***/ function(module, exports, __webpack_require__) { - zrUtil.each(geoFixFuncs, function (fixFunc) { - fixFunc(this); - }, this); - }, + - // Overwrite - transformTo: function (x, y, width, height) { - var rect = this.getBoundingRect(); + // var zrUtil = require('zrender/lib/core/util'); + var graphic = __webpack_require__(44); - rect = rect.clone(); - // Longitute is inverted - rect.y = -rect.y - rect.height; + var MapDraw = __webpack_require__(190); - var viewTransform = this._viewTransform; + __webpack_require__(1).extendChartView({ - viewTransform.transform = rect.calculateTransform( - new BoundingRect(x, y, width, height) - ); + type: 'map', - viewTransform.decomposeTransform(); + render: function (mapModel, ecModel, api, payload) { + // Not render if it is an toggleSelect action from self + if (payload && payload.type === 'mapToggleSelect' + && payload.from === this.uid + ) { + return; + } - var scale = viewTransform.scale; - scale[1] = -scale[1]; + var group = this.group; + group.removeAll(); - viewTransform.updateTransform(); + if (mapModel.getHostGeoModel()) { + return; + } - this._updateTransform(); - }, + // Not update map if it is an roam action from self + if (!(payload && payload.type === 'geoRoam' + && payload.componentType === 'series' + && payload.seriesId === mapModel.id + ) + ) { + if (mapModel.needsDrawMap) { + var mapDraw = this._mapDraw || new MapDraw(api, true); + group.add(mapDraw.group); - /** - * @param {string} name - * @return {module:echarts/coord/geo/Region} - */ - getRegion: function (name) { - return this._regionsMap[name]; - }, + mapDraw.draw(mapModel, ecModel, api, this, payload); - getRegionByCoord: function (coord) { - var regions = this.regions; - for (var i = 0; i < regions.length; i++) { - if (regions[i].contain(coord)) { - return regions[i]; + this._mapDraw = mapDraw; + } + else { + // Remove drawed map + this._mapDraw && this._mapDraw.remove(); + this._mapDraw = null; } } + else { + var mapDraw = this._mapDraw; + mapDraw && group.add(mapDraw.group); + } + + mapModel.get('showLegendSymbol') && ecModel.getComponent('legend') + && this._renderSymbols(mapModel, ecModel, api); }, - /** - * Add geoCoord for indexing by name - * @param {string} name - * @param {Array.} geoCoord - */ - addGeoCoord: function (name, geoCoord) { - this._nameCoordMap[name] = geoCoord; + remove: function () { + this._mapDraw && this._mapDraw.remove(); + this._mapDraw = null; + this.group.removeAll(); }, - /** - * Get geoCoord by name - * @param {string} name - * @return {Array.} - */ - getGeoCoord: function (name) { - return this._nameCoordMap[name]; + dispose: function () { + this._mapDraw && this._mapDraw.remove(); + this._mapDraw = null; }, - // Overwrite - getBoundingRect: function () { - if (this._rect) { - return this._rect; - } - var rect; + _renderSymbols: function (mapModel, ecModel, api) { + var originalData = mapModel.originalData; + var group = this.group; - var regions = this.regions; - for (var i = 0; i < regions.length; i++) { - var regionRect = regions[i].getBoundingRect(); - rect = rect || regionRect.clone(); - rect.union(regionRect); - } - // FIXME Always return new ? - return (this._rect = rect || new BoundingRect(0, 0, 0, 0)); - }, + originalData.each('value', function (value, idx) { + if (isNaN(value)) { + return; + } - /** - * Convert series data to a list of points - * @param {module:echarts/data/List} data - * @param {boolean} stack - * @return {Array} - * Return list of points. For example: - * `[[10, 10], [20, 20], [30, 30]]` - */ - dataToPoints: function (data) { - var item = []; - return data.mapArray(['lng', 'lat'], function (lon, lat) { - item[0] = lon; - item[1] = lat; - return this.dataToPoint(item); - }, this); - }, + var layout = originalData.getItemLayout(idx); - // Overwrite - /** - * @param {string|Array.} data - * @return {Array.} - */ - dataToPoint: function (data) { - if (typeof data === 'string') { - // Map area name to geoCoord - data = this.getGeoCoord(data); - } - if (data) { - return View.prototype.dataToPoint.call(this, data); - } - }, + if (!layout || !layout.point) { + // Not exists in map + return; + } - /** - * @override - * @implements - * see {module:echarts/CoodinateSystem} - */ - convertToPixel: zrUtil.curry(doConvert, 'dataToPoint'), + var point = layout.point; + var offset = layout.offset; - /** - * @override - * @implements - * see {module:echarts/CoodinateSystem} - */ - convertFromPixel: zrUtil.curry(doConvert, 'pointToData') + var circle = new graphic.Circle({ + style: { + // Because the special of map draw. + // Which needs statistic of multiple series and draw on one map. + // And each series also need a symbol with legend color + // + // Layout and visual are put one the different data + fill: mapModel.getData().getVisual('color') + }, + shape: { + cx: point[0] + offset * 9, + cy: point[1], + r: 3 + }, + silent: true, + z2: 10 + }); - }; + // First data on the same region + if (!offset) { + var fullData = mapModel.mainSeries.getData(); + var name = originalData.getName(idx); + var labelText = name; + var fullIndex = fullData.indexOfName(name); - zrUtil.mixin(Geo, View); + var itemModel = originalData.getItemModel(idx); + var labelModel = itemModel.getModel('label.normal'); + var hoverLabelModel = itemModel.getModel('label.emphasis'); - function doConvert(methodName, ecModel, finder, value) { - var geoModel = finder.geoModel; - var seriesModel = finder.seriesModel; + var textStyleModel = labelModel.getModel('textStyle'); + var hoverTextStyleModel = hoverLabelModel.getModel('textStyle'); - var coordSys = geoModel - ? geoModel.coordinateSystem - : seriesModel - ? ( - seriesModel.coordinateSystem // For map. - || (seriesModel.getReferringComponents('geo')[0] || {}).coordinateSystem - ) - : null; + var polygonGroups = fullData.getItemGraphicEl(fullIndex); + circle.setStyle({ + textPosition: 'bottom' + }); - return coordSys === this ? coordSys[methodName](value) : null; - } + var onEmphasis = function () { + circle.setStyle({ + text: hoverLabelModel.get('show') ? labelText : '', + textFill: hoverTextStyleModel.getTextColor(), + textFont: hoverTextStyleModel.getFont() + }); + }; - module.exports = Geo; + var onNormal = function () { + circle.setStyle({ + text: labelModel.get('show') ? labelText : '', + textFill: textStyleModel.getTextColor(), + textFont: textStyleModel.getFont() + }); + }; + + polygonGroups.on('mouseover', onEmphasis) + .on('mouseout', onNormal) + .on('emphasis', onEmphasis) + .on('normal', onNormal); + + onNormal(); + } + + group.add(circle); + }); + } + }); /***/ }, -/* 168 */ +/* 190 */ /***/ function(module, exports, __webpack_require__) { /** - * Parse and decode geo json - * @module echarts/coord/geo/parseGeoJson + * @module echarts/component/helper/MapDraw */ + var RoamController = __webpack_require__(191); + var graphic = __webpack_require__(44); var zrUtil = __webpack_require__(4); - var Region = __webpack_require__(169); + function getFixedItemStyle(model, scale) { + var itemStyle = model.getItemStyle(); + var areaColor = model.get('areaColor'); - function decode(json) { - if (!json.UTF8Encoding) { - return json; + // If user want the color not to be changed when hover, + // they should both set areaColor and color to be null. + if (areaColor != null) { + itemStyle.fill = areaColor; } - var features = json.features; - for (var f = 0; f < features.length; f++) { - var feature = features[f]; - var geometry = feature.geometry; - var coordinates = geometry.coordinates; - var encodeOffsets = geometry.encodeOffsets; + return itemStyle; + } - for (var c = 0; c < coordinates.length; c++) { - var coordinate = coordinates[c]; + function updateMapSelectHandler(mapDraw, mapOrGeoModel, group, api, fromView) { + group.off('click'); + group.off('mousedown'); - if (geometry.type === 'Polygon') { - coordinates[c] = decodePolygon( - coordinate, - encodeOffsets[c] - ); + if (mapOrGeoModel.get('selectedMode')) { + + group.on('mousedown', function () { + mapDraw._mouseDownFlag = true; + }); + + group.on('click', function (e) { + if (!mapDraw._mouseDownFlag) { + return; } - else if (geometry.type === 'MultiPolygon') { - for (var c2 = 0; c2 < coordinate.length; c2++) { - var polygon = coordinate[c2]; - coordinate[c2] = decodePolygon( - polygon, - encodeOffsets[c][c2] - ); - } + mapDraw._mouseDownFlag = false; + + var el = e.target; + while (!el.__regions) { + el = el.parent; + } + if (!el) { + return; } - } - } - // Has been decoded - json.UTF8Encoding = false; - return json; - } - function decodePolygon(coordinate, encodeOffsets) { - var result = []; - var prevX = encodeOffsets[0]; - var prevY = encodeOffsets[1]; + var action = { + type: (mapOrGeoModel.mainType === 'geo' ? 'geo' : 'map') + 'ToggleSelect', + batch: zrUtil.map(el.__regions, function (region) { + return { + name: region.name, + from: fromView.uid + }; + }) + }; + action[mapOrGeoModel.mainType + 'Id'] = mapOrGeoModel.id; - for (var i = 0; i < coordinate.length; i += 2) { - var x = coordinate.charCodeAt(i) - 64; - var y = coordinate.charCodeAt(i + 1) - 64; - // ZigZag decoding - x = (x >> 1) ^ (-(x & 1)); - y = (y >> 1) ^ (-(y & 1)); - // Delta deocding - x += prevX; - y += prevY; + api.dispatchAction(action); - prevX = x; - prevY = y; - // Dequantize - result.push([x / 1024, y / 1024]); + updateMapSelected(mapOrGeoModel, group); + }); } - - return result; } - /** - * @inner - */ - function flattern2D(array) { - var ret = []; - for (var i = 0; i < array.length; i++) { - for (var k = 0; k < array[i].length; k++) { - ret.push(array[i][k]); - } - } - return ret; + function updateMapSelected(mapOrGeoModel, group) { + // FIXME + group.eachChild(function (otherRegionEl) { + zrUtil.each(otherRegionEl.__regions, function (region) { + otherRegionEl.trigger(mapOrGeoModel.isSelected(region.name) ? 'emphasis' : 'normal'); + }); + }); } /** - * @alias module:echarts/coord/geo/parseGeoJson - * @param {Object} geoJson - * @return {module:zrender/container/Group} + * @alias module:echarts/component/helper/MapDraw + * @param {module:echarts/ExtensionAPI} api + * @param {boolean} updateGroup */ - module.exports = function (geoJson) { - - decode(geoJson); - - return zrUtil.map(zrUtil.filter(geoJson.features, function (featureObj) { - // Output of mapshaper may have geometry null - return featureObj.geometry && featureObj.properties; - }), function (featureObj) { - var properties = featureObj.properties; - var geometry = featureObj.geometry; - - var coordinates = geometry.coordinates; - - if (geometry.type === 'MultiPolygon') { - coordinates = flattern2D(coordinates); - } - - return new Region( - properties.name, - coordinates, - properties.cp - ); - }); - }; - - -/***/ }, -/* 169 */ -/***/ function(module, exports, __webpack_require__) { - - /** - * @module echarts/coord/geo/Region - */ - - - var polygonContain = __webpack_require__(170); - - var BoundingRect = __webpack_require__(9); + function MapDraw(api, updateGroup) { - var bbox = __webpack_require__(51); - var vec2 = __webpack_require__(10); + var group = new graphic.Group(); - /** - * @param {string} name - * @param {Array} contours - * @param {Array.} cp - */ - function Region(name, contours, cp) { + /** + * @type {module:echarts/component/helper/RoamController} + * @private + */ + this._controller = new RoamController( + api.getZr(), updateGroup ? group : null, null + ); /** - * @type {string} + * @type {module:zrender/container/Group} * @readOnly */ - this.name = name; + this.group = group; /** - * @type {Array.} - * @readOnly + * @type {boolean} + * @private */ - this.contours = contours; + this._updateGroup = updateGroup; - if (!cp) { - var rect = this.getBoundingRect(); - cp = [ - rect.x + rect.width / 2, - rect.y + rect.height / 2 - ]; - } - else { - cp = [cp[0], cp[1]]; - } /** - * @type {Array.} + * This flag is used to make sure that only one among + * `pan`, `zoom`, `click` can occurs, otherwise 'selected' + * action may be triggered when `pan`, which is unexpected. + * @type {booelan} */ - this.center = cp; + this._mouseDownFlag; } - Region.prototype = { - - constructor: Region, + MapDraw.prototype = { - /** - * @return {module:zrender/core/BoundingRect} - */ - getBoundingRect: function () { - var rect = this._rect; - if (rect) { - return rect; - } + constructor: MapDraw, - var MAX_NUMBER = Number.MAX_VALUE; - var min = [MAX_NUMBER, MAX_NUMBER]; - var max = [-MAX_NUMBER, -MAX_NUMBER]; - var min2 = []; - var max2 = []; - var contours = this.contours; - for (var i = 0; i < contours.length; i++) { - bbox.fromPoints(contours[i], min2, max2); - vec2.min(min, min, min2); - vec2.max(max, max, max2); - } - // No data - if (i === 0) { - min[0] = min[1] = max[0] = max[1] = 0; - } + draw: function (mapOrGeoModel, ecModel, api, fromView, payload) { - return (this._rect = new BoundingRect( - min[0], min[1], max[0] - min[0], max[1] - min[1] - )); - }, + var isGeo = mapOrGeoModel.mainType === 'geo'; - /** - * @param {} coord - * @return {boolean} - */ - contain: function (coord) { - var rect = this.getBoundingRect(); - var contours = this.contours; - if (rect.contain(coord[0], coord[1])) { - for (var i = 0, len = contours.length; i < len; i++) { - if (polygonContain.contain(contours[i], coord[0], coord[1])) { - return true; - } + // map series has data, geo model that controlled by map series + // has no data, otherwise data exists. + var data = mapOrGeoModel.getData && mapOrGeoModel.getData(); + isGeo && ecModel.eachComponent({mainType: 'series', subType: 'map'}, function (mapSeries) { + if (!data && mapSeries.getHostGeoModel() === mapOrGeoModel) { + data = mapSeries.getData(); } - } - return false; - }, + }); - transformTo: function (x, y, width, height) { - var rect = this.getBoundingRect(); - var aspect = rect.width / rect.height; - if (!width) { - width = aspect * height; - } - else if (!height) { - height = width / aspect ; - } - var target = new BoundingRect(x, y, width, height); - var transform = rect.calculateTransform(target); - var contours = this.contours; - for (var i = 0; i < contours.length; i++) { - for (var p = 0; p < contours[i].length; p++) { - vec2.applyTransform(contours[i][p], contours[i][p], transform); - } - } - rect = this._rect; - rect.copy(target); - // Update center - this.center = [ - rect.x + rect.width / 2, - rect.y + rect.height / 2 - ]; - } - }; + var geo = mapOrGeoModel.coordinateSystem; + + var group = this.group; + + var scale = geo.scale; + var groupNewProp = { + position: geo.position, + scale: scale + }; + + // No animation when first draw or in action + if (!group.childAt(0) || payload) { + group.attr(groupNewProp); + } + else { + graphic.updateProps(group, groupNewProp, mapOrGeoModel); + } - module.exports = Region; + group.removeAll(); + var itemStyleAccessPath = ['itemStyle', 'normal']; + var hoverItemStyleAccessPath = ['itemStyle', 'emphasis']; + var labelAccessPath = ['label', 'normal']; + var hoverLabelAccessPath = ['label', 'emphasis']; + var nameMap = {}; -/***/ }, -/* 170 */ -/***/ function(module, exports, __webpack_require__) { + zrUtil.each(geo.regions, function (region) { - + // Consider in GeoJson properties.name may be duplicated, for example, + // there is multiple region named "United Kindom" or "France" (so many + // colonies). And it is not appropriate to merge them in geo, which + // will make them share the same label and bring trouble in label + // location calculation. + var regionGroup = nameMap[region.name] + || (nameMap[region.name] = new graphic.Group()); - var windingLine = __webpack_require__(58); + var compoundPath = new graphic.CompoundPath({ + shape: { + paths: [] + } + }); + regionGroup.add(compoundPath); - var EPSILON = 1e-8; + var regionModel = mapOrGeoModel.getRegionModel(region.name) || mapOrGeoModel; - function isAroundEqual(a, b) { - return Math.abs(a - b) < EPSILON; - } + var itemStyleModel = regionModel.getModel(itemStyleAccessPath); + var hoverItemStyleModel = regionModel.getModel(hoverItemStyleAccessPath); + var itemStyle = getFixedItemStyle(itemStyleModel, scale); + var hoverItemStyle = getFixedItemStyle(hoverItemStyleModel, scale); - function contain(points, x, y) { - var w = 0; - var p = points[0]; + var labelModel = regionModel.getModel(labelAccessPath); + var hoverLabelModel = regionModel.getModel(hoverLabelAccessPath); - if (!p) { - return false; - } + var dataIdx; + // Use the itemStyle in data if has data + if (data) { + dataIdx = data.indexOfName(region.name); + // Only visual color of each item will be used. It can be encoded by dataRange + // But visual color of series is used in symbol drawing + // + // Visual color for each series is for the symbol draw + var visualColor = data.getItemVisual(dataIdx, 'color', true); + if (visualColor) { + itemStyle.fill = visualColor; + } + } - for (var i = 1; i < points.length; i++) { - var p2 = points[i]; - w += windingLine(p[0], p[1], p2[0], p2[1], x, y); - p = p2; - } + var textStyleModel = labelModel.getModel('textStyle'); + var hoverTextStyleModel = hoverLabelModel.getModel('textStyle'); - // Close polygon - var p0 = points[0]; - if (!isAroundEqual(p[0], p0[0]) || !isAroundEqual(p[1], p0[1])) { - w += windingLine(p[0], p[1], p0[0], p0[1], x, y); - } + zrUtil.each(region.geometries, function (geometry) { + if (geometry.type !== 'polygon') { + return; + } + compoundPath.shape.paths.push(new graphic.Polygon({ + shape: { + points: geometry.exterior + } + })); - return w !== 0; - } + for (var i = 0; i < (geometry.interiors ? geometry.interiors.length : 0); i++) { + compoundPath.shape.paths.push(new graphic.Polygon({ + shape: { + points: geometry.interiors[i] + } + })); + } + }); + compoundPath.setStyle(itemStyle); + compoundPath.style.strokeNoScale = true; + compoundPath.culling = true; + // Label + var showLabel = labelModel.get('show'); + var hoverShowLabel = hoverLabelModel.get('show'); - module.exports = { - contain: contain - }; + var isDataNaN = data && isNaN(data.get('value', dataIdx)); + var itemLayout = data && data.getItemLayout(dataIdx); + // In the following cases label will be drawn + // 1. In map series and data value is NaN + // 2. In geo component + // 4. Region has no series legendSymbol, which will be add a showLabel flag in mapSymbolLayout + if ( + (isGeo || isDataNaN && (showLabel || hoverShowLabel)) + || (itemLayout && itemLayout.showLabel) + ) { + var query = data ? dataIdx : region.name; + var formattedStr = mapOrGeoModel.getFormattedLabel(query, 'normal'); + var hoverFormattedStr = mapOrGeoModel.getFormattedLabel(query, 'emphasis'); + var text = new graphic.Text({ + style: { + text: showLabel ? (formattedStr || region.name) : '', + fill: textStyleModel.getTextColor(), + textFont: textStyleModel.getFont(), + textAlign: 'center', + textVerticalAlign: 'middle' + }, + hoverStyle: { + text: hoverShowLabel ? (hoverFormattedStr || region.name) : '', + fill: hoverTextStyleModel.getTextColor(), + textFont: hoverTextStyleModel.getFont() + }, + position: region.center.slice(), + scale: [1 / scale[0], 1 / scale[1]], + z2: 10, + silent: true + }); + regionGroup.add(text); + } -/***/ }, -/* 171 */ -/***/ function(module, exports, __webpack_require__) { + // setItemGraphicEl, setHoverStyle after all polygons and labels + // are added to the rigionGroup + if (data) { + data.setItemGraphicEl(dataIdx, regionGroup); + } + else { + var regionModel = mapOrGeoModel.getRegionModel(region.name); + // Package custom mouse event for geo component + compoundPath.eventData = { + componentType: 'geo', + geoIndex: mapOrGeoModel.componentIndex, + name: region.name, + region: (regionModel && regionModel.option) || {} + }; + } - /** - * Simple view coordinate system - * Mapping given x, y to transformd view x, y - */ + var groupRegions = regionGroup.__regions || (regionGroup.__regions = []); + groupRegions.push(region); + graphic.setHoverStyle( + regionGroup, + hoverItemStyle, + {hoverSilentOnTouch: !!mapOrGeoModel.get('selectedMode')} + ); - var vector = __webpack_require__(10); - var matrix = __webpack_require__(11); + group.add(regionGroup); + }); - var Transformable = __webpack_require__(34); - var zrUtil = __webpack_require__(4); + this._updateController(mapOrGeoModel, ecModel, api); - var BoundingRect = __webpack_require__(9); + updateMapSelectHandler(this, mapOrGeoModel, group, api, fromView); - var v2ApplyTransform = vector.applyTransform; + updateMapSelected(mapOrGeoModel, group); + }, - // Dummy transform node - function TransformDummy() { - Transformable.call(this); - } - zrUtil.mixin(TransformDummy, Transformable); + remove: function () { + this.group.removeAll(); + this._controller.dispose(); + }, - function View(name) { - /** - * @type {string} - */ - this.name = name; + _updateController: function (mapOrGeoModel, ecModel, api) { + var geo = mapOrGeoModel.coordinateSystem; + var controller = this._controller; + controller.zoomLimit = mapOrGeoModel.get('scaleLimit'); + // Update zoom from model + controller.zoom = geo.getZoom(); + // roamType is will be set default true if it is null + controller.enable(mapOrGeoModel.get('roam') || false); + var mainType = mapOrGeoModel.mainType; - /** - * @type {Object} - */ - this.zoomLimit; + function makeActionBase() { + var action = { + type: 'geoRoam', + componentType: mainType + }; + action[mainType + 'Id'] = mapOrGeoModel.id; + return action; + } - Transformable.call(this); + controller.off('pan').on('pan', function (dx, dy) { + this._mouseDownFlag = false; - this._roamTransform = new TransformDummy(); + api.dispatchAction(zrUtil.extend(makeActionBase(), { + dx: dx, + dy: dy + })); + }, this); - this._viewTransform = new TransformDummy(); + controller.off('zoom').on('zoom', function (zoom, mouseX, mouseY) { + this._mouseDownFlag = false; - this._center; - this._zoom; - } + api.dispatchAction(zrUtil.extend(makeActionBase(), { + zoom: zoom, + originX: mouseX, + originY: mouseY + })); - View.prototype = { + if (this._updateGroup) { + var group = this.group; + var scale = group.scale; + group.traverse(function (el) { + if (el.type === 'text') { + el.attr('scale', [1 / scale[0], 1 / scale[1]]); + } + }); + } + }, this); - constructor: View, + controller.setContainsPoint(function (x, y) { + return geo.getViewRectAfterRoam().contain(x, y); + }); + } + }; - type: 'view', + module.exports = MapDraw; - /** - * @param {Array.} - * @readOnly - */ - dimensions: ['x', 'y'], - /** - * Set bounding rect - * @param {number} x - * @param {number} y - * @param {number} width - * @param {number} height - */ +/***/ }, +/* 191 */ +/***/ function(module, exports, __webpack_require__) { - // PENDING to getRect - setBoundingRect: function (x, y, width, height) { - this._rect = new BoundingRect(x, y, width, height); - return this._rect; - }, + /** + * @module echarts/component/helper/RoamController + */ - /** - * @return {module:zrender/core/BoundingRect} - */ - // PENDING to getRect - getBoundingRect: function () { - return this._rect; - }, - /** - * @param {number} x - * @param {number} y - * @param {number} width - * @param {number} height - */ - setViewRect: function (x, y, width, height) { - this.transformTo(x, y, width, height); - this._viewRect = new BoundingRect(x, y, width, height); - }, - /** - * Transformed to particular position and size - * @param {number} x - * @param {number} y - * @param {number} width - * @param {number} height - */ - transformTo: function (x, y, width, height) { - var rect = this.getBoundingRect(); - var viewTransform = this._viewTransform; + var Eventful = __webpack_require__(33); + var zrUtil = __webpack_require__(4); + var eventTool = __webpack_require__(88); + var interactionMutex = __webpack_require__(192); - viewTransform.transform = rect.calculateTransform( - new BoundingRect(x, y, width, height) - ); + function mousedown(e) { + if (e.target && e.target.draggable) { + return; + } - viewTransform.decomposeTransform(); + var x = e.offsetX; + var y = e.offsetY; - this._updateTransform(); - }, + if (this.containsPoint && this.containsPoint(x, y)) { + this._x = x; + this._y = y; + this._dragging = true; + } + } - /** - * Set center of view - * @param {Array.} [centerCoord] - */ - setCenter: function (centerCoord) { - if (!centerCoord) { - return; - } - this._center = centerCoord; + function mousemove(e) { + if (!this._dragging) { + return; + } - this._updateCenterAndZoom(); - }, + eventTool.stop(e.event); - /** - * @param {number} zoom - */ - setZoom: function (zoom) { - zoom = zoom || 1; + if (e.gestureEvent !== 'pinch') { - var zoomLimit = this.zoomLimit; - if (zoomLimit) { - if (zoomLimit.max != null) { - zoom = Math.min(zoomLimit.max, zoom); - } - if (zoomLimit.min != null) { - zoom = Math.max(zoomLimit.min, zoom); - } + if (interactionMutex.isTaken(this._zr, 'globalPan')) { + return; } - this._zoom = zoom; - this._updateCenterAndZoom(); - }, + var x = e.offsetX; + var y = e.offsetY; - /** - * Get default center without roam - */ - getDefaultCenter: function () { - // Rect before any transform - var rawRect = this.getBoundingRect(); - var cx = rawRect.x + rawRect.width / 2; - var cy = rawRect.y + rawRect.height / 2; + var oldX = this._x; + var oldY = this._y; - return [cx, cy]; - }, + var dx = x - oldX; + var dy = y - oldY; - getCenter: function () { - return this._center || this.getDefaultCenter(); - }, + this._x = x; + this._y = y; - getZoom: function () { - return this._zoom || 1; - }, + var target = this.target; - /** - * @return {Array. 0 ? 1.1 : 1 / 1.1; + zoom.call(this, e, zoomDelta, e.offsetX, e.offsetY); + } - this._updateTransform(); - }, + function pinch(e) { + if (interactionMutex.isTaken(this._zr, 'globalPan')) { + return; + } + var zoomDelta = e.pinchScale > 1 ? 1.1 : 1 / 1.1; + zoom.call(this, e, zoomDelta, e.pinchX, e.pinchY); + } - /** - * Update transform from roam and mapLocation - * @private - */ - _updateTransform: function () { - var roamTransform = this._roamTransform; - var viewTransform = this._viewTransform; + function zoom(e, zoomDelta, zoomX, zoomY) { + if (this.containsPoint && this.containsPoint(zoomX, zoomY)) { + // When mouse is out of roamController rect, + // default befavoius should be be disabled, otherwise + // page sliding is disabled, contrary to expectation. + eventTool.stop(e.event); - viewTransform.parent = roamTransform; - roamTransform.updateTransform(); - viewTransform.updateTransform(); + var target = this.target; + var zoomLimit = this.zoomLimit; - viewTransform.transform - && matrix.copy(this.transform || (this.transform = []), viewTransform.transform); + if (target) { + var pos = target.position; + var scale = target.scale; - if (this.transform) { - this.invTransform = this.invTransform || []; - matrix.invert(this.invTransform, this.transform); - } - else { - this.invTransform = null; + var newZoom = this.zoom = this.zoom || 1; + newZoom *= zoomDelta; + if (zoomLimit) { + var zoomMin = zoomLimit.min || 0; + var zoomMax = zoomLimit.max || Infinity; + newZoom = Math.max( + Math.min(zoomMax, newZoom), + zoomMin + ); + } + var zoomScale = newZoom / this.zoom; + this.zoom = newZoom; + // Keep the mouse center when scaling + pos[0] -= (zoomX - pos[0]) * (zoomScale - 1); + pos[1] -= (zoomY - pos[1]) * (zoomScale - 1); + scale[0] *= zoomScale; + scale[1] *= zoomScale; + + target.dirty(); } - this.decomposeTransform(); - }, - /** - * @return {module:zrender/core/BoundingRect} - */ - getViewRect: function () { - return this._viewRect; - }, + this.trigger('zoom', zoomDelta, zoomX, zoomY); + } + } - /** - * Get view rect after roam transform - * @return {module:zrender/core/BoundingRect} - */ - getViewRectAfterRoam: function () { - var rect = this.getBoundingRect().clone(); - rect.applyTransform(this.transform); - return rect; - }, + /** + * @alias module:echarts/component/helper/RoamController + * @constructor + * @mixin {module:zrender/mixin/Eventful} + * + * @param {module:zrender/zrender~ZRender} zr + * @param {module:zrender/Element} target + */ + function RoamController(zr, target) { /** - * Convert a single (lon, lat) data item to (x, y) point. - * @param {Array.} data - * @return {Array.} + * @type {module:zrender/Element} */ - dataToPoint: function (data) { - var transform = this.transform; - return transform - ? v2ApplyTransform([], data, transform) - : [data[0], data[1]]; - }, + this.target = target; - /** - * Convert a (x, y) point to (lon, lat) data - * @param {Array.} point - * @return {Array.} - */ - pointToData: function (point) { - var invTransform = this.invTransform; - return invTransform - ? v2ApplyTransform([], point, invTransform) - : [point[0], point[1]]; - }, + /** + * @type {Function} + */ + this.containsPoint; /** - * @implements - * see {module:echarts/CoodinateSystem} + * { min: 1, max: 2 } + * @type {Object} */ - convertToPixel: zrUtil.curry(doConvert, 'dataToPoint'), + this.zoomLimit; /** - * @implements - * see {module:echarts/CoodinateSystem} + * @type {number} */ - convertFromPixel: zrUtil.curry(doConvert, 'pointToData'), + this.zoom; + /** + * @type {module:zrender} + */ + this._zr = zr; + + // Avoid two roamController bind the same handler + var bind = zrUtil.bind; + var mousedownHandler = bind(mousedown, this); + var mousemoveHandler = bind(mousemove, this); + var mouseupHandler = bind(mouseup, this); + var mousewheelHandler = bind(mousewheel, this); + var pinchHandler = bind(pinch, this); + + Eventful.call(this); /** - * @implements - * see {module:echarts/CoodinateSystem} + * @param {Function} containsPoint + * input: x, y + * output: boolean */ - containPoint: function (point) { - return this.getViewRectAfterRoam().contain(point[0], point[1]); - } + this.setContainsPoint = function (containsPoint) { + this.containsPoint = containsPoint; + }; /** - * @return {number} + * Notice: only enable needed types. For example, if 'zoom' + * is not needed, 'zoom' should not be enabled, otherwise + * default mousewheel behaviour (scroll page) will be disabled. + * + * @param {boolean|string} [controlType=true] Specify the control type, + * which can be null/undefined or true/false + * or 'pan/move' or 'zoom'/'scale' */ - // getScalarScale: function () { - // // Use determinant square root of transform to mutiply scalar - // var m = this.transform; - // var det = Math.sqrt(Math.abs(m[0] * m[3] - m[2] * m[1])); - // return det; - // } - }; + this.enable = function (controlType) { + // Disable previous first + this.disable(); - zrUtil.mixin(View, Transformable); + if (controlType == null) { + controlType = true; + } - function doConvert(methodName, ecModel, finder, value) { - var seriesModel = finder.seriesModel; - var coordSys = seriesModel ? seriesModel.coordinateSystem : null; // e.g., graph. - return coordSys === this ? coordSys[methodName](value) : null; + if (controlType === true || (controlType === 'move' || controlType === 'pan')) { + zr.on('mousedown', mousedownHandler); + zr.on('mousemove', mousemoveHandler); + zr.on('mouseup', mouseupHandler); + } + if (controlType === true || (controlType === 'scale' || controlType === 'zoom')) { + zr.on('mousewheel', mousewheelHandler); + zr.on('pinch', pinchHandler); + } + }; + + this.disable = function () { + zr.off('mousedown', mousedownHandler); + zr.off('mousemove', mousemoveHandler); + zr.off('mouseup', mouseupHandler); + zr.off('mousewheel', mousewheelHandler); + zr.off('pinch', pinchHandler); + }; + + this.dispose = this.disable; + + this.isDragging = function () { + return this._dragging; + }; + + this.isPinching = function () { + return this._pinching; + }; } - module.exports = View; + zrUtil.mixin(RoamController, Eventful); + + module.exports = RoamController; /***/ }, -/* 172 */ +/* 192 */ /***/ function(module, exports, __webpack_require__) { - // Fix for 南海诸岛 + + var ATTR = '\0_ec_interaction_mutex'; - var Region = __webpack_require__(169); + var interactionMutex = { - var geoCoord = [126, 25]; + take: function (zr, resourceKey, userKey) { + var store = getStore(zr); + store[resourceKey] = userKey; + }, - var points = [ - [[0,3.5],[7,11.2],[15,11.9],[30,7],[42,0.7],[52,0.7], - [56,7.7],[59,0.7],[64,0.7],[64,0],[5,0],[0,3.5]], - [[13,16.1],[19,14.7],[16,21.7],[11,23.1],[13,16.1]], - [[12,32.2],[14,38.5],[15,38.5],[13,32.2],[12,32.2]], - [[16,47.6],[12,53.2],[13,53.2],[18,47.6],[16,47.6]], - [[6,64.4],[8,70],[9,70],[8,64.4],[6,64.4]], - [[23,82.6],[29,79.8],[30,79.8],[25,82.6],[23,82.6]], - [[37,70.7],[43,62.3],[44,62.3],[39,70.7],[37,70.7]], - [[48,51.1],[51,45.5],[53,45.5],[50,51.1],[48,51.1]], - [[51,35],[51,28.7],[53,28.7],[53,35],[51,35]], - [[52,22.4],[55,17.5],[56,17.5],[53,22.4],[52,22.4]], - [[58,12.6],[62,7],[63,7],[60,12.6],[58,12.6]], - [[0,3.5],[0,93.1],[64,93.1],[64,0],[63,0],[63,92.4], - [1,92.4],[1,3.5],[0,3.5]] - ]; - for (var i = 0; i < points.length; i++) { - for (var k = 0; k < points[i].length; k++) { - points[i][k][0] /= 10.5; - points[i][k][1] /= -10.5 / 0.75; + release: function (zr, resourceKey, userKey) { + var store = getStore(zr); + var uKey = store[resourceKey]; - points[i][k][0] += geoCoord[0]; - points[i][k][1] += geoCoord[1]; - } - } - module.exports = function (geo) { - if (geo.map === 'china') { - geo.regions.push(new Region( - '南海诸岛', points, geoCoord - )); + if (uKey === userKey) { + store[resourceKey] = null; + } + }, + + isTaken: function (zr, resourceKey) { + return !!getStore(zr)[resourceKey]; } }; + function getStore(zr) { + return zr[ATTR] || (zr[ATTR] = {}); + } + + /** + * payload: { + * type: 'takeGlobalCursor', + * key: 'dataZoomSelect', or 'brush', or ..., + * If no userKey, release global cursor. + * } + */ + __webpack_require__(1).registerAction( + {type: 'takeGlobalCursor', event: 'globalCursorTaken', update: 'update'}, + function () {} + ); + + module.exports = interactionMutex; + /***/ }, -/* 173 */ +/* 193 */ /***/ function(module, exports, __webpack_require__) { var zrUtil = __webpack_require__(4); + var roamHelper = __webpack_require__(194); - var coordsOffsetMap = { - '南海诸岛' : [32, 80], - // 全国 - '广东': [0, -10], - '香港': [10, 5], - '澳门': [-10, 10], - //'北京': [-10, 0], - '天津': [5, 5] - }; + var echarts = __webpack_require__(1); - module.exports = function (geo) { - zrUtil.each(geo.regions, function (region) { - var coordFix = coordsOffsetMap[region.name]; - if (coordFix) { - var cp = region.center; - cp[0] += coordFix[0] / 10.5; - cp[1] += -coordFix[1] / (10.5 / 0.75); + /** + * @payload + * @property {string} [componentType=series] + * @property {number} [dx] + * @property {number} [dy] + * @property {number} [zoom] + * @property {number} [originX] + * @property {number} [originY] + */ + echarts.registerAction({ + type: 'geoRoam', + event: 'geoRoam', + update: 'updateLayout' + }, function (payload, ecModel) { + var componentType = payload.componentType || 'series'; + + ecModel.eachComponent( + { mainType: componentType, query: payload }, + function (componentModel) { + var geo = componentModel.coordinateSystem; + if (geo.type !== 'geo') { + return; + } + + var res = roamHelper.updateCenterAndZoom( + geo, payload, componentModel.get('scaleLimit') + ); + + componentModel.setCenter + && componentModel.setCenter(res.center); + + componentModel.setZoom + && componentModel.setZoom(res.zoom); + + // All map series with same `map` use the same geo coordinate system + // So the center and zoom must be in sync. Include the series not selected by legend + if (componentType === 'series') { + zrUtil.each(componentModel.seriesGroup, function (seriesModel) { + seriesModel.setCenter(res.center); + seriesModel.setZoom(res.zoom); + }); + } } - }); - }; + ); + }); /***/ }, -/* 174 */ -/***/ function(module, exports, __webpack_require__) { +/* 194 */ +/***/ function(module, exports) { - var zrUtil = __webpack_require__(4); + var roamHelper = {}; - var geoCoordMap = { - 'Russia': [100, 60], - 'United States of America': [-99, 38] - }; + /** + * @param {module:echarts/coord/View} view + * @param {Object} payload + * @param {Object} [zoomLimit] + */ + roamHelper.updateCenterAndZoom = function ( + view, payload, zoomLimit + ) { + var previousZoom = view.getZoom(); + var center = view.getCenter(); + var zoom = payload.zoom; - module.exports = function (geo) { - zrUtil.each(geo.regions, function (region) { - var geoCoord = geoCoordMap[region.name]; - if (geoCoord) { - var cp = region.center; - cp[0] = geoCoord[0]; - cp[1] = geoCoord[1]; + var point = view.dataToPoint(center); + + if (payload.dx != null && payload.dy != null) { + point[0] -= payload.dx; + point[1] -= payload.dy; + + var center = view.pointToData(point); + view.setCenter(center); + } + if (zoom != null) { + if (zoomLimit) { + var zoomMin = zoomLimit.min || 0; + var zoomMax = zoomLimit.max || Infinity; + zoom = Math.max( + Math.min(previousZoom * zoom, zoomMax), + zoomMin + ) / previousZoom; } - }); + + // Zoom on given point(originX, originY) + view.scale[0] *= zoom; + view.scale[1] *= zoom; + var position = view.position; + var fixX = (payload.originX - position[0]) * (zoom - 1); + var fixY = (payload.originY - position[1]) * (zoom - 1); + + position[0] -= fixX; + position[1] -= fixY; + + view.updateTransform(); + // Get the new center + var center = view.pointToData(point); + view.setCenter(center); + view.setZoom(zoom * previousZoom); + } + + return { + center: view.getCenter(), + zoom: view.getZoom() + }; }; + module.exports = roamHelper; + /***/ }, -/* 175 */ +/* 195 */ /***/ function(module, exports, __webpack_require__) { - // var zrUtil = require('zrender/lib/core/util'); - var graphic = __webpack_require__(43); - - var MapDraw = __webpack_require__(176); + var zrUtil = __webpack_require__(4); - __webpack_require__(1).extendChartView({ + module.exports = function (ecModel) { - type: 'map', + var processedMapType = {}; - render: function (mapModel, ecModel, api, payload) { - // Not render if it is an toggleSelect action from self - if (payload && payload.type === 'mapToggleSelect' - && payload.from === this.uid - ) { + ecModel.eachSeriesByType('map', function (mapSeries) { + var mapType = mapSeries.getMapType(); + if (mapSeries.getHostGeoModel() || processedMapType[mapType]) { return; } - var group = this.group; - group.removeAll(); + var mapSymbolOffsets = {}; - if (mapModel.getHostGeoModel()) { - return; - } + zrUtil.each(mapSeries.seriesGroup, function (subMapSeries) { + var geo = subMapSeries.coordinateSystem; + var data = subMapSeries.originalData; + if (subMapSeries.get('showLegendSymbol') && ecModel.getComponent('legend')) { + data.each('value', function (value, idx) { + var name = data.getName(idx); + var region = geo.getRegion(name); - // Not update map if it is an roam action from self - if (!(payload && payload.type === 'geoRoam' - && payload.componentType === 'series' - && payload.seriesId === mapModel.id - ) - ) { - if (mapModel.needsDrawMap) { - var mapDraw = this._mapDraw || new MapDraw(api, true); - group.add(mapDraw.group); + // If input series.data is [11, 22, '-'/null/undefined, 44], + // it will be filled with NaN: [11, 22, NaN, 44] and NaN will + // not be drawn. So here must validate if value is NaN. + if (!region || isNaN(value)) { + return; + } - mapDraw.draw(mapModel, ecModel, api, this, payload); + var offset = mapSymbolOffsets[name] || 0; - this._mapDraw = mapDraw; - } - else { - // Remove drawed map - this._mapDraw && this._mapDraw.remove(); - this._mapDraw = null; + var point = geo.dataToPoint(region.center); + + mapSymbolOffsets[name] = offset + 1; + + data.setItemLayout(idx, { + point: point, + offset: offset + }); + }); } - } - else { - var mapDraw = this._mapDraw; - mapDraw && group.add(mapDraw.group); - } + }); - mapModel.get('showLegendSymbol') && ecModel.getComponent('legend') - && this._renderSymbols(mapModel, ecModel, api); - }, + // Show label of those region not has legendSymbol(which is offset 0) + var data = mapSeries.getData(); + data.each(function (idx) { + var name = data.getName(idx); + var layout = data.getItemLayout(idx) || {}; + layout.showLabel = !mapSymbolOffsets[name]; + data.setItemLayout(idx, layout); + }); - remove: function () { - this._mapDraw && this._mapDraw.remove(); - this._mapDraw = null; - this.group.removeAll(); - }, + processedMapType[mapType] = true; + }); + }; - dispose: function () { - this._mapDraw && this._mapDraw.remove(); - this._mapDraw = null; - }, - _renderSymbols: function (mapModel, ecModel, api) { - var originalData = mapModel.originalData; - var group = this.group; +/***/ }, +/* 196 */ +/***/ function(module, exports) { - originalData.each('value', function (value, idx) { - if (isNaN(value)) { - return; - } + + module.exports = function (ecModel) { + ecModel.eachSeriesByType('map', function (seriesModel) { + var colorList = seriesModel.get('color'); + var itemStyleModel = seriesModel.getModel('itemStyle.normal'); - var layout = originalData.getItemLayout(idx); + var areaColor = itemStyleModel.get('areaColor'); + var color = itemStyleModel.get('color') + || colorList[seriesModel.seriesIndex % colorList.length]; - if (!layout || !layout.point) { - // Not exists in map - return; - } + seriesModel.getData().setVisual({ + 'areaColor': areaColor, + 'color': color + }); + }); + }; - var point = layout.point; - var offset = layout.offset; - var circle = new graphic.Circle({ - style: { - // Because the special of map draw. - // Which needs statistic of multiple series and draw on one map. - // And each series also need a symbol with legend color - // - // Layout and visual are put one the different data - fill: mapModel.getData().getVisual('color') - }, - shape: { - cx: point[0] + offset * 9, - cy: point[1], - r: 3 - }, - silent: true, - z2: 10 - }); +/***/ }, +/* 197 */ +/***/ function(module, exports, __webpack_require__) { - // First data on the same region - if (!offset) { - var fullData = mapModel.mainSeries.getData(); - var name = originalData.getName(idx); - var labelText = name; - var fullIndex = fullData.indexOfName(name); + - var itemModel = originalData.getItemModel(idx); - var labelModel = itemModel.getModel('label.normal'); - var hoverLabelModel = itemModel.getModel('label.emphasis'); + var zrUtil = __webpack_require__(4); - var textStyleModel = labelModel.getModel('textStyle'); - var hoverTextStyleModel = hoverLabelModel.getModel('textStyle'); + // FIXME 公用? + /** + * @param {Array.} datas + * @param {string} statisticType 'average' 'sum' + * @inner + */ + function dataStatistics(datas, statisticType) { + var dataNameMap = {}; + var dims = ['value']; - var polygonGroups = fullData.getItemGraphicEl(fullIndex); - circle.setStyle({ - textPosition: 'bottom' - }); + zrUtil.each(datas, function (data) { + data.each(dims, function (value, idx) { + var name = data.getName(idx); + dataNameMap[name] = dataNameMap[name] || []; + if (!isNaN(value)) { + dataNameMap[name].push(value); + } + }); + }); - var onEmphasis = function () { - circle.setStyle({ - text: hoverLabelModel.get('show') ? labelText : '', - textFill: hoverTextStyleModel.getTextColor(), - textFont: hoverTextStyleModel.getFont() - }); - }; + return datas[0].map(dims, function (value, idx) { + var name = datas[0].getName(idx); + var sum = 0; + var min = Infinity; + var max = -Infinity; + var len = dataNameMap[name].length; + for (var i = 0; i < len; i++) { + min = Math.min(min, dataNameMap[name][i]); + max = Math.max(max, dataNameMap[name][i]); + sum += dataNameMap[name][i]; + } + var result; + if (statisticType === 'min') { + result = min; + } + else if (statisticType === 'max') { + result = max; + } + else if (statisticType === 'average') { + result = sum / len; + } + else { + result = sum; + } + return len === 0 ? NaN : result; + }); + } + + module.exports = function (ecModel) { + var seriesGroups = {}; + ecModel.eachSeriesByType('map', function (seriesModel) { + var hostGeoModel = seriesModel.getHostGeoModel(); + var key = hostGeoModel ? 'o' + hostGeoModel.id : 'i' + seriesModel.getMapType(); + (seriesGroups[key] = seriesGroups[key] || []).push(seriesModel); + }); - var onNormal = function () { - circle.setStyle({ - text: labelModel.get('show') ? labelText : '', - textFill: textStyleModel.getTextColor(), - textFont: textStyleModel.getFont() - }); - }; + zrUtil.each(seriesGroups, function (seriesList, key) { + var data = dataStatistics( + zrUtil.map(seriesList, function (seriesModel) { + return seriesModel.getData(); + }), + seriesList[0].get('mapValueCalculation') + ); - polygonGroups.on('mouseover', onEmphasis) - .on('mouseout', onNormal) - .on('emphasis', onEmphasis) - .on('normal', onNormal); + for (var i = 0; i < seriesList.length; i++) { + seriesList[i].originalData = seriesList[i].getData(); + } - onNormal(); - } + // FIXME Put where? + for (var i = 0; i < seriesList.length; i++) { + seriesList[i].seriesGroup = seriesList; + seriesList[i].needsDrawMap = i === 0 && !seriesList[i].getHostGeoModel(); - group.add(circle); - }); - } - }); + seriesList[i].setData(data.cloneShallow()); + seriesList[i].mainSeries = seriesList[0]; + } + }); + }; /***/ }, -/* 176 */ +/* 198 */ /***/ function(module, exports, __webpack_require__) { - /** - * @module echarts/component/helper/MapDraw - */ - + - var RoamController = __webpack_require__(177); - var graphic = __webpack_require__(43); var zrUtil = __webpack_require__(4); - function getFixedItemStyle(model, scale) { - var itemStyle = model.getItemStyle(); - var areaColor = model.get('areaColor'); + module.exports = function (option) { + // Save geoCoord + var mapSeries = []; + zrUtil.each(option.series, function (seriesOpt) { + if (seriesOpt.type === 'map') { + mapSeries.push(seriesOpt); + } + }); - // If user want the color not to be changed when hover, - // they should both set areaColor and color to be null. - if (areaColor != null) { - itemStyle.fill = areaColor; - } + zrUtil.each(mapSeries, function (seriesOpt) { + seriesOpt.map = seriesOpt.map || seriesOpt.mapType; + // Put x, y, width, height, x2, y2 in the top level + zrUtil.defaults(seriesOpt, seriesOpt.mapLocation); + }); + }; - return itemStyle; - } - function updateMapSelectHandler(mapDraw, mapOrGeoModel, group, api, fromView) { - group.off('click'); - group.off('mousedown'); +/***/ }, +/* 199 */ +/***/ function(module, exports, __webpack_require__) { - if (mapOrGeoModel.get('selectedMode')) { + - group.on('mousedown', function () { - mapDraw._mouseDownFlag = true; - }); + var echarts = __webpack_require__(1); - group.on('click', function (e) { - if (!mapDraw._mouseDownFlag) { - return; - } - mapDraw._mouseDownFlag = false; + __webpack_require__(200); + __webpack_require__(204); + __webpack_require__(207); - var el = e.target; - while (!el.__region) { - el = el.parent; - } - if (!el) { - return; - } + echarts.registerVisual(__webpack_require__(208)); - var region = el.__region; - var action = { - type: (mapOrGeoModel.mainType === 'geo' ? 'geo' : 'map') + 'ToggleSelect', - name: region.name, - from: fromView.uid - }; - action[mapOrGeoModel.mainType + 'Id'] = mapOrGeoModel.id; + echarts.registerLayout(__webpack_require__(210)); - api.dispatchAction(action); - updateMapSelected(mapOrGeoModel, group); - }); - } - } +/***/ }, +/* 200 */ +/***/ function(module, exports, __webpack_require__) { - function updateMapSelected(mapOrGeoModel, group) { - // FIXME - group.eachChild(function (otherRegionEl) { - if (otherRegionEl.__region) { - otherRegionEl.trigger(mapOrGeoModel.isSelected(otherRegionEl.__region.name) ? 'emphasis' : 'normal'); - } - }); - } + - /** - * @alias module:echarts/component/helper/MapDraw - * @param {module:echarts/ExtensionAPI} api - * @param {boolean} updateGroup - */ - function MapDraw(api, updateGroup) { + var SeriesModel = __webpack_require__(28); + var Tree = __webpack_require__(201); + var zrUtil = __webpack_require__(4); + var Model = __webpack_require__(12); + var formatUtil = __webpack_require__(6); + var helper = __webpack_require__(203); + var encodeHTML = formatUtil.encodeHTML; + var addCommas = formatUtil.addCommas; - var group = new graphic.Group(); - /** - * @type {module:echarts/component/helper/RoamController} - * @private - */ - this._controller = new RoamController( - api.getZr(), updateGroup ? group : null, null - ); + module.exports = SeriesModel.extend({ - /** - * @type {module:zrender/container/Group} - * @readOnly - */ - this.group = group; + type: 'series.treemap', - /** - * @type {boolean} - * @private - */ - this._updateGroup = updateGroup; + layoutMode: 'box', + + dependencies: ['grid', 'polar'], /** - * This flag is used to make sure that only one among - * `pan`, `zoom`, `click` can occurs, otherwise 'selected' - * action may be triggered when `pan`, which is unexpected. - * @type {booelan} + * @type {module:echarts/data/Tree~Node} */ - this._mouseDownFlag; - } - - MapDraw.prototype = { - - constructor: MapDraw, + _viewRoot: null, - draw: function (mapOrGeoModel, ecModel, api, fromView, payload) { + defaultOption: { + // Disable progressive rendering + progressive: 0, + hoverLayerThreshold: Infinity, + // center: ['50%', '50%'], // not supported in ec3. + // size: ['80%', '80%'], // deprecated, compatible with ec2. + left: 'center', + top: 'middle', + right: null, + bottom: null, + width: '80%', + height: '80%', + sort: true, // Can be null or false or true + // (order by desc default, asc not supported yet (strange effect)) + clipWindow: 'origin', // Size of clipped window when zooming. 'origin' or 'fullscreen' + squareRatio: 0.5 * (1 + Math.sqrt(5)), // golden ratio + leafDepth: null, // Nodes on depth from root are regarded as leaves. + // Count from zero (zero represents only view root). + drillDownIcon: '▶', // Use html character temporarily because it is complicated + // to align specialized icon. ▷▶❒❐▼✚ - var isGeo = mapOrGeoModel.mainType === 'geo'; + zoomToNodeRatio: 0.32 * 0.32, // Be effective when using zoomToNode. Specify the proportion of the + // target node area in the view area. + roam: true, // true, false, 'scale' or 'zoom', 'move'. + nodeClick: 'zoomToNode', // Leaf node click behaviour: 'zoomToNode', 'link', false. + // If leafDepth is set and clicking a node which has children but + // be on left depth, the behaviour would be changing root. Otherwise + // use behavious defined above. + animation: true, + animationDurationUpdate: 900, + animationEasing: 'quinticInOut', + breadcrumb: { + show: true, + height: 22, + left: 'center', + top: 'bottom', + // right + // bottom + emptyItemWidth: 25, // Width of empty node. + itemStyle: { + normal: { + color: 'rgba(0,0,0,0.7)', //'#5793f3', + borderColor: 'rgba(255,255,255,0.7)', + borderWidth: 1, + shadowColor: 'rgba(150,150,150,1)', + shadowBlur: 3, + shadowOffsetX: 0, + shadowOffsetY: 0, + textStyle: { + color: '#fff' + } + }, + emphasis: { + textStyle: {} + } + } + }, + label: { + normal: { + show: true, + position: 'inside', // Can be [5, '5%'] or position stirng like 'insideTopLeft', ... + textStyle: { + color: '#fff', + ellipsis: true + } + } + }, + itemStyle: { + normal: { + color: null, // Can be 'none' if not necessary. + colorAlpha: null, // Can be 'none' if not necessary. + colorSaturation: null, // Can be 'none' if not necessary. + borderWidth: 0, + gapWidth: 0, + borderColor: '#fff', + borderColorSaturation: null // If specified, borderColor will be ineffective, and the + // border color is evaluated by color of current node and + // borderColorSaturation. + }, + emphasis: { - // map series has data, geo model that controlled by map series - // has no data, otherwise data exists. - var data = mapOrGeoModel.getData && mapOrGeoModel.getData(); - isGeo && ecModel.eachComponent({mainType: 'series', subType: 'map'}, function (mapSeries) { - if (!data && mapSeries.getHostGeoModel() === mapOrGeoModel) { - data = mapSeries.getData(); } - }); + }, - var geo = mapOrGeoModel.coordinateSystem; + visualDimension: 0, // Can be 0, 1, 2, 3. + visualMin: null, + visualMax: null, - var group = this.group; + color: [], // + treemapSeries.color should not be modified. Please only modified + // level[n].color (if necessary). + // + Specify color list of each level. level[0].color would be global + // color list if not specified. (see method `setDefault`). + // + But set as a empty array to forbid fetch color from global palette + // when using nodeModel.get('color'), otherwise nodes on deep level + // will always has color palette set and are not able to inherit color + // from parent node. + // + TreemapSeries.color can not be set as 'none', otherwise effect + // legend color fetching (see seriesColor.js). + colorAlpha: null, // Array. Specify color alpha range of each level, like [0.2, 0.8] + colorSaturation: null, // Array. Specify color saturation of each level, like [0.2, 0.5] + colorMappingBy: 'index', // 'value' or 'index' or 'id'. + visibleMin: 10, // If area less than this threshold (unit: pixel^2), node will not + // be rendered. Only works when sort is 'asc' or 'desc'. + childrenVisibleMin: null, // If area of a node less than this threshold (unit: pixel^2), + // grandchildren will not show. + // Why grandchildren? If not grandchildren but children, + // some siblings show children and some not, + // the appearance may be mess and not consistent, + levels: [] // Each item: { + // visibleMin, itemStyle, visualDimension, label + // } + // data: { + // value: [], + // children: [], + // link: 'http://xxx.xxx.xxx', + // target: 'blank' or 'self' + // } + }, - var scale = geo.scale; - var groupNewProp = { - position: geo.position, - scale: scale - }; + /** + * @override + */ + getInitialData: function (option, ecModel) { + var rootName = option.name; + rootName == null && (rootName = option.name); - // No animation when first draw or in action - if (!group.childAt(0) || payload) { - group.attr(groupNewProp); - } - else { - graphic.updateProps(group, groupNewProp, mapOrGeoModel); - } + // Create a virtual root. + var root = {name: rootName, children: option.data}; - group.removeAll(); + completeTreeValue(root); - var itemStyleAccessPath = ['itemStyle', 'normal']; - var hoverItemStyleAccessPath = ['itemStyle', 'emphasis']; - var labelAccessPath = ['label', 'normal']; - var hoverLabelAccessPath = ['label', 'emphasis']; + var levels = option.levels || []; - zrUtil.each(geo.regions, function (region) { + levels = option.levels = setDefault(levels, ecModel); - var regionGroup = new graphic.Group(); - var compoundPath = new graphic.CompoundPath({ - shape: { - paths: [] - } - }); - regionGroup.add(compoundPath); + // Make sure always a new tree is created when setOption, + // in TreemapView, we check whether oldTree === newTree + // to choose mappings approach among old shapes and new shapes. + return Tree.createTree(root, this, levels).data; + }, - var regionModel = mapOrGeoModel.getRegionModel(region.name) || mapOrGeoModel; + optionUpdated: function () { + this.resetViewRoot(); + }, - var itemStyleModel = regionModel.getModel(itemStyleAccessPath); - var hoverItemStyleModel = regionModel.getModel(hoverItemStyleAccessPath); - var itemStyle = getFixedItemStyle(itemStyleModel, scale); - var hoverItemStyle = getFixedItemStyle(hoverItemStyleModel, scale); + /** + * @override + * @param {number} dataIndex + * @param {boolean} [mutipleSeries=false] + */ + formatTooltip: function (dataIndex) { + var data = this.getData(); + var value = this.getRawValue(dataIndex); + var formattedValue = zrUtil.isArray(value) + ? addCommas(value[0]) : addCommas(value); + var name = data.getName(dataIndex); - var labelModel = regionModel.getModel(labelAccessPath); - var hoverLabelModel = regionModel.getModel(hoverLabelAccessPath); + return encodeHTML(name + ': ' + formattedValue); + }, - var dataIdx; - // Use the itemStyle in data if has data - if (data) { - dataIdx = data.indexOfName(region.name); - // Only visual color of each item will be used. It can be encoded by dataRange - // But visual color of series is used in symbol drawing - // - // Visual color for each series is for the symbol draw - var visualColor = data.getItemVisual(dataIdx, 'color', true); - if (visualColor) { - itemStyle.fill = visualColor; - } - } + /** + * Add tree path to tooltip param + * + * @override + * @param {number} dataIndex + * @return {Object} + */ + getDataParams: function (dataIndex) { + var params = SeriesModel.prototype.getDataParams.apply(this, arguments); - var textStyleModel = labelModel.getModel('textStyle'); - var hoverTextStyleModel = hoverLabelModel.getModel('textStyle'); + var node = this.getData().tree.getNodeByDataIndex(dataIndex); + params.treePathInfo = helper.wrapTreePathInfo(node, this); - zrUtil.each(region.contours, function (contour) { + return params; + }, - var polygon = new graphic.Polygon({ - shape: { - points: contour - } - }); + /** + * @public + * @param {Object} layoutInfo { + * x: containerGroup x + * y: containerGroup y + * width: containerGroup width + * height: containerGroup height + * } + */ + setLayoutInfo: function (layoutInfo) { + /** + * @readOnly + * @type {Object} + */ + this.layoutInfo = this.layoutInfo || {}; + zrUtil.extend(this.layoutInfo, layoutInfo); + }, - compoundPath.shape.paths.push(polygon); - }); + /** + * @param {string} id + * @return {number} index + */ + mapIdToIndex: function (id) { + // A feature is implemented: + // index is monotone increasing with the sequence of + // input id at the first time. + // This feature can make sure that each data item and its + // mapped color have the same index between data list and + // color list at the beginning, which is useful for user + // to adjust data-color mapping. - compoundPath.setStyle(itemStyle); - compoundPath.style.strokeNoScale = true; - compoundPath.culling = true; - // Label - var showLabel = labelModel.get('show'); - var hoverShowLabel = hoverLabelModel.get('show'); + /** + * @private + * @type {Object} + */ + var idIndexMap = this._idIndexMap; - var isDataNaN = data && isNaN(data.get('value', dataIdx)); - var itemLayout = data && data.getItemLayout(dataIdx); - // In the following cases label will be drawn - // 1. In map series and data value is NaN - // 2. In geo component - // 4. Region has no series legendSymbol, which will be add a showLabel flag in mapSymbolLayout - if ( - (isGeo || isDataNaN && (showLabel || hoverShowLabel)) - || (itemLayout && itemLayout.showLabel) - ) { - var query = data ? dataIdx : region.name; - var formattedStr = mapOrGeoModel.getFormattedLabel(query, 'normal'); - var hoverFormattedStr = mapOrGeoModel.getFormattedLabel(query, 'emphasis'); - var text = new graphic.Text({ - style: { - text: showLabel ? (formattedStr || region.name) : '', - fill: textStyleModel.getTextColor(), - textFont: textStyleModel.getFont(), - textAlign: 'center', - textVerticalAlign: 'middle' - }, - hoverStyle: { - text: hoverShowLabel ? (hoverFormattedStr || region.name) : '', - fill: hoverTextStyleModel.getTextColor(), - textFont: hoverTextStyleModel.getFont() - }, - position: region.center.slice(), - scale: [1 / scale[0], 1 / scale[1]], - z2: 10, - silent: true - }); + if (!idIndexMap) { + idIndexMap = this._idIndexMap = {}; + /** + * @private + * @type {number} + */ + this._idIndexMapCount = 0; + } - regionGroup.add(text); - } + var index = idIndexMap[id]; + if (index == null) { + idIndexMap[id] = index = this._idIndexMapCount++; + } - // setItemGraphicEl, setHoverStyle after all polygons and labels - // are added to the rigionGroup - if (data) { - data.setItemGraphicEl(dataIdx, regionGroup); - } - else { - var regionModel = mapOrGeoModel.getRegionModel(region.name); - // Package custom mouse event for geo component - compoundPath.eventData = { - componentType: 'geo', - geoIndex: mapOrGeoModel.componentIndex, - name: region.name, - region: (regionModel && regionModel.option) || {} - }; - } + return index; + }, - regionGroup.__region = region; + getViewRoot: function () { + return this._viewRoot; + }, - graphic.setHoverStyle( - regionGroup, - hoverItemStyle, - {hoverSilentOnTouch: !!mapOrGeoModel.get('selectedMode')} - ); + /** + * @param {module:echarts/data/Tree~Node} [viewRoot] + */ + resetViewRoot: function (viewRoot) { + viewRoot + ? (this._viewRoot = viewRoot) + : (viewRoot = this._viewRoot); - group.add(regionGroup); - }); + var root = this.getData().tree.root; + + if (!viewRoot + || (viewRoot !== root && !root.contains(viewRoot)) + ) { + this._viewRoot = root; + } + } + }); - this._updateController(mapOrGeoModel, ecModel, api); + /** + * @param {Object} dataNode + */ + function completeTreeValue(dataNode) { + // Postorder travel tree. + // If value of none-leaf node is not set, + // calculate it by suming up the value of all children. + var sum = 0; - updateMapSelectHandler(this, mapOrGeoModel, group, api, fromView); + zrUtil.each(dataNode.children, function (child) { - updateMapSelected(mapOrGeoModel, group); - }, + completeTreeValue(child); - remove: function () { - this.group.removeAll(); - this._controller.dispose(); - }, + var childValue = child.value; + zrUtil.isArray(childValue) && (childValue = childValue[0]); - _updateController: function (mapOrGeoModel, ecModel, api) { - var geo = mapOrGeoModel.coordinateSystem; - var controller = this._controller; - controller.zoomLimit = mapOrGeoModel.get('scaleLimit'); - // Update zoom from model - controller.zoom = geo.getZoom(); - // roamType is will be set default true if it is null - controller.enable(mapOrGeoModel.get('roam') || false); - var mainType = mapOrGeoModel.mainType; + sum += childValue; + }); - function makeActionBase() { - var action = { - type: 'geoRoam', - componentType: mainType - }; - action[mainType + 'Id'] = mapOrGeoModel.id; - return action; - } + var thisValue = dataNode.value; + if (zrUtil.isArray(thisValue)) { + thisValue = thisValue[0]; + } - controller.off('pan').on('pan', function (dx, dy) { - this._mouseDownFlag = false; + if (thisValue == null || isNaN(thisValue)) { + thisValue = sum; + } + // Value should not less than 0. + if (thisValue < 0) { + thisValue = 0; + } - api.dispatchAction(zrUtil.extend(makeActionBase(), { - dx: dx, - dy: dy - })); - }, this); + zrUtil.isArray(dataNode.value) + ? (dataNode.value[0] = thisValue) + : (dataNode.value = thisValue); + } - controller.off('zoom').on('zoom', function (zoom, mouseX, mouseY) { - this._mouseDownFlag = false; + /** + * set default to level configuration + */ + function setDefault(levels, ecModel) { + var globalColorList = ecModel.get('color'); - api.dispatchAction(zrUtil.extend(makeActionBase(), { - zoom: zoom, - originX: mouseX, - originY: mouseY - })); + if (!globalColorList) { + return; + } - if (this._updateGroup) { - var group = this.group; - var scale = group.scale; - group.traverse(function (el) { - if (el.type === 'text') { - el.attr('scale', [1 / scale[0], 1 / scale[1]]); - } - }); - } - }, this); + levels = levels || []; + var hasColorDefine; + zrUtil.each(levels, function (levelDefine) { + var model = new Model(levelDefine); + var modelColor = model.get('color'); - controller.setContainsPoint(function (x, y) { - return geo.getViewRectAfterRoam().contain(x, y); - }); + if (model.get('itemStyle.normal.color') + || (modelColor && modelColor !== 'none') + ) { + hasColorDefine = true; + } + }); + + if (!hasColorDefine) { + var level0 = levels[0] || (levels[0] = {}); + level0.color = globalColorList.slice(); } - }; - module.exports = MapDraw; + return levels; + } + /***/ }, -/* 177 */ +/* 201 */ /***/ function(module, exports, __webpack_require__) { /** - * @module echarts/component/helper/RoamController + * Tree data structure + * + * @module echarts/data/Tree */ - - var Eventful = __webpack_require__(33); var zrUtil = __webpack_require__(4); - var eventTool = __webpack_require__(88); - var interactionMutex = __webpack_require__(178); - - function mousedown(e) { - if (e.target && e.target.draggable) { - return; - } + var Model = __webpack_require__(12); + var List = __webpack_require__(98); + var linkList = __webpack_require__(202); + var completeDimensions = __webpack_require__(103); - var x = e.offsetX; - var y = e.offsetY; + /** + * @constructor module:echarts/data/Tree~TreeNode + * @param {string} name + * @param {module:echarts/data/Tree} hostTree + */ + var TreeNode = function (name, hostTree) { + /** + * @type {string} + */ + this.name = name || ''; - if (this.containsPoint && this.containsPoint(x, y)) { - this._x = x; - this._y = y; - this._dragging = true; - } - } + /** + * Depth of node + * + * @type {number} + * @readOnly + */ + this.depth = 0; - function mousemove(e) { - if (!this._dragging) { - return; - } + /** + * Height of the subtree rooted at this node. + * @type {number} + * @readOnly + */ + this.height = 0; - eventTool.stop(e.event); + /** + * @type {module:echarts/data/Tree~TreeNode} + * @readOnly + */ + this.parentNode = null; - if (e.gestureEvent !== 'pinch') { + /** + * Reference to list item. + * Do not persistent dataIndex outside, + * besause it may be changed by list. + * If dataIndex -1, + * this node is logical deleted (filtered) in list. + * + * @type {Object} + * @readOnly + */ + this.dataIndex = -1; - if (interactionMutex.isTaken(this._zr, 'globalPan')) { - return; - } + /** + * @type {Array.} + * @readOnly + */ + this.children = []; - var x = e.offsetX; - var y = e.offsetY; + /** + * @type {Array.} + * @pubilc + */ + this.viewChildren = []; - var oldX = this._x; - var oldY = this._y; + /** + * @type {moduel:echarts/data/Tree} + * @readOnly + */ + this.hostTree = hostTree; + }; - var dx = x - oldX; - var dy = y - oldY; + TreeNode.prototype = { - this._x = x; - this._y = y; + constructor: TreeNode, - var target = this.target; + /** + * The node is removed. + * @return {boolean} is removed. + */ + isRemoved: function () { + return this.dataIndex < 0; + }, - if (target) { - var pos = target.position; - pos[0] += dx; - pos[1] += dy; - target.dirty(); + /** + * Travel this subtree (include this node). + * Usage: + * node.eachNode(function () { ... }); // preorder + * node.eachNode('preorder', function () { ... }); // preorder + * node.eachNode('postorder', function () { ... }); // postorder + * node.eachNode( + * {order: 'postorder', attr: 'viewChildren'}, + * function () { ... } + * ); // postorder + * + * @param {(Object|string)} options If string, means order. + * @param {string=} options.order 'preorder' or 'postorder' + * @param {string=} options.attr 'children' or 'viewChildren' + * @param {Function} cb If in preorder and return false, + * its subtree will not be visited. + * @param {Object} [context] + */ + eachNode: function (options, cb, context) { + if (typeof options === 'function') { + context = cb; + cb = options; + options = null; } - eventTool.stop(e.event); - this.trigger('pan', dx, dy, oldX, oldY, x, y); - } - } + options = options || {}; + if (zrUtil.isString(options)) { + options = {order: options}; + } - function mouseup(e) { - this._dragging = false; - } + var order = options.order || 'preorder'; + var children = this[options.attr || 'children']; - function mousewheel(e) { - // Convenience: - // Mac and VM Windows on Mac: scroll up: zoom out. - // Windows: scroll up: zoom in. - var zoomDelta = e.wheelDelta > 0 ? 1.1 : 1 / 1.1; - zoom.call(this, e, zoomDelta, e.offsetX, e.offsetY); - } + var suppressVisitSub; + order === 'preorder' && (suppressVisitSub = cb.call(context, this)); - function pinch(e) { - if (interactionMutex.isTaken(this._zr, 'globalPan')) { - return; - } - var zoomDelta = e.pinchScale > 1 ? 1.1 : 1 / 1.1; - zoom.call(this, e, zoomDelta, e.pinchX, e.pinchY); - } + for (var i = 0; !suppressVisitSub && i < children.length; i++) { + children[i].eachNode(options, cb, context); + } - function zoom(e, zoomDelta, zoomX, zoomY) { - if (this.containsPoint && this.containsPoint(zoomX, zoomY)) { - // When mouse is out of roamController rect, - // default befavoius should be be disabled, otherwise - // page sliding is disabled, contrary to expectation. - eventTool.stop(e.event); + order === 'postorder' && cb.call(context, this); + }, - var target = this.target; - var zoomLimit = this.zoomLimit; + /** + * Update depth and height of this subtree. + * + * @param {number} depth + */ + updateDepthAndHeight: function (depth) { + var height = 0; + this.depth = depth; + for (var i = 0; i < this.children.length; i++) { + var child = this.children[i]; + child.updateDepthAndHeight(depth + 1); + if (child.height > height) { + height = child.height; + } + } + this.height = height + 1; + }, - if (target) { - var pos = target.position; - var scale = target.scale; + /** + * @param {string} id + * @return {module:echarts/data/Tree~TreeNode} + */ + getNodeById: function (id) { + if (this.getId() === id) { + return this; + } + for (var i = 0, children = this.children, len = children.length; i < len; i++) { + var res = children[i].getNodeById(id); + if (res) { + return res; + } + } + }, - var newZoom = this.zoom = this.zoom || 1; - newZoom *= zoomDelta; - if (zoomLimit) { - var zoomMin = zoomLimit.min || 0; - var zoomMax = zoomLimit.max || Infinity; - newZoom = Math.max( - Math.min(zoomMax, newZoom), - zoomMin - ); + /** + * @param {module:echarts/data/Tree~TreeNode} node + * @return {boolean} + */ + contains: function (node) { + if (node === this) { + return true; + } + for (var i = 0, children = this.children, len = children.length; i < len; i++) { + var res = children[i].contains(node); + if (res) { + return res; } - var zoomScale = newZoom / this.zoom; - this.zoom = newZoom; - // Keep the mouse center when scaling - pos[0] -= (zoomX - pos[0]) * (zoomScale - 1); - pos[1] -= (zoomY - pos[1]) * (zoomScale - 1); - scale[0] *= zoomScale; - scale[1] *= zoomScale; + } + }, - target.dirty(); + /** + * @param {boolean} includeSelf Default false. + * @return {Array.} order: [root, child, grandchild, ...] + */ + getAncestors: function (includeSelf) { + var ancestors = []; + var node = includeSelf ? this : this.parentNode; + while (node) { + ancestors.push(node); + node = node.parentNode; } + ancestors.reverse(); + return ancestors; + }, - this.trigger('zoom', zoomDelta, zoomX, zoomY); + /** + * @param {string|Array=} [dimension='value'] Default 'value'. can be 0, 1, 2, 3 + * @return {number} Value. + */ + getValue: function (dimension) { + var data = this.hostTree.data; + return data.get(data.getDimension(dimension || 'value'), this.dataIndex); + }, + + /** + * @param {Object} layout + * @param {boolean=} [merge=false] + */ + setLayout: function (layout, merge) { + this.dataIndex >= 0 + && this.hostTree.data.setItemLayout(this.dataIndex, layout, merge); + }, + + /** + * @return {Object} layout + */ + getLayout: function () { + return this.hostTree.data.getItemLayout(this.dataIndex); + }, + + /** + * @param {string} path + * @return {module:echarts/model/Model} + */ + getModel: function (path) { + if (this.dataIndex < 0) { + return; + } + var hostTree = this.hostTree; + var itemModel = hostTree.data.getItemModel(this.dataIndex); + var levelModel = this.getLevelModel(); + + return itemModel.getModel(path, (levelModel || hostTree.hostModel).getModel(path)); + }, + + /** + * @return {module:echarts/model/Model} + */ + getLevelModel: function () { + return (this.hostTree.levelModels || [])[this.depth]; + }, + + /** + * @example + * setItemVisual('color', color); + * setItemVisual({ + * 'color': color + * }); + */ + setVisual: function (key, value) { + this.dataIndex >= 0 + && this.hostTree.data.setItemVisual(this.dataIndex, key, value); + }, + + /** + * Get item visual + */ + getVisual: function (key, ignoreParent) { + return this.hostTree.data.getItemVisual(this.dataIndex, key, ignoreParent); + }, + + /** + * @public + * @return {number} + */ + getRawIndex: function () { + return this.hostTree.data.getRawIndex(this.dataIndex); + }, + + /** + * @public + * @return {string} + */ + getId: function () { + return this.hostTree.data.getId(this.dataIndex); } - } + }; /** - * @alias module:echarts/component/helper/RoamController * @constructor - * @mixin {module:zrender/mixin/Eventful} - * - * @param {module:zrender/zrender~ZRender} zr - * @param {module:zrender/Element} target + * @alias module:echarts/data/Tree + * @param {module:echarts/model/Model} hostModel + * @param {Array.} levelOptions */ - function RoamController(zr, target) { - + function Tree(hostModel, levelOptions) { /** - * @type {module:zrender/Element} + * @type {module:echarts/data/Tree~TreeNode} + * @readOnly */ - this.target = target; + this.root; /** - * @type {Function} + * @type {module:echarts/data/List} + * @readOnly */ - this.containsPoint; + this.data; /** - * { min: 1, max: 2 } - * @type {Object} + * Index of each item is the same as the raw index of coresponding list item. + * @private + * @type {Array.} levelOptions + * @return module:echarts/data/Tree + */ + Tree.createTree = function (dataRoot, hostModel, levelOptions) { - this.isPinching = function () { - return this._pinching; - }; - } + var tree = new Tree(hostModel, levelOptions); + var listData = []; + var dimMax = 1; - zrUtil.mixin(RoamController, Eventful); + buildHierarchy(dataRoot); - module.exports = RoamController; + function buildHierarchy(dataNode, parentNode) { + var value = dataNode.value; + dimMax = Math.max(dimMax, zrUtil.isArray(value) ? value.length : 1); + listData.push(dataNode); -/***/ }, -/* 178 */ -/***/ function(module, exports, __webpack_require__) { + var node = new TreeNode(dataNode.name, tree); + parentNode + ? addChild(node, parentNode) + : (tree.root = node); - + tree._nodes.push(node); - var ATTR = '\0_ec_interaction_mutex'; + var children = dataNode.children; + if (children) { + for (var i = 0; i < children.length; i++) { + buildHierarchy(children[i], node); + } + } + } - var interactionMutex = { + tree.root.updateDepthAndHeight(0); - take: function (zr, resourceKey, userKey) { - var store = getStore(zr); - store[resourceKey] = userKey; - }, + var dimensions = completeDimensions([{name: 'value'}], listData, {dimCount: dimMax}); + var list = new List(dimensions, hostModel); + list.initData(listData); - release: function (zr, resourceKey, userKey) { - var store = getStore(zr); - var uKey = store[resourceKey]; + linkList({ + mainData: list, + struct: tree, + structAttr: 'tree' + }); - if (uKey === userKey) { - store[resourceKey] = null; - } - }, + tree.update(); - isTaken: function (zr, resourceKey) { - return !!getStore(zr)[resourceKey]; - } + return tree; }; - function getStore(zr) { - return zr[ATTR] || (zr[ATTR] = {}); - } - /** - * payload: { - * type: 'takeGlobalCursor', - * key: 'dataZoomSelect', or 'brush', or ..., - * If no userKey, release global cursor. - * } + * It is needed to consider the mess of 'list', 'hostModel' when creating a TreeNote, + * so this function is not ready and not necessary to be public. + * + * @param {(module:echarts/data/Tree~TreeNode|Object)} child */ - __webpack_require__(1).registerAction( - {type: 'takeGlobalCursor', event: 'globalCursorTaken', update: 'update'}, - function () {} - ); + function addChild(child, node) { + var children = node.children; + if (child.parentNode === node) { + return; + } - module.exports = interactionMutex; + children.push(child); + child.parentNode = node; + } + + module.exports = Tree; /***/ }, -/* 179 */ +/* 202 */ /***/ function(module, exports, __webpack_require__) { - + /** + * Link lists and struct (graph or tree) + */ + var zrUtil = __webpack_require__(4); - var roamHelper = __webpack_require__(180); + var each = zrUtil.each; - var echarts = __webpack_require__(1); + var DATAS = '\0__link_datas'; + var MAIN_DATA = '\0__link_mainData'; + + // Caution: + // In most case, either list or its shallow clones (see list.cloneShallow) + // is active in echarts process. So considering heap memory consumption, + // we do not clone tree or graph, but share them among list and its shallow clones. + // But in some rare case, we have to keep old list (like do animation in chart). So + // please take care that both the old list and the new list share the same tree/graph. /** - * @payload - * @property {string} [componentType=series] - * @property {number} [dx] - * @property {number} [dy] - * @property {number} [zoom] - * @property {number} [originX] - * @property {number} [originY] + * @param {Object} opt + * @param {module:echarts/data/List} opt.mainData + * @param {Object} [opt.struct] For example, instance of Graph or Tree. + * @param {string} [opt.structAttr] designation: list[structAttr] = struct; + * @param {Object} [opt.datas] {dataType: data}, + * like: {node: nodeList, edge: edgeList}. + * Should contain mainData. + * @param {Object} [opt.datasAttr] {dataType: attr}, + * designation: struct[datasAttr[dataType]] = list; */ - echarts.registerAction({ - type: 'geoRoam', - event: 'geoRoam', - update: 'updateLayout' - }, function (payload, ecModel) { - var componentType = payload.componentType || 'series'; + function linkList(opt) { + var mainData = opt.mainData; + var datas = opt.datas; - ecModel.eachComponent( - { mainType: componentType, query: payload }, - function (componentModel) { - var geo = componentModel.coordinateSystem; - if (geo.type !== 'geo') { - return; - } + if (!datas) { + datas = {main: mainData}; + opt.datasAttr = {main: 'data'}; + } + opt.datas = opt.mainData = null; - var res = roamHelper.updateCenterAndZoom( - geo, payload, componentModel.get('scaleLimit') - ); + linkAll(mainData, datas, opt); - componentModel.setCenter - && componentModel.setCenter(res.center); + // Porxy data original methods. + each(datas, function (data) { + each(mainData.TRANSFERABLE_METHODS, function (methodName) { + data.wrapMethod(methodName, zrUtil.curry(transferInjection, opt)); + }); - componentModel.setZoom - && componentModel.setZoom(res.zoom); + }); - // All map series with same `map` use the same geo coordinate system - // So the center and zoom must be in sync. Include the series not selected by legend - if (componentType === 'series') { - zrUtil.each(componentModel.seriesGroup, function (seriesModel) { - seriesModel.setCenter(res.center); - seriesModel.setZoom(res.zoom); - }); - } - } - ); - }); + // Beyond transfer, additional features should be added to `cloneShallow`. + mainData.wrapMethod('cloneShallow', zrUtil.curry(cloneShallowInjection, opt)); + // Only mainData trigger change, because struct.update may trigger + // another changable methods, which may bring about dead lock. + each(mainData.CHANGABLE_METHODS, function (methodName) { + mainData.wrapMethod(methodName, zrUtil.curry(changeInjection, opt)); + }); -/***/ }, -/* 180 */ -/***/ function(module, exports) { + // Make sure datas contains mainData. + zrUtil.assert(datas[mainData.dataType] === mainData); + } - + function transferInjection(opt, res) { + if (isMainData(this)) { + // Transfer datas to new main data. + var datas = zrUtil.extend({}, this[DATAS]); + datas[this.dataType] = res; + linkAll(res, datas, opt); + } + else { + // Modify the reference in main data to point newData. + linkSingle(res, this.dataType, this[MAIN_DATA], opt); + } + return res; + } - var roamHelper = {}; + function changeInjection(opt, res) { + opt.struct && opt.struct.update(this); + return res; + } + + function cloneShallowInjection(opt, res) { + // cloneShallow, which brings about some fragilities, may be inappropriate + // to be exposed as an API. So for implementation simplicity we can make + // the restriction that cloneShallow of not-mainData should not be invoked + // outside, but only be invoked here. + each(res[DATAS], function (data, dataType) { + data !== res && linkSingle(data.cloneShallow(), dataType, res, opt); + }); + return res; + } /** - * @param {module:echarts/coord/View} view - * @param {Object} payload - * @param {Object} [zoomLimit] + * Supplement method to List. + * + * @public + * @param {string} [dataType] If not specified, return mainData. + * @return {module:echarts/data/List} */ - roamHelper.updateCenterAndZoom = function ( - view, payload, zoomLimit - ) { - var previousZoom = view.getZoom(); - var center = view.getCenter(); - var zoom = payload.zoom; - - var point = view.dataToPoint(center); - - if (payload.dx != null && payload.dy != null) { - point[0] -= payload.dx; - point[1] -= payload.dy; + function getLinkedData(dataType) { + var mainData = this[MAIN_DATA]; + return (dataType == null || mainData == null) + ? mainData + : mainData[DATAS][dataType]; + } - var center = view.pointToData(point); - view.setCenter(center); - } - if (zoom != null) { - if (zoomLimit) { - var zoomMin = zoomLimit.min || 0; - var zoomMax = zoomLimit.max || Infinity; - zoom = Math.max( - Math.min(previousZoom * zoom, zoomMax), - zoomMin - ) / previousZoom; - } + function isMainData(data) { + return data[MAIN_DATA] === data; + } - // Zoom on given point(originX, originY) - view.scale[0] *= zoom; - view.scale[1] *= zoom; - var position = view.position; - var fixX = (payload.originX - position[0]) * (zoom - 1); - var fixY = (payload.originY - position[1]) * (zoom - 1); + function linkAll(mainData, datas, opt) { + mainData[DATAS] = {}; + each(datas, function (data, dataType) { + linkSingle(data, dataType, mainData, opt); + }); + } - position[0] -= fixX; - position[1] -= fixY; + function linkSingle(data, dataType, mainData, opt) { + mainData[DATAS][dataType] = data; + data[MAIN_DATA] = mainData; + data.dataType = dataType; - view.updateTransform(); - // Get the new center - var center = view.pointToData(point); - view.setCenter(center); - view.setZoom(zoom * previousZoom); + if (opt.struct) { + data[opt.structAttr] = opt.struct; + opt.struct[opt.datasAttr[dataType]] = data; } - return { - center: view.getCenter(), - zoom: view.getZoom() - }; - }; + // Supplement method. + data.getLinkedData = getLinkedData; + } - module.exports = roamHelper; + module.exports = linkList; /***/ }, -/* 181 */ +/* 203 */ /***/ function(module, exports, __webpack_require__) { var zrUtil = __webpack_require__(4); - module.exports = function (ecModel) { + var helper = { - var processedMapType = {}; + retrieveTargetInfo: function (payload, seriesModel) { + if (payload + && ( + payload.type === 'treemapZoomToNode' + || payload.type === 'treemapRootToNode' + ) + ) { + var root = seriesModel.getData().tree.root; + var targetNode = payload.targetNode; + if (targetNode && root.contains(targetNode)) { + return {node: targetNode}; + } - ecModel.eachSeriesByType('map', function (mapSeries) { - var mapType = mapSeries.getMapType(); - if (mapSeries.getHostGeoModel() || processedMapType[mapType]) { - return; + var targetNodeId = payload.targetNodeId; + if (targetNodeId != null && (targetNode = root.getNodeById(targetNodeId))) { + return {node: targetNode}; + } } + }, - var mapSymbolOffsets = {}; + // Not includes the given node at the last item. + getPathToRoot: function (node) { + var path = []; + while (node) { + node = node.parentNode; + node && path.push(node); + } + return path.reverse(); + }, - zrUtil.each(mapSeries.seriesGroup, function (subMapSeries) { - var geo = subMapSeries.coordinateSystem; - var data = subMapSeries.originalData; - if (subMapSeries.get('showLegendSymbol') && ecModel.getComponent('legend')) { - data.each('value', function (value, idx) { - var name = data.getName(idx); - var region = geo.getRegion(name); + aboveViewRoot: function (viewRoot, node) { + var viewPath = helper.getPathToRoot(viewRoot); + return zrUtil.indexOf(viewPath, node) >= 0; + }, - // If input series.data is [11, 22, '-'/null/undefined, 44], - // it will be filled with NaN: [11, 22, NaN, 44] and NaN will - // not be drawn. So here must validate if value is NaN. - if (!region || isNaN(value)) { - return; - } + // From root to the input node (the input node will be included). + wrapTreePathInfo: function (node, seriesModel) { + var treePathInfo = []; - var offset = mapSymbolOffsets[name] || 0; + while (node) { + var nodeDataIndex = node.dataIndex; + treePathInfo.push({ + name: node.name, + dataIndex: nodeDataIndex, + value: seriesModel.getRawValue(nodeDataIndex) + }); + node = node.parentNode; + } - var point = geo.dataToPoint(region.center); + treePathInfo.reverse(); - mapSymbolOffsets[name] = offset + 1; + return treePathInfo; + } + }; - data.setItemLayout(idx, { - point: point, - offset: offset - }); - }); - } - }); + module.exports = helper; - // Show label of those region not has legendSymbol(which is offset 0) - var data = mapSeries.getData(); - data.each(function (idx) { - var name = data.getName(idx); - var layout = data.getItemLayout(idx) || {}; - layout.showLabel = !mapSymbolOffsets[name]; - data.setItemLayout(idx, layout); - }); - processedMapType[mapType] = true; - }); - }; +/***/ }, +/* 204 */ +/***/ function(module, exports, __webpack_require__) { + + + + var zrUtil = __webpack_require__(4); + var graphic = __webpack_require__(44); + var DataDiffer = __webpack_require__(99); + var helper = __webpack_require__(203); + var Breadcrumb = __webpack_require__(205); + var RoamController = __webpack_require__(191); + var BoundingRect = __webpack_require__(9); + var matrix = __webpack_require__(11); + var animationUtil = __webpack_require__(206); + var bind = zrUtil.bind; + var Group = graphic.Group; + var Rect = graphic.Rect; + var each = zrUtil.each; + + var DRAG_THRESHOLD = 3; + var PATH_LABEL_NORMAL = ['label', 'normal']; + var PATH_LABEL_EMPHASIS = ['label', 'emphasis']; + var Z_BASE = 10; // Should bigger than every z. + var Z_BG = 1; + var Z_CONTENT = 2; + + module.exports = __webpack_require__(1).extendChartView({ + + type: 'treemap', + + /** + * @override + */ + init: function (o, api) { + + /** + * @private + * @type {module:zrender/container/Group} + */ + this._containerGroup; + /** + * @private + * @type {Object.>} + */ + this._storage = createStorage(); -/***/ }, -/* 182 */ -/***/ function(module, exports) { + /** + * @private + * @type {module:echarts/data/Tree} + */ + this._oldTree; - - module.exports = function (ecModel) { - ecModel.eachSeriesByType('map', function (seriesModel) { - var colorList = seriesModel.get('color'); - var itemStyleModel = seriesModel.getModel('itemStyle.normal'); + /** + * @private + * @type {module:echarts/chart/treemap/Breadcrumb} + */ + this._breadcrumb; - var areaColor = itemStyleModel.get('areaColor'); - var color = itemStyleModel.get('color') - || colorList[seriesModel.seriesIndex % colorList.length]; + /** + * @private + * @type {module:echarts/component/helper/RoamController} + */ + this._controller; - seriesModel.getData().setVisual({ - 'areaColor': areaColor, - 'color': color - }); - }); - }; + /** + * 'ready', 'animating' + * @private + */ + this._state = 'ready'; + /** + * @private + * @type {boolean} + */ + this._mayClick; + }, -/***/ }, -/* 183 */ -/***/ function(module, exports, __webpack_require__) { + /** + * @override + */ + render: function (seriesModel, ecModel, api, payload) { - + var models = ecModel.findComponents({ + mainType: 'series', subType: 'treemap', query: payload + }); + if (zrUtil.indexOf(models, seriesModel) < 0) { + return; + } - var zrUtil = __webpack_require__(4); + this.seriesModel = seriesModel; + this.api = api; + this.ecModel = ecModel; - // FIXME 公用? - /** - * @param {Array.} datas - * @param {string} statisticType 'average' 'sum' - * @inner - */ - function dataStatistics(datas, statisticType) { - var dataNameMap = {}; - var dims = ['value']; + var targetInfo = helper.retrieveTargetInfo(payload, seriesModel); + var payloadType = payload && payload.type; + var layoutInfo = seriesModel.layoutInfo; + var isInit = !this._oldTree; + var thisStorage = this._storage; - zrUtil.each(datas, function (data) { - data.each(dims, function (value, idx) { - var name = data.getName(idx); - dataNameMap[name] = dataNameMap[name] || []; - if (!isNaN(value)) { - dataNameMap[name].push(value); + // Mark new root when action is treemapRootToNode. + var reRoot = (payloadType === 'treemapRootToNode' && targetInfo && thisStorage) + ? { + rootNodeGroup: thisStorage.nodeGroup[targetInfo.node.getRawIndex()], + direction: payload.direction } - }); - }); - - return datas[0].map(dims, function (value, idx) { - var name = datas[0].getName(idx); - var sum = 0; - var min = Infinity; - var max = -Infinity; - var len = dataNameMap[name].length; - for (var i = 0; i < len; i++) { - min = Math.min(min, dataNameMap[name][i]); - max = Math.max(max, dataNameMap[name][i]); - sum += dataNameMap[name][i]; - } - var result; - if (statisticType === 'min') { - result = min; - } - else if (statisticType === 'max') { - result = max; - } - else if (statisticType === 'average') { - result = sum / len; - } - else { - result = sum; - } - return len === 0 ? NaN : result; - }); - } + : null; - module.exports = function (ecModel) { - var seriesGroups = {}; - ecModel.eachSeriesByType('map', function (seriesModel) { - var hostGeoModel = seriesModel.getHostGeoModel(); - var key = hostGeoModel ? 'o' + hostGeoModel.id : 'i' + seriesModel.getMapType(); - (seriesGroups[key] = seriesGroups[key] || []).push(seriesModel); - }); + var containerGroup = this._giveContainerGroup(layoutInfo); - zrUtil.each(seriesGroups, function (seriesList, key) { - var data = dataStatistics( - zrUtil.map(seriesList, function (seriesModel) { - return seriesModel.getData(); - }), - seriesList[0].get('mapValueCalculation') - ); + var renderResult = this._doRender(containerGroup, seriesModel, reRoot); + ( + !isInit && ( + !payloadType + || payloadType === 'treemapZoomToNode' + || payloadType === 'treemapRootToNode' + ) + ) + ? this._doAnimation(containerGroup, renderResult, seriesModel, reRoot) + : renderResult.renderFinally(); - for (var i = 0; i < seriesList.length; i++) { - seriesList[i].originalData = seriesList[i].getData(); - } + this._resetController(api); - // FIXME Put where? - for (var i = 0; i < seriesList.length; i++) { - seriesList[i].seriesGroup = seriesList; - seriesList[i].needsDrawMap = i === 0 && !seriesList[i].getHostGeoModel(); + this._renderBreadcrumb(seriesModel, api, targetInfo); + }, - seriesList[i].setData(data.cloneShallow()); - seriesList[i].mainSeries = seriesList[0]; + /** + * @private + */ + _giveContainerGroup: function (layoutInfo) { + var containerGroup = this._containerGroup; + if (!containerGroup) { + // FIXME + // 加一层containerGroup是为了clip,但是现在clip功能并没有实现。 + containerGroup = this._containerGroup = new Group(); + this._initEvents(containerGroup); + this.group.add(containerGroup); } - }); - }; + containerGroup.attr('position', [layoutInfo.x, layoutInfo.y]); + return containerGroup; + }, -/***/ }, -/* 184 */ -/***/ function(module, exports, __webpack_require__) { + /** + * @private + */ + _doRender: function (containerGroup, seriesModel, reRoot) { + var thisTree = seriesModel.getData().tree; + var oldTree = this._oldTree; - + // Clear last shape records. + var lastsForAnimation = createStorage(); + var thisStorage = createStorage(); + var oldStorage = this._storage; + var willInvisibleEls = []; + var doRenderNode = zrUtil.curry( + renderNode, seriesModel, + thisStorage, oldStorage, reRoot, + lastsForAnimation, willInvisibleEls + ); - var zrUtil = __webpack_require__(4); + // Notice: when thisTree and oldTree are the same tree (see list.cloneShadow), + // the oldTree is actually losted, so we can not find all of the old graphic + // elements from tree. So we use this stragegy: make element storage, move + // from old storage to new storage, clear old storage. - module.exports = function (option) { - // Save geoCoord - var mapSeries = []; - zrUtil.each(option.series, function (seriesOpt) { - if (seriesOpt.type === 'map') { - mapSeries.push(seriesOpt); - } - }); + dualTravel( + thisTree.root ? [thisTree.root] : [], + (oldTree && oldTree.root) ? [oldTree.root] : [], + containerGroup, + thisTree === oldTree || !oldTree, + 0 + ); - zrUtil.each(mapSeries, function (seriesOpt) { - seriesOpt.map = seriesOpt.map || seriesOpt.mapType; - // Put x, y, width, height, x2, y2 in the top level - zrUtil.defaults(seriesOpt, seriesOpt.mapLocation); - }); - }; + // Process all removing. + var willDeleteEls = clearStorage(oldStorage); + this._oldTree = thisTree; + this._storage = thisStorage; -/***/ }, -/* 185 */ -/***/ function(module, exports, __webpack_require__) { + return { + lastsForAnimation: lastsForAnimation, + willDeleteEls: willDeleteEls, + renderFinally: renderFinally + }; - + function dualTravel(thisViewChildren, oldViewChildren, parentGroup, sameTree, depth) { + // When 'render' is triggered by action, + // 'this' and 'old' may be the same tree, + // we use rawIndex in that case. + if (sameTree) { + oldViewChildren = thisViewChildren; + each(thisViewChildren, function (child, index) { + !child.isRemoved() && processNode(index, index); + }); + } + // Diff hierarchically (diff only in each subtree, but not whole). + // because, consistency of view is important. + else { + (new DataDiffer(oldViewChildren, thisViewChildren, getKey, getKey)) + .add(processNode) + .update(processNode) + .remove(zrUtil.curry(processNode, null)) + .execute(); + } - var echarts = __webpack_require__(1); + function getKey(node) { + // Identify by name or raw index. + return node.getId(); + } - __webpack_require__(186); - __webpack_require__(190); - __webpack_require__(193); + function processNode(newIndex, oldIndex) { + var thisNode = newIndex != null ? thisViewChildren[newIndex] : null; + var oldNode = oldIndex != null ? oldViewChildren[oldIndex] : null; - echarts.registerVisual(__webpack_require__(194)); + var group = doRenderNode(thisNode, oldNode, parentGroup, depth); - echarts.registerLayout(__webpack_require__(196)); + group && dualTravel( + thisNode && thisNode.viewChildren || [], + oldNode && oldNode.viewChildren || [], + group, + sameTree, + depth + 1 + ); + } + } + function clearStorage(storage) { + var willDeleteEls = createStorage(); + storage && each(storage, function (store, storageName) { + var delEls = willDeleteEls[storageName]; + each(store, function (el) { + el && (delEls.push(el), el.__tmWillDelete = 1); + }); + }); + return willDeleteEls; + } -/***/ }, -/* 186 */ -/***/ function(module, exports, __webpack_require__) { + function renderFinally() { + each(willDeleteEls, function (els) { + each(els, function (el) { + el.parent && el.parent.remove(el); + }); + }); + each(willInvisibleEls, function (el) { + el.invisible = true; + // Setting invisible is for optimizing, so no need to set dirty, + // just mark as invisible. + el.dirty(); + }); + } + }, - + /** + * @private + */ + _doAnimation: function (containerGroup, renderResult, seriesModel, reRoot) { + if (!seriesModel.get('animation')) { + return; + } - var SeriesModel = __webpack_require__(28); - var Tree = __webpack_require__(187); - var zrUtil = __webpack_require__(4); - var Model = __webpack_require__(12); - var formatUtil = __webpack_require__(6); - var helper = __webpack_require__(189); - var encodeHTML = formatUtil.encodeHTML; - var addCommas = formatUtil.addCommas; + var duration = seriesModel.get('animationDurationUpdate'); + var easing = seriesModel.get('animationEasing'); + var animationWrap = animationUtil.createWrap(); + // Make delete animations. + each(renderResult.willDeleteEls, function (store, storageName) { + each(store, function (el, rawIndex) { + if (el.invisible) { + return; + } - module.exports = SeriesModel.extend({ + var parent = el.parent; // Always has parent, and parent is nodeGroup. + var target; - type: 'series.treemap', + if (reRoot && reRoot.direction === 'drillDown') { + target = parent === reRoot.rootNodeGroup + // This is the content element of view root. + // Only `content` will enter this branch, because + // `background` and `nodeGroup` will not be deleted. + ? { + shape: { + x: 0, + y: 0, + width: parent.__tmNodeWidth, + height: parent.__tmNodeHeight + }, + style: { + opacity: 0 + } + } + // Others. + : {style: {opacity: 0}}; + } + else { + var targetX = 0; + var targetY = 0; - layoutMode: 'box', + if (!parent.__tmWillDelete) { + // Let node animate to right-bottom corner, cooperating with fadeout, + // which is appropriate for user understanding. + // Divided by 2 for reRoot rolling up effect. + targetX = parent.__tmNodeWidth / 2; + targetY = parent.__tmNodeHeight / 2; + } - dependencies: ['grid', 'polar'], + target = storageName === 'nodeGroup' + ? {position: [targetX, targetY], style: {opacity: 0}} + : { + shape: {x: targetX, y: targetY, width: 0, height: 0}, + style: {opacity: 0} + }; + } - /** - * @type {module:echarts/data/Tree~Node} - */ - _viewRoot: null, + target && animationWrap.add(el, target, duration, easing); + }); + }); - defaultOption: { - // Disable progressive rendering - progressive: 0, - hoverLayerThreshold: Infinity, - // center: ['50%', '50%'], // not supported in ec3. - // size: ['80%', '80%'], // deprecated, compatible with ec2. - left: 'center', - top: 'middle', - right: null, - bottom: null, - width: '80%', - height: '80%', - sort: true, // Can be null or false or true - // (order by desc default, asc not supported yet (strange effect)) - clipWindow: 'origin', // Size of clipped window when zooming. 'origin' or 'fullscreen' - squareRatio: 0.5 * (1 + Math.sqrt(5)), // golden ratio - leafDepth: null, // Nodes on depth from root are regarded as leaves. - // Count from zero (zero represents only view root). - drillDownIcon: '▶', // Use html character temporarily because it is complicated - // to align specialized icon. ▷▶❒❐▼✚ + // Make other animations + each(this._storage, function (store, storageName) { + each(store, function (el, rawIndex) { + var last = renderResult.lastsForAnimation[storageName][rawIndex]; + var target = {}; - zoomToNodeRatio: 0.32 * 0.32, // Be effective when using zoomToNode. Specify the proportion of the - // target node area in the view area. - roam: true, // true, false, 'scale' or 'zoom', 'move'. - nodeClick: 'zoomToNode', // Leaf node click behaviour: 'zoomToNode', 'link', false. - // If leafDepth is set and clicking a node which has children but - // be on left depth, the behaviour would be changing root. Otherwise - // use behavious defined above. - animation: true, - animationDurationUpdate: 900, - animationEasing: 'quinticInOut', - breadcrumb: { - show: true, - height: 22, - left: 'center', - top: 'bottom', - // right - // bottom - emptyItemWidth: 25, // Width of empty node. - itemStyle: { - normal: { - color: 'rgba(0,0,0,0.7)', //'#5793f3', - borderColor: 'rgba(255,255,255,0.7)', - borderWidth: 1, - shadowColor: 'rgba(150,150,150,1)', - shadowBlur: 3, - shadowOffsetX: 0, - shadowOffsetY: 0, - textStyle: { - color: '#fff' + if (!last) { + return; + } + + if (storageName === 'nodeGroup') { + if (last.old) { + target.position = el.position.slice(); + el.attr('position', last.old); } - }, - emphasis: { - textStyle: {} } - } - }, - label: { - normal: { - show: true, - position: 'inside', // Can be [5, '5%'] or position stirng like 'insideTopLeft', ... - textStyle: { - color: '#fff', - ellipsis: true + else { + if (last.old) { + target.shape = zrUtil.extend({}, el.shape); + el.setShape(last.old); + } + + if (last.fadein) { + el.setStyle('opacity', 0); + target.style = {opacity: 1}; + } + // When animation is stopped for succedent animation starting, + // el.style.opacity might not be 1 + else if (el.style.opacity !== 1) { + target.style = {opacity: 1}; + } } - } - }, - itemStyle: { - normal: { - color: null, // Can be 'none' if not necessary. - colorAlpha: null, // Can be 'none' if not necessary. - colorSaturation: null, // Can be 'none' if not necessary. - borderWidth: 0, - gapWidth: 0, - borderColor: '#fff', - borderColorSaturation: null // If specified, borderColor will be ineffective, and the - // border color is evaluated by color of current node and - // borderColorSaturation. - }, - emphasis: { - } - }, + animationWrap.add(el, target, duration, easing); + }); + }, this); - visualDimension: 0, // Can be 0, 1, 2, 3. - visualMin: null, - visualMax: null, + this._state = 'animating'; - color: [], // + treemapSeries.color should not be modified. Please only modified - // level[n].color (if necessary). - // + Specify color list of each level. level[0].color would be global - // color list if not specified. (see method `setDefault`). - // + But set as a empty array to forbid fetch color from global palette - // when using nodeModel.get('color'), otherwise nodes on deep level - // will always has color palette set and are not able to inherit color - // from parent node. - // + TreemapSeries.color can not be set as 'none', otherwise effect - // legend color fetching (see seriesColor.js). - colorAlpha: null, // Array. Specify color alpha range of each level, like [0.2, 0.8] - colorSaturation: null, // Array. Specify color saturation of each level, like [0.2, 0.5] - colorMappingBy: 'index', // 'value' or 'index' or 'id'. - visibleMin: 10, // If area less than this threshold (unit: pixel^2), node will not - // be rendered. Only works when sort is 'asc' or 'desc'. - childrenVisibleMin: null, // If area of a node less than this threshold (unit: pixel^2), - // grandchildren will not show. - // Why grandchildren? If not grandchildren but children, - // some siblings show children and some not, - // the appearance may be mess and not consistent, - levels: [] // Each item: { - // visibleMin, itemStyle, visualDimension, label - // } - // data: { - // value: [], - // children: [], - // link: 'http://xxx.xxx.xxx', - // target: 'blank' or 'self' - // } + animationWrap + .done(bind(function () { + this._state = 'ready'; + renderResult.renderFinally(); + }, this)) + .start(); }, /** - * @override + * @private */ - getInitialData: function (option, ecModel) { - var data = option.data || []; - var rootName = option.name; - rootName == null && (rootName = option.name); - - // Create a virtual root. - var root = {name: rootName, children: option.data}; - var value0 = (data[0] || {}).value; - - completeTreeValue(root, zrUtil.isArray(value0) ? value0.length : -1); - - // FIXME - // sereis.mergeOption 的 getInitData是否放在merge后,从而能直接获取merege后的结果而非手动判断。 - var levels = option.levels || []; - - levels = option.levels = setDefault(levels, ecModel); + _resetController: function (api) { + var controller = this._controller; - // Make sure always a new tree is created when setOption, - // in TreemapView, we check whether oldTree === newTree - // to choose mappings approach among old shapes and new shapes. - return Tree.createTree(root, this, levels).data; - }, + // Init controller. + if (!controller) { + controller = this._controller = new RoamController(api.getZr()); + controller.enable(this.seriesModel.get('roam')); + controller.on('pan', bind(this._onPan, this)); + controller.on('zoom', bind(this._onZoom, this)); + } - optionUpdated: function () { - this.resetViewRoot(); + var rect = new BoundingRect(0, 0, api.getWidth(), api.getHeight()); + controller.setContainsPoint(function (x, y) { + return rect.contain(x, y); + }); }, /** - * @override - * @param {number} dataIndex - * @param {boolean} [mutipleSeries=false] + * @private */ - formatTooltip: function (dataIndex) { - var data = this.getData(); - var value = this.getRawValue(dataIndex); - var formattedValue = zrUtil.isArray(value) - ? addCommas(value[0]) : addCommas(value); - var name = data.getName(dataIndex); - - return encodeHTML(name + ': ' + formattedValue); + _clearController: function () { + var controller = this._controller; + if (controller) { + controller.dispose(); + controller = null; + } }, /** - * Add tree path to tooltip param - * - * @override - * @param {number} dataIndex - * @return {Object} + * @private */ - getDataParams: function (dataIndex) { - var params = SeriesModel.prototype.getDataParams.apply(this, arguments); + _onPan: function (dx, dy) { + this._mayClick = false; - var node = this.getData().tree.getNodeByDataIndex(dataIndex); - params.treePathInfo = helper.wrapTreePathInfo(node, this); + if (this._state !== 'animating' + && (Math.abs(dx) > DRAG_THRESHOLD || Math.abs(dy) > DRAG_THRESHOLD) + ) { + // These param must not be cached. + var root = this.seriesModel.getData().tree.root; - return params; + if (!root) { + return; + } + + var rootLayout = root.getLayout(); + + if (!rootLayout) { + return; + } + + this.api.dispatchAction({ + type: 'treemapMove', + from: this.uid, + seriesId: this.seriesModel.id, + rootRect: { + x: rootLayout.x + dx, y: rootLayout.y + dy, + width: rootLayout.width, height: rootLayout.height + } + }); + } }, /** - * @public - * @param {Object} layoutInfo { - * x: containerGroup x - * y: containerGroup y - * width: containerGroup width - * height: containerGroup height - * } + * @private */ - setLayoutInfo: function (layoutInfo) { - /** - * @readOnly - * @type {Object} - */ - this.layoutInfo = this.layoutInfo || {}; - zrUtil.extend(this.layoutInfo, layoutInfo); + _onZoom: function (scale, mouseX, mouseY) { + this._mayClick = false; + + if (this._state !== 'animating') { + // These param must not be cached. + var root = this.seriesModel.getData().tree.root; + + if (!root) { + return; + } + + var rootLayout = root.getLayout(); + + if (!rootLayout) { + return; + } + + var rect = new BoundingRect( + rootLayout.x, rootLayout.y, rootLayout.width, rootLayout.height + ); + var layoutInfo = this.seriesModel.layoutInfo; + + // Transform mouse coord from global to containerGroup. + mouseX -= layoutInfo.x; + mouseY -= layoutInfo.y; + + // Scale root bounding rect. + var m = matrix.create(); + matrix.translate(m, m, [-mouseX, -mouseY]); + matrix.scale(m, m, [scale, scale]); + matrix.translate(m, m, [mouseX, mouseY]); + + rect.applyTransform(m); + + this.api.dispatchAction({ + type: 'treemapRender', + from: this.uid, + seriesId: this.seriesModel.id, + rootRect: { + x: rect.x, y: rect.y, + width: rect.width, height: rect.height + } + }); + } }, /** - * @param {string} id - * @return {number} index + * @private */ - mapIdToIndex: function (id) { - // A feature is implemented: - // index is monotone increasing with the sequence of - // input id at the first time. - // This feature can make sure that each data item and its - // mapped color have the same index between data list and - // color list at the beginning, which is useful for user - // to adjust data-color mapping. + _initEvents: function (containerGroup) { + // FIXME + // 不用click以及silent的原因是,animate时视图设置silent true来避免click生效, + // 但是animate中,按下鼠标,animate结束后(silent设回为false)松开鼠标, + // 还是会触发click,期望是不触发。 - /** - * @private - * @type {Object} - */ - var idIndexMap = this._idIndexMap; + // Mousedown occurs when drag start, and mouseup occurs when drag end, + // click event should not be triggered in that case. - if (!idIndexMap) { - idIndexMap = this._idIndexMap = {}; - /** - * @private - * @type {number} - */ - this._idIndexMapCount = 0; - } + containerGroup.on('mousedown', function (e) { + this._state === 'ready' && (this._mayClick = true); + }, this); + containerGroup.on('mouseup', function (e) { + if (this._mayClick) { + this._mayClick = false; + this._state === 'ready' && onClick.call(this, e); + } + }, this); - var index = idIndexMap[id]; - if (index == null) { - idIndexMap[id] = index = this._idIndexMapCount++; - } + function onClick(e) { + var nodeClick = this.seriesModel.get('nodeClick', true); - return index; - }, + if (!nodeClick) { + return; + } - getViewRoot: function () { - return this._viewRoot; + var targetInfo = this.findTarget(e.offsetX, e.offsetY); + + if (!targetInfo) { + return; + } + + var node = targetInfo.node; + if (node.getLayout().isLeafRoot) { + this._rootToNode(targetInfo); + } + else { + if (nodeClick === 'zoomToNode') { + this._zoomToNode(targetInfo); + } + else if (nodeClick === 'link') { + var itemModel = node.hostTree.data.getItemModel(node.dataIndex); + var link = itemModel.get('link', true); + var linkTarget = itemModel.get('target', true) || 'blank'; + link && window.open(link, linkTarget); + } + } + } }, /** - * @param {module:echarts/data/Tree~Node} [viewRoot] + * @private */ - resetViewRoot: function (viewRoot) { - viewRoot - ? (this._viewRoot = viewRoot) - : (viewRoot = this._viewRoot); + _renderBreadcrumb: function (seriesModel, api, targetInfo) { + if (!targetInfo) { + targetInfo = seriesModel.get('leafDepth', true) != null + ? {node: seriesModel.getViewRoot()} + // FIXME + // better way? + // Find breadcrumb tail on center of containerGroup. + : this.findTarget(api.getWidth() / 2, api.getHeight() / 2); - var root = this.getData().tree.root; + if (!targetInfo) { + targetInfo = {node: seriesModel.getData().tree.root}; + } + } - if (!viewRoot - || (viewRoot !== root && !root.contains(viewRoot)) - ) { - this._viewRoot = root; + (this._breadcrumb || (this._breadcrumb = new Breadcrumb(this.group))) + .render(seriesModel, api, targetInfo.node, bind(onSelect, this)); + + function onSelect(node) { + if (this._state !== 'animating') { + helper.aboveViewRoot(seriesModel.getViewRoot(), node) + ? this._rootToNode({node: node}) + : this._zoomToNode({node: node}); + } } - } - }); + }, - /** - * @param {Object} dataNode - */ - function completeTreeValue(dataNode, arrValueLength) { - // Postorder travel tree. - // If value of none-leaf node is not set, - // calculate it by suming up the value of all children. - var sum = 0; + /** + * @override + */ + remove: function () { + this._clearController(); + this._containerGroup && this._containerGroup.removeAll(); + this._storage = createStorage(); + this._state = 'ready'; + this._breadcrumb && this._breadcrumb.remove(); + }, - zrUtil.each(dataNode.children, function (child) { + dispose: function () { + this._clearController(); + }, - completeTreeValue(child, arrValueLength); + /** + * @private + */ + _zoomToNode: function (targetInfo) { + this.api.dispatchAction({ + type: 'treemapZoomToNode', + from: this.uid, + seriesId: this.seriesModel.id, + targetNode: targetInfo.node + }); + }, - var childValue = child.value; - zrUtil.isArray(childValue) && (childValue = childValue[0]); + /** + * @private + */ + _rootToNode: function (targetInfo) { + this.api.dispatchAction({ + type: 'treemapRootToNode', + from: this.uid, + seriesId: this.seriesModel.id, + targetNode: targetInfo.node + }); + }, - sum += childValue; - }); + /** + * @public + * @param {number} x Global coord x. + * @param {number} y Global coord y. + * @return {Object} info If not found, return undefined; + * @return {number} info.node Target node. + * @return {number} info.offsetX x refer to target node. + * @return {number} info.offsetY y refer to target node. + */ + findTarget: function (x, y) { + var targetInfo; + var viewRoot = this.seriesModel.getViewRoot(); - var thisValue = dataNode.value; + viewRoot.eachNode({attr: 'viewChildren', order: 'preorder'}, function (node) { + var bgEl = this._storage.background[node.getRawIndex()]; + // If invisible, there might be no element. + if (bgEl) { + var point = bgEl.transformCoordToLocal(x, y); + var shape = bgEl.shape; - if (arrValueLength >= 0) { - if (!zrUtil.isArray(thisValue)) { - dataNode.value = new Array(arrValueLength); - } - else { - thisValue = thisValue[0]; - } - } + // For performance consideration, dont use 'getBoundingRect'. + if (shape.x <= point[0] + && point[0] <= shape.x + shape.width + && shape.y <= point[1] + && point[1] <= shape.y + shape.height + ) { + targetInfo = {node: node, offsetX: point[0], offsetY: point[1]}; + } + else { + return false; // Suppress visit subtree. + } + } + }, this); - if (thisValue == null || isNaN(thisValue)) { - thisValue = sum; - } - // Value should not less than 0. - if (thisValue < 0) { - thisValue = 0; + return targetInfo; } - arrValueLength >= 0 - ? (dataNode.value[0] = thisValue) - : (dataNode.value = thisValue); - } + }); /** - * set default to level configuration + * @inner */ - function setDefault(levels, ecModel) { - var globalColorList = ecModel.get('color'); + function createStorage() { + return {nodeGroup: [], background: [], content: []}; + } - if (!globalColorList) { + /** + * @inner + * @return Return undefined means do not travel further. + */ + function renderNode( + seriesModel, thisStorage, oldStorage, reRoot, + lastsForAnimation, willInvisibleEls, + thisNode, oldNode, parentGroup, depth + ) { + // Whether under viewRoot. + if (!thisNode) { + // Deleting nodes will be performed finally. This method just find + // element from old storage, or create new element, set them to new + // storage, and set styles. return; } - levels = levels || []; - var hasColorDefine; - zrUtil.each(levels, function (levelDefine) { - var model = new Model(levelDefine); - var modelColor = model.get('color'); - - if (model.get('itemStyle.normal.color') - || (modelColor && modelColor !== 'none') - ) { - hasColorDefine = true; - } - }); + var thisLayout = thisNode.getLayout(); - if (!hasColorDefine) { - var level0 = levels[0] || (levels[0] = {}); - level0.color = globalColorList.slice(); + if (!thisLayout || !thisLayout.isInView) { + return; } - return levels; - } + var thisWidth = thisLayout.width; + var thisHeight = thisLayout.height; + var thisInvisible = thisLayout.invisible; + var thisRawIndex = thisNode.getRawIndex(); + var oldRawIndex = oldNode && oldNode.getRawIndex(); + // Node group + var group = giveGraphic('nodeGroup', Group); -/***/ }, -/* 187 */ -/***/ function(module, exports, __webpack_require__) { + if (!group) { + return; + } - /** - * Tree data structure - * - * @module echarts/data/Tree - */ + parentGroup.add(group); + // x,y are not set when el is above view root. + group.attr('position', [thisLayout.x || 0, thisLayout.y || 0]); + group.__tmNodeWidth = thisWidth; + group.__tmNodeHeight = thisHeight; + if (thisLayout.isAboveViewRoot) { + return group; + } - var zrUtil = __webpack_require__(4); - var Model = __webpack_require__(12); - var List = __webpack_require__(98); - var linkList = __webpack_require__(188); - var completeDimensions = __webpack_require__(103); + // Background + var bg = giveGraphic('background', Rect, depth, Z_BG); + if (bg) { + bg.setShape({x: 0, y: 0, width: thisWidth, height: thisHeight}); + updateStyle(bg, function () { + bg.setStyle('fill', thisNode.getVisual('borderColor', true)); + }); + group.add(bg); + } - /** - * @constructor module:echarts/data/Tree~TreeNode - * @param {string} name - * @param {module:echarts/data/Tree} hostTree - */ - var TreeNode = function (name, hostTree) { - /** - * @type {string} - */ - this.name = name || ''; + var thisViewChildren = thisNode.viewChildren; - /** - * Depth of node - * - * @type {number} - * @readOnly - */ - this.depth = 0; + // No children, render content. + if (!thisViewChildren || !thisViewChildren.length) { + var content = giveGraphic('content', Rect, depth, Z_CONTENT); + content && renderContent(group); + } - /** - * Height of the subtree rooted at this node. - * @type {number} - * @readOnly - */ - this.height = 0; + return group; - /** - * @type {module:echarts/data/Tree~TreeNode} - * @readOnly - */ - this.parentNode = null; + // ---------------------------- + // | Procedures in renderNode | + // ---------------------------- - /** - * Reference to list item. - * Do not persistent dataIndex outside, - * besause it may be changed by list. - * If dataIndex -1, - * this node is logical deleted (filtered) in list. - * - * @type {Object} - * @readOnly - */ - this.dataIndex = -1; + function renderContent(group) { + // For tooltip. + content.dataIndex = thisNode.dataIndex; + content.seriesIndex = seriesModel.seriesIndex; - /** - * @type {Array.} - * @readOnly - */ - this.children = []; + var borderWidth = thisLayout.borderWidth; + var contentWidth = Math.max(thisWidth - 2 * borderWidth, 0); + var contentHeight = Math.max(thisHeight - 2 * borderWidth, 0); - /** - * @type {Array.} - * @pubilc - */ - this.viewChildren = []; + content.culling = true; + content.setShape({ + x: borderWidth, + y: borderWidth, + width: contentWidth, + height: contentHeight + }); + + var visualColor = thisNode.getVisual('color', true); + updateStyle(content, function () { + var normalStyle = {fill: visualColor}; + var emphasisStyle = thisNode.getModel('itemStyle.emphasis').getItemStyle(); - /** - * @type {moduel:echarts/data/Tree} - * @readOnly - */ - this.hostTree = hostTree; - }; + prepareText(normalStyle, emphasisStyle, visualColor, contentWidth, contentHeight); - TreeNode.prototype = { + content.setStyle(normalStyle); + graphic.setHoverStyle(content, emphasisStyle); + }); - constructor: TreeNode, + group.add(content); + } - /** - * The node is removed. - * @return {boolean} is removed. - */ - isRemoved: function () { - return this.dataIndex < 0; - }, + function updateStyle(element, cb) { + if (!thisInvisible) { + // If invisible, do not set visual, otherwise the element will + // change immediately before animation. We think it is OK to + // remain its origin color when moving out of the view window. + cb(); - /** - * Travel this subtree (include this node). - * Usage: - * node.eachNode(function () { ... }); // preorder - * node.eachNode('preorder', function () { ... }); // preorder - * node.eachNode('postorder', function () { ... }); // postorder - * node.eachNode( - * {order: 'postorder', attr: 'viewChildren'}, - * function () { ... } - * ); // postorder - * - * @param {(Object|string)} options If string, means order. - * @param {string=} options.order 'preorder' or 'postorder' - * @param {string=} options.attr 'children' or 'viewChildren' - * @param {Function} cb If in preorder and return false, - * its subtree will not be visited. - * @param {Object} [context] - */ - eachNode: function (options, cb, context) { - if (typeof options === 'function') { - context = cb; - cb = options; - options = null; + if (!element.__tmWillVisible) { + element.invisible = false; + } + } + else { + // Delay invisible setting utill animation finished, + // avoid element vanish suddenly before animation. + !element.invisible && willInvisibleEls.push(element); } + } - options = options || {}; - if (zrUtil.isString(options)) { - options = {order: options}; + function prepareText(normalStyle, emphasisStyle, visualColor, contentWidth, contentHeight) { + var nodeModel = thisNode.getModel(); + var text = nodeModel.get('name'); + if (thisLayout.isLeafRoot) { + var iconChar = seriesModel.get('drillDownIcon', true); + text = iconChar ? iconChar + ' ' + text : text; } - var order = options.order || 'preorder'; - var children = this[options.attr || 'children']; + setText( + text, normalStyle, nodeModel, PATH_LABEL_NORMAL, + visualColor, contentWidth, contentHeight + ); + setText( + text, emphasisStyle, nodeModel, PATH_LABEL_EMPHASIS, + visualColor, contentWidth, contentHeight + ); + } - var suppressVisitSub; - order === 'preorder' && (suppressVisitSub = cb.call(context, this)); + function setText(text, style, nodeModel, labelPath, visualColor, contentWidth, contentHeight) { + var labelModel = nodeModel.getModel(labelPath); + var labelTextStyleModel = labelModel.getModel('textStyle'); - for (var i = 0; !suppressVisitSub && i < children.length; i++) { - children[i].eachNode(options, cb, context); - } + graphic.setText(style, labelModel, visualColor); - order === 'postorder' && cb.call(context, this); - }, + // text.align and text.baseline is not included by graphic.setText, + // because in most cases the two attributes are not exposed to user, + // except in treemap. + style.textAlign = labelTextStyleModel.get('align'); + style.textVerticalAlign = labelTextStyleModel.get('baseline'); - /** - * Update depth and height of this subtree. - * - * @param {number} depth - */ - updateDepthAndHeight: function (depth) { - var height = 0; - this.depth = depth; - for (var i = 0; i < this.children.length; i++) { - var child = this.children[i]; - child.updateDepthAndHeight(depth + 1); - if (child.height > height) { - height = child.height; - } + var textRect = labelTextStyleModel.getTextRect(text); + if (!labelModel.getShallow('show') || textRect.height > contentHeight) { + style.text = ''; } - this.height = height + 1; - }, - - /** - * @param {string} id - * @return {module:echarts/data/Tree~TreeNode} - */ - getNodeById: function (id) { - if (this.getId() === id) { - return this; + else if (textRect.width > contentWidth) { + style.text = labelTextStyleModel.get('ellipsis') + ? labelTextStyleModel.truncateText( + text, contentWidth, null, {minChar: 2} + ) + : ''; } - for (var i = 0, children = this.children, len = children.length; i < len; i++) { - var res = children[i].getNodeById(id); - if (res) { - return res; - } + else { + style.text = text; } - }, + } - /** - * @param {module:echarts/data/Tree~TreeNode} node - * @return {boolean} - */ - contains: function (node) { - if (node === this) { - return true; + function giveGraphic(storageName, Ctor, depth, z) { + var element = oldRawIndex != null && oldStorage[storageName][oldRawIndex]; + var lasts = lastsForAnimation[storageName]; + + if (element) { + // Remove from oldStorage + oldStorage[storageName][oldRawIndex] = null; + prepareAnimationWhenHasOld(lasts, element, storageName); } - for (var i = 0, children = this.children, len = children.length; i < len; i++) { - var res = children[i].contains(node); - if (res) { - return res; - } + // If invisible and no old element, do not create new element (for optimizing). + else if (!thisInvisible) { + element = new Ctor({z: calculateZ(depth, z)}); + element.__tmDepth = depth; + element.__tmStorageName = storageName; + prepareAnimationWhenNoOld(lasts, element, storageName); } - }, - /** - * @param {boolean} includeSelf Default false. - * @return {Array.} order: [root, child, grandchild, ...] - */ - getAncestors: function (includeSelf) { - var ancestors = []; - var node = includeSelf ? this : this.parentNode; - while (node) { - ancestors.push(node); - node = node.parentNode; - } - ancestors.reverse(); - return ancestors; - }, + // Set to thisStorage + return (thisStorage[storageName][thisRawIndex] = element); + } - /** - * @param {string|Array=} [dimension='value'] Default 'value'. can be 0, 1, 2, 3 - * @return {number} Value. - */ - getValue: function (dimension) { - var data = this.hostTree.data; - return data.get(data.getDimension(dimension || 'value'), this.dataIndex); - }, + function prepareAnimationWhenHasOld(lasts, element, storageName) { + var lastCfg = lasts[thisRawIndex] = {}; + lastCfg.old = storageName === 'nodeGroup' + ? element.position.slice() + : zrUtil.extend({}, element.shape); + } - /** - * @param {Object} layout - * @param {boolean=} [merge=false] - */ - setLayout: function (layout, merge) { - this.dataIndex >= 0 - && this.hostTree.data.setItemLayout(this.dataIndex, layout, merge); - }, + // If a element is new, we need to find the animation start point carefully, + // otherwise it will looks strange when 'zoomToNode'. + function prepareAnimationWhenNoOld(lasts, element, storageName) { + var lastCfg = lasts[thisRawIndex] = {}; + var parentNode = thisNode.parentNode; - /** - * @return {Object} layout - */ - getLayout: function () { - return this.hostTree.data.getItemLayout(this.dataIndex); - }, + if (parentNode && (!reRoot || reRoot.direction === 'drillDown')) { + var parentOldX = 0; + var parentOldY = 0; - /** - * @param {string} path - * @return {module:echarts/model/Model} - */ - getModel: function (path) { - if (this.dataIndex < 0) { - return; - } - var hostTree = this.hostTree; - var itemModel = hostTree.data.getItemModel(this.dataIndex); - var levelModel = this.getLevelModel(); + // New nodes appear from right-bottom corner in 'zoomToNode' animation. + // For convenience, get old bounding rect from background. + var parentOldBg = lastsForAnimation.background[parentNode.getRawIndex()]; + if (!reRoot && parentOldBg && parentOldBg.old) { + parentOldX = parentOldBg.old.width; + parentOldY = parentOldBg.old.height; + } - return itemModel.getModel(path, (levelModel || hostTree.hostModel).getModel(path)); - }, + // When no parent old shape found, its parent is new too, + // so we can just use {x:0, y:0}. + lastCfg.old = storageName === 'nodeGroup' + ? [0, parentOldY] + : {x: parentOldX, y: parentOldY, width: 0, height: 0}; + } - /** - * @return {module:echarts/model/Model} - */ - getLevelModel: function () { - return (this.hostTree.levelModels || [])[this.depth]; - }, + // Fade in, user can be aware that these nodes are new. + lastCfg.fadein = storageName !== 'nodeGroup'; + } + } - /** - * @example - * setItemVisual('color', color); - * setItemVisual({ - * 'color': color - * }); - */ - setVisual: function (key, value) { - this.dataIndex >= 0 - && this.hostTree.data.setItemVisual(this.dataIndex, key, value); - }, + // We can not set all backgroud with the same z, Because the behaviour of + // drill down and roll up differ background creation sequence from tree + // hierarchy sequence, which cause that lowser background element overlap + // upper ones. So we calculate z based on depth. + // Moreover, we try to shrink down z interval to [0, 1] to avoid that + // treemap with large z overlaps other components. + function calculateZ(depth, zInLevel) { + var zb = depth * Z_BASE + zInLevel; + return (zb - 1) / zb; + } - /** - * Get item visual - */ - getVisual: function (key, ignoreParent) { - return this.hostTree.data.getItemVisual(this.dataIndex, key, ignoreParent); - }, - /** - * @public - * @return {number} - */ - getRawIndex: function () { - return this.hostTree.data.getRawIndex(this.dataIndex); - }, - /** - * @public - * @return {string} - */ - getId: function () { - return this.hostTree.data.getId(this.dataIndex); - } - }; +/***/ }, +/* 205 */ +/***/ function(module, exports, __webpack_require__) { - /** - * @constructor - * @alias module:echarts/data/Tree - * @param {module:echarts/model/Model} hostModel - * @param {Array.} levelOptions - */ - function Tree(hostModel, levelOptions) { - /** - * @type {module:echarts/data/Tree~TreeNode} - * @readOnly - */ - this.root; + - /** - * @type {module:echarts/data/List} - * @readOnly - */ - this.data; + var graphic = __webpack_require__(44); + var layout = __webpack_require__(21); + var zrUtil = __webpack_require__(4); + var helper = __webpack_require__(203); - /** - * Index of each item is the same as the raw index of coresponding list item. - * @private - * @type {Array.} levelOptions - * @return module:echarts/data/Tree - */ - Tree.createTree = function (dataRoot, hostModel, levelOptions) { - - var tree = new Tree(hostModel, levelOptions); - var listData = []; + _renderContent: function ( + seriesModel, layoutParam, normalStyleModel, textStyleModel, onSelect + ) { + // Start rendering. + var lastX = 0; + var emptyItemWidth = layoutParam.emptyItemWidth; + var height = seriesModel.get('breadcrumb.height'); + var availableSize = layout.getAvailableSize(layoutParam.pos, layoutParam.box); + var totalWidth = layoutParam.totalWidth; + var renderList = layoutParam.renderList; - buildHierarchy(dataRoot); + for (var i = renderList.length - 1; i >= 0; i--) { + var item = renderList[i]; + var itemNode = item.node; + var itemWidth = item.width; + var text = item.text; - function buildHierarchy(dataNode, parentNode) { - listData.push(dataNode); + // Hdie text and shorten width if necessary. + if (totalWidth > availableSize.width) { + totalWidth -= itemWidth - emptyItemWidth; + itemWidth = emptyItemWidth; + text = ''; + } - var node = new TreeNode(dataNode.name, tree); - parentNode - ? addChild(node, parentNode) - : (tree.root = node); + var el = new graphic.Polygon({ + shape: { + points: makeItemPoints( + lastX, 0, itemWidth, height, + i === renderList.length - 1, i === 0 + ) + }, + style: zrUtil.defaults( + normalStyleModel.getItemStyle(), + { + lineJoin: 'bevel', + text: text, + textFill: textStyleModel.getTextColor(), + textFont: textStyleModel.getFont() + } + ), + z: 10, + onclick: zrUtil.curry(onSelect, itemNode) + }); + this.group.add(el); - tree._nodes.push(node); + packEventData(el, seriesModel, itemNode); - var children = dataNode.children; - if (children) { - for (var i = 0; i < children.length; i++) { - buildHierarchy(children[i], node); - } + lastX += itemWidth + ITEM_GAP; } - } - - tree.root.updateDepthAndHeight(0); - - var dimensions = completeDimensions([{name: 'value'}], listData); - var list = new List(dimensions, hostModel); - list.initData(listData); - - linkList({ - mainData: list, - struct: tree, - structAttr: 'tree' - }); - - tree.update(); + }, - return tree; + /** + * @override + */ + remove: function () { + this.group.removeAll(); + } }; - /** - * It is needed to consider the mess of 'list', 'hostModel' when creating a TreeNote, - * so this function is not ready and not necessary to be public. - * - * @param {(module:echarts/data/Tree~TreeNode|Object)} child - */ - function addChild(child, node) { - var children = node.children; - if (child.parentNode === node) { - return; - } + function makeItemPoints(x, y, itemWidth, itemHeight, head, tail) { + var points = [ + [head ? x : x - ARRAY_LENGTH, y], + [x + itemWidth, y], + [x + itemWidth, y + itemHeight], + [head ? x : x - ARRAY_LENGTH, y + itemHeight] + ]; + !tail && points.splice(2, 0, [x + itemWidth + ARRAY_LENGTH, y + itemHeight / 2]); + !head && points.push([x, y + itemHeight / 2]); + return points; + } - children.push(child); - child.parentNode = node; + // Package custom mouse event. + function packEventData(el, seriesModel, itemNode) { + el.eventData = { + componentType: 'series', + componentSubType: 'treemap', + seriesIndex: seriesModel.componentIndex, + seriesName: seriesModel.name, + seriesType: 'treemap', + selfType: 'breadcrumb', // Distinguish with click event on treemap node. + nodeData: { + dataIndex: itemNode && itemNode.dataIndex, + name: itemNode && itemNode.name + }, + treePathInfo: itemNode && helper.wrapTreePathInfo(itemNode, seriesModel) + }; } - module.exports = Tree; + module.exports = Breadcrumb; /***/ }, -/* 188 */ +/* 206 */ /***/ function(module, exports, __webpack_require__) { - /** - * Link lists and struct (graph or tree) - */ - + var zrUtil = __webpack_require__(4); - var each = zrUtil.each; - - var DATAS = '\0__link_datas'; - var MAIN_DATA = '\0__link_mainData'; - - // Caution: - // In most case, either list or its shallow clones (see list.cloneShallow) - // is active in echarts process. So considering heap memory consumption, - // we do not clone tree or graph, but share them among list and its shallow clones. - // But in some rare case, we have to keep old list (like do animation in chart). So - // please take care that both the old list and the new list share the same tree/graph. /** - * @param {Object} opt - * @param {module:echarts/data/List} opt.mainData - * @param {Object} [opt.struct] For example, instance of Graph or Tree. - * @param {string} [opt.structAttr] designation: list[structAttr] = struct; - * @param {Object} [opt.datas] {dataType: data}, - * like: {node: nodeList, edge: edgeList}. - * Should contain mainData. - * @param {Object} [opt.datasAttr] {dataType: attr}, - * designation: struct[datasAttr[dataType]] = list; + * @param {number} [time=500] Time in ms + * @param {string} [easing='linear'] + * @param {number} [delay=0] + * @param {Function} [callback] + * + * @example + * // Animate position + * animation + * .createWrap() + * .add(el1, {position: [10, 10]}) + * .add(el2, {shape: {width: 500}, style: {fill: 'red'}}, 400) + * .done(function () { // done }) + * .start('cubicOut'); */ - function linkList(opt) { - var mainData = opt.mainData; - var datas = opt.datas; + function createWrap() { - if (!datas) { - datas = {main: mainData}; - opt.datasAttr = {main: 'data'}; - } - opt.datas = opt.mainData = null; + var storage = []; + var elExistsMap = {}; + var doneCallback; - linkAll(mainData, datas, opt); + return { - // Porxy data original methods. - each(datas, function (data) { - each(mainData.TRANSFERABLE_METHODS, function (methodName) { - data.wrapMethod(methodName, zrUtil.curry(transferInjection, opt)); - }); + /** + * Caution: a el can only be added once, otherwise 'done' + * might not be called. This method checks this (by el.id), + * suppresses adding and returns false when existing el found. + * + * @param {modele:zrender/Element} el + * @param {Object} target + * @param {number} [time=500] + * @param {number} [delay=0] + * @param {string} [easing='linear'] + * @return {boolean} Whether adding succeeded. + * + * @example + * add(el, target, time, delay, easing); + * add(el, target, time, easing); + * add(el, target, time); + * add(el, target); + */ + add: function (el, target, time, delay, easing) { + if (zrUtil.isString(delay)) { + easing = delay; + delay = 0; + } - }); + if (elExistsMap[el.id]) { + return false; + } + elExistsMap[el.id] = 1; - // Beyond transfer, additional features should be added to `cloneShallow`. - mainData.wrapMethod('cloneShallow', zrUtil.curry(cloneShallowInjection, opt)); + storage.push( + {el: el, target: target, time: time, delay: delay, easing: easing} + ); - // Only mainData trigger change, because struct.update may trigger - // another changable methods, which may bring about dead lock. - each(mainData.CHANGABLE_METHODS, function (methodName) { - mainData.wrapMethod(methodName, zrUtil.curry(changeInjection, opt)); - }); + return true; + }, - // Make sure datas contains mainData. - zrUtil.assert(datas[mainData.dataType] === mainData); - } + /** + * Only execute when animation finished. Will not execute when any + * of 'stop' or 'stopAnimation' called. + * + * @param {Function} callback + */ + done: function (callback) { + doneCallback = callback; + return this; + }, - function transferInjection(opt, res) { - if (isMainData(this)) { - // Transfer datas to new main data. - var datas = zrUtil.extend({}, this[DATAS]); - datas[this.dataType] = res; - linkAll(res, datas, opt); - } - else { - // Modify the reference in main data to point newData. - linkSingle(res, this.dataType, this[MAIN_DATA], opt); - } - return res; - } + /** + * Will stop exist animation firstly. + */ + start: function () { + var count = storage.length; - function changeInjection(opt, res) { - opt.struct && opt.struct.update(this); - return res; - } + for (var i = 0, len = storage.length; i < len; i++) { + var item = storage[i]; + item.el.animateTo(item.target, item.time, item.delay, item.easing, done); + } - function cloneShallowInjection(opt, res) { - // cloneShallow, which brings about some fragilities, may be inappropriate - // to be exposed as an API. So for implementation simplicity we can make - // the restriction that cloneShallow of not-mainData should not be invoked - // outside, but only be invoked here. - each(res[DATAS], function (data, dataType) { - data !== res && linkSingle(data.cloneShallow(), dataType, res, opt); - }); - return res; - } + return this; - /** - * Supplement method to List. - * - * @public - * @param {string} [dataType] If not specified, return mainData. - * @return {module:echarts/data/List} - */ - function getLinkedData(dataType) { - var mainData = this[MAIN_DATA]; - return (dataType == null || mainData == null) - ? mainData - : mainData[DATAS][dataType]; + function done() { + count--; + if (!count) { + storage.length = 0; + elExistsMap = {}; + doneCallback && doneCallback(); + } + } + } + }; } - function isMainData(data) { - return data[MAIN_DATA] === data; - } + module.exports = {createWrap: createWrap}; - function linkAll(mainData, datas, opt) { - mainData[DATAS] = {}; - each(datas, function (data, dataType) { - linkSingle(data, dataType, mainData, opt); - }); - } - function linkSingle(data, dataType, mainData, opt) { - mainData[DATAS][dataType] = data; - data[MAIN_DATA] = mainData; - data.dataType = dataType; +/***/ }, +/* 207 */ +/***/ function(module, exports, __webpack_require__) { - if (opt.struct) { - data[opt.structAttr] = opt.struct; - opt.struct[opt.datasAttr[dataType]] = data; - } + /** + * @file Treemap action + */ - // Supplement method. - data.getLinkedData = getLinkedData; - } - module.exports = linkList; + var echarts = __webpack_require__(1); + var helper = __webpack_require__(203); + var noop = function () {}; -/***/ }, -/* 189 */ -/***/ function(module, exports, __webpack_require__) { + var actionTypes = [ + 'treemapZoomToNode', + 'treemapRender', + 'treemapMove' + ]; - + for (var i = 0; i < actionTypes.length; i++) { + echarts.registerAction({type: actionTypes[i], update: 'updateView'}, noop); + } - var zrUtil = __webpack_require__(4); + echarts.registerAction( + {type: 'treemapRootToNode', update: 'updateView'}, + function (payload, ecModel) { - var helper = { + ecModel.eachComponent( + {mainType: 'series', subType: 'treemap', query: payload}, + handleRootToNode + ); - retrieveTargetInfo: function (payload, seriesModel) { - if (payload - && ( - payload.type === 'treemapZoomToNode' - || payload.type === 'treemapRootToNode' - ) - ) { - var root = seriesModel.getData().tree.root; - var targetNode = payload.targetNode; - if (targetNode && root.contains(targetNode)) { - return {node: targetNode}; - } + function handleRootToNode(model, index) { + var targetInfo = helper.retrieveTargetInfo(payload, model); - var targetNodeId = payload.targetNodeId; - if (targetNodeId != null && (targetNode = root.getNodeById(targetNodeId))) { - return {node: targetNode}; + if (targetInfo) { + var originViewRoot = model.getViewRoot(); + if (originViewRoot) { + payload.direction = helper.aboveViewRoot(originViewRoot, targetInfo.node) + ? 'rollUp' : 'drillDown'; + } + model.resetViewRoot(targetInfo.node); } } - }, + } + ); - // Not includes the given node at the last item. - getPathToRoot: function (node) { - var path = []; - while (node) { - node = node.parentNode; - node && path.push(node); - } - return path.reverse(); - }, - aboveViewRoot: function (viewRoot, node) { - var viewPath = helper.getPathToRoot(viewRoot); - return zrUtil.indexOf(viewPath, node) >= 0; - }, - // From root to the input node (the input node will be included). - wrapTreePathInfo: function (node, seriesModel) { - var treePathInfo = []; +/***/ }, +/* 208 */ +/***/ function(module, exports, __webpack_require__) { - while (node) { - var nodeDataIndex = node.dataIndex; - treePathInfo.push({ - name: node.name, - dataIndex: nodeDataIndex, - value: seriesModel.getRawValue(nodeDataIndex) - }); - node = node.parentNode; - } + - treePathInfo.reverse(); + var VisualMapping = __webpack_require__(209); + var zrColor = __webpack_require__(39); + var zrUtil = __webpack_require__(4); + var isArray = zrUtil.isArray; - return treePathInfo; - } - }; + var ITEM_STYLE_NORMAL = 'itemStyle.normal'; - module.exports = helper; + module.exports = function (ecModel, api, payload) { + var condition = {mainType: 'series', subType: 'treemap', query: payload}; + ecModel.eachComponent(condition, function (seriesModel) { -/***/ }, -/* 190 */ -/***/ function(module, exports, __webpack_require__) { + var tree = seriesModel.getData().tree; + var root = tree.root; + var seriesItemStyleModel = seriesModel.getModel(ITEM_STYLE_NORMAL); - + if (root.isRemoved()) { + return; + } - var zrUtil = __webpack_require__(4); - var graphic = __webpack_require__(43); - var DataDiffer = __webpack_require__(99); - var helper = __webpack_require__(189); - var Breadcrumb = __webpack_require__(191); - var RoamController = __webpack_require__(177); - var BoundingRect = __webpack_require__(9); - var matrix = __webpack_require__(11); - var animationUtil = __webpack_require__(192); - var bind = zrUtil.bind; - var Group = graphic.Group; - var Rect = graphic.Rect; - var each = zrUtil.each; + var levelItemStyles = zrUtil.map(tree.levelModels, function (levelModel) { + return levelModel ? levelModel.get(ITEM_STYLE_NORMAL) : null; + }); - var DRAG_THRESHOLD = 3; - var PATH_LABEL_NORMAL = ['label', 'normal']; - var PATH_LABEL_EMPHASIS = ['label', 'emphasis']; - var Z_BASE = 10; // Should bigger than every z. - var Z_BG = 1; - var Z_CONTENT = 2; + travelTree( + root, // Visual should calculate from tree root but not view root. + {}, + levelItemStyles, + seriesItemStyleModel, + seriesModel.getViewRoot().getAncestors(), + seriesModel + ); + }); + }; - module.exports = __webpack_require__(1).extendChartView({ + function travelTree( + node, designatedVisual, levelItemStyles, seriesItemStyleModel, + viewRootAncestors, seriesModel + ) { + var nodeModel = node.getModel(); + var nodeLayout = node.getLayout(); - type: 'treemap', + // Optimize + if (!nodeLayout || nodeLayout.invisible || !nodeLayout.isInView) { + return; + } - /** - * @override - */ - init: function (o, api) { + var nodeItemStyleModel = node.getModel(ITEM_STYLE_NORMAL); + var levelItemStyle = levelItemStyles[node.depth]; + var visuals = buildVisuals( + nodeItemStyleModel, designatedVisual, levelItemStyle, seriesItemStyleModel + ); - /** - * @private - * @type {module:zrender/container/Group} - */ - this._containerGroup; + // calculate border color + var borderColor = nodeItemStyleModel.get('borderColor'); + var borderColorSaturation = nodeItemStyleModel.get('borderColorSaturation'); + var thisNodeColor; + if (borderColorSaturation != null) { + // For performance, do not always execute 'calculateColor'. + thisNodeColor = calculateColor(visuals, node); + borderColor = calculateBorderColor(borderColorSaturation, thisNodeColor); + } + node.setVisual('borderColor', borderColor); - /** - * @private - * @type {Object.>} - */ - this._storage = createStorage(); + var viewChildren = node.viewChildren; + if (!viewChildren || !viewChildren.length) { + thisNodeColor = calculateColor(visuals, node); + // Apply visual to this node. + node.setVisual('color', thisNodeColor); + } + else { + var mapping = buildVisualMapping( + node, nodeModel, nodeLayout, nodeItemStyleModel, visuals, viewChildren + ); - /** - * @private - * @type {module:echarts/data/Tree} - */ - this._oldTree; + // Designate visual to children. + zrUtil.each(viewChildren, function (child, index) { + // If higher than viewRoot, only ancestors of viewRoot is needed to visit. + if (child.depth >= viewRootAncestors.length + || child === viewRootAncestors[child.depth] + ) { + var childVisual = mapVisual( + nodeModel, visuals, child, index, mapping, seriesModel + ); + travelTree( + child, childVisual, levelItemStyles, seriesItemStyleModel, + viewRootAncestors, seriesModel + ); + } + }); + } + } - /** - * @private - * @type {module:echarts/chart/treemap/Breadcrumb} - */ - this._breadcrumb; + function buildVisuals( + nodeItemStyleModel, designatedVisual, levelItemStyle, seriesItemStyleModel + ) { + var visuals = zrUtil.extend({}, designatedVisual); - /** - * @private - * @type {module:echarts/component/helper/RoamController} - */ - this._controller; + zrUtil.each(['color', 'colorAlpha', 'colorSaturation'], function (visualName) { + // Priority: thisNode > thisLevel > parentNodeDesignated > seriesModel + var val = nodeItemStyleModel.get(visualName, true); // Ignore parent + val == null && levelItemStyle && (val = levelItemStyle[visualName]); + val == null && (val = designatedVisual[visualName]); + val == null && (val = seriesItemStyleModel.get(visualName)); - /** - * 'ready', 'animating' - * @private - */ - this._state = 'ready'; + val != null && (visuals[visualName] = val); + }); - /** - * @private - * @type {boolean} - */ - this._mayClick; - }, + return visuals; + } - /** - * @override - */ - render: function (seriesModel, ecModel, api, payload) { + function calculateColor(visuals) { + var color = getValueVisualDefine(visuals, 'color'); - var models = ecModel.findComponents({ - mainType: 'series', subType: 'treemap', query: payload - }); - if (zrUtil.indexOf(models, seriesModel) < 0) { - return; + if (color) { + var colorAlpha = getValueVisualDefine(visuals, 'colorAlpha'); + var colorSaturation = getValueVisualDefine(visuals, 'colorSaturation'); + if (colorSaturation) { + color = zrColor.modifyHSL(color, null, null, colorSaturation); + } + if (colorAlpha) { + color = zrColor.modifyAlpha(color, colorAlpha); } - this.seriesModel = seriesModel; - this.api = api; - this.ecModel = ecModel; + return color; + } + } - var targetInfo = helper.retrieveTargetInfo(payload, seriesModel); - var payloadType = payload && payload.type; - var layoutInfo = seriesModel.layoutInfo; - var isInit = !this._oldTree; - var thisStorage = this._storage; + function calculateBorderColor(borderColorSaturation, thisNodeColor) { + return thisNodeColor != null + ? zrColor.modifyHSL(thisNodeColor, null, null, borderColorSaturation) + : null; + } - // Mark new root when action is treemapRootToNode. - var reRoot = (payloadType === 'treemapRootToNode' && targetInfo && thisStorage) - ? { - rootNodeGroup: thisStorage.nodeGroup[targetInfo.node.getRawIndex()], - direction: payload.direction - } - : null; + function getValueVisualDefine(visuals, name) { + var value = visuals[name]; + if (value != null && value !== 'none') { + return value; + } + } - var containerGroup = this._giveContainerGroup(layoutInfo); + function buildVisualMapping( + node, nodeModel, nodeLayout, nodeItemStyleModel, visuals, viewChildren + ) { + if (!viewChildren || !viewChildren.length) { + return; + } - var renderResult = this._doRender(containerGroup, seriesModel, reRoot); - ( - !isInit && ( - !payloadType - || payloadType === 'treemapZoomToNode' - || payloadType === 'treemapRootToNode' + var rangeVisual = getRangeVisual(nodeModel, 'color') + || ( + visuals.color != null + && visuals.color !== 'none' + && ( + getRangeVisual(nodeModel, 'colorAlpha') + || getRangeVisual(nodeModel, 'colorSaturation') ) - ) - ? this._doAnimation(containerGroup, renderResult, seriesModel, reRoot) - : renderResult.renderFinally(); + ); - this._resetController(api); + if (!rangeVisual) { + return; + } - this._renderBreadcrumb(seriesModel, api, targetInfo); - }, + var visualMin = nodeModel.get('visualMin'); + var visualMax = nodeModel.get('visualMax'); + var dataExtent = nodeLayout.dataExtent.slice(); + visualMin != null && visualMin < dataExtent[0] && (dataExtent[0] = visualMin); + visualMax != null && visualMax > dataExtent[1] && (dataExtent[1] = visualMax); - /** - * @private - */ - _giveContainerGroup: function (layoutInfo) { - var containerGroup = this._containerGroup; - if (!containerGroup) { - // FIXME - // 加一层containerGroup是为了clip,但是现在clip功能并没有实现。 - containerGroup = this._containerGroup = new Group(); - this._initEvents(containerGroup); - this.group.add(containerGroup); - } - containerGroup.attr('position', [layoutInfo.x, layoutInfo.y]); + var colorMappingBy = nodeModel.get('colorMappingBy'); + var opt = { + type: rangeVisual.name, + dataExtent: dataExtent, + visual: rangeVisual.range + }; + if (opt.type === 'color' + && (colorMappingBy === 'index' || colorMappingBy === 'id') + ) { + opt.mappingMethod = 'category'; + opt.loop = true; + // categories is ordinal, so do not set opt.categories. + } + else { + opt.mappingMethod = 'linear'; + } - return containerGroup; - }, + var mapping = new VisualMapping(opt); + mapping.__drColorMappingBy = colorMappingBy; - /** - * @private - */ - _doRender: function (containerGroup, seriesModel, reRoot) { - var thisTree = seriesModel.getData().tree; - var oldTree = this._oldTree; + return mapping; + } - // Clear last shape records. - var lastsForAnimation = createStorage(); - var thisStorage = createStorage(); - var oldStorage = this._storage; - var willInvisibleEls = []; - var doRenderNode = zrUtil.curry( - renderNode, seriesModel, - thisStorage, oldStorage, reRoot, - lastsForAnimation, willInvisibleEls - ); + // Notice: If we dont have the attribute 'colorRange', but only use + // attribute 'color' to represent both concepts of 'colorRange' and 'color', + // (It means 'colorRange' when 'color' is Array, means 'color' when not array), + // this problem will be encountered: + // If a level-1 node dont have children, and its siblings has children, + // and colorRange is set on level-1, then the node can not be colored. + // So we separate 'colorRange' and 'color' to different attributes. + function getRangeVisual(nodeModel, name) { + // 'colorRange', 'colorARange', 'colorSRange'. + // If not exsits on this node, fetch from levels and series. + var range = nodeModel.get(name); + return (isArray(range) && range.length) ? {name: name, range: range} : null; + } - // Notice: when thisTree and oldTree are the same tree (see list.cloneShadow), - // the oldTree is actually losted, so we can not find all of the old graphic - // elements from tree. So we use this stragegy: make element storage, move - // from old storage to new storage, clear old storage. + function mapVisual(nodeModel, visuals, child, index, mapping, seriesModel) { + var childVisuals = zrUtil.extend({}, visuals); - dualTravel( - thisTree.root ? [thisTree.root] : [], - (oldTree && oldTree.root) ? [oldTree.root] : [], - containerGroup, - thisTree === oldTree || !oldTree, - 0 - ); + if (mapping) { + var mappingType = mapping.type; + var colorMappingBy = mappingType === 'color' && mapping.__drColorMappingBy; + var value = + colorMappingBy === 'index' + ? index + : colorMappingBy === 'id' + ? seriesModel.mapIdToIndex(child.getId()) + : child.getValue(nodeModel.get('visualDimension')); - // Process all removing. - var willDeleteEls = clearStorage(oldStorage); + childVisuals[mappingType] = mapping.mapValueToVisual(value); + } - this._oldTree = thisTree; - this._storage = thisStorage; + return childVisuals; + } - return { - lastsForAnimation: lastsForAnimation, - willDeleteEls: willDeleteEls, - renderFinally: renderFinally - }; - function dualTravel(thisViewChildren, oldViewChildren, parentGroup, sameTree, depth) { - // When 'render' is triggered by action, - // 'this' and 'old' may be the same tree, - // we use rawIndex in that case. - if (sameTree) { - oldViewChildren = thisViewChildren; - each(thisViewChildren, function (child, index) { - !child.isRemoved() && processNode(index, index); - }); - } - // Diff hierarchically (diff only in each subtree, but not whole). - // because, consistency of view is important. - else { - (new DataDiffer(oldViewChildren, thisViewChildren, getKey, getKey)) - .add(processNode) - .update(processNode) - .remove(zrUtil.curry(processNode, null)) - .execute(); - } - function getKey(node) { - // Identify by name or raw index. - return node.getId(); - } +/***/ }, +/* 209 */ +/***/ function(module, exports, __webpack_require__) { - function processNode(newIndex, oldIndex) { - var thisNode = newIndex != null ? thisViewChildren[newIndex] : null; - var oldNode = oldIndex != null ? oldViewChildren[oldIndex] : null; + /** + * @file Visual mapping. + */ - var group = doRenderNode(thisNode, oldNode, parentGroup, depth); - group && dualTravel( - thisNode && thisNode.viewChildren || [], - oldNode && oldNode.viewChildren || [], - group, - sameTree, - depth + 1 - ); - } - } + var zrUtil = __webpack_require__(4); + var zrColor = __webpack_require__(39); + var linearMap = __webpack_require__(7).linearMap; + var each = zrUtil.each; + var isObject = zrUtil.isObject; - function clearStorage(storage) { - var willDeleteEls = createStorage(); - storage && each(storage, function (store, storageName) { - var delEls = willDeleteEls[storageName]; - each(store, function (el) { - el && (delEls.push(el), el.__tmWillDelete = 1); - }); - }); - return willDeleteEls; - } + var CATEGORY_DEFAULT_VISUAL_INDEX = -1; - function renderFinally() { - each(willDeleteEls, function (els) { - each(els, function (el) { - el.parent && el.parent.remove(el); - }); - }); - each(willInvisibleEls, function (el) { - el.invisible = true; - // Setting invisible is for optimizing, so no need to set dirty, - // just mark as invisible. - el.dirty(); - }); - } - }, + /** + * @param {Object} option + * @param {string} [option.type] See visualHandlers. + * @param {string} [option.mappingMethod] 'linear' or 'piecewise' or 'category' or 'fixed' + * @param {Array.=} [option.dataExtent] [minExtent, maxExtent], + * required when mappingMethod is 'linear' + * @param {Array.=} [option.pieceList] [ + * {value: someValue}, + * {interval: [min1, max1], visual: {...}}, + * {interval: [min2, max2]} + * ], + * required when mappingMethod is 'piecewise'. + * Visual for only each piece can be specified. + * @param {Array.=} [option.categories] ['cate1', 'cate2'] + * required when mappingMethod is 'category'. + * If no option.categories, categories is set + * as [0, 1, 2, ...]. + * @param {boolean} [option.loop=false] Whether loop mapping when mappingMethod is 'category'. + * @param {(Array|Object|*)} [option.visual] Visual data. + * when mappingMethod is 'category', + * visual data can be array or object + * (like: {cate1: '#222', none: '#fff'}) + * or primary types (which represents + * defualt category visual), otherwise visual + * can be array or primary (which will be + * normalized to array). + * + */ + var VisualMapping = function (option) { + var mappingMethod = option.mappingMethod; + var visualType = option.type; /** - * @private + * @readOnly + * @type {Object} */ - _doAnimation: function (containerGroup, renderResult, seriesModel, reRoot) { - if (!seriesModel.get('animation')) { - return; - } + var thisOption = this.option = zrUtil.clone(option); - var duration = seriesModel.get('animationDurationUpdate'); - var easing = seriesModel.get('animationEasing'); - var animationWrap = animationUtil.createWrap(); + /** + * @readOnly + * @type {string} + */ + this.type = visualType; - // Make delete animations. - each(renderResult.willDeleteEls, function (store, storageName) { - each(store, function (el, rawIndex) { - if (el.invisible) { - return; - } + /** + * @readOnly + * @type {string} + */ + this.mappingMethod = mappingMethod; - var parent = el.parent; // Always has parent, and parent is nodeGroup. - var target; + /** + * @private + * @type {Function} + */ + this._normalizeData = normalizers[mappingMethod]; - if (reRoot && reRoot.direction === 'drillDown') { - target = parent === reRoot.rootNodeGroup - // This is the content element of view root. - // Only `content` will enter this branch, because - // `background` and `nodeGroup` will not be deleted. - ? { - shape: { - x: 0, - y: 0, - width: parent.__tmNodeWidth, - height: parent.__tmNodeHeight - }, - style: { - opacity: 0 - } - } - // Others. - : {style: {opacity: 0}}; - } - else { - var targetX = 0; - var targetY = 0; + var visualHandler = visualHandlers[visualType]; - if (!parent.__tmWillDelete) { - // Let node animate to right-bottom corner, cooperating with fadeout, - // which is appropriate for user understanding. - // Divided by 2 for reRoot rolling up effect. - targetX = parent.__tmNodeWidth / 2; - targetY = parent.__tmNodeHeight / 2; - } + /** + * @public + * @type {Function} + */ + this.applyVisual = visualHandler.applyVisual; - target = storageName === 'nodeGroup' - ? {position: [targetX, targetY], style: {opacity: 0}} - : { - shape: {x: targetX, y: targetY, width: 0, height: 0}, - style: {opacity: 0} - }; - } + /** + * @public + * @type {Function} + */ + this.getColorMapper = visualHandler.getColorMapper; - target && animationWrap.add(el, target, duration, easing); - }); - }); + /** + * @private + * @type {Function} + */ + this._doMap = visualHandler._doMap[mappingMethod]; - // Make other animations - each(this._storage, function (store, storageName) { - each(store, function (el, rawIndex) { - var last = renderResult.lastsForAnimation[storageName][rawIndex]; - var target = {}; + if (mappingMethod === 'piecewise') { + normalizeVisualRange(thisOption); + preprocessForPiecewise(thisOption); + } + else if (mappingMethod === 'category') { + thisOption.categories + ? preprocessForSpecifiedCategory(thisOption) + // categories is ordinal when thisOption.categories not specified, + // which need no more preprocess except normalize visual. + : normalizeVisualRange(thisOption, true); + } + else { // mappingMethod === 'linear' or 'fixed' + zrUtil.assert(mappingMethod !== 'linear' || thisOption.dataExtent); + normalizeVisualRange(thisOption); + } + }; - if (!last) { - return; - } + VisualMapping.prototype = { - if (storageName === 'nodeGroup') { - if (last.old) { - target.position = el.position.slice(); - el.attr('position', last.old); - } - } - else { - if (last.old) { - target.shape = zrUtil.extend({}, el.shape); - el.setShape(last.old); - } + constructor: VisualMapping, - if (last.fadein) { - el.setStyle('opacity', 0); - target.style = {opacity: 1}; - } - // When animation is stopped for succedent animation starting, - // el.style.opacity might not be 1 - else if (el.style.opacity !== 1) { - target.style = {opacity: 1}; - } - } + mapValueToVisual: function (value) { + var normalized = this._normalizeData(value); + return this._doMap(normalized, value); + }, - animationWrap.add(el, target, duration, easing); - }); - }, this); + getNormalizer: function () { + return zrUtil.bind(this._normalizeData, this); + } + }; - this._state = 'animating'; + var visualHandlers = VisualMapping.visualHandlers = { - animationWrap - .done(bind(function () { - this._state = 'ready'; - renderResult.renderFinally(); - }, this)) - .start(); - }, + color: { - /** - * @private - */ - _resetController: function (api) { - var controller = this._controller; + applyVisual: makeApplyVisual('color'), - // Init controller. - if (!controller) { - controller = this._controller = new RoamController(api.getZr()); - controller.enable(this.seriesModel.get('roam')); - controller.on('pan', bind(this._onPan, this)); - controller.on('zoom', bind(this._onZoom, this)); - } + /** + * Create a mapper function + * @return {Function} + */ + getColorMapper: function () { + var thisOption = this.option; - var rect = new BoundingRect(0, 0, api.getWidth(), api.getHeight()); - controller.setContainsPoint(function (x, y) { - return rect.contain(x, y); - }); - }, + return zrUtil.bind( + thisOption.mappingMethod === 'category' + ? function (value, isNormalized) { + !isNormalized && (value = this._normalizeData(value)); + return doMapCategory.call(this, value); + } + : function (value, isNormalized, out) { + // If output rgb array + // which will be much faster and useful in pixel manipulation + var returnRGBArray = !!out; + !isNormalized && (value = this._normalizeData(value)); + out = zrColor.fastMapToColor(value, thisOption.parsedVisual, out); + return returnRGBArray ? out : zrColor.stringify(out, 'rgba'); + }, + this + ); + }, - /** - * @private - */ - _clearController: function () { - var controller = this._controller; - if (controller) { - controller.dispose(); - controller = null; + _doMap: { + linear: function (normalized) { + return zrColor.stringify( + zrColor.fastMapToColor(normalized, this.option.parsedVisual), + 'rgba' + ); + }, + category: doMapCategory, + piecewise: function (normalized, value) { + var result = getSpecifiedVisual.call(this, value); + if (result == null) { + result = zrColor.stringify( + zrColor.fastMapToColor(normalized, this.option.parsedVisual), + 'rgba' + ); + } + return result; + }, + fixed: doMapFixed } }, - /** - * @private - */ - _onPan: function (dx, dy) { - this._mayClick = false; + colorHue: makePartialColorVisualHandler(function (color, value) { + return zrColor.modifyHSL(color, value); + }), - if (this._state !== 'animating' - && (Math.abs(dx) > DRAG_THRESHOLD || Math.abs(dy) > DRAG_THRESHOLD) - ) { - // These param must not be cached. - var root = this.seriesModel.getData().tree.root; + colorSaturation: makePartialColorVisualHandler(function (color, value) { + return zrColor.modifyHSL(color, null, value); + }), - if (!root) { - return; - } + colorLightness: makePartialColorVisualHandler(function (color, value) { + return zrColor.modifyHSL(color, null, null, value); + }), - var rootLayout = root.getLayout(); + colorAlpha: makePartialColorVisualHandler(function (color, value) { + return zrColor.modifyAlpha(color, value); + }), - if (!rootLayout) { - return; - } + opacity: { + applyVisual: makeApplyVisual('opacity'), + _doMap: makeDoMap([0, 1]) + }, - this.api.dispatchAction({ - type: 'treemapMove', - from: this.uid, - seriesId: this.seriesModel.id, - rootRect: { - x: rootLayout.x + dx, y: rootLayout.y + dy, - width: rootLayout.width, height: rootLayout.height + symbol: { + applyVisual: function (value, getter, setter) { + var symbolCfg = this.mapValueToVisual(value); + if (zrUtil.isString(symbolCfg)) { + setter('symbol', symbolCfg); + } + else if (isObject(symbolCfg)) { + for (var name in symbolCfg) { + if (symbolCfg.hasOwnProperty(name)) { + setter(name, symbolCfg[name]); + } } - }); + } + }, + _doMap: { + linear: doMapToArray, + category: doMapCategory, + piecewise: function (normalized, value) { + var result = getSpecifiedVisual.call(this, value); + if (result == null) { + result = doMapToArray.call(this, normalized); + } + return result; + }, + fixed: doMapFixed } }, - /** - * @private - */ - _onZoom: function (scale, mouseX, mouseY) { - this._mayClick = false; + symbolSize: { + applyVisual: makeApplyVisual('symbolSize'), + _doMap: makeDoMap([0, 1]) + } + }; - if (this._state !== 'animating') { - // These param must not be cached. - var root = this.seriesModel.getData().tree.root; - if (!root) { - return; - } + function preprocessForPiecewise(thisOption) { + var pieceList = thisOption.pieceList; + thisOption.hasSpecialVisual = false; - var rootLayout = root.getLayout(); + zrUtil.each(pieceList, function (piece, index) { + piece.originIndex = index; + // piece.visual is "result visual value" but not + // a visual range, so it does not need to be normalized. + if (piece.visual != null) { + thisOption.hasSpecialVisual = true; + } + }); + } - if (!rootLayout) { - return; - } + function preprocessForSpecifiedCategory(thisOption) { + // Hash categories. + var categories = thisOption.categories; + var visual = thisOption.visual; - var rect = new BoundingRect( - rootLayout.x, rootLayout.y, rootLayout.width, rootLayout.height - ); - var layoutInfo = this.seriesModel.layoutInfo; + var categoryMap = thisOption.categoryMap = {}; + each(categories, function (cate, index) { + categoryMap[cate] = index; + }); - // Transform mouse coord from global to containerGroup. - mouseX -= layoutInfo.x; - mouseY -= layoutInfo.y; + // Process visual map input. + if (!zrUtil.isArray(visual)) { + var visualArr = []; - // Scale root bounding rect. - var m = matrix.create(); - matrix.translate(m, m, [-mouseX, -mouseY]); - matrix.scale(m, m, [scale, scale]); - matrix.translate(m, m, [mouseX, mouseY]); + if (zrUtil.isObject(visual)) { + each(visual, function (v, cate) { + var index = categoryMap[cate]; + visualArr[index != null ? index : CATEGORY_DEFAULT_VISUAL_INDEX] = v; + }); + } + else { // Is primary type, represents default visual. + visualArr[CATEGORY_DEFAULT_VISUAL_INDEX] = visual; + } - rect.applyTransform(m); + visual = setVisualToOption(thisOption, visualArr); + } - this.api.dispatchAction({ - type: 'treemapRender', - from: this.uid, - seriesId: this.seriesModel.id, - rootRect: { - x: rect.x, y: rect.y, - width: rect.width, height: rect.height - } - }); + // Remove categories that has no visual, + // then we can mapping them to CATEGORY_DEFAULT_VISUAL_INDEX. + for (var i = categories.length - 1; i >= 0; i--) { + if (visual[i] == null) { + delete categoryMap[categories[i]]; + categories.pop(); } - }, + } + } - /** - * @private - */ - _initEvents: function (containerGroup) { - // FIXME - // 不用click以及silent的原因是,animate时视图设置silent true来避免click生效, - // 但是animate中,按下鼠标,animate结束后(silent设回为false)松开鼠标, - // 还是会触发click,期望是不触发。 + function normalizeVisualRange(thisOption, isCategory) { + var visual = thisOption.visual; + var visualArr = []; - // Mousedown occurs when drag start, and mouseup occurs when drag end, - // click event should not be triggered in that case. + if (zrUtil.isObject(visual)) { + each(visual, function (v) { + visualArr.push(v); + }); + } + else if (visual != null) { + visualArr.push(visual); + } - containerGroup.on('mousedown', function (e) { - this._state === 'ready' && (this._mayClick = true); - }, this); - containerGroup.on('mouseup', function (e) { - if (this._mayClick) { - this._mayClick = false; - this._state === 'ready' && onClick.call(this, e); - } - }, this); + var doNotNeedPair = {color: 1, symbol: 1}; - function onClick(e) { - var nodeClick = this.seriesModel.get('nodeClick', true); + if (!isCategory + && visualArr.length === 1 + && !doNotNeedPair.hasOwnProperty(thisOption.type) + ) { + // Do not care visualArr.length === 0, which is illegal. + visualArr[1] = visualArr[0]; + } - if (!nodeClick) { - return; - } + setVisualToOption(thisOption, visualArr); + } - var targetInfo = this.findTarget(e.offsetX, e.offsetY); + function makePartialColorVisualHandler(applyValue) { + return { + applyVisual: function (value, getter, setter) { + value = this.mapValueToVisual(value); + // Must not be array value + setter('color', applyValue(getter('color'), value)); + }, + _doMap: makeDoMap([0, 1]) + }; + } - if (!targetInfo) { - return; - } + function doMapToArray(normalized) { + var visual = this.option.visual; + return visual[ + Math.round(linearMap(normalized, [0, 1], [0, visual.length - 1], true)) + ] || {}; + } - var node = targetInfo.node; - if (node.getLayout().isLeafRoot) { - this._rootToNode(targetInfo); - } - else { - if (nodeClick === 'zoomToNode') { - this._zoomToNode(targetInfo); - } - else if (nodeClick === 'link') { - var itemModel = node.hostTree.data.getItemModel(node.dataIndex); - var link = itemModel.get('link', true); - var linkTarget = itemModel.get('target', true) || 'blank'; - link && window.open(link, linkTarget); - } - } - } - }, + function makeApplyVisual(visualType) { + return function (value, getter, setter) { + setter(visualType, this.mapValueToVisual(value)); + }; + } - /** - * @private - */ - _renderBreadcrumb: function (seriesModel, api, targetInfo) { - if (!targetInfo) { - targetInfo = seriesModel.get('leafDepth', true) != null - ? {node: seriesModel.getViewRoot()} - // FIXME - // better way? - // Find breadcrumb tail on center of containerGroup. - : this.findTarget(api.getWidth() / 2, api.getHeight() / 2); + function doMapCategory(normalized) { + var visual = this.option.visual; + return visual[ + (this.option.loop && normalized !== CATEGORY_DEFAULT_VISUAL_INDEX) + ? normalized % visual.length + : normalized + ]; + } - if (!targetInfo) { - targetInfo = {node: seriesModel.getData().tree.root}; + function doMapFixed() { + return this.option.visual[0]; + } + + function makeDoMap(sourceExtent) { + return { + linear: function (normalized) { + return linearMap(normalized, sourceExtent, this.option.visual, true); + }, + category: doMapCategory, + piecewise: function (normalized, value) { + var result = getSpecifiedVisual.call(this, value); + if (result == null) { + result = linearMap(normalized, sourceExtent, this.option.visual, true); } + return result; + }, + fixed: doMapFixed + }; + } + + function getSpecifiedVisual(value) { + var thisOption = this.option; + var pieceList = thisOption.pieceList; + if (thisOption.hasSpecialVisual) { + var pieceIndex = VisualMapping.findPieceIndex(value, pieceList); + var piece = pieceList[pieceIndex]; + if (piece && piece.visual) { + return piece.visual[this.type]; } + } + } - (this._breadcrumb || (this._breadcrumb = new Breadcrumb(this.group))) - .render(seriesModel, api, targetInfo.node, bind(onSelect, this)); + function setVisualToOption(thisOption, visualArr) { + thisOption.visual = visualArr; + if (thisOption.type === 'color') { + thisOption.parsedVisual = zrUtil.map(visualArr, function (item) { + return zrColor.parse(item); + }); + } + return visualArr; + } - function onSelect(node) { - if (this._state !== 'animating') { - helper.aboveViewRoot(seriesModel.getViewRoot(), node) - ? this._rootToNode({node: node}) - : this._zoomToNode({node: node}); - } - } - }, - /** - * @override - */ - remove: function () { - this._clearController(); - this._containerGroup && this._containerGroup.removeAll(); - this._storage = createStorage(); - this._state = 'ready'; - this._breadcrumb && this._breadcrumb.remove(); - }, + /** + * Normalizers by mapping methods. + */ + var normalizers = { - dispose: function () { - this._clearController(); + linear: function (value) { + return linearMap(value, this.option.dataExtent, [0, 1], true); }, - /** - * @private - */ - _zoomToNode: function (targetInfo) { - this.api.dispatchAction({ - type: 'treemapZoomToNode', - from: this.uid, - seriesId: this.seriesModel.id, - targetNode: targetInfo.node - }); + piecewise: function (value) { + var pieceList = this.option.pieceList; + var pieceIndex = VisualMapping.findPieceIndex(value, pieceList, true); + if (pieceIndex != null) { + return linearMap(pieceIndex, [0, pieceList.length - 1], [0, 1], true); + } }, - /** - * @private - */ - _rootToNode: function (targetInfo) { - this.api.dispatchAction({ - type: 'treemapRootToNode', - from: this.uid, - seriesId: this.seriesModel.id, - targetNode: targetInfo.node - }); + category: function (value) { + var index = this.option.categories + ? this.option.categoryMap[value] + : value; // ordinal + return index == null ? CATEGORY_DEFAULT_VISUAL_INDEX : index; }, - /** - * @public - * @param {number} x Global coord x. - * @param {number} y Global coord y. - * @return {Object} info If not found, return undefined; - * @return {number} info.node Target node. - * @return {number} info.offsetX x refer to target node. - * @return {number} info.offsetY y refer to target node. - */ - findTarget: function (x, y) { - var targetInfo; - var viewRoot = this.seriesModel.getViewRoot(); - - viewRoot.eachNode({attr: 'viewChildren', order: 'preorder'}, function (node) { - var bgEl = this._storage.background[node.getRawIndex()]; - // If invisible, there might be no element. - if (bgEl) { - var point = bgEl.transformCoordToLocal(x, y); - var shape = bgEl.shape; - - // For performance consideration, dont use 'getBoundingRect'. - if (shape.x <= point[0] - && point[0] <= shape.x + shape.width - && shape.y <= point[1] - && point[1] <= shape.y + shape.height - ) { - targetInfo = {node: node, offsetX: point[0], offsetY: point[1]}; - } - else { - return false; // Suppress visit subtree. - } - } - }, this); + fixed: zrUtil.noop + }; - return targetInfo; - } - }); /** - * @inner + * List available visual types. + * + * @public + * @return {Array.} */ - function createStorage() { - return {nodeGroup: [], background: [], content: []}; - } + VisualMapping.listVisualTypes = function () { + var visualTypes = []; + zrUtil.each(visualHandlers, function (handler, key) { + visualTypes.push(key); + }); + return visualTypes; + }; /** - * @inner - * @return Return undefined means do not travel further. + * @public */ - function renderNode( - seriesModel, thisStorage, oldStorage, reRoot, - lastsForAnimation, willInvisibleEls, - thisNode, oldNode, parentGroup, depth - ) { - // Whether under viewRoot. - if (!thisNode) { - // Deleting nodes will be performed finally. This method just find - // element from old storage, or create new element, set them to new - // storage, and set styles. - return; - } - - var thisLayout = thisNode.getLayout(); - - if (!thisLayout || !thisLayout.isInView) { - return; - } - - var thisWidth = thisLayout.width; - var thisHeight = thisLayout.height; - var thisInvisible = thisLayout.invisible; - - var thisRawIndex = thisNode.getRawIndex(); - var oldRawIndex = oldNode && oldNode.getRawIndex(); - - // Node group - var group = giveGraphic('nodeGroup', Group); - - if (!group) { - return; - } - - parentGroup.add(group); - // x,y are not set when el is above view root. - group.attr('position', [thisLayout.x || 0, thisLayout.y || 0]); - group.__tmNodeWidth = thisWidth; - group.__tmNodeHeight = thisHeight; + VisualMapping.addVisualHandler = function (name, handler) { + visualHandlers[name] = handler; + }; - if (thisLayout.isAboveViewRoot) { - return group; - } + /** + * @public + */ + VisualMapping.isValidType = function (visualType) { + return visualHandlers.hasOwnProperty(visualType); + }; - // Background - var bg = giveGraphic('background', Rect, depth, Z_BG); - if (bg) { - bg.setShape({x: 0, y: 0, width: thisWidth, height: thisHeight}); - updateStyle(bg, function () { - bg.setStyle('fill', thisNode.getVisual('borderColor', true)); - }); - group.add(bg); + /** + * Convinent method. + * Visual can be Object or Array or primary type. + * + * @public + */ + VisualMapping.eachVisual = function (visual, callback, context) { + if (zrUtil.isObject(visual)) { + zrUtil.each(visual, callback, context); } - - var thisViewChildren = thisNode.viewChildren; - - // No children, render content. - if (!thisViewChildren || !thisViewChildren.length) { - var content = giveGraphic('content', Rect, depth, Z_CONTENT); - content && renderContent(group); + else { + callback.call(context, visual); } + }; - return group; - - // ---------------------------- - // | Procedures in renderNode | - // ---------------------------- - - function renderContent(group) { - // For tooltip. - content.dataIndex = thisNode.dataIndex; - content.seriesIndex = seriesModel.seriesIndex; + VisualMapping.mapVisual = function (visual, callback, context) { + var isPrimary; + var newVisual = zrUtil.isArray(visual) + ? [] + : zrUtil.isObject(visual) + ? {} + : (isPrimary = true, null); - var borderWidth = thisLayout.borderWidth; - var contentWidth = Math.max(thisWidth - 2 * borderWidth, 0); - var contentHeight = Math.max(thisHeight - 2 * borderWidth, 0); + VisualMapping.eachVisual(visual, function (v, key) { + var newVal = callback.call(context, v, key); + isPrimary ? (newVisual = newVal) : (newVisual[key] = newVal); + }); + return newVisual; + }; - content.culling = true; - content.setShape({ - x: borderWidth, - y: borderWidth, - width: contentWidth, - height: contentHeight - }); + /** + * @public + * @param {Object} obj + * @return {Oject} new object containers visual values. + * If no visuals, return null. + */ + VisualMapping.retrieveVisuals = function (obj) { + var ret = {}; + var hasVisual; - var visualColor = thisNode.getVisual('color', true); - updateStyle(content, function () { - var normalStyle = {fill: visualColor}; - var emphasisStyle = thisNode.getModel('itemStyle.emphasis').getItemStyle(); + obj && each(visualHandlers, function (h, visualType) { + if (obj.hasOwnProperty(visualType)) { + ret[visualType] = obj[visualType]; + hasVisual = true; + } + }); - prepareText(normalStyle, emphasisStyle, visualColor, contentWidth, contentHeight); + return hasVisual ? ret : null; + }; - content.setStyle(normalStyle); - graphic.setHoverStyle(content, emphasisStyle); + /** + * Give order to visual types, considering colorSaturation, colorAlpha depends on color. + * + * @public + * @param {(Object|Array)} visualTypes If Object, like: {color: ..., colorSaturation: ...} + * IF Array, like: ['color', 'symbol', 'colorSaturation'] + * @return {Array.} Sorted visual types. + */ + VisualMapping.prepareVisualTypes = function (visualTypes) { + if (isObject(visualTypes)) { + var types = []; + each(visualTypes, function (item, type) { + types.push(type); }); - - group.add(content); + visualTypes = types; } - - function updateStyle(element, cb) { - if (!thisInvisible) { - // If invisible, do not set visual, otherwise the element will - // change immediately before animation. We think it is OK to - // remain its origin color when moving out of the view window. - cb(); - - if (!element.__tmWillVisible) { - element.invisible = false; - } - } - else { - // Delay invisible setting utill animation finished, - // avoid element vanish suddenly before animation. - !element.invisible && willInvisibleEls.push(element); - } + else if (zrUtil.isArray(visualTypes)) { + visualTypes = visualTypes.slice(); } - - function prepareText(normalStyle, emphasisStyle, visualColor, contentWidth, contentHeight) { - var nodeModel = thisNode.getModel(); - var text = nodeModel.get('name'); - if (thisLayout.isLeafRoot) { - var iconChar = seriesModel.get('drillDownIcon', true); - text = iconChar ? iconChar + ' ' + text : text; - } - - setText( - text, normalStyle, nodeModel, PATH_LABEL_NORMAL, - visualColor, contentWidth, contentHeight - ); - setText( - text, emphasisStyle, nodeModel, PATH_LABEL_EMPHASIS, - visualColor, contentWidth, contentHeight - ); + else { + return []; } - function setText(text, style, nodeModel, labelPath, visualColor, contentWidth, contentHeight) { - var labelModel = nodeModel.getModel(labelPath); - var labelTextStyleModel = labelModel.getModel('textStyle'); + visualTypes.sort(function (type1, type2) { + // color should be front of colorSaturation, colorAlpha, ... + // symbol and symbolSize do not matter. + return (type2 === 'color' && type1 !== 'color' && type1.indexOf('color') === 0) + ? 1 : -1; + }); - graphic.setText(style, labelModel, visualColor); + return visualTypes; + }; - // text.align and text.baseline is not included by graphic.setText, - // because in most cases the two attributes are not exposed to user, - // except in treemap. - style.textAlign = labelTextStyleModel.get('align'); - style.textVerticalAlign = labelTextStyleModel.get('baseline'); + /** + * 'color', 'colorSaturation', 'colorAlpha', ... are depends on 'color'. + * Other visuals are only depends on themself. + * + * @public + * @param {string} visualType1 + * @param {string} visualType2 + * @return {boolean} + */ + VisualMapping.dependsOn = function (visualType1, visualType2) { + return visualType2 === 'color' + ? !!(visualType1 && visualType1.indexOf(visualType2) === 0) + : visualType1 === visualType2; + }; - var textRect = labelTextStyleModel.getTextRect(text); - if (!labelModel.getShallow('show') || textRect.height > contentHeight) { - style.text = ''; - } - else if (textRect.width > contentWidth) { - style.text = labelTextStyleModel.get('ellipsis') - ? labelTextStyleModel.truncateText( - text, contentWidth, null, {minChar: 2} - ) - : ''; - } - else { - style.text = text; + /** + * @param {number} value + * @param {Array.} pieceList [{value: ..., interval: [min, max]}, ...] + * Always from small to big. + * @param {boolean} [findClosestWhenOutside=false] + * @return {number} index + */ + VisualMapping.findPieceIndex = function (value, pieceList, findClosestWhenOutside) { + var possibleI; + var abs = Infinity; + + // value has the higher priority. + for (var i = 0, len = pieceList.length; i < len; i++) { + var pieceValue = pieceList[i].value; + if (pieceValue != null) { + if (pieceValue === value + // FIXME + // It is supposed to compare value according to value type of dimension, + // but currently value type can exactly be string or number. + // Compromise for numeric-like string (like '12'), especially + // in the case that visualMap.categories is ['22', '33']. + || (typeof pieceValue === 'string' && pieceValue === value + '') + ) { + return i; + } + findClosestWhenOutside && updatePossible(pieceValue, i); } } - function giveGraphic(storageName, Ctor, depth, z) { - var element = oldRawIndex != null && oldStorage[storageName][oldRawIndex]; - var lasts = lastsForAnimation[storageName]; + for (var i = 0, len = pieceList.length; i < len; i++) { + var piece = pieceList[i]; + var interval = piece.interval; + var close = piece.close; - if (element) { - // Remove from oldStorage - oldStorage[storageName][oldRawIndex] = null; - prepareAnimationWhenHasOld(lasts, element, storageName); - } - // If invisible and no old element, do not create new element (for optimizing). - else if (!thisInvisible) { - element = new Ctor({z: calculateZ(depth, z)}); - element.__tmDepth = depth; - element.__tmStorageName = storageName; - prepareAnimationWhenNoOld(lasts, element, storageName); + if (interval) { + if (interval[0] === -Infinity) { + if (littleThan(close[1], value, interval[1])) { + return i; + } + } + else if (interval[1] === Infinity) { + if (littleThan(close[0], interval[0], value)) { + return i; + } + } + else if ( + littleThan(close[0], interval[0], value) + && littleThan(close[1], value, interval[1]) + ) { + return i; + } + findClosestWhenOutside && updatePossible(interval[0], i); + findClosestWhenOutside && updatePossible(interval[1], i); } - - // Set to thisStorage - return (thisStorage[storageName][thisRawIndex] = element); } - function prepareAnimationWhenHasOld(lasts, element, storageName) { - var lastCfg = lasts[thisRawIndex] = {}; - lastCfg.old = storageName === 'nodeGroup' - ? element.position.slice() - : zrUtil.extend({}, element.shape); + if (findClosestWhenOutside) { + return value === Infinity + ? pieceList.length - 1 + : value === -Infinity + ? 0 + : possibleI; } - // If a element is new, we need to find the animation start point carefully, - // otherwise it will looks strange when 'zoomToNode'. - function prepareAnimationWhenNoOld(lasts, element, storageName) { - var lastCfg = lasts[thisRawIndex] = {}; - var parentNode = thisNode.parentNode; - - if (parentNode && (!reRoot || reRoot.direction === 'drillDown')) { - var parentOldX = 0; - var parentOldY = 0; - - // New nodes appear from right-bottom corner in 'zoomToNode' animation. - // For convenience, get old bounding rect from background. - var parentOldBg = lastsForAnimation.background[parentNode.getRawIndex()]; - if (!reRoot && parentOldBg && parentOldBg.old) { - parentOldX = parentOldBg.old.width; - parentOldY = parentOldBg.old.height; - } - - // When no parent old shape found, its parent is new too, - // so we can just use {x:0, y:0}. - lastCfg.old = storageName === 'nodeGroup' - ? [0, parentOldY] - : {x: parentOldX, y: parentOldY, width: 0, height: 0}; + function updatePossible(val, index) { + var newAbs = Math.abs(val - value); + if (newAbs < abs) { + abs = newAbs; + possibleI = index; } - - // Fade in, user can be aware that these nodes are new. - lastCfg.fadein = storageName !== 'nodeGroup'; } - } - // We can not set all backgroud with the same z, Because the behaviour of - // drill down and roll up differ background creation sequence from tree - // hierarchy sequence, which cause that lowser background element overlap - // upper ones. So we calculate z based on depth. - // Moreover, we try to shrink down z interval to [0, 1] to avoid that - // treemap with large z overlaps other components. - function calculateZ(depth, zInLevel) { - var zb = depth * Z_BASE + zInLevel; - return (zb - 1) / zb; + }; + + function littleThan(close, a, b) { + return close ? a <= b : a < b; } + module.exports = VisualMapping; + /***/ }, -/* 191 */ +/* 210 */ /***/ function(module, exports, __webpack_require__) { - + - var graphic = __webpack_require__(43); - var layout = __webpack_require__(21); var zrUtil = __webpack_require__(4); - var helper = __webpack_require__(189); - - var TEXT_PADDING = 8; - var ITEM_GAP = 8; - var ARRAY_LENGTH = 5; - - function Breadcrumb(containerGroup) { - /** - * @private - * @type {module:zrender/container/Group} - */ - this.group = new graphic.Group(); - - containerGroup.add(this.group); - } - - Breadcrumb.prototype = { - - constructor: Breadcrumb, - - render: function (seriesModel, api, targetNode, onSelect) { - var model = seriesModel.getModel('breadcrumb'); - var thisGroup = this.group; + var numberUtil = __webpack_require__(7); + var layout = __webpack_require__(21); + var helper = __webpack_require__(203); + var BoundingRect = __webpack_require__(9); + var helper = __webpack_require__(203); - thisGroup.removeAll(); + var mathMax = Math.max; + var mathMin = Math.min; + var parsePercent = numberUtil.parsePercent; + var retrieveValue = zrUtil.retrieve; + var each = zrUtil.each; - if (!model.get('show') || !targetNode) { - return; - } + /** + * @public + */ + function update(ecModel, api, payload) { + // Layout result in each node: + // {x, y, width, height, area, borderWidth} + var condition = {mainType: 'series', subType: 'treemap', query: payload}; + ecModel.eachComponent(condition, function (seriesModel) { - var normalStyleModel = model.getModel('itemStyle.normal'); - // var emphasisStyleModel = model.getModel('itemStyle.emphasis'); - var textStyleModel = normalStyleModel.getModel('textStyle'); + var ecWidth = api.getWidth(); + var ecHeight = api.getHeight(); + var seriesOption = seriesModel.option; - var layoutParam = { - pos: { - left: model.get('left'), - right: model.get('right'), - top: model.get('top'), - bottom: model.get('bottom') - }, - box: { + var layoutInfo = layout.getLayoutRect( + seriesModel.getBoxLayoutParams(), + { width: api.getWidth(), height: api.getHeight() - }, - emptyItemWidth: model.get('emptyItemWidth'), - totalWidth: 0, - renderList: [] - }; + } + ); - this._prepare(targetNode, layoutParam, textStyleModel); - this._renderContent(seriesModel, layoutParam, normalStyleModel, textStyleModel, onSelect); + var size = seriesOption.size || []; // Compatible with ec2. + var containerWidth = parsePercent( + retrieveValue(layoutInfo.width, size[0]), + ecWidth + ); + var containerHeight = parsePercent( + retrieveValue(layoutInfo.height, size[1]), + ecHeight + ); - layout.positionElement(thisGroup, layoutParam.pos, layoutParam.box); - }, + // Fetch payload info. + var payloadType = payload && payload.type; + var targetInfo = helper.retrieveTargetInfo(payload, seriesModel); + var rootRect = (payloadType === 'treemapRender' || payloadType === 'treemapMove') + ? payload.rootRect : null; + var viewRoot = seriesModel.getViewRoot(); + var viewAbovePath = helper.getPathToRoot(viewRoot); - /** - * Prepare render list and total width - * @private - */ - _prepare: function (targetNode, layoutParam, textStyleModel) { - for (var node = targetNode; node; node = node.parentNode) { - var text = node.getModel().get('name'); - var textRect = textStyleModel.getTextRect(text); - var itemWidth = Math.max( - textRect.width + TEXT_PADDING * 2, - layoutParam.emptyItemWidth - ); - layoutParam.totalWidth += itemWidth + ITEM_GAP; - layoutParam.renderList.push({node: node, text: text, width: itemWidth}); - } - }, + if (payloadType !== 'treemapMove') { + var rootSize = payloadType === 'treemapZoomToNode' + ? estimateRootSize( + seriesModel, targetInfo, viewRoot, containerWidth, containerHeight + ) + : rootRect + ? [rootRect.width, rootRect.height] + : [containerWidth, containerHeight]; - /** - * @private - */ - _renderContent: function ( - seriesModel, layoutParam, normalStyleModel, textStyleModel, onSelect - ) { - // Start rendering. - var lastX = 0; - var emptyItemWidth = layoutParam.emptyItemWidth; - var height = seriesModel.get('breadcrumb.height'); - var availableSize = layout.getAvailableSize(layoutParam.pos, layoutParam.box); - var totalWidth = layoutParam.totalWidth; - var renderList = layoutParam.renderList; + var sort = seriesOption.sort; + if (sort && sort !== 'asc' && sort !== 'desc') { + sort = 'desc'; + } + var options = { + squareRatio: seriesOption.squareRatio, + sort: sort, + leafDepth: seriesOption.leafDepth + }; - for (var i = renderList.length - 1; i >= 0; i--) { - var item = renderList[i]; - var itemNode = item.node; - var itemWidth = item.width; - var text = item.text; + // layout should be cleared because using updateView but not update. + viewRoot.hostTree.clearLayouts(); - // Hdie text and shorten width if necessary. - if (totalWidth > availableSize.width) { - totalWidth -= itemWidth - emptyItemWidth; - itemWidth = emptyItemWidth; - text = ''; - } + // TODO + // optimize: if out of view clip, do not layout. + // But take care that if do not render node out of view clip, + // how to calculate start po - var el = new graphic.Polygon({ - shape: { - points: makeItemPoints( - lastX, 0, itemWidth, height, - i === renderList.length - 1, i === 0 - ) - }, - style: zrUtil.defaults( - normalStyleModel.getItemStyle(), - { - lineJoin: 'bevel', - text: text, - textFill: textStyleModel.getTextColor(), - textFont: textStyleModel.getFont() - } - ), - z: 10, - onclick: zrUtil.curry(onSelect, itemNode) + var viewRootLayout = { + x: 0, y: 0, + width: rootSize[0], height: rootSize[1], + area: rootSize[0] * rootSize[1] + }; + viewRoot.setLayout(viewRootLayout); + + squarify(viewRoot, options, false, 0); + // Supplement layout. + var viewRootLayout = viewRoot.getLayout(); + each(viewAbovePath, function (node, index) { + var childValue = (viewAbovePath[index + 1] || viewRoot).getValue(); + node.setLayout(zrUtil.extend( + {dataExtent: [childValue, childValue], borderWidth: 0}, + viewRootLayout + )); }); - this.group.add(el); + } - packEventData(el, seriesModel, itemNode); + var treeRoot = seriesModel.getData().tree.root; - lastX += itemWidth + ITEM_GAP; - } - }, + treeRoot.setLayout( + calculateRootPosition(layoutInfo, rootRect, targetInfo), + true + ); - /** - * @override - */ - remove: function () { - this.group.removeAll(); - } - }; + seriesModel.setLayoutInfo(layoutInfo); - function makeItemPoints(x, y, itemWidth, itemHeight, head, tail) { - var points = [ - [head ? x : x - ARRAY_LENGTH, y], - [x + itemWidth, y], - [x + itemWidth, y + itemHeight], - [head ? x : x - ARRAY_LENGTH, y + itemHeight] - ]; - !tail && points.splice(2, 0, [x + itemWidth + ARRAY_LENGTH, y + itemHeight / 2]); - !head && points.push([x, y + itemHeight / 2]); - return points; + // FIXME + // 现在没有clip功能,暂时取ec高宽。 + prunning( + treeRoot, + // Transform to base element coordinate system. + new BoundingRect(-layoutInfo.x, -layoutInfo.y, ecWidth, ecHeight), + viewAbovePath, + viewRoot, + 0 + ); + }); } - // Package custom mouse event. - function packEventData(el, seriesModel, itemNode) { - el.eventData = { - componentType: 'series', - componentSubType: 'treemap', - seriesIndex: seriesModel.componentIndex, - seriesName: seriesModel.name, - seriesType: 'treemap', - selfType: 'breadcrumb', // Distinguish with click event on treemap node. - nodeData: { - dataIndex: itemNode && itemNode.dataIndex, - name: itemNode && itemNode.name - }, - treePathInfo: itemNode && helper.wrapTreePathInfo(itemNode, seriesModel) - }; - } + /** + * Layout treemap with squarify algorithm. + * @see https://graphics.ethz.ch/teaching/scivis_common/Literature/squarifiedTreeMaps.pdf + * @see https://github.com/mbostock/d3/blob/master/src/layout/treemap.js + * + * @protected + * @param {module:echarts/data/Tree~TreeNode} node + * @param {Object} options + * @param {string} options.sort 'asc' or 'desc' + * @param {number} options.squareRatio + * @param {boolean} hideChildren + * @param {number} depth + */ + function squarify(node, options, hideChildren, depth) { + var width; + var height; - module.exports = Breadcrumb; + if (node.isRemoved()) { + return; + } + var thisLayout = node.getLayout(); + width = thisLayout.width; + height = thisLayout.height; -/***/ }, -/* 192 */ -/***/ function(module, exports, __webpack_require__) { + // Considering border and gap + var itemStyleModel = node.getModel('itemStyle.normal'); + var borderWidth = itemStyleModel.get('borderWidth'); + var halfGapWidth = itemStyleModel.get('gapWidth') / 2; + var layoutOffset = borderWidth - halfGapWidth; + var nodeModel = node.getModel(); + + node.setLayout({borderWidth: borderWidth}, true); - + width = mathMax(width - 2 * layoutOffset, 0); + height = mathMax(height - 2 * layoutOffset, 0); - var zrUtil = __webpack_require__(4); + var totalArea = width * height; + var viewChildren = initChildren( + node, nodeModel, totalArea, options, hideChildren, depth + ); - /** - * @param {number} [time=500] Time in ms - * @param {string} [easing='linear'] - * @param {number} [delay=0] - * @param {Function} [callback] - * - * @example - * // Animate position - * animation - * .createWrap() - * .add(el1, {position: [10, 10]}) - * .add(el2, {shape: {width: 500}, style: {fill: 'red'}}, 400) - * .done(function () { // done }) - * .start('cubicOut'); - */ - function createWrap() { + if (!viewChildren.length) { + return; + } - var storage = []; - var elExistsMap = {}; - var doneCallback; + var rect = {x: layoutOffset, y: layoutOffset, width: width, height: height}; + var rowFixedLength = mathMin(width, height); + var best = Infinity; // the best row score so far + var row = []; + row.area = 0; - return { + for (var i = 0, len = viewChildren.length; i < len;) { + var child = viewChildren[i]; - /** - * Caution: a el can only be added once, otherwise 'done' - * might not be called. This method checks this (by el.id), - * suppresses adding and returns false when existing el found. - * - * @param {modele:zrender/Element} el - * @param {Object} target - * @param {number} [time=500] - * @param {number} [delay=0] - * @param {string} [easing='linear'] - * @return {boolean} Whether adding succeeded. - * - * @example - * add(el, target, time, delay, easing); - * add(el, target, time, easing); - * add(el, target, time); - * add(el, target); - */ - add: function (el, target, time, delay, easing) { - if (zrUtil.isString(delay)) { - easing = delay; - delay = 0; - } + row.push(child); + row.area += child.getLayout().area; + var score = worst(row, rowFixedLength, options.squareRatio); - if (elExistsMap[el.id]) { - return false; - } - elExistsMap[el.id] = 1; + // continue with this orientation + if (score <= best) { + i++; + best = score; + } + // abort, and try a different orientation + else { + row.area -= row.pop().getLayout().area; + position(row, rowFixedLength, rect, halfGapWidth, false); + rowFixedLength = mathMin(rect.width, rect.height); + row.length = row.area = 0; + best = Infinity; + } + } - storage.push( - {el: el, target: target, time: time, delay: delay, easing: easing} - ); + if (row.length) { + position(row, rowFixedLength, rect, halfGapWidth, true); + } - return true; - }, + if (!hideChildren) { + var childrenVisibleMin = nodeModel.get('childrenVisibleMin'); + if (childrenVisibleMin != null && totalArea < childrenVisibleMin) { + hideChildren = true; + } + } - /** - * Only execute when animation finished. Will not execute when any - * of 'stop' or 'stopAnimation' called. - * - * @param {Function} callback - */ - done: function (callback) { - doneCallback = callback; - return this; - }, + for (var i = 0, len = viewChildren.length; i < len; i++) { + squarify(viewChildren[i], options, hideChildren, depth + 1); + } + } - /** - * Will stop exist animation firstly. - */ - start: function () { - var count = storage.length; + /** + * Set area to each child, and calculate data extent for visual coding. + */ + function initChildren(node, nodeModel, totalArea, options, hideChildren, depth) { + var viewChildren = node.children || []; + var orderBy = options.sort; + orderBy !== 'asc' && orderBy !== 'desc' && (orderBy = null); - for (var i = 0, len = storage.length; i < len; i++) { - var item = storage[i]; - item.el.animateTo(item.target, item.time, item.delay, item.easing, done); - } + var overLeafDepth = options.leafDepth != null && options.leafDepth <= depth; - return this; + // leafDepth has higher priority. + if (hideChildren && !overLeafDepth) { + return (node.viewChildren = []); + } - function done() { - count--; - if (!count) { - storage.length = 0; - elExistsMap = {}; - doneCallback && doneCallback(); - } - } - } - }; - } + // Sort children, order by desc. + viewChildren = zrUtil.filter(viewChildren, function (child) { + return !child.isRemoved(); + }); - module.exports = {createWrap: createWrap}; + sort(viewChildren, orderBy); + var info = statistic(nodeModel, viewChildren, orderBy); -/***/ }, -/* 193 */ -/***/ function(module, exports, __webpack_require__) { + if (info.sum === 0) { + return (node.viewChildren = []); + } - /** - * @file Treemap action - */ + info.sum = filterByThreshold(nodeModel, totalArea, info.sum, orderBy, viewChildren); + if (info.sum === 0) { + return (node.viewChildren = []); + } - var echarts = __webpack_require__(1); - var helper = __webpack_require__(189); + // Set area to each child. + for (var i = 0, len = viewChildren.length; i < len; i++) { + var area = viewChildren[i].getValue() / info.sum * totalArea; + // Do not use setLayout({...}, true), because it is needed to clear last layout. + viewChildren[i].setLayout({area: area}); + } - var noop = function () {}; + if (overLeafDepth) { + viewChildren.length && node.setLayout({isLeafRoot: true}, true); + viewChildren.length = 0; + } - var actionTypes = [ - 'treemapZoomToNode', - 'treemapRender', - 'treemapMove' - ]; + node.viewChildren = viewChildren; + node.setLayout({dataExtent: info.dataExtent}, true); - for (var i = 0; i < actionTypes.length; i++) { - echarts.registerAction({type: actionTypes[i], update: 'updateView'}, noop); + return viewChildren; } - echarts.registerAction( - {type: 'treemapRootToNode', update: 'updateView'}, - function (payload, ecModel) { + /** + * Consider 'visibleMin'. Modify viewChildren and get new sum. + */ + function filterByThreshold(nodeModel, totalArea, sum, orderBy, orderedChildren) { - ecModel.eachComponent( - {mainType: 'series', subType: 'treemap', query: payload}, - handleRootToNode - ); + // visibleMin is not supported yet when no option.sort. + if (!orderBy) { + return sum; + } - function handleRootToNode(model, index) { - var targetInfo = helper.retrieveTargetInfo(payload, model); + var visibleMin = nodeModel.get('visibleMin'); + var len = orderedChildren.length; + var deletePoint = len; - if (targetInfo) { - var originViewRoot = model.getViewRoot(); - if (originViewRoot) { - payload.direction = helper.aboveViewRoot(originViewRoot, targetInfo.node) - ? 'rollUp' : 'drillDown'; - } - model.resetViewRoot(targetInfo.node); - } + // Always travel from little value to big value. + for (var i = len - 1; i >= 0; i--) { + var value = orderedChildren[ + orderBy === 'asc' ? len - i - 1 : i + ].getValue(); + + if (value / sum * totalArea < visibleMin) { + deletePoint = i; + sum -= value; } } - ); + orderBy === 'asc' + ? orderedChildren.splice(0, len - deletePoint) + : orderedChildren.splice(deletePoint, len - deletePoint); + return sum; + } -/***/ }, -/* 194 */ -/***/ function(module, exports, __webpack_require__) { + /** + * Sort + */ + function sort(viewChildren, orderBy) { + if (orderBy) { + viewChildren.sort(function (a, b) { + return orderBy === 'asc' + ? a.getValue() - b.getValue() : b.getValue() - a.getValue(); + }); + } + return viewChildren; + } - + /** + * Statistic + */ + function statistic(nodeModel, children, orderBy) { + // Calculate sum. + var sum = 0; + for (var i = 0, len = children.length; i < len; i++) { + sum += children[i].getValue(); + } - var VisualMapping = __webpack_require__(195); - var zrColor = __webpack_require__(39); - var zrUtil = __webpack_require__(4); - var isArray = zrUtil.isArray; + // Statistic data extent for latter visual coding. + // Notice: data extent should be calculate based on raw children + // but not filtered view children, otherwise visual mapping will not + // be stable when zoom (where children is filtered by visibleMin). - var ITEM_STYLE_NORMAL = 'itemStyle.normal'; + var dimension = nodeModel.get('visualDimension'); + var dataExtent; - module.exports = function (ecModel, api, payload) { + // The same as area dimension. + if (!children || !children.length) { + dataExtent = [NaN, NaN]; + } + else if (dimension === 'value' && orderBy) { + dataExtent = [ + children[children.length - 1].getValue(), + children[0].getValue() + ]; + orderBy === 'asc' && dataExtent.reverse(); + } + // Other dimension. + else { + var dataExtent = [Infinity, -Infinity]; + each(children, function (child) { + var value = child.getValue(dimension); + value < dataExtent[0] && (dataExtent[0] = value); + value > dataExtent[1] && (dataExtent[1] = value); + }); + } - var condition = {mainType: 'series', subType: 'treemap', query: payload}; - ecModel.eachComponent(condition, function (seriesModel) { + return {sum: sum, dataExtent: dataExtent}; + } - var tree = seriesModel.getData().tree; - var root = tree.root; - var seriesItemStyleModel = seriesModel.getModel(ITEM_STYLE_NORMAL); + /** + * Computes the score for the specified row, + * as the worst aspect ratio. + */ + function worst(row, rowFixedLength, ratio) { + var areaMax = 0; + var areaMin = Infinity; - if (root.isRemoved()) { - return; + for (var i = 0, area, len = row.length; i < len; i++) { + area = row[i].getLayout().area; + if (area) { + area < areaMin && (areaMin = area); + area > areaMax && (areaMax = area); } + } - var levelItemStyles = zrUtil.map(tree.levelModels, function (levelModel) { - return levelModel ? levelModel.get(ITEM_STYLE_NORMAL) : null; - }); + var squareArea = row.area * row.area; + var f = rowFixedLength * rowFixedLength * ratio; - travelTree( - root, // Visual should calculate from tree root but not view root. - {}, - levelItemStyles, - seriesItemStyleModel, - seriesModel.getViewRoot().getAncestors(), - seriesModel - ); - }); - }; + return squareArea + ? mathMax( + (f * areaMax) / squareArea, + squareArea / (f * areaMin) + ) + : Infinity; + } - function travelTree( - node, designatedVisual, levelItemStyles, seriesItemStyleModel, - viewRootAncestors, seriesModel - ) { - var nodeModel = node.getModel(); - var nodeLayout = node.getLayout(); + /** + * Positions the specified row of nodes. Modifies `rect`. + */ + function position(row, rowFixedLength, rect, halfGapWidth, flush) { + // When rowFixedLength === rect.width, + // it is horizontal subdivision, + // rowFixedLength is the width of the subdivision, + // rowOtherLength is the height of the subdivision, + // and nodes will be positioned from left to right. - // Optimize - if (!nodeLayout || nodeLayout.invisible || !nodeLayout.isInView) { - return; - } + // wh[idx0WhenH] means: when horizontal, + // wh[idx0WhenH] => wh[0] => 'width'. + // xy[idx1WhenH] => xy[1] => 'y'. + var idx0WhenH = rowFixedLength === rect.width ? 0 : 1; + var idx1WhenH = 1 - idx0WhenH; + var xy = ['x', 'y']; + var wh = ['width', 'height']; - var nodeItemStyleModel = node.getModel(ITEM_STYLE_NORMAL); - var levelItemStyle = levelItemStyles[node.depth]; - var visuals = buildVisuals( - nodeItemStyleModel, designatedVisual, levelItemStyle, seriesItemStyleModel - ); + var last = rect[xy[idx0WhenH]]; + var rowOtherLength = rowFixedLength + ? row.area / rowFixedLength : 0; - // calculate border color - var borderColor = nodeItemStyleModel.get('borderColor'); - var borderColorSaturation = nodeItemStyleModel.get('borderColorSaturation'); - var thisNodeColor; - if (borderColorSaturation != null) { - // For performance, do not always execute 'calculateColor'. - thisNodeColor = calculateColor(visuals, node); - borderColor = calculateBorderColor(borderColorSaturation, thisNodeColor); + if (flush || rowOtherLength > rect[wh[idx1WhenH]]) { + rowOtherLength = rect[wh[idx1WhenH]]; // over+underflow } - node.setVisual('borderColor', borderColor); + for (var i = 0, rowLen = row.length; i < rowLen; i++) { + var node = row[i]; + var nodeLayout = {}; + var step = rowOtherLength + ? node.getLayout().area / rowOtherLength : 0; - var viewChildren = node.viewChildren; - if (!viewChildren || !viewChildren.length) { - thisNodeColor = calculateColor(visuals, node); - // Apply visual to this node. - node.setVisual('color', thisNodeColor); - } - else { - var mapping = buildVisualMapping( - node, nodeModel, nodeLayout, nodeItemStyleModel, visuals, viewChildren - ); + var wh1 = nodeLayout[wh[idx1WhenH]] = mathMax(rowOtherLength - 2 * halfGapWidth, 0); - // Designate visual to children. - zrUtil.each(viewChildren, function (child, index) { - // If higher than viewRoot, only ancestors of viewRoot is needed to visit. - if (child.depth >= viewRootAncestors.length - || child === viewRootAncestors[child.depth] - ) { - var childVisual = mapVisual( - nodeModel, visuals, child, index, mapping, seriesModel - ); - travelTree( - child, childVisual, levelItemStyles, seriesItemStyleModel, - viewRootAncestors, seriesModel - ); - } - }); + // We use Math.max/min to avoid negative width/height when considering gap width. + var remain = rect[xy[idx0WhenH]] + rect[wh[idx0WhenH]] - last; + var modWH = (i === rowLen - 1 || remain < step) ? remain : step; + var wh0 = nodeLayout[wh[idx0WhenH]] = mathMax(modWH - 2 * halfGapWidth, 0); + + nodeLayout[xy[idx1WhenH]] = rect[xy[idx1WhenH]] + mathMin(halfGapWidth, wh1 / 2); + nodeLayout[xy[idx0WhenH]] = last + mathMin(halfGapWidth, wh0 / 2); + + last += modWH; + node.setLayout(nodeLayout, true); } - } - function buildVisuals( - nodeItemStyleModel, designatedVisual, levelItemStyle, seriesItemStyleModel - ) { - var visuals = zrUtil.extend({}, designatedVisual); + rect[xy[idx1WhenH]] += rowOtherLength; + rect[wh[idx1WhenH]] -= rowOtherLength; + } - zrUtil.each(['color', 'colorAlpha', 'colorSaturation'], function (visualName) { - // Priority: thisNode > thisLevel > parentNodeDesignated > seriesModel - var val = nodeItemStyleModel.get(visualName, true); // Ignore parent - val == null && levelItemStyle && (val = levelItemStyle[visualName]); - val == null && (val = designatedVisual[visualName]); - val == null && (val = seriesItemStyleModel.get(visualName)); + // Return [containerWidth, containerHeight] as defualt. + function estimateRootSize(seriesModel, targetInfo, viewRoot, containerWidth, containerHeight) { + // If targetInfo.node exists, we zoom to the node, + // so estimate whold width and heigth by target node. + var currNode = (targetInfo || {}).node; + var defaultSize = [containerWidth, containerHeight]; - val != null && (visuals[visualName] = val); - }); + if (!currNode || currNode === viewRoot) { + return defaultSize; + } - return visuals; - } + var parent; + var viewArea = containerWidth * containerHeight; + var area = viewArea * seriesModel.option.zoomToNodeRatio; - function calculateColor(visuals) { - var color = getValueVisualDefine(visuals, 'color'); + while (parent = currNode.parentNode) { // jshint ignore:line + var sum = 0; + var siblings = parent.children; - if (color) { - var colorAlpha = getValueVisualDefine(visuals, 'colorAlpha'); - var colorSaturation = getValueVisualDefine(visuals, 'colorSaturation'); - if (colorSaturation) { - color = zrColor.modifyHSL(color, null, null, colorSaturation); + for (var i = 0, len = siblings.length; i < len; i++) { + sum += siblings[i].getValue(); } - if (colorAlpha) { - color = zrColor.modifyAlpha(color, colorAlpha); + var currNodeValue = currNode.getValue(); + if (currNodeValue === 0) { + return defaultSize; } + area *= sum / currNodeValue; - return color; - } - } + var borderWidth = parent.getModel('itemStyle.normal').get('borderWidth'); - function calculateBorderColor(borderColorSaturation, thisNodeColor) { - return thisNodeColor != null - ? zrColor.modifyHSL(thisNodeColor, null, null, borderColorSaturation) - : null; - } + if (isFinite(borderWidth)) { + // Considering border, suppose aspect ratio is 1. + area += 4 * borderWidth * borderWidth + 4 * borderWidth * Math.pow(area, 0.5); + } - function getValueVisualDefine(visuals, name) { - var value = visuals[name]; - if (value != null && value !== 'none') { - return value; + area > numberUtil.MAX_SAFE_INTEGER && (area = numberUtil.MAX_SAFE_INTEGER); + + currNode = parent; } + + area < viewArea && (area = viewArea); + var scale = Math.pow(area / viewArea, 0.5); + + return [containerWidth * scale, containerHeight * scale]; } - function buildVisualMapping( - node, nodeModel, nodeLayout, nodeItemStyleModel, visuals, viewChildren - ) { - if (!viewChildren || !viewChildren.length) { - return; + // Root postion base on coord of containerGroup + function calculateRootPosition(layoutInfo, rootRect, targetInfo) { + if (rootRect) { + return {x: rootRect.x, y: rootRect.y}; } - var rangeVisual = getRangeVisual(nodeModel, 'color') - || ( - visuals.color != null - && visuals.color !== 'none' - && ( - getRangeVisual(nodeModel, 'colorAlpha') - || getRangeVisual(nodeModel, 'colorSaturation') - ) - ); - - if (!rangeVisual) { - return; + var defaultPosition = {x: 0, y: 0}; + if (!targetInfo) { + return defaultPosition; } - var visualMin = nodeModel.get('visualMin'); - var visualMax = nodeModel.get('visualMax'); - var dataExtent = nodeLayout.dataExtent.slice(); - visualMin != null && visualMin < dataExtent[0] && (dataExtent[0] = visualMin); - visualMax != null && visualMax > dataExtent[1] && (dataExtent[1] = visualMax); + // If targetInfo is fetched by 'retrieveTargetInfo', + // old tree and new tree are the same tree, + // so the node still exists and we can visit it. - var colorMappingBy = nodeModel.get('colorMappingBy'); - var opt = { - type: rangeVisual.name, - dataExtent: dataExtent, - visual: rangeVisual.range - }; - if (opt.type === 'color' - && (colorMappingBy === 'index' || colorMappingBy === 'id') - ) { - opt.mappingMethod = 'category'; - opt.loop = true; - // categories is ordinal, so do not set opt.categories. - } - else { - opt.mappingMethod = 'linear'; + var targetNode = targetInfo.node; + var layout = targetNode.getLayout(); + + if (!layout) { + return defaultPosition; } - var mapping = new VisualMapping(opt); - mapping.__drColorMappingBy = colorMappingBy; + // Transform coord from local to container. + var targetCenter = [layout.width / 2, layout.height / 2]; + var node = targetNode; + while (node) { + var nodeLayout = node.getLayout(); + targetCenter[0] += nodeLayout.x; + targetCenter[1] += nodeLayout.y; + node = node.parentNode; + } - return mapping; + return { + x: layoutInfo.width / 2 - targetCenter[0], + y: layoutInfo.height / 2 - targetCenter[1] + }; } - // Notice: If we dont have the attribute 'colorRange', but only use - // attribute 'color' to represent both concepts of 'colorRange' and 'color', - // (It means 'colorRange' when 'color' is Array, means 'color' when not array), - // this problem will be encountered: - // If a level-1 node dont have children, and its siblings has children, - // and colorRange is set on level-1, then the node can not be colored. - // So we separate 'colorRange' and 'color' to different attributes. - function getRangeVisual(nodeModel, name) { - // 'colorRange', 'colorARange', 'colorSRange'. - // If not exsits on this node, fetch from levels and series. - var range = nodeModel.get(name); - return (isArray(range) && range.length) ? {name: name, range: range} : null; - } + // Mark nodes visible for prunning when visual coding and rendering. + // Prunning depends on layout and root position, so we have to do it after layout. + function prunning(node, clipRect, viewAbovePath, viewRoot, depth) { + var nodeLayout = node.getLayout(); + var nodeInViewAbovePath = viewAbovePath[depth]; + var isAboveViewRoot = nodeInViewAbovePath && nodeInViewAbovePath === node; - function mapVisual(nodeModel, visuals, child, index, mapping, seriesModel) { - var childVisuals = zrUtil.extend({}, visuals); + if ( + (nodeInViewAbovePath && !isAboveViewRoot) + || (depth === viewAbovePath.length && node !== viewRoot) + ) { + return; + } - if (mapping) { - var mappingType = mapping.type; - var colorMappingBy = mappingType === 'color' && mapping.__drColorMappingBy; - var value = - colorMappingBy === 'index' - ? index - : colorMappingBy === 'id' - ? seriesModel.mapIdToIndex(child.getId()) - : child.getValue(nodeModel.get('visualDimension')); + node.setLayout({ + // isInView means: viewRoot sub tree + viewAbovePath + isInView: true, + // invisible only means: outside view clip so that the node can not + // see but still layout for animation preparation but not render. + invisible: !isAboveViewRoot && !clipRect.intersect(nodeLayout), + isAboveViewRoot: isAboveViewRoot + }, true); - childVisuals[mappingType] = mapping.mapValueToVisual(value); - } + // Transform to child coordinate. + var childClipRect = new BoundingRect( + clipRect.x - nodeLayout.x, + clipRect.y - nodeLayout.y, + clipRect.width, + clipRect.height + ); - return childVisuals; + each(node.viewChildren || [], function (child) { + prunning(child, childClipRect, viewAbovePath, viewRoot, depth + 1); + }); } + module.exports = update; /***/ }, -/* 195 */ +/* 211 */ /***/ function(module, exports, __webpack_require__) { - /** - * @file Visual mapping. - */ - + + var echarts = __webpack_require__(1); var zrUtil = __webpack_require__(4); - var zrColor = __webpack_require__(39); - var linearMap = __webpack_require__(7).linearMap; - var each = zrUtil.each; - var isObject = zrUtil.isObject; - - var CATEGORY_DEFAULT_VISUAL_INDEX = -1; - - /** - * @param {Object} option - * @param {string} [option.type] See visualHandlers. - * @param {string} [option.mappingMethod] 'linear' or 'piecewise' or 'category' or 'fixed' - * @param {Array.=} [option.dataExtent] [minExtent, maxExtent], - * required when mappingMethod is 'linear' - * @param {Array.=} [option.pieceList] [ - * {value: someValue}, - * {interval: [min1, max1], visual: {...}}, - * {interval: [min2, max2]} - * ], - * required when mappingMethod is 'piecewise'. - * Visual for only each piece can be specified. - * @param {Array.=} [option.categories] ['cate1', 'cate2'] - * required when mappingMethod is 'category'. - * If no option.categories, categories is set - * as [0, 1, 2, ...]. - * @param {boolean} [option.loop=false] Whether loop mapping when mappingMethod is 'category'. - * @param {(Array|Object|*)} [option.visual] Visual data. - * when mappingMethod is 'category', - * visual data can be array or object - * (like: {cate1: '#222', none: '#fff'}) - * or primary types (which represents - * defualt category visual), otherwise visual - * can be array or primary (which will be - * normalized to array). - * - */ - var VisualMapping = function (option) { - var mappingMethod = option.mappingMethod; - var visualType = option.type; - - /** - * @readOnly - * @type {Object} - */ - var thisOption = this.option = zrUtil.clone(option); - /** - * @readOnly - * @type {string} - */ - this.type = visualType; + __webpack_require__(212); + __webpack_require__(215); - /** - * @readOnly - * @type {string} - */ - this.mappingMethod = mappingMethod; + __webpack_require__(220); - /** - * @private - * @type {Function} - */ - this._normalizeData = normalizers[mappingMethod]; + echarts.registerProcessor(__webpack_require__(221)); - var visualHandler = visualHandlers[visualType]; + echarts.registerVisual(zrUtil.curry( + __webpack_require__(119), 'graph', 'circle', null + )); + echarts.registerVisual(__webpack_require__(222)); + echarts.registerVisual(__webpack_require__(223)); - /** - * @public - * @type {Function} - */ - this.applyVisual = visualHandler.applyVisual; + echarts.registerLayout(__webpack_require__(224)); + echarts.registerLayout(__webpack_require__(227)); + echarts.registerLayout(__webpack_require__(229)); - /** - * @public - * @type {Function} - */ - this.getColorMapper = visualHandler.getColorMapper; + // Graph view coordinate system + echarts.registerCoordinateSystem('graphView', { + create: __webpack_require__(231) + }); - /** - * @private - * @type {Function} - */ - this._doMap = visualHandler._doMap[mappingMethod]; - if (mappingMethod === 'piecewise') { - normalizeVisualRange(thisOption); - preprocessForPiecewise(thisOption); - } - else if (mappingMethod === 'category') { - thisOption.categories - ? preprocessForSpecifiedCategory(thisOption) - // categories is ordinal when thisOption.categories not specified, - // which need no more preprocess except normalize visual. - : normalizeVisualRange(thisOption, true); - } - else { // mappingMethod === 'linear' or 'fixed' - zrUtil.assert(mappingMethod !== 'linear' || thisOption.dataExtent); - normalizeVisualRange(thisOption); - } - }; +/***/ }, +/* 212 */ +/***/ function(module, exports, __webpack_require__) { - VisualMapping.prototype = { + 'use strict'; - constructor: VisualMapping, - mapValueToVisual: function (value) { - var normalized = this._normalizeData(value); - return this._doMap(normalized, value); - }, + var List = __webpack_require__(98); + var zrUtil = __webpack_require__(4); + var modelUtil = __webpack_require__(5); + var Model = __webpack_require__(12); + var formatUtil = __webpack_require__(6); - getNormalizer: function () { - return zrUtil.bind(this._normalizeData, this); - } - }; + var createGraphFromNodeEdge = __webpack_require__(213); - var visualHandlers = VisualMapping.visualHandlers = { + var GraphSeries = __webpack_require__(1).extendSeriesModel({ - color: { + type: 'series.graph', - applyVisual: makeApplyVisual('color'), + init: function (option) { + GraphSeries.superApply(this, 'init', arguments); - /** - * Create a mapper function - * @return {Function} - */ - getColorMapper: function () { - var thisOption = this.option; - var parsedVisual = zrUtil.map(thisOption.visual, zrColor.parse); + // Provide data for legend select + this.legendDataProvider = function () { + return this._categoriesData; + }; - return zrUtil.bind( - thisOption.mappingMethod === 'category' - ? function (value, isNormalized) { - !isNormalized && (value = this._normalizeData(value)); - return doMapCategory.call(this, value); - } - : function (value, isNormalized, out) { - // If output rgb array - // which will be much faster and useful in pixel manipulation - var returnRGBArray = !!out; - !isNormalized && (value = this._normalizeData(value)); - out = zrColor.fastMapToColor(value, parsedVisual, out); - return returnRGBArray ? out : zrUtil.stringify(out, 'rgba'); - }, - this - ); - }, + this.fillDataTextStyle(option.edges || option.links); - _doMap: { - linear: function (normalized) { - return zrColor.mapToColor(normalized, this.option.visual); - }, - category: doMapCategory, - piecewise: function (normalized, value) { - var result = getSpecifiedVisual.call(this, value); - if (result == null) { - result = zrColor.mapToColor(normalized, this.option.visual); - } - return result; - }, - fixed: doMapFixed - } + this._updateCategoriesData(); }, - colorHue: makePartialColorVisualHandler(function (color, value) { - return zrColor.modifyHSL(color, value); - }), - - colorSaturation: makePartialColorVisualHandler(function (color, value) { - return zrColor.modifyHSL(color, null, value); - }), - - colorLightness: makePartialColorVisualHandler(function (color, value) { - return zrColor.modifyHSL(color, null, null, value); - }), + mergeOption: function (option) { + GraphSeries.superApply(this, 'mergeOption', arguments); - colorAlpha: makePartialColorVisualHandler(function (color, value) { - return zrColor.modifyAlpha(color, value); - }), + this.fillDataTextStyle(option.edges || option.links); - opacity: { - applyVisual: makeApplyVisual('opacity'), - _doMap: makeDoMap([0, 1]) + this._updateCategoriesData(); }, - symbol: { - applyVisual: function (value, getter, setter) { - var symbolCfg = this.mapValueToVisual(value); - if (zrUtil.isString(symbolCfg)) { - setter('symbol', symbolCfg); - } - else if (isObject(symbolCfg)) { - for (var name in symbolCfg) { - if (symbolCfg.hasOwnProperty(name)) { - setter(name, symbolCfg[name]); - } - } - } - }, - _doMap: { - linear: doMapToArray, - category: doMapCategory, - piecewise: function (normalized, value) { - var result = getSpecifiedVisual.call(this, value); - if (result == null) { - result = doMapToArray.call(this, normalized); - } - return result; - }, - fixed: doMapFixed - } + mergeDefaultAndTheme: function (option) { + GraphSeries.superApply(this, 'mergeDefaultAndTheme', arguments); + modelUtil.defaultEmphasis(option.edgeLabel, modelUtil.LABEL_OPTIONS); }, - symbolSize: { - applyVisual: makeApplyVisual('symbolSize'), - _doMap: makeDoMap([0, 1]) - } - }; - - - function preprocessForPiecewise(thisOption) { - var pieceList = thisOption.pieceList; - thisOption.hasSpecialVisual = false; + getInitialData: function (option, ecModel) { + var edges = option.edges || option.links || []; + var nodes = option.data || option.nodes || []; + var self = this; - zrUtil.each(pieceList, function (piece, index) { - piece.originIndex = index; - // piece.visual is "result visual value" but not - // a visual range, so it does not need to be normalized. - if (piece.visual != null) { - thisOption.hasSpecialVisual = true; + if (nodes && edges) { + return createGraphFromNodeEdge(nodes, edges, this, true, beforeLink).data; } - }); - } - - function preprocessForSpecifiedCategory(thisOption) { - // Hash categories. - var categories = thisOption.categories; - var visual = thisOption.visual; - var categoryMap = thisOption.categoryMap = {}; - each(categories, function (cate, index) { - categoryMap[cate] = index; - }); + function beforeLink(nodeData, edgeData) { + // Overwrite nodeData.getItemModel to + nodeData.wrapMethod('getItemModel', function (model) { + var categoriesModels = self._categoriesModels; + var categoryIdx = model.getShallow('category'); + var categoryModel = categoriesModels[categoryIdx]; + if (categoryModel) { + categoryModel.parentModel = model.parentModel; + model.parentModel = categoryModel; + } + return model; + }); - // Process visual map input. - if (!zrUtil.isArray(visual)) { - var visualArr = []; + var edgeLabelModel = self.getModel('edgeLabel'); + // For option `edgeLabel` can be found by label.xxx.xxx on item mode. + var fakeSeriesModel = new Model( + {label: edgeLabelModel.option}, + edgeLabelModel.parentModel, + ecModel + ); - if (zrUtil.isObject(visual)) { - each(visual, function (v, cate) { - var index = categoryMap[cate]; - visualArr[index != null ? index : CATEGORY_DEFAULT_VISUAL_INDEX] = v; + edgeData.wrapMethod('getItemModel', function (model) { + model.customizeGetParent(edgeGetParent); + return model; }); - } - else { // Is primary type, represents default visual. - visualArr[CATEGORY_DEFAULT_VISUAL_INDEX] = visual; - } - visual = thisOption.visual = visualArr; - } - - // Remove categories that has no visual, - // then we can mapping them to CATEGORY_DEFAULT_VISUAL_INDEX. - for (var i = categories.length - 1; i >= 0; i--) { - if (visual[i] == null) { - delete categoryMap[categories[i]]; - categories.pop(); + function edgeGetParent(path) { + path = this.parsePath(path); + return (path && path[0] === 'label') + ? fakeSeriesModel + : this.parentModel; + } } - } - } - - function normalizeVisualRange(thisOption, isCategory) { - var visual = thisOption.visual; - var visualArr = []; - - if (zrUtil.isObject(visual)) { - each(visual, function (v) { - visualArr.push(v); - }); - } - else if (visual != null) { - visualArr.push(visual); - } - - var doNotNeedPair = {color: 1, symbol: 1}; - - if (!isCategory - && visualArr.length === 1 - && !doNotNeedPair.hasOwnProperty(thisOption.type) - ) { - // Do not care visualArr.length === 0, which is illegal. - visualArr[1] = visualArr[0]; - } - - thisOption.visual = visualArr; - } - - function makePartialColorVisualHandler(applyValue) { - return { - applyVisual: function (value, getter, setter) { - value = this.mapValueToVisual(value); - // Must not be array value - setter('color', applyValue(getter('color'), value)); - }, - _doMap: makeDoMap([0, 1]) - }; - } + }, - function doMapToArray(normalized) { - var visual = this.option.visual; - return visual[ - Math.round(linearMap(normalized, [0, 1], [0, visual.length - 1], true)) - ] || {}; - } + /** + * @return {module:echarts/data/Graph} + */ + getGraph: function () { + return this.getData().graph; + }, - function makeApplyVisual(visualType) { - return function (value, getter, setter) { - setter(visualType, this.mapValueToVisual(value)); - }; - } + /** + * @return {module:echarts/data/List} + */ + getEdgeData: function () { + return this.getGraph().edgeData; + }, - function doMapCategory(normalized) { - var visual = this.option.visual; - return visual[ - (this.option.loop && normalized !== CATEGORY_DEFAULT_VISUAL_INDEX) - ? normalized % visual.length - : normalized - ]; - } + /** + * @return {module:echarts/data/List} + */ + getCategoriesData: function () { + return this._categoriesData; + }, - function doMapFixed() { - return this.option.visual[0]; - } + /** + * @override + */ + formatTooltip: function (dataIndex, multipleSeries, dataType) { + if (dataType === 'edge') { + var nodeData = this.getData(); + var params = this.getDataParams(dataIndex, dataType); + var edge = nodeData.graph.getEdgeByIndex(dataIndex); + var sourceName = nodeData.getName(edge.node1.dataIndex); + var targetName = nodeData.getName(edge.node2.dataIndex); - function makeDoMap(sourceExtent) { - return { - linear: function (normalized) { - return linearMap(normalized, sourceExtent, this.option.visual, true); - }, - category: doMapCategory, - piecewise: function (normalized, value) { - var result = getSpecifiedVisual.call(this, value); - if (result == null) { - result = linearMap(normalized, sourceExtent, this.option.visual, true); - } - return result; - }, - fixed: doMapFixed - }; - } + var html = []; + sourceName != null && html.push(sourceName); + targetName != null && html.push(targetName); + html = formatUtil.encodeHTML(html.join(' > ')); - function getSpecifiedVisual(value) { - var thisOption = this.option; - var pieceList = thisOption.pieceList; - if (thisOption.hasSpecialVisual) { - var pieceIndex = VisualMapping.findPieceIndex(value, pieceList); - var piece = pieceList[pieceIndex]; - if (piece && piece.visual) { - return piece.visual[this.type]; + if (params.value) { + html += ' : ' + formatUtil.encodeHTML(params.value); + } + return html; } - } - } + else { // dataType === 'node' or empty + return GraphSeries.superApply(this, 'formatTooltip', arguments); + } + }, + _updateCategoriesData: function () { + var categories = zrUtil.map(this.option.categories || [], function (category) { + // Data must has value + return category.value != null ? category : zrUtil.extend({ + value: 0 + }, category); + }); + var categoriesData = new List(['value'], this); + categoriesData.initData(categories); - /** - * Normalizers by mapping methods. - */ - var normalizers = { + this._categoriesData = categoriesData; - linear: function (value) { - return linearMap(value, this.option.dataExtent, [0, 1], true); + this._categoriesModels = categoriesData.mapArray(function (idx) { + return categoriesData.getItemModel(idx, true); + }); }, - piecewise: function (value) { - var pieceList = this.option.pieceList; - var pieceIndex = VisualMapping.findPieceIndex(value, pieceList, true); - if (pieceIndex != null) { - return linearMap(pieceIndex, [0, pieceList.length - 1], [0, 1], true); - } + setZoom: function (zoom) { + this.option.zoom = zoom; }, - category: function (value) { - var index = this.option.categories - ? this.option.categoryMap[value] - : value; // ordinal - return index == null ? CATEGORY_DEFAULT_VISUAL_INDEX : index; + setCenter: function (center) { + this.option.center = center; }, - fixed: zrUtil.noop - }; + isAnimationEnabled: function () { + return GraphSeries.superCall(this, 'isAnimationEnabled') + // Not enable animation when do force layout + && !(this.get('layout') === 'force' && this.get('force.layoutAnimation')); + }, + defaultOption: { + zlevel: 0, + z: 2, + coordinateSystem: 'view', - /** - * List available visual types. - * - * @public - * @return {Array.} - */ - VisualMapping.listVisualTypes = function () { - var visualTypes = []; - zrUtil.each(visualHandlers, function (handler, key) { - visualTypes.push(key); - }); - return visualTypes; - }; + // Default option for all coordinate systems + // xAxisIndex: 0, + // yAxisIndex: 0, + // polarIndex: 0, + // geoIndex: 0, - /** - * @public - */ - VisualMapping.addVisualHandler = function (name, handler) { - visualHandlers[name] = handler; - }; + legendHoverLink: true, - /** - * @public - */ - VisualMapping.isValidType = function (visualType) { - return visualHandlers.hasOwnProperty(visualType); - }; + hoverAnimation: true, - /** - * Convinent method. - * Visual can be Object or Array or primary type. - * - * @public - */ - VisualMapping.eachVisual = function (visual, callback, context) { - if (zrUtil.isObject(visual)) { - zrUtil.each(visual, callback, context); - } - else { - callback.call(context, visual); - } - }; + layout: null, - VisualMapping.mapVisual = function (visual, callback, context) { - var isPrimary; - var newVisual = zrUtil.isArray(visual) - ? [] - : zrUtil.isObject(visual) - ? {} - : (isPrimary = true, null); + focusNodeAdjacency: false, - VisualMapping.eachVisual(visual, function (v, key) { - var newVal = callback.call(context, v, key); - isPrimary ? (newVisual = newVal) : (newVisual[key] = newVal); - }); - return newVisual; - }; + // Configuration of circular layout + circular: { + rotateLabel: false + }, + // Configuration of force directed layout + force: { + initLayout: null, + // Node repulsion. Can be an array to represent range. + repulsion: [0, 50], + gravity: 0.1, - /** - * @public - * @param {Object} obj - * @return {Oject} new object containers visual values. - * If no visuals, return null. - */ - VisualMapping.retrieveVisuals = function (obj) { - var ret = {}; - var hasVisual; + // Edge length. Can be an array to represent range. + edgeLength: 30, - obj && each(visualHandlers, function (h, visualType) { - if (obj.hasOwnProperty(visualType)) { - ret[visualType] = obj[visualType]; - hasVisual = true; - } - }); + layoutAnimation: true + }, - return hasVisual ? ret : null; - }; + left: 'center', + top: 'center', + // right: null, + // bottom: null, + // width: '80%', + // height: '80%', - /** - * Give order to visual types, considering colorSaturation, colorAlpha depends on color. - * - * @public - * @param {(Object|Array)} visualTypes If Object, like: {color: ..., colorSaturation: ...} - * IF Array, like: ['color', 'symbol', 'colorSaturation'] - * @return {Array.} Sorted visual types. - */ - VisualMapping.prepareVisualTypes = function (visualTypes) { - if (isObject(visualTypes)) { - var types = []; - each(visualTypes, function (item, type) { - types.push(type); - }); - visualTypes = types; - } - else if (zrUtil.isArray(visualTypes)) { - visualTypes = visualTypes.slice(); - } - else { - return []; - } + symbol: 'circle', + symbolSize: 10, - visualTypes.sort(function (type1, type2) { - // color should be front of colorSaturation, colorAlpha, ... - // symbol and symbolSize do not matter. - return (type2 === 'color' && type1 !== 'color' && type1.indexOf('color') === 0) - ? 1 : -1; - }); + edgeSymbol: ['none', 'none'], + edgeSymbolSize: 10, + edgeLabel: { + normal: { + position: 'middle' + }, + emphasis: {} + }, - return visualTypes; - }; + draggable: false, - /** - * 'color', 'colorSaturation', 'colorAlpha', ... are depends on 'color'. - * Other visuals are only depends on themself. - * - * @public - * @param {string} visualType1 - * @param {string} visualType2 - * @return {boolean} - */ - VisualMapping.dependsOn = function (visualType1, visualType2) { - return visualType2 === 'color' - ? !!(visualType1 && visualType1.indexOf(visualType2) === 0) - : visualType1 === visualType2; - }; + roam: false, - /** - * @param {number} value - * @param {Array.} pieceList [{value: ..., interval: [min, max]}, ...] - * Always from small to big. - * @param {boolean} [findClosestWhenOutside=false] - * @return {number} index - */ - VisualMapping.findPieceIndex = function (value, pieceList, findClosestWhenOutside) { - var possibleI; - var abs = Infinity; + // Default on center of graph + center: null, - // value has the higher priority. - for (var i = 0, len = pieceList.length; i < len; i++) { - var pieceValue = pieceList[i].value; - if (pieceValue != null) { - if (pieceValue === value) { - return i; - } - findClosestWhenOutside && updatePossible(pieceValue, i); - } - } + zoom: 1, + // Symbol size scale ratio in roam + nodeScaleRatio: 0.6, - for (var i = 0, len = pieceList.length; i < len; i++) { - var piece = pieceList[i]; - var interval = piece.interval; - var close = piece.close; + // categories: [], - if (interval) { - if (interval[0] === -Infinity) { - if (littleThan(close[1], value, interval[1])) { - return i; - } - } - else if (interval[1] === Infinity) { - if (littleThan(close[0], interval[0], value)) { - return i; - } - } - else if ( - littleThan(close[0], interval[0], value) - && littleThan(close[1], value, interval[1]) - ) { - return i; + // data: [] + // Or + // nodes: [] + // + // links: [] + // Or + // edges: [] + + label: { + normal: { + show: false, + formatter: '{b}' + }, + emphasis: { + show: true } - findClosestWhenOutside && updatePossible(interval[0], i); - findClosestWhenOutside && updatePossible(interval[1], i); - } - } + }, - if (findClosestWhenOutside) { - return value === Infinity - ? pieceList.length - 1 - : value === -Infinity - ? 0 - : possibleI; - } + itemStyle: { + normal: {}, + emphasis: {} + }, - function updatePossible(val, index) { - var newAbs = Math.abs(val - value); - if (newAbs < abs) { - abs = newAbs; - possibleI = index; + lineStyle: { + normal: { + color: '#aaa', + width: 1, + curveness: 0, + opacity: 0.5 + }, + emphasis: {} } } + }); - }; - - function littleThan(close, a, b) { - return close ? a <= b : a < b; - } - - module.exports = VisualMapping; - + module.exports = GraphSeries; /***/ }, -/* 196 */ +/* 213 */ /***/ function(module, exports, __webpack_require__) { + var List = __webpack_require__(98); + var Graph = __webpack_require__(214); + var linkList = __webpack_require__(202); + var completeDimensions = __webpack_require__(103); + var CoordinateSystem = __webpack_require__(26); var zrUtil = __webpack_require__(4); - var numberUtil = __webpack_require__(7); - var layout = __webpack_require__(21); - var helper = __webpack_require__(189); - var BoundingRect = __webpack_require__(9); - var helper = __webpack_require__(189); - - var mathMax = Math.max; - var mathMin = Math.min; - var parsePercent = numberUtil.parsePercent; - var retrieveValue = zrUtil.retrieve; - var each = zrUtil.each; - - /** - * @public - */ - function update(ecModel, api, payload) { - // Layout result in each node: - // {x, y, width, height, area, borderWidth} - var condition = {mainType: 'series', subType: 'treemap', query: payload}; - ecModel.eachComponent(condition, function (seriesModel) { - - var ecWidth = api.getWidth(); - var ecHeight = api.getHeight(); - var seriesOption = seriesModel.option; - - var layoutInfo = layout.getLayoutRect( - seriesModel.getBoxLayoutParams(), - { - width: api.getWidth(), - height: api.getHeight() - } - ); - - var size = seriesOption.size || []; // Compatible with ec2. - var containerWidth = parsePercent( - retrieveValue(layoutInfo.width, size[0]), - ecWidth - ); - var containerHeight = parsePercent( - retrieveValue(layoutInfo.height, size[1]), - ecHeight - ); - - // Fetch payload info. - var payloadType = payload && payload.type; - var targetInfo = helper.retrieveTargetInfo(payload, seriesModel); - var rootRect = (payloadType === 'treemapRender' || payloadType === 'treemapMove') - ? payload.rootRect : null; - var viewRoot = seriesModel.getViewRoot(); - var viewAbovePath = helper.getPathToRoot(viewRoot); - - if (payloadType !== 'treemapMove') { - var rootSize = payloadType === 'treemapZoomToNode' - ? estimateRootSize( - seriesModel, targetInfo, viewRoot, containerWidth, containerHeight - ) - : rootRect - ? [rootRect.width, rootRect.height] - : [containerWidth, containerHeight]; - - var sort = seriesOption.sort; - if (sort && sort !== 'asc' && sort !== 'desc') { - sort = 'desc'; - } - var options = { - squareRatio: seriesOption.squareRatio, - sort: sort, - leafDepth: seriesOption.leafDepth - }; - - // layout should be cleared because using updateView but not update. - viewRoot.hostTree.clearLayouts(); - - // TODO - // optimize: if out of view clip, do not layout. - // But take care that if do not render node out of view clip, - // how to calculate start po + var createListFromArray = __webpack_require__(102); - var viewRootLayout = { - x: 0, y: 0, - width: rootSize[0], height: rootSize[1], - area: rootSize[0] * rootSize[1] - }; - viewRoot.setLayout(viewRootLayout); + module.exports = function (nodes, edges, hostModel, directed, beforeLink) { + var graph = new Graph(directed); + for (var i = 0; i < nodes.length; i++) { + graph.addNode(zrUtil.retrieve( + // Id, name, dataIndex + nodes[i].id, nodes[i].name, i + ), i); + } - squarify(viewRoot, options, false, 0); - // Supplement layout. - var viewRootLayout = viewRoot.getLayout(); - each(viewAbovePath, function (node, index) { - var childValue = (viewAbovePath[index + 1] || viewRoot).getValue(); - node.setLayout(zrUtil.extend( - {dataExtent: [childValue, childValue], borderWidth: 0}, - viewRootLayout - )); - }); + var linkNameList = []; + var validEdges = []; + var linkCount = 0; + for (var i = 0; i < edges.length; i++) { + var link = edges[i]; + var source = link.source; + var target = link.target; + // addEdge may fail when source or target not exists + if (graph.addEdge(source, target, linkCount)) { + validEdges.push(link); + linkNameList.push(zrUtil.retrieve(link.id, source + ' > ' + target)); + linkCount++; } + } - var treeRoot = seriesModel.getData().tree.root; - - treeRoot.setLayout( - calculateRootPosition(layoutInfo, rootRect, targetInfo), - true + var coordSys = hostModel.get('coordinateSystem'); + var nodeData; + if (coordSys === 'cartesian2d' || coordSys === 'polar') { + nodeData = createListFromArray(nodes, hostModel, hostModel.ecModel); + } + else { + // FIXME + var coordSysCtor = CoordinateSystem.get(coordSys); + // FIXME + var dimensionNames = completeDimensions( + ((coordSysCtor && coordSysCtor.type !== 'view') ? (coordSysCtor.dimensions || []) : []).concat(['value']), + nodes ); + nodeData = new List(dimensionNames, hostModel); + nodeData.initData(nodes); + } - seriesModel.setLayoutInfo(layoutInfo); + var edgeData = new List(['value'], hostModel); + edgeData.initData(validEdges, linkNameList); - // FIXME - // 现在没有clip功能,暂时取ec高宽。 - prunning( - treeRoot, - // Transform to base element coordinate system. - new BoundingRect(-layoutInfo.x, -layoutInfo.y, ecWidth, ecHeight), - viewAbovePath, - viewRoot, - 0 - ); + beforeLink && beforeLink(nodeData, edgeData); + + linkList({ + mainData: nodeData, + struct: graph, + structAttr: 'graph', + datas: {node: nodeData, edge: edgeData}, + datasAttr: {node: 'data', edge: 'edgeData'} }); - } - /** - * Layout treemap with squarify algorithm. - * @see https://graphics.ethz.ch/teaching/scivis_common/Literature/squarifiedTreeMaps.pdf - * @see https://github.com/mbostock/d3/blob/master/src/layout/treemap.js - * - * @protected - * @param {module:echarts/data/Tree~TreeNode} node - * @param {Object} options - * @param {string} options.sort 'asc' or 'desc' - * @param {number} options.squareRatio - * @param {boolean} hideChildren - * @param {number} depth - */ - function squarify(node, options, hideChildren, depth) { - var width; - var height; + // Update dataIndex of nodes and edges because invalid edge may be removed + graph.update(); - if (node.isRemoved()) { - return; - } + return graph; + }; - var thisLayout = node.getLayout(); - width = thisLayout.width; - height = thisLayout.height; - // Considering border and gap - var itemStyleModel = node.getModel('itemStyle.normal'); - var borderWidth = itemStyleModel.get('borderWidth'); - var halfGapWidth = itemStyleModel.get('gapWidth') / 2; - var layoutOffset = borderWidth - halfGapWidth; - var nodeModel = node.getModel(); +/***/ }, +/* 214 */ +/***/ function(module, exports, __webpack_require__) { - node.setLayout({borderWidth: borderWidth}, true); + 'use strict'; + /** + * Graph data structure + * + * @module echarts/data/Graph + * @author Yi Shen(https://www.github.com/pissang) + */ - width = mathMax(width - 2 * layoutOffset, 0); - height = mathMax(height - 2 * layoutOffset, 0); - var totalArea = width * height; - var viewChildren = initChildren( - node, nodeModel, totalArea, options, hideChildren, depth - ); + var zrUtil = __webpack_require__(4); - if (!viewChildren.length) { - return; - } + /** + * @alias module:echarts/data/Graph + * @constructor + * @param {boolean} directed + */ + var Graph = function(directed) { + /** + * 是否是有向图 + * @type {boolean} + * @private + */ + this._directed = directed || false; - var rect = {x: layoutOffset, y: layoutOffset, width: width, height: height}; - var rowFixedLength = mathMin(width, height); - var best = Infinity; // the best row score so far - var row = []; - row.area = 0; + /** + * @type {Array.} + * @readOnly + */ + this.nodes = []; - for (var i = 0, len = viewChildren.length; i < len;) { - var child = viewChildren[i]; + /** + * @type {Array.} + * @readOnly + */ + this.edges = []; - row.push(child); - row.area += child.getLayout().area; - var score = worst(row, rowFixedLength, options.squareRatio); + /** + * @type {Object.} + * @private + */ + this._nodesMap = {}; + /** + * @type {Object.} + * @private + */ + this._edgesMap = {}; - // continue with this orientation - if (score <= best) { - i++; - best = score; - } - // abort, and try a different orientation - else { - row.area -= row.pop().getLayout().area; - position(row, rowFixedLength, rect, halfGapWidth, false); - rowFixedLength = mathMin(rect.width, rect.height); - row.length = row.area = 0; - best = Infinity; - } - } + /** + * @type {module:echarts/data/List} + * @readOnly + */ + this.data; - if (row.length) { - position(row, rowFixedLength, rect, halfGapWidth, true); - } + /** + * @type {module:echarts/data/List} + * @readOnly + */ + this.edgeData; + }; - if (!hideChildren) { - var childrenVisibleMin = nodeModel.get('childrenVisibleMin'); - if (childrenVisibleMin != null && totalArea < childrenVisibleMin) { - hideChildren = true; - } - } + var graphProto = Graph.prototype; + /** + * @type {string} + */ + graphProto.type = 'graph'; - for (var i = 0, len = viewChildren.length; i < len; i++) { - squarify(viewChildren[i], options, hideChildren, depth + 1); - } - } + /** + * If is directed graph + * @return {boolean} + */ + graphProto.isDirected = function () { + return this._directed; + }; /** - * Set area to each child, and calculate data extent for visual coding. + * Add a new node + * @param {string} id + * @param {number} [dataIndex] */ - function initChildren(node, nodeModel, totalArea, options, hideChildren, depth) { - var viewChildren = node.children || []; - var orderBy = options.sort; - orderBy !== 'asc' && orderBy !== 'desc' && (orderBy = null); + graphProto.addNode = function (id, dataIndex) { + id = id || ('' + dataIndex); - var overLeafDepth = options.leafDepth != null && options.leafDepth <= depth; + var nodesMap = this._nodesMap; - // leafDepth has higher priority. - if (hideChildren && !overLeafDepth) { - return (node.viewChildren = []); + if (nodesMap[id]) { + return; } - // Sort children, order by desc. - viewChildren = zrUtil.filter(viewChildren, function (child) { - return !child.isRemoved(); - }); + var node = new Node(id, dataIndex); + node.hostGraph = this; - sort(viewChildren, orderBy); + this.nodes.push(node); - var info = statistic(nodeModel, viewChildren, orderBy); + nodesMap[id] = node; + return node; + }; - if (info.sum === 0) { - return (node.viewChildren = []); - } + /** + * Get node by data index + * @param {number} dataIndex + * @return {module:echarts/data/Graph~Node} + */ + graphProto.getNodeByIndex = function (dataIndex) { + var rawIdx = this.data.getRawIndex(dataIndex); + return this.nodes[rawIdx]; + }; + /** + * Get node by id + * @param {string} id + * @return {module:echarts/data/Graph.Node} + */ + graphProto.getNodeById = function (id) { + return this._nodesMap[id]; + }; - info.sum = filterByThreshold(nodeModel, totalArea, info.sum, orderBy, viewChildren); + /** + * Add a new edge + * @param {number|string|module:echarts/data/Graph.Node} n1 + * @param {number|string|module:echarts/data/Graph.Node} n2 + * @param {number} [dataIndex=-1] + * @return {module:echarts/data/Graph.Edge} + */ + graphProto.addEdge = function (n1, n2, dataIndex) { + var nodesMap = this._nodesMap; + var edgesMap = this._edgesMap; - if (info.sum === 0) { - return (node.viewChildren = []); + // PNEDING + if (typeof n1 === 'number') { + n1 = this.nodes[n1]; + } + if (typeof n2 === 'number') { + n2 = this.nodes[n2]; } - // Set area to each child. - for (var i = 0, len = viewChildren.length; i < len; i++) { - var area = viewChildren[i].getValue() / info.sum * totalArea; - // Do not use setLayout({...}, true), because it is needed to clear last layout. - viewChildren[i].setLayout({area: area}); + if (!(n1 instanceof Node)) { + n1 = nodesMap[n1]; + } + if (!(n2 instanceof Node)) { + n2 = nodesMap[n2]; + } + if (!n1 || !n2) { + return; } - if (overLeafDepth) { - viewChildren.length && node.setLayout({isLeafRoot: true}, true); - viewChildren.length = 0; + var key = n1.id + '-' + n2.id; + // PENDING + if (edgesMap[key]) { + return; } - node.viewChildren = viewChildren; - node.setLayout({dataExtent: info.dataExtent}, true); + var edge = new Edge(n1, n2, dataIndex); + edge.hostGraph = this; - return viewChildren; - } + if (this._directed) { + n1.outEdges.push(edge); + n2.inEdges.push(edge); + } + n1.edges.push(edge); + if (n1 !== n2) { + n2.edges.push(edge); + } + + this.edges.push(edge); + edgesMap[key] = edge; + + return edge; + }; /** - * Consider 'visibleMin'. Modify viewChildren and get new sum. + * Get edge by data index + * @param {number} dataIndex + * @return {module:echarts/data/Graph~Node} */ - function filterByThreshold(nodeModel, totalArea, sum, orderBy, orderedChildren) { - - // visibleMin is not supported yet when no option.sort. - if (!orderBy) { - return sum; + graphProto.getEdgeByIndex = function (dataIndex) { + var rawIdx = this.edgeData.getRawIndex(dataIndex); + return this.edges[rawIdx]; + }; + /** + * Get edge by two linked nodes + * @param {module:echarts/data/Graph.Node|string} n1 + * @param {module:echarts/data/Graph.Node|string} n2 + * @return {module:echarts/data/Graph.Edge} + */ + graphProto.getEdge = function (n1, n2) { + if (n1 instanceof Node) { + n1 = n1.id; + } + if (n2 instanceof Node) { + n2 = n2.id; } - var visibleMin = nodeModel.get('visibleMin'); - var len = orderedChildren.length; - var deletePoint = len; + var edgesMap = this._edgesMap; - // Always travel from little value to big value. - for (var i = len - 1; i >= 0; i--) { - var value = orderedChildren[ - orderBy === 'asc' ? len - i - 1 : i - ].getValue(); + if (this._directed) { + return edgesMap[n1 + '-' + n2]; + } else { + return edgesMap[n1 + '-' + n2] + || edgesMap[n2 + '-' + n1]; + } + }; - if (value / sum * totalArea < visibleMin) { - deletePoint = i; - sum -= value; + /** + * Iterate all nodes + * @param {Function} cb + * @param {*} [context] + */ + graphProto.eachNode = function (cb, context) { + var nodes = this.nodes; + var len = nodes.length; + for (var i = 0; i < len; i++) { + if (nodes[i].dataIndex >= 0) { + cb.call(context, nodes[i], i); } } - - orderBy === 'asc' - ? orderedChildren.splice(0, len - deletePoint) - : orderedChildren.splice(deletePoint, len - deletePoint); - - return sum; - } + }; /** - * Sort + * Iterate all edges + * @param {Function} cb + * @param {*} [context] */ - function sort(viewChildren, orderBy) { - if (orderBy) { - viewChildren.sort(function (a, b) { - return orderBy === 'asc' - ? a.getValue() - b.getValue() : b.getValue() - a.getValue(); - }); + graphProto.eachEdge = function (cb, context) { + var edges = this.edges; + var len = edges.length; + for (var i = 0; i < len; i++) { + if (edges[i].dataIndex >= 0 + && edges[i].node1.dataIndex >= 0 + && edges[i].node2.dataIndex >= 0 + ) { + cb.call(context, edges[i], i); + } } - return viewChildren; - } + }; /** - * Statistic + * Breadth first traverse + * @param {Function} cb + * @param {module:echarts/data/Graph.Node} startNode + * @param {string} [direction='none'] 'none'|'in'|'out' + * @param {*} [context] */ - function statistic(nodeModel, children, orderBy) { - // Calculate sum. - var sum = 0; - for (var i = 0, len = children.length; i < len; i++) { - sum += children[i].getValue(); + graphProto.breadthFirstTraverse = function ( + cb, startNode, direction, context + ) { + if (!(startNode instanceof Node)) { + startNode = this._nodesMap[startNode]; + } + if (!startNode) { + return; } - // Statistic data extent for latter visual coding. - // Notice: data extent should be calculate based on raw children - // but not filtered view children, otherwise visual mapping will not - // be stable when zoom (where children is filtered by visibleMin). - - var dimension = nodeModel.get('visualDimension'); - var dataExtent; + var edgeType = direction === 'out' + ? 'outEdges' : (direction === 'in' ? 'inEdges' : 'edges'); - // The same as area dimension. - if (!children || !children.length) { - dataExtent = [NaN, NaN]; - } - else if (dimension === 'value' && orderBy) { - dataExtent = [ - children[children.length - 1].getValue(), - children[0].getValue() - ]; - orderBy === 'asc' && dataExtent.reverse(); - } - // Other dimension. - else { - var dataExtent = [Infinity, -Infinity]; - each(children, function (child) { - var value = child.getValue(dimension); - value < dataExtent[0] && (dataExtent[0] = value); - value > dataExtent[1] && (dataExtent[1] = value); - }); + for (var i = 0; i < this.nodes.length; i++) { + this.nodes[i].__visited = false; } - return {sum: sum, dataExtent: dataExtent}; - } + if (cb.call(context, startNode, null)) { + return; + } - /** - * Computes the score for the specified row, - * as the worst aspect ratio. - */ - function worst(row, rowFixedLength, ratio) { - var areaMax = 0; - var areaMin = Infinity; + var queue = [startNode]; + while (queue.length) { + var currentNode = queue.shift(); + var edges = currentNode[edgeType]; - for (var i = 0, area, len = row.length; i < len; i++) { - area = row[i].getLayout().area; - if (area) { - area < areaMin && (areaMin = area); - area > areaMax && (areaMax = area); + for (var i = 0; i < edges.length; i++) { + var e = edges[i]; + var otherNode = e.node1 === currentNode + ? e.node2 : e.node1; + if (!otherNode.__visited) { + if (cb.call(otherNode, otherNode, currentNode)) { + // Stop traversing + return; + } + queue.push(otherNode); + otherNode.__visited = true; + } } } + }; - var squareArea = row.area * row.area; - var f = rowFixedLength * rowFixedLength * ratio; + // TODO + // graphProto.depthFirstTraverse = function ( + // cb, startNode, direction, context + // ) { - return squareArea - ? mathMax( - (f * areaMax) / squareArea, - squareArea / (f * areaMin) - ) - : Infinity; - } + // }; - /** - * Positions the specified row of nodes. Modifies `rect`. - */ - function position(row, rowFixedLength, rect, halfGapWidth, flush) { - // When rowFixedLength === rect.width, - // it is horizontal subdivision, - // rowFixedLength is the width of the subdivision, - // rowOtherLength is the height of the subdivision, - // and nodes will be positioned from left to right. + // Filter update + graphProto.update = function () { + var data = this.data; + var edgeData = this.edgeData; + var nodes = this.nodes; + var edges = this.edges; - // wh[idx0WhenH] means: when horizontal, - // wh[idx0WhenH] => wh[0] => 'width'. - // xy[idx1WhenH] => xy[1] => 'y'. - var idx0WhenH = rowFixedLength === rect.width ? 0 : 1; - var idx1WhenH = 1 - idx0WhenH; - var xy = ['x', 'y']; - var wh = ['width', 'height']; + for (var i = 0, len = nodes.length; i < len; i++) { + nodes[i].dataIndex = -1; + } + for (var i = 0, len = data.count(); i < len; i++) { + nodes[data.getRawIndex(i)].dataIndex = i; + } - var last = rect[xy[idx0WhenH]]; - var rowOtherLength = rowFixedLength - ? row.area / rowFixedLength : 0; + edgeData.filterSelf(function (idx) { + var edge = edges[edgeData.getRawIndex(idx)]; + return edge.node1.dataIndex >= 0 && edge.node2.dataIndex >= 0; + }); - if (flush || rowOtherLength > rect[wh[idx1WhenH]]) { - rowOtherLength = rect[wh[idx1WhenH]]; // over+underflow + // Update edge + for (var i = 0, len = edges.length; i < len; i++) { + edges[i].dataIndex = -1; } - for (var i = 0, rowLen = row.length; i < rowLen; i++) { - var node = row[i]; - var nodeLayout = {}; - var step = rowOtherLength - ? node.getLayout().area / rowOtherLength : 0; - - var wh1 = nodeLayout[wh[idx1WhenH]] = mathMax(rowOtherLength - 2 * halfGapWidth, 0); + for (var i = 0, len = edgeData.count(); i < len; i++) { + edges[edgeData.getRawIndex(i)].dataIndex = i; + } + }; - // We use Math.max/min to avoid negative width/height when considering gap width. - var remain = rect[xy[idx0WhenH]] + rect[wh[idx0WhenH]] - last; - var modWH = (i === rowLen - 1 || remain < step) ? remain : step; - var wh0 = nodeLayout[wh[idx0WhenH]] = mathMax(modWH - 2 * halfGapWidth, 0); + /** + * @return {module:echarts/data/Graph} + */ + graphProto.clone = function () { + var graph = new Graph(this._directed); + var nodes = this.nodes; + var edges = this.edges; + for (var i = 0; i < nodes.length; i++) { + graph.addNode(nodes[i].id, nodes[i].dataIndex); + } + for (var i = 0; i < edges.length; i++) { + var e = edges[i]; + graph.addEdge(e.node1.id, e.node2.id, e.dataIndex); + } + return graph; + }; - nodeLayout[xy[idx1WhenH]] = rect[xy[idx1WhenH]] + mathMin(halfGapWidth, wh1 / 2); - nodeLayout[xy[idx0WhenH]] = last + mathMin(halfGapWidth, wh0 / 2); - last += modWH; - node.setLayout(nodeLayout, true); - } + /** + * @alias module:echarts/data/Graph.Node + */ + function Node(id, dataIndex) { + /** + * @type {string} + */ + this.id = id == null ? '' : id; - rect[xy[idx1WhenH]] += rowOtherLength; - rect[wh[idx1WhenH]] -= rowOtherLength; - } + /** + * @type {Array.} + */ + this.inEdges = []; + /** + * @type {Array.} + */ + this.outEdges = []; + /** + * @type {Array.} + */ + this.edges = []; + /** + * @type {module:echarts/data/Graph} + */ + this.hostGraph; - // Return [containerWidth, containerHeight] as defualt. - function estimateRootSize(seriesModel, targetInfo, viewRoot, containerWidth, containerHeight) { - // If targetInfo.node exists, we zoom to the node, - // so estimate whold width and heigth by target node. - var currNode = (targetInfo || {}).node; - var defaultSize = [containerWidth, containerHeight]; + /** + * @type {number} + */ + this.dataIndex = dataIndex == null ? -1 : dataIndex; + } - if (!currNode || currNode === viewRoot) { - return defaultSize; - } + Node.prototype = { - var parent; - var viewArea = containerWidth * containerHeight; - var area = viewArea * seriesModel.option.zoomToNodeRatio; + constructor: Node, - while (parent = currNode.parentNode) { // jshint ignore:line - var sum = 0; - var siblings = parent.children; + /** + * @return {number} + */ + degree: function () { + return this.edges.length; + }, - for (var i = 0, len = siblings.length; i < len; i++) { - sum += siblings[i].getValue(); - } - var currNodeValue = currNode.getValue(); - if (currNodeValue === 0) { - return defaultSize; - } - area *= sum / currNodeValue; + /** + * @return {number} + */ + inDegree: function () { + return this.inEdges.length; + }, - var borderWidth = parent.getModel('itemStyle.normal').get('borderWidth'); + /** + * @return {number} + */ + outDegree: function () { + return this.outEdges.length; + }, - if (isFinite(borderWidth)) { - // Considering border, suppose aspect ratio is 1. - area += 4 * borderWidth * borderWidth + 4 * borderWidth * Math.pow(area, 0.5); + /** + * @param {string} [path] + * @return {module:echarts/model/Model} + */ + getModel: function (path) { + if (this.dataIndex < 0) { + return; } + var graph = this.hostGraph; + var itemModel = graph.data.getItemModel(this.dataIndex); - area > numberUtil.MAX_SAFE_INTEGER && (area = numberUtil.MAX_SAFE_INTEGER); - - currNode = parent; + return itemModel.getModel(path); } + }; - area < viewArea && (area = viewArea); - var scale = Math.pow(area / viewArea, 0.5); + /** + * 图边 + * @alias module:echarts/data/Graph.Edge + * @param {module:echarts/data/Graph.Node} n1 + * @param {module:echarts/data/Graph.Node} n2 + * @param {number} [dataIndex=-1] + */ + function Edge(n1, n2, dataIndex) { - return [containerWidth * scale, containerHeight * scale]; - } + /** + * 节点1,如果是有向图则为源节点 + * @type {module:echarts/data/Graph.Node} + */ + this.node1 = n1; - // Root postion base on coord of containerGroup - function calculateRootPosition(layoutInfo, rootRect, targetInfo) { - if (rootRect) { - return {x: rootRect.x, y: rootRect.y}; - } + /** + * 节点2,如果是有向图则为目标节点 + * @type {module:echarts/data/Graph.Node} + */ + this.node2 = n2; - var defaultPosition = {x: 0, y: 0}; - if (!targetInfo) { - return defaultPosition; + this.dataIndex = dataIndex == null ? -1 : dataIndex; + } + + /** + * @param {string} [path] + * @return {module:echarts/model/Model} + */ + Edge.prototype.getModel = function (path) { + if (this.dataIndex < 0) { + return; } + var graph = this.hostGraph; + var itemModel = graph.edgeData.getItemModel(this.dataIndex); - // If targetInfo is fetched by 'retrieveTargetInfo', - // old tree and new tree are the same tree, - // so the node still exists and we can visit it. + return itemModel.getModel(path); + }; - var targetNode = targetInfo.node; - var layout = targetNode.getLayout(); + var createGraphDataProxyMixin = function (hostName, dataName) { + return { + /** + * @param {string=} [dimension='value'] Default 'value'. can be 'a', 'b', 'c', 'd', 'e'. + * @return {number} + */ + getValue: function (dimension) { + var data = this[hostName][dataName]; + return data.get(data.getDimension(dimension || 'value'), this.dataIndex); + }, - if (!layout) { - return defaultPosition; - } + /** + * @param {Object|string} key + * @param {*} [value] + */ + setVisual: function (key, value) { + this.dataIndex >= 0 + && this[hostName][dataName].setItemVisual(this.dataIndex, key, value); + }, - // Transform coord from local to container. - var targetCenter = [layout.width / 2, layout.height / 2]; - var node = targetNode; - while (node) { - var nodeLayout = node.getLayout(); - targetCenter[0] += nodeLayout.x; - targetCenter[1] += nodeLayout.y; - node = node.parentNode; - } + /** + * @param {string} key + * @return {boolean} + */ + getVisual: function (key, ignoreParent) { + return this[hostName][dataName].getItemVisual(this.dataIndex, key, ignoreParent); + }, - return { - x: layoutInfo.width / 2 - targetCenter[0], - y: layoutInfo.height / 2 - targetCenter[1] - }; - } + /** + * @param {Object} layout + * @return {boolean} [merge=false] + */ + setLayout: function (layout, merge) { + this.dataIndex >= 0 + && this[hostName][dataName].setItemLayout(this.dataIndex, layout, merge); + }, - // Mark nodes visible for prunning when visual coding and rendering. - // Prunning depends on layout and root position, so we have to do it after layout. - function prunning(node, clipRect, viewAbovePath, viewRoot, depth) { - var nodeLayout = node.getLayout(); - var nodeInViewAbovePath = viewAbovePath[depth]; - var isAboveViewRoot = nodeInViewAbovePath && nodeInViewAbovePath === node; + /** + * @return {Object} + */ + getLayout: function () { + return this[hostName][dataName].getItemLayout(this.dataIndex); + }, - if ( - (nodeInViewAbovePath && !isAboveViewRoot) - || (depth === viewAbovePath.length && node !== viewRoot) - ) { - return; - } + /** + * @return {module:zrender/Element} + */ + getGraphicEl: function () { + return this[hostName][dataName].getItemGraphicEl(this.dataIndex); + }, - node.setLayout({ - // isInView means: viewRoot sub tree + viewAbovePath - isInView: true, - // invisible only means: outside view clip so that the node can not - // see but still layout for animation preparation but not render. - invisible: !isAboveViewRoot && !clipRect.intersect(nodeLayout), - isAboveViewRoot: isAboveViewRoot - }, true); + /** + * @return {number} + */ + getRawIndex: function () { + return this[hostName][dataName].getRawIndex(this.dataIndex); + } + }; + }; - // Transform to child coordinate. - var childClipRect = new BoundingRect( - clipRect.x - nodeLayout.x, - clipRect.y - nodeLayout.y, - clipRect.width, - clipRect.height - ); + zrUtil.mixin(Node, createGraphDataProxyMixin('hostGraph', 'data')); + zrUtil.mixin(Edge, createGraphDataProxyMixin('hostGraph', 'edgeData')); - each(node.viewChildren || [], function (child) { - prunning(child, childClipRect, viewAbovePath, viewRoot, depth + 1); - }); - } + Graph.Node = Node; + Graph.Edge = Edge; - module.exports = update; + module.exports = Graph; /***/ }, -/* 197 */ +/* 215 */ /***/ function(module, exports, __webpack_require__) { - var echarts = __webpack_require__(1); + + var SymbolDraw = __webpack_require__(115); + var LineDraw = __webpack_require__(216); + var RoamController = __webpack_require__(191); + + var graphic = __webpack_require__(44); + var adjustEdge = __webpack_require__(219); var zrUtil = __webpack_require__(4); - __webpack_require__(198); - __webpack_require__(201); + var nodeOpacityPath = ['itemStyle', 'normal', 'opacity']; + var lineOpacityPath = ['lineStyle', 'normal', 'opacity']; - __webpack_require__(206); + function getItemOpacity(item, opacityPath) { + return item.getVisual('opacity') || item.getModel().get(opacityPath); + } - echarts.registerProcessor(__webpack_require__(207)); + __webpack_require__(1).extendChartView({ - echarts.registerVisual(zrUtil.curry( - __webpack_require__(110), 'graph', 'circle', null - )); - echarts.registerVisual(__webpack_require__(208)); - echarts.registerVisual(__webpack_require__(209)); + type: 'graph', - echarts.registerLayout(__webpack_require__(210)); - echarts.registerLayout(__webpack_require__(213)); - echarts.registerLayout(__webpack_require__(215)); + init: function (ecModel, api) { + var symbolDraw = new SymbolDraw(); + var lineDraw = new LineDraw(); + var group = this.group; - // Graph view coordinate system - echarts.registerCoordinateSystem('graphView', { - create: __webpack_require__(217) - }); + var controller = new RoamController(api.getZr(), group); + group.add(symbolDraw.group); + group.add(lineDraw.group); -/***/ }, -/* 198 */ -/***/ function(module, exports, __webpack_require__) { + this._symbolDraw = symbolDraw; + this._lineDraw = lineDraw; + this._controller = controller; - 'use strict'; + this._firstRender = true; + }, + render: function (seriesModel, ecModel, api) { + var coordSys = seriesModel.coordinateSystem; - var List = __webpack_require__(98); - var zrUtil = __webpack_require__(4); - var modelUtil = __webpack_require__(5); - var Model = __webpack_require__(12); - var formatUtil = __webpack_require__(6); + this._model = seriesModel; + this._nodeScaleRatio = seriesModel.get('nodeScaleRatio'); - var createGraphFromNodeEdge = __webpack_require__(199); + var symbolDraw = this._symbolDraw; + var lineDraw = this._lineDraw; - var GraphSeries = __webpack_require__(1).extendSeriesModel({ + var group = this.group; - type: 'series.graph', + if (coordSys.type === 'view') { + var groupNewProp = { + position: coordSys.position, + scale: coordSys.scale + }; + if (this._firstRender) { + group.attr(groupNewProp); + } + else { + graphic.updateProps(group, groupNewProp, seriesModel); + } + } + // Fix edge contact point with node + adjustEdge(seriesModel.getGraph(), this._getNodeGlobalScale(seriesModel)); - init: function (option) { - GraphSeries.superApply(this, 'init', arguments); + var data = seriesModel.getData(); + symbolDraw.updateData(data); - // Provide data for legend select - this.legendDataProvider = function () { - return this._categoriesData; - }; + var edgeData = seriesModel.getEdgeData(); + lineDraw.updateData(edgeData); - this.fillDataTextStyle(option.edges || option.links); + this._updateNodeAndLinkScale(); - this._updateCategoriesData(); - }, + this._updateController(seriesModel, api); - mergeOption: function (option) { - GraphSeries.superApply(this, 'mergeOption', arguments); + clearTimeout(this._layoutTimeout); + var forceLayout = seriesModel.forceLayout; + var layoutAnimation = seriesModel.get('force.layoutAnimation'); + if (forceLayout) { + this._startForceLayoutIteration(forceLayout, layoutAnimation); + } + data.eachItemGraphicEl(function (el, idx) { + var itemModel = data.getItemModel(idx); + // Update draggable + el.off('drag').off('dragend'); + var draggable = data.getItemModel(idx).get('draggable'); + if (draggable) { + el.on('drag', function () { + if (forceLayout) { + forceLayout.warmUp(); + !this._layouting + && this._startForceLayoutIteration(forceLayout, layoutAnimation); + forceLayout.setFixed(idx); + // Write position back to layout + data.setItemLayout(idx, el.position); + } + }, this).on('dragend', function () { + if (forceLayout) { + forceLayout.setUnfixed(idx); + } + }, this); + } + el.setDraggable(draggable && forceLayout); - this.fillDataTextStyle(option.edges || option.links); + el.off('mouseover', el.__focusNodeAdjacency); + el.off('mouseout', el.__unfocusNodeAdjacency); - this._updateCategoriesData(); + if (itemModel.get('focusNodeAdjacency')) { + el.on('mouseover', el.__focusNodeAdjacency = function () { + api.dispatchAction({ + type: 'focusNodeAdjacency', + seriesId: seriesModel.id, + dataIndex: el.dataIndex + }); + }); + el.on('mouseout', el.__unfocusNodeAdjacency = function () { + api.dispatchAction({ + type: 'unfocusNodeAdjacency', + seriesId: seriesModel.id + }); + }); + } + + }, this); + + var circularRotateLabel = seriesModel.get('layout') === 'circular' && seriesModel.get('circular.rotateLabel'); + var cx = data.getLayout('cx'); + var cy = data.getLayout('cy'); + data.eachItemGraphicEl(function (el, idx) { + var symbolPath = el.getSymbolPath(); + if (circularRotateLabel) { + var pos = data.getItemLayout(idx); + var rad = Math.atan2(pos[1] - cy, pos[0] - cx); + if (rad < 0) { + rad = Math.PI * 2 + rad; + } + var isLeft = pos[0] < cx; + if (isLeft) { + rad = rad - Math.PI; + } + var textPosition = isLeft ? 'left' : 'right'; + symbolPath.setStyle({ + textRotation: rad, + textPosition: textPosition + }); + symbolPath.hoverStyle && (symbolPath.hoverStyle.textPosition = textPosition); + } + else { + symbolPath.setStyle({ + textRotation: 0 + }); + } + }); + + this._firstRender = false; }, - mergeDefaultAndTheme: function (option) { - GraphSeries.superApply(this, 'mergeDefaultAndTheme', arguments); - modelUtil.defaultEmphasis(option.edgeLabel, modelUtil.LABEL_OPTIONS); + dispose: function () { + this._controller && this._controller.dispose(); }, - getInitialData: function (option, ecModel) { - var edges = option.edges || option.links || []; - var nodes = option.data || option.nodes || []; - var self = this; + focusNodeAdjacency: function (seriesModel, ecModel, api, payload) { + var data = this._model.getData(); + var dataIndex = payload.dataIndex; + var el = data.getItemGraphicEl(dataIndex); - if (nodes && edges) { - return createGraphFromNodeEdge(nodes, edges, this, true, beforeLink).data; + if (!el) { + return; } - function beforeLink(nodeData, edgeData) { - // Overwrite nodeData.getItemModel to - nodeData.wrapMethod('getItemModel', function (model) { - var categoriesModels = self._categoriesModels; - var categoryIdx = model.getShallow('category'); - var categoryModel = categoriesModels[categoryIdx]; - if (categoryModel) { - categoryModel.parentModel = model.parentModel; - model.parentModel = categoryModel; + var graph = data.graph; + var dataType = el.dataType; + + function fadeOutItem(item, opacityPath) { + var opacity = getItemOpacity(item, opacityPath); + var el = item.getGraphicEl(); + if (opacity == null) { + opacity = 1; + } + + el.traverse(function (child) { + child.trigger('normal'); + if (child.type !== 'group') { + child.setStyle('opacity', opacity * 0.1); } - return model; }); + } - var edgeLabelModel = self.getModel('edgeLabel'); - // For option `edgeLabel` can be found by label.xxx.xxx on item mode. - var fakeSeriesModel = new Model( - {label: edgeLabelModel.option}, - edgeLabelModel.parentModel, - ecModel - ); + function fadeInItem(item, opacityPath) { + var opacity = getItemOpacity(item, opacityPath); + var el = item.getGraphicEl(); - edgeData.wrapMethod('getItemModel', function (model) { - model.customizeGetParent(edgeGetParent); - return model; + el.traverse(function (child) { + child.trigger('emphasis'); + if (child.type !== 'group') { + child.setStyle('opacity', opacity); + } }); - - function edgeGetParent(path) { - path = this.parsePath(path); - return (path && path[0] === 'label') - ? fakeSeriesModel - : this.parentModel; - } } - }, - - /** - * @return {module:echarts/data/Graph} - */ - getGraph: function () { - return this.getData().graph; - }, + if (dataIndex !== null && dataType !== 'edge') { + graph.eachNode(function (node) { + fadeOutItem(node, nodeOpacityPath); + }); + graph.eachEdge(function (edge) { + fadeOutItem(edge, lineOpacityPath); + }); - /** - * @return {module:echarts/data/List} - */ - getEdgeData: function () { - return this.getGraph().edgeData; + var node = graph.getNodeByIndex(dataIndex); + fadeInItem(node, nodeOpacityPath); + zrUtil.each(node.edges, function (edge) { + if (edge.dataIndex < 0) { + return; + } + fadeInItem(edge, lineOpacityPath); + fadeInItem(edge.node1, nodeOpacityPath); + fadeInItem(edge.node2, nodeOpacityPath); + }); + } }, - /** - * @return {module:echarts/data/List} - */ - getCategoriesData: function () { - return this._categoriesData; + unfocusNodeAdjacency: function (seriesModel, ecModel, api, payload) { + var graph = this._model.getData().graph; + graph.eachNode(function (node) { + var opacity = getItemOpacity(node, nodeOpacityPath); + node.getGraphicEl().traverse(function (child) { + child.trigger('normal'); + if (child.type !== 'group') { + child.setStyle('opacity', opacity); + } + }); + }); + graph.eachEdge(function (edge) { + var opacity = getItemOpacity(edge, lineOpacityPath); + edge.getGraphicEl().traverse(function (child) { + child.trigger('normal'); + if (child.type !== 'group') { + child.setStyle('opacity', opacity); + } + }); + }); }, - /** - * @override - */ - formatTooltip: function (dataIndex, multipleSeries, dataType) { - if (dataType === 'edge') { - var nodeData = this.getData(); - var params = this.getDataParams(dataIndex, dataType); - var edge = nodeData.graph.getEdgeByIndex(dataIndex); - var sourceName = nodeData.getName(edge.node1.dataIndex); - var targetName = nodeData.getName(edge.node2.dataIndex); + _startForceLayoutIteration: function (forceLayout, layoutAnimation) { + var self = this; + (function step() { + forceLayout.step(function (stopped) { + self.updateLayout(self._model); + (self._layouting = !stopped) && ( + layoutAnimation + ? (self._layoutTimeout = setTimeout(step, 16)) + : step() + ); + }); + })(); + }, - var html = []; - sourceName != null && html.push(sourceName); - targetName != null && html.push(targetName); - html = formatUtil.encodeHTML(html.join(' > ')); + _updateController: function (seriesModel, api) { + var controller = this._controller; + var group = this.group; - if (params.value) { - html += ' : ' + formatUtil.encodeHTML(params.value); - } - return html; - } - else { // dataType === 'node' or empty - return GraphSeries.superApply(this, 'formatTooltip', arguments); + controller.setContainsPoint(function (x, y) { + var rect = group.getBoundingRect(); + rect.applyTransform(group.transform); + return rect.contain(x, y); + }); + + if (seriesModel.coordinateSystem.type !== 'view') { + controller.disable(); + return; } + controller.enable(seriesModel.get('roam')); + controller.zoomLimit = seriesModel.get('scaleLimit'); + // Update zoom from model + controller.zoom = seriesModel.coordinateSystem.getZoom(); + + controller + .off('pan') + .off('zoom') + .on('pan', function (dx, dy) { + api.dispatchAction({ + seriesId: seriesModel.id, + type: 'graphRoam', + dx: dx, + dy: dy + }); + }) + .on('zoom', function (zoom, mouseX, mouseY) { + api.dispatchAction({ + seriesId: seriesModel.id, + type: 'graphRoam', + zoom: zoom, + originX: mouseX, + originY: mouseY + }); + this._updateNodeAndLinkScale(); + adjustEdge(seriesModel.getGraph(), this._getNodeGlobalScale(seriesModel)); + this._lineDraw.updateLayout(); + }, this); }, - _updateCategoriesData: function () { - var categories = zrUtil.map(this.option.categories || [], function (category) { - // Data must has value - return category.value != null ? category : zrUtil.extend({ - value: 0 - }, category); - }); - var categoriesData = new List(['value'], this); - categoriesData.initData(categories); + _updateNodeAndLinkScale: function () { + var seriesModel = this._model; + var data = seriesModel.getData(); - this._categoriesData = categoriesData; + var nodeScale = this._getNodeGlobalScale(seriesModel); + var invScale = [nodeScale, nodeScale]; - this._categoriesModels = categoriesData.mapArray(function (idx) { - return categoriesData.getItemModel(idx, true); + data.eachItemGraphicEl(function (el, idx) { + el.attr('scale', invScale); }); }, - setZoom: function (zoom) { - this.option.zoom = zoom; - }, + _getNodeGlobalScale: function (seriesModel) { + var coordSys = seriesModel.coordinateSystem; + if (coordSys.type !== 'view') { + return 1; + } - setCenter: function (center) { - this.option.center = center; + var nodeScaleRatio = this._nodeScaleRatio; + + var groupScale = coordSys.scale; + var groupZoom = (groupScale && groupScale[0]) || 1; + // Scale node when zoom changes + var roamZoom = coordSys.getZoom(); + var nodeScale = (roamZoom - 1) * nodeScaleRatio + 1; + + return nodeScale / groupZoom; }, - isAnimationEnabled: function () { - return GraphSeries.superCall(this, 'isAnimationEnabled') - // Not enable animation when do force layout - && !(this.get('layout') === 'force' && this.get('force.layoutAnimation')); + updateLayout: function (seriesModel) { + adjustEdge(seriesModel.getGraph(), this._getNodeGlobalScale(seriesModel)); + + this._symbolDraw.updateLayout(); + this._lineDraw.updateLayout(); }, - defaultOption: { - zlevel: 0, - z: 2, + remove: function (ecModel, api) { + this._symbolDraw && this._symbolDraw.remove(); + this._lineDraw && this._lineDraw.remove(); + } + }); - coordinateSystem: 'view', - // Default option for all coordinate systems - // xAxisIndex: 0, - // yAxisIndex: 0, - // polarIndex: 0, - // geoIndex: 0, +/***/ }, +/* 216 */ +/***/ function(module, exports, __webpack_require__) { - legendHoverLink: true, + /** + * @module echarts/chart/helper/LineDraw + */ - hoverAnimation: true, - layout: null, + var graphic = __webpack_require__(44); + var LineGroup = __webpack_require__(217); - focusNodeAdjacency: false, - // Configuration of circular layout - circular: { - rotateLabel: false - }, - // Configuration of force directed layout - force: { - initLayout: null, - // Node repulsion. Can be an array to represent range. - repulsion: [0, 50], - gravity: 0.1, + function isPointNaN(pt) { + return isNaN(pt[0]) || isNaN(pt[1]); + } + function lineNeedsDraw(pts) { + return !isPointNaN(pts[0]) && !isPointNaN(pts[1]); + } + /** + * @alias module:echarts/component/marker/LineDraw + * @constructor + */ + function LineDraw(ctor) { + this._ctor = ctor || LineGroup; + this.group = new graphic.Group(); + } - // Edge length. Can be an array to represent range. - edgeLength: 30, + var lineDrawProto = LineDraw.prototype; - layoutAnimation: true - }, + /** + * @param {module:echarts/data/List} lineData + */ + lineDrawProto.updateData = function (lineData) { - left: 'center', - top: 'center', - // right: null, - // bottom: null, - // width: '80%', - // height: '80%', + var oldLineData = this._lineData; + var group = this.group; + var LineCtor = this._ctor; - symbol: 'circle', - symbolSize: 10, + var hostModel = lineData.hostModel; - edgeSymbol: ['none', 'none'], - edgeSymbolSize: 10, - edgeLabel: { - normal: { - position: 'middle' - }, - emphasis: {} - }, + var seriesScope = { + lineStyle: hostModel.getModel('lineStyle.normal').getLineStyle(), + hoverLineStyle: hostModel.getModel('lineStyle.emphasis').getLineStyle(), + labelModel: hostModel.getModel('label.normal'), + hoverLabelModel: hostModel.getModel('label.emphasis') + }; - draggable: false, + lineData.diff(oldLineData) + .add(function (idx) { + if (!lineNeedsDraw(lineData.getItemLayout(idx))) { + return; + } + var lineGroup = new LineCtor(lineData, idx, seriesScope); - roam: false, + lineData.setItemGraphicEl(idx, lineGroup); - // Default on center of graph - center: null, + group.add(lineGroup); + }) + .update(function (newIdx, oldIdx) { + var lineGroup = oldLineData.getItemGraphicEl(oldIdx); + if (!lineNeedsDraw(lineData.getItemLayout(newIdx))) { + group.remove(lineGroup); + return; + } - zoom: 1, - // Symbol size scale ratio in roam - nodeScaleRatio: 0.6, + if (!lineGroup) { + lineGroup = new LineCtor(lineData, newIdx, seriesScope); + } + else { + lineGroup.updateData(lineData, newIdx, seriesScope); + } - // categories: [], + lineData.setItemGraphicEl(newIdx, lineGroup); - // data: [] - // Or - // nodes: [] - // - // links: [] - // Or - // edges: [] + group.add(lineGroup); + }) + .remove(function (idx) { + group.remove(oldLineData.getItemGraphicEl(idx)); + }) + .execute(); - label: { - normal: { - show: false, - formatter: '{b}' - }, - emphasis: { - show: true - } - }, + this._lineData = lineData; + }; - itemStyle: { - normal: {}, - emphasis: {} - }, + lineDrawProto.updateLayout = function () { + var lineData = this._lineData; + lineData.eachItemGraphicEl(function (el, idx) { + el.updateLayout(lineData, idx); + }, this); + }; - lineStyle: { - normal: { - color: '#aaa', - width: 1, - curveness: 0, - opacity: 0.5 - }, - emphasis: {} - } - } - }); + lineDrawProto.remove = function () { + this.group.removeAll(); + }; - module.exports = GraphSeries; + module.exports = LineDraw; /***/ }, -/* 199 */ +/* 217 */ /***/ function(module, exports, __webpack_require__) { - + /** + * @module echarts/chart/helper/Line + */ - var List = __webpack_require__(98); - var Graph = __webpack_require__(200); - var linkList = __webpack_require__(188); - var completeDimensions = __webpack_require__(103); - var CoordinateSystem = __webpack_require__(26); + + var symbolUtil = __webpack_require__(104); + var vector = __webpack_require__(10); + // var matrix = require('zrender/lib/core/matrix'); + var LinePath = __webpack_require__(218); + var graphic = __webpack_require__(44); var zrUtil = __webpack_require__(4); - var createListFromArray = __webpack_require__(102); + var numberUtil = __webpack_require__(7); - module.exports = function (nodes, edges, hostModel, directed, beforeLink) { - var graph = new Graph(directed); - for (var i = 0; i < nodes.length; i++) { - graph.addNode(zrUtil.retrieve( - // Id, name, dataIndex - nodes[i].id, nodes[i].name, i - ), i); - } + var SYMBOL_CATEGORIES = ['fromSymbol', 'toSymbol']; + function makeSymbolTypeKey(symbolCategory) { + return '_' + symbolCategory + 'Type'; + } + /** + * @inner + */ + function createSymbol(name, lineData, idx) { + var color = lineData.getItemVisual(idx, 'color'); + var symbolType = lineData.getItemVisual(idx, name); + var symbolSize = lineData.getItemVisual(idx, name + 'Size'); - var linkNameList = []; - var validEdges = []; - var linkCount = 0; - for (var i = 0; i < edges.length; i++) { - var link = edges[i]; - var source = link.source; - var target = link.target; - // addEdge may fail when source or target not exists - if (graph.addEdge(source, target, linkCount)) { - validEdges.push(link); - linkNameList.push(zrUtil.retrieve(link.id, source + ' > ' + target)); - linkCount++; - } + if (!symbolType || symbolType === 'none') { + return; } - var coordSys = hostModel.get('coordinateSystem'); - var nodeData; - if (coordSys === 'cartesian2d' || coordSys === 'polar') { - nodeData = createListFromArray(nodes, hostModel, hostModel.ecModel); - } - else { - // FIXME - var coordSysCtor = CoordinateSystem.get(coordSys); - // FIXME - var dimensionNames = completeDimensions( - ((coordSysCtor && coordSysCtor.type !== 'view') ? (coordSysCtor.dimensions || []) : []).concat(['value']), - nodes - ); - nodeData = new List(dimensionNames, hostModel); - nodeData.initData(nodes); + if (!zrUtil.isArray(symbolSize)) { + symbolSize = [symbolSize, symbolSize]; } + var symbolPath = symbolUtil.createSymbol( + symbolType, -symbolSize[0] / 2, -symbolSize[1] / 2, + symbolSize[0], symbolSize[1], color + ); - var edgeData = new List(['value'], hostModel); - edgeData.initData(validEdges, linkNameList); + symbolPath.name = name; - beforeLink && beforeLink(nodeData, edgeData); + return symbolPath; + } - linkList({ - mainData: nodeData, - struct: graph, - structAttr: 'graph', - datas: {node: nodeData, edge: edgeData}, - datasAttr: {node: 'data', edge: 'edgeData'} + function createLine(points) { + var line = new LinePath({ + name: 'line' }); + setLinePoints(line.shape, points); + return line; + } - // Update dataIndex of nodes and edges because invalid edge may be removed - graph.update(); - - return graph; - }; - + function setLinePoints(targetShape, points) { + var p1 = points[0]; + var p2 = points[1]; + var cp1 = points[2]; + targetShape.x1 = p1[0]; + targetShape.y1 = p1[1]; + targetShape.x2 = p2[0]; + targetShape.y2 = p2[1]; + targetShape.percent = 1; -/***/ }, -/* 200 */ -/***/ function(module, exports, __webpack_require__) { + if (cp1) { + targetShape.cpx1 = cp1[0]; + targetShape.cpy1 = cp1[1]; + } + else { + targetShape.cpx1 = NaN; + targetShape.cpy1 = NaN; + } + } - 'use strict'; - /** - * Graph data structure - * - * @module echarts/data/Graph - * @author Yi Shen(https://www.github.com/pissang) - */ + function updateSymbolAndLabelBeforeLineUpdate () { + var lineGroup = this; + var symbolFrom = lineGroup.childOfName('fromSymbol'); + var symbolTo = lineGroup.childOfName('toSymbol'); + var label = lineGroup.childOfName('label'); + // Quick reject + if (!symbolFrom && !symbolTo && label.ignore) { + return; + } + var invScale = 1; + var parentNode = this.parent; + while (parentNode) { + if (parentNode.scale) { + invScale /= parentNode.scale[0]; + } + parentNode = parentNode.parent; + } - var zrUtil = __webpack_require__(4); + var line = lineGroup.childOfName('line'); + // If line not changed + // FIXME Parent scale changed + if (!this.__dirty && !line.__dirty) { + return; + } - /** - * @alias module:echarts/data/Graph - * @constructor - * @param {boolean} directed - */ - var Graph = function(directed) { - /** - * 是否是有向图 - * @type {boolean} - * @private - */ - this._directed = directed || false; + var percent = line.shape.percent; + var fromPos = line.pointAt(0); + var toPos = line.pointAt(percent); - /** - * @type {Array.} - * @readOnly - */ - this.nodes = []; + var d = vector.sub([], toPos, fromPos); + vector.normalize(d, d); - /** - * @type {Array.} - * @readOnly - */ - this.edges = []; + if (symbolFrom) { + symbolFrom.attr('position', fromPos); + var tangent = line.tangentAt(0); + symbolFrom.attr('rotation', Math.PI / 2 - Math.atan2( + tangent[1], tangent[0] + )); + symbolFrom.attr('scale', [invScale * percent, invScale * percent]); + } + if (symbolTo) { + symbolTo.attr('position', toPos); + var tangent = line.tangentAt(1); + symbolTo.attr('rotation', -Math.PI / 2 - Math.atan2( + tangent[1], tangent[0] + )); + symbolTo.attr('scale', [invScale * percent, invScale * percent]); + } - /** - * @type {Object.} - * @private - */ - this._nodesMap = {}; - /** - * @type {Object.} - * @private - */ - this._edgesMap = {}; + if (!label.ignore) { + label.attr('position', toPos); - /** - * @type {module:echarts/data/List} - * @readOnly - */ - this.data; + var textPosition; + var textAlign; + var textVerticalAlign; - /** - * @type {module:echarts/data/List} - * @readOnly - */ - this.edgeData; - }; + var distance = 5 * invScale; + // End + if (label.__position === 'end') { + textPosition = [d[0] * distance + toPos[0], d[1] * distance + toPos[1]]; + textAlign = d[0] > 0.8 ? 'left' : (d[0] < -0.8 ? 'right' : 'center'); + textVerticalAlign = d[1] > 0.8 ? 'top' : (d[1] < -0.8 ? 'bottom' : 'middle'); + } + // Middle + else if (label.__position === 'middle') { + var halfPercent = percent / 2; + var tangent = line.tangentAt(halfPercent); + var n = [tangent[1], -tangent[0]]; + var cp = line.pointAt(halfPercent); + if (n[1] > 0) { + n[0] = -n[0]; + n[1] = -n[1]; + } + textPosition = [cp[0] + n[0] * distance, cp[1] + n[1] * distance]; + textAlign = 'center'; + textVerticalAlign = 'bottom'; + var rotation = -Math.atan2(tangent[1], tangent[0]); + if (toPos[0] < fromPos[0]) { + rotation = Math.PI + rotation; + } + label.attr('rotation', rotation); + } + // Start + else { + textPosition = [-d[0] * distance + fromPos[0], -d[1] * distance + fromPos[1]]; + textAlign = d[0] > 0.8 ? 'right' : (d[0] < -0.8 ? 'left' : 'center'); + textVerticalAlign = d[1] > 0.8 ? 'bottom' : (d[1] < -0.8 ? 'top' : 'middle'); + } + label.attr({ + style: { + // Use the user specified text align and baseline first + textVerticalAlign: label.__verticalAlign || textVerticalAlign, + textAlign: label.__textAlign || textAlign + }, + position: textPosition, + scale: [invScale, invScale] + }); + } + } - var graphProto = Graph.prototype; /** - * @type {string} + * @constructor + * @extends {module:zrender/graphic/Group} + * @alias {module:echarts/chart/helper/Line} */ - graphProto.type = 'graph'; + function Line(lineData, idx, seriesScope) { + graphic.Group.call(this); - /** - * If is directed graph - * @return {boolean} - */ - graphProto.isDirected = function () { - return this._directed; - }; + this._createLine(lineData, idx, seriesScope); + } - /** - * Add a new node - * @param {string} id - * @param {number} [dataIndex] - */ - graphProto.addNode = function (id, dataIndex) { - id = id || ('' + dataIndex); + var lineProto = Line.prototype; - var nodesMap = this._nodesMap; + // Update symbol position and rotation + lineProto.beforeUpdate = updateSymbolAndLabelBeforeLineUpdate; - if (nodesMap[id]) { - return; - } + lineProto._createLine = function (lineData, idx, seriesScope) { + var seriesModel = lineData.hostModel; + var linePoints = lineData.getItemLayout(idx); - var node = new Node(id, dataIndex); - node.hostGraph = this; + var line = createLine(linePoints); + line.shape.percent = 0; + graphic.initProps(line, { + shape: { + percent: 1 + } + }, seriesModel, idx); - this.nodes.push(node); + this.add(line); - nodesMap[id] = node; - return node; - }; + var label = new graphic.Text({ + name: 'label' + }); + this.add(label); - /** - * Get node by data index - * @param {number} dataIndex - * @return {module:echarts/data/Graph~Node} - */ - graphProto.getNodeByIndex = function (dataIndex) { - var rawIdx = this.data.getRawIndex(dataIndex); - return this.nodes[rawIdx]; - }; - /** - * Get node by id - * @param {string} id - * @return {module:echarts/data/Graph.Node} - */ - graphProto.getNodeById = function (id) { - return this._nodesMap[id]; + zrUtil.each(SYMBOL_CATEGORIES, function (symbolCategory) { + var symbol = createSymbol(symbolCategory, lineData, idx); + // symbols must added after line to make sure + // it will be updated after line#update. + // Or symbol position and rotation update in line#beforeUpdate will be one frame slow + this.add(symbol); + this[makeSymbolTypeKey(symbolCategory)] = lineData.getItemVisual(idx, symbolCategory); + }, this); + + this._updateCommonStl(lineData, idx, seriesScope); }; - /** - * Add a new edge - * @param {number|string|module:echarts/data/Graph.Node} n1 - * @param {number|string|module:echarts/data/Graph.Node} n2 - * @param {number} [dataIndex=-1] - * @return {module:echarts/data/Graph.Edge} - */ - graphProto.addEdge = function (n1, n2, dataIndex) { - var nodesMap = this._nodesMap; - var edgesMap = this._edgesMap; + lineProto.updateData = function (lineData, idx, seriesScope) { + var seriesModel = lineData.hostModel; - // PNEDING - if (typeof n1 === 'number') { - n1 = this.nodes[n1]; - } - if (typeof n2 === 'number') { - n2 = this.nodes[n2]; - } + var line = this.childOfName('line'); + var linePoints = lineData.getItemLayout(idx); + var target = { + shape: {} + }; + setLinePoints(target.shape, linePoints); + graphic.updateProps(line, target, seriesModel, idx); - if (!(n1 instanceof Node)) { - n1 = nodesMap[n1]; - } - if (!(n2 instanceof Node)) { - n2 = nodesMap[n2]; - } - if (!n1 || !n2) { - return; - } + zrUtil.each(SYMBOL_CATEGORIES, function (symbolCategory) { + var symbolType = lineData.getItemVisual(idx, symbolCategory); + var key = makeSymbolTypeKey(symbolCategory); + // Symbol changed + if (this[key] !== symbolType) { + this.remove(this.childOfName(symbolCategory)); + var symbol = createSymbol(symbolCategory, lineData, idx); + this.add(symbol); + } + this[key] = symbolType; + }, this); - var key = n1.id + '-' + n2.id; - // PENDING - if (edgesMap[key]) { - return; - } + this._updateCommonStl(lineData, idx, seriesScope); + }; - var edge = new Edge(n1, n2, dataIndex); - edge.hostGraph = this; + lineProto._updateCommonStl = function (lineData, idx, seriesScope) { + var seriesModel = lineData.hostModel; - if (this._directed) { - n1.outEdges.push(edge); - n2.inEdges.push(edge); - } - n1.edges.push(edge); - if (n1 !== n2) { - n2.edges.push(edge); - } + var line = this.childOfName('line'); - this.edges.push(edge); - edgesMap[key] = edge; + var lineStyle = seriesScope && seriesScope.lineStyle; + var hoverLineStyle = seriesScope && seriesScope.hoverLineStyle; + var labelModel = seriesScope && seriesScope.labelModel; + var hoverLabelModel = seriesScope && seriesScope.hoverLabelModel; - return edge; - }; + // Optimization for large dataset + if (!seriesScope || lineData.hasItemOption) { + var itemModel = lineData.getItemModel(idx); - /** - * Get edge by data index - * @param {number} dataIndex - * @return {module:echarts/data/Graph~Node} - */ - graphProto.getEdgeByIndex = function (dataIndex) { - var rawIdx = this.edgeData.getRawIndex(dataIndex); - return this.edges[rawIdx]; - }; - /** - * Get edge by two linked nodes - * @param {module:echarts/data/Graph.Node|string} n1 - * @param {module:echarts/data/Graph.Node|string} n2 - * @return {module:echarts/data/Graph.Edge} - */ - graphProto.getEdge = function (n1, n2) { - if (n1 instanceof Node) { - n1 = n1.id; - } - if (n2 instanceof Node) { - n2 = n2.id; + lineStyle = itemModel.getModel('lineStyle.normal').getLineStyle(); + hoverLineStyle = itemModel.getModel('lineStyle.emphasis').getLineStyle(); + + labelModel = itemModel.getModel('label.normal'); + hoverLabelModel = itemModel.getModel('label.emphasis'); } - var edgesMap = this._edgesMap; + var visualColor = lineData.getItemVisual(idx, 'color'); + var visualOpacity = zrUtil.retrieve( + lineData.getItemVisual(idx, 'opacity'), + lineStyle.opacity, + 1 + ); - if (this._directed) { - return edgesMap[n1 + '-' + n2]; - } else { - return edgesMap[n1 + '-' + n2] - || edgesMap[n2 + '-' + n1]; - } - }; + line.useStyle(zrUtil.defaults( + { + strokeNoScale: true, + fill: 'none', + stroke: visualColor, + opacity: visualOpacity + }, + lineStyle + )); + line.hoverStyle = hoverLineStyle; - /** - * Iterate all nodes - * @param {Function} cb - * @param {*} [context] - */ - graphProto.eachNode = function (cb, context) { - var nodes = this.nodes; - var len = nodes.length; - for (var i = 0; i < len; i++) { - if (nodes[i].dataIndex >= 0) { - cb.call(context, nodes[i], i); + // Update symbol + zrUtil.each(SYMBOL_CATEGORIES, function (symbolCategory) { + var symbol = this.childOfName(symbolCategory); + if (symbol) { + symbol.setColor(visualColor); + symbol.setStyle({ + opacity: visualOpacity + }); } - } - }; + }, this); - /** - * Iterate all edges - * @param {Function} cb - * @param {*} [context] - */ - graphProto.eachEdge = function (cb, context) { - var edges = this.edges; - var len = edges.length; - for (var i = 0; i < len; i++) { - if (edges[i].dataIndex >= 0 - && edges[i].node1.dataIndex >= 0 - && edges[i].node2.dataIndex >= 0 - ) { - cb.call(context, edges[i], i); - } - } - }; + var showLabel = labelModel.getShallow('show'); + var hoverShowLabel = hoverLabelModel.getShallow('show'); - /** - * Breadth first traverse - * @param {Function} cb - * @param {module:echarts/data/Graph.Node} startNode - * @param {string} [direction='none'] 'none'|'in'|'out' - * @param {*} [context] - */ - graphProto.breadthFirstTraverse = function ( - cb, startNode, direction, context - ) { - if (!(startNode instanceof Node)) { - startNode = this._nodesMap[startNode]; - } - if (!startNode) { - return; + var label = this.childOfName('label'); + var defaultLabelColor; + var defaultText; + + if (showLabel || hoverShowLabel) { + var rawVal = seriesModel.getRawValue(idx); + defaultText = rawVal == null + ? defaultText = lineData.getName(idx) + : isFinite(rawVal) + ? numberUtil.round(rawVal) + : rawVal; + defaultLabelColor = visualColor || '#000'; } - var edgeType = direction === 'out' - ? 'outEdges' : (direction === 'in' ? 'inEdges' : 'edges'); + // label.afterUpdate = lineAfterUpdate; + if (showLabel) { + var textStyleModel = labelModel.getModel('textStyle'); + label.setStyle({ + text: zrUtil.retrieve( + seriesModel.getFormattedLabel(idx, 'normal', lineData.dataType), + defaultText + ), + textFont: textStyleModel.getFont(), + fill: textStyleModel.getTextColor() || defaultLabelColor + }); - for (var i = 0; i < this.nodes.length; i++) { - this.nodes[i].__visited = false; + label.__textAlign = textStyleModel.get('align'); + label.__verticalAlign = textStyleModel.get('baseline'); + label.__position = labelModel.get('position'); } + else { + label.setStyle('text', ''); + } + if (hoverShowLabel) { + var textStyleHoverModel = hoverLabelModel.getModel('textStyle'); - if (cb.call(context, startNode, null)) { - return; + label.hoverStyle = { + text: zrUtil.retrieve( + seriesModel.getFormattedLabel(idx, 'emphasis', lineData.dataType), + defaultText + ), + textFont: textStyleHoverModel.getFont(), + fill: textStyleHoverModel.getTextColor() || defaultLabelColor + }; + } + else { + label.hoverStyle = { + text: '' + }; } - var queue = [startNode]; - while (queue.length) { - var currentNode = queue.shift(); - var edges = currentNode[edgeType]; + label.ignore = !showLabel && !hoverShowLabel; - for (var i = 0; i < edges.length; i++) { - var e = edges[i]; - var otherNode = e.node1 === currentNode - ? e.node2 : e.node1; - if (!otherNode.__visited) { - if (cb.call(otherNode, otherNode, currentNode)) { - // Stop traversing - return; - } - queue.push(otherNode); - otherNode.__visited = true; - } - } - } + graphic.setHoverStyle(this); }; - // TODO - // graphProto.depthFirstTraverse = function ( - // cb, startNode, direction, context - // ) { - - // }; + lineProto.updateLayout = function (lineData, idx) { + this.setLinePoints(lineData.getItemLayout(idx)); + }; - // Filter update - graphProto.update = function () { - var data = this.data; - var edgeData = this.edgeData; - var nodes = this.nodes; - var edges = this.edges; + lineProto.setLinePoints = function (points) { + var linePath = this.childOfName('line'); + setLinePoints(linePath.shape, points); + linePath.dirty(); + }; - for (var i = 0, len = nodes.length; i < len; i++) { - nodes[i].dataIndex = -1; - } - for (var i = 0, len = data.count(); i < len; i++) { - nodes[data.getRawIndex(i)].dataIndex = i; - } + zrUtil.inherits(Line, graphic.Group); - edgeData.filterSelf(function (idx) { - var edge = edges[edgeData.getRawIndex(idx)]; - return edge.node1.dataIndex >= 0 && edge.node2.dataIndex >= 0; - }); + module.exports = Line; - // Update edge - for (var i = 0, len = edges.length; i < len; i++) { - edges[i].dataIndex = -1; - } - for (var i = 0, len = edgeData.count(); i < len; i++) { - edges[edgeData.getRawIndex(i)].dataIndex = i; - } - }; - /** - * @return {module:echarts/data/Graph} - */ - graphProto.clone = function () { - var graph = new Graph(this._directed); - var nodes = this.nodes; - var edges = this.edges; - for (var i = 0; i < nodes.length; i++) { - graph.addNode(nodes[i].id, nodes[i].dataIndex); - } - for (var i = 0; i < edges.length; i++) { - var e = edges[i]; - graph.addEdge(e.node1.id, e.node2.id, e.dataIndex); - } - return graph; - }; +/***/ }, +/* 218 */ +/***/ function(module, exports, __webpack_require__) { + /** + * Line path for bezier and straight line draw + */ - /** - * @alias module:echarts/data/Graph.Node - */ - function Node(id, dataIndex) { - /** - * @type {string} - */ - this.id = id == null ? '' : id; + var graphic = __webpack_require__(44); + var vec2 = __webpack_require__(10); - /** - * @type {Array.} - */ - this.inEdges = []; - /** - * @type {Array.} - */ - this.outEdges = []; - /** - * @type {Array.} - */ - this.edges = []; - /** - * @type {module:echarts/data/Graph} - */ - this.hostGraph; + var straightLineProto = graphic.Line.prototype; + var bezierCurveProto = graphic.BezierCurve.prototype; - /** - * @type {number} - */ - this.dataIndex = dataIndex == null ? -1 : dataIndex; + function isLine(shape) { + return isNaN(+shape.cpx1) || isNaN(+shape.cpy1); } - Node.prototype = { + module.exports = graphic.extendShape({ - constructor: Node, + type: 'ec-line', - /** - * @return {number} - */ - degree: function () { - return this.edges.length; + style: { + stroke: '#000', + fill: null }, - /** - * @return {number} - */ - inDegree: function () { - return this.inEdges.length; + shape: { + x1: 0, + y1: 0, + x2: 0, + y2: 0, + percent: 1, + cpx1: null, + cpy1: null }, - /** - * @return {number} - */ - outDegree: function () { - return this.outEdges.length; + buildPath: function (ctx, shape) { + (isLine(shape) ? straightLineProto : bezierCurveProto).buildPath(ctx, shape); }, - /** - * @param {string} [path] - * @return {module:echarts/model/Model} - */ - getModel: function (path) { - if (this.dataIndex < 0) { - return; - } - var graph = this.hostGraph; - var itemModel = graph.data.getItemModel(this.dataIndex); + pointAt: function (t) { + return isLine(this.shape) + ? straightLineProto.pointAt.call(this, t) + : bezierCurveProto.pointAt.call(this, t); + }, + + tangentAt: function (t) { + var shape = this.shape; + var p = isLine(shape) + ? [shape.x2 - shape.x1, shape.y2 - shape.y1] + : bezierCurveProto.tangentAt.call(this, t); + return vec2.normalize(p, p); + } + }); + + +/***/ }, +/* 219 */ +/***/ function(module, exports, __webpack_require__) { + + + + var curveTool = __webpack_require__(51); + var vec2 = __webpack_require__(10); + + var v1 = []; + var v2 = []; + var v3 = []; + var quadraticAt = curveTool.quadraticAt; + var v2DistSquare = vec2.distSquare; + var mathAbs = Math.abs; + function intersectCurveCircle(curvePoints, center, radius) { + var p0 = curvePoints[0]; + var p1 = curvePoints[1]; + var p2 = curvePoints[2]; - return itemModel.getModel(path); + var d = Infinity; + var t; + var radiusSquare = radius * radius; + var interval = 0.1; + + for (var _t = 0.1; _t <= 0.9; _t += 0.1) { + v1[0] = quadraticAt(p0[0], p1[0], p2[0], _t); + v1[1] = quadraticAt(p0[1], p1[1], p2[1], _t); + var diff = mathAbs(v2DistSquare(v1, center) - radiusSquare); + if (diff < d) { + d = diff; + t = _t; + } } - }; - /** - * 图边 - * @alias module:echarts/data/Graph.Edge - * @param {module:echarts/data/Graph.Node} n1 - * @param {module:echarts/data/Graph.Node} n2 - * @param {number} [dataIndex=-1] - */ - function Edge(n1, n2, dataIndex) { + // Assume the segment is monotone,Find root through Bisection method + // At most 32 iteration + for (var i = 0; i < 32; i++) { + // var prev = t - interval; + var next = t + interval; + // v1[0] = quadraticAt(p0[0], p1[0], p2[0], prev); + // v1[1] = quadraticAt(p0[1], p1[1], p2[1], prev); + v2[0] = quadraticAt(p0[0], p1[0], p2[0], t); + v2[1] = quadraticAt(p0[1], p1[1], p2[1], t); + v3[0] = quadraticAt(p0[0], p1[0], p2[0], next); + v3[1] = quadraticAt(p0[1], p1[1], p2[1], next); - /** - * 节点1,如果是有向图则为源节点 - * @type {module:echarts/data/Graph.Node} - */ - this.node1 = n1; + var diff = v2DistSquare(v2, center) - radiusSquare; + if (mathAbs(diff) < 1e-2) { + break; + } - /** - * 节点2,如果是有向图则为目标节点 - * @type {module:echarts/data/Graph.Node} - */ - this.node2 = n2; + // var prevDiff = v2DistSquare(v1, center) - radiusSquare; + var nextDiff = v2DistSquare(v3, center) - radiusSquare; - this.dataIndex = dataIndex == null ? -1 : dataIndex; + interval /= 2; + if (diff < 0) { + if (nextDiff >= 0) { + t = t + interval; + } + else { + t = t - interval; + } + } + else { + if (nextDiff >= 0) { + t = t - interval; + } + else { + t = t + interval; + } + } + } + + return t; } + // Adjust edge to avoid + module.exports = function (graph, scale) { + var tmp0 = []; + var quadraticSubdivide = curveTool.quadraticSubdivide; + var pts = [[], [], []]; + var pts2 = [[], []]; + var v = []; + scale /= 2; - /** - * @param {string} [path] - * @return {module:echarts/model/Model} - */ - Edge.prototype.getModel = function (path) { - if (this.dataIndex < 0) { - return; + function getSymbolSize(node) { + var symbolSize = node.getVisual('symbolSize'); + if (symbolSize instanceof Array) { + symbolSize = (symbolSize[0] + symbolSize[1]) / 2; + } + return symbolSize; } - var graph = this.hostGraph; - var itemModel = graph.edgeData.getItemModel(this.dataIndex); - - return itemModel.getModel(path); - }; + graph.eachEdge(function (edge, idx) { + var linePoints = edge.getLayout(); + var fromSymbol = edge.getVisual('fromSymbol'); + var toSymbol = edge.getVisual('toSymbol'); - var createGraphDataProxyMixin = function (hostName, dataName) { - return { - /** - * @param {string=} [dimension='value'] Default 'value'. can be 'a', 'b', 'c', 'd', 'e'. - * @return {number} - */ - getValue: function (dimension) { - var data = this[hostName][dataName]; - return data.get(data.getDimension(dimension || 'value'), this.dataIndex); - }, + if (!linePoints.__original) { + linePoints.__original = [ + vec2.clone(linePoints[0]), + vec2.clone(linePoints[1]) + ]; + if (linePoints[2]) { + linePoints.__original.push(vec2.clone(linePoints[2])); + } + } + var originalPoints = linePoints.__original; + // Quadratic curve + if (linePoints[2] != null) { + vec2.copy(pts[0], originalPoints[0]); + vec2.copy(pts[1], originalPoints[2]); + vec2.copy(pts[2], originalPoints[1]); + if (fromSymbol && fromSymbol != 'none') { + var symbolSize = getSymbolSize(edge.node1); - /** - * @param {Object|string} key - * @param {*} [value] - */ - setVisual: function (key, value) { - this.dataIndex >= 0 - && this[hostName][dataName].setItemVisual(this.dataIndex, key, value); - }, + var t = intersectCurveCircle(pts, originalPoints[0], symbolSize * scale); + // Subdivide and get the second + quadraticSubdivide(pts[0][0], pts[1][0], pts[2][0], t, tmp0); + pts[0][0] = tmp0[3]; + pts[1][0] = tmp0[4]; + quadraticSubdivide(pts[0][1], pts[1][1], pts[2][1], t, tmp0); + pts[0][1] = tmp0[3]; + pts[1][1] = tmp0[4]; + } + if (toSymbol && toSymbol != 'none') { + var symbolSize = getSymbolSize(edge.node2); - /** - * @param {string} key - * @return {boolean} - */ - getVisual: function (key, ignoreParent) { - return this[hostName][dataName].getItemVisual(this.dataIndex, key, ignoreParent); - }, + var t = intersectCurveCircle(pts, originalPoints[1], symbolSize * scale); + // Subdivide and get the first + quadraticSubdivide(pts[0][0], pts[1][0], pts[2][0], t, tmp0); + pts[1][0] = tmp0[1]; + pts[2][0] = tmp0[2]; + quadraticSubdivide(pts[0][1], pts[1][1], pts[2][1], t, tmp0); + pts[1][1] = tmp0[1]; + pts[2][1] = tmp0[2]; + } + // Copy back to layout + vec2.copy(linePoints[0], pts[0]); + vec2.copy(linePoints[1], pts[2]); + vec2.copy(linePoints[2], pts[1]); + } + // Line + else { + vec2.copy(pts2[0], originalPoints[0]); + vec2.copy(pts2[1], originalPoints[1]); - /** - * @param {Object} layout - * @return {boolean} [merge=false] - */ - setLayout: function (layout, merge) { - this.dataIndex >= 0 - && this[hostName][dataName].setItemLayout(this.dataIndex, layout, merge); - }, + vec2.sub(v, pts2[1], pts2[0]); + vec2.normalize(v, v); + if (fromSymbol && fromSymbol != 'none') { - /** - * @return {Object} - */ - getLayout: function () { - return this[hostName][dataName].getItemLayout(this.dataIndex); - }, + var symbolSize = getSymbolSize(edge.node1); - /** - * @return {module:zrender/Element} - */ - getGraphicEl: function () { - return this[hostName][dataName].getItemGraphicEl(this.dataIndex); - }, + vec2.scaleAndAdd(pts2[0], pts2[0], v, symbolSize * scale); + } + if (toSymbol && toSymbol != 'none') { + var symbolSize = getSymbolSize(edge.node2); - /** - * @return {number} - */ - getRawIndex: function () { - return this[hostName][dataName].getRawIndex(this.dataIndex); + vec2.scaleAndAdd(pts2[1], pts2[1], v, -symbolSize * scale); + } + vec2.copy(linePoints[0], pts2[0]); + vec2.copy(linePoints[1], pts2[1]); } - }; + }); }; - zrUtil.mixin(Node, createGraphDataProxyMixin('hostGraph', 'data')); - zrUtil.mixin(Edge, createGraphDataProxyMixin('hostGraph', 'edgeData')); - - Graph.Node = Node; - Graph.Edge = Edge; - - module.exports = Graph; - /***/ }, -/* 201 */ +/* 220 */ /***/ function(module, exports, __webpack_require__) { + var echarts = __webpack_require__(1); + var roamHelper = __webpack_require__(194); - var SymbolDraw = __webpack_require__(105); - var LineDraw = __webpack_require__(202); - var RoamController = __webpack_require__(177); - - var graphic = __webpack_require__(43); - var adjustEdge = __webpack_require__(205); - var zrUtil = __webpack_require__(4); + var actionInfo = { + type: 'graphRoam', + event: 'graphRoam', + update: 'none' + }; - var nodeOpacityPath = ['itemStyle', 'normal', 'opacity']; - var lineOpacityPath = ['lineStyle', 'normal', 'opacity']; + /** + * @payload + * @property {string} name Series name + * @property {number} [dx] + * @property {number} [dy] + * @property {number} [zoom] + * @property {number} [originX] + * @property {number} [originY] + */ + echarts.registerAction(actionInfo, function (payload, ecModel) { + ecModel.eachComponent({mainType: 'series', query: payload}, function (seriesModel) { + var coordSys = seriesModel.coordinateSystem; - function getItemOpacity(item, opacityPath) { - return item.getVisual('opacity') || item.getModel().get(opacityPath); - } + var res = roamHelper.updateCenterAndZoom(coordSys, payload); - __webpack_require__(1).extendChartView({ + seriesModel.setCenter + && seriesModel.setCenter(res.center); - type: 'graph', + seriesModel.setZoom + && seriesModel.setZoom(res.zoom); + }); + }); - init: function (ecModel, api) { - var symbolDraw = new SymbolDraw(); - var lineDraw = new LineDraw(); - var group = this.group; - var controller = new RoamController(api.getZr(), group); + /** + * @payload + * @property {number} [seriesIndex] + * @property {string} [seriesId] + * @property {string} [seriesName] + * @property {number} [dataIndex] + */ + echarts.registerAction({ + type: 'focusNodeAdjacency', + event: 'focusNodeAdjacency', + update: 'series.graph:focusNodeAdjacency' + }, function () {}); - group.add(symbolDraw.group); - group.add(lineDraw.group); + /** + * @payload + * @property {number} [seriesIndex] + * @property {string} [seriesId] + * @property {string} [seriesName] + */ + echarts.registerAction({ + type: 'unfocusNodeAdjacency', + event: 'unfocusNodeAdjacency', + update: 'series.graph:unfocusNodeAdjacency' + }, function () {}); - this._symbolDraw = symbolDraw; - this._lineDraw = lineDraw; - this._controller = controller; - this._firstRender = true; - }, - render: function (seriesModel, ecModel, api) { - var coordSys = seriesModel.coordinateSystem; +/***/ }, +/* 221 */ +/***/ function(module, exports) { - this._model = seriesModel; - this._nodeScaleRatio = seriesModel.get('nodeScaleRatio'); + - var symbolDraw = this._symbolDraw; - var lineDraw = this._lineDraw; + module.exports = function (ecModel) { + var legendModels = ecModel.findComponents({ + mainType: 'legend' + }); + if (!legendModels || !legendModels.length) { + return; + } + ecModel.eachSeriesByType('graph', function (graphSeries) { + var categoriesData = graphSeries.getCategoriesData(); + var graph = graphSeries.getGraph(); + var data = graph.data; - var group = this.group; + var categoryNames = categoriesData.mapArray(categoriesData.getName); - if (coordSys.type === 'view') { - var groupNewProp = { - position: coordSys.position, - scale: coordSys.scale - }; - if (this._firstRender) { - group.attr(groupNewProp); - } - else { - graphic.updateProps(group, groupNewProp, seriesModel); + data.filterSelf(function (idx) { + var model = data.getItemModel(idx); + var category = model.getShallow('category'); + if (category != null) { + if (typeof category === 'number') { + category = categoryNames[category]; + } + // If in any legend component the status is not selected. + for (var i = 0; i < legendModels.length; i++) { + if (!legendModels[i].isSelected(category)) { + return false; + } + } } - } - // Fix edge contact point with node - adjustEdge(seriesModel.getGraph(), this._getNodeGlobalScale(seriesModel)); + return true; + }); + }, this); + }; + + +/***/ }, +/* 222 */ +/***/ function(module, exports) { + + + + module.exports = function (ecModel) { + var paletteScope = {}; + ecModel.eachSeriesByType('graph', function (seriesModel) { + var categoriesData = seriesModel.getCategoriesData(); var data = seriesModel.getData(); - symbolDraw.updateData(data); - var edgeData = seriesModel.getEdgeData(); - lineDraw.updateData(edgeData); + var categoryNameIdxMap = {}; - this._updateNodeAndLinkScale(); + categoriesData.each(function (idx) { + var name = categoriesData.getName(idx); + categoryNameIdxMap[name] = idx; - this._updateController(seriesModel, api); + var itemModel = categoriesData.getItemModel(idx); + var color = itemModel.get('itemStyle.normal.color') + || seriesModel.getColorFromPalette(name, paletteScope); + categoriesData.setItemVisual(idx, 'color', color); + }); - clearTimeout(this._layoutTimeout); - var forceLayout = seriesModel.forceLayout; - var layoutAnimation = seriesModel.get('force.layoutAnimation'); - if (forceLayout) { - this._startForceLayoutIteration(forceLayout, layoutAnimation); - } - data.eachItemGraphicEl(function (el, idx) { - var itemModel = data.getItemModel(idx); - // Update draggable - el.off('drag').off('dragend'); - var draggable = data.getItemModel(idx).get('draggable'); - if (draggable) { - el.on('drag', function () { - if (forceLayout) { - forceLayout.warmUp(); - !this._layouting - && this._startForceLayoutIteration(forceLayout, layoutAnimation); - forceLayout.setFixed(idx); - // Write position back to layout - data.setItemLayout(idx, el.position); + // Assign category color to visual + if (categoriesData.count()) { + data.each(function (idx) { + var model = data.getItemModel(idx); + var category = model.getShallow('category'); + if (category != null) { + if (typeof category === 'string') { + category = categoryNameIdxMap[category]; } - }, this).on('dragend', function () { - if (forceLayout) { - forceLayout.setUnfixed(idx); + if (!data.getItemVisual(idx, 'color', true)) { + data.setItemVisual( + idx, 'color', + categoriesData.getItemVisual(category, 'color') + ); } - }, this); - } - el.setDraggable(draggable && forceLayout); + } + }); + } + }); + }; - el.off('mouseover', el.__focusNodeAdjacency); - el.off('mouseout', el.__unfocusNodeAdjacency); - if (itemModel.get('focusNodeAdjacency')) { - el.on('mouseover', el.__focusNodeAdjacency = function () { - api.dispatchAction({ - type: 'focusNodeAdjacency', - seriesId: seriesModel.id, - dataIndex: el.dataIndex - }); - }); - el.on('mouseout', el.__unfocusNodeAdjacency = function () { - api.dispatchAction({ - type: 'unfocusNodeAdjacency', - seriesId: seriesModel.id - }); - }); - } +/***/ }, +/* 223 */ +/***/ function(module, exports) { - }, this); + - var circularRotateLabel = seriesModel.get('layout') === 'circular' && seriesModel.get('circular.rotateLabel'); - var cx = data.getLayout('cx'); - var cy = data.getLayout('cy'); - data.eachItemGraphicEl(function (el, idx) { - var symbolPath = el.getSymbolPath(); - if (circularRotateLabel) { - var pos = data.getItemLayout(idx); - var rad = Math.atan2(pos[1] - cy, pos[0] - cx); - if (rad < 0) { - rad = Math.PI * 2 + rad; - } - var isLeft = pos[0] < cx; - if (isLeft) { - rad = rad - Math.PI; - } - var textPosition = isLeft ? 'left' : 'right'; - symbolPath.setStyle({ - textRotation: rad, - textPosition: textPosition - }); - symbolPath.hoverStyle && (symbolPath.hoverStyle.textPosition = textPosition); - } - else { - symbolPath.setStyle({ - textRotation: 0 - }); - } - }); + function normalize(a) { + if (!(a instanceof Array)) { + a = [a, a]; + } + return a; + } + module.exports = function (ecModel) { + ecModel.eachSeriesByType('graph', function (seriesModel) { + var graph = seriesModel.getGraph(); + var edgeData = seriesModel.getEdgeData(); + var symbolType = normalize(seriesModel.get('edgeSymbol')); + var symbolSize = normalize(seriesModel.get('edgeSymbolSize')); - this._firstRender = false; - }, + var colorQuery = 'lineStyle.normal.color'.split('.'); + var opacityQuery = 'lineStyle.normal.opacity'.split('.'); - dispose: function () { - this._controller && this._controller.dispose(); - }, + edgeData.setVisual('fromSymbol', symbolType && symbolType[0]); + edgeData.setVisual('toSymbol', symbolType && symbolType[1]); + edgeData.setVisual('fromSymbolSize', symbolSize && symbolSize[0]); + edgeData.setVisual('toSymbolSize', symbolSize && symbolSize[1]); + edgeData.setVisual('color', seriesModel.get(colorQuery)); + edgeData.setVisual('opacity', seriesModel.get(opacityQuery)); + + edgeData.each(function (idx) { + var itemModel = edgeData.getItemModel(idx); + var edge = graph.getEdgeByIndex(idx); + var symbolType = normalize(itemModel.getShallow('symbol', true)); + var symbolSize = normalize(itemModel.getShallow('symbolSize', true)); + // Edge visual must after node visual + var color = itemModel.get(colorQuery); + var opacity = itemModel.get(opacityQuery); + switch (color) { + case 'source': + color = edge.node1.getVisual('color'); + break; + case 'target': + color = edge.node2.getVisual('color'); + break; + } + + symbolType[0] && edge.setVisual('fromSymbol', symbolType[0]); + symbolType[1] && edge.setVisual('toSymbol', symbolType[1]); + symbolSize[0] && edge.setVisual('fromSymbolSize', symbolSize[0]); + symbolSize[1] && edge.setVisual('toSymbolSize', symbolSize[1]); - focusNodeAdjacency: function (seriesModel, ecModel, api, payload) { - var data = this._model.getData(); - var dataIndex = payload.dataIndex; - var el = data.getItemGraphicEl(dataIndex); + edge.setVisual('color', color); + edge.setVisual('opacity', opacity); + }); + }); + }; - if (!el) { - return; - } - var graph = data.graph; - var dataType = el.dataType; +/***/ }, +/* 224 */ +/***/ function(module, exports, __webpack_require__) { - function fadeOutItem(item, opacityPath) { - var opacity = getItemOpacity(item, opacityPath); - var el = item.getGraphicEl(); - if (opacity == null) { - opacity = 1; - } + - el.traverse(function (child) { - child.trigger('normal'); - if (child.type !== 'group') { - child.setStyle('opacity', opacity * 0.1); - } - }); - } + var simpleLayoutHelper = __webpack_require__(225); + var simpleLayoutEdge = __webpack_require__(226); - function fadeInItem(item, opacityPath) { - var opacity = getItemOpacity(item, opacityPath); - var el = item.getGraphicEl(); + module.exports = function (ecModel, api) { + ecModel.eachSeriesByType('graph', function (seriesModel) { + var layout = seriesModel.get('layout'); + var coordSys = seriesModel.coordinateSystem; + if (coordSys && coordSys.type !== 'view') { + var data = seriesModel.getData(); + var dimensions = coordSys.dimensions; - el.traverse(function (child) { - child.trigger('emphasis'); - if (child.type !== 'group') { - child.setStyle('opacity', opacity); + data.each(dimensions, function () { + var hasValue; + var args = arguments; + var value = []; + for (var i = 0; i < dimensions.length; i++) { + if (!isNaN(args[i])) { + hasValue = true; + } + value.push(args[i]); } - }); - } - if (dataIndex !== null && dataType !== 'edge') { - graph.eachNode(function (node) { - fadeOutItem(node, nodeOpacityPath); - }); - graph.eachEdge(function (edge) { - fadeOutItem(edge, lineOpacityPath); - }); + var idx = args[args.length - 1]; - var node = graph.getNodeByIndex(dataIndex); - fadeInItem(node, nodeOpacityPath); - zrUtil.each(node.edges, function (edge) { - if (edge.dataIndex < 0) { - return; + if (hasValue) { + data.setItemLayout(idx, coordSys.dataToPoint(value)); + } + else { + // Also {Array.}, not undefined to avoid if...else... statement + data.setItemLayout(idx, [NaN, NaN]); } - fadeInItem(edge, lineOpacityPath); - fadeInItem(edge.node1, nodeOpacityPath); - fadeInItem(edge.node2, nodeOpacityPath); }); + + simpleLayoutEdge(data.graph); } - }, + else if (!layout || layout === 'none') { + simpleLayoutHelper(seriesModel); + } + }); + }; - unfocusNodeAdjacency: function (seriesModel, ecModel, api, payload) { - var graph = this._model.getData().graph; - graph.eachNode(function (node) { - var opacity = getItemOpacity(node, nodeOpacityPath); - node.getGraphicEl().traverse(function (child) { - child.trigger('normal'); - if (child.type !== 'group') { - child.setStyle('opacity', opacity); - } - }); - }); - graph.eachEdge(function (edge) { - var opacity = getItemOpacity(edge, lineOpacityPath); - edge.getGraphicEl().traverse(function (child) { - child.trigger('normal'); - if (child.type !== 'group') { - child.setStyle('opacity', opacity); - } - }); - }); - }, - _startForceLayoutIteration: function (forceLayout, layoutAnimation) { - var self = this; - (function step() { - forceLayout.step(function (stopped) { - self.updateLayout(self._model); - (self._layouting = !stopped) && ( - layoutAnimation - ? (self._layoutTimeout = setTimeout(step, 16)) - : step() - ); - }); - })(); - }, - _updateController: function (seriesModel, api) { - var controller = this._controller; - var group = this.group; +/***/ }, +/* 225 */ +/***/ function(module, exports, __webpack_require__) { - controller.setContainsPoint(function (x, y) { - var rect = group.getBoundingRect(); - rect.applyTransform(group.transform); - return rect.contain(x, y); - }); + - if (seriesModel.coordinateSystem.type !== 'view') { - controller.disable(); - return; - } - controller.enable(seriesModel.get('roam')); - controller.zoomLimit = seriesModel.get('scaleLimit'); - // Update zoom from model - controller.zoom = seriesModel.coordinateSystem.getZoom(); + var simpleLayoutEdge = __webpack_require__(226); - controller - .off('pan') - .off('zoom') - .on('pan', function (dx, dy) { - api.dispatchAction({ - seriesId: seriesModel.id, - type: 'graphRoam', - dx: dx, - dy: dy - }); - }) - .on('zoom', function (zoom, mouseX, mouseY) { - api.dispatchAction({ - seriesId: seriesModel.id, - type: 'graphRoam', - zoom: zoom, - originX: mouseX, - originY: mouseY - }); - this._updateNodeAndLinkScale(); - adjustEdge(seriesModel.getGraph(), this._getNodeGlobalScale(seriesModel)); - this._lineDraw.updateLayout(); - }, this); - }, + module.exports = function (seriesModel) { + var coordSys = seriesModel.coordinateSystem; + if (coordSys && coordSys.type !== 'view') { + return; + } + var graph = seriesModel.getGraph(); - _updateNodeAndLinkScale: function () { - var seriesModel = this._model; - var data = seriesModel.getData(); + graph.eachNode(function (node) { + var model = node.getModel(); + node.setLayout([+model.get('x'), +model.get('y')]); + }); - var nodeScale = this._getNodeGlobalScale(seriesModel); - var invScale = [nodeScale, nodeScale]; + simpleLayoutEdge(graph); + }; - data.eachItemGraphicEl(function (el, idx) { - el.attr('scale', invScale); - }); - }, - _getNodeGlobalScale: function (seriesModel) { - var coordSys = seriesModel.coordinateSystem; - if (coordSys.type !== 'view') { - return 1; +/***/ }, +/* 226 */ +/***/ function(module, exports, __webpack_require__) { + + + var vec2 = __webpack_require__(10); + module.exports = function (graph) { + graph.eachEdge(function (edge) { + var curveness = edge.getModel().get('lineStyle.normal.curveness') || 0; + var p1 = vec2.clone(edge.node1.getLayout()); + var p2 = vec2.clone(edge.node2.getLayout()); + var points = [p1, p2]; + if (+curveness) { + points.push([ + (p1[0] + p2[0]) / 2 - (p1[1] - p2[1]) * curveness, + (p1[1] + p2[1]) / 2 - (p2[0] - p1[0]) * curveness + ]); } + edge.setLayout(points); + }); + }; - var nodeScaleRatio = this._nodeScaleRatio; - var groupScale = coordSys.scale; - var groupZoom = (groupScale && groupScale[0]) || 1; - // Scale node when zoom changes - var roamZoom = coordSys.getZoom(); - var nodeScale = (roamZoom - 1) * nodeScaleRatio + 1; +/***/ }, +/* 227 */ +/***/ function(module, exports, __webpack_require__) { - return nodeScale / groupZoom; - }, + + var circularLayoutHelper = __webpack_require__(228); + module.exports = function (ecModel) { + ecModel.eachSeriesByType('graph', function (seriesModel) { + if (seriesModel.get('layout') === 'circular') { + circularLayoutHelper(seriesModel); + } + }); + }; - updateLayout: function (seriesModel) { - adjustEdge(seriesModel.getGraph(), this._getNodeGlobalScale(seriesModel)); - this._symbolDraw.updateLayout(); - this._lineDraw.updateLayout(); - }, +/***/ }, +/* 228 */ +/***/ function(module, exports, __webpack_require__) { - remove: function (ecModel, api) { - this._symbolDraw && this._symbolDraw.remove(); - this._lineDraw && this._lineDraw.remove(); + + var vec2 = __webpack_require__(10); + module.exports = function (seriesModel) { + var coordSys = seriesModel.coordinateSystem; + if (coordSys && coordSys.type !== 'view') { + return; } - }); + var rect = coordSys.getBoundingRect(); -/***/ }, -/* 202 */ -/***/ function(module, exports, __webpack_require__) { + var nodeData = seriesModel.getData(); + var graph = nodeData.graph; - /** - * @module echarts/chart/helper/LineDraw - */ + var angle = 0; + var sum = nodeData.getSum('value'); + var unitAngle = Math.PI * 2 / (sum || nodeData.count()); + var cx = rect.width / 2 + rect.x; + var cy = rect.height / 2 + rect.y; - var graphic = __webpack_require__(43); - var LineGroup = __webpack_require__(203); + var r = Math.min(rect.width, rect.height) / 2; + graph.eachNode(function (node) { + var value = node.getValue('value'); - function isPointNaN(pt) { - return isNaN(pt[0]) || isNaN(pt[1]); - } - function lineNeedsDraw(pts) { - return !isPointNaN(pts[0]) && !isPointNaN(pts[1]); - } - /** - * @alias module:echarts/component/marker/LineDraw - * @constructor - */ - function LineDraw(ctor) { - this._ctor = ctor || LineGroup; - this.group = new graphic.Group(); - } + angle += unitAngle * (sum ? value : 1) / 2; - var lineDrawProto = LineDraw.prototype; + node.setLayout([ + r * Math.cos(angle) + cx, + r * Math.sin(angle) + cy + ]); - /** - * @param {module:echarts/data/List} lineData - */ - lineDrawProto.updateData = function (lineData) { + angle += unitAngle * (sum ? value : 1) / 2; + }); - var oldLineData = this._lineData; - var group = this.group; - var LineCtor = this._ctor; + nodeData.setLayout({ + cx: cx, + cy: cy + }); - var hostModel = lineData.hostModel; + graph.eachEdge(function (edge) { + var curveness = edge.getModel().get('lineStyle.normal.curveness') || 0; + var p1 = vec2.clone(edge.node1.getLayout()); + var p2 = vec2.clone(edge.node2.getLayout()); + var cp1; + var x12 = (p1[0] + p2[0]) / 2; + var y12 = (p1[1] + p2[1]) / 2; + if (+curveness) { + curveness *= 3; + cp1 = [ + cx * curveness + x12 * (1 - curveness), + cy * curveness + y12 * (1 - curveness) + ]; + } + edge.setLayout([p1, p2, cp1]); + }); + }; - var seriesScope = { - lineStyle: hostModel.getModel('lineStyle.normal').getLineStyle(), - hoverLineStyle: hostModel.getModel('lineStyle.emphasis').getLineStyle(), - labelModel: hostModel.getModel('label.normal'), - hoverLabelModel: hostModel.getModel('label.emphasis') - }; - lineData.diff(oldLineData) - .add(function (idx) { - if (!lineNeedsDraw(lineData.getItemLayout(idx))) { - return; - } - var lineGroup = new LineCtor(lineData, idx, seriesScope); +/***/ }, +/* 229 */ +/***/ function(module, exports, __webpack_require__) { - lineData.setItemGraphicEl(idx, lineGroup); + - group.add(lineGroup); - }) - .update(function (newIdx, oldIdx) { - var lineGroup = oldLineData.getItemGraphicEl(oldIdx); - if (!lineNeedsDraw(lineData.getItemLayout(newIdx))) { - group.remove(lineGroup); - return; + var forceHelper = __webpack_require__(230); + var numberUtil = __webpack_require__(7); + var simpleLayoutHelper = __webpack_require__(225); + var circularLayoutHelper = __webpack_require__(228); + var vec2 = __webpack_require__(10); + var zrUtil = __webpack_require__(4); + + module.exports = function (ecModel) { + ecModel.eachSeriesByType('graph', function (graphSeries) { + var coordSys = graphSeries.coordinateSystem; + if (coordSys && coordSys.type !== 'view') { + return; + } + if (graphSeries.get('layout') === 'force') { + var preservedPoints = graphSeries.preservedPoints || {}; + var graph = graphSeries.getGraph(); + var nodeData = graph.data; + var edgeData = graph.edgeData; + var forceModel = graphSeries.getModel('force'); + var initLayout = forceModel.get('initLayout'); + if (graphSeries.preservedPoints) { + nodeData.each(function (idx) { + var id = nodeData.getId(idx); + nodeData.setItemLayout(idx, preservedPoints[id] || [NaN, NaN]); + }); + } + else if (!initLayout || initLayout === 'none') { + simpleLayoutHelper(graphSeries); + } + else if (initLayout === 'circular') { + circularLayoutHelper(graphSeries); } - if (!lineGroup) { - lineGroup = new LineCtor(lineData, newIdx, seriesScope); + var nodeDataExtent = nodeData.getDataExtent('value'); + var edgeDataExtent = edgeData.getDataExtent('value'); + // var edgeDataExtent = edgeData.getDataExtent('value'); + var repulsion = forceModel.get('repulsion'); + var edgeLength = forceModel.get('edgeLength'); + if (!zrUtil.isArray(repulsion)) { + repulsion = [repulsion, repulsion]; } - else { - lineGroup.updateData(lineData, newIdx, seriesScope); + if (!zrUtil.isArray(edgeLength)) { + edgeLength = [edgeLength, edgeLength]; } + // Larger value has smaller length + edgeLength = [edgeLength[1], edgeLength[0]]; - lineData.setItemGraphicEl(newIdx, lineGroup); + var nodes = nodeData.mapArray('value', function (value, idx) { + var point = nodeData.getItemLayout(idx); + // var w = numberUtil.linearMap(value, nodeDataExtent, [0, 50]); + var rep = numberUtil.linearMap(value, nodeDataExtent, repulsion); + if (isNaN(rep)) { + rep = (repulsion[0] + repulsion[1]) / 2; + } + return { + w: rep, + rep: rep, + p: (!point || isNaN(point[0]) || isNaN(point[1])) ? null : point + }; + }); + var edges = edgeData.mapArray('value', function (value, idx) { + var edge = graph.getEdgeByIndex(idx); + var d = numberUtil.linearMap(value, edgeDataExtent, edgeLength); + if (isNaN(d)) { + d = (edgeLength[0] + edgeLength[1]) / 2; + } + return { + n1: nodes[edge.node1.dataIndex], + n2: nodes[edge.node2.dataIndex], + d: d, + curveness: edge.getModel().get('lineStyle.normal.curveness') || 0 + }; + }); - group.add(lineGroup); - }) - .remove(function (idx) { - group.remove(oldLineData.getItemGraphicEl(idx)); - }) - .execute(); + var coordSys = graphSeries.coordinateSystem; + var rect = coordSys.getBoundingRect(); + var forceInstance = forceHelper(nodes, edges, { + rect: rect, + gravity: forceModel.get('gravity') + }); + var oldStep = forceInstance.step; + forceInstance.step = function (cb) { + for (var i = 0, l = nodes.length; i < l; i++) { + if (nodes[i].fixed) { + // Write back to layout instance + vec2.copy(nodes[i].p, graph.getNodeByIndex(i).getLayout()); + } + } + oldStep(function (nodes, edges, stopped) { + for (var i = 0, l = nodes.length; i < l; i++) { + if (!nodes[i].fixed) { + graph.getNodeByIndex(i).setLayout(nodes[i].p); + } + preservedPoints[nodeData.getId(i)] = nodes[i].p; + } + for (var i = 0, l = edges.length; i < l; i++) { + var e = edges[i]; + var edge = graph.getEdgeByIndex(i); + var p1 = e.n1.p; + var p2 = e.n2.p; + var points = edge.getLayout(); + points = points ? points.slice() : []; + points[0] = points[0] || []; + points[1] = points[1] || []; + vec2.copy(points[0], p1); + vec2.copy(points[1], p2); + if (+e.curveness) { + points[2] = [ + (p1[0] + p2[0]) / 2 - (p1[1] - p2[1]) * e.curveness, + (p1[1] + p2[1]) / 2 - (p2[0] - p1[0]) * e.curveness + ]; + } + edge.setLayout(points); + } + // Update layout + + cb && cb(stopped); + }); + }; + graphSeries.forceLayout = forceInstance; + graphSeries.preservedPoints = preservedPoints; + + // Step to get the layout + forceInstance.step(); + } + else { + // Remove prev injected forceLayout instance + graphSeries.forceLayout = null; + } + }); + }; + + +/***/ }, +/* 230 */ +/***/ function(module, exports, __webpack_require__) { + + + + var vec2 = __webpack_require__(10); + var scaleAndAdd = vec2.scaleAndAdd; + + // function adjacentNode(n, e) { + // return e.n1 === n ? e.n2 : e.n1; + // } + + module.exports = function (nodes, edges, opts) { + var rect = opts.rect; + var width = rect.width; + var height = rect.height; + var center = [rect.x + width / 2, rect.y + height / 2]; + // var scale = opts.scale || 1; + var gravity = opts.gravity == null ? 0.1 : opts.gravity; + + // for (var i = 0; i < edges.length; i++) { + // var e = edges[i]; + // var n1 = e.n1; + // var n2 = e.n2; + // n1.edges = n1.edges || []; + // n2.edges = n2.edges || []; + // n1.edges.push(e); + // n2.edges.push(e); + // } + // Init position + for (var i = 0; i < nodes.length; i++) { + var n = nodes[i]; + if (!n.p) { + // Use the position from first adjecent node with defined position + // Or use a random position + // From d3 + // if (n.edges) { + // var j = -1; + // while (++j < n.edges.length) { + // var e = n.edges[j]; + // var other = adjacentNode(n, e); + // if (other.p) { + // n.p = vec2.clone(other.p); + // break; + // } + // } + // } + // if (!n.p) { + n.p = vec2.create( + width * (Math.random() - 0.5) + center[0], + height * (Math.random() - 0.5) + center[1] + ); + // } + } + n.pp = vec2.clone(n.p); + n.edges = null; + } - this._lineData = lineData; - }; + // Formula in 'Graph Drawing by Force-directed Placement' + // var k = scale * Math.sqrt(width * height / nodes.length); + // var k2 = k * k; - lineDrawProto.updateLayout = function () { - var lineData = this._lineData; - lineData.eachItemGraphicEl(function (el, idx) { - el.updateLayout(lineData, idx); - }, this); - }; + var friction = 0.6; - lineDrawProto.remove = function () { - this.group.removeAll(); - }; + return { + warmUp: function () { + friction = 0.5; + }, - module.exports = LineDraw; + setFixed: function (idx) { + nodes[idx].fixed = true; + }, + setUnfixed: function (idx) { + nodes[idx].fixed = false; + }, -/***/ }, -/* 203 */ -/***/ function(module, exports, __webpack_require__) { + step: function (cb) { + var v12 = []; + var nLen = nodes.length; + for (var i = 0; i < edges.length; i++) { + var e = edges[i]; + var n1 = e.n1; + var n2 = e.n2; - /** - * @module echarts/chart/helper/Line - */ + vec2.sub(v12, n2.p, n1.p); + var d = vec2.len(v12) - e.d; + var w = n2.w / (n1.w + n2.w); + vec2.normalize(v12, v12); + !n1.fixed && scaleAndAdd(n1.p, n1.p, v12, w * d * friction); + !n2.fixed && scaleAndAdd(n2.p, n2.p, v12, -(1 - w) * d * friction); + } + // Gravity + for (var i = 0; i < nLen; i++) { + var n = nodes[i]; + if (!n.fixed) { + vec2.sub(v12, center, n.p); + // var d = vec2.len(v12); + // vec2.scale(v12, v12, 1 / d); + // var gravityFactor = gravity; + vec2.scaleAndAdd(n.p, n.p, v12, gravity * friction); + } + } - var symbolUtil = __webpack_require__(107); - var vector = __webpack_require__(10); - // var matrix = require('zrender/lib/core/matrix'); - var LinePath = __webpack_require__(204); - var graphic = __webpack_require__(43); - var zrUtil = __webpack_require__(4); - var numberUtil = __webpack_require__(7); + // Repulsive + // PENDING + for (var i = 0; i < nLen; i++) { + var n1 = nodes[i]; + for (var j = i + 1; j < nLen; j++) { + var n2 = nodes[j]; + vec2.sub(v12, n2.p, n1.p); + var d = vec2.len(v12); + if (d === 0) { + // Random repulse + vec2.set(v12, Math.random() - 0.5, Math.random() - 0.5); + d = 1; + } + var repFact = (n1.rep + n2.rep) / d / d; + !n1.fixed && scaleAndAdd(n1.pp, n1.pp, v12, repFact); + !n2.fixed && scaleAndAdd(n2.pp, n2.pp, v12, -repFact); + } + } + var v = []; + for (var i = 0; i < nLen; i++) { + var n = nodes[i]; + if (!n.fixed) { + vec2.sub(v, n.p, n.pp); + vec2.scaleAndAdd(n.p, n.p, v, friction); + vec2.copy(n.pp, n.p); + } + } - var SYMBOL_CATEGORIES = ['fromSymbol', 'toSymbol']; - function makeSymbolTypeKey(symbolCategory) { - return '_' + symbolCategory + 'Type'; - } - /** - * @inner - */ - function createSymbol(name, lineData, idx) { - var color = lineData.getItemVisual(idx, 'color'); - var symbolType = lineData.getItemVisual(idx, name); - var symbolSize = lineData.getItemVisual(idx, name + 'Size'); + friction = friction * 0.992; - if (!symbolType || symbolType === 'none') { - return; - } + cb && cb(nodes, edges, friction < 0.01); + } + }; + }; - if (!zrUtil.isArray(symbolSize)) { - symbolSize = [symbolSize, symbolSize]; - } - var symbolPath = symbolUtil.createSymbol( - symbolType, -symbolSize[0] / 2, -symbolSize[1] / 2, - symbolSize[0], symbolSize[1], color - ); - symbolPath.name = name; +/***/ }, +/* 231 */ +/***/ function(module, exports, __webpack_require__) { - return symbolPath; - } + + // FIXME Where to create the simple view coordinate system + var View = __webpack_require__(185); + var layout = __webpack_require__(21); + var bbox = __webpack_require__(52); - function createLine(points) { - var line = new LinePath({ - name: 'line' + function getViewRect(seriesModel, api, aspect) { + var option = seriesModel.getBoxLayoutParams(); + option.aspect = aspect; + return layout.getLayoutRect(option, { + width: api.getWidth(), + height: api.getHeight() }); - setLinePoints(line.shape, points); - return line; } - function setLinePoints(targetShape, points) { - var p1 = points[0]; - var p2 = points[1]; - var cp1 = points[2]; - targetShape.x1 = p1[0]; - targetShape.y1 = p1[1]; - targetShape.x2 = p2[0]; - targetShape.y2 = p2[1]; - targetShape.percent = 1; + module.exports = function (ecModel, api) { + var viewList = []; + ecModel.eachSeriesByType('graph', function (seriesModel) { + var coordSysType = seriesModel.get('coordinateSystem'); + if (!coordSysType || coordSysType === 'view') { - if (cp1) { - targetShape.cpx1 = cp1[0]; - targetShape.cpy1 = cp1[1]; - } - else { - targetShape.cpx1 = NaN; - targetShape.cpy1 = NaN; - } - } + var data = seriesModel.getData(); + var positions = data.mapArray(function (idx) { + var itemModel = data.getItemModel(idx); + return [+itemModel.get('x'), +itemModel.get('y')]; + }); - function updateSymbolAndLabelBeforeLineUpdate () { - var lineGroup = this; - var symbolFrom = lineGroup.childOfName('fromSymbol'); - var symbolTo = lineGroup.childOfName('toSymbol'); - var label = lineGroup.childOfName('label'); - // Quick reject - if (!symbolFrom && !symbolTo && label.ignore) { - return; - } + var min = []; + var max = []; - var invScale = 1; - var parentNode = this.parent; - while (parentNode) { - if (parentNode.scale) { - invScale /= parentNode.scale[0]; - } - parentNode = parentNode.parent; - } + bbox.fromPoints(positions, min, max); - var line = lineGroup.childOfName('line'); - // If line not changed - // FIXME Parent scale changed - if (!this.__dirty && !line.__dirty) { - return; - } + // If width or height is 0 + if (max[0] - min[0] === 0) { + max[0] += 1; + min[0] -= 1; + } + if (max[1] - min[1] === 0) { + max[1] += 1; + min[1] -= 1; + } + var aspect = (max[0] - min[0]) / (max[1] - min[1]); + // FIXME If get view rect after data processed? + var viewRect = getViewRect(seriesModel, api, aspect); + // Position may be NaN, use view rect instead + if (isNaN(aspect)) { + min = [viewRect.x, viewRect.y]; + max = [viewRect.x + viewRect.width, viewRect.y + viewRect.height]; + } - var percent = line.shape.percent; - var fromPos = line.pointAt(0); - var toPos = line.pointAt(percent); + var bbWidth = max[0] - min[0]; + var bbHeight = max[1] - min[1]; - var d = vector.sub([], toPos, fromPos); - vector.normalize(d, d); + var viewWidth = viewRect.width; + var viewHeight = viewRect.height; - if (symbolFrom) { - symbolFrom.attr('position', fromPos); - var tangent = line.tangentAt(0); - symbolFrom.attr('rotation', Math.PI / 2 - Math.atan2( - tangent[1], tangent[0] - )); - symbolFrom.attr('scale', [invScale * percent, invScale * percent]); - } - if (symbolTo) { - symbolTo.attr('position', toPos); - var tangent = line.tangentAt(1); - symbolTo.attr('rotation', -Math.PI / 2 - Math.atan2( - tangent[1], tangent[0] - )); - symbolTo.attr('scale', [invScale * percent, invScale * percent]); - } + var viewCoordSys = seriesModel.coordinateSystem = new View(); + viewCoordSys.zoomLimit = seriesModel.get('scaleLimit'); - if (!label.ignore) { - label.attr('position', toPos); + viewCoordSys.setBoundingRect( + min[0], min[1], bbWidth, bbHeight + ); + viewCoordSys.setViewRect( + viewRect.x, viewRect.y, viewWidth, viewHeight + ); - var textPosition; - var textAlign; - var textVerticalAlign; + // Update roam info + viewCoordSys.setCenter(seriesModel.get('center')); + viewCoordSys.setZoom(seriesModel.get('zoom')); - var distance = 5 * invScale; - // End - if (label.__position === 'end') { - textPosition = [d[0] * distance + toPos[0], d[1] * distance + toPos[1]]; - textAlign = d[0] > 0.8 ? 'left' : (d[0] < -0.8 ? 'right' : 'center'); - textVerticalAlign = d[1] > 0.8 ? 'top' : (d[1] < -0.8 ? 'bottom' : 'middle'); - } - // Middle - else if (label.__position === 'middle') { - var halfPercent = percent / 2; - var tangent = line.tangentAt(halfPercent); - var n = [tangent[1], -tangent[0]]; - var cp = line.pointAt(halfPercent); - if (n[1] > 0) { - n[0] = -n[0]; - n[1] = -n[1]; - } - textPosition = [cp[0] + n[0] * distance, cp[1] + n[1] * distance]; - textAlign = 'center'; - textVerticalAlign = 'bottom'; - var rotation = -Math.atan2(tangent[1], tangent[0]); - if (toPos[0] < fromPos[0]) { - rotation = Math.PI + rotation; - } - label.attr('rotation', rotation); - } - // Start - else { - textPosition = [-d[0] * distance + fromPos[0], -d[1] * distance + fromPos[1]]; - textAlign = d[0] > 0.8 ? 'right' : (d[0] < -0.8 ? 'left' : 'center'); - textVerticalAlign = d[1] > 0.8 ? 'bottom' : (d[1] < -0.8 ? 'top' : 'middle'); + viewList.push(viewCoordSys); } - label.attr({ - style: { - // Use the user specified text align and baseline first - textVerticalAlign: label.__verticalAlign || textVerticalAlign, - textAlign: label.__textAlign || textAlign - }, - position: textPosition, - scale: [invScale, invScale] - }); - } - } + }); + return viewList; + }; - /** - * @constructor - * @extends {module:zrender/graphic/Group} - * @alias {module:echarts/chart/helper/Line} - */ - function Line(lineData, idx, seriesScope) { - graphic.Group.call(this); - this._createLine(lineData, idx, seriesScope); - } +/***/ }, +/* 232 */ +/***/ function(module, exports, __webpack_require__) { - var lineProto = Line.prototype; + + __webpack_require__(233); + __webpack_require__(234); - // Update symbol position and rotation - lineProto.beforeUpdate = updateSymbolAndLabelBeforeLineUpdate; - lineProto._createLine = function (lineData, idx, seriesScope) { - var seriesModel = lineData.hostModel; - var linePoints = lineData.getItemLayout(idx); +/***/ }, +/* 233 */ +/***/ function(module, exports, __webpack_require__) { - var line = createLine(linePoints); - line.shape.percent = 0; - graphic.initProps(line, { - shape: { - percent: 1 - } - }, seriesModel, idx); + - this.add(line); + var List = __webpack_require__(98); + var SeriesModel = __webpack_require__(28); + var zrUtil = __webpack_require__(4); - var label = new graphic.Text({ - name: 'label' - }); - this.add(label); + var GaugeSeries = SeriesModel.extend({ - zrUtil.each(SYMBOL_CATEGORIES, function (symbolCategory) { - var symbol = createSymbol(symbolCategory, lineData, idx); - // symbols must added after line to make sure - // it will be updated after line#update. - // Or symbol position and rotation update in line#beforeUpdate will be one frame slow - this.add(symbol); - this[makeSymbolTypeKey(symbolCategory)] = lineData.getItemVisual(idx, symbolCategory); - }, this); + type: 'series.gauge', - this._updateCommonStl(lineData, idx, seriesScope); - }; + getInitialData: function (option, ecModel) { + var list = new List(['value'], this); + var dataOpt = option.data || []; + if (!zrUtil.isArray(dataOpt)) { + dataOpt = [dataOpt]; + } + // Only use the first data item + list.initData(dataOpt); + return list; + }, - lineProto.updateData = function (lineData, idx, seriesScope) { - var seriesModel = lineData.hostModel; + defaultOption: { + zlevel: 0, + z: 2, + // 默认全局居中 + center: ['50%', '50%'], + legendHoverLink: true, + radius: '75%', + startAngle: 225, + endAngle: -45, + clockwise: true, + // 最小值 + min: 0, + // 最大值 + max: 100, + // 分割段数,默认为10 + splitNumber: 10, + // 坐标轴线 + axisLine: { + // 默认显示,属性show控制显示与否 + show: true, + lineStyle: { // 属性lineStyle控制线条样式 + color: [[0.2, '#91c7ae'], [0.8, '#63869e'], [1, '#c23531']], + width: 30 + } + }, + // 分隔线 + splitLine: { + // 默认显示,属性show控制显示与否 + show: true, + // 属性length控制线长 + length: 30, + // 属性lineStyle(详见lineStyle)控制线条样式 + lineStyle: { + color: '#eee', + width: 2, + type: 'solid' + } + }, + // 坐标轴小标记 + axisTick: { + // 属性show控制显示与否,默认不显示 + show: true, + // 每份split细分多少段 + splitNumber: 5, + // 属性length控制线长 + length: 8, + // 属性lineStyle控制线条样式 + lineStyle: { + color: '#eee', + width: 1, + type: 'solid' + } + }, + axisLabel: { + show: true, + distance: 5, + // formatter: null, + textStyle: { // 其余属性默认使用全局文本样式,详见TEXTSTYLE + color: 'auto' + } + }, + pointer: { + show: true, + length: '80%', + width: 8 + }, + itemStyle: { + normal: { + color: 'auto' + } + }, + title: { + show: true, + // x, y,单位px + offsetCenter: [0, '-40%'], + // 其余属性默认使用全局文本样式,详见TEXTSTYLE + textStyle: { + color: '#333', + fontSize: 15 + } + }, + detail: { + show: true, + backgroundColor: 'rgba(0,0,0,0)', + borderWidth: 0, + borderColor: '#ccc', + width: 100, + height: 40, + // x, y,单位px + offsetCenter: [0, '40%'], + // formatter: null, + // 其余属性默认使用全局文本样式,详见TEXTSTYLE + textStyle: { + color: 'auto', + fontSize: 30 + } + } + } + }); - var line = this.childOfName('line'); - var linePoints = lineData.getItemLayout(idx); - var target = { - shape: {} - }; - setLinePoints(target.shape, linePoints); - graphic.updateProps(line, target, seriesModel, idx); + module.exports = GaugeSeries; - zrUtil.each(SYMBOL_CATEGORIES, function (symbolCategory) { - var symbolType = lineData.getItemVisual(idx, symbolCategory); - var key = makeSymbolTypeKey(symbolCategory); - // Symbol changed - if (this[key] !== symbolType) { - this.remove(this.childOfName(symbolCategory)); - var symbol = createSymbol(symbolCategory, lineData, idx); - this.add(symbol); - } - this[key] = symbolType; - }, this); - this._updateCommonStl(lineData, idx, seriesScope); - }; +/***/ }, +/* 234 */ +/***/ function(module, exports, __webpack_require__) { - lineProto._updateCommonStl = function (lineData, idx, seriesScope) { - var seriesModel = lineData.hostModel; + - var line = this.childOfName('line'); + var PointerPath = __webpack_require__(235); - var lineStyle = seriesScope && seriesScope.lineStyle; - var hoverLineStyle = seriesScope && seriesScope.hoverLineStyle; - var labelModel = seriesScope && seriesScope.labelModel; - var hoverLabelModel = seriesScope && seriesScope.hoverLabelModel; + var graphic = __webpack_require__(44); + var numberUtil = __webpack_require__(7); + var parsePercent = numberUtil.parsePercent; - // Optimization for large dataset - if (!seriesScope || lineData.hasItemOption) { - var itemModel = lineData.getItemModel(idx); + function parsePosition(seriesModel, api) { + var center = seriesModel.get('center'); + var width = api.getWidth(); + var height = api.getHeight(); + var size = Math.min(width, height); + var cx = parsePercent(center[0], api.getWidth()); + var cy = parsePercent(center[1], api.getHeight()); + var r = parsePercent(seriesModel.get('radius'), size / 2); - lineStyle = itemModel.getModel('lineStyle.normal').getLineStyle(); - hoverLineStyle = itemModel.getModel('lineStyle.emphasis').getLineStyle(); + return { + cx: cx, + cy: cy, + r: r + }; + } - labelModel = itemModel.getModel('label.normal'); - hoverLabelModel = itemModel.getModel('label.emphasis'); + function formatLabel(label, labelFormatter) { + if (labelFormatter) { + if (typeof labelFormatter === 'string') { + label = labelFormatter.replace('{value}', label != null ? label : ''); + } + else if (typeof labelFormatter === 'function') { + label = labelFormatter(label); + } } - var visualColor = lineData.getItemVisual(idx, 'color'); - var visualOpacity = zrUtil.retrieve( - lineData.getItemVisual(idx, 'opacity'), - lineStyle.opacity, - 1 - ); + return label; + } - line.useStyle(zrUtil.defaults( - { - strokeNoScale: true, - fill: 'none', - stroke: visualColor, - opacity: visualOpacity - }, - lineStyle - )); - line.hoverStyle = hoverLineStyle; + var PI2 = Math.PI * 2; - // Update symbol - zrUtil.each(SYMBOL_CATEGORIES, function (symbolCategory) { - var symbol = this.childOfName(symbolCategory); - if (symbol) { - symbol.setColor(visualColor); - symbol.setStyle({ - opacity: visualOpacity - }); - } - }, this); + var GaugeView = __webpack_require__(43).extend({ - var showLabel = labelModel.getShallow('show'); - var hoverShowLabel = hoverLabelModel.getShallow('show'); + type: 'gauge', - var label = this.childOfName('label'); - var defaultLabelColor; - var defaultText; + render: function (seriesModel, ecModel, api) { - if (showLabel || hoverShowLabel) { - var rawVal = seriesModel.getRawValue(idx); - defaultText = rawVal == null - ? defaultText = lineData.getName(idx) - : isFinite(rawVal) - ? numberUtil.round(rawVal) - : rawVal; - defaultLabelColor = visualColor || '#000'; - } + this.group.removeAll(); - // label.afterUpdate = lineAfterUpdate; - if (showLabel) { - var textStyleModel = labelModel.getModel('textStyle'); - label.setStyle({ - text: zrUtil.retrieve( - seriesModel.getFormattedLabel(idx, 'normal', lineData.dataType), - defaultText - ), - textFont: textStyleModel.getFont(), - fill: textStyleModel.getTextColor() || defaultLabelColor - }); + var colorList = seriesModel.get('axisLine.lineStyle.color'); + var posInfo = parsePosition(seriesModel, api); - label.__textAlign = textStyleModel.get('align'); - label.__verticalAlign = textStyleModel.get('baseline'); - label.__position = labelModel.get('position'); - } - else { - label.setStyle('text', ''); - } - if (hoverShowLabel) { - var textStyleHoverModel = hoverLabelModel.getModel('textStyle'); + this._renderMain( + seriesModel, ecModel, api, colorList, posInfo + ); + }, - label.hoverStyle = { - text: zrUtil.retrieve( - seriesModel.getFormattedLabel(idx, 'emphasis', lineData.dataType), - defaultText - ), - textFont: textStyleHoverModel.getFont(), - fill: textStyleHoverModel.getTextColor() || defaultLabelColor - }; - } - else { - label.hoverStyle = { - text: '' - }; - } + dispose: function () {}, - label.ignore = !showLabel && !hoverShowLabel; + _renderMain: function (seriesModel, ecModel, api, colorList, posInfo) { + var group = this.group; - graphic.setHoverStyle(this); - }; + var axisLineModel = seriesModel.getModel('axisLine'); + var lineStyleModel = axisLineModel.getModel('lineStyle'); - lineProto.updateLayout = function (lineData, idx) { - this.setLinePoints(lineData.getItemLayout(idx)); - }; + var clockwise = seriesModel.get('clockwise'); + var startAngle = -seriesModel.get('startAngle') / 180 * Math.PI; + var endAngle = -seriesModel.get('endAngle') / 180 * Math.PI; - lineProto.setLinePoints = function (points) { - var linePath = this.childOfName('line'); - setLinePoints(linePath.shape, points); - linePath.dirty(); - }; + var angleRangeSpan = (endAngle - startAngle) % PI2; - zrUtil.inherits(Line, graphic.Group); + var prevEndAngle = startAngle; + var axisLineWidth = lineStyleModel.get('width'); - module.exports = Line; + for (var i = 0; i < colorList.length; i++) { + // Clamp + var percent = Math.min(Math.max(colorList[i][0], 0), 1); + var endAngle = startAngle + angleRangeSpan * percent; + var sector = new graphic.Sector({ + shape: { + startAngle: prevEndAngle, + endAngle: endAngle, + cx: posInfo.cx, + cy: posInfo.cy, + clockwise: clockwise, + r0: posInfo.r - axisLineWidth, + r: posInfo.r + }, + silent: true + }); + sector.setStyle({ + fill: colorList[i][1] + }); -/***/ }, -/* 204 */ -/***/ function(module, exports, __webpack_require__) { + sector.setStyle(lineStyleModel.getLineStyle( + // Because we use sector to simulate arc + // so the properties for stroking are useless + ['color', 'borderWidth', 'borderColor'] + )); - /** - * Line path for bezier and straight line draw - */ + group.add(sector); - var graphic = __webpack_require__(43); - var vec2 = __webpack_require__(10); + prevEndAngle = endAngle; + } - var straightLineProto = graphic.Line.prototype; - var bezierCurveProto = graphic.BezierCurve.prototype; + var getColor = function (percent) { + // Less than 0 + if (percent <= 0) { + return colorList[0][1]; + } + for (var i = 0; i < colorList.length; i++) { + if (colorList[i][0] >= percent + && (i === 0 ? 0 : colorList[i - 1][0]) < percent + ) { + return colorList[i][1]; + } + } + // More than 1 + return colorList[i - 1][1]; + }; - function isLine(shape) { - return isNaN(+shape.cpx1) || isNaN(+shape.cpy1); - } + if (!clockwise) { + var tmp = startAngle; + startAngle = endAngle; + endAngle = tmp; + } - module.exports = graphic.extendShape({ + this._renderTicks( + seriesModel, ecModel, api, getColor, posInfo, + startAngle, endAngle, clockwise + ); - type: 'ec-line', + this._renderPointer( + seriesModel, ecModel, api, getColor, posInfo, + startAngle, endAngle, clockwise + ); - style: { - stroke: '#000', - fill: null + this._renderTitle( + seriesModel, ecModel, api, getColor, posInfo + ); + this._renderDetail( + seriesModel, ecModel, api, getColor, posInfo + ); }, - shape: { - x1: 0, - y1: 0, - x2: 0, - y2: 0, - percent: 1, - cpx1: null, - cpy1: null - }, + _renderTicks: function ( + seriesModel, ecModel, api, getColor, posInfo, + startAngle, endAngle, clockwise + ) { + var group = this.group; + var cx = posInfo.cx; + var cy = posInfo.cy; + var r = posInfo.r; - buildPath: function (ctx, shape) { - (isLine(shape) ? straightLineProto : bezierCurveProto).buildPath(ctx, shape); - }, + var minVal = +seriesModel.get('min'); + var maxVal = +seriesModel.get('max'); - pointAt: function (t) { - return isLine(this.shape) - ? straightLineProto.pointAt.call(this, t) - : bezierCurveProto.pointAt.call(this, t); - }, + var splitLineModel = seriesModel.getModel('splitLine'); + var tickModel = seriesModel.getModel('axisTick'); + var labelModel = seriesModel.getModel('axisLabel'); - tangentAt: function (t) { - var shape = this.shape; - var p = isLine(shape) - ? [shape.x2 - shape.x1, shape.y2 - shape.y1] - : bezierCurveProto.tangentAt.call(this, t); - return vec2.normalize(p, p); - } - }); + var splitNumber = seriesModel.get('splitNumber'); + var subSplitNumber = tickModel.get('splitNumber'); + var splitLineLen = parsePercent( + splitLineModel.get('length'), r + ); + var tickLen = parsePercent( + tickModel.get('length'), r + ); -/***/ }, -/* 205 */ -/***/ function(module, exports, __webpack_require__) { + var angle = startAngle; + var step = (endAngle - startAngle) / splitNumber; + var subStep = step / subSplitNumber; - + var splitLineStyle = splitLineModel.getModel('lineStyle').getLineStyle(); + var tickLineStyle = tickModel.getModel('lineStyle').getLineStyle(); + var textStyleModel = labelModel.getModel('textStyle'); - var curveTool = __webpack_require__(50); - var vec2 = __webpack_require__(10); + for (var i = 0; i <= splitNumber; i++) { + var unitX = Math.cos(angle); + var unitY = Math.sin(angle); + // Split line + if (splitLineModel.get('show')) { + var splitLine = new graphic.Line({ + shape: { + x1: unitX * r + cx, + y1: unitY * r + cy, + x2: unitX * (r - splitLineLen) + cx, + y2: unitY * (r - splitLineLen) + cy + }, + style: splitLineStyle, + silent: true + }); + if (splitLineStyle.stroke === 'auto') { + splitLine.setStyle({ + stroke: getColor(i / splitNumber) + }); + } - var v1 = []; - var v2 = []; - var v3 = []; - var quadraticAt = curveTool.quadraticAt; - var v2DistSquare = vec2.distSquare; - var mathAbs = Math.abs; - function intersectCurveCircle(curvePoints, center, radius) { - var p0 = curvePoints[0]; - var p1 = curvePoints[1]; - var p2 = curvePoints[2]; + group.add(splitLine); + } - var d = Infinity; - var t; - var radiusSquare = radius * radius; - var interval = 0.1; + // Label + if (labelModel.get('show')) { + var label = formatLabel( + numberUtil.round(i / splitNumber * (maxVal - minVal) + minVal), + labelModel.get('formatter') + ); + var distance = labelModel.get('distance'); - for (var _t = 0.1; _t <= 0.9; _t += 0.1) { - v1[0] = quadraticAt(p0[0], p1[0], p2[0], _t); - v1[1] = quadraticAt(p0[1], p1[1], p2[1], _t); - var diff = mathAbs(v2DistSquare(v1, center) - radiusSquare); - if (diff < d) { - d = diff; - t = _t; - } - } + var text = new graphic.Text({ + style: { + text: label, + x: unitX * (r - splitLineLen - distance) + cx, + y: unitY * (r - splitLineLen - distance) + cy, + fill: textStyleModel.getTextColor(), + textFont: textStyleModel.getFont(), + textVerticalAlign: unitY < -0.4 ? 'top' : (unitY > 0.4 ? 'bottom' : 'middle'), + textAlign: unitX < -0.4 ? 'left' : (unitX > 0.4 ? 'right' : 'center') + }, + silent: true + }); + if (text.style.fill === 'auto') { + text.setStyle({ + fill: getColor(i / splitNumber) + }); + } - // Assume the segment is monotone,Find root through Bisection method - // At most 32 iteration - for (var i = 0; i < 32; i++) { - // var prev = t - interval; - var next = t + interval; - // v1[0] = quadraticAt(p0[0], p1[0], p2[0], prev); - // v1[1] = quadraticAt(p0[1], p1[1], p2[1], prev); - v2[0] = quadraticAt(p0[0], p1[0], p2[0], t); - v2[1] = quadraticAt(p0[1], p1[1], p2[1], t); - v3[0] = quadraticAt(p0[0], p1[0], p2[0], next); - v3[1] = quadraticAt(p0[1], p1[1], p2[1], next); + group.add(text); + } - var diff = v2DistSquare(v2, center) - radiusSquare; - if (mathAbs(diff) < 1e-2) { - break; - } + // Axis tick + if (tickModel.get('show') && i !== splitNumber) { + for (var j = 0; j <= subSplitNumber; j++) { + var unitX = Math.cos(angle); + var unitY = Math.sin(angle); + var tickLine = new graphic.Line({ + shape: { + x1: unitX * r + cx, + y1: unitY * r + cy, + x2: unitX * (r - tickLen) + cx, + y2: unitY * (r - tickLen) + cy + }, + silent: true, + style: tickLineStyle + }); - // var prevDiff = v2DistSquare(v1, center) - radiusSquare; - var nextDiff = v2DistSquare(v3, center) - radiusSquare; + if (tickLineStyle.stroke === 'auto') { + tickLine.setStyle({ + stroke: getColor((i + j / subSplitNumber) / splitNumber) + }); + } - interval /= 2; - if (diff < 0) { - if (nextDiff >= 0) { - t = t + interval; - } - else { - t = t - interval; - } - } - else { - if (nextDiff >= 0) { - t = t - interval; + group.add(tickLine); + angle += subStep; + } + angle -= subStep; } else { - t = t + interval; + angle += step; } } - } + }, - return t; - } - // Adjust edge to avoid - module.exports = function (graph, scale) { - var tmp0 = []; - var quadraticSubdivide = curveTool.quadraticSubdivide; - var pts = [[], [], []]; - var pts2 = [[], []]; - var v = []; - scale /= 2; + _renderPointer: function ( + seriesModel, ecModel, api, getColor, posInfo, + startAngle, endAngle, clockwise + ) { - function getSymbolSize(node) { - var symbolSize = node.getVisual('symbolSize'); - if (symbolSize instanceof Array) { - symbolSize = (symbolSize[0] + symbolSize[1]) / 2; - } - return symbolSize; - } - graph.eachEdge(function (edge, idx) { - var linePoints = edge.getLayout(); - var fromSymbol = edge.getVisual('fromSymbol'); - var toSymbol = edge.getVisual('toSymbol'); + var group = this.group; + var oldData = this._data; - if (!linePoints.__original) { - linePoints.__original = [ - vec2.clone(linePoints[0]), - vec2.clone(linePoints[1]) - ]; - if (linePoints[2]) { - linePoints.__original.push(vec2.clone(linePoints[2])); - } + if (!seriesModel.get('pointer.show')) { + // Remove old element + oldData && oldData.eachItemGraphicEl(function (el) { + group.remove(el); + }); + return; } - var originalPoints = linePoints.__original; - // Quadratic curve - if (linePoints[2] != null) { - vec2.copy(pts[0], originalPoints[0]); - vec2.copy(pts[1], originalPoints[2]); - vec2.copy(pts[2], originalPoints[1]); - if (fromSymbol && fromSymbol != 'none') { - var symbolSize = getSymbolSize(edge.node1); - var t = intersectCurveCircle(pts, originalPoints[0], symbolSize * scale); - // Subdivide and get the second - quadraticSubdivide(pts[0][0], pts[1][0], pts[2][0], t, tmp0); - pts[0][0] = tmp0[3]; - pts[1][0] = tmp0[4]; - quadraticSubdivide(pts[0][1], pts[1][1], pts[2][1], t, tmp0); - pts[0][1] = tmp0[3]; - pts[1][1] = tmp0[4]; - } - if (toSymbol && toSymbol != 'none') { - var symbolSize = getSymbolSize(edge.node2); + var valueExtent = [+seriesModel.get('min'), +seriesModel.get('max')]; + var angleExtent = [startAngle, endAngle]; - var t = intersectCurveCircle(pts, originalPoints[1], symbolSize * scale); - // Subdivide and get the first - quadraticSubdivide(pts[0][0], pts[1][0], pts[2][0], t, tmp0); - pts[1][0] = tmp0[1]; - pts[2][0] = tmp0[2]; - quadraticSubdivide(pts[0][1], pts[1][1], pts[2][1], t, tmp0); - pts[1][1] = tmp0[1]; - pts[2][1] = tmp0[2]; + var data = seriesModel.getData(); + + data.diff(oldData) + .add(function (idx) { + var pointer = new PointerPath({ + shape: { + angle: startAngle + } + }); + + graphic.updateProps(pointer, { + shape: { + angle: numberUtil.linearMap(data.get('value', idx), valueExtent, angleExtent, true) + } + }, seriesModel); + + group.add(pointer); + data.setItemGraphicEl(idx, pointer); + }) + .update(function (newIdx, oldIdx) { + var pointer = oldData.getItemGraphicEl(oldIdx); + + graphic.updateProps(pointer, { + shape: { + angle: numberUtil.linearMap(data.get('value', newIdx), valueExtent, angleExtent, true) + } + }, seriesModel); + + group.add(pointer); + data.setItemGraphicEl(newIdx, pointer); + }) + .remove(function (idx) { + var pointer = oldData.getItemGraphicEl(idx); + group.remove(pointer); + }) + .execute(); + + data.eachItemGraphicEl(function (pointer, idx) { + var itemModel = data.getItemModel(idx); + var pointerModel = itemModel.getModel('pointer'); + + pointer.setShape({ + x: posInfo.cx, + y: posInfo.cy, + width: parsePercent( + pointerModel.get('width'), posInfo.r + ), + r: parsePercent(pointerModel.get('length'), posInfo.r) + }); + + pointer.useStyle(itemModel.getModel('itemStyle.normal').getItemStyle()); + + if (pointer.style.fill === 'auto') { + pointer.setStyle('fill', getColor( + numberUtil.linearMap(data.get('value', idx), valueExtent, [0, 1], true) + )); } - // Copy back to layout - vec2.copy(linePoints[0], pts[0]); - vec2.copy(linePoints[1], pts[2]); - vec2.copy(linePoints[2], pts[1]); - } - // Line - else { - vec2.copy(pts2[0], originalPoints[0]); - vec2.copy(pts2[1], originalPoints[1]); - vec2.sub(v, pts2[1], pts2[0]); - vec2.normalize(v, v); - if (fromSymbol && fromSymbol != 'none') { + graphic.setHoverStyle( + pointer, itemModel.getModel('itemStyle.emphasis').getItemStyle() + ); + }); - var symbolSize = getSymbolSize(edge.node1); + this._data = data; + }, - vec2.scaleAndAdd(pts2[0], pts2[0], v, symbolSize * scale); + _renderTitle: function ( + seriesModel, ecModel, api, getColor, posInfo + ) { + var titleModel = seriesModel.getModel('title'); + if (titleModel.get('show')) { + var textStyleModel = titleModel.getModel('textStyle'); + var offsetCenter = titleModel.get('offsetCenter'); + var x = posInfo.cx + parsePercent(offsetCenter[0], posInfo.r); + var y = posInfo.cy + parsePercent(offsetCenter[1], posInfo.r); + + var text = new graphic.Text({ + style: { + x: x, + y: y, + // FIXME First data name ? + text: seriesModel.getData().getName(0), + fill: textStyleModel.getTextColor(), + textFont: textStyleModel.getFont(), + textAlign: 'center', + textVerticalAlign: 'middle' + } + }); + + if (text.style.fill === 'auto') { + var minVal = +seriesModel.get('min'); + var maxVal = +seriesModel.get('max'); + var value = seriesModel.getData().get('value', 0); + text.setStyle('fill', getColor( + numberUtil.linearMap(value, [minVal, maxVal], [0, 1], true) + )); } - if (toSymbol && toSymbol != 'none') { - var symbolSize = getSymbolSize(edge.node2); - vec2.scaleAndAdd(pts2[1], pts2[1], v, -symbolSize * scale); + this.group.add(text); + } + }, + + _renderDetail: function ( + seriesModel, ecModel, api, getColor, posInfo + ) { + var detailModel = seriesModel.getModel('detail'); + var minVal = +seriesModel.get('min'); + var maxVal = +seriesModel.get('max'); + if (detailModel.get('show')) { + var textStyleModel = detailModel.getModel('textStyle'); + var offsetCenter = detailModel.get('offsetCenter'); + var x = posInfo.cx + parsePercent(offsetCenter[0], posInfo.r); + var y = posInfo.cy + parsePercent(offsetCenter[1], posInfo.r); + var width = parsePercent(detailModel.get('width'), posInfo.r); + var height = parsePercent(detailModel.get('height'), posInfo.r); + var value = seriesModel.getData().get('value', 0); + var rect = new graphic.Rect({ + shape: { + x: x - width / 2, + y: y - height / 2, + width: width, + height: height + }, + style: { + text: formatLabel( + // FIXME First data name ? + value, detailModel.get('formatter') + ), + fill: detailModel.get('backgroundColor'), + textFill: textStyleModel.getTextColor(), + textFont: textStyleModel.getFont() + } + }); + if (rect.style.textFill === 'auto') { + rect.setStyle('textFill', getColor( + numberUtil.linearMap(value, [minVal, maxVal], [0, 1], true) + )); } - vec2.copy(linePoints[0], pts2[0]); - vec2.copy(linePoints[1], pts2[1]); + rect.setStyle(detailModel.getItemStyle(['color'])); + this.group.add(rect); } - }); - }; + } + }); + + module.exports = GaugeView; /***/ }, -/* 206 */ +/* 235 */ /***/ function(module, exports, __webpack_require__) { - var echarts = __webpack_require__(1); - var roamHelper = __webpack_require__(180); + module.exports = __webpack_require__(46).extend({ - var actionInfo = { - type: 'graphRoam', - event: 'graphRoam', - update: 'none' - }; + type: 'echartsGaugePointer', - /** - * @payload - * @property {string} name Series name - * @property {number} [dx] - * @property {number} [dy] - * @property {number} [zoom] - * @property {number} [originX] - * @property {number} [originY] - */ - echarts.registerAction(actionInfo, function (payload, ecModel) { - ecModel.eachComponent({mainType: 'series', query: payload}, function (seriesModel) { - var coordSys = seriesModel.coordinateSystem; + shape: { + angle: 0, - var res = roamHelper.updateCenterAndZoom(coordSys, payload); + width: 10, - seriesModel.setCenter - && seriesModel.setCenter(res.center); + r: 10, - seriesModel.setZoom - && seriesModel.setZoom(res.zoom); - }); - }); + x: 0, + y: 0 + }, - /** - * @payload - * @property {number} [seriesIndex] - * @property {string} [seriesId] - * @property {string} [seriesName] - * @property {number} [dataIndex] - */ - echarts.registerAction({ - type: 'focusNodeAdjacency', - event: 'focusNodeAdjacency', - update: 'series.graph:focusNodeAdjacency' - }, function () {}); + buildPath: function (ctx, shape) { + var mathCos = Math.cos; + var mathSin = Math.sin; - /** - * @payload - * @property {number} [seriesIndex] - * @property {string} [seriesId] - * @property {string} [seriesName] - */ - echarts.registerAction({ - type: 'unfocusNodeAdjacency', - event: 'unfocusNodeAdjacency', - update: 'series.graph:unfocusNodeAdjacency' - }, function () {}); + var r = shape.r; + var width = shape.width; + var angle = shape.angle; + var x = shape.x - mathCos(angle) * width * (width >= r / 3 ? 1 : 2); + var y = shape.y - mathSin(angle) * width * (width >= r / 3 ? 1 : 2); + angle = shape.angle - Math.PI / 2; + ctx.moveTo(x, y); + ctx.lineTo( + shape.x + mathCos(angle) * width, + shape.y + mathSin(angle) * width + ); + ctx.lineTo( + shape.x + mathCos(shape.angle) * r, + shape.y + mathSin(shape.angle) * r + ); + ctx.lineTo( + shape.x - mathCos(angle) * width, + shape.y - mathSin(angle) * width + ); + ctx.lineTo(x, y); + return; + } + }); /***/ }, -/* 207 */ -/***/ function(module, exports) { +/* 236 */ +/***/ function(module, exports, __webpack_require__) { - module.exports = function (ecModel) { - var legendModels = ecModel.findComponents({ - mainType: 'legend' - }); - if (!legendModels || !legendModels.length) { - return; - } - ecModel.eachSeriesByType('graph', function (graphSeries) { - var categoriesData = graphSeries.getCategoriesData(); - var graph = graphSeries.getGraph(); - var data = graph.data; + var zrUtil = __webpack_require__(4); + var echarts = __webpack_require__(1); - var categoryNames = categoriesData.mapArray(categoriesData.getName); + __webpack_require__(237); + __webpack_require__(238); - data.filterSelf(function (idx) { - var model = data.getItemModel(idx); - var category = model.getShallow('category'); - if (category != null) { - if (typeof category === 'number') { - category = categoryNames[category]; - } - // If in any legend component the status is not selected. - for (var i = 0; i < legendModels.length; i++) { - if (!legendModels[i].isSelected(category)) { - return false; - } - } - } - return true; - }); - }, this); - }; + echarts.registerVisual(zrUtil.curry(__webpack_require__(160), 'funnel')); + echarts.registerLayout(__webpack_require__(239)); + + echarts.registerProcessor(zrUtil.curry(__webpack_require__(163), 'funnel')); /***/ }, -/* 208 */ -/***/ function(module, exports) { +/* 237 */ +/***/ function(module, exports, __webpack_require__) { - + 'use strict'; - module.exports = function (ecModel) { - var paletteScope = {}; - ecModel.eachSeriesByType('graph', function (seriesModel) { - var categoriesData = seriesModel.getCategoriesData(); - var data = seriesModel.getData(); + var List = __webpack_require__(98); + var modelUtil = __webpack_require__(5); + var completeDimensions = __webpack_require__(103); - var categoryNameIdxMap = {}; + var FunnelSeries = __webpack_require__(1).extendSeriesModel({ - categoriesData.each(function (idx) { - var name = categoriesData.getName(idx); - categoryNameIdxMap[name] = idx; + type: 'series.funnel', - var itemModel = categoriesData.getItemModel(idx); - var color = itemModel.get('itemStyle.normal.color') - || seriesModel.getColorFromPalette(name, paletteScope); - categoriesData.setItemVisual(idx, 'color', color); - }); + init: function (option) { + FunnelSeries.superApply(this, 'init', arguments); - // Assign category color to visual - if (categoriesData.count()) { - data.each(function (idx) { - var model = data.getItemModel(idx); - var category = model.getShallow('category'); - if (category != null) { - if (typeof category === 'string') { - category = categoryNameIdxMap[category]; - } - if (!data.getItemVisual(idx, 'color', true)) { - data.setItemVisual( - idx, 'color', - categoriesData.getItemVisual(category, 'color') - ); - } - } - }); - } - }); - }; + // Enable legend selection for each data item + // Use a function instead of direct access because data reference may changed + this.legendDataProvider = function () { + return this.getRawData(); + }; + // Extend labelLine emphasis + this._defaultLabelLine(option); + }, + getInitialData: function (option, ecModel) { + var dimensions = completeDimensions(['value'], option.data); + var list = new List(dimensions, this); + list.initData(option.data); + return list; + }, -/***/ }, -/* 209 */ -/***/ function(module, exports) { + _defaultLabelLine: function (option) { + // Extend labelLine emphasis + modelUtil.defaultEmphasis(option.labelLine, ['show']); - + var labelLineNormalOpt = option.labelLine.normal; + var labelLineEmphasisOpt = option.labelLine.emphasis; + // Not show label line if `label.normal.show = false` + labelLineNormalOpt.show = labelLineNormalOpt.show + && option.label.normal.show; + labelLineEmphasisOpt.show = labelLineEmphasisOpt.show + && option.label.emphasis.show; + }, - function normalize(a) { - if (!(a instanceof Array)) { - a = [a, a]; - } - return a; - } - module.exports = function (ecModel) { - ecModel.eachSeriesByType('graph', function (seriesModel) { - var graph = seriesModel.getGraph(); - var edgeData = seriesModel.getEdgeData(); - var symbolType = normalize(seriesModel.get('edgeSymbol')); - var symbolSize = normalize(seriesModel.get('edgeSymbolSize')); + // Overwrite + getDataParams: function (dataIndex) { + var data = this.getData(); + var params = FunnelSeries.superCall(this, 'getDataParams', dataIndex); + var sum = data.getSum('value'); + // Percent is 0 if sum is 0 + params.percent = !sum ? 0 : +(data.get('value', dataIndex) / sum * 100).toFixed(2); - var colorQuery = 'lineStyle.normal.color'.split('.'); - var opacityQuery = 'lineStyle.normal.opacity'.split('.'); + params.$vars.push('percent'); + return params; + }, - edgeData.setVisual('fromSymbol', symbolType && symbolType[0]); - edgeData.setVisual('toSymbol', symbolType && symbolType[1]); - edgeData.setVisual('fromSymbolSize', symbolSize && symbolSize[0]); - edgeData.setVisual('toSymbolSize', symbolSize && symbolSize[1]); - edgeData.setVisual('color', seriesModel.get(colorQuery)); - edgeData.setVisual('opacity', seriesModel.get(opacityQuery)); + defaultOption: { + zlevel: 0, // 一级层叠 + z: 2, // 二级层叠 + legendHoverLink: true, + left: 80, + top: 60, + right: 80, + bottom: 60, + // width: {totalWidth} - left - right, + // height: {totalHeight} - top - bottom, - edgeData.each(function (idx) { - var itemModel = edgeData.getItemModel(idx); - var edge = graph.getEdgeByIndex(idx); - var symbolType = normalize(itemModel.getShallow('symbol', true)); - var symbolSize = normalize(itemModel.getShallow('symbolSize', true)); - // Edge visual must after node visual - var color = itemModel.get(colorQuery); - var opacity = itemModel.get(opacityQuery); - switch (color) { - case 'source': - color = edge.node1.getVisual('color'); - break; - case 'target': - color = edge.node2.getVisual('color'); - break; + // 默认取数据最小最大值 + // min: 0, + // max: 100, + minSize: '0%', + maxSize: '100%', + sort: 'descending', // 'ascending', 'descending' + gap: 0, + funnelAlign: 'center', + label: { + normal: { + show: true, + position: 'outer' + // formatter: 标签文本格式器,同Tooltip.formatter,不支持异步回调 + // textStyle: null // 默认使用全局文本样式,详见TEXTSTYLE + }, + emphasis: { + show: true + } + }, + labelLine: { + normal: { + show: true, + length: 20, + lineStyle: { + // color: 各异, + width: 1, + type: 'solid' + } + }, + emphasis: {} + }, + itemStyle: { + normal: { + // color: 各异, + borderColor: '#fff', + borderWidth: 1 + }, + emphasis: { + // color: 各异, } + } + } + }); - symbolType[0] && edge.setVisual('fromSymbol', symbolType[0]); - symbolType[1] && edge.setVisual('toSymbol', symbolType[1]); - symbolSize[0] && edge.setVisual('fromSymbolSize', symbolSize[0]); - symbolSize[1] && edge.setVisual('toSymbolSize', symbolSize[1]); + module.exports = FunnelSeries; - edge.setVisual('color', color); - edge.setVisual('opacity', opacity); - }); - }); - }; /***/ }, -/* 210 */ +/* 238 */ /***/ function(module, exports, __webpack_require__) { - var simpleLayoutHelper = __webpack_require__(211); - var simpleLayoutEdge = __webpack_require__(212); - module.exports = function (ecModel, api) { - ecModel.eachSeriesByType('graph', function (seriesModel) { - var layout = seriesModel.get('layout'); - var coordSys = seriesModel.coordinateSystem; - if (coordSys && coordSys.type !== 'view') { - var data = seriesModel.getData(); - data.each(coordSys.dimensions, function (x, y, idx) { - if (!isNaN(x) && !isNaN(y)) { - data.setItemLayout(idx, coordSys.dataToPoint([x, y])); - } - else { - // Also {Array.}, not undefined to avoid if...else... statement - data.setItemLayout(idx, [NaN, NaN]); - } - }); - - simpleLayoutEdge(data.graph); - } - else if (!layout || layout === 'none') { - simpleLayoutHelper(seriesModel); - } - }); - }; + var graphic = __webpack_require__(44); + var zrUtil = __webpack_require__(4); + /** + * Piece of pie including Sector, Label, LabelLine + * @constructor + * @extends {module:zrender/graphic/Group} + */ + function FunnelPiece(data, idx) { -/***/ }, -/* 211 */ -/***/ function(module, exports, __webpack_require__) { + graphic.Group.call(this); - + var polygon = new graphic.Polygon(); + var labelLine = new graphic.Polyline(); + var text = new graphic.Text(); + this.add(polygon); + this.add(labelLine); + this.add(text); - var simpleLayoutEdge = __webpack_require__(212); + this.updateData(data, idx, true); - module.exports = function (seriesModel) { - var coordSys = seriesModel.coordinateSystem; - if (coordSys && coordSys.type !== 'view') { - return; + // Hover to change label and labelLine + function onEmphasis() { + labelLine.ignore = labelLine.hoverIgnore; + text.ignore = text.hoverIgnore; } - var graph = seriesModel.getGraph(); + function onNormal() { + labelLine.ignore = labelLine.normalIgnore; + text.ignore = text.normalIgnore; + } + this.on('emphasis', onEmphasis) + .on('normal', onNormal) + .on('mouseover', onEmphasis) + .on('mouseout', onNormal); + } - graph.eachNode(function (node) { - var model = node.getModel(); - node.setLayout([+model.get('x'), +model.get('y')]); - }); + var funnelPieceProto = FunnelPiece.prototype; + + function getLabelStyle(data, idx, state, labelModel) { + var textStyleModel = labelModel.getModel('textStyle'); + var position = labelModel.get('position'); + var isLabelInside = position === 'inside' || position === 'inner' || position === 'center'; + return { + fill: textStyleModel.getTextColor() + || (isLabelInside ? '#fff' : data.getItemVisual(idx, 'color')), + textFont: textStyleModel.getFont(), + text: zrUtil.retrieve( + data.hostModel.getFormattedLabel(idx, state), + data.getName(idx) + ) + }; + } + + var opacityAccessPath = ['itemStyle', 'normal', 'opacity']; + funnelPieceProto.updateData = function (data, idx, firstCreate) { + + var polygon = this.childAt(0); + + var seriesModel = data.hostModel; + var itemModel = data.getItemModel(idx); + var layout = data.getItemLayout(idx); + var opacity = data.getItemModel(idx).get(opacityAccessPath); + opacity = opacity == null ? 1 : opacity; + + // Reset style + polygon.useStyle({}); + + if (firstCreate) { + polygon.setShape({ + points: layout.points + }); + polygon.setStyle({ opacity : 0 }); + graphic.initProps(polygon, { + style: { + opacity: opacity + } + }, seriesModel, idx); + } + else { + graphic.updateProps(polygon, { + style: { + opacity: opacity + }, + shape: { + points: layout.points + } + }, seriesModel, idx); + } - simpleLayoutEdge(graph); - }; + // Update common style + var itemStyleModel = itemModel.getModel('itemStyle'); + var visualColor = data.getItemVisual(idx, 'color'); + polygon.setStyle( + zrUtil.defaults( + { + lineJoin: 'round', + fill: visualColor + }, + itemStyleModel.getModel('normal').getItemStyle(['opacity']) + ) + ); + polygon.hoverStyle = itemStyleModel.getModel('emphasis').getItemStyle(); -/***/ }, -/* 212 */ -/***/ function(module, exports, __webpack_require__) { + this._updateLabel(data, idx); - - var vec2 = __webpack_require__(10); - module.exports = function (graph) { - graph.eachEdge(function (edge) { - var curveness = edge.getModel().get('lineStyle.normal.curveness') || 0; - var p1 = vec2.clone(edge.node1.getLayout()); - var p2 = vec2.clone(edge.node2.getLayout()); - var points = [p1, p2]; - if (+curveness) { - points.push([ - (p1[0] + p2[0]) / 2 - (p1[1] - p2[1]) * curveness, - (p1[1] + p2[1]) / 2 - (p2[0] - p1[0]) * curveness - ]); - } - edge.setLayout(points); - }); + graphic.setHoverStyle(this); }; + funnelPieceProto._updateLabel = function (data, idx) { -/***/ }, -/* 213 */ -/***/ function(module, exports, __webpack_require__) { - - - var circularLayoutHelper = __webpack_require__(214); - module.exports = function (ecModel) { - ecModel.eachSeriesByType('graph', function (seriesModel) { - if (seriesModel.get('layout') === 'circular') { - circularLayoutHelper(seriesModel); - } - }); - }; + var labelLine = this.childAt(1); + var labelText = this.childAt(2); + var seriesModel = data.hostModel; + var itemModel = data.getItemModel(idx); + var layout = data.getItemLayout(idx); + var labelLayout = layout.label; + var visualColor = data.getItemVisual(idx, 'color'); -/***/ }, -/* 214 */ -/***/ function(module, exports, __webpack_require__) { + graphic.updateProps(labelLine, { + shape: { + points: labelLayout.linePoints || labelLayout.linePoints + } + }, seriesModel, idx); - - var vec2 = __webpack_require__(10); - module.exports = function (seriesModel) { - var coordSys = seriesModel.coordinateSystem; - if (coordSys && coordSys.type !== 'view') { - return; - } + graphic.updateProps(labelText, { + style: { + x: labelLayout.x, + y: labelLayout.y + } + }, seriesModel, idx); + labelText.attr({ + style: { + textAlign: labelLayout.textAlign, + textVerticalAlign: labelLayout.verticalAlign, + textFont: labelLayout.font + }, + rotation: labelLayout.rotation, + origin: [labelLayout.x, labelLayout.y], + z2: 10 + }); - var rect = coordSys.getBoundingRect(); + var labelModel = itemModel.getModel('label.normal'); + var labelHoverModel = itemModel.getModel('label.emphasis'); + var labelLineModel = itemModel.getModel('labelLine.normal'); + var labelLineHoverModel = itemModel.getModel('labelLine.emphasis'); - var nodeData = seriesModel.getData(); - var graph = nodeData.graph; + labelText.setStyle(getLabelStyle(data, idx, 'normal', labelModel)); - var angle = 0; - var sum = nodeData.getSum('value'); - var unitAngle = Math.PI * 2 / (sum || nodeData.count()); + labelText.ignore = labelText.normalIgnore = !labelModel.get('show'); + labelText.hoverIgnore = !labelHoverModel.get('show'); - var cx = rect.width / 2 + rect.x; - var cy = rect.height / 2 + rect.y; + labelLine.ignore = labelLine.normalIgnore = !labelLineModel.get('show'); + labelLine.hoverIgnore = !labelLineHoverModel.get('show'); - var r = Math.min(rect.width, rect.height) / 2; + // Default use item visual color + labelLine.setStyle({ + stroke: visualColor + }); + labelLine.setStyle(labelLineModel.getModel('lineStyle').getLineStyle()); - graph.eachNode(function (node) { - var value = node.getValue('value'); + labelText.hoverStyle = getLabelStyle(data, idx, 'emphasis', labelHoverModel); + labelLine.hoverStyle = labelLineHoverModel.getModel('lineStyle').getLineStyle(); + }; - angle += unitAngle * (sum ? value : 1) / 2; + zrUtil.inherits(FunnelPiece, graphic.Group); - node.setLayout([ - r * Math.cos(angle) + cx, - r * Math.sin(angle) + cy - ]); - angle += unitAngle * (sum ? value : 1) / 2; - }); + var Funnel = __webpack_require__(43).extend({ - nodeData.setLayout({ - cx: cx, - cy: cy - }); + type: 'funnel', - graph.eachEdge(function (edge) { - var curveness = edge.getModel().get('lineStyle.normal.curveness') || 0; - var p1 = vec2.clone(edge.node1.getLayout()); - var p2 = vec2.clone(edge.node2.getLayout()); - var cp1; - var x12 = (p1[0] + p2[0]) / 2; - var y12 = (p1[1] + p2[1]) / 2; - if (+curveness) { - curveness *= 3; - cp1 = [ - cx * curveness + x12 * (1 - curveness), - cy * curveness + y12 * (1 - curveness) - ]; - } - edge.setLayout([p1, p2, cp1]); - }); - }; + render: function (seriesModel, ecModel, api) { + var data = seriesModel.getData(); + var oldData = this._data; + var group = this.group; -/***/ }, -/* 215 */ -/***/ function(module, exports, __webpack_require__) { + data.diff(oldData) + .add(function (idx) { + var funnelPiece = new FunnelPiece(data, idx); - + data.setItemGraphicEl(idx, funnelPiece); - var forceHelper = __webpack_require__(216); - var numberUtil = __webpack_require__(7); - var simpleLayoutHelper = __webpack_require__(211); - var circularLayoutHelper = __webpack_require__(214); - var vec2 = __webpack_require__(10); - var zrUtil = __webpack_require__(4); + group.add(funnelPiece); + }) + .update(function (newIdx, oldIdx) { + var piePiece = oldData.getItemGraphicEl(oldIdx); - module.exports = function (ecModel) { - ecModel.eachSeriesByType('graph', function (graphSeries) { - var coordSys = graphSeries.coordinateSystem; - if (coordSys && coordSys.type !== 'view') { - return; - } - if (graphSeries.get('layout') === 'force') { - var preservedPoints = graphSeries.preservedPoints || {}; - var graph = graphSeries.getGraph(); - var nodeData = graph.data; - var edgeData = graph.edgeData; - var forceModel = graphSeries.getModel('force'); - var initLayout = forceModel.get('initLayout'); - if (graphSeries.preservedPoints) { - nodeData.each(function (idx) { - var id = nodeData.getId(idx); - nodeData.setItemLayout(idx, preservedPoints[id] || [NaN, NaN]); - }); - } - else if (!initLayout || initLayout === 'none') { - simpleLayoutHelper(graphSeries); - } - else if (initLayout === 'circular') { - circularLayoutHelper(graphSeries); - } + piePiece.updateData(data, newIdx); - var nodeDataExtent = nodeData.getDataExtent('value'); - var edgeDataExtent = edgeData.getDataExtent('value'); - // var edgeDataExtent = edgeData.getDataExtent('value'); - var repulsion = forceModel.get('repulsion'); - var edgeLength = forceModel.get('edgeLength'); - if (!zrUtil.isArray(repulsion)) { - repulsion = [repulsion, repulsion]; - } - if (!zrUtil.isArray(edgeLength)) { - edgeLength = [edgeLength, edgeLength]; - } - // Larger value has smaller length - edgeLength = [edgeLength[1], edgeLength[0]]; + group.add(piePiece); + data.setItemGraphicEl(newIdx, piePiece); + }) + .remove(function (idx) { + var piePiece = oldData.getItemGraphicEl(idx); + group.remove(piePiece); + }) + .execute(); - var nodes = nodeData.mapArray('value', function (value, idx) { - var point = nodeData.getItemLayout(idx); - // var w = numberUtil.linearMap(value, nodeDataExtent, [0, 50]); - var rep = numberUtil.linearMap(value, nodeDataExtent, repulsion); - if (isNaN(rep)) { - rep = (repulsion[0] + repulsion[1]) / 2; - } - return { - w: rep, - rep: rep, - p: (!point || isNaN(point[0]) || isNaN(point[1])) ? null : point - }; - }); - var edges = edgeData.mapArray('value', function (value, idx) { - var edge = graph.getEdgeByIndex(idx); - var d = numberUtil.linearMap(value, edgeDataExtent, edgeLength); - if (isNaN(d)) { - d = (edgeLength[0] + edgeLength[1]) / 2; - } - return { - n1: nodes[edge.node1.dataIndex], - n2: nodes[edge.node2.dataIndex], - d: d, - curveness: edge.getModel().get('lineStyle.normal.curveness') || 0 - }; - }); + this._data = data; + }, - var coordSys = graphSeries.coordinateSystem; - var rect = coordSys.getBoundingRect(); - var forceInstance = forceHelper(nodes, edges, { - rect: rect, - gravity: forceModel.get('gravity') - }); - var oldStep = forceInstance.step; - forceInstance.step = function (cb) { - for (var i = 0, l = nodes.length; i < l; i++) { - if (nodes[i].fixed) { - // Write back to layout instance - vec2.copy(nodes[i].p, graph.getNodeByIndex(i).getLayout()); - } - } - oldStep(function (nodes, edges, stopped) { - for (var i = 0, l = nodes.length; i < l; i++) { - if (!nodes[i].fixed) { - graph.getNodeByIndex(i).setLayout(nodes[i].p); - } - preservedPoints[nodeData.getId(i)] = nodes[i].p; - } - for (var i = 0, l = edges.length; i < l; i++) { - var e = edges[i]; - var edge = graph.getEdgeByIndex(i); - var p1 = e.n1.p; - var p2 = e.n2.p; - var points = edge.getLayout(); - points = points ? points.slice() : []; - points[0] = points[0] || []; - points[1] = points[1] || []; - vec2.copy(points[0], p1); - vec2.copy(points[1], p2); - if (+e.curveness) { - points[2] = [ - (p1[0] + p2[0]) / 2 - (p1[1] - p2[1]) * e.curveness, - (p1[1] + p2[1]) / 2 - (p2[0] - p1[0]) * e.curveness - ]; - } - edge.setLayout(points); - } - // Update layout + remove: function () { + this.group.removeAll(); + this._data = null; + }, - cb && cb(stopped); - }); - }; - graphSeries.forceLayout = forceInstance; - graphSeries.preservedPoints = preservedPoints; + dispose: function () {} + }); - // Step to get the layout - forceInstance.step(); - } - else { - // Remove prev injected forceLayout instance - graphSeries.forceLayout = null; - } - }); - }; + module.exports = Funnel; /***/ }, -/* 216 */ +/* 239 */ /***/ function(module, exports, __webpack_require__) { - var vec2 = __webpack_require__(10); - var scaleAndAdd = vec2.scaleAndAdd; - - // function adjacentNode(n, e) { - // return e.n1 === n ? e.n2 : e.n1; - // } + var layout = __webpack_require__(21); + var number = __webpack_require__(7); - module.exports = function (nodes, edges, opts) { - var rect = opts.rect; - var width = rect.width; - var height = rect.height; - var center = [rect.x + width / 2, rect.y + height / 2]; - // var scale = opts.scale || 1; - var gravity = opts.gravity == null ? 0.1 : opts.gravity; + var parsePercent = number.parsePercent; - // for (var i = 0; i < edges.length; i++) { - // var e = edges[i]; - // var n1 = e.n1; - // var n2 = e.n2; - // n1.edges = n1.edges || []; - // n2.edges = n2.edges || []; - // n1.edges.push(e); - // n2.edges.push(e); - // } - // Init position - for (var i = 0; i < nodes.length; i++) { - var n = nodes[i]; - if (!n.p) { - // Use the position from first adjecent node with defined position - // Or use a random position - // From d3 - // if (n.edges) { - // var j = -1; - // while (++j < n.edges.length) { - // var e = n.edges[j]; - // var other = adjacentNode(n, e); - // if (other.p) { - // n.p = vec2.clone(other.p); - // break; - // } - // } - // } - // if (!n.p) { - n.p = vec2.create( - width * (Math.random() - 0.5) + center[0], - height * (Math.random() - 0.5) + center[1] - ); - // } + function getViewRect(seriesModel, api) { + return layout.getLayoutRect( + seriesModel.getBoxLayoutParams(), { + width: api.getWidth(), + height: api.getHeight() } - n.pp = vec2.clone(n.p); - n.edges = null; - } - - // Formula in 'Graph Drawing by Force-directed Placement' - // var k = scale * Math.sqrt(width * height / nodes.length); - // var k2 = k * k; - - var friction = 0.6; + ); + } - return { - warmUp: function () { - friction = 0.5; - }, + function getSortedIndices(data, sort) { + var valueArr = data.mapArray('value', function (val) { + return val; + }); + var indices = []; + var isAscending = sort === 'ascending'; + for (var i = 0, len = data.count(); i < len; i++) { + indices[i] = i; + } + indices.sort(function (a, b) { + return isAscending ? valueArr[a] - valueArr[b] : valueArr[b] - valueArr[a]; + }); + return indices; + } - setFixed: function (idx) { - nodes[idx].fixed = true; - }, + function labelLayout (data) { + data.each(function (idx) { + var itemModel = data.getItemModel(idx); + var labelModel = itemModel.getModel('label.normal'); + var labelPosition = labelModel.get('position'); - setUnfixed: function (idx) { - nodes[idx].fixed = false; - }, + var labelLineModel = itemModel.getModel('labelLine.normal'); - step: function (cb) { - var v12 = []; - var nLen = nodes.length; - for (var i = 0; i < edges.length; i++) { - var e = edges[i]; - var n1 = e.n1; - var n2 = e.n2; + var layout = data.getItemLayout(idx); + var points = layout.points; - vec2.sub(v12, n2.p, n1.p); - var d = vec2.len(v12) - e.d; - var w = n2.w / (n1.w + n2.w); - vec2.normalize(v12, v12); + var isLabelInside = labelPosition === 'inner' + || labelPosition === 'inside' || labelPosition === 'center'; - !n1.fixed && scaleAndAdd(n1.p, n1.p, v12, w * d * friction); - !n2.fixed && scaleAndAdd(n2.p, n2.p, v12, -(1 - w) * d * friction); - } - // Gravity - for (var i = 0; i < nLen; i++) { - var n = nodes[i]; - if (!n.fixed) { - vec2.sub(v12, center, n.p); - // var d = vec2.len(v12); - // vec2.scale(v12, v12, 1 / d); - // var gravityFactor = gravity; - vec2.scaleAndAdd(n.p, n.p, v12, gravity * friction); - } - } + var textAlign; + var textX; + var textY; + var linePoints; - // Repulsive - // PENDING - for (var i = 0; i < nLen; i++) { - var n1 = nodes[i]; - for (var j = i + 1; j < nLen; j++) { - var n2 = nodes[j]; - vec2.sub(v12, n2.p, n1.p); - var d = vec2.len(v12); - if (d === 0) { - // Random repulse - vec2.set(v12, Math.random() - 0.5, Math.random() - 0.5); - d = 1; - } - var repFact = (n1.rep + n2.rep) / d / d; - !n1.fixed && scaleAndAdd(n1.pp, n1.pp, v12, repFact); - !n2.fixed && scaleAndAdd(n2.pp, n2.pp, v12, -repFact); - } + if (isLabelInside) { + textX = (points[0][0] + points[1][0] + points[2][0] + points[3][0]) / 4; + textY = (points[0][1] + points[1][1] + points[2][1] + points[3][1]) / 4; + textAlign = 'center'; + linePoints = [ + [textX, textY], [textX, textY] + ]; + } + else { + var x1; + var y1; + var x2; + var labelLineLen = labelLineModel.get('length'); + if (labelPosition === 'left') { + // Left side + x1 = (points[3][0] + points[0][0]) / 2; + y1 = (points[3][1] + points[0][1]) / 2; + x2 = x1 - labelLineLen; + textX = x2 - 5; + textAlign = 'right'; } - var v = []; - for (var i = 0; i < nLen; i++) { - var n = nodes[i]; - if (!n.fixed) { - vec2.sub(v, n.p, n.pp); - vec2.scaleAndAdd(n.p, n.p, v, friction); - vec2.copy(n.pp, n.p); - } + else { + // Right side + x1 = (points[1][0] + points[2][0]) / 2; + y1 = (points[1][1] + points[2][1]) / 2; + x2 = x1 + labelLineLen; + textX = x2 + 5; + textAlign = 'left'; } + var y2 = y1; - friction = friction * 0.992; - - cb && cb(nodes, edges, friction < 0.01); - } - }; - }; - - -/***/ }, -/* 217 */ -/***/ function(module, exports, __webpack_require__) { - - - // FIXME Where to create the simple view coordinate system - var View = __webpack_require__(171); - var layout = __webpack_require__(21); - var bbox = __webpack_require__(51); - - function getViewRect(seriesModel, api, aspect) { - var option = seriesModel.getBoxLayoutParams(); - option.aspect = aspect; - return layout.getLayoutRect(option, { - width: api.getWidth(), - height: api.getHeight() + linePoints = [[x1, y1], [x2, y2]]; + textY = y2; + } + + layout.label = { + linePoints: linePoints, + x: textX, + y: textY, + verticalAlign: 'middle', + textAlign: textAlign, + inside: isLabelInside + }; }); } - module.exports = function (ecModel, api) { - var viewList = []; - ecModel.eachSeriesByType('graph', function (seriesModel) { - var coordSysType = seriesModel.get('coordinateSystem'); - if (!coordSysType || coordSysType === 'view') { + module.exports = function (ecModel, api, payload) { + ecModel.eachSeriesByType('funnel', function (seriesModel) { + var data = seriesModel.getData(); + var sort = seriesModel.get('sort'); + var viewRect = getViewRect(seriesModel, api); + var indices = getSortedIndices(data, sort); - var data = seriesModel.getData(); - var positions = data.mapArray(function (idx) { - var itemModel = data.getItemModel(idx); - return [+itemModel.get('x'), +itemModel.get('y')]; - }); + var sizeExtent = [ + parsePercent(seriesModel.get('minSize'), viewRect.width), + parsePercent(seriesModel.get('maxSize'), viewRect.width) + ]; + var dataExtent = data.getDataExtent('value'); + var min = seriesModel.get('min'); + var max = seriesModel.get('max'); + if (min == null) { + min = Math.min(dataExtent[0], 0); + } + if (max == null) { + max = dataExtent[1]; + } - var min = []; - var max = []; + var funnelAlign = seriesModel.get('funnelAlign'); + var gap = seriesModel.get('gap'); + var itemHeight = (viewRect.height - gap * (data.count() - 1)) / data.count(); - bbox.fromPoints(positions, min, max); + var y = viewRect.y; - // If width or height is 0 - if (max[0] - min[0] === 0) { - max[0] += 1; - min[0] -= 1; - } - if (max[1] - min[1] === 0) { - max[1] += 1; - min[1] -= 1; - } - var aspect = (max[0] - min[0]) / (max[1] - min[1]); - // FIXME If get view rect after data processed? - var viewRect = getViewRect(seriesModel, api, aspect); - // Position may be NaN, use view rect instead - if (isNaN(aspect)) { - min = [viewRect.x, viewRect.y]; - max = [viewRect.x + viewRect.width, viewRect.y + viewRect.height]; + var getLinePoints = function (idx, offY) { + // End point index is data.count() and we assign it 0 + var val = data.get('value', idx) || 0; + var itemWidth = number.linearMap(val, [min, max], sizeExtent, true); + var x0; + switch (funnelAlign) { + case 'left': + x0 = viewRect.x; + break; + case 'center': + x0 = viewRect.x + (viewRect.width - itemWidth) / 2; + break; + case 'right': + x0 = viewRect.x + viewRect.width - itemWidth; + break; } + return [ + [x0, offY], + [x0 + itemWidth, offY] + ]; + }; - var bbWidth = max[0] - min[0]; - var bbHeight = max[1] - min[1]; - - var viewWidth = viewRect.width; - var viewHeight = viewRect.height; - - var viewCoordSys = seriesModel.coordinateSystem = new View(); - viewCoordSys.zoomLimit = seriesModel.get('scaleLimit'); + if (sort === 'ascending') { + // From bottom to top + itemHeight = -itemHeight; + gap = -gap; + y += viewRect.height; + indices = indices.reverse(); + } - viewCoordSys.setBoundingRect( - min[0], min[1], bbWidth, bbHeight - ); - viewCoordSys.setViewRect( - viewRect.x, viewRect.y, viewWidth, viewHeight - ); + for (var i = 0; i < indices.length; i++) { + var idx = indices[i]; + var nextIdx = indices[i + 1]; + var start = getLinePoints(idx, y); + var end = getLinePoints(nextIdx, y + itemHeight); - // Update roam info - viewCoordSys.setCenter(seriesModel.get('center')); - viewCoordSys.setZoom(seriesModel.get('zoom')); + y += itemHeight + gap; - viewList.push(viewCoordSys); + data.setItemLayout(idx, { + points: start.concat(end.slice().reverse()) + }); } + + labelLayout(data); }); - return viewList; }; /***/ }, -/* 218 */ +/* 240 */ /***/ function(module, exports, __webpack_require__) { - __webpack_require__(219); - __webpack_require__(220); + + var echarts = __webpack_require__(1); + + __webpack_require__(241); + + __webpack_require__(252); + __webpack_require__(253); + + echarts.registerVisual(__webpack_require__(254)); + /***/ }, -/* 219 */ +/* 241 */ /***/ function(module, exports, __webpack_require__) { - var List = __webpack_require__(98); - var SeriesModel = __webpack_require__(28); + __webpack_require__(242); + __webpack_require__(245); + __webpack_require__(247); + + var echarts = __webpack_require__(1); var zrUtil = __webpack_require__(4); - var GaugeSeries = SeriesModel.extend({ + var CLICK_THRESHOLD = 5; // > 4 - type: 'series.gauge', + // Parallel view + echarts.extendComponentView({ + type: 'parallel', - getInitialData: function (option, ecModel) { - var list = new List(['value'], this); - var dataOpt = option.data || []; - if (!zrUtil.isArray(dataOpt)) { - dataOpt = [dataOpt]; + render: function (parallelModel, ecModel, api) { + var zr = api.getZr(); + + if (!this.__onMouseDown) { + // FIXME + // click: mousemove check. otherwise confilct with drag brush. + var mousedownPoint; + zr.on('mousedown', this.__onMouseDown = function (e) { + mousedownPoint = [e.offsetX, e.offsetY]; + }); + zr.on('mouseup', this.__onMouseUp = function (e) { + var point = [e.offsetX, e.offsetY]; + var dist = Math.pow(mousedownPoint[0] - point[0], 2) + + Math.pow(mousedownPoint[1] - point[1], 2); + + if (!parallelModel.get('axisExpandable') || dist > CLICK_THRESHOLD) { + return; + } + + var coordSys = parallelModel.coordinateSystem; + var closestDim = coordSys.findClosestAxisDim(point); + if (closestDim) { + var axisIndex = zrUtil.indexOf(coordSys.dimensions, closestDim); + api.dispatchAction({ + type: 'parallelAxisExpand', + axisExpandCenter: axisIndex + }); + } + }); } - // Only use the first data item - list.initData(dataOpt); - return list; }, - defaultOption: { - zlevel: 0, - z: 2, - // 默认全局居中 - center: ['50%', '50%'], - legendHoverLink: true, - radius: '75%', - startAngle: 225, - endAngle: -45, - clockwise: true, - // 最小值 - min: 0, - // 最大值 - max: 100, - // 分割段数,默认为10 - splitNumber: 10, - // 坐标轴线 - axisLine: { - // 默认显示,属性show控制显示与否 - show: true, - lineStyle: { // 属性lineStyle控制线条样式 - color: [[0.2, '#91c7ae'], [0.8, '#63869e'], [1, '#c23531']], - width: 30 - } - }, - // 分隔线 - splitLine: { - // 默认显示,属性show控制显示与否 - show: true, - // 属性length控制线长 - length: 30, - // 属性lineStyle(详见lineStyle)控制线条样式 - lineStyle: { - color: '#eee', - width: 2, - type: 'solid' - } - }, - // 坐标轴小标记 - axisTick: { - // 属性show控制显示与否,默认不显示 - show: true, - // 每份split细分多少段 - splitNumber: 5, - // 属性length控制线长 - length: 8, - // 属性lineStyle控制线条样式 - lineStyle: { - color: '#eee', - width: 1, - type: 'solid' - } - }, - axisLabel: { - show: true, - distance: 5, - // formatter: null, - textStyle: { // 其余属性默认使用全局文本样式,详见TEXTSTYLE - color: 'auto' - } - }, - pointer: { - show: true, - length: '80%', - width: 8 - }, - itemStyle: { - normal: { - color: 'auto' - } - }, - title: { - show: true, - // x, y,单位px - offsetCenter: [0, '-40%'], - // 其余属性默认使用全局文本样式,详见TEXTSTYLE - textStyle: { - color: '#333', - fontSize: 15 - } - }, - detail: { - show: true, - backgroundColor: 'rgba(0,0,0,0)', - borderWidth: 0, - borderColor: '#ccc', - width: 100, - height: 40, - // x, y,单位px - offsetCenter: [0, '40%'], - // formatter: null, - // 其余属性默认使用全局文本样式,详见TEXTSTYLE - textStyle: { - color: 'auto', - fontSize: 30 - } - } + dispose: function (ecModel, api) { + api.getZr().off(this.__onMouseDown); + api.getZr().off(this.__onMouseUp); } }); - module.exports = GaugeSeries; + echarts.registerPreprocessor( + __webpack_require__(251) + ); + /***/ }, -/* 220 */ +/* 242 */ /***/ function(module, exports, __webpack_require__) { - + /** + * Parallel coordinate system creater. + */ - var PointerPath = __webpack_require__(221); - var graphic = __webpack_require__(43); - var numberUtil = __webpack_require__(7); - var parsePercent = numberUtil.parsePercent; + var Parallel = __webpack_require__(243); - function parsePosition(seriesModel, api) { - var center = seriesModel.get('center'); - var width = api.getWidth(); - var height = api.getHeight(); - var size = Math.min(width, height); - var cx = parsePercent(center[0], api.getWidth()); - var cy = parsePercent(center[1], api.getHeight()); - var r = parsePercent(seriesModel.get('radius'), size / 2); + function create(ecModel, api) { + var coordSysList = []; - return { - cx: cx, - cy: cy, - r: r - }; - } + ecModel.eachComponent('parallel', function (parallelModel, idx) { + var coordSys = new Parallel(parallelModel, ecModel, api); - function formatLabel(label, labelFormatter) { - if (labelFormatter) { - if (typeof labelFormatter === 'string') { - label = labelFormatter.replace('{value}', label != null ? label : ''); - } - else if (typeof labelFormatter === 'function') { - label = labelFormatter(label); + coordSys.name = 'parallel_' + idx; + coordSys.resize(parallelModel, api); + + parallelModel.coordinateSystem = coordSys; + coordSys.model = parallelModel; + + coordSysList.push(coordSys); + }); + + // Inject the coordinateSystems into seriesModel + ecModel.eachSeries(function (seriesModel) { + if (seriesModel.get('coordinateSystem') === 'parallel') { + var parallelModel = ecModel.queryComponents({ + mainType: 'parallel', + index: seriesModel.get('parallelIndex'), + id: seriesModel.get('parallelId') + })[0]; + seriesModel.coordinateSystem = parallelModel.coordinateSystem; } - } + }); - return label; + return coordSysList; } - var PI2 = Math.PI * 2; + __webpack_require__(26).register('parallel', {create: create}); - var GaugeView = __webpack_require__(42).extend({ - type: 'gauge', - render: function (seriesModel, ecModel, api) { +/***/ }, +/* 243 */ +/***/ function(module, exports, __webpack_require__) { - this.group.removeAll(); + /** + * Parallel Coordinates + * + */ - var colorList = seriesModel.get('axisLine.lineStyle.color'); - var posInfo = parsePosition(seriesModel, api); - this._renderMain( - seriesModel, ecModel, api, colorList, posInfo - ); - }, + var layout = __webpack_require__(21); + var axisHelper = __webpack_require__(105); + var zrUtil = __webpack_require__(4); + var ParallelAxis = __webpack_require__(244); + var graphic = __webpack_require__(44); + var matrix = __webpack_require__(11); - dispose: function () {}, + var each = zrUtil.each; - _renderMain: function (seriesModel, ecModel, api, colorList, posInfo) { - var group = this.group; + var PI = Math.PI; - var axisLineModel = seriesModel.getModel('axisLine'); - var lineStyleModel = axisLineModel.getModel('lineStyle'); + function Parallel(parallelModel, ecModel, api) { - var clockwise = seriesModel.get('clockwise'); - var startAngle = -seriesModel.get('startAngle') / 180 * Math.PI; - var endAngle = -seriesModel.get('endAngle') / 180 * Math.PI; + /** + * key: dimension + * @type {Object.} + * @private + */ + this._axesMap = {}; - var angleRangeSpan = (endAngle - startAngle) % PI2; + /** + * key: dimension + * value: {position: [], rotation, } + * @type {Object.} + * @private + */ + this._axesLayout = {}; - var prevEndAngle = startAngle; - var axisLineWidth = lineStyleModel.get('width'); + /** + * Always follow axis order. + * @type {Array.} + * @readOnly + */ + this.dimensions = parallelModel.dimensions; - for (var i = 0; i < colorList.length; i++) { - // Clamp - var percent = Math.min(Math.max(colorList[i][0], 0), 1); - var endAngle = startAngle + angleRangeSpan * percent; - var sector = new graphic.Sector({ - shape: { - startAngle: prevEndAngle, - endAngle: endAngle, - cx: posInfo.cx, - cy: posInfo.cy, - clockwise: clockwise, - r0: posInfo.r - axisLineWidth, - r: posInfo.r - }, - silent: true - }); + /** + * @type {module:zrender/core/BoundingRect} + */ + this._rect; - sector.setStyle({ - fill: colorList[i][1] - }); + /** + * @type {module:echarts/coord/parallel/ParallelModel} + */ + this._model = parallelModel; - sector.setStyle(lineStyleModel.getLineStyle( - // Because we use sector to simulate arc - // so the properties for stroking are useless - ['color', 'borderWidth', 'borderColor'] - )); + this._init(parallelModel, ecModel, api); + } - group.add(sector); + Parallel.prototype = { - prevEndAngle = endAngle; - } + type: 'parallel', - var getColor = function (percent) { - // Less than 0 - if (percent <= 0) { - return colorList[0][1]; - } - for (var i = 0; i < colorList.length; i++) { - if (colorList[i][0] >= percent - && (i === 0 ? 0 : colorList[i - 1][0]) < percent - ) { - return colorList[i][1]; - } - } - // More than 1 - return colorList[i - 1][1]; - }; + constructor: Parallel, - if (!clockwise) { - var tmp = startAngle; - startAngle = endAngle; - endAngle = tmp; - } + /** + * Initialize cartesian coordinate systems + * @private + */ + _init: function (parallelModel, ecModel, api) { - this._renderTicks( - seriesModel, ecModel, api, getColor, posInfo, - startAngle, endAngle, clockwise - ); + var dimensions = parallelModel.dimensions; + var parallelAxisIndex = parallelModel.parallelAxisIndex; - this._renderPointer( - seriesModel, ecModel, api, getColor, posInfo, - startAngle, endAngle, clockwise - ); + each(dimensions, function (dim, idx) { - this._renderTitle( - seriesModel, ecModel, api, getColor, posInfo - ); - this._renderDetail( - seriesModel, ecModel, api, getColor, posInfo - ); + var axisIndex = parallelAxisIndex[idx]; + var axisModel = ecModel.getComponent('parallelAxis', axisIndex); + + var axis = this._axesMap[dim] = new ParallelAxis( + dim, + axisHelper.createScaleByModel(axisModel), + [0, 0], + axisModel.get('type'), + axisIndex + ); + + var isCategory = axis.type === 'category'; + axis.onBand = isCategory && axisModel.get('boundaryGap'); + axis.inverse = axisModel.get('inverse'); + + // Inject axis into axisModel + axisModel.axis = axis; + + // Inject axisModel into axis + axis.model = axisModel; + }, this); }, - _renderTicks: function ( - seriesModel, ecModel, api, getColor, posInfo, - startAngle, endAngle, clockwise - ) { - var group = this.group; - var cx = posInfo.cx; - var cy = posInfo.cy; - var r = posInfo.r; + /** + * Update axis scale after data processed + * @param {module:echarts/model/Global} ecModel + * @param {module:echarts/ExtensionAPI} api + */ + update: function (ecModel, api) { + this._updateAxesFromSeries(this._model, ecModel); + }, + + /** + * Update properties from series + * @private + */ + _updateAxesFromSeries: function (parallelModel, ecModel) { + ecModel.eachSeries(function (seriesModel) { - var minVal = +seriesModel.get('min'); - var maxVal = +seriesModel.get('max'); + if (!parallelModel.contains(seriesModel, ecModel)) { + return; + } - var splitLineModel = seriesModel.getModel('splitLine'); - var tickModel = seriesModel.getModel('axisTick'); - var labelModel = seriesModel.getModel('axisLabel'); + var data = seriesModel.getData(); - var splitNumber = seriesModel.get('splitNumber'); - var subSplitNumber = tickModel.get('splitNumber'); + each(this.dimensions, function (dim) { + var axis = this._axesMap[dim]; + axis.scale.unionExtentFromData(data, dim); + axisHelper.niceScaleExtent(axis.scale, axis.model); + }, this); + }, this); + }, - var splitLineLen = parsePercent( - splitLineModel.get('length'), r - ); - var tickLen = parsePercent( - tickModel.get('length'), r + /** + * Resize the parallel coordinate system. + * @param {module:echarts/coord/parallel/ParallelModel} parallelModel + * @param {module:echarts/ExtensionAPI} api + */ + resize: function (parallelModel, api) { + this._rect = layout.getLayoutRect( + parallelModel.getBoxLayoutParams(), + { + width: api.getWidth(), + height: api.getHeight() + } ); - var angle = startAngle; - var step = (endAngle - startAngle) / splitNumber; - var subStep = step / subSplitNumber; + this._layoutAxes(parallelModel); + }, - var splitLineStyle = splitLineModel.getModel('lineStyle').getLineStyle(); - var tickLineStyle = tickModel.getModel('lineStyle').getLineStyle(); - var textStyleModel = labelModel.getModel('textStyle'); + /** + * @return {module:zrender/core/BoundingRect} + */ + getRect: function () { + return this._rect; + }, - for (var i = 0; i <= splitNumber; i++) { - var unitX = Math.cos(angle); - var unitY = Math.sin(angle); - // Split line - if (splitLineModel.get('show')) { - var splitLine = new graphic.Line({ - shape: { - x1: unitX * r + cx, - y1: unitY * r + cy, - x2: unitX * (r - splitLineLen) + cx, - y2: unitY * (r - splitLineLen) + cy - }, - style: splitLineStyle, - silent: true - }); - if (splitLineStyle.stroke === 'auto') { - splitLine.setStyle({ - stroke: getColor(i / splitNumber) - }); - } + /** + * @private + */ + _layoutAxes: function (parallelModel) { + var rect = this._rect; + var layout = parallelModel.get('layout'); + var axes = this._axesMap; + var dimensions = this.dimensions; - group.add(splitLine); - } + var size = [rect.width, rect.height]; + var sizeIdx = layout === 'horizontal' ? 0 : 1; + var layoutLength = size[sizeIdx]; + var axisLength = size[1 - sizeIdx]; + var axisExtent = [0, axisLength]; - // Label - if (labelModel.get('show')) { - var label = formatLabel( - numberUtil.round(i / splitNumber * (maxVal - minVal) + minVal), - labelModel.get('formatter') - ); - var distance = labelModel.get('distance'); + each(axes, function (axis) { + var idx = axis.inverse ? 1 : 0; + axis.setExtent(axisExtent[idx], axisExtent[1 - idx]); + }); - var text = new graphic.Text({ - style: { - text: label, - x: unitX * (r - splitLineLen - distance) + cx, - y: unitY * (r - splitLineLen - distance) + cy, - fill: textStyleModel.getTextColor(), - textFont: textStyleModel.getFont(), - textVerticalAlign: unitY < -0.4 ? 'top' : (unitY > 0.4 ? 'bottom' : 'middle'), - textAlign: unitX < -0.4 ? 'left' : (unitX > 0.4 ? 'right' : 'center') - }, - silent: true - }); - if (text.style.fill === 'auto') { - text.setStyle({ - fill: getColor(i / splitNumber) - }); - } + var axisExpandable = parallelModel.get('axisExpandable'); + var axisExpandWidth = parallelModel.get('axisExpandWidth'); + var axisExpandCenter = parallelModel.get('axisExpandCenter'); + var axisExpandCount = parallelModel.get('axisExpandCount') || 0; + var axisExpandWindow; - group.add(text); + if (axisExpandCenter != null) { + // Clamp + var left = Math.max(0, Math.floor(axisExpandCenter - (axisExpandCount - 1) / 2)); + var right = left + axisExpandCount - 1; + if (right >= dimensions.length) { + right = dimensions.length - 1; + left = Math.max(0, Math.floor(right - axisExpandCount + 1)); } + axisExpandWindow = [left, right]; + } - // Axis tick - if (tickModel.get('show') && i !== splitNumber) { - for (var j = 0; j <= subSplitNumber; j++) { - var unitX = Math.cos(angle); - var unitY = Math.sin(angle); - var tickLine = new graphic.Line({ - shape: { - x1: unitX * r + cx, - y1: unitY * r + cy, - x2: unitX * (r - tickLen) + cx, - y2: unitY * (r - tickLen) + cy - }, - silent: true, - style: tickLineStyle - }); + var calcPos = (axisExpandable && axisExpandWindow && axisExpandWidth) + ? function (axisIndex, layoutLength, axisCount) { + var peekIntervalCount = axisExpandWindow[1] - axisExpandWindow[0]; + var otherWidth = ( + layoutLength - axisExpandWidth * peekIntervalCount + ) / (axisCount - 1 - peekIntervalCount); - if (tickLineStyle.stroke === 'auto') { - tickLine.setStyle({ - stroke: getColor((i + j / subSplitNumber) / splitNumber) - }); - } + var position; - group.add(tickLine); - angle += subStep; + if (axisIndex < axisExpandWindow[0]) { + position = (axisIndex - 1) * otherWidth; + } + else if (axisIndex <= axisExpandWindow[1]) { + position = axisExpandWindow[0] * otherWidth + + (axisIndex - axisExpandWindow[0]) * axisExpandWidth; + } + else if (axisIndex === axisCount - 1) { + position = layoutLength; + } + else { + position = axisExpandWindow[0] * otherWidth + + peekIntervalCount * axisExpandWidth + + (axisIndex - axisExpandWindow[1]) * otherWidth; } - angle -= subStep; - } - else { - angle += step; - } - } - }, - - _renderPointer: function ( - seriesModel, ecModel, api, getColor, posInfo, - startAngle, endAngle, clockwise - ) { - var group = this.group; - var oldData = this._data; + return { + position: position, + axisNameAvailableWidth: ( + axisExpandWindow[0] < axisIndex && axisIndex < axisExpandWindow[1] + ) ? axisExpandWidth : otherWidth + }; + } + : function (axisIndex, layoutLength, axisCount) { + var step = layoutLength / (axisCount - 1); + return { + position: step * axisIndex, + axisNameAvailableWidth: step + }; + }; - if (!seriesModel.get('pointer.show')) { - // Remove old element - oldData.eachItemGraphicEl(function (el) { - group.remove(el); - }); - return; - } + each(dimensions, function (dim, idx) { + var posInfo = calcPos(idx, layoutLength, dimensions.length); - var valueExtent = [+seriesModel.get('min'), +seriesModel.get('max')]; - var angleExtent = [startAngle, endAngle]; + var positionTable = { + horizontal: { + x: posInfo.position, + y: axisLength + }, + vertical: { + x: 0, + y: posInfo.position + } + }; + var rotationTable = { + horizontal: PI / 2, + vertical: 0 + }; - var data = seriesModel.getData(); + var position = [ + positionTable[layout].x + rect.x, + positionTable[layout].y + rect.y + ]; - data.diff(oldData) - .add(function (idx) { - var pointer = new PointerPath({ - shape: { - angle: startAngle - } - }); + var rotation = rotationTable[layout]; + var transform = matrix.create(); + matrix.rotate(transform, transform, rotation); + matrix.translate(transform, transform, position); - graphic.updateProps(pointer, { - shape: { - angle: numberUtil.linearMap(data.get('value', idx), valueExtent, angleExtent, true) - } - }, seriesModel); + // TODO + // tick等排布信息。 - group.add(pointer); - data.setItemGraphicEl(idx, pointer); - }) - .update(function (newIdx, oldIdx) { - var pointer = oldData.getItemGraphicEl(oldIdx); + // TODO + // 根据axis order 更新 dimensions顺序。 - graphic.updateProps(pointer, { - shape: { - angle: numberUtil.linearMap(data.get('value', newIdx), valueExtent, angleExtent, true) - } - }, seriesModel); + this._axesLayout[dim] = { + position: position, + rotation: rotation, + transform: transform, + axisNameAvailableWidth: posInfo.axisNameAvailableWidth, + tickDirection: 1, + labelDirection: 1, + axisExpandWindow: axisExpandWindow + }; + }, this); + }, - group.add(pointer); - data.setItemGraphicEl(newIdx, pointer); - }) - .remove(function (idx) { - var pointer = oldData.getItemGraphicEl(idx); - group.remove(pointer); - }) - .execute(); + /** + * Get axis by dim. + * @param {string} dim + * @return {module:echarts/coord/parallel/ParallelAxis} [description] + */ + getAxis: function (dim) { + return this._axesMap[dim]; + }, - data.eachItemGraphicEl(function (pointer, idx) { - var itemModel = data.getItemModel(idx); - var pointerModel = itemModel.getModel('pointer'); + /** + * Convert a dim value of a single item of series data to Point. + * @param {*} value + * @param {string} dim + * @return {Array} + */ + dataToPoint: function (value, dim) { + return this.axisCoordToPoint( + this._axesMap[dim].dataToCoord(value), + dim + ); + }, - pointer.setShape({ - x: posInfo.cx, - y: posInfo.cy, - width: parsePercent( - pointerModel.get('width'), posInfo.r - ), - r: parsePercent(pointerModel.get('length'), posInfo.r) - }); + /** + * Travel data for one time, get activeState of each data item. + * @param {module:echarts/data/List} data + * @param {Functio} cb param: {string} activeState 'active' or 'inactive' or 'normal' + * {number} dataIndex + * @param {Object} context + */ + eachActiveState: function (data, callback, context) { + var dimensions = this.dimensions; + var axesMap = this._axesMap; + var hasActiveSet = this.hasAxisbrushed(); - pointer.useStyle(itemModel.getModel('itemStyle.normal').getItemStyle()); + for (var i = 0, len = data.count(); i < len; i++) { + var values = data.getValues(dimensions, i); + var activeState; - if (pointer.style.fill === 'auto') { - pointer.setStyle('fill', getColor( - (data.get('value', idx) - valueExtent[0]) / (valueExtent[1] - valueExtent[0]) - )); + if (!hasActiveSet) { + activeState = 'normal'; } + else { + activeState = 'active'; + for (var j = 0, lenj = dimensions.length; j < lenj; j++) { + var dimName = dimensions[j]; + var state = axesMap[dimName].model.getActiveState(values[j], j); - graphic.setHoverStyle( - pointer, itemModel.getModel('itemStyle.emphasis').getItemStyle() - ); - }); - - this._data = data; - }, - - _renderTitle: function ( - seriesModel, ecModel, api, getColor, posInfo - ) { - var titleModel = seriesModel.getModel('title'); - if (titleModel.get('show')) { - var textStyleModel = titleModel.getModel('textStyle'); - var offsetCenter = titleModel.get('offsetCenter'); - var x = posInfo.cx + parsePercent(offsetCenter[0], posInfo.r); - var y = posInfo.cy + parsePercent(offsetCenter[1], posInfo.r); - var text = new graphic.Text({ - style: { - x: x, - y: y, - // FIXME First data name ? - text: seriesModel.getData().getName(0), - fill: textStyleModel.getTextColor(), - textFont: textStyleModel.getFont(), - textAlign: 'center', - textVerticalAlign: 'middle' + if (state === 'inactive') { + activeState = 'inactive'; + break; + } } - }); - this.group.add(text); + } + + callback.call(context, activeState, i); } }, - _renderDetail: function ( - seriesModel, ecModel, api, getColor, posInfo - ) { - var detailModel = seriesModel.getModel('detail'); - var minVal = +seriesModel.get('min'); - var maxVal = +seriesModel.get('max'); - if (detailModel.get('show')) { - var textStyleModel = detailModel.getModel('textStyle'); - var offsetCenter = detailModel.get('offsetCenter'); - var x = posInfo.cx + parsePercent(offsetCenter[0], posInfo.r); - var y = posInfo.cy + parsePercent(offsetCenter[1], posInfo.r); - var width = parsePercent(detailModel.get('width'), posInfo.r); - var height = parsePercent(detailModel.get('height'), posInfo.r); - var value = seriesModel.getData().get('value', 0); - var rect = new graphic.Rect({ - shape: { - x: x - width / 2, - y: y - height / 2, - width: width, - height: height - }, - style: { - text: formatLabel( - // FIXME First data name ? - value, detailModel.get('formatter') - ), - fill: detailModel.get('backgroundColor'), - textFill: textStyleModel.getTextColor(), - textFont: textStyleModel.getFont() - } - }); - if (rect.style.textFill === 'auto') { - rect.setStyle('textFill', getColor( - numberUtil.linearMap(value, [minVal, maxVal], [0, 1], true) - )); + /** + * Whether has any activeSet. + * @return {boolean} + */ + hasAxisbrushed: function () { + var dimensions = this.dimensions; + var axesMap = this._axesMap; + var hasActiveSet = false; + + for (var j = 0, lenj = dimensions.length; j < lenj; j++) { + if (axesMap[dimensions[j]].model.getActiveState() !== 'normal') { + hasActiveSet = true; } - rect.setStyle(detailModel.getItemStyle(['color'])); - this.group.add(rect); } - } - }); - module.exports = GaugeView; + return hasActiveSet; + }, + /** + * Convert coords of each axis to Point. + * Return point. For example: [10, 20] + * @param {Array.} coords + * @param {string} dim + * @return {Array.} + */ + axisCoordToPoint: function (coord, dim) { + var axisLayout = this._axesLayout[dim]; + return graphic.applyTransform([coord, 0], axisLayout.transform); + }, -/***/ }, -/* 221 */ -/***/ function(module, exports, __webpack_require__) { + /** + * Get axis layout. + */ + getAxisLayout: function (dim) { + return zrUtil.clone(this._axesLayout[dim]); + }, - + findClosestAxisDim: function (point) { + var axisDim; + var minDist = Infinity; - module.exports = __webpack_require__(45).extend({ + zrUtil.each(this._axesLayout, function (axisLayout, dim) { + var localPoint = graphic.applyTransform(point, axisLayout.transform, true); + var extent = this._axesMap[dim].getExtent(); - type: 'echartsGaugePointer', + if (localPoint[0] < extent[0] || localPoint[0] > extent[1]) { + return; + } - shape: { - angle: 0, + var dist = Math.abs(localPoint[1]); + if (dist < minDist) { + minDist = dist; + axisDim = dim; + } + }, this); - width: 10, + return axisDim; + } - r: 10, + }; - x: 0, + module.exports = Parallel; - y: 0 - }, - buildPath: function (ctx, shape) { - var mathCos = Math.cos; - var mathSin = Math.sin; +/***/ }, +/* 244 */ +/***/ function(module, exports, __webpack_require__) { - var r = shape.r; - var width = shape.width; - var angle = shape.angle; - var x = shape.x - mathCos(angle) * width * (width >= r / 3 ? 1 : 2); - var y = shape.y - mathSin(angle) * width * (width >= r / 3 ? 1 : 2); + - angle = shape.angle - Math.PI / 2; - ctx.moveTo(x, y); - ctx.lineTo( - shape.x + mathCos(angle) * width, - shape.y + mathSin(angle) * width - ); - ctx.lineTo( - shape.x + mathCos(shape.angle) * r, - shape.y + mathSin(shape.angle) * r - ); - ctx.lineTo( - shape.x - mathCos(angle) * width, - shape.y - mathSin(angle) * width - ); - ctx.lineTo(x, y); - return; - } - }); + var zrUtil = __webpack_require__(4); + var Axis = __webpack_require__(100); + + /** + * @constructor module:echarts/coord/parallel/ParallelAxis + * @extends {module:echarts/coord/Axis} + * @param {string} dim + * @param {*} scale + * @param {Array.} coordExtent + * @param {string} axisType + */ + var ParallelAxis = function (dim, scale, coordExtent, axisType, axisIndex) { + Axis.call(this, dim, scale, coordExtent); -/***/ }, -/* 222 */ -/***/ function(module, exports, __webpack_require__) { + /** + * Axis type + * - 'category' + * - 'value' + * - 'time' + * - 'log' + * @type {string} + */ + this.type = axisType || 'value'; - + /** + * @type {number} + * @readOnly + */ + this.axisIndex = axisIndex; + }; - var zrUtil = __webpack_require__(4); - var echarts = __webpack_require__(1); + ParallelAxis.prototype = { + + constructor: ParallelAxis, + + /** + * Axis model + * @param {module:echarts/coord/parallel/AxisModel} + */ + model: null - __webpack_require__(223); - __webpack_require__(224); + }; - echarts.registerVisual(zrUtil.curry(__webpack_require__(146), 'funnel')); - echarts.registerLayout(__webpack_require__(225)); + zrUtil.inherits(ParallelAxis, Axis); - echarts.registerProcessor(zrUtil.curry(__webpack_require__(149), 'funnel')); + module.exports = ParallelAxis; /***/ }, -/* 223 */ +/* 245 */ /***/ function(module, exports, __webpack_require__) { - 'use strict'; + + var zrUtil = __webpack_require__(4); + var Component = __webpack_require__(19); - var List = __webpack_require__(98); - var modelUtil = __webpack_require__(5); - var completeDimensions = __webpack_require__(103); + __webpack_require__(246); - var FunnelSeries = __webpack_require__(1).extendSeriesModel({ + Component.extend({ - type: 'series.funnel', + type: 'parallel', - init: function (option) { - FunnelSeries.superApply(this, 'init', arguments); + dependencies: ['parallelAxis'], - // Enable legend selection for each data item - // Use a function instead of direct access because data reference may changed - this.legendDataProvider = function () { - return this.getRawData(); - }; - // Extend labelLine emphasis - this._defaultLabelLine(option); - }, + /** + * @type {module:echarts/coord/parallel/Parallel} + */ + coordinateSystem: null, - getInitialData: function (option, ecModel) { - var dimensions = completeDimensions(['value'], option.data); - var list = new List(dimensions, this); - list.initData(option.data); - return list; - }, + /** + * Each item like: 'dim0', 'dim1', 'dim2', ... + * @type {Array.} + * @readOnly + */ + dimensions: null, - _defaultLabelLine: function (option) { - // Extend labelLine emphasis - modelUtil.defaultEmphasis(option.labelLine, ['show']); + /** + * Coresponding to dimensions. + * @type {Array.} + * @readOnly + */ + parallelAxisIndex: null, - var labelLineNormalOpt = option.labelLine.normal; - var labelLineEmphasisOpt = option.labelLine.emphasis; - // Not show label line if `label.normal.show = false` - labelLineNormalOpt.show = labelLineNormalOpt.show - && option.label.normal.show; - labelLineEmphasisOpt.show = labelLineEmphasisOpt.show - && option.label.emphasis.show; - }, + layoutMode: 'box', defaultOption: { - zlevel: 0, // 一级层叠 - z: 2, // 二级层叠 - legendHoverLink: true, + zlevel: 0, + z: 0, left: 80, top: 60, right: 80, @@ -42056,3935 +46006,3638 @@ return /******/ (function(modules) { // webpackBootstrap // width: {totalWidth} - left - right, // height: {totalHeight} - top - bottom, - // 默认取数据最小最大值 - // min: 0, - // max: 100, - minSize: '0%', - maxSize: '100%', - sort: 'descending', // 'ascending', 'descending' - gap: 0, - funnelAlign: 'center', - label: { - normal: { - show: true, - position: 'outer' - // formatter: 标签文本格式器,同Tooltip.formatter,不支持异步回调 - // textStyle: null // 默认使用全局文本样式,详见TEXTSTYLE - }, - emphasis: { - show: true - } - }, - labelLine: { - normal: { - show: true, - length: 20, - lineStyle: { - // color: 各异, - width: 1, - type: 'solid' - } - }, - emphasis: {} - }, - itemStyle: { - normal: { - // color: 各异, - borderColor: '#fff', - borderWidth: 1 - }, - emphasis: { - // color: 各异, - } - } - } - }); - - module.exports = FunnelSeries; - - -/***/ }, -/* 224 */ -/***/ function(module, exports, __webpack_require__) { - - - - var graphic = __webpack_require__(43); - var zrUtil = __webpack_require__(4); + layout: 'horizontal', // 'horizontal' or 'vertical' - /** - * Piece of pie including Sector, Label, LabelLine - * @constructor - * @extends {module:zrender/graphic/Group} - */ - function FunnelPiece(data, idx) { + // FIXME + // naming? + axisExpandable: false, + axisExpandCenter: null, + axisExpandCount: 0, + axisExpandWidth: 50, // FIXME '10%' ? - graphic.Group.call(this); + parallelAxisDefault: null + }, - var polygon = new graphic.Polygon(); - var labelLine = new graphic.Polyline(); - var text = new graphic.Text(); - this.add(polygon); - this.add(labelLine); - this.add(text); + /** + * @override + */ + init: function () { + Component.prototype.init.apply(this, arguments); - this.updateData(data, idx, true); + this.mergeOption({}); + }, - // Hover to change label and labelLine - function onEmphasis() { - labelLine.ignore = labelLine.hoverIgnore; - text.ignore = text.hoverIgnore; - } - function onNormal() { - labelLine.ignore = labelLine.normalIgnore; - text.ignore = text.normalIgnore; - } - this.on('emphasis', onEmphasis) - .on('normal', onNormal) - .on('mouseover', onEmphasis) - .on('mouseout', onNormal); - } + /** + * @override + */ + mergeOption: function (newOption) { + var thisOption = this.option; - var funnelPieceProto = FunnelPiece.prototype; + newOption && zrUtil.merge(thisOption, newOption, true); - function getLabelStyle(data, idx, state, labelModel) { - var textStyleModel = labelModel.getModel('textStyle'); - var position = labelModel.get('position'); - var isLabelInside = position === 'inside' || position === 'inner' || position === 'center'; - return { - fill: textStyleModel.getTextColor() - || (isLabelInside ? '#fff' : data.getItemVisual(idx, 'color')), - textFont: textStyleModel.getFont(), - text: zrUtil.retrieve( - data.hostModel.getFormattedLabel(idx, state), - data.getName(idx) - ) - }; - } + this._initDimensions(); + }, - var opacityAccessPath = ['itemStyle', 'normal', 'opacity']; - funnelPieceProto.updateData = function (data, idx, firstCreate) { + /** + * Whether series or axis is in this coordinate system. + * @param {module:echarts/model/Series|module:echarts/coord/parallel/AxisModel} model + * @param {module:echarts/model/Global} ecModel + */ + contains: function (model, ecModel) { + var parallelIndex = model.get('parallelIndex'); + return parallelIndex != null + && ecModel.getComponent('parallel', parallelIndex) === this; + }, - var polygon = this.childAt(0); + setAxisExpand: function (opt) { + zrUtil.each( + ['axisExpandable', 'axisExpandCenter', 'axisExpandCount', 'axisExpandWidth'], + function (name) { + if (opt.hasOwnProperty(name)) { + this.option[name] = opt[name]; + } + }, + this + ); + }, - var seriesModel = data.hostModel; - var itemModel = data.getItemModel(idx); - var layout = data.getItemLayout(idx); - var opacity = data.getItemModel(idx).get(opacityAccessPath); - opacity = opacity == null ? 1 : opacity; + /** + * @private + */ + _initDimensions: function () { + var dimensions = this.dimensions = []; + var parallelAxisIndex = this.parallelAxisIndex = []; - // Reset style - polygon.useStyle({}); + var axisModels = zrUtil.filter(this.dependentModels.parallelAxis, function (axisModel) { + // Can not use this.contains here, because + // initialization has not been completed yet. + return axisModel.get('parallelIndex') === this.componentIndex; + }); - if (firstCreate) { - polygon.setShape({ - points: layout.points + zrUtil.each(axisModels, function (axisModel) { + dimensions.push('dim' + axisModel.get('dim')); + parallelAxisIndex.push(axisModel.componentIndex); }); - polygon.setStyle({ opacity : 0 }); - graphic.initProps(polygon, { - style: { - opacity: opacity - } - }, seriesModel, idx); - } - else { - graphic.updateProps(polygon, { - style: { - opacity: opacity - }, - shape: { - points: layout.points - } - }, seriesModel, idx); } - // Update common style - var itemStyleModel = itemModel.getModel('itemStyle'); - var visualColor = data.getItemVisual(idx, 'color'); - - polygon.setStyle( - zrUtil.defaults( - { - lineJoin: 'round', - fill: visualColor - }, - itemStyleModel.getModel('normal').getItemStyle(['opacity']) - ) - ); - polygon.hoverStyle = itemStyleModel.getModel('emphasis').getItemStyle(); - - this._updateLabel(data, idx); - - graphic.setHoverStyle(this); - }; - - funnelPieceProto._updateLabel = function (data, idx) { - - var labelLine = this.childAt(1); - var labelText = this.childAt(2); + }); - var seriesModel = data.hostModel; - var itemModel = data.getItemModel(idx); - var layout = data.getItemLayout(idx); - var labelLayout = layout.label; - var visualColor = data.getItemVisual(idx, 'color'); - graphic.updateProps(labelLine, { - shape: { - points: labelLayout.linePoints || labelLayout.linePoints - } - }, seriesModel, idx); - graphic.updateProps(labelText, { - style: { - x: labelLayout.x, - y: labelLayout.y - } - }, seriesModel, idx); - labelText.attr({ - style: { - textAlign: labelLayout.textAlign, - textVerticalAlign: labelLayout.verticalAlign, - textFont: labelLayout.font - }, - rotation: labelLayout.rotation, - origin: [labelLayout.x, labelLayout.y], - z2: 10 - }); +/***/ }, +/* 246 */ +/***/ function(module, exports, __webpack_require__) { - var labelModel = itemModel.getModel('label.normal'); - var labelHoverModel = itemModel.getModel('label.emphasis'); - var labelLineModel = itemModel.getModel('labelLine.normal'); - var labelLineHoverModel = itemModel.getModel('labelLine.emphasis'); + - labelText.setStyle(getLabelStyle(data, idx, 'normal', labelModel)); + var ComponentModel = __webpack_require__(19); + var zrUtil = __webpack_require__(4); + var makeStyleMapper = __webpack_require__(15); + var axisModelCreator = __webpack_require__(131); + var numberUtil = __webpack_require__(7); - labelText.ignore = labelText.normalIgnore = !labelModel.get('show'); - labelText.hoverIgnore = !labelHoverModel.get('show'); + var AxisModel = ComponentModel.extend({ - labelLine.ignore = labelLine.normalIgnore = !labelLineModel.get('show'); - labelLine.hoverIgnore = !labelLineHoverModel.get('show'); + type: 'baseParallelAxis', - // Default use item visual color - labelLine.setStyle({ - stroke: visualColor - }); - labelLine.setStyle(labelLineModel.getModel('lineStyle').getLineStyle()); + /** + * @type {module:echarts/coord/parallel/Axis} + */ + axis: null, - labelText.hoverStyle = getLabelStyle(data, idx, 'emphasis', labelHoverModel); - labelLine.hoverStyle = labelLineHoverModel.getModel('lineStyle').getLineStyle(); - }; + /** + * @type {Array.} + * @readOnly + */ + activeIntervals: [], - zrUtil.inherits(FunnelPiece, graphic.Group); + /** + * @return {Object} + */ + getAreaSelectStyle: function () { + return makeStyleMapper( + [ + ['fill', 'color'], + ['lineWidth', 'borderWidth'], + ['stroke', 'borderColor'], + ['width', 'width'], + ['opacity', 'opacity'] + ] + ).call(this.getModel('areaSelectStyle')); + }, + /** + * The code of this feature is put on AxisModel but not ParallelAxis, + * because axisModel can be alive after echarts updating but instance of + * ParallelAxis having been disposed. this._activeInterval should be kept + * when action dispatched (i.e. legend click). + * + * @param {Array.>} intervals interval.length === 0 + * means set all active. + * @public + */ + setActiveIntervals: function (intervals) { + var activeIntervals = this.activeIntervals = zrUtil.clone(intervals); - var Funnel = __webpack_require__(42).extend({ + // Normalize + if (activeIntervals) { + for (var i = activeIntervals.length - 1; i >= 0; i--) { + numberUtil.asc(activeIntervals[i]); + } + } + }, - type: 'funnel', + /** + * @param {number|string} [value] When attempting to detect 'no activeIntervals set', + * value can not be input. + * @return {string} 'normal': no activeIntervals set, + * 'active', + * 'inactive'. + * @public + */ + getActiveState: function (value) { + var activeIntervals = this.activeIntervals; - render: function (seriesModel, ecModel, api) { - var data = seriesModel.getData(); - var oldData = this._data; + if (!activeIntervals.length) { + return 'normal'; + } - var group = this.group; + if (value == null) { + return 'inactive'; + } - data.diff(oldData) - .add(function (idx) { - var funnelPiece = new FunnelPiece(data, idx); + for (var i = 0, len = activeIntervals.length; i < len; i++) { + if (activeIntervals[i][0] <= value && value <= activeIntervals[i][1]) { + return 'active'; + } + } + return 'inactive'; + } - data.setItemGraphicEl(idx, funnelPiece); + }); - group.add(funnelPiece); - }) - .update(function (newIdx, oldIdx) { - var piePiece = oldData.getItemGraphicEl(oldIdx); + var defaultOption = { - piePiece.updateData(data, newIdx); + type: 'value', - group.add(piePiece); - data.setItemGraphicEl(newIdx, piePiece); - }) - .remove(function (idx) { - var piePiece = oldData.getItemGraphicEl(idx); - group.remove(piePiece); - }) - .execute(); + /** + * @type {Array.} + */ + dim: null, // 0, 1, 2, ... - this._data = data; - }, + // parallelIndex: null, - remove: function () { - this.group.removeAll(); - this._data = null; + areaSelectStyle: { + width: 20, + borderWidth: 1, + borderColor: 'rgba(160,197,232)', + color: 'rgba(160,197,232)', + opacity: 0.3 }, - dispose: function () {} - }); - - module.exports = Funnel; - + realtime: true, // Whether realtime update view when select. -/***/ }, -/* 225 */ -/***/ function(module, exports, __webpack_require__) { + z: 10 + }; - + zrUtil.merge(AxisModel.prototype, __webpack_require__(111)); - var layout = __webpack_require__(21); - var number = __webpack_require__(7); + function getAxisType(axisName, option) { + return option.type || (option.data ? 'category' : 'value'); + } - var parsePercent = number.parsePercent; + axisModelCreator('parallel', AxisModel, getAxisType, defaultOption); - function getViewRect(seriesModel, api) { - return layout.getLayoutRect( - seriesModel.getBoxLayoutParams(), { - width: api.getWidth(), - height: api.getHeight() - } - ); - } + module.exports = AxisModel; - function getSortedIndices(data, sort) { - var valueArr = data.mapArray('value', function (val) { - return val; - }); - var indices = []; - var isAscending = sort === 'ascending'; - for (var i = 0, len = data.count(); i < len; i++) { - indices[i] = i; - } - indices.sort(function (a, b) { - return isAscending ? valueArr[a] - valueArr[b] : valueArr[b] - valueArr[a]; - }); - return indices; - } - function labelLayout (data) { - data.each(function (idx) { - var itemModel = data.getItemModel(idx); - var labelModel = itemModel.getModel('label.normal'); - var labelPosition = labelModel.get('position'); +/***/ }, +/* 247 */ +/***/ function(module, exports, __webpack_require__) { - var labelLineModel = itemModel.getModel('labelLine.normal'); + - var layout = data.getItemLayout(idx); - var points = layout.points; + __webpack_require__(242); + __webpack_require__(248); + __webpack_require__(249); - var isLabelInside = labelPosition === 'inner' - || labelPosition === 'inside' || labelPosition === 'center'; - var textAlign; - var textX; - var textY; - var linePoints; - if (isLabelInside) { - textX = (points[0][0] + points[1][0] + points[2][0] + points[3][0]) / 4; - textY = (points[0][1] + points[1][1] + points[2][1] + points[3][1]) / 4; - textAlign = 'center'; - linePoints = [ - [textX, textY], [textX, textY] - ]; +/***/ }, +/* 248 */ +/***/ function(module, exports, __webpack_require__) { + + + + var echarts = __webpack_require__(1); + + /** + * @payload + * @property {string} parallelAxisId + * @property {Array.>} intervals + */ + var actionInfo = { + type: 'axisAreaSelect', + event: 'axisAreaSelected', + update: 'updateVisual' + }; + echarts.registerAction(actionInfo, function (payload, ecModel) { + ecModel.eachComponent( + {mainType: 'parallelAxis', query: payload}, + function (parallelAxisModel) { + parallelAxisModel.axis.model.setActiveIntervals(payload.intervals); } - else { - var x1; - var y1; - var x2; - var labelLineLen = labelLineModel.get('length'); - if (labelPosition === 'left') { - // Left side - x1 = (points[3][0] + points[0][0]) / 2; - y1 = (points[3][1] + points[0][1]) / 2; - x2 = x1 - labelLineLen; - textX = x2 - 5; - textAlign = 'right'; - } - else { - // Right side - x1 = (points[1][0] + points[2][0]) / 2; - y1 = (points[1][1] + points[2][1]) / 2; - x2 = x1 + labelLineLen; - textX = x2 + 5; - textAlign = 'left'; - } - var y2 = y1; + ); + }); - linePoints = [[x1, y1], [x2, y2]]; - textY = y2; + /** + * @payload + */ + echarts.registerAction('parallelAxisExpand', function (payload, ecModel) { + ecModel.eachComponent( + {mainType: 'parallel', query: payload}, + function (parallelModel) { + parallelModel.setAxisExpand(payload); } + ); - layout.label = { - linePoints: linePoints, - x: textX, - y: textY, - verticalAlign: 'middle', - textAlign: textAlign, - inside: isLabelInside - }; - }); - } + }); - module.exports = function (ecModel, api, payload) { - ecModel.eachSeriesByType('funnel', function (seriesModel) { - var data = seriesModel.getData(); - var sort = seriesModel.get('sort'); - var viewRect = getViewRect(seriesModel, api); - var indices = getSortedIndices(data, sort); - var sizeExtent = [ - parsePercent(seriesModel.get('minSize'), viewRect.width), - parsePercent(seriesModel.get('maxSize'), viewRect.width) - ]; - var dataExtent = data.getDataExtent('value'); - var min = seriesModel.get('min'); - var max = seriesModel.get('max'); - if (min == null) { - min = Math.min(dataExtent[0], 0); - } - if (max == null) { - max = dataExtent[1]; - } +/***/ }, +/* 249 */ +/***/ function(module, exports, __webpack_require__) { - var funnelAlign = seriesModel.get('funnelAlign'); - var gap = seriesModel.get('gap'); - var itemHeight = (viewRect.height - gap * (data.count() - 1)) / data.count(); + - var y = viewRect.y; + var zrUtil = __webpack_require__(4); + var AxisBuilder = __webpack_require__(135); + var BrushController = __webpack_require__(250); + var graphic = __webpack_require__(44); - var getLinePoints = function (idx, offY) { - // End point index is data.count() and we assign it 0 - var val = data.get('value', idx) || 0; - var itemWidth = number.linearMap(val, [min, max], sizeExtent, true); - var x0; - switch (funnelAlign) { - case 'left': - x0 = viewRect.x; - break; - case 'center': - x0 = viewRect.x + (viewRect.width - itemWidth) / 2; - break; - case 'right': - x0 = viewRect.x + viewRect.width - itemWidth; - break; - } - return [ - [x0, offY], - [x0 + itemWidth, offY] - ]; - }; + var elementList = ['axisLine', 'axisLabel', 'axisTick', 'axisName']; - if (sort === 'ascending') { - // From bottom to top - itemHeight = -itemHeight; - gap = -gap; - y += viewRect.height; - indices = indices.reverse(); - } + var AxisView = __webpack_require__(1).extendComponentView({ - for (var i = 0; i < indices.length; i++) { - var idx = indices[i]; - var nextIdx = indices[i + 1]; - var start = getLinePoints(idx, y); - var end = getLinePoints(nextIdx, y + itemHeight); + type: 'parallelAxis', - y += itemHeight + gap; + /** + * @override + */ + init: function (ecModel, api) { + AxisView.superApply(this, 'init', arguments); - data.setItemLayout(idx, { - points: start.concat(end.slice().reverse()) - }); + /** + * @type {module:echarts/component/helper/BrushController} + */ + (this._brushController = new BrushController(api.getZr())) + .on('brush', zrUtil.bind(this._onBrush, this)); + }, + + /** + * @override + */ + render: function (axisModel, ecModel, api, payload) { + if (fromAxisAreaSelect(axisModel, ecModel, payload)) { + return; } - labelLayout(data); - }); - }; + this.axisModel = axisModel; + this.api = api; + this.group.removeAll(); -/***/ }, -/* 226 */ -/***/ function(module, exports, __webpack_require__) { + var oldAxisGroup = this._axisGroup; + this._axisGroup = new graphic.Group(); + this.group.add(this._axisGroup); - + if (!axisModel.get('show')) { + return; + } - var echarts = __webpack_require__(1); + var coordSys = ecModel.getComponent( + 'parallel', axisModel.get('parallelIndex') + ).coordinateSystem; - __webpack_require__(227); + var areaSelectStyle = axisModel.getAreaSelectStyle(); + var areaWidth = areaSelectStyle.width; - __webpack_require__(238); - __webpack_require__(239); + var dim = axisModel.axis.dim; + var axisLayout = coordSys.getAxisLayout(dim); - echarts.registerVisual(__webpack_require__(240)); + // Fetch from axisModel by default. + var axisLabelShow; + var axisIndex = zrUtil.indexOf(coordSys.dimensions, dim); + var axisExpandWindow = axisLayout.axisExpandWindow; + if (axisExpandWindow + && (axisIndex <= axisExpandWindow[0] || axisIndex >= axisExpandWindow[1]) + ) { + axisLabelShow = false; + } + var builderOpt = zrUtil.extend( + { + axisLabelShow: axisLabelShow, + strokeContainThreshold: areaWidth + }, + axisLayout + ); -/***/ }, -/* 227 */ -/***/ function(module, exports, __webpack_require__) { + var axisBuilder = new AxisBuilder(axisModel, builderOpt); - + zrUtil.each(elementList, axisBuilder.add, axisBuilder); - __webpack_require__(228); - __webpack_require__(231); - __webpack_require__(233); + this._axisGroup.add(axisBuilder.getGroup()); - var echarts = __webpack_require__(1); - var zrUtil = __webpack_require__(4); + this._refreshBrushController(builderOpt, areaSelectStyle, axisModel, areaWidth); - var CLICK_THRESHOLD = 5; // > 4 + graphic.groupTransition(oldAxisGroup, this._axisGroup, axisModel); + }, - // Parallel view - echarts.extendComponentView({ - type: 'parallel', + _refreshBrushController: function (builderOpt, areaSelectStyle, axisModel, areaWidth) { + // After filtering, axis may change, select area needs to be update. + var axis = axisModel.axis; + var coverInfoList = zrUtil.map(axisModel.activeIntervals, function (interval) { + return { + brushType: 'lineX', + panelId: 'pl', + range: [ + axis.dataToCoord(interval[0], true), + axis.dataToCoord(interval[1], true) + ] + }; + }); - render: function (parallelModel, ecModel, api) { - var zr = api.getZr(); + var extent = axis.getExtent(); + var extentLen = extent[1] - extent[0]; + var extra = Math.min(30, Math.abs(extentLen) * 0.1); // Arbitrary value. - if (!this.__onMouseDown) { - // FIXME - // click: mousemove check. otherwise confilct with drag brush. - var mousedownPoint; - zr.on('mousedown', this.__onMouseDown = function (e) { - mousedownPoint = [e.offsetX, e.offsetY]; - }); - zr.on('mouseup', this.__onMouseUp = function (e) { - var point = [e.offsetX, e.offsetY]; - var dist = Math.pow(mousedownPoint[0] - point[0], 2) - + Math.pow(mousedownPoint[1] - point[1], 2); + // width/height might be negative, which will be + // normalized in BoundingRect. + var rect = graphic.BoundingRect.create({ + x: extent[0], + y: -areaWidth / 2, + width: extentLen, + height: areaWidth + }); + rect.x -= extra; + rect.width += 2 * extra; - if (!parallelModel.get('axisExpandable') || dist > CLICK_THRESHOLD) { - return; - } + this._brushController + .mount({ + enableGlobalPan: true, + rotation: builderOpt.rotation, + position: builderOpt.position + }) + .setPanels([{ + panelId: 'pl', + rect: rect + }]) + .enableBrush({ + brushType: 'lineX', + brushStyle: areaSelectStyle, + removeOnClick: true + }) + .updateCovers(coverInfoList); + }, - var coordSys = parallelModel.coordinateSystem; - var closestDim = coordSys.findClosestAxisDim(point); - if (closestDim) { - var axisIndex = zrUtil.indexOf(coordSys.dimensions, closestDim); - api.dispatchAction({ - type: 'parallelAxisExpand', - axisExpandCenter: axisIndex - }); - } + _onBrush: function (coverInfoList, opt) { + // Do not cache these object, because the mey be changed. + var axisModel = this.axisModel; + var axis = axisModel.axis; + + var intervals = zrUtil.map(coverInfoList, function (coverInfo) { + return [ + axis.coordToData(coverInfo.range[0], true), + axis.coordToData(coverInfo.range[1], true) + ]; + }); + + // If realtime is true, action is not dispatched on drag end, because + // the drag end emits the same params with the last drag move event, + // and may have some delay when using touch pad. + if (!axisModel.option.realtime === opt.isEnd || opt.removeOnClick) { // jshint ignore:line + this.api.dispatchAction({ + type: 'axisAreaSelect', + parallelAxisId: axisModel.id, + intervals: intervals }); } }, - dispose: function (ecModel, api) { - api.getZr().off(this.__onMouseDown); - api.getZr().off(this.__onMouseUp); + /** + * @override + */ + dispose: function () { + this._brushController.dispose(); } }); - echarts.registerPreprocessor( - __webpack_require__(237) - ); + function fromAxisAreaSelect(axisModel, ecModel, payload) { + return payload + && payload.type === 'axisAreaSelect' + && ecModel.findComponents( + {mainType: 'parallelAxis', query: payload} + )[0] === axisModel; + } + module.exports = AxisView; /***/ }, -/* 228 */ +/* 250 */ /***/ function(module, exports, __webpack_require__) { /** - * Parallel coordinate system creater. + * Box selection tool. + * + * @module echarts/component/helper/BrushController */ - var Parallel = __webpack_require__(229); - function create(ecModel, api) { - var coordSysList = []; - - ecModel.eachComponent('parallel', function (parallelModel, idx) { - var coordSys = new Parallel(parallelModel, ecModel, api); + var Eventful = __webpack_require__(33); + var zrUtil = __webpack_require__(4); + var BoundingRect = __webpack_require__(9); + var graphic = __webpack_require__(44); + var interactionMutex = __webpack_require__(192); + var DataDiffer = __webpack_require__(99); - coordSys.name = 'parallel_' + idx; - coordSys.resize(parallelModel, api); + var curry = zrUtil.curry; + var each = zrUtil.each; + var map = zrUtil.map; + var mathMin = Math.min; + var mathMax = Math.max; + var mathPow = Math.pow; - parallelModel.coordinateSystem = coordSys; - coordSys.model = parallelModel; + var COVER_Z = 10000; + var UNSELECT_THRESHOLD = 6; + var MIN_RESIZE_LINE_WIDTH = 6; + var MUTEX_RESOURCE_KEY = 'globalPan'; - coordSysList.push(coordSys); - }); + var DIRECTION_MAP = { + w: [0, 0], + e: [0, 1], + n: [1, 0], + s: [1, 1] + }; + var CURSOR_MAP = { + w: 'ew', + e: 'ew', + n: 'ns', + s: 'ns', + ne: 'nesw', + sw: 'nesw', + nw: 'nwse', + se: 'nwse' + }; + var DEFAULT_BRUSH_OPT = { + brushStyle: { + lineWidth: 2, + stroke: 'rgba(0,0,0,0.3)', + fill: 'rgba(0,0,0,0.1)' + }, + transformable: true, + brushMode: 'single', + removeOnClick: false + }; - // Inject the coordinateSystems into seriesModel - ecModel.eachSeries(function (seriesModel) { - if (seriesModel.get('coordinateSystem') === 'parallel') { - var parallelModel = ecModel.queryComponents({ - mainType: 'parallel', - index: seriesModel.get('parallelIndex'), - id: seriesModel.get('parallelId') - })[0]; - seriesModel.coordinateSystem = parallelModel.coordinateSystem; - } - }); + var baseUID = 0; - return coordSysList; - } + /** + * @alias module:echarts/component/helper/BrushController + * @constructor + * @mixin {module:zrender/mixin/Eventful} + * @event module:echarts/component/helper/BrushController#brush + * params: + * areas: Array., coord relates to container group, + * If no container specified, to global. + * opt { + * isEnd: boolean, + * removeOnClick: boolean + * } + * + * @param {module:zrender/zrender~ZRender} zr + */ + function BrushController(zr) { - __webpack_require__(26).register('parallel', {create: create}); + if (true) { + zrUtil.assert(zr); + } + Eventful.call(this); + /** + * @type {module:zrender/zrender~ZRender} + * @private + */ + this._zr = zr; -/***/ }, -/* 229 */ -/***/ function(module, exports, __webpack_require__) { + /** + * @type {module:zrender/container/Group} + * @readOnly + */ + this.group = new graphic.Group(); - /** - * Parallel Coordinates - * - */ + /** + * Only for drawing (after enabledBrush). + * 'line', 'rect', 'polygon' or false + * If passing false/null/undefined, disable brush. + * If passing 'auto', determined by panel.defaultBrushType + * @private + * @type {string} + */ + this._brushType; + /** + * Only for drawing (after enabledBrush). + * + * @private + * @type {Object} + */ + this._brushOption; - var layout = __webpack_require__(21); - var axisHelper = __webpack_require__(115); - var zrUtil = __webpack_require__(4); - var ParallelAxis = __webpack_require__(230); - var graphic = __webpack_require__(43); - var matrix = __webpack_require__(11); + /** + * @private + * @type {Object} + */ + this._panels; - var each = zrUtil.each; + /** + * @private + * @type {Array.} + */ + this._track = []; - var PI = Math.PI; + /** + * @private + * @type {boolean} + */ + this._dragging; - function Parallel(parallelModel, ecModel, api) { + /** + * @private + * @type {Array} + */ + this._covers = []; /** - * key: dimension - * @type {Object.} * @private + * @type {moudule:zrender/container/Group} */ - this._axesMap = {}; + this._creatingCover; /** - * key: dimension - * value: {position: [], rotation, } - * @type {Object.} + * true means global panel * @private + * @type {module:zrender/container/Group|boolean} */ - this._axesLayout = {}; + this._creatingPanel; /** - * Always follow axis order. - * @type {Array.} - * @readOnly + * @private + * @type {boolean} */ - this.dimensions = parallelModel.dimensions; + this._enableGlobalPan; /** - * @type {module:zrender/core/BoundingRect} + * @private + * @type {boolean} */ - this._rect; + if (true) { + this._mounted; + } /** - * @type {module:echarts/coord/parallel/ParallelModel} + * @private + * @type {string} */ - this._model = parallelModel; + this._uid = 'brushController_' + baseUID++; - this._init(parallelModel, ecModel, api); + /** + * @private + * @type {Object} + */ + this._handlers = {}; + each(mouseHandlers, function (handler, eventName) { + this._handlers[eventName] = zrUtil.bind(handler, this); + }, this); } - Parallel.prototype = { - - type: 'parallel', + BrushController.prototype = { - constructor: Parallel, + constructor: BrushController, /** - * Initialize cartesian coordinate systems - * @private + * If set to null/undefined/false, select disabled. + * @param {Object} brushOption + * @param {string|boolean} brushOption.brushType 'line', 'rect', 'polygon' or false + * If passing false/null/undefined, disable brush. + * If passing 'auto', determined by panel.defaultBrushType. + * ('auto' can not be used in global panel) + * @param {number} [brushOption.brushMode='single'] 'single' or 'multiple' + * @param {boolean} [brushOption.transformable=true] + * @param {boolean} [brushOption.removeOnClick=false] + * @param {Object} [brushOption.brushStyle] + * @param {number} [brushOption.brushStyle.width] + * @param {number} [brushOption.brushStyle.lineWidth] + * @param {string} [brushOption.brushStyle.stroke] + * @param {string} [brushOption.brushStyle.fill] */ - _init: function (parallelModel, ecModel, api) { + enableBrush: function (brushOption) { + if (true) { + zrUtil.assert(this._mounted); + } - var dimensions = parallelModel.dimensions; - var parallelAxisIndex = parallelModel.parallelAxisIndex; + this._brushType && doDisableBrush(this); + brushOption.brushType && doEnableBrush(this, brushOption); - each(dimensions, function (dim, idx) { + return this; + }, - var axisIndex = parallelAxisIndex[idx]; - var axisModel = ecModel.getComponent('parallelAxis', axisIndex); + /** + * @param {Array.} panelOpts If not pass, it is global brush. + * Each items: { + * panelId, // mandatory. + * rect, // mandatory. + * defaultBrushType // optional, only used when brushType is 'auto'. + * } + */ + setPanels: function (panelOpts) { + var oldPanels = this._panels || {}; + var newPanels = this._panels = panelOpts && panelOpts.length && {}; + var thisGroup = this.group; - var axis = this._axesMap[dim] = new ParallelAxis( - dim, - axisHelper.createScaleByModel(axisModel), - [0, 0], - axisModel.get('type'), - axisIndex - ); + newPanels && each(panelOpts, function (panelOpt) { + var panelId = panelOpt.panelId; + var panel = oldPanels[panelId]; + if (!panel) { + panel = new graphic.Rect({ + silent: true, + invisible: true + }); + thisGroup.add(panel); + } - var isCategory = axis.type === 'category'; - axis.onBand = isCategory && axisModel.get('boundaryGap'); - axis.inverse = axisModel.get('inverse'); + var rect = panelOpt.rect; + // Using BoundingRect to normalize negative width/height. + if (!(rect instanceof BoundingRect)) { + rect = BoundingRect.create(rect); + } - // Inject axis into axisModel - axisModel.axis = axis; + panel.attr('shape', rect.plain()); + panel.__brushPanelId = panelId; + panel.__defaultBrushType = panelOpt.defaultBrushType; + newPanels[panelId] = panel; + oldPanels[panelId] = null; + }); - // Inject axisModel into axis - axis.model = axisModel; - }, this); - }, + each(oldPanels, function (panel) { + panel && thisGroup.remove(panel); + }); - /** - * Update axis scale after data processed - * @param {module:echarts/model/Global} ecModel - * @param {module:echarts/ExtensionAPI} api - */ - update: function (ecModel, api) { - this._updateAxesFromSeries(this._model, ecModel); + return this; }, /** - * Update properties from series - * @private + * @param {Object} [opt] + * @return {boolean} [opt.enableGlobalPan=false] + * @return {boolean} [opt.position=[0, 0]] + * @return {boolean} [opt.rotation=0] + * @return {boolean} [opt.scale=[1, 1]] */ - _updateAxesFromSeries: function (parallelModel, ecModel) { - ecModel.eachSeries(function (seriesModel) { + mount: function (opt) { + opt = opt || {}; - if (!parallelModel.contains(seriesModel, ecModel)) { - return; - } + if (true) { + this._mounted = true; // should be at first. + } - var data = seriesModel.getData(); + this._enableGlobalPan = opt.enableGlobalPan; - each(this.dimensions, function (dim) { - var axis = this._axesMap[dim]; - axis.scale.unionExtentFromData(data, dim); - axisHelper.niceScaleExtent(axis, axis.model); - }, this); - }, this); - }, + var thisGroup = this.group; + this._zr.add(thisGroup); - /** - * Resize the parallel coordinate system. - * @param {module:echarts/coord/parallel/ParallelModel} parallelModel - * @param {module:echarts/ExtensionAPI} api - */ - resize: function (parallelModel, api) { - this._rect = layout.getLayoutRect( - parallelModel.getBoxLayoutParams(), - { - width: api.getWidth(), - height: api.getHeight() - } - ); + thisGroup.attr({ + position: opt.position || [0, 0], + rotation: opt.rotation || 0, + scale: opt.scale || [1, 1] + }); - this._layoutAxes(parallelModel); + return this; }, - /** - * @return {module:zrender/core/BoundingRect} - */ - getRect: function () { - return this._rect; + eachCover: function (cb, context) { + each(this._covers, cb, context); }, /** - * @private + * Update covers. + * @param {Array.} brushOptionList Like: + * [ + * {id: 'xx', brushType: 'line', range: [23, 44], brushStyle, transformable}, + * {id: 'yy', brushType: 'rect', range: [[23, 44], [23, 54]]}, + * ... + * ] + * `brushType` is required in each cover info. (can not be 'auto') + * `id` is not mandatory. + * `brushStyle`, `transformable` is not mandatory, use DEFAULT_BRUSH_OPT by default. + * If brushOptionList is null/undefined, all covers removed. */ - _layoutAxes: function (parallelModel) { - var rect = this._rect; - var layout = parallelModel.get('layout'); - var axes = this._axesMap; - var dimensions = this.dimensions; - - var size = [rect.width, rect.height]; - var sizeIdx = layout === 'horizontal' ? 0 : 1; - var layoutLength = size[sizeIdx]; - var axisLength = size[1 - sizeIdx]; - var axisExtent = [0, axisLength]; + updateCovers: function (brushOptionList) { + if (true) { + zrUtil.assert(this._mounted); + } - each(axes, function (axis) { - var idx = axis.inverse ? 1 : 0; - axis.setExtent(axisExtent[idx], axisExtent[1 - idx]); + brushOptionList = zrUtil.map(brushOptionList, function (brushOption) { + return zrUtil.merge(zrUtil.clone(DEFAULT_BRUSH_OPT), brushOption, true); }); - var axisExpandable = parallelModel.get('axisExpandable'); - var axisExpandWidth = parallelModel.get('axisExpandWidth'); - var axisExpandCenter = parallelModel.get('axisExpandCenter'); - var axisExpandCount = parallelModel.get('axisExpandCount') || 0; - var axisExpandWindow; + var tmpIdPrefix = '\0-brush-index-'; + var oldCovers = this._covers; + var newCovers = this._covers = []; + var controller = this; + var creatingCover = this._creatingCover; - if (axisExpandCenter != null) { - // Clamp - var left = Math.max(0, Math.floor(axisExpandCenter - (axisExpandCount - 1) / 2)); - var right = left + axisExpandCount - 1; - if (right >= dimensions.length) { - right = dimensions.length - 1; - left = Math.max(0, Math.floor(right - axisExpandCount + 1)); - } - axisExpandWindow = [left, right]; - } + (new DataDiffer(oldCovers, brushOptionList, oldGetKey, getKey)) + .add(addOrUpdate) + .update(addOrUpdate) + .remove(remove) + .execute(); - var calcPos = (axisExpandable && axisExpandWindow && axisExpandWidth) - ? function (axisIndex, layoutLength, axisCount) { - var peekIntervalCount = axisExpandWindow[1] - axisExpandWindow[0]; - var otherWidth = ( - layoutLength - axisExpandWidth * peekIntervalCount - ) / (axisCount - 1 - peekIntervalCount); + return this; - var position; + function getKey(brushOption, index) { + return (brushOption.id != null ? brushOption.id : tmpIdPrefix + index) + + '-' + brushOption.brushType; + } - if (axisIndex < axisExpandWindow[0]) { - position = (axisIndex - 1) * otherWidth; - } - else if (axisIndex <= axisExpandWindow[1]) { - position = axisExpandWindow[0] * otherWidth - + (axisIndex - axisExpandWindow[0]) * axisExpandWidth; - } - else if (axisIndex === axisCount - 1) { - position = layoutLength; - } - else { - position = axisExpandWindow[0] * otherWidth - + peekIntervalCount * axisExpandWidth - + (axisIndex - axisExpandWindow[1]) * otherWidth; - } + function oldGetKey(cover, index) { + return getKey(cover.__brushOption, index); + } - return { - position: position, - axisNameAvailableWidth: ( - axisExpandWindow[0] < axisIndex && axisIndex < axisExpandWindow[1] - ) ? axisExpandWidth : otherWidth - }; + function addOrUpdate(newIndex, oldIndex) { + var newBrushOption = brushOptionList[newIndex]; + // Consider setOption in event listener of brushSelect, + // where updating cover when creating should be forbiden. + if (oldIndex != null && oldCovers[oldIndex] === creatingCover) { + newCovers[newIndex] = oldCovers[oldIndex]; } - : function (axisIndex, layoutLength, axisCount) { - var step = layoutLength / (axisCount - 1); - return { - position: step * axisIndex, - axisNameAvailableWidth: step - }; - }; - - each(dimensions, function (dim, idx) { - var posInfo = calcPos(idx, layoutLength, dimensions.length); + else { + var cover = newCovers[newIndex] = oldIndex != null + ? ( + oldCovers[oldIndex].__brushOption = newBrushOption, + oldCovers[oldIndex] + ) + : endCreating(controller, createCover(controller, newBrushOption)); + updateCoverAfterCreation(controller, cover); + } + } - var positionTable = { - horizontal: { - x: posInfo.position, - y: axisLength - }, - vertical: { - x: 0, - y: posInfo.position - } - }; - var rotationTable = { - horizontal: PI / 2, - vertical: 0 - }; + function remove(oldIndex) { + if (oldCovers[oldIndex] !== creatingCover) { + controller.group.remove(oldCovers[oldIndex]); + } + } + }, - var position = [ - positionTable[layout].x + rect.x, - positionTable[layout].y + rect.y - ]; + unmount: function () { + if (true) { + if (!this._mounted) { + return; + } + } - var rotation = rotationTable[layout]; - var transform = matrix.create(); - matrix.rotate(transform, transform, rotation); - matrix.translate(transform, transform, position); + this.enableBrush(false); - // TODO - // tick等排布信息。 + // container may 'removeAll' outside. + clearCovers(this); + this._zr.remove(this.group); - // TODO - // 根据axis order 更新 dimensions顺序。 + if (true) { + this._mounted = false; // should be at last. + } - this._axesLayout[dim] = { - position: position, - rotation: rotation, - transform: transform, - axisNameAvailableWidth: posInfo.axisNameAvailableWidth, - tickDirection: 1, - labelDirection: 1, - axisExpandWindow: axisExpandWindow - }; - }, this); + return this; }, - /** - * Get axis by dim. - * @param {string} dim - * @return {module:echarts/coord/parallel/ParallelAxis} [description] - */ - getAxis: function (dim) { - return this._axesMap[dim]; - }, + dispose: function () { + this.unmount(); + this.off(); + } + }; - /** - * Convert a dim value of a single item of series data to Point. - * @param {*} value - * @param {string} dim - * @return {Array} - */ - dataToPoint: function (value, dim) { - return this.axisCoordToPoint( - this._axesMap[dim].dataToCoord(value), - dim - ); - }, + zrUtil.mixin(BrushController, Eventful); - /** - * Travel data for one time, get activeState of each data item. - * @param {module:echarts/data/List} data - * @param {Functio} cb param: {string} activeState 'active' or 'inactive' or 'normal' - * {number} dataIndex - * @param {Object} context - */ - eachActiveState: function (data, callback, context) { - var dimensions = this.dimensions; - var axesMap = this._axesMap; - var hasActiveSet = this.hasAxisbrushed(); - for (var i = 0, len = data.count(); i < len; i++) { - var values = data.getValues(dimensions, i); - var activeState; + function doEnableBrush(controller, brushOption) { + var zr = controller._zr; - if (!hasActiveSet) { - activeState = 'normal'; - } - else { - activeState = 'active'; - for (var j = 0, lenj = dimensions.length; j < lenj; j++) { - var dimName = dimensions[j]; - var state = axesMap[dimName].model.getActiveState(values[j], j); + // Consider roam, which takes globalPan too. + if (!controller._enableGlobalPan) { + interactionMutex.take(zr, MUTEX_RESOURCE_KEY, controller._uid); + } - if (state === 'inactive') { - activeState = 'inactive'; - break; - } - } - } + each(controller._handlers, function (handler, eventName) { + zr.on(eventName, handler); + }); - callback.call(context, activeState, i); - } - }, + controller._brushType = brushOption.brushType; + controller._brushOption = zrUtil.merge(zrUtil.clone(DEFAULT_BRUSH_OPT), brushOption, true); + } - /** - * Whether has any activeSet. - * @return {boolean} - */ - hasAxisbrushed: function () { - var dimensions = this.dimensions; - var axesMap = this._axesMap; - var hasActiveSet = false; + function doDisableBrush(controller) { + var zr = controller._zr; - for (var j = 0, lenj = dimensions.length; j < lenj; j++) { - if (axesMap[dimensions[j]].model.getActiveState() !== 'normal') { - hasActiveSet = true; - } - } + interactionMutex.release(zr, MUTEX_RESOURCE_KEY, controller._uid); - return hasActiveSet; - }, + each(controller._handlers, function (handler, eventName) { + zr.off(eventName, handler); + }); - /** - * Convert coords of each axis to Point. - * Return point. For example: [10, 20] - * @param {Array.} coords - * @param {string} dim - * @return {Array.} - */ - axisCoordToPoint: function (coord, dim) { - var axisLayout = this._axesLayout[dim]; - return graphic.applyTransform([coord, 0], axisLayout.transform); - }, + controller._brushType = controller._brushOption = null; + } - /** - * Get axis layout. - */ - getAxisLayout: function (dim) { - return zrUtil.clone(this._axesLayout[dim]); - }, + function createCover(controller, brushOption) { + var cover = coverRenderers[brushOption.brushType].createCover(controller, brushOption); + updateZ(cover); + cover.__brushOption = brushOption; + controller.group.add(cover); + return cover; + } - findClosestAxisDim: function (point) { - var axisDim; - var minDist = Infinity; + function endCreating(controller, creatingCover) { + var coverRenderer = getCoverRenderer(creatingCover); + if (coverRenderer.endCreating) { + coverRenderer.endCreating(controller, creatingCover); + updateZ(creatingCover); + } + return creatingCover; + } - zrUtil.each(this._axesLayout, function (axisLayout, dim) { - var localPoint = graphic.applyTransform(point, axisLayout.transform, true); - var extent = this._axesMap[dim].getExtent(); + function updateCoverShape(controller, cover) { + var brushOption = cover.__brushOption; + getCoverRenderer(cover).updateCoverShape( + controller, cover, brushOption.range, brushOption + ); + } - if (localPoint[0] < extent[0] || localPoint[0] > extent[1]) { - return; - } + function updateZ(group) { + group.traverse(function (el) { + el.z = COVER_Z; + el.z2 = COVER_Z; // Consider in given container. + }); + } - var dist = Math.abs(localPoint[1]); - if (dist < minDist) { - minDist = dist; - axisDim = dim; - } - }, this); + function updateCoverAfterCreation(controller, cover) { + getCoverRenderer(cover).updateCommon(controller, cover); + updateCoverShape(controller, cover); + } - return axisDim; + function getCoverRenderer(cover) { + return coverRenderers[cover.__brushOption.brushType]; + } + + function getPanelByPoint(controller, x, y) { + var panels = controller._panels; + if (!panels) { + return true; // Global panel + } + var panel; + each(panels, function (pn) { + pn.contain(x, y) && (panel = pn); + }); + return panel; + } + + function getPanelByCover(controller, cover) { + var panels = controller._panels; + if (!panels) { + return true; // Global panel } + var panelId = cover.__brushOption.panelId; + // User may give cover without coord sys info, + // which is then treated as global panel. + return panelId != null ? panels[panelId] : true; + } - }; + function clearCovers(controller) { + var covers = controller._covers; + var originalLength = covers.length; + each(covers, function (cover) { + controller.group.remove(cover); + }, controller); + covers.length = 0; - module.exports = Parallel; + return !!originalLength; + } + function trigger(controller, opt) { + var areas = map(controller._covers, function (cover) { + var brushOption = cover.__brushOption; + var range = zrUtil.clone(brushOption.range); -/***/ }, -/* 230 */ -/***/ function(module, exports, __webpack_require__) { + return { + brushType: brushOption.brushType, + panelId: brushOption.panelId, + range: range + }; + }); - + controller.trigger('brush', areas, { + isEnd: !!opt.isEnd, + removeOnClick: !!opt.removeOnClick + }); + } - var zrUtil = __webpack_require__(4); - var Axis = __webpack_require__(124); + function shouldShowCover(controller) { + var track = controller._track; - /** - * @constructor module:echarts/coord/parallel/ParallelAxis - * @extends {module:echarts/coord/Axis} - * @param {string} dim - * @param {*} scale - * @param {Array.} coordExtent - * @param {string} axisType - */ - var ParallelAxis = function (dim, scale, coordExtent, axisType, axisIndex) { + if (!track.length) { + return false; + } - Axis.call(this, dim, scale, coordExtent); + var p2 = track[track.length - 1]; + var p1 = track[0]; + var dx = p2[0] - p1[0]; + var dy = p2[1] - p1[1]; + var dist = mathPow(dx * dx + dy * dy, 0.5); - /** - * Axis type - * - 'category' - * - 'value' - * - 'time' - * - 'log' - * @type {string} - */ - this.type = axisType || 'value'; + return dist > UNSELECT_THRESHOLD; + } - /** - * @type {number} - * @readOnly - */ - this.axisIndex = axisIndex; - }; + function getTrackEnds(track) { + var tail = track.length - 1; + tail < 0 && (tail = 0); + return [track[0], track[tail]]; + } - ParallelAxis.prototype = { + function createBaseRectCover(doDrift, controller, brushOption, edgeNames) { + var cover = new graphic.Group(); - constructor: ParallelAxis, + cover.add(new graphic.Rect({ + name: 'main', + style: makeStyle(brushOption), + silent: true, + draggable: true, + cursor: 'move', + drift: curry(doDrift, controller, cover, 'nswe'), + ondragend: curry(trigger, controller, {isEnd: true}) + })); - /** - * Axis model - * @param {module:echarts/coord/parallel/AxisModel} - */ - model: null + each( + edgeNames, + function (name) { + cover.add(new graphic.Rect({ + name: name, + style: {opacity: 0}, + draggable: true, + silent: true, + invisible: true, + drift: curry(doDrift, controller, cover, name), + ondragend: curry(trigger, controller, {isEnd: true}) + })); + } + ); - }; + return cover; + } - zrUtil.inherits(ParallelAxis, Axis); + function updateBaseRect(controller, cover, localRange, brushOption) { + var lineWidth = brushOption.brushStyle.lineWidth || 0; + var handleSize = mathMax(lineWidth, MIN_RESIZE_LINE_WIDTH); + var x = localRange[0][0]; + var y = localRange[1][0]; + var xa = x - lineWidth / 2; + var ya = y - lineWidth / 2; + var x2 = localRange[0][1]; + var y2 = localRange[1][1]; + var x2a = x2 - handleSize + lineWidth / 2; + var y2a = y2 - handleSize + lineWidth / 2; + var width = x2 - x; + var height = y2 - y; + var widtha = width + lineWidth; + var heighta = height + lineWidth; - module.exports = ParallelAxis; + updateRectShape(controller, cover, 'main', x, y, width, height); + if (brushOption.transformable) { + updateRectShape(controller, cover, 'w', xa, ya, handleSize, heighta); + updateRectShape(controller, cover, 'e', x2a, ya, handleSize, heighta); + updateRectShape(controller, cover, 'n', xa, ya, widtha, handleSize); + updateRectShape(controller, cover, 's', xa, y2a, widtha, handleSize); -/***/ }, -/* 231 */ -/***/ function(module, exports, __webpack_require__) { + updateRectShape(controller, cover, 'nw', xa, ya, handleSize, handleSize); + updateRectShape(controller, cover, 'ne', x2a, ya, handleSize, handleSize); + updateRectShape(controller, cover, 'sw', xa, y2a, handleSize, handleSize); + updateRectShape(controller, cover, 'se', x2a, y2a, handleSize, handleSize); + } + } - + function updateCommon(controller, cover) { + var brushOption = cover.__brushOption; + var transformable = brushOption.transformable; - var zrUtil = __webpack_require__(4); - var Component = __webpack_require__(19); + var mainEl = cover.childAt(0); + mainEl.useStyle(makeStyle(brushOption)); + mainEl.attr({ + silent: !transformable, + cursor: transformable ? 'move' : 'default' + }); - __webpack_require__(232); + each( + ['w', 'e', 'n', 's', 'se', 'sw', 'ne', 'nw'], + function (name) { + var el = cover.childOfName(name); + var globalDir = getGlobalDirection(controller, name); - Component.extend({ + el && el.attr({ + silent: !transformable, + invisible: !transformable, + cursor: transformable ? CURSOR_MAP[globalDir] + '-resize' : null + }); + } + ); + } - type: 'parallel', + function updateRectShape(controller, cover, name, x, y, w, h) { + var el = cover.childOfName(name); + el && el.setShape(pointsToRect( + clipByPanel(controller, cover, [[x, y], [x + w, y + h]]) + )); + } - dependencies: ['parallelAxis'], + function makeStyle(brushOption) { + return zrUtil.defaults({strokeNoScale: true}, brushOption.brushStyle); + } - /** - * @type {module:echarts/coord/parallel/Parallel} - */ - coordinateSystem: null, + function formatRectRange(x, y, x2, y2) { + var min = [mathMin(x, x2), mathMin(y, y2)]; + var max = [mathMax(x, x2), mathMax(y, y2)]; - /** - * Each item like: 'dim0', 'dim1', 'dim2', ... - * @type {Array.} - * @readOnly - */ - dimensions: null, + return [ + [min[0], max[0]], // x range + [min[1], max[1]] // y range + ]; + } - /** - * Coresponding to dimensions. - * @type {Array.} - * @readOnly - */ - parallelAxisIndex: null, + function getTransform(controller) { + return graphic.getTransform(controller.group); + } - layoutMode: 'box', + function getGlobalDirection(controller, localDirection) { + if (localDirection.length > 1) { + localDirection = localDirection.split(''); + var globalDir = [ + getGlobalDirection(controller, localDirection[0]), + getGlobalDirection(controller, localDirection[1]) + ]; + (globalDir[0] === 'e' || globalDir[0] === 'w') && globalDir.reverse(); + return globalDir.join(''); + } + else { + var map = {w: 'left', e: 'right', n: 'top', s: 'bottom'}; + var inverseMap = {left: 'w', right: 'e', top: 'n', bottom: 's'}; + var globalDir = graphic.transformDirection( + map[localDirection], getTransform(controller) + ); + return inverseMap[globalDir]; + } + } - defaultOption: { - zlevel: 0, - z: 0, - left: 80, - top: 60, - right: 80, - bottom: 60, - // width: {totalWidth} - left - right, - // height: {totalHeight} - top - bottom, + function driftRect(toRectRange, fromRectRange, controller, cover, name, dx, dy, e) { + var brushOption = cover.__brushOption; + var rectRange = toRectRange(brushOption.range); + var localDelta = toLocalDelta(controller, dx, dy); - layout: 'horizontal', // 'horizontal' or 'vertical' + each(name.split(''), function (namePart) { + var ind = DIRECTION_MAP[namePart]; + rectRange[ind[0]][ind[1]] += localDelta[ind[0]]; + }); - // FIXME - // naming? - axisExpandable: false, - axisExpandCenter: null, - axisExpandCount: 0, - axisExpandWidth: 50, // FIXME '10%' ? + brushOption.range = fromRectRange(formatRectRange( + rectRange[0][0], rectRange[1][0], rectRange[0][1], rectRange[1][1] + )); - parallelAxisDefault: null - }, + updateCoverAfterCreation(controller, cover); + trigger(controller, {isEnd: false}); + } - /** - * @override - */ - init: function () { - Component.prototype.init.apply(this, arguments); + function driftPolygon(controller, cover, dx, dy, e) { + var range = cover.__brushOption.range; + var localDelta = toLocalDelta(controller, dx, dy); - this.mergeOption({}); - }, + each(range, function (point) { + point[0] += localDelta[0]; + point[1] += localDelta[1]; + }); - /** - * @override - */ - mergeOption: function (newOption) { - var thisOption = this.option; + updateCoverAfterCreation(controller, cover); + trigger(controller, {isEnd: false}); + } - newOption && zrUtil.merge(thisOption, newOption, true); + function toLocalDelta(controller, dx, dy) { + var thisGroup = controller.group; + var localD = thisGroup.transformCoordToLocal(dx, dy); + var localZero = thisGroup.transformCoordToLocal(0, 0); - this._initDimensions(); - }, + return [localD[0] - localZero[0], localD[1] - localZero[1]]; + } - /** - * Whether series or axis is in this coordinate system. - * @param {module:echarts/model/Series|module:echarts/coord/parallel/AxisModel} model - * @param {module:echarts/model/Global} ecModel - */ - contains: function (model, ecModel) { - var parallelIndex = model.get('parallelIndex'); - return parallelIndex != null - && ecModel.getComponent('parallel', parallelIndex) === this; - }, + function clipByPanel(controller, cover, data) { + var panel = getPanelByCover(controller, cover); + if (panel === true) { // Global panel + return zrUtil.clone(data); + } - setAxisExpand: function (opt) { - zrUtil.each( - ['axisExpandable', 'axisExpandCenter', 'axisExpandCount', 'axisExpandWidth'], - function (name) { - if (opt.hasOwnProperty(name)) { - this.option[name] = opt[name]; - } - }, - this - ); - }, + var panelRect = panel.getBoundingRect(); - /** - * @private - */ - _initDimensions: function () { - var dimensions = this.dimensions = []; - var parallelAxisIndex = this.parallelAxisIndex = []; + return zrUtil.map(data, function (point) { + var x = point[0]; + x = mathMax(x, panelRect.x); + x = mathMin(x, panelRect.x + panelRect.width); + var y = point[1]; + y = mathMax(y, panelRect.y); + y = mathMin(y, panelRect.y + panelRect.height); + return [x, y]; + }); + } - var axisModels = zrUtil.filter(this.dependentModels.parallelAxis, function (axisModel) { - // Can not use this.contains here, because - // initialization has not been completed yet. - return axisModel.get('parallelIndex') === this.componentIndex; - }); + function pointsToRect(points) { + var xmin = mathMin(points[0][0], points[1][0]); + var ymin = mathMin(points[0][1], points[1][1]); + var xmax = mathMax(points[0][0], points[1][0]); + var ymax = mathMax(points[0][1], points[1][1]); - zrUtil.each(axisModels, function (axisModel) { - dimensions.push('dim' + axisModel.get('dim')); - parallelAxisIndex.push(axisModel.componentIndex); - }); - } + return { + x: xmin, + y: ymin, + width: xmax - xmin, + height: ymax - ymin + }; + } - }); + function resetCursor(controller, e) { + var x = e.offsetX; + var y = e.offsetY; + var zr = controller._zr; + if (controller._brushType) { // If active + var panels = controller._panels; + var covers = controller._covers; + var inCover; + for (var i = 0; i < covers.length; i++) { + if (coverRenderers[covers[i].__brushOption.brushType].contain(covers[i], x, y)) { + inCover = true; + break; + } + } -/***/ }, -/* 232 */ -/***/ function(module, exports, __webpack_require__) { + if (!inCover) { + if (panels) { // Brush on panels + each(panels, function (panel) { + panel.contain(x, y) && zr.setCursorStyle('crosshair'); + }); + } + else { // Global brush + zr.setCursorStyle('crosshair'); + } + } + } + } - + function preventDefault(e) { + var rawE = e.event; + rawE.preventDefault && rawE.preventDefault(); + } - var ComponentModel = __webpack_require__(19); - var zrUtil = __webpack_require__(4); - var makeStyleMapper = __webpack_require__(15); - var axisModelCreator = __webpack_require__(128); - var numberUtil = __webpack_require__(7); + function mainShapeContain(cover, x, y) { + return cover.childOfName('main').contain(x, y); + } - var AxisModel = ComponentModel.extend({ + function updateCoverByMouse(controller, e, isEnd) { + var x = e.offsetX; + var y = e.offsetY; + var creatingCover = controller._creatingCover; + var panel = controller._creatingPanel; + var thisBrushOption = controller._brushOption; + var eventParams; - type: 'baseParallelAxis', + controller._track.push(controller.group.transformCoordToLocal(x, y)); - /** - * @type {module:echarts/coord/parallel/Axis} - */ - axis: null, + if (shouldShowCover(controller) || creatingCover) { - /** - * @type {Array.} - * @readOnly - */ - activeIntervals: [], + if (panel && !creatingCover) { + thisBrushOption.brushMode === 'single' && clearCovers(controller); + var brushOption = zrUtil.clone(thisBrushOption); + brushOption.brushType = determineBrushType(brushOption.brushType, panel); + brushOption.panelId = panel === true ? null : panel.__brushPanelId; + creatingCover = controller._creatingCover = createCover(controller, brushOption); + controller._covers.push(creatingCover); + } - /** - * @return {Object} - */ - getAreaSelectStyle: function () { - return makeStyleMapper( - [ - ['fill', 'color'], - ['lineWidth', 'borderWidth'], - ['stroke', 'borderColor'], - ['width', 'width'], - ['opacity', 'opacity'] - ] - ).call(this.getModel('areaSelectStyle')); - }, + if (creatingCover) { + var coverRenderer = coverRenderers[determineBrushType(controller._brushType, panel)]; + var coverBrushOption = creatingCover.__brushOption; - /** - * The code of this feature is put on AxisModel but not ParallelAxis, - * because axisModel can be alive after echarts updating but instance of - * ParallelAxis having been disposed. this._activeInterval should be kept - * when action dispatched (i.e. legend click). - * - * @param {Array.>} intervals interval.length === 0 - * means set all active. - * @public - */ - setActiveIntervals: function (intervals) { - var activeIntervals = this.activeIntervals = zrUtil.clone(intervals); + coverBrushOption.range = coverRenderer.getCreatingRange( + clipByPanel(controller, creatingCover, controller._track) + ); - // Normalize - if (activeIntervals) { - for (var i = activeIntervals.length - 1; i >= 0; i--) { - numberUtil.asc(activeIntervals[i]); + if (isEnd) { + endCreating(controller, creatingCover); + coverRenderer.updateCommon(controller, creatingCover); } + + updateCoverShape(controller, creatingCover); + + eventParams = {isEnd: isEnd}; } - }, + } + else if ( + isEnd + && thisBrushOption.brushMode === 'single' + && thisBrushOption.removeOnClick + ) { + // Help user to remove covers easily, only by a tiny drag, in 'single' mode. + // But a single click do not clear covers, because user may have casual + // clicks (for example, click on other component and do not expect covers + // disappear). + // Only some cover removed, trigger action, but not every click trigger action. + if (getPanelByPoint(controller, x, y) && clearCovers(controller)) { + eventParams = {isEnd: isEnd, removeOnClick: true}; + } + } - /** - * @param {number|string} [value] When attempting to detect 'no activeIntervals set', - * value can not be input. - * @return {string} 'normal': no activeIntervals set, - * 'active', - * 'inactive'. - * @public - */ - getActiveState: function (value) { - var activeIntervals = this.activeIntervals; + return eventParams; + } - if (!activeIntervals.length) { - return 'normal'; + function determineBrushType(brushType, panel) { + if (brushType === 'auto') { + if (true) { + zrUtil.assert( + panel && panel.__defaultBrushType, + 'MUST have defaultBrushType when brushType is "atuo"' + ); } + return panel.__defaultBrushType; + } + return brushType; + } - if (value == null) { - return 'inactive'; + var mouseHandlers = { + + mousedown: function (e) { + if (this._dragging) { + // In case some browser do not support globalOut, + // and release mose out side the browser. + handleDragEnd.call(this, e); } + else if (!e.target || !e.target.draggable) { - for (var i = 0, len = activeIntervals.length; i < len; i++) { - if (activeIntervals[i][0] <= value && value <= activeIntervals[i][1]) { - return 'active'; + preventDefault(e); + + var x = e.offsetX; + var y = e.offsetY; + + this._creatingCover = null; + var panel = this._creatingPanel = getPanelByPoint(this, x, y); + + if (panel) { + this._dragging = true; + this._track = [this.group.transformCoordToLocal(x, y)]; } } - return 'inactive'; - } - - }); + }, - var defaultOption = { + mousemove: function (e) { + // set Cursor + resetCursor(this, e); - type: 'value', + if (this._dragging) { - /** - * @type {Array.} - */ - dim: null, // 0, 1, 2, ... + preventDefault(e); - // parallelIndex: null, + var eventParams = updateCoverByMouse(this, e, false); - areaSelectStyle: { - width: 20, - borderWidth: 1, - borderColor: 'rgba(160,197,232)', - color: 'rgba(160,197,232)', - opacity: 0.3 + eventParams && trigger(this, eventParams); + } }, - realtime: true, // Whether realtime update view when select. + mouseup: handleDragEnd //, - z: 10 + // FIXME + // in tooltip, globalout should not be triggered. + // globalout: handleDragEnd }; - zrUtil.merge(AxisModel.prototype, __webpack_require__(130)); + function handleDragEnd(e) { + if (this._dragging) { - function getAxisType(axisName, option) { - return option.type || (option.data ? 'category' : 'value'); - } + preventDefault(e); - axisModelCreator('parallel', AxisModel, getAxisType, defaultOption); + var eventParams = updateCoverByMouse(this, e, true); - module.exports = AxisModel; + this._dragging = false; + this._track = []; + this._creatingCover = null; + // trigger event shoule be at final, after procedure will be nested. + eventParams && trigger(this, eventParams); + } + } -/***/ }, -/* 233 */ -/***/ function(module, exports, __webpack_require__) { + /** + * key: brushType + * @type {Object} + */ + var coverRenderers = { - + lineX: getLineRenderer(0), - __webpack_require__(228); - __webpack_require__(234); - __webpack_require__(235); + lineY: getLineRenderer(1), + rect: { + createCover: function (controller, brushOption) { + return createBaseRectCover( + curry( + driftRect, + function (range) { + return range; + }, + function (range) { + return range; + } + ), + controller, + brushOption, + ['w', 'e', 'n', 's', 'se', 'sw', 'ne', 'nw'] + ); + }, + getCreatingRange: function (localTrack) { + var ends = getTrackEnds(localTrack); + return formatRectRange(ends[1][0], ends[1][1], ends[0][0], ends[0][1]); + }, + updateCoverShape: function (controller, cover, localRange, brushOption) { + updateBaseRect(controller, cover, localRange, brushOption); + }, + updateCommon: updateCommon, + contain: mainShapeContain + }, + polygon: { + createCover: function (controller, brushOption) { + var cover = new graphic.Group(); -/***/ }, -/* 234 */ -/***/ function(module, exports, __webpack_require__) { + // Do not use graphic.Polygon because graphic.Polyline do not close the + // border of the shape when drawing, which is a better experience for user. + cover.add(new graphic.Polyline({ + name: 'main', + style: makeStyle(brushOption), + silent: true + })); - + return cover; + }, + getCreatingRange: function (localTrack) { + return localTrack; + }, + endCreating: function (controller, cover) { + cover.remove(cover.childAt(0)); + // Use graphic.Polygon close the shape. + cover.add(new graphic.Polygon({ + name: 'main', + draggable: true, + drift: curry(driftPolygon, controller, cover), + ondragend: curry(trigger, controller, {isEnd: true}) + })); + }, + updateCoverShape: function (controller, cover, localRange, brushOption) { + cover.childAt(0).setShape({ + points: clipByPanel(controller, cover, localRange) + }); + }, + updateCommon: updateCommon, + contain: mainShapeContain + } + }; - var echarts = __webpack_require__(1); + function getLineRenderer(xyIndex) { + return { + createCover: function (controller, brushOption) { + return createBaseRectCover( + curry( + driftRect, + function (range) { + var rectRange = [range, [0, 100]]; + xyIndex && rectRange.reverse(); + return rectRange; + }, + function (rectRange) { + return rectRange[xyIndex]; + } + ), + controller, + brushOption, + [['w', 'e'], ['n', 's']][xyIndex] + ); + }, + getCreatingRange: function (localTrack) { + var ends = getTrackEnds(localTrack); + var min = mathMin(ends[0][xyIndex], ends[1][xyIndex]); + var max = mathMax(ends[0][xyIndex], ends[1][xyIndex]); - /** - * @payload - * @property {string} parallelAxisId - * @property {Array.>} intervals - */ - var actionInfo = { - type: 'axisAreaSelect', - event: 'axisAreaSelected', - update: 'updateVisual' - }; - echarts.registerAction(actionInfo, function (payload, ecModel) { - ecModel.eachComponent( - {mainType: 'parallelAxis', query: payload}, - function (parallelAxisModel) { - parallelAxisModel.axis.model.setActiveIntervals(payload.intervals); - } - ); - }); + return [min, max]; + }, + updateCoverShape: function (controller, cover, localRange, brushOption) { + var brushWidth = brushOption.brushStyle.width; + var otherExtent; + // If brushWidth not specified, fit the panel. + if (brushWidth == null) { + var panel = getPanelByCover(controller, cover); + var base = 0; + if (panel !== true) { + var rect = panel.getBoundingRect(); + brushWidth = xyIndex ? rect.width : rect.height; + base = xyIndex ? rect.x : rect.y; + } + // FIXME + // do not support global panel yet. + otherExtent = [base, base + (brushWidth || 0)]; + } + else { + otherExtent = [-brushWidth / 2, brushWidth / 2]; + } + var rectRange = [localRange, otherExtent]; + xyIndex && rectRange.reverse(); - /** - * @payload - */ - echarts.registerAction('parallelAxisExpand', function (payload, ecModel) { - ecModel.eachComponent( - {mainType: 'parallel', query: payload}, - function (parallelModel) { - parallelModel.setAxisExpand(payload); - } - ); + updateBaseRect(controller, cover, rectRange, brushOption); + }, + updateCommon: updateCommon, + contain: mainShapeContain + }; + } - }); + module.exports = BrushController; /***/ }, -/* 235 */ +/* 251 */ /***/ function(module, exports, __webpack_require__) { var zrUtil = __webpack_require__(4); - var AxisBuilder = __webpack_require__(133); - var BrushController = __webpack_require__(236); - var graphic = __webpack_require__(43); - - var elementList = ['axisLine', 'axisLabel', 'axisTick', 'axisName']; - - var AxisView = __webpack_require__(1).extendComponentView({ + var modelUtil = __webpack_require__(5); - type: 'parallelAxis', + module.exports = function (option) { + createParallelIfNeeded(option); + mergeAxisOptionFromParallel(option); + }; - /** - * @override - */ - init: function (ecModel, api) { - AxisView.superApply(this, 'init', arguments); + /** + * Create a parallel coordinate if not exists. + * @inner + */ + function createParallelIfNeeded(option) { + if (option.parallel) { + return; + } - /** - * @type {module:echarts/component/helper/BrushController} - */ - (this._brushController = new BrushController(api.getZr())) - .on('brush', zrUtil.bind(this._onBrush, this)); - }, + var hasParallelSeries = false; - /** - * @override - */ - render: function (axisModel, ecModel, api, payload) { - if (fromAxisAreaSelect(axisModel, ecModel, payload)) { - return; + zrUtil.each(option.series, function (seriesOpt) { + if (seriesOpt && seriesOpt.type === 'parallel') { + hasParallelSeries = true; } + }); - this.axisModel = axisModel; - this.api = api; - - this.group.removeAll(); + if (hasParallelSeries) { + option.parallel = [{}]; + } + } - var oldAxisGroup = this._axisGroup; - this._axisGroup = new graphic.Group(); - this.group.add(this._axisGroup); + /** + * Merge aixs definition from parallel option (if exists) to axis option. + * @inner + */ + function mergeAxisOptionFromParallel(option) { + var axes = modelUtil.normalizeToArray(option.parallelAxis); - if (!axisModel.get('show')) { + zrUtil.each(axes, function (axisOption) { + if (!zrUtil.isObject(axisOption)) { return; } - var coordSys = ecModel.getComponent( - 'parallel', axisModel.get('parallelIndex') - ).coordinateSystem; - - var areaSelectStyle = axisModel.getAreaSelectStyle(); - var areaWidth = areaSelectStyle.width; - - var dim = axisModel.axis.dim; - var axisLayout = coordSys.getAxisLayout(dim); - - // Fetch from axisModel by default. - var axisLabelShow; - var axisIndex = zrUtil.indexOf(coordSys.dimensions, dim); - - var axisExpandWindow = axisLayout.axisExpandWindow; - if (axisExpandWindow - && (axisIndex <= axisExpandWindow[0] || axisIndex >= axisExpandWindow[1]) - ) { - axisLabelShow = false; - } - - var builderOpt = zrUtil.extend( - { - axisLabelShow: axisLabelShow, - strokeContainThreshold: areaWidth - }, - axisLayout - ); - - var axisBuilder = new AxisBuilder(axisModel, builderOpt); - - zrUtil.each(elementList, axisBuilder.add, axisBuilder); - - this._axisGroup.add(axisBuilder.getGroup()); - - this._refreshBrushController(builderOpt, areaSelectStyle, axisModel, areaWidth); - - graphic.groupTransition(oldAxisGroup, this._axisGroup, axisModel); - }, - - _refreshBrushController: function (builderOpt, areaSelectStyle, axisModel, areaWidth) { - // After filtering, axis may change, select area needs to be update. - var axis = axisModel.axis; - var coverInfoList = zrUtil.map(axisModel.activeIntervals, function (interval) { - return { - brushType: 'lineX', - panelId: 'pl', - range: [ - axis.dataToCoord(interval[0], true), - axis.dataToCoord(interval[1], true) - ] - }; - }); - - var extent = axis.getExtent(); - var extentLen = extent[1] - extent[0]; - var extra = Math.min(30, Math.abs(extentLen) * 0.1); // Arbitrary value. - - // width/height might be negative, which will be - // normalized in BoundingRect. - var rect = graphic.BoundingRect.create({ - x: extent[0], - y: -areaWidth / 2, - width: extentLen, - height: areaWidth - }); - rect.x -= extra; - rect.width += 2 * extra; - - this._brushController - .mount({ - enableGlobalPan: true, - rotation: builderOpt.rotation, - position: builderOpt.position - }) - .setPanels([{ - panelId: 'pl', - rect: rect - }]) - .enableBrush({ - brushType: 'lineX', - brushStyle: areaSelectStyle, - removeOnClick: true - }) - .updateCovers(coverInfoList); - }, - - _onBrush: function (coverInfoList, opt) { - // Do not cache these object, because the mey be changed. - var axisModel = this.axisModel; - var axis = axisModel.axis; - - var intervals = zrUtil.map(coverInfoList, function (coverInfo) { - return [ - axis.coordToData(coverInfo.range[0], true), - axis.coordToData(coverInfo.range[1], true) - ]; - }); + var parallelIndex = axisOption.parallelIndex || 0; + var parallelOption = modelUtil.normalizeToArray(option.parallel)[parallelIndex]; - // If realtime is true, action is not dispatched on drag end, because - // the drag end emits the same params with the last drag move event, - // and may have some delay when using touch pad. - if (!axisModel.option.realtime === opt.isEnd || opt.removeOnClick) { // jshint ignore:line - this.api.dispatchAction({ - type: 'axisAreaSelect', - parallelAxisId: axisModel.id, - intervals: intervals - }); + if (parallelOption && parallelOption.parallelAxisDefault) { + zrUtil.merge(axisOption, parallelOption.parallelAxisDefault, false); } - }, - - /** - * @override - */ - dispose: function () { - this._brushController.dispose(); - } - }); - - function fromAxisAreaSelect(axisModel, ecModel, payload) { - return payload - && payload.type === 'axisAreaSelect' - && ecModel.findComponents( - {mainType: 'parallelAxis', query: payload} - )[0] === axisModel; + }); } - module.exports = AxisView; /***/ }, -/* 236 */ +/* 252 */ /***/ function(module, exports, __webpack_require__) { - /** - * Box selection tool. - * - * @module echarts/component/helper/BrushController - */ + + var List = __webpack_require__(98); + var zrUtil = __webpack_require__(4); + var SeriesModel = __webpack_require__(28); + var completeDimensions = __webpack_require__(103); + module.exports = SeriesModel.extend({ - var Eventful = __webpack_require__(33); - var zrUtil = __webpack_require__(4); - var BoundingRect = __webpack_require__(9); - var graphic = __webpack_require__(43); - var interactionMutex = __webpack_require__(178); - var DataDiffer = __webpack_require__(99); + type: 'series.parallel', - var curry = zrUtil.curry; - var each = zrUtil.each; - var map = zrUtil.map; - var mathMin = Math.min; - var mathMax = Math.max; - var mathPow = Math.pow; + dependencies: ['parallel'], - var COVER_Z = 10000; - var UNSELECT_THRESHOLD = 6; - var MIN_RESIZE_LINE_WIDTH = 6; - var MUTEX_RESOURCE_KEY = 'globalPan'; + getInitialData: function (option, ecModel) { + var parallelModel = ecModel.getComponent( + 'parallel', this.get('parallelIndex') + ); + var parallelAxisIndices = parallelModel.parallelAxisIndex; - var DIRECTION_MAP = { - w: [0, 0], - e: [0, 1], - n: [1, 0], - s: [1, 1] - }; - var CURSOR_MAP = { - w: 'ew', - e: 'ew', - n: 'ns', - s: 'ns', - ne: 'nesw', - sw: 'nesw', - nw: 'nwse', - se: 'nwse' - }; - var DEFAULT_BRUSH_OPT = { - brushStyle: { - lineWidth: 2, - stroke: 'rgba(0,0,0,0.3)', - fill: 'rgba(0,0,0,0.1)' - }, - transformable: true, - brushMode: 'single', - removeOnClick: false - }; + var rawData = option.data; + var modelDims = parallelModel.dimensions; - var baseUID = 0; + var dataDims = generateDataDims(modelDims, rawData); - /** - * @alias module:echarts/component/helper/BrushController - * @constructor - * @mixin {module:zrender/mixin/Eventful} - * @event module:echarts/component/helper/BrushController#brush - * params: - * areas: Array., coord relates to container group, - * If no container specified, to global. - * opt { - * isEnd: boolean, - * removeOnClick: boolean - * } - * - * @param {module:zrender/zrender~ZRender} zr - */ - function BrushController(zr) { + var dataDimsInfo = zrUtil.map(dataDims, function (dim, dimIndex) { - if (true) { - zrUtil.assert(zr); - } + var modelDimsIndex = zrUtil.indexOf(modelDims, dim); + var axisModel = modelDimsIndex >= 0 && ecModel.getComponent( + 'parallelAxis', parallelAxisIndices[modelDimsIndex] + ); - Eventful.call(this); + if (axisModel && axisModel.get('type') === 'category') { + translateCategoryValue(axisModel, dim, rawData); + return {name: dim, type: 'ordinal'}; + } + else if (modelDimsIndex < 0) { + return completeDimensions.guessOrdinal(rawData, dimIndex) + ? {name: dim, type: 'ordinal'} + : dim; + } + else { + return dim; + } + }); - /** - * @type {module:zrender/zrender~ZRender} - * @private - */ - this._zr = zr; + var list = new List(dataDimsInfo, this); + list.initData(rawData); - /** - * @type {module:zrender/container/Group} - * @readOnly - */ - this.group = new graphic.Group(); + // Anication is forbiden in progressive data mode. + if (this.option.progressive) { + this.option.animation = false; + } - /** - * Only for drawing (after enabledBrush). - * @private - * @type {string} - */ - this._brushType; + return list; + }, /** - * Only for drawing (after enabledBrush). - * @private - * @type {Object} + * User can get data raw indices on 'axisAreaSelected' event received. + * + * @public + * @param {string} activeState 'active' or 'inactive' or 'normal' + * @return {Array.} Raw indices */ - this._brushOption; + getRawIndicesByActiveState: function (activeState) { + var coordSys = this.coordinateSystem; + var data = this.getData(); + var indices = []; - /** - * @private - * @type {Object} - */ - this._panels; + coordSys.eachActiveState(data, function (theActiveState, dataIndex) { + if (activeState === theActiveState) { + indices.push(data.getRawIndex(dataIndex)); + } + }); - /** - * @private - * @type {Array.} - */ - this._track = []; + return indices; + }, - /** - * @private - * @type {boolean} - */ - this._dragging; + defaultOption: { + zlevel: 0, // 一级层叠 + z: 2, // 二级层叠 - /** - * @private - * @type {Array} - */ - this._covers = []; + coordinateSystem: 'parallel', + parallelIndex: 0, - /** - * @private - * @type {moudule:zrender/container/Group} - */ - this._creatingCover; + label: { + normal: { + show: false + }, + emphasis: { + show: false + } + }, - /** - * true means global panel - * @private - * @type {module:zrender/container/Group|boolean} - */ - this._creatingPanel; + inactiveOpacity: 0.05, + activeOpacity: 1, - /** - * @private - * @type {boolean} - */ - this._enableGlobalPan; + lineStyle: { + normal: { + width: 1, + opacity: 0.45, + type: 'solid' + } + }, + progressive: false, // 100 + smooth: false, - /** - * @private - * @type {boolean} - */ - if (true) { - this._mounted; + animationEasing: 'linear' } + }); - /** - * @private - * @type {string} - */ - this._uid = 'brushController_' + baseUID++; + function translateCategoryValue(axisModel, dim, rawData) { + var axisData = axisModel.get('data'); + var numberDim = convertDimNameToNumber(dim); - /** - * @private - * @type {Object} - */ - this._handlers = {}; - each(mouseHandlers, function (handler, eventName) { - this._handlers[eventName] = zrUtil.bind(handler, this); - }, this); + if (axisData && axisData.length) { + zrUtil.each(rawData, function (dataItem) { + if (!dataItem) { + return; + } + // FIXME + // time consuming, should use hash? + var index = zrUtil.indexOf(axisData, dataItem[numberDim]); + dataItem[numberDim] = index >= 0 ? index : NaN; + }); + } + // FIXME + // 如果没有设置axis data, 应自动算出,或者提示。 } - BrushController.prototype = { + function convertDimNameToNumber(dimName) { + return +dimName.replace('dim', ''); + } - constructor: BrushController, + function generateDataDims(modelDims, rawData) { + // parallelModel.dimension should not be regarded as data + // dimensions. Consider dimensions = ['dim4', 'dim2', 'dim6']; - /** - * If set to null/undefined/false, select disabled. - * @param {Object} brushOption - * @param {string|boolean} brushOption.brushType 'line', 'rect', 'polygon' or false - * If pass false/null/undefined, disable brush. - * @param {number} [brushOption.brushMode='single'] 'single' or 'multiple' - * @param {boolean} [brushOption.transformable=true] - * @param {boolean} [brushOption.removeOnClick=false] - * @param {Object} [brushOption.brushStyle] - * @param {number} [brushOption.brushStyle.width] - * @param {number} [brushOption.brushStyle.lineWidth] - * @param {string} [brushOption.brushStyle.stroke] - * @param {string} [brushOption.brushStyle.fill] - */ - enableBrush: function (brushOption) { - if (true) { - zrUtil.assert(this._mounted); - } + // We detect max dim by parallelModel.dimensions and fist + // item in rawData arbitrarily. + var maxDimNum = 0; + zrUtil.each(modelDims, function (dimName) { + var numberDim = convertDimNameToNumber(dimName); + numberDim > maxDimNum && (maxDimNum = numberDim); + }); - this._brushType && doDisableBrush(this); - brushOption.brushType && doEnableBrush(this, brushOption); + var firstItem = rawData[0]; + if (firstItem && firstItem.length - 1 > maxDimNum) { + maxDimNum = firstItem.length - 1; + } - return this; - }, + var dataDims = []; + for (var i = 0; i <= maxDimNum; i++) { + dataDims.push('dim' + i); + } - /** - * @param {Array.} panelOpts If not pass, it is global brush. - * Each items: {panelId, rect} - */ - setPanels: function (panelOpts) { - var oldPanels = this._panels || {}; - var newPanels = this._panels = panelOpts && panelOpts.length && {}; - var thisGroup = this.group; + return dataDims; + } - newPanels && each(panelOpts, function (panelOpt) { - var panelId = panelOpt.panelId; - var panel = oldPanels[panelId]; - if (!panel) { - panel = new graphic.Rect({ - silent: true, - invisible: true - }); - thisGroup.add(panel); - } - var rect = panelOpt.rect; - // Using BoundingRect to normalize negative width/height. - if (!(rect instanceof BoundingRect)) { - rect = BoundingRect.create(rect); - } +/***/ }, +/* 253 */ +/***/ function(module, exports, __webpack_require__) { - panel.attr('shape', rect.plain()); - panel.__brushPanelId = panelId; - newPanels[panelId] = panel; - oldPanels[panelId] = null; - }); + - each(oldPanels, function (panel) { - panel && thisGroup.remove(panel); - }); + var graphic = __webpack_require__(44); + var zrUtil = __webpack_require__(4); - return this; - }, + var SMOOTH = 0.3; - /** - * @param {Object} [opt] - * @return {boolean} [opt.enableGlobalPan=false] - * @return {boolean} [opt.position=[0, 0]] - * @return {boolean} [opt.rotation=0] - * @return {boolean} [opt.scale=[1, 1]] - */ - mount: function (opt) { - opt = opt || {}; + var ParallelView = __webpack_require__(43).extend({ - if (true) { - this._mounted = true; // should be at first. - } + type: 'parallel', - this._enableGlobalPan = opt.enableGlobalPan; + init: function () { - var thisGroup = this.group; - this._zr.add(thisGroup); + /** + * @type {module:zrender/container/Group} + * @private + */ + this._dataGroup = new graphic.Group(); - thisGroup.attr({ - position: opt.position || [0, 0], - rotation: opt.rotation || 0, - scale: opt.scale || [1, 1] - }); + this.group.add(this._dataGroup); - return this; + /** + * @type {module:echarts/data/List} + */ + this._data; }, - eachCover: function (cb, context) { - each(this._covers, cb, context); + /** + * @override + */ + render: function (seriesModel, ecModel, api, payload) { + this._renderForNormal(seriesModel); + // this[ + // seriesModel.option.progressive + // ? '_renderForProgressive' + // : '_renderForNormal' + // ](seriesModel); }, + dispose: function () {}, + /** - * Update covers. - * @param {Array.} brushOptionList Like: - * [ - * {id: 'xx', brushType: 'line', range: [23, 44], brushStyle, transformable}, - * {id: 'yy', brushType: 'rect', range: [[23, 44], [23, 54]]}, - * ... - * ] - * `brushType` is required in each cover info. - * `id` is not mandatory. - * `brushStyle`, `transformable` is not mandatory, use DEFAULT_BRUSH_OPT by default. - * If brushOptionList is null/undefined, all covers removed. + * @private */ - updateCovers: function (brushOptionList) { - if (true) { - zrUtil.assert(this._mounted); - } - - brushOptionList = zrUtil.map(brushOptionList, function (brushOption) { - return zrUtil.merge(zrUtil.clone(DEFAULT_BRUSH_OPT), brushOption, true); - }); + _renderForNormal: function (seriesModel) { + var dataGroup = this._dataGroup; + var data = seriesModel.getData(); + var oldData = this._data; + var coordSys = seriesModel.coordinateSystem; + var dimensions = coordSys.dimensions; + var option = seriesModel.option; + var smooth = option.smooth ? SMOOTH : null; - var tmpIdPrefix = '\0-brush-index-'; - var oldCovers = this._covers; - var newCovers = this._covers = []; - var controller = this; - var creatingCover = this._creatingCover; + // Consider switch between progressive and not. + // oldData && oldData.__plProgressive && dataGroup.removeAll(); - (new DataDiffer(oldCovers, brushOptionList, oldGetKey, getKey)) - .add(addOrUpdate) - .update(addOrUpdate) + data.diff(oldData) + .add(add) + .update(update) .remove(remove) .execute(); - return this; + // Update style + updateElCommon(data, smooth); - function getKey(brushOption, index) { - return (brushOption.id != null ? brushOption.id : tmpIdPrefix + index) - + '-' + brushOption.brushType; + // First create + if (!this._data) { + var clipPath = createGridClipShape( + coordSys, seriesModel, function () { + // Callback will be invoked immediately if there is no animation + setTimeout(function () { + dataGroup.removeClipPath(); + }); + } + ); + dataGroup.setClipPath(clipPath); } - function oldGetKey(cover, index) { - return getKey(cover.__brushOption, index); - } + this._data = data; - function addOrUpdate(newIndex, oldIndex) { - var newBrushOption = brushOptionList[newIndex]; - // Consider setOption in event listener of brushSelect, - // where updating cover when creating should be forbiden. - if (oldIndex != null && oldCovers[oldIndex] === creatingCover) { - newCovers[newIndex] = oldCovers[oldIndex]; - } - else { - var cover = newCovers[newIndex] = oldIndex != null - ? ( - oldCovers[oldIndex].__brushOption = newBrushOption, - oldCovers[oldIndex] - ) - : endCreating(controller, createCover(controller, newBrushOption)); - updateCoverAfterCreation(controller, cover); - } + function add(newDataIndex) { + addEl(data, dataGroup, newDataIndex, dimensions, coordSys, null, smooth); } - function remove(oldIndex) { - if (oldCovers[oldIndex] !== creatingCover) { - controller.group.remove(oldCovers[oldIndex]); - } + function update(newDataIndex, oldDataIndex) { + var line = oldData.getItemGraphicEl(oldDataIndex); + var points = createLinePoints(data, newDataIndex, dimensions, coordSys); + data.setItemGraphicEl(newDataIndex, line); + graphic.updateProps(line, {shape: {points: points}}, seriesModel, newDataIndex); } - }, - - unmount: function () { - this.enableBrush(false); - - // container may 'removeAll' outside. - clearCovers(this); - this._zr.remove(this.group); - if (true) { - this._mounted = false; // should be at last. + function remove(oldDataIndex) { + var line = oldData.getItemGraphicEl(oldDataIndex); + dataGroup.remove(line); } - return this; }, - dispose: function () { - this.unmount(); - this.off(); - } - }; - - zrUtil.mixin(BrushController, Eventful); - - - function doEnableBrush(controller, brushOption) { - var zr = controller._zr; - - // Consider roam, which takes globalPan too. - if (!controller._enableGlobalPan) { - interactionMutex.take(zr, MUTEX_RESOURCE_KEY, controller._uid); - } - - each(controller._handlers, function (handler, eventName) { - zr.on(eventName, handler); - }); - - controller._brushType = brushOption.brushType; - controller._brushOption = zrUtil.merge(zrUtil.clone(DEFAULT_BRUSH_OPT), brushOption, true); - } - - function doDisableBrush(controller) { - var zr = controller._zr; - - interactionMutex.release(zr, MUTEX_RESOURCE_KEY, controller._uid); + /** + * @private + */ + // _renderForProgressive: function (seriesModel) { + // var dataGroup = this._dataGroup; + // var data = seriesModel.getData(); + // var oldData = this._data; + // var coordSys = seriesModel.coordinateSystem; + // var dimensions = coordSys.dimensions; + // var option = seriesModel.option; + // var progressive = option.progressive; + // var smooth = option.smooth ? SMOOTH : null; - each(controller._handlers, function (handler, eventName) { - zr.off(eventName, handler); - }); + // // In progressive animation is disabled, so use simple data diff, + // // which effects performance less. + // // (Typically performance for data with length 7000+ like: + // // simpleDiff: 60ms, addEl: 184ms, + // // in RMBP 2.4GHz intel i7, OSX 10.9 chrome 50.0.2661.102 (64-bit)) + // if (simpleDiff(oldData, data, dimensions)) { + // dataGroup.removeAll(); + // data.each(function (dataIndex) { + // addEl(data, dataGroup, dataIndex, dimensions, coordSys); + // }); + // } - controller._brushType = controller._brushOption = null; - } + // updateElCommon(data, progressive, smooth); - function createCover(controller, brushOption) { - var cover = coverRenderers[brushOption.brushType].createCover(controller, brushOption); - updateZ(cover); - cover.__brushOption = brushOption; - controller.group.add(cover); - return cover; - } + // // Consider switch between progressive and not. + // data.__plProgressive = true; + // this._data = data; + // }, - function endCreating(controller, creatingCover) { - var coverRenderer = getCoverRenderer(creatingCover); - if (coverRenderer.endCreating) { - coverRenderer.endCreating(controller, creatingCover); - updateZ(creatingCover); + /** + * @override + */ + remove: function () { + this._dataGroup && this._dataGroup.removeAll(); + this._data = null; } - return creatingCover; - } - - function updateCoverShape(controller, cover) { - var brushOption = cover.__brushOption; - getCoverRenderer(cover).updateCoverShape( - controller, cover, brushOption.range, brushOption - ); - } + }); - function updateZ(group) { - group.traverse(function (el) { - el.z = COVER_Z; - el.z2 = COVER_Z; // Consider in given container. + function createGridClipShape(coordSys, seriesModel, cb) { + var parallelModel = coordSys.model; + var rect = coordSys.getRect(); + var rectEl = new graphic.Rect({ + shape: { + x: rect.x, + y: rect.y, + width: rect.width, + height: rect.height + } }); - } - - function updateCoverAfterCreation(controller, cover) { - getCoverRenderer(cover).updateCommon(controller, cover); - updateCoverShape(controller, cover); - } - - function getCoverRenderer(cover) { - return coverRenderers[cover.__brushOption.brushType]; - } - function getPanelByPoint(controller, x, y) { - var panels = controller._panels; - if (!panels) { - return true; // Global panel - } - var panel; - each(panels, function (pn) { - pn.contain(x, y) && (panel = pn); - }); - return panel; + var dim = parallelModel.get('layout') === 'horizontal' ? 'width' : 'height'; + rectEl.setShape(dim, 0); + graphic.initProps(rectEl, { + shape: { + width: rect.width, + height: rect.height + } + }, seriesModel, cb); + return rectEl; } - function getPanelByCover(controller, cover) { - var panels = controller._panels; - if (!panels) { - return true; // Global panel + function createLinePoints(data, dataIndex, dimensions, coordSys) { + var points = []; + for (var i = 0; i < dimensions.length; i++) { + var dimName = dimensions[i]; + var value = data.get(dimName, dataIndex); + if (!isEmptyValue(value, coordSys.getAxis(dimName).type)) { + points.push(coordSys.dataToPoint(value, dimName)); + } } - var panelId = cover.__brushOption.panelId; - // User may give cover without coord sys info, - // which is then treated as global panel. - return panelId != null ? panels[panelId] : true; + return points; } - function clearCovers(controller) { - var covers = controller._covers; - var originalLength = covers.length; - each(covers, function (cover) { - controller.group.remove(cover); - }, controller); - covers.length = 0; - - return !!originalLength; + function addEl(data, dataGroup, dataIndex, dimensions, coordSys) { + var points = createLinePoints(data, dataIndex, dimensions, coordSys); + var line = new graphic.Polyline({ + shape: {points: points}, + silent: true, + z2: 10 + }); + dataGroup.add(line); + data.setItemGraphicEl(dataIndex, line); } - function trigger(controller, opt) { - var areas = map(controller._covers, function (cover) { - var brushOption = cover.__brushOption; - var range = zrUtil.clone(brushOption.range); - - return { - brushType: brushOption.brushType, - panelId: brushOption.panelId, - range: range - }; - }); + function updateElCommon(data, smooth) { + var seriesStyleModel = data.hostModel.getModel('lineStyle.normal'); + var lineStyle = seriesStyleModel.getLineStyle(); + data.eachItemGraphicEl(function (line, dataIndex) { + if (data.hasItemOption) { + var itemModel = data.getItemModel(dataIndex); + var lineStyleModel = itemModel.getModel('lineStyle.normal', seriesStyleModel); + lineStyle = lineStyleModel.getLineStyle(); + } - controller.trigger('brush', areas, { - isEnd: !!opt.isEnd, - removeOnClick: !!opt.removeOnClick + line.useStyle(zrUtil.extend( + lineStyle, + { + fill: null, + stroke: data.getItemVisual(dataIndex, 'color'), + opacity: data.getItemVisual(dataIndex, 'opacity') + } + )); + line.shape.smooth = smooth; }); } - function shouldShowCover(controller) { - var track = controller._track; + // function simpleDiff(oldData, newData, dimensions) { + // var oldLen; + // if (!oldData + // || !oldData.__plProgressive + // || (oldLen = oldData.count()) !== newData.count() + // ) { + // return true; + // } - if (!track.length) { - return false; - } + // var dimLen = dimensions.length; + // for (var i = 0; i < oldLen; i++) { + // for (var j = 0; j < dimLen; j++) { + // if (oldData.get(dimensions[j], i) !== newData.get(dimensions[j], i)) { + // return true; + // } + // } + // } - var p2 = track[track.length - 1]; - var p1 = track[0]; - var dx = p2[0] - p1[0]; - var dy = p2[1] - p1[1]; - var dist = mathPow(dx * dx + dy * dy, 0.5); + // return false; + // } - return dist > UNSELECT_THRESHOLD; + // FIXME + // 公用方法? + function isEmptyValue(val, axisType) { + return axisType === 'category' + ? val == null + : (val == null || isNaN(val)); // axisType === 'value' } - function getTrackEnds(track) { - var tail = track.length - 1; - tail < 0 && (tail = 0); - return [track[0], track[tail]]; - } + module.exports = ParallelView; - function createBaseRectCover(doDrift, controller, brushOption, edgeNames) { - var cover = new graphic.Group(); - cover.add(new graphic.Rect({ - name: 'main', - style: makeStyle(brushOption), - silent: true, - draggable: true, - cursor: 'move', - drift: curry(doDrift, controller, cover, 'nswe'), - ondragend: curry(trigger, controller, {isEnd: true}) - })); +/***/ }, +/* 254 */ +/***/ function(module, exports) { - each( - edgeNames, - function (name) { - cover.add(new graphic.Rect({ - name: name, - style: {opacity: 0}, - draggable: true, - silent: true, - invisible: true, - drift: curry(doDrift, controller, cover, name), - ondragend: curry(trigger, controller, {isEnd: true}) - })); - } - ); + - return cover; - } + module.exports = function (ecModel) { - function updateBaseRect(controller, cover, localRange, brushOption) { - var lineWidth = brushOption.brushStyle.lineWidth || 0; - var handleSize = mathMax(lineWidth, MIN_RESIZE_LINE_WIDTH); - var x = localRange[0][0]; - var y = localRange[1][0]; - var xa = x - lineWidth / 2; - var ya = y - lineWidth / 2; - var x2 = localRange[0][1]; - var y2 = localRange[1][1]; - var x2a = x2 - handleSize + lineWidth / 2; - var y2a = y2 - handleSize + lineWidth / 2; - var width = x2 - x; - var height = y2 - y; - var widtha = width + lineWidth; - var heighta = height + lineWidth; + ecModel.eachSeriesByType('parallel', function (seriesModel) { - updateRectShape(controller, cover, 'main', x, y, width, height); + var itemStyleModel = seriesModel.getModel('itemStyle.normal'); + var lineStyleModel = seriesModel.getModel('lineStyle.normal'); + var globalColors = ecModel.get('color'); - if (brushOption.transformable) { - updateRectShape(controller, cover, 'w', xa, ya, handleSize, heighta); - updateRectShape(controller, cover, 'e', x2a, ya, handleSize, heighta); - updateRectShape(controller, cover, 'n', xa, ya, widtha, handleSize); - updateRectShape(controller, cover, 's', xa, y2a, widtha, handleSize); + var color = lineStyleModel.get('color') + || itemStyleModel.get('color') + || globalColors[seriesModel.seriesIndex % globalColors.length]; + var inactiveOpacity = seriesModel.get('inactiveOpacity'); + var activeOpacity = seriesModel.get('activeOpacity'); + var lineStyle = seriesModel.getModel('lineStyle.normal').getLineStyle(); - updateRectShape(controller, cover, 'nw', xa, ya, handleSize, handleSize); - updateRectShape(controller, cover, 'ne', x2a, ya, handleSize, handleSize); - updateRectShape(controller, cover, 'sw', xa, y2a, handleSize, handleSize); - updateRectShape(controller, cover, 'se', x2a, y2a, handleSize, handleSize); - } - } + var coordSys = seriesModel.coordinateSystem; + var data = seriesModel.getData(); - function updateCommon(controller, cover) { - var brushOption = cover.__brushOption; - var transformable = brushOption.transformable; + var opacityMap = { + normal: lineStyle.opacity, + active: activeOpacity, + inactive: inactiveOpacity + }; - var mainEl = cover.childAt(0); - mainEl.useStyle(makeStyle(brushOption)); - mainEl.attr({ - silent: !transformable, - cursor: transformable ? 'move' : 'default' + coordSys.eachActiveState(data, function (activeState, dataIndex) { + data.setItemVisual(dataIndex, 'opacity', opacityMap[activeState]); + }); + + data.setVisual('color', color); }); + }; - each( - ['w', 'e', 'n', 's', 'se', 'sw', 'ne', 'nw'], - function (name) { - var el = cover.childOfName(name); - var globalDir = getGlobalDirection(controller, name); - el && el.attr({ - silent: !transformable, - invisible: !transformable, - cursor: transformable ? CURSOR_MAP[globalDir] + '-resize' : null - }); - } - ); - } +/***/ }, +/* 255 */ +/***/ function(module, exports, __webpack_require__) { - function updateRectShape(controller, cover, name, x, y, w, h) { - var el = cover.childOfName(name); - el && el.setShape(pointsToRect( - clipByPanel(controller, cover, [[x, y], [x + w, y + h]]) - )); - } + - function makeStyle(brushOption) { - return zrUtil.defaults({strokeNoScale: true}, brushOption.brushStyle); - } + var echarts = __webpack_require__(1); - function formatRectRange(x, y, x2, y2) { - var min = [mathMin(x, x2), mathMin(y, y2)]; - var max = [mathMax(x, x2), mathMax(y, y2)]; + __webpack_require__(256); + __webpack_require__(257); + echarts.registerLayout(__webpack_require__(258)); + echarts.registerVisual(__webpack_require__(260)); - return [ - [min[0], max[0]], // x range - [min[1], max[1]] // y range - ]; - } - function getTransform(controller) { - return graphic.getTransform(controller.group); - } +/***/ }, +/* 256 */ +/***/ function(module, exports, __webpack_require__) { - function getGlobalDirection(controller, localDirection) { - if (localDirection.length > 1) { - localDirection = localDirection.split(''); - var globalDir = [ - getGlobalDirection(controller, localDirection[0]), - getGlobalDirection(controller, localDirection[1]) - ]; - (globalDir[0] === 'e' || globalDir[0] === 'w') && globalDir.reverse(); - return globalDir.join(''); - } - else { - var map = {w: 'left', e: 'right', n: 'top', s: 'bottom'}; - var inverseMap = {left: 'w', right: 'e', top: 'n', bottom: 's'}; - var globalDir = graphic.transformDirection( - map[localDirection], getTransform(controller) - ); - return inverseMap[globalDir]; - } - } + /** + * @file Get initial data and define sankey view's series model + * @author Deqing Li(annong035@gmail.com) + */ - function driftRect(toRectRange, fromRectRange, controller, cover, name, dx, dy, e) { - var brushOption = cover.__brushOption; - var rectRange = toRectRange(brushOption.range); - var localDelta = toLocalDelta(controller, dx, dy); - each(name.split(''), function (namePart) { - var ind = DIRECTION_MAP[namePart]; - rectRange[ind[0]][ind[1]] += localDelta[ind[0]]; - }); + var SeriesModel = __webpack_require__(28); + var createGraphFromNodeEdge = __webpack_require__(213); + var encodeHTML = __webpack_require__(6).encodeHTML; - brushOption.range = fromRectRange(formatRectRange( - rectRange[0][0], rectRange[1][0], rectRange[0][1], rectRange[1][1] - )); + var SankeySeries = SeriesModel.extend({ - updateCoverAfterCreation(controller, cover); - trigger(controller, {isEnd: false}); - } + type: 'series.sankey', - function driftPolygon(controller, cover, dx, dy, e) { - var range = cover.__brushOption.range; - var localDelta = toLocalDelta(controller, dx, dy); + layoutInfo: null, - each(range, function (point) { - point[0] += localDelta[0]; - point[1] += localDelta[1]; - }); + /** + * Init a graph data structure from data in option series + * + * @param {Object} option the object used to config echarts view + * @return {module:echarts/data/List} storage initial data + */ + getInitialData: function (option) { + var links = option.edges || option.links; + var nodes = option.data || option.nodes; + if (nodes && links) { + var graph = createGraphFromNodeEdge(nodes, links, this, true); + return graph.data; + } + }, - updateCoverAfterCreation(controller, cover); - trigger(controller, {isEnd: false}); - } + /** + * Return the graphic data structure + * + * @return {module:echarts/data/Graph} graphic data structure + */ + getGraph: function () { + return this.getData().graph; + }, - function toLocalDelta(controller, dx, dy) { - var thisGroup = controller.group; - var localD = thisGroup.transformCoordToLocal(dx, dy); - var localZero = thisGroup.transformCoordToLocal(0, 0); + /** + * Get edge data of graphic data structure + * + * @return {module:echarts/data/List} data structure of list + */ + getEdgeData: function () { + return this.getGraph().edgeData; + }, - return [localD[0] - localZero[0], localD[1] - localZero[1]]; - } + /** + * @override + */ + formatTooltip: function (dataIndex, multipleSeries, dataType) { + // dataType === 'node' or empty do not show tooltip by default + if (dataType === 'edge') { + var params = this.getDataParams(dataIndex, dataType); + var rawDataOpt = params.data; + var html = rawDataOpt.source + ' -- ' + rawDataOpt.target; + if (params.value) { + html += ' : ' + params.value; + } + return encodeHTML(html); + } - function clipByPanel(controller, cover, data) { - var panel = getPanelByCover(controller, cover); - if (panel === true) { // Global panel - return zrUtil.clone(data); - } + return SankeySeries.superCall(this, 'formatTooltip', dataIndex, multipleSeries); + }, - var panelRect = panel.getBoundingRect(); + defaultOption: { + zlevel: 0, + z: 2, - return zrUtil.map(data, function (point) { - var x = point[0]; - x = mathMax(x, panelRect.x); - x = mathMin(x, panelRect.x + panelRect.width); - var y = point[1]; - y = mathMax(y, panelRect.y); - y = mathMin(y, panelRect.y + panelRect.height); - return [x, y]; - }); - } + coordinateSystem: 'view', - function pointsToRect(points) { - var xmin = mathMin(points[0][0], points[1][0]); - var ymin = mathMin(points[0][1], points[1][1]); - var xmax = mathMax(points[0][0], points[1][0]); - var ymax = mathMax(points[0][1], points[1][1]); + layout: null, - return { - x: xmin, - y: ymin, - width: xmax - xmin, - height: ymax - ymin - }; - } + // the position of the whole view + left: '5%', + top: '5%', + right: '20%', + bottom: '5%', - function resetCursor(controller, e) { - var x = e.offsetX; - var y = e.offsetY; - var zr = controller._zr; + // the dx of the node + nodeWidth: 20, - if (controller._brushType) { // If active - var panels = controller._panels; - var covers = controller._covers; - var inCover; + // the vertical distance between two nodes + nodeGap: 8, - for (var i = 0; i < covers.length; i++) { - if (coverRenderers[covers[i].__brushOption.brushType].contain(covers[i], x, y)) { - inCover = true; - break; + // the number of iterations to change the position of the node + layoutIterations: 32, + + label: { + normal: { + show: true, + position: 'right', + textStyle: { + color: '#000', + fontSize: 12 + } + }, + emphasis: { + show: true } - } + }, - if (!inCover) { - if (panels) { // Brush on panels - each(panels, function (panel) { - panel.contain(x, y) && zr.setCursorStyle('crosshair'); - }); + itemStyle: { + normal: { + borderWidth: 1, + borderColor: '#333' } - else { // Global brush - zr.setCursorStyle('crosshair'); + }, + + lineStyle: { + normal: { + color: '#314656', + opacity: 0.2, + curveness: 0.5 + }, + emphasis: { + opacity: 0.6 } - } + }, + + animationEasing: 'linear', + + animationDuration: 1000 } - } - function preventDefault(e) { - var rawE = e.event; - rawE.preventDefault && rawE.preventDefault(); - } + }); - function mainShapeContain(cover, x, y) { - return cover.childOfName('main').contain(x, y); - } + module.exports = SankeySeries; - function updateCoverByMouse(controller, e, isEnd) { - var x = e.offsetX; - var y = e.offsetY; - var creatingCover = controller._creatingCover; - var panel = controller._creatingPanel; - var thisBrushOption = controller._brushOption; - var eventParams; - controller._track.push(controller.group.transformCoordToLocal(x, y)); - if (shouldShowCover(controller) || creatingCover) { +/***/ }, +/* 257 */ +/***/ function(module, exports, __webpack_require__) { - if (panel && !creatingCover) { - thisBrushOption.brushMode === 'single' && clearCovers(controller); - var brushOption = zrUtil.clone(thisBrushOption); - brushOption.panelId = panel === true ? null : panel.__brushPanelId; - creatingCover = controller._creatingCover = createCover(controller, brushOption); - controller._covers.push(creatingCover); - } + /** + * @file The file used to draw sankey view + * @author Deqing Li(annong035@gmail.com) + */ - if (creatingCover) { - var coverRenderer = coverRenderers[controller._brushType]; - var coverBrushOption = creatingCover.__brushOption; - coverBrushOption.range = coverRenderer.getCreatingRange( - clipByPanel(controller, creatingCover, controller._track) - ); + var graphic = __webpack_require__(44); + var zrUtil = __webpack_require__(4); - if (isEnd) { - endCreating(controller, creatingCover); - coverRenderer.updateCommon(controller, creatingCover); - } + var SankeyShape = graphic.extendShape({ + shape: { + x1: 0, y1: 0, + x2: 0, y2: 0, + cpx1: 0, cpy1: 0, + cpx2: 0, cpy2: 0, - updateCoverShape(controller, creatingCover); + extent: 0 + }, - eventParams = {isEnd: isEnd}; - } - } - else if ( - isEnd - && thisBrushOption.brushMode === 'single' - && thisBrushOption.removeOnClick - ) { - // Help user to remove covers easily, only by a tiny drag, in 'single' mode. - // But a single click do not clear covers, because user may have casual - // clicks (for example, click on other component and do not expect covers - // disappear). - // Only some cover removed, trigger action, but not every click trigger action. - if (getPanelByPoint(controller, x, y) && clearCovers(controller)) { - eventParams = {isEnd: isEnd, removeOnClick: true}; - } + buildPath: function (ctx, shape) { + var halfExtent = shape.extent / 2; + ctx.moveTo(shape.x1, shape.y1 - halfExtent); + ctx.bezierCurveTo( + shape.cpx1, shape.cpy1 - halfExtent, + shape.cpx2, shape.cpy2 - halfExtent, + shape.x2, shape.y2 - halfExtent + ); + ctx.lineTo(shape.x2, shape.y2 + halfExtent); + ctx.bezierCurveTo( + shape.cpx2, shape.cpy2 + halfExtent, + shape.cpx1, shape.cpy1 + halfExtent, + shape.x1, shape.y1 + halfExtent + ); + ctx.closePath(); } + }); - return eventParams; - } + module.exports = __webpack_require__(1).extendChartView({ - var mouseHandlers = { + type: 'sankey', - mousedown: function (e) { - if (this._dragging) { - // In case some browser do not support globalOut, - // and release mose out side the browser. - handleDragEnd.call(this, e); - } - else if (!e.target || !e.target.draggable) { + /** + * @private + * @type {module:echarts/chart/sankey/SankeySeries} + */ + _model: null, - preventDefault(e); + render: function (seriesModel, ecModel, api) { + var graph = seriesModel.getGraph(); + var group = this.group; + var layoutInfo = seriesModel.layoutInfo; + var nodeData = seriesModel.getData(); + var edgeData = seriesModel.getData('edge'); - var x = e.offsetX; - var y = e.offsetY; + this._model = seriesModel; - this._creatingCover = null; - var panel = this._creatingPanel = getPanelByPoint(this, x, y); + group.removeAll(); - if (panel) { - this._dragging = true; - this._track = [this.group.transformCoordToLocal(x, y)]; - } - } - }, + group.position = [layoutInfo.x, layoutInfo.y]; - mousemove: function (e) { - // set Cursor - resetCursor(this, e); + // generate a bezire Curve for each edge + graph.eachEdge(function (edge) { + var curve = new SankeyShape(); - if (this._dragging) { + curve.dataIndex = edge.dataIndex; + curve.seriesIndex = seriesModel.seriesIndex; + curve.dataType = 'edge'; - preventDefault(e); + var lineStyleModel = edge.getModel('lineStyle.normal'); + var curvature = lineStyleModel.get('curveness'); + var n1Layout = edge.node1.getLayout(); + var n2Layout = edge.node2.getLayout(); + var edgeLayout = edge.getLayout(); - var eventParams = updateCoverByMouse(this, e, false); + curve.shape.extent = Math.max(1, edgeLayout.dy); - eventParams && trigger(this, eventParams); - } - }, + var x1 = n1Layout.x + n1Layout.dx; + var y1 = n1Layout.y + edgeLayout.sy + edgeLayout.dy / 2; + var x2 = n2Layout.x; + var y2 = n2Layout.y + edgeLayout.ty + edgeLayout.dy / 2; + var cpx1 = x1 * (1 - curvature) + x2 * curvature; + var cpy1 = y1; + var cpx2 = x1 * curvature + x2 * (1 - curvature); + var cpy2 = y2; - mouseup: handleDragEnd //, + curve.setShape({ + x1: x1, + y1: y1, + x2: x2, + y2: y2, + cpx1: cpx1, + cpy1: cpy1, + cpx2: cpx2, + cpy2: cpy2 + }); - // FIXME - // in tooltip, globalout should not be triggered. - // globalout: handleDragEnd - }; + curve.setStyle(lineStyleModel.getItemStyle()); + // Special color, use source node color or target node color + switch (curve.style.fill) { + case 'source': + curve.style.fill = edge.node1.getVisual('color'); + break; + case 'target': + curve.style.fill = edge.node2.getVisual('color'); + break; + } - function handleDragEnd(e) { - if (this._dragging) { + graphic.setHoverStyle(curve, edge.getModel('lineStyle.emphasis').getItemStyle()); - preventDefault(e); + group.add(curve); - var eventParams = updateCoverByMouse(this, e, true); + edgeData.setItemGraphicEl(edge.dataIndex, curve); + }); - this._dragging = false; - this._track = []; - this._creatingCover = null; + // generate a rect for each node + graph.eachNode(function (node) { + var layout = node.getLayout(); + var itemModel = node.getModel(); + var labelModel = itemModel.getModel('label.normal'); + var textStyleModel = labelModel.getModel('textStyle'); + var labelHoverModel = itemModel.getModel('label.emphasis'); + var textStyleHoverModel = labelHoverModel.getModel('textStyle'); - // trigger event shoule be at final, after procedure will be nested. - eventParams && trigger(this, eventParams); - } - } + var rect = new graphic.Rect({ + shape: { + x: layout.x, + y: layout.y, + width: node.getLayout().dx, + height: node.getLayout().dy + }, + style: { + // Get formatted label in label.normal option + // Use node id if it is not specified + text: labelModel.get('show') + ? seriesModel.getFormattedLabel(node.dataIndex, 'normal') || node.id + // Use empty string to hide the label + : '', + textFont: textStyleModel.getFont(), + textFill: textStyleModel.getTextColor(), + textPosition: labelModel.get('position') + } + }); - /** - * key: brushType - * @type {Object} - */ - var coverRenderers = { + rect.setStyle(zrUtil.defaults( + { + fill: node.getVisual('color') + }, + itemModel.getModel('itemStyle.normal').getItemStyle() + )); - lineX: getLineRenderer(0), + graphic.setHoverStyle(rect, zrUtil.extend( + node.getModel('itemStyle.emphasis'), + { + text: labelHoverModel.get('show') + ? seriesModel.getFormattedLabel(node.dataIndex, 'emphasis') || node.id + : '', + textFont: textStyleHoverModel.getFont(), + textFill: textStyleHoverModel.getTextColor(), + textPosition: labelHoverModel.get('position') + } + )); - lineY: getLineRenderer(1), + group.add(rect); - rect: { - createCover: function (controller, brushOption) { - return createBaseRectCover( - curry( - driftRect, - function (range) { - return range; - }, - function (range) { - return range; - } - ), - controller, - brushOption, - ['w', 'e', 'n', 's', 'se', 'sw', 'ne', 'nw'] - ); - }, - getCreatingRange: function (localTrack) { - var ends = getTrackEnds(localTrack); - return formatRectRange(ends[1][0], ends[1][1], ends[0][0], ends[0][1]); - }, - updateCoverShape: function (controller, cover, localRange, brushOption) { - updateBaseRect(controller, cover, localRange, brushOption); - }, - updateCommon: updateCommon, - contain: mainShapeContain - }, + nodeData.setItemGraphicEl(node.dataIndex, rect); - polygon: { - createCover: function (controller, brushOption) { - var cover = new graphic.Group(); + rect.dataType = 'node'; + }); - // Do not use graphic.Polygon because graphic.Polyline do not close the - // border of the shape when drawing, which is a better experience for user. - cover.add(new graphic.Polyline({ - name: 'main', - style: makeStyle(brushOption), - silent: true + if (!this._data && seriesModel.get('animation')) { + group.setClipPath(createGridClipShape(group.getBoundingRect(), seriesModel, function () { + group.removeClipPath(); })); + } - return cover; - }, - getCreatingRange: function (localTrack) { - return localTrack; - }, - endCreating: function (controller, cover) { - cover.remove(cover.childAt(0)); - // Use graphic.Polygon close the shape. - cover.add(new graphic.Polygon({ - name: 'main', - draggable: true, - drift: curry(driftPolygon, controller, cover), - ondragend: curry(trigger, controller, {isEnd: true}) - })); - }, - updateCoverShape: function (controller, cover, localRange, brushOption) { - cover.childAt(0).setShape({ - points: clipByPanel(controller, cover, localRange) - }); - }, - updateCommon: updateCommon, - contain: mainShapeContain - } - }; + this._data = seriesModel.getData(); + }, - function getLineRenderer(xyIndex) { - return { - createCover: function (controller, brushOption) { - return createBaseRectCover( - curry( - driftRect, - function (range) { - var rectRange = [range, [0, 100]]; - xyIndex && rectRange.reverse(); - return rectRange; - }, - function (rectRange) { - return rectRange[xyIndex]; - } - ), - controller, - brushOption, - [['w', 'e'], ['n', 's']][xyIndex] - ); - }, - getCreatingRange: function (localTrack) { - var ends = getTrackEnds(localTrack); - var min = mathMin(ends[0][xyIndex], ends[1][xyIndex]); - var max = mathMax(ends[0][xyIndex], ends[1][xyIndex]); + dispose: function () {} + }); - return [min, max]; - }, - updateCoverShape: function (controller, cover, localRange, brushOption) { - var brushWidth = brushOption.brushStyle.width; - var otherExtent; - // If brushWidth not specified, fit the panel. - if (brushWidth == null) { - var panel = getPanelByCover(controller, cover); - var base = 0; - if (panel !== true) { - var rect = panel.getBoundingRect(); - brushWidth = xyIndex ? rect.width : rect.height; - base = xyIndex ? rect.x : rect.y; - } - // FIXME - // do not support global panel yet. - otherExtent = [base, base + (brushWidth || 0)]; - } - else { - otherExtent = [-brushWidth / 2, brushWidth / 2]; - } - var rectRange = [localRange, otherExtent]; - xyIndex && rectRange.reverse(); + // add animation to the view + function createGridClipShape(rect, seriesModel, cb) { + var rectEl = new graphic.Rect({ + shape: { + x: rect.x - 10, + y: rect.y - 10, + width: 0, + height: rect.height + 20 + } + }); + graphic.initProps(rectEl, { + shape: { + width: rect.width + 20, + height: rect.height + 20 + } + }, seriesModel, cb); - updateBaseRect(controller, cover, rectRange, brushOption); - }, - updateCommon: updateCommon, - contain: mainShapeContain - }; + return rectEl; } - module.exports = BrushController; /***/ }, -/* 237 */ +/* 258 */ /***/ function(module, exports, __webpack_require__) { - + /** + * @file The layout algorithm of sankey view + * @author Deqing Li(annong035@gmail.com) + */ - var zrUtil = __webpack_require__(4); - var modelUtil = __webpack_require__(5); - module.exports = function (option) { - createParallelIfNeeded(option); - mergeAxisOptionFromParallel(option); - }; + var layout = __webpack_require__(21); + var nest = __webpack_require__(259); + var zrUtil = __webpack_require__(4); - /** - * Create a parallel coordinate if not exists. - * @inner - */ - function createParallelIfNeeded(option) { - if (option.parallel) { - return; - } + module.exports = function (ecModel, api, payload) { - var hasParallelSeries = false; + ecModel.eachSeriesByType('sankey', function (seriesModel) { - zrUtil.each(option.series, function (seriesOpt) { - if (seriesOpt && seriesOpt.type === 'parallel') { - hasParallelSeries = true; - } - }); + var nodeWidth = seriesModel.get('nodeWidth'); + var nodeGap = seriesModel.get('nodeGap'); - if (hasParallelSeries) { - option.parallel = [{}]; - } - } + var layoutInfo = getViewRect(seriesModel, api); - /** - * Merge aixs definition from parallel option (if exists) to axis option. - * @inner - */ - function mergeAxisOptionFromParallel(option) { - var axes = modelUtil.normalizeToArray(option.parallelAxis); + seriesModel.layoutInfo = layoutInfo; - zrUtil.each(axes, function (axisOption) { - if (!zrUtil.isObject(axisOption)) { - return; - } + var width = layoutInfo.width; + var height = layoutInfo.height; - var parallelIndex = axisOption.parallelIndex || 0; - var parallelOption = modelUtil.normalizeToArray(option.parallel)[parallelIndex]; + var graph = seriesModel.getGraph(); - if (parallelOption && parallelOption.parallelAxisDefault) { - zrUtil.merge(axisOption, parallelOption.parallelAxisDefault, false); - } - }); - } + var nodes = graph.nodes; + var edges = graph.edges; + computeNodeValues(nodes); + var filteredNodes = nodes.filter(function (node) { + return node.getLayout().value === 0; + }); -/***/ }, -/* 238 */ -/***/ function(module, exports, __webpack_require__) { + var iterations = filteredNodes.length !== 0 + ? 0 : seriesModel.get('layoutIterations'); - + layoutSankey(nodes, edges, nodeWidth, nodeGap, width, height, iterations); + }); + }; - var List = __webpack_require__(98); - var zrUtil = __webpack_require__(4); - var SeriesModel = __webpack_require__(28); - var completeDimensions = __webpack_require__(103); + /** + * Get the layout position of the whole view + * + * @param {module:echarts/model/Series} seriesModel the model object of sankey series + * @param {module:echarts/ExtensionAPI} api provide the API list that the developer can call + * @return {module:zrender/core/BoundingRect} size of rect to draw the sankey view + */ + function getViewRect(seriesModel, api) { + return layout.getLayoutRect( + seriesModel.getBoxLayoutParams(), { + width: api.getWidth(), + height: api.getHeight() + } + ); + } - module.exports = SeriesModel.extend({ + function layoutSankey(nodes, edges, nodeWidth, nodeGap, width, height, iterations) { + computeNodeBreadths(nodes, nodeWidth, width); + computeNodeDepths(nodes, edges, height, nodeGap, iterations); + computeEdgeDepths(nodes); + } - type: 'series.parallel', + /** + * Compute the value of each node by summing the associated edge's value + * + * @param {module:echarts/data/Graph~Node} nodes node of sankey view + */ + function computeNodeValues(nodes) { + zrUtil.each(nodes, function (node) { + var value1 = sum(node.outEdges, getEdgeValue); + var value2 = sum(node.inEdges, getEdgeValue); + var value = Math.max(value1, value2); + node.setLayout({value: value}, true); + }); + } - dependencies: ['parallel'], + /** + * Compute the x-position for each node + * + * @param {module:echarts/data/Graph~Node} nodes node of sankey view + * @param {number} nodeWidth the dx of the node + * @param {number} width the whole width of the area to draw the view + */ + function computeNodeBreadths(nodes, nodeWidth, width) { + var remainNodes = nodes; + var nextNode = null; + var x = 0; + var kx = 0; - getInitialData: function (option, ecModel) { - var parallelModel = ecModel.getComponent( - 'parallel', this.get('parallelIndex') - ); - var parallelAxisIndices = parallelModel.parallelAxisIndex; + while (remainNodes.length) { + nextNode = []; + for (var i = 0, len = remainNodes.length; i < len; i++) { + var node = remainNodes[i]; + node.setLayout({x: x}, true); + node.setLayout({dx: nodeWidth}, true); + for (var j = 0, lenj = node.outEdges.length; j < lenj; j++) { + nextNode.push(node.outEdges[j].node2); + } + } + remainNodes = nextNode; + ++x; + } - var rawData = option.data; - var modelDims = parallelModel.dimensions; + moveSinksRight(nodes, x); + kx = (width - nodeWidth) / (x - 1); - var dataDims = generateDataDims(modelDims, rawData); + scaleNodeBreadths(nodes, kx); + } - var dataDimsInfo = zrUtil.map(dataDims, function (dim, dimIndex) { + /** + * All the node without outEgdes are assigned maximum x-position and + * be aligned in the last column. + * + * @param {module:echarts/data/Graph~Node} nodes node of sankey view + * @param {number} x value (x-1) use to assign to node without outEdges + * as x-position + */ + function moveSinksRight(nodes, x) { + zrUtil.each(nodes, function (node) { + if (!node.outEdges.length) { + node.setLayout({x: x - 1}, true); + } + }); + } - var modelDimsIndex = zrUtil.indexOf(modelDims, dim); - var axisModel = modelDimsIndex >= 0 && ecModel.getComponent( - 'parallelAxis', parallelAxisIndices[modelDimsIndex] - ); + /** + * Scale node x-position to the width + * + * @param {module:echarts/data/Graph~Node} nodes node of sankey view + * @param {number} kx multiple used to scale nodes + */ + function scaleNodeBreadths(nodes, kx) { + zrUtil.each(nodes, function (node) { + var nodeX = node.getLayout().x * kx; + node.setLayout({x: nodeX}, true); + }); + } - if (axisModel && axisModel.get('type') === 'category') { - translateCategoryValue(axisModel, dim, rawData); - return {name: dim, type: 'ordinal'}; - } - else if (modelDimsIndex < 0) { - return completeDimensions.guessOrdinal(rawData, dimIndex) - ? {name: dim, type: 'ordinal'} - : dim; - } - else { - return dim; - } + /** + * Using Gauss-Seidel iterations method to compute the node depth(y-position) + * + * @param {module:echarts/data/Graph~Node} nodes node of sankey view + * @param {module:echarts/data/Graph~Edge} edges edge of sankey view + * @param {number} height the whole height of the area to draw the view + * @param {numbber} nodeGap the vertical distance between two nodes + * in the same column. + * @param {number} iterations the number of iterations for the algorithm + */ + function computeNodeDepths(nodes, edges, height, nodeGap, iterations) { + var nodesByBreadth = nest() + .key(function (d) { + return d.getLayout().x; + }) + .sortKeys(ascending) + .entries(nodes) + .map(function (d) { + return d.values; }); - var list = new List(dataDimsInfo, this); - list.initData(rawData); + initializeNodeDepth(nodes, nodesByBreadth, edges, height, nodeGap); + resolveCollisions(nodesByBreadth, nodeGap, height); - // Anication is forbiden in progressive data mode. - if (this.option.progressive) { - this.option.animation = false; - } + for (var alpha = 1; iterations > 0; iterations--) { + // 0.99 is a experience parameter, ensure that each iterations of + // changes as small as possible. + alpha *= 0.99; + relaxRightToLeft(nodesByBreadth, alpha); + resolveCollisions(nodesByBreadth, nodeGap, height); + relaxLeftToRight(nodesByBreadth, alpha); + resolveCollisions(nodesByBreadth, nodeGap, height); + } + } - return list; - }, + /** + * Compute the original y-position for each node + * + * @param {module:echarts/data/Graph~Node} nodes node of sankey view + * @param {Array.>} nodesByBreadth + * group by the array of all sankey nodes based on the nodes x-position. + * @param {module:echarts/data/Graph~Edge} edges edge of sankey view + * @param {number} height the whole height of the area to draw the view + * @param {number} nodeGap the vertical distance between two nodes + */ + function initializeNodeDepth(nodes, nodesByBreadth, edges, height, nodeGap) { + var kyArray = []; + zrUtil.each(nodesByBreadth, function (nodes) { + var n = nodes.length; + var sum = 0; + zrUtil.each(nodes, function (node) { + sum += node.getLayout().value; + }); + var ky = (height - (n - 1) * nodeGap) / sum; + kyArray.push(ky); + }); - /** - * User can get data raw indices on 'axisAreaSelected' event received. - * - * @public - * @param {string} activeState 'active' or 'inactive' or 'normal' - * @return {Array.} Raw indices - */ - getRawIndicesByActiveState: function (activeState) { - var coordSys = this.coordinateSystem; - var data = this.getData(); - var indices = []; + kyArray.sort(function (a, b) { + return a - b; + }); + var ky0 = kyArray[0]; - coordSys.eachActiveState(data, function (theActiveState, dataIndex) { - if (activeState === theActiveState) { - indices.push(data.getRawIndex(dataIndex)); - } + zrUtil.each(nodesByBreadth, function (nodes) { + zrUtil.each(nodes, function (node, i) { + node.setLayout({y: i}, true); + var nodeDy = node.getLayout().value * ky0; + node.setLayout({dy: nodeDy}, true); }); + }); - return indices; - }, + zrUtil.each(edges, function (edge) { + var edgeDy = +edge.getValue() * ky0; + edge.setLayout({dy: edgeDy}, true); + }); + } - defaultOption: { - zlevel: 0, // 一级层叠 - z: 2, // 二级层叠 + /** + * Resolve the collision of initialized depth (y-position) + * + * @param {Array.>} nodesByBreadth + * group by the array of all sankey nodes based on the nodes x-position. + * @param {number} nodeGap the vertical distance between two nodes + * @param {number} height the whole height of the area to draw the view + */ + function resolveCollisions(nodesByBreadth, nodeGap, height) { + zrUtil.each(nodesByBreadth, function (nodes) { + var node; + var dy; + var y0 = 0; + var n = nodes.length; + var i; - coordinateSystem: 'parallel', - parallelIndex: 0, + nodes.sort(ascendingDepth); - label: { - normal: { - show: false - }, - emphasis: { - show: false + for (i = 0; i < n; i++) { + node = nodes[i]; + dy = y0 - node.getLayout().y; + if (dy > 0) { + var nodeY = node.getLayout().y + dy; + node.setLayout({y: nodeY}, true); } - }, - - inactiveOpacity: 0.05, - activeOpacity: 1, + y0 = node.getLayout().y + node.getLayout().dy + nodeGap; + } - lineStyle: { - normal: { - width: 1, - opacity: 0.45, - type: 'solid' + // if the bottommost node goes outside the bounds, push it back up + dy = y0 - nodeGap - height; + if (dy > 0) { + var nodeY = node.getLayout().y - dy; + node.setLayout({y: nodeY}, true); + y0 = node.getLayout().y; + for (i = n - 2; i >= 0; --i) { + node = nodes[i]; + dy = node.getLayout().y + node.getLayout().dy + nodeGap - y0; + if (dy > 0) { + nodeY = node.getLayout().y - dy; + node.setLayout({y: nodeY}, true); + } + y0 = node.getLayout().y; } - }, - progressive: false, // 100 - smooth: false, - - animationEasing: 'linear' - } - }); - - function translateCategoryValue(axisModel, dim, rawData) { - var axisData = axisModel.get('data'); - var numberDim = convertDimNameToNumber(dim); + } + }); + } - if (axisData && axisData.length) { - zrUtil.each(rawData, function (dataItem) { - if (!dataItem) { - return; + /** + * Change the y-position of the nodes, except most the right side nodes + * + * @param {Array.>} nodesByBreadth + * group by the array of all sankey nodes based on the node x-position. + * @param {number} alpha parameter used to adjust the nodes y-position + */ + function relaxRightToLeft(nodesByBreadth, alpha) { + zrUtil.each(nodesByBreadth.slice().reverse(), function (nodes) { + zrUtil.each(nodes, function (node) { + if (node.outEdges.length) { + var y = sum(node.outEdges, weightedTarget) / sum(node.outEdges, getEdgeValue); + var nodeY = node.getLayout().y + (y - center(node)) * alpha; + node.setLayout({y: nodeY}, true); } - // FIXME - // time consuming, should use hash? - var index = zrUtil.indexOf(axisData, dataItem[numberDim]); - dataItem[numberDim] = index >= 0 ? index : NaN; }); - } - // FIXME - // 如果没有设置axis data, 应自动算出,或者提示。 + }); } - function convertDimNameToNumber(dimName) { - return +dimName.replace('dim', ''); + function weightedTarget(edge) { + return center(edge.node2) * edge.getValue(); } - function generateDataDims(modelDims, rawData) { - // parallelModel.dimension should not be regarded as data - // dimensions. Consider dimensions = ['dim4', 'dim2', 'dim6']; - - // We detect max dim by parallelModel.dimensions and fist - // item in rawData arbitrarily. - var maxDimNum = 0; - zrUtil.each(modelDims, function (dimName) { - var numberDim = convertDimNameToNumber(dimName); - numberDim > maxDimNum && (maxDimNum = numberDim); + /** + * Change the y-position of the nodes, except most the left side nodes + * + * @param {Array.>} nodesByBreadth + * group by the array of all sankey nodes based on the node x-position. + * @param {number} alpha parameter used to adjust the nodes y-position + */ + function relaxLeftToRight(nodesByBreadth, alpha) { + zrUtil.each(nodesByBreadth, function (nodes) { + zrUtil.each(nodes, function (node) { + if (node.inEdges.length) { + var y = sum(node.inEdges, weightedSource) / sum(node.inEdges, getEdgeValue); + var nodeY = node.getLayout().y + (y - center(node)) * alpha; + node.setLayout({y: nodeY}, true); + } + }); }); + } - var firstItem = rawData[0]; - if (firstItem && firstItem.length - 1 > maxDimNum) { - maxDimNum = firstItem.length - 1; - } + function weightedSource(edge) { + return center(edge.node1) * edge.getValue(); + } - var dataDims = []; - for (var i = 0; i <= maxDimNum; i++) { - dataDims.push('dim' + i); - } + /** + * Compute the depth(y-position) of each edge + * + * @param {module:echarts/data/Graph~Node} nodes node of sankey view + */ + function computeEdgeDepths(nodes) { + zrUtil.each(nodes, function (node) { + node.outEdges.sort(ascendingTargetDepth); + node.inEdges.sort(ascendingSourceDepth); + }); + zrUtil.each(nodes, function (node) { + var sy = 0; + var ty = 0; + zrUtil.each(node.outEdges, function (edge) { + edge.setLayout({sy: sy}, true); + sy += edge.getLayout().dy; + }); + zrUtil.each(node.inEdges, function (edge) { + edge.setLayout({ty: ty}, true); + ty += edge.getLayout().dy; + }); + }); + } - return dataDims; + function ascendingTargetDepth(a, b) { + return a.node2.getLayout().y - b.node2.getLayout().y; } + function ascendingSourceDepth(a, b) { + return a.node1.getLayout().y - b.node1.getLayout().y; + } -/***/ }, -/* 239 */ -/***/ function(module, exports, __webpack_require__) { + function sum(array, f) { + var sum = 0; + var len = array.length; + var i = -1; + while (++i < len) { + var value = +f.call(array, array[i], i); + if (!isNaN(value)) { + sum += value; + } + } + return sum; + } - + function center(node) { + return node.getLayout().y + node.getLayout().dy / 2; + } - var graphic = __webpack_require__(43); - var zrUtil = __webpack_require__(4); + function ascendingDepth(a, b) { + return a.getLayout().y - b.getLayout().y; + } - var SMOOTH = 0.3; + function ascending(a, b) { + return a < b ? -1 : a > b ? 1 : a === b ? 0 : NaN; + } - var ParallelView = __webpack_require__(42).extend({ + function getEdgeValue(edge) { + return edge.getValue(); + } - type: 'parallel', - init: function () { - /** - * @type {module:zrender/container/Group} - * @private - */ - this._dataGroup = new graphic.Group(); +/***/ }, +/* 259 */ +/***/ function(module, exports, __webpack_require__) { - this.group.add(this._dataGroup); + - /** - * @type {module:echarts/data/List} - */ - this._data; - }, + var zrUtil = __webpack_require__(4); - /** - * @override - */ - render: function (seriesModel, ecModel, api, payload) { - this._renderForNormal(seriesModel); - // this[ - // seriesModel.option.progressive - // ? '_renderForProgressive' - // : '_renderForNormal' - // ](seriesModel); - }, + /** + * nest helper used to group by the array. + * can specified the keys and sort the keys. + */ + function nest() { - dispose: function () {}, + var keysFunction = []; + var sortKeysFunction = []; /** - * @private + * map an Array into the mapObject. + * @param {Array} array + * @param {number} depth */ - _renderForNormal: function (seriesModel) { - var dataGroup = this._dataGroup; - var data = seriesModel.getData(); - var oldData = this._data; - var coordSys = seriesModel.coordinateSystem; - var dimensions = coordSys.dimensions; - var option = seriesModel.option; - var smooth = option.smooth ? SMOOTH : null; - - // Consider switch between progressive and not. - // oldData && oldData.__plProgressive && dataGroup.removeAll(); - - data.diff(oldData) - .add(add) - .update(update) - .remove(remove) - .execute(); - - // Update style - updateElCommon(data, smooth); - - // First create - if (!this._data) { - var clipPath = createGridClipShape( - coordSys, seriesModel, function () { - // Callback will be invoked immediately if there is no animation - setTimeout(function () { - dataGroup.removeClipPath(); - }); - } - ); - dataGroup.setClipPath(clipPath); - } - - this._data = data; - - function add(newDataIndex) { - addEl(data, dataGroup, newDataIndex, dimensions, coordSys, null, smooth); + function map(array, depth) { + if (depth >= keysFunction.length) { + return array; } + var i = -1; + var n = array.length; + var keyFunction = keysFunction[depth++]; + var mapObject = {}; + var valuesByKey = {}; - function update(newDataIndex, oldDataIndex) { - var line = oldData.getItemGraphicEl(oldDataIndex); - var points = createLinePoints(data, newDataIndex, dimensions, coordSys); - data.setItemGraphicEl(newDataIndex, line); - graphic.updateProps(line, {shape: {points: points}}, seriesModel, newDataIndex); - } + while (++i < n) { + var keyValue = keyFunction(array[i]); + var values = valuesByKey[keyValue]; - function remove(oldDataIndex) { - var line = oldData.getItemGraphicEl(oldDataIndex); - dataGroup.remove(line); + if (values) { + values.push(array[i]); + } + else { + valuesByKey[keyValue] = [array[i]]; + } } - }, - - /** - * @private - */ - // _renderForProgressive: function (seriesModel) { - // var dataGroup = this._dataGroup; - // var data = seriesModel.getData(); - // var oldData = this._data; - // var coordSys = seriesModel.coordinateSystem; - // var dimensions = coordSys.dimensions; - // var option = seriesModel.option; - // var progressive = option.progressive; - // var smooth = option.smooth ? SMOOTH : null; - - // // In progressive animation is disabled, so use simple data diff, - // // which effects performance less. - // // (Typically performance for data with length 7000+ like: - // // simpleDiff: 60ms, addEl: 184ms, - // // in RMBP 2.4GHz intel i7, OSX 10.9 chrome 50.0.2661.102 (64-bit)) - // if (simpleDiff(oldData, data, dimensions)) { - // dataGroup.removeAll(); - // data.each(function (dataIndex) { - // addEl(data, dataGroup, dataIndex, dimensions, coordSys); - // }); - // } - - // updateElCommon(data, progressive, smooth); + zrUtil.each(valuesByKey, function (value, key) { + mapObject[key] = map(value, depth); + }); - // // Consider switch between progressive and not. - // data.__plProgressive = true; - // this._data = data; - // }, + return mapObject; + } /** - * @override + * transform the Map Object to multidimensional Array + * @param {Object} map + * @param {number} depth */ - remove: function () { - this._dataGroup && this._dataGroup.removeAll(); - this._data = null; - } - }); - - function createGridClipShape(coordSys, seriesModel, cb) { - var parallelModel = coordSys.model; - var rect = coordSys.getRect(); - var rectEl = new graphic.Rect({ - shape: { - x: rect.x, - y: rect.y, - width: rect.width, - height: rect.height - } - }); - - var dim = parallelModel.get('layout') === 'horizontal' ? 'width' : 'height'; - rectEl.setShape(dim, 0); - graphic.initProps(rectEl, { - shape: { - width: rect.width, - height: rect.height - } - }, seriesModel, cb); - return rectEl; - } - - function createLinePoints(data, dataIndex, dimensions, coordSys) { - var points = []; - for (var i = 0; i < dimensions.length; i++) { - var dimName = dimensions[i]; - var value = data.get(dimName, dataIndex); - if (!isEmptyValue(value, coordSys.getAxis(dimName).type)) { - points.push(coordSys.dataToPoint(value, dimName)); - } - } - return points; - } - - function addEl(data, dataGroup, dataIndex, dimensions, coordSys) { - var points = createLinePoints(data, dataIndex, dimensions, coordSys); - var line = new graphic.Polyline({ - shape: {points: points}, - silent: true, - z2: 10 - }); - dataGroup.add(line); - data.setItemGraphicEl(dataIndex, line); - } - - function updateElCommon(data, smooth) { - var seriesStyleModel = data.hostModel.getModel('lineStyle.normal'); - var lineStyle = seriesStyleModel.getLineStyle(); - data.eachItemGraphicEl(function (line, dataIndex) { - if (data.hasItemOption) { - var itemModel = data.getItemModel(dataIndex); - var lineStyleModel = itemModel.getModel('lineStyle.normal', seriesStyleModel); - lineStyle = lineStyleModel.getLineStyle(); + function entriesMap(mapObject, depth) { + if (depth >= keysFunction.length) { + return mapObject; } + var array = []; + var sortKeyFunction = sortKeysFunction[depth++]; - line.useStyle(zrUtil.extend( - lineStyle, - { - fill: null, - stroke: data.getItemVisual(dataIndex, 'color'), - opacity: data.getItemVisual(dataIndex, 'opacity') - } - )); - line.shape.smooth = smooth; - }); - } + zrUtil.each(mapObject, function (value, key) { + array.push({ + key: key, values: entriesMap(value, depth) + }); + }); - // function simpleDiff(oldData, newData, dimensions) { - // var oldLen; - // if (!oldData - // || !oldData.__plProgressive - // || (oldLen = oldData.count()) !== newData.count() - // ) { - // return true; - // } + if (sortKeyFunction) { + return array.sort(function (a, b) { + return sortKeyFunction(a.key, b.key); + }); + } + else { + return array; + } + } - // var dimLen = dimensions.length; - // for (var i = 0; i < oldLen; i++) { - // for (var j = 0; j < dimLen; j++) { - // if (oldData.get(dimensions[j], i) !== newData.get(dimensions[j], i)) { - // return true; - // } - // } - // } + return { + /** + * specified the key to groupby the arrays. + * users can specified one more keys. + * @param {Function} d + */ + key: function (d) { + keysFunction.push(d); + return this; + }, - // return false; - // } + /** + * specified the comparator to sort the keys + * @param {Function} order + */ + sortKeys: function (order) { + sortKeysFunction[keysFunction.length - 1] = order; + return this; + }, - // FIXME - // 公用方法? - function isEmptyValue(val, axisType) { - return axisType === 'category' - ? val == null - : (val == null || isNaN(val)); // axisType === 'value' + /** + * the array to be grouped by. + * @param {Array} array + */ + entries: function (array) { + return entriesMap(map(array, 0), 0); + } + }; } - - module.exports = ParallelView; + module.exports = nest; /***/ }, -/* 240 */ -/***/ function(module, exports) { +/* 260 */ +/***/ function(module, exports, __webpack_require__) { - + /** + * @file Visual encoding for sankey view + * @author Deqing Li(annong035@gmail.com) + */ - module.exports = function (ecModel) { - ecModel.eachSeriesByType('parallel', function (seriesModel) { + var VisualMapping = __webpack_require__(209); + var zrUtil = __webpack_require__(4); - var itemStyleModel = seriesModel.getModel('itemStyle.normal'); - var lineStyleModel = seriesModel.getModel('lineStyle.normal'); - var globalColors = ecModel.get('color'); + module.exports = function (ecModel, payload) { + ecModel.eachSeriesByType('sankey', function (seriesModel) { + var graph = seriesModel.getGraph(); + var nodes = graph.nodes; - var color = lineStyleModel.get('color') - || itemStyleModel.get('color') - || globalColors[seriesModel.seriesIndex % globalColors.length]; - var inactiveOpacity = seriesModel.get('inactiveOpacity'); - var activeOpacity = seriesModel.get('activeOpacity'); - var lineStyle = seriesModel.getModel('lineStyle.normal').getLineStyle(); + nodes.sort(function (a, b) { + return a.getLayout().value - b.getLayout().value; + }); - var coordSys = seriesModel.coordinateSystem; - var data = seriesModel.getData(); + var minValue = nodes[0].getLayout().value; + var maxValue = nodes[nodes.length - 1].getLayout().value; - var opacityMap = { - normal: lineStyle.opacity, - active: activeOpacity, - inactive: inactiveOpacity - }; + zrUtil.each(nodes, function (node) { + var mapping = new VisualMapping({ + type: 'color', + mappingMethod: 'linear', + dataExtent: [minValue, maxValue], + visual: seriesModel.get('color') + }); - coordSys.eachActiveState(data, function (activeState, dataIndex) { - data.setItemVisual(dataIndex, 'opacity', opacityMap[activeState]); + var mapValueToColor = mapping.mapValueToVisual(node.getLayout().value); + node.setVisual('color', mapValueToColor); + // If set itemStyle.normal.color + var itemModel = node.getModel(); + var customColor = itemModel.get('itemStyle.normal.color'); + if (customColor != null) { + node.setVisual('color', customColor); + } }); - data.setVisual('color', color); }); }; + /***/ }, -/* 241 */ +/* 261 */ /***/ function(module, exports, __webpack_require__) { var echarts = __webpack_require__(1); - __webpack_require__(242); - __webpack_require__(243); - echarts.registerLayout(__webpack_require__(244)); - echarts.registerVisual(__webpack_require__(246)); + __webpack_require__(262); + __webpack_require__(265); + + echarts.registerVisual(__webpack_require__(266)); + echarts.registerLayout(__webpack_require__(267)); + /***/ }, -/* 242 */ +/* 262 */ /***/ function(module, exports, __webpack_require__) { - /** - * @file Get initial data and define sankey view's series model - * @author Deqing Li(annong035@gmail.com) - */ + 'use strict'; + var zrUtil = __webpack_require__(4); var SeriesModel = __webpack_require__(28); - var createGraphFromNodeEdge = __webpack_require__(199); - var encodeHTML = __webpack_require__(6).encodeHTML; + var whiskerBoxCommon = __webpack_require__(263); - var SankeySeries = SeriesModel.extend({ + var BoxplotSeries = SeriesModel.extend({ - type: 'series.sankey', + type: 'series.boxplot', - layoutInfo: null, + dependencies: ['xAxis', 'yAxis', 'grid'], - /** - * Init a graph data structure from data in option series - * - * @param {Object} option the object used to config echarts view - * @return {module:echarts/data/List} storage initial data - */ - getInitialData: function (option) { - var links = option.edges || option.links; - var nodes = option.data || option.nodes; - if (nodes && links) { - var graph = createGraphFromNodeEdge(nodes, links, this, true); - return graph.data; - } - }, + // TODO + // box width represents group size, so dimension should have 'size'. /** - * Return the graphic data structure - * - * @return {module:echarts/data/Graph} graphic data structure + * @see + * The meanings of 'min' and 'max' depend on user, + * and echarts do not need to know it. + * @readOnly */ - getGraph: function () { - return this.getData().graph; - }, + valueDimensions: ['min', 'Q1', 'median', 'Q3', 'max'], /** - * Get edge data of graphic data structure - * - * @return {module:echarts/data/List} data structure of list + * @type {Array.} + * @readOnly */ - getEdgeData: function () { - return this.getGraph().edgeData; - }, + dimensions: null, /** * @override */ - formatTooltip: function (dataIndex, multipleSeries, dataType) { - // dataType === 'node' or empty do not show tooltip by default - if (dataType === 'edge') { - var params = this.getDataParams(dataIndex, dataType); - var rawDataOpt = params.data; - var html = rawDataOpt.source + ' -- ' + rawDataOpt.target; - if (params.value) { - html += ' : ' + params.value; - } - return encodeHTML(html); - } - - return SankeySeries.superCall(this, 'formatTooltip', dataIndex, multipleSeries); - }, - defaultOption: { - zlevel: 0, - z: 2, - - coordinateSystem: 'view', - - layout: null, - - // the position of the whole view - left: '5%', - top: '5%', - right: '20%', - bottom: '5%', - - // the dx of the node - nodeWidth: 20, + zlevel: 0, // 一级层叠 + z: 2, // 二级层叠 + coordinateSystem: 'cartesian2d', + legendHoverLink: true, - // the vertical distance between two nodes - nodeGap: 8, + hoverAnimation: true, - // the number of iterations to change the position of the node - layoutIterations: 32, + // xAxisIndex: 0, + // yAxisIndex: 0, - label: { - normal: { - show: true, - position: 'right', - textStyle: { - color: '#000', - fontSize: 12 - } - }, - emphasis: { - show: true - } - }, + layout: null, // 'horizontal' or 'vertical' + boxWidth: [7, 50], // [min, max] can be percent of band width. itemStyle: { normal: { - borderWidth: 1, - borderColor: '#333' - } - }, - - lineStyle: { - normal: { - color: '#314656', - opacity: 0.2, - curveness: 0.5 + color: '#fff', + borderWidth: 1 }, emphasis: { - opacity: 0.6 + borderWidth: 2, + shadowBlur: 5, + shadowOffsetX: 2, + shadowOffsetY: 2, + shadowColor: 'rgba(0,0,0,0.4)' } }, - animationEasing: 'linear', - - animationDuration: 1000 + animationEasing: 'elasticOut', + animationDuration: 800 } - }); - module.exports = SankeySeries; + zrUtil.mixin(BoxplotSeries, whiskerBoxCommon.seriesModelMixin, true); + + module.exports = BoxplotSeries; /***/ }, -/* 243 */ +/* 263 */ /***/ function(module, exports, __webpack_require__) { - /** - * @file The file used to draw sankey view - * @author Deqing Li(annong035@gmail.com) - */ + 'use strict'; - var graphic = __webpack_require__(43); + var List = __webpack_require__(98); + var completeDimensions = __webpack_require__(103); + var WhiskerBoxDraw = __webpack_require__(264); var zrUtil = __webpack_require__(4); - var SankeyShape = graphic.extendShape({ - shape: { - x1: 0, y1: 0, - x2: 0, y2: 0, - cpx1: 0, cpy1: 0, - cpx2: 0, cpy2: 0, - - extent: 0 - }, - - buildPath: function (ctx, shape) { - var halfExtent = shape.extent / 2; - ctx.moveTo(shape.x1, shape.y1 - halfExtent); - ctx.bezierCurveTo( - shape.cpx1, shape.cpy1 - halfExtent, - shape.cpx2, shape.cpy2 - halfExtent, - shape.x2, shape.y2 - halfExtent - ); - ctx.lineTo(shape.x2, shape.y2 + halfExtent); - ctx.bezierCurveTo( - shape.cpx2, shape.cpy2 + halfExtent, - shape.cpx1, shape.cpy1 + halfExtent, - shape.x1, shape.y1 + halfExtent - ); - ctx.closePath(); - } - }); - - module.exports = __webpack_require__(1).extendChartView({ + function getItemValue(item) { + return item.value == null ? item : item.value; + } - type: 'sankey', + var seriesModelMixin = { /** * @private - * @type {module:echarts/chart/sankey/SankeySeries} + * @type {string} */ - _model: null, - - render: function (seriesModel, ecModel, api) { - var graph = seriesModel.getGraph(); - var group = this.group; - var layoutInfo = seriesModel.layoutInfo; - var nodeData = seriesModel.getData(); - var edgeData = seriesModel.getData('edge'); - - this._model = seriesModel; - - group.removeAll(); - - group.position = [layoutInfo.x, layoutInfo.y]; - - // generate a bezire Curve for each edge - graph.eachEdge(function (edge) { - var curve = new SankeyShape(); - - curve.dataIndex = edge.dataIndex; - curve.seriesIndex = seriesModel.seriesIndex; - curve.dataType = 'edge'; + _baseAxisDim: null, - var lineStyleModel = edge.getModel('lineStyle.normal'); - var curvature = lineStyleModel.get('curveness'); - var n1Layout = edge.node1.getLayout(); - var n2Layout = edge.node2.getLayout(); - var edgeLayout = edge.getLayout(); + /** + * @override + */ + getInitialData: function (option, ecModel) { + // When both types of xAxis and yAxis are 'value', layout is + // needed to be specified by user. Otherwise, layout can be + // judged by which axis is category. - curve.shape.extent = Math.max(1, edgeLayout.dy); + var categories; - var x1 = n1Layout.x + n1Layout.dx; - var y1 = n1Layout.y + edgeLayout.sy + edgeLayout.dy / 2; - var x2 = n2Layout.x; - var y2 = n2Layout.y + edgeLayout.ty + edgeLayout.dy / 2; - var cpx1 = x1 * (1 - curvature) + x2 * curvature; - var cpy1 = y1; - var cpx2 = x1 * curvature + x2 * (1 - curvature); - var cpy2 = y2; + var xAxisModel = ecModel.getComponent('xAxis', this.get('xAxisIndex')); + var yAxisModel = ecModel.getComponent('yAxis', this.get('yAxisIndex')); + var xAxisType = xAxisModel.get('type'); + var yAxisType = yAxisModel.get('type'); + var addOrdinal; - curve.setShape({ - x1: x1, - y1: y1, - x2: x2, - y2: y2, - cpx1: cpx1, - cpy1: cpy1, - cpx2: cpx2, - cpy2: cpy2 - }); + // FIXME + // 考虑时间轴 - curve.setStyle(lineStyleModel.getItemStyle()); - // Special color, use source node color or target node color - switch (curve.style.fill) { - case 'source': - curve.style.fill = edge.node1.getVisual('color'); - break; - case 'target': - curve.style.fill = edge.node2.getVisual('color'); - break; - } + if (xAxisType === 'category') { + option.layout = 'horizontal'; + categories = xAxisModel.getCategories(); + addOrdinal = true; + } + else if (yAxisType === 'category') { + option.layout = 'vertical'; + categories = yAxisModel.getCategories(); + addOrdinal = true; + } + else { + option.layout = option.layout || 'horizontal'; + } - graphic.setHoverStyle(curve, edge.getModel('lineStyle.emphasis').getItemStyle()); + this._baseAxisDim = option.layout === 'horizontal' ? 'x' : 'y'; - group.add(curve); + var data = option.data; + var dimensions = this.dimensions = ['base'].concat(this.valueDimensions); + completeDimensions(dimensions, data); - edgeData.setItemGraphicEl(edge.dataIndex, curve); + var list = new List(dimensions, this); + list.initData(data, categories ? categories.slice() : null, function (dataItem, dimName, idx, dimIdx) { + var value = getItemValue(dataItem); + return addOrdinal ? (dimName === 'base' ? idx : value[dimIdx - 1]) : value[dimIdx]; }); - // generate a rect for each node - graph.eachNode(function (node) { - var layout = node.getLayout(); - var itemModel = node.getModel(); - var labelModel = itemModel.getModel('label.normal'); - var textStyleModel = labelModel.getModel('textStyle'); - var labelHoverModel = itemModel.getModel('label.emphasis'); - var textStyleHoverModel = labelHoverModel.getModel('textStyle'); - - var rect = new graphic.Rect({ - shape: { - x: layout.x, - y: layout.y, - width: node.getLayout().dx, - height: node.getLayout().dy - }, - style: { - // Get formatted label in label.normal option - // Use node id if it is not specified - text: labelModel.get('show') - ? seriesModel.getFormattedLabel(node.dataIndex, 'normal') || node.id - // Use empty string to hide the label - : '', - textFont: textStyleModel.getFont(), - textFill: textStyleModel.getTextColor(), - textPosition: labelModel.get('position') - } - }); - - rect.setStyle(zrUtil.defaults( - { - fill: node.getVisual('color') - }, - itemModel.getModel('itemStyle.normal').getItemStyle() - )); + return list; + }, - graphic.setHoverStyle(rect, zrUtil.extend( - node.getModel('itemStyle.emphasis'), - { - text: labelHoverModel.get('show') - ? seriesModel.getFormattedLabel(node.dataIndex, 'emphasis') || node.id - : '', - textFont: textStyleHoverModel.getFont(), - textFill: textStyleHoverModel.getTextColor(), - textPosition: labelHoverModel.get('position') - } - )); + /** + * Used by Gird. + * @param {string} axisDim 'x' or 'y' + * @return {Array.} dimensions on the axis. + */ + coordDimToDataDim: function (axisDim) { + var dims = this.valueDimensions.slice(); + var baseDim = ['base']; + var map = { + horizontal: {x: baseDim, y: dims}, + vertical: {x: dims, y: baseDim} + }; + return map[this.get('layout')][axisDim]; + }, - group.add(rect); + /** + * @override + * @param {string|number} dataDim + * @return {string} coord dimension + */ + dataDimToCoordDim: function (dataDim) { + var dim; - nodeData.setItemGraphicEl(node.dataIndex, rect); + zrUtil.each(['x', 'y'], function (coordDim, index) { + var dataDims = this.coordDimToDataDim(coordDim); + if (zrUtil.indexOf(dataDims, dataDim) >= 0) { + dim = coordDim; + } + }, this); - rect.dataType = 'node'; - }); + return dim; + }, - if (!this._data && seriesModel.get('animation')) { - group.setClipPath(createGridClipShape(group.getBoundingRect(), seriesModel, function () { - group.removeClipPath(); - })); - } + /** + * If horizontal, base axis is x, otherwise y. + * @override + */ + getBaseAxis: function () { + var dim = this._baseAxisDim; + return this.ecModel.getComponent(dim + 'Axis', this.get(dim + 'AxisIndex')).axis; + } + }; - this._data = seriesModel.getData(); - }, + var viewMixin = { - dispose: function () {} - }); + init: function () { + /** + * Old data. + * @private + * @type {module:echarts/chart/helper/WhiskerBoxDraw} + */ + var whiskerBoxDraw = this._whiskerBoxDraw = new WhiskerBoxDraw( + this.getStyleUpdater() + ); + this.group.add(whiskerBoxDraw.group); + }, - // add animation to the view - function createGridClipShape(rect, seriesModel, cb) { - var rectEl = new graphic.Rect({ - shape: { - x: rect.x - 10, - y: rect.y - 10, - width: 0, - height: rect.height + 20 - } - }); - graphic.initProps(rectEl, { - shape: { - width: rect.width + 20, - height: rect.height + 20 - } - }, seriesModel, cb); + render: function (seriesModel, ecModel, api) { + this._whiskerBoxDraw.updateData(seriesModel.getData()); + }, - return rectEl; - } + remove: function (ecModel) { + this._whiskerBoxDraw.remove(); + } + }; + module.exports = { + seriesModelMixin: seriesModelMixin, + viewMixin: viewMixin + }; /***/ }, -/* 244 */ +/* 264 */ /***/ function(module, exports, __webpack_require__) { /** - * @file The layout algorithm of sankey view - * @author Deqing Li(annong035@gmail.com) + * @module echarts/chart/helper/Symbol */ - var layout = __webpack_require__(21); - var nest = __webpack_require__(245); var zrUtil = __webpack_require__(4); + var graphic = __webpack_require__(44); + var Path = __webpack_require__(46); - module.exports = function (ecModel, api, payload) { + var WhiskerPath = Path.extend({ - ecModel.eachSeriesByType('sankey', function (seriesModel) { + type: 'whiskerInBox', - var nodeWidth = seriesModel.get('nodeWidth'); - var nodeGap = seriesModel.get('nodeGap'); + shape: {}, - var layoutInfo = getViewRect(seriesModel, api); + buildPath: function (ctx, shape) { + for (var i in shape) { + if (shape.hasOwnProperty(i) && i.indexOf('ends') === 0) { + var pts = shape[i]; + ctx.moveTo(pts[0][0], pts[0][1]); + ctx.lineTo(pts[1][0], pts[1][1]); + } + } + } + }); - seriesModel.layoutInfo = layoutInfo; + /** + * @constructor + * @alias {module:echarts/chart/helper/WhiskerBox} + * @param {module:echarts/data/List} data + * @param {number} idx + * @param {Function} styleUpdater + * @param {boolean} isInit + * @extends {module:zrender/graphic/Group} + */ + function WhiskerBox(data, idx, styleUpdater, isInit) { + graphic.Group.call(this); - var width = layoutInfo.width; - var height = layoutInfo.height; + /** + * @type {number} + * @readOnly + */ + this.bodyIndex; - var graph = seriesModel.getGraph(); + /** + * @type {number} + * @readOnly + */ + this.whiskerIndex; - var nodes = graph.nodes; - var edges = graph.edges; + /** + * @type {Function} + */ + this.styleUpdater = styleUpdater; - computeNodeValues(nodes); + this._createContent(data, idx, isInit); - var filteredNodes = nodes.filter(function (node) { - return node.getLayout().value === 0; - }); + this.updateData(data, idx, isInit); - var iterations = filteredNodes.length !== 0 - ? 0 : seriesModel.get('layoutIterations'); + /** + * Last series model. + * @type {module:echarts/model/Series} + */ + this._seriesModel; + } - layoutSankey(nodes, edges, nodeWidth, nodeGap, width, height, iterations); + var whiskerBoxProto = WhiskerBox.prototype; + + whiskerBoxProto._createContent = function (data, idx, isInit) { + var itemLayout = data.getItemLayout(idx); + var constDim = itemLayout.chartLayout === 'horizontal' ? 1 : 0; + var count = 0; + + // Whisker element. + this.add(new graphic.Polygon({ + shape: { + points: isInit + ? transInit(itemLayout.bodyEnds, constDim, itemLayout) + : itemLayout.bodyEnds + }, + style: {strokeNoScale: true}, + z2: 100 + })); + this.bodyIndex = count++; + + // Box element. + var whiskerEnds = zrUtil.map(itemLayout.whiskerEnds, function (ends) { + return isInit ? transInit(ends, constDim, itemLayout) : ends; }); + this.add(new WhiskerPath({ + shape: makeWhiskerEndsShape(whiskerEnds), + style: {strokeNoScale: true}, + z2: 100 + })); + this.whiskerIndex = count++; }; - /** - * Get the layout position of the whole view - * - * @param {module:echarts/model/Series} seriesModel the model object of sankey series - * @param {module:echarts/ExtensionAPI} api provide the API list that the developer can call - * @return {module:zrender/core/BoundingRect} size of rect to draw the sankey view - */ - function getViewRect(seriesModel, api) { - return layout.getLayoutRect( - seriesModel.getBoxLayoutParams(), { - width: api.getWidth(), - height: api.getHeight() - } - ); - } - - function layoutSankey(nodes, edges, nodeWidth, nodeGap, width, height, iterations) { - computeNodeBreadths(nodes, nodeWidth, width); - computeNodeDepths(nodes, edges, height, nodeGap, iterations); - computeEdgeDepths(nodes); + function transInit(points, dim, itemLayout) { + return zrUtil.map(points, function (point) { + point = point.slice(); + point[dim] = itemLayout.initBaseline; + return point; + }); } - /** - * Compute the value of each node by summing the associated edge's value - * - * @param {module:echarts/data/Graph~Node} nodes node of sankey view - */ - function computeNodeValues(nodes) { - zrUtil.each(nodes, function (node) { - var value1 = sum(node.outEdges, getEdgeValue); - var value2 = sum(node.inEdges, getEdgeValue); - var value = Math.max(value1, value2); - node.setLayout({value: value}, true); + function makeWhiskerEndsShape(whiskerEnds) { + // zr animation only support 2-dim array. + var shape = {}; + zrUtil.each(whiskerEnds, function (ends, i) { + shape['ends' + i] = ends; }); + return shape; } /** - * Compute the x-position for each node - * - * @param {module:echarts/data/Graph~Node} nodes node of sankey view - * @param {number} nodeWidth the dx of the node - * @param {number} width the whole width of the area to draw the view + * Update symbol properties + * @param {module:echarts/data/List} data + * @param {number} idx */ - function computeNodeBreadths(nodes, nodeWidth, width) { - var remainNodes = nodes; - var nextNode = null; - var x = 0; - var kx = 0; + whiskerBoxProto.updateData = function (data, idx, isInit) { + var seriesModel = this._seriesModel = data.hostModel; + var itemLayout = data.getItemLayout(idx); + var updateMethod = graphic[isInit ? 'initProps' : 'updateProps']; + // this.childAt(this.bodyIndex).stopAnimation(true); + // this.childAt(this.whiskerIndex).stopAnimation(true); + updateMethod( + this.childAt(this.bodyIndex), + {shape: {points: itemLayout.bodyEnds}}, + seriesModel, idx + ); + updateMethod( + this.childAt(this.whiskerIndex), + {shape: makeWhiskerEndsShape(itemLayout.whiskerEnds)}, + seriesModel, idx + ); - while (remainNodes.length) { - nextNode = []; - for (var i = 0, len = remainNodes.length; i < len; i++) { - var node = remainNodes[i]; - node.setLayout({x: x}, true); - node.setLayout({dx: nodeWidth}, true); - for (var j = 0, lenj = node.outEdges.length; j < lenj; j++) { - nextNode.push(node.outEdges[j].node2); - } - } - remainNodes = nextNode; - ++x; - } + this.styleUpdater.call(null, this, data, idx); + }; - moveSinksRight(nodes, x); - kx = (width - nodeWidth) / (x - 1); + zrUtil.inherits(WhiskerBox, graphic.Group); - scaleNodeBreadths(nodes, kx); - } /** - * All the node without outEgdes are assigned maximum x-position and - * be aligned in the last column. - * - * @param {module:echarts/data/Graph~Node} nodes node of sankey view - * @param {number} x value (x-1) use to assign to node without outEdges - * as x-position + * @constructor + * @alias module:echarts/chart/helper/WhiskerBoxDraw */ - function moveSinksRight(nodes, x) { - zrUtil.each(nodes, function (node) { - if (!node.outEdges.length) { - node.setLayout({x: x - 1}, true); - } - }); + function WhiskerBoxDraw(styleUpdater) { + this.group = new graphic.Group(); + this.styleUpdater = styleUpdater; } - /** - * Scale node x-position to the width - * - * @param {module:echarts/data/Graph~Node} nodes node of sankey view - * @param {number} kx multiple used to scale nodes - */ - function scaleNodeBreadths(nodes, kx) { - zrUtil.each(nodes, function (node) { - var nodeX = node.getLayout().x * kx; - node.setLayout({x: nodeX}, true); - }); - } + var whiskerBoxDrawProto = WhiskerBoxDraw.prototype; /** - * Using Gauss-Seidel iterations method to compute the node depth(y-position) - * - * @param {module:echarts/data/Graph~Node} nodes node of sankey view - * @param {module:echarts/data/Graph~Edge} edges edge of sankey view - * @param {number} height the whole height of the area to draw the view - * @param {numbber} nodeGap the vertical distance between two nodes - * in the same column. - * @param {number} iterations the number of iterations for the algorithm + * Update symbols draw by new data + * @param {module:echarts/data/List} data */ - function computeNodeDepths(nodes, edges, height, nodeGap, iterations) { - var nodesByBreadth = nest() - .key(function (d) { - return d.getLayout().x; + whiskerBoxDrawProto.updateData = function (data) { + var group = this.group; + var oldData = this._data; + var styleUpdater = this.styleUpdater; + + data.diff(oldData) + .add(function (newIdx) { + if (data.hasValue(newIdx)) { + var symbolEl = new WhiskerBox(data, newIdx, styleUpdater, true); + data.setItemGraphicEl(newIdx, symbolEl); + group.add(symbolEl); + } }) - .sortKeys(ascending) - .entries(nodes) - .map(function (d) { - return d.values; - }); + .update(function (newIdx, oldIdx) { + var symbolEl = oldData.getItemGraphicEl(oldIdx); - initializeNodeDepth(nodes, nodesByBreadth, edges, height, nodeGap); - resolveCollisions(nodesByBreadth, nodeGap, height); + // Empty data + if (!data.hasValue(newIdx)) { + group.remove(symbolEl); + return; + } - for (var alpha = 1; iterations > 0; iterations--) { - // 0.99 is a experience parameter, ensure that each iterations of - // changes as small as possible. - alpha *= 0.99; - relaxRightToLeft(nodesByBreadth, alpha); - resolveCollisions(nodesByBreadth, nodeGap, height); - relaxLeftToRight(nodesByBreadth, alpha); - resolveCollisions(nodesByBreadth, nodeGap, height); - } - } + if (!symbolEl) { + symbolEl = new WhiskerBox(data, newIdx, styleUpdater); + } + else { + symbolEl.updateData(data, newIdx); + } + + // Add back + group.add(symbolEl); + + data.setItemGraphicEl(newIdx, symbolEl); + }) + .remove(function (oldIdx) { + var el = oldData.getItemGraphicEl(oldIdx); + el && group.remove(el); + }) + .execute(); + + this._data = data; + }; /** - * Compute the original y-position for each node - * - * @param {module:echarts/data/Graph~Node} nodes node of sankey view - * @param {Array.>} nodesByBreadth - * group by the array of all sankey nodes based on the nodes x-position. - * @param {module:echarts/data/Graph~Edge} edges edge of sankey view - * @param {number} height the whole height of the area to draw the view - * @param {number} nodeGap the vertical distance between two nodes + * Remove symbols. + * @param {module:echarts/data/List} data */ - function initializeNodeDepth(nodes, nodesByBreadth, edges, height, nodeGap) { - var kyArray = []; - zrUtil.each(nodesByBreadth, function (nodes) { - var n = nodes.length; - var sum = 0; - zrUtil.each(nodes, function (node) { - sum += node.getLayout().value; - }); - var ky = (height - (n - 1) * nodeGap) / sum; - kyArray.push(ky); + whiskerBoxDrawProto.remove = function () { + var group = this.group; + var data = this._data; + this._data = null; + data && data.eachItemGraphicEl(function (el) { + el && group.remove(el); }); + }; - kyArray.sort(function (a, b) { - return a - b; - }); - var ky0 = kyArray[0]; + module.exports = WhiskerBoxDraw; - zrUtil.each(nodesByBreadth, function (nodes) { - zrUtil.each(nodes, function (node, i) { - node.setLayout({y: i}, true); - var nodeDy = node.getLayout().value * ky0; - node.setLayout({dy: nodeDy}, true); - }); - }); - zrUtil.each(edges, function (edge) { - var edgeDy = +edge.getValue() * ky0; - edge.setLayout({dy: edgeDy}, true); - }); - } +/***/ }, +/* 265 */ +/***/ function(module, exports, __webpack_require__) { - /** - * Resolve the collision of initialized depth (y-position) - * - * @param {Array.>} nodesByBreadth - * group by the array of all sankey nodes based on the nodes x-position. - * @param {number} nodeGap the vertical distance between two nodes - * @param {number} height the whole height of the area to draw the view - */ - function resolveCollisions(nodesByBreadth, nodeGap, height) { - zrUtil.each(nodesByBreadth, function (nodes) { - var node; - var dy; - var y0 = 0; - var n = nodes.length; - var i; + 'use strict'; - nodes.sort(ascendingDepth); - for (i = 0; i < n; i++) { - node = nodes[i]; - dy = y0 - node.getLayout().y; - if (dy > 0) { - var nodeY = node.getLayout().y + dy; - node.setLayout({y: nodeY}, true); - } - y0 = node.getLayout().y + node.getLayout().dy + nodeGap; - } + var zrUtil = __webpack_require__(4); + var ChartView = __webpack_require__(43); + var graphic = __webpack_require__(44); + var whiskerBoxCommon = __webpack_require__(263); - // if the bottommost node goes outside the bounds, push it back up - dy = y0 - nodeGap - height; - if (dy > 0) { - var nodeY = node.getLayout().y - dy; - node.setLayout({y: nodeY}, true); - y0 = node.getLayout().y; - for (i = n - 2; i >= 0; --i) { - node = nodes[i]; - dy = node.getLayout().y + node.getLayout().dy + nodeGap - y0; - if (dy > 0) { - nodeY = node.getLayout().y - dy; - node.setLayout({y: nodeY}, true); - } - y0 = node.getLayout().y; - } - } - }); - } + var BoxplotView = ChartView.extend({ - /** - * Change the y-position of the nodes, except most the right side nodes - * - * @param {Array.>} nodesByBreadth - * group by the array of all sankey nodes based on the node x-position. - * @param {number} alpha parameter used to adjust the nodes y-position - */ - function relaxRightToLeft(nodesByBreadth, alpha) { - zrUtil.each(nodesByBreadth.slice().reverse(), function (nodes) { - zrUtil.each(nodes, function (node) { - if (node.outEdges.length) { - var y = sum(node.outEdges, weightedTarget) / sum(node.outEdges, getEdgeValue); - var nodeY = node.getLayout().y + (y - center(node)) * alpha; - node.setLayout({y: nodeY}, true); - } - }); - }); - } + type: 'boxplot', - function weightedTarget(edge) { - return center(edge.node2) * edge.getValue(); - } + getStyleUpdater: function () { + return updateStyle; + }, - /** - * Change the y-position of the nodes, except most the left side nodes - * - * @param {Array.>} nodesByBreadth - * group by the array of all sankey nodes based on the node x-position. - * @param {number} alpha parameter used to adjust the nodes y-position - */ - function relaxLeftToRight(nodesByBreadth, alpha) { - zrUtil.each(nodesByBreadth, function (nodes) { - zrUtil.each(nodes, function (node) { - if (node.inEdges.length) { - var y = sum(node.inEdges, weightedSource) / sum(node.inEdges, getEdgeValue); - var nodeY = node.getLayout().y + (y - center(node)) * alpha; - node.setLayout({y: nodeY}, true); - } - }); - }); - } + dispose: zrUtil.noop + }); - function weightedSource(edge) { - return center(edge.node1) * edge.getValue(); - } + zrUtil.mixin(BoxplotView, whiskerBoxCommon.viewMixin, true); - /** - * Compute the depth(y-position) of each edge - * - * @param {module:echarts/data/Graph~Node} nodes node of sankey view - */ - function computeEdgeDepths(nodes) { - zrUtil.each(nodes, function (node) { - node.outEdges.sort(ascendingTargetDepth); - node.inEdges.sort(ascendingSourceDepth); - }); - zrUtil.each(nodes, function (node) { - var sy = 0; - var ty = 0; - zrUtil.each(node.outEdges, function (edge) { - edge.setLayout({sy: sy}, true); - sy += edge.getLayout().dy; - }); - zrUtil.each(node.inEdges, function (edge) { - edge.setLayout({ty: ty}, true); - ty += edge.getLayout().dy; - }); - }); + // Update common properties + var normalStyleAccessPath = ['itemStyle', 'normal']; + var emphasisStyleAccessPath = ['itemStyle', 'emphasis']; + + function updateStyle(itemGroup, data, idx) { + var itemModel = data.getItemModel(idx); + var normalItemStyleModel = itemModel.getModel(normalStyleAccessPath); + var borderColor = data.getItemVisual(idx, 'color'); + + // Exclude borderColor. + var itemStyle = normalItemStyleModel.getItemStyle(['borderColor']); + + var whiskerEl = itemGroup.childAt(itemGroup.whiskerIndex); + whiskerEl.style.set(itemStyle); + whiskerEl.style.stroke = borderColor; + whiskerEl.dirty(); + + var bodyEl = itemGroup.childAt(itemGroup.bodyIndex); + bodyEl.style.set(itemStyle); + bodyEl.style.stroke = borderColor; + bodyEl.dirty(); + + var hoverStyle = itemModel.getModel(emphasisStyleAccessPath).getItemStyle(); + graphic.setHoverStyle(itemGroup, hoverStyle); } - function ascendingTargetDepth(a, b) { - return a.node2.getLayout().y - b.node2.getLayout().y; - } + module.exports = BoxplotView; + + + +/***/ }, +/* 266 */ +/***/ function(module, exports) { - function ascendingSourceDepth(a, b) { - return a.node1.getLayout().y - b.node1.getLayout().y; - } + - function sum(array, f) { - var sum = 0; - var len = array.length; - var i = -1; - while (++i < len) { - var value = +f.call(array, array[i], i); - if (!isNaN(value)) { - sum += value; - } - } - return sum; - } + var borderColorQuery = ['itemStyle', 'normal', 'borderColor']; - function center(node) { - return node.getLayout().y + node.getLayout().dy / 2; - } + module.exports = function (ecModel, api) { - function ascendingDepth(a, b) { - return a.getLayout().y - b.getLayout().y; - } + var globalColors = ecModel.get('color'); - function ascending(a, b) { - return a < b ? -1 : a > b ? 1 : a === b ? 0 : NaN; - } + ecModel.eachRawSeriesByType('boxplot', function (seriesModel) { - function getEdgeValue(edge) { - return edge.getValue(); - } + var defaulColor = globalColors[seriesModel.seriesIndex % globalColors.length]; + var data = seriesModel.getData(); + + data.setVisual({ + legendSymbol: 'roundRect', + // Use name 'color' but not 'borderColor' for legend usage and + // visual coding from other component like dataRange. + color: seriesModel.get(borderColorQuery) || defaulColor + }); + + // Only visible series has each data be visual encoded + if (!ecModel.isSeriesFiltered(seriesModel)) { + data.each(function (idx) { + var itemModel = data.getItemModel(idx); + data.setItemVisual( + idx, + {color: itemModel.get(borderColorQuery, true)} + ); + }); + } + }); + }; /***/ }, -/* 245 */ +/* 267 */ /***/ function(module, exports, __webpack_require__) { var zrUtil = __webpack_require__(4); + var numberUtil = __webpack_require__(7); + var parsePercent = numberUtil.parsePercent; + var each = zrUtil.each; - /** - * nest helper used to group by the array. - * can specified the keys and sort the keys. - */ - function nest() { - - var keysFunction = []; - var sortKeysFunction = []; + module.exports = function (ecModel) { - /** - * map an Array into the mapObject. - * @param {Array} array - * @param {number} depth - */ - function map(array, depth) { - if (depth >= keysFunction.length) { - return array; - } - var i = -1; - var n = array.length; - var keyFunction = keysFunction[depth++]; - var mapObject = {}; - var valuesByKey = {}; + var groupResult = groupSeriesByAxis(ecModel); - while (++i < n) { - var keyValue = keyFunction(array[i]); - var values = valuesByKey[keyValue]; + each(groupResult, function (groupItem) { + var seriesModels = groupItem.seriesModels; - if (values) { - values.push(array[i]); - } - else { - valuesByKey[keyValue] = [array[i]]; - } + if (!seriesModels.length) { + return; } - zrUtil.each(valuesByKey, function (value, key) { - mapObject[key] = map(value, depth); + calculateBase(groupItem); + + each(seriesModels, function (seriesModel, idx) { + layoutSingleSeries( + seriesModel, + groupItem.boxOffsetList[idx], + groupItem.boxWidthList[idx] + ); }); + }); + }; - return mapObject; - } + /** + * Group series by axis. + */ + function groupSeriesByAxis(ecModel) { + var result = []; + var axisList = []; - /** - * transform the Map Object to multidimensional Array - * @param {Object} map - * @param {number} depth - */ - function entriesMap(mapObject, depth) { - if (depth >= keysFunction.length) { - return mapObject; + ecModel.eachSeriesByType('boxplot', function (seriesModel) { + var baseAxis = seriesModel.getBaseAxis(); + var idx = zrUtil.indexOf(axisList, baseAxis); + + if (idx < 0) { + idx = axisList.length; + axisList[idx] = baseAxis; + result[idx] = {axis: baseAxis, seriesModels: []}; } - var array = []; - var sortKeyFunction = sortKeysFunction[depth++]; - zrUtil.each(mapObject, function (value, key) { - array.push({ - key: key, values: entriesMap(value, depth) - }); - }); + result[idx].seriesModels.push(seriesModel); + }); - if (sortKeyFunction) { - return array.sort(function (a, b) { - return sortKeyFunction(a.key, b.key); - }); - } - else { - return array; - } - } + return result; + } - return { - /** - * specified the key to groupby the arrays. - * users can specified one more keys. - * @param {Function} d - */ - key: function (d) { - keysFunction.push(d); - return this; - }, + /** + * Calculate offset and box width for each series. + */ + function calculateBase(groupItem) { + var extent; + var baseAxis = groupItem.axis; + var seriesModels = groupItem.seriesModels; + var seriesCount = seriesModels.length; - /** - * specified the comparator to sort the keys - * @param {Function} order - */ - sortKeys: function (order) { - sortKeysFunction[keysFunction.length - 1] = order; - return this; - }, + var boxWidthList = groupItem.boxWidthList = []; + var boxOffsetList = groupItem.boxOffsetList = []; + var boundList = []; - /** - * the array to be grouped by. - * @param {Array} array - */ - entries: function (array) { - return entriesMap(map(array, 0), 0); - } - }; - } - module.exports = nest; + var bandWidth; + if (baseAxis.type === 'category') { + bandWidth = baseAxis.getBandWidth(); + } + else { + var maxDataCount = 0; + each(seriesModels, function (seriesModel) { + maxDataCount = Math.max(maxDataCount, seriesModel.getData().count()); + }); + extent = baseAxis.getExtent(), + Math.abs(extent[1] - extent[0]) / maxDataCount; + } + each(seriesModels, function (seriesModel) { + var boxWidthBound = seriesModel.get('boxWidth'); + if (!zrUtil.isArray(boxWidthBound)) { + boxWidthBound = [boxWidthBound, boxWidthBound]; + } + boundList.push([ + parsePercent(boxWidthBound[0], bandWidth) || 0, + parsePercent(boxWidthBound[1], bandWidth) || 0 + ]); + }); -/***/ }, -/* 246 */ -/***/ function(module, exports, __webpack_require__) { + var availableWidth = bandWidth * 0.8 - 2; + var boxGap = availableWidth / seriesCount * 0.3; + var boxWidth = (availableWidth - boxGap * (seriesCount - 1)) / seriesCount; + var base = boxWidth / 2 - availableWidth / 2; - /** - * @file Visual encoding for sankey view - * @author Deqing Li(annong035@gmail.com) - */ + each(seriesModels, function (seriesModel, idx) { + boxOffsetList.push(base); + base += boxGap + boxWidth; + boxWidthList.push( + Math.min(Math.max(boxWidth, boundList[idx][0]), boundList[idx][1]) + ); + }); + } - var VisualMapping = __webpack_require__(195); - var zrUtil = __webpack_require__(4); + /** + * Calculate points location for each series. + */ + function layoutSingleSeries(seriesModel, offset, boxWidth) { + var coordSys = seriesModel.coordinateSystem; + var data = seriesModel.getData(); + var dimensions = seriesModel.dimensions; + var chartLayout = seriesModel.get('layout'); + var halfWidth = boxWidth / 2; - module.exports = function (ecModel, payload) { - ecModel.eachSeriesByType('sankey', function (seriesModel) { - var graph = seriesModel.getGraph(); - var nodes = graph.nodes; + data.each(dimensions, function () { + var args = arguments; + var dimLen = dimensions.length; + var axisDimVal = args[0]; + var idx = args[dimLen]; + var variableDim = chartLayout === 'horizontal' ? 0 : 1; + var constDim = 1 - variableDim; - nodes.sort(function (a, b) { - return a.getLayout().value - b.getLayout().value; - }); + var median = getPoint(args[3]); + var end1 = getPoint(args[1]); + var end5 = getPoint(args[5]); + var whiskerEnds = [ + [end1, getPoint(args[2])], + [end5, getPoint(args[4])] + ]; + layEndLine(end1); + layEndLine(end5); + layEndLine(median); - var minValue = nodes[0].getLayout().value; - var maxValue = nodes[nodes.length - 1].getLayout().value; + var bodyEnds = []; + addBodyEnd(whiskerEnds[0][1], 0); + addBodyEnd(whiskerEnds[1][1], 1); - zrUtil.each(nodes, function (node) { - var mapping = new VisualMapping({ - type: 'color', - mappingMethod: 'linear', - dataExtent: [minValue, maxValue], - visual: seriesModel.get('color') - }); + data.setItemLayout(idx, { + chartLayout: chartLayout, + initBaseline: median[constDim], + median: median, + bodyEnds: bodyEnds, + whiskerEnds: whiskerEnds + }); - var mapValueToColor = mapping.mapValueToVisual(node.getLayout().value); - node.setVisual('color', mapValueToColor); - // If set itemStyle.normal.color - var itemModel = node.getModel(); - var customColor = itemModel.get('itemStyle.normal.color'); - if (customColor != null) { - node.setVisual('color', customColor); + function getPoint(val) { + var p = []; + p[variableDim] = axisDimVal; + p[constDim] = val; + var point; + if (isNaN(axisDimVal) || isNaN(val)) { + point = [NaN, NaN]; } - }); + else { + point = coordSys.dataToPoint(p); + point[variableDim] += offset; + } + return point; + } + + function addBodyEnd(point, start) { + var point1 = point.slice(); + var point2 = point.slice(); + point1[variableDim] += halfWidth; + point2[variableDim] -= halfWidth; + start + ? bodyEnds.push(point1, point2) + : bodyEnds.push(point2, point1); + } + function layEndLine(endCenter) { + var line = [endCenter.slice(), endCenter.slice()]; + line[0][variableDim] -= halfWidth; + line[1][variableDim] += halfWidth; + whiskerEnds.push(line); + } }); - }; + } /***/ }, -/* 247 */ +/* 268 */ /***/ function(module, exports, __webpack_require__) { var echarts = __webpack_require__(1); - __webpack_require__(248); - __webpack_require__(251); + __webpack_require__(269); + __webpack_require__(270); + + echarts.registerPreprocessor( + __webpack_require__(271) + ); - echarts.registerVisual(__webpack_require__(252)); - echarts.registerLayout(__webpack_require__(253)); + echarts.registerVisual(__webpack_require__(272)); + echarts.registerLayout(__webpack_require__(273)); /***/ }, -/* 248 */ +/* 269 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -45992,24 +49645,21 @@ return /******/ (function(modules) { // webpackBootstrap var zrUtil = __webpack_require__(4); var SeriesModel = __webpack_require__(28); - var whiskerBoxCommon = __webpack_require__(249); + var whiskerBoxCommon = __webpack_require__(263); + var formatUtil = __webpack_require__(6); + var encodeHTML = formatUtil.encodeHTML; + var addCommas = formatUtil.addCommas; - var BoxplotSeries = SeriesModel.extend({ + var CandlestickSeries = SeriesModel.extend({ - type: 'series.boxplot', + type: 'series.candlestick', dependencies: ['xAxis', 'yAxis', 'grid'], - // TODO - // box width represents group size, so dimension should have 'size'. - /** - * @see - * The meanings of 'min' and 'max' depend on user, - * and echarts do not need to know it. * @readOnly */ - valueDimensions: ['min', 'Q1', 'median', 'Q3', 'max'], + valueDimensions: ['open', 'close', 'lowest', 'highest'], /** * @type {Array.} @@ -46031,10734 +49681,11192 @@ return /******/ (function(modules) { // webpackBootstrap // xAxisIndex: 0, // yAxisIndex: 0, - layout: null, // 'horizontal' or 'vertical' - boxWidth: [7, 50], // [min, max] can be percent of band width. + layout: null, // 'horizontal' or 'vertical' itemStyle: { normal: { - color: '#fff', - borderWidth: 1 + color: '#c23531', // 阳线 positive + color0: '#314656', // 阴线 negative '#c23531', '#314656' + borderWidth: 1, + // FIXME + // ec2中使用的是lineStyle.color 和 lineStyle.color0 + borderColor: '#c23531', + borderColor0: '#314656' }, emphasis: { - borderWidth: 2, - shadowBlur: 5, - shadowOffsetX: 2, - shadowOffsetY: 2, - shadowColor: 'rgba(0,0,0,0.4)' + borderWidth: 2 } }, - animationEasing: 'elasticOut', - animationDuration: 800 - } - }); - - zrUtil.mixin(BoxplotSeries, whiskerBoxCommon.seriesModelMixin, true); - - module.exports = BoxplotSeries; - - - -/***/ }, -/* 249 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - - var List = __webpack_require__(98); - var completeDimensions = __webpack_require__(103); - var WhiskerBoxDraw = __webpack_require__(250); - var zrUtil = __webpack_require__(4); - - function getItemValue(item) { - return item.value == null ? item : item.value; - } - - var seriesModelMixin = { - - /** - * @private - * @type {string} - */ - _baseAxisDim: null, - - /** - * @override - */ - getInitialData: function (option, ecModel) { - // When both types of xAxis and yAxis are 'value', layout is - // needed to be specified by user. Otherwise, layout can be - // judged by which axis is category. - - var categories; - - var xAxisModel = ecModel.getComponent('xAxis', this.get('xAxisIndex')); - var yAxisModel = ecModel.getComponent('yAxis', this.get('yAxisIndex')); - var xAxisType = xAxisModel.get('type'); - var yAxisType = yAxisModel.get('type'); - var addOrdinal; - - // FIXME - // 考虑时间轴 - - if (xAxisType === 'category') { - option.layout = 'horizontal'; - categories = xAxisModel.getCategories(); - addOrdinal = true; - } - else if (yAxisType === 'category') { - option.layout = 'vertical'; - categories = yAxisModel.getCategories(); - addOrdinal = true; - } - else { - option.layout = option.layout || 'horizontal'; - } - - this._baseAxisDim = option.layout === 'horizontal' ? 'x' : 'y'; - - var data = option.data; - var dimensions = this.dimensions = ['base'].concat(this.valueDimensions); - completeDimensions(dimensions, data); - - var list = new List(dimensions, this); - list.initData(data, categories ? categories.slice() : null, function (dataItem, dimName, idx, dimIdx) { - var value = getItemValue(dataItem); - return addOrdinal ? (dimName === 'base' ? idx : value[dimIdx - 1]) : value[dimIdx]; - }); - - return list; - }, + barMaxWidth: null, + barMinWidth: null, + barWidth: null, - /** - * Used by Gird. - * @param {string} axisDim 'x' or 'y' - * @return {Array.} dimensions on the axis. - */ - coordDimToDataDim: function (axisDim) { - var dims = this.valueDimensions.slice(); - var baseDim = ['base']; - var map = { - horizontal: {x: baseDim, y: dims}, - vertical: {x: dims, y: baseDim} - }; - return map[this.get('layout')][axisDim]; + animationUpdate: false, + animationEasing: 'linear', + animationDuration: 300 }, /** - * @override - * @param {string|number} dataDim - * @return {string} coord dimension + * Get dimension for shadow in dataZoom + * @return {string} dimension name */ - dataDimToCoordDim: function (dataDim) { - var dim; - - zrUtil.each(['x', 'y'], function (coordDim, index) { - var dataDims = this.coordDimToDataDim(coordDim); - if (zrUtil.indexOf(dataDims, dataDim) >= 0) { - dim = coordDim; - } - }, this); - - return dim; + getShadowDim: function () { + return 'open'; }, /** - * If horizontal, base axis is x, otherwise y. * @override */ - getBaseAxis: function () { - var dim = this._baseAxisDim; - return this.ecModel.getComponent(dim + 'Axis', this.get(dim + 'AxisIndex')).axis; - } - }; - - var viewMixin = { - - init: function () { - /** - * Old data. - * @private - * @type {module:echarts/chart/helper/WhiskerBoxDraw} - */ - var whiskerBoxDraw = this._whiskerBoxDraw = new WhiskerBoxDraw( - this.getStyleUpdater() - ); - this.group.add(whiskerBoxDraw.group); - }, + formatTooltip: function (dataIndex, mutipleSeries) { + // It rearly use mutiple candlestick series in one cartesian, + // so only consider one series in this default tooltip. + var valueHTML = zrUtil.map(this.valueDimensions, function (dim) { + return encodeHTML(dim + ': ' + addCommas(this.getData().get(dim, dataIndex))); + }, this).join('
'); - render: function (seriesModel, ecModel, api) { - this._whiskerBoxDraw.updateData(seriesModel.getData()); + var html = []; + this.name != null && html.push(encodeHTML(this.name)); + valueHTML != null && html.push(valueHTML); + + return html.join('
'); }, - remove: function (ecModel) { - this._whiskerBoxDraw.remove(); + brushSelector: function (itemLayout, selectors) { + return selectors.rect(itemLayout.brushRect); } - }; - module.exports = { - seriesModelMixin: seriesModelMixin, - viewMixin: viewMixin - }; + }); + + zrUtil.mixin(CandlestickSeries, whiskerBoxCommon.seriesModelMixin, true); + + module.exports = CandlestickSeries; + /***/ }, -/* 250 */ +/* 270 */ /***/ function(module, exports, __webpack_require__) { - /** - * @module echarts/chart/helper/Symbol - */ + 'use strict'; var zrUtil = __webpack_require__(4); - var graphic = __webpack_require__(43); - var Path = __webpack_require__(45); + var ChartView = __webpack_require__(43); + var graphic = __webpack_require__(44); + var whiskerBoxCommon = __webpack_require__(263); - var WhiskerPath = Path.extend({ + var CandlestickView = ChartView.extend({ - type: 'whiskerInBox', + type: 'candlestick', - shape: {}, + getStyleUpdater: function () { + return updateStyle; + }, - buildPath: function (ctx, shape) { - for (var i in shape) { - if (shape.hasOwnProperty(i) && i.indexOf('ends') === 0) { - var pts = shape[i]; - ctx.moveTo(pts[0][0], pts[0][1]); - ctx.lineTo(pts[1][0], pts[1][1]); - } - } - } + dispose: zrUtil.noop }); - /** - * @constructor - * @alias {module:echarts/chart/helper/WhiskerBox} - * @param {module:echarts/data/List} data - * @param {number} idx - * @param {Function} styleUpdater - * @param {boolean} isInit - * @extends {module:zrender/graphic/Group} - */ - function WhiskerBox(data, idx, styleUpdater, isInit) { - graphic.Group.call(this); + zrUtil.mixin(CandlestickView, whiskerBoxCommon.viewMixin, true); - /** - * @type {number} - * @readOnly - */ - this.bodyIndex; + // Update common properties + var normalStyleAccessPath = ['itemStyle', 'normal']; + var emphasisStyleAccessPath = ['itemStyle', 'emphasis']; - /** - * @type {number} - * @readOnly - */ - this.whiskerIndex; + function updateStyle(itemGroup, data, idx) { + var itemModel = data.getItemModel(idx); + var normalItemStyleModel = itemModel.getModel(normalStyleAccessPath); + var color = data.getItemVisual(idx, 'color'); + var borderColor = data.getItemVisual(idx, 'borderColor') || color; - /** - * @type {Function} - */ - this.styleUpdater = styleUpdater; + // Color must be excluded. + // Because symbol provide setColor individually to set fill and stroke + var itemStyle = normalItemStyleModel.getItemStyle( + ['color', 'color0', 'borderColor', 'borderColor0'] + ); - this._createContent(data, idx, isInit); + var whiskerEl = itemGroup.childAt(itemGroup.whiskerIndex); + whiskerEl.useStyle(itemStyle); + whiskerEl.style.stroke = borderColor; - this.updateData(data, idx, isInit); + var bodyEl = itemGroup.childAt(itemGroup.bodyIndex); + bodyEl.useStyle(itemStyle); + bodyEl.style.fill = color; + bodyEl.style.stroke = borderColor; - /** - * Last series model. - * @type {module:echarts/model/Series} - */ - this._seriesModel; + var hoverStyle = itemModel.getModel(emphasisStyleAccessPath).getItemStyle(); + graphic.setHoverStyle(itemGroup, hoverStyle); } - var whiskerBoxProto = WhiskerBox.prototype; - whiskerBoxProto._createContent = function (data, idx, isInit) { - var itemLayout = data.getItemLayout(idx); - var constDim = itemLayout.chartLayout === 'horizontal' ? 1 : 0; - var count = 0; + module.exports = CandlestickView; - // Whisker element. - this.add(new graphic.Polygon({ - shape: { - points: isInit - ? transInit(itemLayout.bodyEnds, constDim, itemLayout) - : itemLayout.bodyEnds - }, - style: {strokeNoScale: true}, - z2: 100 - })); - this.bodyIndex = count++; - // Box element. - var whiskerEnds = zrUtil.map(itemLayout.whiskerEnds, function (ends) { - return isInit ? transInit(ends, constDim, itemLayout) : ends; + +/***/ }, +/* 271 */ +/***/ function(module, exports, __webpack_require__) { + + + + var zrUtil = __webpack_require__(4); + + module.exports = function (option) { + if (!option || !zrUtil.isArray(option.series)) { + return; + } + + // Translate 'k' to 'candlestick'. + zrUtil.each(option.series, function (seriesItem) { + if (zrUtil.isObject(seriesItem) && seriesItem.type === 'k') { + seriesItem.type = 'candlestick'; + } }); - this.add(new WhiskerPath({ - shape: makeWhiskerEndsShape(whiskerEnds), - style: {strokeNoScale: true}, - z2: 100 - })); - this.whiskerIndex = count++; }; - function transInit(points, dim, itemLayout) { - return zrUtil.map(points, function (point) { - point = point.slice(); - point[dim] = itemLayout.initBaseline; - return point; - }); - } - function makeWhiskerEndsShape(whiskerEnds) { - // zr animation only support 2-dim array. - var shape = {}; - zrUtil.each(whiskerEnds, function (ends, i) { - shape['ends' + i] = ends; - }); - return shape; - } - /** - * Update symbol properties - * @param {module:echarts/data/List} data - * @param {number} idx - */ - whiskerBoxProto.updateData = function (data, idx, isInit) { - var seriesModel = this._seriesModel = data.hostModel; - var itemLayout = data.getItemLayout(idx); - var updateMethod = graphic[isInit ? 'initProps' : 'updateProps']; - // this.childAt(this.bodyIndex).stopAnimation(true); - // this.childAt(this.whiskerIndex).stopAnimation(true); - updateMethod( - this.childAt(this.bodyIndex), - {shape: {points: itemLayout.bodyEnds}}, - seriesModel, idx - ); - updateMethod( - this.childAt(this.whiskerIndex), - {shape: makeWhiskerEndsShape(itemLayout.whiskerEnds)}, - seriesModel, idx - ); +/***/ }, +/* 272 */ +/***/ function(module, exports) { + + + + var positiveBorderColorQuery = ['itemStyle', 'normal', 'borderColor']; + var negativeBorderColorQuery = ['itemStyle', 'normal', 'borderColor0']; + var positiveColorQuery = ['itemStyle', 'normal', 'color']; + var negativeColorQuery = ['itemStyle', 'normal', 'color0']; + + module.exports = function (ecModel, api) { + + ecModel.eachRawSeriesByType('candlestick', function (seriesModel) { + + var data = seriesModel.getData(); + + data.setVisual({ + legendSymbol: 'roundRect' + }); + + // Only visible series has each data be visual encoded + if (!ecModel.isSeriesFiltered(seriesModel)) { + data.each(function (idx) { + var itemModel = data.getItemModel(idx); + var sign = data.getItemLayout(idx).sign; + + data.setItemVisual( + idx, + { + color: itemModel.get( + sign > 0 ? positiveColorQuery : negativeColorQuery + ), + borderColor: itemModel.get( + sign > 0 ? positiveBorderColorQuery : negativeBorderColorQuery + ) + } + ); + }); + } + }); - this.styleUpdater.call(null, this, data, idx); }; - zrUtil.inherits(WhiskerBox, graphic.Group); +/***/ }, +/* 273 */ +/***/ function(module, exports, __webpack_require__) { - /** - * @constructor - * @alias module:echarts/chart/helper/WhiskerBoxDraw - */ - function WhiskerBoxDraw(styleUpdater) { - this.group = new graphic.Group(); - this.styleUpdater = styleUpdater; - } + - var whiskerBoxDrawProto = WhiskerBoxDraw.prototype; + var retrieve = __webpack_require__(4).retrieve; + var parsePercent = __webpack_require__(7).parsePercent; - /** - * Update symbols draw by new data - * @param {module:echarts/data/List} data - */ - whiskerBoxDrawProto.updateData = function (data) { - var group = this.group; - var oldData = this._data; - var styleUpdater = this.styleUpdater; + module.exports = function (ecModel) { - data.diff(oldData) - .add(function (newIdx) { - if (data.hasValue(newIdx)) { - var symbolEl = new WhiskerBox(data, newIdx, styleUpdater, true); - data.setItemGraphicEl(newIdx, symbolEl); - group.add(symbolEl); - } - }) - .update(function (newIdx, oldIdx) { - var symbolEl = oldData.getItemGraphicEl(oldIdx); + ecModel.eachSeriesByType('candlestick', function (seriesModel) { - // Empty data - if (!data.hasValue(newIdx)) { - group.remove(symbolEl); - return; - } + var coordSys = seriesModel.coordinateSystem; + var data = seriesModel.getData(); + var dimensions = seriesModel.dimensions; + var chartLayout = seriesModel.get('layout'); - if (!symbolEl) { - symbolEl = new WhiskerBox(data, newIdx, styleUpdater); + var candleWidth = calculateCandleWidth(seriesModel, data); + + data.each(dimensions, function () { + var args = arguments; + var dimLen = dimensions.length; + var axisDimVal = args[0]; + var idx = args[dimLen]; + var variableDim = chartLayout === 'horizontal' ? 0 : 1; + var constDim = 1 - variableDim; + + var openVal = args[1]; + var closeVal = args[2]; + var lowestVal = args[3]; + var highestVal = args[4]; + + var ocLow = Math.min(openVal, closeVal); + var ocHigh = Math.max(openVal, closeVal); + + var ocLowPoint = getPoint(ocLow); + var ocHighPoint = getPoint(ocHigh); + var lowestPoint = getPoint(lowestVal); + var highestPoint = getPoint(highestVal); + + var whiskerEnds = [ + [highestPoint, ocHighPoint], + [lowestPoint, ocLowPoint] + ]; + + var bodyEnds = []; + addBodyEnd(ocHighPoint, 0); + addBodyEnd(ocLowPoint, 1); + + data.setItemLayout(idx, { + chartLayout: chartLayout, + sign: openVal > closeVal ? -1 : openVal < closeVal ? 1 : 0, + initBaseline: openVal > closeVal + ? ocHighPoint[constDim] : ocLowPoint[constDim], // open point. + bodyEnds: bodyEnds, + whiskerEnds: whiskerEnds, + brushRect: makeBrushRect() + }); + + function getPoint(val) { + var p = []; + p[variableDim] = axisDimVal; + p[constDim] = val; + return (isNaN(axisDimVal) || isNaN(val)) + ? [NaN, NaN] + : coordSys.dataToPoint(p); } - else { - symbolEl.updateData(data, newIdx); + + function addBodyEnd(point, start) { + var point1 = point.slice(); + var point2 = point.slice(); + point1[variableDim] += candleWidth / 2; + point2[variableDim] -= candleWidth / 2; + start + ? bodyEnds.push(point1, point2) + : bodyEnds.push(point2, point1); } - // Add back - group.add(symbolEl); + function makeBrushRect() { + var pmin = getPoint(Math.min(openVal, closeVal, lowestVal, highestVal)); + var pmax = getPoint(Math.max(openVal, closeVal, lowestVal, highestVal)); - data.setItemGraphicEl(newIdx, symbolEl); - }) - .remove(function (oldIdx) { - var el = oldData.getItemGraphicEl(oldIdx); - el && group.remove(el); - }) - .execute(); + pmin[variableDim] -= candleWidth / 2; + pmax[variableDim] -= candleWidth / 2; - this._data = data; - }; + return { + x: pmin[0], + y: pmin[1], + width: constDim ? candleWidth : pmax[0] - pmin[0], + height: constDim ? pmax[1] - pmin[1] : candleWidth + }; + } - /** - * Remove symbols. - * @param {module:echarts/data/List} data - */ - whiskerBoxDrawProto.remove = function () { - var group = this.group; - var data = this._data; - this._data = null; - data && data.eachItemGraphicEl(function (el) { - el && group.remove(el); + }, true); }); }; - module.exports = WhiskerBoxDraw; + function calculateCandleWidth(seriesModel, data) { + var baseAxis = seriesModel.getBaseAxis(); + var extent; + + var bandWidth = baseAxis.type === 'category' + ? baseAxis.getBandWidth() + : ( + extent = baseAxis.getExtent(), + Math.abs(extent[1] - extent[0]) / data.count() + ); + + var barMaxWidth = parsePercent( + retrieve(seriesModel.get('barMaxWidth'), bandWidth), + bandWidth + ); + var barMinWidth = parsePercent( + retrieve(seriesModel.get('barMinWidth'), 1), + bandWidth + ); + var barWidth = seriesModel.get('barWidth'); + return barWidth != null + ? parsePercent(barWidth, bandWidth) + // Put max outer to ensure bar visible in spite of overlap. + : Math.max(Math.min(bandWidth / 2, barMaxWidth), barMinWidth); + } + /***/ }, -/* 251 */ +/* 274 */ +/***/ function(module, exports, __webpack_require__) { + + + + var zrUtil = __webpack_require__(4); + var echarts = __webpack_require__(1); + + __webpack_require__(275); + __webpack_require__(276); + + echarts.registerVisual(zrUtil.curry( + __webpack_require__(119), 'effectScatter', 'circle', null + )); + echarts.registerLayout(zrUtil.curry( + __webpack_require__(120), 'effectScatter' + )); + + +/***/ }, +/* 275 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; - var zrUtil = __webpack_require__(4); - var ChartView = __webpack_require__(42); - var graphic = __webpack_require__(43); - var whiskerBoxCommon = __webpack_require__(249); + var createListFromArray = __webpack_require__(102); + var SeriesModel = __webpack_require__(28); - var BoxplotView = ChartView.extend({ + module.exports = SeriesModel.extend({ - type: 'boxplot', + type: 'series.effectScatter', - getStyleUpdater: function () { - return updateStyle; + dependencies: ['grid', 'polar'], + + getInitialData: function (option, ecModel) { + var list = createListFromArray(option.data, this, ecModel); + return list; }, - dispose: zrUtil.noop - }); + brushSelector: 'point', - zrUtil.mixin(BoxplotView, whiskerBoxCommon.viewMixin, true); + defaultOption: { + coordinateSystem: 'cartesian2d', + zlevel: 0, + z: 2, + legendHoverLink: true, - // Update common properties - var normalStyleAccessPath = ['itemStyle', 'normal']; - var emphasisStyleAccessPath = ['itemStyle', 'emphasis']; + effectType: 'ripple', - function updateStyle(itemGroup, data, idx) { - var itemModel = data.getItemModel(idx); - var normalItemStyleModel = itemModel.getModel(normalStyleAccessPath); - var borderColor = data.getItemVisual(idx, 'color'); + progressive: 0, - // Exclude borderColor. - var itemStyle = normalItemStyleModel.getItemStyle(['borderColor']); + // When to show the effect, option: 'render'|'emphasis' + showEffectOn: 'render', - var whiskerEl = itemGroup.childAt(itemGroup.whiskerIndex); - whiskerEl.style.set(itemStyle); - whiskerEl.style.stroke = borderColor; - whiskerEl.dirty(); + // Ripple effect config + rippleEffect: { + period: 4, + // Scale of ripple + scale: 2.5, + // Brush type can be fill or stroke + brushType: 'fill' + }, - var bodyEl = itemGroup.childAt(itemGroup.bodyIndex); - bodyEl.style.set(itemStyle); - bodyEl.style.stroke = borderColor; - bodyEl.dirty(); + // Cartesian coordinate system + // xAxisIndex: 0, + // yAxisIndex: 0, - var hoverStyle = itemModel.getModel(emphasisStyleAccessPath).getItemStyle(); - graphic.setHoverStyle(itemGroup, hoverStyle); - } + // Polar coordinate system + // polarIndex: 0, - module.exports = BoxplotView; + // Geo coordinate system + // geoIndex: 0, + + // symbol: null, // 图形类型 + symbolSize: 10 // 图形大小,半宽(半径)参数,当图形为方向或菱形则总宽度为symbolSize * 2 + // symbolRotate: null, // 图形旋转控制 + + // large: false, + // Available when large is true + // largeThreshold: 2000, + + // itemStyle: { + // normal: { + // opacity: 1 + // } + // } + } + }); /***/ }, -/* 252 */ -/***/ function(module, exports) { +/* 276 */ +/***/ function(module, exports, __webpack_require__) { - var borderColorQuery = ['itemStyle', 'normal', 'borderColor']; + var SymbolDraw = __webpack_require__(115); + var EffectSymbol = __webpack_require__(277); - module.exports = function (ecModel, api) { + __webpack_require__(1).extendChartView({ - var globalColors = ecModel.get('color'); + type: 'effectScatter', - ecModel.eachRawSeriesByType('boxplot', function (seriesModel) { + init: function () { + this._symbolDraw = new SymbolDraw(EffectSymbol); + }, - var defaulColor = globalColors[seriesModel.seriesIndex % globalColors.length]; + render: function (seriesModel, ecModel, api) { var data = seriesModel.getData(); + var effectSymbolDraw = this._symbolDraw; + effectSymbolDraw.updateData(data); + this.group.add(effectSymbolDraw.group); + }, - data.setVisual({ - legendSymbol: 'roundRect', - // Use name 'color' but not 'borderColor' for legend usage and - // visual coding from other component like dataRange. - color: seriesModel.get(borderColorQuery) || defaulColor - }); + updateLayout: function () { + this._symbolDraw.updateLayout(); + }, - // Only visible series has each data be visual encoded - if (!ecModel.isSeriesFiltered(seriesModel)) { - data.each(function (idx) { - var itemModel = data.getItemModel(idx); - data.setItemVisual( - idx, - {color: itemModel.get(borderColorQuery, true)} - ); - }); - } - }); + remove: function (ecModel, api) { + this._symbolDraw && this._symbolDraw.remove(api); + }, - }; + dispose: function () {} + }); /***/ }, -/* 253 */ +/* 277 */ /***/ function(module, exports, __webpack_require__) { - + /** + * Symbol with ripple effect + * @module echarts/chart/helper/EffectSymbol + */ + var zrUtil = __webpack_require__(4); + var symbolUtil = __webpack_require__(104); + var graphic = __webpack_require__(44); var numberUtil = __webpack_require__(7); - var parsePercent = numberUtil.parsePercent; - var each = zrUtil.each; + var Symbol = __webpack_require__(116); + var Group = graphic.Group; - module.exports = function (ecModel) { + var EFFECT_RIPPLE_NUMBER = 3; - var groupResult = groupSeriesByAxis(ecModel); + function normalizeSymbolSize(symbolSize) { + if (!zrUtil.isArray(symbolSize)) { + symbolSize = [+symbolSize, +symbolSize]; + } + return symbolSize; + } - each(groupResult, function (groupItem) { - var seriesModels = groupItem.seriesModels; + function updateRipplePath(rippleGroup, effectCfg) { + rippleGroup.eachChild(function (ripplePath) { + ripplePath.attr({ + z: effectCfg.z, + zlevel: effectCfg.zlevel, + style: { + stroke: effectCfg.brushType === 'stroke' ? effectCfg.color : null, + fill: effectCfg.brushType === 'fill' ? effectCfg.color : null + } + }); + }); + } + /** + * @constructor + * @param {module:echarts/data/List} data + * @param {number} idx + * @extends {module:zrender/graphic/Group} + */ + function EffectSymbol(data, idx) { + Group.call(this); - if (!seriesModels.length) { - return; - } + var symbol = new Symbol(data, idx); + var rippleGroup = new Group(); + this.add(symbol); + this.add(rippleGroup); - calculateBase(groupItem); + rippleGroup.beforeUpdate = function () { + this.attr(symbol.getScale()); + }; + this.updateData(data, idx); + } - each(seriesModels, function (seriesModel, idx) { - layoutSingleSeries( - seriesModel, - groupItem.boxOffsetList[idx], - groupItem.boxWidthList[idx] - ); + var effectSymbolProto = EffectSymbol.prototype; + + effectSymbolProto.stopEffectAnimation = function () { + this.childAt(1).removeAll(); + }; + + effectSymbolProto.startEffectAnimation = function (effectCfg) { + var symbolType = effectCfg.symbolType; + var color = effectCfg.color; + var rippleGroup = this.childAt(1); + + for (var i = 0; i < EFFECT_RIPPLE_NUMBER; i++) { + // var ripplePath = symbolUtil.createSymbol( + // symbolType, -0.5, -0.5, 1, 1, color + // ); + // If width/height are set too small (e.g., set to 1) on ios10 + // and macOS Sierra, a circle stroke become a rect, no matter what + // the scale is set. So we set width/height as 2. See #4136. + var ripplePath = symbolUtil.createSymbol( + symbolType, -1, -1, 2, 2, color + ); + ripplePath.attr({ + style: { + strokeNoScale: true + }, + z2: 99, + silent: true, + scale: [0.5, 0.5] }); - }); + + var delay = -i / EFFECT_RIPPLE_NUMBER * effectCfg.period + effectCfg.effectOffset; + // TODO Configurable effectCfg.period + ripplePath.animate('', true) + .when(effectCfg.period, { + scale: [effectCfg.rippleScale / 2, effectCfg.rippleScale / 2] + }) + .delay(delay) + .start(); + ripplePath.animateStyle(true) + .when(effectCfg.period, { + opacity: 0 + }) + .delay(delay) + .start(); + + rippleGroup.add(ripplePath); + } + + updateRipplePath(rippleGroup, effectCfg); }; /** - * Group series by axis. + * Update effect symbol */ - function groupSeriesByAxis(ecModel) { - var result = []; - var axisList = []; - - ecModel.eachSeriesByType('boxplot', function (seriesModel) { - var baseAxis = seriesModel.getBaseAxis(); - var idx = zrUtil.indexOf(axisList, baseAxis); + effectSymbolProto.updateEffectAnimation = function (effectCfg) { + var oldEffectCfg = this._effectCfg; + var rippleGroup = this.childAt(1); - if (idx < 0) { - idx = axisList.length; - axisList[idx] = baseAxis; - result[idx] = {axis: baseAxis, seriesModels: []}; + // Must reinitialize effect if following configuration changed + var DIFFICULT_PROPS = ['symbolType', 'period', 'rippleScale']; + for (var i = 0; i < DIFFICULT_PROPS; i++) { + var propName = DIFFICULT_PROPS[i]; + if (oldEffectCfg[propName] !== effectCfg[propName]) { + this.stopEffectAnimation(); + this.startEffectAnimation(effectCfg); + return; } + } - result[idx].seriesModels.push(seriesModel); - }); - - return result; - } + updateRipplePath(rippleGroup, effectCfg); + }; /** - * Calculate offset and box width for each series. + * Highlight symbol */ - function calculateBase(groupItem) { - var extent; - var baseAxis = groupItem.axis; - var seriesModels = groupItem.seriesModels; - var seriesCount = seriesModels.length; + effectSymbolProto.highlight = function () { + this.trigger('emphasis'); + }; - var boxWidthList = groupItem.boxWidthList = []; - var boxOffsetList = groupItem.boxOffsetList = []; - var boundList = []; + /** + * Downplay symbol + */ + effectSymbolProto.downplay = function () { + this.trigger('normal'); + }; - var bandWidth; - if (baseAxis.type === 'category') { - bandWidth = baseAxis.getBandWidth(); - } - else { - var maxDataCount = 0; - each(seriesModels, function (seriesModel) { - maxDataCount = Math.max(maxDataCount, seriesModel.getData().count()); - }); - extent = baseAxis.getExtent(), - Math.abs(extent[1] - extent[0]) / maxDataCount; - } + /** + * Update symbol properties + * @param {module:echarts/data/List} data + * @param {number} idx + */ + effectSymbolProto.updateData = function (data, idx) { + var seriesModel = data.hostModel; - each(seriesModels, function (seriesModel) { - var boxWidthBound = seriesModel.get('boxWidth'); - if (!zrUtil.isArray(boxWidthBound)) { - boxWidthBound = [boxWidthBound, boxWidthBound]; - } - boundList.push([ - parsePercent(boxWidthBound[0], bandWidth) || 0, - parsePercent(boxWidthBound[1], bandWidth) || 0 - ]); - }); + this.childAt(0).updateData(data, idx); - var availableWidth = bandWidth * 0.8 - 2; - var boxGap = availableWidth / seriesCount * 0.3; - var boxWidth = (availableWidth - boxGap * (seriesCount - 1)) / seriesCount; - var base = boxWidth / 2 - availableWidth / 2; + var rippleGroup = this.childAt(1); + var itemModel = data.getItemModel(idx); + var symbolType = data.getItemVisual(idx, 'symbol'); + var symbolSize = normalizeSymbolSize(data.getItemVisual(idx, 'symbolSize')); + var color = data.getItemVisual(idx, 'color'); - each(seriesModels, function (seriesModel, idx) { - boxOffsetList.push(base); - base += boxGap + boxWidth; + rippleGroup.attr('scale', symbolSize); - boxWidthList.push( - Math.min(Math.max(boxWidth, boundList[idx][0]), boundList[idx][1]) - ); + rippleGroup.traverse(function (ripplePath) { + ripplePath.attr({ + fill: color + }); }); - } - /** - * Calculate points location for each series. - */ - function layoutSingleSeries(seriesModel, offset, boxWidth) { - var coordSys = seriesModel.coordinateSystem; - var data = seriesModel.getData(); - var dimensions = seriesModel.dimensions; - var chartLayout = seriesModel.get('layout'); - var halfWidth = boxWidth / 2; + var symbolOffset = itemModel.getShallow('symbolOffset'); + if (symbolOffset) { + var pos = rippleGroup.position; + pos[0] = numberUtil.parsePercent(symbolOffset[0], symbolSize[0]); + pos[1] = numberUtil.parsePercent(symbolOffset[1], symbolSize[1]); + } + rippleGroup.rotation = (itemModel.getShallow('symbolRotate') || 0) * Math.PI / 180 || 0; - data.each(dimensions, function () { - var args = arguments; - var dimLen = dimensions.length; - var axisDimVal = args[0]; - var idx = args[dimLen]; - var variableDim = chartLayout === 'horizontal' ? 0 : 1; - var constDim = 1 - variableDim; + var effectCfg = {}; - var median = getPoint(args[3]); - var end1 = getPoint(args[1]); - var end5 = getPoint(args[5]); - var whiskerEnds = [ - [end1, getPoint(args[2])], - [end5, getPoint(args[4])] - ]; - layEndLine(end1); - layEndLine(end5); - layEndLine(median); + effectCfg.showEffectOn = seriesModel.get('showEffectOn'); + effectCfg.rippleScale = itemModel.get('rippleEffect.scale'); + effectCfg.brushType = itemModel.get('rippleEffect.brushType'); + effectCfg.period = itemModel.get('rippleEffect.period') * 1000; + effectCfg.effectOffset = idx / data.count(); + effectCfg.z = itemModel.getShallow('z') || 0; + effectCfg.zlevel = itemModel.getShallow('zlevel') || 0; + effectCfg.symbolType = symbolType; + effectCfg.color = color; - var bodyEnds = []; - addBodyEnd(whiskerEnds[0][1], 0); - addBodyEnd(whiskerEnds[1][1], 1); + this.off('mouseover').off('mouseout').off('emphasis').off('normal'); - data.setItemLayout(idx, { - chartLayout: chartLayout, - initBaseline: median[constDim], - median: median, - bodyEnds: bodyEnds, - whiskerEnds: whiskerEnds - }); + if (effectCfg.showEffectOn === 'render') { + this._effectCfg + ? this.updateEffectAnimation(effectCfg) + : this.startEffectAnimation(effectCfg); - function getPoint(val) { - var p = []; - p[variableDim] = axisDimVal; - p[constDim] = val; - var point; - if (isNaN(axisDimVal) || isNaN(val)) { - point = [NaN, NaN]; + this._effectCfg = effectCfg; + } + else { + // Not keep old effect config + this._effectCfg = null; + + this.stopEffectAnimation(); + var symbol = this.childAt(0); + var onEmphasis = function () { + symbol.trigger('emphasis'); + if (effectCfg.showEffectOn !== 'render') { + this.startEffectAnimation(effectCfg); } - else { - point = coordSys.dataToPoint(p); - point[variableDim] += offset; + }; + var onNormal = function () { + symbol.trigger('normal'); + if (effectCfg.showEffectOn !== 'render') { + this.stopEffectAnimation(); } - return point; - } + }; + this.on('mouseover', onEmphasis, this) + .on('mouseout', onNormal, this) + .on('emphasis', onEmphasis, this) + .on('normal', onNormal, this); + } - function addBodyEnd(point, start) { - var point1 = point.slice(); - var point2 = point.slice(); - point1[variableDim] += halfWidth; - point2[variableDim] -= halfWidth; - start - ? bodyEnds.push(point1, point2) - : bodyEnds.push(point2, point1); - } + this._effectCfg = effectCfg; + }; - function layEndLine(endCenter) { - var line = [endCenter.slice(), endCenter.slice()]; - line[0][variableDim] -= halfWidth; - line[1][variableDim] += halfWidth; - whiskerEnds.push(line); - } - }); - } + effectSymbolProto.fadeOut = function (cb) { + this.off('mouseover').off('mouseout').off('emphasis').off('normal'); + cb && cb(); + }; + + zrUtil.inherits(EffectSymbol, Group); + module.exports = EffectSymbol; /***/ }, -/* 254 */ +/* 278 */ /***/ function(module, exports, __webpack_require__) { - var echarts = __webpack_require__(1); - - __webpack_require__(255); - __webpack_require__(256); + __webpack_require__(279); + __webpack_require__(280); - echarts.registerPreprocessor( - __webpack_require__(257) + var echarts = __webpack_require__(1); + echarts.registerLayout( + __webpack_require__(285) + ); + echarts.registerVisual( + __webpack_require__(286) ); - - echarts.registerVisual(__webpack_require__(258)); - echarts.registerLayout(__webpack_require__(259)); - /***/ }, -/* 255 */ +/* 279 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; - var zrUtil = __webpack_require__(4); var SeriesModel = __webpack_require__(28); - var whiskerBoxCommon = __webpack_require__(249); + var List = __webpack_require__(98); + var zrUtil = __webpack_require__(4); var formatUtil = __webpack_require__(6); - var encodeHTML = formatUtil.encodeHTML; - var addCommas = formatUtil.addCommas; + var CoordinateSystem = __webpack_require__(26); - var CandlestickSeries = SeriesModel.extend({ + // Convert [ [{coord: []}, {coord: []}] ] + // to [ { coords: [[]] } ] + function preprocessOption (seriesOpt) { + var data = seriesOpt.data; + if (data && data[0] && data[0][0] && data[0][0].coord) { + if (true) { + console.warn('Lines data configuration has been changed to' + + ' { coords:[[1,2],[2,3]] }'); + } + seriesOpt.data = zrUtil.map(data, function (itemOpt) { + var coords = [ + itemOpt[0].coord, itemOpt[1].coord + ]; + var target = { + coords: coords + }; + if (itemOpt[0].name) { + target.fromName = itemOpt[0].name; + } + if (itemOpt[1].name) { + target.toName = itemOpt[1].name; + } + return zrUtil.mergeAll([target, itemOpt[0], itemOpt[1]]); + }); + } + } - type: 'series.candlestick', + var LinesSeries = SeriesModel.extend({ - dependencies: ['xAxis', 'yAxis', 'grid'], + type: 'series.lines', - /** - * @readOnly - */ - valueDimensions: ['open', 'close', 'lowest', 'highest'], + dependencies: ['grid', 'polar'], - /** - * @type {Array.} - * @readOnly - */ - dimensions: null, + visualColorAccessPath: 'lineStyle.normal.color', + + init: function (option) { + // Not using preprocessor because mergeOption may not have series.type + preprocessOption(option); + + LinesSeries.superApply(this, 'init', arguments); + }, + + mergeOption: function (option) { + preprocessOption(option); + + LinesSeries.superApply(this, 'mergeOption', arguments); + }, + + getInitialData: function (option, ecModel) { + if (true) { + var CoordSys = CoordinateSystem.get(option.coordinateSystem); + if (!CoordSys) { + throw new Error('Unkown coordinate system ' + option.coordinateSystem); + } + } + + var lineData = new List(['value'], this); + lineData.hasItemOption = false; + lineData.initData(option.data, [], function (dataItem, dimName, dataIndex, dimIndex) { + // dataItem is simply coords + if (dataItem instanceof Array) { + return NaN; + } + else { + lineData.hasItemOption = true; + var value = dataItem.value; + if (value != null) { + return value instanceof Array ? value[dimIndex] : value; + } + } + }); + + return lineData; + }, + + formatTooltip: function (dataIndex) { + var data = this.getData(); + var itemModel = data.getItemModel(dataIndex); + var name = itemModel.get('name'); + if (name) { + return name; + } + var fromName = itemModel.get('fromName'); + var toName = itemModel.get('toName'); + var html = []; + fromName != null && html.push(fromName); + toName != null && html.push(toName); + + return formatUtil.encodeHTML(html.join(' > ')); + }, - /** - * @override - */ defaultOption: { - zlevel: 0, // 一级层叠 - z: 2, // 二级层叠 - coordinateSystem: 'cartesian2d', + coordinateSystem: 'geo', + zlevel: 0, + z: 2, legendHoverLink: true, hoverAnimation: true, + // Cartesian coordinate system + xAxisIndex: 0, + yAxisIndex: 0, - // xAxisIndex: 0, - // yAxisIndex: 0, + symbol: ['none', 'none'], + symbolSize: [10, 10], + // Geo coordinate system + geoIndex: 0, + + effect: { + show: false, + period: 4, + // Animation delay. support callback + // delay: 0, + // If move with constant speed px/sec + // period will be ignored if this property is > 0, + constantSpeed: 0, + symbol: 'circle', + symbolSize: 3, + loop: true, + // Length of trail, 0 - 1 + trailLength: 0.2 + // Same with lineStyle.normal.color + // color + }, - layout: null, // 'horizontal' or 'vertical' + large: false, + // Available when large is true + largeThreshold: 2000, - itemStyle: { + // If lines are polyline + // polyline not support curveness, label, animation + polyline: false, + + label: { normal: { - color: '#c23531', // 阳线 positive - color0: '#314656', // 阴线 negative '#c23531', '#314656' - borderWidth: 1, - // FIXME - // ec2中使用的是lineStyle.color 和 lineStyle.color0 - borderColor: '#c23531', - borderColor0: '#314656' - }, - emphasis: { - borderWidth: 2 + show: false, + position: 'end' + // distance: 5, + // formatter: 标签文本格式器,同Tooltip.formatter,不支持异步回调 } }, - barMaxWidth: null, - barMinWidth: null, - barWidth: null, + lineStyle: { + normal: { + opacity: 0.5 + } + } + } + }); - animationUpdate: false, - animationEasing: 'linear', - animationDuration: 300 - }, - /** - * Get dimension for shadow in dataZoom - * @return {string} dimension name - */ - getShadowDim: function () { - return 'open'; - }, +/***/ }, +/* 280 */ +/***/ function(module, exports, __webpack_require__) { - /** - * @override - */ - formatTooltip: function (dataIndex, mutipleSeries) { - // It rearly use mutiple candlestick series in one cartesian, - // so only consider one series in this default tooltip. - var valueHTML = zrUtil.map(this.valueDimensions, function (dim) { - return encodeHTML(dim + ': ' + addCommas(this.getData().get(dim, dataIndex))); - }, this).join('
'); + - var html = []; - this.name != null && html.push(encodeHTML(this.name)); - valueHTML != null && html.push(valueHTML); + var LineDraw = __webpack_require__(216); + var EffectLine = __webpack_require__(281); + var Line = __webpack_require__(217); + var Polyline = __webpack_require__(282); + var EffectPolyline = __webpack_require__(283); + var LargeLineDraw = __webpack_require__(284); - return html.join('
'); - }, + __webpack_require__(1).extendChartView({ - brushSelector: function (itemLayout, selectors) { - return selectors.rect(itemLayout.brushRect); - } + type: 'lines', - }); + init: function () {}, - zrUtil.mixin(CandlestickSeries, whiskerBoxCommon.seriesModelMixin, true); + render: function (seriesModel, ecModel, api) { + var data = seriesModel.getData(); + var lineDraw = this._lineDraw; - module.exports = CandlestickSeries; + var hasEffect = seriesModel.get('effect.show'); + var isPolyline = seriesModel.get('polyline'); + var isLarge = seriesModel.get('large') && data.count() >= seriesModel.get('largeThreshold'); + if (true) { + if (hasEffect && isLarge) { + console.warn('Large lines not support effect'); + } + } + if (hasEffect !== this._hasEffet || isPolyline !== this._isPolyline || isLarge !== this._isLarge) { + if (lineDraw) { + lineDraw.remove(); + } + lineDraw = this._lineDraw = isLarge + ? new LargeLineDraw() + : new LineDraw( + isPolyline + ? (hasEffect ? EffectPolyline : Polyline) + : (hasEffect ? EffectLine : Line) + ); + this._hasEffet = hasEffect; + this._isPolyline = isPolyline; + this._isLarge = isLarge; + } + var zlevel = seriesModel.get('zlevel'); + var trailLength = seriesModel.get('effect.trailLength'); -/***/ }, -/* 256 */ -/***/ function(module, exports, __webpack_require__) { + var zr = api.getZr(); + // Avoid the drag cause ghost shadow + // FIXME Better way ? + zr.painter.getLayer(zlevel).clear(true); + // Config layer with motion blur + if (this._lastZlevel != null) { + zr.configLayer(this._lastZlevel, { + motionBlur: false + }); + } + if (hasEffect && trailLength) { + if (true) { + var notInIndividual = false; + ecModel.eachSeries(function (otherSeriesModel) { + if (otherSeriesModel !== seriesModel && otherSeriesModel.get('zlevel') === zlevel) { + notInIndividual = true; + } + }); + notInIndividual && console.warn('Lines with trail effect should have an individual zlevel'); + } - 'use strict'; + zr.configLayer(zlevel, { + motionBlur: true, + lastFrameAlpha: Math.max(Math.min(trailLength / 10 + 0.9, 1), 0) + }); + } + this.group.add(lineDraw.group); - var zrUtil = __webpack_require__(4); - var ChartView = __webpack_require__(42); - var graphic = __webpack_require__(43); - var whiskerBoxCommon = __webpack_require__(249); + lineDraw.updateData(data); - var CandlestickView = ChartView.extend({ + this._lastZlevel = zlevel; + }, - type: 'candlestick', + updateLayout: function (seriesModel, ecModel, api) { + this._lineDraw.updateLayout(seriesModel); + // Not use motion when dragging or zooming + var zr = api.getZr(); + zr.painter.getLayer(this._lastZlevel).clear(true); + }, - getStyleUpdater: function () { - return updateStyle; + remove: function (ecModel, api) { + this._lineDraw && this._lineDraw.remove(api, true); }, - dispose: zrUtil.noop + dispose: function () {} }); - zrUtil.mixin(CandlestickView, whiskerBoxCommon.viewMixin, true); - // Update common properties - var normalStyleAccessPath = ['itemStyle', 'normal']; - var emphasisStyleAccessPath = ['itemStyle', 'emphasis']; +/***/ }, +/* 281 */ +/***/ function(module, exports, __webpack_require__) { - function updateStyle(itemGroup, data, idx) { - var itemModel = data.getItemModel(idx); - var normalItemStyleModel = itemModel.getModel(normalStyleAccessPath); - var color = data.getItemVisual(idx, 'color'); - var borderColor = data.getItemVisual(idx, 'borderColor') || color; + /** + * Provide effect for line + * @module echarts/chart/helper/EffectLine + */ - // Color must be excluded. - // Because symbol provide setColor individually to set fill and stroke - var itemStyle = normalItemStyleModel.getItemStyle( - ['color', 'color0', 'borderColor', 'borderColor0'] - ); - var whiskerEl = itemGroup.childAt(itemGroup.whiskerIndex); - whiskerEl.useStyle(itemStyle); - whiskerEl.style.stroke = borderColor; + var graphic = __webpack_require__(44); + var Line = __webpack_require__(217); + var zrUtil = __webpack_require__(4); + var symbolUtil = __webpack_require__(104); + var vec2 = __webpack_require__(10); - var bodyEl = itemGroup.childAt(itemGroup.bodyIndex); - bodyEl.useStyle(itemStyle); - bodyEl.style.fill = color; - bodyEl.style.stroke = borderColor; + var curveUtil = __webpack_require__(51); - var hoverStyle = itemModel.getModel(emphasisStyleAccessPath).getItemStyle(); - graphic.setHoverStyle(itemGroup, hoverStyle); - } + /** + * @constructor + * @extends {module:zrender/graphic/Group} + * @alias {module:echarts/chart/helper/Line} + */ + function EffectLine(lineData, idx, seriesScope) { + graphic.Group.call(this); + this.add(this.createLine(lineData, idx, seriesScope)); - module.exports = CandlestickView; + this._updateEffectSymbol(lineData, idx); + } + var effectLineProto = EffectLine.prototype; + effectLineProto.createLine = function (lineData, idx, seriesScope) { + return new Line(lineData, idx, seriesScope); + }; -/***/ }, -/* 257 */ -/***/ function(module, exports, __webpack_require__) { + effectLineProto._updateEffectSymbol = function (lineData, idx) { + var itemModel = lineData.getItemModel(idx); + var effectModel = itemModel.getModel('effect'); + var size = effectModel.get('symbolSize'); + var symbolType = effectModel.get('symbol'); + if (!zrUtil.isArray(size)) { + size = [size, size]; + } + var color = effectModel.get('color') || lineData.getItemVisual(idx, 'color'); + var symbol = this.childAt(1); - + if (this._symbolType !== symbolType) { + // Remove previous + this.remove(symbol); - var zrUtil = __webpack_require__(4); + symbol = symbolUtil.createSymbol( + symbolType, -0.5, -0.5, 1, 1, color + ); + symbol.z2 = 100; + symbol.culling = true; - module.exports = function (option) { - if (!option || !zrUtil.isArray(option.series)) { + this.add(symbol); + } + + // Symbol may be removed if loop is false + if (!symbol) { return; } - // Translate 'k' to 'candlestick'. - zrUtil.each(option.series, function (seriesItem) { - if (zrUtil.isObject(seriesItem) && seriesItem.type === 'k') { - seriesItem.type = 'candlestick'; - } - }); + // Shadow color is same with color in default + symbol.setStyle('shadowColor', color); + symbol.setStyle(effectModel.getItemStyle(['color'])); + + symbol.attr('scale', size); + + symbol.setColor(color); + symbol.attr('scale', size); + + this._symbolType = symbolType; + + this._updateEffectAnimation(lineData, effectModel, idx); }; + effectLineProto._updateEffectAnimation = function (lineData, effectModel, idx) { + var symbol = this.childAt(1); + if (!symbol) { + return; + } -/***/ }, -/* 258 */ -/***/ function(module, exports) { + var self = this; - + var points = lineData.getItemLayout(idx); - var positiveBorderColorQuery = ['itemStyle', 'normal', 'borderColor']; - var negativeBorderColorQuery = ['itemStyle', 'normal', 'borderColor0']; - var positiveColorQuery = ['itemStyle', 'normal', 'color']; - var negativeColorQuery = ['itemStyle', 'normal', 'color0']; + var period = effectModel.get('period') * 1000; + var loop = effectModel.get('loop'); + var constantSpeed = effectModel.get('constantSpeed'); + var delayExpr = zrUtil.retrieve(effectModel.get('delay'), function (idx) { + return idx / lineData.count() * period / 3; + }); + var isDelayFunc = typeof delayExpr === 'function'; - module.exports = function (ecModel, api) { + // Ignore when updating + symbol.ignore = true; - ecModel.eachRawSeriesByType('candlestick', function (seriesModel) { + this.updateAnimationPoints(symbol, points); - var data = seriesModel.getData(); + if (constantSpeed > 0) { + period = this.getLineLength(symbol) / constantSpeed * 1000; + } - data.setVisual({ - legendSymbol: 'roundRect' - }); + if (period !== this._period || loop !== this._loop) { - // Only visible series has each data be visual encoded - if (!ecModel.isSeriesFiltered(seriesModel)) { - data.each(function (idx) { - var itemModel = data.getItemModel(idx); - var sign = data.getItemLayout(idx).sign; + symbol.stopAnimation(); - data.setItemVisual( - idx, - { - color: itemModel.get( - sign > 0 ? positiveColorQuery : negativeColorQuery - ), - borderColor: itemModel.get( - sign > 0 ? positiveBorderColorQuery : negativeBorderColorQuery - ) - } - ); + var delay = delayExpr; + if (isDelayFunc) { + delay = delayExpr(idx); + } + if (symbol.__t > 0) { + delay = -period * symbol.__t; + } + symbol.__t = 0; + var animator = symbol.animate('', loop) + .when(period, { + __t: 1 + }) + .delay(delay) + .during(function () { + self.updateSymbolPosition(symbol); + }); + if (!loop) { + animator.done(function () { + self.remove(symbol); }); } - }); + animator.start(); + } + this._period = period; + this._loop = loop; }; + effectLineProto.getLineLength = function (symbol) { + // Not so accurate + return (vec2.dist(symbol.__p1, symbol.__cp1) + + vec2.dist(symbol.__cp1, symbol.__p2)); + }; -/***/ }, -/* 259 */ -/***/ function(module, exports, __webpack_require__) { + effectLineProto.updateAnimationPoints = function (symbol, points) { + symbol.__p1 = points[0]; + symbol.__p2 = points[1]; + symbol.__cp1 = points[2] || [ + (points[0][0] + points[1][0]) / 2, + (points[0][1] + points[1][1]) / 2 + ]; + }; - + effectLineProto.updateData = function (lineData, idx, seriesScope) { + this.childAt(0).updateData(lineData, idx, seriesScope); + this._updateEffectSymbol(lineData, idx); + }; - var retrieve = __webpack_require__(4).retrieve; - var parsePercent = __webpack_require__(7).parsePercent; + effectLineProto.updateSymbolPosition = function (symbol) { + var p1 = symbol.__p1; + var p2 = symbol.__p2; + var cp1 = symbol.__cp1; + var t = symbol.__t; + var pos = symbol.position; + var quadraticAt = curveUtil.quadraticAt; + var quadraticDerivativeAt = curveUtil.quadraticDerivativeAt; + pos[0] = quadraticAt(p1[0], cp1[0], p2[0], t); + pos[1] = quadraticAt(p1[1], cp1[1], p2[1], t); - module.exports = function (ecModel) { + // Tangent + var tx = quadraticDerivativeAt(p1[0], cp1[0], p2[0], t); + var ty = quadraticDerivativeAt(p1[1], cp1[1], p2[1], t); - ecModel.eachSeriesByType('candlestick', function (seriesModel) { + symbol.rotation = -Math.atan2(ty, tx) - Math.PI / 2; - var coordSys = seriesModel.coordinateSystem; - var data = seriesModel.getData(); - var dimensions = seriesModel.dimensions; - var chartLayout = seriesModel.get('layout'); + symbol.ignore = false; + }; - var candleWidth = calculateCandleWidth(seriesModel, data); - data.each(dimensions, function () { - var args = arguments; - var dimLen = dimensions.length; - var axisDimVal = args[0]; - var idx = args[dimLen]; - var variableDim = chartLayout === 'horizontal' ? 0 : 1; - var constDim = 1 - variableDim; + effectLineProto.updateLayout = function (lineData, idx) { + this.childAt(0).updateLayout(lineData, idx); - var openVal = args[1]; - var closeVal = args[2]; - var lowestVal = args[3]; - var highestVal = args[4]; + var effectModel = lineData.getItemModel(idx).getModel('effect'); + this._updateEffectAnimation(lineData, effectModel, idx); + }; - var ocLow = Math.min(openVal, closeVal); - var ocHigh = Math.max(openVal, closeVal); + zrUtil.inherits(EffectLine, graphic.Group); - var ocLowPoint = getPoint(ocLow); - var ocHighPoint = getPoint(ocHigh); - var lowestPoint = getPoint(lowestVal); - var highestPoint = getPoint(highestVal); + module.exports = EffectLine; - var whiskerEnds = [ - [highestPoint, ocHighPoint], - [lowestPoint, ocLowPoint] - ]; - var bodyEnds = []; - addBodyEnd(ocHighPoint, 0); - addBodyEnd(ocLowPoint, 1); +/***/ }, +/* 282 */ +/***/ function(module, exports, __webpack_require__) { - data.setItemLayout(idx, { - chartLayout: chartLayout, - sign: openVal > closeVal ? -1 : openVal < closeVal ? 1 : 0, - initBaseline: openVal > closeVal - ? ocHighPoint[constDim] : ocLowPoint[constDim], // open point. - bodyEnds: bodyEnds, - whiskerEnds: whiskerEnds, - brushRect: makeBrushRect() - }); + /** + * @module echarts/chart/helper/Line + */ - function getPoint(val) { - var p = []; - p[variableDim] = axisDimVal; - p[constDim] = val; - return (isNaN(axisDimVal) || isNaN(val)) - ? [NaN, NaN] - : coordSys.dataToPoint(p); - } - function addBodyEnd(point, start) { - var point1 = point.slice(); - var point2 = point.slice(); - point1[variableDim] += candleWidth / 2; - point2[variableDim] -= candleWidth / 2; - start - ? bodyEnds.push(point1, point2) - : bodyEnds.push(point2, point1); - } + var graphic = __webpack_require__(44); + var zrUtil = __webpack_require__(4); - function makeBrushRect() { - var pmin = getPoint(Math.min(openVal, closeVal, lowestVal, highestVal)); - var pmax = getPoint(Math.max(openVal, closeVal, lowestVal, highestVal)); + /** + * @constructor + * @extends {module:zrender/graphic/Group} + * @alias {module:echarts/chart/helper/Polyline} + */ + function Polyline(lineData, idx, seriesScope) { + graphic.Group.call(this); - pmin[variableDim] -= candleWidth / 2; - pmax[variableDim] -= candleWidth / 2; + this._createPolyline(lineData, idx, seriesScope); + } - return { - x: pmin[0], - y: pmin[1], - width: constDim ? candleWidth : pmax[0] - pmin[0], - height: constDim ? pmax[1] - pmin[1] : candleWidth - }; - } + var polylineProto = Polyline.prototype; - }, true); + polylineProto._createPolyline = function (lineData, idx, seriesScope) { + // var seriesModel = lineData.hostModel; + var points = lineData.getItemLayout(idx); + + var line = new graphic.Polyline({ + shape: { + points: points + } }); + + this.add(line); + + this._updateCommonStl(lineData, idx, seriesScope); }; - function calculateCandleWidth(seriesModel, data) { - var baseAxis = seriesModel.getBaseAxis(); - var extent; + polylineProto.updateData = function (lineData, idx, seriesScope) { + var seriesModel = lineData.hostModel; - var bandWidth = baseAxis.type === 'category' - ? baseAxis.getBandWidth() - : ( - extent = baseAxis.getExtent(), - Math.abs(extent[1] - extent[0]) / data.count() - ); + var line = this.childAt(0); + var target = { + shape: { + points: lineData.getItemLayout(idx) + } + }; + graphic.updateProps(line, target, seriesModel, idx); - var barMaxWidth = parsePercent( - retrieve(seriesModel.get('barMaxWidth'), bandWidth), - bandWidth - ); - var barMinWidth = parsePercent( - retrieve(seriesModel.get('barMinWidth'), 1), - bandWidth - ); - var barWidth = seriesModel.get('barWidth'); - return barWidth != null - ? parsePercent(barWidth, bandWidth) - // Put max outer to ensure bar visible in spite of overlap. - : Math.max(Math.min(bandWidth / 2, barMaxWidth), barMinWidth); - } + this._updateCommonStl(lineData, idx, seriesScope); + }; + polylineProto._updateCommonStl = function (lineData, idx, seriesScope) { + var line = this.childAt(0); + var itemModel = lineData.getItemModel(idx); + var visualColor = lineData.getItemVisual(idx, 'color'); -/***/ }, -/* 260 */ -/***/ function(module, exports, __webpack_require__) { + var lineStyle = seriesScope && seriesScope.lineStyle; + var hoverLineStyle = seriesScope && seriesScope.hoverLineStyle; + + if (!seriesScope || lineData.hasItemOption) { + lineStyle = itemModel.getModel('lineStyle.normal').getLineStyle(); + hoverLineStyle = itemModel.getModel('lineStyle.emphasis').getLineStyle(); + } + line.useStyle(zrUtil.defaults( + { + strokeNoScale: true, + fill: 'none', + stroke: visualColor + }, + lineStyle + )); + line.hoverStyle = hoverLineStyle; - + graphic.setHoverStyle(this); + }; - var zrUtil = __webpack_require__(4); - var echarts = __webpack_require__(1); + polylineProto.updateLayout = function (lineData, idx) { + var polyline = this.childAt(0); + polyline.setShape('points', lineData.getItemLayout(idx)); + }; - __webpack_require__(261); - __webpack_require__(262); + zrUtil.inherits(Polyline, graphic.Group); - echarts.registerVisual(zrUtil.curry( - __webpack_require__(110), 'effectScatter', 'circle', null - )); - echarts.registerLayout(zrUtil.curry( - __webpack_require__(111), 'effectScatter' - )); + module.exports = Polyline; /***/ }, -/* 261 */ +/* 283 */ /***/ function(module, exports, __webpack_require__) { - 'use strict'; - + /** + * Provide effect for line + * @module echarts/chart/helper/EffectLine + */ - var createListFromArray = __webpack_require__(102); - var SeriesModel = __webpack_require__(28); - module.exports = SeriesModel.extend({ + var Polyline = __webpack_require__(282); + var zrUtil = __webpack_require__(4); + var EffectLine = __webpack_require__(281); + var vec2 = __webpack_require__(10); - type: 'series.effectScatter', + /** + * @constructor + * @extends {module:echarts/chart/helper/EffectLine} + * @alias {module:echarts/chart/helper/Polyline} + */ + function EffectPolyline(lineData, idx, seriesScope) { + EffectLine.call(this, lineData, idx, seriesScope); + this._lastFrame = 0; + this._lastFramePercent = 0; + } - dependencies: ['grid', 'polar'], + var effectPolylineProto = EffectPolyline.prototype; - getInitialData: function (option, ecModel) { - var list = createListFromArray(option.data, this, ecModel); - return list; - }, + // Overwrite + effectPolylineProto.createLine = function (lineData, idx, seriesScope) { + return new Polyline(lineData, idx, seriesScope); + }; - brushSelector: 'point', + // Overwrite + effectPolylineProto.updateAnimationPoints = function (symbol, points) { + this._points = points; + var accLenArr = [0]; + var len = 0; + for (var i = 1; i < points.length; i++) { + var p1 = points[i - 1]; + var p2 = points[i]; + len += vec2.dist(p1, p2); + accLenArr.push(len); + } + if (len === 0) { + return; + } - defaultOption: { - coordinateSystem: 'cartesian2d', - zlevel: 0, - z: 2, - legendHoverLink: true, + for (var i = 0; i < accLenArr.length; i++) { + accLenArr[i] /= len; + } + this._offsets = accLenArr; + this._length = len; + }; - effectType: 'ripple', + // Overwrite + effectPolylineProto.getLineLength = function (symbol) { + return this._length; + }; - progressive: 0, + // Overwrite + effectPolylineProto.updateSymbolPosition = function (symbol) { + var t = symbol.__t; + var points = this._points; + var offsets = this._offsets; + var len = points.length; - // When to show the effect, option: 'render'|'emphasis' - showEffectOn: 'render', + if (!offsets) { + // Has length 0 + return; + } - // Ripple effect config - rippleEffect: { - period: 4, - // Scale of ripple - scale: 2.5, - // Brush type can be fill or stroke - brushType: 'fill' - }, + var lastFrame = this._lastFrame; + var frame; - // Cartesian coordinate system - // xAxisIndex: 0, - // yAxisIndex: 0, + if (t < this._lastFramePercent) { + // Start from the next frame + // PENDING start from lastFrame ? + var start = Math.min(lastFrame + 1, len - 1); + for (frame = start; frame >= 0; frame--) { + if (offsets[frame] <= t) { + break; + } + } + // PENDING really need to do this ? + frame = Math.min(frame, len - 2); + } + else { + for (var frame = lastFrame; frame < len; frame++) { + if (offsets[frame] > t) { + break; + } + } + frame = Math.min(frame - 1, len - 2); + } - // Polar coordinate system - // polarIndex: 0, + vec2.lerp( + symbol.position, points[frame], points[frame + 1], + (t - offsets[frame]) / (offsets[frame + 1] - offsets[frame]) + ); - // Geo coordinate system - // geoIndex: 0, + var tx = points[frame + 1][0] - points[frame][0]; + var ty = points[frame + 1][1] - points[frame][1]; + symbol.rotation = -Math.atan2(ty, tx) - Math.PI / 2; - // symbol: null, // 图形类型 - symbolSize: 10 // 图形大小,半宽(半径)参数,当图形为方向或菱形则总宽度为symbolSize * 2 - // symbolRotate: null, // 图形旋转控制 + this._lastFrame = frame; + this._lastFramePercent = t; - // large: false, - // Available when large is true - // largeThreshold: 2000, + symbol.ignore = false; + }; - // itemStyle: { - // normal: { - // opacity: 1 - // } - // } - } + zrUtil.inherits(EffectPolyline, EffectLine); - }); + module.exports = EffectPolyline; /***/ }, -/* 262 */ +/* 284 */ /***/ function(module, exports, __webpack_require__) { - + // TODO Batch by color - var SymbolDraw = __webpack_require__(105); - var EffectSymbol = __webpack_require__(263); - __webpack_require__(1).extendChartView({ - type: 'effectScatter', + var graphic = __webpack_require__(44); - init: function () { - this._symbolDraw = new SymbolDraw(EffectSymbol); - }, + var quadraticContain = __webpack_require__(56); + var lineContain = __webpack_require__(54); - render: function (seriesModel, ecModel, api) { - var data = seriesModel.getData(); - var effectSymbolDraw = this._symbolDraw; - effectSymbolDraw.updateData(data); - this.group.add(effectSymbolDraw.group); - }, + var LargeLineShape = graphic.extendShape({ + shape: { + polyline: false, - updateLayout: function () { - this._symbolDraw.updateLayout(); + segs: [] }, - remove: function (ecModel, api) { - this._symbolDraw && this._symbolDraw.remove(api); + buildPath: function (path, shape) { + var segs = shape.segs; + var isPolyline = shape.polyline; + + for (var i = 0; i < segs.length; i++) { + var seg = segs[i]; + if (isPolyline) { + path.moveTo(seg[0][0], seg[0][1]); + for (var j = 1; j < seg.length; j++) { + path.lineTo(seg[j][0], seg[j][1]); + } + } + else { + path.moveTo(seg[0][0], seg[0][1]); + if (seg.length > 2) { + path.quadraticCurveTo(seg[2][0], seg[2][1], seg[1][0], seg[1][1]); + } + else { + path.lineTo(seg[1][0], seg[1][1]); + } + } + } }, - dispose: function () {} + findDataIndex: function (x, y) { + var shape = this.shape; + var segs = shape.segs; + var isPolyline = shape.polyline; + var lineWidth = Math.max(this.style.lineWidth, 1); + + // Not consider transform + for (var i = 0; i < segs.length; i++) { + var seg = segs[i]; + if (isPolyline) { + for (var j = 1; j < seg.length; j++) { + if (lineContain.containStroke( + seg[j - 1][0], seg[j - 1][1], seg[j][0], seg[j][1], lineWidth, x, y + )) { + return i; + } + } + } + else { + if (seg.length > 2) { + if (quadraticContain.containStroke( + seg[0][0], seg[0][1], seg[2][0], seg[2][1], seg[1][0], seg[1][1], lineWidth, x, y + )) { + return i; + } + } + else { + if (lineContain.containStroke( + seg[0][0], seg[0][1], seg[1][0], seg[1][1], lineWidth, x, y + )) { + return i; + } + } + } + } + + return -1; + } }); + function LargeLineDraw() { + this.group = new graphic.Group(); -/***/ }, -/* 263 */ -/***/ function(module, exports, __webpack_require__) { + this._lineEl = new LargeLineShape(); + } - /** - * Symbol with ripple effect - * @module echarts/chart/helper/EffectSymbol - */ + var largeLineProto = LargeLineDraw.prototype; + /** + * Update symbols draw by new data + * @param {module:echarts/data/List} data + */ + largeLineProto.updateData = function (data) { + this.group.removeAll(); - var zrUtil = __webpack_require__(4); - var symbolUtil = __webpack_require__(107); - var graphic = __webpack_require__(43); - var numberUtil = __webpack_require__(7); - var Symbol = __webpack_require__(106); - var Group = graphic.Group; + var lineEl = this._lineEl; - var EFFECT_RIPPLE_NUMBER = 3; + var seriesModel = data.hostModel; - function normalizeSymbolSize(symbolSize) { - if (!zrUtil.isArray(symbolSize)) { - symbolSize = [+symbolSize, +symbolSize]; + lineEl.setShape({ + segs: data.mapArray(data.getItemLayout), + polyline: seriesModel.get('polyline') + }); + + lineEl.useStyle( + seriesModel.getModel('lineStyle.normal').getLineStyle() + ); + + var visualColor = data.getVisual('color'); + if (visualColor) { + lineEl.setStyle('stroke', visualColor); } - return symbolSize; - } + lineEl.setStyle('fill'); - function updateRipplePath(rippleGroup, effectCfg) { - rippleGroup.eachChild(function (ripplePath) { - ripplePath.attr({ - z: effectCfg.z, - zlevel: effectCfg.zlevel, - style: { - stroke: effectCfg.brushType === 'stroke' ? effectCfg.color : null, - fill: effectCfg.brushType === 'fill' ? effectCfg.color : null - } - }); + // Enable tooltip + // PENDING May have performance issue when path is extremely large + lineEl.seriesIndex = seriesModel.seriesIndex; + lineEl.on('mousemove', function (e) { + lineEl.dataIndex = null; + var dataIndex = lineEl.findDataIndex(e.offsetX, e.offsetY); + if (dataIndex > 0) { + // Provide dataIndex for tooltip + lineEl.dataIndex = dataIndex; + } }); - } - /** - * @constructor - * @param {module:echarts/data/List} data - * @param {number} idx - * @extends {module:zrender/graphic/Group} - */ - function EffectSymbol(data, idx) { - Group.call(this); - - var symbol = new Symbol(data, idx); - var rippleGroup = new Group(); - this.add(symbol); - this.add(rippleGroup); - rippleGroup.beforeUpdate = function () { - this.attr(symbol.getScale()); - }; - this.updateData(data, idx); - } + // Add back + this.group.add(lineEl); + }; - var effectSymbolProto = EffectSymbol.prototype; + largeLineProto.updateLayout = function (seriesModel) { + var data = seriesModel.getData(); + this._lineEl.setShape({ + segs: data.mapArray(data.getItemLayout) + }); + }; - effectSymbolProto.stopEffectAnimation = function () { - this.childAt(1).removeAll(); + largeLineProto.remove = function () { + this.group.removeAll(); }; - effectSymbolProto.startEffectAnimation = function (effectCfg) { - var symbolType = effectCfg.symbolType; - var color = effectCfg.color; - var rippleGroup = this.childAt(1); + module.exports = LargeLineDraw; - for (var i = 0; i < EFFECT_RIPPLE_NUMBER; i++) { - // var ripplePath = symbolUtil.createSymbol( - // symbolType, -0.5, -0.5, 1, 1, color - // ); - // If width/height are set too small (e.g., set to 1) on ios10 - // and macOS Sierra, a circle stroke become a rect, no matter what - // the scale is set. So we set width/height as 2. See #4136. - var ripplePath = symbolUtil.createSymbol( - symbolType, -1, -1, 2, 2, color - ); - ripplePath.attr({ - style: { - strokeNoScale: true - }, - z2: 99, - silent: true, - scale: [0.5, 0.5] - }); - var delay = -i / EFFECT_RIPPLE_NUMBER * effectCfg.period + effectCfg.effectOffset; - // TODO Configurable effectCfg.period - ripplePath.animate('', true) - .when(effectCfg.period, { - scale: [effectCfg.rippleScale / 2, effectCfg.rippleScale / 2] - }) - .delay(delay) - .start(); - ripplePath.animateStyle(true) - .when(effectCfg.period, { - opacity: 0 - }) - .delay(delay) - .start(); +/***/ }, +/* 285 */ +/***/ function(module, exports, __webpack_require__) { - rippleGroup.add(ripplePath); - } + - updateRipplePath(rippleGroup, effectCfg); - }; + module.exports = function (ecModel) { + ecModel.eachSeriesByType('lines', function (seriesModel) { + var coordSys = seriesModel.coordinateSystem; + var lineData = seriesModel.getData(); - /** - * Update effect symbol - */ - effectSymbolProto.updateEffectAnimation = function (effectCfg) { - var oldEffectCfg = this._effectCfg; - var rippleGroup = this.childAt(1); + // FIXME Use data dimensions ? + lineData.each(function (idx) { + var itemModel = lineData.getItemModel(idx); - // Must reinitialize effect if following configuration changed - var DIFFICULT_PROPS = ['symbolType', 'period', 'rippleScale']; - for (var i = 0; i < DIFFICULT_PROPS; i++) { - var propName = DIFFICULT_PROPS[i]; - if (oldEffectCfg[propName] !== effectCfg[propName]) { - this.stopEffectAnimation(); - this.startEffectAnimation(effectCfg); - return; - } - } + var coords = (itemModel.option instanceof Array) ? + itemModel.option : itemModel.get('coords'); - updateRipplePath(rippleGroup, effectCfg); - }; + if (true) { + if (!(coords instanceof Array && coords.length > 0 && coords[0] instanceof Array)) { + throw new Error('Invalid coords ' + JSON.stringify(coords) + '. Lines must have 2d coords array in data item.'); + } + } + var pts = []; - /** - * Highlight symbol - */ - effectSymbolProto.highlight = function () { - this.trigger('emphasis'); - }; + if (seriesModel.get('polyline')) { + for (var i = 0; i < coords.length; i++) { + pts.push(coordSys.dataToPoint(coords[i])); + } + } + else { + pts[0] = coordSys.dataToPoint(coords[0]); + pts[1] = coordSys.dataToPoint(coords[1]); - /** - * Downplay symbol - */ - effectSymbolProto.downplay = function () { - this.trigger('normal'); + var curveness = itemModel.get('lineStyle.normal.curveness'); + if (+curveness) { + pts[2] = [ + (pts[0][0] + pts[1][0]) / 2 - (pts[0][1] - pts[1][1]) * curveness, + (pts[0][1] + pts[1][1]) / 2 - (pts[1][0] - pts[0][0]) * curveness + ]; + } + } + lineData.setItemLayout(idx, pts); + }); + }); }; - /** - * Update symbol properties - * @param {module:echarts/data/List} data - * @param {number} idx - */ - effectSymbolProto.updateData = function (data, idx) { - var seriesModel = data.hostModel; - this.childAt(0).updateData(data, idx); +/***/ }, +/* 286 */ +/***/ function(module, exports) { - var rippleGroup = this.childAt(1); - var itemModel = data.getItemModel(idx); - var symbolType = data.getItemVisual(idx, 'symbol'); - var symbolSize = normalizeSymbolSize(data.getItemVisual(idx, 'symbolSize')); - var color = data.getItemVisual(idx, 'color'); + - rippleGroup.attr('scale', symbolSize); + function normalize(a) { + if (!(a instanceof Array)) { + a = [a, a]; + } + return a; + } + module.exports = function (ecModel) { + ecModel.eachSeriesByType('lines', function (seriesModel) { + var data = seriesModel.getData(); + var symbolType = normalize(seriesModel.get('symbol')); + var symbolSize = normalize(seriesModel.get('symbolSize')); - rippleGroup.traverse(function (ripplePath) { - ripplePath.attr({ - fill: color + var opacityQuery = 'lineStyle.normal.opacity'.split('.'); + + data.setVisual('fromSymbol', symbolType && symbolType[0]); + data.setVisual('toSymbol', symbolType && symbolType[1]); + data.setVisual('fromSymbolSize', symbolSize && symbolSize[0]); + data.setVisual('toSymbolSize', symbolSize && symbolSize[1]); + data.setVisual('opacity', seriesModel.get(opacityQuery)); + + data.each(function (idx) { + var itemModel = data.getItemModel(idx); + var symbolType = normalize(itemModel.getShallow('symbol', true)); + var symbolSize = normalize(itemModel.getShallow('symbolSize', true)); + var opacity = itemModel.get(opacityQuery); + + symbolType[0] && data.setItemVisual(idx, 'fromSymbol', symbolType[0]); + symbolType[1] && data.setItemVisual(idx, 'toSymbol', symbolType[1]); + symbolSize[0] && data.setItemVisual(idx, 'fromSymbolSize', symbolSize[0]); + symbolSize[1] && data.setItemVisual(idx, 'toSymbolSize', symbolSize[1]); + + data.setItemVisual(idx, 'opacity', opacity); }); }); + }; + + +/***/ }, +/* 287 */ +/***/ function(module, exports, __webpack_require__) { - var symbolOffset = itemModel.getShallow('symbolOffset'); - if (symbolOffset) { - var pos = rippleGroup.position; - pos[0] = numberUtil.parsePercent(symbolOffset[0], symbolSize[0]); - pos[1] = numberUtil.parsePercent(symbolOffset[1], symbolSize[1]); - } - rippleGroup.rotation = (itemModel.getShallow('symbolRotate') || 0) * Math.PI / 180 || 0; + - var effectCfg = {}; + __webpack_require__(288); + __webpack_require__(289); - effectCfg.showEffectOn = seriesModel.get('showEffectOn'); - effectCfg.rippleScale = itemModel.get('rippleEffect.scale'); - effectCfg.brushType = itemModel.get('rippleEffect.brushType'); - effectCfg.period = itemModel.get('rippleEffect.period') * 1000; - effectCfg.effectOffset = idx / data.count(); - effectCfg.z = itemModel.getShallow('z') || 0; - effectCfg.zlevel = itemModel.getShallow('zlevel') || 0; - effectCfg.symbolType = symbolType; - effectCfg.color = color; - this.off('mouseover').off('mouseout').off('emphasis').off('normal'); +/***/ }, +/* 288 */ +/***/ function(module, exports, __webpack_require__) { - if (effectCfg.showEffectOn === 'render') { - this._effectCfg - ? this.updateEffectAnimation(effectCfg) - : this.startEffectAnimation(effectCfg); + - this._effectCfg = effectCfg; - } - else { - // Not keep old effect config - this._effectCfg = null; + var SeriesModel = __webpack_require__(28); + var createListFromArray = __webpack_require__(102); - this.stopEffectAnimation(); - var symbol = this.childAt(0); - var onEmphasis = function () { - symbol.trigger('emphasis'); - if (effectCfg.showEffectOn !== 'render') { - this.startEffectAnimation(effectCfg); - } - }; - var onNormal = function () { - symbol.trigger('normal'); - if (effectCfg.showEffectOn !== 'render') { - this.stopEffectAnimation(); - } - }; - this.on('mouseover', onEmphasis, this) - .on('mouseout', onNormal, this) - .on('emphasis', onEmphasis, this) - .on('normal', onNormal, this); - } + module.exports = SeriesModel.extend({ + type: 'series.heatmap', - this._effectCfg = effectCfg; - }; + getInitialData: function (option, ecModel) { + return createListFromArray(option.data, this, ecModel); + }, - effectSymbolProto.fadeOut = function (cb) { - this.off('mouseover').off('mouseout').off('emphasis').off('normal'); - cb && cb(); - }; + defaultOption: { - zrUtil.inherits(EffectSymbol, Group); + // Cartesian2D or geo + coordinateSystem: 'cartesian2d', - module.exports = EffectSymbol; + zlevel: 0, + z: 2, -/***/ }, -/* 264 */ -/***/ function(module, exports, __webpack_require__) { + // Cartesian coordinate system + // xAxisIndex: 0, + // yAxisIndex: 0, - + // Geo coordinate system + geoIndex: 0, - __webpack_require__(265); - __webpack_require__(266); + blurSize: 30, - var echarts = __webpack_require__(1); - echarts.registerLayout( - __webpack_require__(271) - ); - echarts.registerVisual( - __webpack_require__(272) - ); + pointSize: 20, + + maxOpacity: 1, + + minOpacity: 0 + } + }); /***/ }, -/* 265 */ +/* 289 */ /***/ function(module, exports, __webpack_require__) { - 'use strict'; - + - var SeriesModel = __webpack_require__(28); - var List = __webpack_require__(98); + var graphic = __webpack_require__(44); + var HeatmapLayer = __webpack_require__(290); var zrUtil = __webpack_require__(4); - var formatUtil = __webpack_require__(6); - var CoordinateSystem = __webpack_require__(26); - // Convert [ [{coord: []}, {coord: []}] ] - // to [ { coords: [[]] } ] - function preprocessOption (seriesOpt) { - var data = seriesOpt.data; - if (data && data[0] && data[0][0] && data[0][0].coord) { - if (true) { - console.warn('Lines data configuration has been changed to' - + ' { coords:[[1,2],[2,3]] }'); - } - seriesOpt.data = zrUtil.map(data, function (itemOpt) { - var coords = [ - itemOpt[0].coord, itemOpt[1].coord - ]; - var target = { - coords: coords - }; - if (itemOpt[0].name) { - target.fromName = itemOpt[0].name; + function getIsInPiecewiseRange(dataExtent, pieceList, selected) { + var dataSpan = dataExtent[1] - dataExtent[0]; + pieceList = zrUtil.map(pieceList, function (piece) { + return { + interval: [ + (piece.interval[0] - dataExtent[0]) / dataSpan, + (piece.interval[1] - dataExtent[0]) / dataSpan + ] + }; + }); + var len = pieceList.length; + var lastIndex = 0; + return function (val) { + // Try to find in the location of the last found + for (var i = lastIndex; i < len; i++) { + var interval = pieceList[i].interval; + if (interval[0] <= val && val <= interval[1]) { + lastIndex = i; + break; } - if (itemOpt[1].name) { - target.toName = itemOpt[1].name; + } + if (i === len) { // Not found, back interation + for (var i = lastIndex - 1; i >= 0; i--) { + var interval = pieceList[i].interval; + if (interval[0] <= val && val <= interval[1]) { + lastIndex = i; + break; + } } - return zrUtil.mergeAll([target, itemOpt[0], itemOpt[1]]); - }); - } + } + return i >= 0 && i < len && selected[i]; + }; } - var LinesSeries = SeriesModel.extend({ + function getIsInContinuousRange(dataExtent, range) { + var dataSpan = dataExtent[1] - dataExtent[0]; + range = [ + (range[0] - dataExtent[0]) / dataSpan, + (range[1] - dataExtent[0]) / dataSpan + ]; + return function (val) { + return val >= range[0] && val <= range[1]; + }; + } - type: 'series.lines', + function isGeoCoordSys(coordSys) { + var dimensions = coordSys.dimensions; + // Not use coorSys.type === 'geo' because coordSys maybe extended + return dimensions[0] === 'lng' && dimensions[1] === 'lat'; + } - dependencies: ['grid', 'polar'], + module.exports = __webpack_require__(1).extendChartView({ - visualColorAccessPath: 'lineStyle.normal.color', + type: 'heatmap', - init: function (option) { - // Not using preprocessor because mergeOption may not have series.type - preprocessOption(option); + render: function (seriesModel, ecModel, api) { + var visualMapOfThisSeries; + ecModel.eachComponent('visualMap', function (visualMap) { + visualMap.eachTargetSeries(function (targetSeries) { + if (targetSeries === seriesModel) { + visualMapOfThisSeries = visualMap; + } + }); + }); - LinesSeries.superApply(this, 'init', arguments); + if (true) { + if (!visualMapOfThisSeries) { + throw new Error('Heatmap must use with visualMap'); + } + } + + this.group.removeAll(); + var coordSys = seriesModel.coordinateSystem; + if (coordSys.type === 'cartesian2d' || coordSys.type === 'calendar') { + this._renderOnCartesianAndCalendar(coordSys, seriesModel, api); + } + else if (isGeoCoordSys(coordSys)) { + this._renderOnGeo( + coordSys, seriesModel, visualMapOfThisSeries, api + ); + } }, - mergeOption: function (option) { - preprocessOption(option); + dispose: function () {}, - LinesSeries.superApply(this, 'mergeOption', arguments); - }, + _renderOnCartesianAndCalendar: function (coordSys, seriesModel, api) { - getInitialData: function (option, ecModel) { - if (true) { - var CoordSys = CoordinateSystem.get(option.coordinateSystem); - if (!CoordSys) { - throw new Error('Unkown coordinate system ' + option.coordinateSystem); - } - } + if (coordSys.type === 'cartesian2d') { + var xAxis = coordSys.getAxis('x'); + var yAxis = coordSys.getAxis('y'); - var lineData = new List(['value'], this); - lineData.hasItemOption = false; - lineData.initData(option.data, [], function (dataItem, dimName, dataIndex, dimIndex) { - // dataItem is simply coords - if (dataItem instanceof Array) { - return NaN; - } - else { - lineData.hasItemOption = true; - var value = dataItem.value; - if (value != null) { - return value instanceof Array ? value[dimIndex] : value; + if (true) { + if (!(xAxis.type === 'category' && yAxis.type === 'category')) { + throw new Error('Heatmap on cartesian must have two category axes'); + } + if (!(xAxis.onBand && yAxis.onBand)) { + throw new Error('Heatmap on cartesian must have two axes with boundaryGap true'); } } - }); - return lineData; - }, + var width = xAxis.getBandWidth(); + var height = yAxis.getBandWidth(); - formatTooltip: function (dataIndex) { - var data = this.getData(); - var itemModel = data.getItemModel(dataIndex); - var name = itemModel.get('name'); - if (name) { - return name; } - var fromName = itemModel.get('fromName'); - var toName = itemModel.get('toName'); - var html = []; - fromName != null && html.push(fromName); - toName != null && html.push(toName); - return formatUtil.encodeHTML(html.join(' > ')); - }, - defaultOption: { - coordinateSystem: 'geo', - zlevel: 0, - z: 2, - legendHoverLink: true, + var group = this.group; + var data = seriesModel.getData(); - hoverAnimation: true, - // Cartesian coordinate system - xAxisIndex: 0, - yAxisIndex: 0, + var itemStyleQuery = 'itemStyle.normal'; + var hoverItemStyleQuery = 'itemStyle.emphasis'; + var labelQuery = 'label.normal'; + var hoverLabelQuery = 'label.emphasis'; + var style = seriesModel.getModel(itemStyleQuery).getItemStyle(['color']); + var hoverStl = seriesModel.getModel(hoverItemStyleQuery).getItemStyle(); + var labelModel = seriesModel.getModel('label.normal'); + var hoverLabelModel = seriesModel.getModel('label.emphasis'); - symbol: ['none', 'none'], - symbolSize: [10, 10], - // Geo coordinate system - geoIndex: 0, - effect: { - show: false, - period: 4, - // Animation delay. support callback - // delay: 0, - // If move with constant speed px/sec - // period will be ignored if this property is > 0, - constantSpeed: 0, - symbol: 'circle', - symbolSize: 3, - loop: true, - // Length of trail, 0 - 1 - trailLength: 0.2 - // Same with lineStyle.normal.color - // color - }, - large: false, - // Available when large is true - largeThreshold: 2000, + data.each( + coordSys.type === 'cartesian2d' ? ['x', 'y', 'z'] : ['time', 'value'], - // If lines are polyline - // polyline not support curveness, label, animation - polyline: false, + function (x, y, z, idx) { + var rect; - label: { - normal: { - show: false, - position: 'end' - // distance: 5, - // formatter: 标签文本格式器,同Tooltip.formatter,不支持异步回调 - } - }, + if (coordSys.type === 'cartesian2d') { - lineStyle: { - normal: { - opacity: 0.5 + // Ignore empty data + if (isNaN(z)) { + return; + } + + var point = coordSys.dataToPoint([x, y]); + + rect = new graphic.Rect({ + shape: { + x: point[0] - width / 2, + y: point[1] - height / 2, + width: width, + height: height + }, + style: { + fill: data.getItemVisual(idx, 'color'), + opacity: data.getItemVisual(idx, 'opacity') + } + }); + } + else { + // x => time y => value z => idx + + // Ignore empty data + if (isNaN(y)) { + return; + } + + idx = z; + + rect = new graphic.Rect({ + z2: 1, + shape: coordSys.dataToRect([x, y]).contentShape, + style: { + fill: data.getItemVisual(idx, 'color'), + opacity: data.getItemVisual(idx, 'opacity') + } + }); + } + + + var itemModel = data.getItemModel(idx); + + // Optimization for large datset + if (data.hasItemOption) { + style = itemModel.getModel(itemStyleQuery).getItemStyle(['color']); + hoverStl = itemModel.getModel(hoverItemStyleQuery).getItemStyle(); + labelModel = itemModel.getModel(labelQuery); + hoverLabelModel = itemModel.getModel(hoverLabelQuery); + } + + var rawValue = seriesModel.getRawValue(idx); + var defaultText = '-'; + if (rawValue && rawValue[2] != null) { + defaultText = rawValue[2]; + } + if (labelModel.getShallow('show')) { + graphic.setText(style, labelModel); + style.text = seriesModel.getFormattedLabel(idx, 'normal') || defaultText; + } + if (hoverLabelModel.getShallow('show')) { + graphic.setText(hoverStl, hoverLabelModel); + hoverStl.text = seriesModel.getFormattedLabel(idx, 'emphasis') || defaultText; + } + + rect.setStyle(style); + + graphic.setHoverStyle(rect, data.hasItemOption ? hoverStl : zrUtil.extend({}, hoverStl)); + + group.add(rect); + data.setItemGraphicEl(idx, rect); } - } + ); + }, + + _renderOnGeo: function (geo, seriesModel, visualMapModel, api) { + var inRangeVisuals = visualMapModel.targetVisuals.inRange; + var outOfRangeVisuals = visualMapModel.targetVisuals.outOfRange; + // if (!visualMapping) { + // throw new Error('Data range must have color visuals'); + // } + + var data = seriesModel.getData(); + var hmLayer = this._hmLayer || (this._hmLayer || new HeatmapLayer()); + hmLayer.blurSize = seriesModel.get('blurSize'); + hmLayer.pointSize = seriesModel.get('pointSize'); + hmLayer.minOpacity = seriesModel.get('minOpacity'); + hmLayer.maxOpacity = seriesModel.get('maxOpacity'); + + var rect = geo.getViewRect().clone(); + var roamTransform = geo.getRoamTransform().transform; + rect.applyTransform(roamTransform); + + // Clamp on viewport + var x = Math.max(rect.x, 0); + var y = Math.max(rect.y, 0); + var x2 = Math.min(rect.width + rect.x, api.getWidth()); + var y2 = Math.min(rect.height + rect.y, api.getHeight()); + var width = x2 - x; + var height = y2 - y; + + var points = data.mapArray(['lng', 'lat', 'value'], function (lng, lat, value) { + var pt = geo.dataToPoint([lng, lat]); + pt[0] -= x; + pt[1] -= y; + pt.push(value); + return pt; + }); + + var dataExtent = visualMapModel.getExtent(); + var isInRange = visualMapModel.type === 'visualMap.continuous' + ? getIsInContinuousRange(dataExtent, visualMapModel.option.range) + : getIsInPiecewiseRange( + dataExtent, visualMapModel.getPieceList(), visualMapModel.option.selected + ); + + hmLayer.update( + points, width, height, + inRangeVisuals.color.getNormalizer(), + { + inRange: inRangeVisuals.color.getColorMapper(), + outOfRange: outOfRangeVisuals.color.getColorMapper() + }, + isInRange + ); + var img = new graphic.Image({ + style: { + width: width, + height: height, + x: x, + y: y, + image: hmLayer.canvas + }, + silent: true + }); + this.group.add(img); } }); + /***/ }, -/* 266 */ +/* 290 */ /***/ function(module, exports, __webpack_require__) { - + /** + * @file defines echarts Heatmap Chart + * @author Ovilia (me@zhangwenli.com) + * Inspired by https://github.com/mourner/simpleheat + * + * @module + */ - var LineDraw = __webpack_require__(202); - var EffectLine = __webpack_require__(267); - var Line = __webpack_require__(203); - var Polyline = __webpack_require__(268); - var EffectPolyline = __webpack_require__(269); - var LargeLineDraw = __webpack_require__(270); - __webpack_require__(1).extendChartView({ + var GRADIENT_LEVELS = 256; + var zrUtil = __webpack_require__(4); - type: 'lines', + /** + * Heatmap Chart + * + * @class + */ + function Heatmap() { + var canvas = zrUtil.createCanvas(); + this.canvas = canvas; - init: function () {}, + this.blurSize = 30; + this.pointSize = 20; - render: function (seriesModel, ecModel, api) { - var data = seriesModel.getData(); - var lineDraw = this._lineDraw; + this.maxOpacity = 1; + this.minOpacity = 0; - var hasEffect = seriesModel.get('effect.show'); - var isPolyline = seriesModel.get('polyline'); - var isLarge = seriesModel.get('large') && data.count() >= seriesModel.get('largeThreshold'); + this._gradientPixels = {}; + } - if (true) { - if (hasEffect && isLarge) { - console.warn('Large lines not support effect'); - } - } - if (hasEffect !== this._hasEffet || isPolyline !== this._isPolyline || isLarge !== this._isLarge) { - if (lineDraw) { - lineDraw.remove(); - } - lineDraw = this._lineDraw = isLarge - ? new LargeLineDraw() - : new LineDraw( - isPolyline - ? (hasEffect ? EffectPolyline : Polyline) - : (hasEffect ? EffectLine : Line) - ); - this._hasEffet = hasEffect; - this._isPolyline = isPolyline; - this._isLarge = isLarge; - } + Heatmap.prototype = { + /** + * Renders Heatmap and returns the rendered canvas + * @param {Array} data array of data, each has x, y, value + * @param {number} width canvas width + * @param {number} height canvas height + */ + update: function(data, width, height, normalize, colorFunc, isInRange) { + var brush = this._getBrush(); + var gradientInRange = this._getGradient(data, colorFunc, 'inRange'); + var gradientOutOfRange = this._getGradient(data, colorFunc, 'outOfRange'); + var r = this.pointSize + this.blurSize; - var zlevel = seriesModel.get('zlevel'); - var trailLength = seriesModel.get('effect.trailLength'); + var canvas = this.canvas; + var ctx = canvas.getContext('2d'); + var len = data.length; + canvas.width = width; + canvas.height = height; + for (var i = 0; i < len; ++i) { + var p = data[i]; + var x = p[0]; + var y = p[1]; + var value = p[2]; - var zr = api.getZr(); - // Avoid the drag cause ghost shadow - // FIXME Better way ? - zr.painter.getLayer(zlevel).clear(true); - // Config layer with motion blur - if (this._lastZlevel != null) { - zr.configLayer(this._lastZlevel, { - motionBlur: false - }); - } - if (hasEffect && trailLength) { - if (true) { - var notInIndividual = false; - ecModel.eachSeries(function (otherSeriesModel) { - if (otherSeriesModel !== seriesModel && otherSeriesModel.get('zlevel') === zlevel) { - notInIndividual = true; - } - }); - notInIndividual && console.warn('Lines with trail effect should have an individual zlevel'); - } + // calculate alpha using value + var alpha = normalize(value); - zr.configLayer(zlevel, { - motionBlur: true, - lastFrameAlpha: Math.max(Math.min(trailLength / 10 + 0.9, 1), 0) - }); + // draw with the circle brush with alpha + ctx.globalAlpha = alpha; + ctx.drawImage(brush, x - r, y - r); } - this.group.add(lineDraw.group); + // colorize the canvas using alpha value and set with gradient + var imageData = ctx.getImageData(0, 0, canvas.width, canvas.height); + var pixels = imageData.data; + var offset = 0; + var pixelLen = pixels.length; + var minOpacity = this.minOpacity; + var maxOpacity = this.maxOpacity; + var diffOpacity = maxOpacity - minOpacity; - lineDraw.updateData(data); + while(offset < pixelLen) { + var alpha = pixels[offset + 3] / 256; + var gradientOffset = Math.floor(alpha * (GRADIENT_LEVELS - 1)) * 4; + // Simple optimize to ignore the empty data + if (alpha > 0) { + var gradient = isInRange(alpha) ? gradientInRange : gradientOutOfRange; + // Any alpha > 0 will be mapped to [minOpacity, maxOpacity] + alpha > 0 && (alpha = alpha * diffOpacity + minOpacity); + pixels[offset++] = gradient[gradientOffset]; + pixels[offset++] = gradient[gradientOffset + 1]; + pixels[offset++] = gradient[gradientOffset + 2]; + pixels[offset++] = gradient[gradientOffset + 3] * alpha * 256; + } + else { + offset += 4; + } + } + ctx.putImageData(imageData, 0, 0); - this._lastZlevel = zlevel; + return canvas; }, - updateLayout: function (seriesModel, ecModel, api) { - this._lineDraw.updateLayout(seriesModel); - // Not use motion when dragging or zooming - var zr = api.getZr(); - zr.painter.getLayer(this._lastZlevel).clear(true); - }, + /** + * get canvas of a black circle brush used for canvas to draw later + * @private + * @returns {Object} circle brush canvas + */ + _getBrush: function() { + var brushCanvas = this._brushCanvas || (this._brushCanvas = zrUtil.createCanvas()); + // set brush size + var r = this.pointSize + this.blurSize; + var d = r * 2; + brushCanvas.width = d; + brushCanvas.height = d; - remove: function (ecModel, api) { - this._lineDraw && this._lineDraw.remove(api, true); + var ctx = brushCanvas.getContext('2d'); + ctx.clearRect(0, 0, d, d); + + // in order to render shadow without the distinct circle, + // draw the distinct circle in an invisible place, + // and use shadowOffset to draw shadow in the center of the canvas + ctx.shadowOffsetX = d; + ctx.shadowBlur = this.blurSize; + // draw the shadow in black, and use alpha and shadow blur to generate + // color in color map + ctx.shadowColor = '#000'; + + // draw circle in the left to the canvas + ctx.beginPath(); + ctx.arc(-r, r, this.pointSize, 0, Math.PI * 2, true); + ctx.closePath(); + ctx.fill(); + return brushCanvas; }, - dispose: function () {} - }); + /** + * get gradient color map + * @private + */ + _getGradient: function (data, colorFunc, state) { + var gradientPixels = this._gradientPixels; + var pixelsSingleState = gradientPixels[state] || (gradientPixels[state] = new Uint8ClampedArray(256 * 4)); + var color = []; + var off = 0; + for (var i = 0; i < 256; i++) { + colorFunc[state](i / 255, true, color); + pixelsSingleState[off++] = color[0]; + pixelsSingleState[off++] = color[1]; + pixelsSingleState[off++] = color[2]; + pixelsSingleState[off++] = color[3]; + } + return pixelsSingleState; + } + }; + + module.exports = Heatmap; + /***/ }, -/* 267 */ +/* 291 */ /***/ function(module, exports, __webpack_require__) { - /** - * Provide effect for line - * @module echarts/chart/helper/EffectLine - */ - + - var graphic = __webpack_require__(43); - var Line = __webpack_require__(203); var zrUtil = __webpack_require__(4); - var symbolUtil = __webpack_require__(107); - var vec2 = __webpack_require__(10); - var curveUtil = __webpack_require__(50); + __webpack_require__(124); - /** - * @constructor - * @extends {module:zrender/graphic/Group} - * @alias {module:echarts/chart/helper/Line} - */ - function EffectLine(lineData, idx, seriesScope) { - graphic.Group.call(this); + __webpack_require__(292); + __webpack_require__(293); - this.add(this.createLine(lineData, idx, seriesScope)); + var barLayoutGrid = __webpack_require__(154); + var echarts = __webpack_require__(1); - this._updateEffectSymbol(lineData, idx); - } + echarts.registerLayout(zrUtil.curry(barLayoutGrid, 'pictorialBar')); - var effectLineProto = EffectLine.prototype; + echarts.registerVisual(zrUtil.curry( + __webpack_require__(119), 'pictorialBar', 'roundRect', null + )); - effectLineProto.createLine = function (lineData, idx, seriesScope) { - return new Line(lineData, idx, seriesScope); - }; + // In case developer forget to include grid component + __webpack_require__(122); - effectLineProto._updateEffectSymbol = function (lineData, idx) { - var itemModel = lineData.getItemModel(idx); - var effectModel = itemModel.getModel('effect'); - var size = effectModel.get('symbolSize'); - var symbolType = effectModel.get('symbol'); - if (!zrUtil.isArray(size)) { - size = [size, size]; - } - var color = effectModel.get('color') || lineData.getItemVisual(idx, 'color'); - var symbol = this.childAt(1); - if (this._symbolType !== symbolType) { - // Remove previous - this.remove(symbol); +/***/ }, +/* 292 */ +/***/ function(module, exports, __webpack_require__) { - symbol = symbolUtil.createSymbol( - symbolType, -0.5, -0.5, 1, 1, color - ); - symbol.z2 = 100; - symbol.culling = true; + - this.add(symbol); - } + var PictorialBarSeries = __webpack_require__(150).extend({ - // Symbol may be removed if loop is false - if (!symbol) { - return; - } + type: 'series.pictorialBar', - // Shadow color is same with color in default - symbol.setStyle('shadowColor', color); - symbol.setStyle(effectModel.getItemStyle(['color'])); + dependencies: ['grid'], - symbol.attr('scale', size); + defaultOption: { + symbol: 'circle', // Customized bar shape + symbolSize: null, // Can be ['100%', '100%'], null means auto. + symbolRotate: null, - symbol.setColor(color); - symbol.attr('scale', size); + symbolPosition: null, // 'start' or 'end' or 'center', null means auto. + symbolOffset: null, + symbolMargin: null, // start margin and end margin. Can be a number or a percent string. + // Auto margin by defualt. + symbolRepeat: false, // false/null/undefined, means no repeat. + // Can be true, means auto calculate repeat times and cut by data. + // Can be a number, specifies repeat times, and do not cut by data. + // Can be 'fixed', means auto calculate repeat times but do not cut by data. + symbolRepeatDirection: 'end', // 'end' means from 'start' to 'end'. - this._symbolType = symbolType; + symbolClip: false, + symbolBoundingData: null, + symbolPatternSize: 400, // 400 * 400 px - this._updateEffectAnimation(lineData, effectModel, idx); - }; + barGap: '-100%', // In most case, overlap is needed. - effectLineProto._updateEffectAnimation = function (lineData, effectModel, idx) { + // z can be set in data item, which is z2 actually. - var symbol = this.childAt(1); - if (!symbol) { - return; + // Disable progressive + progressive: 0, + hoverAnimation: false // Open only when needed. + }, + + getInitialData: function (option) { + // Disable stack. + option.stack = null; + return PictorialBarSeries.superApply(this, 'getInitialData', arguments); } + }); - var self = this; + module.exports = PictorialBarSeries; - var points = lineData.getItemLayout(idx); - var period = effectModel.get('period') * 1000; - var loop = effectModel.get('loop'); - var constantSpeed = effectModel.get('constantSpeed'); - var delayExpr = zrUtil.retrieve(effectModel.get('delay'), function (idx) { - return idx / lineData.count() * period / 3; - }); - var isDelayFunc = typeof delayExpr === 'function'; +/***/ }, +/* 293 */ +/***/ function(module, exports, __webpack_require__) { - // Ignore when updating - symbol.ignore = true; + - this.updateAnimationPoints(symbol, points); + var zrUtil = __webpack_require__(4); + var graphic = __webpack_require__(44); + var symbolUtil = __webpack_require__(104); + var numberUtil = __webpack_require__(7); + var helper = __webpack_require__(152); - if (constantSpeed > 0) { - period = this.getLineLength(symbol) / constantSpeed * 1000; - } + var parsePercent = numberUtil.parsePercent; - if (period !== this._period || loop !== this._loop) { + var BAR_BORDER_WIDTH_QUERY = ['itemStyle', 'normal', 'borderWidth']; - symbol.stopAnimation(); + // index: +isHorizontal + var LAYOUT_ATTRS = [ + {xy: 'x', wh: 'width', index: 0, posDesc: ['left', 'right']}, + {xy: 'y', wh: 'height', index: 1, posDesc: ['top', 'bottom']} + ]; - var delay = delayExpr; - if (isDelayFunc) { - delay = delayExpr(idx); - } - if (symbol.__t > 0) { - delay = -period * symbol.__t; - } - symbol.__t = 0; - var animator = symbol.animate('', loop) - .when(period, { - __t: 1 - }) - .delay(delay) - .during(function () { - self.updateSymbolPosition(symbol); - }); - if (!loop) { - animator.done(function () { - self.remove(symbol); - }); - } - animator.start(); - } + var pathForLineWidth = new graphic.Circle(); - this._period = period; - this._loop = loop; - }; + var BarView = __webpack_require__(1).extendChartView({ - effectLineProto.getLineLength = function (symbol) { - // Not so accurate - return (vec2.dist(symbol.__p1, symbol.__cp1) - + vec2.dist(symbol.__cp1, symbol.__p2)); - }; + type: 'pictorialBar', - effectLineProto.updateAnimationPoints = function (symbol, points) { - symbol.__p1 = points[0]; - symbol.__p2 = points[1]; - symbol.__cp1 = points[2] || [ - (points[0][0] + points[1][0]) / 2, - (points[0][1] + points[1][1]) / 2 - ]; - }; + render: function (seriesModel, ecModel, api) { + var group = this.group; + var data = seriesModel.getData(); + var oldData = this._data; - effectLineProto.updateData = function (lineData, idx, seriesScope) { - this.childAt(0).updateData(lineData, idx, seriesScope); - this._updateEffectSymbol(lineData, idx); - }; + var cartesian = seriesModel.coordinateSystem; + var baseAxis = cartesian.getBaseAxis(); + var isHorizontal = !!baseAxis.isHorizontal(); + var coordSysRect = cartesian.grid.getRect(); - effectLineProto.updateSymbolPosition = function (symbol) { - var p1 = symbol.__p1; - var p2 = symbol.__p2; - var cp1 = symbol.__cp1; - var t = symbol.__t; - var pos = symbol.position; - var quadraticAt = curveUtil.quadraticAt; - var quadraticDerivativeAt = curveUtil.quadraticDerivativeAt; - pos[0] = quadraticAt(p1[0], cp1[0], p2[0], t); - pos[1] = quadraticAt(p1[1], cp1[1], p2[1], t); + var opt = { + ecSize: {width: api.getWidth(), height: api.getHeight()}, + seriesModel: seriesModel, + coordSys: cartesian, + coordSysExtent: [ + [coordSysRect.x, coordSysRect.x + coordSysRect.width], + [coordSysRect.y, coordSysRect.y + coordSysRect.height] + ], + isHorizontal: isHorizontal, + valueDim: LAYOUT_ATTRS[+isHorizontal], + categoryDim: LAYOUT_ATTRS[1 - isHorizontal] + }; - // Tangent - var tx = quadraticDerivativeAt(p1[0], cp1[0], p2[0], t); - var ty = quadraticDerivativeAt(p1[1], cp1[1], p2[1], t); + data.diff(oldData) + .add(function (dataIndex) { + if (!data.hasValue(dataIndex)) { + return; + } - symbol.rotation = -Math.atan2(ty, tx) - Math.PI / 2; + var itemModel = getItemModel(data, dataIndex); + var symbolMeta = getSymbolMeta(data, dataIndex, itemModel, opt); - symbol.ignore = false; - }; + var bar = createBar(data, opt, symbolMeta); + data.setItemGraphicEl(dataIndex, bar); + group.add(bar); - effectLineProto.updateLayout = function (lineData, idx) { - this.childAt(0).updateLayout(lineData, idx); + updateCommon(bar, opt, symbolMeta); + }) + .update(function (newIndex, oldIndex) { + var bar = oldData.getItemGraphicEl(oldIndex); - var effectModel = lineData.getItemModel(idx).getModel('effect'); - this._updateEffectAnimation(lineData, effectModel, idx); - }; + if (!data.hasValue(newIndex)) { + group.remove(bar); + return; + } - zrUtil.inherits(EffectLine, graphic.Group); + var itemModel = getItemModel(data, newIndex); + var symbolMeta = getSymbolMeta(data, newIndex, itemModel, opt); - module.exports = EffectLine; + var pictorialShapeStr = getShapeStr(data, symbolMeta); + if (bar && pictorialShapeStr !== bar.__pictorialShapeStr) { + group.remove(bar); + data.setItemGraphicEl(newIndex, null); + bar = null; + } + if (bar) { + updateBar(bar, opt, symbolMeta); + } + else { + bar = createBar(data, opt, symbolMeta, true); + } -/***/ }, -/* 268 */ -/***/ function(module, exports, __webpack_require__) { + data.setItemGraphicEl(newIndex, bar); + bar.__pictorialSymbolMeta = symbolMeta; + // Add back + group.add(bar); - /** - * @module echarts/chart/helper/Line - */ + updateCommon(bar, opt, symbolMeta); + }) + .remove(function (dataIndex) { + var bar = oldData.getItemGraphicEl(dataIndex); + bar && removeBar(oldData, dataIndex, bar.__pictorialSymbolMeta.animationModel, bar); + }) + .execute(); + this._data = data; - var graphic = __webpack_require__(43); - var zrUtil = __webpack_require__(4); + return this.group; + }, - /** - * @constructor - * @extends {module:zrender/graphic/Group} - * @alias {module:echarts/chart/helper/Polyline} - */ - function Polyline(lineData, idx, seriesScope) { - graphic.Group.call(this); + dispose: zrUtil.noop, - this._createPolyline(lineData, idx, seriesScope); - } + remove: function (ecModel, api) { + var group = this.group; + var data = this._data; + if (ecModel.get('animation')) { + if (data) { + data.eachItemGraphicEl(function (bar) { + removeBar(data, bar.dataIndex, ecModel, bar); + }); + } + } + else { + group.removeAll(); + } + } + }); - var polylineProto = Polyline.prototype; - polylineProto._createPolyline = function (lineData, idx, seriesScope) { - // var seriesModel = lineData.hostModel; - var points = lineData.getItemLayout(idx); + // Set or calculate default value about symbol, and calculate layout info. + function getSymbolMeta(data, dataIndex, itemModel, opt) { + var layout = data.getItemLayout(dataIndex); + var symbolRepeat = itemModel.get('symbolRepeat'); + var symbolClip = itemModel.get('symbolClip'); + var symbolPosition = itemModel.get('symbolPosition') || 'start'; + var symbolRotate = itemModel.get('symbolRotate'); + var rotation = (symbolRotate || 0) * Math.PI / 180 || 0; + var symbolPatternSize = itemModel.get('symbolPatternSize') || 2; + var isAnimationEnabled = itemModel.isAnimationEnabled(); - var line = new graphic.Polyline({ - shape: { - points: points - } - }); + var symbolMeta = { + dataIndex: dataIndex, + layout: layout, + itemModel: itemModel, + symbolType: data.getItemVisual(dataIndex, 'symbol') || 'circle', + color: data.getItemVisual(dataIndex, 'color'), + symbolClip: symbolClip, + symbolRepeat: symbolRepeat, + symbolRepeatDirection: itemModel.get('symbolRepeatDirection'), + symbolPatternSize: symbolPatternSize, + rotation: rotation, + animationModel: isAnimationEnabled ? itemModel : null, + hoverAnimation: isAnimationEnabled && itemModel.get('hoverAnimation'), + z2: itemModel.getShallow('z', true) || 0 + }; - this.add(line); + prepareBarLength(itemModel, symbolRepeat, layout, opt, symbolMeta); - this._updateCommonStl(lineData, idx, seriesScope); - }; + prepareSymbolSize( + data, dataIndex, layout, symbolRepeat, symbolClip, symbolMeta.boundingLength, + symbolMeta.pxSign, symbolPatternSize, opt, symbolMeta + ); - polylineProto.updateData = function (lineData, idx, seriesScope) { - var seriesModel = lineData.hostModel; + prepareLineWidth(itemModel, symbolMeta.symbolScale, rotation, opt, symbolMeta); - var line = this.childAt(0); - var target = { - shape: { - points: lineData.getItemLayout(idx) - } - }; - graphic.updateProps(line, target, seriesModel, idx); + var symbolSize = symbolMeta.symbolSize; + var symbolOffset = itemModel.get('symbolOffset'); + if (zrUtil.isArray(symbolOffset)) { + symbolOffset = [ + parsePercent(symbolOffset[0], symbolSize[0]), + parsePercent(symbolOffset[1], symbolSize[1]) + ]; + } - this._updateCommonStl(lineData, idx, seriesScope); - }; + prepareLayoutInfo( + itemModel, symbolSize, layout, symbolRepeat, symbolClip, symbolOffset, + symbolPosition, symbolMeta.valueLineWidth, symbolMeta.boundingLength, symbolMeta.repeatCutLength, + opt, symbolMeta + ); - polylineProto._updateCommonStl = function (lineData, idx, seriesScope) { - var line = this.childAt(0); - var itemModel = lineData.getItemModel(idx); + return symbolMeta; + } - var visualColor = lineData.getItemVisual(idx, 'color'); + // bar length can be negative. + function prepareBarLength(itemModel, symbolRepeat, layout, opt, output) { + var valueDim = opt.valueDim; + var symbolBoundingData = itemModel.get('symbolBoundingData'); + var valueAxis = opt.coordSys.getOtherAxis(opt.coordSys.getBaseAxis()); + var zeroPx = valueAxis.toGlobalCoord(valueAxis.dataToCoord(0)); - var lineStyle = seriesScope && seriesScope.lineStyle; - var hoverLineStyle = seriesScope && seriesScope.hoverLineStyle; + var boundingLength = output.boundingLength = symbolBoundingData != null + ? valueAxis.toGlobalCoord(valueAxis.dataToCoord(valueAxis.scale.parse(symbolBoundingData))) - zeroPx + : symbolRepeat + ? opt.coordSysExtent[valueDim.index][1 - +(layout[valueDim.wh] <= 0)] - zeroPx + : layout[valueDim.wh]; - if (!seriesScope || lineData.hasItemOption) { - lineStyle = itemModel.getModel('lineStyle.normal').getLineStyle(); - hoverLineStyle = itemModel.getModel('lineStyle.emphasis').getLineStyle(); + if (symbolRepeat) { + output.repeatCutLength = layout[valueDim.wh]; } - line.useStyle(zrUtil.defaults( - { - strokeNoScale: true, - fill: 'none', - stroke: visualColor - }, - lineStyle - )); - line.hoverStyle = hoverLineStyle; - graphic.setHoverStyle(this); - }; + output.pxSign = boundingLength > 0 ? 1 : boundingLength < 0 ? -1 : 0; + } - polylineProto.updateLayout = function (lineData, idx) { - var polyline = this.childAt(0); - polyline.setShape('points', lineData.getItemLayout(idx)); - }; + // Support ['100%', '100%'] + function prepareSymbolSize( + data, dataIndex, layout, symbolRepeat, symbolClip, boundingLength, + pxSign, symbolPatternSize, opt, output + ) { + var valueDim = opt.valueDim; + var categoryDim = opt.categoryDim; + var categorySize = Math.abs(layout[categoryDim.wh]); - zrUtil.inherits(Polyline, graphic.Group); + var symbolSize = data.getItemVisual(dataIndex, 'symbolSize'); + if (zrUtil.isArray(symbolSize)) { + symbolSize = symbolSize.slice(); + } + else { + if (symbolSize == null) { + symbolSize = '100%'; + } + symbolSize = [symbolSize, symbolSize]; + } - module.exports = Polyline; + // Note: percentage symbolSize (like '100%') do not consider lineWidth, because it is + // to complicated to calculate real percent value if considering scaled lineWidth. + // So the actual size will bigger than layout size if lineWidth is bigger than zero, + // which can be tolerated in pictorial chart. + symbolSize[categoryDim.index] = parsePercent( + symbolSize[categoryDim.index], + categorySize + ); + symbolSize[valueDim.index] = parsePercent( + symbolSize[valueDim.index], + symbolRepeat ? categorySize : Math.abs(boundingLength) + ); -/***/ }, -/* 269 */ -/***/ function(module, exports, __webpack_require__) { + output.symbolSize = symbolSize; - /** - * Provide effect for line - * @module echarts/chart/helper/EffectLine - */ + // If x or y is less than zero, show reversed shape. + var symbolScale = output.symbolScale = [ + symbolSize[0] / symbolPatternSize, + symbolSize[1] / symbolPatternSize + ]; + // Follow convention, 'right' and 'top' is the normal scale. + symbolScale[valueDim.index] *= (opt.isHorizontal ? -1 : 1) * pxSign; + } + function prepareLineWidth(itemModel, symbolScale, rotation, opt, output) { + // In symbols are drawn with scale, so do not need to care about the case that width + // or height are too small. But symbol use strokeNoScale, where acture lineWidth should + // be calculated. + var valueLineWidth = itemModel.get(BAR_BORDER_WIDTH_QUERY) || 0; - var Polyline = __webpack_require__(268); - var zrUtil = __webpack_require__(4); - var EffectLine = __webpack_require__(267); - var vec2 = __webpack_require__(10); + if (valueLineWidth) { + pathForLineWidth.attr({ + scale: symbolScale.slice(), + rotation: rotation + }); + pathForLineWidth.updateTransform(); + valueLineWidth /= pathForLineWidth.getLineScale(); + valueLineWidth *= symbolScale[opt.valueDim.index]; + } - /** - * @constructor - * @extends {module:echarts/chart/helper/EffectLine} - * @alias {module:echarts/chart/helper/Polyline} - */ - function EffectPolyline(lineData, idx, seriesScope) { - EffectLine.call(this, lineData, idx, seriesScope); - this._lastFrame = 0; - this._lastFramePercent = 0; + output.valueLineWidth = valueLineWidth; } - var effectPolylineProto = EffectPolyline.prototype; + function prepareLayoutInfo( + itemModel, symbolSize, layout, symbolRepeat, symbolClip, symbolOffset, + symbolPosition, valueLineWidth, boundingLength, repeatCutLength, opt, output + ) { + var categoryDim = opt.categoryDim; + var valueDim = opt.valueDim; + var pxSign = output.pxSign; - // Overwrite - effectPolylineProto.createLine = function (lineData, idx, seriesScope) { - return new Polyline(lineData, idx, seriesScope); - }; + var unitLength = Math.max(symbolSize[valueDim.index] + valueLineWidth, 0); + var pathLen = unitLength; - // Overwrite - effectPolylineProto.updateAnimationPoints = function (symbol, points) { - this._points = points; - var accLenArr = [0]; - var len = 0; - for (var i = 1; i < points.length; i++) { - var p1 = points[i - 1]; - var p2 = points[i]; - len += vec2.dist(p1, p2); - accLenArr.push(len); - } - if (len === 0) { - return; - } + // Note: rotation will not effect the layout of symbols, because user may + // want symbols to rotate on its center, which should not be translated + // when rotating. - for (var i = 0; i < accLenArr.length; i++) { - accLenArr[i] /= len; - } - this._offsets = accLenArr; - this._length = len; - }; + if (symbolRepeat) { + var absBoundingLength = Math.abs(boundingLength); - // Overwrite - effectPolylineProto.getLineLength = function (symbol) { - return this._length; - }; + var symbolMargin = zrUtil.retrieve(itemModel.get('symbolMargin'), '15%') + ''; + var hasEndGap = false; + if (symbolMargin.lastIndexOf('!') === symbolMargin.length - 1) { + hasEndGap = true; + symbolMargin = symbolMargin.slice(0, symbolMargin.length - 1); + } + symbolMargin = parsePercent(symbolMargin, symbolSize[valueDim.index]); - // Overwrite - effectPolylineProto.updateSymbolPosition = function (symbol) { - var t = symbol.__t; - var points = this._points; - var offsets = this._offsets; - var len = points.length; + var uLenWithMargin = Math.max(unitLength + symbolMargin * 2, 0); - if (!offsets) { - // Has length 0 - return; - } + // When symbol margin is less than 0, margin at both ends will be subtracted + // to ensure that all of the symbols will not be overflow the given area. + var endFix = hasEndGap ? 0 : symbolMargin * 2; - var lastFrame = this._lastFrame; - var frame; + // Both final repeatTimes and final symbolMargin area calculated based on + // boundingLength. + var repeatSpecified = numberUtil.isNumeric(symbolRepeat); + var repeatTimes = repeatSpecified + ? symbolRepeat + : toIntTimes((absBoundingLength + endFix) / uLenWithMargin); - if (t < this._lastFramePercent) { - // Start from the next frame - // PENDING start from lastFrame ? - var start = Math.min(lastFrame + 1, len - 1); - for (frame = start; frame >= 0; frame--) { - if (offsets[frame] <= t) { - break; - } - } - // PENDING really need to do this ? - frame = Math.min(frame, len - 2); - } - else { - for (var frame = lastFrame; frame < len; frame++) { - if (offsets[frame] > t) { - break; - } - } - frame = Math.min(frame - 1, len - 2); - } + // Adjust calculate margin, to ensure each symbol is displayed + // entirely in the given layout area. + var mDiff = absBoundingLength - repeatTimes * unitLength; + symbolMargin = mDiff / 2 / (hasEndGap ? repeatTimes : repeatTimes - 1); + uLenWithMargin = unitLength + symbolMargin * 2; + endFix = hasEndGap ? 0 : symbolMargin * 2; - vec2.lerp( - symbol.position, points[frame], points[frame + 1], - (t - offsets[frame]) / (offsets[frame + 1] - offsets[frame]) - ); + // Update repeatTimes when not all symbol will be shown. + if (!repeatSpecified && symbolRepeat !== 'fixed') { + repeatTimes = repeatCutLength + ? toIntTimes((Math.abs(repeatCutLength) + endFix) / uLenWithMargin) + : 0; + } - var tx = points[frame + 1][0] - points[frame][0]; - var ty = points[frame + 1][1] - points[frame][1]; - symbol.rotation = -Math.atan2(ty, tx) - Math.PI / 2; + pathLen = repeatTimes * uLenWithMargin - endFix; + output.repeatTimes = repeatTimes; + output.symbolMargin = symbolMargin; + } - this._lastFrame = frame; - this._lastFramePercent = t; + var sizeFix = pxSign * (pathLen / 2); + var pathPosition = output.pathPosition = []; + pathPosition[categoryDim.index] = layout[categoryDim.wh] / 2; + pathPosition[valueDim.index] = symbolPosition === 'start' + ? sizeFix + : symbolPosition === 'end' + ? boundingLength - sizeFix + : boundingLength / 2; // 'center' + if (symbolOffset) { + pathPosition[0] += symbolOffset[0]; + pathPosition[1] += symbolOffset[1]; + } - symbol.ignore = false; - }; + var bundlePosition = output.bundlePosition = []; + bundlePosition[categoryDim.index] = layout[categoryDim.xy]; + bundlePosition[valueDim.index] = layout[valueDim.xy]; - zrUtil.inherits(EffectPolyline, EffectLine); + var barRectShape = output.barRectShape = zrUtil.extend({}, layout); + barRectShape[valueDim.wh] = pxSign * Math.max( + Math.abs(layout[valueDim.wh]), Math.abs(pathPosition[valueDim.index] + sizeFix) + ); + barRectShape[categoryDim.wh] = layout[categoryDim.wh]; - module.exports = EffectPolyline; + var clipShape = output.clipShape = {}; + // Consider that symbol may be overflow layout rect. + clipShape[categoryDim.xy] = -layout[categoryDim.xy]; + clipShape[categoryDim.wh] = opt.ecSize[categoryDim.wh]; + clipShape[valueDim.xy] = 0; + clipShape[valueDim.wh] = layout[valueDim.wh]; + } + function createPath(symbolMeta) { + var symbolPatternSize = symbolMeta.symbolPatternSize; + var path = symbolUtil.createSymbol( + // Consider texture img, make a big size. + symbolMeta.symbolType, + -symbolPatternSize / 2, + -symbolPatternSize / 2, + symbolPatternSize, + symbolPatternSize, + symbolMeta.color + ); + path.attr({ + culling: true + }); + path.type !== 'image' && path.setStyle({ + strokeNoScale: true + }); -/***/ }, -/* 270 */ -/***/ function(module, exports, __webpack_require__) { + return path; + } - // TODO Batch by color + function createOrUpdateRepeatSymbols(bar, opt, symbolMeta, isUpdate) { + var bundle = bar.__pictorialBundle; + var symbolSize = symbolMeta.symbolSize; + var valueLineWidth = symbolMeta.valueLineWidth; + var pathPosition = symbolMeta.pathPosition; + var valueDim = opt.valueDim; + var repeatTimes = symbolMeta.repeatTimes || 0; + var index = 0; + var unit = symbolSize[opt.valueDim.index] + valueLineWidth + symbolMeta.symbolMargin * 2; + eachPath(bar, function (path) { + path.__pictorialAnimationIndex = index; + path.__pictorialRepeatTimes = repeatTimes; + if (index < repeatTimes) { + updateAttr(path, null, makeTarget(index), symbolMeta, isUpdate); + } + else { + updateAttr(path, null, {scale: [0, 0]}, symbolMeta, isUpdate, function () { + bundle.remove(path); + }); + } - var graphic = __webpack_require__(43); + updateHoverAnimation(path, symbolMeta); - var quadraticContain = __webpack_require__(55); - var lineContain = __webpack_require__(53); + index++; + }); - var LargeLineShape = graphic.extendShape({ - shape: { - polyline: false, + for (; index < repeatTimes; index++) { + var path = createPath(symbolMeta); + path.__pictorialAnimationIndex = index; + path.__pictorialRepeatTimes = repeatTimes; + bundle.add(path); - segs: [] - }, + var target = makeTarget(index, true); - buildPath: function (path, shape) { - var segs = shape.segs; - var isPolyline = shape.polyline; + updateAttr( + path, + { + position: target.position, + scale: [0, 0] + }, + { + scale: target.scale, + rotation: target.rotation + }, + symbolMeta, + isUpdate + ); - for (var i = 0; i < segs.length; i++) { - var seg = segs[i]; - if (isPolyline) { - path.moveTo(seg[0][0], seg[0][1]); - for (var j = 1; j < seg.length; j++) { - path.lineTo(seg[j][0], seg[j][1]); - } - } - else { - path.moveTo(seg[0][0], seg[0][1]); - if (seg.length > 2) { - path.quadraticCurveTo(seg[2][0], seg[2][1], seg[1][0], seg[1][1]); - } - else { - path.lineTo(seg[1][0], seg[1][1]); - } - } - } - }, + // FIXME + // If all emphasis/normal through action. + path + .on('mouseover', onMouseOver) + .on('mouseout', onMouseOut); - findDataIndex: function (x, y) { - var shape = this.shape; - var segs = shape.segs; - var isPolyline = shape.polyline; - var lineWidth = Math.max(this.style.lineWidth, 1); + updateHoverAnimation(path, symbolMeta); + } - // Not consider transform - for (var i = 0; i < segs.length; i++) { - var seg = segs[i]; - if (isPolyline) { - for (var j = 1; j < seg.length; j++) { - if (lineContain.containStroke( - seg[j - 1][0], seg[j - 1][1], seg[j][0], seg[j][1], lineWidth, x, y - )) { - return i; - } - } - } - else { - if (seg.length > 2) { - if (quadraticContain.containStroke( - seg[0][0], seg[0][1], seg[2][0], seg[2][1], seg[1][0], seg[1][1], lineWidth, x, y - )) { - return i; - } - } - else { - if (lineContain.containStroke( - seg[0][0], seg[0][1], seg[1][0], seg[1][1], lineWidth, x, y - )) { - return i; - } - } - } + function makeTarget(index) { + var position = pathPosition.slice(); + // (start && pxSign > 0) || (end && pxSign < 0): i = repeatTimes - index + // Otherwise: i = index; + var pxSign = symbolMeta.pxSign; + var i = index; + if (symbolMeta.symbolRepeatDirection === 'start' ? pxSign > 0 : pxSign < 0) { + i = repeatTimes - 1 - index; } + position[valueDim.index] = unit * (i - repeatTimes / 2 + 0.5) + pathPosition[valueDim.index]; - return -1; + return { + position: position, + scale: symbolMeta.symbolScale.slice(), + rotation: symbolMeta.rotation + }; } - }); - function LargeLineDraw() { - this.group = new graphic.Group(); + function onMouseOver() { + eachPath(bar, function (path) { + path.trigger('emphasis'); + }); + } - this._lineEl = new LargeLineShape(); + function onMouseOut() { + eachPath(bar, function (path) { + path.trigger('normal'); + }); + } } - var largeLineProto = LargeLineDraw.prototype; - - /** - * Update symbols draw by new data - * @param {module:echarts/data/List} data - */ - largeLineProto.updateData = function (data) { - this.group.removeAll(); + function createOrUpdateSingleSymbol(bar, opt, symbolMeta, isUpdate) { + var bundle = bar.__pictorialBundle; + var mainPath = bar.__pictorialMainPath; - var lineEl = this._lineEl; + if (!mainPath) { + mainPath = bar.__pictorialMainPath = createPath(symbolMeta); + bundle.add(mainPath); - var seriesModel = data.hostModel; + updateAttr( + mainPath, + { + position: symbolMeta.pathPosition.slice(), + scale: [0, 0], + rotation: symbolMeta.rotation + }, + { + scale: symbolMeta.symbolScale.slice() + }, + symbolMeta, + isUpdate + ); - lineEl.setShape({ - segs: data.mapArray(data.getItemLayout), - polyline: seriesModel.get('polyline') - }); + mainPath + .on('mouseover', onMouseOver) + .on('mouseout', onMouseOut); + } + else { + updateAttr( + mainPath, + null, + { + position: symbolMeta.pathPosition.slice(), + scale: symbolMeta.symbolScale.slice(), + rotation: symbolMeta.rotation + }, + symbolMeta, + isUpdate + ); + } - lineEl.useStyle( - seriesModel.getModel('lineStyle.normal').getLineStyle() - ); + updateHoverAnimation(mainPath, symbolMeta); - var visualColor = data.getVisual('color'); - if (visualColor) { - lineEl.setStyle('stroke', visualColor); + function onMouseOver() { + this.trigger('emphasis'); } - lineEl.setStyle('fill'); - - // Enable tooltip - // PENDING May have performance issue when path is extremely large - lineEl.seriesIndex = seriesModel.seriesIndex; - lineEl.on('mousemove', function (e) { - lineEl.dataIndex = null; - var dataIndex = lineEl.findDataIndex(e.offsetX, e.offsetY); - if (dataIndex > 0) { - // Provide dataIndex for tooltip - lineEl.dataIndex = dataIndex; - } - }); - // Add back - this.group.add(lineEl); - }; + function onMouseOut() { + this.trigger('normal'); + } + } - largeLineProto.updateLayout = function (seriesModel) { - var data = seriesModel.getData(); - this._lineEl.setShape({ - segs: data.mapArray(data.getItemLayout) - }); - }; + // bar rect is used for label. + function createOrUpdateBarRect(bar, symbolMeta, isUpdate) { + var rectShape = zrUtil.extend({}, symbolMeta.barRectShape); - largeLineProto.remove = function () { - this.group.removeAll(); - }; + var barRect = bar.__pictorialBarRect; + if (!barRect) { + barRect = bar.__pictorialBarRect = new graphic.Rect({ + z2: 2, + shape: rectShape, + silent: true, + style: { + stroke: 'transparent', + fill: 'transparent', + lineWidth: 0 + } + }); - module.exports = LargeLineDraw; + bar.add(barRect); + } + else { + updateAttr(barRect, null, {shape: rectShape}, symbolMeta, isUpdate); + } + } + function createOrUpdateClip(bar, opt, symbolMeta, isUpdate) { + // If not clip, symbol will be remove and rebuilt. + if (symbolMeta.symbolClip) { + var clipPath = bar.__pictorialClipPath; + var clipShape = zrUtil.extend({}, symbolMeta.clipShape); + var valueDim = opt.valueDim; + var animationModel = symbolMeta.animationModel; + var dataIndex = symbolMeta.dataIndex; -/***/ }, -/* 271 */ -/***/ function(module, exports, __webpack_require__) { + if (clipPath) { + graphic.updateProps( + clipPath, {shape: clipShape}, animationModel, dataIndex + ); + } + else { + clipShape[valueDim.wh] = 0; + clipPath = new graphic.Rect({shape: clipShape}); + bar.__pictorialBundle.setClipPath(clipPath); + bar.__pictorialClipPath = clipPath; - + var target = {}; + target[valueDim.wh] = symbolMeta.clipShape[valueDim.wh]; - module.exports = function (ecModel) { - ecModel.eachSeriesByType('lines', function (seriesModel) { - var coordSys = seriesModel.coordinateSystem; - var lineData = seriesModel.getData(); + graphic[isUpdate ? 'updateProps' : 'initProps']( + clipPath, {shape: target}, animationModel, dataIndex + ); + } + } + } - // FIXME Use data dimensions ? - lineData.each(function (idx) { - var itemModel = lineData.getItemModel(idx); - // TODO Support pure array - var coords = (itemModel.option instanceof Array) ? - itemModel.option : itemModel.get('coords'); + function getItemModel(data, dataIndex) { + var itemModel = data.getItemModel(dataIndex); + itemModel.getAnimationDelayParams = getAnimationDelayParams; + itemModel.isAnimationEnabled = isAnimationEnabled; + return itemModel; + } - if (true) { - if (!(coords instanceof Array && coords.length > 0 && coords[0] instanceof Array)) { - throw new Error('Invalid coords ' + JSON.stringify(coords) + '. Lines must have 2d coords array in data item.'); - } - } - var pts = []; + function getAnimationDelayParams(path) { + // The order is the same as the z-order, see `symbolRepeatDiretion`. + return { + index: path.__pictorialAnimationIndex, + count: path.__pictorialRepeatTimes + }; + } - if (seriesModel.get('polyline')) { - for (var i = 0; i < coords.length; i++) { - pts.push(coordSys.dataToPoint(coords[i])); - } - } - else { - pts[0] = coordSys.dataToPoint(coords[0]); - pts[1] = coordSys.dataToPoint(coords[1]); + function isAnimationEnabled() { + // `animation` prop can be set on itemModel in pictorial bar chart. + return this.parentModel.isAnimationEnabled() && !!this.getShallow('animation'); + } - var curveness = itemModel.get('lineStyle.normal.curveness'); - if (+curveness) { - pts[2] = [ - (pts[0][0] + pts[1][0]) / 2 - (pts[0][1] - pts[1][1]) * curveness, - (pts[0][1] + pts[1][1]) / 2 - (pts[1][0] - pts[0][0]) * curveness - ]; - } - } - lineData.setItemLayout(idx, pts); - }); - }); - }; + function updateHoverAnimation(path, symbolMeta) { + path.off('emphasis').off('normal'); + var scale = symbolMeta.symbolScale.slice(); -/***/ }, -/* 272 */ -/***/ function(module, exports) { + symbolMeta.hoverAnimation && path + .on('emphasis', function() { + this.animateTo({ + scale: [scale[0] * 1.1, scale[1] * 1.1] + }, 400, 'elasticOut'); + }) + .on('normal', function() { + this.animateTo({ + scale: scale.slice() + }, 400, 'elasticOut'); + }); + } - + function createBar(data, opt, symbolMeta, isUpdate) { + // bar is the main element for each data. + var bar = new graphic.Group(); + // bundle is used for location and clip. + var bundle = new graphic.Group(); + bar.add(bundle); + bar.__pictorialBundle = bundle; + bundle.attr('position', symbolMeta.bundlePosition.slice()); - function normalize(a) { - if (!(a instanceof Array)) { - a = [a, a]; + if (symbolMeta.symbolRepeat) { + createOrUpdateRepeatSymbols(bar, opt, symbolMeta); + } + else { + createOrUpdateSingleSymbol(bar, opt, symbolMeta); } - return a; - } - module.exports = function (ecModel) { - ecModel.eachSeriesByType('lines', function (seriesModel) { - var data = seriesModel.getData(); - var symbolType = normalize(seriesModel.get('symbol')); - var symbolSize = normalize(seriesModel.get('symbolSize')); - var opacityQuery = 'lineStyle.normal.opacity'.split('.'); + createOrUpdateBarRect(bar, symbolMeta, isUpdate); - data.setVisual('fromSymbol', symbolType && symbolType[0]); - data.setVisual('toSymbol', symbolType && symbolType[1]); - data.setVisual('fromSymbolSize', symbolSize && symbolSize[0]); - data.setVisual('toSymbolSize', symbolSize && symbolSize[1]); - data.setVisual('opacity', seriesModel.get(opacityQuery)); + createOrUpdateClip(bar, opt, symbolMeta, isUpdate); - data.each(function (idx) { - var itemModel = data.getItemModel(idx); - var symbolType = normalize(itemModel.getShallow('symbol', true)); - var symbolSize = normalize(itemModel.getShallow('symbolSize', true)); - var opacity = itemModel.get(opacityQuery); + bar.__pictorialShapeStr = getShapeStr(data, symbolMeta); + bar.__pictorialSymbolMeta = symbolMeta; - symbolType[0] && data.setItemVisual(idx, 'fromSymbol', symbolType[0]); - symbolType[1] && data.setItemVisual(idx, 'toSymbol', symbolType[1]); - symbolSize[0] && data.setItemVisual(idx, 'fromSymbolSize', symbolSize[0]); - symbolSize[1] && data.setItemVisual(idx, 'toSymbolSize', symbolSize[1]); + return bar; + } - data.setItemVisual(idx, 'opacity', opacity); - }); - }); - }; + function updateBar(bar, opt, symbolMeta) { + var animationModel = symbolMeta.animationModel; + var dataIndex = symbolMeta.dataIndex; + var bundle = bar.__pictorialBundle; + graphic.updateProps( + bundle, {position: symbolMeta.bundlePosition.slice()}, animationModel, dataIndex + ); -/***/ }, -/* 273 */ -/***/ function(module, exports, __webpack_require__) { + if (symbolMeta.symbolRepeat) { + createOrUpdateRepeatSymbols(bar, opt, symbolMeta, true); + } + else { + createOrUpdateSingleSymbol(bar, opt, symbolMeta, true); + } - + createOrUpdateBarRect(bar, symbolMeta, true); - __webpack_require__(274); - __webpack_require__(275); + createOrUpdateClip(bar, opt, symbolMeta, true); + } + function removeBar(data, dataIndex, animationModel, bar) { + // Not show text when animating + var labelRect = bar.__pictorialBarRect; + labelRect && (labelRect.style.text = ''); -/***/ }, -/* 274 */ -/***/ function(module, exports, __webpack_require__) { + var pathes = []; + eachPath(bar, function (path) { + pathes.push(path); + }); + bar.__pictorialMainPath && pathes.push(bar.__pictorialMainPath); - + // I do not find proper remove animation for clip yet. + bar.__pictorialClipPath && (animationModel = null); - var SeriesModel = __webpack_require__(28); - var createListFromArray = __webpack_require__(102); + zrUtil.each(pathes, function (path) { + graphic.updateProps( + path, {scale: [0, 0]}, animationModel, dataIndex, + function () { + bar.parent && bar.parent.remove(bar); + } + ); + }); - module.exports = SeriesModel.extend({ - type: 'series.heatmap', + data.setItemGraphicEl(dataIndex, null); + } - getInitialData: function (option, ecModel) { - return createListFromArray(option.data, this, ecModel); - }, + function getShapeStr(data, symbolMeta) { + return [ + data.getItemVisual(symbolMeta.dataIndex, 'symbol') || 'none', + !!symbolMeta.symbolRepeat, + !!symbolMeta.symbolClip + ].join(':'); + } - defaultOption: { + function eachPath(bar, cb, context) { + // Do not use Group#eachChild, because it do not support remove. + zrUtil.each(bar.__pictorialBundle.children(), function (el) { + el !== bar.__pictorialBarRect && cb.call(context, el); + }); + } - // Cartesian2D or geo - coordinateSystem: 'cartesian2d', + function updateAttr(el, immediateAttrs, animationAttrs, symbolMeta, isUpdate, cb) { + immediateAttrs && el.attr(immediateAttrs); + // when symbolCip used, only clip path has init animation, otherwise it would be weird effect. + if (symbolMeta.symbolClip && !isUpdate) { + animationAttrs && el.attr(animationAttrs); + } + else { + animationAttrs && graphic[isUpdate ? 'updateProps' : 'initProps']( + el, animationAttrs, symbolMeta.animationModel, symbolMeta.dataIndex, cb + ); + } + } - zlevel: 0, + function updateCommon(bar, opt, symbolMeta) { + var color = symbolMeta.color; + var dataIndex = symbolMeta.dataIndex; + var itemModel = symbolMeta.itemModel; + // Color must be excluded. + // Because symbol provide setColor individually to set fill and stroke + var normalStyle = itemModel.getModel('itemStyle.normal').getItemStyle(['color']); + var hoverStyle = itemModel.getModel('itemStyle.emphasis').getItemStyle(); - z: 2, + eachPath(bar, function (path) { + // PENDING setColor should be before setStyle!!! + path.setColor(color); + path.setStyle(zrUtil.defaults( + { + fill: color, + opacity: symbolMeta.opacity + }, + normalStyle + )); + graphic.setHoverStyle(path, hoverStyle); - // Cartesian coordinate system - // xAxisIndex: 0, - // yAxisIndex: 0, + path.z2 = symbolMeta.z2; + }); - // Geo coordinate system - geoIndex: 0, + var barRectHoverStyle = {}; + var barPositionOutside = opt.valueDim.posDesc[+(symbolMeta.boundingLength > 0)]; + var barRect = bar.__pictorialBarRect; - blurSize: 30, + helper.setLabel( + barRect.style, barRectHoverStyle, itemModel, + color, opt.seriesModel, dataIndex, barPositionOutside + ); - pointSize: 20, + graphic.setHoverStyle(barRect, barRectHoverStyle); + } - maxOpacity: 1, + function toIntTimes(times) { + var roundedTimes = Math.round(times); + // Escapse accurate error + return Math.abs(times - roundedTimes) < 1e-4 + ? roundedTimes + : Math.ceil(times); + } - minOpacity: 0 - } - }); + module.exports = BarView; /***/ }, -/* 275 */ +/* 294 */ /***/ function(module, exports, __webpack_require__) { - var graphic = __webpack_require__(43); - var HeatmapLayer = __webpack_require__(276); + var echarts = __webpack_require__(1); var zrUtil = __webpack_require__(4); - function getIsInPiecewiseRange(dataExtent, pieceList, selected) { - var dataSpan = dataExtent[1] - dataExtent[0]; - pieceList = zrUtil.map(pieceList, function (piece) { - return { - interval: [ - (piece.interval[0] - dataExtent[0]) / dataSpan, - (piece.interval[1] - dataExtent[0]) / dataSpan - ] - }; - }); - var len = pieceList.length; - var lastIndex = 0; - return function (val) { - // Try to find in the location of the last found - for (var i = lastIndex; i < len; i++) { - var interval = pieceList[i].interval; - if (interval[0] <= val && val <= interval[1]) { - lastIndex = i; - break; - } - } - if (i === len) { // Not found, back interation - for (var i = lastIndex - 1; i >= 0; i--) { - var interval = pieceList[i].interval; - if (interval[0] <= val && val <= interval[1]) { - lastIndex = i; - break; - } - } - } - return i >= 0 && i < len && selected[i]; - }; - } - - function getIsInContinuousRange(dataExtent, range) { - var dataSpan = dataExtent[1] - dataExtent[0]; - range = [ - (range[0] - dataExtent[0]) / dataSpan, - (range[1] - dataExtent[0]) / dataSpan - ]; - return function (val) { - return val >= range[0] && val <= range[1]; - }; - } + __webpack_require__(295); - function isGeoCoordSys(coordSys) { - var dimensions = coordSys.dimensions; - // Not use coorSys.type === 'geo' because coordSys maybe extended - return dimensions[0] === 'lng' && dimensions[1] === 'lat'; - } + __webpack_require__(303); - module.exports = __webpack_require__(1).extendChartView({ + __webpack_require__(304); - type: 'heatmap', + echarts.registerLayout(__webpack_require__(306)); - render: function (seriesModel, ecModel, api) { - var visualMapOfThisSeries; - ecModel.eachComponent('visualMap', function (visualMap) { - visualMap.eachTargetSeries(function (targetSeries) { - if (targetSeries === seriesModel) { - visualMapOfThisSeries = visualMap; - } - }); - }); + echarts.registerVisual(__webpack_require__(307)); - if (true) { - if (!visualMapOfThisSeries) { - throw new Error('Heatmap must use with visualMap'); - } - } + echarts.registerProcessor( + zrUtil.curry(__webpack_require__(163), 'themeRiver') + ); - this.group.removeAll(); - var coordSys = seriesModel.coordinateSystem; - if (coordSys.type === 'cartesian2d') { - this._renderOnCartesian(coordSys, seriesModel, api); - } - else if (isGeoCoordSys(coordSys)) { - this._renderOnGeo( - coordSys, seriesModel, visualMapOfThisSeries, api - ); - } - }, - dispose: function () {}, +/***/ }, +/* 295 */ +/***/ function(module, exports, __webpack_require__) { - _renderOnCartesian: function (cartesian, seriesModel, api) { - var xAxis = cartesian.getAxis('x'); - var yAxis = cartesian.getAxis('y'); - var group = this.group; + - if (true) { - if (!(xAxis.type === 'category' && yAxis.type === 'category')) { - throw new Error('Heatmap on cartesian must have two category axes'); - } - if (!(xAxis.onBand && yAxis.onBand)) { - throw new Error('Heatmap on cartesian must have two axes with boundaryGap true'); - } - } + __webpack_require__(296); + __webpack_require__(299); + __webpack_require__(302); + __webpack_require__(142); - var width = xAxis.getBandWidth(); - var height = yAxis.getBandWidth(); + var echarts = __webpack_require__(1); - var data = seriesModel.getData(); + echarts.extendComponentView({ + type: 'single' + }); - var itemStyleQuery = 'itemStyle.normal'; - var hoverItemStyleQuery = 'itemStyle.emphasis'; - var labelQuery = 'label.normal'; - var hoverLabelQuery = 'label.emphasis'; - var style = seriesModel.getModel(itemStyleQuery).getItemStyle(['color']); - var hoverStl = seriesModel.getModel(hoverItemStyleQuery).getItemStyle(); - var labelModel = seriesModel.getModel('label.normal'); - var hoverLabelModel = seriesModel.getModel('label.emphasis'); - data.each(['x', 'y', 'z'], function (x, y, z, idx) { - var itemModel = data.getItemModel(idx); - var point = cartesian.dataToPoint([x, y]); - // Ignore empty data - if (isNaN(z)) { - return; - } - var rect = new graphic.Rect({ - shape: { - x: point[0] - width / 2, - y: point[1] - height / 2, - width: width, - height: height - }, - style: { - fill: data.getItemVisual(idx, 'color'), - opacity: data.getItemVisual(idx, 'opacity') - } - }); - // Optimization for large datset - if (data.hasItemOption) { - style = itemModel.getModel(itemStyleQuery).getItemStyle(['color']); - hoverStl = itemModel.getModel(hoverItemStyleQuery).getItemStyle(); - labelModel = itemModel.getModel(labelQuery); - hoverLabelModel = itemModel.getModel(hoverLabelQuery); - } - var rawValue = seriesModel.getRawValue(idx); - var defaultText = '-'; - if (rawValue && rawValue[2] != null) { - defaultText = rawValue[2]; - } - if (labelModel.getShallow('show')) { - graphic.setText(style, labelModel); - style.text = seriesModel.getFormattedLabel(idx, 'normal') || defaultText; - } - if (hoverLabelModel.getShallow('show')) { - graphic.setText(hoverStl, hoverLabelModel); - hoverStl.text = seriesModel.getFormattedLabel(idx, 'emphasis') || defaultText; - } +/***/ }, +/* 296 */ +/***/ function(module, exports, __webpack_require__) { - rect.setStyle(style); + /** + * Single coordinate system creator. + */ - graphic.setHoverStyle(rect, data.hasItemOption ? hoverStl : zrUtil.extend({}, hoverStl)); - group.add(rect); - data.setItemGraphicEl(idx, rect); - }); - }, + var Single = __webpack_require__(297); - _renderOnGeo: function (geo, seriesModel, visualMapModel, api) { - var inRangeVisuals = visualMapModel.targetVisuals.inRange; - var outOfRangeVisuals = visualMapModel.targetVisuals.outOfRange; - // if (!visualMapping) { - // throw new Error('Data range must have color visuals'); - // } + /** + * Create single coordinate system and inject it into seriesModel. + * + * @param {module:echarts/model/Global} ecModel + * @param {module:echarts/ExtensionAPI} api + * @return {Array.} + */ + function create(ecModel, api) { + var singles = []; - var data = seriesModel.getData(); - var hmLayer = this._hmLayer || (this._hmLayer || new HeatmapLayer()); - hmLayer.blurSize = seriesModel.get('blurSize'); - hmLayer.pointSize = seriesModel.get('pointSize'); - hmLayer.minOpacity = seriesModel.get('minOpacity'); - hmLayer.maxOpacity = seriesModel.get('maxOpacity'); + ecModel.eachComponent('singleAxis', function(axisModel, idx) { - var rect = geo.getViewRect().clone(); - var roamTransform = geo.getRoamTransform().transform; - rect.applyTransform(roamTransform); + var single = new Single(axisModel, ecModel, api); + single.name = 'single_' + idx; + single.resize(axisModel, api); + axisModel.coordinateSystem = single; + singles.push(single); - // Clamp on viewport - var x = Math.max(rect.x, 0); - var y = Math.max(rect.y, 0); - var x2 = Math.min(rect.width + rect.x, api.getWidth()); - var y2 = Math.min(rect.height + rect.y, api.getHeight()); - var width = x2 - x; - var height = y2 - y; + }); - var points = data.mapArray(['lng', 'lat', 'value'], function (lng, lat, value) { - var pt = geo.dataToPoint([lng, lat]); - pt[0] -= x; - pt[1] -= y; - pt.push(value); - return pt; - }); + ecModel.eachSeries(function (seriesModel) { + if (seriesModel.get('coordinateSystem') === 'singleAxis') { + var singleAxisModel = ecModel.queryComponents({ + mainType: 'singleAxis', + index: seriesModel.get('singleAxisIndex'), + id: seriesModel.get('singleAxisId') + })[0]; + seriesModel.coordinateSystem = singleAxisModel && singleAxisModel.coordinateSystem; + } + }); - var dataExtent = visualMapModel.getExtent(); - var isInRange = visualMapModel.type === 'visualMap.continuous' - ? getIsInContinuousRange(dataExtent, visualMapModel.option.range) - : getIsInPiecewiseRange( - dataExtent, visualMapModel.getPieceList(), visualMapModel.option.selected - ); + return singles; + } - hmLayer.update( - points, width, height, - inRangeVisuals.color.getNormalizer(), - { - inRange: inRangeVisuals.color.getColorMapper(), - outOfRange: outOfRangeVisuals.color.getColorMapper() - }, - isInRange - ); - var img = new graphic.Image({ - style: { - width: width, - height: height, - x: x, - y: y, - image: hmLayer.canvas - }, - silent: true - }); - this.group.add(img); - } + __webpack_require__(26).register('single', { + create: create, + dimensions: Single.prototype.dimensions }); /***/ }, -/* 276 */ +/* 297 */ /***/ function(module, exports, __webpack_require__) { /** - * @file defines echarts Heatmap Chart - * @author Ovilia (me@zhangwenli.com) - * Inspired by https://github.com/mourner/simpleheat - * - * @module + * Single coordinates system. */ - var GRADIENT_LEVELS = 256; - var zrUtil = __webpack_require__(4); + var SingleAxis = __webpack_require__(298); + var axisHelper = __webpack_require__(105); + var layout = __webpack_require__(21); /** - * Heatmap Chart + * Create a single coordinates system. * - * @class + * @param {module:echarts/coord/single/AxisModel} axisModel + * @param {module:echarts/model/Global} ecModel + * @param {module:echarts/ExtensionAPI} api */ - function Heatmap() { - var canvas = zrUtil.createCanvas(); - this.canvas = canvas; + function Single(axisModel, ecModel, api) { - this.blurSize = 30; - this.pointSize = 20; + /** + * @type {string} + * @readOnly + */ + this.dimension = 'single'; + + /** + * Add it just for draw tooltip. + * + * @type {Array.} + * @readOnly + */ + this.dimensions = ['single']; + + /** + * @private + * @type {module:echarts/coord/single/SingleAxis}. + */ + this._axis = null; + + /** + * @private + * @type {module:zrender/core/BoundingRect} + */ + this._rect; - this.maxOpacity = 1; - this.minOpacity = 0; + this._init(axisModel, ecModel, api); - this._gradientPixels = {}; + /** + * @type {module:echarts/coord/single/AxisModel} + */ + this.model = axisModel; } - Heatmap.prototype = { + Single.prototype = { + + type: 'singleAxis', + + axisPointerEnabled: true, + + constructor: Single, + /** - * Renders Heatmap and returns the rendered canvas - * @param {Array} data array of data, each has x, y, value - * @param {number} width canvas width - * @param {number} height canvas height + * Initialize single coordinate system. + * + * @param {module:echarts/coord/single/AxisModel} axisModel + * @param {module:echarts/model/Global} ecModel + * @param {module:echarts/ExtensionAPI} api + * @private */ - update: function(data, width, height, normalize, colorFunc, isInRange) { - var brush = this._getBrush(); - var gradientInRange = this._getGradient(data, colorFunc, 'inRange'); - var gradientOutOfRange = this._getGradient(data, colorFunc, 'outOfRange'); - var r = this.pointSize + this.blurSize; + _init: function (axisModel, ecModel, api) { - var canvas = this.canvas; - var ctx = canvas.getContext('2d'); - var len = data.length; - canvas.width = width; - canvas.height = height; - for (var i = 0; i < len; ++i) { - var p = data[i]; - var x = p[0]; - var y = p[1]; - var value = p[2]; + var dim = this.dimension; - // calculate alpha using value - var alpha = normalize(value); + var axis = new SingleAxis( + dim, + axisHelper.createScaleByModel(axisModel), + [0, 0], + axisModel.get('type'), + axisModel.get('position') + ); - // draw with the circle brush with alpha - ctx.globalAlpha = alpha; - ctx.drawImage(brush, x - r, y - r); - } + var isCategory = axis.type === 'category'; + axis.onBand = isCategory && axisModel.get('boundaryGap'); + axis.inverse = axisModel.get('inverse'); + axis.orient = axisModel.get('orient'); - // colorize the canvas using alpha value and set with gradient - var imageData = ctx.getImageData(0, 0, canvas.width, canvas.height); - var pixels = imageData.data; - var offset = 0; - var pixelLen = pixels.length; - var minOpacity = this.minOpacity; - var maxOpacity = this.maxOpacity; - var diffOpacity = maxOpacity - minOpacity; + axisModel.axis = axis; + axis.model = axisModel; + axis.coordinateSystem = this; + this._axis = axis; + }, - while(offset < pixelLen) { - var alpha = pixels[offset + 3] / 256; - var gradientOffset = Math.floor(alpha * (GRADIENT_LEVELS - 1)) * 4; - // Simple optimize to ignore the empty data - if (alpha > 0) { - var gradient = isInRange(alpha) ? gradientInRange : gradientOutOfRange; - // Any alpha > 0 will be mapped to [minOpacity, maxOpacity] - alpha > 0 && (alpha = alpha * diffOpacity + minOpacity); - pixels[offset++] = gradient[gradientOffset]; - pixels[offset++] = gradient[gradientOffset + 1]; - pixels[offset++] = gradient[gradientOffset + 2]; - pixels[offset++] = gradient[gradientOffset + 3] * alpha * 256; - } - else { - offset += 4; + /** + * Update axis scale after data processed + * @param {module:echarts/model/Global} ecModel + * @param {module:echarts/ExtensionAPI} api + */ + update: function (ecModel, api) { + ecModel.eachSeries(function (seriesModel) { + if (seriesModel.coordinateSystem === this) { + var data = seriesModel.getData(); + var dim = this.dimension; + this._axis.scale.unionExtentFromData( + data, seriesModel.coordDimToDataDim(dim) + ); + axisHelper.niceScaleExtent(this._axis.scale, this._axis.model); } - } - ctx.putImageData(imageData, 0, 0); - - return canvas; + }, this); }, /** - * get canvas of a black circle brush used for canvas to draw later - * @private - * @returns {Object} circle brush canvas + * Resize the single coordinate system. + * + * @param {module:echarts/coord/single/AxisModel} axisModel + * @param {module:echarts/ExtensionAPI} api */ - _getBrush: function() { - var brushCanvas = this._brushCanvas || (this._brushCanvas = zrUtil.createCanvas()); - // set brush size - var r = this.pointSize + this.blurSize; - var d = r * 2; - brushCanvas.width = d; - brushCanvas.height = d; - - var ctx = brushCanvas.getContext('2d'); - ctx.clearRect(0, 0, d, d); + resize: function (axisModel, api) { + this._rect = layout.getLayoutRect( + { + left: axisModel.get('left'), + top: axisModel.get('top'), + right: axisModel.get('right'), + bottom: axisModel.get('bottom'), + width: axisModel.get('width'), + height: axisModel.get('height') + }, + { + width: api.getWidth(), + height: api.getHeight() + } + ); - // in order to render shadow without the distinct circle, - // draw the distinct circle in an invisible place, - // and use shadowOffset to draw shadow in the center of the canvas - ctx.shadowOffsetX = d; - ctx.shadowBlur = this.blurSize; - // draw the shadow in black, and use alpha and shadow blur to generate - // color in color map - ctx.shadowColor = '#000'; + this._adjustAxis(); + }, - // draw circle in the left to the canvas - ctx.beginPath(); - ctx.arc(-r, r, this.pointSize, 0, Math.PI * 2, true); - ctx.closePath(); - ctx.fill(); - return brushCanvas; + /** + * @return {module:zrender/core/BoundingRect} + */ + getRect: function () { + return this._rect; }, /** - * get gradient color map * @private */ - _getGradient: function (data, colorFunc, state) { - var gradientPixels = this._gradientPixels; - var pixelsSingleState = gradientPixels[state] || (gradientPixels[state] = new Uint8ClampedArray(256 * 4)); - var color = []; - var off = 0; - for (var i = 0; i < 256; i++) { - colorFunc[state](i / 255, true, color); - pixelsSingleState[off++] = color[0]; - pixelsSingleState[off++] = color[1]; - pixelsSingleState[off++] = color[2]; - pixelsSingleState[off++] = color[3]; - } - return pixelsSingleState; - } - }; + _adjustAxis: function () { - module.exports = Heatmap; + var rect = this._rect; + var axis = this._axis; + var isHorizontal = axis.isHorizontal(); + var extent = isHorizontal ? [0, rect.width] : [0, rect.height]; + var idx = axis.reverse ? 1 : 0; + axis.setExtent(extent[idx], extent[1 - idx]); -/***/ }, -/* 277 */ -/***/ function(module, exports, __webpack_require__) { + this._updateAxisTransform(axis, isHorizontal ? rect.x : rect.y); - + }, - var zrUtil = __webpack_require__(4); + /** + * @param {module:echarts/coord/single/SingleAxis} axis + * @param {number} coordBase + */ + _updateAxisTransform: function (axis, coordBase) { - __webpack_require__(114); + var axisExtent = axis.getExtent(); + var extentSum = axisExtent[0] + axisExtent[1]; + var isHorizontal = axis.isHorizontal(); - __webpack_require__(278); - __webpack_require__(279); + axis.toGlobalCoord = isHorizontal ? + function (coord) { + return coord + coordBase; + } : + function (coord) { + return extentSum - coord + coordBase; + }; - var barLayoutGrid = __webpack_require__(140); - var echarts = __webpack_require__(1); + axis.toLocalCoord = isHorizontal ? + function (coord) { + return coord - coordBase; + } : + function (coord) { + return extentSum - coord + coordBase; + }; + }, - echarts.registerLayout(zrUtil.curry(barLayoutGrid, 'pictorialBar')); + /** + * Get axis. + * + * @return {module:echarts/coord/single/SingleAxis} + */ + getAxis: function () { + return this._axis; + }, - echarts.registerVisual(zrUtil.curry( - __webpack_require__(110), 'pictorialBar', 'roundRect', null - )); + /** + * Get axis, add it just for draw tooltip. + * + * @return {[type]} [description] + */ + getBaseAxis: function () { + return this._axis; + }, - // In case developer forget to include grid component - __webpack_require__(113); + /** + * @return {Array.} + */ + getAxes: function () { + return [this._axis]; + }, + /** + * @return {Object} {baseAxes: [], otherAxes: []} + */ + getTooltipAxes: function () { + return {baseAxes: [this.getAxis()]}; + }, -/***/ }, -/* 278 */ -/***/ function(module, exports, __webpack_require__) { + /** + * If contain point. + * + * @param {Array.} point + * @return {boolean} + */ + containPoint: function (point) { + var rect = this.getRect(); + var axis = this.getAxis(); + var orient = axis.orient; + if (orient === 'horizontal') { + return axis.contain(axis.toLocalCoord(point[0])) + && (point[1] >= rect.y && point[1] <= (rect.y + rect.height)); + } + else { + return axis.contain(axis.toLocalCoord(point[1])) + && (point[0] >= rect.y && point[0] <= (rect.y + rect.height)); + } + }, - + /** + * @param {Array.} point + * @return {Array.} + */ + pointToData: function (point) { + var axis = this.getAxis(); + return [axis.coordToData(axis.toLocalCoord( + point[axis.orient === 'horizontal' ? 0 : 1] + ))]; + }, - var PictorialBarSeries = __webpack_require__(136).extend({ + /** + * Convert the series data to concrete point. + * + * @param {number|Array.} val + * @return {Array.} + */ + dataToPoint: function (val) { + var axis = this.getAxis(); + var rect = this.getRect(); + var pt = []; + var idx = axis.orient === 'horizontal' ? 0 : 1; - type: 'series.pictorialBar', + if (val instanceof Array) { + val = val[0]; + } - dependencies: ['grid'], + pt[idx] = axis.toGlobalCoord(axis.dataToCoord(+val)); + pt[1 - idx] = idx === 0 ? (rect.y + rect.height / 2) : (rect.x + rect.width / 2); + return pt; + } + }; - defaultOption: { - symbol: 'circle', // Customized bar shape - symbolSize: null, // Can be ['100%', '100%'], null means auto. - symbolRotate: null, + module.exports = Single; - symbolPosition: null, // 'start' or 'end' or 'center', null means auto. - symbolOffset: null, - symbolMargin: null, // start margin and end margin. Can be a number or a percent string. - // Auto margin by defualt. - symbolRepeat: false, // false/null/undefined, means no repeat. - // Can be true, means auto calculate repeat times and cut by data. - // Can be a number, specifies repeat times, and do not cut by data. - // Can be 'fixed', means auto calculate repeat times but do not cut by data. - symbolRepeatDirection: 'end', // 'end' means from 'start' to 'end'. - symbolClip: false, - symbolBoundingData: null, - symbolPatternSize: 400, // 400 * 400 px - barGap: '-100%', // In most case, overlap is needed. +/***/ }, +/* 298 */ +/***/ function(module, exports, __webpack_require__) { - // z can be set in data item, which is z2 actually. + - // Disable progressive - progressive: 0, - hoverAnimation: false // Open only when needed. - }, + var zrUtil = __webpack_require__(4); + var Axis = __webpack_require__(100); + var axisHelper = __webpack_require__(105); - getInitialData: function (option) { - // Disable stack. - option.stack = null; - return PictorialBarSeries.superApply(this, 'getInitialData', arguments); - } - }); + /** + * @constructor module:echarts/coord/single/SingleAxis + * @extends {module:echarts/coord/Axis} + * @param {string} dim + * @param {*} scale + * @param {Array.} coordExtent + * @param {string} axisType + * @param {string} position + */ + var SingleAxis = function (dim, scale, coordExtent, axisType, position) { - module.exports = PictorialBarSeries; + Axis.call(this, dim, scale, coordExtent); + /** + * Axis type + * - 'category' + * - 'value' + * - 'time' + * - 'log' + * @type {string} + */ + this.type = axisType || 'value'; -/***/ }, -/* 279 */ -/***/ function(module, exports, __webpack_require__) { + /** + * Axis position + * - 'top' + * - 'bottom' + * - 'left' + * - 'right' + * @type {string} + */ + this.position = position || 'bottom'; - + /** + * Axis orient + * - 'horizontal' + * - 'vertical' + * @type {[type]} + */ + this.orient = null; - var zrUtil = __webpack_require__(4); - var graphic = __webpack_require__(43); - var symbolUtil = __webpack_require__(107); - var numberUtil = __webpack_require__(7); - var helper = __webpack_require__(138); + /** + * @type {number} + */ + this._labelInterval = null; - var parsePercent = numberUtil.parsePercent; + }; - var BAR_BORDER_WIDTH_QUERY = ['itemStyle', 'normal', 'borderWidth']; + SingleAxis.prototype = { - // index: +isHorizontal - var LAYOUT_ATTRS = [ - {xy: 'x', wh: 'width', index: 0, posDesc: ['left', 'right']}, - {xy: 'y', wh: 'height', index: 1, posDesc: ['top', 'bottom']} - ]; + constructor: SingleAxis, - var pathForLineWidth = new graphic.Circle(); + /** + * Axis model + * @type {module:echarts/coord/single/AxisModel} + */ + model: null, - var BarView = __webpack_require__(1).extendChartView({ + /** + * Judge the orient of the axis. + * @return {boolean} + */ + isHorizontal: function () { + var position = this.position; + return position === 'top' || position === 'bottom'; - type: 'pictorialBar', + }, - render: function (seriesModel, ecModel, api) { - var group = this.group; - var data = seriesModel.getData(); - var oldData = this._data; + /** + * Get interval of the axis label. + * @return {number} + */ + getLabelInterval: function () { + var labelInterval = this._labelInterval; + if (!labelInterval) { + var axisModel = this.model; + var labelModel = axisModel.getModel('axisLabel'); + var interval = labelModel.get('interval'); + if (!(this.type === 'category' && interval === 'auto')) { - var cartesian = seriesModel.coordinateSystem; - var baseAxis = cartesian.getBaseAxis(); - var isHorizontal = !!baseAxis.isHorizontal(); - var coordSysRect = cartesian.grid.getRect(); + labelInterval = this._labelInterval = interval === 'auto' ? 0 : interval; + return labelInterval; + } + labelInterval = this._labelInterval = + axisHelper.getAxisLabelInterval( + zrUtil.map(this.scale.getTicks(), this.dataToCoord, this), + axisModel.getFormattedLabels(), + labelModel.getModel('textStyle').getFont(), + this.isHorizontal() + ); + } + return labelInterval; + }, - var opt = { - ecSize: {width: api.getWidth(), height: api.getHeight()}, - seriesModel: seriesModel, - coordSys: cartesian, - coordSysExtent: [ - [coordSysRect.x, coordSysRect.x + coordSysRect.width], - [coordSysRect.y, coordSysRect.y + coordSysRect.height] - ], - isHorizontal: isHorizontal, - valueDim: LAYOUT_ATTRS[+isHorizontal], - categoryDim: LAYOUT_ATTRS[1 - isHorizontal] - }; + /** + * @override + */ + pointToData: function (point, clamp) { + return this.coordinateSystem.pointToData(point, clamp)[0]; + }, - data.diff(oldData) - .add(function (dataIndex) { - if (!data.hasValue(dataIndex)) { - return; - } + /** + * Convert the local coord(processed by dataToCoord()) + * to global coord(concrete pixel coord). + * designated by module:echarts/coord/single/Single. + * @type {Function} + */ + toGlobalCoord: null, - var itemModel = getItemModel(data, dataIndex); - var symbolMeta = getSymbolMeta(data, dataIndex, itemModel, opt); + /** + * Convert the global coord to local coord. + * designated by module:echarts/coord/single/Single. + * @type {Function} + */ + toLocalCoord: null - var bar = createBar(data, opt, symbolMeta); + }; - data.setItemGraphicEl(dataIndex, bar); - group.add(bar); + zrUtil.inherits(SingleAxis, Axis); - updateCommon(bar, opt, symbolMeta); - }) - .update(function (newIndex, oldIndex) { - var bar = oldData.getItemGraphicEl(oldIndex); + module.exports = SingleAxis; - if (!data.hasValue(newIndex)) { - group.remove(bar); - return; - } - var itemModel = getItemModel(data, newIndex); - var symbolMeta = getSymbolMeta(data, newIndex, itemModel, opt); +/***/ }, +/* 299 */ +/***/ function(module, exports, __webpack_require__) { - var pictorialShapeStr = getShapeStr(data, symbolMeta); - if (bar && pictorialShapeStr !== bar.__pictorialShapeStr) { - group.remove(bar); - data.setItemGraphicEl(newIndex, null); - bar = null; - } + - if (bar) { - updateBar(bar, opt, symbolMeta); - } - else { - bar = createBar(data, opt, symbolMeta, true); - } + var AxisBuilder = __webpack_require__(135); + var zrUtil = __webpack_require__(4); + var graphic = __webpack_require__(44); + var SingleAxisPointer = __webpack_require__(300); + var singleAxisHelper = __webpack_require__(301); + var getInterval = AxisBuilder.getInterval; + var ifIgnoreOnTick = AxisBuilder.ifIgnoreOnTick; - data.setItemGraphicEl(newIndex, bar); - bar.__pictorialSymbolMeta = symbolMeta; - // Add back - group.add(bar); + var axisBuilderAttrs = [ + 'axisLine', 'axisLabel', 'axisTick', 'axisName' + ]; - updateCommon(bar, opt, symbolMeta); - }) - .remove(function (dataIndex) { - var bar = oldData.getItemGraphicEl(dataIndex); - bar && removeBar(oldData, dataIndex, bar.__pictorialSymbolMeta.animationModel, bar); - }) - .execute(); + var selfBuilderAttr = 'splitLine'; - this._data = data; + var SingleAxisView = __webpack_require__(141).extend({ - return this.group; - }, + type: 'singleAxis', - dispose: zrUtil.noop, + axisPointerClass: SingleAxisPointer, + + render: function (axisModel, ecModel, api, payload) { - remove: function (ecModel, api) { var group = this.group; - var data = this._data; - if (ecModel.get('animation')) { - if (data) { - data.eachItemGraphicEl(function (bar) { - removeBar(data, bar.dataIndex, ecModel, bar); - }); - } - } - else { - group.removeAll(); - } - } - }); + group.removeAll(); - // Set or calculate default value about symbol, and calculate layout info. - function getSymbolMeta(data, dataIndex, itemModel, opt) { - var layout = data.getItemLayout(dataIndex); - var symbolRepeat = itemModel.get('symbolRepeat'); - var symbolClip = itemModel.get('symbolClip'); - var symbolPosition = itemModel.get('symbolPosition') || 'start'; - var symbolRotate = itemModel.get('symbolRotate'); - var rotation = (symbolRotate || 0) * Math.PI / 180 || 0; - var symbolPatternSize = itemModel.get('symbolPatternSize') || 2; - var isAnimationEnabled = itemModel.isAnimationEnabled(); + var layout = singleAxisHelper.layout(axisModel); - var symbolMeta = { - dataIndex: dataIndex, - layout: layout, - itemModel: itemModel, - symbolType: data.getItemVisual(dataIndex, 'symbol') || 'circle', - color: data.getItemVisual(dataIndex, 'color'), - symbolClip: symbolClip, - symbolRepeat: symbolRepeat, - symbolRepeatDirection: itemModel.get('symbolRepeatDirection'), - symbolPatternSize: symbolPatternSize, - rotation: rotation, - animationModel: isAnimationEnabled ? itemModel : null, - hoverAnimation: isAnimationEnabled && itemModel.get('hoverAnimation'), - z2: itemModel.getShallow('z', true) || 0 - }; + var axisBuilder = new AxisBuilder(axisModel, layout); - prepareBarLength(itemModel, symbolRepeat, layout, opt, symbolMeta); + zrUtil.each(axisBuilderAttrs, axisBuilder.add, axisBuilder); - prepareSymbolSize( - data, dataIndex, layout, symbolRepeat, symbolClip, symbolMeta.boundingLength, - symbolMeta.pxSign, symbolPatternSize, opt, symbolMeta - ); + group.add(axisBuilder.getGroup()); - prepareLineWidth(itemModel, symbolMeta.symbolScale, rotation, opt, symbolMeta); + if (axisModel.get(selfBuilderAttr + '.show')) { + this['_' + selfBuilderAttr](axisModel, layout.labelInterval); + } - var symbolSize = symbolMeta.symbolSize; - var symbolOffset = itemModel.get('symbolOffset'); - if (zrUtil.isArray(symbolOffset)) { - symbolOffset = [ - parsePercent(symbolOffset[0], symbolSize[0]), - parsePercent(symbolOffset[1], symbolSize[1]) - ]; - } + SingleAxisView.superCall(this, 'render', axisModel, ecModel, api, payload); + }, - prepareLayoutInfo( - itemModel, symbolSize, layout, symbolRepeat, symbolClip, symbolOffset, - symbolPosition, symbolMeta.valueLineWidth, symbolMeta.boundingLength, symbolMeta.repeatCutLength, - opt, symbolMeta - ); + _splitLine: function(axisModel, labelInterval) { + var axis = axisModel.axis; - return symbolMeta; - } + if (axis.scale.isBlank()) { + return; + } - // bar length can be negative. - function prepareBarLength(itemModel, symbolRepeat, layout, opt, output) { - var valueDim = opt.valueDim; - var symbolBoundingData = itemModel.get('symbolBoundingData'); - var valueAxis = opt.coordSys.getOtherAxis(opt.coordSys.getBaseAxis()); - var zeroPx = valueAxis.toGlobalCoord(valueAxis.dataToCoord(0)); + var splitLineModel = axisModel.getModel('splitLine'); + var lineStyleModel = splitLineModel.getModel('lineStyle'); + var lineWidth = lineStyleModel.get('width'); + var lineColors = lineStyleModel.get('color'); + var lineInterval = getInterval(splitLineModel, labelInterval); - var boundingLength = output.boundingLength = symbolBoundingData != null - ? valueAxis.toGlobalCoord(valueAxis.dataToCoord(valueAxis.scale.parse(symbolBoundingData))) - zeroPx - : symbolRepeat - ? opt.coordSysExtent[valueDim.index][1 - +(layout[valueDim.wh] <= 0)] - zeroPx - : layout[valueDim.wh]; + lineColors = lineColors instanceof Array ? lineColors : [lineColors]; - if (symbolRepeat) { - output.repeatCutLength = layout[valueDim.wh]; - } + var gridRect = axisModel.coordinateSystem.getRect(); + var isHorizontal = axis.isHorizontal(); - output.pxSign = boundingLength > 0 ? 1 : boundingLength < 0 ? -1 : 0; - } + var splitLines = []; + var lineCount = 0; - // Support ['100%', '100%'] - function prepareSymbolSize( - data, dataIndex, layout, symbolRepeat, symbolClip, boundingLength, - pxSign, symbolPatternSize, opt, output - ) { - var valueDim = opt.valueDim; - var categoryDim = opt.categoryDim; - var categorySize = Math.abs(layout[categoryDim.wh]); + var ticksCoords = axis.getTicksCoords(); - var symbolSize = data.getItemVisual(dataIndex, 'symbolSize'); - if (zrUtil.isArray(symbolSize)) { - symbolSize = symbolSize.slice(); - } - else { - if (symbolSize == null) { - symbolSize = '100%'; + var p1 = []; + var p2 = []; + + for (var i = 0; i < ticksCoords.length; ++i) { + if (ifIgnoreOnTick(axis, i, lineInterval)) { + continue; + } + var tickCoord = axis.toGlobalCoord(ticksCoords[i]); + if (isHorizontal) { + p1[0] = tickCoord; + p1[1] = gridRect.y; + p2[0] = tickCoord; + p2[1] = gridRect.y + gridRect.height; + } + else { + p1[0] = gridRect.x; + p1[1] = tickCoord; + p2[0] = gridRect.x + gridRect.width; + p2[1] = tickCoord; + } + var colorIndex = (lineCount++) % lineColors.length; + splitLines[colorIndex] = splitLines[colorIndex] || []; + splitLines[colorIndex].push(new graphic.Line( + graphic.subPixelOptimizeLine({ + shape: { + x1: p1[0], + y1: p1[1], + x2: p2[0], + y2: p2[1] + }, + style: { + lineWidth: lineWidth + }, + silent: true + }))); } - symbolSize = [symbolSize, symbolSize]; - } - // Note: percentage symbolSize (like '100%') do not consider lineWidth, because it is - // to complicated to calculate real percent value if considering scaled lineWidth. - // So the actual size will bigger than layout size if lineWidth is bigger than zero, - // which can be tolerated in pictorial chart. + for (var i = 0; i < splitLines.length; ++i) { + this.group.add(graphic.mergePath(splitLines[i], { + style: { + stroke: lineColors[i % lineColors.length], + lineDash: lineStyleModel.getLineDash(lineWidth), + lineWidth: lineWidth + }, + silent: true + })); + } + } + }); - symbolSize[categoryDim.index] = parsePercent( - symbolSize[categoryDim.index], - categorySize - ); - symbolSize[valueDim.index] = parsePercent( - symbolSize[valueDim.index], - symbolRepeat ? categorySize : Math.abs(boundingLength) - ); + module.exports = SingleAxisView; - output.symbolSize = symbolSize; - // If x or y is less than zero, show reversed shape. - var symbolScale = output.symbolScale = [ - symbolSize[0] / symbolPatternSize, - symbolSize[1] / symbolPatternSize - ]; - // Follow convention, 'right' and 'top' is the normal scale. - symbolScale[valueDim.index] *= (opt.isHorizontal ? -1 : 1) * pxSign; - } - function prepareLineWidth(itemModel, symbolScale, rotation, opt, output) { - // In symbols are drawn with scale, so do not need to care about the case that width - // or height are too small. But symbol use strokeNoScale, where acture lineWidth should - // be calculated. - var valueLineWidth = itemModel.get(BAR_BORDER_WIDTH_QUERY) || 0; +/***/ }, +/* 300 */ +/***/ function(module, exports, __webpack_require__) { - if (valueLineWidth) { - pathForLineWidth.attr({ - scale: symbolScale.slice(), - rotation: rotation - }); - pathForLineWidth.updateTransform(); - valueLineWidth /= pathForLineWidth.getLineScale(); - valueLineWidth *= symbolScale[opt.valueDim.index]; - } + 'use strict'; - output.valueLineWidth = valueLineWidth; - } - function prepareLayoutInfo( - itemModel, symbolSize, layout, symbolRepeat, symbolClip, symbolOffset, - symbolPosition, valueLineWidth, boundingLength, repeatCutLength, opt, output - ) { - var categoryDim = opt.categoryDim; - var valueDim = opt.valueDim; - var pxSign = output.pxSign; + var graphic = __webpack_require__(44); + var BaseAxisPointer = __webpack_require__(137); + var viewHelper = __webpack_require__(139); + var singleAxisHelper = __webpack_require__(301); - var unitLength = Math.max(symbolSize[valueDim.index] + valueLineWidth, 0); - var pathLen = unitLength; + var XY = ['x', 'y']; + var WH = ['width', 'height']; - // Note: rotation will not effect the layout of symbols, because user may - // want symbols to rotate on its center, which should not be translated - // when rotating. + var SingleAxisPointer = BaseAxisPointer.extend({ - if (symbolRepeat) { - var absBoundingLength = Math.abs(boundingLength); + /** + * @override + */ + makeElOption: function (elOption, value, axisModel, axisPointerModel, api) { + var axis = axisModel.axis; + var coordSys = axis.coordinateSystem; + var otherExtent = getGlobalExtent(coordSys, 1 - getPointDimIndex(axis)); + var pixelValue = coordSys.dataToPoint(value)[0]; + var elStyle = viewHelper.buildElStyle(axisPointerModel); + var pointerOption = pointerShapeBuilder[axisPointerModel.get('type')]( + axis, pixelValue, otherExtent, elStyle + ); + pointerOption.style = elStyle; - var symbolMargin = zrUtil.retrieve(itemModel.get('symbolMargin'), '15%') + ''; - var hasEndGap = false; - if (symbolMargin.lastIndexOf('!') === symbolMargin.length - 1) { - hasEndGap = true; - symbolMargin = symbolMargin.slice(0, symbolMargin.length - 1); - } - symbolMargin = parsePercent(symbolMargin, symbolSize[valueDim.index]); + elOption.graphicKey = pointerOption.type; + elOption.pointer = pointerOption; - var uLenWithMargin = Math.max(unitLength + symbolMargin * 2, 0); + var layoutInfo = singleAxisHelper.layout(axisModel); + viewHelper.buildCartesianSingleLabelElOption( + value, elOption, layoutInfo, axisModel, axisPointerModel, api + ); + }, - // When symbol margin is less than 0, margin at both ends will be subtracted - // to ensure that all of the symbols will not be overflow the given area. - var endFix = hasEndGap ? 0 : symbolMargin * 2; + /** + * @override + */ + getHandleTransform: function (value, axisModel, axisPointerModel) { + var layoutInfo = singleAxisHelper.layout(axisModel, {labelInside: false}); + layoutInfo.labelMargin = axisPointerModel.get('handle.margin'); + return { + position: viewHelper.getTransformedPosition(axisModel.axis, value, layoutInfo), + rotation: layoutInfo.rotation + (layoutInfo.labelDirection < 0 ? Math.PI : 0) + }; + }, - // Both final repeatTimes and final symbolMargin area calculated based on - // boundingLength. - var repeatSpecified = numberUtil.isNumeric(symbolRepeat); - var repeatTimes = repeatSpecified - ? symbolRepeat - : toIntTimes((absBoundingLength + endFix) / uLenWithMargin); + /** + * @override + */ + updateHandleTransform: function (transform, delta, axisModel, axisPointerModel) { + var axis = axisModel.axis; + var coordSys = axis.coordinateSystem; + var dimIndex = getPointDimIndex(axis); + var axisExtent = getGlobalExtent(coordSys, dimIndex); + var currPosition = transform.position; + currPosition[dimIndex] += delta[dimIndex]; + currPosition[dimIndex] = Math.min(axisExtent[1], currPosition[dimIndex]); + currPosition[dimIndex] = Math.max(axisExtent[0], currPosition[dimIndex]); + var otherExtent = getGlobalExtent(coordSys, 1 - dimIndex); + var cursorOtherValue = (otherExtent[1] + otherExtent[0]) / 2; + var cursorPoint = [cursorOtherValue, cursorOtherValue]; + cursorPoint[dimIndex] = currPosition[dimIndex]; - // Adjust calculate margin, to ensure each symbol is displayed - // entirely in the given layout area. - var mDiff = absBoundingLength - repeatTimes * unitLength; - symbolMargin = mDiff / 2 / (hasEndGap ? repeatTimes : repeatTimes - 1); - uLenWithMargin = unitLength + symbolMargin * 2; - endFix = hasEndGap ? 0 : symbolMargin * 2; + return { + position: currPosition, + rotation: transform.rotation, + cursorPoint: cursorPoint, + tooltipOption: { + verticalAlign: 'middle' + } + }; + } + }); - // Update repeatTimes when not all symbol will be shown. - if (!repeatSpecified && symbolRepeat !== 'fixed') { - repeatTimes = repeatCutLength - ? toIntTimes((Math.abs(repeatCutLength) + endFix) / uLenWithMargin) - : 0; - } + var pointerShapeBuilder = { - pathLen = repeatTimes * uLenWithMargin - endFix; - output.repeatTimes = repeatTimes; - output.symbolMargin = symbolMargin; - } + line: function (axis, pixelValue, otherExtent, elStyle) { + var targetShape = viewHelper.makeLineShape( + [pixelValue, otherExtent[0]], + [pixelValue, otherExtent[1]], + getPointDimIndex(axis) + ); + graphic.subPixelOptimizeLine({ + shape: targetShape, + style: elStyle + }); + return { + type: 'Line', + shape: targetShape + }; + }, - var sizeFix = pxSign * (pathLen / 2); - var pathPosition = output.pathPosition = []; - pathPosition[categoryDim.index] = layout[categoryDim.wh] / 2; - pathPosition[valueDim.index] = symbolPosition === 'start' - ? sizeFix - : symbolPosition === 'end' - ? boundingLength - sizeFix - : boundingLength / 2; // 'center' - if (symbolOffset) { - pathPosition[0] += symbolOffset[0]; - pathPosition[1] += symbolOffset[1]; + shadow: function (axis, pixelValue, otherExtent, elStyle) { + var bandWidth = axis.getBandWidth(); + var span = otherExtent[1] - otherExtent[0]; + return { + type: 'Rect', + shape: viewHelper.makeRectShape( + [pixelValue - bandWidth / 2, otherExtent[0]], + [bandWidth, span], + getPointDimIndex(axis) + ) + }; } + }; - var bundlePosition = output.bundlePosition = []; - bundlePosition[categoryDim.index] = layout[categoryDim.xy]; - bundlePosition[valueDim.index] = layout[valueDim.xy]; - - var barRectShape = output.barRectShape = zrUtil.extend({}, layout); - barRectShape[valueDim.wh] = pxSign * Math.max( - Math.abs(layout[valueDim.wh]), Math.abs(pathPosition[valueDim.index] + sizeFix) - ); - barRectShape[categoryDim.wh] = layout[categoryDim.wh]; + function getPointDimIndex(axis) { + return axis.isHorizontal() ? 0 : 1; + } - var clipShape = output.clipShape = {}; - // Consider that symbol may be overflow layout rect. - clipShape[categoryDim.xy] = -layout[categoryDim.xy]; - clipShape[categoryDim.wh] = opt.ecSize[categoryDim.wh]; - clipShape[valueDim.xy] = 0; - clipShape[valueDim.wh] = layout[valueDim.wh]; + function getGlobalExtent(coordSys, dimIndex) { + var rect = coordSys.getRect(); + return [rect[XY[dimIndex]], rect[XY[dimIndex]] + rect[WH[dimIndex]]]; } - function createPath(symbolMeta) { - var symbolPatternSize = symbolMeta.symbolPatternSize; - var path = symbolUtil.createSymbol( - // Consider texture img, make a big size. - symbolMeta.symbolType, - -symbolPatternSize / 2, - -symbolPatternSize / 2, - symbolPatternSize, - symbolPatternSize, - symbolMeta.color - ); - path.attr({ - culling: true - }); - path.type !== 'image' && path.setStyle({ - strokeNoScale: true - }); + module.exports = SingleAxisPointer; - return path; - } - function createOrUpdateRepeatSymbols(bar, opt, symbolMeta, isUpdate) { - var bundle = bar.__pictorialBundle; - var symbolSize = symbolMeta.symbolSize; - var valueLineWidth = symbolMeta.valueLineWidth; - var pathPosition = symbolMeta.pathPosition; - var valueDim = opt.valueDim; - var repeatTimes = symbolMeta.repeatTimes || 0; +/***/ }, +/* 301 */ +/***/ function(module, exports, __webpack_require__) { - var index = 0; - var unit = symbolSize[opt.valueDim.index] + valueLineWidth + symbolMeta.symbolMargin * 2; + - eachPath(bar, function (path) { - path.__pictorialAnimationIndex = index; - path.__pictorialRepeatTimes = repeatTimes; - if (index < repeatTimes) { - updateAttr(path, null, makeTarget(index), symbolMeta, isUpdate); - } - else { - updateAttr(path, null, {scale: [0, 0]}, symbolMeta, isUpdate, function () { - bundle.remove(path); - }); - } + var zrUtil = __webpack_require__(4); - updateHoverAnimation(path, symbolMeta); + var helper = {}; - index++; - }); + /** + * @param {Object} opt {labelInside} + * @return {Object} { + * position, rotation, labelDirection, labelOffset, + * tickDirection, labelRotate, labelInterval, z2 + * } + */ + helper.layout = function (axisModel, opt) { + opt = opt || {}; + var single = axisModel.coordinateSystem; + var axis = axisModel.axis; + var layout = {}; - for (; index < repeatTimes; index++) { - var path = createPath(symbolMeta); - path.__pictorialAnimationIndex = index; - path.__pictorialRepeatTimes = repeatTimes; - bundle.add(path); + var axisPosition = axis.position; + var orient = axis.orient; - var target = makeTarget(index, true); + var rect = single.getRect(); + var rectBound = [rect.x, rect.x + rect.width, rect.y, rect.y + rect.height]; - updateAttr( - path, - { - position: target.position, - scale: [0, 0] - }, - { - scale: target.scale, - rotation: target.rotation - }, - symbolMeta, - isUpdate - ); + var positionMap = { + horizontal: {top: rectBound[2], bottom: rectBound[3]}, + vertical: {left: rectBound[0], right: rectBound[1]} + }; - // FIXME - // If all emphasis/normal through action. - path - .on('mouseover', onMouseOver) - .on('mouseout', onMouseOut); + layout.position = [ + orient === 'vertical' + ? positionMap.vertical[axisPosition] + : rectBound[0], + orient === 'horizontal' + ? positionMap.horizontal[axisPosition] + : rectBound[3] + ]; - updateHoverAnimation(path, symbolMeta); - } + var r = {horizontal: 0, vertical: 1}; + layout.rotation = Math.PI / 2 * r[orient]; - function makeTarget(index) { - var position = pathPosition.slice(); - // (start && pxSign > 0) || (end && pxSign < 0): i = repeatTimes - index - // Otherwise: i = index; - var pxSign = symbolMeta.pxSign; - var i = index; - if (symbolMeta.symbolRepeatDirection === 'start' ? pxSign > 0 : pxSign < 0) { - i = repeatTimes - 1 - index; - } - position[valueDim.index] = unit * (i - repeatTimes / 2 + 0.5) + pathPosition[valueDim.index]; + var directionMap = {top: -1, bottom: 1, right: 1, left: -1}; - return { - position: position, - scale: symbolMeta.symbolScale.slice(), - rotation: symbolMeta.rotation - }; - } + layout.labelDirection = layout.tickDirection + = layout.nameDirection + = directionMap[axisPosition]; - function onMouseOver() { - eachPath(bar, function (path) { - path.trigger('emphasis'); - }); + if (axisModel.get('axisTick.inside')) { + layout.tickDirection = -layout.tickDirection; } - function onMouseOut() { - eachPath(bar, function (path) { - path.trigger('normal'); - }); + if (zrUtil.retrieve(opt.labelInside, axisModel.get('axisLabel.inside'))) { + layout.labelDirection = -layout.labelDirection; } - } - function createOrUpdateSingleSymbol(bar, opt, symbolMeta, isUpdate) { - var bundle = bar.__pictorialBundle; - var mainPath = bar.__pictorialMainPath; + var labelRotation = opt.rotate; + labelRotation == null && (labelRotation = axisModel.get('axisLabel.rotate')); + layout.labelRotation = axisPosition === 'top' ? -labelRotation : labelRotation; - if (!mainPath) { - mainPath = bar.__pictorialMainPath = createPath(symbolMeta); - bundle.add(mainPath); + layout.labelInterval = axis.getLabelInterval(); - updateAttr( - mainPath, - { - position: symbolMeta.pathPosition.slice(), - scale: [0, 0], - rotation: symbolMeta.rotation - }, - { - scale: symbolMeta.symbolScale.slice() - }, - symbolMeta, - isUpdate - ); + layout.z2 = 1; - mainPath - .on('mouseover', onMouseOver) - .on('mouseout', onMouseOut); - } - else { - updateAttr( - mainPath, - null, - { - position: symbolMeta.pathPosition.slice(), - scale: symbolMeta.symbolScale.slice(), - rotation: symbolMeta.rotation - }, - symbolMeta, - isUpdate - ); - } + return layout; + }; + + module.exports = helper; + + + +/***/ }, +/* 302 */ +/***/ function(module, exports, __webpack_require__) { + + + + var ComponentModel = __webpack_require__(19); + var axisModelCreator = __webpack_require__(131); + var zrUtil = __webpack_require__(4); + + var AxisModel = ComponentModel.extend({ - updateHoverAnimation(mainPath, symbolMeta); + type: 'singleAxis', - function onMouseOver() { - this.trigger('emphasis'); - } + layoutMode: 'box', - function onMouseOut() { - this.trigger('normal'); + /** + * @type {module:echarts/coord/single/SingleAxis} + */ + axis: null, + + /** + * @type {module:echarts/coord/single/Single} + */ + coordinateSystem: null, + + /** + * @override + */ + getCoordSysModel: function () { + return this; } - } - // bar rect is used for label. - function createOrUpdateBarRect(bar, symbolMeta, isUpdate) { - var rectShape = zrUtil.extend({}, symbolMeta.barRectShape); + }); - var barRect = bar.__pictorialBarRect; - if (!barRect) { - barRect = bar.__pictorialBarRect = new graphic.Rect({ - z2: 2, - shape: rectShape, - silent: true, - style: { - stroke: 'transparent', - fill: 'transparent', - lineWidth: 0 - } - }); + var defaultOption = { - bar.add(barRect); - } - else { - updateAttr(barRect, null, {shape: rectShape}, symbolMeta, isUpdate); - } - } + left: '5%', + top: '5%', + right: '5%', + bottom: '5%', - function createOrUpdateClip(bar, opt, symbolMeta, isUpdate) { - // If not clip, symbol will be remove and rebuilt. - if (symbolMeta.symbolClip) { - var clipPath = bar.__pictorialClipPath; - var clipShape = zrUtil.extend({}, symbolMeta.clipShape); - var valueDim = opt.valueDim; - var animationModel = symbolMeta.animationModel; - var dataIndex = symbolMeta.dataIndex; + type: 'value', - if (clipPath) { - graphic.updateProps( - clipPath, {shape: clipShape}, animationModel, dataIndex - ); + position: 'bottom', + + orient: 'horizontal', + + axisLine: { + show: true, + lineStyle: { + width: 2, + type: 'solid' } - else { - clipShape[valueDim.wh] = 0; - clipPath = new graphic.Rect({shape: clipShape}); - bar.__pictorialBundle.setClipPath(clipPath); - bar.__pictorialClipPath = clipPath; + }, - var target = {}; - target[valueDim.wh] = symbolMeta.clipShape[valueDim.wh]; + // Single coordinate system and single axis is the, + // which is used as the parent tooltip model. + // same model, so we set default tooltip show as true. + tooltip: { + show: true + }, - graphic[isUpdate ? 'updateProps' : 'initProps']( - clipPath, {shape: target}, animationModel, dataIndex - ); + axisTick: { + show: true, + length: 6, + lineStyle: { + width: 2 + } + }, + + axisLabel: { + show: true, + interval: 'auto' + }, + + splitLine: { + show: true, + lineStyle: { + type: 'dashed', + opacity: 0.2 } } - } + }; - function getItemModel(data, dataIndex) { - var itemModel = data.getItemModel(dataIndex); - itemModel.getAnimationDelayParams = getAnimationDelayParams; - itemModel.isAnimationEnabled = isAnimationEnabled; - return itemModel; + function getAxisType(axisName, option) { + return option.type || (option.data ? 'category' : 'value'); } - function getAnimationDelayParams(path) { - // The order is the same as the z-order, see `symbolRepeatDiretion`. - return { - index: path.__pictorialAnimationIndex, - count: path.__pictorialRepeatTimes - }; - } + zrUtil.merge(AxisModel.prototype, __webpack_require__(111)); - function isAnimationEnabled() { - // `animation` prop can be set on itemModel in pictorial bar chart. - return this.parentModel.isAnimationEnabled() && !!this.getShallow('animation'); - } + axisModelCreator('single', AxisModel, getAxisType, defaultOption); - function updateHoverAnimation(path, symbolMeta) { - path.off('emphasis').off('normal'); + module.exports = AxisModel; - var scale = symbolMeta.symbolScale.slice(); - symbolMeta.hoverAnimation && path - .on('emphasis', function() { - this.animateTo({ - scale: [scale[0] * 1.1, scale[1] * 1.1] - }, 400, 'elasticOut'); - }) - .on('normal', function() { - this.animateTo({ - scale: scale.slice() - }, 400, 'elasticOut'); - }); - } +/***/ }, +/* 303 */ +/***/ function(module, exports, __webpack_require__) { - function createBar(data, opt, symbolMeta, isUpdate) { - // bar is the main element for each data. - var bar = new graphic.Group(); - // bundle is used for location and clip. - var bundle = new graphic.Group(); - bar.add(bundle); - bar.__pictorialBundle = bundle; - bundle.attr('position', symbolMeta.bundlePosition.slice()); + 'use strict'; + /** + * @file Define the themeRiver view's series model + * @author Deqing Li(annong035@gmail.com) + */ - if (symbolMeta.symbolRepeat) { - createOrUpdateRepeatSymbols(bar, opt, symbolMeta); - } - else { - createOrUpdateSingleSymbol(bar, opt, symbolMeta); - } - createOrUpdateBarRect(bar, symbolMeta, isUpdate); + var completeDimensions = __webpack_require__(103); + var SeriesModel = __webpack_require__(28); + var List = __webpack_require__(98); + var zrUtil = __webpack_require__(4); + var formatUtil = __webpack_require__(6); + var encodeHTML = formatUtil.encodeHTML; + var nest = __webpack_require__(259); - createOrUpdateClip(bar, opt, symbolMeta, isUpdate); + var DATA_NAME_INDEX = 2; - bar.__pictorialShapeStr = getShapeStr(data, symbolMeta); - bar.__pictorialSymbolMeta = symbolMeta; + var ThemeRiverSeries = SeriesModel.extend({ - return bar; - } + type: 'series.themeRiver', - function updateBar(bar, opt, symbolMeta) { - var animationModel = symbolMeta.animationModel; - var dataIndex = symbolMeta.dataIndex; - var bundle = bar.__pictorialBundle; + dependencies: ['singleAxis'], - graphic.updateProps( - bundle, {position: symbolMeta.bundlePosition.slice()}, animationModel, dataIndex - ); + /** + * @readOnly + * @type {Object} + */ + nameMap: null, - if (symbolMeta.symbolRepeat) { - createOrUpdateRepeatSymbols(bar, opt, symbolMeta, true); - } - else { - createOrUpdateSingleSymbol(bar, opt, symbolMeta, true); - } + /** + * @override + */ + init: function (option) { + ThemeRiverSeries.superApply(this, 'init', arguments); - createOrUpdateBarRect(bar, symbolMeta, true); + // Put this function here is for the sake of consistency of code + // Enable legend selection for each data item + // Use a function instead of direct access because data reference may changed + this.legendDataProvider = function () { + return this.getRawData(); + }; + }, - createOrUpdateClip(bar, opt, symbolMeta, true); - } + /** + * If there is no value of a certain point in the time for some event,set it value to 0. + * + * @param {Array} data initial data in the option + * @return {Array} + */ + fixData: function (data) { + var rawDataLength = data.length; - function removeBar(data, dataIndex, animationModel, bar) { - // Not show text when animating - var labelRect = bar.__pictorialBarRect; - labelRect && (labelRect.style.text = ''); + // grouped data by name + var dataByName = nest() + .key(function (dataItem) { + return dataItem[2]; + }) + .entries(data); - var pathes = []; - eachPath(bar, function (path) { - pathes.push(path); - }); - bar.__pictorialMainPath && pathes.push(bar.__pictorialMainPath); + // data group in each layer + var layData = zrUtil.map(dataByName, function (d) { + return { + name: d.key, + dataList: d.values + }; + }); - // I do not find proper remove animation for clip yet. - bar.__pictorialClipPath && (animationModel = null); + var layerNum = layData.length; + var largestLayer = -1; + var index = -1; + for (var i = 0; i < layerNum; ++i) { + var len = layData[i].dataList.length; + if (len > largestLayer) { + largestLayer = len; + index = i; + } + } - zrUtil.each(pathes, function (path) { - graphic.updateProps( - path, {scale: [0, 0]}, animationModel, dataIndex, - function () { - bar.parent && bar.parent.remove(bar); + for (var k = 0; k < layerNum; ++k) { + if (k === index) { + continue; } - ); - }); + var name = layData[k].name; + for (var j = 0; j < largestLayer; ++j) { + var timeValue = layData[index].dataList[j][0]; + var length = layData[k].dataList.length; + var keyIndex = -1; + for (var l = 0; l < length; ++l) { + var value = layData[k].dataList[l][0]; + if (value === timeValue) { + keyIndex = l; + break; + } + } + if (keyIndex === -1) { + data[rawDataLength] = []; + data[rawDataLength][0] = timeValue; + data[rawDataLength][1] = 0; + data[rawDataLength][2] = name; + rawDataLength++; - data.setItemGraphicEl(dataIndex, null); - } + } + } + } + return data; + }, - function getShapeStr(data, symbolMeta) { - return [ - data.getItemVisual(symbolMeta.dataIndex, 'symbol') || 'none', - !!symbolMeta.symbolRepeat, - !!symbolMeta.symbolClip - ].join(':'); - } + /** + * @override + * @param {Object} option the initial option that user gived + * @param {module:echarts/model/Model} ecModel the model object for themeRiver option + * @return {module:echarts/data/List} + */ + getInitialData: function (option, ecModel) { - function eachPath(bar, cb, context) { - // Do not use Group#eachChild, because it do not support remove. - zrUtil.each(bar.__pictorialBundle.children(), function (el) { - el !== bar.__pictorialBarRect && cb.call(context, el); - }); - } + var dimensions = []; - function updateAttr(el, immediateAttrs, animationAttrs, symbolMeta, isUpdate, cb) { - immediateAttrs && el.attr(immediateAttrs); - // when symbolCip used, only clip path has init animation, otherwise it would be weird effect. - if (symbolMeta.symbolClip && !isUpdate) { - animationAttrs && el.attr(animationAttrs); - } - else { - animationAttrs && graphic[isUpdate ? 'updateProps' : 'initProps']( - el, animationAttrs, symbolMeta.animationModel, symbolMeta.dataIndex, cb - ); - } - } + var singleAxisModel = ecModel.queryComponents({ + mainType: 'singleAxis', + index: this.get('singleAxisIndex'), + id: this.get('singleAxisId') + })[0]; - function updateCommon(bar, opt, symbolMeta) { - var color = symbolMeta.color; - var dataIndex = symbolMeta.dataIndex; - var itemModel = symbolMeta.itemModel; - // Color must be excluded. - // Because symbol provide setColor individually to set fill and stroke - var normalStyle = itemModel.getModel('itemStyle.normal').getItemStyle(['color']); - var hoverStyle = itemModel.getModel('itemStyle.emphasis').getItemStyle(); + var axisType = singleAxisModel.get('type'); - eachPath(bar, function (path) { - // PENDING setColor should be before setStyle!!! - path.setColor(color); - path.setStyle(zrUtil.defaults( + dimensions = [ { - fill: color, - opacity: symbolMeta.opacity + name: 'time', + // FIXME common? + type: axisType === 'category' + ? 'ordinal' + : axisType === 'time' + ? 'time' + : 'float' }, - normalStyle - )); - graphic.setHoverStyle(path, hoverStyle); + { + name: 'value', + type: 'float' + }, + { + name: 'name', + type: 'ordinal' + } + ]; - path.z2 = symbolMeta.z2; - }); + // filter the data item with the value of label is undefined + var filterData = zrUtil.filter(option.data, function (dataItem) { + return dataItem[2] !== undefined; + }); - var barRectHoverStyle = {}; - var barPositionOutside = opt.valueDim.posDesc[+(symbolMeta.boundingLength > 0)]; - var barRect = bar.__pictorialBarRect; + var data = this.fixData(filterData || []); + var nameList = []; + var nameMap = this.nameMap = {}; + var count = 0; - helper.setLabel( - barRect.style, barRectHoverStyle, itemModel, - color, opt.seriesModel, dataIndex, barPositionOutside - ); + for (var i = 0; i < data.length; ++i) { + nameList.push(data[i][DATA_NAME_INDEX]); + if (!nameMap[data[i][DATA_NAME_INDEX]]) { + nameMap[data[i][DATA_NAME_INDEX]] = count++; + } + } - graphic.setHoverStyle(barRect, barRectHoverStyle); - } + completeDimensions(dimensions, data); - function toIntTimes(times) { - var roundedTimes = Math.round(times); - // Escapse accurate error - return Math.abs(times - roundedTimes) < 1e-4 - ? roundedTimes - : Math.ceil(times); - } + var list = new List(dimensions, this); - module.exports = BarView; + list.initData(data, nameList); + return list; + }, -/***/ }, -/* 280 */ -/***/ function(module, exports, __webpack_require__) { + /** + * Used by single coordinate + * + * @param {string} axisDim the dimension for single coordinate + * @return {Array. } specified dimensions on the axis. + */ + coordDimToDataDim: function (axisDim) { + return ['time']; + }, - + /** + * The raw data is divided into multiple layers and each layer + * has same name. + * + * @return {Array.>} + */ + getLayerSeries: function () { + var data = this.getData(); + var lenCount = data.count(); + var indexArr = []; - var echarts = __webpack_require__(1); - var zrUtil = __webpack_require__(4); + for (var i = 0; i < lenCount; ++i) { + indexArr[i] = i; + } + // data group by name + var dataByName = nest() + .key(function (index) { + return data.get('name', index); + }) + .entries(indexArr); + + var layerSeries = zrUtil.map(dataByName, function (d) { + return { + name: d.key, + indices: d.values + }; + }); - __webpack_require__(281); + for (var j = 0; j < layerSeries.length; ++j) { + layerSeries[j].indices.sort(comparer); + } - __webpack_require__(287); + function comparer(index1, index2) { + return data.get('time', index1) - data.get('time', index2); + } - __webpack_require__(288); + return layerSeries; + }, - echarts.registerLayout(__webpack_require__(290)); + /** + * Get data indices for show tooltip content + * + * @param {Array.|string} dim single coordinate dimension + * @param {number} value axis value + * @param {module:echarts/coord/single/SingleAxis} baseAxis single Axis used + * the themeRiver. + * @return {Object} {dataIndices, nestestValue} + */ + getAxisTooltipData: function (dim, value, baseAxis) { + if (!zrUtil.isArray(dim)) { + dim = dim ? [dim] : []; + } - echarts.registerVisual(__webpack_require__(291)); + var data = this.getData(); + var layerSeries = this.getLayerSeries(); + var indices = []; + var layerNum = layerSeries.length; + var nestestValue; - echarts.registerProcessor( - zrUtil.curry(__webpack_require__(149), 'themeRiver') - ); + for (var i = 0; i < layerNum; ++i) { + var minDist = Number.MAX_VALUE; + var nearestIdx = -1; + var pointNum = layerSeries[i].indices.length; + for (var j = 0; j < pointNum; ++j) { + var theValue = data.get(dim[0], layerSeries[i].indices[j]); + var dist = Math.abs(theValue - value); + if (dist <= minDist) { + nestestValue = theValue; + minDist = dist; + nearestIdx = layerSeries[i].indices[j]; + } + } + indices.push(nearestIdx); + } + return {dataIndices: indices, nestestValue: nestestValue}; + }, -/***/ }, -/* 281 */ -/***/ function(module, exports, __webpack_require__) { + /** + * @override + * @param {number} dataIndex index of data + */ + formatTooltip: function (dataIndex) { + var data = this.getData(); + var htmlName = data.get('name', dataIndex); + var htmlValue = data.get('value', dataIndex); + if (isNaN(htmlValue) || htmlValue == null) { + htmlValue = '-'; + } + return encodeHTML(htmlName + ' : ' + htmlValue); + }, - + defaultOption: { + zlevel: 0, + z: 2, - __webpack_require__(282); - __webpack_require__(285); - __webpack_require__(286); + coordinateSystem: 'singleAxis', - var echarts = __webpack_require__(1); + // gap in axis's orthogonal orientation + boundaryGap: ['10%', '10%'], - echarts.extendComponentView({ - type: 'single' + // legendHoverLink: true, + + singleAxisIndex: 0, + + animationEasing: 'linear', + + label: { + normal: { + margin: 4, + textAlign: 'right', + show: true, + position: 'left', + textStyle: { + color: '#000', + fontSize: 11 + } + }, + emphasis: { + show: true + } + } + } }); + module.exports = ThemeRiverSeries; + /***/ }, -/* 282 */ +/* 304 */ /***/ function(module, exports, __webpack_require__) { - /** - * Single coordinate system creator. + /* WEBPACK VAR INJECTION */(function(process) {/** + * @file The file used to draw themeRiver view + * @author Deqing Li(annong035@gmail.com) */ - var Single = __webpack_require__(283); + var poly = __webpack_require__(118); + var graphic = __webpack_require__(44); + var zrUtil = __webpack_require__(4); + var DataDiffer = __webpack_require__(99); - /** - * Create single coordinate system and inject it into seriesModel. - * - * @param {module:echarts/model/Global} ecModel - * @param {module:echarts/ExtensionAPI} api - * @return {Array.} - */ - function create(ecModel, api) { - var singles = []; + module.exports = __webpack_require__(1).extendChartView({ - ecModel.eachComponent('singleAxis', function(axisModel, idx) { + type: 'themeRiver', - var single = new Single(axisModel, ecModel, api); - single.name = 'single_' + idx; - single.resize(axisModel, api); - axisModel.coordinateSystem = single; - singles.push(single); + init: function () { + this._layers = []; + }, - }); + render: function (seriesModel, ecModel, api) { + var data = seriesModel.getData(); + var rawData = seriesModel.getRawData(); - ecModel.eachSeries(function (seriesModel) { - if (seriesModel.get('coordinateSystem') === 'singleAxis') { - var singleAxisModel = ecModel.queryComponents({ - mainType: 'singleAxis', - index: seriesModel.get('singleAxisIndex'), - id: seriesModel.get('singleAxisId') - })[0]; - seriesModel.coordinateSystem = singleAxisModel && singleAxisModel.coordinateSystem; + if (!data.count()) { + return; } - }); - return singles; - } + var group = this.group; - __webpack_require__(26).register('single', { - create: create, - dimensions: Single.prototype.dimensions - }); + var layerSeries = seriesModel.getLayerSeries(); + var layoutInfo = data.getLayout('layoutInfo'); + var rect = layoutInfo.rect; + var boundaryGap = layoutInfo.boundaryGap; -/***/ }, -/* 283 */ -/***/ function(module, exports, __webpack_require__) { + group.attr('position', [0, rect.y + boundaryGap[0]]); - /** - * Single coordinates system. - */ + function keyGetter(item) { + return item.name; + } + var dataDiffer = new DataDiffer( + this._layersSeries || [], layerSeries, + keyGetter, keyGetter + ); + var newLayersGroups = {}; - var SingleAxis = __webpack_require__(284); - var axisHelper = __webpack_require__(115); - var layout = __webpack_require__(21); + dataDiffer.add(zrUtil.bind(zrUtil.curry(process, 'add'), this)) + .update(zrUtil.bind(zrUtil.curry(process, 'update'), this)) + .remove(zrUtil.bind(zrUtil.curry(process, 'remove'), this)) + .execute(); - /** - * Create a single coordinates system. - * - * @param {module:echarts/coord/single/AxisModel} axisModel - * @param {module:echarts/model/Global} ecModel - * @param {module:echarts/ExtensionAPI} api - */ - function Single(axisModel, ecModel, api) { + function process(status, idx, oldIdx) { + var oldLayersGroups = this._layers; + if (status === 'remove') { + group.remove(oldLayersGroups[idx]); + return; + } + var points0 = []; + var points1 = []; + var color; + var indices = layerSeries[idx].indices; + for (var j = 0; j < indices.length; j++) { + var layout = data.getItemLayout(indices[j]); + var x = layout.x; + var y0 = layout.y0; + var y = layout.y; - /** - * @type {string} - * @readOnly - */ - this.dimension = 'single'; + points0.push([x, y0]); + points1.push([x, y0 + y]); - /** - * Add it just for draw tooltip. - * - * @type {Array.} - * @readOnly - */ - this.dimensions = ['single']; + color = rawData.getItemVisual(indices[j], 'color'); + } - /** - * @private - * @type {module:echarts/coord/single/SingleAxis}. - */ - this._axis = null; + var polygon; + var text; + var textLayout = data.getItemLayout(indices[0]); + var itemModel = data.getItemModel(indices[j - 1]); + var labelModel = itemModel.getModel('label.normal'); + var margin = labelModel.get('margin'); + if (status === 'add') { + var layerGroup = newLayersGroups[idx] = new graphic.Group(); + polygon = new poly.Polygon({ + shape: { + points: points0, + stackedOnPoints: points1, + smooth: 0.4, + stackedOnSmooth: 0.4, + smoothConstraint: false + }, + z2: 0 + }); + text = new graphic.Text({ + style: { + x: textLayout.x - margin, + y: textLayout.y0 + textLayout.y / 2 + } + }); + layerGroup.add(polygon); + layerGroup.add(text); + group.add(layerGroup); - /** - * @private - * @type {module:zrender/core/BoundingRect} - */ - this._rect; + polygon.setClipPath(createGridClipShape(polygon.getBoundingRect(), seriesModel, function () { + polygon.removeClipPath(); + })); + } + else { + var layerGroup = oldLayersGroups[oldIdx]; + polygon = layerGroup.childAt(0); + text = layerGroup.childAt(1); + group.add(layerGroup); - this._init(axisModel, ecModel, api); + newLayersGroups[idx] = layerGroup; - /** - * @type {module:echarts/coord/single/AxisModel} - */ - this._model = axisModel; - } + graphic.updateProps(polygon, { + shape: { + points: points0, + stackedOnPoints: points1 + } + }, seriesModel); - Single.prototype = { + graphic.updateProps(text, { + style: { + x: textLayout.x - margin, + y: textLayout.y0 + textLayout.y / 2 + } + }, seriesModel); + } - type: 'singleAxis', + var hoverItemStyleModel = itemModel.getModel('itemStyle.emphasis'); + var itemStyleModel = itemModel.getModel('itemStyle.normal'); + var textStyleModel = labelModel.getModel('textStyle'); - constructor: Single, + text.setStyle({ + text: labelModel.get('show') + ? seriesModel.getFormattedLabel(indices[j - 1], 'normal') + || data.getName(indices[j - 1]) + : '', + textFont: textStyleModel.getFont(), + textAlign: labelModel.get('textAlign'), + textVerticalAlign: 'middle' + }); - /** - * Initialize single coordinate system. - * - * @param {module:echarts/coord/single/AxisModel} axisModel - * @param {module:echarts/model/Global} ecModel - * @param {module:echarts/ExtensionAPI} api - * @private - */ - _init: function (axisModel, ecModel, api) { + polygon.setStyle(zrUtil.extend({ + fill: color + }, itemStyleModel.getItemStyle(['color']))); - var dim = this.dimension; + graphic.setHoverStyle(polygon, hoverItemStyleModel.getItemStyle()); + } - var axis = new SingleAxis( - dim, - axisHelper.createScaleByModel(axisModel), - [0, 0], - axisModel.get('type'), - axisModel.get('position') - ); + this._layersSeries = layerSeries; + this._layers = newLayersGroups; + }, - var isCategory = axis.type === 'category'; - axis.onBand = isCategory && axisModel.get('boundaryGap'); - axis.inverse = axisModel.get('inverse'); - axis.orient = axisModel.get('orient'); + dispose: function () {} + }); - axisModel.axis = axis; - axis.model = axisModel; - this._axis = axis; - }, + // add animation to the view + function createGridClipShape(rect, seriesModel, cb) { + var rectEl = new graphic.Rect({ + shape: { + x: rect.x - 10, + y: rect.y - 10, + width: 0, + height: rect.height + 20 + } + }); + graphic.initProps(rectEl, { + shape: { + width: rect.width + 20, + height: rect.height + 20 + } + }, seriesModel, cb); - /** - * Update axis scale after data processed - * @param {module:echarts/model/Global} ecModel - * @param {module:echarts/ExtensionAPI} api - */ - update: function (ecModel, api) { - ecModel.eachSeries(function (seriesModel) { - if (seriesModel.coordinateSystem === this) { - var data = seriesModel.getData(); - var dim = this.dimension; - this._axis.scale.unionExtentFromData( - data, seriesModel.coordDimToDataDim(dim) - ); - axisHelper.niceScaleExtent(this._axis, this._axis.model); - } - }, this); - }, + return rectEl; + } - /** - * Resize the single coordinate system. - * - * @param {module:echarts/coord/single/AxisModel} axisModel - * @param {module:echarts/ExtensionAPI} api - */ - resize: function (axisModel, api) { - this._rect = layout.getLayoutRect( - { - left: axisModel.get('left'), - top: axisModel.get('top'), - right: axisModel.get('right'), - bottom: axisModel.get('bottom'), - width: axisModel.get('width'), - height: axisModel.get('height') - }, - { - width: api.getWidth(), - height: api.getHeight() - } - ); - this._adjustAxis(); - }, - /** - * @return {module:zrender/core/BoundingRect} - */ - getRect: function () { - return this._rect; - }, + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(305))) - /** - * @private - */ - _adjustAxis: function () { +/***/ }, +/* 305 */ +/***/ function(module, exports) { - var rect = this._rect; - var axis = this._axis; + // shim for using process in browser + var process = module.exports = {}; - var isHorizontal = axis.isHorizontal(); - var extent = isHorizontal ? [0, rect.width] : [0, rect.height]; - var idx = axis.reverse ? 1 : 0; + // cached from whatever global is present so that test runners that stub it + // don't break things. But we need to wrap it in a try catch in case it is + // wrapped in strict mode code which doesn't define any globals. It's inside a + // function because try/catches deoptimize in certain engines. - axis.setExtent(extent[idx], extent[1 - idx]); + var cachedSetTimeout; + var cachedClearTimeout; - this._updateAxisTransform(axis, isHorizontal ? rect.x : rect.y); + function defaultSetTimout() { + throw new Error('setTimeout has not been defined'); + } + function defaultClearTimeout () { + throw new Error('clearTimeout has not been defined'); + } + (function () { + try { + if (typeof setTimeout === 'function') { + cachedSetTimeout = setTimeout; + } else { + cachedSetTimeout = defaultSetTimout; + } + } catch (e) { + cachedSetTimeout = defaultSetTimout; + } + try { + if (typeof clearTimeout === 'function') { + cachedClearTimeout = clearTimeout; + } else { + cachedClearTimeout = defaultClearTimeout; + } + } catch (e) { + cachedClearTimeout = defaultClearTimeout; + } + } ()) + function runTimeout(fun) { + if (cachedSetTimeout === setTimeout) { + //normal enviroments in sane situations + return setTimeout(fun, 0); + } + // if setTimeout wasn't available but was latter defined + if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { + cachedSetTimeout = setTimeout; + return setTimeout(fun, 0); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedSetTimeout(fun, 0); + } catch(e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedSetTimeout.call(null, fun, 0); + } catch(e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error + return cachedSetTimeout.call(this, fun, 0); + } + } - }, - /** - * @param {module:echarts/coord/single/SingleAxis} axis - * @param {number} coordBase - */ - _updateAxisTransform: function (axis, coordBase) { + } + function runClearTimeout(marker) { + if (cachedClearTimeout === clearTimeout) { + //normal enviroments in sane situations + return clearTimeout(marker); + } + // if clearTimeout wasn't available but was latter defined + if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { + cachedClearTimeout = clearTimeout; + return clearTimeout(marker); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedClearTimeout(marker); + } catch (e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedClearTimeout.call(null, marker); + } catch (e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. + // Some versions of I.E. have different rules for clearTimeout vs setTimeout + return cachedClearTimeout.call(this, marker); + } + } - var axisExtent = axis.getExtent(); - var extentSum = axisExtent[0] + axisExtent[1]; - var isHorizontal = axis.isHorizontal(); - axis.toGlobalCoord = isHorizontal ? - function (coord) { - return coord + coordBase; - } : - function (coord) { - return extentSum - coord + coordBase; - }; - axis.toLocalCoord = isHorizontal ? - function (coord) { - return coord - coordBase; - } : - function (coord) { - return extentSum - coord + coordBase; - }; - }, + } + var queue = []; + var draining = false; + var currentQueue; + var queueIndex = -1; - /** - * Get axis. - * - * @return {module:echarts/coord/single/SingleAxis} - */ - getAxis: function () { - return this._axis; - }, + function cleanUpNextTick() { + if (!draining || !currentQueue) { + return; + } + draining = false; + if (currentQueue.length) { + queue = currentQueue.concat(queue); + } else { + queueIndex = -1; + } + if (queue.length) { + drainQueue(); + } + } - /** - * Get axis, add it just for draw tooltip. - * - * @return {[type]} [description] - */ - getBaseAxis: function () { - return this._axis; - }, + function drainQueue() { + if (draining) { + return; + } + var timeout = runTimeout(cleanUpNextTick); + draining = true; - /** - * If contain point. - * - * @param {Array.} point - * @return {boolean} - */ - containPoint: function (point) { - var rect = this.getRect(); - var axis = this.getAxis(); - var orient = axis.orient; - if (orient === 'horizontal') { - return axis.contain(axis.toLocalCoord(point[0])) - && (point[1] >= rect.y && point[1] <= (rect.y + rect.height)); - } - else { - return axis.contain(axis.toLocalCoord(point[1])) - && (point[0] >= rect.y && point[0] <= (rect.y + rect.height)); + var len = queue.length; + while(len) { + currentQueue = queue; + queue = []; + while (++queueIndex < len) { + if (currentQueue) { + currentQueue[queueIndex].run(); } - }, + } + queueIndex = -1; + len = queue.length; + } + currentQueue = null; + draining = false; + runClearTimeout(timeout); + } + + process.nextTick = function (fun) { + var args = new Array(arguments.length - 1); + if (arguments.length > 1) { + for (var i = 1; i < arguments.length; i++) { + args[i - 1] = arguments[i]; + } + } + queue.push(new Item(fun, args)); + if (queue.length === 1 && !draining) { + runTimeout(drainQueue); + } + }; + + // v8 likes predictible objects + function Item(fun, array) { + this.fun = fun; + this.array = array; + } + Item.prototype.run = function () { + this.fun.apply(null, this.array); + }; + process.title = 'browser'; + process.browser = true; + process.env = {}; + process.argv = []; + process.version = ''; // empty string to avoid regexp issues + process.versions = {}; - /** - * @param {Array.} point - * @return {Array.} - */ - pointToData: function (point) { - var axis = this.getAxis(); - return [axis.coordToData(axis.toLocalCoord( - point[axis.orient === 'horizontal' ? 0 : 1] - ))]; - }, + function noop() {} - /** - * Convert the series data to concrete point. - * - * @param {number|Array.} val - * @return {Array.} - */ - dataToPoint: function (val) { - var axis = this.getAxis(); - var rect = this.getRect(); - var pt = []; - var idx = axis.orient === 'horizontal' ? 0 : 1; - pt[idx] = axis.toGlobalCoord(axis.dataToCoord(+val)); - pt[1 - idx] = idx === 0 ? (rect.y + rect.height / 2) : (rect.x + rect.width / 2); - return pt; - } - }; + process.on = noop; + process.addListener = noop; + process.once = noop; + process.off = noop; + process.removeListener = noop; + process.removeAllListeners = noop; + process.emit = noop; - module.exports = Single; + process.binding = function (name) { + throw new Error('process.binding is not supported'); + }; + process.cwd = function () { return '/' }; + process.chdir = function (dir) { + throw new Error('process.chdir is not supported'); + }; + process.umask = function() { return 0; }; /***/ }, -/* 284 */ +/* 306 */ /***/ function(module, exports, __webpack_require__) { - + /** + * @file Using layout algorithm transform the raw data to layout information. + * @author Deqing Li(annong035@gmail.com) + */ + var zrUtil = __webpack_require__(4); - var Axis = __webpack_require__(124); - var axisHelper = __webpack_require__(115); + var numberUtil = __webpack_require__(7); - /** - * @constructor module:echarts/coord/single/SingleAxis - * @extends {module:echarts/coord/Axis} - * @param {string} dim - * @param {*} scale - * @param {Array.} coordExtent - * @param {string} axisType - * @param {string} position - */ - var SingleAxis = function (dim, scale, coordExtent, axisType, position) { - Axis.call(this, dim, scale, coordExtent); + module.exports = function (ecModel, api) { - /** - * Axis type - * - 'category' - * - 'value' - * - 'time' - * - 'log' - * @type {string} - */ - this.type = axisType || 'value'; + ecModel.eachSeriesByType('themeRiver', function (seriesModel) { - /** - * Axis position - * - 'top' - * - 'bottom' - * - 'left' - * - 'right' - * @type {string} - */ - this.position = position || 'bottom'; + var data = seriesModel.getData(); - /** - * Axis orient - * - 'horizontal' - * - 'vertical' - * @type {[type]} - */ - this.orient = null; + var single = seriesModel.coordinateSystem; - /** - * @type {number} - */ - this._labelInterval = null; + var layoutInfo = {}; + + // use the axis boundingRect for view + var rect = single.getRect(); + + layoutInfo.rect = rect; + + var boundaryGap = seriesModel.get('boundaryGap'); + + var axis = single.getAxis(); + + layoutInfo.boundaryGap = boundaryGap; + + if (axis.orient === 'horizontal') { + boundaryGap[0] = numberUtil.parsePercent(boundaryGap[0], rect.height); + boundaryGap[1] = numberUtil.parsePercent(boundaryGap[1], rect.height); + var height = rect.height - boundaryGap[0] - boundaryGap[1]; + themeRiverLayout(data, seriesModel, height); + } + else { + boundaryGap[0] = numberUtil.parsePercent(boundaryGap[0], rect.width); + boundaryGap[1] = numberUtil.parsePercent(boundaryGap[1], rect.width); + var width = rect.width - boundaryGap[0] - boundaryGap[1]; + themeRiverLayout(data, seriesModel, width); + } + data.setLayout('layoutInfo', layoutInfo); + }); }; - SingleAxis.prototype = { + /** + * The layout information about themeriver + * + * @param {module:echarts/data/List} data data in the series + * @param {module:echarts/model/Series} seriesModel the model object of themeRiver series + * @param {number} height value used to compute every series height + */ + function themeRiverLayout(data, seriesModel, height) { + if (!data.count()) { + return; + } + var coordSys = seriesModel.coordinateSystem; + // the data in each layer are organized into a series. + var layerSeries = seriesModel.getLayerSeries(); - constructor: SingleAxis, + // the points in each layer. + var layerPoints = zrUtil.map(layerSeries, function (singleLayer) { + return zrUtil.map(singleLayer.indices, function (idx) { + var pt = coordSys.dataToPoint(data.get('time', idx)); + pt[1] = data.get('value', idx); + return pt; + }); + }); - /** - * Axis model - * @type {module:echarts/coord/single/AxisModel} - */ - model: null, + var base = computeBaseline(layerPoints); + var baseLine = base.y0; + var ky = height / base.max; - /** - * Judge the orient of the axis. - * @return {boolean} - */ - isHorizontal: function () { - var position = this.position; - return position === 'top' || position === 'bottom'; + // set layout information for each item. + var n = layerSeries.length; + var m = layerSeries[0].indices.length; + var baseY0; + for (var j = 0; j < m; ++j) { + baseY0 = baseLine[j] * ky; + data.setItemLayout(layerSeries[0].indices[j], { + layerIndex: 0, + x: layerPoints[0][j][0], + y0: baseY0, + y: layerPoints[0][j][1] * ky + }); + for (var i = 1; i < n; ++i) { + baseY0 += layerPoints[i - 1][j][1] * ky; + data.setItemLayout(layerSeries[i].indices[j], { + layerIndex: i, + x: layerPoints[i][j][0], + y0: baseY0, + y: layerPoints[i][j][1] * ky + }); + } + } + } - }, + /** + * Compute the baseLine of the rawdata + * Inspired by Lee Byron's paper Stacked Graphs - Geometry & Aesthetics + * + * @param {Array.} data the points in each layer + * @return {Array} + */ + function computeBaseline(data) { + var layerNum = data.length; + var pointNum = data[0].length; + var sums = []; + var y0 = []; + var max = 0; + var temp; + var base = {}; - /** - * Get interval of the axis label. - * @return {number} - */ - getLabelInterval: function () { - var labelInterval = this._labelInterval; - if (!labelInterval) { - var axisModel = this.model; - var labelModel = axisModel.getModel('axisLabel'); - var interval = labelModel.get('interval'); - if (!(this.type === 'category' && interval === 'auto')) { + for (var i = 0; i < pointNum; ++i) { + for (var j = 0, temp = 0; j < layerNum; ++j) { + temp += data[j][i][1]; + } + if (temp > max) { + max = temp; + } + sums.push(temp); + } - labelInterval = this._labelInterval = interval === 'auto' ? 0 : interval; - return labelInterval; - } - labelInterval = this._labelInterval = - axisHelper.getAxisLabelInterval( - zrUtil.map(this.scale.getTicks(), this.dataToCoord, this), - axisModel.getFormattedLabels(), - labelModel.getModel('textStyle').getFont(), - this.isHorizontal() - ); + for (var k = 0; k < pointNum; ++k) { + y0[k] = (max - sums[k]) / 2; + } + max = 0; + + for (var l = 0; l < pointNum; ++l) { + var sum = sums[l] + y0[l]; + if (sum > max) { + max = sum; } - return labelInterval; - }, + } + base.y0 = y0; + base.max = max; - /** - * Convert the local coord(processed by dataToCoord()) - * to global coord(concrete pixel coord). - * designated by module:echarts/coord/single/Single. - * @type {Function} - */ - toGlobalCoord: null, + return base; + } - /** - * Convert the global coord to local coord. - * designated by module:echarts/coord/single/Single. - * @type {Function} - */ - toLocalCoord: null - }; - zrUtil.inherits(SingleAxis, Axis); +/***/ }, +/* 307 */ +/***/ function(module, exports) { + + /** + * @file Visual encoding for themeRiver view + * @author Deqing Li(annong035@gmail.com) + */ + + + module.exports = function (ecModel) { + ecModel.eachSeriesByType('themeRiver', function (seriesModel) { + var data = seriesModel.getData(); + var rawData = seriesModel.getRawData(); + var colorList = seriesModel.get('color'); + + data.each(function (index) { + var name = data.getName(index); + var color = colorList[(seriesModel.nameMap[name] - 1) % colorList.length]; + rawData.setItemVisual(index, 'color', color); + }); + }); + }; - module.exports = SingleAxis; /***/ }, -/* 285 */ +/* 308 */ /***/ function(module, exports, __webpack_require__) { - var AxisBuilder = __webpack_require__(133); - var zrUtil = __webpack_require__(4); - var graphic = __webpack_require__(43); - var getInterval = AxisBuilder.getInterval; - var ifIgnoreOnTick = AxisBuilder.ifIgnoreOnTick; + var echarts = __webpack_require__(1); + var zrUtil = __webpack_require__(4); + var modelUtil = __webpack_require__(5); + var graphicUtil = __webpack_require__(44); + var layoutUtil = __webpack_require__(21); - var axisBuilderAttrs = [ - 'axisLine', 'axisLabel', 'axisTick', 'axisName' - ]; + // ------------- + // Preprocessor + // ------------- - var selfBuilderAttr = 'splitLine'; + echarts.registerPreprocessor(function (option) { + var graphicOption = option.graphic; - var AxisView = __webpack_require__(1).extendComponentView({ + // Convert + // {graphic: [{left: 10, type: 'circle'}, ...]} + // or + // {graphic: {left: 10, type: 'circle'}} + // to + // {graphic: [{elements: [{left: 10, type: 'circle'}, ...]}]} + if (zrUtil.isArray(graphicOption)) { + if (!graphicOption[0] || !graphicOption[0].elements) { + option.graphic = [{elements: graphicOption}]; + } + else { + // Only one graphic instance can be instantiated. (We dont + // want that too many views are created in echarts._viewMap) + option.graphic = [option.graphic[0]]; + } + } + else if (graphicOption && !graphicOption.elements) { + option.graphic = [{elements: [graphicOption]}]; + } + }); - type: 'singleAxis', + // ------ + // Model + // ------ - render: function (axisModel, ecModel) { + var GraphicModel = echarts.extendComponentModel({ - var group = this.group; + type: 'graphic', - group.removeAll(); + defaultOption: { - var layout = axisLayout(axisModel); + // Extra properties for each elements: + // + // left/right/top/bottom: (like 12, '22%', 'center', default undefined) + // If left/rigth is set, shape.x/shape.cx/position will not be used. + // If top/bottom is set, shape.y/shape.cy/position will not be used. + // This mechanism is useful when you want to position a group/element + // against the right side or the center of this container. + // + // width/height: (can only be pixel value, default 0) + // Only be used to specify contianer(group) size, if needed. And + // can not be percentage value (like '33%'). See the reason in the + // layout algorithm below. + // + // bounding: (enum: 'all' (default) | 'raw') + // Specify how to calculate boundingRect when locating. + // 'all': Get uioned and transformed boundingRect + // from both itself and its descendants. + // This mode simplies confining a group of elements in the bounding + // of their ancester container (e.g., using 'right: 0'). + // 'raw': Only use the boundingRect of itself and before transformed. + // This mode is similar to css behavior, which is useful when you + // want an element to be able to overflow its container. (Consider + // a rotated circle needs to be located in a corner.) - var axisBuilder = new AxisBuilder(axisModel, layout); + // Note: elements is always behind its ancestors in this elements array. + elements: [], + parentId: null + }, - zrUtil.each(axisBuilderAttrs, axisBuilder.add, axisBuilder); + /** + * Save el options for the sake of the performance (only update modified graphics). + * The order is the same as those in option. (ancesters -> descendants) + * + * @private + * @type {Array.} + */ + _elOptionsToUpdate: null, - group.add(axisBuilder.getGroup()); + /** + * @override + */ + mergeOption: function (option) { + // Prevent default merge to elements + var elements = this.option.elements; + this.option.elements = null; - if (axisModel.get(selfBuilderAttr + '.show')) { - this['_' + selfBuilderAttr](axisModel, layout.labelInterval); - } + GraphicModel.superApply(this, 'mergeOption', arguments); + + this.option.elements = elements; }, - _splitLine: function(axisModel, labelInterval) { - var axis = axisModel.axis; + /** + * @override + */ + optionUpdated: function (newOption, isInit) { + var thisOption = this.option; + var newList = (isInit ? thisOption : newOption).elements; + var existList = thisOption.elements = isInit ? [] : thisOption.elements; - if (axis.isBlank()) { - return; - } + var flattenedList = []; + this._flatten(newList, flattenedList); - var splitLineModel = axisModel.getModel('splitLine'); - var lineStyleModel = splitLineModel.getModel('lineStyle'); - var lineWidth = lineStyleModel.get('width'); - var lineColors = lineStyleModel.get('color'); - var lineInterval = getInterval(splitLineModel, labelInterval); + var mappingResult = modelUtil.mappingToExists(existList, flattenedList); + modelUtil.makeIdAndName(mappingResult); - lineColors = lineColors instanceof Array ? lineColors : [lineColors]; + // Clear elOptionsToUpdate + var elOptionsToUpdate = this._elOptionsToUpdate = []; - var gridRect = axisModel.coordinateSystem.getRect(); - var isHorizontal = axis.isHorizontal(); + zrUtil.each(mappingResult, function (resultItem, index) { + var newElOption = resultItem.option; - var splitLines = []; - var lineCount = 0; + if (true) { + zrUtil.assert( + zrUtil.isObject(newElOption) || resultItem.exist, + 'Empty graphic option definition' + ); + } - var ticksCoords = axis.getTicksCoords(); + if (!newElOption) { + return; + } - var p1 = []; - var p2 = []; + elOptionsToUpdate.push(newElOption); - for (var i = 0; i < ticksCoords.length; ++i) { - if (ifIgnoreOnTick(axis, i, lineInterval)) { - continue; - } - var tickCoord = axis.toGlobalCoord(ticksCoords[i]); - if (isHorizontal) { - p1[0] = tickCoord; - p1[1] = gridRect.y; - p2[0] = tickCoord; - p2[1] = gridRect.y + gridRect.height; + setKeyInfoToNewElOption(resultItem, newElOption); + + mergeNewElOptionToExist(existList, index, newElOption); + + setLayoutInfoToExist(existList[index], newElOption); + + }, this); + + // Clean + for (var i = existList.length - 1; i >= 0; i--) { + if (existList[i] == null) { + existList.splice(i, 1); } else { - p1[0] = gridRect.x; - p1[1] = tickCoord; - p2[0] = gridRect.x + gridRect.width; - p2[1] = tickCoord; + // $action should be volatile, otherwise option gotten from + // `getOption` will contain unexpected $action. + delete existList[i].$action; } - var colorIndex = (lineCount++) % lineColors.length; - splitLines[colorIndex] = splitLines[colorIndex] || []; - splitLines[colorIndex].push(new graphic.Line( - graphic.subPixelOptimizeLine({ - shape: { - x1: p1[0], - y1: p1[1], - x2: p2[0], - y2: p2[1] - }, - style: { - lineWidth: lineWidth - }, - silent: true - }))); - } - - for (var i = 0; i < splitLines.length; ++i) { - this.group.add(graphic.mergePath(splitLines[i], { - style: { - stroke: lineColors[i % lineColors.length], - lineDash: lineStyleModel.getLineDash(lineWidth), - lineWidth: lineWidth - }, - silent: true - })); } - } - }); + }, - function axisLayout(axisModel) { + /** + * Convert + * [{ + * type: 'group', + * id: 'xx', + * children: [{type: 'circle'}, {type: 'polygon'}] + * }] + * to + * [ + * {type: 'group', id: 'xx'}, + * {type: 'circle', parentId: 'xx'}, + * {type: 'polygon', parentId: 'xx'} + * ] + * + * @private + * @param {Array.} optionList option list + * @param {Array.} result result of flatten + * @param {Object} parentOption parent option + */ + _flatten: function (optionList, result, parentOption) { + zrUtil.each(optionList, function (option) { + if (!option) { + return; + } - var single = axisModel.coordinateSystem; - var axis = axisModel.axis; - var layout = {}; + if (parentOption) { + option.parentOption = parentOption; + } - var axisPosition = axis.position; - var orient = axis.orient; + result.push(option); - var rect = single.getRect(); - var rectBound = [rect.x, rect.x + rect.width, rect.y, rect.y + rect.height]; + var children = option.children; + if (option.type === 'group' && children) { + this._flatten(children, result, option); + } + // Deleting for JSON output, and for not affecting group creation. + delete option.children; + }, this); + }, - var positionMap = { - horizontal: {top: rectBound[2], bottom: rectBound[3]}, - vertical: {left: rectBound[0], right: rectBound[1]} - }; + // FIXME + // Pass to view using payload? setOption has a payload? + useElOptionsToUpdate: function () { + var els = this._elOptionsToUpdate; + // Clear to avoid render duplicately when zooming. + this._elOptionsToUpdate = null; + return els; + } + }); - layout.position = [ - orient === 'vertical' - ? positionMap.vertical[axisPosition] - : rectBound[0], - orient === 'horizontal' - ? positionMap.horizontal[axisPosition] - : rectBound[3] - ]; + // ----- + // View + // ----- - var r = {horizontal: 0, vertical: 1}; - layout.rotation = Math.PI / 2 * r[orient]; + echarts.extendComponentView({ - var directionMap = {top: -1, bottom: 1, right: 1, left: -1}; + type: 'graphic', - layout.labelDirection = layout.tickDirection - = layout.nameDirection - = directionMap[axisPosition]; + /** + * @override + */ + init: function (ecModel, api) { - if (axisModel.getModel('axisTick').get('inside')) { - layout.tickDirection = -layout.tickDirection; - } + /** + * @private + * @type {Object} + */ + this._elMap = {}; - if (axisModel.getModel('axisLabel').get('inside')) { - layout.labelDirection = -layout.labelDirection; - } + /** + * @private + * @type {module:echarts/graphic/GraphicModel} + */ + this._lastGraphicModel; + }, - var labelRotation = axisModel.getModel('axisLabel').get('rotate'); - layout.labelRotation = axisPosition === 'top' ? -labelRotation : labelRotation; + /** + * @override + */ + render: function (graphicModel, ecModel, api) { - layout.labelInterval = axis.getLabelInterval(); + // Having leveraged between use cases and algorithm complexity, a very + // simple layout mechanism is used: + // The size(width/height) can be determined by itself or its parent (not + // implemented yet), but can not by its children. (Top-down travel) + // The location(x/y) can be determined by the bounding rect of itself + // (can including its descendants or not) and the size of its parent. + // (Bottom-up travel) - layout.z2 = 1; + // When `chart.clear()` or `chart.setOption({...}, true)` with the same id, + // view will be reused. + if (graphicModel !== this._lastGraphicModel) { + this._clear(); + } + this._lastGraphicModel = graphicModel; - return layout; - } + this._updateElements(graphicModel, api); + this._relocate(graphicModel, api); + }, - module.exports = AxisView; + /** + * Update graphic elements. + * + * @private + * @param {Object} graphicModel graphic model + * @param {module:echarts/ExtensionAPI} api extension API + */ + _updateElements: function (graphicModel, api) { + var elOptionsToUpdate = graphicModel.useElOptionsToUpdate(); + if (!elOptionsToUpdate) { + return; + } + var elMap = this._elMap; + var rootGroup = this.group; -/***/ }, -/* 286 */ -/***/ function(module, exports, __webpack_require__) { + // Top-down tranverse to assign graphic settings to each elements. + zrUtil.each(elOptionsToUpdate, function (elOption) { + var $action = elOption.$action; + var id = elOption.id; + var existEl = elMap[id]; + var parentId = elOption.parentId; + var targetElParent = parentId != null ? elMap[parentId] : rootGroup; - + // In top/bottom mode, textVertical should not be used. And textBaseline + // should not be 'alphabetic', which cause inaccurately locating. + if (elOption.hv && elOption.hv[1] && elOption.type === 'text') { + elOption.style = zrUtil.defaults({textBaseline: 'middle'}, elOption.style); + elOption.style.textVerticalAlign = null; + } - var ComponentModel = __webpack_require__(19); - var axisModelCreator = __webpack_require__(128); - var zrUtil = __webpack_require__(4); + // Remove unnecessary props to avoid potential problems. + var elOptionCleaned = getCleanedElOption(elOption); - var AxisModel = ComponentModel.extend({ + // For simple, do not support parent change, otherwise reorder is needed. + if (true) { + existEl && zrUtil.assert( + targetElParent === existEl.parent, + 'Changing parent is not supported.' + ); + } - type: 'singleAxis', + if (!$action || $action === 'merge') { + existEl + ? existEl.attr(elOptionCleaned) + : createEl(id, targetElParent, elOptionCleaned, elMap); + } + else if ($action === 'replace') { + removeEl(existEl, elMap); + createEl(id, targetElParent, elOptionCleaned, elMap); + } + else if ($action === 'remove') { + removeEl(existEl, elMap); + } - layoutMode: 'box', + if (elMap[id]) { + elMap[id].__ecGraphicWidth = elOption.width; + elMap[id].__ecGraphicHeight = elOption.height; + } + }); + }, /** - * @type {module:echarts/coord/single/SingleAxis} + * Locate graphic elements. + * + * @private + * @param {Object} graphicModel graphic model + * @param {module:echarts/ExtensionAPI} api extension API */ - axis: null, + _relocate: function (graphicModel, api) { + var elOptions = graphicModel.option.elements; + var rootGroup = this.group; + var elMap = this._elMap; + + // Bottom-up tranvese all elements (consider ec resize) to locate elements. + for (var i = elOptions.length - 1; i >= 0; i--) { + var elOption = elOptions[i]; + var el = elMap[elOption.id]; + + if (!el) { + continue; + } + + var parentEl = el.parent; + var containerInfo = parentEl === rootGroup + ? { + width: api.getWidth(), + height: api.getHeight() + } + : { // Like 'position:absolut' in css, default 0. + width: parentEl.__ecGraphicWidth || 0, + height: parentEl.__ecGraphicHeight || 0 + }; + + layoutUtil.positionElement( + el, elOption, containerInfo, null, + {hv: elOption.hv, boundingMode: elOption.bounding} + ); + } + }, /** - * @type {module:echarts/coord/single/Single} + * Clear all elements. + * + * @private */ - coordinateSystem: null, + _clear: function () { + var elMap = this._elMap; + zrUtil.each(elMap, function (el) { + removeEl(el, elMap); + }); + this._elMap = {}; + }, /** * @override */ - getCoordSysModel: function () { - return this; + dispose: function () { + this._clear(); } - }); - var defaultOption = { + function createEl(id, targetElParent, elOption, elMap) { + var graphicType = elOption.type; - left: '5%', - top: '5%', - right: '5%', - bottom: '5%', + if (true) { + zrUtil.assert(graphicType, 'graphic type MUST be set'); + } - type: 'value', + var Clz = graphicUtil[graphicType.charAt(0).toUpperCase() + graphicType.slice(1)]; - position: 'bottom', + if (true) { + zrUtil.assert(Clz, 'graphic type can not be found'); + } - orient: 'horizontal', + var el = new Clz(elOption); + targetElParent.add(el); + elMap[id] = el; + el.__ecGraphicId = id; + } - axisLine: { - show: true, - lineStyle: { - width: 2, - type: 'solid' - } - }, + function removeEl(existEl, elMap) { + var existElParent = existEl && existEl.parent; + if (existElParent) { + existEl.type === 'group' && existEl.traverse(function (el) { + removeEl(el, elMap); + }); + delete elMap[existEl.__ecGraphicId]; + existElParent.remove(existEl); + } + } - axisTick: { - show: true, - length: 6, - lineStyle: { - width: 2 + // Remove unnecessary props to avoid potential problems. + function getCleanedElOption(elOption) { + elOption = zrUtil.extend({}, elOption); + zrUtil.each( + ['id', 'parentId', '$action', 'hv', 'bounding'].concat(layoutUtil.LOCATION_PARAMS), + function (name) { + delete elOption[name]; } - }, + ); + return elOption; + } - axisLabel: { - show: true, - interval: 'auto' - }, + function isSetLoc(obj, props) { + var isSet; + zrUtil.each(props, function (prop) { + obj[prop] != null && obj[prop] !== 'auto' && (isSet = true); + }); + return isSet; + } - splitLine: { - show: true, - lineStyle: { - type: 'dashed', - opacity: 0.2 + function setKeyInfoToNewElOption(resultItem, newElOption) { + var existElOption = resultItem.exist; + + // Set id and type after id assigned. + newElOption.id = resultItem.keyInfo.id; + !newElOption.type && existElOption && (newElOption.type = existElOption.type); + + // Set parent id if not specified + if (newElOption.parentId == null) { + var newElParentOption = newElOption.parentOption; + if (newElParentOption) { + newElOption.parentId = newElParentOption.id; + } + else if (existElOption) { + newElOption.parentId = existElOption.parentId; } } - }; - function getAxisType(axisName, option) { - return option.type || (option.data ? 'category' : 'value'); + // Clear + newElOption.parentOption = null; } - zrUtil.merge(AxisModel.prototype, __webpack_require__(130)); + function mergeNewElOptionToExist(existList, index, newElOption) { + // Update existing options, for `getOption` feature. + var newElOptCopy = zrUtil.extend({}, newElOption); + var existElOption = existList[index]; - axisModelCreator('single', AxisModel, getAxisType, defaultOption); + var $action = newElOption.$action || 'merge'; + if ($action === 'merge') { + if (existElOption) { + + if (true) { + var newType = newElOption.type; + zrUtil.assert( + !newType || existElOption.type === newType, + 'Please set $action: "replace" to change `type`' + ); + } + + // We can ensure that newElOptCopy and existElOption are not + // the same object, so `merge` will not change newElOptCopy. + zrUtil.merge(existElOption, newElOptCopy, true); + // Rigid body, use ignoreSize. + layoutUtil.mergeLayoutParam(existElOption, newElOptCopy, {ignoreSize: true}); + // Will be used in render. + layoutUtil.copyLayoutParams(newElOption, existElOption); + } + else { + existList[index] = newElOptCopy; + } + } + else if ($action === 'replace') { + existList[index] = newElOptCopy; + } + else if ($action === 'remove') { + // null will be cleaned later. + existElOption && (existList[index] = null); + } + } + + function setLayoutInfoToExist(existItem, newElOption) { + if (!existItem) { + return; + } + existItem.hv = newElOption.hv = [ + // Rigid body, dont care `width`. + isSetLoc(newElOption, ['left', 'right']), + // Rigid body, dont care `height`. + isSetLoc(newElOption, ['top', 'bottom']) + ]; + // Give default group size. Otherwise layout error may occur. + if (existItem.type === 'group') { + existItem.width == null && (existItem.width = newElOption.width = 0); + existItem.height == null && (existItem.height = newElOption.height = 0); + } + } - module.exports = AxisModel; /***/ }, -/* 287 */ +/* 309 */ /***/ function(module, exports, __webpack_require__) { - 'use strict'; /** - * @file Define the themeRiver view's series model - * @author Deqing Li(annong035@gmail.com) + * Legend component entry file8 */ - var completeDimensions = __webpack_require__(103); - var SeriesModel = __webpack_require__(28); - var List = __webpack_require__(98); - var zrUtil = __webpack_require__(4); - var formatUtil = __webpack_require__(6); - var encodeHTML = formatUtil.encodeHTML; - var nest = __webpack_require__(245); + __webpack_require__(310); + __webpack_require__(311); + __webpack_require__(312); - var DATA_NAME_INDEX = 2; + var echarts = __webpack_require__(1); + // Series Filter + echarts.registerProcessor(__webpack_require__(314)); - var ThemeRiverSeries = SeriesModel.extend({ - type: 'series.themeRiver', +/***/ }, +/* 310 */ +/***/ function(module, exports, __webpack_require__) { - dependencies: ['singleAxis'], + 'use strict'; - /** - * @readOnly - * @type {Object} - */ - nameMap: null, - /** - * @override - */ - init: function (option) { - ThemeRiverSeries.superApply(this, 'init', arguments); + var zrUtil = __webpack_require__(4); + var Model = __webpack_require__(12); - // Put this function here is for the sake of consistency of code - // Enable legend selection for each data item - // Use a function instead of direct access because data reference may changed - this.legendDataProvider = function () { - return this.getRawData(); - }; + var LegendModel = __webpack_require__(1).extendComponentModel({ + + type: 'legend', + + dependencies: ['series'], + + layoutMode: { + type: 'box', + ignoreSize: true }, - /** - * If there is no value of a certain point in the time for some event,set it value to 0. - * - * @param {Array} data initial data in the option - * @return {Array} - */ - fixData: function (data) { - var rawDataLength = data.length; + init: function (option, parentModel, ecModel) { + this.mergeDefaultAndTheme(option, ecModel); - // grouped data by name - var dataByName = nest() - .key(function (dataItem) { - return dataItem[2]; - }) - .entries(data); + option.selected = option.selected || {}; + }, - // data group in each layer - var layData = zrUtil.map(dataByName, function (d) { - return { - name: d.key, - dataList: d.values - }; - }); + mergeOption: function (option) { + LegendModel.superCall(this, 'mergeOption', option); + }, - var layerNum = layData.length; - var largestLayer = -1; - var index = -1; - for (var i = 0; i < layerNum; ++i) { - var len = layData[i].dataList.length; - if (len > largestLayer) { - largestLayer = len; - index = i; - } - } + optionUpdated: function () { + this._updateData(this.ecModel); - for (var k = 0; k < layerNum; ++k) { - if (k === index) { - continue; - } - var name = layData[k].name; - for (var j = 0; j < largestLayer; ++j) { - var timeValue = layData[index].dataList[j][0]; - var length = layData[k].dataList.length; - var keyIndex = -1; - for (var l = 0; l < length; ++l) { - var value = layData[k].dataList[l][0]; - if (value === timeValue) { - keyIndex = l; - break; - } - } - if (keyIndex === -1) { - data[rawDataLength] = []; - data[rawDataLength][0] = timeValue; - data[rawDataLength][1] = 0; - data[rawDataLength][2] = name; - rawDataLength++; + var legendData = this._data; + // If selectedMode is single, try to select one + if (legendData[0] && this.get('selectedMode') === 'single') { + var hasSelected = false; + // If has any selected in option.selected + for (var i = 0; i < legendData.length; i++) { + var name = legendData[i].get('name'); + if (this.isSelected(name)) { + // Force to unselect others + this.select(name); + hasSelected = true; + break; } } + // Try select the first if selectedMode is single + !hasSelected && this.select(legendData[0].get('name')); } - return data; }, - /** - * @override - * @param {Object} option the initial option that user gived - * @param {module:echarts/model/Model} ecModel the model object for themeRiver option - * @return {module:echarts/data/List} - */ - getInitialData: function (option, ecModel) { - - var dimensions = []; - - var singleAxisModel = ecModel.queryComponents({ - mainType: 'singleAxis', - index: this.get('singleAxisIndex'), - id: this.get('singleAxisId') - })[0]; - - var axisType = singleAxisModel.get('type'); - - dimensions = [ - { - name: 'time', - // FIXME common? - type: axisType === 'category' - ? 'ordinal' - : axisType === 'time' - ? 'time' - : 'float' - }, - { - name: 'value', - type: 'float' - }, - { - name: 'name', - type: 'ordinal' + _updateData: function (ecModel) { + var legendData = zrUtil.map(this.get('data') || [], function (dataItem) { + // Can be string or number + if (typeof dataItem === 'string' || typeof dataItem === 'number') { + dataItem = { + name: dataItem + }; } - ]; + return new Model(dataItem, this, this.ecModel); + }, this); + this._data = legendData; - // filter the data item with the value of label is undefined - var filterData = zrUtil.filter(option.data, function (dataItem) { - return dataItem[2] !== undefined; + var availableNames = zrUtil.map(ecModel.getSeries(), function (series) { + return series.name; }); - - var data = this.fixData(filterData || []); - var nameList = []; - var nameMap = this.nameMap = {}; - var count = 0; - - for (var i = 0; i < data.length; ++i) { - nameList.push(data[i][DATA_NAME_INDEX]); - if (!nameMap[data[i][DATA_NAME_INDEX]]) { - nameMap[data[i][DATA_NAME_INDEX]] = count++; + ecModel.eachSeries(function (seriesModel) { + if (seriesModel.legendDataProvider) { + var data = seriesModel.legendDataProvider(); + availableNames = availableNames.concat(data.mapArray(data.getName)); } - } - - completeDimensions(dimensions, data); - - var list = new List(dimensions, this); - - list.initData(data, nameList); - - return list; + }); + /** + * @type {Array.} + * @private + */ + this._availableNames = availableNames; }, /** - * Used by single coordinate - * - * @param {string} axisDim the dimension for single coordinate - * @return {Array. } specified dimensions on the axis. + * @return {Array.} */ - coordDimToDataDim: function (axisDim) { - return ['time']; + getData: function () { + return this._data; }, /** - * The raw data is divided into multiple layers and each layer - * has same name. - * - * @return {Array.>} + * @param {string} name */ - getLayerSeries: function () { - var data = this.getData(); - var lenCount = data.count(); - var indexArr = []; - - for (var i = 0; i < lenCount; ++i) { - indexArr[i] = i; - } - // data group by name - var dataByName = nest() - .key(function (index) { - return data.get('name', index); - }) - .entries(indexArr); - - var layerSeries = zrUtil.map(dataByName, function (d) { - return { - name: d.key, - indices: d.values - }; - }); - - for (var j = 0; j < layerSeries.length; ++j) { - layerSeries[j].indices.sort(comparer); - } - - function comparer(index1, index2) { - return data.get('time', index1) - data.get('time', index2); + select: function (name) { + var selected = this.option.selected; + var selectedMode = this.get('selectedMode'); + if (selectedMode === 'single') { + var data = this._data; + zrUtil.each(data, function (dataItem) { + selected[dataItem.get('name')] = false; + }); } - - return layerSeries; + selected[name] = true; }, /** - * Get data indices for show tooltip content - * - * @param {Array.|string} dim single coordinate dimension - * @param {Array.} value coordinate value - * @param {module:echarts/coord/single/SingleAxis} baseAxis single Axis used - * the themeRiver. - * @return {Array.} + * @param {string} name */ - getAxisTooltipDataIndex: function (dim, value, baseAxis) { - if (!zrUtil.isArray(dim)) { - dim = dim ? [dim] : []; - } - - var data = this.getData(); - - if (baseAxis.orient === 'horizontal') { - value = value[0]; - } - else { - value = value[1]; - } - - var layerSeries = this.getLayerSeries(); - var indices = []; - var layerNum = layerSeries.length; - - for (var i = 0; i < layerNum; ++i) { - var minDist = Number.MAX_VALUE; - var nearestIdx = -1; - var pointNum = layerSeries[i].indices.length; - for (var j = 0; j < pointNum; ++j) { - var dist = Math.abs(data.get(dim[0], layerSeries[i].indices[j]) - value); - if (dist <= minDist) { - minDist = dist; - nearestIdx = layerSeries[i].indices[j]; - } - } - indices.push(nearestIdx); + unSelect: function (name) { + if (this.get('selectedMode') !== 'single') { + this.option.selected[name] = false; } - return indices; }, /** - * @override - * @param {Array.} dataIndexs index of data + * @param {string} name */ - formatTooltip: function (dataIndexs) { - var data = this.getData(); - var len = dataIndexs.length; - var time = data.get('time', dataIndexs[0]); - var single = this.coordinateSystem; - var axis = single.getAxis(); - - if (axis.scale.type === 'time') { - time = formatUtil.formatTime('yyyy-MM-dd', time); + toggleSelected: function (name) { + var selected = this.option.selected; + // Default is true + if (!selected.hasOwnProperty(name)) { + selected[name] = true; } + this[selected[name] ? 'unSelect' : 'select'](name); + }, - var html = encodeHTML(time) + '
'; - for (var i = 0; i < len; ++i) { - var htmlName = data.get('name', dataIndexs[i]); - var htmlValue = data.get('value', dataIndexs[i]); - if (isNaN(htmlValue) || htmlValue == null) { - htmlValue = '-'; - } - html += encodeHTML(htmlName + ' : ' + htmlValue) + '
'; - } - return html; + /** + * @param {string} name + */ + isSelected: function (name) { + var selected = this.option.selected; + return !(selected.hasOwnProperty(name) && !selected[name]) + && zrUtil.indexOf(this._availableNames, name) >= 0; }, defaultOption: { + // 一级层叠 zlevel: 0, - z: 2, + // 二级层叠 + z: 4, + show: true, - coordinateSystem: 'singleAxis', + // 布局方式,默认为水平布局,可选为: + // 'horizontal' | 'vertical' + orient: 'horizontal', - // gap in axis's orthogonal orientation - boundaryGap: ['10%', '10%'], + left: 'center', + // right: 'center', - // legendHoverLink: true, + top: 'top', + // bottom: 'top', - singleAxisIndex: 0, + // 水平对齐 + // 'auto' | 'left' | 'right' + // 默认为 'auto', 根据 x 的位置判断是左对齐还是右对齐 + align: 'auto', - animationEasing: 'linear', + backgroundColor: 'rgba(0,0,0,0)', + // 图例边框颜色 + borderColor: '#ccc', + // 图例边框线宽,单位px,默认为0(无边框) + borderWidth: 0, + // 图例内边距,单位px,默认各方向内边距为5, + // 接受数组分别设定上右下左边距,同css + padding: 5, + // 各个item之间的间隔,单位px,默认为10, + // 横向布局时为水平间隔,纵向布局时为纵向间隔 + itemGap: 10, + // 图例图形宽度 + itemWidth: 25, + // 图例图形高度 + itemHeight: 14, - label: { - normal: { - margin: 4, - textAlign: 'right', - show: true, - position: 'left', - textStyle: { - color: '#000', - fontSize: 11 - } - }, - emphasis: { - show: true - } + // 图例关闭时候的颜色 + inactiveColor: '#ccc', + + textStyle: { + // 图例文字颜色 + color: '#333' + }, + // formatter: '', + // 选择模式,默认开启图例开关 + selectedMode: true, + // 配置默认选中状态,可配合LEGEND.SELECTED事件做动态数据载入 + // selected: null, + // 图例内容(详见legend.data,数组中每一项代表一个item + // data: [], + + // Tooltip 相关配置 + tooltip: { + show: false } } }); - module.exports = ThemeRiverSeries; - + module.exports = LegendModel; /***/ }, -/* 288 */ +/* 311 */ /***/ function(module, exports, __webpack_require__) { - /* WEBPACK VAR INJECTION */(function(process) {/** - * @file The file used to draw themeRiver view - * @author Deqing Li(annong035@gmail.com) + /** + * @file Legend action */ - var poly = __webpack_require__(109); - var graphic = __webpack_require__(43); + var echarts = __webpack_require__(1); var zrUtil = __webpack_require__(4); - var DataDiffer = __webpack_require__(99); - module.exports = __webpack_require__(1).extendChartView({ + function legendSelectActionHandler(methodName, payload, ecModel) { + var selectedMap = {}; + var isToggleSelect = methodName === 'toggleSelected'; + var isSelected; + // Update all legend components + ecModel.eachComponent('legend', function (legendModel) { + if (isToggleSelect && isSelected != null) { + // Force other legend has same selected status + // Or the first is toggled to true and other are toggled to false + // In the case one legend has some item unSelected in option. And if other legend + // doesn't has the item, they will assume it is selected. + legendModel[isSelected ? 'select' : 'unSelect'](payload.name); + } + else { + legendModel[methodName](payload.name); + isSelected = legendModel.isSelected(payload.name); + } + var legendData = legendModel.getData(); + zrUtil.each(legendData, function (model) { + var name = model.get('name'); + // Wrap element + if (name === '\n' || name === '') { + return; + } + var isItemSelected = legendModel.isSelected(name); + if (name in selectedMap) { + // Unselected if any legend is unselected + selectedMap[name] = selectedMap[name] && isItemSelected; + } + else { + selectedMap[name] = isItemSelected; + } + }); + }); + // Return the event explicitly + return { + name: payload.name, + selected: selectedMap + }; + } + /** + * @event legendToggleSelect + * @type {Object} + * @property {string} type 'legendToggleSelect' + * @property {string} [from] + * @property {string} name Series name or data item name + */ + echarts.registerAction( + 'legendToggleSelect', 'legendselectchanged', + zrUtil.curry(legendSelectActionHandler, 'toggleSelected') + ); - type: 'themeRiver', + /** + * @event legendSelect + * @type {Object} + * @property {string} type 'legendSelect' + * @property {string} name Series name or data item name + */ + echarts.registerAction( + 'legendSelect', 'legendselected', + zrUtil.curry(legendSelectActionHandler, 'select') + ); + + /** + * @event legendUnSelect + * @type {Object} + * @property {string} type 'legendUnSelect' + * @property {string} name Series name or data item name + */ + echarts.registerAction( + 'legendUnSelect', 'legendunselected', + zrUtil.curry(legendSelectActionHandler, 'unSelect') + ); + + +/***/ }, +/* 312 */ +/***/ function(module, exports, __webpack_require__) { + + + + var zrUtil = __webpack_require__(4); + var symbolCreator = __webpack_require__(104); + var graphic = __webpack_require__(44); + var listComponentHelper = __webpack_require__(313); + + var curry = zrUtil.curry; + + function dispatchSelectAction(name, api) { + api.dispatchAction({ + type: 'legendToggleSelect', + name: name + }); + } + + function dispatchHighlightAction(seriesModel, dataName, api) { + // If element hover will move to a hoverLayer. + var el = api.getZr().storage.getDisplayList()[0]; + if (!(el && el.useHoverLayer)) { + seriesModel.get('legendHoverLink') && api.dispatchAction({ + type: 'highlight', + seriesName: seriesModel.name, + name: dataName + }); + } + } + + function dispatchDownplayAction(seriesModel, dataName, api) { + // If element hover will move to a hoverLayer. + var el = api.getZr().storage.getDisplayList()[0]; + if (!(el && el.useHoverLayer)) { + seriesModel.get('legendHoverLink') && api.dispatchAction({ + type: 'downplay', + seriesName: seriesModel.name, + name: dataName + }); + } + } + + module.exports = __webpack_require__(1).extendComponentView({ + + type: 'legend', init: function () { - this._layers = []; + this._symbolTypeStore = {}; }, - render: function (seriesModel, ecModel, api) { - var data = seriesModel.getData(); - var rawData = seriesModel.getRawData(); + render: function (legendModel, ecModel, api) { + var group = this.group; + group.removeAll(); - if (!data.count()) { + if (!legendModel.get('show')) { return; } - var group = this.group; - - var layerSeries = seriesModel.getLayerSeries(); - - var layoutInfo = data.getLayout('layoutInfo'); - var rect = layoutInfo.rect; - var boundaryGap = layoutInfo.boundaryGap; - - group.attr('position', [0, rect.y + boundaryGap[0]]); + var selectMode = legendModel.get('selectedMode'); + var itemAlign = legendModel.get('align'); - function keyGetter(item) { - return item.name; + if (itemAlign === 'auto') { + itemAlign = (legendModel.get('left') === 'right' + && legendModel.get('orient') === 'vertical') + ? 'right' : 'left'; } - var dataDiffer = new DataDiffer( - this._layersSeries || [], layerSeries, - keyGetter, keyGetter - ); - var newLayersGroups = {}; + var legendDrawedMap = {}; - dataDiffer.add(zrUtil.bind(zrUtil.curry(process, 'add'), this)) - .update(zrUtil.bind(zrUtil.curry(process, 'update'), this)) - .remove(zrUtil.bind(zrUtil.curry(process, 'remove'), this)) - .execute(); + zrUtil.each(legendModel.getData(), function (itemModel) { + var name = itemModel.get('name'); - function process(status, idx, oldIdx) { - var oldLayersGroups = this._layers; - if (status === 'remove') { - group.remove(oldLayersGroups[idx]); + // Use empty string or \n as a newline string + if (name === '' || name === '\n') { + group.add(new graphic.Group({ + newline: true + })); return; } - var points0 = []; - var points1 = []; - var color; - var indices = layerSeries[idx].indices; - for (var j = 0; j < indices.length; j++) { - var layout = data.getItemLayout(indices[j]); - var x = layout.x; - var y0 = layout.y0; - var y = layout.y; - points0.push([x, y0]); - points1.push([x, y0 + y]); + var seriesModel = ecModel.getSeriesByName(name)[0]; - color = rawData.getItemVisual(indices[j], 'color'); + if (legendDrawedMap[name]) { + // Have been drawed + return; } - var polygon; - var text; - var textLayout = data.getItemLayout(indices[0]); - var itemModel = data.getItemModel(indices[j - 1]); - var labelModel = itemModel.getModel('label.normal'); - var margin = labelModel.get('margin'); - if (status === 'add') { - var layerGroup = newLayersGroups[idx] = new graphic.Group(); - polygon = new poly.Polygon({ - shape: { - points: points0, - stackedOnPoints: points1, - smooth: 0.4, - stackedOnSmooth: 0.4, - smoothConstraint: false - }, - z2: 0 - }); - text = new graphic.Text({ - style: { - x: textLayout.x - margin, - y: textLayout.y0 + textLayout.y / 2 - } - }); - layerGroup.add(polygon); - layerGroup.add(text); - group.add(layerGroup); + // Series legend + if (seriesModel) { + var data = seriesModel.getData(); + var color = data.getVisual('color'); - polygon.setClipPath(createGridClipShape(polygon.getBoundingRect(), seriesModel, function () { - polygon.removeClipPath(); - })); + // If color is a callback function + if (typeof color === 'function') { + // Use the first data + color = color(seriesModel.getDataParams(0)); + } + + // Using rect symbol defaultly + var legendSymbolType = data.getVisual('legendSymbol') || 'roundRect'; + var symbolType = data.getVisual('symbol'); + + var itemGroup = this._createItem( + name, itemModel, legendModel, + legendSymbolType, symbolType, + itemAlign, color, + selectMode + ); + + itemGroup.on('click', curry(dispatchSelectAction, name, api)) + .on('mouseover', curry(dispatchHighlightAction, seriesModel, null, api)) + .on('mouseout', curry(dispatchDownplayAction, seriesModel, null, api)); + + legendDrawedMap[name] = true; } else { - var layerGroup = oldLayersGroups[oldIdx]; - polygon = layerGroup.childAt(0); - text = layerGroup.childAt(1); - group.add(layerGroup); + // Data legend of pie, funnel + ecModel.eachRawSeries(function (seriesModel) { + // In case multiple series has same data name + if (legendDrawedMap[name]) { + return; + } + if (seriesModel.legendDataProvider) { + var data = seriesModel.legendDataProvider(); + var idx = data.indexOfName(name); + if (idx < 0) { + return; + } - newLayersGroups[idx] = layerGroup; + var color = data.getItemVisual(idx, 'color'); - graphic.updateProps(polygon, { - shape: { - points: points0, - stackedOnPoints: points1 + var legendSymbolType = 'roundRect'; + + var itemGroup = this._createItem( + name, itemModel, legendModel, + legendSymbolType, null, + itemAlign, color, + selectMode + ); + + itemGroup.on('click', curry(dispatchSelectAction, name, api)) + // FIXME Should not specify the series name + .on('mouseover', curry(dispatchHighlightAction, seriesModel, name, api)) + .on('mouseout', curry(dispatchDownplayAction, seriesModel, name, api)); + + legendDrawedMap[name] = true; } - }, seriesModel); + }, this); + } + + if (true) { + if (!legendDrawedMap[name]) { + console.warn(name + ' series not exists. Legend data should be same with series name or data name.'); + } + } + }, this); + + listComponentHelper.layout(group, legendModel, api); + // Render background after group is layout + // FIXME + listComponentHelper.addBackground(group, legendModel); + }, + + _createItem: function ( + name, itemModel, legendModel, + legendSymbolType, symbolType, + itemAlign, color, selectMode + ) { + var itemWidth = legendModel.get('itemWidth'); + var itemHeight = legendModel.get('itemHeight'); + var inactiveColor = legendModel.get('inactiveColor'); + + var isSelected = legendModel.isSelected(name); + var itemGroup = new graphic.Group(); + + var textStyleModel = itemModel.getModel('textStyle'); + + var itemIcon = itemModel.get('icon'); + + var tooltipModel = itemModel.getModel('tooltip'); + var legendGlobalTooltipModel = tooltipModel.parentModel; + + // Use user given icon first + legendSymbolType = itemIcon || legendSymbolType; + itemGroup.add(symbolCreator.createSymbol( + legendSymbolType, 0, 0, itemWidth, itemHeight, isSelected ? color : inactiveColor + )); - graphic.updateProps(text, { - style: { - x: textLayout.x - margin, - y: textLayout.y0 + textLayout.y / 2 - } - }, seriesModel); + // Compose symbols + // PENDING + if (!itemIcon && symbolType + // At least show one symbol, can't be all none + && ((symbolType !== legendSymbolType) || symbolType == 'none') + ) { + var size = itemHeight * 0.8; + if (symbolType === 'none') { + symbolType = 'circle'; } + // Put symbol in the center + itemGroup.add(symbolCreator.createSymbol( + symbolType, (itemWidth - size) / 2, (itemHeight - size) / 2, size, size, + isSelected ? color : inactiveColor + )); + } - var hoverItemStyleModel = itemModel.getModel('itemStyle.emphasis'); - var itemStyleModel = itemModel.getModel('itemStyle.normal'); - var textStyleModel = labelModel.getModel('textStyle'); + // Text + var textX = itemAlign === 'left' ? itemWidth + 5 : -5; + var textAlign = itemAlign; - text.setStyle({ - text: labelModel.get('show') - ? seriesModel.getFormattedLabel(indices[j - 1], 'normal') - || data.getName(indices[j - 1]) - : '', + var formatter = legendModel.get('formatter'); + var content = name; + if (typeof formatter === 'string' && formatter) { + content = formatter.replace('{name}', name != null ? name : ''); + } + else if (typeof formatter === 'function') { + content = formatter(name); + } + + var text = new graphic.Text({ + style: { + text: content, + x: textX, + y: itemHeight / 2, + fill: isSelected ? textStyleModel.getTextColor() : inactiveColor, textFont: textStyleModel.getFont(), - textAlign: labelModel.get('textAlign'), + textAlign: textAlign, textVerticalAlign: 'middle' - }); + } + }); + itemGroup.add(text); - polygon.setStyle(zrUtil.extend({ - fill: color - }, itemStyleModel.getItemStyle(['color']))); + // Add a invisible rect to increase the area of mouse hover + var hitRect = new graphic.Rect({ + shape: itemGroup.getBoundingRect(), + invisible: true, + tooltip: tooltipModel.get('show') ? zrUtil.extend({ + content: name, + // Defaul formatter + formatter: legendGlobalTooltipModel.get('formatter', true) || function () { + return name; + }, + formatterParams: { + componentType: 'legend', + legendIndex: legendModel.componentIndex, + name: name, + $vars: ['name'] + } + }, tooltipModel.option) : null + }); + itemGroup.add(hitRect); - graphic.setHoverStyle(polygon, hoverItemStyleModel.getItemStyle()); - } + itemGroup.eachChild(function (child) { + child.silent = true; + }); - this._layersSeries = layerSeries; - this._layers = newLayersGroups; - }, + hitRect.silent = !selectMode; - dispose: function () {} - }); - // add animation to the view - function createGridClipShape(rect, seriesModel, cb) { - var rectEl = new graphic.Rect({ - shape: { - x: rect.x - 10, - y: rect.y - 10, - width: 0, - height: rect.height + 20 - } - }); - graphic.initProps(rectEl, { - shape: { - width: rect.width + 20, - height: rect.height + 20 - } - }, seriesModel, cb); - return rectEl; - } + this.group.add(itemGroup); + graphic.setHoverStyle(itemGroup); + return itemGroup; + } + }); - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(289))) /***/ }, -/* 289 */ -/***/ function(module, exports) { +/* 313 */ +/***/ function(module, exports, __webpack_require__) { - // shim for using process in browser - var process = module.exports = {}; + + // List layout + var layout = __webpack_require__(21); + var formatUtil = __webpack_require__(6); + var graphic = __webpack_require__(44); - // cached from whatever global is present so that test runners that stub it - // don't break things. But we need to wrap it in a try catch in case it is - // wrapped in strict mode code which doesn't define any globals. It's inside a - // function because try/catches deoptimize in certain engines. + function positionGroup(group, model, api) { + layout.positionElement( + group, model.getBoxLayoutParams(), + { + width: api.getWidth(), + height: api.getHeight() + }, + model.get('padding') + ); + } - var cachedSetTimeout; - var cachedClearTimeout; + module.exports = { + /** + * Layout list like component. + * It will box layout each items in group of component and then position the whole group in the viewport + * @param {module:zrender/group/Group} group + * @param {module:echarts/model/Component} componentModel + * @param {module:echarts/ExtensionAPI} + */ + layout: function (group, componentModel, api) { + var rect = layout.getLayoutRect(componentModel.getBoxLayoutParams(), { + width: api.getWidth(), + height: api.getHeight() + }, componentModel.get('padding')); + layout.box( + componentModel.get('orient'), + group, + componentModel.get('itemGap'), + rect.width, + rect.height + ); - function defaultSetTimout() { - throw new Error('setTimeout has not been defined'); - } - function defaultClearTimeout () { - throw new Error('clearTimeout has not been defined'); - } - (function () { - try { - if (typeof setTimeout === 'function') { - cachedSetTimeout = setTimeout; - } else { - cachedSetTimeout = defaultSetTimout; - } - } catch (e) { - cachedSetTimeout = defaultSetTimout; - } - try { - if (typeof clearTimeout === 'function') { - cachedClearTimeout = clearTimeout; - } else { - cachedClearTimeout = defaultClearTimeout; - } - } catch (e) { - cachedClearTimeout = defaultClearTimeout; - } - } ()) - function runTimeout(fun) { - if (cachedSetTimeout === setTimeout) { - //normal enviroments in sane situations - return setTimeout(fun, 0); - } - // if setTimeout wasn't available but was latter defined - if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { - cachedSetTimeout = setTimeout; - return setTimeout(fun, 0); - } - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedSetTimeout(fun, 0); - } catch(e){ - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedSetTimeout.call(null, fun, 0); - } catch(e){ - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error - return cachedSetTimeout.call(this, fun, 0); - } - } + positionGroup(group, componentModel, api); + }, + addBackground: function (group, componentModel) { + var padding = formatUtil.normalizeCssArray( + componentModel.get('padding') + ); + var boundingRect = group.getBoundingRect(); + var style = componentModel.getItemStyle(['color', 'opacity']); + style.fill = componentModel.get('backgroundColor'); + var rect = new graphic.Rect({ + shape: { + x: boundingRect.x - padding[3], + y: boundingRect.y - padding[0], + width: boundingRect.width + padding[1] + padding[3], + height: boundingRect.height + padding[0] + padding[2] + }, + style: style, + silent: true, + z2: -1 + }); + graphic.subPixelOptimizeRect(rect); - } - function runClearTimeout(marker) { - if (cachedClearTimeout === clearTimeout) { - //normal enviroments in sane situations - return clearTimeout(marker); - } - // if clearTimeout wasn't available but was latter defined - if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { - cachedClearTimeout = clearTimeout; - return clearTimeout(marker); - } - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedClearTimeout(marker); - } catch (e){ - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedClearTimeout.call(null, marker); - } catch (e){ - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. - // Some versions of I.E. have different rules for clearTimeout vs setTimeout - return cachedClearTimeout.call(this, marker); + group.add(rect); } - } + }; +/***/ }, +/* 314 */ +/***/ function(module, exports) { - } - var queue = []; - var draining = false; - var currentQueue; - var queueIndex = -1; + + module.exports = function (ecModel) { + var legendModels = ecModel.findComponents({ + mainType: 'legend' + }); + if (legendModels && legendModels.length) { + ecModel.filterSeries(function (series) { + // If in any legend component the status is not selected. + // Because in legend series is assumed selected when it is not in the legend data. + for (var i = 0; i < legendModels.length; i++) { + if (!legendModels[i].isSelected(series.name)) { + return false; + } + } + return true; + }); + } + }; - function cleanUpNextTick() { - if (!draining || !currentQueue) { - return; - } - draining = false; - if (currentQueue.length) { - queue = currentQueue.concat(queue); - } else { - queueIndex = -1; - } - if (queue.length) { - drainQueue(); - } - } - function drainQueue() { - if (draining) { - return; - } - var timeout = runTimeout(cleanUpNextTick); - draining = true; +/***/ }, +/* 315 */ +/***/ function(module, exports, __webpack_require__) { - var len = queue.length; - while(len) { - currentQueue = queue; - queue = []; - while (++queueIndex < len) { - if (currentQueue) { - currentQueue[queueIndex].run(); - } - } - queueIndex = -1; - len = queue.length; - } - currentQueue = null; - draining = false; - runClearTimeout(timeout); - } + // FIXME Better way to pack data in graphic element - process.nextTick = function (fun) { - var args = new Array(arguments.length - 1); - if (arguments.length > 1) { - for (var i = 1; i < arguments.length; i++) { - args[i - 1] = arguments[i]; - } - } - queue.push(new Item(fun, args)); - if (queue.length === 1 && !draining) { - runTimeout(drainQueue); - } - }; - // v8 likes predictible objects - function Item(fun, array) { - this.fun = fun; - this.array = array; - } - Item.prototype.run = function () { - this.fun.apply(null, this.array); - }; - process.title = 'browser'; - process.browser = true; - process.env = {}; - process.argv = []; - process.version = ''; // empty string to avoid regexp issues - process.versions = {}; + __webpack_require__(142); - function noop() {} + __webpack_require__(316); - process.on = noop; - process.addListener = noop; - process.once = noop; - process.off = noop; - process.removeListener = noop; - process.removeAllListeners = noop; - process.emit = noop; + __webpack_require__(317); - process.binding = function (name) { - throw new Error('process.binding is not supported'); - }; - process.cwd = function () { return '/' }; - process.chdir = function (dir) { - throw new Error('process.chdir is not supported'); - }; - process.umask = function() { return 0; }; + // Show tip action + /** + * @action + * @property {string} type + * @property {number} seriesIndex + * @property {number} dataIndex + * @property {number} [x] + * @property {number} [y] + */ + __webpack_require__(1).registerAction( + { + type: 'showTip', + event: 'showTip', + update: 'tooltip:manuallyShowTip' + }, + // noop + function () {} + ); + // Hide tip action + __webpack_require__(1).registerAction( + { + type: 'hideTip', + event: 'hideTip', + update: 'tooltip:manuallyHideTip' + }, + // noop + function () {} + ); /***/ }, -/* 290 */ +/* 316 */ /***/ function(module, exports, __webpack_require__) { - /** - * @file Using layout algorithm transform the raw data to layout information. - * @author Deqing Li(annong035@gmail.com) - */ - - - var zrUtil = __webpack_require__(4); - var numberUtil = __webpack_require__(7); + + __webpack_require__(1).extendComponentModel({ - module.exports = function (ecModel, api) { + type: 'tooltip', - ecModel.eachSeriesByType('themeRiver', function (seriesModel) { + dependencies: ['axisPointer'], - var data = seriesModel.getData(); + defaultOption: { + zlevel: 0, - var single = seriesModel.coordinateSystem; + z: 8, - var layoutInfo = {}; + show: true, - // use the axis boundingRect for view - var rect = single.getRect(); + // tooltip主体内容 + showContent: true, - layoutInfo.rect = rect; + // 'trigger' only works on coordinate system. + // 'item' | 'axis' | 'none' + trigger: 'item', - var boundaryGap = seriesModel.get('boundaryGap'); + // 'click' | 'mousemove' | 'none' + triggerOn: 'mousemove|click', - var axis = single.getAxis(); + alwaysShowContent: false, - layoutInfo.boundaryGap = boundaryGap; + displayMode: 'single', // 'single' | 'multipleByCoordSys' - if (axis.orient === 'horizontal') { - boundaryGap[0] = numberUtil.parsePercent(boundaryGap[0], rect.height); - boundaryGap[1] = numberUtil.parsePercent(boundaryGap[1], rect.height); - var height = rect.height - boundaryGap[0] - boundaryGap[1]; - themeRiverLayout(data, seriesModel, height); - } - else { - boundaryGap[0] = numberUtil.parsePercent(boundaryGap[0], rect.width); - boundaryGap[1] = numberUtil.parsePercent(boundaryGap[1], rect.width); - var width = rect.width - boundaryGap[0] - boundaryGap[1]; - themeRiverLayout(data, seriesModel, width); - } + // 位置 {Array} | {Function} + // position: null + // Consider triggered from axisPointer handle, verticalAlign should be 'middle' + // align: null, + // verticalAlign: null, - data.setLayout('layoutInfo', layoutInfo); - }); - }; + // 是否约束 content 在 viewRect 中。默认 false 是为了兼容以前版本。 + confine: false, - /** - * The layout information about themeriver - * - * @param {module:echarts/data/List} data data in the series - * @param {module:echarts/model/Series} seriesModel the model object of themeRiver series - * @param {number} height value used to compute every series height - */ - function themeRiverLayout(data, seriesModel, height) { - if (!data.count()) { - return; - } - var coordSys = seriesModel.coordinateSystem; - // the data in each layer are organized into a series. - var layerSeries = seriesModel.getLayerSeries(); + // 内容格式器:{string}(Template) ¦ {Function} + // formatter: null - // the points in each layer. - var layerPoints = zrUtil.map(layerSeries, function (singleLayer) { - return zrUtil.map(singleLayer.indices, function (idx) { - var pt = coordSys.dataToPoint(data.get('time', idx)); - pt[1] = data.get('value', idx); - return pt; - }); - }); + showDelay: 0, - var base = computeBaseline(layerPoints); - var baseLine = base.y0; - var ky = height / base.max; + // 隐藏延迟,单位ms + hideDelay: 100, - // set layout information for each item. - var n = layerSeries.length; - var m = layerSeries[0].indices.length; - var baseY0; - for (var j = 0; j < m; ++j) { - baseY0 = baseLine[j] * ky; - data.setItemLayout(layerSeries[0].indices[j], { - layerIndex: 0, - x: layerPoints[0][j][0], - y0: baseY0, - y: layerPoints[0][j][1] * ky - }); - for (var i = 1; i < n; ++i) { - baseY0 += layerPoints[i - 1][j][1] * ky; - data.setItemLayout(layerSeries[i].indices[j], { - layerIndex: i, - x: layerPoints[i][j][0], - y0: baseY0, - y: layerPoints[i][j][1] * ky - }); - } - } - } + // 动画变换时间,单位s + transitionDuration: 0.4, - /** - * Compute the baseLine of the rawdata - * Inspired by Lee Byron's paper Stacked Graphs - Geometry & Aesthetics - * - * @param {Array.} data the points in each layer - * @return {Array} - */ - function computeBaseline(data) { - var layerNum = data.length; - var pointNum = data[0].length; - var sums = []; - var y0 = []; - var max = 0; - var temp; - var base = {}; + enterable: false, - for (var i = 0; i < pointNum; ++i) { - for (var j = 0, temp = 0; j < layerNum; ++j) { - temp += data[j][i][1]; - } - if (temp > max) { - max = temp; - } - sums.push(temp); - } + // 提示背景颜色,默认为透明度为0.7的黑色 + backgroundColor: 'rgba(50,50,50,0.7)', - for (var k = 0; k < pointNum; ++k) { - y0[k] = (max - sums[k]) / 2; - } - max = 0; + // 提示边框颜色 + borderColor: '#333', - for (var l = 0; l < pointNum; ++l) { - var sum = sums[l] + y0[l]; - if (sum > max) { - max = sum; - } - } - base.y0 = y0; - base.max = max; + // 提示边框圆角,单位px,默认为4 + borderRadius: 4, - return base; - } + // 提示边框线宽,单位px,默认为0(无边框) + borderWidth: 0, + // 提示内边距,单位px,默认各方向内边距为5, + // 接受数组分别设定上右下左边距,同css + padding: 5, + // Extra css text + extraCssText: '', -/***/ }, -/* 291 */ -/***/ function(module, exports) { + // 坐标轴指示器,坐标轴触发有效 + axisPointer: { + // 默认为直线 + // 可选为:'line' | 'shadow' | 'cross' + type: 'line', - /** - * @file Visual encoding for themeRiver view - * @author Deqing Li(annong035@gmail.com) - */ + // type 为 line 的时候有效,指定 tooltip line 所在的轴,可选 + // 可选 'x' | 'y' | 'angle' | 'radius' | 'auto' + // 默认 'auto',会选择类型为 cateogry 的轴,对于双数值轴,笛卡尔坐标系会默认选择 x 轴 + // 极坐标系会默认选择 angle 轴 + axis: 'auto', + animation: 'auto', + animationDurationUpdate: 200, + animationEasingUpdate: 'exponentialOut', - module.exports = function (ecModel) { - ecModel.eachSeriesByType('themeRiver', function (seriesModel) { - var data = seriesModel.getData(); - var rawData = seriesModel.getRawData(); - var colorList = seriesModel.get('color'); + crossStyle: { + color: '#999', + width: 1, + type: 'dashed', - data.each(function (index) { - var name = data.getName(index); - var color = colorList[(seriesModel.nameMap[name] - 1) % colorList.length]; - rawData.setItemVisual(index, 'color', color); - }); - }); - }; + // TODO formatter + textStyle: {} + } + // lineStyle and shadowStyle should not be specified here, + // otherwise it will always override those styles on option.axisPointer. + }, + textStyle: { + color: '#fff', + fontSize: 14 + } + } + }); /***/ }, -/* 292 */ +/* 317 */ /***/ function(module, exports, __webpack_require__) { - var echarts = __webpack_require__(1); + var TooltipContent = __webpack_require__(318); var zrUtil = __webpack_require__(4); - var modelUtil = __webpack_require__(5); - var graphicUtil = __webpack_require__(43); + var formatUtil = __webpack_require__(6); + var numberUtil = __webpack_require__(7); + var findPointFromSeries = __webpack_require__(144); var layoutUtil = __webpack_require__(21); + var env = __webpack_require__(2); + var Model = __webpack_require__(12); + var globalListener = __webpack_require__(147); + var axisHelper = __webpack_require__(105); + var axisPointerViewHelper = __webpack_require__(139); - // ------------- - // Preprocessor - // ------------- + var bind = zrUtil.bind; + var each = zrUtil.each; + var parsePercent = numberUtil.parsePercent; - echarts.registerPreprocessor(function (option) { - var graphicOption = option && option.graphic; - // Convert - // {graphic: [{left: 10, type: 'circle'}, ...]} - // or - // {graphic: {left: 10, type: 'circle'}} - // to - // {graphic: [{elements: [{left: 10, type: 'circle'}, ...]}]} - if (zrUtil.isArray(graphicOption)) { - if (!graphicOption[0] || !graphicOption[0].elements) { - option.graphic = [{elements: graphicOption}]; + __webpack_require__(1).extendComponentView({ + + type: 'tooltip', + + init: function (ecModel, api) { + if (env.node) { + return; } - else { - // Only one graphic instance can be instantiated. (We dont - // want that too many views are created in echarts._viewMap) - option.graphic = [option.graphic[0]]; + var tooltipContent = new TooltipContent(api.getDom(), api); + this._tooltipContent = tooltipContent; + }, + + render: function (tooltipModel, ecModel, api) { + if (env.node) { + return; } - } - else if (graphicOption && !graphicOption.elements) { - option.graphic = [{elements: [graphicOption]}]; - } - }); - // ------ - // Model - // ------ + // Reset + this.group.removeAll(); - var GraphicModel = echarts.extendComponentModel({ + /** + * @private + * @type {module:echarts/component/tooltip/TooltipModel} + */ + this._tooltipModel = tooltipModel; - type: 'graphic', + /** + * @private + * @type {module:echarts/model/Global} + */ + this._ecModel = ecModel; - defaultOption: { + /** + * @private + * @type {module:echarts/ExtensionAPI} + */ + this._api = api; - // Extra properties for each elements: - // - // left/right/top/bottom: (like 12, '22%', 'center', default undefined) - // If left/rigth is set, shape.x/shape.cx/position will not be used. - // If top/bottom is set, shape.y/shape.cy/position will not be used. - // This mechanism is useful when you want to position a group/element - // against the right side or the center of this container. - // - // width/height: (can only be pixel value, default 0) - // Only be used to specify contianer(group) size, if needed. And - // can not be percentage value (like '33%'). See the reason in the - // layout algorithm below. - // - // bounding: (enum: 'all' (default) | 'raw') - // Specify how to calculate boundingRect when locating. - // 'all': Get uioned and transformed boundingRect - // from both itself and its descendants. - // This mode simplies confining a group of elements in the bounding - // of their ancester container (e.g., using 'right: 0'). - // 'raw': Only use the boundingRect of itself and before transformed. - // This mode is similar to css behavior, which is useful when you - // want an element to be able to overflow its container. (Consider - // a rotated circle needs to be located in a corner.) + /** + * @private + * @type {Array.>} + */ + this._lastDataByCoordSys; - // Note: elements is always behind its ancestors in this elements array. - elements: [], - parentId: null + /** + * @private + * @type {boolean} + */ + this._alwaysShowContent = tooltipModel.get('alwaysShowContent'); + + var tooltipContent = this._tooltipContent; + tooltipContent.update(); + tooltipContent.setEnterable(tooltipModel.get('enterable')); + + this._initGlobalListener(); + + this._keepShow(); + }, + + _initGlobalListener: function () { + var tooltipModel = this._tooltipModel; + var triggerOn = tooltipModel.get('triggerOn'); + + globalListener.register( + 'itemTooltip', + this._api, + bind(function (currTrigger, e, dispatchAction) { + // If 'none', it is not controlled by mouse totally. + if (triggerOn !== 'none') { + if (triggerOn.indexOf(currTrigger) >= 0) { + this._tryShow(e, dispatchAction); + } + else if (currTrigger === 'leave') { + this._hide(dispatchAction); + } + } + }, this) + ); + }, + + _keepShow: function () { + var tooltipModel = this._tooltipModel; + var ecModel = this._ecModel; + var api = this._api; + + // Try to keep the tooltip show when refreshing + if (this._lastX != null + && this._lastY != null + // When user is willing to control tooltip totally using API, + // self.manuallyShowTip({x, y}) might cause tooltip hide, + // which is not expected. + && tooltipModel.get('triggerOn') !== 'none' + ) { + var self = this; + clearTimeout(this._refreshUpdateTimeout); + this._refreshUpdateTimeout = setTimeout(function () { + // Show tip next tick after other charts are rendered + // In case highlight action has wrong result + // FIXME + self.manuallyShowTip(tooltipModel, ecModel, api, { + x: self._lastX, + y: self._lastY + }); + }); + } }, /** - * Save el options for the sake of the performance (only update modified graphics). - * The order is the same as those in option. (ancesters -> descendants) + * Show tip manually by + * dispatchAction({ + * type: 'showTip', + * x: 10, + * y: 10 + * }); + * Or + * dispatchAction({ + * type: 'showTip', + * seriesIndex: 0, + * dataIndex or dataIndexInside or name + * }); * - * @private - * @type {Array.} + * TODO Batch */ - _elOptionsToUpdate: null, + manuallyShowTip: function (tooltipModel, ecModel, api, payload) { + if (payload.from === this.uid || env.node) { + return; + } - /** - * @override - */ - mergeOption: function (option) { - // Prevent default merge to elements - var elements = this.option.elements; - this.option.elements = null; + var dispatchAction = makeDispatchAction(payload, api); - GraphicModel.superApply(this, 'mergeOption', arguments); + // Reset ticket + this._ticket = ''; - this.option.elements = elements; + var seriesIndex = payload.seriesIndex; + var dataByCoordSys = payload.dataByCoordSys; + + // When triggered from axisPointer. + if (dataByCoordSys) { + this._tryShow({ + offsetX: payload.x, + offsetY: payload.y, + position: payload.position, + event: {}, + dataByCoordSys: payload.dataByCoordSys, + tooltipOption: payload.tooltipOption + }, dispatchAction); + } + else if (seriesIndex != null) { + var pointInfo = findPointFromSeries(payload, ecModel); + var cx = pointInfo.point[0]; + var cy = pointInfo.point[1]; + if (cx != null && cy != null) { + this._tryShow({ + offsetX: cx, + offsetY: cy, + position: payload.position, + target: pointInfo.el, + event: {} + }, dispatchAction); + } + } + else if (payload.x != null && payload.y != null) { + this._tryShow({ + offsetX: payload.x, + offsetY: payload.y, + position: payload.position, + target: api.getZr().handler.findHover(payload.x, payload.y), + event: {} + }, dispatchAction); + } }, - /** - * @override - */ - optionUpdated: function (newOption, isInit) { - var thisOption = this.option; - var newList = (isInit ? thisOption : newOption).elements; - var existList = thisOption.elements = isInit ? [] : thisOption.elements; + manuallyHideTip: function (tooltipModel, ecModel, api, payload) { + var tooltipContent = this._tooltipContent; - var flattenedList = []; - this._flatten(newList, flattenedList); + if (!this._alwaysShowContent) { + tooltipContent.hideLater(this._tooltipModel.get('hideDelay')); + } - var mappingResult = modelUtil.mappingToExists(existList, flattenedList); - modelUtil.makeIdAndName(mappingResult); + this._lastX = this._lastY = null; - // Clear elOptionsToUpdate - var elOptionsToUpdate = this._elOptionsToUpdate = []; + if (payload.from !== this.uid) { + this._hide(makeDispatchAction(payload, api)); + } + }, - zrUtil.each(mappingResult, function (resultItem, index) { - var existElOption = resultItem.exist; - var newElOption = resultItem.option; + _tryShow: function (e, dispatchAction) { + var el = e.target; + var tooltipModel = this._tooltipModel; - if (true) { - zrUtil.assert( - zrUtil.isObject(newElOption) || existElOption, - 'Empty graphic option definition' - ); - } + if (!tooltipModel) { + return; + } - if (!newElOption) { - return; - } + // Save mouse x, mouse y. So we can try to keep showing the tip if chart is refreshed + this._lastX = e.offsetX; + this._lastY = e.offsetY; - // Set id and parent id after id assigned. - newElOption.id = resultItem.keyInfo.id; - var newElParentId = newElOption.parentId; - var newElParentOption = newElOption.parentOption; - var existElParentId = existElOption && existElOption.parentId; - !newElOption.type && existElOption && (newElOption.type = existElOption.type); - newElOption.parentId = newElParentId // parent id specified - ? newElParentId - : newElParentOption - ? newElParentOption.id - : existElParentId // parent not specified - ? existElParentId - : null; - newElOption.parentOption = null; // Clear - elOptionsToUpdate.push(newElOption); + var dataByCoordSys = e.dataByCoordSys; + if (dataByCoordSys && dataByCoordSys.length) { + this._showAxisTooltip(dataByCoordSys, e); + } + // Always show item tooltip if mouse is on the element with dataIndex + else if (el && el.dataIndex != null) { + this._lastDataByCoordSys = null; + this._showSeriesItemTooltip(e, el, dispatchAction); + } + // Tooltip provided directly. Like legend. + else if (el && el.tooltip) { + this._lastDataByCoordSys = null; + this._showComponentItemTooltip(e, el, dispatchAction); + } + else { + this._lastDataByCoordSys = null; + this._hide(dispatchAction); + } + }, - // Update existing options, for `getOption` feature. - var newElOptCopy = zrUtil.extend({}, newElOption); - var $action = newElOption.$action; - if (!$action || $action === 'merge') { - if (existElOption) { + _showOrMove: function (tooltipModel, cb) { + // showDelay is used in this case: tooltip.enterable is set + // as true. User intent to move mouse into tooltip and click + // something. `showDelay` makes it easyer to enter the content + // but tooltip do not move immediately. + var delay = tooltipModel.get('showDelay'); + cb = zrUtil.bind(cb, this); + clearTimeout(this._showTimout); + delay > 0 + ? (this._showTimout = setTimeout(cb, delay)) + : cb(); + }, - if (true) { - var newType = newElOption.type; - zrUtil.assert( - !newType || existElOption.type === newType, - 'Please set $action: "replace" to change `type`' - ); - } + _showAxisTooltip: function (dataByCoordSys, e) { + var ecModel = this._ecModel; + var globalTooltipModel = this._tooltipModel; + var point = [e.offsetX, e.offsetY]; + var singleDefaultHTML = []; + var singleParamsList = []; + var singleTooltipModel = buildTooltipModel([ + e.tooltipOption, + globalTooltipModel + ]); - // We can ensure that newElOptCopy and existElOption are not - // the same object, so `merge` will not change newElOptCopy. - zrUtil.merge(existElOption, newElOptCopy, true); - // Rigid body, use ignoreSize. - layoutUtil.mergeLayoutParam(existElOption, newElOptCopy, {ignoreSize: true}); - // Will be used in render. - layoutUtil.copyLayoutParams(newElOption, existElOption); - } - else { - existList[index] = newElOptCopy; + each(dataByCoordSys, function (itemCoordSys) { + // var coordParamList = []; + // var coordDefaultHTML = []; + // var coordTooltipModel = buildTooltipModel([ + // e.tooltipOption, + // itemCoordSys.tooltipOption, + // ecModel.getComponent(itemCoordSys.coordSysMainType, itemCoordSys.coordSysIndex), + // globalTooltipModel + // ]); + // var displayMode = coordTooltipModel.get('displayMode'); + // var paramsList = displayMode === 'single' ? singleParamsList : []; + + each(itemCoordSys.dataByAxis, function (item) { + var axisModel = ecModel.getComponent(item.axisDim + 'Axis', item.axisIndex); + var axisValue = item.value; + var seriesDefaultHTML = []; + + if (!axisModel || axisValue == null) { + return; } - } - else if ($action === 'replace') { - existList[index] = newElOptCopy; - } - else if ($action === 'remove') { - // null will be cleaned later. - existElOption && (existList[index] = null); - } - if (existList[index]) { - existList[index].hv = newElOption.hv = [ - // Rigid body, dont care `width`. - isSetLoc(newElOption, ['left', 'right']), - // Rigid body, dont care `height`. - isSetLoc(newElOption, ['top', 'bottom']) - ]; - // Give default group size. Otherwise layout error may occur. - if (existList[index].type === 'group') { - existList[index].width == null && (existList[index].width = newElOption.width = 0); - existList[index].height == null && (existList[index].height = newElOption.height = 0); - } - } + var valueLabel = axisPointerViewHelper.getValueLabel( + axisValue, axisModel.axis, ecModel, + item.seriesDataIndices, + item.valueLabelOpt + ); + + zrUtil.each(item.seriesDataIndices, function (idxItem) { + var series = ecModel.getSeriesByIndex(idxItem.seriesIndex); + var dataIndex = idxItem.dataIndexInside; + var dataParams = series && series.getDataParams(dataIndex); + dataParams.axisDim = item.axisDim; + dataParams.axisIndex = item.axisIndex; + dataParams.axisType = item.axisType; + dataParams.axisId = item.axisId; + dataParams.axisValue = axisHelper.getAxisRawValue(axisModel.axis, axisValue); + dataParams.axisValueLabel = valueLabel; + + if (dataParams) { + singleParamsList.push(dataParams); + seriesDefaultHTML.push(series.formatTooltip(dataIndex, true)); + } + }); + // Default tooltip content + // FIXME + // (1) shold be the first data which has name? + // (2) themeRiver, firstDataIndex is array, and first line is unnecessary. + var firstLine = valueLabel; + singleDefaultHTML.push( + (firstLine ? formatUtil.encodeHTML(firstLine) + '
' : '') + + seriesDefaultHTML.join('
') + ); + }); }, this); - // Clean - for (var i = existList.length - 1; i >= 0; i--) { - if (existList[i] == null) { - existList.splice(i, 1); + // In most case, the second axis is shown upper than the first one. + singleDefaultHTML.reverse(); + singleDefaultHTML = singleDefaultHTML.join('

'); + + var positionExpr = e.position; + this._showOrMove(singleTooltipModel, function () { + if (this._updateContentNotChangedOnAxis(dataByCoordSys)) { + this._updatePosition( + singleTooltipModel, + positionExpr, + point[0], point[1], + this._tooltipContent, + singleParamsList + ); } else { - // $action should be volatile, otherwise option gotten from - // `getOption` will contain unexpected $action. - delete existList[i].$action; + this._showTooltipContent( + singleTooltipModel, singleDefaultHTML, singleParamsList, Math.random(), + point[0], point[1], positionExpr + ); } - } - }, - - /** - * Convert - * [{ - * type: 'group', - * id: 'xx', - * children: [{type: 'circle'}, {type: 'polygon'}] - * }] - * to - * [ - * {type: 'group', id: 'xx'}, - * {type: 'circle', parentId: 'xx'}, - * {type: 'polygon', parentId: 'xx'} - * ] - * - * @private - * @param {Array.} optionList option list - * @param {Array.} result result of flatten - * @param {Object} parentOption parent option - */ - _flatten: function (optionList, result, parentOption) { - zrUtil.each(optionList, function (option) { - if (option) { - if (parentOption) { - option.parentOption = parentOption; - } - - result.push(option); + }); - var children = option.children; - if (option.type === 'group' && children) { - this._flatten(children, result, option); - } - // Deleting for JSON output, and for not affecting group creation. - delete option.children; - } - }, this); + // Do not trigger events here, because this branch only be entered + // from dispatchAction. }, - // FIXME - // Pass to view using payload? setOption has a payload? - useElOptionsToUpdate: function () { - var els = this._elOptionsToUpdate; - // Clear to avoid render duplicately when zooming. - this._elOptionsToUpdate = null; - return els; - } - }); + _showSeriesItemTooltip: function (e, el, dispatchAction) { + var ecModel = this._ecModel; + // Use dataModel in element if possible + // Used when mouseover on a element like markPoint or edge + // In which case, the data is not main data in series. + var seriesIndex = el.seriesIndex; + var seriesModel = ecModel.getSeriesByIndex(seriesIndex); - // ----- - // View - // ----- + // For example, graph link. + var dataModel = el.dataModel || seriesModel; + var dataIndex = el.dataIndex; + var dataType = el.dataType; + var data = dataModel.getData(); - echarts.extendComponentView({ + var tooltipModel = buildTooltipModel([ + data.getItemModel(dataIndex), + dataModel, + seriesModel && (seriesModel.coordinateSystem || {}).model, + this._tooltipModel + ]); - type: 'graphic', + var tooltipTrigger = tooltipModel.get('trigger'); + if (tooltipTrigger != null && tooltipTrigger !== 'item') { + return; + } - /** - * @override - */ - init: function (ecModel, api) { + var params = dataModel.getDataParams(dataIndex, dataType); + var defaultHtml = dataModel.formatTooltip(dataIndex, false, dataType); + var asyncTicket = 'item_' + dataModel.name + '_' + dataIndex; - /** - * @private - * @type {Object} - */ - this._elMap = {}; + this._showOrMove(tooltipModel, function () { + this._showTooltipContent( + tooltipModel, defaultHtml, params, asyncTicket, + e.offsetX, e.offsetY, e.position, e.target + ); + }); - /** - * @private - * @type {module:echarts/graphic/GraphicModel} - */ - this._lastGraphicModel; + // FIXME + // duplicated showtip if manuallyShowTip is called from dispatchAction. + dispatchAction({ + type: 'showTip', + dataIndexInside: dataIndex, + dataIndex: data.getRawIndex(dataIndex), + seriesIndex: seriesIndex, + from: this.uid + }); }, - /** - * @override - */ - render: function (graphicModel, ecModel, api) { + _showComponentItemTooltip: function (e, el, dispatchAction) { + var tooltipOpt = el.tooltip; + if (typeof tooltipOpt === 'string') { + var content = tooltipOpt; + tooltipOpt = { + content: content, + // Fixed formatter + formatter: content + }; + } + var subTooltipModel = new Model(tooltipOpt, this._tooltipModel, this._ecModel); + var defaultHtml = subTooltipModel.get('content'); + var asyncTicket = Math.random(); - // Having leveraged between use cases and algorithm complexity, a very - // simple layout mechanism is used: - // The size(width/height) can be determined by itself or its parent (not - // implemented yet), but can not by its children. (Top-down travel) - // The location(x/y) can be determined by the bounding rect of itself - // (can including its descendants or not) and the size of its parent. - // (Bottom-up travel) + // Do not check whether `trigger` is 'none' here, because `trigger` + // only works on cooridinate system. In fact, we have not found case + // that requires setting `trigger` nothing on component yet. - // When `chart.clear()` or `chart.setOption({...}, true)` with the same id, - // view will be reused. - if (graphicModel !== this._lastGraphicModel) { - this._clear(); - } - this._lastGraphicModel = graphicModel; + this._showOrMove(subTooltipModel, function () { + this._showTooltipContent( + subTooltipModel, defaultHtml, subTooltipModel.get('formatterParams') || {}, + asyncTicket, e.offsetX, e.offsetY, e.position, el + ); + }); - this._updateElements(graphicModel, api); - this._relocate(graphicModel, api); + // If not dispatch showTip, tip may be hide triggered by axis. + dispatchAction({ + type: 'showTip', + from: this.uid + }); }, - /** - * Update graphic elements. - * - * @private - * @param {Object} graphicModel graphic model - * @param {module:echarts/ExtensionAPI} api extension API - */ - _updateElements: function (graphicModel, api) { - var elOptionsToUpdate = graphicModel.useElOptionsToUpdate(); + _showTooltipContent: function ( + tooltipModel, defaultHtml, params, asyncTicket, x, y, positionExpr, el + ) { + // Reset ticket + this._ticket = ''; - if (!elOptionsToUpdate) { + if (!tooltipModel.get('showContent') || !tooltipModel.get('show')) { return; } - var elMap = this._elMap; - var rootGroup = this.group; - - // Top-down tranverse to assign graphic settings to each elements. - zrUtil.each(elOptionsToUpdate, function (elOption) { - var $action = elOption.$action; - var id = elOption.id; - var existEl = elMap[id]; - var parentId = elOption.parentId; - var targetElParent = parentId != null ? elMap[parentId] : rootGroup; - - // In top/bottom mode, textVertical should not be used. And textBaseline - // should not be 'alphabetic', which cause inaccurately locating. - if (elOption.hv && elOption.hv[1] && elOption.type === 'text') { - elOption.style = zrUtil.defaults({textBaseline: 'middle'}, elOption.style); - elOption.style.textVerticalAlign = null; - } - - // Remove unnecessary props to avoid potential problems. - var elOptionCleaned = getCleanedElOption(elOption); + var tooltipContent = this._tooltipContent; - // For simple, do not support parent change, otherwise reorder is needed. - if (true) { - existEl && zrUtil.assert( - targetElParent === existEl.parent, - 'Changing parent is not supported.' - ); - } + var formatter = tooltipModel.get('formatter'); + positionExpr = positionExpr || tooltipModel.get('position'); + var html = defaultHtml; - if (!$action || $action === 'merge') { - existEl - ? existEl.attr(elOptionCleaned) - : createEl(id, targetElParent, elOptionCleaned, elMap); - } - else if ($action === 'replace') { - removeEl(existEl, elMap); - createEl(id, targetElParent, elOptionCleaned, elMap); - } - else if ($action === 'remove') { - removeEl(existEl, elMap); - } + if (formatter && typeof formatter === 'string') { + html = formatUtil.formatTpl(formatter, params, true); + } + else if (typeof formatter === 'function') { + var callback = bind(function (cbTicket, html) { + if (cbTicket === this._ticket) { + tooltipContent.setContent(html); + this._updatePosition( + tooltipModel, positionExpr, x, y, tooltipContent, params, el + ); + } + }, this); + this._ticket = asyncTicket; + html = formatter(params, asyncTicket, callback); + } - if (elMap[id]) { - elMap[id].__ecGraphicWidth = elOption.width; - elMap[id].__ecGraphicHeight = elOption.height; - } - }); + tooltipContent.setContent(html); + tooltipContent.show(tooltipModel); + + this._updatePosition( + tooltipModel, positionExpr, x, y, tooltipContent, params, el + ); }, /** - * Locate graphic elements. - * - * @private - * @param {Object} graphicModel graphic model - * @param {module:echarts/ExtensionAPI} api extension API + * @param {string|Function|Array.} positionExpr + * @param {number} x Mouse x + * @param {number} y Mouse y + * @param {boolean} confine Whether confine tooltip content in view rect. + * @param {Object|} params + * @param {module:zrender/Element} el target element + * @param {module:echarts/ExtensionAPI} api + * @return {Array.} */ - _relocate: function (graphicModel, api) { - var elOptions = graphicModel.option.elements; - var rootGroup = this.group; - var elMap = this._elMap; - - // Bottom-up tranvese all elements (consider ec resize) to locate elements. - for (var i = elOptions.length - 1; i >= 0; i--) { - var elOption = elOptions[i]; - var el = elMap[elOption.id]; + _updatePosition: function (tooltipModel, positionExpr, x, y, content, params, el) { + var viewWidth = this._api.getWidth(); + var viewHeight = this._api.getHeight(); + positionExpr = positionExpr || tooltipModel.get('position'); + + var contentSize = content.getSize(); + var align = tooltipModel.get('align'); + var vAlign = tooltipModel.get('verticalAlign'); + var rect = el && el.getBoundingRect().clone(); + el && rect.applyTransform(el.transform); + + if (typeof positionExpr === 'function') { + // Callback of position can be an array or a string specify the position + positionExpr = positionExpr([x, y], params, content.el, rect, { + viewSize: [viewWidth, viewHeight], + contentSize: contentSize.slice() + }); + } - if (!el) { - continue; - } + if (zrUtil.isArray(positionExpr)) { + x = parsePercent(positionExpr[0], viewWidth); + y = parsePercent(positionExpr[1], viewHeight); + } + else if (zrUtil.isObject(positionExpr)) { + positionExpr.width = contentSize[0]; + positionExpr.height = contentSize[1]; + var layoutRect = layoutUtil.getLayoutRect( + positionExpr, {width: viewWidth, height: viewHeight} + ); + x = layoutRect.x; + y = layoutRect.y; + align = null; + // When positionExpr is left/top/right/bottom, + // align and verticalAlign will not work. + vAlign = null; + } + // Specify tooltip position by string 'top' 'bottom' 'left' 'right' around graphic element + else if (typeof positionExpr === 'string' && el) { + var pos = calcTooltipPosition( + positionExpr, rect, contentSize + ); + x = pos[0]; + y = pos[1]; + } + else { + var pos = refixTooltipPosition( + x, y, content.el, viewWidth, viewHeight, align ? 0 : 20, vAlign ? 0 : 20 + ); + x = pos[0]; + y = pos[1]; + } - var parentEl = el.parent; - var containerInfo = parentEl === rootGroup - ? { - width: api.getWidth(), - height: api.getHeight() - } - : { // Like 'position:absolut' in css, default 0. - width: parentEl.__ecGraphicWidth || 0, - height: parentEl.__ecGraphicHeight || 0 - }; + align && (x -= isCenterAlign(align) ? contentSize[0] / 2 : align === 'right' ? contentSize[0] : 0); + vAlign && (y -= isCenterAlign(vAlign) ? contentSize[1] / 2 : vAlign === 'bottom' ? contentSize[1] : 0); - layoutUtil.positionElement( - el, elOption, containerInfo, null, - {hv: elOption.hv, boundingMode: elOption.bounding} + if (tooltipModel.get('confine')) { + var pos = confineTooltipPosition( + x, y, content.el, viewWidth, viewHeight ); + x = pos[0]; + y = pos[1]; } + + content.moveTo(x, y); }, - /** - * Clear all elements. - * - * @private - */ - _clear: function () { - var elMap = this._elMap; - zrUtil.each(elMap, function (el) { - removeEl(el, elMap); + // FIXME + // Should we remove this but leave this to user? + _updateContentNotChangedOnAxis: function (dataByCoordSys) { + var lastCoordSys = this._lastDataByCoordSys; + var contentNotChanged = !!lastCoordSys + && lastCoordSys.length === dataByCoordSys.length; + + each(lastCoordSys, function (lastItemCoordSys, indexCoordSys) { + var lastDataByAxis = lastItemCoordSys.dataByAxis || {}; + var thisItemCoordSys = dataByCoordSys[indexCoordSys] || {}; + var thisDataByAxis = thisItemCoordSys.dataByAxis || []; + contentNotChanged &= lastDataByAxis.length === thisDataByAxis.length; + + each(lastDataByAxis, function (lastItem, indexAxis) { + var thisItem = thisDataByAxis[indexAxis] || {}; + var lastIndices = lastItem.seriesDataIndices || []; + var newIndices = thisItem.seriesDataIndices || []; + + contentNotChanged &= + lastItem.value === thisItem.value + && lastItem.axisType === thisItem.axisType + && lastItem.axisId === thisItem.axisId + && lastIndices.length === newIndices.length; + + each(lastIndices, function (lastIdxItem, j) { + var newIdxItem = newIndices[j]; + contentNotChanged &= + lastIdxItem.seriesIndex === newIdxItem.seriesIndex + && lastIdxItem.dataIndex === newIdxItem.dataIndex; + }); + }); }); - this._elMap = {}; + + this._lastDataByCoordSys = dataByCoordSys; + + return !!contentNotChanged; }, - /** - * @override - */ - dispose: function () { - this._clear(); - } - }); + _hide: function (dispatchAction) { + // Do not directly hideLater here, because this behavior may be prevented + // in dispatchAction when showTip is dispatched. - function createEl(id, targetElParent, elOption, elMap) { - var graphicType = elOption.type; + // FIXME + // duplicated hideTip if manuallyHideTip is called from dispatchAction. + this._lastDataByCoordSys = null; + dispatchAction({ + type: 'hideTip', + from: this.uid + }); + }, - if (true) { - zrUtil.assert(graphicType, 'graphic type MUST be set'); + dispose: function (ecModel, api) { + if (env.node) { + return; + } + this._tooltipContent.hide(); + globalListener.unregister('itemTooltip', api); } + }); - var Clz = graphicUtil[graphicType.charAt(0).toUpperCase() + graphicType.slice(1)]; - if (true) { - zrUtil.assert(Clz, 'graphic type can not be found'); + /** + * @param {Array.} modelCascade + * From top to bottom. (the last one should be globalTooltipModel); + */ + function buildTooltipModel(modelCascade) { + var resultModel = modelCascade.pop(); + while (modelCascade.length) { + var tooltipOpt = modelCascade.pop(); + if (tooltipOpt) { + if (tooltipOpt instanceof Model) { + tooltipOpt = tooltipOpt.get('tooltip', true); + } + // In each data item tooltip can be simply write: + // { + // value: 10, + // tooltip: 'Something you need to know' + // } + if (typeof tooltipOpt === 'string') { + tooltipOpt = {formatter: tooltipOpt}; + } + resultModel = new Model(tooltipOpt, resultModel, resultModel.ecModel); + } } + return resultModel; + } - var el = new Clz(elOption); - targetElParent.add(el); - elMap[id] = el; - el.__ecGraphicId = id; + function makeDispatchAction(payload, api) { + return payload.dispatchAction || zrUtil.bind(api.dispatchAction, api); } - function removeEl(existEl, elMap) { - var existElParent = existEl && existEl.parent; - if (existElParent) { - existEl.type === 'group' && existEl.traverse(function (el) { - removeEl(el, elMap); - }); - delete elMap[existEl.__ecGraphicId]; - existElParent.remove(existEl); + function refixTooltipPosition(x, y, el, viewWidth, viewHeight, gapH, gapV) { + var width = el.clientWidth; + var height = el.clientHeight; + + if (x + width + gapH > viewWidth) { + x -= width + gapH; + } + else { + x += gapH; } + if (y + height + gapV > viewHeight) { + y -= height + gapV; + } + else { + y += gapV; + } + return [x, y]; } - // Remove unnecessary props to avoid potential problems. - function getCleanedElOption(elOption) { - elOption = zrUtil.extend({}, elOption); - zrUtil.each( - ['id', 'parentId', '$action', 'hv', 'bounding'].concat(layoutUtil.LOCATION_PARAMS), - function (name) { - delete elOption[name]; - } - ); - return elOption; + function confineTooltipPosition(x, y, el, viewWidth, viewHeight) { + var width = el.clientWidth; + var height = el.clientHeight; + + x = Math.min(x + width, viewWidth) - width; + y = Math.min(y + height, viewHeight) - height; + x = Math.max(x, 0); + y = Math.max(y, 0); + + return [x, y]; } - function isSetLoc(obj, props) { - var isSet; - zrUtil.each(props, function (prop) { - obj[prop] != null && obj[prop] !== 'auto' && (isSet = true); - }); - return isSet; + function calcTooltipPosition(position, rect, contentSize) { + var domWidth = contentSize[0]; + var domHeight = contentSize[1]; + var gap = 5; + var x = 0; + var y = 0; + var rectWidth = rect.width; + var rectHeight = rect.height; + switch (position) { + case 'inside': + x = rect.x + rectWidth / 2 - domWidth / 2; + y = rect.y + rectHeight / 2 - domHeight / 2; + break; + case 'top': + x = rect.x + rectWidth / 2 - domWidth / 2; + y = rect.y - domHeight - gap; + break; + case 'bottom': + x = rect.x + rectWidth / 2 - domWidth / 2; + y = rect.y + rectHeight + gap; + break; + case 'left': + x = rect.x - domWidth - gap; + y = rect.y + rectHeight / 2 - domHeight / 2; + break; + case 'right': + x = rect.x + rectWidth + gap; + y = rect.y + rectHeight / 2 - domHeight / 2; + } + return [x, y]; + } + + function isCenterAlign(align) { + return align === 'center' || align === 'middle'; } /***/ }, -/* 293 */ +/* 318 */ /***/ function(module, exports, __webpack_require__) { /** - * Legend component entry file8 + * @module echarts/component/tooltip/TooltipContent */ - __webpack_require__(294); - __webpack_require__(295); - __webpack_require__(296); - - var echarts = __webpack_require__(1); - // Series Filter - echarts.registerProcessor(__webpack_require__(298)); + var zrUtil = __webpack_require__(4); + var zrColor = __webpack_require__(39); + var eventUtil = __webpack_require__(88); + var formatUtil = __webpack_require__(6); + var each = zrUtil.each; + var toCamelCase = formatUtil.toCamelCase; + var env = __webpack_require__(2); + var vendors = ['', '-webkit-', '-moz-', '-o-']; -/***/ }, -/* 294 */ -/***/ function(module, exports, __webpack_require__) { + var gCssText = 'position:absolute;display:block;border-style:solid;white-space:nowrap;z-index:9999999;'; - 'use strict'; + /** + * @param {number} duration + * @return {string} + * @inner + */ + function assembleTransition(duration) { + var transitionCurve = 'cubic-bezier(0.23, 1, 0.32, 1)'; + var transitionText = 'left ' + duration + 's ' + transitionCurve + ',' + + 'top ' + duration + 's ' + transitionCurve; + return zrUtil.map(vendors, function (vendorPrefix) { + return vendorPrefix + 'transition:' + transitionText; + }).join(';'); + } + /** + * @param {Object} textStyle + * @return {string} + * @inner + */ + function assembleFont(textStyleModel) { + var cssText = []; - var zrUtil = __webpack_require__(4); - var Model = __webpack_require__(12); + var fontSize = textStyleModel.get('fontSize'); + var color = textStyleModel.getTextColor(); - var LegendModel = __webpack_require__(1).extendComponentModel({ + color && cssText.push('color:' + color); - type: 'legend', + cssText.push('font:' + textStyleModel.getFont()); - dependencies: ['series'], + fontSize && + cssText.push('line-height:' + Math.round(fontSize * 3 / 2) + 'px'); - layoutMode: { - type: 'box', - ignoreSize: true - }, + each(['decoration', 'align'], function (name) { + var val = textStyleModel.get(name); + val && cssText.push('text-' + name + ':' + val); + }); - init: function (option, parentModel, ecModel) { - this.mergeDefaultAndTheme(option, ecModel); + return cssText.join(';'); + } - option.selected = option.selected || {}; - }, + /** + * @param {Object} tooltipModel + * @return {string} + * @inner + */ + function assembleCssText(tooltipModel) { - mergeOption: function (option) { - LegendModel.superCall(this, 'mergeOption', option); - }, + var cssText = []; - optionUpdated: function () { - this._updateData(this.ecModel); + var transitionDuration = tooltipModel.get('transitionDuration'); + var backgroundColor = tooltipModel.get('backgroundColor'); + var textStyleModel = tooltipModel.getModel('textStyle'); + var padding = tooltipModel.get('padding'); - var legendData = this._data; + // Animation transition. Do not animate when transitionDuration is 0. + transitionDuration && + cssText.push(assembleTransition(transitionDuration)); - // If selectedMode is single, try to select one - if (legendData[0] && this.get('selectedMode') === 'single') { - var hasSelected = false; - // If has any selected in option.selected - for (var i = 0; i < legendData.length; i++) { - var name = legendData[i].get('name'); - if (this.isSelected(name)) { - // Force to unselect others - this.select(name); - hasSelected = true; - break; - } - } - // Try select the first if selectedMode is single - !hasSelected && this.select(legendData[0].get('name')); + if (backgroundColor) { + if (env.canvasSupported) { + cssText.push('background-Color:' + backgroundColor); } - }, + else { + // for ie + cssText.push( + 'background-Color:#' + zrColor.toHex(backgroundColor) + ); + cssText.push('filter:alpha(opacity=70)'); + } + } - _updateData: function (ecModel) { - var legendData = zrUtil.map(this.get('data') || [], function (dataItem) { - // Can be string or number - if (typeof dataItem === 'string' || typeof dataItem === 'number') { - dataItem = { - name: dataItem - }; - } - return new Model(dataItem, this, this.ecModel); - }, this); - this._data = legendData; + // Border style + each(['width', 'color', 'radius'], function (name) { + var borderName = 'border-' + name; + var camelCase = toCamelCase(borderName); + var val = tooltipModel.get(camelCase); + val != null && + cssText.push(borderName + ':' + val + (name === 'color' ? '' : 'px')); + }); - var availableNames = zrUtil.map(ecModel.getSeries(), function (series) { - return series.name; - }); - ecModel.eachSeries(function (seriesModel) { - if (seriesModel.legendDataProvider) { - var data = seriesModel.legendDataProvider(); - availableNames = availableNames.concat(data.mapArray(data.getName)); - } - }); - /** - * @type {Array.} - * @private - */ - this._availableNames = availableNames; - }, + // Text style + cssText.push(assembleFont(textStyleModel)); - /** - * @return {Array.} - */ - getData: function () { - return this._data; - }, + // Padding + if (padding != null) { + cssText.push('padding:' + formatUtil.normalizeCssArray(padding).join('px ') + 'px'); + } + + return cssText.join(';') + ';'; + } + + /** + * @alias module:echarts/component/tooltip/TooltipContent + * @constructor + */ + function TooltipContent(container, api) { + var el = document.createElement('div'); + var zr = this._zr = api.getZr(); + + this.el = el; + + this._x = api.getWidth() / 2; + this._y = api.getHeight() / 2; + + container.appendChild(el); + + this._container = container; + + this._show = false; /** - * @param {string} name + * @private */ - select: function (name) { - var selected = this.option.selected; - var selectedMode = this.get('selectedMode'); - if (selectedMode === 'single') { - var data = this._data; - zrUtil.each(data, function (dataItem) { - selected[dataItem.get('name')] = false; - }); + this._hideTimeout; + + var self = this; + el.onmouseenter = function () { + // clear the timeout in hideLater and keep showing tooltip + if (self._enterable) { + clearTimeout(self._hideTimeout); + self._show = true; } - selected[name] = true; - }, + self._inContent = true; + }; + el.onmousemove = function (e) { + e = e || window.event; + if (!self._enterable) { + // Try trigger zrender event to avoid mouse + // in and out shape too frequently + var handler = zr.handler; + eventUtil.normalizeEvent(container, e, true); + handler.dispatch('mousemove', e); + } + }; + el.onmouseleave = function () { + if (self._enterable) { + if (self._show) { + self.hideLater(self._hideDelay); + } + } + self._inContent = false; + }; + } + + TooltipContent.prototype = { + + constructor: TooltipContent, /** - * @param {string} name + * @private + * @type {boolean} */ - unSelect: function (name) { - if (this.get('selectedMode') !== 'single') { - this.option.selected[name] = false; - } - }, + _enterable: true, /** - * @param {string} name + * Update when tooltip is rendered */ - toggleSelected: function (name) { - var selected = this.option.selected; - // Default is true - if (!selected.hasOwnProperty(name)) { - selected[name] = true; + update: function () { + // FIXME + // Move this logic to ec main? + var container = this._container; + var stl = container.currentStyle + || document.defaultView.getComputedStyle(container); + var domStyle = container.style; + if (domStyle.position !== 'absolute' && stl.position !== 'absolute') { + domStyle.position = 'relative'; } - this[selected[name] ? 'unSelect' : 'select'](name); + // Hide the tooltip + // PENDING + // this.hide(); }, - /** - * @param {string} name - */ - isSelected: function (name) { - var selected = this.option.selected; - return !(selected.hasOwnProperty(name) && !selected[name]) - && zrUtil.indexOf(this._availableNames, name) >= 0; - }, + show: function (tooltipModel) { + clearTimeout(this._hideTimeout); + var el = this.el; - defaultOption: { - // 一级层叠 - zlevel: 0, - // 二级层叠 - z: 4, - show: true, + el.style.cssText = gCssText + assembleCssText(tooltipModel) + // http://stackoverflow.com/questions/21125587/css3-transition-not-working-in-chrome-anymore + + ';left:' + this._x + 'px;top:' + this._y + 'px;' + + (tooltipModel.get('extraCssText') || ''); - // 布局方式,默认为水平布局,可选为: - // 'horizontal' | 'vertical' - orient: 'horizontal', + el.style.display = el.innerHTML ? 'block' : 'none'; - left: 'center', - // right: 'center', + this._show = true; + }, - top: 'top', - // bottom: 'top', + setContent: function (content) { + this.el.innerHTML = content; + }, - // 水平对齐 - // 'auto' | 'left' | 'right' - // 默认为 'auto', 根据 x 的位置判断是左对齐还是右对齐 - align: 'auto', + setEnterable: function (enterable) { + this._enterable = enterable; + }, - backgroundColor: 'rgba(0,0,0,0)', - // 图例边框颜色 - borderColor: '#ccc', - // 图例边框线宽,单位px,默认为0(无边框) - borderWidth: 0, - // 图例内边距,单位px,默认各方向内边距为5, - // 接受数组分别设定上右下左边距,同css - padding: 5, - // 各个item之间的间隔,单位px,默认为10, - // 横向布局时为水平间隔,纵向布局时为纵向间隔 - itemGap: 10, - // 图例图形宽度 - itemWidth: 25, - // 图例图形高度 - itemHeight: 14, + getSize: function () { + var el = this.el; + return [el.clientWidth, el.clientHeight]; + }, - // 图例关闭时候的颜色 - inactiveColor: '#ccc', + moveTo: function (x, y) { + // xy should be based on canvas root. But tooltipContent is + // the sibling of canvas root. So padding of ec container + // should be considered here. + var zr = this._zr; + var viewportRoot; + if (zr && zr.painter && (viewportRoot = zr.painter.getViewportRoot())) { + x += viewportRoot.offsetLeft || 0; + y += viewportRoot.offsetTop || 0; + } - textStyle: { - // 图例文字颜色 - color: '#333' - }, - // formatter: '', - // 选择模式,默认开启图例开关 - selectedMode: true, - // 配置默认选中状态,可配合LEGEND.SELECTED事件做动态数据载入 - // selected: null, - // 图例内容(详见legend.data,数组中每一项代表一个item - // data: [], + var style = this.el.style; + style.left = x + 'px'; + style.top = y + 'px'; + + this._x = x; + this._y = y; + }, + + hide: function () { + this.el.style.display = 'none'; + this._show = false; + }, - // Tooltip 相关配置 - tooltip: { - show: false + hideLater: function (time) { + if (this._show && !(this._inContent && this._enterable)) { + if (time) { + this._hideDelay = time; + // Set show false to avoid invoke hideLater mutiple times + this._show = false; + this._hideTimeout = setTimeout(zrUtil.bind(this.hide, this), time); + } + else { + this.hide(); + } } + }, + + isShow: function () { + return this._show; } - }); + }; - module.exports = LegendModel; + module.exports = TooltipContent; /***/ }, -/* 295 */ +/* 319 */ /***/ function(module, exports, __webpack_require__) { - /** - * @file Legend action - */ - - - var echarts = __webpack_require__(1); - var zrUtil = __webpack_require__(4); + 'use strict'; - function legendSelectActionHandler(methodName, payload, ecModel) { - var selectedMap = {}; - var isToggleSelect = methodName === 'toggleSelected'; - var isSelected; - // Update all legend components - ecModel.eachComponent('legend', function (legendModel) { - if (isToggleSelect && isSelected != null) { - // Force other legend has same selected status - // Or the first is toggled to true and other are toggled to false - // In the case one legend has some item unSelected in option. And if other legend - // doesn't has the item, they will assume it is selected. - legendModel[isSelected ? 'select' : 'unSelect'](payload.name); - } - else { - legendModel[methodName](payload.name); - isSelected = legendModel.isSelected(payload.name); - } - var legendData = legendModel.getData(); - zrUtil.each(legendData, function (model) { - var name = model.get('name'); - // Wrap element - if (name === '\n' || name === '') { - return; - } - var isItemSelected = legendModel.isSelected(name); - if (name in selectedMap) { - // Unselected if any legend is unselected - selectedMap[name] = selectedMap[name] && isItemSelected; - } - else { - selectedMap[name] = isItemSelected; - } - }); - }); - // Return the event explicitly - return { - name: payload.name, - selected: selectedMap - }; - } - /** - * @event legendToggleSelect - * @type {Object} - * @property {string} type 'legendToggleSelect' - * @property {string} [from] - * @property {string} name Series name or data item name - */ - echarts.registerAction( - 'legendToggleSelect', 'legendselectchanged', - zrUtil.curry(legendSelectActionHandler, 'toggleSelected') - ); - /** - * @event legendSelect - * @type {Object} - * @property {string} type 'legendSelect' - * @property {string} name Series name or data item name - */ - echarts.registerAction( - 'legendSelect', 'legendselected', - zrUtil.curry(legendSelectActionHandler, 'select') - ); + __webpack_require__(320); + __webpack_require__(326); + __webpack_require__(329); + __webpack_require__(142); - /** - * @event legendUnSelect - * @type {Object} - * @property {string} type 'legendUnSelect' - * @property {string} name Series name or data item name - */ - echarts.registerAction( - 'legendUnSelect', 'legendunselected', - zrUtil.curry(legendSelectActionHandler, 'unSelect') - ); + // Polar view + __webpack_require__(1).extendComponentView({ + type: 'polar' + }); /***/ }, -/* 296 */ +/* 320 */ /***/ function(module, exports, __webpack_require__) { - + // TODO Axis scale + + var Polar = __webpack_require__(321); + var numberUtil = __webpack_require__(7); var zrUtil = __webpack_require__(4); - var symbolCreator = __webpack_require__(107); - var graphic = __webpack_require__(43); - var listComponentHelper = __webpack_require__(297); - var curry = zrUtil.curry; + var axisHelper = __webpack_require__(105); + var niceScaleExtent = axisHelper.niceScaleExtent; - function dispatchSelectAction(name, api) { - api.dispatchAction({ - type: 'legendToggleSelect', - name: name - }); - } + // 依赖 PolarModel 做预处理 + __webpack_require__(324); - function dispatchHighlightAction(seriesModel, dataName, api) { - // If element hover will move to a hoverLayer. - var el = api.getZr().storage.getDisplayList()[0]; - if (!(el && el.useHoverLayer)) { - seriesModel.get('legendHoverLink') && api.dispatchAction({ - type: 'highlight', - seriesName: seriesModel.name, - name: dataName - }); - } + /** + * Resize method bound to the polar + * @param {module:echarts/coord/polar/PolarModel} polarModel + * @param {module:echarts/ExtensionAPI} api + */ + function resizePolar(polarModel, api) { + var center = polarModel.get('center'); + var radius = polarModel.get('radius'); + var width = api.getWidth(); + var height = api.getHeight(); + var parsePercent = numberUtil.parsePercent; + + this.cx = parsePercent(center[0], width); + this.cy = parsePercent(center[1], height); + + var radiusAxis = this.getRadiusAxis(); + var size = Math.min(width, height) / 2; + // var idx = radiusAxis.inverse ? 1 : 0; + radiusAxis.setExtent(0, parsePercent(radius, size)); } - function dispatchDownplayAction(seriesModel, dataName, api) { - // If element hover will move to a hoverLayer. - var el = api.getZr().storage.getDisplayList()[0]; - if (!(el && el.useHoverLayer)) { - seriesModel.get('legendHoverLink') && api.dispatchAction({ - type: 'downplay', - seriesName: seriesModel.name, - name: dataName - }); + /** + * Update polar + */ + function updatePolarScale(ecModel, api) { + var polar = this; + var angleAxis = polar.getAngleAxis(); + var radiusAxis = polar.getRadiusAxis(); + // Reset scale + angleAxis.scale.setExtent(Infinity, -Infinity); + radiusAxis.scale.setExtent(Infinity, -Infinity); + + ecModel.eachSeries(function (seriesModel) { + if (seriesModel.coordinateSystem === polar) { + var data = seriesModel.getData(); + radiusAxis.scale.unionExtentFromData(data, 'radius'); + angleAxis.scale.unionExtentFromData(data, 'angle'); + } + }); + + niceScaleExtent(angleAxis.scale, angleAxis.model); + niceScaleExtent(radiusAxis.scale, radiusAxis.model); + + // Fix extent of category angle axis + if (angleAxis.type === 'category' && !angleAxis.onBand) { + var extent = angleAxis.getExtent(); + var diff = 360 / angleAxis.scale.count(); + angleAxis.inverse ? (extent[1] += diff) : (extent[1] -= diff); + angleAxis.setExtent(extent[0], extent[1]); } } - module.exports = __webpack_require__(1).extendComponentView({ - - type: 'legend', + /** + * Set common axis properties + * @param {module:echarts/coord/polar/AngleAxis|module:echarts/coord/polar/RadiusAxis} + * @param {module:echarts/coord/polar/AxisModel} + * @inner + */ + function setAxis(axis, axisModel) { + axis.type = axisModel.get('type'); + axis.scale = axisHelper.createScaleByModel(axisModel); + axis.onBand = axisModel.get('boundaryGap') && axis.type === 'category'; - init: function () { - this._symbolTypeStore = {}; - }, + // FIXME Radius axis not support inverse axis + if (axisModel.mainType === 'angleAxis') { + var startAngle = axisModel.get('startAngle'); + axis.inverse = axisModel.get('inverse') ^ axisModel.get('clockwise'); + axis.setExtent(startAngle, startAngle + (axis.inverse ? -360 : 360)); + } - render: function (legendModel, ecModel, api) { - var group = this.group; - group.removeAll(); + // Inject axis instance + axisModel.axis = axis; + axis.model = axisModel; + } - if (!legendModel.get('show')) { - return; - } - var selectMode = legendModel.get('selectedMode'); - var itemAlign = legendModel.get('align'); + var polarCreator = { - if (itemAlign === 'auto') { - itemAlign = (legendModel.get('left') === 'right' - && legendModel.get('orient') === 'vertical') - ? 'right' : 'left'; - } + dimensions: Polar.prototype.dimensions, - var legendDrawedMap = {}; + create: function (ecModel, api) { + var polarList = []; + ecModel.eachComponent('polar', function (polarModel, idx) { + var polar = new Polar(idx); + // Inject resize and update method + polar.resize = resizePolar; + polar.update = updatePolarScale; - zrUtil.each(legendModel.getData(), function (itemModel) { - var name = itemModel.get('name'); + var radiusAxis = polar.getRadiusAxis(); + var angleAxis = polar.getAngleAxis(); - // Use empty string or \n as a newline string - if (name === '' || name === '\n') { - group.add(new graphic.Group({ - newline: true - })); - return; - } + var radiusAxisModel = polarModel.findAxisModel('radiusAxis'); + var angleAxisModel = polarModel.findAxisModel('angleAxis'); - var seriesModel = ecModel.getSeriesByName(name)[0]; + setAxis(radiusAxis, radiusAxisModel); + setAxis(angleAxis, angleAxisModel); - if (legendDrawedMap[name]) { - // Have been drawed - return; - } + polar.resize(polarModel, api); + polarList.push(polar); - // Series legend - if (seriesModel) { - var data = seriesModel.getData(); - var color = data.getVisual('color'); + polarModel.coordinateSystem = polar; + polar.model = polarModel; + }); + // Inject coordinateSystem to series + ecModel.eachSeries(function (seriesModel) { + if (seriesModel.get('coordinateSystem') === 'polar') { + var polarModel = ecModel.queryComponents({ + mainType: 'polar', + index: seriesModel.get('polarIndex'), + id: seriesModel.get('polarId') + })[0]; - // If color is a callback function - if (typeof color === 'function') { - // Use the first data - color = color(seriesModel.getDataParams(0)); + if (true) { + if (!polarModel) { + throw new Error( + 'Polar "' + zrUtil.retrieve( + seriesModel.get('polarIndex'), + seriesModel.get('polarId'), + 0 + ) + '" not found' + ); + } } + seriesModel.coordinateSystem = polarModel.coordinateSystem; + } + }); - // Using rect symbol defaultly - var legendSymbolType = data.getVisual('legendSymbol') || 'roundRect'; - var symbolType = data.getVisual('symbol'); + return polarList; + } + }; - var itemGroup = this._createItem( - name, itemModel, legendModel, - legendSymbolType, symbolType, - itemAlign, color, - selectMode - ); + __webpack_require__(26).register('polar', polarCreator); - itemGroup.on('click', curry(dispatchSelectAction, name, api)) - .on('mouseover', curry(dispatchHighlightAction, seriesModel, null, api)) - .on('mouseout', curry(dispatchDownplayAction, seriesModel, null, api)); - legendDrawedMap[name] = true; - } - else { - // Data legend of pie, funnel - ecModel.eachRawSeries(function (seriesModel) { - // In case multiple series has same data name - if (legendDrawedMap[name]) { - return; - } - if (seriesModel.legendDataProvider) { - var data = seriesModel.legendDataProvider(); - var idx = data.indexOfName(name); - if (idx < 0) { - return; - } +/***/ }, +/* 321 */ +/***/ function(module, exports, __webpack_require__) { - var color = data.getItemVisual(idx, 'color'); + 'use strict'; + /** + * @module echarts/coord/polar/Polar + */ - var legendSymbolType = 'roundRect'; - var itemGroup = this._createItem( - name, itemModel, legendModel, - legendSymbolType, null, - itemAlign, color, - selectMode - ); + var RadiusAxis = __webpack_require__(322); + var AngleAxis = __webpack_require__(323); - itemGroup.on('click', curry(dispatchSelectAction, name, api)) - // FIXME Should not specify the series name - .on('mouseover', curry(dispatchHighlightAction, seriesModel, name, api)) - .on('mouseout', curry(dispatchDownplayAction, seriesModel, name, api)); + /** + * @alias {module:echarts/coord/polar/Polar} + * @constructor + * @param {string} name + */ + var Polar = function (name) { - legendDrawedMap[name] = true; - } - }, this); - } + /** + * @type {string} + */ + this.name = name || ''; - if (true) { - if (!legendDrawedMap[name]) { - console.warn(name + ' series not exists. Legend data should be same with series name or data name.'); - } - } - }, this); + /** + * x of polar center + * @type {number} + */ + this.cx = 0; - listComponentHelper.layout(group, legendModel, api); - // Render background after group is layout - // FIXME - listComponentHelper.addBackground(group, legendModel); - }, + /** + * y of polar center + * @type {number} + */ + this.cy = 0; - _createItem: function ( - name, itemModel, legendModel, - legendSymbolType, symbolType, - itemAlign, color, selectMode - ) { - var itemWidth = legendModel.get('itemWidth'); - var itemHeight = legendModel.get('itemHeight'); - var inactiveColor = legendModel.get('inactiveColor'); + /** + * @type {module:echarts/coord/polar/RadiusAxis} + * @private + */ + this._radiusAxis = new RadiusAxis(); - var isSelected = legendModel.isSelected(name); - var itemGroup = new graphic.Group(); + /** + * @type {module:echarts/coord/polar/AngleAxis} + * @private + */ + this._angleAxis = new AngleAxis(); - var textStyleModel = itemModel.getModel('textStyle'); + this._radiusAxis.polar = this._angleAxis.polar = this; + }; - var itemIcon = itemModel.get('icon'); + Polar.prototype = { - var tooltipModel = itemModel.getModel('tooltip'); - var legendGlobalTooltipModel = tooltipModel.parentModel; + type: 'polar', - // Use user given icon first - legendSymbolType = itemIcon || legendSymbolType; - itemGroup.add(symbolCreator.createSymbol( - legendSymbolType, 0, 0, itemWidth, itemHeight, isSelected ? color : inactiveColor - )); + axisPointerEnabled: true, - // Compose symbols - // PENDING - if (!itemIcon && symbolType - // At least show one symbol, can't be all none - && ((symbolType !== legendSymbolType) || symbolType == 'none') - ) { - var size = itemHeight * 0.8; - if (symbolType === 'none') { - symbolType = 'circle'; - } - // Put symbol in the center - itemGroup.add(symbolCreator.createSymbol( - symbolType, (itemWidth - size) / 2, (itemHeight - size) / 2, size, size, - isSelected ? color : inactiveColor - )); - } + constructor: Polar, - // Text - var textX = itemAlign === 'left' ? itemWidth + 5 : -5; - var textAlign = itemAlign; + /** + * @param {Array.} + * @readOnly + */ + dimensions: ['radius', 'angle'], - var formatter = legendModel.get('formatter'); - var content = name; - if (typeof formatter === 'string' && formatter) { - content = formatter.replace('{name}', name != null ? name : ''); - } - else if (typeof formatter === 'function') { - content = formatter(name); - } + /** + * @type {module:echarts/coord/PolarModel} + */ + model: null, - var text = new graphic.Text({ - style: { - text: content, - x: textX, - y: itemHeight / 2, - fill: isSelected ? textStyleModel.getTextColor() : inactiveColor, - textFont: textStyleModel.getFont(), - textAlign: textAlign, - textVerticalAlign: 'middle' - } - }); - itemGroup.add(text); + /** + * If contain coord + * @param {Array.} point + * @return {boolean} + */ + containPoint: function (point) { + var coord = this.pointToCoord(point); + return this._radiusAxis.contain(coord[0]) + && this._angleAxis.contain(coord[1]); + }, - // Add a invisible rect to increase the area of mouse hover - var hitRect = new graphic.Rect({ - shape: itemGroup.getBoundingRect(), - invisible: true, - tooltip: tooltipModel.get('show') ? zrUtil.extend({ - content: name, - // Defaul formatter - formatter: legendGlobalTooltipModel.get('formatter', true) || function () { - return name; - }, - formatterParams: { - componentType: 'legend', - legendIndex: legendModel.componentIndex, - name: name, - $vars: ['name'] - } - }, tooltipModel.option) : null - }); - itemGroup.add(hitRect); + /** + * If contain data + * @param {Array.} data + * @return {boolean} + */ + containData: function (data) { + return this._radiusAxis.containData(data[0]) + && this._angleAxis.containData(data[1]); + }, - itemGroup.eachChild(function (child) { - child.silent = true; - }); + /** + * @param {string} dim + * @return {module:echarts/coord/polar/AngleAxis|module:echarts/coord/polar/RadiusAxis} + */ + getAxis: function (dim) { + return this['_' + dim + 'Axis']; + }, - hitRect.silent = !selectMode; + /** + * @return {Array.} + */ + getAxes: function () { + return [this._radiusAxis, this._angleAxis]; + }, + + /** + * Get axes by type of scale + * @param {string} scaleType + * @return {module:echarts/coord/polar/AngleAxis|module:echarts/coord/polar/RadiusAxis} + */ + getAxesByScale: function (scaleType) { + var axes = []; + var angleAxis = this._angleAxis; + var radiusAxis = this._radiusAxis; + angleAxis.scale.type === scaleType && axes.push(angleAxis); + radiusAxis.scale.type === scaleType && axes.push(radiusAxis); + return axes; + }, + /** + * @return {module:echarts/coord/polar/AngleAxis} + */ + getAngleAxis: function () { + return this._angleAxis; + }, - this.group.add(itemGroup); + /** + * @return {module:echarts/coord/polar/RadiusAxis} + */ + getRadiusAxis: function () { + return this._radiusAxis; + }, - graphic.setHoverStyle(itemGroup); + /** + * @param {module:echarts/coord/polar/Axis} + * @return {module:echarts/coord/polar/Axis} + */ + getOtherAxis: function (axis) { + var angleAxis = this._angleAxis; + return axis === angleAxis ? this._radiusAxis : angleAxis; + }, - return itemGroup; - } - }); + /** + * Base axis will be used on stacking. + * + * @return {module:echarts/coord/polar/Axis} + */ + getBaseAxis: function () { + return this.getAxesByScale('ordinal')[0] + || this.getAxesByScale('time')[0] + || this.getAngleAxis(); + }, + /** + * @param {string} [dim] 'radius' or 'angle' or 'auto' or null/undefined + * @return {Object} {baseAxes: [], otherAxes: []} + */ + getTooltipAxes: function (dim) { + var baseAxis = (dim != null && dim !== 'auto') + ? this.getAxis(dim) : this.getBaseAxis(); + return { + baseAxes: [baseAxis], + otherAxes: [this.getOtherAxis(baseAxis)] + }; + }, -/***/ }, -/* 297 */ -/***/ function(module, exports, __webpack_require__) { + /** + * Convert series data to a list of (x, y) points + * @param {module:echarts/data/List} data + * @return {Array} + * Return list of coordinates. For example: + * `[[10, 10], [20, 20], [30, 30]]` + */ + dataToPoints: function (data) { + return data.mapArray(this.dimensions, function (radius, angle) { + return this.dataToPoint([radius, angle]); + }, this); + }, - - // List layout - var layout = __webpack_require__(21); - var formatUtil = __webpack_require__(6); - var graphic = __webpack_require__(43); + /** + * Convert a single data item to (x, y) point. + * Parameter data is an array which the first element is radius and the second is angle + * @param {Array.} data + * @param {boolean} [clamp=false] + * @return {Array.} + */ + dataToPoint: function (data, clamp) { + return this.coordToPoint([ + this._radiusAxis.dataToRadius(data[0], clamp), + this._angleAxis.dataToAngle(data[1], clamp) + ]); + }, - function positionGroup(group, model, api) { - layout.positionElement( - group, model.getBoxLayoutParams(), - { - width: api.getWidth(), - height: api.getHeight() - }, - model.get('padding') - ); - } + /** + * Convert a (x, y) point to data + * @param {Array.} point + * @param {boolean} [clamp=false] + * @return {Array.} + */ + pointToData: function (point, clamp) { + var coord = this.pointToCoord(point); + return [ + this._radiusAxis.radiusToData(coord[0], clamp), + this._angleAxis.angleToData(coord[1], clamp) + ]; + }, - module.exports = { /** - * Layout list like component. - * It will box layout each items in group of component and then position the whole group in the viewport - * @param {module:zrender/group/Group} group - * @param {module:echarts/model/Component} componentModel - * @param {module:echarts/ExtensionAPI} + * Convert a (x, y) point to (radius, angle) coord + * @param {Array.} point + * @return {Array.} */ - layout: function (group, componentModel, api) { - var rect = layout.getLayoutRect(componentModel.getBoxLayoutParams(), { - width: api.getWidth(), - height: api.getHeight() - }, componentModel.get('padding')); - layout.box( - componentModel.get('orient'), - group, - componentModel.get('itemGap'), - rect.width, - rect.height - ); + pointToCoord: function (point) { + var dx = point[0] - this.cx; + var dy = point[1] - this.cy; + var angleAxis = this.getAngleAxis(); + var extent = angleAxis.getExtent(); + var minAngle = Math.min(extent[0], extent[1]); + var maxAngle = Math.max(extent[0], extent[1]); + // Fix fixed extent in polarCreator + // FIXME + angleAxis.inverse + ? (minAngle = maxAngle - 360) + : (maxAngle = minAngle + 360); - positionGroup(group, componentModel, api); - }, + var radius = Math.sqrt(dx * dx + dy * dy); + dx /= radius; + dy /= radius; - addBackground: function (group, componentModel) { - var padding = formatUtil.normalizeCssArray( - componentModel.get('padding') - ); - var boundingRect = group.getBoundingRect(); - var style = componentModel.getItemStyle(['color', 'opacity']); - style.fill = componentModel.get('backgroundColor'); - var rect = new graphic.Rect({ - shape: { - x: boundingRect.x - padding[3], - y: boundingRect.y - padding[0], - width: boundingRect.width + padding[1] + padding[3], - height: boundingRect.height + padding[0] + padding[2] - }, - style: style, - silent: true, - z2: -1 - }); - graphic.subPixelOptimizeRect(rect); + var radian = Math.atan2(-dy, dx) / Math.PI * 180; - group.add(rect); - } - }; + // move to angleExtent + var dir = radian < minAngle ? 1 : -1; + while (radian < minAngle || radian > maxAngle) { + radian += dir * 360; + } + return [radius, radian]; + }, -/***/ }, -/* 298 */ -/***/ function(module, exports) { + /** + * Convert a (radius, angle) coord to (x, y) point + * @param {Array.} coord + * @return {Array.} + */ + coordToPoint: function (coord) { + var radius = coord[0]; + var radian = coord[1] / 180 * Math.PI; + var x = Math.cos(radian) * radius + this.cx; + // Inverse the y + var y = -Math.sin(radian) * radius + this.cy; - - module.exports = function (ecModel) { - var legendModels = ecModel.findComponents({ - mainType: 'legend' - }); - if (legendModels && legendModels.length) { - ecModel.filterSeries(function (series) { - // If in any legend component the status is not selected. - // Because in legend series is assumed selected when it is not in the legend data. - for (var i = 0; i < legendModels.length; i++) { - if (!legendModels[i].isSelected(series.name)) { - return false; - } - } - return true; - }); + return [x, y]; } }; + module.exports = Polar; + /***/ }, -/* 299 */ +/* 322 */ /***/ function(module, exports, __webpack_require__) { - // FIXME Better way to pack data in graphic element - + 'use strict'; - __webpack_require__(300); - __webpack_require__(301); + var zrUtil = __webpack_require__(4); + var Axis = __webpack_require__(100); - // Show tip action - /** - * @action - * @property {string} type - * @property {number} seriesIndex - * @property {number} dataIndex - * @property {number} [x] - * @property {number} [y] - */ - __webpack_require__(1).registerAction( - { - type: 'showTip', - event: 'showTip', - update: 'tooltip:manuallyShowTip' - }, - // noop - function () {} - ); - // Hide tip action - __webpack_require__(1).registerAction( - { - type: 'hideTip', - event: 'hideTip', - update: 'tooltip:manuallyHideTip' - }, - // noop - function () {} - ); + function RadiusAxis(scale, radiusExtent) { + Axis.call(this, 'radius', scale, radiusExtent); -/***/ }, -/* 300 */ -/***/ function(module, exports, __webpack_require__) { + /** + * Axis type + * - 'category' + * - 'value' + * - 'time' + * - 'log' + * @type {string} + */ + this.type = 'category'; + } - + RadiusAxis.prototype = { - __webpack_require__(1).extendComponentModel({ + constructor: RadiusAxis, - type: 'tooltip', + /** + * @override + */ + pointToData: function (point, clamp) { + return this.polar.pointToData(point, clamp)[this.dim === 'radius' ? 0 : 1]; + }, - defaultOption: { - zlevel: 0, + dataToRadius: Axis.prototype.dataToCoord, - z: 8, + radiusToData: Axis.prototype.coordToData + }; - show: true, + zrUtil.inherits(RadiusAxis, Axis); - // tooltip主体内容 - showContent: true, + module.exports = RadiusAxis; - // 触发类型,默认数据触发,见下图,可选为:'item' ¦ 'axis' - trigger: 'item', - // 触发条件,支持 'click' | 'mousemove' | 'none' - triggerOn: 'mousemove', +/***/ }, +/* 323 */ +/***/ function(module, exports, __webpack_require__) { - // 是否永远显示 content - alwaysShowContent: false, + 'use strict'; - // 位置 {Array} | {Function} - // position: null - // 是否约束 content 在 viewRect 中。默认 false 是为了兼容以前版本。 - confine: false, + var zrUtil = __webpack_require__(4); + var Axis = __webpack_require__(100); - // 内容格式器:{string}(Template) ¦ {Function} - // formatter: null + function AngleAxis(scale, angleExtent) { - showDelay: 0, + angleExtent = angleExtent || [0, 360]; - // 隐藏延迟,单位ms - hideDelay: 100, + Axis.call(this, 'angle', scale, angleExtent); - // 动画变换时间,单位s - transitionDuration: 0.4, + /** + * Axis type + * - 'category' + * - 'value' + * - 'time' + * - 'log' + * @type {string} + */ + this.type = 'category'; + } - enterable: false, + AngleAxis.prototype = { - // 提示背景颜色,默认为透明度为0.7的黑色 - backgroundColor: 'rgba(50,50,50,0.7)', + constructor: AngleAxis, - // 提示边框颜色 - borderColor: '#333', + /** + * @override + */ + pointToData: function (point, clamp) { + return this.polar.pointToData(point, clamp)[this.dim === 'radius' ? 0 : 1]; + }, - // 提示边框圆角,单位px,默认为4 - borderRadius: 4, + dataToAngle: Axis.prototype.dataToCoord, - // 提示边框线宽,单位px,默认为0(无边框) - borderWidth: 0, + angleToData: Axis.prototype.coordToData + }; - // 提示内边距,单位px,默认各方向内边距为5, - // 接受数组分别设定上右下左边距,同css - padding: 5, + zrUtil.inherits(AngleAxis, Axis); - // Extra css text - extraCssText: '', + module.exports = AngleAxis; - // 坐标轴指示器,坐标轴触发有效 - axisPointer: { - // 默认为直线 - // 可选为:'line' | 'shadow' | 'cross' - type: 'line', - // type 为 line 的时候有效,指定 tooltip line 所在的轴,可选 - // 可选 'x' | 'y' | 'angle' | 'radius' | 'auto' - // 默认 'auto',会选择类型为 cateogry 的轴,对于双数值轴,笛卡尔坐标系会默认选择 x 轴 - // 极坐标系会默认选择 angle 轴 - axis: 'auto', +/***/ }, +/* 324 */ +/***/ function(module, exports, __webpack_require__) { - animation: true, - animationDurationUpdate: 200, - animationEasingUpdate: 'exponentialOut', + 'use strict'; - // 直线指示器样式设置 - lineStyle: { - color: '#555', - width: 1, - type: 'solid' - }, - crossStyle: { - color: '#555', - width: 1, - type: 'dashed', + __webpack_require__(325); - // TODO formatter - textStyle: {} - }, + __webpack_require__(1).extendComponentModel({ - // 阴影指示器样式设置 - shadowStyle: { - color: 'rgba(150,150,150,0.3)' - } - }, - textStyle: { - color: '#fff', - fontSize: 14 - } - } - }); + type: 'polar', + dependencies: ['polarAxis', 'angleAxis'], -/***/ }, -/* 301 */ -/***/ function(module, exports, __webpack_require__) { + /** + * @type {module:echarts/coord/polar/Polar} + */ + coordinateSystem: null, - + /** + * @param {string} axisType + * @return {module:echarts/coord/polar/AxisModel} + */ + findAxisModel: function (axisType) { + var foundAxisModel; + var ecModel = this.ecModel; - var TooltipContent = __webpack_require__(302); - var graphic = __webpack_require__(43); - var zrUtil = __webpack_require__(4); - var formatUtil = __webpack_require__(6); - var numberUtil = __webpack_require__(7); - var modelUtil = __webpack_require__(5); - var parsePercent = numberUtil.parsePercent; - var env = __webpack_require__(2); - var Model = __webpack_require__(12); + ecModel.eachComponent(axisType, function (axisModel) { + if (axisModel.getCoordSysModel() === this) { + foundAxisModel = axisModel; + } + }, this); + return foundAxisModel; + }, - function dataEqual(a, b) { - if (!a || !b) { - return false; - } - var round = numberUtil.round; - return round(a[0]) === round(b[0]) - && round(a[1]) === round(b[1]); - } - /** - * @inner - */ - function makeLineShape(x1, y1, x2, y2) { - return { - x1: x1, - y1: y1, - x2: x2, - y2: y2 - }; - } + defaultOption: { - /** - * @inner - */ - function makeRectShape(x, y, width, height) { - return { - x: x, - y: y, - width: width, - height: height - }; - } + zlevel: 0, - /** - * @inner - */ - function makeSectorShape(cx, cy, r0, r, startAngle, endAngle) { - return { - cx: cx, - cy: cy, - r0: r0, - r: r, - startAngle: startAngle, - endAngle: endAngle, - clockwise: true - }; - } + z: 0, - function refixTooltipPosition(x, y, el, viewWidth, viewHeight) { - var width = el.clientWidth; - var height = el.clientHeight; - var gap = 20; + center: ['50%', '50%'], - if (x + width + gap > viewWidth) { - x -= width + gap; - } - else { - x += gap; - } - if (y + height + gap > viewHeight) { - y -= height + gap; - } - else { - y += gap; + radius: '80%' } - return [x, y]; - } + }); - function confineTooltipPosition(x, y, el, viewWidth, viewHeight) { - var width = el.clientWidth; - var height = el.clientHeight; - x = Math.min(x + width, viewWidth) - width; - y = Math.min(y + height, viewHeight) - height; - x = Math.max(x, 0); - y = Math.max(y, 0); +/***/ }, +/* 325 */ +/***/ function(module, exports, __webpack_require__) { - return [x, y]; - } + 'use strict'; - function calcTooltipPosition(position, rect, dom) { - var domWidth = dom.clientWidth; - var domHeight = dom.clientHeight; - var gap = 5; - var x = 0; - var y = 0; - var rectWidth = rect.width; - var rectHeight = rect.height; - switch (position) { - case 'inside': - x = rect.x + rectWidth / 2 - domWidth / 2; - y = rect.y + rectHeight / 2 - domHeight / 2; - break; - case 'top': - x = rect.x + rectWidth / 2 - domWidth / 2; - y = rect.y - domHeight - gap; - break; - case 'bottom': - x = rect.x + rectWidth / 2 - domWidth / 2; - y = rect.y + rectHeight + gap; - break; - case 'left': - x = rect.x - domWidth - gap; - y = rect.y + rectHeight / 2 - domHeight / 2; - break; - case 'right': - x = rect.x + rectWidth + gap; - y = rect.y + rectHeight / 2 - domHeight / 2; - } - return [x, y]; - } - /** - * @param {string|Function|Array.} positionExpr - * @param {number} x Mouse x - * @param {number} y Mouse y - * @param {boolean} confine Whether confine tooltip content in view rect. - * @param {module:echarts/component/tooltip/TooltipContent} content - * @param {Object|} params - * @param {module:zrender/Element} el target element - * @param {module:echarts/ExtensionAPI} api - * @return {Array.} - */ - function updatePosition(positionExpr, x, y, confine, content, params, el, api) { - var viewWidth = api.getWidth(); - var viewHeight = api.getHeight(); + var zrUtil = __webpack_require__(4); + var ComponentModel = __webpack_require__(19); + var axisModelCreator = __webpack_require__(131); - var rect = el && el.getBoundingRect().clone(); - el && rect.applyTransform(el.transform); - if (typeof positionExpr === 'function') { - // Callback of position can be an array or a string specify the position - positionExpr = positionExpr([x, y], params, content.el, rect); - } + var PolarAxisModel = ComponentModel.extend({ - if (zrUtil.isArray(positionExpr)) { - x = parsePercent(positionExpr[0], viewWidth); - y = parsePercent(positionExpr[1], viewHeight); - } - // Specify tooltip position by string 'top' 'bottom' 'left' 'right' around graphic element - else if (typeof positionExpr === 'string' && el) { - var pos = calcTooltipPosition( - positionExpr, rect, content.el - ); - x = pos[0]; - y = pos[1]; - } - else { - var pos = refixTooltipPosition( - x, y, content.el, viewWidth, viewHeight - ); - x = pos[0]; - y = pos[1]; + type: 'polarAxis', + + /** + * @type {module:echarts/coord/polar/AngleAxis|module:echarts/coord/polar/RadiusAxis} + */ + axis: null, + + /** + * @override + */ + getCoordSysModel: function () { + return this.ecModel.queryComponents({ + mainType: 'polar', + index: this.option.polarIndex, + id: this.option.polarId + })[0]; } - if (confine) { - var pos = confineTooltipPosition( - x, y, content.el, viewWidth, viewHeight - ); - x = pos[0]; - y = pos[1]; - } + }); - content.moveTo(x, y); - } + zrUtil.merge(PolarAxisModel.prototype, __webpack_require__(111)); - function ifSeriesSupportAxisTrigger(seriesModel) { - var coordSys = seriesModel.coordinateSystem; - var trigger = seriesModel.get('tooltip.trigger', true); - // Ignore series use item tooltip trigger and series coordinate system is not cartesian or - return !(!coordSys - || (coordSys.type !== 'cartesian2d' && coordSys.type !== 'polar' && coordSys.type !== 'singleAxis') - || trigger === 'item'); - } + var polarAxisDefaultExtendedOption = { + angle: { + // polarIndex: 0, + // polarId: '', - __webpack_require__(1).extendComponentView({ + startAngle: 90, - type: 'tooltip', + clockwise: true, - _axisPointers: {}, + splitNumber: 12, - init: function (ecModel, api) { - if (env.node) { - return; + axisLabel: { + rotate: false } - var tooltipContent = new TooltipContent(api.getDom(), api); - this._tooltipContent = tooltipContent; }, + radius: { + // polarIndex: 0, + // polarId: '', - render: function (tooltipModel, ecModel, api) { - if (env.node) { - return; - } - - // Reset - this.group.removeAll(); + splitNumber: 5 + } + }; - /** - * @type {Object} - * @private - */ - this._axisPointers = {}; + function getAxisType(axisDim, option) { + // Default axis with data is category axis + return option.type || (option.data ? 'category' : 'value'); + } - /** - * @private - * @type {module:echarts/component/tooltip/TooltipModel} - */ - this._tooltipModel = tooltipModel; + axisModelCreator('angle', PolarAxisModel, getAxisType, polarAxisDefaultExtendedOption.angle); + axisModelCreator('radius', PolarAxisModel, getAxisType, polarAxisDefaultExtendedOption.radius); - /** - * @private - * @type {module:echarts/model/Global} - */ - this._ecModel = ecModel; - /** - * @private - * @type {module:echarts/ExtensionAPI} - */ - this._api = api; - /** - * @type {Object} - * @private - */ - this._lastHover = { - // data - // payloadBatch - }; +/***/ }, +/* 326 */ +/***/ function(module, exports, __webpack_require__) { - var tooltipContent = this._tooltipContent; - tooltipContent.update(); - tooltipContent.enterable = tooltipModel.get('enterable'); - this._alwaysShowContent = tooltipModel.get('alwaysShowContent'); + 'use strict'; - /** - * @type {Object.} - */ - this._seriesGroupByAxis = this._prepareAxisTriggerData( - tooltipModel, ecModel - ); - var crossText = this._crossText; - if (crossText) { - this.group.add(crossText); - } + __webpack_require__(320); - var triggerOn = tooltipModel.get('triggerOn'); + __webpack_require__(327); - // Try to keep the tooltip show when refreshing - if (this._lastX != null - && this._lastY != null - // When user is willing to control tooltip totally using API, - // self.manuallyShowTip({x, y}) might cause tooltip hide, - // which is not expected. - && triggerOn !== 'none' - ) { - var self = this; - clearTimeout(this._refreshUpdateTimeout); - this._refreshUpdateTimeout = setTimeout(function () { - // Show tip next tick after other charts are rendered - // In case highlight action has wrong result - // FIXME - self.manuallyShowTip(tooltipModel, ecModel, api, { - x: self._lastX, - y: self._lastY - }); - }); - } - var zr = this._api.getZr(); - zr.off('click', this._tryShow); - zr.off('mousemove', this._mousemove); - zr.off('mouseout', this._hide); - zr.off('globalout', this._hide); +/***/ }, +/* 327 */ +/***/ function(module, exports, __webpack_require__) { - if (triggerOn === 'click') { - zr.on('click', this._tryShow, this); - } - else if (triggerOn === 'mousemove') { - zr.on('mousemove', this._mousemove, this); - zr.on('mouseout', this._hide, this); - zr.on('globalout', this._hide, this); - } - // else triggerOn is 'none', which enable user - // to control tooltip totally using API. - }, + 'use strict'; - _mousemove: function (e) { - var showDelay = this._tooltipModel.get('showDelay'); - var self = this; - clearTimeout(this._showTimeout); - if (showDelay > 0) { - this._showTimeout = setTimeout(function () { - self._tryShow(e); - }, showDelay); - } - else { - this._tryShow(e); - } - }, - /** - * Show tip manually by - * dispatchAction({ - * type: 'showTip', - * x: 10, - * y: 10 - * }); - * Or - * dispatchAction({ - * type: 'showTip', - * seriesIndex: 0, - * dataIndex or dataIndexInside or name - * }); - * - * TODO Batch - */ - manuallyShowTip: function (tooltipModel, ecModel, api, payload) { - // From self - if (payload.from === this.uid) { - return; - } + var zrUtil = __webpack_require__(4); + var graphic = __webpack_require__(44); + var Model = __webpack_require__(12); + var PolarAxisPointer = __webpack_require__(328); - var ecModel = this._ecModel; - var seriesIndex = payload.seriesIndex; - var seriesModel = ecModel.getSeriesByIndex(seriesIndex); - var api = this._api; + var elementList = ['axisLine', 'axisLabel', 'axisTick', 'splitLine', 'splitArea']; - var isTriggerAxis = this._tooltipModel.get('trigger') === 'axis'; - function seriesHaveDataOnIndex(_series) { - var data = _series.getData(); - var dataIndex = modelUtil.queryDataIndex(data, payload); - // Have single dataIndex - if (dataIndex != null && !zrUtil.isArray(dataIndex) - && data.hasValue(dataIndex) - ) { - return true; - } - } + function getAxisLineShape(polar, r0, r, angle) { + var start = polar.coordToPoint([r0, angle]); + var end = polar.coordToPoint([r, angle]); - if (payload.x == null || payload.y == null) { - if (isTriggerAxis) { - // Find another series. - if (seriesModel && !seriesHaveDataOnIndex(seriesModel)) { - seriesModel = null; - } - if (!seriesModel) { - // Find the first series can use axis trigger And data is not null - ecModel.eachSeries(function (_series) { - if (ifSeriesSupportAxisTrigger(_series) && !seriesModel) { - if (seriesHaveDataOnIndex(_series)) { - seriesModel = _series; - } - } - }); - } - } - else { - // Use the first series by default. - seriesModel = seriesModel || ecModel.getSeriesByIndex(0); - } - if (seriesModel) { - var data = seriesModel.getData(); - var dataIndex = modelUtil.queryDataIndex(data, payload); + return { + x1: start[0], + y1: start[1], + x2: end[0], + y2: end[1] + }; + } - if (dataIndex == null || zrUtil.isArray(dataIndex)) { - return; - } + __webpack_require__(141).extend({ - var el = data.getItemGraphicEl(dataIndex); - var cx; - var cy; - // Try to get the point in coordinate system - var coordSys = seriesModel.coordinateSystem; - if (seriesModel.getTooltipPosition) { - var point = seriesModel.getTooltipPosition(dataIndex) || []; - cx = point[0]; - cy = point[1]; - } - else if (coordSys && coordSys.dataToPoint) { - var point = coordSys.dataToPoint( - data.getValues( - zrUtil.map(coordSys.dimensions, function (dim) { - return seriesModel.coordDimToDataDim(dim)[0]; - }), dataIndex, true - ) - ); - cx = point && point[0]; - cy = point && point[1]; - } - else if (el) { - // Use graphic bounding rect - var rect = el.getBoundingRect().clone(); - rect.applyTransform(el.transform); - cx = rect.x + rect.width / 2; - cy = rect.y + rect.height / 2; - } + type: 'angleAxis', - if (cx != null && cy != null) { - this._tryShow({ - offsetX: cx, - offsetY: cy, - position: payload.position, - target: el, - event: {} - }); - } - } - } - else { - var el = api.getZr().handler.findHover(payload.x, payload.y); - this._tryShow({ - offsetX: payload.x, - offsetY: payload.y, - position: payload.position, - target: el, - event: {} - }); - } - }, + axisPointerClass: PolarAxisPointer, - manuallyHideTip: function (tooltipModel, ecModel, api, payload) { - if (payload.from === this.uid) { + render: function (angleAxisModel, ecModel) { + this.group.removeAll(); + if (!angleAxisModel.get('show')) { return; } - this._hide(); - }, - - _prepareAxisTriggerData: function (tooltipModel, ecModel) { - // Prepare data for axis trigger - var seriesGroupByAxis = {}; - ecModel.eachSeries(function (seriesModel) { - if (ifSeriesSupportAxisTrigger(seriesModel)) { - var coordSys = seriesModel.coordinateSystem; - var baseAxis; - var key; + var angleAxis = angleAxisModel.axis; + var polar = angleAxis.polar; + var radiusExtent = polar.getRadiusAxis().getExtent(); + var ticksAngles = angleAxis.getTicksCoords(); - // Only cartesian2d, polar and single support axis trigger - if (coordSys.type === 'cartesian2d') { - // FIXME `axisPointer.axis` is not baseAxis - baseAxis = coordSys.getBaseAxis(); - key = baseAxis.dim + baseAxis.index; - } - else if (coordSys.type === 'singleAxis') { - baseAxis = coordSys.getAxis(); - key = baseAxis.dim + baseAxis.type; - } - else { - baseAxis = coordSys.getBaseAxis(); - key = baseAxis.dim + coordSys.name; - } + if (angleAxis.type !== 'category') { + // Remove the last tick which will overlap the first tick + ticksAngles.pop(); + } - seriesGroupByAxis[key] = seriesGroupByAxis[key] || { - coordSys: [], - series: [] - }; - seriesGroupByAxis[key].coordSys.push(coordSys); - seriesGroupByAxis[key].series.push(seriesModel); + zrUtil.each(elementList, function (name) { + if (angleAxisModel.get(name +'.show') + && (!angleAxis.scale.isBlank() || name === 'axisLine') + ) { + this['_' + name](angleAxisModel, polar, ticksAngles, radiusExtent); } }, this); - - return seriesGroupByAxis; }, /** - * mousemove handler - * @param {Object} e * @private */ - _tryShow: function (e) { - var el = e.target; - var tooltipModel = this._tooltipModel; - var globalTrigger = tooltipModel.get('trigger'); - var ecModel = this._ecModel; - var api = this._api; + _axisLine: function (angleAxisModel, polar, ticksAngles, radiusExtent) { + var lineStyleModel = angleAxisModel.getModel('axisLine.lineStyle'); - if (!tooltipModel) { - return; - } + var circle = new graphic.Circle({ + shape: { + cx: polar.cx, + cy: polar.cy, + r: radiusExtent[1] + }, + style: lineStyleModel.getLineStyle(), + z2: 1, + silent: true + }); + circle.style.fill = null; - // Save mouse x, mouse y. So we can try to keep showing the tip if chart is refreshed - this._lastX = e.offsetX; - this._lastY = e.offsetY; + this.group.add(circle); + }, - // Always show item tooltip if mouse is on the element with dataIndex - if (el && el.dataIndex != null) { - // Use dataModel in element if possible - // Used when mouseover on a element like markPoint or edge - // In which case, the data is not main data in series. - var dataModel = el.dataModel || ecModel.getSeriesByIndex(el.seriesIndex); - var dataIndex = el.dataIndex; - var data = dataModel.getData(); - var itemModel = data.getItemModel(dataIndex); - // Series or single data may use item trigger when global is axis trigger - if ((itemModel.get('tooltip.trigger') || globalTrigger) === 'axis') { - this._showAxisTooltip(tooltipModel, ecModel, e); - } - else { - // Reset ticket - this._ticket = ''; - // If either single data or series use item trigger - this._hideAxisPointer(); - // Reset last hover and dispatch downplay action - this._resetLastHover(); + /** + * @private + */ + _axisTick: function (angleAxisModel, polar, ticksAngles, radiusExtent) { + var tickModel = angleAxisModel.getModel('axisTick'); - this._showItemTooltipContent(dataModel, dataIndex, el.dataType, e); - } + var tickLen = (tickModel.get('inside') ? -1 : 1) * tickModel.get('length'); - api.dispatchAction({ - type: 'showTip', - from: this.uid, - dataIndexInside: dataIndex, - dataIndex: data.getRawIndex(dataIndex), // expose to user. - seriesIndex: el.seriesIndex + var lines = zrUtil.map(ticksAngles, function (tickAngle) { + return new graphic.Line({ + shape: getAxisLineShape(polar, radiusExtent[1], radiusExtent[1] + tickLen, tickAngle) }); - } - // Tooltip provided directly. Like legend - else if (el && el.tooltip) { - var tooltipOpt = el.tooltip; - if (typeof tooltipOpt === 'string') { - var content = tooltipOpt; - tooltipOpt = { - content: content, - // Fixed formatter - formatter: content - }; - } - var subTooltipModel = new Model(tooltipOpt, tooltipModel); - var defaultHtml = subTooltipModel.get('content'); - var asyncTicket = Math.random(); - this._showTooltipContent( - // TODO params - subTooltipModel, defaultHtml, subTooltipModel.get('formatterParams') || {}, - asyncTicket, e.offsetX, e.offsetY, e.position, el, api - ); - } - else { - if (globalTrigger === 'item') { - this._hide(); - } - else { - // Try show axis tooltip - this._showAxisTooltip(tooltipModel, ecModel, e); - } - - // Action of cross pointer - // other pointer types will trigger action in _dispatchAndShowSeriesTooltipContent method - if (tooltipModel.get('axisPointer.type') === 'cross') { - api.dispatchAction({ - type: 'showTip', - from: this.uid, - x: e.offsetX, - y: e.offsetY - }); + }); + this.group.add(graphic.mergePath( + lines, { + style: zrUtil.defaults( + tickModel.getModel('lineStyle').getLineStyle(), + { + stroke: angleAxisModel.get('axisLine.lineStyle.color') + } + ) } - } + )); }, /** - * Show tooltip on axis - * @param {module:echarts/component/tooltip/TooltipModel} tooltipModel - * @param {module:echarts/model/Global} ecModel - * @param {Object} e * @private */ - _showAxisTooltip: function (tooltipModel, ecModel, e) { - var axisPointerModel = tooltipModel.getModel('axisPointer'); - var axisPointerType = axisPointerModel.get('type'); - - if (axisPointerType === 'cross') { - var el = e.target; - if (el && el.dataIndex != null) { - var seriesModel = ecModel.getSeriesByIndex(el.seriesIndex); - var dataIndex = el.dataIndex; - this._showItemTooltipContent(seriesModel, dataIndex, el.dataType, e); - } - } - - this._showAxisPointer(); - var allNotShow = true; - zrUtil.each(this._seriesGroupByAxis, function (seriesCoordSysSameAxis) { - // Try show the axis pointer - var allCoordSys = seriesCoordSysSameAxis.coordSys; - var coordSys = allCoordSys[0]; + _axisLabel: function (angleAxisModel, polar, ticksAngles, radiusExtent) { + var axis = angleAxisModel.axis; - // If mouse position is not in the grid or polar - var point = [e.offsetX, e.offsetY]; + var categoryData = angleAxisModel.get('data'); - if (!coordSys.containPoint(point)) { - // Hide axis pointer - this._hideAxisPointer(coordSys.name); - return; - } + var labelModel = angleAxisModel.getModel('axisLabel'); + var axisTextStyleModel = labelModel.getModel('textStyle'); - allNotShow = false; - // Make sure point is discrete on cateogry axis - var dimensions = coordSys.dimensions; - var value = coordSys.pointToData(point, true); - point = coordSys.dataToPoint(value); + var labels = angleAxisModel.getFormattedLabels(); - var baseAxis = coordSys.getBaseAxis(); - var axisType = axisPointerModel.get('axis'); - if (axisType === 'auto') { - axisType = baseAxis.dim; - } + var labelMargin = labelModel.get('margin'); + var labelsAngles = axis.getLabelsCoords(); - if (baseAxis.isBlank() || zrUtil.eqNaN(point[0]) || zrUtil.eqNaN(point[1])) { - this._hideAxisPointer(coordSys.name); - return; - } + // Use length of ticksAngles because it may remove the last tick to avoid overlapping + for (var i = 0; i < ticksAngles.length; i++) { + var r = radiusExtent[1]; + var p = polar.coordToPoint([r + labelMargin, labelsAngles[i]]); + var cx = polar.cx; + var cy = polar.cy; - var contentNotChange = false; - var lastHover = this._lastHover; - if (axisPointerType === 'cross') { - // If hover data not changed - // Possible when two axes are all category - if (dataEqual(lastHover.data, value)) { - contentNotChange = true; - } - lastHover.data = value; - } - else { - var valIndex = zrUtil.indexOf(dimensions, axisType); + var labelTextAlign = Math.abs(p[0] - cx) / r < 0.3 + ? 'center' : (p[0] > cx ? 'left' : 'right'); + var labelTextBaseline = Math.abs(p[1] - cy) / r < 0.3 + ? 'middle' : (p[1] > cy ? 'top' : 'bottom'); - // If hover data not changed on the axis dimension - if (lastHover.data === value[valIndex]) { - contentNotChange = true; - } - lastHover.data = value[valIndex]; + var textStyleModel = axisTextStyleModel; + if (categoryData && categoryData[i] && categoryData[i].textStyle) { + textStyleModel = new Model( + categoryData[i].textStyle, axisTextStyleModel + ); } + this.group.add(new graphic.Text({ + style: { + x: p[0], + y: p[1], + fill: textStyleModel.getTextColor() || angleAxisModel.get('axisLine.lineStyle.color'), + text: labels[i], + textAlign: labelTextAlign, + textVerticalAlign: labelTextBaseline, + textFont: textStyleModel.getFont() + }, + silent: true + })); + } + }, - var enableAnimation = tooltipModel.get('animation'); + /** + * @private + */ + _splitLine: function (angleAxisModel, polar, ticksAngles, radiusExtent) { + var splitLineModel = angleAxisModel.getModel('splitLine'); + var lineStyleModel = splitLineModel.getModel('lineStyle'); + var lineColors = lineStyleModel.get('color'); + var lineCount = 0; - if (coordSys.type === 'cartesian2d' && !contentNotChange) { - this._showCartesianPointer( - axisPointerModel, coordSys, axisType, point, enableAnimation - ); - } - else if (coordSys.type === 'polar' && !contentNotChange) { - this._showPolarPointer( - axisPointerModel, coordSys, axisType, point, enableAnimation - ); - } - else if (coordSys.type === 'singleAxis' && !contentNotChange) { - this._showSinglePointer( - axisPointerModel, coordSys, axisType, point, enableAnimation - ); - } + lineColors = lineColors instanceof Array ? lineColors : [lineColors]; - if (axisPointerType !== 'cross') { - this._dispatchAndShowSeriesTooltipContent( - coordSys, seriesCoordSysSameAxis.series, point, value, contentNotChange, e.position - ); - } - }, this); + var splitLines = []; - if (!this._tooltipModel.get('show')) { - this._hideAxisPointer(); + for (var i = 0; i < ticksAngles.length; i++) { + var colorIndex = (lineCount++) % lineColors.length; + splitLines[colorIndex] = splitLines[colorIndex] || []; + splitLines[colorIndex].push(new graphic.Line({ + shape: getAxisLineShape(polar, radiusExtent[0], radiusExtent[1], ticksAngles[i]) + })); } - if (allNotShow) { - this._hide(); + // Simple optimization + // Batching the lines if color are the same + for (var i = 0; i < splitLines.length; i++) { + this.group.add(graphic.mergePath(splitLines[i], { + style: zrUtil.defaults({ + stroke: lineColors[i % lineColors.length] + }, lineStyleModel.getLineStyle()), + silent: true, + z: angleAxisModel.get('z') + })); } }, /** - * Show tooltip on axis of cartesian coordinate - * @param {module:echarts/model/Model} axisPointerModel - * @param {module:echarts/coord/cartesian/Cartesian2D} cartesians - * @param {string} axisType - * @param {Array.} point * @private */ - _showCartesianPointer: function (axisPointerModel, cartesian, axisType, point, enableAnimation) { - var self = this; - - var axisPointerType = axisPointerModel.get('type'); - var baseAxis = cartesian.getBaseAxis(); - var moveAnimation = enableAnimation - && axisPointerType !== 'cross' - && baseAxis.type === 'category' - && baseAxis.getBandWidth() > 20; + _splitArea: function (angleAxisModel, polar, ticksAngles, radiusExtent) { - if (axisPointerType === 'cross') { - moveGridLine('x', point, cartesian.getAxis('y').getGlobalExtent()); - moveGridLine('y', point, cartesian.getAxis('x').getGlobalExtent()); + var splitAreaModel = angleAxisModel.getModel('splitArea'); + var areaStyleModel = splitAreaModel.getModel('areaStyle'); + var areaColors = areaStyleModel.get('color'); + var lineCount = 0; - this._updateCrossText(cartesian, point, axisPointerModel); - } - else { - var otherAxis = cartesian.getAxis(axisType === 'x' ? 'y' : 'x'); - var otherExtent = otherAxis.getGlobalExtent(); + areaColors = areaColors instanceof Array ? areaColors : [areaColors]; - if (cartesian.type === 'cartesian2d') { - (axisPointerType === 'line' ? moveGridLine : moveGridShadow)( - axisType, point, otherExtent - ); - } - } + var splitAreas = []; - /** - * @inner - */ - function moveGridLine(axisType, point, otherExtent) { - var targetShape = axisType === 'x' - ? makeLineShape(point[0], otherExtent[0], point[0], otherExtent[1]) - : makeLineShape(otherExtent[0], point[1], otherExtent[1], point[1]); + var RADIAN = Math.PI / 180; + var prevAngle = -ticksAngles[0] * RADIAN; + var r0 = Math.min(radiusExtent[0], radiusExtent[1]); + var r1 = Math.max(radiusExtent[0], radiusExtent[1]); - var pointerEl = self._getPointerElement( - cartesian, axisPointerModel, axisType, targetShape - ); - graphic.subPixelOptimizeLine({ - shape: targetShape, - style: pointerEl.style - }); + var clockwise = angleAxisModel.get('clockwise'); - moveAnimation - ? graphic.updateProps(pointerEl, { - shape: targetShape - }, axisPointerModel) - : pointerEl.attr({ - shape: targetShape - }); + for (var i = 1; i < ticksAngles.length; i++) { + var colorIndex = (lineCount++) % areaColors.length; + splitAreas[colorIndex] = splitAreas[colorIndex] || []; + splitAreas[colorIndex].push(new graphic.Sector({ + shape: { + cx: polar.cx, + cy: polar.cy, + r0: r0, + r: r1, + startAngle: prevAngle, + endAngle: -ticksAngles[i] * RADIAN, + clockwise: clockwise + }, + silent: true + })); + prevAngle = -ticksAngles[i] * RADIAN; } - /** - * @inner - */ - function moveGridShadow(axisType, point, otherExtent) { - var axis = cartesian.getAxis(axisType); - var bandWidth = axis.getBandWidth(); - var span = otherExtent[1] - otherExtent[0]; - var targetShape = axisType === 'x' - ? makeRectShape(point[0] - bandWidth / 2, otherExtent[0], bandWidth, span) - : makeRectShape(otherExtent[0], point[1] - bandWidth / 2, span, bandWidth); - - var pointerEl = self._getPointerElement( - cartesian, axisPointerModel, axisType, targetShape - ); - moveAnimation - ? graphic.updateProps(pointerEl, { - shape: targetShape - }, axisPointerModel) - : pointerEl.attr({ - shape: targetShape - }); + // Simple optimization + // Batching the lines if color are the same + for (var i = 0; i < splitAreas.length; i++) { + this.group.add(graphic.mergePath(splitAreas[i], { + style: zrUtil.defaults({ + fill: areaColors[i % areaColors.length] + }, areaStyleModel.getAreaStyle()), + silent: true + })); } - }, + } + }); - _showSinglePointer: function (axisPointerModel, single, axisType, point, enableAnimation) { - var self = this; - var axisPointerType = axisPointerModel.get('type'); - var moveAnimation = - enableAnimation - && axisPointerType !== 'cross' - && single.getBaseAxis().type === 'category'; - var rect = single.getRect(); - var otherExtent = [rect.y, rect.y + rect.height]; - moveSingleLine(axisType, point, otherExtent); +/***/ }, +/* 328 */ +/***/ function(module, exports, __webpack_require__) { - /** - * @inner - */ - function moveSingleLine(axisType, point, otherExtent) { - var axis = single.getAxis(); - var orient = axis.orient; + 'use strict'; - var targetShape = orient === 'horizontal' - ? makeLineShape(point[0], otherExtent[0], point[0], otherExtent[1]) - : makeLineShape(otherExtent[0], point[1], otherExtent[1], point[1]); - var pointerEl = self._getPointerElement( - single, axisPointerModel, axisType, targetShape - ); - moveAnimation - ? graphic.updateProps(pointerEl, { - shape: targetShape - }, axisPointerModel) - : pointerEl.attr({ - shape: targetShape - }); - } + var formatUtil = __webpack_require__(6); + var BaseAxisPointer = __webpack_require__(137); + var graphic = __webpack_require__(44); + var viewHelper = __webpack_require__(139); + var matrix = __webpack_require__(11); + var AxisBuilder = __webpack_require__(135); - }, + var PolarAxisPointer = BaseAxisPointer.extend({ /** - * Show tooltip on axis of polar coordinate - * @param {module:echarts/model/Model} axisPointerModel - * @param {Array.} polar - * @param {string} axisType - * @param {Array.} point + * @override */ - _showPolarPointer: function (axisPointerModel, polar, axisType, point, enableAnimation) { - var self = this; + makeElOption: function (elOption, value, axisModel, axisPointerModel, api) { + var axis = axisModel.axis; - var axisPointerType = axisPointerModel.get('type'); + if (axis.dim === 'angle') { + this.animationThreshold = Math.PI / 18; + } - var angleAxis = polar.getAngleAxis(); - var radiusAxis = polar.getRadiusAxis(); + var polar = axis.polar; + var otherAxis = polar.getOtherAxis(axis); + var otherExtent = otherAxis.getExtent(); - var moveAnimation = enableAnimation - && axisPointerType !== 'cross' - && polar.getBaseAxis().type === 'category'; + var coordValue; + coordValue = axis['dataTo' + formatUtil.capitalFirst(axis.dim)](value); - if (axisPointerType === 'cross') { - movePolarLine('angle', point, radiusAxis.getExtent()); - movePolarLine('radius', point, angleAxis.getExtent()); + var elStyle = viewHelper.buildElStyle(axisPointerModel); + var pointerOption = pointerShapeBuilder[axisPointerModel.get('type')]( + axis, polar, coordValue, otherExtent, elStyle + ); + pointerOption.style = elStyle; - this._updateCrossText(polar, point, axisPointerModel); - } - else { - var otherAxis = polar.getAxis(axisType === 'radius' ? 'angle' : 'radius'); - var otherExtent = otherAxis.getExtent(); + elOption.graphicKey = pointerOption.type; + elOption.pointer = pointerOption; - (axisPointerType === 'line' ? movePolarLine : movePolarShadow)( - axisType, point, otherExtent - ); - } - /** - * @inner - */ - function movePolarLine(axisType, point, otherExtent) { - var mouseCoord = polar.pointToCoord(point); + var labelMargin = axisPointerModel.get('label.margin'); + var labelPos = getLabelPosition(value, axisModel, axisPointerModel, polar, labelMargin); + viewHelper.buildLabelElOption(elOption, axisModel, axisPointerModel, api, labelPos); + } - var targetShape; + // Do not support handle, utill any user requires it. - if (axisType === 'angle') { - var p1 = polar.coordToPoint([otherExtent[0], mouseCoord[1]]); - var p2 = polar.coordToPoint([otherExtent[1], mouseCoord[1]]); - targetShape = makeLineShape(p1[0], p1[1], p2[0], p2[1]); - } - else { - targetShape = { - cx: polar.cx, - cy: polar.cy, - r: mouseCoord[0] - }; - } + }); - var pointerEl = self._getPointerElement( - polar, axisPointerModel, axisType, targetShape - ); + function getLabelPosition(value, axisModel, axisPointerModel, polar, labelMargin) { + var axis = axisModel.axis; + var coord = axis.dataToCoord(value); + var axisAngle = polar.getAngleAxis().getExtent()[0]; + axisAngle = axisAngle / 180 * Math.PI; + var radiusExtent = polar.getRadiusAxis().getExtent(); + var position; + var align; + var verticalAlign; - moveAnimation - ? graphic.updateProps(pointerEl, { - shape: targetShape - }, axisPointerModel) - : pointerEl.attr({ - shape: targetShape - }); - } + if (axis.dim === 'radius') { + var transform = matrix.create(); + matrix.rotate(transform, transform, axisAngle); + matrix.translate(transform, transform, [polar.cx, polar.cy]); + position = graphic.applyTransform([coord, -labelMargin], transform); + + var labelRotation = axisModel.getModel('axisLabel').get('rotate') || 0; + var labelLayout = AxisBuilder.innerTextLayout( + axisAngle, labelRotation * Math.PI / 180, -1 + ); + align = labelLayout.textAlign; + verticalAlign = labelLayout.textVerticalAlign; + } + else { // angle axis + var r = radiusExtent[1]; + position = polar.coordToPoint([r + labelMargin, coord]); + var cx = polar.cx; + var cy = polar.cy; + align = Math.abs(position[0] - cx) / r < 0.3 + ? 'center' : (position[0] > cx ? 'left' : 'right'); + verticalAlign = Math.abs(position[1] - cy) / r < 0.3 + ? 'middle' : (position[1] > cy ? 'top' : 'bottom'); + } + + return { + position: position, + align: align, + verticalAlign: verticalAlign + }; + } - /** - * @inner - */ - function movePolarShadow(axisType, point, otherExtent) { - var axis = polar.getAxis(axisType); - var bandWidth = axis.getBandWidth(); - var mouseCoord = polar.pointToCoord(point); + var pointerShapeBuilder = { - var targetShape; + line: function (axis, polar, coordValue, otherExtent, elStyle) { + return axis.dim === 'angle' + ? { + type: 'Line', + shape: viewHelper.makeLineShape( + polar.coordToPoint([otherExtent[0], coordValue]), + polar.coordToPoint([otherExtent[1], coordValue]) + ) + } + : { + type: 'Circle', + shape: { + cx: polar.cx, + cy: polar.cy, + r: coordValue + } + }; + }, - var radian = Math.PI / 180; + shadow: function (axis, polar, coordValue, otherExtent, elStyle) { + var bandWidth = axis.getBandWidth(); + var radian = Math.PI / 180; - if (axisType === 'angle') { - targetShape = makeSectorShape( + return axis.dim === 'angle' + ? { + type: 'Sector', + shape: viewHelper.makeSectorShape( polar.cx, polar.cy, otherExtent[0], otherExtent[1], // In ECharts y is negative if angle is positive - (-mouseCoord[1] - bandWidth / 2) * radian, - (-mouseCoord[1] + bandWidth / 2) * radian - ); + (-coordValue - bandWidth / 2) * radian, + (-coordValue + bandWidth / 2) * radian + ) } - else { - targetShape = makeSectorShape( + : { + type: 'Sector', + shape: viewHelper.makeSectorShape( polar.cx, polar.cy, - mouseCoord[0] - bandWidth / 2, - mouseCoord[0] + bandWidth / 2, + coordValue - bandWidth / 2, + coordValue + bandWidth / 2, 0, Math.PI * 2 - ); - } - - var pointerEl = self._getPointerElement( - polar, axisPointerModel, axisType, targetShape - ); - moveAnimation - ? graphic.updateProps(pointerEl, { - shape: targetShape - }, axisPointerModel) - : pointerEl.attr({ - shape: targetShape - }); - } - }, + ) + }; + } + }; - _updateCrossText: function (coordSys, point, axisPointerModel) { - var crossStyleModel = axisPointerModel.getModel('crossStyle'); - var textStyleModel = crossStyleModel.getModel('textStyle'); + module.exports = PolarAxisPointer; - var tooltipModel = this._tooltipModel; - var text = this._crossText; - if (!text) { - text = this._crossText = new graphic.Text({ - style: { - textAlign: 'left', - textVerticalAlign: 'bottom' - } - }); - this.group.add(text); - } +/***/ }, +/* 329 */ +/***/ function(module, exports, __webpack_require__) { - var value = coordSys.pointToData(point); + - var dims = coordSys.dimensions; - value = zrUtil.map(value, function (val, idx) { - var axis = coordSys.getAxis(dims[idx]); - if (axis.type === 'category' || axis.type === 'time') { - val = axis.scale.getLabel(val); - } - else { - val = formatUtil.addCommas( - val.toFixed(axis.getPixelPrecision()) - ); - } - return val; - }); + __webpack_require__(320); - text.setStyle({ - fill: textStyleModel.getTextColor() || crossStyleModel.get('color'), - textFont: textStyleModel.getFont(), - text: value.join(', '), - x: point[0] + 5, - y: point[1] - 5 - }); - text.z = tooltipModel.get('z'); - text.zlevel = tooltipModel.get('zlevel'); - }, + __webpack_require__(330); - _getPointerElement: function (coordSys, pointerModel, axisType, initShape) { - var tooltipModel = this._tooltipModel; - var z = tooltipModel.get('z'); - var zlevel = tooltipModel.get('zlevel'); - var axisPointers = this._axisPointers; - var coordSysName = coordSys.name; - axisPointers[coordSysName] = axisPointers[coordSysName] || {}; - if (axisPointers[coordSysName][axisType]) { - return axisPointers[coordSysName][axisType]; - } - // Create if not exists - var pointerType = pointerModel.get('type'); - var styleModel = pointerModel.getModel(pointerType + 'Style'); - var isShadow = pointerType === 'shadow'; - var style = styleModel[isShadow ? 'getAreaStyle' : 'getLineStyle'](); +/***/ }, +/* 330 */ +/***/ function(module, exports, __webpack_require__) { - var elementType = coordSys.type === 'polar' - ? (isShadow ? 'Sector' : (axisType === 'radius' ? 'Circle' : 'Line')) - : (isShadow ? 'Rect' : 'Line'); + 'use strict'; - isShadow ? (style.stroke = null) : (style.fill = null); - var el = axisPointers[coordSysName][axisType] = new graphic[elementType]({ - style: style, - z: z, - zlevel: zlevel, - silent: true, - shape: initShape - }); + var zrUtil = __webpack_require__(4); + var graphic = __webpack_require__(44); + var AxisBuilder = __webpack_require__(135); + var PolarAxisPointer = __webpack_require__(328); - this.group.add(el); - return el; - }, + var axisBuilderAttrs = [ + 'axisLine', 'axisLabel', 'axisTick', 'axisName' + ]; + var selfBuilderAttrs = [ + 'splitLine', 'splitArea' + ]; - /** - * Dispatch actions and show tooltip on series - * @param {Array.} seriesList - * @param {Array.} point - * @param {Array.} value - * @param {boolean} contentNotChange - * @param {Array.|string|Function} [positionExpr] - */ - _dispatchAndShowSeriesTooltipContent: function ( - coordSys, seriesList, point, value, contentNotChange, positionExpr - ) { + __webpack_require__(141).extend({ - var rootTooltipModel = this._tooltipModel; + type: 'radiusAxis', - var baseAxis = coordSys.getBaseAxis(); - var baseDimIndex = ({x: 1, radius: 1, single: 1})[baseAxis.dim] ? 0 : 1; + axisPointerClass: PolarAxisPointer, - if (!seriesList.length) { + render: function (radiusAxisModel, ecModel) { + this.group.removeAll(); + if (!radiusAxisModel.get('show')) { return; } + var radiusAxis = radiusAxisModel.axis; + var polar = radiusAxis.polar; + var angleAxis = polar.getAngleAxis(); + var ticksCoords = radiusAxis.getTicksCoords(); + var axisAngle = angleAxis.getExtent()[0]; + var radiusExtent = radiusAxis.getExtent(); - var payloadBatch = zrUtil.map(seriesList, function (series) { - return { - seriesIndex: series.seriesIndex, - dataIndexInside: series.getAxisTooltipDataIndex - ? series.getAxisTooltipDataIndex(series.coordDimToDataDim(baseAxis.dim), value, baseAxis) - : series.getData().indexOfNearest( - series.coordDimToDataDim(baseAxis.dim)[0], - value[baseDimIndex], - // Add a threshold to avoid find the wrong dataIndex when data length is not same - false, baseAxis.type === 'category' ? 0.5 : null - ) - }; - }); - var sampleSeriesIndex; - zrUtil.each(payloadBatch, function (payload, idx) { - if (seriesList[idx].getData().hasValue(payload.dataIndexInside)) { - sampleSeriesIndex = idx; - } - }); - // Fallback to 0. - sampleSeriesIndex = sampleSeriesIndex || 0; + var layout = layoutAxis(polar, radiusAxisModel, axisAngle); + var axisBuilder = new AxisBuilder(radiusAxisModel, layout); + zrUtil.each(axisBuilderAttrs, axisBuilder.add, axisBuilder); + this.group.add(axisBuilder.getGroup()); - var lastHover = this._lastHover; - var api = this._api; - // Dispatch downplay action - if (lastHover.payloadBatch && !contentNotChange) { - api.dispatchAction({ - type: 'downplay', - batch: lastHover.payloadBatch - }); - } - // Dispatch highlight action - if (!contentNotChange) { - api.dispatchAction({ - type: 'highlight', - batch: payloadBatch - }); - lastHover.payloadBatch = payloadBatch; - } - // Dispatch showTip action - var dataIndex = payloadBatch[sampleSeriesIndex].dataIndexInside; - api.dispatchAction({ - type: 'showTip', - dataIndexInside: dataIndex, - // expose to user. - dataIndex: seriesList[sampleSeriesIndex].getData().getRawIndex(dataIndex), - seriesIndex: payloadBatch[sampleSeriesIndex].seriesIndex, - from: this.uid - }); + zrUtil.each(selfBuilderAttrs, function (name) { + if (radiusAxisModel.get(name +'.show') && !radiusAxis.scale.isBlank()) { + this['_' + name](radiusAxisModel, polar, axisAngle, radiusExtent, ticksCoords); + } + }, this); + }, - if (baseAxis && rootTooltipModel.get('showContent') && rootTooltipModel.get('show')) { - var paramsList = zrUtil.map(seriesList, function (series, index) { - return series.getDataParams(payloadBatch[index].dataIndexInside); - }); + /** + * @private + */ + _splitLine: function (radiusAxisModel, polar, axisAngle, radiusExtent, ticksCoords) { + var splitLineModel = radiusAxisModel.getModel('splitLine'); + var lineStyleModel = splitLineModel.getModel('lineStyle'); + var lineColors = lineStyleModel.get('color'); + var lineCount = 0; - if (!contentNotChange) { - // Update html content - var firstDataIndex = payloadBatch[sampleSeriesIndex].dataIndexInside; + lineColors = lineColors instanceof Array ? lineColors : [lineColors]; - // Default tooltip content - // FIXME - // (1) shold be the first data which has name? - // (2) themeRiver, firstDataIndex is array, and first line is unnecessary. - var firstLine = baseAxis.type === 'time' - ? baseAxis.scale.getLabel(value[baseDimIndex]) - : seriesList[sampleSeriesIndex].getData().getName(firstDataIndex); - var defaultHtml = (firstLine ? formatUtil.encodeHTML(firstLine) + '
' : '') - + zrUtil.map(seriesList, function (series, index) { - return series.formatTooltip(payloadBatch[index].dataIndexInside, true); - }).join('
'); + var splitLines = []; - var asyncTicket = 'axis_' + coordSys.name + '_' + firstDataIndex; + for (var i = 0; i < ticksCoords.length; i++) { + var colorIndex = (lineCount++) % lineColors.length; + splitLines[colorIndex] = splitLines[colorIndex] || []; + splitLines[colorIndex].push(new graphic.Circle({ + shape: { + cx: polar.cx, + cy: polar.cy, + r: ticksCoords[i] + }, + silent: true + })); + } - this._showTooltipContent( - rootTooltipModel, defaultHtml, paramsList, asyncTicket, - point[0], point[1], positionExpr, null, api - ); - } - else { - updatePosition( - positionExpr || rootTooltipModel.get('position'), - point[0], point[1], - rootTooltipModel.get('confine'), - this._tooltipContent, paramsList, null, api - ); - } + // Simple optimization + // Batching the lines if color are the same + for (var i = 0; i < splitLines.length; i++) { + this.group.add(graphic.mergePath(splitLines[i], { + style: zrUtil.defaults({ + stroke: lineColors[i % lineColors.length], + fill: null + }, lineStyleModel.getLineStyle()), + silent: true + })); } }, /** - * Show tooltip on item - * @param {module:echarts/model/Series} seriesModel - * @param {number} dataIndex - * @param {string} dataType - * @param {Object} e + * @private */ - _showItemTooltipContent: function (seriesModel, dataIndex, dataType, e) { - // FIXME Graph data - var api = this._api; - var data = seriesModel.getData(dataType); - var itemModel = data.getItemModel(dataIndex); + _splitArea: function (radiusAxisModel, polar, axisAngle, radiusExtent, ticksCoords) { - var tooltipOpt = itemModel.get('tooltip', true); - if (typeof tooltipOpt === 'string') { - // In each data item tooltip can be simply write: - // { - // value: 10, - // tooltip: 'Something you need to know' - // } - var tooltipContent = tooltipOpt; - tooltipOpt = { - formatter: tooltipContent - }; - } - var rootTooltipModel = this._tooltipModel; - var seriesTooltipModel = seriesModel.getModel( - 'tooltip', rootTooltipModel - ); - var tooltipModel = new Model(tooltipOpt, seriesTooltipModel, seriesTooltipModel.ecModel); + var splitAreaModel = radiusAxisModel.getModel('splitArea'); + var areaStyleModel = splitAreaModel.getModel('areaStyle'); + var areaColors = areaStyleModel.get('color'); + var lineCount = 0; - var params = seriesModel.getDataParams(dataIndex, dataType); - var defaultHtml = seriesModel.formatTooltip(dataIndex, false, dataType); + areaColors = areaColors instanceof Array ? areaColors : [areaColors]; - var asyncTicket = 'item_' + seriesModel.name + '_' + dataIndex; + var splitAreas = []; - this._showTooltipContent( - tooltipModel, defaultHtml, params, asyncTicket, - e.offsetX, e.offsetY, e.position, e.target, api - ); - }, + var prevRadius = ticksCoords[0]; + for (var i = 1; i < ticksCoords.length; i++) { + var colorIndex = (lineCount++) % areaColors.length; + splitAreas[colorIndex] = splitAreas[colorIndex] || []; + splitAreas[colorIndex].push(new graphic.Sector({ + shape: { + cx: polar.cx, + cy: polar.cy, + r0: prevRadius, + r: ticksCoords[i], + startAngle: 0, + endAngle: Math.PI * 2 + }, + silent: true + })); + prevRadius = ticksCoords[i]; + } - _showTooltipContent: function ( - tooltipModel, defaultHtml, params, asyncTicket, x, y, positionExpr, target, api - ) { - // Reset ticket - this._ticket = ''; + // Simple optimization + // Batching the lines if color are the same + for (var i = 0; i < splitAreas.length; i++) { + this.group.add(graphic.mergePath(splitAreas[i], { + style: zrUtil.defaults({ + fill: areaColors[i % areaColors.length] + }, areaStyleModel.getAreaStyle()), + silent: true + })); + } + } + }); - if (tooltipModel.get('showContent') && tooltipModel.get('show')) { - var tooltipContent = this._tooltipContent; - var confine = tooltipModel.get('confine'); + /** + * @inner + */ + function layoutAxis(polar, radiusAxisModel, axisAngle) { + return { + position: [polar.cx, polar.cy], + rotation: axisAngle / 180 * Math.PI, + labelDirection: -1, + tickDirection: -1, + nameDirection: 1, + labelRotate: radiusAxisModel.getModel('axisLabel').get('rotate'), + // Over splitLine and splitArea + z2: 1 + }; + } - var formatter = tooltipModel.get('formatter'); - positionExpr = positionExpr || tooltipModel.get('position'); - var html = defaultHtml; - if (formatter) { - if (typeof formatter === 'string') { - html = formatUtil.formatTpl(formatter, params, true); - } - else if (typeof formatter === 'function') { - var self = this; - var ticket = asyncTicket; - var callback = function (cbTicket, html) { - if (cbTicket === self._ticket) { - tooltipContent.setContent(html); - - updatePosition( - positionExpr, x, y, confine, - tooltipContent, params, target, api - ); - } - }; - self._ticket = ticket; - html = formatter(params, ticket, callback); - } - } +/***/ }, +/* 331 */ +/***/ function(module, exports, __webpack_require__) { - tooltipContent.show(tooltipModel); - tooltipContent.setContent(html); + - updatePosition( - positionExpr, x, y, confine, - tooltipContent, params, target, api - ); - } - }, + __webpack_require__(332); - /** - * Show axis pointer - * @param {string} [coordSysName] - */ - _showAxisPointer: function (coordSysName) { - if (coordSysName) { - var axisPointers = this._axisPointers[coordSysName]; - axisPointers && zrUtil.each(axisPointers, function (el) { - el.show(); - }); - } - else { - this.group.eachChild(function (child) { - child.show(); - }); - this.group.show(); - } - }, + __webpack_require__(180); - _resetLastHover: function () { - var lastHover = this._lastHover; - if (lastHover.payloadBatch) { - this._api.dispatchAction({ - type: 'downplay', - batch: lastHover.payloadBatch - }); - } - // Reset lastHover - this._lastHover = {}; - }, - /** - * Hide axis pointer - * @param {string} [coordSysName] - */ - _hideAxisPointer: function (coordSysName) { - if (coordSysName) { - var axisPointers = this._axisPointers[coordSysName]; - axisPointers && zrUtil.each(axisPointers, function (el) { - el.hide(); - }); - } - else { - if (this.group.children().length) { - this.group.hide(); - } - } - }, + __webpack_require__(333); - _hide: function () { - clearTimeout(this._showTimeout); + __webpack_require__(193); - this._hideAxisPointer(); - this._resetLastHover(); - if (!this._alwaysShowContent) { - this._tooltipContent.hideLater(this._tooltipModel.get('hideDelay')); - } + var echarts = __webpack_require__(1); + var zrUtil = __webpack_require__(4); - this._api.dispatchAction({ - type: 'hideTip', - from: this.uid - }); + function makeAction(method, actionInfo) { + actionInfo.update = 'updateView'; + echarts.registerAction(actionInfo, function (payload, ecModel) { + var selected = {}; - this._lastX = this._lastY = null; - }, + ecModel.eachComponent( + { mainType: 'geo', query: payload}, + function (geoModel) { + geoModel[method](payload.name); + var geo = geoModel.coordinateSystem; + zrUtil.each(geo.regions, function (region) { + selected[region.name] = geoModel.isSelected(region.name) || false; + }); + } + ); - dispose: function (ecModel, api) { - if (env.node) { - return; - } - var zr = api.getZr(); - this._tooltipContent.hide(); + return { + selected: selected, + name: payload.name + }; + }); + } - zr.off('click', this._tryShow); - zr.off('mousemove', this._mousemove); - zr.off('mouseout', this._hide); - zr.off('globalout', this._hide); - } + makeAction('toggleSelected', { + type: 'geoToggleSelect', + event: 'geoselectchanged' + }); + makeAction('select', { + type: 'geoSelect', + event: 'geoselected' + }); + makeAction('unSelect', { + type: 'geoUnSelect', + event: 'geounselected' }); /***/ }, -/* 302 */ +/* 332 */ /***/ function(module, exports, __webpack_require__) { - /** - * @module echarts/component/tooltip/TooltipContent - */ - + 'use strict'; + var modelUtil = __webpack_require__(5); + var ComponentModel = __webpack_require__(19); + var Model = __webpack_require__(12); var zrUtil = __webpack_require__(4); - var zrColor = __webpack_require__(39); - var eventUtil = __webpack_require__(88); - var formatUtil = __webpack_require__(6); - var each = zrUtil.each; - var toCamelCase = formatUtil.toCamelCase; - var env = __webpack_require__(2); - var vendors = ['', '-webkit-', '-moz-', '-o-']; + var selectableMixin = __webpack_require__(157); - var gCssText = 'position:absolute;display:block;border-style:solid;white-space:nowrap;z-index:9999999;'; + var geoCreator = __webpack_require__(180); - /** - * @param {number} duration - * @return {string} - * @inner - */ - function assembleTransition(duration) { - var transitionCurve = 'cubic-bezier(0.23, 1, 0.32, 1)'; - var transitionText = 'left ' + duration + 's ' + transitionCurve + ',' - + 'top ' + duration + 's ' + transitionCurve; - return zrUtil.map(vendors, function (vendorPrefix) { - return vendorPrefix + 'transition:' + transitionText; - }).join(';'); - } + var GeoModel = ComponentModel.extend({ - /** - * @param {Object} textStyle - * @return {string} - * @inner - */ - function assembleFont(textStyleModel) { - var cssText = []; + type: 'geo', - var fontSize = textStyleModel.get('fontSize'); - var color = textStyleModel.getTextColor(); + /** + * @type {module:echarts/coord/geo/Geo} + */ + coordinateSystem: null, - color && cssText.push('color:' + color); + layoutMode: 'box', - cssText.push('font:' + textStyleModel.getFont()); + init: function (option) { + ComponentModel.prototype.init.apply(this, arguments); - fontSize && - cssText.push('line-height:' + Math.round(fontSize * 3 / 2) + 'px'); + // Default label emphasis `position` and `show` + modelUtil.defaultEmphasis( + option.label, ['position', 'show', 'textStyle', 'distance', 'formatter'] + ); + }, - each(['decoration', 'align'], function (name) { - var val = textStyleModel.get(name); - val && cssText.push('text-' + name + ':' + val); - }); + optionUpdated: function () { + var option = this.option; + var self = this; - return cssText.join(';'); - } + option.regions = geoCreator.getFilledRegions(option.regions, option.map); - /** - * @param {Object} tooltipModel - * @return {string} - * @inner - */ - function assembleCssText(tooltipModel) { + this._optionModelMap = zrUtil.reduce(option.regions || [], function (obj, regionOpt) { + if (regionOpt.name) { + obj[regionOpt.name] = new Model(regionOpt, self); + } + return obj; + }, {}); - tooltipModel = tooltipModel; + this.updateSelectedMap(option.regions); + }, - var cssText = []; + defaultOption: { - var transitionDuration = tooltipModel.get('transitionDuration'); - var backgroundColor = tooltipModel.get('backgroundColor'); - var textStyleModel = tooltipModel.getModel('textStyle'); - var padding = tooltipModel.get('padding'); + zlevel: 0, - // Animation transition - transitionDuration && - cssText.push(assembleTransition(transitionDuration)); + z: 0, - if (backgroundColor) { - if (env.canvasSupported) { - cssText.push('background-Color:' + backgroundColor); - } - else { - // for ie - cssText.push( - 'background-Color:#' + zrColor.toHex(backgroundColor) - ); - cssText.push('filter:alpha(opacity=70)'); - } - } + show: true, - // Border style - each(['width', 'color', 'radius'], function (name) { - var borderName = 'border-' + name; - var camelCase = toCamelCase(borderName); - var val = tooltipModel.get(camelCase); - val != null && - cssText.push(borderName + ':' + val + (name === 'color' ? '' : 'px')); - }); + left: 'center', - // Text style - cssText.push(assembleFont(textStyleModel)); + top: 'center', - // Padding - if (padding != null) { - cssText.push('padding:' + formatUtil.normalizeCssArray(padding).join('px ') + 'px'); - } - return cssText.join(';') + ';'; - } + // width:, + // height:, + // right + // bottom - /** - * @alias module:echarts/component/tooltip/TooltipContent - * @constructor - */ - function TooltipContent(container, api) { - var el = document.createElement('div'); - var zr = api.getZr(); + // Aspect is width / height. Inited to be geoJson bbox aspect + // This parameter is used for scale this aspect + aspectScale: 0.75, - this.el = el; + ///// Layout with center and size + // If you wan't to put map in a fixed size box with right aspect ratio + // This two properties may more conveninet + // layoutCenter: [50%, 50%] + // layoutSize: 100 - this._x = api.getWidth() / 2; - this._y = api.getHeight() / 2; - container.appendChild(el); + silent: false, - this._container = container; + // Map type + map: '', - this._show = false; + // Define left-top, right-bottom coords to control view + // For example, [ [180, 90], [-180, -90] ] + boundingCoords: null, + + // Default on center of map + center: null, + + zoom: 1, + + scaleLimit: null, + + // selectedMode: false + + label: { + normal: { + show: false, + textStyle: { + color: '#000' + } + }, + emphasis: { + show: true, + textStyle: { + color: 'rgb(100,0,0)' + } + } + }, + + itemStyle: { + normal: { + // color: 各异, + borderWidth: 0.5, + borderColor: '#444', + color: '#eee' + }, + emphasis: { // 也是选中样式 + color: 'rgba(255,215,0,0.8)' + } + }, + + regions: [] + }, /** - * @private + * Get model of region + * @param {string} name + * @return {module:echarts/model/Model} */ - this._hideTimeout; + getRegionModel: function (name) { + return this._optionModelMap[name] || new Model(null, this, this.ecModel); + }, - var self = this; - el.onmouseenter = function () { - // clear the timeout in hideLater and keep showing tooltip - if (self.enterable) { - clearTimeout(self._hideTimeout); - self._show = true; - } - self._inContent = true; - }; - el.onmousemove = function (e) { - e = e || window.event; - if (!self.enterable) { - // Try trigger zrender event to avoid mouse - // in and out shape too frequently - var handler = zr.handler; - eventUtil.normalizeEvent(container, e, true); - handler.dispatch('mousemove', e); - } - }; - el.onmouseleave = function () { - if (self.enterable) { - if (self._show) { - self.hideLater(self._hideDelay); - } + /** + * Format label + * @param {string} name Region name + * @param {string} [status='normal'] 'normal' or 'emphasis' + * @return {string} + */ + getFormattedLabel: function (name, status) { + var regionModel = this.getRegionModel(name); + var formatter = regionModel.get('label.' + status + '.formatter'); + var params = { + name: name + }; + if (typeof formatter === 'function') { + params.status = status; + return formatter(params); } - self._inContent = false; - }; - } + else if (typeof formatter === 'string') { + var serName = params.seriesName; + return formatter.replace('{a}', serName != null ? serName : ''); + } + }, - TooltipContent.prototype = { + setZoom: function (zoom) { + this.option.zoom = zoom; + }, - constructor: TooltipContent, + setCenter: function (center) { + this.option.center = center; + } + }); - enterable: true, + zrUtil.mixin(GeoModel, selectableMixin); - /** - * Update when tooltip is rendered - */ - update: function () { - var container = this._container; - var stl = container.currentStyle - || document.defaultView.getComputedStyle(container); - var domStyle = container.style; - if (domStyle.position !== 'absolute' && stl.position !== 'absolute') { - domStyle.position = 'relative'; - } - // Hide the tooltip - // PENDING - // this.hide(); - }, + module.exports = GeoModel; - show: function (tooltipModel) { - clearTimeout(this._hideTimeout); - var el = this.el; - el.style.cssText = gCssText + assembleCssText(tooltipModel) - // http://stackoverflow.com/questions/21125587/css3-transition-not-working-in-chrome-anymore - + ';left:' + this._x + 'px;top:' + this._y + 'px;' - + (tooltipModel.get('extraCssText') || ''); +/***/ }, +/* 333 */ +/***/ function(module, exports, __webpack_require__) { - el.style.display = el.innerHTML ? 'block' : 'none'; + 'use strict'; - this._show = true; - }, - setContent: function (content) { - var el = this.el; - el.innerHTML = content; - el.style.display = content ? 'block' : 'none'; - }, + var MapDraw = __webpack_require__(190); - moveTo: function (x, y) { - var style = this.el.style; - style.left = x + 'px'; - style.top = y + 'px'; + module.exports = __webpack_require__(1).extendComponentView({ - this._x = x; - this._y = y; - }, + type: 'geo', - hide: function () { - this.el.style.display = 'none'; - this._show = false; + init: function (ecModel, api) { + var mapDraw = new MapDraw(api, true); + this._mapDraw = mapDraw; + + this.group.add(mapDraw.group); }, - // showLater: function () + render: function (geoModel, ecModel, api, payload) { + // Not render if it is an toggleSelect action from self + if (payload && payload.type === 'geoToggleSelect' + && payload.from === this.uid + ) { + return; + } - hideLater: function (time) { - if (this._show && !(this._inContent && this.enterable)) { - if (time) { - this._hideDelay = time; - // Set show false to avoid invoke hideLater mutiple times - this._show = false; - this._hideTimeout = setTimeout(zrUtil.bind(this.hide, this), time); - } - else { - this.hide(); - } + var mapDraw = this._mapDraw; + if (geoModel.get('show')) { + mapDraw.draw(geoModel, ecModel, api, this, payload); + } + else { + this._mapDraw.group.removeAll(); } + + this.group.silent = geoModel.get('silent'); }, - isShow: function () { - return this._show; + dispose: function () { + this._mapDraw && this._mapDraw.remove(); } - }; - module.exports = TooltipContent; + }); /***/ }, -/* 303 */ +/* 334 */ /***/ function(module, exports, __webpack_require__) { - 'use strict'; + /** + * Brush component entry + */ - __webpack_require__(304); - __webpack_require__(310); - __webpack_require__(312); + __webpack_require__(1).registerPreprocessor( + __webpack_require__(335) + ); + + __webpack_require__(336); + __webpack_require__(340); + __webpack_require__(341); + __webpack_require__(342); + + __webpack_require__(343); - // Polar view - __webpack_require__(1).extendComponentView({ - type: 'polar' - }); /***/ }, -/* 304 */ +/* 335 */ /***/ function(module, exports, __webpack_require__) { - // TODO Axis scale + /** + * @file brush preprocessor + */ - var Polar = __webpack_require__(305); - var numberUtil = __webpack_require__(7); var zrUtil = __webpack_require__(4); - var axisHelper = __webpack_require__(115); - var niceScaleExtent = axisHelper.niceScaleExtent; - - // 依赖 PolarModel 做预处理 - __webpack_require__(308); + var DEFAULT_TOOLBOX_BTNS = ['rect', 'polygon', 'keep', 'clear']; - /** - * Resize method bound to the polar - * @param {module:echarts/coord/polar/PolarModel} polarModel - * @param {module:echarts/ExtensionAPI} api - */ - function resizePolar(polarModel, api) { - var center = polarModel.get('center'); - var radius = polarModel.get('radius'); - var width = api.getWidth(); - var height = api.getHeight(); - var parsePercent = numberUtil.parsePercent; + module.exports = function (option, isNew) { + var brushComponents = option && option.brush; + if (!zrUtil.isArray(brushComponents)) { + brushComponents = brushComponents ? [brushComponents] : []; + } - this.cx = parsePercent(center[0], width); - this.cy = parsePercent(center[1], height); + if (!brushComponents.length) { + return; + } - var radiusAxis = this.getRadiusAxis(); - var size = Math.min(width, height) / 2; - // var idx = radiusAxis.inverse ? 1 : 0; - radiusAxis.setExtent(0, parsePercent(radius, size)); - } + var brushComponentSpecifiedBtns = []; - /** - * Update polar - */ - function updatePolarScale(ecModel, api) { - var polar = this; - var angleAxis = polar.getAngleAxis(); - var radiusAxis = polar.getRadiusAxis(); - // Reset scale - angleAxis.scale.setExtent(Infinity, -Infinity); - radiusAxis.scale.setExtent(Infinity, -Infinity); + zrUtil.each(brushComponents, function (brushOpt) { + var tbs = brushOpt.hasOwnProperty('toolbox') + ? brushOpt.toolbox : []; - ecModel.eachSeries(function (seriesModel) { - if (seriesModel.coordinateSystem === polar) { - var data = seriesModel.getData(); - radiusAxis.scale.unionExtentFromData(data, 'radius'); - angleAxis.scale.unionExtentFromData(data, 'angle'); + if (tbs instanceof Array) { + brushComponentSpecifiedBtns = brushComponentSpecifiedBtns.concat(tbs); } }); - niceScaleExtent(angleAxis, angleAxis.model); - niceScaleExtent(radiusAxis, radiusAxis.model); + var toolbox = option && option.toolbox; - // Fix extent of category angle axis - if (angleAxis.type === 'category' && !angleAxis.onBand) { - var extent = angleAxis.getExtent(); - var diff = 360 / angleAxis.scale.count(); - angleAxis.inverse ? (extent[1] += diff) : (extent[1] -= diff); - angleAxis.setExtent(extent[0], extent[1]); + if (zrUtil.isArray(toolbox)) { + toolbox = toolbox[0]; } - } - - /** - * Set common axis properties - * @param {module:echarts/coord/polar/AngleAxis|module:echarts/coord/polar/RadiusAxis} - * @param {module:echarts/coord/polar/AxisModel} - * @inner - */ - function setAxis(axis, axisModel) { - axis.type = axisModel.get('type'); - axis.scale = axisHelper.createScaleByModel(axisModel); - axis.onBand = axisModel.get('boundaryGap') && axis.type === 'category'; - - // FIXME Radius axis not support inverse axis - if (axisModel.mainType === 'angleAxis') { - var startAngle = axisModel.get('startAngle'); - axis.inverse = axisModel.get('inverse') ^ axisModel.get('clockwise'); - axis.setExtent(startAngle, startAngle + (axis.inverse ? -360 : 360)); + if (!toolbox) { + toolbox = {feature: {}}; + option.toolbox = [toolbox]; } - // Inject axis instance - axisModel.axis = axis; - axis.model = axisModel; - } - - - var polarCreator = { - - dimensions: Polar.prototype.dimensions, - - create: function (ecModel, api) { - var polarList = []; - ecModel.eachComponent('polar', function (polarModel, idx) { - var polar = new Polar(idx); - // Inject resize and update method - polar.resize = resizePolar; - polar.update = updatePolarScale; - - var radiusAxis = polar.getRadiusAxis(); - var angleAxis = polar.getAngleAxis(); - - var radiusAxisModel = polarModel.findAxisModel('radiusAxis'); - var angleAxisModel = polarModel.findAxisModel('angleAxis'); - - setAxis(radiusAxis, radiusAxisModel); - setAxis(angleAxis, angleAxisModel); - - polar.resize(polarModel, api); - polarList.push(polar); + var toolboxFeature = (toolbox.feature || (toolbox.feature = {})); + var toolboxBrush = toolboxFeature.brush || (toolboxFeature.brush = {}); + var brushTypes = toolboxBrush.type || (toolboxBrush.type = []); - polarModel.coordinateSystem = polar; - }); - // Inject coordinateSystem to series - ecModel.eachSeries(function (seriesModel) { - if (seriesModel.get('coordinateSystem') === 'polar') { - var polarModel = ecModel.queryComponents({ - mainType: 'polar', - index: seriesModel.get('polarIndex'), - id: seriesModel.get('polarId') - })[0]; + brushTypes.push.apply(brushTypes, brushComponentSpecifiedBtns); - if (true) { - if (!polarModel) { - throw new Error( - 'Polar "' + zrUtil.retrieve( - seriesModel.get('polarIndex'), - seriesModel.get('polarId'), - 0 - ) + '" not found' - ); - } - } - seriesModel.coordinateSystem = polarModel.coordinateSystem; - } - }); + removeDuplicate(brushTypes); - return polarList; + if (isNew && !brushTypes.length) { + brushTypes.push.apply(brushTypes, DEFAULT_TOOLBOX_BTNS); } }; - __webpack_require__(26).register('polar', polarCreator); + function removeDuplicate(arr) { + var map = {}; + zrUtil.each(arr, function (val) { + map[val] = 1; + }); + arr.length = 0; + zrUtil.each(map, function (flag, val) { + arr.push(val); + }); + } + /***/ }, -/* 305 */ +/* 336 */ /***/ function(module, exports, __webpack_require__) { - 'use strict'; /** - * @module echarts/coord/polar/Polar + * @file Brush visual coding. */ - var RadiusAxis = __webpack_require__(306); - var AngleAxis = __webpack_require__(307); + var echarts = __webpack_require__(1); + var visualSolution = __webpack_require__(337); + var zrUtil = __webpack_require__(4); + var BoundingRect = __webpack_require__(9); + var selector = __webpack_require__(338); + var throttle = __webpack_require__(81); + var BrushTargetManager = __webpack_require__(339); + + var STATE_LIST = ['inBrush', 'outOfBrush']; + var DISPATCH_METHOD = '__ecBrushSelect'; + var DISPATCH_FLAG = '__ecInBrushSelectEvent'; + var PRIORITY_BRUSH = echarts.PRIORITY.VISUAL.BRUSH; /** - * @alias {module:echarts/coord/polar/Polar} - * @constructor - * @param {string} name + * Layout for visual, the priority higher than other layout, and before brush visual. */ - var Polar = function (name) { - - /** - * @type {string} - */ - this.name = name || ''; - - /** - * x of polar center - * @type {number} - */ - this.cx = 0; - - /** - * y of polar center - * @type {number} - */ - this.cy = 0; - - /** - * @type {module:echarts/coord/polar/RadiusAxis} - * @private - */ - this._radiusAxis = new RadiusAxis(); - - /** - * @type {module:echarts/coord/polar/AngleAxis} - * @private - */ - this._angleAxis = new AngleAxis(); - }; - - Polar.prototype = { - - constructor: Polar, - - type: 'polar', - - /** - * @param {Array.} - * @readOnly - */ - dimensions: ['radius', 'angle'], - - /** - * If contain coord - * @param {Array.} point - * @return {boolean} - */ - containPoint: function (point) { - var coord = this.pointToCoord(point); - return this._radiusAxis.contain(coord[0]) - && this._angleAxis.contain(coord[1]); - }, - - /** - * If contain data - * @param {Array.} data - * @return {boolean} - */ - containData: function (data) { - return this._radiusAxis.containData(data[0]) - && this._angleAxis.containData(data[1]); - }, - - /** - * @param {string} axisType - * @return {module:echarts/coord/polar/AngleAxis|module:echarts/coord/polar/RadiusAxis} - */ - getAxis: function (axisType) { - return this['_' + axisType + 'Axis']; - }, + echarts.registerLayout(PRIORITY_BRUSH, function (ecModel, api, payload) { + ecModel.eachComponent({mainType: 'brush'}, function (brushModel) { - /** - * Get axes by type of scale - * @param {string} scaleType - * @return {module:echarts/coord/polar/AngleAxis|module:echarts/coord/polar/RadiusAxis} - */ - getAxesByScale: function (scaleType) { - var axes = []; - var angleAxis = this._angleAxis; - var radiusAxis = this._radiusAxis; - angleAxis.scale.type === scaleType && axes.push(angleAxis); - radiusAxis.scale.type === scaleType && axes.push(radiusAxis); + payload && payload.type === 'takeGlobalCursor' && brushModel.setBrushOption( + payload.key === 'brush' ? payload.brushOption : {brushType: false} + ); - return axes; - }, + var brushTargetManager = brushModel.brushTargetManager = new BrushTargetManager(brushModel.option, ecModel); - /** - * @return {module:echarts/coord/polar/AngleAxis} - */ - getAngleAxis: function () { - return this._angleAxis; - }, + brushTargetManager.setInputRanges(brushModel.areas, ecModel); + }); + }); - /** - * @return {module:echarts/coord/polar/RadiusAxis} - */ - getRadiusAxis: function () { - return this._radiusAxis; - }, + /** + * Register the visual encoding if this modules required. + */ + echarts.registerVisual(PRIORITY_BRUSH, function (ecModel, api, payload) { - /** - * @param {module:echarts/coord/polar/Axis} - * @return {module:echarts/coord/polar/Axis} - */ - getOtherAxis: function (axis) { - var angleAxis = this._angleAxis; - return axis === angleAxis ? this._radiusAxis : angleAxis; - }, + var brushSelected = []; + var throttleType; + var throttleDelay; - /** - * Base axis will be used on stacking. - * - * @return {module:echarts/coord/polar/Axis} - */ - getBaseAxis: function () { - return this.getAxesByScale('ordinal')[0] - || this.getAxesByScale('time')[0] - || this.getAngleAxis(); - }, + ecModel.eachComponent({mainType: 'brush'}, function (brushModel, brushIndex) { - /** - * Convert series data to a list of (x, y) points - * @param {module:echarts/data/List} data - * @return {Array} - * Return list of coordinates. For example: - * `[[10, 10], [20, 20], [30, 30]]` - */ - dataToPoints: function (data) { - return data.mapArray(this.dimensions, function (radius, angle) { - return this.dataToPoint([radius, angle]); - }, this); - }, + var thisBrushSelected = { + brushId: brushModel.id, + brushIndex: brushIndex, + brushName: brushModel.name, + areas: zrUtil.clone(brushModel.areas), + selected: [] + }; + // Every brush component exists in event params, convenient + // for user to find by index. + brushSelected.push(thisBrushSelected); - /** - * Convert a single data item to (x, y) point. - * Parameter data is an array which the first element is radius and the second is angle - * @param {Array.} data - * @param {boolean} [clamp=false] - * @return {Array.} - */ - dataToPoint: function (data, clamp) { - return this.coordToPoint([ - this._radiusAxis.dataToRadius(data[0], clamp), - this._angleAxis.dataToAngle(data[1], clamp) - ]); - }, + var brushOption = brushModel.option; + var brushLink = brushOption.brushLink; + var linkedSeriesMap = []; + var selectedDataIndexForLink = []; + var rangeInfoBySeries = []; + var hasBrushExists = 0; - /** - * Convert a (x, y) point to data - * @param {Array.} point - * @param {boolean} [clamp=false] - * @return {Array.} - */ - pointToData: function (point, clamp) { - var coord = this.pointToCoord(point); - return [ - this._radiusAxis.radiusToData(coord[0], clamp), - this._angleAxis.angleToData(coord[1], clamp) - ]; - }, + if (!brushIndex) { // Only the first throttle setting works. + throttleType = brushOption.throttleType; + throttleDelay = brushOption.throttleDelay; + } - /** - * Convert a (x, y) point to (radius, angle) coord - * @param {Array.} point - * @return {Array.} - */ - pointToCoord: function (point) { - var dx = point[0] - this.cx; - var dy = point[1] - this.cy; - var angleAxis = this.getAngleAxis(); - var extent = angleAxis.getExtent(); - var minAngle = Math.min(extent[0], extent[1]); - var maxAngle = Math.max(extent[0], extent[1]); - // Fix fixed extent in polarCreator - // FIXME - angleAxis.inverse - ? (minAngle = maxAngle - 360) - : (maxAngle = minAngle + 360); + // Add boundingRect and selectors to range. + var areas = zrUtil.map(brushModel.areas, function (area) { + return bindSelector( + zrUtil.defaults( + {boundingRect: boundingRectBuilders[area.brushType](area)}, + area + ) + ); + }); - var radius = Math.sqrt(dx * dx + dy * dy); - dx /= radius; - dy /= radius; + var visualMappings = visualSolution.createVisualMappings( + brushModel.option, STATE_LIST, function (mappingOption) { + mappingOption.mappingMethod = 'fixed'; + } + ); - var radian = Math.atan2(-dy, dx) / Math.PI * 180; + zrUtil.isArray(brushLink) && zrUtil.each(brushLink, function (seriesIndex) { + linkedSeriesMap[seriesIndex] = 1; + }); - // move to angleExtent - var dir = radian < minAngle ? 1 : -1; - while (radian < minAngle || radian > maxAngle) { - radian += dir * 360; + function linkOthers(seriesIndex) { + return brushLink === 'all' || linkedSeriesMap[seriesIndex]; } - return [radius, radian]; - }, + // If no supported brush or no brush on the series, + // all visuals should be in original state. + function brushed(rangeInfoList) { + return !!rangeInfoList.length; + } - /** - * Convert a (radius, angle) coord to (x, y) point - * @param {Array.} coord - * @return {Array.} - */ - coordToPoint: function (coord) { - var radius = coord[0]; - var radian = coord[1] / 180 * Math.PI; - var x = Math.cos(radian) * radius + this.cx; - // Inverse the y - var y = -Math.sin(radian) * radius + this.cy; + /** + * Logic for each series: (If the logic has to be modified one day, do it carefully!) + * + * ( brushed ┬ && ┬hasBrushExist ┬ && linkOthers ) => StepA: ┬record, ┬ StepB: ┬visualByRecord. + * !brushed┘ ├hasBrushExist ┤ └nothing,┘ ├visualByRecord. + * └!hasBrushExist┘ └nothing. + * ( !brushed && ┬hasBrushExist ┬ && linkOthers ) => StepA: nothing, StepB: ┬visualByRecord. + * └!hasBrushExist┘ └nothing. + * ( brushed ┬ && !linkOthers ) => StepA: nothing, StepB: ┬visualByCheck. + * !brushed┘ └nothing. + * ( !brushed && !linkOthers ) => StepA: nothing, StepB: nothing. + */ - return [x, y]; - } - }; + // Step A + ecModel.eachSeries(function (seriesModel, seriesIndex) { + var rangeInfoList = rangeInfoBySeries[seriesIndex] = []; - module.exports = Polar; + seriesModel.subType === 'parallel' + ? stepAParallel(seriesModel, seriesIndex, rangeInfoList) + : stepAOthers(seriesModel, seriesIndex, rangeInfoList); + }); + function stepAParallel(seriesModel, seriesIndex) { + var coordSys = seriesModel.coordinateSystem; + hasBrushExists |= coordSys.hasAxisbrushed(); -/***/ }, -/* 306 */ -/***/ function(module, exports, __webpack_require__) { + linkOthers(seriesIndex) && coordSys.eachActiveState( + seriesModel.getData(), + function (activeState, dataIndex) { + activeState === 'active' && (selectedDataIndexForLink[dataIndex] = 1); + } + ); + } - 'use strict'; + function stepAOthers(seriesModel, seriesIndex, rangeInfoList) { + var selectorsByBrushType = getSelectorsByBrushType(seriesModel); + if (!selectorsByBrushType || brushModelNotControll(brushModel, seriesIndex)) { + return; + } + zrUtil.each(areas, function (area) { + selectorsByBrushType[area.brushType] + && brushModel.brushTargetManager.controlSeries(area, seriesModel, ecModel) + && rangeInfoList.push(area); + hasBrushExists |= brushed(rangeInfoList); + }); - var zrUtil = __webpack_require__(4); - var Axis = __webpack_require__(124); + if (linkOthers(seriesIndex) && brushed(rangeInfoList)) { + var data = seriesModel.getData(); + data.each(function (dataIndex) { + if (checkInRange(selectorsByBrushType, rangeInfoList, data, dataIndex)) { + selectedDataIndexForLink[dataIndex] = 1; + } + }); + } + } - function RadiusAxis(scale, radiusExtent) { + // Step B + ecModel.eachSeries(function (seriesModel, seriesIndex) { + var seriesBrushSelected = { + seriesId: seriesModel.id, + seriesIndex: seriesIndex, + seriesName: seriesModel.name, + dataIndex: [] + }; + // Every series exists in event params, convenient + // for user to find series by seriesIndex. + thisBrushSelected.selected.push(seriesBrushSelected); - Axis.call(this, 'radius', scale, radiusExtent); + var selectorsByBrushType = getSelectorsByBrushType(seriesModel); + var rangeInfoList = rangeInfoBySeries[seriesIndex]; - /** - * Axis type - * - 'category' - * - 'value' - * - 'time' - * - 'log' - * @type {string} - */ - this.type = 'category'; - } + var data = seriesModel.getData(); + var getValueState = linkOthers(seriesIndex) + ? function (dataIndex) { + return selectedDataIndexForLink[dataIndex] + ? (seriesBrushSelected.dataIndex.push(data.getRawIndex(dataIndex)), 'inBrush') + : 'outOfBrush'; + } + : function (dataIndex) { + return checkInRange(selectorsByBrushType, rangeInfoList, data, dataIndex) + ? (seriesBrushSelected.dataIndex.push(data.getRawIndex(dataIndex)), 'inBrush') + : 'outOfBrush'; + }; - RadiusAxis.prototype = { + // If no supported brush or no brush, all visuals are in original state. + (linkOthers(seriesIndex) ? hasBrushExists : brushed(rangeInfoList)) + && visualSolution.applyVisual( + STATE_LIST, visualMappings, data, getValueState + ); + }); - constructor: RadiusAxis, + }); - dataToRadius: Axis.prototype.dataToCoord, + dispatchAction(api, throttleType, throttleDelay, brushSelected, payload); + }); - radiusToData: Axis.prototype.coordToData - }; + function dispatchAction(api, throttleType, throttleDelay, brushSelected, payload) { + // This event will not be triggered when `setOpion`, otherwise dead lock may + // triggered when do `setOption` in event listener, which we do not find + // satisfactory way to solve yet. Some considered resolutions: + // (a) Diff with prevoius selected data ant only trigger event when changed. + // But store previous data and diff precisely (i.e., not only by dataIndex, but + // also detect value changes in selected data) might bring complexity or fragility. + // (b) Use spectial param like `silent` to suppress event triggering. + // But such kind of volatile param may be weird in `setOption`. + if (!payload) { + return; + } - zrUtil.inherits(RadiusAxis, Axis); + var zr = api.getZr(); + if (zr[DISPATCH_FLAG]) { + return; + } - module.exports = RadiusAxis; + if (!zr[DISPATCH_METHOD]) { + zr[DISPATCH_METHOD] = doDispatch; + } + var fn = throttle.createOrUpdate(zr, DISPATCH_METHOD, throttleDelay, throttleType); -/***/ }, -/* 307 */ -/***/ function(module, exports, __webpack_require__) { + fn(api, brushSelected); + } - 'use strict'; + function doDispatch(api, brushSelected) { + if (!api.isDisposed()) { + var zr = api.getZr(); + zr[DISPATCH_FLAG] = true; + api.dispatchAction({ + type: 'brushSelect', + batch: brushSelected + }); + zr[DISPATCH_FLAG] = false; + } + } + function checkInRange(selectorsByBrushType, rangeInfoList, data, dataIndex) { + var itemLayout = data.getItemLayout(dataIndex); + for (var i = 0, len = rangeInfoList.length; i < len; i++) { + var area = rangeInfoList[i]; + if (selectorsByBrushType[area.brushType]( + itemLayout, area.selectors, area + )) { + return true; + } + } + } - var zrUtil = __webpack_require__(4); - var Axis = __webpack_require__(124); + function getSelectorsByBrushType(seriesModel) { + var brushSelector = seriesModel.brushSelector; + if (zrUtil.isString(brushSelector)) { + var sels = []; + zrUtil.each(selector, function (selectorsByElementType, brushType) { + sels[brushType] = selectorsByElementType[brushSelector]; + }); + return sels; + } + else if (zrUtil.isFunction(brushSelector)) { + var bSelector = {}; + zrUtil.each(selector, function (sel, brushType) { + bSelector[brushType] = brushSelector; + }); + return bSelector; + } + return brushSelector; + } - function AngleAxis(scale, angleExtent) { + function brushModelNotControll(brushModel, seriesIndex) { + var seriesIndices = brushModel.option.seriesIndex; + return seriesIndices != null + && seriesIndices !== 'all' + && ( + zrUtil.isArray(seriesIndices) + ? zrUtil.indexOf(seriesIndices, seriesIndex) < 0 + : seriesIndex !== seriesIndices + ); + } - angleExtent = angleExtent || [0, 360]; + function bindSelector(area) { + var selectors = area.selectors = {}; + zrUtil.each(selector[area.brushType], function (selFn, elType) { + // Do not use function binding or curry for performance. + selectors[elType] = function (itemLayout) { + return selFn(itemLayout, selectors, area); + }; + }); + return area; + } - Axis.call(this, 'angle', scale, angleExtent); + var boundingRectBuilders = { - /** - * Axis type - * - 'category' - * - 'value' - * - 'time' - * - 'log' - * @type {string} - */ - this.type = 'category'; - } + lineX: zrUtil.noop, - AngleAxis.prototype = { + lineY: zrUtil.noop, - constructor: AngleAxis, + rect: function (area) { + return getBoundingRectFromMinMax(area.range); + }, - dataToAngle: Axis.prototype.dataToCoord, + polygon: function (area) { + var minMax; + var range = area.range; - angleToData: Axis.prototype.coordToData + for (var i = 0, len = range.length; i < len; i++) { + minMax = minMax || [[Infinity, -Infinity], [Infinity, -Infinity]]; + var rg = range[i]; + rg[0] < minMax[0][0] && (minMax[0][0] = rg[0]); + rg[0] > minMax[0][1] && (minMax[0][1] = rg[0]); + rg[1] < minMax[1][0] && (minMax[1][0] = rg[1]); + rg[1] > minMax[1][1] && (minMax[1][1] = rg[1]); + } + + return minMax && getBoundingRectFromMinMax(minMax); + } }; - zrUtil.inherits(AngleAxis, Axis); + function getBoundingRectFromMinMax(minMax) { + return new BoundingRect( + minMax[0][0], + minMax[1][0], + minMax[0][1] - minMax[0][0], + minMax[1][1] - minMax[1][0] + ); + } - module.exports = AngleAxis; /***/ }, -/* 308 */ +/* 337 */ /***/ function(module, exports, __webpack_require__) { - 'use strict'; - - - __webpack_require__(309); + /** + * @file Visual solution, for consistent option specification. + */ - __webpack_require__(1).extendComponentModel({ - type: 'polar', + var zrUtil = __webpack_require__(4); + var VisualMapping = __webpack_require__(209); + var each = zrUtil.each; - dependencies: ['polarAxis', 'angleAxis'], + function hasKeys(obj) { + if (obj) { + for (var name in obj){ + if (obj.hasOwnProperty(name)) { + return true; + } + } + } + } - /** - * @type {module:echarts/coord/polar/Polar} - */ - coordinateSystem: null, + var visualSolution = { /** - * @param {string} axisType - * @return {module:echarts/coord/polar/AxisModel} + * @param {Object} option + * @param {Array.} stateList + * @param {Function} [supplementVisualOption] + * @return {Object} visualMappings > */ - findAxisModel: function (axisType) { - var foundAxisModel; - var ecModel = this.ecModel; + createVisualMappings: function (option, stateList, supplementVisualOption) { + var visualMappings = {}; - ecModel.eachComponent(axisType, function (axisModel) { - if (axisModel.getCoordSysModel() === this) { - foundAxisModel = axisModel; - } - }, this); - return foundAxisModel; - }, + each(stateList, function (state) { + var mappings = visualMappings[state] = createMappings(); - defaultOption: { + each(option[state], function (visualData, visualType) { + if (!VisualMapping.isValidType(visualType)) { + return; + } + var mappingOption = { + type: visualType, + visual: visualData + }; + supplementVisualOption && supplementVisualOption(mappingOption, state); + mappings[visualType] = new VisualMapping(mappingOption); - zlevel: 0, + // Prepare a alpha for opacity, for some case that opacity + // is not supported, such as rendering using gradient color. + if (visualType === 'opacity') { + mappingOption = zrUtil.clone(mappingOption); + mappingOption.type = 'colorAlpha'; + mappings.__hidden.__alphaForOpacity = new VisualMapping(mappingOption); + } + }); + }); - z: 0, + return visualMappings; - center: ['50%', '50%'], + function createMappings() { + var Creater = function () {}; + // Make sure hidden fields will not be visited by + // object iteration (with hasOwnProperty checking). + Creater.prototype.__hidden = Creater.prototype; + var obj = new Creater(); + return obj; + } + }, - radius: '80%' - } - }); + /** + * @param {Object} thisOption + * @param {Object} newOption + * @param {Array.} keys + */ + replaceVisualOption: function (thisOption, newOption, keys) { + // Visual attributes merge is not supported, otherwise it + // brings overcomplicated merge logic. See #2853. So if + // newOption has anyone of these keys, all of these keys + // will be reset. Otherwise, all keys remain. + var has; + zrUtil.each(keys, function (key) { + if (newOption.hasOwnProperty(key) && hasKeys(newOption[key])) { + has = true; + } + }); + has && zrUtil.each(keys, function (key) { + if (newOption.hasOwnProperty(key) && hasKeys(newOption[key])) { + thisOption[key] = zrUtil.clone(newOption[key]); + } + else { + delete thisOption[key]; + } + }); + }, + /** + * @param {Array.} stateList + * @param {Object} visualMappings > + * @param {module:echarts/data/List} list + * @param {Function} getValueState param: valueOrIndex, return: state. + * @param {object} [scope] Scope for getValueState + * @param {string} [dimension] Concrete dimension, if used. + */ + applyVisual: function (stateList, visualMappings, data, getValueState, scope, dimension) { + var visualTypesMap = {}; + zrUtil.each(stateList, function (state) { + var visualTypes = VisualMapping.prepareVisualTypes(visualMappings[state]); + visualTypesMap[state] = visualTypes; + }); -/***/ }, -/* 309 */ -/***/ function(module, exports, __webpack_require__) { + var dataIndex; - 'use strict'; + function getVisual(key) { + return data.getItemVisual(dataIndex, key); + } + function setVisual(key, value) { + data.setItemVisual(dataIndex, key, value); + } - var zrUtil = __webpack_require__(4); - var ComponentModel = __webpack_require__(19); - var axisModelCreator = __webpack_require__(128); + if (dimension == null) { + data.each(eachItem, true); + } + else { + data.each([dimension], eachItem, true); + } - var PolarAxisModel = ComponentModel.extend({ + function eachItem(valueOrIndex, index) { + dataIndex = dimension == null ? valueOrIndex : index; - type: 'polarAxis', + var rawDataItem = data.getRawDataItem(dataIndex); + // Consider performance + if (rawDataItem && rawDataItem.visualMap === false) { + return; + } - /** - * @type {module:echarts/coord/polar/AngleAxis|module:echarts/coord/polar/RadiusAxis} - */ - axis: null, + var valueState = getValueState.call(scope, valueOrIndex); + var mappings = visualMappings[valueState]; + var visualTypes = visualTypesMap[valueState]; - /** - * @override - */ - getCoordSysModel: function () { - return this.ecModel.queryComponents({ - mainType: 'polar', - index: this.option.polarIndex, - id: this.option.polarId - })[0]; + for (var i = 0, len = visualTypes.length; i < len; i++) { + var type = visualTypes[i]; + mappings[type] && mappings[type].applyVisual( + valueOrIndex, getVisual, setVisual + ); + } + } } + }; - }); + module.exports = visualSolution; - zrUtil.merge(PolarAxisModel.prototype, __webpack_require__(130)); - var polarAxisDefaultExtendedOption = { - angle: { - // polarIndex: 0, - // polarId: '', - startAngle: 90, +/***/ }, +/* 338 */ +/***/ function(module, exports, __webpack_require__) { - clockwise: true, + - splitNumber: 12, + var polygonContain = __webpack_require__(184).contain; + var BoundingRect = __webpack_require__(9); - axisLabel: { - rotate: false + // Key of the first level is brushType: `line`, `rect`, `polygon`. + // Key of the second level is chart element type: `point`, `rect`. + // See moudule:echarts/component/helper/BrushController + // function param: + // {Object} itemLayout fetch from data.getItemLayout(dataIndex) + // {Object} selectors {point: selector, rect: selector, ...} + // {Object} area {range: [[], [], ..], boudingRect} + // function return: + // {boolean} Whether in the given brush. + var selector = { + lineX: getLineSelectors(0), + lineY: getLineSelectors(1), + rect: { + point: function (itemLayout, selectors, area) { + return area.boundingRect.contain(itemLayout[0], itemLayout[1]); + }, + rect: function (itemLayout, selectors, area) { + return area.boundingRect.intersect(itemLayout); } }, - radius: { - // polarIndex: 0, - // polarId: '', + polygon: { + point: function (itemLayout, selectors, area) { + return area.boundingRect.contain(itemLayout[0], itemLayout[1]) + && polygonContain(area.range, itemLayout[0], itemLayout[1]); + }, + rect: function (itemLayout, selectors, area) { + var points = area.range; - splitNumber: 5 + if (points.length <= 1) { + return false; + } + + var x = itemLayout.x; + var y = itemLayout.y; + var width = itemLayout.width; + var height = itemLayout.height; + var p = points[0]; + + if (polygonContain(points, x, y) + || polygonContain(points, x + width, y) + || polygonContain(points, x, y + height) + || polygonContain(points, x + width, y + height) + || BoundingRect.create(itemLayout).contain(p[0], p[1]) + || lineIntersectPolygon(x, y, x + width, y, points) + || lineIntersectPolygon(x, y, x, y + height, points) + || lineIntersectPolygon(x + width, y, x + width, y + height, points) + || lineIntersectPolygon(x, y + height, x + width, y + height, points) + ) { + return true; + } + } } }; - function getAxisType(axisDim, option) { - // Default axis with data is category axis - return option.type || (option.data ? 'category' : 'value'); - } + function getLineSelectors(xyIndex) { + var xy = ['x', 'y']; + var wh = ['width', 'height']; - axisModelCreator('angle', PolarAxisModel, getAxisType, polarAxisDefaultExtendedOption.angle); - axisModelCreator('radius', PolarAxisModel, getAxisType, polarAxisDefaultExtendedOption.radius); + return { + point: function (itemLayout, selectors, area) { + var range = area.range; + var p = itemLayout[xyIndex]; + return inLineRange(p, range); + }, + rect: function (itemLayout, selectors, area) { + var range = area.range; + var layoutRange = [ + itemLayout[xy[xyIndex]], + itemLayout[xy[xyIndex]] + itemLayout[wh[xyIndex]] + ]; + layoutRange[1] < layoutRange[0] && layoutRange.reverse(); + return inLineRange(layoutRange[0], range) + || inLineRange(layoutRange[1], range) + || inLineRange(range[0], layoutRange) + || inLineRange(range[1], layoutRange); + } + }; + } + function inLineRange(p, range) { + return range[0] <= p && p <= range[1]; + } + function lineIntersectPolygon(lx, ly, l2x, l2y, points) { + for (var i = 0, p2 = points[points.length - 1]; i < points.length; i++) { + var p = points[i]; + if (lineIntersect(lx, ly, l2x, l2y, p[0], p[1], p2[0], p2[1])) { + return true; + } + p2 = p; + } + } -/***/ }, -/* 310 */ -/***/ function(module, exports, __webpack_require__) { + // Code from with some fix. + // See + function lineIntersect(a1x, a1y, a2x, a2y, b1x, b1y, b2x, b2y) { + var delta = determinant(a2x - a1x, b1x - b2x, a2y - a1y, b1y - b2y); + if (nearZero(delta)) { // parallel + return false; + } + var namenda = determinant(b1x - a1x, b1x - b2x, b1y - a1y, b1y - b2y) / delta; + if (namenda < 0 || namenda > 1) { + return false; + } + var miu = determinant(a2x - a1x, b1x - a1x, a2y - a1y, b1y - a1y) / delta; + if (miu < 0 || miu > 1) { + return false; + } + return true; + } - 'use strict'; + function nearZero(val) { + return val <= (1e-6) && val >= -(1e-6); + } + function determinant(v1, v2, v3, v4) { + return v1 * v4 - v2 * v3; + } - __webpack_require__(304); + module.exports = selector; - __webpack_require__(311); /***/ }, -/* 311 */ +/* 339 */ /***/ function(module, exports, __webpack_require__) { - 'use strict'; - + var zrUtil = __webpack_require__(4); - var graphic = __webpack_require__(43); - var Model = __webpack_require__(12); - - var elementList = ['axisLine', 'axisLabel', 'axisTick', 'splitLine', 'splitArea']; - - function getAxisLineShape(polar, r0, r, angle) { - var start = polar.coordToPoint([r0, angle]); - var end = polar.coordToPoint([r, angle]); - - return { - x1: start[0], - y1: start[1], - x2: end[0], - y2: end[1] - }; - } - __webpack_require__(1).extendComponentView({ - - type: 'angleAxis', - - render: function (angleAxisModel, ecModel) { - this.group.removeAll(); - if (!angleAxisModel.get('show')) { - return; - } - - var polarModel = ecModel.getComponent('polar', angleAxisModel.get('polarIndex')); - var angleAxis = angleAxisModel.axis; - var polar = polarModel.coordinateSystem; - var radiusExtent = polar.getRadiusAxis().getExtent(); - var ticksAngles = angleAxis.getTicksCoords(); - - if (angleAxis.type !== 'category') { - // Remove the last tick which will overlap the first tick - ticksAngles.pop(); - } + var graphic = __webpack_require__(44); + var modelUtil = __webpack_require__(5); - zrUtil.each(elementList, function (name) { - if (angleAxisModel.get(name +'.show') - && (!angleAxis.isBlank() || name === 'axisLine') - ) { - this['_' + name](angleAxisModel, polar, ticksAngles, radiusExtent); - } - }, this); - }, + var each = zrUtil.each; + var indexOf = zrUtil.indexOf; + var curry = zrUtil.curry; - /** - * @private - */ - _axisLine: function (angleAxisModel, polar, ticksAngles, radiusExtent) { - var lineStyleModel = angleAxisModel.getModel('axisLine.lineStyle'); + var COORD_CONVERTS = ['dataToPoint', 'pointToData']; - var circle = new graphic.Circle({ - shape: { - cx: polar.cx, - cy: polar.cy, - r: radiusExtent[1] - }, - style: lineStyleModel.getLineStyle(), - z2: 1, - silent: true - }); - circle.style.fill = null; + // FIXME + // how to genarialize to more coordinate systems. + var INCLUDE_FINDER_MAIN_TYPES = [ + 'grid', 'xAxis', 'yAxis', 'geo', 'graph', + 'polar', 'radiusAxis', 'angleAxis', 'bmap' + ]; - this.group.add(circle); - }, + /** + * [option in constructor]: + * { + * Index/Id/Name of geo, xAxis, yAxis, grid: See util/model#parseFinder. + * } + * + * + * [targetInfo]: + * + * There can be multiple axes in a single targetInfo. Consider the case + * of `grid` component, a targetInfo represents a grid which contains one or more + * cartesian and one or more axes. And consider the case of parallel system, + * which has multiple axes in a coordinate system. + * Can be { + * panelId: ..., + * coordSys: , + * coordSyses: all cartesians. + * gridModel: + * xAxes: correspond to coordSyses on index + * yAxes: correspond to coordSyses on index + * } + * or { + * panelId: ..., + * coordSys: + * coordSyses: [] + * geoModel: + * } + * + * + * [panelOpt]: + * + * Make from targetInfo. Input to BrushController. + * { + * panelId: ..., + * rect: ... + * } + * + * + * [area]: + * + * Generated by BrushController or user input. + * { + * panelId: Used to locate coordInfo directly. If user inpput, no panelId. + * brushType: determine how to convert to/from coord('rect' or 'polygon' or 'lineX/Y'). + * Index/Id/Name of geo, xAxis, yAxis, grid: See util/model#parseFinder. + * range: pixel range. + * coordRange: representitive coord range (the first one of coordRanges). + * coordRanges: coord ranges, used in multiple cartesian in one grid. + * } + */ + /** + * @param {Object} option contains Index/Id/Name of xAxis/yAxis/geo/grid + * Each can be {number|Array.}. like: {xAxisIndex: [3, 4]} + * @param {module:echarts/model/Global} ecModel + * @param {Object} [opt] + * @param {Array.} [opt.include] include coordinate system types. + */ + function BrushTargetManager(option, ecModel, opt) { /** * @private + * @type {Array.} */ - _axisTick: function (angleAxisModel, polar, ticksAngles, radiusExtent) { - var tickModel = angleAxisModel.getModel('axisTick'); - - var tickLen = (tickModel.get('inside') ? -1 : 1) * tickModel.get('length'); - - var lines = zrUtil.map(ticksAngles, function (tickAngle) { - return new graphic.Line({ - shape: getAxisLineShape(polar, radiusExtent[1], radiusExtent[1] + tickLen, tickAngle) - }); - }); - this.group.add(graphic.mergePath( - lines, { - style: zrUtil.defaults( - tickModel.getModel('lineStyle').getLineStyle(), - { - stroke: angleAxisModel.get('axisLine.lineStyle.color') - } - ) - } - )); - }, + var targetInfoList = this._targetInfoList = []; + var info = {}; + var foundCpts = parseFinder(ecModel, option); - /** - * @private - */ - _axisLabel: function (angleAxisModel, polar, ticksAngles, radiusExtent) { - var axis = angleAxisModel.axis; + each(targetInfoBuilders, function (builder, type) { + if (!opt || !opt.include || indexOf(opt.include, type) >= 0) { + builder(foundCpts, targetInfoList, info); + } + }); + } - var categoryData = angleAxisModel.get('data'); + var proto = BrushTargetManager.prototype; + + proto.setOutputRanges = function (areas, ecModel) { + this.matchOutputRanges(areas, ecModel, function (area, coordRange, coordSys) { + (area.coordRanges || (area.coordRanges = [])).push(coordRange); + // area.coordRange is the first of area.coordRanges + if (!area.coordRange) { + area.coordRange = coordRange; + // In 'category' axis, coord to pixel is not reversible, so we can not + // rebuild range by coordRange accrately, which may bring trouble when + // brushing only one item. So we use __rangeOffset to rebuilding range + // by coordRange. And this it only used in brush component so it is no + // need to be adapted to coordRanges. + var result = coordConvert[area.brushType](0, coordSys, coordRange); + area.__rangeOffset = { + offset: diffProcessor[area.brushType](result.values, area.range, [1, 1]), + xyMinMax: result.xyMinMax + }; + } + }); + }; - var labelModel = angleAxisModel.getModel('axisLabel'); - var axisTextStyleModel = labelModel.getModel('textStyle'); + proto.matchOutputRanges = function (areas, ecModel, cb) { + each(areas, function (area) { + var targetInfo = this.findTargetInfo(area, ecModel); - var labels = angleAxisModel.getFormattedLabels(); + if (targetInfo && targetInfo !== true) { + zrUtil.each( + targetInfo.coordSyses, + function (coordSys) { + var result = coordConvert[area.brushType](1, coordSys, area.range); + cb(area, result.values, coordSys, ecModel); + } + ); + } + }, this); + }; - var labelMargin = labelModel.get('margin'); - var labelsAngles = axis.getLabelsCoords(); + proto.setInputRanges = function (areas, ecModel) { + each(areas, function (area) { + var targetInfo = this.findTargetInfo(area, ecModel); - // Use length of ticksAngles because it may remove the last tick to avoid overlapping - for (var i = 0; i < ticksAngles.length; i++) { - var r = radiusExtent[1]; - var p = polar.coordToPoint([r + labelMargin, labelsAngles[i]]); - var cx = polar.cx; - var cy = polar.cy; + if (true) { + zrUtil.assert( + !targetInfo || targetInfo === true || area.coordRange, + 'coordRange must be specified when coord index specified.' + ); + zrUtil.assert( + !targetInfo || targetInfo !== true || area.range, + 'range must be specified in global brush.' + ); + } - var labelTextAlign = Math.abs(p[0] - cx) / r < 0.3 - ? 'center' : (p[0] > cx ? 'left' : 'right'); - var labelTextBaseline = Math.abs(p[1] - cy) / r < 0.3 - ? 'middle' : (p[1] > cy ? 'top' : 'bottom'); + area.range = area.range || []; - var textStyleModel = axisTextStyleModel; - if (categoryData && categoryData[i] && categoryData[i].textStyle) { - textStyleModel = new Model( - categoryData[i].textStyle, axisTextStyleModel - ); - } - this.group.add(new graphic.Text({ - style: { - x: p[0], - y: p[1], - fill: textStyleModel.getTextColor() || angleAxisModel.get('axisLine.lineStyle.color'), - text: labels[i], - textAlign: labelTextAlign, - textVerticalAlign: labelTextBaseline, - textFont: textStyleModel.getFont() - }, - silent: true - })); + // convert coordRange to global range and set panelId. + if (targetInfo && targetInfo !== true) { + area.panelId = targetInfo.panelId; + // (1) area.range shoule always be calculate from coordRange but does + // not keep its original value, for the sake of the dataZoom scenario, + // where area.coordRange remains unchanged but area.range may be changed. + // (2) Only support converting one coordRange to pixel range in brush + // component. So do not consider `coordRanges`. + // (3) About __rangeOffset, see comment above. + var result = coordConvert[area.brushType](0, targetInfo.coordSys, area.coordRange); + var rangeOffset = area.__rangeOffset; + area.range = rangeOffset + ? diffProcessor[area.brushType]( + result.values, + rangeOffset.offset, + getScales(result.xyMinMax, rangeOffset.xyMinMax) + ) + : result.values; } - }, + }, this); + }; - /** - * @private - */ - _splitLine: function (angleAxisModel, polar, ticksAngles, radiusExtent) { - var splitLineModel = angleAxisModel.getModel('splitLine'); - var lineStyleModel = splitLineModel.getModel('lineStyle'); - var lineColors = lineStyleModel.get('color'); - var lineCount = 0; + proto.makePanelOpts = function (getDefaultBrushType) { + return zrUtil.map(this._targetInfoList, function (targetInfo) { + return { + panelId: targetInfo.panelId, + rect: targetInfo.getPanelRect(), + defaultBrushType: getDefaultBrushType && getDefaultBrushType(targetInfo) + }; + }); + }; - lineColors = lineColors instanceof Array ? lineColors : [lineColors]; + proto.controlSeries = function (area, seriesModel, ecModel) { + // Check whether area is bound in coord, and series do not belong to that coord. + // If do not do this check, some brush (like lineX) will controll all axes. + var targetInfo = this.findTargetInfo(area, ecModel); + return targetInfo === true || ( + targetInfo && indexOf(targetInfo.coordSyses, seriesModel.coordinateSystem) >= 0 + ); + }; - var splitLines = []; + /** + * If return Object, a coord found. + * If reutrn true, global found. + * Otherwise nothing found. + * + * @param {Object} area + * @param {Array} targetInfoList + * @return {Obejct|boolean} + */ + proto.findTargetInfo = function (area, ecModel) { + var targetInfoList = this._targetInfoList; + var foundCpts = parseFinder(ecModel, area); - for (var i = 0; i < ticksAngles.length; i++) { - var colorIndex = (lineCount++) % lineColors.length; - splitLines[colorIndex] = splitLines[colorIndex] || []; - splitLines[colorIndex].push(new graphic.Line({ - shape: getAxisLineShape(polar, radiusExtent[0], radiusExtent[1], ticksAngles[i]) - })); + for (var i = 0; i < targetInfoList.length; i++) { + var targetInfo = targetInfoList[i]; + var areaPanelId = area.panelId; + if (areaPanelId) { + if (targetInfo.panelId === areaPanelId) { + return targetInfo; + } } - - // Simple optimization - // Batching the lines if color are the same - for (var i = 0; i < splitLines.length; i++) { - this.group.add(graphic.mergePath(splitLines[i], { - style: zrUtil.defaults({ - stroke: lineColors[i % lineColors.length] - }, lineStyleModel.getLineStyle()), - silent: true, - z: angleAxisModel.get('z') - })); + else { + for (var i = 0; i < targetInfoMatchers.length; i++) { + if (targetInfoMatchers[i](foundCpts, targetInfo)) { + return targetInfo; + } + } } - }, - - /** - * @private - */ - _splitArea: function (angleAxisModel, polar, ticksAngles, radiusExtent) { - - var splitAreaModel = angleAxisModel.getModel('splitArea'); - var areaStyleModel = splitAreaModel.getModel('areaStyle'); - var areaColors = areaStyleModel.get('color'); - var lineCount = 0; + } - areaColors = areaColors instanceof Array ? areaColors : [areaColors]; + return true; + }; - var splitAreas = []; + function formatMinMax(minMax) { + minMax[0] > minMax[1] && minMax.reverse(); + return minMax; + } - var RADIAN = Math.PI / 180; - var prevAngle = -ticksAngles[0] * RADIAN; - var r0 = Math.min(radiusExtent[0], radiusExtent[1]); - var r1 = Math.max(radiusExtent[0], radiusExtent[1]); + function parseFinder(ecModel, option) { + return modelUtil.parseFinder( + ecModel, option, {includeMainTypes: INCLUDE_FINDER_MAIN_TYPES} + ); + } - var clockwise = angleAxisModel.get('clockwise'); + var targetInfoBuilders = { - for (var i = 1; i < ticksAngles.length; i++) { - var colorIndex = (lineCount++) % areaColors.length; - splitAreas[colorIndex] = splitAreas[colorIndex] || []; - splitAreas[colorIndex].push(new graphic.Sector({ - shape: { - cx: polar.cx, - cy: polar.cy, - r0: r0, - r: r1, - startAngle: prevAngle, - endAngle: -ticksAngles[i] * RADIAN, - clockwise: clockwise - }, - silent: true - })); - prevAngle = -ticksAngles[i] * RADIAN; - } + grid: function (foundCpts, targetInfoList) { + var xAxisModels = foundCpts.xAxisModels; + var yAxisModels = foundCpts.yAxisModels; + var gridModels = foundCpts.gridModels; + // Remove duplicated. + var gridModelMap = {}; + var xAxesHas = {}; + var yAxesHas = {}; - // Simple optimization - // Batching the lines if color are the same - for (var i = 0; i < splitAreas.length; i++) { - this.group.add(graphic.mergePath(splitAreas[i], { - style: zrUtil.defaults({ - fill: areaColors[i % areaColors.length] - }, areaStyleModel.getAreaStyle()), - silent: true - })); + if (!xAxisModels && !yAxisModels && !gridModels) { + return; } - } - }); - - -/***/ }, -/* 312 */ -/***/ function(module, exports, __webpack_require__) { - + each(xAxisModels, function (axisModel) { + var gridModel = axisModel.axis.grid.model; + gridModelMap[gridModel.id] = gridModel; + xAxesHas[gridModel.id] = true; + }); + each(yAxisModels, function (axisModel) { + var gridModel = axisModel.axis.grid.model; + gridModelMap[gridModel.id] = gridModel; + yAxesHas[gridModel.id] = true; + }); + each(gridModels, function (gridModel) { + gridModelMap[gridModel.id] = gridModel; + xAxesHas[gridModel.id] = true; + yAxesHas[gridModel.id] = true; + }); - __webpack_require__(304); + each(gridModelMap, function (gridModel) { + var grid = gridModel.coordinateSystem; + var cartesians = []; - __webpack_require__(313); + each(grid.getCartesians(), function (cartesian, index) { + if (indexOf(xAxisModels, cartesian.getAxis('x').model) >= 0 + || indexOf(yAxisModels, cartesian.getAxis('y').model) >= 0 + ) { + cartesians.push(cartesian); + } + }); + targetInfoList.push({ + panelId: 'grid--' + gridModel.id, + gridModel: gridModel, + // Use the first one as the representitive coordSys. + coordSys: cartesians[0], + coordSyses: cartesians, + getPanelRect: panelRectBuilder.grid, + xAxisDeclared: xAxesHas[gridModel.id], + yAxisDeclared: yAxesHas[gridModel.id] + }); + }); + }, + geo: function (foundCpts, targetInfoList) { + each(foundCpts.geoModels, function (geoModel) { + var coordSys = geoModel.coordinateSystem; + targetInfoList.push({ + panelId: 'geo--' + geoModel.id, + geoModel: geoModel, + coordSys: coordSys, + coordSyses: [coordSys], + getPanelRect: panelRectBuilder.geo + }); + }); + } + }; -/***/ }, -/* 313 */ -/***/ function(module, exports, __webpack_require__) { + var targetInfoMatchers = [ - 'use strict'; + // grid + function (foundCpts, targetInfo) { + var xAxisModel = foundCpts.xAxisModel; + var yAxisModel = foundCpts.yAxisModel; + var gridModel = foundCpts.gridModel; + !gridModel && xAxisModel && (gridModel = xAxisModel.axis.grid.model); + !gridModel && yAxisModel && (gridModel = yAxisModel.axis.grid.model); - var zrUtil = __webpack_require__(4); - var graphic = __webpack_require__(43); - var AxisBuilder = __webpack_require__(133); + return gridModel && gridModel === targetInfo.gridModel; + }, - var axisBuilderAttrs = [ - 'axisLine', 'axisLabel', 'axisTick', 'axisName' - ]; - var selfBuilderAttrs = [ - 'splitLine', 'splitArea' + // geo + function (foundCpts, targetInfo) { + var geoModel = foundCpts.geoModel; + return geoModel && geoModel === targetInfo.geoModel; + } ]; - __webpack_require__(1).extendComponentView({ - - type: 'radiusAxis', - - render: function (radiusAxisModel, ecModel) { - this.group.removeAll(); - if (!radiusAxisModel.get('show')) { - return; - } - var polarModel = ecModel.getComponent('polar', radiusAxisModel.get('polarIndex')); - var angleAxis = polarModel.coordinateSystem.getAngleAxis(); - var radiusAxis = radiusAxisModel.axis; - var polar = polarModel.coordinateSystem; - var ticksCoords = radiusAxis.getTicksCoords(); - var axisAngle = angleAxis.getExtent()[0]; - var radiusExtent = radiusAxis.getExtent(); - - var layout = layoutAxis(polar, radiusAxisModel, axisAngle); - var axisBuilder = new AxisBuilder(radiusAxisModel, layout); - zrUtil.each(axisBuilderAttrs, axisBuilder.add, axisBuilder); - this.group.add(axisBuilder.getGroup()); + var panelRectBuilder = { - zrUtil.each(selfBuilderAttrs, function (name) { - if (radiusAxisModel.get(name +'.show') && !radiusAxis.isBlank()) { - this['_' + name](radiusAxisModel, polar, axisAngle, radiusExtent, ticksCoords); - } - }, this); + grid: function () { + // grid is not Transformable. + return this.coordSys.grid.getRect().clone(); }, - /** - * @private - */ - _splitLine: function (radiusAxisModel, polar, axisAngle, radiusExtent, ticksCoords) { - var splitLineModel = radiusAxisModel.getModel('splitLine'); - var lineStyleModel = splitLineModel.getModel('lineStyle'); - var lineColors = lineStyleModel.get('color'); - var lineCount = 0; + geo: function () { + var coordSys = this.coordSys; + var rect = coordSys.getBoundingRect().clone(); + // geo roam and zoom transform + rect.applyTransform(graphic.getTransform(coordSys)); + return rect; + } + }; - lineColors = lineColors instanceof Array ? lineColors : [lineColors]; + var coordConvert = { - var splitLines = []; + lineX: curry(axisConvert, 0), - for (var i = 0; i < ticksCoords.length; i++) { - var colorIndex = (lineCount++) % lineColors.length; - splitLines[colorIndex] = splitLines[colorIndex] || []; - splitLines[colorIndex].push(new graphic.Circle({ - shape: { - cx: polar.cx, - cy: polar.cy, - r: ticksCoords[i] - }, - silent: true - })); - } + lineY: curry(axisConvert, 1), - // Simple optimization - // Batching the lines if color are the same - for (var i = 0; i < splitLines.length; i++) { - this.group.add(graphic.mergePath(splitLines[i], { - style: zrUtil.defaults({ - stroke: lineColors[i % lineColors.length], - fill: null - }, lineStyleModel.getLineStyle()), - silent: true - })); - } - }, + rect: function (to, coordSys, rangeOrCoordRange) { + var xminymin = coordSys[COORD_CONVERTS[to]]([rangeOrCoordRange[0][0], rangeOrCoordRange[1][0]]); + var xmaxymax = coordSys[COORD_CONVERTS[to]]([rangeOrCoordRange[0][1], rangeOrCoordRange[1][1]]); + var values = [ + formatMinMax([xminymin[0], xmaxymax[0]]), + formatMinMax([xminymin[1], xmaxymax[1]]) + ]; + return {values: values, xyMinMax: values}; + }, + + polygon: function (to, coordSys, rangeOrCoordRange) { + var xyMinMax = [[Infinity, -Infinity], [Infinity, -Infinity]]; + var values = zrUtil.map(rangeOrCoordRange, function (item) { + var p = coordSys[COORD_CONVERTS[to]](item); + xyMinMax[0][0] = Math.min(xyMinMax[0][0], p[0]); + xyMinMax[1][0] = Math.min(xyMinMax[1][0], p[1]); + xyMinMax[0][1] = Math.max(xyMinMax[0][1], p[0]); + xyMinMax[1][1] = Math.max(xyMinMax[1][1], p[1]); + return p; + }); + return {values: values, xyMinMax: xyMinMax}; + } + }; - /** - * @private - */ - _splitArea: function (radiusAxisModel, polar, axisAngle, radiusExtent, ticksCoords) { + function axisConvert(axisNameIndex, to, coordSys, rangeOrCoordRange) { + if (true) { + zrUtil.assert( + coordSys.type === 'cartesian2d', + 'lineX/lineY brush is available only in cartesian2d.' + ); + } - var splitAreaModel = radiusAxisModel.getModel('splitArea'); - var areaStyleModel = splitAreaModel.getModel('areaStyle'); - var areaColors = areaStyleModel.get('color'); - var lineCount = 0; + var axis = coordSys.getAxis(['x', 'y'][axisNameIndex]); + var values = formatMinMax(zrUtil.map([0, 1], function (i) { + return to + ? axis.coordToData(axis.toLocalCoord(rangeOrCoordRange[i])) + : axis.toGlobalCoord(axis.dataToCoord(rangeOrCoordRange[i])); + })); + var xyMinMax = []; + xyMinMax[axisNameIndex] = values; + xyMinMax[1 - axisNameIndex] = [NaN, NaN]; - areaColors = areaColors instanceof Array ? areaColors : [areaColors]; + return {values: values, xyMinMax: xyMinMax}; + } - var splitAreas = []; + var diffProcessor = { + lineX: curry(axisDiffProcessor, 0), - var prevRadius = ticksCoords[0]; - for (var i = 1; i < ticksCoords.length; i++) { - var colorIndex = (lineCount++) % areaColors.length; - splitAreas[colorIndex] = splitAreas[colorIndex] || []; - splitAreas[colorIndex].push(new graphic.Sector({ - shape: { - cx: polar.cx, - cy: polar.cy, - r0: prevRadius, - r: ticksCoords[i], - startAngle: 0, - endAngle: Math.PI * 2 - }, - silent: true - })); - prevRadius = ticksCoords[i]; - } + lineY: curry(axisDiffProcessor, 1), - // Simple optimization - // Batching the lines if color are the same - for (var i = 0; i < splitAreas.length; i++) { - this.group.add(graphic.mergePath(splitAreas[i], { - style: zrUtil.defaults({ - fill: areaColors[i % areaColors.length] - }, areaStyleModel.getAreaStyle()), - silent: true - })); - } + rect: function (values, refer, scales) { + return [ + [values[0][0] - scales[0] * refer[0][0], values[0][1] - scales[0] * refer[0][1]], + [values[1][0] - scales[1] * refer[1][0], values[1][1] - scales[1] * refer[1][1]] + ]; + }, + + polygon: function (values, refer, scales) { + return zrUtil.map(values, function (item, idx) { + return [item[0] - scales[0] * refer[idx][0], item[1] - scales[1] * refer[idx][1]]; + }); } - }); + }; - /** - * @inner - */ - function layoutAxis(polar, radiusAxisModel, axisAngle) { - return { - position: [polar.cx, polar.cy], - rotation: axisAngle / 180 * Math.PI, - labelDirection: -1, - tickDirection: -1, - nameDirection: 1, - labelRotation: radiusAxisModel.getModel('axisLabel').get('rotate'), - // Over splitLine and splitArea - z2: 1 - }; + function axisDiffProcessor(axisNameIndex, values, refer, scales) { + return [ + values[0] - scales[axisNameIndex] * refer[0], + values[1] - scales[axisNameIndex] * refer[1] + ]; } + // We have to process scale caused by dataZoom manually, + // although it might be not accurate. + function getScales(xyMinMaxCurr, xyMinMaxOrigin) { + var sizeCurr = getSize(xyMinMaxCurr); + var sizeOrigin = getSize(xyMinMaxOrigin); + var scales = [sizeCurr[0] / sizeOrigin[0], sizeCurr[1] / sizeOrigin[1]]; + isNaN(scales[0]) && (scales[0] = 1); + isNaN(scales[1]) && (scales[1] = 1); + return scales; + } -/***/ }, -/* 314 */ -/***/ function(module, exports, __webpack_require__) { + function getSize(xyMinMax) { + return xyMinMax + ? [xyMinMax[0][1] - xyMinMax[0][0], xyMinMax[1][1] - xyMinMax[1][0]] + : [NaN, NaN]; + } - + module.exports = BrushTargetManager; - __webpack_require__(315); - __webpack_require__(166); +/***/ }, +/* 340 */ +/***/ function(module, exports, __webpack_require__) { - __webpack_require__(316); + /** + * @file Brush model + */ - __webpack_require__(179); var echarts = __webpack_require__(1); var zrUtil = __webpack_require__(4); + var visualSolution = __webpack_require__(337); + var Model = __webpack_require__(12); - function makeAction(method, actionInfo) { - actionInfo.update = 'updateView'; - echarts.registerAction(actionInfo, function (payload, ecModel) { - var selected = {}; - - ecModel.eachComponent( - { mainType: 'geo', query: payload}, - function (geoModel) { - geoModel[method](payload.name); - var geo = geoModel.coordinateSystem; - zrUtil.each(geo.regions, function (region) { - selected[region.name] = geoModel.isSelected(region.name) || false; - }); - } - ); - - return { - selected: selected, - name: payload.name - } - }); - } + var DEFAULT_OUT_OF_BRUSH_COLOR = ['#ddd']; - makeAction('toggleSelected', { - type: 'geoToggleSelect', - event: 'geoselectchanged' - }); - makeAction('select', { - type: 'geoSelect', - event: 'geoselected' - }); - makeAction('unSelect', { - type: 'geoUnSelect', - event: 'geounselected' - }); + var BrushModel = echarts.extendComponentModel({ + type: 'brush', -/***/ }, -/* 315 */ -/***/ function(module, exports, __webpack_require__) { + dependencies: ['geo', 'grid', 'xAxis', 'yAxis', 'parallel', 'series'], - 'use strict'; + /** + * @protected + */ + defaultOption: { + // inBrush: null, + // outOfBrush: null, + toolbox: null, // Default value see preprocessor. + brushLink: null, // Series indices array, broadcast using dataIndex. + // or 'all', which means all series. 'none' or null means no series. + seriesIndex: 'all', // seriesIndex array, specify series controlled by this brush component. + geoIndex: null, // + xAxisIndex: null, + yAxisIndex: null, - var modelUtil = __webpack_require__(5); - var ComponentModel = __webpack_require__(19); - var Model = __webpack_require__(12); - var zrUtil = __webpack_require__(4); + brushType: 'rect', // Default brushType, see BrushController. + brushMode: 'single', // Default brushMode, 'single' or 'multiple' + transformable: true, // Default transformable. + brushStyle: { // Default brushStyle + borderWidth: 1, + color: 'rgba(120,140,180,0.3)', + borderColor: 'rgba(120,140,180,0.8)', + width: null // do not use bursh width in line brush, but fetch from grid. + }, - var selectableMixin = __webpack_require__(143); + throttleType: 'fixRate',// Throttle in brushSelected event. 'fixRate' or 'debounce'. + // If null, no throttle. Valid only in the first brush component + throttleDelay: 0, // Unit: ms, 0 means every event will be triggered. - var geoCreator = __webpack_require__(166); + // FIXME + // 试验效果 + removeOnClick: true + }, - var GeoModel = ComponentModel.extend({ + /** + * @readOnly + * @type {Array.} + */ + areas: [], - type: 'geo', + /** + * Current activated brush type. + * If null, brush is inactived. + * see module:echarts/component/helper/BrushController + * @readOnly + * @type {string} + */ + brushType: null, /** - * @type {module:echarts/coord/geo/Geo} + * Current brush opt. + * see module:echarts/component/helper/BrushController + * @readOnly + * @type {Object} */ - coordinateSystem: null, + brushOption: {}, - layoutMode: 'box', + /** + * @readOnly + * @type {Array.} + */ + coordInfoList: [], - init: function (option) { - ComponentModel.prototype.init.apply(this, arguments); + optionUpdated: function (newOption, isInit) { + var thisOption = this.option; - // Default label emphasis `position` and `show` - modelUtil.defaultEmphasis( - option.label, ['position', 'show', 'textStyle', 'distance', 'formatter'] + !isInit && visualSolution.replaceVisualOption( + thisOption, newOption, ['inBrush', 'outOfBrush'] ); - }, - optionUpdated: function () { - var option = this.option; - var self = this; + thisOption.inBrush = thisOption.inBrush || {}; + // Always give default visual, consider setOption at the second time. + thisOption.outOfBrush = thisOption.outOfBrush || {color: DEFAULT_OUT_OF_BRUSH_COLOR}; + }, - option.regions = geoCreator.getFilledRegions(option.regions, option.map); + /** + * If ranges is null/undefined, range state remain. + * + * @param {Array.} [ranges] + */ + setAreas: function (areas) { + if (true) { + zrUtil.assert(zrUtil.isArray(areas)); + zrUtil.each(areas, function (area) { + zrUtil.assert(area.brushType, 'Illegal areas'); + }); + } - this._optionModelMap = zrUtil.reduce(option.regions || [], function (obj, regionOpt) { - if (regionOpt.name) { - obj[regionOpt.name] = new Model(regionOpt, self); - } - return obj; - }, {}); + // If ranges is null/undefined, range state remain. + // This helps user to dispatchAction({type: 'brush'}) with no areas + // set but just want to get the current brush select info from a `brush` event. + if (!areas) { + return; + } - this.updateSelectedMap(option.regions); + this.areas = zrUtil.map(areas, function (area) { + return generateBrushOption(this.option, area); + }, this); }, - defaultOption: { + /** + * see module:echarts/component/helper/BrushController + * @param {Object} brushOption + */ + setBrushOption: function (brushOption) { + this.brushOption = generateBrushOption(this.option, brushOption); + this.brushType = this.brushOption.brushType; + } - zlevel: 0, + }); - z: 0, + function generateBrushOption(option, brushOption) { + return zrUtil.merge( + { + brushType: option.brushType, + brushMode: option.brushMode, + transformable: option.transformable, + brushStyle: new Model(option.brushStyle).getItemStyle(), + removeOnClick: option.removeOnClick + }, + brushOption, + true + ); + } - show: true, + module.exports = BrushModel; - left: 'center', - top: 'center', +/***/ }, +/* 341 */ +/***/ function(module, exports, __webpack_require__) { - // width:, - // height:, - // right - // bottom + - // Aspect is width / height. Inited to be geoJson bbox aspect - // This parameter is used for scale this aspect - aspectScale: 0.75, + var zrUtil = __webpack_require__(4); + var BrushController = __webpack_require__(250); + var echarts = __webpack_require__(1); - ///// Layout with center and size - // If you wan't to put map in a fixed size box with right aspect ratio - // This two properties may more conveninet - // layoutCenter: [50%, 50%] - // layoutSize: 100 + module.exports = echarts.extendComponentView({ + type: 'brush', - silent: false, + init: function (ecModel, api) { - // Map type - map: '', + /** + * @readOnly + * @type {module:echarts/model/Global} + */ + this.ecModel = ecModel; - // Default on center of map - center: null, + /** + * @readOnly + * @type {module:echarts/ExtensionAPI} + */ + this.api = api; - zoom: 1, + /** + * @readOnly + * @type {module:echarts/component/brush/BrushModel} + */ + this.model; - scaleLimit: null, + /** + * @private + * @type {module:echarts/component/helper/BrushController} + */ + (this._brushController = new BrushController(api.getZr())) + .on('brush', zrUtil.bind(this._onBrush, this)) + .mount(); + }, - // selectedMode: false + /** + * @override + */ + render: function (brushModel) { + this.model = brushModel; + return updateController.apply(this, arguments); + }, - label: { - normal: { - show: false, - textStyle: { - color: '#000' - } - }, - emphasis: { - show: true, - textStyle: { - color: 'rgb(100,0,0)' - } - } - }, + /** + * @override + */ + updateView: updateController, - itemStyle: { - normal: { - // color: 各异, - borderWidth: 0.5, - borderColor: '#444', - color: '#eee' - }, - emphasis: { // 也是选中样式 - color: 'rgba(255,215,0,0.8)' - } - }, + /** + * @override + */ + updateLayout: updateController, - regions: [] - }, + /** + * @override + */ + updateVisual: updateController, /** - * Get model of region - * @param {string} name - * @return {module:echarts/model/Model} + * @override */ - getRegionModel: function (name) { - return this._optionModelMap[name]; + dispose: function () { + this._brushController.dispose(); }, /** - * Format label - * @param {string} name Region name - * @param {string} [status='normal'] 'normal' or 'emphasis' - * @return {string} + * @private */ - getFormattedLabel: function (name, status) { - var formatter = this.get('label.' + status + '.formatter'); - var params = { - name: name - }; - if (typeof formatter === 'function') { - params.status = status; - return formatter(params); - } - else if (typeof formatter === 'string') { - var serName = params.seriesName; - return formatter.replace('{a}', serName != null ? serName : ''); - } - }, + _onBrush: function (areas, opt) { + var modelId = this.model.id; - setZoom: function (zoom) { - this.option.zoom = zoom; - }, + this.model.brushTargetManager.setOutputRanges(areas, this.ecModel); - setCenter: function (center) { - this.option.center = center; + // Action is not dispatched on drag end, because the drag end + // emits the same params with the last drag move event, and + // may have some delay when using touch pad, which makes + // animation not smooth (when using debounce). + (!opt.isEnd || opt.removeOnClick) && this.api.dispatchAction({ + type: 'brush', + brushId: modelId, + areas: zrUtil.clone(areas), + $from: modelId + }); } + }); - zrUtil.mixin(GeoModel, selectableMixin); + function updateController(brushModel, ecModel, api, payload) { + // Do not update controller when drawing. + (!payload || payload.$from !== brushModel.id) && this._brushController + .setPanels(brushModel.brushTargetManager.makePanelOpts()) + .enableBrush(brushModel.brushOption) + .updateCovers(brushModel.areas.slice()); + } - module.exports = GeoModel; /***/ }, -/* 316 */ +/* 342 */ +/***/ function(module, exports, __webpack_require__) { + + /** + * @file Brush action + */ + + + var echarts = __webpack_require__(1); + + /** + * payload: { + * brushIndex: number, or, + * brushId: string, or, + * brushName: string, + * globalRanges: Array + * } + */ + echarts.registerAction( + {type: 'brush', event: 'brush', update: 'updateView'}, + function (payload, ecModel) { + ecModel.eachComponent({mainType: 'brush', query: payload}, function (brushModel) { + brushModel.setAreas(payload.areas); + }); + } + ); + + /** + * payload: { + * brushComponents: [ + * { + * brushId, + * brushIndex, + * brushName, + * series: [ + * { + * seriesId, + * seriesIndex, + * seriesName, + * rawIndices: [21, 34, ...] + * }, + * ... + * ] + * }, + * ... + * ] + * } + */ + echarts.registerAction( + {type: 'brushSelect', event: 'brushSelected', update: 'none'}, + function () {} + ); + + +/***/ }, +/* 343 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; - var MapDraw = __webpack_require__(176); + var featureManager = __webpack_require__(344); + var zrUtil = __webpack_require__(4); - module.exports = __webpack_require__(1).extendComponentView({ + function Brush(model, ecModel, api) { + this.model = model; + this.ecModel = ecModel; + this.api = api; - type: 'geo', + /** + * @private + * @type {string} + */ + this._brushType; - init: function (ecModel, api) { - var mapDraw = new MapDraw(api, true); - this._mapDraw = mapDraw; + /** + * @private + * @type {string} + */ + this._brushMode; + } - this.group.add(mapDraw.group); + Brush.defaultOption = { + show: true, + type: ['rect', 'polygon', 'lineX', 'lineY', 'keep', 'clear'], + icon: { + rect: 'M7.3,34.7 M0.4,10V-0.2h9.8 M89.6,10V-0.2h-9.8 M0.4,60v10.2h9.8 M89.6,60v10.2h-9.8 M12.3,22.4V10.5h13.1 M33.6,10.5h7.8 M49.1,10.5h7.8 M77.5,22.4V10.5h-13 M12.3,31.1v8.2 M77.7,31.1v8.2 M12.3,47.6v11.9h13.1 M33.6,59.5h7.6 M49.1,59.5 h7.7 M77.5,47.6v11.9h-13', // jshint ignore:line + polygon: 'M55.2,34.9c1.7,0,3.1,1.4,3.1,3.1s-1.4,3.1-3.1,3.1 s-3.1-1.4-3.1-3.1S53.5,34.9,55.2,34.9z M50.4,51c1.7,0,3.1,1.4,3.1,3.1c0,1.7-1.4,3.1-3.1,3.1c-1.7,0-3.1-1.4-3.1-3.1 C47.3,52.4,48.7,51,50.4,51z M55.6,37.1l1.5-7.8 M60.1,13.5l1.6-8.7l-7.8,4 M59,19l-1,5.3 M24,16.1l6.4,4.9l6.4-3.3 M48.5,11.6 l-5.9,3.1 M19.1,12.8L9.7,5.1l1.1,7.7 M13.4,29.8l1,7.3l6.6,1.6 M11.6,18.4l1,6.1 M32.8,41.9 M26.6,40.4 M27.3,40.2l6.1,1.6 M49.9,52.1l-5.6-7.6l-4.9-1.2', // jshint ignore:line + lineX: 'M15.2,30 M19.7,15.6V1.9H29 M34.8,1.9H40.4 M55.3,15.6V1.9H45.9 M19.7,44.4V58.1H29 M34.8,58.1H40.4 M55.3,44.4 V58.1H45.9 M12.5,20.3l-9.4,9.6l9.6,9.8 M3.1,29.9h16.5 M62.5,20.3l9.4,9.6L62.3,39.7 M71.9,29.9H55.4', // jshint ignore:line + lineY: 'M38.8,7.7 M52.7,12h13.2v9 M65.9,26.6V32 M52.7,46.3h13.2v-9 M24.9,12H11.8v9 M11.8,26.6V32 M24.9,46.3H11.8v-9 M48.2,5.1l-9.3-9l-9.4,9.2 M38.9-3.9V12 M48.2,53.3l-9.3,9l-9.4-9.2 M38.9,62.3V46.4', // jshint ignore:line + keep: 'M4,10.5V1h10.3 M20.7,1h6.1 M33,1h6.1 M55.4,10.5V1H45.2 M4,17.3v6.6 M55.6,17.3v6.6 M4,30.5V40h10.3 M20.7,40 h6.1 M33,40h6.1 M55.4,30.5V40H45.2 M21,18.9h62.9v48.6H21V18.9z', // jshint ignore:line + clear: 'M22,14.7l30.9,31 M52.9,14.7L22,45.7 M4.7,16.8V4.2h13.1 M26,4.2h7.8 M41.6,4.2h7.8 M70.3,16.8V4.2H57.2 M4.7,25.9v8.6 M70.3,25.9v8.6 M4.7,43.2v12.6h13.1 M26,55.8h7.8 M41.6,55.8h7.8 M70.3,43.2v12.6H57.2' // jshint ignore:line }, + title: { + rect: '矩形选择', + polygon: '圈选', + lineX: '横向选择', + lineY: '纵向选择', + keep: '保持选择', + clear: '清除选择' + } + }; - render: function (geoModel, ecModel, api, payload) { - // Not render if it is an toggleSelect action from self - if (payload && payload.type === 'geoToggleSelect' - && payload.from === this.uid - ) { - return; - } + var proto = Brush.prototype; - var mapDraw = this._mapDraw; - if (geoModel.get('show')) { - mapDraw.draw(geoModel, ecModel, api, this, payload); - } - else { - this._mapDraw.group.removeAll(); + proto.render = + proto.updateView = + proto.updateLayout = function (featureModel, ecModel, api) { + var brushType; + var brushMode; + var isBrushed; + + ecModel.eachComponent({mainType: 'brush'}, function (brushModel) { + brushType = brushModel.brushType; + brushMode = brushModel.brushOption.brushMode || 'single'; + isBrushed |= brushModel.areas.length; + }); + this._brushType = brushType; + this._brushMode = brushMode; + + zrUtil.each(featureModel.get('type', true), function (type) { + featureModel.setIconStatus( + type, + ( + type === 'keep' + ? brushMode === 'multiple' + : type === 'clear' + ? isBrushed + : type === brushType + ) ? 'emphasis' : 'normal' + ); + }); + }; + + proto.getIcons = function () { + var model = this.model; + var availableIcons = model.get('icon', true); + var icons = {}; + zrUtil.each(model.get('type', true), function (type) { + if (availableIcons[type]) { + icons[type] = availableIcons[type]; } + }); + return icons; + }; - this.group.silent = geoModel.get('silent'); - }, + proto.onclick = function (ecModel, api, type) { + var api = this.api; + var brushType = this._brushType; + var brushMode = this._brushMode; - dispose: function () { - this._mapDraw && this._mapDraw.remove(); + if (type === 'clear') { + api.dispatchAction({ + type: 'brush', + // Clear all areas of all brush components. + areas: [] + }); + } + else { + api.dispatchAction({ + type: 'takeGlobalCursor', + key: 'brush', + brushOption: { + brushType: type === 'keep' + ? brushType + : (brushType === type ? false : type), + brushMode: type === 'keep' + ? (brushMode === 'multiple' ? 'single' : 'multiple') + : brushMode + } + }); } + }; - }); + featureManager.register('brush', Brush); + module.exports = Brush; -/***/ }, -/* 317 */ -/***/ function(module, exports, __webpack_require__) { - /** - * Brush component entry - */ +/***/ }, +/* 344 */ +/***/ function(module, exports) { + 'use strict'; - __webpack_require__(1).registerPreprocessor( - __webpack_require__(318) - ); - __webpack_require__(319); - __webpack_require__(323); - __webpack_require__(324); - __webpack_require__(325); + var features = {}; - __webpack_require__(326); + module.exports = { + register: function (name, ctor) { + features[name] = ctor; + }, + get: function (name) { + return features[name]; + } + }; /***/ }, -/* 318 */ +/* 345 */ /***/ function(module, exports, __webpack_require__) { + 'use strict'; /** - * @file brush preprocessor + * @file calendar.js + * @author dxh */ - var zrUtil = __webpack_require__(4); - - var DEFAULT_TOOLBOX_BTNS = ['rect', 'polygon', 'keep', 'clear']; - - module.exports = function (option, isNew) { - var brushComponents = option && option.brush; - if (!zrUtil.isArray(brushComponents)) { - brushComponents = brushComponents ? [brushComponents] : []; - } - - if (!brushComponents.length) { - return; - } - var brushComponentSpecifiedBtns = []; + __webpack_require__(346); + __webpack_require__(347); + __webpack_require__(348); - zrUtil.each(brushComponents, function (brushOpt) { - var tbs = brushOpt.hasOwnProperty('toolbox') - ? brushOpt.toolbox : []; - if (tbs instanceof Array) { - brushComponentSpecifiedBtns = brushComponentSpecifiedBtns.concat(tbs); - } - }); - var toolbox = option && option.toolbox; - if (zrUtil.isArray(toolbox)) { - toolbox = toolbox[0]; - } - if (!toolbox) { - toolbox = {feature: {}}; - option.toolbox = [toolbox]; - } +/***/ }, +/* 346 */ +/***/ function(module, exports, __webpack_require__) { - var toolboxFeature = (toolbox.feature || (toolbox.feature = {})); - var toolboxBrush = toolboxFeature.brush || (toolboxFeature.brush = {}); - var brushTypes = toolboxBrush.type || (toolboxBrush.type = []); + 'use strict'; - brushTypes.push.apply(brushTypes, brushComponentSpecifiedBtns); - removeDuplicate(brushTypes); + var layout = __webpack_require__(21); + var numberUtil = __webpack_require__(7); + var zrUtil = __webpack_require__(4); - if (isNew && !brushTypes.length) { - brushTypes.push.apply(brushTypes, DEFAULT_TOOLBOX_BTNS); - } - }; + // (24*60*60*1000) + var ONE_DAY = 86400000; - function removeDuplicate(arr) { - var map = {}; - zrUtil.each(arr, function (val) { - map[val] = 1; - }); - arr.length = 0; - zrUtil.each(map, function (flag, val) { - arr.push(val); - }); + /** + * Calendar + * + * @constructor + * + * @param {Object} calendarModel calendarModel + * @param {Object} ecModel ecModel + * @param {Object} api api + */ + function Calendar(calendarModel, ecModel, api) { + this._model = calendarModel; } + Calendar.prototype = { + constructor: Calendar, -/***/ }, -/* 319 */ -/***/ function(module, exports, __webpack_require__) { + type: 'calendar', - /** - * @file Brush visual coding. - */ + dimensions: ['time', 'value'], + // Required in createListFromData + getDimensionsInfo: function () { + return [{name: 'time', type: 'time'}]; + }, - var echarts = __webpack_require__(1); - var visualSolution = __webpack_require__(320); - var zrUtil = __webpack_require__(4); - var BoundingRect = __webpack_require__(9); - var selector = __webpack_require__(321); - var throttle = __webpack_require__(81); - var brushHelper = __webpack_require__(322); + getHandledRangeInfo: function () { + return this._rangeInfo; + }, - var STATE_LIST = ['inBrush', 'outOfBrush']; - var DISPATCH_METHOD = '__ecBrushSelect'; - var DISPATCH_FLAG = '__ecInBrushSelectEvent'; - var PRIORITY_BRUSH = echarts.PRIORITY.VISUAL.BRUSH; + getModel: function () { + return this._model; + }, - /** - * Layout for visual, the priority higher than other layout, and before brush visual. - */ - echarts.registerLayout(PRIORITY_BRUSH, function (ecModel, api, payload) { - ecModel.eachComponent({mainType: 'brush'}, function (brushModel) { + getRect: function () { + return this._rect; + }, - payload && payload.type === 'takeGlobalCursor' && brushModel.setBrushOption( - payload.key === 'brush' ? payload.brushOption : {brushType: false} - ); + getCellWidth: function () { + return this._sw; + }, - brushModel.coordInfoList = brushHelper.makeCoordInfoList(brushModel.option, ecModel); + getCellHeight: function () { + return this._sh; + }, - brushHelper.parseInputRanges(brushModel, ecModel); - }); - }); + getOrient: function () { + return this._orient; + }, - /** - * Register the visual encoding if this modules required. - */ - echarts.registerVisual(PRIORITY_BRUSH, function (ecModel, api, payload) { + /** + * getFirstDayOfWeek + * + * @example + * 0 : start at Sunday + * 1 : start at Monday + * + * @return {number} + */ + getFirstDayOfWeek: function () { + return this._firstDayOfWeek; + }, - var brushSelected = []; - var throttleType; - var throttleDelay; + /** + * get date info + * + * @param {string|number} date date + * @return {Object} info + */ + getDateInfo: function (date) { - ecModel.eachComponent({mainType: 'brush'}, function (brushModel, brushIndex) { + date = numberUtil.parseDate(date); - var thisBrushSelected = { - brushId: brushModel.id, - brushIndex: brushIndex, - brushName: brushModel.name, - areas: zrUtil.clone(brushModel.areas), - selected: [] - }; - // Every brush component exists in event params, convenient - // for user to find by index. - brushSelected.push(thisBrushSelected); + var y = date.getFullYear(); - var brushOption = brushModel.option; - var brushLink = brushOption.brushLink; - var linkedSeriesMap = []; - var selectedDataIndexForLink = []; - var rangeInfoBySeries = []; - var hasBrushExists = 0; + var m = date.getMonth() + 1; + m = m < 10 ? '0' + m : m; - if (!brushIndex) { // Only the first throttle setting works. - throttleType = brushOption.throttleType; - throttleDelay = brushOption.throttleDelay; - } + var d = date.getDate(); + d = d < 10 ? '0' + d : d; - // Add boundingRect and selectors to range. - var areas = zrUtil.map(brushModel.areas, function (area) { - return bindSelector( - zrUtil.defaults( - {boundingRect: boundingRectBuilders[area.brushType](area)}, - area - ) - ); - }); + var day = date.getDay(); - var visualMappings = visualSolution.createVisualMappings( - brushModel.option, STATE_LIST, function (mappingOption) { - mappingOption.mappingMethod = 'fixed'; - } - ); + day = Math.abs((day + 7 - this.getFirstDayOfWeek()) % 7); - zrUtil.isArray(brushLink) && zrUtil.each(brushLink, function (seriesIndex) { - linkedSeriesMap[seriesIndex] = 1; - }); + return { + y: y, + m: m, + d: d, + day: day, + time: date.getTime(), + formatedDate: y + '-' + m + '-' + d, + date: date + }; + }, - function linkOthers(seriesIndex) { - return brushLink === 'all' || linkedSeriesMap[seriesIndex]; + getNextNDay: function (date, n) { + n = n || 0; + if (n === 0) { + return this.getDateInfo(date); } - // If no supported brush or no brush on the series, - // all visuals should be in original state. - function brushed(rangeInfoList) { - return !!rangeInfoList.length; - } + var time = this.getDateInfo(date).time; - /** - * Logic for each series: (If the logic has to be modified one day, do it carefully!) - * - * ( brushed ┬ && ┬hasBrushExist ┬ && linkOthers ) => StepA: ┬record, ┬ StepB: ┬visualByRecord. - * !brushed┘ ├hasBrushExist ┤ └nothing,┘ ├visualByRecord. - * └!hasBrushExist┘ └nothing. - * ( !brushed && ┬hasBrushExist ┬ && linkOthers ) => StepA: nothing, StepB: ┬visualByRecord. - * └!hasBrushExist┘ └nothing. - * ( brushed ┬ && !linkOthers ) => StepA: nothing, StepB: ┬visualByCheck. - * !brushed┘ └nothing. - * ( !brushed && !linkOthers ) => StepA: nothing, StepB: nothing. - */ + return this.getDateInfo(time + ONE_DAY * n); + }, - // Step A - ecModel.eachSeries(function (seriesModel, seriesIndex) { - var rangeInfoList = rangeInfoBySeries[seriesIndex] = []; + update: function (ecModel, api) { - seriesModel.subType === 'parallel' - ? stepAParallel(seriesModel, seriesIndex, rangeInfoList) - : stepAOthers(seriesModel, seriesIndex, rangeInfoList); - }); + this._firstDayOfWeek = this._model.getModel('dayLabel').get('firstDay'); + this._orient = this._model.get('orient'); + this._lineWidth = this._model.getModel('itemStyle.normal').getItemStyle().lineWidth || 0; - function stepAParallel(seriesModel, seriesIndex) { - var coordSys = seriesModel.coordinateSystem; - hasBrushExists |= coordSys.hasAxisbrushed(); - linkOthers(seriesIndex) && coordSys.eachActiveState( - seriesModel.getData(), - function (activeState, dataIndex) { - activeState === 'active' && (selectedDataIndexForLink[dataIndex] = 1); - } - ); - } + this._rangeInfo = this._getRangeInfo(this._initRangeOption()); + var weeks = this._rangeInfo.weeks || 1; + var whNames = ['width', 'height']; + var cellSize = this._model.get('cellSize').slice(); + var layoutParams = this._model.getBoxLayoutParams(); + var cellNumbers = this._orient === 'horizontal' ? [weeks, 7] : [7, weeks]; - function stepAOthers(seriesModel, seriesIndex, rangeInfoList) { - var selectorsByBrushType = getSelectorsByBrushType(seriesModel); - if (!selectorsByBrushType || brushModelNotControll(brushModel, seriesIndex)) { - return; + zrUtil.each([0, 1], function (idx) { + if (cellSizeSpecified(cellSize, idx)) { + layoutParams[whNames[idx]] = cellSize[idx] * cellNumbers[idx]; } + }); - zrUtil.each(areas, function (area) { - selectorsByBrushType[area.brushType] - && brushHelper.controlSeries(area, brushModel, seriesModel) - && rangeInfoList.push(area); - hasBrushExists |= brushed(rangeInfoList); - }); + var whGlobal = { + width: api.getWidth(), + height: api.getHeight() + }; + var calendarRect = this._rect = layout.getLayoutRect(layoutParams, whGlobal); - if (linkOthers(seriesIndex) && brushed(rangeInfoList)) { - var data = seriesModel.getData(); - data.each(function (dataIndex) { - if (checkInRange(selectorsByBrushType, rangeInfoList, data, dataIndex)) { - selectedDataIndexForLink[dataIndex] = 1; - } - }); + zrUtil.each([0, 1], function (idx) { + if (!cellSizeSpecified(cellSize, idx)) { + cellSize[idx] = calendarRect[whNames[idx]] / cellNumbers[idx]; } - } - - // Step B - ecModel.eachSeries(function (seriesModel, seriesIndex) { - var seriesBrushSelected = { - seriesId: seriesModel.id, - seriesIndex: seriesIndex, - seriesName: seriesModel.name, - dataIndex: [] - }; - // Every series exists in event params, convenient - // for user to find series by seriesIndex. - thisBrushSelected.selected.push(seriesBrushSelected); - - var selectorsByBrushType = getSelectorsByBrushType(seriesModel); - var rangeInfoList = rangeInfoBySeries[seriesIndex]; - - var data = seriesModel.getData(); - var getValueState = linkOthers(seriesIndex) - ? function (dataIndex) { - return selectedDataIndexForLink[dataIndex] - ? (seriesBrushSelected.dataIndex.push(data.getRawIndex(dataIndex)), 'inBrush') - : 'outOfBrush'; - } - : function (dataIndex) { - return checkInRange(selectorsByBrushType, rangeInfoList, data, dataIndex) - ? (seriesBrushSelected.dataIndex.push(data.getRawIndex(dataIndex)), 'inBrush') - : 'outOfBrush'; - }; - - // If no supported brush or no brush, all visuals are in original state. - (linkOthers(seriesIndex) ? hasBrushExists : brushed(rangeInfoList)) - && visualSolution.applyVisual( - STATE_LIST, visualMappings, data, getValueState - ); }); - }); + function cellSizeSpecified(cellSize, idx) { + return cellSize[idx] != null && cellSize[idx] !== 'auto'; + } - dispatchAction(api, throttleType, throttleDelay, brushSelected, payload); - }); + this._sw = cellSize[0]; + this._sh = cellSize[1]; + }, - function dispatchAction(api, throttleType, throttleDelay, brushSelected, payload) { - // This event will not be triggered when `setOpion`, otherwise dead lock may - // triggered when do `setOption` in event listener, which we do not find - // satisfactory way to solve yet. Some considered resolutions: - // (a) Diff with prevoius selected data ant only trigger event when changed. - // But store previous data and diff precisely (i.e., not only by dataIndex, but - // also detect value changes in selected data) might bring complexity or fragility. - // (b) Use spectial param like `silent` to suppress event triggering. - // But such kind of volatile param may be weird in `setOption`. - if (!payload) { - return; - } - var zr = api.getZr(); - if (zr[DISPATCH_FLAG]) { - return; - } + /** + * Convert a time data(time, value) item to (x, y) point. + * + * @override + * @param {Array} data data + * @param {boolean} noClip out of range + * @return {Array} point + */ + dataToPoint: function (data, noClip) { - if (!zr[DISPATCH_METHOD]) { - zr[DISPATCH_METHOD] = doDispatch; - } + var dayInfo = this.getDateInfo(data[0]); + var range = this._rangeInfo; + var date = dayInfo.formatedDate; - var fn = throttle.createOrUpdate(zr, DISPATCH_METHOD, throttleDelay, throttleType); + // if not in range return [NaN, NaN] + if (!noClip && !(dayInfo.time >= range.start.time && dayInfo.time <= range.end.time)) { + return [NaN, NaN]; + } - fn(api, brushSelected); - } + var week = dayInfo.day; + var nthWeek = this._getRangeInfo([range.start.time, date]).weeks; - function doDispatch(api, brushSelected) { - if (!api.isDisposed()) { - var zr = api.getZr(); - zr[DISPATCH_FLAG] = true; - api.dispatchAction({ - type: 'brushSelect', - batch: brushSelected - }); - zr[DISPATCH_FLAG] = false; - } - } + if (this._orient === 'vertical') { + return [ + this._rect.x + week * this._sw + this._sw / 2, + this._rect.y + (nthWeek - 1) * this._sh + this._sh / 2 + ]; - function checkInRange(selectorsByBrushType, rangeInfoList, data, dataIndex) { - var itemLayout = data.getItemLayout(dataIndex); - for (var i = 0, len = rangeInfoList.length; i < len; i++) { - var area = rangeInfoList[i]; - if (selectorsByBrushType[area.brushType]( - itemLayout, area.selectors, area - )) { - return true; } - } - } - - function getSelectorsByBrushType(seriesModel) { - var brushSelector = seriesModel.brushSelector; - if (zrUtil.isString(brushSelector)) { - var sels = []; - zrUtil.each(selector, function (selectorsByElementType, brushType) { - sels[brushType] = selectorsByElementType[brushSelector]; - }); - return sels; - } - else if (zrUtil.isFunction(brushSelector)) { - var bSelector = {}; - zrUtil.each(selector, function (sel, brushType) { - bSelector[brushType] = brushSelector; - }); - return bSelector; - } - return brushSelector; - } - function brushModelNotControll(brushModel, seriesIndex) { - var seriesIndices = brushModel.option.seriesIndex; - return seriesIndices != null - && seriesIndices !== 'all' - && ( - zrUtil.isArray(seriesIndices) - ? zrUtil.indexOf(seriesIndices, seriesIndex) < 0 - : seriesIndex !== seriesIndices - ); - } - - function bindSelector(area) { - var selectors = area.selectors = {}; - zrUtil.each(selector[area.brushType], function (selFn, elType) { - // Do not use function binding or curry for performance. - selectors[elType] = function (itemLayout) { - return selFn(itemLayout, selectors, area); - }; - }); - return area; - } + return [ + this._rect.x + (nthWeek - 1) * this._sw + this._sw / 2, + this._rect.y + week * this._sh + this._sh / 2 + ]; - var boundingRectBuilders = { + }, - lineX: zrUtil.noop, + /** + * Convert a (x, y) point to time data + * + * @override + * @param {string} point point + * @return {string} data + */ + pointToData: function (point) { - lineY: zrUtil.noop, + var date = this.pointToDate(point); - rect: function (area) { - return getBoundingRectFromMinMax(area.range); + return date && date.time; }, - polygon: function (area) { - var minMax; - var range = area.range; + /** + * Convert a time date item to (x, y) four point. + * + * @param {Array} data date[0] is date + * @param {boolean} noClip out of range + * @return {Object} point + */ + dataToRect: function (data, noClip) { - for (var i = 0, len = range.length; i < len; i++) { - minMax = minMax || [[Infinity, -Infinity], [Infinity, -Infinity]]; - var rg = range[i]; - rg[0] < minMax[0][0] && (minMax[0][0] = rg[0]); - rg[0] > minMax[0][1] && (minMax[0][1] = rg[0]); - rg[1] < minMax[1][0] && (minMax[1][0] = rg[1]); - rg[1] > minMax[1][1] && (minMax[1][1] = rg[1]); - } + var point = this.dataToPoint(data, noClip); - return minMax && getBoundingRectFromMinMax(minMax); - } - }; + return { + contentShape: { + x: point[0] - (this._sw - this._lineWidth) / 2, + y: point[1] - (this._sh - this._lineWidth) / 2, + width: this._sw - this._lineWidth, + height: this._sh - this._lineWidth + }, - function getBoundingRectFromMinMax(minMax) { - return new BoundingRect( - minMax[0][0], - minMax[1][0], - minMax[0][1] - minMax[0][0], - minMax[1][1] - minMax[1][0] - ); - } + center: point, + tl: [ + point[0] - this._sw / 2, + point[1] - this._sh / 2 + ], + tr: [ + point[0] + this._sw / 2, + point[1] - this._sh / 2 + ], -/***/ }, -/* 320 */ -/***/ function(module, exports, __webpack_require__) { + br: [ + point[0] + this._sw / 2, + point[1] + this._sh / 2 + ], - /** - * @file Visual solution, for consistent option specification. - */ + bl: [ + point[0] - this._sw / 2, + point[1] + this._sh / 2 + ] + }; + }, - var zrUtil = __webpack_require__(4); - var VisualMapping = __webpack_require__(195); - var each = zrUtil.each; + /** + * Convert a (x, y) point to time date + * + * @param {string} point point + * @return {Object} date + */ + pointToDate: function (point) { + var nthX = Math.floor((point[0] - this._rect.x) / this._sw) + 1; + var nthY = Math.floor((point[1] - this._rect.y) / this._sh) + 1; + var range = this._rangeInfo.range; - function hasKeys(obj) { - if (obj) { - for (var name in obj){ - if (obj.hasOwnProperty(name)) { - return true; - } + if (this._orient === 'vertical') { + return this._getDateByWeeksAndDay(nthY, nthX - 1, range); } - } - } - var visualSolution = { + return this._getDateByWeeksAndDay(nthX, nthY - 1, range); + }, /** - * @param {Object} option - * @param {Array.} stateList - * @param {Function} [supplementVisualOption] - * @return {Object} visualMappings > + * @override + * @implements + * see {module:echarts/CoodinateSystem} */ - createVisualMappings: function (option, stateList, supplementVisualOption) { - var visualMappings = {}; - - each(stateList, function (state) { - var mappings = visualMappings[state] = createMappings(); - - each(option[state], function (visualData, visualType) { - if (!VisualMapping.isValidType(visualType)) { - return; - } - var mappingOption = { - type: visualType, - visual: visualData - }; - supplementVisualOption && supplementVisualOption(mappingOption, state); - mappings[visualType] = new VisualMapping(mappingOption); - - // Prepare a alpha for opacity, for some case that opacity - // is not supported, such as rendering using gradient color. - if (visualType === 'opacity') { - mappingOption = zrUtil.clone(mappingOption); - mappingOption.type = 'colorAlpha'; - mappings.__hidden.__alphaForOpacity = new VisualMapping(mappingOption); - } - }); - }); - - return visualMappings; - - function createMappings() { - var Creater = function () {}; - // Make sure hidden fields will not be visited by - // object iteration (with hasOwnProperty checking). - Creater.prototype.__hidden = Creater.prototype; - var obj = new Creater(); - return obj; - } - }, + convertToPixel: zrUtil.curry(doConvert, 'dataToPoint'), /** - * @param {Object} thisOption - * @param {Object} newOption - * @param {Array.} keys + * @override + * @implements + * see {module:echarts/CoodinateSystem} */ - replaceVisualOption: function (thisOption, newOption, keys) { - // Visual attributes merge is not supported, otherwise it - // brings overcomplicated merge logic. See #2853. So if - // newOption has anyone of these keys, all of these keys - // will be reset. Otherwise, all keys remain. - var has; - zrUtil.each(keys, function (key) { - if (newOption.hasOwnProperty(key) && hasKeys(newOption[key])) { - has = true; - } - }); - has && zrUtil.each(keys, function (key) { - if (newOption.hasOwnProperty(key) && hasKeys(newOption[key])) { - thisOption[key] = zrUtil.clone(newOption[key]); - } - else { - delete thisOption[key]; - } - }); - }, + convertFromPixel: zrUtil.curry(doConvert, 'pointToData'), /** - * @param {Array.} stateList - * @param {Object} visualMappings > - * @param {module:echarts/data/List} list - * @param {Function} getValueState param: valueOrIndex, return: state. - * @param {object} [scope] Scope for getValueState - * @param {string} [dimension] Concrete dimension, if used. + * initRange + * + * @private + * @return {Array} [start, end] */ - applyVisual: function (stateList, visualMappings, data, getValueState, scope, dimension) { - var visualTypesMap = {}; - zrUtil.each(stateList, function (state) { - var visualTypes = VisualMapping.prepareVisualTypes(visualMappings[state]); - visualTypesMap[state] = visualTypes; - }); + _initRangeOption: function () { + var range = this._model.get('range'); - var dataIndex; + var rg = range; - function getVisual(key) { - return data.getItemVisual(dataIndex, key); + if (zrUtil.isArray(rg) && rg.length === 1) { + rg = rg[0]; } - function setVisual(key, value) { - data.setItemVisual(dataIndex, key, value); + if (/^\d{4}$/.test(rg)) { + range = [rg + '-01-01', rg + '-12-31']; } - if (dimension == null) { - data.each(eachItem, true); - } - else { - data.each([dimension], eachItem, true); - } + if (/^\d{4}[\/|-]\d{1,2}$/.test(rg)) { - function eachItem(valueOrIndex, index) { - dataIndex = dimension == null ? valueOrIndex : index; + var start = this.getDateInfo(rg); + var firstDay = start.date; + firstDay.setMonth(firstDay.getMonth() + 1); - var rawDataItem = data.getRawDataItem(dataIndex); - // Consider performance - if (rawDataItem && rawDataItem.visualMap === false) { - return; - } + var end = this.getNextNDay(firstDay, -1); + range = [start.formatedDate, end.formatedDate]; + } - var valueState = getValueState.call(scope, valueOrIndex); - var mappings = visualMappings[valueState]; - var visualTypes = visualTypesMap[valueState]; + if (/^\d{4}[\/|-]\d{1,2}[\/|-]\d{1,2}$/.test(rg)) { + range = [rg, rg]; + } - for (var i = 0, len = visualTypes.length; i < len; i++) { - var type = visualTypes[i]; - mappings[type] && mappings[type].applyVisual( - valueOrIndex, getVisual, setVisual - ); - } + var tmp = this._getRangeInfo(range); + + if (tmp.start.time > tmp.end.time) { + range.reverse(); } - } - }; - module.exports = visualSolution; + return range; + }, + /** + * range info + * + * @private + * @param {Array} range range ['2017-01-01', '2017-07-08'] + * @return {Object} obj + */ + _getRangeInfo: function (range) { + var start = this.getDateInfo(range[0]); + var end = this.getDateInfo(range[1]); -/***/ }, -/* 321 */ -/***/ function(module, exports, __webpack_require__) { + var allDay = Math.floor(end.time / ONE_DAY) - Math.floor(start.time / ONE_DAY) + 1; - + var weeks = Math.floor((allDay + start.day + 6) / 7); - var polygonContain = __webpack_require__(170).contain; - var BoundingRect = __webpack_require__(9); + return { + range: [start.formatedDate, end.formatedDate], + start: start, + end: end, + allDay: allDay, + weeks: weeks, + fweek: start.day, + lweek: end.day + }; + }, - // Key of the first level is brushType: `line`, `rect`, `polygon`. - // Key of the second level is chart element type: `point`, `rect`. - // See moudule:echarts/component/helper/BrushController - // function param: - // {Object} itemLayout fetch from data.getItemLayout(dataIndex) - // {Object} selectors {point: selector, rect: selector, ...} - // {Object} area {range: [[], [], ..], boudingRect} - // function return: - // {boolean} Whether in the given brush. - var selector = { - lineX: getLineSelectors(0), - lineY: getLineSelectors(1), - rect: { - point: function (itemLayout, selectors, area) { - return area.boundingRect.contain(itemLayout[0], itemLayout[1]); - }, - rect: function (itemLayout, selectors, area) { - return area.boundingRect.intersect(itemLayout); + /** + * get date by nthWeeks and week day in range + * + * @private + * @param {number} nthWeek the week + * @param {number} day the week day + * @param {Array} range [d1, d2] + * @return {Object} + */ + _getDateByWeeksAndDay: function (nthWeek, day, range) { + var rangeInfo = this._getRangeInfo(range); + + if (nthWeek > rangeInfo.weeks + || (nthWeek === 0 && day < rangeInfo.fweek) + || (nthWeek === rangeInfo.weeks && day > rangeInfo.lweek) + ) { + return false; } - }, - polygon: { - point: function (itemLayout, selectors, area) { - return area.boundingRect.contain(itemLayout[0], itemLayout[1]) - && polygonContain(area.range, itemLayout[0], itemLayout[1]); - }, - rect: function (itemLayout, selectors, area) { - // FIXME - // 随意写的,没有考察过效率。 - var points = area.range; - if (points.length <= 1) { - return false; - } + var nthDay = (nthWeek - 1) * 7 - rangeInfo.fweek + day; - var x = itemLayout.x; - var y = itemLayout.y; - var width = itemLayout.width; - var height = itemLayout.height; - var p = points[0]; + var time = rangeInfo.start.time + nthDay * ONE_DAY; + + return this.getDateInfo(time); - if (polygonContain(points, x, y) - || polygonContain(points, x + width, y) - || polygonContain(points, x, y + height) - || polygonContain(points, x + width, y + height) - || BoundingRect.create(itemLayout).contain(p[0], p[1]) - || lineIntersectPolygon(x, y, x + width, y, points) - || lineIntersectPolygon(x, y, x, y + height, points) - || lineIntersectPolygon(x + width, y, x + width, y + height, points) - || lineIntersectPolygon(x, y + height, x + width, y + height, points) - ) { - return true; - } - } } }; - function getLineSelectors(xyIndex) { - var xy = ['x', 'y']; - var wh = ['width', 'height']; + Calendar.dimensions = Calendar.prototype.dimensions; - return { - point: function (itemLayout, selectors, area) { - var range = area.range; - var p = itemLayout[xyIndex]; - return inLineRange(p, range); - }, - rect: function (itemLayout, selectors, area) { - var range = area.range; - return inLineRange(itemLayout[xy[xyIndex]], range) - || inLineRange(itemLayout[xy[xyIndex]] + itemLayout[wh[xyIndex]], range); - } - }; - } + Calendar.getDimensionsInfo = Calendar.prototype.getDimensionsInfo; - function inLineRange(p, range) { - return range[0] <= p && p <= range[1]; - } + Calendar.create = function (ecModel, api) { + var calendarList = []; - // FIXME - // 随意写的,没考察过效率。 - function lineIntersectPolygon(lx, ly, l2x, l2y, points) { - for (var i = 0, p2 = points[points.length - 1]; i < points.length; i++) { - var p = points[i]; - if (lineIntersect(lx, ly, l2x, l2y, p[0], p[1], p2[0], p2[1])) { - return true; + ecModel.eachComponent('calendar', function (calendarModel) { + var calendar = new Calendar(calendarModel, ecModel, api); + calendarList.push(calendar); + calendarModel.coordinateSystem = calendar; + }); + + ecModel.eachSeries(function (calendarSeries) { + if (calendarSeries.get('coordinateSystem') === 'calendar') { + // Inject coordinate system + calendarSeries.coordinateSystem = calendarList[calendarSeries.get('calendarIndex') || 0]; } - p2 = p; - } - } + }); + return calendarList; + }; - // Code from with some fix. - // See - function lineIntersect(a1x, a1y, a2x, a2y, b1x, b1y, b2x, b2y) { - var delta = determinant(a2x - a1x, b1x - b2x, a2y - a1y, b1y - b2y); - if (nearZero(delta)) { // parallel - return false; - } - var namenda = determinant(b1x - a1x, b1x - b2x, b1y - a1y, b1y - b2y) / delta; - if (namenda < 0 || namenda > 1) { - return false; - } - var miu = determinant(a2x - a1x, b1x - a1x, a2y - a1y, b1y - a1y) / delta; - if (miu < 0 || miu > 1) { - return false; - } - return true; - } + function doConvert(methodName, ecModel, finder, value) { + var calendarModel = finder.calendarModel; + var seriesModel = finder.seriesModel; - function nearZero(val) { - return val <= (1e-6) && val >= -(1e-6); - } + var coordSys = calendarModel + ? calendarModel.coordinateSystem + : seriesModel + ? seriesModel.coordinateSystem + : null; - function determinant(v1, v2, v3, v4) { - return v1 * v4 - v2 * v3; + return coordSys === this ? coordSys[methodName](value) : null; } - module.exports = selector; + __webpack_require__(26).register('calendar', Calendar); + + module.exports = Calendar; /***/ }, -/* 322 */ +/* 347 */ /***/ function(module, exports, __webpack_require__) { - + 'use strict'; + + var ComponentModel = __webpack_require__(19); var zrUtil = __webpack_require__(4); - var graphic = __webpack_require__(43); + var layout = __webpack_require__(21); - var each = zrUtil.each; + var CalendarModel = ComponentModel.extend({ - var helper = {}; + type: 'calendar', - var COMPONENT_NAMES = ['geo', 'xAxis', 'yAxis']; - var PANEL_ID_SPLIT = '--'; - var COORD_CONVERTS = ['dataToPoint', 'pointToData']; + /** + * @type {module:echarts/coord/calendar/Calendar} + */ + coordinateSystem: null, + + defaultOption: { + zlevel: 0, + z: 2, + left: 80, + top: 60, - helper.parseOutputRanges = function (areas, coordInfoList, ecModel, rangesCoordInfo) { - each(areas, function (area, index) { - var panelId = area.panelId; + cellSize: 20, - if (panelId) { - panelId = panelId.split(PANEL_ID_SPLIT); + // horizontal vertical + orient: 'horizontal', - area[panelId[0] + 'Index'] = +panelId[1]; + // month separate line style + splitLine: { + show: true, + lineStyle: { + color: '#000', + width: 1, + type: 'solid' + } + }, - var coordInfo = findCoordInfo(area, coordInfoList); - area.coordRange = coordConvert[area.brushType]( - 1, coordInfo, area.range - ); - rangesCoordInfo && (rangesCoordInfo[index] = coordInfo); - } - }); - }; + // rect style temporarily unused emphasis + itemStyle: { + normal: { + color: '#fff', + borderWidth: 1, + borderColor: '#ccc' + } + }, - helper.parseInputRanges = function (brushModel, ecModel) { - each(brushModel.areas, function (area) { - var coordInfo = findCoordInfo(area, brushModel.coordInfoList); + // week text style + dayLabel: { + show: true, - if (true) { - zrUtil.assert( - !coordInfo || coordInfo === true || area.coordRange, - 'coordRange must be specified when coord index specified.' - ); - zrUtil.assert( - !coordInfo || coordInfo !== true || area.range, - 'range must be specified.' - ); - } + // a week first day + firstDay: 0, - area.range = area.range || []; + // start end + position: 'start', + margin: '50%', // 50% of cellSize + nameMap: 'en', + textStyle: { + color: '#000' + } + }, - // convert coordRange to global range and set panelId. - if (coordInfo && coordInfo !== true) { - area.range = coordConvert[area.brushType]( - 0, coordInfo, area.coordRange - ); - area.panelId = coordInfo.panelId; - } - }); - }; + // month text style + monthLabel: { + show: true, - helper.makePanelOpts = function (coordInfoList) { - var panelOpts = []; + // start end + position: 'start', + margin: 5, - each(coordInfoList, function (coordInfo) { - var coordSys = coordInfo.coordSys; - var rect; + // center or left + align: 'center', - if (coordInfo.geoIndex >= 0) { - rect = coordSys.getBoundingRect().clone(); - // geo roam and zoom transform - rect.applyTransform(graphic.getTransform(coordSys)); - } - else { // xAxis or yAxis - // grid is not Transformable. - rect = coordSys.grid.getRect().clone(); + // cn en [] + nameMap: 'en', + formatter: null, + textStyle: { + color: '#000' + } + }, + + // year text style + yearLabel: { + show: true, + + // top bottom left right + position: null, + margin: 30, + formatter: null, + textStyle: { + color: '#ccc', + fontFamily: 'sans-serif', + fontWeight: 'bolder', + fontSize: 20 + } } + }, - panelOpts.push({panelId: coordInfo.panelId, rect: rect}); - }); + /** + * @override + */ + init: function (option, parentModel, ecModel, extraOpt) { + var inputPositionParams = layout.getLayoutParams(option); - return panelOpts; - }; + CalendarModel.superApply(this, 'init', arguments); - /** - * @param {Object} option {xAxisIndex, yAxisIndex, geoIndex} - * @param {module:echarts/model/Global} ecModel - * @return {Array.} coordInfoList - */ - helper.makeCoordInfoList = function (option, ecModel) { - var coordInfoList = []; + mergeAndNormalizeLayoutParams(option, inputPositionParams); + }, - each(COMPONENT_NAMES, function (componentName) { - var componentIndices = option[componentName + 'Index']; - if (componentIndices == null || componentIndices === 'none') { - return; - } - if (componentIndices !== 'all' && !zrUtil.isArray(componentIndices)) { - componentIndices = [componentIndices]; + /** + * @override + */ + mergeOption: function (option, extraOpt) { + CalendarModel.superApply(this, 'mergeOption', arguments); + + mergeAndNormalizeLayoutParams(this.option, option); + } + }); + + function mergeAndNormalizeLayoutParams(target, raw) { + // Normalize cellSize + var cellSize = target.cellSize; + + if (!zrUtil.isArray(cellSize)) { + cellSize = target.cellSize = [cellSize, cellSize]; + } + else if (cellSize.length === 1) { + cellSize[1] = cellSize[0]; + } + + var ignoreSize = zrUtil.map([0, 1], function (hvIdx) { + // If user have set `width` or both `left` and `right`, cellSize + // will be automatically set to 'auto', otherwise the default + // setting of cellSize will make `width` setting not work. + if (layout.sizeCalculable(raw, hvIdx)) { + cellSize[hvIdx] = 'auto'; } + return cellSize[hvIdx] != null && cellSize[hvIdx] !== 'auto'; + }); - ecModel.eachComponent({mainType: componentName}, function (componentModel, index) { - if (componentIndices !== 'all' && zrUtil.indexOf(componentIndices, index) < 0) { - return; - } + layout.mergeLayoutParam(target, raw, { + type: 'box', ignoreSize: ignoreSize + }); + } - var grid; - var coordSys; + module.exports = CalendarModel; - (componentName === 'xAxis' || componentName === 'yAxis') - ? (grid = componentModel.axis.grid) - : (coordSys = componentModel.coordinateSystem); // geo - var coordInfo; - // Check duplicate and find cartesian when tranval to yAxis. - for (var i = 0, len = coordInfoList.length; i < len; i++) { - var cInfo = coordInfoList[i]; - if (true) { - zrUtil.assert( - cInfo[componentName + 'Index'] != index, - 'Coord should not be defined duplicately: ' + componentName + index - ); - } - // CoordSys is always required for `rect brush` or `polygon brush`. - // If both xAxisIndex and yAxisIndex specified, fetch cartesian by them. - if (componentName === 'yAxis' && !cInfo.yAxis && cInfo.xAxis) { - var aCoordSys = grid.getCartesian(cInfo.xAxisIndex, index); - if (aCoordSys) { // The yAxis and xAxis are in the same cartesian. - coordSys = aCoordSys; - coordInfo = cInfo; - break; - } - } - } - !coordInfo && coordInfoList.push(coordInfo = {}); +/***/ }, +/* 348 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; - coordInfo[componentName] = componentModel; - coordInfo[componentName + 'Index'] = index; - // If both xAxisIndex and yAxisIndex specified, panelId only use yAxisIndex, - // which is enough to index panel. - coordInfo.panelId = componentName + PANEL_ID_SPLIT + index; - coordInfo.coordSys = coordSys - // If only xAxisIndex or only yAxisIndex specified, find its first cartesian. - || grid.getCartesian(coordInfo.xAxisIndex, coordInfo.yAxisIndex); - coordInfo.coordSys - ? (coordInfoList[componentName + 'Has'] = true) - : coordInfoList.pop(); // If a coordInfo exists originally, existance of coordSys is ensured. - }); - }); + var zrUtil = __webpack_require__(4); + var graphic = __webpack_require__(44); + var formatUtil = __webpack_require__(6); + var numberUtil = __webpack_require__(7); - return coordInfoList; + var MONTH_TEXT = { + EN: [ + 'Jan', 'Feb', 'Mar', + 'Apr', 'May', 'Jun', + 'Jul', 'Aug', 'Sep', + 'Oct', 'Nov', 'Dec' + ], + CN: [ + '一月', '二月', '三月', + '四月', '五月', '六月', + '七月', '八月', '九月', + '十月', '十一月', '十二月' + ] }; - helper.controlSeries = function (area, brushModel, seriesModel) { - // Check whether area is bound in coord, and series do not belong to that coord. - // If do not do this check, some brush (like lineX) will controll all axes. - var coordInfo = findCoordInfo(area, brushModel.coordInfoList); - return coordInfo === true || (coordInfo && coordInfo.coordSys === seriesModel.coordinateSystem); + var WEEK_TEXT = { + EN: ['S', 'M', 'T', 'W', 'T', 'F', 'S'], + CN: ['日', '一', '二', '三', '四', '五', '六'] }; - function formatMinMax(minMax) { - minMax[0] > minMax[1] && minMax.reverse(); - return minMax; - } + module.exports = __webpack_require__(1).extendComponentView({ - /** - * If return Object, a coord found. - * If reutrn true, global found. - * Otherwise nothing found. - * - * @param {Object} area {Index} - * @param {Array} coordInfoList - * @return {Obejct|boolean} - */ - function findCoordInfo(area, coordInfoList) { - var isGlobal = true; - for (var j = 0; j < COMPONENT_NAMES.length; j++) { - var indexAttr = COMPONENT_NAMES[j] + 'Index'; - if (area[indexAttr] >= 0) { - isGlobal = false; - for (var i = 0; i < coordInfoList.length; i++) { - if (coordInfoList[i][indexAttr] === area[indexAttr]) { - return coordInfoList[i]; - } - } - } - } - return isGlobal; - } + type: 'calendar', - function axisConvert(axisName, to, coordInfo, coordRange) { - var axis = coordInfo.coordSys.getAxis(axisName); + /** + * top/left line points + * @private + */ + _tlpoints: null, - if (true) { - zrUtil.assert(axis, 'line brush is only available in cartesian (grid).'); - } + /** + * bottom/right line points + * @private + */ + _blpoints: null, - return formatMinMax(zrUtil.map([0, 1], function (i) { - return to - ? axis.coordToData(axis.toLocalCoord(coordRange[i])) - : axis.toGlobalCoord(axis.dataToCoord(coordRange[i])); - })); - } + /** + * first day of month + * @private + */ + _firstDayOfMonth: null, - var coordConvert = { + /** + * first day point of month + * @private + */ + _firstDayPoints: null, - lineX: zrUtil.curry(axisConvert, 'x'), + render: function (calendarModel, ecModel, api) { - lineY: zrUtil.curry(axisConvert, 'y'), + var group = this.group; - rect: function (to, coordInfo, coordRange) { - var coordSys = coordInfo.coordSys; - var xminymin = coordSys[COORD_CONVERTS[to]]([coordRange[0][0], coordRange[1][0]]); - var xmaxymax = coordSys[COORD_CONVERTS[to]]([coordRange[0][1], coordRange[1][1]]); - return [ - formatMinMax([xminymin[0], xmaxymax[0]]), - formatMinMax([xminymin[1], xmaxymax[1]]) - ]; - }, + group.removeAll(); - polygon: function (to, coordInfo, coordRange) { - var coordSys = coordInfo.coordSys; - return zrUtil.map(coordRange, coordSys[COORD_CONVERTS[to]], coordSys); - } - }; + var coordSys = calendarModel.coordinateSystem; - module.exports = helper; + // range info + var rangeData = coordSys.getHandledRangeInfo(); + var orient = coordSys.getOrient(); + this._renderDayRect(calendarModel, rangeData, group); + // _renderLines must be called prior to following function + this._renderLines(calendarModel, rangeData, orient, group); -/***/ }, -/* 323 */ -/***/ function(module, exports, __webpack_require__) { + this._renderYearText(calendarModel, rangeData, orient, group); - /** - * @file Brush model - */ + this._renderMonthText(calendarModel, orient, group); + this._renderWeekText(calendarModel, rangeData, orient, group); + }, - var echarts = __webpack_require__(1); - var zrUtil = __webpack_require__(4); - var visualSolution = __webpack_require__(320); - var Model = __webpack_require__(12); + // render day rect + _renderDayRect: function (calendarModel, rangeData, group) { + var coordSys = calendarModel.coordinateSystem; + var itemRectStyleModel = calendarModel.getModel('itemStyle.normal').getItemStyle(); + var sw = coordSys.getCellWidth(); + var sh = coordSys.getCellHeight(); - var DEFAULT_OUT_OF_BRUSH_COLOR = ['#ddd']; + for (var i = rangeData.start.time; + i <= rangeData.end.time; + i = coordSys.getNextNDay(i, 1).time + ) { - var BrushModel = echarts.extendComponentModel({ + var point = coordSys.dataToRect([i], true).tl; - type: 'brush', + // every rect + var rect = new graphic.Rect({ + shape: { + x: point[0], + y: point[1], + width: sw, + height: sh + }, + style: itemRectStyleModel + }); - dependencies: ['geo', 'grid', 'xAxis', 'yAxis', 'parallel', 'series'], + group.add(rect); + } - /** - * @protected - */ - defaultOption: { - // inBrush: null, - // outOfBrush: null, - toolbox: null, // Default value see preprocessor. - brushLink: null, // Series indices array, broadcast using dataIndex. - // or 'all', which means all series. 'none' or null means no series. - seriesIndex: 'all', // seriesIndex array, specify series controlled by this brush component. - geoIndex: null, // - xAxisIndex: null, - yAxisIndex: null, + }, - brushType: 'rect', // Default brushType, see BrushController. - brushMode: 'single', // Default brushMode, 'single' or 'multiple' - transformable: true, // Default transformable. - brushStyle: { // Default brushStyle - borderWidth: 1, - color: 'rgba(120,140,180,0.3)', - borderColor: 'rgba(120,140,180,0.8)', - width: null // do not use bursh width in line brush, but fetch from grid. - }, + // render separate line + _renderLines: function (calendarModel, rangeData, orient, group) { - throttleType: 'fixRate',// Throttle in brushSelected event. 'fixRate' or 'debounce'. - // If null, no throttle. Valid only in the first brush component - throttleDelay: 0, // Unit: ms, 0 means every event will be triggered. + var self = this; - // FIXME - // 试验效果 - removeOnClick: true - }, + var coordSys = calendarModel.coordinateSystem; - /** - * @readOnly - * @type {Array.} - */ - areas: [], + var lineStyleModel = calendarModel.getModel('splitLine.lineStyle').getLineStyle(); + var show = calendarModel.get('splitLine.show'); - /** - * Current activated brush type. - * If null, brush is inactived. - * see module:echarts/component/helper/BrushController - * @readOnly - * @type {string} - */ - brushType: null, + var lineWidth = lineStyleModel.lineWidth; - /** - * Current brush opt. - * see module:echarts/component/helper/BrushController - * @readOnly - * @type {Object} - */ - brushOption: {}, + this._tlpoints = []; + this._blpoints = []; + this._firstDayOfMonth = []; + this._firstDayPoints = []; - /** - * @readOnly - * @type {Array.} - */ - coordInfoList: [], - optionUpdated: function (newOption, isInit) { - var thisOption = this.option; + var firstDay = rangeData.start; - !isInit && visualSolution.replaceVisualOption( - thisOption, newOption, ['inBrush', 'outOfBrush'] - ); + for (var i = 0; firstDay.time <= rangeData.end.time; i++) { + addPoints(firstDay.formatedDate); - thisOption.inBrush = thisOption.inBrush || {}; - // Always give default visual, consider setOption at the second time. - thisOption.outOfBrush = thisOption.outOfBrush || {color: DEFAULT_OUT_OF_BRUSH_COLOR}; - }, + if (i === 0) { + firstDay = coordSys.getDateInfo(rangeData.start.y + '-' + rangeData.start.m); + } - /** - * If ranges is null/undefined, range state remain. - * - * @param {Array.} [ranges] - */ - setAreas: function (areas) { - if (true) { - zrUtil.assert(zrUtil.isArray(areas)); - zrUtil.each(areas, function (area) { - zrUtil.assert(area.brushType, 'Illegal areas'); - }); + var date = firstDay.date; + date.setMonth(date.getMonth() + 1); + firstDay = coordSys.getDateInfo(date); } - // If ranges is null/undefined, range state remain. - // This helps user to dispatchAction({type: 'brush'}) with no areas - // set but just want to get the current brush select info from a `brush` event. - if (!areas) { - return; + addPoints(coordSys.getNextNDay(rangeData.end.time, 1).formatedDate); + + function addPoints(date) { + + self._firstDayOfMonth.push(coordSys.getDateInfo(date)); + self._firstDayPoints.push(coordSys.dataToRect([date], true).tl); + + var points = self._getLinePointsOfOneWeek(calendarModel, date, orient); + + self._tlpoints.push(points[0]); + self._blpoints.push(points[points.length - 1]); + + show && self._drawSplitline(points, lineStyleModel, group); } - this.areas = zrUtil.map(areas, function (area) { - return this._mergeBrushOption(area); - }, this); + + // render top/left line + show && this._drawSplitline(self._getEdgesPoints(self._tlpoints, lineWidth, orient), lineStyleModel, group); + + // render bottom/right line + show && this._drawSplitline(self._getEdgesPoints(self._blpoints, lineWidth, orient), lineStyleModel, group); + }, - /** - * see module:echarts/component/helper/BrushController - * @param {Object} brushOption - */ - setBrushOption: function (brushOption) { - this.brushOption = this._mergeBrushOption(brushOption); - this.brushType = this.brushOption.brushType; + // get points at both ends + _getEdgesPoints: function (points, lineWidth, orient) { + var rs = [points[0].slice(), points[points.length - 1].slice()]; + var idx = orient === 'horizontal' ? 0 : 1; + + // both ends of the line are extend half lineWidth + rs[0][idx] = rs[0][idx] - lineWidth / 2; + rs[1][idx] = rs[1][idx] + lineWidth / 2; + + return rs; }, - /** - * @private - */ - _mergeBrushOption: function (brushOption) { - var option = this.option; - return zrUtil.merge( - { - brushType: option.brushType, - brushMode: option.brushMode, - transformable: option.transformable, - brushStyle: new Model(option.brushStyle).getItemStyle(), - removeOnClick: option.removeOnClick - }, - brushOption, - true - ); - } + // render split line + _drawSplitline: function (points, lineStyleModel, group) { - }); + var poyline = new graphic.Polyline({ + z2: 20, + shape: { + points: points + }, + style: lineStyleModel + }); - module.exports = BrushModel; + group.add(poyline); + }, + // render month line of one week points + _getLinePointsOfOneWeek: function (calendarModel, date, orient) { + var coordSys = calendarModel.coordinateSystem; + date = coordSys.getDateInfo(date); -/***/ }, -/* 324 */ -/***/ function(module, exports, __webpack_require__) { + var points = []; - + for (var i = 0; i < 7; i++) { - var zrUtil = __webpack_require__(4); - var BrushController = __webpack_require__(236); - var echarts = __webpack_require__(1); - var brushHelper = __webpack_require__(322); + var tmpD = coordSys.getNextNDay(date.time, i); + var point = coordSys.dataToRect([tmpD.time], true); - module.exports = echarts.extendComponentView({ + points[2 * tmpD.day] = point.tl; + points[2 * tmpD.day + 1] = point[orient === 'horizontal' ? 'bl' : 'tr']; + } - type: 'brush', + return points; - init: function (ecModel, api) { + }, - /** - * @readOnly - * @type {module:echarts/model/Global} - */ - this.ecModel = ecModel; + _formatterLabel: function (formatter, params) { - /** - * @readOnly - * @type {module:echarts/ExtensionAPI} - */ - this.api = api; + if (typeof formatter === 'string' && formatter) { + return formatUtil.formatTplSimple(formatter, params); + } - /** - * @readOnly - * @type {module:echarts/component/brush/BrushModel} - */ - this.model; + if (typeof formatter === 'function') { + return formatter(params); + } - /** - * @private - * @type {module:echarts/component/helper/BrushController} - */ - (this._brushController = new BrushController(api.getZr())) - .on('brush', zrUtil.bind(this._onBrush, this)) - .mount(); - }, + return params.nameMap; - /** - * @override - */ - render: function (brushModel) { - this.model = brushModel; - return updateController.apply(this, arguments); }, - /** - * @override - */ - updateView: updateController, + _yearTextPositionControl: function (point, orient, position, margin) { - /** - * @override - */ - updateLayout: updateController, + point = point.slice(); + var aligns = ['center', 'bottom']; - /** - * @override - */ - updateVisual: updateController, + if (position === 'top') { + point[1] -= margin; + } + if (position === 'bottom') { + point[1] += margin; + aligns = ['center', 'top']; + } + if (position === 'left') { + point[0] -= margin; + } + if (position === 'right') { + point[0] += margin; + aligns = ['center', 'top']; + } - /** - * @override - */ - dispose: function () { - this._brushController.dispose(); + var rotate = 0; + if (position === 'left' || position === 'right') { + rotate = Math.PI / 2; + } + + return { + rotation: rotate, + origin: point, + style: { + x: point[0], + y: point[1], + textAlign: aligns[0], + textVerticalAlign: aligns[1] + } + }; }, - /** - * @private - */ - _onBrush: function (areas, opt) { - var modelId = this.model.id; + // render year + _renderYearText: function (calendarModel, rangeData, orient, group) { + var yearLabel = calendarModel.getModel('yearLabel'); - brushHelper.parseOutputRanges(areas, this.model.coordInfoList, this.ecModel); + if (!yearLabel.get('show')) { + return; + } - // Action is not dispatched on drag end, because the drag end - // emits the same params with the last drag move event, and - // may have some delay when using touch pad, which makes - // animation not smooth (when using debounce). - (!opt.isEnd || opt.removeOnClick) && this.api.dispatchAction({ - type: 'brush', - brushId: modelId, - areas: zrUtil.clone(areas), - $from: modelId - }); - } + var yearLabelStyleModel = calendarModel.getModel('yearLabel.textStyle'); + var margin = yearLabel.get('margin'); + var pos = yearLabel.get('position'); - }); + if (!pos) { + pos = orient !== 'horizontal' ? 'top' : 'left'; + } - function updateController(brushModel, ecModel, api, payload) { - // Do not update controller when drawing. - (!payload || payload.$from !== brushModel.id) && this._brushController - .setPanels(brushHelper.makePanelOpts(brushModel.coordInfoList)) - .enableBrush(brushModel.brushOption) - .updateCovers(brushModel.areas.slice()); - } + var points = [this._tlpoints[this._tlpoints.length - 1], this._blpoints[0]]; + var xc = (points[0][0] + points[1][0]) / 2; + var yc = (points[0][1] + points[1][1]) / 2; + var idx = orient === 'horizontal' ? 0 : 1; -/***/ }, -/* 325 */ -/***/ function(module, exports, __webpack_require__) { + var posPoints = { + top: [xc, points[idx][1]], + bottom: [xc, points[1 - idx][1]], + left: [points[1 - idx][0], yc], + right: [points[idx][0], yc] + }; - /** - * @file Brush action - */ + var name = rangeData.start.y; + if (+rangeData.end.y > +rangeData.start.y) { + name = name + '-' + rangeData.end.y; + } - var echarts = __webpack_require__(1); + var formatter = yearLabel.get('formatter'); - /** - * payload: { - * brushIndex: number, or, - * brushId: string, or, - * brushName: string, - * globalRanges: Array - * } - */ - echarts.registerAction( - {type: 'brush', event: 'brush', update: 'updateView'}, - function (payload, ecModel) { - ecModel.eachComponent({mainType: 'brush', query: payload}, function (brushModel) { - brushModel.setAreas(payload.areas); - }); - } - ); + var params = { + start: rangeData.start.y, + end: rangeData.end.y, + nameMap: name + }; - /** - * payload: { - * brushComponents: [ - * { - * brushId, - * brushIndex, - * brushName, - * series: [ - * { - * seriesId, - * seriesIndex, - * seriesName, - * rawIndices: [21, 34, ...] - * }, - * ... - * ] - * }, - * ... - * ] - * } - */ - echarts.registerAction( - {type: 'brushSelect', event: 'brushSelected', update: 'none'}, - function () {} - ); + var content = this._formatterLabel(formatter, params); + var yearText = new graphic.Text( + zrUtil.merge({ + z2: 30, + style: { + text: content, + font: yearLabelStyleModel.getFont(), + fill: yearLabelStyleModel.getTextColor() + } + }, this._yearTextPositionControl(posPoints[pos], orient, pos, margin)) + ); -/***/ }, -/* 326 */ -/***/ function(module, exports, __webpack_require__) { + group.add(yearText); + }, - 'use strict'; + _monthTextPositionControl: function (point, isCenter, orient, position, margin) { + var align = 'left'; + var vAlign = 'top'; + var x = point[0]; + var y = point[1]; + if (orient === 'horizontal') { + y = y + margin; - var featureManager = __webpack_require__(327); - var zrUtil = __webpack_require__(4); + if (isCenter) { + align = 'center'; + } - function Brush(model, ecModel, api) { - this.model = model; - this.ecModel = ecModel; - this.api = api; + if (position === 'start') { + vAlign = 'bottom'; + } + } + else { + x = x + margin; - /** - * @private - * @type {string} - */ - this._brushType; + if (isCenter) { + vAlign = 'middle'; + } - /** - * @private - * @type {string} - */ - this._brushMode; - } + if (position === 'start') { + align = 'right'; + } + } - Brush.defaultOption = { - show: true, - type: ['rect', 'polygon', 'lineX', 'lineY', 'keep', 'clear'], - icon: { - rect: 'M7.3,34.7 M0.4,10V-0.2h9.8 M89.6,10V-0.2h-9.8 M0.4,60v10.2h9.8 M89.6,60v10.2h-9.8 M12.3,22.4V10.5h13.1 M33.6,10.5h7.8 M49.1,10.5h7.8 M77.5,22.4V10.5h-13 M12.3,31.1v8.2 M77.7,31.1v8.2 M12.3,47.6v11.9h13.1 M33.6,59.5h7.6 M49.1,59.5 h7.7 M77.5,47.6v11.9h-13', // jshint ignore:line - polygon: 'M55.2,34.9c1.7,0,3.1,1.4,3.1,3.1s-1.4,3.1-3.1,3.1 s-3.1-1.4-3.1-3.1S53.5,34.9,55.2,34.9z M50.4,51c1.7,0,3.1,1.4,3.1,3.1c0,1.7-1.4,3.1-3.1,3.1c-1.7,0-3.1-1.4-3.1-3.1 C47.3,52.4,48.7,51,50.4,51z M55.6,37.1l1.5-7.8 M60.1,13.5l1.6-8.7l-7.8,4 M59,19l-1,5.3 M24,16.1l6.4,4.9l6.4-3.3 M48.5,11.6 l-5.9,3.1 M19.1,12.8L9.7,5.1l1.1,7.7 M13.4,29.8l1,7.3l6.6,1.6 M11.6,18.4l1,6.1 M32.8,41.9 M26.6,40.4 M27.3,40.2l6.1,1.6 M49.9,52.1l-5.6-7.6l-4.9-1.2', // jshint ignore:line - lineX: 'M15.2,30 M19.7,15.6V1.9H29 M34.8,1.9H40.4 M55.3,15.6V1.9H45.9 M19.7,44.4V58.1H29 M34.8,58.1H40.4 M55.3,44.4 V58.1H45.9 M12.5,20.3l-9.4,9.6l9.6,9.8 M3.1,29.9h16.5 M62.5,20.3l9.4,9.6L62.3,39.7 M71.9,29.9H55.4', // jshint ignore:line - lineY: 'M38.8,7.7 M52.7,12h13.2v9 M65.9,26.6V32 M52.7,46.3h13.2v-9 M24.9,12H11.8v9 M11.8,26.6V32 M24.9,46.3H11.8v-9 M48.2,5.1l-9.3-9l-9.4,9.2 M38.9-3.9V12 M48.2,53.3l-9.3,9l-9.4-9.2 M38.9,62.3V46.4', // jshint ignore:line - keep: 'M4,10.5V1h10.3 M20.7,1h6.1 M33,1h6.1 M55.4,10.5V1H45.2 M4,17.3v6.6 M55.6,17.3v6.6 M4,30.5V40h10.3 M20.7,40 h6.1 M33,40h6.1 M55.4,30.5V40H45.2 M21,18.9h62.9v48.6H21V18.9z', // jshint ignore:line - clear: 'M22,14.7l30.9,31 M52.9,14.7L22,45.7 M4.7,16.8V4.2h13.1 M26,4.2h7.8 M41.6,4.2h7.8 M70.3,16.8V4.2H57.2 M4.7,25.9v8.6 M70.3,25.9v8.6 M4.7,43.2v12.6h13.1 M26,55.8h7.8 M41.6,55.8h7.8 M70.3,43.2v12.6H57.2' // jshint ignore:line + return { + x: x, + y: y, + textAlign: align, + textVerticalAlign: vAlign + }; }, - title: { - rect: '矩形选择', - polygon: '圈选', - lineX: '横向选择', - lineY: '纵向选择', - keep: '保持选择', - clear: '清除选择' - } - }; - var proto = Brush.prototype; + // render month and year text + _renderMonthText: function (calendarModel, orient, group) { + var monthLabel = calendarModel.getModel('monthLabel'); - proto.render = - proto.updateView = - proto.updateLayout = function (featureModel, ecModel, api) { - var brushType; - var brushMode; - var isBrushed; + if (!monthLabel.get('show')) { + return; + } - ecModel.eachComponent({mainType: 'brush'}, function (brushModel) { - brushType = brushModel.brushType; - brushMode = brushModel.brushOption.brushMode || 'single'; - isBrushed |= brushModel.areas.length; - }); - this._brushType = brushType; - this._brushMode = brushMode; + var monthLabelStyleModel = calendarModel.getModel('monthLabel.textStyle'); + var nameMap = monthLabel.get('nameMap'); + var margin = monthLabel.get('margin'); + var pos = monthLabel.get('position'); + var align = monthLabel.get('align'); - zrUtil.each(featureModel.get('type', true), function (type) { - featureModel.setIconStatus( - type, - ( - type === 'keep' - ? brushMode === 'multiple' - : type === 'clear' - ? isBrushed - : type === brushType - ) ? 'emphasis' : 'normal' - ); - }); - }; + var termPoints = [this._tlpoints, this._blpoints]; - proto.getIcons = function () { - var model = this.model; - var availableIcons = model.get('icon', true); - var icons = {}; - zrUtil.each(model.get('type', true), function (type) { - if (availableIcons[type]) { - icons[type] = availableIcons[type]; + if (zrUtil.isString(nameMap)) { + nameMap = MONTH_TEXT[nameMap.toUpperCase()] || []; } - }); - return icons; - }; - proto.onclick = function (ecModel, api, type) { - var api = this.api; - var brushType = this._brushType; - var brushMode = this._brushMode; + var idx = pos === 'start' ? 0 : 1; + var axis = orient === 'horizontal' ? 0 : 1; + margin = pos === 'start' ? -margin : margin; + var isCenter = (align === 'center'); - if (type === 'clear') { - api.dispatchAction({ - type: 'brush', - // Clear all areas of all brush components. - areas: [] - }); - } - else { - api.dispatchAction({ - type: 'takeGlobalCursor', - key: 'brush', - brushOption: { - brushType: type === 'keep' - ? brushType - : (brushType === type ? false : type), - brushMode: type === 'keep' - ? (brushMode === 'multiple' ? 'single' : 'multiple') - : brushMode - } - }); - } - }; + for (var i = 0; i < termPoints[idx].length - 1; i++) { - featureManager.register('brush', Brush); + var tmp = termPoints[idx][i].slice(); + var firstDay = this._firstDayOfMonth[i]; - module.exports = Brush; + if (isCenter) { + var firstDayPoints = this._firstDayPoints[i]; + tmp[axis] = (firstDayPoints[axis] + termPoints[0][i + 1][axis]) / 2; + } + var formatter = monthLabel.get('formatter'); + var name = nameMap[+firstDay.m - 1]; + var params = { + yyyy: firstDay.y, + yy: (firstDay.y + '').slice(2), + MM: firstDay.m, + M: +firstDay.m, + nameMap: name + }; -/***/ }, -/* 327 */ -/***/ function(module, exports) { + var content = this._formatterLabel(formatter, params); - 'use strict'; + var monthText = new graphic.Text({ + z2: 30, + style: zrUtil.extend({ + text: content, + font: monthLabelStyleModel.getFont(), + fill: monthLabelStyleModel.getTextColor() + }, this._monthTextPositionControl(tmp, isCenter, orient, pos, margin)) + }); + group.add(monthText); + } + }, - var features = {}; + _weekTextPositionControl: function (point, orient, position, margin, cellSize) { + var align = 'center'; + var vAlign = 'middle'; + var x = point[0]; + var y = point[1]; + var isStart = position === 'start'; - module.exports = { - register: function (name, ctor) { - features[name] = ctor; + if (orient === 'horizontal') { + x = x + margin + (isStart ? 1 : -1) * cellSize[0] / 2; + align = isStart ? 'right' : 'left'; + } + else { + y = y + margin + (isStart ? 1 : -1) * cellSize[1] / 2; + vAlign = isStart ? 'bottom' : 'top'; + } + + return { + x: x, + y: y, + textAlign: align, + textVerticalAlign: vAlign + }; }, - get: function (name) { - return features[name]; + // render weeks + _renderWeekText: function (calendarModel, rangeData, orient, group) { + var dayLabel = calendarModel.getModel('dayLabel'); + + if (!dayLabel.get('show')) { + return; + } + + var coordSys = calendarModel.coordinateSystem; + var dayLabelStyleModel = calendarModel.getModel('dayLabel.textStyle'); + var pos = dayLabel.get('position'); + var nameMap = dayLabel.get('nameMap'); + var margin = dayLabel.get('margin'); + var firstDayOfWeek = coordSys.getFirstDayOfWeek(); + + if (zrUtil.isString(nameMap)) { + nameMap = WEEK_TEXT[nameMap.toUpperCase()] || []; + } + + var start = coordSys.getNextNDay( + rangeData.end.time, (7 - rangeData.lweek) + ).time; + + var cellSize = [coordSys.getCellWidth(), coordSys.getCellHeight()]; + margin = numberUtil.parsePercent(margin, cellSize[orient === 'horizontal' ? 0 : 1]); + + if (pos === 'start') { + start = coordSys.getNextNDay( + rangeData.start.time, -(7 + rangeData.fweek) + ).time; + margin = -margin; + } + + for (var i = 0; i < 7; i++) { + + var tmpD = coordSys.getNextNDay(start, i); + var point = coordSys.dataToRect([tmpD.time], true).center; + var day = i; + day = Math.abs((i + firstDayOfWeek) % 7); + var weekText = new graphic.Text({ + z2: 30, + style: zrUtil.extend({ + text: nameMap[day], + font: dayLabelStyleModel.getFont(), + fill: dayLabelStyleModel.getTextColor() + }, this._weekTextPositionControl(point, orient, pos, margin, cellSize)) + }); + group.add(weekText); + } } - }; + }); + /***/ }, -/* 328 */ +/* 349 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var echarts = __webpack_require__(1); - var graphic = __webpack_require__(43); + var graphic = __webpack_require__(44); var layout = __webpack_require__(21); // Model @@ -56965,7 +61073,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 329 */ +/* 350 */ /***/ function(module, exports, __webpack_require__) { /** @@ -56973,24 +61081,24 @@ return /******/ (function(modules) { // webpackBootstrap */ - __webpack_require__(330); + __webpack_require__(351); - __webpack_require__(331); - __webpack_require__(334); + __webpack_require__(352); + __webpack_require__(355); - __webpack_require__(335); - __webpack_require__(336); + __webpack_require__(356); + __webpack_require__(357); - __webpack_require__(338); - __webpack_require__(339); + __webpack_require__(359); + __webpack_require__(360); - __webpack_require__(341); - __webpack_require__(342); + __webpack_require__(362); + __webpack_require__(363); /***/ }, -/* 330 */ +/* 351 */ /***/ function(module, exports, __webpack_require__) { @@ -57003,7 +61111,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 331 */ +/* 352 */ /***/ function(module, exports, __webpack_require__) { /** @@ -57015,8 +61123,8 @@ return /******/ (function(modules) { // webpackBootstrap var env = __webpack_require__(2); var echarts = __webpack_require__(1); var modelUtil = __webpack_require__(5); - var helper = __webpack_require__(332); - var AxisProxy = __webpack_require__(333); + var helper = __webpack_require__(353); + var AxisProxy = __webpack_require__(354); var each = zrUtil.each; var eachAxisDim = helper.eachAxisDim; @@ -57091,6 +61199,12 @@ return /******/ (function(modules) { // webpackBootstrap */ this._autoThrottle = true; + /** + * 'percent' or 'value' + * @private + */ + this._rangePropMode = ['percent', 'percent']; + var rawOption = retrieveRaw(option); this.mergeDefaultAndTheme(option, ecModel); @@ -57123,8 +61237,17 @@ return /******/ (function(modules) { // webpackBootstrap this._setDefaultThrottle(rawOption); - processRangeProp('start', 'startValue', rawOption, thisOption); - processRangeProp('end', 'endValue', rawOption, thisOption); + updateRangeUse(this, rawOption); + + each([['start', 'startValue'], ['end', 'endValue']], function (names, index) { + // start/end has higher priority over startValue/endValue if they + // both set, but we should make chart.setOption({endValue: 1000}) + // effective, rather than chart.setOption({endValue: 1000, end: null}). + if (this._rangePropMode[index] === 'value') { + thisOption[names[0]] = null; + } + // Otherwise do nothing and use the merge result. + }, this); this.textStyleModel = this.getModel('textStyle'); @@ -57388,10 +61511,25 @@ return /******/ (function(modules) { // webpackBootstrap }, this); }, + /** + * @param {string} dimName + * @param {number} axisIndex + * @return {module:echarts/component/dataZoom/AxisProxy} If not found, return null/undefined. + */ getAxisProxy: function (dimName, axisIndex) { return this._axisProxies[dimName + '_' + axisIndex]; }, + /** + * @param {string} dimName + * @param {number} axisIndex + * @return {module:echarts/model/Model} If not found, return null/undefined. + */ + getAxisModel: function (dimName, axisIndex) { + var axisProxy = this.getAxisProxy(dimName, axisIndex); + return axisProxy && axisProxy.getAxisModel(); + }, + /** * If not specified, set to undefined. * @@ -57401,14 +61539,17 @@ return /******/ (function(modules) { // webpackBootstrap * @param {number} [opt.end] * @param {number} [opt.startValue] * @param {number} [opt.endValue] + * @param {boolean} [ignoreUpdateRangeUsg=false] */ - setRawRange: function (opt) { + setRawRange: function (opt, ignoreUpdateRangeUsg) { each(['start', 'end', 'startValue', 'endValue'], function (name) { // If any of those prop is null/undefined, we should alos set // them, because only one pair between start/end and // startValue/endValue can work. this.option[name] = opt[name]; }, this); + + !ignoreUpdateRangeUsg && updateRangeUse(this, opt); }, /** @@ -57465,8 +61606,14 @@ return /******/ (function(modules) { // webpackBootstrap return axisProxies[key]; } } - } + }, + /** + * @return {Array.} + */ + getRangePropMode: function () { + return this._rangePropMode.slice(); + } }); function retrieveRaw(option) { @@ -57480,14 +61627,17 @@ return /******/ (function(modules) { // webpackBootstrap return ret; } - function processRangeProp(percentProp, valueProp, rawOption, thisOption) { - // start/end has higher priority over startValue/endValue, - // but we should make chart.setOption({endValue: 1000}) effective, - // rather than chart.setOption({endValue: 1000, end: null}). - if (rawOption[valueProp] != null && rawOption[percentProp] == null) { - thisOption[percentProp] = null; - } - // Otherwise do nothing and use the merge result. + function updateRangeUse(dataZoomModel, rawOption) { + each([['start', 'startValue'], ['end', 'endValue']], function (names, index) { + var rangePropMode = dataZoomModel._rangePropMode; + if (rawOption[names[0]] != null) { + rangePropMode[index] = 'percent'; + } + else if (rawOption[names[1]] != null) { + rangePropMode[index] = 'value'; + } + // else remain its original setting. + }); } module.exports = DataZoomModel; @@ -57495,7 +61645,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 332 */ +/* 353 */ /***/ function(module, exports, __webpack_require__) { @@ -57633,7 +61783,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 333 */ +/* 354 */ /***/ function(module, exports, __webpack_require__) { /** @@ -57643,7 +61793,7 @@ return /******/ (function(modules) { // webpackBootstrap var zrUtil = __webpack_require__(4); var numberUtil = __webpack_require__(7); - var helper = __webpack_require__(332); + var helper = __webpack_require__(353); var each = zrUtil.each; var asc = numberUtil.asc; @@ -57798,6 +61948,7 @@ return /******/ (function(modules) { // webpackBootstrap var dataExtent = this._dataExtent; var axisModel = this.getAxisModel(); var scale = axisModel.axis.scale; + var rangePropMode = this._dataZoomModel.getRangePropMode(); var percentExtent = [0, 100]; var percentWindow = [ opt.start, @@ -57805,12 +61956,6 @@ return /******/ (function(modules) { // webpackBootstrap ]; var valueWindow = []; - // In percent range is used and axis min/max/scale is set, - // window should be based on min/max/0, but should not be - // based on the extent of filtered data. - dataExtent = dataExtent.slice(); - fixExtentByAxis(dataExtent, axisModel); - each(['startValue', 'endValue'], function (prop) { valueWindow.push(opt[prop] != null ? scale.parse(opt[prop]) : null); }); @@ -57820,11 +61965,19 @@ return /******/ (function(modules) { // webpackBootstrap var boundValue = valueWindow[idx]; var boundPercent = percentWindow[idx]; - // start/end has higher priority over startValue/endValue, - // because start/end can be consistent among different type - // of axis but startValue/endValue not. - - if (boundPercent != null || boundValue == null) { + // Notice: dataZoom is based either on `percentProp` ('start', 'end') or + // on `valueProp` ('startValue', 'endValue'). The former one is suitable + // for cases that a dataZoom component controls multiple axes with different + // unit or extent, and the latter one is suitable for accurate zoom by pixel + // (e.g., in dataZoomSelect). `valueProp` can be calculated from `percentProp`, + // but it is awkward that `percentProp` can not be obtained from `valueProp` + // accurately (because all of values that are overflow the `dataExtent` will + // be calculated to percent '100%'). So we have to use + // `dataZoom.getRangePropMode()` to mark which prop is used. + // `rangePropMode` is updated only when setOption or dispatchAction, otherwise + // it remains its original value. + + if (rangePropMode[idx] === 'percent') { if (boundPercent == null) { boundPercent = percentExtent[idx]; } @@ -57833,11 +61986,15 @@ return /******/ (function(modules) { // webpackBootstrap boundPercent, percentExtent, dataExtent, true )); } - else { // boundPercent == null && boundValue != null + else { + // Calculating `percent` from `value` may be not accurate, because + // This calculation can not be inversed, because all of values that + // are overflow the `dataExtent` will be calculated to percent '100%' boundPercent = numberUtil.linearMap( boundValue, dataExtent, percentExtent, true ); } + // valueWindow[idx] = round(boundValue); // percentWindow[idx] = round(boundPercent); valueWindow[idx] = boundValue; @@ -57864,9 +62021,11 @@ return /******/ (function(modules) { // webpackBootstrap // Culculate data window and data extent, and record them. this._dataExtent = calculateDataExtent( - this._dimName, this.getTargetSeriesModels() + this, this._dimName, this.getTargetSeriesModels() ); + var dataWindow = this.calculateDataWindow(dataZoomModel.option); + this._valueWindow = dataWindow.valueWindow; this._percentWindow = dataWindow.percentWindow; @@ -57939,7 +62098,7 @@ return /******/ (function(modules) { // webpackBootstrap } }; - function calculateDataExtent(axisDim, seriesModels) { + function calculateDataExtent(axisProxy, axisDim, seriesModels) { var dataExtent = [Infinity, -Infinity]; each(seriesModels, function (seriesModel) { @@ -57951,30 +62110,60 @@ return /******/ (function(modules) { // webpackBootstrap seriesExtent[1] > dataExtent[1] && (dataExtent[1] = seriesExtent[1]); }); } - }, this); + }); if (dataExtent[1] < dataExtent[0]) { dataExtent = [NaN, NaN]; } + // It is important to get "consistent" extent when more then one axes is + // controlled by a `dataZoom`, otherwise those axes will not be synchronized + // when zooming. But it is difficult to know what is "consistent", considering + // axes have different type or even different meanings (For example, two + // time axes are used to compare data of the same date in different years). + // So basically dataZoom just obtains extent by series.data (in category axis + // extent can be obtained from axis.data). + // Nevertheless, user can set min/max/scale on axes to make extent of axes + // consistent. + fixExtentByAxis(axisProxy, dataExtent); + return dataExtent; } - function fixExtentByAxis(dataExtent, axisModel) { + function fixExtentByAxis(axisProxy, dataExtent) { + var axisModel = axisProxy.getAxisModel(); var min = axisModel.getMin(true); + + // For category axis, if min/max/scale are not set, extent is determined + // by axis.data by default. + var isCategoryAxis = axisModel.get('type') === 'category'; + var axisDataLen = isCategoryAxis && (axisModel.get('data') || []).length; + if (min != null && min !== 'dataMin') { dataExtent[0] = min; } + else if (isCategoryAxis) { + dataExtent[0] = axisDataLen > 0 ? 0 : NaN; + } + var max = axisModel.getMax(true); if (max != null && max !== 'dataMax') { dataExtent[1] = max; } + else if (isCategoryAxis) { + dataExtent[1] = axisDataLen > 0 ? axisDataLen - 1 : NaN; + } if (!axisModel.get('scale', true)) { dataExtent[0] > 0 && (dataExtent[0] = 0); dataExtent[1] < 0 && (dataExtent[1] = 0); } + // For value axis, if min/max/scale are not set, we just use the extent obtained + // by series data, which may be a little different from the extent calculated by + // `axisHelper.getScaleExtent`. But the different just affects the experience a + // little when zooming. So it will not be fixed until some users require it strongly. + return dataExtent; } @@ -58004,7 +62193,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 334 */ +/* 355 */ /***/ function(module, exports, __webpack_require__) { @@ -58081,7 +62270,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 335 */ +/* 356 */ /***/ function(module, exports, __webpack_require__) { /** @@ -58089,7 +62278,7 @@ return /******/ (function(modules) { // webpackBootstrap */ - var DataZoomModel = __webpack_require__(331); + var DataZoomModel = __webpack_require__(352); var SliderZoomModel = DataZoomModel.extend({ @@ -58160,20 +62349,22 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 336 */ +/* 357 */ /***/ function(module, exports, __webpack_require__) { var zrUtil = __webpack_require__(4); - var graphic = __webpack_require__(43); + var graphic = __webpack_require__(44); var throttle = __webpack_require__(81); - var DataZoomView = __webpack_require__(334); + var DataZoomView = __webpack_require__(355); var Rect = graphic.Rect; var numberUtil = __webpack_require__(7); var linearMap = numberUtil.linearMap; var layout = __webpack_require__(21); - var sliderMove = __webpack_require__(337); + var sliderMove = __webpack_require__(358); + var eventTool = __webpack_require__(88); + var asc = numberUtil.asc; var bind = zrUtil.bind; // var mathMax = Math.max; @@ -58580,6 +62771,10 @@ return /******/ (function(modules) { // webpackBootstrap draggable: true, cursor: 'move', drift: bind(this._onDragMove, this, 'all'), + onmousemove: function (e) { + // Fot mobile devicem, prevent screen slider on the button. + eventTool.stop(e.event); + }, ondragstart: bind(this._showDataInfo, this, true), ondragend: bind(this._onDragEnd, this), onmouseover: bind(this._showDataInfo, this, true), @@ -58617,6 +62812,10 @@ return /******/ (function(modules) { // webpackBootstrap cursor: this._orient === 'vertical' ? 'ns-resize' : 'ew-resize', draggable: true, drift: bind(this._onDragMove, this, handleIndex), + onmousemove: function (e) { + // Fot mobile devicem, prevent screen slider on the button. + eventTool.stop(e.event); + }, ondragend: bind(this._onDragEnd, this), onmouseover: bind(this._showDataInfo, this, true), onmouseout: bind(this._showDataInfo, this, false) @@ -58920,7 +63119,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 337 */ +/* 358 */ /***/ function(module, exports) { @@ -58979,7 +63178,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 338 */ +/* 359 */ /***/ function(module, exports, __webpack_require__) { /** @@ -58987,7 +63186,7 @@ return /******/ (function(modules) { // webpackBootstrap */ - module.exports = __webpack_require__(331).extend({ + module.exports = __webpack_require__(352).extend({ type: 'dataZoom.inside', @@ -59002,15 +63201,15 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 339 */ +/* 360 */ /***/ function(module, exports, __webpack_require__) { - var DataZoomView = __webpack_require__(334); + var DataZoomView = __webpack_require__(355); var zrUtil = __webpack_require__(4); - var sliderMove = __webpack_require__(337); - var roams = __webpack_require__(340); + var sliderMove = __webpack_require__(358); + var roams = __webpack_require__(361); var bind = zrUtil.bind; var InsideZoomView = DataZoomView.extend({ @@ -59238,7 +63437,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 340 */ +/* 361 */ /***/ function(module, exports, __webpack_require__) { /** @@ -59253,7 +63452,7 @@ return /******/ (function(modules) { // webpackBootstrap // components. var zrUtil = __webpack_require__(4); - var RoamController = __webpack_require__(177); + var RoamController = __webpack_require__(191); var throttle = __webpack_require__(81); var curry = zrUtil.curry; @@ -59433,7 +63632,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 341 */ +/* 362 */ /***/ function(module, exports, __webpack_require__) { /** @@ -59480,7 +63679,7 @@ return /******/ (function(modules) { // webpackBootstrap end: percentRange[1], startValue: valueRange[0], endValue: valueRange[1] - }); + }, true); }); }); @@ -59496,7 +63695,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 342 */ +/* 363 */ /***/ function(module, exports, __webpack_require__) { /** @@ -59505,7 +63704,7 @@ return /******/ (function(modules) { // webpackBootstrap var zrUtil = __webpack_require__(4); - var helper = __webpack_require__(332); + var helper = __webpack_require__(353); var echarts = __webpack_require__(1); @@ -59544,7 +63743,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 343 */ +/* 364 */ /***/ function(module, exports, __webpack_require__) { /** @@ -59552,13 +63751,13 @@ return /******/ (function(modules) { // webpackBootstrap */ - __webpack_require__(344); - __webpack_require__(355); + __webpack_require__(365); + __webpack_require__(376); /***/ }, -/* 344 */ +/* 365 */ /***/ function(module, exports, __webpack_require__) { /** @@ -59567,19 +63766,19 @@ return /******/ (function(modules) { // webpackBootstrap __webpack_require__(1).registerPreprocessor( - __webpack_require__(345) + __webpack_require__(366) ); - __webpack_require__(346); - __webpack_require__(347); - __webpack_require__(348); - __webpack_require__(351); - __webpack_require__(354); + __webpack_require__(367); + __webpack_require__(368); + __webpack_require__(369); + __webpack_require__(372); + __webpack_require__(375); /***/ }, -/* 345 */ +/* 366 */ /***/ function(module, exports, __webpack_require__) { /** @@ -59631,7 +63830,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 346 */ +/* 367 */ /***/ function(module, exports, __webpack_require__) { @@ -59655,7 +63854,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 347 */ +/* 368 */ /***/ function(module, exports, __webpack_require__) { /** @@ -59664,8 +63863,8 @@ return /******/ (function(modules) { // webpackBootstrap var echarts = __webpack_require__(1); - var visualSolution = __webpack_require__(320); - var VisualMapping = __webpack_require__(195); + var visualSolution = __webpack_require__(337); + var VisualMapping = __webpack_require__(209); var zrUtil = __webpack_require__(4); echarts.registerVisual(echarts.PRIORITY.VISUAL.COMPONENT, function (ecModel) { @@ -59745,7 +63944,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 348 */ +/* 369 */ /***/ function(module, exports, __webpack_require__) { /** @@ -59753,7 +63952,7 @@ return /******/ (function(modules) { // webpackBootstrap */ - var VisualMapModel = __webpack_require__(349); + var VisualMapModel = __webpack_require__(370); var zrUtil = __webpack_require__(4); var numberUtil = __webpack_require__(7); @@ -59999,7 +64198,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 349 */ +/* 370 */ /***/ function(module, exports, __webpack_require__) { /** @@ -60010,9 +64209,9 @@ return /******/ (function(modules) { // webpackBootstrap var echarts = __webpack_require__(1); var zrUtil = __webpack_require__(4); var env = __webpack_require__(2); - var visualDefault = __webpack_require__(350); - var VisualMapping = __webpack_require__(195); - var visualSolution = __webpack_require__(320); + var visualDefault = __webpack_require__(371); + var VisualMapping = __webpack_require__(209); + var visualSolution = __webpack_require__(337); var mapVisual = VisualMapping.mapVisual; var modelUtil = __webpack_require__(5); var eachVisual = VisualMapping.eachVisual; @@ -60526,7 +64725,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 350 */ +/* 371 */ /***/ function(module, exports, __webpack_require__) { /** @@ -60602,19 +64801,20 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 351 */ +/* 372 */ /***/ function(module, exports, __webpack_require__) { - var VisualMapView = __webpack_require__(352); - var graphic = __webpack_require__(43); + var VisualMapView = __webpack_require__(373); + var graphic = __webpack_require__(44); var zrUtil = __webpack_require__(4); var numberUtil = __webpack_require__(7); - var sliderMove = __webpack_require__(337); + var sliderMove = __webpack_require__(358); var LinearGradient = __webpack_require__(78); - var helper = __webpack_require__(353); + var helper = __webpack_require__(374); var modelUtil = __webpack_require__(5); + var eventTool = __webpack_require__(88); var linearMap = numberUtil.linearMap; var each = zrUtil.each; @@ -60837,6 +65037,10 @@ return /******/ (function(modules) { // webpackBootstrap var handleLabel = new graphic.Text({ draggable: true, drift: onDrift, + onmousemove: function (e) { + // Fot mobile devicem, prevent screen slider on the button. + eventTool.stop(e.event); + }, ondragend: onDragEnd, style: { x: 0, y: 0, text: '', @@ -61302,14 +65506,20 @@ return /******/ (function(modules) { // webpackBootstrap */ _hoverLinkFromSeriesMouseOver: function (e) { var el = e.target; + var visualMapModel = this.visualMapModel; if (!el || el.dataIndex == null) { return; } - var dataModel = el.dataModel || this.ecModel.getSeriesByIndex(el.seriesIndex); + var dataModel = this.ecModel.getSeriesByIndex(el.seriesIndex); + + if (!visualMapModel.isTargetSeries(dataModel)) { + return; + } + var data = dataModel.getData(el.dataType); - var dim = data.getDimension(this.visualMapModel.getDataDimension(data)); + var dim = data.getDimension(visualMapModel.getDataDimension(data)); var value = data.get(dim, el.dataIndex, true); if (!isNaN(value)) { @@ -61395,6 +65605,10 @@ return /******/ (function(modules) { // webpackBootstrap draggable: !!onDrift, cursor: cursor, drift: onDrift, + onmousemove: function (e) { + // Fot mobile devicem, prevent screen slider on the button. + eventTool.stop(e.event); + }, ondragend: onDragEnd }); } @@ -61435,17 +65649,17 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 352 */ +/* 373 */ /***/ function(module, exports, __webpack_require__) { var zrUtil = __webpack_require__(4); - var graphic = __webpack_require__(43); + var graphic = __webpack_require__(44); var formatUtil = __webpack_require__(6); var layout = __webpack_require__(21); var echarts = __webpack_require__(1); - var VisualMapping = __webpack_require__(195); + var VisualMapping = __webpack_require__(209); module.exports = echarts.extendComponentView({ @@ -61595,7 +65809,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 353 */ +/* 374 */ /***/ function(module, exports, __webpack_require__) { @@ -61667,7 +65881,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 354 */ +/* 375 */ /***/ function(module, exports, __webpack_require__) { /** @@ -61695,7 +65909,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 355 */ +/* 376 */ /***/ function(module, exports, __webpack_require__) { /** @@ -61704,27 +65918,27 @@ return /******/ (function(modules) { // webpackBootstrap __webpack_require__(1).registerPreprocessor( - __webpack_require__(345) + __webpack_require__(366) ); - __webpack_require__(346); - __webpack_require__(347); - __webpack_require__(356); - __webpack_require__(357); - __webpack_require__(354); + __webpack_require__(367); + __webpack_require__(368); + __webpack_require__(377); + __webpack_require__(378); + __webpack_require__(375); /***/ }, -/* 356 */ +/* 377 */ /***/ function(module, exports, __webpack_require__) { - var VisualMapModel = __webpack_require__(349); + var VisualMapModel = __webpack_require__(370); var zrUtil = __webpack_require__(4); - var VisualMapping = __webpack_require__(195); - var visualDefault = __webpack_require__(350); + var VisualMapping = __webpack_require__(209); + var visualDefault = __webpack_require__(371); var reformIntervals = __webpack_require__(7).reformIntervals; var PiecewiseModel = VisualMapModel.extend({ @@ -62249,17 +66463,17 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 357 */ +/* 378 */ /***/ function(module, exports, __webpack_require__) { - var VisualMapView = __webpack_require__(352); + var VisualMapView = __webpack_require__(373); var zrUtil = __webpack_require__(4); - var graphic = __webpack_require__(43); - var symbolCreators = __webpack_require__(107); + var graphic = __webpack_require__(44); + var symbolCreators = __webpack_require__(104); var layout = __webpack_require__(21); - var helper = __webpack_require__(353); + var helper = __webpack_require__(374); var PiecewiseVisualMapView = VisualMapView.extend({ @@ -62477,14 +66691,14 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 358 */ +/* 379 */ /***/ function(module, exports, __webpack_require__) { // HINT Markpoint can't be used too much - __webpack_require__(359); - __webpack_require__(361); + __webpack_require__(380); + __webpack_require__(382); __webpack_require__(1).registerPreprocessor(function (opt) { // Make sure markPoint component is enabled @@ -62493,12 +66707,12 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 359 */ +/* 380 */ /***/ function(module, exports, __webpack_require__) { - module.exports = __webpack_require__(360).extend({ + module.exports = __webpack_require__(381).extend({ type: 'markPoint', @@ -62531,7 +66745,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 360 */ +/* 381 */ /***/ function(module, exports, __webpack_require__) { @@ -62669,18 +66883,18 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 361 */ +/* 382 */ /***/ function(module, exports, __webpack_require__) { - var SymbolDraw = __webpack_require__(105); + var SymbolDraw = __webpack_require__(115); var zrUtil = __webpack_require__(4); var numberUtil = __webpack_require__(7); var List = __webpack_require__(98); - var markerHelper = __webpack_require__(362); + var markerHelper = __webpack_require__(383); function updateMarkerLayout(mpData, seriesModel, api) { var coordSys = seriesModel.coordinateSystem; @@ -62718,7 +66932,7 @@ return /******/ (function(modules) { // webpackBootstrap }); } - __webpack_require__(363).extend({ + __webpack_require__(384).extend({ type: 'markPoint', @@ -62830,7 +67044,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 362 */ +/* 383 */ /***/ function(module, exports, __webpack_require__) { @@ -62868,7 +67082,7 @@ return /******/ (function(modules) { // webpackBootstrap var coordArr = []; var value = numCalculate(data, targetDataDim, mlType); - var dataIndex = data.indexOfNearest(targetDataDim, value, true); + var dataIndex = data.indexOfNearest(targetDataDim, value, true)[0]; coordArr[otherCoordIndex] = data.get(otherDataDim, dataIndex, true); coordArr[targetCoordIndex] = data.get(targetDataDim, dataIndex, true); @@ -63034,7 +67248,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 363 */ +/* 384 */ /***/ function(module, exports, __webpack_require__) { @@ -63078,13 +67292,13 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 364 */ +/* 385 */ /***/ function(module, exports, __webpack_require__) { - __webpack_require__(365); - __webpack_require__(366); + __webpack_require__(386); + __webpack_require__(387); __webpack_require__(1).registerPreprocessor(function (opt) { // Make sure markLine component is enabled @@ -63093,12 +67307,12 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 365 */ +/* 386 */ /***/ function(module, exports, __webpack_require__) { - module.exports = __webpack_require__(360).extend({ + module.exports = __webpack_require__(381).extend({ type: 'markLine', @@ -63138,7 +67352,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 366 */ +/* 387 */ /***/ function(module, exports, __webpack_require__) { @@ -63147,9 +67361,9 @@ return /******/ (function(modules) { // webpackBootstrap var List = __webpack_require__(98); var numberUtil = __webpack_require__(7); - var markerHelper = __webpack_require__(362); + var markerHelper = __webpack_require__(383); - var LineDraw = __webpack_require__(202); + var LineDraw = __webpack_require__(216); var markLineTransform = function (seriesModel, coordSys, mlModel, item) { var data = seriesModel.getData(); @@ -63319,7 +67533,7 @@ return /******/ (function(modules) { // webpackBootstrap data.setItemLayout(idx, point); } - __webpack_require__(363).extend({ + __webpack_require__(384).extend({ type: 'markLine', @@ -63498,13 +67712,13 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 367 */ +/* 388 */ /***/ function(module, exports, __webpack_require__) { - __webpack_require__(368); - __webpack_require__(369); + __webpack_require__(389); + __webpack_require__(390); __webpack_require__(1).registerPreprocessor(function (opt) { // Make sure markArea component is enabled @@ -63513,12 +67727,12 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 368 */ +/* 389 */ /***/ function(module, exports, __webpack_require__) { - module.exports = __webpack_require__(360).extend({ + module.exports = __webpack_require__(381).extend({ type: 'markArea', @@ -63554,7 +67768,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 369 */ +/* 390 */ /***/ function(module, exports, __webpack_require__) { // TODO Better on polar @@ -63563,10 +67777,10 @@ return /******/ (function(modules) { // webpackBootstrap var zrUtil = __webpack_require__(4); var List = __webpack_require__(98); var numberUtil = __webpack_require__(7); - var graphic = __webpack_require__(43); + var graphic = __webpack_require__(44); var colorUtil = __webpack_require__(39); - var markerHelper = __webpack_require__(362); + var markerHelper = __webpack_require__(383); var markAreaTransform = function (seriesModel, coordSys, maModel, item) { var lt = markerHelper.dataTransform(seriesModel, item[0]); @@ -63686,7 +67900,7 @@ return /******/ (function(modules) { // webpackBootstrap var dimPermutations = [['x0', 'y0'], ['x1', 'y0'], ['x1', 'y1'], ['x0', 'y1']]; - __webpack_require__(363).extend({ + __webpack_require__(384).extend({ type: 'markArea', @@ -63876,7 +68090,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 370 */ +/* 391 */ /***/ function(module, exports, __webpack_require__) { /** @@ -63886,17 +68100,17 @@ return /******/ (function(modules) { // webpackBootstrap var echarts = __webpack_require__(1); - echarts.registerPreprocessor(__webpack_require__(371)); + echarts.registerPreprocessor(__webpack_require__(392)); - __webpack_require__(372); - __webpack_require__(373); - __webpack_require__(374); - __webpack_require__(376); + __webpack_require__(393); + __webpack_require__(394); + __webpack_require__(395); + __webpack_require__(397); /***/ }, -/* 371 */ +/* 392 */ /***/ function(module, exports, __webpack_require__) { /** @@ -63987,7 +68201,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 372 */ +/* 393 */ /***/ function(module, exports, __webpack_require__) { @@ -64000,7 +68214,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 373 */ +/* 394 */ /***/ function(module, exports, __webpack_require__) { /** @@ -64050,7 +68264,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 374 */ +/* 395 */ /***/ function(module, exports, __webpack_require__) { /** @@ -64058,7 +68272,7 @@ return /******/ (function(modules) { // webpackBootstrap */ - var TimelineModel = __webpack_require__(375); + var TimelineModel = __webpack_require__(396); var zrUtil = __webpack_require__(4); var modelUtil = __webpack_require__(5); @@ -64166,7 +68380,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 375 */ +/* 396 */ /***/ function(module, exports, __webpack_require__) { /** @@ -64368,7 +68582,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 376 */ +/* 397 */ /***/ function(module, exports, __webpack_require__) { /** @@ -64377,12 +68591,12 @@ return /******/ (function(modules) { // webpackBootstrap var zrUtil = __webpack_require__(4); - var graphic = __webpack_require__(43); + var graphic = __webpack_require__(44); var layout = __webpack_require__(21); - var TimelineView = __webpack_require__(377); - var TimelineAxis = __webpack_require__(378); - var symbolUtil = __webpack_require__(107); - var axisHelper = __webpack_require__(115); + var TimelineView = __webpack_require__(398); + var TimelineAxis = __webpack_require__(399); + var symbolUtil = __webpack_require__(104); + var axisHelper = __webpack_require__(105); var BoundingRect = __webpack_require__(9); var matrix = __webpack_require__(11); var numberUtil = __webpack_require__(7); @@ -65086,7 +69300,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 377 */ +/* 398 */ /***/ function(module, exports, __webpack_require__) { /** @@ -65106,14 +69320,14 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 378 */ +/* 399 */ /***/ function(module, exports, __webpack_require__) { var zrUtil = __webpack_require__(4); - var Axis = __webpack_require__(124); - var axisHelper = __webpack_require__(115); + var Axis = __webpack_require__(100); + var axisHelper = __webpack_require__(105); /** * Extend axis 2d @@ -65207,28 +69421,28 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 379 */ +/* 400 */ /***/ function(module, exports, __webpack_require__) { - __webpack_require__(380); - __webpack_require__(381); + __webpack_require__(401); + __webpack_require__(402); - __webpack_require__(382); - __webpack_require__(383); - __webpack_require__(384); - __webpack_require__(385); - __webpack_require__(390); + __webpack_require__(403); + __webpack_require__(404); + __webpack_require__(405); + __webpack_require__(406); + __webpack_require__(411); /***/ }, -/* 380 */ +/* 401 */ /***/ function(module, exports, __webpack_require__) { - var featureManager = __webpack_require__(327); + var featureManager = __webpack_require__(344); var zrUtil = __webpack_require__(4); var ToolboxModel = __webpack_require__(1).extendComponentModel({ @@ -65299,17 +69513,17 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 381 */ +/* 402 */ /***/ function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(process) { - var featureManager = __webpack_require__(327); + var featureManager = __webpack_require__(344); var zrUtil = __webpack_require__(4); - var graphic = __webpack_require__(43); + var graphic = __webpack_require__(44); var Model = __webpack_require__(12); var DataDiffer = __webpack_require__(99); - var listComponentHelper = __webpack_require__(297); + var listComponentHelper = __webpack_require__(313); var textContain = __webpack_require__(8); module.exports = __webpack_require__(1).extendComponentView({ @@ -65551,10 +69765,10 @@ return /******/ (function(modules) { // webpackBootstrap } - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(289))) + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(305))) /***/ }, -/* 382 */ +/* 403 */ /***/ function(module, exports, __webpack_require__) { @@ -65618,7 +69832,7 @@ return /******/ (function(modules) { // webpackBootstrap } }; - __webpack_require__(327).register( + __webpack_require__(344).register( 'saveAsImage', SaveAsImage ); @@ -65626,7 +69840,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 383 */ +/* 404 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -65800,13 +70014,13 @@ return /******/ (function(modules) { // webpackBootstrap ecModel.mergeOption(payload.newOption); }); - __webpack_require__(327).register('magicType', MagicType); + __webpack_require__(344).register('magicType', MagicType); module.exports = MagicType; /***/ }, -/* 384 */ +/* 405 */ /***/ function(module, exports, __webpack_require__) { /** @@ -66117,7 +70331,7 @@ return /******/ (function(modules) { // webpackBootstrap var viewMain = document.createElement('div'); var textarea = document.createElement('textarea'); - viewMain.style.cssText = 'display:block;width:100%;overflow:hidden;'; + viewMain.style.cssText = 'display:block;width:100%;overflow:auto;'; var optionToContent = model.get('optionToContent'); var contentToOption = model.get('contentToOption'); @@ -66253,7 +70467,7 @@ return /******/ (function(modules) { // webpackBootstrap }); } - __webpack_require__(327).register('dataView', DataView); + __webpack_require__(344).register('dataView', DataView); __webpack_require__(1).registerAction({ type: 'changeDataView', @@ -66289,21 +70503,21 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 385 */ +/* 406 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var zrUtil = __webpack_require__(4); - var BrushController = __webpack_require__(236); - var brushHelper = __webpack_require__(322); - var history = __webpack_require__(386); + var BrushController = __webpack_require__(250); + var BrushTargetManager = __webpack_require__(339); + var history = __webpack_require__(407); var each = zrUtil.each; // Use dataZoomSelect - __webpack_require__(387); + __webpack_require__(408); // Spectial component id start with \0ec\0, see echarts/model/Global.js~hasInnerId var DATA_ZOOM_ID_BASE = '\0_ec_\0toolbox-dataZoom_'; @@ -66393,57 +70607,44 @@ return /******/ (function(modules) { // webpackBootstrap this._brushController.updateCovers([]); // remove cover - var coordInfoList = brushHelper.makeCoordInfoList( - retrieveAxisSetting(this.model.option), ecModel + var brushTargetManager = new BrushTargetManager( + retrieveAxisSetting(this.model.option), ecModel, {include: ['grid']} ); - var rangesCoordInfoList = []; - brushHelper.parseOutputRanges(areas, coordInfoList, ecModel, rangesCoordInfoList); - - var area = areas[0]; // dataZoom can not multiple area. - var coordInfo = rangesCoordInfoList[0]; - var coordRange = area.coordRange; - var brushType = area.brushType; + brushTargetManager.matchOutputRanges(areas, ecModel, function (area, coordRange, coordSys) { + if (coordSys.type !== 'cartesian2d') { + return; + } - if (coordInfo && coordRange) { + var brushType = area.brushType; if (brushType === 'rect') { - setBatch('xAxis', coordRange[0], coordInfo); - setBatch('yAxis', coordRange[1], coordInfo); + setBatch('x', coordSys, coordRange[0]); + setBatch('y', coordSys, coordRange[1]); } else { - var axisNames = {lineX: 'xAxis', lineY: 'yAxis'}; - setBatch(axisNames[brushType], coordRange, coordInfo); + setBatch(({lineX: 'x', lineY: 'y'})[brushType], coordSys, coordRange); } - } + }); history.push(ecModel, snapshot); this._dispatchZoomAction(snapshot); - function setBatch(axisName, minMax, coordInfo) { - var dataZoomModel = findDataZoom(axisName, coordInfo[axisName], ecModel); - if (dataZoomModel) { - snapshot[dataZoomModel.id] = { - dataZoomId: dataZoomModel.id, - startValue: minMax[0], - endValue: minMax[1] - }; - } + function setBatch(dimName, coordSys, minMax) { + var dataZoomModel = findDataZoom(dimName, coordSys.getAxis(dimName).model, ecModel); + dataZoomModel && (snapshot[dataZoomModel.id] = { + dataZoomId: dataZoomModel.id, + startValue: minMax[0], + endValue: minMax[1] + }); } - function findDataZoom(axisName, axisModel, ecModel) { - var dataZoomModel; - ecModel.eachComponent( - {mainType: 'dataZoom', subType: 'select'}, - function (dzModel, dataZoomIndex) { - var axisIndex = dzModel.get(axisName + 'Index'); - if (axisIndex != null - && ecModel.getComponent(axisName, axisIndex) === axisModel - ) { - dataZoomModel = dzModel; - } - } - ); - return dataZoomModel; + function findDataZoom(dimName, axisModel, ecModel) { + var found; + ecModel.eachComponent({mainType: 'dataZoom', subType: 'select'}, function (dzModel) { + var has = dzModel.getAxisModel(dimName, axisModel.componentIndex); + has && (found = dzModel); + }); + return found; } }; @@ -66495,24 +70696,25 @@ return /******/ (function(modules) { // webpackBootstrap featureModel.setIconStatus('zoom', zoomActive ? 'emphasis' : 'normal'); - var coordInfoList = brushHelper.makeCoordInfoList( - retrieveAxisSetting(featureModel.option), ecModel + var brushTargetManager = new BrushTargetManager( + retrieveAxisSetting(featureModel.option), ecModel, {include: ['grid']} ); - var brushType = (coordInfoList.xAxisHas && !coordInfoList.yAxisHas) - ? 'lineX' - : (!coordInfoList.xAxisHas && coordInfoList.yAxisHas) - ? 'lineY' - : 'rect'; view._brushController - .setPanels(brushHelper.makePanelOpts(coordInfoList)) + .setPanels(brushTargetManager.makePanelOpts(function (targetInfo) { + return (targetInfo.xAxisDeclared && !targetInfo.yAxisDeclared) + ? 'lineX' + : (!targetInfo.xAxisDeclared && targetInfo.yAxisDeclared) + ? 'lineY' + : 'rect'; + })) .enableBrush( zoomActive ? { - brushType: brushType, - brushStyle: { // FIXME user customized? + brushType: 'auto', + brushStyle: { + // FIXME user customized? lineWidth: 0, - // stroke: '#333', fill: 'rgba(0,0,0,0.2)' } } @@ -66521,7 +70723,7 @@ return /******/ (function(modules) { // webpackBootstrap } - __webpack_require__(327).register('dataZoom', DataZoom); + __webpack_require__(344).register('dataZoom', DataZoom); // Create special dataZoom option for select @@ -66597,7 +70799,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 386 */ +/* 407 */ /***/ function(module, exports, __webpack_require__) { /** @@ -66711,7 +70913,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 387 */ +/* 408 */ /***/ function(module, exports, __webpack_require__) { /** @@ -66719,21 +70921,21 @@ return /******/ (function(modules) { // webpackBootstrap */ - __webpack_require__(330); + __webpack_require__(351); - __webpack_require__(331); - __webpack_require__(334); + __webpack_require__(352); + __webpack_require__(355); - __webpack_require__(388); - __webpack_require__(389); + __webpack_require__(409); + __webpack_require__(410); - __webpack_require__(341); - __webpack_require__(342); + __webpack_require__(362); + __webpack_require__(363); /***/ }, -/* 388 */ +/* 409 */ /***/ function(module, exports, __webpack_require__) { /** @@ -66741,7 +70943,7 @@ return /******/ (function(modules) { // webpackBootstrap */ - var DataZoomModel = __webpack_require__(331); + var DataZoomModel = __webpack_require__(352); module.exports = DataZoomModel.extend({ @@ -66752,12 +70954,12 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 389 */ +/* 410 */ /***/ function(module, exports, __webpack_require__) { - module.exports = __webpack_require__(334).extend({ + module.exports = __webpack_require__(355).extend({ type: 'dataZoom.select' @@ -66766,13 +70968,13 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 390 */ +/* 411 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; - var history = __webpack_require__(386); + var history = __webpack_require__(407); function Restore(model) { this.model = model; @@ -66796,7 +70998,7 @@ return /******/ (function(modules) { // webpackBootstrap }; - __webpack_require__(327).register('restore', Restore); + __webpack_require__(344).register('restore', Restore); __webpack_require__(1).registerAction( @@ -66810,16 +71012,16 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 391 */ +/* 412 */ /***/ function(module, exports, __webpack_require__) { - __webpack_require__(392); - __webpack_require__(82).registerPainter('vml', __webpack_require__(394)); + __webpack_require__(413); + __webpack_require__(82).registerPainter('vml', __webpack_require__(415)); /***/ }, -/* 392 */ +/* 413 */ /***/ function(module, exports, __webpack_require__) { // http://www.w3.org/TR/NOTE-VML @@ -66829,18 +71031,18 @@ return /******/ (function(modules) { // webpackBootstrap if (!__webpack_require__(2).canvasSupported) { var vec2 = __webpack_require__(10); var BoundingRect = __webpack_require__(9); - var CMD = __webpack_require__(49).CMD; + var CMD = __webpack_require__(50).CMD; var colorTool = __webpack_require__(39); var textContain = __webpack_require__(8); - var RectText = __webpack_require__(48); - var Displayable = __webpack_require__(46); - var ZImage = __webpack_require__(61); + var RectText = __webpack_require__(49); + var Displayable = __webpack_require__(47); + var ZImage = __webpack_require__(62); var Text = __webpack_require__(63); - var Path = __webpack_require__(45); + var Path = __webpack_require__(46); var Gradient = __webpack_require__(79); - var vmlCore = __webpack_require__(393); + var vmlCore = __webpack_require__(414); var round = Math.round; var sqrt = Math.sqrt; @@ -67879,7 +72081,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 393 */ +/* 414 */ /***/ function(module, exports, __webpack_require__) { @@ -67932,7 +72134,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 394 */ +/* 415 */ /***/ function(module, exports, __webpack_require__) { /** @@ -67943,8 +72145,8 @@ return /******/ (function(modules) { // webpackBootstrap - var zrLog = __webpack_require__(40); - var vmlCore = __webpack_require__(393); + var zrLog = __webpack_require__(41); + var vmlCore = __webpack_require__(414); function parseInt10(val) { return parseInt(val, 10); @@ -68118,7 +72320,7 @@ return /******/ (function(modules) { // webpackBootstrap } var notSupportedMethods = [ - 'getLayer', 'insertLayer', 'eachLayer', 'eachBuildinLayer', 'eachOtherLayer', 'getLayers', + 'getLayer', 'insertLayer', 'eachLayer', 'eachBuiltinLayer', 'eachOtherLayer', 'getLayers', 'modLayer', 'delLayer', 'clearLayer', 'toDataURL', 'pathToImage' ]; diff --git a/dist/echarts.min.js b/dist/echarts.min.js index 3563d8c66b..fcd1e59b95 100644 --- a/dist/echarts.min.js +++ b/dist/echarts.min.js @@ -1,4 +1,4 @@ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.echarts=e():t.echarts=e()}(this,function(){return function(t){function e(n){if(i[n])return i[n].exports;var o=i[n]={exports:{},id:n,loaded:!1};return t[n].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var i={};return e.m=t,e.c=i,e.p="",e(0)}([function(t,e,i){t.exports=i(2),i(100),i(94),i(104),i(178),i(310),i(298),i(325),i(272),i(268),i(264),i(305),i(315),i(250),i(255),i(261),i(293),i(285),i(309),i(320),i(191),i(31),i(192),i(215),i(348),i(345),i(232),i(233),i(338),i(206),i(181),i(362),i(199),i(198),i(197),i(352),i(207),i(222)},function(t,e){function i(t){if(null==t||"object"!=typeof t)return t;var e=t,n=O.call(t);if("[object Array]"===n){e=[];for(var o=0,r=t.length;oe.get("hoverLayerThreshold")&&!w.node&&i.traverse(function(t){t.isGroup||(t.useHoverLayer=!0)})}function x(t,e){var i=0;e.group.traverse(function(t){"group"===t.type||t.ignore||i++});var n=+t.get("progressive"),o=i>t.get("progressiveThreshold")&&n&&!w.node;o&&e.group.traverse(function(t){t.isGroup||(t.progressive=o?Math.floor(i++/n):-1,o&&t.stopAnimation(!0))});var r=t.get("blendMode")||null;e.group.traverse(function(t){t.isGroup||t.setStyle("blend",r)})}function _(t,e){var i=t.get("z"),n=t.get("zlevel");e.group.traverse(function(t){"group"!==t.type&&(null!=i&&(t.z=i),null!=n&&(t.zlevel=n))})}function b(t){function e(t,e){for(var i=0;ie.get("hoverLayerThreshold")&&!w.node&&i.traverse(function(t){t.isGroup||(t.useHoverLayer=!0)})}function x(t,e){var i=0;e.group.traverse(function(t){"group"===t.type||t.ignore||i++});var n=+t.get("progressive"),o=i>t.get("progressiveThreshold")&&n&&!w.node;o&&e.group.traverse(function(t){t.isGroup||(t.progressive=o?Math.floor(i++/n):-1,o&&t.stopAnimation(!0))});var a=t.get("blendMode")||null;e.group.traverse(function(t){t.isGroup||t.setStyle("blend",a)})}function _(t,e){var i=t.get("z"),n=t.get("zlevel");e.group.traverse(function(t){"group"!==t.type&&(null!=i&&(t.z=i),null!=n&&(t.zlevel=n))})}function b(t){function e(t,e){for(var i=0;i=0&&E.each(t,function(t){var o=t.coordinateSystem;if(o&&o.containPoint)i|=!!o.containPoint(e);else if("seriesModels"===n){var r=this._chartsMap[t.__viewId];r&&r.containPoint&&(i|=r.containPoint(e,t))}},this)},this),!!i},K.getVisual=function(t,e){var i=this._model;t=k.parseFinder(i,t,{defaultMainType:"series"});var n=t.seriesModel,o=n.getData(),r=t.hasOwnProperty("dataIndexInside")?t.dataIndexInside:t.hasOwnProperty("dataIndex")?o.indexOfRawIndex(t.dataIndex):null;return null!=r?o.getItemVisual(r,e):o.getVisual(e)};var J={update:function(t){var e=this._model,i=this._api,n=this._coordSysMgr,o=this._zr;if(e){e.restoreData(),n.create(this._model,this._api),f.call(this,e,i),p.call(this,e),n.update(e,i),m.call(this,e,t),v.call(this,e,t);var r=e.get("backgroundColor")||"transparent",a=o.painter;if(a.isSingleCanvas&&a.isSingleCanvas())o.configLayer(0,{clearColor:r});else{if(!w.canvasSupported){var s=R.parse(r);r=R.stringify(s,"rgb"),0===s[3]&&(r="transparent")}r.colorStops||r.image?(o.configLayer(0,{clearColor:r}),this[Y]=!0,this._dom.style.background="transparent"):(this[Y]&&o.configLayer(0,{clearColor:null}),this[Y]=!1,this._dom.style.background=r)}}},updateView:function(t){var e=this._model;e&&(e.eachSeries(function(t){t.getData().clearAllVisual()}),m.call(this,e,t),c.call(this,"updateView",e,t))},updateVisual:function(t){var e=this._model;e&&(e.eachSeries(function(t){t.getData().clearAllVisual()}),m.call(this,e,t,!0),c.call(this,"updateVisual",e,t))},updateLayout:function(t){var e=this._model;e&&(g.call(this,e,t),c.call(this,"updateLayout",e,t))},prepareAndUpdate:function(t){var e=this._model;d.call(this,"component",e),d.call(this,"chart",e),this.__lastOnlyGraphic?(B(this._componentsViews,function(i){var n=i.__model;n&&"graphic"===n.mainType&&(i.render(n,e,this._api,t),_(n,i))},this),this.__lastOnlyGraphic=!1):J.update.call(this,t)}};K.resize=function(t){this[X]=!0,this._zr.resize(t);var e=this._model&&this._model.resetOption("media"),i=e?"prepareAndUpdate":"update";J[i].call(this),this._loadingFX&&this._loadingFX.resize(),this[X]=!1;var n=t&&t.silent;u.call(this,n),h.call(this,n)},K.showLoading=function(t,e){if(E.isObject(t)&&(e=t,t=""),t=t||"default",this.hideLoading(),st[t]){var i=st[t](this._api,e),n=this._zr;this._loadingFX=i,n.add(i)}},K.hideLoading=function(){this._loadingFX&&this._zr.remove(this._loadingFX),this._loadingFX=null},K.makeActionFromEvent=function(t){var e=E.extend({},t);return e.type=it[t.type],e},K.dispatchAction=function(t,e){if(E.isObject(e)||(e={silent:!!e}),et[t.type]){if(this[X])return void this._pendingActions.push(t);l.call(this,t,e.silent),e.flush?this._zr.flush(!0):e.flush!==!1&&w.browser.weChat&&this._throttledZrFlush(),u.call(this,e.silent),h.call(this,e.silent)}},K.on=n("on"),K.off=n("off"),K.one=n("one");var tt=["click","dblclick","mouseover","mouseout","mousemove","mousedown","mouseup","globalout","contextmenu"];K._initEvents=function(){B(tt,function(t){this._zr.on(t,function(e){var i,n=this.getModel(),o=e.target;if("globalout"===t)i={};else if(o&&null!=o.dataIndex){var r=o.dataModel||n.getSeriesByIndex(o.seriesIndex);i=r&&r.getDataParams(o.dataIndex,o.dataType)||{}}else o&&o.eventData&&(i=E.extend({},o.eventData));i&&(i.event=e,i.type=t,this.trigger(t,i))},this)},this),B(it,function(t,e){this._messageCenter.on(e,function(t){this.trigger(e,t)},this)},this)},K.isDisposed=function(){return this._disposed},K.clear=function(){this.setOption({series:[]},!0)},K.dispose=function(){if(!this._disposed){this._disposed=!0;var t=this._api,e=this._model;B(this._componentsViews,function(i){i.dispose(e,t)}),B(this._chartsViews,function(i){i.dispose(e,t)}),this._zr.dispose(),delete lt[this.id]}},E.mixin(r,N);var et=[],it={},nt=[],ot=[],rt=[],at={},st={},lt={},ut={},ht=new Date-0,ct=new Date-0,dt="_echarts_instance_",ft={version:"3.4.0",dependencies:{zrender:"3.3.0"}};ft.init=function(t,e,i){var n=new r(t,e,i);return n.id="ec_"+ht++,lt[n.id]=n,t.setAttribute&&t.setAttribute(dt,n.id),b(n),n},ft.connect=function(t){if(E.isArray(t)){var e=t;t=null,E.each(e,function(e){null!=e.group&&(t=e.group)}),t=t||"g_"+ct++,E.each(e,function(e){e.group=t})}return ut[t]=!0,t},ft.disConnect=function(t){ut[t]=!1},ft.dispose=function(t){E.isDom(t)?t=ft.getInstanceByDom(t):"string"==typeof t&&(t=lt[t]),t instanceof r&&!t.isDisposed()&&t.dispose()},ft.getInstanceByDom=function(t){var e=t.getAttribute(dt);return lt[e]},ft.getInstanceById=function(t){return lt[t]},ft.registerTheme=function(t,e){at[t]=e},ft.registerPreprocessor=function(t){ot.push(t)},ft.registerProcessor=function(t,e){"function"==typeof t&&(e=t,t=F),nt.push({prio:t,func:e})},ft.registerAction=function(t,e,i){"function"==typeof e&&(i=e,e="");var n=E.isObject(t)?t.type:[t,t={event:e}][0];t.event=(t.event||n).toLowerCase(),e=t.event,E.assert(Q.test(n)&&Q.test(e)),et[n]||(et[n]={action:i,actionInfo:t}),it[e]=n},ft.registerCoordinateSystem=function(t,e){I.register(t,e)},ft.registerLayout=function(t,e){"function"==typeof t&&(e=t,t=W),rt.push({prio:t,func:e,isLayout:!0})},ft.registerVisual=function(t,e){"function"==typeof t&&(e=t,t=q),rt.push({prio:t,func:e})},ft.registerLoading=function(t,e){st[t]=e},ft.extendComponentModel=function(t){return A.extend(t)},ft.extendComponentView=function(t){return C.extend(t)},ft.extendSeriesModel=function(t){return L.extend(t)},ft.extendChartView=function(t){return D.extend(t)},ft.setCanvasCreator=function(t){E.createCanvas=t},ft.registerVisual(Z,i(139)),ft.registerPreprocessor(i(133)),ft.registerLoading("default",i(124)),ft.registerAction({type:"highlight",event:"highlight",update:"highlight"},E.noop),ft.registerAction({type:"downplay",event:"downplay",update:"downplay"},E.noop),ft.List=i(14),ft.Model=i(11),ft.graphic=i(3),ft.number=i(4),ft.format=i(8),ft.throttle=O.throttle,ft.matrix=i(20),ft.vector=i(5),ft.color=i(19),ft.util={},B(["map","each","filter","indexOf","inherits","reduce","filter","bind","curry","isArray","isString","isObject","isFunction","extend","defaults","clone"],function(t){ft.util[t]=E[t]}),ft.PRIORITY={PROCESSOR:{FILTER:F,STATISTIC:H},VISUAL:{LAYOUT:W,GLOBAL:Z,CHART:q,COMPONENT:j,BRUSH:U}},t.exports=ft},function(t,e,i){"use strict";function n(t){return null!=t&&"none"!=t}function o(t){return"string"==typeof t?_.lift(t,-.1):t}function r(t){if(t.__hoverStlDirty){var e=t.style.stroke,i=t.style.fill,r=t.__hoverStl;r.fill=r.fill||(n(i)?o(i):null),r.stroke=r.stroke||(n(e)?o(e):null);var a={};for(var s in r)r.hasOwnProperty(s)&&(a[s]=t.style[s]);t.__normalStl=a,t.__hoverStlDirty=!1}}function a(t){t.__isHover||(r(t),t.useHoverLayer?t.__zr&&t.__zr.addHover(t,t.__hoverStl):(t.setStyle(t.__hoverStl),t.z2+=1),t.__isHover=!0)}function s(t){if(t.__isHover){var e=t.__normalStl;t.useHoverLayer?t.__zr&&t.__zr.removeHover(t):(e&&t.setStyle(e),t.z2-=1),t.__isHover=!1}}function l(t){"group"===t.type?t.traverse(function(t){"group"!==t.type&&a(t)}):a(t)}function u(t){"group"===t.type?t.traverse(function(t){"group"!==t.type&&s(t)}):s(t)}function h(t,e){t.__hoverStl=t.hoverStyle||e||{},t.__hoverStlDirty=!0,t.__isHover&&r(t)}function c(t){this.__hoverSilentOnTouch&&t.zrByTouch||!this.__isEmphasis&&l(this)}function d(t){this.__hoverSilentOnTouch&&t.zrByTouch||!this.__isEmphasis&&u(this)}function f(){this.__isEmphasis=!0,l(this)}function p(){this.__isEmphasis=!1,u(this)}function g(t,e,i,n,o,r){"function"==typeof o&&(r=o,o=null);var a=n&&n.isAnimationEnabled();if(a){var s=t?"Update":"",l=n.getShallow("animationDuration"+s),u=n.getShallow("animationEasing"+s),h=n.getShallow("animationDelay"+s);"function"==typeof h&&(h=h(o,n.getAnimationDelayParams?n.getAnimationDelayParams(e,o):null)),"function"==typeof l&&(l=l(o)),l>0?e.animateTo(i,l,h||0,u,r):(e.attr(i),r&&r())}else e.attr(i),r&&r()}var m=i(1),v=i(169),y=Math.round,x=i(7),_=i(19),b=i(20),w=i(5),S={};S.Group=i(34),S.Image=i(49),S.Text=i(76),S.Circle=i(160),S.Sector=i(166),S.Ring=i(165),S.Polygon=i(162),S.Polyline=i(163),S.Rect=i(164),S.Line=i(161),S.BezierCurve=i(159),S.Arc=i(158),S.CompoundPath=i(153),S.LinearGradient=i(91),S.RadialGradient=i(154),S.BoundingRect=i(9),S.extendShape=function(t){return x.extend(t)},S.extendPath=function(t,e){return v.extendFromString(t,e)},S.makePath=function(t,e,i,n){var o=v.createFromString(t,e),r=o.getBoundingRect();if(i){var a=r.width/r.height;if("center"===n){var s,l=i.height*a;l<=i.width?s=i.height:(l=i.width,s=l/a);var u=i.x+i.width/2,h=i.y+i.height/2;i.x=u-l/2,i.y=h-s/2,i.width=l,i.height=s}S.resizePath(o,i)}return o},S.mergePath=v.mergePath,S.resizePath=function(t,e){if(t.applyTransform){var i=t.getBoundingRect(),n=i.calculateTransform(e);t.applyTransform(n)}},S.subPixelOptimizeLine=function(t){var e=S.subPixelOptimize,i=t.shape,n=t.style.lineWidth;return y(2*i.x1)===y(2*i.x2)&&(i.x1=i.x2=e(i.x1,n,!0)),y(2*i.y1)===y(2*i.y2)&&(i.y1=i.y2=e(i.y1,n,!0)),t},S.subPixelOptimizeRect=function(t){var e=S.subPixelOptimize,i=t.shape,n=t.style.lineWidth,o=i.x,r=i.y,a=i.width,s=i.height;return i.x=e(i.x,n,!0),i.y=e(i.y,n,!0),i.width=Math.max(e(o+a,n,!1)-i.x,0===a?0:1),i.height=Math.max(e(r+s,n,!1)-i.y,0===s?0:1),t},S.subPixelOptimize=function(t,e,i){var n=y(2*t);return(n+y(e))%2===0?n/2:(n+(i?1:-1))/2},S.setHoverStyle=function(t,e,i){t.__hoverSilentOnTouch=i&&i.hoverSilentOnTouch,"group"===t.type?t.traverse(function(t){"group"!==t.type&&h(t,e)}):h(t,e),t.on("mouseover",c).on("mouseout",d),t.on("emphasis",f).on("normal",p)},S.setText=function(t,e,i){var n=e.getShallow("position")||"inside",o=e.getShallow("offset"),r=n.indexOf("inside")>=0?"white":i,a=e.getModel("textStyle");m.extend(t,{textDistance:e.getShallow("distance")||5,textFont:a.getFont(),textPosition:n,textOffset:o,textFill:a.getTextColor()||r})},S.updateProps=function(t,e,i,n,o){g(!0,t,e,i,n,o)},S.initProps=function(t,e,i,n,o){g(!1,t,e,i,n,o)},S.getTransform=function(t,e){for(var i=b.identity([]);t&&t!==e;)b.mul(i,t.getLocalTransform(),i),t=t.parent;return i},S.applyTransform=function(t,e,i){return i&&(e=b.invert([],e)),w.applyTransform([],t,e)},S.transformDirection=function(t,e,i){var n=0===e[4]||0===e[5]||0===e[0]?1:Math.abs(2*e[4]/e[0]),o=0===e[4]||0===e[5]||0===e[2]?1:Math.abs(2*e[4]/e[2]),r=["left"===t?-n:"right"===t?n:0,"top"===t?-o:"bottom"===t?o:0];return r=S.applyTransform(r,e,i),Math.abs(r[0])>Math.abs(r[1])?r[0]>0?"right":"left":r[1]>0?"bottom":"top"},S.groupTransition=function(t,e,i,n){function o(t){var e={};return t.traverse(function(t){!t.isGroup&&t.anid&&(e[t.anid]=t)}),e}function r(t){var e={position:w.clone(t.position),rotation:t.rotation};return t.shape&&(e.shape=m.extend({},t.shape)),e}if(t&&e){var a=o(t);e.traverse(function(t){if(!t.isGroup&&t.anid){var e=a[t.anid];if(e){var n=r(t);t.attr(r(e)),S.updateProps(t,n,i,t.dataIndex)}}})}},t.exports=S},function(t,e){function i(t){return t.replace(/^\s+/,"").replace(/\s+$/,"")}var n={},o=1e-4;n.linearMap=function(t,e,i,n){var o=e[1]-e[0],r=i[1]-i[0];if(0===o)return 0===r?i[0]:(i[0]+i[1])/2;if(n)if(o>0){if(t<=e[0])return i[0];if(t>=e[1])return i[1]}else{if(t>=e[0])return i[0];if(t<=e[1])return i[1]}else{if(t===e[0])return i[0];if(t===e[1])return i[1]}return(t-e[0])/o*r+i[0]},n.parsePercent=function(t,e){switch(t){case"center":case"middle":t="50%";break;case"left":case"top":t="0%";break;case"right":case"bottom":t="100%"}return"string"==typeof t?i(t).match(/%$/)?parseFloat(t)/100*e:parseFloat(t):null==t?NaN:+t},n.round=function(t,e){return null==e&&(e=10),e=Math.min(Math.max(0,e),20),+(+t).toFixed(e)},n.asc=function(t){return t.sort(function(t,e){return t-e}),t},n.getPrecision=function(t){if(t=+t,isNaN(t))return 0;for(var e=1,i=0;Math.round(t*e)/e!==t;)e*=10,i++;return i},n.getPrecisionSafe=function(t){var e=t.toString(),i=e.indexOf(".");return i<0?0:e.length-1-i},n.getPixelPrecision=function(t,e){var i=Math.log,n=Math.LN10,o=Math.floor(i(t[1]-t[0])/n),r=Math.round(i(Math.abs(e[1]-e[0]))/n),a=Math.min(Math.max(-o+r,0),20);return isFinite(a)?a:20},n.MAX_SAFE_INTEGER=9007199254740991,n.remRadian=function(t){var e=2*Math.PI;return(t%e+e)%e},n.isRadianAroundZero=function(t){return t>-o&&t=0},t.exports=n},function(t,e){var i="undefined"==typeof Float32Array?Array:Float32Array,n={create:function(t,e){var n=new i(2);return null==t&&(t=0),null==e&&(e=0),n[0]=t,n[1]=e,n},copy:function(t,e){return t[0]=e[0],t[1]=e[1],t},clone:function(t){var e=new i(2);return e[0]=t[0],e[1]=t[1],e},set:function(t,e,i){return t[0]=e,t[1]=i,t},add:function(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t},scaleAndAdd:function(t,e,i,n){return t[0]=e[0]+i[0]*n,t[1]=e[1]+i[1]*n,t},sub:function(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t},len:function(t){return Math.sqrt(this.lenSquare(t))},lenSquare:function(t){return t[0]*t[0]+t[1]*t[1]},mul:function(t,e,i){return t[0]=e[0]*i[0],t[1]=e[1]*i[1],t},div:function(t,e,i){return t[0]=e[0]/i[0],t[1]=e[1]/i[1],t},dot:function(t,e){return t[0]*e[0]+t[1]*e[1]},scale:function(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t},normalize:function(t,e){var i=n.len(e);return 0===i?(t[0]=0,t[1]=0):(t[0]=e[0]/i,t[1]=e[1]/i),t},distance:function(t,e){return Math.sqrt((t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1]))},distanceSquare:function(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])},negate:function(t,e){return t[0]=-e[0],t[1]=-e[1],t},lerp:function(t,e,i,n){return t[0]=e[0]+n*(i[0]-e[0]),t[1]=e[1]+n*(i[1]-e[1]),t},applyTransform:function(t,e,i){var n=e[0],o=e[1];return t[0]=i[0]*n+i[2]*o+i[4],t[1]=i[1]*n+i[3]*o+i[5],t},min:function(t,e,i){return t[0]=Math.min(e[0],i[0]),t[1]=Math.min(e[1],i[1]),t},max:function(t,e,i){return t[0]=Math.max(e[0],i[0]),t[1]=Math.max(e[1],i[1]),t}};n.length=n.len,n.lengthSquare=n.lenSquare,n.dist=n.distance,n.distSquare=n.distanceSquare,t.exports=n},function(t,e,i){function n(t,e){return t&&t.hasOwnProperty(e)}var o=i(8),r=i(4),a=i(11),s=i(1),l=s.each,u=s.isObject,h={};h.normalizeToArray=function(t){return t instanceof Array?t:null==t?[]:[t]},h.defaultEmphasis=function(t,e){if(t){var i=t.emphasis=t.emphasis||{},n=t.normal=t.normal||{};l(e,function(t){var e=s.retrieve(i[t],n[t]);null!=e&&(i[t]=e)})}},h.LABEL_OPTIONS=["position","offset","show","textStyle","distance","formatter"],h.getDataItemValue=function(t){return t&&(null==t.value?t:t.value)},h.isDataItemOption=function(t){return u(t)&&!(t instanceof Array)},h.converDataValue=function(t,e){var i=e&&e.type;return"ordinal"===i?t:("time"!==i||isFinite(t)||null==t||"-"===t||(t=+r.parseDate(t)),null==t||""===t?NaN:+t)},h.createDataFormatModel=function(t,e){var i=new a;return s.mixin(i,h.dataFormatMixin),i.seriesIndex=e.seriesIndex,i.name=e.name||"",i.mainType=e.mainType,i.subType=e.subType,i.getData=function(){return t},i},h.dataFormatMixin={getDataParams:function(t,e){var i=this.getData(e),n=this.seriesIndex,o=this.name,r=this.getRawValue(t,e),a=i.getRawIndex(t),s=i.getName(t,!0),l=i.getRawDataItem(t);return{componentType:this.mainType,componentSubType:this.subType,seriesType:"series"===this.mainType?this.subType:null,seriesIndex:n,seriesName:o,name:s,dataIndex:a,data:l,dataType:e,value:r,color:i.getItemVisual(t,"color"),$vars:["seriesName","name","value"]}},getFormattedLabel:function(t,e,i,n){e=e||"normal";var r=this.getData(i),a=r.getItemModel(t),s=this.getDataParams(t,i);null!=n&&s.value instanceof Array&&(s.value=s.value[n]);var l=a.get(["label",e,"formatter"]);return"function"==typeof l?(s.status=e,l(s)):"string"==typeof l?o.formatTpl(l,s):void 0},getRawValue:function(t,e){var i=this.getData(e),n=i.getRawDataItem(t);if(null!=n)return!u(n)||n instanceof Array?n:n.value},formatTooltip:s.noop},h.mappingToExists=function(t,e){e=(e||[]).slice();var i=s.map(t||[],function(t,e){return{exist:t}});return l(e,function(t,n){if(u(t)){for(var o=0;o=i.length&&i.push({option:t})}}),i},h.makeIdAndName=function(t){var e={};l(t,function(t,i){var n=t.exist;n&&(e[n.id]=t)}),l(t,function(t,i){var n=t.option;s.assert(!n||null==n.id||!e[n.id]||e[n.id]===t,"id duplicates: "+(n&&n.id)),n&&null!=n.id&&(e[n.id]=t),!t.keyInfo&&(t.keyInfo={})}),l(t,function(t,i){var n=t.exist,o=t.option,r=t.keyInfo;if(u(o)){if(r.name=null!=o.name?o.name+"":n?n.name:"\0-",n)r.id=n.id;else if(null!=o.id)r.id=o.id+"";else{var a=0;do r.id="\0"+r.name+"\0"+a++;while(e[r.id])}e[r.id]=t}})},h.isIdInner=function(t){return u(t)&&t.id&&0===(t.id+"").indexOf("\0_ec_\0")},h.compressBatches=function(t,e){function i(t,e,i){for(var n=0,o=t.length;n1e-10&&(o.width+=r/a,o.height+=r/a,o.x-=r/a/2,o.y-=r/a/2)}return o}return t},contain:function(t,e){var i=this.transformCoordToLocal(t,e),n=this.getBoundingRect(),o=this.style;if(t=i[0],e=i[1],n.contain(t,e)){var r=this.path.data;if(o.hasStroke()){var a=o.lineWidth,l=o.strokeNoScale?this.getLineScale():1;if(l>1e-10&&(o.hasFill()||(a=Math.max(a,this.strokeContainThreshold)),s.containStroke(r,a/l,t,e)))return!0}if(o.hasFill())return s.contain(r,t,e)}return!1},dirty:function(t){null==t&&(t=!0),t&&(this.__dirtyPath=t,this._rect=null),this.__dirty=!0,this.__zr&&this.__zr.refresh(),this.__clipTarget&&this.__clipTarget.dirty()},animateShape:function(t){return this.animate("shape",t)},attrKV:function(t,e){"shape"===t?(this.setShape(e),this.__dirtyPath=!0,this._rect=null):o.prototype.attrKV.call(this,t,e)},setShape:function(t,e){var i=this.shape;if(i){if(r.isObject(t))for(var n in t)t.hasOwnProperty(n)&&(i[n]=t[n]);else i[t]=e;this.dirty(!0)}return this},getLineScale:function(){var t=this.transform;return t&&h(t[0]-1)>1e-10&&h(t[3]-1)>1e-10?Math.sqrt(h(t[0]*t[3]-t[2]*t[1])):1}},n.extend=function(t){var e=function(e){n.call(this,e),t.style&&this.style.extendFrom(t.style,!1);var i=t.shape;if(i){this.shape=this.shape||{};var o=this.shape;for(var r in i)!o.hasOwnProperty(r)&&i.hasOwnProperty(r)&&(o[r]=i[r])}t.init&&t.init.call(this,e)};r.inherits(e,n);for(var i in t)"style"!==i&&"shape"!==i&&(e.prototype[i]=t[i]);return e},r.inherits(n,o),t.exports=n},function(t,e,i){var n=i(1),o=i(4),r=i(17),a={};a.addCommas=function(t){return isNaN(t)?"-":(t=(t+"").split("."),t[0].replace(/(\d{1,3})(?=(?:\d{3})+(?!\d))/g,"$1,")+(t.length>1?"."+t[1]:""))},a.toCamelCase=function(t,e){return t=(t||"").toLowerCase().replace(/-(.)/g,function(t,e){return e.toUpperCase()}),e&&t&&(t=t.charAt(0).toUpperCase()+t.slice(1)),t},a.normalizeCssArray=function(t){var e=t.length;return"number"==typeof t?[t,t,t,t]:2===e?[t[0],t[1],t[0],t[1]]:3===e?[t[0],t[1],t[2],t[1]]:t};var s=a.encodeHTML=function(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")},l=["a","b","c","d","e","f","g"],u=function(t,e){return"{"+t+(null==e?"":e)+"}"};a.formatTpl=function(t,e,i){n.isArray(e)||(e=[e]);var o=e.length;if(!o)return"";for(var r=e[0].$vars||[],a=0;a=i.x&&t<=i.x+i.width&&e>=i.y&&e<=i.y+i.height},clone:function(){return new n(this.x,this.y,this.width,this.height)},copy:function(t){this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height},plain:function(){return{x:this.x,y:this.y,width:this.width,height:this.height}}},n.create=function(t){return new n(t.x,t.y,t.width,t.height)},t.exports=n},function(t,e){function i(t){var e={},i={},n=t.match(/Firefox\/([\d.]+)/),o=t.match(/MSIE\s([\d.]+)/)||t.match(/Trident\/.+?rv:(([\d.]+))/),r=t.match(/Edge\/([\d.]+)/),a=/micromessenger/i.test(t);return n&&(i.firefox=!0,i.version=n[1]),o&&(i.ie=!0,i.version=o[1]),r&&(i.edge=!0,i.version=r[1]),a&&(i.weChat=!0),{browser:i,os:e,node:!1,canvasSupported:!!document.createElement("canvas").getContext,touchEventsSupported:"ontouchstart"in window&&!i.ie&&!i.edge,pointerEventsSupported:"onpointerdown"in window&&(i.edge||i.ie&&i.version>=11)}}var n={};n="undefined"==typeof navigator?{browser:{},os:{},node:!0,canvasSupported:!0}:i(navigator.userAgent),t.exports=n},function(t,e,i){function n(t,e,i){this.parentModel=e,this.ecModel=i,this.option=t}function o(t,e,i){for(var n=0;nn||l.newline?(r=0,h=m,a+=s+i,s=f.height):s=Math.max(s,f.height)}else{var v=f.height+(g?-g.y+f.y:0);c=a+v,c>o||l.newline?(r+=s+i,a=0,c=v,s=f.width):s=Math.max(s,f.width)}l.newline||(d[0]=r,d[1]=a,"horizontal"===t?r=h+i:a=c+i)})}var o=i(1),r=i(9),a=i(4),s=i(8),l=a.parsePercent,u=o.each,h={},c=h.LOCATION_PARAMS=["left","right","top","bottom","width","height"];h.box=n,h.vbox=o.curry(n,"vertical"),h.hbox=o.curry(n,"horizontal"),h.getAvailableSize=function(t,e,i){var n=e.width,o=e.height,r=l(t.x,n),a=l(t.y,o),u=l(t.x2,n),h=l(t.y2,o);return(isNaN(r)||isNaN(parseFloat(t.x)))&&(r=0),(isNaN(u)||isNaN(parseFloat(t.x2)))&&(u=n),(isNaN(a)||isNaN(parseFloat(t.y)))&&(a=0),(isNaN(h)||isNaN(parseFloat(t.y2)))&&(h=o),i=s.normalizeCssArray(i||0),{width:Math.max(u-r-i[1]-i[3],0),height:Math.max(h-a-i[0]-i[2],0)}},h.getLayoutRect=function(t,e,i){i=s.normalizeCssArray(i||0);var n=e.width,o=e.height,a=l(t.left,n),u=l(t.top,o),h=l(t.right,n),c=l(t.bottom,o),d=l(t.width,n),f=l(t.height,o),p=i[2]+i[0],g=i[1]+i[3],m=t.aspect;switch(isNaN(d)&&(d=n-h-g-a),isNaN(f)&&(f=o-c-p-u),isNaN(d)&&isNaN(f)&&(m>n/o?d=.8*n:f=.8*o),null!=m&&(isNaN(d)&&(d=m*f),isNaN(f)&&(f=d/m)),isNaN(a)&&(a=n-h-d-g),isNaN(u)&&(u=o-c-f-p),t.left||t.right){case"center":a=n/2-d/2-i[3];break;case"right":a=n-d-g}switch(t.top||t.bottom){case"middle":case"center":u=o/2-f/2-i[0];break;case"bottom":u=o-f-p}a=a||0,u=u||0,isNaN(d)&&(d=n-a-(h||0)),isNaN(f)&&(f=o-u-(c||0));var v=new r(a+i[3],u+i[0],d,f);return v.margin=i,v},h.positionElement=function(t,e,i,n,a){var s=!a||!a.hv||a.hv[0],l=!a||!a.hv||a.hv[1],u=a&&a.boundingMode||"all";if(s||l){var c;if("raw"===u)c="group"===t.type?new r(0,0,+e.width||0,+e.height||0):t.getBoundingRect();else if(c=t.getBoundingRect(),t.needLocalTransform()){var d=t.getLocalTransform();c=c.clone(),c.applyTransform(d)}e=h.getLayoutRect(o.defaults({width:c.width, -height:c.height},e),i,n);var f=t.position,p=s?e.x-c.x:0,g=l?e.y-c.y:0;t.attr("position","raw"===u?[p,g]:[f[0]+p,f[1]+g])}},h.mergeLayoutParam=function(t,e,i){function n(n){var o={},s=0,l={},h=0,c=i.ignoreSize?1:2;if(u(n,function(e){l[e]=t[e]}),u(n,function(t){r(e,t)&&(o[t]=l[t]=e[t]),a(o,t)&&s++,a(l,t)&&h++}),h!==c&&s){if(s>=c)return o;for(var d=0;d=0;o--)n=r.merge(n,t[o],!0);l.set(this,"__defaultOption",n)}return l.get(this,"__defaultOption")},getReferringComponents:function(t){return this.ecModel.queryComponents({mainType:t,index:this.get(t+"Index",!0),id:this.get(t+"Id",!0)})}});l.enableClassManagement(h,{registerWhenExtend:!0}),s.enableSubTypeDefaulter(h),s.enableTopologicalTravel(h,n),r.mixin(h,i(129)),t.exports=h},function(t,e,i){(function(e){function n(t){return d.isArray(t)||(t=[t]),t}function o(t,e){var i=t.dimensions,n=new v(d.map(i,t.getDimensionInfo,t),t.hostModel);m(n,t);for(var o=n._storage={},r=t._storage,a=0;a=0?o[s]=new l.constructor(r[s].length):o[s]=r[s]}return n}var r="undefined",a="undefined"==typeof window?e:window,s=typeof a.Float64Array===r?Array:a.Float64Array,l=typeof a.Int32Array===r?Array:a.Int32Array,u={"float":s,"int":l,ordinal:Array,number:Array,time:Array},h=i(11),c=i(43),d=i(1),f=i(6),p=d.isObject,g=["stackedOn","hasItemOption","_nameList","_idList","_rawData"],m=function(t,e){d.each(g.concat(e.__wrappedMethods||[]),function(i){e.hasOwnProperty(i)&&(t[i]=e[i])}),t.__wrappedMethods=e.__wrappedMethods},v=function(t,e){t=t||["x","y"];for(var i={},n=[],o=0;o0&&(w+="__ec__"+h[b]),h[b]++),w&&(l[c]=w)}this._nameList=e,this._idList=l},y.count=function(){return this.indices.length},y.get=function(t,e,i){var n=this._storage,o=this.indices[e];if(null==o)return NaN;var r=n[t]&&n[t][o];if(i){var a=this._dimensionInfos[t];if(a&&a.stackable)for(var s=this.stackedOn;s;){var l=s.get(t,e);(r>=0&&l>0||r<=0&&l<0)&&(r+=l),s=s.stackedOn}}return r},y.getValues=function(t,e,i){var n=[];d.isArray(t)||(i=e,e=t,t=this.dimensions);for(var o=0,r=t.length;ol&&(l=r));return this._extent[t+!!e]=[s,l]}return[1/0,-(1/0)]},y.getSum=function(t,e){var i=this._storage[t],n=0;if(i)for(var o=0,r=this.count();ot))return r;o=r-1}}return-1},y.indexOfNearest=function(t,e,i,n){var o=this._storage,r=o[t];null==n&&(n=1/0);var a=-1;if(r)for(var s=Number.MAX_VALUE,l=0,u=this.count();l0)&&(s=c,a=l)}return a},y.getRawIndex=function(t){var e=this.indices[t];return null==e?-1:e},y.getRawDataItem=function(t){return this._rawData[this.getRawIndex(t)]},y.getName=function(t){return this._nameList[this.indices[t]]||""},y.getId=function(t){return this._idList[this.indices[t]]||this.getRawIndex(t)+""},y.each=function(t,e,i,o){"function"==typeof t&&(o=i,i=e,e=t,t=[]),t=d.map(n(t),this.getDimension,this);var r=[],a=t.length,s=this.indices;o=o||this;for(var l=0;lp-g&&(d=p-g,h.length=d);for(var m=0;m',g=this.name;return"\0-"===g&&(g=""),e?c+f(this.name)+" : "+l:(g&&f(g)+"
")+c+(u?f(u)+" : "+l:l)},isAnimationEnabled:function(){if(u.node)return!1;var t=this.getShallow("animation");return t&&this.getData().count()>this.getShallow("animationThreshold")&&(t=!1),t},restoreData:function(){c(this,"data",d(this,"dataBeforeProcessed").cloneShallow())},getColorFromPalette:function(t,e){var i=this.ecModel,n=l.getColorFromPalette.call(this,t,e);return n||(n=i.getColorFromPalette(t,e)),n},getAxisTooltipDataIndex:null,getTooltipPosition:null});n.mixin(g,a.dataFormatMixin),n.mixin(g,l),t.exports=g},function(t,e,i){function n(t,e){var i=t+":"+e;if(l[i])return l[i];for(var n=(t+"").split("\n"),o=0,r=0,a=n.length;rh&&(u=0,l={}),u++,l[i]=o,o}function o(t,e,i,o){var r=((t||"")+"").split("\n").length,a=n(t,e),s=n("国",e),l=r*s,u=new d(0,0,a,l);switch(u.lineHeight=s,o){case"bottom":case"alphabetic":u.y-=s;break;case"middle":u.y-=s/2}switch(i){case"end":case"right":u.x-=u.width;break;case"center":u.x-=u.width/2}return u}function r(t,e,i,n){var o=e.x,r=e.y,a=e.height,s=e.width,l=i.height,u=a/2-l/2,h="left";switch(t){case"left":o-=n,r+=u,h="right";break;case"right":o+=n+s,r+=u,h="left";break;case"top":o+=s/2,r-=n+l,h="center";break;case"bottom":o+=s/2,r+=a+n,h="center";break;case"inside":o+=s/2,r+=u,h="center";break;case"insideLeft":o+=n,r+=u,h="left";break;case"insideRight":o+=s-n,r+=u,h="right";break;case"insideTop":o+=s/2,r+=n,h="center";break;case"insideBottom":o+=s/2,r+=a-l-n,h="center";break;case"insideTopLeft":o+=n,r+=n,h="left";break;case"insideTopRight":o+=s-n,r+=n,h="right";break;case"insideBottomLeft":o+=n,r+=a-l-n;break;case"insideBottomRight":o+=s-n,r+=a-l-n,h="right"}return{x:o,y:r,textAlign:h,textBaseline:"top"}}function a(t,e,i,o,r){if(!e)return"";r=r||{},o=f(o,"...");for(var a=f(r.maxIterations,2),l=f(r.minChar,0),u=n("国",i),h=n("a",i),c=f(r.placeholder,""),d=e=Math.max(0,e-1),p=0;p=h;p++)d-=h;var g=n(o);g>d&&(o="",g=0),d=e-g;for(var m=(t+"").split("\n"),p=0,v=m.length;p=a){y+=o;break}var b=0===_?s(y,d,h,u):x>0?Math.floor(y.length*d/x):0;y=y.substr(0,b),x=n(y,i)}""===y&&(y=c),m[p]=y}}return m.join("\n")}function s(t,e,i,n){for(var o=0,r=0,a=t.length;r-w&&tw||t<-w}function r(t,e,i,n,o){var r=1-o;return r*r*(r*t+3*o*e)+o*o*(o*n+3*r*i)}function a(t,e,i,n,o){var r=1-o;return 3*(((e-t)*r+2*(i-e)*o)*r+(n-i)*o*o)}function s(t,e,i,o,r,a){var s=o+3*(e-i)-t,l=3*(i-2*e+t),u=3*(e-t),h=t-r,c=l*l-3*s*u,d=l*u-9*s*h,f=u*u-3*l*h,p=0;if(n(c)&&n(d))if(n(l))a[0]=0;else{var g=-u/l;g>=0&&g<=1&&(a[p++]=g)}else{var m=d*d-4*c*f;if(n(m)){var v=d/c,g=-l/s+v,y=-v/2;g>=0&&g<=1&&(a[p++]=g),y>=0&&y<=1&&(a[p++]=y)}else if(m>0){var x=b(m),w=c*l+1.5*s*(-d+x),S=c*l+1.5*s*(-d-x);w=w<0?-_(-w,I):_(w,I),S=S<0?-_(-S,I):_(S,I);var g=(-l-(w+S))/(3*s);g>=0&&g<=1&&(a[p++]=g)}else{var T=(2*c*l-3*s*d)/(2*b(c*c*c)),A=Math.acos(T)/3,L=b(c),C=Math.cos(A),g=(-l-2*L*C)/(3*s),y=(-l+L*(C+M*Math.sin(A)))/(3*s),D=(-l+L*(C-M*Math.sin(A)))/(3*s);g>=0&&g<=1&&(a[p++]=g),y>=0&&y<=1&&(a[p++]=y),D>=0&&D<=1&&(a[p++]=D)}}return p}function l(t,e,i,r,a){var s=6*i-12*e+6*t,l=9*e+3*r-3*t-9*i,u=3*e-3*t,h=0;if(n(l)){if(o(s)){var c=-u/s;c>=0&&c<=1&&(a[h++]=c)}}else{var d=s*s-4*l*u;if(n(d))a[0]=-s/(2*l);else if(d>0){var f=b(d),c=(-s+f)/(2*l),p=(-s-f)/(2*l);c>=0&&c<=1&&(a[h++]=c),p>=0&&p<=1&&(a[h++]=p)}}return h}function u(t,e,i,n,o,r){var a=(e-t)*o+t,s=(i-e)*o+e,l=(n-i)*o+i,u=(s-a)*o+a,h=(l-s)*o+s,c=(h-u)*o+u;r[0]=t,r[1]=a,r[2]=u,r[3]=c,r[4]=c,r[5]=h,r[6]=l,r[7]=n}function h(t,e,i,n,o,a,s,l,u,h,c){var d,f,p,g,m,v=.005,y=1/0;T[0]=u,T[1]=h;for(var _=0;_<1;_+=.05)A[0]=r(t,i,o,s,_),A[1]=r(e,n,a,l,_),g=x(T,A),g=0&&g=0&&c<=1&&(a[h++]=c)}}else{var d=l*l-4*s*u;if(n(d)){var c=-l/(2*s);c>=0&&c<=1&&(a[h++]=c)}else if(d>0){var f=b(d),c=(-l+f)/(2*s),p=(-l-f)/(2*s);c>=0&&c<=1&&(a[h++]=c),p>=0&&p<=1&&(a[h++]=p)}}return h}function p(t,e,i){var n=t+i-2*e;return 0===n?.5:(t-e)/n}function g(t,e,i,n,o){var r=(e-t)*n+t,a=(i-e)*n+e,s=(a-r)*n+r;o[0]=t,o[1]=r,o[2]=s,o[3]=s,o[4]=a,o[5]=i}function m(t,e,i,n,o,r,a,s,l){var u,h=.005,d=1/0;T[0]=a,T[1]=s;for(var f=0;f<1;f+=.05){A[0]=c(t,i,o,f),A[1]=c(e,n,r,f);var p=x(T,A);p=0&&p255?255:t}function n(t){return t=Math.round(t),t<0?0:t>360?360:t}function o(t){return t<0?0:t>1?1:t}function r(t){return i(t.length&&"%"===t.charAt(t.length-1)?parseFloat(t)/100*255:parseInt(t,10))}function a(t){return o(t.length&&"%"===t.charAt(t.length-1)?parseFloat(t)/100:parseFloat(t))}function s(t,e,i){return i<0?i+=1:i>1&&(i-=1),6*i<1?t+(e-t)*i*6:2*i<1?e:3*i<2?t+(e-t)*(2/3-i)*6:t}function l(t,e,i){return t+(e-t)*i}function u(t){if(t){t+="";var e=t.replace(/ /g,"").toLowerCase();if(e in x)return x[e].slice();if("#"!==e.charAt(0)){var i=e.indexOf("("),n=e.indexOf(")");if(i!==-1&&n+1===e.length){var o=e.substr(0,i),s=e.substr(i+1,n-(i+1)).split(","),l=1;switch(o){case"rgba":if(4!==s.length)return;l=a(s.pop());case"rgb":if(3!==s.length)return;return[r(s[0]),r(s[1]),r(s[2]),l];case"hsla":if(4!==s.length)return;return s[3]=a(s[3]),h(s);case"hsl":if(3!==s.length)return;return h(s);default:return}}}else{if(4===e.length){var u=parseInt(e.substr(1),16);if(!(u>=0&&u<=4095))return;return[(3840&u)>>4|(3840&u)>>8,240&u|(240&u)>>4,15&u|(15&u)<<4,1]}if(7===e.length){var u=parseInt(e.substr(1),16);if(!(u>=0&&u<=16777215))return;return[(16711680&u)>>16,(65280&u)>>8,255&u,1]}}}}function h(t){var e=(parseFloat(t[0])%360+360)%360/360,n=a(t[1]),o=a(t[2]),r=o<=.5?o*(n+1):o+n-o*n,l=2*o-r,u=[i(255*s(l,r,e+1/3)),i(255*s(l,r,e)),i(255*s(l,r,e-1/3))];return 4===t.length&&(u[3]=t[3]),u}function c(t){if(t){var e,i,n=t[0]/255,o=t[1]/255,r=t[2]/255,a=Math.min(n,o,r),s=Math.max(n,o,r),l=s-a,u=(s+a)/2;if(0===l)e=0,i=0;else{i=u<.5?l/(s+a):l/(2-s-a);var h=((s-n)/6+l/2)/l,c=((s-o)/6+l/2)/l,d=((s-r)/6+l/2)/l;n===s?e=d-c:o===s?e=1/3+h-d:r===s&&(e=2/3+c-h),e<0&&(e+=1),e>1&&(e-=1)}var f=[360*e,i,u];return null!=t[3]&&f.push(t[3]),f}}function d(t,e){var i=u(t);if(i){for(var n=0;n<3;n++)e<0?i[n]=i[n]*(1-e)|0:i[n]=(255-i[n])*e+i[n]|0;return y(i,4===i.length?"rgba":"rgb")}}function f(t,e){var i=u(t);if(i)return((1<<24)+(i[0]<<16)+(i[1]<<8)+ +i[2]).toString(16).slice(1)}function p(t,e,n){if(e&&e.length&&t>=0&&t<=1){n=n||[0,0,0,0];var o=t*(e.length-1),r=Math.floor(o),a=Math.ceil(o),s=e[r],u=e[a],h=o-r;return n[0]=i(l(s[0],u[0],h)),n[1]=i(l(s[1],u[1],h)),n[2]=i(l(s[2],u[2],h)),n[3]=i(l(s[3],u[3],h)),n}}function g(t,e,n){if(e&&e.length&&t>=0&&t<=1){var r=t*(e.length-1),a=Math.floor(r),s=Math.ceil(r),h=u(e[a]),c=u(e[s]),d=r-a,f=y([i(l(h[0],c[0],d)),i(l(h[1],c[1],d)),i(l(h[2],c[2],d)),o(l(h[3],c[3],d))],"rgba");return n?{color:f,leftIndex:a,rightIndex:s,value:r}:f}}function m(t,e,i,o){if(t=u(t))return t=c(t),null!=e&&(t[0]=n(e)),null!=i&&(t[1]=a(i)),null!=o&&(t[2]=a(o)),y(h(t),"rgba")}function v(t,e){if(t=u(t),t&&null!=e)return t[3]=o(e),y(t,"rgba")}function y(t,e){var i=t[0]+","+t[1]+","+t[2];return"rgba"!==e&&"hsva"!==e&&"hsla"!==e||(i+=","+t[3]),e+"("+i+")"}var x={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};t.exports={parse:u,lift:d,toHex:f,fastMapToColor:p,mapToColor:g,modifyHSL:m,modifyAlpha:v,stringify:y}},function(t,e){var i="undefined"==typeof Float32Array?Array:Float32Array,n={create:function(){var t=new i(6);return n.identity(t),t},identity:function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t},copy:function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t},mul:function(t,e,i){var n=e[0]*i[0]+e[2]*i[1],o=e[1]*i[0]+e[3]*i[1],r=e[0]*i[2]+e[2]*i[3],a=e[1]*i[2]+e[3]*i[3],s=e[0]*i[4]+e[2]*i[5]+e[4],l=e[1]*i[4]+e[3]*i[5]+e[5];return t[0]=n,t[1]=o,t[2]=r,t[3]=a,t[4]=s,t[5]=l,t},translate:function(t,e,i){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4]+i[0],t[5]=e[5]+i[1],t},rotate:function(t,e,i){var n=e[0],o=e[2],r=e[4],a=e[1],s=e[3],l=e[5],u=Math.sin(i),h=Math.cos(i);return t[0]=n*h+a*u,t[1]=-n*u+a*h,t[2]=o*h+s*u,t[3]=-o*u+h*s,t[4]=h*r+u*l,t[5]=h*l-u*r,t},scale:function(t,e,i){var n=i[0],o=i[1];return t[0]=e[0]*n,t[1]=e[1]*o,t[2]=e[2]*n,t[3]=e[3]*o,t[4]=e[4]*n,t[5]=e[5]*o,t},invert:function(t,e){var i=e[0],n=e[2],o=e[4],r=e[1],a=e[3],s=e[5],l=i*a-r*n;return l?(l=1/l,t[0]=a*l,t[1]=-r*l,t[2]=-n*l,t[3]=i*l,t[4]=(n*s-a*o)*l,t[5]=(r*o-i*s)*l,t):null}};t.exports=n},function(t,e){var i=Array.prototype.slice,n=function(){this._$handlers={}};n.prototype={constructor:n,one:function(t,e,i){var n=this._$handlers;if(!e||!t)return this;n[t]||(n[t]=[]);for(var o=0;o3&&(e=i.call(e,1));for(var o=this._$handlers[t],r=o.length,a=0;a4&&(e=i.call(e,1,e.length-1));for(var o=e[e.length-1],r=this._$handlers[t],a=r.length,s=0;s0&&h>0&&!c&&(u=0),u<0&&h<0&&!d&&(h=0)),[u,h]},u.niceScaleExtent=function(t,e){var i=t.scale,n=u.getScaleExtent(t,e),o=null!=e.getMin(),r=null!=e.getMax(),a=e.get("splitNumber");"log"===i.type&&(i.base=e.get("logBase")),i.setExtent(n[0],n[1]),i.niceExtent(a,o,r);var s=e.get("minInterval");if(isFinite(s)&&!o&&!r&&"interval"===i.type){var l=i.getInterval(),h=Math.max(Math.abs(l),s)/l;n=i.getExtent();var c=(n[1]+n[0])/2;i.setExtent(h*(n[0]-c)+c,h*(n[1]-c)+c),i.niceExtent(a)}var l=e.get("interval");null!=l&&i.setInterval&&i.setInterval(l)},u.createScaleByModel=function(t,e){if(e=e||t.get("type"))switch(e){case"category":return new n(t.getCategories(),[1/0,-(1/0)]);case"value":return new o;default:return(r.getClass(e)||o).create(t)}},u.ifAxisCrossZero=function(t){var e=t.scale.getExtent(),i=e[0],n=e[1];return!(i>0&&n>0||i<0&&n<0)},u.getAxisLabelInterval=function(t,e,i,n){var o,r=0,a=0,s=1;e.length>40&&(s=Math.floor(e.length/40));for(var u=0;u1?s:(r+1)*s-1},u.getFormattedLabels=function(t,e){var i=t.scale,n=i.getTicksLabels(),o=i.getTicks();return"string"==typeof e?(e=function(t){return function(e){return t.replace("{value}",null!=e?e:"")}}(e),s.map(n,e)):"function"==typeof e?s.map(o,function(n,o){return e("category"===t.type?i.getLabel(n):n,o)},this):n},t.exports=u},function(t,e,i){"use strict";function n(){this._coordinateSystems=[]}var o=i(1),r={};n.prototype={constructor:n,create:function(t,e){var i=[];o.each(r,function(n,o){var r=n.create(t,e);i=i.concat(r||[])}),this._coordinateSystems=i},update:function(t,e){o.each(this._coordinateSystems,function(i){i.update&&i.update(t,e)})},getCoordinateSystems:function(){return this._coordinateSystems.slice()}},n.register=function(t,e){r[t]=e},n.get=function(t){return r[t]},t.exports=n},function(t,e,i){"use strict";var n=i(3),o=i(9),r=n.extendShape({type:"triangle", -shape:{cx:0,cy:0,width:0,height:0},buildPath:function(t,e){var i=e.cx,n=e.cy,o=e.width/2,r=e.height/2;t.moveTo(i,n-r),t.lineTo(i+o,n+r),t.lineTo(i-o,n+r),t.closePath()}}),a=n.extendShape({type:"diamond",shape:{cx:0,cy:0,width:0,height:0},buildPath:function(t,e){var i=e.cx,n=e.cy,o=e.width/2,r=e.height/2;t.moveTo(i,n-r),t.lineTo(i+o,n),t.lineTo(i,n+r),t.lineTo(i-o,n),t.closePath()}}),s=n.extendShape({type:"pin",shape:{x:0,y:0,width:0,height:0},buildPath:function(t,e){var i=e.x,n=e.y,o=e.width/5*3,r=Math.max(o,e.height),a=o/2,s=a*a/(r-a),l=n-r+a+s,u=Math.asin(s/a),h=Math.cos(u)*a,c=Math.sin(u),d=Math.cos(u);t.arc(i,l,a,Math.PI-u,2*Math.PI+u);var f=.6*a,p=.7*a;t.bezierCurveTo(i+h-c*f,l+s+d*f,i,n-p,i,n),t.bezierCurveTo(i,n-p,i-h+c*f,l+s+d*f,i-h,l+s),t.closePath()}}),l=n.extendShape({type:"arrow",shape:{x:0,y:0,width:0,height:0},buildPath:function(t,e){var i=e.height,n=e.width,o=e.x,r=e.y,a=n/3*2;t.moveTo(o,r),t.lineTo(o+a,r+i),t.lineTo(o,r+i/4*3),t.lineTo(o-a,r+i),t.lineTo(o,r),t.closePath()}}),u={line:n.Line,rect:n.Rect,roundRect:n.Rect,square:n.Rect,circle:n.Circle,diamond:a,pin:s,arrow:l,triangle:r},h={line:function(t,e,i,n,o){o.x1=t,o.y1=e+n/2,o.x2=t+i,o.y2=e+n/2},rect:function(t,e,i,n,o){o.x=t,o.y=e,o.width=i,o.height=n},roundRect:function(t,e,i,n,o){o.x=t,o.y=e,o.width=i,o.height=n,o.r=Math.min(i,n)/4},square:function(t,e,i,n,o){var r=Math.min(i,n);o.x=t,o.y=e,o.width=r,o.height=r},circle:function(t,e,i,n,o){o.cx=t+i/2,o.cy=e+n/2,o.r=Math.min(i,n)/2},diamond:function(t,e,i,n,o){o.cx=t+i/2,o.cy=e+n/2,o.width=i,o.height=n},pin:function(t,e,i,n,o){o.x=t+i/2,o.y=e+n/2,o.width=i,o.height=n},arrow:function(t,e,i,n,o){o.x=t+i/2,o.y=e+n/2,o.width=i,o.height=n},triangle:function(t,e,i,n,o){o.cx=t+i/2,o.cy=e+n/2,o.width=i,o.height=n}},c={};for(var d in u)u.hasOwnProperty(d)&&(c[d]=new u[d]);var f=n.extendShape({type:"symbol",shape:{symbolType:"",x:0,y:0,width:0,height:0},beforeBrush:function(){var t=this.style,e=this.shape;"pin"===e.symbolType&&"inside"===t.textPosition&&(t.textPosition=["50%","40%"],t.textAlign="center",t.textVerticalAlign="middle")},buildPath:function(t,e,i){var n=e.symbolType,o=c[n];"none"!==e.symbolType&&(o||(n="rect",o=c[n]),h[n](e.x,e.y,e.width,e.height,o.shape),o.buildPath(t,o.shape,i))}}),p=function(t){if("image"!==this.type){var e=this.style,i=this.shape;i&&"line"===i.symbolType?e.stroke=t:this.__isEmptyBrush?(e.stroke=t,e.fill="#fff"):(e.fill&&(e.fill=t),e.stroke&&(e.stroke=t)),this.dirty(!1)}},g={createSymbol:function(t,e,i,r,a,s){var l=0===t.indexOf("empty");l&&(t=t.substr(5,1).toLowerCase()+t.substr(6));var u;return u=0===t.indexOf("image://")?new n.Image({style:{image:t.slice(8),x:e,y:i,width:r,height:a}}):0===t.indexOf("path://")?n.makePath(t.slice(7),{},new o(e,i,r,a)):new f({shape:{symbolType:t,x:e,y:i,width:r,height:a}}),u.__isEmptyBrush=l,u.setColor=p,u.setColor(s),u}};t.exports=g},function(t,e,i){"use strict";function n(t){return t.getBoundingClientRect?t.getBoundingClientRect():{left:0,top:0}}function o(t,e,i,n){return i=i||{},n||!h.canvasSupported?r(t,e,i):h.browser.firefox&&null!=e.layerX&&e.layerX!==e.offsetX?(i.zrX=e.layerX,i.zrY=e.layerY):null!=e.offsetX?(i.zrX=e.offsetX,i.zrY=e.offsetY):r(t,e,i),i}function r(t,e,i){var o=n(t);i.zrX=e.clientX-o.left,i.zrY=e.clientY-o.top}function a(t,e,i){if(e=e||window.event,null!=e.zrX)return e;var n=e.type,r=n&&n.indexOf("touch")>=0;if(r){var a="touchend"!=n?e.targetTouches[0]:e.changedTouches[0];a&&o(t,a,e,i)}else o(t,e,e,i),e.zrDelta=e.wheelDelta?e.wheelDelta/120:-(e.detail||0)/3;return e}function s(t,e,i){c?t.addEventListener(e,i):t.attachEvent("on"+e,i)}function l(t,e,i){c?t.removeEventListener(e,i):t.detachEvent("on"+e,i)}var u=i(21),h=i(10),c="undefined"!=typeof window&&!!window.addEventListener,d=c?function(t){t.preventDefault(),t.stopPropagation(),t.cancelBubble=!0}:function(t){t.returnValue=!1,t.cancelBubble=!0};t.exports={clientToLocal:o,normalizeEvent:a,addEventListener:s,removeEventListener:l,stop:d,Dispatcher:u}},function(t,e){"use strict";var i={};t.exports={register:function(t,e){i[t]=e},get:function(t){return i[t]}}},function(t,e,i){function n(t,e,i,n){if(!e)return t;var s=o(e[0]),l=r.isArray(s)&&s.length||1;i=i||[],n=n||"extra";for(var u=0;uthis._ux||y(e-this._yi)>this._uy||this._len<5;return this.addData(l.L,t,e),this._ctx&&i&&(this._needsDash()?this._dashedLineTo(t,e):this._ctx.lineTo(t,e)),i&&(this._xi=t,this._yi=e),this},bezierCurveTo:function(t,e,i,n,o,r){return this.addData(l.C,t,e,i,n,o,r),this._ctx&&(this._needsDash()?this._dashedBezierTo(t,e,i,n,o,r):this._ctx.bezierCurveTo(t,e,i,n,o,r)),this._xi=o,this._yi=r,this},quadraticCurveTo:function(t,e,i,n){return this.addData(l.Q,t,e,i,n),this._ctx&&(this._needsDash()?this._dashedQuadraticTo(t,e,i,n):this._ctx.quadraticCurveTo(t,e,i,n)),this._xi=i,this._yi=n,this},arc:function(t,e,i,n,o,r){return this.addData(l.A,t,e,i,i,n,o-n,0,r?0:1),this._ctx&&this._ctx.arc(t,e,i,n,o,r),this._xi=g(o)*i+t,this._yi=m(o)*i+t,this},arcTo:function(t,e,i,n,o){return this._ctx&&this._ctx.arcTo(t,e,i,n,o),this},rect:function(t,e,i,n){return this._ctx&&this._ctx.rect(t,e,i,n),this.addData(l.R,t,e,i,n),this},closePath:function(){this.addData(l.Z);var t=this._ctx,e=this._x0,i=this._y0;return t&&(this._needsDash()&&this._dashedLineTo(e,i),t.closePath()),this._xi=e,this._yi=i,this},fill:function(t){t&&t.fill(),this.toStatic()},stroke:function(t){t&&t.stroke(),this.toStatic()},setLineDash:function(t){if(t instanceof Array){this._lineDash=t,this._dashIdx=0;for(var e=0,i=0;ie.length&&(this._expandData(),e=this.data);for(var i=0;i0&&g<=t||h<0&&g>=t||0==h&&(c>0&&m<=e||c<0&&m>=e);)n=this._dashIdx,i=a[n],g+=h*i,m+=c*i,this._dashIdx=(n+1)%y,h>0&&gl||c>0&&mu||s[n%2?"moveTo":"lineTo"](h>=0?f(g,t):p(g,t),c>=0?f(m,e):p(m,e));h=g-t,c=m-e,this._dashOffset=-v(h*h+c*c)},_dashedBezierTo:function(t,e,i,o,r,a){var s,l,u,h,c,d=this._dashSum,f=this._dashOffset,p=this._lineDash,g=this._ctx,m=this._xi,y=this._yi,x=n.cubicAt,_=0,b=this._dashIdx,w=p.length,S=0;for(f<0&&(f=d+f),f%=d,s=0;s<1;s+=.1)l=x(m,t,i,r,s+.1)-x(m,t,i,r,s),u=x(y,e,o,a,s+.1)-x(y,e,o,a,s),_+=v(l*l+u*u);for(;bf));b++);for(s=(S-f)/_;s<=1;)h=x(m,t,i,r,s),c=x(y,e,o,a,s),b%2?g.moveTo(h,c):g.lineTo(h,c),s+=p[b]/_,b=(b+1)%w;b%2!==0&&g.lineTo(r,a),l=r-h,u=a-c,this._dashOffset=-v(l*l+u*u)},_dashedQuadraticTo:function(t,e,i,n){var o=i,r=n;i=(i+2*t)/3,n=(n+2*e)/3,t=(this._xi+2*t)/3,e=(this._yi+2*e)/3,this._dashedBezierTo(t,e,i,n,o,r)},toStatic:function(){var t=this.data;t instanceof Array&&(t.length=this._len,x&&(this.data=new Float32Array(t)))},getBoundingRect:function(){u[0]=u[1]=c[0]=c[1]=Number.MAX_VALUE,h[0]=h[1]=d[0]=d[1]=-Number.MAX_VALUE;for(var t=this.data,e=0,i=0,n=0,s=0,f=0;fu||y(a-o)>h||d===c-1)&&(t.lineTo(r,a),n=r,o=a);break;case l.C:t.bezierCurveTo(s[d++],s[d++],s[d++],s[d++],s[d++],s[d++]),n=s[d-2],o=s[d-1];break;case l.Q:t.quadraticCurveTo(s[d++],s[d++],s[d++],s[d++]),n=s[d-2],o=s[d-1];break;case l.A:var p=s[d++],v=s[d++],x=s[d++],_=s[d++],b=s[d++],w=s[d++],S=s[d++],M=s[d++],I=x>_?x:_,T=x>_?1:x/_,A=x>_?_/x:1,L=Math.abs(x-_)>.001,C=b+w;L?(t.translate(p,v),t.rotate(S),t.scale(T,A),t.arc(0,0,I,b,C,1-M),t.scale(1/T,1/A),t.rotate(-S),t.translate(-p,-v)):t.arc(p,v,I,b,C,1-M),1==d&&(e=g(b)*x+p,i=m(b)*_+v),n=g(C)*x+p,o=m(C)*_+v;break;case l.R:e=n=s[d],i=o=s[d+1],t.rect(s[d++],s[d++],s[d++],s[d++]);break;case l.Z:t.closePath(),n=e,o=i}}}},_.CMD=l,t.exports=_},function(t,e,i){var n=i(1);t.exports=function(t){for(var e=0;e=0)){var a=this.getShallow(r);null!=a&&(i[t[o][0]]=a)}}return i}}},function(t,e,i){"use strict";var n=i(3),o=i(1),r=i(2);i(53),i(109),r.extendComponentView({type:"grid",render:function(t,e){this.group.removeAll(),t.get("show")&&this.group.add(new n.Rect({shape:t.coordinateSystem.getRect(),style:o.defaults({fill:t.get("backgroundColor")},t.getItemStyle()),silent:!0,z2:-1}))}}),r.registerPreprocessor(function(t){t.xAxis&&t.yAxis&&!t.grid&&(t.grid={})})},function(t,e,i){function n(){this._extent=[1/0,-(1/0)],this._interval=0,this.init&&this.init.apply(this,arguments)}var o=i(15),r=n.prototype;r.parse=function(t){return t},r.contain=function(t){var e=this._extent;return t>=e[0]&&t<=e[1]},r.normalize=function(t){var e=this._extent;return e[1]===e[0]?.5:(t-e[0])/(e[1]-e[0])},r.scale=function(t){var e=this._extent;return t*(e[1]-e[0])+e[0]},r.unionExtent=function(t){var e=this._extent;t[0]e[1]&&(e[1]=t[1])},r.unionExtentFromData=function(t,e){this.unionExtent(t.getDataExtent(e,!0))},r.getExtent=function(){return this._extent.slice()},r.setExtent=function(t,e){var i=this._extent;isNaN(t)||(i[0]=t),isNaN(e)||(i[1]=e)},r.getTicksLabels=function(){for(var t=[],e=this.getTicks(),i=0;i=0&&(i.splice(n,0,t),this._doAdd(t))}return this},_doAdd:function(t){t.parent&&t.parent.remove(t),t.parent=this;var e=this.__storage,i=this.__zr;e&&e!==t.__storage&&(e.addToMap(t),t instanceof a&&t.addChildrenToStorage(e)),i&&i.refresh()},remove:function(t){var e=this.__zr,i=this.__storage,o=this._children,r=n.indexOf(o,t);return r<0?this:(o.splice(r,1),t.parent=null,i&&(i.delFromMap(t.id),t instanceof a&&t.delChildrenFromStorage(i)),e&&e.refresh(),this)},removeAll:function(){var t,e,i=this._children,n=this.__storage;for(e=0;e=0&&o(t)?function(t,e,i,n){return d.isDataItemOption(t)&&(x.hasItemOption=!0),n===y?i:g(p(t),v[n])}:function(t,e,i,n){var o=p(t),r=g(o&&o[n],v[n]);d.isDataItemOption(t)&&(x.hasItemOption=!0);var a=s&&s.categoryAxesModels;return a&&a[e]&&"string"==typeof r&&(b[e]=b[e]||a[e].getCategories(),r=c.indexOf(b[e],r),r<0&&!isNaN(r)&&(r=+r)),r};return x.hasItemOption=!1,x.initData(t,_,w),x}function a(t){return"category"!==t&&"time"!==t}function s(t){return"category"===t?"ordinal":"time"===t?"time":"float"}function l(t,e){var i,n=[],o=t&&t.dimensions[t.categoryIndex];if(o&&(i=t.categoryAxesModels[o.name]),i){var r=i.getCategories();if(r){var a=e.length;if(c.isArray(e[0])&&e[0].length>1){n=[];for(var s=0;se[1]&&(e[1]=t[1]),h.prototype.setExtent.call(this,e[0],e[1])},getInterval:function(){return this._interval||this.niceTicks(),this._interval},setInterval:function(t){this._interval=t,this._niceExtent=this._extent.slice()},getTicks:function(){this._interval||this.niceTicks();var t=this._interval,e=this._extent,i=[],n=1e4;if(t){var o=this._niceExtent,r=l(t)+2;e[0]n)return[];e[1]>(i.length?i[i.length-1]:o[1])&&i.push(e[1])}return i},getTicksLabels:function(){for(var t=[],e=this.getTicks(),i=0;i0?100:20}},getFirstTargetAxisModel:function(){var t;return d(function(e){if(null==t){var i=this.get(e.axisIndex);i.length&&(t=this.dependentModels[e.axis][i[0]])}},this),t},eachTargetAxis:function(t,e){var i=this.ecModel;d(function(n){c(this.get(n.axisIndex),function(o){t.call(e,n,o,this,i)},this)},this)},getAxisProxy:function(t,e){return this._axisProxies[t+"_"+e]},setRawRange:function(t){c(["start","end","startValue","endValue"],function(e){this.option[e]=t[e]},this)},getPercentRange:function(){var t=this.findRepresentativeAxisProxy();if(t)return t.getDataPercentWindow()},getValueRange:function(t,e){if(null!=t||null!=e)return this.getAxisProxy(t,e).getDataValueWindow();var i=this.findRepresentativeAxisProxy();return i?i.getDataValueWindow():void 0},findRepresentativeAxisProxy:function(){var t=this._axisProxies;for(var e in t)if(t.hasOwnProperty(e)&&t[e].hostedBy(this))return t[e];for(var e in t)if(t.hasOwnProperty(e)&&!t[e].hostedBy(this))return t[e]}});t.exports=f},function(t,e,i){var n=i(59);t.exports=n.extend({type:"dataZoom",render:function(t,e,i,n){this.dataZoomModel=t,this.ecModel=e,this.api=i},getTargetCoordInfo:function(){function t(t,e,i,n){for(var o,r=0;r=i&&t<=n},containData:function(t){return this.contain(this.dataToCoord(t))},getExtent:function(){var t=this._extent.slice();return t},getPixelPrecision:function(t){return o.getPixelPrecision(t||this.scale.getExtent(),this._extent)},setExtent:function(t,e){var i=this._extent;i[0]=t,i[1]=e},dataToCoord:function(t,e){var i=this._extent,o=this.scale;return t=o.normalize(t),this.onBand&&"ordinal"===o.type&&(i=i.slice(),n(i,o.count())),r(t,s,i,e)},coordToData:function(t,e){var i=this._extent,o=this.scale;this.onBand&&"ordinal"===o.type&&(i=i.slice(),n(i,o.count()));var a=r(t,i,s,e);return this.scale.scale(a)},getTicksCoords:function(t){if(this.onBand&&!t){for(var e=this.getBands(),i=[],n=0;n=0&&i.push(t)}),i}t.topologicalTravel=function(t,e,o,r){function a(t){u[t].entryCount--,0===u[t].entryCount&&h.push(t)}function s(t){c[t]=!0,a(t)}if(t.length){var l=i(e),u=l.graph,h=l.noEntryList,c={};for(n.each(t,function(t){c[t]=!0});h.length;){var d=h.pop(),f=u[d],p=!!c[d];p&&(o.call(r,d,f.originalDeps.slice()),delete c[d]),n.each(f.successor,p?s:a)}n.each(c,function(){throw new Error("Circle dependency may exists")})}}},t.exports=s},function(t,e){t.exports=function(t,e,i,n,o){n.eachRawSeriesByType(t,function(t){var o=t.getData(),r=t.get("symbol")||e,a=t.get("symbolSize");o.setVisual({legendSymbol:i||r,symbol:r,symbolSize:a}),n.isSeriesFiltered(t)||("function"==typeof a&&o.each(function(e){var i=t.getRawValue(e),n=t.getDataParams(e);o.setItemVisual(e,"symbolSize",a(i,n))}),o.each(function(t){var e=o.getItemModel(t),i=e.getShallow("symbol",!0),n=e.getShallow("symbolSize",!0);null!=i&&o.setItemVisual(t,"symbol",i),null!=n&&o.setItemVisual(t,"symbolSize",n)}))})}},function(t,e){function i(t){for(var e=0;t>=h;)e|=1&t,t>>=1;return t+e}function n(t,e,i,n){var r=e+1;if(r===i)return 1;if(n(t[r++],t[e])<0){for(;r=0;)r++;return r-e}function o(t,e,i){for(i--;e>>1,o(a,t[r])<0?l=r:s=r+1;var u=n-s;switch(u){case 3:t[s+3]=t[s+2];case 2:t[s+2]=t[s+1];case 1:t[s+1]=t[s];break;default:for(;u>0;)t[s+u]=t[s+u-1],u--}t[s]=a}}function a(t,e,i,n,o,r){var a=0,s=0,l=1;if(r(t,e[i+o])>0){for(s=n-o;l0;)a=l,l=(l<<1)+1,l<=0&&(l=s);l>s&&(l=s),a+=o,l+=o}else{for(s=o+1;ls&&(l=s);var u=a;a=o-l,l=o-u}for(a++;a>>1);r(t,e[i+h])>0?a=h+1:l=h}return l}function s(t,e,i,n,o,r){var a=0,s=0,l=1;if(r(t,e[i+o])<0){for(s=o+1;ls&&(l=s);var u=a;a=o-l,l=o-u}else{for(s=n-o;l=0;)a=l,l=(l<<1)+1,l<=0&&(l=s);l>s&&(l=s),a+=o,l+=o}for(a++;a>>1);r(t,e[i+h])<0?l=h:a=h+1}return l}function l(t,e){function i(t,e){h[y]=t,f[y]=e,y+=1}function n(){for(;y>1;){var t=y-2;if(t>=1&&f[t-1]<=f[t]+f[t+1]||t>=2&&f[t-2]<=f[t]+f[t-1])f[t-1]f[t+1])break;r(t)}}function o(){for(;y>1;){var t=y-2;t>0&&f[t-1]=c||g>=c);if(m)break;v<0&&(v=0),v+=2}if(p=v,p<1&&(p=1),1===n){for(l=0;l=0;l--)t[g+l]=t[f+l];return void(t[d]=x[h])}for(var m=p;;){var v=0,y=0,_=!1;do if(e(x[h],t[u])<0){if(t[d--]=t[u--],v++,y=0,0===--n){_=!0;break}}else if(t[d--]=x[h--],y++,v=0,1===--r){_=!0;break}while((v|y)=0;l--)t[g+l]=t[f+l];if(0===n){_=!0;break}}if(t[d--]=x[h--],1===--r){_=!0;break}if(y=r-a(t[u],x,0,r,r-1,e),0!==y){for(d-=y,h-=y,r-=y,g=d+1,f=h+1,l=0;l=c||y>=c);if(_)break;m<0&&(m=0),m+=2}if(p=m,p<1&&(p=1),1===r){for(d-=n,u-=n,g=d+1,f=u+1,l=n-1;l>=0;l--)t[g+l]=t[f+l];t[d]=x[h]}else{if(0===r)throw new Error;for(f=d-(r-1),l=0;l>>1);var x=[];v=g<120?5:g<1542?10:g<119151?19:40,h=[],f=[],this.mergeRuns=n,this.forceMergeRuns=o,this.pushRun=i}function u(t,e,o,a){o||(o=0),a||(a=t.length);var s=a-o;if(!(s<2)){var u=0;if(sd&&(f=d),r(t,o,o+f,o+u,e),u=f}c.pushRun(o,u),c.mergeRuns(),s-=u,o+=u}while(0!==s);c.forceMergeRuns()}}var h=32,c=7,d=256;t.exports=u},function(t,e){var i={},n="\0__throttleOriginMethod",o="\0__throttleRate",r="\0__throttleType";i.throttle=function(t,e,i){function n(){u=(new Date).getTime(),h=null,t.apply(a,s||[])}var o,r,a,s,l=0,u=0,h=null;e=e||0;var c=function(){o=(new Date).getTime(),a=this,s=arguments,r=o-(i?l:u)-e,clearTimeout(h),i?h=setTimeout(n,e):r>=0?n():h=setTimeout(n,-r),l=o};return c.clear=function(){h&&(clearTimeout(h),h=null)},c},i.createOrUpdate=function(t,e,a,s){var l=t[e];if(l){var u=l[n]||l,h=l[r],c=l[o];if(c!==a||h!==s){if(null==a||!s)return t[e]=u;l=t[e]=i.throttle(u,a,"debounce"===s),l[n]=u,l[r]=s,l[o]=a}return l}},i.clear=function(t,e){var i=t[e];i&&i[n]&&(t[e]=i[n])},t.exports=i},function(t,e,i){var n=i(33);t.exports=function(){if(0!==n.debugMode)if(1==n.debugMode)for(var t in arguments)throw new Error(arguments[t]);else if(n.debugMode>1)for(var t in arguments)console.log(arguments[t])}},function(t,e,i){function n(t){o.call(this,t)}var o=i(36),r=i(9),a=i(1),s=i(151),l=new s(50);n.prototype={constructor:n,type:"image",brush:function(t,e){var i,n=this.style,o=n.image;if(n.bind(t,this,e),i="string"==typeof o?this._image:o,!i&&o){var r=l.get(o);if(!r)return i=new Image,i.onload=function(){i.onload=null;for(var t=0;t0?"top":"bottom",n="center"):f(r-v)?(o=i>0?"bottom":"top",n="center"):(o="middle",n=r>0&&r0?"right":"left":i>0?"left":"right"),{rotation:r,textAlign:n,verticalAlign:o}}function r(t,e,i,n){var o,r,a=d(i-t.rotation),s=n[0]>n[1],l="start"===e&&!s||"start"!==e&&s;return f(a-v/2)?(r=l?"bottom":"top",o="center"):f(a-1.5*v)?(r=l?"top":"bottom",o="center"):(r="middle",o=a<1.5*v&&a>v/2?l?"left":"right":l?"right":"left"),{rotation:a,textAlign:o,verticalAlign:r}}function a(t){var e=t.get("tooltip");return t.get("silent")||!(t.get("triggerEvent")||e&&e.show)}var s=i(1),l=i(8),u=i(3),h=i(11),c=i(4),d=c.remRadian,f=c.isRadianAroundZero,p=i(5),g=p.applyTransform,m=s.retrieve,v=Math.PI,y=function(t,e){this.opt=e,this.axisModel=t,s.defaults(e,{labelOffset:0,nameDirection:1,tickDirection:1,labelDirection:1,silent:!0}),this.group=new u.Group;var i=new u.Group({position:e.position.slice(),rotation:e.rotation});i.updateTransform(),this._transform=i.transform,this._dumbGroup=i};y.prototype={constructor:y,hasBuilder:function(t){return!!x[t]},add:function(t){x[t].call(this)},getGroup:function(){return this.group}};var x={axisLine:function(){var t=this.opt,e=this.axisModel;if(e.get("axisLine.show")){var i=this.axisModel.axis.getExtent(),n=this._transform,o=[i[0],0],r=[i[1],0];n&&(g(o,o,n),g(r,r,n)),this.group.add(new u.Line(u.subPixelOptimizeLine({anid:"line",shape:{x1:o[0],y1:o[1],x2:r[0],y2:r[1]},style:s.extend({lineCap:"round"},e.getModel("axisLine.lineStyle").getLineStyle()),strokeContainThreshold:t.strokeContainThreshold||5,silent:!0,z2:1})))}},axisTick:function(){var t=this.axisModel,e=t.axis;if(t.get("axisTick.show")&&!e.isBlank())for(var i=t.getModel("axisTick"),n=this.opt,o=i.getModel("lineStyle"),r=i.get("length"),a=b(i,n.labelInterval),l=e.getTicksCoords(i.get("alignWithLabel")),h=e.scale.getTicks(),c=[],d=[],f=this._transform,p=0;pg[1]?-1:1,x=["start"===c?g[0]-y*p:"end"===c?g[1]+y*p:(g[0]+g[1])/2,"middle"===c?t.labelOffset+d*p:0],_=e.get("nameRotate");null!=_&&(_=_*v/180);var b;"middle"===c?h=o(t,null!=_?_:t.rotation,d):(h=r(t,c,_||0,g),b=t.axisNameAvailableWidth,null!=b&&(b=Math.abs(b/Math.sin(h.rotation)),!isFinite(b)&&(b=null)));var w=f.getFont(),S=e.get("nameTruncate",!0)||{},M=S.ellipsis,I=m(S.maxWidth,b),T=null!=M&&null!=I?l.truncateText(i,I,w,M,{minChar:2,placeholder:S.placeholder}):i,A=e.get("tooltip",!0),L=e.mainType,C={componentType:L,name:i,$vars:["name"]};C[L+"Index"]=e.componentIndex;var D=new u.Text({anid:"name",__fullText:i,__truncatedText:T,style:{text:T,textFont:w,fill:f.getTextColor()||e.get("axisLine.lineStyle.color"),textAlign:h.textAlign,textVerticalAlign:h.verticalAlign},position:x,rotation:h.rotation,silent:a(e),z2:1,tooltip:A&&A.show?s.extend({content:i,formatter:function(){return i},formatterParams:C},A):null});e.get("triggerEvent")&&(D.eventData=n(e),D.eventData.targetType="axisName",D.eventData.name=i),this._dumbGroup.add(D),D.updateTransform(),this.group.add(D),D.decomposeTransform()}}},_=y.ifIgnoreOnTick=function(t,e,i){var n,o=t.scale;return"ordinal"===o.type&&("function"==typeof i?(n=o.getTicks()[e],!i(n,o.getLabel(n))):e%(i+1))},b=y.getInterval=function(t,e){var i=t.get("interval");return null!=i&&"auto"!=i||(i=e),i};t.exports=y},function(t,e,i){function n(t){return o.isObject(t)&&null!=t.value?t.value:t}var o=i(1),r=i(22);t.exports={getFormattedLabels:function(){return r.getFormattedLabels(this.axis,this.get("axisLabel.formatter"))},getCategories:function(){return"category"===this.get("type")&&o.map(this.get("data"),n)},getMin:function(t){var e=this.option,i=t||null==e.rangeStart?e.min:e.rangeStart;return null==i||"dataMin"===i||o.eqNaN(i)||(i=this.axis.scale.parse(i)),i},getMax:function(t){var e=this.option,i=t||null==e.rangeEnd?e.max:e.rangeEnd;return null==i||"dataMax"===i||o.eqNaN(i)||(i=this.axis.scale.parse(i)),i},getNeedCrossZero:function(){var t=this.option;return null==t.rangeStart&&null==t.rangeEnd&&!t.scale},getCoordSysModel:o.noop,setRange:function(t,e){this.option.rangeStart=t,this.option.rangeEnd=e},resetRange:function(){this.option.rangeStart=this.option.rangeEnd=null}}},function(t,e,i){function n(t,e,i){return t.getCoordSysModel()===e}function o(t){var e,i=t.model,n=i.getFormattedLabels(),o=i.getModel("axisLabel.textStyle"),r=1,a=n.length;a>40&&(r=Math.ceil(a/40));for(var s=0;s.5?e:t}function s(t,e,i,n,o){var a=t.length;if(1==o)for(var s=0;so;if(r)t.length=o;else for(var a=n;a=0&&!(T[i]<=e);i--);i=Math.min(i,x-2)}else{for(i=G;ie);i++);i=Math.min(i-1,x-2)}G=i,F=e;var n=T[i+1]-T[i];if(0!==n)if(E=(e-T[i])/n,v)if(N=A[i],R=A[0===i?i:i-1],V=A[i>x-2?x-1:i+1],B=A[i>x-3?x-1:i+2],w)h(R,N,V,B,E,E*E,E*E*E,d(t,o),I);else{var l;if(S)l=h(R,N,V,B,E,E*E,E*E*E,H,1),l=f(H);else{if(M)return a(N,V,E);l=c(R,N,V,B,E,E*E,E*E*E)}p(t,o,l)}else if(w)s(A[i],A[i+1],E,d(t,o),I);else{var l;if(S)s(A[i],A[i+1],E,H,1),l=f(H);else{if(M)return a(A[i],A[i+1],E);l=r(A[i],A[i+1],E)}p(t,o,l)}},Z=new g({target:t._target,life:_,loop:t._loop,delay:t._delay,onframe:W,ondestroy:i});return e&&"spline"!==e&&(Z.easing=e),Z}}}var g=i(145),m=i(19),v=i(1),y=v.isArrayLike,x=Array.prototype.slice,_=function(t,e,i,r){this._tracks={},this._target=t,this._loop=e||!1,this._getter=i||n,this._setter=r||o,this._clipCount=0,this._delay=0,this._doneList=[],this._onframeList=[],this._clipList=[]};_.prototype={when:function(t,e){var i=this._tracks;for(var n in e)if(e.hasOwnProperty(n)){if(!i[n]){i[n]=[];var o=this._getter(this._target,n);if(null==o)continue;0!==t&&i[n].push({time:0,value:d(o)})}i[n].push({time:t,value:e[n]})}return this},during:function(t){return this._onframeList.push(t),this},_doneCallback:function(){this._tracks={},this._clipList.length=0;for(var t=this._doneList,e=t.length,i=0;i0},extendFrom:function(t,e){if(t){var i=this;for(var n in t)!t.hasOwnProperty(n)||!e&&i.hasOwnProperty(n)||(i[n]=t[n])}},set:function(t,e){"string"==typeof t?this[t]=e:this.extendFrom(t,!0)},clone:function(){var t=new this.constructor;return t.extendFrom(this,!0),t},getGradient:function(t,e,o){for(var r="radial"===e.type?n:i,a=r(t,e,o),s=e.colorStops,l=0;l=2){if(a&&"spline"!==a){var s=o(r,a,i,e.smoothConstraint);t.moveTo(r[0][0],r[0][1]);for(var l=r.length,u=0;u<(i?l:l-1);u++){var h=s[2*u],c=s[2*u+1],d=r[(u+1)%l];t.bezierCurveTo(h[0],h[1],c[0],c[1],d[0],d[1])}}else{"spline"===a&&(r=n(r,i)),t.moveTo(r[0][0],r[0][1]);for(var u=1,f=r.length;u=0},r.createNameEach=function(t,e){t=t.slice();var i=o.map(t,n.capitalFirst);e=(e||[]).slice();var r=o.map(e,n.capitalFirst);return function(n,a){o.each(t,function(t,o){for(var s={name:t,capital:i[o]},l=0;l=0}function r(t,n){var r=!1;return e(function(e){o.each(i(t,e)||[],function(t){n.records[e.name][t]&&(r=!0)})}),r}function a(t,n){n.nodes.push(t),e(function(e){o.each(i(t,e)||[],function(t){n.records[e.name][t]=!0})})}return function(i){function o(t){!n(t,s)&&r(t,s)&&(a(t,s),l=!0)}var s={nodes:[],records:{}};if(e(function(t){s.records[t.name]={}}),!i)return s;a(i,s);var l;do l=!1,t(o);while(l);return s}},t.exports=r},function(t,e,i){var n=i(1);t.exports={updateSelectedMap:function(t){this._selectTargetMap=n.reduce(t||[],function(t,e){return t[e.name]=e,t},{})},select:function(t){var e=this._selectTargetMap,i=e[t],o=this.get("selectedMode"); -"single"===o&&n.each(e,function(t){t.selected=!1}),i&&(i.selected=!0)},unSelect:function(t){var e=this._selectTargetMap[t];e&&(e.selected=!1)},toggleSelected:function(t){var e=this._selectTargetMap[t];if(null!=e)return this[e.selected?"unSelect":"select"](t),e.selected},isSelected:function(t){var e=this._selectTargetMap[t];return e&&e.selected}}},function(t,e,i){function n(t){o.defaultEmphasis(t.label,o.LABEL_OPTIONS)}var o=i(6),r=i(1),a=i(10),s=i(8),l=s.addCommas,u=s.encodeHTML,h=i(2).extendComponentModel({type:"marker",dependencies:["series","grid","polar","geo"],init:function(t,e,i,n){this.mergeDefaultAndTheme(t,i),this.mergeOption(t,i,n.createdBySelf,!0)},isAnimationEnabled:function(){if(a.node)return!1;var t=this.__hostSeries;return this.getShallow("animation")&&t&&t.isAnimationEnabled()},mergeOption:function(t,e,i,o){var a=this.constructor,s=this.mainType+"Model";i||e.eachSeries(function(t){var i=t.get(this.mainType),l=t[s];return i&&i.data?(l?l.mergeOption(i,e,!0):(o&&n(i),r.each(i.data,function(t){t instanceof Array?(n(t[0]),n(t[1])):n(t)}),l=new a(i,this,e),r.extend(l,{mainType:this.mainType,seriesIndex:t.seriesIndex,name:t.name,createdBySelf:!0}),l.__hostSeries=t),void(t[s]=l)):void(t[s]=null)},this)},formatTooltip:function(t){var e=this.getData(),i=this.getRawValue(t),n=r.isArray(i)?r.map(i,l).join(", "):l(i),o=e.getName(t),a=u(this.name);return(null!=i||o)&&(a+="
"),o&&(a+=u(o),null!=i&&(a+=" : ")),null!=i&&(a+=u(n)),a},getData:function(){return this._data},setData:function(t){this._data=t}});r.mixin(h,o.dataFormatMixin),t.exports=h},function(t,e,i){t.exports=i(2).extendComponentView({type:"marker",init:function(){this.markerGroupMap={}},render:function(t,e,i){var n=this.markerGroupMap;for(var o in n)n.hasOwnProperty(o)&&(n[o].__keep=!1);var r=this.type+"Model";e.eachSeries(function(t){var n=t[r];n&&this.renderSeries(t,n,e,i)},this);for(var o in n)n.hasOwnProperty(o)&&!n[o].__keep&&this.group.remove(n[o].group)},renderSeries:function(){}})},function(t,e,i){function n(t){return!(isNaN(parseFloat(t.x))&&isNaN(parseFloat(t.y)))}function o(t){return!isNaN(parseFloat(t.x))&&!isNaN(parseFloat(t.y))}function r(t,e,i){var n=-1;do n=Math.max(l.getPrecision(t.get(e,i)),n),t=t.stackedOn;while(t);return n}function a(t,e,i,n,o,a){var s=[],l=m(e,n,t),u=e.indexOfNearest(n,l,!0);s[o]=e.get(i,u,!0),s[a]=e.get(n,u,!0);var h=r(e,n,u);return h>=0&&(s[a]=+s[a].toFixed(h)),s}var s=i(1),l=i(4),u=s.indexOf,h=s.curry,c={min:h(a,"min"),max:h(a,"max"),average:h(a,"average")},d=function(t,e){var i=t.getData(),n=t.coordinateSystem;if(e&&!o(e)&&!s.isArray(e.coord)&&n){var r=n.dimensions,a=f(e,i,n,t);if(e=s.clone(e),e.type&&c[e.type]&&a.baseAxis&&a.valueAxis){var l=u(r,a.baseAxis.dim),h=u(r,a.valueAxis.dim);e.coord=c[e.type](i,a.baseDataDim,a.valueDataDim,l,h),e.value=e.coord[h]}else{for(var d=[null!=e.xAxis?e.xAxis:e.radiusAxis,null!=e.yAxis?e.yAxis:e.angleAxis],p=0;p<2;p++)if(c[d[p]]){var g=t.coordDimToDataDim(r[p])[0];d[p]=m(i,g,d[p])}e.coord=d}}return e},f=function(t,e,i,n){var o={};return null!=t.valueIndex||null!=t.valueDim?(o.valueDataDim=null!=t.valueIndex?e.getDimension(t.valueIndex):t.valueDim,o.valueAxis=i.getAxis(n.dataDimToCoordDim(o.valueDataDim)),o.baseAxis=i.getOtherAxis(o.valueAxis),o.baseDataDim=n.coordDimToDataDim(o.baseAxis.dim)[0]):(o.baseAxis=n.getBaseAxis(),o.valueAxis=i.getOtherAxis(o.baseAxis),o.baseDataDim=n.coordDimToDataDim(o.baseAxis.dim)[0],o.valueDataDim=n.coordDimToDataDim(o.valueAxis.dim)[0]),o},p=function(t,e){return!(t&&t.containData&&e.coord&&!n(e))||t.containData(e.coord)},g=function(t,e,i,n){return n<2?t.coord&&t.coord[n]:t.value},m=function(t,e,i){if("average"===i){var n=0,o=0;return t.each(e,function(t,e){isNaN(t)||(n+=t,o++)},!0),n/o}return t.getDataExtent(e,!0)["max"===i?1:0]};t.exports={dataTransform:d,dataFilter:p,dimValueGetter:g,getAxisInfo:f,numCalculate:m}},function(t,e,i){function n(t){var e=t.pieceList;t.hasSpecialVisual=!1,p.each(e,function(e,i){e.originIndex=i,null!=e.visual&&(t.hasSpecialVisual=!0)})}function o(t){var e=t.categories,i=t.visual,n=t.categoryMap={};if(v(e,function(t,e){n[t]=e}),!p.isArray(i)){var o=[];p.isObject(i)?v(i,function(t,e){var i=n[e];o[null!=i?i:x]=t}):o[x]=i,i=t.visual=o}for(var r=e.length-1;r>=0;r--)null==i[r]&&(delete n[e[r]],e.pop())}function r(t,e){var i=t.visual,n=[];p.isObject(i)?v(i,function(t){n.push(t)}):null!=i&&n.push(i);var o={color:1,symbol:1};e||1!==n.length||o.hasOwnProperty(t.type)||(n[1]=n[0]),t.visual=n}function a(t){return{applyVisual:function(e,i,n){e=this.mapValueToVisual(e),n("color",t(i("color"),e))},_doMap:c([0,1])}}function s(t){var e=this.option.visual;return e[Math.round(m(t,[0,1],[0,e.length-1],!0))]||{}}function l(t){return function(e,i,n){n(t,this.mapValueToVisual(e))}}function u(t){var e=this.option.visual;return e[this.option.loop&&t!==x?t%e.length:t]}function h(){return this.option.visual[0]}function c(t){return{linear:function(e){return m(e,t,this.option.visual,!0)},category:u,piecewise:function(e,i){var n=d.call(this,i);return null==n&&(n=m(e,t,this.option.visual,!0)),n},fixed:h}}function d(t){var e=this.option,i=e.pieceList;if(e.hasSpecialVisual){var n=_.findPieceIndex(t,i),o=i[n];if(o&&o.visual)return o.visual[this.type]}}function f(t,e,i){return t?e<=i:e1e-4)return p[0]=t-i,p[1]=e-o,g[0]=t+i,void(g[1]=e+o);if(h[0]=u(r)*i+t,h[1]=l(r)*o+e,c[0]=u(a)*i+t,c[1]=l(a)*o+e,m(p,h,c),v(g,h,c),r%=f,r<0&&(r+=f),a%=f,a<0&&(a+=f),r>a&&!s?a+=f:rr&&(d[0]=u(_)*i+t,d[1]=l(_)*o+e,m(p,d,p),v(g,d,g))},t.exports=r},function(t,e,i){var n=i(36),o=i(1),r=i(17),a=function(t){n.call(this,t)};a.prototype={constructor:a,type:"text",brush:function(t,e){var i=this.style,n=i.x||0,o=i.y||0,a=i.text;if(null!=a&&(a+=""),i.bind(t,this,e),a){this.setTransform(t);var s,l=i.textAlign,u=i.textFont||i.font;if(i.textVerticalAlign){var h=r.getBoundingRect(a,u,i.textAlign,"top");switch(s="middle",i.textVerticalAlign){case"middle":o-=h.height/2-h.lineHeight/2;break;case"bottom":o-=h.height-h.lineHeight/2;break;default:o+=h.lineHeight/2}}else s=i.textBaseline;t.font=u||"12px sans-serif",t.textAlign=l||"left",t.textAlign!==l&&(t.textAlign="left"),t.textBaseline=s||"alphabetic",t.textBaseline!==s&&(t.textBaseline="alphabetic");for(var c=r.measureText("国",t.font).width,d=a.split("\n"),f=0;f=0?parseFloat(t)/100*e:parseFloat(t):t}var o=i(17),r=i(9),a=new r,s=function(){};s.prototype={constructor:s,drawRectText:function(t,e,i){var r=this.style,s=r.text;if(null!=s&&(s+=""),s){t.save();var l,u,h=r.textPosition,c=r.textOffset,d=r.textDistance,f=r.textAlign,p=r.textFont||r.font,g=r.textBaseline,m=r.textVerticalAlign;i=i||o.getBoundingRect(s,p,f,g);var v=this.transform;if(r.textTransform?this.setTransform(t):v&&(a.copy(e),a.applyTransform(v),e=a),h instanceof Array){if(l=e.x+n(h[0],e.width),u=e.y+n(h[1],e.height),f=f||"left",g=g||"top",m){switch(m){case"middle":u-=i.height/2-i.lineHeight/2;break;case"bottom":u-=i.height-i.lineHeight/2;break;default:u+=i.lineHeight/2}g="middle"}}else{var y=o.adjustTextPositionOnRect(h,e,i,d);l=y.x,u=y.y,f=f||y.textAlign,g=g||y.textBaseline}c&&(l+=c[0],u+=c[1]),t.textAlign=f||"left",t.textBaseline=g||"alphabetic";var x=r.textFill,_=r.textStroke;x&&(t.fillStyle=x),_&&(t.strokeStyle=_),t.font=p||"12px sans-serif",t.shadowBlur=r.textShadowBlur,t.shadowColor=r.textShadowColor||"transparent",t.shadowOffsetX=r.textShadowOffsetX,t.shadowOffsetY=r.textShadowOffsetY;var b=s.split("\n");r.textRotation&&(v&&t.translate(v[4],v[5]),t.rotate(r.textRotation),v&&t.translate(-v[4],-v[5]));for(var w=0;w=0&&R.each(t,function(t){var o=t.coordinateSystem;if(o&&o.containPoint)i|=!!o.containPoint(e);else if("seriesModels"===n){var a=this._chartsMap[t.__viewId];a&&a.containPoint&&(i|=a.containPoint(e,t))}},this)},this),!!i},J.getVisual=function(t,e){var i=this._model;t=k.parseFinder(i,t,{defaultMainType:"series"});var n=t.seriesModel,o=n.getData(),a=t.hasOwnProperty("dataIndexInside")?t.dataIndexInside:t.hasOwnProperty("dataIndex")?o.indexOfRawIndex(t.dataIndex):null;return null!=a?o.getItemVisual(a,e):o.getVisual(e)},J.getViewOfComponentModel=function(t){return this._componentsMap[t.__viewId]},J.getViewOfSeriesModel=function(t){return this._chartsMap[t.__viewId]};var Q={update:function(t){var e=this._model,i=this._api,n=this._coordSysMgr,o=this._zr;if(e){e.restoreData(),n.create(this._model,this._api),f.call(this,e,i),p.call(this,e),n.update(e,i),m.call(this,e,t),v.call(this,e,t);var a=e.get("backgroundColor")||"transparent",r=o.painter;if(r.isSingleCanvas&&r.isSingleCanvas())o.configLayer(0,{clearColor:a});else{if(!w.canvasSupported){var s=E.parse(a);a=E.stringify(s,"rgb"),0===s[3]&&(a="transparent")}a.colorStops||a.image?(o.configLayer(0,{clearColor:a}),this[Y]=!0,this._dom.style.background="transparent"):(this[Y]&&o.configLayer(0,{clearColor:null}),this[Y]=!1,this._dom.style.background=a)}B(at,function(t){t(e,i)})}},updateView:function(t){var e=this._model;e&&(e.eachSeries(function(t){t.getData().clearAllVisual()}),m.call(this,e,t),c.call(this,"updateView",e,t))},updateVisual:function(t){var e=this._model;e&&(e.eachSeries(function(t){t.getData().clearAllVisual()}),m.call(this,e,t,!0),c.call(this,"updateVisual",e,t))},updateLayout:function(t){var e=this._model;e&&(g.call(this,e,t),c.call(this,"updateLayout",e,t))},prepareAndUpdate:function(t){var e=this._model;d.call(this,"component",e),d.call(this,"chart",e),this.__lastOnlyGraphic?(B(this._componentsViews,function(i){var n=i.__model;n&&"graphic"===n.mainType&&(i.render(n,e,this._api,t),_(n,i))},this),this.__lastOnlyGraphic=!1):Q.update.call(this,t)}};J.resize=function(t){this[X]=!0,this._zr.resize(t);var e=this._model&&this._model.resetOption("media"),i=e?"prepareAndUpdate":"update";Q[i].call(this),this._loadingFX&&this._loadingFX.resize(),this[X]=!1;var n=t&&t.silent;u.call(this,n),h.call(this,n)},J.showLoading=function(t,e){if(R.isObject(t)&&(e=t,t=""),t=t||"default",this.hideLoading(),lt[t]){var i=lt[t](this._api,e),n=this._zr;this._loadingFX=i,n.add(i)}},J.hideLoading=function(){this._loadingFX&&this._zr.remove(this._loadingFX),this._loadingFX=null},J.makeActionFromEvent=function(t){var e=R.extend({},t);return e.type=it[t.type],e},J.dispatchAction=function(t,e){if(R.isObject(e)||(e={silent:!!e}),et[t.type]){if(this[X])return void this._pendingActions.push(t);l.call(this,t,e.silent),e.flush?this._zr.flush(!0):e.flush!==!1&&w.browser.weChat&&this._throttledZrFlush(),u.call(this,e.silent),h.call(this,e.silent)}},J.on=n("on"),J.off=n("off"),J.one=n("one");var tt=["click","dblclick","mouseover","mouseout","mousemove","mousedown","mouseup","globalout","contextmenu"];J._initEvents=function(){B(tt,function(t){this._zr.on(t,function(e){var i,n=this.getModel(),o=e.target;if("globalout"===t)i={};else if(o&&null!=o.dataIndex){var a=o.dataModel||n.getSeriesByIndex(o.seriesIndex);i=a&&a.getDataParams(o.dataIndex,o.dataType)||{}}else o&&o.eventData&&(i=R.extend({},o.eventData));i&&(i.event=e,i.type=t,this.trigger(t,i))},this)},this),B(it,function(t,e){this._messageCenter.on(e,function(t){this.trigger(e,t)},this)},this)},J.isDisposed=function(){return this._disposed},J.clear=function(){this.setOption({series:[]},!0)},J.dispose=function(){if(!this._disposed){this._disposed=!0;var t=this._api,e=this._model;B(this._componentsViews,function(i){i.dispose(e,t)}),B(this._chartsViews,function(i){i.dispose(e,t)}),this._zr.dispose(),delete ut[this.id]}},R.mixin(a,N);var et={},it={},nt=[],ot=[],at=[],rt=[],st={},lt={},ut={},ht={},ct=new Date-0,dt=new Date-0,ft="_echarts_instance_",pt={version:"3.5.0",dependencies:{zrender:"3.4.0"}};pt.init=function(t,e,i){var n=new a(t,e,i);return n.id="ec_"+ct++,ut[n.id]=n,t.setAttribute&&t.setAttribute(ft,n.id),b(n),n},pt.connect=function(t){if(R.isArray(t)){var e=t;t=null,R.each(e,function(e){null!=e.group&&(t=e.group)}),t=t||"g_"+dt++,R.each(e,function(e){e.group=t})}return ht[t]=!0,t},pt.disConnect=function(t){ht[t]=!1},pt.disconnect=pt.disConnect,pt.dispose=function(t){R.isDom(t)?t=pt.getInstanceByDom(t):"string"==typeof t&&(t=ut[t]),t instanceof a&&!t.isDisposed()&&t.dispose()},pt.getInstanceByDom=function(t){var e=t.getAttribute(ft);return ut[e]},pt.getInstanceById=function(t){return ut[t]},pt.registerTheme=function(t,e){st[t]=e},pt.registerPreprocessor=function(t){ot.push(t)},pt.registerProcessor=function(t,e){"function"==typeof t&&(e=t,t=F),nt.push({prio:t,func:e})},pt.registerPostUpdate=function(t){at.push(t)},pt.registerAction=function(t,e,i){"function"==typeof e&&(i=e,e="");var n=R.isObject(t)?t.type:[t,t={event:e}][0];t.event=(t.event||n).toLowerCase(),e=t.event,R.assert(K.test(n)&&K.test(e)),et[n]||(et[n]={action:i,actionInfo:t}),it[e]=n},pt.registerCoordinateSystem=function(t,e){I.register(t,e)},pt.registerLayout=function(t,e){"function"==typeof t&&(e=t,t=W),rt.push({prio:t,func:e,isLayout:!0})},pt.registerVisual=function(t,e){"function"==typeof t&&(e=t,t=q),rt.push({prio:t,func:e})},pt.registerLoading=function(t,e){lt[t]=e},pt.extendComponentModel=function(t){return A.extend(t)},pt.extendComponentView=function(t){return C.extend(t)},pt.extendSeriesModel=function(t){return L.extend(t)},pt.extendChartView=function(t){return D.extend(t)},pt.setCanvasCreator=function(t){R.createCanvas=t},pt.registerVisual(Z,i(153)),pt.registerPreprocessor(i(147)),pt.registerLoading("default",i(138)),pt.registerAction({type:"highlight",event:"highlight",update:"highlight"},R.noop),pt.registerAction({type:"downplay",event:"downplay",update:"downplay"},R.noop),pt.zrender=z,pt.List=i(14),pt.Model=i(10),pt.Axis=i(33),pt.graphic=i(3),pt.number=i(4),pt.format=i(7),pt.throttle=O.throttle,pt.matrix=i(19),pt.vector=i(6),pt.color=i(22),pt.util={},B(["map","each","filter","indexOf","inherits","reduce","filter","bind","curry","isArray","isString","isObject","isFunction","extend","defaults","clone","merge"],function(t){pt.util[t]=R[t]}),pt.helper=i(137),pt.PRIORITY={PROCESSOR:{FILTER:F,STATISTIC:H},VISUAL:{LAYOUT:W,GLOBAL:Z,CHART:q,COMPONENT:j,BRUSH:U}},t.exports=pt},function(t,e,i){"use strict";function n(t){return null!=t&&"none"!=t}function o(t){return"string"==typeof t?_.lift(t,-.1):t}function a(t){if(t.__hoverStlDirty){var e=t.style.stroke,i=t.style.fill,a=t.__hoverStl;a.fill=a.fill||(n(i)?o(i):null),a.stroke=a.stroke||(n(e)?o(e):null);var r={};for(var s in a)a.hasOwnProperty(s)&&(r[s]=t.style[s]);t.__normalStl=r,t.__hoverStlDirty=!1}}function r(t){t.__isHover||(a(t),t.useHoverLayer?t.__zr&&t.__zr.addHover(t,t.__hoverStl):(t.setStyle(t.__hoverStl),t.z2+=1),t.__isHover=!0)}function s(t){if(t.__isHover){var e=t.__normalStl;t.useHoverLayer?t.__zr&&t.__zr.removeHover(t):(e&&t.setStyle(e),t.z2-=1),t.__isHover=!1}}function l(t){"group"===t.type?t.traverse(function(t){"group"!==t.type&&r(t)}):r(t)}function u(t){"group"===t.type?t.traverse(function(t){"group"!==t.type&&s(t)}):s(t)}function h(t,e){t.__hoverStl=t.hoverStyle||e||{},t.__hoverStlDirty=!0,t.__isHover&&a(t)}function c(t){this.__hoverSilentOnTouch&&t.zrByTouch||!this.__isEmphasis&&l(this)}function d(t){this.__hoverSilentOnTouch&&t.zrByTouch||!this.__isEmphasis&&u(this)}function f(){this.__isEmphasis=!0,l(this)}function p(){this.__isEmphasis=!1,u(this)}function g(t,e,i,n,o,a){"function"==typeof o&&(a=o,o=null);var r=n&&n.isAnimationEnabled();if(r){var s=t?"Update":"",l=n.getShallow("animationDuration"+s),u=n.getShallow("animationEasing"+s),h=n.getShallow("animationDelay"+s);"function"==typeof h&&(h=h(o,n.getAnimationDelayParams?n.getAnimationDelayParams(e,o):null)),"function"==typeof l&&(l=l(o)),l>0?e.animateTo(i,l,h||0,u,a):(e.attr(i),a&&a())}else e.attr(i),a&&a()}var m=i(1),v=i(182),y=Math.round,x=i(8),_=i(22),b=i(19),w=i(6),S={};S.Group=i(36),S.Image=i(53),S.Text=i(85),S.Circle=i(173),S.Sector=i(179),S.Ring=i(178),S.Polygon=i(175),S.Polyline=i(176),S.Rect=i(177),S.Line=i(174),S.BezierCurve=i(172),S.Arc=i(171),S.CompoundPath=i(166),S.LinearGradient=i(101),S.RadialGradient=i(167),S.BoundingRect=i(11),S.extendShape=function(t){return x.extend(t)},S.extendPath=function(t,e){return v.extendFromString(t,e)},S.makePath=function(t,e,i,n){var o=v.createFromString(t,e),a=o.getBoundingRect();if(i){var r=a.width/a.height;if("center"===n){var s,l=i.height*r;l<=i.width?s=i.height:(l=i.width,s=l/r);var u=i.x+i.width/2,h=i.y+i.height/2;i.x=u-l/2,i.y=h-s/2,i.width=l,i.height=s}S.resizePath(o,i)}return o},S.mergePath=v.mergePath,S.resizePath=function(t,e){if(t.applyTransform){var i=t.getBoundingRect(),n=i.calculateTransform(e);t.applyTransform(n)}},S.subPixelOptimizeLine=function(t){var e=S.subPixelOptimize,i=t.shape,n=t.style.lineWidth;return y(2*i.x1)===y(2*i.x2)&&(i.x1=i.x2=e(i.x1,n,!0)),y(2*i.y1)===y(2*i.y2)&&(i.y1=i.y2=e(i.y1,n,!0)),t},S.subPixelOptimizeRect=function(t){var e=S.subPixelOptimize,i=t.shape,n=t.style.lineWidth,o=i.x,a=i.y,r=i.width,s=i.height;return i.x=e(i.x,n,!0),i.y=e(i.y,n,!0),i.width=Math.max(e(o+r,n,!1)-i.x,0===r?0:1),i.height=Math.max(e(a+s,n,!1)-i.y,0===s?0:1),t},S.subPixelOptimize=function(t,e,i){var n=y(2*t);return(n+y(e))%2===0?n/2:(n+(i?1:-1))/2},S.setHoverStyle=function(t,e,i){t.__hoverSilentOnTouch=i&&i.hoverSilentOnTouch,"group"===t.type?t.traverse(function(t){"group"!==t.type&&h(t,e)}):h(t,e),t.on("mouseover",c).on("mouseout",d),t.on("emphasis",f).on("normal",p)},S.setText=function(t,e,i){var n=e.getShallow("position")||"inside",o=e.getShallow("offset"),a=n.indexOf("inside")>=0?"white":i,r=e.getModel("textStyle");m.extend(t,{textDistance:e.getShallow("distance")||5,textFont:r.getFont(),textPosition:n,textOffset:o,textFill:r.getTextColor()||a})},S.updateProps=function(t,e,i,n,o){g(!0,t,e,i,n,o)},S.initProps=function(t,e,i,n,o){g(!1,t,e,i,n,o)},S.getTransform=function(t,e){for(var i=b.identity([]);t&&t!==e;)b.mul(i,t.getLocalTransform(),i),t=t.parent;return i},S.applyTransform=function(t,e,i){return i&&(e=b.invert([],e)),w.applyTransform([],t,e)},S.transformDirection=function(t,e,i){var n=0===e[4]||0===e[5]||0===e[0]?1:Math.abs(2*e[4]/e[0]),o=0===e[4]||0===e[5]||0===e[2]?1:Math.abs(2*e[4]/e[2]),a=["left"===t?-n:"right"===t?n:0,"top"===t?-o:"bottom"===t?o:0];return a=S.applyTransform(a,e,i),Math.abs(a[0])>Math.abs(a[1])?a[0]>0?"right":"left":a[1]>0?"bottom":"top"},S.groupTransition=function(t,e,i,n){function o(t){var e={};return t.traverse(function(t){!t.isGroup&&t.anid&&(e[t.anid]=t)}),e}function a(t){var e={position:w.clone(t.position),rotation:t.rotation};return t.shape&&(e.shape=m.extend({},t.shape)),e}if(t&&e){var r=o(t);e.traverse(function(t){if(!t.isGroup&&t.anid){var e=r[t.anid];if(e){var n=a(t);t.attr(a(e)),S.updateProps(t,n,i,t.dataIndex)}}})}},t.exports=S},function(t,e){function i(t){return t.replace(/^\s+/,"").replace(/\s+$/,"")}var n={},o=1e-4;n.linearMap=function(t,e,i,n){var o=e[1]-e[0],a=i[1]-i[0];if(0===o)return 0===a?i[0]:(i[0]+i[1])/2;if(n)if(o>0){if(t<=e[0])return i[0];if(t>=e[1])return i[1]}else{if(t>=e[0])return i[0];if(t<=e[1])return i[1]}else{if(t===e[0])return i[0];if(t===e[1])return i[1]}return(t-e[0])/o*a+i[0]},n.parsePercent=function(t,e){switch(t){case"center":case"middle":t="50%";break;case"left":case"top":t="0%";break;case"right":case"bottom":t="100%"}return"string"==typeof t?i(t).match(/%$/)?parseFloat(t)/100*e:parseFloat(t):null==t?NaN:+t},n.round=function(t,e,i){return null==e&&(e=10),e=Math.min(Math.max(0,e),20),t=(+t).toFixed(e),i?t:+t},n.asc=function(t){return t.sort(function(t,e){return t-e}),t},n.getPrecision=function(t){if(t=+t,isNaN(t))return 0;for(var e=1,i=0;Math.round(t*e)/e!==t;)e*=10,i++;return i},n.getPrecisionSafe=function(t){var e=t.toString(),i=e.indexOf(".");return i<0?0:e.length-1-i},n.getPixelPrecision=function(t,e){var i=Math.log,n=Math.LN10,o=Math.floor(i(t[1]-t[0])/n),a=Math.round(i(Math.abs(e[1]-e[0]))/n),r=Math.min(Math.max(-o+a,0),20);return isFinite(r)?r:20},n.MAX_SAFE_INTEGER=9007199254740991,n.remRadian=function(t){var e=2*Math.PI;return(t%e+e)%e},n.isRadianAroundZero=function(t){return t>-o&&t=0},t.exports=n},function(t,e,i){function n(t,e){return t&&t.hasOwnProperty(e)}var o=i(7),a=i(4),r=i(10),s=i(1),l=s.each,u=s.isObject,h={};h.normalizeToArray=function(t){return t instanceof Array?t:null==t?[]:[t]},h.defaultEmphasis=function(t,e){if(t){var i=t.emphasis=t.emphasis||{},n=t.normal=t.normal||{};l(e,function(t){var e=s.retrieve(i[t],n[t]);null!=e&&(i[t]=e)})}},h.LABEL_OPTIONS=["position","offset","show","textStyle","distance","formatter"],h.getDataItemValue=function(t){return t&&(null==t.value?t:t.value)},h.isDataItemOption=function(t){return u(t)&&!(t instanceof Array)},h.converDataValue=function(t,e){var i=e&&e.type;return"ordinal"===i?t:("time"===i&&"number"!=typeof t&&null!=t&&"-"!==t&&(t=+a.parseDate(t)),null==t||""===t?NaN:+t)},h.createDataFormatModel=function(t,e){var i=new r;return s.mixin(i,h.dataFormatMixin),i.seriesIndex=e.seriesIndex,i.name=e.name||"",i.mainType=e.mainType,i.subType=e.subType,i.getData=function(){return t},i},h.dataFormatMixin={getDataParams:function(t,e){var i=this.getData(e),n=this.getRawValue(t,e),o=i.getRawIndex(t),a=i.getName(t,!0),r=i.getRawDataItem(t);return{componentType:this.mainType,componentSubType:this.subType,seriesType:"series"===this.mainType?this.subType:null,seriesIndex:this.seriesIndex,seriesId:this.id,seriesName:this.name,name:a,dataIndex:o,data:r,dataType:e,value:n,color:i.getItemVisual(t,"color"),$vars:["seriesName","name","value"]}},getFormattedLabel:function(t,e,i,n){e=e||"normal";var a=this.getData(i),r=a.getItemModel(t),s=this.getDataParams(t,i);null!=n&&s.value instanceof Array&&(s.value=s.value[n]);var l=r.get(["label",e,"formatter"]);return"function"==typeof l?(s.status=e,l(s)):"string"==typeof l?o.formatTpl(l,s):void 0},getRawValue:function(t,e){var i=this.getData(e),n=i.getRawDataItem(t);if(null!=n)return!u(n)||n instanceof Array?n:n.value},formatTooltip:s.noop},h.mappingToExists=function(t,e){e=(e||[]).slice();var i=s.map(t||[],function(t,e){return{exist:t}});return l(e,function(t,n){if(u(t)){for(var o=0;o=i.length&&i.push({option:t})}}),i},h.makeIdAndName=function(t){var e={};l(t,function(t,i){var n=t.exist;n&&(e[n.id]=t)}),l(t,function(t,i){var n=t.option;s.assert(!n||null==n.id||!e[n.id]||e[n.id]===t,"id duplicates: "+(n&&n.id)),n&&null!=n.id&&(e[n.id]=t),!t.keyInfo&&(t.keyInfo={})}),l(t,function(t,i){var n=t.exist,o=t.option,a=t.keyInfo;if(u(o)){if(a.name=null!=o.name?o.name+"":n?n.name:"\0-",n)a.id=n.id;else if(null!=o.id)a.id=o.id+"";else{var r=0;do a.id="\0"+a.name+"\0"+r++;while(e[a.id])}e[a.id]=t}})},h.isIdInner=function(t){return u(t)&&t.id&&0===(t.id+"").indexOf("\0_ec_\0")},h.compressBatches=function(t,e){function i(t,e,i){for(var n=0,o=t.length;n1?"."+t[1]:""))},r.toCamelCase=function(t,e){return t=(t||"").toLowerCase().replace(/-(.)/g,function(t,e){return e.toUpperCase()}),e&&t&&(t=t.charAt(0).toUpperCase()+t.slice(1)),t},r.normalizeCssArray=function(t){var e=t.length;return"number"==typeof t?[t,t,t,t]:2===e?[t[0],t[1],t[0],t[1]]:3===e?[t[0],t[1],t[2],t[1]]:t};var s=r.encodeHTML=function(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")},l=["a","b","c","d","e","f","g"],u=function(t,e){return"{"+t+(null==e?"":e)+"}"};r.formatTpl=function(t,e,i){n.isArray(e)||(e=[e]);var o=e.length;if(!o)return"";for(var a=e[0].$vars||[],r=0;r1e-10&&(o.width+=a/r,o.height+=a/r,o.x-=a/r/2,o.y-=a/r/2)}return o}return t},contain:function(t,e){var i=this.transformCoordToLocal(t,e),n=this.getBoundingRect(),o=this.style;if(t=i[0],e=i[1],n.contain(t,e)){var a=this.path.data;if(o.hasStroke()){var r=o.lineWidth,l=o.strokeNoScale?this.getLineScale():1;if(l>1e-10&&(o.hasFill()||(r=Math.max(r,this.strokeContainThreshold)),s.containStroke(a,r/l,t,e)))return!0}if(o.hasFill())return s.contain(a,t,e)}return!1},dirty:function(t){null==t&&(t=!0),t&&(this.__dirtyPath=t,this._rect=null),this.__dirty=!0,this.__zr&&this.__zr.refresh(),this.__clipTarget&&this.__clipTarget.dirty()},animateShape:function(t){return this.animate("shape",t)},attrKV:function(t,e){"shape"===t?(this.setShape(e),this.__dirtyPath=!0,this._rect=null):o.prototype.attrKV.call(this,t,e)},setShape:function(t,e){var i=this.shape;if(i){if(a.isObject(t))for(var n in t)t.hasOwnProperty(n)&&(i[n]=t[n]);else i[t]=e;this.dirty(!0)}return this},getLineScale:function(){var t=this.transform;return t&&h(t[0]-1)>1e-10&&h(t[3]-1)>1e-10?Math.sqrt(h(t[0]*t[3]-t[2]*t[1])):1}},n.extend=function(t){var e=function(e){n.call(this,e),t.style&&this.style.extendFrom(t.style,!1);var i=t.shape;if(i){this.shape=this.shape||{};var o=this.shape;for(var a in i)!o.hasOwnProperty(a)&&i.hasOwnProperty(a)&&(o[a]=i[a])}t.init&&t.init.call(this,e)};a.inherits(e,n);for(var i in t)"style"!==i&&"shape"!==i&&(e.prototype[i]=t[i]);return e},a.inherits(n,o),t.exports=n},function(t,e){function i(t){var e={},i={},n=t.match(/Firefox\/([\d.]+)/),o=t.match(/MSIE\s([\d.]+)/)||t.match(/Trident\/.+?rv:(([\d.]+))/),a=t.match(/Edge\/([\d.]+)/),r=/micromessenger/i.test(t);return n&&(i.firefox=!0,i.version=n[1]),o&&(i.ie=!0,i.version=o[1]),a&&(i.edge=!0,i.version=a[1]),r&&(i.weChat=!0),{browser:i,os:e,node:!1,canvasSupported:!!document.createElement("canvas").getContext,touchEventsSupported:"ontouchstart"in window&&!i.ie&&!i.edge,pointerEventsSupported:"onpointerdown"in window&&(i.edge||i.ie&&i.version>=11)}}var n={};n="undefined"==typeof navigator?{browser:{},os:{},node:!0,canvasSupported:!0}:i(navigator.userAgent),t.exports=n},function(t,e,i){function n(t,e,i){this.parentModel=e,this.ecModel=i,this.option=t}function o(t,e,i){for(var n=0;n=i.x&&t<=i.x+i.width&&e>=i.y&&e<=i.y+i.height},clone:function(){return new n(this.x,this.y,this.width,this.height)},copy:function(t){this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height},plain:function(){return{x:this.x,y:this.y,width:this.width,height:this.height}}},n.create=function(t){return new n(t.x,t.y,t.width,t.height)},t.exports=n},function(t,e,i){"use strict";function n(t,e,i,n,o){var a=0,r=0;null==n&&(n=1/0),null==o&&(o=1/0);var s=0;e.eachChild(function(l,u){var h,c,d=l.position,f=l.getBoundingRect(),p=e.childAt(u+1),g=p&&p.getBoundingRect();if("horizontal"===t){var m=f.width+(g?-g.x+f.x:0);h=a+m,h>n||l.newline?(a=0,h=m,r+=s+i,s=f.height):s=Math.max(s,f.height)}else{var v=f.height+(g?-g.y+f.y:0);c=r+v,c>o||l.newline?(a+=s+i,r=0,c=v,s=f.width):s=Math.max(s,f.width)}l.newline||(d[0]=a,d[1]=r,"horizontal"===t?a=h+i:r=c+i)})}var o=i(1),a=i(11),r=i(4),s=i(7),l=r.parsePercent,u=o.each,h={},c=h.LOCATION_PARAMS=["left","right","top","bottom","width","height"],d=h.HV_NAMES=[["width","left","right"],["height","top","bottom"]];h.box=n,h.vbox=o.curry(n,"vertical"),h.hbox=o.curry(n,"horizontal"),h.getAvailableSize=function(t,e,i){var n=e.width,o=e.height,a=l(t.x,n),r=l(t.y,o),u=l(t.x2,n),h=l(t.y2,o);return(isNaN(a)||isNaN(parseFloat(t.x)))&&(a=0),(isNaN(u)||isNaN(parseFloat(t.x2)))&&(u=n),(isNaN(r)||isNaN(parseFloat(t.y)))&&(r=0),(isNaN(h)||isNaN(parseFloat(t.y2)))&&(h=o), +i=s.normalizeCssArray(i||0),{width:Math.max(u-a-i[1]-i[3],0),height:Math.max(h-r-i[0]-i[2],0)}},h.getLayoutRect=function(t,e,i){i=s.normalizeCssArray(i||0);var n=e.width,o=e.height,r=l(t.left,n),u=l(t.top,o),h=l(t.right,n),c=l(t.bottom,o),d=l(t.width,n),f=l(t.height,o),p=i[2]+i[0],g=i[1]+i[3],m=t.aspect;switch(isNaN(d)&&(d=n-h-g-r),isNaN(f)&&(f=o-c-p-u),isNaN(d)&&isNaN(f)&&(m>n/o?d=.8*n:f=.8*o),null!=m&&(isNaN(d)&&(d=m*f),isNaN(f)&&(f=d/m)),isNaN(r)&&(r=n-h-d-g),isNaN(u)&&(u=o-c-f-p),t.left||t.right){case"center":r=n/2-d/2-i[3];break;case"right":r=n-d-g}switch(t.top||t.bottom){case"middle":case"center":u=o/2-f/2-i[0];break;case"bottom":u=o-f-p}r=r||0,u=u||0,isNaN(d)&&(d=n-r-(h||0)),isNaN(f)&&(f=o-u-(c||0));var v=new a(r+i[3],u+i[0],d,f);return v.margin=i,v},h.positionElement=function(t,e,i,n,r){var s=!r||!r.hv||r.hv[0],l=!r||!r.hv||r.hv[1],u=r&&r.boundingMode||"all";if(s||l){var c;if("raw"===u)c="group"===t.type?new a(0,0,+e.width||0,+e.height||0):t.getBoundingRect();else if(c=t.getBoundingRect(),t.needLocalTransform()){var d=t.getLocalTransform();c=c.clone(),c.applyTransform(d)}e=h.getLayoutRect(o.defaults({width:c.width,height:c.height},e),i,n);var f=t.position,p=s?e.x-c.x:0,g=l?e.y-c.y:0;t.attr("position","raw"===u?[p,g]:[f[0]+p,f[1]+g])}},h.sizeCalculable=function(t,e){return null!=t[d[e][0]]||null!=t[d[e][1]]&&null!=t[d[e][2]]},h.mergeLayoutParam=function(t,e,i){function n(i,n){var o={},s=0,h={},c=0,d=2;if(u(i,function(e){h[e]=t[e]}),u(i,function(t){a(e,t)&&(o[t]=h[t]=e[t]),r(o,t)&&s++,r(h,t)&&c++}),l[n])return r(e,i[2])&&(h[i[1]]=null),r(e,i[1])&&(h[i[2]]=null),h;if(c!==d&&s){if(s>=d)return o;for(var f=0;f=0;o--)n=a.merge(n,t[o],!0);l.set(this,"__defaultOption",n)}return l.get(this,"__defaultOption")},getReferringComponents:function(t){return this.ecModel.queryComponents({mainType:t,index:this.get(t+"Index",!0),id:this.get(t+"Id",!0)})}});l.enableClassManagement(h,{registerWhenExtend:!0}),s.enableSubTypeDefaulter(h),s.enableTopologicalTravel(h,n),a.mixin(h,i(143)),t.exports=h},function(t,e,i){(function(e){function n(t){return d.isArray(t)||(t=[t]),t}function o(t,e){var i=t.dimensions,n=new v(d.map(i,t.getDimensionInfo,t),t.hostModel);m(n,t);for(var o=n._storage={},a=t._storage,r=0;r=0?o[s]=new l.constructor(a[s].length):o[s]=a[s]}return n}var a="undefined",r="undefined"==typeof window?e:window,s=typeof r.Float64Array===a?Array:r.Float64Array,l=typeof r.Int32Array===a?Array:r.Int32Array,u={"float":s,"int":l,ordinal:Array,number:Array,time:Array},h=i(10),c=i(48),d=i(1),f=i(5),p=d.isObject,g=["stackedOn","hasItemOption","_nameList","_idList","_rawData"],m=function(t,e){d.each(g.concat(e.__wrappedMethods||[]),function(i){e.hasOwnProperty(i)&&(t[i]=e[i])}),t.__wrappedMethods=e.__wrappedMethods},v=function(t,e){t=t||["x","y"];for(var i={},n=[],o=0;o0&&(w+="__ec__"+h[b]),h[b]++),w&&(l[c]=w)}this._nameList=e,this._idList=l},y.count=function(){return this.indices.length},y.get=function(t,e,i){var n=this._storage,o=this.indices[e];if(null==o)return NaN;var a=n[t]&&n[t][o];if(i){var r=this._dimensionInfos[t];if(r&&r.stackable)for(var s=this.stackedOn;s;){var l=s.get(t,e);(a>=0&&l>0||a<=0&&l<0)&&(a+=l),s=s.stackedOn}}return a},y.getValues=function(t,e,i){var n=[];d.isArray(t)||(i=e,e=t,t=this.dimensions);for(var o=0,a=t.length;ol&&(l=a));return this._extent[t+!!e]=[s,l]}return[1/0,-(1/0)]},y.getSum=function(t,e){var i=this._storage[t],n=0;if(i)for(var o=0,a=this.count();ot))return a;o=a-1}}return-1},y.indexOfNearest=function(t,e,i,n){var o=this._storage,a=o[t],r=[];if(!a)return r;null==n&&(n=1/0);for(var s=Number.MAX_VALUE,l=-1,u=0,h=this.count();u=0&&l<0)&&(s=d,l=c,r.length=0),r.push(u))}return r},y.getRawIndex=function(t){var e=this.indices[t];return null==e?-1:e},y.getRawDataItem=function(t){return this._rawData[this.getRawIndex(t)]},y.getName=function(t){return this._nameList[this.indices[t]]||""},y.getId=function(t){return this._idList[this.indices[t]]||this.getRawIndex(t)+""},y.each=function(t,e,i,o){"function"==typeof t&&(o=i,i=e,e=t,t=[]),t=d.map(n(t),this.getDimension,this);var a=[],r=t.length,s=this.indices;o=o||this;for(var l=0;lp-g&&(d=p-g,h.length=d);for(var m=0;mh&&(u=0,l={}),u++,l[i]=o,o}function o(t,e,i,o){var a=((t||"")+"").split("\n").length,r=n(t,e),s=n("国",e),l=a*s,u=new d(0,0,r,l);switch(u.lineHeight=s,o){case"bottom":case"alphabetic":u.y-=s;break;case"middle":u.y-=s/2}switch(i){case"end":case"right":u.x-=u.width;break;case"center":u.x-=u.width/2}return u}function a(t,e,i,n){var o=e.x,a=e.y,r=e.height,s=e.width,l=i.height,u=r/2-l/2,h="left";switch(t){case"left":o-=n,a+=u,h="right";break;case"right":o+=n+s,a+=u,h="left";break;case"top":o+=s/2,a-=n+l,h="center";break;case"bottom":o+=s/2,a+=r+n,h="center";break;case"inside":o+=s/2,a+=u,h="center";break;case"insideLeft":o+=n,a+=u,h="left";break;case"insideRight":o+=s-n,a+=u,h="right";break;case"insideTop":o+=s/2,a+=n,h="center";break;case"insideBottom":o+=s/2,a+=r-l-n,h="center";break;case"insideTopLeft":o+=n,a+=n,h="left";break;case"insideTopRight":o+=s-n,a+=n,h="right";break;case"insideBottomLeft":o+=n,a+=r-l-n;break;case"insideBottomRight":o+=s-n,a+=r-l-n,h="right"}return{x:o,y:a,textAlign:h,textBaseline:"top"}}function r(t,e,i,o,a){if(!e)return"";a=a||{},o=f(o,"...");for(var r=f(a.maxIterations,2),l=f(a.minChar,0),u=n("国",i),h=n("a",i),c=f(a.placeholder,""),d=e=Math.max(0,e-1),p=0;p=h;p++)d-=h;var g=n(o);g>d&&(o="",g=0),d=e-g;for(var m=(t+"").split("\n"),p=0,v=m.length;p=r){y+=o;break}var b=0===_?s(y,d,h,u):x>0?Math.floor(y.length*d/x):0;y=y.substr(0,b),x=n(y,i)}""===y&&(y=c),m[p]=y}}return m.join("\n")}function s(t,e,i,n){for(var o=0,a=0,r=t.length;a0&&u>0&&!h&&(l=0),l<0&&u<0&&!c&&(u=0)),[l,u]},u.niceScaleExtent=function(t,e){var i=u.getScaleExtent(t,e),n=null!=e.getMin(),o=null!=e.getMax(),a=e.get("splitNumber");"log"===t.type&&(t.base=e.get("logBase")),t.setExtent(i[0],i[1]),t.niceExtent(a,n,o);var r=e.get("minInterval");if(isFinite(r)&&!n&&!o&&"interval"===t.type){var s=t.getInterval(),l=Math.max(Math.abs(s),r)/s;i=t.getExtent();var h=(i[1]+i[0])/2;t.setExtent(l*(i[0]-h)+h,l*(i[1]-h)+h),t.niceExtent(a)}var s=e.get("interval");null!=s&&t.setInterval&&t.setInterval(s)},u.createScaleByModel=function(t,e){if(e=e||t.get("type"))switch(e){case"category":return new n(t.getCategories(),[1/0,-(1/0)]);case"value":return new o;default:return(a.getClass(e)||o).create(t)}},u.ifAxisCrossZero=function(t){var e=t.scale.getExtent(),i=e[0],n=e[1];return!(i>0&&n>0||i<0&&n<0)},u.getAxisLabelInterval=function(t,e,i,n){var o,a=0,r=0,s=1;e.length>40&&(s=Math.floor(e.length/40));for(var u=0;u1?s:(a+1)*s-1},u.getFormattedLabels=function(t,e){var i=t.scale,n=i.getTicksLabels(),o=i.getTicks();return"string"==typeof e?(e=function(t){return function(e){return t.replace("{value}",null!=e?e:"")}}(e),s.map(n,e)):"function"==typeof e?s.map(o,function(i,n){return e(u.getAxisRawValue(t,i),n)},this):n},u.getAxisRawValue=function(t,e){return"category"===t.type?t.scale.getLabel(e):e},t.exports=u},function(t,e,i){"use strict";var n=i(1),o=i(7),a=i(15),r=i(5),s=i(13),l=i(62),u=i(9),h=i(12),c=a.set,d=a.get,f=o.encodeHTML,p=o.addCommas,g=s.extend({type:"series.__base__",seriesIndex:0,coordinateSystem:null,defaultOption:null,legendDataProvider:null,visualColorAccessPath:"itemStyle.normal.color",layoutMode:null,init:function(t,e,i,n){this.seriesIndex=this.componentIndex,this.mergeDefaultAndTheme(t,i);var o=this.getInitialData(t,i);c(this,"dataBeforeProcessed",o),this.restoreData()},mergeDefaultAndTheme:function(t,e){var i=this.layoutMode,o=i?h.getLayoutParams(t):{};n.merge(t,e.getTheme().get(this.subType)),n.merge(t,this.getDefaultOption()),r.defaultEmphasis(t.label,r.LABEL_OPTIONS),this.fillDataTextStyle(t.data),i&&h.mergeLayoutParam(t,o,i)},mergeOption:function(t,e){t=n.merge(this.option,t,!0),this.fillDataTextStyle(t.data);var i=this.layoutMode;i&&h.mergeLayoutParam(this.option,t,i);var o=this.getInitialData(t,e);o&&(c(this,"data",o),c(this,"dataBeforeProcessed",o.cloneShallow()))},fillDataTextStyle:function(t){if(t)for(var e=0;e',g=this.name;return"\0-"===g&&(g=""),e?c+f(this.name)+" : "+l:(g&&f(g)+"
")+c+(u?f(u)+" : "+l:l)},isAnimationEnabled:function(){if(u.node)return!1;var t=this.getShallow("animation");return t&&this.getData().count()>this.getShallow("animationThreshold")&&(t=!1),t},restoreData:function(){c(this,"data",d(this,"dataBeforeProcessed").cloneShallow())},getColorFromPalette:function(t,e){var i=this.ecModel,n=l.getColorFromPalette.call(this,t,e);return n||(n=i.getColorFromPalette(t,e)),n},getAxisTooltipData:null,getTooltipPosition:null});n.mixin(g,r.dataFormatMixin),n.mixin(g,l),t.exports=g},function(t,e){var i="undefined"==typeof Float32Array?Array:Float32Array,n={create:function(){var t=new i(6);return n.identity(t),t},identity:function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t},copy:function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t},mul:function(t,e,i){var n=e[0]*i[0]+e[2]*i[1],o=e[1]*i[0]+e[3]*i[1],a=e[0]*i[2]+e[2]*i[3],r=e[1]*i[2]+e[3]*i[3],s=e[0]*i[4]+e[2]*i[5]+e[4],l=e[1]*i[4]+e[3]*i[5]+e[5];return t[0]=n,t[1]=o,t[2]=a,t[3]=r,t[4]=s,t[5]=l,t},translate:function(t,e,i){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4]+i[0],t[5]=e[5]+i[1],t},rotate:function(t,e,i){var n=e[0],o=e[2],a=e[4],r=e[1],s=e[3],l=e[5],u=Math.sin(i),h=Math.cos(i);return t[0]=n*h+r*u,t[1]=-n*u+r*h,t[2]=o*h+s*u,t[3]=-o*u+h*s,t[4]=h*a+u*l,t[5]=h*l-u*a,t},scale:function(t,e,i){var n=i[0],o=i[1];return t[0]=e[0]*n,t[1]=e[1]*o,t[2]=e[2]*n,t[3]=e[3]*o,t[4]=e[4]*n,t[5]=e[5]*o,t},invert:function(t,e){var i=e[0],n=e[2],o=e[4],a=e[1],r=e[3],s=e[5],l=i*r-a*n;return l?(l=1/l,t[0]=r*l,t[1]=-a*l,t[2]=-n*l,t[3]=i*l,t[4]=(n*s-r*o)*l,t[5]=(a*o-i*s)*l,t):null}};t.exports=n},function(t,e,i){"use strict";function n(t){return t.getBoundingClientRect?t.getBoundingClientRect():{left:0,top:0}}function o(t,e,i,n){return i=i||{},n||!h.canvasSupported?a(t,e,i):h.browser.firefox&&null!=e.layerX&&e.layerX!==e.offsetX?(i.zrX=e.layerX,i.zrY=e.layerY):null!=e.offsetX?(i.zrX=e.offsetX,i.zrY=e.offsetY):a(t,e,i),i}function a(t,e,i){var o=n(t);i.zrX=e.clientX-o.left,i.zrY=e.clientY-o.top}function r(t,e,i){if(e=e||window.event,null!=e.zrX)return e;var n=e.type,a=n&&n.indexOf("touch")>=0;if(a){var r="touchend"!=n?e.targetTouches[0]:e.changedTouches[0];r&&o(t,r,e,i)}else o(t,e,e,i),e.zrDelta=e.wheelDelta?e.wheelDelta/120:-(e.detail||0)/3;return e}function s(t,e,i){c?t.addEventListener(e,i):t.attachEvent("on"+e,i)}function l(t,e,i){c?t.removeEventListener(e,i):t.detachEvent("on"+e,i)}var u=i(23),h=i(9),c="undefined"!=typeof window&&!!window.addEventListener,d=c?function(t){t.preventDefault(),t.stopPropagation(),t.cancelBubble=!0}:function(t){t.returnValue=!1,t.cancelBubble=!0};t.exports={clientToLocal:o,normalizeEvent:r,addEventListener:s,removeEventListener:l,stop:d,Dispatcher:u}},function(t,e,i){"use strict";function n(t){return t>-w&&tw||t<-w}function a(t,e,i,n,o){var a=1-o;return a*a*(a*t+3*o*e)+o*o*(o*n+3*a*i)}function r(t,e,i,n,o){var a=1-o;return 3*(((e-t)*a+2*(i-e)*o)*a+(n-i)*o*o)}function s(t,e,i,o,a,r){var s=o+3*(e-i)-t,l=3*(i-2*e+t),u=3*(e-t),h=t-a,c=l*l-3*s*u,d=l*u-9*s*h,f=u*u-3*l*h,p=0;if(n(c)&&n(d))if(n(l))r[0]=0;else{var g=-u/l;g>=0&&g<=1&&(r[p++]=g)}else{var m=d*d-4*c*f;if(n(m)){var v=d/c,g=-l/s+v,y=-v/2;g>=0&&g<=1&&(r[p++]=g),y>=0&&y<=1&&(r[p++]=y)}else if(m>0){var x=b(m),w=c*l+1.5*s*(-d+x),S=c*l+1.5*s*(-d-x);w=w<0?-_(-w,I):_(w,I),S=S<0?-_(-S,I):_(S,I);var g=(-l-(w+S))/(3*s);g>=0&&g<=1&&(r[p++]=g)}else{var T=(2*c*l-3*s*d)/(2*b(c*c*c)),A=Math.acos(T)/3,L=b(c),C=Math.cos(A),g=(-l-2*L*C)/(3*s),y=(-l+L*(C+M*Math.sin(A)))/(3*s),D=(-l+L*(C-M*Math.sin(A)))/(3*s);g>=0&&g<=1&&(r[p++]=g),y>=0&&y<=1&&(r[p++]=y),D>=0&&D<=1&&(r[p++]=D)}}return p}function l(t,e,i,a,r){var s=6*i-12*e+6*t,l=9*e+3*a-3*t-9*i,u=3*e-3*t,h=0;if(n(l)){if(o(s)){var c=-u/s;c>=0&&c<=1&&(r[h++]=c)}}else{var d=s*s-4*l*u;if(n(d))r[0]=-s/(2*l);else if(d>0){var f=b(d),c=(-s+f)/(2*l),p=(-s-f)/(2*l);c>=0&&c<=1&&(r[h++]=c),p>=0&&p<=1&&(r[h++]=p)}}return h}function u(t,e,i,n,o,a){var r=(e-t)*o+t,s=(i-e)*o+e,l=(n-i)*o+i,u=(s-r)*o+r,h=(l-s)*o+s,c=(h-u)*o+u;a[0]=t,a[1]=r,a[2]=u,a[3]=c,a[4]=c,a[5]=h,a[6]=l,a[7]=n}function h(t,e,i,n,o,r,s,l,u,h,c){var d,f,p,g,m,v=.005,y=1/0;T[0]=u,T[1]=h;for(var _=0;_<1;_+=.05)A[0]=a(t,i,o,s,_),A[1]=a(e,n,r,l,_),g=x(T,A),g=0&&g=0&&c<=1&&(r[h++]=c)}}else{var d=l*l-4*s*u;if(n(d)){var c=-l/(2*s);c>=0&&c<=1&&(r[h++]=c)}else if(d>0){var f=b(d),c=(-l+f)/(2*s),p=(-l-f)/(2*s);c>=0&&c<=1&&(r[h++]=c),p>=0&&p<=1&&(r[h++]=p)}}return h}function p(t,e,i){var n=t+i-2*e;return 0===n?.5:(t-e)/n}function g(t,e,i,n,o){var a=(e-t)*n+t,r=(i-e)*n+e,s=(r-a)*n+a;o[0]=t,o[1]=a,o[2]=s,o[3]=s,o[4]=r,o[5]=i}function m(t,e,i,n,o,a,r,s,l){var u,h=.005,d=1/0;T[0]=r,T[1]=s;for(var f=0;f<1;f+=.05){A[0]=c(t,i,o,f),A[1]=c(e,n,a,f);var p=x(T,A);p=0&&p255?255:t}function o(t){return t=Math.round(t),t<0?0:t>360?360:t}function a(t){return t<0?0:t>1?1:t}function r(t){return n(t.length&&"%"===t.charAt(t.length-1)?parseFloat(t)/100*255:parseInt(t,10))}function s(t){return a(t.length&&"%"===t.charAt(t.length-1)?parseFloat(t)/100:parseFloat(t))}function l(t,e,i){return i<0?i+=1:i>1&&(i-=1),6*i<1?t+(e-t)*i*6:2*i<1?e:3*i<2?t+(e-t)*(2/3-i)*6:t}function u(t,e,i){return t+(e-t)*i}function h(t,e,i,n,o){return t[0]=e,t[1]=i,t[2]=n,t[3]=o,t}function c(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function d(t,e){T&&c(T,e),T=I.put(t,T||e.slice())}function f(t,e){if(t){e=e||[];var i=I.get(t);if(i)return c(e,i);t+="";var n=t.replace(/ /g,"").toLowerCase();if(n in M)return c(e,M[n]),d(t,e),e;if("#"!==n.charAt(0)){var o=n.indexOf("("),a=n.indexOf(")");if(o!==-1&&a+1===n.length){var l=n.substr(0,o),u=n.substr(o+1,a-(o+1)).split(","),f=1;switch(l){case"rgba":if(4!==u.length)return void h(e,0,0,0,1);f=s(u.pop());case"rgb":return 3!==u.length?void h(e,0,0,0,1):(h(e,r(u[0]),r(u[1]),r(u[2]),f),d(t,e),e);case"hsla":return 4!==u.length?void h(e,0,0,0,1):(u[3]=s(u[3]),p(u,e),d(t,e),e);case"hsl":return 3!==u.length?void h(e,0,0,0,1):(p(u,e),d(t,e),e);default:return}}h(e,0,0,0,1)}else{if(4===n.length){var g=parseInt(n.substr(1),16);return g>=0&&g<=4095?(h(e,(3840&g)>>4|(3840&g)>>8,240&g|(240&g)>>4,15&g|(15&g)<<4,1),d(t,e),e):void h(e,0,0,0,1)}if(7===n.length){var g=parseInt(n.substr(1),16);return g>=0&&g<=16777215?(h(e,(16711680&g)>>16,(65280&g)>>8,255&g,1),d(t,e),e):void h(e,0,0,0,1)}}}}function p(t,e){var i=(parseFloat(t[0])%360+360)%360/360,o=s(t[1]),a=s(t[2]),r=a<=.5?a*(o+1):a+o-a*o,u=2*a-r;return e=e||[],h(e,n(255*l(u,r,i+1/3)),n(255*l(u,r,i)),n(255*l(u,r,i-1/3)),1),4===t.length&&(e[3]=t[3]),e}function g(t){if(t){var e,i,n=t[0]/255,o=t[1]/255,a=t[2]/255,r=Math.min(n,o,a),s=Math.max(n,o,a),l=s-r,u=(s+r)/2;if(0===l)e=0,i=0;else{i=u<.5?l/(s+r):l/(2-s-r);var h=((s-n)/6+l/2)/l,c=((s-o)/6+l/2)/l,d=((s-a)/6+l/2)/l;n===s?e=d-c:o===s?e=1/3+h-d:a===s&&(e=2/3+c-h),e<0&&(e+=1),e>1&&(e-=1)}var f=[360*e,i,u];return null!=t[3]&&f.push(t[3]),f}}function m(t,e){var i=f(t);if(i){for(var n=0;n<3;n++)e<0?i[n]=i[n]*(1-e)|0:i[n]=(255-i[n])*e+i[n]|0;return w(i,4===i.length?"rgba":"rgb")}}function v(t,e){var i=f(t);if(i)return((1<<24)+(i[0]<<16)+(i[1]<<8)+ +i[2]).toString(16).slice(1)}function y(t,e,i){if(i=i||[0,0,0,0],!e||!e.length||!(t>=0&&t<=1))return i;var o=t*(e.length-1),a=Math.floor(o),r=Math.ceil(o),s=e[a],l=e[r],h=o-a;return i[0]=n(u(s[0],l[0],h)),i[1]=n(u(s[1],l[1],h)),i[2]=n(u(s[2],l[2],h)),i[3]=n(u(s[3],l[3],h)),i}function x(t,e,i){if(e&&e.length&&t>=0&&t<=1){var o=t*(e.length-1),r=Math.floor(o),s=Math.ceil(o),l=f(e[r]),h=f(e[s]),c=o-r,d=w([n(u(l[0],h[0],c)),n(u(l[1],h[1],c)),n(u(l[2],h[2],c)),a(u(l[3],h[3],c))],"rgba");return i?{color:d,leftIndex:r,rightIndex:s,value:o}:d}}function _(t,e,i,n){if(t=f(t))return t=g(t),null!=e&&(t[0]=o(e)),null!=i&&(t[1]=s(i)),null!=n&&(t[2]=s(n)),w(p(t),"rgba")}function b(t,e){if(t=f(t),t&&null!=e)return t[3]=a(e),w(t,"rgba")}function w(t,e){if(t){var i=t[0]+","+t[1]+","+t[2];return"rgba"!==e&&"hsva"!==e&&"hsla"!==e||(i+=","+t[3]),e+"("+i+")"}}var S=i(69),M={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1], +plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]},I=new S(20),T=null;t.exports={parse:f,lift:m,toHex:v,fastMapToColor:y,mapToColor:x,modifyHSL:_,modifyAlpha:b,stringify:w}},function(t,e){var i=Array.prototype.slice,n=function(){this._$handlers={}};n.prototype={constructor:n,one:function(t,e,i){var n=this._$handlers;if(!e||!t)return this;n[t]||(n[t]=[]);for(var o=0;o3&&(e=i.call(e,1));for(var o=this._$handlers[t],a=o.length,r=0;r4&&(e=i.call(e,1,e.length-1));for(var o=e[e.length-1],a=this._$handlers[t],r=a.length,s=0;s=0&&o(t)?function(t,e,i,n){return d.isDataItemOption(t)&&(x.hasItemOption=!0),n===y?i:g(p(t),v[n])}:function(t,e,i,n){var o=p(t),a=g(o&&o[n],v[n]);d.isDataItemOption(t)&&(x.hasItemOption=!0);var r=s&&s.categoryAxesModels;return r&&r[e]&&"string"==typeof a&&(b[e]=b[e]||r[e].getCategories(),a=c.indexOf(b[e],a),a<0&&!isNaN(a)&&(a=+a)),a};return x.hasItemOption=!1,x.initData(t,_,w),x}function r(t){return"category"!==t&&"time"!==t}function s(t){return"category"===t?"ordinal":"time"===t?"time":"float"}function l(t,e){var i,n=[],o=t&&t.dimensions[t.categoryIndex];if(o&&(i=t.categoryAxesModels[o.name]),i){var a=i.getCategories();if(a){var r=e.length;if(c.isArray(e[0])&&e[0].length>1){n=[];for(var s=0;sthis._ux||y(e-this._yi)>this._uy||this._len<5;return this.addData(l.L,t,e),this._ctx&&i&&(this._needsDash()?this._dashedLineTo(t,e):this._ctx.lineTo(t,e)),i&&(this._xi=t,this._yi=e),this},bezierCurveTo:function(t,e,i,n,o,a){return this.addData(l.C,t,e,i,n,o,a),this._ctx&&(this._needsDash()?this._dashedBezierTo(t,e,i,n,o,a):this._ctx.bezierCurveTo(t,e,i,n,o,a)),this._xi=o,this._yi=a,this},quadraticCurveTo:function(t,e,i,n){return this.addData(l.Q,t,e,i,n),this._ctx&&(this._needsDash()?this._dashedQuadraticTo(t,e,i,n):this._ctx.quadraticCurveTo(t,e,i,n)),this._xi=i,this._yi=n,this},arc:function(t,e,i,n,o,a){return this.addData(l.A,t,e,i,i,n,o-n,0,a?0:1),this._ctx&&this._ctx.arc(t,e,i,n,o,a),this._xi=g(o)*i+t,this._yi=m(o)*i+t,this},arcTo:function(t,e,i,n,o){return this._ctx&&this._ctx.arcTo(t,e,i,n,o),this},rect:function(t,e,i,n){return this._ctx&&this._ctx.rect(t,e,i,n),this.addData(l.R,t,e,i,n),this},closePath:function(){this.addData(l.Z);var t=this._ctx,e=this._x0,i=this._y0;return t&&(this._needsDash()&&this._dashedLineTo(e,i),t.closePath()),this._xi=e,this._yi=i,this},fill:function(t){t&&t.fill(),this.toStatic()},stroke:function(t){t&&t.stroke(),this.toStatic()},setLineDash:function(t){if(t instanceof Array){this._lineDash=t,this._dashIdx=0;for(var e=0,i=0;ie.length&&(this._expandData(),e=this.data);for(var i=0;i0&&g<=t||h<0&&g>=t||0==h&&(c>0&&m<=e||c<0&&m>=e);)n=this._dashIdx,i=r[n],g+=h*i,m+=c*i,this._dashIdx=(n+1)%y,h>0&&gl||c>0&&mu||s[n%2?"moveTo":"lineTo"](h>=0?f(g,t):p(g,t),c>=0?f(m,e):p(m,e));h=g-t,c=m-e,this._dashOffset=-v(h*h+c*c)},_dashedBezierTo:function(t,e,i,o,a,r){var s,l,u,h,c,d=this._dashSum,f=this._dashOffset,p=this._lineDash,g=this._ctx,m=this._xi,y=this._yi,x=n.cubicAt,_=0,b=this._dashIdx,w=p.length,S=0;for(f<0&&(f=d+f),f%=d,s=0;s<1;s+=.1)l=x(m,t,i,a,s+.1)-x(m,t,i,a,s),u=x(y,e,o,r,s+.1)-x(y,e,o,r,s),_+=v(l*l+u*u);for(;bf));b++);for(s=(S-f)/_;s<=1;)h=x(m,t,i,a,s),c=x(y,e,o,r,s),b%2?g.moveTo(h,c):g.lineTo(h,c),s+=p[b]/_,b=(b+1)%w;b%2!==0&&g.lineTo(a,r),l=a-h,u=r-c,this._dashOffset=-v(l*l+u*u)},_dashedQuadraticTo:function(t,e,i,n){var o=i,a=n;i=(i+2*t)/3,n=(n+2*e)/3,t=(this._xi+2*t)/3,e=(this._yi+2*e)/3,this._dashedBezierTo(t,e,i,n,o,a)},toStatic:function(){var t=this.data;t instanceof Array&&(t.length=this._len,x&&(this.data=new Float32Array(t)))},getBoundingRect:function(){u[0]=u[1]=c[0]=c[1]=Number.MAX_VALUE,h[0]=h[1]=d[0]=d[1]=-Number.MAX_VALUE;for(var t=this.data,e=0,i=0,n=0,s=0,f=0;fu||y(r-o)>h||d===c-1)&&(t.lineTo(a,r),n=a,o=r);break;case l.C:t.bezierCurveTo(s[d++],s[d++],s[d++],s[d++],s[d++],s[d++]),n=s[d-2],o=s[d-1];break;case l.Q:t.quadraticCurveTo(s[d++],s[d++],s[d++],s[d++]),n=s[d-2],o=s[d-1];break;case l.A:var p=s[d++],v=s[d++],x=s[d++],_=s[d++],b=s[d++],w=s[d++],S=s[d++],M=s[d++],I=x>_?x:_,T=x>_?1:x/_,A=x>_?_/x:1,L=Math.abs(x-_)>.001,C=b+w;L?(t.translate(p,v),t.rotate(S),t.scale(T,A),t.arc(0,0,I,b,C,1-M),t.scale(1/T,1/A),t.rotate(-S),t.translate(-p,-v)):t.arc(p,v,I,b,C,1-M),1==d&&(e=g(b)*x+p,i=m(b)*_+v),n=g(C)*x+p,o=m(C)*_+v;break;case l.R:e=n=s[d],i=o=s[d+1],t.rect(s[d++],s[d++],s[d++],s[d++]);break;case l.Z:t.closePath(),n=e,o=i}}}},_.CMD=l,t.exports=_},function(t,e,i){var n=i(1);t.exports=function(t){for(var e=0;e=0||i&&n.indexOf(i,r)<0)){var s=this.getShallow(r);null!=s&&(o[t[a][0]]=s)}}return o}}},function(t,e,i){function n(t,e,i){var n=e.getComponent("tooltip"),a=e.getComponent("axisPointer"),s=a.get("link",!0)||[],u=[];c(i.getCoordinateSystems(),function(i){function h(n,h,c){var d=c.model.getModel("axisPointer",a),f=d.get("show");if(f&&("auto"!==f||n||l(d))){null==h&&(h=d.get("triggerTooltip")),d=n?o(c,v,a,e,n,h):d;var m=d.get("snap"),y=p(c.model),x=h||m||"category"===c.type,_=t.axesInfo[y]={key:y,axis:c,coordSys:i,axisPointerModel:d,triggerTooltip:h,involveSeries:x,snap:m,useHandle:l(d),seriesModels:[]};g[y]=_,t.seriesInvolved|=x;var b=r(s,c);if(null!=b){var w=u[b]||(u[b]={axesInfo:{}});w.axesInfo[y]=_,w.mapper=s[b].mapper,_.linkGroup=w}}}if(i.axisPointerEnabled){var f=p(i.model),g=t.coordSysAxesInfo[f]={};t.coordSysMap[f]=i;var m=i.model,v=m.getModel("tooltip",n);if(c(i.getAxes(),d(h,!1,null)),i.getTooltipAxes&&n&&v.get("show")){var y="axis"===v.get("trigger"),x="cross"===v.get("axisPointer.type"),_=i.getTooltipAxes(v.get("axisPointer.axis"));(y||x)&&c(_.baseAxes,d(h,!x||"cross",y)),x&&c(_.otherAxes,d(h,"cross",!1))}}})}function o(t,e,i,n,o,a){var r=e.getModel("axisPointer"),s={};c(["type","snap","lineStyle","shadowStyle","label","animation","animationDurationUpdate","animationEasingUpdate","z"],function(t){s[t]=u.clone(r.get(t))}),s.snap="category"!==t.type&&!!a,"cross"===r.get("type")&&(s.type="line");var l=s.label||(s.label={});if(null==l.show&&(l.show=!1),"cross"===o&&(l.show=!0,!a)){var d=s.lineStyle=r.get("crossStyle");d&&u.defaults(l.textStyle||(l.textStyle={}),d.textStyle)}return t.model.getModel("axisPointer",new h(s,i,n))}function a(t,e){e.eachSeries(function(e){var i=e.coordinateSystem,n=e.get("tooltip.trigger",!0);i&&"none"!==n&&n!==!1&&"item"!==n&&e.get("axisPointer.show",!0)!==!1&&c(t.coordSysAxesInfo[p(i.model)],function(t){var n=t.axis;i.getAxis(n.dim)===n&&(t.seriesModels.push(e),null==t.seriesDataCount&&(t.seriesDataCount=0),t.seriesDataCount+=e.getData().count())})},this)}function r(t,e){for(var i=e.model,n=e.dim,o=0;o=0||t===e}function l(t){return!!t.get("handle.show")}var u=i(1),h=i(10),c=u.each,d=u.curry,f={};f.collect=function(t,e){var i={axesInfo:{},seriesInvolved:!1,coordSysAxesInfo:{},coordSysMap:{}};return n(i,t,e),i.seriesInvolved&&a(i,t),i},f.fixValue=function(t){var e=f.getAxisInfo(t);if(e){var i=e.axisPointerModel,n=e.axis.scale,o=i.option,a=i.get("status"),r=i.get("value");null!=r&&(r=n.parse(r));var s=l(i);null==a&&(o.status=s?"show":"hide");var u=n.getExtent().slice();u[0]>u[1]&&u.reverse(),(null==r||r>u[1])&&(r=u[1]),r=i&&t<=n},containData:function(t){return this.contain(this.dataToCoord(t))},getExtent:function(){var t=this._extent.slice();return t},getPixelPrecision:function(t){return o.getPixelPrecision(t||this.scale.getExtent(),this._extent)},setExtent:function(t,e){var i=this._extent;i[0]=t,i[1]=e},dataToCoord:function(t,e){var i=this._extent,o=this.scale;return t=o.normalize(t),this.onBand&&"ordinal"===o.type&&(i=i.slice(),n(i,o.count())),a(t,s,i,e)},coordToData:function(t,e){var i=this._extent,o=this.scale;this.onBand&&"ordinal"===o.type&&(i=i.slice(),n(i,o.count()));var r=a(t,i,s,e);return this.scale.scale(r)},pointToData:function(t,e){},getTicksCoords:function(t){if(this.onBand&&!t){for(var e=this.getBands(),i=[],n=0;n=e[0]&&t<=e[1]},a.normalize=function(t){var e=this._extent;return e[1]===e[0]?.5:(t-e[0])/(e[1]-e[0])},a.scale=function(t){var e=this._extent;return t*(e[1]-e[0])+e[0]},a.unionExtent=function(t){var e=this._extent;t[0]e[1]&&(e[1]=t[1])},a.unionExtentFromData=function(t,e){this.unionExtent(t.getDataExtent(e,!0))},a.getExtent=function(){return this._extent.slice()},a.setExtent=function(t,e){var i=this._extent;isNaN(t)||(i[0]=t),isNaN(e)||(i[1]=e)},a.getTicksLabels=function(){for(var t=[],e=this.getTicks(),i=0;i=0&&(i.splice(n,0,t),this._doAdd(t))}return this},_doAdd:function(t){t.parent&&t.parent.remove(t),t.parent=this;var e=this.__storage,i=this.__zr;e&&e!==t.__storage&&(e.addToMap(t),t instanceof r&&t.addChildrenToStorage(e)),i&&i.refresh()},remove:function(t){var e=this.__zr,i=this.__storage,o=this._children,a=n.indexOf(o,t);return a<0?this:(o.splice(a,1),t.parent=null,i&&(i.delFromMap(t.id),t instanceof r&&t.delChildrenFromStorage(i)),e&&e.refresh(),this)},removeAll:function(){var t,e,i=this._children,n=this.__storage;for(e=0;en[1],l="start"===e&&!s||"start"!==e&&s;return d(r-m/2)?(a=l?"bottom":"top",o="center"):d(r-1.5*m)?(a=l?"top":"bottom",o="center"):(a="middle",o=r<1.5*m&&r>m/2?l?"left":"right":l?"right":"left"),{rotation:r,textAlign:o,textVerticalAlign:a}}function a(t){var e=t.get("tooltip");return t.get("silent")||!(t.get("triggerEvent")||e&&e.show)}var r=i(1),s=i(7),l=i(3),u=i(10),h=i(4),c=h.remRadian,d=h.isRadianAroundZero,f=i(6),p=f.applyTransform,g=r.retrieve,m=Math.PI,v=function(t,e){this.opt=e,this.axisModel=t,r.defaults(e,{labelOffset:0,nameDirection:1,tickDirection:1,labelDirection:1,silent:!0}),this.group=new l.Group;var i=new l.Group({position:e.position.slice(),rotation:e.rotation});i.updateTransform(),this._transform=i.transform,this._dumbGroup=i};v.prototype={constructor:v,hasBuilder:function(t){return!!y[t]},add:function(t){y[t].call(this)},getGroup:function(){return this.group}};var y={axisLine:function(){var t=this.opt,e=this.axisModel;if(e.get("axisLine.show")){var i=this.axisModel.axis.getExtent(),n=this._transform,o=[i[0],0],a=[i[1],0];n&&(p(o,o,n),p(a,a,n)),this.group.add(new l.Line(l.subPixelOptimizeLine({anid:"line",shape:{x1:o[0],y1:o[1],x2:a[0],y2:a[1]},style:r.extend({lineCap:"round"},e.getModel("axisLine.lineStyle").getLineStyle()),strokeContainThreshold:t.strokeContainThreshold||5,silent:!0,z2:1})))}},axisTick:function(){var t=this.axisModel,e=t.axis;if(t.get("axisTick.show")&&!e.scale.isBlank())for(var i=t.getModel("axisTick"),n=this.opt,o=i.getModel("lineStyle"),a=i.get("length"),s=b(i,n.labelInterval),u=e.getTicksCoords(i.get("alignWithLabel")),h=e.scale.getTicks(),c=[],d=[],f=this._transform,g=0;gp[1]?-1:1,y=["start"===h?p[0]-v*f:"end"===h?p[1]+v*f:(p[0]+p[1])/2,"middle"===h?t.labelOffset+c*f:0],_=e.get("nameRotate");null!=_&&(_=_*m/180);var b;"middle"===h?u=x(t.rotation,null!=_?_:t.rotation,c):(u=o(t,h,_||0,p),b=t.axisNameAvailableWidth,null!=b&&(b=Math.abs(b/Math.sin(u.rotation)),!isFinite(b)&&(b=null)));var w=d.getFont(),S=e.get("nameTruncate",!0)||{},M=S.ellipsis,I=g(S.maxWidth,b),T=null!=M&&null!=I?s.truncateText(i,I,w,M,{minChar:2,placeholder:S.placeholder}):i,A=e.get("tooltip",!0),L=e.mainType,C={componentType:L,name:i,$vars:["name"]};C[L+"Index"]=e.componentIndex;var D=new l.Text({anid:"name",__fullText:i,__truncatedText:T,style:{text:T,textFont:w,fill:d.getTextColor()||e.get("axisLine.lineStyle.color"),textAlign:u.textAlign,textVerticalAlign:u.textVerticalAlign},position:y,rotation:u.rotation,silent:a(e),z2:1,tooltip:A&&A.show?r.extend({content:i,formatter:function(){return i},formatterParams:C},A):null});e.get("triggerEvent")&&(D.eventData=n(e),D.eventData.targetType="axisName",D.eventData.name=i),this._dumbGroup.add(D),D.updateTransform(),this.group.add(D),D.decomposeTransform()}}},x=v.innerTextLayout=function(t,e,i){var n,o,a=c(e-t);return d(a)?(o=i>0?"top":"bottom",n="center"):d(a-m)?(o=i>0?"bottom":"top",n="center"):(o="middle",n=a>0&&a0?"right":"left":i>0?"left":"right"),{rotation:a,textAlign:n,textVerticalAlign:o}},_=v.ifIgnoreOnTick=function(t,e,i){var n,o=t.scale;return"ordinal"===o.type&&("function"==typeof i?(n=o.getTicks()[e],!i(n,o.getLabel(n))):e%(i+1))},b=v.getInterval=function(t,e){var i=t.get("interval");return null!=i&&"auto"!=i||(i=e),i};t.exports=v},function(t,e,i){i(93),i(45)},function(t,e){var i={},n="\0__throttleOriginMethod",o="\0__throttleRate",a="\0__throttleType";i.throttle=function(t,e,i){function n(){u=(new Date).getTime(),h=null,t.apply(r,s||[])}var o,a,r,s,l=0,u=0,h=null;e=e||0;var c=function(){o=(new Date).getTime(),r=this,s=arguments,a=o-(i?l:u)-e,clearTimeout(h),i?h=setTimeout(n,e):a>=0?n():h=setTimeout(n,-a),l=o};return c.clear=function(){h&&(clearTimeout(h),h=null)},c},i.createOrUpdate=function(t,e,r,s){var l=t[e];if(l){var u=l[n]||l,h=l[a],c=l[o];if(c!==r||h!==s){if(null==r||!s)return t[e]=u;l=t[e]=i.throttle(u,r,"debounce"===s),l[n]=u,l[a]=s,l[o]=r}return l}},i.clear=function(t,e){var i=t[e];i&&i[n]&&(t[e]=i[n])},t.exports=i},function(t,e,i){function n(t){t=t||{},r.call(this,t);for(var e in t)t.hasOwnProperty(e)&&"style"!==e&&(this[e]=t[e]);this.style=new a(t.style),this._rect=null,this.__clipPaths=[]}var o=i(1),a=i(72),r=i(65),s=i(86);n.prototype={constructor:n,type:"displayable",__dirty:!0,invisible:!1,z:0,z2:0,zlevel:0,draggable:!1,dragging:!1,silent:!1,culling:!1,cursor:"pointer",rectHover:!1,progressive:-1,beforeBrush:function(t){},afterBrush:function(t){},brush:function(t,e){},getBoundingRect:function(){},contain:function(t,e){return this.rectContain(t,e)},traverse:function(t,e){t.call(e,this)},rectContain:function(t,e){var i=this.transformCoordToLocal(t,e),n=this.getBoundingRect();return n.contain(i[0],i[1])},dirty:function(){this.__dirty=!0,this._rect=null,this.__zr&&this.__zr.refresh()},animateStyle:function(t){return this.animate("style",t)},attrKV:function(t,e){"style"!==t?r.prototype.attrKV.call(this,t,e):this.style.set(e)},setStyle:function(t,e){return this.style.set(t,e),this.dirty(!1),this},useStyle:function(t){return this.style=new a(t),this.dirty(!1),this}},o.inherits(n,r),o.mixin(n,s),t.exports=n},function(t,e){var i=function(t){this.colorStops=t||[]};i.prototype={constructor:i,addColorStop:function(t,e){this.colorStops.push({offset:t,color:e})}},t.exports=i},function(t,e,i){function n(t){return o.isObject(t)&&null!=t.value?t.value:t}var o=i(1),a=i(17);t.exports={getFormattedLabels:function(){ +return a.getFormattedLabels(this.axis,this.get("axisLabel.formatter"))},getCategories:function(){return"category"===this.get("type")&&o.map(this.get("data"),n)},getMin:function(t){var e=this.option,i=t||null==e.rangeStart?e.min:e.rangeStart;return this.axis&&null!=i&&"dataMin"!==i&&!o.eqNaN(i)&&(i=this.axis.scale.parse(i)),i},getMax:function(t){var e=this.option,i=t||null==e.rangeEnd?e.max:e.rangeEnd;return this.axis&&null!=i&&"dataMax"!==i&&!o.eqNaN(i)&&(i=this.axis.scale.parse(i)),i},getNeedCrossZero:function(){var t=this.option;return null==t.rangeStart&&null==t.rangeEnd&&!t.scale},getCoordSysModel:o.noop,setRange:function(t,e){this.option.rangeStart=t,this.option.rangeEnd=e},resetRange:function(){this.option.rangeStart=this.option.rangeEnd=null}}},function(t,e,i){var n=i(4),o=i(7),a=i(34),r=Math.floor,s=Math.ceil,l=n.getPrecisionSafe,u=n.round,h=a.extend({type:"interval",_interval:0,_intervalPrecision:2,setExtent:function(t,e){var i=this._extent;isNaN(t)||(i[0]=parseFloat(t)),isNaN(e)||(i[1]=parseFloat(e))},unionExtent:function(t){var e=this._extent;t[0]e[1]&&(e[1]=t[1]),h.prototype.setExtent.call(this,e[0],e[1])},getInterval:function(){return this._interval||this.niceTicks(),this._interval},setInterval:function(t){this._interval=t,this._niceExtent=this._extent.slice()},getTicks:function(){this._interval||this.niceTicks();var t=this._interval,e=this._extent,i=[],n=1e4;if(t){var o=this._niceExtent,a=this._intervalPrecision=l(t);a+=2,e[0]n)return[];e[1]>(i.length?i[i.length-1]:o[1])&&i.push(e[1])}return i},getTicksLabels:function(){for(var t=[],e=this.getTicks(),i=0;i0?100:20}},getFirstTargetAxisModel:function(){var t;return d(function(e){if(null==t){var i=this.get(e.axisIndex);i.length&&(t=this.dependentModels[e.axis][i[0]])}},this),t},eachTargetAxis:function(t,e){var i=this.ecModel;d(function(n){c(this.get(n.axisIndex),function(o){t.call(e,n,o,this,i)},this)},this)},getAxisProxy:function(t,e){return this._axisProxies[t+"_"+e]},getAxisModel:function(t,e){var i=this.getAxisProxy(t,e);return i&&i.getAxisModel()},setRawRange:function(t,e){c(["start","end","startValue","endValue"],function(e){this.option[e]=t[e]},this),!e&&o(this,t)},getPercentRange:function(){var t=this.findRepresentativeAxisProxy();if(t)return t.getDataPercentWindow()},getValueRange:function(t,e){if(null!=t||null!=e)return this.getAxisProxy(t,e).getDataValueWindow();var i=this.findRepresentativeAxisProxy();return i?i.getDataValueWindow():void 0},findRepresentativeAxisProxy:function(){var t=this._axisProxies;for(var e in t)if(t.hasOwnProperty(e)&&t[e].hostedBy(this))return t[e];for(var e in t)if(t.hasOwnProperty(e)&&!t[e].hostedBy(this))return t[e]},getRangePropMode:function(){return this._rangePropMode.slice()}});t.exports=f},function(t,e,i){var n=i(64);t.exports=n.extend({type:"dataZoom",render:function(t,e,i,n){this.dataZoomModel=t,this.ecModel=e,this.api=i},getTargetCoordInfo:function(){function t(t,e,i,n){for(var o,a=0;a=0&&i.push(t)}),i}t.topologicalTravel=function(t,e,o,a){function r(t){u[t].entryCount--,0===u[t].entryCount&&h.push(t)}function s(t){c[t]=!0,r(t)}if(t.length){var l=i(e),u=l.graph,h=l.noEntryList,c={};for(n.each(t,function(t){c[t]=!0});h.length;){var d=h.pop(),f=u[d],p=!!c[d];p&&(o.call(a,d,f.originalDeps.slice()),delete c[d]),n.each(f.successor,p?s:r)}n.each(c,function(){throw new Error("Circle dependency may exists")})}}},t.exports=s},function(t,e){t.exports=function(t,e,i,n,o){n.eachRawSeriesByType(t,function(t){var o=t.getData(),a=t.get("symbol")||e,r=t.get("symbolSize");o.setVisual({legendSymbol:i||a,symbol:a,symbolSize:r}),n.isSeriesFiltered(t)||("function"==typeof r&&o.each(function(e){var i=t.getRawValue(e),n=t.getDataParams(e);o.setItemVisual(e,"symbolSize",r(i,n))}),o.each(function(t){var e=o.getItemModel(t),i=e.getShallow("symbol",!0),n=e.getShallow("symbolSize",!0);null!=i&&o.setItemVisual(t,"symbol",i),null!=n&&o.setItemVisual(t,"symbolSize",n)}))})}},function(t,e){function i(t){for(var e=0;t>=h;)e|=1&t,t>>=1;return t+e}function n(t,e,i,n){var a=e+1;if(a===i)return 1;if(n(t[a++],t[e])<0){for(;a=0;)a++;return a-e}function o(t,e,i){for(i--;e>>1,o(r,t[a])<0?l=a:s=a+1;var u=n-s;switch(u){case 3:t[s+3]=t[s+2];case 2:t[s+2]=t[s+1];case 1:t[s+1]=t[s];break;default:for(;u>0;)t[s+u]=t[s+u-1],u--}t[s]=r}}function r(t,e,i,n,o,a){var r=0,s=0,l=1;if(a(t,e[i+o])>0){for(s=n-o;l0;)r=l,l=(l<<1)+1,l<=0&&(l=s);l>s&&(l=s),r+=o,l+=o}else{for(s=o+1;ls&&(l=s);var u=r;r=o-l,l=o-u}for(r++;r>>1);a(t,e[i+h])>0?r=h+1:l=h}return l}function s(t,e,i,n,o,a){var r=0,s=0,l=1;if(a(t,e[i+o])<0){for(s=o+1;ls&&(l=s);var u=r;r=o-l,l=o-u}else{for(s=n-o;l=0;)r=l,l=(l<<1)+1,l<=0&&(l=s);l>s&&(l=s),r+=o,l+=o}for(r++;r>>1);a(t,e[i+h])<0?l=h:r=h+1}return l}function l(t,e){function i(t,e){h[y]=t,f[y]=e,y+=1}function n(){for(;y>1;){var t=y-2;if(t>=1&&f[t-1]<=f[t]+f[t+1]||t>=2&&f[t-2]<=f[t]+f[t-1])f[t-1]f[t+1])break;a(t)}}function o(){for(;y>1;){var t=y-2;t>0&&f[t-1]=c||g>=c);if(m)break;v<0&&(v=0),v+=2}if(p=v,p<1&&(p=1),1===n){for(l=0;l=0;l--)t[g+l]=t[f+l];return void(t[d]=x[h])}for(var m=p;;){var v=0,y=0,_=!1;do if(e(x[h],t[u])<0){if(t[d--]=t[u--],v++,y=0,0===--n){_=!0;break}}else if(t[d--]=x[h--],y++,v=0,1===--a){_=!0;break}while((v|y)=0;l--)t[g+l]=t[f+l];if(0===n){_=!0;break}}if(t[d--]=x[h--],1===--a){_=!0;break}if(y=a-r(t[u],x,0,a,a-1,e),0!==y){for(d-=y,h-=y,a-=y,g=d+1,f=h+1,l=0;l=c||y>=c);if(_)break;m<0&&(m=0),m+=2}if(p=m,p<1&&(p=1),1===a){for(d-=n,u-=n,g=d+1,f=u+1,l=n-1;l>=0;l--)t[g+l]=t[f+l];t[d]=x[h]}else{if(0===a)throw new Error;for(f=d-(a-1),l=0;l>>1);var x=[];v=g<120?5:g<1542?10:g<119151?19:40,h=[],f=[],this.mergeRuns=n,this.forceMergeRuns=o,this.pushRun=i}function u(t,e,o,r){o||(o=0),r||(r=t.length);var s=r-o;if(!(s<2)){var u=0;if(sd&&(f=d),a(t,o,o+f,o+u,e),u=f}c.pushRun(o,u),c.mergeRuns(),s-=u,o+=u}while(0!==s);c.forceMergeRuns()}}var h=32,c=7,d=256;t.exports=u},function(t,e,i){var n=i(35);t.exports=function(){if(0!==n.debugMode)if(1==n.debugMode)for(var t in arguments)throw new Error(arguments[t]);else if(n.debugMode>1)for(var t in arguments)console.log(arguments[t])}},function(t,e,i){function n(t){o.call(this,t)}var o=i(40),a=i(11),r=i(1),s=i(69),l=new s(50);n.prototype={constructor:n,type:"image",brush:function(t,e){var i,n=this.style,o=n.image;if(n.bind(t,this,e),i="string"==typeof o?this._image:o,!i&&o){var a=l.get(o);if(!a)return i=new Image,i.onload=function(){i.onload=null;for(var t=0;t40&&(a=Math.ceil(r/40));for(var s=0;s.5?e:t}function s(t,e,i,n,o){var r=t.length;if(1==o)for(var s=0;so;if(a)t.length=o;else for(var r=n;r=0&&!(T[i]<=e);i--);i=Math.min(i,x-2)}else{for(i=G;ie);i++);i=Math.min(i-1,x-2)}G=i,F=e;var n=T[i+1]-T[i];if(0!==n)if(R=(e-T[i])/n,v)if(N=A[i],E=A[0===i?i:i-1],V=A[i>x-2?x-1:i+1],B=A[i>x-3?x-1:i+2],w)h(E,N,V,B,R,R*R,R*R*R,d(t,o),I);else{var l;if(S)l=h(E,N,V,B,R,R*R,R*R*R,H,1),l=f(H);else{if(M)return r(N,V,R);l=c(E,N,V,B,R,R*R,R*R*R)}p(t,o,l)}else if(w)s(A[i],A[i+1],R,d(t,o),I);else{var l;if(S)s(A[i],A[i+1],R,H,1),l=f(H);else{if(M)return r(A[i],A[i+1],R);l=a(A[i],A[i+1],R)}p(t,o,l)}},Z=new g({target:t._target,life:_,loop:t._loop,delay:t._delay,onframe:W,ondestroy:i});return e&&"spline"!==e&&(Z.easing=e),Z}}}var g=i(159),m=i(22),v=i(1),y=v.isArrayLike,x=Array.prototype.slice,_=function(t,e,i,a){this._tracks={},this._target=t,this._loop=e||!1,this._getter=i||n,this._setter=a||o,this._clipCount=0,this._delay=0,this._doneList=[],this._onframeList=[],this._clipList=[]};_.prototype={when:function(t,e){var i=this._tracks;for(var n in e)if(e.hasOwnProperty(n)){if(!i[n]){i[n]=[];var o=this._getter(this._target,n);if(null==o)continue;0!==t&&i[n].push({time:0,value:d(o)})}i[n].push({time:t,value:e[n]})}return this},during:function(t){return this._onframeList.push(t),this},pause:function(){for(var t=0;t=this._maxSize&&r>0){var l=i.head;i.remove(l),delete n[l.key],a=l.value,this._lastRemovedEntry=l}s?s.value=e:s=new o(e),s.key=t,i.insertEntry(s),n[t]=s}return a},r.get=function(t){var e=this._map[t],i=this._list;if(null!=e)return e!==i.tail&&(i.remove(e),i.insertEntry(e)),e.value},r.clear=function(){this._list.clear(),this._map={}},t.exports=a},function(t,e){var i=2311;t.exports=function(){return i++}},function(t,e){var i=function(t,e){this.image=t,this.repeat=e,this.type="pattern"};i.prototype.getCanvasPattern=function(t){return this._canvasPattern||(this._canvasPattern=t.createPattern(this.image,this.repeat))},t.exports=i},function(t,e){function i(t,e,i){var n=e.x,o=e.x2,a=e.y,r=e.y2;e.global||(n=n*i.width+i.x,o=o*i.width+i.x,a=a*i.height+i.y,r=r*i.height+i.y);var s=t.createLinearGradient(n,a,o,r);return s}function n(t,e,i){var n=i.width,o=i.height,a=Math.min(n,o),r=e.x,s=e.y,l=e.r;e.global||(r=r*n+i.x,s=s*o+i.y,l*=a);var u=t.createRadialGradient(r,s,0,r,s,l);return u}var o=[["shadowBlur",0],["shadowOffsetX",0],["shadowOffsetY",0],["shadowColor","#000"],["lineCap","butt"],["lineJoin","miter"],["miterLimit",10]],a=function(t){this.extendFrom(t)};a.prototype={constructor:a,fill:"#000000",stroke:null,opacity:1,lineDash:null,lineDashOffset:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,lineWidth:1,strokeNoScale:!1,text:null,textFill:"#000",textStroke:null,textPosition:"inside",textOffset:null,textBaseline:null,textAlign:null,textVerticalAlign:null,textDistance:5,textShadowBlur:0,textShadowOffsetX:0,textShadowOffsetY:0,textTransform:!1,textRotation:0,blend:null,bind:function(t,e,i){for(var n=this,a=i&&i.style,r=!a,s=0;s0},extendFrom:function(t,e){if(t){var i=this;for(var n in t)!t.hasOwnProperty(n)||!e&&i.hasOwnProperty(n)||(i[n]=t[n])}},set:function(t,e){"string"==typeof t?this[t]=e:this.extendFrom(t,!0)},clone:function(){var t=new this.constructor;return t.extendFrom(this,!0),t},getGradient:function(t,e,o){for(var a="radial"===e.type?n:i,r=a(t,e,o),s=e.colorStops,l=0;l=2){if(r&&"spline"!==r){var s=o(a,r,i,e.smoothConstraint);t.moveTo(a[0][0],a[0][1]);for(var l=a.length,u=0;u<(i?l:l-1);u++){var h=s[2*u],c=s[2*u+1],d=a[(u+1)%l];t.bezierCurveTo(h[0],h[1],c[0],c[1],d[0],d[1])}}else{"spline"===r&&(a=n(a,i)),t.moveTo(a[0][0],a[0][1]);for(var u=1,f=a.length;ur)return!0;if(a){var s=p.getAxisInfo(t).seriesDataCount,l=n.getExtent();return Math.abs(l[0]-l[1])/s>r}return!1}return i===!0},makeElOption:function(t,e,i,n,o){},createPointerEl:function(t,e,i,n){var o=e.pointer,a=f(t).pointerEl=new d[o.type](v(e.pointer));t.add(a)},createLabelEl:function(t,e,i,n){var o=f(t).labelEl=new d.Rect(v(e.label));t.add(o),r(o,n)},updatePointerEl:function(t,e,i){var n=f(t).pointerEl;n&&(n.setStyle(e.pointer.style),i(n,{shape:e.pointer.shape}))},updateLabelEl:function(t,e,i,n){var o=f(t).labelEl;o&&(o.setStyle(e.label.style),i(o,{shape:e.label.shape,position:e.label.position}),r(o,n))},_renderHandle:function(t){if(!this._dragging&&this.updateHandleTransform){var e=this._axisPointerModel,i=this._api.getZr(),n=this._handle,o=e.getModel("handle"),a=e.get("status");if(!o.get("show")||!a||"hide"===a)return n&&i.remove(n),void(this._handle=null);var r;this._handle||(r=!0,n=this._handle=l(o,{onmousemove:function(t){g.stop(t.event)},onmousedown:y(this._onHandleDragMove,this,0,0),drift:y(this._onHandleDragMove,this),ondragend:y(this._onHandleDragEnd,this)}),i.add(n)),u(n,e,!1);var s=["color","borderColor","borderWidth","opacity","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY"];n.setStyle(o.getItemStyle(null,s));var c=o.get("size");h.isArray(c)||(c=[c,c]),n.attr("scale",[c[0]/2,c[1]/2]),m.createOrUpdate(this,"_doDispatchAxisPointer",o.get("throttle")||0,"fixRate"),this._moveHandleToValue(t,r)}},_moveHandleToValue:function(t,e){o(this._axisPointerModel,!e&&this._moveAnimation,this._handle,s(this.getHandleTransform(t,this._axisModel,this._axisPointerModel)))},_onHandleDragMove:function(t,e){var i=this._handle;if(i){this._dragging=!0;var n=this.updateHandleTransform(s(i),[t,e],this._axisModel,this._axisPointerModel);this._payloadInfo=n,i.stopAnimation(),i.attr(s(n)),f(i).lastProp=null,this._doDispatchAxisPointer()}},_doDispatchAxisPointer:function(){var t=this._handle;if(t){var e=this._payloadInfo,i={type:"updateAxisPointer",x:e.cursorPoint[0],y:e.cursorPoint[1],tooltipOption:e.tooltipOption,highDownKey:"axisPointerHandle"},n=this._axisModel.axis;i[n.dim+"AxisId"]=this._axisModel.id,this._api.dispatchAction(i)}},_onHandleDragEnd:function(t){this._dragging=!1;var e=this._handle;if(e){var i=this._axisPointerModel.get("value");this._moveHandleToValue(i),this._api.dispatchAction({type:"hideTip"})}},getHandleTransform:null,updateHandleTransform:null,clear:function(t){this._lastValue=null,this._lastStatus=null;var e=t.getZr(),i=this._group,n=this._handle;e&&i&&(this._lastGraphicKey=null,i&&e.remove(i),n&&e.remove(n),this._group=null,this._handle=null,this._payloadInfo=null)},doClear:function(){},buildLabel:function(t,e,i){return i=i||0,{x:t[i],y:t[1-i],width:e[i],height:e[1-i]}}},n.prototype.constructor=n,c.enableClassExtend(n),t.exports=n},function(t,e,i){var n=i(1),o=i(5);t.exports=function(t,e){var i,a=[],r=t.seriesIndex;if(null==r||!(i=e.getSeriesByIndex(r)))return{point:[]};var s=i.getData(),l=o.queryDataIndex(s,t);if(null==l||n.isArray(l))return{point:[]};var u=s.getItemGraphicEl(l),h=i.coordinateSystem;if(i.getTooltipPosition)a=i.getTooltipPosition(l)||[];else if(h&&h.dataToPoint)a=h.dataToPoint(s.getValues(n.map(h.dimensions,function(t){return i.coordDimToDataDim(t)[0]}),l,!0))||[];else if(u){var c=u.getBoundingRect().clone();c.applyTransform(u.transform),a=[c.x+c.width/2,c.y+c.height/2]}return{point:a,el:u}}},function(t,e,i){function n(t,e){function i(i,n){t.on(i,function(i){var a=s(e);c(h(t).records,function(t){t&&n(t,i,a.dispatchAction)}),o(a.pendings,e)})}h(t).initialized||(h(t).initialized=!0,i("click",u.curry(r,"click")),i("mousemove",u.curry(r,"mousemove")),i("globalout",a))}function o(t,e){var i,n=t.showTip.length,o=t.hideTip.length;n?i=t.showTip[n-1]:o&&(i=t.hideTip[o-1]),i&&(i.dispatchAction=null,e.dispatchAction(i))}function a(t,e,i){t.handler("leave",null,i)}function r(t,e,i,n){e.handler(t,i,n)}function s(t){var e={showTip:[],hideTip:[]},i=function(n){var o=e[n.type];o?o.push(n):(n.dispatchAction=i,t.dispatchAction(n))};return{dispatchAction:i,pendings:e}}var l=i(9),u=i(1),h=i(5).makeGetter(),c=u.each,d={};d.register=function(t,e,i){if(!l.node){var o=e.getZr();h(o).records||(h(o).records={}),n(o,e);var a=h(o).records[t]||(h(o).records[t]={});a.handler=i}},d.unregister=function(t,e){if(!l.node){var i=e.getZr(),n=(h(i).records||{})[t];n&&(h(i).records[t]=null)}},t.exports=d},function(t,e,i){var n=i(7),o=i(1),a={},r=["x","y","z","radius","angle","single"],s=["cartesian2d","polar","singleAxis"];a.isCoordSupported=function(t){return o.indexOf(s,t)>=0},a.createNameEach=function(t,e){t=t.slice();var i=o.map(t,n.capitalFirst);e=(e||[]).slice();var a=o.map(e,n.capitalFirst);return function(n,r){o.each(t,function(t,o){for(var s={name:t,capital:i[o]},l=0;l=0}function a(t,n){var a=!1;return e(function(e){o.each(i(t,e)||[],function(t){n.records[e.name][t]&&(a=!0)})}),a}function r(t,n){n.nodes.push(t),e(function(e){o.each(i(t,e)||[],function(t){n.records[e.name][t]=!0})})}return function(i){function o(t){!n(t,s)&&a(t,s)&&(r(t,s),l=!0)}var s={nodes:[],records:{}};if(e(function(t){s.records[t.name]={}}),!i)return s;r(i,s);var l;do l=!1,t(o);while(l);return s}},t.exports=a},function(t,e,i){var n=i(1);t.exports={updateSelectedMap:function(t){this._selectTargetMap=n.reduce(t||[],function(t,e){return t[e.name]=e,t},{})},select:function(t){var e=this._selectTargetMap,i=e[t],o=this.get("selectedMode");"single"===o&&n.each(e,function(t){t.selected=!1}),i&&(i.selected=!0)},unSelect:function(t){var e=this._selectTargetMap[t];e&&(e.selected=!1)},toggleSelected:function(t){var e=this._selectTargetMap[t];if(null!=e)return this[e.selected?"unSelect":"select"](t),e.selected},isSelected:function(t){var e=this._selectTargetMap[t];return e&&e.selected}}},function(t,e,i){function n(t){o.defaultEmphasis(t.label,o.LABEL_OPTIONS)}var o=i(5),a=i(1),r=i(9),s=i(7),l=s.addCommas,u=s.encodeHTML,h=i(2).extendComponentModel({type:"marker",dependencies:["series","grid","polar","geo"],init:function(t,e,i,n){this.mergeDefaultAndTheme(t,i),this.mergeOption(t,i,n.createdBySelf,!0)},isAnimationEnabled:function(){if(r.node)return!1;var t=this.__hostSeries;return this.getShallow("animation")&&t&&t.isAnimationEnabled()},mergeOption:function(t,e,i,o){var r=this.constructor,s=this.mainType+"Model";i||e.eachSeries(function(t){var i=t.get(this.mainType),l=t[s];return i&&i.data?(l?l.mergeOption(i,e,!0):(o&&n(i),a.each(i.data,function(t){t instanceof Array?(n(t[0]),n(t[1])):n(t)}),l=new r(i,this,e),a.extend(l,{mainType:this.mainType,seriesIndex:t.seriesIndex,name:t.name,createdBySelf:!0}),l.__hostSeries=t),void(t[s]=l)):void(t[s]=null)},this)},formatTooltip:function(t){var e=this.getData(),i=this.getRawValue(t),n=a.isArray(i)?a.map(i,l).join(", "):l(i),o=e.getName(t),r=u(this.name);return(null!=i||o)&&(r+="
"),o&&(r+=u(o),null!=i&&(r+=" : ")),null!=i&&(r+=u(n)),r},getData:function(){return this._data},setData:function(t){this._data=t}});a.mixin(h,o.dataFormatMixin),t.exports=h},function(t,e,i){t.exports=i(2).extendComponentView({type:"marker",init:function(){this.markerGroupMap={}},render:function(t,e,i){var n=this.markerGroupMap;for(var o in n)n.hasOwnProperty(o)&&(n[o].__keep=!1);var a=this.type+"Model";e.eachSeries(function(t){var n=t[a];n&&this.renderSeries(t,n,e,i)},this);for(var o in n)n.hasOwnProperty(o)&&!n[o].__keep&&this.group.remove(n[o].group)},renderSeries:function(){}})},function(t,e,i){function n(t){return!(isNaN(parseFloat(t.x))&&isNaN(parseFloat(t.y)))}function o(t){return!isNaN(parseFloat(t.x))&&!isNaN(parseFloat(t.y))}function a(t,e,i){var n=-1;do n=Math.max(l.getPrecision(t.get(e,i)),n),t=t.stackedOn;while(t);return n}function r(t,e,i,n,o,r){var s=[],l=m(e,n,t),u=e.indexOfNearest(n,l,!0)[0];s[o]=e.get(i,u,!0),s[r]=e.get(n,u,!0);var h=a(e,n,u);return h>=0&&(s[r]=+s[r].toFixed(h)),s}var s=i(1),l=i(4),u=s.indexOf,h=s.curry,c={min:h(r,"min"),max:h(r,"max"),average:h(r,"average")},d=function(t,e){var i=t.getData(),n=t.coordinateSystem;if(e&&!o(e)&&!s.isArray(e.coord)&&n){var a=n.dimensions,r=f(e,i,n,t);if(e=s.clone(e),e.type&&c[e.type]&&r.baseAxis&&r.valueAxis){var l=u(a,r.baseAxis.dim),h=u(a,r.valueAxis.dim);e.coord=c[e.type](i,r.baseDataDim,r.valueDataDim,l,h),e.value=e.coord[h]}else{for(var d=[null!=e.xAxis?e.xAxis:e.radiusAxis,null!=e.yAxis?e.yAxis:e.angleAxis],p=0;p<2;p++)if(c[d[p]]){var g=t.coordDimToDataDim(a[p])[0];d[p]=m(i,g,d[p])}e.coord=d}}return e},f=function(t,e,i,n){var o={};return null!=t.valueIndex||null!=t.valueDim?(o.valueDataDim=null!=t.valueIndex?e.getDimension(t.valueIndex):t.valueDim,o.valueAxis=i.getAxis(n.dataDimToCoordDim(o.valueDataDim)),o.baseAxis=i.getOtherAxis(o.valueAxis),o.baseDataDim=n.coordDimToDataDim(o.baseAxis.dim)[0]):(o.baseAxis=n.getBaseAxis(),o.valueAxis=i.getOtherAxis(o.baseAxis),o.baseDataDim=n.coordDimToDataDim(o.baseAxis.dim)[0],o.valueDataDim=n.coordDimToDataDim(o.valueAxis.dim)[0]),o},p=function(t,e){return!(t&&t.containData&&e.coord&&!n(e))||t.containData(e.coord)},g=function(t,e,i,n){return n<2?t.coord&&t.coord[n]:t.value},m=function(t,e,i){if("average"===i){var n=0,o=0;return t.each(e,function(t,e){isNaN(t)||(n+=t,o++)},!0),n/o}return t.getDataExtent(e,!0)["max"===i?1:0]};t.exports={dataTransform:d,dataFilter:p,dimValueGetter:g,getAxisInfo:f,numCalculate:m}},function(t,e,i){function n(t){var e=t.pieceList;t.hasSpecialVisual=!1,g.each(e,function(e,i){e.originIndex=i,null!=e.visual&&(t.hasSpecialVisual=!0)})}function o(t){var e=t.categories,i=t.visual,n=t.categoryMap={};if(y(e,function(t,e){n[t]=e}),!g.isArray(i)){var o=[];g.isObject(i)?y(i,function(t,e){var i=n[e];o[null!=i?i:_]=t}):o[_]=i,i=f(t,o)}for(var a=e.length-1;a>=0;a--)null==i[a]&&(delete n[e[a]],e.pop())}function a(t,e){var i=t.visual,n=[];g.isObject(i)?y(i,function(t){n.push(t)}):null!=i&&n.push(i);var o={color:1,symbol:1};e||1!==n.length||o.hasOwnProperty(t.type)||(n[1]=n[0]),f(t,n)}function r(t){return{applyVisual:function(e,i,n){e=this.mapValueToVisual(e),n("color",t(i("color"),e))},_doMap:c([0,1])}}function s(t){var e=this.option.visual;return e[Math.round(v(t,[0,1],[0,e.length-1],!0))]||{}}function l(t){return function(e,i,n){n(t,this.mapValueToVisual(e))}}function u(t){var e=this.option.visual;return e[this.option.loop&&t!==_?t%e.length:t]}function h(){return this.option.visual[0]}function c(t){return{linear:function(e){return v(e,t,this.option.visual,!0)},category:u,piecewise:function(e,i){var n=d.call(this,i);return null==n&&(n=v(e,t,this.option.visual,!0)),n},fixed:h}}function d(t){var e=this.option,i=e.pieceList;if(e.hasSpecialVisual){var n=b.findPieceIndex(t,i),o=i[n];if(o&&o.visual)return o.visual[this.type]}}function f(t,e){return t.visual=e,"color"===t.type&&(t.parsedVisual=g.map(e,function(t){return m.parse(t)})),e}function p(t,e,i){return t?e<=i:e1e-4)return p[0]=t-i,p[1]=e-o,g[0]=t+i,void(g[1]=e+o);if(h[0]=u(a)*i+t,h[1]=l(a)*o+e,c[0]=u(r)*i+t,c[1]=l(r)*o+e,m(p,h,c),v(g,h,c),a%=f,a<0&&(a+=f),r%=f,r<0&&(r+=f),a>r&&!s?r+=f:aa&&(d[0]=u(_)*i+t,d[1]=l(_)*o+e,m(p,d,p),v(g,d,g))},t.exports=a},function(t,e,i){var n=i(40),o=i(1),a=i(16),r=function(t){n.call(this,t)};r.prototype={constructor:r,type:"text",brush:function(t,e){var i=this.style,n=i.x||0,o=i.y||0,r=i.text;if(null!=r&&(r+=""),i.bind(t,this,e),r){this.setTransform(t);var s,l=i.textAlign,u=i.textFont||i.font;if(i.textVerticalAlign){var h=a.getBoundingRect(r,u,i.textAlign,"top");switch(s="middle",i.textVerticalAlign){case"middle":o-=h.height/2-h.lineHeight/2;break;case"bottom":o-=h.height-h.lineHeight/2;break;default:o+=h.lineHeight/2}}else s=i.textBaseline;t.font=u||"12px sans-serif",t.textAlign=l||"left",t.textAlign!==l&&(t.textAlign="left"),t.textBaseline=s||"alphabetic",t.textBaseline!==s&&(t.textBaseline="alphabetic");for(var c=a.measureText("国",t.font).width,d=r.split("\n"),f=0;f=0?parseFloat(t)/100*e:parseFloat(t):t}var o=i(16),a=i(11),r=new a,s=function(){};s.prototype={constructor:s,drawRectText:function(t,e,i){var a=this.style,s=a.text;if(null!=s&&(s+=""),s){t.save();var l,u,h=a.textPosition,c=a.textOffset,d=a.textDistance,f=a.textAlign,p=a.textFont||a.font,g=a.textBaseline,m=a.textVerticalAlign;i=i||o.getBoundingRect(s,p,f,g);var v=this.transform;if(a.textTransform?this.setTransform(t):v&&(r.copy(e),r.applyTransform(v),e=r),h instanceof Array){if(l=e.x+n(h[0],e.width),u=e.y+n(h[1],e.height),f=f||"left",g=g||"top",m){switch(m){case"middle":u-=i.height/2-i.lineHeight/2;break;case"bottom":u-=i.height-i.lineHeight/2;break;default:u+=i.lineHeight/2}g="middle"}}else{var y=o.adjustTextPositionOnRect(h,e,i,d);l=y.x,u=y.y,f=f||y.textAlign,g=g||y.textBaseline}c&&(l+=c[0],u+=c[1]),t.textAlign=f||"left",t.textBaseline=g||"alphabetic";var x=a.textFill,_=a.textStroke;x&&(t.fillStyle=x),_&&(t.strokeStyle=_),t.font=p||"12px sans-serif",t.shadowBlur=a.textShadowBlur,t.shadowColor=a.textShadowColor||"transparent",t.shadowOffsetX=a.textShadowOffsetX,t.shadowOffsetY=a.textShadowOffsetY;var b=s.split("\n");a.textRotation&&(v&&t.translate(v[4],v[5]),t.rotate(a.textRotation),v&&t.translate(-v[4],-v[5]));for(var w=0;ws&&(l=s);var u=a;a=o-l,l=o-u}for(a++;a=r||b<0)break;if(n(S)){if(x){b+=a;continue}break}if(b===i)t[a>0?"moveTo":"lineTo"](S[0],S[1]),c(f,S);else if(v>0){var M=b+a,I=e[M];if(x)for(;I&&n(e[M]);)M+=a,I=e[M];var T=.5,A=e[_],I=e[M];if(!I||n(I))c(p,S);else{n(I)&&!x&&(I=S),s.sub(d,I,A);var L,C;if("x"===y||"y"===y){var D="x"===y?0:1;L=Math.abs(S[D]-A[D]),C=Math.abs(S[D]-I[D])}else L=s.dist(S,A),C=s.dist(S,I);T=C/(C+L),h(p,S,d,-v*(1-T))}l(f,f,m),u(f,f,g),l(p,p,m),u(p,p,g),t.bezierCurveTo(f[0],f[1],p[0],p[1],S[0],S[1]),h(f,S,d,v*T)}else t.lineTo(S[0],S[1]);_=b,b+=a}return w}function r(t,e){var i=[1/0,1/0],n=[-(1/0),-(1/0)];if(e)for(var o=0;on[0]&&(n[0]=r[0]),r[1]>n[1]&&(n[1]=r[1])}return{min:e?i:n,max:e?n:i}}var a=i(7),s=i(5),l=s.min,u=s.max,h=s.scaleAndAdd,c=s.copy,d=[],f=[],p=[];t.exports={Polyline:a.extend({type:"ec-polyline",shape:{points:[],smooth:0,smoothConstraint:!0,smoothMonotone:null,connectNulls:!1},style:{fill:null,stroke:"#000"},buildPath:function(t,e){var i=e.points,a=0,s=i.length,l=r(i,e.smoothConstraint);if(e.connectNulls){for(;s>0&&n(i[s-1]);s--);for(;a0&&n(i[l-1]);l--);for(;s=0},wrapTreePathInfo:function(t,e){for(var i=[];t;){var n=t.dataIndex;i.push({name:t.name,dataIndex:n,value:e.getRawValue(n)}),t=t.parentNode}return i.reverse(),i}};t.exports=o},function(t,e,i){function n(t){if(!t.target||!t.target.draggable){var e=t.offsetX,i=t.offsetY;this.containsPoint&&this.containsPoint(e,i)&&(this._x=e,this._y=i,this._dragging=!0)}}function o(t){if(this._dragging&&(d.stop(t.event),"pinch"!==t.gestureEvent)){if(f.isTaken(this._zr,"globalPan"))return;var e=t.offsetX,i=t.offsetY,n=this._x,o=this._y,r=e-n,a=i-o;this._x=e,this._y=i;var s=this.target;if(s){var l=s.position;l[0]+=r,l[1]+=a,s.dirty()}d.stop(t.event),this.trigger("pan",r,a,n,o,e,i)}}function r(t){this._dragging=!1}function a(t){var e=t.wheelDelta>0?1.1:1/1.1;l.call(this,t,e,t.offsetX,t.offsetY)}function s(t){if(!f.isTaken(this._zr,"globalPan")){var e=t.pinchScale>1?1.1:1/1.1;l.call(this,t,e,t.pinchX,t.pinchY)}}function l(t,e,i,n){if(this.containsPoint&&this.containsPoint(i,n)){d.stop(t.event);var o=this.target,r=this.zoomLimit;if(o){var a=o.position,s=o.scale,l=this.zoom=this.zoom||1;if(l*=e,r){var u=r.min||0,h=r.max||1/0;l=Math.max(Math.min(h,l),u)}var c=l/this.zoom;this.zoom=l,a[0]-=(i-a[0])*(c-1),a[1]-=(n-a[1])*(c-1),s[0]*=c,s[1]*=c,o.dirty()}this.trigger("zoom",e,i,n)}}function u(t,e){this.target=e,this.containsPoint,this.zoomLimit,this.zoom,this._zr=t;var i=c.bind,l=i(n,this),u=i(o,this),d=i(r,this),f=i(a,this),p=i(s,this);h.call(this),this.setContainsPoint=function(t){this.containsPoint=t},this.enable=function(e){this.disable(),null==e&&(e=!0),e!==!0&&"move"!==e&&"pan"!==e||(t.on("mousedown",l),t.on("mousemove",u),t.on("mouseup",d)),e!==!0&&"scale"!==e&&"zoom"!==e||(t.on("mousewheel",f),t.on("pinch",p))},this.disable=function(){t.off("mousedown",l),t.off("mousemove",u),t.off("mouseup",d),t.off("mousewheel",f),t.off("pinch",p)},this.dispose=this.disable,this.isDragging=function(){return this._dragging},this.isPinching=function(){return this._pinching}}var h=i(21),c=i(1),d=i(25),f=i(117);c.mixin(u,h),t.exports=u},function(t,e){t.exports=function(t,e,i,n,o){function r(t,e,i){var n=e.length?e.slice():[e,e];return e[0]>e[1]&&n.reverse(),t<0&&n[0]+t0&&n[1]+t>i[1]&&(t=i[1]-n[1]),t}return t?("rigid"===n?(t=r(t,e,i),e[0]+=t,e[1]+=t):(t=r(t,e[o],i),e[o]+=t,"push"===n&&e[0]>e[1]&&(e[1-o]=e[o])),e):e}},function(t,e,i){var n=i(1),o={show:!0,zlevel:0,z:0,inverse:!1,name:"",nameLocation:"end",nameRotate:null,nameTruncate:{maxWidth:null,ellipsis:"...",placeholder:"."},nameTextStyle:{},nameGap:15,silent:!1,triggerEvent:!1,tooltip:{show:!1},axisLine:{show:!0,onZero:!0,lineStyle:{color:"#333",width:1,type:"solid"}},axisTick:{show:!0,inside:!1,length:5,lineStyle:{width:1}},axisLabel:{show:!0,inside:!1,rotate:0,margin:8,textStyle:{fontSize:12}},splitLine:{show:!0,lineStyle:{color:["#ccc"],width:1,type:"solid"}},splitArea:{show:!1,areaStyle:{color:["rgba(250,250,250,0.3)","rgba(200,200,200,0.3)"]}}},r=n.merge({boundaryGap:!0,splitLine:{show:!1},axisTick:{alignWithLabel:!1,interval:"auto"},axisLabel:{interval:"auto"}},o),a=n.merge({boundaryGap:[0,0],splitNumber:5},o),s=n.defaults({scale:!0,min:"dataMin",max:"dataMax"},a),l=n.defaults({logBase:10},a);l.scale=!0,t.exports={categoryAxis:r,valueAxis:a,timeAxis:s,logAxis:l}},function(t,e,i){"use strict";function n(t){return t.get("stack")||"__ec_stack_"+t.seriesIndex}function o(t){return t.dim+t.index}function r(t,e){var i={};s.each(t,function(t,e){var r=t.getData(),a=t.coordinateSystem,s=a.getBaseAxis(),l=s.getExtent(),h="category"===s.type?s.getBandWidth():Math.abs(l[1]-l[0])/r.count(),c=i[o(s)]||{bandWidth:h,remainedWidth:h,autoWidthCount:0,categoryGap:"20%",gap:"30%",stacks:{}},d=c.stacks;i[o(s)]=c;var f=n(t);d[f]||c.autoWidthCount++,d[f]=d[f]||{width:0,maxWidth:0};var p=u(t.get("barWidth"),h),g=u(t.get("barMaxWidth"),h),m=t.get("barGap"),v=t.get("barCategoryGap");p&&!d[f].width&&(p=Math.min(c.remainedWidth,p),d[f].width=p,c.remainedWidth-=p),g&&(d[f].maxWidth=g),null!=m&&(c.gap=m),null!=v&&(c.categoryGap=v)});var r={};return s.each(i,function(t,e){r[e]={};var i=t.stacks,n=t.bandWidth,o=u(t.categoryGap,n),a=u(t.gap,1),l=t.remainedWidth,h=t.autoWidthCount,c=(l-o)/(h+(h-1)*a);c=Math.max(c,0),s.each(i,function(t,e){var i=t.maxWidth;!t.width&&i&&i=0?"p":"n",v=m[i],y=l[s][i][h],x=u[s][i][h];f.isHorizontal()?(n=y,o=v[1]+c,r=v[0]-x,a=d,u[s][i][h]+=r,Math.abs(r)e+s&&a>n+s||at+s&&r>i+s||re+h&&u>o+h&&u>a+h||ut+h&&l>i+h&&l>r+h||le&&r>n||ro?a:0}},function(t,e,i){"use strict";var n=i(1),o=i(37),r=function(t,e,i,n,r,a){this.x=null==t?0:t,this.y=null==e?0:e,this.x2=null==i?1:i,this.y2=null==n?0:n,this.type="linear",this.global=a||!1,o.call(this,r)};r.prototype={constructor:r},n.inherits(r,o),t.exports=r},function(t,e,i){"use strict";function n(t){return t>s||t<-s}var o=i(20),r=i(5),a=o.identity,s=5e-5,l=function(t){t=t||{},t.position||(this.position=[0,0]),null==t.rotation&&(this.rotation=0),t.scale||(this.scale=[1,1]),this.origin=this.origin||null},u=l.prototype;u.transform=null,u.needLocalTransform=function(){return n(this.rotation)||n(this.position[0])||n(this.position[1])||n(this.scale[0]-1)||n(this.scale[1]-1)},u.updateTransform=function(){var t=this.parent,e=t&&t.transform,i=this.needLocalTransform(),n=this.transform;return i||e?(n=n||o.create(),i?this.getLocalTransform(n):a(n),e&&(i?o.mul(n,t.transform,n):o.copy(n,t.transform)),this.transform=n,this.invTransform=this.invTransform||o.create(),void o.invert(this.invTransform,n)):void(n&&a(n))},u.getLocalTransform=function(t){t=t||[],a(t);var e=this.origin,i=this.scale,n=this.rotation,r=this.position;return e&&(t[4]-=e[0],t[5]-=e[1]),o.scale(t,t,i),n&&o.rotate(t,t,n),e&&(t[4]+=e[0],t[5]+=e[1]),t[4]+=r[0],t[5]+=r[1],t},u.setTransform=function(t){var e=this.transform,i=t.dpr||1;e?t.setTransform(i*e[0],i*e[1],i*e[2],i*e[3],i*e[4],i*e[5]):t.setTransform(i,0,0,i,0,0)},u.restoreTransform=function(t){var e=(this.transform,t.dpr||1);t.setTransform(e,0,0,e,0,0)};var h=[];u.decomposeTransform=function(){if(this.transform){var t=this.parent,e=this.transform;t&&t.transform&&(o.mul(h,t.invTransform,e),e=h);var i=e[0]*e[0]+e[1]*e[1],r=e[2]*e[2]+e[3]*e[3],a=this.position,s=this.scale;n(i-1)&&(i=Math.sqrt(i)),n(r-1)&&(r=Math.sqrt(r)),e[0]<0&&(i=-i),e[3]<0&&(r=-r),a[0]=e[4],a[1]=e[5],s[0]=i,s[1]=r,this.rotation=Math.atan2(-e[1]/r,e[0]/i)}},u.getGlobalScale=function(){var t=this.transform;if(!t)return[1,1];var e=Math.sqrt(t[0]*t[0]+t[1]*t[1]),i=Math.sqrt(t[2]*t[2]+t[3]*t[3]);return t[0]<0&&(e=-e),t[3]<0&&(i=-i),[e,i]},u.transformCoordToLocal=function(t,e){var i=[t,e],n=this.invTransform;return n&&r.applyTransform(i,i,n),i},u.transformCoordToGlobal=function(t,e){var i=[t,e],n=this.transform;return n&&r.applyTransform(i,i,n),i},t.exports=l},function(t,e,i){"use strict";function n(t){o.each(r,function(e){this[e]=o.bind(t[e],t)},this)}var o=i(1),r=["getDom","getZr","getWidth","getHeight","dispatchAction","isDisposed","on","off","getDataURL","getConnectedDataURL","getModel","getOption"];t.exports=n},function(t,e,i){var n=i(1);i(53),i(95),i(96);var o=i(87),r=i(2);r.registerLayout(n.curry(o,"bar")),r.registerVisual(function(t){t.eachSeriesByType("bar",function(t){var e=t.getData();e.setVisual("legendSymbol","roundRect")})}),i(31)},function(t,e,i){t.exports=i(80).extend({type:"series.bar",dependencies:["grid","polar"],brushSelector:"rect"})},function(t,e,i){"use strict";function n(t,e,i,n,o,r,a){var s=new u.Rect({shape:l.extend({},n)});if(r){var h=s.shape,c=o?"height":"width",d={};h[c]=0,d[c]=n[c],u[a?"updateProps":"initProps"](s,{shape:d},r,e)}return s}function o(t,e,i){i.style.text="",u.updateProps(i,{shape:{width:0}},e,t,function(){i.parent&&i.parent.remove(i)})}function r(t,e,i){var n=t.getItemLayout(e),o=s(i,n),r=n.width>0?1:-1,a=n.height>0?1:-1;return{x:n.x+r*o/2,y:n.y+a*o/2,width:n.width-r*o,height:n.height-a*o}}function a(t,e,i,n,o,r,a){var s=e.getItemVisual(i,"color"),c=e.getItemVisual(i,"opacity"),d=n.getModel("itemStyle.normal"),f=n.getModel("itemStyle.emphasis").getBarItemStyle();t.setShape("r",d.get("barBorderRadius")||0),t.useStyle(l.defaults({fill:s,opacity:c},d.getBarItemStyle()));var p=a?o.height>0?"bottom":"top":o.width>0?"left":"right";h.setLabel(t.style,f,n,s,r,i,p),u.setHoverStyle(t,f)}function s(t,e){var i=t.get(c)||0;return Math.min(i,Math.abs(e.width),Math.abs(e.height))}var l=i(1),u=i(3),h=i(81),c=["itemStyle","normal","barBorderWidth"];l.extend(i(11).prototype,i(97));var d=i(2).extendChartView({type:"bar",render:function(t,e,i){var n=t.get("coordinateSystem");return"cartesian2d"===n&&this._renderOnCartesian(t,e,i),this.group},dispose:l.noop,_renderOnCartesian:function(t,e,i){var s=this.group,l=t.getData(),h=this._data,c=t.coordinateSystem,d=c.getBaseAxis(),f=d.isHorizontal(),p=t.isAnimationEnabled()?t:null;l.diff(h).add(function(e){if(l.hasValue(e)){var i=l.getItemModel(e),o=r(l,e,i),u=n(l,e,i,o,f,p);l.setItemGraphicEl(e,u),s.add(u),a(u,l,e,i,o,t,f)}}).update(function(e,i){var o=h.getItemGraphicEl(i);if(!l.hasValue(e))return void s.remove(o);var c=l.getItemModel(e),d=r(l,e,c);o?u.updateProps(o,{shape:d},p,e):o=n(l,e,c,d,f,p,!0),l.setItemGraphicEl(e,o),s.add(o),a(o,l,e,c,d,t,f)}).remove(function(t){var e=h.getItemGraphicEl(t);e&&o(t,p,e)}).execute(),this._data=l},remove:function(t,e){var i=this.group,n=this._data;t.get("animation")?n&&n.eachItemGraphicEl(function(e){o(e.dataIndex,t,e)}):i.removeAll()}});t.exports=d},function(t,e,i){var n=i(30)([["fill","color"],["stroke","borderColor"],["lineWidth","borderWidth"],["stroke","barBorderColor"],["lineWidth","barBorderWidth"],["opacity"],["shadowBlur"],["shadowOffsetX"],["shadowOffsetY"],["shadowColor"]]);t.exports={getBarItemStyle:function(t){var e=n.call(this,t);if(this.getBorderLineDash){var i=this.getBorderLineDash();i&&(e.lineDash=i)}return e}}},function(t,e,i){function n(t){return"_"+t+"Type"}function o(t,e,i){var n=e.getItemVisual(i,"color"),o=e.getItemVisual(i,t),r=e.getItemVisual(i,t+"Size");if(o&&"none"!==o){f.isArray(r)||(r=[r,r]);var a=u.createSymbol(o,-r[0]/2,-r[1]/2,r[0],r[1],n);return a.name=t,a}}function r(t){var e=new c({name:"line"});return a(e.shape,t),e}function a(t,e){var i=e[0],n=e[1],o=e[2];t.x1=i[0],t.y1=i[1],t.x2=n[0],t.y2=n[1],t.percent=1,o?(t.cpx1=o[0],t.cpy1=o[1]):(t.cpx1=NaN,t.cpy1=NaN)}function s(){var t=this,e=t.childOfName("fromSymbol"),i=t.childOfName("toSymbol"),n=t.childOfName("label");if(e||i||!n.ignore){for(var o=1,r=this.parent;r;)r.scale&&(o/=r.scale[0]),r=r.parent;var a=t.childOfName("line");if(this.__dirty||a.__dirty){var s=a.shape.percent,l=a.pointAt(0),u=a.pointAt(s),c=h.sub([],u,l);if(h.normalize(c,c),e){e.attr("position",l);var d=a.tangentAt(0);e.attr("rotation",Math.PI/2-Math.atan2(d[1],d[0])),e.attr("scale",[o*s,o*s])}if(i){i.attr("position",u);var d=a.tangentAt(1);i.attr("rotation",-Math.PI/2-Math.atan2(d[1],d[0])),i.attr("scale",[o*s,o*s])}if(!n.ignore){n.attr("position",u);var f,p,g,m=5*o;if("end"===n.__position)f=[c[0]*m+u[0],c[1]*m+u[1]],p=c[0]>.8?"left":c[0]<-.8?"right":"center",g=c[1]>.8?"top":c[1]<-.8?"bottom":"middle";else if("middle"===n.__position){var v=s/2,d=a.tangentAt(v),y=[d[1],-d[0]],x=a.pointAt(v);y[1]>0&&(y[0]=-y[0],y[1]=-y[1]),f=[x[0]+y[0]*m,x[1]+y[1]*m],p="center",g="bottom";var _=-Math.atan2(d[1],d[0]);u[0].8?"right":c[0]<-.8?"left":"center",g=c[1]>.8?"bottom":c[1]<-.8?"top":"middle";n.attr({style:{textVerticalAlign:n.__verticalAlign||g,textAlign:n.__textAlign||p},position:f,scale:[o,o]})}}}}function l(t,e,i){d.Group.call(this),this._createLine(t,e,i)}var u=i(24),h=i(5),c=i(177),d=i(3),f=i(1),p=i(4),g=["fromSymbol","toSymbol"],m=l.prototype;m.beforeUpdate=s,m._createLine=function(t,e,i){var a=t.hostModel,s=t.getItemLayout(e),l=r(s);l.shape.percent=0,d.initProps(l,{shape:{percent:1}},a,e),this.add(l);var u=new d.Text({name:"label"});this.add(u),f.each(g,function(i){var r=o(i,t,e);this.add(r),this[n(i)]=t.getItemVisual(e,i)},this),this._updateCommonStl(t,e,i)},m.updateData=function(t,e,i){var r=t.hostModel,s=this.childOfName("line"),l=t.getItemLayout(e),u={shape:{}};a(u.shape,l),d.updateProps(s,u,r,e),f.each(g,function(i){var r=t.getItemVisual(e,i),a=n(i);if(this[a]!==r){this.remove(this.childOfName(i));var s=o(i,t,e);this.add(s)}this[a]=r},this),this._updateCommonStl(t,e,i)},m._updateCommonStl=function(t,e,i){var n=t.hostModel,o=this.childOfName("line"),r=i&&i.lineStyle,a=i&&i.hoverLineStyle,s=i&&i.labelModel,l=i&&i.hoverLabelModel;if(!i||t.hasItemOption){var u=t.getItemModel(e);r=u.getModel("lineStyle.normal").getLineStyle(),a=u.getModel("lineStyle.emphasis").getLineStyle(),s=u.getModel("label.normal"),l=u.getModel("label.emphasis")}var h=t.getItemVisual(e,"color"),c=f.retrieve(t.getItemVisual(e,"opacity"),r.opacity,1);o.useStyle(f.defaults({strokeNoScale:!0,fill:"none",stroke:h,opacity:c},r)),o.hoverStyle=a,f.each(g,function(t){var e=this.childOfName(t);e&&(e.setColor(h),e.setStyle({opacity:c}))},this);var m,v,y=s.getShallow("show"),x=l.getShallow("show"),_=this.childOfName("label");if(y||x){var b=n.getRawValue(e);v=null==b?v=t.getName(e):isFinite(b)?p.round(b):b,m=h||"#000"}if(y){var w=s.getModel("textStyle");_.setStyle({text:f.retrieve(n.getFormattedLabel(e,"normal",t.dataType),v),textFont:w.getFont(),fill:w.getTextColor()||m}),_.__textAlign=w.get("align"),_.__verticalAlign=w.get("baseline"),_.__position=s.get("position")}else _.setStyle("text","");if(x){var S=l.getModel("textStyle");_.hoverStyle={text:f.retrieve(n.getFormattedLabel(e,"emphasis",t.dataType),v),textFont:S.getFont(),fill:S.getTextColor()||m}}else _.hoverStyle={text:""};_.ignore=!y&&!x,d.setHoverStyle(this)},m.updateLayout=function(t,e){this.setLinePoints(t.getItemLayout(e))},m.setLinePoints=function(t){var e=this.childOfName("line");a(e.shape,t),e.dirty()},f.inherits(l,d.Group),t.exports=l},function(t,e,i){function n(t){return isNaN(t[0])||isNaN(t[1])}function o(t){return!n(t[0])&&!n(t[1])}function r(t){this._ctor=t||s,this.group=new a.Group}var a=i(3),s=i(98),l=r.prototype;l.updateData=function(t){var e=this._lineData,i=this.group,n=this._ctor,r=t.hostModel,a={lineStyle:r.getModel("lineStyle.normal").getLineStyle(),hoverLineStyle:r.getModel("lineStyle.emphasis").getLineStyle(),labelModel:r.getModel("label.normal"),hoverLabelModel:r.getModel("label.emphasis")};t.diff(e).add(function(e){if(o(t.getItemLayout(e))){var r=new n(t,e,a);t.setItemGraphicEl(e,r),i.add(r)}}).update(function(r,s){var l=e.getItemGraphicEl(s);return o(t.getItemLayout(r))?(l?l.updateData(t,r,a):l=new n(t,r,a),t.setItemGraphicEl(r,l),void i.add(l)):void i.remove(l)}).remove(function(t){i.remove(e.getItemGraphicEl(t))}).execute(),this._lineData=t},l.updateLayout=function(){var t=this._lineData;t.eachItemGraphicEl(function(e,i){e.updateLayout(t,i)},this)},l.remove=function(){this.group.removeAll()},t.exports=r},function(t,e,i){var n=i(1),o=i(2),r=o.PRIORITY;i(101),i(102),o.registerVisual(n.curry(i(45),"line","circle","line")),o.registerLayout(n.curry(i(56),"line")),o.registerProcessor(r.PROCESSOR.STATISTIC,n.curry(i(135),"line")),i(31)},function(t,e,i){"use strict";var n=i(35),o=i(16);t.exports=o.extend({type:"series.line",dependencies:["grid","polar"],getInitialData:function(t,e){return n(t.data,this,e)},defaultOption:{zlevel:0,z:2,coordinateSystem:"cartesian2d",legendHoverLink:!0,hoverAnimation:!0,clipOverflow:!0,label:{normal:{position:"top"}},lineStyle:{normal:{width:2,type:"solid"}},step:!1,smooth:!1,smoothMonotone:null,symbol:"emptyCircle",symbolSize:4,symbolRotate:null,showSymbol:!0,showAllSymbol:!1,connectNulls:!1,sampling:"none",animationEasing:"linear",progressive:0,hoverLayerThreshold:1/0}})},function(t,e,i){"use strict";function n(t,e){if(t.length===e.length){for(var i=0;ie[0]?1:-1;e[0]+=n*i,e[1]-=n*i}return e}function a(t){return t>=0?1:-1}function s(t,e){var i=t.getBaseAxis(),n=t.getOtherAxis(i),o=i.onZero?0:n.scale.getExtent()[0],r=n.dim,s="x"===r||"radius"===r?1:0;return e.mapArray([r],function(n,l){for(var u,h=e.stackedOn;h&&a(h.get(r,l))===a(n);){u=h;break}var c=[];return c[s]=e.get(i.dim,l),c[1-s]=u?u.get(r,l,!0):o,t.dataToPoint(c)},!0)}function l(t,e,i){var n=r(t.getAxis("x")),o=r(t.getAxis("y")),a=t.getBaseAxis().isHorizontal(),s=Math.min(n[0],n[1]),l=Math.min(o[0],o[1]),u=Math.max(n[0],n[1])-s,h=Math.max(o[0],o[1])-l,c=i.get("lineStyle.normal.width")||2,d=i.get("clipOverflow")?c/2:Math.max(u,h);a?(l-=d,h+=2*d):(s-=d,u+=2*d);var f=new v.Rect({shape:{x:s,y:l,width:u,height:h}});return e&&(f.shape[a?"width":"height"]=0,v.initProps(f,{shape:{width:u,height:h}},i)),f}function u(t,e,i){var n=t.getAngleAxis(),o=t.getRadiusAxis(),r=o.getExtent(),a=n.getExtent(),s=Math.PI/180,l=new v.Sector({shape:{cx:t.cx,cy:t.cy,r0:r[0],r:r[1],startAngle:-a[0]*s,endAngle:-a[1]*s,clockwise:n.inverse}});return e&&(l.shape.endAngle=-a[0]*s,v.initProps(l,{shape:{endAngle:-a[1]*s}},i)),l}function h(t,e,i){return"polar"===t.type?u(t,e,i):l(t,e,i)}function c(t,e,i){for(var n=e.getBaseAxis(),o="x"===n.dim||"radius"===n.dim?0:1,r=[],a=0;a=0;o--)if(i[o].dimension<2){n=i[o];break}if(n&&"cartesian2d"===e.type){var r=n.dimension,a=t.dimensions[r],s=e.getAxis(a),l=f.map(n.stops,function(t){return{coord:s.toGlobalCoord(s.dataToCoord(t.value)),color:t.color}}),u=l.length,h=n.outerColors.slice();u&&l[0].coord>l[u-1].coord&&(l.reverse(),h.reverse());var c=10,d=l[0].coord-c,p=l[u-1].coord+c,g=p-d;if(g<.001)return"transparent";f.each(l,function(t){t.offset=(t.coord-d)/g}),l.push({offset:u?l[u-1].offset:.5,color:h[1]||"transparent"}),l.unshift({offset:u?l[0].offset:.5,color:h[0]||"transparent"});var m=new v.LinearGradient(0,0,0,0,l,(!0));return m[a]=d,m[a+"2"]=p,m}}}var f=i(1),p=i(39),g=i(50),m=i(103),v=i(3),y=i(6),x=i(82),_=i(28);t.exports=_.extend({type:"line",init:function(){var t=new v.Group,e=new p;this.group.add(e.group),this._symbolDraw=e,this._lineGroup=t},render:function(t,e,i){var r=t.coordinateSystem,a=this.group,l=t.getData(),u=t.getModel("lineStyle.normal"),p=t.getModel("areaStyle.normal"),g=l.mapArray(l.getItemLayout,!0),m="polar"===r.type,v=this._coordSys,y=this._symbolDraw,x=this._polyline,_=this._polygon,b=this._lineGroup,w=t.get("animation"),S=!p.isEmpty(),M=s(r,l),I=t.get("showSymbol"),T=I&&!m&&!t.get("showAllSymbol")&&this._getSymbolIgnoreFunc(l,r),A=this._data;A&&A.eachItemGraphicEl(function(t,e){t.__temp&&(a.remove(t),A.setItemGraphicEl(e,null))}),I||y.remove(),a.add(b);var L=!m&&t.get("step");x&&v.type===r.type&&L===this._step?(S&&!_?_=this._newPolygon(g,M,r,w):_&&!S&&(b.remove(_),_=this._polygon=null),b.setClipPath(h(r,!1,t)),I&&y.updateData(l,T),l.eachItemGraphicEl(function(t){t.stopAnimation(!0)}),n(this._stackedOnPoints,M)&&n(this._points,g)||(w?this._updateAnimation(l,M,r,i,L):(L&&(g=c(g,r,L),M=c(M,r,L)),x.setShape({points:g}),_&&_.setShape({points:g,stackedOnPoints:M})))):(I&&y.updateData(l,T),L&&(g=c(g,r,L),M=c(M,r,L)),x=this._newPolyline(g,r,w),S&&(_=this._newPolygon(g,M,r,w)),b.setClipPath(h(r,!0,t)));var C=d(l,r)||l.getVisual("color");x.useStyle(f.defaults(u.getLineStyle(),{fill:"none",stroke:C,lineJoin:"bevel"}));var D=t.get("smooth");if(D=o(t.get("smooth")),x.setShape({smooth:D,smoothMonotone:t.get("smoothMonotone"),connectNulls:t.get("connectNulls")}),_){var P=l.stackedOn,k=0;if(_.useStyle(f.defaults(p.getAreaStyle(),{fill:C,opacity:.7,lineJoin:"bevel"})),P){var O=P.hostModel;k=o(O.get("smooth"))}_.setShape({smooth:D,stackedOnSmooth:k,smoothMonotone:t.get("smoothMonotone"),connectNulls:t.get("connectNulls")})}this._data=l,this._coordSys=r,this._stackedOnPoints=M,this._points=g,this._step=L},dispose:function(){},highlight:function(t,e,i,n){var o=t.getData(),r=y.queryDataIndex(o,n);if(!(r instanceof Array)&&null!=r&&r>=0){var a=o.getItemGraphicEl(r);if(!a){var s=o.getItemLayout(r);if(!s)return;a=new g(o,r),a.position=s,a.setZ(t.get("zlevel"),t.get("z")),a.ignore=isNaN(s[0])||isNaN(s[1]),a.__temp=!0,o.setItemGraphicEl(r,a),a.stopSymbolAnimation(!0),this.group.add(a)}a.highlight()}else _.prototype.highlight.call(this,t,e,i,n)},downplay:function(t,e,i,n){var o=t.getData(),r=y.queryDataIndex(o,n);if(null!=r&&r>=0){var a=o.getItemGraphicEl(r);a&&(a.__temp?(o.setItemGraphicEl(r,null),this.group.remove(a)):a.downplay())}else _.prototype.downplay.call(this,t,e,i,n)},_newPolyline:function(t){var e=this._polyline;return e&&this._lineGroup.remove(e),e=new x.Polyline({shape:{points:t},silent:!0,z2:10}),this._lineGroup.add(e),this._polyline=e,e},_newPolygon:function(t,e){var i=this._polygon;return i&&this._lineGroup.remove(i),i=new x.Polygon({shape:{points:t,stackedOnPoints:e},silent:!0}),this._lineGroup.add(i),this._polygon=i,i},_getSymbolIgnoreFunc:function(t,e){var i=e.getAxesByScale("ordinal")[0];if(i&&i.isLabelIgnored)return f.bind(i.isLabelIgnored,i)},_updateAnimation:function(t,e,i,n,o){var r=this._polyline,a=this._polygon,s=t.hostModel,l=m(this._data,t,this._stackedOnPoints,e,this._coordSys,i),u=l.current,h=l.stackedOnCurrent,d=l.next,f=l.stackedOnNext;o&&(u=c(l.current,i,o),h=c(l.stackedOnCurrent,i,o),d=c(l.next,i,o),f=c(l.stackedOnNext,i,o)),r.shape.__points=l.current,r.shape.points=u,v.updateProps(r,{shape:{points:d}},s),a&&(a.setShape({points:u,stackedOnPoints:h}),v.updateProps(a,{shape:{points:d,stackedOnPoints:f}},s));for(var p=[],g=l.status,y=0;y=0?1:-1}function n(t,e,n){for(var o,r=t.getBaseAxis(),a=t.getOtherAxis(r),s=r.onZero?0:a.scale.getExtent()[0],l=a.dim,u="x"===l||"radius"===l?1:0,h=e.stackedOn,c=e.get(l,n);h&&i(h.get(l,n))===i(c);){o=h;break}var d=[];return d[u]=e.get(r.dim,n),d[1-u]=o?o.get(l,n,!0):s,t.dataToPoint(d)}function o(t,e){var i=[];return e.diff(t).add(function(t){i.push({cmd:"+",idx:t})}).update(function(t,e){i.push({cmd:"=",idx:e,idx1:t})}).remove(function(t){i.push({cmd:"-",idx:t})}).execute(),i}t.exports=function(t,e,i,r,a,s){for(var l=o(t,e),u=[],h=[],c=[],d=[],f=[],p=[],g=[],m=s.dimensions,v=0;v0&&"scale"!==d){var g=a.getItemLayout(0),m=Math.max(i.getWidth(),i.getHeight())/2,v=l.bind(u.removeClipPath,u);u.setClipPath(this._createClipPath(g.cx,g.cy,m,g.startAngle,g.clockwise,v,t))}this._data=a}},dispose:function(){},_createClipPath:function(t,e,i,n,o,r,a){var l=new s.Sector({shape:{cx:t,cy:e,r0:0,r:i,startAngle:n,endAngle:n,clockwise:o}});return s.initProps(l,{shape:{endAngle:n+(o?1:-1)*Math.PI*2}},a,r),l},containPoint:function(t,e){var i=e.getData(),n=i.getItemLayout(0);if(n){var o=t[0]-n.cx,r=t[1]-n.cy,a=Math.sqrt(o*o+r*r);return a<=n.r&&a>=n.r0}}});t.exports=h},function(t,e,i){"use strict";function n(t,e,i,n,o,r,a){function s(e,i,n,o){for(var r=e;re&&r+1t[r].y+t[r].height)return void l(r,n/2);l(i-1,n/2)}function l(e,i){for(var n=e;n>=0&&(t[n].y-=i,!(n>0&&t[n].y>t[n-1].y+t[n-1].height));n--);}function u(t,e,i,n,o,r){for(var a=r>0?e?Number.MAX_VALUE:0:e?Number.MAX_VALUE:0,s=0,l=t.length;s=a&&(d=a-10),!e&&d<=a&&(d=a+10),t[s].x=i+d*r,a=d}}t.sort(function(t,e){return t.y-e.y});for(var h,c=0,d=t.length,f=[],p=[],g=0;g=i?p.push(t[g]):f.push(t[g]);u(f,!1,e,i,n,o),u(p,!0,e,i,n,o)}function o(t,e,i,o,r,a){for(var s=[],l=[],u=0;u0?"left":"right"}var D=g.getModel("textStyle").getFont(),P=g.get("rotate")?b<0?-_+Math.PI:-_:0,k=t.getFormattedLabel(i,"normal")||l.getName(i),O=r.getBoundingRect(k,D,d,"top");h=!!P,f.label={x:n,y:o,position:m,height:O.height,len:y,len2:x,linePoints:c,textAlign:d,verticalAlign:"middle",font:D,rotation:P},S||u.push(f.label)}),!h&&t.get("avoidLabelOverlap")&&o(u,a,s,e,i,n)}},function(t,e,i){var n=i(4),o=n.parsePercent,r=i(107),a=i(1),s=2*Math.PI,l=Math.PI/180;t.exports=function(t,e,i,u){e.eachSeriesByType(t,function(t){var e=t.get("center"),u=t.get("radius");a.isArray(u)||(u=[0,u]),a.isArray(e)||(e=[e,e]);var h=i.getWidth(),c=i.getHeight(),d=Math.min(h,c),f=o(e[0],h),p=o(e[1],c),g=o(u[0],d/2),m=o(u[1],d/2),v=t.getData(),y=-t.get("startAngle")*l,x=t.get("minAngle")*l,_=v.getSum("value"),b=Math.PI/(_||v.count())*2,w=t.get("clockwise"),S=t.get("roseType"),M=t.get("stillShowZeroSum"),I=v.getDataExtent("value");I[0]=0;var T=s,A=0,L=y,C=w?1:-1;if(v.each("value",function(t,e){var i;if(isNaN(t))return void v.setItemLayout(e,{angle:NaN,startAngle:NaN,endAngle:NaN,clockwise:w,cx:f,cy:p,r0:g,r:S?NaN:m});i="area"!==S?0===_&&M?b:t*b:s/(v.count()||1),i=0;o--){var r=i[o];if(r[n])break}if(o<0){var a=t.queryComponents({mainType:"dataZoom",subType:"select",id:n})[0];if(a){var s=a.getPercentRange();i[0][n]={dataZoomId:n,start:s[0],end:s[1]}}}}),i.push(e)},pop:function(t){var e=n(t),i=e[e.length-1];e.length>1&&e.pop();var o={};return r(i,function(t,i){for(var n=e.length-1;n>=0;n--){var t=e[n][i];if(t){o[i]=t;break}}}),o},clear:function(t){t[a]=null},count:function(t){return n(t).length}};t.exports=s},function(t,e,i){i(13).registerSubTypeDefaulter("dataZoom",function(t){return"slider"})},function(t,e,i){function n(t){N.call(this),this._zr=t,this.group=new G.Group,this._brushType,this._brushOption,this._panels,this._track=[],this._dragging,this._covers=[],this._creatingCover,this._creatingPanel,this._enableGlobalPan,this._uid="brushController_"+it++,this._handlers={},Z(nt,function(t,e){this._handlers[e]=V.bind(t,this)},this)}function o(t,e){var i=t._zr;t._enableGlobalPan||F.take(i,K,t._uid),Z(t._handlers,function(t,e){i.on(e,t)}),t._brushType=e.brushType,t._brushOption=V.merge(V.clone(et),e,!0)}function r(t){var e=t._zr;F.release(e,K,t._uid),Z(t._handlers,function(t,i){e.off(i,t)}),t._brushType=t._brushOption=null}function a(t,e){var i=ot[e.brushType].createCover(t,e);return u(i),i.__brushOption=e,t.group.add(i),i}function s(t,e){var i=c(e);return i.endCreating&&(i.endCreating(t,e),u(e)),e}function l(t,e){var i=e.__brushOption;c(e).updateCoverShape(t,e,i.range,i)}function u(t){t.traverse(function(t){t.z=Y,t.z2=Y})}function h(t,e){c(e).updateCommon(t,e),l(t,e)}function c(t){return ot[t.__brushOption.brushType]}function d(t,e,i){var n=t._panels;if(!n)return!0;var o;return Z(n,function(t){t.contain(e,i)&&(o=t)}),o}function f(t,e){var i=t._panels;if(!i)return!0;var n=e.__brushOption.panelId;return null==n||i[n]}function p(t){var e=t._covers,i=e.length;return Z(e,function(e){t.group.remove(e)},t),e.length=0,!!i}function g(t,e){var i=q(t._covers,function(t){var e=t.__brushOption,i=V.clone(e.range);return{brushType:e.brushType,panelId:e.panelId,range:i}});t.trigger("brush",i,{isEnd:!!e.isEnd,removeOnClick:!!e.removeOnClick})}function m(t){var e=t._track;if(!e.length)return!1;var i=e[e.length-1],n=e[0],o=i[0]-n[0],r=i[1]-n[1],a=X(o*o+r*r,.5);return a>$}function v(t){var e=t.length-1;return e<0&&(e=0),[t[0],t[e]]}function y(t,e,i,n){var o=new G.Group;return o.add(new G.Rect({name:"main",style:w(i),silent:!0,draggable:!0,cursor:"move",drift:W(t,e,o,"nswe"),ondragend:W(g,e,{isEnd:!0})})),Z(n,function(i){o.add(new G.Rect({name:i,style:{opacity:0},draggable:!0,silent:!0,invisible:!0,drift:W(t,e,o,i),ondragend:W(g,e,{isEnd:!0})}))}),o}function x(t,e,i,n){var o=n.brushStyle.lineWidth||0,r=U(o,Q),a=i[0][0],s=i[1][0],l=a-o/2,u=s-o/2,h=i[0][1],c=i[1][1],d=h-r+o/2,f=c-r+o/2,p=h-a,g=c-s,m=p+o,v=g+o;b(t,e,"main",a,s,p,g),n.transformable&&(b(t,e,"w",l,u,r,v),b(t,e,"e",d,u,r,v),b(t,e,"n",l,u,m,r),b(t,e,"s",l,f,m,r),b(t,e,"nw",l,u,r,r),b(t,e,"ne",d,u,r,r),b(t,e,"sw",l,f,r,r),b(t,e,"se",d,f,r,r))}function _(t,e){var i=e.__brushOption,n=i.transformable,o=e.childAt(0);o.useStyle(w(i)),o.attr({silent:!n,cursor:n?"move":"default"}),Z(["w","e","n","s","se","sw","ne","nw"],function(i){var o=e.childOfName(i),r=I(t,i);o&&o.attr({silent:!n,invisible:!n,cursor:n?tt[r]+"-resize":null})})}function b(t,e,i,n,o,r,a){var s=e.childOfName(i);s&&s.setShape(D(C(t,e,[[n,o],[n+r,o+a]])))}function w(t){return V.defaults({strokeNoScale:!0},t.brushStyle)}function S(t,e,i,n){var o=[j(t,i),j(e,n)],r=[U(t,i),U(e,n)];return[[o[0],r[0]],[o[1],r[1]]]}function M(t){return G.getTransform(t.group)}function I(t,e){if(e.length>1){e=e.split("");var i=[I(t,e[0]),I(t,e[1])];return("e"===i[0]||"w"===i[0])&&i.reverse(),i.join("")}var n={w:"left",e:"right",n:"top",s:"bottom"},o={left:"w",right:"e",top:"n",bottom:"s"},i=G.transformDirection(n[e],M(t));return o[i]}function T(t,e,i,n,o,r,a,s){var l=n.__brushOption,u=t(l.range),c=L(i,r,a);Z(o.split(""),function(t){var e=J[t];u[e[0]][e[1]]+=c[e[0]]}),l.range=e(S(u[0][0],u[1][0],u[0][1],u[1][1])),h(i,n),g(i,{isEnd:!1})}function A(t,e,i,n,o){var r=e.__brushOption.range,a=L(t,i,n);Z(r,function(t){t[0]+=a[0],t[1]+=a[1]}),h(t,e),g(t,{isEnd:!1})}function L(t,e,i){var n=t.group,o=n.transformCoordToLocal(e,i),r=n.transformCoordToLocal(0,0);return[o[0]-r[0],o[1]-r[1]]}function C(t,e,i){var n=f(t,e);if(n===!0)return V.clone(i);var o=n.getBoundingRect();return V.map(i,function(t){var e=t[0];e=U(e,o.x),e=j(e,o.x+o.width);var i=t[1];return i=U(i,o.y),i=j(i,o.y+o.height),[e,i]})}function D(t){var e=j(t[0][0],t[1][0]),i=j(t[0][1],t[1][1]),n=U(t[0][0],t[1][0]),o=U(t[0][1],t[1][1]);return{x:e,y:i,width:n-e,height:o-i}}function P(t,e){var i=e.offsetX,n=e.offsetY,o=t._zr;if(t._brushType){for(var r,a=t._panels,s=t._covers,l=0;lt[1]&&t.reverse(),t}function o(t,e){for(var i=!0,n=0;n=0){i=!1;for(var r=0;r=0?(i=n.getBoundingRect().clone(),i.applyTransform(s.getTransform(n))):i=n.grid.getRect().clone(),e.push({panelId:t.panelId,rect:i})}),e},u.makeCoordInfoList=function(t,e){var i=[];return l(h,function(n){var o=t[n+"Index"];null!=o&&"none"!==o&&("all"===o||a.isArray(o)||(o=[o]),e.eachComponent({mainType:n},function(t,e){if(!("all"!==o&&a.indexOf(o,e)<0)){var r,s;"xAxis"===n||"yAxis"===n?r=t.axis.grid:s=t.coordinateSystem;for(var l,u=0,h=i.length;u=0;n--)c.isIdInner(e[n])&&e.splice(n,1);t[i]=e}}),delete t[b],t},getTheme:function(){return this._theme},getComponent:function(t,e){var i=this._componentsMap[t];if(i)return i[e||0]},queryComponents:function(t){var e=t.mainType;if(!e)return[];var i=t.index,n=t.id,o=t.name,r=this._componentsMap[e];if(!r||!r.length)return[];var a;if(null!=i)m(i)||(i=[i]),a=p(g(i,function(t){return r[t]}),function(t){return!!t});else if(null!=n){var s=m(n);a=p(r,function(t){return s&&v(n,t.id)>=0||!s&&t.id===n})}else if(null!=o){var u=m(o);a=p(r,function(t){return u&&v(o,t.name)>=0||!u&&t.name===o})}else a=r;return l(a,t)},findComponents:function(t){function e(t){var e=o+"Index",i=o+"Id",n=o+"Name";return!t||null==t[e]&&null==t[i]&&null==t[n]?null:{mainType:o,index:t[e],id:t[i],name:t[n]}}function i(e){return t.filter?p(e,t.filter):e}var n=t.query,o=t.mainType,r=e(n),a=r?this.queryComponents(r):this._componentsMap[o];return i(l(a,t))},eachComponent:function(t,e,i){var n=this._componentsMap;if("function"==typeof t)i=e,e=t,f(n,function(t,n){f(t,function(t,o){e.call(i,n,t,o)})});else if(h.isString(t))f(n[t],e,i);else if(y(t)){var o=this.findComponents(t);f(o,e,i)}},getSeriesByName:function(t){var e=this._componentsMap.series;return p(e,function(e){return e.name===t})},getSeriesByIndex:function(t){return this._componentsMap.series[t]},getSeriesByType:function(t){var e=this._componentsMap.series;return p(e,function(e){return e.subType===t})},getSeries:function(){return this._componentsMap.series.slice()},eachSeries:function(t,e){u(this),f(this._seriesIndices,function(i){var n=this._componentsMap.series[i];t.call(e,n,i)},this)},eachRawSeries:function(t,e){f(this._componentsMap.series,t,e)},eachSeriesByType:function(t,e,i){u(this),f(this._seriesIndices,function(n){var o=this._componentsMap.series[n];o.subType===t&&e.call(i,o,n)},this)},eachRawSeriesByType:function(t,e,i){return f(this.getSeriesByType(t),e,i)},isSeriesFiltered:function(t){return u(this),h.indexOf(this._seriesIndices,t.componentIndex)<0},filterSeries:function(t,e){u(this);var i=p(this._componentsMap.series,t,e);this._seriesIndices=s(i)},restoreData:function(){var t=this._componentsMap;this._seriesIndices=s(t.series);var e=[];f(t,function(t,i){e.push(i)}),x.topologicalTravel(e,x.getAllClassMainTypes(),function(e,i){f(t[e],function(t){t.restoreData()})})}});h.mixin(w,i(57)),t.exports=w},function(t,e,i){function n(t){this._api=t,this._timelineOptions=[],this._mediaList=[],this._mediaDefault,this._currentMediaIndices=[],this._optionBackup,this._newBaseOption}function o(t,e,i){var n,o,r=[],a=[],s=t.timeline;if(t.baseOption&&(o=t.baseOption),(s||t.options)&&(o=o||{},r=(t.options||[]).slice()),t.media){o=o||{};var l=t.media;d(l,function(t){t&&t.option&&(t.query?a.push(t):n||(n=t))})}return o||(o=t),o.timeline||(o.timeline=s),d([o].concat(r).concat(u.map(a,function(t){return t.option})),function(t){d(e,function(e){e(t,i)})}),{baseOption:o,timelineOptions:r,mediaDefault:n,mediaList:a}}function r(t,e,i){var n={width:e,height:i,aspectratio:e/i},o=!0;return u.each(t,function(t,e){var i=e.match(m);if(i&&i[1]&&i[2]){var r=i[1],s=i[2].toLowerCase();a(n[s],t,r)||(o=!1)}}),o}function a(t,e,i){return"min"===i?t>=e:"max"===i?t<=e:t===e}function s(t,e){return t.join(",")===e.join(",")}function l(t,e){e=e||{},d(e,function(e,i){if(null!=e){var n=t[i];if(c.hasClass(i)){e=h.normalizeToArray(e),n=h.normalizeToArray(n);var o=h.mappingToExists(n,e);t[i]=p(o,function(t){return t.option&&t.exist?g(t.exist,t.option,!0):t.exist||t.option})}else t[i]=g(n,e,!0)}})}var u=i(1),h=i(6),c=i(13),d=u.each,f=u.clone,p=u.map,g=u.merge,m=/^(min|max)?(.+)$/;n.prototype={constructor:n,setOption:function(t,e){t=f(t,!0);var i=this._optionBackup,n=o.call(this,t,e,!i);this._newBaseOption=n.baseOption,i?(l(i.baseOption,n.baseOption),n.timelineOptions.length&&(i.timelineOptions=n.timelineOptions),n.mediaList.length&&(i.mediaList=n.mediaList),n.mediaDefault&&(i.mediaDefault=n.mediaDefault)):this._optionBackup=n},mountOption:function(t){var e=this._optionBackup;return this._timelineOptions=p(e.timelineOptions,f),this._mediaList=p(e.mediaList,f),this._mediaDefault=f(e.mediaDefault),this._currentMediaIndices=[],f(t?e.baseOption:this._newBaseOption)},getTimelineOption:function(t){var e,i=this._timelineOptions;if(i.length){var n=t.getComponent("timeline");n&&(e=f(i[n.getCurrentIndex()],!0))}return e},getMediaOption:function(t){var e=this._api.getWidth(),i=this._api.getHeight(),n=this._mediaList,o=this._mediaDefault,a=[],l=[];if(!n.length&&!o)return l;for(var u=0,h=n.length;ue&&(e=t[i]);return e},min:function(t){for(var e=1/0,i=0;i1){var c;"string"==typeof o?c=i[o]:"function"==typeof o&&(c=o),c&&(e=e.downSample(s.dim,1/h,c,n),t.setData(e))}}},this)}},function(t,e,i){function n(t,e){return c(t,h(e))}var o=i(1),r=i(32),a=i(4),s=i(38),l=r.prototype,u=s.prototype,h=a.getPrecisionSafe,c=a.round,d=Math.floor,f=Math.ceil,p=Math.pow,g=Math.log,m=r.extend({type:"log",base:10,$constructor:function(){r.apply(this,arguments),this._originalScale=new s},getTicks:function(){var t=this._originalScale,e=this._extent,i=t.getExtent();return o.map(u.getTicks.call(this),function(o){var r=a.round(p(this.base,o));return r=o===e[0]&&t.__fixMin?n(r,i[0]):r,r=o===e[1]&&t.__fixMax?n(r,i[1]):r},this)},getLabel:u.getLabel,scale:function(t){return t=l.scale.call(this,t),p(this.base,t)},setExtent:function(t,e){var i=this.base;t=g(t)/g(i),e=g(e)/g(i),u.setExtent.call(this,t,e)},getExtent:function(){var t=this.base,e=l.getExtent.call(this);e[0]=p(t,e[0]),e[1]=p(t,e[1]);var i=this._originalScale,o=i.getExtent();return i.__fixMin&&(e[0]=n(e[0],o[0])),i.__fixMax&&(e[1]=n(e[1],o[1])),e},unionExtent:function(t){this._originalScale.unionExtent(t);var e=this.base;t[0]=g(t[0])/g(e),t[1]=g(t[1])/g(e),l.unionExtent.call(this,t)},unionExtentFromData:function(t,e){this.unionExtent(t.getDataExtent(e,!0,function(t){return t>0}))},niceTicks:function(t){t=t||10;var e=this._extent,i=e[1]-e[0];if(!(i===1/0||i<=0)){var n=a.quantity(i),o=t/i*n;for(o<=.5&&(n*=10);!isNaN(n)&&Math.abs(n)<1&&Math.abs(n)>0;)n*=10;var r=[a.round(f(e[0]/n)*n),a.round(d(e[1]/n)*n)];this._interval=n,this._niceExtent=r}},niceExtent:function(t,e,i){u.niceExtent.call(this,t,e,i);var n=this._originalScale;n.__fixMin=e,n.__fixMax=i}});o.each(["contain","normalize"],function(t){m.prototype[t]=function(e){return e=g(e)/g(this.base),l[t].call(this,e)}}),m.create=function(){return new m},t.exports=m},function(t,e,i){var n=i(1),o=i(32),r=o.prototype,a=o.extend({type:"ordinal",init:function(t,e){this._data=t,this._extent=e||[0,t.length-1]},parse:function(t){return"string"==typeof t?n.indexOf(this._data,t):Math.round(t)},contain:function(t){return t=this.parse(t),r.contain.call(this,t)&&null!=this._data[t]},normalize:function(t){return r.normalize.call(this,this.parse(t))},scale:function(t){return Math.round(r.scale.call(this,t))},getTicks:function(){for(var t=[],e=this._extent,i=e[0];i<=e[1];)t.push(i),i++;return t},getLabel:function(t){return this._data[t]},count:function(){return this._extent[1]-this._extent[0]+1},unionExtentFromData:function(t,e){this.unionExtent(t.getDataExtent(e,!1))},niceTicks:n.noop,niceExtent:n.noop});a.create=function(){return new a},t.exports=a},function(t,e,i){var n=i(1),o=i(4),r=i(8),a=i(38),s=a.prototype,l=Math.ceil,u=Math.floor,h=1e3,c=60*h,d=60*c,f=24*d,p=function(t,e,i,n){for(;i>>1;t[o][2]=0;o--)if(!n[o].silent&&n[o]!==i&&!n[o].ignore&&r(n[o],t,e))return n[o]}},a.each(["click","mousedown","mouseup","mousewheel","dblclick","contextmenu"],function(t){h.prototype[t]=function(e){var i=this.findHover(e.zrX,e.zrY,null);if("mousedown"===t)this._downel=i,this._upel=i;else if("mosueup"===t)this._upel=i;else if("click"===t&&this._downel!==this._upel)return;this.dispatchToElement(i,t,e)}}),a.mixin(h,l),a.mixin(h,s),t.exports=h},function(t,e,i){function n(){return!1}function o(t,e,i,n){var o=document.createElement(e),r=i.getWidth(),a=i.getHeight(),s=o.style;return s.position="absolute",s.left=0,s.top=0,s.width=r+"px",s.height=a+"px",o.width=r*n,o.height=a*n,o.setAttribute("data-zr-dom-id",t),o}var r=i(1),a=i(33),s=i(66),l=i(65),u=function(t,e,i){var s;i=i||a.devicePixelRatio,"string"==typeof t?s=o(t,"canvas",e,i):r.isObject(t)&&(s=t,t=s.id),this.id=t,this.dom=s;var l=s.style;l&&(s.onselectstart=n,l["-webkit-user-select"]="none",l["user-select"]="none",l["-webkit-touch-callout"]="none",l["-webkit-tap-highlight-color"]="rgba(0,0,0,0)",l.padding=0,l.margin=0,l["border-width"]=0),this.domBack=null,this.ctxBack=null,this.painter=e,this.config=null,this.clearColor=0,this.motionBlur=!1,this.lastFrameAlpha=.7,this.dpr=i};u.prototype={constructor:u,elCount:0,__dirty:!0,initContext:function(){this.ctx=this.dom.getContext("2d"),this.ctx.dpr=this.dpr},createBackBuffer:function(){var t=this.dpr;this.domBack=o("back-"+this.id,"canvas",this.painter,t),this.ctxBack=this.domBack.getContext("2d"),1!=t&&this.ctxBack.scale(t,t)},resize:function(t,e){var i=this.dpr,n=this.dom,o=n.style,r=this.domBack;o.width=t+"px",o.height=e+"px",n.width=t*i,n.height=e*i,r&&(r.width=t*i,r.height=e*i,1!=i&&this.ctxBack.scale(i,i))},clear:function(t){var e=this.dom,i=this.ctx,n=e.width,o=e.height,r=this.clearColor,a=this.motionBlur&&!t,u=this.lastFrameAlpha,h=this.dpr;if(a&&(this.domBack||this.createBackBuffer(),this.ctxBack.globalCompositeOperation="copy",this.ctxBack.drawImage(e,0,0,n/h,o/h)),i.clearRect(0,0,n,o),r){var c;r.colorStops?(c=r.__canvasGradient||s.getGradient(i,r,{x:0,y:0,width:n,height:o}),r.__canvasGradient=c):r.image&&(c=l.prototype.getCanvasPattern.call(r,i)),i.save(),i.fillStyle=c||r,i.fillRect(0,0,n,o),i.restore()}if(a){var d=this.domBack;i.save(),i.globalAlpha=u,i.drawImage(d,0,0,n,o),i.restore()}}},t.exports=u},function(t,e,i){"use strict";function n(t){return parseInt(t,10)}function o(t){return!!t&&(!!t.isBuildin||"function"==typeof t.resize&&"function"==typeof t.refresh)}function r(t){t.__unusedCount++}function a(t){1==t.__unusedCount&&t.clear()}function s(t,e,i){return x.copy(t.getBoundingRect()),t.transform&&x.applyTransform(t.transform),_.width=e,_.height=i,!x.intersect(_)}function l(t,e){if(t==e)return!1;if(!t||!e||t.length!==e.length)return!0;for(var i=0;i=0&&i.splice(n,1),t.__hoverMir=null},clearHover:function(t){for(var e=this._hoverElements,i=0;i=0){if(!s){if(s=this._progressiveLayers[Math.min(u++,y-1)],s.ctx.save(),s.renderScope={},s&&s.__progress>s.__maxProgress){g=s.__nextIdxNotProg-1;continue}l=s.__progress,s.__dirty||(p=l),s.__progress=p+1}_===p&&this._doPaintEl(v,s,!0,s.renderScope)}else this._doPaintEl(v,n,e,a);v.__dirty=!1}}s&&i(s),r&&r.restore(),this._furtherProgressive=!1,d.each(this._progressiveLayers,function(t){t.__maxProgress>=t.__progress&&(this._furtherProgressive=!0)},this)},_doPaintEl:function(t,e,i,n){var o=e.ctx,r=t.transform;if((e.__dirty||i)&&!t.invisible&&0!==t.style.opacity&&(!r||r[0]||r[3])&&(!t.culling||!s(t,this._width,this._height))){var a=t.__clipPaths;(n.prevClipLayer!==e||l(a,n.prevElClipPaths))&&(n.prevElClipPaths&&(n.prevClipLayer.ctx.restore(),n.prevClipLayer=n.prevElClipPaths=null,n.prevEl=null),a&&(o.save(),u(a,o),n.prevClipLayer=e,n.prevElClipPaths=a)),t.beforeBrush&&t.beforeBrush(o),t.brush(o,n.prevEl||null),n.prevEl=t,t.afterBrush&&t.afterBrush(o)}},getLayer:function(t){if(this._singleCanvas)return this._layers[0];var e=this._layers[t];return e||(e=new m("zr_"+t,this,this.dpr),e.isBuildin=!0,this._layerConfig[t]&&d.merge(e,this._layerConfig[t],!0),this.insertLayer(t,e),e.initContext()),e},insertLayer:function(t,e){var i=this._layers,n=this._zlevelList,r=n.length,a=null,s=-1,l=this._domRoot;if(i[t])return void f("ZLevel "+t+" has been used already");if(!o(e))return void f("Layer of zlevel "+t+" is not valid");if(r>0&&t>n[0]){for(s=0;st);s++);a=i[n[s]]}if(n.splice(s+1,0,t),a){var u=a.dom;u.nextSibling?l.insertBefore(e.dom,u.nextSibling):l.appendChild(e.dom)}else l.firstChild?l.insertBefore(e.dom,l.firstChild):l.appendChild(e.dom);i[t]=e},eachLayer:function(t,e){var i,n,o=this._zlevelList;for(n=0;n=0){a!==g&&(a=g,l++);var v=c.__frame=l-1;if(!r){var x=Math.min(s,y-1);r=i[x],r||(r=i[x]=new m("progressive",this,this.dpr),r.initContext()),r.__maxProgress=0}r.__dirty=r.__dirty||c.__dirty,r.elCount++,r.__maxProgress=Math.max(r.__maxProgress,v),r.__maxProgress>=r.__progress&&(p.__dirty=!0)}else c.__frame=-1,r&&(r.__nextIdxNotProg=u,s++,r=null)}r&&(s++,r.__nextIdxNotProg=u),this.eachBuildinLayer(function(t,e){n[e]!==t.elCount&&(t.__dirty=!0)}),i.length=Math.min(s,y),d.each(i,function(t,e){o[e]!==t.elCount&&(c.__dirty=!0),t.__dirty&&(t.__progress=0)})},clear:function(){return this.eachBuildinLayer(this._clearLayer),this},_clearLayer:function(t){t.clear()},configLayer:function(t,e){if(e){var i=this._layerConfig;i[t]?d.merge(i[t],e,!0):i[t]=e;var n=this._layers[t];n&&d.merge(n,i[t],!0)}},delLayer:function(t){var e=this._layers,i=this._zlevelList,n=e[t];n&&(n.dom.parentNode.removeChild(n.dom),delete e[t],i.splice(d.indexOf(i,t),1))},resize:function(t,e){var i=this._domRoot;i.style.display="none";var n=this._opts;if(null!=t&&(n.width=t),null!=e&&(n.height=e),t=this._getSize(0),e=this._getSize(1),i.style.display="",this._width!=t||e!=this._height){i.style.width=t+"px",i.style.height=e+"px";for(var o in this._layers)this._layers.hasOwnProperty(o)&&this._layers[o].resize(t,e);d.each(this._progressiveLayers,function(i){i.resize(t,e)}),this.refresh(!0)}return this._width=t,this._height=e,this},clearLayer:function(t){var e=this._layers[t];e&&e.clear()},dispose:function(){this.root.innerHTML="",this.root=this.storage=this._domRoot=this._layers=null},getRenderedCanvas:function(t){if(t=t||{},this._singleCanvas)return this._layers[0].dom;var e=new m("image",this,t.pixelRatio||this.dpr);e.initContext(),e.clearColor=t.backgroundColor,e.clear();for(var i=this.storage.getDisplayList(!0),n={},o=0;o=0&&(this.delFromMap(r.id),this._roots.splice(s,1),r instanceof a&&r.delChildrenFromStorage(this))}},addToMap:function(t){return t instanceof a&&(t.__storage=this),t.dirty(!1),this._elements[t.id]=t,this},get:function(t){return this._elements[t]},delFromMap:function(t){var e=this._elements,i=e[t];return i&&(delete e[t],i instanceof a&&(i.__storage=null)),this},dispose:function(){this._elements=this._renderList=this._roots=null},displayableSortFunc:n},t.exports=l},function(t,e,i){"use strict";var n=i(1),o=i(25).Dispatcher,r=i(62),a=i(61),s=function(t){t=t||{},this.stage=t.stage||{},this.onframe=t.onframe||function(){},this._clips=[],this._running=!1,this._time,this._pausedTime,this._pauseStart,this._paused=!1,o.call(this)};s.prototype={constructor:s,addClip:function(t){this._clips.push(t)},addAnimator:function(t){t.animation=this;for(var e=t.getClips(),i=0;i=0&&this._clips.splice(e,1)},removeAnimator:function(t){for(var e=t.getClips(),i=0;ii||d+ca&&(a+=o);var p=Math.atan2(h,u);return p<0&&(p+=o),p>=r&&p<=a||p+o>=r&&p+o<=a}}},function(t,e,i){var n=i(18);t.exports={containStroke:function(t,e,i,o,r,a,s,l,u,h,c){if(0===u)return!1;var d=u;if(c>e+d&&c>o+d&&c>a+d&&c>l+d||ct+d&&h>i+d&&h>r+d&&h>s+d||he&&h>n&&h>a&&h>l||h1&&o(),d=g.cubicAt(e,n,a,l,b[0]),m>1&&(f=g.cubicAt(e,n,a,l,b[1]))),p+=2==m?ye&&s>n&&s>r||s=0&&u<=1){for(var h=0,c=g.quadraticAt(e,n,r,u),d=0;di||s<-i)return 0;var l=Math.sqrt(i*i-s*s);_[0]=-l,_[1]=l;var u=Math.abs(n-o);if(u<1e-4)return 0;if(u%y<1e-4){n=0,o=y;var h=r?1:-1;return a>=_[0]+t&&a<=_[1]+t?h:0}if(r){var l=n;n=p(o),o=p(l)}else n=p(n),o=p(o);n>o&&(o+=y);for(var c=0,d=0;d<2;d++){var f=_[d];if(f+t>a){var g=Math.atan2(s,f),h=r?1:-1;g<0&&(g=y+g),(g>=n&&g<=o||g+y>=n&&g+y<=o)&&(g>Math.PI/2&&g<1.5*Math.PI&&(h=-h),c+=h)}}return c}function l(t,e,i,o,l){for(var h=0,p=0,g=0,y=0,x=0,_=0;_1&&(i||(h+=m(p,g,y,x,o,l))),1==_&&(p=t[_],g=t[_+1],y=p,x=g),b){case u.M:y=t[_++],x=t[_++],p=y,g=x;break;case u.L:if(i){if(v(p,g,t[_],t[_+1],e,o,l))return!0}else h+=m(p,g,t[_],t[_+1],o,l)||0;p=t[_++],g=t[_++];break;case u.C:if(i){if(c.containStroke(p,g,t[_++],t[_++],t[_++],t[_++],t[_],t[_+1],e,o,l))return!0}else h+=r(p,g,t[_++],t[_++],t[_++],t[_++],t[_],t[_+1],o,l)||0;p=t[_++],g=t[_++];break;case u.Q:if(i){if(d.containStroke(p,g,t[_++],t[_++],t[_],t[_+1],e,o,l))return!0}else h+=a(p,g,t[_++],t[_++],t[_],t[_+1],o,l)||0;p=t[_++],g=t[_++];break;case u.A:var w=t[_++],S=t[_++],M=t[_++],I=t[_++],T=t[_++],A=t[_++],L=(t[_++],1-t[_++]),C=Math.cos(T)*M+w,D=Math.sin(T)*I+S;_>1?h+=m(p,g,C,D,o,l):(y=C,x=D);var P=(o-w)*I/M+w;if(i){if(f.containStroke(w,S,I,T,T+A,L,e,P,l))return!0}else h+=s(w,S,I,T,T+A,L,P,l);p=Math.cos(T+A)*M+w,g=Math.sin(T+A)*I+S;break;case u.R:y=p=t[_++],x=g=t[_++];var k=t[_++],O=t[_++],C=y+k,D=x+O;if(i){if(v(y,x,C,x,e,o,l)||v(C,x,C,D,e,o,l)||v(C,D,y,D,e,o,l)||v(y,D,y,x,e,o,l))return!0}else h+=m(C,x,C,D,o,l),h+=m(y,D,y,x,o,l);break;case u.Z:if(i){if(v(p,g,y,x,e,o,l))return!0}else h+=m(p,g,y,x,o,l);p=y,g=x}}return i||n(g,x)||(h+=m(p,g,y,x,o,l)||0),0!==h}var u=i(29).CMD,h=i(88),c=i(148),d=i(89),f=i(147),p=i(63).normalizeRadian,g=i(18),m=i(90),v=h.containStroke,y=2*Math.PI,x=1e-4,_=[-1,-1,-1],b=[-1,-1];t.exports={contain:function(t,e,i){return l(t,0,!1,e,i)},containStroke:function(t,e,i,n){return l(t,e,!0,i,n)}}},function(t,e,i){"use strict";function n(t){var e=t[1][0]-t[0][0],i=t[1][1]-t[0][1];return Math.sqrt(e*e+i*i)}function o(t){return[(t[0][0]+t[1][0])/2,(t[0][1]+t[1][1])/2]}var r=i(25),a=function(){this._track=[]};a.prototype={constructor:a,recognize:function(t,e,i){return this._doTrack(t,e,i),this._recognize(t)},clear:function(){return this._track.length=0,this},_doTrack:function(t,e,i){var n=t.touches;if(n){for(var o={points:[],touches:[],target:e,event:t},a=0,s=n.length;a1&&r&&r.length>1){var s=n(r)/n(a);!isFinite(s)&&(s=1),e.pinchScale=s;var l=o(r);return e.pinchX=l[0],e.pinchY=l[1],{type:"pinch",target:t[0].target,event:e}}}}};t.exports=a},function(t,e){var i=function(){this.head=null,this.tail=null,this._len=0},n=i.prototype;n.insert=function(t){var e=new o(t);return this.insertEntry(e),e},n.insertEntry=function(t){this.head?(this.tail.next=t,t.prev=this.tail,this.tail=t):this.head=this.tail=t,this._len++},n.remove=function(t){var e=t.prev,i=t.next;e?e.next=i:this.head=i,i?i.prev=e:this.tail=e,t.next=t.prev=null,this._len--},n.len=function(){return this._len};var o=function(t){this.value=t,this.next,this.prev},r=function(t){this._list=new i,this._map={},this._maxSize=t||10},a=r.prototype;a.put=function(t,e){var i=this._list,n=this._map;if(null==n[t]){var o=i.len();if(o>=this._maxSize&&o>0){var r=i.head;i.remove(r),delete n[r.key]}var a=i.insert(e);a.key=t,n[t]=a}},a.get=function(t){var e=this._map[t],i=this._list;if(null!=e)return e!==i.tail&&(i.remove(e),i.insertEntry(e)),e.value},a.clear=function(){this._list.clear(),this._map={}},t.exports=r},function(t,e,i){function n(t){return"mousewheel"===t&&d.browser.firefox?"DOMMouseScroll":t}function o(t,e,i){var n=t._gestureMgr;"start"===i&&n.clear();var o=n.recognize(e,t.handler.findHover(e.zrX,e.zrY,null),t.dom);if("end"===i&&n.clear(),o){var r=o.type;e.gestureEvent=r,t.handler.dispatchToElement(o.target,r,o.event)}}function r(t){t._touching=!0,clearTimeout(t._touchTimer),t._touchTimer=setTimeout(function(){t._touching=!1},700)}function a(t){var e=t.pointerType;return"pen"===e||"touch"===e}function s(t){function e(t,e){return function(){if(!e._touching)return t.apply(e,arguments)}}h.each(x,function(e){t._handlers[e]=h.bind(w[e],t)}),h.each(b,function(e){t._handlers[e]=h.bind(w[e],t)}),h.each(y,function(i){t._handlers[i]=e(w[i],t)})}function l(t){function e(e,i){h.each(e,function(e){p(t,n(e),i._handlers[e])},i)}c.call(this),this.dom=t,this._touching=!1,this._touchTimer,this._gestureMgr=new f,this._handlers={},s(this),d.pointerEventsSupported?e(b,this):(d.touchEventsSupported&&e(x,this),e(y,this))}var u=i(25),h=i(1),c=i(21),d=i(10),f=i(150),p=u.addEventListener,g=u.removeEventListener,m=u.normalizeEvent,v=300,y=["click","dblclick","mousewheel","mouseout","mouseup","mousedown","mousemove","contextmenu"],x=["touchstart","touchend","touchmove"],_={pointerdown:1,pointerup:1,pointermove:1,pointerout:1},b=h.map(y,function(t){var e=t.replace("mouse","pointer");return _[e]?e:t}),w={mousemove:function(t){t=m(this.dom,t),this.trigger("mousemove",t)},mouseout:function(t){t=m(this.dom,t);var e=t.toElement||t.relatedTarget;if(e!=this.dom)for(;e&&9!=e.nodeType;){if(e===this.dom)return;e=e.parentNode}this.trigger("mouseout",t)},touchstart:function(t){t=m(this.dom,t),t.zrByTouch=!0,this._lastTouchMoment=new Date,o(this,t,"start"),w.mousemove.call(this,t),w.mousedown.call(this,t),r(this)},touchmove:function(t){t=m(this.dom,t),t.zrByTouch=!0,o(this,t,"change"),w.mousemove.call(this,t),r(this)},touchend:function(t){t=m(this.dom,t),t.zrByTouch=!0,o(this,t,"end"),w.mouseup.call(this,t),+new Date-this._lastTouchMomentl&&(c=i+n,i*=l/c,n*=l/c),o+r>l&&(c=o+r,o*=l/c,r*=l/c),n+o>u&&(c=n+o,n*=u/c,o*=u/c),i+r>u&&(c=i+r,i*=u/c,r*=u/c),t.moveTo(a+i,s),t.lineTo(a+l-n,s),0!==n&&t.quadraticCurveTo(a+l,s,a+l,s+n),t.lineTo(a+l,s+u-o),0!==o&&t.quadraticCurveTo(a+l,s+u,a+l-o,s+u),t.lineTo(a+r,s+u),0!==r&&t.quadraticCurveTo(a,s+u,a,s+u-r),t.lineTo(a,s+i),0!==i&&t.quadraticCurveTo(a,s,a+i,s)}}},function(t,e,i){var n=i(5),o=n.min,r=n.max,a=n.scale,s=n.distance,l=n.add;t.exports=function(t,e,i,u){var h,c,d,f,p=[],g=[],m=[],v=[];if(u){d=[1/0,1/0],f=[-(1/0),-(1/0)];for(var y=0,x=t.length;yi-2?i-1:f+1],c=t[f>i-3?i-1:f+2]);var m=p*p,v=p*m;r.push([n(u[0],g[0],h[0],c[0],p,m,v),n(u[1],g[1],h[1],c[1],p,m,v)])}return r}},function(t,e,i){t.exports=i(7).extend({type:"arc",shape:{cx:0,cy:0,r:0,startAngle:0,endAngle:2*Math.PI,clockwise:!0},style:{stroke:"#000",fill:null},buildPath:function(t,e){var i=e.cx,n=e.cy,o=Math.max(e.r,0),r=e.startAngle,a=e.endAngle,s=e.clockwise,l=Math.cos(r),u=Math.sin(r);t.moveTo(l*o+i,u*o+n),t.arc(i,n,o,r,a,!s)}})},function(t,e,i){"use strict";function n(t,e,i){var n=t.cpx2,o=t.cpy2;return null===n||null===o?[(i?c:u)(t.x1,t.cpx1,t.cpx2,t.x2,e),(i?c:u)(t.y1,t.cpy1,t.cpy2,t.y2,e)]:[(i?h:l)(t.x1,t.cpx1,t.x2,e),(i?h:l)(t.y1,t.cpy1,t.y2,e)]}var o=i(18),r=i(5),a=o.quadraticSubdivide,s=o.cubicSubdivide,l=o.quadraticAt,u=o.cubicAt,h=o.quadraticDerivativeAt,c=o.cubicDerivativeAt,d=[];t.exports=i(7).extend({type:"bezier-curve",shape:{x1:0,y1:0,x2:0,y2:0,cpx1:0,cpy1:0,percent:1},style:{stroke:"#000",fill:null},buildPath:function(t,e){var i=e.x1,n=e.y1,o=e.x2,r=e.y2,l=e.cpx1,u=e.cpy1,h=e.cpx2,c=e.cpy2,f=e.percent;0!==f&&(t.moveTo(i,n),null==h||null==c?(f<1&&(a(i,l,o,f,d),l=d[1],o=d[2],a(n,u,r,f,d),u=d[1],r=d[2]),t.quadraticCurveTo(l,u,o,r)):(f<1&&(s(i,l,h,o,f,d),l=d[1],h=d[2],o=d[3],s(n,u,c,r,f,d),u=d[1],c=d[2],r=d[3]),t.bezierCurveTo(l,u,h,c,o,r)))},pointAt:function(t){return n(this.shape,t,!1)},tangentAt:function(t){var e=n(this.shape,t,!0);return r.normalize(e,e)}})},function(t,e,i){"use strict";t.exports=i(7).extend({type:"circle",shape:{cx:0,cy:0,r:0},buildPath:function(t,e,i){i&&t.moveTo(e.cx+e.r,e.cy),t.arc(e.cx,e.cy,e.r,0,2*Math.PI,!0)}})},function(t,e,i){t.exports=i(7).extend({type:"line",shape:{x1:0,y1:0,x2:0,y2:0,percent:1},style:{stroke:"#000",fill:null},buildPath:function(t,e){var i=e.x1,n=e.y1,o=e.x2,r=e.y2,a=e.percent;0!==a&&(t.moveTo(i,n),a<1&&(o=i*(1-a)+o*a,r=n*(1-a)+r*a),t.lineTo(o,r))},pointAt:function(t){var e=this.shape;return[e.x1*(1-t)+e.x2*t,e.y1*(1-t)+e.y2*t]}})},function(t,e,i){var n=i(67);t.exports=i(7).extend({type:"polygon",shape:{points:null,smooth:!1,smoothConstraint:null},buildPath:function(t,e){n.buildPath(t,e,!0)}})},function(t,e,i){var n=i(67);t.exports=i(7).extend({type:"polyline",shape:{points:null,smooth:!1,smoothConstraint:null},style:{stroke:"#000",fill:null},buildPath:function(t,e){n.buildPath(t,e,!1)}})},function(t,e,i){var n=i(155);t.exports=i(7).extend({type:"rect",shape:{r:0,x:0,y:0,width:0,height:0},buildPath:function(t,e){var i=e.x,o=e.y,r=e.width,a=e.height;e.r?n.buildPath(t,e):t.rect(i,o,r,a),t.closePath()}})},function(t,e,i){t.exports=i(7).extend({type:"ring",shape:{cx:0,cy:0,r:0,r0:0},buildPath:function(t,e){var i=e.cx,n=e.cy,o=2*Math.PI;t.moveTo(i+e.r,n),t.arc(i,n,e.r,0,o,!1),t.moveTo(i+e.r0,n),t.arc(i,n,e.r0,0,o,!0)}})},function(t,e,i){var n=i(10),o=i(7),r=[["shadowBlur",0],["shadowColor","#000"],["shadowOffsetX",0],["shadowOffsetY",0]];t.exports=o.extend({type:"sector",shape:{cx:0,cy:0,r0:0,r:0,startAngle:0,endAngle:2*Math.PI,clockwise:!0},brush:n.browser.ie&&n.browser.version>=11?function(){var t,e=this.__clipPaths,i=this.style;if(e)for(var n=0;n0&&this.animate(t,!1).when(null==n?500:n,a).delay(r||0),this}},t.exports=u},function(t,e){function i(){this.on("mousedown",this._dragStart,this),this.on("mousemove",this._drag,this),this.on("mouseup",this._dragEnd,this),this.on("globalout",this._dragEnd,this)}i.prototype={constructor:i,_dragStart:function(t){var e=t.target;e&&e.draggable&&(this._draggingTarget=e,e.dragging=!0,this._x=t.offsetX,this._y=t.offsetY,this.dispatchToElement(e,"dragstart",t.event))},_drag:function(t){var e=this._draggingTarget;if(e){var i=t.offsetX,n=t.offsetY,o=i-this._x,r=n-this._y;this._x=i,this._y=n,e.drift(o,r,t),this.dispatchToElement(e,"drag",t.event);var a=this.findHover(i,n,e),s=this._dropTarget;this._dropTarget=a,e!==a&&(s&&a!==s&&this.dispatchToElement(s,"dragleave",t.event),a&&a!==s&&this.dispatchToElement(a,"dragenter",t.event))}},_dragEnd:function(t){var e=this._draggingTarget;e&&(e.dragging=!1),this.dispatchToElement(e,"dragend",t.event),this._dropTarget&&this.dispatchToElement(this._dropTarget,"drop",t.event),this._draggingTarget=null,this._dropTarget=null}},t.exports=i},function(t,e,i){function n(t,e,i,n,o,r,a,s,l,u,h){var g=l*(p/180),y=f(g)*(t-i)/2+d(g)*(e-n)/2,x=-1*d(g)*(t-i)/2+f(g)*(e-n)/2,_=y*y/(a*a)+x*x/(s*s);_>1&&(a*=c(_),s*=c(_));var b=(o===r?-1:1)*c((a*a*(s*s)-a*a*(x*x)-s*s*(y*y))/(a*a*(x*x)+s*s*(y*y)))||0,w=b*a*x/s,S=b*-s*y/a,M=(t+i)/2+f(g)*w-d(g)*S,I=(e+n)/2+d(g)*w+f(g)*S,T=v([1,0],[(y-w)/a,(x-S)/s]),A=[(y-w)/a,(x-S)/s],L=[(-1*y-w)/a,(-1*x-S)/s],C=v(A,L);m(A,L)<=-1&&(C=p),m(A,L)>=1&&(C=0),0===r&&C>0&&(C-=2*p),1===r&&C<0&&(C+=2*p),h.addData(u,M,I,a,s,T,C,g,r)}function o(t){if(!t)return[];var e,i=t.replace(/-/g," -").replace(/ /g," ").replace(/ /g,",").replace(/,,/g,",");for(e=0;e0&&""===m[0]&&m.shift();for(var v=0;v')}}catch(l){n=function(t){return a.createElement("<"+t+' xmlns="'+o+'" class="zrvml">')}}var u=function(){if(!s){s=!0;var t=a.styleSheets;t.length<31?a.createStyleSheet().addRule(".zrvml","behavior:url(#default#VML)"):t[0].addRule(".zrvml","behavior:url(#default#VML)")}};t.exports={doc:a,initVML:u,createNode:n}}},function(t,e,i){"use strict";function n(t){return null==t.value?t:t.value}var o=i(14),r=i(27),a=i(292),s=i(1),l={_baseAxisDim:null,getInitialData:function(t,e){var i,a,s=e.getComponent("xAxis",this.get("xAxisIndex")),l=e.getComponent("yAxis",this.get("yAxisIndex")),u=s.get("type"),h=l.get("type");"category"===u?(t.layout="horizontal",i=s.getCategories(),a=!0):"category"===h?(t.layout="vertical",i=l.getCategories(),a=!0):t.layout=t.layout||"horizontal",this._baseAxisDim="horizontal"===t.layout?"x":"y";var c=t.data,d=this.dimensions=["base"].concat(this.valueDimensions);r(d,c);var f=new o(d,this);return f.initData(c,i?i.slice():null,function(t,e,i,o){var r=n(t);return a?"base"===e?i:r[o-1]:r[o]}),f},coordDimToDataDim:function(t){var e=this.valueDimensions.slice(),i=["base"],n={horizontal:{x:i,y:e},vertical:{x:e,y:i}};return n[this.get("layout")][t]},dataDimToCoordDim:function(t){var e;return s.each(["x","y"],function(i,n){var o=this.coordDimToDataDim(i);s.indexOf(o,t)>=0&&(e=i)},this),e},getBaseAxis:function(){var t=this._baseAxisDim;return this.ecModel.getComponent(t+"Axis",this.get(t+"AxisIndex")).axis}},u={init:function(){var t=this._whiskerBoxDraw=new a(this.getStyleUpdater());this.group.add(t.group)},render:function(t,e,i){this._whiskerBoxDraw.updateData(t.getData())},remove:function(t){this._whiskerBoxDraw.remove()}};t.exports={seriesModelMixin:l,viewMixin:u}},function(t,e,i){function n(t,e){var i,n=this.getBoundingRect(),o=t.get("layoutCenter"),r=t.get("layoutSize"),s=e.getWidth(),u=e.getHeight(),h=t.get("aspectScale")||.75,c=n.width/n.height*h,d=!1;o&&r&&(o=[l.parsePercent(o[0],s),l.parsePercent(o[1],u)],r=l.parsePercent(r,Math.min(s,u)),isNaN(o[0])||isNaN(o[1])||isNaN(r)||(d=!0));var f;if(d){var f={};c>1?(f.width=r,f.height=r/c):(f.height=r,f.width=r*c),f.y=o[1]-f.height/2,f.x=o[0]-f.width/2}else i=t.getBoxLayoutParams(),i.aspect=c,f=a.getLayoutRect(i,{width:s,height:u});this.setViewRect(f.x,f.y,f.width,f.height),this.setCenter(t.get("center")),this.setZoom(t.get("zoom"))}function o(t,e){s.each(e.get("geoCoord"),function(e,i){t.addGeoCoord(i,e)})}var r=i(369),a=i(12),s=i(1),l=i(4),u={},h={dimensions:r.prototype.dimensions,create:function(t,e){var i=[];t.eachComponent("geo",function(t,a){var s=t.get("map"),l=u[s],h=new r(s+a,s,l&&l.geoJson,l&&l.specialAreas,t.get("nameMap"));h.zoomLimit=t.get("scaleLimit"),i.push(h),o(h,t),t.coordinateSystem=h,h.model=t,h.resize=n,h.resize(t,e)}),t.eachSeries(function(t){var e=t.get("coordinateSystem");if("geo"===e){var n=t.get("geoIndex")||0;t.coordinateSystem=i[n]}});var a={};return t.eachSeriesByType("map",function(t){if(!t.getHostGeoModel()){var e=t.getMapType();a[e]=a[e]||[],a[e].push(t)}}),s.each(a,function(t,a){var l=u[a],h=s.map(t,function(t){return t.get("nameMap")}),c=new r(a,a,l&&l.geoJson,l&&l.specialAreas,s.mergeAll(h));c.zoomLimit=s.retrieve.apply(null,s.map(t,function(t){return t.get("scaleLimit")})),i.push(c),c.resize=n,c.resize(t[0],e),s.each(t,function(t){t.coordinateSystem=c,o(c,t)})}),i},registerMap:function(t,e,i){e.geoJson&&!e.features&&(i=e.specialAreas,e=e.geoJson),"string"==typeof e&&(e="undefined"!=typeof JSON&&JSON.parse?JSON.parse(e):new Function("return ("+e+");")()),u[t]={geoJson:e,specialAreas:i}},getMap:function(t){return u[t]},getFilledRegions:function(t,e){var i=(t||[]).slice(),n=h.getMap(e),o=n&&n.geoJson;if(!o)return t;for(var r={},a=o.features,s=0;s1)for(var i=1;i=0;r--){var a=n[r],s=o[r],l=a[0]-s[0]/2,u=a[1]-s[1]/2;if(t>=l&&e>=u&&t<=l+s[0]&&e<=u+s[1])return r}return-1}}),s=n.prototype;s.updateData=function(t){this.group.removeAll();var e=this._symbolEl,i=t.hostModel;e.setShape({points:t.mapArray(t.getItemLayout),sizes:t.mapArray(function(e){var i=t.getItemVisual(e,"symbolSize");return i instanceof Array||(i=[i,i]),i})}),e.symbolProxy=r.createSymbol(t.getVisual("symbol"),0,0,0,0),e.setColor=e.symbolProxy.setColor, -e.useStyle(i.getModel("itemStyle.normal").getItemStyle(["color"]));var n=t.getVisual("color");n&&e.setColor(n),e.seriesIndex=i.seriesIndex,e.on("mousemove",function(t){e.dataIndex=null;var i=e.findDataIndex(t.offsetX,t.offsetY);i>0&&(e.dataIndex=i)}),this.group.add(e)},s.updateLayout=function(t){var e=t.getData();this._symbolEl.setShape({points:e.mapArray(e.getItemLayout)})},s.remove=function(){this.group.removeAll()},t.exports=n},function(t,e,i){function n(t){return isNaN(+t.cpx1)||isNaN(+t.cpy1)}var o=i(3),r=i(5),a=o.Line.prototype,s=o.BezierCurve.prototype;t.exports=o.extendShape({type:"ec-line",style:{stroke:"#000",fill:null},shape:{x1:0,y1:0,x2:0,y2:0,percent:1,cpx1:null,cpy1:null},buildPath:function(t,e){(n(e)?a:s).buildPath(t,e)},pointAt:function(t){return n(this.shape)?a.pointAt.call(this,t):s.pointAt.call(this,t)},tangentAt:function(t){var e=this.shape,i=n(e)?[e.x2-e.x1,e.y2-e.y1]:s.tangentAt.call(this,t);return r.normalize(i,i)}})},function(t,e,i){var n=i(1),o=i(2);i(179),i(180),o.registerVisual(n.curry(i(45),"scatter","circle",null)),o.registerLayout(n.curry(i(56),"scatter")),i(31)},function(t,e,i){"use strict";var n=i(35),o=i(16);t.exports=o.extend({type:"series.scatter",dependencies:["grid","polar"],getInitialData:function(t,e){var i=n(t.data,this,e);return i},brushSelector:"point",defaultOption:{coordinateSystem:"cartesian2d",zlevel:0,z:2,legendHoverLink:!0,hoverAnimation:!0,symbolSize:10,large:!1,largeThreshold:2e3,itemStyle:{normal:{opacity:.8}}}})},function(t,e,i){var n=i(39),o=i(176);i(2).extendChartView({type:"scatter",init:function(){this._normalSymbolDraw=new n,this._largeSymbolDraw=new o},render:function(t,e,i){var n=t.getData(),o=this._largeSymbolDraw,r=this._normalSymbolDraw,a=this.group,s=t.get("large")&&n.count()>t.get("largeThreshold")?o:r;this._symbolDraw=s,s.updateData(n),a.add(s.group),a.remove(s===o?r.group:o.group)},updateLayout:function(t){this._symbolDraw.updateLayout(t)},remove:function(t,e){this._symbolDraw&&this._symbolDraw.remove(e,!0)},dispose:function(){}})},function(t,e,i){i(114),i(40),i(41),i(187),i(188),i(183),i(184),i(112),i(111)},function(t,e,i){function n(t,e){var i=[1/0,-(1/0)];return u(e,function(e){var n=e.getData();n&&u(e.coordDimToDataDim(t),function(t){var e=n.getDataExtent(t);e[0]i[1]&&(i[1]=e[1])})},this),i[1]0&&(t[0]=0),t[1]<0&&(t[1]=0)),t}function r(t,e){var i=t.getAxisModel(),n=t._percentWindow,o=t._valueWindow;if(n){var r=s.getPixelPrecision(o,[0,500]),a=e||0===n[0]&&100===n[1];i.setRange(a?null:+o[0].toFixed(r),a?null:+o[1].toFixed(r))}}var a=i(1),s=i(4),l=i(68),u=a.each,h=s.asc,c=function(t,e,i,n){this._dimName=t,this._axisIndex=e,this._valueWindow,this._percentWindow,this._dataExtent,this.ecModel=n,this._dataZoomModel=i};c.prototype={constructor:c,hostedBy:function(t){return this._dataZoomModel===t},getDataValueWindow:function(){return this._valueWindow.slice()},getDataPercentWindow:function(){return this._percentWindow.slice()},getTargetSeriesModels:function(){var t=[],e=this.ecModel;return e.eachSeries(function(i){if(l.isCoordSupported(i.get("coordinateSystem"))){var n=this._dimName,o=e.queryComponents({mainType:n+"Axis",index:i.get(n+"AxisIndex"),id:i.get(n+"AxisId")})[0];this._axisIndex===(o&&o.componentIndex)&&t.push(i)}},this),t},getAxisModel:function(){return this.ecModel.getComponent(this._dimName+"Axis",this._axisIndex)},getOtherAxisModel:function(){var t,e,i=this._dimName,n=this.ecModel,o=this.getAxisModel(),r="x"===i||"y"===i;r?(e="gridIndex",t="x"===i?"y":"x"):(e="polarIndex",t="angle"===i?"radius":"angle");var a;return n.eachComponent(t+"Axis",function(t){(t.get(e)||0)===(o.get(e)||0)&&(a=t)}),a},calculateDataWindow:function(t){var e=this._dataExtent,i=this.getAxisModel(),n=i.axis.scale,r=[0,100],a=[t.start,t.end],l=[];return e=e.slice(),o(e,i),u(["startValue","endValue"],function(e){l.push(null!=t[e]?n.parse(t[e]):null)}),u([0,1],function(t){var i=l[t],o=a[t];null!=o||null==i?(null==o&&(o=r[t]),i=n.parse(s.linearMap(o,r,e,!0))):o=s.linearMap(i,e,r,!0),l[t]=i,a[t]=o}),{valueWindow:h(l),percentWindow:h(a)}},reset:function(t){if(t===this._dataZoomModel){this._dataExtent=n(this._dimName,this.getTargetSeriesModels());var e=this.calculateDataWindow(t.option);this._valueWindow=e.valueWindow,this._percentWindow=e.percentWindow,r(this)}},restore:function(t){t===this._dataZoomModel&&(this._valueWindow=this._percentWindow=null,r(this,!0))},filterData:function(t){function e(t){return t>=r[0]&&t<=r[1]}if(t===this._dataZoomModel){var i=this._dimName,n=this.getTargetSeriesModels(),o=t.get("filterMode"),r=this._valueWindow,a=this.getOtherAxisModel();t.get("$fromToolbox")&&a&&"category"===a.get("type")&&(o="empty"),u(n,function(t){var n=t.getData();n&&u(t.coordDimToDataDim(i),function(i){"empty"===o?t.setData(n.map(i,function(t){return e(t)?t:NaN})):n.filterSelf(i,e)})})}}},t.exports=c},function(t,e,i){t.exports=i(40).extend({type:"dataZoom.inside",defaultOption:{disabled:!1,zoomLock:!1}})},function(t,e,i){function n(t){var e=[0,100];return!(t[0]<=e[1])&&(t[0]=e[1]),!(t[1]<=e[1])&&(t[1]=e[1]),!(t[0]>=e[0])&&(t[0]=e[0]),!(t[1]>=e[0])&&(t[1]=e[0]),t}var o=i(41),r=i(1),a=i(85),s=i(189),l=r.bind,u=o.extend({type:"dataZoom.inside",init:function(t,e){this._range},render:function(t,e,i,n){u.superApply(this,"render",arguments),s.shouldRecordRange(n,t.id)&&(this._range=t.getPercentRange()),r.each(this.getTargetCoordInfo(),function(e,n){var o=r.map(e,function(t){return s.generateCoordId(t.model)});r.each(e,function(e){var r=e.model;s.register(i,{coordId:s.generateCoordId(r),allCoordIds:o,containsPoint:function(t,e){return r.coordinateSystem.containPoint([t,e])},dataZoomId:t.id,throttleRate:t.get("throttle",!0),panGetRange:l(this._onPan,this,e,n),zoomGetRange:l(this._onZoom,this,e,n)})},this)},this)},dispose:function(){s.unregister(this.api,this.dataZoomModel.id),u.superApply(this,"dispose",arguments),this._range=null},_onPan:function(t,e,i,n,o,r,s,l,u){if(this.dataZoomModel.option.disabled)return this._range;var c=this._range.slice(),d=t.axisModels[0];if(d){var f=h[e]([r,s],[l,u],d,i,t),p=f.signal*(c[1]-c[0])*f.pixel/f.pixelLength;return a(p,c,[0,100],"rigid"),this._range=c}},_onZoom:function(t,e,i,o,r,a){var s=this.dataZoomModel.option;if(s.disabled||s.zoomLock)return this._range;var l=this._range.slice(),u=t.axisModels[0];if(u){var c=h[e](null,[r,a],u,i,t),d=(c.pixel-c.pixelStart)/c.pixelLength*(l[1]-l[0])+l[0];return o=Math.max(1/o,0),l[0]=(l[0]-d)*o+d,l[1]=(l[1]-d)*o+d,this._range=n(l)}}}),h={grid:function(t,e,i,n,o){var r=i.axis,a={},s=o.model.coordinateSystem.getRect();return t=t||[0,0],"x"===r.dim?(a.pixel=e[0]-t[0],a.pixelLength=s.width,a.pixelStart=s.x,a.signal=r.inverse?1:-1):(a.pixel=e[1]-t[1],a.pixelLength=s.height,a.pixelStart=s.y,a.signal=r.inverse?-1:1),a},polar:function(t,e,i,n,o){var r=i.axis,a={},s=o.model.coordinateSystem,l=s.getRadiusAxis().getExtent(),u=s.getAngleAxis().getExtent();return t=t?s.pointToCoord(t):[0,0],e=s.pointToCoord(e),"radiusAxis"===i.mainType?(a.pixel=e[0]-t[0],a.pixelLength=l[1]-l[0],a.pixelStart=l[0],a.signal=r.inverse?1:-1):(a.pixel=e[1]-t[1],a.pixelLength=u[1]-u[0],a.pixelStart=u[0],a.signal=r.inverse?-1:1),a},singleAxis:function(t,e,i,n,o){var r=i.axis,a=o.model.coordinateSystem.getRect(),s={};return t=t||[0,0],"horizontal"===r.orient?(s.pixel=e[0]-t[0],s.pixelLength=a.width,s.pixelStart=a.x,s.signal=r.inverse?1:-1):(s.pixel=e[1]-t[1],s.pixelLength=a.height,s.pixelStart=a.y,s.signal=r.inverse?-1:1),s}};t.exports=u},function(t,e,i){var n=i(40);t.exports=n.extend({type:"dataZoom.select"})},function(t,e,i){t.exports=i(41).extend({type:"dataZoom.select"})},function(t,e,i){var n=i(40),o=n.extend({type:"dataZoom.slider",layoutMode:"box",defaultOption:{show:!0,right:"ph",top:"ph",width:"ph",height:"ph",left:null,bottom:null,backgroundColor:"rgba(47,69,84,0)",dataBackground:{lineStyle:{color:"#2f4554",width:.5,opacity:.3},areaStyle:{color:"rgba(47,69,84,0.3)",opacity:.3}},borderColor:"#ddd",fillerColor:"rgba(167,183,204,0.4)",handleIcon:"M8.2,13.6V3.9H6.3v9.7H3.1v14.9h3.3v9.7h1.8v-9.7h3.3V13.6H8.2z M9.7,24.4H4.8v-1.4h4.9V24.4z M9.7,19.1H4.8v-1.4h4.9V19.1z",handleSize:"100%",handleStyle:{color:"#a7b7cc"},labelPrecision:null,labelFormatter:null,showDetail:!0,showDataShadow:"auto",realtime:!0,zoomLock:!1,textStyle:{color:"#333"}}});t.exports=o},function(t,e,i){function n(t){var e={x:"y",y:"x",radius:"angle",angle:"radius"};return e[t]}var o=i(1),r=i(3),a=i(47),s=i(41),l=r.Rect,u=i(4),h=u.linearMap,c=i(12),d=i(85),f=u.asc,p=o.bind,g=o.each,m=7,v=1,y=30,x="horizontal",_="vertical",b=5,w=["line","bar","candlestick","scatter"],S=s.extend({type:"dataZoom.slider",init:function(t,e){this._displayables={},this._orient,this._range,this._handleEnds,this._size,this._handleWidth,this._handleHeight,this._location,this._dragging,this._dataShadowInfo,this.api=e},render:function(t,e,i,n){return S.superApply(this,"render",arguments),a.createOrUpdate(this,"_dispatchZoomAction",this.dataZoomModel.get("throttle"),"fixRate"),this._orient=t.get("orient"),this.dataZoomModel.get("show")===!1?void this.group.removeAll():(n&&"dataZoom"===n.type&&n.from===this.uid||this._buildView(),void this._updateView())},remove:function(){S.superApply(this,"remove",arguments),a.clear(this,"_dispatchZoomAction")},dispose:function(){S.superApply(this,"dispose",arguments),a.clear(this,"_dispatchZoomAction")},_buildView:function(){var t=this.group;t.removeAll(),this._resetLocation(),this._resetInterval();var e=this._displayables.barGroup=new r.Group;this._renderBackground(),this._renderHandle(),this._renderDataShadow(),t.add(e),this._positionGroup()},_resetLocation:function(){var t=this.dataZoomModel,e=this.api,i=this._findCoordRect(),n={width:e.getWidth(),height:e.getHeight()},r=this._orient===x?{right:n.width-i.x-i.width,top:n.height-y-m,width:i.width,height:y}:{right:m,top:i.y,width:y,height:i.height},a=c.getLayoutParams(t.option);o.each(["right","top","width","height"],function(t){"ph"===a[t]&&(a[t]=r[t])});var s=c.getLayoutRect(a,n,t.padding);this._location={x:s.x,y:s.y},this._size=[s.width,s.height],this._orient===_&&this._size.reverse()},_positionGroup:function(){var t=this.group,e=this._location,i=this._orient,n=this.dataZoomModel.getFirstTargetAxisModel(),o=n&&n.get("inverse"),r=this._displayables.barGroup,a=(this._dataShadowInfo||{}).otherAxisInverse;r.attr(i!==x||o?i===x&&o?{scale:a?[-1,1]:[-1,-1]}:i!==_||o?{scale:a?[-1,-1]:[-1,1],rotation:Math.PI/2}:{scale:a?[1,-1]:[1,1],rotation:Math.PI/2}:{scale:a?[1,1]:[1,-1]});var s=t.getBoundingRect([r]);t.attr("position",[e.x-s.x,e.y-s.y])},_getViewExtent:function(){return[0,this._size[0]]},_renderBackground:function(){var t=this.dataZoomModel,e=this._size;this._displayables.barGroup.add(new l({silent:!0,shape:{x:0,y:0,width:e[0],height:e[1]},style:{fill:t.get("backgroundColor")},z2:-40}))},_renderDataShadow:function(){var t=this._dataShadowInfo=this._prepareDataShadowInfo();if(t){var e=this._size,i=t.series,n=i.getRawData(),a=i.getShadowDim?i.getShadowDim():t.otherDim;if(null!=a){var s=n.getDataExtent(a),l=.3*(s[1]-s[0]);s=[s[0]-l,s[1]+l];var u,c=[0,e[1]],d=[0,e[0]],f=[[e[0],0],[0,0]],p=[],g=d[1]/(n.count()-1),m=0,v=Math.round(n.count()/e[0]);n.each([a],function(t,e){if(v>0&&e%v)return void(m+=g);var i=null==t||isNaN(t)||""===t,n=i?0:h(t,s,c,!0);i&&!u&&e?(f.push([f[f.length-1][0],0]),p.push([p[p.length-1][0],0])):!i&&u&&(f.push([m,0]),p.push([m,0])),f.push([m,n]),p.push([m,n]),m+=g,u=i});var y=this.dataZoomModel;this._displayables.barGroup.add(new r.Polygon({shape:{points:f},style:o.defaults({fill:y.get("dataBackgroundColor")},y.getModel("dataBackground.areaStyle").getAreaStyle()),silent:!0,z2:-20})),this._displayables.barGroup.add(new r.Polyline({shape:{points:p},style:y.getModel("dataBackground.lineStyle").getLineStyle(),silent:!0,z2:-19}))}}},_prepareDataShadowInfo:function(){var t=this.dataZoomModel,e=t.get("showDataShadow");if(e!==!1){var i,r=this.ecModel;return t.eachTargetAxis(function(a,s){var l=t.getAxisProxy(a.name,s).getTargetSeriesModels();o.each(l,function(t){if(!(i||e!==!0&&o.indexOf(w,t.get("type"))<0)){var l,u=r.getComponent(a.axis,s).axis,h=n(a.name),c=t.coordinateSystem;null!=h&&c.getOtherAxis&&(l=c.getOtherAxis(u).inverse),i={thisAxis:u,series:t,thisDim:a.name,otherDim:h,otherAxisInverse:l}}},this)},this),i}},_renderHandle:function(){var t=this._displayables,e=t.handles=[],i=t.handleLabels=[],n=this._displayables.barGroup,o=this._size,a=this.dataZoomModel;n.add(t.filler=new l({draggable:!0,cursor:"move",drift:p(this._onDragMove,this,"all"),ondragstart:p(this._showDataInfo,this,!0),ondragend:p(this._onDragEnd,this),onmouseover:p(this._showDataInfo,this,!0),onmouseout:p(this._showDataInfo,this,!1),style:{fill:a.get("fillerColor"),textPosition:"inside"}})),n.add(new l(r.subPixelOptimizeRect({silent:!0,shape:{x:0,y:0,width:o[0],height:o[1]},style:{stroke:a.get("dataBackgroundColor")||a.get("borderColor"),lineWidth:v,fill:"rgba(0,0,0,0)"}})));var s=a.get("handleIcon");g([0,1],function(t){var o=r.makePath(s,{style:{strokeNoScale:!0},rectHover:!0,cursor:"vertical"===this._orient?"ns-resize":"ew-resize",draggable:!0,drift:p(this._onDragMove,this,t),ondragend:p(this._onDragEnd,this),onmouseover:p(this._showDataInfo,this,!0),onmouseout:p(this._showDataInfo,this,!1)},{x:-.5,y:0,width:1,height:1},"center"),l=o.getBoundingRect();this._handleHeight=u.parsePercent(a.get("handleSize"),this._size[1]),this._handleWidth=l.width/l.height*this._handleHeight,o.setStyle(a.getModel("handleStyle").getItemStyle());var h=a.get("handleColor");null!=h&&(o.style.fill=h),n.add(e[t]=o);var c=a.textStyleModel;this.group.add(i[t]=new r.Text({silent:!0,invisible:!0,style:{x:0,y:0,text:"",textVerticalAlign:"middle",textAlign:"center",fill:c.getTextColor(),textFont:c.getFont()},z2:10}))},this)},_resetInterval:function(){var t=this._range=this.dataZoomModel.getPercentRange(),e=this._getViewExtent();this._handleEnds=[h(t[0],[0,100],e,!0),h(t[1],[0,100],e,!0)]},_updateInterval:function(t,e){var i=this._handleEnds,n=this._getViewExtent();d(e,i,n,"all"===t||this.dataZoomModel.get("zoomLock")?"rigid":"cross",t),this._range=f([h(i[0],n,[0,100],!0),h(i[1],n,[0,100],!0)])},_updateView:function(t){var e=this._displayables,i=this._handleEnds,n=f(i.slice()),o=this._size;g([0,1],function(t){var n=e.handles[t],r=this._handleHeight;n.attr({scale:[r,r],position:[i[t],o[1]/2-r/2]})},this),e.filler.setShape({x:n[0],y:0,width:n[1]-n[0],height:o[1]}),this._updateDataInfo(t)},_updateDataInfo:function(t){function e(t){var e=r.getTransform(n.handles[t].parent,this.group),i=r.transformDirection(0===t?"right":"left",e),l=this._handleWidth/2+b,u=r.applyTransform([d[t]+(0===t?-l:l),this._size[1]/2],e);o[t].setStyle({x:u[0],y:u[1],textVerticalAlign:a===x?"middle":i,textAlign:a===x?i:"center",text:s[t]})}var i=this.dataZoomModel,n=this._displayables,o=n.handleLabels,a=this._orient,s=["",""];if(i.get("showDetail")){var l=i.findRepresentativeAxisProxy();if(l){var u=l.getAxisModel().axis,h=this._range,c=t?l.calculateDataWindow({start:h[0],end:h[1]}).valueWindow:l.getDataValueWindow();s=[this._formatLabel(c[0],u),this._formatLabel(c[1],u)]}}var d=f(this._handleEnds.slice());e.call(this,0),e.call(this,1)},_formatLabel:function(t,e){var i=this.dataZoomModel,n=i.get("labelFormatter"),r=i.get("labelPrecision");null!=r&&"auto"!==r||(r=e.getPixelPrecision());var a=null==t||isNaN(t)?"":"category"===e.type||"time"===e.type?e.scale.getLabel(Math.round(t)):t.toFixed(Math.min(r,20));return o.isFunction(n)?n(t,a):o.isString(n)?n.replace("{value}",a):a},_showDataInfo:function(t){t=this._dragging||t;var e=this._displayables.handleLabels;e[0].attr("invisible",!t),e[1].attr("invisible",!t)},_onDragMove:function(t,e,i){this._dragging=!0;var n=this._applyBarTransform([e,i],!0);this._updateInterval(t,n[0]);var o=this.dataZoomModel.get("realtime");this._updateView(!o),o&&o&&this._dispatchZoomAction()},_onDragEnd:function(){this._dragging=!1,this._showDataInfo(!1),this._dispatchZoomAction()},_dispatchZoomAction:function(){var t=this._range;this.api.dispatchAction({type:"dataZoom",from:this.uid,dataZoomId:this.dataZoomModel.id,start:t[0],end:t[1]})},_applyBarTransform:function(t,e){var i=this._displayables.barGroup.getLocalTransform();return r.applyTransform(t,i,e)},_findCoordRect:function(){var t;if(g(this.getTargetCoordInfo(),function(e){if(!t&&e.length){var i=e[0].model.coordinateSystem;t=i.getRect&&i.getRect()}}),!t){var e=this.api.getWidth(),i=this.api.getHeight();t={x:.2*e,y:.2*i,width:.6*e,height:.6*i}}return t}});t.exports=S},function(t,e,i){function n(t){var e=t.getZr();return e[p]||(e[p]={})}function o(t,e,i){var n=new c(t.getZr());return n.enable(),n.on("pan",f(a,i)),n.on("zoom",f(s,i)),n}function r(t){h.each(t,function(e,i){e.count||(e.controller.dispose(),delete t[i])})}function a(t,e,i,n,o,r,a){l(t,function(s){return s.panGetRange(t.controller,e,i,n,o,r,a)})}function s(t,e,i,n){l(t,function(o){return o.zoomGetRange(t.controller,e,i,n)})}function l(t,e){var i=[];h.each(t.dataZoomInfos,function(t){var n=e(t);n&&i.push({dataZoomId:t.dataZoomId,start:n[0],end:n[1]})}),t.dispatchAction(i)}function u(t,e){t.dispatchAction({type:"dataZoom",batch:e})}var h=i(1),c=i(84),d=i(47),f=h.curry,p="\0_ec_dataZoom_roams",g={register:function(t,e){var i=n(t),a=e.dataZoomId,s=e.coordId;h.each(i,function(t,i){var n=t.dataZoomInfos;n[a]&&h.indexOf(e.allCoordIds,s)<0&&(delete n[a],t.count--)}),r(i);var l=i[s];l||(l=i[s]={coordId:s,dataZoomInfos:{},count:0},l.controller=o(t,e,l),l.dispatchAction=h.curry(u,t)),l.controller.setContainsPoint(e.containsPoint),d.createOrUpdate(l,"dispatchAction",e.throttleRate,"fixRate"),!l.dataZoomInfos[a]&&l.count++,l.dataZoomInfos[a]=e},unregister:function(t,e){var i=n(t);h.each(i,function(t){t.controller.dispose();var i=t.dataZoomInfos;i[e]&&(delete i[e],t.count--)}),r(i)},shouldRecordRange:function(t,e){if(t&&"dataZoom"===t.type&&t.batch)for(var i=0,n=t.batch.length;i=0;d--)null==o[d]?o.splice(d,1):delete o[d].$action},_flatten:function(t,e,i){l.each(t,function(t){if(t){i&&(t.parentOption=i),e.push(t);var n=t.children;"group"===t.type&&n&&this._flatten(n,e,t),delete t.children}},this)},useElOptionsToUpdate:function(){var t=this._elOptionsToUpdate;return this._elOptionsToUpdate=null,t}});s.extendComponentView({type:"graphic",init:function(t,e){this._elMap={},this._lastGraphicModel},render:function(t,e,i){t!==this._lastGraphicModel&&this._clear(),this._lastGraphicModel=t,this._updateElements(t,i),this._relocate(t,i)},_updateElements:function(t,e){var i=t.useElOptionsToUpdate();if(i){var a=this._elMap,s=this.group;l.each(i,function(t){var e=t.$action,i=t.id,u=a[i],h=t.parentId,c=null!=h?a[h]:s;t.hv&&t.hv[1]&&"text"===t.type&&(t.style=l.defaults({textBaseline:"middle"},t.style),t.style.textVerticalAlign=null);var d=r(t);e&&"merge"!==e?"replace"===e?(o(u,a),n(i,c,d,a)):"remove"===e&&o(u,a):u?u.attr(d):n(i,c,d,a),a[i]&&(a[i].__ecGraphicWidth=t.width,a[i].__ecGraphicHeight=t.height)})}},_relocate:function(t,e){for(var i=t.option.elements,n=this.group,o=this._elMap,r=i.length-1;r>=0;r--){var a=i[r],s=o[a.id];if(s){var l=s.parent,u=l===n?{width:e.getWidth(),height:e.getHeight()}:{width:l.__ecGraphicWidth||0,height:l.__ecGraphicHeight||0};c.positionElement(s,a,u,null,{hv:a.hv,boundingMode:a.bounding})}}},_clear:function(){var t=this._elMap;l.each(t,function(e){o(e,t)}),this._elMap={}},dispose:function(){this._clear()}})},function(t,e,i){i(193),i(195),i(194);var n=i(2);n.registerProcessor(i(196))},function(t,e,i){"use strict";var n=i(1),o=i(11),r=i(2).extendComponentModel({type:"legend",dependencies:["series"],layoutMode:{type:"box",ignoreSize:!0},init:function(t,e,i){this.mergeDefaultAndTheme(t,i),t.selected=t.selected||{}},mergeOption:function(t){r.superCall(this,"mergeOption",t)},optionUpdated:function(){this._updateData(this.ecModel);var t=this._data;if(t[0]&&"single"===this.get("selectedMode")){for(var e=!1,i=0;i=0},defaultOption:{zlevel:0,z:4,show:!0,orient:"horizontal",left:"center",top:"top",align:"auto",backgroundColor:"rgba(0,0,0,0)",borderColor:"#ccc",borderWidth:0,padding:5,itemGap:10,itemWidth:25,itemHeight:14,inactiveColor:"#ccc",textStyle:{color:"#333"},selectedMode:!0,tooltip:{show:!1}}});t.exports=r},function(t,e,i){function n(t,e){e.dispatchAction({type:"legendToggleSelect",name:t})}function o(t,e,i){var n=i.getZr().storage.getDisplayList()[0];n&&n.useHoverLayer||t.get("legendHoverLink")&&i.dispatchAction({type:"highlight",seriesName:t.name,name:e})}function r(t,e,i){var n=i.getZr().storage.getDisplayList()[0];n&&n.useHoverLayer||t.get("legendHoverLink")&&i.dispatchAction({type:"downplay",seriesName:t.name,name:e})}var a=i(1),s=i(24),l=i(3),u=i(118),h=a.curry;t.exports=i(2).extendComponentView({type:"legend",init:function(){this._symbolTypeStore={}},render:function(t,e,i){var s=this.group;if(s.removeAll(),t.get("show")){var c=t.get("selectedMode"),d=t.get("align");"auto"===d&&(d="right"===t.get("left")&&"vertical"===t.get("orient")?"right":"left");var f={};a.each(t.getData(),function(a){var u=a.get("name");if(""===u||"\n"===u)return void s.add(new l.Group({newline:!0}));var p=e.getSeriesByName(u)[0];if(!f[u])if(p){var g=p.getData(),m=g.getVisual("color");"function"==typeof m&&(m=m(p.getDataParams(0)));var v=g.getVisual("legendSymbol")||"roundRect",y=g.getVisual("symbol"),x=this._createItem(u,a,t,v,y,d,m,c);x.on("click",h(n,u,i)).on("mouseover",h(o,p,null,i)).on("mouseout",h(r,p,null,i)),f[u]=!0}else e.eachRawSeries(function(e){if(!f[u]&&e.legendDataProvider){var s=e.legendDataProvider(),l=s.indexOfName(u);if(l<0)return;var p=s.getItemVisual(l,"color"),g="roundRect",m=this._createItem(u,a,t,g,null,d,p,c);m.on("click",h(n,u,i)).on("mouseover",h(o,e,u,i)).on("mouseout",h(r,e,u,i)),f[u]=!0}},this)},this),u.layout(s,t,i),u.addBackground(s,t)}},_createItem:function(t,e,i,n,o,r,u,h){var c=i.get("itemWidth"),d=i.get("itemHeight"),f=i.get("inactiveColor"),p=i.isSelected(t),g=new l.Group,m=e.getModel("textStyle"),v=e.get("icon"),y=e.getModel("tooltip"),x=y.parentModel;if(n=v||n,g.add(s.createSymbol(n,0,0,c,d,p?u:f)),!v&&o&&(o!==n||"none"==o)){var _=.8*d;"none"===o&&(o="circle"),g.add(s.createSymbol(o,(c-_)/2,(d-_)/2,_,_,p?u:f))}var b="left"===r?c+5:-5,w=r,S=i.get("formatter"),M=t;"string"==typeof S&&S?M=S.replace("{name}",null!=t?t:""):"function"==typeof S&&(M=S(t));var I=new l.Text({style:{text:M,x:b,y:d/2,fill:p?m.getTextColor():f,textFont:m.getFont(),textAlign:w,textVerticalAlign:"middle"}});g.add(I);var T=new l.Rect({shape:g.getBoundingRect(),invisible:!0,tooltip:y.get("show")?a.extend({content:t,formatter:x.get("formatter",!0)||function(){return t},formatterParams:{componentType:"legend",legendIndex:i.componentIndex,name:t,$vars:["name"]}},y.option):null});return g.add(T),g.eachChild(function(t){t.silent=!0}),T.silent=!h,this.group.add(g),l.setHoverStyle(g),g}})},function(t,e,i){function n(t,e,i){var n,o={},a="toggleSelected"===t;return i.eachComponent("legend",function(i){a&&null!=n?i[n?"select":"unSelect"](e.name):(i[t](e.name),n=i.isSelected(e.name));var s=i.getData();r.each(s,function(t){var e=t.get("name");if("\n"!==e&&""!==e){var n=i.isSelected(e);e in o?o[e]=o[e]&&n:o[e]=n}})}),{name:e.name,selected:o}}var o=i(2),r=i(1);o.registerAction("legendToggleSelect","legendselectchanged",r.curry(n,"toggleSelected")),o.registerAction("legendSelect","legendselected",r.curry(n,"select")),o.registerAction("legendUnSelect","legendunselected",r.curry(n,"unSelect"))},function(t,e){t.exports=function(t){var e=t.findComponents({mainType:"legend"});e&&e.length&&t.filterSeries(function(t){for(var i=0;i=0&&"number"==typeof u&&(u=+u.toFixed(m)),p.coord[d]=g.coord[d]=u,n=[p,g,{type:r,valueIndex:n.valueIndex,value:u}]}return n=[c.dataTransform(t,n[0]),c.dataTransform(t,n[1]),l.extend({},n[2])],n[2].type=n[2].type||"",l.merge(n[2],n[0]),l.merge(n[2],n[1]),n};i(71).extend({type:"markLine",updateLayout:function(t,e,i){e.eachSeries(function(t){var e=t.markLineModel;if(e){var n=e.getData(),o=e.__from,r=e.__to;o.each(function(e){a(o,e,!0,t,i),a(r,e,!1,t,i)}),n.each(function(t){n.setItemLayout(t,[o.getItemLayout(t),r.getItemLayout(t)])}),this.markerGroupMap[t.name].updateLayout()}},this)},renderSeries:function(t,e,i,n){function o(e,i,o){var r=e.getItemModel(i);a(e,i,o,t,n),e.setItemVisual(i,{symbolSize:r.get("symbolSize")||x[o?0:1],symbol:r.get("symbol",!0)||y[o?0:1],color:r.get("itemStyle.normal.color")||h.getVisual("color")})}var r=t.coordinateSystem,u=t.name,h=t.getData(),c=this.markerGroupMap,f=c[u];f||(f=c[u]=new d),this.group.add(f.group);var p=s(r,t,e),g=p.from,m=p.to,v=p.line;e.__from=g,e.__to=m,e.setData(v);var y=e.get("symbol"),x=e.get("symbolSize");l.isArray(y)||(y=[y,y]),"number"==typeof x&&(x=[x,x]),p.from.each(function(t){o(g,t,!0),o(m,t,!1)}),v.each(function(t){var e=v.getItemModel(t).get("lineStyle.normal.color");v.setItemVisual(t,{color:e||g.getItemVisual(t,"color")}),v.setItemLayout(t,[g.getItemLayout(t),m.getItemLayout(t)]),v.setItemVisual(t,{fromSymbolSize:g.getItemVisual(t,"symbolSize"),fromSymbol:g.getItemVisual(t,"symbol"),toSymbolSize:m.getItemVisual(t,"symbolSize"),toSymbol:m.getItemVisual(t,"symbol")})}),f.updateData(v),p.line.eachItemGraphicEl(function(t,i){t.traverse(function(t){t.dataModel=e})}),f.__keep=!0,f.group.silent=e.get("silent")||t.get("silent")}})},function(t,e,i){t.exports=i(70).extend({type:"markPoint",defaultOption:{zlevel:0,z:5,symbol:"pin",symbolSize:50,tooltip:{trigger:"item"},label:{normal:{show:!0,position:"inside"},emphasis:{show:!0}},itemStyle:{normal:{borderWidth:2}}}})},function(t,e,i){function n(t,e,i){var n=e.coordinateSystem;t.each(function(o){var r,a=t.getItemModel(o),l=s.parsePercent(a.get("x"),i.getWidth()),u=s.parsePercent(a.get("y"),i.getHeight());if(isNaN(l)||isNaN(u)){if(e.getMarkerPosition)r=e.getMarkerPosition(t.getValues(t.dimensions,o));else if(n){var h=t.get(n.dimensions[0],o),c=t.get(n.dimensions[1],o);r=n.dataToPoint([h,c])}}else r=[l,u];isNaN(l)||(r[0]=l),isNaN(u)||(r[1]=u),t.setItemLayout(o,r)})}function o(t,e,i){var n;n=t?a.map(t&&t.dimensions,function(t){var i=e.getData().getDimensionInfo(e.coordDimToDataDim(t)[0])||{};return i.name=t,i}):[{name:"value",type:"float"}];var o=new l(n,i),r=a.map(i.get("data"),a.curry(u.dataTransform,e));return t&&(r=a.filter(r,a.curry(u.dataFilter,t))),o.initData(r,null,t?u.dimValueGetter:function(t){return t.value}),o}var r=i(39),a=i(1),s=i(4),l=i(14),u=i(72);i(71).extend({type:"markPoint",updateLayout:function(t,e,i){e.eachSeries(function(t){var e=t.markPointModel;e&&(n(e.getData(),t,i),this.markerGroupMap[t.name].updateLayout(e))},this)},renderSeries:function(t,e,i,a){var s=t.coordinateSystem,l=t.name,u=t.getData(),h=this.markerGroupMap,c=h[l];c||(c=h[l]=new r);var d=o(s,t,e);e.setData(d),n(e.getData(),t,a),d.each(function(t){var i=d.getItemModel(t),n=i.getShallow("symbolSize");"function"==typeof n&&(n=n(e.getRawValue(t),e.getDataParams(t))),d.setItemVisual(t,{symbolSize:n,color:i.get("itemStyle.normal.color")||u.getVisual("color"),symbol:i.getShallow("symbol")})}),c.updateData(d),this.group.add(c.group),d.eachItemGraphicEl(function(t){t.traverse(function(t){t.dataModel=e})}),c.__keep=!0,c.group.silent=e.get("silent")||t.get("silent")}})},function(t,e,i){"use strict";var n=i(2),o=i(3),r=i(12);n.extendComponentModel({type:"title",layoutMode:{type:"box",ignoreSize:!0},defaultOption:{zlevel:0,z:6,show:!0,text:"",target:"blank",subtext:"",subtarget:"blank",left:0,top:0,backgroundColor:"rgba(0,0,0,0)",borderColor:"#ccc",borderWidth:0,padding:5,itemGap:10,textStyle:{fontSize:18,fontWeight:"bolder",color:"#333"},subtextStyle:{color:"#aaa"}}}),n.extendComponentView({type:"title",render:function(t,e,i){if(this.group.removeAll(),t.get("show")){var n=this.group,a=t.getModel("textStyle"),s=t.getModel("subtextStyle"),l=t.get("textAlign"),u=t.get("textBaseline"),h=new o.Text({style:{text:t.get("text"),textFont:a.getFont(),fill:a.getTextColor()},z2:10}),c=h.getBoundingRect(),d=t.get("subtext"),f=new o.Text({style:{text:d,textFont:s.getFont(),fill:s.getTextColor(),y:c.height+t.get("itemGap"),textBaseline:"top"},z2:10}),p=t.get("link"),g=t.get("sublink");h.silent=!p,f.silent=!g,p&&h.on("click",function(){window.open(p,"_"+t.get("target"))}),g&&f.on("click",function(){window.open(g,"_"+t.get("subtarget"))}),n.add(h),d&&n.add(f);var m=n.getBoundingRect(),v=t.getBoxLayoutParams();v.width=m.width,v.height=m.height;var y=r.getLayoutRect(v,{width:i.getWidth(),height:i.getHeight()},t.get("padding"));l||(l=t.get("left")||t.get("right"),"middle"===l&&(l="center"),"right"===l?y.x+=y.width:"center"===l&&(y.x+=y.width/2)),u||(u=t.get("top")||t.get("bottom"),"center"===u&&(u="middle"),"bottom"===u?y.y+=y.height:"middle"===u&&(y.y+=y.height/2),u=u||"top"),n.attr("position",[y.x,y.y]);var x={textAlign:l,textVerticalAlign:u};h.setStyle(x),f.setStyle(x),m=n.getBoundingRect();var _=y.margin,b=t.getItemStyle(["color","opacity"]);b.fill=t.get("backgroundColor");var w=new o.Rect({shape:{x:m.x-_[3],y:m.y-_[0],width:m.width+_[1]+_[3],height:m.height+_[0]+_[2]},style:b,silent:!0});o.subPixelOptimizeRect(w),n.add(w)}}})},function(t,e,i){i(208),i(209),i(214),i(212),i(210),i(211),i(213)},function(t,e,i){var n=i(26),o=i(1),r=i(2).extendComponentModel({type:"toolbox",layoutMode:{type:"box",ignoreSize:!0},mergeDefaultAndTheme:function(t){r.superApply(this,"mergeDefaultAndTheme",arguments),o.each(this.option.feature,function(t,e){var i=n.get(e);i&&o.merge(t,i.defaultOption)})},defaultOption:{show:!0,z:6,zlevel:0,orient:"horizontal",left:"right",top:"top",backgroundColor:"transparent",borderColor:"#ccc",borderWidth:0,padding:5,itemSize:15,itemGap:8,showTitle:!0,iconStyle:{normal:{borderColor:"#666",color:"none"},emphasis:{borderColor:"#3E98C5"}}}});t.exports=r},function(t,e,i){(function(e){function n(t){return 0===t.indexOf("my")}var o=i(26),r=i(1),a=i(3),s=i(11),l=i(43),u=i(118),h=i(17);t.exports=i(2).extendComponentView({type:"toolbox",render:function(t,e,i,c){function d(r,a){var l,u=y[r],h=y[a],d=m[u],p=new s(d,t,t.ecModel);if(u&&!h){if(n(u))l={model:p,onclick:p.option.onclick,featureName:u};else{var g=o.get(u);if(!g)return;l=new g(p,e,i)}v[u]=l}else{if(l=v[h],!l)return;l.model=p,l.ecModel=e,l.api=i}return!u&&h?void(l.dispose&&l.dispose(e,i)):!p.get("show")||l.unusable?void(l.remove&&l.remove(e,i)):(f(p,l,u),p.setIconStatus=function(t,e){var i=this.option,n=this.iconPaths;i.iconStatus=i.iconStatus||{},i.iconStatus[t]=e,n[t]&&n[t].trigger(e)},void(l.render&&l.render(p,e,i,c)))}function f(n,o,s){var l=n.getModel("iconStyle"),u=o.getIcons?o.getIcons():n.get("icon"),h=n.get("title")||{};if("string"==typeof u){var c=u,d=h;u={},h={},u[s]=c,h[s]=d}var f=n.iconPaths={};r.each(u,function(s,u){var c=l.getModel("normal").getItemStyle(),d=l.getModel("emphasis").getItemStyle(),m={x:-g/2,y:-g/2,width:g,height:g},v=0===s.indexOf("image://")?(m.image=s.slice(8),new a.Image({style:m})):a.makePath(s.replace("path://",""),{style:c,hoverStyle:d,rectHover:!0},m,"center");a.setHoverStyle(v),t.get("showTitle")&&(v.__title=h[u],v.on("mouseover",function(){var t=l.getModel("emphasis").getItemStyle();v.setStyle({text:h[u],textPosition:t.textPosition||"bottom",textFill:t.fill||t.stroke||"#000",textAlign:t.textAlign||"center"})}).on("mouseout",function(){v.setStyle({textFill:null})})),v.trigger(n.get("iconStatus."+u)||"normal"),p.add(v),v.on("click",r.bind(o.onclick,o,e,i,u)),f[u]=v})}var p=this.group;if(p.removeAll(),t.get("show")){var g=+t.get("itemSize"),m=t.get("feature")||{},v=this._features||(this._features={}),y=[];r.each(m,function(t,e){y.push(e)}),new l(this._featureNames||[],y).add(d).update(d).remove(r.curry(d,null)).execute(),this._featureNames=y,u.layout(p,t,i),u.addBackground(p,t),p.eachChild(function(t){var e=t.__title,n=t.hoverStyle;if(n&&e){var o=h.getBoundingRect(e,n.font),r=t.position[0]+p.position[0],a=t.position[1]+p.position[1]+g,s=!1;a+o.height>i.getHeight()&&(n.textPosition="top",s=!0);var l=s?-5-o.height:g+8;r+o.width/2>i.getWidth()?(n.textPosition=["100%",l],n.textAlign="right"):r-o.width/2<0&&(n.textPosition=[0,l],n.textAlign="left")}})}},updateView:function(t,e,i,n){r.each(this._features,function(t){t.updateView&&t.updateView(t.model,e,i,n)})},updateLayout:function(t,e,i,n){r.each(this._features,function(t){t.updateLayout&&t.updateLayout(t.model,e,i,n)})},remove:function(t,e){r.each(this._features,function(i){i.remove&&i.remove(t,e)}),this.group.removeAll()},dispose:function(t,e){r.each(this._features,function(i){i.dispose&&i.dispose(t,e)})}})}).call(e,i(175))},function(t,e,i){function n(t){var e={},i=[],n=[];return t.eachRawSeries(function(t){var o=t.coordinateSystem;if(!o||"cartesian2d"!==o.type&&"polar"!==o.type)i.push(t);else{var r=o.getBaseAxis();if("category"===r.type){var a=r.dim+"_"+r.index;e[a]||(e[a]={categoryAxis:r,valueAxis:o.getOtherAxis(r),series:[]},n.push({axisDim:r.dim,axisIndex:r.index})),e[a].series.push(t)}else i.push(t)}}),{seriesGroupByCategoryAxis:e,other:i,meta:n}}function o(t){var e=[];return p.each(t,function(t,i){var n=t.categoryAxis,o=t.valueAxis,r=o.dim,a=[" "].concat(p.map(t.series,function(t){return t.name})),s=[n.model.getCategories()];p.each(t.series,function(t){s.push(t.getRawData().mapArray(r,function(t){return t}))});for(var l=[a.join(v)],u=0;u=0)return!0}function u(t){for(var e=t.split(/\n+/g),i=s(e.shift()).split(y),n=[],o=p.map(i,function(t){return{name:t,data:[]}}),r=0;r1?"emphasis":"normal")}function a(t,e,i,n){var r=i._isZoomActive;n&&"takeGlobalCursor"===n.type&&(r="dataZoomSelect"===n.key&&n.dataZoomSelectActive),i._isZoomActive=r,t.setIconStatus("zoom",r?"emphasis":"normal");var a=u.makeCoordInfoList(o(t.option),e),s=a.xAxisHas&&!a.yAxisHas?"lineX":!a.xAxisHas&&a.yAxisHas?"lineY":"rect";i._brushController.setPanels(u.makePanelOpts(a)).enableBrush(!!r&&{brushType:s,brushStyle:{lineWidth:0,fill:"rgba(0,0,0,0.2)"}})}var s=i(1),l=i(115),u=i(116),h=i(113),c=s.each;i(190);var d="\0_ec_\0toolbox-dataZoom_";n.defaultOption={show:!0,icon:{zoom:"M0,13.5h26.9 M13.5,26.9V0 M32.1,13.5H58V58H13.5 V32.1",back:"M22,1.4L9.9,13.5l12.3,12.3 M10.3,13.5H54.9v44.6 H10.3v-26"},title:{zoom:"区域缩放",back:"区域缩放还原"}};var f=n.prototype;f.render=function(t,e,i,n){this.model=t,this.ecModel=e,this.api=i,a(t,e,this,n),r(t,e)},f.onclick=function(t,e,i){p[i].call(this)},f.remove=function(t,e){this._brushController.unmount()},f.dispose=function(t,e){this._brushController.dispose()};var p={zoom:function(){var t=!this._isZoomActive;this.api.dispatchAction({type:"takeGlobalCursor",key:"dataZoomSelect",dataZoomSelectActive:t})},back:function(){this._dispatchZoomAction(h.pop(this.ecModel))}};f._onBrush=function(t,e){function i(t,e,i){var o=n(t,i[t],a);o&&(r[o.id]={dataZoomId:o.id,startValue:e[0],endValue:e[1]})}function n(t,e,i){var n;return i.eachComponent({mainType:"dataZoom",subType:"select"},function(o,r){var a=o.get(t+"Index");null!=a&&i.getComponent(t,a)===e&&(n=o)}),n}if(e.isEnd&&t.length){var r={},a=this.ecModel;this._brushController.updateCovers([]);var s=u.makeCoordInfoList(o(this.model.option),a),l=[];u.parseOutputRanges(t,s,a,l);var c=t[0],d=l[0],f=c.coordRange,p=c.brushType;if(d&&f)if("rect"===p)i("xAxis",f[0],d),i("yAxis",f[1],d);else{var g={lineX:"xAxis",lineY:"yAxis"};i(g[p],f,d)}h.push(a,r),this._dispatchZoomAction(r)}},f._dispatchZoomAction=function(t){var e=[];c(t,function(t,i){e.push(s.clone(t))}),e.length&&this.api.dispatchAction({type:"dataZoom",from:this.uid,batch:e})},i(26).register("dataZoom",n),i(2).registerPreprocessor(function(t){function e(t,e){if(e){var o=t+"Index",r=e[o];null==r||"all"==r||s.isArray(r)||(r=r===!1||"none"===r?[]:[r]),i(t,function(e,i){if(null==r||"all"==r||s.indexOf(r,i)!==-1){var a={type:"select",$fromToolbox:!0,id:d+t+i};a[o]=i,n.push(a)}})}}function i(e,i){var n=t[e];s.isArray(n)||(n=n?[n]:[]),c(n,i)}if(t){var n=t.dataZoom||(t.dataZoom=[]);s.isArray(n)||(t.dataZoom=n=[n]);var o=t.toolbox;if(o&&(s.isArray(o)&&(o=o[0]),o&&o.feature)){var r=o.feature.dataZoom;e("xAxis",r),e("yAxis",r)}}}),t.exports=n},function(t,e,i){"use strict";function n(t){this.model=t}var o=i(1);n.defaultOption={show:!0,type:[],icon:{line:"M4.1,28.9h7.1l9.3-22l7.4,38l9.7-19.7l3,12.8h14.9M4.1,58h51.4",bar:"M6.7,22.9h10V48h-10V22.9zM24.9,13h10v35h-10V13zM43.2,2h10v46h-10V2zM3.1,58h53.7",stack:"M8.2,38.4l-8.4,4.1l30.6,15.3L60,42.5l-8.1-4.1l-21.5,11L8.2,38.4z M51.9,30l-8.1,4.2l-13.4,6.9l-13.9-6.9L8.2,30l-8.4,4.2l8.4,4.2l22.2,11l21.5-11l8.1-4.2L51.9,30z M51.9,21.7l-8.1,4.2L35.7,30l-5.3,2.8L24.9,30l-8.4-4.1l-8.3-4.2l-8.4,4.2L8.2,30l8.3,4.2l13.9,6.9l13.4-6.9l8.1-4.2l8.1-4.1L51.9,21.7zM30.4,2.2L-0.2,17.5l8.4,4.1l8.3,4.2l8.4,4.2l5.5,2.7l5.3-2.7l8.1-4.2l8.1-4.2l8.1-4.1L30.4,2.2z",tiled:"M2.3,2.2h22.8V25H2.3V2.2z M35,2.2h22.8V25H35V2.2zM2.3,35h22.8v22.8H2.3V35z M35,35h22.8v22.8H35V35z"},title:{line:"切换为折线图",bar:"切换为柱状图",stack:"切换为堆叠",tiled:"切换为平铺"},option:{},seriesIndex:{}};var r=n.prototype;r.getIcons=function(){var t=this.model,e=t.get("icon"),i={};return o.each(t.get("type"),function(t){e[t]&&(i[t]=e[t])}),i};var a={line:function(t,e,i,n){if("bar"===t)return o.merge({id:e,type:"line",data:i.get("data"),stack:i.get("stack"),markPoint:i.get("markPoint"),markLine:i.get("markLine")},n.get("option.line")||{},!0)},bar:function(t,e,i,n){if("line"===t)return o.merge({id:e,type:"bar",data:i.get("data"),stack:i.get("stack"),markPoint:i.get("markPoint"),markLine:i.get("markLine")},n.get("option.bar")||{},!0)},stack:function(t,e,i,n){if("line"===t||"bar"===t)return o.merge({id:e,stack:"__ec_magicType_stack__"},n.get("option.stack")||{},!0)},tiled:function(t,e,i,n){if("line"===t||"bar"===t)return o.merge({id:e,stack:""},n.get("option.tiled")||{},!0)}},s=[["line","bar"],["stack","tiled"]];r.onclick=function(t,e,i){var n=this.model,r=n.get("seriesIndex."+i);if(a[i]){var l={series:[]},u=function(e){var r=e.subType,s=e.id,u=a[i](r,s,e,n);u&&(o.defaults(u,e.option),l.series.push(u));var h=e.coordinateSystem;if(h&&"cartesian2d"===h.type&&("line"===i||"bar"===i)){var c=h.getAxesByScale("ordinal")[0];if(c){var d=c.dim,f=d+"Axis",p=t.queryComponents({mainType:f,index:e.get(name+"Index"),id:e.get(name+"Id")})[0],g=p.componentIndex;l[f]=l[f]||[];for(var m=0;m<=g;m++)l[f][g]=l[f][g]||{};l[f][g].boundaryGap="bar"===i}}};o.each(s,function(t){o.indexOf(t,i)>=0&&o.each(t,function(t){n.setIconStatus(t,"normal")})}),n.setIconStatus(i,"emphasis"),t.eachComponent({mainType:"series",query:null==r?null:{seriesIndex:r}},u),e.dispatchAction({type:"changeMagicType",currentType:i,newOption:l})}};var l=i(2);l.registerAction({type:"changeMagicType",event:"magicTypeChanged",update:"prepareAndUpdate"},function(t,e){e.mergeOption(t.newOption)}),i(26).register("magicType",n),t.exports=n},function(t,e,i){"use strict";function n(t){this.model=t}var o=i(113);n.defaultOption={show:!0,icon:"M3.8,33.4 M47,18.9h9.8V8.7 M56.3,20.1 C52.1,9,40.5,0.6,26.8,2.1C12.6,3.7,1.6,16.2,2.1,30.6 M13,41.1H3.1v10.2 M3.7,39.9c4.2,11.1,15.8,19.5,29.5,18 c14.2-1.6,25.2-14.1,24.7-28.5",title:"还原"};var r=n.prototype;r.onclick=function(t,e,i){o.clear(t),e.dispatchAction({type:"restore",from:this.uid})},i(26).register("restore",n),i(2).registerAction({type:"restore",event:"restore",update:"prepareAndUpdate"},function(t,e){e.resetOption("recreate")}),t.exports=n},function(t,e,i){function n(t){this.model=t}var o=i(10);n.defaultOption={show:!0,icon:"M4.7,22.9L29.3,45.5L54.7,23.4M4.6,43.6L4.6,58L53.8,58L53.8,43.6M29.2,45.1L29.2,0",title:"保存为图片",type:"png",name:"",excludeComponents:["toolbox"],pixelRatio:1,lang:["右键另存为图片"]},n.prototype.unusable=!o.canvasSupported;var r=n.prototype;r.onclick=function(t,e){var i=this.model,n=i.get("name")||t.get("title.0.text")||"echarts",r=document.createElement("a"),a=i.get("type",!0)||"png";r.download=n+"."+a,r.target="_blank";var s=e.getConnectedDataURL({type:a,backgroundColor:i.get("backgroundColor",!0)||t.get("backgroundColor")||"#fff",excludeComponents:i.get("excludeComponents"),pixelRatio:i.get("pixelRatio")});if(r.href=s,"function"!=typeof MouseEvent||o.browser.ie||o.browser.edge){var l=i.get("lang"),u='',h=window.open();h.document.write(u)}else{var c=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!1});r.dispatchEvent(c)}},i(26).register("saveAsImage",n),t.exports=n},function(t,e,i){i(217),i(218),i(2).registerAction({type:"showTip",event:"showTip",update:"tooltip:manuallyShowTip"},function(){}),i(2).registerAction({type:"hideTip",event:"hideTip",update:"tooltip:manuallyHideTip"},function(){})},function(t,e,i){function n(t){var e="cubic-bezier(0.23, 1, 0.32, 1)",i="left "+t+"s "+e+",top "+t+"s "+e;return s.map(p,function(t){return t+"transition:"+i}).join(";")}function o(t){var e=[],i=t.get("fontSize"),n=t.getTextColor();return n&&e.push("color:"+n),e.push("font:"+t.getFont()),i&&e.push("line-height:"+Math.round(3*i/2)+"px"),c(["decoration","align"],function(i){var n=t.get(i);n&&e.push("text-"+i+":"+n)}),e.join(";")}function r(t){t=t;var e=[],i=t.get("transitionDuration"),r=t.get("backgroundColor"),a=t.getModel("textStyle"),s=t.get("padding");return i&&e.push(n(i)),r&&(f.canvasSupported?e.push("background-Color:"+r):(e.push("background-Color:#"+l.toHex(r)),e.push("filter:alpha(opacity=70)"))),c(["width","color","radius"],function(i){var n="border-"+i,o=d(n),r=t.get(o);null!=r&&e.push(n+":"+r+("color"===i?"":"px"))}),e.push(o(a)),null!=s&&e.push("padding:"+h.normalizeCssArray(s).join("px ")+"px"),e.join(";")+";"}function a(t,e){var i=document.createElement("div"),n=e.getZr();this.el=i,this._x=e.getWidth()/2,this._y=e.getHeight()/2,t.appendChild(i),this._container=t,this._show=!1,this._hideTimeout;var o=this;i.onmouseenter=function(){o.enterable&&(clearTimeout(o._hideTimeout),o._show=!0),o._inContent=!0},i.onmousemove=function(e){if(e=e||window.event,!o.enterable){var i=n.handler;u.normalizeEvent(t,e,!0),i.dispatch("mousemove",e)}},i.onmouseleave=function(){o.enterable&&o._show&&o.hideLater(o._hideDelay),o._inContent=!1}}var s=i(1),l=i(19),u=i(25),h=i(8),c=s.each,d=h.toCamelCase,f=i(10),p=["","-webkit-","-moz-","-o-"],g="position:absolute;display:block;border-style:solid;white-space:nowrap;z-index:9999999;";a.prototype={constructor:a,enterable:!0,update:function(){var t=this._container,e=t.currentStyle||document.defaultView.getComputedStyle(t),i=t.style;"absolute"!==i.position&&"absolute"!==e.position&&(i.position="relative")},show:function(t){clearTimeout(this._hideTimeout);var e=this.el;e.style.cssText=g+r(t)+";left:"+this._x+"px;top:"+this._y+"px;"+(t.get("extraCssText")||""),e.style.display=e.innerHTML?"block":"none",this._show=!0},setContent:function(t){var e=this.el;e.innerHTML=t,e.style.display=t?"block":"none"},moveTo:function(t,e){var i=this.el.style;i.left=t+"px",i.top=e+"px",this._x=t,this._y=e},hide:function(){this.el.style.display="none",this._show=!1},hideLater:function(t){!this._show||this._inContent&&this.enterable||(t?(this._hideDelay=t,this._show=!1,this._hideTimeout=setTimeout(s.bind(this.hide,this),t)):this.hide())},isShow:function(){return this._show}},t.exports=a},function(t,e,i){i(2).extendComponentModel({type:"tooltip",defaultOption:{zlevel:0,z:8,show:!0,showContent:!0,trigger:"item",triggerOn:"mousemove",alwaysShowContent:!1,confine:!1,showDelay:0,hideDelay:100,transitionDuration:.4,enterable:!1,backgroundColor:"rgba(50,50,50,0.7)",borderColor:"#333",borderRadius:4,borderWidth:0,padding:5,extraCssText:"",axisPointer:{type:"line",axis:"auto",animation:!0,animationDurationUpdate:200,animationEasingUpdate:"exponentialOut",lineStyle:{color:"#555",width:1,type:"solid"},crossStyle:{color:"#555",width:1,type:"dashed",textStyle:{}},shadowStyle:{color:"rgba(150,150,150,0.3)"}},textStyle:{color:"#fff",fontSize:14}}})},function(t,e,i){function n(t,e){if(!t||!e)return!1;var i=m.round;return i(t[0])===i(e[0])&&i(t[1])===i(e[1])}function o(t,e,i,n){return{x1:t,y1:e,x2:i,y2:n}}function r(t,e,i,n){return{x:t,y:e,width:i,height:n}}function a(t,e,i,n,o,r){return{cx:t,cy:e,r0:i,r:n,startAngle:o,endAngle:r,clockwise:!0}}function s(t,e,i,n,o){var r=i.clientWidth,a=i.clientHeight,s=20;return t+r+s>n?t-=r+s:t+=s,e+a+s>o?e-=a+s:e+=s,[t,e]}function l(t,e,i,n,o){var r=i.clientWidth,a=i.clientHeight;return t=Math.min(t+r,n)-r,e=Math.min(e+a,o)-a,t=Math.max(t,0),e=Math.max(e,0),[t,e]}function u(t,e,i){var n=i.clientWidth,o=i.clientHeight,r=5,a=0,s=0,l=e.width,u=e.height;switch(t){case"inside":a=e.x+l/2-n/2,s=e.y+u/2-o/2;break;case"top":a=e.x+l/2-n/2,s=e.y-o-r;break;case"bottom":a=e.x+l/2-n/2,s=e.y+u+r;break;case"left":a=e.x-n-r,s=e.y+u/2-o/2;break;case"right":a=e.x+l+r,s=e.y+u/2-o/2}return[a,s]}function h(t,e,i,n,o,r,a,h){var c=h.getWidth(),d=h.getHeight(),f=a&&a.getBoundingRect().clone();if(a&&f.applyTransform(a.transform),"function"==typeof t&&(t=t([e,i],r,o.el,f)),p.isArray(t))e=y(t[0],c),i=y(t[1],d);else if("string"==typeof t&&a){var g=u(t,f,o.el);e=g[0],i=g[1]}else{var g=s(e,i,o.el,c,d);e=g[0],i=g[1]}if(n){var g=l(e,i,o.el,c,d);e=g[0],i=g[1]}o.moveTo(e,i)}function c(t){var e=t.coordinateSystem,i=t.get("tooltip.trigger",!0);return!(!e||"cartesian2d"!==e.type&&"polar"!==e.type&&"singleAxis"!==e.type||"item"===i)}var d=i(216),f=i(3),p=i(1),g=i(8),m=i(4),v=i(6),y=m.parsePercent,x=i(10),_=i(11);i(2).extendComponentView({type:"tooltip",_axisPointers:{},init:function(t,e){if(!x.node){var i=new d(e.getDom(),e);this._tooltipContent=i}},render:function(t,e,i){if(!x.node){this.group.removeAll(),this._axisPointers={},this._tooltipModel=t,this._ecModel=e,this._api=i,this._lastHover={};var n=this._tooltipContent;n.update(),n.enterable=t.get("enterable"),this._alwaysShowContent=t.get("alwaysShowContent"),this._seriesGroupByAxis=this._prepareAxisTriggerData(t,e);var o=this._crossText;o&&this.group.add(o);var r=t.get("triggerOn");if(null!=this._lastX&&null!=this._lastY&&"none"!==r){var a=this;clearTimeout(this._refreshUpdateTimeout),this._refreshUpdateTimeout=setTimeout(function(){a.manuallyShowTip(t,e,i,{x:a._lastX,y:a._lastY})})}var s=this._api.getZr();s.off("click",this._tryShow),s.off("mousemove",this._mousemove),s.off("mouseout",this._hide),s.off("globalout",this._hide),"click"===r?s.on("click",this._tryShow,this):"mousemove"===r&&(s.on("mousemove",this._mousemove,this),s.on("mouseout",this._hide,this),s.on("globalout",this._hide,this))}},_mousemove:function(t){var e=this._tooltipModel.get("showDelay"),i=this;clearTimeout(this._showTimeout),e>0?this._showTimeout=setTimeout(function(){i._tryShow(t)},e):this._tryShow(t)},manuallyShowTip:function(t,e,i,n){function o(t){var e=t.getData(),i=v.queryDataIndex(e,n);if(null!=i&&!p.isArray(i)&&e.hasValue(i))return!0}if(n.from!==this.uid){var e=this._ecModel,r=n.seriesIndex,a=e.getSeriesByIndex(r),i=this._api,s="axis"===this._tooltipModel.get("trigger");if(null==n.x||null==n.y){if(s?(a&&!o(a)&&(a=null),a||e.eachSeries(function(t){c(t)&&!a&&o(t)&&(a=t)})):a=a||e.getSeriesByIndex(0),a){var l=a.getData(),u=v.queryDataIndex(l,n);if(null==u||p.isArray(u))return;var h,d,f=l.getItemGraphicEl(u),g=a.coordinateSystem;if(a.getTooltipPosition){var m=a.getTooltipPosition(u)||[];h=m[0],d=m[1]}else if(g&&g.dataToPoint){var m=g.dataToPoint(l.getValues(p.map(g.dimensions,function(t){return a.coordDimToDataDim(t)[0]}),u,!0));h=m&&m[0],d=m&&m[1]}else if(f){var y=f.getBoundingRect().clone();y.applyTransform(f.transform),h=y.x+y.width/2,d=y.y+y.height/2}null!=h&&null!=d&&this._tryShow({offsetX:h,offsetY:d,position:n.position,target:f,event:{}})}}else{var f=i.getZr().handler.findHover(n.x,n.y);this._tryShow({offsetX:n.x,offsetY:n.y,position:n.position,target:f,event:{}})}}},manuallyHideTip:function(t,e,i,n){n.from!==this.uid&&this._hide()},_prepareAxisTriggerData:function(t,e){var i={};return e.eachSeries(function(t){if(c(t)){var e,n,o=t.coordinateSystem;"cartesian2d"===o.type?(e=o.getBaseAxis(),n=e.dim+e.index):"singleAxis"===o.type?(e=o.getAxis(),n=e.dim+e.type):(e=o.getBaseAxis(),n=e.dim+o.name),i[n]=i[n]||{coordSys:[],series:[]},i[n].coordSys.push(o),i[n].series.push(t)}},this),i},_tryShow:function(t){var e=t.target,i=this._tooltipModel,n=i.get("trigger"),o=this._ecModel,r=this._api;if(i)if(this._lastX=t.offsetX,this._lastY=t.offsetY,e&&null!=e.dataIndex){var a=e.dataModel||o.getSeriesByIndex(e.seriesIndex),s=e.dataIndex,l=a.getData(),u=l.getItemModel(s);"axis"===(u.get("tooltip.trigger")||n)?this._showAxisTooltip(i,o,t):(this._ticket="",this._hideAxisPointer(),this._resetLastHover(),this._showItemTooltipContent(a,s,e.dataType,t)),r.dispatchAction({type:"showTip",from:this.uid,dataIndexInside:s,dataIndex:l.getRawIndex(s),seriesIndex:e.seriesIndex})}else if(e&&e.tooltip){var h=e.tooltip;if("string"==typeof h){var c=h;h={content:c,formatter:c}}var d=new _(h,i),f=d.get("content"),p=Math.random();this._showTooltipContent(d,f,d.get("formatterParams")||{},p,t.offsetX,t.offsetY,t.position,e,r)}else"item"===n?this._hide():this._showAxisTooltip(i,o,t),"cross"===i.get("axisPointer.type")&&r.dispatchAction({type:"showTip",from:this.uid,x:t.offsetX,y:t.offsetY})},_showAxisTooltip:function(t,e,i){var o=t.getModel("axisPointer"),r=o.get("type");if("cross"===r){var a=i.target;if(a&&null!=a.dataIndex){var s=e.getSeriesByIndex(a.seriesIndex),l=a.dataIndex;this._showItemTooltipContent(s,l,a.dataType,i)}}this._showAxisPointer();var u=!0;p.each(this._seriesGroupByAxis,function(e){var a=e.coordSys,s=a[0],l=[i.offsetX,i.offsetY];if(!s.containPoint(l))return void this._hideAxisPointer(s.name);u=!1;var h=s.dimensions,c=s.pointToData(l,!0);l=s.dataToPoint(c);var d=s.getBaseAxis(),f=o.get("axis"); -if("auto"===f&&(f=d.dim),d.isBlank()||p.eqNaN(l[0])||p.eqNaN(l[1]))return void this._hideAxisPointer(s.name);var g=!1,m=this._lastHover;if("cross"===r)n(m.data,c)&&(g=!0),m.data=c;else{var v=p.indexOf(h,f);m.data===c[v]&&(g=!0),m.data=c[v]}var y=t.get("animation");"cartesian2d"!==s.type||g?"polar"!==s.type||g?"singleAxis"!==s.type||g||this._showSinglePointer(o,s,f,l,y):this._showPolarPointer(o,s,f,l,y):this._showCartesianPointer(o,s,f,l,y),"cross"!==r&&this._dispatchAndShowSeriesTooltipContent(s,e.series,l,c,g,i.position)},this),this._tooltipModel.get("show")||this._hideAxisPointer(),u&&this._hide()},_showCartesianPointer:function(t,e,i,n,a){function s(i,n,r){var a="x"===i?o(n[0],r[0],n[0],r[1]):o(r[0],n[1],r[1],n[1]),s=u._getPointerElement(e,t,i,a);f.subPixelOptimizeLine({shape:a,style:s.style}),d?f.updateProps(s,{shape:a},t):s.attr({shape:a})}function l(i,n,o){var a=e.getAxis(i),s=a.getBandWidth(),l=o[1]-o[0],h="x"===i?r(n[0]-s/2,o[0],s,l):r(o[0],n[1]-s/2,l,s),c=u._getPointerElement(e,t,i,h);d?f.updateProps(c,{shape:h},t):c.attr({shape:h})}var u=this,h=t.get("type"),c=e.getBaseAxis(),d=a&&"cross"!==h&&"category"===c.type&&c.getBandWidth()>20;if("cross"===h)s("x",n,e.getAxis("y").getGlobalExtent()),s("y",n,e.getAxis("x").getGlobalExtent()),this._updateCrossText(e,n,t);else{var p=e.getAxis("x"===i?"y":"x"),g=p.getGlobalExtent();"cartesian2d"===e.type&&("line"===h?s:l)(i,n,g)}},_showSinglePointer:function(t,e,i,n,r){function a(i,n,r){var a=e.getAxis(),l=a.orient,h="horizontal"===l?o(n[0],r[0],n[0],r[1]):o(r[0],n[1],r[1],n[1]),c=s._getPointerElement(e,t,i,h);u?f.updateProps(c,{shape:h},t):c.attr({shape:h})}var s=this,l=t.get("type"),u=r&&"cross"!==l&&"category"===e.getBaseAxis().type,h=e.getRect(),c=[h.y,h.y+h.height];a(i,n,c)},_showPolarPointer:function(t,e,i,n,r){function s(i,n,r){var a,s=e.pointToCoord(n);if("angle"===i){var l=e.coordToPoint([r[0],s[1]]),h=e.coordToPoint([r[1],s[1]]);a=o(l[0],l[1],h[0],h[1])}else a={cx:e.cx,cy:e.cy,r:s[0]};var c=u._getPointerElement(e,t,i,a);p?f.updateProps(c,{shape:a},t):c.attr({shape:a})}function l(i,n,o){var r,s=e.getAxis(i),l=s.getBandWidth(),h=e.pointToCoord(n),c=Math.PI/180;r="angle"===i?a(e.cx,e.cy,o[0],o[1],(-h[1]-l/2)*c,(-h[1]+l/2)*c):a(e.cx,e.cy,h[0]-l/2,h[0]+l/2,0,2*Math.PI);var d=u._getPointerElement(e,t,i,r);p?f.updateProps(d,{shape:r},t):d.attr({shape:r})}var u=this,h=t.get("type"),c=e.getAngleAxis(),d=e.getRadiusAxis(),p=r&&"cross"!==h&&"category"===e.getBaseAxis().type;if("cross"===h)s("angle",n,d.getExtent()),s("radius",n,c.getExtent()),this._updateCrossText(e,n,t);else{var g=e.getAxis("radius"===i?"angle":"radius"),m=g.getExtent();("line"===h?s:l)(i,n,m)}},_updateCrossText:function(t,e,i){var n=i.getModel("crossStyle"),o=n.getModel("textStyle"),r=this._tooltipModel,a=this._crossText;a||(a=this._crossText=new f.Text({style:{textAlign:"left",textVerticalAlign:"bottom"}}),this.group.add(a));var s=t.pointToData(e),l=t.dimensions;s=p.map(s,function(e,i){var n=t.getAxis(l[i]);return e="category"===n.type||"time"===n.type?n.scale.getLabel(e):g.addCommas(e.toFixed(n.getPixelPrecision()))}),a.setStyle({fill:o.getTextColor()||n.get("color"),textFont:o.getFont(),text:s.join(", "),x:e[0]+5,y:e[1]-5}),a.z=r.get("z"),a.zlevel=r.get("zlevel")},_getPointerElement:function(t,e,i,n){var o=this._tooltipModel,r=o.get("z"),a=o.get("zlevel"),s=this._axisPointers,l=t.name;if(s[l]=s[l]||{},s[l][i])return s[l][i];var u=e.get("type"),h=e.getModel(u+"Style"),c="shadow"===u,d=h[c?"getAreaStyle":"getLineStyle"](),p="polar"===t.type?c?"Sector":"radius"===i?"Circle":"Line":c?"Rect":"Line";c?d.stroke=null:d.fill=null;var g=s[l][i]=new f[p]({style:d,z:r,zlevel:a,silent:!0,shape:n});return this.group.add(g),g},_dispatchAndShowSeriesTooltipContent:function(t,e,i,n,o,r){var a=this._tooltipModel,s=t.getBaseAxis(),l={x:1,radius:1,single:1}[s.dim]?0:1;if(e.length){var u,c=p.map(e,function(t){return{seriesIndex:t.seriesIndex,dataIndexInside:t.getAxisTooltipDataIndex?t.getAxisTooltipDataIndex(t.coordDimToDataDim(s.dim),n,s):t.getData().indexOfNearest(t.coordDimToDataDim(s.dim)[0],n[l],!1,"category"===s.type?.5:null)}});p.each(c,function(t,i){e[i].getData().hasValue(t.dataIndexInside)&&(u=i)}),u=u||0;var d=this._lastHover,f=this._api;d.payloadBatch&&!o&&f.dispatchAction({type:"downplay",batch:d.payloadBatch}),o||(f.dispatchAction({type:"highlight",batch:c}),d.payloadBatch=c);var m=c[u].dataIndexInside;if(f.dispatchAction({type:"showTip",dataIndexInside:m,dataIndex:e[u].getData().getRawIndex(m),seriesIndex:c[u].seriesIndex,from:this.uid}),s&&a.get("showContent")&&a.get("show")){var v=p.map(e,function(t,e){return t.getDataParams(c[e].dataIndexInside)});if(o)h(r||a.get("position"),i[0],i[1],a.get("confine"),this._tooltipContent,v,null,f);else{var y=c[u].dataIndexInside,x="time"===s.type?s.scale.getLabel(n[l]):e[u].getData().getName(y),_=(x?g.encodeHTML(x)+"
":"")+p.map(e,function(t,e){return t.formatTooltip(c[e].dataIndexInside,!0)}).join("
"),b="axis_"+t.name+"_"+y;this._showTooltipContent(a,_,v,b,i[0],i[1],r,null,f)}}}},_showItemTooltipContent:function(t,e,i,n){var o=this._api,r=t.getData(i),a=r.getItemModel(e),s=a.get("tooltip",!0);if("string"==typeof s){var l=s;s={formatter:l}}var u=this._tooltipModel,h=t.getModel("tooltip",u),c=new _(s,h,h.ecModel),d=t.getDataParams(e,i),f=t.formatTooltip(e,!1,i),p="item_"+t.name+"_"+e;this._showTooltipContent(c,f,d,p,n.offsetX,n.offsetY,n.position,n.target,o)},_showTooltipContent:function(t,e,i,n,o,r,a,s,l){if(this._ticket="",t.get("showContent")&&t.get("show")){var u=this._tooltipContent,c=t.get("confine"),d=t.get("formatter");a=a||t.get("position");var f=e;if(d)if("string"==typeof d)f=g.formatTpl(d,i,!0);else if("function"==typeof d){var p=this,m=n,v=function(t,e){t===p._ticket&&(u.setContent(e),h(a,o,r,c,u,i,s,l))};p._ticket=m,f=d(i,m,v)}u.show(t),u.setContent(f),h(a,o,r,c,u,i,s,l)}},_showAxisPointer:function(t){if(t){var e=this._axisPointers[t];e&&p.each(e,function(t){t.show()})}else this.group.eachChild(function(t){t.show()}),this.group.show()},_resetLastHover:function(){var t=this._lastHover;t.payloadBatch&&this._api.dispatchAction({type:"downplay",batch:t.payloadBatch}),this._lastHover={}},_hideAxisPointer:function(t){if(t){var e=this._axisPointers[t];e&&p.each(e,function(t){t.hide()})}else this.group.children().length&&this.group.hide()},_hide:function(){clearTimeout(this._showTimeout),this._hideAxisPointer(),this._resetLastHover(),this._alwaysShowContent||this._tooltipContent.hideLater(this._tooltipModel.get("hideDelay")),this._api.dispatchAction({type:"hideTip",from:this.uid}),this._lastX=this._lastY=null},dispose:function(t,e){if(!x.node){var i=e.getZr();this._tooltipContent.hide(),i.off("click",this._tryShow),i.off("mousemove",this._mousemove),i.off("mouseout",this._hide),i.off("globalout",this._hide)}}})},function(t,e,i){function n(t,e){var i=t.get("center"),n=t.get("radius"),o=e.getWidth(),r=e.getHeight(),a=s.parsePercent;this.cx=a(i[0],o),this.cy=a(i[1],r);var l=this.getRadiusAxis(),u=Math.min(o,r)/2;l.setExtent(0,a(n,u))}function o(t,e){var i=this,n=i.getAngleAxis(),o=i.getRadiusAxis();if(n.scale.setExtent(1/0,-(1/0)),o.scale.setExtent(1/0,-(1/0)),t.eachSeries(function(t){if(t.coordinateSystem===i){var e=t.getData();o.scale.unionExtentFromData(e,"radius"),n.scale.unionExtentFromData(e,"angle")}}),u(n,n.model),u(o,o.model),"category"===n.type&&!n.onBand){var r=n.getExtent(),a=360/n.scale.count();n.inverse?r[1]+=a:r[1]-=a,n.setExtent(r[0],r[1])}}function r(t,e){if(t.type=e.get("type"),t.scale=l.createScaleByModel(e),t.onBand=e.get("boundaryGap")&&"category"===t.type,"angleAxis"===e.mainType){var i=e.get("startAngle");t.inverse=e.get("inverse")^e.get("clockwise"),t.setExtent(i,i+(t.inverse?-360:360))}e.axis=t,t.model=e}var a=i(382),s=i(4),l=(i(1),i(22)),u=l.niceScaleExtent;i(383);var h={dimensions:a.prototype.dimensions,create:function(t,e){var i=[];return t.eachComponent("polar",function(t,s){var l=new a(s);l.resize=n,l.update=o;var u=l.getRadiusAxis(),h=l.getAngleAxis(),c=t.findAxisModel("radiusAxis"),d=t.findAxisModel("angleAxis");r(u,c),r(h,d),l.resize(t,e),i.push(l),t.coordinateSystem=l}),t.eachSeries(function(e){if("polar"===e.get("coordinateSystem")){var i=t.queryComponents({mainType:"polar",index:e.get("polarIndex"),id:e.get("polarId")})[0];e.coordinateSystem=i.coordinateSystem}}),i}};i(23).register("polar",h)},function(t,e,i){function n(t){return parseInt(t,10)}function o(t,e){s.initVML(),this.root=t,this.storage=e;var i=document.createElement("div"),n=document.createElement("div");i.style.cssText="display:inline-block;overflow:hidden;position:relative;width:300px;height:150px;",n.style.cssText="position:absolute;left:0;top:0;",t.appendChild(i),this._vmlRoot=n,this._vmlViewport=i,this.resize();var o=e.delFromMap,r=e.addToMap;e.delFromMap=function(t){var i=e.get(t);o.call(e,t),i&&i.onRemove&&i.onRemove(n)},e.addToMap=function(t){t.onAdd&&t.onAdd(n),r.call(e,t)},this._firstPaint=!0}function r(t){return function(){a('In IE8.0 VML mode painter not support method "'+t+'"')}}var a=i(48),s=i(171);o.prototype={constructor:o,getViewportRoot:function(){return this._vmlViewport},refresh:function(){var t=this.storage.getDisplayList(!0,!0);this._paintList(t)},_paintList:function(t){for(var e=this._vmlRoot,i=0;i=0?parseFloat(t)/100*e:parseFloat(t):t},E=function(t,e,i){var n=a.parse(e);i=+i,isNaN(i)&&(i=1),n&&(t.color=D(n[0],n[1],n[2]),t.opacity=i*n[3])},R=function(t){var e=a.parse(t);return[D(e[0],e[1],e[2]),e[3]]},N=function(t,e,i){var n=e.fill;if(null!=n)if(n instanceof f){var o,r=0,a=[0,0],s=0,l=1,u=i.getBoundingRect(),h=u.width,c=u.height;if("linear"===n.type){o="gradient";var d=i.transform,p=[n.x*h,n.y*c],g=[n.x2*h,n.y2*c];d&&(b(p,p,d),b(g,g,d));var m=g[0]-p[0],v=g[1]-p[1];r=180*Math.atan2(m,v)/Math.PI,r<0&&(r+=360),r<1e-6&&(r=0)}else{o="gradientradial";var p=[n.x*h,n.y*c],d=i.transform,y=i.scale,x=h,w=c;a=[(p[0]-u.x)/x,(p[1]-u.y)/w],d&&b(p,p,d),x/=y[0]*M,w/=y[1]*M;var S=_(x,w);s=0/S,l=2*n.r/S-s}var I=n.colorStops.slice();I.sort(function(t,e){return t.offset-e.offset});for(var T=I.length,A=[],L=[],C=0;C=2){var k=A[0][0],O=A[1][0],z=A[0][1]*e.opacity,N=A[1][1]*e.opacity;t.type=o,t.method="none",t.focus="100%",t.angle=r,t.color=k,t.color2=O,t.colors=L.join(","),t.opacity=N,t.opacity2=z}"radial"===o&&(t.focusposition=a.join(","))}else E(t,n,e.opacity)},V=function(t,e){null!=e.lineDash&&(t.dashstyle=e.lineDash.join(" ")),null==e.stroke||e.stroke instanceof f||E(t,e.stroke,e.opacity)},B=function(t,e,i,n){var o="fill"==e,r=t.getElementsByTagName(e)[0];null!=i[e]&&"none"!==i[e]&&(o||!o&&i.lineWidth)?(t[o?"filled":"stroked"]="true",i[e]instanceof f&&k(t,r),r||(r=p.createNode(e)),o?N(r,i,n):V(r,i),P(t,r)):(t[o?"filled":"stroked"]="false",k(t,r))},G=[[],[],[]],F=function(t,e){var i,n,o,a,s,l,u=r.M,h=r.C,c=r.L,d=r.A,f=r.Q,p=[];for(a=0;a.01?F&&(H+=270/M):Math.abs(W-E)<1e-4?F&&Hz?T-=270/M:T+=270/M:F&&WE?S+=270/M:S-=270/M),p.push(Z,g(((z-R)*P+C)*M-I),w,g(((E-N)*k+D)*M-I),w,g(((z+R)*P+C)*M-I),w,g(((E+N)*k+D)*M-I),w,g((H*P+C)*M-I),w,g((W*k+D)*M-I),w,g((S*P+C)*M-I),w,g((T*k+D)*M-I)),s=S,l=T;break;case r.R:var q=G[0],j=G[1];q[0]=t[a++],q[1]=t[a++],j[0]=q[0]+t[a++],j[1]=q[1]+t[a++],e&&(b(q,q,e),b(j,j,e)),q[0]=g(q[0]*M-I),j[0]=g(j[0]*M-I),q[1]=g(q[1]*M-I),j[1]=g(j[1]*M-I),p.push(" m ",q[0],w,q[1]," l ",j[0],w,q[1]," l ",j[0],w,j[1]," l ",q[0],w,j[1]);break;case r.Z:p.push(" x ")}if(i>0){p.push(n);for(var U=0;UU&&(j=0,q={});var i,n=X.style;try{n.font=t,i=n.fontFamily.split(",")[0]}catch(o){}e={style:n.fontStyle||Z,variant:n.fontVariant||Z,weight:n.fontWeight||Z,size:0|parseFloat(n.fontSize||12),family:i||"Microsoft YaHei"},q[t]=e,j++}return e};s.measureText=function(t,e){var i=p.doc;W||(W=i.createElement("div"),W.style.cssText="position:absolute;top:-20000px;left:0;padding:0;margin:0;border:none;white-space:pre;",p.doc.body.appendChild(W));try{W.style.font=e}catch(n){}return W.innerHTML="",W.appendChild(i.createTextNode(t)),{width:W.offsetWidth}};for(var $=new o,Q=function(t,e,i,n){var o=this.style,r=o.text;if(null!=r&&(r+=""),r){var a,l,u=o.textAlign,h=Y(o.textFont),c=h.style+" "+h.variant+" "+h.weight+" "+h.size+'px "'+h.family+'"',d=o.textBaseline,f=o.textVerticalAlign;i=i||s.getBoundingRect(r,c,u,d);var m=this.transform;if(m&&!n&&($.copy(e),$.applyTransform(m),e=$),n)a=e.x,l=e.y;else{var v=o.textPosition,y=o.textDistance;if(v instanceof Array)a=e.x+z(v[0],e.width),l=e.y+z(v[1],e.height),u=u||"left",d=d||"top";else{var x=s.adjustTextPositionOnRect(v,e,i,y);a=x.x,l=x.y,u=u||x.textAlign,d=d||x.textBaseline}}if(f){switch(f){case"middle":l-=i.height/2;break;case"bottom":l-=i.height}d="top"}var _=h.size;switch(d){case"hanging":case"top":l+=_/1.75;break;case"middle":break;default:l-=_/2.25}switch(u){case"left":break;case"center":a-=i.width/2;break;case"right":a-=i.width}var S,M,I,T=p.createNode,A=this._textVmlEl;A?(I=A.firstChild,S=I.nextSibling,M=S.nextSibling):(A=T("line"),S=T("path"),M=T("textpath"),I=T("skew"),M.style["v-text-align"]="left",L(A),S.textpathok=!0,M.on=!0,A.from="0 0",A.to="1000 0.05",P(A,I),P(A,S),P(A,M),this._textVmlEl=A);var D=[a,l],k=A.style;m&&n?(b(D,D,m),I.on=!0,I.matrix=m[0].toFixed(3)+w+m[2].toFixed(3)+w+m[1].toFixed(3)+w+m[3].toFixed(3)+",0,0",I.offset=(g(D[0])||0)+","+(g(D[1])||0),I.origin="0 0",k.left="0px",k.top="0px"):(I.on=!1,k.left=g(a)+"px",k.top=g(l)+"px"),M.string=C(r);try{M.style.font=c}catch(E){}B(A,"fill",{fill:n?o.fill:o.textFill,opacity:o.opacity},this),B(A,"stroke",{stroke:n?o.stroke:o.textStroke,opacity:o.opacity,lineDash:o.lineDash},this),A.style.zIndex=O(this.zlevel,this.z,this.z2),P(t,A)}},K=function(t){k(t,this._textVmlEl),this._textVmlEl=null},J=function(t){P(t,this._textVmlEl)},tt=[l,u,h,d,c],et=0;et0&&(s=this.getLineLength(n)/u*1e3),s!==this._period||l!==this._loop){n.stopAnimation();var d=h;c&&(d=h(i)),n.__t>0&&(d=-s*n.__t),n.__t=0;var f=n.animate("",l).when(s,{__t:1}).delay(d).during(function(){o.updateSymbolPosition(n)});l||f.done(function(){o.remove(n)}),f.start()}this._period=s,this._loop=l}},h.getLineLength=function(t){return l.dist(t.__p1,t.__cp1)+l.dist(t.__cp1,t.__p2)},h.updateAnimationPoints=function(t,e){t.__p1=e[0],t.__p2=e[1],t.__cp1=e[2]||[(e[0][0]+e[1][0])/2,(e[0][1]+e[1][1])/2]},h.updateData=function(t,e,i){this.childAt(0).updateData(t,e,i),this._updateEffectSymbol(t,e)},h.updateSymbolPosition=function(t){var e=t.__p1,i=t.__p2,n=t.__cp1,o=t.__t,r=t.position,a=u.quadraticAt,s=u.quadraticDerivativeAt;r[0]=a(e[0],n[0],i[0],o),r[1]=a(e[1],n[1],i[1],o);var l=s(e[0],n[0],i[0],o),h=s(e[1],n[1],i[1],o);t.rotation=-Math.atan2(h,l)-Math.PI/2,t.ignore=!1},h.updateLayout=function(t,e){this.childAt(0).updateLayout(t,e);var i=t.getItemModel(e).getModel("effect");this._updateEffectAnimation(t,i,e)},a.inherits(n,o.Group),t.exports=n},function(t,e,i){function n(t,e,i){o.Group.call(this),this._createPolyline(t,e,i)}var o=i(3),r=i(1),a=n.prototype;a._createPolyline=function(t,e,i){var n=t.getItemLayout(e),r=new o.Polyline({shape:{points:n}});this.add(r),this._updateCommonStl(t,e,i)},a.updateData=function(t,e,i){var n=t.hostModel,r=this.childAt(0),a={shape:{points:t.getItemLayout(e)}};o.updateProps(r,a,n,e),this._updateCommonStl(t,e,i)},a._updateCommonStl=function(t,e,i){var n=this.childAt(0),a=t.getItemModel(e),s=t.getItemVisual(e,"color"),l=i&&i.lineStyle,u=i&&i.hoverLineStyle;i&&!t.hasItemOption||(l=a.getModel("lineStyle.normal").getLineStyle(),u=a.getModel("lineStyle.emphasis").getLineStyle()),n.useStyle(r.defaults({strokeNoScale:!0,fill:"none",stroke:s},l)),n.hoverStyle=u,o.setHoverStyle(this)},a.updateLayout=function(t,e){var i=this.childAt(0);i.setShape("points",t.getItemLayout(e))},r.inherits(n,o.Group),t.exports=n},function(t,e,i){var n=i(14),o=i(392),r=i(244),a=i(27),s=i(23),l=i(1),u=i(35);t.exports=function(t,e,i,h,c){for(var d=new o(h),f=0;f "+x)),m++)}var _,b=i.get("coordinateSystem");if("cartesian2d"===b||"polar"===b)_=u(t,i,i.ecModel);else{var w=s.get(b),S=a((w&&"view"!==w.type?w.dimensions||[]:[]).concat(["value"]),t);_=new n(S,i),_.initData(t)}var M=new n(["value"],i);return M.initData(g,p),c&&c(_,M),r({mainData:_,struct:d,structAttr:"graph",datas:{node:_,edge:M},datasAttr:{node:"data",edge:"edgeData"}}),d.update(),d}},function(t,e,i){function n(t,e){var i=t.getItemStyle(),n=t.get("areaColor");return null!=n&&(i.fill=n),i}function o(t,e,i,n,o){i.off("click"),i.off("mousedown"),e.get("selectedMode")&&(i.on("mousedown",function(){t._mouseDownFlag=!0}),i.on("click",function(a){if(t._mouseDownFlag){t._mouseDownFlag=!1;for(var s=a.target;!s.__region;)s=s.parent;if(s){var l=s.__region,u={type:("geo"===e.mainType?"geo":"map")+"ToggleSelect",name:l.name,from:o.uid};u[e.mainType+"Id"]=e.id,n.dispatchAction(u),r(e,i)}}}))}function r(t,e){e.eachChild(function(e){e.__region&&e.trigger(t.isSelected(e.__region.name)?"emphasis":"normal")})}function a(t,e){var i=new l.Group;this._controller=new s(t.getZr(),e?i:null,null),this.group=i,this._updateGroup=e,this._mouseDownFlag}var s=i(84),l=i(3),u=i(1);a.prototype={constructor:a,draw:function(t,e,i,a,s){var h="geo"===t.mainType,c=t.getData&&t.getData();h&&e.eachComponent({mainType:"series",subType:"map"},function(e){c||e.getHostGeoModel()!==t||(c=e.getData())});var d=t.coordinateSystem,f=this.group,p=d.scale,g={position:d.position,scale:p};!f.childAt(0)||s?f.attr(g):l.updateProps(f,g,t),f.removeAll();var m=["itemStyle","normal"],v=["itemStyle","emphasis"],y=["label","normal"],x=["label","emphasis"];u.each(d.regions,function(e){var i=new l.Group,o=new l.CompoundPath({shape:{paths:[]}});i.add(o);var r,a=t.getRegionModel(e.name)||t,s=a.getModel(m),d=a.getModel(v),g=n(s,p),_=n(d,p),b=a.getModel(y),w=a.getModel(x);if(c){r=c.indexOfName(e.name);var S=c.getItemVisual(r,"color",!0);S&&(g.fill=S)}var M=b.getModel("textStyle"),I=w.getModel("textStyle");u.each(e.contours,function(t){var e=new l.Polygon({shape:{points:t}});o.shape.paths.push(e)}),o.setStyle(g),o.style.strokeNoScale=!0,o.culling=!0;var T=b.get("show"),A=w.get("show"),L=c&&isNaN(c.get("value",r)),C=c&&c.getItemLayout(r);if(h||L&&(T||A)||C&&C.showLabel){var D=c?r:e.name,P=t.getFormattedLabel(D,"normal"),k=t.getFormattedLabel(D,"emphasis"),O=new l.Text({style:{text:T?P||e.name:"",fill:M.getTextColor(),textFont:M.getFont(),textAlign:"center",textVerticalAlign:"middle"},hoverStyle:{text:A?k||e.name:"",fill:I.getTextColor(),textFont:I.getFont()},position:e.center.slice(),scale:[1/p[0],1/p[1]],z2:10,silent:!0});i.add(O)}if(c)c.setItemGraphicEl(r,i);else{var a=t.getRegionModel(e.name);o.eventData={componentType:"geo",geoIndex:t.componentIndex,name:e.name,region:a&&a.option||{}}}i.__region=e,l.setHoverStyle(i,_,{hoverSilentOnTouch:!!t.get("selectedMode")}),f.add(i)}),this._updateController(t,e,i),o(this,t,f,i,a),r(t,f)},remove:function(){this.group.removeAll(),this._controller.dispose()},_updateController:function(t,e,i){function n(){var e={type:"geoRoam",componentType:a};return e[a+"Id"]=t.id,e}var o=t.coordinateSystem,r=this._controller;r.zoomLimit=t.get("scaleLimit"),r.zoom=o.getZoom(),r.enable(t.get("roam")||!1);var a=t.mainType;r.off("pan").on("pan",function(t,e){this._mouseDownFlag=!1,i.dispatchAction(u.extend(n(),{dx:t,dy:e}))},this),r.off("zoom").on("zoom",function(t,e,o){if(this._mouseDownFlag=!1,i.dispatchAction(u.extend(n(),{zoom:t,originX:e,originY:o})),this._updateGroup){var r=this.group,a=r.scale;r.traverse(function(t){"text"===t.type&&t.attr("scale",[1/a[0],1/a[1]])})}},this),r.setContainsPoint(function(t,e){return o.getViewRectAfterRoam().contain(t,e)})}},t.exports=a},function(t,e,i){i(243),i(378),i(347);var n=i(2),o=i(1),r=5;n.extendComponentView({type:"parallel",render:function(t,e,i){var n=i.getZr();if(!this.__onMouseDown){var a;n.on("mousedown",this.__onMouseDown=function(t){a=[t.offsetX,t.offsetY]}),n.on("mouseup",this.__onMouseUp=function(e){var n=[e.offsetX,e.offsetY],s=Math.pow(a[0]-n[0],2)+Math.pow(a[1]-n[1],2);if(t.get("axisExpandable")&&!(s>r)){var l=t.coordinateSystem,u=l.findClosestAxisDim(n);if(u){var h=o.indexOf(l.dimensions,u);i.dispatchAction({type:"parallelAxisExpand",axisExpandCenter:h})}}})}},dispose:function(t,e){e.getZr().off(this.__onMouseDown),e.getZr().off(this.__onMouseUp)}}),n.registerPreprocessor(i(379))},function(t,e,i){i(391),i(336),i(388);var n=i(2);n.extendComponentView({type:"single"})},function(t,e,i){var n=i(2),o=i(1),r=i(10),a=i(246),s=i(73),l=i(174),u=s.mapVisual,h=i(6),c=s.eachVisual,d=i(4),f=o.isArray,p=o.each,g=d.asc,m=d.linearMap,v=o.noop,y=["#f6efa6","#d88273","#bf444c"],x=n.extendComponentModel({type:"visualMap",dependencies:["series"],stateList:["inRange","outOfRange"],replacableOptionKeys:["inRange","outOfRange","target","controller","color"],dataBound:[-(1/0),1/0],layoutMode:{type:"box",ignoreSize:!0},defaultOption:{show:!0,zlevel:0,z:4,seriesIndex:null,min:0,max:200,dimension:null,inRange:null,outOfRange:null,left:0,right:null,top:null,bottom:0,itemWidth:null,itemHeight:null,inverse:!1,orient:"vertical",backgroundColor:"rgba(0,0,0,0)",borderColor:"#ccc",contentColor:"#5793f3",inactiveColor:"#aaa",borderWidth:0,padding:5,textGap:10,precision:0,color:null,formatter:null,text:null,textStyle:{color:"#333"}},init:function(t,e,i){this._dataExtent,this.targetVisuals={},this.controllerVisuals={},this.textStyleModel,this.itemSize,this.mergeDefaultAndTheme(t,i)},optionUpdated:function(t,e){var i=this.option;r.canvasSupported||(i.realtime=!1),!e&&l.replaceVisualOption(i,t,this.replacableOptionKeys),this.textStyleModel=this.getModel("textStyle"),this.resetItemSize(),this.completeVisualOption()},resetVisual:function(t){var e=this.stateList;t=o.bind(t,this),this.controllerVisuals=l.createVisualMappings(this.option.controller,e,t),this.targetVisuals=l.createVisualMappings(this.option.target,e,t)},resetTargetSeries:function(){var t=this.option,e=null==t.seriesIndex;t.seriesIndex=e?[]:h.normalizeToArray(t.seriesIndex),e&&this.ecModel.eachSeries(function(e,i){t.seriesIndex.push(i)})},eachTargetSeries:function(t,e){o.each(this.option.seriesIndex,function(i){t.call(e,this.ecModel.getSeriesByIndex(i))},this)},isTargetSeries:function(t){ -var e=!1;return this.eachTargetSeries(function(i){i===t&&(e=!0)}),e},formatValueText:function(t,e,i){function n(t){return t===u[0]?"min":t===u[1]?"max":(+t).toFixed(l)}var r,a,s=this.option,l=s.precision,u=this.dataBound,h=s.formatter;return i=i||["<",">"],o.isArray(t)&&(t=t.slice(),r=!0),a=e?t:r?[n(t[0]),n(t[1])]:n(t),o.isString(h)?h.replace("{value}",r?a[0]:a).replace("{value2}",r?a[1]:a):o.isFunction(h)?r?h(t[0],t[1]):h(t):r?t[0]===u[0]?i[0]+" "+a[1]:t[1]===u[1]?i[1]+" "+a[0]:a[0]+" - "+a[1]:a},resetExtent:function(){var t=this.option,e=g([t.min,t.max]);this._dataExtent=e},getDataDimension:function(t){var e=this.option.dimension;return null!=e?e:t.dimensions.length-1},getExtent:function(){return this._dataExtent.slice()},completeVisualOption:function(){function t(t){f(n.color)&&!t.inRange&&(t.inRange={color:n.color.slice().reverse()}),t.inRange=t.inRange||{color:y},p(this.stateList,function(e){var i=t[e];if(o.isString(i)){var n=a.get(i,"active",d);n?(t[e]={},t[e][i]=n):delete t[e]}},this)}function e(t,e,i){var n=t[e],o=t[i];n&&!o&&(o=t[i]={},p(n,function(t,e){if(s.isValidType(e)){var i=a.get(e,"inactive",d);null!=i&&(o[e]=i,"color"!==e||o.hasOwnProperty("opacity")||o.hasOwnProperty("colorAlpha")||(o.opacity=[0,0]))}}))}function i(t){var e=(t.inRange||{}).symbol||(t.outOfRange||{}).symbol,i=(t.inRange||{}).symbolSize||(t.outOfRange||{}).symbolSize,n=this.get("inactiveColor");p(this.stateList,function(r){var a=this.itemSize,s=t[r];s||(s=t[r]={color:d?n:[n]}),null==s.symbol&&(s.symbol=e&&o.clone(e)||(d?"roundRect":["roundRect"])),null==s.symbolSize&&(s.symbolSize=i&&o.clone(i)||(d?a[0]:[a[0],a[0]])),s.symbol=u(s.symbol,function(t){return"none"===t||"square"===t?"roundRect":t});var l=s.symbolSize;if(null!=l){var h=-(1/0);c(l,function(t){t>h&&(h=t)}),s.symbolSize=u(l,function(t){return m(t,[0,h],[0,a[0]],!0)})}},this)}var n=this.option,r={inRange:n.inRange,outOfRange:n.outOfRange},l=n.target||(n.target={}),h=n.controller||(n.controller={});o.merge(l,r),o.merge(h,r);var d=this.isCategory();t.call(this,l),t.call(this,h),e.call(this,l,"inRange","outOfRange"),i.call(this,h)},resetItemSize:function(){this.itemSize=[parseFloat(this.get("itemWidth")),parseFloat(this.get("itemHeight"))]},isCategory:function(){return!!this.option.categories},setSelected:v,getValueState:v,getVisualMeta:v});t.exports=x},function(t,e,i){var n=i(1),o=i(3),r=i(8),a=i(12),s=i(2),l=i(73);t.exports=s.extendComponentView({type:"visualMap",autoPositionValues:{left:1,right:1,top:1,bottom:1},init:function(t,e){this.ecModel=t,this.api=e,this.visualMapModel},render:function(t,e,i,n){return this.visualMapModel=t,t.get("show")===!1?void this.group.removeAll():void this.doRender.apply(this,arguments)},renderBackground:function(t){var e=this.visualMapModel,i=r.normalizeCssArray(e.get("padding")||0),n=t.getBoundingRect();t.add(new o.Rect({z2:-1,silent:!0,shape:{x:n.x-i[3],y:n.y-i[0],width:n.width+i[3]+i[1],height:n.height+i[0]+i[2]},style:{fill:e.get("backgroundColor"),stroke:e.get("borderColor"),lineWidth:e.get("borderWidth")}}))},getControllerVisual:function(t,e,i){function o(t){return u[t]}function r(t,e){u[t]=e}i=i||{};var a=i.forceState,s=this.visualMapModel,u={};if("symbol"===e&&(u.symbol=s.get("itemSymbol")),"color"===e){var h=s.get("contentColor");u.color=h}var c=s.controllerVisuals[a||s.getValueState(t)],d=l.prepareVisualTypes(c);return n.each(d,function(n){var a=c[n];i.convertOpacityToAlpha&&"opacity"===n&&(n="colorAlpha",a=c.__alphaForOpacity),l.dependsOn(n,e)&&a&&a.applyVisual(t,o,r)}),u[e]},positionGroup:function(t){var e=this.visualMapModel,i=this.api;a.positionElement(t,e.getBoxLayoutParams(),{width:i.getWidth(),height:i.getHeight()})},doRender:n.noop})},function(t,e,i){var n=i(1),o=i(12),r={getItemAlign:function(t,e,i){var n=t.option,r=n.align;if(null!=r&&"auto"!==r)return r;for(var a={width:e.getWidth(),height:e.getHeight()},s="horizontal"===n.orient?1:0,l=[["left","right","width"],["top","bottom","height"]],u=l[s],h=[0,null,10],c={},d=0;d<3;d++)c[l[1-s][d]]=h[d],c[u[d]]=2===d?i[0]:n[u[d]];var f=[["x","width",3],["y","height",0]][s],p=o.getLayoutRect(c,a,n.padding);return u[(p.margin[f[2]]||0)+p[f[0]]+.5*p[f[1]]<.5*a[f[1]]?0:1]},convertDataIndex:function(t){return n.each(t||[],function(e){null!=t.dataIndex&&(t.dataIndexInside=t.dataIndex,t.dataIndex=null)}),t}};t.exports=r},function(t,e,i){function n(t,e){return t&&t.hasOwnProperty&&t.hasOwnProperty(e)}var o=i(1),r=o.each;t.exports=function(t){var e=t&&t.visualMap;o.isArray(e)||(e=e?[e]:[]),r(e,function(t){if(t){n(t,"splitList")&&!n(t,"pieces")&&(t.pieces=t.splitList,delete t.splitList);var e=t.pieces;e&&o.isArray(e)&&r(e,function(t){o.isObject(t)&&(n(t,"start")&&!n(t,"min")&&(t.min=t.start),n(t,"end")&&!n(t,"max")&&(t.max=t.end))})}})}},function(t,e,i){i(13).registerSubTypeDefaulter("visualMap",function(t){return t.categories||(t.pieces?t.pieces.length>0:t.splitNumber>0)&&!t.calculable?"piecewise":"continuous"})},function(t,e,i){function n(t,e){t.eachTargetSeries(function(e){var i=e.getData();s.applyVisual(t.stateList,t.targetVisuals,i,t.getValueState,t,t.getDataDimension(i))})}function o(t){t.eachSeries(function(e){var i=e.getData(),n=[];t.eachComponent("visualMap",function(t){if(t.isTargetSeries(e)){var o=t.getVisualMeta(u.bind(r,null,e,t))||{stops:[],outerColors:[]};o.dimension=t.getDataDimension(i),n.push(o)}}),e.getData().setVisual("visualMeta",n)})}function r(t,e,i,n){function o(t){return u[t]}function r(t,e){u[t]=e}for(var a=e.targetVisuals[n],s=l.prepareVisualTypes(a),u={color:t.getData().getVisual("color")},h=0,c=s.length;h=i.length)return e;for(var r=-1,a=e.length,s=i[n++],l={},u={};++r=i.length)return t;var a=[],s=n[r++];return o.each(t,function(t,i){a.push({key:i,values:e(t,r)})}),s?a.sort(function(t,e){return s(t.key,e.key)}):a}var i=[],n=[];return{key:function(t){return i.push(t),this},sortKeys:function(t){return n[i.length-1]=t,this},entries:function(i){return e(t(i,0),0)}}}var o=i(1);t.exports=n},function(t,e,i){var n=i(1),o={get:function(t,e,i){var o=n.clone((r[t]||{})[e]);return i&&n.isArray(o)?o[o.length-1]:o}},r={color:{active:["#006edd","#e0ffff"],inactive:["rgba(0,0,0,0)"]},colorHue:{active:[0,360],inactive:[0,0]},colorSaturation:{active:[.3,1],inactive:[0,0]},colorLightness:{active:[.9,.5],inactive:[0,0]},colorAlpha:{active:[.3,1],inactive:[0,0]},opacity:{active:[.3,1],inactive:[0,0]},symbol:{active:["circle","roundRect","diamond"],inactive:["none"]},symbolSize:{active:[10,50],inactive:[0,0]}};t.exports=o},function(t,e,i){function n(t,e){return Math.abs(t-e)0?1:u<0?-1:0}function r(t,e,i,n,o,r,a,s,l,u){var h=l.valueDim,c=l.categoryDim,d=Math.abs(i[c.wh]),f=t.getItemVisual(e,"symbolSize");I.isArray(f)?f=f.slice():(null==f&&(f="100%"),f=[f,f]),f[c.index]=D(f[c.index],d),f[h.index]=D(f[h.index],n?d:Math.abs(r)),u.symbolSize=f;var p=u.symbolScale=[f[0]/s,f[1]/s];p[h.index]*=(l.isHorizontal?-1:1)*a}function a(t,e,i,n,o){var r=t.get(P)||0;r&&(O.attr({scale:e.slice(),rotation:i}),O.updateTransform(),r/=O.getLineScale(),r*=e[n.valueDim.index]),o.valueLineWidth=r}function s(t,e,i,n,o,r,a,s,l,u,h,c){var d=h.categoryDim,f=h.valueDim,p=c.pxSign,g=Math.max(e[f.index]+s,0),m=g;if(n){var v=Math.abs(l),y=I.retrieve(t.get("symbolMargin"),"15%")+"",x=!1;y.lastIndexOf("!")===y.length-1&&(x=!0,y=y.slice(0,y.length-1)),y=D(y,e[f.index]);var _=Math.max(g+2*y,0),b=x?0:2*y,w=L.isNumeric(n),S=w?n:M((v+b)/_),T=v-S*g;y=T/2/(x?S:S-1),_=g+2*y,b=x?0:2*y,w||"fixed"===n||(S=u?M((Math.abs(u)+b)/_):0),m=S*_-b,c.repeatTimes=S,c.symbolMargin=y}var A=p*(m/2),C=c.pathPosition=[];C[d.index]=i[d.wh]/2,C[f.index]="start"===a?A:"end"===a?l-A:l/2,r&&(C[0]+=r[0],C[1]+=r[1]);var P=c.bundlePosition=[];P[d.index]=i[d.xy],P[f.index]=i[f.xy];var k=c.barRectShape=I.extend({},i);k[f.wh]=p*Math.max(Math.abs(i[f.wh]),Math.abs(C[f.index]+A)),k[d.wh]=i[d.wh];var O=c.clipShape={};O[d.xy]=-i[d.xy],O[d.wh]=h.ecSize[d.wh],O[f.xy]=0,O[f.wh]=i[f.wh]}function l(t){var e=t.symbolPatternSize,i=A.createSymbol(t.symbolType,-e/2,-e/2,e,e,t.color);return i.attr({culling:!0}),"image"!==i.type&&i.setStyle({strokeNoScale:!0}),i}function u(t,e,i,n){function o(t){var e=c.slice(),n=i.pxSign,o=t;return("start"===i.symbolRepeatDirection?n>0:n<0)&&(o=f-1-t),e[d.index]=g*(o-f/2+.5)+c[d.index],{position:e,scale:i.symbolScale.slice(),rotation:i.rotation}}function r(){b(t,function(t){t.trigger("emphasis")})}function a(){b(t,function(t){t.trigger("normal")})}var s=t.__pictorialBundle,u=i.symbolSize,h=i.valueLineWidth,c=i.pathPosition,d=e.valueDim,f=i.repeatTimes||0,p=0,g=u[e.valueDim.index]+h+2*i.symbolMargin;for(b(t,function(t){t.__pictorialAnimationIndex=p,t.__pictorialRepeatTimes=f,p0)],h=t.__pictorialBarRect;C.setLabel(h.style,l,r,n,e.seriesModel,o,u),T.setHoverStyle(h,l)}function M(t){var e=Math.round(t);return Math.abs(t-e)<1e-4?e:Math.ceil(t)}var I=i(1),T=i(3),A=i(24),L=i(4),C=i(81),D=L.parsePercent,P=["itemStyle","normal","borderWidth"],k=[{xy:"x",wh:"width",index:0,posDesc:["left","right"]},{xy:"y",wh:"height",index:1,posDesc:["top","bottom"]}],O=new T.Circle,z=i(2).extendChartView({type:"pictorialBar",render:function(t,e,i){var o=this.group,r=t.getData(),a=this._data,s=t.coordinateSystem,l=s.getBaseAxis(),u=!!l.isHorizontal(),h=s.grid.getRect(),c={ecSize:{width:i.getWidth(),height:i.getHeight()},seriesModel:t,coordSys:s,coordSysExtent:[[h.x,h.x+h.width],[h.y,h.y+h.height]],isHorizontal:u,valueDim:k[+u],categoryDim:k[1-u]};return r.diff(a).add(function(t){if(r.hasValue(t)){var e=f(r,t),i=n(r,t,e,c),a=v(r,c,i);r.setItemGraphicEl(t,a),o.add(a),S(a,c,i)}}).update(function(t,e){var i=a.getItemGraphicEl(e);if(!r.hasValue(t))return void o.remove(i);var s=f(r,t),l=n(r,t,s,c),u=_(r,l);i&&u!==i.__pictorialShapeStr&&(o.remove(i),r.setItemGraphicEl(t,null),i=null),i?y(i,c,l):i=v(r,c,l,!0),r.setItemGraphicEl(t,i),i.__pictorialSymbolMeta=l,o.add(i),S(i,c,l)}).remove(function(t){var e=a.getItemGraphicEl(t);e&&x(a,t,e.__pictorialSymbolMeta.animationModel,e)}).execute(),this._data=r,this.group},dispose:I.noop,remove:function(t,e){var i=this.group,n=this._data;t.get("animation")?n&&n.eachItemGraphicEl(function(e){x(n,e.dataIndex,t,e)}):i.removeAll()}});t.exports=z},function(t,e,i){var n=i(2);i(251),i(252),n.registerVisual(i(254)),n.registerLayout(i(253))},function(t,e,i){"use strict";var n=i(1),o=i(16),r=i(172),a=o.extend({type:"series.boxplot",dependencies:["xAxis","yAxis","grid"],valueDimensions:["min","Q1","median","Q3","max"],dimensions:null,defaultOption:{zlevel:0,z:2,coordinateSystem:"cartesian2d",legendHoverLink:!0,hoverAnimation:!0,layout:null,boxWidth:[7,50],itemStyle:{normal:{color:"#fff",borderWidth:1},emphasis:{borderWidth:2,shadowBlur:5,shadowOffsetX:2,shadowOffsetY:2,shadowColor:"rgba(0,0,0,0.4)"}},animationEasing:"elasticOut",animationDuration:800}});n.mixin(a,r.seriesModelMixin,!0),t.exports=a},function(t,e,i){"use strict";function n(t,e,i){var n=e.getItemModel(i),o=n.getModel(u),r=e.getItemVisual(i,"color"),s=o.getItemStyle(["borderColor"]),l=t.childAt(t.whiskerIndex);l.style.set(s),l.style.stroke=r,l.dirty();var c=t.childAt(t.bodyIndex);c.style.set(s),c.style.stroke=r,c.dirty();var d=n.getModel(h).getItemStyle();a.setHoverStyle(t,d)}var o=i(1),r=i(28),a=i(3),s=i(172),l=r.extend({type:"boxplot",getStyleUpdater:function(){return n},dispose:o.noop});o.mixin(l,s.viewMixin,!0);var u=["itemStyle","normal"],h=["itemStyle","emphasis"];t.exports=l},function(t,e,i){function n(t){var e=[],i=[];return t.eachSeriesByType("boxplot",function(t){var n=t.getBaseAxis(),o=a.indexOf(i,n);o<0&&(o=i.length,i[o]=n,e[o]={axis:n,seriesModels:[]}),e[o].seriesModels.push(t)}),e}function o(t){var e,i,n=t.axis,o=t.seriesModels,r=o.length,s=t.boxWidthList=[],h=t.boxOffsetList=[],c=[];if("category"===n.type)i=n.getBandWidth();else{var d=0;u(o,function(t){d=Math.max(d,t.getData().count())}),e=n.getExtent(),Math.abs(e[1]-e[0])/d}u(o,function(t){var e=t.get("boxWidth");a.isArray(e)||(e=[e,e]),c.push([l(e[0],i)||0,l(e[1],i)||0])});var f=.8*i-2,p=f/r*.3,g=(f-p*(r-1))/r,m=g/2-f/2;u(o,function(t,e){h.push(m),m+=p+g,s.push(Math.min(Math.max(g,c[e][0]),c[e][1]))})}function r(t,e,i){var n=t.coordinateSystem,o=t.getData(),r=t.dimensions,a=t.get("layout"),s=i/2;o.each(r,function(){function t(t){var i=[];i[f]=c,i[p]=t;var o;return isNaN(c)||isNaN(t)?o=[NaN,NaN]:(o=n.dataToPoint(i),o[f]+=e),o}function i(t,e){var i=t.slice(),n=t.slice();i[f]+=s,n[f]-=s,e?x.push(i,n):x.push(n,i)}function l(t){var e=[t.slice(),t.slice()];e[0][f]-=s,e[1][f]+=s,y.push(e)}var u=arguments,h=r.length,c=u[0],d=u[h],f="horizontal"===a?0:1,p=1-f,g=t(u[3]),m=t(u[1]),v=t(u[5]),y=[[m,t(u[2])],[v,t(u[4])]];l(m),l(v),l(g);var x=[];i(y[0][1],0),i(y[1][1],1),o.setItemLayout(d,{chartLayout:a,initBaseline:g[p],median:g,bodyEnds:x,whiskerEnds:y})})}var a=i(1),s=i(4),l=s.parsePercent,u=a.each;t.exports=function(t){var e=n(t);u(e,function(t){var e=t.seriesModels;e.length&&(o(t),u(e,function(e,i){r(e,t.boxOffsetList[i],t.boxWidthList[i])}))})}},function(t,e){var i=["itemStyle","normal","borderColor"];t.exports=function(t,e){var n=t.get("color");t.eachRawSeriesByType("boxplot",function(e){var o=n[e.seriesIndex%n.length],r=e.getData();r.setVisual({legendSymbol:"roundRect",color:e.get(i)||o}),t.isSeriesFiltered(e)||r.each(function(t){var e=r.getItemModel(t);r.setItemVisual(t,{color:e.get(i,!0)})})})}},function(t,e,i){var n=i(2);i(256),i(257),n.registerPreprocessor(i(260)),n.registerVisual(i(259)),n.registerLayout(i(258))},function(t,e,i){"use strict";var n=i(1),o=i(16),r=i(172),a=i(8),s=a.encodeHTML,l=a.addCommas,u=o.extend({type:"series.candlestick",dependencies:["xAxis","yAxis","grid"],valueDimensions:["open","close","lowest","highest"],dimensions:null,defaultOption:{zlevel:0,z:2,coordinateSystem:"cartesian2d",legendHoverLink:!0,hoverAnimation:!0,layout:null,itemStyle:{normal:{color:"#c23531",color0:"#314656",borderWidth:1,borderColor:"#c23531",borderColor0:"#314656"},emphasis:{borderWidth:2}},barMaxWidth:null,barMinWidth:null,barWidth:null,animationUpdate:!1,animationEasing:"linear",animationDuration:300},getShadowDim:function(){return"open"},formatTooltip:function(t,e){var i=n.map(this.valueDimensions,function(e){return s(e+": "+l(this.getData().get(e,t)))},this).join("
"),o=[];return null!=this.name&&o.push(s(this.name)),null!=i&&o.push(i),o.join("
")},brushSelector:function(t,e){return e.rect(t.brushRect)}});n.mixin(u,r.seriesModelMixin,!0),t.exports=u},function(t,e,i){"use strict";function n(t,e,i){var n=e.getItemModel(i),o=n.getModel(u),r=e.getItemVisual(i,"color"),s=e.getItemVisual(i,"borderColor")||r,l=o.getItemStyle(["color","color0","borderColor","borderColor0"]),c=t.childAt(t.whiskerIndex);c.useStyle(l),c.style.stroke=s;var d=t.childAt(t.bodyIndex);d.useStyle(l),d.style.fill=r,d.style.stroke=s;var f=n.getModel(h).getItemStyle();a.setHoverStyle(t,f)}var o=i(1),r=i(28),a=i(3),s=i(172),l=r.extend({type:"candlestick",getStyleUpdater:function(){return n},dispose:o.noop});o.mixin(l,s.viewMixin,!0);var u=["itemStyle","normal"],h=["itemStyle","emphasis"];t.exports=l},function(t,e,i){function n(t,e){var i,n=t.getBaseAxis(),a="category"===n.type?n.getBandWidth():(i=n.getExtent(),Math.abs(i[1]-i[0])/e.count()),s=r(o(t.get("barMaxWidth"),a),a),l=r(o(t.get("barMinWidth"),1),a),u=t.get("barWidth");return null!=u?r(u,a):Math.max(Math.min(a/2,s),l)}var o=i(1).retrieve,r=i(4).parsePercent;t.exports=function(t){t.eachSeriesByType("candlestick",function(t){var e=t.coordinateSystem,i=t.getData(),o=t.dimensions,r=t.get("layout"),a=n(t,i);i.each(o,function(){function t(t){var i=[];return i[d]=h,i[f]=t,isNaN(h)||isNaN(t)?[NaN,NaN]:e.dataToPoint(i)}function n(t,e){var i=t.slice(),n=t.slice();i[d]+=a/2,n[d]-=a/2,e?I.push(i,n):I.push(n,i)}function s(){var e=t(Math.min(p,g,m,v)),i=t(Math.max(p,g,m,v));return e[d]-=a/2,i[d]-=a/2,{x:e[0],y:e[1],width:f?a:i[0]-e[0],height:f?i[1]-e[1]:a}}var l=arguments,u=o.length,h=l[0],c=l[u],d="horizontal"===r?0:1,f=1-d,p=l[1],g=l[2],m=l[3],v=l[4],y=Math.min(p,g),x=Math.max(p,g),_=t(y),b=t(x),w=t(m),S=t(v),M=[[S,b],[w,_]],I=[];n(b,0),n(_,1),i.setItemLayout(c,{chartLayout:r,sign:p>g?-1:pg?b[f]:_[f],bodyEnds:I,whiskerEnds:M,brushRect:s()})},!0)})}},function(t,e){var i=["itemStyle","normal","borderColor"],n=["itemStyle","normal","borderColor0"],o=["itemStyle","normal","color"],r=["itemStyle","normal","color0"];t.exports=function(t,e){t.eachRawSeriesByType("candlestick",function(e){var a=e.getData();a.setVisual({legendSymbol:"roundRect"}),t.isSeriesFiltered(e)||a.each(function(t){var e=a.getItemModel(t),s=a.getItemLayout(t).sign;a.setItemVisual(t,{color:e.get(s>0?o:r),borderColor:e.get(s>0?i:n)})})})}},function(t,e,i){var n=i(1);t.exports=function(t){t&&n.isArray(t.series)&&n.each(t.series,function(t){n.isObject(t)&&"k"===t.type&&(t.type="candlestick")})}},function(t,e,i){var n=i(1),o=i(2);i(262),i(263),o.registerVisual(n.curry(i(45),"effectScatter","circle",null)),o.registerLayout(n.curry(i(56),"effectScatter"))},function(t,e,i){"use strict";var n=i(35),o=i(16);t.exports=o.extend({type:"series.effectScatter",dependencies:["grid","polar"],getInitialData:function(t,e){var i=n(t.data,this,e);return i},brushSelector:"point",defaultOption:{coordinateSystem:"cartesian2d",zlevel:0,z:2,legendHoverLink:!0,effectType:"ripple",progressive:0,showEffectOn:"render",rippleEffect:{period:4,scale:2.5,brushType:"fill"},symbolSize:10}})},function(t,e,i){var n=i(39),o=i(290);i(2).extendChartView({type:"effectScatter",init:function(){this._symbolDraw=new n(o)},render:function(t,e,i){var n=t.getData(),o=this._symbolDraw;o.updateData(n),this.group.add(o.group)},updateLayout:function(){this._symbolDraw.updateLayout()},remove:function(t,e){this._symbolDraw&&this._symbolDraw.remove(e)},dispose:function(){}})},function(t,e,i){var n=i(1),o=i(2);i(265),i(266),o.registerVisual(n.curry(i(74),"funnel")),o.registerLayout(i(267)),o.registerProcessor(n.curry(i(58),"funnel"))},function(t,e,i){"use strict";var n=i(14),o=i(6),r=i(27),a=i(2).extendSeriesModel({type:"series.funnel",init:function(t){a.superApply(this,"init",arguments),this.legendDataProvider=function(){return this.getRawData()},this._defaultLabelLine(t)},getInitialData:function(t,e){var i=r(["value"],t.data),o=new n(i,this);return o.initData(t.data),o},_defaultLabelLine:function(t){o.defaultEmphasis(t.labelLine,["show"]);var e=t.labelLine.normal,i=t.labelLine.emphasis;e.show=e.show&&t.label.normal.show,i.show=i.show&&t.label.emphasis.show},defaultOption:{zlevel:0,z:2,legendHoverLink:!0,left:80,top:60,right:80,bottom:60,minSize:"0%",maxSize:"100%",sort:"descending",gap:0,funnelAlign:"center",label:{normal:{show:!0,position:"outer"},emphasis:{show:!0}},labelLine:{normal:{show:!0,length:20,lineStyle:{width:1,type:"solid"}},emphasis:{}},itemStyle:{normal:{borderColor:"#fff",borderWidth:1},emphasis:{}}}});t.exports=a},function(t,e,i){function n(t,e){function i(){a.ignore=a.hoverIgnore,s.ignore=s.hoverIgnore}function n(){a.ignore=a.normalIgnore,s.ignore=s.normalIgnore}r.Group.call(this);var o=new r.Polygon,a=new r.Polyline,s=new r.Text;this.add(o),this.add(a),this.add(s),this.updateData(t,e,!0),this.on("emphasis",i).on("normal",n).on("mouseover",i).on("mouseout",n)}function o(t,e,i,n){var o=n.getModel("textStyle"),r=n.get("position"),s="inside"===r||"inner"===r||"center"===r;return{fill:o.getTextColor()||(s?"#fff":t.getItemVisual(e,"color")),textFont:o.getFont(),text:a.retrieve(t.hostModel.getFormattedLabel(e,i),t.getName(e))}}var r=i(3),a=i(1),s=n.prototype,l=["itemStyle","normal","opacity"];s.updateData=function(t,e,i){var n=this.childAt(0),o=t.hostModel,s=t.getItemModel(e),u=t.getItemLayout(e),h=t.getItemModel(e).get(l);h=null==h?1:h,n.useStyle({}),i?(n.setShape({points:u.points}),n.setStyle({opacity:0}),r.initProps(n,{style:{opacity:h}},o,e)):r.updateProps(n,{style:{opacity:h},shape:{points:u.points}},o,e);var c=s.getModel("itemStyle"),d=t.getItemVisual(e,"color");n.setStyle(a.defaults({lineJoin:"round",fill:d},c.getModel("normal").getItemStyle(["opacity"]))),n.hoverStyle=c.getModel("emphasis").getItemStyle(),this._updateLabel(t,e),r.setHoverStyle(this)},s._updateLabel=function(t,e){var i=this.childAt(1),n=this.childAt(2),a=t.hostModel,s=t.getItemModel(e),l=t.getItemLayout(e),u=l.label,h=t.getItemVisual(e,"color");r.updateProps(i,{shape:{points:u.linePoints||u.linePoints}},a,e),r.updateProps(n,{style:{x:u.x,y:u.y}},a,e),n.attr({style:{textAlign:u.textAlign,textVerticalAlign:u.verticalAlign,textFont:u.font},rotation:u.rotation,origin:[u.x,u.y],z2:10});var c=s.getModel("label.normal"),d=s.getModel("label.emphasis"),f=s.getModel("labelLine.normal"),p=s.getModel("labelLine.emphasis");n.setStyle(o(t,e,"normal",c)),n.ignore=n.normalIgnore=!c.get("show"),n.hoverIgnore=!d.get("show"),i.ignore=i.normalIgnore=!f.get("show"),i.hoverIgnore=!p.get("show"),i.setStyle({stroke:h}),i.setStyle(f.getModel("lineStyle").getLineStyle()),n.hoverStyle=o(t,e,"emphasis",d),i.hoverStyle=p.getModel("lineStyle").getLineStyle()},a.inherits(n,r.Group);var u=i(28).extend({type:"funnel",render:function(t,e,i){var o=t.getData(),r=this._data,a=this.group;o.diff(r).add(function(t){var e=new n(o,t);o.setItemGraphicEl(t,e),a.add(e)}).update(function(t,e){var i=r.getItemGraphicEl(e);i.updateData(o,t),a.add(i),o.setItemGraphicEl(t,i)}).remove(function(t){var e=r.getItemGraphicEl(t);a.remove(e)}).execute(),this._data=o},remove:function(){this.group.removeAll(),this._data=null; -},dispose:function(){}});t.exports=u},function(t,e,i){function n(t,e){return a.getLayoutRect(t.getBoxLayoutParams(),{width:e.getWidth(),height:e.getHeight()})}function o(t,e){for(var i=t.mapArray("value",function(t){return t}),n=[],o="ascending"===e,r=0,a=t.count();r=t&&(0===e?0:n[e-1][0]).4?"bottom":"middle",textAlign:k<-.4?"left":k>.4?"right":"center"},silent:!0});"auto"===N.style.fill&&N.setStyle({fill:n(P/b)}),d.add(N)}if(x.get("show")&&P!==b){for(var V=0;V<=w;V++){var k=Math.cos(I),O=Math.sin(I),B=new a.Line({shape:{x1:k*g+f,y1:O*g+p,x2:k*(g-M)+f,y2:O*(g-M)+p},silent:!0,style:C});"auto"===C.stroke&&B.setStyle({stroke:n((P+V/w)/b)}),d.add(B),I+=A}I-=A}else I+=T}},_renderPointer:function(t,e,i,n,o,u,h,c){var d=this.group,f=this._data;if(!t.get("pointer.show"))return void f.eachItemGraphicEl(function(t){d.remove(t)});var p=[+t.get("min"),+t.get("max")],g=[u,h],m=t.getData();m.diff(f).add(function(e){var i=new r({shape:{angle:u}});a.updateProps(i,{shape:{angle:s.linearMap(m.get("value",e),p,g,!0)}},t),d.add(i),m.setItemGraphicEl(e,i)}).update(function(e,i){var n=f.getItemGraphicEl(i);a.updateProps(n,{shape:{angle:s.linearMap(m.get("value",e),p,g,!0)}},t),d.add(n),m.setItemGraphicEl(e,n)}).remove(function(t){var e=f.getItemGraphicEl(t);d.remove(e)}).execute(),m.eachItemGraphicEl(function(t,e){var i=m.getItemModel(e),r=i.getModel("pointer");t.setShape({x:o.cx,y:o.cy,width:l(r.get("width"),o.r),r:l(r.get("length"),o.r)}),t.useStyle(i.getModel("itemStyle.normal").getItemStyle()),"auto"===t.style.fill&&t.setStyle("fill",n((m.get("value",e)-p[0])/(p[1]-p[0]))),a.setHoverStyle(t,i.getModel("itemStyle.emphasis").getItemStyle())}),this._data=m},_renderTitle:function(t,e,i,n,o){var r=t.getModel("title");if(r.get("show")){var s=r.getModel("textStyle"),u=r.get("offsetCenter"),h=o.cx+l(u[0],o.r),c=o.cy+l(u[1],o.r),d=new a.Text({style:{x:h,y:c,text:t.getData().getName(0),fill:s.getTextColor(),textFont:s.getFont(),textAlign:"center",textVerticalAlign:"middle"}});this.group.add(d)}},_renderDetail:function(t,e,i,n,r){var u=t.getModel("detail"),h=+t.get("min"),c=+t.get("max");if(u.get("show")){var d=u.getModel("textStyle"),f=u.get("offsetCenter"),p=r.cx+l(f[0],r.r),g=r.cy+l(f[1],r.r),m=l(u.get("width"),r.r),v=l(u.get("height"),r.r),y=t.getData().get("value",0),x=new a.Rect({shape:{x:p-m/2,y:g-v/2,width:m,height:v},style:{text:o(y,u.get("formatter")),fill:u.get("backgroundColor"),textFill:d.getTextColor(),textFont:d.getFont()}});"auto"===x.style.textFill&&x.setStyle("textFill",n(s.linearMap(y,[h,c],[0,1],!0))),x.setStyle(u.getItemStyle(["color"])),this.group.add(x)}}});t.exports=h},function(t,e,i){t.exports=i(7).extend({type:"echartsGaugePointer",shape:{angle:0,width:10,r:10,x:0,y:0},buildPath:function(t,e){var i=Math.cos,n=Math.sin,o=e.r,r=e.width,a=e.angle,s=e.x-i(a)*r*(r>=o/3?1:2),l=e.y-n(a)*r*(r>=o/3?1:2);a=e.angle-Math.PI/2,t.moveTo(s,l),t.lineTo(e.x+i(a)*r,e.y+n(a)*r),t.lineTo(e.x+i(e.angle)*o,e.y+n(e.angle)*o),t.lineTo(e.x-i(a)*r,e.y-n(a)*r),t.lineTo(s,l)}})},function(t,e,i){var n=i(2),o=i(1);i(273),i(274),i(283),n.registerProcessor(i(276)),n.registerVisual(o.curry(i(45),"graph","circle",null)),n.registerVisual(i(277)),n.registerVisual(i(280)),n.registerLayout(i(284)),n.registerLayout(i(278)),n.registerLayout(i(282)),n.registerCoordinateSystem("graphView",{create:i(279)})},function(t,e,i){"use strict";var n=i(14),o=i(1),r=i(6),a=i(11),s=i(8),l=i(230),u=i(2).extendSeriesModel({type:"series.graph",init:function(t){u.superApply(this,"init",arguments),this.legendDataProvider=function(){return this._categoriesData},this.fillDataTextStyle(t.edges||t.links),this._updateCategoriesData()},mergeOption:function(t){u.superApply(this,"mergeOption",arguments),this.fillDataTextStyle(t.edges||t.links),this._updateCategoriesData()},mergeDefaultAndTheme:function(t){u.superApply(this,"mergeDefaultAndTheme",arguments),r.defaultEmphasis(t.edgeLabel,r.LABEL_OPTIONS)},getInitialData:function(t,e){function i(t,i){function n(t){return t=this.parsePath(t),t&&"label"===t[0]?s:this.parentModel}t.wrapMethod("getItemModel",function(t){var e=r._categoriesModels,i=t.getShallow("category"),n=e[i];return n&&(n.parentModel=t.parentModel,t.parentModel=n),t});var o=r.getModel("edgeLabel"),s=new a({label:o.option},o.parentModel,e);i.wrapMethod("getItemModel",function(t){return t.customizeGetParent(n),t})}var n=t.edges||t.links||[],o=t.data||t.nodes||[],r=this;if(o&&n)return l(o,n,this,!0,i).data},getGraph:function(){return this.getData().graph},getEdgeData:function(){return this.getGraph().edgeData},getCategoriesData:function(){return this._categoriesData},formatTooltip:function(t,e,i){if("edge"===i){var n=this.getData(),o=this.getDataParams(t,i),r=n.graph.getEdgeByIndex(t),a=n.getName(r.node1.dataIndex),l=n.getName(r.node2.dataIndex),h=[];return null!=a&&h.push(a),null!=l&&h.push(l),h=s.encodeHTML(h.join(" > ")),o.value&&(h+=" : "+s.encodeHTML(o.value)),h}return u.superApply(this,"formatTooltip",arguments)},_updateCategoriesData:function(){var t=o.map(this.option.categories||[],function(t){return null!=t.value?t:o.extend({value:0},t)}),e=new n(["value"],this);e.initData(t),this._categoriesData=e,this._categoriesModels=e.mapArray(function(t){return e.getItemModel(t,!0)})},setZoom:function(t){this.option.zoom=t},setCenter:function(t){this.option.center=t},isAnimationEnabled:function(){return u.superCall(this,"isAnimationEnabled")&&!("force"===this.get("layout")&&this.get("force.layoutAnimation"))},defaultOption:{zlevel:0,z:2,coordinateSystem:"view",legendHoverLink:!0,hoverAnimation:!0,layout:null,focusNodeAdjacency:!1,circular:{rotateLabel:!1},force:{initLayout:null,repulsion:[0,50],gravity:.1,edgeLength:30,layoutAnimation:!0},left:"center",top:"center",symbol:"circle",symbolSize:10,edgeSymbol:["none","none"],edgeSymbolSize:10,edgeLabel:{normal:{position:"middle"},emphasis:{}},draggable:!1,roam:!1,center:null,zoom:1,nodeScaleRatio:.6,label:{normal:{show:!1,formatter:"{b}"},emphasis:{show:!0}},itemStyle:{normal:{},emphasis:{}},lineStyle:{normal:{color:"#aaa",width:1,curveness:0,opacity:.5},emphasis:{}}}});t.exports=u},function(t,e,i){function n(t,e){return t.getVisual("opacity")||t.getModel().get(e)}var o=i(39),r=i(99),a=i(84),s=i(3),l=i(275),u=i(1),h=["itemStyle","normal","opacity"],c=["lineStyle","normal","opacity"];i(2).extendChartView({type:"graph",init:function(t,e){var i=new o,n=new r,s=this.group,l=new a(e.getZr(),s);s.add(i.group),s.add(n.group),this._symbolDraw=i,this._lineDraw=n,this._controller=l,this._firstRender=!0},render:function(t,e,i){var n=t.coordinateSystem;this._model=t,this._nodeScaleRatio=t.get("nodeScaleRatio");var o=this._symbolDraw,r=this._lineDraw,a=this.group;if("view"===n.type){var u={position:n.position,scale:n.scale};this._firstRender?a.attr(u):s.updateProps(a,u,t)}l(t.getGraph(),this._getNodeGlobalScale(t));var h=t.getData();o.updateData(h);var c=t.getEdgeData();r.updateData(c),this._updateNodeAndLinkScale(),this._updateController(t,i),clearTimeout(this._layoutTimeout);var d=t.forceLayout,f=t.get("force.layoutAnimation");d&&this._startForceLayoutIteration(d,f),h.eachItemGraphicEl(function(e,n){var o=h.getItemModel(n);e.off("drag").off("dragend");var r=h.getItemModel(n).get("draggable");r&&e.on("drag",function(){d&&(d.warmUp(),!this._layouting&&this._startForceLayoutIteration(d,f),d.setFixed(n),h.setItemLayout(n,e.position))},this).on("dragend",function(){d&&d.setUnfixed(n)},this),e.setDraggable(r&&d),e.off("mouseover",e.__focusNodeAdjacency),e.off("mouseout",e.__unfocusNodeAdjacency),o.get("focusNodeAdjacency")&&(e.on("mouseover",e.__focusNodeAdjacency=function(){i.dispatchAction({type:"focusNodeAdjacency",seriesId:t.id,dataIndex:e.dataIndex})}),e.on("mouseout",e.__unfocusNodeAdjacency=function(){i.dispatchAction({type:"unfocusNodeAdjacency",seriesId:t.id})}))},this);var p="circular"===t.get("layout")&&t.get("circular.rotateLabel"),g=h.getLayout("cx"),m=h.getLayout("cy");h.eachItemGraphicEl(function(t,e){var i=t.getSymbolPath();if(p){var n=h.getItemLayout(e),o=Math.atan2(n[1]-m,n[0]-g);o<0&&(o=2*Math.PI+o);var r=n[0]=0?n+=g:n-=g:_>=0?n-=g:n+=g}return n}var o=i(18),r=i(5),a=[],s=[],l=[],u=o.quadraticAt,h=r.distSquare,c=Math.abs;t.exports=function(t,e){function i(t){var e=t.getVisual("symbolSize");return e instanceof Array&&(e=(e[0]+e[1])/2),e}var a=[],s=o.quadraticSubdivide,l=[[],[],[]],u=[[],[]],h=[];e/=2,t.eachEdge(function(t,o){var c=t.getLayout(),d=t.getVisual("fromSymbol"),f=t.getVisual("toSymbol");c.__original||(c.__original=[r.clone(c[0]),r.clone(c[1])],c[2]&&c.__original.push(r.clone(c[2])));var p=c.__original;if(null!=c[2]){if(r.copy(l[0],p[0]),r.copy(l[1],p[2]),r.copy(l[2],p[1]),d&&"none"!=d){var g=i(t.node1),m=n(l,p[0],g*e);s(l[0][0],l[1][0],l[2][0],m,a),l[0][0]=a[3],l[1][0]=a[4],s(l[0][1],l[1][1],l[2][1],m,a),l[0][1]=a[3],l[1][1]=a[4]}if(f&&"none"!=f){var g=i(t.node2),m=n(l,p[1],g*e);s(l[0][0],l[1][0],l[2][0],m,a),l[1][0]=a[1],l[2][0]=a[2],s(l[0][1],l[1][1],l[2][1],m,a),l[1][1]=a[1],l[2][1]=a[2]}r.copy(c[0],l[0]),r.copy(c[1],l[2]),r.copy(c[2],l[1])}else{if(r.copy(u[0],p[0]),r.copy(u[1],p[1]),r.sub(h,u[1],u[0]),r.normalize(h,h),d&&"none"!=d){var g=i(t.node1);r.scaleAndAdd(u[0],u[0],h,g*e)}if(f&&"none"!=f){var g=i(t.node2);r.scaleAndAdd(u[1],u[1],h,-g*e)}r.copy(c[0],u[0]),r.copy(c[1],u[1])}})}},function(t,e){t.exports=function(t){var e=t.findComponents({mainType:"legend"});e&&e.length&&t.eachSeriesByType("graph",function(t){var i=t.getCategoriesData(),n=t.getGraph(),o=n.data,r=i.mapArray(i.getName);o.filterSelf(function(t){var i=o.getItemModel(t),n=i.getShallow("category");if(null!=n){"number"==typeof n&&(n=r[n]);for(var a=0;a0){var L=a(x)?l:u;x>0&&(x=x*T+M),b[w++]=L[A],b[w++]=L[A+1],b[w++]=L[A+2],b[w++]=L[A+3]*x*256}else w+=4}return d.putImageData(_,0,0),c},_getBrush:function(){var t=this._brushCanvas||(this._brushCanvas=r.createCanvas()),e=this.pointSize+this.blurSize,i=2*e;t.width=i,t.height=i;var n=t.getContext("2d");return n.clearRect(0,0,i,i),n.shadowOffsetX=i,n.shadowBlur=this.blurSize,n.shadowColor="#000",n.beginPath(),n.arc(-e,e,this.pointSize,0,2*Math.PI,!0),n.closePath(),n.fill(),t},_getGradient:function(t,e,i){for(var n=this._gradientPixels,o=n[i]||(n[i]=new Uint8ClampedArray(1024)),r=[],a=0,s=0;s<256;s++)e[i](s/255,!0,r),o[a++]=r[0],o[a++]=r[1],o[a++]=r[2],o[a++]=r[3];return o}},t.exports=n},function(t,e,i){var n=i(16),o=i(35);t.exports=n.extend({type:"series.heatmap",getInitialData:function(t,e){return o(t.data,this,e)},defaultOption:{coordinateSystem:"cartesian2d",zlevel:0,z:2,geoIndex:0,blurSize:30,pointSize:20,maxOpacity:1,minOpacity:0}})},function(t,e,i){function n(t,e,i){var n=t[1]-t[0];e=l.map(e,function(e){return{interval:[(e.interval[0]-t[0])/n,(e.interval[1]-t[0])/n]}});var o=e.length,r=0;return function(t){for(var n=r;n=0;n--){var a=e[n].interval;if(a[0]<=t&&t<=a[1]){r=n;break}}return n>=0&&n=e[0]&&t<=e[1]}}function r(t){var e=t.dimensions;return"lng"===e[0]&&"lat"===e[1]}var a=i(3),s=i(286),l=i(1);t.exports=i(2).extendChartView({type:"heatmap",render:function(t,e,i){var n;e.eachComponent("visualMap",function(e){e.eachTargetSeries(function(i){i===t&&(n=e)})}),this.group.removeAll();var o=t.coordinateSystem;"cartesian2d"===o.type?this._renderOnCartesian(o,t,i):r(o)&&this._renderOnGeo(o,t,n,i)},dispose:function(){},_renderOnCartesian:function(t,e,i){var n=t.getAxis("x"),o=t.getAxis("y"),r=this.group,s=n.getBandWidth(),u=o.getBandWidth(),h=e.getData(),c="itemStyle.normal",d="itemStyle.emphasis",f="label.normal",p="label.emphasis",g=e.getModel(c).getItemStyle(["color"]),m=e.getModel(d).getItemStyle(),v=e.getModel("label.normal"),y=e.getModel("label.emphasis");h.each(["x","y","z"],function(i,n,o,x){var _=h.getItemModel(x),b=t.dataToPoint([i,n]);if(!isNaN(o)){var w=new a.Rect({shape:{x:b[0]-s/2,y:b[1]-u/2,width:s,height:u},style:{fill:h.getItemVisual(x,"color"),opacity:h.getItemVisual(x,"opacity")}});h.hasItemOption&&(g=_.getModel(c).getItemStyle(["color"]),m=_.getModel(d).getItemStyle(),v=_.getModel(f),y=_.getModel(p));var S=e.getRawValue(x),M="-";S&&null!=S[2]&&(M=S[2]),v.getShallow("show")&&(a.setText(g,v),g.text=e.getFormattedLabel(x,"normal")||M),y.getShallow("show")&&(a.setText(m,y),m.text=e.getFormattedLabel(x,"emphasis")||M),w.setStyle(g),a.setHoverStyle(w,h.hasItemOption?m:l.extend({},m)),r.add(w),h.setItemGraphicEl(x,w)}})},_renderOnGeo:function(t,e,i,r){var l=i.targetVisuals.inRange,u=i.targetVisuals.outOfRange,h=e.getData(),c=this._hmLayer||this._hmLayer||new s;c.blurSize=e.get("blurSize"),c.pointSize=e.get("pointSize"),c.minOpacity=e.get("minOpacity"),c.maxOpacity=e.get("maxOpacity");var d=t.getViewRect().clone(),f=t.getRoamTransform().transform;d.applyTransform(f);var p=Math.max(d.x,0),g=Math.max(d.y,0),m=Math.min(d.width+d.x,r.getWidth()),v=Math.min(d.height+d.y,r.getHeight()),y=m-p,x=v-g,_=h.mapArray(["lng","lat","value"],function(e,i,n){var o=t.dataToPoint([e,i]);return o[0]-=p,o[1]-=g,o.push(n),o}),b=i.getExtent(),w="visualMap.continuous"===i.type?o(b,i.option.range):n(b,i.getPieceList(),i.option.selected);c.update(_,y,x,l.color.getNormalizer(),{inRange:l.color.getColorMapper(),outOfRange:u.color.getColorMapper()},w);var S=new a.Image({style:{width:y,height:x,x:p,y:g,image:c.canvas},silent:!0});this.group.add(S)}})},function(t,e,i){function n(t,e,i){a.call(this,t,e,i),this._lastFrame=0,this._lastFramePercent=0}var o=i(229),r=i(1),a=i(228),s=i(5),l=n.prototype;l.createLine=function(t,e,i){return new o(t,e,i)},l.updateAnimationPoints=function(t,e){this._points=e;for(var i=[0],n=0,o=1;o=0&&!(n[r]<=e);r--);r=Math.min(r,o-2)}else{for(var r=a;re);r++);r=Math.min(r-1,o-2)}s.lerp(t.position,i[r],i[r+1],(e-n[r])/(n[r+1]-n[r]));var u=i[r+1][0]-i[r][0],h=i[r+1][1]-i[r][1];t.rotation=-Math.atan2(h,u)-Math.PI/2,this._lastFrame=r,this._lastFramePercent=e,t.ignore=!1}},r.inherits(n,a),t.exports=n},function(t,e,i){function n(t){return a.isArray(t)||(t=[+t,+t]),t}function o(t,e){t.eachChild(function(t){t.attr({z:e.z,zlevel:e.zlevel,style:{stroke:"stroke"===e.brushType?e.color:null,fill:"fill"===e.brushType?e.color:null}})})}function r(t,e){c.call(this);var i=new h(t,e),n=new c;this.add(i),this.add(n),n.beforeUpdate=function(){this.attr(i.getScale())},this.updateData(t,e)}var a=i(1),s=i(24),l=i(3),u=i(4),h=i(50),c=l.Group,d=3,f=r.prototype;f.stopEffectAnimation=function(){this.childAt(1).removeAll()},f.startEffectAnimation=function(t){for(var e=t.symbolType,i=t.color,n=this.childAt(1),r=0;r2?t.quadraticCurveTo(r[2][0],r[2][1],r[1][0],r[1][1]):t.lineTo(r[1][0],r[1][1]); -}},findDataIndex:function(t,e){for(var i=this.shape,n=i.segs,o=i.polyline,s=Math.max(this.style.lineWidth,1),l=0;l2){if(r.containStroke(u[0][0],u[0][1],u[2][0],u[2][1],u[1][0],u[1][1],s,t,e))return l}else if(a.containStroke(u[0][0],u[0][1],u[1][0],u[1][1],s,t,e))return l}return-1}}),l=n.prototype;l.updateData=function(t){this.group.removeAll();var e=this._lineEl,i=t.hostModel;e.setShape({segs:t.mapArray(t.getItemLayout),polyline:i.get("polyline")}),e.useStyle(i.getModel("lineStyle.normal").getLineStyle());var n=t.getVisual("color");n&&e.setStyle("stroke",n),e.setStyle("fill"),e.seriesIndex=i.seriesIndex,e.on("mousemove",function(t){e.dataIndex=null;var i=e.findDataIndex(t.offsetX,t.offsetY);i>0&&(e.dataIndex=i)}),this.group.add(e)},l.updateLayout=function(t){var e=t.getData();this._lineEl.setShape({segs:e.mapArray(e.getItemLayout)})},l.remove=function(){this.group.removeAll()},t.exports=n},function(t,e,i){function n(t,e,i,n){l.Group.call(this),this.bodyIndex,this.whiskerIndex,this.styleUpdater=i,this._createContent(t,e,n),this.updateData(t,e,n),this._seriesModel}function o(t,e,i){return s.map(t,function(t){return t=t.slice(),t[e]=i.initBaseline,t})}function r(t){var e={};return s.each(t,function(t,i){e["ends"+i]=t}),e}function a(t){this.group=new l.Group,this.styleUpdater=t}var s=i(1),l=i(3),u=i(7),h=u.extend({type:"whiskerInBox",shape:{},buildPath:function(t,e){for(var i in e)if(e.hasOwnProperty(i)&&0===i.indexOf("ends")){var n=e[i];t.moveTo(n[0][0],n[0][1]),t.lineTo(n[1][0],n[1][1])}}}),c=n.prototype;c._createContent=function(t,e,i){var n=t.getItemLayout(e),a="horizontal"===n.chartLayout?1:0,u=0;this.add(new l.Polygon({shape:{points:i?o(n.bodyEnds,a,n):n.bodyEnds},style:{strokeNoScale:!0},z2:100})),this.bodyIndex=u++;var c=s.map(n.whiskerEnds,function(t){return i?o(t,a,n):t});this.add(new h({shape:r(c),style:{strokeNoScale:!0},z2:100})),this.whiskerIndex=u++},c.updateData=function(t,e,i){var n=this._seriesModel=t.hostModel,o=t.getItemLayout(e),a=l[i?"initProps":"updateProps"];a(this.childAt(this.bodyIndex),{shape:{points:o.bodyEnds}},n,e),a(this.childAt(this.whiskerIndex),{shape:r(o.whiskerEnds)},n,e),this.styleUpdater.call(null,this,t,e)},s.inherits(n,l.Group);var d=a.prototype;d.updateData=function(t){var e=this.group,i=this._data,o=this.styleUpdater;t.diff(i).add(function(i){if(t.hasValue(i)){var r=new n(t,i,o,(!0));t.setItemGraphicEl(i,r),e.add(r)}}).update(function(r,a){var s=i.getItemGraphicEl(a);return t.hasValue(r)?(s?s.updateData(t,r):s=new n(t,r,o),e.add(s),void t.setItemGraphicEl(r,s)):void e.remove(s)}).remove(function(t){var n=i.getItemGraphicEl(t);n&&e.remove(n)}).execute(),this._data=t},d.remove=function(){var t=this.group,e=this._data;this._data=null,e&&e.eachItemGraphicEl(function(e){e&&t.remove(e)})},t.exports=a},function(t,e,i){i(294),i(295);var n=i(2);n.registerLayout(i(296)),n.registerVisual(i(297))},function(t,e,i){"use strict";function n(t){var e=t.data;e&&e[0]&&e[0][0]&&e[0][0].coord&&(t.data=a.map(e,function(t){var e=[t[0].coord,t[1].coord],i={coords:e};return t[0].name&&(i.fromName=t[0].name),t[1].name&&(i.toName=t[1].name),a.mergeAll([i,t[0],t[1]])}))}var o=i(16),r=i(14),a=i(1),s=i(8),l=(i(23),o.extend({type:"series.lines",dependencies:["grid","polar"],visualColorAccessPath:"lineStyle.normal.color",init:function(t){n(t),l.superApply(this,"init",arguments)},mergeOption:function(t){n(t),l.superApply(this,"mergeOption",arguments)},getInitialData:function(t,e){var i=new r(["value"],this);return i.hasItemOption=!1,i.initData(t.data,[],function(t,e,n,o){if(t instanceof Array)return NaN;i.hasItemOption=!0;var r=t.value;return null!=r?r instanceof Array?r[o]:r:void 0}),i},formatTooltip:function(t){var e=this.getData(),i=e.getItemModel(t),n=i.get("name");if(n)return n;var o=i.get("fromName"),r=i.get("toName"),a=[];return null!=o&&a.push(o),null!=r&&a.push(r),s.encodeHTML(a.join(" > "))},defaultOption:{coordinateSystem:"geo",zlevel:0,z:2,legendHoverLink:!0,hoverAnimation:!0,xAxisIndex:0,yAxisIndex:0,symbol:["none","none"],symbolSize:[10,10],geoIndex:0,effect:{show:!1,period:4,constantSpeed:0,symbol:"circle",symbolSize:3,loop:!0,trailLength:.2},large:!1,largeThreshold:2e3,polyline:!1,label:{normal:{show:!1,position:"end"}},lineStyle:{normal:{opacity:.5}}}}))},function(t,e,i){var n=i(99),o=i(228),r=i(98),a=i(229),s=i(289),l=i(291);i(2).extendChartView({type:"lines",init:function(){},render:function(t,e,i){var u=t.getData(),h=this._lineDraw,c=t.get("effect.show"),d=t.get("polyline"),f=t.get("large")&&u.count()>=t.get("largeThreshold");c===this._hasEffet&&d===this._isPolyline&&f===this._isLarge||(h&&h.remove(),h=this._lineDraw=f?new l:new n(d?c?s:a:c?o:r),this._hasEffet=c,this._isPolyline=d,this._isLarge=f);var p=t.get("zlevel"),g=t.get("effect.trailLength"),m=i.getZr();if(m.painter.getLayer(p).clear(!0),null!=this._lastZlevel&&m.configLayer(this._lastZlevel,{motionBlur:!1}),c&&g){m.configLayer(p,{motionBlur:!0,lastFrameAlpha:Math.max(Math.min(g/10+.9,1),0)})}this.group.add(h.group),h.updateData(u),this._lastZlevel=p},updateLayout:function(t,e,i){this._lineDraw.updateLayout(t);var n=i.getZr();n.painter.getLayer(this._lastZlevel).clear(!0)},remove:function(t,e){this._lineDraw&&this._lineDraw.remove(e,!0)},dispose:function(){}})},function(t,e,i){t.exports=function(t){t.eachSeriesByType("lines",function(t){var e=t.coordinateSystem,i=t.getData();i.each(function(n){var o=i.getItemModel(n),r=o.option instanceof Array?o.option:o.get("coords"),a=[];if(t.get("polyline"))for(var s=0;s"+l(n+" : "+i)},getTooltipPosition:function(t){if(null!=t){var e=this.getData().getName(t),i=this.coordinateSystem,n=i.getRegion(e);return n&&i.dataToPoint(n.center)}},setZoom:function(t){this.option.zoom=t},setCenter:function(t){this.option.center=t},defaultOption:{zlevel:0,z:2,coordinateSystem:"geo",map:"",left:"center",top:"center",aspectScale:.75,showLegendSymbol:!0,dataRangeHoverLink:!0,center:null,zoom:1,scaleLimit:null,label:{normal:{show:!1,textStyle:{color:"#000"}},emphasis:{show:!0,textStyle:{color:"rgb(100,0,0)"}}},itemStyle:{normal:{borderWidth:.5,borderColor:"#444",areaColor:"#eee"},emphasis:{areaColor:"rgba(255,215,0,0.8)"}}}});r.mixin(d,h),t.exports=d},function(t,e,i){var n=i(3),o=i(231);i(2).extendChartView({type:"map",render:function(t,e,i,n){if(!n||"mapToggleSelect"!==n.type||n.from!==this.uid){var r=this.group;if(r.removeAll(),!t.getHostGeoModel()){if(n&&"geoRoam"===n.type&&"series"===n.componentType&&n.seriesId===t.id){var a=this._mapDraw;a&&r.add(a.group)}else if(t.needsDrawMap){var a=this._mapDraw||new o(i,(!0));r.add(a.group),a.draw(t,e,i,this,n),this._mapDraw=a}else this._mapDraw&&this._mapDraw.remove(),this._mapDraw=null;t.get("showLegendSymbol")&&e.getComponent("legend")&&this._renderSymbols(t,e,i)}}},remove:function(){this._mapDraw&&this._mapDraw.remove(),this._mapDraw=null,this.group.removeAll()},dispose:function(){this._mapDraw&&this._mapDraw.remove(),this._mapDraw=null},_renderSymbols:function(t,e,i){var o=t.originalData,r=this.group;o.each("value",function(e,i){if(!isNaN(e)){var a=o.getItemLayout(i);if(a&&a.point){var s=a.point,l=a.offset,u=new n.Circle({style:{fill:t.getData().getVisual("color")},shape:{cx:s[0]+9*l,cy:s[1],r:3},silent:!0,z2:10});if(!l){var h=t.mainSeries.getData(),c=o.getName(i),d=c,f=h.indexOfName(c),p=o.getItemModel(i),g=p.getModel("label.normal"),m=p.getModel("label.emphasis"),v=g.getModel("textStyle"),y=m.getModel("textStyle"),x=h.getItemGraphicEl(f);u.setStyle({textPosition:"bottom"});var _=function(){u.setStyle({text:m.get("show")?d:"",textFill:y.getTextColor(),textFont:y.getFont()})},b=function(){u.setStyle({text:g.get("show")?d:"",textFill:v.getTextColor(),textFont:v.getFont()})};x.on("mouseover",_).on("mouseout",b).on("emphasis",_).on("normal",b),b()}r.add(u)}}})}})},function(t,e,i){var n=i(1);t.exports=function(t){var e=[];n.each(t.series,function(t){"map"===t.type&&e.push(t)}),n.each(e,function(t){t.map=t.map||t.mapType,n.defaults(t,t.mapLocation)})}},function(t,e,i){function n(t,e){var i={},n=["value"];return o.each(t,function(t){t.each(n,function(e,n){var o=t.getName(n);i[o]=i[o]||[],isNaN(e)||i[o].push(e)})}),t[0].map(n,function(n,o){for(var r=t[0].getName(o),a=0,s=1/0,l=-(1/0),u=i[r].length,h=0;h=0?e:NaN}})}function o(t){return+t.replace("dim","")}function r(t,e){var i=0;s.each(t,function(t){var e=o(t);e>i&&(i=e)});var n=e[0];n&&n.length-1>i&&(i=n.length-1);for(var r=[],a=0;a<=i;a++)r.push("dim"+a);return r}var a=i(14),s=i(1),l=i(16),u=i(27);t.exports=l.extend({type:"series.parallel",dependencies:["parallel"],getInitialData:function(t,e){var i=e.getComponent("parallel",this.get("parallelIndex")),o=i.parallelAxisIndex,l=t.data,h=i.dimensions,c=r(h,l),d=s.map(c,function(t,i){var r=s.indexOf(h,t),a=r>=0&&e.getComponent("parallelAxis",o[r]);return a&&"category"===a.get("type")?(n(a,t,l),{name:t,type:"ordinal"}):r<0&&u.guessOrdinal(l,i)?{name:t,type:"ordinal"}:t}),f=new a(d,this);return f.initData(l),this.option.progressive&&(this.option.animation=!1),f},getRawIndicesByActiveState:function(t){var e=this.coordinateSystem,i=this.getData(),n=[];return e.eachActiveState(i,function(e,o){t===e&&n.push(i.getRawIndex(o))}),n},defaultOption:{zlevel:0,z:2,coordinateSystem:"parallel",parallelIndex:0,label:{normal:{show:!1},emphasis:{show:!1}},inactiveOpacity:.05,activeOpacity:1,lineStyle:{normal:{width:1,opacity:.45,type:"solid"}},progressive:!1,smooth:!1,animationEasing:"linear"}})},function(t,e,i){function n(t,e,i){var n=t.model,o=t.getRect(),r=new l.Rect({shape:{x:o.x,y:o.y,width:o.width,height:o.height}}),a="horizontal"===n.get("layout")?"width":"height";return r.setShape(a,0),l.initProps(r,{shape:{width:o.width,height:o.height}},e,i),r}function o(t,e,i,n){for(var o=[],r=0;r"+a.map(n,function(t,i){return s(t.name+" : "+e[i])}).join("
")},defaultOption:{zlevel:0,z:2,coordinateSystem:"radar",legendHoverLink:!0,radarIndex:0,lineStyle:{normal:{width:2,type:"solid"}},label:{normal:{position:"top"}},symbol:"emptyCircle",symbolSize:4}});t.exports=l},function(t,e,i){function n(t){return r.isArray(t)||(t=[+t,+t]),t}var o=i(3),r=i(1),a=i(24);t.exports=i(2).extendChartView({type:"radar",render:function(t,e,i){function s(t,e){var i=t.getItemVisual(e,"symbol")||"circle",o=t.getItemVisual(e,"color");if("none"!==i){var r=a.createSymbol(i,-.5,-.5,1,1,o);return r.attr({style:{strokeNoScale:!0},z2:100,scale:n(t.getItemVisual(e,"symbolSize"))}),r}}function l(e,i,n,r,a,l){n.removeAll();for(var u=0;u0;o--)a*=.99,d(r,a),c(r,n,i),p(r,a),c(r,n,i)}function h(t,e,i,n,o){var r=[];T.each(e,function(t){var e=t.length,i=0;T.each(t,function(t){i+=t.getLayout().value});var a=(n-(e-1)*o)/i;r.push(a)}),r.sort(function(t,e){return t-e});var a=r[0];T.each(e,function(t){T.each(t,function(t,e){t.setLayout({y:e},!0);var i=t.getLayout().value*a;t.setLayout({dy:i},!0)})}),T.each(i,function(t){var e=+t.getValue()*a;t.setLayout({dy:e},!0)})}function c(t,e,i){T.each(t,function(t){var n,o,r,a=0,s=t.length;for(t.sort(b),r=0;r0){var l=n.getLayout().y+o;n.setLayout({y:l},!0)}a=n.getLayout().y+n.getLayout().dy+e}if(o=a-e-i,o>0){var l=n.getLayout().y-o;for(n.setLayout({y:l},!0),a=n.getLayout().y,r=s-2;r>=0;--r)n=t[r],o=n.getLayout().y+n.getLayout().dy+e-a,o>0&&(l=n.getLayout().y-o,n.setLayout({y:l},!0)),a=n.getLayout().y}})}function d(t,e){T.each(t.slice().reverse(),function(t){T.each(t,function(t){if(t.outEdges.length){var i=x(t.outEdges,f)/x(t.outEdges,S),n=t.getLayout().y+(i-_(t))*e;t.setLayout({y:n},!0)}})})}function f(t){return _(t.node2)*t.getValue()}function p(t,e){T.each(t,function(t){T.each(t,function(t){if(t.inEdges.length){var i=x(t.inEdges,g)/x(t.inEdges,S),n=t.getLayout().y+(i-_(t))*e;t.setLayout({y:n},!0)}})})}function g(t){return _(t.node1)*t.getValue()}function m(t){T.each(t,function(t){t.outEdges.sort(v),t.inEdges.sort(y)}),T.each(t,function(t){var e=0,i=0;T.each(t.outEdges,function(t){t.setLayout({sy:e},!0),e+=t.getLayout().dy}),T.each(t.inEdges,function(t){t.setLayout({ty:i},!0),i+=t.getLayout().dy})})}function v(t,e){return t.node2.getLayout().y-e.node2.getLayout().y}function y(t,e){return t.node1.getLayout().y-e.node1.getLayout().y}function x(t,e){for(var i=0,n=t.length,o=-1;++oe?1:t===e?0:NaN}function S(t){return t.getValue()}var M=i(12),I=i(245),T=i(1);t.exports=function(t,e,i){t.eachSeriesByType("sankey",function(t){var i=t.get("nodeWidth"),a=t.get("nodeGap"),s=n(t,e);t.layoutInfo=s;var l=s.width,u=s.height,h=t.getGraph(),c=h.nodes,d=h.edges;r(c);var f=c.filter(function(t){return 0===t.getLayout().value}),p=0!==f.length?0:t.get("layoutIterations");o(c,d,i,a,l,u,p)})}},function(t,e,i){var n=i(73),o=i(1);t.exports=function(t,e){t.eachSeriesByType("sankey",function(t){var e=t.getGraph(),i=e.nodes;i.sort(function(t,e){return t.getLayout().value-e.getLayout().value});var r=i[0].getLayout().value,a=i[i.length-1].getLayout().value;o.each(i,function(e){var i=new n({type:"color",mappingMethod:"linear",dataExtent:[r,a],visual:t.get("color")}),o=i.mapValueToVisual(e.getLayout().value);e.setVisual("color",o);var s=e.getModel(),l=s.get("itemStyle.normal.color");null!=l&&e.setVisual("color",l)})})}},function(t,e,i){var n=i(2),o=i(1);i(233),i(321),i(322),n.registerLayout(i(323)),n.registerVisual(i(324)),n.registerProcessor(o.curry(i(58),"themeRiver"))},function(t,e,i){"use strict";var n=i(27),o=i(16),r=i(14),a=i(1),s=i(8),l=s.encodeHTML,u=i(245),h=2,c=o.extend({type:"series.themeRiver",dependencies:["singleAxis"],nameMap:null,init:function(t){c.superApply(this,"init",arguments),this.legendDataProvider=function(){return this.getRawData()}},fixData:function(t){for(var e=t.length,i=u().key(function(t){return t[2]}).entries(t),n=a.map(i,function(t){return{name:t.key,dataList:t.values}}),o=n.length,r=-1,s=-1,l=0;lr&&(r=h,s=l)}for(var c=0;c",u=0;u"}return a},defaultOption:{zlevel:0,z:2,coordinateSystem:"singleAxis",boundaryGap:["10%","10%"],singleAxisIndex:0,animationEasing:"linear",label:{normal:{margin:4,textAlign:"right",show:!0,position:"left",textStyle:{color:"#000",fontSize:11}},emphasis:{show:!0}}}});t.exports=c},function(t,e,i){(function(e){function n(t,e,i){var n=new r.Rect({shape:{x:t.x-10,y:t.y-10,width:0,height:t.height+20}});return r.initProps(n,{shape:{width:t.width+20,height:t.height+20}},e,i),n}var o=i(82),r=i(3),a=i(1),s=i(43);t.exports=i(2).extendChartView({type:"themeRiver",init:function(){this._layers=[]},render:function(t,e,i){function l(t){return t.name}function u(e,i,s){var l=this._layers;if("remove"===e)return void d.remove(l[i]);for(var u,p=[],g=[],m=f[i].indices,v=0;va&&(a=e),o.push(e)}for(var h=0;ha&&(a=d)}return s.y0=r,s.max=a,s}var r=i(1),a=i(4);t.exports=function(t,e){t.eachSeriesByType("themeRiver",function(t){var e=t.getData(),i=t.coordinateSystem,o={},r=i.getRect();o.rect=r;var s=t.get("boundaryGap"),l=i.getAxis();if(o.boundaryGap=s,"horizontal"===l.orient){s[0]=a.parsePercent(s[0],r.height),s[1]=a.parsePercent(s[1],r.height);var u=r.height-s[0]-s[1];n(e,t,u)}else{s[0]=a.parsePercent(s[0],r.width),s[1]=a.parsePercent(s[1],r.width);var h=r.width-s[0]-s[1];n(e,t,h)}e.setLayout("layoutInfo",o)})}},function(t,e){t.exports=function(t){t.eachSeriesByType("themeRiver",function(t){var e=t.getData(),i=t.getRawData(),n=t.get("color");e.each(function(o){var r=e.getName(o),a=n[(t.nameMap[r]-1)%n.length];i.setItemVisual(o,"color",a)})})}},function(t,e,i){var n=i(2);i(327),i(328),i(329),n.registerVisual(i(331)),n.registerLayout(i(330))},function(t,e,i){function n(t){this.group=new a.Group,t.add(this.group)}function o(t,e,i,n,o,r){var a=[[o?t:t-d,e],[t+i,e],[t+i,e+n],[o?t:t-d,e+n]];return!r&&a.splice(2,0,[t+i+d,e+n/2]),!o&&a.push([t,e+n/2]),a}function r(t,e,i){t.eventData={componentType:"series",componentSubType:"treemap",seriesIndex:e.componentIndex,seriesName:e.name,seriesType:"treemap",selfType:"breadcrumb",nodeData:{dataIndex:i&&i.dataIndex,name:i&&i.name},treePathInfo:i&&u.wrapTreePathInfo(i,e)}}var a=i(3),s=i(12),l=i(1),u=i(83),h=8,c=8,d=5;n.prototype={constructor:n,render:function(t,e,i,n){var o=t.getModel("breadcrumb"),r=this.group;if(r.removeAll(),o.get("show")&&i){var a=o.getModel("itemStyle.normal"),l=a.getModel("textStyle"),u={pos:{left:o.get("left"),right:o.get("right"),top:o.get("top"),bottom:o.get("bottom")},box:{width:e.getWidth(),height:e.getHeight()},emptyItemWidth:o.get("emptyItemWidth"),totalWidth:0,renderList:[]};this._prepare(i,u,l),this._renderContent(t,u,a,l,n),s.positionElement(r,u.pos,u.box)}},_prepare:function(t,e,i){for(var n=t;n;n=n.parentNode){var o=n.getModel().get("name"),r=i.getTextRect(o),a=Math.max(r.width+2*h,e.emptyItemWidth);e.totalWidth+=a+c,e.renderList.push({node:n,text:o,width:a})}},_renderContent:function(t,e,i,n,u){for(var h=0,d=e.emptyItemWidth,f=t.get("breadcrumb.height"),p=s.getAvailableSize(e.pos,e.box),g=e.totalWidth,m=e.renderList,v=m.length-1;v>=0;v--){var y=m[v],x=y.node,_=y.width,b=y.text;g>p.width&&(g-=_-d,_=d,b="");var w=new a.Polygon({shape:{points:o(h,0,_,f,v===m.length-1,0===v)},style:l.defaults(i.getItemStyle(),{lineJoin:"bevel",text:b,textFill:n.getTextColor(),textFont:n.getFont()}),z:10,onclick:l.curry(u,x)});this.group.add(w),r(w,t,x),h+=_+c}},remove:function(){this.group.removeAll()}},t.exports=n},function(t,e,i){function n(t,e){var i=0;s.each(t.children,function(t){n(t,e);var o=t.value;s.isArray(o)&&(o=o[0]),i+=o});var o=t.value;e>=0&&(s.isArray(o)?o=o[0]:t.value=new Array(e)),(null==o||isNaN(o))&&(o=i),o<0&&(o=0),e>=0?t.value[0]=o:t.value=o}function o(t,e){var i=e.get("color");if(i){t=t||[];var n;if(s.each(t,function(t){var e=new l(t),i=e.get("color");(e.get("itemStyle.normal.color")||i&&"none"!==i)&&(n=!0)}),!n){var o=t[0]||(t[0]={});o.color=i.slice()}return t}}var r=i(16),a=i(393),s=i(1),l=i(11),u=i(8),h=i(83),c=u.encodeHTML,d=u.addCommas;t.exports=r.extend({type:"series.treemap",layoutMode:"box",dependencies:["grid","polar"],_viewRoot:null,defaultOption:{progressive:0,hoverLayerThreshold:1/0,left:"center",top:"middle",right:null,bottom:null,width:"80%",height:"80%",sort:!0,clipWindow:"origin",squareRatio:.5*(1+Math.sqrt(5)),leafDepth:null,drillDownIcon:"▶",zoomToNodeRatio:.1024,roam:!0,nodeClick:"zoomToNode",animation:!0,animationDurationUpdate:900,animationEasing:"quinticInOut",breadcrumb:{show:!0,height:22,left:"center",top:"bottom",emptyItemWidth:25,itemStyle:{normal:{color:"rgba(0,0,0,0.7)",borderColor:"rgba(255,255,255,0.7)",borderWidth:1,shadowColor:"rgba(150,150,150,1)",shadowBlur:3,shadowOffsetX:0,shadowOffsetY:0,textStyle:{color:"#fff"}},emphasis:{textStyle:{}}}},label:{normal:{show:!0,position:"inside",textStyle:{color:"#fff",ellipsis:!0}}},itemStyle:{normal:{color:null,colorAlpha:null,colorSaturation:null,borderWidth:0,gapWidth:0,borderColor:"#fff",borderColorSaturation:null},emphasis:{}},visualDimension:0,visualMin:null,visualMax:null,color:[],colorAlpha:null,colorSaturation:null,colorMappingBy:"index",visibleMin:10,childrenVisibleMin:null,levels:[]},getInitialData:function(t,e){var i=t.data||[],r=t.name;null==r&&(r=t.name);var l={name:r,children:t.data},u=(i[0]||{}).value;n(l,s.isArray(u)?u.length:-1);var h=t.levels||[];return h=t.levels=o(h,e),a.createTree(l,this,h).data},optionUpdated:function(){this.resetViewRoot()},formatTooltip:function(t){var e=this.getData(),i=this.getRawValue(t),n=d(s.isArray(i)?i[0]:i),o=e.getName(t);return c(o+": "+n)},getDataParams:function(t){var e=r.prototype.getDataParams.apply(this,arguments),i=this.getData().tree.getNodeByDataIndex(t);return e.treePathInfo=h.wrapTreePathInfo(i,this),e},setLayoutInfo:function(t){this.layoutInfo=this.layoutInfo||{},s.extend(this.layoutInfo,t)},mapIdToIndex:function(t){var e=this._idIndexMap;e||(e=this._idIndexMap={},this._idIndexMapCount=0);var i=e[t];return null==i&&(e[t]=i=this._idIndexMapCount++),i},getViewRoot:function(){return this._viewRoot},resetViewRoot:function(t){t?this._viewRoot=t:t=this._viewRoot;var e=this.getData().tree.root;t&&(t===e||e.contains(t))||(this._viewRoot=e)}})},function(t,e,i){function n(){return{nodeGroup:[],background:[],content:[]}}function o(t,e,i,n,o,l,u,h,c,d){function f(e){E.dataIndex=u.dataIndex,E.seriesIndex=t.seriesIndex;var i=T.borderWidth,n=Math.max(A-2*i,0),o=Math.max(L-2*i,0);E.culling=!0,E.setShape({x:i,y:i,width:n,height:o});var r=u.getVisual("color",!0);p(E,function(){var t={fill:r},e=u.getModel("itemStyle.emphasis").getItemStyle();g(t,e,r,n,o),E.setStyle(t),s.setHoverStyle(E,e)}),e.add(E)}function p(t,e){C?!t.invisible&&l.push(t):(e(),t.__tmWillVisible||(t.invisible=!1))}function g(e,i,n,o,r){var a=u.getModel(),s=a.get("name");if(T.isLeafRoot){var l=t.get("drillDownIcon",!0);s=l?l+" "+s:s}y(s,e,a,_,n,o,r),y(s,i,a,b,n,o,r)}function y(t,e,i,n,o,r,a){var l=i.getModel(n),u=l.getModel("textStyle");s.setText(e,l,o),e.textAlign=u.get("align"),e.textVerticalAlign=u.get("baseline");var h=u.getTextRect(t);!l.getShallow("show")||h.height>a?e.text="":h.width>r?e.text=u.get("ellipsis")?u.truncateText(t,r,null,{minChar:2}):"":e.text=t}function x(t,n,a,s){var l=null!=P&&i[t][P],u=o[t];return l?(i[t][P]=null,w(u,l,t)):C||(l=new n({z:r(a,s)}),l.__tmDepth=a,l.__tmStorageName=t,I(u,l,t)),e[t][D]=l}function w(t,e,i){var n=t[D]={};n.old="nodeGroup"===i?e.position.slice():a.extend({},e.shape)}function I(t,e,i){var r=t[D]={},a=u.parentNode;if(a&&(!n||"drillDown"===n.direction)){var s=0,l=0,h=o.background[a.getRawIndex()];!n&&h&&h.old&&(s=h.old.width,l=h.old.height),r.old="nodeGroup"===i?[0,l]:{x:s,y:l,width:0,height:0}}r.fadein="nodeGroup"!==i}if(u){var T=u.getLayout();if(T&&T.isInView){var A=T.width,L=T.height,C=T.invisible,D=u.getRawIndex(),P=h&&h.getRawIndex(),k=x("nodeGroup",m);if(k){if(c.add(k),k.attr("position",[T.x||0,T.y||0]),k.__tmNodeWidth=A,k.__tmNodeHeight=L,T.isAboveViewRoot)return k;var O=x("background",v,d,S);O&&(O.setShape({x:0,y:0,width:A,height:L}),p(O,function(){O.setStyle("fill",u.getVisual("borderColor",!0))}),k.add(O));var z=u.viewChildren;if(!z||!z.length){var E=x("content",v,d,M);E&&f(k)}return k}}}}function r(t,e){var i=t*w+e;return(i-1)/i}var a=i(1),s=i(3),l=i(43),u=i(83),h=i(326),c=i(84),d=i(9),f=i(20),p=i(394),g=a.bind,m=s.Group,v=s.Rect,y=a.each,x=3,_=["label","normal"],b=["label","emphasis"],w=10,S=1,M=2;t.exports=i(2).extendChartView({type:"treemap",init:function(t,e){this._containerGroup,this._storage=n(),this._oldTree,this._breadcrumb,this._controller,this._state="ready",this._mayClick},render:function(t,e,i,n){var o=e.findComponents({mainType:"series",subType:"treemap",query:n});if(!(a.indexOf(o,t)<0)){this.seriesModel=t,this.api=i,this.ecModel=e;var r=u.retrieveTargetInfo(n,t),s=n&&n.type,l=t.layoutInfo,h=!this._oldTree,c=this._storage,d="treemapRootToNode"===s&&r&&c?{rootNodeGroup:c.nodeGroup[r.node.getRawIndex()],direction:n.direction}:null,f=this._giveContainerGroup(l),p=this._doRender(f,t,d);h||s&&"treemapZoomToNode"!==s&&"treemapRootToNode"!==s?p.renderFinally():this._doAnimation(f,p,t,d),this._resetController(i),this._renderBreadcrumb(t,i,r)}},_giveContainerGroup:function(t){var e=this._containerGroup;return e||(e=this._containerGroup=new m,this._initEvents(e),this.group.add(e)),e.attr("position",[t.x,t.y]),e},_doRender:function(t,e,i){function r(t,e,i,n,o){function s(t){return t.getId()}function u(a,s){var l=null!=a?t[a]:null,u=null!=s?e[s]:null,h=m(l,u,i,o);h&&r(l&&l.viewChildren||[],u&&u.viewChildren||[],h,n,o+1)}n?(e=t,y(t,function(t,e){!t.isRemoved()&&u(e,e)})):new l(e,t,s,s).add(u).update(u).remove(a.curry(u,null)).execute()}function s(t){var e=n();return t&&y(t,function(t,i){var n=e[i];y(t,function(t){t&&(n.push(t),t.__tmWillDelete=1)})}),e}function u(){y(v,function(t){y(t,function(t){t.parent&&t.parent.remove(t)})}),y(g,function(t){t.invisible=!0,t.dirty()})}var h=e.getData().tree,c=this._oldTree,d=n(),f=n(),p=this._storage,g=[],m=a.curry(o,e,f,p,i,d,g);r(h.root?[h.root]:[],c&&c.root?[c.root]:[],t,h===c||!c,0);var v=s(p);return this._oldTree=h,this._storage=f,{lastsForAnimation:d,willDeleteEls:v,renderFinally:u}},_doAnimation:function(t,e,i,n){if(i.get("animation")){var o=i.get("animationDurationUpdate"),r=i.get("animationEasing"),s=p.createWrap();y(e.willDeleteEls,function(t,e){y(t,function(t,i){if(!t.invisible){var a,l=t.parent;if(n&&"drillDown"===n.direction)a=l===n.rootNodeGroup?{shape:{x:0,y:0,width:l.__tmNodeWidth,height:l.__tmNodeHeight},style:{opacity:0}}:{style:{opacity:0}};else{var u=0,h=0;l.__tmWillDelete||(u=l.__tmNodeWidth/2,h=l.__tmNodeHeight/2),a="nodeGroup"===e?{position:[u,h],style:{opacity:0}}:{shape:{x:u,y:h,width:0,height:0},style:{opacity:0}}}a&&s.add(t,a,o,r)}})}),y(this._storage,function(t,i){y(t,function(t,n){var l=e.lastsForAnimation[i][n],u={};l&&("nodeGroup"===i?l.old&&(u.position=t.position.slice(),t.attr("position",l.old)):(l.old&&(u.shape=a.extend({},t.shape),t.setShape(l.old)),l.fadein?(t.setStyle("opacity",0),u.style={opacity:1}):1!==t.style.opacity&&(u.style={opacity:1})),s.add(t,u,o,r))})},this),this._state="animating",s.done(g(function(){this._state="ready",e.renderFinally()},this)).start()}},_resetController:function(t){var e=this._controller;e||(e=this._controller=new c(t.getZr()),e.enable(this.seriesModel.get("roam")),e.on("pan",g(this._onPan,this)),e.on("zoom",g(this._onZoom,this)));var i=new d(0,0,t.getWidth(),t.getHeight());e.setContainsPoint(function(t,e){return i.contain(t,e)})},_clearController:function(){var t=this._controller;t&&(t.dispose(),t=null)},_onPan:function(t,e){if(this._mayClick=!1,"animating"!==this._state&&(Math.abs(t)>x||Math.abs(e)>x)){var i=this.seriesModel.getData().tree.root;if(!i)return;var n=i.getLayout();if(!n)return;this.api.dispatchAction({type:"treemapMove",from:this.uid,seriesId:this.seriesModel.id,rootRect:{x:n.x+t,y:n.y+e,width:n.width,height:n.height}})}},_onZoom:function(t,e,i){if(this._mayClick=!1,"animating"!==this._state){var n=this.seriesModel.getData().tree.root;if(!n)return;var o=n.getLayout();if(!o)return;var r=new d(o.x,o.y,o.width,o.height),a=this.seriesModel.layoutInfo;e-=a.x,i-=a.y;var s=f.create();f.translate(s,s,[-e,-i]),f.scale(s,s,[t,t]),f.translate(s,s,[e,i]),r.applyTransform(s),this.api.dispatchAction({type:"treemapRender",from:this.uid,seriesId:this.seriesModel.id,rootRect:{x:r.x,y:r.y,width:r.width,height:r.height}})}},_initEvents:function(t){function e(t){var e=this.seriesModel.get("nodeClick",!0);if(e){var i=this.findTarget(t.offsetX,t.offsetY);if(i){var n=i.node;if(n.getLayout().isLeafRoot)this._rootToNode(i);else if("zoomToNode"===e)this._zoomToNode(i);else if("link"===e){var o=n.hostTree.data.getItemModel(n.dataIndex),r=o.get("link",!0),a=o.get("target",!0)||"blank";r&&window.open(r,a)}}}}t.on("mousedown",function(t){"ready"===this._state&&(this._mayClick=!0)},this),t.on("mouseup",function(t){this._mayClick&&(this._mayClick=!1,"ready"===this._state&&e.call(this,t))},this)},_renderBreadcrumb:function(t,e,i){function n(e){"animating"!==this._state&&(u.aboveViewRoot(t.getViewRoot(),e)?this._rootToNode({node:e}):this._zoomToNode({node:e}))}i||(i=null!=t.get("leafDepth",!0)?{node:t.getViewRoot()}:this.findTarget(e.getWidth()/2,e.getHeight()/2),i||(i={node:t.getData().tree.root})),(this._breadcrumb||(this._breadcrumb=new h(this.group))).render(t,e,i.node,g(n,this))},remove:function(){this._clearController(),this._containerGroup&&this._containerGroup.removeAll(),this._storage=n(),this._state="ready",this._breadcrumb&&this._breadcrumb.remove()},dispose:function(){this._clearController()},_zoomToNode:function(t){this.api.dispatchAction({type:"treemapZoomToNode",from:this.uid,seriesId:this.seriesModel.id,targetNode:t.node})},_rootToNode:function(t){this.api.dispatchAction({type:"treemapRootToNode",from:this.uid,seriesId:this.seriesModel.id,targetNode:t.node})},findTarget:function(t,e){var i,n=this.seriesModel.getViewRoot();return n.eachNode({attr:"viewChildren",order:"preorder"},function(n){var o=this._storage.background[n.getRawIndex()];if(o){var r=o.transformCoordToLocal(t,e),a=o.shape;if(!(a.x<=r[0]&&r[0]<=a.x+a.width&&a.y<=r[1]&&r[1]<=a.y+a.height))return!1;i={node:n,offsetX:r[0],offsetY:r[1]}}},this),i}})},function(t,e,i){for(var n=i(2),o=i(83),r=function(){},a=["treemapZoomToNode","treemapRender","treemapMove"],s=0;s=0;l--){var u=o["asc"===n?a-l-1:l].getValue();u/i*ea[1]&&(a[1]=e)})}else a=[NaN,NaN];return{sum:n,dataExtent:a}}function u(t,e,i){for(var n,o=0,r=1/0,a=0,s=t.length;ao&&(o=n));var l=t.area*t.area,u=e*e*i;return l?x(u*o/l,l/(u*r)):1/0}function h(t,e,i,n,o){var r=e===i.width?0:1,a=1-r,s=["x","y"],l=["width","height"],u=i[s[r]],h=e?t.area/e:0;(o||h>i[l[a]])&&(h=i[l[a]]);for(var c=0,d=t.length;cg.MAX_SAFE_INTEGER&&(u=g.MAX_SAFE_INTEGER),r=s}u=u.length||t===u[t.depth]){var o=h(d,x,t,e,S,c);n(t,o,i,s,u,c)}})}else m=r(x,t),t.setVisual("color",m)}}function o(t,e,i,n){var o=f.extend({},e);return f.each(["color","colorAlpha","colorSaturation"],function(r){var a=t.get(r,!0);null==a&&i&&(a=i[r]),null==a&&(a=e[r]),null==a&&(a=n.get(r)),null!=a&&(o[r]=a)}),o}function r(t){var e=s(t,"color");if(e){var i=s(t,"colorAlpha"),n=s(t,"colorSaturation");return n&&(e=d.modifyHSL(e,null,null,n)),i&&(e=d.modifyAlpha(e,i)),e}}function a(t,e){return null!=e?d.modifyHSL(e,null,null,t):null}function s(t,e){var i=t[e];if(null!=i&&"none"!==i)return i}function l(t,e,i,n,o,r){if(r&&r.length){var a=u(e,"color")||null!=o.color&&"none"!==o.color&&(u(e,"colorAlpha")||u(e,"colorSaturation"));if(a){var s=e.get("visualMin"),l=e.get("visualMax"),h=i.dataExtent.slice();null!=s&&sh[1]&&(h[1]=l);var d=e.get("colorMappingBy"),f={type:a.name,dataExtent:h,visual:a.range};"color"!==f.type||"index"!==d&&"id"!==d?f.mappingMethod="linear":(f.mappingMethod="category",f.loop=!0);var p=new c(f);return p.__drColorMappingBy=d,p}}}function u(t,e){var i=t.get(e);return p(i)&&i.length?{name:e,range:i}:null}function h(t,e,i,n,o,r){var a=f.extend({},e);if(o){var s=o.type,l="color"===s&&o.__drColorMappingBy,u="index"===l?n:"id"===l?r.mapIdToIndex(i.getId()):i.getValue(t.get("visualDimension"));a[s]=o.mapValueToVisual(u)}return a}var c=i(73),d=i(19),f=i(1),p=f.isArray,g="itemStyle.normal";t.exports=function(t,e,i){var o={mainType:"series",subType:"treemap",query:i};t.eachComponent(o,function(t){var e=t.getData().tree,i=e.root,o=t.getModel(g);if(!i.isRemoved()){var r=f.map(e.levelModels,function(t){return t?t.get(g):null});n(i,{},r,o,t.getViewRoot().getAncestors(),t)}})}},function(t,e,i){"use strict";i(219),i(333)},function(t,e,i){"use strict";function n(t,e,i,n){var o=t.coordToPoint([e,n]),r=t.coordToPoint([i,n]);return{x1:o[0],y1:o[1],x2:r[0],y2:r[1]}}var o=i(1),r=i(3),a=i(11),s=["axisLine","axisLabel","axisTick","splitLine","splitArea"];i(2).extendComponentView({type:"angleAxis",render:function(t,e){if(this.group.removeAll(),t.get("show")){var i=e.getComponent("polar",t.get("polarIndex")),n=t.axis,r=i.coordinateSystem,a=r.getRadiusAxis().getExtent(),l=n.getTicksCoords();"category"!==n.type&&l.pop(),o.each(s,function(e){!t.get(e+".show")||n.isBlank()&&"axisLine"!==e||this["_"+e](t,r,l,a)},this)}},_axisLine:function(t,e,i,n){var o=t.getModel("axisLine.lineStyle"),a=new r.Circle({shape:{cx:e.cx,cy:e.cy,r:n[1]},style:o.getLineStyle(),z2:1,silent:!0});a.style.fill=null,this.group.add(a)},_axisTick:function(t,e,i,a){var s=t.getModel("axisTick"),l=(s.get("inside")?-1:1)*s.get("length"),u=o.map(i,function(t){return new r.Line({shape:n(e,a[1],a[1]+l,t)})});this.group.add(r.mergePath(u,{style:o.defaults(s.getModel("lineStyle").getLineStyle(),{stroke:t.get("axisLine.lineStyle.color")})}))},_axisLabel:function(t,e,i,n){for(var o=t.axis,s=t.get("data"),l=t.getModel("axisLabel"),u=l.getModel("textStyle"),h=t.getFormattedLabels(),c=l.get("margin"),d=o.getLabelsCoords(),f=0;fm?"left":"right",x=Math.abs(g[1]-v)/p<.3?"middle":g[1]>v?"top":"bottom",_=u;s&&s[f]&&s[f].textStyle&&(_=new a(s[f].textStyle,u)),this.group.add(new r.Text({style:{x:g[0],y:g[1],fill:_.getTextColor()||t.get("axisLine.lineStyle.color"),text:h[f],textAlign:y,textVerticalAlign:x,textFont:_.getFont()},silent:!0}))}},_splitLine:function(t,e,i,a){var s=t.getModel("splitLine"),l=s.getModel("lineStyle"),u=l.get("color"),h=0;u=u instanceof Array?u:[u];for(var c=[],d=0;d=v[1])&&(h=!1);var y=o.extend({axisLabelShow:h,strokeContainThreshold:f},g),x=new r(t,y);o.each(l,x.add,x),this._axisGroup.add(x.getGroup()),this._refreshBrushController(y,d,t,f),s.groupTransition(u,this._axisGroup,t)}}},_refreshBrushController:function(t,e,i,n){var r=i.axis,a=o.map(i.activeIntervals,function(t){return{brushType:"lineX",panelId:"pl",range:[r.dataToCoord(t[0],!0),r.dataToCoord(t[1],!0)]}}),l=r.getExtent(),u=l[1]-l[0],h=Math.min(30,.1*Math.abs(u)),c=s.BoundingRect.create({x:l[0],y:-n/2,width:u,height:n});c.x-=h,c.width+=2*h,this._brushController.mount({enableGlobalPan:!0,rotation:t.rotation,position:t.position}).setPanels([{panelId:"pl",rect:c}]).enableBrush({brushType:"lineX",brushStyle:e,removeOnClick:!0}).updateCovers(a)},_onBrush:function(t,e){var i=this.axisModel,n=i.axis,r=o.map(t,function(t){return[n.coordToData(t.range[0],!0),n.coordToData(t.range[1],!0)]});(!i.option.realtime===e.isEnd||e.removeOnClick)&&this.api.dispatchAction({type:"axisAreaSelect",parallelAxisId:i.id,intervals:r})},dispose:function(){this._brushController.dispose()}});t.exports=u},function(t,e,i){"use strict";function n(t,e,i){return{position:[t.cx,t.cy],rotation:i/180*Math.PI,labelDirection:-1,tickDirection:-1,nameDirection:1,labelRotation:e.getModel("axisLabel").get("rotate"),z2:1}}var o=i(1),r=i(3),a=i(51),s=["axisLine","axisLabel","axisTick","axisName"],l=["splitLine","splitArea"];i(2).extendComponentView({type:"radiusAxis",render:function(t,e){if(this.group.removeAll(),t.get("show")){var i=e.getComponent("polar",t.get("polarIndex")),r=i.coordinateSystem.getAngleAxis(),u=t.axis,h=i.coordinateSystem,c=u.getTicksCoords(),d=r.getExtent()[0],f=u.getExtent(),p=n(h,t,d),g=new a(t,p);o.each(s,g.add,g),this.group.add(g.getGroup()),o.each(l,function(e){t.get(e+".show")&&!u.isBlank()&&this["_"+e](t,h,d,f,c)},this)}},_splitLine:function(t,e,i,n,a){var s=t.getModel("splitLine"),l=s.getModel("lineStyle"),u=l.get("color"),h=0;u=u instanceof Array?u:[u];for(var c=[],d=0;d1)return!1;var d=l(i-t,o-t,n-e,r-e)/h;return!(d<0||d>1)}function s(t){return t<=1e-6&&t>=-1e-6}function l(t,e,i,n){return t*n-e*i}var u=i(247).contain,h=i(9),c={lineX:n(0),lineY:n(1),rect:{point:function(t,e,i){return i.boundingRect.contain(t[0],t[1])},rect:function(t,e,i){return i.boundingRect.intersect(t)}},polygon:{point:function(t,e,i){return i.boundingRect.contain(t[0],t[1])&&u(i.range,t[0],t[1])},rect:function(t,e,i){var n=i.range;if(n.length<=1)return!1;var o=t.x,a=t.y,s=t.width,l=t.height,c=n[0];return!!(u(n,o,a)||u(n,o+s,a)||u(n,o,a+l)||u(n,o+s,a+l)||h.create(t).contain(c[0],c[1])||r(o,a,o+s,a,n)||r(o,a,o,a+l,n)||r(o+s,a,o+s,a+l,n)||r(o,a+l,o+s,a+l,n))||void 0}}};t.exports=c},function(t,e,i){function n(t,e,i,n,r){if(r){var a=t.getZr();if(!a[x]){a[y]||(a[y]=o);var s=g.createOrUpdate(a,y,i,e);s(t,n)}}}function o(t,e){if(!t.isDisposed()){var i=t.getZr();i[x]=!0,t.dispatchAction({type:"brushSelect",batch:e}),i[x]=!1}}function r(t,e,i,n){for(var o=i.getItemLayout(n),r=0,a=e.length;re[0][1]&&(e[0][1]=r[0]),r[1]e[1][1]&&(e[1][1]=r[1])}return e&&u(e)}}},function(t,e,i){function n(t,e){e.update="updateView",o.registerAction(e,function(e,i){var n={};return i.eachComponent({mainType:"geo",query:e},function(i){i[t](e.name);var o=i.coordinateSystem;r.each(o.regions,function(t){n[t.name]=i.isSelected(t.name)||!1})}),{selected:n,name:e.name}})}i(370),i(173),i(346),i(223);var o=i(2),r=i(1);n("toggleSelected",{type:"geoToggleSelect",event:"geoselectchanged"}),n("select",{type:"geoSelect",event:"geoselected"}),n("unSelect",{type:"geoUnSelect",event:"geounselected"})},function(t,e,i){"use strict";var n=i(231);t.exports=i(2).extendComponentView({type:"geo",init:function(t,e){var i=new n(e,(!0));this._mapDraw=i,this.group.add(i.group)},render:function(t,e,i,n){if(!n||"geoToggleSelect"!==n.type||n.from!==this.uid){var o=this._mapDraw;t.get("show")?o.draw(t,e,i,this,n):this._mapDraw.group.removeAll(),this.group.silent=t.get("silent")}},dispose:function(){this._mapDraw&&this._mapDraw.remove()}})},function(t,e,i){i(243),i(337),i(334)},function(t,e,i){"use strict";i(219),i(332),i(351),i(2).extendComponentView({type:"polar"})},function(t,e,i){i(386),i(387),i(350)},function(t,e,i){var n=i(51),o=i(1),r=i(3),a=["axisLine","axisLabel","axisTick","axisName"];t.exports=i(2).extendComponentView({type:"radar",render:function(t,e,i){var n=this.group;n.removeAll(),this._buildAxes(t),this._buildSplitLineAndArea(t)},_buildAxes:function(t){var e=t.coordinateSystem,i=e.getIndicatorAxes(),r=o.map(i,function(t){var i=new n(t.model,{position:[e.cx,e.cy],rotation:t.angle,labelDirection:-1,tickDirection:-1,nameDirection:1});return i});o.each(r,function(t){o.each(a,t.add,t),this.group.add(t.getGroup())},this)},_buildSplitLineAndArea:function(t){function e(t,e,i){var n=i%e.length;return t[n]=t[n]||[],n}var i=t.coordinateSystem,n=i.getIndicatorAxes();if(n.length){var a=t.get("shape"),s=t.getModel("splitLine"),l=t.getModel("splitArea"),u=s.getModel("lineStyle"),h=l.getModel("areaStyle"),c=s.get("show"),d=l.get("show"),f=u.get("color"),p=h.get("color");f=o.isArray(f)?f:[f],p=o.isArray(p)?p:[p];var g=[],m=[];if("circle"===a)for(var v=n[0].getTicksCoords(),y=i.cx,x=i.cy,_=0;_=0||"+"===i?"left":"right"},s={horizontal:i>=0||"+"===i?"top":"bottom",vertical:"middle"},l={horizontal:0,vertical:b/2},u="vertical"===o?r.height:r.width,h=t.getModel("controlStyle"),c=h.get("show"),d=c?h.get("itemSize"):0,f=c?h.get("itemGap"):0,p=d+f,g=t.get("label.normal.rotate")||0;g=g*b/180;var m,v,y,x,_=h.get("position",!0),c=h.get("show",!0),w=c&&h.get("showPlayBtn",!0),S=c&&h.get("showPrevBtn",!0),M=c&&h.get("showNextBtn",!0),I=0,T=u;return"left"===_||"bottom"===_?(w&&(m=[0,0],I+=p),S&&(v=[I,0],I+=p),M&&(y=[T-d,0],T-=p)):(w&&(m=[T-d,0],T-=p),S&&(v=[0,0],I+=p),M&&(y=[T-d,0],T-=p)),x=[I,T],t.get("inverse")&&x.reverse(),{viewRect:r,mainLength:u,orient:o,rotation:l[o],labelRotation:g,labelPosOpt:i,labelAlign:a[o],labelBaseline:s[o],playPosition:m,prevBtnPosition:v,nextBtnPosition:y,axisExtent:x,controlSize:d,controlGap:f}},_position:function(t,e){function i(t){var e=t.position;t.origin=[c[0][0]-e[0],c[1][0]-e[1]]}function n(t){return[[t.x,t.x+t.width],[t.y,t.y+t.height]]}function o(t,e,i,n,o){t[n]+=i[n][o]-e[n][o]}var r=this._mainGroup,a=this._labelGroup,s=t.viewRect;if("vertical"===t.orient){var l=g.create(),u=s.x,h=s.y+s.height;g.translate(l,l,[-u,-h]),g.rotate(l,l,-b/2),g.translate(l,l,[u,h]),s=s.clone(),s.applyTransform(l)}var c=n(s),d=n(r.getBoundingRect()),f=n(a.getBoundingRect()),p=r.position,m=a.position;m[0]=p[0]=c[0][0];var v=t.labelPosOpt;if(isNaN(v)){var y="+"===v?0:1;o(p,d,c,1,y),o(m,f,c,1,1-y)}else{var y=v>=0?0:1;o(p,d,c,1,y),m[1]=p[1]+v}r.attr("position",p),a.attr("position",m),r.rotation=a.rotation=t.rotation,i(r),i(a)},_createAxis:function(t,e){var i=e.getData(),n=e.get("axisType"),o=f.createScaleByModel(e,n),r=i.getDataExtent("value");o.setExtent(r[0],r[1]),this._customizeScale(o,i),o.niceTicks();var a=new c("value",o,t.axisExtent,n);return a.model=e,a},_customizeScale:function(t,e){t.getTicks=function(){return e.mapArray(["value"],function(t){return t})},t.getTicksLabels=function(){return s.map(this.getTicks(),t.getLabel,t)}},_createGroup:function(t){var e=this["_"+t]=new l.Group;return this.group.add(e),e},_renderAxisLine:function(t,e,i,n){var o=i.getExtent();n.get("lineStyle.show")&&e.add(new l.Line({shape:{x1:o[0],y1:0,x2:o[1],y2:0},style:s.extend({lineCap:"round"},n.getModel("lineStyle").getLineStyle()),silent:!0,z2:1}))},_renderAxisTick:function(t,e,i,n){var o=n.getData(),a=i.scale.getTicks();_(a,function(t,a){var s=i.dataToCoord(t),u=o.getItemModel(a),h=u.getModel("itemStyle.normal"),c=u.getModel("itemStyle.emphasis"),d={position:[s,0],onclick:x(this._changeTimeline,this,a)},f=r(u,h,e,d);l.setHoverStyle(f,c.getItemStyle()),u.get("tooltip")?(f.dataIndex=a,f.dataModel=n):f.dataIndex=f.dataModel=null},this)},_renderAxisLabel:function(t,e,i,n){var o=n.getModel("label.normal");if(o.get("show")){var r=n.getData(),a=i.scale.getTicks(),s=f.getFormattedLabels(i,o.get("formatter")),u=i.getLabelInterval();_(a,function(n,o){if(!i.isLabelIgnored(o,u)){var a=r.getItemModel(o),h=a.getModel("label.normal.textStyle"),c=a.getModel("label.emphasis.textStyle"),d=i.dataToCoord(n),f=new l.Text({style:{text:s[o],textAlign:t.labelAlign,textVerticalAlign:t.labelBaseline,textFont:h.getFont(),fill:h.getTextColor()},position:[d,0],rotation:t.labelRotation-t.rotation,onclick:x(this._changeTimeline,this,o),silent:!1});e.add(f),l.setHoverStyle(f,c.getItemStyle())}},this)}},_renderControl:function(t,e,i,n){function r(t,i,r,d){if(t){var f={position:t,origin:[a/2,0],rotation:d?-s:0,rectHover:!0,style:u,onclick:r},p=o(n,i,c,f);e.add(p),l.setHoverStyle(p,h)}}var a=t.controlSize,s=t.rotation,u=n.getModel("controlStyle.normal").getItemStyle(),h=n.getModel("controlStyle.emphasis").getItemStyle(),c=[0,-a/2,a,a],d=n.getPlayState(),f=n.get("inverse",!0);r(t.nextBtnPosition,"controlStyle.nextIcon",x(this._changeTimeline,this,f?"-":"+")),r(t.prevBtnPosition,"controlStyle.prevIcon",x(this._changeTimeline,this,f?"+":"-")),r(t.playPosition,"controlStyle."+(d?"stopIcon":"playIcon"),x(this._handlePlayClick,this,!d),!0)},_renderCurrentPointer:function(t,e,i,n){var o=n.getData(),s=n.getCurrentIndex(),l=o.getItemModel(s).getModel("checkpointStyle"),u=this,h={onCreate:function(t){t.draggable=!0,t.drift=x(u._handlePointerDrag,u),t.ondragend=x(u._handlePointerDragend,u),a(t,s,i,n,!0)},onUpdate:function(t){a(t,s,i,n)}};this._currentPointer=r(l,l,this._mainGroup,{},this._currentPointer,h)},_handlePlayClick:function(t){this._clearTimer(),this.api.dispatchAction({type:"timelinePlayChange",playState:t,from:this.uid})},_handlePointerDrag:function(t,e,i){this._clearTimer(),this._pointerChangeTimeline([i.offsetX,i.offsetY])},_handlePointerDragend:function(t){this._pointerChangeTimeline([t.offsetX,t.offsetY],!0)},_pointerChangeTimeline:function(t,e){var i=this._toAxisCoord(t)[0],n=this._axis,o=m.asc(n.getExtent().slice());i>o[1]&&(i=o[1]),i=e&&(t=e-1),t<0&&(t=0)),this.option.currentIndex=t},getCurrentIndex:function(){return this.option.currentIndex},isIndexMax:function(){return this.getCurrentIndex()>=this._data.count()-1},setPlayState:function(t){this.option.autoPlay=!!t},getPlayState:function(){return!!this.option.autoPlay},_initData:function(){var t=this.option,e=t.data||[],i=t.axisType,n=this._names=[];if("category"===i){var s=[];r.each(e,function(t,e){var i,o=a.getDataItemValue(t);r.isObject(t)?(i=r.clone(t),i.value=e):i=e,s.push(i),r.isString(o)||null!=o&&!isNaN(o)||(o=""),n.push(o+"")}),e=s}var l={category:"ordinal",time:"time"}[i]||"number",u=this._data=new o([{name:"value",type:l}],this);u.initData(e,n)},getData:function(){return this._data},getCategories:function(){if("category"===this.get("axisType"))return this._names.slice()}});t.exports=s},function(t,e,i){var n=i(59);t.exports=n.extend({type:"timeline"})},function(t,e,i){function n(t){var e=t.type,i={number:"value",time:"time"};if(i[e]&&(t.axisType=i[e],delete t.type),o(t),r(t,"controlPosition")){var n=t.controlStyle||(t.controlStyle={});r(n,"position")||(n.position=t.controlPosition),"none"!==n.position||r(n,"show")||(n.show=!1,delete n.position),delete t.controlPosition}a.each(t.data||[],function(t){a.isObject(t)&&!a.isArray(t)&&(!r(t,"value")&&r(t,"name")&&(t.value=t.name),o(t))})}function o(t){var e=t.itemStyle||(t.itemStyle={}),i=e.emphasis||(e.emphasis={}),n=t.label||t.label||{},o=n.normal||(n.normal={}),s={normal:1,emphasis:1};a.each(n,function(t,e){s[e]||r(o,e)||(o[e]=t)}),i.label&&!r(n,"emphasis")&&(n.emphasis=i.label,delete i.label)}function r(t,e){return t.hasOwnProperty(e)}var a=i(1);t.exports=function(t){var e=t&&t.timeline;a.isArray(e)||(e=e?[e]:[]),a.each(e,function(t){t&&n(t)})}},function(t,e,i){var n=i(2),o=i(1);n.registerAction({type:"timelineChange",event:"timelineChanged",update:"prepareAndUpdate"},function(t,e){var i=e.getComponent("timeline");return i&&null!=t.currentIndex&&(i.setCurrentIndex(t.currentIndex),!i.get("loop",!0)&&i.isIndexMax()&&i.setPlayState(!1)),e.resetOption("timeline"),o.defaults({currentIndex:i.option.currentIndex},t)}),n.registerAction({type:"timelinePlayChange",event:"timelinePlayChanged",update:"update"},function(t,e){var i=e.getComponent("timeline");i&&null!=t.playState&&i.setPlayState(t.playState)})},function(t,e,i){i(13).registerSubTypeDefaulter("timeline",function(){return"slider"})},function(t,e,i){"use strict";function n(t,e,i){this.model=t,this.ecModel=e,this.api=i,this._brushType,this._brushMode}var o=i(26),r=i(1);n.defaultOption={show:!0,type:["rect","polygon","lineX","lineY","keep","clear"],icon:{rect:"M7.3,34.7 M0.4,10V-0.2h9.8 M89.6,10V-0.2h-9.8 M0.4,60v10.2h9.8 M89.6,60v10.2h-9.8 M12.3,22.4V10.5h13.1 M33.6,10.5h7.8 M49.1,10.5h7.8 M77.5,22.4V10.5h-13 M12.3,31.1v8.2 M77.7,31.1v8.2 M12.3,47.6v11.9h13.1 M33.6,59.5h7.6 M49.1,59.5 h7.7 M77.5,47.6v11.9h-13",polygon:"M55.2,34.9c1.7,0,3.1,1.4,3.1,3.1s-1.4,3.1-3.1,3.1 s-3.1-1.4-3.1-3.1S53.5,34.9,55.2,34.9z M50.4,51c1.7,0,3.1,1.4,3.1,3.1c0,1.7-1.4,3.1-3.1,3.1c-1.7,0-3.1-1.4-3.1-3.1 C47.3,52.4,48.7,51,50.4,51z M55.6,37.1l1.5-7.8 M60.1,13.5l1.6-8.7l-7.8,4 M59,19l-1,5.3 M24,16.1l6.4,4.9l6.4-3.3 M48.5,11.6 l-5.9,3.1 M19.1,12.8L9.7,5.1l1.1,7.7 M13.4,29.8l1,7.3l6.6,1.6 M11.6,18.4l1,6.1 M32.8,41.9 M26.6,40.4 M27.3,40.2l6.1,1.6 M49.9,52.1l-5.6-7.6l-4.9-1.2",lineX:"M15.2,30 M19.7,15.6V1.9H29 M34.8,1.9H40.4 M55.3,15.6V1.9H45.9 M19.7,44.4V58.1H29 M34.8,58.1H40.4 M55.3,44.4 V58.1H45.9 M12.5,20.3l-9.4,9.6l9.6,9.8 M3.1,29.9h16.5 M62.5,20.3l9.4,9.6L62.3,39.7 M71.9,29.9H55.4",lineY:"M38.8,7.7 M52.7,12h13.2v9 M65.9,26.6V32 M52.7,46.3h13.2v-9 M24.9,12H11.8v9 M11.8,26.6V32 M24.9,46.3H11.8v-9 M48.2,5.1l-9.3-9l-9.4,9.2 M38.9-3.9V12 M48.2,53.3l-9.3,9l-9.4-9.2 M38.9,62.3V46.4",keep:"M4,10.5V1h10.3 M20.7,1h6.1 M33,1h6.1 M55.4,10.5V1H45.2 M4,17.3v6.6 M55.6,17.3v6.6 M4,30.5V40h10.3 M20.7,40 h6.1 M33,40h6.1 M55.4,30.5V40H45.2 M21,18.9h62.9v48.6H21V18.9z",clear:"M22,14.7l30.9,31 M52.9,14.7L22,45.7 M4.7,16.8V4.2h13.1 M26,4.2h7.8 M41.6,4.2h7.8 M70.3,16.8V4.2H57.2 M4.7,25.9v8.6 M70.3,25.9v8.6 M4.7,43.2v12.6h13.1 M26,55.8h7.8 M41.6,55.8h7.8 M70.3,43.2v12.6H57.2"},title:{rect:"矩形选择",polygon:"圈选",lineX:"横向选择",lineY:"纵向选择",keep:"保持选择",clear:"清除选择"}};var a=n.prototype;a.render=a.updateView=a.updateLayout=function(t,e,i){var n,o,a;e.eachComponent({mainType:"brush"},function(t){n=t.brushType,o=t.brushOption.brushMode||"single",a|=t.areas.length}),this._brushType=n,this._brushMode=o,r.each(t.get("type",!0),function(e){t.setIconStatus(e,("keep"===e?"multiple"===o:"clear"===e?a:e===n)?"emphasis":"normal")})},a.getIcons=function(){var t=this.model,e=t.get("icon",!0),i={};return r.each(t.get("type",!0),function(t){e[t]&&(i[t]=e[t])}),i},a.onclick=function(t,e,i){var e=this.api,n=this._brushType,o=this._brushMode;"clear"===i?e.dispatchAction({type:"brush",areas:[]}):e.dispatchAction({type:"takeGlobalCursor",key:"brush",brushOption:{brushType:"keep"===i?n:n!==i&&i,brushMode:"keep"===i?"multiple"===o?"single":"multiple":o}})},o.register("brush",n),t.exports=n},function(t,e,i){i(367),i(368)},function(t,e,i){function n(t,e,i){if(i[0]===i[1])return i.slice();for(var n=200,o=(i[1]-i[0])/n,r=i[0],a=[],s=0;s<=n&&re[1]&&e.reverse(),e[0]=Math.max(e[0],t[0]),e[1]=Math.min(e[1],t[1]))},completeVisualOption:function(){o.prototype.completeVisualOption.apply(this,arguments),r.each(this.stateList,function(t){var e=this.option.controller[t].symbolSize;e&&e[0]!==e[1]&&(e[0]=0)},this)},setSelected:function(t){this.option.range=t.slice(),this._resetRange()},getSelected:function(){var t=this.getExtent(),e=a.asc((this.get("range")||[]).slice());return e[0]>t[1]&&(e[0]=t[1]),e[1]>t[1]&&(e[1]=t[1]),e[0]=i[1]||t<=e[1])?"inRange":"outOfRange"},findTargetDataIndices:function(t){var e=[];return this.eachTargetSeries(function(i){var n=[],o=i.getData();o.each(this.getDataDimension(o),function(e,i){t[0]<=e&&e<=t[1]&&n.push(i)},!0,this),e.push({seriesId:i.id,dataIndex:n})},this),e},getVisualMeta:function(t){function e(e,i){r.push({value:e,color:t(e,i)})}for(var i=n(this,"outOfRange",this.getExtent()),o=n(this,"inRange",this.option.range.slice()),r=[],a=0,s=0,l=o.length,u=i.length;st[1])break;n.push({color:this.getControllerVisual(a,"color",e),offset:r/i})}return n.push({color:this.getControllerVisual(t[1],"color",e),offset:1}),n},_createBarPoints:function(t,e){var i=this.visualMapModel.itemSize;return[[i[0]-e[0],t[0]],[i[0],t[0]],[i[0],t[1]],[i[0]-e[1],t[1]]]},_createBarGroup:function(t){var e=this._orient,i=this.visualMapModel.get("inverse");return new u.Group("horizontal"!==e||i?"horizontal"===e&&i?{scale:"bottom"===t?[-1,1]:[1,1],rotation:-Math.PI/2}:"vertical"!==e||i?{scale:"left"===t?[1,1]:[-1,1]}:{scale:"left"===t?[1,-1]:[-1,-1]}:{scale:"bottom"===t?[1,1]:[-1,1],rotation:Math.PI/2})},_updateHandle:function(t,e){if(this._useHandle){var i=this._shapes,n=this.visualMapModel,o=i.handleThumbs,r=i.handleLabels;v([0,1],function(a){var s=o[a];s.setStyle("fill",e.handlesColor[a]),s.position[1]=t[a];var l=u.applyTransform(i.handleLabelPoints[a],u.getTransform(s,this.group));r[a].setStyle({x:l[0],y:l[1],text:n.formatValueText(this._dataInterval[a]),textVerticalAlign:"middle",textAlign:this._applyTransform("horizontal"===this._orient?0===a?"bottom":"top":"left",i.barGroup)})},this)}},_showIndicator:function(t,e,i,n){var o=this.visualMapModel,a=o.getExtent(),s=o.itemSize,l=[0,s[1]],h=m(t,a,l,!0),c=this._shapes,d=c.indicator;if(d){d.position[1]=h,d.attr("invisible",!1),d.setShape("points",r(!!i,n,h,s[1]));var f={convertOpacityToAlpha:!0},p=this.getControllerVisual(t,"color",f);d.setStyle("fill",p);var g=u.applyTransform(c.indicatorLabelPoint,u.getTransform(d,this.group)),v=c.indicatorLabel;v.attr("invisible",!1);var y=this._applyTransform("left",c.barGroup),x=this._orient;v.setStyle({text:(i?i:"")+o.formatValueText(e),textVerticalAlign:"horizontal"===x?y:"middle",textAlign:"horizontal"===x?"center":y,x:g[0],y:g[1]})}},_enableHoverLinkToSeries:function(){var t=this;this._shapes.barGroup.on("mousemove",function(e){if(t._hovering=!0,!t._dragging){var i=t.visualMapModel.itemSize,n=t._applyTransform([e.offsetX,e.offsetY],t._shapes.barGroup,!0,!0);n[1]=y(x(0,n[1]),i[1]),t._doHoverLinkToSeries(n[1],0<=n[0]&&n[0]<=i[0])}}).on("mouseout",function(){t._hovering=!1,!t._dragging&&t._clearHoverLinkToSeries()})},_enableHoverLinkFromSeries:function(){var t=this.api.getZr();this.visualMapModel.option.hoverLink?(t.on("mouseover",this._hoverLinkFromSeriesMouseOver,this),t.on("mouseout",this._hideIndicator,this)):this._clearHoverLinkFromSeries()},_doHoverLinkToSeries:function(t,e){var i=this.visualMapModel,n=i.itemSize;if(i.option.hoverLink){var o=[0,n[1]],r=i.getExtent();t=y(x(o[0],t),o[1]);var l=a(i,r,o),u=[t-l,t+l],h=m(t,o,r,!0),c=[m(u[0],o,r,!0),m(u[1],o,r,!0)];u[0]o[1]&&(c[1]=1/0),e&&(c[0]===-(1/0)?this._showIndicator(h,c[1],"< ",l):c[1]===1/0?this._showIndicator(h,c[0],"> ",l):this._showIndicator(h,h,"≈ ",l));var d=this._hoverLinkDataIndices,f=[];(e||s(i))&&(f=this._hoverLinkDataIndices=i.findTargetDataIndices(c));var v=g.compressBatches(d,f);this._dispatchHighDown("downplay",p.convertDataIndex(v[0])),this._dispatchHighDown("highlight",p.convertDataIndex(v[1]))}},_hoverLinkFromSeriesMouseOver:function(t){var e=t.target;if(e&&null!=e.dataIndex){var i=e.dataModel||this.ecModel.getSeriesByIndex(e.seriesIndex),n=i.getData(e.dataType),o=n.getDimension(this.visualMapModel.getDataDimension(n)),r=n.get(o,e.dataIndex,!0);isNaN(r)||this._showIndicator(r,r)}},_hideIndicator:function(){var t=this._shapes;t.indicator&&t.indicator.attr("invisible",!0),t.indicatorLabel&&t.indicatorLabel.attr("invisible",!0)},_clearHoverLinkToSeries:function(){this._hideIndicator();var t=this._hoverLinkDataIndices;this._dispatchHighDown("downplay",p.convertDataIndex(t)),t.length=0},_clearHoverLinkFromSeries:function(){this._hideIndicator();var t=this.api.getZr();t.off("mouseover",this._hoverLinkFromSeriesMouseOver),t.off("mouseout",this._hideIndicator)},_applyTransform:function(t,e,i,n){var o=u.getTransform(e,n?null:this.group);return u[h.isArray(t)?"applyTransform":"transformDirection"](t,o,i)},_dispatchHighDown:function(t,e){e&&e.length&&this.api.dispatchAction({type:t,batch:e})},dispose:function(){this._clearHoverLinkFromSeries(),this._clearHoverLinkToSeries()},remove:function(){this._clearHoverLinkFromSeries(),this._clearHoverLinkToSeries()}});t.exports=w},function(t,e,i){function n(t,e){var i=t.inverse;("vertical"===t.orient?!i:i)&&e.reverse()}var o=i(234),r=i(1),a=i(73),s=i(246),l=i(4).reformIntervals,u=o.extend({type:"visualMap.piecewise",defaultOption:{selected:null,minOpen:!1,maxOpen:!1,align:"auto",itemWidth:20,itemHeight:14,itemSymbol:"roundRect",pieceList:null,categories:null,splitNumber:5,selectedMode:"multiple",itemGap:10,hoverLink:!0,showLabel:null},optionUpdated:function(t,e){u.superApply(this,"optionUpdated",arguments),this._pieceList=[],this.resetTargetSeries(),this.resetExtent();var i=this._mode=this._determineMode();h[this._mode].call(this),this._resetSelected(t,e);var n=this.option.categories;this.resetVisual(function(t,e){"categories"===i?(t.mappingMethod="category",t.categories=r.clone(n)):(t.dataExtent=this.getExtent(),t.mappingMethod="piecewise",t.pieceList=r.map(this._pieceList,function(t){var t=r.clone(t);return"inRange"!==e&&(t.visual=null),t}))})},completeVisualOption:function(){function t(t,e,i){return t&&t[e]&&(r.isObject(t[e])?t[e].hasOwnProperty(i):t[e]===i)}var e=this.option,i={},n=a.listVisualTypes(),l=this.isCategory();r.each(e.pieces,function(t){r.each(n,function(e){t.hasOwnProperty(e)&&(i[e]=1)})}),r.each(i,function(i,n){var o=0;r.each(this.stateList,function(i){o|=t(e,i,n)||t(e.target,i,n)},this),!o&&r.each(this.stateList,function(t){(e[t]||(e[t]={}))[n]=s.get(n,"inRange"===t?"active":"inactive",l)})},this),o.prototype.completeVisualOption.apply(this,arguments)},_resetSelected:function(t,e){var i=this.option,n=this._pieceList,o=(e?i:t).selected||{};if(i.selected=o,r.each(n,function(t,e){var i=this.getSelectedMapKey(t);o.hasOwnProperty(i)||(o[i]=!0)},this),"single"===i.selectedMode){var a=!1;r.each(n,function(t,e){var i=this.getSelectedMapKey(t);o[i]&&(a?o[i]=!1:a=!0)},this)}},getSelectedMapKey:function(t){return"categories"===this._mode?t.value+"":t.index+""},getPieceList:function(){return this._pieceList},_determineMode:function(){var t=this.option;return t.pieces&&t.pieces.length>0?"pieces":this.option.categories?"categories":"splitNumber"},setSelected:function(t){this.option.selected=r.clone(t)},getValueState:function(t){var e=a.findPieceIndex(t,this._pieceList);return null!=e&&this.option.selected[this.getSelectedMapKey(this._pieceList[e])]?"inRange":"outOfRange"},findTargetDataIndices:function(t){var e=[];return this.eachTargetSeries(function(i){var n=[],o=i.getData();o.each(this.getDataDimension(o),function(e,i){var o=a.findPieceIndex(e,this._pieceList);o===t&&n.push(i)},!0,this),e.push({seriesId:i.id,dataIndex:n})},this),e},getRepresentValue:function(t){var e;if(this.isCategory())e=t.value;else if(null!=t.value)e=t.value;else{var i=t.interval||[];e=i[0]===-(1/0)&&i[1]===1/0?0:(i[0]+i[1])/2}return e},getVisualMeta:function(t){function e(e,r){var a=o.getRepresentValue({interval:e});r||(r=o.getValueState(a));var s=t(a,r);e[0]===-(1/0)?n[0]=s:e[1]===1/0?n[1]=s:i.push({value:e[0],color:s},{value:e[1],color:s})}if(!this.isCategory()){var i=[],n=[],o=this,a=this._pieceList.slice();if(a.length){var s=a[0].interval[0];s!==-(1/0)&&a.unshift({interval:[-(1/0),s]}),s=a[a.length-1].interval[1],s!==1/0&&a.push({interval:[s,1/0]})}else a.push({interval:[-(1/0),1/0]});var l=-(1/0);return r.each(a,function(t){var i=t.interval;i&&(i[0]>l&&e([l,i[0]],"outOfRange"),e(i.slice()),l=i[1])},this),{stops:i,outerColors:n}}}}),h={splitNumber:function(){var t=this.option,e=this._pieceList,i=t.precision,n=this.getExtent(),o=t.splitNumber;o=Math.max(parseInt(o,10),1),t.splitNumber=o;for(var a=(n[1]-n[0])/o;+a.toFixed(i)!==a&&i<5;)i++;t.precision=i,a=+a.toFixed(i);var s=0;t.minOpen&&e.push({index:s++,interval:[-(1/0),n[0]],close:[0,0]});for(var u=n[0],h=s+o;s","≥"][e[0]]];t.text=t.text||this.formatValueText(null!=t.value?t.value:t.interval,!1,i)},this)}};t.exports=u},function(t,e,i){var n=i(235),o=i(1),r=i(3),a=i(24),s=i(12),l=i(236),u=n.extend({type:"visualMap.piecewise",doRender:function(){function t(t){var a=t.piece,s=new r.Group;s.onclick=o.bind(this._onItemClick,this,a),this._enableHoverLink(s,t.indexInModelPieceList);var d=i.getRepresentValue(a);if(this._createItemSymbol(s,d,[0,0,c[0],c[1]]),p){var f=this.visualMapModel.getValueState(d);s.add(new r.Text({style:{x:"right"===h?-n:c[0]+n,y:c[1]/2,text:a.text,textVerticalAlign:"middle",textAlign:h,textFont:l,fill:u,opacity:"outOfRange"===f?.5:1}}))}e.add(s)}var e=this.group;e.removeAll();var i=this.visualMapModel,n=i.get("textGap"),a=i.textStyleModel,l=a.getFont(),u=a.getTextColor(),h=this._getItemAlign(),c=i.itemSize,d=this._getViewData(),f=d.endsText,p=o.retrieve(i.get("showLabel",!0),!f);f&&this._renderEndsText(e,f[0],c,p,h),o.each(d.viewPieceList,t,this),f&&this._renderEndsText(e,f[1],c,p,h),s.box(i.get("orient"),e,i.get("itemGap")),this.renderBackground(e),this.positionGroup(e)},_enableHoverLink:function(t,e){function i(t){var i=this.visualMapModel;i.option.hoverLink&&this.api.dispatchAction({type:t,batch:l.convertDataIndex(i.findTargetDataIndices(e))})}t.on("mouseover",o.bind(i,this,"highlight")).on("mouseout",o.bind(i,this,"downplay"))},_getItemAlign:function(){var t=this.visualMapModel,e=t.option;if("vertical"===e.orient)return l.getItemAlign(t,this.api,t.itemSize);var i=e.align;return i&&"auto"!==i||(i="left"),i},_renderEndsText:function(t,e,i,n,o){if(e){var a=new r.Group,s=this.visualMapModel.textStyleModel;a.add(new r.Text({style:{x:n?"right"===o?i[0]:0:i[0]/2,y:i[1]/2,textVerticalAlign:"middle",textAlign:n?o:"center",text:e,textFont:s.getFont(),fill:s.getTextColor()}})),t.add(a)}},_getViewData:function(){var t=this.visualMapModel,e=o.map(t.getPieceList(),function(t,e){return{piece:t,indexInModelPieceList:e}}),i=t.get("text"),n=t.get("orient"),r=t.get("inverse");return("horizontal"===n?r:!r)?e.reverse():i&&(i=i.slice().reverse()),{viewPieceList:e,endsText:i}},_createItemSymbol:function(t,e,i){t.add(a.createSymbol(this.getControllerVisual(e,"symbol"),i[0],i[1],i[2],i[3],this.getControllerVisual(e,"color")))},_onItemClick:function(t){var e=this.visualMapModel,i=e.option,n=o.clone(i.selected),r=e.getSelectedMapKey(t);"single"===i.selectedMode?(n[r]=!0,o.each(n,function(t,e){n[e]=e===r})):n[r]=!n[r],this.api.dispatchAction({type:"selectDataRange",from:this.uid,visualMapId:this.visualMapModel.id,selected:n})}});t.exports=u},function(t,e,i){i(2).registerPreprocessor(i(237)),i(238),i(239),i(363),i(364),i(240)},function(t,e,i){i(2).registerPreprocessor(i(237)),i(238),i(239),i(365),i(366),i(240)},function(t,e,i){function n(t,e,i,n,o){l.call(this,t),this.map=e,this._nameCoordMap={},this.loadGeoJson(i,n,o)}function o(t,e,i,n){var o=i.geoModel,r=i.seriesModel,a=o?o.coordinateSystem:r?r.coordinateSystem||(r.getReferringComponents("geo")[0]||{}).coordinateSystem:null;return a===this?a[t](n):null}var r=i(374),a=i(1),s=i(9),l=i(241),u=[i(372),i(373),i(371)];n.prototype={constructor:n,type:"geo",dimensions:["lng","lat"],containCoord:function(t){for(var e=this.regions,i=0;i>1^-(1&a),s=s>>1^-(1&s),a+=n,s+=o,n=a,o=s,i.push([a/1024,s/1024])}return i}function r(t){for(var e=[],i=0;i=0;i--)l.asc(e[i])},getActiveState:function(t){var e=this.activeIntervals;if(!e.length)return"normal";if(null==t)return"inactive";for(var i=0,n=e.length;i=o.length&&(x=o.length-1,y=Math.max(0,Math.floor(x-v+1))),f=[y,x]}var _=p&&f&&g?function(t,e,i){var n,o=f[1]-f[0],r=(e-g*o)/(i-1-o);return n=ta[1])){var s=Math.abs(r[1]);sa;)l+=360*u;return[s,l]},coordToPoint:function(t){var e=t[0],i=t[1]/180*Math.PI,n=Math.cos(i)*e+this.cx,o=-Math.sin(i)*e+this.cy;return[n,o]}},t.exports=r},function(t,e,i){"use strict";i(381),i(2).extendComponentModel({type:"polar",dependencies:["polarAxis","angleAxis"],coordinateSystem:null,findAxisModel:function(t){var e,i=this.ecModel;return i.eachComponent(t,function(t){t.getCoordSysModel()===this&&(e=t)},this),e},defaultOption:{zlevel:0,z:0,center:["50%","50%"],radius:"80%"}})},function(t,e,i){"use strict";function n(t,e){r.call(this,"radius",t,e),this.type="category"}var o=i(1),r=i(42);n.prototype={constructor:n,dataToRadius:r.prototype.dataToCoord,radiusToData:r.prototype.coordToData},o.inherits(n,r),t.exports=n},function(t,e,i){function n(t,e,i){r.call(this,t,e,i),this.type="value",this.angle=0,this.name="",this.model}var o=i(1),r=i(42);o.inherits(n,r),t.exports=n},function(t,e,i){function n(t,e,i){this._model=t,this.dimensions=[],this._indicatorAxes=o.map(t.getIndicatorModels(),function(t,e){var i="indicator_"+e,n=new r(i,new a);return n.name=t.get("name"),n.model=t,t.axis=n,this.dimensions.push(i),n},this),this.resize(t,i),this.cx,this.cy,this.r,this.startAngle}var o=i(1),r=i(385),a=i(38),s=i(4),l=i(22);n.prototype.getIndicatorAxes=function(){return this._indicatorAxes},n.prototype.dataToPoint=function(t,e){var i=this._indicatorAxes[e];return this.coordToPoint(i.dataToCoord(t),e)},n.prototype.coordToPoint=function(t,e){var i=this._indicatorAxes[e],n=i.angle,o=this.cx+t*Math.cos(n),r=this.cy-t*Math.sin(n);return[o,r]},n.prototype.pointToData=function(t){var e=t[0]-this.cx,i=t[1]-this.cy,n=Math.sqrt(e*e+i*i);e/=n,i/=n;for(var o,r=Math.atan2(-i,e),a=1/0,s=-1,l=0;ln[0]&&isFinite(f)&&isFinite(n[0]))}else{var p=r.getTicks().length-1;p>a&&(c=i(c));var g=Math.round((n[0]+n[1])/2/c)*c,m=Math.round(a/2);r.setExtent(s.round(g-m*c),s.round(g+(a-m)*c)),r.setInterval(c)}})},n.dimensions=[],n.create=function(t,e){var i=[];return t.eachComponent("radar",function(o){var r=new n(o,t,e);i.push(r),o.coordinateSystem=r}),t.eachSeriesByType("radar",function(t){"radar"===t.get("coordinateSystem")&&(t.coordinateSystem=i[t.get("radarIndex")||0])}),i},i(23).register("radar",n),t.exports=n},function(t,e,i){function n(t,e){return s.defaults({show:e},t)}var o=i(86),r=o.valueAxis,a=i(11),s=i(1),l=i(52),u=i(2).extendComponentModel({type:"radar",optionUpdated:function(){var t=this.get("boundaryGap"),e=this.get("splitNumber"),i=this.get("scale"),n=this.get("axisLine"),o=this.get("axisTick"),r=this.get("axisLabel"),u=this.get("name.textStyle"),h=this.get("name.show"),c=this.get("name.formatter"),d=this.get("nameGap"),f=this.get("triggerEvent"),p=s.map(this.get("indicator")||[],function(p){if(null!=p.max&&p.max>0&&!p.min?p.min=0:null!=p.min&&p.min<0&&!p.max&&(p.max=0),p=s.merge(s.clone(p),{boundaryGap:t,splitNumber:e,scale:i,axisLine:n,axisTick:o,axisLabel:r,name:p.text,nameLocation:"end",nameGap:d,nameTextStyle:u,triggerEvent:f},!1),h||(p.name=""),"string"==typeof c){var g=p.name;p.name=c.replace("{value}",null!=g?g:"")}else"function"==typeof c&&(p.name=c(p.name,p));var m=s.extend(new a(p,null,this.ecModel),l);return m.mainType="radar",m.componentIndex=this.componentIndex,m},this);this.getIndicatorModels=function(){return p}},defaultOption:{zlevel:0,z:0,center:["50%","50%"],radius:"75%",startAngle:90,name:{show:!0},boundaryGap:[0,0],splitNumber:5,nameGap:15,scale:!1,shape:"polygon",axisLine:s.merge({lineStyle:{color:"#bbb"}},r.axisLine),axisLabel:n(r.axisLabel,!1),axisTick:n(r.axisTick,!1),splitLine:n(r.splitLine,!0),splitArea:n(r.splitArea,!0),indicator:[]}});t.exports=u},function(t,e,i){function n(t,e){return e.type||(e.data?"category":"value")}var o=i(13),r=i(54),a=i(1),s=o.extend({type:"singleAxis",layoutMode:"box",axis:null,coordinateSystem:null,getCoordSysModel:function(){return this}}),l={left:"5%",top:"5%",right:"5%",bottom:"5%",type:"value",position:"bottom",orient:"horizontal",axisLine:{show:!0,lineStyle:{width:2,type:"solid"}},axisTick:{show:!0,length:6,lineStyle:{width:2}},axisLabel:{show:!0,interval:"auto"},splitLine:{show:!0,lineStyle:{type:"dashed",opacity:.2}}};a.merge(s.prototype,i(52)),r("single",s,n,l),t.exports=s},function(t,e,i){function n(t,e,i){this.dimension="single",this.dimensions=["single"],this._axis=null,this._rect,this._init(t,e,i),this._model=t}var o=i(390),r=i(22),a=i(12);n.prototype={type:"singleAxis",constructor:n,_init:function(t,e,i){var n=this.dimension,a=new o(n,r.createScaleByModel(t),[0,0],t.get("type"),t.get("position")),s="category"===a.type;a.onBand=s&&t.get("boundaryGap"),a.inverse=t.get("inverse"),a.orient=t.get("orient"),t.axis=a,a.model=t,this._axis=a; -},update:function(t,e){t.eachSeries(function(t){if(t.coordinateSystem===this){var e=t.getData(),i=this.dimension;this._axis.scale.unionExtentFromData(e,t.coordDimToDataDim(i)),r.niceScaleExtent(this._axis,this._axis.model)}},this)},resize:function(t,e){this._rect=a.getLayoutRect({left:t.get("left"),top:t.get("top"),right:t.get("right"),bottom:t.get("bottom"),width:t.get("width"),height:t.get("height")},{width:e.getWidth(),height:e.getHeight()}),this._adjustAxis()},getRect:function(){return this._rect},_adjustAxis:function(){var t=this._rect,e=this._axis,i=e.isHorizontal(),n=i?[0,t.width]:[0,t.height],o=e.reverse?1:0;e.setExtent(n[o],n[1-o]),this._updateAxisTransform(e,i?t.x:t.y)},_updateAxisTransform:function(t,e){var i=t.getExtent(),n=i[0]+i[1],o=t.isHorizontal();t.toGlobalCoord=o?function(t){return t+e}:function(t){return n-t+e},t.toLocalCoord=o?function(t){return t-e}:function(t){return n-t+e}},getAxis:function(){return this._axis},getBaseAxis:function(){return this._axis},containPoint:function(t){var e=this.getRect(),i=this.getAxis(),n=i.orient;return"horizontal"===n?i.contain(i.toLocalCoord(t[0]))&&t[1]>=e.y&&t[1]<=e.y+e.height:i.contain(i.toLocalCoord(t[1]))&&t[0]>=e.y&&t[0]<=e.y+e.height},pointToData:function(t){var e=this.getAxis();return[e.coordToData(e.toLocalCoord(t["horizontal"===e.orient?0:1]))]},dataToPoint:function(t){var e=this.getAxis(),i=this.getRect(),n=[],o="horizontal"===e.orient?0:1;return n[o]=e.toGlobalCoord(e.dataToCoord(+t)),n[1-o]=0===o?i.y+i.height/2:i.x+i.width/2,n}},t.exports=n},function(t,e,i){var n=i(1),o=i(42),r=i(22),a=function(t,e,i,n,r){o.call(this,t,e,i),this.type=n||"value",this.position=r||"bottom",this.orient=null,this._labelInterval=null};a.prototype={constructor:a,model:null,isHorizontal:function(){var t=this.position;return"top"===t||"bottom"===t},getLabelInterval:function(){var t=this._labelInterval;if(!t){var e=this.model,i=e.getModel("axisLabel"),o=i.get("interval");if("category"!==this.type||"auto"!==o)return t=this._labelInterval="auto"===o?0:o;t=this._labelInterval=r.getAxisLabelInterval(n.map(this.scale.getTicks(),this.dataToCoord,this),e.getFormattedLabels(),i.getModel("textStyle").getFont(),this.isHorizontal())}return t},toGlobalCoord:null,toLocalCoord:null},n.inherits(a,o),t.exports=a},function(t,e,i){function n(t,e){var i=[];return t.eachComponent("singleAxis",function(n,r){var a=new o(n,t,e);a.name="single_"+r,a.resize(n,e),n.coordinateSystem=a,i.push(a)}),t.eachSeries(function(e){if("singleAxis"===e.get("coordinateSystem")){var i=t.queryComponents({mainType:"singleAxis",index:e.get("singleAxisIndex"),id:e.get("singleAxisId")})[0];e.coordinateSystem=i&&i.coordinateSystem}}),i}var o=i(389);i(23).register("single",{create:n,dimensions:o.prototype.dimensions})},function(t,e,i){"use strict";function n(t,e){this.id=null==t?"":t,this.inEdges=[],this.outEdges=[],this.edges=[],this.hostGraph,this.dataIndex=null==e?-1:e}function o(t,e,i){this.node1=t,this.node2=e,this.dataIndex=null==i?-1:i}var r=i(1),a=function(t){this._directed=t||!1,this.nodes=[],this.edges=[],this._nodesMap={},this._edgesMap={},this.data,this.edgeData},s=a.prototype;s.type="graph",s.isDirected=function(){return this._directed},s.addNode=function(t,e){t=t||""+e;var i=this._nodesMap;if(!i[t]){var o=new n(t,e);return o.hostGraph=this,this.nodes.push(o),i[t]=o,o}},s.getNodeByIndex=function(t){var e=this.data.getRawIndex(t);return this.nodes[e]},s.getNodeById=function(t){return this._nodesMap[t]},s.addEdge=function(t,e,i){var r=this._nodesMap,a=this._edgesMap;if("number"==typeof t&&(t=this.nodes[t]),"number"==typeof e&&(e=this.nodes[e]),t instanceof n||(t=r[t]),e instanceof n||(e=r[e]),t&&e){var s=t.id+"-"+e.id;if(!a[s]){var l=new o(t,e,i);return l.hostGraph=this,this._directed&&(t.outEdges.push(l),e.inEdges.push(l)),t.edges.push(l),t!==e&&e.edges.push(l),this.edges.push(l),a[s]=l,l}}},s.getEdgeByIndex=function(t){var e=this.edgeData.getRawIndex(t);return this.edges[e]},s.getEdge=function(t,e){t instanceof n&&(t=t.id),e instanceof n&&(e=e.id);var i=this._edgesMap;return this._directed?i[t+"-"+e]:i[t+"-"+e]||i[e+"-"+t]},s.eachNode=function(t,e){for(var i=this.nodes,n=i.length,o=0;o=0&&t.call(e,i[o],o)},s.eachEdge=function(t,e){for(var i=this.edges,n=i.length,o=0;o=0&&i[o].node1.dataIndex>=0&&i[o].node2.dataIndex>=0&&t.call(e,i[o],o)},s.breadthFirstTraverse=function(t,e,i,o){if(e instanceof n||(e=this._nodesMap[e]),e){for(var r="out"===i?"outEdges":"in"===i?"inEdges":"edges",a=0;a=0&&i.node2.dataIndex>=0});for(var o=0,r=n.length;o=0&&this[t][e].setItemVisual(this.dataIndex,i,n)},getVisual:function(i,n){return this[t][e].getItemVisual(this.dataIndex,i,n)},setLayout:function(i,n){this.dataIndex>=0&&this[t][e].setItemLayout(this.dataIndex,i,n)},getLayout:function(){return this[t][e].getItemLayout(this.dataIndex)},getGraphicEl:function(){return this[t][e].getItemGraphicEl(this.dataIndex)},getRawIndex:function(){return this[t][e].getRawIndex(this.dataIndex)}}};r.mixin(n,l("hostGraph","data")),r.mixin(o,l("hostGraph","edgeData")),a.Node=n,a.Edge=o,t.exports=a},function(t,e,i){function n(t,e){this.root,this.data,this._nodes=[],this.hostModel=t,this.levelModels=r.map(e||[],function(e){return new a(e,t,t.ecModel)})}function o(t,e){var i=e.children;t.parentNode!==e&&(i.push(t),t.parentNode=e)}var r=i(1),a=i(11),s=i(14),l=i(244),u=i(27),h=function(t,e){this.name=t||"",this.depth=0,this.height=0,this.parentNode=null,this.dataIndex=-1,this.children=[],this.viewChildren=[],this.hostTree=e};h.prototype={constructor:h,isRemoved:function(){return this.dataIndex<0},eachNode:function(t,e,i){"function"==typeof t&&(i=e,e=t,t=null),t=t||{},r.isString(t)&&(t={order:t});var n,o=t.order||"preorder",a=this[t.attr||"children"];"preorder"===o&&(n=e.call(i,this));for(var s=0;!n&&se&&(e=n.height)}this.height=e+1},getNodeById:function(t){if(this.getId()===t)return this;for(var e=0,i=this.children,n=i.length;e=0&&this.hostTree.data.setItemLayout(this.dataIndex,t,e)},getLayout:function(){return this.hostTree.data.getItemLayout(this.dataIndex)},getModel:function(t){if(!(this.dataIndex<0)){var e=this.hostTree,i=e.data.getItemModel(this.dataIndex),n=this.getLevelModel();return i.getModel(t,(n||e.hostModel).getModel(t))}},getLevelModel:function(){return(this.hostTree.levelModels||[])[this.depth]},setVisual:function(t,e){this.dataIndex>=0&&this.hostTree.data.setItemVisual(this.dataIndex,t,e)},getVisual:function(t,e){return this.hostTree.data.getItemVisual(this.dataIndex,t,e)},getRawIndex:function(){return this.hostTree.data.getRawIndex(this.dataIndex)},getId:function(){return this.hostTree.data.getId(this.dataIndex)}},n.prototype={constructor:n,type:"tree",eachNode:function(t,e,i){this.root.eachNode(t,e,i)},getNodeByDataIndex:function(t){var e=this.data.getRawIndex(t);return this._nodes[e]},getNodeByName:function(t){return this.root.getNodeByName(t)},update:function(){for(var t=this.data,e=this._nodes,i=0,n=e.length;i=a||b<0)break;if(n(S)){if(x){b+=r;continue}break}if(b===i)t[r>0?"moveTo":"lineTo"](S[0],S[1]),c(f,S);else if(v>0){var M=b+r,I=e[M];if(x)for(;I&&n(e[M]);)M+=r,I=e[M];var T=.5,A=e[_],I=e[M];if(!I||n(I))c(p,S);else{n(I)&&!x&&(I=S),s.sub(d,I,A);var L,C;if("x"===y||"y"===y){var D="x"===y?0:1;L=Math.abs(S[D]-A[D]),C=Math.abs(S[D]-I[D])}else L=s.dist(S,A),C=s.dist(S,I);T=C/(C+L),h(p,S,d,-v*(1-T))}l(f,f,m),u(f,f,g),l(p,p,m),u(p,p,g),t.bezierCurveTo(f[0],f[1],p[0],p[1],S[0],S[1]),h(f,S,d,v*T)}else t.lineTo(S[0],S[1]);_=b,b+=r}return w}function a(t,e){var i=[1/0,1/0],n=[-(1/0),-(1/0)];if(e)for(var o=0;on[0]&&(n[0]=a[0]),a[1]>n[1]&&(n[1]=a[1])}return{min:e?i:n,max:e?n:i}}var r=i(8),s=i(6),l=s.min,u=s.max,h=s.scaleAndAdd,c=s.copy,d=[],f=[],p=[];t.exports={Polyline:r.extend({type:"ec-polyline",shape:{points:[],smooth:0,smoothConstraint:!0,smoothMonotone:null,connectNulls:!1},style:{fill:null,stroke:"#000"},buildPath:function(t,e){var i=e.points,r=0,s=i.length,l=a(i,e.smoothConstraint);if(e.connectNulls){for(;s>0&&n(i[s-1]);s--);for(;r0&&n(i[l-1]);l--);for(;s=0},wrapTreePathInfo:function(t,e){for(var i=[];t;){var n=t.dataIndex;i.push({name:t.name,dataIndex:n,value:e.getRawValue(n)}),t=t.parentNode}return i.reverse(),i}};t.exports=o},function(t,e,i){"use strict";var n=i(3),o=i(1),a=i(2);i(56),i(119),a.extendComponentView({type:"grid",render:function(t,e){this.group.removeAll(),t.get("show")&&this.group.add(new n.Rect({shape:t.coordinateSystem.getRect(),style:o.defaults({fill:t.get("backgroundColor")},t.getItemStyle()),silent:!0,z2:-1}))}}),a.registerPreprocessor(function(t){t.xAxis&&t.yAxis&&!t.grid&&(t.grid={})})},function(t,e,i){function n(t){if(!t.target||!t.target.draggable){var e=t.offsetX,i=t.offsetY;this.containsPoint&&this.containsPoint(e,i)&&(this._x=e,this._y=i,this._dragging=!0)}}function o(t){if(this._dragging&&(d.stop(t.event),"pinch"!==t.gestureEvent)){if(f.isTaken(this._zr,"globalPan"))return;var e=t.offsetX,i=t.offsetY,n=this._x,o=this._y,a=e-n,r=i-o;this._x=e,this._y=i;var s=this.target;if(s){var l=s.position;l[0]+=a,l[1]+=r,s.dirty()}d.stop(t.event),this.trigger("pan",a,r,n,o,e,i)}}function a(t){this._dragging=!1}function r(t){if(0!==t.wheelDelta){var e=t.wheelDelta>0?1.1:1/1.1;l.call(this,t,e,t.offsetX,t.offsetY)}}function s(t){if(!f.isTaken(this._zr,"globalPan")){var e=t.pinchScale>1?1.1:1/1.1;l.call(this,t,e,t.pinchX,t.pinchY)}}function l(t,e,i,n){if(this.containsPoint&&this.containsPoint(i,n)){d.stop(t.event);var o=this.target,a=this.zoomLimit;if(o){var r=o.position,s=o.scale,l=this.zoom=this.zoom||1;if(l*=e,a){var u=a.min||0,h=a.max||1/0;l=Math.max(Math.min(h,l),u)}var c=l/this.zoom;this.zoom=l,r[0]-=(i-r[0])*(c-1),r[1]-=(n-r[1])*(c-1),s[0]*=c,s[1]*=c,o.dirty()}this.trigger("zoom",e,i,n)}}function u(t,e){this.target=e,this.containsPoint,this.zoomLimit,this.zoom,this._zr=t;var i=c.bind,l=i(n,this),u=i(o,this),d=i(a,this),f=i(r,this),p=i(s,this);h.call(this),this.setContainsPoint=function(t){this.containsPoint=t},this.enable=function(e){this.disable(),null==e&&(e=!0),e!==!0&&"move"!==e&&"pan"!==e||(t.on("mousedown",l),t.on("mousemove",u),t.on("mouseup",d)),e!==!0&&"scale"!==e&&"zoom"!==e||(t.on("mousewheel",f),t.on("pinch",p))},this.disable=function(){t.off("mousedown",l),t.off("mousemove",u),t.off("mouseup",d),t.off("mousewheel",f),t.off("pinch",p)},this.dispose=this.disable,this.isDragging=function(){return this._dragging},this.isPinching=function(){return this._pinching}}var h=i(23),c=i(1),d=i(20),f=i(130);c.mixin(u,h),t.exports=u},function(t,e){t.exports=function(t,e,i,n,o){function a(t,e,i){var n=e.length?e.slice():[e,e];return e[0]>e[1]&&n.reverse(),t<0&&n[0]+t0&&n[1]+t>i[1]&&(t=i[1]-n[1]),t}return t?("rigid"===n?(t=a(t,e,i),e[0]+=t,e[1]+=t):(t=a(t,e[o],i),e[o]+=t,"push"===n&&e[0]>e[1]&&(e[1-o]=e[o])),e):e}},function(t,e,i){var n=i(1),o={show:!0,zlevel:0,z:0,inverse:!1,name:"",nameLocation:"end",nameRotate:null,nameTruncate:{maxWidth:null,ellipsis:"...",placeholder:"."},nameTextStyle:{},nameGap:15,silent:!1,triggerEvent:!1,tooltip:{show:!1},axisPointer:{},axisLine:{show:!0,onZero:!0,lineStyle:{color:"#333",width:1,type:"solid"}},axisTick:{show:!0,inside:!1,length:5,lineStyle:{width:1}},axisLabel:{show:!0,inside:!1,rotate:0,margin:8,textStyle:{fontSize:12}},splitLine:{show:!0,lineStyle:{color:["#ccc"],width:1,type:"solid"}},splitArea:{show:!1,areaStyle:{color:["rgba(250,250,250,0.3)","rgba(200,200,200,0.3)"]}}},a=n.merge({boundaryGap:!0,splitLine:{show:!1},axisTick:{alignWithLabel:!1,interval:"auto"},axisLabel:{interval:"auto"}},o),r=n.merge({boundaryGap:[0,0],splitNumber:5},o),s=n.defaults({scale:!0,min:"dataMin",max:"dataMax"},r),l=n.defaults({logBase:10},r);l.scale=!0,t.exports={categoryAxis:a,valueAxis:r,timeAxis:s,logAxis:l}},function(t,e,i){"use strict";function n(t){return t.get("stack")||"__ec_stack_"+t.seriesIndex}function o(t){return t.dim+t.index}function a(t,e){var i={};s.each(t,function(t,e){var a=t.getData(),r=t.coordinateSystem,s=r.getBaseAxis(),l=s.getExtent(),h="category"===s.type?s.getBandWidth():Math.abs(l[1]-l[0])/a.count(),c=i[o(s)]||{bandWidth:h,remainedWidth:h,autoWidthCount:0,categoryGap:"20%",gap:"30%",stacks:{}},d=c.stacks;i[o(s)]=c;var f=n(t);d[f]||c.autoWidthCount++,d[f]=d[f]||{width:0,maxWidth:0};var p=u(t.get("barWidth"),h),g=u(t.get("barMaxWidth"),h),m=t.get("barGap"),v=t.get("barCategoryGap");p&&!d[f].width&&(p=Math.min(c.remainedWidth,p),d[f].width=p,c.remainedWidth-=p),g&&(d[f].maxWidth=g),null!=m&&(c.gap=m),null!=v&&(c.categoryGap=v)});var a={};return s.each(i,function(t,e){a[e]={};var i=t.stacks,n=t.bandWidth,o=u(t.categoryGap,n),r=u(t.gap,1),l=t.remainedWidth,h=t.autoWidthCount,c=(l-o)/(h+(h-1)*r);c=Math.max(c,0),s.each(i,function(t,e){var i=t.maxWidth;!t.width&&i&&i=0?"p":"n",v=m[i],y=l[s][i][h],x=u[s][i][h];f.isHorizontal()?(n=y,o=v[1]+c,a=v[0]-x,r=d,u[s][i][h]+=a,Math.abs(a)e+s&&r>n+s||rt+s&&a>i+s||ae+h&&u>o+h&&u>r+h||ut+h&&l>i+h&&l>a+h||le&&a>n||ao?r:0}},function(t,e,i){"use strict";var n=i(1),o=i(41),a=function(t,e,i,n,a,r){this.x=null==t?0:t,this.y=null==e?0:e,this.x2=null==i?1:i,this.y2=null==n?0:n,this.type="linear",this.global=r||!1,o.call(this,a)};a.prototype={constructor:a},n.inherits(a,o),t.exports=a},function(t,e,i){"use strict";function n(t){return t>s||t<-s}var o=i(19),a=i(6),r=o.identity,s=5e-5,l=function(t){t=t||{},t.position||(this.position=[0,0]),null==t.rotation&&(this.rotation=0),t.scale||(this.scale=[1,1]),this.origin=this.origin||null},u=l.prototype;u.transform=null,u.needLocalTransform=function(){return n(this.rotation)||n(this.position[0])||n(this.position[1])||n(this.scale[0]-1)||n(this.scale[1]-1)},u.updateTransform=function(){var t=this.parent,e=t&&t.transform,i=this.needLocalTransform(),n=this.transform;return i||e?(n=n||o.create(),i?this.getLocalTransform(n):r(n),e&&(i?o.mul(n,t.transform,n):o.copy(n,t.transform)),this.transform=n,this.invTransform=this.invTransform||o.create(),void o.invert(this.invTransform,n)):void(n&&r(n))},u.getLocalTransform=function(t){t=t||[],r(t);var e=this.origin,i=this.scale,n=this.rotation,a=this.position;return e&&(t[4]-=e[0],t[5]-=e[1]),o.scale(t,t,i),n&&o.rotate(t,t,n),e&&(t[4]+=e[0],t[5]+=e[1]),t[4]+=a[0],t[5]+=a[1],t},u.setTransform=function(t){var e=this.transform,i=t.dpr||1;e?t.setTransform(i*e[0],i*e[1],i*e[2],i*e[3],i*e[4],i*e[5]):t.setTransform(i,0,0,i,0,0)},u.restoreTransform=function(t){var e=(this.transform,t.dpr||1);t.setTransform(e,0,0,e,0,0)};var h=[];u.decomposeTransform=function(){if(this.transform){var t=this.parent,e=this.transform;t&&t.transform&&(o.mul(h,t.invTransform,e),e=h);var i=e[0]*e[0]+e[1]*e[1],a=e[2]*e[2]+e[3]*e[3],r=this.position,s=this.scale;n(i-1)&&(i=Math.sqrt(i)),n(a-1)&&(a=Math.sqrt(a)),e[0]<0&&(i=-i),e[3]<0&&(a=-a),r[0]=e[4],r[1]=e[5],s[0]=i,s[1]=a,this.rotation=Math.atan2(-e[1]/a,e[0]/i)}},u.getGlobalScale=function(){var t=this.transform;if(!t)return[1,1];var e=Math.sqrt(t[0]*t[0]+t[1]*t[1]),i=Math.sqrt(t[2]*t[2]+t[3]*t[3]);return t[0]<0&&(e=-e),t[3]<0&&(i=-i),[e,i]},u.transformCoordToLocal=function(t,e){var i=[t,e],n=this.invTransform;return n&&a.applyTransform(i,i,n),i},u.transformCoordToGlobal=function(t,e){var i=[t,e],n=this.transform;return n&&a.applyTransform(i,i,n),i},t.exports=l},function(t,e,i){"use strict";function n(t,e){o.each(a,function(e){this[e]=o.bind(t[e],t)},this),this.getCoordinateSystems=o.bind(e.getCoordinateSystems,e)}var o=i(1),a=["getDom","getZr","getWidth","getHeight","getDevicePixelRatio","dispatchAction","isDisposed","on","off","getDataURL","getConnectedDataURL","getModel","getOption","getViewOfComponentModel","getViewOfSeriesModel"];t.exports=n},function(t,e,i){var n=i(1);i(56),i(105),i(106);var o=i(97),a=i(2);a.registerLayout(n.curry(o,"bar")),a.registerVisual(function(t){t.eachSeriesByType("bar",function(t){var e=t.getData();e.setVisual("legendSymbol","roundRect")})}),i(38)},function(t,e,i){t.exports=i(89).extend({type:"series.bar",dependencies:["grid","polar"],brushSelector:"rect"})},function(t,e,i){"use strict";function n(t,e,i,n,o,a,r){var s=new u.Rect({shape:l.extend({},n)});if(a){var h=s.shape,c=o?"height":"width",d={};h[c]=0,d[c]=n[c],u[r?"updateProps":"initProps"](s,{shape:d},a,e)}return s}function o(t,e,i){i.style.text="",u.updateProps(i,{shape:{width:0}},e,t,function(){i.parent&&i.parent.remove(i)})}function a(t,e,i){var n=t.getItemLayout(e),o=s(i,n),a=n.width>0?1:-1,r=n.height>0?1:-1;return{x:n.x+a*o/2,y:n.y+r*o/2,width:n.width-a*o,height:n.height-r*o}}function r(t,e,i,n,o,a,r){var s=e.getItemVisual(i,"color"),c=e.getItemVisual(i,"opacity"),d=n.getModel("itemStyle.normal"),f=n.getModel("itemStyle.emphasis").getBarItemStyle();t.setShape("r",d.get("barBorderRadius")||0),t.useStyle(l.defaults({fill:s,opacity:c},d.getBarItemStyle()));var p=r?o.height>0?"bottom":"top":o.width>0?"left":"right";h.setLabel(t.style,f,n,s,a,i,p),u.setHoverStyle(t,f)}function s(t,e){var i=t.get(c)||0;return Math.min(i,Math.abs(e.width),Math.abs(e.height))}var l=i(1),u=i(3),h=i(90),c=["itemStyle","normal","barBorderWidth"];l.extend(i(10).prototype,i(107));var d=i(2).extendChartView({type:"bar",render:function(t,e,i){var n=t.get("coordinateSystem");return"cartesian2d"===n&&this._renderOnCartesian(t,e,i),this.group},dispose:l.noop,_renderOnCartesian:function(t,e,i){var s=this.group,l=t.getData(),h=this._data,c=t.coordinateSystem,d=c.getBaseAxis(),f=d.isHorizontal(),p=t.isAnimationEnabled()?t:null;l.diff(h).add(function(e){if(l.hasValue(e)){var i=l.getItemModel(e),o=a(l,e,i),u=n(l,e,i,o,f,p);l.setItemGraphicEl(e,u),s.add(u),r(u,l,e,i,o,t,f)}}).update(function(e,i){var o=h.getItemGraphicEl(i);if(!l.hasValue(e))return void s.remove(o);var c=l.getItemModel(e),d=a(l,e,c);o?u.updateProps(o,{shape:d},p,e):o=n(l,e,c,d,f,p,!0),l.setItemGraphicEl(e,o),s.add(o),r(o,l,e,c,d,t,f)}).remove(function(t){var e=h.getItemGraphicEl(t);e&&o(t,p,e)}).execute(),this._data=l},remove:function(t,e){var i=this.group,n=this._data;t.get("animation")?n&&n.eachItemGraphicEl(function(e){o(e.dataIndex,t,e)}):i.removeAll()}});t.exports=d},function(t,e,i){var n=i(31)([["fill","color"],["stroke","borderColor"],["lineWidth","borderWidth"],["stroke","barBorderColor"],["lineWidth","barBorderWidth"],["opacity"],["shadowBlur"],["shadowOffsetX"],["shadowOffsetY"],["shadowColor"]]);t.exports={getBarItemStyle:function(t){var e=n.call(this,t);if(this.getBorderLineDash){var i=this.getBorderLineDash();i&&(e.lineDash=i)}return e}}},function(t,e,i){function n(t){return"_"+t+"Type"}function o(t,e,i){var n=e.getItemVisual(i,"color"),o=e.getItemVisual(i,t),a=e.getItemVisual(i,t+"Size");if(o&&"none"!==o){f.isArray(a)||(a=[a,a]);var r=u.createSymbol(o,-a[0]/2,-a[1]/2,a[0],a[1],n);return r.name=t,r}}function a(t){var e=new c({name:"line"});return r(e.shape,t),e}function r(t,e){var i=e[0],n=e[1],o=e[2];t.x1=i[0],t.y1=i[1],t.x2=n[0],t.y2=n[1],t.percent=1,o?(t.cpx1=o[0],t.cpy1=o[1]):(t.cpx1=NaN,t.cpy1=NaN)}function s(){var t=this,e=t.childOfName("fromSymbol"),i=t.childOfName("toSymbol"),n=t.childOfName("label");if(e||i||!n.ignore){for(var o=1,a=this.parent;a;)a.scale&&(o/=a.scale[0]),a=a.parent;var r=t.childOfName("line");if(this.__dirty||r.__dirty){var s=r.shape.percent,l=r.pointAt(0),u=r.pointAt(s),c=h.sub([],u,l);if(h.normalize(c,c),e){e.attr("position",l);var d=r.tangentAt(0);e.attr("rotation",Math.PI/2-Math.atan2(d[1],d[0])),e.attr("scale",[o*s,o*s])}if(i){i.attr("position",u);var d=r.tangentAt(1);i.attr("rotation",-Math.PI/2-Math.atan2(d[1],d[0])),i.attr("scale",[o*s,o*s])}if(!n.ignore){n.attr("position",u);var f,p,g,m=5*o;if("end"===n.__position)f=[c[0]*m+u[0],c[1]*m+u[1]],p=c[0]>.8?"left":c[0]<-.8?"right":"center",g=c[1]>.8?"top":c[1]<-.8?"bottom":"middle";else if("middle"===n.__position){var v=s/2,d=r.tangentAt(v),y=[d[1],-d[0]],x=r.pointAt(v);y[1]>0&&(y[0]=-y[0],y[1]=-y[1]),f=[x[0]+y[0]*m,x[1]+y[1]*m],p="center",g="bottom";var _=-Math.atan2(d[1],d[0]);u[0].8?"right":c[0]<-.8?"left":"center",g=c[1]>.8?"bottom":c[1]<-.8?"top":"middle";n.attr({style:{textVerticalAlign:n.__verticalAlign||g,textAlign:n.__textAlign||p},position:f,scale:[o,o]})}}}}function l(t,e,i){d.Group.call(this),this._createLine(t,e,i)}var u=i(24),h=i(6),c=i(191),d=i(3),f=i(1),p=i(4),g=["fromSymbol","toSymbol"],m=l.prototype;m.beforeUpdate=s,m._createLine=function(t,e,i){var r=t.hostModel,s=t.getItemLayout(e),l=a(s);l.shape.percent=0,d.initProps(l,{shape:{percent:1}},r,e),this.add(l);var u=new d.Text({name:"label"});this.add(u),f.each(g,function(i){var a=o(i,t,e);this.add(a),this[n(i)]=t.getItemVisual(e,i)},this),this._updateCommonStl(t,e,i)},m.updateData=function(t,e,i){var a=t.hostModel,s=this.childOfName("line"),l=t.getItemLayout(e),u={shape:{}};r(u.shape,l),d.updateProps(s,u,a,e),f.each(g,function(i){var a=t.getItemVisual(e,i),r=n(i);if(this[r]!==a){this.remove(this.childOfName(i));var s=o(i,t,e);this.add(s)}this[r]=a},this),this._updateCommonStl(t,e,i)},m._updateCommonStl=function(t,e,i){var n=t.hostModel,o=this.childOfName("line"),a=i&&i.lineStyle,r=i&&i.hoverLineStyle,s=i&&i.labelModel,l=i&&i.hoverLabelModel;if(!i||t.hasItemOption){var u=t.getItemModel(e);a=u.getModel("lineStyle.normal").getLineStyle(),r=u.getModel("lineStyle.emphasis").getLineStyle(),s=u.getModel("label.normal"),l=u.getModel("label.emphasis")}var h=t.getItemVisual(e,"color"),c=f.retrieve(t.getItemVisual(e,"opacity"),a.opacity,1);o.useStyle(f.defaults({strokeNoScale:!0,fill:"none",stroke:h,opacity:c},a)),o.hoverStyle=r,f.each(g,function(t){var e=this.childOfName(t);e&&(e.setColor(h),e.setStyle({opacity:c}))},this);var m,v,y=s.getShallow("show"),x=l.getShallow("show"),_=this.childOfName("label");if(y||x){var b=n.getRawValue(e);v=null==b?v=t.getName(e):isFinite(b)?p.round(b):b,m=h||"#000"}if(y){var w=s.getModel("textStyle");_.setStyle({text:f.retrieve(n.getFormattedLabel(e,"normal",t.dataType),v),textFont:w.getFont(),fill:w.getTextColor()||m}),_.__textAlign=w.get("align"),_.__verticalAlign=w.get("baseline"),_.__position=s.get("position")}else _.setStyle("text","");if(x){var S=l.getModel("textStyle");_.hoverStyle={text:f.retrieve(n.getFormattedLabel(e,"emphasis",t.dataType),v),textFont:S.getFont(),fill:S.getTextColor()||m}}else _.hoverStyle={text:""};_.ignore=!y&&!x,d.setHoverStyle(this)},m.updateLayout=function(t,e){this.setLinePoints(t.getItemLayout(e))},m.setLinePoints=function(t){var e=this.childOfName("line");r(e.shape,t),e.dirty()},f.inherits(l,d.Group),t.exports=l},function(t,e,i){function n(t){return isNaN(t[0])||isNaN(t[1])}function o(t){return!n(t[0])&&!n(t[1])}function a(t){this._ctor=t||s,this.group=new r.Group}var r=i(3),s=i(108),l=a.prototype;l.updateData=function(t){var e=this._lineData,i=this.group,n=this._ctor,a=t.hostModel,r={lineStyle:a.getModel("lineStyle.normal").getLineStyle(),hoverLineStyle:a.getModel("lineStyle.emphasis").getLineStyle(),labelModel:a.getModel("label.normal"),hoverLabelModel:a.getModel("label.emphasis")};t.diff(e).add(function(e){if(o(t.getItemLayout(e))){var a=new n(t,e,r);t.setItemGraphicEl(e,a),i.add(a)}}).update(function(a,s){var l=e.getItemGraphicEl(s);return o(t.getItemLayout(a))?(l?l.updateData(t,a,r):l=new n(t,a,r),t.setItemGraphicEl(a,l),void i.add(l)):void i.remove(l)}).remove(function(t){i.remove(e.getItemGraphicEl(t))}).execute(),this._lineData=t},l.updateLayout=function(){var t=this._lineData;t.eachItemGraphicEl(function(e,i){e.updateLayout(t,i)},this)},l.remove=function(){this.group.removeAll()},t.exports=a},function(t,e,i){var n=i(1),o=i(2),a=o.PRIORITY;i(111),i(112),o.registerVisual(n.curry(i(50),"line","circle","line")),o.registerLayout(n.curry(i(61),"line")),o.registerProcessor(a.PROCESSOR.STATISTIC,n.curry(i(149),"line")),i(38)},function(t,e,i){"use strict";var n=i(27),o=i(18);t.exports=o.extend({type:"series.line",dependencies:["grid","polar"],getInitialData:function(t,e){return n(t.data,this,e)},defaultOption:{zlevel:0,z:2,coordinateSystem:"cartesian2d",legendHoverLink:!0,hoverAnimation:!0,clipOverflow:!0,label:{normal:{position:"top"}},lineStyle:{normal:{width:2,type:"solid"}},step:!1,smooth:!1,smoothMonotone:null,symbol:"emptyCircle",symbolSize:4,symbolRotate:null,showSymbol:!0,showAllSymbol:!1,connectNulls:!1,sampling:"none",animationEasing:"linear",progressive:0,hoverLayerThreshold:1/0}})},function(t,e,i){"use strict";function n(t,e){if(t.length===e.length){for(var i=0;ie[0]?1:-1;e[0]+=n*i,e[1]-=n*i}return e}function r(t){return t>=0?1:-1}function s(t,e){var i=t.getBaseAxis(),n=t.getOtherAxis(i),o=i.onZero?0:n.scale.getExtent()[0],a=n.dim,s="x"===a||"radius"===a?1:0;return e.mapArray([a],function(n,l){for(var u,h=e.stackedOn;h&&r(h.get(a,l))===r(n);){u=h;break}var c=[];return c[s]=e.get(i.dim,l),c[1-s]=u?u.get(a,l,!0):o,t.dataToPoint(c)},!0)}function l(t,e,i){var n=a(t.getAxis("x")),o=a(t.getAxis("y")),r=t.getBaseAxis().isHorizontal(),s=Math.min(n[0],n[1]),l=Math.min(o[0],o[1]),u=Math.max(n[0],n[1])-s,h=Math.max(o[0],o[1])-l,c=i.get("lineStyle.normal.width")||2,d=i.get("clipOverflow")?c/2:Math.max(u,h);r?(l-=d,h+=2*d):(s-=d,u+=2*d);var f=new v.Rect({shape:{x:s,y:l,width:u,height:h}});return e&&(f.shape[r?"width":"height"]=0,v.initProps(f,{shape:{width:u,height:h}},i)),f}function u(t,e,i){var n=t.getAngleAxis(),o=t.getRadiusAxis(),a=o.getExtent(),r=n.getExtent(),s=Math.PI/180,l=new v.Sector({shape:{cx:t.cx,cy:t.cy,r0:a[0],r:a[1],startAngle:-r[0]*s,endAngle:-r[1]*s,clockwise:n.inverse}});return e&&(l.shape.endAngle=-r[0]*s,v.initProps(l,{shape:{endAngle:-r[1]*s}},i)),l}function h(t,e,i){return"polar"===t.type?u(t,e,i):l(t,e,i)}function c(t,e,i){for(var n=e.getBaseAxis(),o="x"===n.dim||"radius"===n.dim?0:1,a=[],r=0;r=0;o--)if(i[o].dimension<2){n=i[o];break}if(n&&"cartesian2d"===e.type){var a=n.dimension,r=t.dimensions[a],s=e.getAxis(r),l=f.map(n.stops,function(t){return{coord:s.toGlobalCoord(s.dataToCoord(t.value)),color:t.color}}),u=l.length,h=n.outerColors.slice();u&&l[0].coord>l[u-1].coord&&(l.reverse(),h.reverse());var c=10,d=l[0].coord-c,p=l[u-1].coord+c,g=p-d;if(g<.001)return"transparent";f.each(l,function(t){t.offset=(t.coord-d)/g}),l.push({offset:u?l[u-1].offset:.5,color:h[1]||"transparent"}),l.unshift({offset:u?l[0].offset:.5,color:h[0]||"transparent"});var m=new v.LinearGradient(0,0,0,0,l,(!0));return m[r]=d,m[r+"2"]=p,m}}}var f=i(1),p=i(44),g=i(54),m=i(113),v=i(3),y=i(5),x=i(91),_=i(29);t.exports=_.extend({type:"line",init:function(){var t=new v.Group,e=new p;this.group.add(e.group),this._symbolDraw=e,this._lineGroup=t},render:function(t,e,i){var a=t.coordinateSystem,r=this.group,l=t.getData(),u=t.getModel("lineStyle.normal"),p=t.getModel("areaStyle.normal"),g=l.mapArray(l.getItemLayout,!0),m="polar"===a.type,v=this._coordSys,y=this._symbolDraw,x=this._polyline,_=this._polygon,b=this._lineGroup,w=t.get("animation"),S=!p.isEmpty(),M=s(a,l),I=t.get("showSymbol"),T=I&&!m&&!t.get("showAllSymbol")&&this._getSymbolIgnoreFunc(l,a),A=this._data;A&&A.eachItemGraphicEl(function(t,e){t.__temp&&(r.remove(t),A.setItemGraphicEl(e,null))}),I||y.remove(),r.add(b);var L=!m&&t.get("step");x&&v.type===a.type&&L===this._step?(S&&!_?_=this._newPolygon(g,M,a,w):_&&!S&&(b.remove(_),_=this._polygon=null),b.setClipPath(h(a,!1,t)),I&&y.updateData(l,T),l.eachItemGraphicEl(function(t){t.stopAnimation(!0)}),n(this._stackedOnPoints,M)&&n(this._points,g)||(w?this._updateAnimation(l,M,a,i,L):(L&&(g=c(g,a,L),M=c(M,a,L)),x.setShape({points:g}),_&&_.setShape({points:g,stackedOnPoints:M})))):(I&&y.updateData(l,T),L&&(g=c(g,a,L),M=c(M,a,L)),x=this._newPolyline(g,a,w),S&&(_=this._newPolygon(g,M,a,w)),b.setClipPath(h(a,!0,t)));var C=d(l,a)||l.getVisual("color");x.useStyle(f.defaults(u.getLineStyle(),{fill:"none",stroke:C,lineJoin:"bevel"}));var D=t.get("smooth");if(D=o(t.get("smooth")),x.setShape({smooth:D,smoothMonotone:t.get("smoothMonotone"),connectNulls:t.get("connectNulls")}),_){var P=l.stackedOn,k=0;if(_.useStyle(f.defaults(p.getAreaStyle(),{fill:C,opacity:.7,lineJoin:"bevel"})),P){var O=P.hostModel;k=o(O.get("smooth"))}_.setShape({smooth:D,stackedOnSmooth:k,smoothMonotone:t.get("smoothMonotone"),connectNulls:t.get("connectNulls")})}this._data=l,this._coordSys=a,this._stackedOnPoints=M,this._points=g,this._step=L},dispose:function(){},highlight:function(t,e,i,n){var o=t.getData(),a=y.queryDataIndex(o,n);if(!(a instanceof Array)&&null!=a&&a>=0){var r=o.getItemGraphicEl(a);if(!r){var s=o.getItemLayout(a);if(!s)return;r=new g(o,a),r.position=s,r.setZ(t.get("zlevel"),t.get("z")),r.ignore=isNaN(s[0])||isNaN(s[1]),r.__temp=!0,o.setItemGraphicEl(a,r),r.stopSymbolAnimation(!0),this.group.add(r)}r.highlight()}else _.prototype.highlight.call(this,t,e,i,n)},downplay:function(t,e,i,n){var o=t.getData(),a=y.queryDataIndex(o,n);if(null!=a&&a>=0){var r=o.getItemGraphicEl(a);r&&(r.__temp?(o.setItemGraphicEl(a,null),this.group.remove(r)):r.downplay())}else _.prototype.downplay.call(this,t,e,i,n)},_newPolyline:function(t){var e=this._polyline;return e&&this._lineGroup.remove(e),e=new x.Polyline({shape:{points:t},silent:!0,z2:10}),this._lineGroup.add(e),this._polyline=e,e},_newPolygon:function(t,e){var i=this._polygon;return i&&this._lineGroup.remove(i),i=new x.Polygon({shape:{points:t,stackedOnPoints:e},silent:!0}),this._lineGroup.add(i),this._polygon=i,i},_getSymbolIgnoreFunc:function(t,e){var i=e.getAxesByScale("ordinal")[0];if(i&&i.isLabelIgnored)return f.bind(i.isLabelIgnored,i)},_updateAnimation:function(t,e,i,n,o){var a=this._polyline,r=this._polygon,s=t.hostModel,l=m(this._data,t,this._stackedOnPoints,e,this._coordSys,i),u=l.current,h=l.stackedOnCurrent,d=l.next,f=l.stackedOnNext;o&&(u=c(l.current,i,o),h=c(l.stackedOnCurrent,i,o),d=c(l.next,i,o),f=c(l.stackedOnNext,i,o)),a.shape.__points=l.current,a.shape.points=u,v.updateProps(a,{shape:{points:d}},s),r&&(r.setShape({points:u,stackedOnPoints:h}),v.updateProps(r,{shape:{points:d,stackedOnPoints:f}},s));for(var p=[],g=l.status,y=0;y=0?1:-1}function n(t,e,n){for(var o,a=t.getBaseAxis(),r=t.getOtherAxis(a),s=a.onZero?0:r.scale.getExtent()[0],l=r.dim,u="x"===l||"radius"===l?1:0,h=e.stackedOn,c=e.get(l,n);h&&i(h.get(l,n))===i(c);){o=h;break}var d=[];return d[u]=e.get(a.dim,n),d[1-u]=o?o.get(l,n,!0):s,t.dataToPoint(d)}function o(t,e){var i=[];return e.diff(t).add(function(t){i.push({cmd:"+",idx:t})}).update(function(t,e){i.push({cmd:"=",idx:e,idx1:t})}).remove(function(t){i.push({cmd:"-",idx:t})}).execute(),i}t.exports=function(t,e,i,a,r,s){for(var l=o(t,e),u=[],h=[],c=[],d=[],f=[],p=[],g=[],m=s.dimensions,v=0;v0&&"scale"!==d){var g=r.getItemLayout(0),m=Math.max(i.getWidth(),i.getHeight())/2,v=l.bind(u.removeClipPath,u);u.setClipPath(this._createClipPath(g.cx,g.cy,m,g.startAngle,g.clockwise,v,t))}this._data=r}},dispose:function(){},_createClipPath:function(t,e,i,n,o,a,r){var l=new s.Sector({shape:{cx:t,cy:e,r0:0,r:i,startAngle:n,endAngle:n,clockwise:o}});return s.initProps(l,{shape:{endAngle:n+(o?1:-1)*Math.PI*2}},r,a),l},containPoint:function(t,e){var i=e.getData(),n=i.getItemLayout(0);if(n){var o=t[0]-n.cx,a=t[1]-n.cy,r=Math.sqrt(o*o+a*a);return r<=n.r&&r>=n.r0}}});t.exports=h},function(t,e,i){"use strict";function n(t,e,i,n,o,a,r){function s(e,i,n,o){for(var a=e;ae&&a+1t[a].y+t[a].height)return void l(a,n/2);l(i-1,n/2)}function l(e,i){for(var n=e;n>=0&&(t[n].y-=i,!(n>0&&t[n].y>t[n-1].y+t[n-1].height));n--);}function u(t,e,i,n,o,a){for(var r=a>0?e?Number.MAX_VALUE:0:e?Number.MAX_VALUE:0,s=0,l=t.length;s=r&&(d=r-10),!e&&d<=r&&(d=r+10),t[s].x=i+d*a,r=d}}t.sort(function(t,e){return t.y-e.y});for(var h,c=0,d=t.length,f=[],p=[],g=0;g=i?p.push(t[g]):f.push(t[g]);u(f,!1,e,i,n,o),u(p,!0,e,i,n,o)}function o(t,e,i,o,a,r){for(var s=[],l=[],u=0;u0?"left":"right"}var D=g.getModel("textStyle").getFont(),P=g.get("rotate")?b<0?-_+Math.PI:-_:0,k=t.getFormattedLabel(i,"normal")||l.getName(i),O=a.getBoundingRect(k,D,d,"top");h=!!P,f.label={x:n,y:o,position:m,height:O.height,len:y,len2:x,linePoints:c,textAlign:d,verticalAlign:"middle",font:D,rotation:P},S||u.push(f.label)}),!h&&t.get("avoidLabelOverlap")&&o(u,r,s,e,i,n)}},function(t,e,i){var n=i(4),o=n.parsePercent,a=i(117),r=i(1),s=2*Math.PI,l=Math.PI/180;t.exports=function(t,e,i,u){e.eachSeriesByType(t,function(t){var e=t.get("center"),u=t.get("radius");r.isArray(u)||(u=[0,u]),r.isArray(e)||(e=[e,e]);var h=i.getWidth(),c=i.getHeight(),d=Math.min(h,c),f=o(e[0],h),p=o(e[1],c),g=o(u[0],d/2),m=o(u[1],d/2),v=t.getData(),y=-t.get("startAngle")*l,x=t.get("minAngle")*l,_=v.getSum("value"),b=Math.PI/(_||v.count())*2,w=t.get("clockwise"),S=t.get("roseType"),M=t.get("stillShowZeroSum"),I=v.getDataExtent("value");I[0]=0;var T=s,A=0,L=y,C=w?1:-1;if(v.each("value",function(t,e){var i;if(isNaN(t))return void v.setItemLayout(e,{angle:NaN,startAngle:NaN,endAngle:NaN,clockwise:w,cx:f,cy:p,r0:g,r:S?NaN:m});i="area"!==S?0===_&&M?b:t*b:s/(v.count()||1),i=0)&&i({type:"updateAxisPointer",currTrigger:t,x:e&&e.offsetX,y:e&&e.offsetY})})},remove:function(t,e){n.disopse(e.getZr(),"axisPointer"),o.superApply(this._model,"remove",arguments)},dispose:function(t,e){n.unregister("axisPointer",e),o.superApply(this._model,"dispose",arguments)}})},function(t,e,i){"use strict";function n(t,e){var i={};return i[e.dim+"AxisIndex"]=e.index,t.getCartesian(i)}function o(t){return"x"===t.dim?0:1}var a=i(3),r=i(74),s=i(55),l=i(58),u=r.extend({makeElOption:function(t,e,i,o,a){var r=i.axis,u=r.grid,c=o.get("type"),d=n(u,r).getOtherAxis(r).getGlobalExtent(),f=r.toGlobalCoord(r.dataToCoord(e,!0)),p=s.buildElStyle(o),g=h[c](r,f,d,p);g.style=p,t.graphicKey=g.type,t.pointer=g;var m=l.layout(u.model,i);s.buildCartesianSingleLabelElOption(e,t,m,i,o,a)},getHandleTransform:function(t,e,i){var n=l.layout(e.axis.grid.model,e,{labelInside:!1});return n.labelMargin=i.get("handle.margin"),{position:s.getTransformedPosition(e.axis,t,n),rotation:n.rotation+(n.labelDirection<0?Math.PI:0)}},updateHandleTransform:function(t,e,i,o){var a=i.axis,r=a.grid,s=a.getGlobalExtent(!0),l=n(r,a).getOtherAxis(a).getGlobalExtent(),u="x"===a.dim?0:1,h=t.position;h[u]+=e[u],h[u]=Math.min(s[1],h[u]),h[u]=Math.max(s[0],h[u]);var c=(l[1]+l[0])/2,d=[c,c];d[u]=h[u];var f=[{verticalAlign:"middle"},{align:"center"}];return{position:h,rotation:t.rotation,cursorPoint:d,tooltipOption:f[u]}}}),h={line:function(t,e,i,n){var r=s.makeLineShape([e,i[0]],[e,i[1]],o(t));return a.subPixelOptimizeLine({shape:r,style:n}),{type:"Line",shape:r}},shadow:function(t,e,i,n){var a=t.getBandWidth(),r=i[1]-i[0];return{type:"Rect",shape:s.makeRectShape([e-a/2,i[0]],[a,r],o(t))}}};t.exports=u},function(t,e,i){function n(t,e,i,n,a,g,m,v){var b=[];b=null!=i.x&&null!=i.y?[i.x,i.y]:y({seriesIndex:i.seriesIndex,dataIndex:i.dataIndex},a).point;var w=t.axesInfo,S="leave"===e||p(b),M={},I={},T={list:[],map:{}},A=[],L={showPointer:_(r,I),showTooltip:_(s,T),highlight:_(l,A)};return x(t.coordSysMap,function(e,n){var a=e.containPoint(b);x(t.coordSysAxesInfo[n],function(t,e){var n=t.axis;S||!a||d(i,n)||o(t,n.pointToData(b),L,!1,M)})}),x(w,function(t,e){var i=t.linkGroup;i&&!I[e]&&x(i.axesInfo,function(e,n){var a=I[n];if(e!==t&&a){var r=a.value;i.mapper&&(r=t.axis.scale.parse(i.mapper(r,f(e),f(t)))),o(t,r,L,!0,M)}})}),u(I,w),h(T,b,m,n),c(A,n,g,v),M}function o(t,e,i,n,o){var r=t.axis;if(!r.scale.isBlank()&&r.containData(e)){if(!t.involveSeries)return void i.showPointer(t,e);var s=a(e,t),l=s.payloadBatch,u=s.snapToValue;l[0]&&null==o.seriesIndex&&g.extend(o,l[0]),!n&&t.snap&&r.containData(u)&&null!=u&&(e=u),i.highlight("highlight",l),i.showPointer(t,e,l),i.showTooltip(t,s,u)}}function a(t,e){var i=e.axis,n=i.dim,o=t,a=[],r=Number.MAX_VALUE,s=-1;return x(e.seriesModels,function(e,l){var u,h,c=e.coordDimToDataDim(n);if(e.getAxisTooltipData){var d=e.getAxisTooltipData(c,t,i);h=d.dataIndices,u=d.nestestValue}else{if(h=e.getData().indexOfNearest(c[0],t,!1,"category"===i.type?.5:null),!h.length)return;u=e.getData().get(c[0],h[0])}if(null!=u&&isFinite(u)){var f=t-u,p=Math.abs(f);p<=r&&((p=0&&s<0)&&(r=p,s=f,o=u,a.length=0),x(h,function(t){a.push({seriesIndex:e.seriesIndex,dataIndexInside:t,dataIndex:e.getData().getRawIndex(t)})}))}}),{payloadBatch:a,snapToValue:o}}function r(t,e,i,n){t[e.key]={value:i,payloadBatch:n}}function s(t,e,i,n){var o=i.payloadBatch,a=e.axis,r=a.model,s=e.axisPointerModel;if(e.triggerTooltip&&o.length){var l=e.coordSys.model,u=v.makeKey(l),h=t.map[u];h||(h=t.map[u]={coordSysId:l.id,coordSysIndex:l.componentIndex,coordSysType:l.type,coordSysMainType:l.mainType,dataByAxis:[]},t.list.push(h)),h.dataByAxis.push({axisDim:a.dim,axisIndex:r.componentIndex,axisType:r.type,axisId:r.id,value:n,valueLabelOpt:{precision:s.get("label.precision"),formatter:s.get("label.formatter")},seriesDataIndices:o.slice()})}}function l(t,e,i){t.push.apply(t,i)}function u(t,e){x(e,function(e,i){var n=e.axisPointerModel.option,o=t[i];o?(!e.useHandle&&(n.status="show"),n.value=o.value,n.seriesDataIndices=(o.payloadBatch||[]).slice()):!e.useHandle&&(n.status="hide")})}function h(t,e,i,n){if(p(e)||!t.list.length)return void n({type:"hideTip"});var o=((t.list[0].dataByAxis[0]||{}).seriesDataIndices||[])[0]||{};n({type:"showTip",escapeConnect:!0,x:e[0],y:e[1],tooltipOption:i,dataIndexInside:o.dataIndexInside,dataIndex:o.dataIndex,seriesIndex:o.seriesIndex,dataByCoordSys:t.list})}function c(t,e,i,n){var o=i.getZr();n="lastHighlights"+(n||"");var a=b(o)[n]||{},r=b(o)[n]={};g.each(t,function(t){var e=t.seriesIndex+" | "+t.dataIndex;r[e]=t});var s=[],l=[];g.each(a,function(t,e){!r[e]&&l.push(t)}),g.each(r,function(t,e){!a[e]&&s.push(t)}),l.length&&i.dispatchAction({type:"downplay",escapeConnect:!0,batch:l}),s.length&&i.dispatchAction({type:"highlight",escapeConnect:!0,batch:s})}function d(t,e){var i=1;return x(t,function(t,e){i&=!/^.+(AxisId|AxisName|AxisIndex)$/.test(e)}),!i&&x([["AxisId","id"],["AxisIndex","componentIndex"],["AxisName","name"]],function(n){var o=m.normalizeToArray(t[e.dim+n[0]]);i|=g.indexOf(o,e.model[n[1]])>=0}),!i}function f(t){var e=t.axis.model,i={},n=i.axisDim=t.axis.dim;return i.axisIndex=i[n+"AxisIndex"]=e.componentIndex,i.axisName=i[n+"AxisName"]=e.name,i.axisId=i[n+"AxisId"]=e.id,i}function p(t){return null==t[0]||isNaN(t[0])||null==t[1]||isNaN(t[1])}var g=i(1),m=i(5),v=i(32),y=i(75),x=g.each,_=g.curry,b=m.makeGetter();t.exports=n},function(t,e,i){var n=i(1),o=i(77),a=i(2);a.registerAction("dataZoom",function(t,e){var i=o.createLinkedNodesFinder(n.bind(e.eachComponent,e,"dataZoom"),o.eachAxisDim,function(t,e){return t.get(e.axisIndex)}),a=[];e.eachComponent({mainType:"dataZoom",query:t},function(t,e){a.push.apply(a,i(t).nodes)}),n.each(a,function(e,i){e.setRawRange({start:t.start,end:t.end,startValue:t.startValue,endValue:t.endValue})})})},function(t,e,i){function n(t,e,i){i.getAxisProxy(t.name,e).reset(i)}function o(t,e,i){i.getAxisProxy(t.name,e).filterData(i)}var a=i(2);a.registerProcessor(function(t,e){t.eachComponent("dataZoom",function(t){t.eachTargetAxis(n),t.eachTargetAxis(o)}),t.eachComponent("dataZoom",function(t){var e=t.findRepresentativeAxisProxy(),i=e.getDataPercentWindow(),n=e.getDataValueWindow();t.setRawRange({start:i[0],end:i[1],startValue:n[0],endValue:n[1]},!0)})})},function(t,e,i){function n(t){var e=t[r];return e||(e=t[r]=[{}]),e}var o=i(1),a=o.each,r="\0_ec_hist_store",s={push:function(t,e){var i=n(t);a(e,function(e,n){for(var o=i.length-1;o>=0;o--){var a=i[o];if(a[n])break}if(o<0){var r=t.queryComponents({mainType:"dataZoom",subType:"select",id:n})[0];if(r){var s=r.getPercentRange();i[0][n]={dataZoomId:n,start:s[0],end:s[1]}}}}),i.push(e)},pop:function(t){var e=n(t),i=e[e.length-1];e.length>1&&e.pop();var o={};return a(i,function(t,i){for(var n=e.length-1;n>=0;n--){var t=e[n][i];if(t){o[i]=t;break}}}),o},clear:function(t){t[r]=null},count:function(t){return n(t).length}};t.exports=s},function(t,e,i){i(13).registerSubTypeDefaulter("dataZoom",function(t){return"slider"})},function(t,e,i){function n(t){V.call(this),this._zr=t,this.group=new F.Group,this._brushType,this._brushOption,this._panels,this._track=[],this._dragging,this._covers=[],this._creatingCover,this._creatingPanel,this._enableGlobalPan,this._uid="brushController_"+nt++,this._handlers={},q(ot,function(t,e){this._handlers[e]=B.bind(t,this)},this)}function o(t,e){var i=t._zr;t._enableGlobalPan||H.take(i,Q,t._uid),q(t._handlers,function(t,e){i.on(e,t)}),t._brushType=e.brushType,t._brushOption=B.merge(B.clone(it),e,!0)}function a(t){var e=t._zr;H.release(e,Q,t._uid),q(t._handlers,function(t,i){e.off(i,t)}),t._brushType=t._brushOption=null}function r(t,e){var i=at[e.brushType].createCover(t,e);return u(i),i.__brushOption=e,t.group.add(i),i}function s(t,e){var i=c(e);return i.endCreating&&(i.endCreating(t,e),u(e)),e}function l(t,e){var i=e.__brushOption;c(e).updateCoverShape(t,e,i.range,i)}function u(t){t.traverse(function(t){t.z=$,t.z2=$})}function h(t,e){c(e).updateCommon(t,e),l(t,e)}function c(t){return at[t.__brushOption.brushType]}function d(t,e,i){var n=t._panels;if(!n)return!0;var o;return q(n,function(t){t.contain(e,i)&&(o=t)}),o}function f(t,e){var i=t._panels;if(!i)return!0;var n=e.__brushOption.panelId;return null==n||i[n]}function p(t){var e=t._covers,i=e.length;return q(e,function(e){t.group.remove(e)},t),e.length=0,!!i}function g(t,e){var i=j(t._covers,function(t){var e=t.__brushOption,i=B.clone(e.range);return{brushType:e.brushType,panelId:e.panelId,range:i}});t.trigger("brush",i,{isEnd:!!e.isEnd,removeOnClick:!!e.removeOnClick})}function m(t){var e=t._track;if(!e.length)return!1;var i=e[e.length-1],n=e[0],o=i[0]-n[0],a=i[1]-n[1],r=Y(o*o+a*a,.5);return r>K}function v(t){var e=t.length-1;return e<0&&(e=0),[t[0],t[e]]}function y(t,e,i,n){var o=new F.Group;return o.add(new F.Rect({name:"main",style:w(i),silent:!0,draggable:!0,cursor:"move",drift:Z(t,e,o,"nswe"),ondragend:Z(g,e,{isEnd:!0})})),q(n,function(i){o.add(new F.Rect({name:i,style:{opacity:0},draggable:!0,silent:!0,invisible:!0,drift:Z(t,e,o,i),ondragend:Z(g,e,{isEnd:!0})}))}),o}function x(t,e,i,n){var o=n.brushStyle.lineWidth||0,a=X(o,J),r=i[0][0],s=i[1][0],l=r-o/2,u=s-o/2,h=i[0][1],c=i[1][1],d=h-a+o/2,f=c-a+o/2,p=h-r,g=c-s,m=p+o,v=g+o;b(t,e,"main",r,s,p,g),n.transformable&&(b(t,e,"w",l,u,a,v),b(t,e,"e",d,u,a,v),b(t,e,"n",l,u,m,a),b(t,e,"s",l,f,m,a),b(t,e,"nw",l,u,a,a),b(t,e,"ne",d,u,a,a),b(t,e,"sw",l,f,a,a),b(t,e,"se",d,f,a,a))}function _(t,e){var i=e.__brushOption,n=i.transformable,o=e.childAt(0);o.useStyle(w(i)),o.attr({silent:!n,cursor:n?"move":"default"}),q(["w","e","n","s","se","sw","ne","nw"],function(i){var o=e.childOfName(i),a=I(t,i);o&&o.attr({silent:!n,invisible:!n,cursor:n?et[a]+"-resize":null})})}function b(t,e,i,n,o,a,r){var s=e.childOfName(i);s&&s.setShape(D(C(t,e,[[n,o],[n+a,o+r]])))}function w(t){return B.defaults({strokeNoScale:!0},t.brushStyle)}function S(t,e,i,n){var o=[U(t,i),U(e,n)],a=[X(t,i),X(e,n)];return[[o[0],a[0]],[o[1],a[1]]]}function M(t){return F.getTransform(t.group)}function I(t,e){if(e.length>1){e=e.split("");var i=[I(t,e[0]),I(t,e[1])];return("e"===i[0]||"w"===i[0])&&i.reverse(),i.join("")}var n={w:"left",e:"right",n:"top",s:"bottom"},o={left:"w",right:"e",top:"n",bottom:"s"},i=F.transformDirection(n[e],M(t));return o[i]}function T(t,e,i,n,o,a,r,s){var l=n.__brushOption,u=t(l.range),c=L(i,a,r);q(o.split(""),function(t){var e=tt[t];u[e[0]][e[1]]+=c[e[0]]}),l.range=e(S(u[0][0],u[1][0],u[0][1],u[1][1])),h(i,n),g(i,{isEnd:!1})}function A(t,e,i,n,o){var a=e.__brushOption.range,r=L(t,i,n);q(a,function(t){t[0]+=r[0],t[1]+=r[1]}),h(t,e),g(t,{isEnd:!1})}function L(t,e,i){var n=t.group,o=n.transformCoordToLocal(e,i),a=n.transformCoordToLocal(0,0);return[o[0]-a[0],o[1]-a[1]]}function C(t,e,i){var n=f(t,e);if(n===!0)return B.clone(i);var o=n.getBoundingRect();return B.map(i,function(t){var e=t[0];e=X(e,o.x),e=U(e,o.x+o.width);var i=t[1];return i=X(i,o.y),i=U(i,o.y+o.height),[e,i]})}function D(t){var e=U(t[0][0],t[1][0]),i=U(t[0][1],t[1][1]),n=X(t[0][0],t[1][0]),o=X(t[0][1],t[1][1]);return{x:e,y:i,width:n-e,height:o-i}}function P(t,e){var i=e.offsetX,n=e.offsetY,o=t._zr;if(t._brushType){for(var a,r=t._panels,s=t._covers,l=0;le[1]&&e.reverse(),e},getOtherAxis:function(){this.grid.getOtherAxis()},getLabelInterval:function(){var t=this._labelInterval;return t||(t=this._labelInterval=a(this)),t},isLabelIgnored:function(t){if("category"===this.type){var e=this.getLabelInterval();return"function"==typeof e&&!e(t,this.scale.getLabel(t))||t%(e+1)}},pointToData:function(t,e){return this.coordToData(this.toLocalCoord(t["x"===this.dim?0:1]),e)},toLocalCoord:null,toGlobalCoord:null},n.inherits(r,o),t.exports=r},function(t,e,i){"use strict";function n(t){return this._axes[t]}var o=i(1),a=function(t){this._axes={},this._dimList=[],this.name=t||""};a.prototype={constructor:a,type:"cartesian",getAxis:function(t){return this._axes[t]},getAxes:function(){return o.map(this._dimList,n,this)},getAxesByScale:function(t){return t=t.toLowerCase(),o.filter(this.getAxes(),function(e){return e.scale.type===t})},addAxis:function(t){var e=t.dim;this._axes[e]=t,this._dimList.push(e)},dataToCoord:function(t){return this._dataCoordConvert(t,"dataToCoord")},coordToData:function(t){return this._dataCoordConvert(t,"coordToData")},_dataCoordConvert:function(t,e){for(var i=this._dimList,n=t instanceof Array?[]:{},o=0;o=0;n--)c.isIdInner(e[n])&&e.splice(n,1);t[i]=e}}),delete t[b],t},getTheme:function(){return this._theme},getComponent:function(t,e){var i=this._componentsMap[t];if(i)return i[e||0]},queryComponents:function(t){var e=t.mainType;if(!e)return[];var i=t.index,n=t.id,o=t.name,a=this._componentsMap[e];if(!a||!a.length)return[];var r;if(null!=i)m(i)||(i=[i]),r=p(g(i,function(t){return a[t]}),function(t){return!!t});else if(null!=n){var s=m(n);r=p(a,function(t){return s&&v(n,t.id)>=0||!s&&t.id===n})}else if(null!=o){var u=m(o);r=p(a,function(t){return u&&v(o,t.name)>=0||!u&&t.name===o})}else r=a.slice();return l(r,t)},findComponents:function(t){function e(t){var e=o+"Index",i=o+"Id",n=o+"Name";return!t||null==t[e]&&null==t[i]&&null==t[n]?null:{mainType:o,index:t[e],id:t[i],name:t[n]}}function i(e){return t.filter?p(e,t.filter):e}var n=t.query,o=t.mainType,a=e(n),r=a?this.queryComponents(a):this._componentsMap[o];return i(l(r,t))},eachComponent:function(t,e,i){var n=this._componentsMap;if("function"==typeof t)i=e,e=t,f(n,function(t,n){f(t,function(t,o){e.call(i,n,t,o)})});else if(h.isString(t))f(n[t],e,i);else if(y(t)){var o=this.findComponents(t);f(o,e,i)}},getSeriesByName:function(t){var e=this._componentsMap.series;return p(e,function(e){return e.name===t})},getSeriesByIndex:function(t){return this._componentsMap.series[t]},getSeriesByType:function(t){var e=this._componentsMap.series;return p(e,function(e){return e.subType===t})},getSeries:function(){return this._componentsMap.series.slice()},eachSeries:function(t,e){u(this),f(this._seriesIndices,function(i){var n=this._componentsMap.series[i];t.call(e,n,i)},this)},eachRawSeries:function(t,e){f(this._componentsMap.series,t,e)},eachSeriesByType:function(t,e,i){u(this),f(this._seriesIndices,function(n){var o=this._componentsMap.series[n];o.subType===t&&e.call(i,o,n)},this)},eachRawSeriesByType:function(t,e,i){return f(this.getSeriesByType(t),e,i)},isSeriesFiltered:function(t){return u(this),h.indexOf(this._seriesIndices,t.componentIndex)<0},filterSeries:function(t,e){u(this);var i=p(this._componentsMap.series,t,e);this._seriesIndices=s(i)},restoreData:function(){var t=this._componentsMap;this._seriesIndices=s(t.series);var e=[];f(t,function(t,i){e.push(i)}),x.topologicalTravel(e,x.getAllClassMainTypes(),function(e,i){f(t[e],function(t){t.restoreData()})})}});h.mixin(w,i(62)),t.exports=w},function(t,e,i){function n(t){this._api=t,this._timelineOptions=[],this._mediaList=[],this._mediaDefault,this._currentMediaIndices=[],this._optionBackup,this._newBaseOption}function o(t,e,i){var n,o,a=[],r=[],s=t.timeline;if(t.baseOption&&(o=t.baseOption),(s||t.options)&&(o=o||{},a=(t.options||[]).slice()),t.media){o=o||{};var l=t.media;d(l,function(t){t&&t.option&&(t.query?r.push(t):n||(n=t))})}return o||(o=t),o.timeline||(o.timeline=s),d([o].concat(a).concat(u.map(r,function(t){return t.option})),function(t){d(e,function(e){e(t,i)})}),{baseOption:o,timelineOptions:a,mediaDefault:n,mediaList:r}}function a(t,e,i){var n={width:e,height:i,aspectratio:e/i},o=!0;return u.each(t,function(t,e){var i=e.match(m);if(i&&i[1]&&i[2]){var a=i[1],s=i[2].toLowerCase();r(n[s],t,a)||(o=!1)}}),o}function r(t,e,i){return"min"===i?t>=e:"max"===i?t<=e:t===e}function s(t,e){return t.join(",")===e.join(",")}function l(t,e){e=e||{},d(e,function(e,i){if(null!=e){var n=t[i];if(c.hasClass(i)){e=h.normalizeToArray(e),n=h.normalizeToArray(n);var o=h.mappingToExists(n,e);t[i]=p(o,function(t){return t.option&&t.exist?g(t.exist,t.option,!0):t.exist||t.option})}else t[i]=g(n,e,!0)}})}var u=i(1),h=i(5),c=i(13),d=u.each,f=u.clone,p=u.map,g=u.merge,m=/^(min|max)?(.+)$/;n.prototype={constructor:n,setOption:function(t,e){t=f(t,!0);var i=this._optionBackup,n=o.call(this,t,e,!i);this._newBaseOption=n.baseOption,i?(l(i.baseOption,n.baseOption),n.timelineOptions.length&&(i.timelineOptions=n.timelineOptions),n.mediaList.length&&(i.mediaList=n.mediaList),n.mediaDefault&&(i.mediaDefault=n.mediaDefault)):this._optionBackup=n},mountOption:function(t){var e=this._optionBackup;return this._timelineOptions=p(e.timelineOptions,f),this._mediaList=p(e.mediaList,f),this._mediaDefault=f(e.mediaDefault),this._currentMediaIndices=[],f(t?e.baseOption:this._newBaseOption)},getTimelineOption:function(t){var e,i=this._timelineOptions;if(i.length){var n=t.getComponent("timeline");n&&(e=f(i[n.getCurrentIndex()],!0))}return e},getMediaOption:function(t){var e=this._api.getWidth(),i=this._api.getHeight(),n=this._mediaList,o=this._mediaDefault,r=[],l=[];if(!n.length&&!o)return l;for(var u=0,h=n.length;ue&&(e=t[i]);return e},min:function(t){for(var e=1/0,i=0;i1){var c;"string"==typeof o?c=i[o]:"function"==typeof o&&(c=o),c&&(e=e.downSample(s.dim,1/h,c,n),t.setData(e))}}},this)}},function(t,e,i){function n(t,e){return c(t,h(e))}var o=i(1),a=i(34),r=i(4),s=i(43),l=a.prototype,u=s.prototype,h=r.getPrecisionSafe,c=r.round,d=Math.floor,f=Math.ceil,p=Math.pow,g=Math.log,m=a.extend({type:"log",base:10,$constructor:function(){a.apply(this,arguments),this._originalScale=new s},getTicks:function(){var t=this._originalScale,e=this._extent,i=t.getExtent();return o.map(u.getTicks.call(this),function(o){var a=r.round(p(this.base,o));return a=o===e[0]&&t.__fixMin?n(a,i[0]):a,a=o===e[1]&&t.__fixMax?n(a,i[1]):a},this)},getLabel:u.getLabel,scale:function(t){return t=l.scale.call(this,t),p(this.base,t)},setExtent:function(t,e){var i=this.base;t=g(t)/g(i),e=g(e)/g(i),u.setExtent.call(this,t,e)},getExtent:function(){var t=this.base,e=l.getExtent.call(this);e[0]=p(t,e[0]),e[1]=p(t,e[1]);var i=this._originalScale,o=i.getExtent();return i.__fixMin&&(e[0]=n(e[0],o[0])),i.__fixMax&&(e[1]=n(e[1],o[1])),e},unionExtent:function(t){this._originalScale.unionExtent(t);var e=this.base;t[0]=g(t[0])/g(e),t[1]=g(t[1])/g(e),l.unionExtent.call(this,t)},unionExtentFromData:function(t,e){this.unionExtent(t.getDataExtent(e,!0,function(t){return t>0}))},niceTicks:function(t){t=t||10;var e=this._extent,i=e[1]-e[0];if(!(i===1/0||i<=0)){var n=r.quantity(i),o=t/i*n;for(o<=.5&&(n*=10);!isNaN(n)&&Math.abs(n)<1&&Math.abs(n)>0;)n*=10;var a=[r.round(f(e[0]/n)*n),r.round(d(e[1]/n)*n)];this._interval=n,this._niceExtent=a}},niceExtent:function(t,e,i){u.niceExtent.call(this,t,e,i);var n=this._originalScale;n.__fixMin=e,n.__fixMax=i}});o.each(["contain","normalize"],function(t){m.prototype[t]=function(e){return e=g(e)/g(this.base),l[t].call(this,e)}}),m.create=function(){return new m},t.exports=m},function(t,e,i){var n=i(1),o=i(34),a=o.prototype,r=o.extend({type:"ordinal",init:function(t,e){this._data=t,this._extent=e||[0,t.length-1]},parse:function(t){return"string"==typeof t?n.indexOf(this._data,t):Math.round(t)},contain:function(t){return t=this.parse(t),a.contain.call(this,t)&&null!=this._data[t]},normalize:function(t){return a.normalize.call(this,this.parse(t))},scale:function(t){return Math.round(a.scale.call(this,t))},getTicks:function(){for(var t=[],e=this._extent,i=e[0];i<=e[1];)t.push(i),i++;return t},getLabel:function(t){return this._data[t]},count:function(){return this._extent[1]-this._extent[0]+1},unionExtentFromData:function(t,e){this.unionExtent(t.getDataExtent(e,!1))},niceTicks:n.noop,niceExtent:n.noop});r.create=function(){return new r},t.exports=r},function(t,e,i){var n=i(1),o=i(4),a=i(7),r=i(43),s=r.prototype,l=Math.ceil,u=Math.floor,h=1e3,c=60*h,d=60*c,f=24*d,p=function(t,e,i,n){for(;i>>1;t[o][2]=0;o--)if(!n[o].silent&&n[o]!==i&&!n[o].ignore&&a(n[o],t,e))return n[o]}},r.each(["click","mousedown","mouseup","mousewheel","dblclick","contextmenu"],function(t){h.prototype[t]=function(e){var i=this.findHover(e.zrX,e.zrY,null);if("mousedown"===t)this._downel=i,this._upel=i;else if("mosueup"===t)this._upel=i;else if("click"===t&&this._downel!==this._upel)return;this.dispatchToElement(i,t,e)}}),r.mixin(h,l),r.mixin(h,s),t.exports=h},function(t,e,i){function n(){return!1}function o(t,e,i,n){var o=document.createElement(e),a=i.getWidth(),r=i.getHeight(),s=o.style;return s.position="absolute",s.left=0,s.top=0,s.width=a+"px",s.height=r+"px",o.width=a*n,o.height=r*n,o.setAttribute("data-zr-dom-id",t),o}var a=i(1),r=i(35),s=i(72),l=i(71),u=function(t,e,i){var s;i=i||r.devicePixelRatio,"string"==typeof t?s=o(t,"canvas",e,i):a.isObject(t)&&(s=t,t=s.id),this.id=t,this.dom=s;var l=s.style;l&&(s.onselectstart=n,l["-webkit-user-select"]="none",l["user-select"]="none",l["-webkit-touch-callout"]="none",l["-webkit-tap-highlight-color"]="rgba(0,0,0,0)",l.padding=0,l.margin=0,l["border-width"]=0),this.domBack=null,this.ctxBack=null,this.painter=e,this.config=null,this.clearColor=0,this.motionBlur=!1,this.lastFrameAlpha=.7,this.dpr=i};u.prototype={constructor:u,elCount:0,__dirty:!0,initContext:function(){this.ctx=this.dom.getContext("2d"),this.ctx.dpr=this.dpr},createBackBuffer:function(){var t=this.dpr;this.domBack=o("back-"+this.id,"canvas",this.painter,t),this.ctxBack=this.domBack.getContext("2d"),1!=t&&this.ctxBack.scale(t,t)},resize:function(t,e){var i=this.dpr,n=this.dom,o=n.style,a=this.domBack;o.width=t+"px",o.height=e+"px",n.width=t*i,n.height=e*i,a&&(a.width=t*i,a.height=e*i,1!=i&&this.ctxBack.scale(i,i))},clear:function(t){var e=this.dom,i=this.ctx,n=e.width,o=e.height,a=this.clearColor,r=this.motionBlur&&!t,u=this.lastFrameAlpha,h=this.dpr;if(r&&(this.domBack||this.createBackBuffer(),this.ctxBack.globalCompositeOperation="copy",this.ctxBack.drawImage(e,0,0,n/h,o/h)),i.clearRect(0,0,n,o),a){var c;a.colorStops?(c=a.__canvasGradient||s.getGradient(i,a,{x:0,y:0,width:n,height:o}),a.__canvasGradient=c):a.image&&(c=l.prototype.getCanvasPattern.call(a,i)),i.save(),i.fillStyle=c||a,i.fillRect(0,0,n,o),i.restore()}if(r){var d=this.domBack;i.save(),i.globalAlpha=u,i.drawImage(d,0,0,n,o),i.restore()}}},t.exports=u},function(t,e,i){"use strict";function n(t){return parseInt(t,10)}function o(t){return!!t&&(!!t.__builtin__||"function"==typeof t.resize&&"function"==typeof t.refresh)}function a(t){t.__unusedCount++}function r(t){1==t.__unusedCount&&t.clear()}function s(t,e,i){return x.copy(t.getBoundingRect()),t.transform&&x.applyTransform(t.transform),_.width=e,_.height=i,!x.intersect(_)}function l(t,e){if(t==e)return!1;if(!t||!e||t.length!==e.length)return!0;for(var i=0;i=0&&i.splice(n,1),t.__hoverMir=null},clearHover:function(t){for(var e=this._hoverElements,i=0;i=0){if(!s){if(s=this._progressiveLayers[Math.min(u++,y-1)],s.ctx.save(),s.renderScope={},s&&s.__progress>s.__maxProgress){g=s.__nextIdxNotProg-1;continue}l=s.__progress,s.__dirty||(p=l),s.__progress=p+1}_===p&&this._doPaintEl(v,s,!0,s.renderScope)}else this._doPaintEl(v,n,e,r);v.__dirty=!1}}s&&i(s),a&&a.restore(),this._furtherProgressive=!1,d.each(this._progressiveLayers,function(t){t.__maxProgress>=t.__progress&&(this._furtherProgressive=!0)},this)},_doPaintEl:function(t,e,i,n){var o=e.ctx,a=t.transform;if((e.__dirty||i)&&!t.invisible&&0!==t.style.opacity&&(!a||a[0]||a[3])&&(!t.culling||!s(t,this._width,this._height))){var r=t.__clipPaths;(n.prevClipLayer!==e||l(r,n.prevElClipPaths))&&(n.prevElClipPaths&&(n.prevClipLayer.ctx.restore(),n.prevClipLayer=n.prevElClipPaths=null,n.prevEl=null),r&&(o.save(),u(r,o),n.prevClipLayer=e,n.prevElClipPaths=r)),t.beforeBrush&&t.beforeBrush(o),t.brush(o,n.prevEl||null),n.prevEl=t,t.afterBrush&&t.afterBrush(o)}},getLayer:function(t){if(this._singleCanvas)return this._layers[0];var e=this._layers[t];return e||(e=new m("zr_"+t,this,this.dpr),e.__builtin__=!0,this._layerConfig[t]&&d.merge(e,this._layerConfig[t],!0),this.insertLayer(t,e),e.initContext()),e},insertLayer:function(t,e){var i=this._layers,n=this._zlevelList,a=n.length,r=null,s=-1,l=this._domRoot;if(i[t])return void f("ZLevel "+t+" has been used already");if(!o(e))return void f("Layer of zlevel "+t+" is not valid");if(a>0&&t>n[0]){for(s=0;st);s++);r=i[n[s]]}if(n.splice(s+1,0,t),i[t]=e,!e.virtual)if(r){var u=r.dom;u.nextSibling?l.insertBefore(e.dom,u.nextSibling):l.appendChild(e.dom)}else l.firstChild?l.insertBefore(e.dom,l.firstChild):l.appendChild(e.dom)},eachLayer:function(t,e){var i,n,o=this._zlevelList;for(n=0;n=0){r!==g&&(r=g,l++);var v=c.__frame=l-1;if(!a){var x=Math.min(s,y-1);a=i[x],a||(a=i[x]=new m("progressive",this,this.dpr),a.initContext()),a.__maxProgress=0}a.__dirty=a.__dirty||c.__dirty,a.elCount++,a.__maxProgress=Math.max(a.__maxProgress,v),a.__maxProgress>=a.__progress&&(p.__dirty=!0)}else c.__frame=-1,a&&(a.__nextIdxNotProg=u,s++,a=null)}a&&(s++,a.__nextIdxNotProg=u),this.eachBuiltinLayer(function(t,e){n[e]!==t.elCount&&(t.__dirty=!0)}),i.length=Math.min(s,y),d.each(i,function(t,e){o[e]!==t.elCount&&(c.__dirty=!0),t.__dirty&&(t.__progress=0)})},clear:function(){return this.eachBuiltinLayer(this._clearLayer),this},_clearLayer:function(t){t.clear()},configLayer:function(t,e){if(e){var i=this._layerConfig;i[t]?d.merge(i[t],e,!0):i[t]=e;var n=this._layers[t];n&&d.merge(n,i[t],!0)}},delLayer:function(t){var e=this._layers,i=this._zlevelList,n=e[t];n&&(n.dom.parentNode.removeChild(n.dom),delete e[t],i.splice(d.indexOf(i,t),1))},resize:function(t,e){var i=this._domRoot;i.style.display="none";var n=this._opts;if(null!=t&&(n.width=t),null!=e&&(n.height=e),t=this._getSize(0),e=this._getSize(1),i.style.display="",this._width!=t||e!=this._height){i.style.width=t+"px",i.style.height=e+"px";for(var o in this._layers)this._layers.hasOwnProperty(o)&&this._layers[o].resize(t,e);d.each(this._progressiveLayers,function(i){i.resize(t,e)}),this.refresh(!0)}return this._width=t,this._height=e,this},clearLayer:function(t){var e=this._layers[t];e&&e.clear()},dispose:function(){ +this.root.innerHTML="",this.root=this.storage=this._domRoot=this._layers=null},getRenderedCanvas:function(t){if(t=t||{},this._singleCanvas)return this._layers[0].dom;var e=new m("image",this,t.pixelRatio||this.dpr);e.initContext(),e.clearColor=t.backgroundColor,e.clear();for(var i=this.storage.getDisplayList(!0),n={},o=0;o=0&&(this.delFromMap(a.id),this._roots.splice(s,1),a instanceof r&&a.delChildrenFromStorage(this))}},addToMap:function(t){return t instanceof r&&(t.__storage=this),t.dirty(!1),this._elements[t.id]=t,this},get:function(t){return this._elements[t]},delFromMap:function(t){var e=this._elements,i=e[t];return i&&(delete e[t],i instanceof r&&(i.__storage=null)),this},dispose:function(){this._elements=this._renderList=this._roots=null},displayableSortFunc:n},t.exports=l},function(t,e,i){"use strict";var n=i(1),o=i(20).Dispatcher,a=i(67),r=i(66),s=function(t){t=t||{},this.stage=t.stage||{},this.onframe=t.onframe||function(){},this._clips=[],this._running=!1,this._time,this._pausedTime,this._pauseStart,this._paused=!1,o.call(this)};s.prototype={constructor:s,addClip:function(t){this._clips.push(t)},addAnimator:function(t){t.animation=this;for(var e=t.getClips(),i=0;i=0&&this._clips.splice(e,1)},removeAnimator:function(t){for(var e=t.getClips(),i=0;ii||d+cr&&(r+=o);var p=Math.atan2(h,u);return p<0&&(p+=o),p>=a&&p<=r||p+o>=a&&p+o<=r}}},function(t,e,i){var n=i(21);t.exports={containStroke:function(t,e,i,o,a,r,s,l,u,h,c){if(0===u)return!1;var d=u;if(c>e+d&&c>o+d&&c>r+d&&c>l+d||ct+d&&h>i+d&&h>a+d&&h>s+d||he&&h>n&&h>r&&h>l||h1&&o(),d=g.cubicAt(e,n,r,l,b[0]),m>1&&(f=g.cubicAt(e,n,r,l,b[1]))),p+=2==m?ye&&s>n&&s>a||s=0&&u<=1){for(var h=0,c=g.quadraticAt(e,n,a,u),d=0;di||s<-i)return 0;var l=Math.sqrt(i*i-s*s);_[0]=-l,_[1]=l;var u=Math.abs(n-o);if(u<1e-4)return 0;if(u%y<1e-4){n=0,o=y;var h=a?1:-1;return r>=_[0]+t&&r<=_[1]+t?h:0}if(a){var l=n;n=p(o),o=p(l)}else n=p(n),o=p(o);n>o&&(o+=y);for(var c=0,d=0;d<2;d++){var f=_[d];if(f+t>r){var g=Math.atan2(s,f),h=a?1:-1;g<0&&(g=y+g),(g>=n&&g<=o||g+y>=n&&g+y<=o)&&(g>Math.PI/2&&g<1.5*Math.PI&&(h=-h),c+=h)}}return c}function l(t,e,i,o,l){for(var h=0,p=0,g=0,y=0,x=0,_=0;_1&&(i||(h+=m(p,g,y,x,o,l))),1==_&&(p=t[_],g=t[_+1],y=p,x=g),b){case u.M:y=t[_++],x=t[_++],p=y,g=x;break;case u.L:if(i){if(v(p,g,t[_],t[_+1],e,o,l))return!0}else h+=m(p,g,t[_],t[_+1],o,l)||0;p=t[_++],g=t[_++];break;case u.C:if(i){if(c.containStroke(p,g,t[_++],t[_++],t[_++],t[_++],t[_],t[_+1],e,o,l))return!0}else h+=a(p,g,t[_++],t[_++],t[_++],t[_++],t[_],t[_+1],o,l)||0;p=t[_++],g=t[_++];break;case u.Q:if(i){if(d.containStroke(p,g,t[_++],t[_++],t[_],t[_+1],e,o,l))return!0}else h+=r(p,g,t[_++],t[_++],t[_],t[_+1],o,l)||0;p=t[_++],g=t[_++];break;case u.A:var w=t[_++],S=t[_++],M=t[_++],I=t[_++],T=t[_++],A=t[_++],L=(t[_++],1-t[_++]),C=Math.cos(T)*M+w,D=Math.sin(T)*I+S;_>1?h+=m(p,g,C,D,o,l):(y=C,x=D);var P=(o-w)*I/M+w;if(i){if(f.containStroke(w,S,I,T,T+A,L,e,P,l))return!0}else h+=s(w,S,I,T,T+A,L,P,l);p=Math.cos(T+A)*M+w,g=Math.sin(T+A)*I+S;break;case u.R:y=p=t[_++],x=g=t[_++];var k=t[_++],O=t[_++],C=y+k,D=x+O;if(i){if(v(y,x,C,x,e,o,l)||v(C,x,C,D,e,o,l)||v(C,D,y,D,e,o,l)||v(y,D,y,x,e,o,l))return!0}else h+=m(C,x,C,D,o,l),h+=m(y,D,y,x,o,l);break;case u.Z:if(i){if(v(p,g,y,x,e,o,l))return!0}else h+=m(p,g,y,x,o,l);p=y,g=x}}return i||n(g,x)||(h+=m(p,g,y,x,o,l)||0),0!==h}var u=i(30).CMD,h=i(98),c=i(162),d=i(99),f=i(161),p=i(68).normalizeRadian,g=i(21),m=i(100),v=h.containStroke,y=2*Math.PI,x=1e-4,_=[-1,-1,-1],b=[-1,-1];t.exports={contain:function(t,e,i){return l(t,0,!1,e,i)},containStroke:function(t,e,i,n){return l(t,e,!0,i,n)}}},function(t,e,i){"use strict";function n(t){var e=t[1][0]-t[0][0],i=t[1][1]-t[0][1];return Math.sqrt(e*e+i*i)}function o(t){return[(t[0][0]+t[1][0])/2,(t[0][1]+t[1][1])/2]}var a=i(20),r=function(){this._track=[]};r.prototype={constructor:r,recognize:function(t,e,i){return this._doTrack(t,e,i),this._recognize(t)},clear:function(){return this._track.length=0,this},_doTrack:function(t,e,i){var n=t.touches;if(n){for(var o={points:[],touches:[],target:e,event:t},r=0,s=n.length;r1&&a&&a.length>1){var s=n(a)/n(r);!isFinite(s)&&(s=1),e.pinchScale=s;var l=o(a);return e.pinchX=l[0],e.pinchY=l[1],{type:"pinch",target:t[0].target,event:e}}}}};t.exports=r},function(t,e,i){function n(t){return"mousewheel"===t&&d.browser.firefox?"DOMMouseScroll":t}function o(t,e,i){var n=t._gestureMgr;"start"===i&&n.clear();var o=n.recognize(e,t.handler.findHover(e.zrX,e.zrY,null),t.dom);if("end"===i&&n.clear(),o){var a=o.type;e.gestureEvent=a,t.handler.dispatchToElement(o.target,a,o.event)}}function a(t){t._touching=!0,clearTimeout(t._touchTimer),t._touchTimer=setTimeout(function(){t._touching=!1},700)}function r(t){var e=t.pointerType;return"pen"===e||"touch"===e}function s(t){function e(t,e){return function(){if(!e._touching)return t.apply(e,arguments)}}h.each(x,function(e){t._handlers[e]=h.bind(w[e],t)}),h.each(b,function(e){t._handlers[e]=h.bind(w[e],t)}),h.each(y,function(i){t._handlers[i]=e(w[i],t)})}function l(t){function e(e,i){h.each(e,function(e){p(t,n(e),i._handlers[e])},i)}c.call(this),this.dom=t,this._touching=!1,this._touchTimer,this._gestureMgr=new f,this._handlers={},s(this),d.pointerEventsSupported?e(b,this):(d.touchEventsSupported&&e(x,this),e(y,this))}var u=i(20),h=i(1),c=i(23),d=i(9),f=i(164),p=u.addEventListener,g=u.removeEventListener,m=u.normalizeEvent,v=300,y=["click","dblclick","mousewheel","mouseout","mouseup","mousedown","mousemove","contextmenu"],x=["touchstart","touchend","touchmove"],_={pointerdown:1,pointerup:1,pointermove:1,pointerout:1},b=h.map(y,function(t){var e=t.replace("mouse","pointer");return _[e]?e:t}),w={mousemove:function(t){t=m(this.dom,t),this.trigger("mousemove",t)},mouseout:function(t){t=m(this.dom,t);var e=t.toElement||t.relatedTarget;if(e!=this.dom)for(;e&&9!=e.nodeType;){if(e===this.dom)return;e=e.parentNode}this.trigger("mouseout",t)},touchstart:function(t){t=m(this.dom,t),t.zrByTouch=!0,this._lastTouchMoment=new Date,o(this,t,"start"),w.mousemove.call(this,t),w.mousedown.call(this,t),a(this)},touchmove:function(t){t=m(this.dom,t),t.zrByTouch=!0,o(this,t,"change"),w.mousemove.call(this,t),a(this)},touchend:function(t){t=m(this.dom,t),t.zrByTouch=!0,o(this,t,"end"),w.mouseup.call(this,t),+new Date-this._lastTouchMomentl&&(c=i+n,i*=l/c,n*=l/c),o+a>l&&(c=o+a,o*=l/c,a*=l/c),n+o>u&&(c=n+o,n*=u/c,o*=u/c),i+a>u&&(c=i+a,i*=u/c,a*=u/c),t.moveTo(r+i,s),t.lineTo(r+l-n,s),0!==n&&t.quadraticCurveTo(r+l,s,r+l,s+n),t.lineTo(r+l,s+u-o),0!==o&&t.quadraticCurveTo(r+l,s+u,r+l-o,s+u),t.lineTo(r+a,s+u),0!==a&&t.quadraticCurveTo(r,s+u,r,s+u-a),t.lineTo(r,s+i),0!==i&&t.quadraticCurveTo(r,s,r+i,s)}}},function(t,e,i){var n=i(6),o=n.min,a=n.max,r=n.scale,s=n.distance,l=n.add;t.exports=function(t,e,i,u){var h,c,d,f,p=[],g=[],m=[],v=[];if(u){d=[1/0,1/0],f=[-(1/0),-(1/0)];for(var y=0,x=t.length;yi-2?i-1:f+1],c=t[f>i-3?i-1:f+2]);var m=p*p,v=p*m;a.push([n(u[0],g[0],h[0],c[0],p,m,v),n(u[1],g[1],h[1],c[1],p,m,v)])}return a}},function(t,e,i){t.exports=i(8).extend({type:"arc",shape:{cx:0,cy:0,r:0,startAngle:0,endAngle:2*Math.PI,clockwise:!0},style:{stroke:"#000",fill:null},buildPath:function(t,e){var i=e.cx,n=e.cy,o=Math.max(e.r,0),a=e.startAngle,r=e.endAngle,s=e.clockwise,l=Math.cos(a),u=Math.sin(a);t.moveTo(l*o+i,u*o+n),t.arc(i,n,o,a,r,!s)}})},function(t,e,i){"use strict";function n(t,e,i){var n=t.cpx2,o=t.cpy2;return null===n||null===o?[(i?c:u)(t.x1,t.cpx1,t.cpx2,t.x2,e),(i?c:u)(t.y1,t.cpy1,t.cpy2,t.y2,e)]:[(i?h:l)(t.x1,t.cpx1,t.x2,e),(i?h:l)(t.y1,t.cpy1,t.y2,e)]}var o=i(21),a=i(6),r=o.quadraticSubdivide,s=o.cubicSubdivide,l=o.quadraticAt,u=o.cubicAt,h=o.quadraticDerivativeAt,c=o.cubicDerivativeAt,d=[];t.exports=i(8).extend({type:"bezier-curve",shape:{x1:0,y1:0,x2:0,y2:0,cpx1:0,cpy1:0,percent:1},style:{stroke:"#000",fill:null},buildPath:function(t,e){var i=e.x1,n=e.y1,o=e.x2,a=e.y2,l=e.cpx1,u=e.cpy1,h=e.cpx2,c=e.cpy2,f=e.percent;0!==f&&(t.moveTo(i,n),null==h||null==c?(f<1&&(r(i,l,o,f,d),l=d[1],o=d[2],r(n,u,a,f,d),u=d[1],a=d[2]),t.quadraticCurveTo(l,u,o,a)):(f<1&&(s(i,l,h,o,f,d),l=d[1],h=d[2],o=d[3],s(n,u,c,a,f,d),u=d[1],c=d[2],a=d[3]),t.bezierCurveTo(l,u,h,c,o,a)))},pointAt:function(t){return n(this.shape,t,!1)},tangentAt:function(t){var e=n(this.shape,t,!0);return a.normalize(e,e)}})},function(t,e,i){"use strict";t.exports=i(8).extend({type:"circle",shape:{cx:0,cy:0,r:0},buildPath:function(t,e,i){i&&t.moveTo(e.cx+e.r,e.cy),t.arc(e.cx,e.cy,e.r,0,2*Math.PI,!0)}})},function(t,e,i){t.exports=i(8).extend({type:"line",shape:{x1:0,y1:0,x2:0,y2:0,percent:1},style:{stroke:"#000",fill:null},buildPath:function(t,e){var i=e.x1,n=e.y1,o=e.x2,a=e.y2,r=e.percent;0!==r&&(t.moveTo(i,n),r<1&&(o=i*(1-r)+o*r,a=n*(1-r)+a*r),t.lineTo(o,a))},pointAt:function(t){var e=this.shape;return[e.x1*(1-t)+e.x2*t,e.y1*(1-t)+e.y2*t]}})},function(t,e,i){var n=i(73);t.exports=i(8).extend({type:"polygon",shape:{points:null,smooth:!1,smoothConstraint:null},buildPath:function(t,e){n.buildPath(t,e,!0)}})},function(t,e,i){var n=i(73);t.exports=i(8).extend({type:"polyline",shape:{points:null,smooth:!1,smoothConstraint:null},style:{stroke:"#000",fill:null},buildPath:function(t,e){n.buildPath(t,e,!1)}})},function(t,e,i){var n=i(168);t.exports=i(8).extend({type:"rect",shape:{r:0,x:0,y:0,width:0,height:0},buildPath:function(t,e){var i=e.x,o=e.y,a=e.width,r=e.height;e.r?n.buildPath(t,e):t.rect(i,o,a,r),t.closePath()}})},function(t,e,i){t.exports=i(8).extend({type:"ring",shape:{cx:0,cy:0,r:0,r0:0},buildPath:function(t,e){var i=e.cx,n=e.cy,o=2*Math.PI;t.moveTo(i+e.r,n),t.arc(i,n,e.r,0,o,!1),t.moveTo(i+e.r0,n),t.arc(i,n,e.r0,0,o,!0)}})},function(t,e,i){var n=i(9),o=i(8),a=[["shadowBlur",0],["shadowColor","#000"],["shadowOffsetX",0],["shadowOffsetY",0]];t.exports=o.extend({type:"sector",shape:{cx:0,cy:0,r0:0,r:0,startAngle:0,endAngle:2*Math.PI,clockwise:!0},brush:n.browser.ie&&n.browser.version>=11?function(){var t,e=this.__clipPaths,i=this.style;if(e)for(var n=0;n0&&this.animate(t,!1).when(null==n?500:n,r).delay(a||0),this}},t.exports=u},function(t,e){function i(){this.on("mousedown",this._dragStart,this),this.on("mousemove",this._drag,this),this.on("mouseup",this._dragEnd,this),this.on("globalout",this._dragEnd,this)}i.prototype={constructor:i,_dragStart:function(t){var e=t.target;e&&e.draggable&&(this._draggingTarget=e,e.dragging=!0,this._x=t.offsetX,this._y=t.offsetY,this.dispatchToElement(e,"dragstart",t.event))},_drag:function(t){var e=this._draggingTarget;if(e){var i=t.offsetX,n=t.offsetY,o=i-this._x,a=n-this._y;this._x=i,this._y=n,e.drift(o,a,t),this.dispatchToElement(e,"drag",t.event);var r=this.findHover(i,n,e),s=this._dropTarget;this._dropTarget=r,e!==r&&(s&&r!==s&&this.dispatchToElement(s,"dragleave",t.event),r&&r!==s&&this.dispatchToElement(r,"dragenter",t.event))}},_dragEnd:function(t){var e=this._draggingTarget;e&&(e.dragging=!1),this.dispatchToElement(e,"dragend",t.event),this._dropTarget&&this.dispatchToElement(this._dropTarget,"drop",t.event),this._draggingTarget=null,this._dropTarget=null}},t.exports=i},function(t,e,i){function n(t,e,i,n,o,a,r,s,l,u,h){var g=l*(p/180),y=f(g)*(t-i)/2+d(g)*(e-n)/2,x=-1*d(g)*(t-i)/2+f(g)*(e-n)/2,_=y*y/(r*r)+x*x/(s*s);_>1&&(r*=c(_),s*=c(_));var b=(o===a?-1:1)*c((r*r*(s*s)-r*r*(x*x)-s*s*(y*y))/(r*r*(x*x)+s*s*(y*y)))||0,w=b*r*x/s,S=b*-s*y/r,M=(t+i)/2+f(g)*w-d(g)*S,I=(e+n)/2+d(g)*w+f(g)*S,T=v([1,0],[(y-w)/r,(x-S)/s]),A=[(y-w)/r,(x-S)/s],L=[(-1*y-w)/r,(-1*x-S)/s],C=v(A,L);m(A,L)<=-1&&(C=p),m(A,L)>=1&&(C=0),0===a&&C>0&&(C-=2*p),1===a&&C<0&&(C+=2*p),h.addData(u,M,I,r,s,T,C,g,a)}function o(t){if(!t)return[];var e,i=t.replace(/-/g," -").replace(/ /g," ").replace(/ /g,",").replace(/,,/g,",");for(e=0;e0&&""===m[0]&&m.shift();for(var v=0;v')}}catch(l){n=function(t){return r.createElement("<"+t+' xmlns="'+o+'" class="zrvml">')}}var u=function(){if(!s){s=!0;var t=r.styleSheets;t.length<31?r.createStyleSheet().addRule(".zrvml","behavior:url(#default#VML)"):t[0].addRule(".zrvml","behavior:url(#default#VML)")}};t.exports={doc:r,initVML:u,createNode:n}}},function(t,e,i){"use strict";function n(t){return null==t.value?t:t.value}var o=i(14),a=i(25),r=i(309),s=i(1),l={_baseAxisDim:null,getInitialData:function(t,e){var i,r,s=e.getComponent("xAxis",this.get("xAxisIndex")),l=e.getComponent("yAxis",this.get("yAxisIndex")),u=s.get("type"),h=l.get("type");"category"===u?(t.layout="horizontal",i=s.getCategories(),r=!0):"category"===h?(t.layout="vertical",i=l.getCategories(),r=!0):t.layout=t.layout||"horizontal",this._baseAxisDim="horizontal"===t.layout?"x":"y";var c=t.data,d=this.dimensions=["base"].concat(this.valueDimensions);a(d,c);var f=new o(d,this);return f.initData(c,i?i.slice():null,function(t,e,i,o){var a=n(t);return r?"base"===e?i:a[o-1]:a[o]}),f},coordDimToDataDim:function(t){var e=this.valueDimensions.slice(),i=["base"],n={horizontal:{x:i,y:e},vertical:{x:e,y:i}};return n[this.get("layout")][t]},dataDimToCoordDim:function(t){var e;return s.each(["x","y"],function(i,n){var o=this.coordDimToDataDim(i);s.indexOf(o,t)>=0&&(e=i)},this),e},getBaseAxis:function(){var t=this._baseAxisDim;return this.ecModel.getComponent(t+"Axis",this.get(t+"AxisIndex")).axis}},u={init:function(){var t=this._whiskerBoxDraw=new r(this.getStyleUpdater());this.group.add(t.group)},render:function(t,e,i){this._whiskerBoxDraw.updateData(t.getData())},remove:function(t){this._whiskerBoxDraw.remove()}};t.exports={seriesModelMixin:l,viewMixin:u}},function(t,e,i){function n(t,e,i){var n=this._targetInfoList=[],o={},r=a(e,t);f(x,function(t,e){(!i||!i.include||p(i.include,e)>=0)&&t(r,n,o)})}function o(t){return t[0]>t[1]&&t.reverse(),t}function a(t,e){return d.parseFinder(t,e,{includeMainTypes:v})}function r(t,e,i,n){var a=i.getAxis(["x","y"][t]),r=o(h.map([0,1],function(t){return e?a.coordToData(a.toLocalCoord(n[t])):a.toGlobalCoord(a.dataToCoord(n[t]))})),s=[];return s[t]=r,s[1-t]=[NaN,NaN],{values:r,xyMinMax:s}}function s(t,e,i,n){return[e[0]-n[t]*i[0],e[1]-n[t]*i[1]]}function l(t,e){var i=u(t),n=u(e),o=[i[0]/n[0],i[1]/n[1]];return isNaN(o[0])&&(o[0]=1),isNaN(o[1])&&(o[1]=1),o}function u(t){return t?[t[0][1]-t[0][0],t[1][1]-t[1][0]]:[NaN,NaN]}var h=i(1),c=i(3),d=i(5),f=h.each,p=h.indexOf,g=h.curry,m=["dataToPoint","pointToData"],v=["grid","xAxis","yAxis","geo","graph","polar","radiusAxis","angleAxis","bmap"],y=n.prototype;y.setOutputRanges=function(t,e){this.matchOutputRanges(t,e,function(t,e,i){if((t.coordRanges||(t.coordRanges=[])).push(e),!t.coordRange){t.coordRange=e;var n=w[t.brushType](0,i,e);t.__rangeOffset={offset:S[t.brushType](n.values,t.range,[1,1]),xyMinMax:n.xyMinMax}}})},y.matchOutputRanges=function(t,e,i){f(t,function(t){var n=this.findTargetInfo(t,e);n&&n!==!0&&h.each(n.coordSyses,function(n){var o=w[t.brushType](1,n,t.range);i(t,o.values,n,e)})},this)},y.setInputRanges=function(t,e){ +f(t,function(t){var i=this.findTargetInfo(t,e);if(t.range=t.range||[],i&&i!==!0){t.panelId=i.panelId;var n=w[t.brushType](0,i.coordSys,t.coordRange),o=t.__rangeOffset;t.range=o?S[t.brushType](n.values,o.offset,l(n.xyMinMax,o.xyMinMax)):n.values}},this)},y.makePanelOpts=function(t){return h.map(this._targetInfoList,function(e){return{panelId:e.panelId,rect:e.getPanelRect(),defaultBrushType:t&&t(e)}})},y.controlSeries=function(t,e,i){var n=this.findTargetInfo(t,i);return n===!0||n&&p(n.coordSyses,e.coordinateSystem)>=0},y.findTargetInfo=function(t,e){for(var i=this._targetInfoList,n=a(e,t),o=0;o=0||p(n,t.getAxis("y").model)>=0)&&a.push(t)}),e.push({panelId:"grid--"+t.id,gridModel:t,coordSys:a[0],coordSyses:a,getPanelRect:b.grid,xAxisDeclared:r[t.id],yAxisDeclared:s[t.id]})}))},geo:function(t,e){f(t.geoModels,function(t){var i=t.coordinateSystem;e.push({panelId:"geo--"+t.id,geoModel:t,coordSys:i,coordSyses:[i],getPanelRect:b.geo})})}},_=[function(t,e){var i=t.xAxisModel,n=t.yAxisModel,o=t.gridModel;return!o&&i&&(o=i.axis.grid.model),!o&&n&&(o=n.axis.grid.model),o&&o===e.gridModel},function(t,e){var i=t.geoModel;return i&&i===e.geoModel}],b={grid:function(){return this.coordSys.grid.getRect().clone()},geo:function(){var t=this.coordSys,e=t.getBoundingRect().clone();return e.applyTransform(c.getTransform(t)),e}},w={lineX:g(r,0),lineY:g(r,1),rect:function(t,e,i){var n=e[m[t]]([i[0][0],i[1][0]]),a=e[m[t]]([i[0][1],i[1][1]]),r=[o([n[0],a[0]]),o([n[1],a[1]])];return{values:r,xyMinMax:r}},polygon:function(t,e,i){var n=[[1/0,-(1/0)],[1/0,-(1/0)]],o=h.map(i,function(i){var o=e[m[t]](i);return n[0][0]=Math.min(n[0][0],o[0]),n[1][0]=Math.min(n[1][0],o[1]),n[0][1]=Math.max(n[0][1],o[0]),n[1][1]=Math.max(n[1][1],o[1]),o});return{values:o,xyMinMax:n}}},S={lineX:g(s,0),lineY:g(s,1),rect:function(t,e,i){return[[t[0][0]-i[0]*e[0][0],t[0][1]-i[0]*e[0][1]],[t[1][0]-i[1]*e[1][0],t[1][1]-i[1]*e[1][1]]]},polygon:function(t,e,i){return h.map(t,function(t,n){return[t[0]-i[0]*e[n][0],t[1]-i[1]*e[n][1]]})}};t.exports=n},function(t,e,i){function n(t,e){var i=t.get("boundingCoords");if(null!=i){var n=i[0],o=i[1];isNaN(n[0])||isNaN(n[1])||isNaN(o[0])||isNaN(o[1])||this.setBoundingRect(n[0],n[1],o[0]-n[0],o[1]-n[1])}var a,s=this.getBoundingRect(),u=t.get("layoutCenter"),h=t.get("layoutSize"),c=e.getWidth(),d=e.getHeight(),f=t.get("aspectScale")||.75,p=s.width/s.height*f,g=!1;u&&h&&(u=[l.parsePercent(u[0],c),l.parsePercent(u[1],d)],h=l.parsePercent(h,Math.min(c,d)),isNaN(u[0])||isNaN(u[1])||isNaN(h)||(g=!0));var m;if(g){var m={};p>1?(m.width=h,m.height=h/p):(m.height=h,m.width=h*p),m.y=u[1]-m.height/2,m.x=u[0]-m.width/2}else a=t.getBoxLayoutParams(),a.aspect=p,m=r.getLayoutRect(a,{width:c,height:d});this.setViewRect(m.x,m.y,m.width,m.height),this.setCenter(t.get("center")),this.setZoom(t.get("zoom"))}function o(t,e){s.each(e.get("geoCoord"),function(e,i){t.addGeoCoord(i,e)})}var a=i(391),r=i(12),s=i(1),l=i(4),u={},h={dimensions:a.prototype.dimensions,create:function(t,e){var i=[];t.eachComponent("geo",function(t,r){var s=t.get("map"),l=u[s],h=new a(s+r,s,l&&l.geoJson,l&&l.specialAreas,t.get("nameMap"));h.zoomLimit=t.get("scaleLimit"),i.push(h),o(h,t),t.coordinateSystem=h,h.model=t,h.resize=n,h.resize(t,e)}),t.eachSeries(function(t){var e=t.get("coordinateSystem");if("geo"===e){var n=t.get("geoIndex")||0;t.coordinateSystem=i[n]}});var r={};return t.eachSeriesByType("map",function(t){if(!t.getHostGeoModel()){var e=t.getMapType();r[e]=r[e]||[],r[e].push(t)}}),s.each(r,function(t,r){var l=u[r],h=s.map(t,function(t){return t.get("nameMap")}),c=new a(r,r,l&&l.geoJson,l&&l.specialAreas,s.mergeAll(h));c.zoomLimit=s.retrieve.apply(null,s.map(t,function(t){return t.get("scaleLimit")})),i.push(c),c.resize=n,c.resize(t[0],e),s.each(t,function(t){t.coordinateSystem=c,o(c,t)})}),i},registerMap:function(t,e,i){e.geoJson&&!e.features&&(i=e.specialAreas,e=e.geoJson),"string"==typeof e&&(e="undefined"!=typeof JSON&&JSON.parse?JSON.parse(e):new Function("return ("+e+");")()),u[t]={geoJson:e,specialAreas:i}},getMap:function(t){return u[t]},getFilledRegions:function(t,e){var i=(t||[]).slice(),n=h.getMap(e),o=n&&n.geoJson;if(!o)return t;for(var a={},r=o.features,s=0;s1)for(var i=1;i=0;a--){var r=n[a],s=o[a],l=r[0]-s[0]/2,u=r[1]-s[1]/2;if(t>=l&&e>=u&&t<=l+s[0]&&e<=u+s[1])return a}return-1}}),s=n.prototype;s.updateData=function(t){this.group.removeAll();var e=this._symbolEl,i=t.hostModel;e.setShape({points:t.mapArray(t.getItemLayout),sizes:t.mapArray(function(e){var i=t.getItemVisual(e,"symbolSize");return i instanceof Array||(i=[i,i]),i})}),e.symbolProxy=a.createSymbol(t.getVisual("symbol"),0,0,0,0),e.setColor=e.symbolProxy.setColor,e.useStyle(i.getModel("itemStyle.normal").getItemStyle(["color"]));var n=t.getVisual("color");n&&e.setColor(n),e.seriesIndex=i.seriesIndex,e.on("mousemove",function(t){e.dataIndex=null;var i=e.findDataIndex(t.offsetX,t.offsetY);i>0&&(e.dataIndex=i)}),this.group.add(e)},s.updateLayout=function(t){var e=t.getData();this._symbolEl.setShape({points:e.mapArray(e.getItemLayout)})},s.remove=function(){this.group.removeAll()},t.exports=n},function(t,e,i){function n(t){return isNaN(+t.cpx1)||isNaN(+t.cpy1)}var o=i(3),a=i(6),r=o.Line.prototype,s=o.BezierCurve.prototype;t.exports=o.extendShape({type:"ec-line",style:{stroke:"#000",fill:null},shape:{x1:0,y1:0,x2:0,y2:0,percent:1,cpx1:null,cpy1:null},buildPath:function(t,e){(n(e)?r:s).buildPath(t,e)},pointAt:function(t){return n(this.shape)?r.pointAt.call(this,t):s.pointAt.call(this,t)},tangentAt:function(t){var e=this.shape,i=n(e)?[e.x2-e.x1,e.y2-e.y1]:s.tangentAt.call(this,t);return a.normalize(i,i)}})},function(t,e,i){var n=i(1),o=i(2);i(193),i(194),o.registerVisual(n.curry(i(50),"scatter","circle",null)),o.registerLayout(n.curry(i(61),"scatter")),i(38)},function(t,e,i){"use strict";var n=i(27),o=i(18);t.exports=o.extend({type:"series.scatter",dependencies:["grid","polar","geo","singleAxis"],getInitialData:function(t,e){var i=n(t.data,this,e);return i},brushSelector:"point",defaultOption:{coordinateSystem:"cartesian2d",zlevel:0,z:2,legendHoverLink:!0,hoverAnimation:!0,symbolSize:10,large:!1,largeThreshold:2e3,itemStyle:{normal:{opacity:.8}}}})},function(t,e,i){var n=i(44),o=i(190);i(2).extendChartView({type:"scatter",init:function(){this._normalSymbolDraw=new n,this._largeSymbolDraw=new o},render:function(t,e,i){var n=t.getData(),o=this._largeSymbolDraw,a=this._normalSymbolDraw,r=this.group,s=t.get("large")&&n.count()>t.get("largeThreshold")?o:a;this._symbolDraw=s,s.updateData(n),r.add(s.group),r.remove(s===o?a.group:o.group)},updateLayout:function(t){this._symbolDraw.updateLayout(t)},remove:function(t,e){this._symbolDraw&&this._symbolDraw.remove(e,!0)},dispose:function(){}})},function(t,e,i){i(128),i(46),i(47),i(201),i(202),i(197),i(198),i(126),i(125)},function(t,e,i){function n(t,e,i){var n=[1/0,-(1/0)];return u(i,function(t){var i=t.getData();i&&u(t.coordDimToDataDim(e),function(t){var e=i.getDataExtent(t);e[0]n[1]&&(n[1]=e[1])})}),n[1]0?0:NaN);var r=i.getMax(!0);return null!=r&&"dataMax"!==r?e[1]=r:o&&(e[1]=a>0?a-1:NaN),i.get("scale",!0)||(e[0]>0&&(e[0]=0),e[1]<0&&(e[1]=0)),e}function a(t,e){var i=t.getAxisModel(),n=t._percentWindow,o=t._valueWindow;if(n){var a=s.getPixelPrecision(o,[0,500]),r=e||0===n[0]&&100===n[1];i.setRange(r?null:+o[0].toFixed(a),r?null:+o[1].toFixed(a))}}var r=i(1),s=i(4),l=i(77),u=r.each,h=s.asc,c=function(t,e,i,n){this._dimName=t,this._axisIndex=e,this._valueWindow,this._percentWindow,this._dataExtent,this.ecModel=n,this._dataZoomModel=i};c.prototype={constructor:c,hostedBy:function(t){return this._dataZoomModel===t},getDataValueWindow:function(){return this._valueWindow.slice()},getDataPercentWindow:function(){return this._percentWindow.slice()},getTargetSeriesModels:function(){var t=[],e=this.ecModel;return e.eachSeries(function(i){if(l.isCoordSupported(i.get("coordinateSystem"))){var n=this._dimName,o=e.queryComponents({mainType:n+"Axis",index:i.get(n+"AxisIndex"),id:i.get(n+"AxisId")})[0];this._axisIndex===(o&&o.componentIndex)&&t.push(i)}},this),t},getAxisModel:function(){return this.ecModel.getComponent(this._dimName+"Axis",this._axisIndex)},getOtherAxisModel:function(){var t,e,i=this._dimName,n=this.ecModel,o=this.getAxisModel(),a="x"===i||"y"===i;a?(e="gridIndex",t="x"===i?"y":"x"):(e="polarIndex",t="angle"===i?"radius":"angle");var r;return n.eachComponent(t+"Axis",function(t){(t.get(e)||0)===(o.get(e)||0)&&(r=t)}),r},calculateDataWindow:function(t){var e=this._dataExtent,i=this.getAxisModel(),n=i.axis.scale,o=this._dataZoomModel.getRangePropMode(),a=[0,100],r=[t.start,t.end],l=[];return u(["startValue","endValue"],function(e){l.push(null!=t[e]?n.parse(t[e]):null)}),u([0,1],function(t){var i=l[t],u=r[t];"percent"===o[t]?(null==u&&(u=a[t]),i=n.parse(s.linearMap(u,a,e,!0))):u=s.linearMap(i,e,a,!0),l[t]=i,r[t]=u}),{valueWindow:h(l),percentWindow:h(r)}},reset:function(t){if(t===this._dataZoomModel){this._dataExtent=n(this,this._dimName,this.getTargetSeriesModels());var e=this.calculateDataWindow(t.option);this._valueWindow=e.valueWindow,this._percentWindow=e.percentWindow,a(this)}},restore:function(t){t===this._dataZoomModel&&(this._valueWindow=this._percentWindow=null,a(this,!0))},filterData:function(t){function e(t){return t>=a[0]&&t<=a[1]}if(t===this._dataZoomModel){var i=this._dimName,n=this.getTargetSeriesModels(),o=t.get("filterMode"),a=this._valueWindow,r=this.getOtherAxisModel();t.get("$fromToolbox")&&r&&"category"===r.get("type")&&(o="empty"),u(n,function(t){var n=t.getData();n&&u(t.coordDimToDataDim(i),function(i){"empty"===o?t.setData(n.map(i,function(t){return e(t)?t:NaN})):n.filterSelf(i,e)})})}}},t.exports=c},function(t,e,i){t.exports=i(46).extend({type:"dataZoom.inside",defaultOption:{disabled:!1,zoomLock:!1}})},function(t,e,i){function n(t){var e=[0,100];return!(t[0]<=e[1])&&(t[0]=e[1]),!(t[1]<=e[1])&&(t[1]=e[1]),!(t[0]>=e[0])&&(t[0]=e[0]),!(t[1]>=e[0])&&(t[1]=e[0]),t}var o=i(47),a=i(1),r=i(95),s=i(203),l=a.bind,u=o.extend({type:"dataZoom.inside",init:function(t,e){this._range},render:function(t,e,i,n){u.superApply(this,"render",arguments),s.shouldRecordRange(n,t.id)&&(this._range=t.getPercentRange()),a.each(this.getTargetCoordInfo(),function(e,n){var o=a.map(e,function(t){return s.generateCoordId(t.model)});a.each(e,function(e){var a=e.model;s.register(i,{coordId:s.generateCoordId(a),allCoordIds:o,containsPoint:function(t,e){return a.coordinateSystem.containPoint([t,e])},dataZoomId:t.id,throttleRate:t.get("throttle",!0),panGetRange:l(this._onPan,this,e,n),zoomGetRange:l(this._onZoom,this,e,n)})},this)},this)},dispose:function(){s.unregister(this.api,this.dataZoomModel.id),u.superApply(this,"dispose",arguments),this._range=null},_onPan:function(t,e,i,n,o,a,s,l,u){if(this.dataZoomModel.option.disabled)return this._range;var c=this._range.slice(),d=t.axisModels[0];if(d){var f=h[e]([a,s],[l,u],d,i,t),p=f.signal*(c[1]-c[0])*f.pixel/f.pixelLength;return r(p,c,[0,100],"rigid"),this._range=c}},_onZoom:function(t,e,i,o,a,r){var s=this.dataZoomModel.option;if(s.disabled||s.zoomLock)return this._range;var l=this._range.slice(),u=t.axisModels[0];if(u){var c=h[e](null,[a,r],u,i,t),d=(c.pixel-c.pixelStart)/c.pixelLength*(l[1]-l[0])+l[0];return o=Math.max(1/o,0),l[0]=(l[0]-d)*o+d,l[1]=(l[1]-d)*o+d,this._range=n(l)}}}),h={grid:function(t,e,i,n,o){var a=i.axis,r={},s=o.model.coordinateSystem.getRect();return t=t||[0,0],"x"===a.dim?(r.pixel=e[0]-t[0],r.pixelLength=s.width,r.pixelStart=s.x,r.signal=a.inverse?1:-1):(r.pixel=e[1]-t[1],r.pixelLength=s.height,r.pixelStart=s.y,r.signal=a.inverse?-1:1),r},polar:function(t,e,i,n,o){var a=i.axis,r={},s=o.model.coordinateSystem,l=s.getRadiusAxis().getExtent(),u=s.getAngleAxis().getExtent();return t=t?s.pointToCoord(t):[0,0],e=s.pointToCoord(e),"radiusAxis"===i.mainType?(r.pixel=e[0]-t[0],r.pixelLength=l[1]-l[0],r.pixelStart=l[0],r.signal=a.inverse?1:-1):(r.pixel=e[1]-t[1],r.pixelLength=u[1]-u[0],r.pixelStart=u[0],r.signal=a.inverse?-1:1),r},singleAxis:function(t,e,i,n,o){var a=i.axis,r=o.model.coordinateSystem.getRect(),s={};return t=t||[0,0],"horizontal"===a.orient?(s.pixel=e[0]-t[0],s.pixelLength=r.width,s.pixelStart=r.x,s.signal=a.inverse?1:-1):(s.pixel=e[1]-t[1],s.pixelLength=r.height,s.pixelStart=r.y,s.signal=a.inverse?-1:1),s}};t.exports=u},function(t,e,i){var n=i(46);t.exports=n.extend({type:"dataZoom.select"})},function(t,e,i){t.exports=i(47).extend({type:"dataZoom.select"})},function(t,e,i){var n=i(46),o=n.extend({type:"dataZoom.slider",layoutMode:"box",defaultOption:{show:!0,right:"ph",top:"ph",width:"ph",height:"ph",left:null,bottom:null,backgroundColor:"rgba(47,69,84,0)",dataBackground:{lineStyle:{color:"#2f4554",width:.5,opacity:.3},areaStyle:{color:"rgba(47,69,84,0.3)",opacity:.3}},borderColor:"#ddd",fillerColor:"rgba(167,183,204,0.4)",handleIcon:"M8.2,13.6V3.9H6.3v9.7H3.1v14.9h3.3v9.7h1.8v-9.7h3.3V13.6H8.2z M9.7,24.4H4.8v-1.4h4.9V24.4z M9.7,19.1H4.8v-1.4h4.9V19.1z",handleSize:"100%",handleStyle:{color:"#a7b7cc"},labelPrecision:null,labelFormatter:null,showDetail:!0,showDataShadow:"auto",realtime:!0,zoomLock:!1,textStyle:{color:"#333"}}});t.exports=o},function(t,e,i){function n(t){var e={x:"y",y:"x",radius:"angle",angle:"radius"};return e[t]}var o=i(1),a=i(3),r=i(39),s=i(47),l=a.Rect,u=i(4),h=u.linearMap,c=i(12),d=i(95),f=i(20),p=u.asc,g=o.bind,m=o.each,v=7,y=1,x=30,_="horizontal",b="vertical",w=5,S=["line","bar","candlestick","scatter"],M=s.extend({type:"dataZoom.slider",init:function(t,e){this._displayables={},this._orient,this._range,this._handleEnds,this._size,this._handleWidth,this._handleHeight,this._location,this._dragging,this._dataShadowInfo,this.api=e},render:function(t,e,i,n){return M.superApply(this,"render",arguments),r.createOrUpdate(this,"_dispatchZoomAction",this.dataZoomModel.get("throttle"),"fixRate"),this._orient=t.get("orient"),this.dataZoomModel.get("show")===!1?void this.group.removeAll():(n&&"dataZoom"===n.type&&n.from===this.uid||this._buildView(),void this._updateView())},remove:function(){M.superApply(this,"remove",arguments),r.clear(this,"_dispatchZoomAction")},dispose:function(){M.superApply(this,"dispose",arguments),r.clear(this,"_dispatchZoomAction")},_buildView:function(){var t=this.group;t.removeAll(),this._resetLocation(),this._resetInterval();var e=this._displayables.barGroup=new a.Group;this._renderBackground(),this._renderHandle(),this._renderDataShadow(),t.add(e),this._positionGroup()},_resetLocation:function(){var t=this.dataZoomModel,e=this.api,i=this._findCoordRect(),n={width:e.getWidth(),height:e.getHeight()},a=this._orient===_?{right:n.width-i.x-i.width,top:n.height-x-v,width:i.width,height:x}:{right:v,top:i.y,width:x,height:i.height},r=c.getLayoutParams(t.option);o.each(["right","top","width","height"],function(t){"ph"===r[t]&&(r[t]=a[t])});var s=c.getLayoutRect(r,n,t.padding);this._location={x:s.x,y:s.y},this._size=[s.width,s.height],this._orient===b&&this._size.reverse()},_positionGroup:function(){var t=this.group,e=this._location,i=this._orient,n=this.dataZoomModel.getFirstTargetAxisModel(),o=n&&n.get("inverse"),a=this._displayables.barGroup,r=(this._dataShadowInfo||{}).otherAxisInverse;a.attr(i!==_||o?i===_&&o?{scale:r?[-1,1]:[-1,-1]}:i!==b||o?{scale:r?[-1,-1]:[-1,1],rotation:Math.PI/2}:{scale:r?[1,-1]:[1,1],rotation:Math.PI/2}:{scale:r?[1,1]:[1,-1]});var s=t.getBoundingRect([a]);t.attr("position",[e.x-s.x,e.y-s.y])},_getViewExtent:function(){return[0,this._size[0]]},_renderBackground:function(){var t=this.dataZoomModel,e=this._size;this._displayables.barGroup.add(new l({silent:!0,shape:{x:0,y:0,width:e[0],height:e[1]},style:{fill:t.get("backgroundColor")},z2:-40}))},_renderDataShadow:function(){var t=this._dataShadowInfo=this._prepareDataShadowInfo();if(t){var e=this._size,i=t.series,n=i.getRawData(),r=i.getShadowDim?i.getShadowDim():t.otherDim;if(null!=r){var s=n.getDataExtent(r),l=.3*(s[1]-s[0]);s=[s[0]-l,s[1]+l];var u,c=[0,e[1]],d=[0,e[0]],f=[[e[0],0],[0,0]],p=[],g=d[1]/(n.count()-1),m=0,v=Math.round(n.count()/e[0]);n.each([r],function(t,e){if(v>0&&e%v)return void(m+=g);var i=null==t||isNaN(t)||""===t,n=i?0:h(t,s,c,!0);i&&!u&&e?(f.push([f[f.length-1][0],0]),p.push([p[p.length-1][0],0])):!i&&u&&(f.push([m,0]),p.push([m,0])),f.push([m,n]),p.push([m,n]),m+=g,u=i});var y=this.dataZoomModel;this._displayables.barGroup.add(new a.Polygon({shape:{points:f},style:o.defaults({fill:y.get("dataBackgroundColor")},y.getModel("dataBackground.areaStyle").getAreaStyle()),silent:!0,z2:-20})),this._displayables.barGroup.add(new a.Polyline({shape:{points:p},style:y.getModel("dataBackground.lineStyle").getLineStyle(),silent:!0,z2:-19}))}}},_prepareDataShadowInfo:function(){var t=this.dataZoomModel,e=t.get("showDataShadow");if(e!==!1){var i,a=this.ecModel;return t.eachTargetAxis(function(r,s){var l=t.getAxisProxy(r.name,s).getTargetSeriesModels();o.each(l,function(t){if(!(i||e!==!0&&o.indexOf(S,t.get("type"))<0)){var l,u=a.getComponent(r.axis,s).axis,h=n(r.name),c=t.coordinateSystem;null!=h&&c.getOtherAxis&&(l=c.getOtherAxis(u).inverse),i={thisAxis:u,series:t,thisDim:r.name,otherDim:h,otherAxisInverse:l}}},this)},this),i}},_renderHandle:function(){var t=this._displayables,e=t.handles=[],i=t.handleLabels=[],n=this._displayables.barGroup,o=this._size,r=this.dataZoomModel;n.add(t.filler=new l({draggable:!0,cursor:"move",drift:g(this._onDragMove,this,"all"),onmousemove:function(t){f.stop(t.event)},ondragstart:g(this._showDataInfo,this,!0),ondragend:g(this._onDragEnd,this),onmouseover:g(this._showDataInfo,this,!0),onmouseout:g(this._showDataInfo,this,!1),style:{fill:r.get("fillerColor"),textPosition:"inside"}})),n.add(new l(a.subPixelOptimizeRect({silent:!0,shape:{x:0,y:0,width:o[0],height:o[1]},style:{stroke:r.get("dataBackgroundColor")||r.get("borderColor"),lineWidth:y,fill:"rgba(0,0,0,0)"}})));var s=r.get("handleIcon");m([0,1],function(t){var o=a.makePath(s,{style:{strokeNoScale:!0},rectHover:!0,cursor:"vertical"===this._orient?"ns-resize":"ew-resize",draggable:!0,drift:g(this._onDragMove,this,t),onmousemove:function(t){f.stop(t.event)},ondragend:g(this._onDragEnd,this),onmouseover:g(this._showDataInfo,this,!0),onmouseout:g(this._showDataInfo,this,!1)},{x:-.5,y:0,width:1,height:1},"center"),l=o.getBoundingRect();this._handleHeight=u.parsePercent(r.get("handleSize"),this._size[1]),this._handleWidth=l.width/l.height*this._handleHeight,o.setStyle(r.getModel("handleStyle").getItemStyle());var h=r.get("handleColor");null!=h&&(o.style.fill=h),n.add(e[t]=o);var c=r.textStyleModel;this.group.add(i[t]=new a.Text({silent:!0,invisible:!0,style:{x:0,y:0,text:"",textVerticalAlign:"middle",textAlign:"center",fill:c.getTextColor(),textFont:c.getFont()},z2:10}))},this)},_resetInterval:function(){var t=this._range=this.dataZoomModel.getPercentRange(),e=this._getViewExtent();this._handleEnds=[h(t[0],[0,100],e,!0),h(t[1],[0,100],e,!0)]},_updateInterval:function(t,e){var i=this._handleEnds,n=this._getViewExtent();d(e,i,n,"all"===t||this.dataZoomModel.get("zoomLock")?"rigid":"cross",t),this._range=p([h(i[0],n,[0,100],!0),h(i[1],n,[0,100],!0)])},_updateView:function(t){var e=this._displayables,i=this._handleEnds,n=p(i.slice()),o=this._size;m([0,1],function(t){var n=e.handles[t],a=this._handleHeight;n.attr({scale:[a,a],position:[i[t],o[1]/2-a/2]})},this),e.filler.setShape({x:n[0],y:0,width:n[1]-n[0],height:o[1]}),this._updateDataInfo(t)},_updateDataInfo:function(t){function e(t){var e=a.getTransform(n.handles[t].parent,this.group),i=a.transformDirection(0===t?"right":"left",e),l=this._handleWidth/2+w,u=a.applyTransform([d[t]+(0===t?-l:l),this._size[1]/2],e);o[t].setStyle({x:u[0],y:u[1],textVerticalAlign:r===_?"middle":i,textAlign:r===_?i:"center",text:s[t]})}var i=this.dataZoomModel,n=this._displayables,o=n.handleLabels,r=this._orient,s=["",""];if(i.get("showDetail")){var l=i.findRepresentativeAxisProxy();if(l){var u=l.getAxisModel().axis,h=this._range,c=t?l.calculateDataWindow({start:h[0],end:h[1]}).valueWindow:l.getDataValueWindow();s=[this._formatLabel(c[0],u),this._formatLabel(c[1],u)]}}var d=p(this._handleEnds.slice());e.call(this,0),e.call(this,1)},_formatLabel:function(t,e){var i=this.dataZoomModel,n=i.get("labelFormatter"),a=i.get("labelPrecision");null!=a&&"auto"!==a||(a=e.getPixelPrecision());var r=null==t||isNaN(t)?"":"category"===e.type||"time"===e.type?e.scale.getLabel(Math.round(t)):t.toFixed(Math.min(a,20));return o.isFunction(n)?n(t,r):o.isString(n)?n.replace("{value}",r):r},_showDataInfo:function(t){t=this._dragging||t;var e=this._displayables.handleLabels;e[0].attr("invisible",!t),e[1].attr("invisible",!t)},_onDragMove:function(t,e,i){this._dragging=!0;var n=this._applyBarTransform([e,i],!0);this._updateInterval(t,n[0]);var o=this.dataZoomModel.get("realtime");this._updateView(!o),o&&o&&this._dispatchZoomAction()},_onDragEnd:function(){this._dragging=!1,this._showDataInfo(!1),this._dispatchZoomAction()},_dispatchZoomAction:function(){var t=this._range;this.api.dispatchAction({type:"dataZoom",from:this.uid,dataZoomId:this.dataZoomModel.id,start:t[0],end:t[1]})},_applyBarTransform:function(t,e){var i=this._displayables.barGroup.getLocalTransform();return a.applyTransform(t,i,e)},_findCoordRect:function(){var t;if(m(this.getTargetCoordInfo(),function(e){if(!t&&e.length){var i=e[0].model.coordinateSystem;t=i.getRect&&i.getRect()}}),!t){var e=this.api.getWidth(),i=this.api.getHeight();t={x:.2*e,y:.2*i,width:.6*e,height:.6*i}}return t}});t.exports=M},function(t,e,i){function n(t){var e=t.getZr();return e[p]||(e[p]={})}function o(t,e,i){var n=new c(t.getZr());return n.enable(),n.on("pan",f(r,i)),n.on("zoom",f(s,i)),n}function a(t){h.each(t,function(e,i){e.count||(e.controller.dispose(),delete t[i])})}function r(t,e,i,n,o,a,r){l(t,function(s){return s.panGetRange(t.controller,e,i,n,o,a,r)})}function s(t,e,i,n){l(t,function(o){return o.zoomGetRange(t.controller,e,i,n)})}function l(t,e){var i=[];h.each(t.dataZoomInfos,function(t){var n=e(t);n&&i.push({dataZoomId:t.dataZoomId,start:n[0],end:n[1]})}),t.dispatchAction(i)}function u(t,e){t.dispatchAction({type:"dataZoom",batch:e})}var h=i(1),c=i(94),d=i(39),f=h.curry,p="\0_ec_dataZoom_roams",g={register:function(t,e){var i=n(t),r=e.dataZoomId,s=e.coordId;h.each(i,function(t,i){var n=t.dataZoomInfos;n[r]&&h.indexOf(e.allCoordIds,s)<0&&(delete n[r],t.count--)}),a(i);var l=i[s];l||(l=i[s]={coordId:s,dataZoomInfos:{},count:0},l.controller=o(t,e,l),l.dispatchAction=h.curry(u,t)),l.controller.setContainsPoint(e.containsPoint),d.createOrUpdate(l,"dispatchAction",e.throttleRate,"fixRate"),!l.dataZoomInfos[r]&&l.count++,l.dataZoomInfos[r]=e},unregister:function(t,e){var i=n(t);h.each(i,function(t){t.controller.dispose();var i=t.dataZoomInfos;i[e]&&(delete i[e],t.count--)}),a(i)},shouldRecordRange:function(t,e){if(t&&"dataZoom"===t.type&&t.batch)for(var i=0,n=t.batch.length;i=0;f--)null==o[f]?o.splice(f,1):delete o[f].$action},_flatten:function(t,e,i){c.each(t,function(t){if(t){i&&(t.parentOption=i),e.push(t);var n=t.children;"group"===t.type&&n&&this._flatten(n,e,t),delete t.children}},this)},useElOptionsToUpdate:function(){var t=this._elOptionsToUpdate;return this._elOptionsToUpdate=null,t}});h.extendComponentView({type:"graphic",init:function(t,e){this._elMap={},this._lastGraphicModel},render:function(t,e,i){t!==this._lastGraphicModel&&this._clear(),this._lastGraphicModel=t,this._updateElements(t,i),this._relocate(t,i)},_updateElements:function(t,e){var i=t.useElOptionsToUpdate();if(i){var r=this._elMap,s=this.group;c.each(i,function(t){var e=t.$action,i=t.id,l=r[i],u=t.parentId,h=null!=u?r[u]:s;t.hv&&t.hv[1]&&"text"===t.type&&(t.style=c.defaults({textBaseline:"middle"},t.style),t.style.textVerticalAlign=null);var d=a(t);e&&"merge"!==e?"replace"===e?(o(l,r),n(i,h,d,r)):"remove"===e&&o(l,r):l?l.attr(d):n(i,h,d,r),r[i]&&(r[i].__ecGraphicWidth=t.width,r[i].__ecGraphicHeight=t.height)})}},_relocate:function(t,e){for(var i=t.option.elements,n=this.group,o=this._elMap,a=i.length-1;a>=0;a--){var r=i[a],s=o[r.id];if(s){var l=s.parent,u=l===n?{width:e.getWidth(),height:e.getHeight()}:{width:l.__ecGraphicWidth||0,height:l.__ecGraphicHeight||0};p.positionElement(s,r,u,null,{hv:r.hv,boundingMode:r.bounding})}}},_clear:function(){var t=this._elMap;c.each(t,function(e){o(e,t)}),this._elMap={}},dispose:function(){this._clear()}})},function(t,e,i){i(207),i(209),i(208);var n=i(2);n.registerProcessor(i(210))},function(t,e,i){"use strict";var n=i(1),o=i(10),a=i(2).extendComponentModel({type:"legend",dependencies:["series"],layoutMode:{type:"box",ignoreSize:!0},init:function(t,e,i){this.mergeDefaultAndTheme(t,i),t.selected=t.selected||{}},mergeOption:function(t){a.superCall(this,"mergeOption",t)},optionUpdated:function(){this._updateData(this.ecModel);var t=this._data;if(t[0]&&"single"===this.get("selectedMode")){for(var e=!1,i=0;i=0},defaultOption:{ +zlevel:0,z:4,show:!0,orient:"horizontal",left:"center",top:"top",align:"auto",backgroundColor:"rgba(0,0,0,0)",borderColor:"#ccc",borderWidth:0,padding:5,itemGap:10,itemWidth:25,itemHeight:14,inactiveColor:"#ccc",textStyle:{color:"#333"},selectedMode:!0,tooltip:{show:!1}}});t.exports=a},function(t,e,i){function n(t,e){e.dispatchAction({type:"legendToggleSelect",name:t})}function o(t,e,i){var n=i.getZr().storage.getDisplayList()[0];n&&n.useHoverLayer||t.get("legendHoverLink")&&i.dispatchAction({type:"highlight",seriesName:t.name,name:e})}function a(t,e,i){var n=i.getZr().storage.getDisplayList()[0];n&&n.useHoverLayer||t.get("legendHoverLink")&&i.dispatchAction({type:"downplay",seriesName:t.name,name:e})}var r=i(1),s=i(24),l=i(3),u=i(131),h=r.curry;t.exports=i(2).extendComponentView({type:"legend",init:function(){this._symbolTypeStore={}},render:function(t,e,i){var s=this.group;if(s.removeAll(),t.get("show")){var c=t.get("selectedMode"),d=t.get("align");"auto"===d&&(d="right"===t.get("left")&&"vertical"===t.get("orient")?"right":"left");var f={};r.each(t.getData(),function(r){var u=r.get("name");if(""===u||"\n"===u)return void s.add(new l.Group({newline:!0}));var p=e.getSeriesByName(u)[0];if(!f[u])if(p){var g=p.getData(),m=g.getVisual("color");"function"==typeof m&&(m=m(p.getDataParams(0)));var v=g.getVisual("legendSymbol")||"roundRect",y=g.getVisual("symbol"),x=this._createItem(u,r,t,v,y,d,m,c);x.on("click",h(n,u,i)).on("mouseover",h(o,p,null,i)).on("mouseout",h(a,p,null,i)),f[u]=!0}else e.eachRawSeries(function(e){if(!f[u]&&e.legendDataProvider){var s=e.legendDataProvider(),l=s.indexOfName(u);if(l<0)return;var p=s.getItemVisual(l,"color"),g="roundRect",m=this._createItem(u,r,t,g,null,d,p,c);m.on("click",h(n,u,i)).on("mouseover",h(o,e,u,i)).on("mouseout",h(a,e,u,i)),f[u]=!0}},this)},this),u.layout(s,t,i),u.addBackground(s,t)}},_createItem:function(t,e,i,n,o,a,u,h){var c=i.get("itemWidth"),d=i.get("itemHeight"),f=i.get("inactiveColor"),p=i.isSelected(t),g=new l.Group,m=e.getModel("textStyle"),v=e.get("icon"),y=e.getModel("tooltip"),x=y.parentModel;if(n=v||n,g.add(s.createSymbol(n,0,0,c,d,p?u:f)),!v&&o&&(o!==n||"none"==o)){var _=.8*d;"none"===o&&(o="circle"),g.add(s.createSymbol(o,(c-_)/2,(d-_)/2,_,_,p?u:f))}var b="left"===a?c+5:-5,w=a,S=i.get("formatter"),M=t;"string"==typeof S&&S?M=S.replace("{name}",null!=t?t:""):"function"==typeof S&&(M=S(t));var I=new l.Text({style:{text:M,x:b,y:d/2,fill:p?m.getTextColor():f,textFont:m.getFont(),textAlign:w,textVerticalAlign:"middle"}});g.add(I);var T=new l.Rect({shape:g.getBoundingRect(),invisible:!0,tooltip:y.get("show")?r.extend({content:t,formatter:x.get("formatter",!0)||function(){return t},formatterParams:{componentType:"legend",legendIndex:i.componentIndex,name:t,$vars:["name"]}},y.option):null});return g.add(T),g.eachChild(function(t){t.silent=!0}),T.silent=!h,this.group.add(g),l.setHoverStyle(g),g}})},function(t,e,i){function n(t,e,i){var n,o={},r="toggleSelected"===t;return i.eachComponent("legend",function(i){r&&null!=n?i[n?"select":"unSelect"](e.name):(i[t](e.name),n=i.isSelected(e.name));var s=i.getData();a.each(s,function(t){var e=t.get("name");if("\n"!==e&&""!==e){var n=i.isSelected(e);e in o?o[e]=o[e]&&n:o[e]=n}})}),{name:e.name,selected:o}}var o=i(2),a=i(1);o.registerAction("legendToggleSelect","legendselectchanged",a.curry(n,"toggleSelected")),o.registerAction("legendSelect","legendselected",a.curry(n,"select")),o.registerAction("legendUnSelect","legendunselected",a.curry(n,"unSelect"))},function(t,e){t.exports=function(t){var e=t.findComponents({mainType:"legend"});e&&e.length&&t.filterSeries(function(t){for(var i=0;i=0&&"number"==typeof u&&(u=+u.toFixed(m)),p.coord[d]=g.coord[d]=u,n=[p,g,{type:a,valueIndex:n.valueIndex,value:u}]}return n=[c.dataTransform(t,n[0]),c.dataTransform(t,n[1]),l.extend({},n[2])],n[2].type=n[2].type||"",l.merge(n[2],n[0]),l.merge(n[2],n[1]),n};i(80).extend({type:"markLine",updateLayout:function(t,e,i){e.eachSeries(function(t){var e=t.markLineModel;if(e){var n=e.getData(),o=e.__from,a=e.__to;o.each(function(e){r(o,e,!0,t,i),r(a,e,!1,t,i)}),n.each(function(t){n.setItemLayout(t,[o.getItemLayout(t),a.getItemLayout(t)])}),this.markerGroupMap[t.name].updateLayout()}},this)},renderSeries:function(t,e,i,n){function o(e,i,o){var a=e.getItemModel(i);r(e,i,o,t,n),e.setItemVisual(i,{symbolSize:a.get("symbolSize")||x[o?0:1],symbol:a.get("symbol",!0)||y[o?0:1],color:a.get("itemStyle.normal.color")||h.getVisual("color")})}var a=t.coordinateSystem,u=t.name,h=t.getData(),c=this.markerGroupMap,f=c[u];f||(f=c[u]=new d),this.group.add(f.group);var p=s(a,t,e),g=p.from,m=p.to,v=p.line;e.__from=g,e.__to=m,e.setData(v);var y=e.get("symbol"),x=e.get("symbolSize");l.isArray(y)||(y=[y,y]),"number"==typeof x&&(x=[x,x]),p.from.each(function(t){o(g,t,!0),o(m,t,!1)}),v.each(function(t){var e=v.getItemModel(t).get("lineStyle.normal.color");v.setItemVisual(t,{color:e||g.getItemVisual(t,"color")}),v.setItemLayout(t,[g.getItemLayout(t),m.getItemLayout(t)]),v.setItemVisual(t,{fromSymbolSize:g.getItemVisual(t,"symbolSize"),fromSymbol:g.getItemVisual(t,"symbol"),toSymbolSize:m.getItemVisual(t,"symbolSize"),toSymbol:m.getItemVisual(t,"symbol")})}),f.updateData(v),p.line.eachItemGraphicEl(function(t,i){t.traverse(function(t){t.dataModel=e})}),f.__keep=!0,f.group.silent=e.get("silent")||t.get("silent")}})},function(t,e,i){t.exports=i(79).extend({type:"markPoint",defaultOption:{zlevel:0,z:5,symbol:"pin",symbolSize:50,tooltip:{trigger:"item"},label:{normal:{show:!0,position:"inside"},emphasis:{show:!0}},itemStyle:{normal:{borderWidth:2}}}})},function(t,e,i){function n(t,e,i){var n=e.coordinateSystem;t.each(function(o){var a,r=t.getItemModel(o),l=s.parsePercent(r.get("x"),i.getWidth()),u=s.parsePercent(r.get("y"),i.getHeight());if(isNaN(l)||isNaN(u)){if(e.getMarkerPosition)a=e.getMarkerPosition(t.getValues(t.dimensions,o));else if(n){var h=t.get(n.dimensions[0],o),c=t.get(n.dimensions[1],o);a=n.dataToPoint([h,c])}}else a=[l,u];isNaN(l)||(a[0]=l),isNaN(u)||(a[1]=u),t.setItemLayout(o,a)})}function o(t,e,i){var n;n=t?r.map(t&&t.dimensions,function(t){var i=e.getData().getDimensionInfo(e.coordDimToDataDim(t)[0])||{};return i.name=t,i}):[{name:"value",type:"float"}];var o=new l(n,i),a=r.map(i.get("data"),r.curry(u.dataTransform,e));return t&&(a=r.filter(a,r.curry(u.dataFilter,t))),o.initData(a,null,t?u.dimValueGetter:function(t){return t.value}),o}var a=i(44),r=i(1),s=i(4),l=i(14),u=i(81);i(80).extend({type:"markPoint",updateLayout:function(t,e,i){e.eachSeries(function(t){var e=t.markPointModel;e&&(n(e.getData(),t,i),this.markerGroupMap[t.name].updateLayout(e))},this)},renderSeries:function(t,e,i,r){var s=t.coordinateSystem,l=t.name,u=t.getData(),h=this.markerGroupMap,c=h[l];c||(c=h[l]=new a);var d=o(s,t,e);e.setData(d),n(e.getData(),t,r),d.each(function(t){var i=d.getItemModel(t),n=i.getShallow("symbolSize");"function"==typeof n&&(n=n(e.getRawValue(t),e.getDataParams(t))),d.setItemVisual(t,{symbolSize:n,color:i.get("itemStyle.normal.color")||u.getVisual("color"),symbol:i.getShallow("symbol")})}),c.updateData(d),this.group.add(c.group),d.eachItemGraphicEl(function(t){t.traverse(function(t){t.dataModel=e})}),c.__keep=!0,c.group.silent=e.get("silent")||t.get("silent")}})},function(t,e,i){"use strict";var n=i(2),o=i(3),a=i(12);n.extendComponentModel({type:"title",layoutMode:{type:"box",ignoreSize:!0},defaultOption:{zlevel:0,z:6,show:!0,text:"",target:"blank",subtext:"",subtarget:"blank",left:0,top:0,backgroundColor:"rgba(0,0,0,0)",borderColor:"#ccc",borderWidth:0,padding:5,itemGap:10,textStyle:{fontSize:18,fontWeight:"bolder",color:"#333"},subtextStyle:{color:"#aaa"}}}),n.extendComponentView({type:"title",render:function(t,e,i){if(this.group.removeAll(),t.get("show")){var n=this.group,r=t.getModel("textStyle"),s=t.getModel("subtextStyle"),l=t.get("textAlign"),u=t.get("textBaseline"),h=new o.Text({style:{text:t.get("text"),textFont:r.getFont(),fill:r.getTextColor()},z2:10}),c=h.getBoundingRect(),d=t.get("subtext"),f=new o.Text({style:{text:d,textFont:s.getFont(),fill:s.getTextColor(),y:c.height+t.get("itemGap"),textBaseline:"top"},z2:10}),p=t.get("link"),g=t.get("sublink");h.silent=!p,f.silent=!g,p&&h.on("click",function(){window.open(p,"_"+t.get("target"))}),g&&f.on("click",function(){window.open(g,"_"+t.get("subtarget"))}),n.add(h),d&&n.add(f);var m=n.getBoundingRect(),v=t.getBoxLayoutParams();v.width=m.width,v.height=m.height;var y=a.getLayoutRect(v,{width:i.getWidth(),height:i.getHeight()},t.get("padding"));l||(l=t.get("left")||t.get("right"),"middle"===l&&(l="center"),"right"===l?y.x+=y.width:"center"===l&&(y.x+=y.width/2)),u||(u=t.get("top")||t.get("bottom"),"center"===u&&(u="middle"),"bottom"===u?y.y+=y.height:"middle"===u&&(y.y+=y.height/2),u=u||"top"),n.attr("position",[y.x,y.y]);var x={textAlign:l,textVerticalAlign:u};h.setStyle(x),f.setStyle(x),m=n.getBoundingRect();var _=y.margin,b=t.getItemStyle(["color","opacity"]);b.fill=t.get("backgroundColor");var w=new o.Rect({shape:{x:m.x-_[3],y:m.y-_[0],width:m.width+_[1]+_[3],height:m.height+_[0]+_[2]},style:b,silent:!0});o.subPixelOptimizeRect(w),n.add(w)}}})},function(t,e,i){i(222),i(223),i(228),i(226),i(224),i(225),i(227)},function(t,e,i){var n=i(28),o=i(1),a=i(2).extendComponentModel({type:"toolbox",layoutMode:{type:"box",ignoreSize:!0},mergeDefaultAndTheme:function(t){a.superApply(this,"mergeDefaultAndTheme",arguments),o.each(this.option.feature,function(t,e){var i=n.get(e);i&&o.merge(t,i.defaultOption)})},defaultOption:{show:!0,z:6,zlevel:0,orient:"horizontal",left:"right",top:"top",backgroundColor:"transparent",borderColor:"#ccc",borderWidth:0,padding:5,itemSize:15,itemGap:8,showTitle:!0,iconStyle:{normal:{borderColor:"#666",color:"none"},emphasis:{borderColor:"#3E98C5"}}}});t.exports=a},function(t,e,i){(function(e){function n(t){return 0===t.indexOf("my")}var o=i(28),a=i(1),r=i(3),s=i(10),l=i(48),u=i(131),h=i(16);t.exports=i(2).extendComponentView({type:"toolbox",render:function(t,e,i,c){function d(a,r){var l,u=y[a],h=y[r],d=m[u],p=new s(d,t,t.ecModel);if(u&&!h){if(n(u))l={model:p,onclick:p.option.onclick,featureName:u};else{var g=o.get(u);if(!g)return;l=new g(p,e,i)}v[u]=l}else{if(l=v[h],!l)return;l.model=p,l.ecModel=e,l.api=i}return!u&&h?void(l.dispose&&l.dispose(e,i)):!p.get("show")||l.unusable?void(l.remove&&l.remove(e,i)):(f(p,l,u),p.setIconStatus=function(t,e){var i=this.option,n=this.iconPaths;i.iconStatus=i.iconStatus||{},i.iconStatus[t]=e,n[t]&&n[t].trigger(e)},void(l.render&&l.render(p,e,i,c)))}function f(n,o,s){var l=n.getModel("iconStyle"),u=o.getIcons?o.getIcons():n.get("icon"),h=n.get("title")||{};if("string"==typeof u){var c=u,d=h;u={},h={},u[s]=c,h[s]=d}var f=n.iconPaths={};a.each(u,function(s,u){var c=l.getModel("normal").getItemStyle(),d=l.getModel("emphasis").getItemStyle(),m={x:-g/2,y:-g/2,width:g,height:g},v=0===s.indexOf("image://")?(m.image=s.slice(8),new r.Image({style:m})):r.makePath(s.replace("path://",""),{style:c,hoverStyle:d,rectHover:!0},m,"center");r.setHoverStyle(v),t.get("showTitle")&&(v.__title=h[u],v.on("mouseover",function(){var t=l.getModel("emphasis").getItemStyle();v.setStyle({text:h[u],textPosition:t.textPosition||"bottom",textFill:t.fill||t.stroke||"#000",textAlign:t.textAlign||"center"})}).on("mouseout",function(){v.setStyle({textFill:null})})),v.trigger(n.get("iconStatus."+u)||"normal"),p.add(v),v.on("click",a.bind(o.onclick,o,e,i,u)),f[u]=v})}var p=this.group;if(p.removeAll(),t.get("show")){var g=+t.get("itemSize"),m=t.get("feature")||{},v=this._features||(this._features={}),y=[];a.each(m,function(t,e){y.push(e)}),new l(this._featureNames||[],y).add(d).update(d).remove(a.curry(d,null)).execute(),this._featureNames=y,u.layout(p,t,i),u.addBackground(p,t),p.eachChild(function(t){var e=t.__title,n=t.hoverStyle;if(n&&e){var o=h.getBoundingRect(e,n.font),a=t.position[0]+p.position[0],r=t.position[1]+p.position[1]+g,s=!1;r+o.height>i.getHeight()&&(n.textPosition="top",s=!0);var l=s?-5-o.height:g+8;a+o.width/2>i.getWidth()?(n.textPosition=["100%",l],n.textAlign="right"):a-o.width/2<0&&(n.textPosition=[0,l],n.textAlign="left")}})}},updateView:function(t,e,i,n){a.each(this._features,function(t){t.updateView&&t.updateView(t.model,e,i,n)})},updateLayout:function(t,e,i,n){a.each(this._features,function(t){t.updateLayout&&t.updateLayout(t.model,e,i,n)})},remove:function(t,e){a.each(this._features,function(i){i.remove&&i.remove(t,e)}),this.group.removeAll()},dispose:function(t,e){a.each(this._features,function(i){i.dispose&&i.dispose(t,e)})}})}).call(e,i(189))},function(t,e,i){function n(t){var e={},i=[],n=[];return t.eachRawSeries(function(t){var o=t.coordinateSystem;if(!o||"cartesian2d"!==o.type&&"polar"!==o.type)i.push(t);else{var a=o.getBaseAxis();if("category"===a.type){var r=a.dim+"_"+a.index;e[r]||(e[r]={categoryAxis:a,valueAxis:o.getOtherAxis(a),series:[]},n.push({axisDim:a.dim,axisIndex:a.index})),e[r].series.push(t)}else i.push(t)}}),{seriesGroupByCategoryAxis:e,other:i,meta:n}}function o(t){var e=[];return p.each(t,function(t,i){var n=t.categoryAxis,o=t.valueAxis,a=o.dim,r=[" "].concat(p.map(t.series,function(t){return t.name})),s=[n.model.getCategories()];p.each(t.series,function(t){s.push(t.getRawData().mapArray(a,function(t){return t}))});for(var l=[r.join(v)],u=0;u=0)return!0}function u(t){for(var e=t.split(/\n+/g),i=s(e.shift()).split(y),n=[],o=p.map(i,function(t){return{name:t,data:[]}}),a=0;a1?"emphasis":"normal")}function r(t,e,i,n){var a=i._isZoomActive;n&&"takeGlobalCursor"===n.type&&(a="dataZoomSelect"===n.key&&n.dataZoomSelectActive),i._isZoomActive=a,t.setIconStatus("zoom",a?"emphasis":"normal");var r=new u(o(t.option),e,{include:["grid"]});i._brushController.setPanels(r.makePanelOpts(function(t){return t.xAxisDeclared&&!t.yAxisDeclared?"lineX":!t.xAxisDeclared&&t.yAxisDeclared?"lineY":"rect"})).enableBrush(!!a&&{brushType:"auto",brushStyle:{lineWidth:0,fill:"rgba(0,0,0,0.2)"}})}var s=i(1),l=i(129),u=i(186),h=i(127),c=s.each;i(204);var d="\0_ec_\0toolbox-dataZoom_";n.defaultOption={show:!0,icon:{zoom:"M0,13.5h26.9 M13.5,26.9V0 M32.1,13.5H58V58H13.5 V32.1",back:"M22,1.4L9.9,13.5l12.3,12.3 M10.3,13.5H54.9v44.6 H10.3v-26"},title:{zoom:"区域缩放",back:"区域缩放还原"}};var f=n.prototype;f.render=function(t,e,i,n){this.model=t,this.ecModel=e,this.api=i,r(t,e,this,n),a(t,e)},f.onclick=function(t,e,i){p[i].call(this)},f.remove=function(t,e){this._brushController.unmount()},f.dispose=function(t,e){this._brushController.dispose()};var p={zoom:function(){var t=!this._isZoomActive;this.api.dispatchAction({type:"takeGlobalCursor",key:"dataZoomSelect",dataZoomSelectActive:t})},back:function(){this._dispatchZoomAction(h.pop(this.ecModel))}};f._onBrush=function(t,e){function i(t,e,i){var o=n(t,e.getAxis(t).model,r);o&&(a[o.id]={dataZoomId:o.id,startValue:i[0],endValue:i[1]})}function n(t,e,i){var n;return i.eachComponent({mainType:"dataZoom",subType:"select"},function(i){var o=i.getAxisModel(t,e.componentIndex);o&&(n=i)}),n}if(e.isEnd&&t.length){var a={},r=this.ecModel;this._brushController.updateCovers([]);var s=new u(o(this.model.option),r,{include:["grid"]});s.matchOutputRanges(t,r,function(t,e,n){if("cartesian2d"===n.type){var o=t.brushType;"rect"===o?(i("x",n,e[0]),i("y",n,e[1])):i({lineX:"x",lineY:"y"}[o],n,e)}}),h.push(r,a),this._dispatchZoomAction(a)}},f._dispatchZoomAction=function(t){var e=[];c(t,function(t,i){e.push(s.clone(t))}),e.length&&this.api.dispatchAction({type:"dataZoom",from:this.uid,batch:e})},i(28).register("dataZoom",n),i(2).registerPreprocessor(function(t){function e(t,e){if(e){var o=t+"Index",a=e[o];null==a||"all"==a||s.isArray(a)||(a=a===!1||"none"===a?[]:[a]),i(t,function(e,i){if(null==a||"all"==a||s.indexOf(a,i)!==-1){var r={type:"select",$fromToolbox:!0,id:d+t+i};r[o]=i,n.push(r)}})}}function i(e,i){var n=t[e];s.isArray(n)||(n=n?[n]:[]),c(n,i)}if(t){var n=t.dataZoom||(t.dataZoom=[]);s.isArray(n)||(t.dataZoom=n=[n]);var o=t.toolbox;if(o&&(s.isArray(o)&&(o=o[0]),o&&o.feature)){var a=o.feature.dataZoom;e("xAxis",a),e("yAxis",a)}}}),t.exports=n},function(t,e,i){"use strict";function n(t){this.model=t}var o=i(1);n.defaultOption={show:!0,type:[],icon:{line:"M4.1,28.9h7.1l9.3-22l7.4,38l9.7-19.7l3,12.8h14.9M4.1,58h51.4",bar:"M6.7,22.9h10V48h-10V22.9zM24.9,13h10v35h-10V13zM43.2,2h10v46h-10V2zM3.1,58h53.7",stack:"M8.2,38.4l-8.4,4.1l30.6,15.3L60,42.5l-8.1-4.1l-21.5,11L8.2,38.4z M51.9,30l-8.1,4.2l-13.4,6.9l-13.9-6.9L8.2,30l-8.4,4.2l8.4,4.2l22.2,11l21.5-11l8.1-4.2L51.9,30z M51.9,21.7l-8.1,4.2L35.7,30l-5.3,2.8L24.9,30l-8.4-4.1l-8.3-4.2l-8.4,4.2L8.2,30l8.3,4.2l13.9,6.9l13.4-6.9l8.1-4.2l8.1-4.1L51.9,21.7zM30.4,2.2L-0.2,17.5l8.4,4.1l8.3,4.2l8.4,4.2l5.5,2.7l5.3-2.7l8.1-4.2l8.1-4.2l8.1-4.1L30.4,2.2z",tiled:"M2.3,2.2h22.8V25H2.3V2.2z M35,2.2h22.8V25H35V2.2zM2.3,35h22.8v22.8H2.3V35z M35,35h22.8v22.8H35V35z"},title:{line:"切换为折线图",bar:"切换为柱状图",stack:"切换为堆叠",tiled:"切换为平铺"},option:{},seriesIndex:{}};var a=n.prototype;a.getIcons=function(){var t=this.model,e=t.get("icon"),i={};return o.each(t.get("type"),function(t){e[t]&&(i[t]=e[t])}),i};var r={line:function(t,e,i,n){if("bar"===t)return o.merge({id:e,type:"line",data:i.get("data"),stack:i.get("stack"),markPoint:i.get("markPoint"),markLine:i.get("markLine")},n.get("option.line")||{},!0)},bar:function(t,e,i,n){if("line"===t)return o.merge({id:e,type:"bar",data:i.get("data"),stack:i.get("stack"),markPoint:i.get("markPoint"),markLine:i.get("markLine")},n.get("option.bar")||{},!0)},stack:function(t,e,i,n){if("line"===t||"bar"===t)return o.merge({id:e,stack:"__ec_magicType_stack__"},n.get("option.stack")||{},!0)},tiled:function(t,e,i,n){if("line"===t||"bar"===t)return o.merge({id:e,stack:""},n.get("option.tiled")||{},!0)}},s=[["line","bar"],["stack","tiled"]];a.onclick=function(t,e,i){var n=this.model,a=n.get("seriesIndex."+i);if(r[i]){var l={series:[]},u=function(e){var a=e.subType,s=e.id,u=r[i](a,s,e,n);u&&(o.defaults(u,e.option),l.series.push(u));var h=e.coordinateSystem;if(h&&"cartesian2d"===h.type&&("line"===i||"bar"===i)){var c=h.getAxesByScale("ordinal")[0];if(c){var d=c.dim,f=d+"Axis",p=t.queryComponents({mainType:f,index:e.get(name+"Index"),id:e.get(name+"Id")})[0],g=p.componentIndex;l[f]=l[f]||[];for(var m=0;m<=g;m++)l[f][g]=l[f][g]||{};l[f][g].boundaryGap="bar"===i}}};o.each(s,function(t){o.indexOf(t,i)>=0&&o.each(t,function(t){n.setIconStatus(t,"normal")})}),n.setIconStatus(i,"emphasis"),t.eachComponent({mainType:"series",query:null==a?null:{seriesIndex:a}},u),e.dispatchAction({type:"changeMagicType",currentType:i,newOption:l})}};var l=i(2);l.registerAction({type:"changeMagicType",event:"magicTypeChanged",update:"prepareAndUpdate"},function(t,e){e.mergeOption(t.newOption)}),i(28).register("magicType",n),t.exports=n},function(t,e,i){"use strict";function n(t){this.model=t}var o=i(127);n.defaultOption={show:!0,icon:"M3.8,33.4 M47,18.9h9.8V8.7 M56.3,20.1 C52.1,9,40.5,0.6,26.8,2.1C12.6,3.7,1.6,16.2,2.1,30.6 M13,41.1H3.1v10.2 M3.7,39.9c4.2,11.1,15.8,19.5,29.5,18 c14.2-1.6,25.2-14.1,24.7-28.5",title:"还原"};var a=n.prototype;a.onclick=function(t,e,i){o.clear(t),e.dispatchAction({type:"restore",from:this.uid})},i(28).register("restore",n),i(2).registerAction({type:"restore",event:"restore",update:"prepareAndUpdate"},function(t,e){e.resetOption("recreate")}),t.exports=n},function(t,e,i){function n(t){this.model=t}var o=i(9);n.defaultOption={show:!0,icon:"M4.7,22.9L29.3,45.5L54.7,23.4M4.6,43.6L4.6,58L53.8,58L53.8,43.6M29.2,45.1L29.2,0",title:"保存为图片",type:"png",name:"",excludeComponents:["toolbox"],pixelRatio:1,lang:["右键另存为图片"]},n.prototype.unusable=!o.canvasSupported;var a=n.prototype;a.onclick=function(t,e){var i=this.model,n=i.get("name")||t.get("title.0.text")||"echarts",a=document.createElement("a"),r=i.get("type",!0)||"png";a.download=n+"."+r,a.target="_blank";var s=e.getConnectedDataURL({type:r,backgroundColor:i.get("backgroundColor",!0)||t.get("backgroundColor")||"#fff",excludeComponents:i.get("excludeComponents"),pixelRatio:i.get("pixelRatio")});if(a.href=s,"function"!=typeof MouseEvent||o.browser.ie||o.browser.edge){var l=i.get("lang"),u='',h=window.open();h.document.write(u)}else{var c=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!1});a.dispatchEvent(c)}},i(28).register("saveAsImage",n),t.exports=n},function(t,e,i){i(45),i(231),i(232),i(2).registerAction({type:"showTip",event:"showTip",update:"tooltip:manuallyShowTip"},function(){}),i(2).registerAction({type:"hideTip",event:"hideTip", +update:"tooltip:manuallyHideTip"},function(){})},function(t,e,i){function n(t){var e="cubic-bezier(0.23, 1, 0.32, 1)",i="left "+t+"s "+e+",top "+t+"s "+e;return s.map(p,function(t){return t+"transition:"+i}).join(";")}function o(t){var e=[],i=t.get("fontSize"),n=t.getTextColor();return n&&e.push("color:"+n),e.push("font:"+t.getFont()),i&&e.push("line-height:"+Math.round(3*i/2)+"px"),c(["decoration","align"],function(i){var n=t.get(i);n&&e.push("text-"+i+":"+n)}),e.join(";")}function a(t){var e=[],i=t.get("transitionDuration"),a=t.get("backgroundColor"),r=t.getModel("textStyle"),s=t.get("padding");return i&&e.push(n(i)),a&&(f.canvasSupported?e.push("background-Color:"+a):(e.push("background-Color:#"+l.toHex(a)),e.push("filter:alpha(opacity=70)"))),c(["width","color","radius"],function(i){var n="border-"+i,o=d(n),a=t.get(o);null!=a&&e.push(n+":"+a+("color"===i?"":"px"))}),e.push(o(r)),null!=s&&e.push("padding:"+h.normalizeCssArray(s).join("px ")+"px"),e.join(";")+";"}function r(t,e){var i=document.createElement("div"),n=this._zr=e.getZr();this.el=i,this._x=e.getWidth()/2,this._y=e.getHeight()/2,t.appendChild(i),this._container=t,this._show=!1,this._hideTimeout;var o=this;i.onmouseenter=function(){o._enterable&&(clearTimeout(o._hideTimeout),o._show=!0),o._inContent=!0},i.onmousemove=function(e){if(e=e||window.event,!o._enterable){var i=n.handler;u.normalizeEvent(t,e,!0),i.dispatch("mousemove",e)}},i.onmouseleave=function(){o._enterable&&o._show&&o.hideLater(o._hideDelay),o._inContent=!1}}var s=i(1),l=i(22),u=i(20),h=i(7),c=s.each,d=h.toCamelCase,f=i(9),p=["","-webkit-","-moz-","-o-"],g="position:absolute;display:block;border-style:solid;white-space:nowrap;z-index:9999999;";r.prototype={constructor:r,_enterable:!0,update:function(){var t=this._container,e=t.currentStyle||document.defaultView.getComputedStyle(t),i=t.style;"absolute"!==i.position&&"absolute"!==e.position&&(i.position="relative")},show:function(t){clearTimeout(this._hideTimeout);var e=this.el;e.style.cssText=g+a(t)+";left:"+this._x+"px;top:"+this._y+"px;"+(t.get("extraCssText")||""),e.style.display=e.innerHTML?"block":"none",this._show=!0},setContent:function(t){this.el.innerHTML=t},setEnterable:function(t){this._enterable=t},getSize:function(){var t=this.el;return[t.clientWidth,t.clientHeight]},moveTo:function(t,e){var i,n=this._zr;n&&n.painter&&(i=n.painter.getViewportRoot())&&(t+=i.offsetLeft||0,e+=i.offsetTop||0);var o=this.el.style;o.left=t+"px",o.top=e+"px",this._x=t,this._y=e},hide:function(){this.el.style.display="none",this._show=!1},hideLater:function(t){!this._show||this._inContent&&this._enterable||(t?(this._hideDelay=t,this._show=!1,this._hideTimeout=setTimeout(s.bind(this.hide,this),t)):this.hide())},isShow:function(){return this._show}},t.exports=r},function(t,e,i){i(2).extendComponentModel({type:"tooltip",dependencies:["axisPointer"],defaultOption:{zlevel:0,z:8,show:!0,showContent:!0,trigger:"item",triggerOn:"mousemove|click",alwaysShowContent:!1,displayMode:"single",confine:!1,showDelay:0,hideDelay:100,transitionDuration:.4,enterable:!1,backgroundColor:"rgba(50,50,50,0.7)",borderColor:"#333",borderRadius:4,borderWidth:0,padding:5,extraCssText:"",axisPointer:{type:"line",axis:"auto",animation:"auto",animationDurationUpdate:200,animationEasingUpdate:"exponentialOut",crossStyle:{color:"#999",width:1,type:"dashed",textStyle:{}}},textStyle:{color:"#fff",fontSize:14}}})},function(t,e,i){function n(t){for(var e=t.pop();t.length;){var i=t.pop();i&&(i instanceof m&&(i=i.get("tooltip",!0)),"string"==typeof i&&(i={formatter:i}),e=new m(i,e,e.ecModel))}return e}function o(t,e){return t.dispatchAction||h.bind(e.dispatchAction,e)}function a(t,e,i,n,o,a,r){var s=i.clientWidth,l=i.clientHeight;return t+s+a>n?t-=s+a:t+=a,e+l+r>o?e-=l+r:e+=r,[t,e]}function r(t,e,i,n,o){var a=i.clientWidth,r=i.clientHeight;return t=Math.min(t+a,n)-a,e=Math.min(e+r,o)-r,t=Math.max(t,0),e=Math.max(e,0),[t,e]}function s(t,e,i){var n=i[0],o=i[1],a=5,r=0,s=0,l=e.width,u=e.height;switch(t){case"inside":r=e.x+l/2-n/2,s=e.y+u/2-o/2;break;case"top":r=e.x+l/2-n/2,s=e.y-o-a;break;case"bottom":r=e.x+l/2-n/2,s=e.y+u+a;break;case"left":r=e.x-n-a,s=e.y+u/2-o/2;break;case"right":r=e.x+l+a,s=e.y+u/2-o/2}return[r,s]}function l(t){return"center"===t||"middle"===t}var u=i(230),h=i(1),c=i(7),d=i(4),f=i(75),p=i(12),g=i(9),m=i(10),v=i(76),y=i(17),x=i(55),_=h.bind,b=h.each,w=d.parsePercent;i(2).extendComponentView({type:"tooltip",init:function(t,e){if(!g.node){var i=new u(e.getDom(),e);this._tooltipContent=i}},render:function(t,e,i){if(!g.node){this.group.removeAll(),this._tooltipModel=t,this._ecModel=e,this._api=i,this._lastDataByCoordSys,this._alwaysShowContent=t.get("alwaysShowContent");var n=this._tooltipContent;n.update(),n.setEnterable(t.get("enterable")),this._initGlobalListener(),this._keepShow()}},_initGlobalListener:function(){var t=this._tooltipModel,e=t.get("triggerOn");v.register("itemTooltip",this._api,_(function(t,i,n){"none"!==e&&(e.indexOf(t)>=0?this._tryShow(i,n):"leave"===t&&this._hide(n))},this))},_keepShow:function(){var t=this._tooltipModel,e=this._ecModel,i=this._api;if(null!=this._lastX&&null!=this._lastY&&"none"!==t.get("triggerOn")){var n=this;clearTimeout(this._refreshUpdateTimeout),this._refreshUpdateTimeout=setTimeout(function(){n.manuallyShowTip(t,e,i,{x:n._lastX,y:n._lastY})})}},manuallyShowTip:function(t,e,i,n){if(n.from!==this.uid&&!g.node){var a=o(n,i);this._ticket="";var r=n.seriesIndex,s=n.dataByCoordSys;if(s)this._tryShow({offsetX:n.x,offsetY:n.y,position:n.position,event:{},dataByCoordSys:n.dataByCoordSys,tooltipOption:n.tooltipOption},a);else if(null!=r){var l=f(n,e),u=l.point[0],h=l.point[1];null!=u&&null!=h&&this._tryShow({offsetX:u,offsetY:h,position:n.position,target:l.el,event:{}},a)}else null!=n.x&&null!=n.y&&this._tryShow({offsetX:n.x,offsetY:n.y,position:n.position,target:i.getZr().handler.findHover(n.x,n.y),event:{}},a)}},manuallyHideTip:function(t,e,i,n){var a=this._tooltipContent;this._alwaysShowContent||a.hideLater(this._tooltipModel.get("hideDelay")),this._lastX=this._lastY=null,n.from!==this.uid&&this._hide(o(n,i))},_tryShow:function(t,e){var i=t.target,n=this._tooltipModel;if(n){this._lastX=t.offsetX,this._lastY=t.offsetY;var o=t.dataByCoordSys;o&&o.length?this._showAxisTooltip(o,t):i&&null!=i.dataIndex?(this._lastDataByCoordSys=null,this._showSeriesItemTooltip(t,i,e)):i&&i.tooltip?(this._lastDataByCoordSys=null,this._showComponentItemTooltip(t,i,e)):(this._lastDataByCoordSys=null,this._hide(e))}},_showOrMove:function(t,e){var i=t.get("showDelay");e=h.bind(e,this),clearTimeout(this._showTimout),i>0?this._showTimout=setTimeout(e,i):e()},_showAxisTooltip:function(t,e){var i=this._ecModel,o=this._tooltipModel,a=[e.offsetX,e.offsetY],r=[],s=[],l=n([e.tooltipOption,o]);b(t,function(t){b(t.dataByAxis,function(t){var e=i.getComponent(t.axisDim+"Axis",t.axisIndex),n=t.value,o=[];if(e&&null!=n){var a=x.getValueLabel(n,e.axis,i,t.seriesDataIndices,t.valueLabelOpt);h.each(t.seriesDataIndices,function(r){var l=i.getSeriesByIndex(r.seriesIndex),u=r.dataIndexInside,h=l&&l.getDataParams(u);h.axisDim=t.axisDim,h.axisIndex=t.axisIndex,h.axisType=t.axisType,h.axisId=t.axisId,h.axisValue=y.getAxisRawValue(e.axis,n),h.axisValueLabel=a,h&&(s.push(h),o.push(l.formatTooltip(u,!0)))});var l=a;r.push((l?c.encodeHTML(l)+"
":"")+o.join("
"))}})},this),r.reverse(),r=r.join("

");var u=e.position;this._showOrMove(l,function(){this._updateContentNotChangedOnAxis(t)?this._updatePosition(l,u,a[0],a[1],this._tooltipContent,s):this._showTooltipContent(l,r,s,Math.random(),a[0],a[1],u)})},_showSeriesItemTooltip:function(t,e,i){var o=this._ecModel,a=e.seriesIndex,r=o.getSeriesByIndex(a),s=e.dataModel||r,l=e.dataIndex,u=e.dataType,h=s.getData(),c=n([h.getItemModel(l),s,r&&(r.coordinateSystem||{}).model,this._tooltipModel]),d=c.get("trigger");if(null==d||"item"===d){var f=s.getDataParams(l,u),p=s.formatTooltip(l,!1,u),g="item_"+s.name+"_"+l;this._showOrMove(c,function(){this._showTooltipContent(c,p,f,g,t.offsetX,t.offsetY,t.position,t.target)}),i({type:"showTip",dataIndexInside:l,dataIndex:h.getRawIndex(l),seriesIndex:a,from:this.uid})}},_showComponentItemTooltip:function(t,e,i){var n=e.tooltip;if("string"==typeof n){var o=n;n={content:o,formatter:o}}var a=new m(n,this._tooltipModel,this._ecModel),r=a.get("content"),s=Math.random();this._showOrMove(a,function(){this._showTooltipContent(a,r,a.get("formatterParams")||{},s,t.offsetX,t.offsetY,t.position,e)}),i({type:"showTip",from:this.uid})},_showTooltipContent:function(t,e,i,n,o,a,r,s){if(this._ticket="",t.get("showContent")&&t.get("show")){var l=this._tooltipContent,u=t.get("formatter");r=r||t.get("position");var h=e;if(u&&"string"==typeof u)h=c.formatTpl(u,i,!0);else if("function"==typeof u){var d=_(function(e,n){e===this._ticket&&(l.setContent(n),this._updatePosition(t,r,o,a,l,i,s))},this);this._ticket=n,h=u(i,n,d)}l.setContent(h),l.show(t),this._updatePosition(t,r,o,a,l,i,s)}},_updatePosition:function(t,e,i,n,o,u,c){var d=this._api.getWidth(),f=this._api.getHeight();e=e||t.get("position");var g=o.getSize(),m=t.get("align"),v=t.get("verticalAlign"),y=c&&c.getBoundingRect().clone();if(c&&y.applyTransform(c.transform),"function"==typeof e&&(e=e([i,n],u,o.el,y,{viewSize:[d,f],contentSize:g.slice()})),h.isArray(e))i=w(e[0],d),n=w(e[1],f);else if(h.isObject(e)){e.width=g[0],e.height=g[1];var x=p.getLayoutRect(e,{width:d,height:f});i=x.x,n=x.y,m=null,v=null}else if("string"==typeof e&&c){var _=s(e,y,g);i=_[0],n=_[1]}else{var _=a(i,n,o.el,d,f,m?0:20,v?0:20);i=_[0],n=_[1]}if(m&&(i-=l(m)?g[0]/2:"right"===m?g[0]:0),v&&(n-=l(v)?g[1]/2:"bottom"===v?g[1]:0),t.get("confine")){var _=r(i,n,o.el,d,f);i=_[0],n=_[1]}o.moveTo(i,n)},_updateContentNotChangedOnAxis:function(t){var e=this._lastDataByCoordSys,i=!!e&&e.length===t.length;return b(e,function(e,n){var o=e.dataByAxis||{},a=t[n]||{},r=a.dataByAxis||[];i&=o.length===r.length,b(o,function(t,e){var n=r[e]||{},o=t.seriesDataIndices||[],a=n.seriesDataIndices||[];i&=t.value===n.value&&t.axisType===n.axisType&&t.axisId===n.axisId&&o.length===a.length,b(o,function(t,e){var n=a[e];i&=t.seriesIndex===n.seriesIndex&&t.dataIndex===n.dataIndex})})}),this._lastDataByCoordSys=t,!!i},_hide:function(t){this._lastDataByCoordSys=null,t({type:"hideTip",from:this.uid})},dispose:function(t,e){g.node||(this._tooltipContent.hide(),v.unregister("itemTooltip",e))}})},function(t,e,i){function n(t,e){var i=t.get("center"),n=t.get("radius"),o=e.getWidth(),a=e.getHeight(),r=s.parsePercent;this.cx=r(i[0],o),this.cy=r(i[1],a);var l=this.getRadiusAxis(),u=Math.min(o,a)/2;l.setExtent(0,r(n,u))}function o(t,e){var i=this,n=i.getAngleAxis(),o=i.getRadiusAxis();if(n.scale.setExtent(1/0,-(1/0)),o.scale.setExtent(1/0,-(1/0)),t.eachSeries(function(t){if(t.coordinateSystem===i){var e=t.getData();o.scale.unionExtentFromData(e,"radius"),n.scale.unionExtentFromData(e,"angle")}}),u(n.scale,n.model),u(o.scale,o.model),"category"===n.type&&!n.onBand){var a=n.getExtent(),r=360/n.scale.count();n.inverse?a[1]+=r:a[1]-=r,n.setExtent(a[0],a[1])}}function a(t,e){if(t.type=e.get("type"),t.scale=l.createScaleByModel(e),t.onBand=e.get("boundaryGap")&&"category"===t.type,"angleAxis"===e.mainType){var i=e.get("startAngle");t.inverse=e.get("inverse")^e.get("clockwise"),t.setExtent(i,i+(t.inverse?-360:360))}e.axis=t,t.model=e}var r=i(403),s=i(4),l=(i(1),i(17)),u=l.niceScaleExtent;i(404);var h={dimensions:r.prototype.dimensions,create:function(t,e){var i=[];return t.eachComponent("polar",function(t,s){var l=new r(s);l.resize=n,l.update=o;var u=l.getRadiusAxis(),h=l.getAngleAxis(),c=t.findAxisModel("radiusAxis"),d=t.findAxisModel("angleAxis");a(u,c),a(h,d),l.resize(t,e),i.push(l),t.coordinateSystem=l,l.model=t}),t.eachSeries(function(e){if("polar"===e.get("coordinateSystem")){var i=t.queryComponents({mainType:"polar",index:e.get("polarIndex"),id:e.get("polarId")})[0];e.coordinateSystem=i.coordinateSystem}}),i}};i(26).register("polar",h)},function(t,e,i){function n(t){return parseInt(t,10)}function o(t,e){s.initVML(),this.root=t,this.storage=e;var i=document.createElement("div"),n=document.createElement("div");i.style.cssText="display:inline-block;overflow:hidden;position:relative;width:300px;height:150px;",n.style.cssText="position:absolute;left:0;top:0;",t.appendChild(i),this._vmlRoot=n,this._vmlViewport=i,this.resize();var o=e.delFromMap,a=e.addToMap;e.delFromMap=function(t){var i=e.get(t);o.call(e,t),i&&i.onRemove&&i.onRemove(n)},e.addToMap=function(t){t.onAdd&&t.onAdd(n),a.call(e,t)},this._firstPaint=!0}function a(t){return function(){r('In IE8.0 VML mode painter not support method "'+t+'"')}}var r=i(52),s=i(184);o.prototype={constructor:o,getViewportRoot:function(){return this._vmlViewport},refresh:function(){var t=this.storage.getDisplayList(!0,!0);this._paintList(t)},_paintList:function(t){for(var e=this._vmlRoot,i=0;i=0?parseFloat(t)/100*e:parseFloat(t):t},R=function(t,e,i){var n=r.parse(e);i=+i,isNaN(i)&&(i=1),n&&(t.color=D(n[0],n[1],n[2]),t.opacity=i*n[3])},E=function(t){var e=r.parse(t);return[D(e[0],e[1],e[2]),e[3]]},N=function(t,e,i){var n=e.fill;if(null!=n)if(n instanceof f){var o,a=0,r=[0,0],s=0,l=1,u=i.getBoundingRect(),h=u.width,c=u.height;if("linear"===n.type){o="gradient";var d=i.transform,p=[n.x*h,n.y*c],g=[n.x2*h,n.y2*c];d&&(b(p,p,d),b(g,g,d));var m=g[0]-p[0],v=g[1]-p[1];a=180*Math.atan2(m,v)/Math.PI,a<0&&(a+=360),a<1e-6&&(a=0)}else{o="gradientradial";var p=[n.x*h,n.y*c],d=i.transform,y=i.scale,x=h,w=c;r=[(p[0]-u.x)/x,(p[1]-u.y)/w],d&&b(p,p,d),x/=y[0]*M,w/=y[1]*M;var S=_(x,w);s=0/S,l=2*n.r/S-s}var I=n.colorStops.slice();I.sort(function(t,e){return t.offset-e.offset});for(var T=I.length,A=[],L=[],C=0;C=2){var k=A[0][0],O=A[1][0],z=A[0][1]*e.opacity,N=A[1][1]*e.opacity;t.type=o,t.method="none",t.focus="100%",t.angle=a,t.color=k,t.color2=O,t.colors=L.join(","),t.opacity=N,t.opacity2=z}"radial"===o&&(t.focusposition=r.join(","))}else R(t,n,e.opacity)},V=function(t,e){null!=e.lineDash&&(t.dashstyle=e.lineDash.join(" ")),null==e.stroke||e.stroke instanceof f||R(t,e.stroke,e.opacity)},B=function(t,e,i,n){var o="fill"==e,a=t.getElementsByTagName(e)[0];null!=i[e]&&"none"!==i[e]&&(o||!o&&i.lineWidth)?(t[o?"filled":"stroked"]="true",i[e]instanceof f&&k(t,a),a||(a=p.createNode(e)),o?N(a,i,n):V(a,i),P(t,a)):(t[o?"filled":"stroked"]="false",k(t,a))},G=[[],[],[]],F=function(t,e){var i,n,o,r,s,l,u=a.M,h=a.C,c=a.L,d=a.A,f=a.Q,p=[];for(r=0;r.01?F&&(H+=270/M):Math.abs(W-R)<1e-4?F&&Hz?T-=270/M:T+=270/M:F&&WR?S+=270/M:S-=270/M),p.push(Z,g(((z-E)*P+C)*M-I),w,g(((R-N)*k+D)*M-I),w,g(((z+E)*P+C)*M-I),w,g(((R+N)*k+D)*M-I),w,g((H*P+C)*M-I),w,g((W*k+D)*M-I),w,g((S*P+C)*M-I),w,g((T*k+D)*M-I)),s=S,l=T;break;case a.R:var q=G[0],j=G[1];q[0]=t[r++],q[1]=t[r++],j[0]=q[0]+t[r++],j[1]=q[1]+t[r++],e&&(b(q,q,e),b(j,j,e)),q[0]=g(q[0]*M-I),j[0]=g(j[0]*M-I),q[1]=g(q[1]*M-I),j[1]=g(j[1]*M-I),p.push(" m ",q[0],w,q[1]," l ",j[0],w,q[1]," l ",j[0],w,j[1]," l ",q[0],w,j[1]);break;case a.Z:p.push(" x ")}if(i>0){p.push(n);for(var U=0;UU&&(j=0,q={});var i,n=X.style;try{n.font=t,i=n.fontFamily.split(",")[0]}catch(o){}e={style:n.fontStyle||Z,variant:n.fontVariant||Z,weight:n.fontWeight||Z,size:0|parseFloat(n.fontSize||12),family:i||"Microsoft YaHei"},q[t]=e,j++}return e};s.measureText=function(t,e){var i=p.doc;W||(W=i.createElement("div"),W.style.cssText="position:absolute;top:-20000px;left:0;padding:0;margin:0;border:none;white-space:pre;",p.doc.body.appendChild(W));try{W.style.font=e}catch(n){}return W.innerHTML="",W.appendChild(i.createTextNode(t)),{width:W.offsetWidth}};for(var $=new o,K=function(t,e,i,n){var o=this.style,a=o.text;if(null!=a&&(a+=""),a){var r,l,u=o.textAlign,h=Y(o.textFont),c=h.style+" "+h.variant+" "+h.weight+" "+h.size+'px "'+h.family+'"',d=o.textBaseline,f=o.textVerticalAlign;i=i||s.getBoundingRect(a,c,u,d);var m=this.transform;if(m&&!n&&($.copy(e),$.applyTransform(m),e=$),n)r=e.x,l=e.y;else{var v=o.textPosition,y=o.textDistance;if(v instanceof Array)r=e.x+z(v[0],e.width),l=e.y+z(v[1],e.height),u=u||"left",d=d||"top";else{var x=s.adjustTextPositionOnRect(v,e,i,y);r=x.x,l=x.y,u=u||x.textAlign,d=d||x.textBaseline}}if(f){switch(f){case"middle":l-=i.height/2;break;case"bottom":l-=i.height}d="top"}var _=h.size;switch(d){case"hanging":case"top":l+=_/1.75;break;case"middle":break;default:l-=_/2.25}switch(u){case"left":break;case"center":r-=i.width/2;break;case"right":r-=i.width}var S,M,I,T=p.createNode,A=this._textVmlEl;A?(I=A.firstChild,S=I.nextSibling,M=S.nextSibling):(A=T("line"),S=T("path"),M=T("textpath"),I=T("skew"),M.style["v-text-align"]="left",L(A),S.textpathok=!0,M.on=!0,A.from="0 0",A.to="1000 0.05",P(A,I),P(A,S),P(A,M),this._textVmlEl=A);var D=[r,l],k=A.style;m&&n?(b(D,D,m),I.on=!0,I.matrix=m[0].toFixed(3)+w+m[2].toFixed(3)+w+m[1].toFixed(3)+w+m[3].toFixed(3)+",0,0",I.offset=(g(D[0])||0)+","+(g(D[1])||0),I.origin="0 0",k.left="0px",k.top="0px"):(I.on=!1,k.left=g(r)+"px",k.top=g(l)+"px"),M.string=C(a);try{M.style.font=c}catch(R){}B(A,"fill",{fill:n?o.fill:o.textFill,opacity:o.opacity},this),B(A,"stroke",{stroke:n?o.stroke:o.textStroke,opacity:o.opacity,lineDash:o.lineDash},this),A.style.zIndex=O(this.zlevel,this.z,this.z2),P(t,A)}},J=function(t){k(t,this._textVmlEl),this._textVmlEl=null},Q=function(t){P(t,this._textVmlEl)},tt=[l,u,h,d,c],et=0;et0&&(s=this.getLineLength(n)/u*1e3),s!==this._period||l!==this._loop){n.stopAnimation();var d=h;c&&(d=h(i)),n.__t>0&&(d=-s*n.__t),n.__t=0;var f=n.animate("",l).when(s,{__t:1}).delay(d).during(function(){o.updateSymbolPosition(n)});l||f.done(function(){o.remove(n)}),f.start()}this._period=s,this._loop=l}},h.getLineLength=function(t){return l.dist(t.__p1,t.__cp1)+l.dist(t.__cp1,t.__p2)},h.updateAnimationPoints=function(t,e){t.__p1=e[0],t.__p2=e[1],t.__cp1=e[2]||[(e[0][0]+e[1][0])/2,(e[0][1]+e[1][1])/2]},h.updateData=function(t,e,i){this.childAt(0).updateData(t,e,i),this._updateEffectSymbol(t,e)},h.updateSymbolPosition=function(t){var e=t.__p1,i=t.__p2,n=t.__cp1,o=t.__t,a=t.position,r=u.quadraticAt,s=u.quadraticDerivativeAt;a[0]=r(e[0],n[0],i[0],o),a[1]=r(e[1],n[1],i[1],o);var l=s(e[0],n[0],i[0],o),h=s(e[1],n[1],i[1],o);t.rotation=-Math.atan2(h,l)-Math.PI/2,t.ignore=!1},h.updateLayout=function(t,e){this.childAt(0).updateLayout(t,e);var i=t.getItemModel(e).getModel("effect");this._updateEffectAnimation(t,i,e)},r.inherits(n,o.Group),t.exports=n},function(t,e,i){function n(t,e,i){o.Group.call(this),this._createPolyline(t,e,i)}var o=i(3),a=i(1),r=n.prototype;r._createPolyline=function(t,e,i){var n=t.getItemLayout(e),a=new o.Polyline({shape:{points:n}});this.add(a),this._updateCommonStl(t,e,i)},r.updateData=function(t,e,i){var n=t.hostModel,a=this.childAt(0),r={shape:{points:t.getItemLayout(e)}};o.updateProps(a,r,n,e),this._updateCommonStl(t,e,i)},r._updateCommonStl=function(t,e,i){var n=this.childAt(0),r=t.getItemModel(e),s=t.getItemVisual(e,"color"),l=i&&i.lineStyle,u=i&&i.hoverLineStyle;i&&!t.hasItemOption||(l=r.getModel("lineStyle.normal").getLineStyle(),u=r.getModel("lineStyle.emphasis").getLineStyle()),n.useStyle(a.defaults({strokeNoScale:!0,fill:"none",stroke:s},l)),n.hoverStyle=u,o.setHoverStyle(this)},r.updateLayout=function(t,e){var i=this.childAt(0);i.setShape("points",t.getItemLayout(e))},a.inherits(n,o.Group),t.exports=n},function(t,e,i){var n=i(14),o=i(413),a=i(261),r=i(25),s=i(26),l=i(1),u=i(27);t.exports=function(t,e,i,h,c){for(var d=new o(h),f=0;f "+x)),m++)}var _,b=i.get("coordinateSystem");if("cartesian2d"===b||"polar"===b)_=u(t,i,i.ecModel);else{var w=s.get(b),S=r((w&&"view"!==w.type?w.dimensions||[]:[]).concat(["value"]),t);_=new n(S,i),_.initData(t)}var M=new n(["value"],i);return M.initData(g,p),c&&c(_,M),a({mainData:_,struct:d,structAttr:"graph",datas:{node:_,edge:M},datasAttr:{node:"data",edge:"edgeData"}}),d.update(),d}},function(t,e,i){var n=i(1),o={};o.layout=function(t,e){e=e||{};var i=t.coordinateSystem,o=t.axis,a={},r=o.position,s=o.orient,l=i.getRect(),u=[l.x,l.x+l.width,l.y,l.y+l.height],h={horizontal:{top:u[2],bottom:u[3]},vertical:{left:u[0],right:u[1]}};a.position=["vertical"===s?h.vertical[r]:u[0],"horizontal"===s?h.horizontal[r]:u[3]];var c={horizontal:0,vertical:1};a.rotation=Math.PI/2*c[s];var d={top:-1,bottom:1,right:1,left:-1};a.labelDirection=a.tickDirection=a.nameDirection=d[r],t.get("axisTick.inside")&&(a.tickDirection=-a.tickDirection),n.retrieve(e.labelInside,t.get("axisLabel.inside"))&&(a.labelDirection=-a.labelDirection);var f=e.rotate;return null==f&&(f=t.get("axisLabel.rotate")),a.labelRotation="top"===r?-f:f,a.labelInterval=o.getLabelInterval(),a.z2=1,a},t.exports=o},function(t,e,i){"use strict";function n(t,e,i,n,o){var a=e.axis,s=a.dataToCoord(t),h=n.getAngleAxis().getExtent()[0];h=h/180*Math.PI;var c,d,f,p=n.getRadiusAxis().getExtent();if("radius"===a.dim){var g=l.create();l.rotate(g,g,h),l.translate(g,g,[n.cx,n.cy]),c=r.applyTransform([s,-o],g);var m=e.getModel("axisLabel").get("rotate")||0,v=u.innerTextLayout(h,m*Math.PI/180,-1);d=v.textAlign,f=v.textVerticalAlign}else{var y=p[1];c=n.coordToPoint([y+o,s]);var x=n.cx,_=n.cy;d=Math.abs(c[0]-x)/y<.3?"center":c[0]>x?"left":"right",f=Math.abs(c[1]-_)/y<.3?"middle":c[1]>_?"top":"bottom"}return{position:c,align:d,verticalAlign:f}}var o=i(7),a=i(74),r=i(3),s=i(55),l=i(19),u=i(37),h=a.extend({makeElOption:function(t,e,i,a,r){var l=i.axis;"angle"===l.dim&&(this.animationThreshold=Math.PI/18);var u,h=l.polar,d=h.getOtherAxis(l),f=d.getExtent();u=l["dataTo"+o.capitalFirst(l.dim)](e);var p=s.buildElStyle(a),g=c[a.get("type")](l,h,u,f,p);g.style=p,t.graphicKey=g.type,t.pointer=g;var m=a.get("label.margin"),v=n(e,i,a,h,m);s.buildLabelElOption(t,i,a,r,v)}}),c={line:function(t,e,i,n,o){return"angle"===t.dim?{type:"Line",shape:s.makeLineShape(e.coordToPoint([n[0],i]),e.coordToPoint([n[1],i]))}:{type:"Circle",shape:{cx:e.cx,cy:e.cy,r:i}}},shadow:function(t,e,i,n,o){var a=t.getBandWidth(),r=Math.PI/180;return"angle"===t.dim?{type:"Sector",shape:s.makeSectorShape(e.cx,e.cy,n[0],n[1],(-i-a/2)*r,(-i+a/2)*r)}:{type:"Sector",shape:s.makeSectorShape(e.cx,e.cy,i-a/2,i+a/2,0,2*Math.PI) +}}};t.exports=h},function(t,e,i){function n(t,e){var i=t.getItemStyle(),n=t.get("areaColor");return null!=n&&(i.fill=n),i}function o(t,e,i,n,o){i.off("click"),i.off("mousedown"),e.get("selectedMode")&&(i.on("mousedown",function(){t._mouseDownFlag=!0}),i.on("click",function(r){if(t._mouseDownFlag){t._mouseDownFlag=!1;for(var s=r.target;!s.__regions;)s=s.parent;if(s){var l={type:("geo"===e.mainType?"geo":"map")+"ToggleSelect",batch:u.map(s.__regions,function(t){return{name:t.name,from:o.uid}})};l[e.mainType+"Id"]=e.id,n.dispatchAction(l),a(e,i)}}}))}function a(t,e){e.eachChild(function(e){u.each(e.__regions,function(i){e.trigger(t.isSelected(i.name)?"emphasis":"normal")})})}function r(t,e){var i=new l.Group;this._controller=new s(t.getZr(),e?i:null,null),this.group=i,this._updateGroup=e,this._mouseDownFlag}var s=i(94),l=i(3),u=i(1);r.prototype={constructor:r,draw:function(t,e,i,r,s){var h="geo"===t.mainType,c=t.getData&&t.getData();h&&e.eachComponent({mainType:"series",subType:"map"},function(e){c||e.getHostGeoModel()!==t||(c=e.getData())});var d=t.coordinateSystem,f=this.group,p=d.scale,g={position:d.position,scale:p};!f.childAt(0)||s?f.attr(g):l.updateProps(f,g,t),f.removeAll();var m=["itemStyle","normal"],v=["itemStyle","emphasis"],y=["label","normal"],x=["label","emphasis"],_={};u.each(d.regions,function(e){var i=_[e.name]||(_[e.name]=new l.Group),o=new l.CompoundPath({shape:{paths:[]}});i.add(o);var a,r=t.getRegionModel(e.name)||t,s=r.getModel(m),d=r.getModel(v),g=n(s,p),b=n(d,p),w=r.getModel(y),S=r.getModel(x);if(c){a=c.indexOfName(e.name);var M=c.getItemVisual(a,"color",!0);M&&(g.fill=M)}var I=w.getModel("textStyle"),T=S.getModel("textStyle");u.each(e.geometries,function(t){if("polygon"===t.type){o.shape.paths.push(new l.Polygon({shape:{points:t.exterior}}));for(var e=0;e<(t.interiors?t.interiors.length:0);e++)o.shape.paths.push(new l.Polygon({shape:{points:t.interiors[e]}}))}}),o.setStyle(g),o.style.strokeNoScale=!0,o.culling=!0;var A=w.get("show"),L=S.get("show"),C=c&&isNaN(c.get("value",a)),D=c&&c.getItemLayout(a);if(h||C&&(A||L)||D&&D.showLabel){var P=c?a:e.name,k=t.getFormattedLabel(P,"normal"),O=t.getFormattedLabel(P,"emphasis"),z=new l.Text({style:{text:A?k||e.name:"",fill:I.getTextColor(),textFont:I.getFont(),textAlign:"center",textVerticalAlign:"middle"},hoverStyle:{text:L?O||e.name:"",fill:T.getTextColor(),textFont:T.getFont()},position:e.center.slice(),scale:[1/p[0],1/p[1]],z2:10,silent:!0});i.add(z)}if(c)c.setItemGraphicEl(a,i);else{var r=t.getRegionModel(e.name);o.eventData={componentType:"geo",geoIndex:t.componentIndex,name:e.name,region:r&&r.option||{}}}var R=i.__regions||(i.__regions=[]);R.push(e),l.setHoverStyle(i,b,{hoverSilentOnTouch:!!t.get("selectedMode")}),f.add(i)}),this._updateController(t,e,i),o(this,t,f,i,r),a(t,f)},remove:function(){this.group.removeAll(),this._controller.dispose()},_updateController:function(t,e,i){function n(){var e={type:"geoRoam",componentType:r};return e[r+"Id"]=t.id,e}var o=t.coordinateSystem,a=this._controller;a.zoomLimit=t.get("scaleLimit"),a.zoom=o.getZoom(),a.enable(t.get("roam")||!1);var r=t.mainType;a.off("pan").on("pan",function(t,e){this._mouseDownFlag=!1,i.dispatchAction(u.extend(n(),{dx:t,dy:e}))},this),a.off("zoom").on("zoom",function(t,e,o){if(this._mouseDownFlag=!1,i.dispatchAction(u.extend(n(),{zoom:t,originX:e,originY:o})),this._updateGroup){var a=this.group,r=a.scale;a.traverse(function(t){"text"===t.type&&t.attr("scale",[1/r[0],1/r[1]])})}},this),a.setContainsPoint(function(t,e){return o.getViewRectAfterRoam().contain(t,e)})}},t.exports=r},function(t,e,i){i(260),i(399),i(367);var n=i(2),o=i(1),a=5;n.extendComponentView({type:"parallel",render:function(t,e,i){var n=i.getZr();if(!this.__onMouseDown){var r;n.on("mousedown",this.__onMouseDown=function(t){r=[t.offsetX,t.offsetY]}),n.on("mouseup",this.__onMouseUp=function(e){var n=[e.offsetX,e.offsetY],s=Math.pow(r[0]-n[0],2)+Math.pow(r[1]-n[1],2);if(t.get("axisExpandable")&&!(s>a)){var l=t.coordinateSystem,u=l.findClosestAxisDim(n);if(u){var h=o.indexOf(l.dimensions,u);i.dispatchAction({type:"parallelAxisExpand",axisExpandCenter:h})}}})}},dispose:function(t,e){e.getZr().off(this.__onMouseDown),e.getZr().off(this.__onMouseUp)}}),n.registerPreprocessor(i(400))},function(t,e,i){i(412),i(353),i(409),i(45);var n=i(2);n.extendComponentView({type:"single"})},function(t,e,i){var n=i(2),o=i(1),a=i(9),r=i(263),s=i(82),l=i(188),u=s.mapVisual,h=i(5),c=s.eachVisual,d=i(4),f=o.isArray,p=o.each,g=d.asc,m=d.linearMap,v=o.noop,y=["#f6efa6","#d88273","#bf444c"],x=n.extendComponentModel({type:"visualMap",dependencies:["series"],stateList:["inRange","outOfRange"],replacableOptionKeys:["inRange","outOfRange","target","controller","color"],dataBound:[-(1/0),1/0],layoutMode:{type:"box",ignoreSize:!0},defaultOption:{show:!0,zlevel:0,z:4,seriesIndex:null,min:0,max:200,dimension:null,inRange:null,outOfRange:null,left:0,right:null,top:null,bottom:0,itemWidth:null,itemHeight:null,inverse:!1,orient:"vertical",backgroundColor:"rgba(0,0,0,0)",borderColor:"#ccc",contentColor:"#5793f3",inactiveColor:"#aaa",borderWidth:0,padding:5,textGap:10,precision:0,color:null,formatter:null,text:null,textStyle:{color:"#333"}},init:function(t,e,i){this._dataExtent,this.targetVisuals={},this.controllerVisuals={},this.textStyleModel,this.itemSize,this.mergeDefaultAndTheme(t,i)},optionUpdated:function(t,e){var i=this.option;a.canvasSupported||(i.realtime=!1),!e&&l.replaceVisualOption(i,t,this.replacableOptionKeys),this.textStyleModel=this.getModel("textStyle"),this.resetItemSize(),this.completeVisualOption()},resetVisual:function(t){var e=this.stateList;t=o.bind(t,this),this.controllerVisuals=l.createVisualMappings(this.option.controller,e,t),this.targetVisuals=l.createVisualMappings(this.option.target,e,t)},resetTargetSeries:function(){var t=this.option,e=null==t.seriesIndex;t.seriesIndex=e?[]:h.normalizeToArray(t.seriesIndex),e&&this.ecModel.eachSeries(function(e,i){t.seriesIndex.push(i)})},eachTargetSeries:function(t,e){o.each(this.option.seriesIndex,function(i){t.call(e,this.ecModel.getSeriesByIndex(i))},this)},isTargetSeries:function(t){var e=!1;return this.eachTargetSeries(function(i){i===t&&(e=!0)}),e},formatValueText:function(t,e,i){function n(t){return t===u[0]?"min":t===u[1]?"max":(+t).toFixed(l)}var a,r,s=this.option,l=s.precision,u=this.dataBound,h=s.formatter;return i=i||["<",">"],o.isArray(t)&&(t=t.slice(),a=!0),r=e?t:a?[n(t[0]),n(t[1])]:n(t),o.isString(h)?h.replace("{value}",a?r[0]:r).replace("{value2}",a?r[1]:r):o.isFunction(h)?a?h(t[0],t[1]):h(t):a?t[0]===u[0]?i[0]+" "+r[1]:t[1]===u[1]?i[1]+" "+r[0]:r[0]+" - "+r[1]:r},resetExtent:function(){var t=this.option,e=g([t.min,t.max]);this._dataExtent=e},getDataDimension:function(t){var e=this.option.dimension;return null!=e?e:t.dimensions.length-1},getExtent:function(){return this._dataExtent.slice()},completeVisualOption:function(){function t(t){f(n.color)&&!t.inRange&&(t.inRange={color:n.color.slice().reverse()}),t.inRange=t.inRange||{color:y},p(this.stateList,function(e){var i=t[e];if(o.isString(i)){var n=r.get(i,"active",d);n?(t[e]={},t[e][i]=n):delete t[e]}},this)}function e(t,e,i){var n=t[e],o=t[i];n&&!o&&(o=t[i]={},p(n,function(t,e){if(s.isValidType(e)){var i=r.get(e,"inactive",d);null!=i&&(o[e]=i,"color"!==e||o.hasOwnProperty("opacity")||o.hasOwnProperty("colorAlpha")||(o.opacity=[0,0]))}}))}function i(t){var e=(t.inRange||{}).symbol||(t.outOfRange||{}).symbol,i=(t.inRange||{}).symbolSize||(t.outOfRange||{}).symbolSize,n=this.get("inactiveColor");p(this.stateList,function(a){var r=this.itemSize,s=t[a];s||(s=t[a]={color:d?n:[n]}),null==s.symbol&&(s.symbol=e&&o.clone(e)||(d?"roundRect":["roundRect"])),null==s.symbolSize&&(s.symbolSize=i&&o.clone(i)||(d?r[0]:[r[0],r[0]])),s.symbol=u(s.symbol,function(t){return"none"===t||"square"===t?"roundRect":t});var l=s.symbolSize;if(null!=l){var h=-(1/0);c(l,function(t){t>h&&(h=t)}),s.symbolSize=u(l,function(t){return m(t,[0,h],[0,r[0]],!0)})}},this)}var n=this.option,a={inRange:n.inRange,outOfRange:n.outOfRange},l=n.target||(n.target={}),h=n.controller||(n.controller={});o.merge(l,a),o.merge(h,a);var d=this.isCategory();t.call(this,l),t.call(this,h),e.call(this,l,"inRange","outOfRange"),i.call(this,h)},resetItemSize:function(){this.itemSize=[parseFloat(this.get("itemWidth")),parseFloat(this.get("itemHeight"))]},isCategory:function(){return!!this.option.categories},setSelected:v,getValueState:v,getVisualMeta:v});t.exports=x},function(t,e,i){var n=i(1),o=i(3),a=i(7),r=i(12),s=i(2),l=i(82);t.exports=s.extendComponentView({type:"visualMap",autoPositionValues:{left:1,right:1,top:1,bottom:1},init:function(t,e){this.ecModel=t,this.api=e,this.visualMapModel},render:function(t,e,i,n){return this.visualMapModel=t,t.get("show")===!1?void this.group.removeAll():void this.doRender.apply(this,arguments)},renderBackground:function(t){var e=this.visualMapModel,i=a.normalizeCssArray(e.get("padding")||0),n=t.getBoundingRect();t.add(new o.Rect({z2:-1,silent:!0,shape:{x:n.x-i[3],y:n.y-i[0],width:n.width+i[3]+i[1],height:n.height+i[0]+i[2]},style:{fill:e.get("backgroundColor"),stroke:e.get("borderColor"),lineWidth:e.get("borderWidth")}}))},getControllerVisual:function(t,e,i){function o(t){return u[t]}function a(t,e){u[t]=e}i=i||{};var r=i.forceState,s=this.visualMapModel,u={};if("symbol"===e&&(u.symbol=s.get("itemSymbol")),"color"===e){var h=s.get("contentColor");u.color=h}var c=s.controllerVisuals[r||s.getValueState(t)],d=l.prepareVisualTypes(c);return n.each(d,function(n){var r=c[n];i.convertOpacityToAlpha&&"opacity"===n&&(n="colorAlpha",r=c.__alphaForOpacity),l.dependsOn(n,e)&&r&&r.applyVisual(t,o,a)}),u[e]},positionGroup:function(t){var e=this.visualMapModel,i=this.api;r.positionElement(t,e.getBoxLayoutParams(),{width:i.getWidth(),height:i.getHeight()})},doRender:n.noop})},function(t,e,i){var n=i(1),o=i(12),a={getItemAlign:function(t,e,i){var n=t.option,a=n.align;if(null!=a&&"auto"!==a)return a;for(var r={width:e.getWidth(),height:e.getHeight()},s="horizontal"===n.orient?1:0,l=[["left","right","width"],["top","bottom","height"]],u=l[s],h=[0,null,10],c={},d=0;d<3;d++)c[l[1-s][d]]=h[d],c[u[d]]=2===d?i[0]:n[u[d]];var f=[["x","width",3],["y","height",0]][s],p=o.getLayoutRect(c,r,n.padding);return u[(p.margin[f[2]]||0)+p[f[0]]+.5*p[f[1]]<.5*r[f[1]]?0:1]},convertDataIndex:function(t){return n.each(t||[],function(e){null!=t.dataIndex&&(t.dataIndexInside=t.dataIndex,t.dataIndex=null)}),t}};t.exports=a},function(t,e,i){function n(t,e){return t&&t.hasOwnProperty&&t.hasOwnProperty(e)}var o=i(1),a=o.each;t.exports=function(t){var e=t&&t.visualMap;o.isArray(e)||(e=e?[e]:[]),a(e,function(t){if(t){n(t,"splitList")&&!n(t,"pieces")&&(t.pieces=t.splitList,delete t.splitList);var e=t.pieces;e&&o.isArray(e)&&a(e,function(t){o.isObject(t)&&(n(t,"start")&&!n(t,"min")&&(t.min=t.start),n(t,"end")&&!n(t,"max")&&(t.max=t.end))})}})}},function(t,e,i){i(13).registerSubTypeDefaulter("visualMap",function(t){return t.categories||(t.pieces?t.pieces.length>0:t.splitNumber>0)&&!t.calculable?"piecewise":"continuous"})},function(t,e,i){function n(t,e){t.eachTargetSeries(function(e){var i=e.getData();s.applyVisual(t.stateList,t.targetVisuals,i,t.getValueState,t,t.getDataDimension(i))})}function o(t){t.eachSeries(function(e){var i=e.getData(),n=[];t.eachComponent("visualMap",function(t){if(t.isTargetSeries(e)){var o=t.getVisualMeta(u.bind(a,null,e,t))||{stops:[],outerColors:[]};o.dimension=t.getDataDimension(i),n.push(o)}}),e.getData().setVisual("visualMeta",n)})}function a(t,e,i,n){function o(t){return u[t]}function a(t,e){u[t]=e}for(var r=e.targetVisuals[n],s=l.prepareVisualTypes(r),u={color:t.getData().getVisual("color")},h=0,c=s.length;h>1^-(1&r),s=s>>1^-(1&s),r+=n,s+=o,n=r,o=s,i.push([r/1024,s/1024])}return i}var a=i(1),r=i(258);t.exports=function(t){return n(t),a.map(a.filter(t.features,function(t){return t.geometry&&t.properties&&t.geometry.coordinates.length>0}),function(t){var e=t.properties,i=t.geometry,n=i.coordinates,o=[];"Polygon"===i.type&&o.push({type:"polygon",exterior:n[0],interiors:n.slice(1)}),"MultiPolygon"===i.type&&a.each(n,function(t){t[0]&&o.push({type:"polygon",exterior:t[0],interiors:t.slice(1)})});var s=new r(e.name,o,e.cp);return s.properties=e,s})}},function(t,e,i){function n(t,e){var i=[];return t.eachComponent("parallel",function(n,a){var r=new o(n,t,e);r.name="parallel_"+a,r.resize(n,e),n.coordinateSystem=r,r.model=n,i.push(r)}),t.eachSeries(function(e){if("parallel"===e.get("coordinateSystem")){var i=t.queryComponents({mainType:"parallel",index:e.get("parallelIndex"),id:e.get("parallelId")})[0];e.coordinateSystem=i.coordinateSystem}}),i}var o=i(397);i(26).register("parallel",{create:n})},function(t,e,i){function n(t){var e=t.mainData,i=t.datas;i||(i={main:e},t.datasAttr={main:"data"}),t.datas=t.mainData=null,u(e,i,t),d(i,function(i){d(e.TRANSFERABLE_METHODS,function(e){i.wrapMethod(e,c.curry(o,t))})}),e.wrapMethod("cloneShallow",c.curry(r,t)),d(e.CHANGABLE_METHODS,function(i){e.wrapMethod(i,c.curry(a,t))}),c.assert(i[e.dataType]===e)}function o(t,e){if(l(this)){var i=c.extend({},this[f]);i[this.dataType]=e,u(e,i,t)}else h(e,this.dataType,this[p],t);return e}function a(t,e){return t.struct&&t.struct.update(this),e}function r(t,e){return d(e[f],function(i,n){i!==e&&h(i.cloneShallow(),n,e,t)}),e}function s(t){var e=this[p];return null==t||null==e?e:e[f][t]}function l(t){return t[p]===t}function u(t,e,i){t[f]={},d(e,function(e,n){h(e,n,t,i)})}function h(t,e,i,n){i[f][e]=t,t[p]=i,t.dataType=e,n.struct&&(t[n.structAttr]=n.struct,n.struct[n.datasAttr[e]]=t),t.getLinkedData=s}var c=i(1),d=c.each,f="\0__link_datas",p="\0__link_mainData";t.exports=n},function(t,e,i){function n(){function t(e,n){if(n>=i.length)return e;for(var a=-1,r=e.length,s=i[n++],l={},u={};++a=i.length)return t;var r=[],s=n[a++];return o.each(t,function(t,i){r.push({key:i,values:e(t,a)})}),s?r.sort(function(t,e){return s(t.key,e.key)}):r}var i=[],n=[];return{key:function(t){return i.push(t),this},sortKeys:function(t){return n[i.length-1]=t,this},entries:function(i){return e(t(i,0),0)}}}var o=i(1);t.exports=n},function(t,e,i){var n=i(1),o={get:function(t,e,i){var o=n.clone((a[t]||{})[e]);return i&&n.isArray(o)?o[o.length-1]:o}},a={color:{active:["#006edd","#e0ffff"],inactive:["rgba(0,0,0,0)"]},colorHue:{active:[0,360],inactive:[0,0]},colorSaturation:{active:[.3,1],inactive:[0,0]},colorLightness:{active:[.9,.5],inactive:[0,0]},colorAlpha:{active:[.3,1],inactive:[0,0]},opacity:{active:[.3,1],inactive:[0,0]},symbol:{active:["circle","roundRect","diamond"],inactive:["none"]},symbolSize:{active:[10,50],inactive:[0,0]}};t.exports=o},function(t,e,i){function n(t,e){return Math.abs(t-e)0?1:u<0?-1:0}function a(t,e,i,n,o,a,r,s,l,u){var h=l.valueDim,c=l.categoryDim,d=Math.abs(i[c.wh]),f=t.getItemVisual(e,"symbolSize");I.isArray(f)?f=f.slice():(null==f&&(f="100%"),f=[f,f]),f[c.index]=D(f[c.index],d),f[h.index]=D(f[h.index],n?d:Math.abs(a)),u.symbolSize=f;var p=u.symbolScale=[f[0]/s,f[1]/s];p[h.index]*=(l.isHorizontal?-1:1)*r}function r(t,e,i,n,o){var a=t.get(P)||0;a&&(O.attr({scale:e.slice(),rotation:i}),O.updateTransform(),a/=O.getLineScale(),a*=e[n.valueDim.index]),o.valueLineWidth=a}function s(t,e,i,n,o,a,r,s,l,u,h,c){var d=h.categoryDim,f=h.valueDim,p=c.pxSign,g=Math.max(e[f.index]+s,0),m=g;if(n){var v=Math.abs(l),y=I.retrieve(t.get("symbolMargin"),"15%")+"",x=!1;y.lastIndexOf("!")===y.length-1&&(x=!0,y=y.slice(0,y.length-1)),y=D(y,e[f.index]);var _=Math.max(g+2*y,0),b=x?0:2*y,w=L.isNumeric(n),S=w?n:M((v+b)/_),T=v-S*g;y=T/2/(x?S:S-1),_=g+2*y,b=x?0:2*y,w||"fixed"===n||(S=u?M((Math.abs(u)+b)/_):0),m=S*_-b,c.repeatTimes=S,c.symbolMargin=y}var A=p*(m/2),C=c.pathPosition=[];C[d.index]=i[d.wh]/2,C[f.index]="start"===r?A:"end"===r?l-A:l/2,a&&(C[0]+=a[0],C[1]+=a[1]);var P=c.bundlePosition=[];P[d.index]=i[d.xy],P[f.index]=i[f.xy];var k=c.barRectShape=I.extend({},i);k[f.wh]=p*Math.max(Math.abs(i[f.wh]),Math.abs(C[f.index]+A)),k[d.wh]=i[d.wh];var O=c.clipShape={};O[d.xy]=-i[d.xy],O[d.wh]=h.ecSize[d.wh],O[f.xy]=0,O[f.wh]=i[f.wh]}function l(t){var e=t.symbolPatternSize,i=A.createSymbol(t.symbolType,-e/2,-e/2,e,e,t.color);return i.attr({culling:!0}),"image"!==i.type&&i.setStyle({strokeNoScale:!0}),i}function u(t,e,i,n){function o(t){var e=c.slice(),n=i.pxSign,o=t;return("start"===i.symbolRepeatDirection?n>0:n<0)&&(o=f-1-t),e[d.index]=g*(o-f/2+.5)+c[d.index],{position:e,scale:i.symbolScale.slice(),rotation:i.rotation}}function a(){b(t,function(t){t.trigger("emphasis")})}function r(){b(t,function(t){t.trigger("normal")})}var s=t.__pictorialBundle,u=i.symbolSize,h=i.valueLineWidth,c=i.pathPosition,d=e.valueDim,f=i.repeatTimes||0,p=0,g=u[e.valueDim.index]+h+2*i.symbolMargin;for(b(t,function(t){t.__pictorialAnimationIndex=p,t.__pictorialRepeatTimes=f,p0)],h=t.__pictorialBarRect;C.setLabel(h.style,l,a,n,e.seriesModel,o,u),T.setHoverStyle(h,l)}function M(t){var e=Math.round(t);return Math.abs(t-e)<1e-4?e:Math.ceil(t)}var I=i(1),T=i(3),A=i(24),L=i(4),C=i(90),D=L.parsePercent,P=["itemStyle","normal","borderWidth"],k=[{xy:"x",wh:"width",index:0,posDesc:["left","right"]},{xy:"y",wh:"height",index:1,posDesc:["top","bottom"]}],O=new T.Circle,z=i(2).extendChartView({type:"pictorialBar",render:function(t,e,i){var o=this.group,a=t.getData(),r=this._data,s=t.coordinateSystem,l=s.getBaseAxis(),u=!!l.isHorizontal(),h=s.grid.getRect(),c={ecSize:{width:i.getWidth(),height:i.getHeight()},seriesModel:t,coordSys:s,coordSysExtent:[[h.x,h.x+h.width],[h.y,h.y+h.height]],isHorizontal:u,valueDim:k[+u],categoryDim:k[1-u]};return a.diff(r).add(function(t){if(a.hasValue(t)){var e=f(a,t),i=n(a,t,e,c),r=v(a,c,i);a.setItemGraphicEl(t,r),o.add(r),S(r,c,i)}}).update(function(t,e){var i=r.getItemGraphicEl(e);if(!a.hasValue(t))return void o.remove(i);var s=f(a,t),l=n(a,t,s,c),u=_(a,l);i&&u!==i.__pictorialShapeStr&&(o.remove(i),a.setItemGraphicEl(t,null),i=null),i?y(i,c,l):i=v(a,c,l,!0),a.setItemGraphicEl(t,i),i.__pictorialSymbolMeta=l,o.add(i),S(i,c,l)}).remove(function(t){var e=r.getItemGraphicEl(t);e&&x(r,t,e.__pictorialSymbolMeta.animationModel,e)}).execute(),this._data=a,this.group},dispose:I.noop,remove:function(t,e){var i=this.group,n=this._data;t.get("animation")?n&&n.eachItemGraphicEl(function(e){x(n,e.dataIndex,t,e)}):i.removeAll()}});t.exports=z},function(t,e,i){var n=i(2);i(268),i(269),n.registerVisual(i(271)),n.registerLayout(i(270))},function(t,e,i){"use strict";var n=i(1),o=i(18),a=i(185),r=o.extend({type:"series.boxplot",dependencies:["xAxis","yAxis","grid"],valueDimensions:["min","Q1","median","Q3","max"],dimensions:null,defaultOption:{zlevel:0,z:2,coordinateSystem:"cartesian2d",legendHoverLink:!0,hoverAnimation:!0,layout:null,boxWidth:[7,50],itemStyle:{normal:{color:"#fff",borderWidth:1},emphasis:{borderWidth:2,shadowBlur:5,shadowOffsetX:2,shadowOffsetY:2,shadowColor:"rgba(0,0,0,0.4)"}},animationEasing:"elasticOut",animationDuration:800}});n.mixin(r,a.seriesModelMixin,!0),t.exports=r},function(t,e,i){"use strict";function n(t,e,i){var n=e.getItemModel(i),o=n.getModel(u),a=e.getItemVisual(i,"color"),s=o.getItemStyle(["borderColor"]),l=t.childAt(t.whiskerIndex);l.style.set(s),l.style.stroke=a,l.dirty();var c=t.childAt(t.bodyIndex);c.style.set(s),c.style.stroke=a,c.dirty();var d=n.getModel(h).getItemStyle();r.setHoverStyle(t,d)}var o=i(1),a=i(29),r=i(3),s=i(185),l=a.extend({type:"boxplot",getStyleUpdater:function(){return n},dispose:o.noop});o.mixin(l,s.viewMixin,!0);var u=["itemStyle","normal"],h=["itemStyle","emphasis"];t.exports=l},function(t,e,i){function n(t){var e=[],i=[];return t.eachSeriesByType("boxplot",function(t){var n=t.getBaseAxis(),o=r.indexOf(i,n);o<0&&(o=i.length,i[o]=n,e[o]={axis:n,seriesModels:[]}),e[o].seriesModels.push(t)}),e}function o(t){var e,i,n=t.axis,o=t.seriesModels,a=o.length,s=t.boxWidthList=[],h=t.boxOffsetList=[],c=[];if("category"===n.type)i=n.getBandWidth();else{var d=0;u(o,function(t){d=Math.max(d,t.getData().count())}),e=n.getExtent(),Math.abs(e[1]-e[0])/d}u(o,function(t){var e=t.get("boxWidth");r.isArray(e)||(e=[e,e]),c.push([l(e[0],i)||0,l(e[1],i)||0])});var f=.8*i-2,p=f/a*.3,g=(f-p*(a-1))/a,m=g/2-f/2;u(o,function(t,e){h.push(m),m+=p+g,s.push(Math.min(Math.max(g,c[e][0]),c[e][1]))})}function a(t,e,i){var n=t.coordinateSystem,o=t.getData(),a=t.dimensions,r=t.get("layout"),s=i/2;o.each(a,function(){function t(t){var i=[];i[f]=c,i[p]=t;var o;return isNaN(c)||isNaN(t)?o=[NaN,NaN]:(o=n.dataToPoint(i),o[f]+=e),o}function i(t,e){var i=t.slice(),n=t.slice();i[f]+=s,n[f]-=s,e?x.push(i,n):x.push(n,i)}function l(t){var e=[t.slice(),t.slice()];e[0][f]-=s,e[1][f]+=s,y.push(e)}var u=arguments,h=a.length,c=u[0],d=u[h],f="horizontal"===r?0:1,p=1-f,g=t(u[3]),m=t(u[1]),v=t(u[5]),y=[[m,t(u[2])],[v,t(u[4])]];l(m),l(v),l(g);var x=[];i(y[0][1],0),i(y[1][1],1),o.setItemLayout(d,{chartLayout:r,initBaseline:g[p],median:g,bodyEnds:x,whiskerEnds:y})})}var r=i(1),s=i(4),l=s.parsePercent,u=r.each;t.exports=function(t){var e=n(t);u(e,function(t){var e=t.seriesModels;e.length&&(o(t),u(e,function(e,i){a(e,t.boxOffsetList[i],t.boxWidthList[i])}))})}},function(t,e){var i=["itemStyle","normal","borderColor"];t.exports=function(t,e){var n=t.get("color");t.eachRawSeriesByType("boxplot",function(e){var o=n[e.seriesIndex%n.length],a=e.getData();a.setVisual({legendSymbol:"roundRect",color:e.get(i)||o}),t.isSeriesFiltered(e)||a.each(function(t){var e=a.getItemModel(t);a.setItemVisual(t,{color:e.get(i,!0)})})})}},function(t,e,i){var n=i(2);i(273),i(274),n.registerPreprocessor(i(277)),n.registerVisual(i(276)),n.registerLayout(i(275))},function(t,e,i){"use strict";var n=i(1),o=i(18),a=i(185),r=i(7),s=r.encodeHTML,l=r.addCommas,u=o.extend({type:"series.candlestick",dependencies:["xAxis","yAxis","grid"],valueDimensions:["open","close","lowest","highest"],dimensions:null,defaultOption:{zlevel:0,z:2,coordinateSystem:"cartesian2d",legendHoverLink:!0,hoverAnimation:!0,layout:null,itemStyle:{normal:{color:"#c23531",color0:"#314656",borderWidth:1,borderColor:"#c23531",borderColor0:"#314656" +},emphasis:{borderWidth:2}},barMaxWidth:null,barMinWidth:null,barWidth:null,animationUpdate:!1,animationEasing:"linear",animationDuration:300},getShadowDim:function(){return"open"},formatTooltip:function(t,e){var i=n.map(this.valueDimensions,function(e){return s(e+": "+l(this.getData().get(e,t)))},this).join("
"),o=[];return null!=this.name&&o.push(s(this.name)),null!=i&&o.push(i),o.join("
")},brushSelector:function(t,e){return e.rect(t.brushRect)}});n.mixin(u,a.seriesModelMixin,!0),t.exports=u},function(t,e,i){"use strict";function n(t,e,i){var n=e.getItemModel(i),o=n.getModel(u),a=e.getItemVisual(i,"color"),s=e.getItemVisual(i,"borderColor")||a,l=o.getItemStyle(["color","color0","borderColor","borderColor0"]),c=t.childAt(t.whiskerIndex);c.useStyle(l),c.style.stroke=s;var d=t.childAt(t.bodyIndex);d.useStyle(l),d.style.fill=a,d.style.stroke=s;var f=n.getModel(h).getItemStyle();r.setHoverStyle(t,f)}var o=i(1),a=i(29),r=i(3),s=i(185),l=a.extend({type:"candlestick",getStyleUpdater:function(){return n},dispose:o.noop});o.mixin(l,s.viewMixin,!0);var u=["itemStyle","normal"],h=["itemStyle","emphasis"];t.exports=l},function(t,e,i){function n(t,e){var i,n=t.getBaseAxis(),r="category"===n.type?n.getBandWidth():(i=n.getExtent(),Math.abs(i[1]-i[0])/e.count()),s=a(o(t.get("barMaxWidth"),r),r),l=a(o(t.get("barMinWidth"),1),r),u=t.get("barWidth");return null!=u?a(u,r):Math.max(Math.min(r/2,s),l)}var o=i(1).retrieve,a=i(4).parsePercent;t.exports=function(t){t.eachSeriesByType("candlestick",function(t){var e=t.coordinateSystem,i=t.getData(),o=t.dimensions,a=t.get("layout"),r=n(t,i);i.each(o,function(){function t(t){var i=[];return i[d]=h,i[f]=t,isNaN(h)||isNaN(t)?[NaN,NaN]:e.dataToPoint(i)}function n(t,e){var i=t.slice(),n=t.slice();i[d]+=r/2,n[d]-=r/2,e?I.push(i,n):I.push(n,i)}function s(){var e=t(Math.min(p,g,m,v)),i=t(Math.max(p,g,m,v));return e[d]-=r/2,i[d]-=r/2,{x:e[0],y:e[1],width:f?r:i[0]-e[0],height:f?i[1]-e[1]:r}}var l=arguments,u=o.length,h=l[0],c=l[u],d="horizontal"===a?0:1,f=1-d,p=l[1],g=l[2],m=l[3],v=l[4],y=Math.min(p,g),x=Math.max(p,g),_=t(y),b=t(x),w=t(m),S=t(v),M=[[S,b],[w,_]],I=[];n(b,0),n(_,1),i.setItemLayout(c,{chartLayout:a,sign:p>g?-1:pg?b[f]:_[f],bodyEnds:I,whiskerEnds:M,brushRect:s()})},!0)})}},function(t,e){var i=["itemStyle","normal","borderColor"],n=["itemStyle","normal","borderColor0"],o=["itemStyle","normal","color"],a=["itemStyle","normal","color0"];t.exports=function(t,e){t.eachRawSeriesByType("candlestick",function(e){var r=e.getData();r.setVisual({legendSymbol:"roundRect"}),t.isSeriesFiltered(e)||r.each(function(t){var e=r.getItemModel(t),s=r.getItemLayout(t).sign;r.setItemVisual(t,{color:e.get(s>0?o:a),borderColor:e.get(s>0?i:n)})})})}},function(t,e,i){var n=i(1);t.exports=function(t){t&&n.isArray(t.series)&&n.each(t.series,function(t){n.isObject(t)&&"k"===t.type&&(t.type="candlestick")})}},function(t,e,i){var n=i(1),o=i(2);i(279),i(280),o.registerVisual(n.curry(i(50),"effectScatter","circle",null)),o.registerLayout(n.curry(i(61),"effectScatter"))},function(t,e,i){"use strict";var n=i(27),o=i(18);t.exports=o.extend({type:"series.effectScatter",dependencies:["grid","polar"],getInitialData:function(t,e){var i=n(t.data,this,e);return i},brushSelector:"point",defaultOption:{coordinateSystem:"cartesian2d",zlevel:0,z:2,legendHoverLink:!0,effectType:"ripple",progressive:0,showEffectOn:"render",rippleEffect:{period:4,scale:2.5,brushType:"fill"},symbolSize:10}})},function(t,e,i){var n=i(44),o=i(307);i(2).extendChartView({type:"effectScatter",init:function(){this._symbolDraw=new n(o)},render:function(t,e,i){var n=t.getData(),o=this._symbolDraw;o.updateData(n),this.group.add(o.group)},updateLayout:function(){this._symbolDraw.updateLayout()},remove:function(t,e){this._symbolDraw&&this._symbolDraw.remove(e)},dispose:function(){}})},function(t,e,i){var n=i(1),o=i(2);i(282),i(283),o.registerVisual(n.curry(i(83),"funnel")),o.registerLayout(i(284)),o.registerProcessor(n.curry(i(63),"funnel"))},function(t,e,i){"use strict";var n=i(14),o=i(5),a=i(25),r=i(2).extendSeriesModel({type:"series.funnel",init:function(t){r.superApply(this,"init",arguments),this.legendDataProvider=function(){return this.getRawData()},this._defaultLabelLine(t)},getInitialData:function(t,e){var i=a(["value"],t.data),o=new n(i,this);return o.initData(t.data),o},_defaultLabelLine:function(t){o.defaultEmphasis(t.labelLine,["show"]);var e=t.labelLine.normal,i=t.labelLine.emphasis;e.show=e.show&&t.label.normal.show,i.show=i.show&&t.label.emphasis.show},getDataParams:function(t){var e=this.getData(),i=r.superCall(this,"getDataParams",t),n=e.getSum("value");return i.percent=n?+(e.get("value",t)/n*100).toFixed(2):0,i.$vars.push("percent"),i},defaultOption:{zlevel:0,z:2,legendHoverLink:!0,left:80,top:60,right:80,bottom:60,minSize:"0%",maxSize:"100%",sort:"descending",gap:0,funnelAlign:"center",label:{normal:{show:!0,position:"outer"},emphasis:{show:!0}},labelLine:{normal:{show:!0,length:20,lineStyle:{width:1,type:"solid"}},emphasis:{}},itemStyle:{normal:{borderColor:"#fff",borderWidth:1},emphasis:{}}}});t.exports=r},function(t,e,i){function n(t,e){function i(){r.ignore=r.hoverIgnore,s.ignore=s.hoverIgnore}function n(){r.ignore=r.normalIgnore,s.ignore=s.normalIgnore}a.Group.call(this);var o=new a.Polygon,r=new a.Polyline,s=new a.Text;this.add(o),this.add(r),this.add(s),this.updateData(t,e,!0),this.on("emphasis",i).on("normal",n).on("mouseover",i).on("mouseout",n)}function o(t,e,i,n){var o=n.getModel("textStyle"),a=n.get("position"),s="inside"===a||"inner"===a||"center"===a;return{fill:o.getTextColor()||(s?"#fff":t.getItemVisual(e,"color")),textFont:o.getFont(),text:r.retrieve(t.hostModel.getFormattedLabel(e,i),t.getName(e))}}var a=i(3),r=i(1),s=n.prototype,l=["itemStyle","normal","opacity"];s.updateData=function(t,e,i){var n=this.childAt(0),o=t.hostModel,s=t.getItemModel(e),u=t.getItemLayout(e),h=t.getItemModel(e).get(l);h=null==h?1:h,n.useStyle({}),i?(n.setShape({points:u.points}),n.setStyle({opacity:0}),a.initProps(n,{style:{opacity:h}},o,e)):a.updateProps(n,{style:{opacity:h},shape:{points:u.points}},o,e);var c=s.getModel("itemStyle"),d=t.getItemVisual(e,"color");n.setStyle(r.defaults({lineJoin:"round",fill:d},c.getModel("normal").getItemStyle(["opacity"]))),n.hoverStyle=c.getModel("emphasis").getItemStyle(),this._updateLabel(t,e),a.setHoverStyle(this)},s._updateLabel=function(t,e){var i=this.childAt(1),n=this.childAt(2),r=t.hostModel,s=t.getItemModel(e),l=t.getItemLayout(e),u=l.label,h=t.getItemVisual(e,"color");a.updateProps(i,{shape:{points:u.linePoints||u.linePoints}},r,e),a.updateProps(n,{style:{x:u.x,y:u.y}},r,e),n.attr({style:{textAlign:u.textAlign,textVerticalAlign:u.verticalAlign,textFont:u.font},rotation:u.rotation,origin:[u.x,u.y],z2:10});var c=s.getModel("label.normal"),d=s.getModel("label.emphasis"),f=s.getModel("labelLine.normal"),p=s.getModel("labelLine.emphasis");n.setStyle(o(t,e,"normal",c)),n.ignore=n.normalIgnore=!c.get("show"),n.hoverIgnore=!d.get("show"),i.ignore=i.normalIgnore=!f.get("show"),i.hoverIgnore=!p.get("show"),i.setStyle({stroke:h}),i.setStyle(f.getModel("lineStyle").getLineStyle()),n.hoverStyle=o(t,e,"emphasis",d),i.hoverStyle=p.getModel("lineStyle").getLineStyle()},r.inherits(n,a.Group);var u=i(29).extend({type:"funnel",render:function(t,e,i){var o=t.getData(),a=this._data,r=this.group;o.diff(a).add(function(t){var e=new n(o,t);o.setItemGraphicEl(t,e),r.add(e)}).update(function(t,e){var i=a.getItemGraphicEl(e);i.updateData(o,t),r.add(i),o.setItemGraphicEl(t,i)}).remove(function(t){var e=a.getItemGraphicEl(t);r.remove(e)}).execute(),this._data=o},remove:function(){this.group.removeAll(),this._data=null},dispose:function(){}});t.exports=u},function(t,e,i){function n(t,e){return r.getLayoutRect(t.getBoxLayoutParams(),{width:e.getWidth(),height:e.getHeight()})}function o(t,e){for(var i=t.mapArray("value",function(t){return t}),n=[],o="ascending"===e,a=0,r=t.count();a=t&&(0===e?0:n[e-1][0]).4?"bottom":"middle",textAlign:k<-.4?"left":k>.4?"right":"center"},silent:!0});"auto"===N.style.fill&&N.setStyle({fill:n(P/b)}),d.add(N)}if(x.get("show")&&P!==b){for(var V=0;V<=w;V++){var k=Math.cos(I),O=Math.sin(I),B=new r.Line({shape:{x1:k*g+f,y1:O*g+p,x2:k*(g-M)+f,y2:O*(g-M)+p},silent:!0,style:C});"auto"===C.stroke&&B.setStyle({stroke:n((P+V/w)/b)}),d.add(B),I+=A}I-=A}else I+=T}},_renderPointer:function(t,e,i,n,o,u,h,c){var d=this.group,f=this._data;if(!t.get("pointer.show"))return void(f&&f.eachItemGraphicEl(function(t){d.remove(t)}));var p=[+t.get("min"),+t.get("max")],g=[u,h],m=t.getData();m.diff(f).add(function(e){var i=new a({shape:{angle:u}});r.updateProps(i,{shape:{angle:s.linearMap(m.get("value",e),p,g,!0)}},t),d.add(i),m.setItemGraphicEl(e,i)}).update(function(e,i){var n=f.getItemGraphicEl(i);r.updateProps(n,{shape:{angle:s.linearMap(m.get("value",e),p,g,!0)}},t),d.add(n),m.setItemGraphicEl(e,n)}).remove(function(t){var e=f.getItemGraphicEl(t);d.remove(e)}).execute(),m.eachItemGraphicEl(function(t,e){var i=m.getItemModel(e),a=i.getModel("pointer");t.setShape({x:o.cx,y:o.cy,width:l(a.get("width"),o.r),r:l(a.get("length"),o.r)}),t.useStyle(i.getModel("itemStyle.normal").getItemStyle()),"auto"===t.style.fill&&t.setStyle("fill",n(s.linearMap(m.get("value",e),p,[0,1],!0))),r.setHoverStyle(t,i.getModel("itemStyle.emphasis").getItemStyle())}),this._data=m},_renderTitle:function(t,e,i,n,o){var a=t.getModel("title");if(a.get("show")){var u=a.getModel("textStyle"),h=a.get("offsetCenter"),c=o.cx+l(h[0],o.r),d=o.cy+l(h[1],o.r),f=new r.Text({style:{x:c,y:d,text:t.getData().getName(0),fill:u.getTextColor(),textFont:u.getFont(),textAlign:"center",textVerticalAlign:"middle"}});if("auto"===f.style.fill){var p=+t.get("min"),g=+t.get("max"),m=t.getData().get("value",0);f.setStyle("fill",n(s.linearMap(m,[p,g],[0,1],!0)))}this.group.add(f)}},_renderDetail:function(t,e,i,n,a){var u=t.getModel("detail"),h=+t.get("min"),c=+t.get("max");if(u.get("show")){var d=u.getModel("textStyle"),f=u.get("offsetCenter"),p=a.cx+l(f[0],a.r),g=a.cy+l(f[1],a.r),m=l(u.get("width"),a.r),v=l(u.get("height"),a.r),y=t.getData().get("value",0),x=new r.Rect({shape:{x:p-m/2,y:g-v/2,width:m,height:v},style:{text:o(y,u.get("formatter")),fill:u.get("backgroundColor"),textFill:d.getTextColor(),textFont:d.getFont()}});"auto"===x.style.textFill&&x.setStyle("textFill",n(s.linearMap(y,[h,c],[0,1],!0))),x.setStyle(u.getItemStyle(["color"])),this.group.add(x)}}});t.exports=h},function(t,e,i){t.exports=i(8).extend({type:"echartsGaugePointer",shape:{angle:0,width:10,r:10,x:0,y:0},buildPath:function(t,e){var i=Math.cos,n=Math.sin,o=e.r,a=e.width,r=e.angle,s=e.x-i(r)*a*(a>=o/3?1:2),l=e.y-n(r)*a*(a>=o/3?1:2);r=e.angle-Math.PI/2,t.moveTo(s,l),t.lineTo(e.x+i(r)*a,e.y+n(r)*a),t.lineTo(e.x+i(e.angle)*o,e.y+n(e.angle)*o),t.lineTo(e.x-i(r)*a,e.y-n(r)*a),t.lineTo(s,l)}})},function(t,e,i){var n=i(2),o=i(1);i(290),i(291),i(300),n.registerProcessor(i(293)),n.registerVisual(o.curry(i(50),"graph","circle",null)),n.registerVisual(i(294)),n.registerVisual(i(297)),n.registerLayout(i(301)),n.registerLayout(i(295)),n.registerLayout(i(299)),n.registerCoordinateSystem("graphView",{create:i(296)})},function(t,e,i){"use strict";var n=i(14),o=i(1),a=i(5),r=i(10),s=i(7),l=i(244),u=i(2).extendSeriesModel({type:"series.graph",init:function(t){u.superApply(this,"init",arguments),this.legendDataProvider=function(){return this._categoriesData},this.fillDataTextStyle(t.edges||t.links),this._updateCategoriesData()},mergeOption:function(t){u.superApply(this,"mergeOption",arguments),this.fillDataTextStyle(t.edges||t.links),this._updateCategoriesData()},mergeDefaultAndTheme:function(t){u.superApply(this,"mergeDefaultAndTheme",arguments),a.defaultEmphasis(t.edgeLabel,a.LABEL_OPTIONS)},getInitialData:function(t,e){function i(t,i){function n(t){return t=this.parsePath(t),t&&"label"===t[0]?s:this.parentModel}t.wrapMethod("getItemModel",function(t){var e=a._categoriesModels,i=t.getShallow("category"),n=e[i];return n&&(n.parentModel=t.parentModel,t.parentModel=n),t});var o=a.getModel("edgeLabel"),s=new r({label:o.option},o.parentModel,e);i.wrapMethod("getItemModel",function(t){return t.customizeGetParent(n),t})}var n=t.edges||t.links||[],o=t.data||t.nodes||[],a=this;if(o&&n)return l(o,n,this,!0,i).data},getGraph:function(){return this.getData().graph},getEdgeData:function(){return this.getGraph().edgeData},getCategoriesData:function(){return this._categoriesData},formatTooltip:function(t,e,i){if("edge"===i){var n=this.getData(),o=this.getDataParams(t,i),a=n.graph.getEdgeByIndex(t),r=n.getName(a.node1.dataIndex),l=n.getName(a.node2.dataIndex),h=[];return null!=r&&h.push(r),null!=l&&h.push(l),h=s.encodeHTML(h.join(" > ")),o.value&&(h+=" : "+s.encodeHTML(o.value)),h}return u.superApply(this,"formatTooltip",arguments)},_updateCategoriesData:function(){var t=o.map(this.option.categories||[],function(t){return null!=t.value?t:o.extend({value:0},t)}),e=new n(["value"],this);e.initData(t),this._categoriesData=e,this._categoriesModels=e.mapArray(function(t){return e.getItemModel(t,!0)})},setZoom:function(t){this.option.zoom=t},setCenter:function(t){this.option.center=t},isAnimationEnabled:function(){return u.superCall(this,"isAnimationEnabled")&&!("force"===this.get("layout")&&this.get("force.layoutAnimation"))},defaultOption:{zlevel:0,z:2,coordinateSystem:"view",legendHoverLink:!0,hoverAnimation:!0,layout:null,focusNodeAdjacency:!1,circular:{rotateLabel:!1},force:{initLayout:null,repulsion:[0,50],gravity:.1,edgeLength:30,layoutAnimation:!0},left:"center",top:"center",symbol:"circle",symbolSize:10,edgeSymbol:["none","none"],edgeSymbolSize:10,edgeLabel:{normal:{position:"middle"},emphasis:{}},draggable:!1,roam:!1,center:null,zoom:1,nodeScaleRatio:.6,label:{normal:{show:!1,formatter:"{b}"},emphasis:{show:!0}},itemStyle:{normal:{},emphasis:{}},lineStyle:{normal:{color:"#aaa",width:1,curveness:0,opacity:.5},emphasis:{}}}});t.exports=u},function(t,e,i){function n(t,e){return t.getVisual("opacity")||t.getModel().get(e)}var o=i(44),a=i(109),r=i(94),s=i(3),l=i(292),u=i(1),h=["itemStyle","normal","opacity"],c=["lineStyle","normal","opacity"];i(2).extendChartView({type:"graph",init:function(t,e){var i=new o,n=new a,s=this.group,l=new r(e.getZr(),s);s.add(i.group),s.add(n.group),this._symbolDraw=i,this._lineDraw=n,this._controller=l,this._firstRender=!0},render:function(t,e,i){var n=t.coordinateSystem;this._model=t,this._nodeScaleRatio=t.get("nodeScaleRatio");var o=this._symbolDraw,a=this._lineDraw,r=this.group;if("view"===n.type){var u={position:n.position,scale:n.scale};this._firstRender?r.attr(u):s.updateProps(r,u,t)}l(t.getGraph(),this._getNodeGlobalScale(t));var h=t.getData();o.updateData(h);var c=t.getEdgeData();a.updateData(c),this._updateNodeAndLinkScale(),this._updateController(t,i),clearTimeout(this._layoutTimeout);var d=t.forceLayout,f=t.get("force.layoutAnimation");d&&this._startForceLayoutIteration(d,f),h.eachItemGraphicEl(function(e,n){var o=h.getItemModel(n);e.off("drag").off("dragend");var a=h.getItemModel(n).get("draggable");a&&e.on("drag",function(){d&&(d.warmUp(),!this._layouting&&this._startForceLayoutIteration(d,f),d.setFixed(n),h.setItemLayout(n,e.position))},this).on("dragend",function(){d&&d.setUnfixed(n)},this),e.setDraggable(a&&d),e.off("mouseover",e.__focusNodeAdjacency),e.off("mouseout",e.__unfocusNodeAdjacency),o.get("focusNodeAdjacency")&&(e.on("mouseover",e.__focusNodeAdjacency=function(){i.dispatchAction({type:"focusNodeAdjacency",seriesId:t.id,dataIndex:e.dataIndex})}),e.on("mouseout",e.__unfocusNodeAdjacency=function(){i.dispatchAction({type:"unfocusNodeAdjacency",seriesId:t.id})}))},this);var p="circular"===t.get("layout")&&t.get("circular.rotateLabel"),g=h.getLayout("cx"),m=h.getLayout("cy");h.eachItemGraphicEl(function(t,e){var i=t.getSymbolPath();if(p){var n=h.getItemLayout(e),o=Math.atan2(n[1]-m,n[0]-g);o<0&&(o=2*Math.PI+o);var a=n[0]=0?n+=g:n-=g:_>=0?n-=g:n+=g}return n}var o=i(21),a=i(6),r=[],s=[],l=[],u=o.quadraticAt,h=a.distSquare,c=Math.abs;t.exports=function(t,e){function i(t){var e=t.getVisual("symbolSize");return e instanceof Array&&(e=(e[0]+e[1])/2),e}var r=[],s=o.quadraticSubdivide,l=[[],[],[]],u=[[],[]],h=[];e/=2,t.eachEdge(function(t,o){var c=t.getLayout(),d=t.getVisual("fromSymbol"),f=t.getVisual("toSymbol");c.__original||(c.__original=[a.clone(c[0]),a.clone(c[1])],c[2]&&c.__original.push(a.clone(c[2])));var p=c.__original;if(null!=c[2]){if(a.copy(l[0],p[0]),a.copy(l[1],p[2]),a.copy(l[2],p[1]),d&&"none"!=d){var g=i(t.node1),m=n(l,p[0],g*e);s(l[0][0],l[1][0],l[2][0],m,r),l[0][0]=r[3],l[1][0]=r[4],s(l[0][1],l[1][1],l[2][1],m,r),l[0][1]=r[3],l[1][1]=r[4]}if(f&&"none"!=f){var g=i(t.node2),m=n(l,p[1],g*e);s(l[0][0],l[1][0],l[2][0],m,r),l[1][0]=r[1],l[2][0]=r[2],s(l[0][1],l[1][1],l[2][1],m,r),l[1][1]=r[1],l[2][1]=r[2]}a.copy(c[0],l[0]),a.copy(c[1],l[2]),a.copy(c[2],l[1])}else{if(a.copy(u[0],p[0]),a.copy(u[1],p[1]),a.sub(h,u[1],u[0]),a.normalize(h,h),d&&"none"!=d){var g=i(t.node1);a.scaleAndAdd(u[0],u[0],h,g*e)}if(f&&"none"!=f){var g=i(t.node2);a.scaleAndAdd(u[1],u[1],h,-g*e)}a.copy(c[0],u[0]),a.copy(c[1],u[1])}})}},function(t,e){t.exports=function(t){var e=t.findComponents({mainType:"legend"});e&&e.length&&t.eachSeriesByType("graph",function(t){var i=t.getCategoriesData(),n=t.getGraph(),o=n.data,a=i.mapArray(i.getName);o.filterSelf(function(t){var i=o.getItemModel(t),n=i.getShallow("category");if(null!=n){"number"==typeof n&&(n=a[n]);for(var r=0;r0){var L=r(x)?l:u;x>0&&(x=x*T+M),b[w++]=L[A],b[w++]=L[A+1],b[w++]=L[A+2],b[w++]=L[A+3]*x*256}else w+=4}return d.putImageData(_,0,0),c},_getBrush:function(){var t=this._brushCanvas||(this._brushCanvas=a.createCanvas()),e=this.pointSize+this.blurSize,i=2*e;t.width=i,t.height=i;var n=t.getContext("2d");return n.clearRect(0,0,i,i),n.shadowOffsetX=i,n.shadowBlur=this.blurSize,n.shadowColor="#000",n.beginPath(),n.arc(-e,e,this.pointSize,0,2*Math.PI,!0),n.closePath(),n.fill(),t},_getGradient:function(t,e,i){for(var n=this._gradientPixels,o=n[i]||(n[i]=new Uint8ClampedArray(1024)),a=[],r=0,s=0;s<256;s++)e[i](s/255,!0,a),o[r++]=a[0],o[r++]=a[1],o[r++]=a[2],o[r++]=a[3];return o}},t.exports=n},function(t,e,i){var n=i(18),o=i(27);t.exports=n.extend({type:"series.heatmap",getInitialData:function(t,e){return o(t.data,this,e)},defaultOption:{coordinateSystem:"cartesian2d",zlevel:0,z:2,geoIndex:0,blurSize:30,pointSize:20,maxOpacity:1,minOpacity:0}})},function(t,e,i){function n(t,e,i){var n=t[1]-t[0];e=l.map(e,function(e){return{interval:[(e.interval[0]-t[0])/n,(e.interval[1]-t[0])/n]}});var o=e.length,a=0;return function(t){for(var n=a;n=0;n--){var r=e[n].interval;if(r[0]<=t&&t<=r[1]){a=n;break}}return n>=0&&n=e[0]&&t<=e[1]}}function a(t){var e=t.dimensions;return"lng"===e[0]&&"lat"===e[1]}var r=i(3),s=i(303),l=i(1);t.exports=i(2).extendChartView({type:"heatmap",render:function(t,e,i){var n;e.eachComponent("visualMap",function(e){e.eachTargetSeries(function(i){i===t&&(n=e)})}),this.group.removeAll();var o=t.coordinateSystem;"cartesian2d"===o.type||"calendar"===o.type?this._renderOnCartesianAndCalendar(o,t,i):a(o)&&this._renderOnGeo(o,t,n,i)},dispose:function(){},_renderOnCartesianAndCalendar:function(t,e,i){if("cartesian2d"===t.type)var n=t.getAxis("x"),o=t.getAxis("y"),a=n.getBandWidth(),s=o.getBandWidth();var u=this.group,h=e.getData(),c="itemStyle.normal",d="itemStyle.emphasis",f="label.normal",p="label.emphasis",g=e.getModel(c).getItemStyle(["color"]),m=e.getModel(d).getItemStyle(),v=e.getModel("label.normal"),y=e.getModel("label.emphasis");h.each("cartesian2d"===t.type?["x","y","z"]:["time","value"],function(i,n,o,x){var _;if("cartesian2d"===t.type){if(isNaN(o))return;var b=t.dataToPoint([i,n]);_=new r.Rect({shape:{x:b[0]-a/2,y:b[1]-s/2,width:a,height:s},style:{fill:h.getItemVisual(x,"color"),opacity:h.getItemVisual(x,"opacity")}})}else{if(isNaN(n))return;x=o,_=new r.Rect({z2:1,shape:t.dataToRect([i,n]).contentShape,style:{fill:h.getItemVisual(x,"color"),opacity:h.getItemVisual(x,"opacity")}})}var w=h.getItemModel(x);h.hasItemOption&&(g=w.getModel(c).getItemStyle(["color"]),m=w.getModel(d).getItemStyle(),v=w.getModel(f),y=w.getModel(p));var S=e.getRawValue(x),M="-";S&&null!=S[2]&&(M=S[2]),v.getShallow("show")&&(r.setText(g,v),g.text=e.getFormattedLabel(x,"normal")||M),y.getShallow("show")&&(r.setText(m,y),m.text=e.getFormattedLabel(x,"emphasis")||M),_.setStyle(g),r.setHoverStyle(_,h.hasItemOption?m:l.extend({},m)),u.add(_),h.setItemGraphicEl(x,_)})},_renderOnGeo:function(t,e,i,a){var l=i.targetVisuals.inRange,u=i.targetVisuals.outOfRange,h=e.getData(),c=this._hmLayer||this._hmLayer||new s;c.blurSize=e.get("blurSize"),c.pointSize=e.get("pointSize"),c.minOpacity=e.get("minOpacity"),c.maxOpacity=e.get("maxOpacity");var d=t.getViewRect().clone(),f=t.getRoamTransform().transform;d.applyTransform(f);var p=Math.max(d.x,0),g=Math.max(d.y,0),m=Math.min(d.width+d.x,a.getWidth()),v=Math.min(d.height+d.y,a.getHeight()),y=m-p,x=v-g,_=h.mapArray(["lng","lat","value"],function(e,i,n){var o=t.dataToPoint([e,i]);return o[0]-=p,o[1]-=g,o.push(n),o}),b=i.getExtent(),w="visualMap.continuous"===i.type?o(b,i.option.range):n(b,i.getPieceList(),i.option.selected);c.update(_,y,x,l.color.getNormalizer(),{inRange:l.color.getColorMapper(),outOfRange:u.color.getColorMapper()},w);var S=new r.Image({style:{width:y,height:x,x:p,y:g,image:c.canvas},silent:!0});this.group.add(S)}})},function(t,e,i){function n(t,e,i){r.call(this,t,e,i),this._lastFrame=0,this._lastFramePercent=0}var o=i(243),a=i(1),r=i(242),s=i(6),l=n.prototype;l.createLine=function(t,e,i){return new o(t,e,i)},l.updateAnimationPoints=function(t,e){this._points=e;for(var i=[0],n=0,o=1;o=0&&!(n[a]<=e);a--);a=Math.min(a,o-2)}else{for(var a=r;ae);a++);a=Math.min(a-1,o-2)}s.lerp(t.position,i[a],i[a+1],(e-n[a])/(n[a+1]-n[a]));var u=i[a+1][0]-i[a][0],h=i[a+1][1]-i[a][1];t.rotation=-Math.atan2(h,u)-Math.PI/2,this._lastFrame=a,this._lastFramePercent=e,t.ignore=!1}},a.inherits(n,r),t.exports=n},function(t,e,i){function n(t){return r.isArray(t)||(t=[+t,+t]),t}function o(t,e){t.eachChild(function(t){t.attr({z:e.z,zlevel:e.zlevel,style:{stroke:"stroke"===e.brushType?e.color:null,fill:"fill"===e.brushType?e.color:null}})})}function a(t,e){c.call(this);var i=new h(t,e),n=new c;this.add(i),this.add(n),n.beforeUpdate=function(){this.attr(i.getScale())},this.updateData(t,e)}var r=i(1),s=i(24),l=i(3),u=i(4),h=i(54),c=l.Group,d=3,f=a.prototype;f.stopEffectAnimation=function(){this.childAt(1).removeAll()},f.startEffectAnimation=function(t){for(var e=t.symbolType,i=t.color,n=this.childAt(1),a=0;a2?t.quadraticCurveTo(a[2][0],a[2][1],a[1][0],a[1][1]):t.lineTo(a[1][0],a[1][1])}},findDataIndex:function(t,e){for(var i=this.shape,n=i.segs,o=i.polyline,s=Math.max(this.style.lineWidth,1),l=0;l2){if(a.containStroke(u[0][0],u[0][1],u[2][0],u[2][1],u[1][0],u[1][1],s,t,e))return l}else if(r.containStroke(u[0][0],u[0][1],u[1][0],u[1][1],s,t,e))return l}return-1}}),l=n.prototype;l.updateData=function(t){this.group.removeAll();var e=this._lineEl,i=t.hostModel;e.setShape({segs:t.mapArray(t.getItemLayout),polyline:i.get("polyline")}),e.useStyle(i.getModel("lineStyle.normal").getLineStyle());var n=t.getVisual("color");n&&e.setStyle("stroke",n),e.setStyle("fill"),e.seriesIndex=i.seriesIndex,e.on("mousemove",function(t){e.dataIndex=null;var i=e.findDataIndex(t.offsetX,t.offsetY);i>0&&(e.dataIndex=i)}),this.group.add(e)},l.updateLayout=function(t){var e=t.getData();this._lineEl.setShape({segs:e.mapArray(e.getItemLayout)})},l.remove=function(){this.group.removeAll()},t.exports=n},function(t,e,i){function n(t,e,i,n){l.Group.call(this),this.bodyIndex,this.whiskerIndex,this.styleUpdater=i,this._createContent(t,e,n),this.updateData(t,e,n),this._seriesModel}function o(t,e,i){return s.map(t,function(t){return t=t.slice(),t[e]=i.initBaseline,t})}function a(t){var e={};return s.each(t,function(t,i){e["ends"+i]=t}),e}function r(t){this.group=new l.Group,this.styleUpdater=t}var s=i(1),l=i(3),u=i(8),h=u.extend({type:"whiskerInBox",shape:{},buildPath:function(t,e){for(var i in e)if(e.hasOwnProperty(i)&&0===i.indexOf("ends")){var n=e[i];t.moveTo(n[0][0],n[0][1]),t.lineTo(n[1][0],n[1][1])}}}),c=n.prototype;c._createContent=function(t,e,i){var n=t.getItemLayout(e),r="horizontal"===n.chartLayout?1:0,u=0;this.add(new l.Polygon({shape:{points:i?o(n.bodyEnds,r,n):n.bodyEnds},style:{strokeNoScale:!0},z2:100})),this.bodyIndex=u++;var c=s.map(n.whiskerEnds,function(t){return i?o(t,r,n):t});this.add(new h({shape:a(c),style:{strokeNoScale:!0},z2:100})),this.whiskerIndex=u++},c.updateData=function(t,e,i){var n=this._seriesModel=t.hostModel,o=t.getItemLayout(e),r=l[i?"initProps":"updateProps"];r(this.childAt(this.bodyIndex),{shape:{points:o.bodyEnds}},n,e),r(this.childAt(this.whiskerIndex),{shape:a(o.whiskerEnds)},n,e),this.styleUpdater.call(null,this,t,e)},s.inherits(n,l.Group);var d=r.prototype;d.updateData=function(t){var e=this.group,i=this._data,o=this.styleUpdater;t.diff(i).add(function(i){if(t.hasValue(i)){var a=new n(t,i,o,(!0));t.setItemGraphicEl(i,a),e.add(a)}}).update(function(a,r){var s=i.getItemGraphicEl(r);return t.hasValue(a)?(s?s.updateData(t,a):s=new n(t,a,o),e.add(s),void t.setItemGraphicEl(a,s)):void e.remove(s)}).remove(function(t){var n=i.getItemGraphicEl(t);n&&e.remove(n)}).execute(),this._data=t},d.remove=function(){var t=this.group,e=this._data;this._data=null,e&&e.eachItemGraphicEl(function(e){e&&t.remove(e)})},t.exports=r},function(t,e,i){i(311),i(312);var n=i(2);n.registerLayout(i(313)),n.registerVisual(i(314))},function(t,e,i){"use strict";function n(t){var e=t.data;e&&e[0]&&e[0][0]&&e[0][0].coord&&(t.data=r.map(e,function(t){var e=[t[0].coord,t[1].coord],i={coords:e};return t[0].name&&(i.fromName=t[0].name),t[1].name&&(i.toName=t[1].name),r.mergeAll([i,t[0],t[1]])}))}var o=i(18),a=i(14),r=i(1),s=i(7),l=(i(26),o.extend({type:"series.lines",dependencies:["grid","polar"],visualColorAccessPath:"lineStyle.normal.color",init:function(t){n(t),l.superApply(this,"init",arguments)},mergeOption:function(t){n(t),l.superApply(this,"mergeOption",arguments)},getInitialData:function(t,e){var i=new a(["value"],this);return i.hasItemOption=!1,i.initData(t.data,[],function(t,e,n,o){if(t instanceof Array)return NaN;i.hasItemOption=!0;var a=t.value;return null!=a?a instanceof Array?a[o]:a:void 0}),i},formatTooltip:function(t){var e=this.getData(),i=e.getItemModel(t),n=i.get("name");if(n)return n;var o=i.get("fromName"),a=i.get("toName"),r=[];return null!=o&&r.push(o),null!=a&&r.push(a),s.encodeHTML(r.join(" > "))},defaultOption:{coordinateSystem:"geo",zlevel:0,z:2,legendHoverLink:!0,hoverAnimation:!0,xAxisIndex:0,yAxisIndex:0,symbol:["none","none"],symbolSize:[10,10],geoIndex:0,effect:{show:!1,period:4,constantSpeed:0,symbol:"circle",symbolSize:3,loop:!0,trailLength:.2},large:!1,largeThreshold:2e3,polyline:!1,label:{normal:{show:!1,position:"end"}},lineStyle:{normal:{opacity:.5}}}}))},function(t,e,i){var n=i(109),o=i(242),a=i(108),r=i(243),s=i(306),l=i(308);i(2).extendChartView({type:"lines",init:function(){},render:function(t,e,i){var u=t.getData(),h=this._lineDraw,c=t.get("effect.show"),d=t.get("polyline"),f=t.get("large")&&u.count()>=t.get("largeThreshold");c===this._hasEffet&&d===this._isPolyline&&f===this._isLarge||(h&&h.remove(),h=this._lineDraw=f?new l:new n(d?c?s:r:c?o:a),this._hasEffet=c,this._isPolyline=d,this._isLarge=f);var p=t.get("zlevel"),g=t.get("effect.trailLength"),m=i.getZr();if(m.painter.getLayer(p).clear(!0),null!=this._lastZlevel&&m.configLayer(this._lastZlevel,{motionBlur:!1}),c&&g){m.configLayer(p,{motionBlur:!0,lastFrameAlpha:Math.max(Math.min(g/10+.9,1),0)})}this.group.add(h.group),h.updateData(u),this._lastZlevel=p},updateLayout:function(t,e,i){this._lineDraw.updateLayout(t);var n=i.getZr();n.painter.getLayer(this._lastZlevel).clear(!0)},remove:function(t,e){this._lineDraw&&this._lineDraw.remove(e,!0)},dispose:function(){}})},function(t,e,i){t.exports=function(t){t.eachSeriesByType("lines",function(t){var e=t.coordinateSystem,i=t.getData();i.each(function(n){var o=i.getItemModel(n),a=o.option instanceof Array?o.option:o.get("coords"),r=[];if(t.get("polyline"))for(var s=0;s"+l(n+" : "+i)},getTooltipPosition:function(t){if(null!=t){var e=this.getData().getName(t),i=this.coordinateSystem,n=i.getRegion(e);return n&&i.dataToPoint(n.center)}},setZoom:function(t){this.option.zoom=t},setCenter:function(t){this.option.center=t},defaultOption:{zlevel:0,z:2,coordinateSystem:"geo",map:"",left:"center",top:"center",aspectScale:.75,showLegendSymbol:!0,dataRangeHoverLink:!0,boundingCoords:null,center:null,zoom:1,scaleLimit:null,label:{normal:{show:!1,textStyle:{color:"#000"}},emphasis:{show:!0,textStyle:{color:"rgb(100,0,0)"}}},itemStyle:{normal:{borderWidth:.5,borderColor:"#444",areaColor:"#eee"},emphasis:{areaColor:"rgba(255,215,0,0.8)"}}}});a.mixin(d,h),t.exports=d},function(t,e,i){var n=i(3),o=i(247);i(2).extendChartView({type:"map",render:function(t,e,i,n){if(!n||"mapToggleSelect"!==n.type||n.from!==this.uid){var a=this.group;if(a.removeAll(),!t.getHostGeoModel()){if(n&&"geoRoam"===n.type&&"series"===n.componentType&&n.seriesId===t.id){var r=this._mapDraw;r&&a.add(r.group)}else if(t.needsDrawMap){var r=this._mapDraw||new o(i,(!0));a.add(r.group),r.draw(t,e,i,this,n),this._mapDraw=r}else this._mapDraw&&this._mapDraw.remove(),this._mapDraw=null;t.get("showLegendSymbol")&&e.getComponent("legend")&&this._renderSymbols(t,e,i)}}},remove:function(){this._mapDraw&&this._mapDraw.remove(),this._mapDraw=null,this.group.removeAll()},dispose:function(){this._mapDraw&&this._mapDraw.remove(),this._mapDraw=null},_renderSymbols:function(t,e,i){var o=t.originalData,a=this.group;o.each("value",function(e,i){if(!isNaN(e)){var r=o.getItemLayout(i);if(r&&r.point){var s=r.point,l=r.offset,u=new n.Circle({style:{fill:t.getData().getVisual("color")},shape:{cx:s[0]+9*l,cy:s[1],r:3},silent:!0,z2:10});if(!l){var h=t.mainSeries.getData(),c=o.getName(i),d=c,f=h.indexOfName(c),p=o.getItemModel(i),g=p.getModel("label.normal"),m=p.getModel("label.emphasis"),v=g.getModel("textStyle"),y=m.getModel("textStyle"),x=h.getItemGraphicEl(f);u.setStyle({textPosition:"bottom"});var _=function(){u.setStyle({text:m.get("show")?d:"",textFill:y.getTextColor(),textFont:y.getFont()})},b=function(){u.setStyle({text:g.get("show")?d:"",textFill:v.getTextColor(),textFont:v.getFont()})};x.on("mouseover",_).on("mouseout",b).on("emphasis",_).on("normal",b),b()}a.add(u)}}})}})},function(t,e,i){var n=i(1);t.exports=function(t){var e=[];n.each(t.series,function(t){"map"===t.type&&e.push(t)}),n.each(e,function(t){t.map=t.map||t.mapType,n.defaults(t,t.mapLocation)})}},function(t,e,i){function n(t,e){var i={},n=["value"];return o.each(t,function(t){t.each(n,function(e,n){var o=t.getName(n);i[o]=i[o]||[],isNaN(e)||i[o].push(e)})}),t[0].map(n,function(n,o){for(var a=t[0].getName(o),r=0,s=1/0,l=-(1/0),u=i[a].length,h=0;h=0?e:NaN}})}function o(t){return+t.replace("dim","")}function a(t,e){var i=0;s.each(t,function(t){var e=o(t);e>i&&(i=e)});var n=e[0];n&&n.length-1>i&&(i=n.length-1);for(var a=[],r=0;r<=i;r++)a.push("dim"+r);return a}var r=i(14),s=i(1),l=i(18),u=i(25);t.exports=l.extend({type:"series.parallel",dependencies:["parallel"],getInitialData:function(t,e){var i=e.getComponent("parallel",this.get("parallelIndex")),o=i.parallelAxisIndex,l=t.data,h=i.dimensions,c=a(h,l),d=s.map(c,function(t,i){var a=s.indexOf(h,t),r=a>=0&&e.getComponent("parallelAxis",o[a]);return r&&"category"===r.get("type")?(n(r,t,l),{name:t,type:"ordinal"}):a<0&&u.guessOrdinal(l,i)?{name:t,type:"ordinal"}:t}),f=new r(d,this);return f.initData(l),this.option.progressive&&(this.option.animation=!1),f},getRawIndicesByActiveState:function(t){var e=this.coordinateSystem,i=this.getData(),n=[];return e.eachActiveState(i,function(e,o){t===e&&n.push(i.getRawIndex(o))}),n},defaultOption:{zlevel:0,z:2,coordinateSystem:"parallel",parallelIndex:0,label:{normal:{show:!1},emphasis:{show:!1}},inactiveOpacity:.05,activeOpacity:1,lineStyle:{normal:{width:1,opacity:.45,type:"solid"}},progressive:!1,smooth:!1,animationEasing:"linear"}})},function(t,e,i){function n(t,e,i){var n=t.model,o=t.getRect(),a=new l.Rect({shape:{x:o.x,y:o.y,width:o.width,height:o.height}}),r="horizontal"===n.get("layout")?"width":"height";return a.setShape(r,0),l.initProps(a,{shape:{width:o.width,height:o.height}},e,i),a}function o(t,e,i,n){for(var o=[],a=0;a"+r.map(n,function(t,i){return s(t.name+" : "+e[i])}).join("
")},defaultOption:{zlevel:0,z:2,coordinateSystem:"radar",legendHoverLink:!0,radarIndex:0,lineStyle:{normal:{width:2,type:"solid"}},label:{normal:{position:"top"}},symbol:"emptyCircle",symbolSize:4}});t.exports=l},function(t,e,i){function n(t){return a.isArray(t)||(t=[+t,+t]),t}var o=i(3),a=i(1),r=i(24);t.exports=i(2).extendChartView({type:"radar",render:function(t,e,i){function s(t,e){var i=t.getItemVisual(e,"symbol")||"circle",o=t.getItemVisual(e,"color");if("none"!==i){var a=r.createSymbol(i,-.5,-.5,1,1,o);return a.attr({style:{strokeNoScale:!0},z2:100,scale:n(t.getItemVisual(e,"symbolSize"))}),a}}function l(e,i,n,a,r,l){n.removeAll();for(var u=0;u0;o--)r*=.99,d(a,r),c(a,n,i),p(a,r),c(a,n,i)}function h(t,e,i,n,o){var a=[];T.each(e,function(t){var e=t.length,i=0;T.each(t,function(t){i+=t.getLayout().value});var r=(n-(e-1)*o)/i;a.push(r)}),a.sort(function(t,e){return t-e});var r=a[0];T.each(e,function(t){T.each(t,function(t,e){t.setLayout({y:e},!0);var i=t.getLayout().value*r;t.setLayout({dy:i},!0)})}),T.each(i,function(t){var e=+t.getValue()*r;t.setLayout({dy:e},!0)})}function c(t,e,i){T.each(t,function(t){var n,o,a,r=0,s=t.length;for(t.sort(b),a=0;a0){var l=n.getLayout().y+o;n.setLayout({y:l},!0)}r=n.getLayout().y+n.getLayout().dy+e}if(o=r-e-i,o>0){var l=n.getLayout().y-o;for(n.setLayout({y:l},!0),r=n.getLayout().y,a=s-2;a>=0;--a)n=t[a],o=n.getLayout().y+n.getLayout().dy+e-r,o>0&&(l=n.getLayout().y-o,n.setLayout({y:l},!0)),r=n.getLayout().y}})}function d(t,e){T.each(t.slice().reverse(),function(t){T.each(t,function(t){if(t.outEdges.length){var i=x(t.outEdges,f)/x(t.outEdges,S),n=t.getLayout().y+(i-_(t))*e;t.setLayout({y:n},!0)}})})}function f(t){return _(t.node2)*t.getValue()}function p(t,e){T.each(t,function(t){T.each(t,function(t){if(t.inEdges.length){var i=x(t.inEdges,g)/x(t.inEdges,S),n=t.getLayout().y+(i-_(t))*e;t.setLayout({y:n},!0)}})})}function g(t){return _(t.node1)*t.getValue()}function m(t){T.each(t,function(t){t.outEdges.sort(v),t.inEdges.sort(y)}),T.each(t,function(t){var e=0,i=0;T.each(t.outEdges,function(t){t.setLayout({sy:e},!0),e+=t.getLayout().dy}),T.each(t.inEdges,function(t){t.setLayout({ty:i},!0),i+=t.getLayout().dy})})}function v(t,e){return t.node2.getLayout().y-e.node2.getLayout().y}function y(t,e){return t.node1.getLayout().y-e.node1.getLayout().y}function x(t,e){for(var i=0,n=t.length,o=-1;++oe?1:t===e?0:NaN}function S(t){return t.getValue()}var M=i(12),I=i(262),T=i(1);t.exports=function(t,e,i){t.eachSeriesByType("sankey",function(t){var i=t.get("nodeWidth"),r=t.get("nodeGap"),s=n(t,e);t.layoutInfo=s;var l=s.width,u=s.height,h=t.getGraph(),c=h.nodes,d=h.edges;a(c);var f=c.filter(function(t){return 0===t.getLayout().value}),p=0!==f.length?0:t.get("layoutIterations");o(c,d,i,r,l,u,p)})}},function(t,e,i){var n=i(82),o=i(1);t.exports=function(t,e){t.eachSeriesByType("sankey",function(t){var e=t.getGraph(),i=e.nodes;i.sort(function(t,e){return t.getLayout().value-e.getLayout().value});var a=i[0].getLayout().value,r=i[i.length-1].getLayout().value;o.each(i,function(e){var i=new n({type:"color",mappingMethod:"linear",dataExtent:[a,r],visual:t.get("color")}),o=i.mapValueToVisual(e.getLayout().value);e.setVisual("color",o);var s=e.getModel(),l=s.get("itemStyle.normal.color");null!=l&&e.setVisual("color",l)})})}},function(t,e,i){var n=i(2),o=i(1);i(249),i(338),i(339),n.registerLayout(i(340)),n.registerVisual(i(341)),n.registerProcessor(o.curry(i(63),"themeRiver"))},function(t,e,i){"use strict";var n=i(25),o=i(18),a=i(14),r=i(1),s=i(7),l=s.encodeHTML,u=i(262),h=2,c=o.extend({type:"series.themeRiver",dependencies:["singleAxis"],nameMap:null,init:function(t){c.superApply(this,"init",arguments),this.legendDataProvider=function(){return this.getRawData()}},fixData:function(t){for(var e=t.length,i=u().key(function(t){return t[2]}).entries(t),n=r.map(i,function(t){return{name:t.key,dataList:t.values}}),o=n.length,a=-1,s=-1,l=0;la&&(a=h,s=l)}for(var c=0;cr&&(r=e),o.push(e)}for(var h=0;hr&&(r=d)}return s.y0=a,s.max=r,s}var a=i(1),r=i(4);t.exports=function(t,e){t.eachSeriesByType("themeRiver",function(t){var e=t.getData(),i=t.coordinateSystem,o={},a=i.getRect();o.rect=a;var s=t.get("boundaryGap"),l=i.getAxis();if(o.boundaryGap=s,"horizontal"===l.orient){s[0]=r.parsePercent(s[0],a.height),s[1]=r.parsePercent(s[1],a.height);var u=a.height-s[0]-s[1];n(e,t,u)}else{s[0]=r.parsePercent(s[0],a.width),s[1]=r.parsePercent(s[1],a.width);var h=a.width-s[0]-s[1];n(e,t,h)}e.setLayout("layoutInfo",o)})}},function(t,e){t.exports=function(t){t.eachSeriesByType("themeRiver",function(t){var e=t.getData(),i=t.getRawData(),n=t.get("color");e.each(function(o){var a=e.getName(o),r=n[(t.nameMap[a]-1)%n.length];i.setItemVisual(o,"color",r)})})}},function(t,e,i){var n=i(2);i(344),i(345),i(346),n.registerVisual(i(348)),n.registerLayout(i(347))},function(t,e,i){function n(t){this.group=new r.Group,t.add(this.group)}function o(t,e,i,n,o,a){var r=[[o?t:t-d,e],[t+i,e],[t+i,e+n],[o?t:t-d,e+n]];return!a&&r.splice(2,0,[t+i+d,e+n/2]),!o&&r.push([t,e+n/2]),r}function a(t,e,i){t.eventData={componentType:"series",componentSubType:"treemap",seriesIndex:e.componentIndex,seriesName:e.name,seriesType:"treemap",selfType:"breadcrumb",nodeData:{dataIndex:i&&i.dataIndex,name:i&&i.name},treePathInfo:i&&u.wrapTreePathInfo(i,e)}}var r=i(3),s=i(12),l=i(1),u=i(92),h=8,c=8,d=5;n.prototype={constructor:n,render:function(t,e,i,n){var o=t.getModel("breadcrumb"),a=this.group;if(a.removeAll(),o.get("show")&&i){var r=o.getModel("itemStyle.normal"),l=r.getModel("textStyle"),u={pos:{left:o.get("left"),right:o.get("right"),top:o.get("top"),bottom:o.get("bottom")},box:{width:e.getWidth(),height:e.getHeight()},emptyItemWidth:o.get("emptyItemWidth"),totalWidth:0,renderList:[]};this._prepare(i,u,l),this._renderContent(t,u,r,l,n),s.positionElement(a,u.pos,u.box)}},_prepare:function(t,e,i){for(var n=t;n;n=n.parentNode){var o=n.getModel().get("name"),a=i.getTextRect(o),r=Math.max(a.width+2*h,e.emptyItemWidth);e.totalWidth+=r+c,e.renderList.push({node:n,text:o,width:r})}},_renderContent:function(t,e,i,n,u){for(var h=0,d=e.emptyItemWidth,f=t.get("breadcrumb.height"),p=s.getAvailableSize(e.pos,e.box),g=e.totalWidth,m=e.renderList,v=m.length-1;v>=0;v--){var y=m[v],x=y.node,_=y.width,b=y.text;g>p.width&&(g-=_-d,_=d,b="");var w=new r.Polygon({shape:{points:o(h,0,_,f,v===m.length-1,0===v)},style:l.defaults(i.getItemStyle(),{lineJoin:"bevel",text:b,textFill:n.getTextColor(),textFont:n.getFont()}),z:10,onclick:l.curry(u,x)});this.group.add(w),a(w,t,x),h+=_+c}},remove:function(){this.group.removeAll()}},t.exports=n},function(t,e,i){function n(t){var e=0;s.each(t.children,function(t){n(t);var i=t.value;s.isArray(i)&&(i=i[0]),e+=i});var i=t.value;s.isArray(i)&&(i=i[0]),(null==i||isNaN(i))&&(i=e),i<0&&(i=0),s.isArray(t.value)?t.value[0]=i:t.value=i}function o(t,e){var i=e.get("color");if(i){t=t||[];var n;if(s.each(t,function(t){var e=new l(t),i=e.get("color");(e.get("itemStyle.normal.color")||i&&"none"!==i)&&(n=!0)}),!n){var o=t[0]||(t[0]={});o.color=i.slice()}return t}}var a=i(18),r=i(414),s=i(1),l=i(10),u=i(7),h=i(92),c=u.encodeHTML,d=u.addCommas;t.exports=a.extend({type:"series.treemap",layoutMode:"box",dependencies:["grid","polar"],_viewRoot:null,defaultOption:{progressive:0,hoverLayerThreshold:1/0,left:"center",top:"middle",right:null,bottom:null,width:"80%",height:"80%",sort:!0,clipWindow:"origin",squareRatio:.5*(1+Math.sqrt(5)),leafDepth:null,drillDownIcon:"▶",zoomToNodeRatio:.1024,roam:!0,nodeClick:"zoomToNode",animation:!0,animationDurationUpdate:900,animationEasing:"quinticInOut",breadcrumb:{show:!0,height:22,left:"center",top:"bottom",emptyItemWidth:25,itemStyle:{normal:{color:"rgba(0,0,0,0.7)",borderColor:"rgba(255,255,255,0.7)",borderWidth:1,shadowColor:"rgba(150,150,150,1)",shadowBlur:3,shadowOffsetX:0,shadowOffsetY:0,textStyle:{color:"#fff"}},emphasis:{textStyle:{}}}},label:{normal:{show:!0,position:"inside",textStyle:{color:"#fff",ellipsis:!0}}},itemStyle:{normal:{color:null,colorAlpha:null,colorSaturation:null,borderWidth:0,gapWidth:0,borderColor:"#fff",borderColorSaturation:null},emphasis:{}},visualDimension:0,visualMin:null,visualMax:null,color:[],colorAlpha:null,colorSaturation:null,colorMappingBy:"index",visibleMin:10,childrenVisibleMin:null,levels:[]},getInitialData:function(t,e){var i=t.name;null==i&&(i=t.name);var a={name:i,children:t.data};n(a);var s=t.levels||[];return s=t.levels=o(s,e),r.createTree(a,this,s).data},optionUpdated:function(){this.resetViewRoot()},formatTooltip:function(t){var e=this.getData(),i=this.getRawValue(t),n=d(s.isArray(i)?i[0]:i),o=e.getName(t);return c(o+": "+n)},getDataParams:function(t){var e=a.prototype.getDataParams.apply(this,arguments),i=this.getData().tree.getNodeByDataIndex(t);return e.treePathInfo=h.wrapTreePathInfo(i,this),e},setLayoutInfo:function(t){this.layoutInfo=this.layoutInfo||{},s.extend(this.layoutInfo,t)},mapIdToIndex:function(t){var e=this._idIndexMap;e||(e=this._idIndexMap={},this._idIndexMapCount=0);var i=e[t];return null==i&&(e[t]=i=this._idIndexMapCount++),i},getViewRoot:function(){return this._viewRoot},resetViewRoot:function(t){t?this._viewRoot=t:t=this._viewRoot;var e=this.getData().tree.root;t&&(t===e||e.contains(t))||(this._viewRoot=e)}})},function(t,e,i){function n(){return{nodeGroup:[],background:[],content:[]}}function o(t,e,i,n,o,l,u,h,c,d){function f(e){R.dataIndex=u.dataIndex,R.seriesIndex=t.seriesIndex;var i=T.borderWidth,n=Math.max(A-2*i,0),o=Math.max(L-2*i,0);R.culling=!0,R.setShape({x:i,y:i,width:n,height:o});var a=u.getVisual("color",!0);p(R,function(){var t={fill:a},e=u.getModel("itemStyle.emphasis").getItemStyle();g(t,e,a,n,o),R.setStyle(t),s.setHoverStyle(R,e)}),e.add(R)}function p(t,e){C?!t.invisible&&l.push(t):(e(),t.__tmWillVisible||(t.invisible=!1))}function g(e,i,n,o,a){var r=u.getModel(),s=r.get("name");if(T.isLeafRoot){var l=t.get("drillDownIcon",!0);s=l?l+" "+s:s}y(s,e,r,_,n,o,a),y(s,i,r,b,n,o,a)}function y(t,e,i,n,o,a,r){var l=i.getModel(n),u=l.getModel("textStyle");s.setText(e,l,o),e.textAlign=u.get("align"),e.textVerticalAlign=u.get("baseline");var h=u.getTextRect(t);!l.getShallow("show")||h.height>r?e.text="":h.width>a?e.text=u.get("ellipsis")?u.truncateText(t,a,null,{minChar:2}):"":e.text=t}function x(t,n,r,s){var l=null!=P&&i[t][P],u=o[t];return l?(i[t][P]=null,w(u,l,t)):C||(l=new n({z:a(r,s)}),l.__tmDepth=r,l.__tmStorageName=t,I(u,l,t)),e[t][D]=l}function w(t,e,i){var n=t[D]={};n.old="nodeGroup"===i?e.position.slice():r.extend({},e.shape)}function I(t,e,i){var a=t[D]={},r=u.parentNode;if(r&&(!n||"drillDown"===n.direction)){var s=0,l=0,h=o.background[r.getRawIndex()];!n&&h&&h.old&&(s=h.old.width,l=h.old.height),a.old="nodeGroup"===i?[0,l]:{x:s,y:l,width:0,height:0}}a.fadein="nodeGroup"!==i}if(u){var T=u.getLayout();if(T&&T.isInView){var A=T.width,L=T.height,C=T.invisible,D=u.getRawIndex(),P=h&&h.getRawIndex(),k=x("nodeGroup",m);if(k){if(c.add(k),k.attr("position",[T.x||0,T.y||0]),k.__tmNodeWidth=A,k.__tmNodeHeight=L,T.isAboveViewRoot)return k;var O=x("background",v,d,S);O&&(O.setShape({x:0,y:0,width:A,height:L}),p(O,function(){O.setStyle("fill",u.getVisual("borderColor",!0))}),k.add(O));var z=u.viewChildren;if(!z||!z.length){var R=x("content",v,d,M);R&&f(k)}return k}}}}function a(t,e){var i=t*w+e;return(i-1)/i}var r=i(1),s=i(3),l=i(48),u=i(92),h=i(343),c=i(94),d=i(11),f=i(19),p=i(415),g=r.bind,m=s.Group,v=s.Rect,y=r.each,x=3,_=["label","normal"],b=["label","emphasis"],w=10,S=1,M=2;t.exports=i(2).extendChartView({type:"treemap",init:function(t,e){this._containerGroup,this._storage=n(),this._oldTree,this._breadcrumb,this._controller,this._state="ready",this._mayClick},render:function(t,e,i,n){var o=e.findComponents({mainType:"series",subType:"treemap",query:n});if(!(r.indexOf(o,t)<0)){this.seriesModel=t,this.api=i,this.ecModel=e;var a=u.retrieveTargetInfo(n,t),s=n&&n.type,l=t.layoutInfo,h=!this._oldTree,c=this._storage,d="treemapRootToNode"===s&&a&&c?{rootNodeGroup:c.nodeGroup[a.node.getRawIndex()],direction:n.direction}:null,f=this._giveContainerGroup(l),p=this._doRender(f,t,d);h||s&&"treemapZoomToNode"!==s&&"treemapRootToNode"!==s?p.renderFinally():this._doAnimation(f,p,t,d),this._resetController(i),this._renderBreadcrumb(t,i,a)}},_giveContainerGroup:function(t){var e=this._containerGroup;return e||(e=this._containerGroup=new m,this._initEvents(e),this.group.add(e)),e.attr("position",[t.x,t.y]),e},_doRender:function(t,e,i){function a(t,e,i,n,o){function s(t){return t.getId()}function u(r,s){var l=null!=r?t[r]:null,u=null!=s?e[s]:null,h=m(l,u,i,o);h&&a(l&&l.viewChildren||[],u&&u.viewChildren||[],h,n,o+1)}n?(e=t,y(t,function(t,e){!t.isRemoved()&&u(e,e)})):new l(e,t,s,s).add(u).update(u).remove(r.curry(u,null)).execute()}function s(t){var e=n();return t&&y(t,function(t,i){var n=e[i];y(t,function(t){t&&(n.push(t),t.__tmWillDelete=1)})}),e}function u(){y(v,function(t){y(t,function(t){t.parent&&t.parent.remove(t)})}),y(g,function(t){t.invisible=!0,t.dirty()})}var h=e.getData().tree,c=this._oldTree,d=n(),f=n(),p=this._storage,g=[],m=r.curry(o,e,f,p,i,d,g);a(h.root?[h.root]:[],c&&c.root?[c.root]:[],t,h===c||!c,0);var v=s(p);return this._oldTree=h,this._storage=f,{lastsForAnimation:d,willDeleteEls:v,renderFinally:u}},_doAnimation:function(t,e,i,n){if(i.get("animation")){var o=i.get("animationDurationUpdate"),a=i.get("animationEasing"),s=p.createWrap();y(e.willDeleteEls,function(t,e){y(t,function(t,i){if(!t.invisible){var r,l=t.parent;if(n&&"drillDown"===n.direction)r=l===n.rootNodeGroup?{shape:{x:0,y:0,width:l.__tmNodeWidth,height:l.__tmNodeHeight},style:{opacity:0}}:{style:{opacity:0}};else{var u=0,h=0;l.__tmWillDelete||(u=l.__tmNodeWidth/2,h=l.__tmNodeHeight/2),r="nodeGroup"===e?{position:[u,h],style:{opacity:0}}:{shape:{x:u,y:h,width:0,height:0},style:{opacity:0}}}r&&s.add(t,r,o,a)}})}),y(this._storage,function(t,i){y(t,function(t,n){var l=e.lastsForAnimation[i][n],u={};l&&("nodeGroup"===i?l.old&&(u.position=t.position.slice(),t.attr("position",l.old)):(l.old&&(u.shape=r.extend({},t.shape),t.setShape(l.old)),l.fadein?(t.setStyle("opacity",0),u.style={opacity:1}):1!==t.style.opacity&&(u.style={opacity:1})),s.add(t,u,o,a))})},this),this._state="animating",s.done(g(function(){this._state="ready",e.renderFinally()},this)).start()}},_resetController:function(t){var e=this._controller;e||(e=this._controller=new c(t.getZr()),e.enable(this.seriesModel.get("roam")),e.on("pan",g(this._onPan,this)),e.on("zoom",g(this._onZoom,this)));var i=new d(0,0,t.getWidth(),t.getHeight());e.setContainsPoint(function(t,e){return i.contain(t,e)})},_clearController:function(){var t=this._controller;t&&(t.dispose(),t=null)},_onPan:function(t,e){if(this._mayClick=!1,"animating"!==this._state&&(Math.abs(t)>x||Math.abs(e)>x)){var i=this.seriesModel.getData().tree.root;if(!i)return;var n=i.getLayout();if(!n)return;this.api.dispatchAction({type:"treemapMove",from:this.uid,seriesId:this.seriesModel.id,rootRect:{x:n.x+t,y:n.y+e,width:n.width,height:n.height}})}},_onZoom:function(t,e,i){if(this._mayClick=!1,"animating"!==this._state){var n=this.seriesModel.getData().tree.root;if(!n)return;var o=n.getLayout();if(!o)return;var a=new d(o.x,o.y,o.width,o.height),r=this.seriesModel.layoutInfo;e-=r.x,i-=r.y;var s=f.create();f.translate(s,s,[-e,-i]),f.scale(s,s,[t,t]),f.translate(s,s,[e,i]),a.applyTransform(s),this.api.dispatchAction({type:"treemapRender",from:this.uid,seriesId:this.seriesModel.id,rootRect:{x:a.x,y:a.y,width:a.width,height:a.height}})}},_initEvents:function(t){function e(t){var e=this.seriesModel.get("nodeClick",!0);if(e){var i=this.findTarget(t.offsetX,t.offsetY);if(i){var n=i.node;if(n.getLayout().isLeafRoot)this._rootToNode(i);else if("zoomToNode"===e)this._zoomToNode(i);else if("link"===e){var o=n.hostTree.data.getItemModel(n.dataIndex),a=o.get("link",!0),r=o.get("target",!0)||"blank";a&&window.open(a,r)}}}}t.on("mousedown",function(t){"ready"===this._state&&(this._mayClick=!0)},this),t.on("mouseup",function(t){this._mayClick&&(this._mayClick=!1,"ready"===this._state&&e.call(this,t))},this)},_renderBreadcrumb:function(t,e,i){function n(e){"animating"!==this._state&&(u.aboveViewRoot(t.getViewRoot(),e)?this._rootToNode({node:e}):this._zoomToNode({node:e}))}i||(i=null!=t.get("leafDepth",!0)?{node:t.getViewRoot()}:this.findTarget(e.getWidth()/2,e.getHeight()/2),i||(i={node:t.getData().tree.root})),(this._breadcrumb||(this._breadcrumb=new h(this.group))).render(t,e,i.node,g(n,this))},remove:function(){this._clearController(),this._containerGroup&&this._containerGroup.removeAll(),this._storage=n(),this._state="ready",this._breadcrumb&&this._breadcrumb.remove()},dispose:function(){this._clearController()},_zoomToNode:function(t){this.api.dispatchAction({type:"treemapZoomToNode",from:this.uid,seriesId:this.seriesModel.id,targetNode:t.node})},_rootToNode:function(t){this.api.dispatchAction({type:"treemapRootToNode",from:this.uid,seriesId:this.seriesModel.id,targetNode:t.node})},findTarget:function(t,e){var i,n=this.seriesModel.getViewRoot();return n.eachNode({attr:"viewChildren",order:"preorder"},function(n){var o=this._storage.background[n.getRawIndex()];if(o){var a=o.transformCoordToLocal(t,e),r=o.shape;if(!(r.x<=a[0]&&a[0]<=r.x+r.width&&r.y<=a[1]&&a[1]<=r.y+r.height))return!1;i={node:n,offsetX:a[0],offsetY:a[1]}}},this),i}})},function(t,e,i){for(var n=i(2),o=i(92),a=function(){},r=["treemapZoomToNode","treemapRender","treemapMove"],s=0;s=0;l--){var u=o["asc"===n?r-l-1:l].getValue();u/i*er[1]&&(r[1]=e)})}else r=[NaN,NaN];return{sum:n,dataExtent:r}}function u(t,e,i){for(var n,o=0,a=1/0,r=0,s=t.length;ro&&(o=n));var l=t.area*t.area,u=e*e*i;return l?x(u*o/l,l/(u*a)):1/0}function h(t,e,i,n,o){var a=e===i.width?0:1,r=1-a,s=["x","y"],l=["width","height"],u=i[s[a]],h=e?t.area/e:0;(o||h>i[l[r]])&&(h=i[l[r]]);for(var c=0,d=t.length;cg.MAX_SAFE_INTEGER&&(u=g.MAX_SAFE_INTEGER),a=s}u=u.length||t===u[t.depth]){var o=h(d,x,t,e,S,c);n(t,o,i,s,u,c)}})}else m=a(x,t),t.setVisual("color",m)}}function o(t,e,i,n){var o=f.extend({},e);return f.each(["color","colorAlpha","colorSaturation"],function(a){var r=t.get(a,!0);null==r&&i&&(r=i[a]),null==r&&(r=e[a]),null==r&&(r=n.get(a)),null!=r&&(o[a]=r)}),o}function a(t){var e=s(t,"color");if(e){var i=s(t,"colorAlpha"),n=s(t,"colorSaturation");return n&&(e=d.modifyHSL(e,null,null,n)),i&&(e=d.modifyAlpha(e,i)),e}}function r(t,e){return null!=e?d.modifyHSL(e,null,null,t):null}function s(t,e){var i=t[e];if(null!=i&&"none"!==i)return i}function l(t,e,i,n,o,a){if(a&&a.length){var r=u(e,"color")||null!=o.color&&"none"!==o.color&&(u(e,"colorAlpha")||u(e,"colorSaturation"));if(r){var s=e.get("visualMin"),l=e.get("visualMax"),h=i.dataExtent.slice();null!=s&&sh[1]&&(h[1]=l);var d=e.get("colorMappingBy"),f={type:r.name,dataExtent:h,visual:r.range};"color"!==f.type||"index"!==d&&"id"!==d?f.mappingMethod="linear":(f.mappingMethod="category",f.loop=!0);var p=new c(f);return p.__drColorMappingBy=d,p}}}function u(t,e){var i=t.get(e);return p(i)&&i.length?{name:e,range:i}:null}function h(t,e,i,n,o,a){var r=f.extend({},e);if(o){var s=o.type,l="color"===s&&o.__drColorMappingBy,u="index"===l?n:"id"===l?a.mapIdToIndex(i.getId()):i.getValue(t.get("visualDimension"));r[s]=o.mapValueToVisual(u)}return r}var c=i(82),d=i(22),f=i(1),p=f.isArray,g="itemStyle.normal";t.exports=function(t,e,i){var o={mainType:"series",subType:"treemap",query:i};t.eachComponent(o,function(t){var e=t.getData().tree,i=e.root,o=t.getModel(g);if(!i.isRemoved()){var a=f.map(e.levelModels,function(t){return t?t.get(g):null});n(i,{},a,o,t.getViewRoot().getAncestors(),t)}})}},function(t,e,i){"use strict";i(233),i(350)},function(t,e,i){"use strict";function n(t,e,i,n){var o=t.coordToPoint([e,n]),a=t.coordToPoint([i,n]);return{x1:o[0],y1:o[1],x2:a[0],y2:a[1]}}var o=i(1),a=i(3),r=i(10),s=i(246),l=["axisLine","axisLabel","axisTick","splitLine","splitArea"];i(57).extend({type:"angleAxis",axisPointerClass:s,render:function(t,e){if(this.group.removeAll(),t.get("show")){var i=t.axis,n=i.polar,a=n.getRadiusAxis().getExtent(),r=i.getTicksCoords();"category"!==i.type&&r.pop(),o.each(l,function(e){!t.get(e+".show")||i.scale.isBlank()&&"axisLine"!==e||this["_"+e](t,n,r,a)},this)}},_axisLine:function(t,e,i,n){var o=t.getModel("axisLine.lineStyle"),r=new a.Circle({shape:{cx:e.cx,cy:e.cy,r:n[1]},style:o.getLineStyle(),z2:1,silent:!0});r.style.fill=null,this.group.add(r)},_axisTick:function(t,e,i,r){var s=t.getModel("axisTick"),l=(s.get("inside")?-1:1)*s.get("length"),u=o.map(i,function(t){return new a.Line({shape:n(e,r[1],r[1]+l,t)})});this.group.add(a.mergePath(u,{style:o.defaults(s.getModel("lineStyle").getLineStyle(),{stroke:t.get("axisLine.lineStyle.color")})}))},_axisLabel:function(t,e,i,n){for(var o=t.axis,s=t.get("data"),l=t.getModel("axisLabel"),u=l.getModel("textStyle"),h=t.getFormattedLabels(),c=l.get("margin"),d=o.getLabelsCoords(),f=0;fm?"left":"right",x=Math.abs(g[1]-v)/p<.3?"middle":g[1]>v?"top":"bottom",_=u;s&&s[f]&&s[f].textStyle&&(_=new r(s[f].textStyle,u)),this.group.add(new a.Text({style:{x:g[0],y:g[1],fill:_.getTextColor()||t.get("axisLine.lineStyle.color"),text:h[f],textAlign:y,textVerticalAlign:x,textFont:_.getFont()},silent:!0}))}},_splitLine:function(t,e,i,r){var s=t.getModel("splitLine"),l=s.getModel("lineStyle"),u=l.get("color"),h=0;u=u instanceof Array?u:[u];for(var c=[],d=0;d=v[1])&&(h=!1);var y=o.extend({axisLabelShow:h,strokeContainThreshold:f},g),x=new a(t,y);o.each(l,x.add,x),this._axisGroup.add(x.getGroup()),this._refreshBrushController(y,d,t,f),s.groupTransition(u,this._axisGroup,t)}}},_refreshBrushController:function(t,e,i,n){var a=i.axis,r=o.map(i.activeIntervals,function(t){return{brushType:"lineX",panelId:"pl",range:[a.dataToCoord(t[0],!0),a.dataToCoord(t[1],!0)]}}),l=a.getExtent(),u=l[1]-l[0],h=Math.min(30,.1*Math.abs(u)),c=s.BoundingRect.create({x:l[0],y:-n/2,width:u,height:n});c.x-=h,c.width+=2*h,this._brushController.mount({enableGlobalPan:!0,rotation:t.rotation,position:t.position}).setPanels([{panelId:"pl",rect:c}]).enableBrush({brushType:"lineX",brushStyle:e,removeOnClick:!0}).updateCovers(r)},_onBrush:function(t,e){var i=this.axisModel,n=i.axis,a=o.map(t,function(t){return[n.coordToData(t.range[0],!0),n.coordToData(t.range[1],!0)]});(!i.option.realtime===e.isEnd||e.removeOnClick)&&this.api.dispatchAction({type:"axisAreaSelect",parallelAxisId:i.id,intervals:a})},dispose:function(){this._brushController.dispose()}});t.exports=u},function(t,e,i){"use strict";function n(t,e,i){return{position:[t.cx,t.cy],rotation:i/180*Math.PI,labelDirection:-1,tickDirection:-1,nameDirection:1,labelRotate:e.getModel("axisLabel").get("rotate"),z2:1}}var o=i(1),a=i(3),r=i(37),s=i(246),l=["axisLine","axisLabel","axisTick","axisName"],u=["splitLine","splitArea"];i(57).extend({type:"radiusAxis",axisPointerClass:s,render:function(t,e){if(this.group.removeAll(),t.get("show")){var i=t.axis,a=i.polar,s=a.getAngleAxis(),h=i.getTicksCoords(),c=s.getExtent()[0],d=i.getExtent(),f=n(a,t,c),p=new r(t,f);o.each(l,p.add,p),this.group.add(p.getGroup()),o.each(u,function(e){t.get(e+".show")&&!i.scale.isBlank()&&this["_"+e](t,a,c,d,h)},this)}},_splitLine:function(t,e,i,n,r){var s=t.getModel("splitLine"),l=s.getModel("lineStyle"),u=l.get("color"),h=0;u=u instanceof Array?u:[u];for(var c=[],d=0;d1)return!1;var d=l(i-t,o-t,n-e,a-e)/h;return!(d<0||d>1)}function s(t){return t<=1e-6&&t>=-1e-6}function l(t,e,i,n){return t*n-e*i}var u=i(264).contain,h=i(11),c={lineX:n(0),lineY:n(1),rect:{point:function(t,e,i){return i.boundingRect.contain(t[0],t[1])},rect:function(t,e,i){return i.boundingRect.intersect(t)}},polygon:{point:function(t,e,i){return i.boundingRect.contain(t[0],t[1])&&u(i.range,t[0],t[1])},rect:function(t,e,i){var n=i.range;if(n.length<=1)return!1;var o=t.x,r=t.y,s=t.width,l=t.height,c=n[0];return!!(u(n,o,r)||u(n,o+s,r)||u(n,o,r+l)||u(n,o+s,r+l)||h.create(t).contain(c[0],c[1])||a(o,r,o+s,r,n)||a(o,r,o,r+l,n)||a(o+s,r,o+s,r+l,n)||a(o,r+l,o+s,r+l,n))||void 0}}};t.exports=c},function(t,e,i){function n(t,e,i,n,a){if(a){var r=t.getZr();if(!r[x]){r[y]||(r[y]=o);var s=g.createOrUpdate(r,y,i,e);s(t,n)}}}function o(t,e){if(!t.isDisposed()){var i=t.getZr();i[x]=!0,t.dispatchAction({type:"brushSelect",batch:e}),i[x]=!1}}function a(t,e,i,n){for(var o=i.getItemLayout(n),a=0,r=e.length;ae[0][1]&&(e[0][1]=a[0]),a[1]e[1][1]&&(e[1][1]=a[1])}return e&&u(e)}}},function(t,e,i){"use strict";i(389),i(390),i(364)},function(t,e,i){"use strict";var n=i(1),o=i(3),a=i(7),r=i(4),s={EN:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],CN:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]},l={EN:["S","M","T","W","T","F","S"],CN:["日","一","二","三","四","五","六"]};t.exports=i(2).extendComponentView({type:"calendar",_tlpoints:null,_blpoints:null,_firstDayOfMonth:null,_firstDayPoints:null,render:function(t,e,i){var n=this.group;n.removeAll();var o=t.coordinateSystem,a=o.getHandledRangeInfo(),r=o.getOrient();this._renderDayRect(t,a,n),this._renderLines(t,a,r,n),this._renderYearText(t,a,r,n),this._renderMonthText(t,r,n),this._renderWeekText(t,a,r,n)},_renderDayRect:function(t,e,i){for(var n=t.coordinateSystem,a=t.getModel("itemStyle.normal").getItemStyle(),r=n.getCellWidth(),s=n.getCellHeight(),l=e.start.time;l<=e.end.time;l=n.getNextNDay(l,1).time){var u=n.dataToRect([l],!0).tl,h=new o.Rect({shape:{x:u[0],y:u[1],width:r,height:s},style:a});i.add(h)}},_renderLines:function(t,e,i,n){function o(e){a._firstDayOfMonth.push(r.getDateInfo(e)),a._firstDayPoints.push(r.dataToRect([e],!0).tl);var o=a._getLinePointsOfOneWeek(t,e,i);a._tlpoints.push(o[0]),a._blpoints.push(o[o.length-1]),l&&a._drawSplitline(o,s,n)}var a=this,r=t.coordinateSystem,s=t.getModel("splitLine.lineStyle").getLineStyle(),l=t.get("splitLine.show"),u=s.lineWidth;this._tlpoints=[],this._blpoints=[],this._firstDayOfMonth=[],this._firstDayPoints=[];for(var h=e.start,c=0;h.time<=e.end.time;c++){o(h.formatedDate),0===c&&(h=r.getDateInfo(e.start.y+"-"+e.start.m));var d=h.date;d.setMonth(d.getMonth()+1),h=r.getDateInfo(d)}o(r.getNextNDay(e.end.time,1).formatedDate),l&&this._drawSplitline(a._getEdgesPoints(a._tlpoints,u,i),s,n),l&&this._drawSplitline(a._getEdgesPoints(a._blpoints,u,i),s,n)},_getEdgesPoints:function(t,e,i){var n=[t[0].slice(),t[t.length-1].slice()],o="horizontal"===i?0:1;return n[0][o]=n[0][o]-e/2,n[1][o]=n[1][o]+e/2,n},_drawSplitline:function(t,e,i){var n=new o.Polyline({z2:20,shape:{points:t},style:e});i.add(n)},_getLinePointsOfOneWeek:function(t,e,i){var n=t.coordinateSystem;e=n.getDateInfo(e);for(var o=[],a=0;a<7;a++){var r=n.getNextNDay(e.time,a),s=n.dataToRect([r.time],!0);o[2*r.day]=s.tl,o[2*r.day+1]=s["horizontal"===i?"bl":"tr"]}return o},_formatterLabel:function(t,e){return"string"==typeof t&&t?a.formatTplSimple(t,e):"function"==typeof t?t(e):e.nameMap},_yearTextPositionControl:function(t,e,i,n){t=t.slice();var o=["center","bottom"];"top"===i&&(t[1]-=n),"bottom"===i&&(t[1]+=n,o=["center","top"]),"left"===i&&(t[0]-=n),"right"===i&&(t[0]+=n,o=["center","top"]);var a=0;return"left"!==i&&"right"!==i||(a=Math.PI/2),{rotation:a,origin:t,style:{x:t[0],y:t[1],textAlign:o[0],textVerticalAlign:o[1]}}},_renderYearText:function(t,e,i,a){var r=t.getModel("yearLabel");if(r.get("show")){var s=t.getModel("yearLabel.textStyle"),l=r.get("margin"),u=r.get("position");u||(u="horizontal"!==i?"top":"left");var h=[this._tlpoints[this._tlpoints.length-1],this._blpoints[0]],c=(h[0][0]+h[1][0])/2,d=(h[0][1]+h[1][1])/2,f="horizontal"===i?0:1,p={top:[c,h[f][1]],bottom:[c,h[1-f][1]],left:[h[1-f][0],d],right:[h[f][0],d]},g=e.start.y;+e.end.y>+e.start.y&&(g=g+"-"+e.end.y);var m=r.get("formatter"),v={start:e.start.y,end:e.end.y,nameMap:g},y=this._formatterLabel(m,v),x=new o.Text(n.merge({z2:30,style:{text:y,font:s.getFont(),fill:s.getTextColor()}},this._yearTextPositionControl(p[u],i,u,l)));a.add(x)}},_monthTextPositionControl:function(t,e,i,n,o){var a="left",r="top",s=t[0],l=t[1];return"horizontal"===i?(l+=o,e&&(a="center"),"start"===n&&(r="bottom")):(s+=o,e&&(r="middle"),"start"===n&&(a="right")),{x:s,y:l,textAlign:a,textVerticalAlign:r}},_renderMonthText:function(t,e,i){var a=t.getModel("monthLabel");if(a.get("show")){var r=t.getModel("monthLabel.textStyle"),l=a.get("nameMap"),u=a.get("margin"),h=a.get("position"),c=a.get("align"),d=[this._tlpoints,this._blpoints];n.isString(l)&&(l=s[l.toUpperCase()]||[]);var f="start"===h?0:1,p="horizontal"===e?0:1;u="start"===h?-u:u;for(var g="center"===c,m=0;m=0||"+"===i?"left":"right"},s={horizontal:i>=0||"+"===i?"top":"bottom",vertical:"middle"},l={horizontal:0,vertical:b/2},u="vertical"===o?a.height:a.width,h=t.getModel("controlStyle"),c=h.get("show"),d=c?h.get("itemSize"):0,f=c?h.get("itemGap"):0,p=d+f,g=t.get("label.normal.rotate")||0;g=g*b/180;var m,v,y,x,_=h.get("position",!0),c=h.get("show",!0),w=c&&h.get("showPlayBtn",!0),S=c&&h.get("showPrevBtn",!0),M=c&&h.get("showNextBtn",!0),I=0,T=u;return"left"===_||"bottom"===_?(w&&(m=[0,0],I+=p),S&&(v=[I,0],I+=p),M&&(y=[T-d,0],T-=p)):(w&&(m=[T-d,0],T-=p),S&&(v=[0,0],I+=p),M&&(y=[T-d,0],T-=p)),x=[I,T],t.get("inverse")&&x.reverse(),{viewRect:a,mainLength:u,orient:o,rotation:l[o],labelRotation:g,labelPosOpt:i,labelAlign:r[o],labelBaseline:s[o],playPosition:m,prevBtnPosition:v,nextBtnPosition:y,axisExtent:x,controlSize:d,controlGap:f}},_position:function(t,e){function i(t){var e=t.position;t.origin=[c[0][0]-e[0],c[1][0]-e[1]]}function n(t){return[[t.x,t.x+t.width],[t.y,t.y+t.height]]}function o(t,e,i,n,o){t[n]+=i[n][o]-e[n][o]}var a=this._mainGroup,r=this._labelGroup,s=t.viewRect;if("vertical"===t.orient){var l=g.create(),u=s.x,h=s.y+s.height;g.translate(l,l,[-u,-h]),g.rotate(l,l,-b/2),g.translate(l,l,[u,h]),s=s.clone(),s.applyTransform(l)}var c=n(s),d=n(a.getBoundingRect()),f=n(r.getBoundingRect()),p=a.position,m=r.position;m[0]=p[0]=c[0][0];var v=t.labelPosOpt;if(isNaN(v)){var y="+"===v?0:1;o(p,d,c,1,y),o(m,f,c,1,1-y)}else{var y=v>=0?0:1;o(p,d,c,1,y),m[1]=p[1]+v}a.attr("position",p),r.attr("position",m),a.rotation=r.rotation=t.rotation,i(a),i(r)},_createAxis:function(t,e){var i=e.getData(),n=e.get("axisType"),o=f.createScaleByModel(e,n),a=i.getDataExtent("value");o.setExtent(a[0],a[1]),this._customizeScale(o,i),o.niceTicks();var r=new c("value",o,t.axisExtent,n);return r.model=e,r},_customizeScale:function(t,e){t.getTicks=function(){return e.mapArray(["value"],function(t){return t})},t.getTicksLabels=function(){return s.map(this.getTicks(),t.getLabel,t)}},_createGroup:function(t){var e=this["_"+t]=new l.Group;return this.group.add(e),e},_renderAxisLine:function(t,e,i,n){var o=i.getExtent();n.get("lineStyle.show")&&e.add(new l.Line({shape:{x1:o[0],y1:0,x2:o[1],y2:0},style:s.extend({lineCap:"round"},n.getModel("lineStyle").getLineStyle()),silent:!0,z2:1}))},_renderAxisTick:function(t,e,i,n){var o=n.getData(),r=i.scale.getTicks();_(r,function(t,r){var s=i.dataToCoord(t),u=o.getItemModel(r),h=u.getModel("itemStyle.normal"),c=u.getModel("itemStyle.emphasis"),d={position:[s,0],onclick:x(this._changeTimeline,this,r)},f=a(u,h,e,d);l.setHoverStyle(f,c.getItemStyle()),u.get("tooltip")?(f.dataIndex=r,f.dataModel=n):f.dataIndex=f.dataModel=null},this)},_renderAxisLabel:function(t,e,i,n){var o=n.getModel("label.normal");if(o.get("show")){var a=n.getData(),r=i.scale.getTicks(),s=f.getFormattedLabels(i,o.get("formatter")),u=i.getLabelInterval();_(r,function(n,o){if(!i.isLabelIgnored(o,u)){var r=a.getItemModel(o),h=r.getModel("label.normal.textStyle"),c=r.getModel("label.emphasis.textStyle"),d=i.dataToCoord(n),f=new l.Text({style:{text:s[o],textAlign:t.labelAlign,textVerticalAlign:t.labelBaseline,textFont:h.getFont(),fill:h.getTextColor()},position:[d,0],rotation:t.labelRotation-t.rotation,onclick:x(this._changeTimeline,this,o),silent:!1});e.add(f),l.setHoverStyle(f,c.getItemStyle())}},this)}},_renderControl:function(t,e,i,n){function a(t,i,a,d){if(t){var f={position:t,origin:[r/2,0],rotation:d?-s:0,rectHover:!0,style:u,onclick:a},p=o(n,i,c,f);e.add(p),l.setHoverStyle(p,h)}}var r=t.controlSize,s=t.rotation,u=n.getModel("controlStyle.normal").getItemStyle(),h=n.getModel("controlStyle.emphasis").getItemStyle(),c=[0,-r/2,r,r],d=n.getPlayState(),f=n.get("inverse",!0);a(t.nextBtnPosition,"controlStyle.nextIcon",x(this._changeTimeline,this,f?"-":"+")),a(t.prevBtnPosition,"controlStyle.prevIcon",x(this._changeTimeline,this,f?"+":"-")),a(t.playPosition,"controlStyle."+(d?"stopIcon":"playIcon"),x(this._handlePlayClick,this,!d),!0)},_renderCurrentPointer:function(t,e,i,n){var o=n.getData(),s=n.getCurrentIndex(),l=o.getItemModel(s).getModel("checkpointStyle"),u=this,h={onCreate:function(t){t.draggable=!0,t.drift=x(u._handlePointerDrag,u),t.ondragend=x(u._handlePointerDragend,u),r(t,s,i,n,!0)},onUpdate:function(t){r(t,s,i,n)}};this._currentPointer=a(l,l,this._mainGroup,{},this._currentPointer,h)},_handlePlayClick:function(t){this._clearTimer(),this.api.dispatchAction({type:"timelinePlayChange",playState:t,from:this.uid})},_handlePointerDrag:function(t,e,i){this._clearTimer(),this._pointerChangeTimeline([i.offsetX,i.offsetY])},_handlePointerDragend:function(t){this._pointerChangeTimeline([t.offsetX,t.offsetY],!0)},_pointerChangeTimeline:function(t,e){var i=this._toAxisCoord(t)[0],n=this._axis,o=m.asc(n.getExtent().slice());i>o[1]&&(i=o[1]),i=e&&(t=e-1),t<0&&(t=0)),this.option.currentIndex=t},getCurrentIndex:function(){return this.option.currentIndex},isIndexMax:function(){return this.getCurrentIndex()>=this._data.count()-1},setPlayState:function(t){this.option.autoPlay=!!t},getPlayState:function(){return!!this.option.autoPlay},_initData:function(){var t=this.option,e=t.data||[],i=t.axisType,n=this._names=[];if("category"===i){var s=[];a.each(e,function(t,e){var i,o=r.getDataItemValue(t);a.isObject(t)?(i=a.clone(t),i.value=e):i=e,s.push(i),a.isString(o)||null!=o&&!isNaN(o)||(o=""),n.push(o+"")}),e=s}var l={category:"ordinal",time:"time"}[i]||"number",u=this._data=new o([{name:"value",type:l}],this);u.initData(e,n)},getData:function(){return this._data},getCategories:function(){if("category"===this.get("axisType"))return this._names.slice()}});t.exports=s},function(t,e,i){var n=i(64);t.exports=n.extend({type:"timeline"})},function(t,e,i){function n(t){var e=t.type,i={number:"value",time:"time"};if(i[e]&&(t.axisType=i[e],delete t.type),o(t),a(t,"controlPosition")){var n=t.controlStyle||(t.controlStyle={});a(n,"position")||(n.position=t.controlPosition),"none"!==n.position||a(n,"show")||(n.show=!1,delete n.position),delete t.controlPosition}r.each(t.data||[],function(t){r.isObject(t)&&!r.isArray(t)&&(!a(t,"value")&&a(t,"name")&&(t.value=t.name),o(t))})}function o(t){var e=t.itemStyle||(t.itemStyle={}),i=e.emphasis||(e.emphasis={}),n=t.label||t.label||{},o=n.normal||(n.normal={}),s={normal:1,emphasis:1};r.each(n,function(t,e){s[e]||a(o,e)||(o[e]=t)}),i.label&&!a(n,"emphasis")&&(n.emphasis=i.label,delete i.label)}function a(t,e){return t.hasOwnProperty(e)}var r=i(1);t.exports=function(t){var e=t&&t.timeline;r.isArray(e)||(e=e?[e]:[]),r.each(e,function(t){t&&n(t)})}},function(t,e,i){var n=i(2),o=i(1);n.registerAction({type:"timelineChange",event:"timelineChanged",update:"prepareAndUpdate"},function(t,e){var i=e.getComponent("timeline");return i&&null!=t.currentIndex&&(i.setCurrentIndex(t.currentIndex),!i.get("loop",!0)&&i.isIndexMax()&&i.setPlayState(!1)),e.resetOption("timeline"),o.defaults({currentIndex:i.option.currentIndex},t)}),n.registerAction({type:"timelinePlayChange",event:"timelinePlayChanged",update:"update"},function(t,e){var i=e.getComponent("timeline");i&&null!=t.playState&&i.setPlayState(t.playState)})},function(t,e,i){i(13).registerSubTypeDefaulter("timeline",function(){return"slider"})},function(t,e,i){"use strict";function n(t,e,i){this.model=t,this.ecModel=e,this.api=i,this._brushType,this._brushMode}var o=i(28),a=i(1);n.defaultOption={show:!0,type:["rect","polygon","lineX","lineY","keep","clear"],icon:{rect:"M7.3,34.7 M0.4,10V-0.2h9.8 M89.6,10V-0.2h-9.8 M0.4,60v10.2h9.8 M89.6,60v10.2h-9.8 M12.3,22.4V10.5h13.1 M33.6,10.5h7.8 M49.1,10.5h7.8 M77.5,22.4V10.5h-13 M12.3,31.1v8.2 M77.7,31.1v8.2 M12.3,47.6v11.9h13.1 M33.6,59.5h7.6 M49.1,59.5 h7.7 M77.5,47.6v11.9h-13",polygon:"M55.2,34.9c1.7,0,3.1,1.4,3.1,3.1s-1.4,3.1-3.1,3.1 s-3.1-1.4-3.1-3.1S53.5,34.9,55.2,34.9z M50.4,51c1.7,0,3.1,1.4,3.1,3.1c0,1.7-1.4,3.1-3.1,3.1c-1.7,0-3.1-1.4-3.1-3.1 C47.3,52.4,48.7,51,50.4,51z M55.6,37.1l1.5-7.8 M60.1,13.5l1.6-8.7l-7.8,4 M59,19l-1,5.3 M24,16.1l6.4,4.9l6.4-3.3 M48.5,11.6 l-5.9,3.1 M19.1,12.8L9.7,5.1l1.1,7.7 M13.4,29.8l1,7.3l6.6,1.6 M11.6,18.4l1,6.1 M32.8,41.9 M26.6,40.4 M27.3,40.2l6.1,1.6 M49.9,52.1l-5.6-7.6l-4.9-1.2",lineX:"M15.2,30 M19.7,15.6V1.9H29 M34.8,1.9H40.4 M55.3,15.6V1.9H45.9 M19.7,44.4V58.1H29 M34.8,58.1H40.4 M55.3,44.4 V58.1H45.9 M12.5,20.3l-9.4,9.6l9.6,9.8 M3.1,29.9h16.5 M62.5,20.3l9.4,9.6L62.3,39.7 M71.9,29.9H55.4",lineY:"M38.8,7.7 M52.7,12h13.2v9 M65.9,26.6V32 M52.7,46.3h13.2v-9 M24.9,12H11.8v9 M11.8,26.6V32 M24.9,46.3H11.8v-9 M48.2,5.1l-9.3-9l-9.4,9.2 M38.9-3.9V12 M48.2,53.3l-9.3,9l-9.4-9.2 M38.9,62.3V46.4",keep:"M4,10.5V1h10.3 M20.7,1h6.1 M33,1h6.1 M55.4,10.5V1H45.2 M4,17.3v6.6 M55.6,17.3v6.6 M4,30.5V40h10.3 M20.7,40 h6.1 M33,40h6.1 M55.4,30.5V40H45.2 M21,18.9h62.9v48.6H21V18.9z",clear:"M22,14.7l30.9,31 M52.9,14.7L22,45.7 M4.7,16.8V4.2h13.1 M26,4.2h7.8 M41.6,4.2h7.8 M70.3,16.8V4.2H57.2 M4.7,25.9v8.6 M70.3,25.9v8.6 M4.7,43.2v12.6h13.1 M26,55.8h7.8 M41.6,55.8h7.8 M70.3,43.2v12.6H57.2"},title:{rect:"矩形选择",polygon:"圈选",lineX:"横向选择",lineY:"纵向选择",keep:"保持选择",clear:"清除选择"}};var r=n.prototype;r.render=r.updateView=r.updateLayout=function(t,e,i){var n,o,r;e.eachComponent({mainType:"brush"},function(t){n=t.brushType,o=t.brushOption.brushMode||"single",r|=t.areas.length}),this._brushType=n,this._brushMode=o,a.each(t.get("type",!0),function(e){t.setIconStatus(e,("keep"===e?"multiple"===o:"clear"===e?r:e===n)?"emphasis":"normal")})},r.getIcons=function(){var t=this.model,e=t.get("icon",!0),i={};return a.each(t.get("type",!0),function(t){e[t]&&(i[t]=e[t])}),i},r.onclick=function(t,e,i){var e=this.api,n=this._brushType,o=this._brushMode;"clear"===i?e.dispatchAction({type:"brush",areas:[]}):e.dispatchAction({type:"takeGlobalCursor",key:"brush",brushOption:{brushType:"keep"===i?n:n!==i&&i,brushMode:"keep"===i?"multiple"===o?"single":"multiple":o}})},o.register("brush",n),t.exports=n},function(t,e,i){i(387),i(388)},function(t,e,i){function n(t,e,i){if(i[0]===i[1])return i.slice();for(var n=200,o=(i[1]-i[0])/n,a=i[0],r=[],s=0;s<=n&&ae[1]&&e.reverse(),e[0]=Math.max(e[0],t[0]),e[1]=Math.min(e[1],t[1]))},completeVisualOption:function(){o.prototype.completeVisualOption.apply(this,arguments),a.each(this.stateList,function(t){var e=this.option.controller[t].symbolSize;e&&e[0]!==e[1]&&(e[0]=0)},this)},setSelected:function(t){this.option.range=t.slice(),this._resetRange()},getSelected:function(){var t=this.getExtent(),e=r.asc((this.get("range")||[]).slice());return e[0]>t[1]&&(e[0]=t[1]),e[1]>t[1]&&(e[1]=t[1]),e[0]=i[1]||t<=e[1])?"inRange":"outOfRange"},findTargetDataIndices:function(t){var e=[];return this.eachTargetSeries(function(i){var n=[],o=i.getData();o.each(this.getDataDimension(o),function(e,i){t[0]<=e&&e<=t[1]&&n.push(i)},!0,this),e.push({seriesId:i.id,dataIndex:n})},this),e},getVisualMeta:function(t){function e(e,i){a.push({value:e,color:t(e,i)})}for(var i=n(this,"outOfRange",this.getExtent()),o=n(this,"inRange",this.option.range.slice()),a=[],r=0,s=0,l=o.length,u=i.length;st[1])break;n.push({color:this.getControllerVisual(r,"color",e),offset:a/i})}return n.push({color:this.getControllerVisual(t[1],"color",e),offset:1}),n},_createBarPoints:function(t,e){var i=this.visualMapModel.itemSize;return[[i[0]-e[0],t[0]],[i[0],t[0]],[i[0],t[1]],[i[0]-e[1],t[1]]]},_createBarGroup:function(t){var e=this._orient,i=this.visualMapModel.get("inverse");return new u.Group("horizontal"!==e||i?"horizontal"===e&&i?{scale:"bottom"===t?[-1,1]:[1,1],rotation:-Math.PI/2}:"vertical"!==e||i?{scale:"left"===t?[1,1]:[-1,1]}:{scale:"left"===t?[1,-1]:[-1,-1]}:{scale:"bottom"===t?[1,1]:[-1,1],rotation:Math.PI/2})},_updateHandle:function(t,e){if(this._useHandle){var i=this._shapes,n=this.visualMapModel,o=i.handleThumbs,a=i.handleLabels;y([0,1],function(r){var s=o[r];s.setStyle("fill",e.handlesColor[r]),s.position[1]=t[r];var l=u.applyTransform(i.handleLabelPoints[r],u.getTransform(s,this.group));a[r].setStyle({x:l[0],y:l[1],text:n.formatValueText(this._dataInterval[r]),textVerticalAlign:"middle",textAlign:this._applyTransform("horizontal"===this._orient?0===r?"bottom":"top":"left",i.barGroup)})},this)}},_showIndicator:function(t,e,i,n){var o=this.visualMapModel,r=o.getExtent(),s=o.itemSize,l=[0,s[1]],h=v(t,r,l,!0),c=this._shapes,d=c.indicator;if(d){d.position[1]=h,d.attr("invisible",!1),d.setShape("points",a(!!i,n,h,s[1]));var f={convertOpacityToAlpha:!0},p=this.getControllerVisual(t,"color",f);d.setStyle("fill",p);var g=u.applyTransform(c.indicatorLabelPoint,u.getTransform(d,this.group)),m=c.indicatorLabel;m.attr("invisible",!1);var y=this._applyTransform("left",c.barGroup),x=this._orient;m.setStyle({text:(i?i:"")+o.formatValueText(e),textVerticalAlign:"horizontal"===x?y:"middle",textAlign:"horizontal"===x?"center":y,x:g[0],y:g[1]})}},_enableHoverLinkToSeries:function(){var t=this;this._shapes.barGroup.on("mousemove",function(e){if(t._hovering=!0,!t._dragging){var i=t.visualMapModel.itemSize,n=t._applyTransform([e.offsetX,e.offsetY],t._shapes.barGroup,!0,!0);n[1]=x(_(0,n[1]),i[1]),t._doHoverLinkToSeries(n[1],0<=n[0]&&n[0]<=i[0])}}).on("mouseout",function(){t._hovering=!1,!t._dragging&&t._clearHoverLinkToSeries()})},_enableHoverLinkFromSeries:function(){var t=this.api.getZr();this.visualMapModel.option.hoverLink?(t.on("mouseover",this._hoverLinkFromSeriesMouseOver,this),t.on("mouseout",this._hideIndicator,this)):this._clearHoverLinkFromSeries()},_doHoverLinkToSeries:function(t,e){var i=this.visualMapModel,n=i.itemSize;if(i.option.hoverLink){var o=[0,n[1]],a=i.getExtent();t=x(_(o[0],t),o[1]);var l=r(i,a,o),u=[t-l,t+l],h=v(t,o,a,!0),c=[v(u[0],o,a,!0),v(u[1],o,a,!0)];u[0]o[1]&&(c[1]=1/0),e&&(c[0]===-(1/0)?this._showIndicator(h,c[1],"< ",l):c[1]===1/0?this._showIndicator(h,c[0],"> ",l):this._showIndicator(h,h,"≈ ",l));var d=this._hoverLinkDataIndices,f=[];(e||s(i))&&(f=this._hoverLinkDataIndices=i.findTargetDataIndices(c));var m=g.compressBatches(d,f);this._dispatchHighDown("downplay",p.convertDataIndex(m[0])),this._dispatchHighDown("highlight",p.convertDataIndex(m[1]))}},_hoverLinkFromSeriesMouseOver:function(t){var e=t.target,i=this.visualMapModel;if(e&&null!=e.dataIndex){var n=this.ecModel.getSeriesByIndex(e.seriesIndex);if(i.isTargetSeries(n)){var o=n.getData(e.dataType),a=o.getDimension(i.getDataDimension(o)),r=o.get(a,e.dataIndex,!0);isNaN(r)||this._showIndicator(r,r)}}},_hideIndicator:function(){var t=this._shapes;t.indicator&&t.indicator.attr("invisible",!0),t.indicatorLabel&&t.indicatorLabel.attr("invisible",!0)},_clearHoverLinkToSeries:function(){this._hideIndicator();var t=this._hoverLinkDataIndices;this._dispatchHighDown("downplay",p.convertDataIndex(t)),t.length=0},_clearHoverLinkFromSeries:function(){this._hideIndicator();var t=this.api.getZr();t.off("mouseover",this._hoverLinkFromSeriesMouseOver),t.off("mouseout",this._hideIndicator)},_applyTransform:function(t,e,i,n){var o=u.getTransform(e,n?null:this.group);return u[h.isArray(t)?"applyTransform":"transformDirection"](t,o,i)},_dispatchHighDown:function(t,e){e&&e.length&&this.api.dispatchAction({type:t,batch:e})},dispose:function(){this._clearHoverLinkFromSeries(),this._clearHoverLinkToSeries()},remove:function(){this._clearHoverLinkFromSeries(),this._clearHoverLinkToSeries()}});t.exports=S},function(t,e,i){function n(t,e){var i=t.inverse;("vertical"===t.orient?!i:i)&&e.reverse()}var o=i(250),a=i(1),r=i(82),s=i(263),l=i(4).reformIntervals,u=o.extend({type:"visualMap.piecewise",defaultOption:{selected:null,minOpen:!1,maxOpen:!1,align:"auto",itemWidth:20,itemHeight:14,itemSymbol:"roundRect",pieceList:null,categories:null,splitNumber:5,selectedMode:"multiple",itemGap:10,hoverLink:!0,showLabel:null},optionUpdated:function(t,e){u.superApply(this,"optionUpdated",arguments),this._pieceList=[],this.resetTargetSeries(),this.resetExtent();var i=this._mode=this._determineMode();h[this._mode].call(this),this._resetSelected(t,e);var n=this.option.categories;this.resetVisual(function(t,e){"categories"===i?(t.mappingMethod="category",t.categories=a.clone(n)):(t.dataExtent=this.getExtent(),t.mappingMethod="piecewise",t.pieceList=a.map(this._pieceList,function(t){var t=a.clone(t);return"inRange"!==e&&(t.visual=null),t}))})},completeVisualOption:function(){function t(t,e,i){return t&&t[e]&&(a.isObject(t[e])?t[e].hasOwnProperty(i):t[e]===i)}var e=this.option,i={},n=r.listVisualTypes(),l=this.isCategory();a.each(e.pieces,function(t){a.each(n,function(e){t.hasOwnProperty(e)&&(i[e]=1)})}),a.each(i,function(i,n){var o=0;a.each(this.stateList,function(i){o|=t(e,i,n)||t(e.target,i,n)},this),!o&&a.each(this.stateList,function(t){(e[t]||(e[t]={}))[n]=s.get(n,"inRange"===t?"active":"inactive",l)})},this),o.prototype.completeVisualOption.apply(this,arguments)},_resetSelected:function(t,e){var i=this.option,n=this._pieceList,o=(e?i:t).selected||{};if(i.selected=o,a.each(n,function(t,e){var i=this.getSelectedMapKey(t);o.hasOwnProperty(i)||(o[i]=!0)},this),"single"===i.selectedMode){var r=!1;a.each(n,function(t,e){var i=this.getSelectedMapKey(t);o[i]&&(r?o[i]=!1:r=!0)},this)}},getSelectedMapKey:function(t){return"categories"===this._mode?t.value+"":t.index+""},getPieceList:function(){return this._pieceList},_determineMode:function(){var t=this.option;return t.pieces&&t.pieces.length>0?"pieces":this.option.categories?"categories":"splitNumber"},setSelected:function(t){this.option.selected=a.clone(t)},getValueState:function(t){var e=r.findPieceIndex(t,this._pieceList);return null!=e&&this.option.selected[this.getSelectedMapKey(this._pieceList[e])]?"inRange":"outOfRange"},findTargetDataIndices:function(t){var e=[];return this.eachTargetSeries(function(i){var n=[],o=i.getData();o.each(this.getDataDimension(o),function(e,i){var o=r.findPieceIndex(e,this._pieceList);o===t&&n.push(i)},!0,this),e.push({seriesId:i.id,dataIndex:n})},this),e},getRepresentValue:function(t){var e;if(this.isCategory())e=t.value;else if(null!=t.value)e=t.value;else{var i=t.interval||[];e=i[0]===-(1/0)&&i[1]===1/0?0:(i[0]+i[1])/2}return e},getVisualMeta:function(t){function e(e,a){var r=o.getRepresentValue({interval:e});a||(a=o.getValueState(r));var s=t(r,a);e[0]===-(1/0)?n[0]=s:e[1]===1/0?n[1]=s:i.push({value:e[0],color:s},{value:e[1],color:s})}if(!this.isCategory()){var i=[],n=[],o=this,r=this._pieceList.slice();if(r.length){var s=r[0].interval[0];s!==-(1/0)&&r.unshift({interval:[-(1/0),s]}),s=r[r.length-1].interval[1],s!==1/0&&r.push({interval:[s,1/0]})}else r.push({interval:[-(1/0),1/0]});var l=-(1/0);return a.each(r,function(t){var i=t.interval;i&&(i[0]>l&&e([l,i[0]],"outOfRange"),e(i.slice()),l=i[1])},this),{stops:i,outerColors:n}}}}),h={splitNumber:function(){var t=this.option,e=this._pieceList,i=t.precision,n=this.getExtent(),o=t.splitNumber;o=Math.max(parseInt(o,10),1),t.splitNumber=o;for(var r=(n[1]-n[0])/o;+r.toFixed(i)!==r&&i<5;)i++;t.precision=i,r=+r.toFixed(i);var s=0;t.minOpen&&e.push({index:s++,interval:[-(1/0),n[0]],close:[0,0]});for(var u=n[0],h=s+o;s","≥"][e[0]]];t.text=t.text||this.formatValueText(null!=t.value?t.value:t.interval,!1,i)},this)}};t.exports=u},function(t,e,i){var n=i(251),o=i(1),a=i(3),r=i(24),s=i(12),l=i(252),u=n.extend({type:"visualMap.piecewise",doRender:function(){function t(t){var r=t.piece,s=new a.Group;s.onclick=o.bind(this._onItemClick,this,r),this._enableHoverLink(s,t.indexInModelPieceList);var d=i.getRepresentValue(r);if(this._createItemSymbol(s,d,[0,0,c[0],c[1]]),p){var f=this.visualMapModel.getValueState(d);s.add(new a.Text({style:{x:"right"===h?-n:c[0]+n,y:c[1]/2,text:r.text,textVerticalAlign:"middle",textAlign:h,textFont:l,fill:u,opacity:"outOfRange"===f?.5:1}}))}e.add(s)}var e=this.group;e.removeAll();var i=this.visualMapModel,n=i.get("textGap"),r=i.textStyleModel,l=r.getFont(),u=r.getTextColor(),h=this._getItemAlign(),c=i.itemSize,d=this._getViewData(),f=d.endsText,p=o.retrieve(i.get("showLabel",!0),!f);f&&this._renderEndsText(e,f[0],c,p,h),o.each(d.viewPieceList,t,this),f&&this._renderEndsText(e,f[1],c,p,h),s.box(i.get("orient"),e,i.get("itemGap")),this.renderBackground(e),this.positionGroup(e)},_enableHoverLink:function(t,e){function i(t){var i=this.visualMapModel;i.option.hoverLink&&this.api.dispatchAction({type:t,batch:l.convertDataIndex(i.findTargetDataIndices(e))})}t.on("mouseover",o.bind(i,this,"highlight")).on("mouseout",o.bind(i,this,"downplay"))},_getItemAlign:function(){var t=this.visualMapModel,e=t.option;if("vertical"===e.orient)return l.getItemAlign(t,this.api,t.itemSize);var i=e.align;return i&&"auto"!==i||(i="left"),i},_renderEndsText:function(t,e,i,n,o){if(e){var r=new a.Group,s=this.visualMapModel.textStyleModel;r.add(new a.Text({style:{x:n?"right"===o?i[0]:0:i[0]/2,y:i[1]/2,textVerticalAlign:"middle",textAlign:n?o:"center",text:e,textFont:s.getFont(),fill:s.getTextColor()}})),t.add(r)}},_getViewData:function(){var t=this.visualMapModel,e=o.map(t.getPieceList(),function(t,e){return{piece:t,indexInModelPieceList:e}}),i=t.get("text"),n=t.get("orient"),a=t.get("inverse");return("horizontal"===n?a:!a)?e.reverse():i&&(i=i.slice().reverse()),{viewPieceList:e,endsText:i}},_createItemSymbol:function(t,e,i){t.add(r.createSymbol(this.getControllerVisual(e,"symbol"),i[0],i[1],i[2],i[3],this.getControllerVisual(e,"color")))},_onItemClick:function(t){var e=this.visualMapModel,i=e.option,n=o.clone(i.selected),a=e.getSelectedMapKey(t);"single"===i.selectedMode?(n[a]=!0,o.each(n,function(t,e){n[e]=e===a})):n[a]=!n[a],this.api.dispatchAction({type:"selectDataRange",from:this.uid,visualMapId:this.visualMapModel.id,selected:n})}});t.exports=u},function(t,e,i){i(2).registerPreprocessor(i(253)),i(254),i(255),i(383),i(384),i(256)},function(t,e,i){i(2).registerPreprocessor(i(253)),i(254),i(255),i(385),i(386),i(256)},function(t,e,i){"use strict";function n(t,e,i){this._model=t}function o(t,e,i,n){var o=i.calendarModel,a=i.seriesModel,r=o?o.coordinateSystem:a?a.coordinateSystem:null;return r===this?r[t](n):null}var a=i(12),r=i(4),s=i(1),l=864e5;n.prototype={constructor:n,type:"calendar",dimensions:["time","value"],getDimensionsInfo:function(){return[{name:"time",type:"time"}]},getHandledRangeInfo:function(){return this._rangeInfo},getModel:function(){return this._model},getRect:function(){return this._rect},getCellWidth:function(){return this._sw},getCellHeight:function(){return this._sh},getOrient:function(){return this._orient},getFirstDayOfWeek:function(){return this._firstDayOfWeek},getDateInfo:function(t){t=r.parseDate(t);var e=t.getFullYear(),i=t.getMonth()+1;i=i<10?"0"+i:i;var n=t.getDate();n=n<10?"0"+n:n;var o=t.getDay();return o=Math.abs((o+7-this.getFirstDayOfWeek())%7),{y:e,m:i,d:n,day:o,time:t.getTime(),formatedDate:e+"-"+i+"-"+n,date:t}},getNextNDay:function(t,e){if(e=e||0,0===e)return this.getDateInfo(t);var i=this.getDateInfo(t).time;return this.getDateInfo(i+l*e)},update:function(t,e){function i(t,e){return null!=t[e]&&"auto"!==t[e]}this._firstDayOfWeek=this._model.getModel("dayLabel").get("firstDay"),this._orient=this._model.get("orient"),this._lineWidth=this._model.getModel("itemStyle.normal").getItemStyle().lineWidth||0,this._rangeInfo=this._getRangeInfo(this._initRangeOption());var n=this._rangeInfo.weeks||1,o=["width","height"],r=this._model.get("cellSize").slice(),l=this._model.getBoxLayoutParams(),u="horizontal"===this._orient?[n,7]:[7,n];s.each([0,1],function(t){i(r,t)&&(l[o[t]]=r[t]*u[t])});var h={width:e.getWidth(),height:e.getHeight()},c=this._rect=a.getLayoutRect(l,h);s.each([0,1],function(t){i(r,t)||(r[t]=c[o[t]]/u[t])}),this._sw=r[0],this._sh=r[1]},dataToPoint:function(t,e){var i=this.getDateInfo(t[0]),n=this._rangeInfo,o=i.formatedDate;if(!(e||i.time>=n.start.time&&i.time<=n.end.time))return[NaN,NaN];var a=i.day,r=this._getRangeInfo([n.start.time,o]).weeks;return"vertical"===this._orient?[this._rect.x+a*this._sw+this._sw/2,this._rect.y+(r-1)*this._sh+this._sh/2]:[this._rect.x+(r-1)*this._sw+this._sw/2,this._rect.y+a*this._sh+this._sh/2]},pointToData:function(t){var e=this.pointToDate(t);return e&&e.time},dataToRect:function(t,e){var i=this.dataToPoint(t,e);return{contentShape:{x:i[0]-(this._sw-this._lineWidth)/2,y:i[1]-(this._sh-this._lineWidth)/2,width:this._sw-this._lineWidth,height:this._sh-this._lineWidth},center:i,tl:[i[0]-this._sw/2,i[1]-this._sh/2],tr:[i[0]+this._sw/2,i[1]-this._sh/2],br:[i[0]+this._sw/2,i[1]+this._sh/2],bl:[i[0]-this._sw/2,i[1]+this._sh/2]}},pointToDate:function(t){var e=Math.floor((t[0]-this._rect.x)/this._sw)+1,i=Math.floor((t[1]-this._rect.y)/this._sh)+1,n=this._rangeInfo.range;return"vertical"===this._orient?this._getDateByWeeksAndDay(i,e-1,n):this._getDateByWeeksAndDay(e,i-1,n)},convertToPixel:s.curry(o,"dataToPoint"),convertFromPixel:s.curry(o,"pointToData"),_initRangeOption:function(){var t=this._model.get("range"),e=t;if(s.isArray(e)&&1===e.length&&(e=e[0]),/^\d{4}$/.test(e)&&(t=[e+"-01-01",e+"-12-31"]),/^\d{4}[\/|-]\d{1,2}$/.test(e)){var i=this.getDateInfo(e),n=i.date;n.setMonth(n.getMonth()+1);var o=this.getNextNDay(n,-1);t=[i.formatedDate,o.formatedDate]}/^\d{4}[\/|-]\d{1,2}[\/|-]\d{1,2}$/.test(e)&&(t=[e,e]);var a=this._getRangeInfo(t);return a.start.time>a.end.time&&t.reverse(),t},_getRangeInfo:function(t){var e=this.getDateInfo(t[0]),i=this.getDateInfo(t[1]),n=Math.floor(i.time/l)-Math.floor(e.time/l)+1,o=Math.floor((n+e.day+6)/7);return{range:[e.formatedDate,i.formatedDate],start:e,end:i,allDay:n,weeks:o,fweek:e.day,lweek:i.day}},_getDateByWeeksAndDay:function(t,e,i){var n=this._getRangeInfo(i);if(t>n.weeks||0===t&&en.lweek)return!1;var o=7*(t-1)-n.fweek+e,a=n.start.time+o*l;return this.getDateInfo(a)}},n.dimensions=n.prototype.dimensions,n.getDimensionsInfo=n.prototype.getDimensionsInfo,n.create=function(t,e){var i=[];return t.eachComponent("calendar",function(o){var a=new n(o,t,e);i.push(a),o.coordinateSystem=a}),t.eachSeries(function(t){"calendar"===t.get("coordinateSystem")&&(t.coordinateSystem=i[t.get("calendarIndex")||0])}),i},i(26).register("calendar",n),t.exports=n},function(t,e,i){"use strict";function n(t,e){var i=t.cellSize;a.isArray(i)?1===i.length&&(i[1]=i[0]):i=t.cellSize=[i,i];var n=a.map([0,1],function(t){return r.sizeCalculable(e,t)&&(i[t]="auto"),null!=i[t]&&"auto"!==i[t]});r.mergeLayoutParam(t,e,{type:"box",ignoreSize:n})}var o=i(13),a=i(1),r=i(12),s=o.extend({type:"calendar",coordinateSystem:null,defaultOption:{zlevel:0,z:2,left:80,top:60,cellSize:20,orient:"horizontal",splitLine:{show:!0,lineStyle:{color:"#000",width:1,type:"solid"}},itemStyle:{normal:{color:"#fff",borderWidth:1,borderColor:"#ccc"}},dayLabel:{show:!0,firstDay:0,position:"start",margin:"50%",nameMap:"en",textStyle:{color:"#000"}},monthLabel:{show:!0,position:"start",margin:5,align:"center",nameMap:"en",formatter:null,textStyle:{color:"#000"}},yearLabel:{show:!0,position:null,margin:30,formatter:null,textStyle:{color:"#ccc",fontFamily:"sans-serif",fontWeight:"bolder",fontSize:20}}},init:function(t,e,i,o){var a=r.getLayoutParams(t);s.superApply(this,"init",arguments),n(t,a)},mergeOption:function(t,e){s.superApply(this,"mergeOption",arguments), +n(this.option,t)}});t.exports=s},function(t,e,i){function n(t,e,i,n,o){l.call(this,t),this.map=e,this._nameCoordMap={},this.loadGeoJson(i,n,o)}function o(t,e,i,n){var o=i.geoModel,a=i.seriesModel,r=o?o.coordinateSystem:a?a.coordinateSystem||(a.getReferringComponents("geo")[0]||{}).coordinateSystem:null;return r===this?r[t](n):null}var a=i(259),r=i(1),s=i(11),l=i(257),u=[i(394),i(395),i(393)];n.prototype={constructor:n,type:"geo",dimensions:["lng","lat"],containCoord:function(t){for(var e=this.regions,i=0;i=0;i--)l.asc(e[i])},getActiveState:function(t){var e=this.activeIntervals;if(!e.length)return"normal";if(null==t)return"inactive";for(var i=0,n=e.length;i=o.length&&(x=o.length-1,y=Math.max(0,Math.floor(x-v+1))),f=[y,x]}var _=p&&f&&g?function(t,e,i){var n,o=f[1]-f[0],a=(e-g*o)/(i-1-o);return n=tr[1])){var s=Math.abs(a[1]);sr;)l+=360*u;return[s,l]},coordToPoint:function(t){var e=t[0],i=t[1]/180*Math.PI,n=Math.cos(i)*e+this.cx,o=-Math.sin(i)*e+this.cy;return[n,o]}},t.exports=a},function(t,e,i){"use strict";i(402),i(2).extendComponentModel({type:"polar",dependencies:["polarAxis","angleAxis"],coordinateSystem:null,findAxisModel:function(t){var e,i=this.ecModel;return i.eachComponent(t,function(t){t.getCoordSysModel()===this&&(e=t)},this),e},defaultOption:{zlevel:0,z:0,center:["50%","50%"],radius:"80%"}})},function(t,e,i){"use strict";function n(t,e){a.call(this,"radius",t,e),this.type="category"}var o=i(1),a=i(33);n.prototype={constructor:n,pointToData:function(t,e){return this.polar.pointToData(t,e)["radius"===this.dim?0:1]},dataToRadius:a.prototype.dataToCoord,radiusToData:a.prototype.coordToData},o.inherits(n,a),t.exports=n},function(t,e,i){function n(t,e,i){a.call(this,t,e,i),this.type="value",this.angle=0,this.name="",this.model}var o=i(1),a=i(33);o.inherits(n,a),t.exports=n},function(t,e,i){function n(t,e,i){this._model=t,this.dimensions=[],this._indicatorAxes=o.map(t.getIndicatorModels(),function(t,e){var i="indicator_"+e,n=new a(i,new r);return n.name=t.get("name"),n.model=t,t.axis=n,this.dimensions.push(i),n},this),this.resize(t,i),this.cx,this.cy,this.r,this.startAngle}var o=i(1),a=i(406),r=i(43),s=i(4),l=i(17);n.prototype.getIndicatorAxes=function(){return this._indicatorAxes},n.prototype.dataToPoint=function(t,e){var i=this._indicatorAxes[e];return this.coordToPoint(i.dataToCoord(t),e)},n.prototype.coordToPoint=function(t,e){var i=this._indicatorAxes[e],n=i.angle,o=this.cx+t*Math.cos(n),a=this.cy-t*Math.sin(n);return[o,a]},n.prototype.pointToData=function(t){var e=t[0]-this.cx,i=t[1]-this.cy,n=Math.sqrt(e*e+i*i);e/=n,i/=n;for(var o,a=Math.atan2(-i,e),r=1/0,s=-1,l=0;ln[0]&&isFinite(f)&&isFinite(n[0]))}else{var p=a.getTicks().length-1;p>r&&(c=i(c));var g=Math.round((n[0]+n[1])/2/c)*c,m=Math.round(r/2);a.setExtent(s.round(g-m*c),s.round(g+(r-m)*c)),a.setInterval(c)}})},n.dimensions=[],n.create=function(t,e){var i=[];return t.eachComponent("radar",function(o){var a=new n(o,t,e);i.push(a),o.coordinateSystem=a}),t.eachSeriesByType("radar",function(t){"radar"===t.get("coordinateSystem")&&(t.coordinateSystem=i[t.get("radarIndex")||0])}),i},i(26).register("radar",n),t.exports=n},function(t,e,i){function n(t,e){return s.defaults({show:e},t)}var o=i(96),a=o.valueAxis,r=i(10),s=i(1),l=i(42),u=i(2).extendComponentModel({type:"radar",optionUpdated:function(){var t=this.get("boundaryGap"),e=this.get("splitNumber"),i=this.get("scale"),n=this.get("axisLine"),o=this.get("axisTick"),a=this.get("axisLabel"),u=this.get("name.textStyle"),h=this.get("name.show"),c=this.get("name.formatter"),d=this.get("nameGap"),f=this.get("triggerEvent"),p=s.map(this.get("indicator")||[],function(p){if(null!=p.max&&p.max>0&&!p.min?p.min=0:null!=p.min&&p.min<0&&!p.max&&(p.max=0),p=s.merge(s.clone(p),{boundaryGap:t,splitNumber:e,scale:i,axisLine:n,axisTick:o,axisLabel:a,name:p.text,nameLocation:"end",nameGap:d,nameTextStyle:u,triggerEvent:f},!1),h||(p.name=""),"string"==typeof c){var g=p.name;p.name=c.replace("{value}",null!=g?g:"")}else"function"==typeof c&&(p.name=c(p.name,p));var m=s.extend(new r(p,null,this.ecModel),l);return m.mainType="radar",m.componentIndex=this.componentIndex,m},this);this.getIndicatorModels=function(){return p}},defaultOption:{zlevel:0,z:0,center:["50%","50%"],radius:"75%",startAngle:90,name:{show:!0},boundaryGap:[0,0],splitNumber:5,nameGap:15,scale:!1,shape:"polygon",axisLine:s.merge({lineStyle:{color:"#bbb"}},a.axisLine),axisLabel:n(a.axisLabel,!1),axisTick:n(a.axisTick,!1),splitLine:n(a.splitLine,!0),splitArea:n(a.splitArea,!0),indicator:[]}});t.exports=u},function(t,e,i){function n(t,e){return e.type||(e.data?"category":"value")}var o=i(13),a=i(59),r=i(1),s=o.extend({type:"singleAxis",layoutMode:"box",axis:null,coordinateSystem:null,getCoordSysModel:function(){return this}}),l={left:"5%",top:"5%",right:"5%",bottom:"5%",type:"value",position:"bottom",orient:"horizontal",axisLine:{show:!0,lineStyle:{width:2,type:"solid"}},tooltip:{show:!0},axisTick:{show:!0,length:6,lineStyle:{width:2}},axisLabel:{show:!0,interval:"auto"},splitLine:{show:!0,lineStyle:{type:"dashed",opacity:.2}}};r.merge(s.prototype,i(42)),a("single",s,n,l),t.exports=s},function(t,e,i){function n(t,e,i){this.dimension="single",this.dimensions=["single"],this._axis=null,this._rect,this._init(t,e,i),this.model=t}var o=i(411),a=i(17),r=i(12);n.prototype={type:"singleAxis",axisPointerEnabled:!0,constructor:n,_init:function(t,e,i){var n=this.dimension,r=new o(n,a.createScaleByModel(t),[0,0],t.get("type"),t.get("position")),s="category"===r.type;r.onBand=s&&t.get("boundaryGap"),r.inverse=t.get("inverse"),r.orient=t.get("orient"),t.axis=r,r.model=t,r.coordinateSystem=this,this._axis=r},update:function(t,e){t.eachSeries(function(t){if(t.coordinateSystem===this){var e=t.getData(),i=this.dimension;this._axis.scale.unionExtentFromData(e,t.coordDimToDataDim(i)),a.niceScaleExtent(this._axis.scale,this._axis.model)}},this)},resize:function(t,e){this._rect=r.getLayoutRect({left:t.get("left"),top:t.get("top"),right:t.get("right"),bottom:t.get("bottom"),width:t.get("width"),height:t.get("height")},{width:e.getWidth(),height:e.getHeight()}),this._adjustAxis()},getRect:function(){return this._rect},_adjustAxis:function(){var t=this._rect,e=this._axis,i=e.isHorizontal(),n=i?[0,t.width]:[0,t.height],o=e.reverse?1:0;e.setExtent(n[o],n[1-o]),this._updateAxisTransform(e,i?t.x:t.y)},_updateAxisTransform:function(t,e){var i=t.getExtent(),n=i[0]+i[1],o=t.isHorizontal();t.toGlobalCoord=o?function(t){return t+e}:function(t){return n-t+e},t.toLocalCoord=o?function(t){return t-e}:function(t){return n-t+e}},getAxis:function(){return this._axis},getBaseAxis:function(){return this._axis},getAxes:function(){return[this._axis]},getTooltipAxes:function(){return{baseAxes:[this.getAxis()]}},containPoint:function(t){var e=this.getRect(),i=this.getAxis(),n=i.orient;return"horizontal"===n?i.contain(i.toLocalCoord(t[0]))&&t[1]>=e.y&&t[1]<=e.y+e.height:i.contain(i.toLocalCoord(t[1]))&&t[0]>=e.y&&t[0]<=e.y+e.height},pointToData:function(t){var e=this.getAxis();return[e.coordToData(e.toLocalCoord(t["horizontal"===e.orient?0:1]))]},dataToPoint:function(t){var e=this.getAxis(),i=this.getRect(),n=[],o="horizontal"===e.orient?0:1;return t instanceof Array&&(t=t[0]),n[o]=e.toGlobalCoord(e.dataToCoord(+t)),n[1-o]=0===o?i.y+i.height/2:i.x+i.width/2,n}},t.exports=n},function(t,e,i){var n=i(1),o=i(33),a=i(17),r=function(t,e,i,n,a){o.call(this,t,e,i),this.type=n||"value",this.position=a||"bottom",this.orient=null,this._labelInterval=null};r.prototype={constructor:r,model:null,isHorizontal:function(){var t=this.position;return"top"===t||"bottom"===t},getLabelInterval:function(){var t=this._labelInterval;if(!t){var e=this.model,i=e.getModel("axisLabel"),o=i.get("interval");if("category"!==this.type||"auto"!==o)return t=this._labelInterval="auto"===o?0:o;t=this._labelInterval=a.getAxisLabelInterval(n.map(this.scale.getTicks(),this.dataToCoord,this),e.getFormattedLabels(),i.getModel("textStyle").getFont(),this.isHorizontal())}return t},pointToData:function(t,e){return this.coordinateSystem.pointToData(t,e)[0]},toGlobalCoord:null,toLocalCoord:null},n.inherits(r,o),t.exports=r},function(t,e,i){function n(t,e){var i=[];return t.eachComponent("singleAxis",function(n,a){var r=new o(n,t,e);r.name="single_"+a,r.resize(n,e),n.coordinateSystem=r,i.push(r)}),t.eachSeries(function(e){if("singleAxis"===e.get("coordinateSystem")){var i=t.queryComponents({mainType:"singleAxis",index:e.get("singleAxisIndex"),id:e.get("singleAxisId")})[0];e.coordinateSystem=i&&i.coordinateSystem}}),i}var o=i(410);i(26).register("single",{create:n,dimensions:o.prototype.dimensions})},function(t,e,i){"use strict";function n(t,e){this.id=null==t?"":t,this.inEdges=[],this.outEdges=[],this.edges=[],this.hostGraph,this.dataIndex=null==e?-1:e}function o(t,e,i){this.node1=t,this.node2=e,this.dataIndex=null==i?-1:i}var a=i(1),r=function(t){this._directed=t||!1,this.nodes=[],this.edges=[],this._nodesMap={},this._edgesMap={},this.data,this.edgeData},s=r.prototype;s.type="graph",s.isDirected=function(){return this._directed},s.addNode=function(t,e){t=t||""+e;var i=this._nodesMap;if(!i[t]){var o=new n(t,e);return o.hostGraph=this,this.nodes.push(o),i[t]=o,o}},s.getNodeByIndex=function(t){var e=this.data.getRawIndex(t);return this.nodes[e]},s.getNodeById=function(t){return this._nodesMap[t]},s.addEdge=function(t,e,i){var a=this._nodesMap,r=this._edgesMap;if("number"==typeof t&&(t=this.nodes[t]),"number"==typeof e&&(e=this.nodes[e]),t instanceof n||(t=a[t]),e instanceof n||(e=a[e]),t&&e){var s=t.id+"-"+e.id;if(!r[s]){var l=new o(t,e,i);return l.hostGraph=this,this._directed&&(t.outEdges.push(l),e.inEdges.push(l)),t.edges.push(l),t!==e&&e.edges.push(l),this.edges.push(l),r[s]=l,l}}},s.getEdgeByIndex=function(t){var e=this.edgeData.getRawIndex(t);return this.edges[e]},s.getEdge=function(t,e){t instanceof n&&(t=t.id),e instanceof n&&(e=e.id);var i=this._edgesMap;return this._directed?i[t+"-"+e]:i[t+"-"+e]||i[e+"-"+t]},s.eachNode=function(t,e){for(var i=this.nodes,n=i.length,o=0;o=0&&t.call(e,i[o],o)},s.eachEdge=function(t,e){for(var i=this.edges,n=i.length,o=0;o=0&&i[o].node1.dataIndex>=0&&i[o].node2.dataIndex>=0&&t.call(e,i[o],o)},s.breadthFirstTraverse=function(t,e,i,o){if(e instanceof n||(e=this._nodesMap[e]),e){for(var a="out"===i?"outEdges":"in"===i?"inEdges":"edges",r=0;r=0&&i.node2.dataIndex>=0});for(var o=0,a=n.length;o=0&&this[t][e].setItemVisual(this.dataIndex,i,n)},getVisual:function(i,n){return this[t][e].getItemVisual(this.dataIndex,i,n)},setLayout:function(i,n){this.dataIndex>=0&&this[t][e].setItemLayout(this.dataIndex,i,n)},getLayout:function(){return this[t][e].getItemLayout(this.dataIndex)},getGraphicEl:function(){return this[t][e].getItemGraphicEl(this.dataIndex)},getRawIndex:function(){return this[t][e].getRawIndex(this.dataIndex)}}};a.mixin(n,l("hostGraph","data")),a.mixin(o,l("hostGraph","edgeData")),r.Node=n,r.Edge=o,t.exports=r},function(t,e,i){function n(t,e){this.root,this.data,this._nodes=[],this.hostModel=t,this.levelModels=a.map(e||[],function(e){return new r(e,t,t.ecModel)})}function o(t,e){var i=e.children;t.parentNode!==e&&(i.push(t),t.parentNode=e)}var a=i(1),r=i(10),s=i(14),l=i(261),u=i(25),h=function(t,e){this.name=t||"",this.depth=0,this.height=0,this.parentNode=null,this.dataIndex=-1,this.children=[],this.viewChildren=[],this.hostTree=e};h.prototype={constructor:h,isRemoved:function(){return this.dataIndex<0},eachNode:function(t,e,i){"function"==typeof t&&(i=e,e=t,t=null),t=t||{},a.isString(t)&&(t={order:t});var n,o=t.order||"preorder",r=this[t.attr||"children"];"preorder"===o&&(n=e.call(i,this));for(var s=0;!n&&se&&(e=n.height)}this.height=e+1},getNodeById:function(t){if(this.getId()===t)return this;for(var e=0,i=this.children,n=i.length;e=0&&this.hostTree.data.setItemLayout(this.dataIndex,t,e)},getLayout:function(){return this.hostTree.data.getItemLayout(this.dataIndex)},getModel:function(t){if(!(this.dataIndex<0)){var e=this.hostTree,i=e.data.getItemModel(this.dataIndex),n=this.getLevelModel();return i.getModel(t,(n||e.hostModel).getModel(t))}},getLevelModel:function(){return(this.hostTree.levelModels||[])[this.depth]},setVisual:function(t,e){this.dataIndex>=0&&this.hostTree.data.setItemVisual(this.dataIndex,t,e)},getVisual:function(t,e){return this.hostTree.data.getItemVisual(this.dataIndex,t,e)},getRawIndex:function(){return this.hostTree.data.getRawIndex(this.dataIndex)},getId:function(){return this.hostTree.data.getId(this.dataIndex)}},n.prototype={constructor:n,type:"tree",eachNode:function(t,e,i){this.root.eachNode(t,e,i)},getNodeByDataIndex:function(t){var e=this.data.getRawIndex(t);return this._nodes[e]},getNodeByName:function(t){return this.root.getNodeByName(t)},update:function(){for(var t=this.data,e=this._nodes,i=0,n=e.length;i} + * @type {Object} key: actionType. * @inner */ - var actions = []; + var actions = {}; /** * Map eventType to actionType @@ -1502,6 +1542,12 @@ return /******/ (function(modules) { // webpackBootstrap */ var optionPreprocessorFuncs = []; + /** + * @type {Array.} + * @inner + */ + var postUpdateFuncs = []; + /** * Visual encoding functions of each stage * @type {Array.>} @@ -1532,27 +1578,32 @@ return /******/ (function(modules) { // webpackBootstrap /** * @type {number} */ - version: '3.4.0', + version: '3.5.0', dependencies: { - zrender: '3.3.0' + zrender: '3.4.0' } }; function enableConnect(chart) { - var STATUS_PENDING = 0; var STATUS_UPDATING = 1; var STATUS_UPDATED = 2; var STATUS_KEY = '__connectUpdateStatus'; + function updateConnectedChartsStatus(charts, status) { for (var i = 0; i < charts.length; i++) { var otherChart = charts[i]; otherChart[STATUS_KEY] = status; } } + zrUtil.each(eventActionMap, function (actionType, eventType) { chart._messageCenter.on(eventType, function (event) { if (connectedGroups[chart.group] && chart[STATUS_KEY] !== STATUS_PENDING) { + if (event && event.escapeConnect) { + return; + } + var action = chart.makeActionFromEvent(event); var otherCharts = []; @@ -1572,8 +1623,8 @@ return /******/ (function(modules) { // webpackBootstrap } }); }); - } + /** * @param {HTMLDomElement} dom * @param {Object} [theme] @@ -1599,7 +1650,13 @@ return /******/ (function(modules) { // webpackBootstrap if (!dom) { throw new Error('Initialize failed: invalid dom.'); } - if (zrUtil.isDom(dom) && dom.nodeName.toUpperCase() !== 'CANVAS' && (!dom.clientWidth || !dom.clientHeight)) { + if (zrUtil.isDom(dom) + && dom.nodeName.toUpperCase() !== 'CANVAS' + && ( + (!dom.clientWidth && (!opts || opts.width == null)) + || (!dom.clientHeight && (!opts || opts.height == null)) + ) + ) { console.warn('Can\'t get dom width or height'); } } @@ -1640,12 +1697,18 @@ return /******/ (function(modules) { // webpackBootstrap }; /** + * @DEPRECATED * @return {string} groupId */ echarts.disConnect = function (groupId) { connectedGroups[groupId] = false; }; + /** + * @return {string} groupId + */ + echarts.disconnect = echarts.disConnect; + /** * Dispose a chart instance * @param {module:echarts~ECharts|HTMLDomElement|string} chart @@ -1713,6 +1776,14 @@ return /******/ (function(modules) { // webpackBootstrap }); }; + /** + * Register postUpdater + * @param {Function} postUpdateFunc + */ + echarts.registerPostUpdate = function (postUpdateFunc) { + postUpdateFuncs.push(postUpdateFunc); + }; + /** * Usage: * registerAction('someAction', 'someEvent', function () { ... }); @@ -1907,11 +1978,14 @@ return /******/ (function(modules) { // webpackBootstrap // -------- // Exports // -------- - // + echarts.zrender = zrender; + echarts.List = __webpack_require__(98); echarts.Model = __webpack_require__(12); - echarts.graphic = __webpack_require__(43); + echarts.Axis = __webpack_require__(100); + + echarts.graphic = __webpack_require__(44); echarts.number = __webpack_require__(7); echarts.format = __webpack_require__(6); echarts.throttle = throttle.throttle; @@ -1923,13 +1997,16 @@ return /******/ (function(modules) { // webpackBootstrap each([ 'map', 'each', 'filter', 'indexOf', 'inherits', 'reduce', 'filter', 'bind', 'curry', 'isArray', 'isString', 'isObject', 'isFunction', - 'extend', 'defaults', 'clone' + 'extend', 'defaults', 'clone', 'merge' ], function (name) { echarts.util[name] = zrUtil[name]; } ); + echarts.helper = __webpack_require__(101); + + // PRIORITY echarts.PRIORITY = { PROCESSOR: { @@ -2151,7 +2228,7 @@ return /******/ (function(modules) { // webpackBootstrap this._optionManager = optionManager; }, - setOption: function (option, optionPreprocessorFuncs) { + setOption: function (option, optionPreprocessorFuncs, onlyGraphic) { zrUtil.assert( !(OPTION_INNER_KEY in option), 'please use chart.getOption()' @@ -2159,7 +2236,7 @@ return /******/ (function(modules) { // webpackBootstrap this._optionManager.setOption(option, optionPreprocessorFuncs); - this.resetOption(); + this.resetOption(null, onlyGraphic); }, /** @@ -2169,7 +2246,7 @@ return /******/ (function(modules) { // webpackBootstrap * 'media': only reset media query option * @return {boolean} Whether option changed. */ - resetOption: function (type) { + resetOption: function (type, onlyGraphic) { var optionChanged = false; var optionManager = this._optionManager; @@ -2180,7 +2257,11 @@ return /******/ (function(modules) { // webpackBootstrap initBase.call(this, baseOption); } else { - this.restoreData(); + // If only graphic, other series and component will not + // go through update process, data should not be restored. + // Otherwise grphic els mounted on data will be eliminated + // and downplay will not work. + !onlyGraphic && this.restoreData(); this.mergeOption(baseOption); } optionChanged = true; @@ -2421,7 +2502,7 @@ return /******/ (function(modules) { // webpackBootstrap } else { // Return all components with mainType - result = cpts; + result = cpts.slice(); } return filterBySubType(result, condition); @@ -2700,10 +2781,12 @@ return /******/ (function(modules) { // webpackBootstrap this.option[OPTION_INNER_KEY] = 1; /** + * Init with series: [], in case of calling findSeries method + * before series initialized. * @type {Object.>} * @private */ - this._componentsMap = {}; + this._componentsMap = {series: []}; /** * Mapping between filtered series list and raw series list. @@ -2870,7 +2953,7 @@ return /******/ (function(modules) { // webpackBootstrap else if (TYPED_ARRAY[typeStr]) { result = source.constructor.from(source); } - else if (!BUILTIN_OBJECT[typeStr] && !isDom(source)) { + else if (!BUILTIN_OBJECT[typeStr] && !isPrimitive(source) && !isDom(source)) { result = {}; for (var key in source) { if (source.hasOwnProperty(key)) { @@ -2906,8 +2989,10 @@ return /******/ (function(modules) { // webpackBootstrap && !isArray(targetProp) && !isDom(sourceProp) && !isDom(targetProp) - && !isBuildInObject(sourceProp) - && !isBuildInObject(targetProp) + && !isBuiltInObject(sourceProp) + && !isBuiltInObject(targetProp) + && !isPrimitive(sourceProp) + && !isPrimitive(targetProp) ) { // 如果需要递归覆盖,就递归调用merge merge(targetProp, sourceProp, overwrite); @@ -3234,7 +3319,7 @@ return /******/ (function(modules) { // webpackBootstrap * @param {*} value * @return {boolean} */ - function isBuildInObject(value) { + function isBuiltInObject(value) { return !!BUILTIN_OBJECT[objToString.call(value)]; } @@ -3293,6 +3378,18 @@ return /******/ (function(modules) { // webpackBootstrap } } + var primitiveKey = '__ec_primitive__'; + /** + * Set an object as primitive to be ignored traversing children in clone or merge + */ + function setAsPrimitive(obj) { + obj[primitiveKey] = true; + } + + function isPrimitive(obj) { + return obj[primitiveKey]; + } + var util = { inherits: inherits, mixin: mixin, @@ -3317,11 +3414,12 @@ return /******/ (function(modules) { // webpackBootstrap isString: isString, isObject: isObject, isFunction: isFunction, - isBuildInObject: isBuildInObject, + isBuiltInObject: isBuiltInObject, isDom: isDom, eqNaN: eqNaN, retrieve: retrieve, assert: assert, + setAsPrimitive: setAsPrimitive, noop: function () {} }; module.exports = util; @@ -3426,7 +3524,12 @@ return /******/ (function(modules) { // webpackBootstrap return value; } - if (dimType === 'time' && !isFinite(value) && value != null && value !== '-') { + if (dimType === 'time' + // spead up when using timestamp + && typeof value !== 'number' + && value != null + && value !== '-' + ) { value = +nubmerUtil.parseDate(value); } @@ -3470,10 +3573,6 @@ return /******/ (function(modules) { // webpackBootstrap */ getDataParams: function (dataIndex, dataType) { var data = this.getData(dataType); - - var seriesIndex = this.seriesIndex; - var seriesName = this.name; - var rawValue = this.getRawValue(dataIndex, dataType); var rawDataIndex = data.getRawIndex(dataIndex); var name = data.getName(dataIndex, true); @@ -3483,8 +3582,9 @@ return /******/ (function(modules) { // webpackBootstrap componentType: this.mainType, componentSubType: this.subType, seriesType: this.mainType === 'series' ? this.subType : null, - seriesIndex: seriesIndex, - seriesName: seriesName, + seriesIndex: this.seriesIndex, + seriesId: this.id, + seriesName: this.name, name: name, dataIndex: rawDataIndex, data: itemOpt, @@ -3702,7 +3802,7 @@ return /******/ (function(modules) { // webpackBootstrap ? opt.name + '' : existCpt ? existCpt.name - : '\0-'; + : '\0-'; // name may be displayed on screen, so use '-'. if (existCpt) { keyInfo.id = existCpt.id; @@ -3817,6 +3917,30 @@ return /******/ (function(modules) { // webpackBootstrap } }; + /** + * Enable property storage to any host object. + * Notice: Serialization is not supported. + * + * For example: + * var get = modelUitl.makeGetter(); + * + * function some(hostObj) { + * get(hostObj)._someProperty = 1212; + * ... + * } + * + * @return {Function} + */ + modelUtil.makeGetter = (function () { + var index = 0; + return function () { + var key = '\0__ec_prop_getter_' + index++; + return function (hostObj) { + return hostObj[key] || (hostObj[key] = {}); + }; + }; + })(); + /** * @param {module:echarts/model/Global} ecModel * @param {string|Object} finder @@ -3824,7 +3948,7 @@ return /******/ (function(modules) { // webpackBootstrap * If Object, could contain some of these properties below: * { * seriesIndex, seriesId, seriesName, - * geoIndex, geoId, goeName, + * geoIndex, geoId, geoName, * bmapIndex, bmapId, bmapName, * xAxisIndex, xAxisId, xAxisName, * yAxisIndex, yAxisId, yAxisName, @@ -3838,8 +3962,11 @@ return /******/ (function(modules) { // webpackBootstrap * geoId: ['aa', 'cc'], * gridName: ['xx', 'rr'] * } + * xxxIndex can be set as 'all' (means all xxx) or 'none' (means not specify) + * If nothing or null/undefined specified, return nothing. * @param {Object} [opt] * @param {string} [opt.defaultMainType] + * @param {Array.} [opt.includeMainTypes] * @return {Object} result like: * { * seriesModels: [seriesModel1, seriesModel2], @@ -3878,14 +4005,22 @@ return /******/ (function(modules) { // webpackBootstrap var parsedKey = key.match(/^(\w+)(Index|Id|Name)$/) || []; var mainType = parsedKey[1]; - var queryType = parsedKey[2]; + var queryType = (parsedKey[2] || '').toLowerCase(); - if (!mainType || !queryType) { + if (!mainType + || !queryType + || value == null + || (queryType === 'index' && value === 'none') + || (opt && opt.includeMainTypes && zrUtil.indexOf(opt.includeMainTypes, mainType) < 0) + ) { return; } var queryParam = {mainType: mainType}; - queryParam[queryType.toLowerCase()] = value; + if (queryType !== 'index' || value !== 'all') { + queryParam[queryType] = value; + } + var models = ecModel.queryComponents(queryParam); result[mainType + 'Models'] = models; result[mainType + 'Model'] = models[0]; @@ -3901,6 +4036,7 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = modelUtil; + /***/ }, /* 6 */ /***/ function(module, exports, __webpack_require__) { @@ -4016,6 +4152,24 @@ return /******/ (function(modules) { // webpackBootstrap return tpl; }; + /** + * simple Template formatter + * + * @param {string} tpl + * @param {Object} param + * @param {boolean} [encode=false] + * @return {string} + */ + formatUtil.formatTplSimple = function (tpl, param, encode) { + zrUtil.each(param, function (value, key) { + tpl = tpl.replace( + '{' + key + '}', + encode ? encodeHTML(value) : value + ); + }); + return tpl; + }; + /** * @param {string} str @@ -4030,9 +4184,15 @@ return /******/ (function(modules) { // webpackBootstrap * ISO Date format * @param {string} tpl * @param {number} value + * @param {boolean} [isLocal=false] Default use UTC + * Why default UTC? In most case, time provided by user is + * understood in UTC. For example, new Date('2012-01-01') + * or a string '2012-01-01' or a timestamp. So it is + * recommended to format time in UTC. + * (see `echarts/util/number.js#parseDate`); * @inner */ - formatUtil.formatTime = function (tpl, value) { + formatUtil.formatTime = function (tpl, value, isLocal) { if (tpl === 'week' || tpl === 'month' || tpl === 'quarter' @@ -4043,12 +4203,13 @@ return /******/ (function(modules) { // webpackBootstrap } var date = numberUtil.parseDate(value); - var y = date.getFullYear(); - var M = date.getMonth() + 1; - var d = date.getDate(); - var h = date.getHours(); - var m = date.getMinutes(); - var s = date.getSeconds(); + var utc = isLocal ? '' : 'UTC'; + var y = date['get' + utc + 'FullYear'](); + var M = date['get' + utc + 'Month']() + 1; + var d = date['get' + utc + 'Date'](); + var h = date['get' + utc + 'Hours'](); + var m = date['get' + utc + 'Minutes'](); + var s = date['get' + utc + 'Seconds'](); tpl = tpl.replace('MM', s2d(M)) .toLowerCase() @@ -4080,6 +4241,7 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = formatUtil; + /***/ }, /* 7 */ /***/ function(module, exports) { @@ -4190,15 +4352,18 @@ return /******/ (function(modules) { // webpackBootstrap /** * Fix rounding error of float numbers * @param {number} x - * @return {number} + * @param {number} [precision] + * @param {boolean} [returnStr] + * @return {number|string} */ - number.round = function (x, precision) { + number.round = function (x, precision, returnStr) { if (precision == null) { precision = 10; } // Avoid range error precision = Math.min(Math.max(0, precision), 20); - return +(+x).toFixed(precision); + x = (+x).toFixed(precision); + return returnStr ? x : +x; }; number.asc = function (arr) { @@ -4276,8 +4441,22 @@ return /******/ (function(modules) { // webpackBootstrap return val > -RADIAN_EPSILON && val < RADIAN_EPSILON; }; + var TIME_REG = /^(?:(\d{4})(?:[-\/](\d{1,2})(?:[-\/](\d{1,2})(?:[T ](\d{1,2})(?::(\d\d)(?::(\d\d)(?:[.,](\d+))?)?)?(?:Z|([\+\-]\d\d):?\d\d)?)?)?)?)?$/; // jshint ignore:line + var TIMEZONE_OFFSET = (new Date()).getTimezoneOffset(); + /** - * @param {string|Date|number} value + * @param {string|Date|number} value These values can be accepted: + * + An instance of Date, represent a time in its own time zone. + * + Or string in a subset of ISO 8601, only including: + * + only year, month, date: '2012-03', '2012-03-01', '2012-03-01 05', '2012-03-01 05:06', + * + separated with T or space: '2012-03-01T12:22:33.123', '2012-03-01 12:22:33.123', + * + time zone: '2012-03-01T12:22:33Z', '2012-03-01T12:22:33+8000', '2012-03-01T12:22:33-05:00', + * all of which will be treated as they reperent a time in UTC + * if time zone is not specified. + * + Or other string format, including: + * '2012', '2012-3-1', '2012/3/1', '2012/03/01', + * '2009/6/12 2:00', '2009/6/12 2:05:08', '2009/6/12 2:05:08.123' + * + a timestamp, which represent a time in UTC. * @return {Date} date */ number.parseDate = function (value) { @@ -4285,13 +4464,32 @@ return /******/ (function(modules) { // webpackBootstrap return value; } else if (typeof value === 'string') { - // Treat as ISO format. See issue #3623 - var ret = new Date(value); - if (isNaN(+ret)) { - // FIXME new Date('1970-01-01') is UTC, new Date('1970/01/01') is local - ret = new Date(new Date(value.replace(/-/g, '/')) - new Date('1970/01/01')); - } - return ret; + // Different browsers parse date in different way, so we parse it manually. + // Some other issues: + // new Date('1970-01-01') is UTC, + // new Date('1970/01/01') and new Date('1970-1-01') is local. + // See issue #3623 + var match = TIME_REG.exec(value); + + if (!match) { + // return Invalid Date. + return new Date(NaN); + } + + // match[n] can only be string or undefined. + // But take care of '12' + 1 => '121'. + return new Date( + +match[1], + +(match[2] || 1) - 1, + +match[3] || 1, + +match[4] || 0, + +(match[5] || 0) - (match[8] || 0) * 60 - TIMEZONE_OFFSET, + +match[6] || 0, + +match[7] || 0 + ); + } + else if (value == null) { + return new Date(NaN); } return new Date(Math.round(value)); @@ -5592,6 +5790,7 @@ return /******/ (function(modules) { // webpackBootstrap }; /** + * Notice, parseClassType('') should returns {main: '', sub: ''} * @public */ var parseClassType = clazz.parseClassType = function (componentType) { @@ -5875,11 +6074,13 @@ return /******/ (function(modules) { // webpackBootstrap properties[i][1] = properties[i][0]; } } - return function (excludes) { + return function (excludes, includes) { var style = {}; for (var i = 0; i < properties.length; i++) { var propName = properties[i][1]; - if (excludes && zrUtil.indexOf(excludes, propName) >= 0) { + if ((excludes && zrUtil.indexOf(excludes, propName) >= 0) + || (includes && zrUtil.indexOf(includes, propName) < 0) + ) { continue; } var val = this.getShallow(propName); @@ -5987,8 +6188,8 @@ return /******/ (function(modules) { // webpackBootstrap ] ); module.exports = { - getItemStyle: function (excludes) { - var style = getItemStyle.call(this, excludes); + getItemStyle: function (excludes, includes) { + var style = getItemStyle.call(this, excludes, includes); var lineDash = this.getBorderLineDash(); lineDash && (style.lineDash = lineDash); return style; @@ -6399,10 +6600,21 @@ return /******/ (function(modules) { // webpackBootstrap var layout = {}; + /** + * @public + */ var LOCATION_PARAMS = layout.LOCATION_PARAMS = [ 'left', 'right', 'top', 'bottom', 'width', 'height' ]; + /** + * @public + */ + var HV_NAMES = layout.HV_NAMES = [ + ['width', 'left', 'right'], + ['height', 'top', 'bottom'] + ]; + function boxLayout(orient, group, gap, maxWidth, maxHeight) { var x = 0; var y = 0; @@ -6718,6 +6930,15 @@ return /******/ (function(modules) { // webpackBootstrap el.attr('position', boundingMode === 'raw' ? [dx, dy] : [elPos[0] + dx, elPos[1] + dy]); }; + /** + * @param {Object} option Contains some of the properties in HV_NAMES. + * @param {number} hvIdx 0: horizontal; 1: vertical. + */ + layout.sizeCalculable = function (option, hvIdx) { + return option[HV_NAMES[hvIdx][0]] != null + || (option[HV_NAMES[hvIdx][1]] != null && option[HV_NAMES[hvIdx][2]] != null); + }; + /** * Consider Case: * When defulat option has {left: 0, width: 100}, and we set {right: 0} @@ -6740,24 +6961,26 @@ return /******/ (function(modules) { // webpackBootstrap * @param {Object} targetOption * @param {Object} newOption * @param {Object|string} [opt] - * @param {boolean} [opt.ignoreSize=false] Some component must has width and height. + * @param {boolean|Array.} [opt.ignoreSize=false] Some component must has width and height. */ layout.mergeLayoutParam = function (targetOption, newOption, opt) { !zrUtil.isObject(opt) && (opt = {}); - var hNames = ['width', 'left', 'right']; // Order by priority. - var vNames = ['height', 'top', 'bottom']; // Order by priority. - var hResult = merge(hNames); - var vResult = merge(vNames); - copy(hNames, targetOption, hResult); - copy(vNames, targetOption, vResult); + var ignoreSize = opt.ignoreSize; + !zrUtil.isArray(ignoreSize) && (ignoreSize = [ignoreSize, ignoreSize]); + + var hResult = merge(HV_NAMES[0], 0); + var vResult = merge(HV_NAMES[1], 1); + + copy(HV_NAMES[0], targetOption, hResult); + copy(HV_NAMES[1], targetOption, vResult); - function merge(names) { + function merge(names, hvIdx) { var newParams = {}; var newValueCount = 0; var merged = {}; var mergedValueCount = 0; - var enoughParamNumber = opt.ignoreSize ? 1 : 2; + var enoughParamNumber = 2; each(names, function (name) { merged[name] = targetOption[name]; @@ -6770,6 +6993,13 @@ return /******/ (function(modules) { // webpackBootstrap hasValue(merged, name) && mergedValueCount++; }); + if (ignoreSize[hvIdx]) { + // Only one of left/height is premitted to exist. + hasValue(newOption, names[2]) && (merged[names[1]] = null); + hasValue(newOption, names[1]) && (merged[names[2]] = null); + return merged; + } + // Case: newOption: {width: ..., right: ...}, // or targetOption: {right: ...} and newOption: {width: ...}, // There is no conflict when merged only has params count @@ -6785,7 +7015,6 @@ return /******/ (function(modules) { // webpackBootstrap } else { // Chose another param from targetOption by priority. - // When 'ignoreSize', enoughParamNumber is 1 and those will not happen. for (var i = 0; i < names.length; i++) { var name = names[i]; if (!hasProp(newParams, name) && hasProp(targetOption, name)) { @@ -6836,6 +7065,7 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = layout; + /***/ }, /* 22 */ /***/ function(module, exports) { @@ -6897,7 +7127,7 @@ return /******/ (function(modules) { // webpackBootstrap // Default is source-over blendMode: null, - animation: true, + animation: 'auto', animationDuration: 1000, animationDurationUpdate: 300, animationEasing: 'exponentialOut', @@ -6966,14 +7196,18 @@ return /******/ (function(modules) { // webpackBootstrap var zrUtil = __webpack_require__(4); var echartsAPIList = [ - 'getDom', 'getZr', 'getWidth', 'getHeight', 'dispatchAction', 'isDisposed', - 'on', 'off', 'getDataURL', 'getConnectedDataURL', 'getModel', 'getOption' + 'getDom', 'getZr', 'getWidth', 'getHeight', 'getDevicePixelRatio', 'dispatchAction', 'isDisposed', + 'on', 'off', 'getDataURL', 'getConnectedDataURL', 'getModel', 'getOption', + 'getViewOfComponentModel', 'getViewOfSeriesModel' ]; - function ExtensionAPI(chartInstance) { + function ExtensionAPI(chartInstance, coordSysMgr) { zrUtil.each(echartsAPIList, function (name) { this[name] = zrUtil.bind(chartInstance[name], chartInstance); }, this); + + // Inject getCoordinateSystems to ecModel + this.getCoordinateSystems = zrUtil.bind(coordSysMgr.getCoordinateSystems, coordSysMgr); } module.exports = ExtensionAPI; @@ -6988,34 +7222,6 @@ return /******/ (function(modules) { // webpackBootstrap var zrUtil = __webpack_require__(4); - /** - * Interface of Coordinate System Class - * - * create: - * @param {module:echarts/model/Global} ecModel - * @param {module:echarts/ExtensionAPI} api - * @return {Object} coordinate system instance - * - * update: - * @param {module:echarts/model/Global} ecModel - * @param {module:echarts/ExtensionAPI} api - * - * convertToPixel: - * convertFromPixel: - * These two methods is also responsible for determine whether this - * coodinate system is applicable to the given `finder`. - * Each coordinate system will be tried, util one returns none - * null/undefined value. - * @param {module:echarts/model/Global} ecModel - * @param {Object} finder - * @param {Array|number} value - * @return {Array|number} convert result. - * - * containPoint: - * @param {Array.} point In pixel coordinate system. - * @return {boolean} - */ - var coordinateSystemCreators = {}; function CoordinateSystemManager() { @@ -7569,11 +7775,15 @@ return /******/ (function(modules) { // webpackBootstrap this.mergeDefaultAndTheme(option, ecModel); + var data = this.getInitialData(option, ecModel); + if (true) { + zrUtil.assert(data, 'getInitialData returned invalid data.'); + } /** * @type {module:echarts/data/List|module:echarts/data/Tree|module:echarts/data/Graph} * @private */ - set(this, 'dataBeforeProcessed', this.getInitialData(option, ecModel)); + set(this, 'dataBeforeProcessed', data); // If we reverse the order (make data firstly, and then make // dataBeforeProcessed by cloneShallow), cloneShallow will @@ -7810,9 +8020,9 @@ return /******/ (function(modules) { // webpackBootstrap * @param {Array.|string} dim * @param {Array.} value * @param {module:echarts/coord/single/SingleAxis} baseAxis - * @return {Array.} data indices. + * @return {Object} {dataIndices, nestestValue}. */ - getAxisTooltipDataIndex: null, + getAxisTooltipData: null, /** * See tooltip. @@ -9069,7 +9279,7 @@ return /******/ (function(modules) { // webpackBootstrap var isString = util.isString; var isFunction = util.isFunction; var isObject = util.isObject; - var log = __webpack_require__(40); + var log = __webpack_require__(41); /** * @alias modue:zrender/mixin/Animatable @@ -9846,6 +10056,24 @@ return /******/ (function(modules) { // webpackBootstrap return this; }, + pause: function () { + for (var i = 0; i < this._clipList.length; i++) { + this._clipList[i].pause(); + } + this._paused = true; + }, + + resume: function () { + for (var i = 0; i < this._clipList.length; i++) { + this._clipList[i].resume(); + } + this._paused = false; + }, + + isPaused: function () { + return !!this._paused; + }, + _doneCallback: function () { // Clear all tracks this._tracks = {}; @@ -10008,13 +10236,16 @@ return /******/ (function(modules) { // webpackBootstrap this.onframe = options.onframe; this.ondestroy = options.ondestroy; this.onrestart = options.onrestart; + + this._pausedTime = 0; + this._paused = false; } Clip.prototype = { constructor: Clip, - step: function (globalTime) { + step: function (globalTime, deltaTime) { // Set startTime on first step, or _startTime may has milleseconds different between clips // PENDING if (!this._initialized) { @@ -10022,7 +10253,12 @@ return /******/ (function(modules) { // webpackBootstrap this._initialized = true; } - var percent = (globalTime - this._startTime) / this._life; + if (this._paused) { + this._pausedTime += deltaTime; + return; + } + + var percent = (globalTime - this._startTime - this._pausedTime) / this._life; // 还没开始 if (percent < 0) { @@ -10058,17 +10294,26 @@ return /******/ (function(modules) { // webpackBootstrap }, restart: function (globalTime) { - var remainder = (globalTime - this._startTime) % this._life; + var remainder = (globalTime - this._startTime - this._pausedTime) % this._life; this._startTime = globalTime - remainder + this.gap; + this._pausedTime = 0; this._needsRemove = false; }, - fire: function(eventType, arg) { + fire: function (eventType, arg) { eventType = 'on' + eventType; if (this[eventType]) { this[eventType](this._target, arg); } + }, + + pause: function () { + this._paused = true; + }, + + resume: function () { + this._paused = false; } }; @@ -10429,13 +10674,15 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, /* 39 */ -/***/ function(module, exports) { +/***/ function(module, exports, __webpack_require__) { /** * @module zrender/tool/color */ + var LRU = __webpack_require__(40); + var kCSSColorTable = { 'transparent': [0,0,0,0], 'aliceblue': [240,248,255,1], 'antiquewhite': [250,235,215,1], 'aqua': [0,255,255,1], @@ -10565,15 +10812,40 @@ return /******/ (function(modules) { // webpackBootstrap return a + (b - a) * p; } + function setRgba(out, r, g, b, a) { + out[0] = r; out[1] = g; out[2] = b; out[3] = a; + return out; + } + function copyRgba(out, a) { + out[0] = a[0]; out[1] = a[1]; out[2] = a[2]; out[3] = a[3]; + return out; + } + var colorCache = new LRU(20); + var lastRemovedArr = null; + function putToCache(colorStr, rgbaArr) { + // Reuse removed array + if (lastRemovedArr) { + copyRgba(lastRemovedArr, rgbaArr); + } + lastRemovedArr = colorCache.put(colorStr, lastRemovedArr || (rgbaArr.slice())); + } /** * @param {string} colorStr + * @param {Array.} out * @return {Array.} * @memberOf module:zrender/util/color */ - function parse(colorStr) { + function parse(colorStr, rgbaArr) { if (!colorStr) { return; } + rgbaArr = rgbaArr || []; + + var cached = colorCache.get(colorStr); + if (cached) { + return copyRgba(rgbaArr, cached); + } + // colorStr may be not string colorStr = colorStr + ''; // Remove all whitespace, not compliant, but should just be more accepting. @@ -10581,7 +10853,9 @@ return /******/ (function(modules) { // webpackBootstrap // Color keywords (and transparent) lookup. if (str in kCSSColorTable) { - return kCSSColorTable[str].slice(); // dup. + copyRgba(rgbaArr, kCSSColorTable[str]); + putToCache(colorStr, rgbaArr); + return rgbaArr; } // #abc and #abc123 syntax. @@ -10589,26 +10863,32 @@ return /******/ (function(modules) { // webpackBootstrap if (str.length === 4) { var iv = parseInt(str.substr(1), 16); // TODO(deanm): Stricter parsing. if (!(iv >= 0 && iv <= 0xfff)) { + setRgba(rgbaArr, 0, 0, 0, 1); return; // Covers NaN. } - return [ + setRgba(rgbaArr, ((iv & 0xf00) >> 4) | ((iv & 0xf00) >> 8), (iv & 0xf0) | ((iv & 0xf0) >> 4), (iv & 0xf) | ((iv & 0xf) << 4), 1 - ]; + ); + putToCache(colorStr, rgbaArr); + return rgbaArr; } else if (str.length === 7) { var iv = parseInt(str.substr(1), 16); // TODO(deanm): Stricter parsing. if (!(iv >= 0 && iv <= 0xffffff)) { + setRgba(rgbaArr, 0, 0, 0, 1); return; // Covers NaN. } - return [ + setRgba(rgbaArr, (iv & 0xff0000) >> 16, (iv & 0xff00) >> 8, iv & 0xff, 1 - ]; + ); + putToCache(colorStr, rgbaArr); + return rgbaArr; } return; @@ -10621,44 +10901,56 @@ return /******/ (function(modules) { // webpackBootstrap switch (fname) { case 'rgba': if (params.length !== 4) { + setRgba(rgbaArr, 0, 0, 0, 1); return; } alpha = parseCssFloat(params.pop()); // jshint ignore:line // Fall through. case 'rgb': if (params.length !== 3) { + setRgba(rgbaArr, 0, 0, 0, 1); return; } - return [ + setRgba(rgbaArr, parseCssInt(params[0]), parseCssInt(params[1]), parseCssInt(params[2]), alpha - ]; + ); + putToCache(colorStr, rgbaArr); + return rgbaArr; case 'hsla': if (params.length !== 4) { + setRgba(rgbaArr, 0, 0, 0, 1); return; } params[3] = parseCssFloat(params[3]); - return hsla2rgba(params); + hsla2rgba(params, rgbaArr); + putToCache(colorStr, rgbaArr); + return rgbaArr; case 'hsl': if (params.length !== 3) { + setRgba(rgbaArr, 0, 0, 0, 1); return; } - return hsla2rgba(params); + hsla2rgba(params, rgbaArr); + putToCache(colorStr, rgbaArr); + return rgbaArr; default: return; } } + setRgba(rgbaArr, 0, 0, 0, 1); return; } /** * @param {Array.} hsla + * @param {Array.} rgba * @return {Array.} rgba */ - function hsla2rgba(hsla) { + function hsla2rgba(hsla, rgba) { var h = (((parseFloat(hsla[0]) % 360) + 360) % 360) / 360; // 0 .. 1 // NOTE(deanm): According to the CSS spec s/l should only be // percentages, but we don't bother and let float or percentage. @@ -10667,11 +10959,13 @@ return /******/ (function(modules) { // webpackBootstrap var m2 = l <= 0.5 ? l * (s + 1) : l + s - l * s; var m1 = l * 2 - m2; - var rgba = [ + rgba = rgba || []; + setRgba(rgba, clampCssByte(cssHueToRgb(m1, m2, h + 1 / 3) * 255), clampCssByte(cssHueToRgb(m1, m2, h) * 255), - clampCssByte(cssHueToRgb(m1, m2, h - 1 / 3) * 255) - ]; + clampCssByte(cssHueToRgb(m1, m2, h - 1 / 3) * 255), + 1 + ); if (hsla.length === 4) { rgba[3] = hsla[3]; @@ -10787,12 +11081,12 @@ return /******/ (function(modules) { // webpackBootstrap * @return {Array.} */ function fastMapToColor(normalizedValue, colors, out) { + out = out || [0, 0, 0, 0]; if (!(colors && colors.length) || !(normalizedValue >= 0 && normalizedValue <= 1) ) { - return; + return out; } - out = out || [0, 0, 0, 0]; var value = normalizedValue * (colors.length - 1); var leftIndex = Math.floor(value); var rightIndex = Math.ceil(value); @@ -10886,9 +11180,12 @@ return /******/ (function(modules) { // webpackBootstrap /** * @param {Array.} colors Color list. * @param {string} type 'rgba', 'hsva', ... - * @return {string} Result color. + * @return {string} Result color. (If input illegal, return undefined). */ function stringify(arrColor, type) { + if (!arrColor) { + return; + } var colorStr = arrColor[0] + ',' + arrColor[1] + ',' + arrColor[2]; if (type === 'rgba' || type === 'hsva' || type === 'hsla') { colorStr += ',' + arrColor[3]; @@ -10912,60 +11209,262 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, /* 40 */ -/***/ function(module, exports, __webpack_require__) { +/***/ function(module, exports) { - - var config = __webpack_require__(41); + // Simple LRU cache use doubly linked list + // @module zrender/core/LRU + + + /** + * Simple double linked list. Compared with array, it has O(1) remove operation. + * @constructor + */ + var LinkedList = function () { /** - * @exports zrender/tool/log - * @author Kener (@Kener-林峰, kener.linfeng@gmail.com) + * @type {module:zrender/core/LRU~Entry} */ - module.exports = function() { - if (config.debugMode === 0) { - return; - } - else if (config.debugMode == 1) { - for (var k in arguments) { - throw new Error(arguments[k]); - } - } - else if (config.debugMode > 1) { - for (var k in arguments) { - console.log(arguments[k]); - } - } - }; - - /* for debug - return function(mes) { - document.getElementById('wrong-message').innerHTML = - mes + ' ' + (new Date() - 0) - + '
' - + document.getElementById('wrong-message').innerHTML; - }; - */ - + this.head = null; + /** + * @type {module:zrender/core/LRU~Entry} + */ + this.tail = null; -/***/ }, -/* 41 */ -/***/ function(module, exports) { + this._len = 0; + }; - - var dpr = 1; - // If in browser environment - if (typeof window !== 'undefined') { - dpr = Math.max(window.devicePixelRatio || 1, 1); - } + var linkedListProto = LinkedList.prototype; /** - * config默认配置项 - * @exports zrender/config - * @author Kener (@Kener-林峰, kener.linfeng@gmail.com) + * Insert a new value at the tail + * @param {} val + * @return {module:zrender/core/LRU~Entry} */ - var config = { - /** - * debug日志选项:catchBrushException为true下有效 + linkedListProto.insert = function (val) { + var entry = new Entry(val); + this.insertEntry(entry); + return entry; + }; + + /** + * Insert an entry at the tail + * @param {module:zrender/core/LRU~Entry} entry + */ + linkedListProto.insertEntry = function (entry) { + if (!this.head) { + this.head = this.tail = entry; + } + else { + this.tail.next = entry; + entry.prev = this.tail; + entry.next = null; + this.tail = entry; + } + this._len++; + }; + + /** + * Remove entry. + * @param {module:zrender/core/LRU~Entry} entry + */ + linkedListProto.remove = function (entry) { + var prev = entry.prev; + var next = entry.next; + if (prev) { + prev.next = next; + } + else { + // Is head + this.head = next; + } + if (next) { + next.prev = prev; + } + else { + // Is tail + this.tail = prev; + } + entry.next = entry.prev = null; + this._len--; + }; + + /** + * @return {number} + */ + linkedListProto.len = function () { + return this._len; + }; + + /** + * Clear list + */ + linkedListProto.clear = function () { + this.head = this.tail = null; + this._len = 0; + }; + + /** + * @constructor + * @param {} val + */ + var Entry = function (val) { + /** + * @type {} + */ + this.value = val; + + /** + * @type {module:zrender/core/LRU~Entry} + */ + this.next; + + /** + * @type {module:zrender/core/LRU~Entry} + */ + this.prev; + }; + + /** + * LRU Cache + * @constructor + * @alias module:zrender/core/LRU + */ + var LRU = function (maxSize) { + + this._list = new LinkedList(); + + this._map = {}; + + this._maxSize = maxSize || 10; + + this._lastRemovedEntry = null; + }; + + var LRUProto = LRU.prototype; + + /** + * @param {string} key + * @param {} value + * @return {} Removed value + */ + LRUProto.put = function (key, value) { + var list = this._list; + var map = this._map; + var removed = null; + if (map[key] == null) { + var len = list.len(); + // Reuse last removed entry + var entry = this._lastRemovedEntry; + + if (len >= this._maxSize && len > 0) { + // Remove the least recently used + var leastUsedEntry = list.head; + list.remove(leastUsedEntry); + delete map[leastUsedEntry.key]; + + removed = leastUsedEntry.value; + this._lastRemovedEntry = leastUsedEntry; + } + + if (entry) { + entry.value = value; + } + else { + entry = new Entry(value); + } + entry.key = key; + list.insertEntry(entry); + map[key] = entry; + } + + return removed; + }; + + /** + * @param {string} key + * @return {} + */ + LRUProto.get = function (key) { + var entry = this._map[key]; + var list = this._list; + if (entry != null) { + // Put the latest used entry in the tail + if (entry !== list.tail) { + list.remove(entry); + list.insertEntry(entry); + } + + return entry.value; + } + }; + + /** + * Clear the cache + */ + LRUProto.clear = function () { + this._list.clear(); + this._map = {}; + }; + + module.exports = LRU; + + +/***/ }, +/* 41 */ +/***/ function(module, exports, __webpack_require__) { + + + var config = __webpack_require__(42); + + /** + * @exports zrender/tool/log + * @author Kener (@Kener-林峰, kener.linfeng@gmail.com) + */ + module.exports = function() { + if (config.debugMode === 0) { + return; + } + else if (config.debugMode == 1) { + for (var k in arguments) { + throw new Error(arguments[k]); + } + } + else if (config.debugMode > 1) { + for (var k in arguments) { + console.log(arguments[k]); + } + } + }; + + /* for debug + return function(mes) { + document.getElementById('wrong-message').innerHTML = + mes + ' ' + (new Date() - 0) + + '
' + + document.getElementById('wrong-message').innerHTML; + }; + */ + + + +/***/ }, +/* 42 */ +/***/ function(module, exports) { + + + var dpr = 1; + // If in browser environment + if (typeof window !== 'undefined') { + dpr = Math.max(window.devicePixelRatio || 1, 1); + } + /** + * config默认配置项 + * @exports zrender/config + * @author Kener (@Kener-林峰, kener.linfeng@gmail.com) + */ + var config = { + /** + * debug日志选项:catchBrushException为true下有效 * 0 : 不生成debug数据,发布用 * 1 : 异常抛出,调试用 * 2 : 控制台输出,调试用 @@ -10981,7 +11480,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 42 */ +/* 43 */ /***/ function(module, exports, __webpack_require__) { @@ -11129,7 +11628,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 43 */ +/* 44 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -11137,9 +11636,9 @@ return /******/ (function(modules) { // webpackBootstrap var zrUtil = __webpack_require__(4); - var pathTool = __webpack_require__(44); + var pathTool = __webpack_require__(45); var round = Math.round; - var Path = __webpack_require__(45); + var Path = __webpack_require__(46); var colorTool = __webpack_require__(39); var matrix = __webpack_require__(11); var vector = __webpack_require__(10); @@ -11148,7 +11647,7 @@ return /******/ (function(modules) { // webpackBootstrap graphic.Group = __webpack_require__(30); - graphic.Image = __webpack_require__(61); + graphic.Image = __webpack_require__(62); graphic.Text = __webpack_require__(63); @@ -11482,7 +11981,8 @@ return /******/ (function(modules) { // webpackBootstrap } /** - * Set hover style of element + * Set hover style of element. + * This method can be called repeatly without side-effects. * @param {module:zrender/Element} el * @param {Object} [hoverStyle] * @param {Object} [opt] @@ -11715,14 +12215,14 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 44 */ +/* 45 */ /***/ function(module, exports, __webpack_require__) { - var Path = __webpack_require__(45); - var PathProxy = __webpack_require__(49); - var transformPath = __webpack_require__(60); + var Path = __webpack_require__(46); + var PathProxy = __webpack_require__(50); + var transformPath = __webpack_require__(61); var matrix = __webpack_require__(11); // command chars @@ -12123,7 +12623,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 45 */ +/* 46 */ /***/ function(module, exports, __webpack_require__) { /** @@ -12133,12 +12633,12 @@ return /******/ (function(modules) { // webpackBootstrap - var Displayable = __webpack_require__(46); + var Displayable = __webpack_require__(47); var zrUtil = __webpack_require__(4); - var PathProxy = __webpack_require__(49); - var pathContain = __webpack_require__(52); + var PathProxy = __webpack_require__(50); + var pathContain = __webpack_require__(53); - var Pattern = __webpack_require__(59); + var Pattern = __webpack_require__(60); var getCanvasPattern = Pattern.prototype.getCanvasPattern; var abs = Math.abs; @@ -12488,7 +12988,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 46 */ +/* 47 */ /***/ function(module, exports, __webpack_require__) { /** @@ -12501,10 +13001,10 @@ return /******/ (function(modules) { // webpackBootstrap var zrUtil = __webpack_require__(4); - var Style = __webpack_require__(47); + var Style = __webpack_require__(48); var Element = __webpack_require__(31); - var RectText = __webpack_require__(48); + var RectText = __webpack_require__(49); // var Stateful = require('./mixin/Stateful'); /** @@ -12762,7 +13262,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 47 */ +/* 48 */ /***/ function(module, exports) { /** @@ -13084,7 +13584,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 48 */ +/* 49 */ /***/ function(module, exports, __webpack_require__) { /** @@ -13226,8 +13726,9 @@ return /******/ (function(modules) { // webpackBootstrap } for (var i = 0; i < textLines.length; i++) { - textFill && ctx.fillText(textLines[i], x, y); + // Fill after stroke so the outline will not cover the main part. textStroke && ctx.strokeText(textLines[i], x, y); + textFill && ctx.fillText(textLines[i], x, y); y += textRect.lineHeight; } @@ -13239,7 +13740,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 49 */ +/* 50 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -13254,11 +13755,11 @@ return /******/ (function(modules) { // webpackBootstrap // TODO getTotalLength, getPointAtLength - var curve = __webpack_require__(50); + var curve = __webpack_require__(51); var vec2 = __webpack_require__(10); - var bbox = __webpack_require__(51); + var bbox = __webpack_require__(52); var BoundingRect = __webpack_require__(9); - var dpr = __webpack_require__(41).devicePixelRatio; + var dpr = __webpack_require__(42).devicePixelRatio; var CMD = { M: 1, @@ -14014,7 +14515,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 50 */ +/* 51 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -14560,7 +15061,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 51 */ +/* 52 */ /***/ function(module, exports, __webpack_require__) { /** @@ -14569,7 +15070,7 @@ return /******/ (function(modules) { // webpackBootstrap var vec2 = __webpack_require__(10); - var curve = __webpack_require__(50); + var curve = __webpack_require__(51); var bbox = {}; var mathMin = Math.min; @@ -14796,21 +15297,21 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 52 */ +/* 53 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; - var CMD = __webpack_require__(49).CMD; - var line = __webpack_require__(53); - var cubic = __webpack_require__(54); - var quadratic = __webpack_require__(55); - var arc = __webpack_require__(56); - var normalizeRadian = __webpack_require__(57).normalizeRadian; - var curve = __webpack_require__(50); + var CMD = __webpack_require__(50).CMD; + var line = __webpack_require__(54); + var cubic = __webpack_require__(55); + var quadratic = __webpack_require__(56); + var arc = __webpack_require__(57); + var normalizeRadian = __webpack_require__(58).normalizeRadian; + var curve = __webpack_require__(51); - var windingLine = __webpack_require__(58); + var windingLine = __webpack_require__(59); var containStroke = line.containStroke; @@ -15202,7 +15703,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 53 */ +/* 54 */ /***/ function(module, exports) { @@ -15250,12 +15751,12 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 54 */ +/* 55 */ /***/ function(module, exports, __webpack_require__) { - var curve = __webpack_require__(50); + var curve = __webpack_require__(51); module.exports = { /** @@ -15297,12 +15798,12 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 55 */ +/* 56 */ /***/ function(module, exports, __webpack_require__) { - var curve = __webpack_require__(50); + var curve = __webpack_require__(51); module.exports = { /** @@ -15342,12 +15843,12 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 56 */ +/* 57 */ /***/ function(module, exports, __webpack_require__) { - var normalizeRadian = __webpack_require__(57).normalizeRadian; + var normalizeRadian = __webpack_require__(58).normalizeRadian; var PI2 = Math.PI * 2; module.exports = { @@ -15408,7 +15909,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 57 */ +/* 58 */ /***/ function(module, exports) { @@ -15426,7 +15927,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 58 */ +/* 59 */ /***/ function(module, exports) { @@ -15453,7 +15954,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 59 */ +/* 60 */ /***/ function(module, exports) { @@ -15476,12 +15977,12 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 60 */ +/* 61 */ /***/ function(module, exports, __webpack_require__) { - var CMD = __webpack_require__(49).CMD; + var CMD = __webpack_require__(50).CMD; var vec2 = __webpack_require__(10); var v2ApplyTransform = vec2.applyTransform; @@ -15577,7 +16078,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 61 */ +/* 62 */ /***/ function(module, exports, __webpack_require__) { /** @@ -15587,11 +16088,11 @@ return /******/ (function(modules) { // webpackBootstrap - var Displayable = __webpack_require__(46); + var Displayable = __webpack_require__(47); var BoundingRect = __webpack_require__(9); var zrUtil = __webpack_require__(4); - var LRU = __webpack_require__(62); + var LRU = __webpack_require__(40); var globalImageCache = new LRU(50); /** * @alias zrender/graphic/Image @@ -15666,19 +16167,30 @@ return /******/ (function(modules) { // webpackBootstrap // } // Else is canvas - var width = style.width || image.width; - var height = style.height || image.height; var x = style.x || 0; var y = style.y || 0; // 图片加载失败 if (!image.width || !image.height) { return; } + var width = style.width; + var height = style.height; + var aspect = image.width / image.height; + if (width == null && height != null) { + // Keep image/height ratio + width = height * aspect; + } + else if (height == null && width != null) { + height = width / aspect; + } + else if (width == null && height == null) { + width = image.width; + height = image.height; + } // 设置transform this.setTransform(ctx); - if (style.sWidth && style.sHeight) { var sx = style.sx || 0; var sy = style.sy || 0; @@ -15703,14 +16215,6 @@ return /******/ (function(modules) { // webpackBootstrap ctx.drawImage(image, x, y, width, height); } - // 如果没设置宽和高的话自动根据图片宽高设置 - if (style.width == null) { - style.width = width; - } - if (style.height == null) { - style.height = height; - } - this.restoreTransform(ctx); // Draw rect text @@ -15738,183 +16242,8 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 62 */ -/***/ function(module, exports) { - - // Simple LRU cache use doubly linked list - // @module zrender/core/LRU - - - /** - * Simple double linked list. Compared with array, it has O(1) remove operation. - * @constructor - */ - var LinkedList = function() { - - /** - * @type {module:zrender/core/LRU~Entry} - */ - this.head = null; - - /** - * @type {module:zrender/core/LRU~Entry} - */ - this.tail = null; - - this._len = 0; - }; - - var linkedListProto = LinkedList.prototype; - /** - * Insert a new value at the tail - * @param {} val - * @return {module:zrender/core/LRU~Entry} - */ - linkedListProto.insert = function(val) { - var entry = new Entry(val); - this.insertEntry(entry); - return entry; - }; - - /** - * Insert an entry at the tail - * @param {module:zrender/core/LRU~Entry} entry - */ - linkedListProto.insertEntry = function(entry) { - if (!this.head) { - this.head = this.tail = entry; - } - else { - this.tail.next = entry; - entry.prev = this.tail; - this.tail = entry; - } - this._len++; - }; - - /** - * Remove entry. - * @param {module:zrender/core/LRU~Entry} entry - */ - linkedListProto.remove = function(entry) { - var prev = entry.prev; - var next = entry.next; - if (prev) { - prev.next = next; - } - else { - // Is head - this.head = next; - } - if (next) { - next.prev = prev; - } - else { - // Is tail - this.tail = prev; - } - entry.next = entry.prev = null; - this._len--; - }; - - /** - * @return {number} - */ - linkedListProto.len = function() { - return this._len; - }; - - /** - * @constructor - * @param {} val - */ - var Entry = function(val) { - /** - * @type {} - */ - this.value = val; - - /** - * @type {module:zrender/core/LRU~Entry} - */ - this.next; - - /** - * @type {module:zrender/core/LRU~Entry} - */ - this.prev; - }; - - /** - * LRU Cache - * @constructor - * @alias module:zrender/core/LRU - */ - var LRU = function(maxSize) { - - this._list = new LinkedList(); - - this._map = {}; - - this._maxSize = maxSize || 10; - }; - - var LRUProto = LRU.prototype; - - /** - * @param {string} key - * @param {} value - */ - LRUProto.put = function(key, value) { - var list = this._list; - var map = this._map; - if (map[key] == null) { - var len = list.len(); - if (len >= this._maxSize && len > 0) { - // Remove the least recently used - var leastUsedEntry = list.head; - list.remove(leastUsedEntry); - delete map[leastUsedEntry.key]; - } - - var entry = list.insert(value); - entry.key = key; - map[key] = entry; - } - }; - - /** - * @param {string} key - * @return {} - */ - LRUProto.get = function(key) { - var entry = this._map[key]; - var list = this._list; - if (entry != null) { - // Put the latest used entry in the tail - if (entry !== list.tail) { - list.remove(entry); - list.insertEntry(entry); - } - - return entry.value; - } - }; - - /** - * Clear the cache - */ - LRUProto.clear = function() { - this._list.clear(); - this._map = {}; - }; - - module.exports = LRU; - - -/***/ }, -/* 63 */ -/***/ function(module, exports, __webpack_require__) { +/* 63 */ +/***/ function(module, exports, __webpack_require__) { /** * Text element @@ -15927,7 +16256,7 @@ return /******/ (function(modules) { // webpackBootstrap - var Displayable = __webpack_require__(46); + var Displayable = __webpack_require__(47); var zrUtil = __webpack_require__(4); var textContain = __webpack_require__(8); @@ -15995,6 +16324,7 @@ return /******/ (function(modules) { // webpackBootstrap if (ctx.textAlign !== textAlign) { ctx.textAlign = 'left'; } + // FIXME in text contain default is top ctx.textBaseline = textBaseline || 'alphabetic'; // Use canvas default alphabetic baseline if (ctx.textBaseline !== textBaseline) { @@ -16005,8 +16335,9 @@ return /******/ (function(modules) { // webpackBootstrap var textLines = text.split('\n'); for (var i = 0; i < textLines.length; i++) { - style.hasFill() && ctx.fillText(textLines[i], x, y); + // Fill after stroke so the outline will not cover the main part. style.hasStroke() && ctx.strokeText(textLines[i], x, y); + style.hasFill() && ctx.fillText(textLines[i], x, y); y += lineHeight; } @@ -16015,8 +16346,8 @@ return /******/ (function(modules) { // webpackBootstrap }, getBoundingRect: function () { + var style = this.style; if (!this._rect) { - var style = this.style; var textVerticalAlign = style.textVerticalAlign; var rect = textContain.getBoundingRect( style.text + '', style.textFont || style.font, style.textAlign, @@ -16032,8 +16363,16 @@ return /******/ (function(modules) { // webpackBootstrap } rect.x += style.x || 0; rect.y += style.y || 0; + if (style.hasStroke()) { + var w = style.lineWidth; + rect.x -= w / 2; + rect.y -= w / 2; + rect.width += w; + rect.height += w; + } this._rect = rect; } + return this._rect; } }; @@ -16055,7 +16394,7 @@ return /******/ (function(modules) { // webpackBootstrap - module.exports = __webpack_require__(45).extend({ + module.exports = __webpack_require__(46).extend({ type: 'circle', @@ -16092,7 +16431,7 @@ return /******/ (function(modules) { // webpackBootstrap var env = __webpack_require__(2); - var Path = __webpack_require__(45); + var Path = __webpack_require__(46); var shadowTemp = [ ['shadowBlur', 0], @@ -16209,7 +16548,7 @@ return /******/ (function(modules) { // webpackBootstrap */ - module.exports = __webpack_require__(45).extend({ + module.exports = __webpack_require__(46).extend({ type: 'ring', @@ -16245,7 +16584,7 @@ return /******/ (function(modules) { // webpackBootstrap var polyHelper = __webpack_require__(68); - module.exports = __webpack_require__(45).extend({ + module.exports = __webpack_require__(46).extend({ type: 'polygon', @@ -16504,7 +16843,7 @@ return /******/ (function(modules) { // webpackBootstrap var polyHelper = __webpack_require__(68); - module.exports = __webpack_require__(45).extend({ + module.exports = __webpack_require__(46).extend({ type: 'polyline', @@ -16540,7 +16879,7 @@ return /******/ (function(modules) { // webpackBootstrap var roundRectHelper = __webpack_require__(73); - module.exports = __webpack_require__(45).extend({ + module.exports = __webpack_require__(46).extend({ type: 'rect', @@ -16680,7 +17019,7 @@ return /******/ (function(modules) { // webpackBootstrap * @module zrender/graphic/shape/Line */ - module.exports = __webpack_require__(45).extend({ + module.exports = __webpack_require__(46).extend({ type: 'line', @@ -16747,7 +17086,7 @@ return /******/ (function(modules) { // webpackBootstrap */ - var curveTool = __webpack_require__(50); + var curveTool = __webpack_require__(51); var vec2 = __webpack_require__(10); var quadraticSubdivide = curveTool.quadraticSubdivide; var cubicSubdivide = curveTool.cubicSubdivide; @@ -16774,7 +17113,7 @@ return /******/ (function(modules) { // webpackBootstrap ]; } } - module.exports = __webpack_require__(45).extend({ + module.exports = __webpack_require__(46).extend({ type: 'bezier-curve', @@ -16887,7 +17226,7 @@ return /******/ (function(modules) { // webpackBootstrap */ - module.exports = __webpack_require__(45).extend({ + module.exports = __webpack_require__(46).extend({ type: 'arc', @@ -16938,7 +17277,7 @@ return /******/ (function(modules) { // webpackBootstrap // CompoundPath to improve performance - var Path = __webpack_require__(45); + var Path = __webpack_require__(46); module.exports = Path.extend({ type: 'compound', @@ -17299,7 +17638,7 @@ return /******/ (function(modules) { // webpackBootstrap /** * @type {string} */ - zrender.version = '3.3.0'; + zrender.version = '3.4.0'; /** * Initializing a zrender instance @@ -17386,6 +17725,7 @@ return /******/ (function(modules) { // webpackBootstrap var storage = new Storage(); var rendererType = opts.renderer; + // TODO WebGL if (useVML) { if (!painterCtors.vml) { throw new Error('You need to require \'zrender/vml/vml\' to support IE8'); @@ -17616,9 +17956,8 @@ return /******/ (function(modules) { // webpackBootstrap * @param {number} width * @param {number} height */ - pathToImage: function(e, width, height) { - var id = guid(); - return this.painter.pathToImage(id, e, width, height); + pathToImage: function(e, dpr) { + return this.painter.pathToImage(e, dpr); }, /** @@ -19175,7 +19514,7 @@ return /******/ (function(modules) { // webpackBootstrap var deferredClips = []; for (var i = 0; i < len; i++) { var clip = clips[i]; - var e = clip.step(time); + var e = clip.step(time, delta); // Throw out the events need to be called after // stage.update, like destroy if (e) { @@ -19998,9 +20337,9 @@ return /******/ (function(modules) { // webpackBootstrap */ - var config = __webpack_require__(41); + var config = __webpack_require__(42); var util = __webpack_require__(4); - var log = __webpack_require__(40); + var log = __webpack_require__(41); var BoundingRect = __webpack_require__(9); var timsort = __webpack_require__(86); @@ -20023,7 +20362,7 @@ return /******/ (function(modules) { // webpackBootstrap return false; } - if (layer.isBuildin) { + if (layer.__builtin__) { return true; } @@ -20177,6 +20516,12 @@ return /******/ (function(modules) { // webpackBootstrap root.appendChild(domRoot); } else { + if (opts.width != null) { + root.width = opts.width; + } + if (opts.height != null) { + root.height = opts.height; + } // Use canvas width and height directly var width = root.width; var height = root.height; @@ -20195,8 +20540,6 @@ return /******/ (function(modules) { // webpackBootstrap this._domRoot = root; } - this.pathToImage = this._createPathToImage(); - // Layers for progressive rendering this._progressiveLayers = []; @@ -20243,7 +20586,7 @@ return /******/ (function(modules) { // webpackBootstrap for (var i = 0; i < zlevelList.length; i++) { var z = zlevelList[i]; var layer = this._layers[z]; - if (!layer.isBuildin && layer.refresh) { + if (!layer.__builtin__ && layer.refresh) { layer.refresh(); } } @@ -20386,11 +20729,11 @@ return /******/ (function(modules) { // webpackBootstrap this._clearProgressive(); - this.eachBuildinLayer(preProcessLayer); + this.eachBuiltinLayer(preProcessLayer); this._doPaintList(list, paintAll); - this.eachBuildinLayer(postProcessLayer); + this.eachBuiltinLayer(postProcessLayer); }, _doPaintList: function (list, paintAll) { @@ -20446,7 +20789,7 @@ return /******/ (function(modules) { // webpackBootstrap currentZLevel = elZLevel; currentLayer = this.getLayer(currentZLevel); - if (!currentLayer.isBuildin) { + if (!currentLayer.__builtin__) { log( 'ZLevel ' + currentZLevel + ' has been used by unkown layer ' + currentLayer.id @@ -20591,7 +20934,7 @@ return /******/ (function(modules) { // webpackBootstrap if (!layer) { // Create a new layer layer = new Layer('zr_' + zlevel, this, this.dpr); - layer.isBuildin = true; + layer.__builtin__ = true; if (this._layerConfig[zlevel]) { util.merge(layer, this._layerConfig[zlevel], true); @@ -20639,28 +20982,33 @@ return /******/ (function(modules) { // webpackBootstrap } zlevelList.splice(i + 1, 0, zlevel); - if (prevLayer) { - var prevDom = prevLayer.dom; - if (prevDom.nextSibling) { - domRoot.insertBefore( - layer.dom, - prevDom.nextSibling - ); - } - else { - domRoot.appendChild(layer.dom); - } - } - else { - if (domRoot.firstChild) { - domRoot.insertBefore(layer.dom, domRoot.firstChild); + layersMap[zlevel] = layer; + + // Vitual layer will not directly show on the screen. + // (It can be a WebGL layer and assigned to a ZImage element) + // But it still under management of zrender. + if (!layer.virtual) { + if (prevLayer) { + var prevDom = prevLayer.dom; + if (prevDom.nextSibling) { + domRoot.insertBefore( + layer.dom, + prevDom.nextSibling + ); + } + else { + domRoot.appendChild(layer.dom); + } } else { - domRoot.appendChild(layer.dom); + if (domRoot.firstChild) { + domRoot.insertBefore(layer.dom, domRoot.firstChild); + } + else { + domRoot.appendChild(layer.dom); + } } } - - layersMap[zlevel] = layer; }, // Iterate each layer @@ -20675,7 +21023,7 @@ return /******/ (function(modules) { // webpackBootstrap }, // Iterate each buildin layer - eachBuildinLayer: function (cb, context) { + eachBuiltinLayer: function (cb, context) { var zlevelList = this._zlevelList; var layer; var z; @@ -20683,7 +21031,7 @@ return /******/ (function(modules) { // webpackBootstrap for (i = 0; i < zlevelList.length; i++) { z = zlevelList[i]; layer = this._layers[z]; - if (layer.isBuildin) { + if (layer.__builtin__) { cb.call(context, layer, z); } } @@ -20698,7 +21046,7 @@ return /******/ (function(modules) { // webpackBootstrap for (i = 0; i < zlevelList.length; i++) { z = zlevelList[i]; layer = this._layers[z]; - if (! layer.isBuildin) { + if (!layer.__builtin__) { cb.call(context, layer, z); } } @@ -20720,7 +21068,7 @@ return /******/ (function(modules) { // webpackBootstrap var elCountsLastFrame = {}; var progressiveElCountsLastFrame = {}; - this.eachBuildinLayer(function (layer, z) { + this.eachBuiltinLayer(function (layer, z) { elCountsLastFrame[z] = layer.elCount; layer.elCount = 0; layer.__dirty = false; @@ -20794,7 +21142,7 @@ return /******/ (function(modules) { // webpackBootstrap } // 层中的元素数量有发生变化 - this.eachBuildinLayer(function (layer, z) { + this.eachBuiltinLayer(function (layer, z) { if (elCountsLastFrame[z] !== layer.elCount) { layer.__dirty = true; } @@ -20815,7 +21163,7 @@ return /******/ (function(modules) { // webpackBootstrap * 清除hover层外所有内容 */ clear: function () { - this.eachBuildinLayer(this._clearLayer); + this.eachBuiltinLayer(this._clearLayer); return this; }, @@ -20995,30 +21343,47 @@ return /******/ (function(modules) { // webpackBootstrap ) | 0; }, - _pathToImage: function (id, path, width, height, dpr) { + pathToImage: function (path, dpr) { + dpr = dpr || this.dpr; + var canvas = document.createElement('canvas'); var ctx = canvas.getContext('2d'); + var rect = path.getBoundingRect(); + var style = path.style; + var shadowBlurSize = style.shadowBlur; + var shadowOffsetX = style.shadowOffsetX; + var shadowOffsetY = style.shadowOffsetY; + var lineWidth = style.hasStroke() ? style.lineWidth : 0; + + var leftMargin = Math.max(lineWidth / 2, -shadowOffsetX + shadowBlurSize); + var rightMargin = Math.max(lineWidth / 2, shadowOffsetX + shadowBlurSize); + var topMargin = Math.max(lineWidth / 2, -shadowOffsetY + shadowBlurSize); + var bottomMargin = Math.max(lineWidth / 2, shadowOffsetY + shadowBlurSize); + var width = rect.width + leftMargin + rightMargin; + var height = rect.height + topMargin + bottomMargin; canvas.width = width * dpr; canvas.height = height * dpr; - ctx.clearRect(0, 0, width * dpr, height * dpr); + ctx.scale(dpr, dpr); + ctx.clearRect(0, 0, width, height); + ctx.dpr = dpr; var pathTransform = { position: path.position, rotation: path.rotation, scale: path.scale }; - path.position = [0, 0, 0]; + path.position = [leftMargin - rect.x, topMargin - rect.y]; path.rotation = 0; path.scale = [1, 1]; + path.updateTransform(); if (path) { path.brush(ctx); } - var ImageShape = __webpack_require__(61); + var ImageShape = __webpack_require__(62); var imgShape = new ImageShape({ - id: id, style: { x: 0, y: 0, @@ -21039,16 +21404,6 @@ return /******/ (function(modules) { // webpackBootstrap } return imgShape; - }, - - _createPathToImage: function () { - var me = this; - - return function (id, e, width, height) { - return me._pathToImage( - id, e, width, height, me.dpr - ); - }; } }; @@ -21067,9 +21422,9 @@ return /******/ (function(modules) { // webpackBootstrap var util = __webpack_require__(4); - var config = __webpack_require__(41); - var Style = __webpack_require__(47); - var Pattern = __webpack_require__(59); + var config = __webpack_require__(42); + var Style = __webpack_require__(48); + var Pattern = __webpack_require__(60); function returnFalse() { return false; @@ -21528,7 +21883,7 @@ return /******/ (function(modules) { // webpackBootstrap - var graphic = __webpack_require__(43); + var graphic = __webpack_require__(44); var zrUtil = __webpack_require__(4); var PI = Math.PI; /** @@ -21676,8 +22031,9 @@ return /******/ (function(modules) { // webpackBootstrap * @constructor * @alias module:echarts/data/List * - * @param {Array.} dimensions - * Dimensions should be concrete names like x, y, z, lng, lat, angle, radius + * @param {Array.} dimensions + * For example, ['someDimName', {name: 'someDimName', type: 'someDimType'}, ...]. + * Dimensions should be concrete names like x, y, z, lng, lat, angle, radius * @param {module:echarts/model/Model} hostModel */ var List = function (dimensions, hostModel) { @@ -22177,37 +22533,39 @@ return /******/ (function(modules) { // webpackBootstrap * @param {number} value * @param {boolean} stack If given value is after stacked * @param {number} [maxDistance=Infinity] - * @return {number} + * @return {Array.} Considere multiple points has the same value. */ listProto.indexOfNearest = function (dim, value, stack, maxDistance) { var storage = this._storage; var dimData = storage[dim]; + var nearestIndices = []; + + if (!dimData) { + return nearestIndices; + } if (maxDistance == null) { maxDistance = Infinity; } - var nearestIdx = -1; - if (dimData) { - var minDist = Number.MAX_VALUE; - for (var i = 0, len = this.count(); i < len; i++) { - var diff = value - this.get(dim, i, stack); - var dist = Math.abs(diff); - if ( - diff <= maxDistance - && (dist < minDist - // For the case of two data are same on xAxis, which has sequence data. - // Show the nearest index - // https://github.com/ecomfe/echarts/issues/2869 - || (dist === minDist && diff > 0) - ) - ) { + var minDist = Number.MAX_VALUE; + var minDiff = -1; + for (var i = 0, len = this.count(); i < len; i++) { + var diff = value - this.get(dim, i, stack); + var dist = Math.abs(diff); + if (diff <= maxDistance && dist <= minDist) { + // For the case of two data are same on xAxis, which has sequence data. + // Show the nearest index + // https://github.com/ecomfe/echarts/issues/2869 + if (dist < minDist || (diff >= 0 && minDiff < 0)) { minDist = dist; - nearestIdx = i; + minDiff = diff; + nearestIndices.length = 0; } + nearestIndices.push(i); } } - return nearestIdx; + return nearestIndices; }; /** @@ -22909,147 +23267,349 @@ return /******/ (function(modules) { // webpackBootstrap + var numberUtil = __webpack_require__(7); + var linearMap = numberUtil.linearMap; var zrUtil = __webpack_require__(4); - var echarts = __webpack_require__(1); - var PRIORITY = echarts.PRIORITY; - __webpack_require__(101); - __webpack_require__(104); - - echarts.registerVisual(zrUtil.curry( - __webpack_require__(110), 'line', 'circle', 'line' - )); - echarts.registerLayout(zrUtil.curry( - __webpack_require__(111), 'line' - )); - - // Down sample after filter - echarts.registerProcessor(PRIORITY.PROCESSOR.STATISTIC, zrUtil.curry( - __webpack_require__(112), 'line' - )); + function fixExtentWithBands(extent, nTick) { + var size = extent[1] - extent[0]; + var len = nTick; + var margin = size / len / 2; + extent[0] += margin; + extent[1] -= margin; + } - // In case developer forget to include grid component - __webpack_require__(113); + var normalizedExtent = [0, 1]; + /** + * @name module:echarts/coord/CartesianAxis + * @constructor + */ + var Axis = function (dim, scale, extent) { + /** + * Axis dimension. Such as 'x', 'y', 'z', 'angle', 'radius' + * @type {string} + */ + this.dim = dim; -/***/ }, -/* 101 */ -/***/ function(module, exports, __webpack_require__) { + /** + * Axis scale + * @type {module:echarts/coord/scale/*} + */ + this.scale = scale; - 'use strict'; + /** + * @type {Array.} + * @private + */ + this._extent = extent || [0, 0]; + /** + * @type {boolean} + */ + this.inverse = false; - var createListFromArray = __webpack_require__(102); - var SeriesModel = __webpack_require__(28); + /** + * Usually true when axis has a ordinal scale + * @type {boolean} + */ + this.onBand = false; + }; - module.exports = SeriesModel.extend({ + Axis.prototype = { - type: 'series.line', + constructor: Axis, - dependencies: ['grid', 'polar'], + /** + * If axis extent contain given coord + * @param {number} coord + * @return {boolean} + */ + contain: function (coord) { + var extent = this._extent; + var min = Math.min(extent[0], extent[1]); + var max = Math.max(extent[0], extent[1]); + return coord >= min && coord <= max; + }, - getInitialData: function (option, ecModel) { - if (true) { - var coordSys = option.coordinateSystem; - if (coordSys !== 'polar' && coordSys !== 'cartesian2d') { - throw new Error('Line not support coordinateSystem besides cartesian and polar'); - } + /** + * If axis extent contain given data + * @param {number} data + * @return {boolean} + */ + containData: function (data) { + return this.contain(this.dataToCoord(data)); + }, + + /** + * Get coord extent. + * @return {Array.} + */ + getExtent: function () { + var ret = this._extent.slice(); + return ret; + }, + + /** + * Get precision used for formatting + * @param {Array.} [dataExtent] + * @return {number} + */ + getPixelPrecision: function (dataExtent) { + return numberUtil.getPixelPrecision( + dataExtent || this.scale.getExtent(), + this._extent + ); + }, + + /** + * Set coord extent + * @param {number} start + * @param {number} end + */ + setExtent: function (start, end) { + var extent = this._extent; + extent[0] = start; + extent[1] = end; + }, + + /** + * Convert data to coord. Data is the rank if it has a ordinal scale + * @param {number} data + * @param {boolean} clamp + * @return {number} + */ + dataToCoord: function (data, clamp) { + var extent = this._extent; + var scale = this.scale; + data = scale.normalize(data); + + if (this.onBand && scale.type === 'ordinal') { + extent = extent.slice(); + fixExtentWithBands(extent, scale.count()); } - return createListFromArray(option.data, this, ecModel); + + return linearMap(data, normalizedExtent, extent, clamp); }, - defaultOption: { - zlevel: 0, // 一级层叠 - z: 2, // 二级层叠 - coordinateSystem: 'cartesian2d', - legendHoverLink: true, + /** + * Convert coord to data. Data is the rank if it has a ordinal scale + * @param {number} coord + * @param {boolean} clamp + * @return {number} + */ + coordToData: function (coord, clamp) { + var extent = this._extent; + var scale = this.scale; - hoverAnimation: true, - // stack: null - // xAxisIndex: 0, - // yAxisIndex: 0, + if (this.onBand && scale.type === 'ordinal') { + extent = extent.slice(); + fixExtentWithBands(extent, scale.count()); + } - // polarIndex: 0, + var t = linearMap(coord, extent, normalizedExtent, clamp); - // If clip the overflow value - clipOverflow: true, + return this.scale.scale(t); + }, - label: { - normal: { - position: 'top' + /** + * Convert pixel point to data in axis + * @param {Array.} point + * @param {boolean} clamp + * @return {number} data + */ + pointToData: function (point, clamp) { + // Should be implemented in derived class if necessary. + }, + + /** + * @return {Array.} + */ + getTicksCoords: function (alignWithLabel) { + if (this.onBand && !alignWithLabel) { + var bands = this.getBands(); + var coords = []; + for (var i = 0; i < bands.length; i++) { + coords.push(bands[i][0]); } - }, - // itemStyle: { - // normal: {}, - // emphasis: {} - // }, - lineStyle: { - normal: { - width: 2, - type: 'solid' + if (bands[i - 1]) { + coords.push(bands[i - 1][1]); } - }, - // areaStyle: {}, - // false, 'start', 'end', 'middle' - step: false, + return coords; + } + else { + return zrUtil.map(this.scale.getTicks(), this.dataToCoord, this); + } + }, - // Disabled if step is true - smooth: false, - smoothMonotone: null, - // 拐点图形类型 - symbol: 'emptyCircle', - // 拐点图形大小 - symbolSize: 4, - // 拐点图形旋转控制 - symbolRotate: null, + /** + * Coords of labels are on the ticks or on the middle of bands + * @return {Array.} + */ + getLabelsCoords: function () { + return zrUtil.map(this.scale.getTicks(), this.dataToCoord, this); + }, - // 是否显示 symbol, 只有在 tooltip hover 的时候显示 - showSymbol: true, - // 标志图形默认只有主轴显示(随主轴标签间隔隐藏策略) - showAllSymbol: false, + /** + * Get bands. + * + * If axis has labels [1, 2, 3, 4]. Bands on the axis are + * |---1---|---2---|---3---|---4---|. + * + * @return {Array} + */ + // FIXME Situation when labels is on ticks + getBands: function () { + var extent = this.getExtent(); + var bands = []; + var len = this.scale.count(); + var start = extent[0]; + var end = extent[1]; + var span = end - start; - // 是否连接断点 - connectNulls: false, + for (var i = 0; i < len; i++) { + bands.push([ + span * i / len + start, + span * (i + 1) / len + start + ]); + } + return bands; + }, - // 数据过滤,'average', 'max', 'min', 'sum' - sampling: 'none', + /** + * Get width of band + * @return {number} + */ + getBandWidth: function () { + var axisExtent = this._extent; + var dataExtent = this.scale.getExtent(); - animationEasing: 'linear', + var len = dataExtent[1] - dataExtent[0] + (this.onBand ? 1 : 0); + // Fix #2728, avoid NaN when only one data. + len === 0 && (len = 1); - // Disable progressive - progressive: 0, - hoverLayerThreshold: Infinity + var size = Math.abs(axisExtent[1] - axisExtent[0]); + + return Math.abs(size) / len; } - }); + + }; + + module.exports = Axis; /***/ }, -/* 102 */ +/* 101 */ /***/ function(module, exports, __webpack_require__) { - 'use strict'; - + - var List = __webpack_require__(98); - var completeDimensions = __webpack_require__(103); - var zrUtil = __webpack_require__(4); - var modelUtil = __webpack_require__(5); - var CoordinateSystem = __webpack_require__(26); - var getDataItemValue = modelUtil.getDataItemValue; - var converDataValue = modelUtil.converDataValue; + var createListFromArray = __webpack_require__(102); + var symbolUtil = __webpack_require__(104); + var axisHelper = __webpack_require__(105); + var axisModelCommonMixin = __webpack_require__(111); + var Model = __webpack_require__(12); + var util = __webpack_require__(4); - function firstDataNotNull(data) { - var i = 0; - while (i < data.length && data[i] == null) { - i++; - } - return data[i]; - } - function ifNeedCompleteOrdinalData(data) { - var sampleItem = firstDataNotNull(data); - return sampleItem != null - && !zrUtil.isArray(getDataItemValue(sampleItem)); - } + module.exports = { + /** + * Create a muti dimension List structure from seriesModel. + * @param {module:echarts/model/Model} seriesModel + * @return {module:echarts/data/List} list + */ + createList: function (seriesModel) { + var data = seriesModel.get('data'); + return createListFromArray(data, seriesModel, seriesModel.ecModel); + }, + + /** + * Complete the dimensions array guessed from the data structure. + * @param {Array.} dimensions Necessary dimensions, like ['x', 'y'] + * @param {Array} data Data list. [[1, 2, 3], [2, 3, 4]] + * @param {Object} [opt] + * @param {Array.} [opt.defaultNames] Default names to fill not necessary dimensions, like ['value'] + * @param {string} [opt.extraPrefix] Prefix of name when filling the left dimensions. + * @param {number} [opt.dimCount] If not specified, guess by the first data item. + * @return {Array.} + */ + completeDimensions: __webpack_require__(103), + + /** + * Create a symbol element with given symbol configuration: shape, x, y, width, height, color + * @see http://echarts.baidu.com/option.html#series-scatter.symbol + * @param {string} symbolDesc + * @param {number} x + * @param {number} y + * @param {number} w + * @param {number} h + * @param {string} color + */ + createSymbol: symbolUtil.createSymbol, + + /** + * Create scale + * @param {Array.} dataExtent + * @param {Object|module:echarts/Model} option + */ + createScale: function (dataExtent, option) { + var axisModel = option; + if (!(option instanceof Model)) { + axisModel = new Model(option); + util.mixin(axisModel, axisModelCommonMixin); + } + + var scale = axisHelper.createScaleByModel(axisModel); + scale.setExtent(dataExtent[0], dataExtent[1]); + + axisHelper.niceScaleExtent(scale, axisModel); + return scale; + }, + + /** + * Mixin common methods to axis model, + * + * Inlcude methods + * `getFormattedLabels() => Array.` + * `getCategories() => Array.` + * `getMin(origin: boolean) => number` + * `getMax(origin: boolean) => number` + * `getNeedCrossZero() => boolean` + * `setRange(start: number, end: number)` + * `resetRange()` + */ + mixinAxisModelCommonMethods: function (Model) { + util.mixin(Model, axisModelCommonMixin); + } + }; + + +/***/ }, +/* 102 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + + var List = __webpack_require__(98); + var completeDimensions = __webpack_require__(103); + var zrUtil = __webpack_require__(4); + var modelUtil = __webpack_require__(5); + var CoordinateSystem = __webpack_require__(26); + var getDataItemValue = modelUtil.getDataItemValue; + var converDataValue = modelUtil.converDataValue; + + function firstDataNotNull(data) { + var i = 0; + while (i < data.length && data[i] == null) { + i++; + } + return data[i]; + } + function ifNeedCompleteOrdinalData(data) { + var sampleItem = firstDataNotNull(data); + return sampleItem != null + && !zrUtil.isArray(getDataItemValue(sampleItem)); + } /** * Helper function to create a list from option data @@ -23072,9 +23632,14 @@ return /******/ (function(modules) { // webpackBootstrap var dimensions = axesInfo && axesInfo.dimensions; if (!dimensions) { // Get dimensions from registered coordinate system - dimensions = (registeredCoordSys && registeredCoordSys.dimensions) || ['x', 'y']; - dimensions = completeDimensions(dimensions, data, dimensions.concat(['value'])); + dimensions = (registeredCoordSys && ( + registeredCoordSys.getDimensionsInfo + ? registeredCoordSys.getDimensionsInfo() + : registeredCoordSys.dimensions.slice() + )) || ['x', 'y']; + dimensions = completeDimensions(dimensions, data, {defaultNames: dimensions.concat(['value'])}); } + var categoryIndex = axesInfo ? axesInfo.categoryIndex : -1; var list = new List(dimensions, seriesModel); @@ -23191,7 +23756,7 @@ return /******/ (function(modules) { // webpackBootstrap var isXAxisCateogry = xAxisType === 'category'; var isYAxisCategory = yAxisType === 'category'; - completeDimensions(dimensions, data, ['x', 'y', 'z']); + completeDimensions(dimensions, data, {defaultNames: ['x', 'y', 'z']}); var categoryAxesModels = {}; if (isXAxisCateogry) { @@ -23281,7 +23846,7 @@ return /******/ (function(modules) { // webpackBootstrap var isAngleAxisCateogry = angleAxisType === 'category'; var isRadiusAxisCateogry = radiusAxisType === 'category'; - completeDimensions(dimensions, data, ['radius', 'angle', 'value']); + completeDimensions(dimensions, data, {defaultNames: ['radius', 'angle', 'value']}); var categoryAxesModels = {}; if (isRadiusAxisCateogry) { @@ -23304,7 +23869,7 @@ return /******/ (function(modules) { // webpackBootstrap dimensions: completeDimensions([ {name: 'lng'}, {name: 'lat'} - ], data, ['lng', 'lat', 'value']) + ], data, {defaultNames: ['lng', 'lat', 'value']}) }; } }; @@ -23359,23 +23924,30 @@ return /******/ (function(modules) { // webpackBootstrap /** * Complete the dimensions array guessed from the data structure. - * @param {Array.} dimensions Necessary dimensions, like ['x', 'y'] - * @param {Array} data Data list. [[1, 2, 3], [2, 3, 4]] - * @param {Array.} [defaultNames] Default names to fill not necessary dimensions, like ['value'] - * @param {string} [extraPrefix] Prefix of name when filling the left dimensions. + * @param {Array.} dimensions Necessary dimensions, like ['x', 'y'] + * @param {Array} data Data list. [[1, 2, 3], [2, 3, 4]] + * @param {Object} [opt] + * @param {Array.} [opt.defaultNames] Default names to fill not necessary dimensions, like ['value'] + * @param {string} [opt.extraPrefix] Prefix of name when filling the left dimensions. + * @param {number} [opt.dimCount] If not specified, guess by the first data item. * @return {Array.} */ - function completeDimensions(dimensions, data, defaultNames, extraPrefix) { + function completeDimensions(dimensions, data, opt) { if (!data) { return dimensions; } - var value0 = retrieveValue(data[0]); - var dimSize = zrUtil.isArray(value0) && value0.length || 1; + opt = opt || {}; - defaultNames = defaultNames || []; - extraPrefix = extraPrefix || 'extra'; - for (var i = 0; i < dimSize; i++) { + var dimCount = opt.dimCount; + if (dimCount == null) { + var value0 = retrieveValue(data[0]); + dimCount = zrUtil.isArray(value0) && value0.length || 1; + } + + var defaultNames = opt.defaultNames || []; + var extraPrefix = opt.extraPrefix || 'extra'; + for (var i = 0; i < dimCount; i++) { if (!dimensions[i]) { var name = defaultNames[i] || (extraPrefix + (i - defaultNames.length)); dimensions[i] = guessOrdinal(data, i) @@ -23421,1505 +23993,2858 @@ return /******/ (function(modules) { // webpackBootstrap /***/ function(module, exports, __webpack_require__) { 'use strict'; - // FIXME step not support polar + // Symbol factory - var zrUtil = __webpack_require__(4); - var SymbolDraw = __webpack_require__(105); - var Symbol = __webpack_require__(106); - var lineAnimationDiff = __webpack_require__(108); - var graphic = __webpack_require__(43); - var modelUtil = __webpack_require__(5); - var polyHelper = __webpack_require__(109); - var ChartView = __webpack_require__(42); + var graphic = __webpack_require__(44); + var BoundingRect = __webpack_require__(9); - function isPointsSame(points1, points2) { - if (points1.length !== points2.length) { - return; - } - for (var i = 0; i < points1.length; i++) { - var p1 = points1[i]; - var p2 = points2[i]; - if (p1[0] !== p2[0] || p1[1] !== p2[1]) { - return; - } + /** + * Triangle shape + * @inner + */ + var Triangle = graphic.extendShape({ + type: 'triangle', + shape: { + cx: 0, + cy: 0, + width: 0, + height: 0 + }, + buildPath: function (path, shape) { + var cx = shape.cx; + var cy = shape.cy; + var width = shape.width / 2; + var height = shape.height / 2; + path.moveTo(cx, cy - height); + path.lineTo(cx + width, cy + height); + path.lineTo(cx - width, cy + height); + path.closePath(); } - return true; - } - - function getSmooth(smooth) { - return typeof (smooth) === 'number' ? smooth : (smooth ? 0.3 : 0); - } - - function getAxisExtentWithGap(axis) { - var extent = axis.getGlobalExtent(); - if (axis.onBand) { - // Remove extra 1px to avoid line miter in clipped edge - var halfBandWidth = axis.getBandWidth() / 2 - 1; - var dir = extent[1] > extent[0] ? 1 : -1; - extent[0] += dir * halfBandWidth; - extent[1] -= dir * halfBandWidth; + }); + /** + * Diamond shape + * @inner + */ + var Diamond = graphic.extendShape({ + type: 'diamond', + shape: { + cx: 0, + cy: 0, + width: 0, + height: 0 + }, + buildPath: function (path, shape) { + var cx = shape.cx; + var cy = shape.cy; + var width = shape.width / 2; + var height = shape.height / 2; + path.moveTo(cx, cy - height); + path.lineTo(cx + width, cy); + path.lineTo(cx, cy + height); + path.lineTo(cx - width, cy); + path.closePath(); } - return extent; - } + }); - function sign(val) { - return val >= 0 ? 1 : -1; - } /** - * @param {module:echarts/coord/cartesian/Cartesian2D|module:echarts/coord/polar/Polar} coordSys - * @param {module:echarts/data/List} data - * @param {Array.>} points - * @private + * Pin shape + * @inner */ - function getStackedOnPoints(coordSys, data) { - var baseAxis = coordSys.getBaseAxis(); - var valueAxis = coordSys.getOtherAxis(baseAxis); - var valueStart = baseAxis.onZero - ? 0 : valueAxis.scale.getExtent()[0]; - - var valueDim = valueAxis.dim; + var Pin = graphic.extendShape({ + type: 'pin', + shape: { + // x, y on the cusp + x: 0, + y: 0, + width: 0, + height: 0 + }, - var baseDataOffset = valueDim === 'x' || valueDim === 'radius' ? 1 : 0; + buildPath: function (path, shape) { + var x = shape.x; + var y = shape.y; + var w = shape.width / 5 * 3; + // Height must be larger than width + var h = Math.max(w, shape.height); + var r = w / 2; - return data.mapArray([valueDim], function (val, idx) { - var stackedOnSameSign; - var stackedOn = data.stackedOn; - // Find first stacked value with same sign - while (stackedOn && - sign(stackedOn.get(valueDim, idx)) === sign(val) - ) { - stackedOnSameSign = stackedOn; - break; - } - var stackedData = []; - stackedData[baseDataOffset] = data.get(baseAxis.dim, idx); - stackedData[1 - baseDataOffset] = stackedOnSameSign - ? stackedOnSameSign.get(valueDim, idx, true) : valueStart; + // Dist on y with tangent point and circle center + var dy = r * r / (h - r); + var cy = y - h + r + dy; + var angle = Math.asin(dy / r); + // Dist on x with tangent point and circle center + var dx = Math.cos(angle) * r; - return coordSys.dataToPoint(stackedData); - }, true); - } + var tanX = Math.sin(angle); + var tanY = Math.cos(angle); - function createGridClipShape(cartesian, hasAnimation, seriesModel) { - var xExtent = getAxisExtentWithGap(cartesian.getAxis('x')); - var yExtent = getAxisExtentWithGap(cartesian.getAxis('y')); - var isHorizontal = cartesian.getBaseAxis().isHorizontal(); + path.arc( + x, cy, r, + Math.PI - angle, + Math.PI * 2 + angle + ); - var x = Math.min(xExtent[0], xExtent[1]); - var y = Math.min(yExtent[0], yExtent[1]); - var width = Math.max(xExtent[0], xExtent[1]) - x; - var height = Math.max(yExtent[0], yExtent[1]) - y; - var lineWidth = seriesModel.get('lineStyle.normal.width') || 2; - // Expand clip shape to avoid clipping when line value exceeds axis - var expandSize = seriesModel.get('clipOverflow') ? lineWidth / 2 : Math.max(width, height); - if (isHorizontal) { - y -= expandSize; - height += expandSize * 2; - } - else { - x -= expandSize; - width += expandSize * 2; + var cpLen = r * 0.6; + var cpLen2 = r * 0.7; + path.bezierCurveTo( + x + dx - tanX * cpLen, cy + dy + tanY * cpLen, + x, y - cpLen2, + x, y + ); + path.bezierCurveTo( + x, y - cpLen2, + x - dx + tanX * cpLen, cy + dy + tanY * cpLen, + x - dx, cy + dy + ); + path.closePath(); } + }); - var clipPath = new graphic.Rect({ - shape: { - x: x, - y: y, - width: width, - height: height - } - }); - - if (hasAnimation) { - clipPath.shape[isHorizontal ? 'width' : 'height'] = 0; - graphic.initProps(clipPath, { - shape: { - width: width, - height: height - } - }, seriesModel); - } + /** + * Arrow shape + * @inner + */ + var Arrow = graphic.extendShape({ - return clipPath; - } + type: 'arrow', - function createPolarClipShape(polar, hasAnimation, seriesModel) { - var angleAxis = polar.getAngleAxis(); - var radiusAxis = polar.getRadiusAxis(); + shape: { + x: 0, + y: 0, + width: 0, + height: 0 + }, - var radiusExtent = radiusAxis.getExtent(); - var angleExtent = angleAxis.getExtent(); + buildPath: function (ctx, shape) { + var height = shape.height; + var width = shape.width; + var x = shape.x; + var y = shape.y; + var dx = width / 3 * 2; + ctx.moveTo(x, y); + ctx.lineTo(x + dx, y + height); + ctx.lineTo(x, y + height / 4 * 3); + ctx.lineTo(x - dx, y + height); + ctx.lineTo(x, y); + ctx.closePath(); + } + }); - var RADIAN = Math.PI / 180; + /** + * Map of path contructors + * @type {Object.} + */ + var symbolCtors = { + line: graphic.Line, - var clipPath = new graphic.Sector({ - shape: { - cx: polar.cx, - cy: polar.cy, - r0: radiusExtent[0], - r: radiusExtent[1], - startAngle: -angleExtent[0] * RADIAN, - endAngle: -angleExtent[1] * RADIAN, - clockwise: angleAxis.inverse - } - }); + rect: graphic.Rect, - if (hasAnimation) { - clipPath.shape.endAngle = -angleExtent[0] * RADIAN; - graphic.initProps(clipPath, { - shape: { - endAngle: -angleExtent[1] * RADIAN - } - }, seriesModel); - } + roundRect: graphic.Rect, - return clipPath; - } + square: graphic.Rect, - function createClipShape(coordSys, hasAnimation, seriesModel) { - return coordSys.type === 'polar' - ? createPolarClipShape(coordSys, hasAnimation, seriesModel) - : createGridClipShape(coordSys, hasAnimation, seriesModel); - } + circle: graphic.Circle, - function turnPointsIntoStep(points, coordSys, stepTurnAt) { - var baseAxis = coordSys.getBaseAxis(); - var baseIndex = baseAxis.dim === 'x' || baseAxis.dim === 'radius' ? 0 : 1; + diamond: Diamond, - var stepPoints = []; - for (var i = 0; i < points.length - 1; i++) { - var nextPt = points[i + 1]; - var pt = points[i]; - stepPoints.push(pt); + pin: Pin, - var stepPt = []; - switch (stepTurnAt) { - case 'end': - stepPt[baseIndex] = nextPt[baseIndex]; - stepPt[1 - baseIndex] = pt[1 - baseIndex]; - // default is start - stepPoints.push(stepPt); - break; - case 'middle': - // default is start - var middle = (pt[baseIndex] + nextPt[baseIndex]) / 2; - var stepPt2 = []; - stepPt[baseIndex] = stepPt2[baseIndex] = middle; - stepPt[1 - baseIndex] = pt[1 - baseIndex]; - stepPt2[1 - baseIndex] = nextPt[1 - baseIndex]; - stepPoints.push(stepPt); - stepPoints.push(stepPt2); - break; - default: - stepPt[baseIndex] = pt[baseIndex]; - stepPt[1 - baseIndex] = nextPt[1 - baseIndex]; - // default is start - stepPoints.push(stepPt); - } - } - // Last points - points[i] && stepPoints.push(points[i]); - return stepPoints; - } + arrow: Arrow, - function getVisualGradient(data, coordSys) { - var visualMetaList = data.getVisual('visualMeta'); - if (!visualMetaList || !visualMetaList.length || !data.count()) { - // When data.count() is 0, gradient range can not be calculated. - return; - } + triangle: Triangle + }; - var visualMeta; - for (var i = visualMetaList.length - 1; i >= 0; i--) { - // Can only be x or y - if (visualMetaList[i].dimension < 2) { - visualMeta = visualMetaList[i]; - break; - } - } - if (!visualMeta || coordSys.type !== 'cartesian2d') { - if (true) { - console.warn('Visual map on line style only support x or y dimension.'); - } - return; - } + var symbolShapeMakers = { - // If the area to be rendered is bigger than area defined by LinearGradient, - // the canvas spec prescribes that the color of the first stop and the last - // stop should be used. But if two stops are added at offset 0, in effect - // browsers use the color of the second stop to render area outside - // LinearGradient. So we can only infinitesimally extend area defined in - // LinearGradient to render `outerColors`. + line: function (x, y, w, h, shape) { + // FIXME + shape.x1 = x; + shape.y1 = y + h / 2; + shape.x2 = x + w; + shape.y2 = y + h / 2; + }, - var dimension = visualMeta.dimension; - var dimName = data.dimensions[dimension]; - var axis = coordSys.getAxis(dimName); + rect: function (x, y, w, h, shape) { + shape.x = x; + shape.y = y; + shape.width = w; + shape.height = h; + }, - // dataToCoor mapping may not be linear, but must be monotonic. - var colorStops = zrUtil.map(visualMeta.stops, function (stop) { - return { - coord: axis.toGlobalCoord(axis.dataToCoord(stop.value)), - color: stop.color - }; - }); - var stopLen = colorStops.length; - var outerColors = visualMeta.outerColors.slice(); + roundRect: function (x, y, w, h, shape) { + shape.x = x; + shape.y = y; + shape.width = w; + shape.height = h; + shape.r = Math.min(w, h) / 4; + }, - if (stopLen && colorStops[0].coord > colorStops[stopLen - 1].coord) { - colorStops.reverse(); - outerColors.reverse(); - } + square: function (x, y, w, h, shape) { + var size = Math.min(w, h); + shape.x = x; + shape.y = y; + shape.width = size; + shape.height = size; + }, - var tinyExtent = 10; // Arbitrary value: 10px - var minCoord = colorStops[0].coord - tinyExtent; - var maxCoord = colorStops[stopLen - 1].coord + tinyExtent; - var coordSpan = maxCoord - minCoord; + circle: function (x, y, w, h, shape) { + // Put circle in the center of square + shape.cx = x + w / 2; + shape.cy = y + h / 2; + shape.r = Math.min(w, h) / 2; + }, - if (coordSpan < 1e-3) { - return 'transparent'; - } + diamond: function (x, y, w, h, shape) { + shape.cx = x + w / 2; + shape.cy = y + h / 2; + shape.width = w; + shape.height = h; + }, - zrUtil.each(colorStops, function (stop) { - stop.offset = (stop.coord - minCoord) / coordSpan; - }); - colorStops.push({ - offset: stopLen ? colorStops[stopLen - 1].offset : 0.5, - color: outerColors[1] || 'transparent' - }); - colorStops.unshift({ // notice colorStops.length have been changed. - offset: stopLen ? colorStops[0].offset : 0.5, - color: outerColors[0] || 'transparent' - }); + pin: function (x, y, w, h, shape) { + shape.x = x + w / 2; + shape.y = y + h / 2; + shape.width = w; + shape.height = h; + }, - // zrUtil.each(colorStops, function (colorStop) { - // // Make sure each offset has rounded px to avoid not sharp edge - // colorStop.offset = (Math.round(colorStop.offset * (end - start) + start) - start) / (end - start); - // }); + arrow: function (x, y, w, h, shape) { + shape.x = x + w / 2; + shape.y = y + h / 2; + shape.width = w; + shape.height = h; + }, - var gradient = new graphic.LinearGradient(0, 0, 0, 0, colorStops, true); - gradient[dimName] = minCoord; - gradient[dimName + '2'] = maxCoord; + triangle: function (x, y, w, h, shape) { + shape.cx = x + w / 2; + shape.cy = y + h / 2; + shape.width = w; + shape.height = h; + } + }; - return gradient; + var symbolBuildProxies = {}; + for (var name in symbolCtors) { + if (symbolCtors.hasOwnProperty(name)) { + symbolBuildProxies[name] = new symbolCtors[name](); + } } - module.exports = ChartView.extend({ - - type: 'line', - - init: function () { - var lineGroup = new graphic.Group(); + var Symbol = graphic.extendShape({ - var symbolDraw = new SymbolDraw(); - this.group.add(symbolDraw.group); + type: 'symbol', - this._symbolDraw = symbolDraw; - this._lineGroup = lineGroup; + shape: { + symbolType: '', + x: 0, + y: 0, + width: 0, + height: 0 }, - render: function (seriesModel, ecModel, api) { - var coordSys = seriesModel.coordinateSystem; - var group = this.group; - var data = seriesModel.getData(); - var lineStyleModel = seriesModel.getModel('lineStyle.normal'); - var areaStyleModel = seriesModel.getModel('areaStyle.normal'); - - var points = data.mapArray(data.getItemLayout, true); - - var isCoordSysPolar = coordSys.type === 'polar'; - var prevCoordSys = this._coordSys; - - var symbolDraw = this._symbolDraw; - var polyline = this._polyline; - var polygon = this._polygon; - - var lineGroup = this._lineGroup; - - var hasAnimation = seriesModel.get('animation'); - - var isAreaChart = !areaStyleModel.isEmpty(); - var stackedOnPoints = getStackedOnPoints(coordSys, data); - - var showSymbol = seriesModel.get('showSymbol'); - - var isSymbolIgnore = showSymbol && !isCoordSysPolar && !seriesModel.get('showAllSymbol') - && this._getSymbolIgnoreFunc(data, coordSys); - - // Remove temporary symbols - var oldData = this._data; - oldData && oldData.eachItemGraphicEl(function (el, idx) { - if (el.__temp) { - group.remove(el); - oldData.setItemGraphicEl(idx, null); - } - }); - - // Remove previous created symbols if showSymbol changed to false - if (!showSymbol) { - symbolDraw.remove(); + beforeBrush: function () { + var style = this.style; + var shape = this.shape; + // FIXME + if (shape.symbolType === 'pin' && style.textPosition === 'inside') { + style.textPosition = ['50%', '40%']; + style.textAlign = 'center'; + style.textVerticalAlign = 'middle'; } + }, - group.add(lineGroup); - - // FIXME step not support polar - var step = !isCoordSysPolar && seriesModel.get('step'); - // Initialization animation or coordinate system changed - if ( - !(polyline && prevCoordSys.type === coordSys.type && step === this._step) - ) { - showSymbol && symbolDraw.updateData(data, isSymbolIgnore); - - if (step) { - // TODO If stacked series is not step - points = turnPointsIntoStep(points, coordSys, step); - stackedOnPoints = turnPointsIntoStep(stackedOnPoints, coordSys, step); + buildPath: function (ctx, shape, inBundle) { + var symbolType = shape.symbolType; + var proxySymbol = symbolBuildProxies[symbolType]; + if (shape.symbolType !== 'none') { + if (!proxySymbol) { + // Default rect + symbolType = 'rect'; + proxySymbol = symbolBuildProxies[symbolType]; } + symbolShapeMakers[symbolType]( + shape.x, shape.y, shape.width, shape.height, proxySymbol.shape + ); + proxySymbol.buildPath(ctx, proxySymbol.shape, inBundle); + } + } + }); - polyline = this._newPolyline(points, coordSys, hasAnimation); - if (isAreaChart) { - polygon = this._newPolygon( - points, stackedOnPoints, - coordSys, hasAnimation - ); - } - lineGroup.setClipPath(createClipShape(coordSys, true, seriesModel)); + // Provide setColor helper method to avoid determine if set the fill or stroke outside + var symbolPathSetColor = function (color) { + if (this.type !== 'image') { + var symbolStyle = this.style; + var symbolShape = this.shape; + if (symbolShape && symbolShape.symbolType === 'line') { + symbolStyle.stroke = color; + } + else if (this.__isEmptyBrush) { + symbolStyle.stroke = color; + symbolStyle.fill = '#fff'; } else { - if (isAreaChart && !polygon) { - // If areaStyle is added - polygon = this._newPolygon( - points, stackedOnPoints, - coordSys, hasAnimation - ); - } - else if (polygon && !isAreaChart) { - // If areaStyle is removed - lineGroup.remove(polygon); - polygon = this._polygon = null; - } - - // Update clipPath - lineGroup.setClipPath(createClipShape(coordSys, false, seriesModel)); + // FIXME 判断图形默认是填充还是描边,使用 onlyStroke ? + symbolStyle.fill && (symbolStyle.fill = color); + symbolStyle.stroke && (symbolStyle.stroke = color); + } + this.dirty(false); + } + }; - // Always update, or it is wrong in the case turning on legend - // because points are not changed - showSymbol && symbolDraw.updateData(data, isSymbolIgnore); + var symbolUtil = { + /** + * Create a symbol element with given symbol configuration: shape, x, y, width, height, color + * @param {string} symbolType + * @param {number} x + * @param {number} y + * @param {number} w + * @param {number} h + * @param {string} color + */ + createSymbol: function (symbolType, x, y, w, h, color) { + // TODO Support image object, DynamicImage. - // Stop symbol animation and sync with line points - // FIXME performance? - data.eachItemGraphicEl(function (el) { - el.stopAnimation(true); - }); + var isEmpty = symbolType.indexOf('empty') === 0; + if (isEmpty) { + symbolType = symbolType.substr(5, 1).toLowerCase() + symbolType.substr(6); + } + var symbolPath; - // In the case data zoom triggerred refreshing frequently - // Data may not change if line has a category axis. So it should animate nothing - if (!isPointsSame(this._stackedOnPoints, stackedOnPoints) - || !isPointsSame(this._points, points) - ) { - if (hasAnimation) { - this._updateAnimation( - data, stackedOnPoints, coordSys, api, step - ); + if (symbolType.indexOf('image://') === 0) { + symbolPath = new graphic.Image({ + style: { + image: symbolType.slice(8), + x: x, + y: y, + width: w, + height: h } - else { - // Not do it in update with animation - if (step) { - // TODO If stacked series is not step - points = turnPointsIntoStep(points, coordSys, step); - stackedOnPoints = turnPointsIntoStep(stackedOnPoints, coordSys, step); - } - - polyline.setShape({ - points: points - }); - polygon && polygon.setShape({ - points: points, - stackedOnPoints: stackedOnPoints - }); + }); + } + else if (symbolType.indexOf('path://') === 0) { + symbolPath = graphic.makePath(symbolType.slice(7), {}, new BoundingRect(x, y, w, h)); + } + else { + symbolPath = new Symbol({ + shape: { + symbolType: symbolType, + x: x, + y: y, + width: w, + height: h } - } + }); } - var visualColor = getVisualGradient(data, coordSys) || data.getVisual('color'); + symbolPath.__isEmptyBrush = isEmpty; - polyline.useStyle(zrUtil.defaults( - // Use color in lineStyle first - lineStyleModel.getLineStyle(), - { - fill: 'none', - stroke: visualColor, - lineJoin: 'bevel' - } - )); + symbolPath.setColor = symbolPathSetColor; - var smooth = seriesModel.get('smooth'); - smooth = getSmooth(seriesModel.get('smooth')); - polyline.setShape({ - smooth: smooth, - smoothMonotone: seriesModel.get('smoothMonotone'), - connectNulls: seriesModel.get('connectNulls') - }); + symbolPath.setColor(color); - if (polygon) { - var stackedOn = data.stackedOn; - var stackedOnSmooth = 0; + return symbolPath; + } + }; - polygon.useStyle(zrUtil.defaults( - areaStyleModel.getAreaStyle(), - { - fill: visualColor, - opacity: 0.7, - lineJoin: 'bevel' - } - )); + module.exports = symbolUtil; - if (stackedOn) { - var stackedOnSeries = stackedOn.hostModel; - stackedOnSmooth = getSmooth(stackedOnSeries.get('smooth')); - } - polygon.setShape({ - smooth: smooth, - stackedOnSmooth: stackedOnSmooth, - smoothMonotone: seriesModel.get('smoothMonotone'), - connectNulls: seriesModel.get('connectNulls') - }); - } +/***/ }, +/* 105 */ +/***/ function(module, exports, __webpack_require__) { - this._data = data; - // Save the coordinate system for transition animation when data changed - this._coordSys = coordSys; - this._stackedOnPoints = stackedOnPoints; - this._points = points; - this._step = step; - }, + - dispose: function () {}, + var OrdinalScale = __webpack_require__(106); + var IntervalScale = __webpack_require__(108); + __webpack_require__(109); + __webpack_require__(110); + var Scale = __webpack_require__(107); - highlight: function (seriesModel, ecModel, api, payload) { - var data = seriesModel.getData(); - var dataIndex = modelUtil.queryDataIndex(data, payload); + var numberUtil = __webpack_require__(7); + var zrUtil = __webpack_require__(4); + var textContain = __webpack_require__(8); + var axisHelper = {}; - if (!(dataIndex instanceof Array) && dataIndex != null && dataIndex >= 0) { - var symbol = data.getItemGraphicEl(dataIndex); - if (!symbol) { - // Create a temporary symbol if it is not exists - var pt = data.getItemLayout(dataIndex); - if (!pt) { - // Null data - return; - } - symbol = new Symbol(data, dataIndex); - symbol.position = pt; - symbol.setZ( - seriesModel.get('zlevel'), - seriesModel.get('z') + /** + * Get axis scale extent before niced. + * Item of returned array can only be number (including Infinity and NaN). + */ + axisHelper.getScaleExtent = function (scale, model) { + var scaleType = scale.type; + + var min = model.getMin(); + var max = model.getMax(); + var fixMin = min != null; + var fixMax = max != null; + var originalExtent = scale.getExtent(); + + var axisDataLen; + var boundaryGap; + var span; + if (scaleType === 'ordinal') { + axisDataLen = (model.get('data') || []).length; + } + else { + boundaryGap = model.get('boundaryGap'); + if (!zrUtil.isArray(boundaryGap)) { + boundaryGap = [boundaryGap || 0, boundaryGap || 0]; + } + boundaryGap[0] = numberUtil.parsePercent(boundaryGap[0], 1); + boundaryGap[1] = numberUtil.parsePercent(boundaryGap[1], 1); + span = originalExtent[1] - originalExtent[0]; + } + + if (min == null) { + min = scaleType === 'ordinal' + ? (axisDataLen ? 0 : NaN) + : originalExtent[0] - boundaryGap[0] * span; + } + if (max == null) { + max = scaleType === 'ordinal' + ? (axisDataLen ? axisDataLen - 1 : NaN) + : originalExtent[1] + boundaryGap[1] * span; + } + + if (min === 'dataMin') { + min = originalExtent[0]; + } + if (max === 'dataMax') { + max = originalExtent[1]; + } + + (min == null || !isFinite(min)) && (min = NaN); + (max == null || !isFinite(max)) && (max = NaN); + + scale.setBlank(zrUtil.eqNaN(min) || zrUtil.eqNaN(max)); + + // Evaluate if axis needs cross zero + if (model.getNeedCrossZero()) { + // Axis is over zero and min is not set + if (min > 0 && max > 0 && !fixMin) { + min = 0; + } + // Axis is under zero and max is not set + if (min < 0 && max < 0 && !fixMax) { + max = 0; + } + } + + return [min, max]; + }; + + axisHelper.niceScaleExtent = function (scale, model) { + var extent = axisHelper.getScaleExtent(scale, model); + var fixMin = model.getMin() != null; + var fixMax = model.getMax() != null; + var splitNumber = model.get('splitNumber'); + + if (scale.type === 'log') { + scale.base = model.get('logBase'); + } + + scale.setExtent(extent[0], extent[1]); + scale.niceExtent(splitNumber, fixMin, fixMax); + + // Use minInterval to constraint the calculated interval. + // If calculated interval is less than minInterval. increase the interval quantity until + // it is larger than minInterval. + // For example: + // minInterval is 1, calculated interval is 0.2, so increase it to be 1. In this way we can get + // an integer axis. + var minInterval = model.get('minInterval'); + if (isFinite(minInterval) && !fixMin && !fixMax && scale.type === 'interval') { + var interval = scale.getInterval(); + var intervalScale = Math.max(Math.abs(interval), minInterval) / interval; + // while (interval < minInterval) { + // var quantity = numberUtil.quantity(interval); + // interval = quantity * 10; + // scaleQuantity *= 10; + // } + extent = scale.getExtent(); + var origin = (extent[1] + extent[0]) / 2; + scale.setExtent( + intervalScale * (extent[0] - origin) + origin, + intervalScale * (extent[1] - origin) + origin + ); + scale.niceExtent(splitNumber); + } + + // If some one specified the min, max. And the default calculated interval + // is not good enough. He can specify the interval. It is often appeared + // in angle axis with angle 0 - 360. Interval calculated in interval scale is hard + // to be 60. + // FIXME + var interval = model.get('interval'); + if (interval != null) { + scale.setInterval && scale.setInterval(interval); + } + }; + + /** + * @param {module:echarts/model/Model} model + * @param {string} [axisType] Default retrieve from model.type + * @return {module:echarts/scale/*} + */ + axisHelper.createScaleByModel = function(model, axisType) { + axisType = axisType || model.get('type'); + if (axisType) { + switch (axisType) { + // Buildin scale + case 'category': + return new OrdinalScale( + model.getCategories(), [Infinity, -Infinity] ); - symbol.ignore = isNaN(pt[0]) || isNaN(pt[1]); - symbol.__temp = true; - data.setItemGraphicEl(dataIndex, symbol); + case 'value': + return new IntervalScale(); + // Extended scale, like time and log + default: + return (Scale.getClass(axisType) || IntervalScale).create(model); + } + } + }; + + /** + * Check if the axis corss 0 + */ + axisHelper.ifAxisCrossZero = function (axis) { + var dataExtent = axis.scale.getExtent(); + var min = dataExtent[0]; + var max = dataExtent[1]; + return !((min > 0 && max > 0) || (min < 0 && max < 0)); + }; + + /** + * @param {Array.} tickCoords In axis self coordinate. + * @param {Array.} labels + * @param {string} font + * @param {boolean} isAxisHorizontal + * @return {number} + */ + axisHelper.getAxisLabelInterval = function (tickCoords, labels, font, isAxisHorizontal) { + // FIXME + // 不同角的axis和label,不只是horizontal和vertical. + + var textSpaceTakenRect; + var autoLabelInterval = 0; + var accumulatedLabelInterval = 0; + + var step = 1; + if (labels.length > 40) { + // Simple optimization for large amount of labels + step = Math.floor(labels.length / 40); + } + + for (var i = 0; i < tickCoords.length; i += step) { + var tickCoord = tickCoords[i]; + var rect = textContain.getBoundingRect( + labels[i], font, 'center', 'top' + ); + rect[isAxisHorizontal ? 'x' : 'y'] += tickCoord; + // FIXME Magic number 1.5 + rect[isAxisHorizontal ? 'width' : 'height'] *= 1.3; + if (!textSpaceTakenRect) { + textSpaceTakenRect = rect.clone(); + } + // There is no space for current label; + else if (textSpaceTakenRect.intersect(rect)) { + accumulatedLabelInterval++; + autoLabelInterval = Math.max(autoLabelInterval, accumulatedLabelInterval); + } + else { + textSpaceTakenRect.union(rect); + // Reset + accumulatedLabelInterval = 0; + } + } + if (autoLabelInterval === 0 && step > 1) { + return step; + } + return (autoLabelInterval + 1) * step - 1; + }; + + /** + * @param {Object} axis + * @param {Function} labelFormatter + * @return {Array.} + */ + axisHelper.getFormattedLabels = function (axis, labelFormatter) { + var scale = axis.scale; + var labels = scale.getTicksLabels(); + var ticks = scale.getTicks(); + if (typeof labelFormatter === 'string') { + labelFormatter = (function (tpl) { + return function (val) { + return tpl.replace('{value}', val != null ? val : ''); + }; + })(labelFormatter); + // Consider empty array + return zrUtil.map(labels, labelFormatter); + } + else if (typeof labelFormatter === 'function') { + return zrUtil.map(ticks, function (tick, idx) { + return labelFormatter( + axisHelper.getAxisRawValue(axis, tick), + idx + ); + }, this); + } + else { + return labels; + } + }; + + axisHelper.getAxisRawValue = function (axis, value) { + // In category axis with data zoom, tick is not the original + // index of axis.data. So tick should not be exposed to user + // in category axis. + return axis.type === 'category' ? axis.scale.getLabel(value) : value; + }; + + module.exports = axisHelper; + + +/***/ }, +/* 106 */ +/***/ function(module, exports, __webpack_require__) { + + /** + * Linear continuous scale + * @module echarts/coord/scale/Ordinal + * + * http://en.wikipedia.org/wiki/Level_of_measurement + */ + + // FIXME only one data + + + var zrUtil = __webpack_require__(4); + var Scale = __webpack_require__(107); + + var scaleProto = Scale.prototype; + + var OrdinalScale = Scale.extend({ + + type: 'ordinal', + + init: function (data, extent) { + this._data = data; + this._extent = extent || [0, data.length - 1]; + }, + + parse: function (val) { + return typeof val === 'string' + ? zrUtil.indexOf(this._data, val) + // val might be float. + : Math.round(val); + }, + + contain: function (rank) { + rank = this.parse(rank); + return scaleProto.contain.call(this, rank) + && this._data[rank] != null; + }, + + /** + * Normalize given rank or name to linear [0, 1] + * @param {number|string} [val] + * @return {number} + */ + normalize: function (val) { + return scaleProto.normalize.call(this, this.parse(val)); + }, + + scale: function (val) { + return Math.round(scaleProto.scale.call(this, val)); + }, + + /** + * @return {Array} + */ + getTicks: function () { + var ticks = []; + var extent = this._extent; + var rank = extent[0]; + + while (rank <= extent[1]) { + ticks.push(rank); + rank++; + } + + return ticks; + }, + + /** + * Get item on rank n + * @param {number} n + * @return {string} + */ + getLabel: function (n) { + return this._data[n]; + }, + + /** + * @return {number} + */ + count: function () { + return this._extent[1] - this._extent[0] + 1; + }, + + /** + * @override + */ + unionExtentFromData: function (data, dim) { + this.unionExtent(data.getDataExtent(dim, false)); + }, + + niceTicks: zrUtil.noop, + niceExtent: zrUtil.noop + }); + + /** + * @return {module:echarts/scale/Time} + */ + OrdinalScale.create = function () { + return new OrdinalScale(); + }; + + module.exports = OrdinalScale; + + +/***/ }, +/* 107 */ +/***/ function(module, exports, __webpack_require__) { + + /** + * // Scale class management + * @module echarts/scale/Scale + */ + + + var clazzUtil = __webpack_require__(13); + + function Scale() { + /** + * Extent + * @type {Array.} + * @protected + */ + this._extent = [Infinity, -Infinity]; + + /** + * Step is calculated in adjustExtent + * @type {Array.} + * @protected + */ + this._interval = 0; + + this.init && this.init.apply(this, arguments); + } + + var scaleProto = Scale.prototype; + + /** + * Parse input val to valid inner number. + * @param {*} val + * @return {number} + */ + scaleProto.parse = function (val) { + // Notice: This would be a trap here, If the implementation + // of this method depends on extent, and this method is used + // before extent set (like in dataZoom), it would be wrong. + // Nevertheless, parse does not depend on extent generally. + return val; + }; + + scaleProto.contain = function (val) { + var extent = this._extent; + return val >= extent[0] && val <= extent[1]; + }; + + /** + * Normalize value to linear [0, 1], return 0.5 if extent span is 0 + * @param {number} val + * @return {number} + */ + scaleProto.normalize = function (val) { + var extent = this._extent; + if (extent[1] === extent[0]) { + return 0.5; + } + return (val - extent[0]) / (extent[1] - extent[0]); + }; + + /** + * Scale normalized value + * @param {number} val + * @return {number} + */ + scaleProto.scale = function (val) { + var extent = this._extent; + return val * (extent[1] - extent[0]) + extent[0]; + }; + + /** + * Set extent from data + * @param {Array.} other + */ + scaleProto.unionExtent = function (other) { + var extent = this._extent; + other[0] < extent[0] && (extent[0] = other[0]); + other[1] > extent[1] && (extent[1] = other[1]); + // not setExtent because in log axis it may transformed to power + // this.setExtent(extent[0], extent[1]); + }; + + /** + * Set extent from data + * @param {module:echarts/data/List} data + * @param {string} dim + */ + scaleProto.unionExtentFromData = function (data, dim) { + this.unionExtent(data.getDataExtent(dim, true)); + }; + + /** + * Get extent + * @return {Array.} + */ + scaleProto.getExtent = function () { + return this._extent.slice(); + }; + + /** + * Set extent + * @param {number} start + * @param {number} end + */ + scaleProto.setExtent = function (start, end) { + var thisExtent = this._extent; + if (!isNaN(start)) { + thisExtent[0] = start; + } + if (!isNaN(end)) { + thisExtent[1] = end; + } + }; + + /** + * @return {Array.} + */ + scaleProto.getTicksLabels = function () { + var labels = []; + var ticks = this.getTicks(); + for (var i = 0; i < ticks.length; i++) { + labels.push(this.getLabel(ticks[i])); + } + return labels; + }; + + /** + * When axis extent depends on data and no data exists, + * axis ticks should not be drawn, which is named 'blank'. + */ + scaleProto.isBlank = function () { + return this._isBlank; + }, + + /** + * When axis extent depends on data and no data exists, + * axis ticks should not be drawn, which is named 'blank'. + */ + scaleProto.setBlank = function (isBlank) { + this._isBlank = isBlank; + }; + + + clazzUtil.enableClassExtend(Scale); + clazzUtil.enableClassManagement(Scale, { + registerWhenExtend: true + }); + + module.exports = Scale; + + +/***/ }, +/* 108 */ +/***/ function(module, exports, __webpack_require__) { + + /** + * Interval scale + * @module echarts/scale/Interval + */ + + + + var numberUtil = __webpack_require__(7); + var formatUtil = __webpack_require__(6); + var Scale = __webpack_require__(107); + + var mathFloor = Math.floor; + var mathCeil = Math.ceil; + + var getPrecisionSafe = numberUtil.getPrecisionSafe; + var roundingErrorFix = numberUtil.round; + /** + * @alias module:echarts/coord/scale/Interval + * @constructor + */ + var IntervalScale = Scale.extend({ + + type: 'interval', + + _interval: 0, + + _intervalPrecision: 2, + + setExtent: function (start, end) { + var thisExtent = this._extent; + //start,end may be a Number like '25',so... + if (!isNaN(start)) { + thisExtent[0] = parseFloat(start); + } + if (!isNaN(end)) { + thisExtent[1] = parseFloat(end); + } + }, + + unionExtent: function (other) { + var extent = this._extent; + other[0] < extent[0] && (extent[0] = other[0]); + other[1] > extent[1] && (extent[1] = other[1]); + + // unionExtent may called by it's sub classes + IntervalScale.prototype.setExtent.call(this, extent[0], extent[1]); + }, + /** + * Get interval + */ + getInterval: function () { + if (!this._interval) { + this.niceTicks(); + } + return this._interval; + }, + + /** + * Set interval + */ + setInterval: function (interval) { + this._interval = interval; + // Dropped auto calculated niceExtent and use user setted extent + // We assume user wan't to set both interval, min, max to get a better result + this._niceExtent = this._extent.slice(); + }, + + /** + * @return {Array.} + */ + getTicks: function () { + if (!this._interval) { + this.niceTicks(); + } + var interval = this._interval; + var extent = this._extent; + var ticks = []; + + // Consider this case: using dataZoom toolbox, zoom and zoom. + var safeLimit = 10000; + + if (interval) { + var niceExtent = this._niceExtent; + var precision = this._intervalPrecision = getPrecisionSafe(interval); + // FIXME + precision += 2; + + if (extent[0] < niceExtent[0]) { + ticks.push(extent[0]); + } + var tick = niceExtent[0]; + + while (tick <= niceExtent[1]) { + ticks.push(tick); + // Avoid rounding error + tick = roundingErrorFix(tick + interval, precision); + if (ticks.length > safeLimit) { + return []; + } + } + // Consider this case: the last item of ticks is smaller + // than niceExtent[1] and niceExtent[1] === extent[1]. + if (extent[1] > (ticks.length ? ticks[ticks.length - 1] : niceExtent[1])) { + ticks.push(extent[1]); + } + } + + return ticks; + }, + + /** + * @return {Array.} + */ + getTicksLabels: function () { + var labels = []; + var ticks = this.getTicks(); + for (var i = 0; i < ticks.length; i++) { + labels.push(this.getLabel(ticks[i])); + } + return labels; + }, + + /** + * @param {number} data + * @param {Object} [opt] + * @param {number|string} [opt.precision] If 'auto', use nice presision. + * @param {boolean} [opt.pad] returns 1.50 but not 1.5 if precision is 2. + * @return {number} + */ + getLabel: function (data, opt) { + var precision = opt && opt.precision; + if (data != null && precision != null) { + // Should be more precise then tick. + precision === 'auto' && (precision = this._intervalPrecision + 2); + data = roundingErrorFix(data, precision, opt && opt.pad); + } + return formatUtil.addCommas(data); + }, + + /** + * Update interval and extent of intervals for nice ticks + * + * @param {number} [splitNumber = 5] Desired number of ticks + */ + niceTicks: function (splitNumber) { + splitNumber = splitNumber || 5; + var extent = this._extent; + var span = extent[1] - extent[0]; + if (!isFinite(span)) { + return; + } + // User may set axis min 0 and data are all negative + // FIXME If it needs to reverse ? + if (span < 0) { + span = -span; + extent.reverse(); + } + + // From "Nice Numbers for Graph Labels" of Graphic Gems + // var niceSpan = numberUtil.nice(span, false); + var step = roundingErrorFix( + numberUtil.nice(span / splitNumber, true), + Math.max( + getPrecisionSafe(extent[0]), + getPrecisionSafe(extent[1]) + // extent may be [0, 1], and step should have 1 more digits. + // To make it safe we add 2 more digits + ) + 2 + ); + + var precision = getPrecisionSafe(step) + 2; + // Niced extent inside original extent + var niceExtent = [ + roundingErrorFix(mathCeil(extent[0] / step) * step, precision), + roundingErrorFix(mathFloor(extent[1] / step) * step, precision) + ]; + + this._interval = step; + this._niceExtent = niceExtent; + }, + + /** + * Nice extent. + * @param {number} [splitNumber = 5] Given approx tick number + * @param {boolean} [fixMin=false] + * @param {boolean} [fixMax=false] + */ + niceExtent: function (splitNumber, fixMin, fixMax) { + var extent = this._extent; + // If extent start and end are same, expand them + if (extent[0] === extent[1]) { + if (extent[0] !== 0) { + // Expand extent + var expandSize = extent[0]; + // In the fowllowing case + // Axis has been fixed max 100 + // Plus data are all 100 and axis extent are [100, 100]. + // Extend to the both side will cause expanded max is larger than fixed max. + // So only expand to the smaller side. + if (!fixMax) { + extent[1] += expandSize / 2; + extent[0] -= expandSize / 2; + } + else { + extent[0] -= expandSize / 2; + } + } + else { + extent[1] = 1; + } + } + var span = extent[1] - extent[0]; + // If there are no data and extent are [Infinity, -Infinity] + if (!isFinite(span)) { + extent[0] = 0; + extent[1] = 1; + } + + this.niceTicks(splitNumber); + + // var extent = this._extent; + var interval = this._interval; + + if (!fixMin) { + extent[0] = roundingErrorFix(mathFloor(extent[0] / interval) * interval); + } + if (!fixMax) { + extent[1] = roundingErrorFix(mathCeil(extent[1] / interval) * interval); + } + } + }); + + /** + * @return {module:echarts/scale/Time} + */ + IntervalScale.create = function () { + return new IntervalScale(); + }; + + module.exports = IntervalScale; + + + +/***/ }, +/* 109 */ +/***/ function(module, exports, __webpack_require__) { + + /** + * Interval scale + * @module echarts/coord/scale/Time + */ + + + + var zrUtil = __webpack_require__(4); + var numberUtil = __webpack_require__(7); + var formatUtil = __webpack_require__(6); + + var IntervalScale = __webpack_require__(108); + + var intervalScaleProto = IntervalScale.prototype; + + var mathCeil = Math.ceil; + var mathFloor = Math.floor; + var ONE_SECOND = 1000; + var ONE_MINUTE = ONE_SECOND * 60; + var ONE_HOUR = ONE_MINUTE * 60; + var ONE_DAY = ONE_HOUR * 24; + + // FIXME 公用? + var bisect = function (a, x, lo, hi) { + while (lo < hi) { + var mid = lo + hi >>> 1; + if (a[mid][2] < x) { + lo = mid + 1; + } + else { + hi = mid; + } + } + return lo; + }; + + /** + * @alias module:echarts/coord/scale/Time + * @constructor + */ + var TimeScale = IntervalScale.extend({ + type: 'time', + + // Overwrite + getLabel: function (val) { + var stepLvl = this._stepLvl; + + var date = new Date(val); + + return formatUtil.formatTime(stepLvl[0], date); + }, + + // Overwrite + niceExtent: function (approxTickNum, fixMin, fixMax) { + var extent = this._extent; + // If extent start and end are same, expand them + if (extent[0] === extent[1]) { + // Expand extent + extent[0] -= ONE_DAY; + extent[1] += ONE_DAY; + } + // If there are no data and extent are [Infinity, -Infinity] + if (extent[1] === -Infinity && extent[0] === Infinity) { + var d = new Date(); + extent[1] = new Date(d.getFullYear(), d.getMonth(), d.getDate()); + extent[0] = extent[1] - ONE_DAY; + } + + this.niceTicks(approxTickNum); + + // var extent = this._extent; + var interval = this._interval; + + if (!fixMin) { + extent[0] = numberUtil.round(mathFloor(extent[0] / interval) * interval); + } + if (!fixMax) { + extent[1] = numberUtil.round(mathCeil(extent[1] / interval) * interval); + } + }, + + // Overwrite + niceTicks: function (approxTickNum) { + approxTickNum = approxTickNum || 10; + + var extent = this._extent; + var span = extent[1] - extent[0]; + var approxInterval = span / approxTickNum; + var scaleLevelsLen = scaleLevels.length; + var idx = bisect(scaleLevels, approxInterval, 0, scaleLevelsLen); + + var level = scaleLevels[Math.min(idx, scaleLevelsLen - 1)]; + var interval = level[2]; + // Same with interval scale if span is much larger than 1 year + if (level[0] === 'year') { + var yearSpan = span / interval; + + // From "Nice Numbers for Graph Labels" of Graphic Gems + // var niceYearSpan = numberUtil.nice(yearSpan, false); + var yearStep = numberUtil.nice(yearSpan / approxTickNum, true); + + interval *= yearStep; + } + + var niceExtent = [ + mathCeil(extent[0] / interval) * interval, + mathFloor(extent[1] / interval) * interval + ]; + + this._stepLvl = level; + // Interval will be used in getTicks + this._interval = interval; + this._niceExtent = niceExtent; + }, + + parse: function (val) { + // val might be float. + return +numberUtil.parseDate(val); + } + }); + + zrUtil.each(['contain', 'normalize'], function (methodName) { + TimeScale.prototype[methodName] = function (val) { + return intervalScaleProto[methodName].call(this, this.parse(val)); + }; + }); + + // Steps from d3 + var scaleLevels = [ + // Format step interval + ['hh:mm:ss', 1, ONE_SECOND], // 1s + ['hh:mm:ss', 5, ONE_SECOND * 5], // 5s + ['hh:mm:ss', 10, ONE_SECOND * 10], // 10s + ['hh:mm:ss', 15, ONE_SECOND * 15], // 15s + ['hh:mm:ss', 30, ONE_SECOND * 30], // 30s + ['hh:mm\nMM-dd',1, ONE_MINUTE], // 1m + ['hh:mm\nMM-dd',5, ONE_MINUTE * 5], // 5m + ['hh:mm\nMM-dd',10, ONE_MINUTE * 10], // 10m + ['hh:mm\nMM-dd',15, ONE_MINUTE * 15], // 15m + ['hh:mm\nMM-dd',30, ONE_MINUTE * 30], // 30m + ['hh:mm\nMM-dd',1, ONE_HOUR], // 1h + ['hh:mm\nMM-dd',2, ONE_HOUR * 2], // 2h + ['hh:mm\nMM-dd',6, ONE_HOUR * 6], // 6h + ['hh:mm\nMM-dd',12, ONE_HOUR * 12], // 12h + ['MM-dd\nyyyy', 1, ONE_DAY], // 1d + ['week', 7, ONE_DAY * 7], // 7d + ['month', 1, ONE_DAY * 31], // 1M + ['quarter', 3, ONE_DAY * 380 / 4], // 3M + ['half-year', 6, ONE_DAY * 380 / 2], // 6M + ['year', 1, ONE_DAY * 380] // 1Y + ]; + + /** + * @return {module:echarts/scale/Time} + */ + TimeScale.create = function () { + return new TimeScale(); + }; + + module.exports = TimeScale; + + +/***/ }, +/* 110 */ +/***/ function(module, exports, __webpack_require__) { + + /** + * Log scale + * @module echarts/scale/Log + */ + + + var zrUtil = __webpack_require__(4); + var Scale = __webpack_require__(107); + var numberUtil = __webpack_require__(7); + + // Use some method of IntervalScale + var IntervalScale = __webpack_require__(108); + + var scaleProto = Scale.prototype; + var intervalScaleProto = IntervalScale.prototype; + + var getPrecisionSafe = numberUtil.getPrecisionSafe; + var roundingErrorFix = numberUtil.round; + + var mathFloor = Math.floor; + var mathCeil = Math.ceil; + var mathPow = Math.pow; + + var mathLog = Math.log; + + var LogScale = Scale.extend({ + + type: 'log', + + base: 10, + + $constructor: function () { + Scale.apply(this, arguments); + this._originalScale = new IntervalScale(); + }, + + /** + * @return {Array.} + */ + getTicks: function () { + var originalScale = this._originalScale; + var extent = this._extent; + var originalExtent = originalScale.getExtent(); + + return zrUtil.map(intervalScaleProto.getTicks.call(this), function (val) { + var powVal = numberUtil.round(mathPow(this.base, val)); + + // Fix #4158 + powVal = (val === extent[0] && originalScale.__fixMin) + ? fixRoundingError(powVal, originalExtent[0]) + : powVal; + powVal = (val === extent[1] && originalScale.__fixMax) + ? fixRoundingError(powVal, originalExtent[1]) + : powVal; + + return powVal; + }, this); + }, + + /** + * @param {number} val + * @return {string} + */ + getLabel: intervalScaleProto.getLabel, + + /** + * @param {number} val + * @return {number} + */ + scale: function (val) { + val = scaleProto.scale.call(this, val); + return mathPow(this.base, val); + }, + + /** + * @param {number} start + * @param {number} end + */ + setExtent: function (start, end) { + var base = this.base; + start = mathLog(start) / mathLog(base); + end = mathLog(end) / mathLog(base); + intervalScaleProto.setExtent.call(this, start, end); + }, + + /** + * @return {number} end + */ + getExtent: function () { + var base = this.base; + var extent = scaleProto.getExtent.call(this); + extent[0] = mathPow(base, extent[0]); + extent[1] = mathPow(base, extent[1]); + + // Fix #4158 + var originalScale = this._originalScale; + var originalExtent = originalScale.getExtent(); + originalScale.__fixMin && (extent[0] = fixRoundingError(extent[0], originalExtent[0])); + originalScale.__fixMax && (extent[1] = fixRoundingError(extent[1], originalExtent[1])); + + return extent; + }, + + /** + * @param {Array.} extent + */ + unionExtent: function (extent) { + this._originalScale.unionExtent(extent); + + var base = this.base; + extent[0] = mathLog(extent[0]) / mathLog(base); + extent[1] = mathLog(extent[1]) / mathLog(base); + scaleProto.unionExtent.call(this, extent); + }, + + /** + * @override + */ + unionExtentFromData: function (data, dim) { + this.unionExtent(data.getDataExtent(dim, true, function (val) { + return val > 0; + })); + }, + + /** + * Update interval and extent of intervals for nice ticks + * @param {number} [approxTickNum = 10] Given approx tick number + */ + niceTicks: function (approxTickNum) { + approxTickNum = approxTickNum || 10; + var extent = this._extent; + var span = extent[1] - extent[0]; + if (span === Infinity || span <= 0) { + return; + } + + var interval = numberUtil.quantity(span); + var err = approxTickNum / span * interval; + + // Filter ticks to get closer to the desired count. + if (err <= 0.5) { + interval *= 10; + } + + // Interval should be integer + while (!isNaN(interval) && Math.abs(interval) < 1 && Math.abs(interval) > 0) { + interval *= 10; + } + + var niceExtent = [ + numberUtil.round(mathCeil(extent[0] / interval) * interval), + numberUtil.round(mathFloor(extent[1] / interval) * interval) + ]; + + this._interval = interval; + this._niceExtent = niceExtent; + }, + + /** + * Nice extent. + * @param {number} [approxTickNum = 10] Given approx tick number + * @param {boolean} [fixMin=false] + * @param {boolean} [fixMax=false] + */ + niceExtent: function (splitNumber, fixMin, fixMax) { + intervalScaleProto.niceExtent.call(this, splitNumber, fixMin, fixMax); + + var originalScale = this._originalScale; + originalScale.__fixMin = fixMin; + originalScale.__fixMax = fixMax; + } + + }); + + zrUtil.each(['contain', 'normalize'], function (methodName) { + LogScale.prototype[methodName] = function (val) { + val = mathLog(val) / mathLog(this.base); + return scaleProto[methodName].call(this, val); + }; + }); + + LogScale.create = function () { + return new LogScale(); + }; + + function fixRoundingError(val, originalVal) { + return roundingErrorFix(val, getPrecisionSafe(originalVal)); + } + + module.exports = LogScale; + + +/***/ }, +/* 111 */ +/***/ function(module, exports, __webpack_require__) { + + + + var zrUtil = __webpack_require__(4); + var axisHelper = __webpack_require__(105); + + function getName(obj) { + if (zrUtil.isObject(obj) && obj.value != null) { + return obj.value; + } + else { + return obj; + } + } + + module.exports = { + + /** + * Format labels + * @return {Array.} + */ + getFormattedLabels: function () { + return axisHelper.getFormattedLabels( + this.axis, + this.get('axisLabel.formatter') + ); + }, + + /** + * Get categories + */ + getCategories: function () { + return this.get('type') === 'category' + && zrUtil.map(this.get('data'), getName); + }, + + /** + * @param {boolean} origin + * @return {number|string} min value or 'dataMin' or null/undefined (means auto) or NaN + */ + getMin: function (origin) { + var option = this.option; + var min = (!origin && option.rangeStart != null) + ? option.rangeStart : option.min; + + if (this.axis && min != null && min !== 'dataMin' && !zrUtil.eqNaN(min)) { + min = this.axis.scale.parse(min); + } + return min; + }, - // Stop scale animation - symbol.stopSymbolAnimation(true); + /** + * @param {boolean} origin + * @return {number|string} max value or 'dataMax' or null/undefined (means auto) or NaN + */ + getMax: function (origin) { + var option = this.option; + var max = (!origin && option.rangeEnd != null) + ? option.rangeEnd : option.max; - this.group.add(symbol); - } - symbol.highlight(); + if (this.axis && max != null && max !== 'dataMax' && !zrUtil.eqNaN(max)) { + max = this.axis.scale.parse(max); } - else { - // Highlight whole series - ChartView.prototype.highlight.call( - this, seriesModel, ecModel, api, payload - ); + return max; + }, + + /** + * @return {boolean} + */ + getNeedCrossZero: function () { + var option = this.option; + return (option.rangeStart != null || option.rangeEnd != null) + ? false : !option.scale; + }, + + /** + * Should be implemented by each axis model if necessary. + * @return {module:echarts/model/Component} coordinate system model + */ + getCoordSysModel: zrUtil.noop, + + /** + * @param {number} rangeStart Can only be finite number or null/undefined or NaN. + * @param {number} rangeEnd Can only be finite number or null/undefined or NaN. + */ + setRange: function (rangeStart, rangeEnd) { + this.option.rangeStart = rangeStart; + this.option.rangeEnd = rangeEnd; + }, + + /** + * Reset range + */ + resetRange: function () { + // rangeStart and rangeEnd is readonly. + this.option.rangeStart = this.option.rangeEnd = null; + } + }; + + +/***/ }, +/* 112 */ +/***/ function(module, exports, __webpack_require__) { + + + + var zrUtil = __webpack_require__(4); + var echarts = __webpack_require__(1); + var PRIORITY = echarts.PRIORITY; + + __webpack_require__(113); + __webpack_require__(114); + + echarts.registerVisual(zrUtil.curry( + __webpack_require__(119), 'line', 'circle', 'line' + )); + echarts.registerLayout(zrUtil.curry( + __webpack_require__(120), 'line' + )); + + // Down sample after filter + echarts.registerProcessor(PRIORITY.PROCESSOR.STATISTIC, zrUtil.curry( + __webpack_require__(121), 'line' + )); + + // In case developer forget to include grid component + __webpack_require__(122); + + +/***/ }, +/* 113 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + + var createListFromArray = __webpack_require__(102); + var SeriesModel = __webpack_require__(28); + + module.exports = SeriesModel.extend({ + + type: 'series.line', + + dependencies: ['grid', 'polar'], + + getInitialData: function (option, ecModel) { + if (true) { + var coordSys = option.coordinateSystem; + if (coordSys !== 'polar' && coordSys !== 'cartesian2d') { + throw new Error('Line not support coordinateSystem besides cartesian and polar'); + } } + return createListFromArray(option.data, this, ecModel); }, - downplay: function (seriesModel, ecModel, api, payload) { - var data = seriesModel.getData(); - var dataIndex = modelUtil.queryDataIndex(data, payload); - if (dataIndex != null && dataIndex >= 0) { - var symbol = data.getItemGraphicEl(dataIndex); - if (symbol) { - if (symbol.__temp) { - data.setItemGraphicEl(dataIndex, null); - this.group.remove(symbol); - } - else { - symbol.downplay(); - } + defaultOption: { + zlevel: 0, // 一级层叠 + z: 2, // 二级层叠 + coordinateSystem: 'cartesian2d', + legendHoverLink: true, + + hoverAnimation: true, + // stack: null + // xAxisIndex: 0, + // yAxisIndex: 0, + + // polarIndex: 0, + + // If clip the overflow value + clipOverflow: true, + + label: { + normal: { + position: 'top' + } + }, + // itemStyle: { + // normal: {}, + // emphasis: {} + // }, + lineStyle: { + normal: { + width: 2, + type: 'solid' } + }, + // areaStyle: {}, + // false, 'start', 'end', 'middle' + step: false, + + // Disabled if step is true + smooth: false, + smoothMonotone: null, + // 拐点图形类型 + symbol: 'emptyCircle', + // 拐点图形大小 + symbolSize: 4, + // 拐点图形旋转控制 + symbolRotate: null, + + // 是否显示 symbol, 只有在 tooltip hover 的时候显示 + showSymbol: true, + // 标志图形默认只有主轴显示(随主轴标签间隔隐藏策略) + showAllSymbol: false, + + // 是否连接断点 + connectNulls: false, + + // 数据过滤,'average', 'max', 'min', 'sum' + sampling: 'none', + + animationEasing: 'linear', + + // Disable progressive + progressive: 0, + hoverLayerThreshold: Infinity + } + }); + + +/***/ }, +/* 114 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + // FIXME step not support polar + + + var zrUtil = __webpack_require__(4); + var SymbolDraw = __webpack_require__(115); + var Symbol = __webpack_require__(116); + var lineAnimationDiff = __webpack_require__(117); + var graphic = __webpack_require__(44); + var modelUtil = __webpack_require__(5); + var polyHelper = __webpack_require__(118); + var ChartView = __webpack_require__(43); + + function isPointsSame(points1, points2) { + if (points1.length !== points2.length) { + return; + } + for (var i = 0; i < points1.length; i++) { + var p1 = points1[i]; + var p2 = points2[i]; + if (p1[0] !== p2[0] || p1[1] !== p2[1]) { + return; } - else { - // Downplay whole series - ChartView.prototype.downplay.call( - this, seriesModel, ecModel, api, payload - ); + } + return true; + } + + function getSmooth(smooth) { + return typeof (smooth) === 'number' ? smooth : (smooth ? 0.3 : 0); + } + + function getAxisExtentWithGap(axis) { + var extent = axis.getGlobalExtent(); + if (axis.onBand) { + // Remove extra 1px to avoid line miter in clipped edge + var halfBandWidth = axis.getBandWidth() / 2 - 1; + var dir = extent[1] > extent[0] ? 1 : -1; + extent[0] += dir * halfBandWidth; + extent[1] -= dir * halfBandWidth; + } + return extent; + } + + function sign(val) { + return val >= 0 ? 1 : -1; + } + /** + * @param {module:echarts/coord/cartesian/Cartesian2D|module:echarts/coord/polar/Polar} coordSys + * @param {module:echarts/data/List} data + * @param {Array.>} points + * @private + */ + function getStackedOnPoints(coordSys, data) { + var baseAxis = coordSys.getBaseAxis(); + var valueAxis = coordSys.getOtherAxis(baseAxis); + var valueStart = baseAxis.onZero + ? 0 : valueAxis.scale.getExtent()[0]; + + var valueDim = valueAxis.dim; + + var baseDataOffset = valueDim === 'x' || valueDim === 'radius' ? 1 : 0; + + return data.mapArray([valueDim], function (val, idx) { + var stackedOnSameSign; + var stackedOn = data.stackedOn; + // Find first stacked value with same sign + while (stackedOn && + sign(stackedOn.get(valueDim, idx)) === sign(val) + ) { + stackedOnSameSign = stackedOn; + break; } - }, + var stackedData = []; + stackedData[baseDataOffset] = data.get(baseAxis.dim, idx); + stackedData[1 - baseDataOffset] = stackedOnSameSign + ? stackedOnSameSign.get(valueDim, idx, true) : valueStart; - /** - * @param {module:zrender/container/Group} group - * @param {Array.>} points - * @private - */ - _newPolyline: function (points) { - var polyline = this._polyline; - // Remove previous created polyline - if (polyline) { - this._lineGroup.remove(polyline); + return coordSys.dataToPoint(stackedData); + }, true); + } + + function createGridClipShape(cartesian, hasAnimation, seriesModel) { + var xExtent = getAxisExtentWithGap(cartesian.getAxis('x')); + var yExtent = getAxisExtentWithGap(cartesian.getAxis('y')); + var isHorizontal = cartesian.getBaseAxis().isHorizontal(); + + var x = Math.min(xExtent[0], xExtent[1]); + var y = Math.min(yExtent[0], yExtent[1]); + var width = Math.max(xExtent[0], xExtent[1]) - x; + var height = Math.max(yExtent[0], yExtent[1]) - y; + var lineWidth = seriesModel.get('lineStyle.normal.width') || 2; + // Expand clip shape to avoid clipping when line value exceeds axis + var expandSize = seriesModel.get('clipOverflow') ? lineWidth / 2 : Math.max(width, height); + if (isHorizontal) { + y -= expandSize; + height += expandSize * 2; + } + else { + x -= expandSize; + width += expandSize * 2; + } + + var clipPath = new graphic.Rect({ + shape: { + x: x, + y: y, + width: width, + height: height } + }); - polyline = new polyHelper.Polyline({ + if (hasAnimation) { + clipPath.shape[isHorizontal ? 'width' : 'height'] = 0; + graphic.initProps(clipPath, { shape: { - points: points - }, - silent: true, - z2: 10 - }); + width: width, + height: height + } + }, seriesModel); + } - this._lineGroup.add(polyline); + return clipPath; + } - this._polyline = polyline; + function createPolarClipShape(polar, hasAnimation, seriesModel) { + var angleAxis = polar.getAngleAxis(); + var radiusAxis = polar.getRadiusAxis(); - return polyline; - }, + var radiusExtent = radiusAxis.getExtent(); + var angleExtent = angleAxis.getExtent(); - /** - * @param {module:zrender/container/Group} group - * @param {Array.>} stackedOnPoints - * @param {Array.>} points - * @private - */ - _newPolygon: function (points, stackedOnPoints) { - var polygon = this._polygon; - // Remove previous created polygon - if (polygon) { - this._lineGroup.remove(polygon); + var RADIAN = Math.PI / 180; + + var clipPath = new graphic.Sector({ + shape: { + cx: polar.cx, + cy: polar.cy, + r0: radiusExtent[0], + r: radiusExtent[1], + startAngle: -angleExtent[0] * RADIAN, + endAngle: -angleExtent[1] * RADIAN, + clockwise: angleAxis.inverse } + }); - polygon = new polyHelper.Polygon({ + if (hasAnimation) { + clipPath.shape.endAngle = -angleExtent[0] * RADIAN; + graphic.initProps(clipPath, { shape: { - points: points, - stackedOnPoints: stackedOnPoints - }, - silent: true - }); + endAngle: -angleExtent[1] * RADIAN + } + }, seriesModel); + } - this._lineGroup.add(polygon); + return clipPath; + } - this._polygon = polygon; - return polygon; - }, - /** - * @private - */ - _getSymbolIgnoreFunc: function (data, coordSys) { - var categoryAxis = coordSys.getAxesByScale('ordinal')[0]; - // `getLabelInterval` is provided by echarts/component/axis - if (categoryAxis && categoryAxis.isLabelIgnored) { - return zrUtil.bind(categoryAxis.isLabelIgnored, categoryAxis); - } - }, + function createClipShape(coordSys, hasAnimation, seriesModel) { + return coordSys.type === 'polar' + ? createPolarClipShape(coordSys, hasAnimation, seriesModel) + : createGridClipShape(coordSys, hasAnimation, seriesModel); + } - /** - * @private - */ - // FIXME Two value axis - _updateAnimation: function (data, stackedOnPoints, coordSys, api, step) { - var polyline = this._polyline; - var polygon = this._polygon; - var seriesModel = data.hostModel; + function turnPointsIntoStep(points, coordSys, stepTurnAt) { + var baseAxis = coordSys.getBaseAxis(); + var baseIndex = baseAxis.dim === 'x' || baseAxis.dim === 'radius' ? 0 : 1; - var diff = lineAnimationDiff( - this._data, data, - this._stackedOnPoints, stackedOnPoints, - this._coordSys, coordSys - ); + var stepPoints = []; + for (var i = 0; i < points.length - 1; i++) { + var nextPt = points[i + 1]; + var pt = points[i]; + stepPoints.push(pt); - var current = diff.current; - var stackedOnCurrent = diff.stackedOnCurrent; - var next = diff.next; - var stackedOnNext = diff.stackedOnNext; - if (step) { - // TODO If stacked series is not step - current = turnPointsIntoStep(diff.current, coordSys, step); - stackedOnCurrent = turnPointsIntoStep(diff.stackedOnCurrent, coordSys, step); - next = turnPointsIntoStep(diff.next, coordSys, step); - stackedOnNext = turnPointsIntoStep(diff.stackedOnNext, coordSys, step); + var stepPt = []; + switch (stepTurnAt) { + case 'end': + stepPt[baseIndex] = nextPt[baseIndex]; + stepPt[1 - baseIndex] = pt[1 - baseIndex]; + // default is start + stepPoints.push(stepPt); + break; + case 'middle': + // default is start + var middle = (pt[baseIndex] + nextPt[baseIndex]) / 2; + var stepPt2 = []; + stepPt[baseIndex] = stepPt2[baseIndex] = middle; + stepPt[1 - baseIndex] = pt[1 - baseIndex]; + stepPt2[1 - baseIndex] = nextPt[1 - baseIndex]; + stepPoints.push(stepPt); + stepPoints.push(stepPt2); + break; + default: + stepPt[baseIndex] = pt[baseIndex]; + stepPt[1 - baseIndex] = nextPt[1 - baseIndex]; + // default is start + stepPoints.push(stepPt); } - // `diff.current` is subset of `current` (which should be ensured by - // turnPointsIntoStep), so points in `__points` can be updated when - // points in `current` are update during animation. - polyline.shape.__points = diff.current; - polyline.shape.points = current; + } + // Last points + points[i] && stepPoints.push(points[i]); + return stepPoints; + } - graphic.updateProps(polyline, { - shape: { - points: next - } - }, seriesModel); + function getVisualGradient(data, coordSys) { + var visualMetaList = data.getVisual('visualMeta'); + if (!visualMetaList || !visualMetaList.length || !data.count()) { + // When data.count() is 0, gradient range can not be calculated. + return; + } - if (polygon) { - polygon.setShape({ - points: current, - stackedOnPoints: stackedOnCurrent - }); - graphic.updateProps(polygon, { - shape: { - points: next, - stackedOnPoints: stackedOnNext - } - }, seriesModel); + var visualMeta; + for (var i = visualMetaList.length - 1; i >= 0; i--) { + // Can only be x or y + if (visualMetaList[i].dimension < 2) { + visualMeta = visualMetaList[i]; + break; + } + } + if (!visualMeta || coordSys.type !== 'cartesian2d') { + if (true) { + console.warn('Visual map on line style only support x or y dimension.'); } + return; + } + + // If the area to be rendered is bigger than area defined by LinearGradient, + // the canvas spec prescribes that the color of the first stop and the last + // stop should be used. But if two stops are added at offset 0, in effect + // browsers use the color of the second stop to render area outside + // LinearGradient. So we can only infinitesimally extend area defined in + // LinearGradient to render `outerColors`. + + var dimension = visualMeta.dimension; + var dimName = data.dimensions[dimension]; + var axis = coordSys.getAxis(dimName); + + // dataToCoor mapping may not be linear, but must be monotonic. + var colorStops = zrUtil.map(visualMeta.stops, function (stop) { + return { + coord: axis.toGlobalCoord(axis.dataToCoord(stop.value)), + color: stop.color + }; + }); + var stopLen = colorStops.length; + var outerColors = visualMeta.outerColors.slice(); + + if (stopLen && colorStops[0].coord > colorStops[stopLen - 1].coord) { + colorStops.reverse(); + outerColors.reverse(); + } + + var tinyExtent = 10; // Arbitrary value: 10px + var minCoord = colorStops[0].coord - tinyExtent; + var maxCoord = colorStops[stopLen - 1].coord + tinyExtent; + var coordSpan = maxCoord - minCoord; - var updatedDataInfo = []; - var diffStatus = diff.status; + if (coordSpan < 1e-3) { + return 'transparent'; + } - for (var i = 0; i < diffStatus.length; i++) { - var cmd = diffStatus[i].cmd; - if (cmd === '=') { - var el = data.getItemGraphicEl(diffStatus[i].idx1); - if (el) { - updatedDataInfo.push({ - el: el, - ptIdx: i // Index of points - }); - } - } - } + zrUtil.each(colorStops, function (stop) { + stop.offset = (stop.coord - minCoord) / coordSpan; + }); + colorStops.push({ + offset: stopLen ? colorStops[stopLen - 1].offset : 0.5, + color: outerColors[1] || 'transparent' + }); + colorStops.unshift({ // notice colorStops.length have been changed. + offset: stopLen ? colorStops[0].offset : 0.5, + color: outerColors[0] || 'transparent' + }); - if (polyline.animators && polyline.animators.length) { - polyline.animators[0].during(function () { - for (var i = 0; i < updatedDataInfo.length; i++) { - var el = updatedDataInfo[i].el; - el.attr('position', polyline.shape.__points[updatedDataInfo[i].ptIdx]); - } - }); - } - }, + // zrUtil.each(colorStops, function (colorStop) { + // // Make sure each offset has rounded px to avoid not sharp edge + // colorStop.offset = (Math.round(colorStop.offset * (end - start) + start) - start) / (end - start); + // }); - remove: function (ecModel) { - var group = this.group; - var oldData = this._data; - this._lineGroup.removeAll(); - this._symbolDraw.remove(true); - // Remove temporary created elements when highlighting - oldData && oldData.eachItemGraphicEl(function (el, idx) { - if (el.__temp) { - group.remove(el); - oldData.setItemGraphicEl(idx, null); - } - }); + var gradient = new graphic.LinearGradient(0, 0, 0, 0, colorStops, true); + gradient[dimName] = minCoord; + gradient[dimName + '2'] = maxCoord; - this._polyline = - this._polygon = - this._coordSys = - this._points = - this._stackedOnPoints = - this._data = null; - } - }); + return gradient; + } + module.exports = ChartView.extend({ -/***/ }, -/* 105 */ -/***/ function(module, exports, __webpack_require__) { + type: 'line', - /** - * @module echarts/chart/helper/SymbolDraw - */ + init: function () { + var lineGroup = new graphic.Group(); + var symbolDraw = new SymbolDraw(); + this.group.add(symbolDraw.group); - var graphic = __webpack_require__(43); - var Symbol = __webpack_require__(106); + this._symbolDraw = symbolDraw; + this._lineGroup = lineGroup; + }, - /** - * @constructor - * @alias module:echarts/chart/helper/SymbolDraw - * @param {module:zrender/graphic/Group} [symbolCtor] - */ - function SymbolDraw(symbolCtor) { - this.group = new graphic.Group(); + render: function (seriesModel, ecModel, api) { + var coordSys = seriesModel.coordinateSystem; + var group = this.group; + var data = seriesModel.getData(); + var lineStyleModel = seriesModel.getModel('lineStyle.normal'); + var areaStyleModel = seriesModel.getModel('areaStyle.normal'); - this._symbolCtor = symbolCtor || Symbol; - } + var points = data.mapArray(data.getItemLayout, true); - var symbolDrawProto = SymbolDraw.prototype; + var isCoordSysPolar = coordSys.type === 'polar'; + var prevCoordSys = this._coordSys; - function symbolNeedsDraw(data, idx, isIgnore) { - var point = data.getItemLayout(idx); - // Is an object - // if (point && point.hasOwnProperty('point')) { - // point = point.point; - // } - return point && !isNaN(point[0]) && !isNaN(point[1]) && !(isIgnore && isIgnore(idx)) - && data.getItemVisual(idx, 'symbol') !== 'none'; - } - /** - * Update symbols draw by new data - * @param {module:echarts/data/List} data - * @param {Array.} [isIgnore] - */ - symbolDrawProto.updateData = function (data, isIgnore) { - var group = this.group; - var seriesModel = data.hostModel; - var oldData = this._data; + var symbolDraw = this._symbolDraw; + var polyline = this._polyline; + var polygon = this._polygon; - var SymbolCtor = this._symbolCtor; + var lineGroup = this._lineGroup; - var seriesScope = { - itemStyle: seriesModel.getModel('itemStyle.normal').getItemStyle(['color']), - hoverItemStyle: seriesModel.getModel('itemStyle.emphasis').getItemStyle(), - symbolRotate: seriesModel.get('symbolRotate'), - symbolOffset: seriesModel.get('symbolOffset'), - hoverAnimation: seriesModel.get('hoverAnimation'), + var hasAnimation = seriesModel.get('animation'); - labelModel: seriesModel.getModel('label.normal'), - hoverLabelModel: seriesModel.getModel('label.emphasis') - }; + var isAreaChart = !areaStyleModel.isEmpty(); + var stackedOnPoints = getStackedOnPoints(coordSys, data); - data.diff(oldData) - .add(function (newIdx) { - var point = data.getItemLayout(newIdx); - if (symbolNeedsDraw(data, newIdx, isIgnore)) { - var symbolEl = new SymbolCtor(data, newIdx, seriesScope); - symbolEl.attr('position', point); - data.setItemGraphicEl(newIdx, symbolEl); - group.add(symbolEl); - } - }) - .update(function (newIdx, oldIdx) { - var symbolEl = oldData.getItemGraphicEl(oldIdx); - var point = data.getItemLayout(newIdx); - if (!symbolNeedsDraw(data, newIdx, isIgnore)) { - group.remove(symbolEl); - return; - } - if (!symbolEl) { - symbolEl = new SymbolCtor(data, newIdx); - symbolEl.attr('position', point); - } - else { - symbolEl.updateData(data, newIdx, seriesScope); - graphic.updateProps(symbolEl, { - position: point - }, seriesModel); - } + var showSymbol = seriesModel.get('showSymbol'); - // Add back - group.add(symbolEl); + var isSymbolIgnore = showSymbol && !isCoordSysPolar && !seriesModel.get('showAllSymbol') + && this._getSymbolIgnoreFunc(data, coordSys); - data.setItemGraphicEl(newIdx, symbolEl); - }) - .remove(function (oldIdx) { - var el = oldData.getItemGraphicEl(oldIdx); - el && el.fadeOut(function () { + // Remove temporary symbols + var oldData = this._data; + oldData && oldData.eachItemGraphicEl(function (el, idx) { + if (el.__temp) { group.remove(el); - }); - }) - .execute(); + oldData.setItemGraphicEl(idx, null); + } + }); - this._data = data; - }; + // Remove previous created symbols if showSymbol changed to false + if (!showSymbol) { + symbolDraw.remove(); + } - symbolDrawProto.updateLayout = function () { - var data = this._data; - if (data) { - // Not use animation - data.eachItemGraphicEl(function (el, idx) { - var point = data.getItemLayout(idx); - el.attr('position', point); - }); - } - }; + group.add(lineGroup); - symbolDrawProto.remove = function (enableAnimation) { - var group = this.group; - var data = this._data; - if (data) { - if (enableAnimation) { - data.eachItemGraphicEl(function (el) { - el.fadeOut(function () { - group.remove(el); - }); - }); + // FIXME step not support polar + var step = !isCoordSysPolar && seriesModel.get('step'); + // Initialization animation or coordinate system changed + if ( + !(polyline && prevCoordSys.type === coordSys.type && step === this._step) + ) { + showSymbol && symbolDraw.updateData(data, isSymbolIgnore); + + if (step) { + // TODO If stacked series is not step + points = turnPointsIntoStep(points, coordSys, step); + stackedOnPoints = turnPointsIntoStep(stackedOnPoints, coordSys, step); + } + + polyline = this._newPolyline(points, coordSys, hasAnimation); + if (isAreaChart) { + polygon = this._newPolygon( + points, stackedOnPoints, + coordSys, hasAnimation + ); + } + lineGroup.setClipPath(createClipShape(coordSys, true, seriesModel)); } else { - group.removeAll(); - } - } - }; + if (isAreaChart && !polygon) { + // If areaStyle is added + polygon = this._newPolygon( + points, stackedOnPoints, + coordSys, hasAnimation + ); + } + else if (polygon && !isAreaChart) { + // If areaStyle is removed + lineGroup.remove(polygon); + polygon = this._polygon = null; + } - module.exports = SymbolDraw; + // Update clipPath + lineGroup.setClipPath(createClipShape(coordSys, false, seriesModel)); + // Always update, or it is wrong in the case turning on legend + // because points are not changed + showSymbol && symbolDraw.updateData(data, isSymbolIgnore); -/***/ }, -/* 106 */ -/***/ function(module, exports, __webpack_require__) { + // Stop symbol animation and sync with line points + // FIXME performance? + data.eachItemGraphicEl(function (el) { + el.stopAnimation(true); + }); - /** - * @module echarts/chart/helper/Symbol - */ + // In the case data zoom triggerred refreshing frequently + // Data may not change if line has a category axis. So it should animate nothing + if (!isPointsSame(this._stackedOnPoints, stackedOnPoints) + || !isPointsSame(this._points, points) + ) { + if (hasAnimation) { + this._updateAnimation( + data, stackedOnPoints, coordSys, api, step + ); + } + else { + // Not do it in update with animation + if (step) { + // TODO If stacked series is not step + points = turnPointsIntoStep(points, coordSys, step); + stackedOnPoints = turnPointsIntoStep(stackedOnPoints, coordSys, step); + } + polyline.setShape({ + points: points + }); + polygon && polygon.setShape({ + points: points, + stackedOnPoints: stackedOnPoints + }); + } + } + } - var zrUtil = __webpack_require__(4); - var symbolUtil = __webpack_require__(107); - var graphic = __webpack_require__(43); - var numberUtil = __webpack_require__(7); + var visualColor = getVisualGradient(data, coordSys) || data.getVisual('color'); - function getSymbolSize(data, idx) { - var symbolSize = data.getItemVisual(idx, 'symbolSize'); - return symbolSize instanceof Array - ? symbolSize.slice() - : [+symbolSize, +symbolSize]; - } + polyline.useStyle(zrUtil.defaults( + // Use color in lineStyle first + lineStyleModel.getLineStyle(), + { + fill: 'none', + stroke: visualColor, + lineJoin: 'bevel' + } + )); - function getScale(symbolSize) { - return [symbolSize[0] / 2, symbolSize[1] / 2]; - } + var smooth = seriesModel.get('smooth'); + smooth = getSmooth(seriesModel.get('smooth')); + polyline.setShape({ + smooth: smooth, + smoothMonotone: seriesModel.get('smoothMonotone'), + connectNulls: seriesModel.get('connectNulls') + }); - /** - * @constructor - * @alias {module:echarts/chart/helper/Symbol} - * @param {module:echarts/data/List} data - * @param {number} idx - * @extends {module:zrender/graphic/Group} - */ - function Symbol(data, idx, seriesScope) { - graphic.Group.call(this); + if (polygon) { + var stackedOn = data.stackedOn; + var stackedOnSmooth = 0; - this.updateData(data, idx, seriesScope); - } + polygon.useStyle(zrUtil.defaults( + areaStyleModel.getAreaStyle(), + { + fill: visualColor, + opacity: 0.7, + lineJoin: 'bevel' + } + )); - var symbolProto = Symbol.prototype; + if (stackedOn) { + var stackedOnSeries = stackedOn.hostModel; + stackedOnSmooth = getSmooth(stackedOnSeries.get('smooth')); + } - function driftSymbol(dx, dy) { - this.parent.drift(dx, dy); - } + polygon.setShape({ + smooth: smooth, + stackedOnSmooth: stackedOnSmooth, + smoothMonotone: seriesModel.get('smoothMonotone'), + connectNulls: seriesModel.get('connectNulls') + }); + } - symbolProto._createSymbol = function (symbolType, data, idx, symbolSize) { - // Remove paths created before - this.removeAll(); + this._data = data; + // Save the coordinate system for transition animation when data changed + this._coordSys = coordSys; + this._stackedOnPoints = stackedOnPoints; + this._points = points; + this._step = step; + }, - var seriesModel = data.hostModel; - var color = data.getItemVisual(idx, 'color'); + dispose: function () {}, - // var symbolPath = symbolUtil.createSymbol( - // symbolType, -0.5, -0.5, 1, 1, color - // ); - // If width/height are set too small (e.g., set to 1) on ios10 - // and macOS Sierra, a circle stroke become a rect, no matter what - // the scale is set. So we set width/height as 2. See #4150. - var symbolPath = symbolUtil.createSymbol( - symbolType, -1, -1, 2, 2, color - ); + highlight: function (seriesModel, ecModel, api, payload) { + var data = seriesModel.getData(); + var dataIndex = modelUtil.queryDataIndex(data, payload); - symbolPath.attr({ - z2: 100, - culling: true, - scale: [0, 0] - }); - // Rewrite drift method - symbolPath.drift = driftSymbol; + if (!(dataIndex instanceof Array) && dataIndex != null && dataIndex >= 0) { + var symbol = data.getItemGraphicEl(dataIndex); + if (!symbol) { + // Create a temporary symbol if it is not exists + var pt = data.getItemLayout(dataIndex); + if (!pt) { + // Null data + return; + } + symbol = new Symbol(data, dataIndex); + symbol.position = pt; + symbol.setZ( + seriesModel.get('zlevel'), + seriesModel.get('z') + ); + symbol.ignore = isNaN(pt[0]) || isNaN(pt[1]); + symbol.__temp = true; + data.setItemGraphicEl(dataIndex, symbol); - graphic.initProps(symbolPath, { - scale: getScale(symbolSize) - }, seriesModel, idx); - this._symbolType = symbolType; + // Stop scale animation + symbol.stopSymbolAnimation(true); - this.add(symbolPath); - }; + this.group.add(symbol); + } + symbol.highlight(); + } + else { + // Highlight whole series + ChartView.prototype.highlight.call( + this, seriesModel, ecModel, api, payload + ); + } + }, - /** - * Stop animation - * @param {boolean} toLastFrame - */ - symbolProto.stopSymbolAnimation = function (toLastFrame) { - this.childAt(0).stopAnimation(toLastFrame); - }; + downplay: function (seriesModel, ecModel, api, payload) { + var data = seriesModel.getData(); + var dataIndex = modelUtil.queryDataIndex(data, payload); + if (dataIndex != null && dataIndex >= 0) { + var symbol = data.getItemGraphicEl(dataIndex); + if (symbol) { + if (symbol.__temp) { + data.setItemGraphicEl(dataIndex, null); + this.group.remove(symbol); + } + else { + symbol.downplay(); + } + } + } + else { + // FIXME + // can not downplay completely. + // Downplay whole series + ChartView.prototype.downplay.call( + this, seriesModel, ecModel, api, payload + ); + } + }, - /** - * Get symbol path element - */ - symbolProto.getSymbolPath = function () { - return this.childAt(0); - }; + /** + * @param {module:zrender/container/Group} group + * @param {Array.>} points + * @private + */ + _newPolyline: function (points) { + var polyline = this._polyline; + // Remove previous created polyline + if (polyline) { + this._lineGroup.remove(polyline); + } - /** - * Get scale(aka, current symbol size). - * Including the change caused by animation - */ - symbolProto.getScale = function () { - return this.childAt(0).scale; - }; + polyline = new polyHelper.Polyline({ + shape: { + points: points + }, + silent: true, + z2: 10 + }); - /** - * Highlight symbol - */ - symbolProto.highlight = function () { - this.childAt(0).trigger('emphasis'); - }; + this._lineGroup.add(polyline); - /** - * Downplay symbol - */ - symbolProto.downplay = function () { - this.childAt(0).trigger('normal'); - }; + this._polyline = polyline; - /** - * @param {number} zlevel - * @param {number} z - */ - symbolProto.setZ = function (zlevel, z) { - var symbolPath = this.childAt(0); - symbolPath.zlevel = zlevel; - symbolPath.z = z; - }; + return polyline; + }, - symbolProto.setDraggable = function (draggable) { - var symbolPath = this.childAt(0); - symbolPath.draggable = draggable; - symbolPath.cursor = draggable ? 'move' : 'pointer'; - }; + /** + * @param {module:zrender/container/Group} group + * @param {Array.>} stackedOnPoints + * @param {Array.>} points + * @private + */ + _newPolygon: function (points, stackedOnPoints) { + var polygon = this._polygon; + // Remove previous created polygon + if (polygon) { + this._lineGroup.remove(polygon); + } - /** - * Update symbol properties - * @param {module:echarts/data/List} data - * @param {number} idx - */ - symbolProto.updateData = function (data, idx, seriesScope) { - this.silent = false; + polygon = new polyHelper.Polygon({ + shape: { + points: points, + stackedOnPoints: stackedOnPoints + }, + silent: true + }); - var symbolType = data.getItemVisual(idx, 'symbol') || 'circle'; - var seriesModel = data.hostModel; - var symbolSize = getSymbolSize(data, idx); + this._lineGroup.add(polygon); - if (symbolType !== this._symbolType) { - this._createSymbol(symbolType, data, idx, symbolSize); - } - else { - var symbolPath = this.childAt(0); - graphic.updateProps(symbolPath, { - scale: getScale(symbolSize) - }, seriesModel, idx); - } - this._updateCommon(data, idx, symbolSize, seriesScope); - this._seriesModel = seriesModel; - }; + this._polygon = polygon; + return polygon; + }, + /** + * @private + */ + _getSymbolIgnoreFunc: function (data, coordSys) { + var categoryAxis = coordSys.getAxesByScale('ordinal')[0]; + // `getLabelInterval` is provided by echarts/component/axis + if (categoryAxis && categoryAxis.isLabelIgnored) { + return zrUtil.bind(categoryAxis.isLabelIgnored, categoryAxis); + } + }, - // Update common properties - var normalStyleAccessPath = ['itemStyle', 'normal']; - var emphasisStyleAccessPath = ['itemStyle', 'emphasis']; - var normalLabelAccessPath = ['label', 'normal']; - var emphasisLabelAccessPath = ['label', 'emphasis']; + /** + * @private + */ + // FIXME Two value axis + _updateAnimation: function (data, stackedOnPoints, coordSys, api, step) { + var polyline = this._polyline; + var polygon = this._polygon; + var seriesModel = data.hostModel; - symbolProto._updateCommon = function (data, idx, symbolSize, seriesScope) { - var symbolPath = this.childAt(0); - var seriesModel = data.hostModel; - var color = data.getItemVisual(idx, 'color'); + var diff = lineAnimationDiff( + this._data, data, + this._stackedOnPoints, stackedOnPoints, + this._coordSys, coordSys + ); - // Reset style - if (symbolPath.type !== 'image') { - symbolPath.useStyle({ - strokeNoScale: true - }); - } + var current = diff.current; + var stackedOnCurrent = diff.stackedOnCurrent; + var next = diff.next; + var stackedOnNext = diff.stackedOnNext; + if (step) { + // TODO If stacked series is not step + current = turnPointsIntoStep(diff.current, coordSys, step); + stackedOnCurrent = turnPointsIntoStep(diff.stackedOnCurrent, coordSys, step); + next = turnPointsIntoStep(diff.next, coordSys, step); + stackedOnNext = turnPointsIntoStep(diff.stackedOnNext, coordSys, step); + } + // `diff.current` is subset of `current` (which should be ensured by + // turnPointsIntoStep), so points in `__points` can be updated when + // points in `current` are update during animation. + polyline.shape.__points = diff.current; + polyline.shape.points = current; - seriesScope = seriesScope || null; + graphic.updateProps(polyline, { + shape: { + points: next + } + }, seriesModel); - var itemStyle = seriesScope && seriesScope.itemStyle; - var hoverItemStyle = seriesScope && seriesScope.hoverItemStyle; - var symbolRotate = seriesScope && seriesScope.symbolRotate; - var symbolOffset = seriesScope && seriesScope.symbolOffset; - var labelModel = seriesScope && seriesScope.labelModel; - var hoverLabelModel = seriesScope && seriesScope.hoverLabelModel; - var hoverAnimation = seriesScope && seriesScope.hoverAnimation; + if (polygon) { + polygon.setShape({ + points: current, + stackedOnPoints: stackedOnCurrent + }); + graphic.updateProps(polygon, { + shape: { + points: next, + stackedOnPoints: stackedOnNext + } + }, seriesModel); + } - if (!seriesScope || data.hasItemOption) { - var itemModel = data.getItemModel(idx); + var updatedDataInfo = []; + var diffStatus = diff.status; - // Color must be excluded. - // Because symbol provide setColor individually to set fill and stroke - itemStyle = itemModel.getModel(normalStyleAccessPath).getItemStyle(['color']); - hoverItemStyle = itemModel.getModel(emphasisStyleAccessPath).getItemStyle(); + for (var i = 0; i < diffStatus.length; i++) { + var cmd = diffStatus[i].cmd; + if (cmd === '=') { + var el = data.getItemGraphicEl(diffStatus[i].idx1); + if (el) { + updatedDataInfo.push({ + el: el, + ptIdx: i // Index of points + }); + } + } + } - symbolRotate = itemModel.getShallow('symbolRotate'); - symbolOffset = itemModel.getShallow('symbolOffset'); + if (polyline.animators && polyline.animators.length) { + polyline.animators[0].during(function () { + for (var i = 0; i < updatedDataInfo.length; i++) { + var el = updatedDataInfo[i].el; + el.attr('position', polyline.shape.__points[updatedDataInfo[i].ptIdx]); + } + }); + } + }, - labelModel = itemModel.getModel(normalLabelAccessPath); - hoverLabelModel = itemModel.getModel(emphasisLabelAccessPath); - hoverAnimation = itemModel.getShallow('hoverAnimation'); - } - else { - hoverItemStyle = zrUtil.extend({}, hoverItemStyle); + remove: function (ecModel) { + var group = this.group; + var oldData = this._data; + this._lineGroup.removeAll(); + this._symbolDraw.remove(true); + // Remove temporary created elements when highlighting + oldData && oldData.eachItemGraphicEl(function (el, idx) { + if (el.__temp) { + group.remove(el); + oldData.setItemGraphicEl(idx, null); + } + }); + + this._polyline = + this._polygon = + this._coordSys = + this._points = + this._stackedOnPoints = + this._data = null; } + }); - var elStyle = symbolPath.style; - symbolPath.attr('rotation', (symbolRotate || 0) * Math.PI / 180 || 0); +/***/ }, +/* 115 */ +/***/ function(module, exports, __webpack_require__) { - if (symbolOffset) { - symbolPath.attr('position', [ - numberUtil.parsePercent(symbolOffset[0], symbolSize[0]), - numberUtil.parsePercent(symbolOffset[1], symbolSize[1]) - ]); - } + /** + * @module echarts/chart/helper/SymbolDraw + */ - // PENDING setColor before setStyle!!! - symbolPath.setColor(color); - symbolPath.setStyle(itemStyle); + var graphic = __webpack_require__(44); + var Symbol = __webpack_require__(116); - var opacity = data.getItemVisual(idx, 'opacity'); - if (opacity != null) { - elStyle.opacity = opacity; - } + /** + * @constructor + * @alias module:echarts/chart/helper/SymbolDraw + * @param {module:zrender/graphic/Group} [symbolCtor] + */ + function SymbolDraw(symbolCtor) { + this.group = new graphic.Group(); - // Get last value dim - var dimensions = data.dimensions.slice(); - var valueDim; - var dataType; - while (dimensions.length && ( - valueDim = dimensions.pop(), - dataType = data.getDimensionInfo(valueDim).type, - dataType === 'ordinal' || dataType === 'time' - )) {} // jshint ignore:line + this._symbolCtor = symbolCtor || Symbol; + } - if (valueDim != null && labelModel.getShallow('show')) { - graphic.setText(elStyle, labelModel, color); - elStyle.text = zrUtil.retrieve( - seriesModel.getFormattedLabel(idx, 'normal'), - data.get(valueDim, idx) - ); - } - else { - elStyle.text = ''; - } + var symbolDrawProto = SymbolDraw.prototype; + + function symbolNeedsDraw(data, idx, isIgnore) { + var point = data.getItemLayout(idx); + // Is an object + // if (point && point.hasOwnProperty('point')) { + // point = point.point; + // } + return point && !isNaN(point[0]) && !isNaN(point[1]) && !(isIgnore && isIgnore(idx)) + && data.getItemVisual(idx, 'symbol') !== 'none'; + } + /** + * Update symbols draw by new data + * @param {module:echarts/data/List} data + * @param {Array.} [isIgnore] + */ + symbolDrawProto.updateData = function (data, isIgnore) { + var group = this.group; + var seriesModel = data.hostModel; + var oldData = this._data; - if (valueDim != null && hoverLabelModel.getShallow('show')) { - graphic.setText(hoverItemStyle, hoverLabelModel, color); - hoverItemStyle.text = zrUtil.retrieve( - seriesModel.getFormattedLabel(idx, 'emphasis'), - data.get(valueDim, idx) - ); - } - else { - hoverItemStyle.text = ''; - } + var SymbolCtor = this._symbolCtor; - symbolPath.off('mouseover') - .off('mouseout') - .off('emphasis') - .off('normal'); + var seriesScope = { + itemStyle: seriesModel.getModel('itemStyle.normal').getItemStyle(['color']), + hoverItemStyle: seriesModel.getModel('itemStyle.emphasis').getItemStyle(), + symbolRotate: seriesModel.get('symbolRotate'), + symbolOffset: seriesModel.get('symbolOffset'), + hoverAnimation: seriesModel.get('hoverAnimation'), - symbolPath.hoverStyle = hoverItemStyle; + labelModel: seriesModel.getModel('label.normal'), + hoverLabelModel: seriesModel.getModel('label.emphasis') + }; - graphic.setHoverStyle(symbolPath); + data.diff(oldData) + .add(function (newIdx) { + var point = data.getItemLayout(newIdx); + if (symbolNeedsDraw(data, newIdx, isIgnore)) { + var symbolEl = new SymbolCtor(data, newIdx, seriesScope); + symbolEl.attr('position', point); + data.setItemGraphicEl(newIdx, symbolEl); + group.add(symbolEl); + } + }) + .update(function (newIdx, oldIdx) { + var symbolEl = oldData.getItemGraphicEl(oldIdx); + var point = data.getItemLayout(newIdx); + if (!symbolNeedsDraw(data, newIdx, isIgnore)) { + group.remove(symbolEl); + return; + } + if (!symbolEl) { + symbolEl = new SymbolCtor(data, newIdx); + symbolEl.attr('position', point); + } + else { + symbolEl.updateData(data, newIdx, seriesScope); + graphic.updateProps(symbolEl, { + position: point + }, seriesModel); + } - var scale = getScale(symbolSize); + // Add back + group.add(symbolEl); - if (hoverAnimation && seriesModel.isAnimationEnabled()) { - var onEmphasis = function() { - var ratio = scale[1] / scale[0]; - this.animateTo({ - scale: [ - Math.max(scale[0] * 1.1, scale[0] + 3), - Math.max(scale[1] * 1.1, scale[1] + 3 * ratio) - ] - }, 400, 'elasticOut'); - }; - var onNormal = function() { - this.animateTo({ - scale: scale - }, 400, 'elasticOut'); - }; - symbolPath.on('mouseover', onEmphasis) - .on('mouseout', onNormal) - .on('emphasis', onEmphasis) - .on('normal', onNormal); - } + data.setItemGraphicEl(newIdx, symbolEl); + }) + .remove(function (oldIdx) { + var el = oldData.getItemGraphicEl(oldIdx); + el && el.fadeOut(function () { + group.remove(el); + }); + }) + .execute(); + + this._data = data; }; - symbolProto.fadeOut = function (cb) { - var symbolPath = this.childAt(0); - // Avoid mistaken hover when fading out - this.silent = true; - // Not show text when animating - symbolPath.style.text = ''; - graphic.updateProps(symbolPath, { - scale: [0, 0] - }, this._seriesModel, this.dataIndex, cb); + symbolDrawProto.updateLayout = function () { + var data = this._data; + if (data) { + // Not use animation + data.eachItemGraphicEl(function (el, idx) { + var point = data.getItemLayout(idx); + el.attr('position', point); + }); + } }; - zrUtil.inherits(Symbol, graphic.Group); + symbolDrawProto.remove = function (enableAnimation) { + var group = this.group; + var data = this._data; + if (data) { + if (enableAnimation) { + data.eachItemGraphicEl(function (el) { + el.fadeOut(function () { + group.remove(el); + }); + }); + } + else { + group.removeAll(); + } + } + }; - module.exports = Symbol; + module.exports = SymbolDraw; /***/ }, -/* 107 */ +/* 116 */ /***/ function(module, exports, __webpack_require__) { - 'use strict'; - // Symbol factory + /** + * @module echarts/chart/helper/Symbol + */ - var graphic = __webpack_require__(43); - var BoundingRect = __webpack_require__(9); + var zrUtil = __webpack_require__(4); + var symbolUtil = __webpack_require__(104); + var graphic = __webpack_require__(44); + var numberUtil = __webpack_require__(7); - /** - * Triangle shape - * @inner - */ - var Triangle = graphic.extendShape({ - type: 'triangle', - shape: { - cx: 0, - cy: 0, - width: 0, - height: 0 - }, - buildPath: function (path, shape) { - var cx = shape.cx; - var cy = shape.cy; - var width = shape.width / 2; - var height = shape.height / 2; - path.moveTo(cx, cy - height); - path.lineTo(cx + width, cy + height); - path.lineTo(cx - width, cy + height); - path.closePath(); - } - }); - /** - * Diamond shape - * @inner - */ - var Diamond = graphic.extendShape({ - type: 'diamond', - shape: { - cx: 0, - cy: 0, - width: 0, - height: 0 - }, - buildPath: function (path, shape) { - var cx = shape.cx; - var cy = shape.cy; - var width = shape.width / 2; - var height = shape.height / 2; - path.moveTo(cx, cy - height); - path.lineTo(cx + width, cy); - path.lineTo(cx, cy + height); - path.lineTo(cx - width, cy); - path.closePath(); - } - }); + function getSymbolSize(data, idx) { + var symbolSize = data.getItemVisual(idx, 'symbolSize'); + return symbolSize instanceof Array + ? symbolSize.slice() + : [+symbolSize, +symbolSize]; + } + + function getScale(symbolSize) { + return [symbolSize[0] / 2, symbolSize[1] / 2]; + } /** - * Pin shape - * @inner + * @constructor + * @alias {module:echarts/chart/helper/Symbol} + * @param {module:echarts/data/List} data + * @param {number} idx + * @extends {module:zrender/graphic/Group} */ - var Pin = graphic.extendShape({ - type: 'pin', - shape: { - // x, y on the cusp - x: 0, - y: 0, - width: 0, - height: 0 - }, + function Symbol(data, idx, seriesScope) { + graphic.Group.call(this); - buildPath: function (path, shape) { - var x = shape.x; - var y = shape.y; - var w = shape.width / 5 * 3; - // Height must be larger than width - var h = Math.max(w, shape.height); - var r = w / 2; + this.updateData(data, idx, seriesScope); + } - // Dist on y with tangent point and circle center - var dy = r * r / (h - r); - var cy = y - h + r + dy; - var angle = Math.asin(dy / r); - // Dist on x with tangent point and circle center - var dx = Math.cos(angle) * r; + var symbolProto = Symbol.prototype; - var tanX = Math.sin(angle); - var tanY = Math.cos(angle); + function driftSymbol(dx, dy) { + this.parent.drift(dx, dy); + } - path.arc( - x, cy, r, - Math.PI - angle, - Math.PI * 2 + angle - ); + symbolProto._createSymbol = function (symbolType, data, idx, symbolSize) { + // Remove paths created before + this.removeAll(); - var cpLen = r * 0.6; - var cpLen2 = r * 0.7; - path.bezierCurveTo( - x + dx - tanX * cpLen, cy + dy + tanY * cpLen, - x, y - cpLen2, - x, y - ); - path.bezierCurveTo( - x, y - cpLen2, - x - dx + tanX * cpLen, cy + dy + tanY * cpLen, - x - dx, cy + dy - ); - path.closePath(); - } - }); + var seriesModel = data.hostModel; + var color = data.getItemVisual(idx, 'color'); + + // var symbolPath = symbolUtil.createSymbol( + // symbolType, -0.5, -0.5, 1, 1, color + // ); + // If width/height are set too small (e.g., set to 1) on ios10 + // and macOS Sierra, a circle stroke become a rect, no matter what + // the scale is set. So we set width/height as 2. See #4150. + var symbolPath = symbolUtil.createSymbol( + symbolType, -1, -1, 2, 2, color + ); - /** - * Arrow shape - * @inner - */ - var Arrow = graphic.extendShape({ + symbolPath.attr({ + z2: 100, + culling: true, + scale: [0, 0] + }); + // Rewrite drift method + symbolPath.drift = driftSymbol; - type: 'arrow', + graphic.initProps(symbolPath, { + scale: getScale(symbolSize) + }, seriesModel, idx); + this._symbolType = symbolType; - shape: { - x: 0, - y: 0, - width: 0, - height: 0 - }, + this.add(symbolPath); + }; - buildPath: function (ctx, shape) { - var height = shape.height; - var width = shape.width; - var x = shape.x; - var y = shape.y; - var dx = width / 3 * 2; - ctx.moveTo(x, y); - ctx.lineTo(x + dx, y + height); - ctx.lineTo(x, y + height / 4 * 3); - ctx.lineTo(x - dx, y + height); - ctx.lineTo(x, y); - ctx.closePath(); - } - }); + /** + * Stop animation + * @param {boolean} toLastFrame + */ + symbolProto.stopSymbolAnimation = function (toLastFrame) { + this.childAt(0).stopAnimation(toLastFrame); + }; /** - * Map of path contructors - * @type {Object.} + * Get symbol path element */ - var symbolCtors = { - line: graphic.Line, + symbolProto.getSymbolPath = function () { + return this.childAt(0); + }; - rect: graphic.Rect, + /** + * Get scale(aka, current symbol size). + * Including the change caused by animation + */ + symbolProto.getScale = function () { + return this.childAt(0).scale; + }; - roundRect: graphic.Rect, + /** + * Highlight symbol + */ + symbolProto.highlight = function () { + this.childAt(0).trigger('emphasis'); + }; - square: graphic.Rect, + /** + * Downplay symbol + */ + symbolProto.downplay = function () { + this.childAt(0).trigger('normal'); + }; - circle: graphic.Circle, + /** + * @param {number} zlevel + * @param {number} z + */ + symbolProto.setZ = function (zlevel, z) { + var symbolPath = this.childAt(0); + symbolPath.zlevel = zlevel; + symbolPath.z = z; + }; - diamond: Diamond, + symbolProto.setDraggable = function (draggable) { + var symbolPath = this.childAt(0); + symbolPath.draggable = draggable; + symbolPath.cursor = draggable ? 'move' : 'pointer'; + }; - pin: Pin, + /** + * Update symbol properties + * @param {module:echarts/data/List} data + * @param {number} idx + */ + symbolProto.updateData = function (data, idx, seriesScope) { + this.silent = false; - arrow: Arrow, + var symbolType = data.getItemVisual(idx, 'symbol') || 'circle'; + var seriesModel = data.hostModel; + var symbolSize = getSymbolSize(data, idx); - triangle: Triangle + if (symbolType !== this._symbolType) { + this._createSymbol(symbolType, data, idx, symbolSize); + } + else { + var symbolPath = this.childAt(0); + symbolPath.silent = false; + graphic.updateProps(symbolPath, { + scale: getScale(symbolSize) + }, seriesModel, idx); + } + this._updateCommon(data, idx, symbolSize, seriesScope); + this._seriesModel = seriesModel; }; - var symbolShapeMakers = { - - line: function (x, y, w, h, shape) { - // FIXME - shape.x1 = x; - shape.y1 = y + h / 2; - shape.x2 = x + w; - shape.y2 = y + h / 2; - }, + // Update common properties + var normalStyleAccessPath = ['itemStyle', 'normal']; + var emphasisStyleAccessPath = ['itemStyle', 'emphasis']; + var normalLabelAccessPath = ['label', 'normal']; + var emphasisLabelAccessPath = ['label', 'emphasis']; - rect: function (x, y, w, h, shape) { - shape.x = x; - shape.y = y; - shape.width = w; - shape.height = h; - }, + symbolProto._updateCommon = function (data, idx, symbolSize, seriesScope) { + var symbolPath = this.childAt(0); + var seriesModel = data.hostModel; + var color = data.getItemVisual(idx, 'color'); - roundRect: function (x, y, w, h, shape) { - shape.x = x; - shape.y = y; - shape.width = w; - shape.height = h; - shape.r = Math.min(w, h) / 4; - }, + // Reset style + if (symbolPath.type !== 'image') { + symbolPath.useStyle({ + strokeNoScale: true + }); + } - square: function (x, y, w, h, shape) { - var size = Math.min(w, h); - shape.x = x; - shape.y = y; - shape.width = size; - shape.height = size; - }, + seriesScope = seriesScope || null; - circle: function (x, y, w, h, shape) { - // Put circle in the center of square - shape.cx = x + w / 2; - shape.cy = y + h / 2; - shape.r = Math.min(w, h) / 2; - }, + var itemStyle = seriesScope && seriesScope.itemStyle; + var hoverItemStyle = seriesScope && seriesScope.hoverItemStyle; + var symbolRotate = seriesScope && seriesScope.symbolRotate; + var symbolOffset = seriesScope && seriesScope.symbolOffset; + var labelModel = seriesScope && seriesScope.labelModel; + var hoverLabelModel = seriesScope && seriesScope.hoverLabelModel; + var hoverAnimation = seriesScope && seriesScope.hoverAnimation; - diamond: function (x, y, w, h, shape) { - shape.cx = x + w / 2; - shape.cy = y + h / 2; - shape.width = w; - shape.height = h; - }, + if (!seriesScope || data.hasItemOption) { + var itemModel = data.getItemModel(idx); - pin: function (x, y, w, h, shape) { - shape.x = x + w / 2; - shape.y = y + h / 2; - shape.width = w; - shape.height = h; - }, + // Color must be excluded. + // Because symbol provide setColor individually to set fill and stroke + itemStyle = itemModel.getModel(normalStyleAccessPath).getItemStyle(['color']); + hoverItemStyle = itemModel.getModel(emphasisStyleAccessPath).getItemStyle(); - arrow: function (x, y, w, h, shape) { - shape.x = x + w / 2; - shape.y = y + h / 2; - shape.width = w; - shape.height = h; - }, + symbolRotate = itemModel.getShallow('symbolRotate'); + symbolOffset = itemModel.getShallow('symbolOffset'); - triangle: function (x, y, w, h, shape) { - shape.cx = x + w / 2; - shape.cy = y + h / 2; - shape.width = w; - shape.height = h; + labelModel = itemModel.getModel(normalLabelAccessPath); + hoverLabelModel = itemModel.getModel(emphasisLabelAccessPath); + hoverAnimation = itemModel.getShallow('hoverAnimation'); } - }; - - var symbolBuildProxies = {}; - for (var name in symbolCtors) { - if (symbolCtors.hasOwnProperty(name)) { - symbolBuildProxies[name] = new symbolCtors[name](); + else { + hoverItemStyle = zrUtil.extend({}, hoverItemStyle); } - } - var Symbol = graphic.extendShape({ + var elStyle = symbolPath.style; - type: 'symbol', + symbolPath.attr('rotation', (symbolRotate || 0) * Math.PI / 180 || 0); - shape: { - symbolType: '', - x: 0, - y: 0, - width: 0, - height: 0 - }, + if (symbolOffset) { + symbolPath.attr('position', [ + numberUtil.parsePercent(symbolOffset[0], symbolSize[0]), + numberUtil.parsePercent(symbolOffset[1], symbolSize[1]) + ]); + } - beforeBrush: function () { - var style = this.style; - var shape = this.shape; - // FIXME - if (shape.symbolType === 'pin' && style.textPosition === 'inside') { - style.textPosition = ['50%', '40%']; - style.textAlign = 'center'; - style.textVerticalAlign = 'middle'; - } - }, + // PENDING setColor before setStyle!!! + symbolPath.setColor(color); + + symbolPath.setStyle(itemStyle); - buildPath: function (ctx, shape, inBundle) { - var symbolType = shape.symbolType; - var proxySymbol = symbolBuildProxies[symbolType]; - if (shape.symbolType !== 'none') { - if (!proxySymbol) { - // Default rect - symbolType = 'rect'; - proxySymbol = symbolBuildProxies[symbolType]; - } - symbolShapeMakers[symbolType]( - shape.x, shape.y, shape.width, shape.height, proxySymbol.shape - ); - proxySymbol.buildPath(ctx, proxySymbol.shape, inBundle); - } + var opacity = data.getItemVisual(idx, 'opacity'); + if (opacity != null) { + elStyle.opacity = opacity; } - }); - // Provide setColor helper method to avoid determine if set the fill or stroke outside - var symbolPathSetColor = function (color) { - if (this.type !== 'image') { - var symbolStyle = this.style; - var symbolShape = this.shape; - if (symbolShape && symbolShape.symbolType === 'line') { - symbolStyle.stroke = color; - } - else if (this.__isEmptyBrush) { - symbolStyle.stroke = color; - symbolStyle.fill = '#fff'; - } - else { - // FIXME 判断图形默认是填充还是描边,使用 onlyStroke ? - symbolStyle.fill && (symbolStyle.fill = color); - symbolStyle.stroke && (symbolStyle.stroke = color); - } - this.dirty(false); + // Get last value dim + var dimensions = data.dimensions.slice(); + var valueDim; + var dataType; + while (dimensions.length && ( + valueDim = dimensions.pop(), + dataType = data.getDimensionInfo(valueDim).type, + dataType === 'ordinal' || dataType === 'time' + )) {} // jshint ignore:line + + if (valueDim != null && labelModel.getShallow('show')) { + graphic.setText(elStyle, labelModel, color); + elStyle.text = zrUtil.retrieve( + seriesModel.getFormattedLabel(idx, 'normal'), + data.get(valueDim, idx) + ); + } + else { + elStyle.text = ''; } - }; - var symbolUtil = { - /** - * Create a symbol element with given symbol configuration: shape, x, y, width, height, color - * @param {string} symbolType - * @param {number} x - * @param {number} y - * @param {number} w - * @param {number} h - * @param {string} color - */ - createSymbol: function (symbolType, x, y, w, h, color) { - var isEmpty = symbolType.indexOf('empty') === 0; - if (isEmpty) { - symbolType = symbolType.substr(5, 1).toLowerCase() + symbolType.substr(6); - } - var symbolPath; + if (valueDim != null && hoverLabelModel.getShallow('show')) { + graphic.setText(hoverItemStyle, hoverLabelModel, color); + hoverItemStyle.text = zrUtil.retrieve( + seriesModel.getFormattedLabel(idx, 'emphasis'), + data.get(valueDim, idx) + ); + } + else { + hoverItemStyle.text = ''; + } - if (symbolType.indexOf('image://') === 0) { - symbolPath = new graphic.Image({ - style: { - image: symbolType.slice(8), - x: x, - y: y, - width: w, - height: h - } - }); - } - else if (symbolType.indexOf('path://') === 0) { - symbolPath = graphic.makePath(symbolType.slice(7), {}, new BoundingRect(x, y, w, h)); - } - else { - symbolPath = new Symbol({ - shape: { - symbolType: symbolType, - x: x, - y: y, - width: w, - height: h - } - }); - } + symbolPath.off('mouseover') + .off('mouseout') + .off('emphasis') + .off('normal'); - symbolPath.__isEmptyBrush = isEmpty; + symbolPath.hoverStyle = hoverItemStyle; - symbolPath.setColor = symbolPathSetColor; + graphic.setHoverStyle(symbolPath); - symbolPath.setColor(color); + var scale = getScale(symbolSize); - return symbolPath; + if (hoverAnimation && seriesModel.isAnimationEnabled()) { + var onEmphasis = function() { + var ratio = scale[1] / scale[0]; + this.animateTo({ + scale: [ + Math.max(scale[0] * 1.1, scale[0] + 3), + Math.max(scale[1] * 1.1, scale[1] + 3 * ratio) + ] + }, 400, 'elasticOut'); + }; + var onNormal = function() { + this.animateTo({ + scale: scale + }, 400, 'elasticOut'); + }; + symbolPath.on('mouseover', onEmphasis) + .on('mouseout', onNormal) + .on('emphasis', onEmphasis) + .on('normal', onNormal); } }; - module.exports = symbolUtil; + symbolProto.fadeOut = function (cb) { + var symbolPath = this.childAt(0); + // Avoid mistaken hover when fading out + this.silent = symbolPath.silent = true; + // Not show text when animating + symbolPath.style.text = ''; + graphic.updateProps(symbolPath, { + scale: [0, 0] + }, this._seriesModel, this.dataIndex, cb); + }; + + zrUtil.inherits(Symbol, graphic.Group); + + module.exports = Symbol; /***/ }, -/* 108 */ +/* 117 */ /***/ function(module, exports) { @@ -25133,13 +27058,13 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 109 */ +/* 118 */ /***/ function(module, exports, __webpack_require__) { // Poly path support NaN point - var Path = __webpack_require__(45); + var Path = __webpack_require__(46); var vec2 = __webpack_require__(10); var vec2Min = vec2.min; @@ -25388,7 +27313,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 110 */ +/* 119 */ /***/ function(module, exports) { @@ -25437,7 +27362,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 111 */ +/* 120 */ /***/ function(module, exports) { @@ -25450,13 +27375,13 @@ return /******/ (function(modules) { // webpackBootstrap if (coordSys) { var dims = coordSys.dimensions; - if (coordSys.type === 'singleAxis') { + if (dims.length === 1) { data.each(dims[0], function (x, idx) { // Also {Array.}, not undefined to avoid if...else... statement data.setItemLayout(idx, isNaN(x) ? [NaN, NaN] : coordSys.dataToPoint(x)); }); } - else { + else if (dims.length === 2) { data.each(dims, function (x, y, idx) { // Also {Array.}, not undefined to avoid if...else... statement data.setItemLayout( @@ -25469,8 +27394,9 @@ return /******/ (function(modules) { // webpackBootstrap }; + /***/ }, -/* 112 */ +/* 121 */ /***/ function(module, exports) { @@ -25553,19 +27479,31 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 113 */ +/* 122 */ +/***/ function(module, exports, __webpack_require__) { + + + + __webpack_require__(123); + + __webpack_require__(142); + + + +/***/ }, +/* 123 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; - var graphic = __webpack_require__(43); + var graphic = __webpack_require__(44); var zrUtil = __webpack_require__(4); var echarts = __webpack_require__(1); - __webpack_require__(114); + __webpack_require__(124); - __webpack_require__(131); + __webpack_require__(133); // Grid view echarts.extendComponentView({ @@ -25597,7 +27535,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 114 */ +/* 124 */ /***/ function(module, exports, __webpack_require__) { /** @@ -25608,11 +27546,11 @@ return /******/ (function(modules) { // webpackBootstrap var factory = exports; var layout = __webpack_require__(21); - var axisHelper = __webpack_require__(115); + var axisHelper = __webpack_require__(105); var zrUtil = __webpack_require__(4); - var Cartesian2D = __webpack_require__(121); - var Axis2D = __webpack_require__(123); + var Cartesian2D = __webpack_require__(125); + var Axis2D = __webpack_require__(127); var each = zrUtil.each; @@ -25620,7 +27558,7 @@ return /******/ (function(modules) { // webpackBootstrap var niceScaleExtent = axisHelper.niceScaleExtent; // 依赖 GridModel, AxisModel 做预处理 - __webpack_require__(126); + __webpack_require__(129); /** * Check if the axis is used in the specified grid @@ -25678,13 +27616,15 @@ return /******/ (function(modules) { // webpackBootstrap this._initCartesian(gridModel, ecModel, api); - this._model = gridModel; + this.model = gridModel; } var gridProto = Grid.prototype; gridProto.type = 'grid'; + gridProto.axisPointerEnabled = true; + gridProto.getRect = function () { return this._rect; }; @@ -25693,7 +27633,7 @@ return /******/ (function(modules) { // webpackBootstrap var axesMap = this._axesMap; - this._updateScale(ecModel, this._model); + this._updateScale(ecModel, this.model); function ifAxisCanNotOnZero(otherAxisDim) { var axes = axesMap[otherAxisDim]; @@ -25709,10 +27649,10 @@ return /******/ (function(modules) { // webpackBootstrap } each(axesMap.x, function (xAxis) { - niceScaleExtent(xAxis, xAxis.model); + niceScaleExtent(xAxis.scale, xAxis.model); }); each(axesMap.y, function (yAxis) { - niceScaleExtent(yAxis, yAxis.model); + niceScaleExtent(yAxis.scale, yAxis.model); }); // Fix configuration each(axesMap.x, function (xAxis) { @@ -25731,7 +27671,7 @@ return /******/ (function(modules) { // webpackBootstrap // Resize again if containLabel is enabled // FIXME It may cause getting wrong grid size in data processing stage - this.resize(this._model, api); + this.resize(this.model, api); }; /** @@ -25805,23 +27745,47 @@ return /******/ (function(modules) { // webpackBootstrap } }; + /** + * @return {Array.} + */ + gridProto.getAxes = function () { + return this._axesList.slice(); + }; + + /** + * Usage: + * grid.getCartesian(xAxisIndex, yAxisIndex); + * grid.getCartesian(xAxisIndex); + * grid.getCartesian(null, yAxisIndex); + * grid.getCartesian({xAxisIndex: ..., yAxisIndex: ...}); + * + * @param {number|Object} [xAxisIndex] + * @param {number} [yAxisIndex] + */ gridProto.getCartesian = function (xAxisIndex, yAxisIndex) { if (xAxisIndex != null && yAxisIndex != null) { var key = 'x' + xAxisIndex + 'y' + yAxisIndex; return this._coordsMap[key]; } - else { - // When only xAxisIndex or yAxisIndex given, find its first cartesian. - for (var i = 0, coordList = this._coordsList; i < coordList.length; i++) { - if (coordList[i].getAxis('x').index === xAxisIndex - || coordList[i].getAxis('y').index === yAxisIndex - ) { - return coordList[i]; - } + + if (zrUtil.isObject(xAxisIndex)) { + yAxisIndex = xAxisIndex.yAxisIndex; + xAxisIndex = xAxisIndex.xAxisIndex; + } + // When only xAxisIndex or yAxisIndex given, find its first cartesian. + for (var i = 0, coordList = this._coordsList; i < coordList.length; i++) { + if (coordList[i].getAxis('x').index === xAxisIndex + || coordList[i].getAxis('y').index === yAxisIndex + ) { + return coordList[i]; } } }; + gridProto.getCartesians = function () { + return this._coordsList.slice(); + }; + /** * @implements * see {module:echarts/CoodinateSystem} @@ -25940,6 +27904,7 @@ return /******/ (function(modules) { // webpackBootstrap var cartesian = new Cartesian2D(key); cartesian.grid = this; + cartesian.model = gridModel; this._coordsMap[key] = cartesian; this._coordsList.push(cartesian); @@ -26054,6 +28019,25 @@ return /******/ (function(modules) { // webpackBootstrap } }; + /** + * @param {string} [dim] 'x' or 'y' or 'auto' or null/undefined + * @return {Object} {baseAxes: [], otherAxes: []} + */ + gridProto.getTooltipAxes = function (dim) { + var baseAxes = []; + var otherAxes = []; + + each(this.getCartesians(), function (cartesian) { + var baseAxis = (dim != null && dim !== 'auto') + ? cartesian.getAxis(dim) : cartesian.getBaseAxis(); + var otherAxis = cartesian.getOtherAxis(baseAxis); + zrUtil.indexOf(baseAxes, baseAxis) < 0 && baseAxes.push(baseAxis); + zrUtil.indexOf(otherAxes, otherAxis) < 0 && otherAxes.push(otherAxis); + }); + + return {baseAxes: baseAxes, otherAxes: otherAxes}; + }; + /** * @inner */ @@ -26150,2426 +28134,2894 @@ return /******/ (function(modules) { // webpackBootstrap seriesModel.coordinateSystem = grid.getCartesian( xAxisModel.componentIndex, yAxisModel.componentIndex ); - }); - - return grids; - }; - - // For deciding which dimensions to use when creating list data - Grid.dimensions = Cartesian2D.prototype.dimensions; - - __webpack_require__(26).register('cartesian2d', Grid); - - module.exports = Grid; - - -/***/ }, -/* 115 */ -/***/ function(module, exports, __webpack_require__) { - - - - var OrdinalScale = __webpack_require__(116); - var IntervalScale = __webpack_require__(118); - __webpack_require__(119); - __webpack_require__(120); - var Scale = __webpack_require__(117); - - var numberUtil = __webpack_require__(7); - var zrUtil = __webpack_require__(4); - var textContain = __webpack_require__(8); - var axisHelper = {}; - - /** - * Get axis scale extent before niced. - * Item of returned array can only be number (including Infinity and NaN). - */ - axisHelper.getScaleExtent = function (axis, model) { - var scale = axis.scale; - var scaleType = scale.type; - - var min = model.getMin(); - var max = model.getMax(); - var fixMin = min != null; - var fixMax = max != null; - var originalExtent = scale.getExtent(); - - var axisDataLen; - var boundaryGap; - var span; - if (scaleType === 'ordinal') { - axisDataLen = (model.get('data') || []).length; - } - else { - boundaryGap = model.get('boundaryGap'); - if (!zrUtil.isArray(boundaryGap)) { - boundaryGap = [boundaryGap || 0, boundaryGap || 0]; - } - boundaryGap[0] = numberUtil.parsePercent(boundaryGap[0], 1); - boundaryGap[1] = numberUtil.parsePercent(boundaryGap[1], 1); - span = originalExtent[1] - originalExtent[0]; - } + }); - if (min == null) { - min = scaleType === 'ordinal' - ? (axisDataLen ? 0 : NaN) - : originalExtent[0] - boundaryGap[0] * span; - } - if (max == null) { - max = scaleType === 'ordinal' - ? (axisDataLen ? axisDataLen - 1 : NaN) - : originalExtent[1] + boundaryGap[1] * span; - } + return grids; + }; - if (min === 'dataMin') { - min = originalExtent[0]; - } - if (max === 'dataMax') { - max = originalExtent[1]; - } + // For deciding which dimensions to use when creating list data + Grid.dimensions = Grid.prototype.dimensions = Cartesian2D.prototype.dimensions; - (min == null || !isFinite(min)) && (min = NaN); - (max == null || !isFinite(max)) && (max = NaN); + __webpack_require__(26).register('cartesian2d', Grid); - axis.setBlank(zrUtil.eqNaN(min) || zrUtil.eqNaN(max)); + module.exports = Grid; - // Evaluate if axis needs cross zero - if (model.getNeedCrossZero()) { - // Axis is over zero and min is not set - if (min > 0 && max > 0 && !fixMin) { - min = 0; - } - // Axis is under zero and max is not set - if (min < 0 && max < 0 && !fixMax) { - max = 0; - } - } - return [min, max]; - }; +/***/ }, +/* 125 */ +/***/ function(module, exports, __webpack_require__) { - axisHelper.niceScaleExtent = function (axis, model) { - var scale = axis.scale; - var extent = axisHelper.getScaleExtent(axis, model); - var fixMin = model.getMin() != null; - var fixMax = model.getMax() != null; - var splitNumber = model.get('splitNumber'); + 'use strict'; - if (scale.type === 'log') { - scale.base = model.get('logBase'); - } - scale.setExtent(extent[0], extent[1]); - scale.niceExtent(splitNumber, fixMin, fixMax); + var zrUtil = __webpack_require__(4); + var Cartesian = __webpack_require__(126); - // Use minInterval to constraint the calculated interval. - // If calculated interval is less than minInterval. increase the interval quantity until - // it is larger than minInterval. - // For example: - // minInterval is 1, calculated interval is 0.2, so increase it to be 1. In this way we can get - // an integer axis. - var minInterval = model.get('minInterval'); - if (isFinite(minInterval) && !fixMin && !fixMax && scale.type === 'interval') { - var interval = scale.getInterval(); - var intervalScale = Math.max(Math.abs(interval), minInterval) / interval; - // while (interval < minInterval) { - // var quantity = numberUtil.quantity(interval); - // interval = quantity * 10; - // scaleQuantity *= 10; - // } - extent = scale.getExtent(); - var origin = (extent[1] + extent[0]) / 2; - scale.setExtent( - intervalScale * (extent[0] - origin) + origin, - intervalScale * (extent[1] - origin) + origin - ); - scale.niceExtent(splitNumber); - } + function Cartesian2D(name) { - // If some one specified the min, max. And the default calculated interval - // is not good enough. He can specify the interval. It is often appeared - // in angle axis with angle 0 - 360. Interval calculated in interval scale is hard - // to be 60. - // FIXME - var interval = model.get('interval'); - if (interval != null) { - scale.setInterval && scale.setInterval(interval); - } - }; + Cartesian.call(this, name); + } - /** - * @param {module:echarts/model/Model} model - * @param {string} [axisType] Default retrieve from model.type - * @return {module:echarts/scale/*} - */ - axisHelper.createScaleByModel = function(model, axisType) { - axisType = axisType || model.get('type'); - if (axisType) { - switch (axisType) { - // Buildin scale - case 'category': - return new OrdinalScale( - model.getCategories(), [Infinity, -Infinity] - ); - case 'value': - return new IntervalScale(); - // Extended scale, like time and log - default: - return (Scale.getClass(axisType) || IntervalScale).create(model); - } - } - }; + Cartesian2D.prototype = { - /** - * Check if the axis corss 0 - */ - axisHelper.ifAxisCrossZero = function (axis) { - var dataExtent = axis.scale.getExtent(); - var min = dataExtent[0]; - var max = dataExtent[1]; - return !((min > 0 && max > 0) || (min < 0 && max < 0)); - }; + constructor: Cartesian2D, - /** - * @param {Array.} tickCoords In axis self coordinate. - * @param {Array.} labels - * @param {string} font - * @param {boolean} isAxisHorizontal - * @return {number} - */ - axisHelper.getAxisLabelInterval = function (tickCoords, labels, font, isAxisHorizontal) { - // FIXME - // 不同角的axis和label,不只是horizontal和vertical. + type: 'cartesian2d', - var textSpaceTakenRect; - var autoLabelInterval = 0; - var accumulatedLabelInterval = 0; + /** + * @type {Array.} + * @readOnly + */ + dimensions: ['x', 'y'], - var step = 1; - if (labels.length > 40) { - // Simple optimization for large amount of labels - step = Math.floor(labels.length / 40); - } + /** + * Base axis will be used on stacking. + * + * @return {module:echarts/coord/cartesian/Axis2D} + */ + getBaseAxis: function () { + return this.getAxesByScale('ordinal')[0] + || this.getAxesByScale('time')[0] + || this.getAxis('x'); + }, - for (var i = 0; i < tickCoords.length; i += step) { - var tickCoord = tickCoords[i]; - var rect = textContain.getBoundingRect( - labels[i], font, 'center', 'top' - ); - rect[isAxisHorizontal ? 'x' : 'y'] += tickCoord; - // FIXME Magic number 1.5 - rect[isAxisHorizontal ? 'width' : 'height'] *= 1.3; - if (!textSpaceTakenRect) { - textSpaceTakenRect = rect.clone(); - } - // There is no space for current label; - else if (textSpaceTakenRect.intersect(rect)) { - accumulatedLabelInterval++; - autoLabelInterval = Math.max(autoLabelInterval, accumulatedLabelInterval); - } - else { - textSpaceTakenRect.union(rect); - // Reset - accumulatedLabelInterval = 0; - } - } - if (autoLabelInterval === 0 && step > 1) { - return step; - } - return (autoLabelInterval + 1) * step - 1; - }; + /** + * If contain point + * @param {Array.} point + * @return {boolean} + */ + containPoint: function (point) { + var axisX = this.getAxis('x'); + var axisY = this.getAxis('y'); + return axisX.contain(axisX.toLocalCoord(point[0])) + && axisY.contain(axisY.toLocalCoord(point[1])); + }, - /** - * @param {Object} axis - * @param {Function} labelFormatter - * @return {Array.} - */ - axisHelper.getFormattedLabels = function (axis, labelFormatter) { - var scale = axis.scale; - var labels = scale.getTicksLabels(); - var ticks = scale.getTicks(); - if (typeof labelFormatter === 'string') { - labelFormatter = (function (tpl) { - return function (val) { - return tpl.replace('{value}', val != null ? val : ''); - }; - })(labelFormatter); - // Consider empty array - return zrUtil.map(labels, labelFormatter); - } - else if (typeof labelFormatter === 'function') { - return zrUtil.map(ticks, function (tick, idx) { - return labelFormatter( - axis.type === 'category' ? scale.getLabel(tick) : tick, - idx - ); - }, this); - } - else { - return labels; + /** + * If contain data + * @param {Array.} data + * @return {boolean} + */ + containData: function (data) { + return this.getAxis('x').containData(data[0]) + && this.getAxis('y').containData(data[1]); + }, + + /** + * Convert series data to an array of points + * @param {module:echarts/data/List} data + * @param {boolean} stack + * @return {Array} + * Return array of points. For example: + * `[[10, 10], [20, 20], [30, 30]]` + */ + dataToPoints: function (data, stack) { + return data.mapArray(['x', 'y'], function (x, y) { + return this.dataToPoint([x, y]); + }, stack, this); + }, + + /** + * @param {Array.} data + * @param {boolean} [clamp=false] + * @return {Array.} + */ + dataToPoint: function (data, clamp) { + var xAxis = this.getAxis('x'); + var yAxis = this.getAxis('y'); + return [ + xAxis.toGlobalCoord(xAxis.dataToCoord(data[0], clamp)), + yAxis.toGlobalCoord(yAxis.dataToCoord(data[1], clamp)) + ]; + }, + + /** + * @param {Array.} point + * @param {boolean} [clamp=false] + * @return {Array.} + */ + pointToData: function (point, clamp) { + var xAxis = this.getAxis('x'); + var yAxis = this.getAxis('y'); + return [ + xAxis.coordToData(xAxis.toLocalCoord(point[0]), clamp), + yAxis.coordToData(yAxis.toLocalCoord(point[1]), clamp) + ]; + }, + + /** + * Get other axis + * @param {module:echarts/coord/cartesian/Axis2D} axis + */ + getOtherAxis: function (axis) { + return this.getAxis(axis.dim === 'x' ? 'y' : 'x'); } }; - module.exports = axisHelper; + zrUtil.inherits(Cartesian2D, Cartesian); + + module.exports = Cartesian2D; /***/ }, -/* 116 */ +/* 126 */ /***/ function(module, exports, __webpack_require__) { + 'use strict'; /** - * Linear continuous scale - * @module echarts/coord/scale/Ordinal + * Cartesian coordinate system + * @module echarts/coord/Cartesian * - * http://en.wikipedia.org/wiki/Level_of_measurement */ - // FIXME only one data - var zrUtil = __webpack_require__(4); - var Scale = __webpack_require__(117); - var scaleProto = Scale.prototype; + function dimAxisMapper(dim) { + return this._axes[dim]; + } - var OrdinalScale = Scale.extend({ + /** + * @alias module:echarts/coord/Cartesian + * @constructor + */ + var Cartesian = function (name) { + this._axes = {}; - type: 'ordinal', + this._dimList = []; - init: function (data, extent) { - this._data = data; - this._extent = extent || [0, data.length - 1]; - }, + /** + * @type {string} + */ + this.name = name || ''; + }; - parse: function (val) { - return typeof val === 'string' - ? zrUtil.indexOf(this._data, val) - // val might be float. - : Math.round(val); - }, + Cartesian.prototype = { - contain: function (rank) { - rank = this.parse(rank); - return scaleProto.contain.call(this, rank) - && this._data[rank] != null; - }, + constructor: Cartesian, + + type: 'cartesian', /** - * Normalize given rank or name to linear [0, 1] - * @param {number|string} [val] - * @return {number} + * Get axis + * @param {number|string} dim + * @return {module:echarts/coord/Cartesian~Axis} */ - normalize: function (val) { - return scaleProto.normalize.call(this, this.parse(val)); + getAxis: function (dim) { + return this._axes[dim]; }, - scale: function (val) { - return Math.round(scaleProto.scale.call(this, val)); + /** + * Get axes list + * @return {Array.} + */ + getAxes: function () { + return zrUtil.map(this._dimList, dimAxisMapper, this); }, /** - * @return {Array} + * Get axes list by given scale type */ - getTicks: function () { - var ticks = []; - var extent = this._extent; - var rank = extent[0]; - - while (rank <= extent[1]) { - ticks.push(rank); - rank++; - } - - return ticks; + getAxesByScale: function (scaleType) { + scaleType = scaleType.toLowerCase(); + return zrUtil.filter( + this.getAxes(), + function (axis) { + return axis.scale.type === scaleType; + } + ); }, /** - * Get item on rank n - * @param {number} n - * @return {string} + * Add axis + * @param {module:echarts/coord/Cartesian.Axis} */ - getLabel: function (n) { - return this._data[n]; + addAxis: function (axis) { + var dim = axis.dim; + + this._axes[dim] = axis; + + this._dimList.push(dim); }, /** - * @return {number} + * Convert data to coord in nd space + * @param {Array.|Object.} val + * @return {Array.|Object.} */ - count: function () { - return this._extent[1] - this._extent[0] + 1; + dataToCoord: function (val) { + return this._dataCoordConvert(val, 'dataToCoord'); }, /** - * @override + * Convert coord in nd space to data + * @param {Array.|Object.} val + * @return {Array.|Object.} */ - unionExtentFromData: function (data, dim) { - this.unionExtent(data.getDataExtent(dim, false)); + coordToData: function (val) { + return this._dataCoordConvert(val, 'coordToData'); }, - niceTicks: zrUtil.noop, - niceExtent: zrUtil.noop - }); + _dataCoordConvert: function (input, method) { + var dimList = this._dimList; - /** - * @return {module:echarts/scale/Time} - */ - OrdinalScale.create = function () { - return new OrdinalScale(); + var output = input instanceof Array ? [] : {}; + + for (var i = 0; i < dimList.length; i++) { + var dim = dimList[i]; + var axis = this._axes[dim]; + + output[dim] = axis[method](input[dim]); + } + + return output; + } }; - module.exports = OrdinalScale; + module.exports = Cartesian; /***/ }, -/* 117 */ +/* 127 */ /***/ function(module, exports, __webpack_require__) { - /** - * // Scale class management - * @module echarts/scale/Scale - */ + + var zrUtil = __webpack_require__(4); + var Axis = __webpack_require__(100); + var axisLabelInterval = __webpack_require__(128); - var clazzUtil = __webpack_require__(13); + /** + * Extend axis 2d + * @constructor module:echarts/coord/cartesian/Axis2D + * @extends {module:echarts/coord/cartesian/Axis} + * @param {string} dim + * @param {*} scale + * @param {Array.} coordExtent + * @param {string} axisType + * @param {string} position + */ + var Axis2D = function (dim, scale, coordExtent, axisType, position) { + Axis.call(this, dim, scale, coordExtent); + /** + * Axis type + * - 'category' + * - 'value' + * - 'time' + * - 'log' + * @type {string} + */ + this.type = axisType || 'value'; + + /** + * Axis position + * - 'top' + * - 'bottom' + * - 'left' + * - 'right' + */ + this.position = position || 'bottom'; + }; + + Axis2D.prototype = { + + constructor: Axis2D, + + /** + * Index of axis, can be used as key + */ + index: 0, + /** + * If axis is on the zero position of the other axis + * @type {boolean} + */ + onZero: false, + + /** + * Axis model + * @param {module:echarts/coord/cartesian/AxisModel} + */ + model: null, + + isHorizontal: function () { + var position = this.position; + return position === 'top' || position === 'bottom'; + }, + + /** + * Each item cooresponds to this.getExtent(), which + * means globalExtent[0] may greater than globalExtent[1], + * unless `asc` is input. + * + * @param {boolean} [asc] + * @return {Array.} + */ + getGlobalExtent: function (asc) { + var ret = this.getExtent(); + ret[0] = this.toGlobalCoord(ret[0]); + ret[1] = this.toGlobalCoord(ret[1]); + asc && ret[0] > ret[1] && ret.reverse(); + return ret; + }, + + getOtherAxis: function () { + this.grid.getOtherAxis(); + }, + + /** + * @return {number} + */ + getLabelInterval: function () { + var labelInterval = this._labelInterval; + if (!labelInterval) { + labelInterval = this._labelInterval = axisLabelInterval(this); + } + return labelInterval; + }, + + /** + * If label is ignored. + * Automatically used when axis is category and label can not be all shown + * @param {number} idx + * @return {boolean} + */ + isLabelIgnored: function (idx) { + if (this.type === 'category') { + var labelInterval = this.getLabelInterval(); + return ((typeof labelInterval === 'function') + && !labelInterval(idx, this.scale.getLabel(idx))) + || idx % (labelInterval + 1); + } + }, - function Scale() { /** - * Extent - * @type {Array.} - * @protected + * @override */ - this._extent = [Infinity, -Infinity]; + pointToData: function (point, clamp) { + return this.coordToData(this.toLocalCoord(point[this.dim === 'x' ? 0 : 1]), clamp); + }, /** - * Step is calculated in adjustExtent - * @type {Array.} - * @protected + * Transform global coord to local coord, + * i.e. var localCoord = axis.toLocalCoord(80); + * designate by module:echarts/coord/cartesian/Grid. + * @type {Function} */ - this._interval = 0; - - this.init && this.init.apply(this, arguments); - } + toLocalCoord: null, - var scaleProto = Scale.prototype; + /** + * Transform global coord to local coord, + * i.e. var globalCoord = axis.toLocalCoord(40); + * designate by module:echarts/coord/cartesian/Grid. + * @type {Function} + */ + toGlobalCoord: null - /** - * Parse input val to valid inner number. - * @param {*} val - * @return {number} - */ - scaleProto.parse = function (val) { - // Notice: This would be a trap here, If the implementation - // of this method depends on extent, and this method is used - // before extent set (like in dataZoom), it would be wrong. - // Nevertheless, parse does not depend on extent generally. - return val; }; + zrUtil.inherits(Axis2D, Axis); - scaleProto.contain = function (val) { - var extent = this._extent; - return val >= extent[0] && val <= extent[1]; - }; + module.exports = Axis2D; - /** - * Normalize value to linear [0, 1], return 0.5 if extent span is 0 - * @param {number} val - * @return {number} - */ - scaleProto.normalize = function (val) { - var extent = this._extent; - if (extent[1] === extent[0]) { - return 0.5; - } - return (val - extent[0]) / (extent[1] - extent[0]); - }; - /** - * Scale normalized value - * @param {number} val - * @return {number} - */ - scaleProto.scale = function (val) { - var extent = this._extent; - return val * (extent[1] - extent[0]) + extent[0]; - }; +/***/ }, +/* 128 */ +/***/ function(module, exports, __webpack_require__) { - /** - * Set extent from data - * @param {Array.} other - */ - scaleProto.unionExtent = function (other) { - var extent = this._extent; - other[0] < extent[0] && (extent[0] = other[0]); - other[1] > extent[1] && (extent[1] = other[1]); - // not setExtent because in log axis it may transformed to power - // this.setExtent(extent[0], extent[1]); - }; + 'use strict'; + /** + * Helper function for axisLabelInterval calculation + */ - /** - * Set extent from data - * @param {module:echarts/data/List} data - * @param {string} dim - */ - scaleProto.unionExtentFromData = function (data, dim) { - this.unionExtent(data.getDataExtent(dim, true)); - }; - /** - * Get extent - * @return {Array.} - */ - scaleProto.getExtent = function () { - return this._extent.slice(); - }; - /** - * Set extent - * @param {number} start - * @param {number} end - */ - scaleProto.setExtent = function (start, end) { - var thisExtent = this._extent; - if (!isNaN(start)) { - thisExtent[0] = start; - } - if (!isNaN(end)) { - thisExtent[1] = end; - } - }; + var zrUtil = __webpack_require__(4); + var axisHelper = __webpack_require__(105); - /** - * @return {Array.} - */ - scaleProto.getTicksLabels = function () { - var labels = []; - var ticks = this.getTicks(); - for (var i = 0; i < ticks.length; i++) { - labels.push(this.getLabel(ticks[i])); + module.exports = function (axis) { + var axisModel = axis.model; + var labelModel = axisModel.getModel('axisLabel'); + var labelInterval = labelModel.get('interval'); + if (!(axis.type === 'category' && labelInterval === 'auto')) { + return labelInterval === 'auto' ? 0 : labelInterval; } - return labels; - }; - - clazzUtil.enableClassExtend(Scale); - clazzUtil.enableClassManagement(Scale, { - registerWhenExtend: true - }); - module.exports = Scale; + return axisHelper.getAxisLabelInterval( + zrUtil.map(axis.scale.getTicks(), axis.dataToCoord, axis), + axisModel.getFormattedLabels(), + labelModel.getModel('textStyle').getFont(), + axis.isHorizontal() + ); + }; /***/ }, -/* 118 */ +/* 129 */ /***/ function(module, exports, __webpack_require__) { - /** - * Interval scale - * @module echarts/scale/Interval - */ - - + 'use strict'; + // Grid 是在有直角坐标系的时候必须要存在的 + // 所以这里也要被 Cartesian2D 依赖 - var numberUtil = __webpack_require__(7); - var formatUtil = __webpack_require__(6); - var Scale = __webpack_require__(117); - var mathFloor = Math.floor; - var mathCeil = Math.ceil; + __webpack_require__(130); - var getPrecisionSafe = numberUtil.getPrecisionSafe; - var roundingErrorFix = numberUtil.round; - /** - * @alias module:echarts/coord/scale/Interval - * @constructor - */ - var IntervalScale = Scale.extend({ + var ComponentModel = __webpack_require__(19); - type: 'interval', + module.exports = ComponentModel.extend({ - _interval: 0, + type: 'grid', - setExtent: function (start, end) { - var thisExtent = this._extent; - //start,end may be a Number like '25',so... - if (!isNaN(start)) { - thisExtent[0] = parseFloat(start); - } - if (!isNaN(end)) { - thisExtent[1] = parseFloat(end); - } - }, + dependencies: ['xAxis', 'yAxis'], - unionExtent: function (other) { - var extent = this._extent; - other[0] < extent[0] && (extent[0] = other[0]); - other[1] > extent[1] && (extent[1] = other[1]); + layoutMode: 'box', - // unionExtent may called by it's sub classes - IntervalScale.prototype.setExtent.call(this, extent[0], extent[1]); - }, /** - * Get interval + * @type {module:echarts/coord/cartesian/Grid} */ - getInterval: function () { - if (!this._interval) { - this.niceTicks(); - } - return this._interval; - }, + coordinateSystem: null, - /** - * Set interval - */ - setInterval: function (interval) { - this._interval = interval; - // Dropped auto calculated niceExtent and use user setted extent - // We assume user wan't to set both interval, min, max to get a better result - this._niceExtent = this._extent.slice(); - }, + defaultOption: { + show: false, + zlevel: 0, + z: 0, + left: '10%', + top: 60, + right: '10%', + bottom: 60, + // If grid size contain label + containLabel: false, + // width: {totalWidth} - left - right, + // height: {totalHeight} - top - bottom, + backgroundColor: 'rgba(0,0,0,0)', + borderWidth: 1, + borderColor: '#ccc' + } + }); - /** - * @return {Array.} - */ - getTicks: function () { - if (!this._interval) { - this.niceTicks(); - } - var interval = this._interval; - var extent = this._extent; - var ticks = []; - // Consider this case: using dataZoom toolbox, zoom and zoom. - var safeLimit = 10000; +/***/ }, +/* 130 */ +/***/ function(module, exports, __webpack_require__) { - if (interval) { - var niceExtent = this._niceExtent; - var precision = getPrecisionSafe(interval) + 2; + 'use strict'; + + + var ComponentModel = __webpack_require__(19); + var zrUtil = __webpack_require__(4); + var axisModelCreator = __webpack_require__(131); - if (extent[0] < niceExtent[0]) { - ticks.push(extent[0]); - } - var tick = niceExtent[0]; + var AxisModel = ComponentModel.extend({ - while (tick <= niceExtent[1]) { - ticks.push(tick); - // Avoid rounding error - tick = roundingErrorFix(tick + interval, precision); - if (ticks.length > safeLimit) { - return []; - } - } - // Consider this case: the last item of ticks is smaller - // than niceExtent[1] and niceExtent[1] === extent[1]. - if (extent[1] > (ticks.length ? ticks[ticks.length - 1] : niceExtent[1])) { - ticks.push(extent[1]); - } - } + type: 'cartesian2dAxis', - return ticks; - }, + /** + * @type {module:echarts/coord/cartesian/Axis2D} + */ + axis: null, /** - * @return {Array.} + * @override */ - getTicksLabels: function () { - var labels = []; - var ticks = this.getTicks(); - for (var i = 0; i < ticks.length; i++) { - labels.push(this.getLabel(ticks[i])); - } - return labels; + init: function () { + AxisModel.superApply(this, 'init', arguments); + this.resetRange(); }, /** - * @param {number} n - * @return {number} + * @override */ - getLabel: function (data) { - return formatUtil.addCommas(data); + mergeOption: function () { + AxisModel.superApply(this, 'mergeOption', arguments); + this.resetRange(); }, /** - * Update interval and extent of intervals for nice ticks - * - * @param {number} [splitNumber = 5] Desired number of ticks + * @override */ - niceTicks: function (splitNumber) { - splitNumber = splitNumber || 5; - var extent = this._extent; - var span = extent[1] - extent[0]; - if (!isFinite(span)) { - return; - } - // User may set axis min 0 and data are all negative - // FIXME If it needs to reverse ? - if (span < 0) { - span = -span; - extent.reverse(); - } - - // From "Nice Numbers for Graph Labels" of Graphic Gems - // var niceSpan = numberUtil.nice(span, false); - var step = roundingErrorFix( - numberUtil.nice(span / splitNumber, true), - Math.max( - getPrecisionSafe(extent[0]), - getPrecisionSafe(extent[1]) - // extent may be [0, 1], and step should have 1 more digits. - // To make it safe we add 2 more digits - ) + 2 - ); - - var precision = getPrecisionSafe(step) + 2; - // Niced extent inside original extent - var niceExtent = [ - roundingErrorFix(mathCeil(extent[0] / step) * step, precision), - roundingErrorFix(mathFloor(extent[1] / step) * step, precision) - ]; - - this._interval = step; - this._niceExtent = niceExtent; + restoreData: function () { + AxisModel.superApply(this, 'restoreData', arguments); + this.resetRange(); }, /** - * Nice extent. - * @param {number} [splitNumber = 5] Given approx tick number - * @param {boolean} [fixMin=false] - * @param {boolean} [fixMax=false] + * @override + * @return {module:echarts/model/Component} */ - niceExtent: function (splitNumber, fixMin, fixMax) { - var extent = this._extent; - // If extent start and end are same, expand them - if (extent[0] === extent[1]) { - if (extent[0] !== 0) { - // Expand extent - var expandSize = extent[0]; - // In the fowllowing case - // Axis has been fixed max 100 - // Plus data are all 100 and axis extent are [100, 100]. - // Extend to the both side will cause expanded max is larger than fixed max. - // So only expand to the smaller side. - if (!fixMax) { - extent[1] += expandSize / 2; - extent[0] -= expandSize / 2; - } - else { - extent[0] -= expandSize / 2; - } - } - else { - extent[1] = 1; - } - } - var span = extent[1] - extent[0]; - // If there are no data and extent are [Infinity, -Infinity] - if (!isFinite(span)) { - extent[0] = 0; - extent[1] = 1; - } + getCoordSysModel: function () { + return this.ecModel.queryComponents({ + mainType: 'grid', + index: this.option.gridIndex, + id: this.option.gridId + })[0]; + } - this.niceTicks(splitNumber); + }); - // var extent = this._extent; - var interval = this._interval; + function getAxisType(axisDim, option) { + // Default axis with data is category axis + return option.type || (option.data ? 'category' : 'value'); + } - if (!fixMin) { - extent[0] = roundingErrorFix(mathFloor(extent[0] / interval) * interval); - } - if (!fixMax) { - extent[1] = roundingErrorFix(mathCeil(extent[1] / interval) * interval); - } - } - }); + zrUtil.merge(AxisModel.prototype, __webpack_require__(111)); - /** - * @return {module:echarts/scale/Time} - */ - IntervalScale.create = function () { - return new IntervalScale(); + var extraOption = { + // gridIndex: 0, + // gridId: '', + + // Offset is for multiple axis on the same position + offset: 0 }; - module.exports = IntervalScale; + axisModelCreator('x', AxisModel, getAxisType, extraOption); + axisModelCreator('y', AxisModel, getAxisType, extraOption); + module.exports = AxisModel; /***/ }, -/* 119 */ +/* 131 */ /***/ function(module, exports, __webpack_require__) { - /** - * Interval scale - * @module echarts/coord/scale/Time - */ - - + + var axisDefault = __webpack_require__(132); var zrUtil = __webpack_require__(4); - var numberUtil = __webpack_require__(7); - var formatUtil = __webpack_require__(6); - - var IntervalScale = __webpack_require__(118); - - var intervalScaleProto = IntervalScale.prototype; - - var mathCeil = Math.ceil; - var mathFloor = Math.floor; - var ONE_SECOND = 1000; - var ONE_MINUTE = ONE_SECOND * 60; - var ONE_HOUR = ONE_MINUTE * 60; - var ONE_DAY = ONE_HOUR * 24; + var ComponentModel = __webpack_require__(19); + var layout = __webpack_require__(21); - // FIXME 公用? - var bisect = function (a, x, lo, hi) { - while (lo < hi) { - var mid = lo + hi >>> 1; - if (a[mid][2] < x) { - lo = mid + 1; - } - else { - hi = mid; - } - } - return lo; - }; + // FIXME axisType is fixed ? + var AXIS_TYPES = ['value', 'category', 'time', 'log']; /** - * @alias module:echarts/coord/scale/Time - * @constructor - */ - var TimeScale = IntervalScale.extend({ - type: 'time', - - // Overwrite - getLabel: function (val) { - var stepLvl = this._stepLvl; - - var date = new Date(val); - - return formatUtil.formatTime(stepLvl[0], date); - }, - - // Overwrite - niceExtent: function (approxTickNum, fixMin, fixMax) { - var extent = this._extent; - // If extent start and end are same, expand them - if (extent[0] === extent[1]) { - // Expand extent - extent[0] -= ONE_DAY; - extent[1] += ONE_DAY; - } - // If there are no data and extent are [Infinity, -Infinity] - if (extent[1] === -Infinity && extent[0] === Infinity) { - var d = new Date(); - extent[1] = new Date(d.getFullYear(), d.getMonth(), d.getDate()); - extent[0] = extent[1] - ONE_DAY; - } - - this.niceTicks(approxTickNum); - - // var extent = this._extent; - var interval = this._interval; - - if (!fixMin) { - extent[0] = numberUtil.round(mathFloor(extent[0] / interval) * interval); - } - if (!fixMax) { - extent[1] = numberUtil.round(mathCeil(extent[1] / interval) * interval); - } - }, - - // Overwrite - niceTicks: function (approxTickNum) { - approxTickNum = approxTickNum || 10; - - var extent = this._extent; - var span = extent[1] - extent[0]; - var approxInterval = span / approxTickNum; - var scaleLevelsLen = scaleLevels.length; - var idx = bisect(scaleLevels, approxInterval, 0, scaleLevelsLen); + * Generate sub axis model class + * @param {string} axisName 'x' 'y' 'radius' 'angle' 'parallel' + * @param {module:echarts/model/Component} BaseAxisModelClass + * @param {Function} axisTypeDefaulter + * @param {Object} [extraDefaultOption] + */ + module.exports = function (axisName, BaseAxisModelClass, axisTypeDefaulter, extraDefaultOption) { - var level = scaleLevels[Math.min(idx, scaleLevelsLen - 1)]; - var interval = level[2]; - // Same with interval scale if span is much larger than 1 year - if (level[0] === 'year') { - var yearSpan = span / interval; + zrUtil.each(AXIS_TYPES, function (axisType) { - // From "Nice Numbers for Graph Labels" of Graphic Gems - // var niceYearSpan = numberUtil.nice(yearSpan, false); - var yearStep = numberUtil.nice(yearSpan / approxTickNum, true); + BaseAxisModelClass.extend({ - interval *= yearStep; - } + type: axisName + 'Axis.' + axisType, - var niceExtent = [ - mathCeil(extent[0] / interval) * interval, - mathFloor(extent[1] / interval) * interval - ]; + mergeDefaultAndTheme: function (option, ecModel) { + var layoutMode = this.layoutMode; + var inputPositionParams = layoutMode + ? layout.getLayoutParams(option) : {}; - this._stepLvl = level; - // Interval will be used in getTicks - this._interval = interval; - this._niceExtent = niceExtent; - }, + var themeModel = ecModel.getTheme(); + zrUtil.merge(option, themeModel.get(axisType + 'Axis')); + zrUtil.merge(option, this.getDefaultOption()); - parse: function (val) { - // val might be float. - return +numberUtil.parseDate(val); - } - }); + option.type = axisTypeDefaulter(axisName, option); - zrUtil.each(['contain', 'normalize'], function (methodName) { - TimeScale.prototype[methodName] = function (val) { - return intervalScaleProto[methodName].call(this, this.parse(val)); - }; - }); + if (layoutMode) { + layout.mergeLayoutParam(option, inputPositionParams, layoutMode); + } + }, - // Steps from d3 - var scaleLevels = [ - // Format step interval - ['hh:mm:ss', 1, ONE_SECOND], // 1s - ['hh:mm:ss', 5, ONE_SECOND * 5], // 5s - ['hh:mm:ss', 10, ONE_SECOND * 10], // 10s - ['hh:mm:ss', 15, ONE_SECOND * 15], // 15s - ['hh:mm:ss', 30, ONE_SECOND * 30], // 30s - ['hh:mm\nMM-dd',1, ONE_MINUTE], // 1m - ['hh:mm\nMM-dd',5, ONE_MINUTE * 5], // 5m - ['hh:mm\nMM-dd',10, ONE_MINUTE * 10], // 10m - ['hh:mm\nMM-dd',15, ONE_MINUTE * 15], // 15m - ['hh:mm\nMM-dd',30, ONE_MINUTE * 30], // 30m - ['hh:mm\nMM-dd',1, ONE_HOUR], // 1h - ['hh:mm\nMM-dd',2, ONE_HOUR * 2], // 2h - ['hh:mm\nMM-dd',6, ONE_HOUR * 6], // 6h - ['hh:mm\nMM-dd',12, ONE_HOUR * 12], // 12h - ['MM-dd\nyyyy', 1, ONE_DAY], // 1d - ['week', 7, ONE_DAY * 7], // 7d - ['month', 1, ONE_DAY * 31], // 1M - ['quarter', 3, ONE_DAY * 380 / 4], // 3M - ['half-year', 6, ONE_DAY * 380 / 2], // 6M - ['year', 1, ONE_DAY * 380] // 1Y - ]; + defaultOption: zrUtil.mergeAll( + [ + {}, + axisDefault[axisType + 'Axis'], + extraDefaultOption + ], + true + ) + }); + }); - /** - * @return {module:echarts/scale/Time} - */ - TimeScale.create = function () { - return new TimeScale(); + ComponentModel.registerSubTypeDefaulter( + axisName + 'Axis', + zrUtil.curry(axisTypeDefaulter, axisName) + ); }; - module.exports = TimeScale; - /***/ }, -/* 120 */ +/* 132 */ /***/ function(module, exports, __webpack_require__) { - /** - * Log scale - * @module echarts/scale/Log - */ - + var zrUtil = __webpack_require__(4); - var Scale = __webpack_require__(117); - var numberUtil = __webpack_require__(7); - // Use some method of IntervalScale - var IntervalScale = __webpack_require__(118); + var defaultOption = { + show: true, + zlevel: 0, // 一级层叠 + z: 0, // 二级层叠 + // 反向坐标轴 + inverse: false, - var scaleProto = Scale.prototype; - var intervalScaleProto = IntervalScale.prototype; + // 坐标轴名字,默认为空 + name: '', + // 坐标轴名字位置,支持'start' | 'middle' | 'end' + nameLocation: 'end', + // 坐标轴名字旋转,degree。 + nameRotate: null, // Adapt to axis rotate, when nameLocation is 'middle'. + nameTruncate: { + maxWidth: null, + ellipsis: '...', + placeholder: '.' + }, + // 坐标轴文字样式,默认取全局样式 + nameTextStyle: {}, + // 文字与轴线距离 + nameGap: 15, - var getPrecisionSafe = numberUtil.getPrecisionSafe; - var roundingErrorFix = numberUtil.round; + silent: false, // Default false to support tooltip. + triggerEvent: false, // Default false to avoid legacy user event listener fail. - var mathFloor = Math.floor; - var mathCeil = Math.ceil; - var mathPow = Math.pow; + tooltip: { + show: false + }, - var mathLog = Math.log; + axisPointer: {}, - var LogScale = Scale.extend({ + // 坐标轴线 + axisLine: { + // 默认显示,属性show控制显示与否 + show: true, + onZero: true, + // 属性lineStyle控制线条样式 + lineStyle: { + color: '#333', + width: 1, + type: 'solid' + } + }, + // 坐标轴小标记 + axisTick: { + // 属性show控制显示与否,默认显示 + show: true, + // 控制小标记是否在grid里 + inside: false, + // 属性length控制线长 + length: 5, + // 属性lineStyle控制线条样式 + lineStyle: { + width: 1 + } + }, + // 坐标轴文本标签,详见axis.axisLabel + axisLabel: { + show: true, + // 控制文本标签是否在grid里 + inside: false, + rotate: 0, + margin: 8, + // formatter: null, + // 其余属性默认使用全局文本样式,详见TEXTSTYLE + textStyle: { + fontSize: 12 + } + }, + // 分隔线 + splitLine: { + // 默认显示,属性show控制显示与否 + show: true, + // 属性lineStyle(详见lineStyle)控制线条样式 + lineStyle: { + color: ['#ccc'], + width: 1, + type: 'solid' + } + }, + // 分隔区域 + splitArea: { + // 默认不显示,属性show控制显示与否 + show: false, + // 属性areaStyle(详见areaStyle)控制区域样式 + areaStyle: { + color: ['rgba(250,250,250,0.3)','rgba(200,200,200,0.3)'] + } + } + }; - type: 'log', + var categoryAxis = zrUtil.merge({ + // 类目起始和结束两端空白策略 + boundaryGap: true, + // splitArea: { + // show: false + // }, + splitLine: { + show: false + }, + // 坐标轴小标记 + axisTick: { + // If tick is align with label when boundaryGap is true + alignWithLabel: false, + interval: 'auto' + }, + // 坐标轴文本标签,详见axis.axisLabel + axisLabel: { + interval: 'auto' + } + }, defaultOption); - base: 10, + var valueAxis = zrUtil.merge({ + // 数值起始和结束两端空白策略 + boundaryGap: [0, 0], + // 最小值, 设置成 'dataMin' 则从数据中计算最小值 + // min: null, + // 最大值,设置成 'dataMax' 则从数据中计算最大值 + // max: null, + // Readonly prop, specifies start value of the range when using data zoom. + // rangeStart: null + // Readonly prop, specifies end value of the range when using data zoom. + // rangeEnd: null + // 脱离0值比例,放大聚焦到最终_min,_max区间 + // scale: false, + // 分割段数,默认为5 + splitNumber: 5 + // Minimum interval + // minInterval: null + }, defaultOption); + + // FIXME + var timeAxis = zrUtil.defaults({ + scale: true, + min: 'dataMin', + max: 'dataMax' + }, valueAxis); + var logAxis = zrUtil.defaults({ + logBase: 10 + }, valueAxis); + logAxis.scale = true; + + module.exports = { + categoryAxis: categoryAxis, + valueAxis: valueAxis, + timeAxis: timeAxis, + logAxis: logAxis + }; + + +/***/ }, +/* 133 */ +/***/ function(module, exports, __webpack_require__) { - $constructor: function () { - Scale.apply(this, arguments); - this._originalScale = new IntervalScale(); - }, + 'use strict'; + // TODO boundaryGap - /** - * @return {Array.} - */ - getTicks: function () { - var originalScale = this._originalScale; - var extent = this._extent; - var originalExtent = originalScale.getExtent(); - return zrUtil.map(intervalScaleProto.getTicks.call(this), function (val) { - var powVal = numberUtil.round(mathPow(this.base, val)); + __webpack_require__(130); - // Fix #4158 - powVal = (val === extent[0] && originalScale.__fixMin) - ? fixRoundingError(powVal, originalExtent[0]) - : powVal; - powVal = (val === extent[1] && originalScale.__fixMax) - ? fixRoundingError(powVal, originalExtent[1]) - : powVal; + __webpack_require__(134); - return powVal; - }, this); - }, - /** - * @param {number} val - * @return {string} - */ - getLabel: intervalScaleProto.getLabel, +/***/ }, +/* 134 */ +/***/ function(module, exports, __webpack_require__) { - /** - * @param {number} val - * @return {number} - */ - scale: function (val) { - val = scaleProto.scale.call(this, val); - return mathPow(this.base, val); - }, + - /** - * @param {number} start - * @param {number} end - */ - setExtent: function (start, end) { - var base = this.base; - start = mathLog(start) / mathLog(base); - end = mathLog(end) / mathLog(base); - intervalScaleProto.setExtent.call(this, start, end); - }, + var zrUtil = __webpack_require__(4); + var graphic = __webpack_require__(44); + var AxisBuilder = __webpack_require__(135); + var CartesianAxisPointer = __webpack_require__(136); + var AxisView = __webpack_require__(141); + var cartesianAxisHelper = __webpack_require__(140); + var ifIgnoreOnTick = AxisBuilder.ifIgnoreOnTick; + var getInterval = AxisBuilder.getInterval; - /** - * @return {number} end - */ - getExtent: function () { - var base = this.base; - var extent = scaleProto.getExtent.call(this); - extent[0] = mathPow(base, extent[0]); - extent[1] = mathPow(base, extent[1]); + var axisBuilderAttrs = [ + 'axisLine', 'axisLabel', 'axisTick', 'axisName' + ]; + var selfBuilderAttrs = [ + 'splitArea', 'splitLine' + ]; - // Fix #4158 - var originalScale = this._originalScale; - var originalExtent = originalScale.getExtent(); - originalScale.__fixMin && (extent[0] = fixRoundingError(extent[0], originalExtent[0])); - originalScale.__fixMax && (extent[1] = fixRoundingError(extent[1], originalExtent[1])); + // function getAlignWithLabel(model, axisModel) { + // var alignWithLabel = model.get('alignWithLabel'); + // if (alignWithLabel === 'auto') { + // alignWithLabel = axisModel.get('axisTick.alignWithLabel'); + // } + // return alignWithLabel; + // } - return extent; - }, + var CartesianAxisView = AxisView.extend({ - /** - * @param {Array.} extent - */ - unionExtent: function (extent) { - this._originalScale.unionExtent(extent); + type: 'cartesianAxis', - var base = this.base; - extent[0] = mathLog(extent[0]) / mathLog(base); - extent[1] = mathLog(extent[1]) / mathLog(base); - scaleProto.unionExtent.call(this, extent); - }, + axisPointerClass: CartesianAxisPointer, /** * @override */ - unionExtentFromData: function (data, dim) { - this.unionExtent(data.getDataExtent(dim, true, function (val) { - return val > 0; - })); - }, + render: function (axisModel, ecModel, api, payload) { - /** - * Update interval and extent of intervals for nice ticks - * @param {number} [approxTickNum = 10] Given approx tick number - */ - niceTicks: function (approxTickNum) { - approxTickNum = approxTickNum || 10; - var extent = this._extent; - var span = extent[1] - extent[0]; - if (span === Infinity || span <= 0) { - return; - } + this.group.removeAll(); - var interval = numberUtil.quantity(span); - var err = approxTickNum / span * interval; + var oldAxisGroup = this._axisGroup; + this._axisGroup = new graphic.Group(); - // Filter ticks to get closer to the desired count. - if (err <= 0.5) { - interval *= 10; - } + this.group.add(this._axisGroup); - // Interval should be integer - while (!isNaN(interval) && Math.abs(interval) < 1 && Math.abs(interval) > 0) { - interval *= 10; + if (!axisModel.get('show')) { + return; } - var niceExtent = [ - numberUtil.round(mathCeil(extent[0] / interval) * interval), - numberUtil.round(mathFloor(extent[1] / interval) * interval) - ]; - - this._interval = interval; - this._niceExtent = niceExtent; - }, - - /** - * Nice extent. - * @param {number} [approxTickNum = 10] Given approx tick number - * @param {boolean} [fixMin=false] - * @param {boolean} [fixMax=false] - */ - niceExtent: function (splitNumber, fixMin, fixMax) { - intervalScaleProto.niceExtent.call(this, splitNumber, fixMin, fixMax); + var gridModel = axisModel.getCoordSysModel(); - var originalScale = this._originalScale; - originalScale.__fixMin = fixMin; - originalScale.__fixMax = fixMax; - } + var layout = cartesianAxisHelper.layout(gridModel, axisModel); - }); + var axisBuilder = new AxisBuilder(axisModel, layout); - zrUtil.each(['contain', 'normalize'], function (methodName) { - LogScale.prototype[methodName] = function (val) { - val = mathLog(val) / mathLog(this.base); - return scaleProto[methodName].call(this, val); - }; - }); + zrUtil.each(axisBuilderAttrs, axisBuilder.add, axisBuilder); - LogScale.create = function () { - return new LogScale(); - }; + this._axisGroup.add(axisBuilder.getGroup()); - function fixRoundingError(val, originalVal) { - return roundingErrorFix(val, getPrecisionSafe(originalVal)); - } + zrUtil.each(selfBuilderAttrs, function (name) { + if (axisModel.get(name + '.show')) { + this['_' + name](axisModel, gridModel, layout.labelInterval); + } + }, this); - module.exports = LogScale; + graphic.groupTransition(oldAxisGroup, this._axisGroup, axisModel); + CartesianAxisView.superCall(this, 'render', axisModel, ecModel, api, payload); + }, -/***/ }, -/* 121 */ -/***/ function(module, exports, __webpack_require__) { + /** + * @param {module:echarts/coord/cartesian/AxisModel} axisModel + * @param {module:echarts/coord/cartesian/GridModel} gridModel + * @param {number|Function} labelInterval + * @private + */ + _splitLine: function (axisModel, gridModel, labelInterval) { + var axis = axisModel.axis; - 'use strict'; + if (axis.scale.isBlank()) { + return; + } + var splitLineModel = axisModel.getModel('splitLine'); + var lineStyleModel = splitLineModel.getModel('lineStyle'); + var lineColors = lineStyleModel.get('color'); - var zrUtil = __webpack_require__(4); - var Cartesian = __webpack_require__(122); + var lineInterval = getInterval(splitLineModel, labelInterval); - function Cartesian2D(name) { + lineColors = zrUtil.isArray(lineColors) ? lineColors : [lineColors]; - Cartesian.call(this, name); - } + var gridRect = gridModel.coordinateSystem.getRect(); + var isHorizontal = axis.isHorizontal(); - Cartesian2D.prototype = { + var lineCount = 0; - constructor: Cartesian2D, + var ticksCoords = axis.getTicksCoords( + // splitLineModel.get('alignWithLabel') + ); + var ticks = axis.scale.getTicks(); - type: 'cartesian2d', + var p1 = []; + var p2 = []; + // Simple optimization + // Batching the lines if color are the same + var lineStyle = lineStyleModel.getLineStyle(); + for (var i = 0; i < ticksCoords.length; i++) { + if (ifIgnoreOnTick(axis, i, lineInterval)) { + continue; + } - /** - * @type {Array.} - * @readOnly - */ - dimensions: ['x', 'y'], + var tickCoord = axis.toGlobalCoord(ticksCoords[i]); - /** - * Base axis will be used on stacking. - * - * @return {module:echarts/coord/cartesian/Axis2D} - */ - getBaseAxis: function () { - return this.getAxesByScale('ordinal')[0] - || this.getAxesByScale('time')[0] - || this.getAxis('x'); - }, + if (isHorizontal) { + p1[0] = tickCoord; + p1[1] = gridRect.y; + p2[0] = tickCoord; + p2[1] = gridRect.y + gridRect.height; + } + else { + p1[0] = gridRect.x; + p1[1] = tickCoord; + p2[0] = gridRect.x + gridRect.width; + p2[1] = tickCoord; + } - /** - * If contain point - * @param {Array.} point - * @return {boolean} - */ - containPoint: function (point) { - var axisX = this.getAxis('x'); - var axisY = this.getAxis('y'); - return axisX.contain(axisX.toLocalCoord(point[0])) - && axisY.contain(axisY.toLocalCoord(point[1])); - }, + var colorIndex = (lineCount++) % lineColors.length; + this._axisGroup.add(new graphic.Line(graphic.subPixelOptimizeLine({ + anid: 'line_' + ticks[i], - /** - * If contain data - * @param {Array.} data - * @return {boolean} - */ - containData: function (data) { - return this.getAxis('x').containData(data[0]) - && this.getAxis('y').containData(data[1]); + shape: { + x1: p1[0], + y1: p1[1], + x2: p2[0], + y2: p2[1] + }, + style: zrUtil.defaults({ + stroke: lineColors[colorIndex] + }, lineStyle), + silent: true + }))); + } }, /** - * Convert series data to an array of points - * @param {module:echarts/data/List} data - * @param {boolean} stack - * @return {Array} - * Return array of points. For example: - * `[[10, 10], [20, 20], [30, 30]]` + * @param {module:echarts/coord/cartesian/AxisModel} axisModel + * @param {module:echarts/coord/cartesian/GridModel} gridModel + * @param {number|Function} labelInterval + * @private */ - dataToPoints: function (data, stack) { - return data.mapArray(['x', 'y'], function (x, y) { - return this.dataToPoint([x, y]); - }, stack, this); - }, + _splitArea: function (axisModel, gridModel, labelInterval) { + var axis = axisModel.axis; - /** - * @param {Array.} data - * @param {boolean} [clamp=false] - * @return {Array.} - */ - dataToPoint: function (data, clamp) { - var xAxis = this.getAxis('x'); - var yAxis = this.getAxis('y'); - return [ - xAxis.toGlobalCoord(xAxis.dataToCoord(data[0], clamp)), - yAxis.toGlobalCoord(yAxis.dataToCoord(data[1], clamp)) - ]; - }, + if (axis.scale.isBlank()) { + return; + } - /** - * @param {Array.} point - * @param {boolean} [clamp=false] - * @return {Array.} - */ - pointToData: function (point, clamp) { - var xAxis = this.getAxis('x'); - var yAxis = this.getAxis('y'); - return [ - xAxis.coordToData(xAxis.toLocalCoord(point[0]), clamp), - yAxis.coordToData(yAxis.toLocalCoord(point[1]), clamp) - ]; - }, + var splitAreaModel = axisModel.getModel('splitArea'); + var areaStyleModel = splitAreaModel.getModel('areaStyle'); + var areaColors = areaStyleModel.get('color'); - /** - * Get other axis - * @param {module:echarts/coord/cartesian/Axis2D} axis - */ - getOtherAxis: function (axis) { - return this.getAxis(axis.dim === 'x' ? 'y' : 'x'); - } - }; + var gridRect = gridModel.coordinateSystem.getRect(); - zrUtil.inherits(Cartesian2D, Cartesian); + var ticksCoords = axis.getTicksCoords( + // splitAreaModel.get('alignWithLabel') + ); + var ticks = axis.scale.getTicks(); - module.exports = Cartesian2D; + var prevX = axis.toGlobalCoord(ticksCoords[0]); + var prevY = axis.toGlobalCoord(ticksCoords[0]); + var count = 0; -/***/ }, -/* 122 */ -/***/ function(module, exports, __webpack_require__) { + var areaInterval = getInterval(splitAreaModel, labelInterval); - 'use strict'; - /** - * Cartesian coordinate system - * @module echarts/coord/Cartesian - * - */ + var areaStyle = areaStyleModel.getAreaStyle(); + areaColors = zrUtil.isArray(areaColors) ? areaColors : [areaColors]; + for (var i = 1; i < ticksCoords.length; i++) { + if (ifIgnoreOnTick(axis, i, areaInterval)) { + continue; + } - var zrUtil = __webpack_require__(4); + var tickCoord = axis.toGlobalCoord(ticksCoords[i]); - function dimAxisMapper(dim) { - return this._axes[dim]; - } + var x; + var y; + var width; + var height; + if (axis.isHorizontal()) { + x = prevX; + y = gridRect.y; + width = tickCoord - x; + height = gridRect.height; + } + else { + x = gridRect.x; + y = prevY; + width = gridRect.width; + height = tickCoord - y; + } - /** - * @alias module:echarts/coord/Cartesian - * @constructor - */ - var Cartesian = function (name) { - this._axes = {}; + var colorIndex = (count++) % areaColors.length; + this._axisGroup.add(new graphic.Rect({ + anid: 'area_' + ticks[i], - this._dimList = []; + shape: { + x: x, + y: y, + width: width, + height: height + }, + style: zrUtil.defaults({ + fill: areaColors[colorIndex] + }, areaStyle), + silent: true + })); - /** - * @type {string} - */ - this.name = name || ''; - }; + prevX = x + width; + prevY = y + height; + } + } + }); - Cartesian.prototype = { + CartesianAxisView.extend({ + type: 'xAxis' + }); + CartesianAxisView.extend({ + type: 'yAxis' + }); - constructor: Cartesian, - type: 'cartesian', - /** - * Get axis - * @param {number|string} dim - * @return {module:echarts/coord/Cartesian~Axis} - */ - getAxis: function (dim) { - return this._axes[dim]; - }, +/***/ }, +/* 135 */ +/***/ function(module, exports, __webpack_require__) { - /** - * Get axes list - * @return {Array.} - */ - getAxes: function () { - return zrUtil.map(this._dimList, dimAxisMapper, this); - }, + - /** - * Get axes list by given scale type - */ - getAxesByScale: function (scaleType) { - scaleType = scaleType.toLowerCase(); - return zrUtil.filter( - this.getAxes(), - function (axis) { - return axis.scale.type === scaleType; - } - ); - }, + var zrUtil = __webpack_require__(4); + var formatUtil = __webpack_require__(6); + var graphic = __webpack_require__(44); + var Model = __webpack_require__(12); + var numberUtil = __webpack_require__(7); + var remRadian = numberUtil.remRadian; + var isRadianAroundZero = numberUtil.isRadianAroundZero; + var vec2 = __webpack_require__(10); + var v2ApplyTransform = vec2.applyTransform; + var retrieve = zrUtil.retrieve; - /** - * Add axis - * @param {module:echarts/coord/Cartesian.Axis} - */ - addAxis: function (axis) { - var dim = axis.dim; + var PI = Math.PI; - this._axes[dim] = axis; + function makeAxisEventDataBase(axisModel) { + var eventData = { + componentType: axisModel.mainType + }; + eventData[axisModel.mainType + 'Index'] = axisModel.componentIndex; + return eventData; + } - this._dimList.push(dim); - }, + /** + * A final axis is translated and rotated from a "standard axis". + * So opt.position and opt.rotation is required. + * + * A standard axis is and axis from [0, 0] to [0, axisExtent[1]], + * for example: (0, 0) ------------> (0, 50) + * + * nameDirection or tickDirection or labelDirection is 1 means tick + * or label is below the standard axis, whereas is -1 means above + * the standard axis. labelOffset means offset between label and axis, + * which is useful when 'onZero', where axisLabel is in the grid and + * label in outside grid. + * + * Tips: like always, + * positive rotation represents anticlockwise, and negative rotation + * represents clockwise. + * The direction of position coordinate is the same as the direction + * of screen coordinate. + * + * Do not need to consider axis 'inverse', which is auto processed by + * axis extent. + * + * @param {module:zrender/container/Group} group + * @param {Object} axisModel + * @param {Object} opt Standard axis parameters. + * @param {Array.} opt.position [x, y] + * @param {number} opt.rotation by radian + * @param {number} [opt.nameDirection=1] 1 or -1 Used when nameLocation is 'middle'. + * @param {number} [opt.tickDirection=1] 1 or -1 + * @param {number} [opt.labelDirection=1] 1 or -1 + * @param {number} [opt.labelOffset=0] Usefull when onZero. + * @param {string} [opt.axisLabelShow] default get from axisModel. + * @param {string} [opt.axisName] default get from axisModel. + * @param {number} [opt.axisNameAvailableWidth] + * @param {number} [opt.labelRotate] by degree, default get from axisModel. + * @param {number} [opt.labelInterval] Default label interval when label + * interval from model is null or 'auto'. + * @param {number} [opt.strokeContainThreshold] Default label interval when label + */ + var AxisBuilder = function (axisModel, opt) { /** - * Convert data to coord in nd space - * @param {Array.|Object.} val - * @return {Array.|Object.} + * @readOnly */ - dataToCoord: function (val) { - return this._dataCoordConvert(val, 'dataToCoord'); - }, + this.opt = opt; /** - * Convert coord in nd space to data - * @param {Array.|Object.} val - * @return {Array.|Object.} + * @readOnly */ - coordToData: function (val) { - return this._dataCoordConvert(val, 'coordToData'); - }, + this.axisModel = axisModel; - _dataCoordConvert: function (input, method) { - var dimList = this._dimList; + // Default value + zrUtil.defaults( + opt, + { + labelOffset: 0, + nameDirection: 1, + tickDirection: 1, + labelDirection: 1, + silent: true + } + ); - var output = input instanceof Array ? [] : {}; + /** + * @readOnly + */ + this.group = new graphic.Group(); - for (var i = 0; i < dimList.length; i++) { - var dim = dimList[i]; - var axis = this._axes[dim]; + // FIXME Not use a seperate text group? + var dumbGroup = new graphic.Group({ + position: opt.position.slice(), + rotation: opt.rotation + }); - output[dim] = axis[method](input[dim]); - } + // this.group.add(dumbGroup); + // this._dumbGroup = dumbGroup; - return output; - } - }; + dumbGroup.updateTransform(); + this._transform = dumbGroup.transform; - module.exports = Cartesian; + this._dumbGroup = dumbGroup; + }; + AxisBuilder.prototype = { -/***/ }, -/* 123 */ -/***/ function(module, exports, __webpack_require__) { + constructor: AxisBuilder, - + hasBuilder: function (name) { + return !!builders[name]; + }, - var zrUtil = __webpack_require__(4); - var Axis = __webpack_require__(124); - var axisLabelInterval = __webpack_require__(125); + add: function (name) { + builders[name].call(this); + }, - /** - * Extend axis 2d - * @constructor module:echarts/coord/cartesian/Axis2D - * @extends {module:echarts/coord/cartesian/Axis} - * @param {string} dim - * @param {*} scale - * @param {Array.} coordExtent - * @param {string} axisType - * @param {string} position - */ - var Axis2D = function (dim, scale, coordExtent, axisType, position) { - Axis.call(this, dim, scale, coordExtent); - /** - * Axis type - * - 'category' - * - 'value' - * - 'time' - * - 'log' - * @type {string} - */ - this.type = axisType || 'value'; + getGroup: function () { + return this.group; + } - /** - * Axis position - * - 'top' - * - 'bottom' - * - 'left' - * - 'right' - */ - this.position = position || 'bottom'; }; - Axis2D.prototype = { - - constructor: Axis2D, - - /** - * Index of axis, can be used as key - */ - index: 0, - /** - * If axis is on the zero position of the other axis - * @type {boolean} - */ - onZero: false, + var builders = { /** - * Axis model - * @param {module:echarts/coord/cartesian/AxisModel} + * @private */ - model: null, + axisLine: function () { + var opt = this.opt; + var axisModel = this.axisModel; - isHorizontal: function () { - var position = this.position; - return position === 'top' || position === 'bottom'; - }, + if (!axisModel.get('axisLine.show')) { + return; + } - getGlobalExtent: function () { - var ret = this.getExtent(); - ret[0] = this.toGlobalCoord(ret[0]); - ret[1] = this.toGlobalCoord(ret[1]); - return ret; - }, + var extent = this.axisModel.axis.getExtent(); - /** - * @return {number} - */ - getLabelInterval: function () { - var labelInterval = this._labelInterval; - if (!labelInterval) { - labelInterval = this._labelInterval = axisLabelInterval(this); + var matrix = this._transform; + var pt1 = [extent[0], 0]; + var pt2 = [extent[1], 0]; + if (matrix) { + v2ApplyTransform(pt1, pt1, matrix); + v2ApplyTransform(pt2, pt2, matrix); } - return labelInterval; - }, - /** - * If label is ignored. - * Automatically used when axis is category and label can not be all shown - * @param {number} idx - * @return {boolean} - */ - isLabelIgnored: function (idx) { - if (this.type === 'category') { - var labelInterval = this.getLabelInterval(); - return ((typeof labelInterval === 'function') - && !labelInterval(idx, this.scale.getLabel(idx))) - || idx % (labelInterval + 1); - } + this.group.add(new graphic.Line(graphic.subPixelOptimizeLine({ + + // Id for animation + anid: 'line', + + shape: { + x1: pt1[0], + y1: pt1[1], + x2: pt2[0], + y2: pt2[1] + }, + style: zrUtil.extend( + {lineCap: 'round'}, + axisModel.getModel('axisLine.lineStyle').getLineStyle() + ), + strokeContainThreshold: opt.strokeContainThreshold || 5, + silent: true, + z2: 1 + }))); }, /** - * Transform global coord to local coord, - * i.e. var localCoord = axis.toLocalCoord(80); - * designate by module:echarts/coord/cartesian/Grid. - * @type {Function} + * @private */ - toLocalCoord: null, + axisTick: function () { + var axisModel = this.axisModel; + var axis = axisModel.axis; - /** - * Transform global coord to local coord, - * i.e. var globalCoord = axis.toLocalCoord(40); - * designate by module:echarts/coord/cartesian/Grid. - * @type {Function} - */ - toGlobalCoord: null + if (!axisModel.get('axisTick.show') || axis.scale.isBlank()) { + return; + } - }; - zrUtil.inherits(Axis2D, Axis); + var tickModel = axisModel.getModel('axisTick'); + var opt = this.opt; - module.exports = Axis2D; + var lineStyleModel = tickModel.getModel('lineStyle'); + var tickLen = tickModel.get('length'); + var tickInterval = getInterval(tickModel, opt.labelInterval); + var ticksCoords = axis.getTicksCoords(tickModel.get('alignWithLabel')); + var ticks = axis.scale.getTicks(); -/***/ }, -/* 124 */ -/***/ function(module, exports, __webpack_require__) { + var pt1 = []; + var pt2 = []; + var matrix = this._transform; - + for (var i = 0; i < ticksCoords.length; i++) { + // Only ordinal scale support tick interval + if (ifIgnoreOnTick(axis, i, tickInterval)) { + continue; + } - var numberUtil = __webpack_require__(7); - var linearMap = numberUtil.linearMap; - var zrUtil = __webpack_require__(4); + var tickCoord = ticksCoords[i]; - function fixExtentWithBands(extent, nTick) { - var size = extent[1] - extent[0]; - var len = nTick; - var margin = size / len / 2; - extent[0] += margin; - extent[1] -= margin; - } + pt1[0] = tickCoord; + pt1[1] = 0; + pt2[0] = tickCoord; + pt2[1] = opt.tickDirection * tickLen; - var normalizedExtent = [0, 1]; - /** - * @name module:echarts/coord/CartesianAxis - * @constructor - */ - var Axis = function (dim, scale, extent) { + if (matrix) { + v2ApplyTransform(pt1, pt1, matrix); + v2ApplyTransform(pt2, pt2, matrix); + } + // Tick line, Not use group transform to have better line draw + this.group.add(new graphic.Line(graphic.subPixelOptimizeLine({ - /** - * Axis dimension. Such as 'x', 'y', 'z', 'angle', 'radius' - * @type {string} - */ - this.dim = dim; + // Id for animation + anid: 'tick_' + ticks[i], - /** - * Axis scale - * @type {module:echarts/coord/scale/*} - */ - this.scale = scale; + shape: { + x1: pt1[0], + y1: pt1[1], + x2: pt2[0], + y2: pt2[1] + }, + style: zrUtil.defaults( + lineStyleModel.getLineStyle(), + { + stroke: axisModel.get('axisLine.lineStyle.color') + } + ), + z2: 2, + silent: true + }))); + } + }, /** - * @type {Array.} + * @param {module:echarts/coord/cartesian/AxisModel} axisModel + * @param {module:echarts/coord/cartesian/GridModel} gridModel * @private */ - this._extent = extent || [0, 0]; + axisLabel: function () { + var opt = this.opt; + var axisModel = this.axisModel; + var axis = axisModel.axis; + var show = retrieve(opt.axisLabelShow, axisModel.get('axisLabel.show')); - /** - * @type {boolean} - */ - this.inverse = false; + if (!show || axis.scale.isBlank()) { + return; + } - /** - * Usually true when axis has a ordinal scale - * @type {boolean} - */ - this.onBand = false; - }; + var labelModel = axisModel.getModel('axisLabel'); + var textStyleModel = labelModel.getModel('textStyle'); + var labelMargin = labelModel.get('margin'); + var ticks = axis.scale.getTicks(); + var labels = axisModel.getFormattedLabels(); - Axis.prototype = { + // Special label rotate. + var labelRotation = ( + retrieve(opt.labelRotate, labelModel.get('rotate')) || 0 + ) * PI / 180; - constructor: Axis, + var labelLayout = innerTextLayout(opt.rotation, labelRotation, opt.labelDirection); + var categoryData = axisModel.get('data'); - /** - * If axis extent contain given coord - * @param {number} coord - * @return {boolean} - */ - contain: function (coord) { - var extent = this._extent; - var min = Math.min(extent[0], extent[1]); - var max = Math.max(extent[0], extent[1]); - return coord >= min && coord <= max; - }, + var textEls = []; + var silent = isSilent(axisModel); + var triggerEvent = axisModel.get('triggerEvent'); - /** - * If axis extent contain given data - * @param {number} data - * @return {boolean} - */ - containData: function (data) { - return this.contain(this.dataToCoord(data)); - }, + zrUtil.each(ticks, function (tickVal, index) { + if (ifIgnoreOnTick(axis, index, opt.labelInterval)) { + return; + } - /** - * Get coord extent. - * @return {Array.} - */ - getExtent: function () { - var ret = this._extent.slice(); - return ret; - }, + var itemTextStyleModel = textStyleModel; + if (categoryData && categoryData[tickVal] && categoryData[tickVal].textStyle) { + itemTextStyleModel = new Model( + categoryData[tickVal].textStyle, textStyleModel, axisModel.ecModel + ); + } + var textColor = itemTextStyleModel.getTextColor() + || axisModel.get('axisLine.lineStyle.color'); - /** - * Get precision used for formatting - * @param {Array.} [dataExtent] - * @return {number} - */ - getPixelPrecision: function (dataExtent) { - return numberUtil.getPixelPrecision( - dataExtent || this.scale.getExtent(), - this._extent - ); - }, + var tickCoord = axis.dataToCoord(tickVal); + var pos = [ + tickCoord, + opt.labelOffset + opt.labelDirection * labelMargin + ]; + var labelStr = axis.scale.getLabel(tickVal); - /** - * Set coord extent - * @param {number} start - * @param {number} end - */ - setExtent: function (start, end) { - var extent = this._extent; - extent[0] = start; - extent[1] = end; - }, + var textEl = new graphic.Text({ - /** - * Convert data to coord. Data is the rank if it has a ordinal scale - * @param {number} data - * @param {boolean} clamp - * @return {number} - */ - dataToCoord: function (data, clamp) { - var extent = this._extent; - var scale = this.scale; - data = scale.normalize(data); + // Id for animation + anid: 'label_' + tickVal, - if (this.onBand && scale.type === 'ordinal') { - extent = extent.slice(); - fixExtentWithBands(extent, scale.count()); - } + style: { + text: labels[index], + textAlign: itemTextStyleModel.get('align', true) || labelLayout.textAlign, + textVerticalAlign: itemTextStyleModel.get('baseline', true) || labelLayout.textVerticalAlign, + textFont: itemTextStyleModel.getFont(), + fill: typeof textColor === 'function' + ? textColor( + // (1) In category axis with data zoom, tick is not the original + // index of axis.data. So tick should not be exposed to user + // in category axis. + // (2) Compatible with previous version, which always returns labelStr. + // But in interval scale labelStr is like '223,445', which maked + // user repalce ','. So we modify it to return original val but remain + // it as 'string' to avoid error in replacing. + axis.type === 'category' ? labelStr : axis.type === 'value' ? tickVal + '' : tickVal, + index + ) + : textColor + }, + position: pos, + rotation: labelLayout.rotation, + silent: silent, + z2: 10 + }); - return linearMap(data, normalizedExtent, extent, clamp); - }, + // Pack data for mouse event + if (triggerEvent) { + textEl.eventData = makeAxisEventDataBase(axisModel); + textEl.eventData.targetType = 'axisLabel'; + textEl.eventData.value = labelStr; + } - /** - * Convert coord to data. Data is the rank if it has a ordinal scale - * @param {number} coord - * @param {boolean} clamp - * @return {number} - */ - coordToData: function (coord, clamp) { - var extent = this._extent; - var scale = this.scale; + // FIXME + this._dumbGroup.add(textEl); + textEl.updateTransform(); - if (this.onBand && scale.type === 'ordinal') { - extent = extent.slice(); - fixExtentWithBands(extent, scale.count()); - } + textEls.push(textEl); + this.group.add(textEl); - var t = linearMap(coord, extent, normalizedExtent, clamp); + textEl.decomposeTransform(); - return this.scale.scale(t); - }, - /** - * @return {Array.} - */ - getTicksCoords: function (alignWithLabel) { - if (this.onBand && !alignWithLabel) { - var bands = this.getBands(); - var coords = []; - for (var i = 0; i < bands.length; i++) { - coords.push(bands[i][0]); + }, this); + + function isTwoLabelOverlapped(current, next) { + var firstRect = current && current.getBoundingRect().clone(); + var nextRect = next && next.getBoundingRect().clone(); + if (firstRect && nextRect) { + firstRect.applyTransform(current.getLocalTransform()); + nextRect.applyTransform(next.getLocalTransform()); + return firstRect.intersect(nextRect); } - if (bands[i - 1]) { - coords.push(bands[i - 1][1]); + } + + // If min or max are user set, we need to check + // If the tick on min(max) are overlap on their neighbour tick + // If they are overlapped, we need to hide the min(max) tick label + if (axisModel.getMin() != null) { + var firstLabel = textEls[0]; + var nextLabel = textEls[1]; + if (isTwoLabelOverlapped(firstLabel, nextLabel)) { + firstLabel.ignore = true; } - return coords; } - else { - return zrUtil.map(this.scale.getTicks(), this.dataToCoord, this); + if (axisModel.getMax() != null) { + var lastLabel = textEls[textEls.length - 1]; + var prevLabel = textEls[textEls.length - 2]; + if (isTwoLabelOverlapped(prevLabel, lastLabel)) { + lastLabel.ignore = true; + } } }, /** - * Coords of labels are on the ticks or on the middle of bands - * @return {Array.} + * @private */ - getLabelsCoords: function () { - return zrUtil.map(this.scale.getTicks(), this.dataToCoord, this); - }, + axisName: function () { + var opt = this.opt; + var axisModel = this.axisModel; + var name = retrieve(opt.axisName, axisModel.get('name')); - /** - * Get bands. - * - * If axis has labels [1, 2, 3, 4]. Bands on the axis are - * |---1---|---2---|---3---|---4---|. - * - * @return {Array} - */ - // FIXME Situation when labels is on ticks - getBands: function () { - var extent = this.getExtent(); - var bands = []; - var len = this.scale.count(); - var start = extent[0]; - var end = extent[1]; - var span = end - start; + if (!name) { + return; + } + + var nameLocation = axisModel.get('nameLocation'); + var nameDirection = opt.nameDirection; + var textStyleModel = axisModel.getModel('nameTextStyle'); + var gap = axisModel.get('nameGap') || 0; + + var extent = this.axisModel.axis.getExtent(); + var gapSignal = extent[0] > extent[1] ? -1 : 1; + var pos = [ + nameLocation === 'start' + ? extent[0] - gapSignal * gap + : nameLocation === 'end' + ? extent[1] + gapSignal * gap + : (extent[0] + extent[1]) / 2, // 'middle' + // Reuse labelOffset. + nameLocation === 'middle' ? opt.labelOffset + nameDirection * gap : 0 + ]; - for (var i = 0; i < len; i++) { - bands.push([ - span * i / len + start, - span * (i + 1) / len + start - ]); + var labelLayout; + + var nameRotation = axisModel.get('nameRotate'); + if (nameRotation != null) { + nameRotation = nameRotation * PI / 180; // To radian. } - return bands; - }, - /** - * Get width of band - * @return {number} - */ - getBandWidth: function () { - var axisExtent = this._extent; - var dataExtent = this.scale.getExtent(); + var axisNameAvailableWidth; - var len = dataExtent[1] - dataExtent[0] + (this.onBand ? 1 : 0); - // Fix #2728, avoid NaN when only one data. - len === 0 && (len = 1); + if (nameLocation === 'middle') { + labelLayout = innerTextLayout( + opt.rotation, + nameRotation != null ? nameRotation : opt.rotation, // Adapt to axis. + nameDirection + ); + } + else { + labelLayout = endTextLayout( + opt, nameLocation, nameRotation || 0, extent + ); - var size = Math.abs(axisExtent[1] - axisExtent[0]); + axisNameAvailableWidth = opt.axisNameAvailableWidth; + if (axisNameAvailableWidth != null) { + axisNameAvailableWidth = Math.abs( + axisNameAvailableWidth / Math.sin(labelLayout.rotation) + ); + !isFinite(axisNameAvailableWidth) && (axisNameAvailableWidth = null); + } + } - return Math.abs(size) / len; - }, + var textFont = textStyleModel.getFont(); - /** - * When axis extent depends on data and no data exists, - * axis ticks should not be drawn, which is named 'blank'. - */ - isBlank: function () { - return this._isBlank; - }, + var truncateOpt = axisModel.get('nameTruncate', true) || {}; + var ellipsis = truncateOpt.ellipsis; + var maxWidth = retrieve(truncateOpt.maxWidth, axisNameAvailableWidth); + var truncatedText = (ellipsis != null && maxWidth != null) + ? formatUtil.truncateText( + name, maxWidth, textFont, ellipsis, + {minChar: 2, placeholder: truncateOpt.placeholder} + ) + : name; - /** - * When axis extent depends on data and no data exists, - * axis ticks should not be drawn, which is named 'blank'. - */ - setBlank: function (isBlank) { - this._isBlank = isBlank; - } + var tooltipOpt = axisModel.get('tooltip', true); - }; + var mainType = axisModel.mainType; + var formatterParams = { + componentType: mainType, + name: name, + $vars: ['name'] + }; + formatterParams[mainType + 'Index'] = axisModel.componentIndex; - module.exports = Axis; + var textEl = new graphic.Text({ + // Id for animation + anid: 'name', -/***/ }, -/* 125 */ -/***/ function(module, exports, __webpack_require__) { + __fullText: name, + __truncatedText: truncatedText, - 'use strict'; - /** - * Helper function for axisLabelInterval calculation - */ + style: { + text: truncatedText, + textFont: textFont, + fill: textStyleModel.getTextColor() + || axisModel.get('axisLine.lineStyle.color'), + textAlign: labelLayout.textAlign, + textVerticalAlign: labelLayout.textVerticalAlign + }, + position: pos, + rotation: labelLayout.rotation, + silent: isSilent(axisModel), + z2: 1, + tooltip: (tooltipOpt && tooltipOpt.show) + ? zrUtil.extend({ + content: name, + formatter: function () { + return name; + }, + formatterParams: formatterParams + }, tooltipOpt) + : null + }); + if (axisModel.get('triggerEvent')) { + textEl.eventData = makeAxisEventDataBase(axisModel); + textEl.eventData.targetType = 'axisName'; + textEl.eventData.name = name; + } + // FIXME + this._dumbGroup.add(textEl); + textEl.updateTransform(); - var zrUtil = __webpack_require__(4); - var axisHelper = __webpack_require__(115); + this.group.add(textEl); - module.exports = function (axis) { - var axisModel = axis.model; - var labelModel = axisModel.getModel('axisLabel'); - var labelInterval = labelModel.get('interval'); - if (!(axis.type === 'category' && labelInterval === 'auto')) { - return labelInterval === 'auto' ? 0 : labelInterval; + textEl.decomposeTransform(); } - return axisHelper.getAxisLabelInterval( - zrUtil.map(axis.scale.getTicks(), axis.dataToCoord, axis), - axisModel.getFormattedLabels(), - labelModel.getModel('textStyle').getFont(), - axis.isHorizontal() - ); }; + /** + * @public + * @static + * @param {Object} opt + * @param {number} axisRotation in radian + * @param {number} textRotation in radian + * @param {number} direction + * @return {Object} { + * rotation, // according to axis + * textAlign, + * textVerticalAlign + * } + */ + var innerTextLayout = AxisBuilder.innerTextLayout = function (axisRotation, textRotation, direction) { + var rotationDiff = remRadian(textRotation - axisRotation); + var textAlign; + var textVerticalAlign; -/***/ }, -/* 126 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - // Grid 是在有直角坐标系的时候必须要存在的 - // 所以这里也要被 Cartesian2D 依赖 + if (isRadianAroundZero(rotationDiff)) { // Label is parallel with axis line. + textVerticalAlign = direction > 0 ? 'top' : 'bottom'; + textAlign = 'center'; + } + else if (isRadianAroundZero(rotationDiff - PI)) { // Label is inverse parallel with axis line. + textVerticalAlign = direction > 0 ? 'bottom' : 'top'; + textAlign = 'center'; + } + else { + textVerticalAlign = 'middle'; + if (rotationDiff > 0 && rotationDiff < PI) { + textAlign = direction > 0 ? 'right' : 'left'; + } + else { + textAlign = direction > 0 ? 'left' : 'right'; + } + } - __webpack_require__(127); - var ComponentModel = __webpack_require__(19); + return { + rotation: rotationDiff, + textAlign: textAlign, + textVerticalAlign: textVerticalAlign + }; + }; - module.exports = ComponentModel.extend({ + /** + * @inner + */ + function endTextLayout(opt, textPosition, textRotate, extent) { + var rotationDiff = remRadian(textRotate - opt.rotation); + var textAlign; + var textVerticalAlign; + var inverse = extent[0] > extent[1]; + var onLeft = (textPosition === 'start' && !inverse) + || (textPosition !== 'start' && inverse); - type: 'grid', + if (isRadianAroundZero(rotationDiff - PI / 2)) { + textVerticalAlign = onLeft ? 'bottom' : 'top'; + textAlign = 'center'; + } + else if (isRadianAroundZero(rotationDiff - PI * 1.5)) { + textVerticalAlign = onLeft ? 'top' : 'bottom'; + textAlign = 'center'; + } + else { + textVerticalAlign = 'middle'; + if (rotationDiff < PI * 1.5 && rotationDiff > PI / 2) { + textAlign = onLeft ? 'left' : 'right'; + } + else { + textAlign = onLeft ? 'right' : 'left'; + } + } - dependencies: ['xAxis', 'yAxis'], + return { + rotation: rotationDiff, + textAlign: textAlign, + textVerticalAlign: textVerticalAlign + }; + } - layoutMode: 'box', + /** + * @inner + */ + function isSilent(axisModel) { + var tooltipOpt = axisModel.get('tooltip'); + return axisModel.get('silent') + // Consider mouse cursor, add these restrictions. + || !( + axisModel.get('triggerEvent') || (tooltipOpt && tooltipOpt.show) + ); + } - /** - * @type {module:echarts/coord/cartesian/Grid} - */ - coordinateSystem: null, + /** + * @static + */ + var ifIgnoreOnTick = AxisBuilder.ifIgnoreOnTick = function (axis, i, interval) { + var rawTick; + var scale = axis.scale; + return scale.type === 'ordinal' + && ( + typeof interval === 'function' + ? ( + rawTick = scale.getTicks()[i], + !interval(rawTick, scale.getLabel(rawTick)) + ) + : i % (interval + 1) + ); + }; - defaultOption: { - show: false, - zlevel: 0, - z: 0, - left: '10%', - top: 60, - right: '10%', - bottom: 60, - // If grid size contain label - containLabel: false, - // width: {totalWidth} - left - right, - // height: {totalHeight} - top - bottom, - backgroundColor: 'rgba(0,0,0,0)', - borderWidth: 1, - borderColor: '#ccc' + /** + * @static + */ + var getInterval = AxisBuilder.getInterval = function (model, labelInterval) { + var interval = model.get('interval'); + if (interval == null || interval == 'auto') { + interval = labelInterval; } - }); + return interval; + }; + + module.exports = AxisBuilder; + /***/ }, -/* 127 */ +/* 136 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; - var ComponentModel = __webpack_require__(19); - var zrUtil = __webpack_require__(4); - var axisModelCreator = __webpack_require__(128); - - var AxisModel = ComponentModel.extend({ - - type: 'cartesian2dAxis', + var graphic = __webpack_require__(44); + var BaseAxisPointer = __webpack_require__(137); + var viewHelper = __webpack_require__(139); + var cartesianAxisHelper = __webpack_require__(140); - /** - * @type {module:echarts/coord/cartesian/Axis2D} - */ - axis: null, + var CartesianAxisPointer = BaseAxisPointer.extend({ /** * @override */ - init: function () { - AxisModel.superApply(this, 'init', arguments); - this.resetRange(); - }, + makeElOption: function (elOption, value, axisModel, axisPointerModel, api) { + var axis = axisModel.axis; + var grid = axis.grid; + var axisPointerType = axisPointerModel.get('type'); + var otherExtent = getCartesian(grid, axis).getOtherAxis(axis).getGlobalExtent(); + var pixelValue = axis.toGlobalCoord(axis.dataToCoord(value, true)); - /** - * @override - */ - mergeOption: function () { - AxisModel.superApply(this, 'mergeOption', arguments); - this.resetRange(); + var elStyle = viewHelper.buildElStyle(axisPointerModel); + var pointerOption = pointerShapeBuilder[axisPointerType](axis, pixelValue, otherExtent, elStyle); + pointerOption.style = elStyle; + + elOption.graphicKey = pointerOption.type; + elOption.pointer = pointerOption; + + var layoutInfo = cartesianAxisHelper.layout(grid.model, axisModel); + viewHelper.buildCartesianSingleLabelElOption( + value, elOption, layoutInfo, axisModel, axisPointerModel, api + ); }, /** * @override */ - restoreData: function () { - AxisModel.superApply(this, 'restoreData', arguments); - this.resetRange(); + getHandleTransform: function (value, axisModel, axisPointerModel) { + var layoutInfo = cartesianAxisHelper.layout(axisModel.axis.grid.model, axisModel, { + labelInside: false + }); + layoutInfo.labelMargin = axisPointerModel.get('handle.margin'); + return { + position: viewHelper.getTransformedPosition(axisModel.axis, value, layoutInfo), + rotation: layoutInfo.rotation + (layoutInfo.labelDirection < 0 ? Math.PI : 0) + }; }, /** * @override - * @return {module:echarts/model/Component} */ - getCoordSysModel: function () { - return this.ecModel.queryComponents({ - mainType: 'grid', - index: this.option.gridIndex, - id: this.option.gridId - })[0]; + updateHandleTransform: function (transform, delta, axisModel, axisPointerModel) { + var axis = axisModel.axis; + var grid = axis.grid; + var axisExtent = axis.getGlobalExtent(true); + var otherExtent = getCartesian(grid, axis).getOtherAxis(axis).getGlobalExtent(); + var dimIndex = axis.dim === 'x' ? 0 : 1; + + var currPosition = transform.position; + currPosition[dimIndex] += delta[dimIndex]; + currPosition[dimIndex] = Math.min(axisExtent[1], currPosition[dimIndex]); + currPosition[dimIndex] = Math.max(axisExtent[0], currPosition[dimIndex]); + + var cursorOtherValue = (otherExtent[1] + otherExtent[0]) / 2; + var cursorPoint = [cursorOtherValue, cursorOtherValue]; + cursorPoint[dimIndex] = currPosition[dimIndex]; + + // Make tooltip do not overlap axisPointer and in the middle of the grid. + var tooltipOptions = [{verticalAlign: 'middle'}, {align: 'center'}]; + + return { + position: currPosition, + rotation: transform.rotation, + cursorPoint: cursorPoint, + tooltipOption: tooltipOptions[dimIndex] + }; } }); - function getAxisType(axisDim, option) { - // Default axis with data is category axis - return option.type || (option.data ? 'category' : 'value'); + function getCartesian(grid, axis) { + var opt = {}; + opt[axis.dim + 'AxisIndex'] = axis.index; + return grid.getCartesian(opt); } - zrUtil.merge(AxisModel.prototype, __webpack_require__(130)); + var pointerShapeBuilder = { - var extraOption = { - // gridIndex: 0, - // gridId: '', + line: function (axis, pixelValue, otherExtent, elStyle) { + var targetShape = viewHelper.makeLineShape( + [pixelValue, otherExtent[0]], + [pixelValue, otherExtent[1]], + getAxisDimIndex(axis) + ); + graphic.subPixelOptimizeLine({ + shape: targetShape, + style: elStyle + }); + return { + type: 'Line', + shape: targetShape + }; + }, - // Offset is for multiple axis on the same position - offset: 0 + shadow: function (axis, pixelValue, otherExtent, elStyle) { + var bandWidth = axis.getBandWidth(); + var span = otherExtent[1] - otherExtent[0]; + return { + type: 'Rect', + shape: viewHelper.makeRectShape( + [pixelValue - bandWidth / 2, otherExtent[0]], + [bandWidth, span], + getAxisDimIndex(axis) + ) + }; + } }; - axisModelCreator('x', AxisModel, getAxisType, extraOption); - axisModelCreator('y', AxisModel, getAxisType, extraOption); + function getAxisDimIndex(axis) { + return axis.dim === 'x' ? 0 : 1; + } - module.exports = AxisModel; + module.exports = CartesianAxisPointer; /***/ }, -/* 128 */ +/* 137 */ /***/ function(module, exports, __webpack_require__) { - + 'use strict'; + - var axisDefault = __webpack_require__(129); var zrUtil = __webpack_require__(4); - var ComponentModel = __webpack_require__(19); - var layout = __webpack_require__(21); + var clazzUtil = __webpack_require__(13); + var graphic = __webpack_require__(44); + var get = __webpack_require__(5).makeGetter(); + var axisPointerModelHelper = __webpack_require__(138); + var eventTool = __webpack_require__(88); + var throttle = __webpack_require__(81); - // FIXME axisType is fixed ? - var AXIS_TYPES = ['value', 'category', 'time', 'log']; + var clone = zrUtil.clone; + var bind = zrUtil.bind; /** - * Generate sub axis model class - * @param {string} axisName 'x' 'y' 'radius' 'angle' 'parallel' - * @param {module:echarts/model/Component} BaseAxisModelClass - * @param {Function} axisTypeDefaulter - * @param {Object} [extraDefaultOption] + * Base axis pointer class in 2D. + * Implemenents {module:echarts/component/axis/IAxisPointer}. */ - module.exports = function (axisName, BaseAxisModelClass, axisTypeDefaulter, extraDefaultOption) { + function BaseAxisPointer () { + } - zrUtil.each(AXIS_TYPES, function (axisType) { + BaseAxisPointer.prototype = { - BaseAxisModelClass.extend({ + /** + * @private + */ + _group: null, - type: axisName + 'Axis.' + axisType, + /** + * @private + */ + _lastGraphicKey: null, - mergeDefaultAndTheme: function (option, ecModel) { - var layoutMode = this.layoutMode; - var inputPositionParams = layoutMode - ? layout.getLayoutParams(option) : {}; + /** + * @private + */ + _handle: null, - var themeModel = ecModel.getTheme(); - zrUtil.merge(option, themeModel.get(axisType + 'Axis')); - zrUtil.merge(option, this.getDefaultOption()); + /** + * @private + */ + _dragging: false, - option.type = axisTypeDefaulter(axisName, option); + /** + * @private + */ + _lastValue: null, - if (layoutMode) { - layout.mergeLayoutParam(option, inputPositionParams, layoutMode); - } - }, + /** + * @private + */ + _lastStatus: null, - defaultOption: zrUtil.mergeAll( - [ - {}, - axisDefault[axisType + 'Axis'], - extraDefaultOption - ], - true - ) - }); - }); + /** + * @private + */ + _payloadInfo: null, - ComponentModel.registerSubTypeDefaulter( - axisName + 'Axis', - zrUtil.curry(axisTypeDefaulter, axisName) - ); - }; + /** + * In px, arbitrary value. Do not set too small, + * no animation is ok for most cases. + * @protected + */ + animationThreshold: 15, + /** + * @implement + */ + render: function (axisModel, axisPointerModel, api, forceRender) { + var value = axisPointerModel.get('value'); + var status = axisPointerModel.get('status'); + + // Bind them to `this`, not in closure, otherwise they will not + // be replaced when user calling setOption in not merge mode. + this._axisModel = axisModel; + this._axisPointerModel = axisPointerModel; + this._api = api; + + // Optimize: `render` will be called repeatly during mouse move. + // So it is power consuming if performing `render` each time, + // especially on mobile device. + if (!forceRender + && this._lastValue === value + && this._lastStatus === status + ) { + return; + } + this._lastValue = value; + this._lastStatus = status; -/***/ }, -/* 129 */ -/***/ function(module, exports, __webpack_require__) { + var group = this._group; + var handle = this._handle; - + if (!status || status === 'hide') { + // Do not clear here, for animation better. + group && group.hide(); + handle && handle.hide(); + return; + } + group && group.show(); + handle && handle.show(); - var zrUtil = __webpack_require__(4); + // Otherwise status is 'show' + var elOption = {}; + this.makeElOption(elOption, value, axisModel, axisPointerModel, api); - var defaultOption = { - show: true, - zlevel: 0, // 一级层叠 - z: 0, // 二级层叠 - // 反向坐标轴 - inverse: false, + // Enable change axis pointer type. + var graphicKey = elOption.graphicKey; + if (graphicKey !== this._lastGraphicKey) { + this.clear(api); + } + this._lastGraphicKey = graphicKey; - // 坐标轴名字,默认为空 - name: '', - // 坐标轴名字位置,支持'start' | 'middle' | 'end' - nameLocation: 'end', - // 坐标轴名字旋转,degree。 - nameRotate: null, // Adapt to axis rotate, when nameLocation is 'middle'. - nameTruncate: { - maxWidth: null, - ellipsis: '...', - placeholder: '.' + var moveAnimation = this._moveAnimation = + this.determineAnimation(axisModel, axisPointerModel); + + if (!group) { + group = this._group = new graphic.Group(); + this.createPointerEl(group, elOption, axisModel, axisPointerModel); + this.createLabelEl(group, elOption, axisModel, axisPointerModel); + api.getZr().add(group); + } + else { + var doUpdateProps = zrUtil.curry(updateProps, axisPointerModel, moveAnimation); + this.updatePointerEl(group, elOption, doUpdateProps, axisPointerModel); + this.updateLabelEl(group, elOption, doUpdateProps, axisPointerModel); + } + + updateMandatoryProps(group, axisPointerModel, true); + + this._renderHandle(value); }, - // 坐标轴文字样式,默认取全局样式 - nameTextStyle: {}, - // 文字与轴线距离 - nameGap: 15, - silent: false, // Default false to support tooltip. - triggerEvent: false, // Default false to avoid legacy user event listener fail. + /** + * @implement + */ + remove: function (api) { + this.clear(api); + }, - tooltip: { - show: false + /** + * @implement + */ + dispose: function (api) { + this.clear(api); }, - // 坐标轴线 - axisLine: { - // 默认显示,属性show控制显示与否 - show: true, - onZero: true, - // 属性lineStyle控制线条样式 - lineStyle: { - color: '#333', - width: 1, - type: 'solid' + /** + * @protected + */ + determineAnimation: function (axisModel, axisPointerModel) { + var animation = axisPointerModel.get('animation'); + var axis = axisModel.axis; + var isCategoryAxis = axis.type === 'category'; + var useSnap = axisPointerModel.get('snap'); + + // Value axis without snap always do not snap. + if (!useSnap && !isCategoryAxis) { + return false; } - }, - // 坐标轴小标记 - axisTick: { - // 属性show控制显示与否,默认显示 - show: true, - // 控制小标记是否在grid里 - inside: false, - // 属性length控制线长 - length: 5, - // 属性lineStyle控制线条样式 - lineStyle: { - width: 1 + + if (animation === 'auto' || animation == null) { + var animationThreshold = this.animationThreshold; + if (isCategoryAxis && axis.getBandWidth() > animationThreshold) { + return true; + } + + // It is important to auto animation when snap used. Consider if there is + // a dataZoom, animation will be disabled when too many points exist, while + // it will be enabled for better visual effect when little points exist. + if (useSnap) { + var seriesDataCount = axisPointerModelHelper.getAxisInfo(axisModel).seriesDataCount; + var axisExtent = axis.getExtent(); + // Approximate band width + return Math.abs(axisExtent[0] - axisExtent[1]) / seriesDataCount > animationThreshold; + } + + return false; } + + return animation === true; }, - // 坐标轴文本标签,详见axis.axisLabel - axisLabel: { - show: true, - // 控制文本标签是否在grid里 - inside: false, - rotate: 0, - margin: 8, - // formatter: null, - // 其余属性默认使用全局文本样式,详见TEXTSTYLE - textStyle: { - fontSize: 12 - } + + /** + * add {pointer, label, graphicKey} to elOption + * @protected + */ + makeElOption: function (elOption, value, axisModel, axisPointerModel, api) { + // Shoule be implemenented by sub-class. }, - // 分隔线 - splitLine: { - // 默认显示,属性show控制显示与否 - show: true, - // 属性lineStyle(详见lineStyle)控制线条样式 - lineStyle: { - color: ['#ccc'], - width: 1, - type: 'solid' - } + + /** + * @protected + */ + createPointerEl: function (group, elOption, axisModel, axisPointerModel) { + var pointerOption = elOption.pointer; + var pointerEl = get(group).pointerEl = new graphic[pointerOption.type]( + clone(elOption.pointer) + ); + group.add(pointerEl); }, - // 分隔区域 - splitArea: { - // 默认不显示,属性show控制显示与否 - show: false, - // 属性areaStyle(详见areaStyle)控制区域样式 - areaStyle: { - color: ['rgba(250,250,250,0.3)','rgba(200,200,200,0.3)'] - } - } - }; - var categoryAxis = zrUtil.merge({ - // 类目起始和结束两端空白策略 - boundaryGap: true, - // splitArea: { - // show: false - // }, - splitLine: { - show: false + /** + * @protected + */ + createLabelEl: function (group, elOption, axisModel, axisPointerModel) { + var labelEl = get(group).labelEl = new graphic.Rect( + clone(elOption.label) + ); + + group.add(labelEl); + updateLabelShowHide(labelEl, axisPointerModel); }, - // 坐标轴小标记 - axisTick: { - // If tick is align with label when boundaryGap is true - // Default with axisTick - alignWithLabel: false, - interval: 'auto' + + /** + * @protected + */ + updatePointerEl: function (group, elOption, updateProps) { + var pointerEl = get(group).pointerEl; + if (pointerEl) { + pointerEl.setStyle(elOption.pointer.style); + updateProps(pointerEl, {shape: elOption.pointer.shape}); + } }, - // 坐标轴文本标签,详见axis.axisLabel - axisLabel: { - interval: 'auto' - } - }, defaultOption); - var valueAxis = zrUtil.merge({ - // 数值起始和结束两端空白策略 - boundaryGap: [0, 0], - // 最小值, 设置成 'dataMin' 则从数据中计算最小值 - // min: null, - // 最大值,设置成 'dataMax' 则从数据中计算最大值 - // max: null, - // Readonly prop, specifies start value of the range when using data zoom. - // rangeStart: null - // Readonly prop, specifies end value of the range when using data zoom. - // rangeEnd: null - // 脱离0值比例,放大聚焦到最终_min,_max区间 - // scale: false, - // 分割段数,默认为5 - splitNumber: 5 - // Minimum interval - // minInterval: null - }, defaultOption); + /** + * @protected + */ + updateLabelEl: function (group, elOption, updateProps, axisPointerModel) { + var labelEl = get(group).labelEl; + if (labelEl) { + labelEl.setStyle(elOption.label.style); + updateProps(labelEl, { + // Consider text length change in vertical axis, animation should + // be used on shape, otherwise the effect will be weird. + shape: elOption.label.shape, + position: elOption.label.position + }); - // FIXME - var timeAxis = zrUtil.defaults({ - scale: true, - min: 'dataMin', - max: 'dataMax' - }, valueAxis); - var logAxis = zrUtil.defaults({ - logBase: 10 - }, valueAxis); - logAxis.scale = true; + updateLabelShowHide(labelEl, axisPointerModel); + } + }, - module.exports = { - categoryAxis: categoryAxis, - valueAxis: valueAxis, - timeAxis: timeAxis, - logAxis: logAxis - }; + /** + * @private + */ + _renderHandle: function (value) { + if (this._dragging || !this.updateHandleTransform) { + return; + } + var axisPointerModel = this._axisPointerModel; + var zr = this._api.getZr(); + var handle = this._handle; + var handleModel = axisPointerModel.getModel('handle'); -/***/ }, -/* 130 */ -/***/ function(module, exports, __webpack_require__) { + var status = axisPointerModel.get('status'); + if (!handleModel.get('show') || !status || status === 'hide') { + handle && zr.remove(handle); + this._handle = null; + return; + } - + var isInit; + if (!this._handle) { + isInit = true; + handle = this._handle = createIcon(handleModel, { + onmousemove: function (e) { + // Fot mobile devicem, prevent screen slider on the button. + eventTool.stop(e.event); + }, + onmousedown: bind(this._onHandleDragMove, this, 0, 0), + drift: bind(this._onHandleDragMove, this), + ondragend: bind(this._onHandleDragEnd, this) + }); + zr.add(handle); + } - var zrUtil = __webpack_require__(4); - var axisHelper = __webpack_require__(115); + updateMandatoryProps(handle, axisPointerModel, false); - function getName(obj) { - if (zrUtil.isObject(obj) && obj.value != null) { - return obj.value; - } - else { - return obj; - } - } + // update style + var includeStyles = [ + 'color', 'borderColor', 'borderWidth', 'opacity', + 'shadowColor', 'shadowBlur', 'shadowOffsetX', 'shadowOffsetY' + ]; + handle.setStyle(handleModel.getItemStyle(null, includeStyles)); - module.exports = { + // update position + var handleSize = handleModel.get('size'); + if (!zrUtil.isArray(handleSize)) { + handleSize = [handleSize, handleSize]; + } + handle.attr('scale', [handleSize[0] / 2, handleSize[1] / 2]); + + throttle.createOrUpdate( + this, + '_doDispatchAxisPointer', + handleModel.get('throttle') || 0, + 'fixRate' + ); + + this._moveHandleToValue(value, isInit); + }, /** - * Format labels - * @return {Array.} + * @private */ - getFormattedLabels: function () { - return axisHelper.getFormattedLabels( - this.axis, - this.get('axisLabel.formatter') + _moveHandleToValue: function (value, isInit) { + updateProps( + this._axisPointerModel, + !isInit && this._moveAnimation, + this._handle, + getHandleTransProps(this.getHandleTransform( + value, this._axisModel, this._axisPointerModel + )) ); }, /** - * Get categories + * @private */ - getCategories: function () { - return this.get('type') === 'category' - && zrUtil.map(this.get('data'), getName); + _onHandleDragMove: function (dx, dy) { + var handle = this._handle; + if (!handle) { + return; + } + + this._dragging = true; + + // Persistent for throttle. + var trans = this.updateHandleTransform( + getHandleTransProps(handle), + [dx, dy], + this._axisModel, + this._axisPointerModel + ); + this._payloadInfo = trans; + + handle.stopAnimation(); + handle.attr(getHandleTransProps(trans)); + get(handle).lastProp = null; + + this._doDispatchAxisPointer(); }, /** - * @param {boolean} origin - * @return {number|string} min value or 'dataMin' or null/undefined (means auto) or NaN + * Throttled method. + * @private */ - getMin: function (origin) { - var option = this.option; - var min = (!origin && option.rangeStart != null) - ? option.rangeStart : option.min; - - if (min != null && min !== 'dataMin' && !zrUtil.eqNaN(min)) { - min = this.axis.scale.parse(min); + _doDispatchAxisPointer: function () { + var handle = this._handle; + if (!handle) { + return; } - return min; + + var payloadInfo = this._payloadInfo; + var payload = { + type: 'updateAxisPointer', + x: payloadInfo.cursorPoint[0], + y: payloadInfo.cursorPoint[1], + tooltipOption: payloadInfo.tooltipOption, + highDownKey: 'axisPointerHandle' + }; + var axis = this._axisModel.axis; + payload[axis.dim + 'AxisId'] = this._axisModel.id; + this._api.dispatchAction(payload); }, /** - * @param {boolean} origin - * @return {number|string} max value or 'dataMax' or null/undefined (means auto) or NaN + * @private */ - getMax: function (origin) { - var option = this.option; - var max = (!origin && option.rangeEnd != null) - ? option.rangeEnd : option.max; - - if (max != null && max !== 'dataMax' && !zrUtil.eqNaN(max)) { - max = this.axis.scale.parse(max); + _onHandleDragEnd: function (moveAnimation) { + this._dragging = false; + var handle = this._handle; + if (!handle) { + return; } - return max; + + var value = this._axisPointerModel.get('value'); + // Consider snap or categroy axis, handle may be not consistent with + // axisPointer. So move handle to align the exact value position when + // drag ended. + this._moveHandleToValue(value); + + // For the effect: tooltip will be shown when finger holding on handle + // button, and will be hidden after finger left handle button. + this._api.dispatchAction({ + type: 'hideTip' + }); }, /** - * @return {boolean} + * Should be implemenented by sub-class if support `handle`. + * @protected + * @param {number} value + * @param {module:echarts/model/Model} axisModel + * @param {module:echarts/model/Model} axisPointerModel + * @return {Object} {position: [x, y], rotation: 0} */ - getNeedCrossZero: function () { - var option = this.option; - return (option.rangeStart != null || option.rangeEnd != null) - ? false : !option.scale; - }, + getHandleTransform: null, /** - * Should be implemented by each axis model if necessary. - * @return {module:echarts/model/Component} coordinate system model + * * Should be implemenented by sub-class if support `handle`. + * @protected + * @param {Object} transform {position, rotation} + * @param {Array.} delta [dx, dy] + * @param {module:echarts/model/Model} axisModel + * @param {module:echarts/model/Model} axisPointerModel + * @return {Object} {position: [x, y], rotation: 0, cursorPoint: [x, y]} */ - getCoordSysModel: zrUtil.noop, + updateHandleTransform: null, /** - * @param {number} rangeStart Can only be finite number or null/undefined or NaN. - * @param {number} rangeEnd Can only be finite number or null/undefined or NaN. + * @private */ - setRange: function (rangeStart, rangeEnd) { - this.option.rangeStart = rangeStart; - this.option.rangeEnd = rangeEnd; + clear: function (api) { + this._lastValue = null; + this._lastStatus = null; + + var zr = api.getZr(); + var group = this._group; + var handle = this._handle; + if (zr && group) { + this._lastGraphicKey = null; + group && zr.remove(group); + handle && zr.remove(handle); + this._group = null; + this._handle = null; + this._payloadInfo = null; + } }, /** - * Reset range + * @protected */ - resetRange: function () { - // rangeStart and rangeEnd is readonly. - this.option.rangeStart = this.option.rangeEnd = null; + doClear: function () { + // Implemented by sub-class if necessary. + }, + + /** + * @protected + * @param {Array.} xy + * @param {Array.} wh + * @param {number} [xDimIndex=0] or 1 + */ + buildLabel: function (xy, wh, xDimIndex) { + xDimIndex = xDimIndex || 0; + return { + x: xy[xDimIndex], + y: xy[1 - xDimIndex], + width: wh[xDimIndex], + height: wh[1 - xDimIndex] + }; + } + }; + + BaseAxisPointer.prototype.constructor = BaseAxisPointer; + + + function updateProps(animationModel, moveAnimation, el, props) { + // Animation optimize. + if (!propsEqual(get(el).lastProp, props)) { + get(el).lastProp = props; + moveAnimation + ? graphic.updateProps(el, props, animationModel) + : (el.stopAnimation(), el.attr(props)); + } + } + + function propsEqual(lastProps, newProps) { + if (zrUtil.isObject(lastProps) && zrUtil.isObject(newProps)) { + var equals = true; + zrUtil.each(newProps, function (item, key) { + equals &= propsEqual(lastProps[key], item); + }); + return !!equals; + } + else { + return lastProps === newProps; } + } + + function updateLabelShowHide(labelEl, axisPointerModel) { + labelEl[axisPointerModel.get('label.show') ? 'show' : 'hide'](); + } + + function getHandleTransProps(trans) { + return { + position: trans.position.slice(), + rotation: trans.rotation || 0 + }; + } + + function createIcon(handleModel, handlers) { + var iconStr = handleModel.get('icon'); + var style = { + x: -1, y: -1, width: 2, height: 2 + }; + var opt = zrUtil.extend({ + style: { + strokeNoScale: true + }, + rectHover: true, + cursor: 'move', + draggable: true + }, handlers); + + return iconStr.indexOf('image://') === 0 + ? ( + style.image = iconStr.slice(8), + opt.style = style, + new graphic.Image(opt) + ) + : graphic.makePath( + iconStr.replace('path://', ''), + opt, + style, + 'center' + ); + } + + function updateMandatoryProps(group, axisPointerModel, silent) { + var z = axisPointerModel.get('z'); + var zlevel = axisPointerModel.get('zlevel'); + + group && group.traverse(function (el) { + if (el.type !== 'group') { + z != null && (el.z = z); + zlevel != null && (el.zlevel = zlevel); + el.silent = silent; + } + }); + } + + clazzUtil.enableClassExtend(BaseAxisPointer); + + module.exports = BaseAxisPointer; + + +/***/ }, +/* 138 */ +/***/ function(module, exports, __webpack_require__) { + + + + var zrUtil = __webpack_require__(4); + var Model = __webpack_require__(12); + var each = zrUtil.each; + var curry = zrUtil.curry; + + var helper = {}; + + // Build axisPointerModel, mergin tooltip.axisPointer model for each axis. + // allAxesInfo should be updated when setOption performed. + helper.collect = function (ecModel, api) { + var result = { + /** + * key: makeKey(axis.model) + * value: { + * axis, + * coordSys, + * axisPointerModel, + * triggerTooltip, + * involveSeries, + * snap, + * seriesModels, + * seriesDataCount + * } + */ + axesInfo: {}, + seriesInvolved: false, + /** + * key: makeKey(coordSys.model) + * value: Object: key makeKey(axis.model), value: axisInfo + */ + coordSysAxesInfo: {}, + coordSysMap: {} + }; + + collectAxesInfo(result, ecModel, api); + + // Check seriesInvolved for performance, in case too many series in some chart. + result.seriesInvolved && collectSeriesInfo(result, ecModel); + + return result; }; + function collectAxesInfo(result, ecModel, api) { + var globalTooltipModel = ecModel.getComponent('tooltip'); + var globalAxisPointerModel = ecModel.getComponent('axisPointer'); + // links can only be set on global. + var linksOption = globalAxisPointerModel.get('link', true) || []; + var linkGroups = []; + + // Collect axes info. + each(api.getCoordinateSystems(), function (coordSys) { + // Some coordinate system do not support axes, like geo. + if (!coordSys.axisPointerEnabled) { + return; + } + + var coordSysKey = makeKey(coordSys.model); + var axesInfoInCoordSys = result.coordSysAxesInfo[coordSysKey] = {}; + result.coordSysMap[coordSysKey] = coordSys; + + // Set tooltip (like 'cross') is a convienent way to show axisPointer + // for user. So we enable seting tooltip on coordSys model. + var coordSysModel = coordSys.model; + var baseTooltipModel = coordSysModel.getModel('tooltip', globalTooltipModel); + + each(coordSys.getAxes(), curry(saveTooltipAxisInfo, false, null)); + + // If axis tooltip used, choose tooltip axis for each coordSys. + // Notice this case: coordSys is `grid` but not `cartesian2D` here. + if (coordSys.getTooltipAxes + && globalTooltipModel + // If tooltip.showContent is set as false, tooltip will not + // show but axisPointer will show as normal. + && baseTooltipModel.get('show') + ) { + // Compatible with previous logic. But series.tooltip.trigger: 'axis' + // or series.data[n].tooltip.trigger: 'axis' are not support any more. + var triggerAxis = baseTooltipModel.get('trigger') === 'axis'; + var cross = baseTooltipModel.get('axisPointer.type') === 'cross'; + var tooltipAxes = coordSys.getTooltipAxes(baseTooltipModel.get('axisPointer.axis')); + if (triggerAxis || cross) { + each(tooltipAxes.baseAxes, curry( + saveTooltipAxisInfo, cross ? 'cross' : true, triggerAxis + )); + } + if (cross) { + each(tooltipAxes.otherAxes, curry(saveTooltipAxisInfo, 'cross', false)); + } + } + + // fromTooltip: true | false | 'cross' + // triggerTooltip: true | false | null + function saveTooltipAxisInfo(fromTooltip, triggerTooltip, axis) { + var axisPointerModel = axis.model.getModel('axisPointer', globalAxisPointerModel); + + var axisPointerShow = axisPointerModel.get('show'); + if (!axisPointerShow || ( + axisPointerShow === 'auto' + && !fromTooltip + && !isHandleTrigger(axisPointerModel) + )) { + return; + } + + if (triggerTooltip == null) { + triggerTooltip = axisPointerModel.get('triggerTooltip'); + } -/***/ }, -/* 131 */ -/***/ function(module, exports, __webpack_require__) { + axisPointerModel = fromTooltip + ? makeAxisPointerModel( + axis, baseTooltipModel, globalAxisPointerModel, ecModel, + fromTooltip, triggerTooltip + ) + : axisPointerModel; + + var snap = axisPointerModel.get('snap'); + var key = makeKey(axis.model); + var involveSeries = triggerTooltip || snap || axis.type === 'category'; + + // If result.axesInfo[key] exist, override it (tooltip has higher priority). + var axisInfo = result.axesInfo[key] = { + key: key, + axis: axis, + coordSys: coordSys, + axisPointerModel: axisPointerModel, + triggerTooltip: triggerTooltip, + involveSeries: involveSeries, + snap: snap, + useHandle: isHandleTrigger(axisPointerModel), + seriesModels: [] + }; + axesInfoInCoordSys[key] = axisInfo; + result.seriesInvolved |= involveSeries; - 'use strict'; - // TODO boundaryGap + var groupIndex = getLinkGroupIndex(linksOption, axis); + if (groupIndex != null) { + var linkGroup = linkGroups[groupIndex] || (linkGroups[groupIndex] = {axesInfo: {}}); + linkGroup.axesInfo[key] = axisInfo; + linkGroup.mapper = linksOption[groupIndex].mapper; + axisInfo.linkGroup = linkGroup; + } + } + }); + } + function makeAxisPointerModel( + axis, baseTooltipModel, globalAxisPointerModel, ecModel, fromTooltip, triggerTooltip + ) { + var tooltipAxisPointerModel = baseTooltipModel.getModel('axisPointer'); + var volatileOption = {}; - __webpack_require__(127); + each( + [ + 'type', 'snap', 'lineStyle', 'shadowStyle', 'label', + 'animation', 'animationDurationUpdate', 'animationEasingUpdate', 'z' + ], + function (field) { + volatileOption[field] = zrUtil.clone(tooltipAxisPointerModel.get(field)); + } + ); - __webpack_require__(132); + // category axis do not auto snap, otherwise some tick that do not + // has value can not be hovered. value/time/log axis default snap if + // triggered from tooltip and trigger tooltip. + volatileOption.snap = axis.type !== 'category' && !!triggerTooltip; + + // Compatibel with previous behavior, tooltip axis do not show label by default. + // Only these properties can be overrided from tooltip to axisPointer. + if (tooltipAxisPointerModel.get('type') === 'cross') { + volatileOption.type = 'line'; + } + var labelOption = volatileOption.label || (volatileOption.label = {}); + // Follow the convention, do not show label when triggered by tooltip by default. + labelOption.show == null && (labelOption.show = false); + + if (fromTooltip === 'cross') { + // When 'cross', both axes show labels. + labelOption.show = true; + // If triggerTooltip, this is a base axis, which should better not use cross style + // (cross style is dashed by default) + if (!triggerTooltip) { + var crossStyle = volatileOption.lineStyle = tooltipAxisPointerModel.get('crossStyle'); + crossStyle && zrUtil.defaults( + labelOption.textStyle || (labelOption.textStyle = {}), + crossStyle.textStyle + ); + } + } + return axis.model.getModel( + 'axisPointer', + new Model(volatileOption, globalAxisPointerModel, ecModel) + ); + } -/***/ }, -/* 132 */ -/***/ function(module, exports, __webpack_require__) { + function collectSeriesInfo(result, ecModel) { + // Prepare data for axis trigger + ecModel.eachSeries(function (seriesModel) { - + // Notice this case: this coordSys is `cartesian2D` but not `grid`. + var coordSys = seriesModel.coordinateSystem; + var seriesTooltipTrigger = seriesModel.get('tooltip.trigger', true); + if (!coordSys + || seriesTooltipTrigger === 'none' + || seriesTooltipTrigger === false + || seriesTooltipTrigger === 'item' + || seriesModel.get('axisPointer.show', true) === false + ) { + return; + } - var zrUtil = __webpack_require__(4); - var graphic = __webpack_require__(43); - var AxisBuilder = __webpack_require__(133); - var ifIgnoreOnTick = AxisBuilder.ifIgnoreOnTick; - var getInterval = AxisBuilder.getInterval; + each(result.coordSysAxesInfo[makeKey(coordSys.model)], function (axisInfo) { + var axis = axisInfo.axis; + if (coordSys.getAxis(axis.dim) === axis) { + axisInfo.seriesModels.push(seriesModel); + axisInfo.seriesDataCount == null && (axisInfo.seriesDataCount = 0); + axisInfo.seriesDataCount += seriesModel.getData().count(); + } + }); - var axisBuilderAttrs = [ - 'axisLine', 'axisLabel', 'axisTick', 'axisName' - ]; - var selfBuilderAttrs = [ - 'splitArea', 'splitLine' - ]; + }, this); + } - // function getAlignWithLabel(model, axisModel) { - // var alignWithLabel = model.get('alignWithLabel'); - // if (alignWithLabel === 'auto') { - // alignWithLabel = axisModel.get('axisTick.alignWithLabel'); - // } - // return alignWithLabel; - // } + /** + * For example: + * { + * axisPointer: { + * links: [{ + * xAxisIndex: [2, 4], + * yAxisIndex: 'all' + * }, { + * xAxisId: ['a5', 'a7'], + * xAxisName: 'xxx' + * }] + * } + * } + */ + function getLinkGroupIndex(linksOption, axis) { + var axisModel = axis.model; + var dim = axis.dim; + for (var i = 0; i < linksOption.length; i++) { + var linkOption = linksOption[i] || {}; + if (checkPropInLink(linkOption[dim + 'AxisId'], axisModel.id) + || checkPropInLink(linkOption[dim + 'AxisIndex'], axisModel.componentIndex) + || checkPropInLink(linkOption[dim + 'AxisName'], axisModel.name) + ) { + return i; + } + } + } - var AxisView = __webpack_require__(1).extendComponentView({ + function checkPropInLink(linkPropValue, axisPropValue) { + return linkPropValue === 'all' + || (zrUtil.isArray(linkPropValue) && zrUtil.indexOf(linkPropValue, axisPropValue) >= 0) + || linkPropValue === axisPropValue; + } - type: 'axis', + helper.fixValue = function (axisModel) { + var axisInfo = helper.getAxisInfo(axisModel); + if (!axisInfo) { + return; + } - render: function (axisModel, ecModel) { + var axisPointerModel = axisInfo.axisPointerModel; + var scale = axisInfo.axis.scale; + var option = axisPointerModel.option; + var status = axisPointerModel.get('status'); + var value = axisPointerModel.get('value'); - this.group.removeAll(); + // Parse init value for category and time axis. + if (value != null) { + value = scale.parse(value); + } - var oldAxisGroup = this._axisGroup; - this._axisGroup = new graphic.Group(); + var useHandle = isHandleTrigger(axisPointerModel); + // If `handle` used, `axisPointer` will always be displayed, so value + // and status should be initialized. + if (status == null) { + option.status = useHandle ? 'show' : 'hide'; + } - this.group.add(this._axisGroup); + var extent = scale.getExtent().slice(); + extent[0] > extent[1] && extent.reverse(); - if (!axisModel.get('show')) { - return; - } + if (// Pick a value on axis when initializing. + value == null + // If both `handle` and `dataZoom` are used, value may be out of axis extent, + // where we should re-pick a value to keep `handle` displaying normally. + || value > extent[1] + ) { + // Make handle displayed on the end of the axis when init, which looks better. + value = extent[1]; + } + if (value < extent[0]) { + value = extent[0]; + } - var gridModel = axisModel.getCoordSysModel(); + option.value = value; - var layout = layoutAxis(gridModel, axisModel); + if (useHandle) { + option.status = axisInfo.axis.scale.isBlank() ? 'hide' : 'show'; + } + }; - var axisBuilder = new AxisBuilder(axisModel, layout); + helper.getAxisInfo = function (axisModel) { + var coordSysAxesInfo = axisModel.ecModel.getComponent('axisPointer').coordSysAxesInfo; + return coordSysAxesInfo && coordSysAxesInfo.axesInfo[makeKey(axisModel)]; + }; - zrUtil.each(axisBuilderAttrs, axisBuilder.add, axisBuilder); + helper.getAxisPointerModel = function (axisModel) { + var axisInfo = helper.getAxisInfo(axisModel); + return axisInfo && axisInfo.axisPointerModel; + }; - this._axisGroup.add(axisBuilder.getGroup()); + function isHandleTrigger(axisPointerModel) { + return !!axisPointerModel.get('handle.show'); + } - zrUtil.each(selfBuilderAttrs, function (name) { - if (axisModel.get(name + '.show')) { - this['_' + name](axisModel, gridModel, layout.labelInterval); - } - }, this); + /** + * @param {module:echarts/model/Model} model + * @return {string} unique key + */ + var makeKey = helper.makeKey = function (model) { + return model.type + '||' + model.id; + }; - graphic.groupTransition(oldAxisGroup, this._axisGroup, axisModel); - }, + module.exports = helper; - /** - * @param {module:echarts/coord/cartesian/AxisModel} axisModel - * @param {module:echarts/coord/cartesian/GridModel} gridModel - * @param {number|Function} labelInterval - * @private - */ - _splitLine: function (axisModel, gridModel, labelInterval) { - var axis = axisModel.axis; - if (axis.isBlank()) { - return; - } - var splitLineModel = axisModel.getModel('splitLine'); - var lineStyleModel = splitLineModel.getModel('lineStyle'); - var lineColors = lineStyleModel.get('color'); +/***/ }, +/* 139 */ +/***/ function(module, exports, __webpack_require__) { - var lineInterval = getInterval(splitLineModel, labelInterval); + 'use strict'; - lineColors = zrUtil.isArray(lineColors) ? lineColors : [lineColors]; - var gridRect = gridModel.coordinateSystem.getRect(); - var isHorizontal = axis.isHorizontal(); + var zrUtil = __webpack_require__(4); + var graphic = __webpack_require__(44); + var textContain = __webpack_require__(8); + var formatUtil = __webpack_require__(6); + var matrix = __webpack_require__(11); + var axisHelper = __webpack_require__(105); + var AxisBuilder = __webpack_require__(135); - var lineCount = 0; + var helper = {}; - var ticksCoords = axis.getTicksCoords( - // splitLineModel.get('alignWithLabel') - ); - var ticks = axis.scale.getTicks(); + /** + * @param {module:echarts/model/Model} axisPointerModel + */ + helper.buildElStyle = function (axisPointerModel) { + var axisPointerType = axisPointerModel.get('type'); + var styleModel = axisPointerModel.getModel(axisPointerType + 'Style'); + var style; + if (axisPointerType === 'line') { + style = styleModel.getLineStyle(); + style.fill = null; + } + else if (axisPointerType === 'shadow') { + style = styleModel.getAreaStyle(); + style.stroke = null; + } + return style; + }; - var p1 = []; - var p2 = []; - // Simple optimization - // Batching the lines if color are the same - var lineStyle = lineStyleModel.getLineStyle(); - for (var i = 0; i < ticksCoords.length; i++) { - if (ifIgnoreOnTick(axis, i, lineInterval)) { - continue; - } + /** + * @param {Function} labelPos {align, verticalAlign, position} + */ + helper.buildLabelElOption = function ( + elOption, axisModel, axisPointerModel, api, labelPos + ) { + var value = axisPointerModel.get('value'); + var text = helper.getValueLabel( + value, axisModel.axis, axisModel.ecModel, + axisPointerModel.get('seriesDataIndices'), + { + precision: axisPointerModel.get('label.precision'), + formatter: axisPointerModel.get('label.formatter') + } + ); + var labelModel = axisPointerModel.getModel('label'); + var textStyleModel = labelModel.getModel('textStyle'); + var paddings = formatUtil.normalizeCssArray(labelModel.get('padding') || 0); - var tickCoord = axis.toGlobalCoord(ticksCoords[i]); + var font = textStyleModel.getFont(); + var textRect = textContain.getBoundingRect( + text, font, labelPos.textAlign, labelPos.textBaseline + ); - if (isHorizontal) { - p1[0] = tickCoord; - p1[1] = gridRect.y; - p2[0] = tickCoord; - p2[1] = gridRect.y + gridRect.height; - } - else { - p1[0] = gridRect.x; - p1[1] = tickCoord; - p2[0] = gridRect.x + gridRect.width; - p2[1] = tickCoord; - } + var position = labelPos.position; + var width = textRect.width + paddings[1] + paddings[3]; + var height = textRect.height + paddings[0] + paddings[2]; - var colorIndex = (lineCount++) % lineColors.length; - this._axisGroup.add(new graphic.Line(graphic.subPixelOptimizeLine({ - anid: 'line_' + ticks[i], + // Adjust by align. + var align = labelPos.align; + align === 'right' && (position[0] -= width); + align === 'center' && (position[0] -= width / 2); + var verticalAlign = labelPos.verticalAlign; + verticalAlign === 'bottom' && (position[1] -= height); + verticalAlign === 'middle' && (position[1] -= height / 2); - shape: { - x1: p1[0], - y1: p1[1], - x2: p2[0], - y2: p2[1] - }, - style: zrUtil.defaults({ - stroke: lineColors[colorIndex] - }, lineStyle), - silent: true - }))); - } - }, + // Not overflow ec container + confineInContainer(position, width, height, api); - /** - * @param {module:echarts/coord/cartesian/AxisModel} axisModel - * @param {module:echarts/coord/cartesian/GridModel} gridModel - * @param {number|Function} labelInterval - * @private - */ - _splitArea: function (axisModel, gridModel, labelInterval) { - var axis = axisModel.axis; + var bgColor = labelModel.get('backgroundColor'); + if (!bgColor || bgColor === 'auto') { + bgColor = axisModel.get('axisLine.lineStyle.color'); + } - if (axis.isBlank()) { - return; + elOption.label = { + shape: {x: 0, y: 0, width: width, height: height, r: labelModel.get('borderRadius')}, + position: position.slice(), + style: { + text: text, + textFont: font, + textFill: textStyleModel.getTextColor(), + textPosition: 'inside', + fill: bgColor, + stroke: labelModel.get('borderColor') || 'transparent', + lineWidth: labelModel.get('borderWidth') || 0, + shadowBlur: labelModel.get('shadowBlur'), + shadowColor: labelModel.get('shadowColor'), + shadowOffsetX: labelModel.get('shadowOffsetX'), + shadowOffsetY: labelModel.get('shadowOffsetY') } + }; + }; - var splitAreaModel = axisModel.getModel('splitArea'); - var areaStyleModel = splitAreaModel.getModel('areaStyle'); - var areaColors = areaStyleModel.get('color'); + // Do not overflow ec container + function confineInContainer(position, width, height, api) { + var viewWidth = api.getWidth(); + var viewHeight = api.getHeight(); + position[0] = Math.min(position[0] + width, viewWidth) - width; + position[1] = Math.min(position[1] + height, viewHeight) - height; + position[0] = Math.max(position[0], 0); + position[1] = Math.max(position[1], 0); + } - var gridRect = gridModel.coordinateSystem.getRect(); + /** + * @param {number} value + * @param {module:echarts/coord/Axis} axis + * @param {module:echarts/model/Global} ecModel + * @param {Object} opt + * @param {Array.} seriesDataIndices + * @param {number|string} opt.precision 'auto' or a number + * @param {string|Function} opt.formatter label formatter + */ + helper.getValueLabel = function (value, axis, ecModel, seriesDataIndices, opt) { + var text = axis.scale.getLabel( + // Use 'pad' to try to fix width, which helps to debounce when when moving label. + value, {precision: opt.precision, pad: true} + ); + var formatter = opt.formatter; - var ticksCoords = axis.getTicksCoords( - // splitAreaModel.get('alignWithLabel') - ); - var ticks = axis.scale.getTicks(); + if (formatter) { + var params = { + value: axisHelper.getAxisRawValue(axis, value), + seriesData: [] + }; + zrUtil.each(seriesDataIndices, function (idxItem) { + var series = ecModel.getSeriesByIndex(idxItem.seriesIndex); + var dataIndex = idxItem.dataIndexInside; + var dataParams = series && series.getDataParams(dataIndex); + dataParams && params.seriesData.push(dataParams); + }); - var prevX = axis.toGlobalCoord(ticksCoords[0]); - var prevY = axis.toGlobalCoord(ticksCoords[0]); + if (zrUtil.isString(formatter)) { + text = formatter.replace('{value}', text); + } + else if (zrUtil.isFunction(formatter)) { + text = formatter(params); + } + } - var count = 0; + return text; + }; - var areaInterval = getInterval(splitAreaModel, labelInterval); + /** + * @param {module:echarts/coord/Axis} axis + * @param {number} value + * @param {Object} layoutInfo { + * rotation, position, labelOffset, labelDirection, labelMargin + * } + */ + helper.getTransformedPosition = function (axis, value, layoutInfo) { + var transform = matrix.create(); + matrix.rotate(transform, transform, layoutInfo.rotation); + matrix.translate(transform, transform, layoutInfo.position); - var areaStyle = areaStyleModel.getAreaStyle(); - areaColors = zrUtil.isArray(areaColors) ? areaColors : [areaColors]; + return graphic.applyTransform([ + axis.dataToCoord(value), + (layoutInfo.labelOffset || 0) + + (layoutInfo.labelDirection || 1) * (layoutInfo.labelMargin || 0) + ], transform); + }; - for (var i = 1; i < ticksCoords.length; i++) { - if (ifIgnoreOnTick(axis, i, areaInterval)) { - continue; - } + helper.buildCartesianSingleLabelElOption = function ( + value, elOption, layoutInfo, axisModel, axisPointerModel, api + ) { + var textLayout = AxisBuilder.innerTextLayout( + layoutInfo.rotation, 0, layoutInfo.labelDirection + ); + layoutInfo.labelMargin = axisPointerModel.get('label.margin'); + helper.buildLabelElOption(elOption, axisModel, axisPointerModel, api, { + position: helper.getTransformedPosition(axisModel.axis, value, layoutInfo), + align: textLayout.textAlign, + verticalAlign: textLayout.textVerticalAlign + }); + }; - var tickCoord = axis.toGlobalCoord(ticksCoords[i]); + /** + * @param {Array.} p1 + * @param {Array.} p2 + * @param {number} [xDimIndex=0] or 1 + */ + helper.makeLineShape = function (p1, p2, xDimIndex) { + xDimIndex = xDimIndex || 0; + return { + x1: p1[xDimIndex], + y1: p1[1 - xDimIndex], + x2: p2[xDimIndex], + y2: p2[1 - xDimIndex] + }; + }; - var x; - var y; - var width; - var height; - if (axis.isHorizontal()) { - x = prevX; - y = gridRect.y; - width = tickCoord - x; - height = gridRect.height; - } - else { - x = gridRect.x; - y = prevY; - width = gridRect.width; - height = tickCoord - y; - } + /** + * @param {Array.} xy + * @param {Array.} wh + * @param {number} [xDimIndex=0] or 1 + */ + helper.makeRectShape = function (xy, wh, xDimIndex) { + xDimIndex = xDimIndex || 0; + return { + x: xy[xDimIndex], + y: xy[1 - xDimIndex], + width: wh[xDimIndex], + height: wh[1 - xDimIndex] + }; + }; - var colorIndex = (count++) % areaColors.length; - this._axisGroup.add(new graphic.Rect({ - anid: 'area_' + ticks[i], + helper.makeSectorShape = function (cx, cy, r0, r, startAngle, endAngle) { + return { + cx: cx, + cy: cy, + r0: r0, + r: r, + startAngle: startAngle, + endAngle: endAngle, + clockwise: true + }; + }; - shape: { - x: x, - y: y, - width: width, - height: height - }, - style: zrUtil.defaults({ - fill: areaColors[colorIndex] - }, areaStyle), - silent: true - })); + module.exports = helper; - prevX = x + width; - prevY = y + height; - } - } - }); - AxisView.extend({ - type: 'xAxis' - }); - AxisView.extend({ - type: 'yAxis' - }); +/***/ }, +/* 140 */ +/***/ function(module, exports, __webpack_require__) { + + + + var zrUtil = __webpack_require__(4); + + var helper = {}; /** - * @inner + * @param {Object} opt {labelInside} + * @return {Object} { + * position, rotation, labelDirection, labelOffset, + * tickDirection, labelRotate, labelInterval, z2 + * } */ - function layoutAxis(gridModel, axisModel) { + helper.layout = function (gridModel, axisModel, opt) { + opt = opt || {}; var grid = gridModel.coordinateSystem; var axis = axisModel.axis; var layout = {}; @@ -28610,20 +31062,18 @@ return /******/ (function(modules) { // webpackBootstrap var dirMap = {top: -1, bottom: 1, left: -1, right: 1}; layout.labelDirection = layout.tickDirection = layout.nameDirection = dirMap[rawAxisPosition]; - if (axis.onZero) { - layout.labelOffset = posMap[axisDim][rawAxisPosition] - posMap[axisDim].onZero; - } + layout.labelOffset = axis.onZero ? posMap[axisDim][rawAxisPosition] - posMap[axisDim].onZero : 0; - if (axisModel.getModel('axisTick').get('inside')) { + if (axisModel.get('axisTick.inside')) { layout.tickDirection = -layout.tickDirection; } - if (axisModel.getModel('axisLabel').get('inside')) { + if (zrUtil.retrieve(opt.labelInside, axisModel.get('axisLabel.inside'))) { layout.labelDirection = -layout.labelDirection; } // Special label rotation - var labelRotation = axisModel.getModel('axisLabel').get('rotate'); - layout.labelRotation = axisPosition === 'top' ? -labelRotation : labelRotation; + var labelRotate = axisModel.get('axisLabel.rotate'); + layout.labelRotate = axisPosition === 'top' ? -labelRotate : labelRotate; // label interval when auto mode. layout.labelInterval = axis.getLabelInterval(); @@ -28632,623 +31082,902 @@ return /******/ (function(modules) { // webpackBootstrap layout.z2 = 1; return layout; - } + }; + + module.exports = helper; + /***/ }, -/* 133 */ +/* 141 */ /***/ function(module, exports, __webpack_require__) { - var zrUtil = __webpack_require__(4); - var formatUtil = __webpack_require__(6); - var graphic = __webpack_require__(43); - var Model = __webpack_require__(12); - var numberUtil = __webpack_require__(7); - var remRadian = numberUtil.remRadian; - var isRadianAroundZero = numberUtil.isRadianAroundZero; - var vec2 = __webpack_require__(10); - var v2ApplyTransform = vec2.applyTransform; - var retrieve = zrUtil.retrieve; - - var PI = Math.PI; - - function makeAxisEventDataBase(axisModel) { - var eventData = { - componentType: axisModel.mainType - }; - eventData[axisModel.mainType + 'Index'] = axisModel.componentIndex; - return eventData; - } + var axisPointerModelHelper = __webpack_require__(138); /** - * A final axis is translated and rotated from a "standard axis". - * So opt.position and opt.rotation is required. - * - * A standard axis is and axis from [0, 0] to [0, axisExtent[1]], - * for example: (0, 0) ------------> (0, 50) - * - * nameDirection or tickDirection or labelDirection is 1 means tick - * or label is below the standard axis, whereas is -1 means above - * the standard axis. labelOffset means offset between label and axis, - * which is useful when 'onZero', where axisLabel is in the grid and - * label in outside grid. - * - * Tips: like always, - * positive rotation represents anticlockwise, and negative rotation - * represents clockwise. - * The direction of position coordinate is the same as the direction - * of screen coordinate. - * - * Do not need to consider axis 'inverse', which is auto processed by - * axis extent. - * - * @param {module:zrender/container/Group} group - * @param {Object} axisModel - * @param {Object} opt Standard axis parameters. - * @param {Array.} opt.position [x, y] - * @param {number} opt.rotation by radian - * @param {number} [opt.nameDirection=1] 1 or -1 Used when nameLocation is 'middle'. - * @param {number} [opt.tickDirection=1] 1 or -1 - * @param {number} [opt.labelDirection=1] 1 or -1 - * @param {number} [opt.labelOffset=0] Usefull when onZero. - * @param {string} [opt.axisLabelShow] default get from axisModel. - * @param {string} [opt.axisName] default get from axisModel. - * @param {number} [opt.axisNameAvailableWidth] - * @param {number} [opt.labelRotation] by degree, default get from axisModel. - * @param {number} [opt.labelInterval] Default label interval when label - * interval from model is null or 'auto'. - * @param {number} [opt.strokeContainThreshold] Default label interval when label + * Base class of AxisView. */ - var AxisBuilder = function (axisModel, opt) { + var AxisView = __webpack_require__(1).extendComponentView({ + + type: 'axis', /** - * @readOnly + * @private */ - this.opt = opt; + _axisPointer: null, + + axisPointerClass: null, /** - * @readOnly + * @override */ - this.axisModel = axisModel; + render: function (axisModel, ecModel, api, payload) { + // FIXME + // This process should proformed after coordinate systems updated + // (axis scale updated), and should be performed each time update. + // So put it here temporarily, although it is not appropriate to + // put a model-writing procedure in `view`. + axisPointerModelHelper.fixValue(axisModel); - // Default value - zrUtil.defaults( - opt, - { - labelOffset: 0, - nameDirection: 1, - tickDirection: 1, - labelDirection: 1, - silent: true - } - ); + AxisView.superApply(this, 'render', arguments); + updateAxisPointer(this, axisModel, ecModel, api, payload, true); + }, /** - * @readOnly + * Action handler. + * @public + * @param {module:echarts/coord/cartesian/AxisModel} axisModel + * @param {module:echarts/model/Global} ecModel + * @param {module:echarts/ExtensionAPI} api + * @param {Object} payload */ - this.group = new graphic.Group(); + updateAxisPointer: function (axisModel, ecModel, api, payload, force) { + updateAxisPointer(this, axisModel, ecModel, api, payload, false); + }, - // FIXME Not use a seperate text group? - var dumbGroup = new graphic.Group({ - position: opt.position.slice(), - rotation: opt.rotation + /** + * @override + */ + remove: function (ecModel, api) { + var axisPointer = this._axisPointer; + axisPointer && axisPointer.remove(api); + AxisView.superApply(this, 'remove', arguments); + }, + + /** + * @override + */ + dispose: function (ecModel, api) { + disposeAxisPointer(this, api); + AxisView.superApply(this, 'dispose', arguments); + } + + }); + + function updateAxisPointer(axisView, axisModel, ecModel, api, payload, forceRender) { + if (!axisView.axisPointerClass) { + return; + } + var axisPointerModel = axisPointerModelHelper.getAxisPointerModel(axisModel); + axisPointerModel + ? (axisView._axisPointer || (axisView._axisPointer = new axisView.axisPointerClass())) + .render(axisModel, axisPointerModel, api, forceRender) + : disposeAxisPointer(axisView, api); + } + + function disposeAxisPointer(axisView, ecModel, api) { + var axisPointer = axisView._axisPointer; + axisPointer && axisPointer.dispose(ecModel, api); + axisView._axisPointer = null; + } + + module.exports = AxisView; + + +/***/ }, +/* 142 */ +/***/ function(module, exports, __webpack_require__) { + + + + var echarts = __webpack_require__(1); + var axisPointerModelHelper = __webpack_require__(138); + var axisTrigger = __webpack_require__(143); + var zrUtil = __webpack_require__(4); + + __webpack_require__(145); + __webpack_require__(146); + + echarts.registerPreprocessor(function (option) { + // Always has a global axisPointerModel for default setting. + if (option) { + (!option.axisPointer || option.axisPointer.length === 0) + && (option.axisPointer = {}); + + var link = option.axisPointer.link; + // Normalize to array to avoid object mergin. But if link + // is not set, remain null/undefined, otherwise it will + // override existent link setting. + if (link && !zrUtil.isArray(link)) { + option.axisPointer.link = [link]; + } + } + }); + + // This process should proformed after coordinate systems created + // and series data processed. So put it on statistic processing stage. + echarts.registerProcessor(echarts.PRIORITY.PROCESSOR.STATISTIC, function (ecModel, api) { + // Build axisPointerModel, mergin tooltip.axisPointer model for each axis. + // allAxesInfo should be updated when setOption performed. + ecModel.getComponent('axisPointer').coordSysAxesInfo + = axisPointerModelHelper.collect(ecModel, api); + }); + + // Broadcast to all views. + echarts.registerAction({ + type: 'updateAxisPointer', + event: 'updateAxisPointer', + update: ':updateAxisPointer' + }, function (payload, ecModel, api) { + var outputFinder = axisTrigger( + ecModel.getComponent('axisPointer').coordSysAxesInfo, + payload.currTrigger, + payload, + payload.dispatchAction || zrUtil.bind(api.dispatchAction, api), + ecModel, + api, + payload.tooltipOption, + payload.highDownKey + ); + + return outputFinder; + }); + + + +/***/ }, +/* 143 */ +/***/ function(module, exports, __webpack_require__) { + + + + var zrUtil = __webpack_require__(4); + var modelUtil = __webpack_require__(5); + var modelHelper = __webpack_require__(138); + var findPointFromSeries = __webpack_require__(144); + + var each = zrUtil.each; + var curry = zrUtil.curry; + var get = modelUtil.makeGetter(); + + /** + * Basic logic: check all axis, if they do not demand show/highlight, + * then hide/downplay them. + * + * @param {Object} coordSysAxesInfo + * @param {string} currTrigger 'click' | 'mousemove' | 'leave' + * @param {Object} finder {x, y, xAxisId: ...[], yAxisName: ...[], angleAxisIndex: ...[]} + * x and y, which are mandatory, specify a point to tigger axisPointer and tooltip. + * other properties, which are optional, restrict target axes. + * @param {Function} dispatchAction + * @param {module:echarts/ExtensionAPI} api + * @param {Object} tooltipOption + * @param {string} [highDownKey] + * @return {Object} content of event obj for echarts.connect. + */ + function axisTrigger( + coordSysAxesInfo, currTrigger, finder, dispatchAction, + ecModel, api, tooltipOption, highDownKey + ) { + var point = []; + if (finder.x != null && finder.y != null) { + point = [finder.x, finder.y]; + } + else { + point = findPointFromSeries({ + seriesIndex: finder.seriesIndex, + // Do not use dataIndexInside from other ec instance. + // FIXME: auto detect it? + dataIndex: finder.dataIndex + }, ecModel).point; + } + + var axesInfo = coordSysAxesInfo.axesInfo; + var shouldHide = currTrigger === 'leave' || illegalPoint(point); + var outputFinder = {}; + + var showValueMap = {}; + var dataByCoordSys = {list: [], map: {}}; + var highlightBatch = []; + var updaters = { + showPointer: curry(showPointer, showValueMap), + showTooltip: curry(showTooltip, dataByCoordSys), + highlight: curry(highlight, highlightBatch) + }; + + // Process for triggered axes. + each(coordSysAxesInfo.coordSysMap, function (coordSys, coordSysKey) { + var coordSysContainsPoint = coordSys.containPoint(point); + + each(coordSysAxesInfo.coordSysAxesInfo[coordSysKey], function (axisInfo, key) { + var axis = axisInfo.axis; + if (!shouldHide && coordSysContainsPoint && !notTargetAxis(finder, axis)) { + processOnAxis(axisInfo, axis.pointToData(point), updaters, false, outputFinder); + } + }); }); - // this.group.add(dumbGroup); - // this._dumbGroup = dumbGroup; + // Process for linked axes. + each(axesInfo, function (tarAxisInfo, tarKey) { + var linkGroup = tarAxisInfo.linkGroup; + + // If axis has been triggered in the previous stage, it should not be triggered by link. + linkGroup && !showValueMap[tarKey] && each(linkGroup.axesInfo, function (srcAxisInfo, srcKey) { + var srcValItem = showValueMap[srcKey]; + // If srcValItem exist, source axis is triggered, so link to target axis. + if (srcAxisInfo !== tarAxisInfo && srcValItem) { + var val = srcValItem.value; + linkGroup.mapper && (val = tarAxisInfo.axis.scale.parse(linkGroup.mapper( + val, makeMapperParam(srcAxisInfo), makeMapperParam(tarAxisInfo) + ))); + processOnAxis(tarAxisInfo, val, updaters, true, outputFinder); + } + }); + }); - dumbGroup.updateTransform(); - this._transform = dumbGroup.transform; + updateModelActually(showValueMap, axesInfo); + dispatchTooltipActually(dataByCoordSys, point, tooltipOption, dispatchAction); + dispatchHighDownActually(highlightBatch, dispatchAction, api, highDownKey); - this._dumbGroup = dumbGroup; - }; + return outputFinder; + } - AxisBuilder.prototype = { + function processOnAxis(axisInfo, newValue, updaters, dontSnap, outputFinder) { + var axis = axisInfo.axis; - constructor: AxisBuilder, + if (axis.scale.isBlank() || !axis.containData(newValue)) { + return; + } - hasBuilder: function (name) { - return !!builders[name]; - }, + if (!axisInfo.involveSeries) { + updaters.showPointer(axisInfo, newValue); + return; + } + + // Heavy calculation. So put it after axis.containData checking. + var payloadInfo = buildPayloadsBySeries(newValue, axisInfo); + var payloadBatch = payloadInfo.payloadBatch; + var snapToValue = payloadInfo.snapToValue; + + // Fill content of event obj for echarts.connect. + // By defualt use the first involved series data as a sample to connect. + if (payloadBatch[0] && outputFinder.seriesIndex == null) { + zrUtil.extend(outputFinder, payloadBatch[0]); + } + + // If no linkSource input, this process is for collecting link + // target, where snap should not be accepted. + if (!dontSnap && axisInfo.snap) { + if (axis.containData(snapToValue) && snapToValue != null) { + newValue = snapToValue; + } + } + + updaters.highlight('highlight', payloadBatch); + updaters.showPointer(axisInfo, newValue, payloadBatch); + // Tooltip should always be snapToValue, otherwise there will be + // incorrect "axis value ~ series value" mapping displayed in tooltip. + updaters.showTooltip(axisInfo, payloadInfo, snapToValue); + } + + function buildPayloadsBySeries(value, axisInfo) { + var axis = axisInfo.axis; + var dim = axis.dim; + var snapToValue = value; + var payloadBatch = []; + var minDist = Number.MAX_VALUE; + var minDiff = -1; + + each(axisInfo.seriesModels, function (series, idx) { + var dataDim = series.coordDimToDataDim(dim); + var seriesNestestValue; + var dataIndices; + + if (series.getAxisTooltipData) { + var result = series.getAxisTooltipData(dataDim, value, axis); + dataIndices = result.dataIndices; + seriesNestestValue = result.nestestValue; + } + else { + dataIndices = series.getData().indexOfNearest( + dataDim[0], + value, + // Add a threshold to avoid find the wrong dataIndex + // when data length is not same. + false, axis.type === 'category' ? 0.5 : null + ); + if (!dataIndices.length) { + return; + } + seriesNestestValue = series.getData().get(dataDim[0], dataIndices[0]); + } + + if (seriesNestestValue == null || !isFinite(seriesNestestValue)) { + return; + } + + var diff = value - seriesNestestValue; + var dist = Math.abs(diff); + // Consider category case + if (dist <= minDist) { + if (dist < minDist || (diff >= 0 && minDiff < 0)) { + minDist = dist; + minDiff = diff; + snapToValue = seriesNestestValue; + payloadBatch.length = 0; + } + each(dataIndices, function (dataIndex) { + payloadBatch.push({ + seriesIndex: series.seriesIndex, + dataIndexInside: dataIndex, + dataIndex: series.getData().getRawIndex(dataIndex) + }); + }); + } + }); + + return { + payloadBatch: payloadBatch, + snapToValue: snapToValue + }; + } - add: function (name) { - builders[name].call(this); - }, + function showPointer(showValueMap, axisInfo, value, payloadBatch) { + showValueMap[axisInfo.key] = {value: value, payloadBatch: payloadBatch}; + } - getGroup: function () { - return this.group; + function showTooltip(dataByCoordSys, axisInfo, payloadInfo, value) { + var payloadBatch = payloadInfo.payloadBatch; + var axis = axisInfo.axis; + var axisModel = axis.model; + var axisPointerModel = axisInfo.axisPointerModel; + + // If no data, do not create anything in dataByCoordSys, + // whose length will be used to judge whether dispatch action. + if (!axisInfo.triggerTooltip || !payloadBatch.length) { + return; } - }; + var coordSysModel = axisInfo.coordSys.model; + var coordSysKey = modelHelper.makeKey(coordSysModel); + var coordSysItem = dataByCoordSys.map[coordSysKey]; + if (!coordSysItem) { + coordSysItem = dataByCoordSys.map[coordSysKey] = { + coordSysId: coordSysModel.id, + coordSysIndex: coordSysModel.componentIndex, + coordSysType: coordSysModel.type, + coordSysMainType: coordSysModel.mainType, + dataByAxis: [] + }; + dataByCoordSys.list.push(coordSysItem); + } + + coordSysItem.dataByAxis.push({ + axisDim: axis.dim, + axisIndex: axisModel.componentIndex, + axisType: axisModel.type, + axisId: axisModel.id, + value: value, + // Caustion: viewHelper.getValueLabel is actually on "view stage", which + // depends that all models have been updated. So it should not be performed + // here. Considering axisPointerModel used here is volatile, which is hard + // to be retrieve in TooltipView, we prepare parameters here. + valueLabelOpt: { + precision: axisPointerModel.get('label.precision'), + formatter: axisPointerModel.get('label.formatter') + }, + seriesDataIndices: payloadBatch.slice() + }); + } - var builders = { + function highlight(highlightBatch, actionType, batch) { + highlightBatch.push.apply(highlightBatch, batch); + } - /** - * @private - */ - axisLine: function () { - var opt = this.opt; - var axisModel = this.axisModel; + function updateModelActually(showValueMap, axesInfo) { + // Basic logic: If no 'show' required, 'hide' this axisPointer. + each(axesInfo, function (axisInfo, key) { + var option = axisInfo.axisPointerModel.option; + var valItem = showValueMap[key]; - if (!axisModel.get('axisLine.show')) { - return; + if (valItem) { + !axisInfo.useHandle && (option.status = 'show'); + option.value = valItem.value; + // For label formatter param. + option.seriesDataIndices = (valItem.payloadBatch || []).slice(); } - - var extent = this.axisModel.axis.getExtent(); - - var matrix = this._transform; - var pt1 = [extent[0], 0]; - var pt2 = [extent[1], 0]; - if (matrix) { - v2ApplyTransform(pt1, pt1, matrix); - v2ApplyTransform(pt2, pt2, matrix); + // When always show (e.g., handle used), remain + // original value and status. + else { + // If hide, value still need to be set, consider + // click legend to toggle axis blank. + !axisInfo.useHandle && (option.status = 'hide'); } + }); + } - this.group.add(new graphic.Line(graphic.subPixelOptimizeLine({ - - // Id for animation - anid: 'line', + function dispatchTooltipActually(dataByCoordSys, point, tooltipOption, dispatchAction) { + // Basic logic: If no showTip required, hideTip will be dispatched. + if (illegalPoint(point) || !dataByCoordSys.list.length) { + dispatchAction({type: 'hideTip'}); + return; + } - shape: { - x1: pt1[0], - y1: pt1[1], - x2: pt2[0], - y2: pt2[1] - }, - style: zrUtil.extend( - {lineCap: 'round'}, - axisModel.getModel('axisLine.lineStyle').getLineStyle() - ), - strokeContainThreshold: opt.strokeContainThreshold || 5, - silent: true, - z2: 1 - }))); - }, + // In most case only one axis (or event one series is used). It is + // convinient to fetch payload.seriesIndex and payload.dataIndex + // dirtectly. So put the first seriesIndex and dataIndex of the first + // axis on the payload. + var sampleItem = ((dataByCoordSys.list[0].dataByAxis[0] || {}).seriesDataIndices || [])[0] || {}; + + dispatchAction({ + type: 'showTip', + escapeConnect: true, + x: point[0], + y: point[1], + tooltipOption: tooltipOption, + dataIndexInside: sampleItem.dataIndexInside, + dataIndex: sampleItem.dataIndex, + seriesIndex: sampleItem.seriesIndex, + dataByCoordSys: dataByCoordSys.list + }); + } - /** - * @private - */ - axisTick: function () { - var axisModel = this.axisModel; - var axis = axisModel.axis; + function dispatchHighDownActually(highlightBatch, dispatchAction, api, highDownKey) { + // Basic logic: If nothing highlighted, should downplay all highlighted items. + // This case will occur when mouse leave coordSys. - if (!axisModel.get('axisTick.show') || axis.isBlank()) { - return; - } + // FIXME + // (1) highlight status shoule be managemented in series.getData()? + // (2) If axisPointer A triggerOn 'handle' and axisPointer B triggerOn + // 'mousemove', items highlighted by A will be downplayed by B. + // It will not be fixed until someone requires this scenario. + + // Consider items area hightlighted by 'handle', and globalListener may + // downplay all items (including just highlighted ones) when mousemove. + // So we use a highDownKey to separate them as a temporary solution. + var zr = api.getZr(); + highDownKey = 'lastHighlights' + (highDownKey || ''); + var lastHighlights = get(zr)[highDownKey] || {}; + var newHighlights = get(zr)[highDownKey] = {}; + + // Build hash map and remove duplicate incidentally. + zrUtil.each(highlightBatch, function (batchItem) { + var key = batchItem.seriesIndex + ' | ' + batchItem.dataIndex; + newHighlights[key] = batchItem; + }); - var tickModel = axisModel.getModel('axisTick'); - var opt = this.opt; + // Diff. + var toHighlight = []; + var toDownplay = []; + zrUtil.each(lastHighlights, function (batchItem, key) { + !newHighlights[key] && toDownplay.push(batchItem); + }); + zrUtil.each(newHighlights, function (batchItem, key) { + !lastHighlights[key] && toHighlight.push(batchItem); + }); - var lineStyleModel = tickModel.getModel('lineStyle'); - var tickLen = tickModel.get('length'); + toDownplay.length && api.dispatchAction({ + type: 'downplay', escapeConnect: true, batch: toDownplay + }); + toHighlight.length && api.dispatchAction({ + type: 'highlight', escapeConnect: true, batch: toHighlight + }); + } - var tickInterval = getInterval(tickModel, opt.labelInterval); - var ticksCoords = axis.getTicksCoords(tickModel.get('alignWithLabel')); - var ticks = axis.scale.getTicks(); + function notTargetAxis(finder, axis) { + var isTarget = 1; + // If none of xxxAxisId and xxxAxisName and xxxAxisIndex exists in finder, + // no axis is not target axis. + each(finder, function (value, propName) { + isTarget &= !(/^.+(AxisId|AxisName|AxisIndex)$/.test(propName)); + }); + !isTarget && each( + [['AxisId', 'id'], ['AxisIndex', 'componentIndex'], ['AxisName', 'name']], + function (prop) { + var vals = modelUtil.normalizeToArray(finder[axis.dim + prop[0]]); + isTarget |= zrUtil.indexOf(vals, axis.model[prop[1]]) >= 0; + } + ); + return !isTarget; + } - var pt1 = []; - var pt2 = []; - var matrix = this._transform; + function makeMapperParam(axisInfo) { + var axisModel = axisInfo.axis.model; + var item = {}; + var dim = item.axisDim = axisInfo.axis.dim; + item.axisIndex = item[dim + 'AxisIndex'] = axisModel.componentIndex; + item.axisName = item[dim + 'AxisName'] = axisModel.name; + item.axisId = item[dim + 'AxisId'] = axisModel.id; + return item; + } - for (var i = 0; i < ticksCoords.length; i++) { - // Only ordinal scale support tick interval - if (ifIgnoreOnTick(axis, i, tickInterval)) { - continue; - } + function illegalPoint(point) { + return point[0] == null || isNaN(point[0]) || point[1] == null || isNaN(point[1]); + } - var tickCoord = ticksCoords[i]; + module.exports = axisTrigger; - pt1[0] = tickCoord; - pt1[1] = 0; - pt2[0] = tickCoord; - pt2[1] = opt.tickDirection * tickLen; - if (matrix) { - v2ApplyTransform(pt1, pt1, matrix); - v2ApplyTransform(pt2, pt2, matrix); - } - // Tick line, Not use group transform to have better line draw - this.group.add(new graphic.Line(graphic.subPixelOptimizeLine({ +/***/ }, +/* 144 */ +/***/ function(module, exports, __webpack_require__) { - // Id for animation - anid: 'tick_' + ticks[i], + - shape: { - x1: pt1[0], - y1: pt1[1], - x2: pt2[0], - y2: pt2[1] - }, - style: zrUtil.defaults( - lineStyleModel.getLineStyle(), - { - stroke: axisModel.get('axisLine.lineStyle.color') - } - ), - z2: 2, - silent: true - }))); - } - }, + var zrUtil = __webpack_require__(4); + var modelUtil = __webpack_require__(5); - /** - * @param {module:echarts/coord/cartesian/AxisModel} axisModel - * @param {module:echarts/coord/cartesian/GridModel} gridModel - * @private - */ - axisLabel: function () { - var opt = this.opt; - var axisModel = this.axisModel; - var axis = axisModel.axis; - var show = retrieve(opt.axisLabelShow, axisModel.get('axisLabel.show')); + /** + * @param {Object} finder contains {seriesIndex, dataIndex, dataIndexInside} + * @param {module:echarts/model/Global} ecModel + * @return {Object} {point: [x, y], el: ...} point Will not be null. + */ + module.exports = function (finder, ecModel) { + var point = []; + var seriesIndex = finder.seriesIndex; + var seriesModel; + if (seriesIndex == null || !( + seriesModel = ecModel.getSeriesByIndex(seriesIndex) + )) { + return {point: []}; + } - if (!show || axis.isBlank()) { - return; - } + var data = seriesModel.getData(); + var dataIndex = modelUtil.queryDataIndex(data, finder); + if (dataIndex == null || zrUtil.isArray(dataIndex)) { + return {point: []}; + } - var labelModel = axisModel.getModel('axisLabel'); - var textStyleModel = labelModel.getModel('textStyle'); - var labelMargin = labelModel.get('margin'); - var ticks = axis.scale.getTicks(); - var labels = axisModel.getFormattedLabels(); + var el = data.getItemGraphicEl(dataIndex); + var coordSys = seriesModel.coordinateSystem; - // Special label rotate. - var labelRotation = retrieve(opt.labelRotation, labelModel.get('rotate')) || 0; - // To radian. - labelRotation = labelRotation * PI / 180; + if (seriesModel.getTooltipPosition) { + point = seriesModel.getTooltipPosition(dataIndex) || []; + } + else if (coordSys && coordSys.dataToPoint) { + point = coordSys.dataToPoint( + data.getValues( + zrUtil.map(coordSys.dimensions, function (dim) { + return seriesModel.coordDimToDataDim(dim)[0]; + }), dataIndex, true + ) + ) || []; + } + else if (el) { + // Use graphic bounding rect + var rect = el.getBoundingRect().clone(); + rect.applyTransform(el.transform); + point = [ + rect.x + rect.width / 2, + rect.y + rect.height / 2 + ]; + } - var labelLayout = innerTextLayout(opt, labelRotation, opt.labelDirection); - var categoryData = axisModel.get('data'); + return {point: point, el: el}; + }; - var textEls = []; - var silent = isSilent(axisModel); - var triggerEvent = axisModel.get('triggerEvent'); - zrUtil.each(ticks, function (tickVal, index) { - if (ifIgnoreOnTick(axis, index, opt.labelInterval)) { - return; - } - var itemTextStyleModel = textStyleModel; - if (categoryData && categoryData[tickVal] && categoryData[tickVal].textStyle) { - itemTextStyleModel = new Model( - categoryData[tickVal].textStyle, textStyleModel, axisModel.ecModel - ); - } - var textColor = itemTextStyleModel.getTextColor() - || axisModel.get('axisLine.lineStyle.color'); - var tickCoord = axis.dataToCoord(tickVal); - var pos = [ - tickCoord, - opt.labelOffset + opt.labelDirection * labelMargin - ]; - var labelBeforeFormat = axis.scale.getLabel(tickVal); +/***/ }, +/* 145 */ +/***/ function(module, exports, __webpack_require__) { - var textEl = new graphic.Text({ + - // Id for animation - anid: 'label_' + tickVal, + var echarts = __webpack_require__(1); - style: { - text: labels[index], - textAlign: itemTextStyleModel.get('align', true) || labelLayout.textAlign, - textVerticalAlign: itemTextStyleModel.get('baseline', true) || labelLayout.verticalAlign, - textFont: itemTextStyleModel.getFont(), - fill: typeof textColor === 'function' ? textColor(labelBeforeFormat) : textColor - }, - position: pos, - rotation: labelLayout.rotation, - silent: silent, - z2: 10 - }); + var AxisPointerModel = echarts.extendComponentModel({ - // Pack data for mouse event - if (triggerEvent) { - textEl.eventData = makeAxisEventDataBase(axisModel); - textEl.eventData.targetType = 'axisLabel'; - textEl.eventData.value = labelBeforeFormat; - } + type: 'axisPointer', - // FIXME - this._dumbGroup.add(textEl); - textEl.updateTransform(); + coordSysAxesInfo: null, - textEls.push(textEl); - this.group.add(textEl); + defaultOption: { + // 'auto' means that show when triggered by tooltip or handle. + show: 'auto', + // 'click' | 'mousemove' | 'none' + triggerOn: null, // set default in AxisPonterView.js - textEl.decomposeTransform(); + zlevel: 0, + z: 50, + + type: 'line', + // axispointer triggered by tootip determine snap automatically, + // see `modelHelper`. + snap: false, + triggerTooltip: true, + + value: null, + status: null, // Init value depends on whether handle is used. + + // [group0, group1, ...] + // Each group can be: { + // mapper: function () {}, + // singleTooltip: 'multiple', // 'multiple' or 'single' + // xAxisId: ..., + // yAxisName: ..., + // angleAxisIndex: ... + // } + // mapper: can be ignored. + // input: {axisInfo, value} + // output: {axisInfo, value} + link: [], - }, this); + // Do not set 'auto' here, otherwise global animation: false + // will not effect at this axispointer. + animation: null, + animationDurationUpdate: 200, - function isTwoLabelOverlapped(current, next) { - var firstRect = current && current.getBoundingRect().clone(); - var nextRect = next && next.getBoundingRect().clone(); - if (firstRect && nextRect) { - firstRect.applyTransform(current.getLocalTransform()); - nextRect.applyTransform(next.getLocalTransform()); - return firstRect.intersect(nextRect); - } - } + lineStyle: { + color: '#aaa', + width: 1, + type: 'solid' + }, - // If min or max are user set, we need to check - // If the tick on min(max) are overlap on their neighbour tick - // If they are overlapped, we need to hide the min(max) tick label - if (axisModel.getMin() != null) { - var firstLabel = textEls[0]; - var nextLabel = textEls[1]; - if (isTwoLabelOverlapped(firstLabel, nextLabel)) { - firstLabel.ignore = true; - } - } - if (axisModel.getMax() != null) { - var lastLabel = textEls[textEls.length - 1]; - var prevLabel = textEls[textEls.length - 2]; - if (isTwoLabelOverlapped(prevLabel, lastLabel)) { - lastLabel.ignore = true; - } - } - }, + shadowStyle: { + color: 'rgba(150,150,150,0.3)' + }, - /** - * @private - */ - axisName: function () { - var opt = this.opt; - var axisModel = this.axisModel; - var name = retrieve(opt.axisName, axisModel.get('name')); + label: { + show: true, + formatter: null, // string | Function + precision: 'auto', // Or a number like 0, 1, 2 ... + margin: 3, + textStyle: { + color: '#fff' + }, + padding: [5, 7, 5, 7], + backgroundColor: 'auto', // default: axis line color + borderColor: null, + borderWidth: 0, + shadowBlur: 3, + shadowColor: '#aaa' + // Considering applicability, common style should + // better not have shadowOffset. + // shadowOffsetX: 0, + // shadowOffsetY: 2 + }, - if (!name) { - return; + handle: { + show: false, + icon: 'M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4h1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7V23h6.6V24.4z M13.3,19.6H6.7v-1.4h6.6V19.6z', // jshint ignore:line + size: 45, + // handle margin is from symbol center to axis, which is stable when circular move. + margin: 50, + // color: '#1b8bbd' + // color: '#2f4554' + color: '#333', + shadowBlur: 3, + shadowColor: '#aaa', + shadowOffsetX: 0, + shadowOffsetY: 2, + + // For mobile performance + throttle: 40 } + } - var nameLocation = axisModel.get('nameLocation'); - var nameDirection = opt.nameDirection; - var textStyleModel = axisModel.getModel('nameTextStyle'); - var gap = axisModel.get('nameGap') || 0; + }); - var extent = this.axisModel.axis.getExtent(); - var gapSignal = extent[0] > extent[1] ? -1 : 1; - var pos = [ - nameLocation === 'start' - ? extent[0] - gapSignal * gap - : nameLocation === 'end' - ? extent[1] + gapSignal * gap - : (extent[0] + extent[1]) / 2, // 'middle' - // Reuse labelOffset. - nameLocation === 'middle' ? opt.labelOffset + nameDirection * gap : 0 - ]; + module.exports = AxisPointerModel; - var labelLayout; - var nameRotation = axisModel.get('nameRotate'); - if (nameRotation != null) { - nameRotation = nameRotation * PI / 180; // To radian. - } - var axisNameAvailableWidth; +/***/ }, +/* 146 */ +/***/ function(module, exports, __webpack_require__) { - if (nameLocation === 'middle') { - labelLayout = innerTextLayout( - opt, - nameRotation != null ? nameRotation : opt.rotation, // Adapt to axis. - nameDirection - ); - } - else { - labelLayout = endTextLayout( - opt, nameLocation, nameRotation || 0, extent - ); + - axisNameAvailableWidth = opt.axisNameAvailableWidth; - if (axisNameAvailableWidth != null) { - axisNameAvailableWidth = Math.abs( - axisNameAvailableWidth / Math.sin(labelLayout.rotation) - ); - !isFinite(axisNameAvailableWidth) && (axisNameAvailableWidth = null); - } - } + var globalListener = __webpack_require__(147); - var textFont = textStyleModel.getFont(); + var AxisPonterView = __webpack_require__(1).extendComponentView({ - var truncateOpt = axisModel.get('nameTruncate', true) || {}; - var ellipsis = truncateOpt.ellipsis; - var maxWidth = retrieve(truncateOpt.maxWidth, axisNameAvailableWidth); - var truncatedText = (ellipsis != null && maxWidth != null) - ? formatUtil.truncateText( - name, maxWidth, textFont, ellipsis, - {minChar: 2, placeholder: truncateOpt.placeholder} - ) - : name; + type: 'axisPointer', - var tooltipOpt = axisModel.get('tooltip', true); + render: function (globalAxisPointerModel, ecModel, api) { + var globalTooltipModel = ecModel.getComponent('tooltip'); + var triggerOn = globalAxisPointerModel.get('triggerOn') + || (globalTooltipModel && globalTooltipModel.get('triggerOn') || 'mousemove|click'); - var mainType = axisModel.mainType; - var formatterParams = { - componentType: mainType, - name: name, - $vars: ['name'] - }; - formatterParams[mainType + 'Index'] = axisModel.componentIndex; + // Register global listener in AxisPointerView to enable + // AxisPointerView to be independent to Tooltip. + globalListener.register( + 'axisPointer', + api, + function (currTrigger, e, dispatchAction) { + // If 'none', it is not controlled by mouse totally. + if (triggerOn !== 'none' + && (currTrigger === 'leave' || triggerOn.indexOf(currTrigger) >= 0) + ) { + dispatchAction({ + type: 'updateAxisPointer', + currTrigger: currTrigger, + x: e && e.offsetX, + y: e && e.offsetY + }); + } + } + ); + }, - var textEl = new graphic.Text({ + /** + * @override + */ + remove: function (ecModel, api) { + globalListener.disopse(api.getZr(), 'axisPointer'); + AxisPonterView.superApply(this._model, 'remove', arguments); + }, - // Id for animation - anid: 'name', + /** + * @override + */ + dispose: function (ecModel, api) { + globalListener.unregister('axisPointer', api); + AxisPonterView.superApply(this._model, 'dispose', arguments); + } - __fullText: name, - __truncatedText: truncatedText, + }); - style: { - text: truncatedText, - textFont: textFont, - fill: textStyleModel.getTextColor() - || axisModel.get('axisLine.lineStyle.color'), - textAlign: labelLayout.textAlign, - textVerticalAlign: labelLayout.verticalAlign - }, - position: pos, - rotation: labelLayout.rotation, - silent: isSilent(axisModel), - z2: 1, - tooltip: (tooltipOpt && tooltipOpt.show) - ? zrUtil.extend({ - content: name, - formatter: function () { - return name; - }, - formatterParams: formatterParams - }, tooltipOpt) - : null - }); - if (axisModel.get('triggerEvent')) { - textEl.eventData = makeAxisEventDataBase(axisModel); - textEl.eventData.targetType = 'axisName'; - textEl.eventData.name = name; - } - // FIXME - this._dumbGroup.add(textEl); - textEl.updateTransform(); +/***/ }, +/* 147 */ +/***/ function(module, exports, __webpack_require__) { - this.group.add(textEl); + - textEl.decomposeTransform(); - } + var env = __webpack_require__(2); + var zrUtil = __webpack_require__(4); + var get = __webpack_require__(5).makeGetter(); - }; + var each = zrUtil.each; + + var globalListener = {}; /** - * @inner + * @param {string} key + * @param {module:echarts/ExtensionAPI} api + * @param {Function} handler + * param: {string} currTrigger + * param: {Array.} point */ - function innerTextLayout(opt, textRotation, direction) { - var rotationDiff = remRadian(textRotation - opt.rotation); - var textAlign; - var verticalAlign; - - if (isRadianAroundZero(rotationDiff)) { // Label is parallel with axis line. - verticalAlign = direction > 0 ? 'top' : 'bottom'; - textAlign = 'center'; - } - else if (isRadianAroundZero(rotationDiff - PI)) { // Label is inverse parallel with axis line. - verticalAlign = direction > 0 ? 'bottom' : 'top'; - textAlign = 'center'; + globalListener.register = function (key, api, handler) { + if (env.node) { + return; } - else { - verticalAlign = 'middle'; - if (rotationDiff > 0 && rotationDiff < PI) { - textAlign = direction > 0 ? 'right' : 'left'; - } - else { - textAlign = direction > 0 ? 'left' : 'right'; - } + var zr = api.getZr(); + get(zr).records || (get(zr).records = {}); + + initGlobalListeners(zr, api); + + var record = get(zr).records[key] || (get(zr).records[key] = {}); + record.handler = handler; + }; + + function initGlobalListeners(zr, api) { + if (get(zr).initialized) { + return; } - return { - rotation: rotationDiff, - textAlign: textAlign, - verticalAlign: verticalAlign - }; + get(zr).initialized = true; + + useHandler('click', zrUtil.curry(doEnter, 'click')); + useHandler('mousemove', zrUtil.curry(doEnter, 'mousemove')); + // useHandler('mouseout', onLeave); + useHandler('globalout', onLeave); + + function useHandler(eventType, cb) { + zr.on(eventType, function (e) { + var dis = makeDispatchAction(api); + + each(get(zr).records, function (record) { + record && cb(record, e, dis.dispatchAction); + }); + + dispatchTooltipFinally(dis.pendings, api); + }); + } } - /** - * @inner - */ - function endTextLayout(opt, textPosition, textRotate, extent) { - var rotationDiff = remRadian(textRotate - opt.rotation); - var textAlign; - var verticalAlign; - var inverse = extent[0] > extent[1]; - var onLeft = (textPosition === 'start' && !inverse) - || (textPosition !== 'start' && inverse); + function dispatchTooltipFinally(pendings, api) { + var showLen = pendings.showTip.length; + var hideLen = pendings.hideTip.length; - if (isRadianAroundZero(rotationDiff - PI / 2)) { - verticalAlign = onLeft ? 'bottom' : 'top'; - textAlign = 'center'; + var actuallyPayload; + if (showLen) { + actuallyPayload = pendings.showTip[showLen - 1]; } - else if (isRadianAroundZero(rotationDiff - PI * 1.5)) { - verticalAlign = onLeft ? 'top' : 'bottom'; - textAlign = 'center'; + else if (hideLen) { + actuallyPayload = pendings.hideTip[hideLen - 1]; } - else { - verticalAlign = 'middle'; - if (rotationDiff < PI * 1.5 && rotationDiff > PI / 2) { - textAlign = onLeft ? 'left' : 'right'; + if (actuallyPayload) { + actuallyPayload.dispatchAction = null; + api.dispatchAction(actuallyPayload); + } + } + + function onLeave(record, e, dispatchAction) { + record.handler('leave', null, dispatchAction); + } + + function doEnter(currTrigger, record, e, dispatchAction) { + record.handler(currTrigger, e, dispatchAction); + } + + function makeDispatchAction(api) { + var pendings = { + showTip: [], + hideTip: [] + }; + // FIXME + // better approach? + // 'showTip' and 'hideTip' can be triggered by axisPointer and tooltip, + // which may be conflict, (axisPointer call showTip but tooltip call hideTip); + // So we have to add "final stage" to merge those dispatched actions. + var dispatchAction = function (payload) { + var pendingList = pendings[payload.type]; + if (pendingList) { + pendingList.push(payload); } else { - textAlign = onLeft ? 'right' : 'left'; + payload.dispatchAction = dispatchAction; + api.dispatchAction(payload); } - } + }; return { - rotation: rotationDiff, - textAlign: textAlign, - verticalAlign: verticalAlign + dispatchAction: dispatchAction, + pendings: pendings }; } /** - * @inner - */ - function isSilent(axisModel) { - var tooltipOpt = axisModel.get('tooltip'); - return axisModel.get('silent') - // Consider mouse cursor, add these restrictions. - || !( - axisModel.get('triggerEvent') || (tooltipOpt && tooltipOpt.show) - ); - } - - /** - * @static - */ - var ifIgnoreOnTick = AxisBuilder.ifIgnoreOnTick = function (axis, i, interval) { - var rawTick; - var scale = axis.scale; - return scale.type === 'ordinal' - && ( - typeof interval === 'function' - ? ( - rawTick = scale.getTicks()[i], - !interval(rawTick, scale.getLabel(rawTick)) - ) - : i % (interval + 1) - ); - }; - - /** - * @static + * @param {string} key + * @param {module:echarts/ExtensionAPI} api */ - var getInterval = AxisBuilder.getInterval = function (model, labelInterval) { - var interval = model.get('interval'); - if (interval == null || interval == 'auto') { - interval = labelInterval; + globalListener.unregister = function (key, api) { + if (env.node) { + return; + } + var zr = api.getZr(); + var record = (get(zr).records || {})[key]; + if (record) { + get(zr).records[key] = null; } - return interval; }; - module.exports = AxisBuilder; - + module.exports = globalListener; /***/ }, -/* 134 */ +/* 148 */ /***/ function(module, exports, __webpack_require__) { var zrUtil = __webpack_require__(4); - __webpack_require__(114); + __webpack_require__(124); - __webpack_require__(135); - __webpack_require__(137); + __webpack_require__(149); + __webpack_require__(151); - var barLayoutGrid = __webpack_require__(140); + var barLayoutGrid = __webpack_require__(154); var echarts = __webpack_require__(1); echarts.registerLayout(zrUtil.curry(barLayoutGrid, 'bar')); @@ -29261,16 +31990,16 @@ return /******/ (function(modules) { // webpackBootstrap }); // In case developer forget to include grid component - __webpack_require__(113); + __webpack_require__(122); /***/ }, -/* 135 */ +/* 149 */ /***/ function(module, exports, __webpack_require__) { - module.exports = __webpack_require__(136).extend({ + module.exports = __webpack_require__(150).extend({ type: 'series.bar', @@ -29281,7 +32010,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 136 */ +/* 150 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -29356,21 +32085,21 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 137 */ +/* 151 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var zrUtil = __webpack_require__(4); - var graphic = __webpack_require__(43); - var helper = __webpack_require__(138); + var graphic = __webpack_require__(44); + var helper = __webpack_require__(152); var BAR_BORDER_WIDTH_QUERY = ['itemStyle', 'normal', 'barBorderWidth']; // FIXME // Just for compatible with ec2. - zrUtil.extend(__webpack_require__(12).prototype, __webpack_require__(139)); + zrUtil.extend(__webpack_require__(12).prototype, __webpack_require__(153)); var BarView = __webpack_require__(1).extendChartView({ @@ -29544,13 +32273,13 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 138 */ +/* 152 */ /***/ function(module, exports, __webpack_require__) { var zrUtil = __webpack_require__(4); - var graphic = __webpack_require__(43); + var graphic = __webpack_require__(44); var helper = {}; @@ -29601,7 +32330,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 139 */ +/* 153 */ /***/ function(module, exports, __webpack_require__) { @@ -29635,7 +32364,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 140 */ +/* 154 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -29887,7 +32616,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 141 */ +/* 155 */ /***/ function(module, exports, __webpack_require__) { @@ -29895,10 +32624,10 @@ return /******/ (function(modules) { // webpackBootstrap var zrUtil = __webpack_require__(4); var echarts = __webpack_require__(1); - __webpack_require__(142); - __webpack_require__(144); + __webpack_require__(156); + __webpack_require__(158); - __webpack_require__(145)('pie', [{ + __webpack_require__(159)('pie', [{ type: 'pieToggleSelect', event: 'pieselectchanged', method: 'toggleSelected' @@ -29912,17 +32641,17 @@ return /******/ (function(modules) { // webpackBootstrap method: 'unSelect' }]); - echarts.registerVisual(zrUtil.curry(__webpack_require__(146), 'pie')); + echarts.registerVisual(zrUtil.curry(__webpack_require__(160), 'pie')); echarts.registerLayout(zrUtil.curry( - __webpack_require__(147), 'pie' + __webpack_require__(161), 'pie' )); - echarts.registerProcessor(zrUtil.curry(__webpack_require__(149), 'pie')); + echarts.registerProcessor(zrUtil.curry(__webpack_require__(163), 'pie')); /***/ }, -/* 142 */ +/* 156 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -29933,7 +32662,7 @@ return /******/ (function(modules) { // webpackBootstrap var modelUtil = __webpack_require__(5); var completeDimensions = __webpack_require__(103); - var dataSelectableMixin = __webpack_require__(143); + var dataSelectableMixin = __webpack_require__(157); var PieSeries = __webpack_require__(1).extendSeriesModel({ @@ -30072,7 +32801,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 143 */ +/* 157 */ /***/ function(module, exports, __webpack_require__) { /** @@ -30142,12 +32871,12 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 144 */ +/* 158 */ /***/ function(module, exports, __webpack_require__) { - var graphic = __webpack_require__(43); + var graphic = __webpack_require__(44); var zrUtil = __webpack_require__(4); /** @@ -30425,7 +33154,7 @@ return /******/ (function(modules) { // webpackBootstrap // Pie view - var Pie = __webpack_require__(42).extend({ + var Pie = __webpack_require__(43).extend({ type: 'pie', @@ -30548,7 +33277,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 145 */ +/* 159 */ /***/ function(module, exports, __webpack_require__) { @@ -30588,7 +33317,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 146 */ +/* 160 */ /***/ function(module, exports) { // Pick color from palette for each data item. @@ -30639,7 +33368,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 147 */ +/* 161 */ /***/ function(module, exports, __webpack_require__) { // TODO minAngle @@ -30648,7 +33377,7 @@ return /******/ (function(modules) { // webpackBootstrap var numberUtil = __webpack_require__(7); var parsePercent = numberUtil.parsePercent; - var labelLayout = __webpack_require__(148); + var labelLayout = __webpack_require__(162); var zrUtil = __webpack_require__(4); var PI2 = Math.PI * 2; @@ -30785,7 +33514,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 148 */ +/* 162 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -31016,7 +33745,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 149 */ +/* 163 */ /***/ function(module, exports) { diff --git a/dist/echarts.simple.min.js b/dist/echarts.simple.min.js index 4e52d3002f..fe6a9bc891 100644 --- a/dist/echarts.simple.min.js +++ b/dist/echarts.simple.min.js @@ -1,4 +1,4 @@ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.echarts=e():t.echarts=e()}(this,function(){return function(t){function e(i){if(n[i])return n[i].exports;var r=n[i]={exports:{},id:i,loaded:!1};return t[i].call(r.exports,r,r.exports,e),r.loaded=!0,r.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){t.exports=n(2),n(100),n(94),n(104),n(31)},function(t,e){function n(t){if(null==t||"object"!=typeof t)return t;var e=t,i=O.call(t);if("[object Array]"===i){e=[];for(var r=0,a=t.length;re.get("hoverLayerThreshold")&&!w.node&&n.traverse(function(t){t.isGroup||(t.useHoverLayer=!0)})}function x(t,e){var n=0;e.group.traverse(function(t){"group"===t.type||t.ignore||n++});var i=+t.get("progressive"),r=n>t.get("progressiveThreshold")&&i&&!w.node;r&&e.group.traverse(function(t){t.isGroup||(t.progressive=r?Math.floor(n++/i):-1,r&&t.stopAnimation(!0))});var a=t.get("blendMode")||null;e.group.traverse(function(t){t.isGroup||t.setStyle("blend",a)})}function _(t,e){var n=t.get("z"),i=t.get("zlevel");e.group.traverse(function(t){"group"!==t.type&&(null!=n&&(t.z=n),null!=i&&(t.zlevel=i))})}function b(t){function e(t,e){for(var n=0;ne.get("hoverLayerThreshold")&&!w.node&&n.traverse(function(t){t.isGroup||(t.useHoverLayer=!0)})}function x(t,e){var n=0;e.group.traverse(function(t){"group"===t.type||t.ignore||n++});var i=+t.get("progressive"),r=n>t.get("progressiveThreshold")&&i&&!w.node;r&&e.group.traverse(function(t){t.isGroup||(t.progressive=r?Math.floor(n++/i):-1,r&&t.stopAnimation(!0))});var a=t.get("blendMode")||null;e.group.traverse(function(t){t.isGroup||t.setStyle("blend",a)})}function _(t,e){var n=t.get("z"),i=t.get("zlevel");e.group.traverse(function(t){"group"!==t.type&&(null!=n&&(t.z=n),null!=i&&(t.zlevel=i))})}function b(t){function e(t,e){for(var n=0;n=0&&z.each(t,function(t){var r=t.coordinateSystem;if(r&&r.containPoint)n|=!!r.containPoint(e);else if("seriesModels"===i){var a=this._chartsMap[t.__viewId];a&&a.containPoint&&(n|=a.containPoint(e,t))}},this)},this),!!n},K.getVisual=function(t,e){var n=this._model;t=D.parseFinder(n,t,{defaultMainType:"series"});var i=t.seriesModel,r=i.getData(),a=t.hasOwnProperty("dataIndexInside")?t.dataIndexInside:t.hasOwnProperty("dataIndex")?r.indexOfRawIndex(t.dataIndex):null;return null!=a?r.getItemVisual(a,e):r.getVisual(e)};var J={update:function(t){var e=this._model,n=this._api,i=this._coordSysMgr,r=this._zr;if(e){e.restoreData(),i.create(this._model,this._api),d.call(this,e,n),p.call(this,e),i.update(e,n),v.call(this,e,t),m.call(this,e,t);var a=e.get("backgroundColor")||"transparent",o=r.painter;if(o.isSingleCanvas&&o.isSingleCanvas())r.configLayer(0,{clearColor:a});else{if(!w.canvasSupported){var s=N.parse(a);a=N.stringify(s,"rgb"),0===s[3]&&(a="transparent")}a.colorStops||a.image?(r.configLayer(0,{clearColor:a}),this[Y]=!0,this._dom.style.background="transparent"):(this[Y]&&r.configLayer(0,{clearColor:null}),this[Y]=!1,this._dom.style.background=a)}}},updateView:function(t){var e=this._model;e&&(e.eachSeries(function(t){t.getData().clearAllVisual()}),v.call(this,e,t),c.call(this,"updateView",e,t))},updateVisual:function(t){var e=this._model;e&&(e.eachSeries(function(t){t.getData().clearAllVisual()}),v.call(this,e,t,!0),c.call(this,"updateVisual",e,t))},updateLayout:function(t){var e=this._model;e&&(g.call(this,e,t),c.call(this,"updateLayout",e,t))},prepareAndUpdate:function(t){var e=this._model;f.call(this,"component",e),f.call(this,"chart",e),this.__lastOnlyGraphic?(F(this._componentsViews,function(n){var i=n.__model;i&&"graphic"===i.mainType&&(n.render(i,e,this._api,t),_(i,n))},this),this.__lastOnlyGraphic=!1):J.update.call(this,t)}};K.resize=function(t){this[X]=!0,this._zr.resize(t);var e=this._model&&this._model.resetOption("media"),n=e?"prepareAndUpdate":"update";J[n].call(this),this._loadingFX&&this._loadingFX.resize(),this[X]=!1;var i=t&&t.silent;h.call(this,i),u.call(this,i)},K.showLoading=function(t,e){if(z.isObject(t)&&(e=t,t=""),t=t||"default",this.hideLoading(),st[t]){var n=st[t](this._api,e),i=this._zr;this._loadingFX=n,i.add(n)}},K.hideLoading=function(){this._loadingFX&&this._zr.remove(this._loadingFX),this._loadingFX=null},K.makeActionFromEvent=function(t){var e=z.extend({},t);return e.type=nt[t.type],e},K.dispatchAction=function(t,e){if(z.isObject(e)||(e={silent:!!e}),et[t.type]){if(this[X])return void this._pendingActions.push(t);l.call(this,t,e.silent),e.flush?this._zr.flush(!0):e.flush!==!1&&w.browser.weChat&&this._throttledZrFlush(),h.call(this,e.silent),u.call(this,e.silent)}},K.on=i("on"),K.off=i("off"),K.one=i("one");var tt=["click","dblclick","mouseover","mouseout","mousemove","mousedown","mouseup","globalout","contextmenu"];K._initEvents=function(){F(tt,function(t){this._zr.on(t,function(e){var n,i=this.getModel(),r=e.target;if("globalout"===t)n={};else if(r&&null!=r.dataIndex){var a=r.dataModel||i.getSeriesByIndex(r.seriesIndex);n=a&&a.getDataParams(r.dataIndex,r.dataType)||{}}else r&&r.eventData&&(n=z.extend({},r.eventData));n&&(n.event=e,n.type=t,this.trigger(t,n))},this)},this),F(nt,function(t,e){this._messageCenter.on(e,function(t){this.trigger(e,t)},this)},this)},K.isDisposed=function(){return this._disposed},K.clear=function(){this.setOption({series:[]},!0)},K.dispose=function(){if(!this._disposed){this._disposed=!0;var t=this._api,e=this._model;F(this._componentsViews,function(n){n.dispose(e,t)}),F(this._chartsViews,function(n){n.dispose(e,t)}),this._zr.dispose(),delete lt[this.id]}},z.mixin(a,R);var et=[],nt={},it=[],rt=[],at=[],ot={},st={},lt={},ht={},ut=new Date-0,ct=new Date-0,ft="_echarts_instance_",dt={version:"3.4.0",dependencies:{zrender:"3.3.0"}};dt.init=function(t,e,n){var i=new a(t,e,n);return i.id="ec_"+ut++,lt[i.id]=i,t.setAttribute&&t.setAttribute(ft,i.id),b(i),i},dt.connect=function(t){if(z.isArray(t)){var e=t;t=null,z.each(e,function(e){null!=e.group&&(t=e.group)}),t=t||"g_"+ct++,z.each(e,function(e){e.group=t})}return ht[t]=!0,t},dt.disConnect=function(t){ht[t]=!1},dt.dispose=function(t){z.isDom(t)?t=dt.getInstanceByDom(t):"string"==typeof t&&(t=lt[t]),t instanceof a&&!t.isDisposed()&&t.dispose()},dt.getInstanceByDom=function(t){var e=t.getAttribute(ft);return lt[e]},dt.getInstanceById=function(t){return lt[t]},dt.registerTheme=function(t,e){ot[t]=e},dt.registerPreprocessor=function(t){rt.push(t)},dt.registerProcessor=function(t,e){"function"==typeof t&&(e=t,t=V),it.push({prio:t,func:e})},dt.registerAction=function(t,e,n){"function"==typeof e&&(n=e,e="");var i=z.isObject(t)?t.type:[t,t={event:e}][0];t.event=(t.event||i).toLowerCase(),e=t.event,z.assert(Q.test(i)&&Q.test(e)),et[i]||(et[i]={action:n,actionInfo:t}),nt[e]=i},dt.registerCoordinateSystem=function(t,e){S.register(t,e)},dt.registerLayout=function(t,e){"function"==typeof t&&(e=t,t=H),at.push({prio:t,func:e,isLayout:!0})},dt.registerVisual=function(t,e){"function"==typeof t&&(e=t,t=j),at.push({prio:t,func:e})},dt.registerLoading=function(t,e){st[t]=e},dt.extendComponentModel=function(t){return I.extend(t)},dt.extendComponentView=function(t){return L.extend(t)},dt.extendSeriesModel=function(t){return C.extend(t)},dt.extendChartView=function(t){return k.extend(t)},dt.setCanvasCreator=function(t){z.createCanvas=t},dt.registerVisual(W,n(139)),dt.registerPreprocessor(n(133)),dt.registerLoading("default",n(124)),dt.registerAction({type:"highlight",event:"highlight",update:"highlight"},z.noop),dt.registerAction({type:"downplay",event:"downplay",update:"downplay"},z.noop),dt.List=n(14),dt.Model=n(11),dt.graphic=n(3),dt.number=n(4),dt.format=n(8),dt.throttle=O.throttle,dt.matrix=n(20),dt.vector=n(5),dt.color=n(19),dt.util={},F(["map","each","filter","indexOf","inherits","reduce","filter","bind","curry","isArray","isString","isObject","isFunction","extend","defaults","clone"],function(t){dt.util[t]=z[t]}),dt.PRIORITY={PROCESSOR:{FILTER:V,STATISTIC:q},VISUAL:{LAYOUT:H,GLOBAL:W,CHART:j,COMPONENT:Z,BRUSH:U}},t.exports=dt},function(t,e,n){"use strict";function i(t){return null!=t&&"none"!=t}function r(t){return"string"==typeof t?_.lift(t,-.1):t}function a(t){if(t.__hoverStlDirty){var e=t.style.stroke,n=t.style.fill,a=t.__hoverStl;a.fill=a.fill||(i(n)?r(n):null),a.stroke=a.stroke||(i(e)?r(e):null);var o={};for(var s in a)a.hasOwnProperty(s)&&(o[s]=t.style[s]);t.__normalStl=o,t.__hoverStlDirty=!1}}function o(t){t.__isHover||(a(t),t.useHoverLayer?t.__zr&&t.__zr.addHover(t,t.__hoverStl):(t.setStyle(t.__hoverStl),t.z2+=1),t.__isHover=!0)}function s(t){if(t.__isHover){var e=t.__normalStl;t.useHoverLayer?t.__zr&&t.__zr.removeHover(t):(e&&t.setStyle(e),t.z2-=1),t.__isHover=!1}}function l(t){"group"===t.type?t.traverse(function(t){"group"!==t.type&&o(t)}):o(t)}function h(t){"group"===t.type?t.traverse(function(t){"group"!==t.type&&s(t)}):s(t)}function u(t,e){t.__hoverStl=t.hoverStyle||e||{},t.__hoverStlDirty=!0,t.__isHover&&a(t)}function c(t){this.__hoverSilentOnTouch&&t.zrByTouch||!this.__isEmphasis&&l(this)}function f(t){this.__hoverSilentOnTouch&&t.zrByTouch||!this.__isEmphasis&&h(this)}function d(){this.__isEmphasis=!0,l(this)}function p(){this.__isEmphasis=!1,h(this)}function g(t,e,n,i,r,a){"function"==typeof r&&(a=r,r=null);var o=i&&i.isAnimationEnabled();if(o){var s=t?"Update":"",l=i.getShallow("animationDuration"+s),h=i.getShallow("animationEasing"+s),u=i.getShallow("animationDelay"+s);"function"==typeof u&&(u=u(r,i.getAnimationDelayParams?i.getAnimationDelayParams(e,r):null)),"function"==typeof l&&(l=l(r)),l>0?e.animateTo(n,l,u||0,h,a):(e.attr(n),a&&a())}else e.attr(n),a&&a()}var v=n(1),m=n(169),y=Math.round,x=n(7),_=n(19),b=n(20),w=n(5),M={};M.Group=n(34),M.Image=n(49),M.Text=n(76),M.Circle=n(160),M.Sector=n(166),M.Ring=n(165),M.Polygon=n(162),M.Polyline=n(163),M.Rect=n(164),M.Line=n(161),M.BezierCurve=n(159),M.Arc=n(158),M.CompoundPath=n(153),M.LinearGradient=n(91),M.RadialGradient=n(154),M.BoundingRect=n(9),M.extendShape=function(t){return x.extend(t)},M.extendPath=function(t,e){return m.extendFromString(t,e)},M.makePath=function(t,e,n,i){var r=m.createFromString(t,e),a=r.getBoundingRect();if(n){var o=a.width/a.height;if("center"===i){var s,l=n.height*o;l<=n.width?s=n.height:(l=n.width,s=l/o);var h=n.x+n.width/2,u=n.y+n.height/2;n.x=h-l/2,n.y=u-s/2,n.width=l,n.height=s}M.resizePath(r,n)}return r},M.mergePath=m.mergePath,M.resizePath=function(t,e){if(t.applyTransform){var n=t.getBoundingRect(),i=n.calculateTransform(e);t.applyTransform(i)}},M.subPixelOptimizeLine=function(t){var e=M.subPixelOptimize,n=t.shape,i=t.style.lineWidth;return y(2*n.x1)===y(2*n.x2)&&(n.x1=n.x2=e(n.x1,i,!0)),y(2*n.y1)===y(2*n.y2)&&(n.y1=n.y2=e(n.y1,i,!0)),t},M.subPixelOptimizeRect=function(t){var e=M.subPixelOptimize,n=t.shape,i=t.style.lineWidth,r=n.x,a=n.y,o=n.width,s=n.height;return n.x=e(n.x,i,!0),n.y=e(n.y,i,!0),n.width=Math.max(e(r+o,i,!1)-n.x,0===o?0:1),n.height=Math.max(e(a+s,i,!1)-n.y,0===s?0:1),t},M.subPixelOptimize=function(t,e,n){var i=y(2*t);return(i+y(e))%2===0?i/2:(i+(n?1:-1))/2},M.setHoverStyle=function(t,e,n){t.__hoverSilentOnTouch=n&&n.hoverSilentOnTouch,"group"===t.type?t.traverse(function(t){"group"!==t.type&&u(t,e)}):u(t,e),t.on("mouseover",c).on("mouseout",f),t.on("emphasis",d).on("normal",p)},M.setText=function(t,e,n){var i=e.getShallow("position")||"inside",r=e.getShallow("offset"),a=i.indexOf("inside")>=0?"white":n,o=e.getModel("textStyle");v.extend(t,{textDistance:e.getShallow("distance")||5,textFont:o.getFont(),textPosition:i,textOffset:r,textFill:o.getTextColor()||a})},M.updateProps=function(t,e,n,i,r){g(!0,t,e,n,i,r)},M.initProps=function(t,e,n,i,r){g(!1,t,e,n,i,r)},M.getTransform=function(t,e){for(var n=b.identity([]);t&&t!==e;)b.mul(n,t.getLocalTransform(),n),t=t.parent;return n},M.applyTransform=function(t,e,n){return n&&(e=b.invert([],e)),w.applyTransform([],t,e)},M.transformDirection=function(t,e,n){var i=0===e[4]||0===e[5]||0===e[0]?1:Math.abs(2*e[4]/e[0]),r=0===e[4]||0===e[5]||0===e[2]?1:Math.abs(2*e[4]/e[2]),a=["left"===t?-i:"right"===t?i:0,"top"===t?-r:"bottom"===t?r:0];return a=M.applyTransform(a,e,n),Math.abs(a[0])>Math.abs(a[1])?a[0]>0?"right":"left":a[1]>0?"bottom":"top"},M.groupTransition=function(t,e,n,i){function r(t){var e={};return t.traverse(function(t){!t.isGroup&&t.anid&&(e[t.anid]=t)}),e}function a(t){var e={position:w.clone(t.position),rotation:t.rotation};return t.shape&&(e.shape=v.extend({},t.shape)),e}if(t&&e){var o=r(t);e.traverse(function(t){if(!t.isGroup&&t.anid){var e=o[t.anid];if(e){var i=a(t);t.attr(a(e)),M.updateProps(t,i,n,t.dataIndex)}}})}},t.exports=M},function(t,e){function n(t){return t.replace(/^\s+/,"").replace(/\s+$/,"")}var i={},r=1e-4;i.linearMap=function(t,e,n,i){var r=e[1]-e[0],a=n[1]-n[0];if(0===r)return 0===a?n[0]:(n[0]+n[1])/2;if(i)if(r>0){if(t<=e[0])return n[0];if(t>=e[1])return n[1]}else{if(t>=e[0])return n[0];if(t<=e[1])return n[1]}else{if(t===e[0])return n[0];if(t===e[1])return n[1]}return(t-e[0])/r*a+n[0]},i.parsePercent=function(t,e){switch(t){case"center":case"middle":t="50%";break;case"left":case"top":t="0%";break;case"right":case"bottom":t="100%"}return"string"==typeof t?n(t).match(/%$/)?parseFloat(t)/100*e:parseFloat(t):null==t?NaN:+t},i.round=function(t,e){return null==e&&(e=10),e=Math.min(Math.max(0,e),20),+(+t).toFixed(e)},i.asc=function(t){return t.sort(function(t,e){return t-e}),t},i.getPrecision=function(t){if(t=+t,isNaN(t))return 0;for(var e=1,n=0;Math.round(t*e)/e!==t;)e*=10,n++;return n},i.getPrecisionSafe=function(t){var e=t.toString(),n=e.indexOf(".");return n<0?0:e.length-1-n},i.getPixelPrecision=function(t,e){var n=Math.log,i=Math.LN10,r=Math.floor(n(t[1]-t[0])/i),a=Math.round(n(Math.abs(e[1]-e[0]))/i),o=Math.min(Math.max(-r+a,0),20);return isFinite(o)?o:20},i.MAX_SAFE_INTEGER=9007199254740991,i.remRadian=function(t){var e=2*Math.PI;return(t%e+e)%e},i.isRadianAroundZero=function(t){return t>-r&&t=0},t.exports=i},function(t,e){var n="undefined"==typeof Float32Array?Array:Float32Array,i={create:function(t,e){var i=new n(2);return null==t&&(t=0),null==e&&(e=0),i[0]=t,i[1]=e,i},copy:function(t,e){return t[0]=e[0],t[1]=e[1],t},clone:function(t){var e=new n(2);return e[0]=t[0],e[1]=t[1],e},set:function(t,e,n){return t[0]=e,t[1]=n,t},add:function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t},scaleAndAdd:function(t,e,n,i){return t[0]=e[0]+n[0]*i,t[1]=e[1]+n[1]*i,t},sub:function(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t},len:function(t){return Math.sqrt(this.lenSquare(t))},lenSquare:function(t){return t[0]*t[0]+t[1]*t[1]},mul:function(t,e,n){return t[0]=e[0]*n[0],t[1]=e[1]*n[1],t},div:function(t,e,n){return t[0]=e[0]/n[0],t[1]=e[1]/n[1],t},dot:function(t,e){return t[0]*e[0]+t[1]*e[1]},scale:function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t},normalize:function(t,e){var n=i.len(e);return 0===n?(t[0]=0,t[1]=0):(t[0]=e[0]/n,t[1]=e[1]/n),t},distance:function(t,e){return Math.sqrt((t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1]))},distanceSquare:function(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])},negate:function(t,e){return t[0]=-e[0],t[1]=-e[1],t},lerp:function(t,e,n,i){return t[0]=e[0]+i*(n[0]-e[0]),t[1]=e[1]+i*(n[1]-e[1]),t},applyTransform:function(t,e,n){var i=e[0],r=e[1];return t[0]=n[0]*i+n[2]*r+n[4],t[1]=n[1]*i+n[3]*r+n[5],t},min:function(t,e,n){return t[0]=Math.min(e[0],n[0]),t[1]=Math.min(e[1],n[1]),t},max:function(t,e,n){return t[0]=Math.max(e[0],n[0]),t[1]=Math.max(e[1],n[1]),t}};i.length=i.len,i.lengthSquare=i.lenSquare,i.dist=i.distance,i.distSquare=i.distanceSquare,t.exports=i},function(t,e,n){function i(t,e){return t&&t.hasOwnProperty(e)}var r=n(8),a=n(4),o=n(11),s=n(1),l=s.each,h=s.isObject,u={};u.normalizeToArray=function(t){return t instanceof Array?t:null==t?[]:[t]},u.defaultEmphasis=function(t,e){if(t){var n=t.emphasis=t.emphasis||{},i=t.normal=t.normal||{};l(e,function(t){var e=s.retrieve(n[t],i[t]);null!=e&&(n[t]=e)})}},u.LABEL_OPTIONS=["position","offset","show","textStyle","distance","formatter"],u.getDataItemValue=function(t){return t&&(null==t.value?t:t.value)},u.isDataItemOption=function(t){return h(t)&&!(t instanceof Array)},u.converDataValue=function(t,e){var n=e&&e.type;return"ordinal"===n?t:("time"!==n||isFinite(t)||null==t||"-"===t||(t=+a.parseDate(t)),null==t||""===t?NaN:+t)},u.createDataFormatModel=function(t,e){var n=new o;return s.mixin(n,u.dataFormatMixin),n.seriesIndex=e.seriesIndex,n.name=e.name||"",n.mainType=e.mainType,n.subType=e.subType,n.getData=function(){return t},n},u.dataFormatMixin={getDataParams:function(t,e){var n=this.getData(e),i=this.seriesIndex,r=this.name,a=this.getRawValue(t,e),o=n.getRawIndex(t),s=n.getName(t,!0),l=n.getRawDataItem(t);return{componentType:this.mainType,componentSubType:this.subType,seriesType:"series"===this.mainType?this.subType:null,seriesIndex:i,seriesName:r,name:s,dataIndex:o,data:l,dataType:e,value:a,color:n.getItemVisual(t,"color"),$vars:["seriesName","name","value"]}},getFormattedLabel:function(t,e,n,i){e=e||"normal";var a=this.getData(n),o=a.getItemModel(t),s=this.getDataParams(t,n);null!=i&&s.value instanceof Array&&(s.value=s.value[i]);var l=o.get(["label",e,"formatter"]);return"function"==typeof l?(s.status=e,l(s)):"string"==typeof l?r.formatTpl(l,s):void 0},getRawValue:function(t,e){var n=this.getData(e),i=n.getRawDataItem(t);if(null!=i)return!h(i)||i instanceof Array?i:i.value},formatTooltip:s.noop},u.mappingToExists=function(t,e){e=(e||[]).slice();var n=s.map(t||[],function(t,e){return{exist:t}});return l(e,function(t,i){if(h(t)){for(var r=0;r=n.length&&n.push({option:t})}}),n},u.makeIdAndName=function(t){var e={};l(t,function(t,n){var i=t.exist;i&&(e[i.id]=t)}),l(t,function(t,n){var i=t.option;s.assert(!i||null==i.id||!e[i.id]||e[i.id]===t,"id duplicates: "+(i&&i.id)),i&&null!=i.id&&(e[i.id]=t),!t.keyInfo&&(t.keyInfo={})}),l(t,function(t,n){var i=t.exist,r=t.option,a=t.keyInfo;if(h(r)){if(a.name=null!=r.name?r.name+"":i?i.name:"\0-",i)a.id=i.id;else if(null!=r.id)a.id=r.id+"";else{var o=0;do a.id="\0"+a.name+"\0"+o++;while(e[a.id])}e[a.id]=t}})},u.isIdInner=function(t){return h(t)&&t.id&&0===(t.id+"").indexOf("\0_ec_\0")},u.compressBatches=function(t,e){function n(t,e,n){for(var i=0,r=t.length;i1e-10&&(r.width+=a/o,r.height+=a/o,r.x-=a/o/2,r.y-=a/o/2)}return r}return t},contain:function(t,e){var n=this.transformCoordToLocal(t,e),i=this.getBoundingRect(),r=this.style;if(t=n[0],e=n[1],i.contain(t,e)){var a=this.path.data;if(r.hasStroke()){var o=r.lineWidth,l=r.strokeNoScale?this.getLineScale():1;if(l>1e-10&&(r.hasFill()||(o=Math.max(o,this.strokeContainThreshold)),s.containStroke(a,o/l,t,e)))return!0}if(r.hasFill())return s.contain(a,t,e)}return!1},dirty:function(t){null==t&&(t=!0),t&&(this.__dirtyPath=t,this._rect=null),this.__dirty=!0,this.__zr&&this.__zr.refresh(),this.__clipTarget&&this.__clipTarget.dirty()},animateShape:function(t){return this.animate("shape",t)},attrKV:function(t,e){"shape"===t?(this.setShape(e),this.__dirtyPath=!0,this._rect=null):r.prototype.attrKV.call(this,t,e)},setShape:function(t,e){var n=this.shape;if(n){if(a.isObject(t))for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);else n[t]=e;this.dirty(!0)}return this},getLineScale:function(){var t=this.transform;return t&&u(t[0]-1)>1e-10&&u(t[3]-1)>1e-10?Math.sqrt(u(t[0]*t[3]-t[2]*t[1])):1}},i.extend=function(t){var e=function(e){i.call(this,e),t.style&&this.style.extendFrom(t.style,!1);var n=t.shape;if(n){this.shape=this.shape||{};var r=this.shape;for(var a in n)!r.hasOwnProperty(a)&&n.hasOwnProperty(a)&&(r[a]=n[a])}t.init&&t.init.call(this,e)};a.inherits(e,i);for(var n in t)"style"!==n&&"shape"!==n&&(e.prototype[n]=t[n]);return e},a.inherits(i,r),t.exports=i},function(t,e,n){var i=n(1),r=n(4),a=n(17),o={};o.addCommas=function(t){return isNaN(t)?"-":(t=(t+"").split("."),t[0].replace(/(\d{1,3})(?=(?:\d{3})+(?!\d))/g,"$1,")+(t.length>1?"."+t[1]:""))},o.toCamelCase=function(t,e){return t=(t||"").toLowerCase().replace(/-(.)/g,function(t,e){return e.toUpperCase()}),e&&t&&(t=t.charAt(0).toUpperCase()+t.slice(1)),t},o.normalizeCssArray=function(t){var e=t.length;return"number"==typeof t?[t,t,t,t]:2===e?[t[0],t[1],t[0],t[1]]:3===e?[t[0],t[1],t[2],t[1]]:t};var s=o.encodeHTML=function(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")},l=["a","b","c","d","e","f","g"],h=function(t,e){return"{"+t+(null==e?"":e)+"}"};o.formatTpl=function(t,e,n){i.isArray(e)||(e=[e]);var r=e.length;if(!r)return"";for(var a=e[0].$vars||[],o=0;o=n.x&&t<=n.x+n.width&&e>=n.y&&e<=n.y+n.height},clone:function(){return new i(this.x,this.y,this.width,this.height)},copy:function(t){this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height},plain:function(){return{x:this.x,y:this.y,width:this.width,height:this.height}}},i.create=function(t){return new i(t.x,t.y,t.width,t.height)},t.exports=i},function(t,e){function n(t){var e={},n={},i=t.match(/Firefox\/([\d.]+)/),r=t.match(/MSIE\s([\d.]+)/)||t.match(/Trident\/.+?rv:(([\d.]+))/),a=t.match(/Edge\/([\d.]+)/),o=/micromessenger/i.test(t);return i&&(n.firefox=!0,n.version=i[1]),r&&(n.ie=!0,n.version=r[1]),a&&(n.edge=!0,n.version=a[1]),o&&(n.weChat=!0),{browser:n,os:e,node:!1,canvasSupported:!!document.createElement("canvas").getContext,touchEventsSupported:"ontouchstart"in window&&!n.ie&&!n.edge,pointerEventsSupported:"onpointerdown"in window&&(n.edge||n.ie&&n.version>=11)}}var i={};i="undefined"==typeof navigator?{browser:{},os:{},node:!0,canvasSupported:!0}:n(navigator.userAgent),t.exports=i},function(t,e,n){function i(t,e,n){this.parentModel=e,this.ecModel=n,this.option=t}function r(t,e,n){for(var i=0;ii||l.newline?(a=0,u=v,o+=s+n,s=d.height):s=Math.max(s,d.height)}else{var m=d.height+(g?-g.y+d.y:0);c=o+m,c>r||l.newline?(a+=s+n,o=0,c=m,s=d.width):s=Math.max(s,d.width)}l.newline||(f[0]=a,f[1]=o,"horizontal"===t?a=u+n:o=c+n)})}var r=n(1),a=n(9),o=n(4),s=n(8),l=o.parsePercent,h=r.each,u={},c=u.LOCATION_PARAMS=["left","right","top","bottom","width","height"];u.box=i,u.vbox=r.curry(i,"vertical"),u.hbox=r.curry(i,"horizontal"),u.getAvailableSize=function(t,e,n){var i=e.width,r=e.height,a=l(t.x,i),o=l(t.y,r),h=l(t.x2,i),u=l(t.y2,r);return(isNaN(a)||isNaN(parseFloat(t.x)))&&(a=0),(isNaN(h)||isNaN(parseFloat(t.x2)))&&(h=i),(isNaN(o)||isNaN(parseFloat(t.y)))&&(o=0),(isNaN(u)||isNaN(parseFloat(t.y2)))&&(u=r),n=s.normalizeCssArray(n||0),{width:Math.max(h-a-n[1]-n[3],0),height:Math.max(u-o-n[0]-n[2],0)}},u.getLayoutRect=function(t,e,n){n=s.normalizeCssArray(n||0);var i=e.width,r=e.height,o=l(t.left,i),h=l(t.top,r),u=l(t.right,i),c=l(t.bottom,r),f=l(t.width,i),d=l(t.height,r),p=n[2]+n[0],g=n[1]+n[3],v=t.aspect;switch(isNaN(f)&&(f=i-u-g-o),isNaN(d)&&(d=r-c-p-h),isNaN(f)&&isNaN(d)&&(v>i/r?f=.8*i:d=.8*r),null!=v&&(isNaN(f)&&(f=v*d),isNaN(d)&&(d=f/v)),isNaN(o)&&(o=i-u-f-g),isNaN(h)&&(h=r-c-d-p),t.left||t.right){case"center":o=i/2-f/2-n[3];break;case"right":o=i-f-g}switch(t.top||t.bottom){case"middle":case"center":h=r/2-d/2-n[0];break;case"bottom":h=r-d-p}o=o||0,h=h||0,isNaN(f)&&(f=i-o-(u||0)),isNaN(d)&&(d=r-h-(c||0));var m=new a(o+n[3],h+n[0],f,d);return m.margin=n,m},u.positionElement=function(t,e,n,i,o){var s=!o||!o.hv||o.hv[0],l=!o||!o.hv||o.hv[1],h=o&&o.boundingMode||"all";if(s||l){var c;if("raw"===h)c="group"===t.type?new a(0,0,+e.width||0,+e.height||0):t.getBoundingRect();else if(c=t.getBoundingRect(),t.needLocalTransform()){var f=t.getLocalTransform();c=c.clone(),c.applyTransform(f)}e=u.getLayoutRect(r.defaults({width:c.width, -height:c.height},e),n,i);var d=t.position,p=s?e.x-c.x:0,g=l?e.y-c.y:0;t.attr("position","raw"===h?[p,g]:[d[0]+p,d[1]+g])}},u.mergeLayoutParam=function(t,e,n){function i(i){var r={},s=0,l={},u=0,c=n.ignoreSize?1:2;if(h(i,function(e){l[e]=t[e]}),h(i,function(t){a(e,t)&&(r[t]=l[t]=e[t]),o(r,t)&&s++,o(l,t)&&u++}),u!==c&&s){if(s>=c)return r;for(var f=0;f=0;r--)i=a.merge(i,t[r],!0);l.set(this,"__defaultOption",i)}return l.get(this,"__defaultOption")},getReferringComponents:function(t){return this.ecModel.queryComponents({mainType:t,index:this.get(t+"Index",!0),id:this.get(t+"Id",!0)})}});l.enableClassManagement(u,{registerWhenExtend:!0}),s.enableSubTypeDefaulter(u),s.enableTopologicalTravel(u,i),a.mixin(u,n(129)),t.exports=u},function(t,e,n){(function(e){function i(t){return f.isArray(t)||(t=[t]),t}function r(t,e){var n=t.dimensions,i=new m(f.map(n,t.getDimensionInfo,t),t.hostModel);v(i,t);for(var r=i._storage={},a=t._storage,o=0;o=0?r[s]=new l.constructor(a[s].length):r[s]=a[s]}return i}var a="undefined",o="undefined"==typeof window?e:window,s=typeof o.Float64Array===a?Array:o.Float64Array,l=typeof o.Int32Array===a?Array:o.Int32Array,h={"float":s,"int":l,ordinal:Array,number:Array,time:Array},u=n(11),c=n(43),f=n(1),d=n(6),p=f.isObject,g=["stackedOn","hasItemOption","_nameList","_idList","_rawData"],v=function(t,e){f.each(g.concat(e.__wrappedMethods||[]),function(n){e.hasOwnProperty(n)&&(t[n]=e[n])}),t.__wrappedMethods=e.__wrappedMethods},m=function(t,e){t=t||["x","y"];for(var n={},i=[],r=0;r0&&(w+="__ec__"+u[b]),u[b]++),w&&(l[c]=w)}this._nameList=e,this._idList=l},y.count=function(){return this.indices.length},y.get=function(t,e,n){var i=this._storage,r=this.indices[e];if(null==r)return NaN;var a=i[t]&&i[t][r];if(n){var o=this._dimensionInfos[t];if(o&&o.stackable)for(var s=this.stackedOn;s;){var l=s.get(t,e);(a>=0&&l>0||a<=0&&l<0)&&(a+=l),s=s.stackedOn}}return a},y.getValues=function(t,e,n){var i=[];f.isArray(t)||(n=e,e=t,t=this.dimensions);for(var r=0,a=t.length;rl&&(l=a));return this._extent[t+!!e]=[s,l]}return[1/0,-(1/0)]},y.getSum=function(t,e){var n=this._storage[t],i=0;if(n)for(var r=0,a=this.count();rt))return a;r=a-1}}return-1},y.indexOfNearest=function(t,e,n,i){var r=this._storage,a=r[t];null==i&&(i=1/0);var o=-1;if(a)for(var s=Number.MAX_VALUE,l=0,h=this.count();l0)&&(s=c,o=l)}return o},y.getRawIndex=function(t){var e=this.indices[t];return null==e?-1:e},y.getRawDataItem=function(t){return this._rawData[this.getRawIndex(t)]},y.getName=function(t){return this._nameList[this.indices[t]]||""},y.getId=function(t){return this._idList[this.indices[t]]||this.getRawIndex(t)+""},y.each=function(t,e,n,r){"function"==typeof t&&(r=n,n=e,e=t,t=[]),t=f.map(i(t),this.getDimension,this);var a=[],o=t.length,s=this.indices;r=r||this;for(var l=0;lp-g&&(f=p-g,u.length=f);for(var v=0;v',g=this.name;return"\0-"===g&&(g=""),e?c+d(this.name)+" : "+l:(g&&d(g)+"
")+c+(h?d(h)+" : "+l:l)},isAnimationEnabled:function(){if(h.node)return!1;var t=this.getShallow("animation");return t&&this.getData().count()>this.getShallow("animationThreshold")&&(t=!1),t},restoreData:function(){c(this,"data",f(this,"dataBeforeProcessed").cloneShallow())},getColorFromPalette:function(t,e){var n=this.ecModel,i=l.getColorFromPalette.call(this,t,e);return i||(i=n.getColorFromPalette(t,e)),i},getAxisTooltipDataIndex:null,getTooltipPosition:null});i.mixin(g,o.dataFormatMixin),i.mixin(g,l),t.exports=g},function(t,e,n){function i(t,e){var n=t+":"+e;if(l[n])return l[n];for(var i=(t+"").split("\n"),r=0,a=0,o=i.length;au&&(h=0,l={}),h++,l[n]=r,r}function r(t,e,n,r){var a=((t||"")+"").split("\n").length,o=i(t,e),s=i("国",e),l=a*s,h=new f(0,0,o,l);switch(h.lineHeight=s,r){case"bottom":case"alphabetic":h.y-=s;break;case"middle":h.y-=s/2}switch(n){case"end":case"right":h.x-=h.width;break;case"center":h.x-=h.width/2}return h}function a(t,e,n,i){var r=e.x,a=e.y,o=e.height,s=e.width,l=n.height,h=o/2-l/2,u="left";switch(t){case"left":r-=i,a+=h,u="right";break;case"right":r+=i+s,a+=h,u="left";break;case"top":r+=s/2,a-=i+l,u="center";break;case"bottom":r+=s/2,a+=o+i,u="center";break;case"inside":r+=s/2,a+=h,u="center";break;case"insideLeft":r+=i,a+=h,u="left";break;case"insideRight":r+=s-i,a+=h,u="right";break;case"insideTop":r+=s/2,a+=i,u="center";break;case"insideBottom":r+=s/2,a+=o-l-i,u="center";break;case"insideTopLeft":r+=i,a+=i,u="left";break;case"insideTopRight":r+=s-i,a+=i,u="right";break;case"insideBottomLeft":r+=i,a+=o-l-i;break;case"insideBottomRight":r+=s-i,a+=o-l-i,u="right"}return{x:r,y:a,textAlign:u,textBaseline:"top"}}function o(t,e,n,r,a){if(!e)return"";a=a||{},r=d(r,"...");for(var o=d(a.maxIterations,2),l=d(a.minChar,0),h=i("国",n),u=i("a",n),c=d(a.placeholder,""),f=e=Math.max(0,e-1),p=0;p=u;p++)f-=u;var g=i(r);g>f&&(r="",g=0),f=e-g;for(var v=(t+"").split("\n"),p=0,m=v.length;p=o){y+=r;break}var b=0===_?s(y,f,u,h):x>0?Math.floor(y.length*f/x):0;y=y.substr(0,b),x=i(y,n)}""===y&&(y=c),v[p]=y}}return v.join("\n")}function s(t,e,n,i){for(var r=0,a=0,o=t.length;a-w&&tw||t<-w}function a(t,e,n,i,r){var a=1-r;return a*a*(a*t+3*r*e)+r*r*(r*i+3*a*n)}function o(t,e,n,i,r){var a=1-r;return 3*(((e-t)*a+2*(n-e)*r)*a+(i-n)*r*r)}function s(t,e,n,r,a,o){var s=r+3*(e-n)-t,l=3*(n-2*e+t),h=3*(e-t),u=t-a,c=l*l-3*s*h,f=l*h-9*s*u,d=h*h-3*l*u,p=0;if(i(c)&&i(f))if(i(l))o[0]=0;else{var g=-h/l;g>=0&&g<=1&&(o[p++]=g)}else{var v=f*f-4*c*d;if(i(v)){var m=f/c,g=-l/s+m,y=-m/2;g>=0&&g<=1&&(o[p++]=g),y>=0&&y<=1&&(o[p++]=y)}else if(v>0){var x=b(v),w=c*l+1.5*s*(-f+x),M=c*l+1.5*s*(-f-x);w=w<0?-_(-w,S):_(w,S),M=M<0?-_(-M,S):_(M,S);var g=(-l-(w+M))/(3*s);g>=0&&g<=1&&(o[p++]=g)}else{var A=(2*c*l-3*s*f)/(2*b(c*c*c)),I=Math.acos(A)/3,C=b(c),L=Math.cos(I),g=(-l-2*C*L)/(3*s),y=(-l+C*(L+T*Math.sin(I)))/(3*s),k=(-l+C*(L-T*Math.sin(I)))/(3*s);g>=0&&g<=1&&(o[p++]=g),y>=0&&y<=1&&(o[p++]=y),k>=0&&k<=1&&(o[p++]=k)}}return p}function l(t,e,n,a,o){var s=6*n-12*e+6*t,l=9*e+3*a-3*t-9*n,h=3*e-3*t,u=0;if(i(l)){if(r(s)){var c=-h/s;c>=0&&c<=1&&(o[u++]=c)}}else{var f=s*s-4*l*h;if(i(f))o[0]=-s/(2*l);else if(f>0){var d=b(f),c=(-s+d)/(2*l),p=(-s-d)/(2*l);c>=0&&c<=1&&(o[u++]=c),p>=0&&p<=1&&(o[u++]=p)}}return u}function h(t,e,n,i,r,a){var o=(e-t)*r+t,s=(n-e)*r+e,l=(i-n)*r+n,h=(s-o)*r+o,u=(l-s)*r+s,c=(u-h)*r+h;a[0]=t,a[1]=o,a[2]=h,a[3]=c,a[4]=c,a[5]=u,a[6]=l,a[7]=i}function u(t,e,n,i,r,o,s,l,h,u,c){var f,d,p,g,v,m=.005,y=1/0;A[0]=h,A[1]=u;for(var _=0;_<1;_+=.05)I[0]=a(t,n,r,s,_),I[1]=a(e,i,o,l,_),g=x(A,I),g=0&&g=0&&c<=1&&(o[u++]=c)}}else{var f=l*l-4*s*h;if(i(f)){var c=-l/(2*s);c>=0&&c<=1&&(o[u++]=c)}else if(f>0){var d=b(f),c=(-l+d)/(2*s),p=(-l-d)/(2*s);c>=0&&c<=1&&(o[u++]=c),p>=0&&p<=1&&(o[u++]=p)}}return u}function p(t,e,n){var i=t+n-2*e;return 0===i?.5:(t-e)/i}function g(t,e,n,i,r){var a=(e-t)*i+t,o=(n-e)*i+e,s=(o-a)*i+a;r[0]=t,r[1]=a,r[2]=s,r[3]=s,r[4]=o,r[5]=n}function v(t,e,n,i,r,a,o,s,l){var h,u=.005,f=1/0;A[0]=o,A[1]=s;for(var d=0;d<1;d+=.05){I[0]=c(t,n,r,d),I[1]=c(e,i,a,d);var p=x(A,I);p=0&&p255?255:t}function i(t){return t=Math.round(t),t<0?0:t>360?360:t}function r(t){return t<0?0:t>1?1:t}function a(t){return n(t.length&&"%"===t.charAt(t.length-1)?parseFloat(t)/100*255:parseInt(t,10))}function o(t){return r(t.length&&"%"===t.charAt(t.length-1)?parseFloat(t)/100:parseFloat(t))}function s(t,e,n){return n<0?n+=1:n>1&&(n-=1),6*n<1?t+(e-t)*n*6:2*n<1?e:3*n<2?t+(e-t)*(2/3-n)*6:t}function l(t,e,n){return t+(e-t)*n}function h(t){if(t){t+="";var e=t.replace(/ /g,"").toLowerCase();if(e in x)return x[e].slice();if("#"!==e.charAt(0)){var n=e.indexOf("("),i=e.indexOf(")");if(n!==-1&&i+1===e.length){var r=e.substr(0,n),s=e.substr(n+1,i-(n+1)).split(","),l=1;switch(r){case"rgba":if(4!==s.length)return;l=o(s.pop());case"rgb":if(3!==s.length)return;return[a(s[0]),a(s[1]),a(s[2]),l];case"hsla":if(4!==s.length)return;return s[3]=o(s[3]),u(s);case"hsl":if(3!==s.length)return;return u(s);default:return}}}else{if(4===e.length){var h=parseInt(e.substr(1),16);if(!(h>=0&&h<=4095))return;return[(3840&h)>>4|(3840&h)>>8,240&h|(240&h)>>4,15&h|(15&h)<<4,1]}if(7===e.length){var h=parseInt(e.substr(1),16);if(!(h>=0&&h<=16777215))return;return[(16711680&h)>>16,(65280&h)>>8,255&h,1]}}}}function u(t){var e=(parseFloat(t[0])%360+360)%360/360,i=o(t[1]),r=o(t[2]),a=r<=.5?r*(i+1):r+i-r*i,l=2*r-a,h=[n(255*s(l,a,e+1/3)),n(255*s(l,a,e)),n(255*s(l,a,e-1/3))];return 4===t.length&&(h[3]=t[3]),h}function c(t){if(t){var e,n,i=t[0]/255,r=t[1]/255,a=t[2]/255,o=Math.min(i,r,a),s=Math.max(i,r,a),l=s-o,h=(s+o)/2;if(0===l)e=0,n=0;else{n=h<.5?l/(s+o):l/(2-s-o);var u=((s-i)/6+l/2)/l,c=((s-r)/6+l/2)/l,f=((s-a)/6+l/2)/l;i===s?e=f-c:r===s?e=1/3+u-f:a===s&&(e=2/3+c-u),e<0&&(e+=1),e>1&&(e-=1)}var d=[360*e,n,h];return null!=t[3]&&d.push(t[3]),d}}function f(t,e){var n=h(t);if(n){for(var i=0;i<3;i++)e<0?n[i]=n[i]*(1-e)|0:n[i]=(255-n[i])*e+n[i]|0;return y(n,4===n.length?"rgba":"rgb")}}function d(t,e){var n=h(t);if(n)return((1<<24)+(n[0]<<16)+(n[1]<<8)+ +n[2]).toString(16).slice(1)}function p(t,e,i){if(e&&e.length&&t>=0&&t<=1){i=i||[0,0,0,0];var r=t*(e.length-1),a=Math.floor(r),o=Math.ceil(r),s=e[a],h=e[o],u=r-a;return i[0]=n(l(s[0],h[0],u)),i[1]=n(l(s[1],h[1],u)),i[2]=n(l(s[2],h[2],u)),i[3]=n(l(s[3],h[3],u)),i}}function g(t,e,i){if(e&&e.length&&t>=0&&t<=1){var a=t*(e.length-1),o=Math.floor(a),s=Math.ceil(a),u=h(e[o]),c=h(e[s]),f=a-o,d=y([n(l(u[0],c[0],f)),n(l(u[1],c[1],f)),n(l(u[2],c[2],f)),r(l(u[3],c[3],f))],"rgba");return i?{color:d,leftIndex:o,rightIndex:s,value:a}:d}}function v(t,e,n,r){if(t=h(t))return t=c(t),null!=e&&(t[0]=i(e)),null!=n&&(t[1]=o(n)),null!=r&&(t[2]=o(r)),y(u(t),"rgba")}function m(t,e){if(t=h(t),t&&null!=e)return t[3]=r(e),y(t,"rgba")}function y(t,e){var n=t[0]+","+t[1]+","+t[2];return"rgba"!==e&&"hsva"!==e&&"hsla"!==e||(n+=","+t[3]),e+"("+n+")"}var x={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};t.exports={parse:h,lift:f,toHex:d,fastMapToColor:p,mapToColor:g,modifyHSL:v,modifyAlpha:m,stringify:y}},function(t,e){var n="undefined"==typeof Float32Array?Array:Float32Array,i={create:function(){var t=new n(6);return i.identity(t),t},identity:function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t},copy:function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t},mul:function(t,e,n){var i=e[0]*n[0]+e[2]*n[1],r=e[1]*n[0]+e[3]*n[1],a=e[0]*n[2]+e[2]*n[3],o=e[1]*n[2]+e[3]*n[3],s=e[0]*n[4]+e[2]*n[5]+e[4],l=e[1]*n[4]+e[3]*n[5]+e[5];return t[0]=i,t[1]=r,t[2]=a,t[3]=o,t[4]=s,t[5]=l,t},translate:function(t,e,n){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4]+n[0],t[5]=e[5]+n[1],t},rotate:function(t,e,n){var i=e[0],r=e[2],a=e[4],o=e[1],s=e[3],l=e[5],h=Math.sin(n),u=Math.cos(n);return t[0]=i*u+o*h,t[1]=-i*h+o*u,t[2]=r*u+s*h,t[3]=-r*h+u*s,t[4]=u*a+h*l,t[5]=u*l-h*a,t},scale:function(t,e,n){var i=n[0],r=n[1];return t[0]=e[0]*i,t[1]=e[1]*r,t[2]=e[2]*i,t[3]=e[3]*r,t[4]=e[4]*i,t[5]=e[5]*r,t},invert:function(t,e){var n=e[0],i=e[2],r=e[4],a=e[1],o=e[3],s=e[5],l=n*o-a*i;return l?(l=1/l,t[0]=o*l,t[1]=-a*l,t[2]=-i*l,t[3]=n*l,t[4]=(i*s-o*r)*l,t[5]=(a*r-n*s)*l,t):null}};t.exports=i},function(t,e){var n=Array.prototype.slice,i=function(){this._$handlers={}};i.prototype={constructor:i,one:function(t,e,n){var i=this._$handlers;if(!e||!t)return this;i[t]||(i[t]=[]);for(var r=0;r3&&(e=n.call(e,1));for(var r=this._$handlers[t],a=r.length,o=0;o4&&(e=n.call(e,1,e.length-1));for(var r=e[e.length-1],a=this._$handlers[t],o=a.length,s=0;s0&&u>0&&!c&&(h=0),h<0&&u<0&&!f&&(u=0)),[h,u]},h.niceScaleExtent=function(t,e){var n=t.scale,i=h.getScaleExtent(t,e),r=null!=e.getMin(),a=null!=e.getMax(),o=e.get("splitNumber");"log"===n.type&&(n.base=e.get("logBase")),n.setExtent(i[0],i[1]),n.niceExtent(o,r,a);var s=e.get("minInterval");if(isFinite(s)&&!r&&!a&&"interval"===n.type){var l=n.getInterval(),u=Math.max(Math.abs(l),s)/l;i=n.getExtent();var c=(i[1]+i[0])/2;n.setExtent(u*(i[0]-c)+c,u*(i[1]-c)+c),n.niceExtent(o)}var l=e.get("interval");null!=l&&n.setInterval&&n.setInterval(l)},h.createScaleByModel=function(t,e){if(e=e||t.get("type"))switch(e){case"category":return new i(t.getCategories(),[1/0,-(1/0)]);case"value":return new r;default:return(a.getClass(e)||r).create(t)}},h.ifAxisCrossZero=function(t){var e=t.scale.getExtent(),n=e[0],i=e[1];return!(n>0&&i>0||n<0&&i<0)},h.getAxisLabelInterval=function(t,e,n,i){var r,a=0,o=0,s=1;e.length>40&&(s=Math.floor(e.length/40));for(var h=0;h1?s:(a+1)*s-1},h.getFormattedLabels=function(t,e){var n=t.scale,i=n.getTicksLabels(),r=n.getTicks();return"string"==typeof e?(e=function(t){return function(e){return t.replace("{value}",null!=e?e:"")}}(e),s.map(i,e)):"function"==typeof e?s.map(r,function(i,r){return e("category"===t.type?n.getLabel(i):i,r)},this):i},t.exports=h},function(t,e,n){"use strict";function i(){this._coordinateSystems=[]}var r=n(1),a={};i.prototype={constructor:i,create:function(t,e){var n=[];r.each(a,function(i,r){var a=i.create(t,e);n=n.concat(a||[])}),this._coordinateSystems=n},update:function(t,e){r.each(this._coordinateSystems,function(n){n.update&&n.update(t,e)})},getCoordinateSystems:function(){return this._coordinateSystems.slice()}},i.register=function(t,e){a[t]=e},i.get=function(t){return a[t]},t.exports=i},function(t,e,n){"use strict";var i=n(3),r=n(9),a=i.extendShape({type:"triangle", -shape:{cx:0,cy:0,width:0,height:0},buildPath:function(t,e){var n=e.cx,i=e.cy,r=e.width/2,a=e.height/2;t.moveTo(n,i-a),t.lineTo(n+r,i+a),t.lineTo(n-r,i+a),t.closePath()}}),o=i.extendShape({type:"diamond",shape:{cx:0,cy:0,width:0,height:0},buildPath:function(t,e){var n=e.cx,i=e.cy,r=e.width/2,a=e.height/2;t.moveTo(n,i-a),t.lineTo(n+r,i),t.lineTo(n,i+a),t.lineTo(n-r,i),t.closePath()}}),s=i.extendShape({type:"pin",shape:{x:0,y:0,width:0,height:0},buildPath:function(t,e){var n=e.x,i=e.y,r=e.width/5*3,a=Math.max(r,e.height),o=r/2,s=o*o/(a-o),l=i-a+o+s,h=Math.asin(s/o),u=Math.cos(h)*o,c=Math.sin(h),f=Math.cos(h);t.arc(n,l,o,Math.PI-h,2*Math.PI+h);var d=.6*o,p=.7*o;t.bezierCurveTo(n+u-c*d,l+s+f*d,n,i-p,n,i),t.bezierCurveTo(n,i-p,n-u+c*d,l+s+f*d,n-u,l+s),t.closePath()}}),l=i.extendShape({type:"arrow",shape:{x:0,y:0,width:0,height:0},buildPath:function(t,e){var n=e.height,i=e.width,r=e.x,a=e.y,o=i/3*2;t.moveTo(r,a),t.lineTo(r+o,a+n),t.lineTo(r,a+n/4*3),t.lineTo(r-o,a+n),t.lineTo(r,a),t.closePath()}}),h={line:i.Line,rect:i.Rect,roundRect:i.Rect,square:i.Rect,circle:i.Circle,diamond:o,pin:s,arrow:l,triangle:a},u={line:function(t,e,n,i,r){r.x1=t,r.y1=e+i/2,r.x2=t+n,r.y2=e+i/2},rect:function(t,e,n,i,r){r.x=t,r.y=e,r.width=n,r.height=i},roundRect:function(t,e,n,i,r){r.x=t,r.y=e,r.width=n,r.height=i,r.r=Math.min(n,i)/4},square:function(t,e,n,i,r){var a=Math.min(n,i);r.x=t,r.y=e,r.width=a,r.height=a},circle:function(t,e,n,i,r){r.cx=t+n/2,r.cy=e+i/2,r.r=Math.min(n,i)/2},diamond:function(t,e,n,i,r){r.cx=t+n/2,r.cy=e+i/2,r.width=n,r.height=i},pin:function(t,e,n,i,r){r.x=t+n/2,r.y=e+i/2,r.width=n,r.height=i},arrow:function(t,e,n,i,r){r.x=t+n/2,r.y=e+i/2,r.width=n,r.height=i},triangle:function(t,e,n,i,r){r.cx=t+n/2,r.cy=e+i/2,r.width=n,r.height=i}},c={};for(var f in h)h.hasOwnProperty(f)&&(c[f]=new h[f]);var d=i.extendShape({type:"symbol",shape:{symbolType:"",x:0,y:0,width:0,height:0},beforeBrush:function(){var t=this.style,e=this.shape;"pin"===e.symbolType&&"inside"===t.textPosition&&(t.textPosition=["50%","40%"],t.textAlign="center",t.textVerticalAlign="middle")},buildPath:function(t,e,n){var i=e.symbolType,r=c[i];"none"!==e.symbolType&&(r||(i="rect",r=c[i]),u[i](e.x,e.y,e.width,e.height,r.shape),r.buildPath(t,r.shape,n))}}),p=function(t){if("image"!==this.type){var e=this.style,n=this.shape;n&&"line"===n.symbolType?e.stroke=t:this.__isEmptyBrush?(e.stroke=t,e.fill="#fff"):(e.fill&&(e.fill=t),e.stroke&&(e.stroke=t)),this.dirty(!1)}},g={createSymbol:function(t,e,n,a,o,s){var l=0===t.indexOf("empty");l&&(t=t.substr(5,1).toLowerCase()+t.substr(6));var h;return h=0===t.indexOf("image://")?new i.Image({style:{image:t.slice(8),x:e,y:n,width:a,height:o}}):0===t.indexOf("path://")?i.makePath(t.slice(7),{},new r(e,n,a,o)):new d({shape:{symbolType:t,x:e,y:n,width:a,height:o}}),h.__isEmptyBrush=l,h.setColor=p,h.setColor(s),h}};t.exports=g},function(t,e,n){"use strict";function i(t){return t.getBoundingClientRect?t.getBoundingClientRect():{left:0,top:0}}function r(t,e,n,i){return n=n||{},i||!u.canvasSupported?a(t,e,n):u.browser.firefox&&null!=e.layerX&&e.layerX!==e.offsetX?(n.zrX=e.layerX,n.zrY=e.layerY):null!=e.offsetX?(n.zrX=e.offsetX,n.zrY=e.offsetY):a(t,e,n),n}function a(t,e,n){var r=i(t);n.zrX=e.clientX-r.left,n.zrY=e.clientY-r.top}function o(t,e,n){if(e=e||window.event,null!=e.zrX)return e;var i=e.type,a=i&&i.indexOf("touch")>=0;if(a){var o="touchend"!=i?e.targetTouches[0]:e.changedTouches[0];o&&r(t,o,e,n)}else r(t,e,e,n),e.zrDelta=e.wheelDelta?e.wheelDelta/120:-(e.detail||0)/3;return e}function s(t,e,n){c?t.addEventListener(e,n):t.attachEvent("on"+e,n)}function l(t,e,n){c?t.removeEventListener(e,n):t.detachEvent("on"+e,n)}var h=n(21),u=n(10),c="undefined"!=typeof window&&!!window.addEventListener,f=c?function(t){t.preventDefault(),t.stopPropagation(),t.cancelBubble=!0}:function(t){t.returnValue=!1,t.cancelBubble=!0};t.exports={clientToLocal:r,normalizeEvent:o,addEventListener:s,removeEventListener:l,stop:f,Dispatcher:h}},,function(t,e,n){function i(t,e,n,i){if(!e)return t;var s=r(e[0]),l=a.isArray(s)&&s.length||1;n=n||[],i=i||"extra";for(var h=0;hthis._ux||y(e-this._yi)>this._uy||this._len<5;return this.addData(l.L,t,e),this._ctx&&n&&(this._needsDash()?this._dashedLineTo(t,e):this._ctx.lineTo(t,e)),n&&(this._xi=t,this._yi=e),this},bezierCurveTo:function(t,e,n,i,r,a){return this.addData(l.C,t,e,n,i,r,a),this._ctx&&(this._needsDash()?this._dashedBezierTo(t,e,n,i,r,a):this._ctx.bezierCurveTo(t,e,n,i,r,a)),this._xi=r,this._yi=a,this},quadraticCurveTo:function(t,e,n,i){return this.addData(l.Q,t,e,n,i),this._ctx&&(this._needsDash()?this._dashedQuadraticTo(t,e,n,i):this._ctx.quadraticCurveTo(t,e,n,i)),this._xi=n,this._yi=i,this},arc:function(t,e,n,i,r,a){return this.addData(l.A,t,e,n,n,i,r-i,0,a?0:1),this._ctx&&this._ctx.arc(t,e,n,i,r,a),this._xi=g(r)*n+t,this._yi=v(r)*n+t,this},arcTo:function(t,e,n,i,r){return this._ctx&&this._ctx.arcTo(t,e,n,i,r),this},rect:function(t,e,n,i){return this._ctx&&this._ctx.rect(t,e,n,i),this.addData(l.R,t,e,n,i),this},closePath:function(){this.addData(l.Z);var t=this._ctx,e=this._x0,n=this._y0;return t&&(this._needsDash()&&this._dashedLineTo(e,n),t.closePath()),this._xi=e,this._yi=n,this},fill:function(t){t&&t.fill(),this.toStatic()},stroke:function(t){t&&t.stroke(),this.toStatic()},setLineDash:function(t){if(t instanceof Array){this._lineDash=t,this._dashIdx=0;for(var e=0,n=0;ne.length&&(this._expandData(),e=this.data);for(var n=0;n0&&g<=t||u<0&&g>=t||0==u&&(c>0&&v<=e||c<0&&v>=e);)i=this._dashIdx,n=o[i],g+=u*n,v+=c*n,this._dashIdx=(i+1)%y,u>0&&gl||c>0&&vh||s[i%2?"moveTo":"lineTo"](u>=0?d(g,t):p(g,t),c>=0?d(v,e):p(v,e));u=g-t,c=v-e,this._dashOffset=-m(u*u+c*c)},_dashedBezierTo:function(t,e,n,r,a,o){var s,l,h,u,c,f=this._dashSum,d=this._dashOffset,p=this._lineDash,g=this._ctx,v=this._xi,y=this._yi,x=i.cubicAt,_=0,b=this._dashIdx,w=p.length,M=0;for(d<0&&(d=f+d),d%=f,s=0;s<1;s+=.1)l=x(v,t,n,a,s+.1)-x(v,t,n,a,s),h=x(y,e,r,o,s+.1)-x(y,e,r,o,s),_+=m(l*l+h*h);for(;bd));b++);for(s=(M-d)/_;s<=1;)u=x(v,t,n,a,s),c=x(y,e,r,o,s),b%2?g.moveTo(u,c):g.lineTo(u,c),s+=p[b]/_,b=(b+1)%w;b%2!==0&&g.lineTo(a,o),l=a-u,h=o-c,this._dashOffset=-m(l*l+h*h)},_dashedQuadraticTo:function(t,e,n,i){var r=n,a=i;n=(n+2*t)/3,i=(i+2*e)/3,t=(this._xi+2*t)/3,e=(this._yi+2*e)/3,this._dashedBezierTo(t,e,n,i,r,a)},toStatic:function(){var t=this.data;t instanceof Array&&(t.length=this._len,x&&(this.data=new Float32Array(t)))},getBoundingRect:function(){h[0]=h[1]=c[0]=c[1]=Number.MAX_VALUE,u[0]=u[1]=f[0]=f[1]=-Number.MAX_VALUE;for(var t=this.data,e=0,n=0,i=0,s=0,d=0;dh||y(o-r)>u||f===c-1)&&(t.lineTo(a,o),i=a,r=o);break;case l.C:t.bezierCurveTo(s[f++],s[f++],s[f++],s[f++],s[f++],s[f++]),i=s[f-2],r=s[f-1];break;case l.Q:t.quadraticCurveTo(s[f++],s[f++],s[f++],s[f++]),i=s[f-2],r=s[f-1];break;case l.A:var p=s[f++],m=s[f++],x=s[f++],_=s[f++],b=s[f++],w=s[f++],M=s[f++],T=s[f++],S=x>_?x:_,A=x>_?1:x/_,I=x>_?_/x:1,C=Math.abs(x-_)>.001,L=b+w;C?(t.translate(p,m),t.rotate(M),t.scale(A,I),t.arc(0,0,S,b,L,1-T),t.scale(1/A,1/I),t.rotate(-M),t.translate(-p,-m)):t.arc(p,m,S,b,L,1-T),1==f&&(e=g(b)*x+p,n=v(b)*_+m),i=g(L)*x+p,r=v(L)*_+m;break;case l.R:e=i=s[f],n=r=s[f+1],t.rect(s[f++],s[f++],s[f++],s[f++]);break;case l.Z:t.closePath(),i=e,r=n}}}},_.CMD=l,t.exports=_},function(t,e,n){var i=n(1);t.exports=function(t){for(var e=0;e=0)){var o=this.getShallow(a);null!=o&&(n[t[r][0]]=o)}}return n}}},function(t,e,n){"use strict";var i=n(3),r=n(1),a=n(2);n(53),n(109),a.extendComponentView({type:"grid",render:function(t,e){this.group.removeAll(),t.get("show")&&this.group.add(new i.Rect({shape:t.coordinateSystem.getRect(),style:r.defaults({fill:t.get("backgroundColor")},t.getItemStyle()),silent:!0,z2:-1}))}}),a.registerPreprocessor(function(t){t.xAxis&&t.yAxis&&!t.grid&&(t.grid={})})},function(t,e,n){function i(){this._extent=[1/0,-(1/0)],this._interval=0,this.init&&this.init.apply(this,arguments)}var r=n(15),a=i.prototype;a.parse=function(t){return t},a.contain=function(t){var e=this._extent;return t>=e[0]&&t<=e[1]},a.normalize=function(t){var e=this._extent;return e[1]===e[0]?.5:(t-e[0])/(e[1]-e[0])},a.scale=function(t){var e=this._extent;return t*(e[1]-e[0])+e[0]},a.unionExtent=function(t){var e=this._extent;t[0]e[1]&&(e[1]=t[1])},a.unionExtentFromData=function(t,e){this.unionExtent(t.getDataExtent(e,!0))},a.getExtent=function(){return this._extent.slice()},a.setExtent=function(t,e){var n=this._extent;isNaN(t)||(n[0]=t),isNaN(e)||(n[1]=e)},a.getTicksLabels=function(){for(var t=[],e=this.getTicks(),n=0;n=0&&(n.splice(i,0,t),this._doAdd(t))}return this},_doAdd:function(t){t.parent&&t.parent.remove(t),t.parent=this;var e=this.__storage,n=this.__zr;e&&e!==t.__storage&&(e.addToMap(t),t instanceof o&&t.addChildrenToStorage(e)),n&&n.refresh()},remove:function(t){var e=this.__zr,n=this.__storage,r=this._children,a=i.indexOf(r,t);return a<0?this:(r.splice(a,1),t.parent=null,n&&(n.delFromMap(t.id),t instanceof o&&t.delChildrenFromStorage(n)),e&&e.refresh(),this)},removeAll:function(){var t,e,n=this._children,i=this.__storage;for(e=0;e=0&&r(t)?function(t,e,n,i){return f.isDataItemOption(t)&&(x.hasItemOption=!0),i===y?n:g(p(t),m[i])}:function(t,e,n,i){var r=p(t),a=g(r&&r[i],m[i]);f.isDataItemOption(t)&&(x.hasItemOption=!0);var o=s&&s.categoryAxesModels;return o&&o[e]&&"string"==typeof a&&(b[e]=b[e]||o[e].getCategories(),a=c.indexOf(b[e],a),a<0&&!isNaN(a)&&(a=+a)),a};return x.hasItemOption=!1,x.initData(t,_,w),x}function o(t){return"category"!==t&&"time"!==t}function s(t){return"category"===t?"ordinal":"time"===t?"time":"float"}function l(t,e){var n,i=[],r=t&&t.dimensions[t.categoryIndex];if(r&&(n=t.categoryAxesModels[r.name]),n){var a=n.getCategories();if(a){var o=e.length;if(c.isArray(e[0])&&e[0].length>1){i=[];for(var s=0;se[1]&&(e[1]=t[1]),u.prototype.setExtent.call(this,e[0],e[1])},getInterval:function(){return this._interval||this.niceTicks(),this._interval},setInterval:function(t){this._interval=t,this._niceExtent=this._extent.slice()},getTicks:function(){this._interval||this.niceTicks();var t=this._interval,e=this._extent,n=[],i=1e4;if(t){var r=this._niceExtent,a=l(t)+2;e[0]i)return[];e[1]>(n.length?n[n.length-1]:r[1])&&n.push(e[1])}return n},getTicksLabels:function(){for(var t=[],e=this.getTicks(),n=0;n=n&&t<=i},containData:function(t){return this.contain(this.dataToCoord(t))},getExtent:function(){var t=this._extent.slice();return t},getPixelPrecision:function(t){return r.getPixelPrecision(t||this.scale.getExtent(),this._extent)},setExtent:function(t,e){var n=this._extent;n[0]=t,n[1]=e},dataToCoord:function(t,e){var n=this._extent,r=this.scale;return t=r.normalize(t),this.onBand&&"ordinal"===r.type&&(n=n.slice(),i(n,r.count())),a(t,s,n,e)},coordToData:function(t,e){var n=this._extent,r=this.scale;this.onBand&&"ordinal"===r.type&&(n=n.slice(),i(n,r.count()));var o=a(t,n,s,e);return this.scale.scale(o)},getTicksCoords:function(t){if(this.onBand&&!t){for(var e=this.getBands(),n=[],i=0;i=0&&n.push(t)}),n}t.topologicalTravel=function(t,e,r,a){function o(t){h[t].entryCount--,0===h[t].entryCount&&u.push(t)}function s(t){c[t]=!0,o(t)}if(t.length){var l=n(e),h=l.graph,u=l.noEntryList,c={};for(i.each(t,function(t){c[t]=!0});u.length;){var f=u.pop(),d=h[f],p=!!c[f];p&&(r.call(a,f,d.originalDeps.slice()),delete c[f]),i.each(d.successor,p?s:o)}i.each(c,function(){throw new Error("Circle dependency may exists")})}}},t.exports=s},function(t,e){t.exports=function(t,e,n,i,r){i.eachRawSeriesByType(t,function(t){var r=t.getData(),a=t.get("symbol")||e,o=t.get("symbolSize");r.setVisual({legendSymbol:n||a,symbol:a,symbolSize:o}),i.isSeriesFiltered(t)||("function"==typeof o&&r.each(function(e){var n=t.getRawValue(e),i=t.getDataParams(e);r.setItemVisual(e,"symbolSize",o(n,i))}),r.each(function(t){var e=r.getItemModel(t),n=e.getShallow("symbol",!0),i=e.getShallow("symbolSize",!0);null!=n&&r.setItemVisual(t,"symbol",n),null!=i&&r.setItemVisual(t,"symbolSize",i)}))})}},function(t,e){function n(t){for(var e=0;t>=u;)e|=1&t,t>>=1;return t+e}function i(t,e,n,i){var a=e+1;if(a===n)return 1;if(i(t[a++],t[e])<0){for(;a=0;)a++;return a-e}function r(t,e,n){for(n--;e>>1,r(o,t[a])<0?l=a:s=a+1;var h=i-s;switch(h){case 3:t[s+3]=t[s+2];case 2:t[s+2]=t[s+1];case 1:t[s+1]=t[s];break;default:for(;h>0;)t[s+h]=t[s+h-1],h--}t[s]=o}}function o(t,e,n,i,r,a){var o=0,s=0,l=1;if(a(t,e[n+r])>0){for(s=i-r;l0;)o=l,l=(l<<1)+1,l<=0&&(l=s);l>s&&(l=s),o+=r,l+=r}else{for(s=r+1;ls&&(l=s);var h=o;o=r-l,l=r-h}for(o++;o>>1);a(t,e[n+u])>0?o=u+1:l=u}return l}function s(t,e,n,i,r,a){var o=0,s=0,l=1;if(a(t,e[n+r])<0){for(s=r+1;ls&&(l=s);var h=o;o=r-l,l=r-h}else{for(s=i-r;l=0;)o=l,l=(l<<1)+1,l<=0&&(l=s);l>s&&(l=s),o+=r,l+=r}for(o++;o>>1);a(t,e[n+u])<0?l=u:o=u+1}return l}function l(t,e){function n(t,e){u[y]=t,d[y]=e,y+=1}function i(){for(;y>1;){var t=y-2;if(t>=1&&d[t-1]<=d[t]+d[t+1]||t>=2&&d[t-2]<=d[t]+d[t-1])d[t-1]d[t+1])break;a(t)}}function r(){for(;y>1;){var t=y-2;t>0&&d[t-1]=c||g>=c);if(v)break;m<0&&(m=0),m+=2}if(p=m,p<1&&(p=1),1===i){for(l=0;l=0;l--)t[g+l]=t[d+l];return void(t[f]=x[u])}for(var v=p;;){var m=0,y=0,_=!1;do if(e(x[u],t[h])<0){if(t[f--]=t[h--],m++,y=0,0===--i){_=!0;break}}else if(t[f--]=x[u--],y++,m=0,1===--a){_=!0;break}while((m|y)=0;l--)t[g+l]=t[d+l];if(0===i){_=!0;break}}if(t[f--]=x[u--],1===--a){_=!0;break}if(y=a-o(t[h],x,0,a,a-1,e),0!==y){for(f-=y,u-=y,a-=y,g=f+1,d=u+1,l=0;l=c||y>=c);if(_)break;v<0&&(v=0),v+=2}if(p=v,p<1&&(p=1),1===a){for(f-=i,h-=i,g=f+1,d=h+1,l=i-1;l>=0;l--)t[g+l]=t[d+l];t[f]=x[u]}else{if(0===a)throw new Error;for(d=f-(a-1),l=0;l>>1);var x=[];m=g<120?5:g<1542?10:g<119151?19:40,u=[],d=[],this.mergeRuns=i,this.forceMergeRuns=r,this.pushRun=n}function h(t,e,r,o){r||(r=0),o||(o=t.length);var s=o-r;if(!(s<2)){var h=0;if(sf&&(d=f),a(t,r,r+d,r+h,e),h=d}c.pushRun(r,h),c.mergeRuns(),s-=h,r+=h}while(0!==s);c.forceMergeRuns()}}var u=32,c=7,f=256;t.exports=h},function(t,e){var n={},i="\0__throttleOriginMethod",r="\0__throttleRate",a="\0__throttleType";n.throttle=function(t,e,n){function i(){h=(new Date).getTime(),u=null,t.apply(o,s||[])}var r,a,o,s,l=0,h=0,u=null;e=e||0;var c=function(){r=(new Date).getTime(),o=this,s=arguments,a=r-(n?l:h)-e,clearTimeout(u),n?u=setTimeout(i,e):a>=0?i():u=setTimeout(i,-a),l=r};return c.clear=function(){u&&(clearTimeout(u),u=null)},c},n.createOrUpdate=function(t,e,o,s){var l=t[e];if(l){var h=l[i]||l,u=l[a],c=l[r];if(c!==o||u!==s){if(null==o||!s)return t[e]=h;l=t[e]=n.throttle(h,o,"debounce"===s),l[i]=h,l[a]=s,l[r]=o}return l}},n.clear=function(t,e){var n=t[e];n&&n[i]&&(t[e]=n[i])},t.exports=n},function(t,e,n){var i=n(33);t.exports=function(){if(0!==i.debugMode)if(1==i.debugMode)for(var t in arguments)throw new Error(arguments[t]);else if(i.debugMode>1)for(var t in arguments)console.log(arguments[t])}},function(t,e,n){function i(t){r.call(this,t)}var r=n(36),a=n(9),o=n(1),s=n(151),l=new s(50);i.prototype={constructor:i,type:"image",brush:function(t,e){var n,i=this.style,r=i.image;if(i.bind(t,this,e),n="string"==typeof r?this._image:r,!n&&r){var a=l.get(r);if(!a)return n=new Image,n.onload=function(){n.onload=null;for(var t=0;t0?"top":"bottom",i="center"):d(a-m)?(r=n>0?"bottom":"top",i="center"):(r="middle",i=a>0&&a0?"right":"left":n>0?"left":"right"),{rotation:a,textAlign:i,verticalAlign:r}}function a(t,e,n,i){var r,a,o=f(n-t.rotation),s=i[0]>i[1],l="start"===e&&!s||"start"!==e&&s;return d(o-m/2)?(a=l?"bottom":"top",r="center"):d(o-1.5*m)?(a=l?"top":"bottom",r="center"):(a="middle",r=o<1.5*m&&o>m/2?l?"left":"right":l?"right":"left"),{rotation:o,textAlign:r,verticalAlign:a}}function o(t){var e=t.get("tooltip");return t.get("silent")||!(t.get("triggerEvent")||e&&e.show)}var s=n(1),l=n(8),h=n(3),u=n(11),c=n(4),f=c.remRadian,d=c.isRadianAroundZero,p=n(5),g=p.applyTransform,v=s.retrieve,m=Math.PI,y=function(t,e){this.opt=e,this.axisModel=t,s.defaults(e,{labelOffset:0,nameDirection:1,tickDirection:1,labelDirection:1,silent:!0}),this.group=new h.Group;var n=new h.Group({position:e.position.slice(),rotation:e.rotation});n.updateTransform(),this._transform=n.transform,this._dumbGroup=n};y.prototype={constructor:y,hasBuilder:function(t){return!!x[t]},add:function(t){x[t].call(this)},getGroup:function(){return this.group}};var x={axisLine:function(){var t=this.opt,e=this.axisModel;if(e.get("axisLine.show")){var n=this.axisModel.axis.getExtent(),i=this._transform,r=[n[0],0],a=[n[1],0];i&&(g(r,r,i),g(a,a,i)),this.group.add(new h.Line(h.subPixelOptimizeLine({anid:"line",shape:{x1:r[0],y1:r[1],x2:a[0],y2:a[1]},style:s.extend({lineCap:"round"},e.getModel("axisLine.lineStyle").getLineStyle()),strokeContainThreshold:t.strokeContainThreshold||5,silent:!0,z2:1})))}},axisTick:function(){var t=this.axisModel,e=t.axis;if(t.get("axisTick.show")&&!e.isBlank())for(var n=t.getModel("axisTick"),i=this.opt,r=n.getModel("lineStyle"),a=n.get("length"),o=b(n,i.labelInterval),l=e.getTicksCoords(n.get("alignWithLabel")),u=e.scale.getTicks(),c=[],f=[],d=this._transform,p=0;pg[1]?-1:1,x=["start"===c?g[0]-y*p:"end"===c?g[1]+y*p:(g[0]+g[1])/2,"middle"===c?t.labelOffset+f*p:0],_=e.get("nameRotate");null!=_&&(_=_*m/180);var b;"middle"===c?u=r(t,null!=_?_:t.rotation,f):(u=a(t,c,_||0,g),b=t.axisNameAvailableWidth,null!=b&&(b=Math.abs(b/Math.sin(u.rotation)),!isFinite(b)&&(b=null)));var w=d.getFont(),M=e.get("nameTruncate",!0)||{},T=M.ellipsis,S=v(M.maxWidth,b),A=null!=T&&null!=S?l.truncateText(n,S,w,T,{minChar:2,placeholder:M.placeholder}):n,I=e.get("tooltip",!0),C=e.mainType,L={componentType:C,name:n,$vars:["name"]};L[C+"Index"]=e.componentIndex;var k=new h.Text({anid:"name",__fullText:n,__truncatedText:A,style:{text:A,textFont:w,fill:d.getTextColor()||e.get("axisLine.lineStyle.color"),textAlign:u.textAlign,textVerticalAlign:u.verticalAlign},position:x,rotation:u.rotation,silent:o(e),z2:1,tooltip:I&&I.show?s.extend({content:n,formatter:function(){return n},formatterParams:L},I):null});e.get("triggerEvent")&&(k.eventData=i(e),k.eventData.targetType="axisName",k.eventData.name=n),this._dumbGroup.add(k),k.updateTransform(),this.group.add(k),k.decomposeTransform()}}},_=y.ifIgnoreOnTick=function(t,e,n){var i,r=t.scale;return"ordinal"===r.type&&("function"==typeof n?(i=r.getTicks()[e],!n(i,r.getLabel(i))):e%(n+1))},b=y.getInterval=function(t,e){var n=t.get("interval");return null!=n&&"auto"!=n||(n=e),n};t.exports=y},function(t,e,n){function i(t){return r.isObject(t)&&null!=t.value?t.value:t}var r=n(1),a=n(22);t.exports={getFormattedLabels:function(){return a.getFormattedLabels(this.axis,this.get("axisLabel.formatter"))},getCategories:function(){return"category"===this.get("type")&&r.map(this.get("data"),i)},getMin:function(t){var e=this.option,n=t||null==e.rangeStart?e.min:e.rangeStart;return null==n||"dataMin"===n||r.eqNaN(n)||(n=this.axis.scale.parse(n)),n},getMax:function(t){var e=this.option,n=t||null==e.rangeEnd?e.max:e.rangeEnd;return null==n||"dataMax"===n||r.eqNaN(n)||(n=this.axis.scale.parse(n)),n},getNeedCrossZero:function(){var t=this.option;return null==t.rangeStart&&null==t.rangeEnd&&!t.scale},getCoordSysModel:r.noop,setRange:function(t,e){this.option.rangeStart=t,this.option.rangeEnd=e},resetRange:function(){this.option.rangeStart=this.option.rangeEnd=null}}},function(t,e,n){function i(t,e,n){return t.getCoordSysModel()===e}function r(t){var e,n=t.model,i=n.getFormattedLabels(),r=n.getModel("axisLabel.textStyle"),a=1,o=i.length;o>40&&(a=Math.ceil(o/40));for(var s=0;s.5?e:t}function s(t,e,n,i,r){var o=t.length;if(1==r)for(var s=0;sr;if(a)t.length=r;else for(var o=i;o=0&&!(A[n]<=e);n--);n=Math.min(n,x-2)}else{for(n=G;ne);n++);n=Math.min(n-1,x-2)}G=n,V=e;var i=A[n+1]-A[n];if(0!==i)if(z=(e-A[n])/i,m)if(R=I[n],N=I[0===n?n:n-1],B=I[n>x-2?x-1:n+1],F=I[n>x-3?x-1:n+2],w)u(N,R,B,F,z,z*z,z*z*z,f(t,r),S);else{var l;if(M)l=u(N,R,B,F,z,z*z,z*z*z,q,1),l=d(q);else{if(T)return o(R,B,z);l=c(N,R,B,F,z,z*z,z*z*z)}p(t,r,l)}else if(w)s(I[n],I[n+1],z,f(t,r),S);else{var l;if(M)s(I[n],I[n+1],z,q,1),l=d(q);else{if(T)return o(I[n],I[n+1],z);l=a(I[n],I[n+1],z)}p(t,r,l)}},W=new g({target:t._target,life:_,loop:t._loop,delay:t._delay,onframe:H,ondestroy:n});return e&&"spline"!==e&&(W.easing=e),W}}}var g=n(145),v=n(19),m=n(1),y=m.isArrayLike,x=Array.prototype.slice,_=function(t,e,n,a){this._tracks={},this._target=t,this._loop=e||!1,this._getter=n||i,this._setter=a||r,this._clipCount=0,this._delay=0,this._doneList=[],this._onframeList=[],this._clipList=[]};_.prototype={when:function(t,e){var n=this._tracks;for(var i in e)if(e.hasOwnProperty(i)){if(!n[i]){n[i]=[];var r=this._getter(this._target,i);if(null==r)continue;0!==t&&n[i].push({time:0,value:f(r)})}n[i].push({time:t,value:e[i]})}return this},during:function(t){return this._onframeList.push(t),this},_doneCallback:function(){this._tracks={},this._clipList.length=0;for(var t=this._doneList,e=t.length,n=0;n0},extendFrom:function(t,e){if(t){var n=this;for(var i in t)!t.hasOwnProperty(i)||!e&&n.hasOwnProperty(i)||(n[i]=t[i])}},set:function(t,e){"string"==typeof t?this[t]=e:this.extendFrom(t,!0)},clone:function(){var t=new this.constructor;return t.extendFrom(this,!0),t},getGradient:function(t,e,r){for(var a="radial"===e.type?i:n,o=a(t,e,r),s=e.colorStops,l=0;l=2){if(o&&"spline"!==o){var s=r(a,o,n,e.smoothConstraint);t.moveTo(a[0][0],a[0][1]);for(var l=a.length,h=0;h<(n?l:l-1);h++){var u=s[2*h],c=s[2*h+1],f=a[(h+1)%l];t.bezierCurveTo(u[0],u[1],c[0],c[1],f[0],f[1])}}else{"spline"===o&&(a=i(a,n)),t.moveTo(a[0][0],a[0][1]);for(var h=1,d=a.length;h1e-4)return p[0]=t-n,p[1]=e-r,g[0]=t+n,void(g[1]=e+r);if(u[0]=h(a)*n+t,u[1]=l(a)*r+e,c[0]=h(o)*n+t,c[1]=l(o)*r+e,v(p,u,c),m(g,u,c),a%=d,a<0&&(a+=d),o%=d,o<0&&(o+=d),a>o&&!s?o+=d:aa&&(f[0]=h(_)*n+t,f[1]=l(_)*r+e,v(p,f,p),m(g,f,g))},t.exports=a},function(t,e,n){var i=n(36),r=n(1),a=n(17),o=function(t){i.call(this,t)};o.prototype={constructor:o,type:"text",brush:function(t,e){var n=this.style,i=n.x||0,r=n.y||0,o=n.text;if(null!=o&&(o+=""),n.bind(t,this,e),o){this.setTransform(t);var s,l=n.textAlign,h=n.textFont||n.font;if(n.textVerticalAlign){var u=a.getBoundingRect(o,h,n.textAlign,"top");switch(s="middle",n.textVerticalAlign){case"middle":r-=u.height/2-u.lineHeight/2;break;case"bottom":r-=u.height-u.lineHeight/2;break;default:r+=u.lineHeight/2}}else s=n.textBaseline;t.font=h||"12px sans-serif",t.textAlign=l||"left",t.textAlign!==l&&(t.textAlign="left"),t.textBaseline=s||"alphabetic",t.textBaseline!==s&&(t.textBaseline="alphabetic");for(var c=a.measureText("国",t.font).width,f=o.split("\n"),d=0;d=0?parseFloat(t)/100*e:parseFloat(t):t}var r=n(17),a=n(9),o=new a,s=function(){};s.prototype={constructor:s,drawRectText:function(t,e,n){var a=this.style,s=a.text;if(null!=s&&(s+=""),s){t.save();var l,h,u=a.textPosition,c=a.textOffset,f=a.textDistance,d=a.textAlign,p=a.textFont||a.font,g=a.textBaseline,v=a.textVerticalAlign;n=n||r.getBoundingRect(s,p,d,g);var m=this.transform;if(a.textTransform?this.setTransform(t):m&&(o.copy(e),o.applyTransform(m),e=o),u instanceof Array){if(l=e.x+i(u[0],e.width),h=e.y+i(u[1],e.height),d=d||"left",g=g||"top",v){switch(v){case"middle":h-=n.height/2-n.lineHeight/2;break;case"bottom":h-=n.height-n.lineHeight/2;break;default:h+=n.lineHeight/2}g="middle"}}else{var y=r.adjustTextPositionOnRect(u,e,n,f);l=y.x,h=y.y,d=d||y.textAlign,g=g||y.textBaseline}c&&(l+=c[0],h+=c[1]),t.textAlign=d||"left",t.textBaseline=g||"alphabetic";var x=a.textFill,_=a.textStroke;x&&(t.fillStyle=x),_&&(t.strokeStyle=_),t.font=p||"12px sans-serif",t.shadowBlur=a.textShadowBlur,t.shadowColor=a.textShadowColor||"transparent",t.shadowOffsetX=a.textShadowOffsetX,t.shadowOffsetY=a.textShadowOffsetY;var b=s.split("\n");a.textRotation&&(m&&t.translate(m[4],m[5]),t.rotate(a.textRotation),m&&t.translate(-m[4],-m[5]));for(var w=0;w=0&&z.each(t,function(t){var r=t.coordinateSystem;if(r&&r.containPoint)n|=!!r.containPoint(e);else if("seriesModels"===i){var a=this._chartsMap[t.__viewId];a&&a.containPoint&&(n|=a.containPoint(e,t))}},this)},this),!!n},Q.getVisual=function(t,e){var n=this._model;t=O.parseFinder(n,t,{defaultMainType:"series"});var i=t.seriesModel,r=i.getData(),a=t.hasOwnProperty("dataIndexInside")?t.dataIndexInside:t.hasOwnProperty("dataIndex")?r.indexOfRawIndex(t.dataIndex):null;return null!=a?r.getItemVisual(a,e):r.getVisual(e)},Q.getViewOfComponentModel=function(t){return this._componentsMap[t.__viewId]},Q.getViewOfSeriesModel=function(t){return this._chartsMap[t.__viewId]};var J={update:function(t){var e=this._model,n=this._api,i=this._coordSysMgr,r=this._zr;if(e){e.restoreData(),i.create(this._model,this._api),d.call(this,e,n),p.call(this,e),i.update(e,n),v.call(this,e,t),m.call(this,e,t);var a=e.get("backgroundColor")||"transparent",o=r.painter;if(o.isSingleCanvas&&o.isSingleCanvas())r.configLayer(0,{clearColor:a});else{if(!w.canvasSupported){var s=R.parse(a);a=R.stringify(s,"rgb"),0===s[3]&&(a="transparent")}a.colorStops||a.image?(r.configLayer(0,{clearColor:a}),this[Y]=!0,this._dom.style.background="transparent"):(this[Y]&&r.configLayer(0,{clearColor:null}),this[Y]=!1,this._dom.style.background=a)}F(at,function(t){t(e,n)})}},updateView:function(t){var e=this._model;e&&(e.eachSeries(function(t){t.getData().clearAllVisual()}),v.call(this,e,t),c.call(this,"updateView",e,t))},updateVisual:function(t){var e=this._model;e&&(e.eachSeries(function(t){t.getData().clearAllVisual()}),v.call(this,e,t,!0),c.call(this,"updateVisual",e,t))},updateLayout:function(t){var e=this._model;e&&(g.call(this,e,t),c.call(this,"updateLayout",e,t))},prepareAndUpdate:function(t){var e=this._model;f.call(this,"component",e),f.call(this,"chart",e),this.__lastOnlyGraphic?(F(this._componentsViews,function(n){var i=n.__model;i&&"graphic"===i.mainType&&(n.render(i,e,this._api,t),_(i,n))},this),this.__lastOnlyGraphic=!1):J.update.call(this,t)}};Q.resize=function(t){this[X]=!0,this._zr.resize(t);var e=this._model&&this._model.resetOption("media"),n=e?"prepareAndUpdate":"update";J[n].call(this),this._loadingFX&&this._loadingFX.resize(),this[X]=!1;var i=t&&t.silent;h.call(this,i),u.call(this,i)},Q.showLoading=function(t,e){if(z.isObject(t)&&(e=t,t=""),t=t||"default",this.hideLoading(),lt[t]){var n=lt[t](this._api,e),i=this._zr;this._loadingFX=n,i.add(n)}},Q.hideLoading=function(){this._loadingFX&&this._zr.remove(this._loadingFX),this._loadingFX=null},Q.makeActionFromEvent=function(t){var e=z.extend({},t);return e.type=nt[t.type],e},Q.dispatchAction=function(t,e){if(z.isObject(e)||(e={silent:!!e}),et[t.type]){if(this[X])return void this._pendingActions.push(t);l.call(this,t,e.silent),e.flush?this._zr.flush(!0):e.flush!==!1&&w.browser.weChat&&this._throttledZrFlush(),h.call(this,e.silent),u.call(this,e.silent)}},Q.on=i("on"),Q.off=i("off"),Q.one=i("one");var tt=["click","dblclick","mouseover","mouseout","mousemove","mousedown","mouseup","globalout","contextmenu"];Q._initEvents=function(){F(tt,function(t){this._zr.on(t,function(e){var n,i=this.getModel(),r=e.target;if("globalout"===t)n={};else if(r&&null!=r.dataIndex){var a=r.dataModel||i.getSeriesByIndex(r.seriesIndex);n=a&&a.getDataParams(r.dataIndex,r.dataType)||{}}else r&&r.eventData&&(n=z.extend({},r.eventData));n&&(n.event=e,n.type=t,this.trigger(t,n))},this)},this),F(nt,function(t,e){this._messageCenter.on(e,function(t){this.trigger(e,t)},this)},this)},Q.isDisposed=function(){return this._disposed},Q.clear=function(){this.setOption({series:[]},!0)},Q.dispose=function(){if(!this._disposed){this._disposed=!0;var t=this._api,e=this._model;F(this._componentsViews,function(n){n.dispose(e,t)}),F(this._chartsViews,function(n){n.dispose(e,t)}),this._zr.dispose(),delete ht[this.id]}},z.mixin(a,N);var et={},nt={},it=[],rt=[],at=[],ot=[],st={},lt={},ht={},ut={},ct=new Date-0,ft=new Date-0,dt="_echarts_instance_",pt={version:"3.5.0",dependencies:{zrender:"3.4.0"}};pt.init=function(t,e,n){var i=new a(t,e,n);return i.id="ec_"+ct++,ht[i.id]=i,t.setAttribute&&t.setAttribute(dt,i.id),b(i),i},pt.connect=function(t){if(z.isArray(t)){var e=t;t=null,z.each(e,function(e){null!=e.group&&(t=e.group)}),t=t||"g_"+ft++,z.each(e,function(e){e.group=t})}return ut[t]=!0,t},pt.disConnect=function(t){ut[t]=!1},pt.disconnect=pt.disConnect,pt.dispose=function(t){z.isDom(t)?t=pt.getInstanceByDom(t):"string"==typeof t&&(t=ht[t]),t instanceof a&&!t.isDisposed()&&t.dispose()},pt.getInstanceByDom=function(t){var e=t.getAttribute(dt);return ht[e]},pt.getInstanceById=function(t){return ht[t]},pt.registerTheme=function(t,e){st[t]=e},pt.registerPreprocessor=function(t){rt.push(t)},pt.registerProcessor=function(t,e){"function"==typeof t&&(e=t,t=G),it.push({prio:t,func:e})},pt.registerPostUpdate=function(t){at.push(t)},pt.registerAction=function(t,e,n){"function"==typeof e&&(n=e,e="");var i=z.isObject(t)?t.type:[t,t={event:e}][0];t.event=(t.event||i).toLowerCase(),e=t.event,z.assert(K.test(i)&&K.test(e)),et[i]||(et[i]={action:n,actionInfo:t}),nt[e]=i},pt.registerCoordinateSystem=function(t,e){S.register(t,e)},pt.registerLayout=function(t,e){"function"==typeof t&&(e=t,t=q),ot.push({prio:t,func:e,isLayout:!0})},pt.registerVisual=function(t,e){"function"==typeof t&&(e=t,t=j),ot.push({prio:t,func:e})},pt.registerLoading=function(t,e){lt[t]=e},pt.extendComponentModel=function(t){return I.extend(t)},pt.extendComponentView=function(t){return P.extend(t)},pt.extendSeriesModel=function(t){return C.extend(t)},pt.extendChartView=function(t){return L.extend(t)},pt.setCanvasCreator=function(t){z.createCanvas=t},pt.registerVisual(W,n(153)),pt.registerPreprocessor(n(147)),pt.registerLoading("default",n(138)),pt.registerAction({type:"highlight",event:"highlight",update:"highlight"},z.noop),pt.registerAction({type:"downplay",event:"downplay",update:"downplay"},z.noop),pt.zrender=E,pt.List=n(14),pt.Model=n(10),pt.Axis=n(33),pt.graphic=n(3),pt.number=n(4),pt.format=n(7),pt.throttle=D.throttle,pt.matrix=n(19),pt.vector=n(6),pt.color=n(22),pt.util={},F(["map","each","filter","indexOf","inherits","reduce","filter","bind","curry","isArray","isString","isObject","isFunction","extend","defaults","clone","merge"],function(t){pt.util[t]=z[t]}),pt.helper=n(137),pt.PRIORITY={PROCESSOR:{FILTER:G,STATISTIC:H},VISUAL:{LAYOUT:q,GLOBAL:W,CHART:j,COMPONENT:Z,BRUSH:U}},t.exports=pt},function(t,e,n){"use strict";function i(t){return null!=t&&"none"!=t}function r(t){return"string"==typeof t?_.lift(t,-.1):t}function a(t){if(t.__hoverStlDirty){var e=t.style.stroke,n=t.style.fill,a=t.__hoverStl;a.fill=a.fill||(i(n)?r(n):null),a.stroke=a.stroke||(i(e)?r(e):null);var o={};for(var s in a)a.hasOwnProperty(s)&&(o[s]=t.style[s]);t.__normalStl=o,t.__hoverStlDirty=!1}}function o(t){t.__isHover||(a(t),t.useHoverLayer?t.__zr&&t.__zr.addHover(t,t.__hoverStl):(t.setStyle(t.__hoverStl),t.z2+=1),t.__isHover=!0)}function s(t){if(t.__isHover){var e=t.__normalStl;t.useHoverLayer?t.__zr&&t.__zr.removeHover(t):(e&&t.setStyle(e),t.z2-=1),t.__isHover=!1}}function l(t){"group"===t.type?t.traverse(function(t){"group"!==t.type&&o(t)}):o(t)}function h(t){"group"===t.type?t.traverse(function(t){"group"!==t.type&&s(t)}):s(t)}function u(t,e){t.__hoverStl=t.hoverStyle||e||{},t.__hoverStlDirty=!0,t.__isHover&&a(t)}function c(t){this.__hoverSilentOnTouch&&t.zrByTouch||!this.__isEmphasis&&l(this)}function f(t){this.__hoverSilentOnTouch&&t.zrByTouch||!this.__isEmphasis&&h(this)}function d(){this.__isEmphasis=!0,l(this)}function p(){this.__isEmphasis=!1,h(this)}function g(t,e,n,i,r,a){"function"==typeof r&&(a=r,r=null);var o=i&&i.isAnimationEnabled();if(o){var s=t?"Update":"",l=i.getShallow("animationDuration"+s),h=i.getShallow("animationEasing"+s),u=i.getShallow("animationDelay"+s);"function"==typeof u&&(u=u(r,i.getAnimationDelayParams?i.getAnimationDelayParams(e,r):null)),"function"==typeof l&&(l=l(r)),l>0?e.animateTo(n,l,u||0,h,a):(e.attr(n),a&&a())}else e.attr(n),a&&a()}var v=n(1),m=n(182),y=Math.round,x=n(8),_=n(22),b=n(19),w=n(6),M={};M.Group=n(36),M.Image=n(53),M.Text=n(85),M.Circle=n(173),M.Sector=n(179),M.Ring=n(178),M.Polygon=n(175),M.Polyline=n(176),M.Rect=n(177),M.Line=n(174),M.BezierCurve=n(172),M.Arc=n(171),M.CompoundPath=n(166),M.LinearGradient=n(101),M.RadialGradient=n(167),M.BoundingRect=n(11),M.extendShape=function(t){return x.extend(t)},M.extendPath=function(t,e){return m.extendFromString(t,e)},M.makePath=function(t,e,n,i){var r=m.createFromString(t,e),a=r.getBoundingRect();if(n){var o=a.width/a.height;if("center"===i){var s,l=n.height*o;l<=n.width?s=n.height:(l=n.width,s=l/o);var h=n.x+n.width/2,u=n.y+n.height/2;n.x=h-l/2,n.y=u-s/2,n.width=l,n.height=s}M.resizePath(r,n)}return r},M.mergePath=m.mergePath,M.resizePath=function(t,e){if(t.applyTransform){var n=t.getBoundingRect(),i=n.calculateTransform(e);t.applyTransform(i)}},M.subPixelOptimizeLine=function(t){var e=M.subPixelOptimize,n=t.shape,i=t.style.lineWidth;return y(2*n.x1)===y(2*n.x2)&&(n.x1=n.x2=e(n.x1,i,!0)),y(2*n.y1)===y(2*n.y2)&&(n.y1=n.y2=e(n.y1,i,!0)),t},M.subPixelOptimizeRect=function(t){var e=M.subPixelOptimize,n=t.shape,i=t.style.lineWidth,r=n.x,a=n.y,o=n.width,s=n.height;return n.x=e(n.x,i,!0),n.y=e(n.y,i,!0),n.width=Math.max(e(r+o,i,!1)-n.x,0===o?0:1),n.height=Math.max(e(a+s,i,!1)-n.y,0===s?0:1),t},M.subPixelOptimize=function(t,e,n){var i=y(2*t);return(i+y(e))%2===0?i/2:(i+(n?1:-1))/2},M.setHoverStyle=function(t,e,n){t.__hoverSilentOnTouch=n&&n.hoverSilentOnTouch,"group"===t.type?t.traverse(function(t){"group"!==t.type&&u(t,e)}):u(t,e),t.on("mouseover",c).on("mouseout",f),t.on("emphasis",d).on("normal",p)},M.setText=function(t,e,n){var i=e.getShallow("position")||"inside",r=e.getShallow("offset"),a=i.indexOf("inside")>=0?"white":n,o=e.getModel("textStyle");v.extend(t,{textDistance:e.getShallow("distance")||5,textFont:o.getFont(),textPosition:i,textOffset:r,textFill:o.getTextColor()||a})},M.updateProps=function(t,e,n,i,r){g(!0,t,e,n,i,r)},M.initProps=function(t,e,n,i,r){g(!1,t,e,n,i,r)},M.getTransform=function(t,e){for(var n=b.identity([]);t&&t!==e;)b.mul(n,t.getLocalTransform(),n),t=t.parent;return n},M.applyTransform=function(t,e,n){return n&&(e=b.invert([],e)),w.applyTransform([],t,e)},M.transformDirection=function(t,e,n){var i=0===e[4]||0===e[5]||0===e[0]?1:Math.abs(2*e[4]/e[0]),r=0===e[4]||0===e[5]||0===e[2]?1:Math.abs(2*e[4]/e[2]),a=["left"===t?-i:"right"===t?i:0,"top"===t?-r:"bottom"===t?r:0];return a=M.applyTransform(a,e,n),Math.abs(a[0])>Math.abs(a[1])?a[0]>0?"right":"left":a[1]>0?"bottom":"top"},M.groupTransition=function(t,e,n,i){function r(t){var e={};return t.traverse(function(t){!t.isGroup&&t.anid&&(e[t.anid]=t)}),e}function a(t){var e={position:w.clone(t.position),rotation:t.rotation};return t.shape&&(e.shape=v.extend({},t.shape)),e}if(t&&e){var o=r(t);e.traverse(function(t){if(!t.isGroup&&t.anid){var e=o[t.anid];if(e){var i=a(t);t.attr(a(e)),M.updateProps(t,i,n,t.dataIndex)}}})}},t.exports=M},function(t,e){function n(t){return t.replace(/^\s+/,"").replace(/\s+$/,"")}var i={},r=1e-4;i.linearMap=function(t,e,n,i){var r=e[1]-e[0],a=n[1]-n[0];if(0===r)return 0===a?n[0]:(n[0]+n[1])/2;if(i)if(r>0){if(t<=e[0])return n[0];if(t>=e[1])return n[1]}else{if(t>=e[0])return n[0];if(t<=e[1])return n[1]}else{if(t===e[0])return n[0];if(t===e[1])return n[1]}return(t-e[0])/r*a+n[0]},i.parsePercent=function(t,e){switch(t){case"center":case"middle":t="50%";break;case"left":case"top":t="0%";break;case"right":case"bottom":t="100%"}return"string"==typeof t?n(t).match(/%$/)?parseFloat(t)/100*e:parseFloat(t):null==t?NaN:+t},i.round=function(t,e,n){return null==e&&(e=10),e=Math.min(Math.max(0,e),20),t=(+t).toFixed(e),n?t:+t},i.asc=function(t){return t.sort(function(t,e){return t-e}),t},i.getPrecision=function(t){if(t=+t,isNaN(t))return 0;for(var e=1,n=0;Math.round(t*e)/e!==t;)e*=10,n++;return n},i.getPrecisionSafe=function(t){var e=t.toString(),n=e.indexOf(".");return n<0?0:e.length-1-n},i.getPixelPrecision=function(t,e){var n=Math.log,i=Math.LN10,r=Math.floor(n(t[1]-t[0])/i),a=Math.round(n(Math.abs(e[1]-e[0]))/i),o=Math.min(Math.max(-r+a,0),20);return isFinite(o)?o:20},i.MAX_SAFE_INTEGER=9007199254740991,i.remRadian=function(t){var e=2*Math.PI;return(t%e+e)%e},i.isRadianAroundZero=function(t){return t>-r&&t=0},t.exports=i},function(t,e,n){function i(t,e){return t&&t.hasOwnProperty(e)}var r=n(7),a=n(4),o=n(10),s=n(1),l=s.each,h=s.isObject,u={};u.normalizeToArray=function(t){return t instanceof Array?t:null==t?[]:[t]},u.defaultEmphasis=function(t,e){if(t){var n=t.emphasis=t.emphasis||{},i=t.normal=t.normal||{};l(e,function(t){var e=s.retrieve(n[t],i[t]);null!=e&&(n[t]=e)})}},u.LABEL_OPTIONS=["position","offset","show","textStyle","distance","formatter"],u.getDataItemValue=function(t){return t&&(null==t.value?t:t.value)},u.isDataItemOption=function(t){return h(t)&&!(t instanceof Array)},u.converDataValue=function(t,e){var n=e&&e.type;return"ordinal"===n?t:("time"===n&&"number"!=typeof t&&null!=t&&"-"!==t&&(t=+a.parseDate(t)),null==t||""===t?NaN:+t)},u.createDataFormatModel=function(t,e){var n=new o;return s.mixin(n,u.dataFormatMixin),n.seriesIndex=e.seriesIndex,n.name=e.name||"",n.mainType=e.mainType,n.subType=e.subType,n.getData=function(){return t},n},u.dataFormatMixin={getDataParams:function(t,e){var n=this.getData(e),i=this.getRawValue(t,e),r=n.getRawIndex(t),a=n.getName(t,!0),o=n.getRawDataItem(t);return{componentType:this.mainType,componentSubType:this.subType,seriesType:"series"===this.mainType?this.subType:null,seriesIndex:this.seriesIndex,seriesId:this.id,seriesName:this.name,name:a,dataIndex:r,data:o,dataType:e,value:i,color:n.getItemVisual(t,"color"),$vars:["seriesName","name","value"]}},getFormattedLabel:function(t,e,n,i){e=e||"normal";var a=this.getData(n),o=a.getItemModel(t),s=this.getDataParams(t,n);null!=i&&s.value instanceof Array&&(s.value=s.value[i]);var l=o.get(["label",e,"formatter"]);return"function"==typeof l?(s.status=e,l(s)):"string"==typeof l?r.formatTpl(l,s):void 0},getRawValue:function(t,e){var n=this.getData(e),i=n.getRawDataItem(t);if(null!=i)return!h(i)||i instanceof Array?i:i.value},formatTooltip:s.noop},u.mappingToExists=function(t,e){e=(e||[]).slice();var n=s.map(t||[],function(t,e){return{exist:t}});return l(e,function(t,i){if(h(t)){for(var r=0;r=n.length&&n.push({option:t})}}),n},u.makeIdAndName=function(t){var e={};l(t,function(t,n){var i=t.exist;i&&(e[i.id]=t)}),l(t,function(t,n){var i=t.option;s.assert(!i||null==i.id||!e[i.id]||e[i.id]===t,"id duplicates: "+(i&&i.id)),i&&null!=i.id&&(e[i.id]=t),!t.keyInfo&&(t.keyInfo={})}),l(t,function(t,n){var i=t.exist,r=t.option,a=t.keyInfo;if(h(r)){if(a.name=null!=r.name?r.name+"":i?i.name:"\0-",i)a.id=i.id;else if(null!=r.id)a.id=r.id+"";else{var o=0;do a.id="\0"+a.name+"\0"+o++;while(e[a.id])}e[a.id]=t}})},u.isIdInner=function(t){return h(t)&&t.id&&0===(t.id+"").indexOf("\0_ec_\0")},u.compressBatches=function(t,e){function n(t,e,n){for(var i=0,r=t.length;i1?"."+t[1]:""))},o.toCamelCase=function(t,e){return t=(t||"").toLowerCase().replace(/-(.)/g,function(t,e){return e.toUpperCase()}),e&&t&&(t=t.charAt(0).toUpperCase()+t.slice(1)),t},o.normalizeCssArray=function(t){var e=t.length;return"number"==typeof t?[t,t,t,t]:2===e?[t[0],t[1],t[0],t[1]]:3===e?[t[0],t[1],t[2],t[1]]:t};var s=o.encodeHTML=function(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")},l=["a","b","c","d","e","f","g"],h=function(t,e){return"{"+t+(null==e?"":e)+"}"};o.formatTpl=function(t,e,n){i.isArray(e)||(e=[e]);var r=e.length;if(!r)return"";for(var a=e[0].$vars||[],o=0;o1e-10&&(r.width+=a/o,r.height+=a/o,r.x-=a/o/2,r.y-=a/o/2)}return r}return t},contain:function(t,e){var n=this.transformCoordToLocal(t,e),i=this.getBoundingRect(),r=this.style;if(t=n[0],e=n[1],i.contain(t,e)){var a=this.path.data;if(r.hasStroke()){var o=r.lineWidth,l=r.strokeNoScale?this.getLineScale():1;if(l>1e-10&&(r.hasFill()||(o=Math.max(o,this.strokeContainThreshold)),s.containStroke(a,o/l,t,e)))return!0}if(r.hasFill())return s.contain(a,t,e)}return!1},dirty:function(t){null==t&&(t=!0),t&&(this.__dirtyPath=t,this._rect=null),this.__dirty=!0,this.__zr&&this.__zr.refresh(),this.__clipTarget&&this.__clipTarget.dirty()},animateShape:function(t){return this.animate("shape",t)},attrKV:function(t,e){"shape"===t?(this.setShape(e),this.__dirtyPath=!0,this._rect=null):r.prototype.attrKV.call(this,t,e)},setShape:function(t,e){var n=this.shape;if(n){if(a.isObject(t))for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);else n[t]=e;this.dirty(!0)}return this},getLineScale:function(){var t=this.transform;return t&&u(t[0]-1)>1e-10&&u(t[3]-1)>1e-10?Math.sqrt(u(t[0]*t[3]-t[2]*t[1])):1}},i.extend=function(t){var e=function(e){i.call(this,e),t.style&&this.style.extendFrom(t.style,!1);var n=t.shape;if(n){this.shape=this.shape||{};var r=this.shape;for(var a in n)!r.hasOwnProperty(a)&&n.hasOwnProperty(a)&&(r[a]=n[a])}t.init&&t.init.call(this,e)};a.inherits(e,i);for(var n in t)"style"!==n&&"shape"!==n&&(e.prototype[n]=t[n]);return e},a.inherits(i,r),t.exports=i},function(t,e){function n(t){var e={},n={},i=t.match(/Firefox\/([\d.]+)/),r=t.match(/MSIE\s([\d.]+)/)||t.match(/Trident\/.+?rv:(([\d.]+))/),a=t.match(/Edge\/([\d.]+)/),o=/micromessenger/i.test(t);return i&&(n.firefox=!0,n.version=i[1]),r&&(n.ie=!0,n.version=r[1]),a&&(n.edge=!0,n.version=a[1]),o&&(n.weChat=!0),{browser:n,os:e,node:!1,canvasSupported:!!document.createElement("canvas").getContext,touchEventsSupported:"ontouchstart"in window&&!n.ie&&!n.edge,pointerEventsSupported:"onpointerdown"in window&&(n.edge||n.ie&&n.version>=11)}}var i={};i="undefined"==typeof navigator?{browser:{},os:{},node:!0,canvasSupported:!0}:n(navigator.userAgent),t.exports=i},function(t,e,n){function i(t,e,n){this.parentModel=e,this.ecModel=n,this.option=t}function r(t,e,n){for(var i=0;i=n.x&&t<=n.x+n.width&&e>=n.y&&e<=n.y+n.height},clone:function(){return new i(this.x,this.y,this.width,this.height)},copy:function(t){this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height},plain:function(){return{x:this.x,y:this.y,width:this.width,height:this.height}}},i.create=function(t){return new i(t.x,t.y,t.width,t.height)},t.exports=i},function(t,e,n){"use strict";function i(t,e,n,i,r){var a=0,o=0;null==i&&(i=1/0),null==r&&(r=1/0);var s=0;e.eachChild(function(l,h){var u,c,f=l.position,d=l.getBoundingRect(),p=e.childAt(h+1),g=p&&p.getBoundingRect();if("horizontal"===t){var v=d.width+(g?-g.x+d.x:0);u=a+v,u>i||l.newline?(a=0,u=v,o+=s+n,s=d.height):s=Math.max(s,d.height)}else{var m=d.height+(g?-g.y+d.y:0);c=o+m,c>r||l.newline?(a+=s+n,o=0,c=m,s=d.width):s=Math.max(s,d.width)}l.newline||(f[0]=a,f[1]=o,"horizontal"===t?a=u+n:o=c+n)})}var r=n(1),a=n(11),o=n(4),s=n(7),l=o.parsePercent,h=r.each,u={},c=u.LOCATION_PARAMS=["left","right","top","bottom","width","height"],f=u.HV_NAMES=[["width","left","right"],["height","top","bottom"]];u.box=i,u.vbox=r.curry(i,"vertical"),u.hbox=r.curry(i,"horizontal"),u.getAvailableSize=function(t,e,n){var i=e.width,r=e.height,a=l(t.x,i),o=l(t.y,r),h=l(t.x2,i),u=l(t.y2,r);return(isNaN(a)||isNaN(parseFloat(t.x)))&&(a=0),(isNaN(h)||isNaN(parseFloat(t.x2)))&&(h=i),(isNaN(o)||isNaN(parseFloat(t.y)))&&(o=0),(isNaN(u)||isNaN(parseFloat(t.y2)))&&(u=r), +n=s.normalizeCssArray(n||0),{width:Math.max(h-a-n[1]-n[3],0),height:Math.max(u-o-n[0]-n[2],0)}},u.getLayoutRect=function(t,e,n){n=s.normalizeCssArray(n||0);var i=e.width,r=e.height,o=l(t.left,i),h=l(t.top,r),u=l(t.right,i),c=l(t.bottom,r),f=l(t.width,i),d=l(t.height,r),p=n[2]+n[0],g=n[1]+n[3],v=t.aspect;switch(isNaN(f)&&(f=i-u-g-o),isNaN(d)&&(d=r-c-p-h),isNaN(f)&&isNaN(d)&&(v>i/r?f=.8*i:d=.8*r),null!=v&&(isNaN(f)&&(f=v*d),isNaN(d)&&(d=f/v)),isNaN(o)&&(o=i-u-f-g),isNaN(h)&&(h=r-c-d-p),t.left||t.right){case"center":o=i/2-f/2-n[3];break;case"right":o=i-f-g}switch(t.top||t.bottom){case"middle":case"center":h=r/2-d/2-n[0];break;case"bottom":h=r-d-p}o=o||0,h=h||0,isNaN(f)&&(f=i-o-(u||0)),isNaN(d)&&(d=r-h-(c||0));var m=new a(o+n[3],h+n[0],f,d);return m.margin=n,m},u.positionElement=function(t,e,n,i,o){var s=!o||!o.hv||o.hv[0],l=!o||!o.hv||o.hv[1],h=o&&o.boundingMode||"all";if(s||l){var c;if("raw"===h)c="group"===t.type?new a(0,0,+e.width||0,+e.height||0):t.getBoundingRect();else if(c=t.getBoundingRect(),t.needLocalTransform()){var f=t.getLocalTransform();c=c.clone(),c.applyTransform(f)}e=u.getLayoutRect(r.defaults({width:c.width,height:c.height},e),n,i);var d=t.position,p=s?e.x-c.x:0,g=l?e.y-c.y:0;t.attr("position","raw"===h?[p,g]:[d[0]+p,d[1]+g])}},u.sizeCalculable=function(t,e){return null!=t[f[e][0]]||null!=t[f[e][1]]&&null!=t[f[e][2]]},u.mergeLayoutParam=function(t,e,n){function i(n,i){var r={},s=0,u={},c=0,f=2;if(h(n,function(e){u[e]=t[e]}),h(n,function(t){a(e,t)&&(r[t]=u[t]=e[t]),o(r,t)&&s++,o(u,t)&&c++}),l[i])return o(e,n[2])&&(u[n[1]]=null),o(e,n[1])&&(u[n[2]]=null),u;if(c!==f&&s){if(s>=f)return r;for(var d=0;d=0;r--)i=a.merge(i,t[r],!0);l.set(this,"__defaultOption",i)}return l.get(this,"__defaultOption")},getReferringComponents:function(t){return this.ecModel.queryComponents({mainType:t,index:this.get(t+"Index",!0),id:this.get(t+"Id",!0)})}});l.enableClassManagement(u,{registerWhenExtend:!0}),s.enableSubTypeDefaulter(u),s.enableTopologicalTravel(u,i),a.mixin(u,n(143)),t.exports=u},function(t,e,n){(function(e){function i(t){return f.isArray(t)||(t=[t]),t}function r(t,e){var n=t.dimensions,i=new m(f.map(n,t.getDimensionInfo,t),t.hostModel);v(i,t);for(var r=i._storage={},a=t._storage,o=0;o=0?r[s]=new l.constructor(a[s].length):r[s]=a[s]}return i}var a="undefined",o="undefined"==typeof window?e:window,s=typeof o.Float64Array===a?Array:o.Float64Array,l=typeof o.Int32Array===a?Array:o.Int32Array,h={"float":s,"int":l,ordinal:Array,number:Array,time:Array},u=n(10),c=n(48),f=n(1),d=n(5),p=f.isObject,g=["stackedOn","hasItemOption","_nameList","_idList","_rawData"],v=function(t,e){f.each(g.concat(e.__wrappedMethods||[]),function(n){e.hasOwnProperty(n)&&(t[n]=e[n])}),t.__wrappedMethods=e.__wrappedMethods},m=function(t,e){t=t||["x","y"];for(var n={},i=[],r=0;r0&&(w+="__ec__"+u[b]),u[b]++),w&&(l[c]=w)}this._nameList=e,this._idList=l},y.count=function(){return this.indices.length},y.get=function(t,e,n){var i=this._storage,r=this.indices[e];if(null==r)return NaN;var a=i[t]&&i[t][r];if(n){var o=this._dimensionInfos[t];if(o&&o.stackable)for(var s=this.stackedOn;s;){var l=s.get(t,e);(a>=0&&l>0||a<=0&&l<0)&&(a+=l),s=s.stackedOn}}return a},y.getValues=function(t,e,n){var i=[];f.isArray(t)||(n=e,e=t,t=this.dimensions);for(var r=0,a=t.length;rl&&(l=a));return this._extent[t+!!e]=[s,l]}return[1/0,-(1/0)]},y.getSum=function(t,e){var n=this._storage[t],i=0;if(n)for(var r=0,a=this.count();rt))return a;r=a-1}}return-1},y.indexOfNearest=function(t,e,n,i){var r=this._storage,a=r[t],o=[];if(!a)return o;null==i&&(i=1/0);for(var s=Number.MAX_VALUE,l=-1,h=0,u=this.count();h=0&&l<0)&&(s=f,l=c,o.length=0),o.push(h))}return o},y.getRawIndex=function(t){var e=this.indices[t];return null==e?-1:e},y.getRawDataItem=function(t){return this._rawData[this.getRawIndex(t)]},y.getName=function(t){return this._nameList[this.indices[t]]||""},y.getId=function(t){return this._idList[this.indices[t]]||this.getRawIndex(t)+""},y.each=function(t,e,n,r){"function"==typeof t&&(r=n,n=e,e=t,t=[]),t=f.map(i(t),this.getDimension,this);var a=[],o=t.length,s=this.indices;r=r||this;for(var l=0;lp-g&&(f=p-g,u.length=f);for(var v=0;vu&&(h=0,l={}),h++,l[n]=r,r}function r(t,e,n,r){var a=((t||"")+"").split("\n").length,o=i(t,e),s=i("国",e),l=a*s,h=new f(0,0,o,l);switch(h.lineHeight=s,r){case"bottom":case"alphabetic":h.y-=s;break;case"middle":h.y-=s/2}switch(n){case"end":case"right":h.x-=h.width;break;case"center":h.x-=h.width/2}return h}function a(t,e,n,i){var r=e.x,a=e.y,o=e.height,s=e.width,l=n.height,h=o/2-l/2,u="left";switch(t){case"left":r-=i,a+=h,u="right";break;case"right":r+=i+s,a+=h,u="left";break;case"top":r+=s/2,a-=i+l,u="center";break;case"bottom":r+=s/2,a+=o+i,u="center";break;case"inside":r+=s/2,a+=h,u="center";break;case"insideLeft":r+=i,a+=h,u="left";break;case"insideRight":r+=s-i,a+=h,u="right";break;case"insideTop":r+=s/2,a+=i,u="center";break;case"insideBottom":r+=s/2,a+=o-l-i,u="center";break;case"insideTopLeft":r+=i,a+=i,u="left";break;case"insideTopRight":r+=s-i,a+=i,u="right";break;case"insideBottomLeft":r+=i,a+=o-l-i;break;case"insideBottomRight":r+=s-i,a+=o-l-i,u="right"}return{x:r,y:a,textAlign:u,textBaseline:"top"}}function o(t,e,n,r,a){if(!e)return"";a=a||{},r=d(r,"...");for(var o=d(a.maxIterations,2),l=d(a.minChar,0),h=i("国",n),u=i("a",n),c=d(a.placeholder,""),f=e=Math.max(0,e-1),p=0;p=u;p++)f-=u;var g=i(r);g>f&&(r="",g=0),f=e-g;for(var v=(t+"").split("\n"),p=0,m=v.length;p=o){y+=r;break}var b=0===_?s(y,f,u,h):x>0?Math.floor(y.length*f/x):0;y=y.substr(0,b),x=i(y,n)}""===y&&(y=c),v[p]=y}}return v.join("\n")}function s(t,e,n,i){for(var r=0,a=0,o=t.length;a0&&h>0&&!u&&(l=0),l<0&&h<0&&!c&&(h=0)),[l,h]},h.niceScaleExtent=function(t,e){var n=h.getScaleExtent(t,e),i=null!=e.getMin(),r=null!=e.getMax(),a=e.get("splitNumber");"log"===t.type&&(t.base=e.get("logBase")),t.setExtent(n[0],n[1]),t.niceExtent(a,i,r);var o=e.get("minInterval");if(isFinite(o)&&!i&&!r&&"interval"===t.type){var s=t.getInterval(),l=Math.max(Math.abs(s),o)/s;n=t.getExtent();var u=(n[1]+n[0])/2;t.setExtent(l*(n[0]-u)+u,l*(n[1]-u)+u),t.niceExtent(a)}var s=e.get("interval");null!=s&&t.setInterval&&t.setInterval(s)},h.createScaleByModel=function(t,e){if(e=e||t.get("type"))switch(e){case"category":return new i(t.getCategories(),[1/0,-(1/0)]);case"value":return new r;default:return(a.getClass(e)||r).create(t)}},h.ifAxisCrossZero=function(t){var e=t.scale.getExtent(),n=e[0],i=e[1];return!(n>0&&i>0||n<0&&i<0)},h.getAxisLabelInterval=function(t,e,n,i){var r,a=0,o=0,s=1;e.length>40&&(s=Math.floor(e.length/40));for(var h=0;h1?s:(a+1)*s-1},h.getFormattedLabels=function(t,e){var n=t.scale,i=n.getTicksLabels(),r=n.getTicks();return"string"==typeof e?(e=function(t){return function(e){return t.replace("{value}",null!=e?e:"")}}(e),s.map(i,e)):"function"==typeof e?s.map(r,function(n,i){return e(h.getAxisRawValue(t,n),i)},this):i},h.getAxisRawValue=function(t,e){return"category"===t.type?t.scale.getLabel(e):e},t.exports=h},function(t,e,n){"use strict";var i=n(1),r=n(7),a=n(15),o=n(5),s=n(13),l=n(62),h=n(9),u=n(12),c=a.set,f=a.get,d=r.encodeHTML,p=r.addCommas,g=s.extend({type:"series.__base__",seriesIndex:0,coordinateSystem:null,defaultOption:null,legendDataProvider:null,visualColorAccessPath:"itemStyle.normal.color",layoutMode:null,init:function(t,e,n,i){this.seriesIndex=this.componentIndex,this.mergeDefaultAndTheme(t,n);var r=this.getInitialData(t,n);c(this,"dataBeforeProcessed",r),this.restoreData()},mergeDefaultAndTheme:function(t,e){var n=this.layoutMode,r=n?u.getLayoutParams(t):{};i.merge(t,e.getTheme().get(this.subType)),i.merge(t,this.getDefaultOption()),o.defaultEmphasis(t.label,o.LABEL_OPTIONS),this.fillDataTextStyle(t.data),n&&u.mergeLayoutParam(t,r,n)},mergeOption:function(t,e){t=i.merge(this.option,t,!0),this.fillDataTextStyle(t.data);var n=this.layoutMode;n&&u.mergeLayoutParam(this.option,t,n);var r=this.getInitialData(t,e);r&&(c(this,"data",r),c(this,"dataBeforeProcessed",r.cloneShallow()))},fillDataTextStyle:function(t){if(t)for(var e=0;e',g=this.name;return"\0-"===g&&(g=""),e?c+d(this.name)+" : "+l:(g&&d(g)+"
")+c+(h?d(h)+" : "+l:l)},isAnimationEnabled:function(){if(h.node)return!1;var t=this.getShallow("animation");return t&&this.getData().count()>this.getShallow("animationThreshold")&&(t=!1),t},restoreData:function(){c(this,"data",f(this,"dataBeforeProcessed").cloneShallow())},getColorFromPalette:function(t,e){var n=this.ecModel,i=l.getColorFromPalette.call(this,t,e);return i||(i=n.getColorFromPalette(t,e)),i},getAxisTooltipData:null,getTooltipPosition:null});i.mixin(g,o.dataFormatMixin),i.mixin(g,l),t.exports=g},function(t,e){var n="undefined"==typeof Float32Array?Array:Float32Array,i={create:function(){var t=new n(6);return i.identity(t),t},identity:function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t},copy:function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t},mul:function(t,e,n){var i=e[0]*n[0]+e[2]*n[1],r=e[1]*n[0]+e[3]*n[1],a=e[0]*n[2]+e[2]*n[3],o=e[1]*n[2]+e[3]*n[3],s=e[0]*n[4]+e[2]*n[5]+e[4],l=e[1]*n[4]+e[3]*n[5]+e[5];return t[0]=i,t[1]=r,t[2]=a,t[3]=o,t[4]=s,t[5]=l,t},translate:function(t,e,n){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4]+n[0],t[5]=e[5]+n[1],t},rotate:function(t,e,n){var i=e[0],r=e[2],a=e[4],o=e[1],s=e[3],l=e[5],h=Math.sin(n),u=Math.cos(n);return t[0]=i*u+o*h,t[1]=-i*h+o*u,t[2]=r*u+s*h,t[3]=-r*h+u*s,t[4]=u*a+h*l,t[5]=u*l-h*a,t},scale:function(t,e,n){var i=n[0],r=n[1];return t[0]=e[0]*i,t[1]=e[1]*r,t[2]=e[2]*i,t[3]=e[3]*r,t[4]=e[4]*i,t[5]=e[5]*r,t},invert:function(t,e){var n=e[0],i=e[2],r=e[4],a=e[1],o=e[3],s=e[5],l=n*o-a*i;return l?(l=1/l,t[0]=o*l,t[1]=-a*l,t[2]=-i*l,t[3]=n*l,t[4]=(i*s-o*r)*l,t[5]=(a*r-n*s)*l,t):null}};t.exports=i},function(t,e,n){"use strict";function i(t){return t.getBoundingClientRect?t.getBoundingClientRect():{left:0,top:0}}function r(t,e,n,i){return n=n||{},i||!u.canvasSupported?a(t,e,n):u.browser.firefox&&null!=e.layerX&&e.layerX!==e.offsetX?(n.zrX=e.layerX,n.zrY=e.layerY):null!=e.offsetX?(n.zrX=e.offsetX,n.zrY=e.offsetY):a(t,e,n),n}function a(t,e,n){var r=i(t);n.zrX=e.clientX-r.left,n.zrY=e.clientY-r.top}function o(t,e,n){if(e=e||window.event,null!=e.zrX)return e;var i=e.type,a=i&&i.indexOf("touch")>=0;if(a){var o="touchend"!=i?e.targetTouches[0]:e.changedTouches[0];o&&r(t,o,e,n)}else r(t,e,e,n),e.zrDelta=e.wheelDelta?e.wheelDelta/120:-(e.detail||0)/3;return e}function s(t,e,n){c?t.addEventListener(e,n):t.attachEvent("on"+e,n)}function l(t,e,n){c?t.removeEventListener(e,n):t.detachEvent("on"+e,n)}var h=n(23),u=n(9),c="undefined"!=typeof window&&!!window.addEventListener,f=c?function(t){t.preventDefault(),t.stopPropagation(),t.cancelBubble=!0}:function(t){t.returnValue=!1,t.cancelBubble=!0};t.exports={clientToLocal:r,normalizeEvent:o,addEventListener:s,removeEventListener:l,stop:f,Dispatcher:h}},function(t,e,n){"use strict";function i(t){return t>-w&&tw||t<-w}function a(t,e,n,i,r){var a=1-r;return a*a*(a*t+3*r*e)+r*r*(r*i+3*a*n)}function o(t,e,n,i,r){var a=1-r;return 3*(((e-t)*a+2*(n-e)*r)*a+(i-n)*r*r)}function s(t,e,n,r,a,o){var s=r+3*(e-n)-t,l=3*(n-2*e+t),h=3*(e-t),u=t-a,c=l*l-3*s*h,f=l*h-9*s*u,d=h*h-3*l*u,p=0;if(i(c)&&i(f))if(i(l))o[0]=0;else{var g=-h/l;g>=0&&g<=1&&(o[p++]=g)}else{var v=f*f-4*c*d;if(i(v)){var m=f/c,g=-l/s+m,y=-m/2;g>=0&&g<=1&&(o[p++]=g),y>=0&&y<=1&&(o[p++]=y)}else if(v>0){var x=b(v),w=c*l+1.5*s*(-f+x),M=c*l+1.5*s*(-f-x);w=w<0?-_(-w,S):_(w,S),M=M<0?-_(-M,S):_(M,S);var g=(-l-(w+M))/(3*s);g>=0&&g<=1&&(o[p++]=g)}else{var A=(2*c*l-3*s*f)/(2*b(c*c*c)),I=Math.acos(A)/3,C=b(c),P=Math.cos(I),g=(-l-2*C*P)/(3*s),y=(-l+C*(P+T*Math.sin(I)))/(3*s),L=(-l+C*(P-T*Math.sin(I)))/(3*s);g>=0&&g<=1&&(o[p++]=g),y>=0&&y<=1&&(o[p++]=y),L>=0&&L<=1&&(o[p++]=L)}}return p}function l(t,e,n,a,o){var s=6*n-12*e+6*t,l=9*e+3*a-3*t-9*n,h=3*e-3*t,u=0;if(i(l)){if(r(s)){var c=-h/s;c>=0&&c<=1&&(o[u++]=c)}}else{var f=s*s-4*l*h;if(i(f))o[0]=-s/(2*l);else if(f>0){var d=b(f),c=(-s+d)/(2*l),p=(-s-d)/(2*l);c>=0&&c<=1&&(o[u++]=c),p>=0&&p<=1&&(o[u++]=p)}}return u}function h(t,e,n,i,r,a){var o=(e-t)*r+t,s=(n-e)*r+e,l=(i-n)*r+n,h=(s-o)*r+o,u=(l-s)*r+s,c=(u-h)*r+h;a[0]=t,a[1]=o,a[2]=h,a[3]=c,a[4]=c,a[5]=u,a[6]=l,a[7]=i}function u(t,e,n,i,r,o,s,l,h,u,c){var f,d,p,g,v,m=.005,y=1/0;A[0]=h,A[1]=u;for(var _=0;_<1;_+=.05)I[0]=a(t,n,r,s,_),I[1]=a(e,i,o,l,_),g=x(A,I),g=0&&g=0&&c<=1&&(o[u++]=c)}}else{var f=l*l-4*s*h;if(i(f)){var c=-l/(2*s);c>=0&&c<=1&&(o[u++]=c)}else if(f>0){var d=b(f),c=(-l+d)/(2*s),p=(-l-d)/(2*s);c>=0&&c<=1&&(o[u++]=c),p>=0&&p<=1&&(o[u++]=p)}}return u}function p(t,e,n){var i=t+n-2*e;return 0===i?.5:(t-e)/i}function g(t,e,n,i,r){var a=(e-t)*i+t,o=(n-e)*i+e,s=(o-a)*i+a;r[0]=t,r[1]=a,r[2]=s,r[3]=s,r[4]=o,r[5]=n}function v(t,e,n,i,r,a,o,s,l){var h,u=.005,f=1/0;A[0]=o,A[1]=s;for(var d=0;d<1;d+=.05){I[0]=c(t,n,r,d),I[1]=c(e,i,a,d);var p=x(A,I);p=0&&p255?255:t}function r(t){return t=Math.round(t),t<0?0:t>360?360:t}function a(t){return t<0?0:t>1?1:t}function o(t){return i(t.length&&"%"===t.charAt(t.length-1)?parseFloat(t)/100*255:parseInt(t,10))}function s(t){return a(t.length&&"%"===t.charAt(t.length-1)?parseFloat(t)/100:parseFloat(t))}function l(t,e,n){return n<0?n+=1:n>1&&(n-=1),6*n<1?t+(e-t)*n*6:2*n<1?e:3*n<2?t+(e-t)*(2/3-n)*6:t}function h(t,e,n){return t+(e-t)*n}function u(t,e,n,i,r){return t[0]=e,t[1]=n,t[2]=i,t[3]=r,t}function c(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function f(t,e){A&&c(A,e),A=S.put(t,A||e.slice())}function d(t,e){if(t){e=e||[];var n=S.get(t);if(n)return c(e,n);t+="";var i=t.replace(/ /g,"").toLowerCase();if(i in T)return c(e,T[i]),f(t,e),e;if("#"!==i.charAt(0)){var r=i.indexOf("("),a=i.indexOf(")");if(r!==-1&&a+1===i.length){var l=i.substr(0,r),h=i.substr(r+1,a-(r+1)).split(","),d=1;switch(l){case"rgba":if(4!==h.length)return void u(e,0,0,0,1);d=s(h.pop());case"rgb":return 3!==h.length?void u(e,0,0,0,1):(u(e,o(h[0]),o(h[1]),o(h[2]),d),f(t,e),e);case"hsla":return 4!==h.length?void u(e,0,0,0,1):(h[3]=s(h[3]),p(h,e),f(t,e),e);case"hsl":return 3!==h.length?void u(e,0,0,0,1):(p(h,e),f(t,e),e);default:return}}u(e,0,0,0,1)}else{if(4===i.length){var g=parseInt(i.substr(1),16);return g>=0&&g<=4095?(u(e,(3840&g)>>4|(3840&g)>>8,240&g|(240&g)>>4,15&g|(15&g)<<4,1),f(t,e),e):void u(e,0,0,0,1)}if(7===i.length){var g=parseInt(i.substr(1),16);return g>=0&&g<=16777215?(u(e,(16711680&g)>>16,(65280&g)>>8,255&g,1),f(t,e),e):void u(e,0,0,0,1)}}}}function p(t,e){var n=(parseFloat(t[0])%360+360)%360/360,r=s(t[1]),a=s(t[2]),o=a<=.5?a*(r+1):a+r-a*r,h=2*a-o;return e=e||[],u(e,i(255*l(h,o,n+1/3)),i(255*l(h,o,n)),i(255*l(h,o,n-1/3)),1),4===t.length&&(e[3]=t[3]),e}function g(t){if(t){var e,n,i=t[0]/255,r=t[1]/255,a=t[2]/255,o=Math.min(i,r,a),s=Math.max(i,r,a),l=s-o,h=(s+o)/2;if(0===l)e=0,n=0;else{n=h<.5?l/(s+o):l/(2-s-o);var u=((s-i)/6+l/2)/l,c=((s-r)/6+l/2)/l,f=((s-a)/6+l/2)/l;i===s?e=f-c:r===s?e=1/3+u-f:a===s&&(e=2/3+c-u),e<0&&(e+=1),e>1&&(e-=1)}var d=[360*e,n,h];return null!=t[3]&&d.push(t[3]),d}}function v(t,e){var n=d(t);if(n){for(var i=0;i<3;i++)e<0?n[i]=n[i]*(1-e)|0:n[i]=(255-n[i])*e+n[i]|0;return w(n,4===n.length?"rgba":"rgb")}}function m(t,e){var n=d(t);if(n)return((1<<24)+(n[0]<<16)+(n[1]<<8)+ +n[2]).toString(16).slice(1)}function y(t,e,n){if(n=n||[0,0,0,0],!e||!e.length||!(t>=0&&t<=1))return n;var r=t*(e.length-1),a=Math.floor(r),o=Math.ceil(r),s=e[a],l=e[o],u=r-a;return n[0]=i(h(s[0],l[0],u)),n[1]=i(h(s[1],l[1],u)),n[2]=i(h(s[2],l[2],u)),n[3]=i(h(s[3],l[3],u)),n}function x(t,e,n){if(e&&e.length&&t>=0&&t<=1){var r=t*(e.length-1),o=Math.floor(r),s=Math.ceil(r),l=d(e[o]),u=d(e[s]),c=r-o,f=w([i(h(l[0],u[0],c)),i(h(l[1],u[1],c)),i(h(l[2],u[2],c)),a(h(l[3],u[3],c))],"rgba");return n?{color:f,leftIndex:o,rightIndex:s,value:r}:f}}function _(t,e,n,i){if(t=d(t))return t=g(t),null!=e&&(t[0]=r(e)),null!=n&&(t[1]=s(n)),null!=i&&(t[2]=s(i)),w(p(t),"rgba")}function b(t,e){if(t=d(t),t&&null!=e)return t[3]=a(e),w(t,"rgba")}function w(t,e){if(t){var n=t[0]+","+t[1]+","+t[2];return"rgba"!==e&&"hsva"!==e&&"hsla"!==e||(n+=","+t[3]),e+"("+n+")"}}var M=n(69),T={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1], +plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]},S=new M(20),A=null;t.exports={parse:d,lift:v,toHex:m,fastMapToColor:y,mapToColor:x,modifyHSL:_,modifyAlpha:b,stringify:w}},function(t,e){var n=Array.prototype.slice,i=function(){this._$handlers={}};i.prototype={constructor:i,one:function(t,e,n){var i=this._$handlers;if(!e||!t)return this;i[t]||(i[t]=[]);for(var r=0;r3&&(e=n.call(e,1));for(var r=this._$handlers[t],a=r.length,o=0;o4&&(e=n.call(e,1,e.length-1));for(var r=e[e.length-1],a=this._$handlers[t],o=a.length,s=0;s=0&&r(t)?function(t,e,n,i){return f.isDataItemOption(t)&&(x.hasItemOption=!0),i===y?n:g(p(t),m[i])}:function(t,e,n,i){var r=p(t),a=g(r&&r[i],m[i]);f.isDataItemOption(t)&&(x.hasItemOption=!0);var o=s&&s.categoryAxesModels;return o&&o[e]&&"string"==typeof a&&(b[e]=b[e]||o[e].getCategories(),a=c.indexOf(b[e],a),a<0&&!isNaN(a)&&(a=+a)),a};return x.hasItemOption=!1,x.initData(t,_,w),x}function o(t){return"category"!==t&&"time"!==t}function s(t){return"category"===t?"ordinal":"time"===t?"time":"float"}function l(t,e){var n,i=[],r=t&&t.dimensions[t.categoryIndex];if(r&&(n=t.categoryAxesModels[r.name]),n){var a=n.getCategories();if(a){var o=e.length;if(c.isArray(e[0])&&e[0].length>1){i=[];for(var s=0;sthis._ux||y(e-this._yi)>this._uy||this._len<5;return this.addData(l.L,t,e),this._ctx&&n&&(this._needsDash()?this._dashedLineTo(t,e):this._ctx.lineTo(t,e)),n&&(this._xi=t,this._yi=e),this},bezierCurveTo:function(t,e,n,i,r,a){return this.addData(l.C,t,e,n,i,r,a),this._ctx&&(this._needsDash()?this._dashedBezierTo(t,e,n,i,r,a):this._ctx.bezierCurveTo(t,e,n,i,r,a)),this._xi=r,this._yi=a,this},quadraticCurveTo:function(t,e,n,i){return this.addData(l.Q,t,e,n,i),this._ctx&&(this._needsDash()?this._dashedQuadraticTo(t,e,n,i):this._ctx.quadraticCurveTo(t,e,n,i)),this._xi=n,this._yi=i,this},arc:function(t,e,n,i,r,a){return this.addData(l.A,t,e,n,n,i,r-i,0,a?0:1),this._ctx&&this._ctx.arc(t,e,n,i,r,a),this._xi=g(r)*n+t,this._yi=v(r)*n+t,this},arcTo:function(t,e,n,i,r){return this._ctx&&this._ctx.arcTo(t,e,n,i,r),this},rect:function(t,e,n,i){return this._ctx&&this._ctx.rect(t,e,n,i),this.addData(l.R,t,e,n,i),this},closePath:function(){this.addData(l.Z);var t=this._ctx,e=this._x0,n=this._y0;return t&&(this._needsDash()&&this._dashedLineTo(e,n),t.closePath()),this._xi=e,this._yi=n,this},fill:function(t){t&&t.fill(),this.toStatic()},stroke:function(t){t&&t.stroke(),this.toStatic()},setLineDash:function(t){if(t instanceof Array){this._lineDash=t,this._dashIdx=0;for(var e=0,n=0;ne.length&&(this._expandData(),e=this.data);for(var n=0;n0&&g<=t||u<0&&g>=t||0==u&&(c>0&&v<=e||c<0&&v>=e);)i=this._dashIdx,n=o[i],g+=u*n,v+=c*n,this._dashIdx=(i+1)%y,u>0&&gl||c>0&&vh||s[i%2?"moveTo":"lineTo"](u>=0?d(g,t):p(g,t),c>=0?d(v,e):p(v,e));u=g-t,c=v-e,this._dashOffset=-m(u*u+c*c)},_dashedBezierTo:function(t,e,n,r,a,o){var s,l,h,u,c,f=this._dashSum,d=this._dashOffset,p=this._lineDash,g=this._ctx,v=this._xi,y=this._yi,x=i.cubicAt,_=0,b=this._dashIdx,w=p.length,M=0;for(d<0&&(d=f+d),d%=f,s=0;s<1;s+=.1)l=x(v,t,n,a,s+.1)-x(v,t,n,a,s),h=x(y,e,r,o,s+.1)-x(y,e,r,o,s),_+=m(l*l+h*h);for(;bd));b++);for(s=(M-d)/_;s<=1;)u=x(v,t,n,a,s),c=x(y,e,r,o,s),b%2?g.moveTo(u,c):g.lineTo(u,c),s+=p[b]/_,b=(b+1)%w;b%2!==0&&g.lineTo(a,o),l=a-u,h=o-c,this._dashOffset=-m(l*l+h*h)},_dashedQuadraticTo:function(t,e,n,i){var r=n,a=i;n=(n+2*t)/3,i=(i+2*e)/3,t=(this._xi+2*t)/3,e=(this._yi+2*e)/3,this._dashedBezierTo(t,e,n,i,r,a)},toStatic:function(){var t=this.data;t instanceof Array&&(t.length=this._len,x&&(this.data=new Float32Array(t)))},getBoundingRect:function(){h[0]=h[1]=c[0]=c[1]=Number.MAX_VALUE,u[0]=u[1]=f[0]=f[1]=-Number.MAX_VALUE;for(var t=this.data,e=0,n=0,i=0,s=0,d=0;dh||y(o-r)>u||f===c-1)&&(t.lineTo(a,o),i=a,r=o);break;case l.C:t.bezierCurveTo(s[f++],s[f++],s[f++],s[f++],s[f++],s[f++]),i=s[f-2],r=s[f-1];break;case l.Q:t.quadraticCurveTo(s[f++],s[f++],s[f++],s[f++]),i=s[f-2],r=s[f-1];break;case l.A:var p=s[f++],m=s[f++],x=s[f++],_=s[f++],b=s[f++],w=s[f++],M=s[f++],T=s[f++],S=x>_?x:_,A=x>_?1:x/_,I=x>_?_/x:1,C=Math.abs(x-_)>.001,P=b+w;C?(t.translate(p,m),t.rotate(M),t.scale(A,I),t.arc(0,0,S,b,P,1-T),t.scale(1/A,1/I),t.rotate(-M),t.translate(-p,-m)):t.arc(p,m,S,b,P,1-T),1==f&&(e=g(b)*x+p,n=v(b)*_+m),i=g(P)*x+p,r=v(P)*_+m;break;case l.R:e=i=s[f],n=r=s[f+1],t.rect(s[f++],s[f++],s[f++],s[f++]);break;case l.Z:t.closePath(),i=e,r=n}}}},_.CMD=l,t.exports=_},function(t,e,n){var i=n(1);t.exports=function(t){for(var e=0;e=0||n&&i.indexOf(n,o)<0)){var s=this.getShallow(o);null!=s&&(r[t[a][0]]=s)}}return r}}},function(t,e,n){function i(t,e,n){var i=e.getComponent("tooltip"),a=e.getComponent("axisPointer"),s=a.get("link",!0)||[],h=[];c(n.getCoordinateSystems(),function(n){function u(i,u,c){var f=c.model.getModel("axisPointer",a),d=f.get("show");if(d&&("auto"!==d||i||l(f))){null==u&&(u=f.get("triggerTooltip")),f=i?r(c,m,a,e,i,u):f;var v=f.get("snap"),y=p(c.model),x=u||v||"category"===c.type,_=t.axesInfo[y]={key:y,axis:c,coordSys:n,axisPointerModel:f,triggerTooltip:u,involveSeries:x,snap:v,useHandle:l(f),seriesModels:[]};g[y]=_,t.seriesInvolved|=x;var b=o(s,c);if(null!=b){var w=h[b]||(h[b]={axesInfo:{}});w.axesInfo[y]=_,w.mapper=s[b].mapper,_.linkGroup=w}}}if(n.axisPointerEnabled){var d=p(n.model),g=t.coordSysAxesInfo[d]={};t.coordSysMap[d]=n;var v=n.model,m=v.getModel("tooltip",i);if(c(n.getAxes(),f(u,!1,null)),n.getTooltipAxes&&i&&m.get("show")){var y="axis"===m.get("trigger"),x="cross"===m.get("axisPointer.type"),_=n.getTooltipAxes(m.get("axisPointer.axis"));(y||x)&&c(_.baseAxes,f(u,!x||"cross",y)),x&&c(_.otherAxes,f(u,"cross",!1))}}})}function r(t,e,n,i,r,a){var o=e.getModel("axisPointer"),s={};c(["type","snap","lineStyle","shadowStyle","label","animation","animationDurationUpdate","animationEasingUpdate","z"],function(t){s[t]=h.clone(o.get(t))}),s.snap="category"!==t.type&&!!a,"cross"===o.get("type")&&(s.type="line");var l=s.label||(s.label={});if(null==l.show&&(l.show=!1),"cross"===r&&(l.show=!0,!a)){var f=s.lineStyle=o.get("crossStyle");f&&h.defaults(l.textStyle||(l.textStyle={}),f.textStyle)}return t.model.getModel("axisPointer",new u(s,n,i))}function a(t,e){e.eachSeries(function(e){var n=e.coordinateSystem,i=e.get("tooltip.trigger",!0);n&&"none"!==i&&i!==!1&&"item"!==i&&e.get("axisPointer.show",!0)!==!1&&c(t.coordSysAxesInfo[p(n.model)],function(t){var i=t.axis;n.getAxis(i.dim)===i&&(t.seriesModels.push(e),null==t.seriesDataCount&&(t.seriesDataCount=0),t.seriesDataCount+=e.getData().count())})},this)}function o(t,e){for(var n=e.model,i=e.dim,r=0;r=0||t===e}function l(t){return!!t.get("handle.show")}var h=n(1),u=n(10),c=h.each,f=h.curry,d={};d.collect=function(t,e){var n={axesInfo:{},seriesInvolved:!1,coordSysAxesInfo:{},coordSysMap:{}};return i(n,t,e),n.seriesInvolved&&a(n,t),n},d.fixValue=function(t){var e=d.getAxisInfo(t);if(e){var n=e.axisPointerModel,i=e.axis.scale,r=n.option,a=n.get("status"),o=n.get("value");null!=o&&(o=i.parse(o));var s=l(n);null==a&&(r.status=s?"show":"hide");var h=i.getExtent().slice();h[0]>h[1]&&h.reverse(),(null==o||o>h[1])&&(o=h[1]),o=n&&t<=i},containData:function(t){return this.contain(this.dataToCoord(t))},getExtent:function(){var t=this._extent.slice();return t},getPixelPrecision:function(t){return r.getPixelPrecision(t||this.scale.getExtent(),this._extent)},setExtent:function(t,e){var n=this._extent;n[0]=t,n[1]=e},dataToCoord:function(t,e){var n=this._extent,r=this.scale;return t=r.normalize(t),this.onBand&&"ordinal"===r.type&&(n=n.slice(),i(n,r.count())),a(t,s,n,e)},coordToData:function(t,e){var n=this._extent,r=this.scale;this.onBand&&"ordinal"===r.type&&(n=n.slice(),i(n,r.count()));var o=a(t,n,s,e);return this.scale.scale(o)},pointToData:function(t,e){},getTicksCoords:function(t){if(this.onBand&&!t){for(var e=this.getBands(),n=[],i=0;i=e[0]&&t<=e[1]},a.normalize=function(t){var e=this._extent;return e[1]===e[0]?.5:(t-e[0])/(e[1]-e[0])},a.scale=function(t){var e=this._extent;return t*(e[1]-e[0])+e[0]},a.unionExtent=function(t){var e=this._extent;t[0]e[1]&&(e[1]=t[1])},a.unionExtentFromData=function(t,e){this.unionExtent(t.getDataExtent(e,!0))},a.getExtent=function(){return this._extent.slice()},a.setExtent=function(t,e){var n=this._extent;isNaN(t)||(n[0]=t),isNaN(e)||(n[1]=e)},a.getTicksLabels=function(){for(var t=[],e=this.getTicks(),n=0;n=0&&(n.splice(i,0,t),this._doAdd(t))}return this},_doAdd:function(t){t.parent&&t.parent.remove(t),t.parent=this;var e=this.__storage,n=this.__zr;e&&e!==t.__storage&&(e.addToMap(t),t instanceof o&&t.addChildrenToStorage(e)),n&&n.refresh()},remove:function(t){var e=this.__zr,n=this.__storage,r=this._children,a=i.indexOf(r,t);return a<0?this:(r.splice(a,1),t.parent=null,n&&(n.delFromMap(t.id),t instanceof o&&t.delChildrenFromStorage(n)),e&&e.refresh(),this)},removeAll:function(){var t,e,n=this._children,i=this.__storage;for(e=0;ei[1],l="start"===e&&!s||"start"!==e&&s;return f(o-v/2)?(a=l?"bottom":"top",r="center"):f(o-1.5*v)?(a=l?"top":"bottom",r="center"):(a="middle",r=o<1.5*v&&o>v/2?l?"left":"right":l?"right":"left"),{rotation:o,textAlign:r,textVerticalAlign:a}}function a(t){var e=t.get("tooltip");return t.get("silent")||!(t.get("triggerEvent")||e&&e.show)}var o=n(1),s=n(7),l=n(3),h=n(10),u=n(4),c=u.remRadian,f=u.isRadianAroundZero,d=n(6),p=d.applyTransform,g=o.retrieve,v=Math.PI,m=function(t,e){this.opt=e,this.axisModel=t,o.defaults(e,{labelOffset:0,nameDirection:1,tickDirection:1,labelDirection:1,silent:!0}),this.group=new l.Group;var n=new l.Group({position:e.position.slice(),rotation:e.rotation});n.updateTransform(),this._transform=n.transform,this._dumbGroup=n};m.prototype={constructor:m,hasBuilder:function(t){return!!y[t]},add:function(t){y[t].call(this)},getGroup:function(){return this.group}};var y={axisLine:function(){var t=this.opt,e=this.axisModel;if(e.get("axisLine.show")){var n=this.axisModel.axis.getExtent(),i=this._transform,r=[n[0],0],a=[n[1],0];i&&(p(r,r,i),p(a,a,i)),this.group.add(new l.Line(l.subPixelOptimizeLine({anid:"line",shape:{x1:r[0],y1:r[1],x2:a[0],y2:a[1]},style:o.extend({lineCap:"round"},e.getModel("axisLine.lineStyle").getLineStyle()),strokeContainThreshold:t.strokeContainThreshold||5,silent:!0,z2:1})))}},axisTick:function(){var t=this.axisModel,e=t.axis;if(t.get("axisTick.show")&&!e.scale.isBlank())for(var n=t.getModel("axisTick"),i=this.opt,r=n.getModel("lineStyle"),a=n.get("length"),s=b(n,i.labelInterval),h=e.getTicksCoords(n.get("alignWithLabel")),u=e.scale.getTicks(),c=[],f=[],d=this._transform,g=0;gp[1]?-1:1,y=["start"===u?p[0]-m*d:"end"===u?p[1]+m*d:(p[0]+p[1])/2,"middle"===u?t.labelOffset+c*d:0],_=e.get("nameRotate");null!=_&&(_=_*v/180);var b;"middle"===u?h=x(t.rotation,null!=_?_:t.rotation,c):(h=r(t,u,_||0,p),b=t.axisNameAvailableWidth,null!=b&&(b=Math.abs(b/Math.sin(h.rotation)),!isFinite(b)&&(b=null)));var w=f.getFont(),M=e.get("nameTruncate",!0)||{},T=M.ellipsis,S=g(M.maxWidth,b),A=null!=T&&null!=S?s.truncateText(n,S,w,T,{minChar:2,placeholder:M.placeholder}):n,I=e.get("tooltip",!0),C=e.mainType,P={componentType:C,name:n,$vars:["name"]};P[C+"Index"]=e.componentIndex;var L=new l.Text({anid:"name",__fullText:n,__truncatedText:A,style:{text:A,textFont:w,fill:f.getTextColor()||e.get("axisLine.lineStyle.color"),textAlign:h.textAlign,textVerticalAlign:h.textVerticalAlign},position:y,rotation:h.rotation,silent:a(e),z2:1,tooltip:I&&I.show?o.extend({content:n,formatter:function(){return n},formatterParams:P},I):null});e.get("triggerEvent")&&(L.eventData=i(e),L.eventData.targetType="axisName",L.eventData.name=n),this._dumbGroup.add(L),L.updateTransform(),this.group.add(L),L.decomposeTransform()}}},x=m.innerTextLayout=function(t,e,n){var i,r,a=c(e-t);return f(a)?(r=n>0?"top":"bottom",i="center"):f(a-v)?(r=n>0?"bottom":"top",i="center"):(r="middle",i=a>0&&a0?"right":"left":n>0?"left":"right"),{rotation:a,textAlign:i,textVerticalAlign:r}},_=m.ifIgnoreOnTick=function(t,e,n){var i,r=t.scale;return"ordinal"===r.type&&("function"==typeof n?(i=r.getTicks()[e],!n(i,r.getLabel(i))):e%(n+1))},b=m.getInterval=function(t,e){var n=t.get("interval");return null!=n&&"auto"!=n||(n=e),n};t.exports=m},function(t,e,n){n(93),n(45)},function(t,e){var n={},i="\0__throttleOriginMethod",r="\0__throttleRate",a="\0__throttleType";n.throttle=function(t,e,n){function i(){h=(new Date).getTime(),u=null,t.apply(o,s||[])}var r,a,o,s,l=0,h=0,u=null;e=e||0;var c=function(){r=(new Date).getTime(),o=this,s=arguments,a=r-(n?l:h)-e,clearTimeout(u),n?u=setTimeout(i,e):a>=0?i():u=setTimeout(i,-a),l=r};return c.clear=function(){u&&(clearTimeout(u),u=null)},c},n.createOrUpdate=function(t,e,o,s){var l=t[e];if(l){var h=l[i]||l,u=l[a],c=l[r];if(c!==o||u!==s){if(null==o||!s)return t[e]=h;l=t[e]=n.throttle(h,o,"debounce"===s),l[i]=h,l[a]=s,l[r]=o}return l}},n.clear=function(t,e){var n=t[e];n&&n[i]&&(t[e]=n[i])},t.exports=n},function(t,e,n){function i(t){t=t||{},o.call(this,t);for(var e in t)t.hasOwnProperty(e)&&"style"!==e&&(this[e]=t[e]);this.style=new a(t.style),this._rect=null,this.__clipPaths=[]}var r=n(1),a=n(72),o=n(65),s=n(86);i.prototype={constructor:i,type:"displayable",__dirty:!0,invisible:!1,z:0,z2:0,zlevel:0,draggable:!1,dragging:!1,silent:!1,culling:!1,cursor:"pointer",rectHover:!1,progressive:-1,beforeBrush:function(t){},afterBrush:function(t){},brush:function(t,e){},getBoundingRect:function(){},contain:function(t,e){return this.rectContain(t,e)},traverse:function(t,e){t.call(e,this)},rectContain:function(t,e){var n=this.transformCoordToLocal(t,e),i=this.getBoundingRect();return i.contain(n[0],n[1])},dirty:function(){this.__dirty=!0,this._rect=null,this.__zr&&this.__zr.refresh()},animateStyle:function(t){return this.animate("style",t)},attrKV:function(t,e){"style"!==t?o.prototype.attrKV.call(this,t,e):this.style.set(e)},setStyle:function(t,e){return this.style.set(t,e),this.dirty(!1),this},useStyle:function(t){return this.style=new a(t),this.dirty(!1),this}},r.inherits(i,o),r.mixin(i,s),t.exports=i},function(t,e){var n=function(t){this.colorStops=t||[]};n.prototype={constructor:n,addColorStop:function(t,e){this.colorStops.push({offset:t,color:e})}},t.exports=n},function(t,e,n){function i(t){return r.isObject(t)&&null!=t.value?t.value:t}var r=n(1),a=n(17);t.exports={getFormattedLabels:function(){return a.getFormattedLabels(this.axis,this.get("axisLabel.formatter"))},getCategories:function(){ +return"category"===this.get("type")&&r.map(this.get("data"),i)},getMin:function(t){var e=this.option,n=t||null==e.rangeStart?e.min:e.rangeStart;return this.axis&&null!=n&&"dataMin"!==n&&!r.eqNaN(n)&&(n=this.axis.scale.parse(n)),n},getMax:function(t){var e=this.option,n=t||null==e.rangeEnd?e.max:e.rangeEnd;return this.axis&&null!=n&&"dataMax"!==n&&!r.eqNaN(n)&&(n=this.axis.scale.parse(n)),n},getNeedCrossZero:function(){var t=this.option;return null==t.rangeStart&&null==t.rangeEnd&&!t.scale},getCoordSysModel:r.noop,setRange:function(t,e){this.option.rangeStart=t,this.option.rangeEnd=e},resetRange:function(){this.option.rangeStart=this.option.rangeEnd=null}}},function(t,e,n){var i=n(4),r=n(7),a=n(34),o=Math.floor,s=Math.ceil,l=i.getPrecisionSafe,h=i.round,u=a.extend({type:"interval",_interval:0,_intervalPrecision:2,setExtent:function(t,e){var n=this._extent;isNaN(t)||(n[0]=parseFloat(t)),isNaN(e)||(n[1]=parseFloat(e))},unionExtent:function(t){var e=this._extent;t[0]e[1]&&(e[1]=t[1]),u.prototype.setExtent.call(this,e[0],e[1])},getInterval:function(){return this._interval||this.niceTicks(),this._interval},setInterval:function(t){this._interval=t,this._niceExtent=this._extent.slice()},getTicks:function(){this._interval||this.niceTicks();var t=this._interval,e=this._extent,n=[],i=1e4;if(t){var r=this._niceExtent,a=this._intervalPrecision=l(t);a+=2,e[0]i)return[];e[1]>(n.length?n[n.length-1]:r[1])&&n.push(e[1])}return n},getTicksLabels:function(){for(var t=[],e=this.getTicks(),n=0;n=0&&n.push(t)}),n}t.topologicalTravel=function(t,e,r,a){function o(t){h[t].entryCount--,0===h[t].entryCount&&u.push(t)}function s(t){c[t]=!0,o(t)}if(t.length){var l=n(e),h=l.graph,u=l.noEntryList,c={};for(i.each(t,function(t){c[t]=!0});u.length;){var f=u.pop(),d=h[f],p=!!c[f];p&&(r.call(a,f,d.originalDeps.slice()),delete c[f]),i.each(d.successor,p?s:o)}i.each(c,function(){throw new Error("Circle dependency may exists")})}}},t.exports=s},function(t,e){t.exports=function(t,e,n,i,r){i.eachRawSeriesByType(t,function(t){var r=t.getData(),a=t.get("symbol")||e,o=t.get("symbolSize");r.setVisual({legendSymbol:n||a,symbol:a,symbolSize:o}),i.isSeriesFiltered(t)||("function"==typeof o&&r.each(function(e){var n=t.getRawValue(e),i=t.getDataParams(e);r.setItemVisual(e,"symbolSize",o(n,i))}),r.each(function(t){var e=r.getItemModel(t),n=e.getShallow("symbol",!0),i=e.getShallow("symbolSize",!0);null!=n&&r.setItemVisual(t,"symbol",n),null!=i&&r.setItemVisual(t,"symbolSize",i)}))})}},function(t,e){function n(t){for(var e=0;t>=u;)e|=1&t,t>>=1;return t+e}function i(t,e,n,i){var a=e+1;if(a===n)return 1;if(i(t[a++],t[e])<0){for(;a=0;)a++;return a-e}function r(t,e,n){for(n--;e>>1,r(o,t[a])<0?l=a:s=a+1;var h=i-s;switch(h){case 3:t[s+3]=t[s+2];case 2:t[s+2]=t[s+1];case 1:t[s+1]=t[s];break;default:for(;h>0;)t[s+h]=t[s+h-1],h--}t[s]=o}}function o(t,e,n,i,r,a){var o=0,s=0,l=1;if(a(t,e[n+r])>0){for(s=i-r;l0;)o=l,l=(l<<1)+1,l<=0&&(l=s);l>s&&(l=s),o+=r,l+=r}else{for(s=r+1;ls&&(l=s);var h=o;o=r-l,l=r-h}for(o++;o>>1);a(t,e[n+u])>0?o=u+1:l=u}return l}function s(t,e,n,i,r,a){var o=0,s=0,l=1;if(a(t,e[n+r])<0){for(s=r+1;ls&&(l=s);var h=o;o=r-l,l=r-h}else{for(s=i-r;l=0;)o=l,l=(l<<1)+1,l<=0&&(l=s);l>s&&(l=s),o+=r,l+=r}for(o++;o>>1);a(t,e[n+u])<0?l=u:o=u+1}return l}function l(t,e){function n(t,e){u[y]=t,d[y]=e,y+=1}function i(){for(;y>1;){var t=y-2;if(t>=1&&d[t-1]<=d[t]+d[t+1]||t>=2&&d[t-2]<=d[t]+d[t-1])d[t-1]d[t+1])break;a(t)}}function r(){for(;y>1;){var t=y-2;t>0&&d[t-1]=c||g>=c);if(v)break;m<0&&(m=0),m+=2}if(p=m,p<1&&(p=1),1===i){for(l=0;l=0;l--)t[g+l]=t[d+l];return void(t[f]=x[u])}for(var v=p;;){var m=0,y=0,_=!1;do if(e(x[u],t[h])<0){if(t[f--]=t[h--],m++,y=0,0===--i){_=!0;break}}else if(t[f--]=x[u--],y++,m=0,1===--a){_=!0;break}while((m|y)=0;l--)t[g+l]=t[d+l];if(0===i){_=!0;break}}if(t[f--]=x[u--],1===--a){_=!0;break}if(y=a-o(t[h],x,0,a,a-1,e),0!==y){for(f-=y,u-=y,a-=y,g=f+1,d=u+1,l=0;l=c||y>=c);if(_)break;v<0&&(v=0),v+=2}if(p=v,p<1&&(p=1),1===a){for(f-=i,h-=i,g=f+1,d=h+1,l=i-1;l>=0;l--)t[g+l]=t[d+l];t[f]=x[u]}else{if(0===a)throw new Error;for(d=f-(a-1),l=0;l>>1);var x=[];m=g<120?5:g<1542?10:g<119151?19:40,u=[],d=[],this.mergeRuns=i,this.forceMergeRuns=r,this.pushRun=n}function h(t,e,r,o){r||(r=0),o||(o=t.length);var s=o-r;if(!(s<2)){var h=0;if(sf&&(d=f),a(t,r,r+d,r+h,e),h=d}c.pushRun(r,h),c.mergeRuns(),s-=h,r+=h}while(0!==s);c.forceMergeRuns()}}var u=32,c=7,f=256;t.exports=h},function(t,e,n){var i=n(35);t.exports=function(){if(0!==i.debugMode)if(1==i.debugMode)for(var t in arguments)throw new Error(arguments[t]);else if(i.debugMode>1)for(var t in arguments)console.log(arguments[t])}},function(t,e,n){function i(t){r.call(this,t)}var r=n(40),a=n(11),o=n(1),s=n(69),l=new s(50);i.prototype={constructor:i,type:"image",brush:function(t,e){var n,i=this.style,r=i.image;if(i.bind(t,this,e),n="string"==typeof r?this._image:r,!n&&r){var a=l.get(r);if(!a)return n=new Image,n.onload=function(){n.onload=null;for(var t=0;t40&&(a=Math.ceil(o/40));for(var s=0;s.5?e:t}function s(t,e,n,i,r){var o=t.length;if(1==r)for(var s=0;sr;if(a)t.length=r;else for(var o=i;o=0&&!(A[n]<=e);n--);n=Math.min(n,x-2)}else{for(n=V;ne);n++);n=Math.min(n-1,x-2)}V=n,G=e;var i=A[n+1]-A[n];if(0!==i)if(z=(e-A[n])/i,m)if(N=I[n],R=I[0===n?n:n-1],B=I[n>x-2?x-1:n+1],F=I[n>x-3?x-1:n+2],w)u(R,N,B,F,z,z*z,z*z*z,f(t,r),S);else{var l;if(M)l=u(R,N,B,F,z,z*z,z*z*z,H,1),l=d(H);else{if(T)return o(N,B,z);l=c(R,N,B,F,z,z*z,z*z*z)}p(t,r,l)}else if(w)s(I[n],I[n+1],z,f(t,r),S);else{var l;if(M)s(I[n],I[n+1],z,H,1),l=d(H);else{if(T)return o(I[n],I[n+1],z);l=a(I[n],I[n+1],z)}p(t,r,l)}},W=new g({target:t._target,life:_,loop:t._loop,delay:t._delay,onframe:q,ondestroy:n});return e&&"spline"!==e&&(W.easing=e), +W}}}var g=n(159),v=n(22),m=n(1),y=m.isArrayLike,x=Array.prototype.slice,_=function(t,e,n,a){this._tracks={},this._target=t,this._loop=e||!1,this._getter=n||i,this._setter=a||r,this._clipCount=0,this._delay=0,this._doneList=[],this._onframeList=[],this._clipList=[]};_.prototype={when:function(t,e){var n=this._tracks;for(var i in e)if(e.hasOwnProperty(i)){if(!n[i]){n[i]=[];var r=this._getter(this._target,i);if(null==r)continue;0!==t&&n[i].push({time:0,value:f(r)})}n[i].push({time:t,value:e[i]})}return this},during:function(t){return this._onframeList.push(t),this},pause:function(){for(var t=0;t=this._maxSize&&o>0){var l=n.head;n.remove(l),delete i[l.key],a=l.value,this._lastRemovedEntry=l}s?s.value=e:s=new r(e),s.key=t,n.insertEntry(s),i[t]=s}return a},o.get=function(t){var e=this._map[t],n=this._list;if(null!=e)return e!==n.tail&&(n.remove(e),n.insertEntry(e)),e.value},o.clear=function(){this._list.clear(),this._map={}},t.exports=a},function(t,e){var n=2311;t.exports=function(){return n++}},function(t,e){var n=function(t,e){this.image=t,this.repeat=e,this.type="pattern"};n.prototype.getCanvasPattern=function(t){return this._canvasPattern||(this._canvasPattern=t.createPattern(this.image,this.repeat))},t.exports=n},function(t,e){function n(t,e,n){var i=e.x,r=e.x2,a=e.y,o=e.y2;e.global||(i=i*n.width+n.x,r=r*n.width+n.x,a=a*n.height+n.y,o=o*n.height+n.y);var s=t.createLinearGradient(i,a,r,o);return s}function i(t,e,n){var i=n.width,r=n.height,a=Math.min(i,r),o=e.x,s=e.y,l=e.r;e.global||(o=o*i+n.x,s=s*r+n.y,l*=a);var h=t.createRadialGradient(o,s,0,o,s,l);return h}var r=[["shadowBlur",0],["shadowOffsetX",0],["shadowOffsetY",0],["shadowColor","#000"],["lineCap","butt"],["lineJoin","miter"],["miterLimit",10]],a=function(t){this.extendFrom(t)};a.prototype={constructor:a,fill:"#000000",stroke:null,opacity:1,lineDash:null,lineDashOffset:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,lineWidth:1,strokeNoScale:!1,text:null,textFill:"#000",textStroke:null,textPosition:"inside",textOffset:null,textBaseline:null,textAlign:null,textVerticalAlign:null,textDistance:5,textShadowBlur:0,textShadowOffsetX:0,textShadowOffsetY:0,textTransform:!1,textRotation:0,blend:null,bind:function(t,e,n){for(var i=this,a=n&&n.style,o=!a,s=0;s0},extendFrom:function(t,e){if(t){var n=this;for(var i in t)!t.hasOwnProperty(i)||!e&&n.hasOwnProperty(i)||(n[i]=t[i])}},set:function(t,e){"string"==typeof t?this[t]=e:this.extendFrom(t,!0)},clone:function(){var t=new this.constructor;return t.extendFrom(this,!0),t},getGradient:function(t,e,r){for(var a="radial"===e.type?i:n,o=a(t,e,r),s=e.colorStops,l=0;l=2){if(o&&"spline"!==o){var s=r(a,o,n,e.smoothConstraint);t.moveTo(a[0][0],a[0][1]);for(var l=a.length,h=0;h<(n?l:l-1);h++){var u=s[2*h],c=s[2*h+1],f=a[(h+1)%l];t.bezierCurveTo(u[0],u[1],c[0],c[1],f[0],f[1])}}else{"spline"===o&&(a=i(a,n)),t.moveTo(a[0][0],a[0][1]);for(var h=1,d=a.length;ho)return!0;if(a){var s=p.getAxisInfo(t).seriesDataCount,l=i.getExtent();return Math.abs(l[0]-l[1])/s>o}return!1}return n===!0},makeElOption:function(t,e,n,i,r){},createPointerEl:function(t,e,n,i){var r=e.pointer,a=d(t).pointerEl=new f[r.type](m(e.pointer));t.add(a)},createLabelEl:function(t,e,n,i){var r=d(t).labelEl=new f.Rect(m(e.label));t.add(r),o(r,i)},updatePointerEl:function(t,e,n){var i=d(t).pointerEl;i&&(i.setStyle(e.pointer.style),n(i,{shape:e.pointer.shape}))},updateLabelEl:function(t,e,n,i){var r=d(t).labelEl;r&&(r.setStyle(e.label.style),n(r,{shape:e.label.shape,position:e.label.position}),o(r,i))},_renderHandle:function(t){if(!this._dragging&&this.updateHandleTransform){var e=this._axisPointerModel,n=this._api.getZr(),i=this._handle,r=e.getModel("handle"),a=e.get("status");if(!r.get("show")||!a||"hide"===a)return i&&n.remove(i),void(this._handle=null);var o;this._handle||(o=!0,i=this._handle=l(r,{onmousemove:function(t){g.stop(t.event)},onmousedown:y(this._onHandleDragMove,this,0,0),drift:y(this._onHandleDragMove,this),ondragend:y(this._onHandleDragEnd,this)}),n.add(i)),h(i,e,!1);var s=["color","borderColor","borderWidth","opacity","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY"];i.setStyle(r.getItemStyle(null,s));var c=r.get("size");u.isArray(c)||(c=[c,c]),i.attr("scale",[c[0]/2,c[1]/2]),v.createOrUpdate(this,"_doDispatchAxisPointer",r.get("throttle")||0,"fixRate"),this._moveHandleToValue(t,o)}},_moveHandleToValue:function(t,e){r(this._axisPointerModel,!e&&this._moveAnimation,this._handle,s(this.getHandleTransform(t,this._axisModel,this._axisPointerModel)))},_onHandleDragMove:function(t,e){var n=this._handle;if(n){this._dragging=!0;var i=this.updateHandleTransform(s(n),[t,e],this._axisModel,this._axisPointerModel);this._payloadInfo=i,n.stopAnimation(),n.attr(s(i)),d(n).lastProp=null,this._doDispatchAxisPointer()}},_doDispatchAxisPointer:function(){var t=this._handle;if(t){var e=this._payloadInfo,n={type:"updateAxisPointer",x:e.cursorPoint[0],y:e.cursorPoint[1],tooltipOption:e.tooltipOption,highDownKey:"axisPointerHandle"},i=this._axisModel.axis;n[i.dim+"AxisId"]=this._axisModel.id,this._api.dispatchAction(n)}},_onHandleDragEnd:function(t){this._dragging=!1;var e=this._handle;if(e){var n=this._axisPointerModel.get("value");this._moveHandleToValue(n),this._api.dispatchAction({type:"hideTip"})}},getHandleTransform:null,updateHandleTransform:null,clear:function(t){this._lastValue=null,this._lastStatus=null;var e=t.getZr(),n=this._group,i=this._handle;e&&n&&(this._lastGraphicKey=null,n&&e.remove(n),i&&e.remove(i),this._group=null,this._handle=null,this._payloadInfo=null)},doClear:function(){},buildLabel:function(t,e,n){return n=n||0,{x:t[n],y:t[1-n],width:e[n],height:e[1-n]}}},i.prototype.constructor=i,c.enableClassExtend(i),t.exports=i},function(t,e,n){var i=n(1),r=n(5);t.exports=function(t,e){var n,a=[],o=t.seriesIndex;if(null==o||!(n=e.getSeriesByIndex(o)))return{point:[]};var s=n.getData(),l=r.queryDataIndex(s,t);if(null==l||i.isArray(l))return{point:[]};var h=s.getItemGraphicEl(l),u=n.coordinateSystem;if(n.getTooltipPosition)a=n.getTooltipPosition(l)||[];else if(u&&u.dataToPoint)a=u.dataToPoint(s.getValues(i.map(u.dimensions,function(t){return n.coordDimToDataDim(t)[0]}),l,!0))||[];else if(h){var c=h.getBoundingRect().clone();c.applyTransform(h.transform),a=[c.x+c.width/2,c.y+c.height/2]}return{point:a,el:h}}},function(t,e,n){function i(t,e){function n(n,i){t.on(n,function(n){var a=s(e);c(u(t).records,function(t){t&&i(t,n,a.dispatchAction)}),r(a.pendings,e)})}u(t).initialized||(u(t).initialized=!0,n("click",h.curry(o,"click")),n("mousemove",h.curry(o,"mousemove")),n("globalout",a))}function r(t,e){var n,i=t.showTip.length,r=t.hideTip.length;i?n=t.showTip[i-1]:r&&(n=t.hideTip[r-1]),n&&(n.dispatchAction=null,e.dispatchAction(n))}function a(t,e,n){t.handler("leave",null,n)}function o(t,e,n,i){e.handler(t,n,i)}function s(t){var e={showTip:[],hideTip:[]},n=function(i){var r=e[i.type];r?r.push(i):(i.dispatchAction=n,t.dispatchAction(i))};return{dispatchAction:n,pendings:e}}var l=n(9),h=n(1),u=n(5).makeGetter(),c=h.each,f={};f.register=function(t,e,n){if(!l.node){var r=e.getZr();u(r).records||(u(r).records={}),i(r,e);var a=u(r).records[t]||(u(r).records[t]={});a.handler=n}},f.unregister=function(t,e){if(!l.node){var n=e.getZr(),i=(u(n).records||{})[t];i&&(u(n).records[t]=null)}},t.exports=f},,function(t,e,n){var i=n(1);t.exports={updateSelectedMap:function(t){this._selectTargetMap=i.reduce(t||[],function(t,e){return t[e.name]=e,t},{})},select:function(t){var e=this._selectTargetMap,n=e[t],r=this.get("selectedMode");"single"===r&&i.each(e,function(t){t.selected=!1}),n&&(n.selected=!0)},unSelect:function(t){var e=this._selectTargetMap[t];e&&(e.selected=!1)},toggleSelected:function(t){var e=this._selectTargetMap[t];if(null!=e)return this[e.selected?"unSelect":"select"](t),e.selected},isSelected:function(t){var e=this._selectTargetMap[t];return e&&e.selected}}},,,,,function(t,e){t.exports=function(t,e){var n={};e.eachRawSeriesByType(t,function(t){var i=t.getRawData(),r={};if(!e.isSeriesFiltered(t)){var a=t.getData();a.each(function(t){var e=a.getRawIndex(t);r[e]=t}),i.each(function(e){var o=r[e],s=null!=o&&a.getItemVisual(o,"color",!0);if(s)i.setItemVisual(e,"color",s);else{var l=i.getItemModel(e),h=l.get("itemStyle.normal.color")||t.getColorFromPalette(i.getName(e),n);i.setItemVisual(e,"color",h),null!=o&&a.setItemVisual(o,"color",h)}})}})}},function(t,e,n){var i=n(6),r=n(21),a={},o=Math.min,s=Math.max,l=Math.sin,h=Math.cos,u=i.create(),c=i.create(),f=i.create(),d=2*Math.PI;a.fromPoints=function(t,e,n){if(0!==t.length){var i,r=t[0],a=r[0],l=r[0],h=r[1],u=r[1];for(i=1;i1e-4)return p[0]=t-n,p[1]=e-r,g[0]=t+n,void(g[1]=e+r);if(u[0]=h(a)*n+t,u[1]=l(a)*r+e,c[0]=h(o)*n+t,c[1]=l(o)*r+e,v(p,u,c),m(g,u,c),a%=d,a<0&&(a+=d),o%=d,o<0&&(o+=d),a>o&&!s?o+=d:aa&&(f[0]=h(_)*n+t,f[1]=l(_)*r+e,v(p,f,p),m(g,f,g))},t.exports=a},function(t,e,n){var i=n(40),r=n(1),a=n(16),o=function(t){i.call(this,t)};o.prototype={constructor:o,type:"text",brush:function(t,e){var n=this.style,i=n.x||0,r=n.y||0,o=n.text;if(null!=o&&(o+=""),n.bind(t,this,e),o){this.setTransform(t);var s,l=n.textAlign,h=n.textFont||n.font;if(n.textVerticalAlign){var u=a.getBoundingRect(o,h,n.textAlign,"top");switch(s="middle",n.textVerticalAlign){case"middle":r-=u.height/2-u.lineHeight/2;break;case"bottom":r-=u.height-u.lineHeight/2;break;default:r+=u.lineHeight/2}}else s=n.textBaseline;t.font=h||"12px sans-serif",t.textAlign=l||"left",t.textAlign!==l&&(t.textAlign="left"),t.textBaseline=s||"alphabetic",t.textBaseline!==s&&(t.textBaseline="alphabetic");for(var c=a.measureText("国",t.font).width,f=o.split("\n"),d=0;d=0?parseFloat(t)/100*e:parseFloat(t):t}var r=n(16),a=n(11),o=new a,s=function(){};s.prototype={constructor:s,drawRectText:function(t,e,n){var a=this.style,s=a.text;if(null!=s&&(s+=""),s){t.save();var l,h,u=a.textPosition,c=a.textOffset,f=a.textDistance,d=a.textAlign,p=a.textFont||a.font,g=a.textBaseline,v=a.textVerticalAlign;n=n||r.getBoundingRect(s,p,d,g);var m=this.transform;if(a.textTransform?this.setTransform(t):m&&(o.copy(e),o.applyTransform(m),e=o),u instanceof Array){if(l=e.x+i(u[0],e.width),h=e.y+i(u[1],e.height),d=d||"left",g=g||"top",v){switch(v){case"middle":h-=n.height/2-n.lineHeight/2;break;case"bottom":h-=n.height-n.lineHeight/2;break;default:h+=n.lineHeight/2}g="middle"}}else{var y=r.adjustTextPositionOnRect(u,e,n,f);l=y.x,h=y.y,d=d||y.textAlign,g=g||y.textBaseline}c&&(l+=c[0],h+=c[1]),t.textAlign=d||"left",t.textBaseline=g||"alphabetic";var x=a.textFill,_=a.textStroke;x&&(t.fillStyle=x),_&&(t.strokeStyle=_),t.font=p||"12px sans-serif",t.shadowBlur=a.textShadowBlur,t.shadowColor=a.textShadowColor||"transparent",t.shadowOffsetX=a.textShadowOffsetX,t.shadowOffsetY=a.textShadowOffsetY;var b=s.split("\n");a.textRotation&&(m&&t.translate(m[4],m[5]),t.rotate(a.textRotation),m&&t.translate(-m[4],-m[5]));for(var w=0;w=a||b<0)break;if(i(M)){if(x){b+=o;continue}break}if(b===n)t[o>0?"moveTo":"lineTo"](M[0],M[1]),c(d,M);else if(m>0){var T=b+o,S=e[T];if(x)for(;S&&i(e[T]);)T+=o,S=e[T];var A=.5,I=e[_],S=e[T];if(!S||i(S))c(p,M);else{i(S)&&!x&&(S=M),s.sub(f,S,I);var C,L;if("x"===y||"y"===y){var k="x"===y?0:1;C=Math.abs(M[k]-I[k]),L=Math.abs(M[k]-S[k])}else C=s.dist(M,I),L=s.dist(M,S);A=L/(L+C),u(p,M,f,-m*(1-A))}l(d,d,v),h(d,d,g),l(p,p,v),h(p,p,g),t.bezierCurveTo(d[0],d[1],p[0],p[1],M[0],M[1]),u(d,M,f,m*A)}else t.lineTo(M[0],M[1]);_=b,b+=o}return w}function a(t,e){var n=[1/0,1/0],i=[-(1/0),-(1/0)];if(e)for(var r=0;ri[0]&&(i[0]=a[0]),a[1]>i[1]&&(i[1]=a[1])}return{min:e?n:i,max:e?i:n}}var o=n(7),s=n(5),l=s.min,h=s.max,u=s.scaleAndAdd,c=s.copy,f=[],d=[],p=[];t.exports={Polyline:o.extend({type:"ec-polyline",shape:{points:[],smooth:0,smoothConstraint:!0,smoothMonotone:null,connectNulls:!1},style:{fill:null,stroke:"#000"},buildPath:function(t,e){var n=e.points,o=0,s=n.length,l=a(n,e.smoothConstraint);if(e.connectNulls){for(;s>0&&i(n[s-1]);s--);for(;o0&&i(n[l-1]);l--);for(;s=0?"p":"n",m=v[n],y=l[s][n][u],x=h[s][n][u];d.isHorizontal()?(i=y,r=m[1]+c,a=m[0]-x,o=f,h[s][n][u]+=a,Math.abs(a)e+s&&o>i+s||ot+s&&a>n+s||ae+u&&h>r+u&&h>o+u||ht+u&&l>n+u&&l>a+u||le&&a>i||ar?o:0}},function(t,e,n){"use strict";var i=n(1),r=n(37),a=function(t,e,n,i,a,o){this.x=null==t?0:t,this.y=null==e?0:e,this.x2=null==n?1:n,this.y2=null==i?0:i,this.type="linear",this.global=o||!1,r.call(this,a)};a.prototype={constructor:a},i.inherits(a,r),t.exports=a},function(t,e,n){"use strict";function i(t){return t>s||t<-s}var r=n(20),a=n(5),o=r.identity,s=5e-5,l=function(t){t=t||{},t.position||(this.position=[0,0]),null==t.rotation&&(this.rotation=0),t.scale||(this.scale=[1,1]),this.origin=this.origin||null},h=l.prototype;h.transform=null,h.needLocalTransform=function(){return i(this.rotation)||i(this.position[0])||i(this.position[1])||i(this.scale[0]-1)||i(this.scale[1]-1)},h.updateTransform=function(){var t=this.parent,e=t&&t.transform,n=this.needLocalTransform(),i=this.transform;return n||e?(i=i||r.create(),n?this.getLocalTransform(i):o(i),e&&(n?r.mul(i,t.transform,i):r.copy(i,t.transform)),this.transform=i,this.invTransform=this.invTransform||r.create(),void r.invert(this.invTransform,i)):void(i&&o(i))},h.getLocalTransform=function(t){t=t||[],o(t);var e=this.origin,n=this.scale,i=this.rotation,a=this.position;return e&&(t[4]-=e[0],t[5]-=e[1]),r.scale(t,t,n),i&&r.rotate(t,t,i),e&&(t[4]+=e[0],t[5]+=e[1]),t[4]+=a[0],t[5]+=a[1],t},h.setTransform=function(t){var e=this.transform,n=t.dpr||1;e?t.setTransform(n*e[0],n*e[1],n*e[2],n*e[3],n*e[4],n*e[5]):t.setTransform(n,0,0,n,0,0)},h.restoreTransform=function(t){var e=(this.transform,t.dpr||1);t.setTransform(e,0,0,e,0,0)};var u=[];h.decomposeTransform=function(){if(this.transform){var t=this.parent,e=this.transform;t&&t.transform&&(r.mul(u,t.invTransform,e),e=u);var n=e[0]*e[0]+e[1]*e[1],a=e[2]*e[2]+e[3]*e[3],o=this.position,s=this.scale;i(n-1)&&(n=Math.sqrt(n)),i(a-1)&&(a=Math.sqrt(a)),e[0]<0&&(n=-n),e[3]<0&&(a=-a),o[0]=e[4],o[1]=e[5],s[0]=n,s[1]=a,this.rotation=Math.atan2(-e[1]/a,e[0]/n)}},h.getGlobalScale=function(){var t=this.transform;if(!t)return[1,1];var e=Math.sqrt(t[0]*t[0]+t[1]*t[1]),n=Math.sqrt(t[2]*t[2]+t[3]*t[3]);return t[0]<0&&(e=-e),t[3]<0&&(n=-n),[e,n]},h.transformCoordToLocal=function(t,e){var n=[t,e],i=this.invTransform;return i&&a.applyTransform(n,n,i),n},h.transformCoordToGlobal=function(t,e){var n=[t,e],i=this.transform;return i&&a.applyTransform(n,n,i),n},t.exports=l},function(t,e,n){"use strict";function i(t){r.each(a,function(e){this[e]=r.bind(t[e],t)},this)}var r=n(1),a=["getDom","getZr","getWidth","getHeight","dispatchAction","isDisposed","on","off","getDataURL","getConnectedDataURL","getModel","getOption"];t.exports=i},function(t,e,n){var i=n(1);n(53),n(95),n(96);var r=n(87),a=n(2);a.registerLayout(i.curry(r,"bar")),a.registerVisual(function(t){t.eachSeriesByType("bar",function(t){var e=t.getData();e.setVisual("legendSymbol","roundRect")})}),n(31)},function(t,e,n){t.exports=n(80).extend({type:"series.bar",dependencies:["grid","polar"],brushSelector:"rect"})},function(t,e,n){"use strict";function i(t,e,n,i,r,a,o){var s=new h.Rect({shape:l.extend({},i)});if(a){var u=s.shape,c=r?"height":"width",f={};u[c]=0,f[c]=i[c],h[o?"updateProps":"initProps"](s,{shape:f},a,e)}return s}function r(t,e,n){n.style.text="",h.updateProps(n,{shape:{width:0}},e,t,function(){n.parent&&n.parent.remove(n)})}function a(t,e,n){var i=t.getItemLayout(e),r=s(n,i),a=i.width>0?1:-1,o=i.height>0?1:-1;return{x:i.x+a*r/2,y:i.y+o*r/2,width:i.width-a*r,height:i.height-o*r}}function o(t,e,n,i,r,a,o){var s=e.getItemVisual(n,"color"),c=e.getItemVisual(n,"opacity"),f=i.getModel("itemStyle.normal"),d=i.getModel("itemStyle.emphasis").getBarItemStyle();t.setShape("r",f.get("barBorderRadius")||0),t.useStyle(l.defaults({fill:s,opacity:c},f.getBarItemStyle()));var p=o?r.height>0?"bottom":"top":r.width>0?"left":"right";u.setLabel(t.style,d,i,s,a,n,p),h.setHoverStyle(t,d)}function s(t,e){var n=t.get(c)||0;return Math.min(n,Math.abs(e.width),Math.abs(e.height))}var l=n(1),h=n(3),u=n(81),c=["itemStyle","normal","barBorderWidth"];l.extend(n(11).prototype,n(97));var f=n(2).extendChartView({type:"bar",render:function(t,e,n){var i=t.get("coordinateSystem");return"cartesian2d"===i&&this._renderOnCartesian(t,e,n),this.group},dispose:l.noop,_renderOnCartesian:function(t,e,n){var s=this.group,l=t.getData(),u=this._data,c=t.coordinateSystem,f=c.getBaseAxis(),d=f.isHorizontal(),p=t.isAnimationEnabled()?t:null;l.diff(u).add(function(e){if(l.hasValue(e)){var n=l.getItemModel(e),r=a(l,e,n),h=i(l,e,n,r,d,p);l.setItemGraphicEl(e,h),s.add(h),o(h,l,e,n,r,t,d)}}).update(function(e,n){var r=u.getItemGraphicEl(n);if(!l.hasValue(e))return void s.remove(r);var c=l.getItemModel(e),f=a(l,e,c);r?h.updateProps(r,{shape:f},p,e):r=i(l,e,c,f,d,p,!0),l.setItemGraphicEl(e,r),s.add(r),o(r,l,e,c,f,t,d)}).remove(function(t){var e=u.getItemGraphicEl(t);e&&r(t,p,e)}).execute(),this._data=l},remove:function(t,e){var n=this.group,i=this._data;t.get("animation")?i&&i.eachItemGraphicEl(function(e){r(e.dataIndex,t,e)}):n.removeAll()}});t.exports=f},function(t,e,n){var i=n(30)([["fill","color"],["stroke","borderColor"],["lineWidth","borderWidth"],["stroke","barBorderColor"],["lineWidth","barBorderWidth"],["opacity"],["shadowBlur"],["shadowOffsetX"],["shadowOffsetY"],["shadowColor"]]);t.exports={getBarItemStyle:function(t){var e=i.call(this,t);if(this.getBorderLineDash){var n=this.getBorderLineDash();n&&(e.lineDash=n)}return e}}},,,function(t,e,n){var i=n(1),r=n(2),a=r.PRIORITY;n(101),n(102),r.registerVisual(i.curry(n(45),"line","circle","line")),r.registerLayout(i.curry(n(56),"line")),r.registerProcessor(a.PROCESSOR.STATISTIC,i.curry(n(135),"line")),n(31)},function(t,e,n){"use strict";var i=n(35),r=n(16);t.exports=r.extend({type:"series.line",dependencies:["grid","polar"],getInitialData:function(t,e){return i(t.data,this,e)},defaultOption:{zlevel:0,z:2,coordinateSystem:"cartesian2d",legendHoverLink:!0,hoverAnimation:!0,clipOverflow:!0,label:{normal:{position:"top"}},lineStyle:{normal:{width:2,type:"solid"}},step:!1,smooth:!1,smoothMonotone:null,symbol:"emptyCircle",symbolSize:4,symbolRotate:null,showSymbol:!0,showAllSymbol:!1,connectNulls:!1,sampling:"none",animationEasing:"linear",progressive:0,hoverLayerThreshold:1/0}})},function(t,e,n){"use strict";function i(t,e){if(t.length===e.length){for(var n=0;ne[0]?1:-1;e[0]+=i*n,e[1]-=i*n}return e}function o(t){return t>=0?1:-1}function s(t,e){var n=t.getBaseAxis(),i=t.getOtherAxis(n),r=n.onZero?0:i.scale.getExtent()[0],a=i.dim,s="x"===a||"radius"===a?1:0;return e.mapArray([a],function(i,l){for(var h,u=e.stackedOn;u&&o(u.get(a,l))===o(i);){h=u;break}var c=[];return c[s]=e.get(n.dim,l),c[1-s]=h?h.get(a,l,!0):r,t.dataToPoint(c)},!0)}function l(t,e,n){var i=a(t.getAxis("x")),r=a(t.getAxis("y")),o=t.getBaseAxis().isHorizontal(),s=Math.min(i[0],i[1]),l=Math.min(r[0],r[1]),h=Math.max(i[0],i[1])-s,u=Math.max(r[0],r[1])-l,c=n.get("lineStyle.normal.width")||2,f=n.get("clipOverflow")?c/2:Math.max(h,u);o?(l-=f,u+=2*f):(s-=f,h+=2*f);var d=new m.Rect({shape:{x:s,y:l,width:h,height:u}});return e&&(d.shape[o?"width":"height"]=0,m.initProps(d,{shape:{width:h,height:u}},n)),d}function h(t,e,n){var i=t.getAngleAxis(),r=t.getRadiusAxis(),a=r.getExtent(),o=i.getExtent(),s=Math.PI/180,l=new m.Sector({shape:{cx:t.cx,cy:t.cy,r0:a[0],r:a[1],startAngle:-o[0]*s,endAngle:-o[1]*s,clockwise:i.inverse}});return e&&(l.shape.endAngle=-o[0]*s,m.initProps(l,{shape:{endAngle:-o[1]*s}},n)),l}function u(t,e,n){return"polar"===t.type?h(t,e,n):l(t,e,n)}function c(t,e,n){for(var i=e.getBaseAxis(),r="x"===i.dim||"radius"===i.dim?0:1,a=[],o=0;o=0;r--)if(n[r].dimension<2){i=n[r];break}if(i&&"cartesian2d"===e.type){var a=i.dimension,o=t.dimensions[a],s=e.getAxis(o),l=d.map(i.stops,function(t){return{coord:s.toGlobalCoord(s.dataToCoord(t.value)),color:t.color}}),h=l.length,u=i.outerColors.slice();h&&l[0].coord>l[h-1].coord&&(l.reverse(),u.reverse());var c=10,f=l[0].coord-c,p=l[h-1].coord+c,g=p-f;if(g<.001)return"transparent";d.each(l,function(t){t.offset=(t.coord-f)/g}),l.push({offset:h?l[h-1].offset:.5,color:u[1]||"transparent"}),l.unshift({offset:h?l[0].offset:.5,color:u[0]||"transparent"});var v=new m.LinearGradient(0,0,0,0,l,(!0));return v[o]=f,v[o+"2"]=p,v}}}var d=n(1),p=n(39),g=n(50),v=n(103),m=n(3),y=n(6),x=n(82),_=n(28);t.exports=_.extend({type:"line",init:function(){var t=new m.Group,e=new p;this.group.add(e.group),this._symbolDraw=e,this._lineGroup=t},render:function(t,e,n){var a=t.coordinateSystem,o=this.group,l=t.getData(),h=t.getModel("lineStyle.normal"),p=t.getModel("areaStyle.normal"),g=l.mapArray(l.getItemLayout,!0),v="polar"===a.type,m=this._coordSys,y=this._symbolDraw,x=this._polyline,_=this._polygon,b=this._lineGroup,w=t.get("animation"),M=!p.isEmpty(),T=s(a,l),S=t.get("showSymbol"),A=S&&!v&&!t.get("showAllSymbol")&&this._getSymbolIgnoreFunc(l,a),I=this._data;I&&I.eachItemGraphicEl(function(t,e){t.__temp&&(o.remove(t),I.setItemGraphicEl(e,null))}),S||y.remove(),o.add(b);var C=!v&&t.get("step");x&&m.type===a.type&&C===this._step?(M&&!_?_=this._newPolygon(g,T,a,w):_&&!M&&(b.remove(_),_=this._polygon=null),b.setClipPath(u(a,!1,t)),S&&y.updateData(l,A),l.eachItemGraphicEl(function(t){t.stopAnimation(!0)}),i(this._stackedOnPoints,T)&&i(this._points,g)||(w?this._updateAnimation(l,T,a,n,C):(C&&(g=c(g,a,C),T=c(T,a,C)),x.setShape({points:g}),_&&_.setShape({points:g,stackedOnPoints:T})))):(S&&y.updateData(l,A),C&&(g=c(g,a,C),T=c(T,a,C)),x=this._newPolyline(g,a,w),M&&(_=this._newPolygon(g,T,a,w)),b.setClipPath(u(a,!0,t)));var L=f(l,a)||l.getVisual("color");x.useStyle(d.defaults(h.getLineStyle(),{fill:"none",stroke:L,lineJoin:"bevel"}));var k=t.get("smooth");if(k=r(t.get("smooth")),x.setShape({smooth:k,smoothMonotone:t.get("smoothMonotone"),connectNulls:t.get("connectNulls")}),_){var P=l.stackedOn,D=0;if(_.useStyle(d.defaults(p.getAreaStyle(),{fill:L,opacity:.7,lineJoin:"bevel"})),P){var O=P.hostModel;D=r(O.get("smooth"))}_.setShape({smooth:k,stackedOnSmooth:D,smoothMonotone:t.get("smoothMonotone"),connectNulls:t.get("connectNulls")})}this._data=l,this._coordSys=a,this._stackedOnPoints=T,this._points=g,this._step=C},dispose:function(){},highlight:function(t,e,n,i){var r=t.getData(),a=y.queryDataIndex(r,i);if(!(a instanceof Array)&&null!=a&&a>=0){var o=r.getItemGraphicEl(a);if(!o){var s=r.getItemLayout(a);if(!s)return;o=new g(r,a),o.position=s,o.setZ(t.get("zlevel"),t.get("z")),o.ignore=isNaN(s[0])||isNaN(s[1]),o.__temp=!0,r.setItemGraphicEl(a,o),o.stopSymbolAnimation(!0),this.group.add(o)}o.highlight()}else _.prototype.highlight.call(this,t,e,n,i)},downplay:function(t,e,n,i){var r=t.getData(),a=y.queryDataIndex(r,i);if(null!=a&&a>=0){var o=r.getItemGraphicEl(a);o&&(o.__temp?(r.setItemGraphicEl(a,null),this.group.remove(o)):o.downplay())}else _.prototype.downplay.call(this,t,e,n,i)},_newPolyline:function(t){var e=this._polyline;return e&&this._lineGroup.remove(e),e=new x.Polyline({shape:{points:t},silent:!0,z2:10}),this._lineGroup.add(e),this._polyline=e,e},_newPolygon:function(t,e){var n=this._polygon;return n&&this._lineGroup.remove(n),n=new x.Polygon({shape:{points:t,stackedOnPoints:e},silent:!0}),this._lineGroup.add(n),this._polygon=n,n},_getSymbolIgnoreFunc:function(t,e){var n=e.getAxesByScale("ordinal")[0];if(n&&n.isLabelIgnored)return d.bind(n.isLabelIgnored,n)},_updateAnimation:function(t,e,n,i,r){var a=this._polyline,o=this._polygon,s=t.hostModel,l=v(this._data,t,this._stackedOnPoints,e,this._coordSys,n),h=l.current,u=l.stackedOnCurrent,f=l.next,d=l.stackedOnNext;r&&(h=c(l.current,n,r),u=c(l.stackedOnCurrent,n,r),f=c(l.next,n,r),d=c(l.stackedOnNext,n,r)),a.shape.__points=l.current,a.shape.points=h,m.updateProps(a,{shape:{points:f}},s),o&&(o.setShape({points:h,stackedOnPoints:u}),m.updateProps(o,{shape:{points:f,stackedOnPoints:d}},s));for(var p=[],g=l.status,y=0;y=0?1:-1}function i(t,e,i){for(var r,a=t.getBaseAxis(),o=t.getOtherAxis(a),s=a.onZero?0:o.scale.getExtent()[0],l=o.dim,h="x"===l||"radius"===l?1:0,u=e.stackedOn,c=e.get(l,i);u&&n(u.get(l,i))===n(c);){r=u;break}var f=[];return f[h]=e.get(a.dim,i),f[1-h]=r?r.get(l,i,!0):s,t.dataToPoint(f)}function r(t,e){var n=[];return e.diff(t).add(function(t){n.push({cmd:"+",idx:t})}).update(function(t,e){n.push({cmd:"=",idx:e,idx1:t})}).remove(function(t){n.push({cmd:"-",idx:t})}).execute(),n}t.exports=function(t,e,n,a,o,s){for(var l=r(t,e),h=[],u=[],c=[],f=[],d=[],p=[],g=[],v=s.dimensions,m=0;m0&&"scale"!==f){var g=o.getItemLayout(0),v=Math.max(n.getWidth(),n.getHeight())/2,m=l.bind(h.removeClipPath,h);h.setClipPath(this._createClipPath(g.cx,g.cy,v,g.startAngle,g.clockwise,m,t))}this._data=o}},dispose:function(){},_createClipPath:function(t,e,n,i,r,a,o){var l=new s.Sector({shape:{cx:t,cy:e,r0:0,r:n,startAngle:i,endAngle:i,clockwise:r}});return s.initProps(l,{shape:{endAngle:i+(r?1:-1)*Math.PI*2}},o,a),l},containPoint:function(t,e){var n=e.getData(),i=n.getItemLayout(0);if(i){var r=t[0]-i.cx,a=t[1]-i.cy,o=Math.sqrt(r*r+a*a);return o<=i.r&&o>=i.r0}}});t.exports=u},function(t,e,n){"use strict";function i(t,e,n,i,r,a,o){function s(e,n,i,r){for(var a=e;ae&&a+1t[a].y+t[a].height)return void l(a,i/2);l(n-1,i/2)}function l(e,n){for(var i=e;i>=0&&(t[i].y-=n,!(i>0&&t[i].y>t[i-1].y+t[i-1].height));i--);}function h(t,e,n,i,r,a){for(var o=a>0?e?Number.MAX_VALUE:0:e?Number.MAX_VALUE:0,s=0,l=t.length;s=o&&(f=o-10),!e&&f<=o&&(f=o+10),t[s].x=n+f*a,o=f}}t.sort(function(t,e){return t.y-e.y});for(var u,c=0,f=t.length,d=[],p=[],g=0;g=n?p.push(t[g]):d.push(t[g]);h(d,!1,e,n,i,r),h(p,!0,e,n,i,r)}function r(t,e,n,r,a,o){for(var s=[],l=[],h=0;h0?"left":"right"}var k=g.getModel("textStyle").getFont(),P=g.get("rotate")?b<0?-_+Math.PI:-_:0,D=t.getFormattedLabel(n,"normal")||l.getName(n),O=a.getBoundingRect(D,k,f,"top");u=!!P,d.label={x:i,y:r,position:v,height:O.height,len:y,len2:x,linePoints:c,textAlign:f,verticalAlign:"middle",font:k,rotation:P},M||h.push(d.label)}),!u&&t.get("avoidLabelOverlap")&&r(h,o,s,e,n,i)}},function(t,e,n){var i=n(4),r=i.parsePercent,a=n(107),o=n(1),s=2*Math.PI,l=Math.PI/180;t.exports=function(t,e,n,h){e.eachSeriesByType(t,function(t){var e=t.get("center"),h=t.get("radius");o.isArray(h)||(h=[0,h]),o.isArray(e)||(e=[e,e]);var u=n.getWidth(),c=n.getHeight(),f=Math.min(u,c),d=r(e[0],u),p=r(e[1],c),g=r(h[0],f/2),v=r(h[1],f/2),m=t.getData(),y=-t.get("startAngle")*l,x=t.get("minAngle")*l,_=m.getSum("value"),b=Math.PI/(_||m.count())*2,w=t.get("clockwise"),M=t.get("roseType"),T=t.get("stillShowZeroSum"),S=m.getDataExtent("value");S[0]=0;var A=s,I=0,C=y,L=w?1:-1;if(m.each("value",function(t,e){var n;if(isNaN(t))return void m.setItemLayout(e,{angle:NaN,startAngle:NaN,endAngle:NaN,clockwise:w,cx:d,cy:p,r0:g,r:M?NaN:v});n="area"!==M?0===_&&T?b:t*b:s/(m.count()||1),n=0;i--)c.isIdInner(e[i])&&e.splice(i,1);t[n]=e}}),delete t[b],t},getTheme:function(){return this._theme},getComponent:function(t,e){var n=this._componentsMap[t];if(n)return n[e||0]},queryComponents:function(t){var e=t.mainType;if(!e)return[];var n=t.index,i=t.id,r=t.name,a=this._componentsMap[e];if(!a||!a.length)return[];var o;if(null!=n)v(n)||(n=[n]),o=p(g(n,function(t){return a[t]}),function(t){return!!t});else if(null!=i){var s=v(i);o=p(a,function(t){return s&&m(i,t.id)>=0||!s&&t.id===i})}else if(null!=r){var h=v(r);o=p(a,function(t){return h&&m(r,t.name)>=0||!h&&t.name===r})}else o=a;return l(o,t)},findComponents:function(t){function e(t){var e=r+"Index",n=r+"Id",i=r+"Name";return!t||null==t[e]&&null==t[n]&&null==t[i]?null:{mainType:r,index:t[e],id:t[n],name:t[i]}}function n(e){return t.filter?p(e,t.filter):e}var i=t.query,r=t.mainType,a=e(i),o=a?this.queryComponents(a):this._componentsMap[r];return n(l(o,t))},eachComponent:function(t,e,n){var i=this._componentsMap;if("function"==typeof t)n=e,e=t,d(i,function(t,i){d(t,function(t,r){e.call(n,i,t,r)})});else if(u.isString(t))d(i[t],e,n);else if(y(t)){var r=this.findComponents(t);d(r,e,n)}},getSeriesByName:function(t){var e=this._componentsMap.series;return p(e,function(e){return e.name===t})},getSeriesByIndex:function(t){return this._componentsMap.series[t]},getSeriesByType:function(t){var e=this._componentsMap.series;return p(e,function(e){return e.subType===t})},getSeries:function(){return this._componentsMap.series.slice()},eachSeries:function(t,e){h(this),d(this._seriesIndices,function(n){var i=this._componentsMap.series[n];t.call(e,i,n)},this)},eachRawSeries:function(t,e){d(this._componentsMap.series,t,e)},eachSeriesByType:function(t,e,n){h(this),d(this._seriesIndices,function(i){var r=this._componentsMap.series[i];r.subType===t&&e.call(n,r,i)},this)},eachRawSeriesByType:function(t,e,n){return d(this.getSeriesByType(t),e,n)},isSeriesFiltered:function(t){return h(this),u.indexOf(this._seriesIndices,t.componentIndex)<0},filterSeries:function(t,e){h(this);var n=p(this._componentsMap.series,t,e);this._seriesIndices=s(n)},restoreData:function(){var t=this._componentsMap;this._seriesIndices=s(t.series);var e=[];d(t,function(t,n){e.push(n)}),x.topologicalTravel(e,x.getAllClassMainTypes(),function(e,n){d(t[e],function(t){t.restoreData()})})}});u.mixin(w,n(57)),t.exports=w},function(t,e,n){function i(t){this._api=t,this._timelineOptions=[],this._mediaList=[],this._mediaDefault,this._currentMediaIndices=[],this._optionBackup,this._newBaseOption}function r(t,e,n){var i,r,a=[],o=[],s=t.timeline;if(t.baseOption&&(r=t.baseOption),(s||t.options)&&(r=r||{},a=(t.options||[]).slice()),t.media){r=r||{};var l=t.media;f(l,function(t){t&&t.option&&(t.query?o.push(t):i||(i=t))})}return r||(r=t),r.timeline||(r.timeline=s),f([r].concat(a).concat(h.map(o,function(t){return t.option})),function(t){f(e,function(e){e(t,n)})}),{baseOption:r,timelineOptions:a,mediaDefault:i,mediaList:o}}function a(t,e,n){var i={width:e,height:n,aspectratio:e/n},r=!0;return h.each(t,function(t,e){var n=e.match(v);if(n&&n[1]&&n[2]){var a=n[1],s=n[2].toLowerCase();o(i[s],t,a)||(r=!1)}}),r}function o(t,e,n){return"min"===n?t>=e:"max"===n?t<=e:t===e}function s(t,e){return t.join(",")===e.join(",")}function l(t,e){e=e||{},f(e,function(e,n){if(null!=e){var i=t[n];if(c.hasClass(n)){e=u.normalizeToArray(e),i=u.normalizeToArray(i);var r=u.mappingToExists(i,e);t[n]=p(r,function(t){return t.option&&t.exist?g(t.exist,t.option,!0):t.exist||t.option})}else t[n]=g(i,e,!0)}})}var h=n(1),u=n(6),c=n(13),f=h.each,d=h.clone,p=h.map,g=h.merge,v=/^(min|max)?(.+)$/;i.prototype={constructor:i,setOption:function(t,e){t=d(t,!0);var n=this._optionBackup,i=r.call(this,t,e,!n);this._newBaseOption=i.baseOption,n?(l(n.baseOption,i.baseOption),i.timelineOptions.length&&(n.timelineOptions=i.timelineOptions),i.mediaList.length&&(n.mediaList=i.mediaList),i.mediaDefault&&(n.mediaDefault=i.mediaDefault)):this._optionBackup=i},mountOption:function(t){var e=this._optionBackup;return this._timelineOptions=p(e.timelineOptions,d),this._mediaList=p(e.mediaList,d),this._mediaDefault=d(e.mediaDefault),this._currentMediaIndices=[],d(t?e.baseOption:this._newBaseOption)},getTimelineOption:function(t){var e,n=this._timelineOptions;if(n.length){var i=t.getComponent("timeline");i&&(e=d(n[i.getCurrentIndex()],!0))}return e},getMediaOption:function(t){var e=this._api.getWidth(),n=this._api.getHeight(),i=this._mediaList,r=this._mediaDefault,o=[],l=[];if(!i.length&&!r)return l;for(var h=0,u=i.length;he&&(e=t[n]);return e},min:function(t){for(var e=1/0,n=0;n1){var c;"string"==typeof r?c=n[r]:"function"==typeof r&&(c=r),c&&(e=e.downSample(s.dim,1/u,c,i),t.setData(e))}}},this)}},function(t,e,n){function i(t,e){return c(t,u(e))}var r=n(1),a=n(32),o=n(4),s=n(38),l=a.prototype,h=s.prototype,u=o.getPrecisionSafe,c=o.round,f=Math.floor,d=Math.ceil,p=Math.pow,g=Math.log,v=a.extend({type:"log",base:10,$constructor:function(){a.apply(this,arguments),this._originalScale=new s},getTicks:function(){var t=this._originalScale,e=this._extent,n=t.getExtent();return r.map(h.getTicks.call(this),function(r){var a=o.round(p(this.base,r));return a=r===e[0]&&t.__fixMin?i(a,n[0]):a,a=r===e[1]&&t.__fixMax?i(a,n[1]):a},this)},getLabel:h.getLabel,scale:function(t){return t=l.scale.call(this,t),p(this.base,t)},setExtent:function(t,e){var n=this.base;t=g(t)/g(n),e=g(e)/g(n),h.setExtent.call(this,t,e)},getExtent:function(){var t=this.base,e=l.getExtent.call(this);e[0]=p(t,e[0]),e[1]=p(t,e[1]);var n=this._originalScale,r=n.getExtent();return n.__fixMin&&(e[0]=i(e[0],r[0])),n.__fixMax&&(e[1]=i(e[1],r[1])),e},unionExtent:function(t){this._originalScale.unionExtent(t);var e=this.base;t[0]=g(t[0])/g(e),t[1]=g(t[1])/g(e),l.unionExtent.call(this,t)},unionExtentFromData:function(t,e){this.unionExtent(t.getDataExtent(e,!0,function(t){return t>0}))},niceTicks:function(t){t=t||10;var e=this._extent,n=e[1]-e[0];if(!(n===1/0||n<=0)){var i=o.quantity(n),r=t/n*i;for(r<=.5&&(i*=10);!isNaN(i)&&Math.abs(i)<1&&Math.abs(i)>0;)i*=10;var a=[o.round(d(e[0]/i)*i),o.round(f(e[1]/i)*i)];this._interval=i,this._niceExtent=a}},niceExtent:function(t,e,n){h.niceExtent.call(this,t,e,n);var i=this._originalScale;i.__fixMin=e,i.__fixMax=n}});r.each(["contain","normalize"],function(t){v.prototype[t]=function(e){return e=g(e)/g(this.base),l[t].call(this,e)}}),v.create=function(){return new v},t.exports=v},function(t,e,n){var i=n(1),r=n(32),a=r.prototype,o=r.extend({type:"ordinal",init:function(t,e){this._data=t,this._extent=e||[0,t.length-1]},parse:function(t){return"string"==typeof t?i.indexOf(this._data,t):Math.round(t)},contain:function(t){return t=this.parse(t),a.contain.call(this,t)&&null!=this._data[t]},normalize:function(t){return a.normalize.call(this,this.parse(t))},scale:function(t){return Math.round(a.scale.call(this,t))},getTicks:function(){for(var t=[],e=this._extent,n=e[0];n<=e[1];)t.push(n),n++;return t},getLabel:function(t){return this._data[t]},count:function(){return this._extent[1]-this._extent[0]+1},unionExtentFromData:function(t,e){this.unionExtent(t.getDataExtent(e,!1))},niceTicks:i.noop,niceExtent:i.noop});o.create=function(){return new o},t.exports=o},function(t,e,n){var i=n(1),r=n(4),a=n(8),o=n(38),s=o.prototype,l=Math.ceil,h=Math.floor,u=1e3,c=60*u,f=60*c,d=24*f,p=function(t,e,n,i){for(;n>>1;t[r][2]=0;r--)if(!i[r].silent&&i[r]!==n&&!i[r].ignore&&a(i[r],t,e))return i[r]}},o.each(["click","mousedown","mouseup","mousewheel","dblclick","contextmenu"],function(t){u.prototype[t]=function(e){var n=this.findHover(e.zrX,e.zrY,null);if("mousedown"===t)this._downel=n,this._upel=n;else if("mosueup"===t)this._upel=n;else if("click"===t&&this._downel!==this._upel)return;this.dispatchToElement(n,t,e)}}),o.mixin(u,l),o.mixin(u,s),t.exports=u},function(t,e,n){function i(){return!1}function r(t,e,n,i){var r=document.createElement(e),a=n.getWidth(),o=n.getHeight(),s=r.style;return s.position="absolute",s.left=0,s.top=0,s.width=a+"px",s.height=o+"px",r.width=a*i,r.height=o*i,r.setAttribute("data-zr-dom-id",t),r}var a=n(1),o=n(33),s=n(66),l=n(65),h=function(t,e,n){var s;n=n||o.devicePixelRatio,"string"==typeof t?s=r(t,"canvas",e,n):a.isObject(t)&&(s=t,t=s.id),this.id=t,this.dom=s;var l=s.style;l&&(s.onselectstart=i,l["-webkit-user-select"]="none",l["user-select"]="none",l["-webkit-touch-callout"]="none",l["-webkit-tap-highlight-color"]="rgba(0,0,0,0)",l.padding=0,l.margin=0,l["border-width"]=0),this.domBack=null,this.ctxBack=null,this.painter=e,this.config=null,this.clearColor=0,this.motionBlur=!1,this.lastFrameAlpha=.7,this.dpr=n};h.prototype={constructor:h,elCount:0,__dirty:!0,initContext:function(){this.ctx=this.dom.getContext("2d"),this.ctx.dpr=this.dpr},createBackBuffer:function(){var t=this.dpr;this.domBack=r("back-"+this.id,"canvas",this.painter,t),this.ctxBack=this.domBack.getContext("2d"),1!=t&&this.ctxBack.scale(t,t)},resize:function(t,e){var n=this.dpr,i=this.dom,r=i.style,a=this.domBack;r.width=t+"px",r.height=e+"px",i.width=t*n,i.height=e*n,a&&(a.width=t*n,a.height=e*n,1!=n&&this.ctxBack.scale(n,n))},clear:function(t){var e=this.dom,n=this.ctx,i=e.width,r=e.height,a=this.clearColor,o=this.motionBlur&&!t,h=this.lastFrameAlpha,u=this.dpr;if(o&&(this.domBack||this.createBackBuffer(),this.ctxBack.globalCompositeOperation="copy",this.ctxBack.drawImage(e,0,0,i/u,r/u)),n.clearRect(0,0,i,r),a){var c;a.colorStops?(c=a.__canvasGradient||s.getGradient(n,a,{x:0,y:0,width:i,height:r}),a.__canvasGradient=c):a.image&&(c=l.prototype.getCanvasPattern.call(a,n)),n.save(),n.fillStyle=c||a,n.fillRect(0,0,i,r),n.restore()}if(o){var f=this.domBack;n.save(),n.globalAlpha=h,n.drawImage(f,0,0,i,r),n.restore()}}},t.exports=h},function(t,e,n){"use strict";function i(t){return parseInt(t,10)}function r(t){return!!t&&(!!t.isBuildin||"function"==typeof t.resize&&"function"==typeof t.refresh)}function a(t){t.__unusedCount++}function o(t){1==t.__unusedCount&&t.clear()}function s(t,e,n){return x.copy(t.getBoundingRect()),t.transform&&x.applyTransform(t.transform),_.width=e,_.height=n,!x.intersect(_)}function l(t,e){if(t==e)return!1;if(!t||!e||t.length!==e.length)return!0;for(var n=0;n=0&&n.splice(i,1),t.__hoverMir=null},clearHover:function(t){for(var e=this._hoverElements,n=0;n=0){if(!s){if(s=this._progressiveLayers[Math.min(h++,y-1)],s.ctx.save(),s.renderScope={},s&&s.__progress>s.__maxProgress){g=s.__nextIdxNotProg-1;continue}l=s.__progress,s.__dirty||(p=l),s.__progress=p+1}_===p&&this._doPaintEl(m,s,!0,s.renderScope)}else this._doPaintEl(m,i,e,o);m.__dirty=!1}}s&&n(s),a&&a.restore(),this._furtherProgressive=!1,f.each(this._progressiveLayers,function(t){t.__maxProgress>=t.__progress&&(this._furtherProgressive=!0)},this)},_doPaintEl:function(t,e,n,i){var r=e.ctx,a=t.transform;if((e.__dirty||n)&&!t.invisible&&0!==t.style.opacity&&(!a||a[0]||a[3])&&(!t.culling||!s(t,this._width,this._height))){var o=t.__clipPaths;(i.prevClipLayer!==e||l(o,i.prevElClipPaths))&&(i.prevElClipPaths&&(i.prevClipLayer.ctx.restore(),i.prevClipLayer=i.prevElClipPaths=null,i.prevEl=null),o&&(r.save(),h(o,r),i.prevClipLayer=e,i.prevElClipPaths=o)),t.beforeBrush&&t.beforeBrush(r),t.brush(r,i.prevEl||null),i.prevEl=t,t.afterBrush&&t.afterBrush(r)}},getLayer:function(t){if(this._singleCanvas)return this._layers[0];var e=this._layers[t];return e||(e=new v("zr_"+t,this,this.dpr),e.isBuildin=!0,this._layerConfig[t]&&f.merge(e,this._layerConfig[t],!0),this.insertLayer(t,e),e.initContext()),e},insertLayer:function(t,e){var n=this._layers,i=this._zlevelList,a=i.length,o=null,s=-1,l=this._domRoot;if(n[t])return void d("ZLevel "+t+" has been used already");if(!r(e))return void d("Layer of zlevel "+t+" is not valid");if(a>0&&t>i[0]){for(s=0;st);s++);o=n[i[s]]}if(i.splice(s+1,0,t),o){var h=o.dom;h.nextSibling?l.insertBefore(e.dom,h.nextSibling):l.appendChild(e.dom)}else l.firstChild?l.insertBefore(e.dom,l.firstChild):l.appendChild(e.dom);n[t]=e},eachLayer:function(t,e){var n,i,r=this._zlevelList;for(i=0;i=0){o!==g&&(o=g,l++);var m=c.__frame=l-1;if(!a){var x=Math.min(s,y-1);a=n[x],a||(a=n[x]=new v("progressive",this,this.dpr),a.initContext()),a.__maxProgress=0}a.__dirty=a.__dirty||c.__dirty,a.elCount++,a.__maxProgress=Math.max(a.__maxProgress,m),a.__maxProgress>=a.__progress&&(p.__dirty=!0)}else c.__frame=-1,a&&(a.__nextIdxNotProg=h,s++,a=null)}a&&(s++,a.__nextIdxNotProg=h),this.eachBuildinLayer(function(t,e){i[e]!==t.elCount&&(t.__dirty=!0)}),n.length=Math.min(s,y),f.each(n,function(t,e){r[e]!==t.elCount&&(c.__dirty=!0),t.__dirty&&(t.__progress=0)})},clear:function(){return this.eachBuildinLayer(this._clearLayer),this},_clearLayer:function(t){t.clear()},configLayer:function(t,e){if(e){var n=this._layerConfig;n[t]?f.merge(n[t],e,!0):n[t]=e;var i=this._layers[t];i&&f.merge(i,n[t],!0)}},delLayer:function(t){var e=this._layers,n=this._zlevelList,i=e[t];i&&(i.dom.parentNode.removeChild(i.dom),delete e[t],n.splice(f.indexOf(n,t),1))},resize:function(t,e){var n=this._domRoot;n.style.display="none";var i=this._opts;if(null!=t&&(i.width=t),null!=e&&(i.height=e),t=this._getSize(0),e=this._getSize(1),n.style.display="",this._width!=t||e!=this._height){n.style.width=t+"px",n.style.height=e+"px";for(var r in this._layers)this._layers.hasOwnProperty(r)&&this._layers[r].resize(t,e);f.each(this._progressiveLayers,function(n){n.resize(t,e)}),this.refresh(!0)}return this._width=t,this._height=e,this},clearLayer:function(t){var e=this._layers[t];e&&e.clear()},dispose:function(){this.root.innerHTML="",this.root=this.storage=this._domRoot=this._layers=null},getRenderedCanvas:function(t){if(t=t||{},this._singleCanvas)return this._layers[0].dom;var e=new v("image",this,t.pixelRatio||this.dpr);e.initContext(),e.clearColor=t.backgroundColor,e.clear();for(var n=this.storage.getDisplayList(!0),i={},r=0;r=0&&(this.delFromMap(a.id),this._roots.splice(s,1),a instanceof o&&a.delChildrenFromStorage(this))}},addToMap:function(t){return t instanceof o&&(t.__storage=this),t.dirty(!1),this._elements[t.id]=t,this},get:function(t){return this._elements[t]},delFromMap:function(t){var e=this._elements,n=e[t];return n&&(delete e[t],n instanceof o&&(n.__storage=null)),this},dispose:function(){this._elements=this._renderList=this._roots=null},displayableSortFunc:i},t.exports=l},function(t,e,n){"use strict";var i=n(1),r=n(25).Dispatcher,a=n(62),o=n(61),s=function(t){t=t||{},this.stage=t.stage||{},this.onframe=t.onframe||function(){},this._clips=[],this._running=!1,this._time,this._pausedTime,this._pauseStart,this._paused=!1,r.call(this)};s.prototype={constructor:s,addClip:function(t){this._clips.push(t)},addAnimator:function(t){t.animation=this;for(var e=t.getClips(),n=0;n=0&&this._clips.splice(e,1)},removeAnimator:function(t){for(var e=t.getClips(),n=0;nn||f+co&&(o+=r);var p=Math.atan2(u,h);return p<0&&(p+=r),p>=a&&p<=o||p+r>=a&&p+r<=o}}},function(t,e,n){var i=n(18);t.exports={containStroke:function(t,e,n,r,a,o,s,l,h,u,c){if(0===h)return!1;var f=h;if(c>e+f&&c>r+f&&c>o+f&&c>l+f||ct+f&&u>n+f&&u>a+f&&u>s+f||ue&&u>i&&u>o&&u>l||u1&&r(),f=g.cubicAt(e,i,o,l,b[0]),v>1&&(d=g.cubicAt(e,i,o,l,b[1]))),p+=2==v?ye&&s>i&&s>a||s=0&&h<=1){for(var u=0,c=g.quadraticAt(e,i,a,h),f=0;fn||s<-n)return 0;var l=Math.sqrt(n*n-s*s);_[0]=-l,_[1]=l;var h=Math.abs(i-r);if(h<1e-4)return 0;if(h%y<1e-4){i=0,r=y;var u=a?1:-1;return o>=_[0]+t&&o<=_[1]+t?u:0}if(a){var l=i;i=p(r),r=p(l)}else i=p(i),r=p(r);i>r&&(r+=y);for(var c=0,f=0;f<2;f++){var d=_[f];if(d+t>o){var g=Math.atan2(s,d),u=a?1:-1;g<0&&(g=y+g),(g>=i&&g<=r||g+y>=i&&g+y<=r)&&(g>Math.PI/2&&g<1.5*Math.PI&&(u=-u),c+=u)}}return c}function l(t,e,n,r,l){for(var u=0,p=0,g=0,y=0,x=0,_=0;_1&&(n||(u+=v(p,g,y,x,r,l))),1==_&&(p=t[_],g=t[_+1],y=p,x=g),b){case h.M:y=t[_++],x=t[_++],p=y,g=x;break;case h.L:if(n){if(m(p,g,t[_],t[_+1],e,r,l))return!0}else u+=v(p,g,t[_],t[_+1],r,l)||0;p=t[_++],g=t[_++];break;case h.C:if(n){if(c.containStroke(p,g,t[_++],t[_++],t[_++],t[_++],t[_],t[_+1],e,r,l))return!0}else u+=a(p,g,t[_++],t[_++],t[_++],t[_++],t[_],t[_+1],r,l)||0;p=t[_++],g=t[_++];break;case h.Q:if(n){if(f.containStroke(p,g,t[_++],t[_++],t[_],t[_+1],e,r,l))return!0}else u+=o(p,g,t[_++],t[_++],t[_],t[_+1],r,l)||0;p=t[_++],g=t[_++];break;case h.A:var w=t[_++],M=t[_++],T=t[_++],S=t[_++],A=t[_++],I=t[_++],C=(t[_++],1-t[_++]),L=Math.cos(A)*T+w,k=Math.sin(A)*S+M;_>1?u+=v(p,g,L,k,r,l):(y=L,x=k);var P=(r-w)*S/T+w;if(n){if(d.containStroke(w,M,S,A,A+I,C,e,P,l))return!0}else u+=s(w,M,S,A,A+I,C,P,l);p=Math.cos(A+I)*T+w,g=Math.sin(A+I)*S+M;break;case h.R:y=p=t[_++],x=g=t[_++];var D=t[_++],O=t[_++],L=y+D,k=x+O;if(n){if(m(y,x,L,x,e,r,l)||m(L,x,L,k,e,r,l)||m(L,k,y,k,e,r,l)||m(y,k,y,x,e,r,l))return!0}else u+=v(L,x,L,k,r,l),u+=v(y,k,y,x,r,l);break;case h.Z:if(n){if(m(p,g,y,x,e,r,l))return!0}else u+=v(p,g,y,x,r,l);p=y,g=x}}return n||i(g,x)||(u+=v(p,g,y,x,r,l)||0),0!==u}var h=n(29).CMD,u=n(88),c=n(148),f=n(89),d=n(147),p=n(63).normalizeRadian,g=n(18),v=n(90),m=u.containStroke,y=2*Math.PI,x=1e-4,_=[-1,-1,-1],b=[-1,-1];t.exports={contain:function(t,e,n){return l(t,0,!1,e,n)},containStroke:function(t,e,n,i){return l(t,e,!0,n,i)}}},function(t,e,n){"use strict";function i(t){var e=t[1][0]-t[0][0],n=t[1][1]-t[0][1];return Math.sqrt(e*e+n*n)}function r(t){return[(t[0][0]+t[1][0])/2,(t[0][1]+t[1][1])/2]}var a=n(25),o=function(){this._track=[]};o.prototype={constructor:o,recognize:function(t,e,n){return this._doTrack(t,e,n),this._recognize(t)},clear:function(){return this._track.length=0,this},_doTrack:function(t,e,n){var i=t.touches;if(i){for(var r={points:[],touches:[],target:e,event:t},o=0,s=i.length;o1&&a&&a.length>1){var s=i(a)/i(o);!isFinite(s)&&(s=1),e.pinchScale=s;var l=r(a);return e.pinchX=l[0],e.pinchY=l[1],{type:"pinch",target:t[0].target,event:e}}}}};t.exports=o},function(t,e){var n=function(){this.head=null,this.tail=null,this._len=0},i=n.prototype;i.insert=function(t){var e=new r(t);return this.insertEntry(e),e},i.insertEntry=function(t){this.head?(this.tail.next=t,t.prev=this.tail,this.tail=t):this.head=this.tail=t,this._len++},i.remove=function(t){var e=t.prev,n=t.next;e?e.next=n:this.head=n,n?n.prev=e:this.tail=e,t.next=t.prev=null,this._len--},i.len=function(){return this._len};var r=function(t){this.value=t,this.next,this.prev},a=function(t){this._list=new n,this._map={},this._maxSize=t||10},o=a.prototype;o.put=function(t,e){var n=this._list,i=this._map;if(null==i[t]){var r=n.len();if(r>=this._maxSize&&r>0){var a=n.head;n.remove(a),delete i[a.key]}var o=n.insert(e);o.key=t,i[t]=o}},o.get=function(t){var e=this._map[t],n=this._list;if(null!=e)return e!==n.tail&&(n.remove(e),n.insertEntry(e)),e.value},o.clear=function(){this._list.clear(),this._map={}},t.exports=a},function(t,e,n){function i(t){return"mousewheel"===t&&f.browser.firefox?"DOMMouseScroll":t}function r(t,e,n){var i=t._gestureMgr;"start"===n&&i.clear();var r=i.recognize(e,t.handler.findHover(e.zrX,e.zrY,null),t.dom);if("end"===n&&i.clear(),r){var a=r.type;e.gestureEvent=a,t.handler.dispatchToElement(r.target,a,r.event)}}function a(t){t._touching=!0,clearTimeout(t._touchTimer),t._touchTimer=setTimeout(function(){t._touching=!1},700)}function o(t){var e=t.pointerType;return"pen"===e||"touch"===e}function s(t){function e(t,e){return function(){if(!e._touching)return t.apply(e,arguments)}}u.each(x,function(e){t._handlers[e]=u.bind(w[e],t)}),u.each(b,function(e){t._handlers[e]=u.bind(w[e],t)}),u.each(y,function(n){t._handlers[n]=e(w[n],t)})}function l(t){function e(e,n){u.each(e,function(e){p(t,i(e),n._handlers[e])},n)}c.call(this),this.dom=t,this._touching=!1,this._touchTimer,this._gestureMgr=new d,this._handlers={},s(this),f.pointerEventsSupported?e(b,this):(f.touchEventsSupported&&e(x,this),e(y,this))}var h=n(25),u=n(1),c=n(21),f=n(10),d=n(150),p=h.addEventListener,g=h.removeEventListener,v=h.normalizeEvent,m=300,y=["click","dblclick","mousewheel","mouseout","mouseup","mousedown","mousemove","contextmenu"],x=["touchstart","touchend","touchmove"],_={pointerdown:1,pointerup:1,pointermove:1,pointerout:1},b=u.map(y,function(t){var e=t.replace("mouse","pointer");return _[e]?e:t}),w={mousemove:function(t){t=v(this.dom,t),this.trigger("mousemove",t)},mouseout:function(t){t=v(this.dom,t);var e=t.toElement||t.relatedTarget;if(e!=this.dom)for(;e&&9!=e.nodeType;){if(e===this.dom)return;e=e.parentNode}this.trigger("mouseout",t)},touchstart:function(t){t=v(this.dom,t),t.zrByTouch=!0,this._lastTouchMoment=new Date,r(this,t,"start"),w.mousemove.call(this,t),w.mousedown.call(this,t),a(this)},touchmove:function(t){t=v(this.dom,t),t.zrByTouch=!0,r(this,t,"change"),w.mousemove.call(this,t),a(this)},touchend:function(t){t=v(this.dom,t),t.zrByTouch=!0,r(this,t,"end"),w.mouseup.call(this,t),+new Date-this._lastTouchMomentl&&(c=n+i,n*=l/c,i*=l/c),r+a>l&&(c=r+a,r*=l/c,a*=l/c),i+r>h&&(c=i+r,i*=h/c,r*=h/c),n+a>h&&(c=n+a,n*=h/c,a*=h/c),t.moveTo(o+n,s),t.lineTo(o+l-i,s),0!==i&&t.quadraticCurveTo(o+l,s,o+l,s+i),t.lineTo(o+l,s+h-r),0!==r&&t.quadraticCurveTo(o+l,s+h,o+l-r,s+h),t.lineTo(o+a,s+h),0!==a&&t.quadraticCurveTo(o,s+h,o,s+h-a),t.lineTo(o,s+n),0!==n&&t.quadraticCurveTo(o,s,o+n,s)}}},function(t,e,n){var i=n(5),r=i.min,a=i.max,o=i.scale,s=i.distance,l=i.add;t.exports=function(t,e,n,h){var u,c,f,d,p=[],g=[],v=[],m=[];if(h){f=[1/0,1/0],d=[-(1/0),-(1/0)];for(var y=0,x=t.length;yn-2?n-1:d+1],c=t[d>n-3?n-1:d+2]);var v=p*p,m=p*v;a.push([i(h[0],g[0],u[0],c[0],p,v,m),i(h[1],g[1],u[1],c[1],p,v,m)])}return a}},function(t,e,n){t.exports=n(7).extend({type:"arc",shape:{cx:0,cy:0,r:0,startAngle:0,endAngle:2*Math.PI,clockwise:!0},style:{stroke:"#000",fill:null},buildPath:function(t,e){var n=e.cx,i=e.cy,r=Math.max(e.r,0),a=e.startAngle,o=e.endAngle,s=e.clockwise,l=Math.cos(a),h=Math.sin(a);t.moveTo(l*r+n,h*r+i),t.arc(n,i,r,a,o,!s)}})},function(t,e,n){"use strict";function i(t,e,n){var i=t.cpx2,r=t.cpy2;return null===i||null===r?[(n?c:h)(t.x1,t.cpx1,t.cpx2,t.x2,e),(n?c:h)(t.y1,t.cpy1,t.cpy2,t.y2,e)]:[(n?u:l)(t.x1,t.cpx1,t.x2,e),(n?u:l)(t.y1,t.cpy1,t.y2,e)]}var r=n(18),a=n(5),o=r.quadraticSubdivide,s=r.cubicSubdivide,l=r.quadraticAt,h=r.cubicAt,u=r.quadraticDerivativeAt,c=r.cubicDerivativeAt,f=[];t.exports=n(7).extend({type:"bezier-curve",shape:{x1:0,y1:0,x2:0,y2:0,cpx1:0,cpy1:0,percent:1},style:{stroke:"#000",fill:null},buildPath:function(t,e){var n=e.x1,i=e.y1,r=e.x2,a=e.y2,l=e.cpx1,h=e.cpy1,u=e.cpx2,c=e.cpy2,d=e.percent;0!==d&&(t.moveTo(n,i),null==u||null==c?(d<1&&(o(n,l,r,d,f),l=f[1],r=f[2],o(i,h,a,d,f),h=f[1],a=f[2]),t.quadraticCurveTo(l,h,r,a)):(d<1&&(s(n,l,u,r,d,f),l=f[1],u=f[2],r=f[3],s(i,h,c,a,d,f),h=f[1],c=f[2],a=f[3]),t.bezierCurveTo(l,h,u,c,r,a)))},pointAt:function(t){return i(this.shape,t,!1)},tangentAt:function(t){var e=i(this.shape,t,!0);return a.normalize(e,e)}})},function(t,e,n){"use strict";t.exports=n(7).extend({type:"circle",shape:{cx:0,cy:0,r:0},buildPath:function(t,e,n){n&&t.moveTo(e.cx+e.r,e.cy),t.arc(e.cx,e.cy,e.r,0,2*Math.PI,!0)}})},function(t,e,n){t.exports=n(7).extend({type:"line",shape:{x1:0,y1:0,x2:0,y2:0,percent:1},style:{stroke:"#000",fill:null},buildPath:function(t,e){var n=e.x1,i=e.y1,r=e.x2,a=e.y2,o=e.percent;0!==o&&(t.moveTo(n,i),o<1&&(r=n*(1-o)+r*o,a=i*(1-o)+a*o),t.lineTo(r,a))},pointAt:function(t){var e=this.shape;return[e.x1*(1-t)+e.x2*t,e.y1*(1-t)+e.y2*t]}})},function(t,e,n){var i=n(67);t.exports=n(7).extend({type:"polygon",shape:{points:null,smooth:!1,smoothConstraint:null},buildPath:function(t,e){i.buildPath(t,e,!0)}})},function(t,e,n){var i=n(67);t.exports=n(7).extend({type:"polyline",shape:{points:null,smooth:!1,smoothConstraint:null},style:{stroke:"#000",fill:null},buildPath:function(t,e){i.buildPath(t,e,!1)}})},function(t,e,n){var i=n(155);t.exports=n(7).extend({type:"rect",shape:{r:0,x:0,y:0,width:0,height:0},buildPath:function(t,e){var n=e.x,r=e.y,a=e.width,o=e.height;e.r?i.buildPath(t,e):t.rect(n,r,a,o),t.closePath()}})},function(t,e,n){t.exports=n(7).extend({type:"ring",shape:{cx:0,cy:0,r:0,r0:0},buildPath:function(t,e){var n=e.cx,i=e.cy,r=2*Math.PI;t.moveTo(n+e.r,i),t.arc(n,i,e.r,0,r,!1),t.moveTo(n+e.r0,i),t.arc(n,i,e.r0,0,r,!0)}})},function(t,e,n){var i=n(10),r=n(7),a=[["shadowBlur",0],["shadowColor","#000"],["shadowOffsetX",0],["shadowOffsetY",0]];t.exports=r.extend({type:"sector",shape:{cx:0,cy:0,r0:0,r:0,startAngle:0,endAngle:2*Math.PI,clockwise:!0},brush:i.browser.ie&&i.browser.version>=11?function(){var t,e=this.__clipPaths,n=this.style;if(e)for(var i=0;i0&&this.animate(t,!1).when(null==i?500:i,o).delay(a||0),this}},t.exports=h},function(t,e){function n(){this.on("mousedown",this._dragStart,this),this.on("mousemove",this._drag,this),this.on("mouseup",this._dragEnd,this),this.on("globalout",this._dragEnd,this)}n.prototype={constructor:n,_dragStart:function(t){var e=t.target;e&&e.draggable&&(this._draggingTarget=e,e.dragging=!0,this._x=t.offsetX,this._y=t.offsetY,this.dispatchToElement(e,"dragstart",t.event))},_drag:function(t){var e=this._draggingTarget;if(e){var n=t.offsetX,i=t.offsetY,r=n-this._x,a=i-this._y;this._x=n,this._y=i,e.drift(r,a,t),this.dispatchToElement(e,"drag",t.event);var o=this.findHover(n,i,e),s=this._dropTarget;this._dropTarget=o,e!==o&&(s&&o!==s&&this.dispatchToElement(s,"dragleave",t.event),o&&o!==s&&this.dispatchToElement(o,"dragenter",t.event))}},_dragEnd:function(t){var e=this._draggingTarget;e&&(e.dragging=!1),this.dispatchToElement(e,"dragend",t.event),this._dropTarget&&this.dispatchToElement(this._dropTarget,"drop",t.event),this._draggingTarget=null,this._dropTarget=null}},t.exports=n},function(t,e,n){function i(t,e,n,i,r,a,o,s,l,h,u){var g=l*(p/180),y=d(g)*(t-n)/2+f(g)*(e-i)/2,x=-1*f(g)*(t-n)/2+d(g)*(e-i)/2,_=y*y/(o*o)+x*x/(s*s);_>1&&(o*=c(_),s*=c(_));var b=(r===a?-1:1)*c((o*o*(s*s)-o*o*(x*x)-s*s*(y*y))/(o*o*(x*x)+s*s*(y*y)))||0,w=b*o*x/s,M=b*-s*y/o,T=(t+n)/2+d(g)*w-f(g)*M,S=(e+i)/2+f(g)*w+d(g)*M,A=m([1,0],[(y-w)/o,(x-M)/s]),I=[(y-w)/o,(x-M)/s],C=[(-1*y-w)/o,(-1*x-M)/s],L=m(I,C);v(I,C)<=-1&&(L=p),v(I,C)>=1&&(L=0),0===a&&L>0&&(L-=2*p),1===a&&L<0&&(L+=2*p),u.addData(h,T,S,o,s,A,L,g,a)}function r(t){if(!t)return[];var e,n=t.replace(/-/g," -").replace(/ /g," ").replace(/ /g,",").replace(/,,/g,",");for(e=0;e0&&""===v[0]&&v.shift();for(var m=0;m=a||b<0)break;if(i(M)){if(x){b+=o;continue}break}if(b===n)t[o>0?"moveTo":"lineTo"](M[0],M[1]),c(d,M);else if(m>0){var T=b+o,S=e[T];if(x)for(;S&&i(e[T]);)T+=o,S=e[T];var A=.5,I=e[_],S=e[T];if(!S||i(S))c(p,M);else{i(S)&&!x&&(S=M),s.sub(f,S,I);var C,P;if("x"===y||"y"===y){var L="x"===y?0:1;C=Math.abs(M[L]-I[L]),P=Math.abs(M[L]-S[L])}else C=s.dist(M,I),P=s.dist(M,S);A=P/(P+C),u(p,M,f,-m*(1-A))}l(d,d,v),h(d,d,g),l(p,p,v),h(p,p,g),t.bezierCurveTo(d[0],d[1],p[0],p[1],M[0],M[1]),u(d,M,f,m*A)}else t.lineTo(M[0],M[1]);_=b,b+=o}return w}function a(t,e){var n=[1/0,1/0],i=[-(1/0),-(1/0)];if(e)for(var r=0;ri[0]&&(i[0]=a[0]),a[1]>i[1]&&(i[1]=a[1])}return{min:e?n:i,max:e?i:n}}var o=n(8),s=n(6),l=s.min,h=s.max,u=s.scaleAndAdd,c=s.copy,f=[],d=[],p=[];t.exports={Polyline:o.extend({type:"ec-polyline",shape:{points:[],smooth:0,smoothConstraint:!0,smoothMonotone:null,connectNulls:!1},style:{fill:null,stroke:"#000"},buildPath:function(t,e){var n=e.points,o=0,s=n.length,l=a(n,e.smoothConstraint);if(e.connectNulls){for(;s>0&&i(n[s-1]);s--);for(;o0&&i(n[l-1]);l--);for(;s=0?"p":"n",m=v[n],y=l[s][n][u],x=h[s][n][u];d.isHorizontal()?(i=y,r=m[1]+c,a=m[0]-x,o=f,h[s][n][u]+=a,Math.abs(a)e+s&&o>i+s||ot+s&&a>n+s||ae+u&&h>r+u&&h>o+u||ht+u&&l>n+u&&l>a+u||le&&a>i||ar?o:0}},function(t,e,n){"use strict";var i=n(1),r=n(41),a=function(t,e,n,i,a,o){this.x=null==t?0:t,this.y=null==e?0:e,this.x2=null==n?1:n,this.y2=null==i?0:i,this.type="linear",this.global=o||!1,r.call(this,a)};a.prototype={constructor:a},i.inherits(a,r),t.exports=a},function(t,e,n){"use strict";function i(t){return t>s||t<-s}var r=n(19),a=n(6),o=r.identity,s=5e-5,l=function(t){t=t||{},t.position||(this.position=[0,0]),null==t.rotation&&(this.rotation=0),t.scale||(this.scale=[1,1]),this.origin=this.origin||null},h=l.prototype;h.transform=null,h.needLocalTransform=function(){return i(this.rotation)||i(this.position[0])||i(this.position[1])||i(this.scale[0]-1)||i(this.scale[1]-1)},h.updateTransform=function(){var t=this.parent,e=t&&t.transform,n=this.needLocalTransform(),i=this.transform;return n||e?(i=i||r.create(),n?this.getLocalTransform(i):o(i),e&&(n?r.mul(i,t.transform,i):r.copy(i,t.transform)),this.transform=i,this.invTransform=this.invTransform||r.create(),void r.invert(this.invTransform,i)):void(i&&o(i))},h.getLocalTransform=function(t){t=t||[],o(t);var e=this.origin,n=this.scale,i=this.rotation,a=this.position;return e&&(t[4]-=e[0],t[5]-=e[1]),r.scale(t,t,n),i&&r.rotate(t,t,i),e&&(t[4]+=e[0],t[5]+=e[1]),t[4]+=a[0],t[5]+=a[1],t},h.setTransform=function(t){var e=this.transform,n=t.dpr||1;e?t.setTransform(n*e[0],n*e[1],n*e[2],n*e[3],n*e[4],n*e[5]):t.setTransform(n,0,0,n,0,0)},h.restoreTransform=function(t){var e=(this.transform,t.dpr||1);t.setTransform(e,0,0,e,0,0)};var u=[];h.decomposeTransform=function(){if(this.transform){var t=this.parent,e=this.transform;t&&t.transform&&(r.mul(u,t.invTransform,e),e=u);var n=e[0]*e[0]+e[1]*e[1],a=e[2]*e[2]+e[3]*e[3],o=this.position,s=this.scale;i(n-1)&&(n=Math.sqrt(n)),i(a-1)&&(a=Math.sqrt(a)),e[0]<0&&(n=-n),e[3]<0&&(a=-a),o[0]=e[4],o[1]=e[5],s[0]=n,s[1]=a,this.rotation=Math.atan2(-e[1]/a,e[0]/n)}},h.getGlobalScale=function(){var t=this.transform;if(!t)return[1,1];var e=Math.sqrt(t[0]*t[0]+t[1]*t[1]),n=Math.sqrt(t[2]*t[2]+t[3]*t[3]);return t[0]<0&&(e=-e),t[3]<0&&(n=-n),[e,n]},h.transformCoordToLocal=function(t,e){var n=[t,e],i=this.invTransform;return i&&a.applyTransform(n,n,i),n},h.transformCoordToGlobal=function(t,e){var n=[t,e],i=this.transform;return i&&a.applyTransform(n,n,i),n},t.exports=l},function(t,e,n){"use strict";function i(t,e){r.each(a,function(e){this[e]=r.bind(t[e],t)},this),this.getCoordinateSystems=r.bind(e.getCoordinateSystems,e)}var r=n(1),a=["getDom","getZr","getWidth","getHeight","getDevicePixelRatio","dispatchAction","isDisposed","on","off","getDataURL","getConnectedDataURL","getModel","getOption","getViewOfComponentModel","getViewOfSeriesModel"];t.exports=i},function(t,e,n){var i=n(1);n(56),n(105),n(106);var r=n(97),a=n(2);a.registerLayout(i.curry(r,"bar")),a.registerVisual(function(t){t.eachSeriesByType("bar",function(t){var e=t.getData();e.setVisual("legendSymbol","roundRect")})}),n(38)},function(t,e,n){t.exports=n(89).extend({type:"series.bar",dependencies:["grid","polar"],brushSelector:"rect"})},function(t,e,n){"use strict";function i(t,e,n,i,r,a,o){var s=new h.Rect({shape:l.extend({},i)});if(a){var u=s.shape,c=r?"height":"width",f={};u[c]=0,f[c]=i[c],h[o?"updateProps":"initProps"](s,{shape:f},a,e)}return s}function r(t,e,n){n.style.text="",h.updateProps(n,{shape:{width:0}},e,t,function(){n.parent&&n.parent.remove(n)})}function a(t,e,n){var i=t.getItemLayout(e),r=s(n,i),a=i.width>0?1:-1,o=i.height>0?1:-1;return{x:i.x+a*r/2,y:i.y+o*r/2,width:i.width-a*r,height:i.height-o*r}}function o(t,e,n,i,r,a,o){var s=e.getItemVisual(n,"color"),c=e.getItemVisual(n,"opacity"),f=i.getModel("itemStyle.normal"),d=i.getModel("itemStyle.emphasis").getBarItemStyle();t.setShape("r",f.get("barBorderRadius")||0),t.useStyle(l.defaults({fill:s,opacity:c},f.getBarItemStyle()));var p=o?r.height>0?"bottom":"top":r.width>0?"left":"right";u.setLabel(t.style,d,i,s,a,n,p),h.setHoverStyle(t,d)}function s(t,e){var n=t.get(c)||0;return Math.min(n,Math.abs(e.width),Math.abs(e.height))}var l=n(1),h=n(3),u=n(90),c=["itemStyle","normal","barBorderWidth"];l.extend(n(10).prototype,n(107));var f=n(2).extendChartView({type:"bar",render:function(t,e,n){var i=t.get("coordinateSystem");return"cartesian2d"===i&&this._renderOnCartesian(t,e,n),this.group},dispose:l.noop,_renderOnCartesian:function(t,e,n){var s=this.group,l=t.getData(),u=this._data,c=t.coordinateSystem,f=c.getBaseAxis(),d=f.isHorizontal(),p=t.isAnimationEnabled()?t:null;l.diff(u).add(function(e){if(l.hasValue(e)){var n=l.getItemModel(e),r=a(l,e,n),h=i(l,e,n,r,d,p);l.setItemGraphicEl(e,h),s.add(h),o(h,l,e,n,r,t,d)}}).update(function(e,n){var r=u.getItemGraphicEl(n);if(!l.hasValue(e))return void s.remove(r);var c=l.getItemModel(e),f=a(l,e,c);r?h.updateProps(r,{shape:f},p,e):r=i(l,e,c,f,d,p,!0),l.setItemGraphicEl(e,r),s.add(r),o(r,l,e,c,f,t,d)}).remove(function(t){var e=u.getItemGraphicEl(t);e&&r(t,p,e)}).execute(),this._data=l},remove:function(t,e){var n=this.group,i=this._data;t.get("animation")?i&&i.eachItemGraphicEl(function(e){r(e.dataIndex,t,e)}):n.removeAll()}});t.exports=f},function(t,e,n){var i=n(31)([["fill","color"],["stroke","borderColor"],["lineWidth","borderWidth"],["stroke","barBorderColor"],["lineWidth","barBorderWidth"],["opacity"],["shadowBlur"],["shadowOffsetX"],["shadowOffsetY"],["shadowColor"]]);t.exports={getBarItemStyle:function(t){var e=i.call(this,t);if(this.getBorderLineDash){var n=this.getBorderLineDash();n&&(e.lineDash=n)}return e}}},,,function(t,e,n){var i=n(1),r=n(2),a=r.PRIORITY;n(111),n(112),r.registerVisual(i.curry(n(50),"line","circle","line")),r.registerLayout(i.curry(n(61),"line")),r.registerProcessor(a.PROCESSOR.STATISTIC,i.curry(n(149),"line")),n(38)},function(t,e,n){"use strict";var i=n(27),r=n(18);t.exports=r.extend({type:"series.line",dependencies:["grid","polar"],getInitialData:function(t,e){return i(t.data,this,e)},defaultOption:{zlevel:0,z:2,coordinateSystem:"cartesian2d",legendHoverLink:!0,hoverAnimation:!0,clipOverflow:!0,label:{normal:{position:"top"}},lineStyle:{normal:{width:2,type:"solid"}},step:!1,smooth:!1,smoothMonotone:null,symbol:"emptyCircle",symbolSize:4,symbolRotate:null,showSymbol:!0,showAllSymbol:!1,connectNulls:!1,sampling:"none",animationEasing:"linear",progressive:0,hoverLayerThreshold:1/0}})},function(t,e,n){"use strict";function i(t,e){if(t.length===e.length){for(var n=0;ne[0]?1:-1;e[0]+=i*n,e[1]-=i*n}return e}function o(t){return t>=0?1:-1}function s(t,e){var n=t.getBaseAxis(),i=t.getOtherAxis(n),r=n.onZero?0:i.scale.getExtent()[0],a=i.dim,s="x"===a||"radius"===a?1:0;return e.mapArray([a],function(i,l){for(var h,u=e.stackedOn;u&&o(u.get(a,l))===o(i);){h=u;break}var c=[];return c[s]=e.get(n.dim,l),c[1-s]=h?h.get(a,l,!0):r,t.dataToPoint(c)},!0)}function l(t,e,n){var i=a(t.getAxis("x")),r=a(t.getAxis("y")),o=t.getBaseAxis().isHorizontal(),s=Math.min(i[0],i[1]),l=Math.min(r[0],r[1]),h=Math.max(i[0],i[1])-s,u=Math.max(r[0],r[1])-l,c=n.get("lineStyle.normal.width")||2,f=n.get("clipOverflow")?c/2:Math.max(h,u);o?(l-=f,u+=2*f):(s-=f,h+=2*f);var d=new m.Rect({shape:{x:s,y:l,width:h,height:u}});return e&&(d.shape[o?"width":"height"]=0,m.initProps(d,{shape:{width:h,height:u}},n)),d}function h(t,e,n){var i=t.getAngleAxis(),r=t.getRadiusAxis(),a=r.getExtent(),o=i.getExtent(),s=Math.PI/180,l=new m.Sector({shape:{cx:t.cx,cy:t.cy,r0:a[0],r:a[1],startAngle:-o[0]*s,endAngle:-o[1]*s,clockwise:i.inverse}});return e&&(l.shape.endAngle=-o[0]*s,m.initProps(l,{shape:{endAngle:-o[1]*s}},n)),l}function u(t,e,n){return"polar"===t.type?h(t,e,n):l(t,e,n)}function c(t,e,n){for(var i=e.getBaseAxis(),r="x"===i.dim||"radius"===i.dim?0:1,a=[],o=0;o=0;r--)if(n[r].dimension<2){i=n[r];break}if(i&&"cartesian2d"===e.type){var a=i.dimension,o=t.dimensions[a],s=e.getAxis(o),l=d.map(i.stops,function(t){return{coord:s.toGlobalCoord(s.dataToCoord(t.value)),color:t.color}}),h=l.length,u=i.outerColors.slice();h&&l[0].coord>l[h-1].coord&&(l.reverse(),u.reverse());var c=10,f=l[0].coord-c,p=l[h-1].coord+c,g=p-f;if(g<.001)return"transparent";d.each(l,function(t){t.offset=(t.coord-f)/g}),l.push({offset:h?l[h-1].offset:.5,color:u[1]||"transparent"}),l.unshift({offset:h?l[0].offset:.5,color:u[0]||"transparent"});var v=new m.LinearGradient(0,0,0,0,l,(!0));return v[o]=f,v[o+"2"]=p,v}}}var d=n(1),p=n(44),g=n(54),v=n(113),m=n(3),y=n(5),x=n(91),_=n(29);t.exports=_.extend({type:"line",init:function(){var t=new m.Group,e=new p;this.group.add(e.group),this._symbolDraw=e,this._lineGroup=t},render:function(t,e,n){var a=t.coordinateSystem,o=this.group,l=t.getData(),h=t.getModel("lineStyle.normal"),p=t.getModel("areaStyle.normal"),g=l.mapArray(l.getItemLayout,!0),v="polar"===a.type,m=this._coordSys,y=this._symbolDraw,x=this._polyline,_=this._polygon,b=this._lineGroup,w=t.get("animation"),M=!p.isEmpty(),T=s(a,l),S=t.get("showSymbol"),A=S&&!v&&!t.get("showAllSymbol")&&this._getSymbolIgnoreFunc(l,a),I=this._data;I&&I.eachItemGraphicEl(function(t,e){t.__temp&&(o.remove(t),I.setItemGraphicEl(e,null))}),S||y.remove(),o.add(b);var C=!v&&t.get("step");x&&m.type===a.type&&C===this._step?(M&&!_?_=this._newPolygon(g,T,a,w):_&&!M&&(b.remove(_),_=this._polygon=null),b.setClipPath(u(a,!1,t)),S&&y.updateData(l,A),l.eachItemGraphicEl(function(t){t.stopAnimation(!0)}),i(this._stackedOnPoints,T)&&i(this._points,g)||(w?this._updateAnimation(l,T,a,n,C):(C&&(g=c(g,a,C),T=c(T,a,C)),x.setShape({points:g}),_&&_.setShape({points:g,stackedOnPoints:T})))):(S&&y.updateData(l,A),C&&(g=c(g,a,C),T=c(T,a,C)),x=this._newPolyline(g,a,w),M&&(_=this._newPolygon(g,T,a,w)),b.setClipPath(u(a,!0,t)));var P=f(l,a)||l.getVisual("color");x.useStyle(d.defaults(h.getLineStyle(),{fill:"none",stroke:P,lineJoin:"bevel"}));var L=t.get("smooth");if(L=r(t.get("smooth")),x.setShape({smooth:L,smoothMonotone:t.get("smoothMonotone"),connectNulls:t.get("connectNulls")}),_){var k=l.stackedOn,O=0;if(_.useStyle(d.defaults(p.getAreaStyle(),{fill:P,opacity:.7,lineJoin:"bevel"})),k){var D=k.hostModel;O=r(D.get("smooth"))}_.setShape({smooth:L,stackedOnSmooth:O,smoothMonotone:t.get("smoothMonotone"),connectNulls:t.get("connectNulls")})}this._data=l,this._coordSys=a,this._stackedOnPoints=T,this._points=g,this._step=C},dispose:function(){},highlight:function(t,e,n,i){var r=t.getData(),a=y.queryDataIndex(r,i);if(!(a instanceof Array)&&null!=a&&a>=0){var o=r.getItemGraphicEl(a);if(!o){var s=r.getItemLayout(a);if(!s)return;o=new g(r,a),o.position=s,o.setZ(t.get("zlevel"),t.get("z")),o.ignore=isNaN(s[0])||isNaN(s[1]),o.__temp=!0,r.setItemGraphicEl(a,o),o.stopSymbolAnimation(!0),this.group.add(o)}o.highlight()}else _.prototype.highlight.call(this,t,e,n,i)},downplay:function(t,e,n,i){var r=t.getData(),a=y.queryDataIndex(r,i);if(null!=a&&a>=0){var o=r.getItemGraphicEl(a);o&&(o.__temp?(r.setItemGraphicEl(a,null),this.group.remove(o)):o.downplay())}else _.prototype.downplay.call(this,t,e,n,i)},_newPolyline:function(t){var e=this._polyline;return e&&this._lineGroup.remove(e),e=new x.Polyline({shape:{points:t},silent:!0,z2:10}),this._lineGroup.add(e),this._polyline=e,e},_newPolygon:function(t,e){var n=this._polygon;return n&&this._lineGroup.remove(n),n=new x.Polygon({shape:{points:t,stackedOnPoints:e},silent:!0}),this._lineGroup.add(n),this._polygon=n,n},_getSymbolIgnoreFunc:function(t,e){var n=e.getAxesByScale("ordinal")[0];if(n&&n.isLabelIgnored)return d.bind(n.isLabelIgnored,n)},_updateAnimation:function(t,e,n,i,r){var a=this._polyline,o=this._polygon,s=t.hostModel,l=v(this._data,t,this._stackedOnPoints,e,this._coordSys,n),h=l.current,u=l.stackedOnCurrent,f=l.next,d=l.stackedOnNext;r&&(h=c(l.current,n,r),u=c(l.stackedOnCurrent,n,r),f=c(l.next,n,r),d=c(l.stackedOnNext,n,r)),a.shape.__points=l.current,a.shape.points=h,m.updateProps(a,{shape:{points:f}},s),o&&(o.setShape({points:h,stackedOnPoints:u}),m.updateProps(o,{shape:{points:f,stackedOnPoints:d}},s));for(var p=[],g=l.status,y=0;y=0?1:-1}function i(t,e,i){for(var r,a=t.getBaseAxis(),o=t.getOtherAxis(a),s=a.onZero?0:o.scale.getExtent()[0],l=o.dim,h="x"===l||"radius"===l?1:0,u=e.stackedOn,c=e.get(l,i);u&&n(u.get(l,i))===n(c);){r=u;break}var f=[];return f[h]=e.get(a.dim,i),f[1-h]=r?r.get(l,i,!0):s,t.dataToPoint(f)}function r(t,e){var n=[];return e.diff(t).add(function(t){n.push({cmd:"+",idx:t})}).update(function(t,e){n.push({cmd:"=",idx:e,idx1:t})}).remove(function(t){n.push({cmd:"-",idx:t})}).execute(),n}t.exports=function(t,e,n,a,o,s){for(var l=r(t,e),h=[],u=[],c=[],f=[],d=[],p=[],g=[],v=s.dimensions,m=0;m0&&"scale"!==f){var g=o.getItemLayout(0),v=Math.max(n.getWidth(),n.getHeight())/2,m=l.bind(h.removeClipPath,h);h.setClipPath(this._createClipPath(g.cx,g.cy,v,g.startAngle,g.clockwise,m,t))}this._data=o}},dispose:function(){},_createClipPath:function(t,e,n,i,r,a,o){var l=new s.Sector({shape:{cx:t,cy:e,r0:0,r:n,startAngle:i,endAngle:i,clockwise:r}});return s.initProps(l,{shape:{endAngle:i+(r?1:-1)*Math.PI*2}},o,a),l},containPoint:function(t,e){var n=e.getData(),i=n.getItemLayout(0);if(i){var r=t[0]-i.cx,a=t[1]-i.cy,o=Math.sqrt(r*r+a*a);return o<=i.r&&o>=i.r0}}});t.exports=u},function(t,e,n){"use strict";function i(t,e,n,i,r,a,o){function s(e,n,i,r){for(var a=e;ae&&a+1t[a].y+t[a].height)return void l(a,i/2);l(n-1,i/2)}function l(e,n){for(var i=e;i>=0&&(t[i].y-=n,!(i>0&&t[i].y>t[i-1].y+t[i-1].height));i--);}function h(t,e,n,i,r,a){for(var o=a>0?e?Number.MAX_VALUE:0:e?Number.MAX_VALUE:0,s=0,l=t.length;s=o&&(f=o-10),!e&&f<=o&&(f=o+10),t[s].x=n+f*a,o=f}}t.sort(function(t,e){return t.y-e.y});for(var u,c=0,f=t.length,d=[],p=[],g=0;g=n?p.push(t[g]):d.push(t[g]);h(d,!1,e,n,i,r),h(p,!0,e,n,i,r)}function r(t,e,n,r,a,o){for(var s=[],l=[],h=0;h0?"left":"right"}var L=g.getModel("textStyle").getFont(),k=g.get("rotate")?b<0?-_+Math.PI:-_:0,O=t.getFormattedLabel(n,"normal")||l.getName(n),D=a.getBoundingRect(O,L,f,"top");u=!!k,d.label={x:i,y:r,position:v,height:D.height,len:y,len2:x,linePoints:c,textAlign:f,verticalAlign:"middle",font:L,rotation:k},M||h.push(d.label)}),!u&&t.get("avoidLabelOverlap")&&r(h,o,s,e,n,i)}},function(t,e,n){var i=n(4),r=i.parsePercent,a=n(117),o=n(1),s=2*Math.PI,l=Math.PI/180;t.exports=function(t,e,n,h){e.eachSeriesByType(t,function(t){var e=t.get("center"),h=t.get("radius");o.isArray(h)||(h=[0,h]),o.isArray(e)||(e=[e,e]);var u=n.getWidth(),c=n.getHeight(),f=Math.min(u,c),d=r(e[0],u),p=r(e[1],c),g=r(h[0],f/2),v=r(h[1],f/2),m=t.getData(),y=-t.get("startAngle")*l,x=t.get("minAngle")*l,_=m.getSum("value"),b=Math.PI/(_||m.count())*2,w=t.get("clockwise"),M=t.get("roseType"),T=t.get("stillShowZeroSum"),S=m.getDataExtent("value");S[0]=0;var A=s,I=0,C=y,P=w?1:-1;if(m.each("value",function(t,e){var n;if(isNaN(t))return void m.setItemLayout(e,{angle:NaN,startAngle:NaN,endAngle:NaN,clockwise:w,cx:d,cy:p,r0:g,r:M?NaN:v});n="area"!==M?0===_&&T?b:t*b:s/(m.count()||1),n=0)&&n({type:"updateAxisPointer",currTrigger:t,x:e&&e.offsetX,y:e&&e.offsetY})})},remove:function(t,e){i.disopse(e.getZr(),"axisPointer"),r.superApply(this._model,"remove",arguments)},dispose:function(t,e){i.unregister("axisPointer",e),r.superApply(this._model,"dispose",arguments)}})},function(t,e,n){"use strict";function i(t,e){var n={};return n[e.dim+"AxisIndex"]=e.index,t.getCartesian(n)}function r(t){return"x"===t.dim?0:1}var a=n(3),o=n(74),s=n(55),l=n(58),h=o.extend({makeElOption:function(t,e,n,r,a){var o=n.axis,h=o.grid,c=r.get("type"),f=i(h,o).getOtherAxis(o).getGlobalExtent(),d=o.toGlobalCoord(o.dataToCoord(e,!0)),p=s.buildElStyle(r),g=u[c](o,d,f,p);g.style=p,t.graphicKey=g.type,t.pointer=g;var v=l.layout(h.model,n);s.buildCartesianSingleLabelElOption(e,t,v,n,r,a)},getHandleTransform:function(t,e,n){var i=l.layout(e.axis.grid.model,e,{labelInside:!1});return i.labelMargin=n.get("handle.margin"),{position:s.getTransformedPosition(e.axis,t,i),rotation:i.rotation+(i.labelDirection<0?Math.PI:0)}},updateHandleTransform:function(t,e,n,r){var a=n.axis,o=a.grid,s=a.getGlobalExtent(!0),l=i(o,a).getOtherAxis(a).getGlobalExtent(),h="x"===a.dim?0:1,u=t.position;u[h]+=e[h],u[h]=Math.min(s[1],u[h]),u[h]=Math.max(s[0],u[h]);var c=(l[1]+l[0])/2,f=[c,c];f[h]=u[h];var d=[{verticalAlign:"middle"},{align:"center"}];return{position:u,rotation:t.rotation,cursorPoint:f,tooltipOption:d[h]}}}),u={line:function(t,e,n,i){var o=s.makeLineShape([e,n[0]],[e,n[1]],r(t));return a.subPixelOptimizeLine({shape:o,style:i}),{type:"Line",shape:o}},shadow:function(t,e,n,i){var a=t.getBandWidth(),o=n[1]-n[0];return{type:"Rect",shape:s.makeRectShape([e-a/2,n[0]],[a,o],r(t))}}};t.exports=h},function(t,e,n){function i(t,e,n,i,a,g,v,m){var b=[];b=null!=n.x&&null!=n.y?[n.x,n.y]:y({seriesIndex:n.seriesIndex,dataIndex:n.dataIndex},a).point;var w=t.axesInfo,M="leave"===e||p(b),T={},S={},A={list:[],map:{}},I=[],C={showPointer:_(o,S),showTooltip:_(s,A),highlight:_(l,I)};return x(t.coordSysMap,function(e,i){var a=e.containPoint(b);x(t.coordSysAxesInfo[i],function(t,e){var i=t.axis;M||!a||f(n,i)||r(t,i.pointToData(b),C,!1,T)})}),x(w,function(t,e){var n=t.linkGroup;n&&!S[e]&&x(n.axesInfo,function(e,i){var a=S[i];if(e!==t&&a){var o=a.value;n.mapper&&(o=t.axis.scale.parse(n.mapper(o,d(e),d(t)))),r(t,o,C,!0,T)}})}),h(S,w),u(A,b,v,i),c(I,i,g,m),T}function r(t,e,n,i,r){var o=t.axis;if(!o.scale.isBlank()&&o.containData(e)){if(!t.involveSeries)return void n.showPointer(t,e);var s=a(e,t),l=s.payloadBatch,h=s.snapToValue;l[0]&&null==r.seriesIndex&&g.extend(r,l[0]),!i&&t.snap&&o.containData(h)&&null!=h&&(e=h),n.highlight("highlight",l),n.showPointer(t,e,l),n.showTooltip(t,s,h)}}function a(t,e){var n=e.axis,i=n.dim,r=t,a=[],o=Number.MAX_VALUE,s=-1;return x(e.seriesModels,function(e,l){var h,u,c=e.coordDimToDataDim(i);if(e.getAxisTooltipData){var f=e.getAxisTooltipData(c,t,n);u=f.dataIndices,h=f.nestestValue}else{if(u=e.getData().indexOfNearest(c[0],t,!1,"category"===n.type?.5:null),!u.length)return;h=e.getData().get(c[0],u[0])}if(null!=h&&isFinite(h)){var d=t-h,p=Math.abs(d);p<=o&&((p=0&&s<0)&&(o=p,s=d,r=h,a.length=0),x(u,function(t){a.push({seriesIndex:e.seriesIndex,dataIndexInside:t,dataIndex:e.getData().getRawIndex(t)})}))}}),{payloadBatch:a,snapToValue:r}}function o(t,e,n,i){t[e.key]={value:n,payloadBatch:i}}function s(t,e,n,i){var r=n.payloadBatch,a=e.axis,o=a.model,s=e.axisPointerModel;if(e.triggerTooltip&&r.length){var l=e.coordSys.model,h=m.makeKey(l),u=t.map[h];u||(u=t.map[h]={coordSysId:l.id,coordSysIndex:l.componentIndex,coordSysType:l.type,coordSysMainType:l.mainType,dataByAxis:[]},t.list.push(u)),u.dataByAxis.push({axisDim:a.dim,axisIndex:o.componentIndex,axisType:o.type,axisId:o.id,value:i,valueLabelOpt:{precision:s.get("label.precision"),formatter:s.get("label.formatter")},seriesDataIndices:r.slice()})}}function l(t,e,n){t.push.apply(t,n)}function h(t,e){x(e,function(e,n){var i=e.axisPointerModel.option,r=t[n];r?(!e.useHandle&&(i.status="show"),i.value=r.value,i.seriesDataIndices=(r.payloadBatch||[]).slice()):!e.useHandle&&(i.status="hide")})}function u(t,e,n,i){if(p(e)||!t.list.length)return void i({type:"hideTip"});var r=((t.list[0].dataByAxis[0]||{}).seriesDataIndices||[])[0]||{};i({type:"showTip",escapeConnect:!0,x:e[0],y:e[1],tooltipOption:n,dataIndexInside:r.dataIndexInside,dataIndex:r.dataIndex,seriesIndex:r.seriesIndex,dataByCoordSys:t.list})}function c(t,e,n,i){var r=n.getZr();i="lastHighlights"+(i||"");var a=b(r)[i]||{},o=b(r)[i]={};g.each(t,function(t){var e=t.seriesIndex+" | "+t.dataIndex;o[e]=t});var s=[],l=[];g.each(a,function(t,e){!o[e]&&l.push(t)}),g.each(o,function(t,e){!a[e]&&s.push(t)}),l.length&&n.dispatchAction({type:"downplay",escapeConnect:!0,batch:l}),s.length&&n.dispatchAction({type:"highlight",escapeConnect:!0,batch:s})}function f(t,e){var n=1;return x(t,function(t,e){n&=!/^.+(AxisId|AxisName|AxisIndex)$/.test(e)}),!n&&x([["AxisId","id"],["AxisIndex","componentIndex"],["AxisName","name"]],function(i){var r=v.normalizeToArray(t[e.dim+i[0]]);n|=g.indexOf(r,e.model[i[1]])>=0}),!n}function d(t){var e=t.axis.model,n={},i=n.axisDim=t.axis.dim;return n.axisIndex=n[i+"AxisIndex"]=e.componentIndex,n.axisName=n[i+"AxisName"]=e.name,n.axisId=n[i+"AxisId"]=e.id,n}function p(t){return null==t[0]||isNaN(t[0])||null==t[1]||isNaN(t[1])}var g=n(1),v=n(5),m=n(32),y=n(75),x=g.each,_=g.curry,b=v.makeGetter();t.exports=i},,,,,,,,function(t,e,n){var i=n(1),r=n(33),a=n(136),o=function(t,e,n,i,a){r.call(this,t,e,n),this.type=i||"value",this.position=a||"bottom"};o.prototype={constructor:o,index:0,onZero:!1,model:null,isHorizontal:function(){var t=this.position;return"top"===t||"bottom"===t},getGlobalExtent:function(t){var e=this.getExtent();return e[0]=this.toGlobalCoord(e[0]),e[1]=this.toGlobalCoord(e[1]),t&&e[0]>e[1]&&e.reverse(),e},getOtherAxis:function(){this.grid.getOtherAxis()},getLabelInterval:function(){var t=this._labelInterval;return t||(t=this._labelInterval=a(this)),t},isLabelIgnored:function(t){if("category"===this.type){var e=this.getLabelInterval();return"function"==typeof e&&!e(t,this.scale.getLabel(t))||t%(e+1)}},pointToData:function(t,e){return this.coordToData(this.toLocalCoord(t["x"===this.dim?0:1]),e)},toLocalCoord:null,toGlobalCoord:null},i.inherits(o,r),t.exports=o},function(t,e,n){"use strict";function i(t){return this._axes[t]}var r=n(1),a=function(t){this._axes={},this._dimList=[],this.name=t||""};a.prototype={constructor:a,type:"cartesian",getAxis:function(t){return this._axes[t]},getAxes:function(){return r.map(this._dimList,i,this)},getAxesByScale:function(t){return t=t.toLowerCase(),r.filter(this.getAxes(),function(e){return e.scale.type===t})},addAxis:function(t){var e=t.dim;this._axes[e]=t,this._dimList.push(e)},dataToCoord:function(t){return this._dataCoordConvert(t,"dataToCoord")},coordToData:function(t){return this._dataCoordConvert(t,"coordToData")},_dataCoordConvert:function(t,e){for(var n=this._dimList,i=t instanceof Array?[]:{},r=0;r=0;i--)c.isIdInner(e[i])&&e.splice(i,1);t[n]=e}}),delete t[b],t},getTheme:function(){return this._theme},getComponent:function(t,e){var n=this._componentsMap[t];if(n)return n[e||0]},queryComponents:function(t){var e=t.mainType;if(!e)return[];var n=t.index,i=t.id,r=t.name,a=this._componentsMap[e];if(!a||!a.length)return[];var o;if(null!=n)v(n)||(n=[n]),o=p(g(n,function(t){return a[t]}),function(t){return!!t});else if(null!=i){var s=v(i);o=p(a,function(t){return s&&m(i,t.id)>=0||!s&&t.id===i})}else if(null!=r){var h=v(r);o=p(a,function(t){return h&&m(r,t.name)>=0||!h&&t.name===r})}else o=a.slice();return l(o,t)},findComponents:function(t){function e(t){var e=r+"Index",n=r+"Id",i=r+"Name";return!t||null==t[e]&&null==t[n]&&null==t[i]?null:{mainType:r,index:t[e],id:t[n],name:t[i]}}function n(e){return t.filter?p(e,t.filter):e}var i=t.query,r=t.mainType,a=e(i),o=a?this.queryComponents(a):this._componentsMap[r];return n(l(o,t))},eachComponent:function(t,e,n){var i=this._componentsMap;if("function"==typeof t)n=e,e=t,d(i,function(t,i){d(t,function(t,r){e.call(n,i,t,r)})});else if(u.isString(t))d(i[t],e,n);else if(y(t)){var r=this.findComponents(t);d(r,e,n)}},getSeriesByName:function(t){var e=this._componentsMap.series;return p(e,function(e){return e.name===t})},getSeriesByIndex:function(t){return this._componentsMap.series[t]},getSeriesByType:function(t){var e=this._componentsMap.series;return p(e,function(e){return e.subType===t})},getSeries:function(){return this._componentsMap.series.slice()},eachSeries:function(t,e){h(this),d(this._seriesIndices,function(n){var i=this._componentsMap.series[n];t.call(e,i,n)},this)},eachRawSeries:function(t,e){d(this._componentsMap.series,t,e)},eachSeriesByType:function(t,e,n){h(this),d(this._seriesIndices,function(i){var r=this._componentsMap.series[i];r.subType===t&&e.call(n,r,i)},this)},eachRawSeriesByType:function(t,e,n){return d(this.getSeriesByType(t),e,n)},isSeriesFiltered:function(t){return h(this),u.indexOf(this._seriesIndices,t.componentIndex)<0},filterSeries:function(t,e){h(this);var n=p(this._componentsMap.series,t,e);this._seriesIndices=s(n)},restoreData:function(){var t=this._componentsMap;this._seriesIndices=s(t.series);var e=[];d(t,function(t,n){e.push(n)}),x.topologicalTravel(e,x.getAllClassMainTypes(),function(e,n){d(t[e],function(t){t.restoreData()})})}});u.mixin(w,n(62)),t.exports=w},function(t,e,n){function i(t){this._api=t,this._timelineOptions=[],this._mediaList=[],this._mediaDefault,this._currentMediaIndices=[],this._optionBackup,this._newBaseOption}function r(t,e,n){var i,r,a=[],o=[],s=t.timeline;if(t.baseOption&&(r=t.baseOption),(s||t.options)&&(r=r||{},a=(t.options||[]).slice()),t.media){r=r||{};var l=t.media;f(l,function(t){t&&t.option&&(t.query?o.push(t):i||(i=t))})}return r||(r=t),r.timeline||(r.timeline=s),f([r].concat(a).concat(h.map(o,function(t){return t.option})),function(t){f(e,function(e){e(t,n)})}),{baseOption:r,timelineOptions:a,mediaDefault:i,mediaList:o}}function a(t,e,n){var i={width:e,height:n,aspectratio:e/n},r=!0;return h.each(t,function(t,e){var n=e.match(v);if(n&&n[1]&&n[2]){var a=n[1],s=n[2].toLowerCase();o(i[s],t,a)||(r=!1)}}),r}function o(t,e,n){return"min"===n?t>=e:"max"===n?t<=e:t===e}function s(t,e){return t.join(",")===e.join(",")}function l(t,e){e=e||{},f(e,function(e,n){if(null!=e){var i=t[n];if(c.hasClass(n)){e=u.normalizeToArray(e),i=u.normalizeToArray(i);var r=u.mappingToExists(i,e);t[n]=p(r,function(t){return t.option&&t.exist?g(t.exist,t.option,!0):t.exist||t.option})}else t[n]=g(i,e,!0)}})}var h=n(1),u=n(5),c=n(13),f=h.each,d=h.clone,p=h.map,g=h.merge,v=/^(min|max)?(.+)$/;i.prototype={constructor:i,setOption:function(t,e){t=d(t,!0);var n=this._optionBackup,i=r.call(this,t,e,!n);this._newBaseOption=i.baseOption,n?(l(n.baseOption,i.baseOption),i.timelineOptions.length&&(n.timelineOptions=i.timelineOptions),i.mediaList.length&&(n.mediaList=i.mediaList),i.mediaDefault&&(n.mediaDefault=i.mediaDefault)):this._optionBackup=i},mountOption:function(t){var e=this._optionBackup;return this._timelineOptions=p(e.timelineOptions,d),this._mediaList=p(e.mediaList,d),this._mediaDefault=d(e.mediaDefault),this._currentMediaIndices=[],d(t?e.baseOption:this._newBaseOption)},getTimelineOption:function(t){var e,n=this._timelineOptions;if(n.length){var i=t.getComponent("timeline");i&&(e=d(n[i.getCurrentIndex()],!0))}return e},getMediaOption:function(t){var e=this._api.getWidth(),n=this._api.getHeight(),i=this._mediaList,r=this._mediaDefault,o=[],l=[];if(!i.length&&!r)return l;for(var h=0,u=i.length;he&&(e=t[n]);return e},min:function(t){for(var e=1/0,n=0;n1){var c;"string"==typeof r?c=n[r]:"function"==typeof r&&(c=r),c&&(e=e.downSample(s.dim,1/u,c,i),t.setData(e))}}},this)}},function(t,e,n){function i(t,e){return c(t,u(e))}var r=n(1),a=n(34),o=n(4),s=n(43),l=a.prototype,h=s.prototype,u=o.getPrecisionSafe,c=o.round,f=Math.floor,d=Math.ceil,p=Math.pow,g=Math.log,v=a.extend({type:"log",base:10,$constructor:function(){a.apply(this,arguments),this._originalScale=new s},getTicks:function(){var t=this._originalScale,e=this._extent,n=t.getExtent();return r.map(h.getTicks.call(this),function(r){var a=o.round(p(this.base,r));return a=r===e[0]&&t.__fixMin?i(a,n[0]):a,a=r===e[1]&&t.__fixMax?i(a,n[1]):a},this)},getLabel:h.getLabel,scale:function(t){return t=l.scale.call(this,t),p(this.base,t)},setExtent:function(t,e){var n=this.base;t=g(t)/g(n),e=g(e)/g(n),h.setExtent.call(this,t,e)},getExtent:function(){var t=this.base,e=l.getExtent.call(this);e[0]=p(t,e[0]),e[1]=p(t,e[1]);var n=this._originalScale,r=n.getExtent();return n.__fixMin&&(e[0]=i(e[0],r[0])),n.__fixMax&&(e[1]=i(e[1],r[1])),e},unionExtent:function(t){this._originalScale.unionExtent(t);var e=this.base;t[0]=g(t[0])/g(e),t[1]=g(t[1])/g(e),l.unionExtent.call(this,t)},unionExtentFromData:function(t,e){this.unionExtent(t.getDataExtent(e,!0,function(t){return t>0}))},niceTicks:function(t){t=t||10;var e=this._extent,n=e[1]-e[0];if(!(n===1/0||n<=0)){var i=o.quantity(n),r=t/n*i;for(r<=.5&&(i*=10);!isNaN(i)&&Math.abs(i)<1&&Math.abs(i)>0;)i*=10;var a=[o.round(d(e[0]/i)*i),o.round(f(e[1]/i)*i)];this._interval=i,this._niceExtent=a}},niceExtent:function(t,e,n){h.niceExtent.call(this,t,e,n);var i=this._originalScale;i.__fixMin=e,i.__fixMax=n}});r.each(["contain","normalize"],function(t){v.prototype[t]=function(e){return e=g(e)/g(this.base),l[t].call(this,e)}}),v.create=function(){return new v},t.exports=v},function(t,e,n){var i=n(1),r=n(34),a=r.prototype,o=r.extend({type:"ordinal",init:function(t,e){this._data=t,this._extent=e||[0,t.length-1]},parse:function(t){return"string"==typeof t?i.indexOf(this._data,t):Math.round(t)},contain:function(t){return t=this.parse(t),a.contain.call(this,t)&&null!=this._data[t]},normalize:function(t){return a.normalize.call(this,this.parse(t))},scale:function(t){return Math.round(a.scale.call(this,t))},getTicks:function(){for(var t=[],e=this._extent,n=e[0];n<=e[1];)t.push(n),n++;return t},getLabel:function(t){return this._data[t]},count:function(){return this._extent[1]-this._extent[0]+1},unionExtentFromData:function(t,e){this.unionExtent(t.getDataExtent(e,!1))},niceTicks:i.noop,niceExtent:i.noop});o.create=function(){return new o},t.exports=o},function(t,e,n){var i=n(1),r=n(4),a=n(7),o=n(43),s=o.prototype,l=Math.ceil,h=Math.floor,u=1e3,c=60*u,f=60*c,d=24*f,p=function(t,e,n,i){for(;n>>1;t[r][2]=0;r--)if(!i[r].silent&&i[r]!==n&&!i[r].ignore&&a(i[r],t,e))return i[r]}},o.each(["click","mousedown","mouseup","mousewheel","dblclick","contextmenu"],function(t){u.prototype[t]=function(e){var n=this.findHover(e.zrX,e.zrY,null);if("mousedown"===t)this._downel=n,this._upel=n;else if("mosueup"===t)this._upel=n;else if("click"===t&&this._downel!==this._upel)return;this.dispatchToElement(n,t,e)}}),o.mixin(u,l),o.mixin(u,s),t.exports=u},function(t,e,n){function i(){return!1}function r(t,e,n,i){var r=document.createElement(e),a=n.getWidth(),o=n.getHeight(),s=r.style;return s.position="absolute",s.left=0,s.top=0,s.width=a+"px",s.height=o+"px",r.width=a*i,r.height=o*i,r.setAttribute("data-zr-dom-id",t),r}var a=n(1),o=n(35),s=n(72),l=n(71),h=function(t,e,n){var s;n=n||o.devicePixelRatio,"string"==typeof t?s=r(t,"canvas",e,n):a.isObject(t)&&(s=t,t=s.id),this.id=t,this.dom=s;var l=s.style;l&&(s.onselectstart=i,l["-webkit-user-select"]="none",l["user-select"]="none",l["-webkit-touch-callout"]="none",l["-webkit-tap-highlight-color"]="rgba(0,0,0,0)",l.padding=0,l.margin=0,l["border-width"]=0),this.domBack=null,this.ctxBack=null,this.painter=e,this.config=null,this.clearColor=0,this.motionBlur=!1,this.lastFrameAlpha=.7,this.dpr=n};h.prototype={constructor:h,elCount:0,__dirty:!0,initContext:function(){this.ctx=this.dom.getContext("2d"),this.ctx.dpr=this.dpr},createBackBuffer:function(){var t=this.dpr;this.domBack=r("back-"+this.id,"canvas",this.painter,t),this.ctxBack=this.domBack.getContext("2d"),1!=t&&this.ctxBack.scale(t,t)},resize:function(t,e){var n=this.dpr,i=this.dom,r=i.style,a=this.domBack;r.width=t+"px",r.height=e+"px",i.width=t*n,i.height=e*n,a&&(a.width=t*n,a.height=e*n,1!=n&&this.ctxBack.scale(n,n))},clear:function(t){var e=this.dom,n=this.ctx,i=e.width,r=e.height,a=this.clearColor,o=this.motionBlur&&!t,h=this.lastFrameAlpha,u=this.dpr;if(o&&(this.domBack||this.createBackBuffer(),this.ctxBack.globalCompositeOperation="copy",this.ctxBack.drawImage(e,0,0,i/u,r/u)),n.clearRect(0,0,i,r),a){var c;a.colorStops?(c=a.__canvasGradient||s.getGradient(n,a,{x:0,y:0,width:i,height:r}),a.__canvasGradient=c):a.image&&(c=l.prototype.getCanvasPattern.call(a,n)),n.save(),n.fillStyle=c||a,n.fillRect(0,0,i,r),n.restore()}if(o){var f=this.domBack;n.save(),n.globalAlpha=h,n.drawImage(f,0,0,i,r),n.restore()}}},t.exports=h},function(t,e,n){"use strict";function i(t){return parseInt(t,10)}function r(t){return!!t&&(!!t.__builtin__||"function"==typeof t.resize&&"function"==typeof t.refresh)}function a(t){t.__unusedCount++}function o(t){1==t.__unusedCount&&t.clear()}function s(t,e,n){return x.copy(t.getBoundingRect()),t.transform&&x.applyTransform(t.transform),_.width=e,_.height=n,!x.intersect(_)}function l(t,e){if(t==e)return!1;if(!t||!e||t.length!==e.length)return!0;for(var n=0;n=0&&n.splice(i,1),t.__hoverMir=null},clearHover:function(t){for(var e=this._hoverElements,n=0;n=0){if(!s){if(s=this._progressiveLayers[Math.min(h++,y-1)],s.ctx.save(),s.renderScope={},s&&s.__progress>s.__maxProgress){g=s.__nextIdxNotProg-1;continue}l=s.__progress,s.__dirty||(p=l),s.__progress=p+1}_===p&&this._doPaintEl(m,s,!0,s.renderScope)}else this._doPaintEl(m,i,e,o);m.__dirty=!1}}s&&n(s),a&&a.restore(),this._furtherProgressive=!1,f.each(this._progressiveLayers,function(t){t.__maxProgress>=t.__progress&&(this._furtherProgressive=!0)},this)},_doPaintEl:function(t,e,n,i){var r=e.ctx,a=t.transform;if((e.__dirty||n)&&!t.invisible&&0!==t.style.opacity&&(!a||a[0]||a[3])&&(!t.culling||!s(t,this._width,this._height))){var o=t.__clipPaths;(i.prevClipLayer!==e||l(o,i.prevElClipPaths))&&(i.prevElClipPaths&&(i.prevClipLayer.ctx.restore(),i.prevClipLayer=i.prevElClipPaths=null,i.prevEl=null),o&&(r.save(),h(o,r),i.prevClipLayer=e,i.prevElClipPaths=o)),t.beforeBrush&&t.beforeBrush(r),t.brush(r,i.prevEl||null),i.prevEl=t,t.afterBrush&&t.afterBrush(r)}},getLayer:function(t){if(this._singleCanvas)return this._layers[0];var e=this._layers[t];return e||(e=new v("zr_"+t,this,this.dpr),e.__builtin__=!0,this._layerConfig[t]&&f.merge(e,this._layerConfig[t],!0),this.insertLayer(t,e),e.initContext()),e},insertLayer:function(t,e){var n=this._layers,i=this._zlevelList,a=i.length,o=null,s=-1,l=this._domRoot;if(n[t])return void d("ZLevel "+t+" has been used already");if(!r(e))return void d("Layer of zlevel "+t+" is not valid");if(a>0&&t>i[0]){for(s=0;st);s++);o=n[i[s]]}if(i.splice(s+1,0,t),n[t]=e,!e.virtual)if(o){var h=o.dom;h.nextSibling?l.insertBefore(e.dom,h.nextSibling):l.appendChild(e.dom)}else l.firstChild?l.insertBefore(e.dom,l.firstChild):l.appendChild(e.dom)},eachLayer:function(t,e){var n,i,r=this._zlevelList;for(i=0;i=0){o!==g&&(o=g,l++);var m=c.__frame=l-1;if(!a){var x=Math.min(s,y-1);a=n[x],a||(a=n[x]=new v("progressive",this,this.dpr),a.initContext()),a.__maxProgress=0}a.__dirty=a.__dirty||c.__dirty,a.elCount++,a.__maxProgress=Math.max(a.__maxProgress,m),a.__maxProgress>=a.__progress&&(p.__dirty=!0)}else c.__frame=-1,a&&(a.__nextIdxNotProg=h,s++,a=null)}a&&(s++,a.__nextIdxNotProg=h),this.eachBuiltinLayer(function(t,e){i[e]!==t.elCount&&(t.__dirty=!0)}),n.length=Math.min(s,y),f.each(n,function(t,e){r[e]!==t.elCount&&(c.__dirty=!0),t.__dirty&&(t.__progress=0)})},clear:function(){return this.eachBuiltinLayer(this._clearLayer),this},_clearLayer:function(t){t.clear()},configLayer:function(t,e){if(e){var n=this._layerConfig;n[t]?f.merge(n[t],e,!0):n[t]=e;var i=this._layers[t];i&&f.merge(i,n[t],!0)}},delLayer:function(t){var e=this._layers,n=this._zlevelList,i=e[t];i&&(i.dom.parentNode.removeChild(i.dom),delete e[t],n.splice(f.indexOf(n,t),1))},resize:function(t,e){var n=this._domRoot;n.style.display="none";var i=this._opts;if(null!=t&&(i.width=t),null!=e&&(i.height=e),t=this._getSize(0),e=this._getSize(1),n.style.display="",this._width!=t||e!=this._height){n.style.width=t+"px",n.style.height=e+"px";for(var r in this._layers)this._layers.hasOwnProperty(r)&&this._layers[r].resize(t,e);f.each(this._progressiveLayers,function(n){n.resize(t,e)}),this.refresh(!0)}return this._width=t,this._height=e,this},clearLayer:function(t){var e=this._layers[t];e&&e.clear()},dispose:function(){this.root.innerHTML="",this.root=this.storage=this._domRoot=this._layers=null},getRenderedCanvas:function(t){if(t=t||{},this._singleCanvas)return this._layers[0].dom;var e=new v("image",this,t.pixelRatio||this.dpr);e.initContext(),e.clearColor=t.backgroundColor,e.clear();for(var n=this.storage.getDisplayList(!0),i={},r=0;r=0&&(this.delFromMap(a.id),this._roots.splice(s,1),a instanceof o&&a.delChildrenFromStorage(this))}},addToMap:function(t){return t instanceof o&&(t.__storage=this),t.dirty(!1),this._elements[t.id]=t,this},get:function(t){return this._elements[t]},delFromMap:function(t){var e=this._elements,n=e[t];return n&&(delete e[t],n instanceof o&&(n.__storage=null)),this},dispose:function(){this._elements=this._renderList=this._roots=null},displayableSortFunc:i},t.exports=l},function(t,e,n){"use strict";var i=n(1),r=n(20).Dispatcher,a=n(67),o=n(66),s=function(t){t=t||{},this.stage=t.stage||{},this.onframe=t.onframe||function(){},this._clips=[],this._running=!1,this._time,this._pausedTime,this._pauseStart,this._paused=!1,r.call(this)};s.prototype={constructor:s,addClip:function(t){this._clips.push(t)},addAnimator:function(t){t.animation=this;for(var e=t.getClips(),n=0;n=0&&this._clips.splice(e,1)},removeAnimator:function(t){for(var e=t.getClips(),n=0;nn||f+co&&(o+=r);var p=Math.atan2(u,h);return p<0&&(p+=r),p>=a&&p<=o||p+r>=a&&p+r<=o}}},function(t,e,n){var i=n(21);t.exports={containStroke:function(t,e,n,r,a,o,s,l,h,u,c){if(0===h)return!1;var f=h;if(c>e+f&&c>r+f&&c>o+f&&c>l+f||ct+f&&u>n+f&&u>a+f&&u>s+f||ue&&u>i&&u>o&&u>l||u1&&r(),f=g.cubicAt(e,i,o,l,b[0]),v>1&&(d=g.cubicAt(e,i,o,l,b[1]))),p+=2==v?ye&&s>i&&s>a||s=0&&h<=1){for(var u=0,c=g.quadraticAt(e,i,a,h),f=0;fn||s<-n)return 0;var l=Math.sqrt(n*n-s*s);_[0]=-l,_[1]=l;var h=Math.abs(i-r);if(h<1e-4)return 0;if(h%y<1e-4){i=0,r=y;var u=a?1:-1;return o>=_[0]+t&&o<=_[1]+t?u:0}if(a){var l=i;i=p(r),r=p(l)}else i=p(i),r=p(r);i>r&&(r+=y);for(var c=0,f=0;f<2;f++){var d=_[f];if(d+t>o){var g=Math.atan2(s,d),u=a?1:-1;g<0&&(g=y+g),(g>=i&&g<=r||g+y>=i&&g+y<=r)&&(g>Math.PI/2&&g<1.5*Math.PI&&(u=-u),c+=u)}}return c}function l(t,e,n,r,l){for(var u=0,p=0,g=0,y=0,x=0,_=0;_1&&(n||(u+=v(p,g,y,x,r,l))),1==_&&(p=t[_],g=t[_+1],y=p,x=g),b){case h.M:y=t[_++],x=t[_++],p=y,g=x;break;case h.L:if(n){if(m(p,g,t[_],t[_+1],e,r,l))return!0}else u+=v(p,g,t[_],t[_+1],r,l)||0;p=t[_++],g=t[_++];break;case h.C:if(n){if(c.containStroke(p,g,t[_++],t[_++],t[_++],t[_++],t[_],t[_+1],e,r,l))return!0}else u+=a(p,g,t[_++],t[_++],t[_++],t[_++],t[_],t[_+1],r,l)||0;p=t[_++],g=t[_++];break;case h.Q:if(n){if(f.containStroke(p,g,t[_++],t[_++],t[_],t[_+1],e,r,l))return!0}else u+=o(p,g,t[_++],t[_++],t[_],t[_+1],r,l)||0;p=t[_++],g=t[_++];break;case h.A:var w=t[_++],M=t[_++],T=t[_++],S=t[_++],A=t[_++],I=t[_++],C=(t[_++],1-t[_++]),P=Math.cos(A)*T+w,L=Math.sin(A)*S+M;_>1?u+=v(p,g,P,L,r,l):(y=P,x=L);var k=(r-w)*S/T+w;if(n){if(d.containStroke(w,M,S,A,A+I,C,e,k,l))return!0}else u+=s(w,M,S,A,A+I,C,k,l);p=Math.cos(A+I)*T+w,g=Math.sin(A+I)*S+M;break;case h.R:y=p=t[_++],x=g=t[_++];var O=t[_++],D=t[_++],P=y+O,L=x+D;if(n){if(m(y,x,P,x,e,r,l)||m(P,x,P,L,e,r,l)||m(P,L,y,L,e,r,l)||m(y,L,y,x,e,r,l))return!0}else u+=v(P,x,P,L,r,l),u+=v(y,L,y,x,r,l);break;case h.Z:if(n){if(m(p,g,y,x,e,r,l))return!0}else u+=v(p,g,y,x,r,l);p=y,g=x}}return n||i(g,x)||(u+=v(p,g,y,x,r,l)||0),0!==u}var h=n(30).CMD,u=n(98),c=n(162),f=n(99),d=n(161),p=n(68).normalizeRadian,g=n(21),v=n(100),m=u.containStroke,y=2*Math.PI,x=1e-4,_=[-1,-1,-1],b=[-1,-1];t.exports={contain:function(t,e,n){return l(t,0,!1,e,n)},containStroke:function(t,e,n,i){return l(t,e,!0,n,i)}}},function(t,e,n){"use strict";function i(t){var e=t[1][0]-t[0][0],n=t[1][1]-t[0][1];return Math.sqrt(e*e+n*n)}function r(t){return[(t[0][0]+t[1][0])/2,(t[0][1]+t[1][1])/2]}var a=n(20),o=function(){this._track=[]};o.prototype={constructor:o,recognize:function(t,e,n){return this._doTrack(t,e,n),this._recognize(t)},clear:function(){return this._track.length=0,this},_doTrack:function(t,e,n){var i=t.touches;if(i){for(var r={points:[],touches:[],target:e,event:t},o=0,s=i.length;o1&&a&&a.length>1){var s=i(a)/i(o);!isFinite(s)&&(s=1),e.pinchScale=s;var l=r(a);return e.pinchX=l[0],e.pinchY=l[1],{type:"pinch",target:t[0].target,event:e}}}}};t.exports=o},function(t,e,n){function i(t){return"mousewheel"===t&&f.browser.firefox?"DOMMouseScroll":t}function r(t,e,n){var i=t._gestureMgr;"start"===n&&i.clear();var r=i.recognize(e,t.handler.findHover(e.zrX,e.zrY,null),t.dom);if("end"===n&&i.clear(),r){var a=r.type;e.gestureEvent=a,t.handler.dispatchToElement(r.target,a,r.event)}}function a(t){t._touching=!0,clearTimeout(t._touchTimer),t._touchTimer=setTimeout(function(){t._touching=!1},700)}function o(t){var e=t.pointerType;return"pen"===e||"touch"===e}function s(t){function e(t,e){return function(){if(!e._touching)return t.apply(e,arguments)}}u.each(x,function(e){t._handlers[e]=u.bind(w[e],t)}),u.each(b,function(e){t._handlers[e]=u.bind(w[e],t)}),u.each(y,function(n){t._handlers[n]=e(w[n],t)})}function l(t){function e(e,n){u.each(e,function(e){p(t,i(e),n._handlers[e])},n)}c.call(this),this.dom=t,this._touching=!1,this._touchTimer,this._gestureMgr=new d,this._handlers={},s(this),f.pointerEventsSupported?e(b,this):(f.touchEventsSupported&&e(x,this),e(y,this))}var h=n(20),u=n(1),c=n(23),f=n(9),d=n(164),p=h.addEventListener,g=h.removeEventListener,v=h.normalizeEvent,m=300,y=["click","dblclick","mousewheel","mouseout","mouseup","mousedown","mousemove","contextmenu"],x=["touchstart","touchend","touchmove"],_={pointerdown:1,pointerup:1,pointermove:1,pointerout:1},b=u.map(y,function(t){var e=t.replace("mouse","pointer");return _[e]?e:t}),w={mousemove:function(t){t=v(this.dom,t),this.trigger("mousemove",t)},mouseout:function(t){t=v(this.dom,t);var e=t.toElement||t.relatedTarget;if(e!=this.dom)for(;e&&9!=e.nodeType;){if(e===this.dom)return;e=e.parentNode}this.trigger("mouseout",t)},touchstart:function(t){t=v(this.dom,t),t.zrByTouch=!0,this._lastTouchMoment=new Date,r(this,t,"start"),w.mousemove.call(this,t),w.mousedown.call(this,t),a(this)},touchmove:function(t){t=v(this.dom,t),t.zrByTouch=!0,r(this,t,"change"),w.mousemove.call(this,t),a(this)},touchend:function(t){t=v(this.dom,t),t.zrByTouch=!0,r(this,t,"end"),w.mouseup.call(this,t),+new Date-this._lastTouchMomentl&&(c=n+i,n*=l/c,i*=l/c),r+a>l&&(c=r+a,r*=l/c,a*=l/c),i+r>h&&(c=i+r,i*=h/c,r*=h/c),n+a>h&&(c=n+a,n*=h/c,a*=h/c),t.moveTo(o+n,s),t.lineTo(o+l-i,s),0!==i&&t.quadraticCurveTo(o+l,s,o+l,s+i),t.lineTo(o+l,s+h-r),0!==r&&t.quadraticCurveTo(o+l,s+h,o+l-r,s+h),t.lineTo(o+a,s+h),0!==a&&t.quadraticCurveTo(o,s+h,o,s+h-a),t.lineTo(o,s+n),0!==n&&t.quadraticCurveTo(o,s,o+n,s)}}},function(t,e,n){var i=n(6),r=i.min,a=i.max,o=i.scale,s=i.distance,l=i.add;t.exports=function(t,e,n,h){var u,c,f,d,p=[],g=[],v=[],m=[];if(h){f=[1/0,1/0],d=[-(1/0),-(1/0)];for(var y=0,x=t.length;yn-2?n-1:d+1],c=t[d>n-3?n-1:d+2]);var v=p*p,m=p*v;a.push([i(h[0],g[0],u[0],c[0],p,v,m),i(h[1],g[1],u[1],c[1],p,v,m)])}return a}},function(t,e,n){t.exports=n(8).extend({type:"arc",shape:{cx:0,cy:0,r:0,startAngle:0,endAngle:2*Math.PI,clockwise:!0},style:{stroke:"#000",fill:null},buildPath:function(t,e){var n=e.cx,i=e.cy,r=Math.max(e.r,0),a=e.startAngle,o=e.endAngle,s=e.clockwise,l=Math.cos(a),h=Math.sin(a);t.moveTo(l*r+n,h*r+i),t.arc(n,i,r,a,o,!s)}})},function(t,e,n){"use strict";function i(t,e,n){var i=t.cpx2,r=t.cpy2;return null===i||null===r?[(n?c:h)(t.x1,t.cpx1,t.cpx2,t.x2,e),(n?c:h)(t.y1,t.cpy1,t.cpy2,t.y2,e)]:[(n?u:l)(t.x1,t.cpx1,t.x2,e),(n?u:l)(t.y1,t.cpy1,t.y2,e)]; +}var r=n(21),a=n(6),o=r.quadraticSubdivide,s=r.cubicSubdivide,l=r.quadraticAt,h=r.cubicAt,u=r.quadraticDerivativeAt,c=r.cubicDerivativeAt,f=[];t.exports=n(8).extend({type:"bezier-curve",shape:{x1:0,y1:0,x2:0,y2:0,cpx1:0,cpy1:0,percent:1},style:{stroke:"#000",fill:null},buildPath:function(t,e){var n=e.x1,i=e.y1,r=e.x2,a=e.y2,l=e.cpx1,h=e.cpy1,u=e.cpx2,c=e.cpy2,d=e.percent;0!==d&&(t.moveTo(n,i),null==u||null==c?(d<1&&(o(n,l,r,d,f),l=f[1],r=f[2],o(i,h,a,d,f),h=f[1],a=f[2]),t.quadraticCurveTo(l,h,r,a)):(d<1&&(s(n,l,u,r,d,f),l=f[1],u=f[2],r=f[3],s(i,h,c,a,d,f),h=f[1],c=f[2],a=f[3]),t.bezierCurveTo(l,h,u,c,r,a)))},pointAt:function(t){return i(this.shape,t,!1)},tangentAt:function(t){var e=i(this.shape,t,!0);return a.normalize(e,e)}})},function(t,e,n){"use strict";t.exports=n(8).extend({type:"circle",shape:{cx:0,cy:0,r:0},buildPath:function(t,e,n){n&&t.moveTo(e.cx+e.r,e.cy),t.arc(e.cx,e.cy,e.r,0,2*Math.PI,!0)}})},function(t,e,n){t.exports=n(8).extend({type:"line",shape:{x1:0,y1:0,x2:0,y2:0,percent:1},style:{stroke:"#000",fill:null},buildPath:function(t,e){var n=e.x1,i=e.y1,r=e.x2,a=e.y2,o=e.percent;0!==o&&(t.moveTo(n,i),o<1&&(r=n*(1-o)+r*o,a=i*(1-o)+a*o),t.lineTo(r,a))},pointAt:function(t){var e=this.shape;return[e.x1*(1-t)+e.x2*t,e.y1*(1-t)+e.y2*t]}})},function(t,e,n){var i=n(73);t.exports=n(8).extend({type:"polygon",shape:{points:null,smooth:!1,smoothConstraint:null},buildPath:function(t,e){i.buildPath(t,e,!0)}})},function(t,e,n){var i=n(73);t.exports=n(8).extend({type:"polyline",shape:{points:null,smooth:!1,smoothConstraint:null},style:{stroke:"#000",fill:null},buildPath:function(t,e){i.buildPath(t,e,!1)}})},function(t,e,n){var i=n(168);t.exports=n(8).extend({type:"rect",shape:{r:0,x:0,y:0,width:0,height:0},buildPath:function(t,e){var n=e.x,r=e.y,a=e.width,o=e.height;e.r?i.buildPath(t,e):t.rect(n,r,a,o),t.closePath()}})},function(t,e,n){t.exports=n(8).extend({type:"ring",shape:{cx:0,cy:0,r:0,r0:0},buildPath:function(t,e){var n=e.cx,i=e.cy,r=2*Math.PI;t.moveTo(n+e.r,i),t.arc(n,i,e.r,0,r,!1),t.moveTo(n+e.r0,i),t.arc(n,i,e.r0,0,r,!0)}})},function(t,e,n){var i=n(9),r=n(8),a=[["shadowBlur",0],["shadowColor","#000"],["shadowOffsetX",0],["shadowOffsetY",0]];t.exports=r.extend({type:"sector",shape:{cx:0,cy:0,r0:0,r:0,startAngle:0,endAngle:2*Math.PI,clockwise:!0},brush:i.browser.ie&&i.browser.version>=11?function(){var t,e=this.__clipPaths,n=this.style;if(e)for(var i=0;i0&&this.animate(t,!1).when(null==i?500:i,o).delay(a||0),this}},t.exports=h},function(t,e){function n(){this.on("mousedown",this._dragStart,this),this.on("mousemove",this._drag,this),this.on("mouseup",this._dragEnd,this),this.on("globalout",this._dragEnd,this)}n.prototype={constructor:n,_dragStart:function(t){var e=t.target;e&&e.draggable&&(this._draggingTarget=e,e.dragging=!0,this._x=t.offsetX,this._y=t.offsetY,this.dispatchToElement(e,"dragstart",t.event))},_drag:function(t){var e=this._draggingTarget;if(e){var n=t.offsetX,i=t.offsetY,r=n-this._x,a=i-this._y;this._x=n,this._y=i,e.drift(r,a,t),this.dispatchToElement(e,"drag",t.event);var o=this.findHover(n,i,e),s=this._dropTarget;this._dropTarget=o,e!==o&&(s&&o!==s&&this.dispatchToElement(s,"dragleave",t.event),o&&o!==s&&this.dispatchToElement(o,"dragenter",t.event))}},_dragEnd:function(t){var e=this._draggingTarget;e&&(e.dragging=!1),this.dispatchToElement(e,"dragend",t.event),this._dropTarget&&this.dispatchToElement(this._dropTarget,"drop",t.event),this._draggingTarget=null,this._dropTarget=null}},t.exports=n},function(t,e,n){function i(t,e,n,i,r,a,o,s,l,h,u){var g=l*(p/180),y=d(g)*(t-n)/2+f(g)*(e-i)/2,x=-1*f(g)*(t-n)/2+d(g)*(e-i)/2,_=y*y/(o*o)+x*x/(s*s);_>1&&(o*=c(_),s*=c(_));var b=(r===a?-1:1)*c((o*o*(s*s)-o*o*(x*x)-s*s*(y*y))/(o*o*(x*x)+s*s*(y*y)))||0,w=b*o*x/s,M=b*-s*y/o,T=(t+n)/2+d(g)*w-f(g)*M,S=(e+i)/2+f(g)*w+d(g)*M,A=m([1,0],[(y-w)/o,(x-M)/s]),I=[(y-w)/o,(x-M)/s],C=[(-1*y-w)/o,(-1*x-M)/s],P=m(I,C);v(I,C)<=-1&&(P=p),v(I,C)>=1&&(P=0),0===a&&P>0&&(P-=2*p),1===a&&P<0&&(P+=2*p),u.addData(h,T,S,o,s,A,P,g,a)}function r(t){if(!t)return[];var e,n=t.replace(/-/g," -").replace(/ /g," ").replace(/ /g,",").replace(/,,/g,",");for(e=0;e0&&""===v[0]&&v.shift();for(var m=0;m