;\n\n var markupFragment;\n\n if (zrUtil.isObject(result)) {\n if (result.type) {\n markupFragment = result;\n } else {\n if (process.env.NODE_ENV !== 'production') {\n console.warn('The return type of `formatTooltip` is not supported: ' + makePrintable(result));\n }\n } // else {\n // markupText = (result as TooltipFormatResultLegacyObject).html;\n // markers = (result as TooltipFormatResultLegacyObject).markers;\n // if (markersExisting) {\n // markers = zrUtil.merge(markersExisting, markers);\n // }\n // }\n\n } else {\n markupText = result;\n }\n\n return {\n text: markupText,\n // markers: markers || markersExisting,\n frag: markupFragment\n };\n}","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { assert, isArray } from 'zrender/lib/core/util.js';\n;\n/**\n * @param {Object} define\n * @return See the return of `createTask`.\n */\n\nexport function createTask(define) {\n return new Task(define);\n}\n\nvar Task =\n/** @class */\nfunction () {\n function Task(define) {\n define = define || {};\n this._reset = define.reset;\n this._plan = define.plan;\n this._count = define.count;\n this._onDirty = define.onDirty;\n this._dirty = true;\n }\n /**\n * @param step Specified step.\n * @param skip Skip customer perform call.\n * @param modBy Sampling window size.\n * @param modDataCount Sampling count.\n * @return whether unfinished.\n */\n\n\n Task.prototype.perform = function (performArgs) {\n var upTask = this._upstream;\n var skip = performArgs && performArgs.skip; // TODO some refactor.\n // Pull data. Must pull data each time, because context.data\n // may be updated by Series.setData.\n\n if (this._dirty && upTask) {\n var context = this.context;\n context.data = context.outputData = upTask.context.outputData;\n }\n\n if (this.__pipeline) {\n this.__pipeline.currentTask = this;\n }\n\n var planResult;\n\n if (this._plan && !skip) {\n planResult = this._plan(this.context);\n } // Support sharding by mod, which changes the render sequence and makes the rendered graphic\n // elements uniformed distributed when progress, especially when moving or zooming.\n\n\n var lastModBy = normalizeModBy(this._modBy);\n var lastModDataCount = this._modDataCount || 0;\n var modBy = normalizeModBy(performArgs && performArgs.modBy);\n var modDataCount = performArgs && performArgs.modDataCount || 0;\n\n if (lastModBy !== modBy || lastModDataCount !== modDataCount) {\n planResult = 'reset';\n }\n\n function normalizeModBy(val) {\n !(val >= 1) && (val = 1); // jshint ignore:line\n\n return val;\n }\n\n var forceFirstProgress;\n\n if (this._dirty || planResult === 'reset') {\n this._dirty = false;\n forceFirstProgress = this._doReset(skip);\n }\n\n this._modBy = modBy;\n this._modDataCount = modDataCount;\n var step = performArgs && performArgs.step;\n\n if (upTask) {\n if (process.env.NODE_ENV !== 'production') {\n assert(upTask._outputDueEnd != null);\n }\n\n this._dueEnd = upTask._outputDueEnd;\n } // DataTask or overallTask\n else {\n if (process.env.NODE_ENV !== 'production') {\n assert(!this._progress || this._count);\n }\n\n this._dueEnd = this._count ? this._count(this.context) : Infinity;\n } // Note: Stubs, that its host overall task let it has progress, has progress.\n // If no progress, pass index from upstream to downstream each time plan called.\n\n\n if (this._progress) {\n var start = this._dueIndex;\n var end = Math.min(step != null ? this._dueIndex + step : Infinity, this._dueEnd);\n\n if (!skip && (forceFirstProgress || start < end)) {\n var progress = this._progress;\n\n if (isArray(progress)) {\n for (var i = 0; i < progress.length; i++) {\n this._doProgress(progress[i], start, end, modBy, modDataCount);\n }\n } else {\n this._doProgress(progress, start, end, modBy, modDataCount);\n }\n }\n\n this._dueIndex = end; // If no `outputDueEnd`, assume that output data and\n // input data is the same, so use `dueIndex` as `outputDueEnd`.\n\n var outputDueEnd = this._settedOutputEnd != null ? this._settedOutputEnd : end;\n\n if (process.env.NODE_ENV !== 'production') {\n // ??? Can not rollback.\n assert(outputDueEnd >= this._outputDueEnd);\n }\n\n this._outputDueEnd = outputDueEnd;\n } else {\n // (1) Some overall task has no progress.\n // (2) Stubs, that its host overall task do not let it has progress, has no progress.\n // This should always be performed so it can be passed to downstream.\n this._dueIndex = this._outputDueEnd = this._settedOutputEnd != null ? this._settedOutputEnd : this._dueEnd;\n }\n\n return this.unfinished();\n };\n\n Task.prototype.dirty = function () {\n this._dirty = true;\n this._onDirty && this._onDirty(this.context);\n };\n\n Task.prototype._doProgress = function (progress, start, end, modBy, modDataCount) {\n iterator.reset(start, end, modBy, modDataCount);\n this._callingProgress = progress;\n\n this._callingProgress({\n start: start,\n end: end,\n count: end - start,\n next: iterator.next\n }, this.context);\n };\n\n Task.prototype._doReset = function (skip) {\n this._dueIndex = this._outputDueEnd = this._dueEnd = 0;\n this._settedOutputEnd = null;\n var progress;\n var forceFirstProgress;\n\n if (!skip && this._reset) {\n progress = this._reset(this.context);\n\n if (progress && progress.progress) {\n forceFirstProgress = progress.forceFirstProgress;\n progress = progress.progress;\n } // To simplify no progress checking, array must has item.\n\n\n if (isArray(progress) && !progress.length) {\n progress = null;\n }\n }\n\n this._progress = progress;\n this._modBy = this._modDataCount = null;\n var downstream = this._downstream;\n downstream && downstream.dirty();\n return forceFirstProgress;\n };\n\n Task.prototype.unfinished = function () {\n return this._progress && this._dueIndex < this._dueEnd;\n };\n /**\n * @param downTask The downstream task.\n * @return The downstream task.\n */\n\n\n Task.prototype.pipe = function (downTask) {\n if (process.env.NODE_ENV !== 'production') {\n assert(downTask && !downTask._disposed && downTask !== this);\n } // If already downstream, do not dirty downTask.\n\n\n if (this._downstream !== downTask || this._dirty) {\n this._downstream = downTask;\n downTask._upstream = this;\n downTask.dirty();\n }\n };\n\n Task.prototype.dispose = function () {\n if (this._disposed) {\n return;\n }\n\n this._upstream && (this._upstream._downstream = null);\n this._downstream && (this._downstream._upstream = null);\n this._dirty = false;\n this._disposed = true;\n };\n\n Task.prototype.getUpstream = function () {\n return this._upstream;\n };\n\n Task.prototype.getDownstream = function () {\n return this._downstream;\n };\n\n Task.prototype.setOutputEnd = function (end) {\n // This only happend in dataTask, dataZoom, map, currently.\n // where dataZoom do not set end each time, but only set\n // when reset. So we should record the setted end, in case\n // that the stub of dataZoom perform again and earse the\n // setted end by upstream.\n this._outputDueEnd = this._settedOutputEnd = end;\n };\n\n return Task;\n}();\n\nexport { Task };\n\nvar iterator = function () {\n var end;\n var current;\n var modBy;\n var modDataCount;\n var winCount;\n var it = {\n reset: function (s, e, sStep, sCount) {\n current = s;\n end = e;\n modBy = sStep;\n modDataCount = sCount;\n winCount = Math.ceil(modDataCount / modBy);\n it.next = modBy > 1 && modDataCount > 0 ? modNext : sequentialNext;\n }\n };\n return it;\n\n function sequentialNext() {\n return current < end ? current++ : null;\n }\n\n function modNext() {\n var dataIndex = current % winCount * modBy + Math.ceil(current / winCount);\n var result = current >= end ? null : dataIndex < modDataCount ? dataIndex // If modDataCount is smaller than data.count() (consider `appendData` case),\n // Use normal linear rendering mode.\n : current;\n current++;\n return result;\n }\n}(); ///////////////////////////////////////////////////////////\n// For stream debug (Should be commented out after used!)\n// @usage: printTask(this, 'begin');\n// @usage: printTask(this, null, {someExtraProp});\n// @usage: Use `__idxInPipeline` as conditional breakpiont.\n//\n// window.printTask = function (task: any, prefix: string, extra: { [key: string]: unknown }): void {\n// window.ecTaskUID == null && (window.ecTaskUID = 0);\n// task.uidDebug == null && (task.uidDebug = `task_${window.ecTaskUID++}`);\n// task.agent && task.agent.uidDebug == null && (task.agent.uidDebug = `task_${window.ecTaskUID++}`);\n// let props = [];\n// if (task.__pipeline) {\n// let val = `${task.__idxInPipeline}/${task.__pipeline.tail.__idxInPipeline} ${task.agent ? '(stub)' : ''}`;\n// props.push({text: '__idxInPipeline/total', value: val});\n// } else {\n// let stubCount = 0;\n// task.agentStubMap.each(() => stubCount++);\n// props.push({text: 'idx', value: `overall (stubs: ${stubCount})`});\n// }\n// props.push({text: 'uid', value: task.uidDebug});\n// if (task.__pipeline) {\n// props.push({text: 'pipelineId', value: task.__pipeline.id});\n// task.agent && props.push(\n// {text: 'stubFor', value: task.agent.uidDebug}\n// );\n// }\n// props.push(\n// {text: 'dirty', value: task._dirty},\n// {text: 'dueIndex', value: task._dueIndex},\n// {text: 'dueEnd', value: task._dueEnd},\n// {text: 'outputDueEnd', value: task._outputDueEnd}\n// );\n// if (extra) {\n// Object.keys(extra).forEach(key => {\n// props.push({text: key, value: extra[key]});\n// });\n// }\n// let args = ['color: blue'];\n// let msg = `%c[${prefix || 'T'}] %c` + props.map(item => (\n// args.push('color: green', 'color: red'),\n// `${item.text}: %c${item.value}`\n// )).join('%c, ');\n// console.log.apply(console, [msg].concat(args));\n// // console.log(this);\n// };\n// window.printPipeline = function (task: any, prefix: string) {\n// const pipeline = task.__pipeline;\n// let currTask = pipeline.head;\n// while (currTask) {\n// window.printTask(currTask, prefix);\n// currTask = currTask._downstream;\n// }\n// };\n// window.showChain = function (chainHeadTask) {\n// var chain = [];\n// var task = chainHeadTask;\n// while (task) {\n// chain.push({\n// task: task,\n// up: task._upstream,\n// down: task._downstream,\n// idxInPipeline: task.__idxInPipeline\n// });\n// task = task._downstream;\n// }\n// return chain;\n// };\n// window.findTaskInChain = function (task, chainHeadTask) {\n// let chain = window.showChain(chainHeadTask);\n// let result = [];\n// for (let i = 0; i < chain.length; i++) {\n// let chainItem = chain[i];\n// if (chainItem.task === task) {\n// result.push(i);\n// }\n// }\n// return result;\n// };\n// window.printChainAEachInChainB = function (chainHeadTaskA, chainHeadTaskB) {\n// let chainA = window.showChain(chainHeadTaskA);\n// for (let i = 0; i < chainA.length; i++) {\n// console.log('chainAIdx:', i, 'inChainB:', window.findTaskInChain(chainA[i].task, chainHeadTaskB));\n// }\n// };","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { parseDate, numericToNumber } from '../../util/number.js';\nimport { createHashMap, trim, hasOwn, isString, isNumber } from 'zrender/lib/core/util.js';\nimport { throwError } from '../../util/log.js';\n/**\n * Convert raw the value in to inner value in List.\n *\n * [Performance sensitive]\n *\n * [Caution]: this is the key logic of user value parser.\n * For backward compatibiliy, do not modify it until have to!\n */\n\nexport function parseDataValue(value, // For high performance, do not omit the second param.\nopt) {\n // Performance sensitive.\n var dimType = opt && opt.type;\n\n if (dimType === 'ordinal') {\n // If given value is a category string\n return value;\n }\n\n if (dimType === 'time' // spead up when using timestamp\n && !isNumber(value) && value != null && value !== '-') {\n value = +parseDate(value);\n } // dimType defaults 'number'.\n // If dimType is not ordinal and value is null or undefined or NaN or '-',\n // parse to NaN.\n // number-like string (like ' 123 ') can be converted to a number.\n // where null/undefined or other string will be converted to NaN.\n\n\n return value == null || value === '' ? NaN // If string (like '-'), using '+' parse to NaN\n // If object, also parse to NaN\n : +value;\n}\n;\nvar valueParserMap = createHashMap({\n 'number': function (val) {\n // Do not use `numericToNumber` here. We have by defualt `numericToNumber`.\n // Here the number parser can have loose rule:\n // enable to cut suffix: \"120px\" => 120, \"14%\" => 14.\n return parseFloat(val);\n },\n 'time': function (val) {\n // return timestamp.\n return +parseDate(val);\n },\n 'trim': function (val) {\n return isString(val) ? trim(val) : val;\n }\n});\nexport function getRawValueParser(type) {\n return valueParserMap.get(type);\n}\nvar ORDER_COMPARISON_OP_MAP = {\n lt: function (lval, rval) {\n return lval < rval;\n },\n lte: function (lval, rval) {\n return lval <= rval;\n },\n gt: function (lval, rval) {\n return lval > rval;\n },\n gte: function (lval, rval) {\n return lval >= rval;\n }\n};\n\nvar FilterOrderComparator =\n/** @class */\nfunction () {\n function FilterOrderComparator(op, rval) {\n if (!isNumber(rval)) {\n var errMsg = '';\n\n if (process.env.NODE_ENV !== 'production') {\n errMsg = 'rvalue of \"<\", \">\", \"<=\", \">=\" can only be number in filter.';\n }\n\n throwError(errMsg);\n }\n\n this._opFn = ORDER_COMPARISON_OP_MAP[op];\n this._rvalFloat = numericToNumber(rval);\n } // Performance sensitive.\n\n\n FilterOrderComparator.prototype.evaluate = function (lval) {\n // Most cases is 'number', and typeof maybe 10 times faseter than parseFloat.\n return isNumber(lval) ? this._opFn(lval, this._rvalFloat) : this._opFn(numericToNumber(lval), this._rvalFloat);\n };\n\n return FilterOrderComparator;\n}();\n\nvar SortOrderComparator =\n/** @class */\nfunction () {\n /**\n * @param order by defualt: 'asc'\n * @param incomparable by defualt: Always on the tail.\n * That is, if 'asc' => 'max', if 'desc' => 'min'\n * See the definition of \"incomparable\" in [SORT_COMPARISON_RULE]\n */\n function SortOrderComparator(order, incomparable) {\n var isDesc = order === 'desc';\n this._resultLT = isDesc ? 1 : -1;\n\n if (incomparable == null) {\n incomparable = isDesc ? 'min' : 'max';\n }\n\n this._incomparable = incomparable === 'min' ? -Infinity : Infinity;\n } // See [SORT_COMPARISON_RULE].\n // Performance sensitive.\n\n\n SortOrderComparator.prototype.evaluate = function (lval, rval) {\n // Most cases is 'number', and typeof maybe 10 times faseter than parseFloat.\n var lvalFloat = isNumber(lval) ? lval : numericToNumber(lval);\n var rvalFloat = isNumber(rval) ? rval : numericToNumber(rval);\n var lvalNotNumeric = isNaN(lvalFloat);\n var rvalNotNumeric = isNaN(rvalFloat);\n\n if (lvalNotNumeric) {\n lvalFloat = this._incomparable;\n }\n\n if (rvalNotNumeric) {\n rvalFloat = this._incomparable;\n }\n\n if (lvalNotNumeric && rvalNotNumeric) {\n var lvalIsStr = isString(lval);\n var rvalIsStr = isString(rval);\n\n if (lvalIsStr) {\n lvalFloat = rvalIsStr ? lval : 0;\n }\n\n if (rvalIsStr) {\n rvalFloat = lvalIsStr ? rval : 0;\n }\n }\n\n return lvalFloat < rvalFloat ? this._resultLT : lvalFloat > rvalFloat ? -this._resultLT : 0;\n };\n\n return SortOrderComparator;\n}();\n\nexport { SortOrderComparator };\n\nvar FilterEqualityComparator =\n/** @class */\nfunction () {\n function FilterEqualityComparator(isEq, rval) {\n this._rval = rval;\n this._isEQ = isEq;\n this._rvalTypeof = typeof rval;\n this._rvalFloat = numericToNumber(rval);\n } // Performance sensitive.\n\n\n FilterEqualityComparator.prototype.evaluate = function (lval) {\n var eqResult = lval === this._rval;\n\n if (!eqResult) {\n var lvalTypeof = typeof lval;\n\n if (lvalTypeof !== this._rvalTypeof && (lvalTypeof === 'number' || this._rvalTypeof === 'number')) {\n eqResult = numericToNumber(lval) === this._rvalFloat;\n }\n }\n\n return this._isEQ ? eqResult : !eqResult;\n };\n\n return FilterEqualityComparator;\n}();\n/**\n * [FILTER_COMPARISON_RULE]\n * `lt`|`lte`|`gt`|`gte`:\n * + rval must be a number. And lval will be converted to number (`numericToNumber`) to compare.\n * `eq`:\n * + If same type, compare with `===`.\n * + If there is one number, convert to number (`numericToNumber`) to compare.\n * + Else return `false`.\n * `ne`:\n * + Not `eq`.\n *\n *\n * [SORT_COMPARISON_RULE]\n * All the values are grouped into three categories:\n * + \"numeric\" (number and numeric string)\n * + \"non-numeric-string\" (string that excluding numeric string)\n * + \"others\"\n * \"numeric\" vs \"numeric\": values are ordered by number order.\n * \"non-numeric-string\" vs \"non-numeric-string\": values are ordered by ES spec (#sec-abstract-relational-comparison).\n * \"others\" vs \"others\": do not change order (always return 0).\n * \"numeric\" vs \"non-numeric-string\": \"non-numeric-string\" is treated as \"incomparable\".\n * \"number\" vs \"others\": \"others\" is treated as \"incomparable\".\n * \"non-numeric-string\" vs \"others\": \"others\" is treated as \"incomparable\".\n * \"incomparable\" will be seen as -Infinity or Infinity (depends on the settings).\n * MEMO:\n * non-numeric string sort make sence when need to put the items with the same tag together.\n * But if we support string sort, we still need to avoid the misleading like `'2' > '12'`,\n * So we treat \"numeric-string\" sorted by number order rather than string comparison.\n *\n *\n * [CHECK_LIST_OF_THE_RULE_DESIGN]\n * + Do not support string comparison until required. And also need to\n * void the misleading of \"2\" > \"12\".\n * + Should avoid the misleading case:\n * `\" 22 \" gte \"22\"` is `true` but `\" 22 \" eq \"22\"` is `false`.\n * + JS bad case should be avoided: null <= 0, [] <= 0, ' ' <= 0, ...\n * + Only \"numeric\" can be converted to comparable number, otherwise converted to NaN.\n * See `util/number.ts#numericToNumber`.\n *\n * @return If `op` is not `RelationalOperator`, return null;\n */\n\n\nexport function createFilterComparator(op, rval) {\n return op === 'eq' || op === 'ne' ? new FilterEqualityComparator(op === 'eq', rval) : hasOwn(ORDER_COMPARISON_OP_MAP, op) ? new FilterOrderComparator(op, rval) : null;\n}","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { SERIES_LAYOUT_BY_COLUMN, SOURCE_FORMAT_OBJECT_ROWS, SOURCE_FORMAT_ARRAY_ROWS } from '../../util/types.js';\nimport { normalizeToArray } from '../../util/model.js';\nimport { createHashMap, bind, each, hasOwn, map, clone, isObject, extend, isNumber } from 'zrender/lib/core/util.js';\nimport { getRawSourceItemGetter, getRawSourceDataCounter, getRawSourceValueGetter } from './dataProvider.js';\nimport { parseDataValue } from './dataValueHelper.js';\nimport { log, makePrintable, throwError } from '../../util/log.js';\nimport { createSource, detectSourceFormat } from '../Source.js';\n/**\n * TODO: disable writable.\n * This structure will be exposed to users.\n */\n\nvar ExternalSource =\n/** @class */\nfunction () {\n function ExternalSource() {}\n\n ExternalSource.prototype.getRawData = function () {\n // Only built-in transform available.\n throw new Error('not supported');\n };\n\n ExternalSource.prototype.getRawDataItem = function (dataIndex) {\n // Only built-in transform available.\n throw new Error('not supported');\n };\n\n ExternalSource.prototype.cloneRawData = function () {\n return;\n };\n /**\n * @return If dimension not found, return null/undefined.\n */\n\n\n ExternalSource.prototype.getDimensionInfo = function (dim) {\n return;\n };\n /**\n * dimensions defined if and only if either:\n * (a) dataset.dimensions are declared.\n * (b) dataset data include dimensions definitions in data (detected or via specified `sourceHeader`).\n * If dimensions are defined, `dimensionInfoAll` is corresponding to\n * the defined dimensions.\n * Otherwise, `dimensionInfoAll` is determined by data columns.\n * @return Always return an array (even empty array).\n */\n\n\n ExternalSource.prototype.cloneAllDimensionInfo = function () {\n return;\n };\n\n ExternalSource.prototype.count = function () {\n return;\n };\n /**\n * Only support by dimension index.\n * No need to support by dimension name in transform function,\n * becuase transform function is not case-specific, no need to use name literally.\n */\n\n\n ExternalSource.prototype.retrieveValue = function (dataIndex, dimIndex) {\n return;\n };\n\n ExternalSource.prototype.retrieveValueFromItem = function (dataItem, dimIndex) {\n return;\n };\n\n ExternalSource.prototype.convertValue = function (rawVal, dimInfo) {\n return parseDataValue(rawVal, dimInfo);\n };\n\n return ExternalSource;\n}();\n\nexport { ExternalSource };\n\nfunction createExternalSource(internalSource, externalTransform) {\n var extSource = new ExternalSource();\n var data = internalSource.data;\n var sourceFormat = extSource.sourceFormat = internalSource.sourceFormat;\n var sourceHeaderCount = internalSource.startIndex;\n var errMsg = '';\n\n if (internalSource.seriesLayoutBy !== SERIES_LAYOUT_BY_COLUMN) {\n // For the logic simplicity in transformer, only 'culumn' is\n // supported in data transform. Otherwise, the `dimensionsDefine`\n // might be detected by 'row', which probably confuses users.\n if (process.env.NODE_ENV !== 'production') {\n errMsg = '`seriesLayoutBy` of upstream dataset can only be \"column\" in data transform.';\n }\n\n throwError(errMsg);\n } // [MEMO]\n // Create a new dimensions structure for exposing.\n // Do not expose all dimension info to users directly.\n // Becuase the dimension is probably auto detected from data and not might reliable.\n // Should not lead the transformers to think that is relialbe and return it.\n // See [DIMENSION_INHERIT_RULE] in `sourceManager.ts`.\n\n\n var dimensions = [];\n var dimsByName = {};\n var dimsDef = internalSource.dimensionsDefine;\n\n if (dimsDef) {\n each(dimsDef, function (dimDef, idx) {\n var name = dimDef.name;\n var dimDefExt = {\n index: idx,\n name: name,\n displayName: dimDef.displayName\n };\n dimensions.push(dimDefExt); // Users probably not sepcify dimension name. For simplicity, data transform\n // do not generate dimension name.\n\n if (name != null) {\n // Dimension name should not be duplicated.\n // For simplicity, data transform forbid name duplication, do not generate\n // new name like module `completeDimensions.ts` did, but just tell users.\n var errMsg_1 = '';\n\n if (hasOwn(dimsByName, name)) {\n if (process.env.NODE_ENV !== 'production') {\n errMsg_1 = 'dimension name \"' + name + '\" duplicated.';\n }\n\n throwError(errMsg_1);\n }\n\n dimsByName[name] = dimDefExt;\n }\n });\n } // If dimension definitions are not defined and can not be detected.\n // e.g., pure data `[[11, 22], ...]`.\n else {\n for (var i = 0; i < internalSource.dimensionsDetectedCount || 0; i++) {\n // Do not generete name or anything others. The consequence process in\n // `transform` or `series` probably have there own name generation strategry.\n dimensions.push({\n index: i\n });\n }\n } // Implement public methods:\n\n\n var rawItemGetter = getRawSourceItemGetter(sourceFormat, SERIES_LAYOUT_BY_COLUMN);\n\n if (externalTransform.__isBuiltIn) {\n extSource.getRawDataItem = function (dataIndex) {\n return rawItemGetter(data, sourceHeaderCount, dimensions, dataIndex);\n };\n\n extSource.getRawData = bind(getRawData, null, internalSource);\n }\n\n extSource.cloneRawData = bind(cloneRawData, null, internalSource);\n var rawCounter = getRawSourceDataCounter(sourceFormat, SERIES_LAYOUT_BY_COLUMN);\n extSource.count = bind(rawCounter, null, data, sourceHeaderCount, dimensions);\n var rawValueGetter = getRawSourceValueGetter(sourceFormat);\n\n extSource.retrieveValue = function (dataIndex, dimIndex) {\n var rawItem = rawItemGetter(data, sourceHeaderCount, dimensions, dataIndex);\n return retrieveValueFromItem(rawItem, dimIndex);\n };\n\n var retrieveValueFromItem = extSource.retrieveValueFromItem = function (dataItem, dimIndex) {\n if (dataItem == null) {\n return;\n }\n\n var dimDef = dimensions[dimIndex]; // When `dimIndex` is `null`, `rawValueGetter` return the whole item.\n\n if (dimDef) {\n return rawValueGetter(dataItem, dimIndex, dimDef.name);\n }\n };\n\n extSource.getDimensionInfo = bind(getDimensionInfo, null, dimensions, dimsByName);\n extSource.cloneAllDimensionInfo = bind(cloneAllDimensionInfo, null, dimensions);\n return extSource;\n}\n\nfunction getRawData(upstream) {\n var sourceFormat = upstream.sourceFormat;\n\n if (!isSupportedSourceFormat(sourceFormat)) {\n var errMsg = '';\n\n if (process.env.NODE_ENV !== 'production') {\n errMsg = '`getRawData` is not supported in source format ' + sourceFormat;\n }\n\n throwError(errMsg);\n }\n\n return upstream.data;\n}\n\nfunction cloneRawData(upstream) {\n var sourceFormat = upstream.sourceFormat;\n var data = upstream.data;\n\n if (!isSupportedSourceFormat(sourceFormat)) {\n var errMsg = '';\n\n if (process.env.NODE_ENV !== 'production') {\n errMsg = '`cloneRawData` is not supported in source format ' + sourceFormat;\n }\n\n throwError(errMsg);\n }\n\n if (sourceFormat === SOURCE_FORMAT_ARRAY_ROWS) {\n var result = [];\n\n for (var i = 0, len = data.length; i < len; i++) {\n // Not strictly clone for performance\n result.push(data[i].slice());\n }\n\n return result;\n } else if (sourceFormat === SOURCE_FORMAT_OBJECT_ROWS) {\n var result = [];\n\n for (var i = 0, len = data.length; i < len; i++) {\n // Not strictly clone for performance\n result.push(extend({}, data[i]));\n }\n\n return result;\n }\n}\n\nfunction getDimensionInfo(dimensions, dimsByName, dim) {\n if (dim == null) {\n return;\n } // Keep the same logic as `List::getDimension` did.\n\n\n if (isNumber(dim) // If being a number-like string but not being defined a dimension name.\n || !isNaN(dim) && !hasOwn(dimsByName, dim)) {\n return dimensions[dim];\n } else if (hasOwn(dimsByName, dim)) {\n return dimsByName[dim];\n }\n}\n\nfunction cloneAllDimensionInfo(dimensions) {\n return clone(dimensions);\n}\n\nvar externalTransformMap = createHashMap();\nexport function registerExternalTransform(externalTransform) {\n externalTransform = clone(externalTransform);\n var type = externalTransform.type;\n var errMsg = '';\n\n if (!type) {\n if (process.env.NODE_ENV !== 'production') {\n errMsg = 'Must have a `type` when `registerTransform`.';\n }\n\n throwError(errMsg);\n }\n\n var typeParsed = type.split(':');\n\n if (typeParsed.length !== 2) {\n if (process.env.NODE_ENV !== 'production') {\n errMsg = 'Name must include namespace like \"ns:regression\".';\n }\n\n throwError(errMsg);\n } // Namespace 'echarts:xxx' is official namespace, where the transforms should\n // be called directly via 'xxx' rather than 'echarts:xxx'.\n\n\n var isBuiltIn = false;\n\n if (typeParsed[0] === 'echarts') {\n type = typeParsed[1];\n isBuiltIn = true;\n }\n\n externalTransform.__isBuiltIn = isBuiltIn;\n externalTransformMap.set(type, externalTransform);\n}\nexport function applyDataTransform(rawTransOption, sourceList, infoForPrint) {\n var pipedTransOption = normalizeToArray(rawTransOption);\n var pipeLen = pipedTransOption.length;\n var errMsg = '';\n\n if (!pipeLen) {\n if (process.env.NODE_ENV !== 'production') {\n errMsg = 'If `transform` declared, it should at least contain one transform.';\n }\n\n throwError(errMsg);\n }\n\n for (var i = 0, len = pipeLen; i < len; i++) {\n var transOption = pipedTransOption[i];\n sourceList = applySingleDataTransform(transOption, sourceList, infoForPrint, pipeLen === 1 ? null : i); // piped transform only support single input, except the fist one.\n // piped transform only support single output, except the last one.\n\n if (i !== len - 1) {\n sourceList.length = Math.max(sourceList.length, 1);\n }\n }\n\n return sourceList;\n}\n\nfunction applySingleDataTransform(transOption, upSourceList, infoForPrint, // If `pipeIndex` is null/undefined, no piped transform.\npipeIndex) {\n var errMsg = '';\n\n if (!upSourceList.length) {\n if (process.env.NODE_ENV !== 'production') {\n errMsg = 'Must have at least one upstream dataset.';\n }\n\n throwError(errMsg);\n }\n\n if (!isObject(transOption)) {\n if (process.env.NODE_ENV !== 'production') {\n errMsg = 'transform declaration must be an object rather than ' + typeof transOption + '.';\n }\n\n throwError(errMsg);\n }\n\n var transType = transOption.type;\n var externalTransform = externalTransformMap.get(transType);\n\n if (!externalTransform) {\n if (process.env.NODE_ENV !== 'production') {\n errMsg = 'Can not find transform on type \"' + transType + '\".';\n }\n\n throwError(errMsg);\n } // Prepare source\n\n\n var extUpSourceList = map(upSourceList, function (upSource) {\n return createExternalSource(upSource, externalTransform);\n });\n var resultList = normalizeToArray(externalTransform.transform({\n upstream: extUpSourceList[0],\n upstreamList: extUpSourceList,\n config: clone(transOption.config)\n }));\n\n if (process.env.NODE_ENV !== 'production') {\n if (transOption.print) {\n var printStrArr = map(resultList, function (extSource) {\n var pipeIndexStr = pipeIndex != null ? ' === pipe index: ' + pipeIndex : '';\n return ['=== dataset index: ' + infoForPrint.datasetIndex + pipeIndexStr + ' ===', '- transform result data:', makePrintable(extSource.data), '- transform result dimensions:', makePrintable(extSource.dimensions)].join('\\n');\n }).join('\\n');\n log(printStrArr);\n }\n }\n\n return map(resultList, function (result, resultIndex) {\n var errMsg = '';\n\n if (!isObject(result)) {\n if (process.env.NODE_ENV !== 'production') {\n errMsg = 'A transform should not return some empty results.';\n }\n\n throwError(errMsg);\n }\n\n if (!result.data) {\n if (process.env.NODE_ENV !== 'production') {\n errMsg = 'Transform result data should be not be null or undefined';\n }\n\n throwError(errMsg);\n }\n\n var sourceFormat = detectSourceFormat(result.data);\n\n if (!isSupportedSourceFormat(sourceFormat)) {\n if (process.env.NODE_ENV !== 'production') {\n errMsg = 'Transform result data should be array rows or object rows.';\n }\n\n throwError(errMsg);\n }\n\n var resultMetaRawOption;\n var firstUpSource = upSourceList[0];\n /**\n * Intuitively, the end users known the content of the original `dataset.source`,\n * calucating the transform result in mind.\n * Suppose the original `dataset.source` is:\n * ```js\n * [\n * ['product', '2012', '2013', '2014', '2015'],\n * ['AAA', 41.1, 30.4, 65.1, 53.3],\n * ['BBB', 86.5, 92.1, 85.7, 83.1],\n * ['CCC', 24.1, 67.2, 79.5, 86.4]\n * ]\n * ```\n * The dimension info have to be detected from the source data.\n * Some of the transformers (like filter, sort) will follow the dimension info\n * of upstream, while others use new dimensions (like aggregate).\n * Transformer can output a field `dimensions` to define the its own output dimensions.\n * We also allow transformers to ignore the output `dimensions` field, and\n * inherit the upstream dimensions definition. It can reduce the burden of handling\n * dimensions in transformers.\n *\n * See also [DIMENSION_INHERIT_RULE] in `sourceManager.ts`.\n */\n\n if (firstUpSource && resultIndex === 0 // If transformer returns `dimensions`, it means that the transformer has different\n // dimensions definitions. We do not inherit anything from upstream.\n && !result.dimensions) {\n var startIndex = firstUpSource.startIndex; // We copy the header of upstream to the result becuase:\n // (1) The returned data always does not contain header line and can not be used\n // as dimension-detection. In this case we can not use \"detected dimensions\" of\n // upstream directly, because it might be detected based on different `seriesLayoutBy`.\n // (2) We should support that the series read the upstream source in `seriesLayoutBy: 'row'`.\n // So the original detected header should be add to the result, otherwise they can not be read.\n\n if (startIndex) {\n result.data = firstUpSource.data.slice(0, startIndex).concat(result.data);\n }\n\n resultMetaRawOption = {\n seriesLayoutBy: SERIES_LAYOUT_BY_COLUMN,\n sourceHeader: startIndex,\n dimensions: firstUpSource.metaRawOption.dimensions\n };\n } else {\n resultMetaRawOption = {\n seriesLayoutBy: SERIES_LAYOUT_BY_COLUMN,\n sourceHeader: 0,\n dimensions: result.dimensions\n };\n }\n\n return createSource(result.data, resultMetaRawOption, null);\n });\n}\n\nfunction isSupportedSourceFormat(sourceFormat) {\n return sourceFormat === SOURCE_FORMAT_ARRAY_ROWS || sourceFormat === SOURCE_FORMAT_OBJECT_ROWS;\n}","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { assert, clone, createHashMap, isFunction, keys, map, reduce } from 'zrender/lib/core/util.js';\nimport { parseDataValue } from './helper/dataValueHelper.js';\nimport { shouldRetrieveDataByName } from './Source.js';\nvar UNDEFINED = 'undefined';\n/* global Float64Array, Int32Array, Uint32Array, Uint16Array */\n// Caution: MUST not use `new CtorUint32Array(arr, 0, len)`, because the Ctor of array is\n// different from the Ctor of typed array.\n\nexport var CtorUint32Array = typeof Uint32Array === UNDEFINED ? Array : Uint32Array;\nexport var CtorUint16Array = typeof Uint16Array === UNDEFINED ? Array : Uint16Array;\nexport var CtorInt32Array = typeof Int32Array === UNDEFINED ? Array : Int32Array;\nexport var CtorFloat64Array = typeof Float64Array === UNDEFINED ? Array : Float64Array;\n/**\n * Multi dimensional data store\n */\n\nvar dataCtors = {\n 'float': CtorFloat64Array,\n 'int': CtorInt32Array,\n // Ordinal data type can be string or int\n 'ordinal': Array,\n 'number': Array,\n 'time': CtorFloat64Array\n};\nvar defaultDimValueGetters;\n\nfunction getIndicesCtor(rawCount) {\n // The possible max value in this._indicies is always this._rawCount despite of filtering.\n return rawCount > 65535 ? CtorUint32Array : CtorUint16Array;\n}\n\n;\n\nfunction getInitialExtent() {\n return [Infinity, -Infinity];\n}\n\n;\n\nfunction cloneChunk(originalChunk) {\n var Ctor = originalChunk.constructor; // Only shallow clone is enough when Array.\n\n return Ctor === Array ? originalChunk.slice() : new Ctor(originalChunk);\n}\n\nfunction prepareStore(store, dimIdx, dimType, end, append) {\n var DataCtor = dataCtors[dimType || 'float'];\n\n if (append) {\n var oldStore = store[dimIdx];\n var oldLen = oldStore && oldStore.length;\n\n if (!(oldLen === end)) {\n var newStore = new DataCtor(end); // The cost of the copy is probably inconsiderable\n // within the initial chunkSize.\n\n for (var j = 0; j < oldLen; j++) {\n newStore[j] = oldStore[j];\n }\n\n store[dimIdx] = newStore;\n }\n } else {\n store[dimIdx] = new DataCtor(end);\n }\n}\n\n;\n/**\n * Basically, DataStore API keep immutable.\n */\n\nvar DataStore =\n/** @class */\nfunction () {\n function DataStore() {\n this._chunks = []; // It will not be calculated util needed.\n\n this._rawExtent = [];\n this._extent = [];\n this._count = 0;\n this._rawCount = 0;\n this._calcDimNameToIdx = createHashMap();\n }\n /**\n * Initialize from data\n */\n\n\n DataStore.prototype.initData = function (provider, inputDimensions, dimValueGetter) {\n if (process.env.NODE_ENV !== 'production') {\n assert(isFunction(provider.getItem) && isFunction(provider.count), 'Inavlid data provider.');\n }\n\n this._provider = provider; // Clear\n\n this._chunks = [];\n this._indices = null;\n this.getRawIndex = this._getRawIdxIdentity;\n var source = provider.getSource();\n var defaultGetter = this.defaultDimValueGetter = defaultDimValueGetters[source.sourceFormat]; // Default dim value getter\n\n this._dimValueGetter = dimValueGetter || defaultGetter; // Reset raw extent.\n\n this._rawExtent = [];\n var willRetrieveDataByName = shouldRetrieveDataByName(source);\n this._dimensions = map(inputDimensions, function (dim) {\n if (process.env.NODE_ENV !== 'production') {\n if (willRetrieveDataByName) {\n assert(dim.property != null);\n }\n }\n\n return {\n // Only pick these two props. Not leak other properties like orderMeta.\n type: dim.type,\n property: dim.property\n };\n });\n\n this._initDataFromProvider(0, provider.count());\n };\n\n DataStore.prototype.getProvider = function () {\n return this._provider;\n };\n /**\n * Caution: even when a `source` instance owned by a series, the created data store\n * may still be shared by different sereis (the source hash does not use all `source`\n * props, see `sourceManager`). In this case, the `source` props that are not used in\n * hash (like `source.dimensionDefine`) probably only belongs to a certain series and\n * thus should not be fetch here.\n */\n\n\n DataStore.prototype.getSource = function () {\n return this._provider.getSource();\n };\n /**\n * @caution Only used in dataStack.\n */\n\n\n DataStore.prototype.ensureCalculationDimension = function (dimName, type) {\n var calcDimNameToIdx = this._calcDimNameToIdx;\n var dimensions = this._dimensions;\n var calcDimIdx = calcDimNameToIdx.get(dimName);\n\n if (calcDimIdx != null) {\n if (dimensions[calcDimIdx].type === type) {\n return calcDimIdx;\n }\n } else {\n calcDimIdx = dimensions.length;\n }\n\n dimensions[calcDimIdx] = {\n type: type\n };\n calcDimNameToIdx.set(dimName, calcDimIdx);\n this._chunks[calcDimIdx] = new dataCtors[type || 'float'](this._rawCount);\n this._rawExtent[calcDimIdx] = getInitialExtent();\n return calcDimIdx;\n };\n\n DataStore.prototype.collectOrdinalMeta = function (dimIdx, ordinalMeta) {\n var chunk = this._chunks[dimIdx];\n var dim = this._dimensions[dimIdx];\n var rawExtents = this._rawExtent;\n var offset = dim.ordinalOffset || 0;\n var len = chunk.length;\n\n if (offset === 0) {\n // We need to reset the rawExtent if collect is from start.\n // Because this dimension may be guessed as number and calcuating a wrong extent.\n rawExtents[dimIdx] = getInitialExtent();\n }\n\n var dimRawExtent = rawExtents[dimIdx]; // Parse from previous data offset. len may be changed after appendData\n\n for (var i = offset; i < len; i++) {\n var val = chunk[i] = ordinalMeta.parseAndCollect(chunk[i]);\n dimRawExtent[0] = Math.min(val, dimRawExtent[0]);\n dimRawExtent[1] = Math.max(val, dimRawExtent[1]);\n }\n\n dim.ordinalMeta = ordinalMeta;\n dim.ordinalOffset = len;\n dim.type = 'ordinal'; // Force to be ordinal\n };\n\n DataStore.prototype.getOrdinalMeta = function (dimIdx) {\n var dimInfo = this._dimensions[dimIdx];\n var ordinalMeta = dimInfo.ordinalMeta;\n return ordinalMeta;\n };\n\n DataStore.prototype.getDimensionProperty = function (dimIndex) {\n var item = this._dimensions[dimIndex];\n return item && item.property;\n };\n /**\n * Caution: Can be only called on raw data (before `this._indices` created).\n */\n\n\n DataStore.prototype.appendData = function (data) {\n if (process.env.NODE_ENV !== 'production') {\n assert(!this._indices, 'appendData can only be called on raw data.');\n }\n\n var provider = this._provider;\n var start = this.count();\n provider.appendData(data);\n var end = provider.count();\n\n if (!provider.persistent) {\n end += start;\n }\n\n if (start < end) {\n this._initDataFromProvider(start, end, true);\n }\n\n return [start, end];\n };\n\n DataStore.prototype.appendValues = function (values, minFillLen) {\n var chunks = this._chunks;\n var dimensions = this._dimensions;\n var dimLen = dimensions.length;\n var rawExtent = this._rawExtent;\n var start = this.count();\n var end = start + Math.max(values.length, minFillLen || 0);\n\n for (var i = 0; i < dimLen; i++) {\n var dim = dimensions[i];\n prepareStore(chunks, i, dim.type, end, true);\n }\n\n var emptyDataItem = [];\n\n for (var idx = start; idx < end; idx++) {\n var sourceIdx = idx - start; // Store the data by dimensions\n\n for (var dimIdx = 0; dimIdx < dimLen; dimIdx++) {\n var dim = dimensions[dimIdx];\n var val = defaultDimValueGetters.arrayRows.call(this, values[sourceIdx] || emptyDataItem, dim.property, sourceIdx, dimIdx);\n chunks[dimIdx][idx] = val;\n var dimRawExtent = rawExtent[dimIdx];\n val < dimRawExtent[0] && (dimRawExtent[0] = val);\n val > dimRawExtent[1] && (dimRawExtent[1] = val);\n }\n }\n\n this._rawCount = this._count = end;\n return {\n start: start,\n end: end\n };\n };\n\n DataStore.prototype._initDataFromProvider = function (start, end, append) {\n var provider = this._provider;\n var chunks = this._chunks;\n var dimensions = this._dimensions;\n var dimLen = dimensions.length;\n var rawExtent = this._rawExtent;\n var dimNames = map(dimensions, function (dim) {\n return dim.property;\n });\n\n for (var i = 0; i < dimLen; i++) {\n var dim = dimensions[i];\n\n if (!rawExtent[i]) {\n rawExtent[i] = getInitialExtent();\n }\n\n prepareStore(chunks, i, dim.type, end, append);\n }\n\n if (provider.fillStorage) {\n provider.fillStorage(start, end, chunks, rawExtent);\n } else {\n var dataItem = [];\n\n for (var idx = start; idx < end; idx++) {\n // NOTICE: Try not to write things into dataItem\n dataItem = provider.getItem(idx, dataItem); // Each data item is value\n // [1, 2]\n // 2\n // Bar chart, line chart which uses category axis\n // only gives the 'y' value. 'x' value is the indices of category\n // Use a tempValue to normalize the value to be a (x, y) value\n // Store the data by dimensions\n\n for (var dimIdx = 0; dimIdx < dimLen; dimIdx++) {\n var dimStorage = chunks[dimIdx]; // PENDING NULL is empty or zero\n\n var val = this._dimValueGetter(dataItem, dimNames[dimIdx], idx, dimIdx);\n\n dimStorage[idx] = val;\n var dimRawExtent = rawExtent[dimIdx];\n val < dimRawExtent[0] && (dimRawExtent[0] = val);\n val > dimRawExtent[1] && (dimRawExtent[1] = val);\n }\n }\n }\n\n if (!provider.persistent && provider.clean) {\n // Clean unused data if data source is typed array.\n provider.clean();\n }\n\n this._rawCount = this._count = end; // Reset data extent\n\n this._extent = [];\n };\n\n DataStore.prototype.count = function () {\n return this._count;\n };\n /**\n * Get value. Return NaN if idx is out of range.\n */\n\n\n DataStore.prototype.get = function (dim, idx) {\n if (!(idx >= 0 && idx < this._count)) {\n return NaN;\n }\n\n var dimStore = this._chunks[dim];\n return dimStore ? dimStore[this.getRawIndex(idx)] : NaN;\n };\n\n DataStore.prototype.getValues = function (dimensions, idx) {\n var values = [];\n var dimArr = [];\n\n if (idx == null) {\n idx = dimensions; // TODO get all from store?\n\n dimensions = []; // All dimensions\n\n for (var i = 0; i < this._dimensions.length; i++) {\n dimArr.push(i);\n }\n } else {\n dimArr = dimensions;\n }\n\n for (var i = 0, len = dimArr.length; i < len; i++) {\n values.push(this.get(dimArr[i], idx));\n }\n\n return values;\n };\n /**\n * @param dim concrete dim\n */\n\n\n DataStore.prototype.getByRawIndex = function (dim, rawIdx) {\n if (!(rawIdx >= 0 && rawIdx < this._rawCount)) {\n return NaN;\n }\n\n var dimStore = this._chunks[dim];\n return dimStore ? dimStore[rawIdx] : NaN;\n };\n /**\n * Get sum of data in one dimension\n */\n\n\n DataStore.prototype.getSum = function (dim) {\n var dimData = this._chunks[dim];\n var sum = 0;\n\n if (dimData) {\n for (var i = 0, len = this.count(); i < len; i++) {\n var value = this.get(dim, i);\n\n if (!isNaN(value)) {\n sum += value;\n }\n }\n }\n\n return sum;\n };\n /**\n * Get median of data in one dimension\n */\n\n\n DataStore.prototype.getMedian = function (dim) {\n var dimDataArray = []; // map all data of one dimension\n\n this.each([dim], function (val) {\n if (!isNaN(val)) {\n dimDataArray.push(val);\n }\n }); // TODO\n // Use quick select?\n\n var sortedDimDataArray = dimDataArray.sort(function (a, b) {\n return a - b;\n });\n var len = this.count(); // calculate median\n\n return len === 0 ? 0 : len % 2 === 1 ? sortedDimDataArray[(len - 1) / 2] : (sortedDimDataArray[len / 2] + sortedDimDataArray[len / 2 - 1]) / 2;\n };\n /**\n * Retreive the index with given raw data index\n */\n\n\n DataStore.prototype.indexOfRawIndex = function (rawIndex) {\n if (rawIndex >= this._rawCount || rawIndex < 0) {\n return -1;\n }\n\n if (!this._indices) {\n return rawIndex;\n } // Indices are ascending\n\n\n var indices = this._indices; // If rawIndex === dataIndex\n\n var rawDataIndex = indices[rawIndex];\n\n if (rawDataIndex != null && rawDataIndex < this._count && rawDataIndex === rawIndex) {\n return rawIndex;\n }\n\n var left = 0;\n var right = this._count - 1;\n\n while (left <= right) {\n var mid = (left + right) / 2 | 0;\n\n if (indices[mid] < rawIndex) {\n left = mid + 1;\n } else if (indices[mid] > rawIndex) {\n right = mid - 1;\n } else {\n return mid;\n }\n }\n\n return -1;\n };\n /**\n * Retreive the index of nearest value\n * @param dim\n * @param value\n * @param [maxDistance=Infinity]\n * @return If and only if multiple indices has\n * the same value, they are put to the result.\n */\n\n\n DataStore.prototype.indicesOfNearest = function (dim, value, maxDistance) {\n var chunks = this._chunks;\n var dimData = chunks[dim];\n var nearestIndices = [];\n\n if (!dimData) {\n return nearestIndices;\n }\n\n if (maxDistance == null) {\n maxDistance = Infinity;\n }\n\n var minDist = Infinity;\n var minDiff = -1;\n var nearestIndicesLen = 0; // Check the test case of `test/ut/spec/data/SeriesData.js`.\n\n for (var i = 0, len = this.count(); i < len; i++) {\n var dataIndex = this.getRawIndex(i);\n var diff = value - dimData[dataIndex];\n var dist = Math.abs(diff);\n\n if (dist <= maxDistance) {\n // When the `value` is at the middle of `this.get(dim, i)` and `this.get(dim, i+1)`,\n // we'd better not push both of them to `nearestIndices`, otherwise it is easy to\n // get more than one item in `nearestIndices` (more specifically, in `tooltip`).\n // So we chose the one that `diff >= 0` in this csae.\n // But if `this.get(dim, i)` and `this.get(dim, j)` get the same value, both of them\n // should be push to `nearestIndices`.\n if (dist < minDist || dist === minDist && diff >= 0 && minDiff < 0) {\n minDist = dist;\n minDiff = diff;\n nearestIndicesLen = 0;\n }\n\n if (diff === minDiff) {\n nearestIndices[nearestIndicesLen++] = i;\n }\n }\n }\n\n nearestIndices.length = nearestIndicesLen;\n return nearestIndices;\n };\n\n DataStore.prototype.getIndices = function () {\n var newIndices;\n var indices = this._indices;\n\n if (indices) {\n var Ctor = indices.constructor;\n var thisCount = this._count; // `new Array(a, b, c)` is different from `new Uint32Array(a, b, c)`.\n\n if (Ctor === Array) {\n newIndices = new Ctor(thisCount);\n\n for (var i = 0; i < thisCount; i++) {\n newIndices[i] = indices[i];\n }\n } else {\n newIndices = new Ctor(indices.buffer, 0, thisCount);\n }\n } else {\n var Ctor = getIndicesCtor(this._rawCount);\n newIndices = new Ctor(this.count());\n\n for (var i = 0; i < newIndices.length; i++) {\n newIndices[i] = i;\n }\n }\n\n return newIndices;\n };\n /**\n * Data filter.\n */\n\n\n DataStore.prototype.filter = function (dims, cb) {\n if (!this._count) {\n return this;\n }\n\n var newStore = this.clone();\n var count = newStore.count();\n var Ctor = getIndicesCtor(newStore._rawCount);\n var newIndices = new Ctor(count);\n var value = [];\n var dimSize = dims.length;\n var offset = 0;\n var dim0 = dims[0];\n var chunks = newStore._chunks;\n\n for (var i = 0; i < count; i++) {\n var keep = void 0;\n var rawIdx = newStore.getRawIndex(i); // Simple optimization\n\n if (dimSize === 0) {\n keep = cb(i);\n } else if (dimSize === 1) {\n var val = chunks[dim0][rawIdx];\n keep = cb(val, i);\n } else {\n var k = 0;\n\n for (; k < dimSize; k++) {\n value[k] = chunks[dims[k]][rawIdx];\n }\n\n value[k] = i;\n keep = cb.apply(null, value);\n }\n\n if (keep) {\n newIndices[offset++] = rawIdx;\n }\n } // Set indices after filtered.\n\n\n if (offset < count) {\n newStore._indices = newIndices;\n }\n\n newStore._count = offset; // Reset data extent\n\n newStore._extent = [];\n\n newStore._updateGetRawIdx();\n\n return newStore;\n };\n /**\n * Select data in range. (For optimization of filter)\n * (Manually inline code, support 5 million data filtering in data zoom.)\n */\n\n\n DataStore.prototype.selectRange = function (range) {\n var newStore = this.clone();\n var len = newStore._count;\n\n if (!len) {\n return this;\n }\n\n var dims = keys(range);\n var dimSize = dims.length;\n\n if (!dimSize) {\n return this;\n }\n\n var originalCount = newStore.count();\n var Ctor = getIndicesCtor(newStore._rawCount);\n var newIndices = new Ctor(originalCount);\n var offset = 0;\n var dim0 = dims[0];\n var min = range[dim0][0];\n var max = range[dim0][1];\n var storeArr = newStore._chunks;\n var quickFinished = false;\n\n if (!newStore._indices) {\n // Extreme optimization for common case. About 2x faster in chrome.\n var idx = 0;\n\n if (dimSize === 1) {\n var dimStorage = storeArr[dims[0]];\n\n for (var i = 0; i < len; i++) {\n var val = dimStorage[i]; // NaN will not be filtered. Consider the case, in line chart, empty\n // value indicates the line should be broken. But for the case like\n // scatter plot, a data item with empty value will not be rendered,\n // but the axis extent may be effected if some other dim of the data\n // item has value. Fortunately it is not a significant negative effect.\n\n if (val >= min && val <= max || isNaN(val)) {\n newIndices[offset++] = idx;\n }\n\n idx++;\n }\n\n quickFinished = true;\n } else if (dimSize === 2) {\n var dimStorage = storeArr[dims[0]];\n var dimStorage2 = storeArr[dims[1]];\n var min2 = range[dims[1]][0];\n var max2 = range[dims[1]][1];\n\n for (var i = 0; i < len; i++) {\n var val = dimStorage[i];\n var val2 = dimStorage2[i]; // Do not filter NaN, see comment above.\n\n if ((val >= min && val <= max || isNaN(val)) && (val2 >= min2 && val2 <= max2 || isNaN(val2))) {\n newIndices[offset++] = idx;\n }\n\n idx++;\n }\n\n quickFinished = true;\n }\n }\n\n if (!quickFinished) {\n if (dimSize === 1) {\n for (var i = 0; i < originalCount; i++) {\n var rawIndex = newStore.getRawIndex(i);\n var val = storeArr[dims[0]][rawIndex]; // Do not filter NaN, see comment above.\n\n if (val >= min && val <= max || isNaN(val)) {\n newIndices[offset++] = rawIndex;\n }\n }\n } else {\n for (var i = 0; i < originalCount; i++) {\n var keep = true;\n var rawIndex = newStore.getRawIndex(i);\n\n for (var k = 0; k < dimSize; k++) {\n var dimk = dims[k];\n var val = storeArr[dimk][rawIndex]; // Do not filter NaN, see comment above.\n\n if (val < range[dimk][0] || val > range[dimk][1]) {\n keep = false;\n }\n }\n\n if (keep) {\n newIndices[offset++] = newStore.getRawIndex(i);\n }\n }\n }\n } // Set indices after filtered.\n\n\n if (offset < originalCount) {\n newStore._indices = newIndices;\n }\n\n newStore._count = offset; // Reset data extent\n\n newStore._extent = [];\n\n newStore._updateGetRawIdx();\n\n return newStore;\n }; // /**\n // * Data mapping to a plain array\n // */\n // mapArray(dims: DimensionIndex[], cb: MapArrayCb): any[] {\n // const result: any[] = [];\n // this.each(dims, function () {\n // result.push(cb && (cb as MapArrayCb).apply(null, arguments));\n // });\n // return result;\n // }\n\n /**\n * Data mapping to a new List with given dimensions\n */\n\n\n DataStore.prototype.map = function (dims, cb) {\n // TODO only clone picked chunks.\n var target = this.clone(dims);\n\n this._updateDims(target, dims, cb);\n\n return target;\n };\n /**\n * @caution Danger!! Only used in dataStack.\n */\n\n\n DataStore.prototype.modify = function (dims, cb) {\n this._updateDims(this, dims, cb);\n };\n\n DataStore.prototype._updateDims = function (target, dims, cb) {\n var targetChunks = target._chunks;\n var tmpRetValue = [];\n var dimSize = dims.length;\n var dataCount = target.count();\n var values = [];\n var rawExtent = target._rawExtent;\n\n for (var i = 0; i < dims.length; i++) {\n rawExtent[dims[i]] = getInitialExtent();\n }\n\n for (var dataIndex = 0; dataIndex < dataCount; dataIndex++) {\n var rawIndex = target.getRawIndex(dataIndex);\n\n for (var k = 0; k < dimSize; k++) {\n values[k] = targetChunks[dims[k]][rawIndex];\n }\n\n values[dimSize] = dataIndex;\n var retValue = cb && cb.apply(null, values);\n\n if (retValue != null) {\n // a number or string (in oridinal dimension)?\n if (typeof retValue !== 'object') {\n tmpRetValue[0] = retValue;\n retValue = tmpRetValue;\n }\n\n for (var i = 0; i < retValue.length; i++) {\n var dim = dims[i];\n var val = retValue[i];\n var rawExtentOnDim = rawExtent[dim];\n var dimStore = targetChunks[dim];\n\n if (dimStore) {\n dimStore[rawIndex] = val;\n }\n\n if (val < rawExtentOnDim[0]) {\n rawExtentOnDim[0] = val;\n }\n\n if (val > rawExtentOnDim[1]) {\n rawExtentOnDim[1] = val;\n }\n }\n }\n }\n };\n /**\n * Large data down sampling using largest-triangle-three-buckets\n * @param {string} valueDimension\n * @param {number} targetCount\n */\n\n\n DataStore.prototype.lttbDownSample = function (valueDimension, rate) {\n var target = this.clone([valueDimension], true);\n var targetStorage = target._chunks;\n var dimStore = targetStorage[valueDimension];\n var len = this.count();\n var sampledIndex = 0;\n var frameSize = Math.floor(1 / rate);\n var currentRawIndex = this.getRawIndex(0);\n var maxArea;\n var area;\n var nextRawIndex;\n var newIndices = new (getIndicesCtor(this._rawCount))(Math.ceil(len / frameSize) + 2); // First frame use the first data.\n\n newIndices[sampledIndex++] = currentRawIndex;\n\n for (var i = 1; i < len - 1; i += frameSize) {\n var nextFrameStart = Math.min(i + frameSize, len - 1);\n var nextFrameEnd = Math.min(i + frameSize * 2, len);\n var avgX = (nextFrameEnd + nextFrameStart) / 2;\n var avgY = 0;\n\n for (var idx = nextFrameStart; idx < nextFrameEnd; idx++) {\n var rawIndex = this.getRawIndex(idx);\n var y = dimStore[rawIndex];\n\n if (isNaN(y)) {\n continue;\n }\n\n avgY += y;\n }\n\n avgY /= nextFrameEnd - nextFrameStart;\n var frameStart = i;\n var frameEnd = Math.min(i + frameSize, len);\n var pointAX = i - 1;\n var pointAY = dimStore[currentRawIndex];\n maxArea = -1;\n nextRawIndex = frameStart; // Find a point from current frame that construct a triangel with largest area with previous selected point\n // And the average of next frame.\n\n for (var idx = frameStart; idx < frameEnd; idx++) {\n var rawIndex = this.getRawIndex(idx);\n var y = dimStore[rawIndex];\n\n if (isNaN(y)) {\n continue;\n } // Calculate triangle area over three buckets\n\n\n area = Math.abs((pointAX - avgX) * (y - pointAY) - (pointAX - idx) * (avgY - pointAY));\n\n if (area > maxArea) {\n maxArea = area;\n nextRawIndex = rawIndex; // Next a is this b\n }\n }\n\n newIndices[sampledIndex++] = nextRawIndex;\n currentRawIndex = nextRawIndex; // This a is the next a (chosen b)\n } // First frame use the last data.\n\n\n newIndices[sampledIndex++] = this.getRawIndex(len - 1);\n target._count = sampledIndex;\n target._indices = newIndices;\n target.getRawIndex = this._getRawIdx;\n return target;\n };\n /**\n * Large data down sampling on given dimension\n * @param sampleIndex Sample index for name and id\n */\n\n\n DataStore.prototype.downSample = function (dimension, rate, sampleValue, sampleIndex) {\n var target = this.clone([dimension], true);\n var targetStorage = target._chunks;\n var frameValues = [];\n var frameSize = Math.floor(1 / rate);\n var dimStore = targetStorage[dimension];\n var len = this.count();\n var rawExtentOnDim = target._rawExtent[dimension] = getInitialExtent();\n var newIndices = new (getIndicesCtor(this._rawCount))(Math.ceil(len / frameSize));\n var offset = 0;\n\n for (var i = 0; i < len; i += frameSize) {\n // Last frame\n if (frameSize > len - i) {\n frameSize = len - i;\n frameValues.length = frameSize;\n }\n\n for (var k = 0; k < frameSize; k++) {\n var dataIdx = this.getRawIndex(i + k);\n frameValues[k] = dimStore[dataIdx];\n }\n\n var value = sampleValue(frameValues);\n var sampleFrameIdx = this.getRawIndex(Math.min(i + sampleIndex(frameValues, value) || 0, len - 1)); // Only write value on the filtered data\n\n dimStore[sampleFrameIdx] = value;\n\n if (value < rawExtentOnDim[0]) {\n rawExtentOnDim[0] = value;\n }\n\n if (value > rawExtentOnDim[1]) {\n rawExtentOnDim[1] = value;\n }\n\n newIndices[offset++] = sampleFrameIdx;\n }\n\n target._count = offset;\n target._indices = newIndices;\n\n target._updateGetRawIdx();\n\n return target;\n };\n /**\n * Data iteration\n * @param ctx default this\n * @example\n * list.each('x', function (x, idx) {});\n * list.each(['x', 'y'], function (x, y, idx) {});\n * list.each(function (idx) {})\n */\n\n\n DataStore.prototype.each = function (dims, cb) {\n if (!this._count) {\n return;\n }\n\n var dimSize = dims.length;\n var chunks = this._chunks;\n\n for (var i = 0, len = this.count(); i < len; i++) {\n var rawIdx = this.getRawIndex(i); // Simple optimization\n\n switch (dimSize) {\n case 0:\n cb(i);\n break;\n\n case 1:\n cb(chunks[dims[0]][rawIdx], i);\n break;\n\n case 2:\n cb(chunks[dims[0]][rawIdx], chunks[dims[1]][rawIdx], i);\n break;\n\n default:\n var k = 0;\n var value = [];\n\n for (; k < dimSize; k++) {\n value[k] = chunks[dims[k]][rawIdx];\n } // Index\n\n\n value[k] = i;\n cb.apply(null, value);\n }\n }\n };\n /**\n * Get extent of data in one dimension\n */\n\n\n DataStore.prototype.getDataExtent = function (dim) {\n // Make sure use concrete dim as cache name.\n var dimData = this._chunks[dim];\n var initialExtent = getInitialExtent();\n\n if (!dimData) {\n return initialExtent;\n } // Make more strict checkings to ensure hitting cache.\n\n\n var currEnd = this.count(); // Consider the most cases when using data zoom, `getDataExtent`\n // happened before filtering. We cache raw extent, which is not\n // necessary to be cleared and recalculated when restore data.\n\n var useRaw = !this._indices;\n var dimExtent;\n\n if (useRaw) {\n return this._rawExtent[dim].slice();\n }\n\n dimExtent = this._extent[dim];\n\n if (dimExtent) {\n return dimExtent.slice();\n }\n\n dimExtent = initialExtent;\n var min = dimExtent[0];\n var max = dimExtent[1];\n\n for (var i = 0; i < currEnd; i++) {\n var rawIdx = this.getRawIndex(i);\n var value = dimData[rawIdx];\n value < min && (min = value);\n value > max && (max = value);\n }\n\n dimExtent = [min, max];\n this._extent[dim] = dimExtent;\n return dimExtent;\n };\n /**\n * Get raw data item\n */\n\n\n DataStore.prototype.getRawDataItem = function (idx) {\n var rawIdx = this.getRawIndex(idx);\n\n if (!this._provider.persistent) {\n var val = [];\n var chunks = this._chunks;\n\n for (var i = 0; i < chunks.length; i++) {\n val.push(chunks[i][rawIdx]);\n }\n\n return val;\n } else {\n return this._provider.getItem(rawIdx);\n }\n };\n /**\n * Clone shallow.\n *\n * @param clonedDims Determine which dims to clone. Will share the data if not specified.\n */\n\n\n DataStore.prototype.clone = function (clonedDims, ignoreIndices) {\n var target = new DataStore();\n var chunks = this._chunks;\n var clonedDimsMap = clonedDims && reduce(clonedDims, function (obj, dimIdx) {\n obj[dimIdx] = true;\n return obj;\n }, {});\n\n if (clonedDimsMap) {\n for (var i = 0; i < chunks.length; i++) {\n // Not clone if dim is not picked.\n target._chunks[i] = !clonedDimsMap[i] ? chunks[i] : cloneChunk(chunks[i]);\n }\n } else {\n target._chunks = chunks;\n }\n\n this._copyCommonProps(target);\n\n if (!ignoreIndices) {\n target._indices = this._cloneIndices();\n }\n\n target._updateGetRawIdx();\n\n return target;\n };\n\n DataStore.prototype._copyCommonProps = function (target) {\n target._count = this._count;\n target._rawCount = this._rawCount;\n target._provider = this._provider;\n target._dimensions = this._dimensions;\n target._extent = clone(this._extent);\n target._rawExtent = clone(this._rawExtent);\n };\n\n DataStore.prototype._cloneIndices = function () {\n if (this._indices) {\n var Ctor = this._indices.constructor;\n var indices = void 0;\n\n if (Ctor === Array) {\n var thisCount = this._indices.length;\n indices = new Ctor(thisCount);\n\n for (var i = 0; i < thisCount; i++) {\n indices[i] = this._indices[i];\n }\n } else {\n indices = new Ctor(this._indices);\n }\n\n return indices;\n }\n\n return null;\n };\n\n DataStore.prototype._getRawIdxIdentity = function (idx) {\n return idx;\n };\n\n DataStore.prototype._getRawIdx = function (idx) {\n if (idx < this._count && idx >= 0) {\n return this._indices[idx];\n }\n\n return -1;\n };\n\n DataStore.prototype._updateGetRawIdx = function () {\n this.getRawIndex = this._indices ? this._getRawIdx : this._getRawIdxIdentity;\n };\n\n DataStore.internalField = function () {\n function getDimValueSimply(dataItem, property, dataIndex, dimIndex) {\n return parseDataValue(dataItem[dimIndex], this._dimensions[dimIndex]);\n }\n\n defaultDimValueGetters = {\n arrayRows: getDimValueSimply,\n objectRows: function (dataItem, property, dataIndex, dimIndex) {\n return parseDataValue(dataItem[property], this._dimensions[dimIndex]);\n },\n keyedColumns: getDimValueSimply,\n original: function (dataItem, property, dataIndex, dimIndex) {\n // Performance sensitive, do not use modelUtil.getDataItemValue.\n // If dataItem is an plain object with no value field, the let `value`\n // will be assigned with the object, but it will be tread correctly\n // in the `convertValue`.\n var value = dataItem && (dataItem.value == null ? dataItem : dataItem.value);\n return parseDataValue(value instanceof Array ? value[dimIndex] // If value is a single number or something else not array.\n : value, this._dimensions[dimIndex]);\n },\n typedArray: function (dataItem, property, dataIndex, dimIndex) {\n return dataItem[dimIndex];\n }\n };\n }();\n\n return DataStore;\n}();\n\nexport default DataStore;","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { setAsPrimitive, map, isTypedArray, assert, each, retrieve2 } from 'zrender/lib/core/util.js';\nimport { createSource, cloneSourceShallow } from '../Source.js';\nimport { SOURCE_FORMAT_TYPED_ARRAY, SOURCE_FORMAT_ORIGINAL } from '../../util/types.js';\nimport { querySeriesUpstreamDatasetModel, queryDatasetUpstreamDatasetModels } from './sourceHelper.js';\nimport { applyDataTransform } from './transform.js';\nimport DataStore from '../DataStore.js';\nimport { DefaultDataProvider } from './dataProvider.js';\n/**\n * [REQUIREMENT_MEMO]:\n * (0) `metaRawOption` means `dimensions`/`sourceHeader`/`seriesLayoutBy` in raw option.\n * (1) Keep support the feature: `metaRawOption` can be specified both on `series` and\n * `root-dataset`. Them on `series` has higher priority.\n * (2) Do not support to set `metaRawOption` on a `non-root-dataset`, because it might\n * confuse users: whether those props indicate how to visit the upstream source or visit\n * the transform result source, and some transforms has nothing to do with these props,\n * and some transforms might have multiple upstream.\n * (3) Transforms should specify `metaRawOption` in each output, just like they can be\n * declared in `root-dataset`.\n * (4) At present only support visit source in `SERIES_LAYOUT_BY_COLUMN` in transforms.\n * That is for reducing complexity in transfroms.\n * PENDING: Whether to provide transposition transform?\n *\n * [IMPLEMENTAION_MEMO]:\n * \"sourceVisitConfig\" are calculated from `metaRawOption` and `data`.\n * They will not be calculated until `source` is about to be visited (to prevent from\n * duplicate calcuation). `source` is visited only in series and input to transforms.\n *\n * [DIMENSION_INHERIT_RULE]:\n * By default the dimensions are inherited from ancestors, unless a transform return\n * a new dimensions definition.\n * Consider the case:\n * ```js\n * dataset: [{\n * source: [ ['Product', 'Sales', 'Prise'], ['Cookies', 321, 44.21], ...]\n * }, {\n * transform: { type: 'filter', ... }\n * }]\n * dataset: [{\n * dimension: ['Product', 'Sales', 'Prise'],\n * source: [ ['Cookies', 321, 44.21], ...]\n * }, {\n * transform: { type: 'filter', ... }\n * }]\n * ```\n * The two types of option should have the same behavior after transform.\n *\n *\n * [SCENARIO]:\n * (1) Provide source data directly:\n * ```js\n * series: {\n * encode: {...},\n * dimensions: [...]\n * seriesLayoutBy: 'row',\n * data: [[...]]\n * }\n * ```\n * (2) Series refer to dataset.\n * ```js\n * series: [{\n * encode: {...}\n * // Ignore datasetIndex means `datasetIndex: 0`\n * // and the dimensions defination in dataset is used\n * }, {\n * encode: {...},\n * seriesLayoutBy: 'column',\n * datasetIndex: 1\n * }]\n * ```\n * (3) dataset transform\n * ```js\n * dataset: [{\n * source: [...]\n * }, {\n * source: [...]\n * }, {\n * // By default from 0.\n * transform: { type: 'filter', config: {...} }\n * }, {\n * // Piped.\n * transform: [\n * { type: 'filter', config: {...} },\n * { type: 'sort', config: {...} }\n * ]\n * }, {\n * id: 'regressionData',\n * fromDatasetIndex: 1,\n * // Third-party transform\n * transform: { type: 'ecStat:regression', config: {...} }\n * }, {\n * // retrieve the extra result.\n * id: 'regressionFormula',\n * fromDatasetId: 'regressionData',\n * fromTransformResult: 1\n * }]\n * ```\n */\n\nvar SourceManager =\n/** @class */\nfunction () {\n function SourceManager(sourceHost) {\n // Cached source. Do not repeat calculating if not dirty.\n this._sourceList = [];\n this._storeList = []; // version sign of each upstream source manager.\n\n this._upstreamSignList = [];\n this._versionSignBase = 0;\n this._dirty = true;\n this._sourceHost = sourceHost;\n }\n /**\n * Mark dirty.\n */\n\n\n SourceManager.prototype.dirty = function () {\n this._setLocalSource([], []);\n\n this._storeList = [];\n this._dirty = true;\n };\n\n SourceManager.prototype._setLocalSource = function (sourceList, upstreamSignList) {\n this._sourceList = sourceList;\n this._upstreamSignList = upstreamSignList;\n this._versionSignBase++;\n\n if (this._versionSignBase > 9e10) {\n this._versionSignBase = 0;\n }\n };\n /**\n * For detecting whether the upstream source is dirty, so that\n * the local cached source (in `_sourceList`) should be discarded.\n */\n\n\n SourceManager.prototype._getVersionSign = function () {\n return this._sourceHost.uid + '_' + this._versionSignBase;\n };\n /**\n * Always return a source instance. Otherwise throw error.\n */\n\n\n SourceManager.prototype.prepareSource = function () {\n // For the case that call `setOption` multiple time but no data changed,\n // cache the result source to prevent from repeating transform.\n if (this._isDirty()) {\n this._createSource();\n\n this._dirty = false;\n }\n };\n\n SourceManager.prototype._createSource = function () {\n this._setLocalSource([], []);\n\n var sourceHost = this._sourceHost;\n\n var upSourceMgrList = this._getUpstreamSourceManagers();\n\n var hasUpstream = !!upSourceMgrList.length;\n var resultSourceList;\n var upstreamSignList;\n\n if (isSeries(sourceHost)) {\n var seriesModel = sourceHost;\n var data = void 0;\n var sourceFormat = void 0;\n var upSource = void 0; // Has upstream dataset\n\n if (hasUpstream) {\n var upSourceMgr = upSourceMgrList[0];\n upSourceMgr.prepareSource();\n upSource = upSourceMgr.getSource();\n data = upSource.data;\n sourceFormat = upSource.sourceFormat;\n upstreamSignList = [upSourceMgr._getVersionSign()];\n } // Series data is from own.\n else {\n data = seriesModel.get('data', true);\n sourceFormat = isTypedArray(data) ? SOURCE_FORMAT_TYPED_ARRAY : SOURCE_FORMAT_ORIGINAL;\n upstreamSignList = [];\n } // See [REQUIREMENT_MEMO], merge settings on series and parent dataset if it is root.\n\n\n var newMetaRawOption = this._getSourceMetaRawOption() || {};\n var upMetaRawOption = upSource && upSource.metaRawOption || {};\n var seriesLayoutBy = retrieve2(newMetaRawOption.seriesLayoutBy, upMetaRawOption.seriesLayoutBy) || null;\n var sourceHeader = retrieve2(newMetaRawOption.sourceHeader, upMetaRawOption.sourceHeader); // Note here we should not use `upSource.dimensionsDefine`. Consider the case:\n // `upSource.dimensionsDefine` is detected by `seriesLayoutBy: 'column'`,\n // but series need `seriesLayoutBy: 'row'`.\n\n var dimensions = retrieve2(newMetaRawOption.dimensions, upMetaRawOption.dimensions); // We share source with dataset as much as possible\n // to avoid extra memroy cost of high dimensional data.\n\n var needsCreateSource = seriesLayoutBy !== upMetaRawOption.seriesLayoutBy || !!sourceHeader !== !!upMetaRawOption.sourceHeader || dimensions;\n resultSourceList = needsCreateSource ? [createSource(data, {\n seriesLayoutBy: seriesLayoutBy,\n sourceHeader: sourceHeader,\n dimensions: dimensions\n }, sourceFormat)] : [];\n } else {\n var datasetModel = sourceHost; // Has upstream dataset.\n\n if (hasUpstream) {\n var result = this._applyTransform(upSourceMgrList);\n\n resultSourceList = result.sourceList;\n upstreamSignList = result.upstreamSignList;\n } // Is root dataset.\n else {\n var sourceData = datasetModel.get('source', true);\n resultSourceList = [createSource(sourceData, this._getSourceMetaRawOption(), null)];\n upstreamSignList = [];\n }\n }\n\n if (process.env.NODE_ENV !== 'production') {\n assert(resultSourceList && upstreamSignList);\n }\n\n this._setLocalSource(resultSourceList, upstreamSignList);\n };\n\n SourceManager.prototype._applyTransform = function (upMgrList) {\n var datasetModel = this._sourceHost;\n var transformOption = datasetModel.get('transform', true);\n var fromTransformResult = datasetModel.get('fromTransformResult', true);\n\n if (process.env.NODE_ENV !== 'production') {\n assert(fromTransformResult != null || transformOption != null);\n }\n\n if (fromTransformResult != null) {\n var errMsg = '';\n\n if (upMgrList.length !== 1) {\n if (process.env.NODE_ENV !== 'production') {\n errMsg = 'When using `fromTransformResult`, there should be only one upstream dataset';\n }\n\n doThrow(errMsg);\n }\n }\n\n var sourceList;\n var upSourceList = [];\n var upstreamSignList = [];\n each(upMgrList, function (upMgr) {\n upMgr.prepareSource();\n var upSource = upMgr.getSource(fromTransformResult || 0);\n var errMsg = '';\n\n if (fromTransformResult != null && !upSource) {\n if (process.env.NODE_ENV !== 'production') {\n errMsg = 'Can not retrieve result by `fromTransformResult`: ' + fromTransformResult;\n }\n\n doThrow(errMsg);\n }\n\n upSourceList.push(upSource);\n upstreamSignList.push(upMgr._getVersionSign());\n });\n\n if (transformOption) {\n sourceList = applyDataTransform(transformOption, upSourceList, {\n datasetIndex: datasetModel.componentIndex\n });\n } else if (fromTransformResult != null) {\n sourceList = [cloneSourceShallow(upSourceList[0])];\n }\n\n return {\n sourceList: sourceList,\n upstreamSignList: upstreamSignList\n };\n };\n\n SourceManager.prototype._isDirty = function () {\n if (this._dirty) {\n return true;\n } // All sourceList is from the some upsteam.\n\n\n var upSourceMgrList = this._getUpstreamSourceManagers();\n\n for (var i = 0; i < upSourceMgrList.length; i++) {\n var upSrcMgr = upSourceMgrList[i];\n\n if ( // Consider the case that there is ancestor diry, call it recursively.\n // The performance is probably not an issue because usually the chain is not long.\n upSrcMgr._isDirty() || this._upstreamSignList[i] !== upSrcMgr._getVersionSign()) {\n return true;\n }\n }\n };\n /**\n * @param sourceIndex By defualt 0, means \"main source\".\n * Most cases there is only one source.\n */\n\n\n SourceManager.prototype.getSource = function (sourceIndex) {\n sourceIndex = sourceIndex || 0;\n var source = this._sourceList[sourceIndex];\n\n if (!source) {\n // Series may share source instance with dataset.\n var upSourceMgrList = this._getUpstreamSourceManagers();\n\n return upSourceMgrList[0] && upSourceMgrList[0].getSource(sourceIndex);\n }\n\n return source;\n };\n /**\n *\n * Get a data store which can be shared across series.\n * Only available for series.\n *\n * @param seriesDimRequest Dimensions that are generated in series.\n * Should have been sorted by `storeDimIndex` asc.\n */\n\n\n SourceManager.prototype.getSharedDataStore = function (seriesDimRequest) {\n if (process.env.NODE_ENV !== 'production') {\n assert(isSeries(this._sourceHost), 'Can only call getDataStore on series source manager.');\n }\n\n var schema = seriesDimRequest.makeStoreSchema();\n return this._innerGetDataStore(schema.dimensions, seriesDimRequest.source, schema.hash);\n };\n\n SourceManager.prototype._innerGetDataStore = function (storeDims, seriesSource, sourceReadKey) {\n // TODO Can use other sourceIndex?\n var sourceIndex = 0;\n var storeList = this._storeList;\n var cachedStoreMap = storeList[sourceIndex];\n\n if (!cachedStoreMap) {\n cachedStoreMap = storeList[sourceIndex] = {};\n }\n\n var cachedStore = cachedStoreMap[sourceReadKey];\n\n if (!cachedStore) {\n var upSourceMgr = this._getUpstreamSourceManagers()[0];\n\n if (isSeries(this._sourceHost) && upSourceMgr) {\n cachedStore = upSourceMgr._innerGetDataStore(storeDims, seriesSource, sourceReadKey);\n } else {\n cachedStore = new DataStore(); // Always create store from source of series.\n\n cachedStore.initData(new DefaultDataProvider(seriesSource, storeDims.length), storeDims);\n }\n\n cachedStoreMap[sourceReadKey] = cachedStore;\n }\n\n return cachedStore;\n };\n /**\n * PEDING: Is it fast enough?\n * If no upstream, return empty array.\n */\n\n\n SourceManager.prototype._getUpstreamSourceManagers = function () {\n // Always get the relationship from the raw option.\n // Do not cache the link of the dependency graph, so that\n // no need to update them when change happen.\n var sourceHost = this._sourceHost;\n\n if (isSeries(sourceHost)) {\n var datasetModel = querySeriesUpstreamDatasetModel(sourceHost);\n return !datasetModel ? [] : [datasetModel.getSourceManager()];\n } else {\n return map(queryDatasetUpstreamDatasetModels(sourceHost), function (datasetModel) {\n return datasetModel.getSourceManager();\n });\n }\n };\n\n SourceManager.prototype._getSourceMetaRawOption = function () {\n var sourceHost = this._sourceHost;\n var seriesLayoutBy;\n var sourceHeader;\n var dimensions;\n\n if (isSeries(sourceHost)) {\n seriesLayoutBy = sourceHost.get('seriesLayoutBy', true);\n sourceHeader = sourceHost.get('sourceHeader', true);\n dimensions = sourceHost.get('dimensions', true);\n } // See [REQUIREMENT_MEMO], `non-root-dataset` do not support them.\n else if (!this._getUpstreamSourceManagers().length) {\n var model = sourceHost;\n seriesLayoutBy = model.get('seriesLayoutBy', true);\n sourceHeader = model.get('sourceHeader', true);\n dimensions = model.get('dimensions', true);\n }\n\n return {\n seriesLayoutBy: seriesLayoutBy,\n sourceHeader: sourceHeader,\n dimensions: dimensions\n };\n };\n\n return SourceManager;\n}();\n\nexport { SourceManager }; // Call this method after `super.init` and `super.mergeOption` to\n// disable the transform merge, but do not disable transfrom clone from rawOption.\n\nexport function disableTransformOptionMerge(datasetModel) {\n var transformOption = datasetModel.option.transform;\n transformOption && setAsPrimitive(datasetModel.option.transform);\n}\n\nfunction isSeries(sourceHost) {\n // Avoid circular dependency with Series.ts\n return sourceHost.mainType === 'series';\n}\n\nfunction doThrow(errMsg) {\n throw new Error(errMsg);\n}","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { getTooltipMarker, encodeHTML, makeValueReadable, convertToColorString } from '../../util/format.js';\nimport { isString, each, hasOwn, isArray, map, assert, extend } from 'zrender/lib/core/util.js';\nimport { SortOrderComparator } from '../../data/helper/dataValueHelper.js';\nimport { getRandomIdBase } from '../../util/number.js';\nvar TOOLTIP_LINE_HEIGHT_CSS = 'line-height:1'; // TODO: more textStyle option\n\nfunction getTooltipTextStyle(textStyle, renderMode) {\n var nameFontColor = textStyle.color || '#6e7079';\n var nameFontSize = textStyle.fontSize || 12;\n var nameFontWeight = textStyle.fontWeight || '400';\n var valueFontColor = textStyle.color || '#464646';\n var valueFontSize = textStyle.fontSize || 14;\n var valueFontWeight = textStyle.fontWeight || '900';\n\n if (renderMode === 'html') {\n // `textStyle` is probably from user input, should be encoded to reduce security risk.\n return {\n // eslint-disable-next-line max-len\n nameStyle: \"font-size:\" + encodeHTML(nameFontSize + '') + \"px;color:\" + encodeHTML(nameFontColor) + \";font-weight:\" + encodeHTML(nameFontWeight + ''),\n // eslint-disable-next-line max-len\n valueStyle: \"font-size:\" + encodeHTML(valueFontSize + '') + \"px;color:\" + encodeHTML(valueFontColor) + \";font-weight:\" + encodeHTML(valueFontWeight + '')\n };\n } else {\n return {\n nameStyle: {\n fontSize: nameFontSize,\n fill: nameFontColor,\n fontWeight: nameFontWeight\n },\n valueStyle: {\n fontSize: valueFontSize,\n fill: valueFontColor,\n fontWeight: valueFontWeight\n }\n };\n }\n} // See `TooltipMarkupLayoutIntent['innerGapLevel']`.\n// (value from UI design)\n\n\nvar HTML_GAPS = [0, 10, 20, 30];\nvar RICH_TEXT_GAPS = ['', '\\n', '\\n\\n', '\\n\\n\\n']; // eslint-disable-next-line max-len\n\nexport function createTooltipMarkup(type, option) {\n option.type = type;\n return option;\n}\n\nfunction isSectionFragment(frag) {\n return frag.type === 'section';\n}\n\nfunction getBuilder(frag) {\n return isSectionFragment(frag) ? buildSection : buildNameValue;\n}\n\nfunction getBlockGapLevel(frag) {\n if (isSectionFragment(frag)) {\n var gapLevel_1 = 0;\n var subBlockLen = frag.blocks.length;\n var hasInnerGap_1 = subBlockLen > 1 || subBlockLen > 0 && !frag.noHeader;\n each(frag.blocks, function (subBlock) {\n var subGapLevel = getBlockGapLevel(subBlock); // If the some of the sub-blocks have some gaps (like 10px) inside, this block\n // should use a larger gap (like 20px) to distinguish those sub-blocks.\n\n if (subGapLevel >= gapLevel_1) {\n gapLevel_1 = subGapLevel + +(hasInnerGap_1 && ( // 0 always can not be readable gap level.\n !subGapLevel // If no header, always keep the sub gap level. Otherwise\n // look weird in case `multipleSeries`.\n || isSectionFragment(subBlock) && !subBlock.noHeader));\n }\n });\n return gapLevel_1;\n }\n\n return 0;\n}\n\nfunction buildSection(ctx, fragment, topMarginForOuterGap, toolTipTextStyle) {\n var noHeader = fragment.noHeader;\n var gaps = getGap(getBlockGapLevel(fragment));\n var subMarkupTextList = [];\n var subBlocks = fragment.blocks || [];\n assert(!subBlocks || isArray(subBlocks));\n subBlocks = subBlocks || [];\n var orderMode = ctx.orderMode;\n\n if (fragment.sortBlocks && orderMode) {\n subBlocks = subBlocks.slice();\n var orderMap = {\n valueAsc: 'asc',\n valueDesc: 'desc'\n };\n\n if (hasOwn(orderMap, orderMode)) {\n var comparator_1 = new SortOrderComparator(orderMap[orderMode], null);\n subBlocks.sort(function (a, b) {\n return comparator_1.evaluate(a.sortParam, b.sortParam);\n });\n } // FIXME 'seriesDesc' necessary?\n else if (orderMode === 'seriesDesc') {\n subBlocks.reverse();\n }\n }\n\n each(subBlocks, function (subBlock, idx) {\n var valueFormatter = fragment.valueFormatter;\n var subMarkupText = getBuilder(subBlock)( // Inherit valueFormatter\n valueFormatter ? extend(extend({}, ctx), {\n valueFormatter: valueFormatter\n }) : ctx, subBlock, idx > 0 ? gaps.html : 0, toolTipTextStyle);\n subMarkupText != null && subMarkupTextList.push(subMarkupText);\n });\n var subMarkupText = ctx.renderMode === 'richText' ? subMarkupTextList.join(gaps.richText) : wrapBlockHTML(subMarkupTextList.join(''), noHeader ? topMarginForOuterGap : gaps.html);\n\n if (noHeader) {\n return subMarkupText;\n }\n\n var displayableHeader = makeValueReadable(fragment.header, 'ordinal', ctx.useUTC);\n var nameStyle = getTooltipTextStyle(toolTipTextStyle, ctx.renderMode).nameStyle;\n\n if (ctx.renderMode === 'richText') {\n return wrapInlineNameRichText(ctx, displayableHeader, nameStyle) + gaps.richText + subMarkupText;\n } else {\n return wrapBlockHTML(\"\" + encodeHTML(displayableHeader) + '
' + subMarkupText, topMarginForOuterGap);\n }\n}\n\nfunction buildNameValue(ctx, fragment, topMarginForOuterGap, toolTipTextStyle) {\n var renderMode = ctx.renderMode;\n var noName = fragment.noName;\n var noValue = fragment.noValue;\n var noMarker = !fragment.markerType;\n var name = fragment.name;\n var useUTC = ctx.useUTC;\n\n var valueFormatter = fragment.valueFormatter || ctx.valueFormatter || function (value) {\n value = isArray(value) ? value : [value];\n return map(value, function (val, idx) {\n return makeValueReadable(val, isArray(valueTypeOption) ? valueTypeOption[idx] : valueTypeOption, useUTC);\n });\n };\n\n if (noName && noValue) {\n return;\n }\n\n var markerStr = noMarker ? '' : ctx.markupStyleCreator.makeTooltipMarker(fragment.markerType, fragment.markerColor || '#333', renderMode);\n var readableName = noName ? '' : makeValueReadable(name, 'ordinal', useUTC);\n var valueTypeOption = fragment.valueType;\n var readableValueList = noValue ? [] : valueFormatter(fragment.value);\n var valueAlignRight = !noMarker || !noName; // It little weird if only value next to marker but far from marker.\n\n var valueCloseToMarker = !noMarker && noName;\n\n var _a = getTooltipTextStyle(toolTipTextStyle, renderMode),\n nameStyle = _a.nameStyle,\n valueStyle = _a.valueStyle;\n\n return renderMode === 'richText' ? (noMarker ? '' : markerStr) + (noName ? '' : wrapInlineNameRichText(ctx, readableName, nameStyle)) // Value has commas inside, so use ' ' as delimiter for multiple values.\n + (noValue ? '' : wrapInlineValueRichText(ctx, readableValueList, valueAlignRight, valueCloseToMarker, valueStyle)) : wrapBlockHTML((noMarker ? '' : markerStr) + (noName ? '' : wrapInlineNameHTML(readableName, !noMarker, nameStyle)) + (noValue ? '' : wrapInlineValueHTML(readableValueList, valueAlignRight, valueCloseToMarker, valueStyle)), topMarginForOuterGap);\n}\n/**\n * @return markupText. null/undefined means no content.\n */\n\n\nexport function buildTooltipMarkup(fragment, markupStyleCreator, renderMode, orderMode, useUTC, toolTipTextStyle) {\n if (!fragment) {\n return;\n }\n\n var builder = getBuilder(fragment);\n var ctx = {\n useUTC: useUTC,\n renderMode: renderMode,\n orderMode: orderMode,\n markupStyleCreator: markupStyleCreator,\n valueFormatter: fragment.valueFormatter\n };\n return builder(ctx, fragment, 0, toolTipTextStyle);\n}\n\nfunction getGap(gapLevel) {\n return {\n html: HTML_GAPS[gapLevel],\n richText: RICH_TEXT_GAPS[gapLevel]\n };\n}\n\nfunction wrapBlockHTML(encodedContent, topGap) {\n var clearfix = '';\n var marginCSS = \"margin: \" + topGap + \"px 0 0\";\n return \"\" + encodedContent + clearfix + '
';\n}\n\nfunction wrapInlineNameHTML(name, leftHasMarker, style) {\n var marginCss = leftHasMarker ? 'margin-left:2px' : '';\n return \"\" + encodeHTML(name) + '';\n}\n\nfunction wrapInlineValueHTML(valueList, alignRight, valueCloseToMarker, style) {\n // Do not too close to marker, considering there are multiple values separated by spaces.\n var paddingStr = valueCloseToMarker ? '10px' : '20px';\n var alignCSS = alignRight ? \"float:right;margin-left:\" + paddingStr : '';\n valueList = isArray(valueList) ? valueList : [valueList];\n return \"\" // Value has commas inside, so use ' ' as delimiter for multiple values.\n + map(valueList, function (value) {\n return encodeHTML(value);\n }).join(' ') + '';\n}\n\nfunction wrapInlineNameRichText(ctx, name, style) {\n return ctx.markupStyleCreator.wrapRichTextStyle(name, style);\n}\n\nfunction wrapInlineValueRichText(ctx, values, alignRight, valueCloseToMarker, style) {\n var styles = [style];\n var paddingLeft = valueCloseToMarker ? 10 : 20;\n alignRight && styles.push({\n padding: [0, 0, 0, paddingLeft],\n align: 'right'\n }); // Value has commas inside, so use ' ' as delimiter for multiple values.\n\n return ctx.markupStyleCreator.wrapRichTextStyle(isArray(values) ? values.join(' ') : values, styles);\n}\n\nexport function retrieveVisualColorForTooltipMarker(series, dataIndex) {\n var style = series.getData().getItemVisual(dataIndex, 'style');\n var color = style[series.visualDrawType];\n return convertToColorString(color);\n}\nexport function getPaddingFromTooltipModel(model, renderMode) {\n var padding = model.get('padding');\n return padding != null ? padding // We give slightly different to look pretty.\n : renderMode === 'richText' ? [8, 10] : 10;\n}\n/**\n * The major feature is generate styles for `renderMode: 'richText'`.\n * But it also serves `renderMode: 'html'` to provide\n * \"renderMode-independent\" API.\n */\n\nvar TooltipMarkupStyleCreator =\n/** @class */\nfunction () {\n function TooltipMarkupStyleCreator() {\n this.richTextStyles = {}; // Notice that \"generate a style name\" usuall happens repeatly when mouse moving and\n // displaying a tooltip. So we put the `_nextStyleNameId` as a member of each creator\n // rather than static shared by all creators (which will cause it increase to fast).\n\n this._nextStyleNameId = getRandomIdBase();\n }\n\n TooltipMarkupStyleCreator.prototype._generateStyleName = function () {\n return '__EC_aUTo_' + this._nextStyleNameId++;\n };\n\n TooltipMarkupStyleCreator.prototype.makeTooltipMarker = function (markerType, colorStr, renderMode) {\n var markerId = renderMode === 'richText' ? this._generateStyleName() : null;\n var marker = getTooltipMarker({\n color: colorStr,\n type: markerType,\n renderMode: renderMode,\n markerId: markerId\n });\n\n if (isString(marker)) {\n return marker;\n } else {\n if (process.env.NODE_ENV !== 'production') {\n assert(markerId);\n }\n\n this.richTextStyles[markerId] = marker.style;\n return marker.content;\n }\n };\n /**\n * @usage\n * ```ts\n * const styledText = markupStyleCreator.wrapRichTextStyle([\n * // The styles will be auto merged.\n * {\n * fontSize: 12,\n * color: 'blue'\n * },\n * {\n * padding: 20\n * }\n * ]);\n * ```\n */\n\n\n TooltipMarkupStyleCreator.prototype.wrapRichTextStyle = function (text, styles) {\n var finalStl = {};\n\n if (isArray(styles)) {\n each(styles, function (stl) {\n return extend(finalStl, stl);\n });\n } else {\n extend(finalStl, styles);\n }\n\n var styleName = this._generateStyleName();\n\n this.richTextStyles[styleName] = finalStl;\n return \"{\" + styleName + \"|\" + text + \"}\";\n };\n\n return TooltipMarkupStyleCreator;\n}();\n\nexport { TooltipMarkupStyleCreator };","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { trim, isArray, each, reduce } from 'zrender/lib/core/util.js';\nimport { retrieveVisualColorForTooltipMarker, createTooltipMarkup } from './tooltipMarkup.js';\nimport { retrieveRawValue } from '../../data/helper/dataProvider.js';\nimport { isNameSpecified } from '../../util/model.js';\nexport function defaultSeriesFormatTooltip(opt) {\n var series = opt.series;\n var dataIndex = opt.dataIndex;\n var multipleSeries = opt.multipleSeries;\n var data = series.getData();\n var tooltipDims = data.mapDimensionsAll('defaultedTooltip');\n var tooltipDimLen = tooltipDims.length;\n var value = series.getRawValue(dataIndex);\n var isValueArr = isArray(value);\n var markerColor = retrieveVisualColorForTooltipMarker(series, dataIndex); // Complicated rule for pretty tooltip.\n\n var inlineValue;\n var inlineValueType;\n var subBlocks;\n var sortParam;\n\n if (tooltipDimLen > 1 || isValueArr && !tooltipDimLen) {\n var formatArrResult = formatTooltipArrayValue(value, series, dataIndex, tooltipDims, markerColor);\n inlineValue = formatArrResult.inlineValues;\n inlineValueType = formatArrResult.inlineValueTypes;\n subBlocks = formatArrResult.blocks; // Only support tooltip sort by the first inline value. It's enough in most cases.\n\n sortParam = formatArrResult.inlineValues[0];\n } else if (tooltipDimLen) {\n var dimInfo = data.getDimensionInfo(tooltipDims[0]);\n sortParam = inlineValue = retrieveRawValue(data, dataIndex, tooltipDims[0]);\n inlineValueType = dimInfo.type;\n } else {\n sortParam = inlineValue = isValueArr ? value[0] : value;\n } // Do not show generated series name. It might not be readable.\n\n\n var seriesNameSpecified = isNameSpecified(series);\n var seriesName = seriesNameSpecified && series.name || '';\n var itemName = data.getName(dataIndex);\n var inlineName = multipleSeries ? seriesName : itemName;\n return createTooltipMarkup('section', {\n header: seriesName,\n // When series name not specified, do not show a header line with only '-'.\n // This case alway happen in tooltip.trigger: 'item'.\n noHeader: multipleSeries || !seriesNameSpecified,\n sortParam: sortParam,\n blocks: [createTooltipMarkup('nameValue', {\n markerType: 'item',\n markerColor: markerColor,\n // Do not mix display seriesName and itemName in one tooltip,\n // which might confuses users.\n name: inlineName,\n // name dimension might be auto assigned, where the name might\n // be not readable. So we check trim here.\n noName: !trim(inlineName),\n value: inlineValue,\n valueType: inlineValueType\n })].concat(subBlocks || [])\n });\n}\n\nfunction formatTooltipArrayValue(value, series, dataIndex, tooltipDims, colorStr) {\n // check: category-no-encode-has-axis-data in dataset.html\n var data = series.getData();\n var isValueMultipleLine = reduce(value, function (isValueMultipleLine, val, idx) {\n var dimItem = data.getDimensionInfo(idx);\n return isValueMultipleLine = isValueMultipleLine || dimItem && dimItem.tooltip !== false && dimItem.displayName != null;\n }, false);\n var inlineValues = [];\n var inlineValueTypes = [];\n var blocks = [];\n tooltipDims.length ? each(tooltipDims, function (dim) {\n setEachItem(retrieveRawValue(data, dataIndex, dim), dim);\n }) // By default, all dims is used on tooltip.\n : each(value, setEachItem);\n\n function setEachItem(val, dim) {\n var dimInfo = data.getDimensionInfo(dim); // If `dimInfo.tooltip` is not set, show tooltip.\n\n if (!dimInfo || dimInfo.otherDims.tooltip === false) {\n return;\n }\n\n if (isValueMultipleLine) {\n blocks.push(createTooltipMarkup('nameValue', {\n markerType: 'subItem',\n markerColor: colorStr,\n name: dimInfo.displayName,\n value: val,\n valueType: dimInfo.type\n }));\n } else {\n inlineValues.push(val);\n inlineValueTypes.push(dimInfo.type);\n }\n }\n\n return {\n inlineValues: inlineValues,\n inlineValueTypes: inlineValueTypes,\n blocks: blocks\n };\n}","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { __extends } from \"tslib\";\nimport * as zrUtil from 'zrender/lib/core/util.js';\nimport env from 'zrender/lib/core/env.js';\nimport * as modelUtil from '../util/model.js';\nimport ComponentModel from './Component.js';\nimport { PaletteMixin } from './mixin/palette.js';\nimport { DataFormatMixin } from '../model/mixin/dataFormat.js';\nimport { getLayoutParams, mergeLayoutParam, fetchLayoutMode } from '../util/layout.js';\nimport { createTask } from '../core/task.js';\nimport { mountExtend } from '../util/clazz.js';\nimport { SourceManager } from '../data/helper/sourceManager.js';\nimport { defaultSeriesFormatTooltip } from '../component/tooltip/seriesFormatTooltip.js';\nvar inner = modelUtil.makeInner();\n\nfunction getSelectionKey(data, dataIndex) {\n return data.getName(dataIndex) || data.getId(dataIndex);\n}\n\nexport var SERIES_UNIVERSAL_TRANSITION_PROP = '__universalTransitionEnabled';\n\nvar SeriesModel =\n/** @class */\nfunction (_super) {\n __extends(SeriesModel, _super);\n\n function SeriesModel() {\n // [Caution]: Becuase this class or desecendants can be used as `XXX.extend(subProto)`,\n // the class members must not be initialized in constructor or declaration place.\n // Otherwise there is bad case:\n // class A {xxx = 1;}\n // enableClassExtend(A);\n // class B extends A {}\n // var C = B.extend({xxx: 5});\n // var c = new C();\n // console.log(c.xxx); // expect 5 but always 1.\n var _this = _super !== null && _super.apply(this, arguments) || this; // ---------------------------------------\n // Props about data selection\n // ---------------------------------------\n\n\n _this._selectedDataIndicesMap = {};\n return _this;\n }\n\n SeriesModel.prototype.init = function (option, parentModel, ecModel) {\n this.seriesIndex = this.componentIndex;\n this.dataTask = createTask({\n count: dataTaskCount,\n reset: dataTaskReset\n });\n this.dataTask.context = {\n model: this\n };\n this.mergeDefaultAndTheme(option, ecModel);\n var sourceManager = inner(this).sourceManager = new SourceManager(this);\n sourceManager.prepareSource();\n var data = this.getInitialData(option, ecModel);\n wrapData(data, this);\n this.dataTask.context.data = data;\n\n if (process.env.NODE_ENV !== 'production') {\n zrUtil.assert(data, 'getInitialData returned invalid data.');\n }\n\n inner(this).dataBeforeProcessed = data; // If we reverse the order (make data firstly, and then make\n // dataBeforeProcessed by cloneShallow), cloneShallow will\n // cause data.graph.data !== data when using\n // module:echarts/data/Graph or module:echarts/data/Tree.\n // See module:echarts/data/helper/linkSeriesData\n // Theoretically, it is unreasonable to call `seriesModel.getData()` in the model\n // init or merge stage, because the data can be restored. So we do not `restoreData`\n // and `setData` here, which forbids calling `seriesModel.getData()` in this stage.\n // Call `seriesModel.getRawData()` instead.\n // this.restoreData();\n\n autoSeriesName(this);\n\n this._initSelectedMapFromData(data);\n };\n /**\n * Util for merge default and theme to option\n */\n\n\n SeriesModel.prototype.mergeDefaultAndTheme = function (option, ecModel) {\n var layoutMode = fetchLayoutMode(this);\n var inputPositionParams = layoutMode ? getLayoutParams(option) : {}; // Backward compat: using subType on theme.\n // But if name duplicate between series subType\n // (for example: parallel) add component mainType,\n // add suffix 'Series'.\n\n var themeSubType = this.subType;\n\n if (ComponentModel.hasClass(themeSubType)) {\n themeSubType += 'Series';\n }\n\n zrUtil.merge(option, ecModel.getTheme().get(this.subType));\n zrUtil.merge(option, this.getDefaultOption()); // Default label emphasis `show`\n\n modelUtil.defaultEmphasis(option, 'label', ['show']);\n this.fillDataTextStyle(option.data);\n\n if (layoutMode) {\n mergeLayoutParam(option, inputPositionParams, layoutMode);\n }\n };\n\n SeriesModel.prototype.mergeOption = function (newSeriesOption, ecModel) {\n // this.settingTask.dirty();\n newSeriesOption = zrUtil.merge(this.option, newSeriesOption, true);\n this.fillDataTextStyle(newSeriesOption.data);\n var layoutMode = fetchLayoutMode(this);\n\n if (layoutMode) {\n mergeLayoutParam(this.option, newSeriesOption, layoutMode);\n }\n\n var sourceManager = inner(this).sourceManager;\n sourceManager.dirty();\n sourceManager.prepareSource();\n var data = this.getInitialData(newSeriesOption, ecModel);\n wrapData(data, this);\n this.dataTask.dirty();\n this.dataTask.context.data = data;\n inner(this).dataBeforeProcessed = data;\n autoSeriesName(this);\n\n this._initSelectedMapFromData(data);\n };\n\n SeriesModel.prototype.fillDataTextStyle = function (data) {\n // Default data label emphasis `show`\n // FIXME Tree structure data ?\n // FIXME Performance ?\n if (data && !zrUtil.isTypedArray(data)) {\n var props = ['show'];\n\n for (var i = 0; i < data.length; i++) {\n if (data[i] && data[i].label) {\n modelUtil.defaultEmphasis(data[i], 'label', props);\n }\n }\n }\n };\n /**\n * Init a data structure from data related option in series\n * Must be overriden.\n */\n\n\n SeriesModel.prototype.getInitialData = function (option, ecModel) {\n return;\n };\n /**\n * Append data to list\n */\n\n\n SeriesModel.prototype.appendData = function (params) {\n // FIXME ???\n // (1) If data from dataset, forbidden append.\n // (2) support append data of dataset.\n var data = this.getRawData();\n data.appendData(params.data);\n };\n /**\n * Consider some method like `filter`, `map` need make new data,\n * We should make sure that `seriesModel.getData()` get correct\n * data in the stream procedure. So we fetch data from upstream\n * each time `task.perform` called.\n */\n\n\n SeriesModel.prototype.getData = function (dataType) {\n var task = getCurrentTask(this);\n\n if (task) {\n var data = task.context.data;\n return dataType == null ? data : data.getLinkedData(dataType);\n } else {\n // When series is not alive (that may happen when click toolbox\n // restore or setOption with not merge mode), series data may\n // be still need to judge animation or something when graphic\n // elements want to know whether fade out.\n return inner(this).data;\n }\n };\n\n SeriesModel.prototype.getAllData = function () {\n var mainData = this.getData();\n return mainData && mainData.getLinkedDataAll ? mainData.getLinkedDataAll() : [{\n data: mainData\n }];\n };\n\n SeriesModel.prototype.setData = function (data) {\n var task = getCurrentTask(this);\n\n if (task) {\n var context = task.context; // Consider case: filter, data sample.\n // FIXME:TS never used, so comment it\n // if (context.data !== data && task.modifyOutputEnd) {\n // task.setOutputEnd(data.count());\n // }\n\n context.outputData = data; // Caution: setData should update context.data,\n // Because getData may be called multiply in a\n // single stage and expect to get the data just\n // set. (For example, AxisProxy, x y both call\n // getData and setDate sequentially).\n // So the context.data should be fetched from\n // upstream each time when a stage starts to be\n // performed.\n\n if (task !== this.dataTask) {\n context.data = data;\n }\n }\n\n inner(this).data = data;\n };\n\n SeriesModel.prototype.getEncode = function () {\n var encode = this.get('encode', true);\n\n if (encode) {\n return zrUtil.createHashMap(encode);\n }\n };\n\n SeriesModel.prototype.getSourceManager = function () {\n return inner(this).sourceManager;\n };\n\n SeriesModel.prototype.getSource = function () {\n return this.getSourceManager().getSource();\n };\n /**\n * Get data before processed\n */\n\n\n SeriesModel.prototype.getRawData = function () {\n return inner(this).dataBeforeProcessed;\n };\n\n SeriesModel.prototype.getColorBy = function () {\n var colorBy = this.get('colorBy');\n return colorBy || 'series';\n };\n\n SeriesModel.prototype.isColorBySeries = function () {\n return this.getColorBy() === 'series';\n };\n /**\n * Get base axis if has coordinate system and has axis.\n * By default use coordSys.getBaseAxis();\n * Can be overrided for some chart.\n * @return {type} description\n */\n\n\n SeriesModel.prototype.getBaseAxis = function () {\n var coordSys = this.coordinateSystem; // @ts-ignore\n\n return coordSys && coordSys.getBaseAxis && coordSys.getBaseAxis();\n };\n /**\n * Default tooltip formatter\n *\n * @param dataIndex\n * @param multipleSeries\n * @param dataType\n * @param renderMode valid values: 'html'(by default) and 'richText'.\n * 'html' is used for rendering tooltip in extra DOM form, and the result\n * string is used as DOM HTML content.\n * 'richText' is used for rendering tooltip in rich text form, for those where\n * DOM operation is not supported.\n * @return formatted tooltip with `html` and `markers`\n * Notice: The override method can also return string\n */\n\n\n SeriesModel.prototype.formatTooltip = function (dataIndex, multipleSeries, dataType) {\n return defaultSeriesFormatTooltip({\n series: this,\n dataIndex: dataIndex,\n multipleSeries: multipleSeries\n });\n };\n\n SeriesModel.prototype.isAnimationEnabled = function () {\n var ecModel = this.ecModel; // Disable animation if using echarts in node but not give ssr flag.\n // In ssr mode, renderToString will generate svg with css animation.\n\n if (env.node && !(ecModel && ecModel.ssr)) {\n return false;\n }\n\n var animationEnabled = this.getShallow('animation');\n\n if (animationEnabled) {\n if (this.getData().count() > this.getShallow('animationThreshold')) {\n animationEnabled = false;\n }\n }\n\n return !!animationEnabled;\n };\n\n SeriesModel.prototype.restoreData = function () {\n this.dataTask.dirty();\n };\n\n SeriesModel.prototype.getColorFromPalette = function (name, scope, requestColorNum) {\n var ecModel = this.ecModel; // PENDING\n\n var color = PaletteMixin.prototype.getColorFromPalette.call(this, name, scope, requestColorNum);\n\n if (!color) {\n color = ecModel.getColorFromPalette(name, scope, requestColorNum);\n }\n\n return color;\n };\n /**\n * Use `data.mapDimensionsAll(coordDim)` instead.\n * @deprecated\n */\n\n\n SeriesModel.prototype.coordDimToDataDim = function (coordDim) {\n return this.getRawData().mapDimensionsAll(coordDim);\n };\n /**\n * Get progressive rendering count each step\n */\n\n\n SeriesModel.prototype.getProgressive = function () {\n return this.get('progressive');\n };\n /**\n * Get progressive rendering count each step\n */\n\n\n SeriesModel.prototype.getProgressiveThreshold = function () {\n return this.get('progressiveThreshold');\n }; // PENGING If selectedMode is null ?\n\n\n SeriesModel.prototype.select = function (innerDataIndices, dataType) {\n this._innerSelect(this.getData(dataType), innerDataIndices);\n };\n\n SeriesModel.prototype.unselect = function (innerDataIndices, dataType) {\n var selectedMap = this.option.selectedMap;\n\n if (!selectedMap) {\n return;\n }\n\n var selectedMode = this.option.selectedMode;\n var data = this.getData(dataType);\n\n if (selectedMode === 'series' || selectedMap === 'all') {\n this.option.selectedMap = {};\n this._selectedDataIndicesMap = {};\n return;\n }\n\n for (var i = 0; i < innerDataIndices.length; i++) {\n var dataIndex = innerDataIndices[i];\n var nameOrId = getSelectionKey(data, dataIndex);\n selectedMap[nameOrId] = false;\n this._selectedDataIndicesMap[nameOrId] = -1;\n }\n };\n\n SeriesModel.prototype.toggleSelect = function (innerDataIndices, dataType) {\n var tmpArr = [];\n\n for (var i = 0; i < innerDataIndices.length; i++) {\n tmpArr[0] = innerDataIndices[i];\n this.isSelected(innerDataIndices[i], dataType) ? this.unselect(tmpArr, dataType) : this.select(tmpArr, dataType);\n }\n };\n\n SeriesModel.prototype.getSelectedDataIndices = function () {\n if (this.option.selectedMap === 'all') {\n return [].slice.call(this.getData().getIndices());\n }\n\n var selectedDataIndicesMap = this._selectedDataIndicesMap;\n var nameOrIds = zrUtil.keys(selectedDataIndicesMap);\n var dataIndices = [];\n\n for (var i = 0; i < nameOrIds.length; i++) {\n var dataIndex = selectedDataIndicesMap[nameOrIds[i]];\n\n if (dataIndex >= 0) {\n dataIndices.push(dataIndex);\n }\n }\n\n return dataIndices;\n };\n\n SeriesModel.prototype.isSelected = function (dataIndex, dataType) {\n var selectedMap = this.option.selectedMap;\n\n if (!selectedMap) {\n return false;\n }\n\n var data = this.getData(dataType);\n return (selectedMap === 'all' || selectedMap[getSelectionKey(data, dataIndex)]) && !data.getItemModel(dataIndex).get(['select', 'disabled']);\n };\n\n SeriesModel.prototype.isUniversalTransitionEnabled = function () {\n if (this[SERIES_UNIVERSAL_TRANSITION_PROP]) {\n return true;\n }\n\n var universalTransitionOpt = this.option.universalTransition; // Quick reject\n\n if (!universalTransitionOpt) {\n return false;\n }\n\n if (universalTransitionOpt === true) {\n return true;\n } // Can be simply 'universalTransition: true'\n\n\n return universalTransitionOpt && universalTransitionOpt.enabled;\n };\n\n SeriesModel.prototype._innerSelect = function (data, innerDataIndices) {\n var _a, _b;\n\n var option = this.option;\n var selectedMode = option.selectedMode;\n var len = innerDataIndices.length;\n\n if (!selectedMode || !len) {\n return;\n }\n\n if (selectedMode === 'series') {\n option.selectedMap = 'all';\n } else if (selectedMode === 'multiple') {\n if (!zrUtil.isObject(option.selectedMap)) {\n option.selectedMap = {};\n }\n\n var selectedMap = option.selectedMap;\n\n for (var i = 0; i < len; i++) {\n var dataIndex = innerDataIndices[i]; // TODO diffrent types of data share same object.\n\n var nameOrId = getSelectionKey(data, dataIndex);\n selectedMap[nameOrId] = true;\n this._selectedDataIndicesMap[nameOrId] = data.getRawIndex(dataIndex);\n }\n } else if (selectedMode === 'single' || selectedMode === true) {\n var lastDataIndex = innerDataIndices[len - 1];\n var nameOrId = getSelectionKey(data, lastDataIndex);\n option.selectedMap = (_a = {}, _a[nameOrId] = true, _a);\n this._selectedDataIndicesMap = (_b = {}, _b[nameOrId] = data.getRawIndex(lastDataIndex), _b);\n }\n };\n\n SeriesModel.prototype._initSelectedMapFromData = function (data) {\n // Ignore select info in data if selectedMap exists.\n // NOTE It's only for legacy usage. edge data is not supported.\n if (this.option.selectedMap) {\n return;\n }\n\n var dataIndices = [];\n\n if (data.hasItemOption) {\n data.each(function (idx) {\n var rawItem = data.getRawDataItem(idx);\n\n if (rawItem && rawItem.selected) {\n dataIndices.push(idx);\n }\n });\n }\n\n if (dataIndices.length > 0) {\n this._innerSelect(data, dataIndices);\n }\n }; // /**\n // * @see {module:echarts/stream/Scheduler}\n // */\n // abstract pipeTask: null\n\n\n SeriesModel.registerClass = function (clz) {\n return ComponentModel.registerClass(clz);\n };\n\n SeriesModel.protoInitialize = function () {\n var proto = SeriesModel.prototype;\n proto.type = 'series.__base__';\n proto.seriesIndex = 0;\n proto.ignoreStyleOnData = false;\n proto.hasSymbolVisual = false;\n proto.defaultSymbol = 'circle'; // Make sure the values can be accessed!\n\n proto.visualStyleAccessPath = 'itemStyle';\n proto.visualDrawType = 'fill';\n }();\n\n return SeriesModel;\n}(ComponentModel);\n\nzrUtil.mixin(SeriesModel, DataFormatMixin);\nzrUtil.mixin(SeriesModel, PaletteMixin);\nmountExtend(SeriesModel, ComponentModel);\n/**\n * MUST be called after `prepareSource` called\n * Here we need to make auto series, especially for auto legend. But we\n * do not modify series.name in option to avoid side effects.\n */\n\nfunction autoSeriesName(seriesModel) {\n // User specified name has higher priority, otherwise it may cause\n // series can not be queried unexpectedly.\n var name = seriesModel.name;\n\n if (!modelUtil.isNameSpecified(seriesModel)) {\n seriesModel.name = getSeriesAutoName(seriesModel) || name;\n }\n}\n\nfunction getSeriesAutoName(seriesModel) {\n var data = seriesModel.getRawData();\n var dataDims = data.mapDimensionsAll('seriesName');\n var nameArr = [];\n zrUtil.each(dataDims, function (dataDim) {\n var dimInfo = data.getDimensionInfo(dataDim);\n dimInfo.displayName && nameArr.push(dimInfo.displayName);\n });\n return nameArr.join(' ');\n}\n\nfunction dataTaskCount(context) {\n return context.model.getRawData().count();\n}\n\nfunction dataTaskReset(context) {\n var seriesModel = context.model;\n seriesModel.setData(seriesModel.getRawData().cloneShallow());\n return dataTaskProgress;\n}\n\nfunction dataTaskProgress(param, context) {\n // Avoid repead cloneShallow when data just created in reset.\n if (context.outputData && param.end > context.outputData.count()) {\n context.model.getRawData().cloneShallow(context.outputData);\n }\n} // TODO refactor\n\n\nfunction wrapData(data, seriesModel) {\n zrUtil.each(zrUtil.concatArray(data.CHANGABLE_METHODS, data.DOWNSAMPLE_METHODS), function (methodName) {\n data.wrapMethod(methodName, zrUtil.curry(onDataChange, seriesModel));\n });\n}\n\nfunction onDataChange(seriesModel, newList) {\n var task = getCurrentTask(seriesModel);\n\n if (task) {\n // Consider case: filter, selectRange\n task.setOutputEnd((newList || this).count());\n }\n\n return newList;\n}\n\nfunction getCurrentTask(seriesModel) {\n var scheduler = (seriesModel.ecModel || {}).scheduler;\n var pipeline = scheduler && scheduler.getPipeline(seriesModel.uid);\n\n if (pipeline) {\n // When pipline finished, the currrentTask keep the last\n // task (renderTask).\n var task = pipeline.currentTask;\n\n if (task) {\n var agentStubMap = task.agentStubMap;\n\n if (agentStubMap) {\n task = agentStubMap.get(seriesModel.uid);\n }\n }\n\n return task;\n }\n}\n\nexport default SeriesModel;","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport Group from 'zrender/lib/graphic/Group.js';\nimport * as componentUtil from '../util/component.js';\nimport * as clazzUtil from '../util/clazz.js';\n\nvar ComponentView =\n/** @class */\nfunction () {\n function ComponentView() {\n this.group = new Group();\n this.uid = componentUtil.getUID('viewComponent');\n }\n\n ComponentView.prototype.init = function (ecModel, api) {};\n\n ComponentView.prototype.render = function (model, ecModel, api, payload) {};\n\n ComponentView.prototype.dispose = function (ecModel, api) {};\n\n ComponentView.prototype.updateView = function (model, ecModel, api, payload) {// Do nothing;\n };\n\n ComponentView.prototype.updateLayout = function (model, ecModel, api, payload) {// Do nothing;\n };\n\n ComponentView.prototype.updateVisual = function (model, ecModel, api, payload) {// Do nothing;\n };\n /**\n * Hook for blur target series.\n * Can be used in marker for blur the markers\n */\n\n\n ComponentView.prototype.blurSeries = function (seriesModels, ecModel) {// Do nothing;\n };\n /**\n * Traverse the new rendered elements.\n *\n * It will traverse the new added element in progressive rendering.\n * And traverse all in normal rendering.\n */\n\n\n ComponentView.prototype.eachRendered = function (cb) {\n var group = this.group;\n\n if (group) {\n group.traverse(cb);\n }\n };\n\n return ComponentView;\n}();\n\n;\nclazzUtil.enableClassExtend(ComponentView);\nclazzUtil.enableClassManagement(ComponentView);\nexport default ComponentView;","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { makeInner } from '../../util/model.js';\n/**\n * @return {string} If large mode changed, return string 'reset';\n */\n\nexport default function createRenderPlanner() {\n var inner = makeInner();\n return function (seriesModel) {\n var fields = inner(seriesModel);\n var pipelineContext = seriesModel.pipelineContext;\n var originalLarge = !!fields.large;\n var originalProgressive = !!fields.progressiveRender; // FIXME: if the planner works on a filtered series, `pipelineContext` does not\n // exists. See #11611 . Probably we need to modify this structure, see the comment\n // on `performRawSeries` in `Schedular.js`.\n\n var large = fields.large = !!(pipelineContext && pipelineContext.large);\n var progressive = fields.progressiveRender = !!(pipelineContext && pipelineContext.progressiveRender);\n return !!(originalLarge !== large || originalProgressive !== progressive) && 'reset';\n };\n}","import PathProxy from '../core/PathProxy.js';\nimport { applyTransform as v2ApplyTransform } from '../core/vector.js';\nvar CMD = PathProxy.CMD;\nvar points = [[], [], []];\nvar mathSqrt = Math.sqrt;\nvar mathAtan2 = Math.atan2;\nexport default function transformPath(path, m) {\n if (!m) {\n return;\n }\n var data = path.data;\n var len = path.len();\n var cmd;\n var nPoint;\n var i;\n var j;\n var k;\n var p;\n var M = CMD.M;\n var C = CMD.C;\n var L = CMD.L;\n var R = CMD.R;\n var A = CMD.A;\n var Q = CMD.Q;\n for (i = 0, j = 0; i < len;) {\n cmd = data[i++];\n j = i;\n nPoint = 0;\n switch (cmd) {\n case M:\n nPoint = 1;\n break;\n case L:\n nPoint = 1;\n break;\n case C:\n nPoint = 3;\n break;\n case Q:\n nPoint = 2;\n break;\n case A:\n var x = m[4];\n var y = m[5];\n var sx = mathSqrt(m[0] * m[0] + m[1] * m[1]);\n var sy = mathSqrt(m[2] * m[2] + m[3] * m[3]);\n var angle = mathAtan2(-m[1] / sy, m[0] / sx);\n data[i] *= sx;\n data[i++] += x;\n data[i] *= sy;\n data[i++] += y;\n data[i++] *= sx;\n data[i++] *= sy;\n data[i++] += angle;\n data[i++] += angle;\n i += 2;\n j = i;\n break;\n case R:\n p[0] = data[i++];\n p[1] = data[i++];\n v2ApplyTransform(p, p, m);\n data[j++] = p[0];\n data[j++] = p[1];\n p[0] += data[i++];\n p[1] += data[i++];\n v2ApplyTransform(p, p, m);\n data[j++] = p[0];\n data[j++] = p[1];\n }\n for (k = 0; k < nPoint; k++) {\n var p_1 = points[k];\n p_1[0] = data[i++];\n p_1[1] = data[i++];\n v2ApplyTransform(p_1, p_1, m);\n data[j++] = p_1[0];\n data[j++] = p_1[1];\n }\n }\n path.increaseVersion();\n}\n","import { __extends } from \"tslib\";\nimport Path from '../graphic/Path.js';\nimport PathProxy from '../core/PathProxy.js';\nimport transformPath from './transformPath.js';\nimport { extend } from '../core/util.js';\nvar mathSqrt = Math.sqrt;\nvar mathSin = Math.sin;\nvar mathCos = Math.cos;\nvar PI = Math.PI;\nfunction vMag(v) {\n return Math.sqrt(v[0] * v[0] + v[1] * v[1]);\n}\n;\nfunction vRatio(u, v) {\n return (u[0] * v[0] + u[1] * v[1]) / (vMag(u) * vMag(v));\n}\n;\nfunction vAngle(u, v) {\n return (u[0] * v[1] < u[1] * v[0] ? -1 : 1)\n * Math.acos(vRatio(u, v));\n}\n;\nfunction processArc(x1, y1, x2, y2, fa, fs, rx, ry, psiDeg, cmd, path) {\n var psi = psiDeg * (PI / 180.0);\n var xp = mathCos(psi) * (x1 - x2) / 2.0\n + mathSin(psi) * (y1 - y2) / 2.0;\n var yp = -1 * mathSin(psi) * (x1 - x2) / 2.0\n + mathCos(psi) * (y1 - y2) / 2.0;\n var lambda = (xp * xp) / (rx * rx) + (yp * yp) / (ry * ry);\n if (lambda > 1) {\n rx *= mathSqrt(lambda);\n ry *= mathSqrt(lambda);\n }\n var f = (fa === fs ? -1 : 1)\n * mathSqrt((((rx * rx) * (ry * ry))\n - ((rx * rx) * (yp * yp))\n - ((ry * ry) * (xp * xp))) / ((rx * rx) * (yp * yp)\n + (ry * ry) * (xp * xp))) || 0;\n var cxp = f * rx * yp / ry;\n var cyp = f * -ry * xp / rx;\n var cx = (x1 + x2) / 2.0\n + mathCos(psi) * cxp\n - mathSin(psi) * cyp;\n var cy = (y1 + y2) / 2.0\n + mathSin(psi) * cxp\n + mathCos(psi) * cyp;\n var theta = vAngle([1, 0], [(xp - cxp) / rx, (yp - cyp) / ry]);\n var u = [(xp - cxp) / rx, (yp - cyp) / ry];\n var v = [(-1 * xp - cxp) / rx, (-1 * yp - cyp) / ry];\n var dTheta = vAngle(u, v);\n if (vRatio(u, v) <= -1) {\n dTheta = PI;\n }\n if (vRatio(u, v) >= 1) {\n dTheta = 0;\n }\n if (dTheta < 0) {\n var n = Math.round(dTheta / PI * 1e6) / 1e6;\n dTheta = PI * 2 + (n % 2) * PI;\n }\n path.addData(cmd, cx, cy, rx, ry, theta, dTheta, psi, fs);\n}\nvar commandReg = /([mlvhzcqtsa])([^mlvhzcqtsa]*)/ig;\nvar numberReg = /-?([0-9]*\\.)?[0-9]+([eE]-?[0-9]+)?/g;\nfunction createPathProxyFromString(data) {\n var path = new PathProxy();\n if (!data) {\n return path;\n }\n var cpx = 0;\n var cpy = 0;\n var subpathX = cpx;\n var subpathY = cpy;\n var prevCmd;\n var CMD = PathProxy.CMD;\n var cmdList = data.match(commandReg);\n if (!cmdList) {\n return path;\n }\n for (var l = 0; l < cmdList.length; l++) {\n var cmdText = cmdList[l];\n var cmdStr = cmdText.charAt(0);\n var cmd = void 0;\n var p = cmdText.match(numberReg) || [];\n var pLen = p.length;\n for (var i = 0; i < pLen; i++) {\n p[i] = parseFloat(p[i]);\n }\n var off = 0;\n while (off < pLen) {\n var ctlPtx = void 0;\n var ctlPty = void 0;\n var rx = void 0;\n var ry = void 0;\n var psi = void 0;\n var fa = void 0;\n var fs = void 0;\n var x1 = cpx;\n var y1 = cpy;\n var len = void 0;\n var pathData = void 0;\n switch (cmdStr) {\n case 'l':\n cpx += p[off++];\n cpy += p[off++];\n cmd = CMD.L;\n path.addData(cmd, cpx, cpy);\n break;\n case 'L':\n cpx = p[off++];\n cpy = p[off++];\n cmd = CMD.L;\n path.addData(cmd, cpx, cpy);\n break;\n case 'm':\n cpx += p[off++];\n cpy += p[off++];\n cmd = CMD.M;\n path.addData(cmd, cpx, cpy);\n subpathX = cpx;\n subpathY = cpy;\n cmdStr = 'l';\n break;\n case 'M':\n cpx = p[off++];\n cpy = p[off++];\n cmd = CMD.M;\n path.addData(cmd, cpx, cpy);\n subpathX = cpx;\n subpathY = cpy;\n cmdStr = 'L';\n break;\n case 'h':\n cpx += p[off++];\n cmd = CMD.L;\n path.addData(cmd, cpx, cpy);\n break;\n case 'H':\n cpx = p[off++];\n cmd = CMD.L;\n path.addData(cmd, cpx, cpy);\n break;\n case 'v':\n cpy += p[off++];\n cmd = CMD.L;\n path.addData(cmd, cpx, cpy);\n break;\n case 'V':\n cpy = p[off++];\n cmd = CMD.L;\n path.addData(cmd, cpx, cpy);\n break;\n case 'C':\n cmd = CMD.C;\n path.addData(cmd, p[off++], p[off++], p[off++], p[off++], p[off++], p[off++]);\n cpx = p[off - 2];\n cpy = p[off - 1];\n break;\n case 'c':\n cmd = CMD.C;\n path.addData(cmd, p[off++] + cpx, p[off++] + cpy, p[off++] + cpx, p[off++] + cpy, p[off++] + cpx, p[off++] + cpy);\n cpx += p[off - 2];\n cpy += p[off - 1];\n break;\n case 'S':\n ctlPtx = cpx;\n ctlPty = cpy;\n len = path.len();\n pathData = path.data;\n if (prevCmd === CMD.C) {\n ctlPtx += cpx - pathData[len - 4];\n ctlPty += cpy - pathData[len - 3];\n }\n cmd = CMD.C;\n x1 = p[off++];\n y1 = p[off++];\n cpx = p[off++];\n cpy = p[off++];\n path.addData(cmd, ctlPtx, ctlPty, x1, y1, cpx, cpy);\n break;\n case 's':\n ctlPtx = cpx;\n ctlPty = cpy;\n len = path.len();\n pathData = path.data;\n if (prevCmd === CMD.C) {\n ctlPtx += cpx - pathData[len - 4];\n ctlPty += cpy - pathData[len - 3];\n }\n cmd = CMD.C;\n x1 = cpx + p[off++];\n y1 = cpy + p[off++];\n cpx += p[off++];\n cpy += p[off++];\n path.addData(cmd, ctlPtx, ctlPty, x1, y1, cpx, cpy);\n break;\n case 'Q':\n x1 = p[off++];\n y1 = p[off++];\n cpx = p[off++];\n cpy = p[off++];\n cmd = CMD.Q;\n path.addData(cmd, x1, y1, cpx, cpy);\n break;\n case 'q':\n x1 = p[off++] + cpx;\n y1 = p[off++] + cpy;\n cpx += p[off++];\n cpy += p[off++];\n cmd = CMD.Q;\n path.addData(cmd, x1, y1, cpx, cpy);\n break;\n case 'T':\n ctlPtx = cpx;\n ctlPty = cpy;\n len = path.len();\n pathData = path.data;\n if (prevCmd === CMD.Q) {\n ctlPtx += cpx - pathData[len - 4];\n ctlPty += cpy - pathData[len - 3];\n }\n cpx = p[off++];\n cpy = p[off++];\n cmd = CMD.Q;\n path.addData(cmd, ctlPtx, ctlPty, cpx, cpy);\n break;\n case 't':\n ctlPtx = cpx;\n ctlPty = cpy;\n len = path.len();\n pathData = path.data;\n if (prevCmd === CMD.Q) {\n ctlPtx += cpx - pathData[len - 4];\n ctlPty += cpy - pathData[len - 3];\n }\n cpx += p[off++];\n cpy += p[off++];\n cmd = CMD.Q;\n path.addData(cmd, ctlPtx, ctlPty, cpx, cpy);\n break;\n case 'A':\n rx = p[off++];\n ry = p[off++];\n psi = p[off++];\n fa = p[off++];\n fs = p[off++];\n x1 = cpx, y1 = cpy;\n cpx = p[off++];\n cpy = p[off++];\n cmd = CMD.A;\n processArc(x1, y1, cpx, cpy, fa, fs, rx, ry, psi, cmd, path);\n break;\n case 'a':\n rx = p[off++];\n ry = p[off++];\n psi = p[off++];\n fa = p[off++];\n fs = p[off++];\n x1 = cpx, y1 = cpy;\n cpx += p[off++];\n cpy += p[off++];\n cmd = CMD.A;\n processArc(x1, y1, cpx, cpy, fa, fs, rx, ry, psi, cmd, path);\n break;\n }\n }\n if (cmdStr === 'z' || cmdStr === 'Z') {\n cmd = CMD.Z;\n path.addData(cmd);\n cpx = subpathX;\n cpy = subpathY;\n }\n prevCmd = cmd;\n }\n path.toStatic();\n return path;\n}\nvar SVGPath = (function (_super) {\n __extends(SVGPath, _super);\n function SVGPath() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n SVGPath.prototype.applyTransform = function (m) { };\n return SVGPath;\n}(Path));\nfunction isPathProxy(path) {\n return path.setData != null;\n}\nfunction createPathOptions(str, opts) {\n var pathProxy = createPathProxyFromString(str);\n var innerOpts = extend({}, opts);\n innerOpts.buildPath = function (path) {\n if (isPathProxy(path)) {\n path.setData(pathProxy.data);\n var ctx = path.getContext();\n if (ctx) {\n path.rebuildPath(ctx, 1);\n }\n }\n else {\n var ctx = path;\n pathProxy.rebuildPath(ctx, 1);\n }\n };\n innerOpts.applyTransform = function (m) {\n transformPath(pathProxy, m);\n this.dirtyShape();\n };\n return innerOpts;\n}\nexport function createFromString(str, opts) {\n return new SVGPath(createPathOptions(str, opts));\n}\nexport function extendFromString(str, defaultOpts) {\n var innerOpts = createPathOptions(str, defaultOpts);\n var Sub = (function (_super) {\n __extends(Sub, _super);\n function Sub(opts) {\n var _this = _super.call(this, opts) || this;\n _this.applyTransform = innerOpts.applyTransform;\n _this.buildPath = innerOpts.buildPath;\n return _this;\n }\n return Sub;\n }(SVGPath));\n return Sub;\n}\nexport function mergePath(pathEls, opts) {\n var pathList = [];\n var len = pathEls.length;\n for (var i = 0; i < len; i++) {\n var pathEl = pathEls[i];\n pathList.push(pathEl.getUpdatedPathProxy(true));\n }\n var pathBundle = new Path(opts);\n pathBundle.createPathProxy();\n pathBundle.buildPath = function (path) {\n if (isPathProxy(path)) {\n path.appendPath(pathList);\n var ctx = path.getContext();\n if (ctx) {\n path.rebuildPath(ctx, 1);\n }\n }\n };\n return pathBundle;\n}\nexport function clonePath(sourcePath, opts) {\n opts = opts || {};\n var path = new Path();\n if (sourcePath.shape) {\n path.setShape(sourcePath.shape);\n }\n path.setStyle(sourcePath.style);\n if (opts.bakeTransform) {\n transformPath(path.path, sourcePath.getComputedTransform());\n }\n else {\n if (opts.toLocal) {\n path.setLocalTransform(sourcePath.getComputedTransform());\n }\n else {\n path.copyTransform(sourcePath);\n }\n }\n path.buildPath = sourcePath.buildPath;\n path.applyTransform = path.applyTransform;\n path.z = sourcePath.z;\n path.z2 = sourcePath.z2;\n path.zlevel = sourcePath.zlevel;\n return path;\n}\n","import { __extends } from \"tslib\";\nimport Path from '../Path.js';\nvar CircleShape = (function () {\n function CircleShape() {\n this.cx = 0;\n this.cy = 0;\n this.r = 0;\n }\n return CircleShape;\n}());\nexport { CircleShape };\nvar Circle = (function (_super) {\n __extends(Circle, _super);\n function Circle(opts) {\n return _super.call(this, opts) || this;\n }\n Circle.prototype.getDefaultShape = function () {\n return new CircleShape();\n };\n Circle.prototype.buildPath = function (ctx, shape) {\n ctx.moveTo(shape.cx + shape.r, shape.cy);\n ctx.arc(shape.cx, shape.cy, shape.r, 0, Math.PI * 2);\n };\n return Circle;\n}(Path));\n;\nCircle.prototype.type = 'circle';\nexport default Circle;\n","import { __extends } from \"tslib\";\nimport Path from '../Path.js';\nvar EllipseShape = (function () {\n function EllipseShape() {\n this.cx = 0;\n this.cy = 0;\n this.rx = 0;\n this.ry = 0;\n }\n return EllipseShape;\n}());\nexport { EllipseShape };\nvar Ellipse = (function (_super) {\n __extends(Ellipse, _super);\n function Ellipse(opts) {\n return _super.call(this, opts) || this;\n }\n Ellipse.prototype.getDefaultShape = function () {\n return new EllipseShape();\n };\n Ellipse.prototype.buildPath = function (ctx, shape) {\n var k = 0.5522848;\n var x = shape.cx;\n var y = shape.cy;\n var a = shape.rx;\n var b = shape.ry;\n var ox = a * k;\n var oy = b * k;\n ctx.moveTo(x - a, y);\n ctx.bezierCurveTo(x - a, y - oy, x - ox, y - b, x, y - b);\n ctx.bezierCurveTo(x + ox, y - b, x + a, y - oy, x + a, y);\n ctx.bezierCurveTo(x + a, y + oy, x + ox, y + b, x, y + b);\n ctx.bezierCurveTo(x - ox, y + b, x - a, y + oy, x - a, y);\n ctx.closePath();\n };\n return Ellipse;\n}(Path));\nEllipse.prototype.type = 'ellipse';\nexport default Ellipse;\n","import { isArray } from '../../core/util.js';\nvar PI = Math.PI;\nvar PI2 = PI * 2;\nvar mathSin = Math.sin;\nvar mathCos = Math.cos;\nvar mathACos = Math.acos;\nvar mathATan2 = Math.atan2;\nvar mathAbs = Math.abs;\nvar mathSqrt = Math.sqrt;\nvar mathMax = Math.max;\nvar mathMin = Math.min;\nvar e = 1e-4;\nfunction intersect(x0, y0, x1, y1, x2, y2, x3, y3) {\n var dx10 = x1 - x0;\n var dy10 = y1 - y0;\n var dx32 = x3 - x2;\n var dy32 = y3 - y2;\n var t = dy32 * dx10 - dx32 * dy10;\n if (t * t < e) {\n return;\n }\n t = (dx32 * (y0 - y2) - dy32 * (x0 - x2)) / t;\n return [x0 + t * dx10, y0 + t * dy10];\n}\nfunction computeCornerTangents(x0, y0, x1, y1, radius, cr, clockwise) {\n var x01 = x0 - x1;\n var y01 = y0 - y1;\n var lo = (clockwise ? cr : -cr) / mathSqrt(x01 * x01 + y01 * y01);\n var ox = lo * y01;\n var oy = -lo * x01;\n var x11 = x0 + ox;\n var y11 = y0 + oy;\n var x10 = x1 + ox;\n var y10 = y1 + oy;\n var x00 = (x11 + x10) / 2;\n var y00 = (y11 + y10) / 2;\n var dx = x10 - x11;\n var dy = y10 - y11;\n var d2 = dx * dx + dy * dy;\n var r = radius - cr;\n var s = x11 * y10 - x10 * y11;\n var d = (dy < 0 ? -1 : 1) * mathSqrt(mathMax(0, r * r * d2 - s * s));\n var cx0 = (s * dy - dx * d) / d2;\n var cy0 = (-s * dx - dy * d) / d2;\n var cx1 = (s * dy + dx * d) / d2;\n var cy1 = (-s * dx + dy * d) / d2;\n var dx0 = cx0 - x00;\n var dy0 = cy0 - y00;\n var dx1 = cx1 - x00;\n var dy1 = cy1 - y00;\n if (dx0 * dx0 + dy0 * dy0 > dx1 * dx1 + dy1 * dy1) {\n cx0 = cx1;\n cy0 = cy1;\n }\n return {\n cx: cx0,\n cy: cy0,\n x0: -ox,\n y0: -oy,\n x1: cx0 * (radius / r - 1),\n y1: cy0 * (radius / r - 1)\n };\n}\nfunction normalizeCornerRadius(cr) {\n var arr;\n if (isArray(cr)) {\n var len = cr.length;\n if (!len) {\n return cr;\n }\n if (len === 1) {\n arr = [cr[0], cr[0], 0, 0];\n }\n else if (len === 2) {\n arr = [cr[0], cr[0], cr[1], cr[1]];\n }\n else if (len === 3) {\n arr = cr.concat(cr[2]);\n }\n else {\n arr = cr;\n }\n }\n else {\n arr = [cr, cr, cr, cr];\n }\n return arr;\n}\nexport function buildPath(ctx, shape) {\n var _a;\n var radius = mathMax(shape.r, 0);\n var innerRadius = mathMax(shape.r0 || 0, 0);\n var hasRadius = radius > 0;\n var hasInnerRadius = innerRadius > 0;\n if (!hasRadius && !hasInnerRadius) {\n return;\n }\n if (!hasRadius) {\n radius = innerRadius;\n innerRadius = 0;\n }\n if (innerRadius > radius) {\n var tmp = radius;\n radius = innerRadius;\n innerRadius = tmp;\n }\n var startAngle = shape.startAngle, endAngle = shape.endAngle;\n if (isNaN(startAngle) || isNaN(endAngle)) {\n return;\n }\n var cx = shape.cx, cy = shape.cy;\n var clockwise = !!shape.clockwise;\n var arc = mathAbs(endAngle - startAngle);\n var mod = arc > PI2 && arc % PI2;\n mod > e && (arc = mod);\n if (!(radius > e)) {\n ctx.moveTo(cx, cy);\n }\n else if (arc > PI2 - e) {\n ctx.moveTo(cx + radius * mathCos(startAngle), cy + radius * mathSin(startAngle));\n ctx.arc(cx, cy, radius, startAngle, endAngle, !clockwise);\n if (innerRadius > e) {\n ctx.moveTo(cx + innerRadius * mathCos(endAngle), cy + innerRadius * mathSin(endAngle));\n ctx.arc(cx, cy, innerRadius, endAngle, startAngle, clockwise);\n }\n }\n else {\n var icrStart = void 0;\n var icrEnd = void 0;\n var ocrStart = void 0;\n var ocrEnd = void 0;\n var ocrs = void 0;\n var ocre = void 0;\n var icrs = void 0;\n var icre = void 0;\n var ocrMax = void 0;\n var icrMax = void 0;\n var limitedOcrMax = void 0;\n var limitedIcrMax = void 0;\n var xre = void 0;\n var yre = void 0;\n var xirs = void 0;\n var yirs = void 0;\n var xrs = radius * mathCos(startAngle);\n var yrs = radius * mathSin(startAngle);\n var xire = innerRadius * mathCos(endAngle);\n var yire = innerRadius * mathSin(endAngle);\n var hasArc = arc > e;\n if (hasArc) {\n var cornerRadius = shape.cornerRadius;\n if (cornerRadius) {\n _a = normalizeCornerRadius(cornerRadius), icrStart = _a[0], icrEnd = _a[1], ocrStart = _a[2], ocrEnd = _a[3];\n }\n var halfRd = mathAbs(radius - innerRadius) / 2;\n ocrs = mathMin(halfRd, ocrStart);\n ocre = mathMin(halfRd, ocrEnd);\n icrs = mathMin(halfRd, icrStart);\n icre = mathMin(halfRd, icrEnd);\n limitedOcrMax = ocrMax = mathMax(ocrs, ocre);\n limitedIcrMax = icrMax = mathMax(icrs, icre);\n if (ocrMax > e || icrMax > e) {\n xre = radius * mathCos(endAngle);\n yre = radius * mathSin(endAngle);\n xirs = innerRadius * mathCos(startAngle);\n yirs = innerRadius * mathSin(startAngle);\n if (arc < PI) {\n var it_1 = intersect(xrs, yrs, xirs, yirs, xre, yre, xire, yire);\n if (it_1) {\n var x0 = xrs - it_1[0];\n var y0 = yrs - it_1[1];\n var x1 = xre - it_1[0];\n var y1 = yre - it_1[1];\n var a = 1 / mathSin(mathACos((x0 * x1 + y0 * y1) / (mathSqrt(x0 * x0 + y0 * y0) * mathSqrt(x1 * x1 + y1 * y1))) / 2);\n var b = mathSqrt(it_1[0] * it_1[0] + it_1[1] * it_1[1]);\n limitedOcrMax = mathMin(ocrMax, (radius - b) / (a + 1));\n limitedIcrMax = mathMin(icrMax, (innerRadius - b) / (a - 1));\n }\n }\n }\n }\n if (!hasArc) {\n ctx.moveTo(cx + xrs, cy + yrs);\n }\n else if (limitedOcrMax > e) {\n var crStart = mathMin(ocrStart, limitedOcrMax);\n var crEnd = mathMin(ocrEnd, limitedOcrMax);\n var ct0 = computeCornerTangents(xirs, yirs, xrs, yrs, radius, crStart, clockwise);\n var ct1 = computeCornerTangents(xre, yre, xire, yire, radius, crEnd, clockwise);\n ctx.moveTo(cx + ct0.cx + ct0.x0, cy + ct0.cy + ct0.y0);\n if (limitedOcrMax < ocrMax && crStart === crEnd) {\n ctx.arc(cx + ct0.cx, cy + ct0.cy, limitedOcrMax, mathATan2(ct0.y0, ct0.x0), mathATan2(ct1.y0, ct1.x0), !clockwise);\n }\n else {\n crStart > 0 && ctx.arc(cx + ct0.cx, cy + ct0.cy, crStart, mathATan2(ct0.y0, ct0.x0), mathATan2(ct0.y1, ct0.x1), !clockwise);\n ctx.arc(cx, cy, radius, mathATan2(ct0.cy + ct0.y1, ct0.cx + ct0.x1), mathATan2(ct1.cy + ct1.y1, ct1.cx + ct1.x1), !clockwise);\n crEnd > 0 && ctx.arc(cx + ct1.cx, cy + ct1.cy, crEnd, mathATan2(ct1.y1, ct1.x1), mathATan2(ct1.y0, ct1.x0), !clockwise);\n }\n }\n else {\n ctx.moveTo(cx + xrs, cy + yrs);\n ctx.arc(cx, cy, radius, startAngle, endAngle, !clockwise);\n }\n if (!(innerRadius > e) || !hasArc) {\n ctx.lineTo(cx + xire, cy + yire);\n }\n else if (limitedIcrMax > e) {\n var crStart = mathMin(icrStart, limitedIcrMax);\n var crEnd = mathMin(icrEnd, limitedIcrMax);\n var ct0 = computeCornerTangents(xire, yire, xre, yre, innerRadius, -crEnd, clockwise);\n var ct1 = computeCornerTangents(xrs, yrs, xirs, yirs, innerRadius, -crStart, clockwise);\n ctx.lineTo(cx + ct0.cx + ct0.x0, cy + ct0.cy + ct0.y0);\n if (limitedIcrMax < icrMax && crStart === crEnd) {\n ctx.arc(cx + ct0.cx, cy + ct0.cy, limitedIcrMax, mathATan2(ct0.y0, ct0.x0), mathATan2(ct1.y0, ct1.x0), !clockwise);\n }\n else {\n crEnd > 0 && ctx.arc(cx + ct0.cx, cy + ct0.cy, crEnd, mathATan2(ct0.y0, ct0.x0), mathATan2(ct0.y1, ct0.x1), !clockwise);\n ctx.arc(cx, cy, innerRadius, mathATan2(ct0.cy + ct0.y1, ct0.cx + ct0.x1), mathATan2(ct1.cy + ct1.y1, ct1.cx + ct1.x1), clockwise);\n crStart > 0 && ctx.arc(cx + ct1.cx, cy + ct1.cy, crStart, mathATan2(ct1.y1, ct1.x1), mathATan2(ct1.y0, ct1.x0), !clockwise);\n }\n }\n else {\n ctx.lineTo(cx + xire, cy + yire);\n ctx.arc(cx, cy, innerRadius, endAngle, startAngle, clockwise);\n }\n }\n ctx.closePath();\n}\n","import { __extends } from \"tslib\";\nimport Path from '../Path.js';\nimport * as roundSectorHelper from '../helper/roundSector.js';\nvar SectorShape = (function () {\n function SectorShape() {\n this.cx = 0;\n this.cy = 0;\n this.r0 = 0;\n this.r = 0;\n this.startAngle = 0;\n this.endAngle = Math.PI * 2;\n this.clockwise = true;\n this.cornerRadius = 0;\n }\n return SectorShape;\n}());\nexport { SectorShape };\nvar Sector = (function (_super) {\n __extends(Sector, _super);\n function Sector(opts) {\n return _super.call(this, opts) || this;\n }\n Sector.prototype.getDefaultShape = function () {\n return new SectorShape();\n };\n Sector.prototype.buildPath = function (ctx, shape) {\n roundSectorHelper.buildPath(ctx, shape);\n };\n Sector.prototype.isZeroArea = function () {\n return this.shape.startAngle === this.shape.endAngle\n || this.shape.r === this.shape.r0;\n };\n return Sector;\n}(Path));\nSector.prototype.type = 'sector';\nexport default Sector;\n","import { __extends } from \"tslib\";\nimport Path from '../Path.js';\nvar RingShape = (function () {\n function RingShape() {\n this.cx = 0;\n this.cy = 0;\n this.r = 0;\n this.r0 = 0;\n }\n return RingShape;\n}());\nexport { RingShape };\nvar Ring = (function (_super) {\n __extends(Ring, _super);\n function Ring(opts) {\n return _super.call(this, opts) || this;\n }\n Ring.prototype.getDefaultShape = function () {\n return new RingShape();\n };\n Ring.prototype.buildPath = function (ctx, shape) {\n var x = shape.cx;\n var y = shape.cy;\n var PI2 = Math.PI * 2;\n ctx.moveTo(x + shape.r, y);\n ctx.arc(x, y, shape.r, 0, PI2, false);\n ctx.moveTo(x + shape.r0, y);\n ctx.arc(x, y, shape.r0, 0, PI2, true);\n };\n return Ring;\n}(Path));\nRing.prototype.type = 'ring';\nexport default Ring;\n","import { min as v2Min, max as v2Max, scale as v2Scale, distance as v2Distance, add as v2Add, clone as v2Clone, sub as v2Sub } from '../../core/vector.js';\nexport default function smoothBezier(points, smooth, isLoop, constraint) {\n var cps = [];\n var v = [];\n var v1 = [];\n var v2 = [];\n var prevPoint;\n var nextPoint;\n var min;\n var max;\n if (constraint) {\n min = [Infinity, Infinity];\n max = [-Infinity, -Infinity];\n for (var i = 0, len = points.length; i < len; i++) {\n v2Min(min, min, points[i]);\n v2Max(max, max, points[i]);\n }\n v2Min(min, min, constraint[0]);\n v2Max(max, max, constraint[1]);\n }\n for (var i = 0, len = points.length; i < len; i++) {\n var point = points[i];\n if (isLoop) {\n prevPoint = points[i ? i - 1 : len - 1];\n nextPoint = points[(i + 1) % len];\n }\n else {\n if (i === 0 || i === len - 1) {\n cps.push(v2Clone(points[i]));\n continue;\n }\n else {\n prevPoint = points[i - 1];\n nextPoint = points[i + 1];\n }\n }\n v2Sub(v, nextPoint, prevPoint);\n v2Scale(v, v, smooth);\n var d0 = v2Distance(point, prevPoint);\n var d1 = v2Distance(point, nextPoint);\n var sum = d0 + d1;\n if (sum !== 0) {\n d0 /= sum;\n d1 /= sum;\n }\n v2Scale(v1, v, -d0);\n v2Scale(v2, v, d1);\n var cp0 = v2Add([], point, v1);\n var cp1 = v2Add([], point, v2);\n if (constraint) {\n v2Max(cp0, cp0, min);\n v2Min(cp0, cp0, max);\n v2Max(cp1, cp1, min);\n v2Min(cp1, cp1, max);\n }\n cps.push(cp0);\n cps.push(cp1);\n }\n if (isLoop) {\n cps.push(cps.shift());\n }\n return cps;\n}\n","import smoothBezier from './smoothBezier.js';\nexport function buildPath(ctx, shape, closePath) {\n var smooth = shape.smooth;\n var points = shape.points;\n if (points && points.length >= 2) {\n if (smooth) {\n var controlPoints = smoothBezier(points, smooth, closePath, shape.smoothConstraint);\n ctx.moveTo(points[0][0], points[0][1]);\n var len = points.length;\n for (var i = 0; i < (closePath ? len : len - 1); i++) {\n var cp1 = controlPoints[i * 2];\n var cp2 = controlPoints[i * 2 + 1];\n var p = points[(i + 1) % len];\n ctx.bezierCurveTo(cp1[0], cp1[1], cp2[0], cp2[1], p[0], p[1]);\n }\n }\n else {\n ctx.moveTo(points[0][0], points[0][1]);\n for (var i = 1, l = points.length; i < l; i++) {\n ctx.lineTo(points[i][0], points[i][1]);\n }\n }\n closePath && ctx.closePath();\n }\n}\n","import { __extends } from \"tslib\";\nimport Path from '../Path.js';\nimport * as polyHelper from '../helper/poly.js';\nvar PolygonShape = (function () {\n function PolygonShape() {\n this.points = null;\n this.smooth = 0;\n this.smoothConstraint = null;\n }\n return PolygonShape;\n}());\nexport { PolygonShape };\nvar Polygon = (function (_super) {\n __extends(Polygon, _super);\n function Polygon(opts) {\n return _super.call(this, opts) || this;\n }\n Polygon.prototype.getDefaultShape = function () {\n return new PolygonShape();\n };\n Polygon.prototype.buildPath = function (ctx, shape) {\n polyHelper.buildPath(ctx, shape, true);\n };\n return Polygon;\n}(Path));\n;\nPolygon.prototype.type = 'polygon';\nexport default Polygon;\n","import { __extends } from \"tslib\";\nimport Path from '../Path.js';\nimport * as polyHelper from '../helper/poly.js';\nvar PolylineShape = (function () {\n function PolylineShape() {\n this.points = null;\n this.percent = 1;\n this.smooth = 0;\n this.smoothConstraint = null;\n }\n return PolylineShape;\n}());\nexport { PolylineShape };\nvar Polyline = (function (_super) {\n __extends(Polyline, _super);\n function Polyline(opts) {\n return _super.call(this, opts) || this;\n }\n Polyline.prototype.getDefaultStyle = function () {\n return {\n stroke: '#000',\n fill: null\n };\n };\n Polyline.prototype.getDefaultShape = function () {\n return new PolylineShape();\n };\n Polyline.prototype.buildPath = function (ctx, shape) {\n polyHelper.buildPath(ctx, shape, false);\n };\n return Polyline;\n}(Path));\nPolyline.prototype.type = 'polyline';\nexport default Polyline;\n","import { __extends } from \"tslib\";\nimport Path from '../Path.js';\nimport { subPixelOptimizeLine } from '../helper/subPixelOptimize.js';\nvar subPixelOptimizeOutputShape = {};\nvar LineShape = (function () {\n function LineShape() {\n this.x1 = 0;\n this.y1 = 0;\n this.x2 = 0;\n this.y2 = 0;\n this.percent = 1;\n }\n return LineShape;\n}());\nexport { LineShape };\nvar Line = (function (_super) {\n __extends(Line, _super);\n function Line(opts) {\n return _super.call(this, opts) || this;\n }\n Line.prototype.getDefaultStyle = function () {\n return {\n stroke: '#000',\n fill: null\n };\n };\n Line.prototype.getDefaultShape = function () {\n return new LineShape();\n };\n Line.prototype.buildPath = function (ctx, shape) {\n var x1;\n var y1;\n var x2;\n var y2;\n if (this.subPixelOptimize) {\n var optimizedShape = subPixelOptimizeLine(subPixelOptimizeOutputShape, shape, this.style);\n x1 = optimizedShape.x1;\n y1 = optimizedShape.y1;\n x2 = optimizedShape.x2;\n y2 = optimizedShape.y2;\n }\n else {\n x1 = shape.x1;\n y1 = shape.y1;\n x2 = shape.x2;\n y2 = shape.y2;\n }\n var percent = shape.percent;\n if (percent === 0) {\n return;\n }\n ctx.moveTo(x1, y1);\n if (percent < 1) {\n x2 = x1 * (1 - percent) + x2 * percent;\n y2 = y1 * (1 - percent) + y2 * percent;\n }\n ctx.lineTo(x2, y2);\n };\n Line.prototype.pointAt = function (p) {\n var shape = this.shape;\n return [\n shape.x1 * (1 - p) + shape.x2 * p,\n shape.y1 * (1 - p) + shape.y2 * p\n ];\n };\n return Line;\n}(Path));\nLine.prototype.type = 'line';\nexport default Line;\n","import { __extends } from \"tslib\";\nimport Path from '../Path.js';\nimport * as vec2 from '../../core/vector.js';\nimport { quadraticSubdivide, cubicSubdivide, quadraticAt, cubicAt, quadraticDerivativeAt, cubicDerivativeAt } from '../../core/curve.js';\nvar out = [];\nvar BezierCurveShape = (function () {\n function BezierCurveShape() {\n this.x1 = 0;\n this.y1 = 0;\n this.x2 = 0;\n this.y2 = 0;\n this.cpx1 = 0;\n this.cpy1 = 0;\n this.percent = 1;\n }\n return BezierCurveShape;\n}());\nexport { BezierCurveShape };\nfunction someVectorAt(shape, t, isTangent) {\n var cpx2 = shape.cpx2;\n var cpy2 = shape.cpy2;\n if (cpx2 != null || cpy2 != null) {\n return [\n (isTangent ? cubicDerivativeAt : cubicAt)(shape.x1, shape.cpx1, shape.cpx2, shape.x2, t),\n (isTangent ? cubicDerivativeAt : cubicAt)(shape.y1, shape.cpy1, shape.cpy2, shape.y2, t)\n ];\n }\n else {\n return [\n (isTangent ? quadraticDerivativeAt : quadraticAt)(shape.x1, shape.cpx1, shape.x2, t),\n (isTangent ? quadraticDerivativeAt : quadraticAt)(shape.y1, shape.cpy1, shape.y2, t)\n ];\n }\n}\nvar BezierCurve = (function (_super) {\n __extends(BezierCurve, _super);\n function BezierCurve(opts) {\n return _super.call(this, opts) || this;\n }\n BezierCurve.prototype.getDefaultStyle = function () {\n return {\n stroke: '#000',\n fill: null\n };\n };\n BezierCurve.prototype.getDefaultShape = function () {\n return new BezierCurveShape();\n };\n BezierCurve.prototype.buildPath = function (ctx, shape) {\n var x1 = shape.x1;\n var y1 = shape.y1;\n var x2 = shape.x2;\n var y2 = shape.y2;\n var cpx1 = shape.cpx1;\n var cpy1 = shape.cpy1;\n var cpx2 = shape.cpx2;\n var cpy2 = shape.cpy2;\n var percent = shape.percent;\n if (percent === 0) {\n return;\n }\n ctx.moveTo(x1, y1);\n if (cpx2 == null || cpy2 == null) {\n if (percent < 1) {\n quadraticSubdivide(x1, cpx1, x2, percent, out);\n cpx1 = out[1];\n x2 = out[2];\n quadraticSubdivide(y1, cpy1, y2, percent, out);\n cpy1 = out[1];\n y2 = out[2];\n }\n ctx.quadraticCurveTo(cpx1, cpy1, x2, y2);\n }\n else {\n if (percent < 1) {\n cubicSubdivide(x1, cpx1, cpx2, x2, percent, out);\n cpx1 = out[1];\n cpx2 = out[2];\n x2 = out[3];\n cubicSubdivide(y1, cpy1, cpy2, y2, percent, out);\n cpy1 = out[1];\n cpy2 = out[2];\n y2 = out[3];\n }\n ctx.bezierCurveTo(cpx1, cpy1, cpx2, cpy2, x2, y2);\n }\n };\n BezierCurve.prototype.pointAt = function (t) {\n return someVectorAt(this.shape, t, false);\n };\n BezierCurve.prototype.tangentAt = function (t) {\n var p = someVectorAt(this.shape, t, true);\n return vec2.normalize(p, p);\n };\n return BezierCurve;\n}(Path));\n;\nBezierCurve.prototype.type = 'bezier-curve';\nexport default BezierCurve;\n","import { __extends } from \"tslib\";\nimport Path from '../Path.js';\nvar ArcShape = (function () {\n function ArcShape() {\n this.cx = 0;\n this.cy = 0;\n this.r = 0;\n this.startAngle = 0;\n this.endAngle = Math.PI * 2;\n this.clockwise = true;\n }\n return ArcShape;\n}());\nexport { ArcShape };\nvar Arc = (function (_super) {\n __extends(Arc, _super);\n function Arc(opts) {\n return _super.call(this, opts) || this;\n }\n Arc.prototype.getDefaultStyle = function () {\n return {\n stroke: '#000',\n fill: null\n };\n };\n Arc.prototype.getDefaultShape = function () {\n return new ArcShape();\n };\n Arc.prototype.buildPath = function (ctx, shape) {\n var x = shape.cx;\n var y = shape.cy;\n var r = Math.max(shape.r, 0);\n var startAngle = shape.startAngle;\n var endAngle = shape.endAngle;\n var clockwise = shape.clockwise;\n var unitX = Math.cos(startAngle);\n var unitY = Math.sin(startAngle);\n ctx.moveTo(unitX * r + x, unitY * r + y);\n ctx.arc(x, y, r, startAngle, endAngle, !clockwise);\n };\n return Arc;\n}(Path));\nArc.prototype.type = 'arc';\nexport default Arc;\n","import { __extends } from \"tslib\";\nimport Path from './Path.js';\nvar CompoundPath = (function (_super) {\n __extends(CompoundPath, _super);\n function CompoundPath() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.type = 'compound';\n return _this;\n }\n CompoundPath.prototype._updatePathDirty = function () {\n var paths = this.shape.paths;\n var dirtyPath = this.shapeChanged();\n for (var i = 0; i < paths.length; i++) {\n dirtyPath = dirtyPath || paths[i].shapeChanged();\n }\n if (dirtyPath) {\n this.dirtyShape();\n }\n };\n CompoundPath.prototype.beforeBrush = function () {\n this._updatePathDirty();\n var paths = this.shape.paths || [];\n var scale = this.getGlobalScale();\n for (var i = 0; i < paths.length; i++) {\n if (!paths[i].path) {\n paths[i].createPathProxy();\n }\n paths[i].path.setScale(scale[0], scale[1], paths[i].segmentIgnoreThreshold);\n }\n };\n CompoundPath.prototype.buildPath = function (ctx, shape) {\n var paths = shape.paths || [];\n for (var i = 0; i < paths.length; i++) {\n paths[i].buildPath(ctx, paths[i].shape, true);\n }\n };\n CompoundPath.prototype.afterBrush = function () {\n var paths = this.shape.paths || [];\n for (var i = 0; i < paths.length; i++) {\n paths[i].pathUpdated();\n }\n };\n CompoundPath.prototype.getBoundingRect = function () {\n this._updatePathDirty.call(this);\n return Path.prototype.getBoundingRect.call(this);\n };\n return CompoundPath;\n}(Path));\nexport default CompoundPath;\n","var Gradient = (function () {\n function Gradient(colorStops) {\n this.colorStops = colorStops || [];\n }\n Gradient.prototype.addColorStop = function (offset, color) {\n this.colorStops.push({\n offset: offset,\n color: color\n });\n };\n return Gradient;\n}());\nexport default Gradient;\n","import { __extends } from \"tslib\";\nimport Gradient from './Gradient.js';\nvar LinearGradient = (function (_super) {\n __extends(LinearGradient, _super);\n function LinearGradient(x, y, x2, y2, colorStops, globalCoord) {\n var _this = _super.call(this, colorStops) || this;\n _this.x = x == null ? 0 : x;\n _this.y = y == null ? 0 : y;\n _this.x2 = x2 == null ? 1 : x2;\n _this.y2 = y2 == null ? 0 : y2;\n _this.type = 'linear';\n _this.global = globalCoord || false;\n return _this;\n }\n return LinearGradient;\n}(Gradient));\nexport default LinearGradient;\n;\n","import { __extends } from \"tslib\";\nimport Gradient from './Gradient.js';\nvar RadialGradient = (function (_super) {\n __extends(RadialGradient, _super);\n function RadialGradient(x, y, r, colorStops, globalCoord) {\n var _this = _super.call(this, colorStops) || this;\n _this.x = x == null ? 0.5 : x;\n _this.y = y == null ? 0.5 : y;\n _this.r = r == null ? 0.5 : r;\n _this.type = 'radial';\n _this.global = globalCoord || false;\n return _this;\n }\n return RadialGradient;\n}(Gradient));\nexport default RadialGradient;\n","import Point from './Point.js';\nvar extent = [0, 0];\nvar extent2 = [0, 0];\nvar minTv = new Point();\nvar maxTv = new Point();\nvar OrientedBoundingRect = (function () {\n function OrientedBoundingRect(rect, transform) {\n this._corners = [];\n this._axes = [];\n this._origin = [0, 0];\n for (var i = 0; i < 4; i++) {\n this._corners[i] = new Point();\n }\n for (var i = 0; i < 2; i++) {\n this._axes[i] = new Point();\n }\n if (rect) {\n this.fromBoundingRect(rect, transform);\n }\n }\n OrientedBoundingRect.prototype.fromBoundingRect = function (rect, transform) {\n var corners = this._corners;\n var axes = this._axes;\n var x = rect.x;\n var y = rect.y;\n var x2 = x + rect.width;\n var y2 = y + rect.height;\n corners[0].set(x, y);\n corners[1].set(x2, y);\n corners[2].set(x2, y2);\n corners[3].set(x, y2);\n if (transform) {\n for (var i = 0; i < 4; i++) {\n corners[i].transform(transform);\n }\n }\n Point.sub(axes[0], corners[1], corners[0]);\n Point.sub(axes[1], corners[3], corners[0]);\n axes[0].normalize();\n axes[1].normalize();\n for (var i = 0; i < 2; i++) {\n this._origin[i] = axes[i].dot(corners[0]);\n }\n };\n OrientedBoundingRect.prototype.intersect = function (other, mtv) {\n var overlapped = true;\n var noMtv = !mtv;\n minTv.set(Infinity, Infinity);\n maxTv.set(0, 0);\n if (!this._intersectCheckOneSide(this, other, minTv, maxTv, noMtv, 1)) {\n overlapped = false;\n if (noMtv) {\n return overlapped;\n }\n }\n if (!this._intersectCheckOneSide(other, this, minTv, maxTv, noMtv, -1)) {\n overlapped = false;\n if (noMtv) {\n return overlapped;\n }\n }\n if (!noMtv) {\n Point.copy(mtv, overlapped ? minTv : maxTv);\n }\n return overlapped;\n };\n OrientedBoundingRect.prototype._intersectCheckOneSide = function (self, other, minTv, maxTv, noMtv, inverse) {\n var overlapped = true;\n for (var i = 0; i < 2; i++) {\n var axis = this._axes[i];\n this._getProjMinMaxOnAxis(i, self._corners, extent);\n this._getProjMinMaxOnAxis(i, other._corners, extent2);\n if (extent[1] < extent2[0] || extent[0] > extent2[1]) {\n overlapped = false;\n if (noMtv) {\n return overlapped;\n }\n var dist0 = Math.abs(extent2[0] - extent[1]);\n var dist1 = Math.abs(extent[0] - extent2[1]);\n if (Math.min(dist0, dist1) > maxTv.len()) {\n if (dist0 < dist1) {\n Point.scale(maxTv, axis, -dist0 * inverse);\n }\n else {\n Point.scale(maxTv, axis, dist1 * inverse);\n }\n }\n }\n else if (minTv) {\n var dist0 = Math.abs(extent2[0] - extent[1]);\n var dist1 = Math.abs(extent[0] - extent2[1]);\n if (Math.min(dist0, dist1) < minTv.len()) {\n if (dist0 < dist1) {\n Point.scale(minTv, axis, dist0 * inverse);\n }\n else {\n Point.scale(minTv, axis, -dist1 * inverse);\n }\n }\n }\n }\n return overlapped;\n };\n OrientedBoundingRect.prototype._getProjMinMaxOnAxis = function (dim, corners, out) {\n var axis = this._axes[dim];\n var origin = this._origin;\n var proj = corners[0].dot(axis) + origin[dim];\n var min = proj;\n var max = proj;\n for (var i = 1; i < corners.length; i++) {\n var proj_1 = corners[i].dot(axis) + origin[dim];\n min = Math.min(proj_1, min);\n max = Math.max(proj_1, max);\n }\n out[0] = min;\n out[1] = max;\n };\n return OrientedBoundingRect;\n}());\nexport default OrientedBoundingRect;\n","import { __extends } from \"tslib\";\nimport Displayble from './Displayable.js';\nimport BoundingRect from '../core/BoundingRect.js';\nvar m = [];\nvar IncrementalDisplayable = (function (_super) {\n __extends(IncrementalDisplayable, _super);\n function IncrementalDisplayable() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.notClear = true;\n _this.incremental = true;\n _this._displayables = [];\n _this._temporaryDisplayables = [];\n _this._cursor = 0;\n return _this;\n }\n IncrementalDisplayable.prototype.traverse = function (cb, context) {\n cb.call(context, this);\n };\n IncrementalDisplayable.prototype.useStyle = function () {\n this.style = {};\n };\n IncrementalDisplayable.prototype.getCursor = function () {\n return this._cursor;\n };\n IncrementalDisplayable.prototype.innerAfterBrush = function () {\n this._cursor = this._displayables.length;\n };\n IncrementalDisplayable.prototype.clearDisplaybles = function () {\n this._displayables = [];\n this._temporaryDisplayables = [];\n this._cursor = 0;\n this.markRedraw();\n this.notClear = false;\n };\n IncrementalDisplayable.prototype.clearTemporalDisplayables = function () {\n this._temporaryDisplayables = [];\n };\n IncrementalDisplayable.prototype.addDisplayable = function (displayable, notPersistent) {\n if (notPersistent) {\n this._temporaryDisplayables.push(displayable);\n }\n else {\n this._displayables.push(displayable);\n }\n this.markRedraw();\n };\n IncrementalDisplayable.prototype.addDisplayables = function (displayables, notPersistent) {\n notPersistent = notPersistent || false;\n for (var i = 0; i < displayables.length; i++) {\n this.addDisplayable(displayables[i], notPersistent);\n }\n };\n IncrementalDisplayable.prototype.getDisplayables = function () {\n return this._displayables;\n };\n IncrementalDisplayable.prototype.getTemporalDisplayables = function () {\n return this._temporaryDisplayables;\n };\n IncrementalDisplayable.prototype.eachPendingDisplayable = function (cb) {\n for (var i = this._cursor; i < this._displayables.length; i++) {\n cb && cb(this._displayables[i]);\n }\n for (var i = 0; i < this._temporaryDisplayables.length; i++) {\n cb && cb(this._temporaryDisplayables[i]);\n }\n };\n IncrementalDisplayable.prototype.update = function () {\n this.updateTransform();\n for (var i = this._cursor; i < this._displayables.length; i++) {\n var displayable = this._displayables[i];\n displayable.parent = this;\n displayable.update();\n displayable.parent = null;\n }\n for (var i = 0; i < this._temporaryDisplayables.length; i++) {\n var displayable = this._temporaryDisplayables[i];\n displayable.parent = this;\n displayable.update();\n displayable.parent = null;\n }\n };\n IncrementalDisplayable.prototype.getBoundingRect = function () {\n if (!this._rect) {\n var rect = new BoundingRect(Infinity, Infinity, -Infinity, -Infinity);\n for (var i = 0; i < this._displayables.length; i++) {\n var displayable = this._displayables[i];\n var childRect = displayable.getBoundingRect().clone();\n if (displayable.needLocalTransform()) {\n childRect.applyTransform(displayable.getLocalTransform(m));\n }\n rect.union(childRect);\n }\n this._rect = rect;\n }\n return this._rect;\n };\n IncrementalDisplayable.prototype.contain = function (x, y) {\n var localPos = this.transformCoordToLocal(x, y);\n var rect = this.getBoundingRect();\n if (rect.contain(localPos[0], localPos[1])) {\n for (var i = 0; i < this._displayables.length; i++) {\n var displayable = this._displayables[i];\n if (displayable.contain(x, y)) {\n return true;\n }\n }\n }\n return false;\n };\n return IncrementalDisplayable;\n}(Displayble));\nexport default IncrementalDisplayable;\n","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport * as pathTool from 'zrender/lib/tool/path.js';\nimport * as matrix from 'zrender/lib/core/matrix.js';\nimport * as vector from 'zrender/lib/core/vector.js';\nimport Path from 'zrender/lib/graphic/Path.js';\nimport Transformable from 'zrender/lib/core/Transformable.js';\nimport ZRImage from 'zrender/lib/graphic/Image.js';\nimport Group from 'zrender/lib/graphic/Group.js';\nimport ZRText from 'zrender/lib/graphic/Text.js';\nimport Circle from 'zrender/lib/graphic/shape/Circle.js';\nimport Ellipse from 'zrender/lib/graphic/shape/Ellipse.js';\nimport Sector from 'zrender/lib/graphic/shape/Sector.js';\nimport Ring from 'zrender/lib/graphic/shape/Ring.js';\nimport Polygon from 'zrender/lib/graphic/shape/Polygon.js';\nimport Polyline from 'zrender/lib/graphic/shape/Polyline.js';\nimport Rect from 'zrender/lib/graphic/shape/Rect.js';\nimport Line from 'zrender/lib/graphic/shape/Line.js';\nimport BezierCurve from 'zrender/lib/graphic/shape/BezierCurve.js';\nimport Arc from 'zrender/lib/graphic/shape/Arc.js';\nimport CompoundPath from 'zrender/lib/graphic/CompoundPath.js';\nimport LinearGradient from 'zrender/lib/graphic/LinearGradient.js';\nimport RadialGradient from 'zrender/lib/graphic/RadialGradient.js';\nimport BoundingRect from 'zrender/lib/core/BoundingRect.js';\nimport OrientedBoundingRect from 'zrender/lib/core/OrientedBoundingRect.js';\nimport Point from 'zrender/lib/core/Point.js';\nimport IncrementalDisplayable from 'zrender/lib/graphic/IncrementalDisplayable.js';\nimport * as subPixelOptimizeUtil from 'zrender/lib/graphic/helper/subPixelOptimize.js';\nimport { extend, isArrayLike, map, defaults, isString, keys, each, hasOwn, isArray } from 'zrender/lib/core/util.js';\nimport { getECData } from './innerStore.js';\nimport { updateProps, initProps, removeElement, removeElementWithFadeOut, isElementRemoved } from '../animation/basicTrasition.js';\n/**\n * @deprecated export for compatitable reason\n */\n\nexport { updateProps, initProps, removeElement, removeElementWithFadeOut, isElementRemoved };\nvar mathMax = Math.max;\nvar mathMin = Math.min;\nvar _customShapeMap = {};\n/**\n * Extend shape with parameters\n */\n\nexport function extendShape(opts) {\n return Path.extend(opts);\n}\nvar extendPathFromString = pathTool.extendFromString;\n/**\n * Extend path\n */\n\nexport function extendPath(pathData, opts) {\n return extendPathFromString(pathData, opts);\n}\n/**\n * Register a user defined shape.\n * The shape class can be fetched by `getShapeClass`\n * This method will overwrite the registered shapes, including\n * the registered built-in shapes, if using the same `name`.\n * The shape can be used in `custom series` and\n * `graphic component` by declaring `{type: name}`.\n *\n * @param name\n * @param ShapeClass Can be generated by `extendShape`.\n */\n\nexport function registerShape(name, ShapeClass) {\n _customShapeMap[name] = ShapeClass;\n}\n/**\n * Find shape class registered by `registerShape`. Usually used in\n * fetching user defined shape.\n *\n * [Caution]:\n * (1) This method **MUST NOT be used inside echarts !!!**, unless it is prepared\n * to use user registered shapes.\n * Because the built-in shape (see `getBuiltInShape`) will be registered by\n * `registerShape` by default. That enables users to get both built-in\n * shapes as well as the shapes belonging to themsleves. But users can overwrite\n * the built-in shapes by using names like 'circle', 'rect' via calling\n * `registerShape`. So the echarts inner featrues should not fetch shapes from here\n * in case that it is overwritten by users, except that some features, like\n * `custom series`, `graphic component`, do it deliberately.\n *\n * (2) In the features like `custom series`, `graphic component`, the user input\n * `{tpye: 'xxx'}` does not only specify shapes but also specify other graphic\n * elements like `'group'`, `'text'`, `'image'` or event `'path'`. Those names\n * are reserved names, that is, if some user register a shape named `'image'`,\n * the shape will not be used. If we intending to add some more reserved names\n * in feature, that might bring break changes (disable some existing user shape\n * names). But that case probably rearly happen. So we dont make more mechanism\n * to resolve this issue here.\n *\n * @param name\n * @return The shape class. If not found, return nothing.\n */\n\nexport function getShapeClass(name) {\n if (_customShapeMap.hasOwnProperty(name)) {\n return _customShapeMap[name];\n }\n}\n/**\n * Create a path element from path data string\n * @param pathData\n * @param opts\n * @param rect\n * @param layout 'center' or 'cover' default to be cover\n */\n\nexport function makePath(pathData, opts, rect, layout) {\n var path = pathTool.createFromString(pathData, opts);\n\n if (rect) {\n if (layout === 'center') {\n rect = centerGraphic(rect, path.getBoundingRect());\n }\n\n resizePath(path, rect);\n }\n\n return path;\n}\n/**\n * Create a image element from image url\n * @param imageUrl image url\n * @param opts options\n * @param rect constrain rect\n * @param layout 'center' or 'cover'. Default to be 'cover'\n */\n\nexport function makeImage(imageUrl, rect, layout) {\n var zrImg = new ZRImage({\n style: {\n image: imageUrl,\n x: rect.x,\n y: rect.y,\n width: rect.width,\n height: rect.height\n },\n onload: function (img) {\n if (layout === 'center') {\n var boundingRect = {\n width: img.width,\n height: img.height\n };\n zrImg.setStyle(centerGraphic(rect, boundingRect));\n }\n }\n });\n return zrImg;\n}\n/**\n * Get position of centered element in bounding box.\n *\n * @param rect element local bounding box\n * @param boundingRect constraint bounding box\n * @return element position containing x, y, width, and height\n */\n\nfunction centerGraphic(rect, boundingRect) {\n // Set rect to center, keep width / height ratio.\n var aspect = boundingRect.width / boundingRect.height;\n var width = rect.height * aspect;\n var height;\n\n if (width <= rect.width) {\n height = rect.height;\n } else {\n width = rect.width;\n height = width / aspect;\n }\n\n var cx = rect.x + rect.width / 2;\n var cy = rect.y + rect.height / 2;\n return {\n x: cx - width / 2,\n y: cy - height / 2,\n width: width,\n height: height\n };\n}\n\nexport var mergePath = pathTool.mergePath;\n/**\n * Resize a path to fit the rect\n * @param path\n * @param rect\n */\n\nexport function resizePath(path, rect) {\n if (!path.applyTransform) {\n return;\n }\n\n var pathRect = path.getBoundingRect();\n var m = pathRect.calculateTransform(rect);\n path.applyTransform(m);\n}\n/**\n * Sub pixel optimize line for canvas\n */\n\nexport function subPixelOptimizeLine(param) {\n subPixelOptimizeUtil.subPixelOptimizeLine(param.shape, param.shape, param.style);\n return param;\n}\n/**\n * Sub pixel optimize rect for canvas\n */\n\nexport function subPixelOptimizeRect(param) {\n subPixelOptimizeUtil.subPixelOptimizeRect(param.shape, param.shape, param.style);\n return param;\n}\n/**\n * Sub pixel optimize for canvas\n *\n * @param position Coordinate, such as x, y\n * @param lineWidth Should be nonnegative integer.\n * @param positiveOrNegative Default false (negative).\n * @return Optimized position.\n */\n\nexport var subPixelOptimize = subPixelOptimizeUtil.subPixelOptimize;\n/**\n * Get transform matrix of target (param target),\n * in coordinate of its ancestor (param ancestor)\n *\n * @param target\n * @param [ancestor]\n */\n\nexport function getTransform(target, ancestor) {\n var mat = matrix.identity([]);\n\n while (target && target !== ancestor) {\n matrix.mul(mat, target.getLocalTransform(), mat);\n target = target.parent;\n }\n\n return mat;\n}\n/**\n * Apply transform to an vertex.\n * @param target [x, y]\n * @param transform Can be:\n * + Transform matrix: like [1, 0, 0, 1, 0, 0]\n * + {position, rotation, scale}, the same as `zrender/Transformable`.\n * @param invert Whether use invert matrix.\n * @return [x, y]\n */\n\nexport function applyTransform(target, transform, invert) {\n if (transform && !isArrayLike(transform)) {\n transform = Transformable.getLocalTransform(transform);\n }\n\n if (invert) {\n transform = matrix.invert([], transform);\n }\n\n return vector.applyTransform([], target, transform);\n}\n/**\n * @param direction 'left' 'right' 'top' 'bottom'\n * @param transform Transform matrix: like [1, 0, 0, 1, 0, 0]\n * @param invert Whether use invert matrix.\n * @return Transformed direction. 'left' 'right' 'top' 'bottom'\n */\n\nexport function transformDirection(direction, transform, invert) {\n // Pick a base, ensure that transform result will not be (0, 0).\n var hBase = transform[4] === 0 || transform[5] === 0 || transform[0] === 0 ? 1 : Math.abs(2 * transform[4] / transform[0]);\n var vBase = transform[4] === 0 || transform[5] === 0 || transform[2] === 0 ? 1 : Math.abs(2 * transform[4] / transform[2]);\n var vertex = [direction === 'left' ? -hBase : direction === 'right' ? hBase : 0, direction === 'top' ? -vBase : direction === 'bottom' ? vBase : 0];\n vertex = applyTransform(vertex, transform, invert);\n return Math.abs(vertex[0]) > Math.abs(vertex[1]) ? vertex[0] > 0 ? 'right' : 'left' : vertex[1] > 0 ? 'bottom' : 'top';\n}\n\nfunction isNotGroup(el) {\n return !el.isGroup;\n}\n\nfunction isPath(el) {\n return el.shape != null;\n}\n/**\n * Apply group transition animation from g1 to g2.\n * If no animatableModel, no animation.\n */\n\n\nexport function groupTransition(g1, g2, animatableModel) {\n if (!g1 || !g2) {\n return;\n }\n\n function getElMap(g) {\n var elMap = {};\n g.traverse(function (el) {\n if (isNotGroup(el) && el.anid) {\n elMap[el.anid] = el;\n }\n });\n return elMap;\n }\n\n function getAnimatableProps(el) {\n var obj = {\n x: el.x,\n y: el.y,\n rotation: el.rotation\n };\n\n if (isPath(el)) {\n obj.shape = extend({}, el.shape);\n }\n\n return obj;\n }\n\n var elMap1 = getElMap(g1);\n g2.traverse(function (el) {\n if (isNotGroup(el) && el.anid) {\n var oldEl = elMap1[el.anid];\n\n if (oldEl) {\n var newProp = getAnimatableProps(el);\n el.attr(getAnimatableProps(oldEl));\n updateProps(el, newProp, animatableModel, getECData(el).dataIndex);\n }\n }\n });\n}\nexport function clipPointsByRect(points, rect) {\n // FIXME: this way migth be incorrect when grpahic clipped by a corner.\n // and when element have border.\n return map(points, function (point) {\n var x = point[0];\n x = mathMax(x, rect.x);\n x = mathMin(x, rect.x + rect.width);\n var y = point[1];\n y = mathMax(y, rect.y);\n y = mathMin(y, rect.y + rect.height);\n return [x, y];\n });\n}\n/**\n * Return a new clipped rect. If rect size are negative, return undefined.\n */\n\nexport function clipRectByRect(targetRect, rect) {\n var x = mathMax(targetRect.x, rect.x);\n var x2 = mathMin(targetRect.x + targetRect.width, rect.x + rect.width);\n var y = mathMax(targetRect.y, rect.y);\n var y2 = mathMin(targetRect.y + targetRect.height, rect.y + rect.height); // If the total rect is cliped, nothing, including the border,\n // should be painted. So return undefined.\n\n if (x2 >= x && y2 >= y) {\n return {\n x: x,\n y: y,\n width: x2 - x,\n height: y2 - y\n };\n }\n}\nexport function createIcon(iconStr, // Support 'image://' or 'path://' or direct svg path.\nopt, rect) {\n var innerOpts = extend({\n rectHover: true\n }, opt);\n var style = innerOpts.style = {\n strokeNoScale: true\n };\n rect = rect || {\n x: -1,\n y: -1,\n width: 2,\n height: 2\n };\n\n if (iconStr) {\n return iconStr.indexOf('image://') === 0 ? (style.image = iconStr.slice(8), defaults(style, rect), new ZRImage(innerOpts)) : makePath(iconStr.replace('path://', ''), innerOpts, rect, 'center');\n }\n}\n/**\n * Return `true` if the given line (line `a`) and the given polygon\n * are intersect.\n * Note that we do not count colinear as intersect here because no\n * requirement for that. We could do that if required in future.\n */\n\nexport function linePolygonIntersect(a1x, a1y, a2x, a2y, points) {\n for (var i = 0, p2 = points[points.length - 1]; i < points.length; i++) {\n var p = points[i];\n\n if (lineLineIntersect(a1x, a1y, a2x, a2y, p[0], p[1], p2[0], p2[1])) {\n return true;\n }\n\n p2 = p;\n }\n}\n/**\n * Return `true` if the given two lines (line `a` and line `b`)\n * are intersect.\n * Note that we do not count colinear as intersect here because no\n * requirement for that. We could do that if required in future.\n */\n\nexport function lineLineIntersect(a1x, a1y, a2x, a2y, b1x, b1y, b2x, b2y) {\n // let `vec_m` to be `vec_a2 - vec_a1` and `vec_n` to be `vec_b2 - vec_b1`.\n var mx = a2x - a1x;\n var my = a2y - a1y;\n var nx = b2x - b1x;\n var ny = b2y - b1y; // `vec_m` and `vec_n` are parallel iff\n // exising `k` such that `vec_m = k · vec_n`, equivalent to `vec_m X vec_n = 0`.\n\n var nmCrossProduct = crossProduct2d(nx, ny, mx, my);\n\n if (nearZero(nmCrossProduct)) {\n return false;\n } // `vec_m` and `vec_n` are intersect iff\n // existing `p` and `q` in [0, 1] such that `vec_a1 + p * vec_m = vec_b1 + q * vec_n`,\n // such that `q = ((vec_a1 - vec_b1) X vec_m) / (vec_n X vec_m)`\n // and `p = ((vec_a1 - vec_b1) X vec_n) / (vec_n X vec_m)`.\n\n\n var b1a1x = a1x - b1x;\n var b1a1y = a1y - b1y;\n var q = crossProduct2d(b1a1x, b1a1y, mx, my) / nmCrossProduct;\n\n if (q < 0 || q > 1) {\n return false;\n }\n\n var p = crossProduct2d(b1a1x, b1a1y, nx, ny) / nmCrossProduct;\n\n if (p < 0 || p > 1) {\n return false;\n }\n\n return true;\n}\n/**\n * Cross product of 2-dimension vector.\n */\n\nfunction crossProduct2d(x1, y1, x2, y2) {\n return x1 * y2 - x2 * y1;\n}\n\nfunction nearZero(val) {\n return val <= 1e-6 && val >= -1e-6;\n}\n\nexport function setTooltipConfig(opt) {\n var itemTooltipOption = opt.itemTooltipOption;\n var componentModel = opt.componentModel;\n var itemName = opt.itemName;\n var itemTooltipOptionObj = isString(itemTooltipOption) ? {\n formatter: itemTooltipOption\n } : itemTooltipOption;\n var mainType = componentModel.mainType;\n var componentIndex = componentModel.componentIndex;\n var formatterParams = {\n componentType: mainType,\n name: itemName,\n $vars: ['name']\n };\n formatterParams[mainType + 'Index'] = componentIndex;\n var formatterParamsExtra = opt.formatterParamsExtra;\n\n if (formatterParamsExtra) {\n each(keys(formatterParamsExtra), function (key) {\n if (!hasOwn(formatterParams, key)) {\n formatterParams[key] = formatterParamsExtra[key];\n formatterParams.$vars.push(key);\n }\n });\n }\n\n var ecData = getECData(opt.el);\n ecData.componentMainType = mainType;\n ecData.componentIndex = componentIndex;\n ecData.tooltipConfig = {\n name: itemName,\n option: defaults({\n content: itemName,\n formatterParams: formatterParams\n }, itemTooltipOptionObj)\n };\n}\n\nfunction traverseElement(el, cb) {\n var stopped; // TODO\n // Polyfill for fixing zrender group traverse don't visit it's root issue.\n\n if (el.isGroup) {\n stopped = cb(el);\n }\n\n if (!stopped) {\n el.traverse(cb);\n }\n}\n\nexport function traverseElements(els, cb) {\n if (els) {\n if (isArray(els)) {\n for (var i = 0; i < els.length; i++) {\n traverseElement(els[i], cb);\n }\n } else {\n traverseElement(els, cb);\n }\n }\n} // Register built-in shapes. These shapes might be overwirtten\n// by users, although we do not recommend that.\n\nregisterShape('circle', Circle);\nregisterShape('ellipse', Ellipse);\nregisterShape('sector', Sector);\nregisterShape('ring', Ring);\nregisterShape('polygon', Polygon);\nregisterShape('polyline', Polyline);\nregisterShape('rect', Rect);\nregisterShape('line', Line);\nregisterShape('bezierCurve', BezierCurve);\nregisterShape('arc', Arc);\nexport { Group, ZRImage as Image, ZRText as Text, Circle, Ellipse, Sector, Ring, Polygon, Polyline, Rect, Line, BezierCurve, Arc, IncrementalDisplayable, CompoundPath, LinearGradient, RadialGradient, BoundingRect, OrientedBoundingRect, Point, Path };","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { each } from 'zrender/lib/core/util.js';\nimport Group from 'zrender/lib/graphic/Group.js';\nimport * as componentUtil from '../util/component.js';\nimport * as clazzUtil from '../util/clazz.js';\nimport * as modelUtil from '../util/model.js';\nimport { enterEmphasis, leaveEmphasis, getHighlightDigit, isHighDownDispatcher } from '../util/states.js';\nimport { createTask } from '../core/task.js';\nimport createRenderPlanner from '../chart/helper/createRenderPlanner.js';\nimport { traverseElements } from '../util/graphic.js';\nimport { error } from '../util/log.js';\nvar inner = modelUtil.makeInner();\nvar renderPlanner = createRenderPlanner();\n\nvar ChartView =\n/** @class */\nfunction () {\n function ChartView() {\n this.group = new Group();\n this.uid = componentUtil.getUID('viewChart');\n this.renderTask = createTask({\n plan: renderTaskPlan,\n reset: renderTaskReset\n });\n this.renderTask.context = {\n view: this\n };\n }\n\n ChartView.prototype.init = function (ecModel, api) {};\n\n ChartView.prototype.render = function (seriesModel, ecModel, api, payload) {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error('render method must been implemented');\n }\n };\n /**\n * Highlight series or specified data item.\n */\n\n\n ChartView.prototype.highlight = function (seriesModel, ecModel, api, payload) {\n var data = seriesModel.getData(payload && payload.dataType);\n\n if (!data) {\n if (process.env.NODE_ENV !== 'production') {\n error(\"Unknown dataType \" + payload.dataType);\n }\n\n return;\n }\n\n toggleHighlight(data, payload, 'emphasis');\n };\n /**\n * Downplay series or specified data item.\n */\n\n\n ChartView.prototype.downplay = function (seriesModel, ecModel, api, payload) {\n var data = seriesModel.getData(payload && payload.dataType);\n\n if (!data) {\n if (process.env.NODE_ENV !== 'production') {\n error(\"Unknown dataType \" + payload.dataType);\n }\n\n return;\n }\n\n toggleHighlight(data, payload, 'normal');\n };\n /**\n * Remove self.\n */\n\n\n ChartView.prototype.remove = function (ecModel, api) {\n this.group.removeAll();\n };\n /**\n * Dispose self.\n */\n\n\n ChartView.prototype.dispose = function (ecModel, api) {};\n\n ChartView.prototype.updateView = function (seriesModel, ecModel, api, payload) {\n this.render(seriesModel, ecModel, api, payload);\n }; // FIXME never used?\n\n\n ChartView.prototype.updateLayout = function (seriesModel, ecModel, api, payload) {\n this.render(seriesModel, ecModel, api, payload);\n }; // FIXME never used?\n\n\n ChartView.prototype.updateVisual = function (seriesModel, ecModel, api, payload) {\n this.render(seriesModel, ecModel, api, payload);\n };\n /**\n * Traverse the new rendered elements.\n *\n * It will traverse the new added element in progressive rendering.\n * And traverse all in normal rendering.\n */\n\n\n ChartView.prototype.eachRendered = function (cb) {\n traverseElements(this.group, cb);\n };\n\n ChartView.markUpdateMethod = function (payload, methodName) {\n inner(payload).updateMethod = methodName;\n };\n\n ChartView.protoInitialize = function () {\n var proto = ChartView.prototype;\n proto.type = 'chart';\n }();\n\n return ChartView;\n}();\n\n;\n/**\n * Set state of single element\n */\n\nfunction elSetState(el, state, highlightDigit) {\n if (el && isHighDownDispatcher(el)) {\n (state === 'emphasis' ? enterEmphasis : leaveEmphasis)(el, highlightDigit);\n }\n}\n\nfunction toggleHighlight(data, payload, state) {\n var dataIndex = modelUtil.queryDataIndex(data, payload);\n var highlightDigit = payload && payload.highlightKey != null ? getHighlightDigit(payload.highlightKey) : null;\n\n if (dataIndex != null) {\n each(modelUtil.normalizeToArray(dataIndex), function (dataIdx) {\n elSetState(data.getItemGraphicEl(dataIdx), state, highlightDigit);\n });\n } else {\n data.eachItemGraphicEl(function (el) {\n elSetState(el, state, highlightDigit);\n });\n }\n}\n\nclazzUtil.enableClassExtend(ChartView, ['dispose']);\nclazzUtil.enableClassManagement(ChartView);\n\nfunction renderTaskPlan(context) {\n return renderPlanner(context.model);\n}\n\nfunction renderTaskReset(context) {\n var seriesModel = context.model;\n var ecModel = context.ecModel;\n var api = context.api;\n var payload = context.payload; // FIXME: remove updateView updateVisual\n\n var progressiveRender = seriesModel.pipelineContext.progressiveRender;\n var view = context.view;\n var updateMethod = payload && inner(payload).updateMethod;\n var methodName = progressiveRender ? 'incrementalPrepareRender' : updateMethod && view[updateMethod] ? updateMethod // `appendData` is also supported when data amount\n // is less than progressive threshold.\n : 'render';\n\n if (methodName !== 'render') {\n view[methodName](seriesModel, ecModel, api, payload);\n }\n\n return progressMethodMap[methodName];\n}\n\nvar progressMethodMap = {\n incrementalPrepareRender: {\n progress: function (params, context) {\n context.view.incrementalRender(params, context.model, context.ecModel, context.api, context.payload);\n }\n },\n render: {\n // Put view.render in `progress` to support appendData. But in this case\n // view.render should not be called in reset, otherwise it will be called\n // twise. Use `forceFirstProgress` to make sure that view.render is called\n // in any cases.\n forceFirstProgress: true,\n progress: function (params, context) {\n context.view.render(context.model, context.ecModel, context.api, context.payload);\n }\n }\n};\nexport default ChartView;","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nvar ORIGIN_METHOD = '\\0__throttleOriginMethod';\nvar RATE = '\\0__throttleRate';\nvar THROTTLE_TYPE = '\\0__throttleType';\n;\n/**\n * @public\n * @param {(Function)} fn\n * @param {number} [delay=0] Unit: ms.\n * @param {boolean} [debounce=false]\n * true: If call interval less than `delay`, only the last call works.\n * false: If call interval less than `delay, call works on fixed rate.\n * @return {(Function)} throttled fn.\n */\n\nexport function throttle(fn, delay, debounce) {\n var currCall;\n var lastCall = 0;\n var lastExec = 0;\n var timer = null;\n var diff;\n var scope;\n var args;\n var debounceNextCall;\n delay = delay || 0;\n\n function exec() {\n lastExec = new Date().getTime();\n timer = null;\n fn.apply(scope, args || []);\n }\n\n var cb = function () {\n var cbArgs = [];\n\n for (var _i = 0; _i < arguments.length; _i++) {\n cbArgs[_i] = arguments[_i];\n }\n\n currCall = new Date().getTime();\n scope = this;\n args = cbArgs;\n var thisDelay = debounceNextCall || delay;\n var thisDebounce = debounceNextCall || debounce;\n debounceNextCall = null;\n diff = currCall - (thisDebounce ? lastCall : lastExec) - thisDelay;\n clearTimeout(timer); // Here we should make sure that: the `exec` SHOULD NOT be called later\n // than a new call of `cb`, that is, preserving the command order. Consider\n // calculating \"scale rate\" when roaming as an example. When a call of `cb`\n // happens, either the `exec` is called dierectly, or the call is delayed.\n // But the delayed call should never be later than next call of `cb`. Under\n // this assurance, we can simply update view state each time `dispatchAction`\n // triggered by user roaming, but not need to add extra code to avoid the\n // state being \"rolled-back\".\n\n if (thisDebounce) {\n timer = setTimeout(exec, thisDelay);\n } else {\n if (diff >= 0) {\n exec();\n } else {\n timer = setTimeout(exec, -diff);\n }\n }\n\n lastCall = currCall;\n };\n /**\n * Clear throttle.\n * @public\n */\n\n\n cb.clear = function () {\n if (timer) {\n clearTimeout(timer);\n timer = null;\n }\n };\n /**\n * Enable debounce once.\n */\n\n\n cb.debounceNextCall = function (debounceDelay) {\n debounceNextCall = debounceDelay;\n };\n\n return cb;\n}\n/**\n * Create throttle method or update throttle rate.\n *\n * @example\n * ComponentView.prototype.render = function () {\n * ...\n * throttle.createOrUpdate(\n * this,\n * '_dispatchAction',\n * this.model.get('throttle'),\n * 'fixRate'\n * );\n * };\n * ComponentView.prototype.remove = function () {\n * throttle.clear(this, '_dispatchAction');\n * };\n * ComponentView.prototype.dispose = function () {\n * throttle.clear(this, '_dispatchAction');\n * };\n *\n */\n\nexport function createOrUpdate(obj, fnAttr, rate, throttleType) {\n var fn = obj[fnAttr];\n\n if (!fn) {\n return;\n }\n\n var originFn = fn[ORIGIN_METHOD] || fn;\n var lastThrottleType = fn[THROTTLE_TYPE];\n var lastRate = fn[RATE];\n\n if (lastRate !== rate || lastThrottleType !== throttleType) {\n if (rate == null || !throttleType) {\n return obj[fnAttr] = originFn;\n }\n\n fn = obj[fnAttr] = throttle(originFn, rate, throttleType === 'debounce');\n fn[ORIGIN_METHOD] = originFn;\n fn[THROTTLE_TYPE] = throttleType;\n fn[RATE] = rate;\n }\n\n return fn;\n}\n/**\n * Clear throttle. Example see throttle.createOrUpdate.\n */\n\nexport function clear(obj, fnAttr) {\n var fn = obj[fnAttr];\n\n if (fn && fn[ORIGIN_METHOD]) {\n // Clear throttle\n fn.clear && fn.clear();\n obj[fnAttr] = fn[ORIGIN_METHOD];\n }\n}","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { isFunction, extend, createHashMap } from 'zrender/lib/core/util.js';\nimport makeStyleMapper from '../model/mixin/makeStyleMapper.js';\nimport { ITEM_STYLE_KEY_MAP } from '../model/mixin/itemStyle.js';\nimport { LINE_STYLE_KEY_MAP } from '../model/mixin/lineStyle.js';\nimport Model from '../model/Model.js';\nimport { makeInner } from '../util/model.js';\nvar inner = makeInner();\nvar defaultStyleMappers = {\n itemStyle: makeStyleMapper(ITEM_STYLE_KEY_MAP, true),\n lineStyle: makeStyleMapper(LINE_STYLE_KEY_MAP, true)\n};\nvar defaultColorKey = {\n lineStyle: 'stroke',\n itemStyle: 'fill'\n};\n\nfunction getStyleMapper(seriesModel, stylePath) {\n var styleMapper = seriesModel.visualStyleMapper || defaultStyleMappers[stylePath];\n\n if (!styleMapper) {\n console.warn(\"Unkown style type '\" + stylePath + \"'.\");\n return defaultStyleMappers.itemStyle;\n }\n\n return styleMapper;\n}\n\nfunction getDefaultColorKey(seriesModel, stylePath) {\n // return defaultColorKey[stylePath] ||\n var colorKey = seriesModel.visualDrawType || defaultColorKey[stylePath];\n\n if (!colorKey) {\n console.warn(\"Unkown style type '\" + stylePath + \"'.\");\n return 'fill';\n }\n\n return colorKey;\n}\n\nvar seriesStyleTask = {\n createOnAllSeries: true,\n performRawSeries: true,\n reset: function (seriesModel, ecModel) {\n var data = seriesModel.getData();\n var stylePath = seriesModel.visualStyleAccessPath || 'itemStyle'; // Set in itemStyle\n\n var styleModel = seriesModel.getModel(stylePath);\n var getStyle = getStyleMapper(seriesModel, stylePath);\n var globalStyle = getStyle(styleModel);\n var decalOption = styleModel.getShallow('decal');\n\n if (decalOption) {\n data.setVisual('decal', decalOption);\n decalOption.dirty = true;\n } // TODO\n\n\n var colorKey = getDefaultColorKey(seriesModel, stylePath);\n var color = globalStyle[colorKey]; // TODO style callback\n\n var colorCallback = isFunction(color) ? color : null;\n var hasAutoColor = globalStyle.fill === 'auto' || globalStyle.stroke === 'auto'; // Get from color palette by default.\n\n if (!globalStyle[colorKey] || colorCallback || hasAutoColor) {\n // Note: if some series has color specified (e.g., by itemStyle.color), we DO NOT\n // make it effect palette. Bacause some scenarios users need to make some series\n // transparent or as background, which should better not effect the palette.\n var colorPalette = seriesModel.getColorFromPalette( // TODO series count changed.\n seriesModel.name, null, ecModel.getSeriesCount());\n\n if (!globalStyle[colorKey]) {\n globalStyle[colorKey] = colorPalette;\n data.setVisual('colorFromPalette', true);\n }\n\n globalStyle.fill = globalStyle.fill === 'auto' || isFunction(globalStyle.fill) ? colorPalette : globalStyle.fill;\n globalStyle.stroke = globalStyle.stroke === 'auto' || isFunction(globalStyle.stroke) ? colorPalette : globalStyle.stroke;\n }\n\n data.setVisual('style', globalStyle);\n data.setVisual('drawType', colorKey); // Only visible series has each data be visual encoded\n\n if (!ecModel.isSeriesFiltered(seriesModel) && colorCallback) {\n data.setVisual('colorFromPalette', false);\n return {\n dataEach: function (data, idx) {\n var dataParams = seriesModel.getDataParams(idx);\n var itemStyle = extend({}, globalStyle);\n itemStyle[colorKey] = colorCallback(dataParams);\n data.setItemVisual(idx, 'style', itemStyle);\n }\n };\n }\n }\n};\nvar sharedModel = new Model();\nvar dataStyleTask = {\n createOnAllSeries: true,\n performRawSeries: true,\n reset: function (seriesModel, ecModel) {\n if (seriesModel.ignoreStyleOnData || ecModel.isSeriesFiltered(seriesModel)) {\n return;\n }\n\n var data = seriesModel.getData();\n var stylePath = seriesModel.visualStyleAccessPath || 'itemStyle'; // Set in itemStyle\n\n var getStyle = getStyleMapper(seriesModel, stylePath);\n var colorKey = data.getVisual('drawType');\n return {\n dataEach: data.hasItemOption ? function (data, idx) {\n // Not use getItemModel for performance considuration\n var rawItem = data.getRawDataItem(idx);\n\n if (rawItem && rawItem[stylePath]) {\n sharedModel.option = rawItem[stylePath];\n var style = getStyle(sharedModel);\n var existsStyle = data.ensureUniqueItemVisual(idx, 'style');\n extend(existsStyle, style);\n\n if (sharedModel.option.decal) {\n data.setItemVisual(idx, 'decal', sharedModel.option.decal);\n sharedModel.option.decal.dirty = true;\n }\n\n if (colorKey in style) {\n data.setItemVisual(idx, 'colorFromPalette', false);\n }\n }\n } : null\n };\n }\n}; // Pick color from palette for the data which has not been set with color yet.\n// Note: do not support stream rendering. No such cases yet.\n\nvar dataColorPaletteTask = {\n performRawSeries: true,\n overallReset: function (ecModel) {\n // Each type of series use one scope.\n // Pie and funnel are using diferrent scopes\n var paletteScopeGroupByType = createHashMap();\n ecModel.eachSeries(function (seriesModel) {\n var colorBy = seriesModel.getColorBy();\n\n if (seriesModel.isColorBySeries()) {\n return;\n }\n\n var key = seriesModel.type + '-' + colorBy;\n var colorScope = paletteScopeGroupByType.get(key);\n\n if (!colorScope) {\n colorScope = {};\n paletteScopeGroupByType.set(key, colorScope);\n }\n\n inner(seriesModel).scope = colorScope;\n });\n ecModel.eachSeries(function (seriesModel) {\n if (seriesModel.isColorBySeries() || ecModel.isSeriesFiltered(seriesModel)) {\n return;\n }\n\n var dataAll = seriesModel.getRawData();\n var idxMap = {};\n var data = seriesModel.getData();\n var colorScope = inner(seriesModel).scope;\n var stylePath = seriesModel.visualStyleAccessPath || 'itemStyle';\n var colorKey = getDefaultColorKey(seriesModel, stylePath);\n data.each(function (idx) {\n var rawIdx = data.getRawIndex(idx);\n idxMap[rawIdx] = idx;\n }); // Iterate on data before filtered. To make sure color from palette can be\n // Consistent when toggling legend.\n\n dataAll.each(function (rawIdx) {\n var idx = idxMap[rawIdx];\n var fromPalette = data.getItemVisual(idx, 'colorFromPalette'); // Get color from palette for each data only when the color is inherited from series color, which is\n // also picked from color palette. So following situation is not in the case:\n // 1. series.itemStyle.color is set\n // 2. color is encoded by visualMap\n\n if (fromPalette) {\n var itemStyle = data.ensureUniqueItemVisual(idx, 'style');\n var name_1 = dataAll.getName(rawIdx) || rawIdx + '';\n var dataCount = dataAll.count();\n itemStyle[colorKey] = seriesModel.getColorFromPalette(name_1, colorScope, dataCount);\n }\n });\n });\n }\n};\nexport { seriesStyleTask, dataStyleTask, dataColorPaletteTask };","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport * as zrUtil from 'zrender/lib/core/util.js';\nimport * as graphic from '../util/graphic.js';\nvar PI = Math.PI;\n/**\n * @param {module:echarts/ExtensionAPI} api\n * @param {Object} [opts]\n * @param {string} [opts.text]\n * @param {string} [opts.color]\n * @param {string} [opts.textColor]\n * @return {module:zrender/Element}\n */\n\nexport default function defaultLoading(api, opts) {\n opts = opts || {};\n zrUtil.defaults(opts, {\n text: 'loading',\n textColor: '#000',\n fontSize: 12,\n fontWeight: 'normal',\n fontStyle: 'normal',\n fontFamily: 'sans-serif',\n maskColor: 'rgba(255, 255, 255, 0.8)',\n showSpinner: true,\n color: '#5470c6',\n spinnerRadius: 10,\n lineWidth: 5,\n zlevel: 0\n });\n var group = new graphic.Group();\n var mask = new graphic.Rect({\n style: {\n fill: opts.maskColor\n },\n zlevel: opts.zlevel,\n z: 10000\n });\n group.add(mask);\n var textContent = new graphic.Text({\n style: {\n text: opts.text,\n fill: opts.textColor,\n fontSize: opts.fontSize,\n fontWeight: opts.fontWeight,\n fontStyle: opts.fontStyle,\n fontFamily: opts.fontFamily\n },\n zlevel: opts.zlevel,\n z: 10001\n });\n var labelRect = new graphic.Rect({\n style: {\n fill: 'none'\n },\n textContent: textContent,\n textConfig: {\n position: 'right',\n distance: 10\n },\n zlevel: opts.zlevel,\n z: 10001\n });\n group.add(labelRect);\n var arc;\n\n if (opts.showSpinner) {\n arc = new graphic.Arc({\n shape: {\n startAngle: -PI / 2,\n endAngle: -PI / 2 + 0.1,\n r: opts.spinnerRadius\n },\n style: {\n stroke: opts.color,\n lineCap: 'round',\n lineWidth: opts.lineWidth\n },\n zlevel: opts.zlevel,\n z: 10001\n });\n arc.animateShape(true).when(1000, {\n endAngle: PI * 3 / 2\n }).start('circularInOut');\n arc.animateShape(true).when(1000, {\n startAngle: PI * 3 / 2\n }).delay(300).start('circularInOut');\n group.add(arc);\n } // Inject resize\n\n\n group.resize = function () {\n var textWidth = textContent.getBoundingRect().width;\n var r = opts.showSpinner ? opts.spinnerRadius : 0; // cx = (containerWidth - arcDiameter - textDistance - textWidth) / 2\n // textDistance needs to be calculated when both animation and text exist\n\n var cx = (api.getWidth() - r * 2 - (opts.showSpinner && textWidth ? 10 : 0) - textWidth) / 2 - (opts.showSpinner && textWidth ? 0 : 5 + textWidth / 2) // only show the text\n + (opts.showSpinner ? 0 : textWidth / 2) // only show the spinner\n + (textWidth ? 0 : r);\n var cy = api.getHeight() / 2;\n opts.showSpinner && arc.setShape({\n cx: cx,\n cy: cy\n });\n labelRect.setShape({\n x: cx - r,\n y: cy - r,\n width: r * 2,\n height: r * 2\n });\n mask.setShape({\n x: 0,\n y: 0,\n width: api.getWidth(),\n height: api.getHeight()\n });\n };\n\n group.resize();\n return group;\n}","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { each, map, isFunction, createHashMap, noop, assert } from 'zrender/lib/core/util.js';\nimport { createTask } from './task.js';\nimport { getUID } from '../util/component.js';\nimport GlobalModel from '../model/Global.js';\nimport ExtensionAPI from './ExtensionAPI.js';\nimport { normalizeToArray } from '../util/model.js';\n;\n\nvar Scheduler =\n/** @class */\nfunction () {\n function Scheduler(ecInstance, api, dataProcessorHandlers, visualHandlers) {\n // key: handlerUID\n this._stageTaskMap = createHashMap();\n this.ecInstance = ecInstance;\n this.api = api; // Fix current processors in case that in some rear cases that\n // processors might be registered after echarts instance created.\n // Register processors incrementally for a echarts instance is\n // not supported by this stream architecture.\n\n dataProcessorHandlers = this._dataProcessorHandlers = dataProcessorHandlers.slice();\n visualHandlers = this._visualHandlers = visualHandlers.slice();\n this._allHandlers = dataProcessorHandlers.concat(visualHandlers);\n }\n\n Scheduler.prototype.restoreData = function (ecModel, payload) {\n // TODO: Only restore needed series and components, but not all components.\n // Currently `restoreData` of all of the series and component will be called.\n // But some independent components like `title`, `legend`, `graphic`, `toolbox`,\n // `tooltip`, `axisPointer`, etc, do not need series refresh when `setOption`,\n // and some components like coordinate system, axes, dataZoom, visualMap only\n // need their target series refresh.\n // (1) If we are implementing this feature some day, we should consider these cases:\n // if a data processor depends on a component (e.g., dataZoomProcessor depends\n // on the settings of `dataZoom`), it should be re-performed if the component\n // is modified by `setOption`.\n // (2) If a processor depends on sevral series, speicified by its `getTargetSeries`,\n // it should be re-performed when the result array of `getTargetSeries` changed.\n // We use `dependencies` to cover these issues.\n // (3) How to update target series when coordinate system related components modified.\n // TODO: simply the dirty mechanism? Check whether only the case here can set tasks dirty,\n // and this case all of the tasks will be set as dirty.\n ecModel.restoreData(payload); // Theoretically an overall task not only depends on each of its target series, but also\n // depends on all of the series.\n // The overall task is not in pipeline, and `ecModel.restoreData` only set pipeline tasks\n // dirty. If `getTargetSeries` of an overall task returns nothing, we should also ensure\n // that the overall task is set as dirty and to be performed, otherwise it probably cause\n // state chaos. So we have to set dirty of all of the overall tasks manually, otherwise it\n // probably cause state chaos (consider `dataZoomProcessor`).\n\n this._stageTaskMap.each(function (taskRecord) {\n var overallTask = taskRecord.overallTask;\n overallTask && overallTask.dirty();\n });\n }; // If seriesModel provided, incremental threshold is check by series data.\n\n\n Scheduler.prototype.getPerformArgs = function (task, isBlock) {\n // For overall task\n if (!task.__pipeline) {\n return;\n }\n\n var pipeline = this._pipelineMap.get(task.__pipeline.id);\n\n var pCtx = pipeline.context;\n var incremental = !isBlock && pipeline.progressiveEnabled && (!pCtx || pCtx.progressiveRender) && task.__idxInPipeline > pipeline.blockIndex;\n var step = incremental ? pipeline.step : null;\n var modDataCount = pCtx && pCtx.modDataCount;\n var modBy = modDataCount != null ? Math.ceil(modDataCount / step) : null;\n return {\n step: step,\n modBy: modBy,\n modDataCount: modDataCount\n };\n };\n\n Scheduler.prototype.getPipeline = function (pipelineId) {\n return this._pipelineMap.get(pipelineId);\n };\n /**\n * Current, progressive rendering starts from visual and layout.\n * Always detect render mode in the same stage, avoiding that incorrect\n * detection caused by data filtering.\n * Caution:\n * `updateStreamModes` use `seriesModel.getData()`.\n */\n\n\n Scheduler.prototype.updateStreamModes = function (seriesModel, view) {\n var pipeline = this._pipelineMap.get(seriesModel.uid);\n\n var data = seriesModel.getData();\n var dataLen = data.count(); // `progressiveRender` means that can render progressively in each\n // animation frame. Note that some types of series do not provide\n // `view.incrementalPrepareRender` but support `chart.appendData`. We\n // use the term `incremental` but not `progressive` to describe the\n // case that `chart.appendData`.\n\n var progressiveRender = pipeline.progressiveEnabled && view.incrementalPrepareRender && dataLen >= pipeline.threshold;\n var large = seriesModel.get('large') && dataLen >= seriesModel.get('largeThreshold'); // TODO: modDataCount should not updated if `appendData`, otherwise cause whole repaint.\n // see `test/candlestick-large3.html`\n\n var modDataCount = seriesModel.get('progressiveChunkMode') === 'mod' ? dataLen : null;\n seriesModel.pipelineContext = pipeline.context = {\n progressiveRender: progressiveRender,\n modDataCount: modDataCount,\n large: large\n };\n };\n\n Scheduler.prototype.restorePipelines = function (ecModel) {\n var scheduler = this;\n var pipelineMap = scheduler._pipelineMap = createHashMap();\n ecModel.eachSeries(function (seriesModel) {\n var progressive = seriesModel.getProgressive();\n var pipelineId = seriesModel.uid;\n pipelineMap.set(pipelineId, {\n id: pipelineId,\n head: null,\n tail: null,\n threshold: seriesModel.getProgressiveThreshold(),\n progressiveEnabled: progressive && !(seriesModel.preventIncremental && seriesModel.preventIncremental()),\n blockIndex: -1,\n step: Math.round(progressive || 700),\n count: 0\n });\n\n scheduler._pipe(seriesModel, seriesModel.dataTask);\n });\n };\n\n Scheduler.prototype.prepareStageTasks = function () {\n var stageTaskMap = this._stageTaskMap;\n var ecModel = this.api.getModel();\n var api = this.api;\n each(this._allHandlers, function (handler) {\n var record = stageTaskMap.get(handler.uid) || stageTaskMap.set(handler.uid, {});\n var errMsg = '';\n\n if (process.env.NODE_ENV !== 'production') {\n // Currently do not need to support to sepecify them both.\n errMsg = '\"reset\" and \"overallReset\" must not be both specified.';\n }\n\n assert(!(handler.reset && handler.overallReset), errMsg);\n handler.reset && this._createSeriesStageTask(handler, record, ecModel, api);\n handler.overallReset && this._createOverallStageTask(handler, record, ecModel, api);\n }, this);\n };\n\n Scheduler.prototype.prepareView = function (view, model, ecModel, api) {\n var renderTask = view.renderTask;\n var context = renderTask.context;\n context.model = model;\n context.ecModel = ecModel;\n context.api = api;\n renderTask.__block = !view.incrementalPrepareRender;\n\n this._pipe(model, renderTask);\n };\n\n Scheduler.prototype.performDataProcessorTasks = function (ecModel, payload) {\n // If we do not use `block` here, it should be considered when to update modes.\n this._performStageTasks(this._dataProcessorHandlers, ecModel, payload, {\n block: true\n });\n };\n\n Scheduler.prototype.performVisualTasks = function (ecModel, payload, opt) {\n this._performStageTasks(this._visualHandlers, ecModel, payload, opt);\n };\n\n Scheduler.prototype._performStageTasks = function (stageHandlers, ecModel, payload, opt) {\n opt = opt || {};\n var unfinished = false;\n var scheduler = this;\n each(stageHandlers, function (stageHandler, idx) {\n if (opt.visualType && opt.visualType !== stageHandler.visualType) {\n return;\n }\n\n var stageHandlerRecord = scheduler._stageTaskMap.get(stageHandler.uid);\n\n var seriesTaskMap = stageHandlerRecord.seriesTaskMap;\n var overallTask = stageHandlerRecord.overallTask;\n\n if (overallTask) {\n var overallNeedDirty_1;\n var agentStubMap = overallTask.agentStubMap;\n agentStubMap.each(function (stub) {\n if (needSetDirty(opt, stub)) {\n stub.dirty();\n overallNeedDirty_1 = true;\n }\n });\n overallNeedDirty_1 && overallTask.dirty();\n scheduler.updatePayload(overallTask, payload);\n var performArgs_1 = scheduler.getPerformArgs(overallTask, opt.block); // Execute stubs firstly, which may set the overall task dirty,\n // then execute the overall task. And stub will call seriesModel.setData,\n // which ensures that in the overallTask seriesModel.getData() will not\n // return incorrect data.\n\n agentStubMap.each(function (stub) {\n stub.perform(performArgs_1);\n });\n\n if (overallTask.perform(performArgs_1)) {\n unfinished = true;\n }\n } else if (seriesTaskMap) {\n seriesTaskMap.each(function (task, pipelineId) {\n if (needSetDirty(opt, task)) {\n task.dirty();\n }\n\n var performArgs = scheduler.getPerformArgs(task, opt.block); // FIXME\n // if intending to decalare `performRawSeries` in handlers, only\n // stream-independent (specifically, data item independent) operations can be\n // performed. Because is a series is filtered, most of the tasks will not\n // be performed. A stream-dependent operation probably cause wrong biz logic.\n // Perhaps we should not provide a separate callback for this case instead\n // of providing the config `performRawSeries`. The stream-dependent operaions\n // and stream-independent operations should better not be mixed.\n\n performArgs.skip = !stageHandler.performRawSeries && ecModel.isSeriesFiltered(task.context.model);\n scheduler.updatePayload(task, payload);\n\n if (task.perform(performArgs)) {\n unfinished = true;\n }\n });\n }\n });\n\n function needSetDirty(opt, task) {\n return opt.setDirty && (!opt.dirtyMap || opt.dirtyMap.get(task.__pipeline.id));\n }\n\n this.unfinished = unfinished || this.unfinished;\n };\n\n Scheduler.prototype.performSeriesTasks = function (ecModel) {\n var unfinished;\n ecModel.eachSeries(function (seriesModel) {\n // Progress to the end for dataInit and dataRestore.\n unfinished = seriesModel.dataTask.perform() || unfinished;\n });\n this.unfinished = unfinished || this.unfinished;\n };\n\n Scheduler.prototype.plan = function () {\n // Travel pipelines, check block.\n this._pipelineMap.each(function (pipeline) {\n var task = pipeline.tail;\n\n do {\n if (task.__block) {\n pipeline.blockIndex = task.__idxInPipeline;\n break;\n }\n\n task = task.getUpstream();\n } while (task);\n });\n };\n\n Scheduler.prototype.updatePayload = function (task, payload) {\n payload !== 'remain' && (task.context.payload = payload);\n };\n\n Scheduler.prototype._createSeriesStageTask = function (stageHandler, stageHandlerRecord, ecModel, api) {\n var scheduler = this;\n var oldSeriesTaskMap = stageHandlerRecord.seriesTaskMap; // The count of stages are totally about only several dozen, so\n // do not need to reuse the map.\n\n var newSeriesTaskMap = stageHandlerRecord.seriesTaskMap = createHashMap();\n var seriesType = stageHandler.seriesType;\n var getTargetSeries = stageHandler.getTargetSeries; // If a stageHandler should cover all series, `createOnAllSeries` should be declared mandatorily,\n // to avoid some typo or abuse. Otherwise if an extension do not specify a `seriesType`,\n // it works but it may cause other irrelevant charts blocked.\n\n if (stageHandler.createOnAllSeries) {\n ecModel.eachRawSeries(create);\n } else if (seriesType) {\n ecModel.eachRawSeriesByType(seriesType, create);\n } else if (getTargetSeries) {\n getTargetSeries(ecModel, api).each(create);\n }\n\n function create(seriesModel) {\n var pipelineId = seriesModel.uid; // Init tasks for each seriesModel only once.\n // Reuse original task instance.\n\n var task = newSeriesTaskMap.set(pipelineId, oldSeriesTaskMap && oldSeriesTaskMap.get(pipelineId) || createTask({\n plan: seriesTaskPlan,\n reset: seriesTaskReset,\n count: seriesTaskCount\n }));\n task.context = {\n model: seriesModel,\n ecModel: ecModel,\n api: api,\n // PENDING: `useClearVisual` not used?\n useClearVisual: stageHandler.isVisual && !stageHandler.isLayout,\n plan: stageHandler.plan,\n reset: stageHandler.reset,\n scheduler: scheduler\n };\n\n scheduler._pipe(seriesModel, task);\n }\n };\n\n Scheduler.prototype._createOverallStageTask = function (stageHandler, stageHandlerRecord, ecModel, api) {\n var scheduler = this;\n var overallTask = stageHandlerRecord.overallTask = stageHandlerRecord.overallTask // For overall task, the function only be called on reset stage.\n || createTask({\n reset: overallTaskReset\n });\n overallTask.context = {\n ecModel: ecModel,\n api: api,\n overallReset: stageHandler.overallReset,\n scheduler: scheduler\n };\n var oldAgentStubMap = overallTask.agentStubMap; // The count of stages are totally about only several dozen, so\n // do not need to reuse the map.\n\n var newAgentStubMap = overallTask.agentStubMap = createHashMap();\n var seriesType = stageHandler.seriesType;\n var getTargetSeries = stageHandler.getTargetSeries;\n var overallProgress = true;\n var shouldOverallTaskDirty = false; // FIXME:TS never used, so comment it\n // let modifyOutputEnd = stageHandler.modifyOutputEnd;\n // An overall task with seriesType detected or has `getTargetSeries`, we add\n // stub in each pipelines, it will set the overall task dirty when the pipeline\n // progress. Moreover, to avoid call the overall task each frame (too frequent),\n // we set the pipeline block.\n\n var errMsg = '';\n\n if (process.env.NODE_ENV !== 'production') {\n errMsg = '\"createOnAllSeries\" do not supported for \"overallReset\", ' + 'becuase it will block all streams.';\n }\n\n assert(!stageHandler.createOnAllSeries, errMsg);\n\n if (seriesType) {\n ecModel.eachRawSeriesByType(seriesType, createStub);\n } else if (getTargetSeries) {\n getTargetSeries(ecModel, api).each(createStub);\n } // Otherwise, (usually it is legancy case), the overall task will only be\n // executed when upstream dirty. Otherwise the progressive rendering of all\n // pipelines will be disabled unexpectedly. But it still needs stubs to receive\n // dirty info from upsteam.\n else {\n overallProgress = false;\n each(ecModel.getSeries(), createStub);\n }\n\n function createStub(seriesModel) {\n var pipelineId = seriesModel.uid;\n var stub = newAgentStubMap.set(pipelineId, oldAgentStubMap && oldAgentStubMap.get(pipelineId) || ( // When the result of `getTargetSeries` changed, the overallTask\n // should be set as dirty and re-performed.\n shouldOverallTaskDirty = true, createTask({\n reset: stubReset,\n onDirty: stubOnDirty\n })));\n stub.context = {\n model: seriesModel,\n overallProgress: overallProgress // FIXME:TS never used, so comment it\n // modifyOutputEnd: modifyOutputEnd\n\n };\n stub.agent = overallTask;\n stub.__block = overallProgress;\n\n scheduler._pipe(seriesModel, stub);\n }\n\n if (shouldOverallTaskDirty) {\n overallTask.dirty();\n }\n };\n\n Scheduler.prototype._pipe = function (seriesModel, task) {\n var pipelineId = seriesModel.uid;\n\n var pipeline = this._pipelineMap.get(pipelineId);\n\n !pipeline.head && (pipeline.head = task);\n pipeline.tail && pipeline.tail.pipe(task);\n pipeline.tail = task;\n task.__idxInPipeline = pipeline.count++;\n task.__pipeline = pipeline;\n };\n\n Scheduler.wrapStageHandler = function (stageHandler, visualType) {\n if (isFunction(stageHandler)) {\n stageHandler = {\n overallReset: stageHandler,\n seriesType: detectSeriseType(stageHandler)\n };\n }\n\n stageHandler.uid = getUID('stageHandler');\n visualType && (stageHandler.visualType = visualType);\n return stageHandler;\n };\n\n ;\n return Scheduler;\n}();\n\nfunction overallTaskReset(context) {\n context.overallReset(context.ecModel, context.api, context.payload);\n}\n\nfunction stubReset(context) {\n return context.overallProgress && stubProgress;\n}\n\nfunction stubProgress() {\n this.agent.dirty();\n this.getDownstream().dirty();\n}\n\nfunction stubOnDirty() {\n this.agent && this.agent.dirty();\n}\n\nfunction seriesTaskPlan(context) {\n return context.plan ? context.plan(context.model, context.ecModel, context.api, context.payload) : null;\n}\n\nfunction seriesTaskReset(context) {\n if (context.useClearVisual) {\n context.data.clearAllVisual();\n }\n\n var resetDefines = context.resetDefines = normalizeToArray(context.reset(context.model, context.ecModel, context.api, context.payload));\n return resetDefines.length > 1 ? map(resetDefines, function (v, idx) {\n return makeSeriesTaskProgress(idx);\n }) : singleSeriesTaskProgress;\n}\n\nvar singleSeriesTaskProgress = makeSeriesTaskProgress(0);\n\nfunction makeSeriesTaskProgress(resetDefineIdx) {\n return function (params, context) {\n var data = context.data;\n var resetDefine = context.resetDefines[resetDefineIdx];\n\n if (resetDefine && resetDefine.dataEach) {\n for (var i = params.start; i < params.end; i++) {\n resetDefine.dataEach(data, i);\n }\n } else if (resetDefine && resetDefine.progress) {\n resetDefine.progress(params, data);\n }\n };\n}\n\nfunction seriesTaskCount(context) {\n return context.data.count();\n}\n/**\n * Only some legacy stage handlers (usually in echarts extensions) are pure function.\n * To ensure that they can work normally, they should work in block mode, that is,\n * they should not be started util the previous tasks finished. So they cause the\n * progressive rendering disabled. We try to detect the series type, to narrow down\n * the block range to only the series type they concern, but not all series.\n */\n\n\nfunction detectSeriseType(legacyFunc) {\n seriesType = null;\n\n try {\n // Assume there is no async when calling `eachSeriesByType`.\n legacyFunc(ecModelMock, apiMock);\n } catch (e) {}\n\n return seriesType;\n}\n\nvar ecModelMock = {};\nvar apiMock = {};\nvar seriesType;\nmockMethods(ecModelMock, GlobalModel);\nmockMethods(apiMock, ExtensionAPI);\n\necModelMock.eachSeriesByType = ecModelMock.eachRawSeriesByType = function (type) {\n seriesType = type;\n};\n\necModelMock.eachComponent = function (cond) {\n if (cond.mainType === 'series' && cond.subType) {\n seriesType = cond.subType;\n }\n};\n\nfunction mockMethods(target, Clz) {\n /* eslint-disable */\n for (var name_1 in Clz.prototype) {\n // Do not use hasOwnProperty\n target[name_1] = noop;\n }\n /* eslint-enable */\n\n}\n\nexport default Scheduler;","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nvar colorAll = ['#37A2DA', '#32C5E9', '#67E0E3', '#9FE6B8', '#FFDB5C', '#ff9f7f', '#fb7293', '#E062AE', '#E690D1', '#e7bcf3', '#9d96f5', '#8378EA', '#96BFFF'];\nexport default {\n color: colorAll,\n colorLayer: [['#37A2DA', '#ffd85c', '#fd7b5f'], ['#37A2DA', '#67E0E3', '#FFDB5C', '#ff9f7f', '#E062AE', '#9d96f5'], ['#37A2DA', '#32C5E9', '#9FE6B8', '#FFDB5C', '#ff9f7f', '#fb7293', '#e7bcf3', '#8378EA', '#96BFFF'], colorAll]\n};","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nvar contrastColor = '#B9B8CE';\nvar backgroundColor = '#100C2A';\n\nvar axisCommon = function () {\n return {\n axisLine: {\n lineStyle: {\n color: contrastColor\n }\n },\n splitLine: {\n lineStyle: {\n color: '#484753'\n }\n },\n splitArea: {\n areaStyle: {\n color: ['rgba(255,255,255,0.02)', 'rgba(255,255,255,0.05)']\n }\n },\n minorSplitLine: {\n lineStyle: {\n color: '#20203B'\n }\n }\n };\n};\n\nvar colorPalette = ['#4992ff', '#7cffb2', '#fddd60', '#ff6e76', '#58d9f9', '#05c091', '#ff8a45', '#8d48e3', '#dd79ff'];\nvar theme = {\n darkMode: true,\n color: colorPalette,\n backgroundColor: backgroundColor,\n axisPointer: {\n lineStyle: {\n color: '#817f91'\n },\n crossStyle: {\n color: '#817f91'\n },\n label: {\n // TODO Contrast of label backgorundColor\n color: '#fff'\n }\n },\n legend: {\n textStyle: {\n color: contrastColor\n }\n },\n textStyle: {\n color: contrastColor\n },\n title: {\n textStyle: {\n color: '#EEF1FA'\n },\n subtextStyle: {\n color: '#B9B8CE'\n }\n },\n toolbox: {\n iconStyle: {\n borderColor: contrastColor\n }\n },\n dataZoom: {\n borderColor: '#71708A',\n textStyle: {\n color: contrastColor\n },\n brushStyle: {\n color: 'rgba(135,163,206,0.3)'\n },\n handleStyle: {\n color: '#353450',\n borderColor: '#C5CBE3'\n },\n moveHandleStyle: {\n color: '#B0B6C3',\n opacity: 0.3\n },\n fillerColor: 'rgba(135,163,206,0.2)',\n emphasis: {\n handleStyle: {\n borderColor: '#91B7F2',\n color: '#4D587D'\n },\n moveHandleStyle: {\n color: '#636D9A',\n opacity: 0.7\n }\n },\n dataBackground: {\n lineStyle: {\n color: '#71708A',\n width: 1\n },\n areaStyle: {\n color: '#71708A'\n }\n },\n selectedDataBackground: {\n lineStyle: {\n color: '#87A3CE'\n },\n areaStyle: {\n color: '#87A3CE'\n }\n }\n },\n visualMap: {\n textStyle: {\n color: contrastColor\n }\n },\n timeline: {\n lineStyle: {\n color: contrastColor\n },\n label: {\n color: contrastColor\n },\n controlStyle: {\n color: contrastColor,\n borderColor: contrastColor\n }\n },\n calendar: {\n itemStyle: {\n color: backgroundColor\n },\n dayLabel: {\n color: contrastColor\n },\n monthLabel: {\n color: contrastColor\n },\n yearLabel: {\n color: contrastColor\n }\n },\n timeAxis: axisCommon(),\n logAxis: axisCommon(),\n valueAxis: axisCommon(),\n categoryAxis: axisCommon(),\n line: {\n symbol: 'circle'\n },\n graph: {\n color: colorPalette\n },\n gauge: {\n title: {\n color: contrastColor\n },\n axisLine: {\n lineStyle: {\n color: [[1, 'rgba(207,212,219,0.2)']]\n }\n },\n axisLabel: {\n color: contrastColor\n },\n detail: {\n color: '#EEF1FA'\n }\n },\n candlestick: {\n itemStyle: {\n color: '#f64e56',\n color0: '#54ea92',\n borderColor: '#f64e56',\n borderColor0: '#54ea92' // borderColor: '#ca2824',\n // borderColor0: '#09a443'\n\n }\n }\n};\ntheme.categoryAxis.splitLine.show = false;\nexport default theme;","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport * as zrUtil from 'zrender/lib/core/util.js';\nimport { parseClassType } from './clazz.js';\n/**\n * Usage of query:\n * `chart.on('click', query, handler);`\n * The `query` can be:\n * + The component type query string, only `mainType` or `mainType.subType`,\n * like: 'xAxis', 'series', 'xAxis.category' or 'series.line'.\n * + The component query object, like:\n * `{seriesIndex: 2}`, `{seriesName: 'xx'}`, `{seriesId: 'some'}`,\n * `{xAxisIndex: 2}`, `{xAxisName: 'xx'}`, `{xAxisId: 'some'}`.\n * + The data query object, like:\n * `{dataIndex: 123}`, `{dataType: 'link'}`, `{name: 'some'}`.\n * + The other query object (cmponent customized query), like:\n * `{element: 'some'}` (only available in custom series).\n *\n * Caveat: If a prop in the `query` object is `null/undefined`, it is the\n * same as there is no such prop in the `query` object.\n */\n\nvar ECEventProcessor =\n/** @class */\nfunction () {\n function ECEventProcessor() {}\n\n ECEventProcessor.prototype.normalizeQuery = function (query) {\n var cptQuery = {};\n var dataQuery = {};\n var otherQuery = {}; // `query` is `mainType` or `mainType.subType` of component.\n\n if (zrUtil.isString(query)) {\n var condCptType = parseClassType(query); // `.main` and `.sub` may be ''.\n\n cptQuery.mainType = condCptType.main || null;\n cptQuery.subType = condCptType.sub || null;\n } // `query` is an object, convert to {mainType, index, name, id}.\n else {\n // `xxxIndex`, `xxxName`, `xxxId`, `name`, `dataIndex`, `dataType` is reserved,\n // can not be used in `compomentModel.filterForExposedEvent`.\n var suffixes_1 = ['Index', 'Name', 'Id'];\n var dataKeys_1 = {\n name: 1,\n dataIndex: 1,\n dataType: 1\n };\n zrUtil.each(query, function (val, key) {\n var reserved = false;\n\n for (var i = 0; i < suffixes_1.length; i++) {\n var propSuffix = suffixes_1[i];\n var suffixPos = key.lastIndexOf(propSuffix);\n\n if (suffixPos > 0 && suffixPos === key.length - propSuffix.length) {\n var mainType = key.slice(0, suffixPos); // Consider `dataIndex`.\n\n if (mainType !== 'data') {\n cptQuery.mainType = mainType;\n cptQuery[propSuffix.toLowerCase()] = val;\n reserved = true;\n }\n }\n }\n\n if (dataKeys_1.hasOwnProperty(key)) {\n dataQuery[key] = val;\n reserved = true;\n }\n\n if (!reserved) {\n otherQuery[key] = val;\n }\n });\n }\n\n return {\n cptQuery: cptQuery,\n dataQuery: dataQuery,\n otherQuery: otherQuery\n };\n };\n\n ECEventProcessor.prototype.filter = function (eventType, query) {\n // They should be assigned before each trigger call.\n var eventInfo = this.eventInfo;\n\n if (!eventInfo) {\n return true;\n }\n\n var targetEl = eventInfo.targetEl;\n var packedEvent = eventInfo.packedEvent;\n var model = eventInfo.model;\n var view = eventInfo.view; // For event like 'globalout'.\n\n if (!model || !view) {\n return true;\n }\n\n var cptQuery = query.cptQuery;\n var dataQuery = query.dataQuery;\n return check(cptQuery, model, 'mainType') && check(cptQuery, model, 'subType') && check(cptQuery, model, 'index', 'componentIndex') && check(cptQuery, model, 'name') && check(cptQuery, model, 'id') && check(dataQuery, packedEvent, 'name') && check(dataQuery, packedEvent, 'dataIndex') && check(dataQuery, packedEvent, 'dataType') && (!view.filterForExposedEvent || view.filterForExposedEvent(eventType, query.otherQuery, targetEl, packedEvent));\n\n function check(query, host, prop, propOnHost) {\n return query[prop] == null || host[propOnHost || prop] === query[prop];\n }\n };\n\n ECEventProcessor.prototype.afterTrigger = function () {\n // Make sure the eventInfo wont be used in next trigger.\n this.eventInfo = null;\n };\n\n return ECEventProcessor;\n}();\n\nexport { ECEventProcessor };\n;","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { extend, isFunction, keys } from 'zrender/lib/core/util.js';\nvar SYMBOL_PROPS_WITH_CB = ['symbol', 'symbolSize', 'symbolRotate', 'symbolOffset'];\nvar SYMBOL_PROPS = SYMBOL_PROPS_WITH_CB.concat(['symbolKeepAspect']); // Encoding visual for all series include which is filtered for legend drawing\n\nvar seriesSymbolTask = {\n createOnAllSeries: true,\n // For legend.\n performRawSeries: true,\n reset: function (seriesModel, ecModel) {\n var data = seriesModel.getData();\n\n if (seriesModel.legendIcon) {\n data.setVisual('legendIcon', seriesModel.legendIcon);\n }\n\n if (!seriesModel.hasSymbolVisual) {\n return;\n }\n\n var symbolOptions = {};\n var symbolOptionsCb = {};\n var hasCallback = false;\n\n for (var i = 0; i < SYMBOL_PROPS_WITH_CB.length; i++) {\n var symbolPropName = SYMBOL_PROPS_WITH_CB[i];\n var val = seriesModel.get(symbolPropName);\n\n if (isFunction(val)) {\n hasCallback = true;\n symbolOptionsCb[symbolPropName] = val;\n } else {\n symbolOptions[symbolPropName] = val;\n }\n }\n\n symbolOptions.symbol = symbolOptions.symbol || seriesModel.defaultSymbol;\n data.setVisual(extend({\n legendIcon: seriesModel.legendIcon || symbolOptions.symbol,\n symbolKeepAspect: seriesModel.get('symbolKeepAspect')\n }, symbolOptions)); // Only visible series has each data be visual encoded\n\n if (ecModel.isSeriesFiltered(seriesModel)) {\n return;\n }\n\n var symbolPropsCb = keys(symbolOptionsCb);\n\n function dataEach(data, idx) {\n var rawValue = seriesModel.getRawValue(idx);\n var params = seriesModel.getDataParams(idx);\n\n for (var i = 0; i < symbolPropsCb.length; i++) {\n var symbolPropName = symbolPropsCb[i];\n data.setItemVisual(idx, symbolPropName, symbolOptionsCb[symbolPropName](rawValue, params));\n }\n }\n\n return {\n dataEach: hasCallback ? dataEach : null\n };\n }\n};\nvar dataSymbolTask = {\n createOnAllSeries: true,\n // For legend.\n performRawSeries: true,\n reset: function (seriesModel, ecModel) {\n if (!seriesModel.hasSymbolVisual) {\n return;\n } // Only visible series has each data be visual encoded\n\n\n if (ecModel.isSeriesFiltered(seriesModel)) {\n return;\n }\n\n var data = seriesModel.getData();\n\n function dataEach(data, idx) {\n var itemModel = data.getItemModel(idx);\n\n for (var i = 0; i < SYMBOL_PROPS.length; i++) {\n var symbolPropName = SYMBOL_PROPS[i];\n var val = itemModel.getShallow(symbolPropName, true);\n\n if (val != null) {\n data.setItemVisual(idx, symbolPropName, val);\n }\n }\n }\n\n return {\n dataEach: data.hasItemOption ? dataEach : null\n };\n }\n};\nexport { seriesSymbolTask, dataSymbolTask };","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nexport function getItemVisualFromData(data, dataIndex, key) {\n switch (key) {\n case 'color':\n var style = data.getItemVisual(dataIndex, 'style');\n return style[data.getVisual('drawType')];\n\n case 'opacity':\n return data.getItemVisual(dataIndex, 'style').opacity;\n\n case 'symbol':\n case 'symbolSize':\n case 'liftZ':\n return data.getItemVisual(dataIndex, key);\n\n default:\n if (process.env.NODE_ENV !== 'production') {\n console.warn(\"Unknown visual type \" + key);\n }\n\n }\n}\nexport function getVisualFromData(data, key) {\n switch (key) {\n case 'color':\n var style = data.getVisual('style');\n return style[data.getVisual('drawType')];\n\n case 'opacity':\n return data.getVisual('style').opacity;\n\n case 'symbol':\n case 'symbolSize':\n case 'liftZ':\n return data.getVisual(key);\n\n default:\n if (process.env.NODE_ENV !== 'production') {\n console.warn(\"Unknown visual type \" + key);\n }\n\n }\n}\nexport function setItemVisualFromData(data, dataIndex, key, value) {\n switch (key) {\n case 'color':\n // Make sure not sharing style object.\n var style = data.ensureUniqueItemVisual(dataIndex, 'style');\n style[data.getVisual('drawType')] = value; // Mark the color has been changed, not from palette anymore\n\n data.setItemVisual(dataIndex, 'colorFromPalette', false);\n break;\n\n case 'opacity':\n data.ensureUniqueItemVisual(dataIndex, 'style').opacity = value;\n break;\n\n case 'symbol':\n case 'symbolSize':\n case 'liftZ':\n data.setItemVisual(dataIndex, key, value);\n break;\n\n default:\n if (process.env.NODE_ENV !== 'production') {\n console.warn(\"Unknown visual type \" + key);\n }\n\n }\n}","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { extend, each, isArray, isString } from 'zrender/lib/core/util.js';\nimport { deprecateReplaceLog, deprecateLog } from '../util/log.js';\nimport { queryDataIndex } from '../util/model.js'; // Legacy data selection action.\n// Inlucdes: pieSelect, pieUnSelect, pieToggleSelect, mapSelect, mapUnSelect, mapToggleSelect\n\nexport function createLegacyDataSelectAction(seriesType, ecRegisterAction) {\n function getSeriesIndices(ecModel, payload) {\n var seriesIndices = [];\n ecModel.eachComponent({\n mainType: 'series',\n subType: seriesType,\n query: payload\n }, function (seriesModel) {\n seriesIndices.push(seriesModel.seriesIndex);\n });\n return seriesIndices;\n }\n\n each([[seriesType + 'ToggleSelect', 'toggleSelect'], [seriesType + 'Select', 'select'], [seriesType + 'UnSelect', 'unselect']], function (eventsMap) {\n ecRegisterAction(eventsMap[0], function (payload, ecModel, api) {\n payload = extend({}, payload);\n\n if (process.env.NODE_ENV !== 'production') {\n deprecateReplaceLog(payload.type, eventsMap[1]);\n }\n\n api.dispatchAction(extend(payload, {\n type: eventsMap[1],\n seriesIndex: getSeriesIndices(ecModel, payload)\n }));\n });\n });\n}\n\nfunction handleSeriesLegacySelectEvents(type, eventPostfix, ecIns, ecModel, payload) {\n var legacyEventName = type + eventPostfix;\n\n if (!ecIns.isSilent(legacyEventName)) {\n if (process.env.NODE_ENV !== 'production') {\n deprecateLog(\"event \" + legacyEventName + \" is deprecated.\");\n }\n\n ecModel.eachComponent({\n mainType: 'series',\n subType: 'pie'\n }, function (seriesModel) {\n var seriesIndex = seriesModel.seriesIndex;\n var selectedMap = seriesModel.option.selectedMap;\n var selected = payload.selected;\n\n for (var i = 0; i < selected.length; i++) {\n if (selected[i].seriesIndex === seriesIndex) {\n var data = seriesModel.getData();\n var dataIndex = queryDataIndex(data, payload.fromActionPayload);\n ecIns.trigger(legacyEventName, {\n type: legacyEventName,\n seriesId: seriesModel.id,\n name: isArray(dataIndex) ? data.getName(dataIndex[0]) : data.getName(dataIndex),\n selected: isString(selectedMap) ? selectedMap : extend({}, selectedMap)\n });\n }\n }\n });\n }\n}\n\nexport function handleLegacySelectEvents(messageCenter, ecIns, api) {\n messageCenter.on('selectchanged', function (params) {\n var ecModel = api.getModel();\n\n if (params.isFromClick) {\n handleSeriesLegacySelectEvents('map', 'selectchanged', ecIns, ecModel, params);\n handleSeriesLegacySelectEvents('pie', 'selectchanged', ecIns, ecModel, params);\n } else if (params.fromAction === 'select') {\n handleSeriesLegacySelectEvents('map', 'selected', ecIns, ecModel, params);\n handleSeriesLegacySelectEvents('pie', 'selected', ecIns, ecModel, params);\n } else if (params.fromAction === 'unselect') {\n handleSeriesLegacySelectEvents('map', 'unselected', ecIns, ecModel, params);\n handleSeriesLegacySelectEvents('pie', 'unselected', ecIns, ecModel, params);\n }\n });\n}","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nexport function findEventDispatcher(target, det, returnFirstMatch) {\n var found;\n\n while (target) {\n if (det(target)) {\n found = target;\n\n if (returnFirstMatch) {\n break;\n }\n }\n\n target = target.__hostTarget || target.parent;\n }\n\n return found;\n}","var wmUniqueIndex = Math.round(Math.random() * 9);\nvar supportDefineProperty = typeof Object.defineProperty === 'function';\nvar WeakMap = (function () {\n function WeakMap() {\n this._id = '__ec_inner_' + wmUniqueIndex++;\n }\n WeakMap.prototype.get = function (key) {\n return this._guard(key)[this._id];\n };\n WeakMap.prototype.set = function (key, value) {\n var target = this._guard(key);\n if (supportDefineProperty) {\n Object.defineProperty(target, this._id, {\n value: value,\n enumerable: false,\n configurable: true\n });\n }\n else {\n target[this._id] = value;\n }\n return this;\n };\n WeakMap.prototype[\"delete\"] = function (key) {\n if (this.has(key)) {\n delete this._guard(key)[this._id];\n return true;\n }\n return false;\n };\n WeakMap.prototype.has = function (key) {\n return !!this._guard(key)[this._id];\n };\n WeakMap.prototype._guard = function (key) {\n if (key !== Object(key)) {\n throw TypeError('Value of WeakMap is not a non-null object.');\n }\n return key;\n };\n return WeakMap;\n}());\nexport default WeakMap;\n","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n// Symbol factory\nimport { each, isArray, retrieve2 } from 'zrender/lib/core/util.js';\nimport * as graphic from './graphic.js';\nimport BoundingRect from 'zrender/lib/core/BoundingRect.js';\nimport { calculateTextPosition } from 'zrender/lib/contain/text.js';\nimport { parsePercent } from './number.js';\n/**\n * Triangle shape\n * @inner\n */\n\nvar Triangle = graphic.Path.extend({\n type: 'triangle',\n shape: {\n cx: 0,\n cy: 0,\n width: 0,\n height: 0\n },\n buildPath: function (path, shape) {\n var cx = shape.cx;\n var cy = shape.cy;\n var width = shape.width / 2;\n var height = shape.height / 2;\n path.moveTo(cx, cy - height);\n path.lineTo(cx + width, cy + height);\n path.lineTo(cx - width, cy + height);\n path.closePath();\n }\n});\n/**\n * Diamond shape\n * @inner\n */\n\nvar Diamond = graphic.Path.extend({\n type: 'diamond',\n shape: {\n cx: 0,\n cy: 0,\n width: 0,\n height: 0\n },\n buildPath: function (path, shape) {\n var cx = shape.cx;\n var cy = shape.cy;\n var width = shape.width / 2;\n var height = shape.height / 2;\n path.moveTo(cx, cy - height);\n path.lineTo(cx + width, cy);\n path.lineTo(cx, cy + height);\n path.lineTo(cx - width, cy);\n path.closePath();\n }\n});\n/**\n * Pin shape\n * @inner\n */\n\nvar Pin = graphic.Path.extend({\n type: 'pin',\n shape: {\n // x, y on the cusp\n x: 0,\n y: 0,\n width: 0,\n height: 0\n },\n buildPath: function (path, shape) {\n var x = shape.x;\n var y = shape.y;\n var w = shape.width / 5 * 3; // Height must be larger than width\n\n var h = Math.max(w, shape.height);\n var r = w / 2; // Dist on y with tangent point and circle center\n\n var dy = r * r / (h - r);\n var cy = y - h + r + dy;\n var angle = Math.asin(dy / r); // Dist on x with tangent point and circle center\n\n var dx = Math.cos(angle) * r;\n var tanX = Math.sin(angle);\n var tanY = Math.cos(angle);\n var cpLen = r * 0.6;\n var cpLen2 = r * 0.7;\n path.moveTo(x - dx, cy + dy);\n path.arc(x, cy, r, Math.PI - angle, Math.PI * 2 + angle);\n path.bezierCurveTo(x + dx - tanX * cpLen, cy + dy + tanY * cpLen, x, y - cpLen2, x, y);\n path.bezierCurveTo(x, y - cpLen2, x - dx + tanX * cpLen, cy + dy + tanY * cpLen, x - dx, cy + dy);\n path.closePath();\n }\n});\n/**\n * Arrow shape\n * @inner\n */\n\nvar Arrow = graphic.Path.extend({\n type: 'arrow',\n shape: {\n x: 0,\n y: 0,\n width: 0,\n height: 0\n },\n buildPath: function (ctx, shape) {\n var height = shape.height;\n var width = shape.width;\n var x = shape.x;\n var y = shape.y;\n var dx = width / 3 * 2;\n ctx.moveTo(x, y);\n ctx.lineTo(x + dx, y + height);\n ctx.lineTo(x, y + height / 4 * 3);\n ctx.lineTo(x - dx, y + height);\n ctx.lineTo(x, y);\n ctx.closePath();\n }\n});\n/**\n * Map of path contructors\n */\n// TODO Use function to build symbol path.\n\nvar symbolCtors = {\n line: graphic.Line,\n rect: graphic.Rect,\n roundRect: graphic.Rect,\n square: graphic.Rect,\n circle: graphic.Circle,\n diamond: Diamond,\n pin: Pin,\n arrow: Arrow,\n triangle: Triangle\n};\nvar symbolShapeMakers = {\n line: function (x, y, w, h, shape) {\n shape.x1 = x;\n shape.y1 = y + h / 2;\n shape.x2 = x + w;\n shape.y2 = y + h / 2;\n },\n rect: function (x, y, w, h, shape) {\n shape.x = x;\n shape.y = y;\n shape.width = w;\n shape.height = h;\n },\n roundRect: function (x, y, w, h, shape) {\n shape.x = x;\n shape.y = y;\n shape.width = w;\n shape.height = h;\n shape.r = Math.min(w, h) / 4;\n },\n square: function (x, y, w, h, shape) {\n var size = Math.min(w, h);\n shape.x = x;\n shape.y = y;\n shape.width = size;\n shape.height = size;\n },\n circle: function (x, y, w, h, shape) {\n // Put circle in the center of square\n shape.cx = x + w / 2;\n shape.cy = y + h / 2;\n shape.r = Math.min(w, h) / 2;\n },\n diamond: function (x, y, w, h, shape) {\n shape.cx = x + w / 2;\n shape.cy = y + h / 2;\n shape.width = w;\n shape.height = h;\n },\n pin: function (x, y, w, h, shape) {\n shape.x = x + w / 2;\n shape.y = y + h / 2;\n shape.width = w;\n shape.height = h;\n },\n arrow: function (x, y, w, h, shape) {\n shape.x = x + w / 2;\n shape.y = y + h / 2;\n shape.width = w;\n shape.height = h;\n },\n triangle: function (x, y, w, h, shape) {\n shape.cx = x + w / 2;\n shape.cy = y + h / 2;\n shape.width = w;\n shape.height = h;\n }\n};\nexport var symbolBuildProxies = {};\neach(symbolCtors, function (Ctor, name) {\n symbolBuildProxies[name] = new Ctor();\n});\nvar SymbolClz = graphic.Path.extend({\n type: 'symbol',\n shape: {\n symbolType: '',\n x: 0,\n y: 0,\n width: 0,\n height: 0\n },\n calculateTextPosition: function (out, config, rect) {\n var res = calculateTextPosition(out, config, rect);\n var shape = this.shape;\n\n if (shape && shape.symbolType === 'pin' && config.position === 'inside') {\n res.y = rect.y + rect.height * 0.4;\n }\n\n return res;\n },\n buildPath: function (ctx, shape, inBundle) {\n var symbolType = shape.symbolType;\n\n if (symbolType !== 'none') {\n var proxySymbol = symbolBuildProxies[symbolType];\n\n if (!proxySymbol) {\n // Default rect\n symbolType = 'rect';\n proxySymbol = symbolBuildProxies[symbolType];\n }\n\n symbolShapeMakers[symbolType](shape.x, shape.y, shape.width, shape.height, proxySymbol.shape);\n proxySymbol.buildPath(ctx, proxySymbol.shape, inBundle);\n }\n }\n}); // Provide setColor helper method to avoid determine if set the fill or stroke outside\n\nfunction symbolPathSetColor(color, innerColor) {\n if (this.type !== 'image') {\n var symbolStyle = this.style;\n\n if (this.__isEmptyBrush) {\n symbolStyle.stroke = color;\n symbolStyle.fill = innerColor || '#fff'; // TODO Same width with lineStyle in LineView\n\n symbolStyle.lineWidth = 2;\n } else if (this.shape.symbolType === 'line') {\n symbolStyle.stroke = color;\n } else {\n symbolStyle.fill = color;\n }\n\n this.markRedraw();\n }\n}\n/**\n * Create a symbol element with given symbol configuration: shape, x, y, width, height, color\n */\n\n\nexport function createSymbol(symbolType, x, y, w, h, color, // whether to keep the ratio of w/h,\nkeepAspect) {\n // TODO Support image object, DynamicImage.\n var isEmpty = symbolType.indexOf('empty') === 0;\n\n if (isEmpty) {\n symbolType = symbolType.substr(5, 1).toLowerCase() + symbolType.substr(6);\n }\n\n var symbolPath;\n\n if (symbolType.indexOf('image://') === 0) {\n symbolPath = graphic.makeImage(symbolType.slice(8), new BoundingRect(x, y, w, h), keepAspect ? 'center' : 'cover');\n } else if (symbolType.indexOf('path://') === 0) {\n symbolPath = graphic.makePath(symbolType.slice(7), {}, new BoundingRect(x, y, w, h), keepAspect ? 'center' : 'cover');\n } else {\n symbolPath = new SymbolClz({\n shape: {\n symbolType: symbolType,\n x: x,\n y: y,\n width: w,\n height: h\n }\n });\n }\n\n symbolPath.__isEmptyBrush = isEmpty; // TODO Should deprecate setColor\n\n symbolPath.setColor = symbolPathSetColor;\n\n if (color) {\n symbolPath.setColor(color);\n }\n\n return symbolPath;\n}\nexport function normalizeSymbolSize(symbolSize) {\n if (!isArray(symbolSize)) {\n symbolSize = [+symbolSize, +symbolSize];\n }\n\n return [symbolSize[0] || 0, symbolSize[1] || 0];\n}\nexport function normalizeSymbolOffset(symbolOffset, symbolSize) {\n if (symbolOffset == null) {\n return;\n }\n\n if (!isArray(symbolOffset)) {\n symbolOffset = [symbolOffset, symbolOffset];\n }\n\n return [parsePercent(symbolOffset[0], symbolSize[0]) || 0, parsePercent(retrieve2(symbolOffset[1], symbolOffset[0]), symbolSize[1]) || 0];\n}","export function createLinearGradient(ctx, obj, rect) {\n var x = obj.x == null ? 0 : obj.x;\n var x2 = obj.x2 == null ? 1 : obj.x2;\n var y = obj.y == null ? 0 : obj.y;\n var y2 = obj.y2 == null ? 0 : obj.y2;\n if (!obj.global) {\n x = x * rect.width + rect.x;\n x2 = x2 * rect.width + rect.x;\n y = y * rect.height + rect.y;\n y2 = y2 * rect.height + rect.y;\n }\n x = isNaN(x) ? 0 : x;\n x2 = isNaN(x2) ? 1 : x2;\n y = isNaN(y) ? 0 : y;\n y2 = isNaN(y2) ? 0 : y2;\n var canvasGradient = ctx.createLinearGradient(x, y, x2, y2);\n return canvasGradient;\n}\nexport function createRadialGradient(ctx, obj, rect) {\n var width = rect.width;\n var height = rect.height;\n var min = Math.min(width, height);\n var x = obj.x == null ? 0.5 : obj.x;\n var y = obj.y == null ? 0.5 : obj.y;\n var r = obj.r == null ? 0.5 : obj.r;\n if (!obj.global) {\n x = x * width + rect.x;\n y = y * height + rect.y;\n r = r * min;\n }\n var canvasGradient = ctx.createRadialGradient(x, y, 0, x, y, r);\n return canvasGradient;\n}\nexport function getCanvasGradient(ctx, obj, rect) {\n var canvasGradient = obj.type === 'radial'\n ? createRadialGradient(ctx, obj, rect)\n : createLinearGradient(ctx, obj, rect);\n var colorStops = obj.colorStops;\n for (var i = 0; i < colorStops.length; i++) {\n canvasGradient.addColorStop(colorStops[i].offset, colorStops[i].color);\n }\n return canvasGradient;\n}\nexport function isClipPathChanged(clipPaths, prevClipPaths) {\n if (clipPaths === prevClipPaths || (!clipPaths && !prevClipPaths)) {\n return false;\n }\n if (!clipPaths || !prevClipPaths || (clipPaths.length !== prevClipPaths.length)) {\n return true;\n }\n for (var i = 0; i < clipPaths.length; i++) {\n if (clipPaths[i] !== prevClipPaths[i]) {\n return true;\n }\n }\n return false;\n}\nfunction parseInt10(val) {\n return parseInt(val, 10);\n}\nexport function getSize(root, whIdx, opts) {\n var wh = ['width', 'height'][whIdx];\n var cwh = ['clientWidth', 'clientHeight'][whIdx];\n var plt = ['paddingLeft', 'paddingTop'][whIdx];\n var prb = ['paddingRight', 'paddingBottom'][whIdx];\n if (opts[wh] != null && opts[wh] !== 'auto') {\n return parseFloat(opts[wh]);\n }\n var stl = document.defaultView.getComputedStyle(root);\n return ((root[cwh] || parseInt10(stl[wh]) || parseInt10(root.style[wh]))\n - (parseInt10(stl[plt]) || 0)\n - (parseInt10(stl[prb]) || 0)) | 0;\n}\n","import { isArray, isNumber, map } from '../core/util.js';\nexport function normalizeLineDash(lineType, lineWidth) {\n if (!lineType || lineType === 'solid' || !(lineWidth > 0)) {\n return null;\n }\n return lineType === 'dashed'\n ? [4 * lineWidth, 2 * lineWidth]\n : lineType === 'dotted'\n ? [lineWidth]\n : isNumber(lineType)\n ? [lineType] : isArray(lineType) ? lineType : null;\n}\nexport function getLineDash(el) {\n var style = el.style;\n var lineDash = style.lineDash && style.lineWidth > 0 && normalizeLineDash(style.lineDash, style.lineWidth);\n var lineDashOffset = style.lineDashOffset;\n if (lineDash) {\n var lineScale_1 = (style.strokeNoScale && el.getLineScale) ? el.getLineScale() : 1;\n if (lineScale_1 && lineScale_1 !== 1) {\n lineDash = map(lineDash, function (rawVal) {\n return rawVal / lineScale_1;\n });\n lineDashOffset /= lineScale_1;\n }\n }\n return [lineDash, lineDashOffset];\n}\n","import { DEFAULT_COMMON_STYLE } from '../graphic/Displayable.js';\nimport PathProxy from '../core/PathProxy.js';\nimport { createOrUpdateImage, isImageReady } from '../graphic/helper/image.js';\nimport { getCanvasGradient, isClipPathChanged } from './helper.js';\nimport Path from '../graphic/Path.js';\nimport ZRImage from '../graphic/Image.js';\nimport TSpan from '../graphic/TSpan.js';\nimport { RADIAN_TO_DEGREE } from '../core/util.js';\nimport { getLineDash } from './dashStyle.js';\nimport { REDRAW_BIT, SHAPE_CHANGED_BIT } from '../graphic/constants.js';\nimport { DEFAULT_FONT } from '../core/platform.js';\nvar pathProxyForDraw = new PathProxy(true);\nfunction styleHasStroke(style) {\n var stroke = style.stroke;\n return !(stroke == null || stroke === 'none' || !(style.lineWidth > 0));\n}\nfunction isValidStrokeFillStyle(strokeOrFill) {\n return typeof strokeOrFill === 'string' && strokeOrFill !== 'none';\n}\nfunction styleHasFill(style) {\n var fill = style.fill;\n return fill != null && fill !== 'none';\n}\nfunction doFillPath(ctx, style) {\n if (style.fillOpacity != null && style.fillOpacity !== 1) {\n var originalGlobalAlpha = ctx.globalAlpha;\n ctx.globalAlpha = style.fillOpacity * style.opacity;\n ctx.fill();\n ctx.globalAlpha = originalGlobalAlpha;\n }\n else {\n ctx.fill();\n }\n}\nfunction doStrokePath(ctx, style) {\n if (style.strokeOpacity != null && style.strokeOpacity !== 1) {\n var originalGlobalAlpha = ctx.globalAlpha;\n ctx.globalAlpha = style.strokeOpacity * style.opacity;\n ctx.stroke();\n ctx.globalAlpha = originalGlobalAlpha;\n }\n else {\n ctx.stroke();\n }\n}\nexport function createCanvasPattern(ctx, pattern, el) {\n var image = createOrUpdateImage(pattern.image, pattern.__image, el);\n if (isImageReady(image)) {\n var canvasPattern = ctx.createPattern(image, pattern.repeat || 'repeat');\n if (typeof DOMMatrix === 'function'\n && canvasPattern\n && canvasPattern.setTransform) {\n var matrix = new DOMMatrix();\n matrix.translateSelf((pattern.x || 0), (pattern.y || 0));\n matrix.rotateSelf(0, 0, (pattern.rotation || 0) * RADIAN_TO_DEGREE);\n matrix.scaleSelf((pattern.scaleX || 1), (pattern.scaleY || 1));\n canvasPattern.setTransform(matrix);\n }\n return canvasPattern;\n }\n}\nfunction brushPath(ctx, el, style, inBatch) {\n var _a;\n var hasStroke = styleHasStroke(style);\n var hasFill = styleHasFill(style);\n var strokePercent = style.strokePercent;\n var strokePart = strokePercent < 1;\n var firstDraw = !el.path;\n if ((!el.silent || strokePart) && firstDraw) {\n el.createPathProxy();\n }\n var path = el.path || pathProxyForDraw;\n var dirtyFlag = el.__dirty;\n if (!inBatch) {\n var fill = style.fill;\n var stroke = style.stroke;\n var hasFillGradient = hasFill && !!fill.colorStops;\n var hasStrokeGradient = hasStroke && !!stroke.colorStops;\n var hasFillPattern = hasFill && !!fill.image;\n var hasStrokePattern = hasStroke && !!stroke.image;\n var fillGradient = void 0;\n var strokeGradient = void 0;\n var fillPattern = void 0;\n var strokePattern = void 0;\n var rect = void 0;\n if (hasFillGradient || hasStrokeGradient) {\n rect = el.getBoundingRect();\n }\n if (hasFillGradient) {\n fillGradient = dirtyFlag\n ? getCanvasGradient(ctx, fill, rect)\n : el.__canvasFillGradient;\n el.__canvasFillGradient = fillGradient;\n }\n if (hasStrokeGradient) {\n strokeGradient = dirtyFlag\n ? getCanvasGradient(ctx, stroke, rect)\n : el.__canvasStrokeGradient;\n el.__canvasStrokeGradient = strokeGradient;\n }\n if (hasFillPattern) {\n fillPattern = (dirtyFlag || !el.__canvasFillPattern)\n ? createCanvasPattern(ctx, fill, el)\n : el.__canvasFillPattern;\n el.__canvasFillPattern = fillPattern;\n }\n if (hasStrokePattern) {\n strokePattern = (dirtyFlag || !el.__canvasStrokePattern)\n ? createCanvasPattern(ctx, stroke, el)\n : el.__canvasStrokePattern;\n el.__canvasStrokePattern = fillPattern;\n }\n if (hasFillGradient) {\n ctx.fillStyle = fillGradient;\n }\n else if (hasFillPattern) {\n if (fillPattern) {\n ctx.fillStyle = fillPattern;\n }\n else {\n hasFill = false;\n }\n }\n if (hasStrokeGradient) {\n ctx.strokeStyle = strokeGradient;\n }\n else if (hasStrokePattern) {\n if (strokePattern) {\n ctx.strokeStyle = strokePattern;\n }\n else {\n hasStroke = false;\n }\n }\n }\n var scale = el.getGlobalScale();\n path.setScale(scale[0], scale[1], el.segmentIgnoreThreshold);\n var lineDash;\n var lineDashOffset;\n if (ctx.setLineDash && style.lineDash) {\n _a = getLineDash(el), lineDash = _a[0], lineDashOffset = _a[1];\n }\n var needsRebuild = true;\n if (firstDraw || (dirtyFlag & SHAPE_CHANGED_BIT)) {\n path.setDPR(ctx.dpr);\n if (strokePart) {\n path.setContext(null);\n }\n else {\n path.setContext(ctx);\n needsRebuild = false;\n }\n path.reset();\n el.buildPath(path, el.shape, inBatch);\n path.toStatic();\n el.pathUpdated();\n }\n if (needsRebuild) {\n path.rebuildPath(ctx, strokePart ? strokePercent : 1);\n }\n if (lineDash) {\n ctx.setLineDash(lineDash);\n ctx.lineDashOffset = lineDashOffset;\n }\n if (!inBatch) {\n if (style.strokeFirst) {\n if (hasStroke) {\n doStrokePath(ctx, style);\n }\n if (hasFill) {\n doFillPath(ctx, style);\n }\n }\n else {\n if (hasFill) {\n doFillPath(ctx, style);\n }\n if (hasStroke) {\n doStrokePath(ctx, style);\n }\n }\n }\n if (lineDash) {\n ctx.setLineDash([]);\n }\n}\nfunction brushImage(ctx, el, style) {\n var image = el.__image = createOrUpdateImage(style.image, el.__image, el, el.onload);\n if (!image || !isImageReady(image)) {\n return;\n }\n var x = style.x || 0;\n var y = style.y || 0;\n var width = el.getWidth();\n var height = el.getHeight();\n var aspect = image.width / image.height;\n if (width == null && height != null) {\n width = height * aspect;\n }\n else if (height == null && width != null) {\n height = width / aspect;\n }\n else if (width == null && height == null) {\n width = image.width;\n height = image.height;\n }\n if (style.sWidth && style.sHeight) {\n var sx = style.sx || 0;\n var sy = style.sy || 0;\n ctx.drawImage(image, sx, sy, style.sWidth, style.sHeight, x, y, width, height);\n }\n else if (style.sx && style.sy) {\n var sx = style.sx;\n var sy = style.sy;\n var sWidth = width - sx;\n var sHeight = height - sy;\n ctx.drawImage(image, sx, sy, sWidth, sHeight, x, y, width, height);\n }\n else {\n ctx.drawImage(image, x, y, width, height);\n }\n}\nfunction brushText(ctx, el, style) {\n var _a;\n var text = style.text;\n text != null && (text += '');\n if (text) {\n ctx.font = style.font || DEFAULT_FONT;\n ctx.textAlign = style.textAlign;\n ctx.textBaseline = style.textBaseline;\n var lineDash = void 0;\n var lineDashOffset = void 0;\n if (ctx.setLineDash && style.lineDash) {\n _a = getLineDash(el), lineDash = _a[0], lineDashOffset = _a[1];\n }\n if (lineDash) {\n ctx.setLineDash(lineDash);\n ctx.lineDashOffset = lineDashOffset;\n }\n if (style.strokeFirst) {\n if (styleHasStroke(style)) {\n ctx.strokeText(text, style.x, style.y);\n }\n if (styleHasFill(style)) {\n ctx.fillText(text, style.x, style.y);\n }\n }\n else {\n if (styleHasFill(style)) {\n ctx.fillText(text, style.x, style.y);\n }\n if (styleHasStroke(style)) {\n ctx.strokeText(text, style.x, style.y);\n }\n }\n if (lineDash) {\n ctx.setLineDash([]);\n }\n }\n}\nvar SHADOW_NUMBER_PROPS = ['shadowBlur', 'shadowOffsetX', 'shadowOffsetY'];\nvar STROKE_PROPS = [\n ['lineCap', 'butt'], ['lineJoin', 'miter'], ['miterLimit', 10]\n];\nfunction bindCommonProps(ctx, style, prevStyle, forceSetAll, scope) {\n var styleChanged = false;\n if (!forceSetAll) {\n prevStyle = prevStyle || {};\n if (style === prevStyle) {\n return false;\n }\n }\n if (forceSetAll || style.opacity !== prevStyle.opacity) {\n flushPathDrawn(ctx, scope);\n styleChanged = true;\n var opacity = Math.max(Math.min(style.opacity, 1), 0);\n ctx.globalAlpha = isNaN(opacity) ? DEFAULT_COMMON_STYLE.opacity : opacity;\n }\n if (forceSetAll || style.blend !== prevStyle.blend) {\n if (!styleChanged) {\n flushPathDrawn(ctx, scope);\n styleChanged = true;\n }\n ctx.globalCompositeOperation = style.blend || DEFAULT_COMMON_STYLE.blend;\n }\n for (var i = 0; i < SHADOW_NUMBER_PROPS.length; i++) {\n var propName = SHADOW_NUMBER_PROPS[i];\n if (forceSetAll || style[propName] !== prevStyle[propName]) {\n if (!styleChanged) {\n flushPathDrawn(ctx, scope);\n styleChanged = true;\n }\n ctx[propName] = ctx.dpr * (style[propName] || 0);\n }\n }\n if (forceSetAll || style.shadowColor !== prevStyle.shadowColor) {\n if (!styleChanged) {\n flushPathDrawn(ctx, scope);\n styleChanged = true;\n }\n ctx.shadowColor = style.shadowColor || DEFAULT_COMMON_STYLE.shadowColor;\n }\n return styleChanged;\n}\nfunction bindPathAndTextCommonStyle(ctx, el, prevEl, forceSetAll, scope) {\n var style = getStyle(el, scope.inHover);\n var prevStyle = forceSetAll\n ? null\n : (prevEl && getStyle(prevEl, scope.inHover) || {});\n if (style === prevStyle) {\n return false;\n }\n var styleChanged = bindCommonProps(ctx, style, prevStyle, forceSetAll, scope);\n if (forceSetAll || style.fill !== prevStyle.fill) {\n if (!styleChanged) {\n flushPathDrawn(ctx, scope);\n styleChanged = true;\n }\n isValidStrokeFillStyle(style.fill) && (ctx.fillStyle = style.fill);\n }\n if (forceSetAll || style.stroke !== prevStyle.stroke) {\n if (!styleChanged) {\n flushPathDrawn(ctx, scope);\n styleChanged = true;\n }\n isValidStrokeFillStyle(style.stroke) && (ctx.strokeStyle = style.stroke);\n }\n if (forceSetAll || style.opacity !== prevStyle.opacity) {\n if (!styleChanged) {\n flushPathDrawn(ctx, scope);\n styleChanged = true;\n }\n ctx.globalAlpha = style.opacity == null ? 1 : style.opacity;\n }\n if (el.hasStroke()) {\n var lineWidth = style.lineWidth;\n var newLineWidth = lineWidth / ((style.strokeNoScale && el.getLineScale) ? el.getLineScale() : 1);\n if (ctx.lineWidth !== newLineWidth) {\n if (!styleChanged) {\n flushPathDrawn(ctx, scope);\n styleChanged = true;\n }\n ctx.lineWidth = newLineWidth;\n }\n }\n for (var i = 0; i < STROKE_PROPS.length; i++) {\n var prop = STROKE_PROPS[i];\n var propName = prop[0];\n if (forceSetAll || style[propName] !== prevStyle[propName]) {\n if (!styleChanged) {\n flushPathDrawn(ctx, scope);\n styleChanged = true;\n }\n ctx[propName] = style[propName] || prop[1];\n }\n }\n return styleChanged;\n}\nfunction bindImageStyle(ctx, el, prevEl, forceSetAll, scope) {\n return bindCommonProps(ctx, getStyle(el, scope.inHover), prevEl && getStyle(prevEl, scope.inHover), forceSetAll, scope);\n}\nfunction setContextTransform(ctx, el) {\n var m = el.transform;\n var dpr = ctx.dpr || 1;\n if (m) {\n ctx.setTransform(dpr * m[0], dpr * m[1], dpr * m[2], dpr * m[3], dpr * m[4], dpr * m[5]);\n }\n else {\n ctx.setTransform(dpr, 0, 0, dpr, 0, 0);\n }\n}\nfunction updateClipStatus(clipPaths, ctx, scope) {\n var allClipped = false;\n for (var i = 0; i < clipPaths.length; i++) {\n var clipPath = clipPaths[i];\n allClipped = allClipped || clipPath.isZeroArea();\n setContextTransform(ctx, clipPath);\n ctx.beginPath();\n clipPath.buildPath(ctx, clipPath.shape);\n ctx.clip();\n }\n scope.allClipped = allClipped;\n}\nfunction isTransformChanged(m0, m1) {\n if (m0 && m1) {\n return m0[0] !== m1[0]\n || m0[1] !== m1[1]\n || m0[2] !== m1[2]\n || m0[3] !== m1[3]\n || m0[4] !== m1[4]\n || m0[5] !== m1[5];\n }\n else if (!m0 && !m1) {\n return false;\n }\n return true;\n}\nvar DRAW_TYPE_PATH = 1;\nvar DRAW_TYPE_IMAGE = 2;\nvar DRAW_TYPE_TEXT = 3;\nvar DRAW_TYPE_INCREMENTAL = 4;\nfunction canPathBatch(style) {\n var hasFill = styleHasFill(style);\n var hasStroke = styleHasStroke(style);\n return !(style.lineDash\n || !(+hasFill ^ +hasStroke)\n || (hasFill && typeof style.fill !== 'string')\n || (hasStroke && typeof style.stroke !== 'string')\n || style.strokePercent < 1\n || style.strokeOpacity < 1\n || style.fillOpacity < 1);\n}\nfunction flushPathDrawn(ctx, scope) {\n scope.batchFill && ctx.fill();\n scope.batchStroke && ctx.stroke();\n scope.batchFill = '';\n scope.batchStroke = '';\n}\nfunction getStyle(el, inHover) {\n return inHover ? (el.__hoverStyle || el.style) : el.style;\n}\nexport function brushSingle(ctx, el) {\n brush(ctx, el, { inHover: false, viewWidth: 0, viewHeight: 0 }, true);\n}\nexport function brush(ctx, el, scope, isLast) {\n var m = el.transform;\n if (!el.shouldBePainted(scope.viewWidth, scope.viewHeight, false, false)) {\n el.__dirty &= ~REDRAW_BIT;\n el.__isRendered = false;\n return;\n }\n var clipPaths = el.__clipPaths;\n var prevElClipPaths = scope.prevElClipPaths;\n var forceSetTransform = false;\n var forceSetStyle = false;\n if (!prevElClipPaths || isClipPathChanged(clipPaths, prevElClipPaths)) {\n if (prevElClipPaths && prevElClipPaths.length) {\n flushPathDrawn(ctx, scope);\n ctx.restore();\n forceSetStyle = forceSetTransform = true;\n scope.prevElClipPaths = null;\n scope.allClipped = false;\n scope.prevEl = null;\n }\n if (clipPaths && clipPaths.length) {\n flushPathDrawn(ctx, scope);\n ctx.save();\n updateClipStatus(clipPaths, ctx, scope);\n forceSetTransform = true;\n }\n scope.prevElClipPaths = clipPaths;\n }\n if (scope.allClipped) {\n el.__isRendered = false;\n return;\n }\n el.beforeBrush && el.beforeBrush();\n el.innerBeforeBrush();\n var prevEl = scope.prevEl;\n if (!prevEl) {\n forceSetStyle = forceSetTransform = true;\n }\n var canBatchPath = el instanceof Path\n && el.autoBatch\n && canPathBatch(el.style);\n if (forceSetTransform || isTransformChanged(m, prevEl.transform)) {\n flushPathDrawn(ctx, scope);\n setContextTransform(ctx, el);\n }\n else if (!canBatchPath) {\n flushPathDrawn(ctx, scope);\n }\n var style = getStyle(el, scope.inHover);\n if (el instanceof Path) {\n if (scope.lastDrawType !== DRAW_TYPE_PATH) {\n forceSetStyle = true;\n scope.lastDrawType = DRAW_TYPE_PATH;\n }\n bindPathAndTextCommonStyle(ctx, el, prevEl, forceSetStyle, scope);\n if (!canBatchPath || (!scope.batchFill && !scope.batchStroke)) {\n ctx.beginPath();\n }\n brushPath(ctx, el, style, canBatchPath);\n if (canBatchPath) {\n scope.batchFill = style.fill || '';\n scope.batchStroke = style.stroke || '';\n }\n }\n else {\n if (el instanceof TSpan) {\n if (scope.lastDrawType !== DRAW_TYPE_TEXT) {\n forceSetStyle = true;\n scope.lastDrawType = DRAW_TYPE_TEXT;\n }\n bindPathAndTextCommonStyle(ctx, el, prevEl, forceSetStyle, scope);\n brushText(ctx, el, style);\n }\n else if (el instanceof ZRImage) {\n if (scope.lastDrawType !== DRAW_TYPE_IMAGE) {\n forceSetStyle = true;\n scope.lastDrawType = DRAW_TYPE_IMAGE;\n }\n bindImageStyle(ctx, el, prevEl, forceSetStyle, scope);\n brushImage(ctx, el, style);\n }\n else if (el.getTemporalDisplayables) {\n if (scope.lastDrawType !== DRAW_TYPE_INCREMENTAL) {\n forceSetStyle = true;\n scope.lastDrawType = DRAW_TYPE_INCREMENTAL;\n }\n brushIncremental(ctx, el, scope);\n }\n }\n if (canBatchPath && isLast) {\n flushPathDrawn(ctx, scope);\n }\n el.innerAfterBrush();\n el.afterBrush && el.afterBrush();\n scope.prevEl = el;\n el.__dirty = 0;\n el.__isRendered = true;\n}\nfunction brushIncremental(ctx, el, scope) {\n var displayables = el.getDisplayables();\n var temporalDisplayables = el.getTemporalDisplayables();\n ctx.save();\n var innerScope = {\n prevElClipPaths: null,\n prevEl: null,\n allClipped: false,\n viewWidth: scope.viewWidth,\n viewHeight: scope.viewHeight,\n inHover: scope.inHover\n };\n var i;\n var len;\n for (i = el.getCursor(), len = displayables.length; i < len; i++) {\n var displayable = displayables[i];\n displayable.beforeBrush && displayable.beforeBrush();\n displayable.innerBeforeBrush();\n brush(ctx, displayable, innerScope, i === len - 1);\n displayable.innerAfterBrush();\n displayable.afterBrush && displayable.afterBrush();\n innerScope.prevEl = displayable;\n }\n for (var i_1 = 0, len_1 = temporalDisplayables.length; i_1 < len_1; i_1++) {\n var displayable = temporalDisplayables[i_1];\n displayable.beforeBrush && displayable.beforeBrush();\n displayable.innerBeforeBrush();\n brush(ctx, displayable, innerScope, i_1 === len_1 - 1);\n displayable.innerAfterBrush();\n displayable.afterBrush && displayable.afterBrush();\n innerScope.prevEl = displayable;\n }\n el.clearTemporalDisplayables();\n el.notClear = true;\n ctx.restore();\n}\n","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport WeakMap from 'zrender/lib/core/WeakMap.js';\nimport LRU from 'zrender/lib/core/LRU.js';\nimport { defaults, map, isArray, isString, isNumber } from 'zrender/lib/core/util.js';\nimport { getLeastCommonMultiple } from './number.js';\nimport { createSymbol } from './symbol.js';\nimport { brushSingle } from 'zrender/lib/canvas/graphic.js';\nimport { platformApi } from 'zrender/lib/core/platform.js';\nvar decalMap = new WeakMap();\nvar decalCache = new LRU(100);\nvar decalKeys = ['symbol', 'symbolSize', 'symbolKeepAspect', 'color', 'backgroundColor', 'dashArrayX', 'dashArrayY', 'maxTileWidth', 'maxTileHeight'];\n/**\n * Create or update pattern image from decal options\n *\n * @param {InnerDecalObject | 'none'} decalObject decal options, 'none' if no decal\n * @return {Pattern} pattern with generated image, null if no decal\n */\n\nexport function createOrUpdatePatternFromDecal(decalObject, api) {\n if (decalObject === 'none') {\n return null;\n }\n\n var dpr = api.getDevicePixelRatio();\n var zr = api.getZr();\n var isSVG = zr.painter.type === 'svg';\n\n if (decalObject.dirty) {\n decalMap[\"delete\"](decalObject);\n }\n\n var oldPattern = decalMap.get(decalObject);\n\n if (oldPattern) {\n return oldPattern;\n }\n\n var decalOpt = defaults(decalObject, {\n symbol: 'rect',\n symbolSize: 1,\n symbolKeepAspect: true,\n color: 'rgba(0, 0, 0, 0.2)',\n backgroundColor: null,\n dashArrayX: 5,\n dashArrayY: 5,\n rotation: 0,\n maxTileWidth: 512,\n maxTileHeight: 512\n });\n\n if (decalOpt.backgroundColor === 'none') {\n decalOpt.backgroundColor = null;\n }\n\n var pattern = {\n repeat: 'repeat'\n };\n setPatternnSource(pattern);\n pattern.rotation = decalOpt.rotation;\n pattern.scaleX = pattern.scaleY = isSVG ? 1 : 1 / dpr;\n decalMap.set(decalObject, pattern);\n decalObject.dirty = false;\n return pattern;\n\n function setPatternnSource(pattern) {\n var keys = [dpr];\n var isValidKey = true;\n\n for (var i = 0; i < decalKeys.length; ++i) {\n var value = decalOpt[decalKeys[i]];\n\n if (value != null && !isArray(value) && !isString(value) && !isNumber(value) && typeof value !== 'boolean') {\n isValidKey = false;\n break;\n }\n\n keys.push(value);\n }\n\n var cacheKey;\n\n if (isValidKey) {\n cacheKey = keys.join(',') + (isSVG ? '-svg' : '');\n var cache = decalCache.get(cacheKey);\n\n if (cache) {\n isSVG ? pattern.svgElement = cache : pattern.image = cache;\n }\n }\n\n var dashArrayX = normalizeDashArrayX(decalOpt.dashArrayX);\n var dashArrayY = normalizeDashArrayY(decalOpt.dashArrayY);\n var symbolArray = normalizeSymbolArray(decalOpt.symbol);\n var lineBlockLengthsX = getLineBlockLengthX(dashArrayX);\n var lineBlockLengthY = getLineBlockLengthY(dashArrayY);\n var canvas = !isSVG && platformApi.createCanvas();\n var svgRoot = isSVG && {\n tag: 'g',\n attrs: {},\n key: 'dcl',\n children: []\n };\n var pSize = getPatternSize();\n var ctx;\n\n if (canvas) {\n canvas.width = pSize.width * dpr;\n canvas.height = pSize.height * dpr;\n ctx = canvas.getContext('2d');\n }\n\n brushDecal();\n\n if (isValidKey) {\n decalCache.put(cacheKey, canvas || svgRoot);\n }\n\n pattern.image = canvas;\n pattern.svgElement = svgRoot;\n pattern.svgWidth = pSize.width;\n pattern.svgHeight = pSize.height;\n /**\n * Get minumum length that can make a repeatable pattern.\n *\n * @return {Object} pattern width and height\n */\n\n function getPatternSize() {\n /**\n * For example, if dash is [[3, 2], [2, 1]] for X, it looks like\n * |--- --- --- --- --- ...\n * |-- -- -- -- -- -- -- -- ...\n * |--- --- --- --- --- ...\n * |-- -- -- -- -- -- -- -- ...\n * So the minumum length of X is 15,\n * which is the least common multiple of `3 + 2` and `2 + 1`\n * |--- --- --- |--- --- ...\n * |-- -- -- -- -- |-- -- -- ...\n */\n var width = 1;\n\n for (var i = 0, xlen = lineBlockLengthsX.length; i < xlen; ++i) {\n width = getLeastCommonMultiple(width, lineBlockLengthsX[i]);\n }\n\n var symbolRepeats = 1;\n\n for (var i = 0, xlen = symbolArray.length; i < xlen; ++i) {\n symbolRepeats = getLeastCommonMultiple(symbolRepeats, symbolArray[i].length);\n }\n\n width *= symbolRepeats;\n var height = lineBlockLengthY * lineBlockLengthsX.length * symbolArray.length;\n\n if (process.env.NODE_ENV !== 'production') {\n var warn = function (attrName) {\n /* eslint-disable-next-line */\n console.warn(\"Calculated decal size is greater than \" + attrName + \" due to decal option settings so \" + attrName + \" is used for the decal size. Please consider changing the decal option to make a smaller decal or set \" + attrName + \" to be larger to avoid incontinuity.\");\n };\n\n if (width > decalOpt.maxTileWidth) {\n warn('maxTileWidth');\n }\n\n if (height > decalOpt.maxTileHeight) {\n warn('maxTileHeight');\n }\n }\n\n return {\n width: Math.max(1, Math.min(width, decalOpt.maxTileWidth)),\n height: Math.max(1, Math.min(height, decalOpt.maxTileHeight))\n };\n }\n\n function brushDecal() {\n if (ctx) {\n ctx.clearRect(0, 0, canvas.width, canvas.height);\n\n if (decalOpt.backgroundColor) {\n ctx.fillStyle = decalOpt.backgroundColor;\n ctx.fillRect(0, 0, canvas.width, canvas.height);\n }\n }\n\n var ySum = 0;\n\n for (var i = 0; i < dashArrayY.length; ++i) {\n ySum += dashArrayY[i];\n }\n\n if (ySum <= 0) {\n // dashArrayY is 0, draw nothing\n return;\n }\n\n var y = -lineBlockLengthY;\n var yId = 0;\n var yIdTotal = 0;\n var xId0 = 0;\n\n while (y < pSize.height) {\n if (yId % 2 === 0) {\n var symbolYId = yIdTotal / 2 % symbolArray.length;\n var x = 0;\n var xId1 = 0;\n var xId1Total = 0;\n\n while (x < pSize.width * 2) {\n var xSum = 0;\n\n for (var i = 0; i < dashArrayX[xId0].length; ++i) {\n xSum += dashArrayX[xId0][i];\n }\n\n if (xSum <= 0) {\n // Skip empty line\n break;\n } // E.g., [15, 5, 20, 5] draws only for 15 and 20\n\n\n if (xId1 % 2 === 0) {\n var size = (1 - decalOpt.symbolSize) * 0.5;\n var left = x + dashArrayX[xId0][xId1] * size;\n var top_1 = y + dashArrayY[yId] * size;\n var width = dashArrayX[xId0][xId1] * decalOpt.symbolSize;\n var height = dashArrayY[yId] * decalOpt.symbolSize;\n var symbolXId = xId1Total / 2 % symbolArray[symbolYId].length;\n brushSymbol(left, top_1, width, height, symbolArray[symbolYId][symbolXId]);\n }\n\n x += dashArrayX[xId0][xId1];\n ++xId1Total;\n ++xId1;\n\n if (xId1 === dashArrayX[xId0].length) {\n xId1 = 0;\n }\n }\n\n ++xId0;\n\n if (xId0 === dashArrayX.length) {\n xId0 = 0;\n }\n }\n\n y += dashArrayY[yId];\n ++yIdTotal;\n ++yId;\n\n if (yId === dashArrayY.length) {\n yId = 0;\n }\n }\n\n function brushSymbol(x, y, width, height, symbolType) {\n var scale = isSVG ? 1 : dpr;\n var symbol = createSymbol(symbolType, x * scale, y * scale, width * scale, height * scale, decalOpt.color, decalOpt.symbolKeepAspect);\n\n if (isSVG) {\n var symbolVNode = zr.painter.renderOneToVNode(symbol);\n\n if (symbolVNode) {\n svgRoot.children.push(symbolVNode);\n }\n } else {\n // Paint to canvas for all other renderers.\n brushSingle(ctx, symbol);\n }\n }\n }\n }\n}\n/**\n * Convert symbol array into normalized array\n *\n * @param {string | (string | string[])[]} symbol symbol input\n * @return {string[][]} normolized symbol array\n */\n\nfunction normalizeSymbolArray(symbol) {\n if (!symbol || symbol.length === 0) {\n return [['rect']];\n }\n\n if (isString(symbol)) {\n return [[symbol]];\n }\n\n var isAllString = true;\n\n for (var i = 0; i < symbol.length; ++i) {\n if (!isString(symbol[i])) {\n isAllString = false;\n break;\n }\n }\n\n if (isAllString) {\n return normalizeSymbolArray([symbol]);\n }\n\n var result = [];\n\n for (var i = 0; i < symbol.length; ++i) {\n if (isString(symbol[i])) {\n result.push([symbol[i]]);\n } else {\n result.push(symbol[i]);\n }\n }\n\n return result;\n}\n/**\n * Convert dash input into dashArray\n *\n * @param {DecalDashArrayX} dash dash input\n * @return {number[][]} normolized dash array\n */\n\n\nfunction normalizeDashArrayX(dash) {\n if (!dash || dash.length === 0) {\n return [[0, 0]];\n }\n\n if (isNumber(dash)) {\n var dashValue = Math.ceil(dash);\n return [[dashValue, dashValue]];\n }\n /**\n * [20, 5] should be normalized into [[20, 5]],\n * while [20, [5, 10]] should be normalized into [[20, 20], [5, 10]]\n */\n\n\n var isAllNumber = true;\n\n for (var i = 0; i < dash.length; ++i) {\n if (!isNumber(dash[i])) {\n isAllNumber = false;\n break;\n }\n }\n\n if (isAllNumber) {\n return normalizeDashArrayX([dash]);\n }\n\n var result = [];\n\n for (var i = 0; i < dash.length; ++i) {\n if (isNumber(dash[i])) {\n var dashValue = Math.ceil(dash[i]);\n result.push([dashValue, dashValue]);\n } else {\n var dashValue = map(dash[i], function (n) {\n return Math.ceil(n);\n });\n\n if (dashValue.length % 2 === 1) {\n // [4, 2, 1] means |---- - -- |---- - -- |\n // so normalize it to be [4, 2, 1, 4, 2, 1]\n result.push(dashValue.concat(dashValue));\n } else {\n result.push(dashValue);\n }\n }\n }\n\n return result;\n}\n/**\n * Convert dash input into dashArray\n *\n * @param {DecalDashArrayY} dash dash input\n * @return {number[]} normolized dash array\n */\n\n\nfunction normalizeDashArrayY(dash) {\n if (!dash || typeof dash === 'object' && dash.length === 0) {\n return [0, 0];\n }\n\n if (isNumber(dash)) {\n var dashValue_1 = Math.ceil(dash);\n return [dashValue_1, dashValue_1];\n }\n\n var dashValue = map(dash, function (n) {\n return Math.ceil(n);\n });\n return dash.length % 2 ? dashValue.concat(dashValue) : dashValue;\n}\n/**\n * Get block length of each line. A block is the length of dash line and space.\n * For example, a line with [4, 1] has a dash line of 4 and a space of 1 after\n * that, so the block length of this line is 5.\n *\n * @param {number[][]} dash dash arrary of X or Y\n * @return {number[]} block length of each line\n */\n\n\nfunction getLineBlockLengthX(dash) {\n return map(dash, function (line) {\n return getLineBlockLengthY(line);\n });\n}\n\nfunction getLineBlockLengthY(dash) {\n var blockLength = 0;\n\n for (var i = 0; i < dash.length; ++i) {\n blockLength += dash[i];\n }\n\n if (dash.length % 2 === 1) {\n // [4, 2, 1] means |---- - -- |---- - -- |\n // So total length is (4 + 2 + 1) * 2\n return blockLength * 2;\n }\n\n return blockLength;\n}","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { createOrUpdatePatternFromDecal } from '../util/decal.js';\nexport default function decalVisual(ecModel, api) {\n ecModel.eachRawSeries(function (seriesModel) {\n if (ecModel.isSeriesFiltered(seriesModel)) {\n return;\n }\n\n var data = seriesModel.getData();\n\n if (data.hasItemVisual()) {\n data.each(function (idx) {\n var decal = data.getItemVisual(idx, 'decal');\n\n if (decal) {\n var itemStyle = data.ensureUniqueItemVisual(idx, 'style');\n itemStyle.decal = createOrUpdatePatternFromDecal(decal, api);\n }\n });\n }\n\n var decal = data.getVisual('decal');\n\n if (decal) {\n var style = data.getVisual('style');\n style.decal = createOrUpdatePatternFromDecal(decal, api);\n }\n });\n}","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport Eventful from 'zrender/lib/core/Eventful.js';\n;\nvar lifecycle = new Eventful();\nexport default lifecycle;","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { error } from '../util/log.js'; // Implementation of exported APIs. For example registerMap, getMap.\n// The implentations will be registered when installing the component.\n// Avoid these code being bundled to the core module.\n\nvar implsStore = {}; // TODO Type\n\nexport function registerImpl(name, impl) {\n if (process.env.NODE_ENV !== 'production') {\n if (implsStore[name]) {\n error(\"Already has an implementation of \" + name + \".\");\n }\n }\n\n implsStore[name] = impl;\n}\nexport function getImpl(name) {\n if (process.env.NODE_ENV !== 'production') {\n if (!implsStore[name]) {\n error(\"Implementation of \" + name + \" doesn't exists.\");\n }\n }\n\n return implsStore[name];\n}","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\nimport { __extends } from \"tslib\";\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\nimport * as zrender from 'zrender/lib/zrender.js';\nimport { assert, each, isFunction, isObject, indexOf, bind, clone, setAsPrimitive, extend, createHashMap, map, defaults, isDom, isArray, noop, isString } from 'zrender/lib/core/util.js';\nimport env from 'zrender/lib/core/env.js';\nimport timsort from 'zrender/lib/core/timsort.js';\nimport Eventful from 'zrender/lib/core/Eventful.js';\nimport GlobalModel from '../model/Global.js';\nimport ExtensionAPI from './ExtensionAPI.js';\nimport CoordinateSystemManager from './CoordinateSystem.js';\nimport OptionManager from '../model/OptionManager.js';\nimport backwardCompat from '../preprocessor/backwardCompat.js';\nimport dataStack from '../processor/dataStack.js';\nimport SeriesModel from '../model/Series.js';\nimport ComponentView from '../view/Component.js';\nimport ChartView from '../view/Chart.js';\nimport * as graphic from '../util/graphic.js';\nimport { getECData } from '../util/innerStore.js';\nimport { isHighDownDispatcher, HOVER_STATE_EMPHASIS, HOVER_STATE_BLUR, blurSeriesFromHighlightPayload, toggleSelectionFromPayload, updateSeriesElementSelection, getAllSelectedIndices, isSelectChangePayload, isHighDownPayload, HIGHLIGHT_ACTION_TYPE, DOWNPLAY_ACTION_TYPE, SELECT_ACTION_TYPE, UNSELECT_ACTION_TYPE, TOGGLE_SELECT_ACTION_TYPE, savePathStates, enterEmphasis, leaveEmphasis, leaveBlur, enterSelect, leaveSelect, enterBlur, allLeaveBlur, findComponentHighDownDispatchers, blurComponent, handleGlobalMouseOverForHighDown, handleGlobalMouseOutForHighDown } from '../util/states.js';\nimport * as modelUtil from '../util/model.js';\nimport { throttle } from '../util/throttle.js';\nimport { seriesStyleTask, dataStyleTask, dataColorPaletteTask } from '../visual/style.js';\nimport loadingDefault from '../loading/default.js';\nimport Scheduler from './Scheduler.js';\nimport lightTheme from '../theme/light.js';\nimport darkTheme from '../theme/dark.js';\nimport { parseClassType } from '../util/clazz.js';\nimport { ECEventProcessor } from '../util/ECEventProcessor.js';\nimport { seriesSymbolTask, dataSymbolTask } from '../visual/symbol.js';\nimport { getVisualFromData, getItemVisualFromData } from '../visual/helper.js';\nimport { deprecateLog, deprecateReplaceLog, error } from '../util/log.js';\nimport { handleLegacySelectEvents } from '../legacy/dataSelectAction.js';\nimport { registerExternalTransform } from '../data/helper/transform.js';\nimport { createLocaleObject, SYSTEM_LANG } from './locale.js';\nimport { findEventDispatcher } from '../util/event.js';\nimport decal from '../visual/decal.js';\nimport lifecycle from './lifecycle.js';\nimport { platformApi, setPlatformAPI } from 'zrender/lib/core/platform.js';\nimport { getImpl } from './impl.js';\nvar hasWindow = typeof window !== 'undefined';\nexport var version = '5.3.0';\nexport var dependencies = {\n zrender: '5.3.0'\n};\nvar TEST_FRAME_REMAIN_TIME = 1;\nvar PRIORITY_PROCESSOR_SERIES_FILTER = 800; // Some data processors depends on the stack result dimension (to calculate data extent).\n// So data stack stage should be in front of data processing stage.\n\nvar PRIORITY_PROCESSOR_DATASTACK = 900; // \"Data filter\" will block the stream, so it should be\n// put at the begining of data processing.\n\nvar PRIORITY_PROCESSOR_FILTER = 1000;\nvar PRIORITY_PROCESSOR_DEFAULT = 2000;\nvar PRIORITY_PROCESSOR_STATISTIC = 5000;\nvar PRIORITY_VISUAL_LAYOUT = 1000;\nvar PRIORITY_VISUAL_PROGRESSIVE_LAYOUT = 1100;\nvar PRIORITY_VISUAL_GLOBAL = 2000;\nvar PRIORITY_VISUAL_CHART = 3000;\nvar PRIORITY_VISUAL_COMPONENT = 4000; // Visual property in data. Greater than `PRIORITY_VISUAL_COMPONENT` to enable to\n// overwrite the viusal result of component (like `visualMap`)\n// using data item specific setting (like itemStyle.xxx on data item)\n\nvar PRIORITY_VISUAL_CHART_DATA_CUSTOM = 4500; // Greater than `PRIORITY_VISUAL_CHART_DATA_CUSTOM` to enable to layout based on\n// visual result like `symbolSize`.\n\nvar PRIORITY_VISUAL_POST_CHART_LAYOUT = 4600;\nvar PRIORITY_VISUAL_BRUSH = 5000;\nvar PRIORITY_VISUAL_ARIA = 6000;\nvar PRIORITY_VISUAL_DECAL = 7000;\nexport var PRIORITY = {\n PROCESSOR: {\n FILTER: PRIORITY_PROCESSOR_FILTER,\n SERIES_FILTER: PRIORITY_PROCESSOR_SERIES_FILTER,\n STATISTIC: PRIORITY_PROCESSOR_STATISTIC\n },\n VISUAL: {\n LAYOUT: PRIORITY_VISUAL_LAYOUT,\n PROGRESSIVE_LAYOUT: PRIORITY_VISUAL_PROGRESSIVE_LAYOUT,\n GLOBAL: PRIORITY_VISUAL_GLOBAL,\n CHART: PRIORITY_VISUAL_CHART,\n POST_CHART_LAYOUT: PRIORITY_VISUAL_POST_CHART_LAYOUT,\n COMPONENT: PRIORITY_VISUAL_COMPONENT,\n BRUSH: PRIORITY_VISUAL_BRUSH,\n CHART_ITEM: PRIORITY_VISUAL_CHART_DATA_CUSTOM,\n ARIA: PRIORITY_VISUAL_ARIA,\n DECAL: PRIORITY_VISUAL_DECAL\n }\n}; // Main process have three entries: `setOption`, `dispatchAction` and `resize`,\n// where they must not be invoked nestedly, except the only case: invoke\n// dispatchAction with updateMethod \"none\" in main process.\n// This flag is used to carry out this rule.\n// All events will be triggered out side main process (i.e. when !this[IN_MAIN_PROCESS]).\n\nvar IN_MAIN_PROCESS_KEY = '__flagInMainProcess';\nvar PENDING_UPDATE = '__pendingUpdate';\nvar STATUS_NEEDS_UPDATE_KEY = '__needsUpdateStatus';\nvar ACTION_REG = /^[a-zA-Z0-9_]+$/;\nvar CONNECT_STATUS_KEY = '__connectUpdateStatus';\nvar CONNECT_STATUS_PENDING = 0;\nvar CONNECT_STATUS_UPDATING = 1;\nvar CONNECT_STATUS_UPDATED = 2;\n;\n;\n\nfunction createRegisterEventWithLowercaseECharts(method) {\n return function () {\n var args = [];\n\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n\n if (this.isDisposed()) {\n disposedWarning(this.id);\n return;\n }\n\n return toLowercaseNameAndCallEventful(this, method, args);\n };\n}\n\nfunction createRegisterEventWithLowercaseMessageCenter(method) {\n return function () {\n var args = [];\n\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n\n return toLowercaseNameAndCallEventful(this, method, args);\n };\n}\n\nfunction toLowercaseNameAndCallEventful(host, method, args) {\n // `args[0]` is event name. Event name is all lowercase.\n args[0] = args[0] && args[0].toLowerCase();\n return Eventful.prototype[method].apply(host, args);\n}\n\nvar MessageCenter =\n/** @class */\nfunction (_super) {\n __extends(MessageCenter, _super);\n\n function MessageCenter() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n\n return MessageCenter;\n}(Eventful);\n\nvar messageCenterProto = MessageCenter.prototype;\nmessageCenterProto.on = createRegisterEventWithLowercaseMessageCenter('on');\nmessageCenterProto.off = createRegisterEventWithLowercaseMessageCenter('off'); // ---------------------------------------\n// Internal method names for class ECharts\n// ---------------------------------------\n\nvar prepare;\nvar prepareView;\nvar updateDirectly;\nvar updateMethods;\nvar doConvertPixel;\nvar updateStreamModes;\nvar doDispatchAction;\nvar flushPendingActions;\nvar triggerUpdatedEvent;\nvar bindRenderedEvent;\nvar bindMouseEvent;\nvar render;\nvar renderComponents;\nvar renderSeries;\nvar createExtensionAPI;\nvar enableConnect;\nvar markStatusToUpdate;\nvar applyChangedStates;\n\nvar ECharts =\n/** @class */\nfunction (_super) {\n __extends(ECharts, _super);\n\n function ECharts(dom, // Theme name or themeOption.\n theme, opts) {\n var _this = _super.call(this, new ECEventProcessor()) || this;\n\n _this._chartsViews = [];\n _this._chartsMap = {};\n _this._componentsViews = [];\n _this._componentsMap = {}; // Can't dispatch action during rendering procedure\n\n _this._pendingActions = [];\n opts = opts || {}; // Get theme by name\n\n if (isString(theme)) {\n theme = themeStorage[theme];\n }\n\n _this._dom = dom;\n var defaultRenderer = 'canvas';\n var defaultUseDirtyRect = false;\n\n if (process.env.NODE_ENV !== 'production') {\n var root =\n /* eslint-disable-next-line */\n hasWindow ? window : global;\n defaultRenderer = root.__ECHARTS__DEFAULT__RENDERER__ || defaultRenderer;\n var devUseDirtyRect = root.__ECHARTS__DEFAULT__USE_DIRTY_RECT__;\n defaultUseDirtyRect = devUseDirtyRect == null ? defaultUseDirtyRect : devUseDirtyRect;\n }\n\n var zr = _this._zr = zrender.init(dom, {\n renderer: opts.renderer || defaultRenderer,\n devicePixelRatio: opts.devicePixelRatio,\n width: opts.width,\n height: opts.height,\n ssr: opts.ssr,\n useDirtyRect: opts.useDirtyRect == null ? defaultUseDirtyRect : opts.useDirtyRect\n });\n _this._ssr = opts.ssr; // Expect 60 fps.\n\n _this._throttledZrFlush = throttle(bind(zr.flush, zr), 17);\n theme = clone(theme);\n theme && backwardCompat(theme, true);\n _this._theme = theme;\n _this._locale = createLocaleObject(opts.locale || SYSTEM_LANG);\n _this._coordSysMgr = new CoordinateSystemManager();\n var api = _this._api = createExtensionAPI(_this); // Sort on demand\n\n function prioritySortFunc(a, b) {\n return a.__prio - b.__prio;\n }\n\n timsort(visualFuncs, prioritySortFunc);\n timsort(dataProcessorFuncs, prioritySortFunc);\n _this._scheduler = new Scheduler(_this, api, dataProcessorFuncs, visualFuncs);\n _this._messageCenter = new MessageCenter(); // Init mouse events\n\n _this._initEvents(); // In case some people write `window.onresize = chart.resize`\n\n\n _this.resize = bind(_this.resize, _this);\n zr.animation.on('frame', _this._onframe, _this);\n bindRenderedEvent(zr, _this);\n bindMouseEvent(zr, _this); // ECharts instance can be used as value.\n\n setAsPrimitive(_this);\n return _this;\n }\n\n ECharts.prototype._onframe = function () {\n if (this._disposed) {\n return;\n }\n\n applyChangedStates(this);\n var scheduler = this._scheduler; // Lazy update\n\n if (this[PENDING_UPDATE]) {\n var silent = this[PENDING_UPDATE].silent;\n this[IN_MAIN_PROCESS_KEY] = true;\n\n try {\n prepare(this);\n updateMethods.update.call(this, null, this[PENDING_UPDATE].updateParams);\n } catch (e) {\n this[IN_MAIN_PROCESS_KEY] = false;\n this[PENDING_UPDATE] = null;\n throw e;\n } // At present, in each frame, zrender performs:\n // (1) animation step forward.\n // (2) trigger('frame') (where this `_onframe` is called)\n // (3) zrender flush (render).\n // If we do nothing here, since we use `setToFinal: true`, the step (3) above\n // will render the final state of the elements before the real animation started.\n\n\n this._zr.flush();\n\n this[IN_MAIN_PROCESS_KEY] = false;\n this[PENDING_UPDATE] = null;\n flushPendingActions.call(this, silent);\n triggerUpdatedEvent.call(this, silent);\n } // Avoid do both lazy update and progress in one frame.\n else if (scheduler.unfinished) {\n // Stream progress.\n var remainTime = TEST_FRAME_REMAIN_TIME;\n var ecModel = this._model;\n var api = this._api;\n scheduler.unfinished = false;\n\n do {\n var startTime = +new Date();\n scheduler.performSeriesTasks(ecModel); // Currently dataProcessorFuncs do not check threshold.\n\n scheduler.performDataProcessorTasks(ecModel);\n updateStreamModes(this, ecModel); // Do not update coordinate system here. Because that coord system update in\n // each frame is not a good user experience. So we follow the rule that\n // the extent of the coordinate system is determin in the first frame (the\n // frame is executed immedietely after task reset.\n // this._coordSysMgr.update(ecModel, api);\n // console.log('--- ec frame visual ---', remainTime);\n\n scheduler.performVisualTasks(ecModel);\n renderSeries(this, this._model, api, 'remain', {});\n remainTime -= +new Date() - startTime;\n } while (remainTime > 0 && scheduler.unfinished); // Call flush explicitly for trigger finished event.\n\n\n if (!scheduler.unfinished) {\n this._zr.flush();\n } // Else, zr flushing be ensue within the same frame,\n // because zr flushing is after onframe event.\n\n }\n };\n\n ECharts.prototype.getDom = function () {\n return this._dom;\n };\n\n ECharts.prototype.getId = function () {\n return this.id;\n };\n\n ECharts.prototype.getZr = function () {\n return this._zr;\n };\n\n ECharts.prototype.isSSR = function () {\n return this._ssr;\n };\n /* eslint-disable-next-line */\n\n\n ECharts.prototype.setOption = function (option, notMerge, lazyUpdate) {\n if (this[IN_MAIN_PROCESS_KEY]) {\n if (process.env.NODE_ENV !== 'production') {\n error('`setOption` should not be called during main process.');\n }\n\n return;\n }\n\n if (this._disposed) {\n disposedWarning(this.id);\n return;\n }\n\n var silent;\n var replaceMerge;\n var transitionOpt;\n\n if (isObject(notMerge)) {\n lazyUpdate = notMerge.lazyUpdate;\n silent = notMerge.silent;\n replaceMerge = notMerge.replaceMerge;\n transitionOpt = notMerge.transition;\n notMerge = notMerge.notMerge;\n }\n\n this[IN_MAIN_PROCESS_KEY] = true;\n\n if (!this._model || notMerge) {\n var optionManager = new OptionManager(this._api);\n var theme = this._theme;\n var ecModel = this._model = new GlobalModel();\n ecModel.scheduler = this._scheduler;\n ecModel.ssr = this._ssr;\n ecModel.init(null, null, null, theme, this._locale, optionManager);\n }\n\n this._model.setOption(option, {\n replaceMerge: replaceMerge\n }, optionPreprocessorFuncs);\n\n var updateParams = {\n seriesTransition: transitionOpt,\n optionChanged: true\n };\n\n if (lazyUpdate) {\n this[PENDING_UPDATE] = {\n silent: silent,\n updateParams: updateParams\n };\n this[IN_MAIN_PROCESS_KEY] = false; // `setOption(option, {lazyMode: true})` may be called when zrender has been slept.\n // It should wake it up to make sure zrender start to render at the next frame.\n\n this.getZr().wakeUp();\n } else {\n try {\n prepare(this);\n updateMethods.update.call(this, null, updateParams);\n } catch (e) {\n this[PENDING_UPDATE] = null;\n this[IN_MAIN_PROCESS_KEY] = false;\n throw e;\n } // Ensure zr refresh sychronously, and then pixel in canvas can be\n // fetched after `setOption`.\n\n\n if (!this._ssr) {\n // not use flush when using ssr mode.\n this._zr.flush();\n }\n\n this[PENDING_UPDATE] = null;\n this[IN_MAIN_PROCESS_KEY] = false;\n flushPendingActions.call(this, silent);\n triggerUpdatedEvent.call(this, silent);\n }\n };\n /**\n * @deprecated\n */\n\n\n ECharts.prototype.setTheme = function () {\n deprecateLog('ECharts#setTheme() is DEPRECATED in ECharts 3.0');\n }; // We don't want developers to use getModel directly.\n\n\n ECharts.prototype.getModel = function () {\n return this._model;\n };\n\n ECharts.prototype.getOption = function () {\n return this._model && this._model.getOption();\n };\n\n ECharts.prototype.getWidth = function () {\n return this._zr.getWidth();\n };\n\n ECharts.prototype.getHeight = function () {\n return this._zr.getHeight();\n };\n\n ECharts.prototype.getDevicePixelRatio = function () {\n return this._zr.painter.dpr\n /* eslint-disable-next-line */\n || hasWindow && window.devicePixelRatio || 1;\n };\n /**\n * Get canvas which has all thing rendered\n * @deprecated Use renderToCanvas instead.\n */\n\n\n ECharts.prototype.getRenderedCanvas = function (opts) {\n if (process.env.NODE_ENV !== 'production') {\n deprecateReplaceLog('getRenderedCanvas', 'renderToCanvas');\n }\n\n return this.renderToCanvas(opts);\n };\n\n ECharts.prototype.renderToCanvas = function (opts) {\n opts = opts || {};\n var painter = this._zr.painter;\n\n if (process.env.NODE_ENV !== 'production') {\n if (painter.type !== 'canvas') {\n throw new Error('renderToCanvas can only be used in the canvas renderer.');\n }\n }\n\n return painter.getRenderedCanvas({\n backgroundColor: opts.backgroundColor || this._model.get('backgroundColor'),\n pixelRatio: opts.pixelRatio || this.getDevicePixelRatio()\n });\n };\n\n ECharts.prototype.renderToSVGString = function (opts) {\n opts = opts || {};\n var painter = this._zr.painter;\n\n if (process.env.NODE_ENV !== 'production') {\n if (painter.type !== 'svg') {\n throw new Error('renderToSVGString can only be used in the svg renderer.');\n }\n }\n\n return painter.renderToString({\n useViewBox: opts.useViewBox\n });\n };\n /**\n * Get svg data url\n */\n\n\n ECharts.prototype.getSvgDataURL = function () {\n if (!env.svgSupported) {\n return;\n }\n\n var zr = this._zr;\n var list = zr.storage.getDisplayList(); // Stop animations\n\n each(list, function (el) {\n el.stopAnimation(null, true);\n });\n return zr.painter.toDataURL();\n };\n\n ECharts.prototype.getDataURL = function (opts) {\n if (this._disposed) {\n disposedWarning(this.id);\n return;\n }\n\n opts = opts || {};\n var excludeComponents = opts.excludeComponents;\n var ecModel = this._model;\n var excludesComponentViews = [];\n var self = this;\n each(excludeComponents, function (componentType) {\n ecModel.eachComponent({\n mainType: componentType\n }, function (component) {\n var view = self._componentsMap[component.__viewId];\n\n if (!view.group.ignore) {\n excludesComponentViews.push(view);\n view.group.ignore = true;\n }\n });\n });\n var url = this._zr.painter.getType() === 'svg' ? this.getSvgDataURL() : this.renderToCanvas(opts).toDataURL('image/' + (opts && opts.type || 'png'));\n each(excludesComponentViews, function (view) {\n view.group.ignore = false;\n });\n return url;\n };\n\n ECharts.prototype.getConnectedDataURL = function (opts) {\n if (this._disposed) {\n disposedWarning(this.id);\n return;\n }\n\n var isSvg = opts.type === 'svg';\n var groupId = this.group;\n var mathMin = Math.min;\n var mathMax = Math.max;\n var MAX_NUMBER = Infinity;\n\n if (connectedGroups[groupId]) {\n var left_1 = MAX_NUMBER;\n var top_1 = MAX_NUMBER;\n var right_1 = -MAX_NUMBER;\n var bottom_1 = -MAX_NUMBER;\n var canvasList_1 = [];\n var dpr_1 = opts && opts.pixelRatio || this.getDevicePixelRatio();\n each(instances, function (chart, id) {\n if (chart.group === groupId) {\n var canvas = isSvg ? chart.getZr().painter.getSvgDom().innerHTML : chart.renderToCanvas(clone(opts));\n var boundingRect = chart.getDom().getBoundingClientRect();\n left_1 = mathMin(boundingRect.left, left_1);\n top_1 = mathMin(boundingRect.top, top_1);\n right_1 = mathMax(boundingRect.right, right_1);\n bottom_1 = mathMax(boundingRect.bottom, bottom_1);\n canvasList_1.push({\n dom: canvas,\n left: boundingRect.left,\n top: boundingRect.top\n });\n }\n });\n left_1 *= dpr_1;\n top_1 *= dpr_1;\n right_1 *= dpr_1;\n bottom_1 *= dpr_1;\n var width = right_1 - left_1;\n var height = bottom_1 - top_1;\n var targetCanvas = platformApi.createCanvas();\n var zr_1 = zrender.init(targetCanvas, {\n renderer: isSvg ? 'svg' : 'canvas'\n });\n zr_1.resize({\n width: width,\n height: height\n });\n\n if (isSvg) {\n var content_1 = '';\n each(canvasList_1, function (item) {\n var x = item.left - left_1;\n var y = item.top - top_1;\n content_1 += '' + item.dom + '';\n });\n zr_1.painter.getSvgRoot().innerHTML = content_1;\n\n if (opts.connectedBackgroundColor) {\n zr_1.painter.setBackgroundColor(opts.connectedBackgroundColor);\n }\n\n zr_1.refreshImmediately();\n return zr_1.painter.toDataURL();\n } else {\n // Background between the charts\n if (opts.connectedBackgroundColor) {\n zr_1.add(new graphic.Rect({\n shape: {\n x: 0,\n y: 0,\n width: width,\n height: height\n },\n style: {\n fill: opts.connectedBackgroundColor\n }\n }));\n }\n\n each(canvasList_1, function (item) {\n var img = new graphic.Image({\n style: {\n x: item.left * dpr_1 - left_1,\n y: item.top * dpr_1 - top_1,\n image: item.dom\n }\n });\n zr_1.add(img);\n });\n zr_1.refreshImmediately();\n return targetCanvas.toDataURL('image/' + (opts && opts.type || 'png'));\n }\n } else {\n return this.getDataURL(opts);\n }\n };\n\n ECharts.prototype.convertToPixel = function (finder, value) {\n return doConvertPixel(this, 'convertToPixel', finder, value);\n };\n\n ECharts.prototype.convertFromPixel = function (finder, value) {\n return doConvertPixel(this, 'convertFromPixel', finder, value);\n };\n /**\n * Is the specified coordinate systems or components contain the given pixel point.\n * @param {Array|number} value\n * @return {boolean} result\n */\n\n\n ECharts.prototype.containPixel = function (finder, value) {\n if (this._disposed) {\n disposedWarning(this.id);\n return;\n }\n\n var ecModel = this._model;\n var result;\n var findResult = modelUtil.parseFinder(ecModel, finder);\n each(findResult, function (models, key) {\n key.indexOf('Models') >= 0 && each(models, function (model) {\n var coordSys = model.coordinateSystem;\n\n if (coordSys && coordSys.containPoint) {\n result = result || !!coordSys.containPoint(value);\n } else if (key === 'seriesModels') {\n var view = this._chartsMap[model.__viewId];\n\n if (view && view.containPoint) {\n result = result || view.containPoint(value, model);\n } else {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(key + ': ' + (view ? 'The found component do not support containPoint.' : 'No view mapping to the found component.'));\n }\n }\n } else {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(key + ': containPoint is not supported');\n }\n }\n }, this);\n }, this);\n return !!result;\n };\n /**\n * Get visual from series or data.\n * @param finder\n * If string, e.g., 'series', means {seriesIndex: 0}.\n * If Object, could contain some of these properties below:\n * {\n * seriesIndex / seriesId / seriesName,\n * dataIndex / dataIndexInside\n * }\n * If dataIndex is not specified, series visual will be fetched,\n * but not data item visual.\n * If all of seriesIndex, seriesId, seriesName are not specified,\n * visual will be fetched from first series.\n * @param visualType 'color', 'symbol', 'symbolSize'\n */\n\n\n ECharts.prototype.getVisual = function (finder, visualType) {\n var ecModel = this._model;\n var parsedFinder = modelUtil.parseFinder(ecModel, finder, {\n defaultMainType: 'series'\n });\n var seriesModel = parsedFinder.seriesModel;\n\n if (process.env.NODE_ENV !== 'production') {\n if (!seriesModel) {\n console.warn('There is no specified seires model');\n }\n }\n\n var data = seriesModel.getData();\n var dataIndexInside = parsedFinder.hasOwnProperty('dataIndexInside') ? parsedFinder.dataIndexInside : parsedFinder.hasOwnProperty('dataIndex') ? data.indexOfRawIndex(parsedFinder.dataIndex) : null;\n return dataIndexInside != null ? getItemVisualFromData(data, dataIndexInside, visualType) : getVisualFromData(data, visualType);\n };\n /**\n * Get view of corresponding component model\n */\n\n\n ECharts.prototype.getViewOfComponentModel = function (componentModel) {\n return this._componentsMap[componentModel.__viewId];\n };\n /**\n * Get view of corresponding series model\n */\n\n\n ECharts.prototype.getViewOfSeriesModel = function (seriesModel) {\n return this._chartsMap[seriesModel.__viewId];\n };\n\n ECharts.prototype._initEvents = function () {\n var _this = this;\n\n each(MOUSE_EVENT_NAMES, function (eveName) {\n var handler = function (e) {\n var ecModel = _this.getModel();\n\n var el = e.target;\n var params;\n var isGlobalOut = eveName === 'globalout'; // no e.target when 'globalout'.\n\n if (isGlobalOut) {\n params = {};\n } else {\n el && findEventDispatcher(el, function (parent) {\n var ecData = getECData(parent);\n\n if (ecData && ecData.dataIndex != null) {\n var dataModel = ecData.dataModel || ecModel.getSeriesByIndex(ecData.seriesIndex);\n params = dataModel && dataModel.getDataParams(ecData.dataIndex, ecData.dataType) || {};\n return true;\n } // If element has custom eventData of components\n else if (ecData.eventData) {\n params = extend({}, ecData.eventData);\n return true;\n }\n }, true);\n } // Contract: if params prepared in mouse event,\n // these properties must be specified:\n // {\n // componentType: string (component main type)\n // componentIndex: number\n // }\n // Otherwise event query can not work.\n\n\n if (params) {\n var componentType = params.componentType;\n var componentIndex = params.componentIndex; // Special handling for historic reason: when trigger by\n // markLine/markPoint/markArea, the componentType is\n // 'markLine'/'markPoint'/'markArea', but we should better\n // enable them to be queried by seriesIndex, since their\n // option is set in each series.\n\n if (componentType === 'markLine' || componentType === 'markPoint' || componentType === 'markArea') {\n componentType = 'series';\n componentIndex = params.seriesIndex;\n }\n\n var model = componentType && componentIndex != null && ecModel.getComponent(componentType, componentIndex);\n var view = model && _this[model.mainType === 'series' ? '_chartsMap' : '_componentsMap'][model.__viewId];\n\n if (process.env.NODE_ENV !== 'production') {\n // `event.componentType` and `event[componentTpype + 'Index']` must not\n // be missed, otherwise there is no way to distinguish source component.\n // See `dataFormat.getDataParams`.\n if (!isGlobalOut && !(model && view)) {\n console.warn('model or view can not be found by params');\n }\n }\n\n params.event = e;\n params.type = eveName;\n _this._$eventProcessor.eventInfo = {\n targetEl: el,\n packedEvent: params,\n model: model,\n view: view\n };\n\n _this.trigger(eveName, params);\n }\n }; // Consider that some component (like tooltip, brush, ...)\n // register zr event handler, but user event handler might\n // do anything, such as call `setOption` or `dispatchAction`,\n // which probably update any of the content and probably\n // cause problem if it is called previous other inner handlers.\n\n\n handler.zrEventfulCallAtLast = true;\n\n _this._zr.on(eveName, handler, _this);\n });\n each(eventActionMap, function (actionType, eventType) {\n _this._messageCenter.on(eventType, function (event) {\n this.trigger(eventType, event);\n }, _this);\n }); // Extra events\n // TODO register?\n\n each(['selectchanged'], function (eventType) {\n _this._messageCenter.on(eventType, function (event) {\n this.trigger(eventType, event);\n }, _this);\n });\n handleLegacySelectEvents(this._messageCenter, this, this._api);\n };\n\n ECharts.prototype.isDisposed = function () {\n return this._disposed;\n };\n\n ECharts.prototype.clear = function () {\n if (this._disposed) {\n disposedWarning(this.id);\n return;\n }\n\n this.setOption({\n series: []\n }, true);\n };\n\n ECharts.prototype.dispose = function () {\n if (this._disposed) {\n disposedWarning(this.id);\n return;\n }\n\n this._disposed = true;\n var dom = this.getDom();\n\n if (dom) {\n modelUtil.setAttribute(this.getDom(), DOM_ATTRIBUTE_KEY, '');\n }\n\n var chart = this;\n var api = chart._api;\n var ecModel = chart._model;\n each(chart._componentsViews, function (component) {\n component.dispose(ecModel, api);\n });\n each(chart._chartsViews, function (chart) {\n chart.dispose(ecModel, api);\n }); // Dispose after all views disposed\n\n chart._zr.dispose(); // Set properties to null.\n // To reduce the memory cost in case the top code still holds this instance unexpectedly.\n\n\n chart._dom = chart._model = chart._chartsMap = chart._componentsMap = chart._chartsViews = chart._componentsViews = chart._scheduler = chart._api = chart._zr = chart._throttledZrFlush = chart._theme = chart._coordSysMgr = chart._messageCenter = null;\n delete instances[chart.id];\n };\n /**\n * Resize the chart\n */\n\n\n ECharts.prototype.resize = function (opts) {\n if (this[IN_MAIN_PROCESS_KEY]) {\n if (process.env.NODE_ENV !== 'production') {\n error('`resize` should not be called during main process.');\n }\n\n return;\n }\n\n if (this._disposed) {\n disposedWarning(this.id);\n return;\n }\n\n this._zr.resize(opts);\n\n var ecModel = this._model; // Resize loading effect\n\n this._loadingFX && this._loadingFX.resize();\n\n if (!ecModel) {\n return;\n }\n\n var needPrepare = ecModel.resetOption('media');\n var silent = opts && opts.silent; // There is some real cases that:\n // chart.setOption(option, { lazyUpdate: true });\n // chart.resize();\n\n if (this[PENDING_UPDATE]) {\n if (silent == null) {\n silent = this[PENDING_UPDATE].silent;\n }\n\n needPrepare = true;\n this[PENDING_UPDATE] = null;\n }\n\n this[IN_MAIN_PROCESS_KEY] = true;\n\n try {\n needPrepare && prepare(this);\n updateMethods.update.call(this, {\n type: 'resize',\n animation: extend({\n // Disable animation\n duration: 0\n }, opts && opts.animation)\n });\n } catch (e) {\n this[IN_MAIN_PROCESS_KEY] = false;\n throw e;\n }\n\n this[IN_MAIN_PROCESS_KEY] = false;\n flushPendingActions.call(this, silent);\n triggerUpdatedEvent.call(this, silent);\n };\n\n ECharts.prototype.showLoading = function (name, cfg) {\n if (this._disposed) {\n disposedWarning(this.id);\n return;\n }\n\n if (isObject(name)) {\n cfg = name;\n name = '';\n }\n\n name = name || 'default';\n this.hideLoading();\n\n if (!loadingEffects[name]) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn('Loading effects ' + name + ' not exists.');\n }\n\n return;\n }\n\n var el = loadingEffects[name](this._api, cfg);\n var zr = this._zr;\n this._loadingFX = el;\n zr.add(el);\n };\n /**\n * Hide loading effect\n */\n\n\n ECharts.prototype.hideLoading = function () {\n if (this._disposed) {\n disposedWarning(this.id);\n return;\n }\n\n this._loadingFX && this._zr.remove(this._loadingFX);\n this._loadingFX = null;\n };\n\n ECharts.prototype.makeActionFromEvent = function (eventObj) {\n var payload = extend({}, eventObj);\n payload.type = eventActionMap[eventObj.type];\n return payload;\n };\n /**\n * @param opt If pass boolean, means opt.silent\n * @param opt.silent Default `false`. Whether trigger events.\n * @param opt.flush Default `undefined`.\n * true: Flush immediately, and then pixel in canvas can be fetched\n * immediately. Caution: it might affect performance.\n * false: Not flush.\n * undefined: Auto decide whether perform flush.\n */\n\n\n ECharts.prototype.dispatchAction = function (payload, opt) {\n if (this._disposed) {\n disposedWarning(this.id);\n return;\n }\n\n if (!isObject(opt)) {\n opt = {\n silent: !!opt\n };\n }\n\n if (!actions[payload.type]) {\n return;\n } // Avoid dispatch action before setOption. Especially in `connect`.\n\n\n if (!this._model) {\n return;\n } // May dispatchAction in rendering procedure\n\n\n if (this[IN_MAIN_PROCESS_KEY]) {\n this._pendingActions.push(payload);\n\n return;\n }\n\n var silent = opt.silent;\n doDispatchAction.call(this, payload, silent);\n var flush = opt.flush;\n\n if (flush) {\n this._zr.flush();\n } else if (flush !== false && env.browser.weChat) {\n // In WeChat embeded browser, `requestAnimationFrame` and `setInterval`\n // hang when sliding page (on touch event), which cause that zr does not\n // refresh util user interaction finished, which is not expected.\n // But `dispatchAction` may be called too frequently when pan on touch\n // screen, which impacts performance if do not throttle them.\n this._throttledZrFlush();\n }\n\n flushPendingActions.call(this, silent);\n triggerUpdatedEvent.call(this, silent);\n };\n\n ECharts.prototype.updateLabelLayout = function () {\n lifecycle.trigger('series:layoutlabels', this._model, this._api, {\n // Not adding series labels.\n // TODO\n updatedSeries: []\n });\n };\n\n ECharts.prototype.appendData = function (params) {\n if (this._disposed) {\n disposedWarning(this.id);\n return;\n }\n\n var seriesIndex = params.seriesIndex;\n var ecModel = this.getModel();\n var seriesModel = ecModel.getSeriesByIndex(seriesIndex);\n\n if (process.env.NODE_ENV !== 'production') {\n assert(params.data && seriesModel);\n }\n\n seriesModel.appendData(params); // Note: `appendData` does not support that update extent of coordinate\n // system, util some scenario require that. In the expected usage of\n // `appendData`, the initial extent of coordinate system should better\n // be fixed by axis `min`/`max` setting or initial data, otherwise if\n // the extent changed while `appendData`, the location of the painted\n // graphic elements have to be changed, which make the usage of\n // `appendData` meaningless.\n\n this._scheduler.unfinished = true;\n this.getZr().wakeUp();\n }; // A work around for no `internal` modifier in ts yet but\n // need to strictly hide private methods to JS users.\n\n\n ECharts.internalField = function () {\n prepare = function (ecIns) {\n var scheduler = ecIns._scheduler;\n scheduler.restorePipelines(ecIns._model);\n scheduler.prepareStageTasks();\n prepareView(ecIns, true);\n prepareView(ecIns, false);\n scheduler.plan();\n };\n /**\n * Prepare view instances of charts and components\n */\n\n\n prepareView = function (ecIns, isComponent) {\n var ecModel = ecIns._model;\n var scheduler = ecIns._scheduler;\n var viewList = isComponent ? ecIns._componentsViews : ecIns._chartsViews;\n var viewMap = isComponent ? ecIns._componentsMap : ecIns._chartsMap;\n var zr = ecIns._zr;\n var api = ecIns._api;\n\n for (var i = 0; i < viewList.length; i++) {\n viewList[i].__alive = false;\n }\n\n isComponent ? ecModel.eachComponent(function (componentType, model) {\n componentType !== 'series' && doPrepare(model);\n }) : ecModel.eachSeries(doPrepare);\n\n function doPrepare(model) {\n // By defaut view will be reused if possible for the case that `setOption` with \"notMerge\"\n // mode and need to enable transition animation. (Usually, when they have the same id, or\n // especially no id but have the same type & name & index. See the `model.id` generation\n // rule in `makeIdAndName` and `viewId` generation rule here).\n // But in `replaceMerge` mode, this feature should be able to disabled when it is clear that\n // the new model has nothing to do with the old model.\n var requireNewView = model.__requireNewView; // This command should not work twice.\n\n model.__requireNewView = false; // Consider: id same and type changed.\n\n var viewId = '_ec_' + model.id + '_' + model.type;\n var view = !requireNewView && viewMap[viewId];\n\n if (!view) {\n var classType = parseClassType(model.type);\n var Clazz = isComponent ? ComponentView.getClass(classType.main, classType.sub) : // FIXME:TS\n // (ChartView as ChartViewConstructor).getClass('series', classType.sub)\n // For backward compat, still support a chart type declared as only subType\n // like \"liquidfill\", but recommend \"series.liquidfill\"\n // But need a base class to make a type series.\n ChartView.getClass(classType.sub);\n\n if (process.env.NODE_ENV !== 'production') {\n assert(Clazz, classType.sub + ' does not exist.');\n }\n\n view = new Clazz();\n view.init(ecModel, api);\n viewMap[viewId] = view;\n viewList.push(view);\n zr.add(view.group);\n }\n\n model.__viewId = view.__id = viewId;\n view.__alive = true;\n view.__model = model;\n view.group.__ecComponentInfo = {\n mainType: model.mainType,\n index: model.componentIndex\n };\n !isComponent && scheduler.prepareView(view, model, ecModel, api);\n }\n\n for (var i = 0; i < viewList.length;) {\n var view = viewList[i];\n\n if (!view.__alive) {\n !isComponent && view.renderTask.dispose();\n zr.remove(view.group);\n view.dispose(ecModel, api);\n viewList.splice(i, 1);\n\n if (viewMap[view.__id] === view) {\n delete viewMap[view.__id];\n }\n\n view.__id = view.group.__ecComponentInfo = null;\n } else {\n i++;\n }\n }\n };\n\n updateDirectly = function (ecIns, method, payload, mainType, subType) {\n var ecModel = ecIns._model;\n ecModel.setUpdatePayload(payload); // broadcast\n\n if (!mainType) {\n // FIXME\n // Chart will not be update directly here, except set dirty.\n // But there is no such scenario now.\n each([].concat(ecIns._componentsViews).concat(ecIns._chartsViews), callView);\n return;\n }\n\n var query = {};\n query[mainType + 'Id'] = payload[mainType + 'Id'];\n query[mainType + 'Index'] = payload[mainType + 'Index'];\n query[mainType + 'Name'] = payload[mainType + 'Name'];\n var condition = {\n mainType: mainType,\n query: query\n };\n subType && (condition.subType = subType); // subType may be '' by parseClassType;\n\n var excludeSeriesId = payload.excludeSeriesId;\n var excludeSeriesIdMap;\n\n if (excludeSeriesId != null) {\n excludeSeriesIdMap = createHashMap();\n each(modelUtil.normalizeToArray(excludeSeriesId), function (id) {\n var modelId = modelUtil.convertOptionIdName(id, null);\n\n if (modelId != null) {\n excludeSeriesIdMap.set(modelId, true);\n }\n });\n } // If dispatchAction before setOption, do nothing.\n\n\n ecModel && ecModel.eachComponent(condition, function (model) {\n var isExcluded = excludeSeriesIdMap && excludeSeriesIdMap.get(model.id) !== null;\n\n if (isExcluded) {\n return;\n }\n\n ;\n\n if (isHighDownPayload(payload)) {\n if (model instanceof SeriesModel) {\n if (payload.type === HIGHLIGHT_ACTION_TYPE && !payload.notBlur && !model.get(['emphasis', 'disabled'])) {\n blurSeriesFromHighlightPayload(model, payload, ecIns._api);\n }\n } else {\n var _a = findComponentHighDownDispatchers(model.mainType, model.componentIndex, payload.name, ecIns._api),\n focusSelf = _a.focusSelf,\n dispatchers = _a.dispatchers;\n\n if (payload.type === HIGHLIGHT_ACTION_TYPE && focusSelf && !payload.notBlur) {\n blurComponent(model.mainType, model.componentIndex, ecIns._api);\n } // PENDING:\n // Whether to put this \"enter emphasis\" code in `ComponentView`,\n // which will be the same as `ChartView` but might be not necessary\n // and will be far from this logic.\n\n\n if (dispatchers) {\n each(dispatchers, function (dispatcher) {\n payload.type === HIGHLIGHT_ACTION_TYPE ? enterEmphasis(dispatcher) : leaveEmphasis(dispatcher);\n });\n }\n }\n } else if (isSelectChangePayload(payload)) {\n // TODO geo\n if (model instanceof SeriesModel) {\n toggleSelectionFromPayload(model, payload, ecIns._api);\n updateSeriesElementSelection(model);\n markStatusToUpdate(ecIns);\n }\n }\n }, ecIns);\n ecModel && ecModel.eachComponent(condition, function (model) {\n var isExcluded = excludeSeriesIdMap && excludeSeriesIdMap.get(model.id) !== null;\n\n if (isExcluded) {\n return;\n }\n\n ;\n callView(ecIns[mainType === 'series' ? '_chartsMap' : '_componentsMap'][model.__viewId]);\n }, ecIns);\n\n function callView(view) {\n view && view.__alive && view[method] && view[method](view.__model, ecModel, ecIns._api, payload);\n }\n };\n\n updateMethods = {\n prepareAndUpdate: function (payload) {\n prepare(this);\n updateMethods.update.call(this, payload, {\n // Needs to mark option changed if newOption is given.\n // It's from MagicType.\n // TODO If use a separate flag optionChanged in payload?\n optionChanged: payload.newOption != null\n });\n },\n update: function (payload, updateParams) {\n var ecModel = this._model;\n var api = this._api;\n var zr = this._zr;\n var coordSysMgr = this._coordSysMgr;\n var scheduler = this._scheduler; // update before setOption\n\n if (!ecModel) {\n return;\n }\n\n ecModel.setUpdatePayload(payload);\n scheduler.restoreData(ecModel, payload);\n scheduler.performSeriesTasks(ecModel); // TODO\n // Save total ecModel here for undo/redo (after restoring data and before processing data).\n // Undo (restoration of total ecModel) can be carried out in 'action' or outside API call.\n // Create new coordinate system each update\n // In LineView may save the old coordinate system and use it to get the orignal point\n\n coordSysMgr.create(ecModel, api);\n scheduler.performDataProcessorTasks(ecModel, payload); // Current stream render is not supported in data process. So we can update\n // stream modes after data processing, where the filtered data is used to\n // deteming whether use progressive rendering.\n\n updateStreamModes(this, ecModel); // We update stream modes before coordinate system updated, then the modes info\n // can be fetched when coord sys updating (consider the barGrid extent fix). But\n // the drawback is the full coord info can not be fetched. Fortunately this full\n // coord is not requied in stream mode updater currently.\n\n coordSysMgr.update(ecModel, api);\n clearColorPalette(ecModel);\n scheduler.performVisualTasks(ecModel, payload);\n render(this, ecModel, api, payload, updateParams); // Set background\n\n var backgroundColor = ecModel.get('backgroundColor') || 'transparent';\n var darkMode = ecModel.get('darkMode');\n zr.setBackgroundColor(backgroundColor); // Force set dark mode.\n\n if (darkMode != null && darkMode !== 'auto') {\n zr.setDarkMode(darkMode);\n }\n\n lifecycle.trigger('afterupdate', ecModel, api);\n },\n updateTransform: function (payload) {\n var _this = this;\n\n var ecModel = this._model;\n var api = this._api; // update before setOption\n\n if (!ecModel) {\n return;\n }\n\n ecModel.setUpdatePayload(payload); // ChartView.markUpdateMethod(payload, 'updateTransform');\n\n var componentDirtyList = [];\n ecModel.eachComponent(function (componentType, componentModel) {\n if (componentType === 'series') {\n return;\n }\n\n var componentView = _this.getViewOfComponentModel(componentModel);\n\n if (componentView && componentView.__alive) {\n if (componentView.updateTransform) {\n var result = componentView.updateTransform(componentModel, ecModel, api, payload);\n result && result.update && componentDirtyList.push(componentView);\n } else {\n componentDirtyList.push(componentView);\n }\n }\n });\n var seriesDirtyMap = createHashMap();\n ecModel.eachSeries(function (seriesModel) {\n var chartView = _this._chartsMap[seriesModel.__viewId];\n\n if (chartView.updateTransform) {\n var result = chartView.updateTransform(seriesModel, ecModel, api, payload);\n result && result.update && seriesDirtyMap.set(seriesModel.uid, 1);\n } else {\n seriesDirtyMap.set(seriesModel.uid, 1);\n }\n });\n clearColorPalette(ecModel); // Keep pipe to the exist pipeline because it depends on the render task of the full pipeline.\n // this._scheduler.performVisualTasks(ecModel, payload, 'layout', true);\n\n this._scheduler.performVisualTasks(ecModel, payload, {\n setDirty: true,\n dirtyMap: seriesDirtyMap\n }); // Currently, not call render of components. Geo render cost a lot.\n // renderComponents(ecIns, ecModel, api, payload, componentDirtyList);\n\n\n renderSeries(this, ecModel, api, payload, {}, seriesDirtyMap);\n lifecycle.trigger('afterupdate', ecModel, api);\n },\n updateView: function (payload) {\n var ecModel = this._model; // update before setOption\n\n if (!ecModel) {\n return;\n }\n\n ecModel.setUpdatePayload(payload);\n ChartView.markUpdateMethod(payload, 'updateView');\n clearColorPalette(ecModel); // Keep pipe to the exist pipeline because it depends on the render task of the full pipeline.\n\n this._scheduler.performVisualTasks(ecModel, payload, {\n setDirty: true\n });\n\n render(this, ecModel, this._api, payload, {});\n lifecycle.trigger('afterupdate', ecModel, this._api);\n },\n updateVisual: function (payload) {\n // updateMethods.update.call(this, payload);\n var _this = this;\n\n var ecModel = this._model; // update before setOption\n\n if (!ecModel) {\n return;\n }\n\n ecModel.setUpdatePayload(payload); // clear all visual\n\n ecModel.eachSeries(function (seriesModel) {\n seriesModel.getData().clearAllVisual();\n }); // Perform visual\n\n ChartView.markUpdateMethod(payload, 'updateVisual');\n clearColorPalette(ecModel); // Keep pipe to the exist pipeline because it depends on the render task of the full pipeline.\n\n this._scheduler.performVisualTasks(ecModel, payload, {\n visualType: 'visual',\n setDirty: true\n });\n\n ecModel.eachComponent(function (componentType, componentModel) {\n if (componentType !== 'series') {\n var componentView = _this.getViewOfComponentModel(componentModel);\n\n componentView && componentView.__alive && componentView.updateVisual(componentModel, ecModel, _this._api, payload);\n }\n });\n ecModel.eachSeries(function (seriesModel) {\n var chartView = _this._chartsMap[seriesModel.__viewId];\n chartView.updateVisual(seriesModel, ecModel, _this._api, payload);\n });\n lifecycle.trigger('afterupdate', ecModel, this._api);\n },\n updateLayout: function (payload) {\n updateMethods.update.call(this, payload);\n }\n };\n\n doConvertPixel = function (ecIns, methodName, finder, value) {\n if (ecIns._disposed) {\n disposedWarning(ecIns.id);\n return;\n }\n\n var ecModel = ecIns._model;\n\n var coordSysList = ecIns._coordSysMgr.getCoordinateSystems();\n\n var result;\n var parsedFinder = modelUtil.parseFinder(ecModel, finder);\n\n for (var i = 0; i < coordSysList.length; i++) {\n var coordSys = coordSysList[i];\n\n if (coordSys[methodName] && (result = coordSys[methodName](ecModel, parsedFinder, value)) != null) {\n return result;\n }\n }\n\n if (process.env.NODE_ENV !== 'production') {\n console.warn('No coordinate system that supports ' + methodName + ' found by the given finder.');\n }\n };\n\n updateStreamModes = function (ecIns, ecModel) {\n var chartsMap = ecIns._chartsMap;\n var scheduler = ecIns._scheduler;\n ecModel.eachSeries(function (seriesModel) {\n scheduler.updateStreamModes(seriesModel, chartsMap[seriesModel.__viewId]);\n });\n };\n\n doDispatchAction = function (payload, silent) {\n var _this = this;\n\n var ecModel = this.getModel();\n var payloadType = payload.type;\n var escapeConnect = payload.escapeConnect;\n var actionWrap = actions[payloadType];\n var actionInfo = actionWrap.actionInfo;\n var cptTypeTmp = (actionInfo.update || 'update').split(':');\n var updateMethod = cptTypeTmp.pop();\n var cptType = cptTypeTmp[0] != null && parseClassType(cptTypeTmp[0]);\n this[IN_MAIN_PROCESS_KEY] = true;\n var payloads = [payload];\n var batched = false; // Batch action\n\n if (payload.batch) {\n batched = true;\n payloads = map(payload.batch, function (item) {\n item = defaults(extend({}, item), payload);\n item.batch = null;\n return item;\n });\n }\n\n var eventObjBatch = [];\n var eventObj;\n var isSelectChange = isSelectChangePayload(payload);\n var isHighDown = isHighDownPayload(payload); // Only leave blur once if there are multiple batches.\n\n if (isHighDown) {\n allLeaveBlur(this._api);\n }\n\n each(payloads, function (batchItem) {\n // Action can specify the event by return it.\n eventObj = actionWrap.action(batchItem, _this._model, _this._api); // Emit event outside\n\n eventObj = eventObj || extend({}, batchItem); // Convert type to eventType\n\n eventObj.type = actionInfo.event || eventObj.type;\n eventObjBatch.push(eventObj); // light update does not perform data process, layout and visual.\n\n if (isHighDown) {\n var _a = modelUtil.preParseFinder(payload),\n queryOptionMap = _a.queryOptionMap,\n mainTypeSpecified = _a.mainTypeSpecified;\n\n var componentMainType = mainTypeSpecified ? queryOptionMap.keys()[0] : 'series';\n updateDirectly(_this, updateMethod, batchItem, componentMainType);\n markStatusToUpdate(_this);\n } else if (isSelectChange) {\n // At present `dispatchAction({ type: 'select', ... })` is not supported on components.\n // geo still use 'geoselect'.\n updateDirectly(_this, updateMethod, batchItem, 'series');\n markStatusToUpdate(_this);\n } else if (cptType) {\n updateDirectly(_this, updateMethod, batchItem, cptType.main, cptType.sub);\n }\n });\n\n if (updateMethod !== 'none' && !isHighDown && !isSelectChange && !cptType) {\n try {\n // Still dirty\n if (this[PENDING_UPDATE]) {\n prepare(this);\n updateMethods.update.call(this, payload);\n this[PENDING_UPDATE] = null;\n } else {\n updateMethods[updateMethod].call(this, payload);\n }\n } catch (e) {\n this[IN_MAIN_PROCESS_KEY] = false;\n throw e;\n }\n } // Follow the rule of action batch\n\n\n if (batched) {\n eventObj = {\n type: actionInfo.event || payloadType,\n escapeConnect: escapeConnect,\n batch: eventObjBatch\n };\n } else {\n eventObj = eventObjBatch[0];\n }\n\n this[IN_MAIN_PROCESS_KEY] = false;\n\n if (!silent) {\n var messageCenter = this._messageCenter;\n messageCenter.trigger(eventObj.type, eventObj); // Extra triggered 'selectchanged' event\n\n if (isSelectChange) {\n var newObj = {\n type: 'selectchanged',\n escapeConnect: escapeConnect,\n selected: getAllSelectedIndices(ecModel),\n isFromClick: payload.isFromClick || false,\n fromAction: payload.type,\n fromActionPayload: payload\n };\n messageCenter.trigger(newObj.type, newObj);\n }\n }\n };\n\n flushPendingActions = function (silent) {\n var pendingActions = this._pendingActions;\n\n while (pendingActions.length) {\n var payload = pendingActions.shift();\n doDispatchAction.call(this, payload, silent);\n }\n };\n\n triggerUpdatedEvent = function (silent) {\n !silent && this.trigger('updated');\n };\n /**\n * Event `rendered` is triggered when zr\n * rendered. It is useful for realtime\n * snapshot (reflect animation).\n *\n * Event `finished` is triggered when:\n * (1) zrender rendering finished.\n * (2) initial animation finished.\n * (3) progressive rendering finished.\n * (4) no pending action.\n * (5) no delayed setOption needs to be processed.\n */\n\n\n bindRenderedEvent = function (zr, ecIns) {\n zr.on('rendered', function (params) {\n ecIns.trigger('rendered', params); // The `finished` event should not be triggered repeatly,\n // so it should only be triggered when rendering indeed happend\n // in zrender. (Consider the case that dipatchAction is keep\n // triggering when mouse move).\n\n if ( // Although zr is dirty if initial animation is not finished\n // and this checking is called on frame, we also check\n // animation finished for robustness.\n zr.animation.isFinished() && !ecIns[PENDING_UPDATE] && !ecIns._scheduler.unfinished && !ecIns._pendingActions.length) {\n ecIns.trigger('finished');\n }\n });\n };\n\n bindMouseEvent = function (zr, ecIns) {\n zr.on('mouseover', function (e) {\n var el = e.target;\n var dispatcher = findEventDispatcher(el, isHighDownDispatcher);\n\n if (dispatcher) {\n handleGlobalMouseOverForHighDown(dispatcher, e, ecIns._api);\n markStatusToUpdate(ecIns);\n }\n }).on('mouseout', function (e) {\n var el = e.target;\n var dispatcher = findEventDispatcher(el, isHighDownDispatcher);\n\n if (dispatcher) {\n handleGlobalMouseOutForHighDown(dispatcher, e, ecIns._api);\n markStatusToUpdate(ecIns);\n }\n }).on('click', function (e) {\n var el = e.target;\n var dispatcher = findEventDispatcher(el, function (target) {\n return getECData(target).dataIndex != null;\n }, true);\n\n if (dispatcher) {\n var actionType = dispatcher.selected ? 'unselect' : 'select';\n var ecData = getECData(dispatcher);\n\n ecIns._api.dispatchAction({\n type: actionType,\n dataType: ecData.dataType,\n dataIndexInside: ecData.dataIndex,\n seriesIndex: ecData.seriesIndex,\n isFromClick: true\n });\n }\n });\n };\n\n function clearColorPalette(ecModel) {\n ecModel.clearColorPalette();\n ecModel.eachSeries(function (seriesModel) {\n seriesModel.clearColorPalette();\n });\n }\n\n ; // Allocate zlevels for series and components\n\n function allocateZlevels(ecModel) {\n ;\n var componentZLevels = [];\n var seriesZLevels = [];\n var hasSeperateZLevel = false;\n ecModel.eachComponent(function (componentType, componentModel) {\n var zlevel = componentModel.get('zlevel') || 0;\n var z = componentModel.get('z') || 0;\n var zlevelKey = componentModel.getZLevelKey();\n hasSeperateZLevel = hasSeperateZLevel || !!zlevelKey;\n (componentType === 'series' ? seriesZLevels : componentZLevels).push({\n zlevel: zlevel,\n z: z,\n idx: componentModel.componentIndex,\n type: componentType,\n key: zlevelKey\n });\n });\n\n if (hasSeperateZLevel) {\n // Series after component\n var zLevels = componentZLevels.concat(seriesZLevels);\n var lastSeriesZLevel_1;\n var lastSeriesKey_1;\n timsort(zLevels, function (a, b) {\n if (a.zlevel === b.zlevel) {\n return a.z - b.z;\n }\n\n return a.zlevel - b.zlevel;\n });\n each(zLevels, function (item) {\n var componentModel = ecModel.getComponent(item.type, item.idx);\n var zlevel = item.zlevel;\n var key = item.key;\n\n if (lastSeriesZLevel_1 != null) {\n zlevel = Math.max(lastSeriesZLevel_1, zlevel);\n }\n\n if (key) {\n if (zlevel === lastSeriesZLevel_1 && key !== lastSeriesKey_1) {\n zlevel++;\n }\n\n lastSeriesKey_1 = key;\n } else if (lastSeriesKey_1) {\n if (zlevel === lastSeriesZLevel_1) {\n zlevel++;\n }\n\n lastSeriesKey_1 = '';\n }\n\n lastSeriesZLevel_1 = zlevel;\n componentModel.setZLevel(zlevel);\n });\n }\n }\n\n render = function (ecIns, ecModel, api, payload, updateParams) {\n allocateZlevels(ecModel);\n renderComponents(ecIns, ecModel, api, payload, updateParams);\n each(ecIns._chartsViews, function (chart) {\n chart.__alive = false;\n });\n renderSeries(ecIns, ecModel, api, payload, updateParams); // Remove groups of unrendered charts\n\n each(ecIns._chartsViews, function (chart) {\n if (!chart.__alive) {\n chart.remove(ecModel, api);\n }\n });\n };\n\n renderComponents = function (ecIns, ecModel, api, payload, updateParams, dirtyList) {\n each(dirtyList || ecIns._componentsViews, function (componentView) {\n var componentModel = componentView.__model;\n clearStates(componentModel, componentView);\n componentView.render(componentModel, ecModel, api, payload);\n updateZ(componentModel, componentView);\n updateStates(componentModel, componentView);\n });\n };\n /**\n * Render each chart and component\n */\n\n\n renderSeries = function (ecIns, ecModel, api, payload, updateParams, dirtyMap) {\n // Render all charts\n var scheduler = ecIns._scheduler;\n updateParams = extend(updateParams || {}, {\n updatedSeries: ecModel.getSeries()\n }); // TODO progressive?\n\n lifecycle.trigger('series:beforeupdate', ecModel, api, updateParams);\n var unfinished = false;\n ecModel.eachSeries(function (seriesModel) {\n var chartView = ecIns._chartsMap[seriesModel.__viewId];\n chartView.__alive = true;\n var renderTask = chartView.renderTask;\n scheduler.updatePayload(renderTask, payload); // TODO states on marker.\n\n clearStates(seriesModel, chartView);\n\n if (dirtyMap && dirtyMap.get(seriesModel.uid)) {\n renderTask.dirty();\n }\n\n if (renderTask.perform(scheduler.getPerformArgs(renderTask))) {\n unfinished = true;\n }\n\n chartView.group.silent = !!seriesModel.get('silent'); // Should not call markRedraw on group, because it will disable zrender\n // increamental render (alway render from the __startIndex each frame)\n // chartView.group.markRedraw();\n\n updateBlend(seriesModel, chartView);\n updateSeriesElementSelection(seriesModel);\n });\n scheduler.unfinished = unfinished || scheduler.unfinished;\n lifecycle.trigger('series:layoutlabels', ecModel, api, updateParams); // transition after label is layouted.\n\n lifecycle.trigger('series:transition', ecModel, api, updateParams);\n ecModel.eachSeries(function (seriesModel) {\n var chartView = ecIns._chartsMap[seriesModel.__viewId]; // Update Z after labels updated. Before applying states.\n\n updateZ(seriesModel, chartView); // NOTE: Update states after label is updated.\n // label should be in normal status when layouting.\n\n updateStates(seriesModel, chartView);\n }); // If use hover layer\n\n updateHoverLayerStatus(ecIns, ecModel);\n lifecycle.trigger('series:afterupdate', ecModel, api, updateParams);\n };\n\n markStatusToUpdate = function (ecIns) {\n ecIns[STATUS_NEEDS_UPDATE_KEY] = true; // Wake up zrender if it's sleep. Let it update states in the next frame.\n\n ecIns.getZr().wakeUp();\n };\n\n applyChangedStates = function (ecIns) {\n if (!ecIns[STATUS_NEEDS_UPDATE_KEY]) {\n return;\n }\n\n ecIns.getZr().storage.traverse(function (el) {\n // Not applied on removed elements, it may still in fading.\n if (graphic.isElementRemoved(el)) {\n return;\n }\n\n applyElementStates(el);\n });\n ecIns[STATUS_NEEDS_UPDATE_KEY] = false;\n };\n\n function applyElementStates(el) {\n var newStates = [];\n var oldStates = el.currentStates; // Keep other states.\n\n for (var i = 0; i < oldStates.length; i++) {\n var stateName = oldStates[i];\n\n if (!(stateName === 'emphasis' || stateName === 'blur' || stateName === 'select')) {\n newStates.push(stateName);\n }\n } // Only use states when it's exists.\n\n\n if (el.selected && el.states.select) {\n newStates.push('select');\n }\n\n if (el.hoverState === HOVER_STATE_EMPHASIS && el.states.emphasis) {\n newStates.push('emphasis');\n } else if (el.hoverState === HOVER_STATE_BLUR && el.states.blur) {\n newStates.push('blur');\n }\n\n el.useStates(newStates);\n }\n\n function updateHoverLayerStatus(ecIns, ecModel) {\n var zr = ecIns._zr;\n var storage = zr.storage;\n var elCount = 0;\n storage.traverse(function (el) {\n if (!el.isGroup) {\n elCount++;\n }\n });\n\n if (elCount > ecModel.get('hoverLayerThreshold') && !env.node && !env.worker) {\n ecModel.eachSeries(function (seriesModel) {\n if (seriesModel.preventUsingHoverLayer) {\n return;\n }\n\n var chartView = ecIns._chartsMap[seriesModel.__viewId];\n\n if (chartView.__alive) {\n chartView.eachRendered(function (el) {\n if (el.states.emphasis) {\n el.states.emphasis.hoverLayer = true;\n }\n });\n }\n });\n }\n }\n\n ;\n /**\n * Update chart and blend.\n */\n\n function updateBlend(seriesModel, chartView) {\n var blendMode = seriesModel.get('blendMode') || null;\n chartView.eachRendered(function (el) {\n // FIXME marker and other components\n if (!el.isGroup) {\n // DONT mark the element dirty. In case element is incremental and don't wan't to rerender.\n el.style.blend = blendMode;\n }\n });\n }\n\n ;\n\n function updateZ(model, view) {\n if (model.preventAutoZ) {\n return;\n }\n\n var z = model.get('z') || 0;\n var zlevel = model.get('zlevel') || 0; // Set z and zlevel\n\n view.eachRendered(function (el) {\n doUpdateZ(el, z, zlevel, -Infinity); // Don't traverse the children because it has been traversed in _updateZ.\n\n return true;\n });\n }\n\n ;\n\n function doUpdateZ(el, z, zlevel, maxZ2) {\n // Group may also have textContent\n var label = el.getTextContent();\n var labelLine = el.getTextGuideLine();\n var isGroup = el.isGroup;\n\n if (isGroup) {\n // set z & zlevel of children elements of Group\n var children = el.childrenRef();\n\n for (var i = 0; i < children.length; i++) {\n maxZ2 = Math.max(doUpdateZ(children[i], z, zlevel, maxZ2), maxZ2);\n }\n } else {\n // not Group\n el.z = z;\n el.zlevel = zlevel;\n maxZ2 = Math.max(el.z2, maxZ2);\n } // always set z and zlevel if label/labelLine exists\n\n\n if (label) {\n label.z = z;\n label.zlevel = zlevel; // lift z2 of text content\n // TODO if el.emphasis.z2 is spcefied, what about textContent.\n\n isFinite(maxZ2) && (label.z2 = maxZ2 + 2);\n }\n\n if (labelLine) {\n var textGuideLineConfig = el.textGuideLineConfig;\n labelLine.z = z;\n labelLine.zlevel = zlevel;\n isFinite(maxZ2) && (labelLine.z2 = maxZ2 + (textGuideLineConfig && textGuideLineConfig.showAbove ? 1 : -1));\n }\n\n return maxZ2;\n } // Clear states without animation.\n // TODO States on component.\n\n\n function clearStates(model, view) {\n view.eachRendered(function (el) {\n // Not applied on removed elements, it may still in fading.\n if (graphic.isElementRemoved(el)) {\n return;\n }\n\n var textContent = el.getTextContent();\n var textGuide = el.getTextGuideLine();\n\n if (el.stateTransition) {\n el.stateTransition = null;\n }\n\n if (textContent && textContent.stateTransition) {\n textContent.stateTransition = null;\n }\n\n if (textGuide && textGuide.stateTransition) {\n textGuide.stateTransition = null;\n } // TODO If el is incremental.\n\n\n if (el.hasState()) {\n el.prevStates = el.currentStates;\n el.clearStates();\n } else if (el.prevStates) {\n el.prevStates = null;\n }\n });\n }\n\n function updateStates(model, view) {\n var stateAnimationModel = model.getModel('stateAnimation');\n var enableAnimation = model.isAnimationEnabled();\n var duration = stateAnimationModel.get('duration');\n var stateTransition = duration > 0 ? {\n duration: duration,\n delay: stateAnimationModel.get('delay'),\n easing: stateAnimationModel.get('easing') // additive: stateAnimationModel.get('additive')\n\n } : null;\n view.eachRendered(function (el) {\n if (el.states && el.states.emphasis) {\n // Not applied on removed elements, it may still in fading.\n if (graphic.isElementRemoved(el)) {\n return;\n }\n\n if (el instanceof graphic.Path) {\n savePathStates(el);\n } // Only updated on changed element. In case element is incremental and don't wan't to rerender.\n // TODO, a more proper way?\n\n\n if (el.__dirty) {\n var prevStates = el.prevStates; // Restore states without animation\n\n if (prevStates) {\n el.useStates(prevStates);\n }\n } // Update state transition and enable animation again.\n\n\n if (enableAnimation) {\n el.stateTransition = stateTransition;\n var textContent = el.getTextContent();\n var textGuide = el.getTextGuideLine(); // TODO Is it necessary to animate label?\n\n if (textContent) {\n textContent.stateTransition = stateTransition;\n }\n\n if (textGuide) {\n textGuide.stateTransition = stateTransition;\n }\n } // The use higlighted and selected flag to toggle states.\n\n\n if (el.__dirty) {\n applyElementStates(el);\n }\n }\n });\n }\n\n ;\n\n createExtensionAPI = function (ecIns) {\n return new (\n /** @class */\n function (_super) {\n __extends(class_1, _super);\n\n function class_1() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n\n class_1.prototype.getCoordinateSystems = function () {\n return ecIns._coordSysMgr.getCoordinateSystems();\n };\n\n class_1.prototype.getComponentByElement = function (el) {\n while (el) {\n var modelInfo = el.__ecComponentInfo;\n\n if (modelInfo != null) {\n return ecIns._model.getComponent(modelInfo.mainType, modelInfo.index);\n }\n\n el = el.parent;\n }\n };\n\n class_1.prototype.enterEmphasis = function (el, highlightDigit) {\n enterEmphasis(el, highlightDigit);\n markStatusToUpdate(ecIns);\n };\n\n class_1.prototype.leaveEmphasis = function (el, highlightDigit) {\n leaveEmphasis(el, highlightDigit);\n markStatusToUpdate(ecIns);\n };\n\n class_1.prototype.enterBlur = function (el) {\n enterBlur(el);\n markStatusToUpdate(ecIns);\n };\n\n class_1.prototype.leaveBlur = function (el) {\n leaveBlur(el);\n markStatusToUpdate(ecIns);\n };\n\n class_1.prototype.enterSelect = function (el) {\n enterSelect(el);\n markStatusToUpdate(ecIns);\n };\n\n class_1.prototype.leaveSelect = function (el) {\n leaveSelect(el);\n markStatusToUpdate(ecIns);\n };\n\n class_1.prototype.getModel = function () {\n return ecIns.getModel();\n };\n\n class_1.prototype.getViewOfComponentModel = function (componentModel) {\n return ecIns.getViewOfComponentModel(componentModel);\n };\n\n class_1.prototype.getViewOfSeriesModel = function (seriesModel) {\n return ecIns.getViewOfSeriesModel(seriesModel);\n };\n\n return class_1;\n }(ExtensionAPI))(ecIns);\n };\n\n enableConnect = function (chart) {\n function updateConnectedChartsStatus(charts, status) {\n for (var i = 0; i < charts.length; i++) {\n var otherChart = charts[i];\n otherChart[CONNECT_STATUS_KEY] = status;\n }\n }\n\n each(eventActionMap, function (actionType, eventType) {\n chart._messageCenter.on(eventType, function (event) {\n if (connectedGroups[chart.group] && chart[CONNECT_STATUS_KEY] !== CONNECT_STATUS_PENDING) {\n if (event && event.escapeConnect) {\n return;\n }\n\n var action_1 = chart.makeActionFromEvent(event);\n var otherCharts_1 = [];\n each(instances, function (otherChart) {\n if (otherChart !== chart && otherChart.group === chart.group) {\n otherCharts_1.push(otherChart);\n }\n });\n updateConnectedChartsStatus(otherCharts_1, CONNECT_STATUS_PENDING);\n each(otherCharts_1, function (otherChart) {\n if (otherChart[CONNECT_STATUS_KEY] !== CONNECT_STATUS_UPDATING) {\n otherChart.dispatchAction(action_1);\n }\n });\n updateConnectedChartsStatus(otherCharts_1, CONNECT_STATUS_UPDATED);\n }\n });\n });\n };\n }();\n\n return ECharts;\n}(Eventful);\n\nvar echartsProto = ECharts.prototype;\nechartsProto.on = createRegisterEventWithLowercaseECharts('on');\nechartsProto.off = createRegisterEventWithLowercaseECharts('off');\n/**\n * @deprecated\n */\n// @ts-ignore\n\nechartsProto.one = function (eventName, cb, ctx) {\n var self = this;\n deprecateLog('ECharts#one is deprecated.');\n\n function wrapped() {\n var args2 = [];\n\n for (var _i = 0; _i < arguments.length; _i++) {\n args2[_i] = arguments[_i];\n }\n\n cb && cb.apply && cb.apply(this, args2); // @ts-ignore\n\n self.off(eventName, wrapped);\n }\n\n ; // @ts-ignore\n\n this.on.call(this, eventName, wrapped, ctx);\n};\n\nvar MOUSE_EVENT_NAMES = ['click', 'dblclick', 'mouseover', 'mouseout', 'mousemove', 'mousedown', 'mouseup', 'globalout', 'contextmenu'];\n\nfunction disposedWarning(id) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn('Instance ' + id + ' has been disposed');\n }\n}\n\nvar actions = {};\n/**\n * Map eventType to actionType\n */\n\nvar eventActionMap = {};\nvar dataProcessorFuncs = [];\nvar optionPreprocessorFuncs = [];\nvar visualFuncs = [];\nvar themeStorage = {};\nvar loadingEffects = {};\nvar instances = {};\nvar connectedGroups = {};\nvar idBase = +new Date() - 0;\nvar groupIdBase = +new Date() - 0;\nvar DOM_ATTRIBUTE_KEY = '_echarts_instance_';\n/**\n * @param opts.devicePixelRatio Use window.devicePixelRatio by default\n * @param opts.renderer Can choose 'canvas' or 'svg' to render the chart.\n * @param opts.width Use clientWidth of the input `dom` by default.\n * Can be 'auto' (the same as null/undefined)\n * @param opts.height Use clientHeight of the input `dom` by default.\n * Can be 'auto' (the same as null/undefined)\n * @param opts.locale Specify the locale.\n * @param opts.useDirtyRect Enable dirty rectangle rendering or not.\n */\n\nexport function init(dom, theme, opts) {\n var isClient = !(opts && opts.ssr);\n\n if (isClient) {\n if (process.env.NODE_ENV !== 'production') {\n if (!dom) {\n throw new Error('Initialize failed: invalid dom.');\n }\n }\n\n var existInstance = getInstanceByDom(dom);\n\n if (existInstance) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn('There is a chart instance already initialized on the dom.');\n }\n\n return existInstance;\n }\n\n if (process.env.NODE_ENV !== 'production') {\n if (isDom(dom) && dom.nodeName.toUpperCase() !== 'CANVAS' && (!dom.clientWidth && (!opts || opts.width == null) || !dom.clientHeight && (!opts || opts.height == null))) {\n console.warn('Can\\'t get DOM width or height. Please check ' + 'dom.clientWidth and dom.clientHeight. They should not be 0.' + 'For example, you may need to call this in the callback ' + 'of window.onload.');\n }\n }\n }\n\n var chart = new ECharts(dom, theme, opts);\n chart.id = 'ec_' + idBase++;\n instances[chart.id] = chart;\n isClient && modelUtil.setAttribute(dom, DOM_ATTRIBUTE_KEY, chart.id);\n enableConnect(chart);\n lifecycle.trigger('afterinit', chart);\n return chart;\n}\n/**\n * @usage\n * (A)\n * ```js\n * let chart1 = echarts.init(dom1);\n * let chart2 = echarts.init(dom2);\n * chart1.group = 'xxx';\n * chart2.group = 'xxx';\n * echarts.connect('xxx');\n * ```\n * (B)\n * ```js\n * let chart1 = echarts.init(dom1);\n * let chart2 = echarts.init(dom2);\n * echarts.connect('xxx', [chart1, chart2]);\n * ```\n */\n\nexport function connect(groupId) {\n // Is array of charts\n if (isArray(groupId)) {\n var charts = groupId;\n groupId = null; // If any chart has group\n\n each(charts, function (chart) {\n if (chart.group != null) {\n groupId = chart.group;\n }\n });\n groupId = groupId || 'g_' + groupIdBase++;\n each(charts, function (chart) {\n chart.group = groupId;\n });\n }\n\n connectedGroups[groupId] = true;\n return groupId;\n}\n/**\n * @deprecated\n */\n\nexport function disConnect(groupId) {\n connectedGroups[groupId] = false;\n}\n/**\n * Alias and backword compat\n */\n\nexport var disconnect = disConnect;\n/**\n * Dispose a chart instance\n */\n\nexport function dispose(chart) {\n if (isString(chart)) {\n chart = instances[chart];\n } else if (!(chart instanceof ECharts)) {\n // Try to treat as dom\n chart = getInstanceByDom(chart);\n }\n\n if (chart instanceof ECharts && !chart.isDisposed()) {\n chart.dispose();\n }\n}\nexport function getInstanceByDom(dom) {\n return instances[modelUtil.getAttribute(dom, DOM_ATTRIBUTE_KEY)];\n}\nexport function getInstanceById(key) {\n return instances[key];\n}\n/**\n * Register theme\n */\n\nexport function registerTheme(name, theme) {\n themeStorage[name] = theme;\n}\n/**\n * Register option preprocessor\n */\n\nexport function registerPreprocessor(preprocessorFunc) {\n if (indexOf(optionPreprocessorFuncs, preprocessorFunc) < 0) {\n optionPreprocessorFuncs.push(preprocessorFunc);\n }\n}\nexport function registerProcessor(priority, processor) {\n normalizeRegister(dataProcessorFuncs, priority, processor, PRIORITY_PROCESSOR_DEFAULT);\n}\n/**\n * Register postIniter\n * @param {Function} postInitFunc\n */\n\nexport function registerPostInit(postInitFunc) {\n registerUpdateLifecycle('afterinit', postInitFunc);\n}\n/**\n * Register postUpdater\n * @param {Function} postUpdateFunc\n */\n\nexport function registerPostUpdate(postUpdateFunc) {\n registerUpdateLifecycle('afterupdate', postUpdateFunc);\n}\nexport function registerUpdateLifecycle(name, cb) {\n lifecycle.on(name, cb);\n}\nexport function registerAction(actionInfo, eventName, action) {\n if (isFunction(eventName)) {\n action = eventName;\n eventName = '';\n }\n\n var actionType = isObject(actionInfo) ? actionInfo.type : [actionInfo, actionInfo = {\n event: eventName\n }][0]; // Event name is all lowercase\n\n actionInfo.event = (actionInfo.event || actionType).toLowerCase();\n eventName = actionInfo.event;\n\n if (eventActionMap[eventName]) {\n // Already registered.\n return;\n } // Validate action type and event name.\n\n\n assert(ACTION_REG.test(actionType) && ACTION_REG.test(eventName));\n\n if (!actions[actionType]) {\n actions[actionType] = {\n action: action,\n actionInfo: actionInfo\n };\n }\n\n eventActionMap[eventName] = actionType;\n}\nexport function registerCoordinateSystem(type, coordSysCreator) {\n CoordinateSystemManager.register(type, coordSysCreator);\n}\n/**\n * Get dimensions of specified coordinate system.\n * @param {string} type\n * @return {Array.}\n */\n\nexport function getCoordinateSystemDimensions(type) {\n var coordSysCreator = CoordinateSystemManager.get(type);\n\n if (coordSysCreator) {\n return coordSysCreator.getDimensionsInfo ? coordSysCreator.getDimensionsInfo() : coordSysCreator.dimensions.slice();\n }\n}\nexport { registerLocale } from './locale.js';\n\nfunction registerLayout(priority, layoutTask) {\n normalizeRegister(visualFuncs, priority, layoutTask, PRIORITY_VISUAL_LAYOUT, 'layout');\n}\n\nfunction registerVisual(priority, visualTask) {\n normalizeRegister(visualFuncs, priority, visualTask, PRIORITY_VISUAL_CHART, 'visual');\n}\n\nexport { registerLayout, registerVisual };\nvar registeredTasks = [];\n\nfunction normalizeRegister(targetList, priority, fn, defaultPriority, visualType) {\n if (isFunction(priority) || isObject(priority)) {\n fn = priority;\n priority = defaultPriority;\n }\n\n if (process.env.NODE_ENV !== 'production') {\n if (isNaN(priority) || priority == null) {\n throw new Error('Illegal priority');\n } // Check duplicate\n\n\n each(targetList, function (wrap) {\n assert(wrap.__raw !== fn);\n });\n } // Already registered\n\n\n if (indexOf(registeredTasks, fn) >= 0) {\n return;\n }\n\n registeredTasks.push(fn);\n var stageHandler = Scheduler.wrapStageHandler(fn, visualType);\n stageHandler.__prio = priority;\n stageHandler.__raw = fn;\n targetList.push(stageHandler);\n}\n\nexport function registerLoading(name, loadingFx) {\n loadingEffects[name] = loadingFx;\n}\n/**\n * ZRender need a canvas context to do measureText.\n * But in node environment canvas may be created by node-canvas.\n * So we need to specify how to create a canvas instead of using document.createElement('canvas')\n *\n *\n * @deprecated use setPlatformAPI({ createCanvas }) instead.\n *\n * @example\n * let Canvas = require('canvas');\n * let echarts = require('echarts');\n * echarts.setCanvasCreator(function () {\n * // Small size is enough.\n * return new Canvas(32, 32);\n * });\n */\n\nexport function setCanvasCreator(creator) {\n if (process.env.NODE_ENV !== 'production') {\n deprecateLog('setCanvasCreator is deprecated. Use setPlatformAPI({ createCanvas }) instead.');\n }\n\n setPlatformAPI({\n createCanvas: creator\n });\n}\n/**\n * The parameters and usage: see `geoSourceManager.registerMap`.\n * Compatible with previous `echarts.registerMap`.\n */\n\nexport function registerMap(mapName, geoJson, specialAreas) {\n var registerMap = getImpl('registerMap');\n registerMap && registerMap(mapName, geoJson, specialAreas);\n}\nexport function getMap(mapName) {\n var getMap = getImpl('getMap');\n return getMap && getMap(mapName);\n}\nexport var registerTransform = registerExternalTransform;\n/**\n * Globa dispatchAction to a specified chart instance.\n */\n// export function dispatchAction(payload: { chartId: string } & Payload, opt?: Parameters[1]) {\n// if (!payload || !payload.chartId) {\n// // Must have chartId to find chart\n// return;\n// }\n// const chart = instances[payload.chartId];\n// if (chart) {\n// chart.dispatchAction(payload, opt);\n// }\n// }\n// Buitlin global visual\n\nregisterVisual(PRIORITY_VISUAL_GLOBAL, seriesStyleTask);\nregisterVisual(PRIORITY_VISUAL_CHART_DATA_CUSTOM, dataStyleTask);\nregisterVisual(PRIORITY_VISUAL_CHART_DATA_CUSTOM, dataColorPaletteTask);\nregisterVisual(PRIORITY_VISUAL_GLOBAL, seriesSymbolTask);\nregisterVisual(PRIORITY_VISUAL_CHART_DATA_CUSTOM, dataSymbolTask);\nregisterVisual(PRIORITY_VISUAL_DECAL, decal);\nregisterPreprocessor(backwardCompat);\nregisterProcessor(PRIORITY_PROCESSOR_DATASTACK, dataStack);\nregisterLoading('default', loadingDefault); // Default actions\n\nregisterAction({\n type: HIGHLIGHT_ACTION_TYPE,\n event: HIGHLIGHT_ACTION_TYPE,\n update: HIGHLIGHT_ACTION_TYPE\n}, noop);\nregisterAction({\n type: DOWNPLAY_ACTION_TYPE,\n event: DOWNPLAY_ACTION_TYPE,\n update: DOWNPLAY_ACTION_TYPE\n}, noop);\nregisterAction({\n type: SELECT_ACTION_TYPE,\n event: SELECT_ACTION_TYPE,\n update: SELECT_ACTION_TYPE\n}, noop);\nregisterAction({\n type: UNSELECT_ACTION_TYPE,\n event: UNSELECT_ACTION_TYPE,\n update: UNSELECT_ACTION_TYPE\n}, noop);\nregisterAction({\n type: TOGGLE_SELECT_ACTION_TYPE,\n event: TOGGLE_SELECT_ACTION_TYPE,\n update: TOGGLE_SELECT_ACTION_TYPE\n}, noop); // Default theme\n\nregisterTheme('light', lightTheme);\nregisterTheme('dark', darkTheme); // For backward compatibility, where the namespace `dataTool` will\n// be mounted on `echarts` is the extension `dataTool` is imported.\n\nexport var dataTool = {};","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { registerPreprocessor, registerProcessor, registerPostInit, registerPostUpdate, registerAction, registerCoordinateSystem, registerLayout, registerVisual, registerTransform, registerLoading, registerMap, registerUpdateLifecycle, PRIORITY } from './core/echarts.js';\nimport ComponentView from './view/Component.js';\nimport ChartView from './view/Chart.js';\nimport ComponentModel from './model/Component.js';\nimport SeriesModel from './model/Series.js';\nimport { isFunction, indexOf, isArray, each } from 'zrender/lib/core/util.js';\nimport { registerImpl } from './core/impl.js';\nimport { registerPainter } from 'zrender/lib/zrender.js';\nvar extensions = [];\nvar extensionRegisters = {\n registerPreprocessor: registerPreprocessor,\n registerProcessor: registerProcessor,\n registerPostInit: registerPostInit,\n registerPostUpdate: registerPostUpdate,\n registerUpdateLifecycle: registerUpdateLifecycle,\n registerAction: registerAction,\n registerCoordinateSystem: registerCoordinateSystem,\n registerLayout: registerLayout,\n registerVisual: registerVisual,\n registerTransform: registerTransform,\n registerLoading: registerLoading,\n registerMap: registerMap,\n registerImpl: registerImpl,\n PRIORITY: PRIORITY,\n ComponentModel: ComponentModel,\n ComponentView: ComponentView,\n SeriesModel: SeriesModel,\n ChartView: ChartView,\n // TODO Use ComponentModel and SeriesModel instead of Constructor\n registerComponentModel: function (ComponentModelClass) {\n ComponentModel.registerClass(ComponentModelClass);\n },\n registerComponentView: function (ComponentViewClass) {\n ComponentView.registerClass(ComponentViewClass);\n },\n registerSeriesModel: function (SeriesModelClass) {\n SeriesModel.registerClass(SeriesModelClass);\n },\n registerChartView: function (ChartViewClass) {\n ChartView.registerClass(ChartViewClass);\n },\n registerSubTypeDefaulter: function (componentType, defaulter) {\n ComponentModel.registerSubTypeDefaulter(componentType, defaulter);\n },\n registerPainter: function (painterType, PainterCtor) {\n registerPainter(painterType, PainterCtor);\n }\n};\nexport function use(ext) {\n if (isArray(ext)) {\n // use([ChartLine, ChartBar]);\n each(ext, function (singleExt) {\n use(singleExt);\n });\n return;\n }\n\n if (indexOf(extensions, ext) >= 0) {\n return;\n }\n\n extensions.push(ext);\n\n if (isFunction(ext)) {\n ext = {\n install: ext\n };\n }\n\n ext.install(extensionRegisters);\n}","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { Point, Path, Polyline } from '../util/graphic.js';\nimport PathProxy from 'zrender/lib/core/PathProxy.js';\nimport { normalizeRadian } from 'zrender/lib/contain/util.js';\nimport { cubicProjectPoint, quadraticProjectPoint } from 'zrender/lib/core/curve.js';\nimport { defaults, retrieve2 } from 'zrender/lib/core/util.js';\nimport { invert } from 'zrender/lib/core/matrix.js';\nimport * as vector from 'zrender/lib/core/vector.js';\nimport { DISPLAY_STATES, SPECIAL_STATES } from '../util/states.js';\nvar PI2 = Math.PI * 2;\nvar CMD = PathProxy.CMD;\nvar DEFAULT_SEARCH_SPACE = ['top', 'right', 'bottom', 'left'];\n\nfunction getCandidateAnchor(pos, distance, rect, outPt, outDir) {\n var width = rect.width;\n var height = rect.height;\n\n switch (pos) {\n case 'top':\n outPt.set(rect.x + width / 2, rect.y - distance);\n outDir.set(0, -1);\n break;\n\n case 'bottom':\n outPt.set(rect.x + width / 2, rect.y + height + distance);\n outDir.set(0, 1);\n break;\n\n case 'left':\n outPt.set(rect.x - distance, rect.y + height / 2);\n outDir.set(-1, 0);\n break;\n\n case 'right':\n outPt.set(rect.x + width + distance, rect.y + height / 2);\n outDir.set(1, 0);\n break;\n }\n}\n\nfunction projectPointToArc(cx, cy, r, startAngle, endAngle, anticlockwise, x, y, out) {\n x -= cx;\n y -= cy;\n var d = Math.sqrt(x * x + y * y);\n x /= d;\n y /= d; // Intersect point.\n\n var ox = x * r + cx;\n var oy = y * r + cy;\n\n if (Math.abs(startAngle - endAngle) % PI2 < 1e-4) {\n // Is a circle\n out[0] = ox;\n out[1] = oy;\n return d - r;\n }\n\n if (anticlockwise) {\n var tmp = startAngle;\n startAngle = normalizeRadian(endAngle);\n endAngle = normalizeRadian(tmp);\n } else {\n startAngle = normalizeRadian(startAngle);\n endAngle = normalizeRadian(endAngle);\n }\n\n if (startAngle > endAngle) {\n endAngle += PI2;\n }\n\n var angle = Math.atan2(y, x);\n\n if (angle < 0) {\n angle += PI2;\n }\n\n if (angle >= startAngle && angle <= endAngle || angle + PI2 >= startAngle && angle + PI2 <= endAngle) {\n // Project point is on the arc.\n out[0] = ox;\n out[1] = oy;\n return d - r;\n }\n\n var x1 = r * Math.cos(startAngle) + cx;\n var y1 = r * Math.sin(startAngle) + cy;\n var x2 = r * Math.cos(endAngle) + cx;\n var y2 = r * Math.sin(endAngle) + cy;\n var d1 = (x1 - x) * (x1 - x) + (y1 - y) * (y1 - y);\n var d2 = (x2 - x) * (x2 - x) + (y2 - y) * (y2 - y);\n\n if (d1 < d2) {\n out[0] = x1;\n out[1] = y1;\n return Math.sqrt(d1);\n } else {\n out[0] = x2;\n out[1] = y2;\n return Math.sqrt(d2);\n }\n}\n\nfunction projectPointToLine(x1, y1, x2, y2, x, y, out, limitToEnds) {\n var dx = x - x1;\n var dy = y - y1;\n var dx1 = x2 - x1;\n var dy1 = y2 - y1;\n var lineLen = Math.sqrt(dx1 * dx1 + dy1 * dy1);\n dx1 /= lineLen;\n dy1 /= lineLen; // dot product\n\n var projectedLen = dx * dx1 + dy * dy1;\n var t = projectedLen / lineLen;\n\n if (limitToEnds) {\n t = Math.min(Math.max(t, 0), 1);\n }\n\n t *= lineLen;\n var ox = out[0] = x1 + t * dx1;\n var oy = out[1] = y1 + t * dy1;\n return Math.sqrt((ox - x) * (ox - x) + (oy - y) * (oy - y));\n}\n\nfunction projectPointToRect(x1, y1, width, height, x, y, out) {\n if (width < 0) {\n x1 = x1 + width;\n width = -width;\n }\n\n if (height < 0) {\n y1 = y1 + height;\n height = -height;\n }\n\n var x2 = x1 + width;\n var y2 = y1 + height;\n var ox = out[0] = Math.min(Math.max(x, x1), x2);\n var oy = out[1] = Math.min(Math.max(y, y1), y2);\n return Math.sqrt((ox - x) * (ox - x) + (oy - y) * (oy - y));\n}\n\nvar tmpPt = [];\n\nfunction nearestPointOnRect(pt, rect, out) {\n var dist = projectPointToRect(rect.x, rect.y, rect.width, rect.height, pt.x, pt.y, tmpPt);\n out.set(tmpPt[0], tmpPt[1]);\n return dist;\n}\n/**\n * Calculate min distance corresponding point.\n * This method won't evaluate if point is in the path.\n */\n\n\nfunction nearestPointOnPath(pt, path, out) {\n var xi = 0;\n var yi = 0;\n var x0 = 0;\n var y0 = 0;\n var x1;\n var y1;\n var minDist = Infinity;\n var data = path.data;\n var x = pt.x;\n var y = pt.y;\n\n for (var i = 0; i < data.length;) {\n var cmd = data[i++];\n\n if (i === 1) {\n xi = data[i];\n yi = data[i + 1];\n x0 = xi;\n y0 = yi;\n }\n\n var d = minDist;\n\n switch (cmd) {\n case CMD.M:\n // moveTo 命令重新创建一个新的 subpath, 并且更新新的起点\n // 在 closePath 的时候使用\n x0 = data[i++];\n y0 = data[i++];\n xi = x0;\n yi = y0;\n break;\n\n case CMD.L:\n d = projectPointToLine(xi, yi, data[i], data[i + 1], x, y, tmpPt, true);\n xi = data[i++];\n yi = data[i++];\n break;\n\n case CMD.C:\n d = cubicProjectPoint(xi, yi, data[i++], data[i++], data[i++], data[i++], data[i], data[i + 1], x, y, tmpPt);\n xi = data[i++];\n yi = data[i++];\n break;\n\n case CMD.Q:\n d = quadraticProjectPoint(xi, yi, data[i++], data[i++], data[i], data[i + 1], x, y, tmpPt);\n xi = data[i++];\n yi = data[i++];\n break;\n\n case CMD.A:\n // TODO Arc 判断的开销比较大\n var cx = data[i++];\n var cy = data[i++];\n var rx = data[i++];\n var ry = data[i++];\n var theta = data[i++];\n var dTheta = data[i++]; // TODO Arc 旋转\n\n i += 1;\n var anticlockwise = !!(1 - data[i++]);\n x1 = Math.cos(theta) * rx + cx;\n y1 = Math.sin(theta) * ry + cy; // 不是直接使用 arc 命令\n\n if (i <= 1) {\n // 第一个命令起点还未定义\n x0 = x1;\n y0 = y1;\n } // zr 使用scale来模拟椭圆, 这里也对x做一定的缩放\n\n\n var _x = (x - cx) * ry / rx + cx;\n\n d = projectPointToArc(cx, cy, ry, theta, theta + dTheta, anticlockwise, _x, y, tmpPt);\n xi = Math.cos(theta + dTheta) * rx + cx;\n yi = Math.sin(theta + dTheta) * ry + cy;\n break;\n\n case CMD.R:\n x0 = xi = data[i++];\n y0 = yi = data[i++];\n var width = data[i++];\n var height = data[i++];\n d = projectPointToRect(x0, y0, width, height, x, y, tmpPt);\n break;\n\n case CMD.Z:\n d = projectPointToLine(xi, yi, x0, y0, x, y, tmpPt, true);\n xi = x0;\n yi = y0;\n break;\n }\n\n if (d < minDist) {\n minDist = d;\n out.set(tmpPt[0], tmpPt[1]);\n }\n }\n\n return minDist;\n} // Temporal varible for intermediate usage.\n\n\nvar pt0 = new Point();\nvar pt1 = new Point();\nvar pt2 = new Point();\nvar dir = new Point();\nvar dir2 = new Point();\n/**\n * Calculate a proper guide line based on the label position and graphic element definition\n * @param label\n * @param labelRect\n * @param target\n * @param targetRect\n */\n\nexport function updateLabelLinePoints(target, labelLineModel) {\n if (!target) {\n return;\n }\n\n var labelLine = target.getTextGuideLine();\n var label = target.getTextContent(); // Needs to create text guide in each charts.\n\n if (!(label && labelLine)) {\n return;\n }\n\n var labelGuideConfig = target.textGuideLineConfig || {};\n var points = [[0, 0], [0, 0], [0, 0]];\n var searchSpace = labelGuideConfig.candidates || DEFAULT_SEARCH_SPACE;\n var labelRect = label.getBoundingRect().clone();\n labelRect.applyTransform(label.getComputedTransform());\n var minDist = Infinity;\n var anchorPoint = labelGuideConfig.anchor;\n var targetTransform = target.getComputedTransform();\n var targetInversedTransform = targetTransform && invert([], targetTransform);\n var len = labelLineModel.get('length2') || 0;\n\n if (anchorPoint) {\n pt2.copy(anchorPoint);\n }\n\n for (var i = 0; i < searchSpace.length; i++) {\n var candidate = searchSpace[i];\n getCandidateAnchor(candidate, 0, labelRect, pt0, dir);\n Point.scaleAndAdd(pt1, pt0, dir, len); // Transform to target coord space.\n\n pt1.transform(targetInversedTransform); // Note: getBoundingRect will ensure the `path` being created.\n\n var boundingRect = target.getBoundingRect();\n var dist = anchorPoint ? anchorPoint.distance(pt1) : target instanceof Path ? nearestPointOnPath(pt1, target.path, pt2) : nearestPointOnRect(pt1, boundingRect, pt2); // TODO pt2 is in the path\n\n if (dist < minDist) {\n minDist = dist; // Transform back to global space.\n\n pt1.transform(targetTransform);\n pt2.transform(targetTransform);\n pt2.toArray(points[0]);\n pt1.toArray(points[1]);\n pt0.toArray(points[2]);\n }\n }\n\n limitTurnAngle(points, labelLineModel.get('minTurnAngle'));\n labelLine.setShape({\n points: points\n });\n} // Temporal variable for the limitTurnAngle function\n\nvar tmpArr = [];\nvar tmpProjPoint = new Point();\n/**\n * Reduce the line segment attached to the label to limit the turn angle between two segments.\n * @param linePoints\n * @param minTurnAngle Radian of minimum turn angle. 0 - 180\n */\n\nexport function limitTurnAngle(linePoints, minTurnAngle) {\n if (!(minTurnAngle <= 180 && minTurnAngle > 0)) {\n return;\n }\n\n minTurnAngle = minTurnAngle / 180 * Math.PI; // The line points can be\n // /pt1----pt2 (label)\n // /\n // pt0/\n\n pt0.fromArray(linePoints[0]);\n pt1.fromArray(linePoints[1]);\n pt2.fromArray(linePoints[2]);\n Point.sub(dir, pt0, pt1);\n Point.sub(dir2, pt2, pt1);\n var len1 = dir.len();\n var len2 = dir2.len();\n\n if (len1 < 1e-3 || len2 < 1e-3) {\n return;\n }\n\n dir.scale(1 / len1);\n dir2.scale(1 / len2);\n var angleCos = dir.dot(dir2);\n var minTurnAngleCos = Math.cos(minTurnAngle);\n\n if (minTurnAngleCos < angleCos) {\n // Smaller than minTurnAngle\n // Calculate project point of pt0 on pt1-pt2\n var d = projectPointToLine(pt1.x, pt1.y, pt2.x, pt2.y, pt0.x, pt0.y, tmpArr, false);\n tmpProjPoint.fromArray(tmpArr); // Calculate new projected length with limited minTurnAngle and get the new connect point\n\n tmpProjPoint.scaleAndAdd(dir2, d / Math.tan(Math.PI - minTurnAngle)); // Limit the new calculated connect point between pt1 and pt2.\n\n var t = pt2.x !== pt1.x ? (tmpProjPoint.x - pt1.x) / (pt2.x - pt1.x) : (tmpProjPoint.y - pt1.y) / (pt2.y - pt1.y);\n\n if (isNaN(t)) {\n return;\n }\n\n if (t < 0) {\n Point.copy(tmpProjPoint, pt1);\n } else if (t > 1) {\n Point.copy(tmpProjPoint, pt2);\n }\n\n tmpProjPoint.toArray(linePoints[1]);\n }\n}\n/**\n * Limit the angle of line and the surface\n * @param maxSurfaceAngle Radian of minimum turn angle. 0 - 180. 0 is same direction to normal. 180 is opposite\n */\n\nexport function limitSurfaceAngle(linePoints, surfaceNormal, maxSurfaceAngle) {\n if (!(maxSurfaceAngle <= 180 && maxSurfaceAngle > 0)) {\n return;\n }\n\n maxSurfaceAngle = maxSurfaceAngle / 180 * Math.PI;\n pt0.fromArray(linePoints[0]);\n pt1.fromArray(linePoints[1]);\n pt2.fromArray(linePoints[2]);\n Point.sub(dir, pt1, pt0);\n Point.sub(dir2, pt2, pt1);\n var len1 = dir.len();\n var len2 = dir2.len();\n\n if (len1 < 1e-3 || len2 < 1e-3) {\n return;\n }\n\n dir.scale(1 / len1);\n dir2.scale(1 / len2);\n var angleCos = dir.dot(surfaceNormal);\n var maxSurfaceAngleCos = Math.cos(maxSurfaceAngle);\n\n if (angleCos < maxSurfaceAngleCos) {\n // Calculate project point of pt0 on pt1-pt2\n var d = projectPointToLine(pt1.x, pt1.y, pt2.x, pt2.y, pt0.x, pt0.y, tmpArr, false);\n tmpProjPoint.fromArray(tmpArr);\n var HALF_PI = Math.PI / 2;\n var angle2 = Math.acos(dir2.dot(surfaceNormal));\n var newAngle = HALF_PI + angle2 - maxSurfaceAngle;\n\n if (newAngle >= HALF_PI) {\n // parallel\n Point.copy(tmpProjPoint, pt2);\n } else {\n // Calculate new projected length with limited minTurnAngle and get the new connect point\n tmpProjPoint.scaleAndAdd(dir2, d / Math.tan(Math.PI / 2 - newAngle)); // Limit the new calculated connect point between pt1 and pt2.\n\n var t = pt2.x !== pt1.x ? (tmpProjPoint.x - pt1.x) / (pt2.x - pt1.x) : (tmpProjPoint.y - pt1.y) / (pt2.y - pt1.y);\n\n if (isNaN(t)) {\n return;\n }\n\n if (t < 0) {\n Point.copy(tmpProjPoint, pt1);\n } else if (t > 1) {\n Point.copy(tmpProjPoint, pt2);\n }\n }\n\n tmpProjPoint.toArray(linePoints[1]);\n }\n}\n\nfunction setLabelLineState(labelLine, ignore, stateName, stateModel) {\n var isNormal = stateName === 'normal';\n var stateObj = isNormal ? labelLine : labelLine.ensureState(stateName); // Make sure display.\n\n stateObj.ignore = ignore; // Set smooth\n\n var smooth = stateModel.get('smooth');\n\n if (smooth && smooth === true) {\n smooth = 0.3;\n }\n\n stateObj.shape = stateObj.shape || {};\n\n if (smooth > 0) {\n stateObj.shape.smooth = smooth;\n }\n\n var styleObj = stateModel.getModel('lineStyle').getLineStyle();\n isNormal ? labelLine.useStyle(styleObj) : stateObj.style = styleObj;\n}\n\nfunction buildLabelLinePath(path, shape) {\n var smooth = shape.smooth;\n var points = shape.points;\n\n if (!points) {\n return;\n }\n\n path.moveTo(points[0][0], points[0][1]);\n\n if (smooth > 0 && points.length >= 3) {\n var len1 = vector.dist(points[0], points[1]);\n var len2 = vector.dist(points[1], points[2]);\n\n if (!len1 || !len2) {\n path.lineTo(points[1][0], points[1][1]);\n path.lineTo(points[2][0], points[2][1]);\n return;\n }\n\n var moveLen = Math.min(len1, len2) * smooth;\n var midPoint0 = vector.lerp([], points[1], points[0], moveLen / len1);\n var midPoint2 = vector.lerp([], points[1], points[2], moveLen / len2);\n var midPoint1 = vector.lerp([], midPoint0, midPoint2, 0.5);\n path.bezierCurveTo(midPoint0[0], midPoint0[1], midPoint0[0], midPoint0[1], midPoint1[0], midPoint1[1]);\n path.bezierCurveTo(midPoint2[0], midPoint2[1], midPoint2[0], midPoint2[1], points[2][0], points[2][1]);\n } else {\n for (var i = 1; i < points.length; i++) {\n path.lineTo(points[i][0], points[i][1]);\n }\n }\n}\n/**\n * Create a label line if necessary and set it's style.\n */\n\n\nexport function setLabelLineStyle(targetEl, statesModels, defaultStyle) {\n var labelLine = targetEl.getTextGuideLine();\n var label = targetEl.getTextContent();\n\n if (!label) {\n // Not show label line if there is no label.\n if (labelLine) {\n targetEl.removeTextGuideLine();\n }\n\n return;\n }\n\n var normalModel = statesModels.normal;\n var showNormal = normalModel.get('show');\n var labelIgnoreNormal = label.ignore;\n\n for (var i = 0; i < DISPLAY_STATES.length; i++) {\n var stateName = DISPLAY_STATES[i];\n var stateModel = statesModels[stateName];\n var isNormal = stateName === 'normal';\n\n if (stateModel) {\n var stateShow = stateModel.get('show');\n var isLabelIgnored = isNormal ? labelIgnoreNormal : retrieve2(label.states[stateName] && label.states[stateName].ignore, labelIgnoreNormal);\n\n if (isLabelIgnored // Not show when label is not shown in this state.\n || !retrieve2(stateShow, showNormal) // Use normal state by default if not set.\n ) {\n var stateObj = isNormal ? labelLine : labelLine && labelLine.states.normal;\n\n if (stateObj) {\n stateObj.ignore = true;\n }\n\n continue;\n } // Create labelLine if not exists\n\n\n if (!labelLine) {\n labelLine = new Polyline();\n targetEl.setTextGuideLine(labelLine); // Reset state of normal because it's new created.\n // NOTE: NORMAL should always been the first!\n\n if (!isNormal && (labelIgnoreNormal || !showNormal)) {\n setLabelLineState(labelLine, true, 'normal', statesModels.normal);\n } // Use same state proxy.\n\n\n if (targetEl.stateProxy) {\n labelLine.stateProxy = targetEl.stateProxy;\n }\n }\n\n setLabelLineState(labelLine, false, stateName, stateModel);\n }\n }\n\n if (labelLine) {\n defaults(labelLine.style, defaultStyle); // Not fill.\n\n labelLine.style.fill = null;\n var showAbove = normalModel.get('showAbove');\n var labelLineConfig = targetEl.textGuideLineConfig = targetEl.textGuideLineConfig || {};\n labelLineConfig.showAbove = showAbove || false; // Custom the buildPath.\n\n labelLine.buildPath = buildLabelLinePath;\n }\n}\nexport function getLabelLineStatesModels(itemModel, labelLineName) {\n labelLineName = labelLineName || 'labelLine';\n var statesModels = {\n normal: itemModel.getModel(labelLineName)\n };\n\n for (var i = 0; i < SPECIAL_STATES.length; i++) {\n var stateName = SPECIAL_STATES[i];\n statesModels[stateName] = itemModel.getModel([stateName, labelLineName]);\n }\n\n return statesModels;\n}","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { BoundingRect, OrientedBoundingRect } from '../util/graphic.js';\nexport function prepareLayoutList(input) {\n var list = [];\n\n for (var i = 0; i < input.length; i++) {\n var rawItem = input[i];\n\n if (rawItem.defaultAttr.ignore) {\n continue;\n }\n\n var label = rawItem.label;\n var transform = label.getComputedTransform(); // NOTE: Get bounding rect after getComputedTransform, or label may not been updated by the host el.\n\n var localRect = label.getBoundingRect();\n var isAxisAligned = !transform || transform[1] < 1e-5 && transform[2] < 1e-5;\n var minMargin = label.style.margin || 0;\n var globalRect = localRect.clone();\n globalRect.applyTransform(transform);\n globalRect.x -= minMargin / 2;\n globalRect.y -= minMargin / 2;\n globalRect.width += minMargin;\n globalRect.height += minMargin;\n var obb = isAxisAligned ? new OrientedBoundingRect(localRect, transform) : null;\n list.push({\n label: label,\n labelLine: rawItem.labelLine,\n rect: globalRect,\n localRect: localRect,\n obb: obb,\n priority: rawItem.priority,\n defaultAttr: rawItem.defaultAttr,\n layoutOption: rawItem.computedLayoutOption,\n axisAligned: isAxisAligned,\n transform: transform\n });\n }\n\n return list;\n}\n\nfunction shiftLayout(list, xyDim, sizeDim, minBound, maxBound, balanceShift) {\n var len = list.length;\n\n if (len < 2) {\n return;\n }\n\n list.sort(function (a, b) {\n return a.rect[xyDim] - b.rect[xyDim];\n });\n var lastPos = 0;\n var delta;\n var adjusted = false;\n var shifts = [];\n var totalShifts = 0;\n\n for (var i = 0; i < len; i++) {\n var item = list[i];\n var rect = item.rect;\n delta = rect[xyDim] - lastPos;\n\n if (delta < 0) {\n // shiftForward(i, len, -delta);\n rect[xyDim] -= delta;\n item.label[xyDim] -= delta;\n adjusted = true;\n }\n\n var shift = Math.max(-delta, 0);\n shifts.push(shift);\n totalShifts += shift;\n lastPos = rect[xyDim] + rect[sizeDim];\n }\n\n if (totalShifts > 0 && balanceShift) {\n // Shift back to make the distribution more equally.\n shiftList(-totalShifts / len, 0, len);\n } // TODO bleedMargin?\n\n\n var first = list[0];\n var last = list[len - 1];\n var minGap;\n var maxGap;\n updateMinMaxGap(); // If ends exceed two bounds, squeeze at most 80%, then take the gap of two bounds.\n\n minGap < 0 && squeezeGaps(-minGap, 0.8);\n maxGap < 0 && squeezeGaps(maxGap, 0.8);\n updateMinMaxGap();\n takeBoundsGap(minGap, maxGap, 1);\n takeBoundsGap(maxGap, minGap, -1); // Handle bailout when there is not enough space.\n\n updateMinMaxGap();\n\n if (minGap < 0) {\n squeezeWhenBailout(-minGap);\n }\n\n if (maxGap < 0) {\n squeezeWhenBailout(maxGap);\n }\n\n function updateMinMaxGap() {\n minGap = first.rect[xyDim] - minBound;\n maxGap = maxBound - last.rect[xyDim] - last.rect[sizeDim];\n }\n\n function takeBoundsGap(gapThisBound, gapOtherBound, moveDir) {\n if (gapThisBound < 0) {\n // Move from other gap if can.\n var moveFromMaxGap = Math.min(gapOtherBound, -gapThisBound);\n\n if (moveFromMaxGap > 0) {\n shiftList(moveFromMaxGap * moveDir, 0, len);\n var remained = moveFromMaxGap + gapThisBound;\n\n if (remained < 0) {\n squeezeGaps(-remained * moveDir, 1);\n }\n } else {\n squeezeGaps(-gapThisBound * moveDir, 1);\n }\n }\n }\n\n function shiftList(delta, start, end) {\n if (delta !== 0) {\n adjusted = true;\n }\n\n for (var i = start; i < end; i++) {\n var item = list[i];\n var rect = item.rect;\n rect[xyDim] += delta;\n item.label[xyDim] += delta;\n }\n } // Squeeze gaps if the labels exceed margin.\n\n\n function squeezeGaps(delta, maxSqeezePercent) {\n var gaps = [];\n var totalGaps = 0;\n\n for (var i = 1; i < len; i++) {\n var prevItemRect = list[i - 1].rect;\n var gap = Math.max(list[i].rect[xyDim] - prevItemRect[xyDim] - prevItemRect[sizeDim], 0);\n gaps.push(gap);\n totalGaps += gap;\n }\n\n if (!totalGaps) {\n return;\n }\n\n var squeezePercent = Math.min(Math.abs(delta) / totalGaps, maxSqeezePercent);\n\n if (delta > 0) {\n for (var i = 0; i < len - 1; i++) {\n // Distribute the shift delta to all gaps.\n var movement = gaps[i] * squeezePercent; // Forward\n\n shiftList(movement, 0, i + 1);\n }\n } else {\n // Backward\n for (var i = len - 1; i > 0; i--) {\n // Distribute the shift delta to all gaps.\n var movement = gaps[i - 1] * squeezePercent;\n shiftList(-movement, i, len);\n }\n }\n }\n /**\n * Squeeze to allow overlap if there is no more space available.\n * Let other overlapping strategy like hideOverlap do the job instead of keep exceeding the bounds.\n */\n\n\n function squeezeWhenBailout(delta) {\n var dir = delta < 0 ? -1 : 1;\n delta = Math.abs(delta);\n var moveForEachLabel = Math.ceil(delta / (len - 1));\n\n for (var i = 0; i < len - 1; i++) {\n if (dir > 0) {\n // Forward\n shiftList(moveForEachLabel, 0, i + 1);\n } else {\n // Backward\n shiftList(-moveForEachLabel, len - i - 1, len);\n }\n\n delta -= moveForEachLabel;\n\n if (delta <= 0) {\n return;\n }\n }\n }\n\n return adjusted;\n}\n/**\n * Adjust labels on x direction to avoid overlap.\n */\n\n\nexport function shiftLayoutOnX(list, leftBound, rightBound, // If average the shifts on all labels and add them to 0\n// TODO: Not sure if should enable it.\n// Pros: The angle of lines will distribute more equally\n// Cons: In some layout. It may not what user wanted. like in pie. the label of last sector is usually changed unexpectedly.\nbalanceShift) {\n return shiftLayout(list, 'x', 'width', leftBound, rightBound, balanceShift);\n}\n/**\n * Adjust labels on y direction to avoid overlap.\n */\n\nexport function shiftLayoutOnY(list, topBound, bottomBound, // If average the shifts on all labels and add them to 0\nbalanceShift) {\n return shiftLayout(list, 'y', 'height', topBound, bottomBound, balanceShift);\n}\nexport function hideOverlap(labelList) {\n var displayedLabels = []; // TODO, render overflow visible first, put in the displayedLabels.\n\n labelList.sort(function (a, b) {\n return b.priority - a.priority;\n });\n var globalRect = new BoundingRect(0, 0, 0, 0);\n\n function hideEl(el) {\n if (!el.ignore) {\n // Show on emphasis.\n var emphasisState = el.ensureState('emphasis');\n\n if (emphasisState.ignore == null) {\n emphasisState.ignore = false;\n }\n }\n\n el.ignore = true;\n }\n\n for (var i = 0; i < labelList.length; i++) {\n var labelItem = labelList[i];\n var isAxisAligned = labelItem.axisAligned;\n var localRect = labelItem.localRect;\n var transform = labelItem.transform;\n var label = labelItem.label;\n var labelLine = labelItem.labelLine;\n globalRect.copy(labelItem.rect); // Add a threshold because layout may be aligned precisely.\n\n globalRect.width -= 0.1;\n globalRect.height -= 0.1;\n globalRect.x += 0.05;\n globalRect.y += 0.05;\n var obb = labelItem.obb;\n var overlapped = false;\n\n for (var j = 0; j < displayedLabels.length; j++) {\n var existsTextCfg = displayedLabels[j]; // Fast rejection.\n\n if (!globalRect.intersect(existsTextCfg.rect)) {\n continue;\n }\n\n if (isAxisAligned && existsTextCfg.axisAligned) {\n // Is overlapped\n overlapped = true;\n break;\n }\n\n if (!existsTextCfg.obb) {\n // If self is not axis aligned. But other is.\n existsTextCfg.obb = new OrientedBoundingRect(existsTextCfg.localRect, existsTextCfg.transform);\n }\n\n if (!obb) {\n // If self is axis aligned. But other is not.\n obb = new OrientedBoundingRect(localRect, transform);\n }\n\n if (obb.intersect(existsTextCfg.obb)) {\n overlapped = true;\n break;\n }\n } // TODO Callback to determine if this overlap should be handled?\n\n\n if (overlapped) {\n hideEl(label);\n labelLine && hideEl(labelLine);\n } else {\n label.attr('ignore', labelItem.defaultAttr.ignore);\n labelLine && labelLine.attr('ignore', labelItem.defaultAttr.labelGuideIgnore);\n displayedLabels.push(labelItem);\n }\n }\n}","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n// TODO: move labels out of viewport.\nimport { BoundingRect, updateProps, initProps, isElementRemoved } from '../util/graphic.js';\nimport { getECData } from '../util/innerStore.js';\nimport { parsePercent } from '../util/number.js';\nimport Transformable from 'zrender/lib/core/Transformable.js';\nimport { updateLabelLinePoints, setLabelLineStyle, getLabelLineStatesModels } from './labelGuideHelper.js';\nimport { makeInner } from '../util/model.js';\nimport { retrieve2, each, keys, isFunction, filter, indexOf } from 'zrender/lib/core/util.js';\nimport { prepareLayoutList, hideOverlap, shiftLayoutOnX, shiftLayoutOnY } from './labelLayoutHelper.js';\nimport { labelInner, animateLabelValue } from './labelStyle.js';\n\nfunction cloneArr(points) {\n if (points) {\n var newPoints = [];\n\n for (var i = 0; i < points.length; i++) {\n newPoints.push(points[i].slice());\n }\n\n return newPoints;\n }\n}\n\nfunction prepareLayoutCallbackParams(labelItem, hostEl) {\n var label = labelItem.label;\n var labelLine = hostEl && hostEl.getTextGuideLine();\n return {\n dataIndex: labelItem.dataIndex,\n dataType: labelItem.dataType,\n seriesIndex: labelItem.seriesModel.seriesIndex,\n text: labelItem.label.style.text,\n rect: labelItem.hostRect,\n labelRect: labelItem.rect,\n // x: labelAttr.x,\n // y: labelAttr.y,\n align: label.style.align,\n verticalAlign: label.style.verticalAlign,\n labelLinePoints: cloneArr(labelLine && labelLine.shape.points)\n };\n}\n\nvar LABEL_OPTION_TO_STYLE_KEYS = ['align', 'verticalAlign', 'width', 'height', 'fontSize'];\nvar dummyTransformable = new Transformable();\nvar labelLayoutInnerStore = makeInner();\nvar labelLineAnimationStore = makeInner();\n\nfunction extendWithKeys(target, source, keys) {\n for (var i = 0; i < keys.length; i++) {\n var key = keys[i];\n\n if (source[key] != null) {\n target[key] = source[key];\n }\n }\n}\n\nvar LABEL_LAYOUT_PROPS = ['x', 'y', 'rotation'];\n\nvar LabelManager =\n/** @class */\nfunction () {\n function LabelManager() {\n this._labelList = [];\n this._chartViewList = [];\n }\n\n LabelManager.prototype.clearLabels = function () {\n this._labelList = [];\n this._chartViewList = [];\n };\n /**\n * Add label to manager\n */\n\n\n LabelManager.prototype._addLabel = function (dataIndex, dataType, seriesModel, label, layoutOption) {\n var labelStyle = label.style;\n var hostEl = label.__hostTarget;\n var textConfig = hostEl.textConfig || {}; // TODO: If label is in other state.\n\n var labelTransform = label.getComputedTransform();\n var labelRect = label.getBoundingRect().plain();\n BoundingRect.applyTransform(labelRect, labelRect, labelTransform);\n\n if (labelTransform) {\n dummyTransformable.setLocalTransform(labelTransform);\n } else {\n // Identity transform.\n dummyTransformable.x = dummyTransformable.y = dummyTransformable.rotation = dummyTransformable.originX = dummyTransformable.originY = 0;\n dummyTransformable.scaleX = dummyTransformable.scaleY = 1;\n }\n\n var host = label.__hostTarget;\n var hostRect;\n\n if (host) {\n hostRect = host.getBoundingRect().plain();\n var transform = host.getComputedTransform();\n BoundingRect.applyTransform(hostRect, hostRect, transform);\n }\n\n var labelGuide = hostRect && host.getTextGuideLine();\n\n this._labelList.push({\n label: label,\n labelLine: labelGuide,\n seriesModel: seriesModel,\n dataIndex: dataIndex,\n dataType: dataType,\n layoutOption: layoutOption,\n computedLayoutOption: null,\n rect: labelRect,\n hostRect: hostRect,\n // Label with lower priority will be hidden when overlapped\n // Use rect size as default priority\n priority: hostRect ? hostRect.width * hostRect.height : 0,\n // Save default label attributes.\n // For restore if developers want get back to default value in callback.\n defaultAttr: {\n ignore: label.ignore,\n labelGuideIgnore: labelGuide && labelGuide.ignore,\n x: dummyTransformable.x,\n y: dummyTransformable.y,\n scaleX: dummyTransformable.scaleX,\n scaleY: dummyTransformable.scaleY,\n rotation: dummyTransformable.rotation,\n style: {\n x: labelStyle.x,\n y: labelStyle.y,\n align: labelStyle.align,\n verticalAlign: labelStyle.verticalAlign,\n width: labelStyle.width,\n height: labelStyle.height,\n fontSize: labelStyle.fontSize\n },\n cursor: label.cursor,\n attachedPos: textConfig.position,\n attachedRot: textConfig.rotation\n }\n });\n };\n\n LabelManager.prototype.addLabelsOfSeries = function (chartView) {\n var _this = this;\n\n this._chartViewList.push(chartView);\n\n var seriesModel = chartView.__model;\n var layoutOption = seriesModel.get('labelLayout');\n /**\n * Ignore layouting if it's not specified anything.\n */\n\n if (!(isFunction(layoutOption) || keys(layoutOption).length)) {\n return;\n }\n\n chartView.group.traverse(function (child) {\n if (child.ignore) {\n return true; // Stop traverse descendants.\n } // Only support label being hosted on graphic elements.\n\n\n var textEl = child.getTextContent();\n var ecData = getECData(child); // Can only attach the text on the element with dataIndex\n\n if (textEl && !textEl.disableLabelLayout) {\n _this._addLabel(ecData.dataIndex, ecData.dataType, seriesModel, textEl, layoutOption);\n }\n });\n };\n\n LabelManager.prototype.updateLayoutConfig = function (api) {\n var width = api.getWidth();\n var height = api.getHeight();\n\n function createDragHandler(el, labelLineModel) {\n return function () {\n updateLabelLinePoints(el, labelLineModel);\n };\n }\n\n for (var i = 0; i < this._labelList.length; i++) {\n var labelItem = this._labelList[i];\n var label = labelItem.label;\n var hostEl = label.__hostTarget;\n var defaultLabelAttr = labelItem.defaultAttr;\n var layoutOption = void 0; // TODO A global layout option?\n\n if (isFunction(labelItem.layoutOption)) {\n layoutOption = labelItem.layoutOption(prepareLayoutCallbackParams(labelItem, hostEl));\n } else {\n layoutOption = labelItem.layoutOption;\n }\n\n layoutOption = layoutOption || {};\n labelItem.computedLayoutOption = layoutOption;\n var degreeToRadian = Math.PI / 180; // TODO hostEl should always exists.\n // Or label should not have parent because the x, y is all in global space.\n\n if (hostEl) {\n hostEl.setTextConfig({\n // Force to set local false.\n local: false,\n // Ignore position and rotation config on the host el if x or y is changed.\n position: layoutOption.x != null || layoutOption.y != null ? null : defaultLabelAttr.attachedPos,\n // Ignore rotation config on the host el if rotation is changed.\n rotation: layoutOption.rotate != null ? layoutOption.rotate * degreeToRadian : defaultLabelAttr.attachedRot,\n offset: [layoutOption.dx || 0, layoutOption.dy || 0]\n });\n }\n\n var needsUpdateLabelLine = false;\n\n if (layoutOption.x != null) {\n // TODO width of chart view.\n label.x = parsePercent(layoutOption.x, width);\n label.setStyle('x', 0); // Ignore movement in style. TODO: origin.\n\n needsUpdateLabelLine = true;\n } else {\n label.x = defaultLabelAttr.x;\n label.setStyle('x', defaultLabelAttr.style.x);\n }\n\n if (layoutOption.y != null) {\n // TODO height of chart view.\n label.y = parsePercent(layoutOption.y, height);\n label.setStyle('y', 0); // Ignore movement in style.\n\n needsUpdateLabelLine = true;\n } else {\n label.y = defaultLabelAttr.y;\n label.setStyle('y', defaultLabelAttr.style.y);\n }\n\n if (layoutOption.labelLinePoints) {\n var guideLine = hostEl.getTextGuideLine();\n\n if (guideLine) {\n guideLine.setShape({\n points: layoutOption.labelLinePoints\n }); // Not update\n\n needsUpdateLabelLine = false;\n }\n }\n\n var labelLayoutStore = labelLayoutInnerStore(label);\n labelLayoutStore.needsUpdateLabelLine = needsUpdateLabelLine;\n label.rotation = layoutOption.rotate != null ? layoutOption.rotate * degreeToRadian : defaultLabelAttr.rotation;\n label.scaleX = defaultLabelAttr.scaleX;\n label.scaleY = defaultLabelAttr.scaleY;\n\n for (var k = 0; k < LABEL_OPTION_TO_STYLE_KEYS.length; k++) {\n var key = LABEL_OPTION_TO_STYLE_KEYS[k];\n label.setStyle(key, layoutOption[key] != null ? layoutOption[key] : defaultLabelAttr.style[key]);\n }\n\n if (layoutOption.draggable) {\n label.draggable = true;\n label.cursor = 'move';\n\n if (hostEl) {\n var hostModel = labelItem.seriesModel;\n\n if (labelItem.dataIndex != null) {\n var data = labelItem.seriesModel.getData(labelItem.dataType);\n hostModel = data.getItemModel(labelItem.dataIndex);\n }\n\n label.on('drag', createDragHandler(hostEl, hostModel.getModel('labelLine')));\n }\n } else {\n // TODO Other drag functions?\n label.off('drag');\n label.cursor = defaultLabelAttr.cursor;\n }\n }\n };\n\n LabelManager.prototype.layout = function (api) {\n var width = api.getWidth();\n var height = api.getHeight();\n var labelList = prepareLayoutList(this._labelList);\n var labelsNeedsAdjustOnX = filter(labelList, function (item) {\n return item.layoutOption.moveOverlap === 'shiftX';\n });\n var labelsNeedsAdjustOnY = filter(labelList, function (item) {\n return item.layoutOption.moveOverlap === 'shiftY';\n });\n shiftLayoutOnX(labelsNeedsAdjustOnX, 0, width);\n shiftLayoutOnY(labelsNeedsAdjustOnY, 0, height);\n var labelsNeedsHideOverlap = filter(labelList, function (item) {\n return item.layoutOption.hideOverlap;\n });\n hideOverlap(labelsNeedsHideOverlap);\n };\n /**\n * Process all labels. Not only labels with layoutOption.\n */\n\n\n LabelManager.prototype.processLabelsOverall = function () {\n var _this = this;\n\n each(this._chartViewList, function (chartView) {\n var seriesModel = chartView.__model;\n var ignoreLabelLineUpdate = chartView.ignoreLabelLineUpdate;\n var animationEnabled = seriesModel.isAnimationEnabled();\n chartView.group.traverse(function (child) {\n if (child.ignore && !child.forceLabelAnimation) {\n return true; // Stop traverse descendants.\n }\n\n var needsUpdateLabelLine = !ignoreLabelLineUpdate;\n var label = child.getTextContent();\n\n if (!needsUpdateLabelLine && label) {\n needsUpdateLabelLine = labelLayoutInnerStore(label).needsUpdateLabelLine;\n }\n\n if (needsUpdateLabelLine) {\n _this._updateLabelLine(child, seriesModel);\n }\n\n if (animationEnabled) {\n _this._animateLabels(child, seriesModel);\n }\n });\n });\n };\n\n LabelManager.prototype._updateLabelLine = function (el, seriesModel) {\n // Only support label being hosted on graphic elements.\n var textEl = el.getTextContent(); // Update label line style.\n\n var ecData = getECData(el);\n var dataIndex = ecData.dataIndex; // Only support labelLine on the labels represent data.\n\n if (textEl && dataIndex != null) {\n var data = seriesModel.getData(ecData.dataType);\n var itemModel = data.getItemModel(dataIndex);\n var defaultStyle = {};\n var visualStyle = data.getItemVisual(dataIndex, 'style');\n var visualType = data.getVisual('drawType'); // Default to be same with main color\n\n defaultStyle.stroke = visualStyle[visualType];\n var labelLineModel = itemModel.getModel('labelLine');\n setLabelLineStyle(el, getLabelLineStatesModels(itemModel), defaultStyle);\n updateLabelLinePoints(el, labelLineModel);\n }\n };\n\n LabelManager.prototype._animateLabels = function (el, seriesModel) {\n var textEl = el.getTextContent();\n var guideLine = el.getTextGuideLine(); // Animate\n\n if (textEl // `forceLabelAnimation` has the highest priority\n && (el.forceLabelAnimation || !textEl.ignore && !textEl.invisible && !el.disableLabelAnimation && !isElementRemoved(el))) {\n var layoutStore = labelLayoutInnerStore(textEl);\n var oldLayout = layoutStore.oldLayout;\n var ecData = getECData(el);\n var dataIndex = ecData.dataIndex;\n var newProps = {\n x: textEl.x,\n y: textEl.y,\n rotation: textEl.rotation\n };\n var data = seriesModel.getData(ecData.dataType);\n\n if (!oldLayout) {\n textEl.attr(newProps); // Disable fade in animation if value animation is enabled.\n\n if (!labelInner(textEl).valueAnimation) {\n var oldOpacity = retrieve2(textEl.style.opacity, 1); // Fade in animation\n\n textEl.style.opacity = 0;\n initProps(textEl, {\n style: {\n opacity: oldOpacity\n }\n }, seriesModel, dataIndex);\n }\n } else {\n textEl.attr(oldLayout); // Make sure the animation from is in the right status.\n\n var prevStates = el.prevStates;\n\n if (prevStates) {\n if (indexOf(prevStates, 'select') >= 0) {\n textEl.attr(layoutStore.oldLayoutSelect);\n }\n\n if (indexOf(prevStates, 'emphasis') >= 0) {\n textEl.attr(layoutStore.oldLayoutEmphasis);\n }\n }\n\n updateProps(textEl, newProps, seriesModel, dataIndex);\n }\n\n layoutStore.oldLayout = newProps;\n\n if (textEl.states.select) {\n var layoutSelect = layoutStore.oldLayoutSelect = {};\n extendWithKeys(layoutSelect, newProps, LABEL_LAYOUT_PROPS);\n extendWithKeys(layoutSelect, textEl.states.select, LABEL_LAYOUT_PROPS);\n }\n\n if (textEl.states.emphasis) {\n var layoutEmphasis = layoutStore.oldLayoutEmphasis = {};\n extendWithKeys(layoutEmphasis, newProps, LABEL_LAYOUT_PROPS);\n extendWithKeys(layoutEmphasis, textEl.states.emphasis, LABEL_LAYOUT_PROPS);\n }\n\n animateLabelValue(textEl, dataIndex, data, seriesModel, seriesModel);\n }\n\n if (guideLine && !guideLine.ignore && !guideLine.invisible) {\n var layoutStore = labelLineAnimationStore(guideLine);\n var oldLayout = layoutStore.oldLayout;\n var newLayout = {\n points: guideLine.shape.points\n };\n\n if (!oldLayout) {\n guideLine.setShape(newLayout);\n guideLine.style.strokePercent = 0;\n initProps(guideLine, {\n style: {\n strokePercent: 1\n }\n }, seriesModel);\n } else {\n guideLine.attr({\n shape: oldLayout\n });\n updateProps(guideLine, {\n shape: newLayout\n }, seriesModel);\n }\n\n layoutStore.oldLayout = newLayout;\n }\n };\n\n return LabelManager;\n}();\n\nexport default LabelManager;","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { makeInner } from '../util/model.js';\nimport LabelManager from './LabelManager.js';\nvar getLabelManager = makeInner();\nexport function installLabelLayout(registers) {\n registers.registerUpdateLifecycle('series:beforeupdate', function (ecModel, api, params) {\n // TODO api provide an namespace that can save stuff per instance\n var labelManager = getLabelManager(api).labelManager;\n\n if (!labelManager) {\n labelManager = getLabelManager(api).labelManager = new LabelManager();\n }\n\n labelManager.clearLabels();\n });\n registers.registerUpdateLifecycle('series:layoutlabels', function (ecModel, api, params) {\n var labelManager = getLabelManager(api).labelManager;\n params.updatedSeries.forEach(function (series) {\n labelManager.addLabelsOfSeries(api.getViewOfSeriesModel(series));\n });\n labelManager.updateLayoutConfig(api);\n labelManager.layout(api);\n labelManager.processLabelsOverall();\n });\n}","import { __extends } from \"tslib\";\nimport * as util from '../core/util.js';\nimport { devicePixelRatio } from '../config.js';\nimport Eventful from '../core/Eventful.js';\nimport { getCanvasGradient } from './helper.js';\nimport { createCanvasPattern } from './graphic.js';\nimport BoundingRect from '../core/BoundingRect.js';\nimport { REDRAW_BIT } from '../graphic/constants.js';\nimport { platformApi } from '../core/platform.js';\nfunction createDom(id, painter, dpr) {\n var newDom = platformApi.createCanvas();\n var width = painter.getWidth();\n var height = painter.getHeight();\n var newDomStyle = newDom.style;\n if (newDomStyle) {\n newDomStyle.position = 'absolute';\n newDomStyle.left = '0';\n newDomStyle.top = '0';\n newDomStyle.width = width + 'px';\n newDomStyle.height = height + 'px';\n newDom.setAttribute('data-zr-dom-id', id);\n }\n newDom.width = width * dpr;\n newDom.height = height * dpr;\n return newDom;\n}\n;\nvar Layer = (function (_super) {\n __extends(Layer, _super);\n function Layer(id, painter, dpr) {\n var _this = _super.call(this) || this;\n _this.motionBlur = false;\n _this.lastFrameAlpha = 0.7;\n _this.dpr = 1;\n _this.virtual = false;\n _this.config = {};\n _this.incremental = false;\n _this.zlevel = 0;\n _this.maxRepaintRectCount = 5;\n _this.__dirty = true;\n _this.__firstTimePaint = true;\n _this.__used = false;\n _this.__drawIndex = 0;\n _this.__startIndex = 0;\n _this.__endIndex = 0;\n _this.__prevStartIndex = null;\n _this.__prevEndIndex = null;\n var dom;\n dpr = dpr || devicePixelRatio;\n if (typeof id === 'string') {\n dom = createDom(id, painter, dpr);\n }\n else if (util.isObject(id)) {\n dom = id;\n id = dom.id;\n }\n _this.id = id;\n _this.dom = dom;\n var domStyle = dom.style;\n if (domStyle) {\n util.disableUserSelect(dom);\n dom.onselectstart = function () { return false; };\n domStyle.padding = '0';\n domStyle.margin = '0';\n domStyle.borderWidth = '0';\n }\n _this.painter = painter;\n _this.dpr = dpr;\n return _this;\n }\n Layer.prototype.getElementCount = function () {\n return this.__endIndex - this.__startIndex;\n };\n Layer.prototype.afterBrush = function () {\n this.__prevStartIndex = this.__startIndex;\n this.__prevEndIndex = this.__endIndex;\n };\n Layer.prototype.initContext = function () {\n this.ctx = this.dom.getContext('2d');\n this.ctx.dpr = this.dpr;\n };\n Layer.prototype.setUnpainted = function () {\n this.__firstTimePaint = true;\n };\n Layer.prototype.createBackBuffer = function () {\n var dpr = this.dpr;\n this.domBack = createDom('back-' + this.id, this.painter, dpr);\n this.ctxBack = this.domBack.getContext('2d');\n if (dpr !== 1) {\n this.ctxBack.scale(dpr, dpr);\n }\n };\n Layer.prototype.createRepaintRects = function (displayList, prevList, viewWidth, viewHeight) {\n if (this.__firstTimePaint) {\n this.__firstTimePaint = false;\n return null;\n }\n var mergedRepaintRects = [];\n var maxRepaintRectCount = this.maxRepaintRectCount;\n var full = false;\n var pendingRect = new BoundingRect(0, 0, 0, 0);\n function addRectToMergePool(rect) {\n if (!rect.isFinite() || rect.isZero()) {\n return;\n }\n if (mergedRepaintRects.length === 0) {\n var boundingRect = new BoundingRect(0, 0, 0, 0);\n boundingRect.copy(rect);\n mergedRepaintRects.push(boundingRect);\n }\n else {\n var isMerged = false;\n var minDeltaArea = Infinity;\n var bestRectToMergeIdx = 0;\n for (var i = 0; i < mergedRepaintRects.length; ++i) {\n var mergedRect = mergedRepaintRects[i];\n if (mergedRect.intersect(rect)) {\n var pendingRect_1 = new BoundingRect(0, 0, 0, 0);\n pendingRect_1.copy(mergedRect);\n pendingRect_1.union(rect);\n mergedRepaintRects[i] = pendingRect_1;\n isMerged = true;\n break;\n }\n else if (full) {\n pendingRect.copy(rect);\n pendingRect.union(mergedRect);\n var aArea = rect.width * rect.height;\n var bArea = mergedRect.width * mergedRect.height;\n var pendingArea = pendingRect.width * pendingRect.height;\n var deltaArea = pendingArea - aArea - bArea;\n if (deltaArea < minDeltaArea) {\n minDeltaArea = deltaArea;\n bestRectToMergeIdx = i;\n }\n }\n }\n if (full) {\n mergedRepaintRects[bestRectToMergeIdx].union(rect);\n isMerged = true;\n }\n if (!isMerged) {\n var boundingRect = new BoundingRect(0, 0, 0, 0);\n boundingRect.copy(rect);\n mergedRepaintRects.push(boundingRect);\n }\n if (!full) {\n full = mergedRepaintRects.length >= maxRepaintRectCount;\n }\n }\n }\n for (var i = this.__startIndex; i < this.__endIndex; ++i) {\n var el = displayList[i];\n if (el) {\n var shouldPaint = el.shouldBePainted(viewWidth, viewHeight, true, true);\n var prevRect = el.__isRendered && ((el.__dirty & REDRAW_BIT) || !shouldPaint)\n ? el.getPrevPaintRect()\n : null;\n if (prevRect) {\n addRectToMergePool(prevRect);\n }\n var curRect = shouldPaint && ((el.__dirty & REDRAW_BIT) || !el.__isRendered)\n ? el.getPaintRect()\n : null;\n if (curRect) {\n addRectToMergePool(curRect);\n }\n }\n }\n for (var i = this.__prevStartIndex; i < this.__prevEndIndex; ++i) {\n var el = prevList[i];\n var shouldPaint = el.shouldBePainted(viewWidth, viewHeight, true, true);\n if (el && (!shouldPaint || !el.__zr) && el.__isRendered) {\n var prevRect = el.getPrevPaintRect();\n if (prevRect) {\n addRectToMergePool(prevRect);\n }\n }\n }\n var hasIntersections;\n do {\n hasIntersections = false;\n for (var i = 0; i < mergedRepaintRects.length;) {\n if (mergedRepaintRects[i].isZero()) {\n mergedRepaintRects.splice(i, 1);\n continue;\n }\n for (var j = i + 1; j < mergedRepaintRects.length;) {\n if (mergedRepaintRects[i].intersect(mergedRepaintRects[j])) {\n hasIntersections = true;\n mergedRepaintRects[i].union(mergedRepaintRects[j]);\n mergedRepaintRects.splice(j, 1);\n }\n else {\n j++;\n }\n }\n i++;\n }\n } while (hasIntersections);\n this._paintRects = mergedRepaintRects;\n return mergedRepaintRects;\n };\n Layer.prototype.debugGetPaintRects = function () {\n return (this._paintRects || []).slice();\n };\n Layer.prototype.resize = function (width, height) {\n var dpr = this.dpr;\n var dom = this.dom;\n var domStyle = dom.style;\n var domBack = this.domBack;\n if (domStyle) {\n domStyle.width = width + 'px';\n domStyle.height = height + 'px';\n }\n dom.width = width * dpr;\n dom.height = height * dpr;\n if (domBack) {\n domBack.width = width * dpr;\n domBack.height = height * dpr;\n if (dpr !== 1) {\n this.ctxBack.scale(dpr, dpr);\n }\n }\n };\n Layer.prototype.clear = function (clearAll, clearColor, repaintRects) {\n var dom = this.dom;\n var ctx = this.ctx;\n var width = dom.width;\n var height = dom.height;\n clearColor = clearColor || this.clearColor;\n var haveMotionBLur = this.motionBlur && !clearAll;\n var lastFrameAlpha = this.lastFrameAlpha;\n var dpr = this.dpr;\n var self = this;\n if (haveMotionBLur) {\n if (!this.domBack) {\n this.createBackBuffer();\n }\n this.ctxBack.globalCompositeOperation = 'copy';\n this.ctxBack.drawImage(dom, 0, 0, width / dpr, height / dpr);\n }\n var domBack = this.domBack;\n function doClear(x, y, width, height) {\n ctx.clearRect(x, y, width, height);\n if (clearColor && clearColor !== 'transparent') {\n var clearColorGradientOrPattern = void 0;\n if (util.isGradientObject(clearColor)) {\n clearColorGradientOrPattern = clearColor.__canvasGradient\n || getCanvasGradient(ctx, clearColor, {\n x: 0,\n y: 0,\n width: width,\n height: height\n });\n clearColor.__canvasGradient = clearColorGradientOrPattern;\n }\n else if (util.isImagePatternObject(clearColor)) {\n clearColorGradientOrPattern = createCanvasPattern(ctx, clearColor, {\n dirty: function () {\n self.setUnpainted();\n self.__painter.refresh();\n }\n });\n }\n ctx.save();\n ctx.fillStyle = clearColorGradientOrPattern || clearColor;\n ctx.fillRect(x, y, width, height);\n ctx.restore();\n }\n if (haveMotionBLur) {\n ctx.save();\n ctx.globalAlpha = lastFrameAlpha;\n ctx.drawImage(domBack, x, y, width, height);\n ctx.restore();\n }\n }\n ;\n if (!repaintRects || haveMotionBLur) {\n doClear(0, 0, width, height);\n }\n else if (repaintRects.length) {\n util.each(repaintRects, function (rect) {\n doClear(rect.x * dpr, rect.y * dpr, rect.width * dpr, rect.height * dpr);\n });\n }\n };\n return Layer;\n}(Eventful));\nexport default Layer;\n","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n// Core API from echarts/src/echarts\nexport * from '../core/echarts.js';\nexport * from './api.js';\nimport { use } from '../extension.js'; // Import label layout by default.\n// TODO will be treeshaked.\n\nimport { installLabelLayout } from '../label/installLabelLayout.js';\nuse(installLabelLayout);","import { devicePixelRatio } from '../config.js';\nimport * as util from '../core/util.js';\nimport Layer from './Layer.js';\nimport requestAnimationFrame from '../animation/requestAnimationFrame.js';\nimport env from '../core/env.js';\nimport { brush, brushSingle } from './graphic.js';\nimport { REDRAW_BIT } from '../graphic/constants.js';\nimport { getSize } from './helper.js';\nvar HOVER_LAYER_ZLEVEL = 1e5;\nvar CANVAS_ZLEVEL = 314159;\nvar EL_AFTER_INCREMENTAL_INC = 0.01;\nvar INCREMENTAL_INC = 0.001;\nfunction isLayerValid(layer) {\n if (!layer) {\n return false;\n }\n if (layer.__builtin__) {\n return true;\n }\n if (typeof (layer.resize) !== 'function'\n || typeof (layer.refresh) !== 'function') {\n return false;\n }\n return true;\n}\nfunction createRoot(width, height) {\n var domRoot = document.createElement('div');\n domRoot.style.cssText = [\n 'position:relative',\n 'width:' + width + 'px',\n 'height:' + height + 'px',\n 'padding:0',\n 'margin:0',\n 'border-width:0'\n ].join(';') + ';';\n return domRoot;\n}\nvar CanvasPainter = (function () {\n function CanvasPainter(root, storage, opts, id) {\n this.type = 'canvas';\n this._zlevelList = [];\n this._prevDisplayList = [];\n this._layers = {};\n this._layerConfig = {};\n this._needsManuallyCompositing = false;\n this.type = 'canvas';\n var singleCanvas = !root.nodeName\n || root.nodeName.toUpperCase() === 'CANVAS';\n this._opts = opts = util.extend({}, opts || {});\n this.dpr = opts.devicePixelRatio || devicePixelRatio;\n this._singleCanvas = singleCanvas;\n this.root = root;\n var rootStyle = root.style;\n if (rootStyle) {\n util.disableUserSelect(root);\n root.innerHTML = '';\n }\n this.storage = storage;\n var zlevelList = this._zlevelList;\n this._prevDisplayList = [];\n var layers = this._layers;\n if (!singleCanvas) {\n this._width = getSize(root, 0, opts);\n this._height = getSize(root, 1, opts);\n var domRoot = this._domRoot = createRoot(this._width, this._height);\n root.appendChild(domRoot);\n }\n else {\n var rootCanvas = root;\n var width = rootCanvas.width;\n var height = rootCanvas.height;\n if (opts.width != null) {\n width = opts.width;\n }\n if (opts.height != null) {\n height = opts.height;\n }\n this.dpr = opts.devicePixelRatio || 1;\n rootCanvas.width = width * this.dpr;\n rootCanvas.height = height * this.dpr;\n this._width = width;\n this._height = height;\n var mainLayer = new Layer(rootCanvas, this, this.dpr);\n mainLayer.__builtin__ = true;\n mainLayer.initContext();\n layers[CANVAS_ZLEVEL] = mainLayer;\n mainLayer.zlevel = CANVAS_ZLEVEL;\n zlevelList.push(CANVAS_ZLEVEL);\n this._domRoot = root;\n }\n }\n CanvasPainter.prototype.getType = function () {\n return 'canvas';\n };\n CanvasPainter.prototype.isSingleCanvas = function () {\n return this._singleCanvas;\n };\n CanvasPainter.prototype.getViewportRoot = function () {\n return this._domRoot;\n };\n CanvasPainter.prototype.getViewportRootOffset = function () {\n var viewportRoot = this.getViewportRoot();\n if (viewportRoot) {\n return {\n offsetLeft: viewportRoot.offsetLeft || 0,\n offsetTop: viewportRoot.offsetTop || 0\n };\n }\n };\n CanvasPainter.prototype.refresh = function (paintAll) {\n var list = this.storage.getDisplayList(true);\n var prevList = this._prevDisplayList;\n var zlevelList = this._zlevelList;\n this._redrawId = Math.random();\n this._paintList(list, prevList, paintAll, this._redrawId);\n for (var i = 0; i < zlevelList.length; i++) {\n var z = zlevelList[i];\n var layer = this._layers[z];\n if (!layer.__builtin__ && layer.refresh) {\n var clearColor = i === 0 ? this._backgroundColor : null;\n layer.refresh(clearColor);\n }\n }\n if (this._opts.useDirtyRect) {\n this._prevDisplayList = list.slice();\n }\n return this;\n };\n CanvasPainter.prototype.refreshHover = function () {\n this._paintHoverList(this.storage.getDisplayList(false));\n };\n CanvasPainter.prototype._paintHoverList = function (list) {\n var len = list.length;\n var hoverLayer = this._hoverlayer;\n hoverLayer && hoverLayer.clear();\n if (!len) {\n return;\n }\n var scope = {\n inHover: true,\n viewWidth: this._width,\n viewHeight: this._height\n };\n var ctx;\n for (var i = 0; i < len; i++) {\n var el = list[i];\n if (el.__inHover) {\n if (!hoverLayer) {\n hoverLayer = this._hoverlayer = this.getLayer(HOVER_LAYER_ZLEVEL);\n }\n if (!ctx) {\n ctx = hoverLayer.ctx;\n ctx.save();\n }\n brush(ctx, el, scope, i === len - 1);\n }\n }\n if (ctx) {\n ctx.restore();\n }\n };\n CanvasPainter.prototype.getHoverLayer = function () {\n return this.getLayer(HOVER_LAYER_ZLEVEL);\n };\n CanvasPainter.prototype.paintOne = function (ctx, el) {\n brushSingle(ctx, el);\n };\n CanvasPainter.prototype._paintList = function (list, prevList, paintAll, redrawId) {\n if (this._redrawId !== redrawId) {\n return;\n }\n paintAll = paintAll || false;\n this._updateLayerStatus(list);\n var _a = this._doPaintList(list, prevList, paintAll), finished = _a.finished, needsRefreshHover = _a.needsRefreshHover;\n if (this._needsManuallyCompositing) {\n this._compositeManually();\n }\n if (needsRefreshHover) {\n this._paintHoverList(list);\n }\n if (!finished) {\n var self_1 = this;\n requestAnimationFrame(function () {\n self_1._paintList(list, prevList, paintAll, redrawId);\n });\n }\n else {\n this.eachLayer(function (layer) {\n layer.afterBrush && layer.afterBrush();\n });\n }\n };\n CanvasPainter.prototype._compositeManually = function () {\n var ctx = this.getLayer(CANVAS_ZLEVEL).ctx;\n var width = this._domRoot.width;\n var height = this._domRoot.height;\n ctx.clearRect(0, 0, width, height);\n this.eachBuiltinLayer(function (layer) {\n if (layer.virtual) {\n ctx.drawImage(layer.dom, 0, 0, width, height);\n }\n });\n };\n CanvasPainter.prototype._doPaintList = function (list, prevList, paintAll) {\n var _this = this;\n var layerList = [];\n var useDirtyRect = this._opts.useDirtyRect;\n for (var zi = 0; zi < this._zlevelList.length; zi++) {\n var zlevel = this._zlevelList[zi];\n var layer = this._layers[zlevel];\n if (layer.__builtin__\n && layer !== this._hoverlayer\n && (layer.__dirty || paintAll)) {\n layerList.push(layer);\n }\n }\n var finished = true;\n var needsRefreshHover = false;\n var _loop_1 = function (k) {\n var layer = layerList[k];\n var ctx = layer.ctx;\n var repaintRects = useDirtyRect\n && layer.createRepaintRects(list, prevList, this_1._width, this_1._height);\n var start = paintAll ? layer.__startIndex : layer.__drawIndex;\n var useTimer = !paintAll && layer.incremental && Date.now;\n var startTime = useTimer && Date.now();\n var clearColor = layer.zlevel === this_1._zlevelList[0]\n ? this_1._backgroundColor : null;\n if (layer.__startIndex === layer.__endIndex) {\n layer.clear(false, clearColor, repaintRects);\n }\n else if (start === layer.__startIndex) {\n var firstEl = list[start];\n if (!firstEl.incremental || !firstEl.notClear || paintAll) {\n layer.clear(false, clearColor, repaintRects);\n }\n }\n if (start === -1) {\n console.error('For some unknown reason. drawIndex is -1');\n start = layer.__startIndex;\n }\n var i;\n var repaint = function (repaintRect) {\n var scope = {\n inHover: false,\n allClipped: false,\n prevEl: null,\n viewWidth: _this._width,\n viewHeight: _this._height\n };\n for (i = start; i < layer.__endIndex; i++) {\n var el = list[i];\n if (el.__inHover) {\n needsRefreshHover = true;\n }\n _this._doPaintEl(el, layer, useDirtyRect, repaintRect, scope, i === layer.__endIndex - 1);\n if (useTimer) {\n var dTime = Date.now() - startTime;\n if (dTime > 15) {\n break;\n }\n }\n }\n if (scope.prevElClipPaths) {\n ctx.restore();\n }\n };\n if (repaintRects) {\n if (repaintRects.length === 0) {\n i = layer.__endIndex;\n }\n else {\n var dpr = this_1.dpr;\n for (var r = 0; r < repaintRects.length; ++r) {\n var rect = repaintRects[r];\n ctx.save();\n ctx.beginPath();\n ctx.rect(rect.x * dpr, rect.y * dpr, rect.width * dpr, rect.height * dpr);\n ctx.clip();\n repaint(rect);\n ctx.restore();\n }\n }\n }\n else {\n ctx.save();\n repaint();\n ctx.restore();\n }\n layer.__drawIndex = i;\n if (layer.__drawIndex < layer.__endIndex) {\n finished = false;\n }\n };\n var this_1 = this;\n for (var k = 0; k < layerList.length; k++) {\n _loop_1(k);\n }\n if (env.wxa) {\n util.each(this._layers, function (layer) {\n if (layer && layer.ctx && layer.ctx.draw) {\n layer.ctx.draw();\n }\n });\n }\n return {\n finished: finished,\n needsRefreshHover: needsRefreshHover\n };\n };\n CanvasPainter.prototype._doPaintEl = function (el, currentLayer, useDirtyRect, repaintRect, scope, isLast) {\n var ctx = currentLayer.ctx;\n if (useDirtyRect) {\n var paintRect = el.getPaintRect();\n if (!repaintRect || paintRect && paintRect.intersect(repaintRect)) {\n brush(ctx, el, scope, isLast);\n el.setPrevPaintRect(paintRect);\n }\n }\n else {\n brush(ctx, el, scope, isLast);\n }\n };\n CanvasPainter.prototype.getLayer = function (zlevel, virtual) {\n if (this._singleCanvas && !this._needsManuallyCompositing) {\n zlevel = CANVAS_ZLEVEL;\n }\n var layer = this._layers[zlevel];\n if (!layer) {\n layer = new Layer('zr_' + zlevel, this, this.dpr);\n layer.zlevel = zlevel;\n layer.__builtin__ = true;\n if (this._layerConfig[zlevel]) {\n util.merge(layer, this._layerConfig[zlevel], true);\n }\n else if (this._layerConfig[zlevel - EL_AFTER_INCREMENTAL_INC]) {\n util.merge(layer, this._layerConfig[zlevel - EL_AFTER_INCREMENTAL_INC], true);\n }\n if (virtual) {\n layer.virtual = virtual;\n }\n this.insertLayer(zlevel, layer);\n layer.initContext();\n }\n return layer;\n };\n CanvasPainter.prototype.insertLayer = function (zlevel, layer) {\n var layersMap = this._layers;\n var zlevelList = this._zlevelList;\n var len = zlevelList.length;\n var domRoot = this._domRoot;\n var prevLayer = null;\n var i = -1;\n if (layersMap[zlevel]) {\n if (process.env.NODE_ENV !== 'production') {\n util.logError('ZLevel ' + zlevel + ' has been used already');\n }\n return;\n }\n if (!isLayerValid(layer)) {\n if (process.env.NODE_ENV !== 'production') {\n util.logError('Layer of zlevel ' + zlevel + ' is not valid');\n }\n return;\n }\n if (len > 0 && zlevel > zlevelList[0]) {\n for (i = 0; i < len - 1; i++) {\n if (zlevelList[i] < zlevel\n && zlevelList[i + 1] > zlevel) {\n break;\n }\n }\n prevLayer = layersMap[zlevelList[i]];\n }\n zlevelList.splice(i + 1, 0, zlevel);\n layersMap[zlevel] = layer;\n if (!layer.virtual) {\n if (prevLayer) {\n var prevDom = prevLayer.dom;\n if (prevDom.nextSibling) {\n domRoot.insertBefore(layer.dom, prevDom.nextSibling);\n }\n else {\n domRoot.appendChild(layer.dom);\n }\n }\n else {\n if (domRoot.firstChild) {\n domRoot.insertBefore(layer.dom, domRoot.firstChild);\n }\n else {\n domRoot.appendChild(layer.dom);\n }\n }\n }\n layer.__painter = this;\n };\n CanvasPainter.prototype.eachLayer = function (cb, context) {\n var zlevelList = this._zlevelList;\n for (var i = 0; i < zlevelList.length; i++) {\n var z = zlevelList[i];\n cb.call(context, this._layers[z], z);\n }\n };\n CanvasPainter.prototype.eachBuiltinLayer = function (cb, context) {\n var zlevelList = this._zlevelList;\n for (var i = 0; i < zlevelList.length; i++) {\n var z = zlevelList[i];\n var layer = this._layers[z];\n if (layer.__builtin__) {\n cb.call(context, layer, z);\n }\n }\n };\n CanvasPainter.prototype.eachOtherLayer = function (cb, context) {\n var zlevelList = this._zlevelList;\n for (var i = 0; i < zlevelList.length; i++) {\n var z = zlevelList[i];\n var layer = this._layers[z];\n if (!layer.__builtin__) {\n cb.call(context, layer, z);\n }\n }\n };\n CanvasPainter.prototype.getLayers = function () {\n return this._layers;\n };\n CanvasPainter.prototype._updateLayerStatus = function (list) {\n this.eachBuiltinLayer(function (layer, z) {\n layer.__dirty = layer.__used = false;\n });\n function updatePrevLayer(idx) {\n if (prevLayer) {\n if (prevLayer.__endIndex !== idx) {\n prevLayer.__dirty = true;\n }\n prevLayer.__endIndex = idx;\n }\n }\n if (this._singleCanvas) {\n for (var i_1 = 1; i_1 < list.length; i_1++) {\n var el = list[i_1];\n if (el.zlevel !== list[i_1 - 1].zlevel || el.incremental) {\n this._needsManuallyCompositing = true;\n break;\n }\n }\n }\n var prevLayer = null;\n var incrementalLayerCount = 0;\n var prevZlevel;\n var i;\n for (i = 0; i < list.length; i++) {\n var el = list[i];\n var zlevel = el.zlevel;\n var layer = void 0;\n if (prevZlevel !== zlevel) {\n prevZlevel = zlevel;\n incrementalLayerCount = 0;\n }\n if (el.incremental) {\n layer = this.getLayer(zlevel + INCREMENTAL_INC, this._needsManuallyCompositing);\n layer.incremental = true;\n incrementalLayerCount = 1;\n }\n else {\n layer = this.getLayer(zlevel + (incrementalLayerCount > 0 ? EL_AFTER_INCREMENTAL_INC : 0), this._needsManuallyCompositing);\n }\n if (!layer.__builtin__) {\n util.logError('ZLevel ' + zlevel + ' has been used by unkown layer ' + layer.id);\n }\n if (layer !== prevLayer) {\n layer.__used = true;\n if (layer.__startIndex !== i) {\n layer.__dirty = true;\n }\n layer.__startIndex = i;\n if (!layer.incremental) {\n layer.__drawIndex = i;\n }\n else {\n layer.__drawIndex = -1;\n }\n updatePrevLayer(i);\n prevLayer = layer;\n }\n if ((el.__dirty & REDRAW_BIT) && !el.__inHover) {\n layer.__dirty = true;\n if (layer.incremental && layer.__drawIndex < 0) {\n layer.__drawIndex = i;\n }\n }\n }\n updatePrevLayer(i);\n this.eachBuiltinLayer(function (layer, z) {\n if (!layer.__used && layer.getElementCount() > 0) {\n layer.__dirty = true;\n layer.__startIndex = layer.__endIndex = layer.__drawIndex = 0;\n }\n if (layer.__dirty && layer.__drawIndex < 0) {\n layer.__drawIndex = layer.__startIndex;\n }\n });\n };\n CanvasPainter.prototype.clear = function () {\n this.eachBuiltinLayer(this._clearLayer);\n return this;\n };\n CanvasPainter.prototype._clearLayer = function (layer) {\n layer.clear();\n };\n CanvasPainter.prototype.setBackgroundColor = function (backgroundColor) {\n this._backgroundColor = backgroundColor;\n util.each(this._layers, function (layer) {\n layer.setUnpainted();\n });\n };\n CanvasPainter.prototype.configLayer = function (zlevel, config) {\n if (config) {\n var layerConfig = this._layerConfig;\n if (!layerConfig[zlevel]) {\n layerConfig[zlevel] = config;\n }\n else {\n util.merge(layerConfig[zlevel], config, true);\n }\n for (var i = 0; i < this._zlevelList.length; i++) {\n var _zlevel = this._zlevelList[i];\n if (_zlevel === zlevel || _zlevel === zlevel + EL_AFTER_INCREMENTAL_INC) {\n var layer = this._layers[_zlevel];\n util.merge(layer, layerConfig[zlevel], true);\n }\n }\n }\n };\n CanvasPainter.prototype.delLayer = function (zlevel) {\n var layers = this._layers;\n var zlevelList = this._zlevelList;\n var layer = layers[zlevel];\n if (!layer) {\n return;\n }\n layer.dom.parentNode.removeChild(layer.dom);\n delete layers[zlevel];\n zlevelList.splice(util.indexOf(zlevelList, zlevel), 1);\n };\n CanvasPainter.prototype.resize = function (width, height) {\n if (!this._domRoot.style) {\n if (width == null || height == null) {\n return;\n }\n this._width = width;\n this._height = height;\n this.getLayer(CANVAS_ZLEVEL).resize(width, height);\n }\n else {\n var domRoot = this._domRoot;\n domRoot.style.display = 'none';\n var opts = this._opts;\n var root = this.root;\n width != null && (opts.width = width);\n height != null && (opts.height = height);\n width = getSize(root, 0, opts);\n height = getSize(root, 1, opts);\n domRoot.style.display = '';\n if (this._width !== width || height !== this._height) {\n domRoot.style.width = width + 'px';\n domRoot.style.height = height + 'px';\n for (var id in this._layers) {\n if (this._layers.hasOwnProperty(id)) {\n this._layers[id].resize(width, height);\n }\n }\n this.refresh(true);\n }\n this._width = width;\n this._height = height;\n }\n return this;\n };\n CanvasPainter.prototype.clearLayer = function (zlevel) {\n var layer = this._layers[zlevel];\n if (layer) {\n layer.clear();\n }\n };\n CanvasPainter.prototype.dispose = function () {\n this.root.innerHTML = '';\n this.root =\n this.storage =\n this._domRoot =\n this._layers = null;\n };\n CanvasPainter.prototype.getRenderedCanvas = function (opts) {\n opts = opts || {};\n if (this._singleCanvas && !this._compositeManually) {\n return this._layers[CANVAS_ZLEVEL].dom;\n }\n var imageLayer = new Layer('image', this, opts.pixelRatio || this.dpr);\n imageLayer.initContext();\n imageLayer.clear(false, opts.backgroundColor || this._backgroundColor);\n var ctx = imageLayer.ctx;\n if (opts.pixelRatio <= this.dpr) {\n this.refresh();\n var width_1 = imageLayer.dom.width;\n var height_1 = imageLayer.dom.height;\n this.eachLayer(function (layer) {\n if (layer.__builtin__) {\n ctx.drawImage(layer.dom, 0, 0, width_1, height_1);\n }\n else if (layer.renderToCanvas) {\n ctx.save();\n layer.renderToCanvas(ctx);\n ctx.restore();\n }\n });\n }\n else {\n var scope = {\n inHover: false,\n viewWidth: this._width,\n viewHeight: this._height\n };\n var displayList = this.storage.getDisplayList(true);\n for (var i = 0, len = displayList.length; i < len; i++) {\n var el = displayList[i];\n brush(ctx, el, scope, i === len - 1);\n }\n }\n return imageLayer.dom;\n };\n CanvasPainter.prototype.getWidth = function () {\n return this._width;\n };\n CanvasPainter.prototype.getHeight = function () {\n return this._height;\n };\n return CanvasPainter;\n}());\nexport default CanvasPainter;\n;\n","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport CanvasPainter from 'zrender/lib/canvas/Painter.js';\nexport function install(registers) {\n registers.registerPainter('canvas', CanvasPainter);\n}","import { isAroundZero } from './helper.js';\nvar mathSin = Math.sin;\nvar mathCos = Math.cos;\nvar PI = Math.PI;\nvar PI2 = Math.PI * 2;\nvar degree = 180 / PI;\nvar SVGPathRebuilder = (function () {\n function SVGPathRebuilder() {\n }\n SVGPathRebuilder.prototype.reset = function (precision) {\n this._start = true;\n this._d = [];\n this._str = '';\n this._p = Math.pow(10, precision || 4);\n };\n SVGPathRebuilder.prototype.moveTo = function (x, y) {\n this._add('M', x, y);\n };\n SVGPathRebuilder.prototype.lineTo = function (x, y) {\n this._add('L', x, y);\n };\n SVGPathRebuilder.prototype.bezierCurveTo = function (x, y, x2, y2, x3, y3) {\n this._add('C', x, y, x2, y2, x3, y3);\n };\n SVGPathRebuilder.prototype.quadraticCurveTo = function (x, y, x2, y2) {\n this._add('Q', x, y, x2, y2);\n };\n SVGPathRebuilder.prototype.arc = function (cx, cy, r, startAngle, endAngle, anticlockwise) {\n this.ellipse(cx, cy, r, r, 0, startAngle, endAngle, anticlockwise);\n };\n SVGPathRebuilder.prototype.ellipse = function (cx, cy, rx, ry, psi, startAngle, endAngle, anticlockwise) {\n var dTheta = endAngle - startAngle;\n var clockwise = !anticlockwise;\n var dThetaPositive = Math.abs(dTheta);\n var isCircle = isAroundZero(dThetaPositive - PI2)\n || (clockwise ? dTheta >= PI2 : -dTheta >= PI2);\n var unifiedTheta = dTheta > 0 ? dTheta % PI2 : (dTheta % PI2 + PI2);\n var large = false;\n if (isCircle) {\n large = true;\n }\n else if (isAroundZero(dThetaPositive)) {\n large = false;\n }\n else {\n large = (unifiedTheta >= PI) === !!clockwise;\n }\n var x0 = cx + rx * mathCos(startAngle);\n var y0 = cy + ry * mathSin(startAngle);\n if (this._start) {\n this._add('M', x0, y0);\n }\n var xRot = Math.round(psi * degree);\n if (isCircle) {\n var p = 1 / this._p;\n var dTheta_1 = (clockwise ? 1 : -1) * (PI2 - p);\n this._add('A', rx, ry, xRot, 1, +clockwise, cx + rx * mathCos(startAngle + dTheta_1), cy + ry * mathSin(startAngle + dTheta_1));\n if (p > 1e-2) {\n this._add('A', rx, ry, xRot, 0, +clockwise, x0, y0);\n }\n }\n else {\n var x = cx + rx * mathCos(endAngle);\n var y = cy + ry * mathSin(endAngle);\n this._add('A', rx, ry, xRot, +large, +clockwise, x, y);\n }\n };\n SVGPathRebuilder.prototype.rect = function (x, y, w, h) {\n this._add('M', x, y);\n this._add('l', w, 0);\n this._add('l', 0, h);\n this._add('l', -w, 0);\n this._add('Z');\n };\n SVGPathRebuilder.prototype.closePath = function () {\n if (this._d.length > 0) {\n this._add('Z');\n }\n };\n SVGPathRebuilder.prototype._add = function (cmd, a, b, c, d, e, f, g, h) {\n var vals = [];\n var p = this._p;\n for (var i = 1; i < arguments.length; i++) {\n var val = arguments[i];\n if (isNaN(val)) {\n this._invalid = true;\n return;\n }\n vals.push(Math.round(val * p) / p);\n }\n this._d.push(cmd + vals.join(' '));\n this._start = cmd === 'Z';\n };\n SVGPathRebuilder.prototype.generateStr = function () {\n this._str = this._invalid ? '' : this._d.join('');\n this._d = [];\n };\n SVGPathRebuilder.prototype.getStr = function () {\n return this._str;\n };\n return SVGPathRebuilder;\n}());\nexport default SVGPathRebuilder;\n","import { DEFAULT_PATH_STYLE } from '../graphic/Path.js';\nimport ZRImage from '../graphic/Image.js';\nimport { getLineDash } from '../canvas/dashStyle.js';\nimport { map } from '../core/util.js';\nimport { normalizeColor } from './helper.js';\nvar NONE = 'none';\nvar mathRound = Math.round;\nfunction pathHasFill(style) {\n var fill = style.fill;\n return fill != null && fill !== NONE;\n}\nfunction pathHasStroke(style) {\n var stroke = style.stroke;\n return stroke != null && stroke !== NONE;\n}\nvar strokeProps = ['lineCap', 'miterLimit', 'lineJoin'];\nvar svgStrokeProps = map(strokeProps, function (prop) { return \"stroke-\" + prop.toLowerCase(); });\nexport default function mapStyleToAttrs(updateAttr, style, el, forceUpdate) {\n var opacity = style.opacity == null ? 1 : style.opacity;\n if (el instanceof ZRImage) {\n updateAttr('opacity', opacity);\n return;\n }\n if (pathHasFill(style)) {\n var fill = normalizeColor(style.fill);\n updateAttr('fill', fill.color);\n var fillOpacity = style.fillOpacity != null\n ? style.fillOpacity * fill.opacity * opacity\n : fill.opacity * opacity;\n if (forceUpdate || fillOpacity < 1) {\n updateAttr('fill-opacity', fillOpacity);\n }\n }\n else {\n updateAttr('fill', NONE);\n }\n if (pathHasStroke(style)) {\n var stroke = normalizeColor(style.stroke);\n updateAttr('stroke', stroke.color);\n var strokeScale = style.strokeNoScale\n ? el.getLineScale()\n : 1;\n var strokeWidth = (strokeScale ? (style.lineWidth || 0) / strokeScale : 0);\n var strokeOpacity = style.strokeOpacity != null\n ? style.strokeOpacity * stroke.opacity * opacity\n : stroke.opacity * opacity;\n var strokeFirst = style.strokeFirst;\n if (forceUpdate || strokeWidth !== 1) {\n updateAttr('stroke-width', strokeWidth);\n }\n if (forceUpdate || strokeFirst) {\n updateAttr('paint-order', strokeFirst ? 'stroke' : 'fill');\n }\n if (forceUpdate || strokeOpacity < 1) {\n updateAttr('stroke-opacity', strokeOpacity);\n }\n if (style.lineDash) {\n var _a = getLineDash(el), lineDash = _a[0], lineDashOffset = _a[1];\n if (lineDash) {\n lineDashOffset = mathRound(lineDashOffset || 0);\n updateAttr('stroke-dasharray', lineDash.join(','));\n if (lineDashOffset || forceUpdate) {\n updateAttr('stroke-dashoffset', lineDashOffset);\n }\n }\n }\n else if (forceUpdate) {\n updateAttr('stroke-dasharray', NONE);\n }\n for (var i = 0; i < strokeProps.length; i++) {\n var propName = strokeProps[i];\n if (forceUpdate || style[propName] !== DEFAULT_PATH_STYLE[propName]) {\n var val = style[propName] || DEFAULT_PATH_STYLE[propName];\n val && updateAttr(svgStrokeProps[i], val);\n }\n }\n }\n else if (forceUpdate) {\n updateAttr('stroke', NONE);\n }\n}\n","import { keys, map } from '../core/util.js';\nexport var SVGNS = 'http://www.w3.org/2000/svg';\nexport var XLINKNS = 'http://www.w3.org/1999/xlink';\nexport var XMLNS = 'http://www.w3.org/2000/xmlns/';\nexport var XML_NAMESPACE = 'http://www.w3.org/XML/1998/namespace';\nexport function createElement(name) {\n return document.createElementNS(SVGNS, name);\n}\n;\nexport function createVNode(tag, key, attrs, children, text) {\n return {\n tag: tag,\n attrs: attrs || {},\n children: children,\n text: text,\n key: key\n };\n}\nfunction createElementOpen(name, attrs) {\n var attrsStr = [];\n if (attrs) {\n for (var key in attrs) {\n var val = attrs[key];\n var part = key;\n if (val === false) {\n continue;\n }\n else if (val !== true && val != null) {\n part += \"=\\\"\" + val + \"\\\"\";\n }\n attrsStr.push(part);\n }\n }\n return \"<\" + name + \" \" + attrsStr.join(' ') + \">\";\n}\nfunction createElementClose(name) {\n return \"\" + name + \">\";\n}\nexport function vNodeToString(el, opts) {\n opts = opts || {};\n var S = opts.newline ? '\\n' : '';\n function convertElToString(el) {\n var children = el.children, tag = el.tag, attrs = el.attrs;\n return createElementOpen(tag, attrs)\n + (el.text || '')\n + (children ? \"\" + S + map(children, function (child) { return convertElToString(child); }).join(S) + S : '')\n + createElementClose(tag);\n }\n return convertElToString(el);\n}\nexport function getCssString(selectorNodes, animationNodes, opts) {\n opts = opts || {};\n var S = opts.newline ? '\\n' : '';\n var bracketBegin = \" {\" + S;\n var bracketEnd = S + \"}\";\n var selectors = map(keys(selectorNodes), function (className) {\n return className + bracketBegin + map(keys(selectorNodes[className]), function (attrName) {\n return attrName + \":\" + selectorNodes[className][attrName] + \";\";\n }).join(S) + bracketEnd;\n }).join(S);\n var animations = map(keys(animationNodes), function (animationName) {\n return \"@keyframes \" + animationName + bracketBegin + map(keys(animationNodes[animationName]), function (percent) {\n return percent + bracketBegin + map(keys(animationNodes[animationName][percent]), function (attrName) {\n var val = animationNodes[animationName][percent][attrName];\n if (attrName === 'd') {\n val = \"path(\\\"\" + val + \"\\\")\";\n }\n return attrName + \":\" + val + \";\";\n }).join(S) + bracketEnd;\n }).join(S) + bracketEnd;\n }).join(S);\n if (!selectors && !animations) {\n return '';\n }\n return [''].join(S);\n}\nexport function createBrushScope(zrId) {\n return {\n zrId: zrId,\n shadowCache: {},\n patternCache: {},\n gradientCache: {},\n clipPathCache: {},\n defs: {},\n cssNodes: {},\n cssAnims: {},\n cssClassIdx: 0,\n cssAnimIdx: 0,\n shadowIdx: 0,\n gradientIdx: 0,\n patternIdx: 0,\n clipPathIdx: 0\n };\n}\nexport function createSVGVNode(width, height, children, useViewBox) {\n return createVNode('svg', 'root', {\n 'width': width,\n 'height': height,\n 'xmlns': SVGNS,\n 'xmlns:xlink': XLINKNS,\n 'version': '1.1',\n 'baseProfile': 'full',\n 'viewBox': useViewBox ? \"0 0 \" + width + \" \" + height : false\n }, children);\n}\n","import { copyTransform } from '../core/Transformable.js';\nimport { createBrushScope } from './core.js';\nimport SVGPathRebuilder from './SVGPathRebuilder.js';\nimport PathProxy from '../core/PathProxy.js';\nimport { getPathPrecision, getSRTTransformString } from './helper.js';\nimport { each, extend, filter, isNumber, isString, keys } from '../core/util.js';\nimport CompoundPath from '../graphic/CompoundPath.js';\nimport { createCubicEasingFunc } from '../animation/cubicEasing.js';\nexport var EASING_MAP = {\n cubicIn: '0.32,0,0.67,0',\n cubicOut: '0.33,1,0.68,1',\n cubicInOut: '0.65,0,0.35,1',\n quadraticIn: '0.11,0,0.5,0',\n quadraticOut: '0.5,1,0.89,1',\n quadraticInOut: '0.45,0,0.55,1',\n quarticIn: '0.5,0,0.75,0',\n quarticOut: '0.25,1,0.5,1',\n quarticInOut: '0.76,0,0.24,1',\n quinticIn: '0.64,0,0.78,0',\n quinticOut: '0.22,1,0.36,1',\n quinticInOut: '0.83,0,0.17,1',\n sinusoidalIn: '0.12,0,0.39,0',\n sinusoidalOut: '0.61,1,0.88,1',\n sinusoidalInOut: '0.37,0,0.63,1',\n exponentialIn: '0.7,0,0.84,0',\n exponentialOut: '0.16,1,0.3,1',\n exponentialInOut: '0.87,0,0.13,1',\n circularIn: '0.55,0,1,0.45',\n circularOut: '0,0.55,0.45,1',\n circularInOut: '0.85,0,0.15,1'\n};\nvar transformOriginKey = 'transform-origin';\nfunction buildPathString(el, kfShape, path) {\n var shape = extend({}, el.shape);\n extend(shape, kfShape);\n el.buildPath(path, shape);\n var svgPathBuilder = new SVGPathRebuilder();\n svgPathBuilder.reset(getPathPrecision(el));\n path.rebuildPath(svgPathBuilder, 1);\n svgPathBuilder.generateStr();\n return svgPathBuilder.getStr();\n}\nfunction setTransformOrigin(target, transform) {\n var originX = transform.originX, originY = transform.originY;\n if (originX || originY) {\n target[transformOriginKey] = originX + \"px \" + originY + \"px\";\n }\n}\nexport var ANIMATE_STYLE_MAP = {\n fill: 'fill',\n opacity: 'opacity',\n lineWidth: 'stroke-width',\n lineDashOffset: 'stroke-dashoffset'\n};\nfunction addAnimation(cssAnim, scope) {\n var animationName = scope.zrId + '-ani-' + scope.cssAnimIdx++;\n scope.cssAnims[animationName] = cssAnim;\n return animationName;\n}\nfunction createCompoundPathCSSAnimation(el, attrs, scope) {\n var paths = el.shape.paths;\n var composedAnim = {};\n var cssAnimationCfg;\n var cssAnimationName;\n each(paths, function (path) {\n var subScope = createBrushScope(scope.zrId);\n subScope.animation = true;\n createCSSAnimation(path, {}, subScope, true);\n var cssAnims = subScope.cssAnims;\n var cssNodes = subScope.cssNodes;\n var animNames = keys(cssAnims);\n var len = animNames.length;\n if (!len) {\n return;\n }\n cssAnimationName = animNames[len - 1];\n var lastAnim = cssAnims[cssAnimationName];\n for (var percent in lastAnim) {\n var kf = lastAnim[percent];\n composedAnim[percent] = composedAnim[percent] || { d: '' };\n composedAnim[percent].d += kf.d || '';\n }\n for (var className in cssNodes) {\n var val = cssNodes[className].animation;\n if (val.indexOf(cssAnimationName) >= 0) {\n cssAnimationCfg = val;\n }\n }\n });\n if (!cssAnimationCfg) {\n return;\n }\n attrs.d = false;\n var animationName = addAnimation(composedAnim, scope);\n return cssAnimationCfg.replace(cssAnimationName, animationName);\n}\nfunction getEasingFunc(easing) {\n return isString(easing)\n ? EASING_MAP[easing]\n ? \"cubic-bezier(\" + EASING_MAP[easing] + \")\"\n : createCubicEasingFunc(easing) ? easing : ''\n : '';\n}\nexport function createCSSAnimation(el, attrs, scope, onlyShape) {\n var animators = el.animators;\n var len = animators.length;\n var cssAnimations = [];\n if (el instanceof CompoundPath) {\n var animationCfg = createCompoundPathCSSAnimation(el, attrs, scope);\n if (animationCfg) {\n cssAnimations.push(animationCfg);\n }\n else if (!len) {\n return;\n }\n }\n else if (!len) {\n return;\n }\n var groupAnimators = {};\n for (var i = 0; i < len; i++) {\n var animator = animators[i];\n var cfgArr = [animator.getMaxTime() / 1000 + 's'];\n var easing = getEasingFunc(animator.getClip().easing);\n var delay = animator.getDelay();\n if (easing) {\n cfgArr.push(easing);\n }\n else {\n cfgArr.push('linear');\n }\n if (delay) {\n cfgArr.push(delay / 1000 + 's');\n }\n if (animator.getLoop()) {\n cfgArr.push('infinite');\n }\n var cfg = cfgArr.join(' ');\n groupAnimators[cfg] = groupAnimators[cfg] || [cfg, []];\n groupAnimators[cfg][1].push(animator);\n }\n function createSingleCSSAnimation(groupAnimator) {\n var animators = groupAnimator[1];\n var len = animators.length;\n var transformKfs = {};\n var shapeKfs = {};\n var finalKfs = {};\n var animationTimingFunctionAttrName = 'animation-timing-function';\n function saveAnimatorTrackToCssKfs(animator, cssKfs, toCssAttrName) {\n var tracks = animator.getTracks();\n var maxTime = animator.getMaxTime();\n for (var k = 0; k < tracks.length; k++) {\n var track = tracks[k];\n if (track.needsAnimate()) {\n var kfs = track.keyframes;\n var attrName = track.propName;\n toCssAttrName && (attrName = toCssAttrName(attrName));\n if (attrName) {\n for (var i = 0; i < kfs.length; i++) {\n var kf = kfs[i];\n var percent = Math.round(kf.time / maxTime * 100) + '%';\n var kfEasing = getEasingFunc(kf.easing);\n var rawValue = kf.rawValue;\n if (isString(rawValue) || isNumber(rawValue)) {\n cssKfs[percent] = cssKfs[percent] || {};\n cssKfs[percent][attrName] = kf.rawValue;\n if (kfEasing) {\n cssKfs[percent][animationTimingFunctionAttrName] = kfEasing;\n }\n }\n }\n }\n }\n }\n }\n for (var i = 0; i < len; i++) {\n var animator = animators[i];\n var targetProp = animator.targetName;\n if (!targetProp) {\n !onlyShape && saveAnimatorTrackToCssKfs(animator, transformKfs);\n }\n else if (targetProp === 'shape') {\n saveAnimatorTrackToCssKfs(animator, shapeKfs);\n }\n }\n for (var percent in transformKfs) {\n var transform = {};\n copyTransform(transform, el);\n extend(transform, transformKfs[percent]);\n var str = getSRTTransformString(transform);\n var timingFunction = transformKfs[percent][animationTimingFunctionAttrName];\n finalKfs[percent] = str ? {\n transform: str\n } : {};\n setTransformOrigin(finalKfs[percent], transform);\n if (timingFunction) {\n finalKfs[percent][animationTimingFunctionAttrName] = timingFunction;\n }\n }\n ;\n var path;\n var canAnimateShape = true;\n for (var percent in shapeKfs) {\n finalKfs[percent] = finalKfs[percent] || {};\n var isFirst = !path;\n var timingFunction = shapeKfs[percent][animationTimingFunctionAttrName];\n if (isFirst) {\n path = new PathProxy();\n }\n var len_1 = path.len();\n path.reset();\n finalKfs[percent].d = buildPathString(el, shapeKfs[percent], path);\n var newLen = path.len();\n if (!isFirst && len_1 !== newLen) {\n canAnimateShape = false;\n break;\n }\n if (timingFunction) {\n finalKfs[percent][animationTimingFunctionAttrName] = timingFunction;\n }\n }\n ;\n if (!canAnimateShape) {\n for (var percent in finalKfs) {\n delete finalKfs[percent].d;\n }\n }\n if (!onlyShape) {\n for (var i = 0; i < len; i++) {\n var animator = animators[i];\n var targetProp = animator.targetName;\n if (targetProp === 'style') {\n saveAnimatorTrackToCssKfs(animator, finalKfs, function (propName) { return ANIMATE_STYLE_MAP[propName]; });\n }\n }\n }\n var percents = keys(finalKfs);\n var allTransformOriginSame = true;\n var transformOrigin;\n for (var i = 1; i < percents.length; i++) {\n var p0 = percents[i - 1];\n var p1 = percents[i];\n if (finalKfs[p0][transformOriginKey] !== finalKfs[p1][transformOriginKey]) {\n allTransformOriginSame = false;\n break;\n }\n transformOrigin = finalKfs[p0][transformOriginKey];\n }\n if (allTransformOriginSame && transformOrigin) {\n for (var percent in finalKfs) {\n if (finalKfs[percent][transformOriginKey]) {\n delete finalKfs[percent][transformOriginKey];\n }\n }\n attrs[transformOriginKey] = transformOrigin;\n }\n if (filter(percents, function (percent) { return keys(finalKfs[percent]).length > 0; }).length) {\n var animationName = addAnimation(finalKfs, scope);\n return animationName + \" \" + groupAnimator[0] + \" both\";\n }\n }\n for (var key in groupAnimators) {\n var animationCfg = createSingleCSSAnimation(groupAnimators[key]);\n if (animationCfg) {\n cssAnimations.push(animationCfg);\n }\n }\n if (cssAnimations.length) {\n var className = scope.zrId + '-cls-' + scope.cssClassIdx++;\n scope.cssNodes['.' + className] = {\n animation: cssAnimations.join(',')\n };\n attrs[\"class\"] = className;\n }\n}\n","import { adjustTextY, getIdURL, getMatrixStr, getPathPrecision, getShadowKey, getSRTTransformString, hasShadow, isAroundZero, isGradient, isImagePattern, isLinearGradient, isPattern, isRadialGradient, normalizeColor, round4, TEXT_ALIGN_TO_ANCHOR } from './helper.js';\nimport Path from '../graphic/Path.js';\nimport ZRImage from '../graphic/Image.js';\nimport { getLineHeight } from '../contain/text.js';\nimport TSpan from '../graphic/TSpan.js';\nimport SVGPathRebuilder from './SVGPathRebuilder.js';\nimport mapStyleToAttrs from './mapStyleToAttrs.js';\nimport { createVNode, vNodeToString } from './core.js';\nimport { assert, isFunction, isString, logError, map, retrieve2 } from '../core/util.js';\nimport { createOrUpdateImage } from '../graphic/helper/image.js';\nimport { createCSSAnimation } from './cssAnimation.js';\nimport { hasSeparateFont, parseFontSize } from '../graphic/Text.js';\nimport { DEFAULT_FONT, DEFAULT_FONT_FAMILY } from '../core/platform.js';\nvar round = Math.round;\nfunction isImageLike(val) {\n return val && isString(val.src);\n}\nfunction isCanvasLike(val) {\n return val && isFunction(val.toDataURL);\n}\nfunction setStyleAttrs(attrs, style, el, scope) {\n mapStyleToAttrs(function (key, val) {\n var isFillStroke = key === 'fill' || key === 'stroke';\n if (isFillStroke && isGradient(val)) {\n setGradient(style, attrs, key, scope);\n }\n else if (isFillStroke && isPattern(val)) {\n setPattern(el, attrs, key, scope);\n }\n else {\n attrs[key] = val;\n }\n }, style, el, false);\n setShadow(el, attrs, scope);\n}\nfunction noRotateScale(m) {\n return isAroundZero(m[0] - 1)\n && isAroundZero(m[1])\n && isAroundZero(m[2])\n && isAroundZero(m[3] - 1);\n}\nfunction noTranslate(m) {\n return isAroundZero(m[4]) && isAroundZero(m[5]);\n}\nfunction setTransform(attrs, m, compress) {\n if (m && !(noTranslate(m) && noRotateScale(m))) {\n var mul = compress ? 10 : 1e4;\n attrs.transform = noRotateScale(m)\n ? \"translate(\" + round(m[4] * mul) / mul + \" \" + round(m[5] * mul) / mul + \")\" : getMatrixStr(m);\n }\n}\nfunction convertPolyShape(shape, attrs, mul) {\n var points = shape.points;\n var strArr = [];\n for (var i = 0; i < points.length; i++) {\n strArr.push(round(points[i][0] * mul) / mul);\n strArr.push(round(points[i][1] * mul) / mul);\n }\n attrs.points = strArr.join(' ');\n}\nfunction validatePolyShape(shape) {\n return !shape.smooth;\n}\nfunction createAttrsConvert(desc) {\n var normalizedDesc = map(desc, function (item) {\n return (typeof item === 'string' ? [item, item] : item);\n });\n return function (shape, attrs, mul) {\n for (var i = 0; i < normalizedDesc.length; i++) {\n var item = normalizedDesc[i];\n var val = shape[item[0]];\n if (val != null) {\n attrs[item[1]] = round(val * mul) / mul;\n }\n }\n };\n}\nvar buitinShapesDef = {\n circle: [createAttrsConvert(['cx', 'cy', 'r'])],\n polyline: [convertPolyShape, validatePolyShape],\n polygon: [convertPolyShape, validatePolyShape]\n};\nfunction hasShapeAnimation(el) {\n var animators = el.animators;\n for (var i = 0; i < animators.length; i++) {\n if (animators[i].targetName === 'shape') {\n return true;\n }\n }\n return false;\n}\nexport function brushSVGPath(el, scope) {\n var style = el.style;\n var shape = el.shape;\n var builtinShpDef = buitinShapesDef[el.type];\n var attrs = {};\n var needsAnimate = scope.animation;\n var svgElType = 'path';\n var strokePercent = el.style.strokePercent;\n var precision = (scope.compress && getPathPrecision(el)) || 4;\n if (builtinShpDef\n && !scope.willUpdate\n && !(builtinShpDef[1] && !builtinShpDef[1](shape))\n && !(needsAnimate && hasShapeAnimation(el))\n && !(strokePercent < 1)) {\n svgElType = el.type;\n var mul = Math.pow(10, precision);\n builtinShpDef[0](shape, attrs, mul);\n }\n else {\n if (!el.path) {\n el.createPathProxy();\n }\n var path = el.path;\n if (el.shapeChanged()) {\n path.beginPath();\n el.buildPath(path, el.shape);\n el.pathUpdated();\n }\n var pathVersion = path.getVersion();\n var elExt = el;\n var svgPathBuilder = elExt.__svgPathBuilder;\n if (elExt.__svgPathVersion !== pathVersion\n || !svgPathBuilder\n || strokePercent !== elExt.__svgPathStrokePercent) {\n if (!svgPathBuilder) {\n svgPathBuilder = elExt.__svgPathBuilder = new SVGPathRebuilder();\n }\n svgPathBuilder.reset(precision);\n path.rebuildPath(svgPathBuilder, strokePercent);\n svgPathBuilder.generateStr();\n elExt.__svgPathVersion = pathVersion;\n elExt.__svgPathStrokePercent = strokePercent;\n }\n attrs.d = svgPathBuilder.getStr();\n }\n setTransform(attrs, el.transform);\n setStyleAttrs(attrs, style, el, scope);\n scope.animation && createCSSAnimation(el, attrs, scope);\n return createVNode(svgElType, el.id + '', attrs);\n}\nexport function brushSVGImage(el, scope) {\n var style = el.style;\n var image = style.image;\n if (image && !isString(image)) {\n if (isImageLike(image)) {\n image = image.src;\n }\n else if (isCanvasLike(image)) {\n image = image.toDataURL();\n }\n }\n if (!image) {\n return;\n }\n var x = style.x || 0;\n var y = style.y || 0;\n var dw = style.width;\n var dh = style.height;\n var attrs = {\n href: image,\n width: dw,\n height: dh\n };\n if (x) {\n attrs.x = x;\n }\n if (y) {\n attrs.y = y;\n }\n setTransform(attrs, el.transform);\n setStyleAttrs(attrs, style, el, scope);\n scope.animation && createCSSAnimation(el, attrs, scope);\n return createVNode('image', el.id + '', attrs);\n}\n;\nexport function brushSVGTSpan(el, scope) {\n var style = el.style;\n var text = style.text;\n text != null && (text += '');\n if (!text || isNaN(style.x) || isNaN(style.y)) {\n return;\n }\n var font = style.font || DEFAULT_FONT;\n var x = style.x || 0;\n var y = adjustTextY(style.y || 0, getLineHeight(font), style.textBaseline);\n var textAlign = TEXT_ALIGN_TO_ANCHOR[style.textAlign]\n || style.textAlign;\n var attrs = {\n 'dominant-baseline': 'central',\n 'text-anchor': textAlign\n };\n if (hasSeparateFont(style)) {\n var separatedFontStr = '';\n var fontStyle = style.fontStyle;\n var fontSize = parseFontSize(style.fontSize);\n if (!parseFloat(fontSize)) {\n return;\n }\n var fontFamily = style.fontFamily || DEFAULT_FONT_FAMILY;\n var fontWeight = style.fontWeight;\n separatedFontStr += \"font-size:\" + fontSize + \";font-family:\" + fontFamily + \";\";\n if (fontStyle && fontStyle !== 'normal') {\n separatedFontStr += \"font-style:\" + fontStyle + \";\";\n }\n if (fontWeight && fontWeight !== 'normal') {\n separatedFontStr += \"font-weight:\" + fontWeight + \";\";\n }\n attrs.style = separatedFontStr;\n }\n else {\n attrs.style = \"font: \" + font;\n }\n if (text.match(/\\s/)) {\n attrs['xml:space'] = 'preserve';\n }\n if (x) {\n attrs.x = x;\n }\n if (y) {\n attrs.y = y;\n }\n setTransform(attrs, el.transform);\n setStyleAttrs(attrs, style, el, scope);\n scope.animation && createCSSAnimation(el, attrs, scope);\n return createVNode('text', el.id + '', attrs, undefined, text);\n}\nexport function brush(el, scope) {\n if (el instanceof Path) {\n return brushSVGPath(el, scope);\n }\n else if (el instanceof ZRImage) {\n return brushSVGImage(el, scope);\n }\n else if (el instanceof TSpan) {\n return brushSVGTSpan(el, scope);\n }\n}\nfunction setShadow(el, attrs, scope) {\n var style = el.style;\n if (hasShadow(style)) {\n var shadowKey = getShadowKey(el);\n var shadowCache = scope.shadowCache;\n var shadowId = shadowCache[shadowKey];\n if (!shadowId) {\n var globalScale = el.getGlobalScale();\n var scaleX = globalScale[0];\n var scaleY = globalScale[1];\n if (!scaleX || !scaleY) {\n return;\n }\n var offsetX = style.shadowOffsetX || 0;\n var offsetY = style.shadowOffsetY || 0;\n var blur_1 = style.shadowBlur;\n var _a = normalizeColor(style.shadowColor), opacity = _a.opacity, color = _a.color;\n var stdDx = blur_1 / 2 / scaleX;\n var stdDy = blur_1 / 2 / scaleY;\n var stdDeviation = stdDx + ' ' + stdDy;\n shadowId = scope.zrId + '-s' + scope.shadowIdx++;\n scope.defs[shadowId] = createVNode('filter', shadowId, {\n 'id': shadowId,\n 'x': '-100%',\n 'y': '-100%',\n 'width': '300%',\n 'height': '300%'\n }, [\n createVNode('feDropShadow', '', {\n 'dx': offsetX / scaleX,\n 'dy': offsetY / scaleY,\n 'stdDeviation': stdDeviation,\n 'flood-color': color,\n 'flood-opacity': opacity\n })\n ]);\n shadowCache[shadowKey] = shadowId;\n }\n attrs.filter = getIdURL(shadowId);\n }\n}\nfunction setGradient(style, attrs, target, scope) {\n var val = style[target];\n var gradientTag;\n var gradientAttrs = {\n 'gradientUnits': val.global\n ? 'userSpaceOnUse'\n : 'objectBoundingBox'\n };\n if (isLinearGradient(val)) {\n gradientTag = 'linearGradient';\n gradientAttrs.x1 = val.x;\n gradientAttrs.y1 = val.y;\n gradientAttrs.x2 = val.x2;\n gradientAttrs.y2 = val.y2;\n }\n else if (isRadialGradient(val)) {\n gradientTag = 'radialGradient';\n gradientAttrs.cx = retrieve2(val.x, 0.5);\n gradientAttrs.cy = retrieve2(val.y, 0.5);\n gradientAttrs.r = retrieve2(val.r, 0.5);\n }\n else {\n if (process.env.NODE_ENV !== 'production') {\n logError('Illegal gradient type.');\n }\n return;\n }\n var colors = val.colorStops;\n var colorStops = [];\n for (var i = 0, len = colors.length; i < len; ++i) {\n var offset = round4(colors[i].offset) * 100 + '%';\n var stopColor = colors[i].color;\n var _a = normalizeColor(stopColor), color = _a.color, opacity = _a.opacity;\n var stopsAttrs = {\n 'offset': offset\n };\n stopsAttrs['stop-color'] = color;\n if (opacity < 1) {\n stopsAttrs['stop-opacity'] = opacity;\n }\n colorStops.push(createVNode('stop', i + '', stopsAttrs));\n }\n var gradientVNode = createVNode(gradientTag, '', gradientAttrs, colorStops);\n var gradientKey = vNodeToString(gradientVNode);\n var gradientCache = scope.gradientCache;\n var gradientId = gradientCache[gradientKey];\n if (!gradientId) {\n gradientId = scope.zrId + '-g' + scope.gradientIdx++;\n gradientCache[gradientKey] = gradientId;\n gradientAttrs.id = gradientId;\n scope.defs[gradientId] = createVNode(gradientTag, gradientId, gradientAttrs, colorStops);\n }\n attrs[target] = getIdURL(gradientId);\n}\nfunction setPattern(el, attrs, target, scope) {\n var val = el.style[target];\n var patternAttrs = {\n 'patternUnits': 'userSpaceOnUse'\n };\n var child;\n if (isImagePattern(val)) {\n var imageWidth_1 = val.imageWidth;\n var imageHeight_1 = val.imageHeight;\n var imageSrc = void 0;\n var patternImage = val.image;\n if (isString(patternImage)) {\n imageSrc = patternImage;\n }\n else if (isImageLike(patternImage)) {\n imageSrc = patternImage.src;\n }\n else if (isCanvasLike(patternImage)) {\n imageSrc = patternImage.toDataURL();\n }\n if (typeof Image === 'undefined') {\n var errMsg = 'Image width/height must been given explictly in svg-ssr renderer.';\n assert(imageWidth_1, errMsg);\n assert(imageHeight_1, errMsg);\n }\n else if (imageWidth_1 == null || imageHeight_1 == null) {\n var setSizeToVNode_1 = function (vNode, img) {\n if (vNode) {\n var svgEl = vNode.elm;\n var width = (vNode.attrs.width = imageWidth_1 || img.width);\n var height = (vNode.attrs.height = imageHeight_1 || img.height);\n if (svgEl) {\n svgEl.setAttribute('width', width);\n svgEl.setAttribute('height', height);\n }\n }\n };\n var createdImage = createOrUpdateImage(imageSrc, null, el, function (img) {\n setSizeToVNode_1(patternVNode, img);\n setSizeToVNode_1(child, img);\n });\n if (createdImage && createdImage.width && createdImage.height) {\n imageWidth_1 = imageWidth_1 || createdImage.width;\n imageHeight_1 = imageHeight_1 || createdImage.height;\n }\n }\n child = createVNode('image', 'img', {\n href: imageSrc,\n width: imageWidth_1,\n height: imageHeight_1\n });\n patternAttrs.width = imageWidth_1;\n patternAttrs.height = imageHeight_1;\n }\n else if (val.svgElement) {\n child = val.svgElement;\n patternAttrs.width = val.svgWidth;\n patternAttrs.height = val.svgHeight;\n }\n if (!child) {\n return;\n }\n patternAttrs.patternTransform = getSRTTransformString(val);\n var patternVNode = createVNode('pattern', '', patternAttrs, [child]);\n var patternKey = vNodeToString(patternVNode);\n var patternCache = scope.patternCache;\n var patternId = patternCache[patternKey];\n if (!patternId) {\n patternId = scope.zrId + '-p' + scope.patternIdx++;\n patternCache[patternKey] = patternId;\n patternAttrs.id = patternId;\n patternVNode = scope.defs[patternId] = createVNode('pattern', patternId, patternAttrs, [child]);\n }\n attrs[target] = getIdURL(patternId);\n}\nexport function setClipPath(clipPath, attrs, scope) {\n var clipPathCache = scope.clipPathCache, defs = scope.defs;\n var clipPathId = clipPathCache[clipPath.id];\n if (!clipPathId) {\n clipPathId = scope.zrId + '-c' + scope.clipPathIdx++;\n var clipPathAttrs = {\n id: clipPathId\n };\n clipPathCache[clipPath.id] = clipPathId;\n defs[clipPathId] = createVNode('clipPath', clipPathId, clipPathAttrs, [brushSVGPath(clipPath, scope)]);\n }\n attrs['clip-path'] = getIdURL(clipPathId);\n}\n","export function createTextNode(text) {\n return document.createTextNode(text);\n}\nexport function createComment(text) {\n return document.createComment(text);\n}\nexport function insertBefore(parentNode, newNode, referenceNode) {\n parentNode.insertBefore(newNode, referenceNode);\n}\nexport function removeChild(node, child) {\n node.removeChild(child);\n}\nexport function appendChild(node, child) {\n node.appendChild(child);\n}\nexport function parentNode(node) {\n return node.parentNode;\n}\nexport function nextSibling(node) {\n return node.nextSibling;\n}\nexport function tagName(elm) {\n return elm.tagName;\n}\nexport function setTextContent(node, text) {\n node.textContent = text;\n}\nexport function getTextContent(node) {\n return node.textContent;\n}\nexport function isElement(node) {\n return node.nodeType === 1;\n}\nexport function isText(node) {\n return node.nodeType === 3;\n}\nexport function isComment(node) {\n return node.nodeType === 8;\n}\n","import { isArray, isObject } from '../core/util.js';\nimport { createElement, createVNode, XMLNS, XML_NAMESPACE, XLINKNS } from './core.js';\nimport * as api from './domapi.js';\nvar colonChar = 58;\nvar xChar = 120;\nvar emptyNode = createVNode('', '');\nfunction isUndef(s) {\n return s === undefined;\n}\nfunction isDef(s) {\n return s !== undefined;\n}\nfunction createKeyToOldIdx(children, beginIdx, endIdx) {\n var map = {};\n for (var i = beginIdx; i <= endIdx; ++i) {\n var key = children[i].key;\n if (key !== undefined) {\n if (process.env.NODE_ENV !== 'production') {\n if (map[key] != null) {\n console.error(\"Duplicate key \" + key);\n }\n }\n map[key] = i;\n }\n }\n return map;\n}\nfunction sameVnode(vnode1, vnode2) {\n var isSameKey = vnode1.key === vnode2.key;\n var isSameTag = vnode1.tag === vnode2.tag;\n return isSameTag && isSameKey;\n}\nfunction createElm(vnode) {\n var i;\n var children = vnode.children;\n var tag = vnode.tag;\n if (isDef(tag)) {\n var elm = (vnode.elm = createElement(tag));\n updateAttrs(emptyNode, vnode);\n if (isArray(children)) {\n for (i = 0; i < children.length; ++i) {\n var ch = children[i];\n if (ch != null) {\n api.appendChild(elm, createElm(ch));\n }\n }\n }\n else if (isDef(vnode.text) && !isObject(vnode.text)) {\n api.appendChild(elm, api.createTextNode(vnode.text));\n }\n }\n else {\n vnode.elm = api.createTextNode(vnode.text);\n }\n return vnode.elm;\n}\nfunction addVnodes(parentElm, before, vnodes, startIdx, endIdx) {\n for (; startIdx <= endIdx; ++startIdx) {\n var ch = vnodes[startIdx];\n if (ch != null) {\n api.insertBefore(parentElm, createElm(ch), before);\n }\n }\n}\nfunction removeVnodes(parentElm, vnodes, startIdx, endIdx) {\n for (; startIdx <= endIdx; ++startIdx) {\n var ch = vnodes[startIdx];\n if (ch != null) {\n if (isDef(ch.tag)) {\n var parent_1 = api.parentNode(ch.elm);\n api.removeChild(parent_1, ch.elm);\n }\n else {\n api.removeChild(parentElm, ch.elm);\n }\n }\n }\n}\nexport function updateAttrs(oldVnode, vnode) {\n var key;\n var elm = vnode.elm;\n var oldAttrs = oldVnode && oldVnode.attrs || {};\n var attrs = vnode.attrs || {};\n if (oldAttrs === attrs) {\n return;\n }\n for (key in attrs) {\n var cur = attrs[key];\n var old = oldAttrs[key];\n if (old !== cur) {\n if (cur === true) {\n elm.setAttribute(key, '');\n }\n else if (cur === false) {\n elm.removeAttribute(key);\n }\n else {\n if (key.charCodeAt(0) !== xChar) {\n elm.setAttribute(key, cur);\n }\n else if (key === 'xmlns:xlink' || key === 'xmlns') {\n elm.setAttributeNS(XMLNS, key, cur);\n }\n else if (key.charCodeAt(3) === colonChar) {\n elm.setAttributeNS(XML_NAMESPACE, key, cur);\n }\n else if (key.charCodeAt(5) === colonChar) {\n elm.setAttributeNS(XLINKNS, key, cur);\n }\n else {\n elm.setAttribute(key, cur);\n }\n }\n }\n }\n for (key in oldAttrs) {\n if (!(key in attrs)) {\n elm.removeAttribute(key);\n }\n }\n}\nfunction updateChildren(parentElm, oldCh, newCh) {\n var oldStartIdx = 0;\n var newStartIdx = 0;\n var oldEndIdx = oldCh.length - 1;\n var oldStartVnode = oldCh[0];\n var oldEndVnode = oldCh[oldEndIdx];\n var newEndIdx = newCh.length - 1;\n var newStartVnode = newCh[0];\n var newEndVnode = newCh[newEndIdx];\n var oldKeyToIdx;\n var idxInOld;\n var elmToMove;\n var before;\n while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {\n if (oldStartVnode == null) {\n oldStartVnode = oldCh[++oldStartIdx];\n }\n else if (oldEndVnode == null) {\n oldEndVnode = oldCh[--oldEndIdx];\n }\n else if (newStartVnode == null) {\n newStartVnode = newCh[++newStartIdx];\n }\n else if (newEndVnode == null) {\n newEndVnode = newCh[--newEndIdx];\n }\n else if (sameVnode(oldStartVnode, newStartVnode)) {\n patchVnode(oldStartVnode, newStartVnode);\n oldStartVnode = oldCh[++oldStartIdx];\n newStartVnode = newCh[++newStartIdx];\n }\n else if (sameVnode(oldEndVnode, newEndVnode)) {\n patchVnode(oldEndVnode, newEndVnode);\n oldEndVnode = oldCh[--oldEndIdx];\n newEndVnode = newCh[--newEndIdx];\n }\n else if (sameVnode(oldStartVnode, newEndVnode)) {\n patchVnode(oldStartVnode, newEndVnode);\n api.insertBefore(parentElm, oldStartVnode.elm, api.nextSibling(oldEndVnode.elm));\n oldStartVnode = oldCh[++oldStartIdx];\n newEndVnode = newCh[--newEndIdx];\n }\n else if (sameVnode(oldEndVnode, newStartVnode)) {\n patchVnode(oldEndVnode, newStartVnode);\n api.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);\n oldEndVnode = oldCh[--oldEndIdx];\n newStartVnode = newCh[++newStartIdx];\n }\n else {\n if (isUndef(oldKeyToIdx)) {\n oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx);\n }\n idxInOld = oldKeyToIdx[newStartVnode.key];\n if (isUndef(idxInOld)) {\n api.insertBefore(parentElm, createElm(newStartVnode), oldStartVnode.elm);\n }\n else {\n elmToMove = oldCh[idxInOld];\n if (elmToMove.tag !== newStartVnode.tag) {\n api.insertBefore(parentElm, createElm(newStartVnode), oldStartVnode.elm);\n }\n else {\n patchVnode(elmToMove, newStartVnode);\n oldCh[idxInOld] = undefined;\n api.insertBefore(parentElm, elmToMove.elm, oldStartVnode.elm);\n }\n }\n newStartVnode = newCh[++newStartIdx];\n }\n }\n if (oldStartIdx <= oldEndIdx || newStartIdx <= newEndIdx) {\n if (oldStartIdx > oldEndIdx) {\n before = newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].elm;\n addVnodes(parentElm, before, newCh, newStartIdx, newEndIdx);\n }\n else {\n removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);\n }\n }\n}\nfunction patchVnode(oldVnode, vnode) {\n var elm = (vnode.elm = oldVnode.elm);\n var oldCh = oldVnode.children;\n var ch = vnode.children;\n if (oldVnode === vnode) {\n return;\n }\n updateAttrs(oldVnode, vnode);\n if (isUndef(vnode.text)) {\n if (isDef(oldCh) && isDef(ch)) {\n if (oldCh !== ch) {\n updateChildren(elm, oldCh, ch);\n }\n }\n else if (isDef(ch)) {\n if (isDef(oldVnode.text)) {\n api.setTextContent(elm, '');\n }\n addVnodes(elm, null, ch, 0, ch.length - 1);\n }\n else if (isDef(oldCh)) {\n removeVnodes(elm, oldCh, 0, oldCh.length - 1);\n }\n else if (isDef(oldVnode.text)) {\n api.setTextContent(elm, '');\n }\n }\n else if (oldVnode.text !== vnode.text) {\n if (isDef(oldCh)) {\n removeVnodes(elm, oldCh, 0, oldCh.length - 1);\n }\n api.setTextContent(elm, vnode.text);\n }\n}\nexport default function patch(oldVnode, vnode) {\n if (sameVnode(oldVnode, vnode)) {\n patchVnode(oldVnode, vnode);\n }\n else {\n var elm = oldVnode.elm;\n var parent_2 = api.parentNode(elm);\n createElm(vnode);\n if (parent_2 !== null) {\n api.insertBefore(parent_2, vnode.elm, api.nextSibling(elm));\n removeVnodes(parent_2, [oldVnode], 0, 0);\n }\n }\n return vnode;\n}\n","import { brush, setClipPath } from './graphic.js';\nimport { createElement, createVNode, vNodeToString, getCssString, createBrushScope, createSVGVNode } from './core.js';\nimport { normalizeColor, encodeBase64 } from './helper.js';\nimport { extend, keys, logError, map, retrieve2 } from '../core/util.js';\nimport patch, { updateAttrs } from './patch.js';\nimport { getSize } from '../canvas/helper.js';\nvar svgId = 0;\nvar SVGPainter = (function () {\n function SVGPainter(root, storage, opts) {\n this.type = 'svg';\n this.refreshHover = createMethodNotSupport('refreshHover');\n this.configLayer = createMethodNotSupport('configLayer');\n this.storage = storage;\n this._opts = opts = extend({}, opts);\n this.root = root;\n this._id = 'zr' + svgId++;\n this._oldVNode = createSVGVNode(opts.width, opts.height);\n if (root && !opts.ssr) {\n var viewport = this._viewport = document.createElement('div');\n viewport.style.cssText = 'position:relative;overflow:hidden';\n var svgDom = this._svgDom = this._oldVNode.elm = createElement('svg');\n updateAttrs(null, this._oldVNode);\n viewport.appendChild(svgDom);\n root.appendChild(viewport);\n }\n this.resize(opts.width, opts.height);\n }\n SVGPainter.prototype.getType = function () {\n return this.type;\n };\n SVGPainter.prototype.getViewportRoot = function () {\n return this._viewport;\n };\n SVGPainter.prototype.getViewportRootOffset = function () {\n var viewportRoot = this.getViewportRoot();\n if (viewportRoot) {\n return {\n offsetLeft: viewportRoot.offsetLeft || 0,\n offsetTop: viewportRoot.offsetTop || 0\n };\n }\n };\n SVGPainter.prototype.getSvgDom = function () {\n return this._svgDom;\n };\n SVGPainter.prototype.refresh = function () {\n if (this.root) {\n var vnode = this.renderToVNode({\n willUpdate: true\n });\n vnode.attrs.style = 'position:absolute;left:0;top:0;user-select:none';\n patch(this._oldVNode, vnode);\n this._oldVNode = vnode;\n }\n };\n SVGPainter.prototype.renderOneToVNode = function (el) {\n return brush(el, createBrushScope(this._id));\n };\n SVGPainter.prototype.renderToVNode = function (opts) {\n opts = opts || {};\n var list = this.storage.getDisplayList(true);\n var bgColor = this._backgroundColor;\n var width = this._width;\n var height = this._height;\n var scope = createBrushScope(this._id);\n scope.animation = opts.animation;\n scope.willUpdate = opts.willUpdate;\n scope.compress = opts.compress;\n var children = [];\n if (bgColor && bgColor !== 'none') {\n var _a = normalizeColor(bgColor), color = _a.color, opacity = _a.opacity;\n this._bgVNode = createVNode('rect', 'bg', {\n width: width,\n height: height,\n x: '0',\n y: '0',\n id: '0',\n fill: color,\n 'fill-opacity': opacity\n });\n children.push(this._bgVNode);\n }\n else {\n this._bgVNode = null;\n }\n var mainVNode = !opts.compress\n ? (this._mainVNode = createVNode('g', 'main', {}, [])) : null;\n this._paintList(list, scope, mainVNode ? mainVNode.children : children);\n mainVNode && children.push(mainVNode);\n var defs = map(keys(scope.defs), function (id) { return scope.defs[id]; });\n if (defs.length) {\n children.push(createVNode('defs', 'defs', {}, defs));\n }\n if (opts.animation) {\n var animationCssStr = getCssString(scope.cssNodes, scope.cssAnims, { newline: true });\n if (animationCssStr) {\n var styleNode = createVNode('style', 'stl', {}, [], animationCssStr);\n children.push(styleNode);\n }\n }\n return createSVGVNode(width, height, children, opts.useViewBox);\n };\n SVGPainter.prototype.renderToString = function (opts) {\n opts = opts || {};\n return vNodeToString(this.renderToVNode({\n animation: retrieve2(opts.cssAnimation, true),\n willUpdate: false,\n compress: true,\n useViewBox: retrieve2(opts.useViewBox, true)\n }), { newline: true });\n };\n SVGPainter.prototype.setBackgroundColor = function (backgroundColor) {\n this._backgroundColor = backgroundColor;\n var bgVNode = this._bgVNode;\n if (bgVNode && bgVNode.elm) {\n var _a = normalizeColor(backgroundColor), color = _a.color, opacity = _a.opacity;\n bgVNode.elm.setAttribute('fill', color);\n if (opacity < 1) {\n bgVNode.elm.setAttribute('fill-opacity', opacity);\n }\n }\n };\n SVGPainter.prototype.getSvgRoot = function () {\n return this._mainVNode && this._mainVNode.elm;\n };\n SVGPainter.prototype._paintList = function (list, scope, out) {\n var listLen = list.length;\n var clipPathsGroupsStack = [];\n var clipPathsGroupsStackDepth = 0;\n var currentClipPathGroup;\n var prevClipPaths;\n var clipGroupNodeIdx = 0;\n for (var i = 0; i < listLen; i++) {\n var displayable = list[i];\n if (!displayable.invisible) {\n var clipPaths = displayable.__clipPaths;\n var len = clipPaths && clipPaths.length || 0;\n var prevLen = prevClipPaths && prevClipPaths.length || 0;\n var lca = void 0;\n for (lca = Math.max(len - 1, prevLen - 1); lca >= 0; lca--) {\n if (clipPaths && prevClipPaths\n && clipPaths[lca] === prevClipPaths[lca]) {\n break;\n }\n }\n for (var i_1 = prevLen - 1; i_1 > lca; i_1--) {\n clipPathsGroupsStackDepth--;\n currentClipPathGroup = clipPathsGroupsStack[clipPathsGroupsStackDepth - 1];\n }\n for (var i_2 = lca + 1; i_2 < len; i_2++) {\n var groupAttrs = {};\n setClipPath(clipPaths[i_2], groupAttrs, scope);\n var g = createVNode('g', 'clip-g-' + clipGroupNodeIdx++, groupAttrs, []);\n (currentClipPathGroup ? currentClipPathGroup.children : out).push(g);\n clipPathsGroupsStack[clipPathsGroupsStackDepth++] = g;\n currentClipPathGroup = g;\n }\n prevClipPaths = clipPaths;\n var ret = brush(displayable, scope);\n if (ret) {\n (currentClipPathGroup ? currentClipPathGroup.children : out).push(ret);\n }\n }\n }\n };\n SVGPainter.prototype.resize = function (width, height) {\n var opts = this._opts;\n var root = this.root;\n var viewport = this._viewport;\n width != null && (opts.width = width);\n height != null && (opts.height = height);\n if (root && viewport) {\n viewport.style.display = 'none';\n width = getSize(root, 0, opts);\n height = getSize(root, 1, opts);\n viewport.style.display = '';\n }\n if (this._width !== width || this._height !== height) {\n this._width = width;\n this._height = height;\n if (viewport) {\n var viewportStyle = viewport.style;\n viewportStyle.width = width + 'px';\n viewportStyle.height = height + 'px';\n }\n var svgDom = this._svgDom;\n if (svgDom) {\n svgDom.setAttribute('width', width);\n svgDom.setAttribute('height', height);\n }\n }\n };\n SVGPainter.prototype.getWidth = function () {\n return this._width;\n };\n SVGPainter.prototype.getHeight = function () {\n return this._height;\n };\n SVGPainter.prototype.dispose = function () {\n if (this.root) {\n this.root.innerHTML = '';\n }\n this._svgDom =\n this._viewport =\n this.storage =\n this._oldVNode =\n this._bgVNode =\n this._mainVNode = null;\n };\n SVGPainter.prototype.clear = function () {\n if (this._svgDom) {\n this._svgDom.innerHTML = null;\n }\n this._oldVNode = null;\n };\n SVGPainter.prototype.toDataURL = function (base64) {\n var str = encodeURIComponent(this.renderToString());\n var prefix = 'data:image/svg+xml;';\n if (base64) {\n str = encodeBase64(str);\n return str && prefix + 'base64,' + str;\n }\n return prefix + 'charset=UTF-8,' + str;\n };\n return SVGPainter;\n}());\nfunction createMethodNotSupport(method) {\n return function () {\n if (process.env.NODE_ENV !== 'production') {\n logError('In SVG mode painter not support method \"' + method + '\"');\n }\n };\n}\nexport default SVGPainter;\n","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport SVGPainter from 'zrender/lib/svg/Painter.js';\nexport function install(registers) {\n registers.registerPainter('svg', SVGPainter);\n}","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nfunction dataIndexMapValueLength(valNumOrArrLengthMoreThan2) {\n return valNumOrArrLengthMoreThan2 == null ? 0 : valNumOrArrLengthMoreThan2.length || 1;\n}\n\nfunction defaultKeyGetter(item) {\n return item;\n}\n\nvar DataDiffer =\n/** @class */\nfunction () {\n /**\n * @param context Can be visited by this.context in callback.\n */\n function DataDiffer(oldArr, newArr, oldKeyGetter, newKeyGetter, context, // By default: 'oneToOne'.\n diffMode) {\n this._old = oldArr;\n this._new = newArr;\n this._oldKeyGetter = oldKeyGetter || defaultKeyGetter;\n this._newKeyGetter = newKeyGetter || defaultKeyGetter; // Visible in callback via `this.context`;\n\n this.context = context;\n this._diffModeMultiple = diffMode === 'multiple';\n }\n /**\n * Callback function when add a data\n */\n\n\n DataDiffer.prototype.add = function (func) {\n this._add = func;\n return this;\n };\n /**\n * Callback function when update a data\n */\n\n\n DataDiffer.prototype.update = function (func) {\n this._update = func;\n return this;\n };\n /**\n * Callback function when update a data and only work in `cbMode: 'byKey'`.\n */\n\n\n DataDiffer.prototype.updateManyToOne = function (func) {\n this._updateManyToOne = func;\n return this;\n };\n /**\n * Callback function when update a data and only work in `cbMode: 'byKey'`.\n */\n\n\n DataDiffer.prototype.updateOneToMany = function (func) {\n this._updateOneToMany = func;\n return this;\n };\n /**\n * Callback function when update a data and only work in `cbMode: 'byKey'`.\n */\n\n\n DataDiffer.prototype.updateManyToMany = function (func) {\n this._updateManyToMany = func;\n return this;\n };\n /**\n * Callback function when remove a data\n */\n\n\n DataDiffer.prototype.remove = function (func) {\n this._remove = func;\n return this;\n };\n\n DataDiffer.prototype.execute = function () {\n this[this._diffModeMultiple ? '_executeMultiple' : '_executeOneToOne']();\n };\n\n DataDiffer.prototype._executeOneToOne = function () {\n var oldArr = this._old;\n var newArr = this._new;\n var newDataIndexMap = {};\n var oldDataKeyArr = new Array(oldArr.length);\n var newDataKeyArr = new Array(newArr.length);\n\n this._initIndexMap(oldArr, null, oldDataKeyArr, '_oldKeyGetter');\n\n this._initIndexMap(newArr, newDataIndexMap, newDataKeyArr, '_newKeyGetter');\n\n for (var i = 0; i < oldArr.length; i++) {\n var oldKey = oldDataKeyArr[i];\n var newIdxMapVal = newDataIndexMap[oldKey];\n var newIdxMapValLen = dataIndexMapValueLength(newIdxMapVal); // idx can never be empty array here. see 'set null' logic below.\n\n if (newIdxMapValLen > 1) {\n // Consider there is duplicate key (for example, use dataItem.name as key).\n // We should make sure every item in newArr and oldArr can be visited.\n var newIdx = newIdxMapVal.shift();\n\n if (newIdxMapVal.length === 1) {\n newDataIndexMap[oldKey] = newIdxMapVal[0];\n }\n\n this._update && this._update(newIdx, i);\n } else if (newIdxMapValLen === 1) {\n newDataIndexMap[oldKey] = null;\n this._update && this._update(newIdxMapVal, i);\n } else {\n this._remove && this._remove(i);\n }\n }\n\n this._performRestAdd(newDataKeyArr, newDataIndexMap);\n };\n /**\n * For example, consider the case:\n * oldData: [o0, o1, o2, o3, o4, o5, o6, o7],\n * newData: [n0, n1, n2, n3, n4, n5, n6, n7, n8],\n * Where:\n * o0, o1, n0 has key 'a' (many to one)\n * o5, n4, n5, n6 has key 'b' (one to many)\n * o2, n1 has key 'c' (one to one)\n * n2, n3 has key 'd' (add)\n * o3, o4 has key 'e' (remove)\n * o6, o7, n7, n8 has key 'f' (many to many, treated as add and remove)\n * Then:\n * (The order of the following directives are not ensured.)\n * this._updateManyToOne(n0, [o0, o1]);\n * this._updateOneToMany([n4, n5, n6], o5);\n * this._update(n1, o2);\n * this._remove(o3);\n * this._remove(o4);\n * this._remove(o6);\n * this._remove(o7);\n * this._add(n2);\n * this._add(n3);\n * this._add(n7);\n * this._add(n8);\n */\n\n\n DataDiffer.prototype._executeMultiple = function () {\n var oldArr = this._old;\n var newArr = this._new;\n var oldDataIndexMap = {};\n var newDataIndexMap = {};\n var oldDataKeyArr = [];\n var newDataKeyArr = [];\n\n this._initIndexMap(oldArr, oldDataIndexMap, oldDataKeyArr, '_oldKeyGetter');\n\n this._initIndexMap(newArr, newDataIndexMap, newDataKeyArr, '_newKeyGetter');\n\n for (var i = 0; i < oldDataKeyArr.length; i++) {\n var oldKey = oldDataKeyArr[i];\n var oldIdxMapVal = oldDataIndexMap[oldKey];\n var newIdxMapVal = newDataIndexMap[oldKey];\n var oldIdxMapValLen = dataIndexMapValueLength(oldIdxMapVal);\n var newIdxMapValLen = dataIndexMapValueLength(newIdxMapVal);\n\n if (oldIdxMapValLen > 1 && newIdxMapValLen === 1) {\n this._updateManyToOne && this._updateManyToOne(newIdxMapVal, oldIdxMapVal);\n newDataIndexMap[oldKey] = null;\n } else if (oldIdxMapValLen === 1 && newIdxMapValLen > 1) {\n this._updateOneToMany && this._updateOneToMany(newIdxMapVal, oldIdxMapVal);\n newDataIndexMap[oldKey] = null;\n } else if (oldIdxMapValLen === 1 && newIdxMapValLen === 1) {\n this._update && this._update(newIdxMapVal, oldIdxMapVal);\n newDataIndexMap[oldKey] = null;\n } else if (oldIdxMapValLen > 1 && newIdxMapValLen > 1) {\n this._updateManyToMany && this._updateManyToMany(newIdxMapVal, oldIdxMapVal);\n newDataIndexMap[oldKey] = null;\n } else if (oldIdxMapValLen > 1) {\n for (var i_1 = 0; i_1 < oldIdxMapValLen; i_1++) {\n this._remove && this._remove(oldIdxMapVal[i_1]);\n }\n } else {\n this._remove && this._remove(oldIdxMapVal);\n }\n }\n\n this._performRestAdd(newDataKeyArr, newDataIndexMap);\n };\n\n DataDiffer.prototype._performRestAdd = function (newDataKeyArr, newDataIndexMap) {\n for (var i = 0; i < newDataKeyArr.length; i++) {\n var newKey = newDataKeyArr[i];\n var newIdxMapVal = newDataIndexMap[newKey];\n var idxMapValLen = dataIndexMapValueLength(newIdxMapVal);\n\n if (idxMapValLen > 1) {\n for (var j = 0; j < idxMapValLen; j++) {\n this._add && this._add(newIdxMapVal[j]);\n }\n } else if (idxMapValLen === 1) {\n this._add && this._add(newIdxMapVal);\n } // Support both `newDataKeyArr` are duplication removed or not removed.\n\n\n newDataIndexMap[newKey] = null;\n }\n };\n\n DataDiffer.prototype._initIndexMap = function (arr, // Can be null.\n map, // In 'byKey', the output `keyArr` is duplication removed.\n // In 'byIndex', the output `keyArr` is not duplication removed and\n // its indices are accurately corresponding to `arr`.\n keyArr, keyGetterName) {\n var cbModeMultiple = this._diffModeMultiple;\n\n for (var i = 0; i < arr.length; i++) {\n // Add prefix to avoid conflict with Object.prototype.\n var key = '_ec_' + this[keyGetterName](arr[i], i);\n\n if (!cbModeMultiple) {\n keyArr[i] = key;\n }\n\n if (!map) {\n continue;\n }\n\n var idxMapVal = map[key];\n var idxMapValLen = dataIndexMapValueLength(idxMapVal);\n\n if (idxMapValLen === 0) {\n // Simple optimize: in most cases, one index has one key,\n // do not need array.\n map[key] = i;\n\n if (cbModeMultiple) {\n keyArr.push(key);\n }\n } else if (idxMapValLen === 1) {\n map[key] = [idxMapVal, i];\n } else {\n idxMapVal.push(i);\n }\n }\n };\n\n return DataDiffer;\n}();\n\nexport default DataDiffer;","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { each, createHashMap, assert, map } from 'zrender/lib/core/util.js';\nimport { VISUAL_DIMENSIONS } from '../../util/types.js';\n\nvar DimensionUserOuput =\n/** @class */\nfunction () {\n function DimensionUserOuput(encode, dimRequest) {\n this._encode = encode;\n this._schema = dimRequest;\n }\n\n DimensionUserOuput.prototype.get = function () {\n return {\n // Do not generate full dimension name until fist used.\n fullDimensions: this._getFullDimensionNames(),\n encode: this._encode\n };\n };\n /**\n * Get all data store dimension names.\n * Theoretically a series data store is defined both by series and used dataset (if any).\n * If some dimensions are omitted for performance reason in `this.dimensions`,\n * the dimension name may not be auto-generated if user does not specify a dimension name.\n * In this case, the dimension name is `null`/`undefined`.\n */\n\n\n DimensionUserOuput.prototype._getFullDimensionNames = function () {\n if (!this._cachedDimNames) {\n this._cachedDimNames = this._schema ? this._schema.makeOutputDimensionNames() : [];\n }\n\n return this._cachedDimNames;\n };\n\n return DimensionUserOuput;\n}();\n\n;\nexport function summarizeDimensions(data, schema) {\n var summary = {};\n var encode = summary.encode = {};\n var notExtraCoordDimMap = createHashMap();\n var defaultedLabel = [];\n var defaultedTooltip = [];\n var userOutputEncode = {};\n each(data.dimensions, function (dimName) {\n var dimItem = data.getDimensionInfo(dimName);\n var coordDim = dimItem.coordDim;\n\n if (coordDim) {\n if (process.env.NODE_ENV !== 'production') {\n assert(VISUAL_DIMENSIONS.get(coordDim) == null);\n }\n\n var coordDimIndex = dimItem.coordDimIndex;\n getOrCreateEncodeArr(encode, coordDim)[coordDimIndex] = dimName;\n\n if (!dimItem.isExtraCoord) {\n notExtraCoordDimMap.set(coordDim, 1); // Use the last coord dim (and label friendly) as default label,\n // because when dataset is used, it is hard to guess which dimension\n // can be value dimension. If both show x, y on label is not look good,\n // and conventionally y axis is focused more.\n\n if (mayLabelDimType(dimItem.type)) {\n defaultedLabel[0] = dimName;\n } // User output encode do not contain generated coords.\n // And it only has index. User can use index to retrieve value from the raw item array.\n\n\n getOrCreateEncodeArr(userOutputEncode, coordDim)[coordDimIndex] = data.getDimensionIndex(dimItem.name);\n }\n\n if (dimItem.defaultTooltip) {\n defaultedTooltip.push(dimName);\n }\n }\n\n VISUAL_DIMENSIONS.each(function (v, otherDim) {\n var encodeArr = getOrCreateEncodeArr(encode, otherDim);\n var dimIndex = dimItem.otherDims[otherDim];\n\n if (dimIndex != null && dimIndex !== false) {\n encodeArr[dimIndex] = dimItem.name;\n }\n });\n });\n var dataDimsOnCoord = [];\n var encodeFirstDimNotExtra = {};\n notExtraCoordDimMap.each(function (v, coordDim) {\n var dimArr = encode[coordDim];\n encodeFirstDimNotExtra[coordDim] = dimArr[0]; // Not necessary to remove duplicate, because a data\n // dim canot on more than one coordDim.\n\n dataDimsOnCoord = dataDimsOnCoord.concat(dimArr);\n });\n summary.dataDimsOnCoord = dataDimsOnCoord;\n summary.dataDimIndicesOnCoord = map(dataDimsOnCoord, function (dimName) {\n return data.getDimensionInfo(dimName).storeDimIndex;\n });\n summary.encodeFirstDimNotExtra = encodeFirstDimNotExtra;\n var encodeLabel = encode.label; // FIXME `encode.label` is not recommanded, because formatter can not be set\n // in this way. Use label.formatter instead. May be remove this approach someday.\n\n if (encodeLabel && encodeLabel.length) {\n defaultedLabel = encodeLabel.slice();\n }\n\n var encodeTooltip = encode.tooltip;\n\n if (encodeTooltip && encodeTooltip.length) {\n defaultedTooltip = encodeTooltip.slice();\n } else if (!defaultedTooltip.length) {\n defaultedTooltip = defaultedLabel.slice();\n }\n\n encode.defaultedLabel = defaultedLabel;\n encode.defaultedTooltip = defaultedTooltip;\n summary.userOutput = new DimensionUserOuput(userOutputEncode, schema);\n return summary;\n}\n\nfunction getOrCreateEncodeArr(encode, dim) {\n if (!encode.hasOwnProperty(dim)) {\n encode[dim] = [];\n }\n\n return encode[dim];\n} // FIXME:TS should be type `AxisType`\n\n\nexport function getDimensionTypeByAxis(axisType) {\n return axisType === 'category' ? 'ordinal' : axisType === 'time' ? 'time' : 'float';\n}\n\nfunction mayLabelDimType(dimType) {\n // In most cases, ordinal and time do not suitable for label.\n // Ordinal info can be displayed on axis. Time is too long.\n return !(dimType === 'ordinal' || dimType === 'time');\n} // function findTheLastDimMayLabel(data) {\n// // Get last value dim\n// let dimensions = data.dimensions.slice();\n// let valueType;\n// let valueDim;\n// while (dimensions.length && (\n// valueDim = dimensions.pop(),\n// valueType = data.getDimensionInfo(valueDim).type,\n// valueType === 'ordinal' || valueType === 'time'\n// )) {} // jshint ignore:line\n// return valueDim;\n// }","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport * as zrUtil from 'zrender/lib/core/util.js';\n\nvar SeriesDimensionDefine =\n/** @class */\nfunction () {\n /**\n * @param opt All of the fields will be shallow copied.\n */\n function SeriesDimensionDefine(opt) {\n /**\n * The format of `otherDims` is:\n * ```js\n * {\n * tooltip?: number\n * label?: number\n * itemName?: number\n * seriesName?: number\n * }\n * ```\n *\n * A `series.encode` can specified these fields:\n * ```js\n * encode: {\n * // \"3, 1, 5\" is the index of data dimension.\n * tooltip: [3, 1, 5],\n * label: [0, 3],\n * ...\n * }\n * ```\n * `otherDims` is the parse result of the `series.encode` above, like:\n * ```js\n * // Suppose the index of this data dimension is `3`.\n * this.otherDims = {\n * // `3` is at the index `0` of the `encode.tooltip`\n * tooltip: 0,\n * // `3` is at the index `1` of the `encode.label`\n * label: 1\n * };\n * ```\n *\n * This prop should never be `null`/`undefined` after initialized.\n */\n this.otherDims = {};\n\n if (opt != null) {\n zrUtil.extend(this, opt);\n }\n }\n\n return SeriesDimensionDefine;\n}();\n\n;\nexport default SeriesDimensionDefine;","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { createHashMap, isObject, retrieve2 } from 'zrender/lib/core/util.js';\nimport { makeInner } from '../../util/model.js';\nimport { shouldRetrieveDataByName } from '../Source.js';\nvar inner = makeInner();\nvar dimTypeShort = {\n float: 'f',\n int: 'i',\n ordinal: 'o',\n number: 'n',\n time: 't'\n};\n/**\n * Represents the dimension requirement of a series.\n *\n * NOTICE:\n * When there are too many dimensions in dataset and many series, only the used dimensions\n * (i.e., used by coord sys and declared in `series.encode`) are add to `dimensionDefineList`.\n * But users may query data by other unused dimension names.\n * In this case, users can only query data if and only if they have defined dimension names\n * via ec option, so we provide `getDimensionIndexFromSource`, which only query them from\n * `source` dimensions.\n */\n\nvar SeriesDataSchema =\n/** @class */\nfunction () {\n function SeriesDataSchema(opt) {\n this.dimensions = opt.dimensions;\n this._dimOmitted = opt.dimensionOmitted;\n this.source = opt.source;\n this._fullDimCount = opt.fullDimensionCount;\n\n this._updateDimOmitted(opt.dimensionOmitted);\n }\n\n SeriesDataSchema.prototype.isDimensionOmitted = function () {\n return this._dimOmitted;\n };\n\n SeriesDataSchema.prototype._updateDimOmitted = function (dimensionOmitted) {\n this._dimOmitted = dimensionOmitted;\n\n if (!dimensionOmitted) {\n return;\n }\n\n if (!this._dimNameMap) {\n this._dimNameMap = ensureSourceDimNameMap(this.source);\n }\n };\n /**\n * @caution Can only be used when `dimensionOmitted: true`.\n *\n * Get index by user defined dimension name (i.e., not internal generate name).\n * That is, get index from `dimensionsDefine`.\n * If no `dimensionsDefine`, or no name get, return -1.\n */\n\n\n SeriesDataSchema.prototype.getSourceDimensionIndex = function (dimName) {\n return retrieve2(this._dimNameMap.get(dimName), -1);\n };\n /**\n * @caution Can only be used when `dimensionOmitted: true`.\n *\n * Notice: may return `null`/`undefined` if user not specify dimension names.\n */\n\n\n SeriesDataSchema.prototype.getSourceDimension = function (dimIndex) {\n var dimensionsDefine = this.source.dimensionsDefine;\n\n if (dimensionsDefine) {\n return dimensionsDefine[dimIndex];\n }\n };\n\n SeriesDataSchema.prototype.makeStoreSchema = function () {\n var dimCount = this._fullDimCount;\n var willRetrieveDataByName = shouldRetrieveDataByName(this.source);\n var makeHashStrict = !shouldOmitUnusedDimensions(dimCount); // If source don't have dimensions or series don't omit unsed dimensions.\n // Generate from seriesDimList directly\n\n var dimHash = '';\n var dims = [];\n\n for (var fullDimIdx = 0, seriesDimIdx = 0; fullDimIdx < dimCount; fullDimIdx++) {\n var property = void 0;\n var type = void 0;\n var ordinalMeta = void 0;\n var seriesDimDef = this.dimensions[seriesDimIdx]; // The list has been sorted by `storeDimIndex` asc.\n\n if (seriesDimDef && seriesDimDef.storeDimIndex === fullDimIdx) {\n property = willRetrieveDataByName ? seriesDimDef.name : null;\n type = seriesDimDef.type;\n ordinalMeta = seriesDimDef.ordinalMeta;\n seriesDimIdx++;\n } else {\n var sourceDimDef = this.getSourceDimension(fullDimIdx);\n\n if (sourceDimDef) {\n property = willRetrieveDataByName ? sourceDimDef.name : null;\n type = sourceDimDef.type;\n }\n }\n\n dims.push({\n property: property,\n type: type,\n ordinalMeta: ordinalMeta\n }); // If retrieving data by index,\n // use to determine whether data can be shared.\n // (Becuase in this case there might be no dimension name defined in dataset, but indices always exists).\n // (indices are always 0, 1, 2, ..., so we can ignore them to shorten the hash).\n // Otherwise if retrieving data by property name (like `data: [{aa: 123, bb: 765}, ...]`),\n // use in hash.\n\n if (willRetrieveDataByName && property != null // For data stack, we have make sure each series has its own dim on this store.\n // So we do not add property to hash to make sure they can share this store.\n && (!seriesDimDef || !seriesDimDef.isCalculationCoord)) {\n dimHash += makeHashStrict // Use escape character '`' in case that property name contains '$'.\n ? property.replace(/\\`/g, '`1').replace(/\\$/g, '`2') // For better performance, when there are large dimensions, tolerant this defects that hardly meet.\n : property;\n }\n\n dimHash += '$';\n dimHash += dimTypeShort[type] || 'f';\n\n if (ordinalMeta) {\n dimHash += ordinalMeta.uid;\n }\n\n dimHash += '$';\n } // Source from endpoint(usually series) will be read differently\n // when seriesLayoutBy or startIndex(which is affected by sourceHeader) are different.\n // So we use this three props as key.\n\n\n var source = this.source;\n var hash = [source.seriesLayoutBy, source.startIndex, dimHash].join('$$');\n return {\n dimensions: dims,\n hash: hash\n };\n };\n\n SeriesDataSchema.prototype.makeOutputDimensionNames = function () {\n var result = [];\n\n for (var fullDimIdx = 0, seriesDimIdx = 0; fullDimIdx < this._fullDimCount; fullDimIdx++) {\n var name_1 = void 0;\n var seriesDimDef = this.dimensions[seriesDimIdx]; // The list has been sorted by `storeDimIndex` asc.\n\n if (seriesDimDef && seriesDimDef.storeDimIndex === fullDimIdx) {\n if (!seriesDimDef.isCalculationCoord) {\n name_1 = seriesDimDef.name;\n }\n\n seriesDimIdx++;\n } else {\n var sourceDimDef = this.getSourceDimension(fullDimIdx);\n\n if (sourceDimDef) {\n name_1 = sourceDimDef.name;\n }\n }\n\n result.push(name_1);\n }\n\n return result;\n };\n\n SeriesDataSchema.prototype.appendCalculationDimension = function (dimDef) {\n this.dimensions.push(dimDef);\n dimDef.isCalculationCoord = true;\n this._fullDimCount++; // If append dimension on a data store, consider the store\n // might be shared by different series, series dimensions not\n // really map to store dimensions.\n\n this._updateDimOmitted(true);\n };\n\n return SeriesDataSchema;\n}();\n\nexport { SeriesDataSchema };\nexport function isSeriesDataSchema(schema) {\n return schema instanceof SeriesDataSchema;\n}\nexport function createDimNameMap(dimsDef) {\n var dataDimNameMap = createHashMap();\n\n for (var i = 0; i < (dimsDef || []).length; i++) {\n var dimDefItemRaw = dimsDef[i];\n var userDimName = isObject(dimDefItemRaw) ? dimDefItemRaw.name : dimDefItemRaw;\n\n if (userDimName != null && dataDimNameMap.get(userDimName) == null) {\n dataDimNameMap.set(userDimName, i);\n }\n }\n\n return dataDimNameMap;\n}\nexport function ensureSourceDimNameMap(source) {\n var innerSource = inner(source);\n return innerSource.dimNameMap || (innerSource.dimNameMap = createDimNameMap(source.dimensionsDefine));\n}\nexport function shouldOmitUnusedDimensions(dimCount) {\n return dimCount > 30;\n}","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n/* global Int32Array */\nimport * as zrUtil from 'zrender/lib/core/util.js';\nimport Model from '../model/Model.js';\nimport DataDiffer from './DataDiffer.js';\nimport { DefaultDataProvider } from './helper/dataProvider.js';\nimport { summarizeDimensions } from './helper/dimensionHelper.js';\nimport SeriesDimensionDefine from './SeriesDimensionDefine.js';\nimport { SOURCE_FORMAT_TYPED_ARRAY, SOURCE_FORMAT_ORIGINAL } from '../util/types.js';\nimport { convertOptionIdName, isDataItemOption } from '../util/model.js';\nimport { setCommonECData } from '../util/innerStore.js';\nimport { isSourceInstance } from './Source.js';\nimport DataStore from './DataStore.js';\nimport { isSeriesDataSchema } from './helper/SeriesDataSchema.js';\nvar isObject = zrUtil.isObject;\nvar map = zrUtil.map;\nvar CtorInt32Array = typeof Int32Array === 'undefined' ? Array : Int32Array; // Use prefix to avoid index to be the same as otherIdList[idx],\n// which will cause weird udpate animation.\n\nvar ID_PREFIX = 'e\\0\\0';\nvar INDEX_NOT_FOUND = -1; // type SeriesDimensionIndex = DimensionIndex;\n\nvar TRANSFERABLE_PROPERTIES = ['hasItemOption', '_nameList', '_idList', '_invertedIndicesMap', '_dimSummary', 'userOutput', '_rawData', '_dimValueGetter', '_nameDimIdx', '_idDimIdx', '_nameRepeatCount'];\nvar CLONE_PROPERTIES = ['_approximateExtent']; // -----------------------------\n// Internal method declarations:\n// -----------------------------\n\nvar prepareInvertedIndex;\nvar getId;\nvar getIdNameFromStore;\nvar normalizeDimensions;\nvar transferProperties;\nvar cloneListForMapAndSample;\nvar makeIdFromName;\n\nvar SeriesData =\n/** @class */\nfunction () {\n /**\n * @param dimensionsInput.dimensions\n * For example, ['someDimName', {name: 'someDimName', type: 'someDimType'}, ...].\n * Dimensions should be concrete names like x, y, z, lng, lat, angle, radius\n */\n function SeriesData(dimensionsInput, hostModel) {\n this.type = 'list';\n this._dimOmitted = false;\n this._nameList = [];\n this._idList = []; // Models of data option is stored sparse for optimizing memory cost\n // Never used yet (not used yet).\n // private _optionModels: Model[] = [];\n // Global visual properties after visual coding\n\n this._visual = {}; // Globel layout properties.\n\n this._layout = {}; // Item visual properties after visual coding\n\n this._itemVisuals = []; // Item layout properties after layout\n\n this._itemLayouts = []; // Graphic elemnents\n\n this._graphicEls = []; // key: dim, value: extent\n\n this._approximateExtent = {};\n this._calculationInfo = {}; // Having detected that there is data item is non primitive type\n // (in type `OptionDataItemObject`).\n // Like `data: [ { value: xx, itemStyle: {...} }, ...]`\n // At present it only happen in `SOURCE_FORMAT_ORIGINAL`.\n\n this.hasItemOption = false; // Methods that create a new list based on this list should be listed here.\n // Notice that those method should `RETURN` the new list.\n\n this.TRANSFERABLE_METHODS = ['cloneShallow', 'downSample', 'lttbDownSample', 'map']; // Methods that change indices of this list should be listed here.\n\n this.CHANGABLE_METHODS = ['filterSelf', 'selectRange'];\n this.DOWNSAMPLE_METHODS = ['downSample', 'lttbDownSample'];\n var dimensions;\n var assignStoreDimIdx = false;\n\n if (isSeriesDataSchema(dimensionsInput)) {\n dimensions = dimensionsInput.dimensions;\n this._dimOmitted = dimensionsInput.isDimensionOmitted();\n this._schema = dimensionsInput;\n } else {\n assignStoreDimIdx = true;\n dimensions = dimensionsInput;\n }\n\n dimensions = dimensions || ['x', 'y'];\n var dimensionInfos = {};\n var dimensionNames = [];\n var invertedIndicesMap = {};\n var needsHasOwn = false;\n var emptyObj = {};\n\n for (var i = 0; i < dimensions.length; i++) {\n // Use the original dimensions[i], where other flag props may exists.\n var dimInfoInput = dimensions[i];\n var dimensionInfo = zrUtil.isString(dimInfoInput) ? new SeriesDimensionDefine({\n name: dimInfoInput\n }) : !(dimInfoInput instanceof SeriesDimensionDefine) ? new SeriesDimensionDefine(dimInfoInput) : dimInfoInput;\n var dimensionName = dimensionInfo.name;\n dimensionInfo.type = dimensionInfo.type || 'float';\n\n if (!dimensionInfo.coordDim) {\n dimensionInfo.coordDim = dimensionName;\n dimensionInfo.coordDimIndex = 0;\n }\n\n var otherDims = dimensionInfo.otherDims = dimensionInfo.otherDims || {};\n dimensionNames.push(dimensionName);\n dimensionInfos[dimensionName] = dimensionInfo;\n\n if (emptyObj[dimensionName] != null) {\n needsHasOwn = true;\n }\n\n if (dimensionInfo.createInvertedIndices) {\n invertedIndicesMap[dimensionName] = [];\n }\n\n if (otherDims.itemName === 0) {\n this._nameDimIdx = i;\n }\n\n if (otherDims.itemId === 0) {\n this._idDimIdx = i;\n }\n\n if (process.env.NODE_ENV !== 'production') {\n zrUtil.assert(assignStoreDimIdx || dimensionInfo.storeDimIndex >= 0);\n }\n\n if (assignStoreDimIdx) {\n dimensionInfo.storeDimIndex = i;\n }\n }\n\n this.dimensions = dimensionNames;\n this._dimInfos = dimensionInfos;\n\n this._initGetDimensionInfo(needsHasOwn);\n\n this.hostModel = hostModel;\n this._invertedIndicesMap = invertedIndicesMap;\n\n if (this._dimOmitted) {\n var dimIdxToName_1 = this._dimIdxToName = zrUtil.createHashMap();\n zrUtil.each(dimensionNames, function (dimName) {\n dimIdxToName_1.set(dimensionInfos[dimName].storeDimIndex, dimName);\n });\n }\n }\n /**\n *\n * Get concrete dimension name by dimension name or dimension index.\n * If input a dimension name, do not validate whether the dimension name exits.\n *\n * @caution\n * @param dim Must make sure the dimension is `SeriesDimensionLoose`.\n * Because only those dimensions will have auto-generated dimension names if not\n * have a user-specified name, and other dimensions will get a return of null/undefined.\n *\n * @notice Becuause of this reason, should better use `getDimensionIndex` instead, for examples:\n * ```js\n * const val = data.getStore().get(data.getDimensionIndex(dim), dataIdx);\n * ```\n *\n * @return Concrete dim name.\n */\n\n\n SeriesData.prototype.getDimension = function (dim) {\n var dimIdx = this._recognizeDimIndex(dim);\n\n if (dimIdx == null) {\n return dim;\n }\n\n dimIdx = dim;\n\n if (!this._dimOmitted) {\n return this.dimensions[dimIdx];\n } // Retrieve from series dimension definition becuase it probably contains\n // generated dimension name (like 'x', 'y').\n\n\n var dimName = this._dimIdxToName.get(dimIdx);\n\n if (dimName != null) {\n return dimName;\n }\n\n var sourceDimDef = this._schema.getSourceDimension(dimIdx);\n\n if (sourceDimDef) {\n return sourceDimDef.name;\n }\n };\n /**\n * Get dimension index in data store. Return -1 if not found.\n * Can be used to index value from getRawValue.\n */\n\n\n SeriesData.prototype.getDimensionIndex = function (dim) {\n var dimIdx = this._recognizeDimIndex(dim);\n\n if (dimIdx != null) {\n return dimIdx;\n }\n\n if (dim == null) {\n return -1;\n }\n\n var dimInfo = this._getDimInfo(dim);\n\n return dimInfo ? dimInfo.storeDimIndex : this._dimOmitted ? this._schema.getSourceDimensionIndex(dim) : -1;\n };\n /**\n * The meanings of the input parameter `dim`:\n *\n * + If dim is a number (e.g., `1`), it means the index of the dimension.\n * For example, `getDimension(0)` will return 'x' or 'lng' or 'radius'.\n * + If dim is a number-like string (e.g., `\"1\"`):\n * + If there is the same concrete dim name defined in `series.dimensions` or `dataset.dimensions`,\n * it means that concrete name.\n * + If not, it will be converted to a number, which means the index of the dimension.\n * (why? because of the backward compatbility. We have been tolerating number-like string in\n * dimension setting, although now it seems that it is not a good idea.)\n * For example, `visualMap[i].dimension: \"1\"` is the same meaning as `visualMap[i].dimension: 1`,\n * if no dimension name is defined as `\"1\"`.\n * + If dim is a not-number-like string, it means the concrete dim name.\n * For example, it can be be default name `\"x\"`, `\"y\"`, `\"z\"`, `\"lng\"`, `\"lat\"`, `\"angle\"`, `\"radius\"`,\n * or customized in `dimensions` property of option like `\"age\"`.\n *\n * @return recogonized `DimensionIndex`. Otherwise return null/undefined (means that dim is `DimensionName`).\n */\n\n\n SeriesData.prototype._recognizeDimIndex = function (dim) {\n if (zrUtil.isNumber(dim) // If being a number-like string but not being defined as a dimension name.\n || dim != null && !isNaN(dim) && !this._getDimInfo(dim) && (!this._dimOmitted || this._schema.getSourceDimensionIndex(dim) < 0)) {\n return +dim;\n }\n };\n\n SeriesData.prototype._getStoreDimIndex = function (dim) {\n var dimIdx = this.getDimensionIndex(dim);\n\n if (process.env.NODE_ENV !== 'production') {\n if (dimIdx == null) {\n throw new Error('Unkown dimension ' + dim);\n }\n }\n\n return dimIdx;\n };\n /**\n * Get type and calculation info of particular dimension\n * @param dim\n * Dimension can be concrete names like x, y, z, lng, lat, angle, radius\n * Or a ordinal number. For example getDimensionInfo(0) will return 'x' or 'lng' or 'radius'\n */\n\n\n SeriesData.prototype.getDimensionInfo = function (dim) {\n // Do not clone, because there may be categories in dimInfo.\n return this._getDimInfo(this.getDimension(dim));\n };\n\n SeriesData.prototype._initGetDimensionInfo = function (needsHasOwn) {\n var dimensionInfos = this._dimInfos;\n this._getDimInfo = needsHasOwn ? function (dimName) {\n return dimensionInfos.hasOwnProperty(dimName) ? dimensionInfos[dimName] : undefined;\n } : function (dimName) {\n return dimensionInfos[dimName];\n };\n };\n /**\n * concrete dimension name list on coord.\n */\n\n\n SeriesData.prototype.getDimensionsOnCoord = function () {\n return this._dimSummary.dataDimsOnCoord.slice();\n };\n\n SeriesData.prototype.mapDimension = function (coordDim, idx) {\n var dimensionsSummary = this._dimSummary;\n\n if (idx == null) {\n return dimensionsSummary.encodeFirstDimNotExtra[coordDim];\n }\n\n var dims = dimensionsSummary.encode[coordDim];\n return dims ? dims[idx] : null;\n };\n\n SeriesData.prototype.mapDimensionsAll = function (coordDim) {\n var dimensionsSummary = this._dimSummary;\n var dims = dimensionsSummary.encode[coordDim];\n return (dims || []).slice();\n };\n\n SeriesData.prototype.getStore = function () {\n return this._store;\n };\n /**\n * Initialize from data\n * @param data source or data or data store.\n * @param nameList The name of a datum is used on data diff and\n * default label/tooltip.\n * A name can be specified in encode.itemName,\n * or dataItem.name (only for series option data),\n * or provided in nameList from outside.\n */\n\n\n SeriesData.prototype.initData = function (data, nameList, dimValueGetter) {\n var _this = this;\n\n var store;\n\n if (data instanceof DataStore) {\n store = data;\n }\n\n if (!store) {\n var dimensions = this.dimensions;\n var provider = isSourceInstance(data) || zrUtil.isArrayLike(data) ? new DefaultDataProvider(data, dimensions.length) : data;\n store = new DataStore();\n var dimensionInfos = map(dimensions, function (dimName) {\n return {\n type: _this._dimInfos[dimName].type,\n property: dimName\n };\n });\n store.initData(provider, dimensionInfos, dimValueGetter);\n }\n\n this._store = store; // Reset\n\n this._nameList = (nameList || []).slice();\n this._idList = [];\n this._nameRepeatCount = {};\n\n this._doInit(0, store.count()); // Cache summary info for fast visit. See \"dimensionHelper\".\n // Needs to be initialized after store is prepared.\n\n\n this._dimSummary = summarizeDimensions(this, this._schema);\n this.userOutput = this._dimSummary.userOutput;\n };\n /**\n * Caution: Can be only called on raw data (before `this._indices` created).\n */\n\n\n SeriesData.prototype.appendData = function (data) {\n var range = this._store.appendData(data);\n\n this._doInit(range[0], range[1]);\n };\n /**\n * Caution: Can be only called on raw data (before `this._indices` created).\n * This method does not modify `rawData` (`dataProvider`), but only\n * add values to store.\n *\n * The final count will be increased by `Math.max(values.length, names.length)`.\n *\n * @param values That is the SourceType: 'arrayRows', like\n * [\n * [12, 33, 44],\n * [NaN, 43, 1],\n * ['-', 'asdf', 0]\n * ]\n * Each item is exaclty cooresponding to a dimension.\n */\n\n\n SeriesData.prototype.appendValues = function (values, names) {\n var _a = this._store.appendValues(values, names.length),\n start = _a.start,\n end = _a.end;\n\n var shouldMakeIdFromName = this._shouldMakeIdFromName();\n\n this._updateOrdinalMeta();\n\n if (names) {\n for (var idx = start; idx < end; idx++) {\n var sourceIdx = idx - start;\n this._nameList[idx] = names[sourceIdx];\n\n if (shouldMakeIdFromName) {\n makeIdFromName(this, idx);\n }\n }\n }\n };\n\n SeriesData.prototype._updateOrdinalMeta = function () {\n var store = this._store;\n var dimensions = this.dimensions;\n\n for (var i = 0; i < dimensions.length; i++) {\n var dimInfo = this._dimInfos[dimensions[i]];\n\n if (dimInfo.ordinalMeta) {\n store.collectOrdinalMeta(dimInfo.storeDimIndex, dimInfo.ordinalMeta);\n }\n }\n };\n\n SeriesData.prototype._shouldMakeIdFromName = function () {\n var provider = this._store.getProvider();\n\n return this._idDimIdx == null && provider.getSource().sourceFormat !== SOURCE_FORMAT_TYPED_ARRAY && !provider.fillStorage;\n };\n\n SeriesData.prototype._doInit = function (start, end) {\n if (start >= end) {\n return;\n }\n\n var store = this._store;\n var provider = store.getProvider();\n\n this._updateOrdinalMeta();\n\n var nameList = this._nameList;\n var idList = this._idList;\n var sourceFormat = provider.getSource().sourceFormat;\n var isFormatOriginal = sourceFormat === SOURCE_FORMAT_ORIGINAL; // Each data item is value\n // [1, 2]\n // 2\n // Bar chart, line chart which uses category axis\n // only gives the 'y' value. 'x' value is the indices of category\n // Use a tempValue to normalize the value to be a (x, y) value\n // If dataItem is {name: ...} or {id: ...}, it has highest priority.\n // This kind of ids and names are always stored `_nameList` and `_idList`.\n\n if (isFormatOriginal && !provider.pure) {\n var sharedDataItem = [];\n\n for (var idx = start; idx < end; idx++) {\n // NOTICE: Try not to write things into dataItem\n var dataItem = provider.getItem(idx, sharedDataItem);\n\n if (!this.hasItemOption && isDataItemOption(dataItem)) {\n this.hasItemOption = true;\n }\n\n if (dataItem) {\n var itemName = dataItem.name;\n\n if (nameList[idx] == null && itemName != null) {\n nameList[idx] = convertOptionIdName(itemName, null);\n }\n\n var itemId = dataItem.id;\n\n if (idList[idx] == null && itemId != null) {\n idList[idx] = convertOptionIdName(itemId, null);\n }\n }\n }\n }\n\n if (this._shouldMakeIdFromName()) {\n for (var idx = start; idx < end; idx++) {\n makeIdFromName(this, idx);\n }\n }\n\n prepareInvertedIndex(this);\n };\n /**\n * PENDING: In fact currently this function is only used to short-circuit\n * the calling of `scale.unionExtentFromData` when data have been filtered by modules\n * like \"dataZoom\". `scale.unionExtentFromData` is used to calculate data extent for series on\n * an axis, but if a \"axis related data filter module\" is used, the extent of the axis have\n * been fixed and no need to calling `scale.unionExtentFromData` actually.\n * But if we add \"custom data filter\" in future, which is not \"axis related\", this method may\n * be still needed.\n *\n * Optimize for the scenario that data is filtered by a given extent.\n * Consider that if data amount is more than hundreds of thousand,\n * extent calculation will cost more than 10ms and the cache will\n * be erased because of the filtering.\n */\n\n\n SeriesData.prototype.getApproximateExtent = function (dim) {\n return this._approximateExtent[dim] || this._store.getDataExtent(this._getStoreDimIndex(dim));\n };\n /**\n * Calculate extent on a filtered data might be time consuming.\n * Approximate extent is only used for: calculte extent of filtered data outside.\n */\n\n\n SeriesData.prototype.setApproximateExtent = function (extent, dim) {\n dim = this.getDimension(dim);\n this._approximateExtent[dim] = extent.slice();\n };\n\n SeriesData.prototype.getCalculationInfo = function (key) {\n return this._calculationInfo[key];\n };\n\n SeriesData.prototype.setCalculationInfo = function (key, value) {\n isObject(key) ? zrUtil.extend(this._calculationInfo, key) : this._calculationInfo[key] = value;\n };\n /**\n * @return Never be null/undefined. `number` will be converted to string. Becuase:\n * In most cases, name is used in display, where returning a string is more convenient.\n * In other cases, name is used in query (see `indexOfName`), where we can keep the\n * rule that name `2` equals to name `'2'`.\n */\n\n\n SeriesData.prototype.getName = function (idx) {\n var rawIndex = this.getRawIndex(idx);\n var name = this._nameList[rawIndex];\n\n if (name == null && this._nameDimIdx != null) {\n name = getIdNameFromStore(this, this._nameDimIdx, rawIndex);\n }\n\n if (name == null) {\n name = '';\n }\n\n return name;\n };\n\n SeriesData.prototype._getCategory = function (dimIdx, idx) {\n var ordinal = this._store.get(dimIdx, idx);\n\n var ordinalMeta = this._store.getOrdinalMeta(dimIdx);\n\n if (ordinalMeta) {\n return ordinalMeta.categories[ordinal];\n }\n\n return ordinal;\n };\n /**\n * @return Never null/undefined. `number` will be converted to string. Becuase:\n * In all cases having encountered at present, id is used in making diff comparison, which\n * are usually based on hash map. We can keep the rule that the internal id are always string\n * (treat `2` is the same as `'2'`) to make the related logic simple.\n */\n\n\n SeriesData.prototype.getId = function (idx) {\n return getId(this, this.getRawIndex(idx));\n };\n\n SeriesData.prototype.count = function () {\n return this._store.count();\n };\n /**\n * Get value. Return NaN if idx is out of range.\n *\n * @notice Should better to use `data.getStore().get(dimIndex, dataIdx)` instead.\n */\n\n\n SeriesData.prototype.get = function (dim, idx) {\n var store = this._store;\n var dimInfo = this._dimInfos[dim];\n\n if (dimInfo) {\n return store.get(dimInfo.storeDimIndex, idx);\n }\n };\n /**\n * @notice Should better to use `data.getStore().getByRawIndex(dimIndex, dataIdx)` instead.\n */\n\n\n SeriesData.prototype.getByRawIndex = function (dim, rawIdx) {\n var store = this._store;\n var dimInfo = this._dimInfos[dim];\n\n if (dimInfo) {\n return store.getByRawIndex(dimInfo.storeDimIndex, rawIdx);\n }\n };\n\n SeriesData.prototype.getIndices = function () {\n return this._store.getIndices();\n };\n\n SeriesData.prototype.getDataExtent = function (dim) {\n return this._store.getDataExtent(this._getStoreDimIndex(dim));\n };\n\n SeriesData.prototype.getSum = function (dim) {\n return this._store.getSum(this._getStoreDimIndex(dim));\n };\n\n SeriesData.prototype.getMedian = function (dim) {\n return this._store.getMedian(this._getStoreDimIndex(dim));\n };\n\n SeriesData.prototype.getValues = function (dimensions, idx) {\n var _this = this;\n\n var store = this._store;\n return zrUtil.isArray(dimensions) ? store.getValues(map(dimensions, function (dim) {\n return _this._getStoreDimIndex(dim);\n }), idx) : store.getValues(dimensions);\n };\n /**\n * If value is NaN. Inlcuding '-'\n * Only check the coord dimensions.\n */\n\n\n SeriesData.prototype.hasValue = function (idx) {\n var dataDimIndicesOnCoord = this._dimSummary.dataDimIndicesOnCoord;\n\n for (var i = 0, len = dataDimIndicesOnCoord.length; i < len; i++) {\n // Ordinal type originally can be string or number.\n // But when an ordinal type is used on coord, it can\n // not be string but only number. So we can also use isNaN.\n if (isNaN(this._store.get(dataDimIndicesOnCoord[i], idx))) {\n return false;\n }\n }\n\n return true;\n };\n /**\n * Retreive the index with given name\n */\n\n\n SeriesData.prototype.indexOfName = function (name) {\n for (var i = 0, len = this._store.count(); i < len; i++) {\n if (this.getName(i) === name) {\n return i;\n }\n }\n\n return -1;\n };\n\n SeriesData.prototype.getRawIndex = function (idx) {\n return this._store.getRawIndex(idx);\n };\n\n SeriesData.prototype.indexOfRawIndex = function (rawIndex) {\n return this._store.indexOfRawIndex(rawIndex);\n };\n /**\n * Only support the dimension which inverted index created.\n * Do not support other cases until required.\n * @param dim concrete dim\n * @param value ordinal index\n * @return rawIndex\n */\n\n\n SeriesData.prototype.rawIndexOf = function (dim, value) {\n var invertedIndices = dim && this._invertedIndicesMap[dim];\n\n if (process.env.NODE_ENV !== 'production') {\n if (!invertedIndices) {\n throw new Error('Do not supported yet');\n }\n }\n\n var rawIndex = invertedIndices[value];\n\n if (rawIndex == null || isNaN(rawIndex)) {\n return INDEX_NOT_FOUND;\n }\n\n return rawIndex;\n };\n /**\n * Retreive the index of nearest value\n * @param dim\n * @param value\n * @param [maxDistance=Infinity]\n * @return If and only if multiple indices has\n * the same value, they are put to the result.\n */\n\n\n SeriesData.prototype.indicesOfNearest = function (dim, value, maxDistance) {\n return this._store.indicesOfNearest(this._getStoreDimIndex(dim), value, maxDistance);\n };\n\n SeriesData.prototype.each = function (dims, cb, ctx) {\n 'use strict';\n\n if (zrUtil.isFunction(dims)) {\n ctx = cb;\n cb = dims;\n dims = [];\n } // ctxCompat just for compat echarts3\n\n\n var fCtx = ctx || this;\n var dimIndices = map(normalizeDimensions(dims), this._getStoreDimIndex, this);\n\n this._store.each(dimIndices, fCtx ? zrUtil.bind(cb, fCtx) : cb);\n };\n\n SeriesData.prototype.filterSelf = function (dims, cb, ctx) {\n 'use strict';\n\n if (zrUtil.isFunction(dims)) {\n ctx = cb;\n cb = dims;\n dims = [];\n } // ctxCompat just for compat echarts3\n\n\n var fCtx = ctx || this;\n var dimIndices = map(normalizeDimensions(dims), this._getStoreDimIndex, this);\n this._store = this._store.filter(dimIndices, fCtx ? zrUtil.bind(cb, fCtx) : cb);\n return this;\n };\n /**\n * Select data in range. (For optimization of filter)\n * (Manually inline code, support 5 million data filtering in data zoom.)\n */\n\n\n SeriesData.prototype.selectRange = function (range) {\n 'use strict';\n\n var _this = this;\n\n var innerRange = {};\n var dims = zrUtil.keys(range);\n var dimIndices = [];\n zrUtil.each(dims, function (dim) {\n var dimIdx = _this._getStoreDimIndex(dim);\n\n innerRange[dimIdx] = range[dim];\n dimIndices.push(dimIdx);\n });\n this._store = this._store.selectRange(innerRange);\n return this;\n };\n /* eslint-enable max-len */\n\n\n SeriesData.prototype.mapArray = function (dims, cb, ctx) {\n 'use strict';\n\n if (zrUtil.isFunction(dims)) {\n ctx = cb;\n cb = dims;\n dims = [];\n } // ctxCompat just for compat echarts3\n\n\n ctx = ctx || this;\n var result = [];\n this.each(dims, function () {\n result.push(cb && cb.apply(this, arguments));\n }, ctx);\n return result;\n };\n\n SeriesData.prototype.map = function (dims, cb, ctx, ctxCompat) {\n 'use strict'; // ctxCompat just for compat echarts3\n\n var fCtx = ctx || ctxCompat || this;\n var dimIndices = map(normalizeDimensions(dims), this._getStoreDimIndex, this);\n var list = cloneListForMapAndSample(this);\n list._store = this._store.map(dimIndices, fCtx ? zrUtil.bind(cb, fCtx) : cb);\n return list;\n };\n\n SeriesData.prototype.modify = function (dims, cb, ctx, ctxCompat) {\n var _this = this; // ctxCompat just for compat echarts3\n\n\n var fCtx = ctx || ctxCompat || this;\n\n if (process.env.NODE_ENV !== 'production') {\n zrUtil.each(normalizeDimensions(dims), function (dim) {\n var dimInfo = _this.getDimensionInfo(dim);\n\n if (!dimInfo.isCalculationCoord) {\n console.error('Danger: only stack dimension can be modified');\n }\n });\n }\n\n var dimIndices = map(normalizeDimensions(dims), this._getStoreDimIndex, this); // If do shallow clone here, if there are too many stacked series,\n // it still cost lots of memory, becuase `_store.dimensions` are not shared.\n // We should consider there probably be shallow clone happen in each sereis\n // in consequent filter/map.\n\n this._store.modify(dimIndices, fCtx ? zrUtil.bind(cb, fCtx) : cb);\n };\n /**\n * Large data down sampling on given dimension\n * @param sampleIndex Sample index for name and id\n */\n\n\n SeriesData.prototype.downSample = function (dimension, rate, sampleValue, sampleIndex) {\n var list = cloneListForMapAndSample(this);\n list._store = this._store.downSample(this._getStoreDimIndex(dimension), rate, sampleValue, sampleIndex);\n return list;\n };\n /**\n * Large data down sampling using largest-triangle-three-buckets\n * @param {string} valueDimension\n * @param {number} targetCount\n */\n\n\n SeriesData.prototype.lttbDownSample = function (valueDimension, rate) {\n var list = cloneListForMapAndSample(this);\n list._store = this._store.lttbDownSample(this._getStoreDimIndex(valueDimension), rate);\n return list;\n };\n\n SeriesData.prototype.getRawDataItem = function (idx) {\n return this._store.getRawDataItem(idx);\n };\n /**\n * Get model of one data item.\n */\n // TODO: Type of data item\n\n\n SeriesData.prototype.getItemModel = function (idx) {\n var hostModel = this.hostModel;\n var dataItem = this.getRawDataItem(idx);\n return new Model(dataItem, hostModel, hostModel && hostModel.ecModel);\n };\n /**\n * Create a data differ\n */\n\n\n SeriesData.prototype.diff = function (otherList) {\n var thisList = this;\n return new DataDiffer(otherList ? otherList.getStore().getIndices() : [], this.getStore().getIndices(), function (idx) {\n return getId(otherList, idx);\n }, function (idx) {\n return getId(thisList, idx);\n });\n };\n /**\n * Get visual property.\n */\n\n\n SeriesData.prototype.getVisual = function (key) {\n var visual = this._visual;\n return visual && visual[key];\n };\n\n SeriesData.prototype.setVisual = function (kvObj, val) {\n this._visual = this._visual || {};\n\n if (isObject(kvObj)) {\n zrUtil.extend(this._visual, kvObj);\n } else {\n this._visual[kvObj] = val;\n }\n };\n /**\n * Get visual property of single data item\n */\n // eslint-disable-next-line\n\n\n SeriesData.prototype.getItemVisual = function (idx, key) {\n var itemVisual = this._itemVisuals[idx];\n var val = itemVisual && itemVisual[key];\n\n if (val == null) {\n // Use global visual property\n return this.getVisual(key);\n }\n\n return val;\n };\n /**\n * If exists visual property of single data item\n */\n\n\n SeriesData.prototype.hasItemVisual = function () {\n return this._itemVisuals.length > 0;\n };\n /**\n * Make sure itemVisual property is unique\n */\n // TODO: use key to save visual to reduce memory.\n\n\n SeriesData.prototype.ensureUniqueItemVisual = function (idx, key) {\n var itemVisuals = this._itemVisuals;\n var itemVisual = itemVisuals[idx];\n\n if (!itemVisual) {\n itemVisual = itemVisuals[idx] = {};\n }\n\n var val = itemVisual[key];\n\n if (val == null) {\n val = this.getVisual(key); // TODO Performance?\n\n if (zrUtil.isArray(val)) {\n val = val.slice();\n } else if (isObject(val)) {\n val = zrUtil.extend({}, val);\n }\n\n itemVisual[key] = val;\n }\n\n return val;\n }; // eslint-disable-next-line\n\n\n SeriesData.prototype.setItemVisual = function (idx, key, value) {\n var itemVisual = this._itemVisuals[idx] || {};\n this._itemVisuals[idx] = itemVisual;\n\n if (isObject(key)) {\n zrUtil.extend(itemVisual, key);\n } else {\n itemVisual[key] = value;\n }\n };\n /**\n * Clear itemVisuals and list visual.\n */\n\n\n SeriesData.prototype.clearAllVisual = function () {\n this._visual = {};\n this._itemVisuals = [];\n };\n\n SeriesData.prototype.setLayout = function (key, val) {\n isObject(key) ? zrUtil.extend(this._layout, key) : this._layout[key] = val;\n };\n /**\n * Get layout property.\n */\n\n\n SeriesData.prototype.getLayout = function (key) {\n return this._layout[key];\n };\n /**\n * Get layout of single data item\n */\n\n\n SeriesData.prototype.getItemLayout = function (idx) {\n return this._itemLayouts[idx];\n };\n /**\n * Set layout of single data item\n */\n\n\n SeriesData.prototype.setItemLayout = function (idx, layout, merge) {\n this._itemLayouts[idx] = merge ? zrUtil.extend(this._itemLayouts[idx] || {}, layout) : layout;\n };\n /**\n * Clear all layout of single data item\n */\n\n\n SeriesData.prototype.clearItemLayouts = function () {\n this._itemLayouts.length = 0;\n };\n /**\n * Set graphic element relative to data. It can be set as null\n */\n\n\n SeriesData.prototype.setItemGraphicEl = function (idx, el) {\n var seriesIndex = this.hostModel && this.hostModel.seriesIndex;\n setCommonECData(seriesIndex, this.dataType, idx, el);\n this._graphicEls[idx] = el;\n };\n\n SeriesData.prototype.getItemGraphicEl = function (idx) {\n return this._graphicEls[idx];\n };\n\n SeriesData.prototype.eachItemGraphicEl = function (cb, context) {\n zrUtil.each(this._graphicEls, function (el, idx) {\n if (el) {\n cb && cb.call(context, el, idx);\n }\n });\n };\n /**\n * Shallow clone a new list except visual and layout properties, and graph elements.\n * New list only change the indices.\n */\n\n\n SeriesData.prototype.cloneShallow = function (list) {\n if (!list) {\n list = new SeriesData(this._schema ? this._schema : map(this.dimensions, this._getDimInfo, this), this.hostModel);\n }\n\n transferProperties(list, this);\n list._store = this._store;\n return list;\n };\n /**\n * Wrap some method to add more feature\n */\n\n\n SeriesData.prototype.wrapMethod = function (methodName, injectFunction) {\n var originalMethod = this[methodName];\n\n if (!zrUtil.isFunction(originalMethod)) {\n return;\n }\n\n this.__wrappedMethods = this.__wrappedMethods || [];\n\n this.__wrappedMethods.push(methodName);\n\n this[methodName] = function () {\n var res = originalMethod.apply(this, arguments);\n return injectFunction.apply(this, [res].concat(zrUtil.slice(arguments)));\n };\n }; // ----------------------------------------------------------\n // A work around for internal method visiting private member.\n // ----------------------------------------------------------\n\n\n SeriesData.internalField = function () {\n prepareInvertedIndex = function (data) {\n var invertedIndicesMap = data._invertedIndicesMap;\n zrUtil.each(invertedIndicesMap, function (invertedIndices, dim) {\n var dimInfo = data._dimInfos[dim]; // Currently, only dimensions that has ordinalMeta can create inverted indices.\n\n var ordinalMeta = dimInfo.ordinalMeta;\n var store = data._store;\n\n if (ordinalMeta) {\n invertedIndices = invertedIndicesMap[dim] = new CtorInt32Array(ordinalMeta.categories.length); // The default value of TypedArray is 0. To avoid miss\n // mapping to 0, we should set it as INDEX_NOT_FOUND.\n\n for (var i = 0; i < invertedIndices.length; i++) {\n invertedIndices[i] = INDEX_NOT_FOUND;\n }\n\n for (var i = 0; i < store.count(); i++) {\n // Only support the case that all values are distinct.\n invertedIndices[store.get(dimInfo.storeDimIndex, i)] = i;\n }\n }\n });\n };\n\n getIdNameFromStore = function (data, dimIdx, idx) {\n return convertOptionIdName(data._getCategory(dimIdx, idx), null);\n };\n /**\n * @see the comment of `List['getId']`.\n */\n\n\n getId = function (data, rawIndex) {\n var id = data._idList[rawIndex];\n\n if (id == null && data._idDimIdx != null) {\n id = getIdNameFromStore(data, data._idDimIdx, rawIndex);\n }\n\n if (id == null) {\n id = ID_PREFIX + rawIndex;\n }\n\n return id;\n };\n\n normalizeDimensions = function (dimensions) {\n if (!zrUtil.isArray(dimensions)) {\n dimensions = dimensions != null ? [dimensions] : [];\n }\n\n return dimensions;\n };\n /**\n * Data in excludeDimensions is copied, otherwise transfered.\n */\n\n\n cloneListForMapAndSample = function (original) {\n var list = new SeriesData(original._schema ? original._schema : map(original.dimensions, original._getDimInfo, original), original.hostModel); // FIXME If needs stackedOn, value may already been stacked\n\n transferProperties(list, original);\n return list;\n };\n\n transferProperties = function (target, source) {\n zrUtil.each(TRANSFERABLE_PROPERTIES.concat(source.__wrappedMethods || []), function (propName) {\n if (source.hasOwnProperty(propName)) {\n target[propName] = source[propName];\n }\n });\n target.__wrappedMethods = source.__wrappedMethods;\n zrUtil.each(CLONE_PROPERTIES, function (propName) {\n target[propName] = zrUtil.clone(source[propName]);\n });\n target._calculationInfo = zrUtil.extend({}, source._calculationInfo);\n };\n\n makeIdFromName = function (data, idx) {\n var nameList = data._nameList;\n var idList = data._idList;\n var nameDimIdx = data._nameDimIdx;\n var idDimIdx = data._idDimIdx;\n var name = nameList[idx];\n var id = idList[idx];\n\n if (name == null && nameDimIdx != null) {\n nameList[idx] = name = getIdNameFromStore(data, nameDimIdx, idx);\n }\n\n if (id == null && idDimIdx != null) {\n idList[idx] = id = getIdNameFromStore(data, idDimIdx, idx);\n }\n\n if (id == null && name != null) {\n var nameRepeatCount = data._nameRepeatCount;\n var nmCnt = nameRepeatCount[name] = (nameRepeatCount[name] || 0) + 1;\n id = name;\n\n if (nmCnt > 1) {\n id += '__ec__' + nmCnt;\n }\n\n idList[idx] = id;\n }\n };\n }();\n\n return SeriesData;\n}();\n\nexport default SeriesData;","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { VISUAL_DIMENSIONS } from '../../util/types.js';\nimport SeriesDimensionDefine from '../SeriesDimensionDefine.js';\nimport { createHashMap, defaults, each, extend, isObject, isString } from 'zrender/lib/core/util.js';\nimport { createSourceFromSeriesDataOption, isSourceInstance } from '../Source.js';\nimport { CtorInt32Array } from '../DataStore.js';\nimport { normalizeToArray } from '../../util/model.js';\nimport { BE_ORDINAL, guessOrdinal } from './sourceHelper.js';\nimport { createDimNameMap, ensureSourceDimNameMap, SeriesDataSchema, shouldOmitUnusedDimensions } from './SeriesDataSchema.js';\n/**\n * For outside usage compat (like echarts-gl are using it).\n */\n\nexport function createDimensions(source, opt) {\n return prepareSeriesDataSchema(source, opt).dimensions;\n}\n/**\n * This method builds the relationship between:\n * + \"what the coord sys or series requires (see `coordDimensions`)\",\n * + \"what the user defines (in `encode` and `dimensions`, see `opt.dimensionsDefine` and `opt.encodeDefine`)\"\n * + \"what the data source provids (see `source`)\".\n *\n * Some guess strategy will be adapted if user does not define something.\n * If no 'value' dimension specified, the first no-named dimension will be\n * named as 'value'.\n *\n * @return The results are always sorted by `storeDimIndex` asc.\n */\n\nexport default function prepareSeriesDataSchema( // TODO: TYPE completeDimensions type\nsource, opt) {\n if (!isSourceInstance(source)) {\n source = createSourceFromSeriesDataOption(source);\n }\n\n opt = opt || {};\n var sysDims = opt.coordDimensions || [];\n var dimsDef = opt.dimensionsDefine || source.dimensionsDefine || [];\n var coordDimNameMap = createHashMap();\n var resultList = [];\n var dimCount = getDimCount(source, sysDims, dimsDef, opt.dimensionsCount); // Try to ignore unsed dimensions if sharing a high dimension datastore\n // 30 is an experience value.\n\n var omitUnusedDimensions = opt.canOmitUnusedDimensions && shouldOmitUnusedDimensions(dimCount);\n var isUsingSourceDimensionsDef = dimsDef === source.dimensionsDefine;\n var dataDimNameMap = isUsingSourceDimensionsDef ? ensureSourceDimNameMap(source) : createDimNameMap(dimsDef);\n var encodeDef = opt.encodeDefine;\n\n if (!encodeDef && opt.encodeDefaulter) {\n encodeDef = opt.encodeDefaulter(source, dimCount);\n }\n\n var encodeDefMap = createHashMap(encodeDef);\n var indicesMap = new CtorInt32Array(dimCount);\n\n for (var i = 0; i < indicesMap.length; i++) {\n indicesMap[i] = -1;\n }\n\n function getResultItem(dimIdx) {\n var idx = indicesMap[dimIdx];\n\n if (idx < 0) {\n var dimDefItemRaw = dimsDef[dimIdx];\n var dimDefItem = isObject(dimDefItemRaw) ? dimDefItemRaw : {\n name: dimDefItemRaw\n };\n var resultItem = new SeriesDimensionDefine();\n var userDimName = dimDefItem.name;\n\n if (userDimName != null && dataDimNameMap.get(userDimName) != null) {\n // Only if `series.dimensions` is defined in option\n // displayName, will be set, and dimension will be diplayed vertically in\n // tooltip by default.\n resultItem.name = resultItem.displayName = userDimName;\n }\n\n dimDefItem.type != null && (resultItem.type = dimDefItem.type);\n dimDefItem.displayName != null && (resultItem.displayName = dimDefItem.displayName);\n var newIdx = resultList.length;\n indicesMap[dimIdx] = newIdx;\n resultItem.storeDimIndex = dimIdx;\n resultList.push(resultItem);\n return resultItem;\n }\n\n return resultList[idx];\n }\n\n if (!omitUnusedDimensions) {\n for (var i = 0; i < dimCount; i++) {\n getResultItem(i);\n }\n } // Set `coordDim` and `coordDimIndex` by `encodeDefMap` and normalize `encodeDefMap`.\n\n\n encodeDefMap.each(function (dataDimsRaw, coordDim) {\n var dataDims = normalizeToArray(dataDimsRaw).slice(); // Note: It is allowed that `dataDims.length` is `0`, e.g., options is\n // `{encode: {x: -1, y: 1}}`. Should not filter anything in\n // this case.\n\n if (dataDims.length === 1 && !isString(dataDims[0]) && dataDims[0] < 0) {\n encodeDefMap.set(coordDim, false);\n return;\n }\n\n var validDataDims = encodeDefMap.set(coordDim, []);\n each(dataDims, function (resultDimIdxOrName, idx) {\n // The input resultDimIdx can be dim name or index.\n var resultDimIdx = isString(resultDimIdxOrName) ? dataDimNameMap.get(resultDimIdxOrName) : resultDimIdxOrName;\n\n if (resultDimIdx != null && resultDimIdx < dimCount) {\n validDataDims[idx] = resultDimIdx;\n applyDim(getResultItem(resultDimIdx), coordDim, idx);\n }\n });\n }); // Apply templetes and default order from `sysDims`.\n\n var availDimIdx = 0;\n each(sysDims, function (sysDimItemRaw) {\n var coordDim;\n var sysDimItemDimsDef;\n var sysDimItemOtherDims;\n var sysDimItem;\n\n if (isString(sysDimItemRaw)) {\n coordDim = sysDimItemRaw;\n sysDimItem = {};\n } else {\n sysDimItem = sysDimItemRaw;\n coordDim = sysDimItem.name;\n var ordinalMeta = sysDimItem.ordinalMeta;\n sysDimItem.ordinalMeta = null;\n sysDimItem = extend({}, sysDimItem);\n sysDimItem.ordinalMeta = ordinalMeta; // `coordDimIndex` should not be set directly.\n\n sysDimItemDimsDef = sysDimItem.dimsDef;\n sysDimItemOtherDims = sysDimItem.otherDims;\n sysDimItem.name = sysDimItem.coordDim = sysDimItem.coordDimIndex = sysDimItem.dimsDef = sysDimItem.otherDims = null;\n }\n\n var dataDims = encodeDefMap.get(coordDim); // negative resultDimIdx means no need to mapping.\n\n if (dataDims === false) {\n return;\n }\n\n dataDims = normalizeToArray(dataDims); // dimensions provides default dim sequences.\n\n if (!dataDims.length) {\n for (var i = 0; i < (sysDimItemDimsDef && sysDimItemDimsDef.length || 1); i++) {\n while (availDimIdx < dimCount && getResultItem(availDimIdx).coordDim != null) {\n availDimIdx++;\n }\n\n availDimIdx < dimCount && dataDims.push(availDimIdx++);\n }\n } // Apply templates.\n\n\n each(dataDims, function (resultDimIdx, coordDimIndex) {\n var resultItem = getResultItem(resultDimIdx); // Coordinate system has a higher priority on dim type than source.\n\n if (isUsingSourceDimensionsDef && sysDimItem.type != null) {\n resultItem.type = sysDimItem.type;\n }\n\n applyDim(defaults(resultItem, sysDimItem), coordDim, coordDimIndex);\n\n if (resultItem.name == null && sysDimItemDimsDef) {\n var sysDimItemDimsDefItem = sysDimItemDimsDef[coordDimIndex];\n !isObject(sysDimItemDimsDefItem) && (sysDimItemDimsDefItem = {\n name: sysDimItemDimsDefItem\n });\n resultItem.name = resultItem.displayName = sysDimItemDimsDefItem.name;\n resultItem.defaultTooltip = sysDimItemDimsDefItem.defaultTooltip;\n } // FIXME refactor, currently only used in case: {otherDims: {tooltip: false}}\n\n\n sysDimItemOtherDims && defaults(resultItem.otherDims, sysDimItemOtherDims);\n });\n });\n\n function applyDim(resultItem, coordDim, coordDimIndex) {\n if (VISUAL_DIMENSIONS.get(coordDim) != null) {\n resultItem.otherDims[coordDim] = coordDimIndex;\n } else {\n resultItem.coordDim = coordDim;\n resultItem.coordDimIndex = coordDimIndex;\n coordDimNameMap.set(coordDim, true);\n }\n } // Make sure the first extra dim is 'value'.\n\n\n var generateCoord = opt.generateCoord;\n var generateCoordCount = opt.generateCoordCount;\n var fromZero = generateCoordCount != null;\n generateCoordCount = generateCoord ? generateCoordCount || 1 : 0;\n var extra = generateCoord || 'value';\n\n function ifNoNameFillWithCoordName(resultItem) {\n if (resultItem.name == null) {\n // Duplication will be removed in the next step.\n resultItem.name = resultItem.coordDim;\n }\n } // Set dim `name` and other `coordDim` and other props.\n\n\n if (!omitUnusedDimensions) {\n for (var resultDimIdx = 0; resultDimIdx < dimCount; resultDimIdx++) {\n var resultItem = getResultItem(resultDimIdx);\n var coordDim = resultItem.coordDim;\n\n if (coordDim == null) {\n // TODO no need to generate coordDim for isExtraCoord?\n resultItem.coordDim = genCoordDimName(extra, coordDimNameMap, fromZero);\n resultItem.coordDimIndex = 0; // Series specified generateCoord is using out.\n\n if (!generateCoord || generateCoordCount <= 0) {\n resultItem.isExtraCoord = true;\n }\n\n generateCoordCount--;\n }\n\n ifNoNameFillWithCoordName(resultItem);\n\n if (resultItem.type == null && (guessOrdinal(source, resultDimIdx) === BE_ORDINAL.Must // Consider the case:\n // {\n // dataset: {source: [\n // ['2001', 123],\n // ['2002', 456],\n // ...\n // ['The others', 987],\n // ]},\n // series: {type: 'pie'}\n // }\n // The first colum should better be treated as a \"ordinal\" although it\n // might not able to be detected as an \"ordinal\" by `guessOrdinal`.\n || resultItem.isExtraCoord && (resultItem.otherDims.itemName != null || resultItem.otherDims.seriesName != null))) {\n resultItem.type = 'ordinal';\n }\n }\n } else {\n each(resultList, function (resultItem) {\n // PENDING: guessOrdinal or let user specify type: 'ordinal' manually?\n ifNoNameFillWithCoordName(resultItem);\n }); // Sort dimensions: there are some rule that use the last dim as label,\n // and for some latter travel process easier.\n\n resultList.sort(function (item0, item1) {\n return item0.storeDimIndex - item1.storeDimIndex;\n });\n }\n\n removeDuplication(resultList);\n return new SeriesDataSchema({\n source: source,\n dimensions: resultList,\n fullDimensionCount: dimCount,\n dimensionOmitted: omitUnusedDimensions\n });\n}\n\nfunction removeDuplication(result) {\n var duplicationMap = createHashMap();\n\n for (var i = 0; i < result.length; i++) {\n var dim = result[i];\n var dimOriginalName = dim.name;\n var count = duplicationMap.get(dimOriginalName) || 0;\n\n if (count > 0) {\n // Starts from 0.\n dim.name = dimOriginalName + (count - 1);\n }\n\n count++;\n duplicationMap.set(dimOriginalName, count);\n }\n} // ??? TODO\n// Originally detect dimCount by data[0]. Should we\n// optimize it to only by sysDims and dimensions and encode.\n// So only necessary dims will be initialized.\n// But\n// (1) custom series should be considered. where other dims\n// may be visited.\n// (2) sometimes user need to calcualte bubble size or use visualMap\n// on other dimensions besides coordSys needed.\n// So, dims that is not used by system, should be shared in data store?\n\n\nfunction getDimCount(source, sysDims, dimsDef, optDimCount) {\n // Note that the result dimCount should not small than columns count\n // of data, otherwise `dataDimNameMap` checking will be incorrect.\n var dimCount = Math.max(source.dimensionsDetectedCount || 1, sysDims.length, dimsDef.length, optDimCount || 0);\n each(sysDims, function (sysDimItem) {\n var sysDimItemDimsDef;\n\n if (isObject(sysDimItem) && (sysDimItemDimsDef = sysDimItem.dimsDef)) {\n dimCount = Math.max(dimCount, sysDimItemDimsDef.length);\n }\n });\n return dimCount;\n}\n\nfunction genCoordDimName(name, map, fromZero) {\n var mapData = map.data;\n\n if (fromZero || mapData.hasOwnProperty(name)) {\n var i = 0;\n\n while (mapData.hasOwnProperty(name + i)) {\n i++;\n }\n\n name += i;\n }\n\n map.set(name, true);\n return name;\n}","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n/**\n * Helper for model references.\n * There are many manners to refer axis/coordSys.\n */\n// TODO\n// merge relevant logic to this file?\n// check: \"modelHelper\" of tooltip and \"BrushTargetManager\".\nimport { createHashMap, retrieve, each } from 'zrender/lib/core/util.js';\nimport { SINGLE_REFERRING } from '../util/model.js';\n/**\n * @class\n * For example:\n * {\n * coordSysName: 'cartesian2d',\n * coordSysDims: ['x', 'y', ...],\n * axisMap: HashMap({\n * x: xAxisModel,\n * y: yAxisModel\n * }),\n * categoryAxisMap: HashMap({\n * x: xAxisModel,\n * y: undefined\n * }),\n * // The index of the first category axis in `coordSysDims`.\n * // `null/undefined` means no category axis exists.\n * firstCategoryDimIndex: 1,\n * // To replace user specified encode.\n * }\n */\n\nvar CoordSysInfo =\n/** @class */\nfunction () {\n function CoordSysInfo(coordSysName) {\n this.coordSysDims = [];\n this.axisMap = createHashMap();\n this.categoryAxisMap = createHashMap();\n this.coordSysName = coordSysName;\n }\n\n return CoordSysInfo;\n}();\n\nexport function getCoordSysInfoBySeries(seriesModel) {\n var coordSysName = seriesModel.get('coordinateSystem');\n var result = new CoordSysInfo(coordSysName);\n var fetch = fetchers[coordSysName];\n\n if (fetch) {\n fetch(seriesModel, result, result.axisMap, result.categoryAxisMap);\n return result;\n }\n}\nvar fetchers = {\n cartesian2d: function (seriesModel, result, axisMap, categoryAxisMap) {\n var xAxisModel = seriesModel.getReferringComponents('xAxis', SINGLE_REFERRING).models[0];\n var yAxisModel = seriesModel.getReferringComponents('yAxis', SINGLE_REFERRING).models[0];\n\n if (process.env.NODE_ENV !== 'production') {\n if (!xAxisModel) {\n throw new Error('xAxis \"' + retrieve(seriesModel.get('xAxisIndex'), seriesModel.get('xAxisId'), 0) + '\" not found');\n }\n\n if (!yAxisModel) {\n throw new Error('yAxis \"' + retrieve(seriesModel.get('xAxisIndex'), seriesModel.get('yAxisId'), 0) + '\" not found');\n }\n }\n\n result.coordSysDims = ['x', 'y'];\n axisMap.set('x', xAxisModel);\n axisMap.set('y', yAxisModel);\n\n if (isCategory(xAxisModel)) {\n categoryAxisMap.set('x', xAxisModel);\n result.firstCategoryDimIndex = 0;\n }\n\n if (isCategory(yAxisModel)) {\n categoryAxisMap.set('y', yAxisModel);\n result.firstCategoryDimIndex == null && (result.firstCategoryDimIndex = 1);\n }\n },\n singleAxis: function (seriesModel, result, axisMap, categoryAxisMap) {\n var singleAxisModel = seriesModel.getReferringComponents('singleAxis', SINGLE_REFERRING).models[0];\n\n if (process.env.NODE_ENV !== 'production') {\n if (!singleAxisModel) {\n throw new Error('singleAxis should be specified.');\n }\n }\n\n result.coordSysDims = ['single'];\n axisMap.set('single', singleAxisModel);\n\n if (isCategory(singleAxisModel)) {\n categoryAxisMap.set('single', singleAxisModel);\n result.firstCategoryDimIndex = 0;\n }\n },\n polar: function (seriesModel, result, axisMap, categoryAxisMap) {\n var polarModel = seriesModel.getReferringComponents('polar', SINGLE_REFERRING).models[0];\n var radiusAxisModel = polarModel.findAxisModel('radiusAxis');\n var angleAxisModel = polarModel.findAxisModel('angleAxis');\n\n if (process.env.NODE_ENV !== 'production') {\n if (!angleAxisModel) {\n throw new Error('angleAxis option not found');\n }\n\n if (!radiusAxisModel) {\n throw new Error('radiusAxis option not found');\n }\n }\n\n result.coordSysDims = ['radius', 'angle'];\n axisMap.set('radius', radiusAxisModel);\n axisMap.set('angle', angleAxisModel);\n\n if (isCategory(radiusAxisModel)) {\n categoryAxisMap.set('radius', radiusAxisModel);\n result.firstCategoryDimIndex = 0;\n }\n\n if (isCategory(angleAxisModel)) {\n categoryAxisMap.set('angle', angleAxisModel);\n result.firstCategoryDimIndex == null && (result.firstCategoryDimIndex = 1);\n }\n },\n geo: function (seriesModel, result, axisMap, categoryAxisMap) {\n result.coordSysDims = ['lng', 'lat'];\n },\n parallel: function (seriesModel, result, axisMap, categoryAxisMap) {\n var ecModel = seriesModel.ecModel;\n var parallelModel = ecModel.getComponent('parallel', seriesModel.get('parallelIndex'));\n var coordSysDims = result.coordSysDims = parallelModel.dimensions.slice();\n each(parallelModel.parallelAxisIndex, function (axisIndex, index) {\n var axisModel = ecModel.getComponent('parallelAxis', axisIndex);\n var axisDim = coordSysDims[index];\n axisMap.set(axisDim, axisModel);\n\n if (isCategory(axisModel)) {\n categoryAxisMap.set(axisDim, axisModel);\n\n if (result.firstCategoryDimIndex == null) {\n result.firstCategoryDimIndex = index;\n }\n }\n });\n }\n};\n\nfunction isCategory(axisModel) {\n return axisModel.get('type') === 'category';\n}","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { each, isString } from 'zrender/lib/core/util.js';\nimport { isSeriesDataSchema } from './SeriesDataSchema.js';\n/**\n * Note that it is too complicated to support 3d stack by value\n * (have to create two-dimension inverted index), so in 3d case\n * we just support that stacked by index.\n *\n * @param seriesModel\n * @param dimensionsInput The same as the input of .\n * The input will be modified.\n * @param opt\n * @param opt.stackedCoordDimension Specify a coord dimension if needed.\n * @param opt.byIndex=false\n * @return calculationInfo\n * {\n * stackedDimension: string\n * stackedByDimension: string\n * isStackedByIndex: boolean\n * stackedOverDimension: string\n * stackResultDimension: string\n * }\n */\n\nexport function enableDataStack(seriesModel, dimensionsInput, opt) {\n opt = opt || {};\n var byIndex = opt.byIndex;\n var stackedCoordDimension = opt.stackedCoordDimension;\n var dimensionDefineList;\n var schema;\n var store;\n\n if (isLegacyDimensionsInput(dimensionsInput)) {\n dimensionDefineList = dimensionsInput;\n } else {\n schema = dimensionsInput.schema;\n dimensionDefineList = schema.dimensions;\n store = dimensionsInput.store;\n } // Compatibal: when `stack` is set as '', do not stack.\n\n\n var mayStack = !!(seriesModel && seriesModel.get('stack'));\n var stackedByDimInfo;\n var stackedDimInfo;\n var stackResultDimension;\n var stackedOverDimension;\n each(dimensionDefineList, function (dimensionInfo, index) {\n if (isString(dimensionInfo)) {\n dimensionDefineList[index] = dimensionInfo = {\n name: dimensionInfo\n };\n }\n\n if (mayStack && !dimensionInfo.isExtraCoord) {\n // Find the first ordinal dimension as the stackedByDimInfo.\n if (!byIndex && !stackedByDimInfo && dimensionInfo.ordinalMeta) {\n stackedByDimInfo = dimensionInfo;\n } // Find the first stackable dimension as the stackedDimInfo.\n\n\n if (!stackedDimInfo && dimensionInfo.type !== 'ordinal' && dimensionInfo.type !== 'time' && (!stackedCoordDimension || stackedCoordDimension === dimensionInfo.coordDim)) {\n stackedDimInfo = dimensionInfo;\n }\n }\n });\n\n if (stackedDimInfo && !byIndex && !stackedByDimInfo) {\n // Compatible with previous design, value axis (time axis) only stack by index.\n // It may make sense if the user provides elaborately constructed data.\n byIndex = true;\n } // Add stack dimension, they can be both calculated by coordinate system in `unionExtent`.\n // That put stack logic in List is for using conveniently in echarts extensions, but it\n // might not be a good way.\n\n\n if (stackedDimInfo) {\n // Use a weird name that not duplicated with other names.\n // Also need to use seriesModel.id as postfix because different\n // series may share same data store. The stack dimension needs to be distinguished.\n stackResultDimension = '__\\0ecstackresult_' + seriesModel.id;\n stackedOverDimension = '__\\0ecstackedover_' + seriesModel.id; // Create inverted index to fast query index by value.\n\n if (stackedByDimInfo) {\n stackedByDimInfo.createInvertedIndices = true;\n }\n\n var stackedDimCoordDim_1 = stackedDimInfo.coordDim;\n var stackedDimType = stackedDimInfo.type;\n var stackedDimCoordIndex_1 = 0;\n each(dimensionDefineList, function (dimensionInfo) {\n if (dimensionInfo.coordDim === stackedDimCoordDim_1) {\n stackedDimCoordIndex_1++;\n }\n });\n var stackedOverDimensionDefine = {\n name: stackResultDimension,\n coordDim: stackedDimCoordDim_1,\n coordDimIndex: stackedDimCoordIndex_1,\n type: stackedDimType,\n isExtraCoord: true,\n isCalculationCoord: true,\n storeDimIndex: dimensionDefineList.length\n };\n var stackResultDimensionDefine = {\n name: stackedOverDimension,\n // This dimension contains stack base (generally, 0), so do not set it as\n // `stackedDimCoordDim` to avoid extent calculation, consider log scale.\n coordDim: stackedOverDimension,\n coordDimIndex: stackedDimCoordIndex_1 + 1,\n type: stackedDimType,\n isExtraCoord: true,\n isCalculationCoord: true,\n storeDimIndex: dimensionDefineList.length + 1\n };\n\n if (schema) {\n if (store) {\n stackedOverDimensionDefine.storeDimIndex = store.ensureCalculationDimension(stackedOverDimension, stackedDimType);\n stackResultDimensionDefine.storeDimIndex = store.ensureCalculationDimension(stackResultDimension, stackedDimType);\n }\n\n schema.appendCalculationDimension(stackedOverDimensionDefine);\n schema.appendCalculationDimension(stackResultDimensionDefine);\n } else {\n dimensionDefineList.push(stackedOverDimensionDefine);\n dimensionDefineList.push(stackResultDimensionDefine);\n }\n }\n\n return {\n stackedDimension: stackedDimInfo && stackedDimInfo.name,\n stackedByDimension: stackedByDimInfo && stackedByDimInfo.name,\n isStackedByIndex: byIndex,\n stackedOverDimension: stackedOverDimension,\n stackResultDimension: stackResultDimension\n };\n}\n\nfunction isLegacyDimensionsInput(dimensionsInput) {\n return !isSeriesDataSchema(dimensionsInput.schema);\n}\n\nexport function isDimensionStacked(data, stackedDim) {\n // Each single series only maps to one pair of axis. So we do not need to\n // check stackByDim, whatever stacked by a dimension or stacked by index.\n return !!stackedDim && stackedDim === data.getCalculationInfo('stackedDimension');\n}\nexport function getStackedDimension(data, targetDim) {\n return isDimensionStacked(data, targetDim) ? data.getCalculationInfo('stackResultDimension') : targetDim;\n}","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport * as zrUtil from 'zrender/lib/core/util.js';\nimport SeriesData from '../../data/SeriesData.js';\nimport prepareSeriesDataSchema from '../../data/helper/createDimensions.js';\nimport { getDimensionTypeByAxis } from '../../data/helper/dimensionHelper.js';\nimport { getDataItemValue } from '../../util/model.js';\nimport CoordinateSystem from '../../core/CoordinateSystem.js';\nimport { getCoordSysInfoBySeries } from '../../model/referHelper.js';\nimport { createSourceFromSeriesDataOption } from '../../data/Source.js';\nimport { enableDataStack } from '../../data/helper/dataStackHelper.js';\nimport { makeSeriesEncodeForAxisCoordSys } from '../../data/helper/sourceHelper.js';\nimport { SOURCE_FORMAT_ORIGINAL } from '../../util/types.js';\n\nfunction getCoordSysDimDefs(seriesModel, coordSysInfo) {\n var coordSysName = seriesModel.get('coordinateSystem');\n var registeredCoordSys = CoordinateSystem.get(coordSysName);\n var coordSysDimDefs;\n\n if (coordSysInfo && coordSysInfo.coordSysDims) {\n coordSysDimDefs = zrUtil.map(coordSysInfo.coordSysDims, function (dim) {\n var dimInfo = {\n name: dim\n };\n var axisModel = coordSysInfo.axisMap.get(dim);\n\n if (axisModel) {\n var axisType = axisModel.get('type');\n dimInfo.type = getDimensionTypeByAxis(axisType);\n }\n\n return dimInfo;\n });\n }\n\n if (!coordSysDimDefs) {\n // Get dimensions from registered coordinate system\n coordSysDimDefs = registeredCoordSys && (registeredCoordSys.getDimensionsInfo ? registeredCoordSys.getDimensionsInfo() : registeredCoordSys.dimensions.slice()) || ['x', 'y'];\n }\n\n return coordSysDimDefs;\n}\n\nfunction injectOrdinalMeta(dimInfoList, createInvertedIndices, coordSysInfo) {\n var firstCategoryDimIndex;\n var hasNameEncode;\n coordSysInfo && zrUtil.each(dimInfoList, function (dimInfo, dimIndex) {\n var coordDim = dimInfo.coordDim;\n var categoryAxisModel = coordSysInfo.categoryAxisMap.get(coordDim);\n\n if (categoryAxisModel) {\n if (firstCategoryDimIndex == null) {\n firstCategoryDimIndex = dimIndex;\n }\n\n dimInfo.ordinalMeta = categoryAxisModel.getOrdinalMeta();\n\n if (createInvertedIndices) {\n dimInfo.createInvertedIndices = true;\n }\n }\n\n if (dimInfo.otherDims.itemName != null) {\n hasNameEncode = true;\n }\n });\n\n if (!hasNameEncode && firstCategoryDimIndex != null) {\n dimInfoList[firstCategoryDimIndex].otherDims.itemName = 0;\n }\n\n return firstCategoryDimIndex;\n}\n/**\n * Caution: there are side effects to `sourceManager` in this method.\n * Should better only be called in `Series['getInitialData']`.\n */\n\n\nfunction createSeriesData(sourceRaw, seriesModel, opt) {\n opt = opt || {};\n var sourceManager = seriesModel.getSourceManager();\n var source;\n var isOriginalSource = false;\n\n if (sourceRaw) {\n isOriginalSource = true;\n source = createSourceFromSeriesDataOption(sourceRaw);\n } else {\n source = sourceManager.getSource(); // Is series.data. not dataset.\n\n isOriginalSource = source.sourceFormat === SOURCE_FORMAT_ORIGINAL;\n }\n\n var coordSysInfo = getCoordSysInfoBySeries(seriesModel);\n var coordSysDimDefs = getCoordSysDimDefs(seriesModel, coordSysInfo);\n var useEncodeDefaulter = opt.useEncodeDefaulter;\n var encodeDefaulter = zrUtil.isFunction(useEncodeDefaulter) ? useEncodeDefaulter : useEncodeDefaulter ? zrUtil.curry(makeSeriesEncodeForAxisCoordSys, coordSysDimDefs, seriesModel) : null;\n var createDimensionOptions = {\n coordDimensions: coordSysDimDefs,\n generateCoord: opt.generateCoord,\n encodeDefine: seriesModel.getEncode(),\n encodeDefaulter: encodeDefaulter,\n canOmitUnusedDimensions: !isOriginalSource\n };\n var schema = prepareSeriesDataSchema(source, createDimensionOptions);\n var firstCategoryDimIndex = injectOrdinalMeta(schema.dimensions, opt.createInvertedIndices, coordSysInfo);\n var store = !isOriginalSource ? sourceManager.getSharedDataStore(schema) : null;\n var stackCalculationInfo = enableDataStack(seriesModel, {\n schema: schema,\n store: store\n });\n var data = new SeriesData(schema, seriesModel);\n data.setCalculationInfo(stackCalculationInfo);\n var dimValueGetter = firstCategoryDimIndex != null && isNeedCompleteOrdinalData(source) ? function (itemOpt, dimName, dataIndex, dimIndex) {\n // Use dataIndex as ordinal value in categoryAxis\n return dimIndex === firstCategoryDimIndex ? dataIndex : this.defaultDimValueGetter(itemOpt, dimName, dataIndex, dimIndex);\n } : null;\n data.hasItemOption = false;\n data.initData( // Try to reuse the data store in sourceManager if using dataset.\n isOriginalSource ? source : store, null, dimValueGetter);\n return data;\n}\n\nfunction isNeedCompleteOrdinalData(source) {\n if (source.sourceFormat === SOURCE_FORMAT_ORIGINAL) {\n var sampleItem = firstDataNotNull(source.data || []);\n return !zrUtil.isArray(getDataItemValue(sampleItem));\n }\n}\n\nfunction firstDataNotNull(arr) {\n var i = 0;\n\n while (i < arr.length && arr[i] == null) {\n i++;\n }\n\n return arr[i];\n}\n\nexport default createSeriesData;","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { __extends } from \"tslib\";\nimport createSeriesData from '../helper/createSeriesData.js';\nimport SeriesModel from '../../model/Series.js';\nimport { createSymbol } from '../../util/symbol.js';\nimport { Group } from '../../util/graphic.js';\n\nvar LineSeriesModel =\n/** @class */\nfunction (_super) {\n __extends(LineSeriesModel, _super);\n\n function LineSeriesModel() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n\n _this.type = LineSeriesModel.type;\n _this.hasSymbolVisual = true;\n return _this;\n }\n\n LineSeriesModel.prototype.getInitialData = function (option) {\n if (process.env.NODE_ENV !== 'production') {\n var coordSys = option.coordinateSystem;\n\n if (coordSys !== 'polar' && coordSys !== 'cartesian2d') {\n throw new Error('Line not support coordinateSystem besides cartesian and polar');\n }\n }\n\n return createSeriesData(null, this, {\n useEncodeDefaulter: true\n });\n };\n\n LineSeriesModel.prototype.getLegendIcon = function (opt) {\n var group = new Group();\n var line = createSymbol('line', 0, opt.itemHeight / 2, opt.itemWidth, 0, opt.lineStyle.stroke, false);\n group.add(line);\n line.setStyle(opt.lineStyle);\n var visualType = this.getData().getVisual('symbol');\n var visualRotate = this.getData().getVisual('symbolRotate');\n var symbolType = visualType === 'none' ? 'circle' : visualType; // Symbol size is 80% when there is a line\n\n var size = opt.itemHeight * 0.8;\n var symbol = createSymbol(symbolType, (opt.itemWidth - size) / 2, (opt.itemHeight - size) / 2, size, size, opt.itemStyle.fill);\n group.add(symbol);\n symbol.setStyle(opt.itemStyle);\n var symbolRotate = opt.iconRotate === 'inherit' ? visualRotate : opt.iconRotate || 0;\n symbol.rotation = symbolRotate * Math.PI / 180;\n symbol.setOrigin([opt.itemWidth / 2, opt.itemHeight / 2]);\n\n if (symbolType.indexOf('empty') > -1) {\n symbol.style.stroke = symbol.style.fill;\n symbol.style.fill = '#fff';\n symbol.style.lineWidth = 2;\n }\n\n return group;\n };\n\n LineSeriesModel.type = 'series.line';\n LineSeriesModel.dependencies = ['grid', 'polar'];\n LineSeriesModel.defaultOption = {\n // zlevel: 0,\n z: 3,\n coordinateSystem: 'cartesian2d',\n legendHoverLink: true,\n clip: true,\n label: {\n position: 'top'\n },\n // itemStyle: {\n // },\n endLabel: {\n show: false,\n valueAnimation: true,\n distance: 8\n },\n lineStyle: {\n width: 2,\n type: 'solid'\n },\n emphasis: {\n scale: true\n },\n // areaStyle: {\n // origin of areaStyle. Valid values:\n // `'auto'/null/undefined`: from axisLine to data\n // `'start'`: from min to data\n // `'end'`: from data to max\n // origin: 'auto'\n // },\n // false, 'start', 'end', 'middle'\n step: false,\n // Disabled if step is true\n smooth: false,\n smoothMonotone: null,\n symbol: 'emptyCircle',\n symbolSize: 4,\n symbolRotate: null,\n showSymbol: true,\n // `false`: follow the label interval strategy.\n // `true`: show all symbols.\n // `'auto'`: If possible, show all symbols, otherwise\n // follow the label interval strategy.\n showAllSymbol: 'auto',\n // Whether to connect break point.\n connectNulls: false,\n // Sampling for large data. Can be: 'average', 'max', 'min', 'sum', 'lttb'.\n sampling: 'none',\n animationEasing: 'linear',\n // Disable progressive\n progressive: 0,\n hoverLayerThreshold: Infinity,\n universalTransition: {\n divideShape: 'clone'\n },\n triggerLineEvent: false\n };\n return LineSeriesModel;\n}(SeriesModel);\n\nexport default LineSeriesModel;","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { retrieveRawValue } from '../../data/helper/dataProvider.js';\nimport { isArray } from 'zrender/lib/core/util.js';\n/**\n * @return label string. Not null/undefined\n */\n\nexport function getDefaultLabel(data, dataIndex) {\n var labelDims = data.mapDimensionsAll('defaultedLabel');\n var len = labelDims.length; // Simple optimization (in lots of cases, label dims length is 1)\n\n if (len === 1) {\n var rawVal = retrieveRawValue(data, dataIndex, labelDims[0]);\n return rawVal != null ? rawVal + '' : null;\n } else if (len) {\n var vals = [];\n\n for (var i = 0; i < labelDims.length; i++) {\n vals.push(retrieveRawValue(data, dataIndex, labelDims[i]));\n }\n\n return vals.join(' ');\n }\n}\nexport function getDefaultInterpolatedLabel(data, interpolatedValue) {\n var labelDims = data.mapDimensionsAll('defaultedLabel');\n\n if (!isArray(interpolatedValue)) {\n return interpolatedValue + '';\n }\n\n var vals = [];\n\n for (var i = 0; i < labelDims.length; i++) {\n var dimIndex = data.getDimensionIndex(labelDims[i]);\n\n if (dimIndex >= 0) {\n vals.push(interpolatedValue[dimIndex]);\n }\n }\n\n return vals.join(' ');\n}","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { __extends } from \"tslib\";\nimport { createSymbol, normalizeSymbolOffset, normalizeSymbolSize } from '../../util/symbol.js';\nimport * as graphic from '../../util/graphic.js';\nimport { getECData } from '../../util/innerStore.js';\nimport { enterEmphasis, leaveEmphasis, toggleHoverEmphasis } from '../../util/states.js';\nimport { getDefaultLabel } from './labelHelper.js';\nimport { extend } from 'zrender/lib/core/util.js';\nimport { setLabelStyle, getLabelStatesModels } from '../../label/labelStyle.js';\nimport ZRImage from 'zrender/lib/graphic/Image.js';\nimport { saveOldStyle } from '../../animation/basicTrasition.js';\n\nvar Symbol =\n/** @class */\nfunction (_super) {\n __extends(Symbol, _super);\n\n function Symbol(data, idx, seriesScope, opts) {\n var _this = _super.call(this) || this;\n\n _this.updateData(data, idx, seriesScope, opts);\n\n return _this;\n }\n\n Symbol.prototype._createSymbol = function (symbolType, data, idx, symbolSize, keepAspect) {\n // Remove paths created before\n this.removeAll(); // let symbolPath = createSymbol(\n // symbolType, -0.5, -0.5, 1, 1, color\n // );\n // If width/height are set too small (e.g., set to 1) on ios10\n // and macOS Sierra, a circle stroke become a rect, no matter what\n // the scale is set. So we set width/height as 2. See #4150.\n\n var symbolPath = createSymbol(symbolType, -1, -1, 2, 2, null, keepAspect);\n symbolPath.attr({\n z2: 100,\n culling: true,\n scaleX: symbolSize[0] / 2,\n scaleY: symbolSize[1] / 2\n }); // Rewrite drift method\n\n symbolPath.drift = driftSymbol;\n this._symbolType = symbolType;\n this.add(symbolPath);\n };\n /**\n * Stop animation\n * @param {boolean} toLastFrame\n */\n\n\n Symbol.prototype.stopSymbolAnimation = function (toLastFrame) {\n this.childAt(0).stopAnimation(null, toLastFrame);\n };\n\n Symbol.prototype.getSymbolType = function () {\n return this._symbolType;\n };\n /**\n * FIXME:\n * Caution: This method breaks the encapsulation of this module,\n * but it indeed brings convenience. So do not use the method\n * unless you detailedly know all the implements of `Symbol`,\n * especially animation.\n *\n * Get symbol path element.\n */\n\n\n Symbol.prototype.getSymbolPath = function () {\n return this.childAt(0);\n };\n /**\n * Highlight symbol\n */\n\n\n Symbol.prototype.highlight = function () {\n enterEmphasis(this.childAt(0));\n };\n /**\n * Downplay symbol\n */\n\n\n Symbol.prototype.downplay = function () {\n leaveEmphasis(this.childAt(0));\n };\n /**\n * @param {number} zlevel\n * @param {number} z\n */\n\n\n Symbol.prototype.setZ = function (zlevel, z) {\n var symbolPath = this.childAt(0);\n symbolPath.zlevel = zlevel;\n symbolPath.z = z;\n };\n\n Symbol.prototype.setDraggable = function (draggable) {\n var symbolPath = this.childAt(0);\n symbolPath.draggable = draggable;\n symbolPath.cursor = draggable ? 'move' : symbolPath.cursor;\n };\n /**\n * Update symbol properties\n */\n\n\n Symbol.prototype.updateData = function (data, idx, seriesScope, opts) {\n this.silent = false;\n var symbolType = data.getItemVisual(idx, 'symbol') || 'circle';\n var seriesModel = data.hostModel;\n var symbolSize = Symbol.getSymbolSize(data, idx);\n var isInit = symbolType !== this._symbolType;\n var disableAnimation = opts && opts.disableAnimation;\n\n if (isInit) {\n var keepAspect = data.getItemVisual(idx, 'symbolKeepAspect');\n\n this._createSymbol(symbolType, data, idx, symbolSize, keepAspect);\n } else {\n var symbolPath = this.childAt(0);\n symbolPath.silent = false;\n var target = {\n scaleX: symbolSize[0] / 2,\n scaleY: symbolSize[1] / 2\n };\n disableAnimation ? symbolPath.attr(target) : graphic.updateProps(symbolPath, target, seriesModel, idx);\n saveOldStyle(symbolPath);\n }\n\n this._updateCommon(data, idx, symbolSize, seriesScope, opts);\n\n if (isInit) {\n var symbolPath = this.childAt(0);\n\n if (!disableAnimation) {\n var target = {\n scaleX: this._sizeX,\n scaleY: this._sizeY,\n style: {\n // Always fadeIn. Because it has fadeOut animation when symbol is removed..\n opacity: symbolPath.style.opacity\n }\n };\n symbolPath.scaleX = symbolPath.scaleY = 0;\n symbolPath.style.opacity = 0;\n graphic.initProps(symbolPath, target, seriesModel, idx);\n }\n }\n\n if (disableAnimation) {\n // Must stop leave transition manually if don't call initProps or updateProps.\n this.childAt(0).stopAnimation('leave');\n }\n\n this._seriesModel = seriesModel;\n };\n\n Symbol.prototype._updateCommon = function (data, idx, symbolSize, seriesScope, opts) {\n var symbolPath = this.childAt(0);\n var seriesModel = data.hostModel;\n var emphasisItemStyle;\n var blurItemStyle;\n var selectItemStyle;\n var focus;\n var blurScope;\n var emphasisDisabled;\n var labelStatesModels;\n var hoverScale;\n var cursorStyle;\n\n if (seriesScope) {\n emphasisItemStyle = seriesScope.emphasisItemStyle;\n blurItemStyle = seriesScope.blurItemStyle;\n selectItemStyle = seriesScope.selectItemStyle;\n focus = seriesScope.focus;\n blurScope = seriesScope.blurScope;\n labelStatesModels = seriesScope.labelStatesModels;\n hoverScale = seriesScope.hoverScale;\n cursorStyle = seriesScope.cursorStyle;\n emphasisDisabled = seriesScope.emphasisDisabled;\n }\n\n if (!seriesScope || data.hasItemOption) {\n var itemModel = seriesScope && seriesScope.itemModel ? seriesScope.itemModel : data.getItemModel(idx);\n var emphasisModel = itemModel.getModel('emphasis');\n emphasisItemStyle = emphasisModel.getModel('itemStyle').getItemStyle();\n selectItemStyle = itemModel.getModel(['select', 'itemStyle']).getItemStyle();\n blurItemStyle = itemModel.getModel(['blur', 'itemStyle']).getItemStyle();\n focus = emphasisModel.get('focus');\n blurScope = emphasisModel.get('blurScope');\n emphasisDisabled = emphasisModel.get('disabled');\n labelStatesModels = getLabelStatesModels(itemModel);\n hoverScale = emphasisModel.getShallow('scale');\n cursorStyle = itemModel.getShallow('cursor');\n }\n\n var symbolRotate = data.getItemVisual(idx, 'symbolRotate');\n symbolPath.attr('rotation', (symbolRotate || 0) * Math.PI / 180 || 0);\n var symbolOffset = normalizeSymbolOffset(data.getItemVisual(idx, 'symbolOffset'), symbolSize);\n\n if (symbolOffset) {\n symbolPath.x = symbolOffset[0];\n symbolPath.y = symbolOffset[1];\n }\n\n cursorStyle && symbolPath.attr('cursor', cursorStyle);\n var symbolStyle = data.getItemVisual(idx, 'style');\n var visualColor = symbolStyle.fill;\n\n if (symbolPath instanceof ZRImage) {\n var pathStyle = symbolPath.style;\n symbolPath.useStyle(extend({\n // TODO other properties like x, y ?\n image: pathStyle.image,\n x: pathStyle.x,\n y: pathStyle.y,\n width: pathStyle.width,\n height: pathStyle.height\n }, symbolStyle));\n } else {\n if (symbolPath.__isEmptyBrush) {\n // fill and stroke will be swapped if it's empty.\n // So we cloned a new style to avoid it affecting the original style in visual storage.\n // TODO Better implementation. No empty logic!\n symbolPath.useStyle(extend({}, symbolStyle));\n } else {\n symbolPath.useStyle(symbolStyle);\n } // Disable decal because symbol scale will been applied on the decal.\n\n\n symbolPath.style.decal = null;\n symbolPath.setColor(visualColor, opts && opts.symbolInnerColor);\n symbolPath.style.strokeNoScale = true;\n }\n\n var liftZ = data.getItemVisual(idx, 'liftZ');\n var z2Origin = this._z2;\n\n if (liftZ != null) {\n if (z2Origin == null) {\n this._z2 = symbolPath.z2;\n symbolPath.z2 += liftZ;\n }\n } else if (z2Origin != null) {\n symbolPath.z2 = z2Origin;\n this._z2 = null;\n }\n\n var useNameLabel = opts && opts.useNameLabel;\n setLabelStyle(symbolPath, labelStatesModels, {\n labelFetcher: seriesModel,\n labelDataIndex: idx,\n defaultText: getLabelDefaultText,\n inheritColor: visualColor,\n defaultOpacity: symbolStyle.opacity\n }); // Do not execute util needed.\n\n function getLabelDefaultText(idx) {\n return useNameLabel ? data.getName(idx) : getDefaultLabel(data, idx);\n }\n\n this._sizeX = symbolSize[0] / 2;\n this._sizeY = symbolSize[1] / 2;\n var emphasisState = symbolPath.ensureState('emphasis');\n emphasisState.style = emphasisItemStyle;\n symbolPath.ensureState('select').style = selectItemStyle;\n symbolPath.ensureState('blur').style = blurItemStyle;\n\n if (hoverScale) {\n var scaleRatio = Math.max(1.1, 3 / this._sizeY);\n emphasisState.scaleX = this._sizeX * scaleRatio;\n emphasisState.scaleY = this._sizeY * scaleRatio;\n }\n\n this.setSymbolScale(1);\n toggleHoverEmphasis(this, focus, blurScope, emphasisDisabled);\n };\n\n Symbol.prototype.setSymbolScale = function (scale) {\n this.scaleX = this.scaleY = scale;\n };\n\n Symbol.prototype.fadeOut = function (cb, opt) {\n var symbolPath = this.childAt(0);\n var seriesModel = this._seriesModel;\n var dataIndex = getECData(this).dataIndex;\n var animationOpt = opt && opt.animation; // Avoid mistaken hover when fading out\n\n this.silent = symbolPath.silent = true; // Not show text when animating\n\n if (opt && opt.fadeLabel) {\n var textContent = symbolPath.getTextContent();\n\n if (textContent) {\n graphic.removeElement(textContent, {\n style: {\n opacity: 0\n }\n }, seriesModel, {\n dataIndex: dataIndex,\n removeOpt: animationOpt,\n cb: function () {\n symbolPath.removeTextContent();\n }\n });\n }\n } else {\n symbolPath.removeTextContent();\n }\n\n graphic.removeElement(symbolPath, {\n style: {\n opacity: 0\n },\n scaleX: 0,\n scaleY: 0\n }, seriesModel, {\n dataIndex: dataIndex,\n cb: cb,\n removeOpt: animationOpt\n });\n };\n\n Symbol.getSymbolSize = function (data, idx) {\n return normalizeSymbolSize(data.getItemVisual(idx, 'symbolSize'));\n };\n\n return Symbol;\n}(graphic.Group);\n\nfunction driftSymbol(dx, dy) {\n this.parent.drift(dx, dy);\n}\n\nexport default Symbol;","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport * as graphic from '../../util/graphic.js';\nimport SymbolClz from './Symbol.js';\nimport { isObject } from 'zrender/lib/core/util.js';\nimport { getLabelStatesModels } from '../../label/labelStyle.js';\n\nfunction symbolNeedsDraw(data, point, idx, opt) {\n return point && !isNaN(point[0]) && !isNaN(point[1]) && !(opt.isIgnore && opt.isIgnore(idx)) // We do not set clipShape on group, because it will cut part of\n // the symbol element shape. We use the same clip shape here as\n // the line clip.\n && !(opt.clipShape && !opt.clipShape.contain(point[0], point[1])) && data.getItemVisual(idx, 'symbol') !== 'none';\n}\n\nfunction normalizeUpdateOpt(opt) {\n if (opt != null && !isObject(opt)) {\n opt = {\n isIgnore: opt\n };\n }\n\n return opt || {};\n}\n\nfunction makeSeriesScope(data) {\n var seriesModel = data.hostModel;\n var emphasisModel = seriesModel.getModel('emphasis');\n return {\n emphasisItemStyle: emphasisModel.getModel('itemStyle').getItemStyle(),\n blurItemStyle: seriesModel.getModel(['blur', 'itemStyle']).getItemStyle(),\n selectItemStyle: seriesModel.getModel(['select', 'itemStyle']).getItemStyle(),\n focus: emphasisModel.get('focus'),\n blurScope: emphasisModel.get('blurScope'),\n emphasisDisabled: emphasisModel.get('disabled'),\n hoverScale: emphasisModel.get('scale'),\n labelStatesModels: getLabelStatesModels(seriesModel),\n cursorStyle: seriesModel.get('cursor')\n };\n}\n\nvar SymbolDraw =\n/** @class */\nfunction () {\n function SymbolDraw(SymbolCtor) {\n this.group = new graphic.Group();\n this._SymbolCtor = SymbolCtor || SymbolClz;\n }\n /**\n * Update symbols draw by new data\n */\n\n\n SymbolDraw.prototype.updateData = function (data, opt) {\n // Remove progressive els.\n this._progressiveEls = null;\n opt = normalizeUpdateOpt(opt);\n var group = this.group;\n var seriesModel = data.hostModel;\n var oldData = this._data;\n var SymbolCtor = this._SymbolCtor;\n var disableAnimation = opt.disableAnimation;\n var seriesScope = makeSeriesScope(data);\n var symbolUpdateOpt = {\n disableAnimation: disableAnimation\n };\n\n var getSymbolPoint = opt.getSymbolPoint || function (idx) {\n return data.getItemLayout(idx);\n }; // There is no oldLineData only when first rendering or switching from\n // stream mode to normal mode, where previous elements should be removed.\n\n\n if (!oldData) {\n group.removeAll();\n }\n\n data.diff(oldData).add(function (newIdx) {\n var point = getSymbolPoint(newIdx);\n\n if (symbolNeedsDraw(data, point, newIdx, opt)) {\n var symbolEl = new SymbolCtor(data, newIdx, seriesScope, symbolUpdateOpt);\n symbolEl.setPosition(point);\n data.setItemGraphicEl(newIdx, symbolEl);\n group.add(symbolEl);\n }\n }).update(function (newIdx, oldIdx) {\n var symbolEl = oldData.getItemGraphicEl(oldIdx);\n var point = getSymbolPoint(newIdx);\n\n if (!symbolNeedsDraw(data, point, newIdx, opt)) {\n group.remove(symbolEl);\n return;\n }\n\n var newSymbolType = data.getItemVisual(newIdx, 'symbol') || 'circle';\n var oldSymbolType = symbolEl && symbolEl.getSymbolType && symbolEl.getSymbolType();\n\n if (!symbolEl // Create a new if symbol type changed.\n || oldSymbolType && oldSymbolType !== newSymbolType) {\n group.remove(symbolEl);\n symbolEl = new SymbolCtor(data, newIdx, seriesScope, symbolUpdateOpt);\n symbolEl.setPosition(point);\n } else {\n symbolEl.updateData(data, newIdx, seriesScope, symbolUpdateOpt);\n var target = {\n x: point[0],\n y: point[1]\n };\n disableAnimation ? symbolEl.attr(target) : graphic.updateProps(symbolEl, target, seriesModel);\n } // Add back\n\n\n group.add(symbolEl);\n data.setItemGraphicEl(newIdx, symbolEl);\n }).remove(function (oldIdx) {\n var el = oldData.getItemGraphicEl(oldIdx);\n el && el.fadeOut(function () {\n group.remove(el);\n });\n }).execute();\n this._getSymbolPoint = getSymbolPoint;\n this._data = data;\n };\n\n ;\n\n SymbolDraw.prototype.updateLayout = function () {\n var _this = this;\n\n var data = this._data;\n\n if (data) {\n // Not use animation\n data.eachItemGraphicEl(function (el, idx) {\n var point = _this._getSymbolPoint(idx);\n\n el.setPosition(point);\n el.markRedraw();\n });\n }\n };\n\n ;\n\n SymbolDraw.prototype.incrementalPrepareUpdate = function (data) {\n this._seriesScope = makeSeriesScope(data);\n this._data = null;\n this.group.removeAll();\n };\n\n ;\n /**\n * Update symbols draw by new data\n */\n\n SymbolDraw.prototype.incrementalUpdate = function (taskParams, data, opt) {\n // Clear\n this._progressiveEls = [];\n opt = normalizeUpdateOpt(opt);\n\n function updateIncrementalAndHover(el) {\n if (!el.isGroup) {\n el.incremental = true;\n el.ensureState('emphasis').hoverLayer = true;\n }\n }\n\n for (var idx = taskParams.start; idx < taskParams.end; idx++) {\n var point = data.getItemLayout(idx);\n\n if (symbolNeedsDraw(data, point, idx, opt)) {\n var el = new this._SymbolCtor(data, idx, this._seriesScope);\n el.traverse(updateIncrementalAndHover);\n el.setPosition(point);\n this.group.add(el);\n data.setItemGraphicEl(idx, el);\n\n this._progressiveEls.push(el);\n }\n }\n };\n\n ;\n\n SymbolDraw.prototype.eachRendered = function (cb) {\n graphic.traverseElements(this._progressiveEls || this.group, cb);\n };\n\n SymbolDraw.prototype.remove = function (enableAnimation) {\n var group = this.group;\n var data = this._data; // Incremental model do not have this._data.\n\n if (data && enableAnimation) {\n data.eachItemGraphicEl(function (el) {\n el.fadeOut(function () {\n group.remove(el);\n });\n });\n } else {\n group.removeAll();\n }\n };\n\n ;\n return SymbolDraw;\n}();\n\nexport default SymbolDraw;","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { isDimensionStacked } from '../../data/helper/dataStackHelper.js';\nimport { map } from 'zrender/lib/core/util.js';\nexport function prepareDataCoordInfo(coordSys, data, valueOrigin) {\n var baseAxis = coordSys.getBaseAxis();\n var valueAxis = coordSys.getOtherAxis(baseAxis);\n var valueStart = getValueStart(valueAxis, valueOrigin);\n var baseAxisDim = baseAxis.dim;\n var valueAxisDim = valueAxis.dim;\n var valueDim = data.mapDimension(valueAxisDim);\n var baseDim = data.mapDimension(baseAxisDim);\n var baseDataOffset = valueAxisDim === 'x' || valueAxisDim === 'radius' ? 1 : 0;\n var dims = map(coordSys.dimensions, function (coordDim) {\n return data.mapDimension(coordDim);\n });\n var stacked = false;\n var stackResultDim = data.getCalculationInfo('stackResultDimension');\n\n if (isDimensionStacked(data, dims[0]\n /*, dims[1]*/\n )) {\n // jshint ignore:line\n stacked = true;\n dims[0] = stackResultDim;\n }\n\n if (isDimensionStacked(data, dims[1]\n /*, dims[0]*/\n )) {\n // jshint ignore:line\n stacked = true;\n dims[1] = stackResultDim;\n }\n\n return {\n dataDimsForPoint: dims,\n valueStart: valueStart,\n valueAxisDim: valueAxisDim,\n baseAxisDim: baseAxisDim,\n stacked: !!stacked,\n valueDim: valueDim,\n baseDim: baseDim,\n baseDataOffset: baseDataOffset,\n stackedOverDimension: data.getCalculationInfo('stackedOverDimension')\n };\n}\n\nfunction getValueStart(valueAxis, valueOrigin) {\n var valueStart = 0;\n var extent = valueAxis.scale.getExtent();\n\n if (valueOrigin === 'start') {\n valueStart = extent[0];\n } else if (valueOrigin === 'end') {\n valueStart = extent[1];\n } // auto\n else {\n // Both positive\n if (extent[0] > 0) {\n valueStart = extent[0];\n } // Both negative\n else if (extent[1] < 0) {\n valueStart = extent[1];\n } // If is one positive, and one negative, onZero shall be true\n\n }\n\n return valueStart;\n}\n\nexport function getStackedOnPoint(dataCoordInfo, coordSys, data, idx) {\n var value = NaN;\n\n if (dataCoordInfo.stacked) {\n value = data.get(data.getCalculationInfo('stackedOverDimension'), idx);\n }\n\n if (isNaN(value)) {\n value = dataCoordInfo.valueStart;\n }\n\n var baseDataOffset = dataCoordInfo.baseDataOffset;\n var stackedData = [];\n stackedData[baseDataOffset] = data.get(dataCoordInfo.baseDim, idx);\n stackedData[1 - baseDataOffset] = value;\n return coordSys.dataToPoint(stackedData);\n}","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { isArray } from 'zrender/lib/core/util.js';\n/* global Float32Array */\n\nvar supportFloat32Array = typeof Float32Array !== 'undefined';\nvar Float32ArrayCtor = !supportFloat32Array ? Array : Float32Array;\nexport function createFloat32Array(arg) {\n if (isArray(arg)) {\n // Return self directly if don't support TypedArray.\n return supportFloat32Array ? new Float32Array(arg) : arg;\n } // Else is number\n\n\n return new Float32ArrayCtor(arg);\n}","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { prepareDataCoordInfo, getStackedOnPoint } from './helper.js';\nimport { createFloat32Array } from '../../util/vendor.js';\n\nfunction diffData(oldData, newData) {\n var diffResult = [];\n newData.diff(oldData).add(function (idx) {\n diffResult.push({\n cmd: '+',\n idx: idx\n });\n }).update(function (newIdx, oldIdx) {\n diffResult.push({\n cmd: '=',\n idx: oldIdx,\n idx1: newIdx\n });\n }).remove(function (idx) {\n diffResult.push({\n cmd: '-',\n idx: idx\n });\n }).execute();\n return diffResult;\n}\n\nexport default function lineAnimationDiff(oldData, newData, oldStackedOnPoints, newStackedOnPoints, oldCoordSys, newCoordSys, oldValueOrigin, newValueOrigin) {\n var diff = diffData(oldData, newData); // let newIdList = newData.mapArray(newData.getId);\n // let oldIdList = oldData.mapArray(oldData.getId);\n // convertToIntId(newIdList, oldIdList);\n // // FIXME One data ?\n // diff = arrayDiff(oldIdList, newIdList);\n\n var currPoints = [];\n var nextPoints = []; // Points for stacking base line\n\n var currStackedPoints = [];\n var nextStackedPoints = [];\n var status = [];\n var sortedIndices = [];\n var rawIndices = [];\n var newDataOldCoordInfo = prepareDataCoordInfo(oldCoordSys, newData, oldValueOrigin); // const oldDataNewCoordInfo = prepareDataCoordInfo(newCoordSys, oldData, newValueOrigin);\n\n var oldPoints = oldData.getLayout('points') || [];\n var newPoints = newData.getLayout('points') || [];\n\n for (var i = 0; i < diff.length; i++) {\n var diffItem = diff[i];\n var pointAdded = true;\n var oldIdx2 = void 0;\n var newIdx2 = void 0; // FIXME, animation is not so perfect when dataZoom window moves fast\n // Which is in case remvoing or add more than one data in the tail or head\n\n switch (diffItem.cmd) {\n case '=':\n oldIdx2 = diffItem.idx * 2;\n newIdx2 = diffItem.idx1 * 2;\n var currentX = oldPoints[oldIdx2];\n var currentY = oldPoints[oldIdx2 + 1];\n var nextX = newPoints[newIdx2];\n var nextY = newPoints[newIdx2 + 1]; // If previous data is NaN, use next point directly\n\n if (isNaN(currentX) || isNaN(currentY)) {\n currentX = nextX;\n currentY = nextY;\n }\n\n currPoints.push(currentX, currentY);\n nextPoints.push(nextX, nextY);\n currStackedPoints.push(oldStackedOnPoints[oldIdx2], oldStackedOnPoints[oldIdx2 + 1]);\n nextStackedPoints.push(newStackedOnPoints[newIdx2], newStackedOnPoints[newIdx2 + 1]);\n rawIndices.push(newData.getRawIndex(diffItem.idx1));\n break;\n\n case '+':\n var newIdx = diffItem.idx;\n var newDataDimsForPoint = newDataOldCoordInfo.dataDimsForPoint;\n var oldPt = oldCoordSys.dataToPoint([newData.get(newDataDimsForPoint[0], newIdx), newData.get(newDataDimsForPoint[1], newIdx)]);\n newIdx2 = newIdx * 2;\n currPoints.push(oldPt[0], oldPt[1]);\n nextPoints.push(newPoints[newIdx2], newPoints[newIdx2 + 1]);\n var stackedOnPoint = getStackedOnPoint(newDataOldCoordInfo, oldCoordSys, newData, newIdx);\n currStackedPoints.push(stackedOnPoint[0], stackedOnPoint[1]);\n nextStackedPoints.push(newStackedOnPoints[newIdx2], newStackedOnPoints[newIdx2 + 1]);\n rawIndices.push(newData.getRawIndex(newIdx));\n break;\n\n case '-':\n pointAdded = false;\n } // Original indices\n\n\n if (pointAdded) {\n status.push(diffItem);\n sortedIndices.push(sortedIndices.length);\n }\n } // Diff result may be crossed if all items are changed\n // Sort by data index\n\n\n sortedIndices.sort(function (a, b) {\n return rawIndices[a] - rawIndices[b];\n });\n var len = currPoints.length;\n var sortedCurrPoints = createFloat32Array(len);\n var sortedNextPoints = createFloat32Array(len);\n var sortedCurrStackedPoints = createFloat32Array(len);\n var sortedNextStackedPoints = createFloat32Array(len);\n var sortedStatus = [];\n\n for (var i = 0; i < sortedIndices.length; i++) {\n var idx = sortedIndices[i];\n var i2 = i * 2;\n var idx2 = idx * 2;\n sortedCurrPoints[i2] = currPoints[idx2];\n sortedCurrPoints[i2 + 1] = currPoints[idx2 + 1];\n sortedNextPoints[i2] = nextPoints[idx2];\n sortedNextPoints[i2 + 1] = nextPoints[idx2 + 1];\n sortedCurrStackedPoints[i2] = currStackedPoints[idx2];\n sortedCurrStackedPoints[i2 + 1] = currStackedPoints[idx2 + 1];\n sortedNextStackedPoints[i2] = nextStackedPoints[idx2];\n sortedNextStackedPoints[i2 + 1] = nextStackedPoints[idx2 + 1];\n sortedStatus[i] = status[idx];\n }\n\n return {\n current: sortedCurrPoints,\n next: sortedNextPoints,\n stackedOnCurrent: sortedCurrStackedPoints,\n stackedOnNext: sortedNextStackedPoints,\n status: sortedStatus\n };\n}","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { __extends } from \"tslib\"; // Poly path support NaN point\n\nimport Path from 'zrender/lib/graphic/Path.js';\nimport PathProxy from 'zrender/lib/core/PathProxy.js';\nimport { cubicRootAt, cubicAt } from 'zrender/lib/core/curve.js';\nvar mathMin = Math.min;\nvar mathMax = Math.max;\n\nfunction isPointNull(x, y) {\n return isNaN(x) || isNaN(y);\n}\n/**\n * Draw smoothed line in non-monotone, in may cause undesired curve in extreme\n * situations. This should be used when points are non-monotone neither in x or\n * y dimension.\n */\n\n\nfunction drawSegment(ctx, points, start, segLen, allLen, dir, smooth, smoothMonotone, connectNulls) {\n var prevX;\n var prevY;\n var cpx0;\n var cpy0;\n var cpx1;\n var cpy1;\n var idx = start;\n var k = 0;\n\n for (; k < segLen; k++) {\n var x = points[idx * 2];\n var y = points[idx * 2 + 1];\n\n if (idx >= allLen || idx < 0) {\n break;\n }\n\n if (isPointNull(x, y)) {\n if (connectNulls) {\n idx += dir;\n continue;\n }\n\n break;\n }\n\n if (idx === start) {\n ctx[dir > 0 ? 'moveTo' : 'lineTo'](x, y);\n cpx0 = x;\n cpy0 = y;\n } else {\n var dx = x - prevX;\n var dy = y - prevY; // Ignore tiny segment.\n\n if (dx * dx + dy * dy < 0.5) {\n idx += dir;\n continue;\n }\n\n if (smooth > 0) {\n var nextIdx = idx + dir;\n var nextX = points[nextIdx * 2];\n var nextY = points[nextIdx * 2 + 1]; // Ignore duplicate point\n\n while (nextX === x && nextY === y && k < segLen) {\n k++;\n nextIdx += dir;\n idx += dir;\n nextX = points[nextIdx * 2];\n nextY = points[nextIdx * 2 + 1];\n x = points[idx * 2];\n y = points[idx * 2 + 1];\n dx = x - prevX;\n dy = y - prevY;\n }\n\n var tmpK = k + 1;\n\n if (connectNulls) {\n // Find next point not null\n while (isPointNull(nextX, nextY) && tmpK < segLen) {\n tmpK++;\n nextIdx += dir;\n nextX = points[nextIdx * 2];\n nextY = points[nextIdx * 2 + 1];\n }\n }\n\n var ratioNextSeg = 0.5;\n var vx = 0;\n var vy = 0;\n var nextCpx0 = void 0;\n var nextCpy0 = void 0; // Is last point\n\n if (tmpK >= segLen || isPointNull(nextX, nextY)) {\n cpx1 = x;\n cpy1 = y;\n } else {\n vx = nextX - prevX;\n vy = nextY - prevY;\n var dx0 = x - prevX;\n var dx1 = nextX - x;\n var dy0 = y - prevY;\n var dy1 = nextY - y;\n var lenPrevSeg = void 0;\n var lenNextSeg = void 0;\n\n if (smoothMonotone === 'x') {\n lenPrevSeg = Math.abs(dx0);\n lenNextSeg = Math.abs(dx1);\n var dir_1 = vx > 0 ? 1 : -1;\n cpx1 = x - dir_1 * lenPrevSeg * smooth;\n cpy1 = y;\n nextCpx0 = x + dir_1 * lenNextSeg * smooth;\n nextCpy0 = y;\n } else if (smoothMonotone === 'y') {\n lenPrevSeg = Math.abs(dy0);\n lenNextSeg = Math.abs(dy1);\n var dir_2 = vy > 0 ? 1 : -1;\n cpx1 = x;\n cpy1 = y - dir_2 * lenPrevSeg * smooth;\n nextCpx0 = x;\n nextCpy0 = y + dir_2 * lenNextSeg * smooth;\n } else {\n lenPrevSeg = Math.sqrt(dx0 * dx0 + dy0 * dy0);\n lenNextSeg = Math.sqrt(dx1 * dx1 + dy1 * dy1); // Use ratio of seg length\n\n ratioNextSeg = lenNextSeg / (lenNextSeg + lenPrevSeg);\n cpx1 = x - vx * smooth * (1 - ratioNextSeg);\n cpy1 = y - vy * smooth * (1 - ratioNextSeg); // cp0 of next segment\n\n nextCpx0 = x + vx * smooth * ratioNextSeg;\n nextCpy0 = y + vy * smooth * ratioNextSeg; // Smooth constraint between point and next point.\n // Avoid exceeding extreme after smoothing.\n\n nextCpx0 = mathMin(nextCpx0, mathMax(nextX, x));\n nextCpy0 = mathMin(nextCpy0, mathMax(nextY, y));\n nextCpx0 = mathMax(nextCpx0, mathMin(nextX, x));\n nextCpy0 = mathMax(nextCpy0, mathMin(nextY, y)); // Reclaculate cp1 based on the adjusted cp0 of next seg.\n\n vx = nextCpx0 - x;\n vy = nextCpy0 - y;\n cpx1 = x - vx * lenPrevSeg / lenNextSeg;\n cpy1 = y - vy * lenPrevSeg / lenNextSeg; // Smooth constraint between point and prev point.\n // Avoid exceeding extreme after smoothing.\n\n cpx1 = mathMin(cpx1, mathMax(prevX, x));\n cpy1 = mathMin(cpy1, mathMax(prevY, y));\n cpx1 = mathMax(cpx1, mathMin(prevX, x));\n cpy1 = mathMax(cpy1, mathMin(prevY, y)); // Adjust next cp0 again.\n\n vx = x - cpx1;\n vy = y - cpy1;\n nextCpx0 = x + vx * lenNextSeg / lenPrevSeg;\n nextCpy0 = y + vy * lenNextSeg / lenPrevSeg;\n }\n }\n\n ctx.bezierCurveTo(cpx0, cpy0, cpx1, cpy1, x, y);\n cpx0 = nextCpx0;\n cpy0 = nextCpy0;\n } else {\n ctx.lineTo(x, y);\n }\n }\n\n prevX = x;\n prevY = y;\n idx += dir;\n }\n\n return k;\n}\n\nvar ECPolylineShape =\n/** @class */\nfunction () {\n function ECPolylineShape() {\n this.smooth = 0;\n this.smoothConstraint = true;\n }\n\n return ECPolylineShape;\n}();\n\nvar ECPolyline =\n/** @class */\nfunction (_super) {\n __extends(ECPolyline, _super);\n\n function ECPolyline(opts) {\n var _this = _super.call(this, opts) || this;\n\n _this.type = 'ec-polyline';\n return _this;\n }\n\n ECPolyline.prototype.getDefaultStyle = function () {\n return {\n stroke: '#000',\n fill: null\n };\n };\n\n ECPolyline.prototype.getDefaultShape = function () {\n return new ECPolylineShape();\n };\n\n ECPolyline.prototype.buildPath = function (ctx, shape) {\n var points = shape.points;\n var i = 0;\n var len = points.length / 2; // const result = getBoundingBox(points, shape.smoothConstraint);\n\n if (shape.connectNulls) {\n // Must remove first and last null values avoid draw error in polygon\n for (; len > 0; len--) {\n if (!isPointNull(points[len * 2 - 2], points[len * 2 - 1])) {\n break;\n }\n }\n\n for (; i < len; i++) {\n if (!isPointNull(points[i * 2], points[i * 2 + 1])) {\n break;\n }\n }\n }\n\n while (i < len) {\n i += drawSegment(ctx, points, i, len, len, 1, shape.smooth, shape.smoothMonotone, shape.connectNulls) + 1;\n }\n };\n\n ECPolyline.prototype.getPointOn = function (xOrY, dim) {\n if (!this.path) {\n this.createPathProxy();\n this.buildPath(this.path, this.shape);\n }\n\n var path = this.path;\n var data = path.data;\n var CMD = PathProxy.CMD;\n var x0;\n var y0;\n var isDimX = dim === 'x';\n var roots = [];\n\n for (var i = 0; i < data.length;) {\n var cmd = data[i++];\n var x = void 0;\n var y = void 0;\n var x2 = void 0;\n var y2 = void 0;\n var x3 = void 0;\n var y3 = void 0;\n var t = void 0;\n\n switch (cmd) {\n case CMD.M:\n x0 = data[i++];\n y0 = data[i++];\n break;\n\n case CMD.L:\n x = data[i++];\n y = data[i++];\n t = isDimX ? (xOrY - x0) / (x - x0) : (xOrY - y0) / (y - y0);\n\n if (t <= 1 && t >= 0) {\n var val = isDimX ? (y - y0) * t + y0 : (x - x0) * t + x0;\n return isDimX ? [xOrY, val] : [val, xOrY];\n }\n\n x0 = x;\n y0 = y;\n break;\n\n case CMD.C:\n x = data[i++];\n y = data[i++];\n x2 = data[i++];\n y2 = data[i++];\n x3 = data[i++];\n y3 = data[i++];\n var nRoot = isDimX ? cubicRootAt(x0, x, x2, x3, xOrY, roots) : cubicRootAt(y0, y, y2, y3, xOrY, roots);\n\n if (nRoot > 0) {\n for (var i_1 = 0; i_1 < nRoot; i_1++) {\n var t_1 = roots[i_1];\n\n if (t_1 <= 1 && t_1 >= 0) {\n var val = isDimX ? cubicAt(y0, y, y2, y3, t_1) : cubicAt(x0, x, x2, x3, t_1);\n return isDimX ? [xOrY, val] : [val, xOrY];\n }\n }\n }\n\n x0 = x3;\n y0 = y3;\n break;\n }\n }\n };\n\n return ECPolyline;\n}(Path);\n\nexport { ECPolyline };\n\nvar ECPolygonShape =\n/** @class */\nfunction (_super) {\n __extends(ECPolygonShape, _super);\n\n function ECPolygonShape() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n\n return ECPolygonShape;\n}(ECPolylineShape);\n\nvar ECPolygon =\n/** @class */\nfunction (_super) {\n __extends(ECPolygon, _super);\n\n function ECPolygon(opts) {\n var _this = _super.call(this, opts) || this;\n\n _this.type = 'ec-polygon';\n return _this;\n }\n\n ECPolygon.prototype.getDefaultShape = function () {\n return new ECPolygonShape();\n };\n\n ECPolygon.prototype.buildPath = function (ctx, shape) {\n var points = shape.points;\n var stackedOnPoints = shape.stackedOnPoints;\n var i = 0;\n var len = points.length / 2;\n var smoothMonotone = shape.smoothMonotone;\n\n if (shape.connectNulls) {\n // Must remove first and last null values avoid draw error in polygon\n for (; len > 0; len--) {\n if (!isPointNull(points[len * 2 - 2], points[len * 2 - 1])) {\n break;\n }\n }\n\n for (; i < len; i++) {\n if (!isPointNull(points[i * 2], points[i * 2 + 1])) {\n break;\n }\n }\n }\n\n while (i < len) {\n var k = drawSegment(ctx, points, i, len, len, 1, shape.smooth, smoothMonotone, shape.connectNulls);\n drawSegment(ctx, stackedOnPoints, i + k - 1, k, len, -1, shape.stackedOnSmooth, smoothMonotone, shape.connectNulls);\n i += k + 1;\n ctx.closePath();\n }\n };\n\n return ECPolygon;\n}(Path);\n\nexport { ECPolygon };","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport * as graphic from '../../util/graphic.js';\nimport { round } from '../../util/number.js';\nimport { isFunction } from 'zrender/lib/core/util.js';\n\nfunction createGridClipPath(cartesian, hasAnimation, seriesModel, done, during) {\n var rect = cartesian.getArea();\n var x = rect.x;\n var y = rect.y;\n var width = rect.width;\n var height = rect.height;\n var lineWidth = seriesModel.get(['lineStyle', 'width']) || 2; // Expand the clip path a bit to avoid the border is clipped and looks thinner\n\n x -= lineWidth / 2;\n y -= lineWidth / 2;\n width += lineWidth;\n height += lineWidth; // fix: https://github.com/apache/incubator-echarts/issues/11369\n\n x = Math.floor(x);\n width = Math.round(width);\n var clipPath = new graphic.Rect({\n shape: {\n x: x,\n y: y,\n width: width,\n height: height\n }\n });\n\n if (hasAnimation) {\n var baseAxis = cartesian.getBaseAxis();\n var isHorizontal = baseAxis.isHorizontal();\n var isAxisInversed = baseAxis.inverse;\n\n if (isHorizontal) {\n if (isAxisInversed) {\n clipPath.shape.x += width;\n }\n\n clipPath.shape.width = 0;\n } else {\n if (!isAxisInversed) {\n clipPath.shape.y += height;\n }\n\n clipPath.shape.height = 0;\n }\n\n var duringCb = isFunction(during) ? function (percent) {\n during(percent, clipPath);\n } : null;\n graphic.initProps(clipPath, {\n shape: {\n width: width,\n height: height,\n x: x,\n y: y\n }\n }, seriesModel, null, done, duringCb);\n }\n\n return clipPath;\n}\n\nfunction createPolarClipPath(polar, hasAnimation, seriesModel) {\n var sectorArea = polar.getArea(); // Avoid float number rounding error for symbol on the edge of axis extent.\n\n var r0 = round(sectorArea.r0, 1);\n var r = round(sectorArea.r, 1);\n var clipPath = new graphic.Sector({\n shape: {\n cx: round(polar.cx, 1),\n cy: round(polar.cy, 1),\n r0: r0,\n r: r,\n startAngle: sectorArea.startAngle,\n endAngle: sectorArea.endAngle,\n clockwise: sectorArea.clockwise\n }\n });\n\n if (hasAnimation) {\n var isRadial = polar.getBaseAxis().dim === 'angle';\n\n if (isRadial) {\n clipPath.shape.endAngle = sectorArea.startAngle;\n } else {\n clipPath.shape.r = r0;\n }\n\n graphic.initProps(clipPath, {\n shape: {\n endAngle: sectorArea.endAngle,\n r: r\n }\n }, seriesModel);\n }\n\n return clipPath;\n}\n\nfunction createClipPath(coordSys, hasAnimation, seriesModel, done, during) {\n if (!coordSys) {\n return null;\n } else if (coordSys.type === 'polar') {\n return createPolarClipPath(coordSys, hasAnimation, seriesModel);\n } else if (coordSys.type === 'cartesian2d') {\n return createGridClipPath(coordSys, hasAnimation, seriesModel, done, during);\n }\n\n return null;\n}\n\nexport { createGridClipPath, createPolarClipPath, createClipPath };","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nexport function isCoordinateSystemType(coordSys, type) {\n return coordSys.type === type;\n}","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { __extends } from \"tslib\"; // FIXME step not support polar\n\nimport * as zrUtil from 'zrender/lib/core/util.js';\nimport SymbolDraw from '../helper/SymbolDraw.js';\nimport SymbolClz from '../helper/Symbol.js';\nimport lineAnimationDiff from './lineAnimationDiff.js';\nimport * as graphic from '../../util/graphic.js';\nimport * as modelUtil from '../../util/model.js';\nimport { ECPolyline, ECPolygon } from './poly.js';\nimport ChartView from '../../view/Chart.js';\nimport { prepareDataCoordInfo, getStackedOnPoint } from './helper.js';\nimport { createGridClipPath, createPolarClipPath } from '../helper/createClipPathFromCoordSys.js';\nimport { isCoordinateSystemType } from '../../coord/CoordinateSystem.js';\nimport { setStatesStylesFromModel, setStatesFlag, toggleHoverEmphasis, SPECIAL_STATES } from '../../util/states.js';\nimport { setLabelStyle, getLabelStatesModels, labelInner } from '../../label/labelStyle.js';\nimport { getDefaultLabel, getDefaultInterpolatedLabel } from '../helper/labelHelper.js';\nimport { getECData } from '../../util/innerStore.js';\nimport { createFloat32Array } from '../../util/vendor.js';\nimport { convertToColorString } from '../../util/format.js';\nimport { lerp } from 'zrender/lib/tool/color.js';\n\nfunction isPointsSame(points1, points2) {\n if (points1.length !== points2.length) {\n return;\n }\n\n for (var i = 0; i < points1.length; i++) {\n if (points1[i] !== points2[i]) {\n return;\n }\n }\n\n return true;\n}\n\nfunction bboxFromPoints(points) {\n var minX = Infinity;\n var minY = Infinity;\n var maxX = -Infinity;\n var maxY = -Infinity;\n\n for (var i = 0; i < points.length;) {\n var x = points[i++];\n var y = points[i++];\n\n if (!isNaN(x)) {\n minX = Math.min(x, minX);\n maxX = Math.max(x, maxX);\n }\n\n if (!isNaN(y)) {\n minY = Math.min(y, minY);\n maxY = Math.max(y, maxY);\n }\n }\n\n return [[minX, minY], [maxX, maxY]];\n}\n\nfunction getBoundingDiff(points1, points2) {\n var _a = bboxFromPoints(points1),\n min1 = _a[0],\n max1 = _a[1];\n\n var _b = bboxFromPoints(points2),\n min2 = _b[0],\n max2 = _b[1]; // Get a max value from each corner of two boundings.\n\n\n return Math.max(Math.abs(min1[0] - min2[0]), Math.abs(min1[1] - min2[1]), Math.abs(max1[0] - max2[0]), Math.abs(max1[1] - max2[1]));\n}\n\nfunction getSmooth(smooth) {\n return zrUtil.isNumber(smooth) ? smooth : smooth ? 0.5 : 0;\n}\n\nfunction getStackedOnPoints(coordSys, data, dataCoordInfo) {\n if (!dataCoordInfo.valueDim) {\n return [];\n }\n\n var len = data.count();\n var points = createFloat32Array(len * 2);\n\n for (var idx = 0; idx < len; idx++) {\n var pt = getStackedOnPoint(dataCoordInfo, coordSys, data, idx);\n points[idx * 2] = pt[0];\n points[idx * 2 + 1] = pt[1];\n }\n\n return points;\n}\n\nfunction turnPointsIntoStep(points, coordSys, stepTurnAt) {\n var baseAxis = coordSys.getBaseAxis();\n var baseIndex = baseAxis.dim === 'x' || baseAxis.dim === 'radius' ? 0 : 1;\n var stepPoints = [];\n var i = 0;\n var stepPt = [];\n var pt = [];\n var nextPt = [];\n\n for (; i < points.length - 2; i += 2) {\n nextPt[0] = points[i + 2];\n nextPt[1] = points[i + 3];\n pt[0] = points[i];\n pt[1] = points[i + 1];\n stepPoints.push(pt[0], pt[1]);\n\n switch (stepTurnAt) {\n case 'end':\n stepPt[baseIndex] = nextPt[baseIndex];\n stepPt[1 - baseIndex] = pt[1 - baseIndex];\n stepPoints.push(stepPt[0], stepPt[1]);\n break;\n\n case 'middle':\n var middle = (pt[baseIndex] + nextPt[baseIndex]) / 2;\n var stepPt2 = [];\n stepPt[baseIndex] = stepPt2[baseIndex] = middle;\n stepPt[1 - baseIndex] = pt[1 - baseIndex];\n stepPt2[1 - baseIndex] = nextPt[1 - baseIndex];\n stepPoints.push(stepPt[0], stepPt[1]);\n stepPoints.push(stepPt2[0], stepPt2[1]);\n break;\n\n default:\n // default is start\n stepPt[baseIndex] = pt[baseIndex];\n stepPt[1 - baseIndex] = nextPt[1 - baseIndex];\n stepPoints.push(stepPt[0], stepPt[1]);\n }\n } // Last points\n\n\n stepPoints.push(points[i++], points[i++]);\n return stepPoints;\n}\n/**\n * Clip color stops to edge. Avoid creating too large gradients.\n * Which may lead to blurry when GPU acceleration is enabled. See #15680\n *\n * The stops has been sorted from small to large.\n */\n\n\nfunction clipColorStops(colorStops, maxSize) {\n var newColorStops = [];\n var len = colorStops.length; // coord will always < 0 in prevOutOfRangeColorStop.\n\n var prevOutOfRangeColorStop;\n var prevInRangeColorStop;\n\n function lerpStop(stop0, stop1, clippedCoord) {\n var coord0 = stop0.coord;\n var p = (clippedCoord - coord0) / (stop1.coord - coord0);\n var color = lerp(p, [stop0.color, stop1.color]);\n return {\n coord: clippedCoord,\n color: color\n };\n }\n\n for (var i = 0; i < len; i++) {\n var stop_1 = colorStops[i];\n var coord = stop_1.coord;\n\n if (coord < 0) {\n prevOutOfRangeColorStop = stop_1;\n } else if (coord > maxSize) {\n if (prevInRangeColorStop) {\n newColorStops.push(lerpStop(prevInRangeColorStop, stop_1, maxSize));\n } else if (prevOutOfRangeColorStop) {\n // If there are two stops and coord range is between these two stops\n newColorStops.push(lerpStop(prevOutOfRangeColorStop, stop_1, 0), lerpStop(prevOutOfRangeColorStop, stop_1, maxSize));\n } // All following stop will be out of range. So just ignore them.\n\n\n break;\n } else {\n if (prevOutOfRangeColorStop) {\n newColorStops.push(lerpStop(prevOutOfRangeColorStop, stop_1, 0)); // Reset\n\n prevOutOfRangeColorStop = null;\n }\n\n newColorStops.push(stop_1);\n prevInRangeColorStop = stop_1;\n }\n }\n\n return newColorStops;\n}\n\nfunction getVisualGradient(data, coordSys, api) {\n var visualMetaList = data.getVisual('visualMeta');\n\n if (!visualMetaList || !visualMetaList.length || !data.count()) {\n // When data.count() is 0, gradient range can not be calculated.\n return;\n }\n\n if (coordSys.type !== 'cartesian2d') {\n if (process.env.NODE_ENV !== 'production') {\n console.warn('Visual map on line style is only supported on cartesian2d.');\n }\n\n return;\n }\n\n var coordDim;\n var visualMeta;\n\n for (var i = visualMetaList.length - 1; i >= 0; i--) {\n var dimInfo = data.getDimensionInfo(visualMetaList[i].dimension);\n coordDim = dimInfo && dimInfo.coordDim; // Can only be x or y\n\n if (coordDim === 'x' || coordDim === 'y') {\n visualMeta = visualMetaList[i];\n break;\n }\n }\n\n if (!visualMeta) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn('Visual map on line style only support x or y dimension.');\n }\n\n return;\n } // If the area to be rendered is bigger than area defined by LinearGradient,\n // the canvas spec prescribes that the color of the first stop and the last\n // stop should be used. But if two stops are added at offset 0, in effect\n // browsers use the color of the second stop to render area outside\n // LinearGradient. So we can only infinitesimally extend area defined in\n // LinearGradient to render `outerColors`.\n\n\n var axis = coordSys.getAxis(coordDim); // dataToCoord mapping may not be linear, but must be monotonic.\n\n var colorStops = zrUtil.map(visualMeta.stops, function (stop) {\n // offset will be calculated later.\n return {\n coord: axis.toGlobalCoord(axis.dataToCoord(stop.value)),\n color: stop.color\n };\n });\n var stopLen = colorStops.length;\n var outerColors = visualMeta.outerColors.slice();\n\n if (stopLen && colorStops[0].coord > colorStops[stopLen - 1].coord) {\n colorStops.reverse();\n outerColors.reverse();\n }\n\n var colorStopsInRange = clipColorStops(colorStops, coordDim === 'x' ? api.getWidth() : api.getHeight());\n var inRangeStopLen = colorStopsInRange.length;\n\n if (!inRangeStopLen && stopLen) {\n // All stops are out of range. All will be the same color.\n return colorStops[0].coord < 0 ? outerColors[1] ? outerColors[1] : colorStops[stopLen - 1].color : outerColors[0] ? outerColors[0] : colorStops[0].color;\n }\n\n var tinyExtent = 10; // Arbitrary value: 10px\n\n var minCoord = colorStopsInRange[0].coord - tinyExtent;\n var maxCoord = colorStopsInRange[inRangeStopLen - 1].coord + tinyExtent;\n var coordSpan = maxCoord - minCoord;\n\n if (coordSpan < 1e-3) {\n return 'transparent';\n }\n\n zrUtil.each(colorStopsInRange, function (stop) {\n stop.offset = (stop.coord - minCoord) / coordSpan;\n });\n colorStopsInRange.push({\n // NOTE: inRangeStopLen may still be 0 if stoplen is zero.\n offset: inRangeStopLen ? colorStopsInRange[inRangeStopLen - 1].offset : 0.5,\n color: outerColors[1] || 'transparent'\n });\n colorStopsInRange.unshift({\n offset: inRangeStopLen ? colorStopsInRange[0].offset : 0.5,\n color: outerColors[0] || 'transparent'\n });\n var gradient = new graphic.LinearGradient(0, 0, 0, 0, colorStopsInRange, true);\n gradient[coordDim] = minCoord;\n gradient[coordDim + '2'] = maxCoord;\n return gradient;\n}\n\nfunction getIsIgnoreFunc(seriesModel, data, coordSys) {\n var showAllSymbol = seriesModel.get('showAllSymbol');\n var isAuto = showAllSymbol === 'auto';\n\n if (showAllSymbol && !isAuto) {\n return;\n }\n\n var categoryAxis = coordSys.getAxesByScale('ordinal')[0];\n\n if (!categoryAxis) {\n return;\n } // Note that category label interval strategy might bring some weird effect\n // in some scenario: users may wonder why some of the symbols are not\n // displayed. So we show all symbols as possible as we can.\n\n\n if (isAuto // Simplify the logic, do not determine label overlap here.\n && canShowAllSymbolForCategory(categoryAxis, data)) {\n return;\n } // Otherwise follow the label interval strategy on category axis.\n\n\n var categoryDataDim = data.mapDimension(categoryAxis.dim);\n var labelMap = {};\n zrUtil.each(categoryAxis.getViewLabels(), function (labelItem) {\n var ordinalNumber = categoryAxis.scale.getRawOrdinalNumber(labelItem.tickValue);\n labelMap[ordinalNumber] = 1;\n });\n return function (dataIndex) {\n return !labelMap.hasOwnProperty(data.get(categoryDataDim, dataIndex));\n };\n}\n\nfunction canShowAllSymbolForCategory(categoryAxis, data) {\n // In mose cases, line is monotonous on category axis, and the label size\n // is close with each other. So we check the symbol size and some of the\n // label size alone with the category axis to estimate whether all symbol\n // can be shown without overlap.\n var axisExtent = categoryAxis.getExtent();\n var availSize = Math.abs(axisExtent[1] - axisExtent[0]) / categoryAxis.scale.count();\n isNaN(availSize) && (availSize = 0); // 0/0 is NaN.\n // Sampling some points, max 5.\n\n var dataLen = data.count();\n var step = Math.max(1, Math.round(dataLen / 5));\n\n for (var dataIndex = 0; dataIndex < dataLen; dataIndex += step) {\n if (SymbolClz.getSymbolSize(data, dataIndex // Only for cartesian, where `isHorizontal` exists.\n )[categoryAxis.isHorizontal() ? 1 : 0] // Empirical number\n * 1.5 > availSize) {\n return false;\n }\n }\n\n return true;\n}\n\nfunction isPointNull(x, y) {\n return isNaN(x) || isNaN(y);\n}\n\nfunction getLastIndexNotNull(points) {\n var len = points.length / 2;\n\n for (; len > 0; len--) {\n if (!isPointNull(points[len * 2 - 2], points[len * 2 - 1])) {\n break;\n }\n }\n\n return len - 1;\n}\n\nfunction getPointAtIndex(points, idx) {\n return [points[idx * 2], points[idx * 2 + 1]];\n}\n\nfunction getIndexRange(points, xOrY, dim) {\n var len = points.length / 2;\n var dimIdx = dim === 'x' ? 0 : 1;\n var a;\n var b;\n var prevIndex = 0;\n var nextIndex = -1;\n\n for (var i = 0; i < len; i++) {\n b = points[i * 2 + dimIdx];\n\n if (isNaN(b) || isNaN(points[i * 2 + 1 - dimIdx])) {\n continue;\n }\n\n if (i === 0) {\n a = b;\n continue;\n }\n\n if (a <= xOrY && b >= xOrY || a >= xOrY && b <= xOrY) {\n nextIndex = i;\n break;\n }\n\n prevIndex = i;\n a = b;\n }\n\n return {\n range: [prevIndex, nextIndex],\n t: (xOrY - a) / (b - a)\n };\n}\n\nfunction anyStateShowEndLabel(seriesModel) {\n if (seriesModel.get(['endLabel', 'show'])) {\n return true;\n }\n\n for (var i = 0; i < SPECIAL_STATES.length; i++) {\n if (seriesModel.get([SPECIAL_STATES[i], 'endLabel', 'show'])) {\n return true;\n }\n }\n\n return false;\n}\n\nfunction createLineClipPath(lineView, coordSys, hasAnimation, seriesModel) {\n if (isCoordinateSystemType(coordSys, 'cartesian2d')) {\n var endLabelModel_1 = seriesModel.getModel('endLabel');\n var valueAnimation_1 = endLabelModel_1.get('valueAnimation');\n var data_1 = seriesModel.getData();\n var labelAnimationRecord_1 = {\n lastFrameIndex: 0\n };\n var during = anyStateShowEndLabel(seriesModel) ? function (percent, clipRect) {\n lineView._endLabelOnDuring(percent, clipRect, data_1, labelAnimationRecord_1, valueAnimation_1, endLabelModel_1, coordSys);\n } : null;\n var isHorizontal = coordSys.getBaseAxis().isHorizontal();\n var clipPath = createGridClipPath(coordSys, hasAnimation, seriesModel, function () {\n var endLabel = lineView._endLabel;\n\n if (endLabel && hasAnimation) {\n if (labelAnimationRecord_1.originalX != null) {\n endLabel.attr({\n x: labelAnimationRecord_1.originalX,\n y: labelAnimationRecord_1.originalY\n });\n }\n }\n }, during); // Expand clip shape to avoid clipping when line value exceeds axis\n\n if (!seriesModel.get('clip', true)) {\n var rectShape = clipPath.shape;\n var expandSize = Math.max(rectShape.width, rectShape.height);\n\n if (isHorizontal) {\n rectShape.y -= expandSize;\n rectShape.height += expandSize * 2;\n } else {\n rectShape.x -= expandSize;\n rectShape.width += expandSize * 2;\n }\n } // Set to the final frame. To make sure label layout is right.\n\n\n if (during) {\n during(1, clipPath);\n }\n\n return clipPath;\n } else {\n if (process.env.NODE_ENV !== 'production') {\n if (seriesModel.get(['endLabel', 'show'])) {\n console.warn('endLabel is not supported for lines in polar systems.');\n }\n }\n\n return createPolarClipPath(coordSys, hasAnimation, seriesModel);\n }\n}\n\nfunction getEndLabelStateSpecified(endLabelModel, coordSys) {\n var baseAxis = coordSys.getBaseAxis();\n var isHorizontal = baseAxis.isHorizontal();\n var isBaseInversed = baseAxis.inverse;\n var align = isHorizontal ? isBaseInversed ? 'right' : 'left' : 'center';\n var verticalAlign = isHorizontal ? 'middle' : isBaseInversed ? 'top' : 'bottom';\n return {\n normal: {\n align: endLabelModel.get('align') || align,\n verticalAlign: endLabelModel.get('verticalAlign') || verticalAlign\n }\n };\n}\n\nvar LineView =\n/** @class */\nfunction (_super) {\n __extends(LineView, _super);\n\n function LineView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n\n LineView.prototype.init = function () {\n var lineGroup = new graphic.Group();\n var symbolDraw = new SymbolDraw();\n this.group.add(symbolDraw.group);\n this._symbolDraw = symbolDraw;\n this._lineGroup = lineGroup;\n };\n\n LineView.prototype.render = function (seriesModel, ecModel, api) {\n var _this = this;\n\n var coordSys = seriesModel.coordinateSystem;\n var group = this.group;\n var data = seriesModel.getData();\n var lineStyleModel = seriesModel.getModel('lineStyle');\n var areaStyleModel = seriesModel.getModel('areaStyle');\n var points = data.getLayout('points') || [];\n var isCoordSysPolar = coordSys.type === 'polar';\n var prevCoordSys = this._coordSys;\n var symbolDraw = this._symbolDraw;\n var polyline = this._polyline;\n var polygon = this._polygon;\n var lineGroup = this._lineGroup;\n var hasAnimation = seriesModel.get('animation');\n var isAreaChart = !areaStyleModel.isEmpty();\n var valueOrigin = areaStyleModel.get('origin');\n var dataCoordInfo = prepareDataCoordInfo(coordSys, data, valueOrigin);\n var stackedOnPoints = isAreaChart && getStackedOnPoints(coordSys, data, dataCoordInfo);\n var showSymbol = seriesModel.get('showSymbol');\n var isIgnoreFunc = showSymbol && !isCoordSysPolar && getIsIgnoreFunc(seriesModel, data, coordSys); // Remove temporary symbols\n\n var oldData = this._data;\n oldData && oldData.eachItemGraphicEl(function (el, idx) {\n if (el.__temp) {\n group.remove(el);\n oldData.setItemGraphicEl(idx, null);\n }\n }); // Remove previous created symbols if showSymbol changed to false\n\n if (!showSymbol) {\n symbolDraw.remove();\n }\n\n group.add(lineGroup); // FIXME step not support polar\n\n var step = !isCoordSysPolar ? seriesModel.get('step') : false;\n var clipShapeForSymbol;\n\n if (coordSys && coordSys.getArea && seriesModel.get('clip', true)) {\n clipShapeForSymbol = coordSys.getArea(); // Avoid float number rounding error for symbol on the edge of axis extent.\n // See #7913 and `test/dataZoom-clip.html`.\n\n if (clipShapeForSymbol.width != null) {\n clipShapeForSymbol.x -= 0.1;\n clipShapeForSymbol.y -= 0.1;\n clipShapeForSymbol.width += 0.2;\n clipShapeForSymbol.height += 0.2;\n } else if (clipShapeForSymbol.r0) {\n clipShapeForSymbol.r0 -= 0.5;\n clipShapeForSymbol.r += 0.5;\n }\n }\n\n this._clipShapeForSymbol = clipShapeForSymbol;\n var visualColor = getVisualGradient(data, coordSys, api) || data.getVisual('style')[data.getVisual('drawType')]; // Initialization animation or coordinate system changed\n\n if (!(polyline && prevCoordSys.type === coordSys.type && step === this._step)) {\n showSymbol && symbolDraw.updateData(data, {\n isIgnore: isIgnoreFunc,\n clipShape: clipShapeForSymbol,\n disableAnimation: true,\n getSymbolPoint: function (idx) {\n return [points[idx * 2], points[idx * 2 + 1]];\n }\n });\n hasAnimation && this._initSymbolLabelAnimation(data, coordSys, clipShapeForSymbol);\n\n if (step) {\n // TODO If stacked series is not step\n points = turnPointsIntoStep(points, coordSys, step);\n\n if (stackedOnPoints) {\n stackedOnPoints = turnPointsIntoStep(stackedOnPoints, coordSys, step);\n }\n }\n\n polyline = this._newPolyline(points);\n\n if (isAreaChart) {\n polygon = this._newPolygon(points, stackedOnPoints);\n } // NOTE: Must update _endLabel before setClipPath.\n\n\n if (!isCoordSysPolar) {\n this._initOrUpdateEndLabel(seriesModel, coordSys, convertToColorString(visualColor));\n }\n\n lineGroup.setClipPath(createLineClipPath(this, coordSys, true, seriesModel));\n } else {\n if (isAreaChart && !polygon) {\n // If areaStyle is added\n polygon = this._newPolygon(points, stackedOnPoints);\n } else if (polygon && !isAreaChart) {\n // If areaStyle is removed\n lineGroup.remove(polygon);\n polygon = this._polygon = null;\n } // NOTE: Must update _endLabel before setClipPath.\n\n\n if (!isCoordSysPolar) {\n this._initOrUpdateEndLabel(seriesModel, coordSys, convertToColorString(visualColor));\n } // Update clipPath\n\n\n var oldClipPath = lineGroup.getClipPath();\n\n if (oldClipPath) {\n var newClipPath = createLineClipPath(this, coordSys, false, seriesModel);\n graphic.initProps(oldClipPath, {\n shape: newClipPath.shape\n }, seriesModel);\n } else {\n lineGroup.setClipPath(createLineClipPath(this, coordSys, true, seriesModel));\n } // Always update, or it is wrong in the case turning on legend\n // because points are not changed\n\n\n showSymbol && symbolDraw.updateData(data, {\n isIgnore: isIgnoreFunc,\n clipShape: clipShapeForSymbol,\n disableAnimation: true,\n getSymbolPoint: function (idx) {\n return [points[idx * 2], points[idx * 2 + 1]];\n }\n }); // In the case data zoom triggerred refreshing frequently\n // Data may not change if line has a category axis. So it should animate nothing\n\n if (!isPointsSame(this._stackedOnPoints, stackedOnPoints) || !isPointsSame(this._points, points)) {\n if (hasAnimation) {\n this._doUpdateAnimation(data, stackedOnPoints, coordSys, api, step, valueOrigin);\n } else {\n // Not do it in update with animation\n if (step) {\n // TODO If stacked series is not step\n points = turnPointsIntoStep(points, coordSys, step);\n\n if (stackedOnPoints) {\n stackedOnPoints = turnPointsIntoStep(stackedOnPoints, coordSys, step);\n }\n }\n\n polyline.setShape({\n points: points\n });\n polygon && polygon.setShape({\n points: points,\n stackedOnPoints: stackedOnPoints\n });\n }\n }\n }\n\n var emphasisModel = seriesModel.getModel('emphasis');\n var focus = emphasisModel.get('focus');\n var blurScope = emphasisModel.get('blurScope');\n var emphasisDisabled = emphasisModel.get('disabled');\n polyline.useStyle(zrUtil.defaults( // Use color in lineStyle first\n lineStyleModel.getLineStyle(), {\n fill: 'none',\n stroke: visualColor,\n lineJoin: 'bevel'\n }));\n setStatesStylesFromModel(polyline, seriesModel, 'lineStyle');\n\n if (polyline.style.lineWidth > 0 && seriesModel.get(['emphasis', 'lineStyle', 'width']) === 'bolder') {\n var emphasisLineStyle = polyline.getState('emphasis').style;\n emphasisLineStyle.lineWidth = +polyline.style.lineWidth + 1;\n } // Needs seriesIndex for focus\n\n\n getECData(polyline).seriesIndex = seriesModel.seriesIndex;\n toggleHoverEmphasis(polyline, focus, blurScope, emphasisDisabled);\n var smooth = getSmooth(seriesModel.get('smooth'));\n var smoothMonotone = seriesModel.get('smoothMonotone');\n var connectNulls = seriesModel.get('connectNulls');\n polyline.setShape({\n smooth: smooth,\n smoothMonotone: smoothMonotone,\n connectNulls: connectNulls\n });\n\n if (polygon) {\n var stackedOnSeries = data.getCalculationInfo('stackedOnSeries');\n var stackedOnSmooth = 0;\n polygon.useStyle(zrUtil.defaults(areaStyleModel.getAreaStyle(), {\n fill: visualColor,\n opacity: 0.7,\n lineJoin: 'bevel',\n decal: data.getVisual('style').decal\n }));\n\n if (stackedOnSeries) {\n stackedOnSmooth = getSmooth(stackedOnSeries.get('smooth'));\n }\n\n polygon.setShape({\n smooth: smooth,\n stackedOnSmooth: stackedOnSmooth,\n smoothMonotone: smoothMonotone,\n connectNulls: connectNulls\n });\n setStatesStylesFromModel(polygon, seriesModel, 'areaStyle'); // Needs seriesIndex for focus\n\n getECData(polygon).seriesIndex = seriesModel.seriesIndex;\n toggleHoverEmphasis(polygon, focus, blurScope, emphasisDisabled);\n }\n\n var changePolyState = function (toState) {\n _this._changePolyState(toState);\n };\n\n data.eachItemGraphicEl(function (el) {\n // Switch polyline / polygon state if element changed its state.\n el && (el.onHoverStateChange = changePolyState);\n });\n this._polyline.onHoverStateChange = changePolyState;\n this._data = data; // Save the coordinate system for transition animation when data changed\n\n this._coordSys = coordSys;\n this._stackedOnPoints = stackedOnPoints;\n this._points = points;\n this._step = step;\n this._valueOrigin = valueOrigin;\n\n if (seriesModel.get('triggerLineEvent')) {\n this.packEventData(seriesModel, polyline);\n polygon && this.packEventData(seriesModel, polygon);\n }\n };\n\n LineView.prototype.packEventData = function (seriesModel, el) {\n getECData(el).eventData = {\n componentType: 'series',\n componentSubType: 'line',\n componentIndex: seriesModel.componentIndex,\n seriesIndex: seriesModel.seriesIndex,\n seriesName: seriesModel.name,\n seriesType: 'line'\n };\n };\n\n LineView.prototype.highlight = function (seriesModel, ecModel, api, payload) {\n var data = seriesModel.getData();\n var dataIndex = modelUtil.queryDataIndex(data, payload);\n\n this._changePolyState('emphasis');\n\n if (!(dataIndex instanceof Array) && dataIndex != null && dataIndex >= 0) {\n var points = data.getLayout('points');\n var symbol = data.getItemGraphicEl(dataIndex);\n\n if (!symbol) {\n // Create a temporary symbol if it is not exists\n var x = points[dataIndex * 2];\n var y = points[dataIndex * 2 + 1];\n\n if (isNaN(x) || isNaN(y)) {\n // Null data\n return;\n } // fix #11360: should't draw symbol outside clipShapeForSymbol\n\n\n if (this._clipShapeForSymbol && !this._clipShapeForSymbol.contain(x, y)) {\n return;\n }\n\n var zlevel = seriesModel.get('zlevel');\n var z = seriesModel.get('z');\n symbol = new SymbolClz(data, dataIndex);\n symbol.x = x;\n symbol.y = y;\n symbol.setZ(zlevel, z); // ensure label text of the temporary symbol is in front of line and area polygon\n\n var symbolLabel = symbol.getSymbolPath().getTextContent();\n\n if (symbolLabel) {\n symbolLabel.zlevel = zlevel;\n symbolLabel.z = z;\n symbolLabel.z2 = this._polyline.z2 + 1;\n }\n\n symbol.__temp = true;\n data.setItemGraphicEl(dataIndex, symbol); // Stop scale animation\n\n symbol.stopSymbolAnimation(true);\n this.group.add(symbol);\n }\n\n symbol.highlight();\n } else {\n // Highlight whole series\n ChartView.prototype.highlight.call(this, seriesModel, ecModel, api, payload);\n }\n };\n\n LineView.prototype.downplay = function (seriesModel, ecModel, api, payload) {\n var data = seriesModel.getData();\n var dataIndex = modelUtil.queryDataIndex(data, payload);\n\n this._changePolyState('normal');\n\n if (dataIndex != null && dataIndex >= 0) {\n var symbol = data.getItemGraphicEl(dataIndex);\n\n if (symbol) {\n if (symbol.__temp) {\n data.setItemGraphicEl(dataIndex, null);\n this.group.remove(symbol);\n } else {\n symbol.downplay();\n }\n }\n } else {\n // FIXME\n // can not downplay completely.\n // Downplay whole series\n ChartView.prototype.downplay.call(this, seriesModel, ecModel, api, payload);\n }\n };\n\n LineView.prototype._changePolyState = function (toState) {\n var polygon = this._polygon;\n setStatesFlag(this._polyline, toState);\n polygon && setStatesFlag(polygon, toState);\n };\n\n LineView.prototype._newPolyline = function (points) {\n var polyline = this._polyline; // Remove previous created polyline\n\n if (polyline) {\n this._lineGroup.remove(polyline);\n }\n\n polyline = new ECPolyline({\n shape: {\n points: points\n },\n segmentIgnoreThreshold: 2,\n z2: 10\n });\n\n this._lineGroup.add(polyline);\n\n this._polyline = polyline;\n return polyline;\n };\n\n LineView.prototype._newPolygon = function (points, stackedOnPoints) {\n var polygon = this._polygon; // Remove previous created polygon\n\n if (polygon) {\n this._lineGroup.remove(polygon);\n }\n\n polygon = new ECPolygon({\n shape: {\n points: points,\n stackedOnPoints: stackedOnPoints\n },\n segmentIgnoreThreshold: 2\n });\n\n this._lineGroup.add(polygon);\n\n this._polygon = polygon;\n return polygon;\n };\n\n LineView.prototype._initSymbolLabelAnimation = function (data, coordSys, clipShape) {\n var isHorizontalOrRadial;\n var isCoordSysPolar;\n var baseAxis = coordSys.getBaseAxis();\n var isAxisInverse = baseAxis.inverse;\n\n if (coordSys.type === 'cartesian2d') {\n isHorizontalOrRadial = baseAxis.isHorizontal();\n isCoordSysPolar = false;\n } else if (coordSys.type === 'polar') {\n isHorizontalOrRadial = baseAxis.dim === 'angle';\n isCoordSysPolar = true;\n }\n\n var seriesModel = data.hostModel;\n var seriesDuration = seriesModel.get('animationDuration');\n\n if (zrUtil.isFunction(seriesDuration)) {\n seriesDuration = seriesDuration(null);\n }\n\n var seriesDalay = seriesModel.get('animationDelay') || 0;\n var seriesDalayValue = zrUtil.isFunction(seriesDalay) ? seriesDalay(null) : seriesDalay;\n data.eachItemGraphicEl(function (symbol, idx) {\n var el = symbol;\n\n if (el) {\n var point = [symbol.x, symbol.y];\n var start = void 0;\n var end = void 0;\n var current = void 0;\n\n if (clipShape) {\n if (isCoordSysPolar) {\n var polarClip = clipShape;\n var coord = coordSys.pointToCoord(point);\n\n if (isHorizontalOrRadial) {\n start = polarClip.startAngle;\n end = polarClip.endAngle;\n current = -coord[1] / 180 * Math.PI;\n } else {\n start = polarClip.r0;\n end = polarClip.r;\n current = coord[0];\n }\n } else {\n var gridClip = clipShape;\n\n if (isHorizontalOrRadial) {\n start = gridClip.x;\n end = gridClip.x + gridClip.width;\n current = symbol.x;\n } else {\n start = gridClip.y + gridClip.height;\n end = gridClip.y;\n current = symbol.y;\n }\n }\n }\n\n var ratio = end === start ? 0 : (current - start) / (end - start);\n\n if (isAxisInverse) {\n ratio = 1 - ratio;\n }\n\n var delay = zrUtil.isFunction(seriesDalay) ? seriesDalay(idx) : seriesDuration * ratio + seriesDalayValue;\n var symbolPath = el.getSymbolPath();\n var text = symbolPath.getTextContent();\n el.attr({\n scaleX: 0,\n scaleY: 0\n });\n el.animateTo({\n scaleX: 1,\n scaleY: 1\n }, {\n duration: 200,\n setToFinal: true,\n delay: delay\n });\n\n if (text) {\n text.animateFrom({\n style: {\n opacity: 0\n }\n }, {\n duration: 300,\n delay: delay\n });\n }\n\n symbolPath.disableLabelAnimation = true;\n }\n });\n };\n\n LineView.prototype._initOrUpdateEndLabel = function (seriesModel, coordSys, inheritColor) {\n var endLabelModel = seriesModel.getModel('endLabel');\n\n if (anyStateShowEndLabel(seriesModel)) {\n var data_2 = seriesModel.getData();\n var polyline = this._polyline; // series may be filtered.\n\n var points = data_2.getLayout('points');\n\n if (!points) {\n polyline.removeTextContent();\n this._endLabel = null;\n return;\n }\n\n var endLabel = this._endLabel;\n\n if (!endLabel) {\n endLabel = this._endLabel = new graphic.Text({\n z2: 200 // should be higher than item symbol\n\n });\n endLabel.ignoreClip = true;\n polyline.setTextContent(this._endLabel);\n polyline.disableLabelAnimation = true;\n } // Find last non-NaN data to display data\n\n\n var dataIndex = getLastIndexNotNull(points);\n\n if (dataIndex >= 0) {\n setLabelStyle(polyline, getLabelStatesModels(seriesModel, 'endLabel'), {\n inheritColor: inheritColor,\n labelFetcher: seriesModel,\n labelDataIndex: dataIndex,\n defaultText: function (dataIndex, opt, interpolatedValue) {\n return interpolatedValue != null ? getDefaultInterpolatedLabel(data_2, interpolatedValue) : getDefaultLabel(data_2, dataIndex);\n },\n enableTextSetter: true\n }, getEndLabelStateSpecified(endLabelModel, coordSys));\n polyline.textConfig.position = null;\n }\n } else if (this._endLabel) {\n this._polyline.removeTextContent();\n\n this._endLabel = null;\n }\n };\n\n LineView.prototype._endLabelOnDuring = function (percent, clipRect, data, animationRecord, valueAnimation, endLabelModel, coordSys) {\n var endLabel = this._endLabel;\n var polyline = this._polyline;\n\n if (endLabel) {\n // NOTE: Don't remove percent < 1. percent === 1 means the first frame during render.\n // The label is not prepared at this time.\n if (percent < 1 && animationRecord.originalX == null) {\n animationRecord.originalX = endLabel.x;\n animationRecord.originalY = endLabel.y;\n }\n\n var points = data.getLayout('points');\n var seriesModel = data.hostModel;\n var connectNulls = seriesModel.get('connectNulls');\n var precision = endLabelModel.get('precision');\n var distance = endLabelModel.get('distance') || 0;\n var baseAxis = coordSys.getBaseAxis();\n var isHorizontal = baseAxis.isHorizontal();\n var isBaseInversed = baseAxis.inverse;\n var clipShape = clipRect.shape;\n var xOrY = isBaseInversed ? isHorizontal ? clipShape.x : clipShape.y + clipShape.height : isHorizontal ? clipShape.x + clipShape.width : clipShape.y;\n var distanceX = (isHorizontal ? distance : 0) * (isBaseInversed ? -1 : 1);\n var distanceY = (isHorizontal ? 0 : -distance) * (isBaseInversed ? -1 : 1);\n var dim = isHorizontal ? 'x' : 'y';\n var dataIndexRange = getIndexRange(points, xOrY, dim);\n var indices = dataIndexRange.range;\n var diff = indices[1] - indices[0];\n var value = void 0;\n\n if (diff >= 1) {\n // diff > 1 && connectNulls, which is on the null data.\n if (diff > 1 && !connectNulls) {\n var pt = getPointAtIndex(points, indices[0]);\n endLabel.attr({\n x: pt[0] + distanceX,\n y: pt[1] + distanceY\n });\n valueAnimation && (value = seriesModel.getRawValue(indices[0]));\n } else {\n var pt = polyline.getPointOn(xOrY, dim);\n pt && endLabel.attr({\n x: pt[0] + distanceX,\n y: pt[1] + distanceY\n });\n var startValue = seriesModel.getRawValue(indices[0]);\n var endValue = seriesModel.getRawValue(indices[1]);\n valueAnimation && (value = modelUtil.interpolateRawValues(data, precision, startValue, endValue, dataIndexRange.t));\n }\n\n animationRecord.lastFrameIndex = indices[0];\n } else {\n // If diff <= 0, which is the range is not found(Include NaN)\n // Choose the first point or last point.\n var idx = percent === 1 || animationRecord.lastFrameIndex > 0 ? indices[0] : 0;\n var pt = getPointAtIndex(points, idx);\n valueAnimation && (value = seriesModel.getRawValue(idx));\n endLabel.attr({\n x: pt[0] + distanceX,\n y: pt[1] + distanceY\n });\n }\n\n if (valueAnimation) {\n labelInner(endLabel).setLabelText(value);\n }\n }\n };\n /**\n * @private\n */\n // FIXME Two value axis\n\n\n LineView.prototype._doUpdateAnimation = function (data, stackedOnPoints, coordSys, api, step, valueOrigin) {\n var polyline = this._polyline;\n var polygon = this._polygon;\n var seriesModel = data.hostModel;\n var diff = lineAnimationDiff(this._data, data, this._stackedOnPoints, stackedOnPoints, this._coordSys, coordSys, this._valueOrigin, valueOrigin);\n var current = diff.current;\n var stackedOnCurrent = diff.stackedOnCurrent;\n var next = diff.next;\n var stackedOnNext = diff.stackedOnNext;\n\n if (step) {\n // TODO If stacked series is not step\n current = turnPointsIntoStep(diff.current, coordSys, step);\n stackedOnCurrent = turnPointsIntoStep(diff.stackedOnCurrent, coordSys, step);\n next = turnPointsIntoStep(diff.next, coordSys, step);\n stackedOnNext = turnPointsIntoStep(diff.stackedOnNext, coordSys, step);\n } // Don't apply animation if diff is large.\n // For better result and avoid memory explosion problems like\n // https://github.com/apache/incubator-echarts/issues/12229\n\n\n if (getBoundingDiff(current, next) > 3000 || polygon && getBoundingDiff(stackedOnCurrent, stackedOnNext) > 3000) {\n polyline.stopAnimation();\n polyline.setShape({\n points: next\n });\n\n if (polygon) {\n polygon.stopAnimation();\n polygon.setShape({\n points: next,\n stackedOnPoints: stackedOnNext\n });\n }\n\n return;\n }\n\n polyline.shape.__points = diff.current;\n polyline.shape.points = current;\n var target = {\n shape: {\n points: next\n }\n }; // Also animate the original points.\n // If points reference is changed when turning into step line.\n\n if (diff.current !== current) {\n target.shape.__points = diff.next;\n } // Stop previous animation.\n\n\n polyline.stopAnimation();\n graphic.updateProps(polyline, target, seriesModel);\n\n if (polygon) {\n polygon.setShape({\n // Reuse the points with polyline.\n points: current,\n stackedOnPoints: stackedOnCurrent\n });\n polygon.stopAnimation();\n graphic.updateProps(polygon, {\n shape: {\n stackedOnPoints: stackedOnNext\n }\n }, seriesModel); // If use attr directly in updateProps.\n\n if (polyline.shape.points !== polygon.shape.points) {\n polygon.shape.points = polyline.shape.points;\n }\n }\n\n var updatedDataInfo = [];\n var diffStatus = diff.status;\n\n for (var i = 0; i < diffStatus.length; i++) {\n var cmd = diffStatus[i].cmd;\n\n if (cmd === '=') {\n var el = data.getItemGraphicEl(diffStatus[i].idx1);\n\n if (el) {\n updatedDataInfo.push({\n el: el,\n ptIdx: i // Index of points\n\n });\n }\n }\n }\n\n if (polyline.animators && polyline.animators.length) {\n polyline.animators[0].during(function () {\n polygon && polygon.dirtyShape();\n var points = polyline.shape.__points;\n\n for (var i = 0; i < updatedDataInfo.length; i++) {\n var el = updatedDataInfo[i].el;\n var offset = updatedDataInfo[i].ptIdx * 2;\n el.x = points[offset];\n el.y = points[offset + 1];\n el.markRedraw();\n }\n });\n }\n };\n\n LineView.prototype.remove = function (ecModel) {\n var group = this.group;\n var oldData = this._data;\n\n this._lineGroup.removeAll();\n\n this._symbolDraw.remove(true); // Remove temporary created elements when highlighting\n\n\n oldData && oldData.eachItemGraphicEl(function (el, idx) {\n if (el.__temp) {\n group.remove(el);\n oldData.setItemGraphicEl(idx, null);\n }\n });\n this._polyline = this._polygon = this._coordSys = this._points = this._stackedOnPoints = this._endLabel = this._data = null;\n };\n\n LineView.type = 'line';\n return LineView;\n}(ChartView);\n\nexport default LineView;","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { map } from 'zrender/lib/core/util.js';\nimport createRenderPlanner from '../chart/helper/createRenderPlanner.js';\nimport { isDimensionStacked } from '../data/helper/dataStackHelper.js';\nimport { createFloat32Array } from '../util/vendor.js';\nexport default function pointsLayout(seriesType, forceStoreInTypedArray) {\n return {\n seriesType: seriesType,\n plan: createRenderPlanner(),\n reset: function (seriesModel) {\n var data = seriesModel.getData();\n var coordSys = seriesModel.coordinateSystem;\n var pipelineContext = seriesModel.pipelineContext;\n var useTypedArray = forceStoreInTypedArray || pipelineContext.large;\n\n if (!coordSys) {\n return;\n }\n\n var dims = map(coordSys.dimensions, function (dim) {\n return data.mapDimension(dim);\n }).slice(0, 2);\n var dimLen = dims.length;\n var stackResultDim = data.getCalculationInfo('stackResultDimension');\n\n if (isDimensionStacked(data, dims[0])) {\n dims[0] = stackResultDim;\n }\n\n if (isDimensionStacked(data, dims[1])) {\n dims[1] = stackResultDim;\n }\n\n var store = data.getStore();\n var dimIdx0 = data.getDimensionIndex(dims[0]);\n var dimIdx1 = data.getDimensionIndex(dims[1]);\n return dimLen && {\n progress: function (params, data) {\n var segCount = params.end - params.start;\n var points = useTypedArray && createFloat32Array(segCount * dimLen);\n var tmpIn = [];\n var tmpOut = [];\n\n for (var i = params.start, offset = 0; i < params.end; i++) {\n var point = void 0;\n\n if (dimLen === 1) {\n var x = store.get(dimIdx0, i); // NOTE: Make sure the second parameter is null to use default strategy.\n\n point = coordSys.dataToPoint(x, null, tmpOut);\n } else {\n tmpIn[0] = store.get(dimIdx0, i);\n tmpIn[1] = store.get(dimIdx1, i); // Let coordinate system to handle the NaN data.\n\n point = coordSys.dataToPoint(tmpIn, null, tmpOut);\n }\n\n if (useTypedArray) {\n points[offset++] = point[0];\n points[offset++] = point[1];\n } else {\n data.setItemLayout(i, point.slice());\n }\n }\n\n useTypedArray && data.setLayout('points', points);\n }\n };\n }\n };\n}\n;","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { isFunction, isString } from 'zrender/lib/core/util.js';\nvar samplers = {\n average: function (frame) {\n var sum = 0;\n var count = 0;\n\n for (var i = 0; i < frame.length; i++) {\n if (!isNaN(frame[i])) {\n sum += frame[i];\n count++;\n }\n } // Return NaN if count is 0\n\n\n return count === 0 ? NaN : sum / count;\n },\n sum: function (frame) {\n var sum = 0;\n\n for (var i = 0; i < frame.length; i++) {\n // Ignore NaN\n sum += frame[i] || 0;\n }\n\n return sum;\n },\n max: function (frame) {\n var max = -Infinity;\n\n for (var i = 0; i < frame.length; i++) {\n frame[i] > max && (max = frame[i]);\n } // NaN will cause illegal axis extent.\n\n\n return isFinite(max) ? max : NaN;\n },\n min: function (frame) {\n var min = Infinity;\n\n for (var i = 0; i < frame.length; i++) {\n frame[i] < min && (min = frame[i]);\n } // NaN will cause illegal axis extent.\n\n\n return isFinite(min) ? min : NaN;\n },\n // TODO\n // Median\n nearest: function (frame) {\n return frame[0];\n }\n};\n\nvar indexSampler = function (frame) {\n return Math.round(frame.length / 2);\n};\n\nexport default function dataSample(seriesType) {\n return {\n seriesType: seriesType,\n // FIXME:TS never used, so comment it\n // modifyOutputEnd: true,\n reset: function (seriesModel, ecModel, api) {\n var data = seriesModel.getData();\n var sampling = seriesModel.get('sampling');\n var coordSys = seriesModel.coordinateSystem;\n var count = data.count(); // Only cartesian2d support down sampling. Disable it when there is few data.\n\n if (count > 10 && coordSys.type === 'cartesian2d' && sampling) {\n var baseAxis = coordSys.getBaseAxis();\n var valueAxis = coordSys.getOtherAxis(baseAxis);\n var extent = baseAxis.getExtent();\n var dpr = api.getDevicePixelRatio(); // Coordinste system has been resized\n\n var size = Math.abs(extent[1] - extent[0]) * (dpr || 1);\n var rate = Math.round(count / size);\n\n if (rate > 1) {\n if (sampling === 'lttb') {\n seriesModel.setData(data.lttbDownSample(data.mapDimension(valueAxis.dim), 1 / rate));\n }\n\n var sampler = void 0;\n\n if (isString(sampling)) {\n sampler = samplers[sampling];\n } else if (isFunction(sampling)) {\n sampler = sampling;\n }\n\n if (sampler) {\n // Only support sample the first dim mapped from value axis.\n seriesModel.setData(data.downSample(data.mapDimension(valueAxis.dim), 1 / rate, sampler, indexSampler));\n }\n }\n }\n }\n };\n}","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport LineSeries from './LineSeries.js';\nimport LineView from './LineView.js'; // In case developer forget to include grid component\n\nimport layoutPoints from '../../layout/points.js';\nimport dataSample from '../../processor/dataSample.js';\nexport function install(registers) {\n registers.registerChartView(LineView);\n registers.registerSeriesModel(LineSeries);\n registers.registerLayout(layoutPoints('line', true));\n registers.registerVisual({\n seriesType: 'line',\n reset: function (seriesModel) {\n var data = seriesModel.getData(); // Visual coding for legend\n\n var lineStyle = seriesModel.getModel('lineStyle').getLineStyle();\n\n if (lineStyle && !lineStyle.stroke) {\n // Fill in visual should be palette color if\n // has color callback\n lineStyle.stroke = data.getVisual('style').fill;\n }\n\n data.setVisual('legendLineStyle', lineStyle);\n }\n }); // Down sample after filter\n\n registers.registerProcessor(registers.PRIORITY.PROCESSOR.STATISTIC, dataSample('line'));\n}","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { each, defaults, keys } from 'zrender/lib/core/util.js';\nimport { parsePercent } from '../util/number.js';\nimport { isDimensionStacked } from '../data/helper/dataStackHelper.js';\nimport createRenderPlanner from '../chart/helper/createRenderPlanner.js';\nimport { createFloat32Array } from '../util/vendor.js';\nvar STACK_PREFIX = '__ec_stack_';\n\nfunction getSeriesStackId(seriesModel) {\n return seriesModel.get('stack') || STACK_PREFIX + seriesModel.seriesIndex;\n}\n\nfunction getAxisKey(axis) {\n return axis.dim + axis.index;\n}\n/**\n * @return {Object} {width, offset, offsetCenter} If axis.type is not 'category', return undefined.\n */\n\n\nexport function getLayoutOnAxis(opt) {\n var params = [];\n var baseAxis = opt.axis;\n var axisKey = 'axis0';\n\n if (baseAxis.type !== 'category') {\n return;\n }\n\n var bandWidth = baseAxis.getBandWidth();\n\n for (var i = 0; i < opt.count || 0; i++) {\n params.push(defaults({\n bandWidth: bandWidth,\n axisKey: axisKey,\n stackId: STACK_PREFIX + i\n }, opt));\n }\n\n var widthAndOffsets = doCalBarWidthAndOffset(params);\n var result = [];\n\n for (var i = 0; i < opt.count; i++) {\n var item = widthAndOffsets[axisKey][STACK_PREFIX + i];\n item.offsetCenter = item.offset + item.width / 2;\n result.push(item);\n }\n\n return result;\n}\nexport function prepareLayoutBarSeries(seriesType, ecModel) {\n var seriesModels = [];\n ecModel.eachSeriesByType(seriesType, function (seriesModel) {\n // Check series coordinate, do layout for cartesian2d only\n if (isOnCartesian(seriesModel)) {\n seriesModels.push(seriesModel);\n }\n });\n return seriesModels;\n}\n/**\n * Map from (baseAxis.dim + '_' + baseAxis.index) to min gap of two adjacent\n * values.\n * This works for time axes, value axes, and log axes.\n * For a single time axis, return value is in the form like\n * {'x_0': [1000000]}.\n * The value of 1000000 is in milliseconds.\n */\n\nfunction getValueAxesMinGaps(barSeries) {\n /**\n * Map from axis.index to values.\n * For a single time axis, axisValues is in the form like\n * {'x_0': [1495555200000, 1495641600000, 1495728000000]}.\n * Items in axisValues[x], e.g. 1495555200000, are time values of all\n * series.\n */\n var axisValues = {};\n each(barSeries, function (seriesModel) {\n var cartesian = seriesModel.coordinateSystem;\n var baseAxis = cartesian.getBaseAxis();\n\n if (baseAxis.type !== 'time' && baseAxis.type !== 'value') {\n return;\n }\n\n var data = seriesModel.getData();\n var key = baseAxis.dim + '_' + baseAxis.index;\n var dimIdx = data.getDimensionIndex(data.mapDimension(baseAxis.dim));\n var store = data.getStore();\n\n for (var i = 0, cnt = store.count(); i < cnt; ++i) {\n var value = store.get(dimIdx, i);\n\n if (!axisValues[key]) {\n // No previous data for the axis\n axisValues[key] = [value];\n } else {\n // No value in previous series\n axisValues[key].push(value);\n } // Ignore duplicated time values in the same axis\n\n }\n });\n var axisMinGaps = {};\n\n for (var key in axisValues) {\n if (axisValues.hasOwnProperty(key)) {\n var valuesInAxis = axisValues[key];\n\n if (valuesInAxis) {\n // Sort axis values into ascending order to calculate gaps\n valuesInAxis.sort(function (a, b) {\n return a - b;\n });\n var min = null;\n\n for (var j = 1; j < valuesInAxis.length; ++j) {\n var delta = valuesInAxis[j] - valuesInAxis[j - 1];\n\n if (delta > 0) {\n // Ignore 0 delta because they are of the same axis value\n min = min === null ? delta : Math.min(min, delta);\n }\n } // Set to null if only have one data\n\n\n axisMinGaps[key] = min;\n }\n }\n }\n\n return axisMinGaps;\n}\n\nexport function makeColumnLayout(barSeries) {\n var axisMinGaps = getValueAxesMinGaps(barSeries);\n var seriesInfoList = [];\n each(barSeries, function (seriesModel) {\n var cartesian = seriesModel.coordinateSystem;\n var baseAxis = cartesian.getBaseAxis();\n var axisExtent = baseAxis.getExtent();\n var bandWidth;\n\n if (baseAxis.type === 'category') {\n bandWidth = baseAxis.getBandWidth();\n } else if (baseAxis.type === 'value' || baseAxis.type === 'time') {\n var key = baseAxis.dim + '_' + baseAxis.index;\n var minGap = axisMinGaps[key];\n var extentSpan = Math.abs(axisExtent[1] - axisExtent[0]);\n var scale = baseAxis.scale.getExtent();\n var scaleSpan = Math.abs(scale[1] - scale[0]);\n bandWidth = minGap ? extentSpan / scaleSpan * minGap : extentSpan; // When there is only one data value\n } else {\n var data = seriesModel.getData();\n bandWidth = Math.abs(axisExtent[1] - axisExtent[0]) / data.count();\n }\n\n var barWidth = parsePercent(seriesModel.get('barWidth'), bandWidth);\n var barMaxWidth = parsePercent(seriesModel.get('barMaxWidth'), bandWidth);\n var barMinWidth = parsePercent( // barMinWidth by default is 0.5 / 1 in cartesian. Because in value axis,\n // the auto-calculated bar width might be less than 0.5 / 1.\n seriesModel.get('barMinWidth') || (isInLargeMode(seriesModel) ? 0.5 : 1), bandWidth);\n var barGap = seriesModel.get('barGap');\n var barCategoryGap = seriesModel.get('barCategoryGap');\n seriesInfoList.push({\n bandWidth: bandWidth,\n barWidth: barWidth,\n barMaxWidth: barMaxWidth,\n barMinWidth: barMinWidth,\n barGap: barGap,\n barCategoryGap: barCategoryGap,\n axisKey: getAxisKey(baseAxis),\n stackId: getSeriesStackId(seriesModel)\n });\n });\n return doCalBarWidthAndOffset(seriesInfoList);\n}\n\nfunction doCalBarWidthAndOffset(seriesInfoList) {\n // Columns info on each category axis. Key is cartesian name\n var columnsMap = {};\n each(seriesInfoList, function (seriesInfo, idx) {\n var axisKey = seriesInfo.axisKey;\n var bandWidth = seriesInfo.bandWidth;\n var columnsOnAxis = columnsMap[axisKey] || {\n bandWidth: bandWidth,\n remainedWidth: bandWidth,\n autoWidthCount: 0,\n categoryGap: null,\n gap: '20%',\n stacks: {}\n };\n var stacks = columnsOnAxis.stacks;\n columnsMap[axisKey] = columnsOnAxis;\n var stackId = seriesInfo.stackId;\n\n if (!stacks[stackId]) {\n columnsOnAxis.autoWidthCount++;\n }\n\n stacks[stackId] = stacks[stackId] || {\n width: 0,\n maxWidth: 0\n }; // Caution: In a single coordinate system, these barGrid attributes\n // will be shared by series. Consider that they have default values,\n // only the attributes set on the last series will work.\n // Do not change this fact unless there will be a break change.\n\n var barWidth = seriesInfo.barWidth;\n\n if (barWidth && !stacks[stackId].width) {\n // See #6312, do not restrict width.\n stacks[stackId].width = barWidth;\n barWidth = Math.min(columnsOnAxis.remainedWidth, barWidth);\n columnsOnAxis.remainedWidth -= barWidth;\n }\n\n var barMaxWidth = seriesInfo.barMaxWidth;\n barMaxWidth && (stacks[stackId].maxWidth = barMaxWidth);\n var barMinWidth = seriesInfo.barMinWidth;\n barMinWidth && (stacks[stackId].minWidth = barMinWidth);\n var barGap = seriesInfo.barGap;\n barGap != null && (columnsOnAxis.gap = barGap);\n var barCategoryGap = seriesInfo.barCategoryGap;\n barCategoryGap != null && (columnsOnAxis.categoryGap = barCategoryGap);\n });\n var result = {};\n each(columnsMap, function (columnsOnAxis, coordSysName) {\n result[coordSysName] = {};\n var stacks = columnsOnAxis.stacks;\n var bandWidth = columnsOnAxis.bandWidth;\n var categoryGapPercent = columnsOnAxis.categoryGap;\n\n if (categoryGapPercent == null) {\n var columnCount = keys(stacks).length; // More columns in one group\n // the spaces between group is smaller. Or the column will be too thin.\n\n categoryGapPercent = Math.max(35 - columnCount * 4, 15) + '%';\n }\n\n var categoryGap = parsePercent(categoryGapPercent, bandWidth);\n var barGapPercent = parsePercent(columnsOnAxis.gap, 1);\n var remainedWidth = columnsOnAxis.remainedWidth;\n var autoWidthCount = columnsOnAxis.autoWidthCount;\n var autoWidth = (remainedWidth - categoryGap) / (autoWidthCount + (autoWidthCount - 1) * barGapPercent);\n autoWidth = Math.max(autoWidth, 0); // Find if any auto calculated bar exceeded maxBarWidth\n\n each(stacks, function (column) {\n var maxWidth = column.maxWidth;\n var minWidth = column.minWidth;\n\n if (!column.width) {\n var finalWidth = autoWidth;\n\n if (maxWidth && maxWidth < finalWidth) {\n finalWidth = Math.min(maxWidth, remainedWidth);\n } // `minWidth` has higher priority. `minWidth` decide that wheter the\n // bar is able to be visible. So `minWidth` should not be restricted\n // by `maxWidth` or `remainedWidth` (which is from `bandWidth`). In\n // the extreme cases for `value` axis, bars are allowed to overlap\n // with each other if `minWidth` specified.\n\n\n if (minWidth && minWidth > finalWidth) {\n finalWidth = minWidth;\n }\n\n if (finalWidth !== autoWidth) {\n column.width = finalWidth;\n remainedWidth -= finalWidth + barGapPercent * finalWidth;\n autoWidthCount--;\n }\n } else {\n // `barMinWidth/barMaxWidth` has higher priority than `barWidth`, as\n // CSS does. Becuase barWidth can be a percent value, where\n // `barMaxWidth` can be used to restrict the final width.\n var finalWidth = column.width;\n\n if (maxWidth) {\n finalWidth = Math.min(finalWidth, maxWidth);\n } // `minWidth` has higher priority, as described above\n\n\n if (minWidth) {\n finalWidth = Math.max(finalWidth, minWidth);\n }\n\n column.width = finalWidth;\n remainedWidth -= finalWidth + barGapPercent * finalWidth;\n autoWidthCount--;\n }\n }); // Recalculate width again\n\n autoWidth = (remainedWidth - categoryGap) / (autoWidthCount + (autoWidthCount - 1) * barGapPercent);\n autoWidth = Math.max(autoWidth, 0);\n var widthSum = 0;\n var lastColumn;\n each(stacks, function (column, idx) {\n if (!column.width) {\n column.width = autoWidth;\n }\n\n lastColumn = column;\n widthSum += column.width * (1 + barGapPercent);\n });\n\n if (lastColumn) {\n widthSum -= lastColumn.width * barGapPercent;\n }\n\n var offset = -widthSum / 2;\n each(stacks, function (column, stackId) {\n result[coordSysName][stackId] = result[coordSysName][stackId] || {\n bandWidth: bandWidth,\n offset: offset,\n width: column.width\n };\n offset += column.width * (1 + barGapPercent);\n });\n });\n return result;\n}\n\nfunction retrieveColumnLayout(barWidthAndOffset, axis, seriesModel) {\n if (barWidthAndOffset && axis) {\n var result = barWidthAndOffset[getAxisKey(axis)];\n\n if (result != null && seriesModel != null) {\n return result[getSeriesStackId(seriesModel)];\n }\n\n return result;\n }\n}\n\nexport { retrieveColumnLayout };\nexport function layout(seriesType, ecModel) {\n var seriesModels = prepareLayoutBarSeries(seriesType, ecModel);\n var barWidthAndOffset = makeColumnLayout(seriesModels);\n each(seriesModels, function (seriesModel) {\n var data = seriesModel.getData();\n var cartesian = seriesModel.coordinateSystem;\n var baseAxis = cartesian.getBaseAxis();\n var stackId = getSeriesStackId(seriesModel);\n var columnLayoutInfo = barWidthAndOffset[getAxisKey(baseAxis)][stackId];\n var columnOffset = columnLayoutInfo.offset;\n var columnWidth = columnLayoutInfo.width;\n data.setLayout({\n bandWidth: columnLayoutInfo.bandWidth,\n offset: columnOffset,\n size: columnWidth\n });\n });\n} // TODO: Do not support stack in large mode yet.\n\nexport function createProgressiveLayout(seriesType) {\n return {\n seriesType: seriesType,\n plan: createRenderPlanner(),\n reset: function (seriesModel) {\n if (!isOnCartesian(seriesModel)) {\n return;\n }\n\n var data = seriesModel.getData();\n var cartesian = seriesModel.coordinateSystem;\n var baseAxis = cartesian.getBaseAxis();\n var valueAxis = cartesian.getOtherAxis(baseAxis);\n var valueDimIdx = data.getDimensionIndex(data.mapDimension(valueAxis.dim));\n var baseDimIdx = data.getDimensionIndex(data.mapDimension(baseAxis.dim));\n var drawBackground = seriesModel.get('showBackground', true);\n var valueDim = data.mapDimension(valueAxis.dim);\n var stackResultDim = data.getCalculationInfo('stackResultDimension');\n var stacked = isDimensionStacked(data, valueDim) && !!data.getCalculationInfo('stackedOnSeries');\n var isValueAxisH = valueAxis.isHorizontal();\n var valueAxisStart = getValueAxisStart(baseAxis, valueAxis);\n var isLarge = isInLargeMode(seriesModel);\n var barMinHeight = seriesModel.get('barMinHeight') || 0;\n var stackedDimIdx = stackResultDim && data.getDimensionIndex(stackResultDim); // Layout info.\n\n var columnWidth = data.getLayout('size');\n var columnOffset = data.getLayout('offset');\n return {\n progress: function (params, data) {\n var count = params.count;\n var largePoints = isLarge && createFloat32Array(count * 3);\n var largeBackgroundPoints = isLarge && drawBackground && createFloat32Array(count * 3);\n var largeDataIndices = isLarge && createFloat32Array(count);\n var coordLayout = cartesian.master.getRect();\n var bgSize = isValueAxisH ? coordLayout.width : coordLayout.height;\n var dataIndex;\n var store = data.getStore();\n var idxOffset = 0;\n\n while ((dataIndex = params.next()) != null) {\n var value = store.get(stacked ? stackedDimIdx : valueDimIdx, dataIndex);\n var baseValue = store.get(baseDimIdx, dataIndex);\n var baseCoord = valueAxisStart;\n var startValue = void 0; // Because of the barMinHeight, we can not use the value in\n // stackResultDimension directly.\n\n if (stacked) {\n startValue = +value - store.get(valueDimIdx, dataIndex);\n }\n\n var x = void 0;\n var y = void 0;\n var width = void 0;\n var height = void 0;\n\n if (isValueAxisH) {\n var coord = cartesian.dataToPoint([value, baseValue]);\n\n if (stacked) {\n var startCoord = cartesian.dataToPoint([startValue, baseValue]);\n baseCoord = startCoord[0];\n }\n\n x = baseCoord;\n y = coord[1] + columnOffset;\n width = coord[0] - baseCoord;\n height = columnWidth;\n\n if (Math.abs(width) < barMinHeight) {\n width = (width < 0 ? -1 : 1) * barMinHeight;\n }\n } else {\n var coord = cartesian.dataToPoint([baseValue, value]);\n\n if (stacked) {\n var startCoord = cartesian.dataToPoint([baseValue, startValue]);\n baseCoord = startCoord[1];\n }\n\n x = coord[0] + columnOffset;\n y = baseCoord;\n width = columnWidth;\n height = coord[1] - baseCoord;\n\n if (Math.abs(height) < barMinHeight) {\n // Include zero to has a positive bar\n height = (height <= 0 ? -1 : 1) * barMinHeight;\n }\n }\n\n if (!isLarge) {\n data.setItemLayout(dataIndex, {\n x: x,\n y: y,\n width: width,\n height: height\n });\n } else {\n largePoints[idxOffset] = x;\n largePoints[idxOffset + 1] = y;\n largePoints[idxOffset + 2] = isValueAxisH ? width : height;\n\n if (largeBackgroundPoints) {\n largeBackgroundPoints[idxOffset] = isValueAxisH ? coordLayout.x : x;\n largeBackgroundPoints[idxOffset + 1] = isValueAxisH ? y : coordLayout.y;\n largeBackgroundPoints[idxOffset + 2] = bgSize;\n }\n\n largeDataIndices[dataIndex] = dataIndex;\n }\n\n idxOffset += 3;\n }\n\n if (isLarge) {\n data.setLayout({\n largePoints: largePoints,\n largeDataIndices: largeDataIndices,\n largeBackgroundPoints: largeBackgroundPoints,\n valueAxisHorizontal: isValueAxisH\n });\n }\n }\n };\n }\n };\n}\n\nfunction isOnCartesian(seriesModel) {\n return seriesModel.coordinateSystem && seriesModel.coordinateSystem.type === 'cartesian2d';\n}\n\nfunction isInLargeMode(seriesModel) {\n return seriesModel.pipelineContext && seriesModel.pipelineContext.large;\n} // See cases in `test/bar-start.html` and `#7412`, `#8747`.\n\n\nfunction getValueAxisStart(baseAxis, valueAxis) {\n return valueAxis.toGlobalCoord(valueAxis.dataToCoord(valueAxis.type === 'log' ? 1 : 0));\n}","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { __extends } from \"tslib\";\nimport SeriesModel from '../../model/Series.js';\nimport createSeriesData from '../helper/createSeriesData.js';\n\nvar BaseBarSeriesModel =\n/** @class */\nfunction (_super) {\n __extends(BaseBarSeriesModel, _super);\n\n function BaseBarSeriesModel() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n\n _this.type = BaseBarSeriesModel.type;\n return _this;\n }\n\n BaseBarSeriesModel.prototype.getInitialData = function (option, ecModel) {\n return createSeriesData(null, this, {\n useEncodeDefaulter: true\n });\n };\n\n BaseBarSeriesModel.prototype.getMarkerPosition = function (value) {\n var coordSys = this.coordinateSystem;\n\n if (coordSys && coordSys.clampData) {\n // PENDING if clamp ?\n var pt = coordSys.dataToPoint(coordSys.clampData(value));\n var data = this.getData();\n var offset = data.getLayout('offset');\n var size = data.getLayout('size');\n var offsetIndex = coordSys.getBaseAxis().isHorizontal() ? 0 : 1;\n pt[offsetIndex] += offset + size / 2;\n return pt;\n }\n\n return [NaN, NaN];\n };\n\n BaseBarSeriesModel.type = 'series.__base_bar__';\n BaseBarSeriesModel.defaultOption = {\n // zlevel: 0,\n z: 2,\n coordinateSystem: 'cartesian2d',\n legendHoverLink: true,\n // stack: null\n // Cartesian coordinate system\n // xAxisIndex: 0,\n // yAxisIndex: 0,\n barMinHeight: 0,\n barMinAngle: 0,\n // cursor: null,\n large: false,\n largeThreshold: 400,\n progressive: 3e3,\n progressiveChunkMode: 'mod'\n };\n return BaseBarSeriesModel;\n}(SeriesModel);\n\nSeriesModel.registerClass(BaseBarSeriesModel);\nexport default BaseBarSeriesModel;","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { __extends } from \"tslib\";\nimport BaseBarSeriesModel from './BaseBarSeries.js';\nimport createSeriesData from '../helper/createSeriesData.js';\nimport { inheritDefaultOption } from '../../util/component.js';\n\nvar BarSeriesModel =\n/** @class */\nfunction (_super) {\n __extends(BarSeriesModel, _super);\n\n function BarSeriesModel() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n\n _this.type = BarSeriesModel.type;\n return _this;\n }\n\n BarSeriesModel.prototype.getInitialData = function () {\n return createSeriesData(null, this, {\n useEncodeDefaulter: true,\n createInvertedIndices: !!this.get('realtimeSort', true) || null\n });\n };\n /**\n * @override\n */\n\n\n BarSeriesModel.prototype.getProgressive = function () {\n // Do not support progressive in normal mode.\n return this.get('large') ? this.get('progressive') : false;\n };\n /**\n * @override\n */\n\n\n BarSeriesModel.prototype.getProgressiveThreshold = function () {\n // Do not support progressive in normal mode.\n var progressiveThreshold = this.get('progressiveThreshold');\n var largeThreshold = this.get('largeThreshold');\n\n if (largeThreshold > progressiveThreshold) {\n progressiveThreshold = largeThreshold;\n }\n\n return progressiveThreshold;\n };\n\n BarSeriesModel.prototype.brushSelector = function (dataIndex, data, selectors) {\n return selectors.rect(data.getItemLayout(dataIndex));\n };\n\n BarSeriesModel.type = 'series.bar';\n BarSeriesModel.dependencies = ['grid', 'polar'];\n BarSeriesModel.defaultOption = inheritDefaultOption(BaseBarSeriesModel.defaultOption, {\n // If clipped\n // Only available on cartesian2d\n clip: true,\n roundCap: false,\n showBackground: false,\n backgroundStyle: {\n color: 'rgba(180, 180, 180, 0.2)',\n borderColor: null,\n borderWidth: 0,\n borderType: 'solid',\n borderRadius: 0,\n shadowBlur: 0,\n shadowColor: null,\n shadowOffsetX: 0,\n shadowOffsetY: 0,\n opacity: 1\n },\n select: {\n itemStyle: {\n borderColor: '#212121'\n }\n },\n realtimeSort: false\n });\n return BarSeriesModel;\n}(BaseBarSeriesModel);\n\nexport default BarSeriesModel;","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { __extends } from \"tslib\";\nimport { Path } from '../graphic.js';\n/**\n * Sausage: similar to sector, but have half circle on both sides\n */\n\nvar SausageShape =\n/** @class */\nfunction () {\n function SausageShape() {\n this.cx = 0;\n this.cy = 0;\n this.r0 = 0;\n this.r = 0;\n this.startAngle = 0;\n this.endAngle = Math.PI * 2;\n this.clockwise = true;\n }\n\n return SausageShape;\n}();\n\nvar SausagePath =\n/** @class */\nfunction (_super) {\n __extends(SausagePath, _super);\n\n function SausagePath(opts) {\n var _this = _super.call(this, opts) || this;\n\n _this.type = 'sausage';\n return _this;\n }\n\n SausagePath.prototype.getDefaultShape = function () {\n return new SausageShape();\n };\n\n SausagePath.prototype.buildPath = function (ctx, shape) {\n var cx = shape.cx;\n var cy = shape.cy;\n var r0 = Math.max(shape.r0 || 0, 0);\n var r = Math.max(shape.r, 0);\n var dr = (r - r0) * 0.5;\n var rCenter = r0 + dr;\n var startAngle = shape.startAngle;\n var endAngle = shape.endAngle;\n var clockwise = shape.clockwise;\n var PI2 = Math.PI * 2;\n var lessThanCircle = clockwise ? endAngle - startAngle < PI2 : startAngle - endAngle < PI2;\n\n if (!lessThanCircle) {\n // Normalize angles\n startAngle = endAngle - (clockwise ? PI2 : -PI2);\n }\n\n var unitStartX = Math.cos(startAngle);\n var unitStartY = Math.sin(startAngle);\n var unitEndX = Math.cos(endAngle);\n var unitEndY = Math.sin(endAngle);\n\n if (lessThanCircle) {\n ctx.moveTo(unitStartX * r0 + cx, unitStartY * r0 + cy);\n ctx.arc(unitStartX * rCenter + cx, unitStartY * rCenter + cy, dr, -Math.PI + startAngle, startAngle, !clockwise);\n } else {\n ctx.moveTo(unitStartX * r + cx, unitStartY * r + cy);\n }\n\n ctx.arc(cx, cy, r, startAngle, endAngle, !clockwise);\n ctx.arc(unitEndX * rCenter + cx, unitEndY * rCenter + cy, dr, endAngle - Math.PI * 2, endAngle - Math.PI, !clockwise);\n\n if (r0 !== 0) {\n ctx.arc(cx, cy, r0, endAngle, startAngle, clockwise);\n } // ctx.closePath();\n\n };\n\n return SausagePath;\n}(Path);\n\nexport default SausagePath;","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { calculateTextPosition } from 'zrender/lib/contain/text.js';\nimport { isArray, isNumber } from 'zrender/lib/core/util.js';\nexport function createSectorCalculateTextPosition(positionMapping, opts) {\n opts = opts || {};\n var isRoundCap = opts.isRoundCap;\n return function (out, opts, boundingRect) {\n var textPosition = opts.position;\n\n if (!textPosition || textPosition instanceof Array) {\n return calculateTextPosition(out, opts, boundingRect);\n }\n\n var mappedSectorPosition = positionMapping(textPosition);\n var distance = opts.distance != null ? opts.distance : 5;\n var sector = this.shape;\n var cx = sector.cx;\n var cy = sector.cy;\n var r = sector.r;\n var r0 = sector.r0;\n var middleR = (r + r0) / 2;\n var startAngle = sector.startAngle;\n var endAngle = sector.endAngle;\n var middleAngle = (startAngle + endAngle) / 2;\n var extraDist = isRoundCap ? Math.abs(r - r0) / 2 : 0;\n var mathCos = Math.cos;\n var mathSin = Math.sin; // base position: top-left\n\n var x = cx + r * mathCos(startAngle);\n var y = cy + r * mathSin(startAngle);\n var textAlign = 'left';\n var textVerticalAlign = 'top';\n\n switch (mappedSectorPosition) {\n case 'startArc':\n x = cx + (r0 - distance) * mathCos(middleAngle);\n y = cy + (r0 - distance) * mathSin(middleAngle);\n textAlign = 'center';\n textVerticalAlign = 'top';\n break;\n\n case 'insideStartArc':\n x = cx + (r0 + distance) * mathCos(middleAngle);\n y = cy + (r0 + distance) * mathSin(middleAngle);\n textAlign = 'center';\n textVerticalAlign = 'bottom';\n break;\n\n case 'startAngle':\n x = cx + middleR * mathCos(startAngle) + adjustAngleDistanceX(startAngle, distance + extraDist, false);\n y = cy + middleR * mathSin(startAngle) + adjustAngleDistanceY(startAngle, distance + extraDist, false);\n textAlign = 'right';\n textVerticalAlign = 'middle';\n break;\n\n case 'insideStartAngle':\n x = cx + middleR * mathCos(startAngle) + adjustAngleDistanceX(startAngle, -distance + extraDist, false);\n y = cy + middleR * mathSin(startAngle) + adjustAngleDistanceY(startAngle, -distance + extraDist, false);\n textAlign = 'left';\n textVerticalAlign = 'middle';\n break;\n\n case 'middle':\n x = cx + middleR * mathCos(middleAngle);\n y = cy + middleR * mathSin(middleAngle);\n textAlign = 'center';\n textVerticalAlign = 'middle';\n break;\n\n case 'endArc':\n x = cx + (r + distance) * mathCos(middleAngle);\n y = cy + (r + distance) * mathSin(middleAngle);\n textAlign = 'center';\n textVerticalAlign = 'bottom';\n break;\n\n case 'insideEndArc':\n x = cx + (r - distance) * mathCos(middleAngle);\n y = cy + (r - distance) * mathSin(middleAngle);\n textAlign = 'center';\n textVerticalAlign = 'top';\n break;\n\n case 'endAngle':\n x = cx + middleR * mathCos(endAngle) + adjustAngleDistanceX(endAngle, distance + extraDist, true);\n y = cy + middleR * mathSin(endAngle) + adjustAngleDistanceY(endAngle, distance + extraDist, true);\n textAlign = 'left';\n textVerticalAlign = 'middle';\n break;\n\n case 'insideEndAngle':\n x = cx + middleR * mathCos(endAngle) + adjustAngleDistanceX(endAngle, -distance + extraDist, true);\n y = cy + middleR * mathSin(endAngle) + adjustAngleDistanceY(endAngle, -distance + extraDist, true);\n textAlign = 'right';\n textVerticalAlign = 'middle';\n break;\n\n default:\n return calculateTextPosition(out, opts, boundingRect);\n }\n\n out = out || {};\n out.x = x;\n out.y = y;\n out.align = textAlign;\n out.verticalAlign = textVerticalAlign;\n return out;\n };\n}\nexport function setSectorTextRotation(sector, textPosition, positionMapping, rotateType) {\n if (isNumber(rotateType)) {\n // user-set rotation\n sector.setTextConfig({\n rotation: rotateType\n });\n return;\n } else if (isArray(textPosition)) {\n // user-set position, use 0 as auto rotation\n sector.setTextConfig({\n rotation: 0\n });\n return;\n }\n\n var shape = sector.shape;\n var startAngle = shape.clockwise ? shape.startAngle : shape.endAngle;\n var endAngle = shape.clockwise ? shape.endAngle : shape.startAngle;\n var middleAngle = (startAngle + endAngle) / 2;\n var anchorAngle;\n var mappedSectorPosition = positionMapping(textPosition);\n\n switch (mappedSectorPosition) {\n case 'startArc':\n case 'insideStartArc':\n case 'middle':\n case 'insideEndArc':\n case 'endArc':\n anchorAngle = middleAngle;\n break;\n\n case 'startAngle':\n case 'insideStartAngle':\n anchorAngle = startAngle;\n break;\n\n case 'endAngle':\n case 'insideEndAngle':\n anchorAngle = endAngle;\n break;\n\n default:\n sector.setTextConfig({\n rotation: 0\n });\n return;\n }\n\n var rotate = Math.PI * 1.5 - anchorAngle;\n /**\n * TODO: labels with rotate > Math.PI / 2 should be rotate another\n * half round flipped to increase readability. However, only middle\n * position supports this for now, because in other positions, the\n * anchor point is not at the center of the text, so the positions\n * after rotating is not as expected.\n */\n\n if (mappedSectorPosition === 'middle' && rotate > Math.PI / 2 && rotate < Math.PI * 1.5) {\n rotate -= Math.PI;\n }\n\n sector.setTextConfig({\n rotation: rotate\n });\n}\n\nfunction adjustAngleDistanceX(angle, distance, isEnd) {\n return distance * Math.sin(angle) * (isEnd ? -1 : 1);\n}\n\nfunction adjustAngleDistanceY(angle, distance, isEnd) {\n return distance * Math.cos(angle) * (isEnd ? 1 : -1);\n}","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { __extends } from \"tslib\";\nimport Path from 'zrender/lib/graphic/Path.js';\nimport Group from 'zrender/lib/graphic/Group.js';\nimport { extend, each, map } from 'zrender/lib/core/util.js';\nimport { Rect, Sector, updateProps, initProps, removeElementWithFadeOut, traverseElements } from '../../util/graphic.js';\nimport { getECData } from '../../util/innerStore.js';\nimport { setStatesStylesFromModel, toggleHoverEmphasis } from '../../util/states.js';\nimport { setLabelStyle, getLabelStatesModels, setLabelValueAnimation, labelInner } from '../../label/labelStyle.js';\nimport { throttle } from '../../util/throttle.js';\nimport { createClipPath } from '../helper/createClipPathFromCoordSys.js';\nimport Sausage from '../../util/shape/sausage.js';\nimport ChartView from '../../view/Chart.js';\nimport { isCoordinateSystemType } from '../../coord/CoordinateSystem.js';\nimport { getDefaultLabel, getDefaultInterpolatedLabel } from '../helper/labelHelper.js';\nimport { warn } from '../../util/log.js';\nimport { createSectorCalculateTextPosition, setSectorTextRotation } from '../../label/sectorLabel.js';\nimport { saveOldStyle } from '../../animation/basicTrasition.js';\nvar mathMax = Math.max;\nvar mathMin = Math.min;\n\nfunction getClipArea(coord, data) {\n var coordSysClipArea = coord.getArea && coord.getArea();\n\n if (isCoordinateSystemType(coord, 'cartesian2d')) {\n var baseAxis = coord.getBaseAxis(); // When boundaryGap is false or using time axis. bar may exceed the grid.\n // We should not clip this part.\n // See test/bar2.html\n\n if (baseAxis.type !== 'category' || !baseAxis.onBand) {\n var expandWidth = data.getLayout('bandWidth');\n\n if (baseAxis.isHorizontal()) {\n coordSysClipArea.x -= expandWidth;\n coordSysClipArea.width += expandWidth * 2;\n } else {\n coordSysClipArea.y -= expandWidth;\n coordSysClipArea.height += expandWidth * 2;\n }\n }\n }\n\n return coordSysClipArea;\n}\n\nvar BarView =\n/** @class */\nfunction (_super) {\n __extends(BarView, _super);\n\n function BarView() {\n var _this = _super.call(this) || this;\n\n _this.type = BarView.type;\n _this._isFirstFrame = true;\n return _this;\n }\n\n BarView.prototype.render = function (seriesModel, ecModel, api, payload) {\n this._model = seriesModel;\n\n this._removeOnRenderedListener(api);\n\n this._updateDrawMode(seriesModel);\n\n var coordinateSystemType = seriesModel.get('coordinateSystem');\n\n if (coordinateSystemType === 'cartesian2d' || coordinateSystemType === 'polar') {\n // Clear previously rendered progressive elements.\n this._progressiveEls = null;\n this._isLargeDraw ? this._renderLarge(seriesModel, ecModel, api) : this._renderNormal(seriesModel, ecModel, api, payload);\n } else if (process.env.NODE_ENV !== 'production') {\n warn('Only cartesian2d and polar supported for bar.');\n }\n };\n\n BarView.prototype.incrementalPrepareRender = function (seriesModel) {\n this._clear();\n\n this._updateDrawMode(seriesModel); // incremental also need to clip, otherwise might be overlow.\n // But must not set clip in each frame, otherwise all of the children will be marked redraw.\n\n\n this._updateLargeClip(seriesModel);\n };\n\n BarView.prototype.incrementalRender = function (params, seriesModel) {\n // Reset\n this._progressiveEls = []; // Do not support progressive in normal mode.\n\n this._incrementalRenderLarge(params, seriesModel);\n };\n\n BarView.prototype.eachRendered = function (cb) {\n traverseElements(this._progressiveEls || this.group, cb);\n };\n\n BarView.prototype._updateDrawMode = function (seriesModel) {\n var isLargeDraw = seriesModel.pipelineContext.large;\n\n if (this._isLargeDraw == null || isLargeDraw !== this._isLargeDraw) {\n this._isLargeDraw = isLargeDraw;\n\n this._clear();\n }\n };\n\n BarView.prototype._renderNormal = function (seriesModel, ecModel, api, payload) {\n var group = this.group;\n var data = seriesModel.getData();\n var oldData = this._data;\n var coord = seriesModel.coordinateSystem;\n var baseAxis = coord.getBaseAxis();\n var isHorizontalOrRadial;\n\n if (coord.type === 'cartesian2d') {\n isHorizontalOrRadial = baseAxis.isHorizontal();\n } else if (coord.type === 'polar') {\n isHorizontalOrRadial = baseAxis.dim === 'angle';\n }\n\n var animationModel = seriesModel.isAnimationEnabled() ? seriesModel : null;\n var realtimeSortCfg = shouldRealtimeSort(seriesModel, coord);\n\n if (realtimeSortCfg) {\n this._enableRealtimeSort(realtimeSortCfg, data, api);\n }\n\n var needsClip = seriesModel.get('clip', true) || realtimeSortCfg;\n var coordSysClipArea = getClipArea(coord, data); // If there is clipPath created in large mode. Remove it.\n\n group.removeClipPath(); // We don't use clipPath in normal mode because we needs a perfect animation\n // And don't want the label are clipped.\n\n var roundCap = seriesModel.get('roundCap', true);\n var drawBackground = seriesModel.get('showBackground', true);\n var backgroundModel = seriesModel.getModel('backgroundStyle');\n var barBorderRadius = backgroundModel.get('borderRadius') || 0;\n var bgEls = [];\n var oldBgEls = this._backgroundEls;\n var isInitSort = payload && payload.isInitSort;\n var isChangeOrder = payload && payload.type === 'changeAxisOrder';\n\n function createBackground(dataIndex) {\n var bgLayout = getLayout[coord.type](data, dataIndex);\n var bgEl = createBackgroundEl(coord, isHorizontalOrRadial, bgLayout);\n bgEl.useStyle(backgroundModel.getItemStyle()); // Only cartesian2d support borderRadius.\n\n if (coord.type === 'cartesian2d') {\n bgEl.setShape('r', barBorderRadius);\n }\n\n bgEls[dataIndex] = bgEl;\n return bgEl;\n }\n\n ;\n data.diff(oldData).add(function (dataIndex) {\n var itemModel = data.getItemModel(dataIndex);\n var layout = getLayout[coord.type](data, dataIndex, itemModel);\n\n if (drawBackground) {\n createBackground(dataIndex);\n } // If dataZoom in filteMode: 'empty', the baseValue can be set as NaN in \"axisProxy\".\n\n\n if (!data.hasValue(dataIndex) || !isValidLayout[coord.type](layout)) {\n return;\n }\n\n var isClipped = false;\n\n if (needsClip) {\n // Clip will modify the layout params.\n // And return a boolean to determine if the shape are fully clipped.\n isClipped = clip[coord.type](coordSysClipArea, layout);\n }\n\n var el = elementCreator[coord.type](seriesModel, data, dataIndex, layout, isHorizontalOrRadial, animationModel, baseAxis.model, false, roundCap);\n\n if (realtimeSortCfg) {\n /**\n * Force label animation because even if the element is\n * ignored because it's clipped, it may not be clipped after\n * changing order. Then, if not using forceLabelAnimation,\n * the label animation was never started, in which case,\n * the label will be the final value and doesn't have label\n * animation.\n */\n el.forceLabelAnimation = true;\n }\n\n updateStyle(el, data, dataIndex, itemModel, layout, seriesModel, isHorizontalOrRadial, coord.type === 'polar');\n\n if (isInitSort) {\n el.attr({\n shape: layout\n });\n } else if (realtimeSortCfg) {\n updateRealtimeAnimation(realtimeSortCfg, animationModel, el, layout, dataIndex, isHorizontalOrRadial, false, false);\n } else {\n initProps(el, {\n shape: layout\n }, seriesModel, dataIndex);\n }\n\n data.setItemGraphicEl(dataIndex, el);\n group.add(el);\n el.ignore = isClipped;\n }).update(function (newIndex, oldIndex) {\n var itemModel = data.getItemModel(newIndex);\n var layout = getLayout[coord.type](data, newIndex, itemModel);\n\n if (drawBackground) {\n var bgEl = void 0;\n\n if (oldBgEls.length === 0) {\n bgEl = createBackground(oldIndex);\n } else {\n bgEl = oldBgEls[oldIndex];\n bgEl.useStyle(backgroundModel.getItemStyle()); // Only cartesian2d support borderRadius.\n\n if (coord.type === 'cartesian2d') {\n bgEl.setShape('r', barBorderRadius);\n }\n\n bgEls[newIndex] = bgEl;\n }\n\n var bgLayout = getLayout[coord.type](data, newIndex);\n var shape = createBackgroundShape(isHorizontalOrRadial, bgLayout, coord);\n updateProps(bgEl, {\n shape: shape\n }, animationModel, newIndex);\n }\n\n var el = oldData.getItemGraphicEl(oldIndex);\n\n if (!data.hasValue(newIndex) || !isValidLayout[coord.type](layout)) {\n group.remove(el);\n return;\n }\n\n var isClipped = false;\n\n if (needsClip) {\n isClipped = clip[coord.type](coordSysClipArea, layout);\n\n if (isClipped) {\n group.remove(el);\n }\n }\n\n if (!el) {\n el = elementCreator[coord.type](seriesModel, data, newIndex, layout, isHorizontalOrRadial, animationModel, baseAxis.model, !!el, roundCap);\n } else {\n saveOldStyle(el);\n }\n\n if (realtimeSortCfg) {\n el.forceLabelAnimation = true;\n }\n\n if (isChangeOrder) {\n var textEl = el.getTextContent();\n\n if (textEl) {\n var labelInnerStore = labelInner(textEl);\n\n if (labelInnerStore.prevValue != null) {\n /**\n * Set preValue to be value so that no new label\n * should be started, otherwise, it will take a full\n * `animationDurationUpdate` time to finish the\n * animation, which is not expected.\n */\n labelInnerStore.prevValue = labelInnerStore.value;\n }\n }\n } // Not change anything if only order changed.\n // Especially not change label.\n else {\n updateStyle(el, data, newIndex, itemModel, layout, seriesModel, isHorizontalOrRadial, coord.type === 'polar');\n }\n\n if (isInitSort) {\n el.attr({\n shape: layout\n });\n } else if (realtimeSortCfg) {\n updateRealtimeAnimation(realtimeSortCfg, animationModel, el, layout, newIndex, isHorizontalOrRadial, true, isChangeOrder);\n } else {\n updateProps(el, {\n shape: layout\n }, seriesModel, newIndex, null);\n }\n\n data.setItemGraphicEl(newIndex, el);\n el.ignore = isClipped;\n group.add(el);\n }).remove(function (dataIndex) {\n var el = oldData.getItemGraphicEl(dataIndex);\n el && removeElementWithFadeOut(el, seriesModel, dataIndex);\n }).execute();\n var bgGroup = this._backgroundGroup || (this._backgroundGroup = new Group());\n bgGroup.removeAll();\n\n for (var i = 0; i < bgEls.length; ++i) {\n bgGroup.add(bgEls[i]);\n }\n\n group.add(bgGroup);\n this._backgroundEls = bgEls;\n this._data = data;\n };\n\n BarView.prototype._renderLarge = function (seriesModel, ecModel, api) {\n this._clear();\n\n createLarge(seriesModel, this.group);\n\n this._updateLargeClip(seriesModel);\n };\n\n BarView.prototype._incrementalRenderLarge = function (params, seriesModel) {\n this._removeBackground();\n\n createLarge(seriesModel, this.group, this._progressiveEls, true);\n };\n\n BarView.prototype._updateLargeClip = function (seriesModel) {\n // Use clipPath in large mode.\n var clipPath = seriesModel.get('clip', true) && createClipPath(seriesModel.coordinateSystem, false, seriesModel);\n var group = this.group;\n\n if (clipPath) {\n group.setClipPath(clipPath);\n } else {\n group.removeClipPath();\n }\n };\n\n BarView.prototype._enableRealtimeSort = function (realtimeSortCfg, data, api) {\n var _this = this; // If no data in the first frame, wait for data to initSort\n\n\n if (!data.count()) {\n return;\n }\n\n var baseAxis = realtimeSortCfg.baseAxis;\n\n if (this._isFirstFrame) {\n this._dispatchInitSort(data, realtimeSortCfg, api);\n\n this._isFirstFrame = false;\n } else {\n var orderMapping_1 = function (idx) {\n var el = data.getItemGraphicEl(idx);\n var shape = el && el.shape;\n return shape && // The result should be consistent with the initial sort by data value.\n // Do not support the case that both positive and negative exist.\n Math.abs(baseAxis.isHorizontal() ? shape.height : shape.width) // If data is NaN, shape.xxx may be NaN, so use || 0 here in case\n || 0;\n };\n\n this._onRendered = function () {\n _this._updateSortWithinSameData(data, orderMapping_1, baseAxis, api);\n };\n\n api.getZr().on('rendered', this._onRendered);\n }\n };\n\n BarView.prototype._dataSort = function (data, baseAxis, orderMapping) {\n var info = [];\n data.each(data.mapDimension(baseAxis.dim), function (ordinalNumber, dataIdx) {\n var mappedValue = orderMapping(dataIdx);\n mappedValue = mappedValue == null ? NaN : mappedValue;\n info.push({\n dataIndex: dataIdx,\n mappedValue: mappedValue,\n ordinalNumber: ordinalNumber\n });\n });\n info.sort(function (a, b) {\n // If NaN, it will be treated as min val.\n return b.mappedValue - a.mappedValue;\n });\n return {\n ordinalNumbers: map(info, function (item) {\n return item.ordinalNumber;\n })\n };\n };\n\n BarView.prototype._isOrderChangedWithinSameData = function (data, orderMapping, baseAxis) {\n var scale = baseAxis.scale;\n var ordinalDataDim = data.mapDimension(baseAxis.dim);\n var lastValue = Number.MAX_VALUE;\n\n for (var tickNum = 0, len = scale.getOrdinalMeta().categories.length; tickNum < len; ++tickNum) {\n var rawIdx = data.rawIndexOf(ordinalDataDim, scale.getRawOrdinalNumber(tickNum));\n var value = rawIdx < 0 // If some tick have no bar, the tick will be treated as min.\n ? Number.MIN_VALUE // PENDING: if dataZoom on baseAxis exits, is it a performance issue?\n : orderMapping(data.indexOfRawIndex(rawIdx));\n\n if (value > lastValue) {\n return true;\n }\n\n lastValue = value;\n }\n\n return false;\n };\n /*\n * Consider the case when A and B changed order, whose representing\n * bars are both out of sight, we don't wish to trigger reorder action\n * as long as the order in the view doesn't change.\n */\n\n\n BarView.prototype._isOrderDifferentInView = function (orderInfo, baseAxis) {\n var scale = baseAxis.scale;\n var extent = scale.getExtent();\n var tickNum = Math.max(0, extent[0]);\n var tickMax = Math.min(extent[1], scale.getOrdinalMeta().categories.length - 1);\n\n for (; tickNum <= tickMax; ++tickNum) {\n if (orderInfo.ordinalNumbers[tickNum] !== scale.getRawOrdinalNumber(tickNum)) {\n return true;\n }\n }\n };\n\n BarView.prototype._updateSortWithinSameData = function (data, orderMapping, baseAxis, api) {\n if (!this._isOrderChangedWithinSameData(data, orderMapping, baseAxis)) {\n return;\n }\n\n var sortInfo = this._dataSort(data, baseAxis, orderMapping);\n\n if (this._isOrderDifferentInView(sortInfo, baseAxis)) {\n this._removeOnRenderedListener(api);\n\n api.dispatchAction({\n type: 'changeAxisOrder',\n componentType: baseAxis.dim + 'Axis',\n axisId: baseAxis.index,\n sortInfo: sortInfo\n });\n }\n };\n\n BarView.prototype._dispatchInitSort = function (data, realtimeSortCfg, api) {\n var baseAxis = realtimeSortCfg.baseAxis;\n\n var sortResult = this._dataSort(data, baseAxis, function (dataIdx) {\n return data.get(data.mapDimension(realtimeSortCfg.otherAxis.dim), dataIdx);\n });\n\n api.dispatchAction({\n type: 'changeAxisOrder',\n componentType: baseAxis.dim + 'Axis',\n isInitSort: true,\n axisId: baseAxis.index,\n sortInfo: sortResult\n });\n };\n\n BarView.prototype.remove = function (ecModel, api) {\n this._clear(this._model);\n\n this._removeOnRenderedListener(api);\n };\n\n BarView.prototype.dispose = function (ecModel, api) {\n this._removeOnRenderedListener(api);\n };\n\n BarView.prototype._removeOnRenderedListener = function (api) {\n if (this._onRendered) {\n api.getZr().off('rendered', this._onRendered);\n this._onRendered = null;\n }\n };\n\n BarView.prototype._clear = function (model) {\n var group = this.group;\n var data = this._data;\n\n if (model && model.isAnimationEnabled() && data && !this._isLargeDraw) {\n this._removeBackground();\n\n this._backgroundEls = [];\n data.eachItemGraphicEl(function (el) {\n removeElementWithFadeOut(el, model, getECData(el).dataIndex);\n });\n } else {\n group.removeAll();\n }\n\n this._data = null;\n this._isFirstFrame = true;\n };\n\n BarView.prototype._removeBackground = function () {\n this.group.remove(this._backgroundGroup);\n this._backgroundGroup = null;\n };\n\n BarView.type = 'bar';\n return BarView;\n}(ChartView);\n\nvar clip = {\n cartesian2d: function (coordSysBoundingRect, layout) {\n var signWidth = layout.width < 0 ? -1 : 1;\n var signHeight = layout.height < 0 ? -1 : 1; // Needs positive width and height\n\n if (signWidth < 0) {\n layout.x += layout.width;\n layout.width = -layout.width;\n }\n\n if (signHeight < 0) {\n layout.y += layout.height;\n layout.height = -layout.height;\n }\n\n var coordSysX2 = coordSysBoundingRect.x + coordSysBoundingRect.width;\n var coordSysY2 = coordSysBoundingRect.y + coordSysBoundingRect.height;\n var x = mathMax(layout.x, coordSysBoundingRect.x);\n var x2 = mathMin(layout.x + layout.width, coordSysX2);\n var y = mathMax(layout.y, coordSysBoundingRect.y);\n var y2 = mathMin(layout.y + layout.height, coordSysY2);\n var xClipped = x2 < x;\n var yClipped = y2 < y; // When xClipped or yClipped, the element will be marked as `ignore`.\n // But we should also place the element at the edge of the coord sys bounding rect.\n // Beause if data changed and the bar show again, its transition animaiton\n // will begin at this place.\n\n layout.x = xClipped && x > coordSysX2 ? x2 : x;\n layout.y = yClipped && y > coordSysY2 ? y2 : y;\n layout.width = xClipped ? 0 : x2 - x;\n layout.height = yClipped ? 0 : y2 - y; // Reverse back\n\n if (signWidth < 0) {\n layout.x += layout.width;\n layout.width = -layout.width;\n }\n\n if (signHeight < 0) {\n layout.y += layout.height;\n layout.height = -layout.height;\n }\n\n return xClipped || yClipped;\n },\n polar: function (coordSysClipArea, layout) {\n var signR = layout.r0 <= layout.r ? 1 : -1; // Make sure r is larger than r0\n\n if (signR < 0) {\n var tmp = layout.r;\n layout.r = layout.r0;\n layout.r0 = tmp;\n }\n\n var r = mathMin(layout.r, coordSysClipArea.r);\n var r0 = mathMax(layout.r0, coordSysClipArea.r0);\n layout.r = r;\n layout.r0 = r0;\n var clipped = r - r0 < 0; // Reverse back\n\n if (signR < 0) {\n var tmp = layout.r;\n layout.r = layout.r0;\n layout.r0 = tmp;\n }\n\n return clipped;\n }\n};\nvar elementCreator = {\n cartesian2d: function (seriesModel, data, newIndex, layout, isHorizontal, animationModel, axisModel, isUpdate, roundCap) {\n var rect = new Rect({\n shape: extend({}, layout),\n z2: 1\n });\n rect.__dataIndex = newIndex;\n rect.name = 'item';\n\n if (animationModel) {\n var rectShape = rect.shape;\n var animateProperty = isHorizontal ? 'height' : 'width';\n rectShape[animateProperty] = 0;\n }\n\n return rect;\n },\n polar: function (seriesModel, data, newIndex, layout, isRadial, animationModel, axisModel, isUpdate, roundCap) {\n var ShapeClass = !isRadial && roundCap ? Sausage : Sector;\n var sector = new ShapeClass({\n shape: layout,\n z2: 1\n });\n sector.name = 'item';\n var positionMap = createPolarPositionMapping(isRadial);\n sector.calculateTextPosition = createSectorCalculateTextPosition(positionMap, {\n isRoundCap: ShapeClass === Sausage\n }); // Animation\n\n if (animationModel) {\n var sectorShape = sector.shape;\n var animateProperty = isRadial ? 'r' : 'endAngle';\n var animateTarget = {};\n sectorShape[animateProperty] = isRadial ? 0 : layout.startAngle;\n animateTarget[animateProperty] = layout[animateProperty];\n (isUpdate ? updateProps : initProps)(sector, {\n shape: animateTarget // __value: typeof dataValue === 'string' ? parseInt(dataValue, 10) : dataValue\n\n }, animationModel);\n }\n\n return sector;\n }\n};\n\nfunction shouldRealtimeSort(seriesModel, coordSys) {\n var realtimeSortOption = seriesModel.get('realtimeSort', true);\n var baseAxis = coordSys.getBaseAxis();\n\n if (process.env.NODE_ENV !== 'production') {\n if (realtimeSortOption) {\n if (baseAxis.type !== 'category') {\n warn('`realtimeSort` will not work because this bar series is not based on a category axis.');\n }\n\n if (coordSys.type !== 'cartesian2d') {\n warn('`realtimeSort` will not work because this bar series is not on cartesian2d.');\n }\n }\n }\n\n if (realtimeSortOption && baseAxis.type === 'category' && coordSys.type === 'cartesian2d') {\n return {\n baseAxis: baseAxis,\n otherAxis: coordSys.getOtherAxis(baseAxis)\n };\n }\n}\n\nfunction updateRealtimeAnimation(realtimeSortCfg, seriesAnimationModel, el, layout, newIndex, isHorizontal, isUpdate, isChangeOrder) {\n var seriesTarget;\n var axisTarget;\n\n if (isHorizontal) {\n axisTarget = {\n x: layout.x,\n width: layout.width\n };\n seriesTarget = {\n y: layout.y,\n height: layout.height\n };\n } else {\n axisTarget = {\n y: layout.y,\n height: layout.height\n };\n seriesTarget = {\n x: layout.x,\n width: layout.width\n };\n }\n\n if (!isChangeOrder) {\n // Keep the original growth animation if only axis order changed.\n // Not start a new animation.\n (isUpdate ? updateProps : initProps)(el, {\n shape: seriesTarget\n }, seriesAnimationModel, newIndex, null);\n }\n\n var axisAnimationModel = seriesAnimationModel ? realtimeSortCfg.baseAxis.model : null;\n (isUpdate ? updateProps : initProps)(el, {\n shape: axisTarget\n }, axisAnimationModel, newIndex);\n}\n\nfunction checkPropertiesNotValid(obj, props) {\n for (var i = 0; i < props.length; i++) {\n if (!isFinite(obj[props[i]])) {\n return true;\n }\n }\n\n return false;\n}\n\nvar rectPropties = ['x', 'y', 'width', 'height'];\nvar polarPropties = ['cx', 'cy', 'r', 'startAngle', 'endAngle'];\nvar isValidLayout = {\n cartesian2d: function (layout) {\n return !checkPropertiesNotValid(layout, rectPropties);\n },\n polar: function (layout) {\n return !checkPropertiesNotValid(layout, polarPropties);\n }\n};\nvar getLayout = {\n // itemModel is only used to get borderWidth, which is not needed\n // when calculating bar background layout.\n cartesian2d: function (data, dataIndex, itemModel) {\n var layout = data.getItemLayout(dataIndex);\n var fixedLineWidth = itemModel ? getLineWidth(itemModel, layout) : 0; // fix layout with lineWidth\n\n var signX = layout.width > 0 ? 1 : -1;\n var signY = layout.height > 0 ? 1 : -1;\n return {\n x: layout.x + signX * fixedLineWidth / 2,\n y: layout.y + signY * fixedLineWidth / 2,\n width: layout.width - signX * fixedLineWidth,\n height: layout.height - signY * fixedLineWidth\n };\n },\n polar: function (data, dataIndex, itemModel) {\n var layout = data.getItemLayout(dataIndex);\n return {\n cx: layout.cx,\n cy: layout.cy,\n r0: layout.r0,\n r: layout.r,\n startAngle: layout.startAngle,\n endAngle: layout.endAngle,\n clockwise: layout.clockwise\n };\n }\n};\n\nfunction isZeroOnPolar(layout) {\n return layout.startAngle != null && layout.endAngle != null && layout.startAngle === layout.endAngle;\n}\n\nfunction createPolarPositionMapping(isRadial) {\n return function (isRadial) {\n var arcOrAngle = isRadial ? 'Arc' : 'Angle';\n return function (position) {\n switch (position) {\n case 'start':\n case 'insideStart':\n case 'end':\n case 'insideEnd':\n return position + arcOrAngle;\n\n default:\n return position;\n }\n };\n }(isRadial);\n}\n\nfunction updateStyle(el, data, dataIndex, itemModel, layout, seriesModel, isHorizontalOrRadial, isPolar) {\n var style = data.getItemVisual(dataIndex, 'style');\n\n if (!isPolar) {\n el.setShape('r', itemModel.get(['itemStyle', 'borderRadius']) || 0);\n }\n\n el.useStyle(style);\n var cursorStyle = itemModel.getShallow('cursor');\n cursorStyle && el.attr('cursor', cursorStyle);\n var labelPositionOutside = isPolar ? isHorizontalOrRadial ? layout.r >= layout.r0 ? 'endArc' : 'startArc' : layout.endAngle >= layout.startAngle ? 'endAngle' : 'startAngle' : isHorizontalOrRadial ? layout.height >= 0 ? 'bottom' : 'top' : layout.width >= 0 ? 'right' : 'left';\n var labelStatesModels = getLabelStatesModels(itemModel);\n setLabelStyle(el, labelStatesModels, {\n labelFetcher: seriesModel,\n labelDataIndex: dataIndex,\n defaultText: getDefaultLabel(seriesModel.getData(), dataIndex),\n inheritColor: style.fill,\n defaultOpacity: style.opacity,\n defaultOutsidePosition: labelPositionOutside\n });\n var label = el.getTextContent();\n\n if (isPolar && label) {\n var position = itemModel.get(['label', 'position']);\n el.textConfig.inside = position === 'middle' ? true : null;\n setSectorTextRotation(el, position === 'outside' ? labelPositionOutside : position, createPolarPositionMapping(isHorizontalOrRadial), itemModel.get(['label', 'rotate']));\n }\n\n setLabelValueAnimation(label, labelStatesModels, seriesModel.getRawValue(dataIndex), function (value) {\n return getDefaultInterpolatedLabel(data, value);\n });\n var emphasisModel = itemModel.getModel(['emphasis']);\n toggleHoverEmphasis(el, emphasisModel.get('focus'), emphasisModel.get('blurScope'), emphasisModel.get('disabled'));\n setStatesStylesFromModel(el, itemModel);\n\n if (isZeroOnPolar(layout)) {\n el.style.fill = 'none';\n el.style.stroke = 'none';\n each(el.states, function (state) {\n if (state.style) {\n state.style.fill = state.style.stroke = 'none';\n }\n });\n }\n} // In case width or height are too small.\n\n\nfunction getLineWidth(itemModel, rawLayout) {\n // Has no border.\n var borderColor = itemModel.get(['itemStyle', 'borderColor']);\n\n if (!borderColor || borderColor === 'none') {\n return 0;\n }\n\n var lineWidth = itemModel.get(['itemStyle', 'borderWidth']) || 0; // width or height may be NaN for empty data\n\n var width = isNaN(rawLayout.width) ? Number.MAX_VALUE : Math.abs(rawLayout.width);\n var height = isNaN(rawLayout.height) ? Number.MAX_VALUE : Math.abs(rawLayout.height);\n return Math.min(lineWidth, width, height);\n}\n\nvar LagePathShape =\n/** @class */\nfunction () {\n function LagePathShape() {}\n\n return LagePathShape;\n}();\n\nvar LargePath =\n/** @class */\nfunction (_super) {\n __extends(LargePath, _super);\n\n function LargePath(opts) {\n var _this = _super.call(this, opts) || this;\n\n _this.type = 'largeBar';\n return _this;\n }\n\n LargePath.prototype.getDefaultShape = function () {\n return new LagePathShape();\n };\n\n LargePath.prototype.buildPath = function (ctx, shape) {\n // Drawing lines is more efficient than drawing\n // a whole line or drawing rects.\n var points = shape.points;\n var baseDimIdx = this.baseDimIdx;\n var valueDimIdx = 1 - this.baseDimIdx;\n var startPoint = [];\n var size = [];\n var barWidth = this.barWidth;\n\n for (var i = 0; i < points.length; i += 3) {\n size[baseDimIdx] = barWidth;\n size[valueDimIdx] = points[i + 2];\n startPoint[baseDimIdx] = points[i + baseDimIdx];\n startPoint[valueDimIdx] = points[i + valueDimIdx];\n ctx.rect(startPoint[0], startPoint[1], size[0], size[1]);\n }\n };\n\n return LargePath;\n}(Path);\n\nfunction createLarge(seriesModel, group, progressiveEls, incremental) {\n // TODO support polar\n var data = seriesModel.getData();\n var baseDimIdx = data.getLayout('valueAxisHorizontal') ? 1 : 0;\n var largeDataIndices = data.getLayout('largeDataIndices');\n var barWidth = data.getLayout('size');\n var backgroundModel = seriesModel.getModel('backgroundStyle');\n var bgPoints = data.getLayout('largeBackgroundPoints');\n\n if (bgPoints) {\n var bgEl = new LargePath({\n shape: {\n points: bgPoints\n },\n incremental: !!incremental,\n silent: true,\n z2: 0\n });\n bgEl.baseDimIdx = baseDimIdx;\n bgEl.largeDataIndices = largeDataIndices;\n bgEl.barWidth = barWidth;\n bgEl.useStyle(backgroundModel.getItemStyle());\n group.add(bgEl);\n progressiveEls && progressiveEls.push(bgEl);\n }\n\n var el = new LargePath({\n shape: {\n points: data.getLayout('largePoints')\n },\n incremental: !!incremental,\n z2: 1\n });\n el.baseDimIdx = baseDimIdx;\n el.largeDataIndices = largeDataIndices;\n el.barWidth = barWidth;\n group.add(el);\n el.useStyle(data.getVisual('style')); // Enable tooltip and user mouse/touch event handlers.\n\n getECData(el).seriesIndex = seriesModel.seriesIndex;\n\n if (!seriesModel.get('silent')) {\n el.on('mousedown', largePathUpdateDataIndex);\n el.on('mousemove', largePathUpdateDataIndex);\n }\n\n progressiveEls && progressiveEls.push(el);\n} // Use throttle to avoid frequently traverse to find dataIndex.\n\n\nvar largePathUpdateDataIndex = throttle(function (event) {\n var largePath = this;\n var dataIndex = largePathFindDataIndex(largePath, event.offsetX, event.offsetY);\n getECData(largePath).dataIndex = dataIndex >= 0 ? dataIndex : null;\n}, 30, false);\n\nfunction largePathFindDataIndex(largePath, x, y) {\n var baseDimIdx = largePath.baseDimIdx;\n var valueDimIdx = 1 - baseDimIdx;\n var points = largePath.shape.points;\n var largeDataIndices = largePath.largeDataIndices;\n var startPoint = [];\n var size = [];\n var barWidth = largePath.barWidth;\n\n for (var i = 0, len = points.length / 3; i < len; i++) {\n var ii = i * 3;\n size[baseDimIdx] = barWidth;\n size[valueDimIdx] = points[ii + 2];\n startPoint[baseDimIdx] = points[ii + baseDimIdx];\n startPoint[valueDimIdx] = points[ii + valueDimIdx];\n\n if (size[valueDimIdx] < 0) {\n startPoint[valueDimIdx] += size[valueDimIdx];\n size[valueDimIdx] = -size[valueDimIdx];\n }\n\n if (x >= startPoint[0] && x <= startPoint[0] + size[0] && y >= startPoint[1] && y <= startPoint[1] + size[1]) {\n return largeDataIndices[i];\n }\n }\n\n return -1;\n}\n\nfunction createBackgroundShape(isHorizontalOrRadial, layout, coord) {\n if (isCoordinateSystemType(coord, 'cartesian2d')) {\n var rectShape = layout;\n var coordLayout = coord.getArea();\n return {\n x: isHorizontalOrRadial ? rectShape.x : coordLayout.x,\n y: isHorizontalOrRadial ? coordLayout.y : rectShape.y,\n width: isHorizontalOrRadial ? rectShape.width : coordLayout.width,\n height: isHorizontalOrRadial ? coordLayout.height : rectShape.height\n };\n } else {\n var coordLayout = coord.getArea();\n var sectorShape = layout;\n return {\n cx: coordLayout.cx,\n cy: coordLayout.cy,\n r0: isHorizontalOrRadial ? coordLayout.r0 : sectorShape.r0,\n r: isHorizontalOrRadial ? coordLayout.r : sectorShape.r,\n startAngle: isHorizontalOrRadial ? sectorShape.startAngle : 0,\n endAngle: isHorizontalOrRadial ? sectorShape.endAngle : Math.PI * 2\n };\n }\n}\n\nfunction createBackgroundEl(coord, isHorizontalOrRadial, layout) {\n var ElementClz = coord.type === 'polar' ? Sector : Rect;\n return new ElementClz({\n shape: createBackgroundShape(isHorizontalOrRadial, layout, coord),\n silent: true,\n z2: 0\n });\n}\n\nexport default BarView;","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport * as zrUtil from 'zrender/lib/core/util.js';\nimport { layout, createProgressiveLayout } from '../../layout/barGrid.js';\nimport dataSample from '../../processor/dataSample.js';\nimport BarSeries from './BarSeries.js';\nimport BarView from './BarView.js';\nexport function install(registers) {\n registers.registerChartView(BarView);\n registers.registerSeriesModel(BarSeries);\n registers.registerLayout(registers.PRIORITY.VISUAL.LAYOUT, zrUtil.curry(layout, 'bar')); // Do layout after other overall layout, which can preapre some informations.\n\n registers.registerLayout(registers.PRIORITY.VISUAL.PROGRESSIVE_LAYOUT, createProgressiveLayout('bar')); // Down sample after filter\n\n registers.registerProcessor(registers.PRIORITY.PROCESSOR.STATISTIC, dataSample('bar'));\n /**\n * @payload\n * @property {string} [componentType=series]\n * @property {number} [dx]\n * @property {number} [dy]\n * @property {number} [zoom]\n * @property {number} [originX]\n * @property {number} [originY]\n */\n\n registers.registerAction({\n type: 'changeAxisOrder',\n event: 'changeAxisOrder',\n update: 'update'\n }, function (payload, ecModel) {\n var componentType = payload.componentType || 'series';\n ecModel.eachComponent({\n mainType: componentType,\n query: payload\n }, function (componentModel) {\n if (payload.sortInfo) {\n componentModel.axis.setCategorySortInfo(payload.sortInfo);\n }\n });\n });\n}","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { parsePercent, linearMap } from '../../util/number.js';\nimport * as layout from '../../util/layout.js';\nimport * as zrUtil from 'zrender/lib/core/util.js';\nvar PI2 = Math.PI * 2;\nvar RADIAN = Math.PI / 180;\n\nfunction getViewRect(seriesModel, api) {\n return layout.getLayoutRect(seriesModel.getBoxLayoutParams(), {\n width: api.getWidth(),\n height: api.getHeight()\n });\n}\n\nexport function getBasicPieLayout(seriesModel, api) {\n var viewRect = getViewRect(seriesModel, api);\n var center = seriesModel.get('center');\n var radius = seriesModel.get('radius');\n\n if (!zrUtil.isArray(radius)) {\n radius = [0, radius];\n }\n\n if (!zrUtil.isArray(center)) {\n center = [center, center];\n }\n\n var width = parsePercent(viewRect.width, api.getWidth());\n var height = parsePercent(viewRect.height, api.getHeight());\n var size = Math.min(width, height);\n var cx = parsePercent(center[0], width) + viewRect.x;\n var cy = parsePercent(center[1], height) + viewRect.y;\n var r0 = parsePercent(radius[0], size / 2);\n var r = parsePercent(radius[1], size / 2);\n return {\n cx: cx,\n cy: cy,\n r0: r0,\n r: r\n };\n}\nexport default function pieLayout(seriesType, ecModel, api) {\n ecModel.eachSeriesByType(seriesType, function (seriesModel) {\n var data = seriesModel.getData();\n var valueDim = data.mapDimension('value');\n var viewRect = getViewRect(seriesModel, api);\n\n var _a = getBasicPieLayout(seriesModel, api),\n cx = _a.cx,\n cy = _a.cy,\n r = _a.r,\n r0 = _a.r0;\n\n var startAngle = -seriesModel.get('startAngle') * RADIAN;\n var minAngle = seriesModel.get('minAngle') * RADIAN;\n var validDataCount = 0;\n data.each(valueDim, function (value) {\n !isNaN(value) && validDataCount++;\n });\n var sum = data.getSum(valueDim); // Sum may be 0\n\n var unitRadian = Math.PI / (sum || validDataCount) * 2;\n var clockwise = seriesModel.get('clockwise');\n var roseType = seriesModel.get('roseType');\n var stillShowZeroSum = seriesModel.get('stillShowZeroSum'); // [0...max]\n\n var extent = data.getDataExtent(valueDim);\n extent[0] = 0; // In the case some sector angle is smaller than minAngle\n\n var restAngle = PI2;\n var valueSumLargerThanMinAngle = 0;\n var currentAngle = startAngle;\n var dir = clockwise ? 1 : -1;\n data.setLayout({\n viewRect: viewRect,\n r: r\n });\n data.each(valueDim, function (value, idx) {\n var angle;\n\n if (isNaN(value)) {\n data.setItemLayout(idx, {\n angle: NaN,\n startAngle: NaN,\n endAngle: NaN,\n clockwise: clockwise,\n cx: cx,\n cy: cy,\n r0: r0,\n r: roseType ? NaN : r\n });\n return;\n } // FIXME 兼容 2.0 但是 roseType 是 area 的时候才是这样?\n\n\n if (roseType !== 'area') {\n angle = sum === 0 && stillShowZeroSum ? unitRadian : value * unitRadian;\n } else {\n angle = PI2 / validDataCount;\n }\n\n if (angle < minAngle) {\n angle = minAngle;\n restAngle -= minAngle;\n } else {\n valueSumLargerThanMinAngle += value;\n }\n\n var endAngle = currentAngle + dir * angle;\n data.setItemLayout(idx, {\n angle: angle,\n startAngle: currentAngle,\n endAngle: endAngle,\n clockwise: clockwise,\n cx: cx,\n cy: cy,\n r0: r0,\n r: roseType ? linearMap(value, extent, [r0, r]) : r\n });\n currentAngle = endAngle;\n }); // Some sector is constrained by minAngle\n // Rest sectors needs recalculate angle\n\n if (restAngle < PI2 && validDataCount) {\n // Average the angle if rest angle is not enough after all angles is\n // Constrained by minAngle\n if (restAngle <= 1e-3) {\n var angle_1 = PI2 / validDataCount;\n data.each(valueDim, function (value, idx) {\n if (!isNaN(value)) {\n var layout_1 = data.getItemLayout(idx);\n layout_1.angle = angle_1;\n layout_1.startAngle = startAngle + dir * idx * angle_1;\n layout_1.endAngle = startAngle + dir * (idx + 1) * angle_1;\n }\n });\n } else {\n unitRadian = restAngle / valueSumLargerThanMinAngle;\n currentAngle = startAngle;\n data.each(valueDim, function (value, idx) {\n if (!isNaN(value)) {\n var layout_2 = data.getItemLayout(idx);\n var angle = layout_2.angle === minAngle ? minAngle : value * unitRadian;\n layout_2.startAngle = currentAngle;\n layout_2.endAngle = currentAngle + dir * angle;\n currentAngle += dir * angle;\n }\n });\n }\n }\n });\n}","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nexport default function dataFilter(seriesType) {\n return {\n seriesType: seriesType,\n reset: function (seriesModel, ecModel) {\n var legendModels = ecModel.findComponents({\n mainType: 'legend'\n });\n\n if (!legendModels || !legendModels.length) {\n return;\n }\n\n var data = seriesModel.getData();\n data.filterSelf(function (idx) {\n var name = data.getName(idx); // If in any legend component the status is not selected.\n\n for (var i = 0; i < legendModels.length; i++) {\n // @ts-ignore FIXME: LegendModel\n if (!legendModels[i].isSelected(name)) {\n return false;\n }\n }\n\n return true;\n });\n }\n };\n}","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n// FIXME emphasis label position is not same with normal label position\nimport { parsePercent } from '../../util/number.js';\nimport { Point } from '../../util/graphic.js';\nimport { each, isNumber } from 'zrender/lib/core/util.js';\nimport { limitTurnAngle, limitSurfaceAngle } from '../../label/labelGuideHelper.js';\nimport { shiftLayoutOnY } from '../../label/labelLayoutHelper.js';\nvar RADIAN = Math.PI / 180;\n\nfunction adjustSingleSide(list, cx, cy, r, dir, viewWidth, viewHeight, viewLeft, viewTop, farthestX) {\n if (list.length < 2) {\n return;\n }\n\n ;\n\n function recalculateXOnSemiToAlignOnEllipseCurve(semi) {\n var rB = semi.rB;\n var rB2 = rB * rB;\n\n for (var i = 0; i < semi.list.length; i++) {\n var item = semi.list[i];\n var dy = Math.abs(item.label.y - cy); // horizontal r is always same with original r because x is not changed.\n\n var rA = r + item.len;\n var rA2 = rA * rA; // Use ellipse implicit function to calculate x\n\n var dx = Math.sqrt((1 - Math.abs(dy * dy / rB2)) * rA2);\n var newX = cx + (dx + item.len2) * dir;\n var deltaX = newX - item.label.x;\n var newTargetWidth = item.targetTextWidth - deltaX * dir; // text x is changed, so need to recalculate width.\n\n constrainTextWidth(item, newTargetWidth, true);\n item.label.x = newX;\n }\n } // Adjust X based on the shifted y. Make tight labels aligned on an ellipse curve.\n\n\n function recalculateX(items) {\n // Extremes of\n var topSemi = {\n list: [],\n maxY: 0\n };\n var bottomSemi = {\n list: [],\n maxY: 0\n };\n\n for (var i = 0; i < items.length; i++) {\n if (items[i].labelAlignTo !== 'none') {\n continue;\n }\n\n var item = items[i];\n var semi = item.label.y > cy ? bottomSemi : topSemi;\n var dy = Math.abs(item.label.y - cy);\n\n if (dy >= semi.maxY) {\n var dx = item.label.x - cx - item.len2 * dir; // horizontal r is always same with original r because x is not changed.\n\n var rA = r + item.len; // Canculate rB based on the topest / bottemest label.\n\n var rB = Math.abs(dx) < rA ? Math.sqrt(dy * dy / (1 - dx * dx / rA / rA)) : rA;\n semi.rB = rB;\n semi.maxY = dy;\n }\n\n semi.list.push(item);\n }\n\n recalculateXOnSemiToAlignOnEllipseCurve(topSemi);\n recalculateXOnSemiToAlignOnEllipseCurve(bottomSemi);\n }\n\n var len = list.length;\n\n for (var i = 0; i < len; i++) {\n if (list[i].position === 'outer' && list[i].labelAlignTo === 'labelLine') {\n var dx = list[i].label.x - farthestX;\n list[i].linePoints[1][0] += dx;\n list[i].label.x = farthestX;\n }\n }\n\n if (shiftLayoutOnY(list, viewTop, viewTop + viewHeight)) {\n recalculateX(list);\n }\n}\n\nfunction avoidOverlap(labelLayoutList, cx, cy, r, viewWidth, viewHeight, viewLeft, viewTop) {\n var leftList = [];\n var rightList = [];\n var leftmostX = Number.MAX_VALUE;\n var rightmostX = -Number.MAX_VALUE;\n\n for (var i = 0; i < labelLayoutList.length; i++) {\n var label = labelLayoutList[i].label;\n\n if (isPositionCenter(labelLayoutList[i])) {\n continue;\n }\n\n if (label.x < cx) {\n leftmostX = Math.min(leftmostX, label.x);\n leftList.push(labelLayoutList[i]);\n } else {\n rightmostX = Math.max(rightmostX, label.x);\n rightList.push(labelLayoutList[i]);\n }\n }\n\n for (var i = 0; i < labelLayoutList.length; i++) {\n var layout = labelLayoutList[i];\n\n if (!isPositionCenter(layout) && layout.linePoints) {\n if (layout.labelStyleWidth != null) {\n continue;\n }\n\n var label = layout.label;\n var linePoints = layout.linePoints;\n var targetTextWidth = void 0;\n\n if (layout.labelAlignTo === 'edge') {\n if (label.x < cx) {\n targetTextWidth = linePoints[2][0] - layout.labelDistance - viewLeft - layout.edgeDistance;\n } else {\n targetTextWidth = viewLeft + viewWidth - layout.edgeDistance - linePoints[2][0] - layout.labelDistance;\n }\n } else if (layout.labelAlignTo === 'labelLine') {\n if (label.x < cx) {\n targetTextWidth = leftmostX - viewLeft - layout.bleedMargin;\n } else {\n targetTextWidth = viewLeft + viewWidth - rightmostX - layout.bleedMargin;\n }\n } else {\n if (label.x < cx) {\n targetTextWidth = label.x - viewLeft - layout.bleedMargin;\n } else {\n targetTextWidth = viewLeft + viewWidth - label.x - layout.bleedMargin;\n }\n }\n\n layout.targetTextWidth = targetTextWidth;\n constrainTextWidth(layout, targetTextWidth);\n }\n }\n\n adjustSingleSide(rightList, cx, cy, r, 1, viewWidth, viewHeight, viewLeft, viewTop, rightmostX);\n adjustSingleSide(leftList, cx, cy, r, -1, viewWidth, viewHeight, viewLeft, viewTop, leftmostX);\n\n for (var i = 0; i < labelLayoutList.length; i++) {\n var layout = labelLayoutList[i];\n\n if (!isPositionCenter(layout) && layout.linePoints) {\n var label = layout.label;\n var linePoints = layout.linePoints;\n var isAlignToEdge = layout.labelAlignTo === 'edge';\n var padding = label.style.padding;\n var paddingH = padding ? padding[1] + padding[3] : 0; // textRect.width already contains paddingH if bgColor is set\n\n var extraPaddingH = label.style.backgroundColor ? 0 : paddingH;\n var realTextWidth = layout.rect.width + extraPaddingH;\n var dist = linePoints[1][0] - linePoints[2][0];\n\n if (isAlignToEdge) {\n if (label.x < cx) {\n linePoints[2][0] = viewLeft + layout.edgeDistance + realTextWidth + layout.labelDistance;\n } else {\n linePoints[2][0] = viewLeft + viewWidth - layout.edgeDistance - realTextWidth - layout.labelDistance;\n }\n } else {\n if (label.x < cx) {\n linePoints[2][0] = label.x + layout.labelDistance;\n } else {\n linePoints[2][0] = label.x - layout.labelDistance;\n }\n\n linePoints[1][0] = linePoints[2][0] + dist;\n }\n\n linePoints[1][1] = linePoints[2][1] = label.y;\n }\n }\n}\n/**\n * Set max width of each label, and then wrap each label to the max width.\n *\n * @param layout label layout\n * @param availableWidth max width for the label to display\n * @param forceRecalculate recaculate the text layout even if the current width\n * is smaller than `availableWidth`. This is useful when the text was previously\n * wrapped by calling `constrainTextWidth` but now `availableWidth` changed, in\n * which case, previous wrapping should be redo.\n */\n\n\nfunction constrainTextWidth(layout, availableWidth, forceRecalculate) {\n if (forceRecalculate === void 0) {\n forceRecalculate = false;\n }\n\n if (layout.labelStyleWidth != null) {\n // User-defined style.width has the highest priority.\n return;\n }\n\n var label = layout.label;\n var style = label.style;\n var textRect = layout.rect;\n var bgColor = style.backgroundColor;\n var padding = style.padding;\n var paddingH = padding ? padding[1] + padding[3] : 0;\n var overflow = style.overflow; // textRect.width already contains paddingH if bgColor is set\n\n var oldOuterWidth = textRect.width + (bgColor ? 0 : paddingH);\n\n if (availableWidth < oldOuterWidth || forceRecalculate) {\n var oldHeight = textRect.height;\n\n if (overflow && overflow.match('break')) {\n // Temporarily set background to be null to calculate\n // the bounding box without backgroud.\n label.setStyle('backgroundColor', null); // Set constraining width\n\n label.setStyle('width', availableWidth - paddingH); // This is the real bounding box of the text without padding\n\n var innerRect = label.getBoundingRect();\n label.setStyle('width', Math.ceil(innerRect.width));\n label.setStyle('backgroundColor', bgColor);\n } else {\n var availableInnerWidth = availableWidth - paddingH;\n var newWidth = availableWidth < oldOuterWidth // Current text is too wide, use `availableWidth` as max width.\n ? availableInnerWidth : // Current available width is enough, but the text may have\n // already been wrapped with a smaller available width.\n forceRecalculate ? availableInnerWidth > layout.unconstrainedWidth // Current available is larger than text width,\n // so don't constrain width (otherwise it may have\n // empty space in the background).\n ? null // Current available is smaller than text width, so\n // use the current available width as constraining\n // width.\n : availableInnerWidth : // Current available width is enough, so no need to\n // constrain.\n null;\n label.setStyle('width', newWidth);\n }\n\n var newRect = label.getBoundingRect();\n textRect.width = newRect.width;\n var margin = (label.style.margin || 0) + 2.1;\n textRect.height = newRect.height + margin;\n textRect.y -= (textRect.height - oldHeight) / 2;\n }\n}\n\nfunction isPositionCenter(sectorShape) {\n // Not change x for center label\n return sectorShape.position === 'center';\n}\n\nexport default function pieLabelLayout(seriesModel) {\n var data = seriesModel.getData();\n var labelLayoutList = [];\n var cx;\n var cy;\n var hasLabelRotate = false;\n var minShowLabelRadian = (seriesModel.get('minShowLabelAngle') || 0) * RADIAN;\n var viewRect = data.getLayout('viewRect');\n var r = data.getLayout('r');\n var viewWidth = viewRect.width;\n var viewLeft = viewRect.x;\n var viewTop = viewRect.y;\n var viewHeight = viewRect.height;\n\n function setNotShow(el) {\n el.ignore = true;\n }\n\n function isLabelShown(label) {\n if (!label.ignore) {\n return true;\n }\n\n for (var key in label.states) {\n if (label.states[key].ignore === false) {\n return true;\n }\n }\n\n return false;\n }\n\n data.each(function (idx) {\n var sector = data.getItemGraphicEl(idx);\n var sectorShape = sector.shape;\n var label = sector.getTextContent();\n var labelLine = sector.getTextGuideLine();\n var itemModel = data.getItemModel(idx);\n var labelModel = itemModel.getModel('label'); // Use position in normal or emphasis\n\n var labelPosition = labelModel.get('position') || itemModel.get(['emphasis', 'label', 'position']);\n var labelDistance = labelModel.get('distanceToLabelLine');\n var labelAlignTo = labelModel.get('alignTo');\n var edgeDistance = parsePercent(labelModel.get('edgeDistance'), viewWidth);\n var bleedMargin = labelModel.get('bleedMargin');\n var labelLineModel = itemModel.getModel('labelLine');\n var labelLineLen = labelLineModel.get('length');\n labelLineLen = parsePercent(labelLineLen, viewWidth);\n var labelLineLen2 = labelLineModel.get('length2');\n labelLineLen2 = parsePercent(labelLineLen2, viewWidth);\n\n if (Math.abs(sectorShape.endAngle - sectorShape.startAngle) < minShowLabelRadian) {\n each(label.states, setNotShow);\n label.ignore = true;\n return;\n }\n\n if (!isLabelShown(label)) {\n return;\n }\n\n var midAngle = (sectorShape.startAngle + sectorShape.endAngle) / 2;\n var nx = Math.cos(midAngle);\n var ny = Math.sin(midAngle);\n var textX;\n var textY;\n var linePoints;\n var textAlign;\n cx = sectorShape.cx;\n cy = sectorShape.cy;\n var isLabelInside = labelPosition === 'inside' || labelPosition === 'inner';\n\n if (labelPosition === 'center') {\n textX = sectorShape.cx;\n textY = sectorShape.cy;\n textAlign = 'center';\n } else {\n var x1 = (isLabelInside ? (sectorShape.r + sectorShape.r0) / 2 * nx : sectorShape.r * nx) + cx;\n var y1 = (isLabelInside ? (sectorShape.r + sectorShape.r0) / 2 * ny : sectorShape.r * ny) + cy;\n textX = x1 + nx * 3;\n textY = y1 + ny * 3;\n\n if (!isLabelInside) {\n // For roseType\n var x2 = x1 + nx * (labelLineLen + r - sectorShape.r);\n var y2 = y1 + ny * (labelLineLen + r - sectorShape.r);\n var x3 = x2 + (nx < 0 ? -1 : 1) * labelLineLen2;\n var y3 = y2;\n\n if (labelAlignTo === 'edge') {\n // Adjust textX because text align of edge is opposite\n textX = nx < 0 ? viewLeft + edgeDistance : viewLeft + viewWidth - edgeDistance;\n } else {\n textX = x3 + (nx < 0 ? -labelDistance : labelDistance);\n }\n\n textY = y3;\n linePoints = [[x1, y1], [x2, y2], [x3, y3]];\n }\n\n textAlign = isLabelInside ? 'center' : labelAlignTo === 'edge' ? nx > 0 ? 'right' : 'left' : nx > 0 ? 'left' : 'right';\n }\n\n var PI = Math.PI;\n var labelRotate = 0;\n var rotate = labelModel.get('rotate');\n\n if (isNumber(rotate)) {\n labelRotate = rotate * (PI / 180);\n } else if (labelPosition === 'center') {\n labelRotate = 0;\n } else if (rotate === 'radial' || rotate === true) {\n var radialAngle = nx < 0 ? -midAngle + PI : -midAngle;\n labelRotate = radialAngle;\n } else if (rotate === 'tangential' && labelPosition !== 'outside' && labelPosition !== 'outer') {\n var rad = Math.atan2(nx, ny);\n\n if (rad < 0) {\n rad = PI * 2 + rad;\n }\n\n var isDown = ny > 0;\n\n if (isDown) {\n rad = PI + rad;\n }\n\n labelRotate = rad - PI;\n }\n\n hasLabelRotate = !!labelRotate;\n label.x = textX;\n label.y = textY;\n label.rotation = labelRotate;\n label.setStyle({\n verticalAlign: 'middle'\n }); // Not sectorShape the inside label\n\n if (!isLabelInside) {\n var textRect = label.getBoundingRect().clone();\n textRect.applyTransform(label.getComputedTransform()); // Text has a default 1px stroke. Exclude this.\n\n var margin = (label.style.margin || 0) + 2.1;\n textRect.y -= margin / 2;\n textRect.height += margin;\n labelLayoutList.push({\n label: label,\n labelLine: labelLine,\n position: labelPosition,\n len: labelLineLen,\n len2: labelLineLen2,\n minTurnAngle: labelLineModel.get('minTurnAngle'),\n maxSurfaceAngle: labelLineModel.get('maxSurfaceAngle'),\n surfaceNormal: new Point(nx, ny),\n linePoints: linePoints,\n textAlign: textAlign,\n labelDistance: labelDistance,\n labelAlignTo: labelAlignTo,\n edgeDistance: edgeDistance,\n bleedMargin: bleedMargin,\n rect: textRect,\n unconstrainedWidth: textRect.width,\n labelStyleWidth: label.style.width\n });\n } else {\n label.setStyle({\n align: textAlign\n });\n var selectState = label.states.select;\n\n if (selectState) {\n selectState.x += label.x;\n selectState.y += label.y;\n }\n }\n\n sector.setTextConfig({\n inside: isLabelInside\n });\n });\n\n if (!hasLabelRotate && seriesModel.get('avoidLabelOverlap')) {\n avoidOverlap(labelLayoutList, cx, cy, r, viewWidth, viewHeight, viewLeft, viewTop);\n }\n\n for (var i = 0; i < labelLayoutList.length; i++) {\n var layout = labelLayoutList[i];\n var label = layout.label;\n var labelLine = layout.labelLine;\n var notShowLabel = isNaN(label.x) || isNaN(label.y);\n\n if (label) {\n label.setStyle({\n align: layout.textAlign\n });\n\n if (notShowLabel) {\n each(label.states, setNotShow);\n label.ignore = true;\n }\n\n var selectState = label.states.select;\n\n if (selectState) {\n selectState.x += label.x;\n selectState.y += label.y;\n }\n }\n\n if (labelLine) {\n var linePoints = layout.linePoints;\n\n if (notShowLabel || !linePoints) {\n each(labelLine.states, setNotShow);\n labelLine.ignore = true;\n } else {\n limitTurnAngle(linePoints, layout.minTurnAngle);\n limitSurfaceAngle(linePoints, layout.surfaceNormal, layout.maxSurfaceAngle);\n labelLine.setShape({\n points: linePoints\n }); // Set the anchor to the midpoint of sector\n\n label.__hostTarget.textGuideLineConfig = {\n anchor: new Point(linePoints[0][0], linePoints[0][1])\n };\n }\n }\n }\n}","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { isArray, map } from 'zrender/lib/core/util.js';\nimport { parsePercent } from 'zrender/lib/contain/text.js';\nexport function getSectorCornerRadius(model, shape, zeroIfNull) {\n var cornerRadius = model.get('borderRadius');\n\n if (cornerRadius == null) {\n return zeroIfNull ? {\n cornerRadius: 0\n } : null;\n }\n\n if (!isArray(cornerRadius)) {\n cornerRadius = [cornerRadius, cornerRadius, cornerRadius, cornerRadius];\n }\n\n var dr = Math.abs(shape.r || 0 - shape.r0 || 0);\n return {\n cornerRadius: map(cornerRadius, function (cr) {\n return parsePercent(cr, dr);\n })\n };\n}","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { __extends } from \"tslib\";\nimport { extend, retrieve3 } from 'zrender/lib/core/util.js';\nimport * as graphic from '../../util/graphic.js';\nimport { setStatesStylesFromModel, toggleHoverEmphasis } from '../../util/states.js';\nimport ChartView from '../../view/Chart.js';\nimport labelLayout from './labelLayout.js';\nimport { setLabelLineStyle, getLabelLineStatesModels } from '../../label/labelGuideHelper.js';\nimport { setLabelStyle, getLabelStatesModels } from '../../label/labelStyle.js';\nimport { getSectorCornerRadius } from '../helper/pieHelper.js';\nimport { saveOldStyle } from '../../animation/basicTrasition.js';\nimport { getBasicPieLayout } from './pieLayout.js';\n/**\n * Piece of pie including Sector, Label, LabelLine\n */\n\nvar PiePiece =\n/** @class */\nfunction (_super) {\n __extends(PiePiece, _super);\n\n function PiePiece(data, idx, startAngle) {\n var _this = _super.call(this) || this;\n\n _this.z2 = 2;\n var text = new graphic.Text();\n\n _this.setTextContent(text);\n\n _this.updateData(data, idx, startAngle, true);\n\n return _this;\n }\n\n PiePiece.prototype.updateData = function (data, idx, startAngle, firstCreate) {\n var sector = this;\n var seriesModel = data.hostModel;\n var itemModel = data.getItemModel(idx);\n var emphasisModel = itemModel.getModel('emphasis');\n var layout = data.getItemLayout(idx); // cornerRadius & innerCornerRadius doesn't exist in the item layout. Use `0` if null value is specified.\n // see `setItemLayout` in `pieLayout.ts`.\n\n var sectorShape = extend(getSectorCornerRadius(itemModel.getModel('itemStyle'), layout, true), layout); // Ignore NaN data.\n\n if (isNaN(sectorShape.startAngle)) {\n // Use NaN shape to avoid drawing shape.\n sector.setShape(sectorShape);\n return;\n }\n\n if (firstCreate) {\n sector.setShape(sectorShape);\n var animationType = seriesModel.getShallow('animationType');\n\n if (seriesModel.ecModel.ssr) {\n // Use scale animation in SSR mode(opacity?)\n // Because CSS SVG animation doesn't support very customized shape animation.\n graphic.initProps(sector, {\n scaleX: 0,\n scaleY: 0\n }, seriesModel, {\n dataIndex: idx,\n isFrom: true\n });\n sector.originX = sectorShape.cx;\n sector.originY = sectorShape.cy;\n } else if (animationType === 'scale') {\n sector.shape.r = layout.r0;\n graphic.initProps(sector, {\n shape: {\n r: layout.r\n }\n }, seriesModel, idx);\n } // Expansion\n else {\n if (startAngle != null) {\n sector.setShape({\n startAngle: startAngle,\n endAngle: startAngle\n });\n graphic.initProps(sector, {\n shape: {\n startAngle: layout.startAngle,\n endAngle: layout.endAngle\n }\n }, seriesModel, idx);\n } else {\n sector.shape.endAngle = layout.startAngle;\n graphic.updateProps(sector, {\n shape: {\n endAngle: layout.endAngle\n }\n }, seriesModel, idx);\n }\n }\n } else {\n saveOldStyle(sector); // Transition animation from the old shape\n\n graphic.updateProps(sector, {\n shape: sectorShape\n }, seriesModel, idx);\n }\n\n sector.useStyle(data.getItemVisual(idx, 'style'));\n setStatesStylesFromModel(sector, itemModel);\n var midAngle = (layout.startAngle + layout.endAngle) / 2;\n var offset = seriesModel.get('selectedOffset');\n var dx = Math.cos(midAngle) * offset;\n var dy = Math.sin(midAngle) * offset;\n var cursorStyle = itemModel.getShallow('cursor');\n cursorStyle && sector.attr('cursor', cursorStyle);\n\n this._updateLabel(seriesModel, data, idx);\n\n sector.ensureState('emphasis').shape = extend({\n r: layout.r + (emphasisModel.get('scale') ? emphasisModel.get('scaleSize') || 0 : 0)\n }, getSectorCornerRadius(emphasisModel.getModel('itemStyle'), layout));\n extend(sector.ensureState('select'), {\n x: dx,\n y: dy,\n shape: getSectorCornerRadius(itemModel.getModel(['select', 'itemStyle']), layout)\n });\n extend(sector.ensureState('blur'), {\n shape: getSectorCornerRadius(itemModel.getModel(['blur', 'itemStyle']), layout)\n });\n var labelLine = sector.getTextGuideLine();\n var labelText = sector.getTextContent();\n labelLine && extend(labelLine.ensureState('select'), {\n x: dx,\n y: dy\n }); // TODO: needs dx, dy in zrender?\n\n extend(labelText.ensureState('select'), {\n x: dx,\n y: dy\n });\n toggleHoverEmphasis(this, emphasisModel.get('focus'), emphasisModel.get('blurScope'), emphasisModel.get('disabled'));\n };\n\n PiePiece.prototype._updateLabel = function (seriesModel, data, idx) {\n var sector = this;\n var itemModel = data.getItemModel(idx);\n var labelLineModel = itemModel.getModel('labelLine');\n var style = data.getItemVisual(idx, 'style');\n var visualColor = style && style.fill;\n var visualOpacity = style && style.opacity;\n setLabelStyle(sector, getLabelStatesModels(itemModel), {\n labelFetcher: data.hostModel,\n labelDataIndex: idx,\n inheritColor: visualColor,\n defaultOpacity: visualOpacity,\n defaultText: seriesModel.getFormattedLabel(idx, 'normal') || data.getName(idx)\n });\n var labelText = sector.getTextContent(); // Set textConfig on sector.\n\n sector.setTextConfig({\n // reset position, rotation\n position: null,\n rotation: null\n }); // Make sure update style on labelText after setLabelStyle.\n // Because setLabelStyle will replace a new style on it.\n\n labelText.attr({\n z2: 10\n });\n var labelPosition = seriesModel.get(['label', 'position']);\n\n if (labelPosition !== 'outside' && labelPosition !== 'outer') {\n sector.removeTextGuideLine();\n } else {\n var polyline = this.getTextGuideLine();\n\n if (!polyline) {\n polyline = new graphic.Polyline();\n this.setTextGuideLine(polyline);\n } // Default use item visual color\n\n\n setLabelLineStyle(this, getLabelLineStatesModels(itemModel), {\n stroke: visualColor,\n opacity: retrieve3(labelLineModel.get(['lineStyle', 'opacity']), visualOpacity, 1)\n });\n }\n };\n\n return PiePiece;\n}(graphic.Sector); // Pie view\n\n\nvar PieView =\n/** @class */\nfunction (_super) {\n __extends(PieView, _super);\n\n function PieView() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n\n _this.ignoreLabelLineUpdate = true;\n return _this;\n }\n\n PieView.prototype.init = function () {\n var sectorGroup = new graphic.Group();\n this._sectorGroup = sectorGroup;\n };\n\n PieView.prototype.render = function (seriesModel, ecModel, api, payload) {\n var data = seriesModel.getData();\n var oldData = this._data;\n var group = this.group;\n var startAngle; // First render\n\n if (!oldData && data.count() > 0) {\n var shape = data.getItemLayout(0);\n\n for (var s = 1; isNaN(shape && shape.startAngle) && s < data.count(); ++s) {\n shape = data.getItemLayout(s);\n }\n\n if (shape) {\n startAngle = shape.startAngle;\n }\n } // remove empty-circle if it exists\n\n\n if (this._emptyCircleSector) {\n group.remove(this._emptyCircleSector);\n } // when all data are filtered, show lightgray empty circle\n\n\n if (data.count() === 0 && seriesModel.get('showEmptyCircle')) {\n var sector = new graphic.Sector({\n shape: getBasicPieLayout(seriesModel, api)\n });\n sector.useStyle(seriesModel.getModel('emptyCircleStyle').getItemStyle());\n this._emptyCircleSector = sector;\n group.add(sector);\n }\n\n data.diff(oldData).add(function (idx) {\n var piePiece = new PiePiece(data, idx, startAngle);\n data.setItemGraphicEl(idx, piePiece);\n group.add(piePiece);\n }).update(function (newIdx, oldIdx) {\n var piePiece = oldData.getItemGraphicEl(oldIdx);\n piePiece.updateData(data, newIdx, startAngle);\n piePiece.off('click');\n group.add(piePiece);\n data.setItemGraphicEl(newIdx, piePiece);\n }).remove(function (idx) {\n var piePiece = oldData.getItemGraphicEl(idx);\n graphic.removeElementWithFadeOut(piePiece, seriesModel, idx);\n }).execute();\n labelLayout(seriesModel); // Always use initial animation.\n\n if (seriesModel.get('animationTypeUpdate') !== 'expansion') {\n this._data = data;\n }\n };\n\n PieView.prototype.dispose = function () {};\n\n PieView.prototype.containPoint = function (point, seriesModel) {\n var data = seriesModel.getData();\n var itemLayout = data.getItemLayout(0);\n\n if (itemLayout) {\n var dx = point[0] - itemLayout.cx;\n var dy = point[1] - itemLayout.cy;\n var radius = Math.sqrt(dx * dx + dy * dy);\n return radius <= itemLayout.r && radius >= itemLayout.r0;\n }\n };\n\n PieView.type = 'pie';\n return PieView;\n}(ChartView);\n\nexport default PieView;","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport prepareSeriesDataSchema from '../../data/helper/createDimensions.js';\nimport SeriesData from '../../data/SeriesData.js';\nimport { extend, isArray } from 'zrender/lib/core/util.js';\n/**\n * [Usage]:\n * (1)\n * createListSimply(seriesModel, ['value']);\n * (2)\n * createListSimply(seriesModel, {\n * coordDimensions: ['value'],\n * dimensionsCount: 5\n * });\n */\n\nexport default function createSeriesDataSimply(seriesModel, opt, nameList) {\n opt = isArray(opt) && {\n coordDimensions: opt\n } || extend({\n encodeDefine: seriesModel.getEncode()\n }, opt);\n var source = seriesModel.getSource();\n var dimensions = prepareSeriesDataSchema(source, opt).dimensions;\n var list = new SeriesData(dimensions, seriesModel);\n list.initData(source, nameList);\n return list;\n}","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n/**\n * LegendVisualProvider is an bridge that pick encoded color from data and\n * provide to the legend component.\n */\nvar LegendVisualProvider =\n/** @class */\nfunction () {\n function LegendVisualProvider( // Function to get data after filtered. It stores all the encoding info\n getDataWithEncodedVisual, // Function to get raw data before filtered.\n getRawData) {\n this._getDataWithEncodedVisual = getDataWithEncodedVisual;\n this._getRawData = getRawData;\n }\n\n LegendVisualProvider.prototype.getAllNames = function () {\n var rawData = this._getRawData(); // We find the name from the raw data. In case it's filtered by the legend component.\n // Normally, the name can be found in rawData, but can't be found in filtered data will display as gray.\n\n\n return rawData.mapArray(rawData.getName);\n };\n\n LegendVisualProvider.prototype.containName = function (name) {\n var rawData = this._getRawData();\n\n return rawData.indexOfName(name) >= 0;\n };\n\n LegendVisualProvider.prototype.indexOfName = function (name) {\n // Only get data when necessary.\n // Because LegendVisualProvider constructor may be new in the stage that data is not prepared yet.\n // Invoking Series#getData immediately will throw an error.\n var dataWithEncodedVisual = this._getDataWithEncodedVisual();\n\n return dataWithEncodedVisual.indexOfName(name);\n };\n\n LegendVisualProvider.prototype.getItemVisual = function (dataIndex, key) {\n // Get encoded visual properties from final filtered data.\n var dataWithEncodedVisual = this._getDataWithEncodedVisual();\n\n return dataWithEncodedVisual.getItemVisual(dataIndex, key);\n };\n\n return LegendVisualProvider;\n}();\n\nexport default LegendVisualProvider;","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { __extends } from \"tslib\";\nimport createSeriesDataSimply from '../helper/createSeriesDataSimply.js';\nimport * as zrUtil from 'zrender/lib/core/util.js';\nimport * as modelUtil from '../../util/model.js';\nimport { getPercentWithPrecision } from '../../util/number.js';\nimport { makeSeriesEncodeForNameBased } from '../../data/helper/sourceHelper.js';\nimport LegendVisualProvider from '../../visual/LegendVisualProvider.js';\nimport SeriesModel from '../../model/Series.js';\n\nvar PieSeriesModel =\n/** @class */\nfunction (_super) {\n __extends(PieSeriesModel, _super);\n\n function PieSeriesModel() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n /**\n * @overwrite\n */\n\n\n PieSeriesModel.prototype.init = function (option) {\n _super.prototype.init.apply(this, arguments); // Enable legend selection for each data item\n // Use a function instead of direct access because data reference may changed\n\n\n this.legendVisualProvider = new LegendVisualProvider(zrUtil.bind(this.getData, this), zrUtil.bind(this.getRawData, this));\n\n this._defaultLabelLine(option);\n };\n /**\n * @overwrite\n */\n\n\n PieSeriesModel.prototype.mergeOption = function () {\n _super.prototype.mergeOption.apply(this, arguments);\n };\n /**\n * @overwrite\n */\n\n\n PieSeriesModel.prototype.getInitialData = function () {\n return createSeriesDataSimply(this, {\n coordDimensions: ['value'],\n encodeDefaulter: zrUtil.curry(makeSeriesEncodeForNameBased, this)\n });\n };\n /**\n * @overwrite\n */\n\n\n PieSeriesModel.prototype.getDataParams = function (dataIndex) {\n var data = this.getData();\n\n var params = _super.prototype.getDataParams.call(this, dataIndex); // FIXME toFixed?\n\n\n var valueList = [];\n data.each(data.mapDimension('value'), function (value) {\n valueList.push(value);\n });\n params.percent = getPercentWithPrecision(valueList, dataIndex, data.hostModel.get('percentPrecision'));\n params.$vars.push('percent');\n return params;\n };\n\n PieSeriesModel.prototype._defaultLabelLine = function (option) {\n // Extend labelLine emphasis\n modelUtil.defaultEmphasis(option, 'labelLine', ['show']);\n var labelLineNormalOpt = option.labelLine;\n var labelLineEmphasisOpt = option.emphasis.labelLine; // Not show label line if `label.normal.show = false`\n\n labelLineNormalOpt.show = labelLineNormalOpt.show && option.label.show;\n labelLineEmphasisOpt.show = labelLineEmphasisOpt.show && option.emphasis.label.show;\n };\n\n PieSeriesModel.type = 'series.pie';\n PieSeriesModel.defaultOption = {\n // zlevel: 0,\n z: 2,\n legendHoverLink: true,\n colorBy: 'data',\n // 默认全局居中\n center: ['50%', '50%'],\n radius: [0, '75%'],\n // 默认顺时针\n clockwise: true,\n startAngle: 90,\n // 最小角度改为0\n minAngle: 0,\n // If the angle of a sector less than `minShowLabelAngle`,\n // the label will not be displayed.\n minShowLabelAngle: 0,\n // 选中时扇区偏移量\n selectedOffset: 10,\n // 选择模式,默认关闭,可选single,multiple\n // selectedMode: false,\n // 南丁格尔玫瑰图模式,'radius'(半径) | 'area'(面积)\n // roseType: null,\n percentPrecision: 2,\n // If still show when all data zero.\n stillShowZeroSum: true,\n // cursor: null,\n left: 0,\n top: 0,\n right: 0,\n bottom: 0,\n width: null,\n height: null,\n label: {\n // color: 'inherit',\n // If rotate around circle\n rotate: 0,\n show: true,\n overflow: 'truncate',\n // 'outer', 'inside', 'center'\n position: 'outer',\n // 'none', 'labelLine', 'edge'. Works only when position is 'outer'\n alignTo: 'none',\n // Closest distance between label and chart edge.\n // Works only position is 'outer' and alignTo is 'edge'.\n edgeDistance: '25%',\n // Works only position is 'outer' and alignTo is not 'edge'.\n bleedMargin: 10,\n // Distance between text and label line.\n distanceToLabelLine: 5 // formatter: 标签文本格式器,同Tooltip.formatter,不支持异步回调\n // 默认使用全局文本样式,详见TEXTSTYLE\n // distance: 当position为inner时有效,为label位置到圆心的距离与圆半径(环状图为内外半径和)的比例系数\n\n },\n // Enabled when label.normal.position is 'outer'\n labelLine: {\n show: true,\n // 引导线两段中的第一段长度\n length: 15,\n // 引导线两段中的第二段长度\n length2: 15,\n smooth: false,\n minTurnAngle: 90,\n maxSurfaceAngle: 90,\n lineStyle: {\n // color: 各异,\n width: 1,\n type: 'solid'\n }\n },\n itemStyle: {\n borderWidth: 1,\n borderJoin: 'round'\n },\n showEmptyCircle: true,\n emptyCircleStyle: {\n color: 'lightgray',\n opacity: 1\n },\n labelLayout: {\n // Hide the overlapped label.\n hideOverlap: true\n },\n emphasis: {\n scale: true,\n scaleSize: 5\n },\n // If use strategy to avoid label overlapping\n avoidLabelOverlap: true,\n // Animation type. Valid values: expansion, scale\n animationType: 'expansion',\n animationDuration: 1000,\n // Animation type when update. Valid values: transition, expansion\n animationTypeUpdate: 'transition',\n animationEasingUpdate: 'cubicInOut',\n animationDurationUpdate: 500,\n animationEasing: 'cubicInOut'\n };\n return PieSeriesModel;\n}(SeriesModel);\n\nexport default PieSeriesModel;","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { isNumber } from 'zrender/lib/core/util.js';\nexport default function negativeDataFilter(seriesType) {\n return {\n seriesType: seriesType,\n reset: function (seriesModel, ecModel) {\n var data = seriesModel.getData();\n data.filterSelf(function (idx) {\n // handle negative value condition\n var valueDim = data.mapDimension('value');\n var curValue = data.get(valueDim, idx);\n\n if (isNumber(curValue) && !isNaN(curValue) && curValue < 0) {\n return false;\n }\n\n return true;\n });\n }\n };\n}","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { createLegacyDataSelectAction } from '../../legacy/dataSelectAction.js';\nimport pieLayout from '../pie/pieLayout.js';\nimport dataFilter from '../../processor/dataFilter.js';\nimport { curry } from 'zrender/lib/core/util.js';\nimport PieView from './PieView.js';\nimport PieSeriesModel from './PieSeries.js';\nimport negativeDataFilter from '../../processor/negativeDataFilter.js';\nexport function install(registers) {\n registers.registerChartView(PieView);\n registers.registerSeriesModel(PieSeriesModel);\n createLegacyDataSelectAction('pie', registers.registerAction);\n registers.registerLayout(curry(pieLayout, 'pie'));\n registers.registerProcessor(dataFilter('pie'));\n registers.registerProcessor(negativeDataFilter('pie'));\n}","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { __extends } from \"tslib\";\nimport createSeriesData from '../helper/createSeriesData.js';\nimport SeriesModel from '../../model/Series.js';\n\nvar ScatterSeriesModel =\n/** @class */\nfunction (_super) {\n __extends(ScatterSeriesModel, _super);\n\n function ScatterSeriesModel() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n\n _this.type = ScatterSeriesModel.type;\n _this.hasSymbolVisual = true;\n return _this;\n }\n\n ScatterSeriesModel.prototype.getInitialData = function (option, ecModel) {\n return createSeriesData(null, this, {\n useEncodeDefaulter: true\n });\n };\n\n ScatterSeriesModel.prototype.getProgressive = function () {\n var progressive = this.option.progressive;\n\n if (progressive == null) {\n // PENDING\n return this.option.large ? 5e3 : this.get('progressive');\n }\n\n return progressive;\n };\n\n ScatterSeriesModel.prototype.getProgressiveThreshold = function () {\n var progressiveThreshold = this.option.progressiveThreshold;\n\n if (progressiveThreshold == null) {\n // PENDING\n return this.option.large ? 1e4 : this.get('progressiveThreshold');\n }\n\n return progressiveThreshold;\n };\n\n ScatterSeriesModel.prototype.brushSelector = function (dataIndex, data, selectors) {\n return selectors.point(data.getItemLayout(dataIndex));\n };\n\n ScatterSeriesModel.prototype.getZLevelKey = function () {\n // Each progressive series has individual key.\n return this.getData().count() > this.getProgressiveThreshold() ? this.id : '';\n };\n\n ScatterSeriesModel.type = 'series.scatter';\n ScatterSeriesModel.dependencies = ['grid', 'polar', 'geo', 'singleAxis', 'calendar'];\n ScatterSeriesModel.defaultOption = {\n coordinateSystem: 'cartesian2d',\n // zlevel: 0,\n z: 2,\n legendHoverLink: true,\n symbolSize: 10,\n // symbolRotate: null, // 图形旋转控制\n large: false,\n // Available when large is true\n largeThreshold: 2000,\n // cursor: null,\n itemStyle: {\n opacity: 0.8 // color: 各异\n\n },\n emphasis: {\n scale: true\n },\n // If clip the overflow graphics\n // Works on cartesian / polar series\n clip: true,\n select: {\n itemStyle: {\n borderColor: '#212121'\n }\n },\n universalTransition: {\n divideShape: 'clone'\n } // progressive: null\n\n };\n return ScatterSeriesModel;\n}(SeriesModel);\n\nexport default ScatterSeriesModel;","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { __extends } from \"tslib\";\n/* global Float32Array */\n// TODO Batch by color\n\nimport * as graphic from '../../util/graphic.js';\nimport { createSymbol } from '../../util/symbol.js';\nimport { getECData } from '../../util/innerStore.js';\nvar BOOST_SIZE_THRESHOLD = 4;\n\nvar LargeSymbolPathShape =\n/** @class */\nfunction () {\n function LargeSymbolPathShape() {}\n\n return LargeSymbolPathShape;\n}();\n\nvar LargeSymbolPath =\n/** @class */\nfunction (_super) {\n __extends(LargeSymbolPath, _super);\n\n function LargeSymbolPath(opts) {\n var _this = _super.call(this, opts) || this;\n\n _this._off = 0;\n _this.hoverDataIdx = -1;\n return _this;\n }\n\n LargeSymbolPath.prototype.getDefaultShape = function () {\n return new LargeSymbolPathShape();\n };\n\n LargeSymbolPath.prototype.reset = function () {\n this.notClear = false;\n this._off = 0;\n };\n\n LargeSymbolPath.prototype.buildPath = function (path, shape) {\n var points = shape.points;\n var size = shape.size;\n var symbolProxy = this.symbolProxy;\n var symbolProxyShape = symbolProxy.shape;\n var ctx = path.getContext ? path.getContext() : path;\n var canBoost = ctx && size[0] < BOOST_SIZE_THRESHOLD;\n var softClipShape = this.softClipShape;\n var i; // Do draw in afterBrush.\n\n if (canBoost) {\n this._ctx = ctx;\n return;\n }\n\n this._ctx = null;\n\n for (i = this._off; i < points.length;) {\n var x = points[i++];\n var y = points[i++];\n\n if (isNaN(x) || isNaN(y)) {\n continue;\n }\n\n if (softClipShape && !softClipShape.contain(x, y)) {\n continue;\n }\n\n symbolProxyShape.x = x - size[0] / 2;\n symbolProxyShape.y = y - size[1] / 2;\n symbolProxyShape.width = size[0];\n symbolProxyShape.height = size[1];\n symbolProxy.buildPath(path, symbolProxyShape, true);\n }\n\n if (this.incremental) {\n this._off = i;\n this.notClear = true;\n }\n };\n\n LargeSymbolPath.prototype.afterBrush = function () {\n var shape = this.shape;\n var points = shape.points;\n var size = shape.size;\n var ctx = this._ctx;\n var softClipShape = this.softClipShape;\n var i;\n\n if (!ctx) {\n return;\n } // PENDING If style or other canvas status changed?\n\n\n for (i = this._off; i < points.length;) {\n var x = points[i++];\n var y = points[i++];\n\n if (isNaN(x) || isNaN(y)) {\n continue;\n }\n\n if (softClipShape && !softClipShape.contain(x, y)) {\n continue;\n } // fillRect is faster than building a rect path and draw.\n // And it support light globalCompositeOperation.\n\n\n ctx.fillRect(x - size[0] / 2, y - size[1] / 2, size[0], size[1]);\n }\n\n if (this.incremental) {\n this._off = i;\n this.notClear = true;\n }\n };\n\n LargeSymbolPath.prototype.findDataIndex = function (x, y) {\n // TODO ???\n // Consider transform\n var shape = this.shape;\n var points = shape.points;\n var size = shape.size;\n var w = Math.max(size[0], 4);\n var h = Math.max(size[1], 4); // Not consider transform\n // Treat each element as a rect\n // top down traverse\n\n for (var idx = points.length / 2 - 1; idx >= 0; idx--) {\n var i = idx * 2;\n var x0 = points[i] - w / 2;\n var y0 = points[i + 1] - h / 2;\n\n if (x >= x0 && y >= y0 && x <= x0 + w && y <= y0 + h) {\n return idx;\n }\n }\n\n return -1;\n };\n\n LargeSymbolPath.prototype.contain = function (x, y) {\n var localPos = this.transformCoordToLocal(x, y);\n var rect = this.getBoundingRect();\n x = localPos[0];\n y = localPos[1];\n\n if (rect.contain(x, y)) {\n // Cache found data index.\n var dataIdx = this.hoverDataIdx = this.findDataIndex(x, y);\n return dataIdx >= 0;\n }\n\n this.hoverDataIdx = -1;\n return false;\n };\n\n LargeSymbolPath.prototype.getBoundingRect = function () {\n // Ignore stroke for large symbol draw.\n var rect = this._rect;\n\n if (!rect) {\n var shape = this.shape;\n var points = shape.points;\n var size = shape.size;\n var w = size[0];\n var h = size[1];\n var minX = Infinity;\n var minY = Infinity;\n var maxX = -Infinity;\n var maxY = -Infinity;\n\n for (var i = 0; i < points.length;) {\n var x = points[i++];\n var y = points[i++];\n minX = Math.min(x, minX);\n maxX = Math.max(x, maxX);\n minY = Math.min(y, minY);\n maxY = Math.max(y, maxY);\n }\n\n rect = this._rect = new graphic.BoundingRect(minX - w / 2, minY - h / 2, maxX - minX + w, maxY - minY + h);\n }\n\n return rect;\n };\n\n return LargeSymbolPath;\n}(graphic.Path);\n\nvar LargeSymbolDraw =\n/** @class */\nfunction () {\n function LargeSymbolDraw() {\n this.group = new graphic.Group();\n }\n /**\n * Update symbols draw by new data\n */\n\n\n LargeSymbolDraw.prototype.updateData = function (data, opt) {\n this._clear();\n\n var symbolEl = this._create();\n\n symbolEl.setShape({\n points: data.getLayout('points')\n });\n\n this._setCommon(symbolEl, data, opt);\n };\n\n LargeSymbolDraw.prototype.updateLayout = function (data) {\n var points = data.getLayout('points');\n this.group.eachChild(function (child) {\n if (child.startIndex != null) {\n var len = (child.endIndex - child.startIndex) * 2;\n var byteOffset = child.startIndex * 4 * 2;\n points = new Float32Array(points.buffer, byteOffset, len);\n }\n\n child.setShape('points', points); // Reset draw cursor.\n\n child.reset();\n });\n };\n\n LargeSymbolDraw.prototype.incrementalPrepareUpdate = function (data) {\n this._clear();\n };\n\n LargeSymbolDraw.prototype.incrementalUpdate = function (taskParams, data, opt) {\n var lastAdded = this._newAdded[0];\n var points = data.getLayout('points');\n var oldPoints = lastAdded && lastAdded.shape.points; // Merging the exists. Each element has 1e4 points.\n // Consider the performance balance between too much elements and too much points in one shape(may affect hover optimization)\n\n if (oldPoints && oldPoints.length < 2e4) {\n var oldLen = oldPoints.length;\n var newPoints = new Float32Array(oldLen + points.length); // Concat two array\n\n newPoints.set(oldPoints);\n newPoints.set(points, oldLen); // Update endIndex\n\n lastAdded.endIndex = taskParams.end;\n lastAdded.setShape({\n points: newPoints\n });\n } else {\n // Clear\n this._newAdded = [];\n\n var symbolEl = this._create();\n\n symbolEl.startIndex = taskParams.start;\n symbolEl.endIndex = taskParams.end;\n symbolEl.incremental = true;\n symbolEl.setShape({\n points: points\n });\n\n this._setCommon(symbolEl, data, opt);\n }\n };\n\n LargeSymbolDraw.prototype.eachRendered = function (cb) {\n this._newAdded[0] && cb(this._newAdded[0]);\n };\n\n LargeSymbolDraw.prototype._create = function () {\n var symbolEl = new LargeSymbolPath({\n cursor: 'default'\n });\n this.group.add(symbolEl);\n\n this._newAdded.push(symbolEl);\n\n return symbolEl;\n };\n\n LargeSymbolDraw.prototype._setCommon = function (symbolEl, data, opt) {\n var hostModel = data.hostModel;\n opt = opt || {};\n var size = data.getVisual('symbolSize');\n symbolEl.setShape('size', size instanceof Array ? size : [size, size]);\n symbolEl.softClipShape = opt.clipShape || null; // Create symbolProxy to build path for each data\n\n symbolEl.symbolProxy = createSymbol(data.getVisual('symbol'), 0, 0, 0, 0); // Use symbolProxy setColor method\n\n symbolEl.setColor = symbolEl.symbolProxy.setColor;\n var extrudeShadow = symbolEl.shape.size[0] < BOOST_SIZE_THRESHOLD;\n symbolEl.useStyle( // Draw shadow when doing fillRect is extremely slow.\n hostModel.getModel('itemStyle').getItemStyle(extrudeShadow ? ['color', 'shadowBlur', 'shadowColor'] : ['color']));\n var globalStyle = data.getVisual('style');\n var visualColor = globalStyle && globalStyle.fill;\n\n if (visualColor) {\n symbolEl.setColor(visualColor);\n }\n\n var ecData = getECData(symbolEl); // Enable tooltip\n // PENDING May have performance issue when path is extremely large\n\n ecData.seriesIndex = hostModel.seriesIndex;\n symbolEl.on('mousemove', function (e) {\n ecData.dataIndex = null;\n var dataIndex = symbolEl.hoverDataIdx;\n\n if (dataIndex >= 0) {\n // Provide dataIndex for tooltip\n ecData.dataIndex = dataIndex + (symbolEl.startIndex || 0);\n }\n });\n };\n\n LargeSymbolDraw.prototype.remove = function () {\n this._clear();\n };\n\n LargeSymbolDraw.prototype._clear = function () {\n this._newAdded = [];\n this.group.removeAll();\n };\n\n return LargeSymbolDraw;\n}();\n\nexport default LargeSymbolDraw;","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { __extends } from \"tslib\";\nimport SymbolDraw from '../helper/SymbolDraw.js';\nimport LargeSymbolDraw from '../helper/LargeSymbolDraw.js';\nimport pointsLayout from '../../layout/points.js';\nimport ChartView from '../../view/Chart.js';\n\nvar ScatterView =\n/** @class */\nfunction (_super) {\n __extends(ScatterView, _super);\n\n function ScatterView() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n\n _this.type = ScatterView.type;\n return _this;\n }\n\n ScatterView.prototype.render = function (seriesModel, ecModel, api) {\n var data = seriesModel.getData();\n\n var symbolDraw = this._updateSymbolDraw(data, seriesModel);\n\n symbolDraw.updateData(data, {\n // TODO\n // If this parameter should be a shape or a bounding volume\n // shape will be more general.\n // But bounding volume like bounding rect will be much faster in the contain calculation\n clipShape: this._getClipShape(seriesModel)\n });\n this._finished = true;\n };\n\n ScatterView.prototype.incrementalPrepareRender = function (seriesModel, ecModel, api) {\n var data = seriesModel.getData();\n\n var symbolDraw = this._updateSymbolDraw(data, seriesModel);\n\n symbolDraw.incrementalPrepareUpdate(data);\n this._finished = false;\n };\n\n ScatterView.prototype.incrementalRender = function (taskParams, seriesModel, ecModel) {\n this._symbolDraw.incrementalUpdate(taskParams, seriesModel.getData(), {\n clipShape: this._getClipShape(seriesModel)\n });\n\n this._finished = taskParams.end === seriesModel.getData().count();\n };\n\n ScatterView.prototype.updateTransform = function (seriesModel, ecModel, api) {\n var data = seriesModel.getData(); // Must mark group dirty and make sure the incremental layer will be cleared\n // PENDING\n\n this.group.dirty();\n\n if (!this._finished || data.count() > 1e4) {\n return {\n update: true\n };\n } else {\n var res = pointsLayout('').reset(seriesModel, ecModel, api);\n\n if (res.progress) {\n res.progress({\n start: 0,\n end: data.count(),\n count: data.count()\n }, data);\n }\n\n this._symbolDraw.updateLayout(data);\n }\n };\n\n ScatterView.prototype.eachRendered = function (cb) {\n this._symbolDraw && this._symbolDraw.eachRendered(cb);\n };\n\n ScatterView.prototype._getClipShape = function (seriesModel) {\n var coordSys = seriesModel.coordinateSystem;\n var clipArea = coordSys && coordSys.getArea && coordSys.getArea();\n return seriesModel.get('clip', true) ? clipArea : null;\n };\n\n ScatterView.prototype._updateSymbolDraw = function (data, seriesModel) {\n var symbolDraw = this._symbolDraw;\n var pipelineContext = seriesModel.pipelineContext;\n var isLargeDraw = pipelineContext.large;\n\n if (!symbolDraw || isLargeDraw !== this._isLargeDraw) {\n symbolDraw && symbolDraw.remove();\n symbolDraw = this._symbolDraw = isLargeDraw ? new LargeSymbolDraw() : new SymbolDraw();\n this._isLargeDraw = isLargeDraw;\n this.group.removeAll();\n }\n\n this.group.add(symbolDraw.group);\n return symbolDraw;\n };\n\n ScatterView.prototype.remove = function (ecModel, api) {\n this._symbolDraw && this._symbolDraw.remove(true);\n this._symbolDraw = null;\n };\n\n ScatterView.prototype.dispose = function () {};\n\n ScatterView.type = 'scatter';\n return ScatterView;\n}(ChartView);\n\nexport default ScatterView;","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { __extends } from \"tslib\";\nimport ComponentModel from '../../model/Component.js';\n\nvar GridModel =\n/** @class */\nfunction (_super) {\n __extends(GridModel, _super);\n\n function GridModel() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n\n GridModel.type = 'grid';\n GridModel.dependencies = ['xAxis', 'yAxis'];\n GridModel.layoutMode = 'box';\n GridModel.defaultOption = {\n show: false,\n // zlevel: 0,\n z: 0,\n left: '10%',\n top: 60,\n right: '10%',\n bottom: 70,\n // If grid size contain label\n containLabel: false,\n // width: {totalWidth} - left - right,\n // height: {totalHeight} - top - bottom,\n backgroundColor: 'rgba(0,0,0,0)',\n borderWidth: 1,\n borderColor: '#ccc'\n };\n return GridModel;\n}(ComponentModel);\n\nexport default GridModel;","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nvar AxisModelCommonMixin =\n/** @class */\nfunction () {\n function AxisModelCommonMixin() {}\n\n AxisModelCommonMixin.prototype.getNeedCrossZero = function () {\n var option = this.option;\n return !option.scale;\n };\n /**\n * Should be implemented by each axis model if necessary.\n * @return coordinate system model\n */\n\n\n AxisModelCommonMixin.prototype.getCoordSysModel = function () {\n return;\n };\n\n return AxisModelCommonMixin;\n}();\n\nexport { AxisModelCommonMixin };","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { __extends } from \"tslib\";\nimport * as zrUtil from 'zrender/lib/core/util.js';\nimport ComponentModel from '../../model/Component.js';\nimport { AxisModelCommonMixin } from '../axisModelCommonMixin.js';\nimport { SINGLE_REFERRING } from '../../util/model.js';\n\nvar CartesianAxisModel =\n/** @class */\nfunction (_super) {\n __extends(CartesianAxisModel, _super);\n\n function CartesianAxisModel() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n\n CartesianAxisModel.prototype.getCoordSysModel = function () {\n return this.getReferringComponents('grid', SINGLE_REFERRING).models[0];\n };\n\n CartesianAxisModel.type = 'cartesian2dAxis';\n return CartesianAxisModel;\n}(ComponentModel);\n\nexport { CartesianAxisModel };\nzrUtil.mixin(CartesianAxisModel, AxisModelCommonMixin);\nexport default CartesianAxisModel;","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport * as zrUtil from 'zrender/lib/core/util.js';\nvar defaultOption = {\n show: true,\n // zlevel: 0,\n z: 0,\n // Inverse the axis.\n inverse: false,\n // Axis name displayed.\n name: '',\n // 'start' | 'middle' | 'end'\n nameLocation: 'end',\n // By degree. By default auto rotate by nameLocation.\n nameRotate: null,\n nameTruncate: {\n maxWidth: null,\n ellipsis: '...',\n placeholder: '.'\n },\n // Use global text style by default.\n nameTextStyle: {},\n // The gap between axisName and axisLine.\n nameGap: 15,\n // Default `false` to support tooltip.\n silent: false,\n // Default `false` to avoid legacy user event listener fail.\n triggerEvent: false,\n tooltip: {\n show: false\n },\n axisPointer: {},\n axisLine: {\n show: true,\n onZero: true,\n onZeroAxisIndex: null,\n lineStyle: {\n color: '#6E7079',\n width: 1,\n type: 'solid'\n },\n // The arrow at both ends the the axis.\n symbol: ['none', 'none'],\n symbolSize: [10, 15]\n },\n axisTick: {\n show: true,\n // Whether axisTick is inside the grid or outside the grid.\n inside: false,\n // The length of axisTick.\n length: 5,\n lineStyle: {\n width: 1\n }\n },\n axisLabel: {\n show: true,\n // Whether axisLabel is inside the grid or outside the grid.\n inside: false,\n rotate: 0,\n // true | false | null/undefined (auto)\n showMinLabel: null,\n // true | false | null/undefined (auto)\n showMaxLabel: null,\n margin: 8,\n // formatter: null,\n fontSize: 12\n },\n splitLine: {\n show: true,\n lineStyle: {\n color: ['#E0E6F1'],\n width: 1,\n type: 'solid'\n }\n },\n splitArea: {\n show: false,\n areaStyle: {\n color: ['rgba(250,250,250,0.2)', 'rgba(210,219,238,0.2)']\n }\n }\n};\nvar categoryAxis = zrUtil.merge({\n // The gap at both ends of the axis. For categoryAxis, boolean.\n boundaryGap: true,\n // Set false to faster category collection.\n deduplication: null,\n // splitArea: {\n // show: false\n // },\n splitLine: {\n show: false\n },\n axisTick: {\n // If tick is align with label when boundaryGap is true\n alignWithLabel: false,\n interval: 'auto'\n },\n axisLabel: {\n interval: 'auto'\n }\n}, defaultOption);\nvar valueAxis = zrUtil.merge({\n boundaryGap: [0, 0],\n axisLine: {\n // Not shown when other axis is categoryAxis in cartesian\n show: 'auto'\n },\n axisTick: {\n // Not shown when other axis is categoryAxis in cartesian\n show: 'auto'\n },\n // TODO\n // min/max: [30, datamin, 60] or [20, datamin] or [datamin, 60]\n splitNumber: 5,\n minorTick: {\n // Minor tick, not available for cateogry axis.\n show: false,\n // Split number of minor ticks. The value should be in range of (0, 100)\n splitNumber: 5,\n // Lenght of minor tick\n length: 3,\n // Line style\n lineStyle: {// Default to be same with axisTick\n }\n },\n minorSplitLine: {\n show: false,\n lineStyle: {\n color: '#F4F7FD',\n width: 1\n }\n }\n}, defaultOption);\nvar timeAxis = zrUtil.merge({\n splitNumber: 6,\n axisLabel: {\n // To eliminate labels that are not nice\n showMinLabel: false,\n showMaxLabel: false,\n rich: {\n primary: {\n fontWeight: 'bold'\n }\n }\n },\n splitLine: {\n show: false\n }\n}, valueAxis);\nvar logAxis = zrUtil.defaults({\n logBase: 10\n}, valueAxis);\nexport default {\n category: categoryAxis,\n value: valueAxis,\n time: timeAxis,\n log: logAxis\n};","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { createHashMap, isObject, map, isString } from 'zrender/lib/core/util.js';\nvar uidBase = 0;\n\nvar OrdinalMeta =\n/** @class */\nfunction () {\n function OrdinalMeta(opt) {\n this.categories = opt.categories || [];\n this._needCollect = opt.needCollect;\n this._deduplication = opt.deduplication;\n this.uid = ++uidBase;\n }\n\n OrdinalMeta.createByAxisModel = function (axisModel) {\n var option = axisModel.option;\n var data = option.data;\n var categories = data && map(data, getName);\n return new OrdinalMeta({\n categories: categories,\n needCollect: !categories,\n // deduplication is default in axis.\n deduplication: option.dedplication !== false\n });\n };\n\n ;\n\n OrdinalMeta.prototype.getOrdinal = function (category) {\n // @ts-ignore\n return this._getOrCreateMap().get(category);\n };\n /**\n * @return The ordinal. If not found, return NaN.\n */\n\n\n OrdinalMeta.prototype.parseAndCollect = function (category) {\n var index;\n var needCollect = this._needCollect; // The value of category dim can be the index of the given category set.\n // This feature is only supported when !needCollect, because we should\n // consider a common case: a value is 2017, which is a number but is\n // expected to be tread as a category. This case usually happen in dataset,\n // where it happent to be no need of the index feature.\n\n if (!isString(category) && !needCollect) {\n return category;\n } // Optimize for the scenario:\n // category is ['2012-01-01', '2012-01-02', ...], where the input\n // data has been ensured not duplicate and is large data.\n // Notice, if a dataset dimension provide categroies, usually echarts\n // should remove duplication except user tell echarts dont do that\n // (set axis.deduplication = false), because echarts do not know whether\n // the values in the category dimension has duplication (consider the\n // parallel-aqi example)\n\n\n if (needCollect && !this._deduplication) {\n index = this.categories.length;\n this.categories[index] = category;\n return index;\n }\n\n var map = this._getOrCreateMap(); // @ts-ignore\n\n\n index = map.get(category);\n\n if (index == null) {\n if (needCollect) {\n index = this.categories.length;\n this.categories[index] = category; // @ts-ignore\n\n map.set(category, index);\n } else {\n index = NaN;\n }\n }\n\n return index;\n }; // Consider big data, do not create map until needed.\n\n\n OrdinalMeta.prototype._getOrCreateMap = function () {\n return this._map || (this._map = createHashMap(this.categories));\n };\n\n return OrdinalMeta;\n}();\n\nfunction getName(obj) {\n if (isObject(obj) && obj.value != null) {\n return obj.value;\n } else {\n return obj + '';\n }\n}\n\nexport default OrdinalMeta;","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nexport var AXIS_TYPES = {\n value: 1,\n category: 1,\n time: 1,\n log: 1\n};","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { __extends } from \"tslib\";\nimport axisDefault from './axisDefault.js';\nimport { getLayoutParams, mergeLayoutParam, fetchLayoutMode } from '../util/layout.js';\nimport OrdinalMeta from '../data/OrdinalMeta.js';\nimport { AXIS_TYPES } from './axisCommonTypes.js';\nimport { each, merge } from 'zrender/lib/core/util.js';\n/**\n * Generate sub axis model class\n * @param axisName 'x' 'y' 'radius' 'angle' 'parallel' ...\n */\n\nexport default function axisModelCreator(registers, axisName, BaseAxisModelClass, extraDefaultOption) {\n each(AXIS_TYPES, function (v, axisType) {\n var defaultOption = merge(merge({}, axisDefault[axisType], true), extraDefaultOption, true);\n\n var AxisModel =\n /** @class */\n function (_super) {\n __extends(AxisModel, _super);\n\n function AxisModel() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n\n _this.type = axisName + 'Axis.' + axisType;\n return _this;\n }\n\n AxisModel.prototype.mergeDefaultAndTheme = function (option, ecModel) {\n var layoutMode = fetchLayoutMode(this);\n var inputPositionParams = layoutMode ? getLayoutParams(option) : {};\n var themeModel = ecModel.getTheme();\n merge(option, themeModel.get(axisType + 'Axis'));\n merge(option, this.getDefaultOption());\n option.type = getAxisType(option);\n\n if (layoutMode) {\n mergeLayoutParam(option, inputPositionParams, layoutMode);\n }\n };\n\n AxisModel.prototype.optionUpdated = function () {\n var thisOption = this.option;\n\n if (thisOption.type === 'category') {\n this.__ordinalMeta = OrdinalMeta.createByAxisModel(this);\n }\n };\n /**\n * Should not be called before all of 'getInitailData' finished.\n * Because categories are collected during initializing data.\n */\n\n\n AxisModel.prototype.getCategories = function (rawData) {\n var option = this.option; // FIXME\n // warning if called before all of 'getInitailData' finished.\n\n if (option.type === 'category') {\n if (rawData) {\n return option.data;\n }\n\n return this.__ordinalMeta.categories;\n }\n };\n\n AxisModel.prototype.getOrdinalMeta = function () {\n return this.__ordinalMeta;\n };\n\n AxisModel.type = axisName + 'Axis.' + axisType;\n AxisModel.defaultOption = defaultOption;\n return AxisModel;\n }(BaseAxisModelClass);\n\n registers.registerComponentModel(AxisModel);\n });\n registers.registerSubTypeDefaulter(axisName + 'Axis', getAxisType);\n}\n\nfunction getAxisType(option) {\n // Default axis with data is category axis\n return option.type || (option.data ? 'category' : 'value');\n}","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport * as clazzUtil from '../util/clazz.js';\n\nvar Scale =\n/** @class */\nfunction () {\n function Scale(setting) {\n this._setting = setting || {};\n this._extent = [Infinity, -Infinity];\n }\n\n Scale.prototype.getSetting = function (name) {\n return this._setting[name];\n };\n /**\n * Set extent from data\n */\n\n\n Scale.prototype.unionExtent = function (other) {\n var extent = this._extent;\n other[0] < extent[0] && (extent[0] = other[0]);\n other[1] > extent[1] && (extent[1] = other[1]); // not setExtent because in log axis it may transformed to power\n // this.setExtent(extent[0], extent[1]);\n };\n /**\n * Set extent from data\n */\n\n\n Scale.prototype.unionExtentFromData = function (data, dim) {\n this.unionExtent(data.getApproximateExtent(dim));\n };\n /**\n * Get extent\n *\n * Extent is always in increase order.\n */\n\n\n Scale.prototype.getExtent = function () {\n return this._extent.slice();\n };\n /**\n * Set extent\n */\n\n\n Scale.prototype.setExtent = function (start, end) {\n var thisExtent = this._extent;\n\n if (!isNaN(start)) {\n thisExtent[0] = start;\n }\n\n if (!isNaN(end)) {\n thisExtent[1] = end;\n }\n };\n /**\n * If value is in extent range\n */\n\n\n Scale.prototype.isInExtentRange = function (value) {\n return this._extent[0] <= value && this._extent[1] >= value;\n };\n /**\n * When axis extent depends on data and no data exists,\n * axis ticks should not be drawn, which is named 'blank'.\n */\n\n\n Scale.prototype.isBlank = function () {\n return this._isBlank;\n };\n /**\n * When axis extent depends on data and no data exists,\n * axis ticks should not be drawn, which is named 'blank'.\n */\n\n\n Scale.prototype.setBlank = function (isBlank) {\n this._isBlank = isBlank;\n };\n\n return Scale;\n}();\n\nclazzUtil.enableClassManagement(Scale);\nexport default Scale;","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { getPrecision, round, nice, quantityExponent } from '../util/number.js';\nexport function isValueNice(val) {\n var exp10 = Math.pow(10, quantityExponent(Math.abs(val)));\n var f = Math.abs(val / exp10);\n return f === 0 || f === 1 || f === 2 || f === 3 || f === 5;\n}\nexport function isIntervalOrLogScale(scale) {\n return scale.type === 'interval' || scale.type === 'log';\n}\n/**\n * @param extent Both extent[0] and extent[1] should be valid number.\n * Should be extent[0] < extent[1].\n * @param splitNumber splitNumber should be >= 1.\n */\n\nexport function intervalScaleNiceTicks(extent, splitNumber, minInterval, maxInterval) {\n var result = {};\n var span = extent[1] - extent[0];\n var interval = result.interval = nice(span / splitNumber, true);\n\n if (minInterval != null && interval < minInterval) {\n interval = result.interval = minInterval;\n }\n\n if (maxInterval != null && interval > maxInterval) {\n interval = result.interval = maxInterval;\n } // Tow more digital for tick.\n\n\n var precision = result.intervalPrecision = getIntervalPrecision(interval); // Niced extent inside original extent\n\n var niceTickExtent = result.niceTickExtent = [round(Math.ceil(extent[0] / interval) * interval, precision), round(Math.floor(extent[1] / interval) * interval, precision)];\n fixExtent(niceTickExtent, extent);\n return result;\n}\nexport function increaseInterval(interval) {\n var exp10 = Math.pow(10, quantityExponent(interval)); // Increase interval\n\n var f = interval / exp10;\n\n if (!f) {\n f = 1;\n } else if (f === 2) {\n f = 3;\n } else if (f === 3) {\n f = 5;\n } else {\n // f is 1 or 5\n f *= 2;\n }\n\n return round(f * exp10);\n}\n/**\n * @return interval precision\n */\n\nexport function getIntervalPrecision(interval) {\n // Tow more digital for tick.\n return getPrecision(interval) + 2;\n}\n\nfunction clamp(niceTickExtent, idx, extent) {\n niceTickExtent[idx] = Math.max(Math.min(niceTickExtent[idx], extent[1]), extent[0]);\n} // In some cases (e.g., splitNumber is 1), niceTickExtent may be out of extent.\n\n\nexport function fixExtent(niceTickExtent, extent) {\n !isFinite(niceTickExtent[0]) && (niceTickExtent[0] = extent[0]);\n !isFinite(niceTickExtent[1]) && (niceTickExtent[1] = extent[1]);\n clamp(niceTickExtent, 0, extent);\n clamp(niceTickExtent, 1, extent);\n\n if (niceTickExtent[0] > niceTickExtent[1]) {\n niceTickExtent[0] = niceTickExtent[1];\n }\n}\nexport function contain(val, extent) {\n return val >= extent[0] && val <= extent[1];\n}\nexport function normalize(val, extent) {\n if (extent[1] === extent[0]) {\n return 0.5;\n }\n\n return (val - extent[0]) / (extent[1] - extent[0]);\n}\nexport function scale(val, extent) {\n return val * (extent[1] - extent[0]) + extent[0];\n}","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { __extends } from \"tslib\";\n/**\n * Linear continuous scale\n * http://en.wikipedia.org/wiki/Level_of_measurement\n */\n// FIXME only one data\n\nimport Scale from './Scale.js';\nimport OrdinalMeta from '../data/OrdinalMeta.js';\nimport * as scaleHelper from './helper.js';\nimport { isArray, map, isObject, isString } from 'zrender/lib/core/util.js';\n\nvar OrdinalScale =\n/** @class */\nfunction (_super) {\n __extends(OrdinalScale, _super);\n\n function OrdinalScale(setting) {\n var _this = _super.call(this, setting) || this;\n\n _this.type = 'ordinal';\n\n var ordinalMeta = _this.getSetting('ordinalMeta'); // Caution: Should not use instanceof, consider ec-extensions using\n // import approach to get OrdinalMeta class.\n\n\n if (!ordinalMeta) {\n ordinalMeta = new OrdinalMeta({});\n }\n\n if (isArray(ordinalMeta)) {\n ordinalMeta = new OrdinalMeta({\n categories: map(ordinalMeta, function (item) {\n return isObject(item) ? item.value : item;\n })\n });\n }\n\n _this._ordinalMeta = ordinalMeta;\n _this._extent = _this.getSetting('extent') || [0, ordinalMeta.categories.length - 1];\n return _this;\n }\n\n OrdinalScale.prototype.parse = function (val) {\n return isString(val) ? this._ordinalMeta.getOrdinal(val) // val might be float.\n : Math.round(val);\n };\n\n OrdinalScale.prototype.contain = function (rank) {\n rank = this.parse(rank);\n return scaleHelper.contain(rank, this._extent) && this._ordinalMeta.categories[rank] != null;\n };\n /**\n * Normalize given rank or name to linear [0, 1]\n * @param val raw ordinal number.\n * @return normalized value in [0, 1].\n */\n\n\n OrdinalScale.prototype.normalize = function (val) {\n val = this._getTickNumber(this.parse(val));\n return scaleHelper.normalize(val, this._extent);\n };\n /**\n * @param val normalized value in [0, 1].\n * @return raw ordinal number.\n */\n\n\n OrdinalScale.prototype.scale = function (val) {\n val = Math.round(scaleHelper.scale(val, this._extent));\n return this.getRawOrdinalNumber(val);\n };\n\n OrdinalScale.prototype.getTicks = function () {\n var ticks = [];\n var extent = this._extent;\n var rank = extent[0];\n\n while (rank <= extent[1]) {\n ticks.push({\n value: rank\n });\n rank++;\n }\n\n return ticks;\n };\n\n OrdinalScale.prototype.getMinorTicks = function (splitNumber) {\n // Not support.\n return;\n };\n /**\n * @see `Ordinal['_ordinalNumbersByTick']`\n */\n\n\n OrdinalScale.prototype.setSortInfo = function (info) {\n if (info == null) {\n this._ordinalNumbersByTick = this._ticksByOrdinalNumber = null;\n return;\n }\n\n var infoOrdinalNumbers = info.ordinalNumbers;\n var ordinalsByTick = this._ordinalNumbersByTick = [];\n var ticksByOrdinal = this._ticksByOrdinalNumber = []; // Unnecessary support negative tick in `realtimeSort`.\n\n var tickNum = 0;\n var allCategoryLen = this._ordinalMeta.categories.length;\n\n for (var len = Math.min(allCategoryLen, infoOrdinalNumbers.length); tickNum < len; ++tickNum) {\n var ordinalNumber = infoOrdinalNumbers[tickNum];\n ordinalsByTick[tickNum] = ordinalNumber;\n ticksByOrdinal[ordinalNumber] = tickNum;\n } // Handle that `series.data` only covers part of the `axis.category.data`.\n\n\n var unusedOrdinal = 0;\n\n for (; tickNum < allCategoryLen; ++tickNum) {\n while (ticksByOrdinal[unusedOrdinal] != null) {\n unusedOrdinal++;\n }\n\n ;\n ordinalsByTick.push(unusedOrdinal);\n ticksByOrdinal[unusedOrdinal] = tickNum;\n }\n };\n\n OrdinalScale.prototype._getTickNumber = function (ordinal) {\n var ticksByOrdinalNumber = this._ticksByOrdinalNumber; // also support ordinal out of range of `ordinalMeta.categories.length`,\n // where ordinal numbers are used as tick value directly.\n\n return ticksByOrdinalNumber && ordinal >= 0 && ordinal < ticksByOrdinalNumber.length ? ticksByOrdinalNumber[ordinal] : ordinal;\n };\n /**\n * @usage\n * ```js\n * const ordinalNumber = ordinalScale.getRawOrdinalNumber(tickVal);\n *\n * // case0\n * const rawOrdinalValue = axisModel.getCategories()[ordinalNumber];\n * // case1\n * const rawOrdinalValue = this._ordinalMeta.categories[ordinalNumber];\n * // case2\n * const coord = axis.dataToCoord(ordinalNumber);\n * ```\n *\n * @param {OrdinalNumber} tickNumber index of display\n */\n\n\n OrdinalScale.prototype.getRawOrdinalNumber = function (tickNumber) {\n var ordinalNumbersByTick = this._ordinalNumbersByTick; // tickNumber may be out of range, e.g., when axis max is larger than `ordinalMeta.categories.length`.,\n // where ordinal numbers are used as tick value directly.\n\n return ordinalNumbersByTick && tickNumber >= 0 && tickNumber < ordinalNumbersByTick.length ? ordinalNumbersByTick[tickNumber] : tickNumber;\n };\n /**\n * Get item on tick\n */\n\n\n OrdinalScale.prototype.getLabel = function (tick) {\n if (!this.isBlank()) {\n var ordinalNumber = this.getRawOrdinalNumber(tick.value);\n var cateogry = this._ordinalMeta.categories[ordinalNumber]; // Note that if no data, ordinalMeta.categories is an empty array.\n // Return empty if it's not exist.\n\n return cateogry == null ? '' : cateogry + '';\n }\n };\n\n OrdinalScale.prototype.count = function () {\n return this._extent[1] - this._extent[0] + 1;\n };\n\n OrdinalScale.prototype.unionExtentFromData = function (data, dim) {\n this.unionExtent(data.getApproximateExtent(dim));\n };\n /**\n * @override\n * If value is in extent range\n */\n\n\n OrdinalScale.prototype.isInExtentRange = function (value) {\n value = this._getTickNumber(value);\n return this._extent[0] <= value && this._extent[1] >= value;\n };\n\n OrdinalScale.prototype.getOrdinalMeta = function () {\n return this._ordinalMeta;\n };\n\n OrdinalScale.prototype.calcNiceTicks = function () {};\n\n OrdinalScale.prototype.calcNiceExtent = function () {};\n\n OrdinalScale.type = 'ordinal';\n return OrdinalScale;\n}(Scale);\n\nScale.registerClass(OrdinalScale);\nexport default OrdinalScale;","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { __extends } from \"tslib\";\nimport * as numberUtil from '../util/number.js';\nimport * as formatUtil from '../util/format.js';\nimport Scale from './Scale.js';\nimport * as helper from './helper.js';\nvar roundNumber = numberUtil.round;\n\nvar IntervalScale =\n/** @class */\nfunction (_super) {\n __extends(IntervalScale, _super);\n\n function IntervalScale() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n\n _this.type = 'interval'; // Step is calculated in adjustExtent.\n\n _this._interval = 0;\n _this._intervalPrecision = 2;\n return _this;\n }\n\n IntervalScale.prototype.parse = function (val) {\n return val;\n };\n\n IntervalScale.prototype.contain = function (val) {\n return helper.contain(val, this._extent);\n };\n\n IntervalScale.prototype.normalize = function (val) {\n return helper.normalize(val, this._extent);\n };\n\n IntervalScale.prototype.scale = function (val) {\n return helper.scale(val, this._extent);\n };\n\n IntervalScale.prototype.setExtent = function (start, end) {\n var thisExtent = this._extent; // start,end may be a Number like '25',so...\n\n if (!isNaN(start)) {\n thisExtent[0] = parseFloat(start);\n }\n\n if (!isNaN(end)) {\n thisExtent[1] = parseFloat(end);\n }\n };\n\n IntervalScale.prototype.unionExtent = function (other) {\n var extent = this._extent;\n other[0] < extent[0] && (extent[0] = other[0]);\n other[1] > extent[1] && (extent[1] = other[1]); // unionExtent may called by it's sub classes\n\n this.setExtent(extent[0], extent[1]);\n };\n\n IntervalScale.prototype.getInterval = function () {\n return this._interval;\n };\n\n IntervalScale.prototype.setInterval = function (interval) {\n this._interval = interval; // Dropped auto calculated niceExtent and use user setted extent\n // We assume user wan't to set both interval, min, max to get a better result\n\n this._niceExtent = this._extent.slice();\n this._intervalPrecision = helper.getIntervalPrecision(interval);\n };\n /**\n * @param expandToNicedExtent Whether expand the ticks to niced extent.\n */\n\n\n IntervalScale.prototype.getTicks = function (expandToNicedExtent) {\n var interval = this._interval;\n var extent = this._extent;\n var niceTickExtent = this._niceExtent;\n var intervalPrecision = this._intervalPrecision;\n var ticks = []; // If interval is 0, return [];\n\n if (!interval) {\n return ticks;\n } // Consider this case: using dataZoom toolbox, zoom and zoom.\n\n\n var safeLimit = 10000;\n\n if (extent[0] < niceTickExtent[0]) {\n if (expandToNicedExtent) {\n ticks.push({\n value: roundNumber(niceTickExtent[0] - interval, intervalPrecision)\n });\n } else {\n ticks.push({\n value: extent[0]\n });\n }\n }\n\n var tick = niceTickExtent[0];\n\n while (tick <= niceTickExtent[1]) {\n ticks.push({\n value: tick\n }); // Avoid rounding error\n\n tick = roundNumber(tick + interval, intervalPrecision);\n\n if (tick === ticks[ticks.length - 1].value) {\n // Consider out of safe float point, e.g.,\n // -3711126.9907707 + 2e-10 === -3711126.9907707\n break;\n }\n\n if (ticks.length > safeLimit) {\n return [];\n }\n } // Consider this case: the last item of ticks is smaller\n // than niceTickExtent[1] and niceTickExtent[1] === extent[1].\n\n\n var lastNiceTick = ticks.length ? ticks[ticks.length - 1].value : niceTickExtent[1];\n\n if (extent[1] > lastNiceTick) {\n if (expandToNicedExtent) {\n ticks.push({\n value: roundNumber(lastNiceTick + interval, intervalPrecision)\n });\n } else {\n ticks.push({\n value: extent[1]\n });\n }\n }\n\n return ticks;\n };\n\n IntervalScale.prototype.getMinorTicks = function (splitNumber) {\n var ticks = this.getTicks(true);\n var minorTicks = [];\n var extent = this.getExtent();\n\n for (var i = 1; i < ticks.length; i++) {\n var nextTick = ticks[i];\n var prevTick = ticks[i - 1];\n var count = 0;\n var minorTicksGroup = [];\n var interval = nextTick.value - prevTick.value;\n var minorInterval = interval / splitNumber;\n\n while (count < splitNumber - 1) {\n var minorTick = roundNumber(prevTick.value + (count + 1) * minorInterval); // For the first and last interval. The count may be less than splitNumber.\n\n if (minorTick > extent[0] && minorTick < extent[1]) {\n minorTicksGroup.push(minorTick);\n }\n\n count++;\n }\n\n minorTicks.push(minorTicksGroup);\n }\n\n return minorTicks;\n };\n /**\n * @param opt.precision If 'auto', use nice presision.\n * @param opt.pad returns 1.50 but not 1.5 if precision is 2.\n */\n\n\n IntervalScale.prototype.getLabel = function (data, opt) {\n if (data == null) {\n return '';\n }\n\n var precision = opt && opt.precision;\n\n if (precision == null) {\n precision = numberUtil.getPrecision(data.value) || 0;\n } else if (precision === 'auto') {\n // Should be more precise then tick.\n precision = this._intervalPrecision;\n } // (1) If `precision` is set, 12.005 should be display as '12.00500'.\n // (2) Use roundNumber (toFixed) to avoid scientific notation like '3.5e-7'.\n\n\n var dataNum = roundNumber(data.value, precision, true);\n return formatUtil.addCommas(dataNum);\n };\n /**\n * @param splitNumber By default `5`.\n */\n\n\n IntervalScale.prototype.calcNiceTicks = function (splitNumber, minInterval, maxInterval) {\n splitNumber = splitNumber || 5;\n var extent = this._extent;\n var span = extent[1] - extent[0];\n\n if (!isFinite(span)) {\n return;\n } // User may set axis min 0 and data are all negative\n // FIXME If it needs to reverse ?\n\n\n if (span < 0) {\n span = -span;\n extent.reverse();\n }\n\n var result = helper.intervalScaleNiceTicks(extent, splitNumber, minInterval, maxInterval);\n this._intervalPrecision = result.intervalPrecision;\n this._interval = result.interval;\n this._niceExtent = result.niceTickExtent;\n };\n\n IntervalScale.prototype.calcNiceExtent = function (opt) {\n var extent = this._extent; // If extent start and end are same, expand them\n\n if (extent[0] === extent[1]) {\n if (extent[0] !== 0) {\n // Expand extent\n var expandSize = extent[0]; // In the fowllowing case\n // Axis has been fixed max 100\n // Plus data are all 100 and axis extent are [100, 100].\n // Extend to the both side will cause expanded max is larger than fixed max.\n // So only expand to the smaller side.\n\n if (!opt.fixMax) {\n extent[1] += expandSize / 2;\n extent[0] -= expandSize / 2;\n } else {\n extent[0] -= expandSize / 2;\n }\n } else {\n extent[1] = 1;\n }\n }\n\n var span = extent[1] - extent[0]; // If there are no data and extent are [Infinity, -Infinity]\n\n if (!isFinite(span)) {\n extent[0] = 0;\n extent[1] = 1;\n }\n\n this.calcNiceTicks(opt.splitNumber, opt.minInterval, opt.maxInterval); // let extent = this._extent;\n\n var interval = this._interval;\n\n if (!opt.fixMin) {\n extent[0] = roundNumber(Math.floor(extent[0] / interval) * interval);\n }\n\n if (!opt.fixMax) {\n extent[1] = roundNumber(Math.ceil(extent[1] / interval) * interval);\n }\n };\n\n IntervalScale.prototype.setNiceExtent = function (min, max) {\n this._niceExtent = [min, max];\n };\n\n IntervalScale.type = 'interval';\n return IntervalScale;\n}(Scale);\n\nScale.registerClass(IntervalScale);\nexport default IntervalScale;","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { __extends } from \"tslib\";\n/*\n* A third-party license is embeded for some of the code in this file:\n* The \"scaleLevels\" was originally copied from \"d3.js\" with some\n* modifications made for this project.\n* (See more details in the comment on the definition of \"scaleLevels\" below.)\n* The use of the source code of this file is also subject to the terms\n* and consitions of the license of \"d3.js\" (BSD-3Clause, see\n* ).\n*/\n// [About UTC and local time zone]:\n// In most cases, `number.parseDate` will treat input data string as local time\n// (except time zone is specified in time string). And `format.formateTime` returns\n// local time by default. option.useUTC is false by default. This design have\n// concidered these common case:\n// (1) Time that is persistent in server is in UTC, but it is needed to be diplayed\n// in local time by default.\n// (2) By default, the input data string (e.g., '2011-01-02') should be displayed\n// as its original time, without any time difference.\n\nimport * as numberUtil from '../util/number.js';\nimport { ONE_SECOND, ONE_MINUTE, ONE_HOUR, ONE_DAY, ONE_YEAR, format, leveledFormat, getUnitValue, timeUnits, fullLeveledFormatter, getPrimaryTimeUnit, isPrimaryTimeUnit, getDefaultFormatPrecisionOfInterval, fullYearGetterName, monthSetterName, fullYearSetterName, dateSetterName, hoursGetterName, hoursSetterName, minutesSetterName, secondsSetterName, millisecondsSetterName, monthGetterName, dateGetterName, minutesGetterName, secondsGetterName, millisecondsGetterName } from '../util/time.js';\nimport * as scaleHelper from './helper.js';\nimport IntervalScale from './Interval.js';\nimport Scale from './Scale.js';\nimport { warn } from '../util/log.js';\nimport { filter, isNumber, map } from 'zrender/lib/core/util.js'; // FIXME 公用?\n\nvar bisect = function (a, x, lo, hi) {\n while (lo < hi) {\n var mid = lo + hi >>> 1;\n\n if (a[mid][1] < x) {\n lo = mid + 1;\n } else {\n hi = mid;\n }\n }\n\n return lo;\n};\n\nvar TimeScale =\n/** @class */\nfunction (_super) {\n __extends(TimeScale, _super);\n\n function TimeScale(settings) {\n var _this = _super.call(this, settings) || this;\n\n _this.type = 'time';\n return _this;\n }\n /**\n * Get label is mainly for other components like dataZoom, tooltip.\n */\n\n\n TimeScale.prototype.getLabel = function (tick) {\n var useUTC = this.getSetting('useUTC');\n return format(tick.value, fullLeveledFormatter[getDefaultFormatPrecisionOfInterval(getPrimaryTimeUnit(this._minLevelUnit))] || fullLeveledFormatter.second, useUTC, this.getSetting('locale'));\n };\n\n TimeScale.prototype.getFormattedLabel = function (tick, idx, labelFormatter) {\n var isUTC = this.getSetting('useUTC');\n var lang = this.getSetting('locale');\n return leveledFormat(tick, idx, labelFormatter, lang, isUTC);\n };\n /**\n * @override\n */\n\n\n TimeScale.prototype.getTicks = function () {\n var interval = this._interval;\n var extent = this._extent;\n var ticks = []; // If interval is 0, return [];\n\n if (!interval) {\n return ticks;\n }\n\n ticks.push({\n value: extent[0],\n level: 0\n });\n var useUTC = this.getSetting('useUTC');\n var innerTicks = getIntervalTicks(this._minLevelUnit, this._approxInterval, useUTC, extent);\n ticks = ticks.concat(innerTicks);\n ticks.push({\n value: extent[1],\n level: 0\n });\n return ticks;\n };\n\n TimeScale.prototype.calcNiceExtent = function (opt) {\n var extent = this._extent; // If extent start and end are same, expand them\n\n if (extent[0] === extent[1]) {\n // Expand extent\n extent[0] -= ONE_DAY;\n extent[1] += ONE_DAY;\n } // If there are no data and extent are [Infinity, -Infinity]\n\n\n if (extent[1] === -Infinity && extent[0] === Infinity) {\n var d = new Date();\n extent[1] = +new Date(d.getFullYear(), d.getMonth(), d.getDate());\n extent[0] = extent[1] - ONE_DAY;\n }\n\n this.calcNiceTicks(opt.splitNumber, opt.minInterval, opt.maxInterval);\n };\n\n TimeScale.prototype.calcNiceTicks = function (approxTickNum, minInterval, maxInterval) {\n approxTickNum = approxTickNum || 10;\n var extent = this._extent;\n var span = extent[1] - extent[0];\n this._approxInterval = span / approxTickNum;\n\n if (minInterval != null && this._approxInterval < minInterval) {\n this._approxInterval = minInterval;\n }\n\n if (maxInterval != null && this._approxInterval > maxInterval) {\n this._approxInterval = maxInterval;\n }\n\n var scaleIntervalsLen = scaleIntervals.length;\n var idx = Math.min(bisect(scaleIntervals, this._approxInterval, 0, scaleIntervalsLen), scaleIntervalsLen - 1); // Interval that can be used to calculate ticks\n\n this._interval = scaleIntervals[idx][1]; // Min level used when picking ticks from top down.\n // We check one more level to avoid the ticks are to sparse in some case.\n\n this._minLevelUnit = scaleIntervals[Math.max(idx - 1, 0)][0];\n };\n\n TimeScale.prototype.parse = function (val) {\n // val might be float.\n return isNumber(val) ? val : +numberUtil.parseDate(val);\n };\n\n TimeScale.prototype.contain = function (val) {\n return scaleHelper.contain(this.parse(val), this._extent);\n };\n\n TimeScale.prototype.normalize = function (val) {\n return scaleHelper.normalize(this.parse(val), this._extent);\n };\n\n TimeScale.prototype.scale = function (val) {\n return scaleHelper.scale(val, this._extent);\n };\n\n TimeScale.type = 'time';\n return TimeScale;\n}(IntervalScale);\n/**\n * This implementation was originally copied from \"d3.js\"\n * \n * with some modifications made for this program.\n * See the license statement at the head of this file.\n */\n\n\nvar scaleIntervals = [// Format interval\n['second', ONE_SECOND], ['minute', ONE_MINUTE], ['hour', ONE_HOUR], ['quarter-day', ONE_HOUR * 6], ['half-day', ONE_HOUR * 12], ['day', ONE_DAY * 1.2], ['half-week', ONE_DAY * 3.5], ['week', ONE_DAY * 7], ['month', ONE_DAY * 31], ['quarter', ONE_DAY * 95], ['half-year', ONE_YEAR / 2], ['year', ONE_YEAR] // 1Y\n];\n\nfunction isUnitValueSame(unit, valueA, valueB, isUTC) {\n var dateA = numberUtil.parseDate(valueA);\n var dateB = numberUtil.parseDate(valueB);\n\n var isSame = function (unit) {\n return getUnitValue(dateA, unit, isUTC) === getUnitValue(dateB, unit, isUTC);\n };\n\n var isSameYear = function () {\n return isSame('year');\n }; // const isSameHalfYear = () => isSameYear() && isSame('half-year');\n // const isSameQuater = () => isSameYear() && isSame('quarter');\n\n\n var isSameMonth = function () {\n return isSameYear() && isSame('month');\n };\n\n var isSameDay = function () {\n return isSameMonth() && isSame('day');\n }; // const isSameHalfDay = () => isSameDay() && isSame('half-day');\n\n\n var isSameHour = function () {\n return isSameDay() && isSame('hour');\n };\n\n var isSameMinute = function () {\n return isSameHour() && isSame('minute');\n };\n\n var isSameSecond = function () {\n return isSameMinute() && isSame('second');\n };\n\n var isSameMilliSecond = function () {\n return isSameSecond() && isSame('millisecond');\n };\n\n switch (unit) {\n case 'year':\n return isSameYear();\n\n case 'month':\n return isSameMonth();\n\n case 'day':\n return isSameDay();\n\n case 'hour':\n return isSameHour();\n\n case 'minute':\n return isSameMinute();\n\n case 'second':\n return isSameSecond();\n\n case 'millisecond':\n return isSameMilliSecond();\n }\n} // const primaryUnitGetters = {\n// year: fullYearGetterName(),\n// month: monthGetterName(),\n// day: dateGetterName(),\n// hour: hoursGetterName(),\n// minute: minutesGetterName(),\n// second: secondsGetterName(),\n// millisecond: millisecondsGetterName()\n// };\n// const primaryUnitUTCGetters = {\n// year: fullYearGetterName(true),\n// month: monthGetterName(true),\n// day: dateGetterName(true),\n// hour: hoursGetterName(true),\n// minute: minutesGetterName(true),\n// second: secondsGetterName(true),\n// millisecond: millisecondsGetterName(true)\n// };\n// function moveTick(date: Date, unitName: TimeUnit, step: number, isUTC: boolean) {\n// step = step || 1;\n// switch (getPrimaryTimeUnit(unitName)) {\n// case 'year':\n// date[fullYearSetterName(isUTC)](date[fullYearGetterName(isUTC)]() + step);\n// break;\n// case 'month':\n// date[monthSetterName(isUTC)](date[monthGetterName(isUTC)]() + step);\n// break;\n// case 'day':\n// date[dateSetterName(isUTC)](date[dateGetterName(isUTC)]() + step);\n// break;\n// case 'hour':\n// date[hoursSetterName(isUTC)](date[hoursGetterName(isUTC)]() + step);\n// break;\n// case 'minute':\n// date[minutesSetterName(isUTC)](date[minutesGetterName(isUTC)]() + step);\n// break;\n// case 'second':\n// date[secondsSetterName(isUTC)](date[secondsGetterName(isUTC)]() + step);\n// break;\n// case 'millisecond':\n// date[millisecondsSetterName(isUTC)](date[millisecondsGetterName(isUTC)]() + step);\n// break;\n// }\n// return date.getTime();\n// }\n// const DATE_INTERVALS = [[8, 7.5], [4, 3.5], [2, 1.5]];\n// const MONTH_INTERVALS = [[6, 5.5], [3, 2.5], [2, 1.5]];\n// const MINUTES_SECONDS_INTERVALS = [[30, 30], [20, 20], [15, 15], [10, 10], [5, 5], [2, 2]];\n\n\nfunction getDateInterval(approxInterval, daysInMonth) {\n approxInterval /= ONE_DAY;\n return approxInterval > 16 ? 16 // Math.floor(daysInMonth / 2) + 1 // In this case we only want one tick betwen two month.\n : approxInterval > 7.5 ? 7 // TODO week 7 or day 8?\n : approxInterval > 3.5 ? 4 : approxInterval > 1.5 ? 2 : 1;\n}\n\nfunction getMonthInterval(approxInterval) {\n var APPROX_ONE_MONTH = 30 * ONE_DAY;\n approxInterval /= APPROX_ONE_MONTH;\n return approxInterval > 6 ? 6 : approxInterval > 3 ? 3 : approxInterval > 2 ? 2 : 1;\n}\n\nfunction getHourInterval(approxInterval) {\n approxInterval /= ONE_HOUR;\n return approxInterval > 12 ? 12 : approxInterval > 6 ? 6 : approxInterval > 3.5 ? 4 : approxInterval > 2 ? 2 : 1;\n}\n\nfunction getMinutesAndSecondsInterval(approxInterval, isMinutes) {\n approxInterval /= isMinutes ? ONE_MINUTE : ONE_SECOND;\n return approxInterval > 30 ? 30 : approxInterval > 20 ? 20 : approxInterval > 15 ? 15 : approxInterval > 10 ? 10 : approxInterval > 5 ? 5 : approxInterval > 2 ? 2 : 1;\n}\n\nfunction getMillisecondsInterval(approxInterval) {\n return numberUtil.nice(approxInterval, true);\n}\n\nfunction getFirstTimestampOfUnit(date, unitName, isUTC) {\n var outDate = new Date(date);\n\n switch (getPrimaryTimeUnit(unitName)) {\n case 'year':\n case 'month':\n outDate[monthSetterName(isUTC)](0);\n\n case 'day':\n outDate[dateSetterName(isUTC)](1);\n\n case 'hour':\n outDate[hoursSetterName(isUTC)](0);\n\n case 'minute':\n outDate[minutesSetterName(isUTC)](0);\n\n case 'second':\n outDate[secondsSetterName(isUTC)](0);\n outDate[millisecondsSetterName(isUTC)](0);\n }\n\n return outDate.getTime();\n}\n\nfunction getIntervalTicks(bottomUnitName, approxInterval, isUTC, extent) {\n var safeLimit = 10000;\n var unitNames = timeUnits;\n var iter = 0;\n\n function addTicksInSpan(interval, minTimestamp, maxTimestamp, getMethodName, setMethodName, isDate, out) {\n var date = new Date(minTimestamp);\n var dateTime = minTimestamp;\n var d = date[getMethodName](); // if (isDate) {\n // d -= 1; // Starts with 0; PENDING\n // }\n\n while (dateTime < maxTimestamp && dateTime <= extent[1]) {\n out.push({\n value: dateTime\n });\n d += interval;\n date[setMethodName](d);\n dateTime = date.getTime();\n } // This extra tick is for calcuating ticks of next level. Will not been added to the final result\n\n\n out.push({\n value: dateTime,\n notAdd: true\n });\n }\n\n function addLevelTicks(unitName, lastLevelTicks, levelTicks) {\n var newAddedTicks = [];\n var isFirstLevel = !lastLevelTicks.length;\n\n if (isUnitValueSame(getPrimaryTimeUnit(unitName), extent[0], extent[1], isUTC)) {\n return;\n }\n\n if (isFirstLevel) {\n lastLevelTicks = [{\n // TODO Optimize. Not include so may ticks.\n value: getFirstTimestampOfUnit(new Date(extent[0]), unitName, isUTC)\n }, {\n value: extent[1]\n }];\n }\n\n for (var i = 0; i < lastLevelTicks.length - 1; i++) {\n var startTick = lastLevelTicks[i].value;\n var endTick = lastLevelTicks[i + 1].value;\n\n if (startTick === endTick) {\n continue;\n }\n\n var interval = void 0;\n var getterName = void 0;\n var setterName = void 0;\n var isDate = false;\n\n switch (unitName) {\n case 'year':\n interval = Math.max(1, Math.round(approxInterval / ONE_DAY / 365));\n getterName = fullYearGetterName(isUTC);\n setterName = fullYearSetterName(isUTC);\n break;\n\n case 'half-year':\n case 'quarter':\n case 'month':\n interval = getMonthInterval(approxInterval);\n getterName = monthGetterName(isUTC);\n setterName = monthSetterName(isUTC);\n break;\n\n case 'week': // PENDING If week is added. Ignore day.\n\n case 'half-week':\n case 'day':\n interval = getDateInterval(approxInterval, 31); // Use 32 days and let interval been 16\n\n getterName = dateGetterName(isUTC);\n setterName = dateSetterName(isUTC);\n isDate = true;\n break;\n\n case 'half-day':\n case 'quarter-day':\n case 'hour':\n interval = getHourInterval(approxInterval);\n getterName = hoursGetterName(isUTC);\n setterName = hoursSetterName(isUTC);\n break;\n\n case 'minute':\n interval = getMinutesAndSecondsInterval(approxInterval, true);\n getterName = minutesGetterName(isUTC);\n setterName = minutesSetterName(isUTC);\n break;\n\n case 'second':\n interval = getMinutesAndSecondsInterval(approxInterval, false);\n getterName = secondsGetterName(isUTC);\n setterName = secondsSetterName(isUTC);\n break;\n\n case 'millisecond':\n interval = getMillisecondsInterval(approxInterval);\n getterName = millisecondsGetterName(isUTC);\n setterName = millisecondsSetterName(isUTC);\n break;\n }\n\n addTicksInSpan(interval, startTick, endTick, getterName, setterName, isDate, newAddedTicks);\n\n if (unitName === 'year' && levelTicks.length > 1 && i === 0) {\n // Add nearest years to the left extent.\n levelTicks.unshift({\n value: levelTicks[0].value - interval\n });\n }\n }\n\n for (var i = 0; i < newAddedTicks.length; i++) {\n levelTicks.push(newAddedTicks[i]);\n } // newAddedTicks.length && console.log(unitName, newAddedTicks);\n\n\n return newAddedTicks;\n }\n\n var levelsTicks = [];\n var currentLevelTicks = [];\n var tickCount = 0;\n var lastLevelTickCount = 0;\n\n for (var i = 0; i < unitNames.length && iter++ < safeLimit; ++i) {\n var primaryTimeUnit = getPrimaryTimeUnit(unitNames[i]);\n\n if (!isPrimaryTimeUnit(unitNames[i])) {\n // TODO\n continue;\n }\n\n addLevelTicks(unitNames[i], levelsTicks[levelsTicks.length - 1] || [], currentLevelTicks);\n var nextPrimaryTimeUnit = unitNames[i + 1] ? getPrimaryTimeUnit(unitNames[i + 1]) : null;\n\n if (primaryTimeUnit !== nextPrimaryTimeUnit) {\n if (currentLevelTicks.length) {\n lastLevelTickCount = tickCount; // Remove the duplicate so the tick count can be precisely.\n\n currentLevelTicks.sort(function (a, b) {\n return a.value - b.value;\n });\n var levelTicksRemoveDuplicated = [];\n\n for (var i_1 = 0; i_1 < currentLevelTicks.length; ++i_1) {\n var tickValue = currentLevelTicks[i_1].value;\n\n if (i_1 === 0 || currentLevelTicks[i_1 - 1].value !== tickValue) {\n levelTicksRemoveDuplicated.push(currentLevelTicks[i_1]);\n\n if (tickValue >= extent[0] && tickValue <= extent[1]) {\n tickCount++;\n }\n }\n }\n\n var targetTickNum = (extent[1] - extent[0]) / approxInterval; // Added too much in this level and not too less in last level\n\n if (tickCount > targetTickNum * 1.5 && lastLevelTickCount > targetTickNum / 1.5) {\n break;\n } // Only treat primary time unit as one level.\n\n\n levelsTicks.push(levelTicksRemoveDuplicated);\n\n if (tickCount > targetTickNum || bottomUnitName === unitNames[i]) {\n break;\n }\n } // Reset if next unitName is primary\n\n\n currentLevelTicks = [];\n }\n }\n\n if (process.env.NODE_ENV !== 'production') {\n if (iter >= safeLimit) {\n warn('Exceed safe limit.');\n }\n }\n\n var levelsTicksInExtent = filter(map(levelsTicks, function (levelTicks) {\n return filter(levelTicks, function (tick) {\n return tick.value >= extent[0] && tick.value <= extent[1] && !tick.notAdd;\n });\n }), function (levelTicks) {\n return levelTicks.length > 0;\n });\n var ticks = [];\n var maxLevel = levelsTicksInExtent.length - 1;\n\n for (var i = 0; i < levelsTicksInExtent.length; ++i) {\n var levelTicks = levelsTicksInExtent[i];\n\n for (var k = 0; k < levelTicks.length; ++k) {\n ticks.push({\n value: levelTicks[k].value,\n level: maxLevel - i\n });\n }\n }\n\n ticks.sort(function (a, b) {\n return a.value - b.value;\n }); // Remove duplicates\n\n var result = [];\n\n for (var i = 0; i < ticks.length; ++i) {\n if (i === 0 || ticks[i].value !== ticks[i - 1].value) {\n result.push(ticks[i]);\n }\n }\n\n return result;\n}\n\nScale.registerClass(TimeScale);\nexport default TimeScale;","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { __extends } from \"tslib\";\nimport * as zrUtil from 'zrender/lib/core/util.js';\nimport Scale from './Scale.js';\nimport * as numberUtil from '../util/number.js';\nimport * as scaleHelper from './helper.js'; // Use some method of IntervalScale\n\nimport IntervalScale from './Interval.js';\nvar scaleProto = Scale.prototype; // FIXME:TS refactor: not good to call it directly with `this`?\n\nvar intervalScaleProto = IntervalScale.prototype;\nvar roundingErrorFix = numberUtil.round;\nvar mathFloor = Math.floor;\nvar mathCeil = Math.ceil;\nvar mathPow = Math.pow;\nvar mathLog = Math.log;\n\nvar LogScale =\n/** @class */\nfunction (_super) {\n __extends(LogScale, _super);\n\n function LogScale() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n\n _this.type = 'log';\n _this.base = 10;\n _this._originalScale = new IntervalScale(); // FIXME:TS actually used by `IntervalScale`\n\n _this._interval = 0;\n return _this;\n }\n /**\n * @param Whether expand the ticks to niced extent.\n */\n\n\n LogScale.prototype.getTicks = function (expandToNicedExtent) {\n var originalScale = this._originalScale;\n var extent = this._extent;\n var originalExtent = originalScale.getExtent();\n var ticks = intervalScaleProto.getTicks.call(this, expandToNicedExtent);\n return zrUtil.map(ticks, function (tick) {\n var val = tick.value;\n var powVal = numberUtil.round(mathPow(this.base, val)); // Fix #4158\n\n powVal = val === extent[0] && this._fixMin ? fixRoundingError(powVal, originalExtent[0]) : powVal;\n powVal = val === extent[1] && this._fixMax ? fixRoundingError(powVal, originalExtent[1]) : powVal;\n return {\n value: powVal\n };\n }, this);\n };\n\n LogScale.prototype.setExtent = function (start, end) {\n var base = this.base;\n start = mathLog(start) / mathLog(base);\n end = mathLog(end) / mathLog(base);\n intervalScaleProto.setExtent.call(this, start, end);\n };\n /**\n * @return {number} end\n */\n\n\n LogScale.prototype.getExtent = function () {\n var base = this.base;\n var extent = scaleProto.getExtent.call(this);\n extent[0] = mathPow(base, extent[0]);\n extent[1] = mathPow(base, extent[1]); // Fix #4158\n\n var originalScale = this._originalScale;\n var originalExtent = originalScale.getExtent();\n this._fixMin && (extent[0] = fixRoundingError(extent[0], originalExtent[0]));\n this._fixMax && (extent[1] = fixRoundingError(extent[1], originalExtent[1]));\n return extent;\n };\n\n LogScale.prototype.unionExtent = function (extent) {\n this._originalScale.unionExtent(extent);\n\n var base = this.base;\n extent[0] = mathLog(extent[0]) / mathLog(base);\n extent[1] = mathLog(extent[1]) / mathLog(base);\n scaleProto.unionExtent.call(this, extent);\n };\n\n LogScale.prototype.unionExtentFromData = function (data, dim) {\n // TODO\n // filter value that <= 0\n this.unionExtent(data.getApproximateExtent(dim));\n };\n /**\n * Update interval and extent of intervals for nice ticks\n * @param approxTickNum default 10 Given approx tick number\n */\n\n\n LogScale.prototype.calcNiceTicks = function (approxTickNum) {\n approxTickNum = approxTickNum || 10;\n var extent = this._extent;\n var span = extent[1] - extent[0];\n\n if (span === Infinity || span <= 0) {\n return;\n }\n\n var interval = numberUtil.quantity(span);\n var err = approxTickNum / span * interval; // Filter ticks to get closer to the desired count.\n\n if (err <= 0.5) {\n interval *= 10;\n } // Interval should be integer\n\n\n while (!isNaN(interval) && Math.abs(interval) < 1 && Math.abs(interval) > 0) {\n interval *= 10;\n }\n\n var niceExtent = [numberUtil.round(mathCeil(extent[0] / interval) * interval), numberUtil.round(mathFloor(extent[1] / interval) * interval)];\n this._interval = interval;\n this._niceExtent = niceExtent;\n };\n\n LogScale.prototype.calcNiceExtent = function (opt) {\n intervalScaleProto.calcNiceExtent.call(this, opt);\n this._fixMin = opt.fixMin;\n this._fixMax = opt.fixMax;\n };\n\n LogScale.prototype.parse = function (val) {\n return val;\n };\n\n LogScale.prototype.contain = function (val) {\n val = mathLog(val) / mathLog(this.base);\n return scaleHelper.contain(val, this._extent);\n };\n\n LogScale.prototype.normalize = function (val) {\n val = mathLog(val) / mathLog(this.base);\n return scaleHelper.normalize(val, this._extent);\n };\n\n LogScale.prototype.scale = function (val) {\n val = scaleHelper.scale(val, this._extent);\n return mathPow(this.base, val);\n };\n\n LogScale.type = 'log';\n return LogScale;\n}(Scale);\n\nvar proto = LogScale.prototype;\nproto.getMinorTicks = intervalScaleProto.getMinorTicks;\nproto.getLabel = intervalScaleProto.getLabel;\n\nfunction fixRoundingError(val, originalVal) {\n return roundingErrorFix(val, numberUtil.getPrecision(originalVal));\n}\n\nScale.registerClass(LogScale);\nexport default LogScale;","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { assert, isArray, eqNaN, isFunction } from 'zrender/lib/core/util.js';\nimport { parsePercent } from 'zrender/lib/contain/text.js';\n\nvar ScaleRawExtentInfo =\n/** @class */\nfunction () {\n function ScaleRawExtentInfo(scale, model, // Usually: data extent from all series on this axis.\n originalExtent) {\n this._prepareParams(scale, model, originalExtent);\n }\n /**\n * Parameters depending on ouside (like model, user callback)\n * are prepared and fixed here.\n */\n\n\n ScaleRawExtentInfo.prototype._prepareParams = function (scale, model, // Usually: data extent from all series on this axis.\n dataExtent) {\n if (dataExtent[1] < dataExtent[0]) {\n dataExtent = [NaN, NaN];\n }\n\n this._dataMin = dataExtent[0];\n this._dataMax = dataExtent[1];\n var isOrdinal = this._isOrdinal = scale.type === 'ordinal';\n this._needCrossZero = scale.type === 'interval' && model.getNeedCrossZero && model.getNeedCrossZero();\n var modelMinRaw = this._modelMinRaw = model.get('min', true);\n\n if (isFunction(modelMinRaw)) {\n // This callback alway provide users the full data extent (before data filtered).\n this._modelMinNum = parseAxisModelMinMax(scale, modelMinRaw({\n min: dataExtent[0],\n max: dataExtent[1]\n }));\n } else if (modelMinRaw !== 'dataMin') {\n this._modelMinNum = parseAxisModelMinMax(scale, modelMinRaw);\n }\n\n var modelMaxRaw = this._modelMaxRaw = model.get('max', true);\n\n if (isFunction(modelMaxRaw)) {\n // This callback alway provide users the full data extent (before data filtered).\n this._modelMaxNum = parseAxisModelMinMax(scale, modelMaxRaw({\n min: dataExtent[0],\n max: dataExtent[1]\n }));\n } else if (modelMaxRaw !== 'dataMax') {\n this._modelMaxNum = parseAxisModelMinMax(scale, modelMaxRaw);\n }\n\n if (isOrdinal) {\n // FIXME: there is a flaw here: if there is no \"block\" data processor like `dataZoom`,\n // and progressive rendering is using, here the category result might just only contain\n // the processed chunk rather than the entire result.\n this._axisDataLen = model.getCategories().length;\n } else {\n var boundaryGap = model.get('boundaryGap');\n var boundaryGapArr = isArray(boundaryGap) ? boundaryGap : [boundaryGap || 0, boundaryGap || 0];\n\n if (typeof boundaryGapArr[0] === 'boolean' || typeof boundaryGapArr[1] === 'boolean') {\n if (process.env.NODE_ENV !== 'production') {\n console.warn('Boolean type for boundaryGap is only ' + 'allowed for ordinal axis. Please use string in ' + 'percentage instead, e.g., \"20%\". Currently, ' + 'boundaryGap is set to be 0.');\n }\n\n this._boundaryGapInner = [0, 0];\n } else {\n this._boundaryGapInner = [parsePercent(boundaryGapArr[0], 1), parsePercent(boundaryGapArr[1], 1)];\n }\n }\n };\n /**\n * Calculate extent by prepared parameters.\n * This method has no external dependency and can be called duplicatedly,\n * getting the same result.\n * If parameters changed, should call this method to recalcuate.\n */\n\n\n ScaleRawExtentInfo.prototype.calculate = function () {\n // Notice: When min/max is not set (that is, when there are null/undefined,\n // which is the most common case), these cases should be ensured:\n // (1) For 'ordinal', show all axis.data.\n // (2) For others:\n // + `boundaryGap` is applied (if min/max set, boundaryGap is\n // disabled).\n // + If `needCrossZero`, min/max should be zero, otherwise, min/max should\n // be the result that originalExtent enlarged by boundaryGap.\n // (3) If no data, it should be ensured that `scale.setBlank` is set.\n var isOrdinal = this._isOrdinal;\n var dataMin = this._dataMin;\n var dataMax = this._dataMax;\n var axisDataLen = this._axisDataLen;\n var boundaryGapInner = this._boundaryGapInner;\n var span = !isOrdinal ? dataMax - dataMin || Math.abs(dataMin) : null; // Currently if a `'value'` axis model min is specified as 'dataMin'/'dataMax',\n // `boundaryGap` will not be used. It's the different from specifying as `null`/`undefined`.\n\n var min = this._modelMinRaw === 'dataMin' ? dataMin : this._modelMinNum;\n var max = this._modelMaxRaw === 'dataMax' ? dataMax : this._modelMaxNum; // If `_modelMinNum`/`_modelMaxNum` is `null`/`undefined`, should not be fixed.\n\n var minFixed = min != null;\n var maxFixed = max != null;\n\n if (min == null) {\n min = isOrdinal ? axisDataLen ? 0 : NaN : dataMin - boundaryGapInner[0] * span;\n }\n\n if (max == null) {\n max = isOrdinal ? axisDataLen ? axisDataLen - 1 : NaN : dataMax + boundaryGapInner[1] * span;\n }\n\n (min == null || !isFinite(min)) && (min = NaN);\n (max == null || !isFinite(max)) && (max = NaN);\n var isBlank = eqNaN(min) || eqNaN(max) || isOrdinal && !axisDataLen; // If data extent modified, need to recalculated to ensure cross zero.\n\n if (this._needCrossZero) {\n // Axis is over zero and min is not set\n if (min > 0 && max > 0 && !minFixed) {\n min = 0; // minFixed = true;\n } // Axis is under zero and max is not set\n\n\n if (min < 0 && max < 0 && !maxFixed) {\n max = 0; // maxFixed = true;\n } // PENDING:\n // When `needCrossZero` and all data is positive/negative, should it be ensured\n // that the results processed by boundaryGap are positive/negative?\n // If so, here `minFixed`/`maxFixed` need to be set.\n\n }\n\n var determinedMin = this._determinedMin;\n var determinedMax = this._determinedMax;\n\n if (determinedMin != null) {\n min = determinedMin;\n minFixed = true;\n }\n\n if (determinedMax != null) {\n max = determinedMax;\n maxFixed = true;\n } // Ensure min/max be finite number or NaN here. (not to be null/undefined)\n // `NaN` means min/max axis is blank.\n\n\n return {\n min: min,\n max: max,\n minFixed: minFixed,\n maxFixed: maxFixed,\n isBlank: isBlank\n };\n };\n\n ScaleRawExtentInfo.prototype.modifyDataMinMax = function (minMaxName, val) {\n if (process.env.NODE_ENV !== 'production') {\n assert(!this.frozen);\n }\n\n this[DATA_MIN_MAX_ATTR[minMaxName]] = val;\n };\n\n ScaleRawExtentInfo.prototype.setDeterminedMinMax = function (minMaxName, val) {\n var attr = DETERMINED_MIN_MAX_ATTR[minMaxName];\n\n if (process.env.NODE_ENV !== 'production') {\n assert(!this.frozen // Earse them usually means logic flaw.\n && this[attr] == null);\n }\n\n this[attr] = val;\n };\n\n ScaleRawExtentInfo.prototype.freeze = function () {\n // @ts-ignore\n this.frozen = true;\n };\n\n return ScaleRawExtentInfo;\n}();\n\nexport { ScaleRawExtentInfo };\nvar DETERMINED_MIN_MAX_ATTR = {\n min: '_determinedMin',\n max: '_determinedMax'\n};\nvar DATA_MIN_MAX_ATTR = {\n min: '_dataMin',\n max: '_dataMax'\n};\n/**\n * Get scale min max and related info only depends on model settings.\n * This method can be called after coordinate system created.\n * For example, in data processing stage.\n *\n * Scale extent info probably be required multiple times during a workflow.\n * For example:\n * (1) `dataZoom` depends it to get the axis extent in \"100%\" state.\n * (2) `processor/extentCalculator` depends it to make sure whether axis extent is specified.\n * (3) `coordSys.update` use it to finally decide the scale extent.\n * But the callback of `min`/`max` should not be called multiple times.\n * The code below should not be implemented repeatedly either.\n * So we cache the result in the scale instance, which will be recreated at the begining\n * of the workflow (because `scale` instance will be recreated each round of the workflow).\n */\n\nexport function ensureScaleRawExtentInfo(scale, model, // Usually: data extent from all series on this axis.\noriginalExtent) {\n // Do not permit to recreate.\n var rawExtentInfo = scale.rawExtentInfo;\n\n if (rawExtentInfo) {\n return rawExtentInfo;\n }\n\n rawExtentInfo = new ScaleRawExtentInfo(scale, model, originalExtent); // @ts-ignore\n\n scale.rawExtentInfo = rawExtentInfo;\n return rawExtentInfo;\n}\nexport function parseAxisModelMinMax(scale, minMax) {\n return minMax == null ? null : eqNaN(minMax) ? NaN : scale.parse(minMax);\n}","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport * as zrUtil from 'zrender/lib/core/util.js';\nimport OrdinalScale from '../scale/Ordinal.js';\nimport IntervalScale from '../scale/Interval.js';\nimport Scale from '../scale/Scale.js';\nimport { prepareLayoutBarSeries, makeColumnLayout, retrieveColumnLayout } from '../layout/barGrid.js';\nimport BoundingRect from 'zrender/lib/core/BoundingRect.js';\nimport TimeScale from '../scale/Time.js';\nimport LogScale from '../scale/Log.js';\nimport { getStackedDimension } from '../data/helper/dataStackHelper.js';\nimport { ensureScaleRawExtentInfo } from './scaleRawExtentInfo.js';\n/**\n * Get axis scale extent before niced.\n * Item of returned array can only be number (including Infinity and NaN).\n *\n * Caution:\n * Precondition of calling this method:\n * The scale extent has been initialized using series data extent via\n * `scale.setExtent` or `scale.unionExtentFromData`;\n */\n\nexport function getScaleExtent(scale, model) {\n var scaleType = scale.type;\n var rawExtentResult = ensureScaleRawExtentInfo(scale, model, scale.getExtent()).calculate();\n scale.setBlank(rawExtentResult.isBlank);\n var min = rawExtentResult.min;\n var max = rawExtentResult.max; // If bars are placed on a base axis of type time or interval account for axis boundary overflow and current axis\n // is base axis\n // FIXME\n // (1) Consider support value axis, where below zero and axis `onZero` should be handled properly.\n // (2) Refactor the logic with `barGrid`. Is it not need to `makeBarWidthAndOffsetInfo` twice with different extent?\n // Should not depend on series type `bar`?\n // (3) Fix that might overlap when using dataZoom.\n // (4) Consider other chart types using `barGrid`?\n // See #6728, #4862, `test/bar-overflow-time-plot.html`\n\n var ecModel = model.ecModel;\n\n if (ecModel && scaleType === 'time'\n /*|| scaleType === 'interval' */\n ) {\n var barSeriesModels = prepareLayoutBarSeries('bar', ecModel);\n var isBaseAxisAndHasBarSeries_1 = false;\n zrUtil.each(barSeriesModels, function (seriesModel) {\n isBaseAxisAndHasBarSeries_1 = isBaseAxisAndHasBarSeries_1 || seriesModel.getBaseAxis() === model.axis;\n });\n\n if (isBaseAxisAndHasBarSeries_1) {\n // Calculate placement of bars on axis. TODO should be decoupled\n // with barLayout\n var barWidthAndOffset = makeColumnLayout(barSeriesModels); // Adjust axis min and max to account for overflow\n\n var adjustedScale = adjustScaleForOverflow(min, max, model, barWidthAndOffset);\n min = adjustedScale.min;\n max = adjustedScale.max;\n }\n }\n\n return {\n extent: [min, max],\n // \"fix\" means \"fixed\", the value should not be\n // changed in the subsequent steps.\n fixMin: rawExtentResult.minFixed,\n fixMax: rawExtentResult.maxFixed\n };\n}\n\nfunction adjustScaleForOverflow(min, max, model, // Only support cartesian coord yet.\nbarWidthAndOffset) {\n // Get Axis Length\n var axisExtent = model.axis.getExtent();\n var axisLength = axisExtent[1] - axisExtent[0]; // Get bars on current base axis and calculate min and max overflow\n\n var barsOnCurrentAxis = retrieveColumnLayout(barWidthAndOffset, model.axis);\n\n if (barsOnCurrentAxis === undefined) {\n return {\n min: min,\n max: max\n };\n }\n\n var minOverflow = Infinity;\n zrUtil.each(barsOnCurrentAxis, function (item) {\n minOverflow = Math.min(item.offset, minOverflow);\n });\n var maxOverflow = -Infinity;\n zrUtil.each(barsOnCurrentAxis, function (item) {\n maxOverflow = Math.max(item.offset + item.width, maxOverflow);\n });\n minOverflow = Math.abs(minOverflow);\n maxOverflow = Math.abs(maxOverflow);\n var totalOverFlow = minOverflow + maxOverflow; // Calculate required buffer based on old range and overflow\n\n var oldRange = max - min;\n var oldRangePercentOfNew = 1 - (minOverflow + maxOverflow) / axisLength;\n var overflowBuffer = oldRange / oldRangePercentOfNew - oldRange;\n max += overflowBuffer * (maxOverflow / totalOverFlow);\n min -= overflowBuffer * (minOverflow / totalOverFlow);\n return {\n min: min,\n max: max\n };\n} // Precondition of calling this method:\n// The scale extent has been initailized using series data extent via\n// `scale.setExtent` or `scale.unionExtentFromData`;\n\n\nexport function niceScaleExtent(scale, inModel) {\n var model = inModel;\n var extentInfo = getScaleExtent(scale, model);\n var extent = extentInfo.extent;\n var splitNumber = model.get('splitNumber');\n\n if (scale instanceof LogScale) {\n scale.base = model.get('logBase');\n }\n\n var scaleType = scale.type;\n var interval = model.get('interval');\n var isIntervalOrTime = scaleType === 'interval' || scaleType === 'time';\n scale.setExtent(extent[0], extent[1]);\n scale.calcNiceExtent({\n splitNumber: splitNumber,\n fixMin: extentInfo.fixMin,\n fixMax: extentInfo.fixMax,\n minInterval: isIntervalOrTime ? model.get('minInterval') : null,\n maxInterval: isIntervalOrTime ? model.get('maxInterval') : null\n }); // If some one specified the min, max. And the default calculated interval\n // is not good enough. He can specify the interval. It is often appeared\n // in angle axis with angle 0 - 360. Interval calculated in interval scale is hard\n // to be 60.\n // FIXME\n\n if (interval != null) {\n scale.setInterval && scale.setInterval(interval);\n }\n}\n/**\n * @param axisType Default retrieve from model.type\n */\n\nexport function createScaleByModel(model, axisType) {\n axisType = axisType || model.get('type');\n\n if (axisType) {\n switch (axisType) {\n // Buildin scale\n case 'category':\n return new OrdinalScale({\n ordinalMeta: model.getOrdinalMeta ? model.getOrdinalMeta() : model.getCategories(),\n extent: [Infinity, -Infinity]\n });\n\n case 'time':\n return new TimeScale({\n locale: model.ecModel.getLocaleModel(),\n useUTC: model.ecModel.get('useUTC')\n });\n\n default:\n // case 'value'/'interval', 'log', or others.\n return new (Scale.getClass(axisType) || IntervalScale)();\n }\n }\n}\n/**\n * Check if the axis cross 0\n */\n\nexport function ifAxisCrossZero(axis) {\n var dataExtent = axis.scale.getExtent();\n var min = dataExtent[0];\n var max = dataExtent[1];\n return !(min > 0 && max > 0 || min < 0 && max < 0);\n}\n/**\n * @param axis\n * @return Label formatter function.\n * param: {number} tickValue,\n * param: {number} idx, the index in all ticks.\n * If category axis, this param is not required.\n * return: {string} label string.\n */\n\nexport function makeLabelFormatter(axis) {\n var labelFormatter = axis.getLabelModel().get('formatter');\n var categoryTickStart = axis.type === 'category' ? axis.scale.getExtent()[0] : null;\n\n if (axis.scale.type === 'time') {\n return function (tpl) {\n return function (tick, idx) {\n return axis.scale.getFormattedLabel(tick, idx, tpl);\n };\n }(labelFormatter);\n } else if (zrUtil.isString(labelFormatter)) {\n return function (tpl) {\n return function (tick) {\n // For category axis, get raw value; for numeric axis,\n // get formatted label like '1,333,444'.\n var label = axis.scale.getLabel(tick);\n var text = tpl.replace('{value}', label != null ? label : '');\n return text;\n };\n }(labelFormatter);\n } else if (zrUtil.isFunction(labelFormatter)) {\n return function (cb) {\n return function (tick, idx) {\n // The original intention of `idx` is \"the index of the tick in all ticks\".\n // But the previous implementation of category axis do not consider the\n // `axisLabel.interval`, which cause that, for example, the `interval` is\n // `1`, then the ticks \"name5\", \"name7\", \"name9\" are displayed, where the\n // corresponding `idx` are `0`, `2`, `4`, but not `0`, `1`, `2`. So we keep\n // the definition here for back compatibility.\n if (categoryTickStart != null) {\n idx = tick.value - categoryTickStart;\n }\n\n return cb(getAxisRawValue(axis, tick), idx, tick.level != null ? {\n level: tick.level\n } : null);\n };\n }(labelFormatter);\n } else {\n return function (tick) {\n return axis.scale.getLabel(tick);\n };\n }\n}\nexport function getAxisRawValue(axis, tick) {\n // In category axis with data zoom, tick is not the original\n // index of axis.data. So tick should not be exposed to user\n // in category axis.\n return axis.type === 'category' ? axis.scale.getLabel(tick) : tick.value;\n}\n/**\n * @param axis\n * @return Be null/undefined if no labels.\n */\n\nexport function estimateLabelUnionRect(axis) {\n var axisModel = axis.model;\n var scale = axis.scale;\n\n if (!axisModel.get(['axisLabel', 'show']) || scale.isBlank()) {\n return;\n }\n\n var realNumberScaleTicks;\n var tickCount;\n var categoryScaleExtent = scale.getExtent(); // Optimize for large category data, avoid call `getTicks()`.\n\n if (scale instanceof OrdinalScale) {\n tickCount = scale.count();\n } else {\n realNumberScaleTicks = scale.getTicks();\n tickCount = realNumberScaleTicks.length;\n }\n\n var axisLabelModel = axis.getLabelModel();\n var labelFormatter = makeLabelFormatter(axis);\n var rect;\n var step = 1; // Simple optimization for large amount of labels\n\n if (tickCount > 40) {\n step = Math.ceil(tickCount / 40);\n }\n\n for (var i = 0; i < tickCount; i += step) {\n var tick = realNumberScaleTicks ? realNumberScaleTicks[i] : {\n value: categoryScaleExtent[0] + i\n };\n var label = labelFormatter(tick, i);\n var unrotatedSingleRect = axisLabelModel.getTextRect(label);\n var singleRect = rotateTextRect(unrotatedSingleRect, axisLabelModel.get('rotate') || 0);\n rect ? rect.union(singleRect) : rect = singleRect;\n }\n\n return rect;\n}\n\nfunction rotateTextRect(textRect, rotate) {\n var rotateRadians = rotate * Math.PI / 180;\n var beforeWidth = textRect.width;\n var beforeHeight = textRect.height;\n var afterWidth = beforeWidth * Math.abs(Math.cos(rotateRadians)) + Math.abs(beforeHeight * Math.sin(rotateRadians));\n var afterHeight = beforeWidth * Math.abs(Math.sin(rotateRadians)) + Math.abs(beforeHeight * Math.cos(rotateRadians));\n var rotatedRect = new BoundingRect(textRect.x, textRect.y, afterWidth, afterHeight);\n return rotatedRect;\n}\n/**\n * @param model axisLabelModel or axisTickModel\n * @return {number|String} Can be null|'auto'|number|function\n */\n\n\nexport function getOptionCategoryInterval(model) {\n var interval = model.get('interval');\n return interval == null ? 'auto' : interval;\n}\n/**\n * Set `categoryInterval` as 0 implicitly indicates that\n * show all labels reguardless of overlap.\n * @param {Object} axis axisModel.axis\n */\n\nexport function shouldShowAllLabels(axis) {\n return axis.type === 'category' && getOptionCategoryInterval(axis.getLabelModel()) === 0;\n}\nexport function getDataDimensionsOnAxis(data, axisDim) {\n // Remove duplicated dat dimensions caused by `getStackedDimension`.\n var dataDimMap = {}; // Currently `mapDimensionsAll` will contain stack result dimension ('__\\0ecstackresult').\n // PENDING: is it reasonable? Do we need to remove the original dim from \"coord dim\" since\n // there has been stacked result dim?\n\n zrUtil.each(data.mapDimensionsAll(axisDim), function (dataDim) {\n // For example, the extent of the original dimension\n // is [0.1, 0.5], the extent of the `stackResultDimension`\n // is [7, 9], the final extent should NOT include [0.1, 0.5],\n // because there is no graphic corresponding to [0.1, 0.5].\n // See the case in `test/area-stack.html` `main1`, where area line\n // stack needs `yAxis` not start from 0.\n dataDimMap[getStackedDimension(data, dataDim)] = true;\n });\n return zrUtil.keys(dataDimMap);\n}\nexport function unionAxisExtentFromData(dataExtent, data, axisDim) {\n if (data) {\n zrUtil.each(getDataDimensionsOnAxis(data, axisDim), function (dim) {\n var seriesExtent = data.getApproximateExtent(dim);\n seriesExtent[0] < dataExtent[0] && (dataExtent[0] = seriesExtent[0]);\n seriesExtent[1] > dataExtent[1] && (dataExtent[1] = seriesExtent[1]);\n });\n }\n}","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport * as zrUtil from 'zrender/lib/core/util.js';\n\nvar Cartesian =\n/** @class */\nfunction () {\n function Cartesian(name) {\n this.type = 'cartesian';\n this._dimList = [];\n this._axes = {};\n this.name = name || '';\n }\n\n Cartesian.prototype.getAxis = function (dim) {\n return this._axes[dim];\n };\n\n Cartesian.prototype.getAxes = function () {\n return zrUtil.map(this._dimList, function (dim) {\n return this._axes[dim];\n }, this);\n };\n\n Cartesian.prototype.getAxesByScale = function (scaleType) {\n scaleType = scaleType.toLowerCase();\n return zrUtil.filter(this.getAxes(), function (axis) {\n return axis.scale.type === scaleType;\n });\n };\n\n Cartesian.prototype.addAxis = function (axis) {\n var dim = axis.dim;\n this._axes[dim] = axis;\n\n this._dimList.push(dim);\n };\n\n return Cartesian;\n}();\n\n;\nexport default Cartesian;","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { __extends } from \"tslib\";\nimport BoundingRect from 'zrender/lib/core/BoundingRect.js';\nimport Cartesian from './Cartesian.js';\nimport { invert } from 'zrender/lib/core/matrix.js';\nimport { applyTransform } from 'zrender/lib/core/vector.js';\nexport var cartesian2DDimensions = ['x', 'y'];\n\nfunction canCalculateAffineTransform(scale) {\n return scale.type === 'interval' || scale.type === 'time';\n}\n\nvar Cartesian2D =\n/** @class */\nfunction (_super) {\n __extends(Cartesian2D, _super);\n\n function Cartesian2D() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n\n _this.type = 'cartesian2d';\n _this.dimensions = cartesian2DDimensions;\n return _this;\n }\n /**\n * Calculate an affine transform matrix if two axes are time or value.\n * It's mainly for accelartion on the large time series data.\n */\n\n\n Cartesian2D.prototype.calcAffineTransform = function () {\n this._transform = this._invTransform = null;\n var xAxisScale = this.getAxis('x').scale;\n var yAxisScale = this.getAxis('y').scale;\n\n if (!canCalculateAffineTransform(xAxisScale) || !canCalculateAffineTransform(yAxisScale)) {\n return;\n }\n\n var xScaleExtent = xAxisScale.getExtent();\n var yScaleExtent = yAxisScale.getExtent();\n var start = this.dataToPoint([xScaleExtent[0], yScaleExtent[0]]);\n var end = this.dataToPoint([xScaleExtent[1], yScaleExtent[1]]);\n var xScaleSpan = xScaleExtent[1] - xScaleExtent[0];\n var yScaleSpan = yScaleExtent[1] - yScaleExtent[0];\n\n if (!xScaleSpan || !yScaleSpan) {\n return;\n } // Accelerate data to point calculation on the special large time series data.\n\n\n var scaleX = (end[0] - start[0]) / xScaleSpan;\n var scaleY = (end[1] - start[1]) / yScaleSpan;\n var translateX = start[0] - xScaleExtent[0] * scaleX;\n var translateY = start[1] - yScaleExtent[0] * scaleY;\n var m = this._transform = [scaleX, 0, 0, scaleY, translateX, translateY];\n this._invTransform = invert([], m);\n };\n /**\n * Base axis will be used on stacking.\n */\n\n\n Cartesian2D.prototype.getBaseAxis = function () {\n return this.getAxesByScale('ordinal')[0] || this.getAxesByScale('time')[0] || this.getAxis('x');\n };\n\n Cartesian2D.prototype.containPoint = function (point) {\n var axisX = this.getAxis('x');\n var axisY = this.getAxis('y');\n return axisX.contain(axisX.toLocalCoord(point[0])) && axisY.contain(axisY.toLocalCoord(point[1]));\n };\n\n Cartesian2D.prototype.containData = function (data) {\n return this.getAxis('x').containData(data[0]) && this.getAxis('y').containData(data[1]);\n };\n\n Cartesian2D.prototype.dataToPoint = function (data, clamp, out) {\n out = out || [];\n var xVal = data[0];\n var yVal = data[1]; // Fast path\n\n if (this._transform // It's supported that if data is like `[Inifity, 123]`, where only Y pixel calculated.\n && xVal != null && isFinite(xVal) && yVal != null && isFinite(yVal)) {\n return applyTransform(out, data, this._transform);\n }\n\n var xAxis = this.getAxis('x');\n var yAxis = this.getAxis('y');\n out[0] = xAxis.toGlobalCoord(xAxis.dataToCoord(xVal, clamp));\n out[1] = yAxis.toGlobalCoord(yAxis.dataToCoord(yVal, clamp));\n return out;\n };\n\n Cartesian2D.prototype.clampData = function (data, out) {\n var xScale = this.getAxis('x').scale;\n var yScale = this.getAxis('y').scale;\n var xAxisExtent = xScale.getExtent();\n var yAxisExtent = yScale.getExtent();\n var x = xScale.parse(data[0]);\n var y = yScale.parse(data[1]);\n out = out || [];\n out[0] = Math.min(Math.max(Math.min(xAxisExtent[0], xAxisExtent[1]), x), Math.max(xAxisExtent[0], xAxisExtent[1]));\n out[1] = Math.min(Math.max(Math.min(yAxisExtent[0], yAxisExtent[1]), y), Math.max(yAxisExtent[0], yAxisExtent[1]));\n return out;\n };\n\n Cartesian2D.prototype.pointToData = function (point, clamp) {\n var out = [];\n\n if (this._invTransform) {\n return applyTransform(out, point, this._invTransform);\n }\n\n var xAxis = this.getAxis('x');\n var yAxis = this.getAxis('y');\n out[0] = xAxis.coordToData(xAxis.toLocalCoord(point[0]), clamp);\n out[1] = yAxis.coordToData(yAxis.toLocalCoord(point[1]), clamp);\n return out;\n };\n\n Cartesian2D.prototype.getOtherAxis = function (axis) {\n return this.getAxis(axis.dim === 'x' ? 'y' : 'x');\n };\n /**\n * Get rect area of cartesian.\n * Area will have a contain function to determine if a point is in the coordinate system.\n */\n\n\n Cartesian2D.prototype.getArea = function () {\n var xExtent = this.getAxis('x').getGlobalExtent();\n var yExtent = this.getAxis('y').getGlobalExtent();\n var x = Math.min(xExtent[0], xExtent[1]);\n var y = Math.min(yExtent[0], yExtent[1]);\n var width = Math.max(xExtent[0], xExtent[1]) - x;\n var height = Math.max(yExtent[0], yExtent[1]) - y;\n return new BoundingRect(x, y, width, height);\n };\n\n return Cartesian2D;\n}(Cartesian);\n\n;\nexport default Cartesian2D;","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport * as zrUtil from 'zrender/lib/core/util.js';\nimport * as textContain from 'zrender/lib/contain/text.js';\nimport { makeInner } from '../util/model.js';\nimport { makeLabelFormatter, getOptionCategoryInterval, shouldShowAllLabels } from './axisHelper.js';\nvar inner = makeInner();\nexport function createAxisLabels(axis) {\n // Only ordinal scale support tick interval\n return axis.type === 'category' ? makeCategoryLabels(axis) : makeRealNumberLabels(axis);\n}\n/**\n * @param {module:echats/coord/Axis} axis\n * @param {module:echarts/model/Model} tickModel For example, can be axisTick, splitLine, splitArea.\n * @return {Object} {\n * ticks: Array.\n * tickCategoryInterval: number\n * }\n */\n\nexport function createAxisTicks(axis, tickModel) {\n // Only ordinal scale support tick interval\n return axis.type === 'category' ? makeCategoryTicks(axis, tickModel) : {\n ticks: zrUtil.map(axis.scale.getTicks(), function (tick) {\n return tick.value;\n })\n };\n}\n\nfunction makeCategoryLabels(axis) {\n var labelModel = axis.getLabelModel();\n var result = makeCategoryLabelsActually(axis, labelModel);\n return !labelModel.get('show') || axis.scale.isBlank() ? {\n labels: [],\n labelCategoryInterval: result.labelCategoryInterval\n } : result;\n}\n\nfunction makeCategoryLabelsActually(axis, labelModel) {\n var labelsCache = getListCache(axis, 'labels');\n var optionLabelInterval = getOptionCategoryInterval(labelModel);\n var result = listCacheGet(labelsCache, optionLabelInterval);\n\n if (result) {\n return result;\n }\n\n var labels;\n var numericLabelInterval;\n\n if (zrUtil.isFunction(optionLabelInterval)) {\n labels = makeLabelsByCustomizedCategoryInterval(axis, optionLabelInterval);\n } else {\n numericLabelInterval = optionLabelInterval === 'auto' ? makeAutoCategoryInterval(axis) : optionLabelInterval;\n labels = makeLabelsByNumericCategoryInterval(axis, numericLabelInterval);\n } // Cache to avoid calling interval function repeatly.\n\n\n return listCacheSet(labelsCache, optionLabelInterval, {\n labels: labels,\n labelCategoryInterval: numericLabelInterval\n });\n}\n\nfunction makeCategoryTicks(axis, tickModel) {\n var ticksCache = getListCache(axis, 'ticks');\n var optionTickInterval = getOptionCategoryInterval(tickModel);\n var result = listCacheGet(ticksCache, optionTickInterval);\n\n if (result) {\n return result;\n }\n\n var ticks;\n var tickCategoryInterval; // Optimize for the case that large category data and no label displayed,\n // we should not return all ticks.\n\n if (!tickModel.get('show') || axis.scale.isBlank()) {\n ticks = [];\n }\n\n if (zrUtil.isFunction(optionTickInterval)) {\n ticks = makeLabelsByCustomizedCategoryInterval(axis, optionTickInterval, true);\n } // Always use label interval by default despite label show. Consider this\n // scenario, Use multiple grid with the xAxis sync, and only one xAxis shows\n // labels. `splitLine` and `axisTick` should be consistent in this case.\n else if (optionTickInterval === 'auto') {\n var labelsResult = makeCategoryLabelsActually(axis, axis.getLabelModel());\n tickCategoryInterval = labelsResult.labelCategoryInterval;\n ticks = zrUtil.map(labelsResult.labels, function (labelItem) {\n return labelItem.tickValue;\n });\n } else {\n tickCategoryInterval = optionTickInterval;\n ticks = makeLabelsByNumericCategoryInterval(axis, tickCategoryInterval, true);\n } // Cache to avoid calling interval function repeatly.\n\n\n return listCacheSet(ticksCache, optionTickInterval, {\n ticks: ticks,\n tickCategoryInterval: tickCategoryInterval\n });\n}\n\nfunction makeRealNumberLabels(axis) {\n var ticks = axis.scale.getTicks();\n var labelFormatter = makeLabelFormatter(axis);\n return {\n labels: zrUtil.map(ticks, function (tick, idx) {\n return {\n level: tick.level,\n formattedLabel: labelFormatter(tick, idx),\n rawLabel: axis.scale.getLabel(tick),\n tickValue: tick.value\n };\n })\n };\n}\n\nfunction getListCache(axis, prop) {\n // Because key can be funciton, and cache size always be small, we use array cache.\n return inner(axis)[prop] || (inner(axis)[prop] = []);\n}\n\nfunction listCacheGet(cache, key) {\n for (var i = 0; i < cache.length; i++) {\n if (cache[i].key === key) {\n return cache[i].value;\n }\n }\n}\n\nfunction listCacheSet(cache, key, value) {\n cache.push({\n key: key,\n value: value\n });\n return value;\n}\n\nfunction makeAutoCategoryInterval(axis) {\n var result = inner(axis).autoInterval;\n return result != null ? result : inner(axis).autoInterval = axis.calculateCategoryInterval();\n}\n/**\n * Calculate interval for category axis ticks and labels.\n * To get precise result, at least one of `getRotate` and `isHorizontal`\n * should be implemented in axis.\n */\n\n\nexport function calculateCategoryInterval(axis) {\n var params = fetchAutoCategoryIntervalCalculationParams(axis);\n var labelFormatter = makeLabelFormatter(axis);\n var rotation = (params.axisRotate - params.labelRotate) / 180 * Math.PI;\n var ordinalScale = axis.scale;\n var ordinalExtent = ordinalScale.getExtent(); // Providing this method is for optimization:\n // avoid generating a long array by `getTicks`\n // in large category data case.\n\n var tickCount = ordinalScale.count();\n\n if (ordinalExtent[1] - ordinalExtent[0] < 1) {\n return 0;\n }\n\n var step = 1; // Simple optimization. Empirical value: tick count should less than 40.\n\n if (tickCount > 40) {\n step = Math.max(1, Math.floor(tickCount / 40));\n }\n\n var tickValue = ordinalExtent[0];\n var unitSpan = axis.dataToCoord(tickValue + 1) - axis.dataToCoord(tickValue);\n var unitW = Math.abs(unitSpan * Math.cos(rotation));\n var unitH = Math.abs(unitSpan * Math.sin(rotation));\n var maxW = 0;\n var maxH = 0; // Caution: Performance sensitive for large category data.\n // Consider dataZoom, we should make appropriate step to avoid O(n) loop.\n\n for (; tickValue <= ordinalExtent[1]; tickValue += step) {\n var width = 0;\n var height = 0; // Not precise, do not consider align and vertical align\n // and each distance from axis line yet.\n\n var rect = textContain.getBoundingRect(labelFormatter({\n value: tickValue\n }), params.font, 'center', 'top'); // Magic number\n\n width = rect.width * 1.3;\n height = rect.height * 1.3; // Min size, void long loop.\n\n maxW = Math.max(maxW, width, 7);\n maxH = Math.max(maxH, height, 7);\n }\n\n var dw = maxW / unitW;\n var dh = maxH / unitH; // 0/0 is NaN, 1/0 is Infinity.\n\n isNaN(dw) && (dw = Infinity);\n isNaN(dh) && (dh = Infinity);\n var interval = Math.max(0, Math.floor(Math.min(dw, dh)));\n var cache = inner(axis.model);\n var axisExtent = axis.getExtent();\n var lastAutoInterval = cache.lastAutoInterval;\n var lastTickCount = cache.lastTickCount; // Use cache to keep interval stable while moving zoom window,\n // otherwise the calculated interval might jitter when the zoom\n // window size is close to the interval-changing size.\n // For example, if all of the axis labels are `a, b, c, d, e, f, g`.\n // The jitter will cause that sometimes the displayed labels are\n // `a, d, g` (interval: 2) sometimes `a, c, e`(interval: 1).\n\n if (lastAutoInterval != null && lastTickCount != null && Math.abs(lastAutoInterval - interval) <= 1 && Math.abs(lastTickCount - tickCount) <= 1 // Always choose the bigger one, otherwise the critical\n // point is not the same when zooming in or zooming out.\n && lastAutoInterval > interval // If the axis change is caused by chart resize, the cache should not\n // be used. Otherwise some hiden labels might not be shown again.\n && cache.axisExtent0 === axisExtent[0] && cache.axisExtent1 === axisExtent[1]) {\n interval = lastAutoInterval;\n } // Only update cache if cache not used, otherwise the\n // changing of interval is too insensitive.\n else {\n cache.lastTickCount = tickCount;\n cache.lastAutoInterval = interval;\n cache.axisExtent0 = axisExtent[0];\n cache.axisExtent1 = axisExtent[1];\n }\n\n return interval;\n}\n\nfunction fetchAutoCategoryIntervalCalculationParams(axis) {\n var labelModel = axis.getLabelModel();\n return {\n axisRotate: axis.getRotate ? axis.getRotate() : axis.isHorizontal && !axis.isHorizontal() ? 90 : 0,\n labelRotate: labelModel.get('rotate') || 0,\n font: labelModel.getFont()\n };\n}\n\nfunction makeLabelsByNumericCategoryInterval(axis, categoryInterval, onlyTick) {\n var labelFormatter = makeLabelFormatter(axis);\n var ordinalScale = axis.scale;\n var ordinalExtent = ordinalScale.getExtent();\n var labelModel = axis.getLabelModel();\n var result = []; // TODO: axisType: ordinalTime, pick the tick from each month/day/year/...\n\n var step = Math.max((categoryInterval || 0) + 1, 1);\n var startTick = ordinalExtent[0];\n var tickCount = ordinalScale.count(); // Calculate start tick based on zero if possible to keep label consistent\n // while zooming and moving while interval > 0. Otherwise the selection\n // of displayable ticks and symbols probably keep changing.\n // 3 is empirical value.\n\n if (startTick !== 0 && step > 1 && tickCount / step > 2) {\n startTick = Math.round(Math.ceil(startTick / step) * step);\n } // (1) Only add min max label here but leave overlap checking\n // to render stage, which also ensure the returned list\n // suitable for splitLine and splitArea rendering.\n // (2) Scales except category always contain min max label so\n // do not need to perform this process.\n\n\n var showAllLabel = shouldShowAllLabels(axis);\n var includeMinLabel = labelModel.get('showMinLabel') || showAllLabel;\n var includeMaxLabel = labelModel.get('showMaxLabel') || showAllLabel;\n\n if (includeMinLabel && startTick !== ordinalExtent[0]) {\n addItem(ordinalExtent[0]);\n } // Optimize: avoid generating large array by `ordinalScale.getTicks()`.\n\n\n var tickValue = startTick;\n\n for (; tickValue <= ordinalExtent[1]; tickValue += step) {\n addItem(tickValue);\n }\n\n if (includeMaxLabel && tickValue - step !== ordinalExtent[1]) {\n addItem(ordinalExtent[1]);\n }\n\n function addItem(tickValue) {\n var tickObj = {\n value: tickValue\n };\n result.push(onlyTick ? tickValue : {\n formattedLabel: labelFormatter(tickObj),\n rawLabel: ordinalScale.getLabel(tickObj),\n tickValue: tickValue\n });\n }\n\n return result;\n}\n\nfunction makeLabelsByCustomizedCategoryInterval(axis, categoryInterval, onlyTick) {\n var ordinalScale = axis.scale;\n var labelFormatter = makeLabelFormatter(axis);\n var result = [];\n zrUtil.each(ordinalScale.getTicks(), function (tick) {\n var rawLabel = ordinalScale.getLabel(tick);\n var tickValue = tick.value;\n\n if (categoryInterval(tick.value, rawLabel)) {\n result.push(onlyTick ? tickValue : {\n formattedLabel: labelFormatter(tick),\n rawLabel: rawLabel,\n tickValue: tickValue\n });\n }\n });\n return result;\n}","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { each, map } from 'zrender/lib/core/util.js';\nimport { linearMap, getPixelPrecision, round } from '../util/number.js';\nimport { createAxisTicks, createAxisLabels, calculateCategoryInterval } from './axisTickLabelBuilder.js';\nvar NORMALIZED_EXTENT = [0, 1];\n/**\n * Base class of Axis.\n */\n\nvar Axis =\n/** @class */\nfunction () {\n function Axis(dim, scale, extent) {\n this.onBand = false;\n this.inverse = false;\n this.dim = dim;\n this.scale = scale;\n this._extent = extent || [0, 0];\n }\n /**\n * If axis extent contain given coord\n */\n\n\n Axis.prototype.contain = function (coord) {\n var extent = this._extent;\n var min = Math.min(extent[0], extent[1]);\n var max = Math.max(extent[0], extent[1]);\n return coord >= min && coord <= max;\n };\n /**\n * If axis extent contain given data\n */\n\n\n Axis.prototype.containData = function (data) {\n return this.scale.contain(data);\n };\n /**\n * Get coord extent.\n */\n\n\n Axis.prototype.getExtent = function () {\n return this._extent.slice();\n };\n /**\n * Get precision used for formatting\n */\n\n\n Axis.prototype.getPixelPrecision = function (dataExtent) {\n return getPixelPrecision(dataExtent || this.scale.getExtent(), this._extent);\n };\n /**\n * Set coord extent\n */\n\n\n Axis.prototype.setExtent = function (start, end) {\n var extent = this._extent;\n extent[0] = start;\n extent[1] = end;\n };\n /**\n * Convert data to coord. Data is the rank if it has an ordinal scale\n */\n\n\n Axis.prototype.dataToCoord = function (data, clamp) {\n var extent = this._extent;\n var scale = this.scale;\n data = scale.normalize(data);\n\n if (this.onBand && scale.type === 'ordinal') {\n extent = extent.slice();\n fixExtentWithBands(extent, scale.count());\n }\n\n return linearMap(data, NORMALIZED_EXTENT, extent, clamp);\n };\n /**\n * Convert coord to data. Data is the rank if it has an ordinal scale\n */\n\n\n Axis.prototype.coordToData = function (coord, clamp) {\n var extent = this._extent;\n var scale = this.scale;\n\n if (this.onBand && scale.type === 'ordinal') {\n extent = extent.slice();\n fixExtentWithBands(extent, scale.count());\n }\n\n var t = linearMap(coord, extent, NORMALIZED_EXTENT, clamp);\n return this.scale.scale(t);\n };\n /**\n * Convert pixel point to data in axis\n */\n\n\n Axis.prototype.pointToData = function (point, clamp) {\n // Should be implemented in derived class if necessary.\n return;\n };\n /**\n * Different from `zrUtil.map(axis.getTicks(), axis.dataToCoord, axis)`,\n * `axis.getTicksCoords` considers `onBand`, which is used by\n * `boundaryGap:true` of category axis and splitLine and splitArea.\n * @param opt.tickModel default: axis.model.getModel('axisTick')\n * @param opt.clamp If `true`, the first and the last\n * tick must be at the axis end points. Otherwise, clip ticks\n * that outside the axis extent.\n */\n\n\n Axis.prototype.getTicksCoords = function (opt) {\n opt = opt || {};\n var tickModel = opt.tickModel || this.getTickModel();\n var result = createAxisTicks(this, tickModel);\n var ticks = result.ticks;\n var ticksCoords = map(ticks, function (tickVal) {\n return {\n coord: this.dataToCoord(this.scale.type === 'ordinal' ? this.scale.getRawOrdinalNumber(tickVal) : tickVal),\n tickValue: tickVal\n };\n }, this);\n var alignWithLabel = tickModel.get('alignWithLabel');\n fixOnBandTicksCoords(this, ticksCoords, alignWithLabel, opt.clamp);\n return ticksCoords;\n };\n\n Axis.prototype.getMinorTicksCoords = function () {\n if (this.scale.type === 'ordinal') {\n // Category axis doesn't support minor ticks\n return [];\n }\n\n var minorTickModel = this.model.getModel('minorTick');\n var splitNumber = minorTickModel.get('splitNumber'); // Protection.\n\n if (!(splitNumber > 0 && splitNumber < 100)) {\n splitNumber = 5;\n }\n\n var minorTicks = this.scale.getMinorTicks(splitNumber);\n var minorTicksCoords = map(minorTicks, function (minorTicksGroup) {\n return map(minorTicksGroup, function (minorTick) {\n return {\n coord: this.dataToCoord(minorTick),\n tickValue: minorTick\n };\n }, this);\n }, this);\n return minorTicksCoords;\n };\n\n Axis.prototype.getViewLabels = function () {\n return createAxisLabels(this).labels;\n };\n\n Axis.prototype.getLabelModel = function () {\n return this.model.getModel('axisLabel');\n };\n /**\n * Notice here we only get the default tick model. For splitLine\n * or splitArea, we should pass the splitLineModel or splitAreaModel\n * manually when calling `getTicksCoords`.\n * In GL, this method may be overrided to:\n * `axisModel.getModel('axisTick', grid3DModel.getModel('axisTick'));`\n */\n\n\n Axis.prototype.getTickModel = function () {\n return this.model.getModel('axisTick');\n };\n /**\n * Get width of band\n */\n\n\n Axis.prototype.getBandWidth = function () {\n var axisExtent = this._extent;\n var dataExtent = this.scale.getExtent();\n var len = dataExtent[1] - dataExtent[0] + (this.onBand ? 1 : 0); // Fix #2728, avoid NaN when only one data.\n\n len === 0 && (len = 1);\n var size = Math.abs(axisExtent[1] - axisExtent[0]);\n return Math.abs(size) / len;\n };\n /**\n * Only be called in category axis.\n * Can be overrided, consider other axes like in 3D.\n * @return Auto interval for cateogry axis tick and label\n */\n\n\n Axis.prototype.calculateCategoryInterval = function () {\n return calculateCategoryInterval(this);\n };\n\n return Axis;\n}();\n\nfunction fixExtentWithBands(extent, nTick) {\n var size = extent[1] - extent[0];\n var len = nTick;\n var margin = size / len / 2;\n extent[0] += margin;\n extent[1] -= margin;\n} // If axis has labels [1, 2, 3, 4]. Bands on the axis are\n// |---1---|---2---|---3---|---4---|.\n// So the displayed ticks and splitLine/splitArea should between\n// each data item, otherwise cause misleading (e.g., split tow bars\n// of a single data item when there are two bar series).\n// Also consider if tickCategoryInterval > 0 and onBand, ticks and\n// splitLine/spliteArea should layout appropriately corresponding\n// to displayed labels. (So we should not use `getBandWidth` in this\n// case).\n\n\nfunction fixOnBandTicksCoords(axis, ticksCoords, alignWithLabel, clamp) {\n var ticksLen = ticksCoords.length;\n\n if (!axis.onBand || alignWithLabel || !ticksLen) {\n return;\n }\n\n var axisExtent = axis.getExtent();\n var last;\n var diffSize;\n\n if (ticksLen === 1) {\n ticksCoords[0].coord = axisExtent[0];\n last = ticksCoords[1] = {\n coord: axisExtent[0]\n };\n } else {\n var crossLen = ticksCoords[ticksLen - 1].tickValue - ticksCoords[0].tickValue;\n var shift_1 = (ticksCoords[ticksLen - 1].coord - ticksCoords[0].coord) / crossLen;\n each(ticksCoords, function (ticksItem) {\n ticksItem.coord -= shift_1 / 2;\n });\n var dataExtent = axis.scale.getExtent();\n diffSize = 1 + dataExtent[1] - ticksCoords[ticksLen - 1].tickValue;\n last = {\n coord: ticksCoords[ticksLen - 1].coord + shift_1 * diffSize\n };\n ticksCoords.push(last);\n }\n\n var inverse = axisExtent[0] > axisExtent[1]; // Handling clamp.\n\n if (littleThan(ticksCoords[0].coord, axisExtent[0])) {\n clamp ? ticksCoords[0].coord = axisExtent[0] : ticksCoords.shift();\n }\n\n if (clamp && littleThan(axisExtent[0], ticksCoords[0].coord)) {\n ticksCoords.unshift({\n coord: axisExtent[0]\n });\n }\n\n if (littleThan(axisExtent[1], last.coord)) {\n clamp ? last.coord = axisExtent[1] : ticksCoords.pop();\n }\n\n if (clamp && littleThan(last.coord, axisExtent[1])) {\n ticksCoords.push({\n coord: axisExtent[1]\n });\n }\n\n function littleThan(a, b) {\n // Avoid rounding error cause calculated tick coord different with extent.\n // It may cause an extra unecessary tick added.\n a = round(a);\n b = round(b);\n return inverse ? a > b : a < b;\n }\n}\n\nexport default Axis;","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { __extends } from \"tslib\";\nimport Axis from '../Axis.js';\n\nvar Axis2D =\n/** @class */\nfunction (_super) {\n __extends(Axis2D, _super);\n\n function Axis2D(dim, scale, coordExtent, axisType, position) {\n var _this = _super.call(this, dim, scale, coordExtent) || this;\n /**\n * Index of axis, can be used as key\n * Injected outside.\n */\n\n\n _this.index = 0;\n _this.type = axisType || 'value';\n _this.position = position || 'bottom';\n return _this;\n }\n\n Axis2D.prototype.isHorizontal = function () {\n var position = this.position;\n return position === 'top' || position === 'bottom';\n };\n /**\n * Each item cooresponds to this.getExtent(), which\n * means globalExtent[0] may greater than globalExtent[1],\n * unless `asc` is input.\n *\n * @param {boolean} [asc]\n * @return {Array.}\n */\n\n\n Axis2D.prototype.getGlobalExtent = function (asc) {\n var ret = this.getExtent();\n ret[0] = this.toGlobalCoord(ret[0]);\n ret[1] = this.toGlobalCoord(ret[1]);\n asc && ret[0] > ret[1] && ret.reverse();\n return ret;\n };\n\n Axis2D.prototype.pointToData = function (point, clamp) {\n return this.coordToData(this.toLocalCoord(point[this.dim === 'x' ? 0 : 1]), clamp);\n };\n /**\n * Set ordinalSortInfo\n * @param info new OrdinalSortInfo\n */\n\n\n Axis2D.prototype.setCategorySortInfo = function (info) {\n if (this.type !== 'category') {\n return false;\n }\n\n this.model.option.categorySortInfo = info;\n this.scale.setSortInfo(info);\n };\n\n return Axis2D;\n}(Axis);\n\nexport default Axis2D;","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport * as zrUtil from 'zrender/lib/core/util.js';\nimport { SINGLE_REFERRING } from '../../util/model.js';\n/**\n * Can only be called after coordinate system creation stage.\n * (Can be called before coordinate system update stage).\n */\n\nexport function layout(gridModel, axisModel, opt) {\n opt = opt || {};\n var grid = gridModel.coordinateSystem;\n var axis = axisModel.axis;\n var layout = {};\n var otherAxisOnZeroOf = axis.getAxesOnZeroOf()[0];\n var rawAxisPosition = axis.position;\n var axisPosition = otherAxisOnZeroOf ? 'onZero' : rawAxisPosition;\n var axisDim = axis.dim;\n var rect = grid.getRect();\n var rectBound = [rect.x, rect.x + rect.width, rect.y, rect.y + rect.height];\n var idx = {\n left: 0,\n right: 1,\n top: 0,\n bottom: 1,\n onZero: 2\n };\n var axisOffset = axisModel.get('offset') || 0;\n var posBound = axisDim === 'x' ? [rectBound[2] - axisOffset, rectBound[3] + axisOffset] : [rectBound[0] - axisOffset, rectBound[1] + axisOffset];\n\n if (otherAxisOnZeroOf) {\n var onZeroCoord = otherAxisOnZeroOf.toGlobalCoord(otherAxisOnZeroOf.dataToCoord(0));\n posBound[idx.onZero] = Math.max(Math.min(onZeroCoord, posBound[1]), posBound[0]);\n } // Axis position\n\n\n layout.position = [axisDim === 'y' ? posBound[idx[axisPosition]] : rectBound[0], axisDim === 'x' ? posBound[idx[axisPosition]] : rectBound[3]]; // Axis rotation\n\n layout.rotation = Math.PI / 2 * (axisDim === 'x' ? 0 : 1); // Tick and label direction, x y is axisDim\n\n var dirMap = {\n top: -1,\n bottom: 1,\n left: -1,\n right: 1\n };\n layout.labelDirection = layout.tickDirection = layout.nameDirection = dirMap[rawAxisPosition];\n layout.labelOffset = otherAxisOnZeroOf ? posBound[idx[rawAxisPosition]] - posBound[idx.onZero] : 0;\n\n if (axisModel.get(['axisTick', 'inside'])) {\n layout.tickDirection = -layout.tickDirection;\n }\n\n if (zrUtil.retrieve(opt.labelInside, axisModel.get(['axisLabel', 'inside']))) {\n layout.labelDirection = -layout.labelDirection;\n } // Special label rotation\n\n\n var labelRotate = axisModel.get(['axisLabel', 'rotate']);\n layout.labelRotate = axisPosition === 'top' ? -labelRotate : labelRotate; // Over splitLine and splitArea\n\n layout.z2 = 1;\n return layout;\n}\nexport function isCartesian2DSeries(seriesModel) {\n return seriesModel.get('coordinateSystem') === 'cartesian2d';\n}\nexport function findAxisModels(seriesModel) {\n var axisModelMap = {\n xAxisModel: null,\n yAxisModel: null\n };\n zrUtil.each(axisModelMap, function (v, key) {\n var axisType = key.replace(/Model$/, '');\n var axisModel = seriesModel.getReferringComponents(axisType, SINGLE_REFERRING).models[0];\n\n if (process.env.NODE_ENV !== 'production') {\n if (!axisModel) {\n throw new Error(axisType + ' \"' + zrUtil.retrieve3(seriesModel.get(axisType + 'Index'), seriesModel.get(axisType + 'Id'), 0) + '\" not found');\n }\n }\n\n axisModelMap[key] = axisModel;\n });\n return axisModelMap;\n}","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { getPrecisionSafe, round } from '../util/number.js';\nimport IntervalScale from '../scale/Interval.js';\nimport { getScaleExtent } from './axisHelper.js';\nimport { warn } from '../util/log.js';\nimport { increaseInterval, isValueNice } from '../scale/helper.js';\nvar mathLog = Math.log;\nexport function alignScaleTicks(scale, axisModel, alignToScale) {\n var intervalScaleProto = IntervalScale.prototype; // NOTE: There is a precondition for log scale here:\n // In log scale we store _interval and _extent of exponent value.\n // So if we use the method of InternalScale to set/get these data.\n // It process the exponent value, which is linear and what we want here.\n\n var alignToTicks = intervalScaleProto.getTicks.call(alignToScale);\n var alignToNicedTicks = intervalScaleProto.getTicks.call(alignToScale, true);\n var alignToSplitNumber = alignToTicks.length - 1;\n var alignToInterval = intervalScaleProto.getInterval.call(alignToScale);\n var scaleExtent = getScaleExtent(scale, axisModel);\n var rawExtent = scaleExtent.extent;\n var isMinFixed = scaleExtent.fixMin;\n var isMaxFixed = scaleExtent.fixMax;\n\n if (scale.type === 'log') {\n var logBase = mathLog(scale.base);\n rawExtent = [mathLog(rawExtent[0]) / logBase, mathLog(rawExtent[1]) / logBase];\n }\n\n scale.setExtent(rawExtent[0], rawExtent[1]);\n scale.calcNiceExtent({\n splitNumber: alignToSplitNumber,\n fixMin: isMinFixed,\n fixMax: isMaxFixed\n });\n var extent = intervalScaleProto.getExtent.call(scale); // Need to update the rawExtent.\n // Because value in rawExtent may be not parsed. e.g. 'dataMin', 'dataMax'\n\n if (isMinFixed) {\n rawExtent[0] = extent[0];\n }\n\n if (isMaxFixed) {\n rawExtent[1] = extent[1];\n }\n\n var interval = intervalScaleProto.getInterval.call(scale);\n var min = rawExtent[0];\n var max = rawExtent[1];\n\n if (isMinFixed && isMaxFixed) {\n // User set min, max, divide to get new interval\n interval = (max - min) / alignToSplitNumber;\n } else if (isMinFixed) {\n max = rawExtent[0] + interval * alignToSplitNumber; // User set min, expand extent on the other side\n\n while (max < rawExtent[1] && isFinite(max) && isFinite(rawExtent[1])) {\n interval = increaseInterval(interval);\n max = rawExtent[0] + interval * alignToSplitNumber;\n }\n } else if (isMaxFixed) {\n // User set max, expand extent on the other side\n min = rawExtent[1] - interval * alignToSplitNumber;\n\n while (min > rawExtent[0] && isFinite(min) && isFinite(rawExtent[0])) {\n interval = increaseInterval(interval);\n min = rawExtent[1] - interval * alignToSplitNumber;\n }\n } else {\n var nicedSplitNumber = scale.getTicks().length - 1;\n\n if (nicedSplitNumber > alignToSplitNumber) {\n interval = increaseInterval(interval);\n }\n\n var range = interval * alignToSplitNumber;\n max = Math.ceil(rawExtent[1] / interval) * interval;\n min = round(max - range); // Not change the result that crossing zero.\n\n if (min < 0 && rawExtent[0] >= 0) {\n min = 0;\n max = round(range);\n } else if (max > 0 && rawExtent[1] <= 0) {\n max = 0;\n min = -round(range);\n }\n } // Adjust min, max based on the extent of alignTo. When min or max is set in alignTo scale\n\n\n var t0 = (alignToTicks[0].value - alignToNicedTicks[0].value) / alignToInterval;\n var t1 = (alignToTicks[alignToSplitNumber].value - alignToNicedTicks[alignToSplitNumber].value) / alignToInterval; // NOTE: Must in setExtent -> setInterval -> setNiceExtent order.\n\n intervalScaleProto.setExtent.call(scale, min + interval * t0, max + interval * t1);\n intervalScaleProto.setInterval.call(scale, interval);\n\n if (t0 || t1) {\n intervalScaleProto.setNiceExtent.call(scale, min + interval, max - interval);\n }\n\n if (process.env.NODE_ENV !== 'production') {\n var ticks = intervalScaleProto.getTicks.call(scale);\n\n if (ticks[1] && (!isValueNice(interval) || getPrecisionSafe(ticks[1].value) > getPrecisionSafe(interval))) {\n warn( // eslint-disable-next-line\n \"The ticks may be not readable when set min: \" + axisModel.get('min') + \", max: \" + axisModel.get('max') + \" and alignTicks: true\");\n }\n }\n}","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n/**\n * Grid is a region which contains at most 4 cartesian systems\n *\n * TODO Default cartesian\n */\nimport { isObject, each, indexOf, retrieve3, keys } from 'zrender/lib/core/util.js';\nimport { getLayoutRect } from '../../util/layout.js';\nimport { createScaleByModel, ifAxisCrossZero, niceScaleExtent, estimateLabelUnionRect, getDataDimensionsOnAxis } from '../../coord/axisHelper.js';\nimport Cartesian2D, { cartesian2DDimensions } from './Cartesian2D.js';\nimport Axis2D from './Axis2D.js';\nimport { SINGLE_REFERRING } from '../../util/model.js';\nimport { isCartesian2DSeries, findAxisModels } from './cartesianAxisHelper.js';\nimport { isIntervalOrLogScale } from '../../scale/helper.js';\nimport { alignScaleTicks } from '../axisAlignTicks.js';\n\nvar Grid =\n/** @class */\nfunction () {\n function Grid(gridModel, ecModel, api) {\n // FIXME:TS where used (different from registered type 'cartesian2d')?\n this.type = 'grid';\n this._coordsMap = {};\n this._coordsList = [];\n this._axesMap = {};\n this._axesList = [];\n this.axisPointerEnabled = true;\n this.dimensions = cartesian2DDimensions;\n\n this._initCartesian(gridModel, ecModel, api);\n\n this.model = gridModel;\n }\n\n Grid.prototype.getRect = function () {\n return this._rect;\n };\n\n Grid.prototype.update = function (ecModel, api) {\n var axesMap = this._axesMap;\n\n this._updateScale(ecModel, this.model);\n\n function updateAxisTicks(axes) {\n var alignTo; // Axis is added in order of axisIndex.\n\n var axesIndices = keys(axes);\n var len = axesIndices.length;\n\n if (!len) {\n return;\n }\n\n var axisNeedsAlign = []; // Process once and calculate the ticks for those don't use alignTicks.\n\n for (var i = len - 1; i >= 0; i--) {\n var idx = +axesIndices[i]; // Convert to number.\n\n var axis = axes[idx];\n var model = axis.model;\n var scale = axis.scale;\n\n if ( // Only value and log axis without interval support alignTicks.\n isIntervalOrLogScale(scale) && model.get('alignTicks') && model.get('interval') == null) {\n axisNeedsAlign.push(axis);\n } else {\n niceScaleExtent(scale, model);\n\n if (isIntervalOrLogScale(scale)) {\n // Can only align to interval or log axis.\n alignTo = axis;\n }\n }\n }\n\n ; // All axes has set alignTicks. Pick the first one.\n // PENDING. Should we find the axis that both set interval, min, max and align to this one?\n\n if (axisNeedsAlign.length) {\n if (!alignTo) {\n alignTo = axisNeedsAlign.pop();\n niceScaleExtent(alignTo.scale, alignTo.model);\n }\n\n each(axisNeedsAlign, function (axis) {\n alignScaleTicks(axis.scale, axis.model, alignTo.scale);\n });\n }\n }\n\n updateAxisTicks(axesMap.x);\n updateAxisTicks(axesMap.y); // Key: axisDim_axisIndex, value: boolean, whether onZero target.\n\n var onZeroRecords = {};\n each(axesMap.x, function (xAxis) {\n fixAxisOnZero(axesMap, 'y', xAxis, onZeroRecords);\n });\n each(axesMap.y, function (yAxis) {\n fixAxisOnZero(axesMap, 'x', yAxis, onZeroRecords);\n }); // Resize again if containLabel is enabled\n // FIXME It may cause getting wrong grid size in data processing stage\n\n this.resize(this.model, api);\n };\n /**\n * Resize the grid\n */\n\n\n Grid.prototype.resize = function (gridModel, api, ignoreContainLabel) {\n var boxLayoutParams = gridModel.getBoxLayoutParams();\n var isContainLabel = !ignoreContainLabel && gridModel.get('containLabel');\n var gridRect = getLayoutRect(boxLayoutParams, {\n width: api.getWidth(),\n height: api.getHeight()\n });\n this._rect = gridRect;\n var axesList = this._axesList;\n adjustAxes(); // Minus label size\n\n if (isContainLabel) {\n each(axesList, function (axis) {\n if (!axis.model.get(['axisLabel', 'inside'])) {\n var labelUnionRect = estimateLabelUnionRect(axis);\n\n if (labelUnionRect) {\n var dim = axis.isHorizontal() ? 'height' : 'width';\n var margin = axis.model.get(['axisLabel', 'margin']);\n gridRect[dim] -= labelUnionRect[dim] + margin;\n\n if (axis.position === 'top') {\n gridRect.y += labelUnionRect.height + margin;\n } else if (axis.position === 'left') {\n gridRect.x += labelUnionRect.width + margin;\n }\n }\n }\n });\n adjustAxes();\n }\n\n each(this._coordsList, function (coord) {\n // Calculate affine matrix to accelerate the data to point transform.\n // If all the axes scales are time or value.\n coord.calcAffineTransform();\n });\n\n function adjustAxes() {\n each(axesList, function (axis) {\n var isHorizontal = axis.isHorizontal();\n var extent = isHorizontal ? [0, gridRect.width] : [0, gridRect.height];\n var idx = axis.inverse ? 1 : 0;\n axis.setExtent(extent[idx], extent[1 - idx]);\n updateAxisTransform(axis, isHorizontal ? gridRect.x : gridRect.y);\n });\n }\n };\n\n Grid.prototype.getAxis = function (dim, axisIndex) {\n var axesMapOnDim = this._axesMap[dim];\n\n if (axesMapOnDim != null) {\n return axesMapOnDim[axisIndex || 0];\n }\n };\n\n Grid.prototype.getAxes = function () {\n return this._axesList.slice();\n };\n\n Grid.prototype.getCartesian = function (xAxisIndex, yAxisIndex) {\n if (xAxisIndex != null && yAxisIndex != null) {\n var key = 'x' + xAxisIndex + 'y' + yAxisIndex;\n return this._coordsMap[key];\n }\n\n if (isObject(xAxisIndex)) {\n yAxisIndex = xAxisIndex.yAxisIndex;\n xAxisIndex = xAxisIndex.xAxisIndex;\n }\n\n for (var i = 0, coordList = this._coordsList; i < coordList.length; i++) {\n if (coordList[i].getAxis('x').index === xAxisIndex || coordList[i].getAxis('y').index === yAxisIndex) {\n return coordList[i];\n }\n }\n };\n\n Grid.prototype.getCartesians = function () {\n return this._coordsList.slice();\n };\n /**\n * @implements\n */\n\n\n Grid.prototype.convertToPixel = function (ecModel, finder, value) {\n var target = this._findConvertTarget(finder);\n\n return target.cartesian ? target.cartesian.dataToPoint(value) : target.axis ? target.axis.toGlobalCoord(target.axis.dataToCoord(value)) : null;\n };\n /**\n * @implements\n */\n\n\n Grid.prototype.convertFromPixel = function (ecModel, finder, value) {\n var target = this._findConvertTarget(finder);\n\n return target.cartesian ? target.cartesian.pointToData(value) : target.axis ? target.axis.coordToData(target.axis.toLocalCoord(value)) : null;\n };\n\n Grid.prototype._findConvertTarget = function (finder) {\n var seriesModel = finder.seriesModel;\n var xAxisModel = finder.xAxisModel || seriesModel && seriesModel.getReferringComponents('xAxis', SINGLE_REFERRING).models[0];\n var yAxisModel = finder.yAxisModel || seriesModel && seriesModel.getReferringComponents('yAxis', SINGLE_REFERRING).models[0];\n var gridModel = finder.gridModel;\n var coordsList = this._coordsList;\n var cartesian;\n var axis;\n\n if (seriesModel) {\n cartesian = seriesModel.coordinateSystem;\n indexOf(coordsList, cartesian) < 0 && (cartesian = null);\n } else if (xAxisModel && yAxisModel) {\n cartesian = this.getCartesian(xAxisModel.componentIndex, yAxisModel.componentIndex);\n } else if (xAxisModel) {\n axis = this.getAxis('x', xAxisModel.componentIndex);\n } else if (yAxisModel) {\n axis = this.getAxis('y', yAxisModel.componentIndex);\n } // Lowest priority.\n else if (gridModel) {\n var grid = gridModel.coordinateSystem;\n\n if (grid === this) {\n cartesian = this._coordsList[0];\n }\n }\n\n return {\n cartesian: cartesian,\n axis: axis\n };\n };\n /**\n * @implements\n */\n\n\n Grid.prototype.containPoint = function (point) {\n var coord = this._coordsList[0];\n\n if (coord) {\n return coord.containPoint(point);\n }\n };\n /**\n * Initialize cartesian coordinate systems\n */\n\n\n Grid.prototype._initCartesian = function (gridModel, ecModel, api) {\n var _this = this;\n\n var grid = this;\n var axisPositionUsed = {\n left: false,\n right: false,\n top: false,\n bottom: false\n };\n var axesMap = {\n x: {},\n y: {}\n };\n var axesCount = {\n x: 0,\n y: 0\n }; /// Create axis\n\n ecModel.eachComponent('xAxis', createAxisCreator('x'), this);\n ecModel.eachComponent('yAxis', createAxisCreator('y'), this);\n\n if (!axesCount.x || !axesCount.y) {\n // Roll back when there no either x or y axis\n this._axesMap = {};\n this._axesList = [];\n return;\n }\n\n this._axesMap = axesMap; /// Create cartesian2d\n\n each(axesMap.x, function (xAxis, xAxisIndex) {\n each(axesMap.y, function (yAxis, yAxisIndex) {\n var key = 'x' + xAxisIndex + 'y' + yAxisIndex;\n var cartesian = new Cartesian2D(key);\n cartesian.master = _this;\n cartesian.model = gridModel;\n _this._coordsMap[key] = cartesian;\n\n _this._coordsList.push(cartesian);\n\n cartesian.addAxis(xAxis);\n cartesian.addAxis(yAxis);\n });\n });\n\n function createAxisCreator(dimName) {\n return function (axisModel, idx) {\n if (!isAxisUsedInTheGrid(axisModel, gridModel)) {\n return;\n }\n\n var axisPosition = axisModel.get('position');\n\n if (dimName === 'x') {\n // Fix position\n if (axisPosition !== 'top' && axisPosition !== 'bottom') {\n // Default bottom of X\n axisPosition = axisPositionUsed.bottom ? 'top' : 'bottom';\n }\n } else {\n // Fix position\n if (axisPosition !== 'left' && axisPosition !== 'right') {\n // Default left of Y\n axisPosition = axisPositionUsed.left ? 'right' : 'left';\n }\n }\n\n axisPositionUsed[axisPosition] = true;\n var axis = new Axis2D(dimName, createScaleByModel(axisModel), [0, 0], axisModel.get('type'), axisPosition);\n var isCategory = axis.type === 'category';\n axis.onBand = isCategory && axisModel.get('boundaryGap');\n axis.inverse = axisModel.get('inverse'); // Inject axis into axisModel\n\n axisModel.axis = axis; // Inject axisModel into axis\n\n axis.model = axisModel; // Inject grid info axis\n\n axis.grid = grid; // Index of axis, can be used as key\n\n axis.index = idx;\n\n grid._axesList.push(axis);\n\n axesMap[dimName][idx] = axis;\n axesCount[dimName]++;\n };\n }\n };\n /**\n * Update cartesian properties from series.\n */\n\n\n Grid.prototype._updateScale = function (ecModel, gridModel) {\n // Reset scale\n each(this._axesList, function (axis) {\n axis.scale.setExtent(Infinity, -Infinity);\n\n if (axis.type === 'category') {\n var categorySortInfo = axis.model.get('categorySortInfo');\n axis.scale.setSortInfo(categorySortInfo);\n }\n });\n ecModel.eachSeries(function (seriesModel) {\n if (isCartesian2DSeries(seriesModel)) {\n var axesModelMap = findAxisModels(seriesModel);\n var xAxisModel = axesModelMap.xAxisModel;\n var yAxisModel = axesModelMap.yAxisModel;\n\n if (!isAxisUsedInTheGrid(xAxisModel, gridModel) || !isAxisUsedInTheGrid(yAxisModel, gridModel)) {\n return;\n }\n\n var cartesian = this.getCartesian(xAxisModel.componentIndex, yAxisModel.componentIndex);\n var data = seriesModel.getData();\n var xAxis = cartesian.getAxis('x');\n var yAxis = cartesian.getAxis('y');\n unionExtent(data, xAxis);\n unionExtent(data, yAxis);\n }\n }, this);\n\n function unionExtent(data, axis) {\n each(getDataDimensionsOnAxis(data, axis.dim), function (dim) {\n axis.scale.unionExtentFromData(data, dim);\n });\n }\n };\n /**\n * @param dim 'x' or 'y' or 'auto' or null/undefined\n */\n\n\n Grid.prototype.getTooltipAxes = function (dim) {\n var baseAxes = [];\n var otherAxes = [];\n each(this.getCartesians(), function (cartesian) {\n var baseAxis = dim != null && dim !== 'auto' ? cartesian.getAxis(dim) : cartesian.getBaseAxis();\n var otherAxis = cartesian.getOtherAxis(baseAxis);\n indexOf(baseAxes, baseAxis) < 0 && baseAxes.push(baseAxis);\n indexOf(otherAxes, otherAxis) < 0 && otherAxes.push(otherAxis);\n });\n return {\n baseAxes: baseAxes,\n otherAxes: otherAxes\n };\n };\n\n Grid.create = function (ecModel, api) {\n var grids = [];\n ecModel.eachComponent('grid', function (gridModel, idx) {\n var grid = new Grid(gridModel, ecModel, api);\n grid.name = 'grid_' + idx; // dataSampling requires axis extent, so resize\n // should be performed in create stage.\n\n grid.resize(gridModel, api, true);\n gridModel.coordinateSystem = grid;\n grids.push(grid);\n }); // Inject the coordinateSystems into seriesModel\n\n ecModel.eachSeries(function (seriesModel) {\n if (!isCartesian2DSeries(seriesModel)) {\n return;\n }\n\n var axesModelMap = findAxisModels(seriesModel);\n var xAxisModel = axesModelMap.xAxisModel;\n var yAxisModel = axesModelMap.yAxisModel;\n var gridModel = xAxisModel.getCoordSysModel();\n\n if (process.env.NODE_ENV !== 'production') {\n if (!gridModel) {\n throw new Error('Grid \"' + retrieve3(xAxisModel.get('gridIndex'), xAxisModel.get('gridId'), 0) + '\" not found');\n }\n\n if (xAxisModel.getCoordSysModel() !== yAxisModel.getCoordSysModel()) {\n throw new Error('xAxis and yAxis must use the same grid');\n }\n }\n\n var grid = gridModel.coordinateSystem;\n seriesModel.coordinateSystem = grid.getCartesian(xAxisModel.componentIndex, yAxisModel.componentIndex);\n });\n return grids;\n }; // For deciding which dimensions to use when creating list data\n\n\n Grid.dimensions = cartesian2DDimensions;\n return Grid;\n}();\n/**\n * Check if the axis is used in the specified grid.\n */\n\n\nfunction isAxisUsedInTheGrid(axisModel, gridModel) {\n return axisModel.getCoordSysModel() === gridModel;\n}\n\nfunction fixAxisOnZero(axesMap, otherAxisDim, axis, // Key: see `getOnZeroRecordKey`\nonZeroRecords) {\n axis.getAxesOnZeroOf = function () {\n // TODO: onZero of multiple axes.\n return otherAxisOnZeroOf ? [otherAxisOnZeroOf] : [];\n }; // onZero can not be enabled in these two situations:\n // 1. When any other axis is a category axis.\n // 2. When no axis is cross 0 point.\n\n\n var otherAxes = axesMap[otherAxisDim];\n var otherAxisOnZeroOf;\n var axisModel = axis.model;\n var onZero = axisModel.get(['axisLine', 'onZero']);\n var onZeroAxisIndex = axisModel.get(['axisLine', 'onZeroAxisIndex']);\n\n if (!onZero) {\n return;\n } // If target axis is specified.\n\n\n if (onZeroAxisIndex != null) {\n if (canOnZeroToAxis(otherAxes[onZeroAxisIndex])) {\n otherAxisOnZeroOf = otherAxes[onZeroAxisIndex];\n }\n } else {\n // Find the first available other axis.\n for (var idx in otherAxes) {\n if (otherAxes.hasOwnProperty(idx) && canOnZeroToAxis(otherAxes[idx]) // Consider that two Y axes on one value axis,\n // if both onZero, the two Y axes overlap.\n && !onZeroRecords[getOnZeroRecordKey(otherAxes[idx])]) {\n otherAxisOnZeroOf = otherAxes[idx];\n break;\n }\n }\n }\n\n if (otherAxisOnZeroOf) {\n onZeroRecords[getOnZeroRecordKey(otherAxisOnZeroOf)] = true;\n }\n\n function getOnZeroRecordKey(axis) {\n return axis.dim + '_' + axis.index;\n }\n}\n\nfunction canOnZeroToAxis(axis) {\n return axis && axis.type !== 'category' && axis.type !== 'time' && ifAxisCrossZero(axis);\n}\n\nfunction updateAxisTransform(axis, coordBase) {\n var axisExtent = axis.getExtent();\n var axisExtentSum = axisExtent[0] + axisExtent[1]; // Fast transform\n\n axis.toGlobalCoord = axis.dim === 'x' ? function (coord) {\n return coord + coordBase;\n } : function (coord) {\n return axisExtentSum - coord + coordBase;\n };\n axis.toLocalCoord = axis.dim === 'x' ? function (coord) {\n return coord - coordBase;\n } : function (coord) {\n return axisExtentSum - coord + coordBase;\n };\n}\n\nexport default Grid;","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { retrieve, defaults, extend, each, isObject, map, isString, isNumber, isFunction } from 'zrender/lib/core/util.js';\nimport * as graphic from '../../util/graphic.js';\nimport { getECData } from '../../util/innerStore.js';\nimport { createTextStyle } from '../../label/labelStyle.js';\nimport Model from '../../model/Model.js';\nimport { isRadianAroundZero, remRadian } from '../../util/number.js';\nimport { createSymbol, normalizeSymbolOffset } from '../../util/symbol.js';\nimport * as matrixUtil from 'zrender/lib/core/matrix.js';\nimport { applyTransform as v2ApplyTransform } from 'zrender/lib/core/vector.js';\nimport { shouldShowAllLabels } from '../../coord/axisHelper.js';\nimport { prepareLayoutList, hideOverlap } from '../../label/labelLayoutHelper.js';\nvar PI = Math.PI;\n/**\n * A final axis is translated and rotated from a \"standard axis\".\n * So opt.position and opt.rotation is required.\n *\n * A standard axis is and axis from [0, 0] to [0, axisExtent[1]],\n * for example: (0, 0) ------------> (0, 50)\n *\n * nameDirection or tickDirection or labelDirection is 1 means tick\n * or label is below the standard axis, whereas is -1 means above\n * the standard axis. labelOffset means offset between label and axis,\n * which is useful when 'onZero', where axisLabel is in the grid and\n * label in outside grid.\n *\n * Tips: like always,\n * positive rotation represents anticlockwise, and negative rotation\n * represents clockwise.\n * The direction of position coordinate is the same as the direction\n * of screen coordinate.\n *\n * Do not need to consider axis 'inverse', which is auto processed by\n * axis extent.\n */\n\nvar AxisBuilder =\n/** @class */\nfunction () {\n function AxisBuilder(axisModel, opt) {\n this.group = new graphic.Group();\n this.opt = opt;\n this.axisModel = axisModel; // Default value\n\n defaults(opt, {\n labelOffset: 0,\n nameDirection: 1,\n tickDirection: 1,\n labelDirection: 1,\n silent: true,\n handleAutoShown: function () {\n return true;\n }\n }); // FIXME Not use a seperate text group?\n\n var transformGroup = new graphic.Group({\n x: opt.position[0],\n y: opt.position[1],\n rotation: opt.rotation\n }); // this.group.add(transformGroup);\n // this._transformGroup = transformGroup;\n\n transformGroup.updateTransform();\n this._transformGroup = transformGroup;\n }\n\n AxisBuilder.prototype.hasBuilder = function (name) {\n return !!builders[name];\n };\n\n AxisBuilder.prototype.add = function (name) {\n builders[name](this.opt, this.axisModel, this.group, this._transformGroup);\n };\n\n AxisBuilder.prototype.getGroup = function () {\n return this.group;\n };\n\n AxisBuilder.innerTextLayout = function (axisRotation, textRotation, direction) {\n var rotationDiff = remRadian(textRotation - axisRotation);\n var textAlign;\n var textVerticalAlign;\n\n if (isRadianAroundZero(rotationDiff)) {\n // Label is parallel with axis line.\n textVerticalAlign = direction > 0 ? 'top' : 'bottom';\n textAlign = 'center';\n } else if (isRadianAroundZero(rotationDiff - PI)) {\n // Label is inverse parallel with axis line.\n textVerticalAlign = direction > 0 ? 'bottom' : 'top';\n textAlign = 'center';\n } else {\n textVerticalAlign = 'middle';\n\n if (rotationDiff > 0 && rotationDiff < PI) {\n textAlign = direction > 0 ? 'right' : 'left';\n } else {\n textAlign = direction > 0 ? 'left' : 'right';\n }\n }\n\n return {\n rotation: rotationDiff,\n textAlign: textAlign,\n textVerticalAlign: textVerticalAlign\n };\n };\n\n AxisBuilder.makeAxisEventDataBase = function (axisModel) {\n var eventData = {\n componentType: axisModel.mainType,\n componentIndex: axisModel.componentIndex\n };\n eventData[axisModel.mainType + 'Index'] = axisModel.componentIndex;\n return eventData;\n };\n\n AxisBuilder.isLabelSilent = function (axisModel) {\n var tooltipOpt = axisModel.get('tooltip');\n return axisModel.get('silent') // Consider mouse cursor, add these restrictions.\n || !(axisModel.get('triggerEvent') || tooltipOpt && tooltipOpt.show);\n };\n\n return AxisBuilder;\n}();\n\n;\nvar builders = {\n axisLine: function (opt, axisModel, group, transformGroup) {\n var shown = axisModel.get(['axisLine', 'show']);\n\n if (shown === 'auto' && opt.handleAutoShown) {\n shown = opt.handleAutoShown('axisLine');\n }\n\n if (!shown) {\n return;\n }\n\n var extent = axisModel.axis.getExtent();\n var matrix = transformGroup.transform;\n var pt1 = [extent[0], 0];\n var pt2 = [extent[1], 0];\n\n if (matrix) {\n v2ApplyTransform(pt1, pt1, matrix);\n v2ApplyTransform(pt2, pt2, matrix);\n }\n\n var lineStyle = extend({\n lineCap: 'round'\n }, axisModel.getModel(['axisLine', 'lineStyle']).getLineStyle());\n var line = new graphic.Line({\n // Id for animation\n subPixelOptimize: true,\n shape: {\n x1: pt1[0],\n y1: pt1[1],\n x2: pt2[0],\n y2: pt2[1]\n },\n style: lineStyle,\n strokeContainThreshold: opt.strokeContainThreshold || 5,\n silent: true,\n z2: 1\n });\n line.anid = 'line';\n group.add(line);\n var arrows = axisModel.get(['axisLine', 'symbol']);\n\n if (arrows != null) {\n var arrowSize = axisModel.get(['axisLine', 'symbolSize']);\n\n if (isString(arrows)) {\n // Use the same arrow for start and end point\n arrows = [arrows, arrows];\n }\n\n if (isString(arrowSize) || isNumber(arrowSize)) {\n // Use the same size for width and height\n arrowSize = [arrowSize, arrowSize];\n }\n\n var arrowOffset = normalizeSymbolOffset(axisModel.get(['axisLine', 'symbolOffset']) || 0, arrowSize);\n var symbolWidth_1 = arrowSize[0];\n var symbolHeight_1 = arrowSize[1];\n each([{\n rotate: opt.rotation + Math.PI / 2,\n offset: arrowOffset[0],\n r: 0\n }, {\n rotate: opt.rotation - Math.PI / 2,\n offset: arrowOffset[1],\n r: Math.sqrt((pt1[0] - pt2[0]) * (pt1[0] - pt2[0]) + (pt1[1] - pt2[1]) * (pt1[1] - pt2[1]))\n }], function (point, index) {\n if (arrows[index] !== 'none' && arrows[index] != null) {\n var symbol = createSymbol(arrows[index], -symbolWidth_1 / 2, -symbolHeight_1 / 2, symbolWidth_1, symbolHeight_1, lineStyle.stroke, true); // Calculate arrow position with offset\n\n var r = point.r + point.offset;\n symbol.attr({\n rotation: point.rotate,\n x: pt1[0] + r * Math.cos(opt.rotation),\n y: pt1[1] - r * Math.sin(opt.rotation),\n silent: true,\n z2: 11\n });\n group.add(symbol);\n }\n });\n }\n },\n axisTickLabel: function (opt, axisModel, group, transformGroup) {\n var ticksEls = buildAxisMajorTicks(group, transformGroup, axisModel, opt);\n var labelEls = buildAxisLabel(group, transformGroup, axisModel, opt);\n fixMinMaxLabelShow(axisModel, labelEls, ticksEls);\n buildAxisMinorTicks(group, transformGroup, axisModel, opt.tickDirection); // This bit fixes the label overlap issue for the time chart.\n // See https://github.com/apache/echarts/issues/14266 for more.\n\n if (axisModel.get(['axisLabel', 'hideOverlap'])) {\n var labelList = prepareLayoutList(map(labelEls, function (label) {\n return {\n label: label,\n priority: label.z2,\n defaultAttr: {\n ignore: label.ignore\n }\n };\n }));\n hideOverlap(labelList);\n }\n },\n axisName: function (opt, axisModel, group, transformGroup) {\n var name = retrieve(opt.axisName, axisModel.get('name'));\n\n if (!name) {\n return;\n }\n\n var nameLocation = axisModel.get('nameLocation');\n var nameDirection = opt.nameDirection;\n var textStyleModel = axisModel.getModel('nameTextStyle');\n var gap = axisModel.get('nameGap') || 0;\n var extent = axisModel.axis.getExtent();\n var gapSignal = extent[0] > extent[1] ? -1 : 1;\n var pos = [nameLocation === 'start' ? extent[0] - gapSignal * gap : nameLocation === 'end' ? extent[1] + gapSignal * gap : (extent[0] + extent[1]) / 2, // Reuse labelOffset.\n isNameLocationCenter(nameLocation) ? opt.labelOffset + nameDirection * gap : 0];\n var labelLayout;\n var nameRotation = axisModel.get('nameRotate');\n\n if (nameRotation != null) {\n nameRotation = nameRotation * PI / 180; // To radian.\n }\n\n var axisNameAvailableWidth;\n\n if (isNameLocationCenter(nameLocation)) {\n labelLayout = AxisBuilder.innerTextLayout(opt.rotation, nameRotation != null ? nameRotation : opt.rotation, // Adapt to axis.\n nameDirection);\n } else {\n labelLayout = endTextLayout(opt.rotation, nameLocation, nameRotation || 0, extent);\n axisNameAvailableWidth = opt.axisNameAvailableWidth;\n\n if (axisNameAvailableWidth != null) {\n axisNameAvailableWidth = Math.abs(axisNameAvailableWidth / Math.sin(labelLayout.rotation));\n !isFinite(axisNameAvailableWidth) && (axisNameAvailableWidth = null);\n }\n }\n\n var textFont = textStyleModel.getFont();\n var truncateOpt = axisModel.get('nameTruncate', true) || {};\n var ellipsis = truncateOpt.ellipsis;\n var maxWidth = retrieve(opt.nameTruncateMaxWidth, truncateOpt.maxWidth, axisNameAvailableWidth);\n var textEl = new graphic.Text({\n x: pos[0],\n y: pos[1],\n rotation: labelLayout.rotation,\n silent: AxisBuilder.isLabelSilent(axisModel),\n style: createTextStyle(textStyleModel, {\n text: name,\n font: textFont,\n overflow: 'truncate',\n width: maxWidth,\n ellipsis: ellipsis,\n fill: textStyleModel.getTextColor() || axisModel.get(['axisLine', 'lineStyle', 'color']),\n align: textStyleModel.get('align') || labelLayout.textAlign,\n verticalAlign: textStyleModel.get('verticalAlign') || labelLayout.textVerticalAlign\n }),\n z2: 1\n });\n graphic.setTooltipConfig({\n el: textEl,\n componentModel: axisModel,\n itemName: name\n });\n textEl.__fullText = name; // Id for animation\n\n textEl.anid = 'name';\n\n if (axisModel.get('triggerEvent')) {\n var eventData = AxisBuilder.makeAxisEventDataBase(axisModel);\n eventData.targetType = 'axisName';\n eventData.name = name;\n getECData(textEl).eventData = eventData;\n } // FIXME\n\n\n transformGroup.add(textEl);\n textEl.updateTransform();\n group.add(textEl);\n textEl.decomposeTransform();\n }\n};\n\nfunction endTextLayout(rotation, textPosition, textRotate, extent) {\n var rotationDiff = remRadian(textRotate - rotation);\n var textAlign;\n var textVerticalAlign;\n var inverse = extent[0] > extent[1];\n var onLeft = textPosition === 'start' && !inverse || textPosition !== 'start' && inverse;\n\n if (isRadianAroundZero(rotationDiff - PI / 2)) {\n textVerticalAlign = onLeft ? 'bottom' : 'top';\n textAlign = 'center';\n } else if (isRadianAroundZero(rotationDiff - PI * 1.5)) {\n textVerticalAlign = onLeft ? 'top' : 'bottom';\n textAlign = 'center';\n } else {\n textVerticalAlign = 'middle';\n\n if (rotationDiff < PI * 1.5 && rotationDiff > PI / 2) {\n textAlign = onLeft ? 'left' : 'right';\n } else {\n textAlign = onLeft ? 'right' : 'left';\n }\n }\n\n return {\n rotation: rotationDiff,\n textAlign: textAlign,\n textVerticalAlign: textVerticalAlign\n };\n}\n\nfunction fixMinMaxLabelShow(axisModel, labelEls, tickEls) {\n if (shouldShowAllLabels(axisModel.axis)) {\n return;\n } // If min or max are user set, we need to check\n // If the tick on min(max) are overlap on their neighbour tick\n // If they are overlapped, we need to hide the min(max) tick label\n\n\n var showMinLabel = axisModel.get(['axisLabel', 'showMinLabel']);\n var showMaxLabel = axisModel.get(['axisLabel', 'showMaxLabel']); // FIXME\n // Have not consider onBand yet, where tick els is more than label els.\n\n labelEls = labelEls || [];\n tickEls = tickEls || [];\n var firstLabel = labelEls[0];\n var nextLabel = labelEls[1];\n var lastLabel = labelEls[labelEls.length - 1];\n var prevLabel = labelEls[labelEls.length - 2];\n var firstTick = tickEls[0];\n var nextTick = tickEls[1];\n var lastTick = tickEls[tickEls.length - 1];\n var prevTick = tickEls[tickEls.length - 2];\n\n if (showMinLabel === false) {\n ignoreEl(firstLabel);\n ignoreEl(firstTick);\n } else if (isTwoLabelOverlapped(firstLabel, nextLabel)) {\n if (showMinLabel) {\n ignoreEl(nextLabel);\n ignoreEl(nextTick);\n } else {\n ignoreEl(firstLabel);\n ignoreEl(firstTick);\n }\n }\n\n if (showMaxLabel === false) {\n ignoreEl(lastLabel);\n ignoreEl(lastTick);\n } else if (isTwoLabelOverlapped(prevLabel, lastLabel)) {\n if (showMaxLabel) {\n ignoreEl(prevLabel);\n ignoreEl(prevTick);\n } else {\n ignoreEl(lastLabel);\n ignoreEl(lastTick);\n }\n }\n}\n\nfunction ignoreEl(el) {\n el && (el.ignore = true);\n}\n\nfunction isTwoLabelOverlapped(current, next) {\n // current and next has the same rotation.\n var firstRect = current && current.getBoundingRect().clone();\n var nextRect = next && next.getBoundingRect().clone();\n\n if (!firstRect || !nextRect) {\n return;\n } // When checking intersect of two rotated labels, we use mRotationBack\n // to avoid that boundingRect is enlarge when using `boundingRect.applyTransform`.\n\n\n var mRotationBack = matrixUtil.identity([]);\n matrixUtil.rotate(mRotationBack, mRotationBack, -current.rotation);\n firstRect.applyTransform(matrixUtil.mul([], mRotationBack, current.getLocalTransform()));\n nextRect.applyTransform(matrixUtil.mul([], mRotationBack, next.getLocalTransform()));\n return firstRect.intersect(nextRect);\n}\n\nfunction isNameLocationCenter(nameLocation) {\n return nameLocation === 'middle' || nameLocation === 'center';\n}\n\nfunction createTicks(ticksCoords, tickTransform, tickEndCoord, tickLineStyle, anidPrefix) {\n var tickEls = [];\n var pt1 = [];\n var pt2 = [];\n\n for (var i = 0; i < ticksCoords.length; i++) {\n var tickCoord = ticksCoords[i].coord;\n pt1[0] = tickCoord;\n pt1[1] = 0;\n pt2[0] = tickCoord;\n pt2[1] = tickEndCoord;\n\n if (tickTransform) {\n v2ApplyTransform(pt1, pt1, tickTransform);\n v2ApplyTransform(pt2, pt2, tickTransform);\n } // Tick line, Not use group transform to have better line draw\n\n\n var tickEl = new graphic.Line({\n subPixelOptimize: true,\n shape: {\n x1: pt1[0],\n y1: pt1[1],\n x2: pt2[0],\n y2: pt2[1]\n },\n style: tickLineStyle,\n z2: 2,\n autoBatch: true,\n silent: true\n });\n tickEl.anid = anidPrefix + '_' + ticksCoords[i].tickValue;\n tickEls.push(tickEl);\n }\n\n return tickEls;\n}\n\nfunction buildAxisMajorTicks(group, transformGroup, axisModel, opt) {\n var axis = axisModel.axis;\n var tickModel = axisModel.getModel('axisTick');\n var shown = tickModel.get('show');\n\n if (shown === 'auto' && opt.handleAutoShown) {\n shown = opt.handleAutoShown('axisTick');\n }\n\n if (!shown || axis.scale.isBlank()) {\n return;\n }\n\n var lineStyleModel = tickModel.getModel('lineStyle');\n var tickEndCoord = opt.tickDirection * tickModel.get('length');\n var ticksCoords = axis.getTicksCoords();\n var ticksEls = createTicks(ticksCoords, transformGroup.transform, tickEndCoord, defaults(lineStyleModel.getLineStyle(), {\n stroke: axisModel.get(['axisLine', 'lineStyle', 'color'])\n }), 'ticks');\n\n for (var i = 0; i < ticksEls.length; i++) {\n group.add(ticksEls[i]);\n }\n\n return ticksEls;\n}\n\nfunction buildAxisMinorTicks(group, transformGroup, axisModel, tickDirection) {\n var axis = axisModel.axis;\n var minorTickModel = axisModel.getModel('minorTick');\n\n if (!minorTickModel.get('show') || axis.scale.isBlank()) {\n return;\n }\n\n var minorTicksCoords = axis.getMinorTicksCoords();\n\n if (!minorTicksCoords.length) {\n return;\n }\n\n var lineStyleModel = minorTickModel.getModel('lineStyle');\n var tickEndCoord = tickDirection * minorTickModel.get('length');\n var minorTickLineStyle = defaults(lineStyleModel.getLineStyle(), defaults(axisModel.getModel('axisTick').getLineStyle(), {\n stroke: axisModel.get(['axisLine', 'lineStyle', 'color'])\n }));\n\n for (var i = 0; i < minorTicksCoords.length; i++) {\n var minorTicksEls = createTicks(minorTicksCoords[i], transformGroup.transform, tickEndCoord, minorTickLineStyle, 'minorticks_' + i);\n\n for (var k = 0; k < minorTicksEls.length; k++) {\n group.add(minorTicksEls[k]);\n }\n }\n}\n\nfunction buildAxisLabel(group, transformGroup, axisModel, opt) {\n var axis = axisModel.axis;\n var show = retrieve(opt.axisLabelShow, axisModel.get(['axisLabel', 'show']));\n\n if (!show || axis.scale.isBlank()) {\n return;\n }\n\n var labelModel = axisModel.getModel('axisLabel');\n var labelMargin = labelModel.get('margin');\n var labels = axis.getViewLabels(); // Special label rotate.\n\n var labelRotation = (retrieve(opt.labelRotate, labelModel.get('rotate')) || 0) * PI / 180;\n var labelLayout = AxisBuilder.innerTextLayout(opt.rotation, labelRotation, opt.labelDirection);\n var rawCategoryData = axisModel.getCategories && axisModel.getCategories(true);\n var labelEls = [];\n var silent = AxisBuilder.isLabelSilent(axisModel);\n var triggerEvent = axisModel.get('triggerEvent');\n each(labels, function (labelItem, index) {\n var tickValue = axis.scale.type === 'ordinal' ? axis.scale.getRawOrdinalNumber(labelItem.tickValue) : labelItem.tickValue;\n var formattedLabel = labelItem.formattedLabel;\n var rawLabel = labelItem.rawLabel;\n var itemLabelModel = labelModel;\n\n if (rawCategoryData && rawCategoryData[tickValue]) {\n var rawCategoryItem = rawCategoryData[tickValue];\n\n if (isObject(rawCategoryItem) && rawCategoryItem.textStyle) {\n itemLabelModel = new Model(rawCategoryItem.textStyle, labelModel, axisModel.ecModel);\n }\n }\n\n var textColor = itemLabelModel.getTextColor() || axisModel.get(['axisLine', 'lineStyle', 'color']);\n var tickCoord = axis.dataToCoord(tickValue);\n var textEl = new graphic.Text({\n x: tickCoord,\n y: opt.labelOffset + opt.labelDirection * labelMargin,\n rotation: labelLayout.rotation,\n silent: silent,\n z2: 10 + (labelItem.level || 0),\n style: createTextStyle(itemLabelModel, {\n text: formattedLabel,\n align: itemLabelModel.getShallow('align', true) || labelLayout.textAlign,\n verticalAlign: itemLabelModel.getShallow('verticalAlign', true) || itemLabelModel.getShallow('baseline', true) || labelLayout.textVerticalAlign,\n fill: isFunction(textColor) ? textColor( // (1) In category axis with data zoom, tick is not the original\n // index of axis.data. So tick should not be exposed to user\n // in category axis.\n // (2) Compatible with previous version, which always use formatted label as\n // input. But in interval scale the formatted label is like '223,445', which\n // maked user repalce ','. So we modify it to return original val but remain\n // it as 'string' to avoid error in replacing.\n axis.type === 'category' ? rawLabel : axis.type === 'value' ? tickValue + '' : tickValue, index) : textColor\n })\n });\n textEl.anid = 'label_' + tickValue; // Pack data for mouse event\n\n if (triggerEvent) {\n var eventData = AxisBuilder.makeAxisEventDataBase(axisModel);\n eventData.targetType = 'axisLabel';\n eventData.value = rawLabel;\n getECData(textEl).eventData = eventData;\n } // FIXME\n\n\n transformGroup.add(textEl);\n textEl.updateTransform();\n labelEls.push(textEl);\n group.add(textEl);\n textEl.decomposeTransform();\n });\n return labelEls;\n}\n\nexport default AxisBuilder;","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport Model from '../../model/Model.js';\nimport { each, curry, clone, defaults, isArray, indexOf } from 'zrender/lib/core/util.js'; // Build axisPointerModel, mergin tooltip.axisPointer model for each axis.\n// allAxesInfo should be updated when setOption performed.\n\nexport function collect(ecModel, api) {\n var result = {\n /**\n * key: makeKey(axis.model)\n * value: {\n * axis,\n * coordSys,\n * axisPointerModel,\n * triggerTooltip,\n * involveSeries,\n * snap,\n * seriesModels,\n * seriesDataCount\n * }\n */\n axesInfo: {},\n seriesInvolved: false,\n\n /**\n * key: makeKey(coordSys.model)\n * value: Object: key makeKey(axis.model), value: axisInfo\n */\n coordSysAxesInfo: {},\n coordSysMap: {}\n };\n collectAxesInfo(result, ecModel, api); // Check seriesInvolved for performance, in case too many series in some chart.\n\n result.seriesInvolved && collectSeriesInfo(result, ecModel);\n return result;\n}\n\nfunction collectAxesInfo(result, ecModel, api) {\n var globalTooltipModel = ecModel.getComponent('tooltip');\n var globalAxisPointerModel = ecModel.getComponent('axisPointer'); // links can only be set on global.\n\n var linksOption = globalAxisPointerModel.get('link', true) || [];\n var linkGroups = []; // Collect axes info.\n\n each(api.getCoordinateSystems(), function (coordSys) {\n // Some coordinate system do not support axes, like geo.\n if (!coordSys.axisPointerEnabled) {\n return;\n }\n\n var coordSysKey = makeKey(coordSys.model);\n var axesInfoInCoordSys = result.coordSysAxesInfo[coordSysKey] = {};\n result.coordSysMap[coordSysKey] = coordSys; // Set tooltip (like 'cross') is a convienent way to show axisPointer\n // for user. So we enable seting tooltip on coordSys model.\n\n var coordSysModel = coordSys.model;\n var baseTooltipModel = coordSysModel.getModel('tooltip', globalTooltipModel);\n each(coordSys.getAxes(), curry(saveTooltipAxisInfo, false, null)); // If axis tooltip used, choose tooltip axis for each coordSys.\n // Notice this case: coordSys is `grid` but not `cartesian2D` here.\n\n if (coordSys.getTooltipAxes && globalTooltipModel // If tooltip.showContent is set as false, tooltip will not\n // show but axisPointer will show as normal.\n && baseTooltipModel.get('show')) {\n // Compatible with previous logic. But series.tooltip.trigger: 'axis'\n // or series.data[n].tooltip.trigger: 'axis' are not support any more.\n var triggerAxis = baseTooltipModel.get('trigger') === 'axis';\n var cross = baseTooltipModel.get(['axisPointer', 'type']) === 'cross';\n var tooltipAxes = coordSys.getTooltipAxes(baseTooltipModel.get(['axisPointer', 'axis']));\n\n if (triggerAxis || cross) {\n each(tooltipAxes.baseAxes, curry(saveTooltipAxisInfo, cross ? 'cross' : true, triggerAxis));\n }\n\n if (cross) {\n each(tooltipAxes.otherAxes, curry(saveTooltipAxisInfo, 'cross', false));\n }\n } // fromTooltip: true | false | 'cross'\n // triggerTooltip: true | false | null\n\n\n function saveTooltipAxisInfo(fromTooltip, triggerTooltip, axis) {\n var axisPointerModel = axis.model.getModel('axisPointer', globalAxisPointerModel);\n var axisPointerShow = axisPointerModel.get('show');\n\n if (!axisPointerShow || axisPointerShow === 'auto' && !fromTooltip && !isHandleTrigger(axisPointerModel)) {\n return;\n }\n\n if (triggerTooltip == null) {\n triggerTooltip = axisPointerModel.get('triggerTooltip');\n }\n\n axisPointerModel = fromTooltip ? makeAxisPointerModel(axis, baseTooltipModel, globalAxisPointerModel, ecModel, fromTooltip, triggerTooltip) : axisPointerModel;\n var snap = axisPointerModel.get('snap');\n var axisKey = makeKey(axis.model);\n var involveSeries = triggerTooltip || snap || axis.type === 'category'; // If result.axesInfo[key] exist, override it (tooltip has higher priority).\n\n var axisInfo = result.axesInfo[axisKey] = {\n key: axisKey,\n axis: axis,\n coordSys: coordSys,\n axisPointerModel: axisPointerModel,\n triggerTooltip: triggerTooltip,\n involveSeries: involveSeries,\n snap: snap,\n useHandle: isHandleTrigger(axisPointerModel),\n seriesModels: [],\n linkGroup: null\n };\n axesInfoInCoordSys[axisKey] = axisInfo;\n result.seriesInvolved = result.seriesInvolved || involveSeries;\n var groupIndex = getLinkGroupIndex(linksOption, axis);\n\n if (groupIndex != null) {\n var linkGroup = linkGroups[groupIndex] || (linkGroups[groupIndex] = {\n axesInfo: {}\n });\n linkGroup.axesInfo[axisKey] = axisInfo;\n linkGroup.mapper = linksOption[groupIndex].mapper;\n axisInfo.linkGroup = linkGroup;\n }\n }\n });\n}\n\nfunction makeAxisPointerModel(axis, baseTooltipModel, globalAxisPointerModel, ecModel, fromTooltip, triggerTooltip) {\n var tooltipAxisPointerModel = baseTooltipModel.getModel('axisPointer');\n var fields = ['type', 'snap', 'lineStyle', 'shadowStyle', 'label', 'animation', 'animationDurationUpdate', 'animationEasingUpdate', 'z'];\n var volatileOption = {};\n each(fields, function (field) {\n volatileOption[field] = clone(tooltipAxisPointerModel.get(field));\n }); // category axis do not auto snap, otherwise some tick that do not\n // has value can not be hovered. value/time/log axis default snap if\n // triggered from tooltip and trigger tooltip.\n\n volatileOption.snap = axis.type !== 'category' && !!triggerTooltip; // Compatibel with previous behavior, tooltip axis do not show label by default.\n // Only these properties can be overrided from tooltip to axisPointer.\n\n if (tooltipAxisPointerModel.get('type') === 'cross') {\n volatileOption.type = 'line';\n }\n\n var labelOption = volatileOption.label || (volatileOption.label = {}); // Follow the convention, do not show label when triggered by tooltip by default.\n\n labelOption.show == null && (labelOption.show = false);\n\n if (fromTooltip === 'cross') {\n // When 'cross', both axes show labels.\n var tooltipAxisPointerLabelShow = tooltipAxisPointerModel.get(['label', 'show']);\n labelOption.show = tooltipAxisPointerLabelShow != null ? tooltipAxisPointerLabelShow : true; // If triggerTooltip, this is a base axis, which should better not use cross style\n // (cross style is dashed by default)\n\n if (!triggerTooltip) {\n var crossStyle = volatileOption.lineStyle = tooltipAxisPointerModel.get('crossStyle');\n crossStyle && defaults(labelOption, crossStyle.textStyle);\n }\n }\n\n return axis.model.getModel('axisPointer', new Model(volatileOption, globalAxisPointerModel, ecModel));\n}\n\nfunction collectSeriesInfo(result, ecModel) {\n // Prepare data for axis trigger\n ecModel.eachSeries(function (seriesModel) {\n // Notice this case: this coordSys is `cartesian2D` but not `grid`.\n var coordSys = seriesModel.coordinateSystem;\n var seriesTooltipTrigger = seriesModel.get(['tooltip', 'trigger'], true);\n var seriesTooltipShow = seriesModel.get(['tooltip', 'show'], true);\n\n if (!coordSys || seriesTooltipTrigger === 'none' || seriesTooltipTrigger === false || seriesTooltipTrigger === 'item' || seriesTooltipShow === false || seriesModel.get(['axisPointer', 'show'], true) === false) {\n return;\n }\n\n each(result.coordSysAxesInfo[makeKey(coordSys.model)], function (axisInfo) {\n var axis = axisInfo.axis;\n\n if (coordSys.getAxis(axis.dim) === axis) {\n axisInfo.seriesModels.push(seriesModel);\n axisInfo.seriesDataCount == null && (axisInfo.seriesDataCount = 0);\n axisInfo.seriesDataCount += seriesModel.getData().count();\n }\n });\n });\n}\n/**\n * For example:\n * {\n * axisPointer: {\n * links: [{\n * xAxisIndex: [2, 4],\n * yAxisIndex: 'all'\n * }, {\n * xAxisId: ['a5', 'a7'],\n * xAxisName: 'xxx'\n * }]\n * }\n * }\n */\n\n\nfunction getLinkGroupIndex(linksOption, axis) {\n var axisModel = axis.model;\n var dim = axis.dim;\n\n for (var i = 0; i < linksOption.length; i++) {\n var linkOption = linksOption[i] || {};\n\n if (checkPropInLink(linkOption[dim + 'AxisId'], axisModel.id) || checkPropInLink(linkOption[dim + 'AxisIndex'], axisModel.componentIndex) || checkPropInLink(linkOption[dim + 'AxisName'], axisModel.name)) {\n return i;\n }\n }\n}\n\nfunction checkPropInLink(linkPropValue, axisPropValue) {\n return linkPropValue === 'all' || isArray(linkPropValue) && indexOf(linkPropValue, axisPropValue) >= 0 || linkPropValue === axisPropValue;\n}\n\nexport function fixValue(axisModel) {\n var axisInfo = getAxisInfo(axisModel);\n\n if (!axisInfo) {\n return;\n }\n\n var axisPointerModel = axisInfo.axisPointerModel;\n var scale = axisInfo.axis.scale;\n var option = axisPointerModel.option;\n var status = axisPointerModel.get('status');\n var value = axisPointerModel.get('value'); // Parse init value for category and time axis.\n\n if (value != null) {\n value = scale.parse(value);\n }\n\n var useHandle = isHandleTrigger(axisPointerModel); // If `handle` used, `axisPointer` will always be displayed, so value\n // and status should be initialized.\n\n if (status == null) {\n option.status = useHandle ? 'show' : 'hide';\n }\n\n var extent = scale.getExtent().slice();\n extent[0] > extent[1] && extent.reverse();\n\n if ( // Pick a value on axis when initializing.\n value == null // If both `handle` and `dataZoom` are used, value may be out of axis extent,\n // where we should re-pick a value to keep `handle` displaying normally.\n || value > extent[1]) {\n // Make handle displayed on the end of the axis when init, which looks better.\n value = extent[1];\n }\n\n if (value < extent[0]) {\n value = extent[0];\n }\n\n option.value = value;\n\n if (useHandle) {\n option.status = axisInfo.axis.scale.isBlank() ? 'hide' : 'show';\n }\n}\nexport function getAxisInfo(axisModel) {\n var coordSysAxesInfo = (axisModel.ecModel.getComponent('axisPointer') || {}).coordSysAxesInfo;\n return coordSysAxesInfo && coordSysAxesInfo.axesInfo[makeKey(axisModel)];\n}\nexport function getAxisPointerModel(axisModel) {\n var axisInfo = getAxisInfo(axisModel);\n return axisInfo && axisInfo.axisPointerModel;\n}\n\nfunction isHandleTrigger(axisPointerModel) {\n return !!axisPointerModel.get(['handle', 'show']);\n}\n/**\n * @param {module:echarts/model/Model} model\n * @return {string} unique key\n */\n\n\nexport function makeKey(model) {\n return model.type + '||' + model.id;\n}","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { __extends } from \"tslib\";\nimport * as axisPointerModelHelper from '../axisPointer/modelHelper.js';\nimport ComponentView from '../../view/Component.js';\nvar axisPointerClazz = {};\n/**\n * Base class of AxisView.\n */\n\nvar AxisView =\n/** @class */\nfunction (_super) {\n __extends(AxisView, _super);\n\n function AxisView() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n\n _this.type = AxisView.type;\n return _this;\n }\n /**\n * @override\n */\n\n\n AxisView.prototype.render = function (axisModel, ecModel, api, payload) {\n // FIXME\n // This process should proformed after coordinate systems updated\n // (axis scale updated), and should be performed each time update.\n // So put it here temporarily, although it is not appropriate to\n // put a model-writing procedure in `view`.\n this.axisPointerClass && axisPointerModelHelper.fixValue(axisModel);\n\n _super.prototype.render.apply(this, arguments);\n\n this._doUpdateAxisPointerClass(axisModel, api, true);\n };\n /**\n * Action handler.\n */\n\n\n AxisView.prototype.updateAxisPointer = function (axisModel, ecModel, api, payload) {\n this._doUpdateAxisPointerClass(axisModel, api, false);\n };\n /**\n * @override\n */\n\n\n AxisView.prototype.remove = function (ecModel, api) {\n var axisPointer = this._axisPointer;\n axisPointer && axisPointer.remove(api);\n };\n /**\n * @override\n */\n\n\n AxisView.prototype.dispose = function (ecModel, api) {\n this._disposeAxisPointer(api);\n\n _super.prototype.dispose.apply(this, arguments);\n };\n\n AxisView.prototype._doUpdateAxisPointerClass = function (axisModel, api, forceRender) {\n var Clazz = AxisView.getAxisPointerClass(this.axisPointerClass);\n\n if (!Clazz) {\n return;\n }\n\n var axisPointerModel = axisPointerModelHelper.getAxisPointerModel(axisModel);\n axisPointerModel ? (this._axisPointer || (this._axisPointer = new Clazz())).render(axisModel, axisPointerModel, api, forceRender) : this._disposeAxisPointer(api);\n };\n\n AxisView.prototype._disposeAxisPointer = function (api) {\n this._axisPointer && this._axisPointer.dispose(api);\n this._axisPointer = null;\n };\n\n AxisView.registerAxisPointerClass = function (type, clazz) {\n if (process.env.NODE_ENV !== 'production') {\n if (axisPointerClazz[type]) {\n throw new Error('axisPointer ' + type + ' exists');\n }\n }\n\n axisPointerClazz[type] = clazz;\n };\n\n ;\n\n AxisView.getAxisPointerClass = function (type) {\n return type && axisPointerClazz[type];\n };\n\n ;\n AxisView.type = 'axis';\n return AxisView;\n}(ComponentView);\n\nexport default AxisView;","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport * as zrUtil from 'zrender/lib/core/util.js';\nimport * as graphic from '../../util/graphic.js';\nimport { makeInner } from '../../util/model.js';\nvar inner = makeInner();\nexport function rectCoordAxisBuildSplitArea(axisView, axisGroup, axisModel, gridModel) {\n var axis = axisModel.axis;\n\n if (axis.scale.isBlank()) {\n return;\n } // TODO: TYPE\n\n\n var splitAreaModel = axisModel.getModel('splitArea');\n var areaStyleModel = splitAreaModel.getModel('areaStyle');\n var areaColors = areaStyleModel.get('color');\n var gridRect = gridModel.coordinateSystem.getRect();\n var ticksCoords = axis.getTicksCoords({\n tickModel: splitAreaModel,\n clamp: true\n });\n\n if (!ticksCoords.length) {\n return;\n } // For Making appropriate splitArea animation, the color and anid\n // should be corresponding to previous one if possible.\n\n\n var areaColorsLen = areaColors.length;\n var lastSplitAreaColors = inner(axisView).splitAreaColors;\n var newSplitAreaColors = zrUtil.createHashMap();\n var colorIndex = 0;\n\n if (lastSplitAreaColors) {\n for (var i = 0; i < ticksCoords.length; i++) {\n var cIndex = lastSplitAreaColors.get(ticksCoords[i].tickValue);\n\n if (cIndex != null) {\n colorIndex = (cIndex + (areaColorsLen - 1) * i) % areaColorsLen;\n break;\n }\n }\n }\n\n var prev = axis.toGlobalCoord(ticksCoords[0].coord);\n var areaStyle = areaStyleModel.getAreaStyle();\n areaColors = zrUtil.isArray(areaColors) ? areaColors : [areaColors];\n\n for (var i = 1; i < ticksCoords.length; i++) {\n var tickCoord = axis.toGlobalCoord(ticksCoords[i].coord);\n var x = void 0;\n var y = void 0;\n var width = void 0;\n var height = void 0;\n\n if (axis.isHorizontal()) {\n x = prev;\n y = gridRect.y;\n width = tickCoord - x;\n height = gridRect.height;\n prev = x + width;\n } else {\n x = gridRect.x;\n y = prev;\n width = gridRect.width;\n height = tickCoord - y;\n prev = y + height;\n }\n\n var tickValue = ticksCoords[i - 1].tickValue;\n tickValue != null && newSplitAreaColors.set(tickValue, colorIndex);\n axisGroup.add(new graphic.Rect({\n anid: tickValue != null ? 'area_' + tickValue : null,\n shape: {\n x: x,\n y: y,\n width: width,\n height: height\n },\n style: zrUtil.defaults({\n fill: areaColors[colorIndex]\n }, areaStyle),\n autoBatch: true,\n silent: true\n }));\n colorIndex = (colorIndex + 1) % areaColorsLen;\n }\n\n inner(axisView).splitAreaColors = newSplitAreaColors;\n}\nexport function rectCoordAxisHandleRemove(axisView) {\n inner(axisView).splitAreaColors = null;\n}","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { __extends } from \"tslib\";\nimport * as zrUtil from 'zrender/lib/core/util.js';\nimport * as graphic from '../../util/graphic.js';\nimport AxisBuilder from './AxisBuilder.js';\nimport AxisView from './AxisView.js';\nimport * as cartesianAxisHelper from '../../coord/cartesian/cartesianAxisHelper.js';\nimport { rectCoordAxisBuildSplitArea, rectCoordAxisHandleRemove } from './axisSplitHelper.js';\nimport { isIntervalOrLogScale } from '../../scale/helper.js';\nvar axisBuilderAttrs = ['axisLine', 'axisTickLabel', 'axisName'];\nvar selfBuilderAttrs = ['splitArea', 'splitLine', 'minorSplitLine'];\n\nvar CartesianAxisView =\n/** @class */\nfunction (_super) {\n __extends(CartesianAxisView, _super);\n\n function CartesianAxisView() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n\n _this.type = CartesianAxisView.type;\n _this.axisPointerClass = 'CartesianAxisPointer';\n return _this;\n }\n /**\n * @override\n */\n\n\n CartesianAxisView.prototype.render = function (axisModel, ecModel, api, payload) {\n this.group.removeAll();\n var oldAxisGroup = this._axisGroup;\n this._axisGroup = new graphic.Group();\n this.group.add(this._axisGroup);\n\n if (!axisModel.get('show')) {\n return;\n }\n\n var gridModel = axisModel.getCoordSysModel();\n var layout = cartesianAxisHelper.layout(gridModel, axisModel);\n var axisBuilder = new AxisBuilder(axisModel, zrUtil.extend({\n handleAutoShown: function (elementType) {\n var cartesians = gridModel.coordinateSystem.getCartesians();\n\n for (var i = 0; i < cartesians.length; i++) {\n if (isIntervalOrLogScale(cartesians[i].getOtherAxis(axisModel.axis).scale)) {\n // Still show axis tick or axisLine if other axis is value / log\n return true;\n }\n } // Not show axisTick or axisLine if other axis is category / time\n\n\n return false;\n }\n }, layout));\n zrUtil.each(axisBuilderAttrs, axisBuilder.add, axisBuilder);\n\n this._axisGroup.add(axisBuilder.getGroup());\n\n zrUtil.each(selfBuilderAttrs, function (name) {\n if (axisModel.get([name, 'show'])) {\n axisElementBuilders[name](this, this._axisGroup, axisModel, gridModel);\n }\n }, this); // THIS is a special case for bar racing chart.\n // Update the axis label from the natural initial layout to\n // sorted layout should has no animation.\n\n var isInitialSortFromBarRacing = payload && payload.type === 'changeAxisOrder' && payload.isInitSort;\n\n if (!isInitialSortFromBarRacing) {\n graphic.groupTransition(oldAxisGroup, this._axisGroup, axisModel);\n }\n\n _super.prototype.render.call(this, axisModel, ecModel, api, payload);\n };\n\n CartesianAxisView.prototype.remove = function () {\n rectCoordAxisHandleRemove(this);\n };\n\n CartesianAxisView.type = 'cartesianAxis';\n return CartesianAxisView;\n}(AxisView);\n\nvar axisElementBuilders = {\n splitLine: function (axisView, axisGroup, axisModel, gridModel) {\n var axis = axisModel.axis;\n\n if (axis.scale.isBlank()) {\n return;\n }\n\n var splitLineModel = axisModel.getModel('splitLine');\n var lineStyleModel = splitLineModel.getModel('lineStyle');\n var lineColors = lineStyleModel.get('color');\n lineColors = zrUtil.isArray(lineColors) ? lineColors : [lineColors];\n var gridRect = gridModel.coordinateSystem.getRect();\n var isHorizontal = axis.isHorizontal();\n var lineCount = 0;\n var ticksCoords = axis.getTicksCoords({\n tickModel: splitLineModel\n });\n var p1 = [];\n var p2 = [];\n var lineStyle = lineStyleModel.getLineStyle();\n\n for (var i = 0; i < ticksCoords.length; i++) {\n var tickCoord = axis.toGlobalCoord(ticksCoords[i].coord);\n\n if (isHorizontal) {\n p1[0] = tickCoord;\n p1[1] = gridRect.y;\n p2[0] = tickCoord;\n p2[1] = gridRect.y + gridRect.height;\n } else {\n p1[0] = gridRect.x;\n p1[1] = tickCoord;\n p2[0] = gridRect.x + gridRect.width;\n p2[1] = tickCoord;\n }\n\n var colorIndex = lineCount++ % lineColors.length;\n var tickValue = ticksCoords[i].tickValue;\n axisGroup.add(new graphic.Line({\n anid: tickValue != null ? 'line_' + ticksCoords[i].tickValue : null,\n subPixelOptimize: true,\n autoBatch: true,\n shape: {\n x1: p1[0],\n y1: p1[1],\n x2: p2[0],\n y2: p2[1]\n },\n style: zrUtil.defaults({\n stroke: lineColors[colorIndex]\n }, lineStyle),\n silent: true\n }));\n }\n },\n minorSplitLine: function (axisView, axisGroup, axisModel, gridModel) {\n var axis = axisModel.axis;\n var minorSplitLineModel = axisModel.getModel('minorSplitLine');\n var lineStyleModel = minorSplitLineModel.getModel('lineStyle');\n var gridRect = gridModel.coordinateSystem.getRect();\n var isHorizontal = axis.isHorizontal();\n var minorTicksCoords = axis.getMinorTicksCoords();\n\n if (!minorTicksCoords.length) {\n return;\n }\n\n var p1 = [];\n var p2 = [];\n var lineStyle = lineStyleModel.getLineStyle();\n\n for (var i = 0; i < minorTicksCoords.length; i++) {\n for (var k = 0; k < minorTicksCoords[i].length; k++) {\n var tickCoord = axis.toGlobalCoord(minorTicksCoords[i][k].coord);\n\n if (isHorizontal) {\n p1[0] = tickCoord;\n p1[1] = gridRect.y;\n p2[0] = tickCoord;\n p2[1] = gridRect.y + gridRect.height;\n } else {\n p1[0] = gridRect.x;\n p1[1] = tickCoord;\n p2[0] = gridRect.x + gridRect.width;\n p2[1] = tickCoord;\n }\n\n axisGroup.add(new graphic.Line({\n anid: 'minor_line_' + minorTicksCoords[i][k].tickValue,\n subPixelOptimize: true,\n autoBatch: true,\n shape: {\n x1: p1[0],\n y1: p1[1],\n x2: p2[0],\n y2: p2[1]\n },\n style: lineStyle,\n silent: true\n }));\n }\n }\n },\n splitArea: function (axisView, axisGroup, axisModel, gridModel) {\n rectCoordAxisBuildSplitArea(axisView, axisGroup, axisModel, gridModel);\n }\n};\n\nvar CartesianXAxisView =\n/** @class */\nfunction (_super) {\n __extends(CartesianXAxisView, _super);\n\n function CartesianXAxisView() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n\n _this.type = CartesianXAxisView.type;\n return _this;\n }\n\n CartesianXAxisView.type = 'xAxis';\n return CartesianXAxisView;\n}(CartesianAxisView);\n\nexport { CartesianXAxisView };\n\nvar CartesianYAxisView =\n/** @class */\nfunction (_super) {\n __extends(CartesianYAxisView, _super);\n\n function CartesianYAxisView() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n\n _this.type = CartesianXAxisView.type;\n return _this;\n }\n\n CartesianYAxisView.type = 'yAxis';\n return CartesianYAxisView;\n}(CartesianAxisView);\n\nexport { CartesianYAxisView };\nexport default CartesianAxisView;","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { __extends } from \"tslib\";\nimport ComponentView from '../../view/Component.js';\nimport GridModel from '../../coord/cartesian/GridModel.js';\nimport { Rect } from '../../util/graphic.js';\nimport { defaults } from 'zrender/lib/core/util.js';\nimport { CartesianAxisModel } from '../../coord/cartesian/AxisModel.js';\nimport axisModelCreator from '../../coord/axisModelCreator.js';\nimport Grid from '../../coord/cartesian/Grid.js';\nimport { CartesianXAxisView, CartesianYAxisView } from '../axis/CartesianAxisView.js'; // Grid view\n\nvar GridView =\n/** @class */\nfunction (_super) {\n __extends(GridView, _super);\n\n function GridView() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n\n _this.type = 'grid';\n return _this;\n }\n\n GridView.prototype.render = function (gridModel, ecModel) {\n this.group.removeAll();\n\n if (gridModel.get('show')) {\n this.group.add(new Rect({\n shape: gridModel.coordinateSystem.getRect(),\n style: defaults({\n fill: gridModel.get('backgroundColor')\n }, gridModel.getItemStyle()),\n silent: true,\n z2: -1\n }));\n }\n };\n\n GridView.type = 'grid';\n return GridView;\n}(ComponentView);\n\nvar extraOption = {\n // gridIndex: 0,\n // gridId: '',\n offset: 0\n};\nexport function install(registers) {\n registers.registerComponentView(GridView);\n registers.registerComponentModel(GridModel);\n registers.registerCoordinateSystem('cartesian2d', Grid);\n axisModelCreator(registers, 'x', CartesianAxisModel, extraOption);\n axisModelCreator(registers, 'y', CartesianAxisModel, extraOption);\n registers.registerComponentView(CartesianXAxisView);\n registers.registerComponentView(CartesianYAxisView);\n registers.registerPreprocessor(function (option) {\n // Only create grid when need\n if (option.xAxis && option.yAxis && !option.grid) {\n option.grid = {};\n }\n });\n}","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { use } from '../../extension.js';\nimport ScatterSeriesModel from './ScatterSeries.js';\nimport ScatterView from './ScatterView.js';\nimport { install as installGridSimple } from '../../component/grid/installSimple.js';\nimport layoutPoints from '../../layout/points.js';\nexport function install(registers) {\n // In case developer forget to include grid component\n use(installGridSimple);\n registers.registerSeriesModel(ScatterSeriesModel);\n registers.registerChartView(ScatterView);\n registers.registerLayout(layoutPoints('scatter'));\n}","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport * as zrUtil from 'zrender/lib/core/util.js';\nexport default function radarLayout(ecModel) {\n ecModel.eachSeriesByType('radar', function (seriesModel) {\n var data = seriesModel.getData();\n var points = [];\n var coordSys = seriesModel.coordinateSystem;\n\n if (!coordSys) {\n return;\n }\n\n var axes = coordSys.getIndicatorAxes();\n zrUtil.each(axes, function (axis, axisIndex) {\n data.each(data.mapDimension(axes[axisIndex].dim), function (val, dataIndex) {\n points[dataIndex] = points[dataIndex] || [];\n var point = coordSys.dataToPoint(val, axisIndex);\n points[dataIndex][axisIndex] = isValidPoint(point) ? point : getValueMissingPoint(coordSys);\n });\n }); // Close polygon\n\n data.each(function (idx) {\n // TODO\n // Is it appropriate to connect to the next data when some data is missing?\n // Or, should trade it like `connectNull` in line chart?\n var firstPoint = zrUtil.find(points[idx], function (point) {\n return isValidPoint(point);\n }) || getValueMissingPoint(coordSys); // Copy the first actual point to the end of the array\n\n points[idx].push(firstPoint.slice());\n data.setItemLayout(idx, points[idx]);\n });\n });\n}\n\nfunction isValidPoint(point) {\n return !isNaN(point[0]) && !isNaN(point[1]);\n}\n\nfunction getValueMissingPoint(coordSys) {\n // It is error-prone to input [NaN, NaN] into polygon, polygon.\n // (probably cause problem when refreshing or animating)\n return [coordSys.cx, coordSys.cy];\n}","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n// @ts-nocheck\n// Backward compat for radar chart in 2\nimport * as zrUtil from 'zrender/lib/core/util.js';\nexport default function radarBackwardCompat(option) {\n var polarOptArr = option.polar;\n\n if (polarOptArr) {\n if (!zrUtil.isArray(polarOptArr)) {\n polarOptArr = [polarOptArr];\n }\n\n var polarNotRadar_1 = [];\n zrUtil.each(polarOptArr, function (polarOpt, idx) {\n if (polarOpt.indicator) {\n if (polarOpt.type && !polarOpt.shape) {\n polarOpt.shape = polarOpt.type;\n }\n\n option.radar = option.radar || [];\n\n if (!zrUtil.isArray(option.radar)) {\n option.radar = [option.radar];\n }\n\n option.radar.push(polarOpt);\n } else {\n polarNotRadar_1.push(polarOpt);\n }\n });\n option.polar = polarNotRadar_1;\n }\n\n zrUtil.each(option.series, function (seriesOpt) {\n if (seriesOpt && seriesOpt.type === 'radar' && seriesOpt.polarIndex) {\n seriesOpt.radarIndex = seriesOpt.polarIndex;\n }\n });\n}","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { __extends } from \"tslib\";\nimport * as graphic from '../../util/graphic.js';\nimport { setStatesStylesFromModel, toggleHoverEmphasis } from '../../util/states.js';\nimport * as zrUtil from 'zrender/lib/core/util.js';\nimport * as symbolUtil from '../../util/symbol.js';\nimport ChartView from '../../view/Chart.js';\nimport { setLabelStyle, getLabelStatesModels } from '../../label/labelStyle.js';\nimport ZRImage from 'zrender/lib/graphic/Image.js';\nimport { saveOldStyle } from '../../animation/basicTrasition.js';\n\nvar RadarView =\n/** @class */\nfunction (_super) {\n __extends(RadarView, _super);\n\n function RadarView() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n\n _this.type = RadarView.type;\n return _this;\n }\n\n RadarView.prototype.render = function (seriesModel, ecModel, api) {\n var polar = seriesModel.coordinateSystem;\n var group = this.group;\n var data = seriesModel.getData();\n var oldData = this._data;\n\n function createSymbol(data, idx) {\n var symbolType = data.getItemVisual(idx, 'symbol') || 'circle';\n\n if (symbolType === 'none') {\n return;\n }\n\n var symbolSize = symbolUtil.normalizeSymbolSize(data.getItemVisual(idx, 'symbolSize'));\n var symbolPath = symbolUtil.createSymbol(symbolType, -1, -1, 2, 2);\n var symbolRotate = data.getItemVisual(idx, 'symbolRotate') || 0;\n symbolPath.attr({\n style: {\n strokeNoScale: true\n },\n z2: 100,\n scaleX: symbolSize[0] / 2,\n scaleY: symbolSize[1] / 2,\n rotation: symbolRotate * Math.PI / 180 || 0\n });\n return symbolPath;\n }\n\n function updateSymbols(oldPoints, newPoints, symbolGroup, data, idx, isInit) {\n // Simply rerender all\n symbolGroup.removeAll();\n\n for (var i = 0; i < newPoints.length - 1; i++) {\n var symbolPath = createSymbol(data, idx);\n\n if (symbolPath) {\n symbolPath.__dimIdx = i;\n\n if (oldPoints[i]) {\n symbolPath.setPosition(oldPoints[i]);\n graphic[isInit ? 'initProps' : 'updateProps'](symbolPath, {\n x: newPoints[i][0],\n y: newPoints[i][1]\n }, seriesModel, idx);\n } else {\n symbolPath.setPosition(newPoints[i]);\n }\n\n symbolGroup.add(symbolPath);\n }\n }\n }\n\n function getInitialPoints(points) {\n return zrUtil.map(points, function (pt) {\n return [polar.cx, polar.cy];\n });\n }\n\n data.diff(oldData).add(function (idx) {\n var points = data.getItemLayout(idx);\n\n if (!points) {\n return;\n }\n\n var polygon = new graphic.Polygon();\n var polyline = new graphic.Polyline();\n var target = {\n shape: {\n points: points\n }\n };\n polygon.shape.points = getInitialPoints(points);\n polyline.shape.points = getInitialPoints(points);\n graphic.initProps(polygon, target, seriesModel, idx);\n graphic.initProps(polyline, target, seriesModel, idx);\n var itemGroup = new graphic.Group();\n var symbolGroup = new graphic.Group();\n itemGroup.add(polyline);\n itemGroup.add(polygon);\n itemGroup.add(symbolGroup);\n updateSymbols(polyline.shape.points, points, symbolGroup, data, idx, true);\n data.setItemGraphicEl(idx, itemGroup);\n }).update(function (newIdx, oldIdx) {\n var itemGroup = oldData.getItemGraphicEl(oldIdx);\n var polyline = itemGroup.childAt(0);\n var polygon = itemGroup.childAt(1);\n var symbolGroup = itemGroup.childAt(2);\n var target = {\n shape: {\n points: data.getItemLayout(newIdx)\n }\n };\n\n if (!target.shape.points) {\n return;\n }\n\n updateSymbols(polyline.shape.points, target.shape.points, symbolGroup, data, newIdx, false);\n saveOldStyle(polygon);\n saveOldStyle(polyline);\n graphic.updateProps(polyline, target, seriesModel);\n graphic.updateProps(polygon, target, seriesModel);\n data.setItemGraphicEl(newIdx, itemGroup);\n }).remove(function (idx) {\n group.remove(oldData.getItemGraphicEl(idx));\n }).execute();\n data.eachItemGraphicEl(function (itemGroup, idx) {\n var itemModel = data.getItemModel(idx);\n var polyline = itemGroup.childAt(0);\n var polygon = itemGroup.childAt(1);\n var symbolGroup = itemGroup.childAt(2); // Radar uses the visual encoded from itemStyle.\n\n var itemStyle = data.getItemVisual(idx, 'style');\n var color = itemStyle.fill;\n group.add(itemGroup);\n polyline.useStyle(zrUtil.defaults(itemModel.getModel('lineStyle').getLineStyle(), {\n fill: 'none',\n stroke: color\n }));\n setStatesStylesFromModel(polyline, itemModel, 'lineStyle');\n setStatesStylesFromModel(polygon, itemModel, 'areaStyle');\n var areaStyleModel = itemModel.getModel('areaStyle');\n var polygonIgnore = areaStyleModel.isEmpty() && areaStyleModel.parentModel.isEmpty();\n polygon.ignore = polygonIgnore;\n zrUtil.each(['emphasis', 'select', 'blur'], function (stateName) {\n var stateModel = itemModel.getModel([stateName, 'areaStyle']);\n var stateIgnore = stateModel.isEmpty() && stateModel.parentModel.isEmpty(); // Won't be ignore if normal state is not ignore.\n\n polygon.ensureState(stateName).ignore = stateIgnore && polygonIgnore;\n });\n polygon.useStyle(zrUtil.defaults(areaStyleModel.getAreaStyle(), {\n fill: color,\n opacity: 0.7,\n decal: itemStyle.decal\n }));\n var emphasisModel = itemModel.getModel('emphasis');\n var itemHoverStyle = emphasisModel.getModel('itemStyle').getItemStyle();\n symbolGroup.eachChild(function (symbolPath) {\n if (symbolPath instanceof ZRImage) {\n var pathStyle = symbolPath.style;\n symbolPath.useStyle(zrUtil.extend({\n // TODO other properties like x, y ?\n image: pathStyle.image,\n x: pathStyle.x,\n y: pathStyle.y,\n width: pathStyle.width,\n height: pathStyle.height\n }, itemStyle));\n } else {\n symbolPath.useStyle(itemStyle);\n symbolPath.setColor(color);\n symbolPath.style.strokeNoScale = true;\n }\n\n var pathEmphasisState = symbolPath.ensureState('emphasis');\n pathEmphasisState.style = zrUtil.clone(itemHoverStyle);\n var defaultText = data.getStore().get(data.getDimensionIndex(symbolPath.__dimIdx), idx);\n (defaultText == null || isNaN(defaultText)) && (defaultText = '');\n setLabelStyle(symbolPath, getLabelStatesModels(itemModel), {\n labelFetcher: data.hostModel,\n labelDataIndex: idx,\n labelDimIndex: symbolPath.__dimIdx,\n defaultText: defaultText,\n inheritColor: color,\n defaultOpacity: itemStyle.opacity\n });\n });\n toggleHoverEmphasis(itemGroup, emphasisModel.get('focus'), emphasisModel.get('blurScope'), emphasisModel.get('disabled'));\n });\n this._data = data;\n };\n\n RadarView.prototype.remove = function () {\n this.group.removeAll();\n this._data = null;\n };\n\n RadarView.type = 'radar';\n return RadarView;\n}(ChartView);\n\nexport default RadarView;","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { __extends } from \"tslib\";\nimport SeriesModel from '../../model/Series.js';\nimport createSeriesDataSimply from '../helper/createSeriesDataSimply.js';\nimport * as zrUtil from 'zrender/lib/core/util.js';\nimport LegendVisualProvider from '../../visual/LegendVisualProvider.js';\nimport { createTooltipMarkup, retrieveVisualColorForTooltipMarker } from '../../component/tooltip/tooltipMarkup.js';\n\nvar RadarSeriesModel =\n/** @class */\nfunction (_super) {\n __extends(RadarSeriesModel, _super);\n\n function RadarSeriesModel() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n\n _this.type = RadarSeriesModel.type;\n _this.hasSymbolVisual = true;\n return _this;\n } // Overwrite\n\n\n RadarSeriesModel.prototype.init = function (option) {\n _super.prototype.init.apply(this, arguments); // Enable legend selection for each data item\n // Use a function instead of direct access because data reference may changed\n\n\n this.legendVisualProvider = new LegendVisualProvider(zrUtil.bind(this.getData, this), zrUtil.bind(this.getRawData, this));\n };\n\n RadarSeriesModel.prototype.getInitialData = function (option, ecModel) {\n return createSeriesDataSimply(this, {\n generateCoord: 'indicator_',\n generateCoordCount: Infinity\n });\n };\n\n RadarSeriesModel.prototype.formatTooltip = function (dataIndex, multipleSeries, dataType) {\n var data = this.getData();\n var coordSys = this.coordinateSystem;\n var indicatorAxes = coordSys.getIndicatorAxes();\n var name = this.getData().getName(dataIndex);\n var nameToDisplay = name === '' ? this.name : name;\n var markerColor = retrieveVisualColorForTooltipMarker(this, dataIndex);\n return createTooltipMarkup('section', {\n header: nameToDisplay,\n sortBlocks: true,\n blocks: zrUtil.map(indicatorAxes, function (axis) {\n var val = data.get(data.mapDimension(axis.dim), dataIndex);\n return createTooltipMarkup('nameValue', {\n markerType: 'subItem',\n markerColor: markerColor,\n name: axis.name,\n value: val,\n sortParam: val\n });\n })\n });\n };\n\n RadarSeriesModel.prototype.getTooltipPosition = function (dataIndex) {\n if (dataIndex != null) {\n var data_1 = this.getData();\n var coordSys = this.coordinateSystem;\n var values = data_1.getValues(zrUtil.map(coordSys.dimensions, function (dim) {\n return data_1.mapDimension(dim);\n }), dataIndex);\n\n for (var i = 0, len = values.length; i < len; i++) {\n if (!isNaN(values[i])) {\n var indicatorAxes = coordSys.getIndicatorAxes();\n return coordSys.coordToPoint(indicatorAxes[i].dataToCoord(values[i]), i);\n }\n }\n }\n };\n\n RadarSeriesModel.type = 'series.radar';\n RadarSeriesModel.dependencies = ['radar'];\n RadarSeriesModel.defaultOption = {\n // zlevel: 0,\n z: 2,\n colorBy: 'data',\n coordinateSystem: 'radar',\n legendHoverLink: true,\n radarIndex: 0,\n lineStyle: {\n width: 2,\n type: 'solid',\n join: 'round'\n },\n label: {\n position: 'top'\n },\n // areaStyle: {\n // },\n // itemStyle: {}\n symbolSize: 8 // symbolRotate: null\n\n };\n return RadarSeriesModel;\n}(SeriesModel);\n\nexport default RadarSeriesModel;","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { __extends } from \"tslib\";\nimport * as zrUtil from 'zrender/lib/core/util.js';\nimport axisDefault from '../axisDefault.js';\nimport Model from '../../model/Model.js';\nimport { AxisModelCommonMixin } from '../axisModelCommonMixin.js';\nimport ComponentModel from '../../model/Component.js';\nvar valueAxisDefault = axisDefault.value;\n\nfunction defaultsShow(opt, show) {\n return zrUtil.defaults({\n show: show\n }, opt);\n}\n\nvar RadarModel =\n/** @class */\nfunction (_super) {\n __extends(RadarModel, _super);\n\n function RadarModel() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n\n _this.type = RadarModel.type;\n return _this;\n }\n\n RadarModel.prototype.optionUpdated = function () {\n var boundaryGap = this.get('boundaryGap');\n var splitNumber = this.get('splitNumber');\n var scale = this.get('scale');\n var axisLine = this.get('axisLine');\n var axisTick = this.get('axisTick'); // let axisType = this.get('axisType');\n\n var axisLabel = this.get('axisLabel');\n var nameTextStyle = this.get('axisName');\n var showName = this.get(['axisName', 'show']);\n var nameFormatter = this.get(['axisName', 'formatter']);\n var nameGap = this.get('axisNameGap');\n var triggerEvent = this.get('triggerEvent');\n var indicatorModels = zrUtil.map(this.get('indicator') || [], function (indicatorOpt) {\n // PENDING\n if (indicatorOpt.max != null && indicatorOpt.max > 0 && !indicatorOpt.min) {\n indicatorOpt.min = 0;\n } else if (indicatorOpt.min != null && indicatorOpt.min < 0 && !indicatorOpt.max) {\n indicatorOpt.max = 0;\n }\n\n var iNameTextStyle = nameTextStyle;\n\n if (indicatorOpt.color != null) {\n iNameTextStyle = zrUtil.defaults({\n color: indicatorOpt.color\n }, nameTextStyle);\n } // Use same configuration\n\n\n var innerIndicatorOpt = zrUtil.merge(zrUtil.clone(indicatorOpt), {\n boundaryGap: boundaryGap,\n splitNumber: splitNumber,\n scale: scale,\n axisLine: axisLine,\n axisTick: axisTick,\n // axisType: axisType,\n axisLabel: axisLabel,\n // Compatible with 2 and use text\n name: indicatorOpt.text,\n showName: showName,\n nameLocation: 'end',\n nameGap: nameGap,\n // min: 0,\n nameTextStyle: iNameTextStyle,\n triggerEvent: triggerEvent\n }, false);\n\n if (!showName) {\n innerIndicatorOpt.name = '';\n }\n\n if (zrUtil.isString(nameFormatter)) {\n var indName = innerIndicatorOpt.name;\n innerIndicatorOpt.name = nameFormatter.replace('{value}', indName != null ? indName : '');\n } else if (zrUtil.isFunction(nameFormatter)) {\n innerIndicatorOpt.name = nameFormatter(innerIndicatorOpt.name, innerIndicatorOpt);\n }\n\n var model = new Model(innerIndicatorOpt, null, this.ecModel);\n zrUtil.mixin(model, AxisModelCommonMixin.prototype); // For triggerEvent.\n\n model.mainType = 'radar';\n model.componentIndex = this.componentIndex;\n return model;\n }, this);\n this._indicatorModels = indicatorModels;\n };\n\n RadarModel.prototype.getIndicatorModels = function () {\n return this._indicatorModels;\n };\n\n RadarModel.type = 'radar';\n RadarModel.defaultOption = {\n // zlevel: 0,\n z: 0,\n center: ['50%', '50%'],\n radius: '75%',\n startAngle: 90,\n axisName: {\n show: true // formatter: null\n // textStyle: {}\n\n },\n boundaryGap: [0, 0],\n splitNumber: 5,\n axisNameGap: 15,\n scale: false,\n // Polygon or circle\n shape: 'polygon',\n axisLine: zrUtil.merge({\n lineStyle: {\n color: '#bbb'\n }\n }, valueAxisDefault.axisLine),\n axisLabel: defaultsShow(valueAxisDefault.axisLabel, false),\n axisTick: defaultsShow(valueAxisDefault.axisTick, false),\n // axisType: 'value',\n splitLine: defaultsShow(valueAxisDefault.splitLine, true),\n splitArea: defaultsShow(valueAxisDefault.splitArea, true),\n // {text, min, max}\n indicator: []\n };\n return RadarModel;\n}(ComponentModel);\n\nexport default RadarModel;","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { __extends } from \"tslib\";\nimport * as zrUtil from 'zrender/lib/core/util.js';\nimport AxisBuilder from '../axis/AxisBuilder.js';\nimport * as graphic from '../../util/graphic.js';\nimport ComponentView from '../../view/Component.js';\nvar axisBuilderAttrs = ['axisLine', 'axisTickLabel', 'axisName'];\n\nvar RadarView =\n/** @class */\nfunction (_super) {\n __extends(RadarView, _super);\n\n function RadarView() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n\n _this.type = RadarView.type;\n return _this;\n }\n\n RadarView.prototype.render = function (radarModel, ecModel, api) {\n var group = this.group;\n group.removeAll();\n\n this._buildAxes(radarModel);\n\n this._buildSplitLineAndArea(radarModel);\n };\n\n RadarView.prototype._buildAxes = function (radarModel) {\n var radar = radarModel.coordinateSystem;\n var indicatorAxes = radar.getIndicatorAxes();\n var axisBuilders = zrUtil.map(indicatorAxes, function (indicatorAxis) {\n var axisName = indicatorAxis.model.get('showName') ? indicatorAxis.name : ''; // hide name\n\n var axisBuilder = new AxisBuilder(indicatorAxis.model, {\n axisName: axisName,\n position: [radar.cx, radar.cy],\n rotation: indicatorAxis.angle,\n labelDirection: -1,\n tickDirection: -1,\n nameDirection: 1\n });\n return axisBuilder;\n });\n zrUtil.each(axisBuilders, function (axisBuilder) {\n zrUtil.each(axisBuilderAttrs, axisBuilder.add, axisBuilder);\n this.group.add(axisBuilder.getGroup());\n }, this);\n };\n\n RadarView.prototype._buildSplitLineAndArea = function (radarModel) {\n var radar = radarModel.coordinateSystem;\n var indicatorAxes = radar.getIndicatorAxes();\n\n if (!indicatorAxes.length) {\n return;\n }\n\n var shape = radarModel.get('shape');\n var splitLineModel = radarModel.getModel('splitLine');\n var splitAreaModel = radarModel.getModel('splitArea');\n var lineStyleModel = splitLineModel.getModel('lineStyle');\n var areaStyleModel = splitAreaModel.getModel('areaStyle');\n var showSplitLine = splitLineModel.get('show');\n var showSplitArea = splitAreaModel.get('show');\n var splitLineColors = lineStyleModel.get('color');\n var splitAreaColors = areaStyleModel.get('color');\n var splitLineColorsArr = zrUtil.isArray(splitLineColors) ? splitLineColors : [splitLineColors];\n var splitAreaColorsArr = zrUtil.isArray(splitAreaColors) ? splitAreaColors : [splitAreaColors];\n var splitLines = [];\n var splitAreas = [];\n\n function getColorIndex(areaOrLine, areaOrLineColorList, idx) {\n var colorIndex = idx % areaOrLineColorList.length;\n areaOrLine[colorIndex] = areaOrLine[colorIndex] || [];\n return colorIndex;\n }\n\n if (shape === 'circle') {\n var ticksRadius = indicatorAxes[0].getTicksCoords();\n var cx = radar.cx;\n var cy = radar.cy;\n\n for (var i = 0; i < ticksRadius.length; i++) {\n if (showSplitLine) {\n var colorIndex = getColorIndex(splitLines, splitLineColorsArr, i);\n splitLines[colorIndex].push(new graphic.Circle({\n shape: {\n cx: cx,\n cy: cy,\n r: ticksRadius[i].coord\n }\n }));\n }\n\n if (showSplitArea && i < ticksRadius.length - 1) {\n var colorIndex = getColorIndex(splitAreas, splitAreaColorsArr, i);\n splitAreas[colorIndex].push(new graphic.Ring({\n shape: {\n cx: cx,\n cy: cy,\n r0: ticksRadius[i].coord,\n r: ticksRadius[i + 1].coord\n }\n }));\n }\n }\n } // Polyyon\n else {\n var realSplitNumber_1;\n var axesTicksPoints = zrUtil.map(indicatorAxes, function (indicatorAxis, idx) {\n var ticksCoords = indicatorAxis.getTicksCoords();\n realSplitNumber_1 = realSplitNumber_1 == null ? ticksCoords.length - 1 : Math.min(ticksCoords.length - 1, realSplitNumber_1);\n return zrUtil.map(ticksCoords, function (tickCoord) {\n return radar.coordToPoint(tickCoord.coord, idx);\n });\n });\n var prevPoints = [];\n\n for (var i = 0; i <= realSplitNumber_1; i++) {\n var points = [];\n\n for (var j = 0; j < indicatorAxes.length; j++) {\n points.push(axesTicksPoints[j][i]);\n } // Close\n\n\n if (points[0]) {\n points.push(points[0].slice());\n } else {\n if (process.env.NODE_ENV !== 'production') {\n console.error('Can\\'t draw value axis ' + i);\n }\n }\n\n if (showSplitLine) {\n var colorIndex = getColorIndex(splitLines, splitLineColorsArr, i);\n splitLines[colorIndex].push(new graphic.Polyline({\n shape: {\n points: points\n }\n }));\n }\n\n if (showSplitArea && prevPoints) {\n var colorIndex = getColorIndex(splitAreas, splitAreaColorsArr, i - 1);\n splitAreas[colorIndex].push(new graphic.Polygon({\n shape: {\n points: points.concat(prevPoints)\n }\n }));\n }\n\n prevPoints = points.slice().reverse();\n }\n }\n\n var lineStyle = lineStyleModel.getLineStyle();\n var areaStyle = areaStyleModel.getAreaStyle(); // Add splitArea before splitLine\n\n zrUtil.each(splitAreas, function (splitAreas, idx) {\n this.group.add(graphic.mergePath(splitAreas, {\n style: zrUtil.defaults({\n stroke: 'none',\n fill: splitAreaColorsArr[idx % splitAreaColorsArr.length]\n }, areaStyle),\n silent: true\n }));\n }, this);\n zrUtil.each(splitLines, function (splitLines, idx) {\n this.group.add(graphic.mergePath(splitLines, {\n style: zrUtil.defaults({\n fill: 'none',\n stroke: splitLineColorsArr[idx % splitLineColorsArr.length]\n }, lineStyle),\n silent: true\n }));\n }, this);\n };\n\n RadarView.type = 'radar';\n return RadarView;\n}(ComponentView);\n\nexport default RadarView;","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { __extends } from \"tslib\";\nimport Axis from '../Axis.js';\n\nvar IndicatorAxis =\n/** @class */\nfunction (_super) {\n __extends(IndicatorAxis, _super);\n\n function IndicatorAxis(dim, scale, radiusExtent) {\n var _this = _super.call(this, dim, scale, radiusExtent) || this;\n\n _this.type = 'value';\n _this.angle = 0;\n _this.name = '';\n return _this;\n }\n\n return IndicatorAxis;\n}(Axis);\n\nexport default IndicatorAxis;","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n// TODO clockwise\nimport IndicatorAxis from './IndicatorAxis.js';\nimport IntervalScale from '../../scale/Interval.js';\nimport * as numberUtil from '../../util/number.js';\nimport { map, each, isString, isNumber } from 'zrender/lib/core/util.js';\nimport { alignScaleTicks } from '../axisAlignTicks.js';\n\nvar Radar =\n/** @class */\nfunction () {\n function Radar(radarModel, ecModel, api) {\n /**\n *\n * Radar dimensions\n */\n this.dimensions = [];\n this._model = radarModel;\n this._indicatorAxes = map(radarModel.getIndicatorModels(), function (indicatorModel, idx) {\n var dim = 'indicator_' + idx;\n var indicatorAxis = new IndicatorAxis(dim, new IntervalScale() // (indicatorModel.get('axisType') === 'log') ? new LogScale() : new IntervalScale()\n );\n indicatorAxis.name = indicatorModel.get('name'); // Inject model and axis\n\n indicatorAxis.model = indicatorModel;\n indicatorModel.axis = indicatorAxis;\n this.dimensions.push(dim);\n return indicatorAxis;\n }, this);\n this.resize(radarModel, api);\n }\n\n Radar.prototype.getIndicatorAxes = function () {\n return this._indicatorAxes;\n };\n\n Radar.prototype.dataToPoint = function (value, indicatorIndex) {\n var indicatorAxis = this._indicatorAxes[indicatorIndex];\n return this.coordToPoint(indicatorAxis.dataToCoord(value), indicatorIndex);\n }; // TODO: API should be coordToPoint([coord, indicatorIndex])\n\n\n Radar.prototype.coordToPoint = function (coord, indicatorIndex) {\n var indicatorAxis = this._indicatorAxes[indicatorIndex];\n var angle = indicatorAxis.angle;\n var x = this.cx + coord * Math.cos(angle);\n var y = this.cy - coord * Math.sin(angle);\n return [x, y];\n };\n\n Radar.prototype.pointToData = function (pt) {\n var dx = pt[0] - this.cx;\n var dy = pt[1] - this.cy;\n var radius = Math.sqrt(dx * dx + dy * dy);\n dx /= radius;\n dy /= radius;\n var radian = Math.atan2(-dy, dx); // Find the closest angle\n // FIXME index can calculated directly\n\n var minRadianDiff = Infinity;\n var closestAxis;\n var closestAxisIdx = -1;\n\n for (var i = 0; i < this._indicatorAxes.length; i++) {\n var indicatorAxis = this._indicatorAxes[i];\n var diff = Math.abs(radian - indicatorAxis.angle);\n\n if (diff < minRadianDiff) {\n closestAxis = indicatorAxis;\n closestAxisIdx = i;\n minRadianDiff = diff;\n }\n }\n\n return [closestAxisIdx, +(closestAxis && closestAxis.coordToData(radius))];\n };\n\n Radar.prototype.resize = function (radarModel, api) {\n var center = radarModel.get('center');\n var viewWidth = api.getWidth();\n var viewHeight = api.getHeight();\n var viewSize = Math.min(viewWidth, viewHeight) / 2;\n this.cx = numberUtil.parsePercent(center[0], viewWidth);\n this.cy = numberUtil.parsePercent(center[1], viewHeight);\n this.startAngle = radarModel.get('startAngle') * Math.PI / 180; // radius may be single value like `20`, `'80%'`, or array like `[10, '80%']`\n\n var radius = radarModel.get('radius');\n\n if (isString(radius) || isNumber(radius)) {\n radius = [0, radius];\n }\n\n this.r0 = numberUtil.parsePercent(radius[0], viewSize);\n this.r = numberUtil.parsePercent(radius[1], viewSize);\n each(this._indicatorAxes, function (indicatorAxis, idx) {\n indicatorAxis.setExtent(this.r0, this.r);\n var angle = this.startAngle + idx * Math.PI * 2 / this._indicatorAxes.length; // Normalize to [-PI, PI]\n\n angle = Math.atan2(Math.sin(angle), Math.cos(angle));\n indicatorAxis.angle = angle;\n }, this);\n };\n\n Radar.prototype.update = function (ecModel, api) {\n var indicatorAxes = this._indicatorAxes;\n var radarModel = this._model;\n each(indicatorAxes, function (indicatorAxis) {\n indicatorAxis.scale.setExtent(Infinity, -Infinity);\n });\n ecModel.eachSeriesByType('radar', function (radarSeries, idx) {\n if (radarSeries.get('coordinateSystem') !== 'radar' // @ts-ignore\n || ecModel.getComponent('radar', radarSeries.get('radarIndex')) !== radarModel) {\n return;\n }\n\n var data = radarSeries.getData();\n each(indicatorAxes, function (indicatorAxis) {\n indicatorAxis.scale.unionExtentFromData(data, data.mapDimension(indicatorAxis.dim));\n });\n }, this);\n var splitNumber = radarModel.get('splitNumber');\n var dummyScale = new IntervalScale();\n dummyScale.setExtent(0, splitNumber);\n dummyScale.setInterval(1); // Force all the axis fixing the maxSplitNumber.\n\n each(indicatorAxes, function (indicatorAxis, idx) {\n alignScaleTicks(indicatorAxis.scale, indicatorAxis.model, dummyScale);\n });\n };\n\n Radar.prototype.convertToPixel = function (ecModel, finder, value) {\n console.warn('Not implemented.');\n return null;\n };\n\n Radar.prototype.convertFromPixel = function (ecModel, finder, pixel) {\n console.warn('Not implemented.');\n return null;\n };\n\n Radar.prototype.containPoint = function (point) {\n console.warn('Not implemented.');\n return false;\n };\n\n Radar.create = function (ecModel, api) {\n var radarList = [];\n ecModel.eachComponent('radar', function (radarModel) {\n var radar = new Radar(radarModel, ecModel, api);\n radarList.push(radar);\n radarModel.coordinateSystem = radar;\n });\n ecModel.eachSeriesByType('radar', function (radarSeries) {\n if (radarSeries.get('coordinateSystem') === 'radar') {\n // Inject coordinate system\n // @ts-ignore\n radarSeries.coordinateSystem = radarList[radarSeries.get('radarIndex') || 0];\n }\n });\n return radarList;\n };\n /**\n * Radar dimensions is based on the data\n */\n\n\n Radar.dimensions = [];\n return Radar;\n}();\n\nexport default Radar;","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport RadarModel from '../../coord/radar/RadarModel.js';\nimport RadarView from './RadarView.js';\nimport Radar from '../../coord/radar/Radar.js';\nexport function install(registers) {\n registers.registerCoordinateSystem('radar', Radar);\n registers.registerComponentModel(RadarModel);\n registers.registerComponentView(RadarView);\n registers.registerVisual({\n seriesType: 'radar',\n reset: function (seriesModel) {\n var data = seriesModel.getData(); // itemVisual symbol is for selected data\n\n data.each(function (idx) {\n data.setItemVisual(idx, 'legendIcon', 'roundRect');\n }); // visual is for unselected data\n\n data.setVisual('legendIcon', 'roundRect');\n }\n });\n}","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { use } from '../../extension.js';\nimport radarLayout from '../radar/radarLayout.js';\nimport dataFilter from '../../processor/dataFilter.js';\nimport backwardCompat from '../radar/backwardCompat.js';\nimport RadarView from './RadarView.js';\nimport RadarSeriesModel from './RadarSeries.js';\nimport { install as installRadarComponent } from '../../component/radar/install.js';\nexport function install(registers) {\n use(installRadarComponent);\n registers.registerChartView(RadarView);\n registers.registerSeriesModel(RadarSeriesModel);\n registers.registerLayout(radarLayout);\n registers.registerProcessor(dataFilter('radar'));\n registers.registerPreprocessor(backwardCompat);\n}","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n// @ts-nocheck\nimport * as echarts from '../../core/echarts.js';\nimport { noop } from 'zrender/lib/core/util.js';\nvar ATTR = '\\0_ec_interaction_mutex';\nexport function take(zr, resourceKey, userKey) {\n var store = getStore(zr);\n store[resourceKey] = userKey;\n}\nexport function release(zr, resourceKey, userKey) {\n var store = getStore(zr);\n var uKey = store[resourceKey];\n\n if (uKey === userKey) {\n store[resourceKey] = null;\n }\n}\nexport function isTaken(zr, resourceKey) {\n return !!getStore(zr)[resourceKey];\n}\n\nfunction getStore(zr) {\n return zr[ATTR] || (zr[ATTR] = {});\n}\n/**\n * payload: {\n * type: 'takeGlobalCursor',\n * key: 'dataZoomSelect', or 'brush', or ...,\n * If no userKey, release global cursor.\n * }\n */\n// TODO: SELF REGISTERED.\n\n\necharts.registerAction({\n type: 'takeGlobalCursor',\n event: 'globalCursorTaken',\n update: 'update'\n}, noop);","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { __extends } from \"tslib\";\nimport Eventful from 'zrender/lib/core/Eventful.js';\nimport * as eventTool from 'zrender/lib/core/event.js';\nimport * as interactionMutex from './interactionMutex.js';\nimport { isString, bind, defaults, clone } from 'zrender/lib/core/util.js';\n;\n\nvar RoamController =\n/** @class */\nfunction (_super) {\n __extends(RoamController, _super);\n\n function RoamController(zr) {\n var _this = _super.call(this) || this;\n\n _this._zr = zr; // Avoid two roamController bind the same handler\n\n var mousedownHandler = bind(_this._mousedownHandler, _this);\n var mousemoveHandler = bind(_this._mousemoveHandler, _this);\n var mouseupHandler = bind(_this._mouseupHandler, _this);\n var mousewheelHandler = bind(_this._mousewheelHandler, _this);\n var pinchHandler = bind(_this._pinchHandler, _this);\n /**\n * Notice: only enable needed types. For example, if 'zoom'\n * is not needed, 'zoom' should not be enabled, otherwise\n * default mousewheel behaviour (scroll page) will be disabled.\n */\n\n _this.enable = function (controlType, opt) {\n // Disable previous first\n this.disable();\n this._opt = defaults(clone(opt) || {}, {\n zoomOnMouseWheel: true,\n moveOnMouseMove: true,\n // By default, wheel do not trigger move.\n moveOnMouseWheel: false,\n preventDefaultMouseMove: true\n });\n\n if (controlType == null) {\n controlType = true;\n }\n\n if (controlType === true || controlType === 'move' || controlType === 'pan') {\n zr.on('mousedown', mousedownHandler);\n zr.on('mousemove', mousemoveHandler);\n zr.on('mouseup', mouseupHandler);\n }\n\n if (controlType === true || controlType === 'scale' || controlType === 'zoom') {\n zr.on('mousewheel', mousewheelHandler);\n zr.on('pinch', pinchHandler);\n }\n };\n\n _this.disable = function () {\n zr.off('mousedown', mousedownHandler);\n zr.off('mousemove', mousemoveHandler);\n zr.off('mouseup', mouseupHandler);\n zr.off('mousewheel', mousewheelHandler);\n zr.off('pinch', pinchHandler);\n };\n\n return _this;\n }\n\n RoamController.prototype.isDragging = function () {\n return this._dragging;\n };\n\n RoamController.prototype.isPinching = function () {\n return this._pinching;\n };\n\n RoamController.prototype.setPointerChecker = function (pointerChecker) {\n this.pointerChecker = pointerChecker;\n };\n\n RoamController.prototype.dispose = function () {\n this.disable();\n };\n\n RoamController.prototype._mousedownHandler = function (e) {\n if (eventTool.isMiddleOrRightButtonOnMouseUpDown(e) || e.target && e.target.draggable) {\n return;\n }\n\n var x = e.offsetX;\n var y = e.offsetY; // Only check on mosedown, but not mousemove.\n // Mouse can be out of target when mouse moving.\n\n if (this.pointerChecker && this.pointerChecker(e, x, y)) {\n this._x = x;\n this._y = y;\n this._dragging = true;\n }\n };\n\n RoamController.prototype._mousemoveHandler = function (e) {\n if (!this._dragging || !isAvailableBehavior('moveOnMouseMove', e, this._opt) || e.gestureEvent === 'pinch' || interactionMutex.isTaken(this._zr, 'globalPan')) {\n return;\n }\n\n var x = e.offsetX;\n var y = e.offsetY;\n var oldX = this._x;\n var oldY = this._y;\n var dx = x - oldX;\n var dy = y - oldY;\n this._x = x;\n this._y = y;\n this._opt.preventDefaultMouseMove && eventTool.stop(e.event);\n trigger(this, 'pan', 'moveOnMouseMove', e, {\n dx: dx,\n dy: dy,\n oldX: oldX,\n oldY: oldY,\n newX: x,\n newY: y,\n isAvailableBehavior: null\n });\n };\n\n RoamController.prototype._mouseupHandler = function (e) {\n if (!eventTool.isMiddleOrRightButtonOnMouseUpDown(e)) {\n this._dragging = false;\n }\n };\n\n RoamController.prototype._mousewheelHandler = function (e) {\n var shouldZoom = isAvailableBehavior('zoomOnMouseWheel', e, this._opt);\n var shouldMove = isAvailableBehavior('moveOnMouseWheel', e, this._opt);\n var wheelDelta = e.wheelDelta;\n var absWheelDeltaDelta = Math.abs(wheelDelta);\n var originX = e.offsetX;\n var originY = e.offsetY; // wheelDelta maybe -0 in chrome mac.\n\n if (wheelDelta === 0 || !shouldZoom && !shouldMove) {\n return;\n } // If both `shouldZoom` and `shouldMove` is true, trigger\n // their event both, and the final behavior is determined\n // by event listener themselves.\n\n\n if (shouldZoom) {\n // Convenience:\n // Mac and VM Windows on Mac: scroll up: zoom out.\n // Windows: scroll up: zoom in.\n // FIXME: Should do more test in different environment.\n // wheelDelta is too complicated in difference nvironment\n // (https://developer.mozilla.org/en-US/docs/Web/Events/mousewheel),\n // although it has been normallized by zrender.\n // wheelDelta of mouse wheel is bigger than touch pad.\n var factor = absWheelDeltaDelta > 3 ? 1.4 : absWheelDeltaDelta > 1 ? 1.2 : 1.1;\n var scale = wheelDelta > 0 ? factor : 1 / factor;\n checkPointerAndTrigger(this, 'zoom', 'zoomOnMouseWheel', e, {\n scale: scale,\n originX: originX,\n originY: originY,\n isAvailableBehavior: null\n });\n }\n\n if (shouldMove) {\n // FIXME: Should do more test in different environment.\n var absDelta = Math.abs(wheelDelta); // wheelDelta of mouse wheel is bigger than touch pad.\n\n var scrollDelta = (wheelDelta > 0 ? 1 : -1) * (absDelta > 3 ? 0.4 : absDelta > 1 ? 0.15 : 0.05);\n checkPointerAndTrigger(this, 'scrollMove', 'moveOnMouseWheel', e, {\n scrollDelta: scrollDelta,\n originX: originX,\n originY: originY,\n isAvailableBehavior: null\n });\n }\n };\n\n RoamController.prototype._pinchHandler = function (e) {\n if (interactionMutex.isTaken(this._zr, 'globalPan')) {\n return;\n }\n\n var scale = e.pinchScale > 1 ? 1.1 : 1 / 1.1;\n checkPointerAndTrigger(this, 'zoom', null, e, {\n scale: scale,\n originX: e.pinchX,\n originY: e.pinchY,\n isAvailableBehavior: null\n });\n };\n\n return RoamController;\n}(Eventful);\n\nfunction checkPointerAndTrigger(controller, eventName, behaviorToCheck, e, contollerEvent) {\n if (controller.pointerChecker && controller.pointerChecker(e, contollerEvent.originX, contollerEvent.originY)) {\n // When mouse is out of roamController rect,\n // default befavoius should not be be disabled, otherwise\n // page sliding is disabled, contrary to expectation.\n eventTool.stop(e.event);\n trigger(controller, eventName, behaviorToCheck, e, contollerEvent);\n }\n}\n\nfunction trigger(controller, eventName, behaviorToCheck, e, contollerEvent) {\n // Also provide behavior checker for event listener, for some case that\n // multiple components share one listener.\n contollerEvent.isAvailableBehavior = bind(isAvailableBehavior, null, behaviorToCheck, e); // TODO should not have type issue.\n\n controller.trigger(eventName, contollerEvent);\n} // settings: {\n// zoomOnMouseWheel\n// moveOnMouseMove\n// moveOnMouseWheel\n// }\n// The value can be: true / false / 'shift' / 'ctrl' / 'alt'.\n\n\nfunction isAvailableBehavior(behaviorToCheck, e, settings) {\n var setting = settings[behaviorToCheck];\n return !behaviorToCheck || setting && (!isString(setting) || e.event[setting + 'Key']);\n}\n\nexport default RoamController;","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n/**\n * For geo and graph.\n */\nexport function updateViewOnPan(controllerHost, dx, dy) {\n var target = controllerHost.target;\n target.x += dx;\n target.y += dy;\n target.dirty();\n}\n/**\n * For geo and graph.\n */\n\nexport function updateViewOnZoom(controllerHost, zoomDelta, zoomX, zoomY) {\n var target = controllerHost.target;\n var zoomLimit = controllerHost.zoomLimit;\n var newZoom = controllerHost.zoom = controllerHost.zoom || 1;\n newZoom *= zoomDelta;\n\n if (zoomLimit) {\n var zoomMin = zoomLimit.min || 0;\n var zoomMax = zoomLimit.max || Infinity;\n newZoom = Math.max(Math.min(zoomMax, newZoom), zoomMin);\n }\n\n var zoomScale = newZoom / controllerHost.zoom;\n controllerHost.zoom = newZoom; // Keep the mouse center when scaling\n\n target.x -= (zoomX - target.x) * (zoomScale - 1);\n target.y -= (zoomY - target.y) * (zoomScale - 1);\n target.scaleX *= zoomScale;\n target.scaleY *= zoomScale;\n target.dirty();\n}","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nvar IRRELEVANT_EXCLUDES = {\n 'axisPointer': 1,\n 'tooltip': 1,\n 'brush': 1\n};\n/**\n * Avoid that: mouse click on a elements that is over geo or graph,\n * but roam is triggered.\n */\n\nexport function onIrrelevantElement(e, api, targetCoordSysModel) {\n var model = api.getComponentByElement(e.topTarget); // If model is axisModel, it works only if it is injected with coordinateSystem.\n\n var coordSys = model && model.coordinateSystem;\n return model && model !== targetCoordSysModel && !IRRELEVANT_EXCLUDES.hasOwnProperty(model.mainType) && coordSys && coordSys.model !== targetCoordSysModel;\n}","import Group from '../graphic/Group.js';\nimport ZRImage from '../graphic/Image.js';\nimport Circle from '../graphic/shape/Circle.js';\nimport Rect from '../graphic/shape/Rect.js';\nimport Ellipse from '../graphic/shape/Ellipse.js';\nimport Line from '../graphic/shape/Line.js';\nimport Polygon from '../graphic/shape/Polygon.js';\nimport Polyline from '../graphic/shape/Polyline.js';\nimport * as matrix from '../core/matrix.js';\nimport { createFromString } from './path.js';\nimport { defaults, trim, each, map, keys, hasOwn } from '../core/util.js';\nimport LinearGradient from '../graphic/LinearGradient.js';\nimport RadialGradient from '../graphic/RadialGradient.js';\nimport TSpan from '../graphic/TSpan.js';\nimport { parseXML } from './parseXML.js';\n;\nvar nodeParsers;\nvar INHERITABLE_STYLE_ATTRIBUTES_MAP = {\n 'fill': 'fill',\n 'stroke': 'stroke',\n 'stroke-width': 'lineWidth',\n 'opacity': 'opacity',\n 'fill-opacity': 'fillOpacity',\n 'stroke-opacity': 'strokeOpacity',\n 'stroke-dasharray': 'lineDash',\n 'stroke-dashoffset': 'lineDashOffset',\n 'stroke-linecap': 'lineCap',\n 'stroke-linejoin': 'lineJoin',\n 'stroke-miterlimit': 'miterLimit',\n 'font-family': 'fontFamily',\n 'font-size': 'fontSize',\n 'font-style': 'fontStyle',\n 'font-weight': 'fontWeight',\n 'text-anchor': 'textAlign',\n 'visibility': 'visibility',\n 'display': 'display'\n};\nvar INHERITABLE_STYLE_ATTRIBUTES_MAP_KEYS = keys(INHERITABLE_STYLE_ATTRIBUTES_MAP);\nvar SELF_STYLE_ATTRIBUTES_MAP = {\n 'alignment-baseline': 'textBaseline',\n 'stop-color': 'stopColor'\n};\nvar SELF_STYLE_ATTRIBUTES_MAP_KEYS = keys(SELF_STYLE_ATTRIBUTES_MAP);\nvar SVGParser = (function () {\n function SVGParser() {\n this._defs = {};\n this._root = null;\n }\n SVGParser.prototype.parse = function (xml, opt) {\n opt = opt || {};\n var svg = parseXML(xml);\n if (process.env.NODE_ENV !== 'production') {\n if (!svg) {\n throw new Error('Illegal svg');\n }\n }\n this._defsUsePending = [];\n var root = new Group();\n this._root = root;\n var named = [];\n var viewBox = svg.getAttribute('viewBox') || '';\n var width = parseFloat((svg.getAttribute('width') || opt.width));\n var height = parseFloat((svg.getAttribute('height') || opt.height));\n isNaN(width) && (width = null);\n isNaN(height) && (height = null);\n parseAttributes(svg, root, null, true, false);\n var child = svg.firstChild;\n while (child) {\n this._parseNode(child, root, named, null, false, false);\n child = child.nextSibling;\n }\n applyDefs(this._defs, this._defsUsePending);\n this._defsUsePending = [];\n var viewBoxRect;\n var viewBoxTransform;\n if (viewBox) {\n var viewBoxArr = splitNumberSequence(viewBox);\n if (viewBoxArr.length >= 4) {\n viewBoxRect = {\n x: parseFloat((viewBoxArr[0] || 0)),\n y: parseFloat((viewBoxArr[1] || 0)),\n width: parseFloat(viewBoxArr[2]),\n height: parseFloat(viewBoxArr[3])\n };\n }\n }\n if (viewBoxRect && width != null && height != null) {\n viewBoxTransform = makeViewBoxTransform(viewBoxRect, { x: 0, y: 0, width: width, height: height });\n if (!opt.ignoreViewBox) {\n var elRoot = root;\n root = new Group();\n root.add(elRoot);\n elRoot.scaleX = elRoot.scaleY = viewBoxTransform.scale;\n elRoot.x = viewBoxTransform.x;\n elRoot.y = viewBoxTransform.y;\n }\n }\n if (!opt.ignoreRootClip && width != null && height != null) {\n root.setClipPath(new Rect({\n shape: { x: 0, y: 0, width: width, height: height }\n }));\n }\n return {\n root: root,\n width: width,\n height: height,\n viewBoxRect: viewBoxRect,\n viewBoxTransform: viewBoxTransform,\n named: named\n };\n };\n SVGParser.prototype._parseNode = function (xmlNode, parentGroup, named, namedFrom, isInDefs, isInText) {\n var nodeName = xmlNode.nodeName.toLowerCase();\n var el;\n var namedFromForSub = namedFrom;\n if (nodeName === 'defs') {\n isInDefs = true;\n }\n if (nodeName === 'text') {\n isInText = true;\n }\n if (nodeName === 'defs' || nodeName === 'switch') {\n el = parentGroup;\n }\n else {\n if (!isInDefs) {\n var parser_1 = nodeParsers[nodeName];\n if (parser_1 && hasOwn(nodeParsers, nodeName)) {\n el = parser_1.call(this, xmlNode, parentGroup);\n var nameAttr = xmlNode.getAttribute('name');\n if (nameAttr) {\n var newNamed = {\n name: nameAttr,\n namedFrom: null,\n svgNodeTagLower: nodeName,\n el: el\n };\n named.push(newNamed);\n if (nodeName === 'g') {\n namedFromForSub = newNamed;\n }\n }\n else if (namedFrom) {\n named.push({\n name: namedFrom.name,\n namedFrom: namedFrom,\n svgNodeTagLower: nodeName,\n el: el\n });\n }\n parentGroup.add(el);\n }\n }\n var parser = paintServerParsers[nodeName];\n if (parser && hasOwn(paintServerParsers, nodeName)) {\n var def = parser.call(this, xmlNode);\n var id = xmlNode.getAttribute('id');\n if (id) {\n this._defs[id] = def;\n }\n }\n }\n if (el && el.isGroup) {\n var child = xmlNode.firstChild;\n while (child) {\n if (child.nodeType === 1) {\n this._parseNode(child, el, named, namedFromForSub, isInDefs, isInText);\n }\n else if (child.nodeType === 3 && isInText) {\n this._parseText(child, el);\n }\n child = child.nextSibling;\n }\n }\n };\n SVGParser.prototype._parseText = function (xmlNode, parentGroup) {\n var text = new TSpan({\n style: {\n text: xmlNode.textContent\n },\n silent: true,\n x: this._textX || 0,\n y: this._textY || 0\n });\n inheritStyle(parentGroup, text);\n parseAttributes(xmlNode, text, this._defsUsePending, false, false);\n applyTextAlignment(text, parentGroup);\n var textStyle = text.style;\n var fontSize = textStyle.fontSize;\n if (fontSize && fontSize < 9) {\n textStyle.fontSize = 9;\n text.scaleX *= fontSize / 9;\n text.scaleY *= fontSize / 9;\n }\n var font = (textStyle.fontSize || textStyle.fontFamily) && [\n textStyle.fontStyle,\n textStyle.fontWeight,\n (textStyle.fontSize || 12) + 'px',\n textStyle.fontFamily || 'sans-serif'\n ].join(' ');\n textStyle.font = font;\n var rect = text.getBoundingRect();\n this._textX += rect.width;\n parentGroup.add(text);\n return text;\n };\n SVGParser.internalField = (function () {\n nodeParsers = {\n 'g': function (xmlNode, parentGroup) {\n var g = new Group();\n inheritStyle(parentGroup, g);\n parseAttributes(xmlNode, g, this._defsUsePending, false, false);\n return g;\n },\n 'rect': function (xmlNode, parentGroup) {\n var rect = new Rect();\n inheritStyle(parentGroup, rect);\n parseAttributes(xmlNode, rect, this._defsUsePending, false, false);\n rect.setShape({\n x: parseFloat(xmlNode.getAttribute('x') || '0'),\n y: parseFloat(xmlNode.getAttribute('y') || '0'),\n width: parseFloat(xmlNode.getAttribute('width') || '0'),\n height: parseFloat(xmlNode.getAttribute('height') || '0')\n });\n rect.silent = true;\n return rect;\n },\n 'circle': function (xmlNode, parentGroup) {\n var circle = new Circle();\n inheritStyle(parentGroup, circle);\n parseAttributes(xmlNode, circle, this._defsUsePending, false, false);\n circle.setShape({\n cx: parseFloat(xmlNode.getAttribute('cx') || '0'),\n cy: parseFloat(xmlNode.getAttribute('cy') || '0'),\n r: parseFloat(xmlNode.getAttribute('r') || '0')\n });\n circle.silent = true;\n return circle;\n },\n 'line': function (xmlNode, parentGroup) {\n var line = new Line();\n inheritStyle(parentGroup, line);\n parseAttributes(xmlNode, line, this._defsUsePending, false, false);\n line.setShape({\n x1: parseFloat(xmlNode.getAttribute('x1') || '0'),\n y1: parseFloat(xmlNode.getAttribute('y1') || '0'),\n x2: parseFloat(xmlNode.getAttribute('x2') || '0'),\n y2: parseFloat(xmlNode.getAttribute('y2') || '0')\n });\n line.silent = true;\n return line;\n },\n 'ellipse': function (xmlNode, parentGroup) {\n var ellipse = new Ellipse();\n inheritStyle(parentGroup, ellipse);\n parseAttributes(xmlNode, ellipse, this._defsUsePending, false, false);\n ellipse.setShape({\n cx: parseFloat(xmlNode.getAttribute('cx') || '0'),\n cy: parseFloat(xmlNode.getAttribute('cy') || '0'),\n rx: parseFloat(xmlNode.getAttribute('rx') || '0'),\n ry: parseFloat(xmlNode.getAttribute('ry') || '0')\n });\n ellipse.silent = true;\n return ellipse;\n },\n 'polygon': function (xmlNode, parentGroup) {\n var pointsStr = xmlNode.getAttribute('points');\n var pointsArr;\n if (pointsStr) {\n pointsArr = parsePoints(pointsStr);\n }\n var polygon = new Polygon({\n shape: {\n points: pointsArr || []\n },\n silent: true\n });\n inheritStyle(parentGroup, polygon);\n parseAttributes(xmlNode, polygon, this._defsUsePending, false, false);\n return polygon;\n },\n 'polyline': function (xmlNode, parentGroup) {\n var pointsStr = xmlNode.getAttribute('points');\n var pointsArr;\n if (pointsStr) {\n pointsArr = parsePoints(pointsStr);\n }\n var polyline = new Polyline({\n shape: {\n points: pointsArr || []\n },\n silent: true\n });\n inheritStyle(parentGroup, polyline);\n parseAttributes(xmlNode, polyline, this._defsUsePending, false, false);\n return polyline;\n },\n 'image': function (xmlNode, parentGroup) {\n var img = new ZRImage();\n inheritStyle(parentGroup, img);\n parseAttributes(xmlNode, img, this._defsUsePending, false, false);\n img.setStyle({\n image: xmlNode.getAttribute('xlink:href') || xmlNode.getAttribute('href'),\n x: +xmlNode.getAttribute('x'),\n y: +xmlNode.getAttribute('y'),\n width: +xmlNode.getAttribute('width'),\n height: +xmlNode.getAttribute('height')\n });\n img.silent = true;\n return img;\n },\n 'text': function (xmlNode, parentGroup) {\n var x = xmlNode.getAttribute('x') || '0';\n var y = xmlNode.getAttribute('y') || '0';\n var dx = xmlNode.getAttribute('dx') || '0';\n var dy = xmlNode.getAttribute('dy') || '0';\n this._textX = parseFloat(x) + parseFloat(dx);\n this._textY = parseFloat(y) + parseFloat(dy);\n var g = new Group();\n inheritStyle(parentGroup, g);\n parseAttributes(xmlNode, g, this._defsUsePending, false, true);\n return g;\n },\n 'tspan': function (xmlNode, parentGroup) {\n var x = xmlNode.getAttribute('x');\n var y = xmlNode.getAttribute('y');\n if (x != null) {\n this._textX = parseFloat(x);\n }\n if (y != null) {\n this._textY = parseFloat(y);\n }\n var dx = xmlNode.getAttribute('dx') || '0';\n var dy = xmlNode.getAttribute('dy') || '0';\n var g = new Group();\n inheritStyle(parentGroup, g);\n parseAttributes(xmlNode, g, this._defsUsePending, false, true);\n this._textX += parseFloat(dx);\n this._textY += parseFloat(dy);\n return g;\n },\n 'path': function (xmlNode, parentGroup) {\n var d = xmlNode.getAttribute('d') || '';\n var path = createFromString(d);\n inheritStyle(parentGroup, path);\n parseAttributes(xmlNode, path, this._defsUsePending, false, false);\n path.silent = true;\n return path;\n }\n };\n })();\n return SVGParser;\n}());\nvar paintServerParsers = {\n 'lineargradient': function (xmlNode) {\n var x1 = parseInt(xmlNode.getAttribute('x1') || '0', 10);\n var y1 = parseInt(xmlNode.getAttribute('y1') || '0', 10);\n var x2 = parseInt(xmlNode.getAttribute('x2') || '10', 10);\n var y2 = parseInt(xmlNode.getAttribute('y2') || '0', 10);\n var gradient = new LinearGradient(x1, y1, x2, y2);\n parsePaintServerUnit(xmlNode, gradient);\n parseGradientColorStops(xmlNode, gradient);\n return gradient;\n },\n 'radialgradient': function (xmlNode) {\n var cx = parseInt(xmlNode.getAttribute('cx') || '0', 10);\n var cy = parseInt(xmlNode.getAttribute('cy') || '0', 10);\n var r = parseInt(xmlNode.getAttribute('r') || '0', 10);\n var gradient = new RadialGradient(cx, cy, r);\n parsePaintServerUnit(xmlNode, gradient);\n parseGradientColorStops(xmlNode, gradient);\n return gradient;\n }\n};\nfunction parsePaintServerUnit(xmlNode, gradient) {\n var gradientUnits = xmlNode.getAttribute('gradientUnits');\n if (gradientUnits === 'userSpaceOnUse') {\n gradient.global = true;\n }\n}\nfunction parseGradientColorStops(xmlNode, gradient) {\n var stop = xmlNode.firstChild;\n while (stop) {\n if (stop.nodeType === 1\n && stop.nodeName.toLocaleLowerCase() === 'stop') {\n var offsetStr = stop.getAttribute('offset');\n var offset = void 0;\n if (offsetStr && offsetStr.indexOf('%') > 0) {\n offset = parseInt(offsetStr, 10) / 100;\n }\n else if (offsetStr) {\n offset = parseFloat(offsetStr);\n }\n else {\n offset = 0;\n }\n var styleVals = {};\n parseInlineStyle(stop, styleVals, styleVals);\n var stopColor = styleVals.stopColor\n || stop.getAttribute('stop-color')\n || '#000000';\n gradient.colorStops.push({\n offset: offset,\n color: stopColor\n });\n }\n stop = stop.nextSibling;\n }\n}\nfunction inheritStyle(parent, child) {\n if (parent && parent.__inheritedStyle) {\n if (!child.__inheritedStyle) {\n child.__inheritedStyle = {};\n }\n defaults(child.__inheritedStyle, parent.__inheritedStyle);\n }\n}\nfunction parsePoints(pointsString) {\n var list = splitNumberSequence(pointsString);\n var points = [];\n for (var i = 0; i < list.length; i += 2) {\n var x = parseFloat(list[i]);\n var y = parseFloat(list[i + 1]);\n points.push([x, y]);\n }\n return points;\n}\nfunction parseAttributes(xmlNode, el, defsUsePending, onlyInlineStyle, isTextGroup) {\n var disp = el;\n var inheritedStyle = disp.__inheritedStyle = disp.__inheritedStyle || {};\n var selfStyle = {};\n if (xmlNode.nodeType === 1) {\n parseTransformAttribute(xmlNode, el);\n parseInlineStyle(xmlNode, inheritedStyle, selfStyle);\n if (!onlyInlineStyle) {\n parseAttributeStyle(xmlNode, inheritedStyle, selfStyle);\n }\n }\n disp.style = disp.style || {};\n if (inheritedStyle.fill != null) {\n disp.style.fill = getFillStrokeStyle(disp, 'fill', inheritedStyle.fill, defsUsePending);\n }\n if (inheritedStyle.stroke != null) {\n disp.style.stroke = getFillStrokeStyle(disp, 'stroke', inheritedStyle.stroke, defsUsePending);\n }\n each([\n 'lineWidth', 'opacity', 'fillOpacity', 'strokeOpacity', 'miterLimit', 'fontSize'\n ], function (propName) {\n if (inheritedStyle[propName] != null) {\n disp.style[propName] = parseFloat(inheritedStyle[propName]);\n }\n });\n each([\n 'lineDashOffset', 'lineCap', 'lineJoin', 'fontWeight', 'fontFamily', 'fontStyle', 'textAlign'\n ], function (propName) {\n if (inheritedStyle[propName] != null) {\n disp.style[propName] = inheritedStyle[propName];\n }\n });\n if (isTextGroup) {\n disp.__selfStyle = selfStyle;\n }\n if (inheritedStyle.lineDash) {\n disp.style.lineDash = map(splitNumberSequence(inheritedStyle.lineDash), function (str) {\n return parseFloat(str);\n });\n }\n if (inheritedStyle.visibility === 'hidden' || inheritedStyle.visibility === 'collapse') {\n disp.invisible = true;\n }\n if (inheritedStyle.display === 'none') {\n disp.ignore = true;\n }\n}\nfunction applyTextAlignment(text, parentGroup) {\n var parentSelfStyle = parentGroup.__selfStyle;\n if (parentSelfStyle) {\n var textBaseline = parentSelfStyle.textBaseline;\n var zrTextBaseline = textBaseline;\n if (!textBaseline || textBaseline === 'auto') {\n zrTextBaseline = 'alphabetic';\n }\n else if (textBaseline === 'baseline') {\n zrTextBaseline = 'alphabetic';\n }\n else if (textBaseline === 'before-edge' || textBaseline === 'text-before-edge') {\n zrTextBaseline = 'top';\n }\n else if (textBaseline === 'after-edge' || textBaseline === 'text-after-edge') {\n zrTextBaseline = 'bottom';\n }\n else if (textBaseline === 'central' || textBaseline === 'mathematical') {\n zrTextBaseline = 'middle';\n }\n text.style.textBaseline = zrTextBaseline;\n }\n var parentInheritedStyle = parentGroup.__inheritedStyle;\n if (parentInheritedStyle) {\n var textAlign = parentInheritedStyle.textAlign;\n var zrTextAlign = textAlign;\n if (textAlign) {\n if (textAlign === 'middle') {\n zrTextAlign = 'center';\n }\n text.style.textAlign = zrTextAlign;\n }\n }\n}\nvar urlRegex = /^url\\(\\s*#(.*?)\\)/;\nfunction getFillStrokeStyle(el, method, str, defsUsePending) {\n var urlMatch = str && str.match(urlRegex);\n if (urlMatch) {\n var url = trim(urlMatch[1]);\n defsUsePending.push([el, method, url]);\n return;\n }\n if (str === 'none') {\n str = null;\n }\n return str;\n}\nfunction applyDefs(defs, defsUsePending) {\n for (var i = 0; i < defsUsePending.length; i++) {\n var item = defsUsePending[i];\n item[0].style[item[1]] = defs[item[2]];\n }\n}\nvar numberReg = /-?([0-9]*\\.)?[0-9]+([eE]-?[0-9]+)?/g;\nfunction splitNumberSequence(rawStr) {\n return rawStr.match(numberReg) || [];\n}\nvar transformRegex = /(translate|scale|rotate|skewX|skewY|matrix)\\(([\\-\\s0-9\\.eE,]*)\\)/g;\nvar DEGREE_TO_ANGLE = Math.PI / 180;\nfunction parseTransformAttribute(xmlNode, node) {\n var transform = xmlNode.getAttribute('transform');\n if (transform) {\n transform = transform.replace(/,/g, ' ');\n var transformOps_1 = [];\n var mt = null;\n transform.replace(transformRegex, function (str, type, value) {\n transformOps_1.push(type, value);\n return '';\n });\n for (var i = transformOps_1.length - 1; i > 0; i -= 2) {\n var value = transformOps_1[i];\n var type = transformOps_1[i - 1];\n var valueArr = splitNumberSequence(value);\n mt = mt || matrix.create();\n switch (type) {\n case 'translate':\n matrix.translate(mt, mt, [parseFloat(valueArr[0]), parseFloat(valueArr[1] || '0')]);\n break;\n case 'scale':\n matrix.scale(mt, mt, [parseFloat(valueArr[0]), parseFloat(valueArr[1] || valueArr[0])]);\n break;\n case 'rotate':\n matrix.rotate(mt, mt, -parseFloat(valueArr[0]) * DEGREE_TO_ANGLE);\n break;\n case 'skewX':\n var sx = Math.tan(parseFloat(valueArr[0]) * DEGREE_TO_ANGLE);\n matrix.mul(mt, [1, 0, sx, 1, 0, 0], mt);\n break;\n case 'skewY':\n var sy = Math.tan(parseFloat(valueArr[0]) * DEGREE_TO_ANGLE);\n matrix.mul(mt, [1, sy, 0, 1, 0, 0], mt);\n break;\n case 'matrix':\n mt[0] = parseFloat(valueArr[0]);\n mt[1] = parseFloat(valueArr[1]);\n mt[2] = parseFloat(valueArr[2]);\n mt[3] = parseFloat(valueArr[3]);\n mt[4] = parseFloat(valueArr[4]);\n mt[5] = parseFloat(valueArr[5]);\n break;\n }\n }\n node.setLocalTransform(mt);\n }\n}\nvar styleRegex = /([^\\s:;]+)\\s*:\\s*([^:;]+)/g;\nfunction parseInlineStyle(xmlNode, inheritableStyleResult, selfStyleResult) {\n var style = xmlNode.getAttribute('style');\n if (!style) {\n return;\n }\n styleRegex.lastIndex = 0;\n var styleRegResult;\n while ((styleRegResult = styleRegex.exec(style)) != null) {\n var svgStlAttr = styleRegResult[1];\n var zrInheritableStlAttr = hasOwn(INHERITABLE_STYLE_ATTRIBUTES_MAP, svgStlAttr)\n ? INHERITABLE_STYLE_ATTRIBUTES_MAP[svgStlAttr]\n : null;\n if (zrInheritableStlAttr) {\n inheritableStyleResult[zrInheritableStlAttr] = styleRegResult[2];\n }\n var zrSelfStlAttr = hasOwn(SELF_STYLE_ATTRIBUTES_MAP, svgStlAttr)\n ? SELF_STYLE_ATTRIBUTES_MAP[svgStlAttr]\n : null;\n if (zrSelfStlAttr) {\n selfStyleResult[zrSelfStlAttr] = styleRegResult[2];\n }\n }\n}\nfunction parseAttributeStyle(xmlNode, inheritableStyleResult, selfStyleResult) {\n for (var i = 0; i < INHERITABLE_STYLE_ATTRIBUTES_MAP_KEYS.length; i++) {\n var svgAttrName = INHERITABLE_STYLE_ATTRIBUTES_MAP_KEYS[i];\n var attrValue = xmlNode.getAttribute(svgAttrName);\n if (attrValue != null) {\n inheritableStyleResult[INHERITABLE_STYLE_ATTRIBUTES_MAP[svgAttrName]] = attrValue;\n }\n }\n for (var i = 0; i < SELF_STYLE_ATTRIBUTES_MAP_KEYS.length; i++) {\n var svgAttrName = SELF_STYLE_ATTRIBUTES_MAP_KEYS[i];\n var attrValue = xmlNode.getAttribute(svgAttrName);\n if (attrValue != null) {\n selfStyleResult[SELF_STYLE_ATTRIBUTES_MAP[svgAttrName]] = attrValue;\n }\n }\n}\nexport function makeViewBoxTransform(viewBoxRect, boundingRect) {\n var scaleX = boundingRect.width / viewBoxRect.width;\n var scaleY = boundingRect.height / viewBoxRect.height;\n var scale = Math.min(scaleX, scaleY);\n return {\n scale: scale,\n x: -(viewBoxRect.x + viewBoxRect.width / 2) * scale + (boundingRect.x + boundingRect.width / 2),\n y: -(viewBoxRect.y + viewBoxRect.height / 2) * scale + (boundingRect.y + boundingRect.height / 2)\n };\n}\nexport function parseSVG(xml, opt) {\n var parser = new SVGParser();\n return parser.parse(xml, opt);\n}\nexport { parseXML };\n","import { isString } from '../core/util.js';\nexport function parseXML(svg) {\n if (isString(svg)) {\n var parser = new DOMParser();\n svg = parser.parseFromString(svg, 'text/xml');\n }\n var svgNode = svg;\n if (svgNode.nodeType === 9) {\n svgNode = svgNode.firstChild;\n }\n while (svgNode.nodeName.toLowerCase() !== 'svg' || svgNode.nodeType !== 1) {\n svgNode = svgNode.nextSibling;\n }\n return svgNode;\n}\n","import windingLine from './windingLine.js';\nvar EPSILON = 1e-8;\nfunction isAroundEqual(a, b) {\n return Math.abs(a - b) < EPSILON;\n}\nexport function contain(points, x, y) {\n var w = 0;\n var p = points[0];\n if (!p) {\n return false;\n }\n for (var i = 1; i < points.length; i++) {\n var p2 = points[i];\n w += windingLine(p[0], p[1], p2[0], p2[1], x, y);\n p = p2;\n }\n var p0 = points[0];\n if (!isAroundEqual(p[0], p0[0]) || !isAroundEqual(p[1], p0[1])) {\n w += windingLine(p[0], p[1], p0[0], p0[1], x, y);\n }\n return w !== 0;\n}\n","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { __extends } from \"tslib\";\nimport BoundingRect from 'zrender/lib/core/BoundingRect.js';\nimport * as vec2 from 'zrender/lib/core/vector.js';\nimport * as polygonContain from 'zrender/lib/contain/polygon.js';\nimport * as matrix from 'zrender/lib/core/matrix.js';\nimport { each } from 'zrender/lib/core/util.js';\nvar TMP_TRANSFORM = [];\n\nfunction transformPoints(points, transform) {\n for (var p = 0; p < points.length; p++) {\n vec2.applyTransform(points[p], points[p], transform);\n }\n}\n\nfunction updateBBoxFromPoints(points, min, max, projection) {\n for (var i = 0; i < points.length; i++) {\n var p = points[i];\n\n if (projection) {\n // projection may return null point.\n p = projection.project(p);\n }\n\n if (p && isFinite(p[0]) && isFinite(p[1])) {\n vec2.min(min, min, p);\n vec2.max(max, max, p);\n }\n }\n}\n\nfunction centroid(points) {\n var signedArea = 0;\n var cx = 0;\n var cy = 0;\n var len = points.length;\n var x0 = points[len - 1][0];\n var y0 = points[len - 1][1]; // Polygon should been closed.\n\n for (var i = 0; i < len; i++) {\n var x1 = points[i][0];\n var y1 = points[i][1];\n var a = x0 * y1 - x1 * y0;\n signedArea += a;\n cx += (x0 + x1) * a;\n cy += (y0 + y1) * a;\n x0 = x1;\n y0 = y1;\n }\n\n return signedArea ? [cx / signedArea / 3, cy / signedArea / 3, signedArea] : [points[0][0] || 0, points[0][1] || 0];\n}\n\nvar Region =\n/** @class */\nfunction () {\n function Region(name) {\n this.name = name;\n }\n\n Region.prototype.setCenter = function (center) {\n this._center = center;\n };\n /**\n * Get center point in data unit. That is,\n * for GeoJSONRegion, the unit is lat/lng,\n * for GeoSVGRegion, the unit is SVG local coord.\n */\n\n\n Region.prototype.getCenter = function () {\n var center = this._center;\n\n if (!center) {\n // In most cases there are no need to calculate this center.\n // So calculate only when called.\n center = this._center = this.calcCenter();\n }\n\n return center;\n };\n\n return Region;\n}();\n\nexport { Region };\n\nvar GeoJSONPolygonGeometry =\n/** @class */\nfunction () {\n function GeoJSONPolygonGeometry(exterior, interiors) {\n this.type = 'polygon';\n this.exterior = exterior;\n this.interiors = interiors;\n }\n\n return GeoJSONPolygonGeometry;\n}();\n\nexport { GeoJSONPolygonGeometry };\n\nvar GeoJSONLineStringGeometry =\n/** @class */\nfunction () {\n function GeoJSONLineStringGeometry(points) {\n this.type = 'linestring';\n this.points = points;\n }\n\n return GeoJSONLineStringGeometry;\n}();\n\nexport { GeoJSONLineStringGeometry };\n\nvar GeoJSONRegion =\n/** @class */\nfunction (_super) {\n __extends(GeoJSONRegion, _super);\n\n function GeoJSONRegion(name, geometries, cp) {\n var _this = _super.call(this, name) || this;\n\n _this.type = 'geoJSON';\n _this.geometries = geometries;\n _this._center = cp && [cp[0], cp[1]];\n return _this;\n }\n\n GeoJSONRegion.prototype.calcCenter = function () {\n var geometries = this.geometries;\n var largestGeo;\n var largestGeoSize = 0;\n\n for (var i = 0; i < geometries.length; i++) {\n var geo = geometries[i];\n var exterior = geo.exterior; // Simple trick to use points count instead of polygon area as region size.\n // Ignore linestring\n\n var size = exterior && exterior.length;\n\n if (size > largestGeoSize) {\n largestGeo = geo;\n largestGeoSize = size;\n }\n }\n\n if (largestGeo) {\n return centroid(largestGeo.exterior);\n } // from bounding rect by default.\n\n\n var rect = this.getBoundingRect();\n return [rect.x + rect.width / 2, rect.y + rect.height / 2];\n };\n\n GeoJSONRegion.prototype.getBoundingRect = function (projection) {\n var rect = this._rect; // Always recalculate if using projection.\n\n if (rect && !projection) {\n return rect;\n }\n\n var min = [Infinity, Infinity];\n var max = [-Infinity, -Infinity];\n var geometries = this.geometries;\n each(geometries, function (geo) {\n if (geo.type === 'polygon') {\n // Doesn't consider hole\n updateBBoxFromPoints(geo.exterior, min, max, projection);\n } else {\n each(geo.points, function (points) {\n updateBBoxFromPoints(points, min, max, projection);\n });\n }\n }); // Normalie invalid bounding.\n\n if (!(isFinite(min[0]) && isFinite(min[1]) && isFinite(max[0]) && isFinite(max[1]))) {\n min[0] = min[1] = max[0] = max[1] = 0;\n }\n\n rect = new BoundingRect(min[0], min[1], max[0] - min[0], max[1] - min[1]);\n\n if (!projection) {\n this._rect = rect;\n }\n\n return rect;\n };\n\n GeoJSONRegion.prototype.contain = function (coord) {\n var rect = this.getBoundingRect();\n var geometries = this.geometries;\n\n if (!rect.contain(coord[0], coord[1])) {\n return false;\n }\n\n loopGeo: for (var i = 0, len = geometries.length; i < len; i++) {\n var geo = geometries[i]; // Only support polygon.\n\n if (geo.type !== 'polygon') {\n continue;\n }\n\n var exterior = geo.exterior;\n var interiors = geo.interiors;\n\n if (polygonContain.contain(exterior, coord[0], coord[1])) {\n // Not in the region if point is in the hole.\n for (var k = 0; k < (interiors ? interiors.length : 0); k++) {\n if (polygonContain.contain(interiors[k], coord[0], coord[1])) {\n continue loopGeo;\n }\n }\n\n return true;\n }\n }\n\n return false;\n };\n /**\n * Transform the raw coords to target bounding.\n * @param x\n * @param y\n * @param width\n * @param height\n */\n\n\n GeoJSONRegion.prototype.transformTo = function (x, y, width, height) {\n var rect = this.getBoundingRect();\n var aspect = rect.width / rect.height;\n\n if (!width) {\n width = aspect * height;\n } else if (!height) {\n height = width / aspect;\n }\n\n var target = new BoundingRect(x, y, width, height);\n var transform = rect.calculateTransform(target);\n var geometries = this.geometries;\n\n for (var i = 0; i < geometries.length; i++) {\n var geo = geometries[i];\n\n if (geo.type === 'polygon') {\n transformPoints(geo.exterior, transform);\n each(geo.interiors, function (interior) {\n transformPoints(interior, transform);\n });\n } else {\n each(geo.points, function (points) {\n transformPoints(points, transform);\n });\n }\n }\n\n rect = this._rect;\n rect.copy(target); // Update center\n\n this._center = [rect.x + rect.width / 2, rect.y + rect.height / 2];\n };\n\n GeoJSONRegion.prototype.cloneShallow = function (name) {\n name == null && (name = this.name);\n var newRegion = new GeoJSONRegion(name, this.geometries, this._center);\n newRegion._rect = this._rect;\n newRegion.transformTo = null; // Simply avoid to be called.\n\n return newRegion;\n };\n\n return GeoJSONRegion;\n}(Region);\n\nexport { GeoJSONRegion };\n\nvar GeoSVGRegion =\n/** @class */\nfunction (_super) {\n __extends(GeoSVGRegion, _super);\n\n function GeoSVGRegion(name, elOnlyForCalculate) {\n var _this = _super.call(this, name) || this;\n\n _this.type = 'geoSVG';\n _this._elOnlyForCalculate = elOnlyForCalculate;\n return _this;\n }\n\n GeoSVGRegion.prototype.calcCenter = function () {\n var el = this._elOnlyForCalculate;\n var rect = el.getBoundingRect();\n var center = [rect.x + rect.width / 2, rect.y + rect.height / 2];\n var mat = matrix.identity(TMP_TRANSFORM);\n var target = el;\n\n while (target && !target.isGeoSVGGraphicRoot) {\n matrix.mul(mat, target.getLocalTransform(), mat);\n target = target.parent;\n }\n\n matrix.invert(mat, mat);\n vec2.applyTransform(center, center, mat);\n return center;\n };\n\n return GeoSVGRegion;\n}(Region);\n\nexport { GeoSVGRegion };","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { parseSVG, makeViewBoxTransform } from 'zrender/lib/tool/parseSVG.js';\nimport Group from 'zrender/lib/graphic/Group.js';\nimport Rect from 'zrender/lib/graphic/shape/Rect.js';\nimport { assert, createHashMap, each } from 'zrender/lib/core/util.js';\nimport BoundingRect from 'zrender/lib/core/BoundingRect.js';\nimport { parseXML } from 'zrender/lib/tool/parseXML.js';\nimport { GeoSVGRegion } from './Region.js';\n/**\n * \"region available\" means that: enable users to set attribute `name=\"xxx\"` on those tags\n * to make it be a region.\n * 1. region styles and its label styles can be defined in echarts opton:\n * ```js\n * geo: {\n * regions: [{\n * name: 'xxx',\n * itemStyle: { ... },\n * label: { ... }\n * }, {\n * ...\n * },\n * ...]\n * };\n * ```\n * 2. name can be duplicated in different SVG tag. All of the tags with the same name share\n * a region option. For exampel if there are two representing two lung lobes. They have\n * no common parents but both of them need to display label \"lung\" inside.\n */\n\nvar REGION_AVAILABLE_SVG_TAG_MAP = createHashMap(['rect', 'circle', 'line', 'ellipse', 'polygon', 'polyline', 'path', // are also enabled becuase some SVG might paint text itself,\n// but still need to trigger events or tooltip.\n'text', 'tspan', // is also enabled because this case: if multiple tags share one name\n// and need label displayed, every tags will display the name, which is not\n// expected. So we can put them into a . Thereby only one label\n// displayed and located based on the bounding rect of the .\n'g']);\n\nvar GeoSVGResource =\n/** @class */\nfunction () {\n function GeoSVGResource(mapName, svg) {\n this.type = 'geoSVG'; // All used graphics. key: hostKey, value: root\n\n this._usedGraphicMap = createHashMap(); // All unused graphics.\n\n this._freedGraphics = [];\n this._mapName = mapName; // Only perform parse to XML object here, which might be time\n // consiming for large SVG.\n // Although convert XML to zrender element is also time consiming,\n // if we do it here, the clone of zrender elements has to be\n // required. So we do it once for each geo instance, util real\n // performance issues call for optimizing it.\n\n this._parsedXML = parseXML(svg);\n }\n\n GeoSVGResource.prototype.load = function ()\n /* nameMap: NameMap */\n {\n // In the \"load\" stage, graphic need to be built to\n // get boundingRect for geo coordinate system.\n var firstGraphic = this._firstGraphic; // Create the return data structure only when first graphic created.\n // Because they will be used in geo coordinate system update stage,\n // and `regions` will be mounted at `geo` coordinate system,\n // in which there is no \"view\" info, so that it should better not to\n // make references to graphic elements.\n\n if (!firstGraphic) {\n firstGraphic = this._firstGraphic = this._buildGraphic(this._parsedXML);\n\n this._freedGraphics.push(firstGraphic);\n\n this._boundingRect = this._firstGraphic.boundingRect.clone(); // PENDING: `nameMap` will not be supported until some real requirement come.\n // if (nameMap) {\n // named = applyNameMap(named, nameMap);\n // }\n\n var _a = createRegions(firstGraphic.named),\n regions = _a.regions,\n regionsMap = _a.regionsMap;\n\n this._regions = regions;\n this._regionsMap = regionsMap;\n }\n\n return {\n boundingRect: this._boundingRect,\n regions: this._regions,\n regionsMap: this._regionsMap\n };\n };\n\n GeoSVGResource.prototype._buildGraphic = function (svgXML) {\n var result;\n var rootFromParse;\n\n try {\n result = svgXML && parseSVG(svgXML, {\n ignoreViewBox: true,\n ignoreRootClip: true\n }) || {};\n rootFromParse = result.root;\n assert(rootFromParse != null);\n } catch (e) {\n throw new Error('Invalid svg format\\n' + e.message);\n } // Note: we keep the covenant that the root has no transform. So always add an extra root.\n\n\n var root = new Group();\n root.add(rootFromParse);\n root.isGeoSVGGraphicRoot = true; // [THE_RULE_OF_VIEWPORT_AND_VIEWBOX]\n //\n // Consider: `