' + 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/**\r\n * @return markupText. null/undefined means no content.\r\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/**\r\n * The major feature is generate styles for `renderMode: 'richText'`.\r\n * But it also serves `renderMode: 'html'` to provide\r\n * \"renderMode-independent\" API.\r\n */\n\nvar TooltipMarkupStyleCreator =\n/** @class */\nfunction () {\n function TooltipMarkupStyleCreator() {\n this.richTextStyles = {}; // Notice that \"generate a style name\" usually happens repeatedly when mouse is moving and\n // a tooltip is displayed. 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 /**\r\n * @usage\r\n * ```ts\r\n * const styledText = markupStyleCreator.wrapRichTextStyle([\r\n * // The styles will be auto merged.\r\n * {\r\n * fontSize: 12,\r\n * color: 'blue'\r\n * },\r\n * {\r\n * padding: 20\r\n * }\r\n * ]);\r\n * ```\r\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\n*/\nimport { keys, isArray, map, isObject, isString, isRegExp, isArrayLike, hasOwn, isNumber } from 'zrender/lib/core/util.js';\nimport { throwError, makePrintable } from './log.js';\nimport { getRawValueParser, createFilterComparator } from '../data/helper/dataValueHelper.js';\n;\nvar RELATIONAL_EXPRESSION_OP_ALIAS_MAP = {\n value: 'eq',\n // PENDING: not good for literal semantic?\n '<': 'lt',\n '<=': 'lte',\n '>': 'gt',\n '>=': 'gte',\n '=': 'eq',\n '!=': 'ne',\n '<>': 'ne' // Might be misleading for sake of the difference between '==' and '===',\n // so don't support them.\n // '==': 'eq',\n // '===': 'seq',\n // '!==': 'sne'\n // PENDING: Whether support some common alias \"ge\", \"le\", \"neq\"?\n // ge: 'gte',\n // le: 'lte',\n // neq: 'ne',\n\n}; // type RelationalExpressionOpEvaluate = (tarVal: unknown, condVal: unknown) => boolean;\n\nvar RegExpEvaluator =\n/** @class */\nfunction () {\n function RegExpEvaluator(rVal) {\n // Support condVal: RegExp | string\n var condValue = this._condVal = isString(rVal) ? new RegExp(rVal) : isRegExp(rVal) ? rVal : null;\n\n if (condValue == null) {\n var errMsg = '';\n\n if (process.env.NODE_ENV !== 'production') {\n errMsg = makePrintable('Illegal regexp', rVal, 'in');\n }\n\n throwError(errMsg);\n }\n }\n\n RegExpEvaluator.prototype.evaluate = function (lVal) {\n var type = typeof lVal;\n return isString(type) ? this._condVal.test(lVal) : isNumber(type) ? this._condVal.test(lVal + '') : false;\n };\n\n return RegExpEvaluator;\n}();\n\nvar ConstConditionInternal =\n/** @class */\nfunction () {\n function ConstConditionInternal() {}\n\n ConstConditionInternal.prototype.evaluate = function () {\n return this.value;\n };\n\n return ConstConditionInternal;\n}();\n\nvar AndConditionInternal =\n/** @class */\nfunction () {\n function AndConditionInternal() {}\n\n AndConditionInternal.prototype.evaluate = function () {\n var children = this.children;\n\n for (var i = 0; i < children.length; i++) {\n if (!children[i].evaluate()) {\n return false;\n }\n }\n\n return true;\n };\n\n return AndConditionInternal;\n}();\n\nvar OrConditionInternal =\n/** @class */\nfunction () {\n function OrConditionInternal() {}\n\n OrConditionInternal.prototype.evaluate = function () {\n var children = this.children;\n\n for (var i = 0; i < children.length; i++) {\n if (children[i].evaluate()) {\n return true;\n }\n }\n\n return false;\n };\n\n return OrConditionInternal;\n}();\n\nvar NotConditionInternal =\n/** @class */\nfunction () {\n function NotConditionInternal() {}\n\n NotConditionInternal.prototype.evaluate = function () {\n return !this.child.evaluate();\n };\n\n return NotConditionInternal;\n}();\n\nvar RelationalConditionInternal =\n/** @class */\nfunction () {\n function RelationalConditionInternal() {}\n\n RelationalConditionInternal.prototype.evaluate = function () {\n var needParse = !!this.valueParser; // Call getValue with no `this`.\n\n var getValue = this.getValue;\n var tarValRaw = getValue(this.valueGetterParam);\n var tarValParsed = needParse ? this.valueParser(tarValRaw) : null; // Relational cond follow \"and\" logic internally.\n\n for (var i = 0; i < this.subCondList.length; i++) {\n if (!this.subCondList[i].evaluate(needParse ? tarValParsed : tarValRaw)) {\n return false;\n }\n }\n\n return true;\n };\n\n return RelationalConditionInternal;\n}();\n\nfunction parseOption(exprOption, getters) {\n if (exprOption === true || exprOption === false) {\n var cond = new ConstConditionInternal();\n cond.value = exprOption;\n return cond;\n }\n\n var errMsg = '';\n\n if (!isObjectNotArray(exprOption)) {\n if (process.env.NODE_ENV !== 'production') {\n errMsg = makePrintable('Illegal config. Expect a plain object but actually', exprOption);\n }\n\n throwError(errMsg);\n }\n\n if (exprOption.and) {\n return parseAndOrOption('and', exprOption, getters);\n } else if (exprOption.or) {\n return parseAndOrOption('or', exprOption, getters);\n } else if (exprOption.not) {\n return parseNotOption(exprOption, getters);\n }\n\n return parseRelationalOption(exprOption, getters);\n}\n\nfunction parseAndOrOption(op, exprOption, getters) {\n var subOptionArr = exprOption[op];\n var errMsg = '';\n\n if (process.env.NODE_ENV !== 'production') {\n errMsg = makePrintable('\"and\"/\"or\" condition should only be `' + op + ': [...]` and must not be empty array.', 'Illegal condition:', exprOption);\n }\n\n if (!isArray(subOptionArr)) {\n throwError(errMsg);\n }\n\n if (!subOptionArr.length) {\n throwError(errMsg);\n }\n\n var cond = op === 'and' ? new AndConditionInternal() : new OrConditionInternal();\n cond.children = map(subOptionArr, function (subOption) {\n return parseOption(subOption, getters);\n });\n\n if (!cond.children.length) {\n throwError(errMsg);\n }\n\n return cond;\n}\n\nfunction parseNotOption(exprOption, getters) {\n var subOption = exprOption.not;\n var errMsg = '';\n\n if (process.env.NODE_ENV !== 'production') {\n errMsg = makePrintable('\"not\" condition should only be `not: {}`.', 'Illegal condition:', exprOption);\n }\n\n if (!isObjectNotArray(subOption)) {\n throwError(errMsg);\n }\n\n var cond = new NotConditionInternal();\n cond.child = parseOption(subOption, getters);\n\n if (!cond.child) {\n throwError(errMsg);\n }\n\n return cond;\n}\n\nfunction parseRelationalOption(exprOption, getters) {\n var errMsg = '';\n var valueGetterParam = getters.prepareGetValue(exprOption);\n var subCondList = [];\n var exprKeys = keys(exprOption);\n var parserName = exprOption.parser;\n var valueParser = parserName ? getRawValueParser(parserName) : null;\n\n for (var i = 0; i < exprKeys.length; i++) {\n var keyRaw = exprKeys[i];\n\n if (keyRaw === 'parser' || getters.valueGetterAttrMap.get(keyRaw)) {\n continue;\n }\n\n var op = hasOwn(RELATIONAL_EXPRESSION_OP_ALIAS_MAP, keyRaw) ? RELATIONAL_EXPRESSION_OP_ALIAS_MAP[keyRaw] : keyRaw;\n var condValueRaw = exprOption[keyRaw];\n var condValueParsed = valueParser ? valueParser(condValueRaw) : condValueRaw;\n var evaluator = createFilterComparator(op, condValueParsed) || op === 'reg' && new RegExpEvaluator(condValueParsed);\n\n if (!evaluator) {\n if (process.env.NODE_ENV !== 'production') {\n errMsg = makePrintable('Illegal relational operation: \"' + keyRaw + '\" in condition:', exprOption);\n }\n\n throwError(errMsg);\n }\n\n subCondList.push(evaluator);\n }\n\n if (!subCondList.length) {\n if (process.env.NODE_ENV !== 'production') {\n errMsg = makePrintable('Relational condition must have at least one operator.', 'Illegal condition:', exprOption);\n } // No relational operator always disabled in case of dangers result.\n\n\n throwError(errMsg);\n }\n\n var cond = new RelationalConditionInternal();\n cond.valueGetterParam = valueGetterParam;\n cond.valueParser = valueParser;\n cond.getValue = getters.getValue;\n cond.subCondList = subCondList;\n return cond;\n}\n\nfunction isObjectNotArray(val) {\n return isObject(val) && !isArrayLike(val);\n}\n\nvar ConditionalExpressionParsed =\n/** @class */\nfunction () {\n function ConditionalExpressionParsed(exprOption, getters) {\n this._cond = parseOption(exprOption, getters);\n }\n\n ConditionalExpressionParsed.prototype.evaluate = function () {\n return this._cond.evaluate();\n };\n\n return ConditionalExpressionParsed;\n}();\n\n;\nexport function parseConditionalExpression(exprOption, getters) {\n return new ConditionalExpressionParsed(exprOption, getters);\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\n*/\nimport { parseConditionalExpression } from '../../util/conditionalExpression.js';\nimport { hasOwn, createHashMap } from 'zrender/lib/core/util.js';\nimport { makePrintable, throwError } from '../../util/log.js';\nexport var filterTransform = {\n type: 'echarts:filter',\n // PENDING: enhance to filter by index rather than create new data\n transform: function (params) {\n // [Caveat] Fail-Fast:\n // Do not return the whole dataset unless user config indicates it explicitly.\n // For example, if no condition is specified by mistake, returning an empty result\n // is better than returning the entire raw source for the user to find the mistake.\n var upstream = params.upstream;\n var rawItem;\n var condition = parseConditionalExpression(params.config, {\n valueGetterAttrMap: createHashMap({\n dimension: true\n }),\n prepareGetValue: function (exprOption) {\n var errMsg = '';\n var dimLoose = exprOption.dimension;\n\n if (!hasOwn(exprOption, 'dimension')) {\n if (process.env.NODE_ENV !== 'production') {\n errMsg = makePrintable('Relation condition must has prop \"dimension\" specified.', 'Illegal condition:', exprOption);\n }\n\n throwError(errMsg);\n }\n\n var dimInfo = upstream.getDimensionInfo(dimLoose);\n\n if (!dimInfo) {\n if (process.env.NODE_ENV !== 'production') {\n errMsg = makePrintable('Can not find dimension info via: ' + dimLoose + '.\\n', 'Existing dimensions: ', upstream.cloneAllDimensionInfo(), '.\\n', 'Illegal condition:', exprOption, '.\\n');\n }\n\n throwError(errMsg);\n }\n\n return {\n dimIdx: dimInfo.index\n };\n },\n getValue: function (param) {\n return upstream.retrieveValueFromItem(rawItem, param.dimIdx);\n }\n });\n var resultData = [];\n\n for (var i = 0, len = upstream.count(); i < len; i++) {\n rawItem = upstream.getRawDataItem(i);\n\n if (condition.evaluate()) {\n resultData.push(rawItem);\n }\n }\n\n return {\n data: resultData\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\n*/\nimport { filterTransform } from './filterTransform.js';\nimport { sortTransform } from './sortTransform.js';\nexport function install(registers) {\n registers.registerTransform(filterTransform);\n registers.registerTransform(sortTransform);\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\n*/\nimport { SOURCE_FORMAT_ARRAY_ROWS, SOURCE_FORMAT_OBJECT_ROWS } from '../../util/types.js';\nimport { makePrintable, throwError } from '../../util/log.js';\nimport { each } from 'zrender/lib/core/util.js';\nimport { normalizeToArray } from '../../util/model.js';\nimport { getRawValueParser, SortOrderComparator } from '../../data/helper/dataValueHelper.js';\nvar sampleLog = '';\n\nif (process.env.NODE_ENV !== 'production') {\n sampleLog = ['Valid config is like:', '{ dimension: \"age\", order: \"asc\" }', 'or [{ dimension: \"age\", order: \"asc\"], { dimension: \"date\", order: \"desc\" }]'].join(' ');\n}\n\nexport var sortTransform = {\n type: 'echarts:sort',\n transform: function (params) {\n var upstream = params.upstream;\n var config = params.config;\n var errMsg = ''; // Normalize\n // const orderExprList: OrderExpression[] = isArray(config[0])\n // ? config as OrderExpression[]\n // : [config as OrderExpression];\n\n var orderExprList = normalizeToArray(config);\n\n if (!orderExprList.length) {\n if (process.env.NODE_ENV !== 'production') {\n errMsg = 'Empty `config` in sort transform.';\n }\n\n throwError(errMsg);\n }\n\n var orderDefList = [];\n each(orderExprList, function (orderExpr) {\n var dimLoose = orderExpr.dimension;\n var order = orderExpr.order;\n var parserName = orderExpr.parser;\n var incomparable = orderExpr.incomparable;\n\n if (dimLoose == null) {\n if (process.env.NODE_ENV !== 'production') {\n errMsg = 'Sort transform config must has \"dimension\" specified.' + sampleLog;\n }\n\n throwError(errMsg);\n }\n\n if (order !== 'asc' && order !== 'desc') {\n if (process.env.NODE_ENV !== 'production') {\n errMsg = 'Sort transform config must has \"order\" specified.' + sampleLog;\n }\n\n throwError(errMsg);\n }\n\n if (incomparable && incomparable !== 'min' && incomparable !== 'max') {\n var errMsg_1 = '';\n\n if (process.env.NODE_ENV !== 'production') {\n errMsg_1 = 'incomparable must be \"min\" or \"max\" rather than \"' + incomparable + '\".';\n }\n\n throwError(errMsg_1);\n }\n\n if (order !== 'asc' && order !== 'desc') {\n var errMsg_2 = '';\n\n if (process.env.NODE_ENV !== 'production') {\n errMsg_2 = 'order must be \"asc\" or \"desc\" rather than \"' + order + '\".';\n }\n\n throwError(errMsg_2);\n }\n\n var dimInfo = upstream.getDimensionInfo(dimLoose);\n\n if (!dimInfo) {\n if (process.env.NODE_ENV !== 'production') {\n errMsg = makePrintable('Can not find dimension info via: ' + dimLoose + '.\\n', 'Existing dimensions: ', upstream.cloneAllDimensionInfo(), '.\\n', 'Illegal config:', orderExpr, '.\\n');\n }\n\n throwError(errMsg);\n }\n\n var parser = parserName ? getRawValueParser(parserName) : null;\n\n if (parserName && !parser) {\n if (process.env.NODE_ENV !== 'production') {\n errMsg = makePrintable('Invalid parser name ' + parserName + '.\\n', 'Illegal config:', orderExpr, '.\\n');\n }\n\n throwError(errMsg);\n }\n\n orderDefList.push({\n dimIdx: dimInfo.index,\n parser: parser,\n comparator: new SortOrderComparator(order, incomparable)\n });\n }); // TODO: support it?\n\n var sourceFormat = upstream.sourceFormat;\n\n if (sourceFormat !== SOURCE_FORMAT_ARRAY_ROWS && sourceFormat !== SOURCE_FORMAT_OBJECT_ROWS) {\n if (process.env.NODE_ENV !== 'production') {\n errMsg = 'sourceFormat \"' + sourceFormat + '\" is not supported yet';\n }\n\n throwError(errMsg);\n } // Other upstream format are all array.\n\n\n var resultData = [];\n\n for (var i = 0, len = upstream.count(); i < len; i++) {\n resultData.push(upstream.getRawDataItem(i));\n }\n\n resultData.sort(function (item0, item1) {\n for (var i = 0; i < orderDefList.length; i++) {\n var orderDef = orderDefList[i];\n var val0 = upstream.retrieveValueFromItem(item0, orderDef.dimIdx);\n var val1 = upstream.retrieveValueFromItem(item1, orderDef.dimIdx);\n\n if (orderDef.parser) {\n val0 = orderDef.parser(val0);\n val1 = orderDef.parser(val1);\n }\n\n var result = orderDef.comparator.evaluate(val0, val1);\n\n if (result !== 0) {\n return result;\n }\n }\n\n return 0;\n });\n return {\n data: resultData\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\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/**\r\n * @param {module:echats/coord/Axis} axis\r\n * @param {module:echarts/model/Model} tickModel For example, can be axisTick, splitLine, splitArea.\r\n * @return {Object} {\r\n * ticks: Array.\r\n * tickCategoryInterval: number\r\n * }\r\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 repeatedly.\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 repeatedly.\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 a function, and cache size always is 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/**\r\n * Calculate interval for category axis ticks and labels.\r\n * To get precise result, at least one of `getRotate` and `isHorizontal`\r\n * should be implemented in axis.\r\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 hidden 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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\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/**\r\n * Base class of Axis.\r\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 /**\r\n * If axis extent contain given coord\r\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 /**\r\n * If axis extent contain given data\r\n */\n\n\n Axis.prototype.containData = function (data) {\n return this.scale.contain(data);\n };\n /**\r\n * Get coord extent.\r\n */\n\n\n Axis.prototype.getExtent = function () {\n return this._extent.slice();\n };\n /**\r\n * Get precision used for formatting\r\n */\n\n\n Axis.prototype.getPixelPrecision = function (dataExtent) {\n return getPixelPrecision(dataExtent || this.scale.getExtent(), this._extent);\n };\n /**\r\n * Set coord extent\r\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 /**\r\n * Convert data to coord. Data is the rank if it has an ordinal scale\r\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 /**\r\n * Convert coord to data. Data is the rank if it has an ordinal scale\r\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 /**\r\n * Convert pixel point to data in axis\r\n */\n\n\n Axis.prototype.pointToData = function (point, clamp) {\n // Should be implemented in derived class if necessary.\n return;\n };\n /**\r\n * Different from `zrUtil.map(axis.getTicks(), axis.dataToCoord, axis)`,\r\n * `axis.getTicksCoords` considers `onBand`, which is used by\r\n * `boundaryGap:true` of category axis and splitLine and splitArea.\r\n * @param opt.tickModel default: axis.model.getModel('axisTick')\r\n * @param opt.clamp If `true`, the first and the last\r\n * tick must be at the axis end points. Otherwise, clip ticks\r\n * that outside the axis extent.\r\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 /**\r\n * Notice here we only get the default tick model. For splitLine\r\n * or splitArea, we should pass the splitLineModel or splitAreaModel\r\n * manually when calling `getTicksCoords`.\r\n * In GL, this method may be overridden to:\r\n * `axisModel.getModel('axisTick', grid3DModel.getModel('axisTick'));`\r\n */\n\n\n Axis.prototype.getTickModel = function () {\n return this.model.getModel('axisTick');\n };\n /**\r\n * Get width of band\r\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 /**\r\n * Only be called in category axis.\r\n * Can be overridden, consider other axes like in 3D.\r\n * @return Auto interval for cateogry axis tick and label\r\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[1]\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 unnecessary 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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\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 // Length 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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\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/**\r\n * Get axis scale extent before niced.\r\n * Item of returned array can only be number (including Infinity and NaN).\r\n *\r\n * Caution:\r\n * Precondition of calling this method:\r\n * The scale extent has been initialized using series data extent via\r\n * `scale.setExtent` or `scale.unionExtentFromData`;\r\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 initialized 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/**\r\n * @param axisType Default retrieve from model.type\r\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/**\r\n * Check if the axis cross 0\r\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/**\r\n * @param axis\r\n * @return Label formatter function.\r\n * param: {number} tickValue,\r\n * param: {number} idx, the index in all ticks.\r\n * If category axis, this param is not required.\r\n * return: {string} label string.\r\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/**\r\n * @param axis\r\n * @return Be null/undefined if no labels.\r\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/**\r\n * @param model axisLabelModel or axisTickModel\r\n * @return {number|String} Can be null|'auto'|number|function\r\n */\n\n\nexport function getOptionCategoryInterval(model) {\n var interval = model.get('interval');\n return interval == null ? 'auto' : interval;\n}\n/**\r\n * Set `categoryInterval` as 0 implicitly indicates that\r\n * show all labels regardless of overlap.\r\n * @param {Object} axis axisModel.axis\r\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\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 /**\r\n * Should be implemented by each axis model if necessary.\r\n * @return coordinate system model\r\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\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/**\r\n * Generate sub axis model class\r\n * @param axisName 'x' 'y' 'radius' 'angle' 'parallel' ...\r\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 /**\r\n * Should not be called before all of 'getInitailData' finished.\r\n * Because categories are collected during initializing data.\r\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\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 /**\r\n * Calculate an affine transform matrix if two axes are time or value.\r\n * It's mainly for accelartion on the large time series data.\r\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 /**\r\n * Base axis will be used on stacking.\r\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.containZone = function (data1, data2) {\n var zoneDiag1 = this.dataToPoint(data1);\n var zoneDiag2 = this.dataToPoint(data2);\n var area = this.getArea();\n var zone = new BoundingRect(zoneDiag1[0], zoneDiag1[1], zoneDiag2[0] - zoneDiag1[0], zoneDiag2[1] - zoneDiag1[1]);\n return area.intersect(zone);\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 /**\r\n * Get rect area of cartesian.\r\n * Area will have a contain function to determine if a point is in the coordinate system.\r\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\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 /**\r\n * Index of axis, can be used as key\r\n * Injected outside.\r\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 /**\r\n * Each item cooresponds to this.getExtent(), which\r\n * means globalExtent[0] may greater than globalExtent[1],\r\n * unless `asc` is input.\r\n *\r\n * @param {boolean} [asc]\r\n * @return {Array.}\r\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 /**\r\n * Set ordinalSortInfo\r\n * @param info new OrdinalSortInfo\r\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\n*/\n\n/**\r\n * Grid is a region which contains at most 4 cartesian systems\r\n *\r\n * TODO Default cartesian\r\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 /**\r\n * Resize the grid\r\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 /**\r\n * @implements\r\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 /**\r\n * @implements\r\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 /**\r\n * @implements\r\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 /**\r\n * Initialize cartesian coordinate systems\r\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 /**\r\n * Update cartesian properties from series.\r\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 /**\r\n * @param dim 'x' or 'y' or 'auto' or null/undefined\r\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/**\r\n * Check if the axis is used in the specified grid.\r\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\n*/\nimport * as zrUtil from 'zrender/lib/core/util.js';\nimport { SINGLE_REFERRING } from '../../util/model.js';\n/**\r\n * Can only be called after coordinate system creation stage.\r\n * (Can be called before coordinate system update stage).\r\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}","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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\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 /**\r\n * Get center point in data unit. That is,\r\n * for GeoJSONRegion, the unit is lat/lng,\r\n * for GeoSVGRegion, the unit is SVG local coord.\r\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 /**\r\n * Transform the raw coords to target bounding.\r\n * @param x\r\n * @param y\r\n * @param width\r\n * @param height\r\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\n*/\n\n/**\r\n * Parse and decode geo json\r\n */\nimport * as zrUtil from 'zrender/lib/core/util.js';\nimport { GeoJSONLineStringGeometry, GeoJSONPolygonGeometry, GeoJSONRegion } from './Region.js';\n\nfunction decode(json) {\n if (!json.UTF8Encoding) {\n return json;\n }\n\n var jsonCompressed = json;\n var encodeScale = jsonCompressed.UTF8Scale;\n\n if (encodeScale == null) {\n encodeScale = 1024;\n }\n\n var features = jsonCompressed.features;\n zrUtil.each(features, function (feature) {\n var geometry = feature.geometry;\n var encodeOffsets = geometry.encodeOffsets;\n var coordinates = geometry.coordinates; // Geometry may be appeded manually in the script after json loaded.\n // In this case this geometry is usually not encoded.\n\n if (!encodeOffsets) {\n return;\n }\n\n switch (geometry.type) {\n case 'LineString':\n geometry.coordinates = decodeRing(coordinates, encodeOffsets, encodeScale);\n break;\n\n case 'Polygon':\n decodeRings(coordinates, encodeOffsets, encodeScale);\n break;\n\n case 'MultiLineString':\n decodeRings(coordinates, encodeOffsets, encodeScale);\n break;\n\n case 'MultiPolygon':\n zrUtil.each(coordinates, function (rings, idx) {\n return decodeRings(rings, encodeOffsets[idx], encodeScale);\n });\n }\n }); // Has been decoded\n\n jsonCompressed.UTF8Encoding = false;\n return jsonCompressed;\n}\n\nfunction decodeRings(rings, encodeOffsets, encodeScale) {\n for (var c = 0; c < rings.length; c++) {\n rings[c] = decodeRing(rings[c], encodeOffsets[c], encodeScale);\n }\n}\n\nfunction decodeRing(coordinate, encodeOffsets, encodeScale) {\n var result = [];\n var prevX = encodeOffsets[0];\n var prevY = encodeOffsets[1];\n\n for (var i = 0; i < coordinate.length; i += 2) {\n var x = coordinate.charCodeAt(i) - 64;\n var y = coordinate.charCodeAt(i + 1) - 64; // ZigZag decoding\n\n x = x >> 1 ^ -(x & 1);\n y = y >> 1 ^ -(y & 1); // Delta deocding\n\n x += prevX;\n y += prevY;\n prevX = x;\n prevY = y; // Dequantize\n\n result.push([x / encodeScale, y / encodeScale]);\n }\n\n return result;\n}\n\nexport default function parseGeoJSON(geoJson, nameProperty) {\n geoJson = decode(geoJson);\n return zrUtil.map(zrUtil.filter(geoJson.features, function (featureObj) {\n // Output of mapshaper may have geometry null\n return featureObj.geometry && featureObj.properties && featureObj.geometry.coordinates.length > 0;\n }), function (featureObj) {\n var properties = featureObj.properties;\n var geo = featureObj.geometry;\n var geometries = [];\n\n switch (geo.type) {\n case 'Polygon':\n var coordinates = geo.coordinates; // According to the GeoJSON specification.\n // First must be exterior, and the rest are all interior(holes).\n\n geometries.push(new GeoJSONPolygonGeometry(coordinates[0], coordinates.slice(1)));\n break;\n\n case 'MultiPolygon':\n zrUtil.each(geo.coordinates, function (item) {\n if (item[0]) {\n geometries.push(new GeoJSONPolygonGeometry(item[0], item.slice(1)));\n }\n });\n break;\n\n case 'LineString':\n geometries.push(new GeoJSONLineStringGeometry([geo.coordinates]));\n break;\n\n case 'MultiLineString':\n geometries.push(new GeoJSONLineStringGeometry(geo.coordinates));\n }\n\n var region = new GeoJSONRegion(properties[nameProperty || 'name'], geometries, properties.cp);\n region.properties = properties;\n return region;\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\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 /**\r\n * Parameters depending on outside (like model, user callback)\r\n * are prepared and fixed here.\r\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 always provides users the full data extent (before data is 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 always provides users the full data extent (before data is 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 /**\r\n * Calculate extent by prepared parameters.\r\n * This method has no external dependency and can be called duplicatedly,\r\n * getting the same result.\r\n * If parameters changed, should call this method to recalcuate.\r\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/**\r\n * Get scale min max and related info only depends on model settings.\r\n * This method can be called after coordinate system created.\r\n * For example, in data processing stage.\r\n *\r\n * Scale extent info probably be required multiple times during a workflow.\r\n * For example:\r\n * (1) `dataZoom` depends it to get the axis extent in \"100%\" state.\r\n * (2) `processor/extentCalculator` depends it to make sure whether axis extent is specified.\r\n * (3) `coordSys.update` use it to finally decide the scale extent.\r\n * But the callback of `min`/`max` should not be called multiple times.\r\n * The code below should not be implemented repeatedly either.\r\n * So we cache the result in the scale instance, which will be recreated at the beginning\r\n * of the workflow (because `scale` instance will be recreated each round of the workflow).\r\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\n*/\nimport * as zrUtil from 'zrender/lib/core/util.js';\nvar coordinateSystemCreators = {};\n\nvar CoordinateSystemManager =\n/** @class */\nfunction () {\n function CoordinateSystemManager() {\n this._coordinateSystems = [];\n }\n\n CoordinateSystemManager.prototype.create = function (ecModel, api) {\n var coordinateSystems = [];\n zrUtil.each(coordinateSystemCreators, function (creator, type) {\n var list = creator.create(ecModel, api);\n coordinateSystems = coordinateSystems.concat(list || []);\n });\n this._coordinateSystems = coordinateSystems;\n };\n\n CoordinateSystemManager.prototype.update = function (ecModel, api) {\n zrUtil.each(this._coordinateSystems, function (coordSys) {\n coordSys.update && coordSys.update(ecModel, api);\n });\n };\n\n CoordinateSystemManager.prototype.getCoordinateSystems = function () {\n return this._coordinateSystems.slice();\n };\n\n CoordinateSystemManager.register = function (type, creator) {\n coordinateSystemCreators[type] = creator;\n };\n\n CoordinateSystemManager.get = function (type) {\n return coordinateSystemCreators[type];\n };\n\n return CoordinateSystemManager;\n}();\n\nexport default CoordinateSystemManager;","\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\n*/\nvar platform = ''; // Navigator not exists in node\n\nif (typeof navigator !== 'undefined') {\n /* global navigator */\n platform = navigator.platform || '';\n}\n\nvar decalColor = 'rgba(0, 0, 0, 0.2)';\nexport default {\n darkMode: 'auto',\n // backgroundColor: 'rgba(0,0,0,0)',\n colorBy: 'series',\n color: ['#5470c6', '#91cc75', '#fac858', '#ee6666', '#73c0de', '#3ba272', '#fc8452', '#9a60b4', '#ea7ccc'],\n gradientColor: ['#f6efa6', '#d88273', '#bf444c'],\n aria: {\n decal: {\n decals: [{\n color: decalColor,\n dashArrayX: [1, 0],\n dashArrayY: [2, 5],\n symbolSize: 1,\n rotation: Math.PI / 6\n }, {\n color: decalColor,\n symbol: 'circle',\n dashArrayX: [[8, 8], [0, 8, 8, 0]],\n dashArrayY: [6, 0],\n symbolSize: 0.8\n }, {\n color: decalColor,\n dashArrayX: [1, 0],\n dashArrayY: [4, 3],\n rotation: -Math.PI / 4\n }, {\n color: decalColor,\n dashArrayX: [[6, 6], [0, 6, 6, 0]],\n dashArrayY: [6, 0]\n }, {\n color: decalColor,\n dashArrayX: [[1, 0], [1, 6]],\n dashArrayY: [1, 0, 6, 0],\n rotation: Math.PI / 4\n }, {\n color: decalColor,\n symbol: 'triangle',\n dashArrayX: [[9, 9], [0, 9, 9, 0]],\n dashArrayY: [7, 2],\n symbolSize: 0.75\n }]\n }\n },\n // If xAxis and yAxis declared, grid is created by default.\n // grid: {},\n textStyle: {\n // color: '#000',\n // decoration: 'none',\n // PENDING\n fontFamily: platform.match(/^Win/) ? 'Microsoft YaHei' : 'sans-serif',\n // fontFamily: 'Arial, Verdana, sans-serif',\n fontSize: 12,\n fontStyle: 'normal',\n fontWeight: 'normal'\n },\n // http://blogs.adobe.com/webplatform/2014/02/24/using-blend-modes-in-html-canvas/\n // https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/globalCompositeOperation\n // Default is source-over\n blendMode: null,\n stateAnimation: {\n duration: 300,\n easing: 'cubicOut'\n },\n animation: 'auto',\n animationDuration: 1000,\n animationDurationUpdate: 500,\n animationEasing: 'cubicInOut',\n animationEasingUpdate: 'cubicInOut',\n animationThreshold: 2000,\n // Configuration for progressive/incremental rendering\n progressiveThreshold: 3000,\n progressive: 400,\n // Threshold of if use single hover layer to optimize.\n // It is recommended that `hoverLayerThreshold` is equivalent to or less than\n // `progressiveThreshold`, otherwise hover will cause restart of progressive,\n // which is unexpected.\n // see example .\n hoverLayerThreshold: 3000,\n // See: module:echarts/scale/Time\n useUTC: false\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\n*/\nimport { createHashMap, assert } from 'zrender/lib/core/util.js';\nimport { isComponentIdInternal } from '../util/model.js';\nvar internalOptionCreatorMap = createHashMap();\nexport function registerInternalOptionCreator(mainType, creator) {\n assert(internalOptionCreatorMap.get(mainType) == null && creator);\n internalOptionCreatorMap.set(mainType, creator);\n}\nexport function concatInternalOptions(ecModel, mainType, newCmptOptionList) {\n var internalOptionCreator = internalOptionCreatorMap.get(mainType);\n\n if (!internalOptionCreator) {\n return newCmptOptionList;\n }\n\n var internalOptions = internalOptionCreator(ecModel);\n\n if (!internalOptions) {\n return newCmptOptionList;\n }\n\n if (process.env.NODE_ENV !== 'production') {\n for (var i = 0; i < internalOptions.length; i++) {\n assert(isComponentIdInternal(internalOptions[i]));\n }\n }\n\n return newCmptOptionList.concat(internalOptions);\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\n*/\nimport { __extends } from \"tslib\";\n/**\r\n * Caution: If the mechanism should be changed some day, these cases\r\n * should be considered:\r\n *\r\n * (1) In `merge option` mode, if using the same option to call `setOption`\r\n * many times, the result should be the same (try our best to ensure that).\r\n * (2) In `merge option` mode, if a component has no id/name specified, it\r\n * will be merged by index, and the result sequence of the components is\r\n * consistent to the original sequence.\r\n * (3) In `replaceMerge` mode, keep the result sequence of the components is\r\n * consistent to the original sequence, even though there might result in \"hole\".\r\n * (4) `reset` feature (in toolbox). Find detailed info in comments about\r\n * `mergeOption` in module:echarts/model/OptionManager.\r\n */\n\nimport { each, filter, isArray, isObject, isString, createHashMap, assert, clone, merge, extend, mixin, isFunction } from 'zrender/lib/core/util.js';\nimport * as modelUtil from '../util/model.js';\nimport Model from './Model.js';\nimport ComponentModel from './Component.js';\nimport globalDefault from './globalDefault.js';\nimport { resetSourceDefaulter } from '../data/helper/sourceHelper.js';\nimport { concatInternalOptions } from './internalComponentCreator.js';\nimport { PaletteMixin } from './mixin/palette.js';\nimport { error, warn } from '../util/log.js'; // -----------------------\n// Internal method names:\n// -----------------------\n\nvar reCreateSeriesIndices;\nvar assertSeriesInitialized;\nvar initBase;\nvar OPTION_INNER_KEY = '\\0_ec_inner';\nvar OPTION_INNER_VALUE = 1;\nvar BUITIN_COMPONENTS_MAP = {\n grid: 'GridComponent',\n polar: 'PolarComponent',\n geo: 'GeoComponent',\n singleAxis: 'SingleAxisComponent',\n parallel: 'ParallelComponent',\n calendar: 'CalendarComponent',\n graphic: 'GraphicComponent',\n toolbox: 'ToolboxComponent',\n tooltip: 'TooltipComponent',\n axisPointer: 'AxisPointerComponent',\n brush: 'BrushComponent',\n title: 'TitleComponent',\n timeline: 'TimelineComponent',\n markPoint: 'MarkPointComponent',\n markLine: 'MarkLineComponent',\n markArea: 'MarkAreaComponent',\n legend: 'LegendComponent',\n dataZoom: 'DataZoomComponent',\n visualMap: 'VisualMapComponent',\n // aria: 'AriaComponent',\n // dataset: 'DatasetComponent',\n // Dependencies\n xAxis: 'GridComponent',\n yAxis: 'GridComponent',\n angleAxis: 'PolarComponent',\n radiusAxis: 'PolarComponent'\n};\nvar BUILTIN_CHARTS_MAP = {\n line: 'LineChart',\n bar: 'BarChart',\n pie: 'PieChart',\n scatter: 'ScatterChart',\n radar: 'RadarChart',\n map: 'MapChart',\n tree: 'TreeChart',\n treemap: 'TreemapChart',\n graph: 'GraphChart',\n gauge: 'GaugeChart',\n funnel: 'FunnelChart',\n parallel: 'ParallelChart',\n sankey: 'SankeyChart',\n boxplot: 'BoxplotChart',\n candlestick: 'CandlestickChart',\n effectScatter: 'EffectScatterChart',\n lines: 'LinesChart',\n heatmap: 'HeatmapChart',\n pictorialBar: 'PictorialBarChart',\n themeRiver: 'ThemeRiverChart',\n sunburst: 'SunburstChart',\n custom: 'CustomChart'\n};\nvar componetsMissingLogPrinted = {};\n\nfunction checkMissingComponents(option) {\n each(option, function (componentOption, mainType) {\n if (!ComponentModel.hasClass(mainType)) {\n var componentImportName = BUITIN_COMPONENTS_MAP[mainType];\n\n if (componentImportName && !componetsMissingLogPrinted[componentImportName]) {\n error(\"Component \" + mainType + \" is used but not imported.\\nimport { \" + componentImportName + \" } from 'echarts/components';\\necharts.use([\" + componentImportName + \"]);\");\n componetsMissingLogPrinted[componentImportName] = true;\n }\n }\n });\n}\n\nvar GlobalModel =\n/** @class */\nfunction (_super) {\n __extends(GlobalModel, _super);\n\n function GlobalModel() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n\n GlobalModel.prototype.init = function (option, parentModel, ecModel, theme, locale, optionManager) {\n theme = theme || {};\n this.option = null; // Mark as not initialized.\n\n this._theme = new Model(theme);\n this._locale = new Model(locale);\n this._optionManager = optionManager;\n };\n\n GlobalModel.prototype.setOption = function (option, opts, optionPreprocessorFuncs) {\n if (process.env.NODE_ENV !== 'production') {\n assert(option != null, 'option is null/undefined');\n assert(option[OPTION_INNER_KEY] !== OPTION_INNER_VALUE, 'please use chart.getOption()');\n }\n\n var innerOpt = normalizeSetOptionInput(opts);\n\n this._optionManager.setOption(option, optionPreprocessorFuncs, innerOpt);\n\n this._resetOption(null, innerOpt);\n };\n /**\r\n * @param type null/undefined: reset all.\r\n * 'recreate': force recreate all.\r\n * 'timeline': only reset timeline option\r\n * 'media': only reset media query option\r\n * @return Whether option changed.\r\n */\n\n\n GlobalModel.prototype.resetOption = function (type, opt) {\n return this._resetOption(type, normalizeSetOptionInput(opt));\n };\n\n GlobalModel.prototype._resetOption = function (type, opt) {\n var optionChanged = false;\n var optionManager = this._optionManager;\n\n if (!type || type === 'recreate') {\n var baseOption = optionManager.mountOption(type === 'recreate');\n\n if (process.env.NODE_ENV !== 'production') {\n checkMissingComponents(baseOption);\n }\n\n if (!this.option || type === 'recreate') {\n initBase(this, baseOption);\n } else {\n this.restoreData();\n\n this._mergeOption(baseOption, opt);\n }\n\n optionChanged = true;\n }\n\n if (type === 'timeline' || type === 'media') {\n this.restoreData();\n } // By design, if `setOption(option2)` at the second time, and `option2` is a `ECUnitOption`,\n // it should better not have the same props with `MediaUnit['option']`.\n // Because either `option2` or `MediaUnit['option']` will be always merged to \"current option\"\n // rather than original \"baseOption\". If they both override a prop, the result might be\n // unexpected when media state changed after `setOption` called.\n // If we really need to modify a props in each `MediaUnit['option']`, use the full version\n // (`{baseOption, media}`) in `setOption`.\n // For `timeline`, the case is the same.\n\n\n if (!type || type === 'recreate' || type === 'timeline') {\n var timelineOption = optionManager.getTimelineOption(this);\n\n if (timelineOption) {\n optionChanged = true;\n\n this._mergeOption(timelineOption, opt);\n }\n }\n\n if (!type || type === 'recreate' || type === 'media') {\n var mediaOptions = optionManager.getMediaOption(this);\n\n if (mediaOptions.length) {\n each(mediaOptions, function (mediaOption) {\n optionChanged = true;\n\n this._mergeOption(mediaOption, opt);\n }, this);\n }\n }\n\n return optionChanged;\n };\n\n GlobalModel.prototype.mergeOption = function (option) {\n this._mergeOption(option, null);\n };\n\n GlobalModel.prototype._mergeOption = function (newOption, opt) {\n var option = this.option;\n var componentsMap = this._componentsMap;\n var componentsCount = this._componentsCount;\n var newCmptTypes = [];\n var newCmptTypeMap = createHashMap();\n var replaceMergeMainTypeMap = opt && opt.replaceMergeMainTypeMap;\n resetSourceDefaulter(this); // If no component class, merge directly.\n // For example: color, animaiton options, etc.\n\n each(newOption, function (componentOption, mainType) {\n if (componentOption == null) {\n return;\n }\n\n if (!ComponentModel.hasClass(mainType)) {\n // globalSettingTask.dirty();\n option[mainType] = option[mainType] == null ? clone(componentOption) : merge(option[mainType], componentOption, true);\n } else if (mainType) {\n newCmptTypes.push(mainType);\n newCmptTypeMap.set(mainType, true);\n }\n });\n\n if (replaceMergeMainTypeMap) {\n // If there is a mainType `xxx` in `replaceMerge` but not declared in option,\n // we trade it as it is declared in option as `{xxx: []}`. Because:\n // (1) for normal merge, `{xxx: null/undefined}` are the same meaning as `{xxx: []}`.\n // (2) some preprocessor may convert some of `{xxx: null/undefined}` to `{xxx: []}`.\n replaceMergeMainTypeMap.each(function (val, mainTypeInReplaceMerge) {\n if (ComponentModel.hasClass(mainTypeInReplaceMerge) && !newCmptTypeMap.get(mainTypeInReplaceMerge)) {\n newCmptTypes.push(mainTypeInReplaceMerge);\n newCmptTypeMap.set(mainTypeInReplaceMerge, true);\n }\n });\n }\n\n ComponentModel.topologicalTravel(newCmptTypes, ComponentModel.getAllClassMainTypes(), visitComponent, this);\n\n function visitComponent(mainType) {\n var newCmptOptionList = concatInternalOptions(this, mainType, modelUtil.normalizeToArray(newOption[mainType]));\n var oldCmptList = componentsMap.get(mainType);\n var mergeMode = // `!oldCmptList` means init. See the comment in `mappingToExists`\n !oldCmptList ? 'replaceAll' : replaceMergeMainTypeMap && replaceMergeMainTypeMap.get(mainType) ? 'replaceMerge' : 'normalMerge';\n var mappingResult = modelUtil.mappingToExists(oldCmptList, newCmptOptionList, mergeMode); // Set mainType and complete subType.\n\n modelUtil.setComponentTypeToKeyInfo(mappingResult, mainType, ComponentModel); // Empty it before the travel, in order to prevent `this._componentsMap`\n // from being used in the `init`/`mergeOption`/`optionUpdated` of some\n // components, which is probably incorrect logic.\n\n option[mainType] = null;\n componentsMap.set(mainType, null);\n componentsCount.set(mainType, 0);\n var optionsByMainType = [];\n var cmptsByMainType = [];\n var cmptsCountByMainType = 0;\n var tooltipExists;\n var tooltipWarningLogged;\n each(mappingResult, function (resultItem, index) {\n var componentModel = resultItem.existing;\n var newCmptOption = resultItem.newOption;\n\n if (!newCmptOption) {\n if (componentModel) {\n // Consider where is no new option and should be merged using {},\n // see removeEdgeAndAdd in topologicalTravel and\n // ComponentModel.getAllClassMainTypes.\n componentModel.mergeOption({}, this);\n componentModel.optionUpdated({}, false);\n } // If no both `resultItem.exist` and `resultItem.option`,\n // either it is in `replaceMerge` and not matched by any id,\n // or it has been removed in previous `replaceMerge` and left a \"hole\" in this component index.\n\n } else {\n var isSeriesType = mainType === 'series';\n var ComponentModelClass = ComponentModel.getClass(mainType, resultItem.keyInfo.subType, !isSeriesType // Give a more detailed warn later if series don't exists\n );\n\n if (!ComponentModelClass) {\n if (process.env.NODE_ENV !== 'production') {\n var subType = resultItem.keyInfo.subType;\n var seriesImportName = BUILTIN_CHARTS_MAP[subType];\n\n if (!componetsMissingLogPrinted[subType]) {\n componetsMissingLogPrinted[subType] = true;\n\n if (seriesImportName) {\n error(\"Series \" + subType + \" is used but not imported.\\nimport { \" + seriesImportName + \" } from 'echarts/charts';\\necharts.use([\" + seriesImportName + \"]);\");\n } else {\n error(\"Unknown series \" + subType);\n }\n }\n }\n\n return;\n } // TODO Before multiple tooltips get supported, we do this check to avoid unexpected exception.\n\n\n if (mainType === 'tooltip') {\n if (tooltipExists) {\n if (process.env.NODE_ENV !== 'production') {\n if (!tooltipWarningLogged) {\n warn('Currently only one tooltip component is allowed.');\n tooltipWarningLogged = true;\n }\n }\n\n return;\n }\n\n tooltipExists = true;\n }\n\n if (componentModel && componentModel.constructor === ComponentModelClass) {\n componentModel.name = resultItem.keyInfo.name; // componentModel.settingTask && componentModel.settingTask.dirty();\n\n componentModel.mergeOption(newCmptOption, this);\n componentModel.optionUpdated(newCmptOption, false);\n } else {\n // PENDING Global as parent ?\n var extraOpt = extend({\n componentIndex: index\n }, resultItem.keyInfo);\n componentModel = new ComponentModelClass(newCmptOption, this, this, extraOpt); // Assign `keyInfo`\n\n extend(componentModel, extraOpt);\n\n if (resultItem.brandNew) {\n componentModel.__requireNewView = true;\n }\n\n componentModel.init(newCmptOption, this, this); // Call optionUpdated after init.\n // newCmptOption has been used as componentModel.option\n // and may be merged with theme and default, so pass null\n // to avoid confusion.\n\n componentModel.optionUpdated(null, true);\n }\n }\n\n if (componentModel) {\n optionsByMainType.push(componentModel.option);\n cmptsByMainType.push(componentModel);\n cmptsCountByMainType++;\n } else {\n // Always do assign to avoid elided item in array.\n optionsByMainType.push(void 0);\n cmptsByMainType.push(void 0);\n }\n }, this);\n option[mainType] = optionsByMainType;\n componentsMap.set(mainType, cmptsByMainType);\n componentsCount.set(mainType, cmptsCountByMainType); // Backup series for filtering.\n\n if (mainType === 'series') {\n reCreateSeriesIndices(this);\n }\n } // If no series declared, ensure `_seriesIndices` initialized.\n\n\n if (!this._seriesIndices) {\n reCreateSeriesIndices(this);\n }\n };\n /**\r\n * Get option for output (cloned option and inner info removed)\r\n */\n\n\n GlobalModel.prototype.getOption = function () {\n var option = clone(this.option);\n each(option, function (optInMainType, mainType) {\n if (ComponentModel.hasClass(mainType)) {\n var opts = modelUtil.normalizeToArray(optInMainType); // Inner cmpts need to be removed.\n // Inner cmpts might not be at last since ec5.0, but still\n // compatible for users: if inner cmpt at last, splice the returned array.\n\n var realLen = opts.length;\n var metNonInner = false;\n\n for (var i = realLen - 1; i >= 0; i--) {\n // Remove options with inner id.\n if (opts[i] && !modelUtil.isComponentIdInternal(opts[i])) {\n metNonInner = true;\n } else {\n opts[i] = null;\n !metNonInner && realLen--;\n }\n }\n\n opts.length = realLen;\n option[mainType] = opts;\n }\n });\n delete option[OPTION_INNER_KEY];\n return option;\n };\n\n GlobalModel.prototype.getTheme = function () {\n return this._theme;\n };\n\n GlobalModel.prototype.getLocaleModel = function () {\n return this._locale;\n };\n\n GlobalModel.prototype.setUpdatePayload = function (payload) {\n this._payload = payload;\n };\n\n GlobalModel.prototype.getUpdatePayload = function () {\n return this._payload;\n };\n /**\r\n * @param idx If not specified, return the first one.\r\n */\n\n\n GlobalModel.prototype.getComponent = function (mainType, idx) {\n var list = this._componentsMap.get(mainType);\n\n if (list) {\n var cmpt = list[idx || 0];\n\n if (cmpt) {\n return cmpt;\n } else if (idx == null) {\n for (var i = 0; i < list.length; i++) {\n if (list[i]) {\n return list[i];\n }\n }\n }\n }\n };\n /**\r\n * @return Never be null/undefined.\r\n */\n\n\n GlobalModel.prototype.queryComponents = function (condition) {\n var mainType = condition.mainType;\n\n if (!mainType) {\n return [];\n }\n\n var index = condition.index;\n var id = condition.id;\n var name = condition.name;\n\n var cmpts = this._componentsMap.get(mainType);\n\n if (!cmpts || !cmpts.length) {\n return [];\n }\n\n var result;\n\n if (index != null) {\n result = [];\n each(modelUtil.normalizeToArray(index), function (idx) {\n cmpts[idx] && result.push(cmpts[idx]);\n });\n } else if (id != null) {\n result = queryByIdOrName('id', id, cmpts);\n } else if (name != null) {\n result = queryByIdOrName('name', name, cmpts);\n } else {\n // Return all non-empty components in that mainType\n result = filter(cmpts, function (cmpt) {\n return !!cmpt;\n });\n }\n\n return filterBySubType(result, condition);\n };\n /**\r\n * The interface is different from queryComponents,\r\n * which is convenient for inner usage.\r\n *\r\n * @usage\r\n * let result = findComponents(\r\n * {mainType: 'dataZoom', query: {dataZoomId: 'abc'}}\r\n * );\r\n * let result = findComponents(\r\n * {mainType: 'series', subType: 'pie', query: {seriesName: 'uio'}}\r\n * );\r\n * let result = findComponents(\r\n * {mainType: 'series',\r\n * filter: function (model, index) {...}}\r\n * );\r\n * // result like [component0, componnet1, ...]\r\n */\n\n\n GlobalModel.prototype.findComponents = function (condition) {\n var query = condition.query;\n var mainType = condition.mainType;\n var queryCond = getQueryCond(query);\n var result = queryCond ? this.queryComponents(queryCond) // Retrieve all non-empty components.\n : filter(this._componentsMap.get(mainType), function (cmpt) {\n return !!cmpt;\n });\n return doFilter(filterBySubType(result, condition));\n\n function getQueryCond(q) {\n var indexAttr = mainType + 'Index';\n var idAttr = mainType + 'Id';\n var nameAttr = mainType + 'Name';\n return q && (q[indexAttr] != null || q[idAttr] != null || q[nameAttr] != null) ? {\n mainType: mainType,\n // subType will be filtered finally.\n index: q[indexAttr],\n id: q[idAttr],\n name: q[nameAttr]\n } : null;\n }\n\n function doFilter(res) {\n return condition.filter ? filter(res, condition.filter) : res;\n }\n };\n\n GlobalModel.prototype.eachComponent = function (mainType, cb, context) {\n var componentsMap = this._componentsMap;\n\n if (isFunction(mainType)) {\n var ctxForAll_1 = cb;\n var cbForAll_1 = mainType;\n componentsMap.each(function (cmpts, componentType) {\n for (var i = 0; cmpts && i < cmpts.length; i++) {\n var cmpt = cmpts[i];\n cmpt && cbForAll_1.call(ctxForAll_1, componentType, cmpt, cmpt.componentIndex);\n }\n });\n } else {\n var cmpts = isString(mainType) ? componentsMap.get(mainType) : isObject(mainType) ? this.findComponents(mainType) : null;\n\n for (var i = 0; cmpts && i < cmpts.length; i++) {\n var cmpt = cmpts[i];\n cmpt && cb.call(context, cmpt, cmpt.componentIndex);\n }\n }\n };\n /**\r\n * Get series list before filtered by name.\r\n */\n\n\n GlobalModel.prototype.getSeriesByName = function (name) {\n var nameStr = modelUtil.convertOptionIdName(name, null);\n return filter(this._componentsMap.get('series'), function (oneSeries) {\n return !!oneSeries && nameStr != null && oneSeries.name === nameStr;\n });\n };\n /**\r\n * Get series list before filtered by index.\r\n */\n\n\n GlobalModel.prototype.getSeriesByIndex = function (seriesIndex) {\n return this._componentsMap.get('series')[seriesIndex];\n };\n /**\r\n * Get series list before filtered by type.\r\n * FIXME: rename to getRawSeriesByType?\r\n */\n\n\n GlobalModel.prototype.getSeriesByType = function (subType) {\n return filter(this._componentsMap.get('series'), function (oneSeries) {\n return !!oneSeries && oneSeries.subType === subType;\n });\n };\n /**\r\n * Get all series before filtered.\r\n */\n\n\n GlobalModel.prototype.getSeries = function () {\n return filter(this._componentsMap.get('series'), function (oneSeries) {\n return !!oneSeries;\n });\n };\n /**\r\n * Count series before filtered.\r\n */\n\n\n GlobalModel.prototype.getSeriesCount = function () {\n return this._componentsCount.get('series');\n };\n /**\r\n * After filtering, series may be different\r\n * from raw series.\r\n */\n\n\n GlobalModel.prototype.eachSeries = function (cb, context) {\n assertSeriesInitialized(this);\n each(this._seriesIndices, function (rawSeriesIndex) {\n var series = this._componentsMap.get('series')[rawSeriesIndex];\n\n cb.call(context, series, rawSeriesIndex);\n }, this);\n };\n /**\r\n * Iterate raw series before filtered.\r\n *\r\n * @param {Function} cb\r\n * @param {*} context\r\n */\n\n\n GlobalModel.prototype.eachRawSeries = function (cb, context) {\n each(this._componentsMap.get('series'), function (series) {\n series && cb.call(context, series, series.componentIndex);\n });\n };\n /**\r\n * After filtering, series may be different.\r\n * from raw series.\r\n */\n\n\n GlobalModel.prototype.eachSeriesByType = function (subType, cb, context) {\n assertSeriesInitialized(this);\n each(this._seriesIndices, function (rawSeriesIndex) {\n var series = this._componentsMap.get('series')[rawSeriesIndex];\n\n if (series.subType === subType) {\n cb.call(context, series, rawSeriesIndex);\n }\n }, this);\n };\n /**\r\n * Iterate raw series before filtered of given type.\r\n */\n\n\n GlobalModel.prototype.eachRawSeriesByType = function (subType, cb, context) {\n return each(this.getSeriesByType(subType), cb, context);\n };\n\n GlobalModel.prototype.isSeriesFiltered = function (seriesModel) {\n assertSeriesInitialized(this);\n return this._seriesIndicesMap.get(seriesModel.componentIndex) == null;\n };\n\n GlobalModel.prototype.getCurrentSeriesIndices = function () {\n return (this._seriesIndices || []).slice();\n };\n\n GlobalModel.prototype.filterSeries = function (cb, context) {\n assertSeriesInitialized(this);\n var newSeriesIndices = [];\n each(this._seriesIndices, function (seriesRawIdx) {\n var series = this._componentsMap.get('series')[seriesRawIdx];\n\n cb.call(context, series, seriesRawIdx) && newSeriesIndices.push(seriesRawIdx);\n }, this);\n this._seriesIndices = newSeriesIndices;\n this._seriesIndicesMap = createHashMap(newSeriesIndices);\n };\n\n GlobalModel.prototype.restoreData = function (payload) {\n reCreateSeriesIndices(this);\n var componentsMap = this._componentsMap;\n var componentTypes = [];\n componentsMap.each(function (components, componentType) {\n if (ComponentModel.hasClass(componentType)) {\n componentTypes.push(componentType);\n }\n });\n ComponentModel.topologicalTravel(componentTypes, ComponentModel.getAllClassMainTypes(), function (componentType) {\n each(componentsMap.get(componentType), function (component) {\n if (component && (componentType !== 'series' || !isNotTargetSeries(component, payload))) {\n component.restoreData();\n }\n });\n });\n };\n\n GlobalModel.internalField = function () {\n reCreateSeriesIndices = function (ecModel) {\n var seriesIndices = ecModel._seriesIndices = [];\n each(ecModel._componentsMap.get('series'), function (series) {\n // series may have been removed by `replaceMerge`.\n series && seriesIndices.push(series.componentIndex);\n });\n ecModel._seriesIndicesMap = createHashMap(seriesIndices);\n };\n\n assertSeriesInitialized = function (ecModel) {\n // Components that use _seriesIndices should depends on series component,\n // which make sure that their initialization is after series.\n if (process.env.NODE_ENV !== 'production') {\n if (!ecModel._seriesIndices) {\n throw new Error('Option should contains series.');\n }\n }\n };\n\n initBase = function (ecModel, baseOption) {\n // Using OPTION_INNER_KEY to mark that this option cannot be used outside,\n // i.e. `chart.setOption(chart.getModel().option);` is forbidden.\n ecModel.option = {};\n ecModel.option[OPTION_INNER_KEY] = OPTION_INNER_VALUE; // Init with series: [], in case of calling findSeries method\n // before series initialized.\n\n ecModel._componentsMap = createHashMap({\n series: []\n });\n ecModel._componentsCount = createHashMap(); // If user spefied `option.aria`, aria will be enable. This detection should be\n // performed before theme and globalDefault merge.\n\n var airaOption = baseOption.aria;\n\n if (isObject(airaOption) && airaOption.enabled == null) {\n airaOption.enabled = true;\n }\n\n mergeTheme(baseOption, ecModel._theme.option); // TODO Needs clone when merging to the unexisted property\n\n merge(baseOption, globalDefault, false);\n\n ecModel._mergeOption(baseOption, null);\n };\n }();\n\n return GlobalModel;\n}(Model);\n\nfunction isNotTargetSeries(seriesModel, payload) {\n if (payload) {\n var index = payload.seriesIndex;\n var id = payload.seriesId;\n var name_1 = payload.seriesName;\n return index != null && seriesModel.componentIndex !== index || id != null && seriesModel.id !== id || name_1 != null && seriesModel.name !== name_1;\n }\n}\n\nfunction mergeTheme(option, theme) {\n // PENDING\n // NOT use `colorLayer` in theme if option has `color`\n var notMergeColorLayer = option.color && !option.colorLayer;\n each(theme, function (themeItem, name) {\n if (name === 'colorLayer' && notMergeColorLayer) {\n return;\n } // If it is component model mainType, the model handles that merge later.\n // otherwise, merge them here.\n\n\n if (!ComponentModel.hasClass(name)) {\n if (typeof themeItem === 'object') {\n option[name] = !option[name] ? clone(themeItem) : merge(option[name], themeItem, false);\n } else {\n if (option[name] == null) {\n option[name] = themeItem;\n }\n }\n }\n });\n}\n\nfunction queryByIdOrName(attr, idOrName, cmpts) {\n // Here is a break from echarts4: string and number are\n // treated as equal.\n if (isArray(idOrName)) {\n var keyMap_1 = createHashMap();\n each(idOrName, function (idOrNameItem) {\n if (idOrNameItem != null) {\n var idName = modelUtil.convertOptionIdName(idOrNameItem, null);\n idName != null && keyMap_1.set(idOrNameItem, true);\n }\n });\n return filter(cmpts, function (cmpt) {\n return cmpt && keyMap_1.get(cmpt[attr]);\n });\n } else {\n var idName_1 = modelUtil.convertOptionIdName(idOrName, null);\n return filter(cmpts, function (cmpt) {\n return cmpt && idName_1 != null && cmpt[attr] === idName_1;\n });\n }\n}\n\nfunction filterBySubType(components, condition) {\n // Using hasOwnProperty for restrict. Consider\n // subType is undefined in user payload.\n return condition.hasOwnProperty('subType') ? filter(components, function (cmpt) {\n return cmpt && cmpt.subType === condition.subType;\n }) : components;\n}\n\nfunction normalizeSetOptionInput(opts) {\n var replaceMergeMainTypeMap = createHashMap();\n opts && each(modelUtil.normalizeToArray(opts.replaceMerge), function (mainType) {\n if (process.env.NODE_ENV !== 'production') {\n assert(ComponentModel.hasClass(mainType), '\"' + mainType + '\" is not valid component main type in \"replaceMerge\"');\n }\n\n replaceMergeMainTypeMap.set(mainType, true);\n });\n return {\n replaceMergeMainTypeMap: replaceMergeMainTypeMap\n };\n}\n\nmixin(GlobalModel, PaletteMixin);\nexport default GlobalModel;","\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\n*/\nimport * as zrUtil from 'zrender/lib/core/util.js';\nvar availableMethods = ['getDom', 'getZr', 'getWidth', 'getHeight', 'getDevicePixelRatio', 'dispatchAction', 'isSSR', 'isDisposed', 'on', 'off', 'getDataURL', 'getConnectedDataURL', // 'getModel',\n'getOption', // 'getViewOfComponentModel',\n// 'getViewOfSeriesModel',\n'getId', 'updateLabelLayout'];\n\nvar ExtensionAPI =\n/** @class */\nfunction () {\n function ExtensionAPI(ecInstance) {\n zrUtil.each(availableMethods, function (methodName) {\n this[methodName] = zrUtil.bind(ecInstance[methodName], ecInstance);\n }, this);\n }\n\n return ExtensionAPI;\n}();\n\nexport default ExtensionAPI;","\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\n*/\nimport { normalizeToArray // , MappingExistingItem, setComponentTypeToKeyInfo, mappingToExists\n} from '../util/model.js';\nimport { each, clone, map, isTypedArray, setAsPrimitive, isArray, isObject // , HashMap , createHashMap, extend, merge,\n} from 'zrender/lib/core/util.js';\nimport { error } from '../util/log.js';\nvar QUERY_REG = /^(min|max)?(.+)$/; // Key: mainType\n// type FakeComponentsMap = HashMap<(MappingExistingItem & { subType: string })[]>;\n\n/**\r\n * TERM EXPLANATIONS:\r\n * See `ECOption` and `ECUnitOption` in `src/util/types.ts`.\r\n */\n\nvar OptionManager =\n/** @class */\nfunction () {\n // timeline.notMerge is not supported in ec3. Firstly there is rearly\n // case that notMerge is needed. Secondly supporting 'notMerge' requires\n // rawOption cloned and backuped when timeline changed, which does no\n // good to performance. What's more, that both timeline and setOption\n // method supply 'notMerge' brings complex and some problems.\n // Consider this case:\n // (step1) chart.setOption({timeline: {notMerge: false}, ...}, false);\n // (step2) chart.setOption({timeline: {notMerge: true}, ...}, false);\n function OptionManager(api) {\n this._timelineOptions = [];\n this._mediaList = [];\n /**\r\n * -1, means default.\r\n * empty means no media.\r\n */\n\n this._currentMediaIndices = [];\n this._api = api;\n }\n\n OptionManager.prototype.setOption = function (rawOption, optionPreprocessorFuncs, opt) {\n if (rawOption) {\n // That set dat primitive is dangerous if user reuse the data when setOption again.\n each(normalizeToArray(rawOption.series), function (series) {\n series && series.data && isTypedArray(series.data) && setAsPrimitive(series.data);\n });\n each(normalizeToArray(rawOption.dataset), function (dataset) {\n dataset && dataset.source && isTypedArray(dataset.source) && setAsPrimitive(dataset.source);\n });\n } // Caution: some series modify option data, if do not clone,\n // it should ensure that the repeat modify correctly\n // (create a new object when modify itself).\n\n\n rawOption = clone(rawOption); // FIXME\n // If some property is set in timeline options or media option but\n // not set in baseOption, a warning should be given.\n\n var optionBackup = this._optionBackup;\n var newParsedOption = parseRawOption(rawOption, optionPreprocessorFuncs, !optionBackup);\n this._newBaseOption = newParsedOption.baseOption; // For setOption at second time (using merge mode);\n\n if (optionBackup) {\n // FIXME\n // the restore merge solution is essentially incorrect.\n // the mapping can not be 100% consistent with ecModel, which probably brings\n // potential bug!\n // The first merge is delayed, because in most cases, users do not call `setOption` twice.\n // let fakeCmptsMap = this._fakeCmptsMap;\n // if (!fakeCmptsMap) {\n // fakeCmptsMap = this._fakeCmptsMap = createHashMap();\n // mergeToBackupOption(fakeCmptsMap, null, optionBackup.baseOption, null);\n // }\n // mergeToBackupOption(\n // fakeCmptsMap, optionBackup.baseOption, newParsedOption.baseOption, opt\n // );\n // For simplicity, timeline options and media options do not support merge,\n // that is, if you `setOption` twice and both has timeline options, the latter\n // timeline options will not be merged to the former, but just substitute them.\n if (newParsedOption.timelineOptions.length) {\n optionBackup.timelineOptions = newParsedOption.timelineOptions;\n }\n\n if (newParsedOption.mediaList.length) {\n optionBackup.mediaList = newParsedOption.mediaList;\n }\n\n if (newParsedOption.mediaDefault) {\n optionBackup.mediaDefault = newParsedOption.mediaDefault;\n }\n } else {\n this._optionBackup = newParsedOption;\n }\n };\n\n OptionManager.prototype.mountOption = function (isRecreate) {\n var optionBackup = this._optionBackup;\n this._timelineOptions = optionBackup.timelineOptions;\n this._mediaList = optionBackup.mediaList;\n this._mediaDefault = optionBackup.mediaDefault;\n this._currentMediaIndices = [];\n return clone(isRecreate // this._optionBackup.baseOption, which is created at the first `setOption`\n // called, and is merged into every new option by inner method `mergeToBackupOption`\n // each time `setOption` called, can be only used in `isRecreate`, because\n // its reliability is under suspicion. In other cases option merge is\n // performed by `model.mergeOption`.\n ? optionBackup.baseOption : this._newBaseOption);\n };\n\n OptionManager.prototype.getTimelineOption = function (ecModel) {\n var option;\n var timelineOptions = this._timelineOptions;\n\n if (timelineOptions.length) {\n // getTimelineOption can only be called after ecModel inited,\n // so we can get currentIndex from timelineModel.\n var timelineModel = ecModel.getComponent('timeline');\n\n if (timelineModel) {\n option = clone( // FIXME:TS as TimelineModel or quivlant interface\n timelineOptions[timelineModel.getCurrentIndex()]);\n }\n }\n\n return option;\n };\n\n OptionManager.prototype.getMediaOption = function (ecModel) {\n var ecWidth = this._api.getWidth();\n\n var ecHeight = this._api.getHeight();\n\n var mediaList = this._mediaList;\n var mediaDefault = this._mediaDefault;\n var indices = [];\n var result = []; // No media defined.\n\n if (!mediaList.length && !mediaDefault) {\n return result;\n } // Multi media may be applied, the latter defined media has higher priority.\n\n\n for (var i = 0, len = mediaList.length; i < len; i++) {\n if (applyMediaQuery(mediaList[i].query, ecWidth, ecHeight)) {\n indices.push(i);\n }\n } // FIXME\n // Whether mediaDefault should force users to provide? Otherwise\n // the change by media query can not be recorvered.\n\n\n if (!indices.length && mediaDefault) {\n indices = [-1];\n }\n\n if (indices.length && !indicesEquals(indices, this._currentMediaIndices)) {\n result = map(indices, function (index) {\n return clone(index === -1 ? mediaDefault.option : mediaList[index].option);\n });\n } // Otherwise return nothing.\n\n\n this._currentMediaIndices = indices;\n return result;\n };\n\n return OptionManager;\n}();\n/**\r\n * [RAW_OPTION_PATTERNS]\r\n * (Note: \"series: []\" represents all other props in `ECUnitOption`)\r\n *\r\n * (1) No prop \"baseOption\" declared:\r\n * Root option is used as \"baseOption\" (except prop \"options\" and \"media\").\r\n * ```js\r\n * option = {\r\n * series: [],\r\n * timeline: {},\r\n * options: [],\r\n * };\r\n * option = {\r\n * series: [],\r\n * media: {},\r\n * };\r\n * option = {\r\n * series: [],\r\n * timeline: {},\r\n * options: [],\r\n * media: {},\r\n * }\r\n * ```\r\n *\r\n * (2) Prop \"baseOption\" declared:\r\n * If \"baseOption\" declared, `ECUnitOption` props can only be declared\r\n * inside \"baseOption\" except prop \"timeline\" (compat ec2).\r\n * ```js\r\n * option = {\r\n * baseOption: {\r\n * timeline: {},\r\n * series: [],\r\n * },\r\n * options: []\r\n * };\r\n * option = {\r\n * baseOption: {\r\n * series: [],\r\n * },\r\n * media: []\r\n * };\r\n * option = {\r\n * baseOption: {\r\n * timeline: {},\r\n * series: [],\r\n * },\r\n * options: []\r\n * media: []\r\n * };\r\n * option = {\r\n * // ec3 compat ec2: allow (only) `timeline` declared\r\n * // outside baseOption. Keep this setting for compat.\r\n * timeline: {},\r\n * baseOption: {\r\n * series: [],\r\n * },\r\n * options: [],\r\n * media: []\r\n * };\r\n * ```\r\n */\n\n\nfunction parseRawOption( // `rawOption` May be modified\nrawOption, optionPreprocessorFuncs, isNew) {\n var mediaList = [];\n var mediaDefault;\n var baseOption;\n var declaredBaseOption = rawOption.baseOption; // Compatible with ec2, [RAW_OPTION_PATTERNS] above.\n\n var timelineOnRoot = rawOption.timeline;\n var timelineOptionsOnRoot = rawOption.options;\n var mediaOnRoot = rawOption.media;\n var hasMedia = !!rawOption.media;\n var hasTimeline = !!(timelineOptionsOnRoot || timelineOnRoot || declaredBaseOption && declaredBaseOption.timeline);\n\n if (declaredBaseOption) {\n baseOption = declaredBaseOption; // For merge option.\n\n if (!baseOption.timeline) {\n baseOption.timeline = timelineOnRoot;\n }\n } // For convenience, enable to use the root option as the `baseOption`:\n // `{ ...normalOptionProps, media: [{ ... }, { ... }] }`\n else {\n if (hasTimeline || hasMedia) {\n rawOption.options = rawOption.media = null;\n }\n\n baseOption = rawOption;\n }\n\n if (hasMedia) {\n if (isArray(mediaOnRoot)) {\n each(mediaOnRoot, function (singleMedia) {\n if (process.env.NODE_ENV !== 'production') {\n // Real case of wrong config.\n if (singleMedia && !singleMedia.option && isObject(singleMedia.query) && isObject(singleMedia.query.option)) {\n error('Illegal media option. Must be like { media: [ { query: {}, option: {} } ] }');\n }\n }\n\n if (singleMedia && singleMedia.option) {\n if (singleMedia.query) {\n mediaList.push(singleMedia);\n } else if (!mediaDefault) {\n // Use the first media default.\n mediaDefault = singleMedia;\n }\n }\n });\n } else {\n if (process.env.NODE_ENV !== 'production') {\n // Real case of wrong config.\n error('Illegal media option. Must be an array. Like { media: [ {...}, {...} ] }');\n }\n }\n }\n\n doPreprocess(baseOption);\n each(timelineOptionsOnRoot, function (option) {\n return doPreprocess(option);\n });\n each(mediaList, function (media) {\n return doPreprocess(media.option);\n });\n\n function doPreprocess(option) {\n each(optionPreprocessorFuncs, function (preProcess) {\n preProcess(option, isNew);\n });\n }\n\n return {\n baseOption: baseOption,\n timelineOptions: timelineOptionsOnRoot || [],\n mediaDefault: mediaDefault,\n mediaList: mediaList\n };\n}\n/**\r\n * @see \r\n * Support: width, height, aspectRatio\r\n * Can use max or min as prefix.\r\n */\n\n\nfunction applyMediaQuery(query, ecWidth, ecHeight) {\n var realMap = {\n width: ecWidth,\n height: ecHeight,\n aspectratio: ecWidth / ecHeight // lower case for convenience.\n\n };\n var applicable = true;\n each(query, function (value, attr) {\n var matched = attr.match(QUERY_REG);\n\n if (!matched || !matched[1] || !matched[2]) {\n return;\n }\n\n var operator = matched[1];\n var realAttr = matched[2].toLowerCase();\n\n if (!compare(realMap[realAttr], value, operator)) {\n applicable = false;\n }\n });\n return applicable;\n}\n\nfunction compare(real, expect, operator) {\n if (operator === 'min') {\n return real >= expect;\n } else if (operator === 'max') {\n return real <= expect;\n } else {\n // Equals\n return real === expect;\n }\n}\n\nfunction indicesEquals(indices1, indices2) {\n // indices is always order by asc and has only finite number.\n return indices1.join(',') === indices2.join(',');\n}\n/**\r\n * Consider case:\r\n * `chart.setOption(opt1);`\r\n * Then user do some interaction like dataZoom, dataView changing.\r\n * `chart.setOption(opt2);`\r\n * Then user press 'reset button' in toolbox.\r\n *\r\n * After doing that all of the interaction effects should be reset, the\r\n * chart should be the same as the result of invoke\r\n * `chart.setOption(opt1); chart.setOption(opt2);`.\r\n *\r\n * Although it is not able ensure that\r\n * `chart.setOption(opt1); chart.setOption(opt2);` is equivalents to\r\n * `chart.setOption(merge(opt1, opt2));` exactly,\r\n * this might be the only simple way to implement that feature.\r\n *\r\n * MEMO: We've considered some other approaches:\r\n * 1. Each model handles its self restoration but not uniform treatment.\r\n * (Too complex in logic and error-prone)\r\n * 2. Use a shadow ecModel. (Performance expensive)\r\n *\r\n * FIXME: A possible solution:\r\n * Add a extra level of model for each component model. The inheritance chain would be:\r\n * ecModel <- componentModel <- componentActionModel <- dataItemModel\r\n * And all of the actions can only modify the `componentActionModel` rather than\r\n * `componentModel`. `setOption` will only modify the `ecModel` and `componentModel`.\r\n * When \"resotre\" action triggered, model from `componentActionModel` will be discarded\r\n * instead of recreating the \"ecModel\" from the \"_optionBackup\".\r\n */\n// function mergeToBackupOption(\n// fakeCmptsMap: FakeComponentsMap,\n// // `tarOption` Can be null/undefined, means init\n// tarOption: ECUnitOption,\n// newOption: ECUnitOption,\n// // Can be null/undefined\n// opt: InnerSetOptionOpts\n// ): void {\n// newOption = newOption || {} as ECUnitOption;\n// const notInit = !!tarOption;\n// each(newOption, function (newOptsInMainType, mainType) {\n// if (newOptsInMainType == null) {\n// return;\n// }\n// if (!ComponentModel.hasClass(mainType)) {\n// if (tarOption) {\n// tarOption[mainType] = merge(tarOption[mainType], newOptsInMainType, true);\n// }\n// }\n// else {\n// const oldTarOptsInMainType = notInit ? normalizeToArray(tarOption[mainType]) : null;\n// const oldFakeCmptsInMainType = fakeCmptsMap.get(mainType) || [];\n// const resultTarOptsInMainType = notInit ? (tarOption[mainType] = [] as ComponentOption[]) : null;\n// const resultFakeCmptsInMainType = fakeCmptsMap.set(mainType, []);\n// const mappingResult = mappingToExists(\n// oldFakeCmptsInMainType,\n// normalizeToArray(newOptsInMainType),\n// (opt && opt.replaceMergeMainTypeMap.get(mainType)) ? 'replaceMerge' : 'normalMerge'\n// );\n// setComponentTypeToKeyInfo(mappingResult, mainType, ComponentModel as ComponentModelConstructor);\n// each(mappingResult, function (resultItem, index) {\n// // The same logic as `Global.ts#_mergeOption`.\n// let fakeCmpt = resultItem.existing;\n// const newOption = resultItem.newOption;\n// const keyInfo = resultItem.keyInfo;\n// let fakeCmptOpt;\n// if (!newOption) {\n// fakeCmptOpt = oldTarOptsInMainType[index];\n// }\n// else {\n// if (fakeCmpt && fakeCmpt.subType === keyInfo.subType) {\n// fakeCmpt.name = keyInfo.name;\n// if (notInit) {\n// fakeCmptOpt = merge(oldTarOptsInMainType[index], newOption, true);\n// }\n// }\n// else {\n// fakeCmpt = extend({}, keyInfo);\n// if (notInit) {\n// fakeCmptOpt = clone(newOption);\n// }\n// }\n// }\n// if (fakeCmpt) {\n// notInit && resultTarOptsInMainType.push(fakeCmptOpt);\n// resultFakeCmptsInMainType.push(fakeCmpt);\n// }\n// else {\n// notInit && resultTarOptsInMainType.push(void 0);\n// resultFakeCmptsInMainType.push(void 0);\n// }\n// });\n// }\n// });\n// }\n\n\nexport default OptionManager;","\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\n*/\nimport { each, isArray, isObject, isTypedArray, defaults } from 'zrender/lib/core/util.js';\nimport compatStyle from './helper/compatStyle.js';\nimport { normalizeToArray } from '../util/model.js';\nimport { deprecateLog, deprecateReplaceLog } from '../util/log.js';\n\nfunction get(opt, path) {\n var pathArr = path.split(',');\n var obj = opt;\n\n for (var i = 0; i < pathArr.length; i++) {\n obj = obj && obj[pathArr[i]];\n\n if (obj == null) {\n break;\n }\n }\n\n return obj;\n}\n\nfunction set(opt, path, val, overwrite) {\n var pathArr = path.split(',');\n var obj = opt;\n var key;\n var i = 0;\n\n for (; i < pathArr.length - 1; i++) {\n key = pathArr[i];\n\n if (obj[key] == null) {\n obj[key] = {};\n }\n\n obj = obj[key];\n }\n\n if (overwrite || obj[pathArr[i]] == null) {\n obj[pathArr[i]] = val;\n }\n}\n\nfunction compatLayoutProperties(option) {\n option && each(LAYOUT_PROPERTIES, function (prop) {\n if (prop[0] in option && !(prop[1] in option)) {\n option[prop[1]] = option[prop[0]];\n }\n });\n}\n\nvar LAYOUT_PROPERTIES = [['x', 'left'], ['y', 'top'], ['x2', 'right'], ['y2', 'bottom']];\nvar COMPATITABLE_COMPONENTS = ['grid', 'geo', 'parallel', 'legend', 'toolbox', 'title', 'visualMap', 'dataZoom', 'timeline'];\nvar BAR_ITEM_STYLE_MAP = [['borderRadius', 'barBorderRadius'], ['borderColor', 'barBorderColor'], ['borderWidth', 'barBorderWidth']];\n\nfunction compatBarItemStyle(option) {\n var itemStyle = option && option.itemStyle;\n\n if (itemStyle) {\n for (var i = 0; i < BAR_ITEM_STYLE_MAP.length; i++) {\n var oldName = BAR_ITEM_STYLE_MAP[i][1];\n var newName = BAR_ITEM_STYLE_MAP[i][0];\n\n if (itemStyle[oldName] != null) {\n itemStyle[newName] = itemStyle[oldName];\n\n if (process.env.NODE_ENV !== 'production') {\n deprecateReplaceLog(oldName, newName);\n }\n }\n }\n }\n}\n\nfunction compatPieLabel(option) {\n if (!option) {\n return;\n }\n\n if (option.alignTo === 'edge' && option.margin != null && option.edgeDistance == null) {\n if (process.env.NODE_ENV !== 'production') {\n deprecateReplaceLog('label.margin', 'label.edgeDistance', 'pie');\n }\n\n option.edgeDistance = option.margin;\n }\n}\n\nfunction compatSunburstState(option) {\n if (!option) {\n return;\n }\n\n if (option.downplay && !option.blur) {\n option.blur = option.downplay;\n\n if (process.env.NODE_ENV !== 'production') {\n deprecateReplaceLog('downplay', 'blur', 'sunburst');\n }\n }\n}\n\nfunction compatGraphFocus(option) {\n if (!option) {\n return;\n }\n\n if (option.focusNodeAdjacency != null) {\n option.emphasis = option.emphasis || {};\n\n if (option.emphasis.focus == null) {\n if (process.env.NODE_ENV !== 'production') {\n deprecateReplaceLog('focusNodeAdjacency', 'emphasis: { focus: \\'adjacency\\'}', 'graph/sankey');\n }\n\n option.emphasis.focus = 'adjacency';\n }\n }\n}\n\nfunction traverseTree(data, cb) {\n if (data) {\n for (var i = 0; i < data.length; i++) {\n cb(data[i]);\n data[i] && traverseTree(data[i].children, cb);\n }\n }\n}\n\nexport default function globalBackwardCompat(option, isTheme) {\n compatStyle(option, isTheme); // Make sure series array for model initialization.\n\n option.series = normalizeToArray(option.series);\n each(option.series, function (seriesOpt) {\n if (!isObject(seriesOpt)) {\n return;\n }\n\n var seriesType = seriesOpt.type;\n\n if (seriesType === 'line') {\n if (seriesOpt.clipOverflow != null) {\n seriesOpt.clip = seriesOpt.clipOverflow;\n\n if (process.env.NODE_ENV !== 'production') {\n deprecateReplaceLog('clipOverflow', 'clip', 'line');\n }\n }\n } else if (seriesType === 'pie' || seriesType === 'gauge') {\n if (seriesOpt.clockWise != null) {\n seriesOpt.clockwise = seriesOpt.clockWise;\n\n if (process.env.NODE_ENV !== 'production') {\n deprecateReplaceLog('clockWise', 'clockwise');\n }\n }\n\n compatPieLabel(seriesOpt.label);\n var data = seriesOpt.data;\n\n if (data && !isTypedArray(data)) {\n for (var i = 0; i < data.length; i++) {\n compatPieLabel(data[i]);\n }\n }\n\n if (seriesOpt.hoverOffset != null) {\n seriesOpt.emphasis = seriesOpt.emphasis || {};\n\n if (seriesOpt.emphasis.scaleSize = null) {\n if (process.env.NODE_ENV !== 'production') {\n deprecateReplaceLog('hoverOffset', 'emphasis.scaleSize');\n }\n\n seriesOpt.emphasis.scaleSize = seriesOpt.hoverOffset;\n }\n }\n } else if (seriesType === 'gauge') {\n var pointerColor = get(seriesOpt, 'pointer.color');\n pointerColor != null && set(seriesOpt, 'itemStyle.color', pointerColor);\n } else if (seriesType === 'bar') {\n compatBarItemStyle(seriesOpt);\n compatBarItemStyle(seriesOpt.backgroundStyle);\n compatBarItemStyle(seriesOpt.emphasis);\n var data = seriesOpt.data;\n\n if (data && !isTypedArray(data)) {\n for (var i = 0; i < data.length; i++) {\n if (typeof data[i] === 'object') {\n compatBarItemStyle(data[i]);\n compatBarItemStyle(data[i] && data[i].emphasis);\n }\n }\n }\n } else if (seriesType === 'sunburst') {\n var highlightPolicy = seriesOpt.highlightPolicy;\n\n if (highlightPolicy) {\n seriesOpt.emphasis = seriesOpt.emphasis || {};\n\n if (!seriesOpt.emphasis.focus) {\n seriesOpt.emphasis.focus = highlightPolicy;\n\n if (process.env.NODE_ENV !== 'production') {\n deprecateReplaceLog('highlightPolicy', 'emphasis.focus', 'sunburst');\n }\n }\n }\n\n compatSunburstState(seriesOpt);\n traverseTree(seriesOpt.data, compatSunburstState);\n } else if (seriesType === 'graph' || seriesType === 'sankey') {\n compatGraphFocus(seriesOpt); // TODO nodes, edges?\n } else if (seriesType === 'map') {\n if (seriesOpt.mapType && !seriesOpt.map) {\n if (process.env.NODE_ENV !== 'production') {\n deprecateReplaceLog('mapType', 'map', 'map');\n }\n\n seriesOpt.map = seriesOpt.mapType;\n }\n\n if (seriesOpt.mapLocation) {\n if (process.env.NODE_ENV !== 'production') {\n deprecateLog('`mapLocation` is not used anymore.');\n }\n\n defaults(seriesOpt, seriesOpt.mapLocation);\n }\n }\n\n if (seriesOpt.hoverAnimation != null) {\n seriesOpt.emphasis = seriesOpt.emphasis || {};\n\n if (seriesOpt.emphasis && seriesOpt.emphasis.scale == null) {\n if (process.env.NODE_ENV !== 'production') {\n deprecateReplaceLog('hoverAnimation', 'emphasis.scale');\n }\n\n seriesOpt.emphasis.scale = seriesOpt.hoverAnimation;\n }\n }\n\n compatLayoutProperties(seriesOpt);\n }); // dataRange has changed to visualMap\n\n if (option.dataRange) {\n option.visualMap = option.dataRange;\n }\n\n each(COMPATITABLE_COMPONENTS, function (componentName) {\n var options = option[componentName];\n\n if (options) {\n if (!isArray(options)) {\n options = [options];\n }\n\n each(options, function (option) {\n compatLayoutProperties(option);\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\n*/\nimport { createHashMap, each } from 'zrender/lib/core/util.js';\nimport { addSafe } from '../util/number.js'; // (1) [Caution]: the logic is correct based on the premises:\n// data processing stage is blocked in stream.\n// See \n// (2) Only register once when import repeatedly.\n// Should be executed after series is filtered and before stack calculation.\n\nexport default function dataStack(ecModel) {\n var stackInfoMap = createHashMap();\n ecModel.eachSeries(function (seriesModel) {\n var stack = seriesModel.get('stack'); // Compatible: when `stack` is set as '', do not stack.\n\n if (stack) {\n var stackInfoList = stackInfoMap.get(stack) || stackInfoMap.set(stack, []);\n var data = seriesModel.getData();\n var stackInfo = {\n // Used for calculate axis extent automatically.\n // TODO: Type getCalculationInfo return more specific type?\n stackResultDimension: data.getCalculationInfo('stackResultDimension'),\n stackedOverDimension: data.getCalculationInfo('stackedOverDimension'),\n stackedDimension: data.getCalculationInfo('stackedDimension'),\n stackedByDimension: data.getCalculationInfo('stackedByDimension'),\n isStackedByIndex: data.getCalculationInfo('isStackedByIndex'),\n data: data,\n seriesModel: seriesModel\n }; // If stacked on axis that do not support data stack.\n\n if (!stackInfo.stackedDimension || !(stackInfo.isStackedByIndex || stackInfo.stackedByDimension)) {\n return;\n }\n\n stackInfoList.length && data.setCalculationInfo('stackedOnSeries', stackInfoList[stackInfoList.length - 1].seriesModel);\n stackInfoList.push(stackInfo);\n }\n });\n stackInfoMap.each(calculateStack);\n}\n\nfunction calculateStack(stackInfoList) {\n each(stackInfoList, function (targetStackInfo, idxInStack) {\n var resultVal = [];\n var resultNaN = [NaN, NaN];\n var dims = [targetStackInfo.stackResultDimension, targetStackInfo.stackedOverDimension];\n var targetData = targetStackInfo.data;\n var isStackedByIndex = targetStackInfo.isStackedByIndex;\n var stackStrategy = targetStackInfo.seriesModel.get('stackStrategy') || 'samesign'; // Should not write on raw data, because stack series model list changes\n // depending on legend selection.\n\n targetData.modify(dims, function (v0, v1, dataIndex) {\n var sum = targetData.get(targetStackInfo.stackedDimension, dataIndex); // Consider `connectNulls` of line area, if value is NaN, stackedOver\n // should also be NaN, to draw a appropriate belt area.\n\n if (isNaN(sum)) {\n return resultNaN;\n }\n\n var byValue;\n var stackedDataRawIndex;\n\n if (isStackedByIndex) {\n stackedDataRawIndex = targetData.getRawIndex(dataIndex);\n } else {\n byValue = targetData.get(targetStackInfo.stackedByDimension, dataIndex);\n } // If stackOver is NaN, chart view will render point on value start.\n\n\n var stackedOver = NaN;\n\n for (var j = idxInStack - 1; j >= 0; j--) {\n var stackInfo = stackInfoList[j]; // Has been optimized by inverted indices on `stackedByDimension`.\n\n if (!isStackedByIndex) {\n stackedDataRawIndex = stackInfo.data.rawIndexOf(stackInfo.stackedByDimension, byValue);\n }\n\n if (stackedDataRawIndex >= 0) {\n var val = stackInfo.data.getByRawIndex(stackInfo.stackResultDimension, stackedDataRawIndex); // Considering positive stack, negative stack and empty data\n\n if (stackStrategy === 'all' // single stack group\n || stackStrategy === 'positive' && val > 0 || stackStrategy === 'negative' && val < 0 || stackStrategy === 'samesign' && sum >= 0 && val > 0 // All positive stack\n || stackStrategy === 'samesign' && sum <= 0 && val < 0 // All negative stack\n ) {\n // The sum has to be very small to be affected by the\n // floating arithmetic problem. An incorrect result will probably\n // cause axis min/max to be filtered incorrectly.\n sum = addSafe(sum, val);\n stackedOver = val;\n break;\n }\n }\n }\n\n resultVal[0] = sum;\n resultVal[1] = stackedOver;\n return resultVal;\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\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(\"Unknown 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(\"Unknown 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. Because 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 uses one scope.\n // Pie and funnel are using different 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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\n*/\nimport * as zrUtil from 'zrender/lib/core/util.js';\nimport * as graphic from '../util/graphic.js';\nvar PI = Math.PI;\n/**\r\n * @param {module:echarts/ExtensionAPI} api\r\n * @param {Object} [opts]\r\n * @param {string} [opts.text]\r\n * @param {string} [opts.color]\r\n * @param {string} [opts.textColor]\r\n * @return {module:zrender/Element}\r\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\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 /**\r\n * Current, progressive rendering starts from visual and layout.\r\n * Always detect render mode in the same stage, avoiding that incorrect\r\n * detection caused by data filtering.\r\n * Caution:\r\n * `updateStreamModes` use `seriesModel.getData()`.\r\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 declare `performRawSeries` in handlers, only\n // stream-independent (specifically, data item independent) operations can be\n // performed. Because if 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 operations\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\" is not supported for \"overallReset\", ' + 'because 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 legacy case), the overall task will only be\n // executed when upstream is dirty. Otherwise the progressive rendering of all\n // pipelines will be disabled unexpectedly. But it still needs stubs to receive\n // dirty info from upstream.\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/**\r\n * Only some legacy stage handlers (usually in echarts extensions) are pure function.\r\n * To ensure that they can work normally, they should work in block mode, that is,\r\n * they should not be started util the previous tasks finished. So they cause the\r\n * progressive rendering disabled. We try to detect the series type, to narrow down\r\n * the block range to only the series type they concern, but not all series.\r\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\n*/\nimport * as zrUtil from 'zrender/lib/core/util.js';\nimport { parseClassType } from './clazz.js';\n/**\r\n * Usage of query:\r\n * `chart.on('click', query, handler);`\r\n * The `query` can be:\r\n * + The component type query string, only `mainType` or `mainType.subType`,\r\n * like: 'xAxis', 'series', 'xAxis.category' or 'series.line'.\r\n * + The component query object, like:\r\n * `{seriesIndex: 2}`, `{seriesName: 'xx'}`, `{seriesId: 'some'}`,\r\n * `{xAxisIndex: 2}`, `{xAxisName: 'xx'}`, `{xAxisId: 'some'}`.\r\n * + The data query object, like:\r\n * `{dataIndex: 123}`, `{dataType: 'link'}`, `{name: 'some'}`.\r\n * + The other query object (cmponent customized query), like:\r\n * `{element: 'some'}` (only available in custom series).\r\n *\r\n * Caveat: If a prop in the `query` object is `null/undefined`, it is the\r\n * same as there is no such prop in the `query` object.\r\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 won't 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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\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// Includes: 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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\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\nimport { __extends } from \"tslib\";\n/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\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, retrieve2 } 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, warn } 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';\nexport var version = '5.4.3';\nexport var dependencies = {\n zrender: '5.4.4'\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 beginning 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 defaultCoarsePointer = 'auto';\n var defaultUseDirtyRect = false;\n\n if (process.env.NODE_ENV !== 'production') {\n var root =\n /* eslint-disable-next-line */\n env.hasGlobalWindow ? window : global;\n defaultRenderer = root.__ECHARTS__DEFAULT__RENDERER__ || defaultRenderer;\n defaultCoarsePointer = retrieve2(root.__ECHARTS__DEFAULT__COARSE_POINTER, defaultCoarsePointer);\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: retrieve2(opts.useDirtyRect, defaultUseDirtyRect),\n useCoarsePointer: retrieve2(opts.useCoarsePointer, defaultCoarsePointer),\n pointerSize: opts.pointerSize\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 determined in the first frame (the\n // frame is executed immediately 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 /**\r\n * @deprecated\r\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 || env.hasGlobalWindow && window.devicePixelRatio || 1;\n };\n /**\r\n * Get canvas which has all thing rendered\r\n * @deprecated Use renderToCanvas instead.\r\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 /**\r\n * Get svg data url\r\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 /**\r\n * Is the specified coordinate systems or components contain the given pixel point.\r\n * @param {Array|number} value\r\n * @return {boolean} result\r\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 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 warn(key + ': containPoint is not supported');\n }\n }\n }, this);\n }, this);\n return !!result;\n };\n /**\r\n * Get visual from series or data.\r\n * @param finder\r\n * If string, e.g., 'series', means {seriesIndex: 0}.\r\n * If Object, could contain some of these properties below:\r\n * {\r\n * seriesIndex / seriesId / seriesName,\r\n * dataIndex / dataIndexInside\r\n * }\r\n * If dataIndex is not specified, series visual will be fetched,\r\n * but not data item visual.\r\n * If all of seriesIndex, seriesId, seriesName are not specified,\r\n * visual will be fetched from first series.\r\n * @param visualType 'color', 'symbol', 'symbolSize'\r\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 warn('There is no specified series 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 /**\r\n * Get view of corresponding component model\r\n */\n\n\n ECharts.prototype.getViewOfComponentModel = function (componentModel) {\n return this._componentsMap[componentModel.__viewId];\n };\n /**\r\n * Get view of corresponding series model\r\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, el) || {};\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 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 /**\r\n * Resize the chart\r\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 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 /**\r\n * Hide loading effect\r\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 /**\r\n * @param opt If pass boolean, means opt.silent\r\n * @param opt.silent Default `false`. Whether trigger events.\r\n * @param opt.flush Default `undefined`.\r\n * true: Flush immediately, and then pixel in canvas can be fetched\r\n * immediately. Caution: it might affect performance.\r\n * false: Not flush.\r\n * undefined: Auto decide whether perform flush.\r\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 embedded browser, `requestAnimationFrame` and `setInterval`\n // hang when sliding page (on touch event), which cause that zr does not\n // refresh until 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 /**\r\n * Prepare view instances of charts and components\r\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 default 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 original 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 // determine whether to 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 required 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 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 /**\r\n * Event `rendered` is triggered when zr\r\n * rendered. It is useful for realtime\r\n * snapshot (reflect animation).\r\n *\r\n * Event `finished` is triggered when:\r\n * (1) zrender rendering finished.\r\n * (2) initial animation finished.\r\n * (3) progressive rendering finished.\r\n * (4) no pending action.\r\n * (5) no delayed setOption needs to be processed.\r\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 repeatedly,\n // so it should only be triggered when rendering indeed happens\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 /**\r\n * Render each chart and component\r\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 // incremental render (always 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 /**\r\n * Update chart and blend.\r\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 // DON'T mark the element dirty. In case element is incremental and don't want 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 want 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 } // Use highlighted 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/**\r\n * @deprecated\r\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 warn('Instance ' + id + ' has been disposed');\n }\n}\n\nvar actions = {};\n/**\r\n * Map eventType to actionType\r\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/**\r\n * @param opts.devicePixelRatio Use window.devicePixelRatio by default\r\n * @param opts.renderer Can choose 'canvas' or 'svg' to render the chart.\r\n * @param opts.width Use clientWidth of the input `dom` by default.\r\n * Can be 'auto' (the same as null/undefined)\r\n * @param opts.height Use clientHeight of the input `dom` by default.\r\n * Can be 'auto' (the same as null/undefined)\r\n * @param opts.locale Specify the locale.\r\n * @param opts.useDirtyRect Enable dirty rectangle rendering or not.\r\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 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 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/**\r\n * @usage\r\n * (A)\r\n * ```js\r\n * let chart1 = echarts.init(dom1);\r\n * let chart2 = echarts.init(dom2);\r\n * chart1.group = 'xxx';\r\n * chart2.group = 'xxx';\r\n * echarts.connect('xxx');\r\n * ```\r\n * (B)\r\n * ```js\r\n * let chart1 = echarts.init(dom1);\r\n * let chart2 = echarts.init(dom2);\r\n * echarts.connect('xxx', [chart1, chart2]);\r\n * ```\r\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}\nexport function disconnect(groupId) {\n connectedGroups[groupId] = false;\n}\n/**\r\n * Alias and backward compatibility\r\n * @deprecated\r\n */\n\nexport var disConnect = disconnect;\n/**\r\n * Dispose a chart instance\r\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/**\r\n * Register theme\r\n */\n\nexport function registerTheme(name, theme) {\n themeStorage[name] = theme;\n}\n/**\r\n * Register option preprocessor\r\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/**\r\n * Register postIniter\r\n * @param {Function} postInitFunc\r\n */\n\nexport function registerPostInit(postInitFunc) {\n registerUpdateLifecycle('afterinit', postInitFunc);\n}\n/**\r\n * Register postUpdater\r\n * @param {Function} postUpdateFunc\r\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/**\r\n * Get dimensions of specified coordinate system.\r\n * @param {string} type\r\n * @return {Array.}\r\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/**\r\n * ZRender need a canvas context to do measureText.\r\n * But in node environment canvas may be created by node-canvas.\r\n * So we need to specify how to create a canvas instead of using document.createElement('canvas')\r\n *\r\n *\r\n * @deprecated use setPlatformAPI({ createCanvas }) instead.\r\n *\r\n * @example\r\n * let Canvas = require('canvas');\r\n * let echarts = require('echarts');\r\n * echarts.setCanvasCreator(function () {\r\n * // Small size is enough.\r\n * return new Canvas(32, 32);\r\n * });\r\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/**\r\n * The parameters and usage: see `geoSourceManager.registerMap`.\r\n * Compatible with previous `echarts.registerMap`.\r\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/**\r\n * Globa dispatchAction to a specified chart instance.\r\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// Builtin 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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\n*/\nimport { error } from '../util/log.js'; // Implementation of exported APIs. For example registerMap, getMap.\n// The implementations 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\n/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\n\n/**\r\n * Language: English.\r\n */\nexport default {\n time: {\n month: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],\n monthAbbr: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],\n dayOfWeek: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],\n dayOfWeekAbbr: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']\n },\n legend: {\n selector: {\n all: 'All',\n inverse: 'Inv'\n }\n },\n toolbox: {\n brush: {\n title: {\n rect: 'Box Select',\n polygon: 'Lasso Select',\n lineX: 'Horizontally Select',\n lineY: 'Vertically Select',\n keep: 'Keep Selections',\n clear: 'Clear Selections'\n }\n },\n dataView: {\n title: 'Data View',\n lang: ['Data View', 'Close', 'Refresh']\n },\n dataZoom: {\n title: {\n zoom: 'Zoom',\n back: 'Zoom Reset'\n }\n },\n magicType: {\n title: {\n line: 'Switch to Line Chart',\n bar: 'Switch to Bar Chart',\n stack: 'Stack',\n tiled: 'Tile'\n }\n },\n restore: {\n title: 'Restore'\n },\n saveAsImage: {\n title: 'Save as Image',\n lang: ['Right Click to Save Image']\n }\n },\n series: {\n typeNames: {\n pie: 'Pie chart',\n bar: 'Bar chart',\n line: 'Line chart',\n scatter: 'Scatter plot',\n effectScatter: 'Ripple scatter plot',\n radar: 'Radar chart',\n tree: 'Tree',\n treemap: 'Treemap',\n boxplot: 'Boxplot',\n candlestick: 'Candlestick',\n k: 'K line chart',\n heatmap: 'Heat map',\n map: 'Map',\n parallel: 'Parallel coordinate map',\n lines: 'Line graph',\n graph: 'Relationship graph',\n sankey: 'Sankey diagram',\n funnel: 'Funnel chart',\n gauge: 'Gauge',\n pictorialBar: 'Pictorial bar',\n themeRiver: 'Theme River Map',\n sunburst: 'Sunburst'\n }\n },\n aria: {\n general: {\n withTitle: 'This is a chart about \"{title}\"',\n withoutTitle: 'This is a chart'\n },\n series: {\n single: {\n prefix: '',\n withName: ' with type {seriesType} named {seriesName}.',\n withoutName: ' with type {seriesType}.'\n },\n multiple: {\n prefix: '. It consists of {seriesCount} series count.',\n withName: ' The {seriesId} series is a {seriesType} representing {seriesName}.',\n withoutName: ' The {seriesId} series is a {seriesType}.',\n separator: {\n middle: '',\n end: ''\n }\n }\n },\n data: {\n allData: 'The data is as follows: ',\n partialData: 'The first {displayCnt} items are: ',\n withName: 'the data for {name} is {value}',\n withoutName: '{value}',\n separator: {\n middle: ', ',\n end: '. '\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/*\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n * specific language governing permissions and limitations\r\n * under the License.\r\n */\nexport default {\n time: {\n month: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],\n monthAbbr: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],\n dayOfWeek: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],\n dayOfWeekAbbr: ['日', '一', '二', '三', '四', '五', '六']\n },\n legend: {\n selector: {\n all: '全选',\n inverse: '反选'\n }\n },\n toolbox: {\n brush: {\n title: {\n rect: '矩形选择',\n polygon: '圈选',\n lineX: '横向选择',\n lineY: '纵向选择',\n keep: '保持选择',\n clear: '清除选择'\n }\n },\n dataView: {\n title: '数据视图',\n lang: ['数据视图', '关闭', '刷新']\n },\n dataZoom: {\n title: {\n zoom: '区域缩放',\n back: '区域缩放还原'\n }\n },\n magicType: {\n title: {\n line: '切换为折线图',\n bar: '切换为柱状图',\n stack: '切换为堆叠',\n tiled: '切换为平铺'\n }\n },\n restore: {\n title: '还原'\n },\n saveAsImage: {\n title: '保存为图片',\n lang: ['右键另存为图片']\n }\n },\n series: {\n typeNames: {\n pie: '饼图',\n bar: '柱状图',\n line: '折线图',\n scatter: '散点图',\n effectScatter: '涟漪散点图',\n radar: '雷达图',\n tree: '树图',\n treemap: '矩形树图',\n boxplot: '箱型图',\n candlestick: 'K线图',\n k: 'K线图',\n heatmap: '热力图',\n map: '地图',\n parallel: '平行坐标图',\n lines: '线图',\n graph: '关系图',\n sankey: '桑基图',\n funnel: '漏斗图',\n gauge: '仪表盘图',\n pictorialBar: '象形柱图',\n themeRiver: '主题河流图',\n sunburst: '旭日图'\n }\n },\n aria: {\n general: {\n withTitle: '这是一个关于“{title}”的图表。',\n withoutTitle: '这是一个图表,'\n },\n series: {\n single: {\n prefix: '',\n withName: '图表类型是{seriesType},表示{seriesName}。',\n withoutName: '图表类型是{seriesType}。'\n },\n multiple: {\n prefix: '它由{seriesCount}个图表系列组成。',\n withName: '第{seriesId}个系列是一个表示{seriesName}的{seriesType},',\n withoutName: '第{seriesId}个系列是一个{seriesType},',\n separator: {\n middle: ';',\n end: '。'\n }\n }\n },\n data: {\n allData: '其数据是——',\n partialData: '其中,前{displayCnt}项是——',\n withName: '{name}的数据是{value}',\n withoutName: '{value}',\n separator: {\n middle: ',',\n end: ''\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\n*/\nimport Model from '../model/Model.js';\nimport env from 'zrender/lib/core/env.js'; // default import ZH and EN lang\n\nimport langEN from '../i18n/langEN.js';\nimport langZH from '../i18n/langZH.js';\nimport { isString, clone, merge } from 'zrender/lib/core/util.js';\nvar LOCALE_ZH = 'ZH';\nvar LOCALE_EN = 'EN';\nvar DEFAULT_LOCALE = LOCALE_EN;\nvar localeStorage = {};\nvar localeModels = {};\nexport var SYSTEM_LANG = !env.domSupported ? DEFAULT_LOCALE : function () {\n var langStr = (\n /* eslint-disable-next-line */\n document.documentElement.lang || navigator.language || navigator.browserLanguage).toUpperCase();\n return langStr.indexOf(LOCALE_ZH) > -1 ? LOCALE_ZH : DEFAULT_LOCALE;\n}();\nexport function registerLocale(locale, localeObj) {\n locale = locale.toUpperCase();\n localeModels[locale] = new Model(localeObj);\n localeStorage[locale] = localeObj;\n} // export function getLocale(locale: string) {\n// return localeStorage[locale];\n// }\n\nexport function createLocaleObject(locale) {\n if (isString(locale)) {\n var localeObj = localeStorage[locale.toUpperCase()] || {};\n\n if (locale === LOCALE_ZH || locale === LOCALE_EN) {\n return clone(localeObj);\n } else {\n return merge(clone(localeObj), clone(localeStorage[DEFAULT_LOCALE]), false);\n }\n } else {\n return merge(clone(locale), clone(localeStorage[DEFAULT_LOCALE]), false);\n }\n}\nexport function getLocaleModel(lang) {\n return localeModels[lang];\n}\nexport function getDefaultLocaleModel() {\n return localeModels[DEFAULT_LOCALE];\n} // Default locale\n\nregisterLocale(LOCALE_EN, langEN);\nregisterLocale(LOCALE_ZH, langZH);","\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\n*/\nimport { assert, isArray } from 'zrender/lib/core/util.js';\n;\n/**\r\n * @param {Object} define\r\n * @return See the return of `createTask`.\r\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 /**\r\n * @param step Specified step.\r\n * @param skip Skip customer perform call.\r\n * @param modBy Sampling window size.\r\n * @param modDataCount Sampling count.\r\n * @return whether unfinished.\r\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 /**\r\n * @param downTask The downstream task.\r\n * @return The downstream task.\r\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 happens 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 set end, in case\n // that the stub of dataZoom perform again and earse the\n // set 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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\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 /**\r\n * @param context Can be visited by this.context in callback.\r\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 /**\r\n * Callback function when add a data\r\n */\n\n\n DataDiffer.prototype.add = function (func) {\n this._add = func;\n return this;\n };\n /**\r\n * Callback function when update a data\r\n */\n\n\n DataDiffer.prototype.update = function (func) {\n this._update = func;\n return this;\n };\n /**\r\n * Callback function when update a data and only work in `cbMode: 'byKey'`.\r\n */\n\n\n DataDiffer.prototype.updateManyToOne = function (func) {\n this._updateManyToOne = func;\n return this;\n };\n /**\r\n * Callback function when update a data and only work in `cbMode: 'byKey'`.\r\n */\n\n\n DataDiffer.prototype.updateOneToMany = function (func) {\n this._updateOneToMany = func;\n return this;\n };\n /**\r\n * Callback function when update a data and only work in `cbMode: 'byKey'`.\r\n */\n\n\n DataDiffer.prototype.updateManyToMany = function (func) {\n this._updateManyToMany = func;\n return this;\n };\n /**\r\n * Callback function when remove a data\r\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 /**\r\n * For example, consider the case:\r\n * oldData: [o0, o1, o2, o3, o4, o5, o6, o7],\r\n * newData: [n0, n1, n2, n3, n4, n5, n6, n7, n8],\r\n * Where:\r\n * o0, o1, n0 has key 'a' (many to one)\r\n * o5, n4, n5, n6 has key 'b' (one to many)\r\n * o2, n1 has key 'c' (one to one)\r\n * n2, n3 has key 'd' (add)\r\n * o3, o4 has key 'e' (remove)\r\n * o6, o7, n7, n8 has key 'f' (many to many, treated as add and remove)\r\n * Then:\r\n * (The order of the following directives are not ensured.)\r\n * this._updateManyToOne(n0, [o0, o1]);\r\n * this._updateOneToMany([n4, n5, n6], o5);\r\n * this._update(n1, o2);\r\n * this._remove(o3);\r\n * this._remove(o4);\r\n * this._remove(o6);\r\n * this._remove(o7);\r\n * this._add(n2);\r\n * this._add(n3);\r\n * this._add(n7);\r\n * this._add(n8);\r\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\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/**\r\n * Multi dimensional data store\r\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/**\r\n * Basically, DataStore API keep immutable.\r\n */\n\nvar DataStore =\n/** @class */\nfunction () {\n function DataStore() {\n this._chunks = []; // It will not be calculated until needed.\n\n this._rawExtent = [];\n this._extent = [];\n this._count = 0;\n this._rawCount = 0;\n this._calcDimNameToIdx = createHashMap();\n }\n /**\r\n * Initialize from data\r\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), 'Invalid 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 /**\r\n * Caution: even when a `source` instance owned by a series, the created data store\r\n * may still be shared by different sereis (the source hash does not use all `source`\r\n * props, see `sourceManager`). In this case, the `source` props that are not used in\r\n * hash (like `source.dimensionDefine`) probably only belongs to a certain series and\r\n * thus should not be fetch here.\r\n */\n\n\n DataStore.prototype.getSource = function () {\n return this._provider.getSource();\n };\n /**\r\n * @caution Only used in dataStack.\r\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\n if (!isNaN(val)) {\n dimRawExtent[0] = Math.min(val, dimRawExtent[0]);\n dimRawExtent[1] = Math.max(val, dimRawExtent[1]);\n }\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 /**\r\n * Caution: Can be only called on raw data (before `this._indices` created).\r\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 /**\r\n * Get value. Return NaN if idx is out of range.\r\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 /**\r\n * @param dim concrete dim\r\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 /**\r\n * Get sum of data in one dimension\r\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 /**\r\n * Get median of data in one dimension\r\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 /**\r\n * Retrieve the index with given raw data index.\r\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 /**\r\n * Retrieve the index of nearest value.\r\n * @param dim\r\n * @param value\r\n * @param [maxDistance=Infinity]\r\n * @return If and only if multiple indices have\r\n * the same value, they are put to the result.\r\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 choose the one that `diff >= 0` in this case.\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 /**\r\n * Data filter.\r\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 /**\r\n * Select data in range. (For optimization of filter)\r\n * (Manually inline code, support 5 million data filtering in data zoom.)\r\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 /**\r\n * Data mapping to a new List with given dimensions\r\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 /**\r\n * @caution Danger!! Only used in dataStack.\r\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 /**\r\n * Large data down sampling using largest-triangle-three-buckets\r\n * @param {string} valueDimension\r\n * @param {number} targetCount\r\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.min((Math.ceil(len / frameSize) + 2) * 2, len)); // 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;\n var firstNaNIndex = -1;\n var countNaN = 0; // Find a point from current frame that construct a triangle 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 countNaN++;\n\n if (firstNaNIndex < 0) {\n firstNaNIndex = rawIndex;\n }\n\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 if (countNaN > 0 && countNaN < frameEnd - frameStart) {\n // Append first NaN point in every bucket.\n // It is necessary to ensure the correct order of indices.\n newIndices[sampledIndex++] = Math.min(firstNaNIndex, nextRawIndex);\n nextRawIndex = Math.max(firstNaNIndex, nextRawIndex);\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 /**\r\n * Large data down sampling on given dimension\r\n * @param sampleIndex Sample index for name and id\r\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 /**\r\n * Data iteration\r\n * @param ctx default this\r\n * @example\r\n * list.each('x', function (x, idx) {});\r\n * list.each(['x', 'y'], function (x, y, idx) {});\r\n * list.each(function (idx) {})\r\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 /**\r\n * Get extent of data in one dimension\r\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 /**\r\n * Get raw data item\r\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 /**\r\n * Clone shallow.\r\n *\r\n * @param clonedDims Determine which dims to clone. Will share the data if not specified.\r\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\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 /**\r\n * @return The ordinal. If not found, return NaN.\r\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\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 update 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 /**\r\n * @param dimensionsInput.dimensions\r\n * For example, ['someDimName', {name: 'someDimName', type: 'someDimType'}, ...].\r\n * Dimensions should be concrete names like x, y, z, lng, lat, angle, radius\r\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 = {}; // Global 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 elements\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 /**\r\n *\r\n * Get concrete dimension name by dimension name or dimension index.\r\n * If input a dimension name, do not validate whether the dimension name exits.\r\n *\r\n * @caution\r\n * @param dim Must make sure the dimension is `SeriesDimensionLoose`.\r\n * Because only those dimensions will have auto-generated dimension names if not\r\n * have a user-specified name, and other dimensions will get a return of null/undefined.\r\n *\r\n * @notice Because of this reason, should better use `getDimensionIndex` instead, for examples:\r\n * ```js\r\n * const val = data.getStore().get(data.getDimensionIndex(dim), dataIdx);\r\n * ```\r\n *\r\n * @return Concrete dim name.\r\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 because 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 /**\r\n * Get dimension index in data store. Return -1 if not found.\r\n * Can be used to index value from getRawValue.\r\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 /**\r\n * The meanings of the input parameter `dim`:\r\n *\r\n * + If dim is a number (e.g., `1`), it means the index of the dimension.\r\n * For example, `getDimension(0)` will return 'x' or 'lng' or 'radius'.\r\n * + If dim is a number-like string (e.g., `\"1\"`):\r\n * + If there is the same concrete dim name defined in `series.dimensions` or `dataset.dimensions`,\r\n * it means that concrete name.\r\n * + If not, it will be converted to a number, which means the index of the dimension.\r\n * (why? because of the backward compatibility. We have been tolerating number-like string in\r\n * dimension setting, although now it seems that it is not a good idea.)\r\n * For example, `visualMap[i].dimension: \"1\"` is the same meaning as `visualMap[i].dimension: 1`,\r\n * if no dimension name is defined as `\"1\"`.\r\n * + If dim is a not-number-like string, it means the concrete dim name.\r\n * For example, it can be be default name `\"x\"`, `\"y\"`, `\"z\"`, `\"lng\"`, `\"lat\"`, `\"angle\"`, `\"radius\"`,\r\n * or customized in `dimensions` property of option like `\"age\"`.\r\n *\r\n * @return recognized `DimensionIndex`. Otherwise return null/undefined (means that dim is `DimensionName`).\r\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('Unknown dimension ' + dim);\n }\n }\n\n return dimIdx;\n };\n /**\r\n * Get type and calculation info of particular dimension\r\n * @param dim\r\n * Dimension can be concrete names like x, y, z, lng, lat, angle, radius\r\n * Or a ordinal number. For example getDimensionInfo(0) will return 'x' or 'lng' or 'radius'\r\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 /**\r\n * concrete dimension name list on coord.\r\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 /**\r\n * Initialize from data\r\n * @param data source or data or data store.\r\n * @param nameList The name of a datum is used on data diff and\r\n * default label/tooltip.\r\n * A name can be specified in encode.itemName,\r\n * or dataItem.name (only for series option data),\r\n * or provided in nameList from outside.\r\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 /**\r\n * Caution: Can be only called on raw data (before `this._indices` created).\r\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 /**\r\n * Caution: Can be only called on raw data (before `this._indices` created).\r\n * This method does not modify `rawData` (`dataProvider`), but only\r\n * add values to store.\r\n *\r\n * The final count will be increased by `Math.max(values.length, names.length)`.\r\n *\r\n * @param values That is the SourceType: 'arrayRows', like\r\n * [\r\n * [12, 33, 44],\r\n * [NaN, 43, 1],\r\n * ['-', 'asdf', 0]\r\n * ]\r\n * Each item is exactly corresponding to a dimension.\r\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 /**\r\n * PENDING: In fact currently this function is only used to short-circuit\r\n * the calling of `scale.unionExtentFromData` when data have been filtered by modules\r\n * like \"dataZoom\". `scale.unionExtentFromData` is used to calculate data extent for series on\r\n * an axis, but if a \"axis related data filter module\" is used, the extent of the axis have\r\n * been fixed and no need to calling `scale.unionExtentFromData` actually.\r\n * But if we add \"custom data filter\" in future, which is not \"axis related\", this method may\r\n * be still needed.\r\n *\r\n * Optimize for the scenario that data is filtered by a given extent.\r\n * Consider that if data amount is more than hundreds of thousand,\r\n * extent calculation will cost more than 10ms and the cache will\r\n * be erased because of the filtering.\r\n */\n\n\n SeriesData.prototype.getApproximateExtent = function (dim) {\n return this._approximateExtent[dim] || this._store.getDataExtent(this._getStoreDimIndex(dim));\n };\n /**\r\n * Calculate extent on a filtered data might be time consuming.\r\n * Approximate extent is only used for: calculate extent of filtered data outside.\r\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 /**\r\n * @return Never be null/undefined. `number` will be converted to string. Because:\r\n * In most cases, name is used in display, where returning a string is more convenient.\r\n * In other cases, name is used in query (see `indexOfName`), where we can keep the\r\n * rule that name `2` equals to name `'2'`.\r\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 /**\r\n * @return Never null/undefined. `number` will be converted to string. Because:\r\n * In all cases having encountered at present, id is used in making diff comparison, which\r\n * are usually based on hash map. We can keep the rule that the internal id are always string\r\n * (treat `2` is the same as `'2'`) to make the related logic simple.\r\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 /**\r\n * Get value. Return NaN if idx is out of range.\r\n *\r\n * @notice Should better to use `data.getStore().get(dimIndex, dataIdx)` instead.\r\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 /**\r\n * @notice Should better to use `data.getStore().getByRawIndex(dimIndex, dataIdx)` instead.\r\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 /**\r\n * If value is NaN. Including '-'\r\n * Only check the coord dimensions.\r\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 /**\r\n * Retrieve the index with given name\r\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 /**\r\n * Only support the dimension which inverted index created.\r\n * Do not support other cases until required.\r\n * @param dim concrete dim\r\n * @param value ordinal index\r\n * @return rawIndex\r\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 /**\r\n * Retrieve the index of nearest value\r\n * @param dim\r\n * @param value\r\n * @param [maxDistance=Infinity]\r\n * @return If and only if multiple indices has\r\n * the same value, they are put to the result.\r\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 /**\r\n * Select data in range. (For optimization of filter)\r\n * (Manually inline code, support 5 million data filtering in data zoom.)\r\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, because `_store.dimensions` are not shared.\n // We should consider there probably be shallow clone happen in each series\n // in consequent filter/map.\n\n this._store.modify(dimIndices, fCtx ? zrUtil.bind(cb, fCtx) : cb);\n };\n /**\r\n * Large data down sampling on given dimension\r\n * @param sampleIndex Sample index for name and id\r\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 /**\r\n * Large data down sampling using largest-triangle-three-buckets\r\n * @param {string} valueDimension\r\n * @param {number} targetCount\r\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 /**\r\n * Get model of one data item.\r\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 /**\r\n * Create a data differ\r\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 /**\r\n * Get visual property.\r\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 /**\r\n * Get visual property of single data item\r\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 /**\r\n * If exists visual property of single data item\r\n */\n\n\n SeriesData.prototype.hasItemVisual = function () {\n return this._itemVisuals.length > 0;\n };\n /**\r\n * Make sure itemVisual property is unique\r\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 /**\r\n * Clear itemVisuals and list visual.\r\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 /**\r\n * Get layout property.\r\n */\n\n\n SeriesData.prototype.getLayout = function (key) {\n return this._layout[key];\n };\n /**\r\n * Get layout of single data item\r\n */\n\n\n SeriesData.prototype.getItemLayout = function (idx) {\n return this._itemLayouts[idx];\n };\n /**\r\n * Set layout of single data item\r\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 /**\r\n * Clear all layout of single data item\r\n */\n\n\n SeriesData.prototype.clearItemLayouts = function () {\n this._itemLayouts.length = 0;\n };\n /**\r\n * Set graphic element relative to data. It can be set as null\r\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 /**\r\n * Shallow clone a new list except visual and layout properties, and graph elements.\r\n * New list only change the indices.\r\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 /**\r\n * Wrap some method to add more feature\r\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 /**\r\n * @see the comment of `List['getId']`.\r\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 /**\r\n * Data in excludeDimensions is copied, otherwise transferred.\r\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\n*/\nimport * as zrUtil from 'zrender/lib/core/util.js';\n\nvar SeriesDimensionDefine =\n/** @class */\nfunction () {\n /**\r\n * @param opt All of the fields will be shallow copied.\r\n */\n function SeriesDimensionDefine(opt) {\n /**\r\n * The format of `otherDims` is:\r\n * ```js\r\n * {\r\n * tooltip?: number\r\n * label?: number\r\n * itemName?: number\r\n * seriesName?: number\r\n * }\r\n * ```\r\n *\r\n * A `series.encode` can specified these fields:\r\n * ```js\r\n * encode: {\r\n * // \"3, 1, 5\" is the index of data dimension.\r\n * tooltip: [3, 1, 5],\r\n * label: [0, 3],\r\n * ...\r\n * }\r\n * ```\r\n * `otherDims` is the parse result of the `series.encode` above, like:\r\n * ```js\r\n * // Suppose the index of this data dimension is `3`.\r\n * this.otherDims = {\r\n * // `3` is at the index `0` of the `encode.tooltip`\r\n * tooltip: 0,\r\n * // `3` is at the index `1` of the `encode.label`\r\n * label: 1\r\n * };\r\n * ```\r\n *\r\n * This prop should never be `null`/`undefined` after initialized.\r\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\n*/\nimport { isTypedArray, clone, createHashMap, isArray, isObject, isArrayLike, hasOwn, assert, each, map, isNumber, isString, keys } from 'zrender/lib/core/util.js';\nimport { SOURCE_FORMAT_ORIGINAL, SERIES_LAYOUT_BY_COLUMN, SOURCE_FORMAT_UNKNOWN, SOURCE_FORMAT_KEYED_COLUMNS, SOURCE_FORMAT_TYPED_ARRAY, SOURCE_FORMAT_ARRAY_ROWS, SOURCE_FORMAT_OBJECT_ROWS, SERIES_LAYOUT_BY_ROW } from '../util/types.js';\nimport { getDataItemValue } from '../util/model.js';\nimport { BE_ORDINAL, guessOrdinal } from './helper/sourceHelper.js';\n; // @inner\n\nvar SourceImpl =\n/** @class */\nfunction () {\n function SourceImpl(fields) {\n this.data = fields.data || (fields.sourceFormat === SOURCE_FORMAT_KEYED_COLUMNS ? {} : []);\n this.sourceFormat = fields.sourceFormat || SOURCE_FORMAT_UNKNOWN; // Visit config\n\n this.seriesLayoutBy = fields.seriesLayoutBy || SERIES_LAYOUT_BY_COLUMN;\n this.startIndex = fields.startIndex || 0;\n this.dimensionsDetectedCount = fields.dimensionsDetectedCount;\n this.metaRawOption = fields.metaRawOption;\n var dimensionsDefine = this.dimensionsDefine = fields.dimensionsDefine;\n\n if (dimensionsDefine) {\n for (var i = 0; i < dimensionsDefine.length; i++) {\n var dim = dimensionsDefine[i];\n\n if (dim.type == null) {\n if (guessOrdinal(this, i) === BE_ORDINAL.Must) {\n dim.type = 'ordinal';\n }\n }\n }\n }\n }\n\n return SourceImpl;\n}();\n\nexport function isSourceInstance(val) {\n return val instanceof SourceImpl;\n}\n/**\r\n * Create a source from option.\r\n * NOTE: Created source is immutable. Don't change any properties in it.\r\n */\n\nexport function createSource(sourceData, thisMetaRawOption, // can be null. If not provided, auto detect it from `sourceData`.\nsourceFormat) {\n sourceFormat = sourceFormat || detectSourceFormat(sourceData);\n var seriesLayoutBy = thisMetaRawOption.seriesLayoutBy;\n var determined = determineSourceDimensions(sourceData, sourceFormat, seriesLayoutBy, thisMetaRawOption.sourceHeader, thisMetaRawOption.dimensions);\n var source = new SourceImpl({\n data: sourceData,\n sourceFormat: sourceFormat,\n seriesLayoutBy: seriesLayoutBy,\n dimensionsDefine: determined.dimensionsDefine,\n startIndex: determined.startIndex,\n dimensionsDetectedCount: determined.dimensionsDetectedCount,\n metaRawOption: clone(thisMetaRawOption)\n });\n return source;\n}\n/**\r\n * Wrap original series data for some compatibility cases.\r\n */\n\nexport function createSourceFromSeriesDataOption(data) {\n return new SourceImpl({\n data: data,\n sourceFormat: isTypedArray(data) ? SOURCE_FORMAT_TYPED_ARRAY : SOURCE_FORMAT_ORIGINAL\n });\n}\n/**\r\n * Clone source but excludes source data.\r\n */\n\nexport function cloneSourceShallow(source) {\n return new SourceImpl({\n data: source.data,\n sourceFormat: source.sourceFormat,\n seriesLayoutBy: source.seriesLayoutBy,\n dimensionsDefine: clone(source.dimensionsDefine),\n startIndex: source.startIndex,\n dimensionsDetectedCount: source.dimensionsDetectedCount\n });\n}\n/**\r\n * Note: An empty array will be detected as `SOURCE_FORMAT_ARRAY_ROWS`.\r\n */\n\nexport function detectSourceFormat(data) {\n var sourceFormat = SOURCE_FORMAT_UNKNOWN;\n\n if (isTypedArray(data)) {\n sourceFormat = SOURCE_FORMAT_TYPED_ARRAY;\n } else if (isArray(data)) {\n // FIXME Whether tolerate null in top level array?\n if (data.length === 0) {\n sourceFormat = SOURCE_FORMAT_ARRAY_ROWS;\n }\n\n for (var i = 0, len = data.length; i < len; i++) {\n var item = data[i];\n\n if (item == null) {\n continue;\n } else if (isArray(item)) {\n sourceFormat = SOURCE_FORMAT_ARRAY_ROWS;\n break;\n } else if (isObject(item)) {\n sourceFormat = SOURCE_FORMAT_OBJECT_ROWS;\n break;\n }\n }\n } else if (isObject(data)) {\n for (var key in data) {\n if (hasOwn(data, key) && isArrayLike(data[key])) {\n sourceFormat = SOURCE_FORMAT_KEYED_COLUMNS;\n break;\n }\n }\n }\n\n return sourceFormat;\n}\n/**\r\n * Determine the source definitions from data standalone dimensions definitions\r\n * are not specified.\r\n */\n\nfunction determineSourceDimensions(data, sourceFormat, seriesLayoutBy, sourceHeader, // standalone raw dimensions definition, like:\n// {\n// dimensions: ['aa', 'bb', { name: 'cc', type: 'time' }]\n// }\n// in `dataset` or `series`\ndimensionsDefine) {\n var dimensionsDetectedCount;\n var startIndex; // PENDING: Could data be null/undefined here?\n // currently, if `dataset.source` not specified, error thrown.\n // if `series.data` not specified, nothing rendered without error thrown.\n // Should test these cases.\n\n if (!data) {\n return {\n dimensionsDefine: normalizeDimensionsOption(dimensionsDefine),\n startIndex: startIndex,\n dimensionsDetectedCount: dimensionsDetectedCount\n };\n }\n\n if (sourceFormat === SOURCE_FORMAT_ARRAY_ROWS) {\n var dataArrayRows = data; // Rule: Most of the first line are string: it is header.\n // Caution: consider a line with 5 string and 1 number,\n // it still can not be sure it is a head, because the\n // 5 string may be 5 values of category columns.\n\n if (sourceHeader === 'auto' || sourceHeader == null) {\n arrayRowsTravelFirst(function (val) {\n // '-' is regarded as null/undefined.\n if (val != null && val !== '-') {\n if (isString(val)) {\n startIndex == null && (startIndex = 1);\n } else {\n startIndex = 0;\n }\n } // 10 is an experience number, avoid long loop.\n\n }, seriesLayoutBy, dataArrayRows, 10);\n } else {\n startIndex = isNumber(sourceHeader) ? sourceHeader : sourceHeader ? 1 : 0;\n }\n\n if (!dimensionsDefine && startIndex === 1) {\n dimensionsDefine = [];\n arrayRowsTravelFirst(function (val, index) {\n dimensionsDefine[index] = val != null ? val + '' : '';\n }, seriesLayoutBy, dataArrayRows, Infinity);\n }\n\n dimensionsDetectedCount = dimensionsDefine ? dimensionsDefine.length : seriesLayoutBy === SERIES_LAYOUT_BY_ROW ? dataArrayRows.length : dataArrayRows[0] ? dataArrayRows[0].length : null;\n } else if (sourceFormat === SOURCE_FORMAT_OBJECT_ROWS) {\n if (!dimensionsDefine) {\n dimensionsDefine = objectRowsCollectDimensions(data);\n }\n } else if (sourceFormat === SOURCE_FORMAT_KEYED_COLUMNS) {\n if (!dimensionsDefine) {\n dimensionsDefine = [];\n each(data, function (colArr, key) {\n dimensionsDefine.push(key);\n });\n }\n } else if (sourceFormat === SOURCE_FORMAT_ORIGINAL) {\n var value0 = getDataItemValue(data[0]);\n dimensionsDetectedCount = isArray(value0) && value0.length || 1;\n } else if (sourceFormat === SOURCE_FORMAT_TYPED_ARRAY) {\n if (process.env.NODE_ENV !== 'production') {\n assert(!!dimensionsDefine, 'dimensions must be given if data is TypedArray.');\n }\n }\n\n return {\n startIndex: startIndex,\n dimensionsDefine: normalizeDimensionsOption(dimensionsDefine),\n dimensionsDetectedCount: dimensionsDetectedCount\n };\n}\n\nfunction objectRowsCollectDimensions(data) {\n var firstIndex = 0;\n var obj;\n\n while (firstIndex < data.length && !(obj = data[firstIndex++])) {} // jshint ignore: line\n\n\n if (obj) {\n return keys(obj);\n }\n} // Consider dimensions defined like ['A', 'price', 'B', 'price', 'C', 'price'],\n// which is reasonable. But dimension name is duplicated.\n// Returns undefined or an array contains only object without null/undefined or string.\n\n\nfunction normalizeDimensionsOption(dimensionsDefine) {\n if (!dimensionsDefine) {\n // The meaning of null/undefined is different from empty array.\n return;\n }\n\n var nameMap = createHashMap();\n return map(dimensionsDefine, function (rawItem, index) {\n rawItem = isObject(rawItem) ? rawItem : {\n name: rawItem\n }; // Other fields will be discarded.\n\n var item = {\n name: rawItem.name,\n displayName: rawItem.displayName,\n type: rawItem.type\n }; // User can set null in dimensions.\n // We don't auto specify name, otherwise a given name may\n // cause it to be referred unexpectedly.\n\n if (item.name == null) {\n return item;\n } // Also consider number form like 2012.\n\n\n item.name += ''; // User may also specify displayName.\n // displayName will always exists except user not\n // specified or dim name is not specified or detected.\n // (A auto generated dim name will not be used as\n // displayName).\n\n if (item.displayName == null) {\n item.displayName = item.name;\n }\n\n var exist = nameMap.get(item.name);\n\n if (!exist) {\n nameMap.set(item.name, {\n count: 1\n });\n } else {\n item.name += '-' + exist.count++;\n }\n\n return item;\n });\n}\n\nfunction arrayRowsTravelFirst(cb, seriesLayoutBy, data, maxLoop) {\n if (seriesLayoutBy === SERIES_LAYOUT_BY_ROW) {\n for (var i = 0; i < data.length && i < maxLoop; i++) {\n cb(data[i] ? data[i][0] : null, i);\n }\n } else {\n var value0 = data[0] || [];\n\n for (var i = 0; i < value0.length && i < maxLoop; i++) {\n cb(value0[i], i);\n }\n }\n}\n\nexport function shouldRetrieveDataByName(source) {\n var sourceFormat = source.sourceFormat;\n return sourceFormat === SOURCE_FORMAT_OBJECT_ROWS || sourceFormat === SOURCE_FORMAT_KEYED_COLUMNS;\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\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/**\r\n * Represents the dimension requirement of a series.\r\n *\r\n * NOTICE:\r\n * When there are too many dimensions in dataset and many series, only the used dimensions\r\n * (i.e., used by coord sys and declared in `series.encode`) are add to `dimensionDefineList`.\r\n * But users may query data by other unused dimension names.\r\n * In this case, users can only query data if and only if they have defined dimension names\r\n * via ec option, so we provide `getDimensionIndexFromSource`, which only query them from\r\n * `source` dimensions.\r\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 /**\r\n * @caution Can only be used when `dimensionOmitted: true`.\r\n *\r\n * Get index by user defined dimension name (i.e., not internal generate name).\r\n * That is, get index from `dimensionsDefine`.\r\n * If no `dimensionsDefine`, or no name get, return -1.\r\n */\n\n\n SeriesDataSchema.prototype.getSourceDimensionIndex = function (dimName) {\n return retrieve2(this._dimNameMap.get(dimName), -1);\n };\n /**\r\n * @caution Can only be used when `dimensionOmitted: true`.\r\n *\r\n * Notice: may return `null`/`undefined` if user not specify dimension names.\r\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 // (Because 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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\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/**\r\n * For outside usage compat (like echarts-gl are using it).\r\n */\n\nexport function createDimensions(source, opt) {\n return prepareSeriesDataSchema(source, opt).dimensions;\n}\n/**\r\n * This method builds the relationship between:\r\n * + \"what the coord sys or series requires (see `coordDimensions`)\",\r\n * + \"what the user defines (in `encode` and `dimensions`, see `opt.dimensionsDefine` and `opt.encodeDefine`)\"\r\n * + \"what the data source provids (see `source`)\".\r\n *\r\n * Some guess strategy will be adapted if user does not define something.\r\n * If no 'value' dimension specified, the first no-named dimension will be\r\n * named as 'value'.\r\n *\r\n * @return The results are always sorted by `storeDimIndex` asc.\r\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 unused 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 displayed 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 templates 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 column should better be treated as a \"ordinal\" although it\n // might not 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 calculate 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 if (fromZero || map.hasKey(name)) {\n var i = 0;\n\n while (map.hasKey(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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\n*/\nvar _a, _b, _c; // TODO\n// ??? refactor? check the outer usage of data provider.\n// merge with defaultDimValueGetter?\n\n\nimport { isTypedArray, extend, assert, each, isObject, bind } from 'zrender/lib/core/util.js';\nimport { getDataItemValue } from '../../util/model.js';\nimport { createSourceFromSeriesDataOption, isSourceInstance } from '../Source.js';\nimport { SOURCE_FORMAT_ORIGINAL, SOURCE_FORMAT_OBJECT_ROWS, SOURCE_FORMAT_KEYED_COLUMNS, SOURCE_FORMAT_TYPED_ARRAY, SOURCE_FORMAT_ARRAY_ROWS, SERIES_LAYOUT_BY_COLUMN, SERIES_LAYOUT_BY_ROW } from '../../util/types.js';\nvar providerMethods;\nvar mountMethods;\n/**\r\n * If normal array used, mutable chunk size is supported.\r\n * If typed array used, chunk size must be fixed.\r\n */\n\nvar DefaultDataProvider =\n/** @class */\nfunction () {\n function DefaultDataProvider(sourceParam, dimSize) {\n // let source: Source;\n var source = !isSourceInstance(sourceParam) ? createSourceFromSeriesDataOption(sourceParam) : sourceParam; // declare source is Source;\n\n this._source = source;\n var data = this._data = source.data; // Typed array. TODO IE10+?\n\n if (source.sourceFormat === SOURCE_FORMAT_TYPED_ARRAY) {\n if (process.env.NODE_ENV !== 'production') {\n if (dimSize == null) {\n throw new Error('Typed array data must specify dimension size');\n }\n }\n\n this._offset = 0;\n this._dimSize = dimSize;\n this._data = data;\n }\n\n mountMethods(this, data, source);\n }\n\n DefaultDataProvider.prototype.getSource = function () {\n return this._source;\n };\n\n DefaultDataProvider.prototype.count = function () {\n return 0;\n };\n\n DefaultDataProvider.prototype.getItem = function (idx, out) {\n return;\n };\n\n DefaultDataProvider.prototype.appendData = function (newData) {};\n\n DefaultDataProvider.prototype.clean = function () {};\n\n DefaultDataProvider.protoInitialize = function () {\n // PENDING: To avoid potential incompat (e.g., prototype\n // is visited somewhere), still init them on prototype.\n var proto = DefaultDataProvider.prototype;\n proto.pure = false;\n proto.persistent = true;\n }();\n\n DefaultDataProvider.internalField = function () {\n var _a;\n\n mountMethods = function (provider, data, source) {\n var sourceFormat = source.sourceFormat;\n var seriesLayoutBy = source.seriesLayoutBy;\n var startIndex = source.startIndex;\n var dimsDef = source.dimensionsDefine;\n var methods = providerMethods[getMethodMapKey(sourceFormat, seriesLayoutBy)];\n\n if (process.env.NODE_ENV !== 'production') {\n assert(methods, 'Invalide sourceFormat: ' + sourceFormat);\n }\n\n extend(provider, methods);\n\n if (sourceFormat === SOURCE_FORMAT_TYPED_ARRAY) {\n provider.getItem = getItemForTypedArray;\n provider.count = countForTypedArray;\n provider.fillStorage = fillStorageForTypedArray;\n } else {\n var rawItemGetter = getRawSourceItemGetter(sourceFormat, seriesLayoutBy);\n provider.getItem = bind(rawItemGetter, null, data, startIndex, dimsDef);\n var rawCounter = getRawSourceDataCounter(sourceFormat, seriesLayoutBy);\n provider.count = bind(rawCounter, null, data, startIndex, dimsDef);\n }\n };\n\n var getItemForTypedArray = function (idx, out) {\n idx = idx - this._offset;\n out = out || [];\n var data = this._data;\n var dimSize = this._dimSize;\n var offset = dimSize * idx;\n\n for (var i = 0; i < dimSize; i++) {\n out[i] = data[offset + i];\n }\n\n return out;\n };\n\n var fillStorageForTypedArray = function (start, end, storage, extent) {\n var data = this._data;\n var dimSize = this._dimSize;\n\n for (var dim = 0; dim < dimSize; dim++) {\n var dimExtent = extent[dim];\n var min = dimExtent[0] == null ? Infinity : dimExtent[0];\n var max = dimExtent[1] == null ? -Infinity : dimExtent[1];\n var count = end - start;\n var arr = storage[dim];\n\n for (var i = 0; i < count; i++) {\n // appendData with TypedArray will always do replace in provider.\n var val = data[i * dimSize + dim];\n arr[start + i] = val;\n val < min && (min = val);\n val > max && (max = val);\n }\n\n dimExtent[0] = min;\n dimExtent[1] = max;\n }\n };\n\n var countForTypedArray = function () {\n return this._data ? this._data.length / this._dimSize : 0;\n };\n\n providerMethods = (_a = {}, _a[SOURCE_FORMAT_ARRAY_ROWS + '_' + SERIES_LAYOUT_BY_COLUMN] = {\n pure: true,\n appendData: appendDataSimply\n }, _a[SOURCE_FORMAT_ARRAY_ROWS + '_' + SERIES_LAYOUT_BY_ROW] = {\n pure: true,\n appendData: function () {\n throw new Error('Do not support appendData when set seriesLayoutBy: \"row\".');\n }\n }, _a[SOURCE_FORMAT_OBJECT_ROWS] = {\n pure: true,\n appendData: appendDataSimply\n }, _a[SOURCE_FORMAT_KEYED_COLUMNS] = {\n pure: true,\n appendData: function (newData) {\n var data = this._data;\n each(newData, function (newCol, key) {\n var oldCol = data[key] || (data[key] = []);\n\n for (var i = 0; i < (newCol || []).length; i++) {\n oldCol.push(newCol[i]);\n }\n });\n }\n }, _a[SOURCE_FORMAT_ORIGINAL] = {\n appendData: appendDataSimply\n }, _a[SOURCE_FORMAT_TYPED_ARRAY] = {\n persistent: false,\n pure: true,\n appendData: function (newData) {\n if (process.env.NODE_ENV !== 'production') {\n assert(isTypedArray(newData), 'Added data must be TypedArray if data in initialization is TypedArray');\n }\n\n this._data = newData;\n },\n // Clean self if data is already used.\n clean: function () {\n // PENDING\n this._offset += this.count();\n this._data = null;\n }\n }, _a);\n\n function appendDataSimply(newData) {\n for (var i = 0; i < newData.length; i++) {\n this._data.push(newData[i]);\n }\n }\n }();\n\n return DefaultDataProvider;\n}();\n\nexport { DefaultDataProvider };\n\nvar getItemSimply = function (rawData, startIndex, dimsDef, idx) {\n return rawData[idx];\n};\n\nvar rawSourceItemGetterMap = (_a = {}, _a[SOURCE_FORMAT_ARRAY_ROWS + '_' + SERIES_LAYOUT_BY_COLUMN] = function (rawData, startIndex, dimsDef, idx) {\n return rawData[idx + startIndex];\n}, _a[SOURCE_FORMAT_ARRAY_ROWS + '_' + SERIES_LAYOUT_BY_ROW] = function (rawData, startIndex, dimsDef, idx, out) {\n idx += startIndex;\n var item = out || [];\n var data = rawData;\n\n for (var i = 0; i < data.length; i++) {\n var row = data[i];\n item[i] = row ? row[idx] : null;\n }\n\n return item;\n}, _a[SOURCE_FORMAT_OBJECT_ROWS] = getItemSimply, _a[SOURCE_FORMAT_KEYED_COLUMNS] = function (rawData, startIndex, dimsDef, idx, out) {\n var item = out || [];\n\n for (var i = 0; i < dimsDef.length; i++) {\n var dimName = dimsDef[i].name;\n\n if (process.env.NODE_ENV !== 'production') {\n if (dimName == null) {\n throw new Error();\n }\n }\n\n var col = rawData[dimName];\n item[i] = col ? col[idx] : null;\n }\n\n return item;\n}, _a[SOURCE_FORMAT_ORIGINAL] = getItemSimply, _a);\nexport function getRawSourceItemGetter(sourceFormat, seriesLayoutBy) {\n var method = rawSourceItemGetterMap[getMethodMapKey(sourceFormat, seriesLayoutBy)];\n\n if (process.env.NODE_ENV !== 'production') {\n assert(method, 'Do not support get item on \"' + sourceFormat + '\", \"' + seriesLayoutBy + '\".');\n }\n\n return method;\n}\n\nvar countSimply = function (rawData, startIndex, dimsDef) {\n return rawData.length;\n};\n\nvar rawSourceDataCounterMap = (_b = {}, _b[SOURCE_FORMAT_ARRAY_ROWS + '_' + SERIES_LAYOUT_BY_COLUMN] = function (rawData, startIndex, dimsDef) {\n return Math.max(0, rawData.length - startIndex);\n}, _b[SOURCE_FORMAT_ARRAY_ROWS + '_' + SERIES_LAYOUT_BY_ROW] = function (rawData, startIndex, dimsDef) {\n var row = rawData[0];\n return row ? Math.max(0, row.length - startIndex) : 0;\n}, _b[SOURCE_FORMAT_OBJECT_ROWS] = countSimply, _b[SOURCE_FORMAT_KEYED_COLUMNS] = function (rawData, startIndex, dimsDef) {\n var dimName = dimsDef[0].name;\n\n if (process.env.NODE_ENV !== 'production') {\n if (dimName == null) {\n throw new Error();\n }\n }\n\n var col = rawData[dimName];\n return col ? col.length : 0;\n}, _b[SOURCE_FORMAT_ORIGINAL] = countSimply, _b);\nexport function getRawSourceDataCounter(sourceFormat, seriesLayoutBy) {\n var method = rawSourceDataCounterMap[getMethodMapKey(sourceFormat, seriesLayoutBy)];\n\n if (process.env.NODE_ENV !== 'production') {\n assert(method, 'Do not support count on \"' + sourceFormat + '\", \"' + seriesLayoutBy + '\".');\n }\n\n return method;\n}\n\nvar getRawValueSimply = function (dataItem, dimIndex, property) {\n return dataItem[dimIndex];\n};\n\nvar rawSourceValueGetterMap = (_c = {}, _c[SOURCE_FORMAT_ARRAY_ROWS] = getRawValueSimply, _c[SOURCE_FORMAT_OBJECT_ROWS] = function (dataItem, dimIndex, property) {\n return dataItem[property];\n}, _c[SOURCE_FORMAT_KEYED_COLUMNS] = getRawValueSimply, _c[SOURCE_FORMAT_ORIGINAL] = function (dataItem, dimIndex, property) {\n // FIXME: In some case (markpoint in geo (geo-map.html)),\n // dataItem is {coord: [...]}\n var value = getDataItemValue(dataItem);\n return !(value instanceof Array) ? value : value[dimIndex];\n}, _c[SOURCE_FORMAT_TYPED_ARRAY] = getRawValueSimply, _c);\nexport function getRawSourceValueGetter(sourceFormat) {\n var method = rawSourceValueGetterMap[sourceFormat];\n\n if (process.env.NODE_ENV !== 'production') {\n assert(method, 'Do not support get value on \"' + sourceFormat + '\".');\n }\n\n return method;\n}\n\nfunction getMethodMapKey(sourceFormat, seriesLayoutBy) {\n return sourceFormat === SOURCE_FORMAT_ARRAY_ROWS ? sourceFormat + '_' + seriesLayoutBy : sourceFormat;\n} // ??? FIXME can these logic be more neat: getRawValue, getRawDataItem,\n// Consider persistent.\n// Caution: why use raw value to display on label or tooltip?\n// A reason is to avoid format. For example time value we do not know\n// how to format is expected. More over, if stack is used, calculated\n// value may be 0.91000000001, which have brings trouble to display.\n// TODO: consider how to treat null/undefined/NaN when display?\n\n\nexport function retrieveRawValue(data, dataIndex, // If dimIndex is null/undefined, return OptionDataItem.\n// Otherwise, return OptionDataValue.\ndim) {\n if (!data) {\n return;\n } // Consider data may be not persistent.\n\n\n var dataItem = data.getRawDataItem(dataIndex);\n\n if (dataItem == null) {\n return;\n }\n\n var store = data.getStore();\n var sourceFormat = store.getSource().sourceFormat;\n\n if (dim != null) {\n var dimIndex = data.getDimensionIndex(dim);\n var property = store.getDimensionProperty(dimIndex);\n return getRawSourceValueGetter(sourceFormat)(dataItem, dimIndex, property);\n } else {\n var result = dataItem;\n\n if (sourceFormat === SOURCE_FORMAT_ORIGINAL) {\n result = getDataItemValue(dataItem);\n }\n\n return result;\n }\n}\n/**\r\n * Compatible with some cases (in pie, map) like:\r\n * data: [{name: 'xx', value: 5, selected: true}, ...]\r\n * where only sourceFormat is 'original' and 'objectRows' supported.\r\n *\r\n * // TODO\r\n * Supported detail options in data item when using 'arrayRows'.\r\n *\r\n * @param data\r\n * @param dataIndex\r\n * @param attr like 'selected'\r\n */\n\nexport function retrieveRawAttr(data, dataIndex, attr) {\n if (!data) {\n return;\n }\n\n var sourceFormat = data.getStore().getSource().sourceFormat;\n\n if (sourceFormat !== SOURCE_FORMAT_ORIGINAL && sourceFormat !== SOURCE_FORMAT_OBJECT_ROWS) {\n return;\n }\n\n var dataItem = data.getRawDataItem(dataIndex);\n\n if (sourceFormat === SOURCE_FORMAT_ORIGINAL && !isObject(dataItem)) {\n dataItem = null;\n }\n\n if (dataItem) {\n return dataItem[attr];\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\n*/\nimport { each, isString } from 'zrender/lib/core/util.js';\nimport { isSeriesDataSchema } from './SeriesDataSchema.js';\n/**\r\n * Note that it is too complicated to support 3d stack by value\r\n * (have to create two-dimension inverted index), so in 3d case\r\n * we just support that stacked by index.\r\n *\r\n * @param seriesModel\r\n * @param dimensionsInput The same as the input of .\r\n * The input will be modified.\r\n * @param opt\r\n * @param opt.stackedCoordDimension Specify a coord dimension if needed.\r\n * @param opt.byIndex=false\r\n * @return calculationInfo\r\n * {\r\n * stackedDimension: string\r\n * stackedByDimension: string\r\n * isStackedByIndex: boolean\r\n * stackedOverDimension: string\r\n * stackResultDimension: string\r\n * }\r\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\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/**\r\n * Convert raw the value in to inner value in List.\r\n *\r\n * [Performance sensitive]\r\n *\r\n * [Caution]: this is the key logic of user value parser.\r\n * For backward compatibility, do not modify it until you have to!\r\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 `numericToNumber` by default.\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 /**\r\n * @param order by default: 'asc'\r\n * @param incomparable by default: Always on the tail.\r\n * That is, if 'asc' => 'max', if 'desc' => 'min'\r\n * See the definition of \"incomparable\" in [SORT_COMPARISON_RULE].\r\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/**\r\n * [FILTER_COMPARISON_RULE]\r\n * `lt`|`lte`|`gt`|`gte`:\r\n * + rval must be a number. And lval will be converted to number (`numericToNumber`) to compare.\r\n * `eq`:\r\n * + If same type, compare with `===`.\r\n * + If there is one number, convert to number (`numericToNumber`) to compare.\r\n * + Else return `false`.\r\n * `ne`:\r\n * + Not `eq`.\r\n *\r\n *\r\n * [SORT_COMPARISON_RULE]\r\n * All the values are grouped into three categories:\r\n * + \"numeric\" (number and numeric string)\r\n * + \"non-numeric-string\" (string that excluding numeric string)\r\n * + \"others\"\r\n * \"numeric\" vs \"numeric\": values are ordered by number order.\r\n * \"non-numeric-string\" vs \"non-numeric-string\": values are ordered by ES spec (#sec-abstract-relational-comparison).\r\n * \"others\" vs \"others\": do not change order (always return 0).\r\n * \"numeric\" vs \"non-numeric-string\": \"non-numeric-string\" is treated as \"incomparable\".\r\n * \"number\" vs \"others\": \"others\" is treated as \"incomparable\".\r\n * \"non-numeric-string\" vs \"others\": \"others\" is treated as \"incomparable\".\r\n * \"incomparable\" will be seen as -Infinity or Infinity (depends on the settings).\r\n * MEMO:\r\n * Non-numeric string sort makes sense when we need to put the items with the same tag together.\r\n * But if we support string sort, we still need to avoid the misleading like `'2' > '12'`,\r\n * So we treat \"numeric-string\" sorted by number order rather than string comparison.\r\n *\r\n *\r\n * [CHECK_LIST_OF_THE_RULE_DESIGN]\r\n * + Do not support string comparison until required. And also need to\r\n * avoid the misleading of \"2\" > \"12\".\r\n * + Should avoid the misleading case:\r\n * `\" 22 \" gte \"22\"` is `true` but `\" 22 \" eq \"22\"` is `false`.\r\n * + JS bad case should be avoided: null <= 0, [] <= 0, ' ' <= 0, ...\r\n * + Only \"numeric\" can be converted to comparable number, otherwise converted to NaN.\r\n * See `util/number.ts#numericToNumber`.\r\n *\r\n * @return If `op` is not `RelationalOperator`, return null;\r\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\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 /**\r\n * Get all data store dimension names.\r\n * Theoretically a series data store is defined both by series and used dataset (if any).\r\n * If some dimensions are omitted for performance reason in `this.dimensions`,\r\n * the dimension name may not be auto-generated if user does not specify a dimension name.\r\n * In this case, the dimension name is `null`/`undefined`.\r\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 recommended, because formatter cannot be set\n // in this way. Use label.formatter instead. Maybe 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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\n*/\nimport { makeInner, getDataItemValue, queryReferringComponents, SINGLE_REFERRING } from '../../util/model.js';\nimport { createHashMap, each, isArray, isString, isObject, isTypedArray } from 'zrender/lib/core/util.js';\nimport { SOURCE_FORMAT_ORIGINAL, SOURCE_FORMAT_ARRAY_ROWS, SOURCE_FORMAT_OBJECT_ROWS, SERIES_LAYOUT_BY_ROW, SOURCE_FORMAT_KEYED_COLUMNS } from '../../util/types.js'; // The result of `guessOrdinal`.\n\nexport var BE_ORDINAL = {\n Must: 1,\n Might: 2,\n Not: 3 // Other cases\n\n};\nvar innerGlobalModel = makeInner();\n/**\r\n * MUST be called before mergeOption of all series.\r\n */\n\nexport function resetSourceDefaulter(ecModel) {\n // `datasetMap` is used to make default encode.\n innerGlobalModel(ecModel).datasetMap = createHashMap();\n}\n/**\r\n * [The strategy of the arrengment of data dimensions for dataset]:\r\n * \"value way\": all axes are non-category axes. So series one by one take\r\n * several (the number is coordSysDims.length) dimensions from dataset.\r\n * The result of data arrengment of data dimensions like:\r\n * | ser0_x | ser0_y | ser1_x | ser1_y | ser2_x | ser2_y |\r\n * \"category way\": at least one axis is category axis. So the the first data\r\n * dimension is always mapped to the first category axis and shared by\r\n * all of the series. The other data dimensions are taken by series like\r\n * \"value way\" does.\r\n * The result of data arrengment of data dimensions like:\r\n * | ser_shared_x | ser0_y | ser1_y | ser2_y |\r\n *\r\n * @return encode Never be `null/undefined`.\r\n */\n\nexport function makeSeriesEncodeForAxisCoordSys(coordDimensions, seriesModel, source) {\n var encode = {};\n var datasetModel = querySeriesUpstreamDatasetModel(seriesModel); // Currently only make default when using dataset, util more reqirements occur.\n\n if (!datasetModel || !coordDimensions) {\n return encode;\n }\n\n var encodeItemName = [];\n var encodeSeriesName = [];\n var ecModel = seriesModel.ecModel;\n var datasetMap = innerGlobalModel(ecModel).datasetMap;\n var key = datasetModel.uid + '_' + source.seriesLayoutBy;\n var baseCategoryDimIndex;\n var categoryWayValueDimStart;\n coordDimensions = coordDimensions.slice();\n each(coordDimensions, function (coordDimInfoLoose, coordDimIdx) {\n var coordDimInfo = isObject(coordDimInfoLoose) ? coordDimInfoLoose : coordDimensions[coordDimIdx] = {\n name: coordDimInfoLoose\n };\n\n if (coordDimInfo.type === 'ordinal' && baseCategoryDimIndex == null) {\n baseCategoryDimIndex = coordDimIdx;\n categoryWayValueDimStart = getDataDimCountOnCoordDim(coordDimInfo);\n }\n\n encode[coordDimInfo.name] = [];\n });\n var datasetRecord = datasetMap.get(key) || datasetMap.set(key, {\n categoryWayDim: categoryWayValueDimStart,\n valueWayDim: 0\n }); // TODO\n // Auto detect first time axis and do arrangement.\n\n each(coordDimensions, function (coordDimInfo, coordDimIdx) {\n var coordDimName = coordDimInfo.name;\n var count = getDataDimCountOnCoordDim(coordDimInfo); // In value way.\n\n if (baseCategoryDimIndex == null) {\n var start = datasetRecord.valueWayDim;\n pushDim(encode[coordDimName], start, count);\n pushDim(encodeSeriesName, start, count);\n datasetRecord.valueWayDim += count; // ??? TODO give a better default series name rule?\n // especially when encode x y specified.\n // consider: when multiple series share one dimension\n // category axis, series name should better use\n // the other dimension name. On the other hand, use\n // both dimensions name.\n } // In category way, the first category axis.\n else if (baseCategoryDimIndex === coordDimIdx) {\n pushDim(encode[coordDimName], 0, count);\n pushDim(encodeItemName, 0, count);\n } // In category way, the other axis.\n else {\n var start = datasetRecord.categoryWayDim;\n pushDim(encode[coordDimName], start, count);\n pushDim(encodeSeriesName, start, count);\n datasetRecord.categoryWayDim += count;\n }\n });\n\n function pushDim(dimIdxArr, idxFrom, idxCount) {\n for (var i = 0; i < idxCount; i++) {\n dimIdxArr.push(idxFrom + i);\n }\n }\n\n function getDataDimCountOnCoordDim(coordDimInfo) {\n var dimsDef = coordDimInfo.dimsDef;\n return dimsDef ? dimsDef.length : 1;\n }\n\n encodeItemName.length && (encode.itemName = encodeItemName);\n encodeSeriesName.length && (encode.seriesName = encodeSeriesName);\n return encode;\n}\n/**\r\n * Work for data like [{name: ..., value: ...}, ...].\r\n *\r\n * @return encode Never be `null/undefined`.\r\n */\n\nexport function makeSeriesEncodeForNameBased(seriesModel, source, dimCount) {\n var encode = {};\n var datasetModel = querySeriesUpstreamDatasetModel(seriesModel); // Currently only make default when using dataset, util more reqirements occur.\n\n if (!datasetModel) {\n return encode;\n }\n\n var sourceFormat = source.sourceFormat;\n var dimensionsDefine = source.dimensionsDefine;\n var potentialNameDimIndex;\n\n if (sourceFormat === SOURCE_FORMAT_OBJECT_ROWS || sourceFormat === SOURCE_FORMAT_KEYED_COLUMNS) {\n each(dimensionsDefine, function (dim, idx) {\n if ((isObject(dim) ? dim.name : dim) === 'name') {\n potentialNameDimIndex = idx;\n }\n });\n }\n\n var idxResult = function () {\n var idxRes0 = {};\n var idxRes1 = {};\n var guessRecords = []; // 5 is an experience value.\n\n for (var i = 0, len = Math.min(5, dimCount); i < len; i++) {\n var guessResult = doGuessOrdinal(source.data, sourceFormat, source.seriesLayoutBy, dimensionsDefine, source.startIndex, i);\n guessRecords.push(guessResult);\n var isPureNumber = guessResult === BE_ORDINAL.Not; // [Strategy of idxRes0]: find the first BE_ORDINAL.Not as the value dim,\n // and then find a name dim with the priority:\n // \"BE_ORDINAL.Might|BE_ORDINAL.Must\" > \"other dim\" > \"the value dim itself\".\n\n if (isPureNumber && idxRes0.v == null && i !== potentialNameDimIndex) {\n idxRes0.v = i;\n }\n\n if (idxRes0.n == null || idxRes0.n === idxRes0.v || !isPureNumber && guessRecords[idxRes0.n] === BE_ORDINAL.Not) {\n idxRes0.n = i;\n }\n\n if (fulfilled(idxRes0) && guessRecords[idxRes0.n] !== BE_ORDINAL.Not) {\n return idxRes0;\n } // [Strategy of idxRes1]: if idxRes0 not satisfied (that is, no BE_ORDINAL.Not),\n // find the first BE_ORDINAL.Might as the value dim,\n // and then find a name dim with the priority:\n // \"other dim\" > \"the value dim itself\".\n // That is for backward compat: number-like (e.g., `'3'`, `'55'`) can be\n // treated as number.\n\n\n if (!isPureNumber) {\n if (guessResult === BE_ORDINAL.Might && idxRes1.v == null && i !== potentialNameDimIndex) {\n idxRes1.v = i;\n }\n\n if (idxRes1.n == null || idxRes1.n === idxRes1.v) {\n idxRes1.n = i;\n }\n }\n }\n\n function fulfilled(idxResult) {\n return idxResult.v != null && idxResult.n != null;\n }\n\n return fulfilled(idxRes0) ? idxRes0 : fulfilled(idxRes1) ? idxRes1 : null;\n }();\n\n if (idxResult) {\n encode.value = [idxResult.v]; // `potentialNameDimIndex` has highest priority.\n\n var nameDimIndex = potentialNameDimIndex != null ? potentialNameDimIndex : idxResult.n; // By default, label uses itemName in charts.\n // So we don't set encodeLabel here.\n\n encode.itemName = [nameDimIndex];\n encode.seriesName = [nameDimIndex];\n }\n\n return encode;\n}\n/**\r\n * @return If return null/undefined, indicate that should not use datasetModel.\r\n */\n\nexport function querySeriesUpstreamDatasetModel(seriesModel) {\n // Caution: consider the scenario:\n // A dataset is declared and a series is not expected to use the dataset,\n // and at the beginning `setOption({series: { noData })` (just prepare other\n // option but no data), then `setOption({series: {data: [...]}); In this case,\n // the user should set an empty array to avoid that dataset is used by default.\n var thisData = seriesModel.get('data', true);\n\n if (!thisData) {\n return queryReferringComponents(seriesModel.ecModel, 'dataset', {\n index: seriesModel.get('datasetIndex', true),\n id: seriesModel.get('datasetId', true)\n }, SINGLE_REFERRING).models[0];\n }\n}\n/**\r\n * @return Always return an array event empty.\r\n */\n\nexport function queryDatasetUpstreamDatasetModels(datasetModel) {\n // Only these attributes declared, we by defualt reference to `datasetIndex: 0`.\n // Otherwise, no reference.\n if (!datasetModel.get('transform', true) && !datasetModel.get('fromTransformResult', true)) {\n return [];\n }\n\n return queryReferringComponents(datasetModel.ecModel, 'dataset', {\n index: datasetModel.get('fromDatasetIndex', true),\n id: datasetModel.get('fromDatasetId', true)\n }, SINGLE_REFERRING).models;\n}\n/**\r\n * The rule should not be complex, otherwise user might not\r\n * be able to known where the data is wrong.\r\n * The code is ugly, but how to make it neat?\r\n */\n\nexport function guessOrdinal(source, dimIndex) {\n return doGuessOrdinal(source.data, source.sourceFormat, source.seriesLayoutBy, source.dimensionsDefine, source.startIndex, dimIndex);\n} // dimIndex may be overflow source data.\n// return {BE_ORDINAL}\n\nfunction doGuessOrdinal(data, sourceFormat, seriesLayoutBy, dimensionsDefine, startIndex, dimIndex) {\n var result; // Experience value.\n\n var maxLoop = 5;\n\n if (isTypedArray(data)) {\n return BE_ORDINAL.Not;\n } // When sourceType is 'objectRows' or 'keyedColumns', dimensionsDefine\n // always exists in source.\n\n\n var dimName;\n var dimType;\n\n if (dimensionsDefine) {\n var dimDefItem = dimensionsDefine[dimIndex];\n\n if (isObject(dimDefItem)) {\n dimName = dimDefItem.name;\n dimType = dimDefItem.type;\n } else if (isString(dimDefItem)) {\n dimName = dimDefItem;\n }\n }\n\n if (dimType != null) {\n return dimType === 'ordinal' ? BE_ORDINAL.Must : BE_ORDINAL.Not;\n }\n\n if (sourceFormat === SOURCE_FORMAT_ARRAY_ROWS) {\n var dataArrayRows = data;\n\n if (seriesLayoutBy === SERIES_LAYOUT_BY_ROW) {\n var sample = dataArrayRows[dimIndex];\n\n for (var i = 0; i < (sample || []).length && i < maxLoop; i++) {\n if ((result = detectValue(sample[startIndex + i])) != null) {\n return result;\n }\n }\n } else {\n for (var i = 0; i < dataArrayRows.length && i < maxLoop; i++) {\n var row = dataArrayRows[startIndex + i];\n\n if (row && (result = detectValue(row[dimIndex])) != null) {\n return result;\n }\n }\n }\n } else if (sourceFormat === SOURCE_FORMAT_OBJECT_ROWS) {\n var dataObjectRows = data;\n\n if (!dimName) {\n return BE_ORDINAL.Not;\n }\n\n for (var i = 0; i < dataObjectRows.length && i < maxLoop; i++) {\n var item = dataObjectRows[i];\n\n if (item && (result = detectValue(item[dimName])) != null) {\n return result;\n }\n }\n } else if (sourceFormat === SOURCE_FORMAT_KEYED_COLUMNS) {\n var dataKeyedColumns = data;\n\n if (!dimName) {\n return BE_ORDINAL.Not;\n }\n\n var sample = dataKeyedColumns[dimName];\n\n if (!sample || isTypedArray(sample)) {\n return BE_ORDINAL.Not;\n }\n\n for (var i = 0; i < sample.length && i < maxLoop; i++) {\n if ((result = detectValue(sample[i])) != null) {\n return result;\n }\n }\n } else if (sourceFormat === SOURCE_FORMAT_ORIGINAL) {\n var dataOriginal = data;\n\n for (var i = 0; i < dataOriginal.length && i < maxLoop; i++) {\n var item = dataOriginal[i];\n var val = getDataItemValue(item);\n\n if (!isArray(val)) {\n return BE_ORDINAL.Not;\n }\n\n if ((result = detectValue(val[dimIndex])) != null) {\n return result;\n }\n }\n }\n\n function detectValue(val) {\n var beStr = isString(val); // Consider usage convenience, '1', '2' will be treated as \"number\".\n // `isFinit('')` get `true`.\n\n if (val != null && isFinite(val) && val !== '') {\n return beStr ? BE_ORDINAL.Might : BE_ORDINAL.Not;\n } else if (beStr && val !== '-') {\n return BE_ORDINAL.Must;\n }\n }\n\n return BE_ORDINAL.Not;\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\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/**\r\n * [REQUIREMENT_MEMO]:\r\n * (0) `metaRawOption` means `dimensions`/`sourceHeader`/`seriesLayoutBy` in raw option.\r\n * (1) Keep support the feature: `metaRawOption` can be specified both on `series` and\r\n * `root-dataset`. Them on `series` has higher priority.\r\n * (2) Do not support to set `metaRawOption` on a `non-root-dataset`, because it might\r\n * confuse users: whether those props indicate how to visit the upstream source or visit\r\n * the transform result source, and some transforms has nothing to do with these props,\r\n * and some transforms might have multiple upstream.\r\n * (3) Transforms should specify `metaRawOption` in each output, just like they can be\r\n * declared in `root-dataset`.\r\n * (4) At present only support visit source in `SERIES_LAYOUT_BY_COLUMN` in transforms.\r\n * That is for reducing complexity in transforms.\r\n * PENDING: Whether to provide transposition transform?\r\n *\r\n * [IMPLEMENTAION_MEMO]:\r\n * \"sourceVisitConfig\" are calculated from `metaRawOption` and `data`.\r\n * They will not be calculated until `source` is about to be visited (to prevent from\r\n * duplicate calcuation). `source` is visited only in series and input to transforms.\r\n *\r\n * [DIMENSION_INHERIT_RULE]:\r\n * By default the dimensions are inherited from ancestors, unless a transform return\r\n * a new dimensions definition.\r\n * Consider the case:\r\n * ```js\r\n * dataset: [{\r\n * source: [ ['Product', 'Sales', 'Prise'], ['Cookies', 321, 44.21], ...]\r\n * }, {\r\n * transform: { type: 'filter', ... }\r\n * }]\r\n * dataset: [{\r\n * dimension: ['Product', 'Sales', 'Prise'],\r\n * source: [ ['Cookies', 321, 44.21], ...]\r\n * }, {\r\n * transform: { type: 'filter', ... }\r\n * }]\r\n * ```\r\n * The two types of option should have the same behavior after transform.\r\n *\r\n *\r\n * [SCENARIO]:\r\n * (1) Provide source data directly:\r\n * ```js\r\n * series: {\r\n * encode: {...},\r\n * dimensions: [...]\r\n * seriesLayoutBy: 'row',\r\n * data: [[...]]\r\n * }\r\n * ```\r\n * (2) Series refer to dataset.\r\n * ```js\r\n * series: [{\r\n * encode: {...}\r\n * // Ignore datasetIndex means `datasetIndex: 0`\r\n * // and the dimensions defination in dataset is used\r\n * }, {\r\n * encode: {...},\r\n * seriesLayoutBy: 'column',\r\n * datasetIndex: 1\r\n * }]\r\n * ```\r\n * (3) dataset transform\r\n * ```js\r\n * dataset: [{\r\n * source: [...]\r\n * }, {\r\n * source: [...]\r\n * }, {\r\n * // By default from 0.\r\n * transform: { type: 'filter', config: {...} }\r\n * }, {\r\n * // Piped.\r\n * transform: [\r\n * { type: 'filter', config: {...} },\r\n * { type: 'sort', config: {...} }\r\n * ]\r\n * }, {\r\n * id: 'regressionData',\r\n * fromDatasetIndex: 1,\r\n * // Third-party transform\r\n * transform: { type: 'ecStat:regression', config: {...} }\r\n * }, {\r\n * // retrieve the extra result.\r\n * id: 'regressionFormula',\r\n * fromDatasetId: 'regressionData',\r\n * fromTransformResult: 1\r\n * }]\r\n * ```\r\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 /**\r\n * Mark dirty.\r\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 /**\r\n * For detecting whether the upstream source is dirty, so that\r\n * the local cached source (in `_sourceList`) should be discarded.\r\n */\n\n\n SourceManager.prototype._getVersionSign = function () {\n return this._sourceHost.uid + '_' + this._versionSignBase;\n };\n /**\r\n * Always return a source instance. Otherwise throw error.\r\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 memory 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 upstream.\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 /**\r\n * @param sourceIndex By default 0, means \"main source\".\r\n * In most cases there is only one source.\r\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 /**\r\n *\r\n * Get a data store which can be shared across series.\r\n * Only available for series.\r\n *\r\n * @param seriesDimRequest Dimensions that are generated in series.\r\n * Should have been sorted by `storeDimIndex` asc.\r\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 /**\r\n * PENDING: Is it fast enough?\r\n * If no upstream, return empty array.\r\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 // there is no need to update them when change happens.\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 transform 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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\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/**\r\n * TODO: disable writable.\r\n * This structure will be exposed to users.\r\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 /**\r\n * @return If dimension not found, return null/undefined.\r\n */\n\n\n ExternalSource.prototype.getDimensionInfo = function (dim) {\n return;\n };\n /**\r\n * dimensions defined if and only if either:\r\n * (a) dataset.dimensions are declared.\r\n * (b) dataset data include dimensions definitions in data (detected or via specified `sourceHeader`).\r\n * If dimensions are defined, `dimensionInfoAll` is corresponding to\r\n * the defined dimensions.\r\n * Otherwise, `dimensionInfoAll` is determined by data columns.\r\n * @return Always return an array (even empty array).\r\n */\n\n\n ExternalSource.prototype.cloneAllDimensionInfo = function () {\n return;\n };\n\n ExternalSource.prototype.count = function () {\n return;\n };\n /**\r\n * Only support by dimension index.\r\n * No need to support by dimension name in transform function,\r\n * because transform function is not case-specific, no need to use name literally.\r\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 // Because the dimension is probably auto detected from data and not might reliable.\n // Should not lead the transformers to think that is reliable 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 do not specify dimension name. For simplicity, data transform\n // does not generate dimension name.\n\n if (name != null) {\n // Dimension name should not be duplicated.\n // For simplicity, data transform forbids 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 /**\r\n * Intuitively, the end users known the content of the original `dataset.source`,\r\n * calucating the transform result in mind.\r\n * Suppose the original `dataset.source` is:\r\n * ```js\r\n * [\r\n * ['product', '2012', '2013', '2014', '2015'],\r\n * ['AAA', 41.1, 30.4, 65.1, 53.3],\r\n * ['BBB', 86.5, 92.1, 85.7, 83.1],\r\n * ['CCC', 24.1, 67.2, 79.5, 86.4]\r\n * ]\r\n * ```\r\n * The dimension info have to be detected from the source data.\r\n * Some of the transformers (like filter, sort) will follow the dimension info\r\n * of upstream, while others use new dimensions (like aggregate).\r\n * Transformer can output a field `dimensions` to define the its own output dimensions.\r\n * We also allow transformers to ignore the output `dimensions` field, and\r\n * inherit the upstream dimensions definition. It can reduce the burden of handling\r\n * dimensions in transformers.\r\n *\r\n * See also [DIMENSION_INHERIT_RULE] in `sourceManager.ts`.\r\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, because:\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\n*/\n// These APIs are for more advanced usages\n// For example extend charts and components, creating graphic elements, formatting.\nimport ComponentModel from '../model/Component.js';\nimport ComponentView from '../view/Component.js';\nimport SeriesModel from '../model/Series.js';\nimport ChartView from '../view/Chart.js';\nimport SeriesData from '../data/SeriesData.js';\nimport * as zrender_1 from 'zrender/lib/zrender.js';\nexport { zrender_1 as zrender };\nimport * as matrix_1 from 'zrender/lib/core/matrix.js';\nexport { matrix_1 as matrix };\nimport * as vector_1 from 'zrender/lib/core/vector.js';\nexport { vector_1 as vector };\nimport * as zrUtil_1 from 'zrender/lib/core/util.js';\nexport { zrUtil_1 as zrUtil };\nimport * as color_1 from 'zrender/lib/tool/color.js';\nexport { color_1 as color };\nexport { throttle } from '../util/throttle.js';\nimport * as helper_1 from './api/helper.js';\nexport { helper_1 as helper };\nexport { use } from '../extension.js';\nexport { setPlatformAPI } from 'zrender/lib/core/platform.js'; // --------------------- Helper Methods ---------------------\n\nexport { default as parseGeoJSON } from '../coord/geo/parseGeoJson.js';\nexport { default as parseGeoJson } from '../coord/geo/parseGeoJson.js';\nimport * as number_1 from './api/number.js';\nexport { number_1 as number };\nimport * as time_1 from './api/time.js';\nexport { time_1 as time };\nimport * as graphic_1 from './api/graphic.js';\nexport { graphic_1 as graphic };\nimport * as format_1 from './api/format.js';\nexport { format_1 as format };\nimport * as util_1 from './api/util.js';\nexport { util_1 as util };\nexport { default as env } from 'zrender/lib/core/env.js'; // --------------------- Export for Extension Usage ---------------------\n// export {SeriesData};\n\nexport { SeriesData as List }; // TODO: Compatitable with exists echarts-gl code\n\nexport { default as Model } from '../model/Model.js';\nexport { default as Axis } from '../coord/Axis.js';\nexport { ComponentModel, ComponentView, SeriesModel, ChartView }; // Only for GL\n\nexport { brushSingle as innerDrawElementOnCanvas } from 'zrender/lib/canvas/graphic.js'; // --------------------- Deprecated Extension Methods ---------------------\n// Should use `ComponentModel.extend` or `class XXXX extend ComponentModel` to create class.\n// Then use `registerComponentModel` in `install` parameter when `use` this extension. For example:\n// class Bar3DModel extends ComponentModel {}\n// export function install(registers) { registers.registerComponentModel(Bar3DModel); }\n// echarts.use(install);\n\nexport function extendComponentModel(proto) {\n var Model = ComponentModel.extend(proto);\n ComponentModel.registerClass(Model);\n return Model;\n}\nexport function extendComponentView(proto) {\n var View = ComponentView.extend(proto);\n ComponentView.registerClass(View);\n return View;\n}\nexport function extendSeriesModel(proto) {\n var Model = SeriesModel.extend(proto);\n SeriesModel.registerClass(Model);\n return Model;\n}\nexport function extendChartView(proto) {\n var View = ChartView.extend(proto);\n ChartView.registerClass(View);\n return View;\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\n*/\n\n/**\r\n * This module exposes helper functions for developing extensions.\r\n */\nimport * as zrUtil from 'zrender/lib/core/util.js';\nimport createSeriesData from '../../chart/helper/createSeriesData.js'; // import createGraphFromNodeEdge from './chart/helper/createGraphFromNodeEdge.js';\n\nimport * as axisHelper from '../../coord/axisHelper.js';\nimport { AxisModelCommonMixin } from '../../coord/axisModelCommonMixin.js';\nimport Model from '../../model/Model.js';\nimport { getLayoutRect } from '../../util/layout.js';\nimport { enableDataStack, isDimensionStacked, getStackedDimension } from '../../data/helper/dataStackHelper.js';\nimport { getECData } from '../../util/innerStore.js';\nimport { createTextStyle as innerCreateTextStyle } from '../../label/labelStyle.js';\n/**\r\n * Create a multi dimension List structure from seriesModel.\r\n */\n\nexport function createList(seriesModel) {\n return createSeriesData(null, seriesModel);\n} // export function createGraph(seriesModel) {\n// let nodes = seriesModel.get('data');\n// let links = seriesModel.get('links');\n// return createGraphFromNodeEdge(nodes, links, seriesModel);\n// }\n\nexport { getLayoutRect };\nexport { createDimensions } from '../../data/helper/createDimensions.js';\nexport var dataStack = {\n isDimensionStacked: isDimensionStacked,\n enableDataStack: enableDataStack,\n getStackedDimension: getStackedDimension\n};\n/**\r\n * Create a symbol element with given symbol configuration: shape, x, y, width, height, color\r\n * @param {string} symbolDesc\r\n * @param {number} x\r\n * @param {number} y\r\n * @param {number} w\r\n * @param {number} h\r\n * @param {string} color\r\n */\n\nexport { createSymbol } from '../../util/symbol.js';\n/**\r\n * Create scale\r\n * @param {Array.} dataExtent\r\n * @param {Object|module:echarts/Model} option If `optoin.type`\r\n * is secified, it can only be `'value'` currently.\r\n */\n\nexport function createScale(dataExtent, option) {\n var axisModel = option;\n\n if (!(option instanceof Model)) {\n axisModel = new Model(option); // FIXME\n // Currently AxisModelCommonMixin has nothing to do with the\n // the requirements of `axisHelper.createScaleByModel`. For\n // example the methods `getCategories` and `getOrdinalMeta`\n // are required for `'category'` axis, and ecModel is required\n // for `'time'` axis. But occasionally echarts-gl happened\n // to only use `'value'` axis.\n // zrUtil.mixin(axisModel, AxisModelCommonMixin);\n }\n\n var scale = axisHelper.createScaleByModel(axisModel);\n scale.setExtent(dataExtent[0], dataExtent[1]);\n axisHelper.niceScaleExtent(scale, axisModel);\n return scale;\n}\n/**\r\n * Mixin common methods to axis model,\r\n *\r\n * Include methods\r\n * `getFormattedLabels() => Array.`\r\n * `getCategories() => Array.`\r\n * `getMin(origin: boolean) => number`\r\n * `getMax(origin: boolean) => number`\r\n * `getNeedCrossZero() => boolean`\r\n */\n\nexport function mixinAxisModelCommonMethods(Model) {\n zrUtil.mixin(Model, AxisModelCommonMixin);\n}\nexport { getECData };\nexport { enableHoverEmphasis } from '../../util/states.js';\nexport function createTextStyle(textStyleModel, opts) {\n opts = opts || {};\n return innerCreateTextStyle(textStyleModel, null, null, opts.state !== 'normal');\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\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);","\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\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/**\r\n * Calculate min distance corresponding point.\r\n * This method won't evaluate if point is in the path.\r\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 variable 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/**\r\n * Calculate a proper guide line based on the label position and graphic element definition\r\n * @param label\r\n * @param labelRect\r\n * @param target\r\n * @param targetRect\r\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/**\r\n * Reduce the line segment attached to the label to limit the turn angle between two segments.\r\n * @param linePoints\r\n * @param minTurnAngle Radian of minimum turn angle. 0 - 180\r\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/**\r\n * Limit the angle of line and the surface\r\n * @param maxSurfaceAngle Radian of minimum turn angle. 0 - 180. 0 is same direction to normal. 180 is opposite\r\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/**\r\n * Create a label line if necessary and set it's style.\r\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[stateName];\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\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';\nimport { normalizeRadian } from 'zrender/lib/contain/util.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 /**\r\n * Add label to manager\r\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 dummyTransformable.rotation = normalizeRadian(dummyTransformable.rotation);\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 /**\r\n * Ignore layouting if it's not specified anything.\r\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 /**\r\n * Process all labels. Not only labels with layoutOption.\r\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\n if (visualStyle) {\n var visualType = data.getVisual('drawType'); // Default to be same with main color\n\n defaultStyle.stroke = visualStyle[visualType];\n }\n\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\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}","\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\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 /**\r\n * Squeeze to allow overlap if there is no more space available.\r\n * Let other overlapping strategy like hideOverlap do the job instead of keep exceeding the bounds.\r\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/**\r\n * Adjust labels on x direction to avoid overlap.\r\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/**\r\n * Adjust labels on y direction to avoid overlap.\r\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\n*/\nimport ZRText from 'zrender/lib/graphic/Text.js';\nimport { isFunction, retrieve2, extend, keys, trim } from 'zrender/lib/core/util.js';\nimport { SPECIAL_STATES, DISPLAY_STATES } from '../util/states.js';\nimport { deprecateReplaceLog } from '../util/log.js';\nimport { makeInner, interpolateRawValues } from '../util/model.js';\nimport { initProps, updateProps } from '../util/graphic.js';\nvar EMPTY_OBJ = {};\nexport function setLabelText(label, labelTexts) {\n for (var i = 0; i < SPECIAL_STATES.length; i++) {\n var stateName = SPECIAL_STATES[i];\n var text = labelTexts[stateName];\n var state = label.ensureState(stateName);\n state.style = state.style || {};\n state.style.text = text;\n }\n\n var oldStates = label.currentStates.slice();\n label.clearStates(true);\n label.setStyle({\n text: labelTexts.normal\n });\n label.useStates(oldStates, true);\n}\n\nfunction getLabelText(opt, stateModels, interpolatedValue) {\n var labelFetcher = opt.labelFetcher;\n var labelDataIndex = opt.labelDataIndex;\n var labelDimIndex = opt.labelDimIndex;\n var normalModel = stateModels.normal;\n var baseText;\n\n if (labelFetcher) {\n baseText = labelFetcher.getFormattedLabel(labelDataIndex, 'normal', null, labelDimIndex, normalModel && normalModel.get('formatter'), interpolatedValue != null ? {\n interpolatedValue: interpolatedValue\n } : null);\n }\n\n if (baseText == null) {\n baseText = isFunction(opt.defaultText) ? opt.defaultText(labelDataIndex, opt, interpolatedValue) : opt.defaultText;\n }\n\n var statesText = {\n normal: baseText\n };\n\n for (var i = 0; i < SPECIAL_STATES.length; i++) {\n var stateName = SPECIAL_STATES[i];\n var stateModel = stateModels[stateName];\n statesText[stateName] = retrieve2(labelFetcher ? labelFetcher.getFormattedLabel(labelDataIndex, stateName, null, labelDimIndex, stateModel && stateModel.get('formatter')) : null, baseText);\n }\n\n return statesText;\n}\n\nfunction setLabelStyle(targetEl, labelStatesModels, opt, stateSpecified // TODO specified position?\n) {\n opt = opt || EMPTY_OBJ;\n var isSetOnText = targetEl instanceof ZRText;\n var needsCreateText = false;\n\n for (var i = 0; i < DISPLAY_STATES.length; i++) {\n var stateModel = labelStatesModels[DISPLAY_STATES[i]];\n\n if (stateModel && stateModel.getShallow('show')) {\n needsCreateText = true;\n break;\n }\n }\n\n var textContent = isSetOnText ? targetEl : targetEl.getTextContent();\n\n if (needsCreateText) {\n if (!isSetOnText) {\n // Reuse the previous\n if (!textContent) {\n textContent = new ZRText();\n targetEl.setTextContent(textContent);\n } // Use same state proxy\n\n\n if (targetEl.stateProxy) {\n textContent.stateProxy = targetEl.stateProxy;\n }\n }\n\n var labelStatesTexts = getLabelText(opt, labelStatesModels);\n var normalModel = labelStatesModels.normal;\n var showNormal = !!normalModel.getShallow('show');\n var normalStyle = createTextStyle(normalModel, stateSpecified && stateSpecified.normal, opt, false, !isSetOnText);\n normalStyle.text = labelStatesTexts.normal;\n\n if (!isSetOnText) {\n // Always create new\n targetEl.setTextConfig(createTextConfig(normalModel, opt, false));\n }\n\n for (var i = 0; i < SPECIAL_STATES.length; i++) {\n var stateName = SPECIAL_STATES[i];\n var stateModel = labelStatesModels[stateName];\n\n if (stateModel) {\n var stateObj = textContent.ensureState(stateName);\n var stateShow = !!retrieve2(stateModel.getShallow('show'), showNormal);\n\n if (stateShow !== showNormal) {\n stateObj.ignore = !stateShow;\n }\n\n stateObj.style = createTextStyle(stateModel, stateSpecified && stateSpecified[stateName], opt, true, !isSetOnText);\n stateObj.style.text = labelStatesTexts[stateName];\n\n if (!isSetOnText) {\n var targetElEmphasisState = targetEl.ensureState(stateName);\n targetElEmphasisState.textConfig = createTextConfig(stateModel, opt, true);\n }\n }\n } // PENDING: if there is many requirements that emphasis position\n // need to be different from normal position, we might consider\n // auto silent is those cases.\n\n\n textContent.silent = !!normalModel.getShallow('silent'); // Keep x and y\n\n if (textContent.style.x != null) {\n normalStyle.x = textContent.style.x;\n }\n\n if (textContent.style.y != null) {\n normalStyle.y = textContent.style.y;\n }\n\n textContent.ignore = !showNormal; // Always create new style.\n\n textContent.useStyle(normalStyle);\n textContent.dirty();\n\n if (opt.enableTextSetter) {\n labelInner(textContent).setLabelText = function (interpolatedValue) {\n var labelStatesTexts = getLabelText(opt, labelStatesModels, interpolatedValue);\n setLabelText(textContent, labelStatesTexts);\n };\n }\n } else if (textContent) {\n // Not display rich text.\n textContent.ignore = true;\n }\n\n targetEl.dirty();\n}\n\nexport { setLabelStyle };\nexport function getLabelStatesModels(itemModel, labelName) {\n labelName = labelName || 'label';\n var statesModels = {\n normal: itemModel.getModel(labelName)\n };\n\n for (var i = 0; i < SPECIAL_STATES.length; i++) {\n var stateName = SPECIAL_STATES[i];\n statesModels[stateName] = itemModel.getModel([stateName, labelName]);\n }\n\n return statesModels;\n}\n/**\r\n * Set basic textStyle properties.\r\n */\n\nexport function createTextStyle(textStyleModel, specifiedTextStyle, // Fixed style in the code. Can't be set by model.\nopt, isNotNormal, isAttached // If text is attached on an element. If so, auto color will handling in zrender.\n) {\n var textStyle = {};\n setTextStyleCommon(textStyle, textStyleModel, opt, isNotNormal, isAttached);\n specifiedTextStyle && extend(textStyle, specifiedTextStyle); // textStyle.host && textStyle.host.dirty && textStyle.host.dirty(false);\n\n return textStyle;\n}\nexport function createTextConfig(textStyleModel, opt, isNotNormal) {\n opt = opt || {};\n var textConfig = {};\n var labelPosition;\n var labelRotate = textStyleModel.getShallow('rotate');\n var labelDistance = retrieve2(textStyleModel.getShallow('distance'), isNotNormal ? null : 5);\n var labelOffset = textStyleModel.getShallow('offset');\n labelPosition = textStyleModel.getShallow('position') || (isNotNormal ? null : 'inside'); // 'outside' is not a valid zr textPostion value, but used\n // in bar series, and magric type should be considered.\n\n labelPosition === 'outside' && (labelPosition = opt.defaultOutsidePosition || 'top');\n\n if (labelPosition != null) {\n textConfig.position = labelPosition;\n }\n\n if (labelOffset != null) {\n textConfig.offset = labelOffset;\n }\n\n if (labelRotate != null) {\n labelRotate *= Math.PI / 180;\n textConfig.rotation = labelRotate;\n }\n\n if (labelDistance != null) {\n textConfig.distance = labelDistance;\n } // fill and auto is determined by the color of path fill if it's not specified by developers.\n\n\n textConfig.outsideFill = textStyleModel.get('color') === 'inherit' ? opt.inheritColor || null : 'auto';\n return textConfig;\n}\n/**\r\n * The uniform entry of set text style, that is, retrieve style definitions\r\n * from `model` and set to `textStyle` object.\r\n *\r\n * Never in merge mode, but in overwrite mode, that is, all of the text style\r\n * properties will be set. (Consider the states of normal and emphasis and\r\n * default value can be adopted, merge would make the logic too complicated\r\n * to manage.)\r\n */\n\nfunction setTextStyleCommon(textStyle, textStyleModel, opt, isNotNormal, isAttached) {\n // Consider there will be abnormal when merge hover style to normal style if given default value.\n opt = opt || EMPTY_OBJ;\n var ecModel = textStyleModel.ecModel;\n var globalTextStyle = ecModel && ecModel.option.textStyle; // Consider case:\n // {\n // data: [{\n // value: 12,\n // label: {\n // rich: {\n // // no 'a' here but using parent 'a'.\n // }\n // }\n // }],\n // rich: {\n // a: { ... }\n // }\n // }\n\n var richItemNames = getRichItemNames(textStyleModel);\n var richResult;\n\n if (richItemNames) {\n richResult = {};\n\n for (var name_1 in richItemNames) {\n if (richItemNames.hasOwnProperty(name_1)) {\n // Cascade is supported in rich.\n var richTextStyle = textStyleModel.getModel(['rich', name_1]); // In rich, never `disableBox`.\n // FIXME: consider `label: {formatter: '{a|xx}', color: 'blue', rich: {a: {}}}`,\n // the default color `'blue'` will not be adopted if no color declared in `rich`.\n // That might confuses users. So probably we should put `textStyleModel` as the\n // root ancestor of the `richTextStyle`. But that would be a break change.\n\n setTokenTextStyle(richResult[name_1] = {}, richTextStyle, globalTextStyle, opt, isNotNormal, isAttached, false, true);\n }\n }\n }\n\n if (richResult) {\n textStyle.rich = richResult;\n }\n\n var overflow = textStyleModel.get('overflow');\n\n if (overflow) {\n textStyle.overflow = overflow;\n }\n\n var margin = textStyleModel.get('minMargin');\n\n if (margin != null) {\n textStyle.margin = margin;\n }\n\n setTokenTextStyle(textStyle, textStyleModel, globalTextStyle, opt, isNotNormal, isAttached, true, false);\n} // Consider case:\n// {\n// data: [{\n// value: 12,\n// label: {\n// rich: {\n// // no 'a' here but using parent 'a'.\n// }\n// }\n// }],\n// rich: {\n// a: { ... }\n// }\n// }\n// TODO TextStyleModel\n\n\nfunction getRichItemNames(textStyleModel) {\n // Use object to remove duplicated names.\n var richItemNameMap;\n\n while (textStyleModel && textStyleModel !== textStyleModel.ecModel) {\n var rich = (textStyleModel.option || EMPTY_OBJ).rich;\n\n if (rich) {\n richItemNameMap = richItemNameMap || {};\n var richKeys = keys(rich);\n\n for (var i = 0; i < richKeys.length; i++) {\n var richKey = richKeys[i];\n richItemNameMap[richKey] = 1;\n }\n }\n\n textStyleModel = textStyleModel.parentModel;\n }\n\n return richItemNameMap;\n}\n\nvar TEXT_PROPS_WITH_GLOBAL = ['fontStyle', 'fontWeight', 'fontSize', 'fontFamily', 'textShadowColor', 'textShadowBlur', 'textShadowOffsetX', 'textShadowOffsetY'];\nvar TEXT_PROPS_SELF = ['align', 'lineHeight', 'width', 'height', 'tag', 'verticalAlign', 'ellipsis'];\nvar TEXT_PROPS_BOX = ['padding', 'borderWidth', 'borderRadius', 'borderDashOffset', 'backgroundColor', 'borderColor', 'shadowColor', 'shadowBlur', 'shadowOffsetX', 'shadowOffsetY'];\n\nfunction setTokenTextStyle(textStyle, textStyleModel, globalTextStyle, opt, isNotNormal, isAttached, isBlock, inRich) {\n // In merge mode, default value should not be given.\n globalTextStyle = !isNotNormal && globalTextStyle || EMPTY_OBJ;\n var inheritColor = opt && opt.inheritColor;\n var fillColor = textStyleModel.getShallow('color');\n var strokeColor = textStyleModel.getShallow('textBorderColor');\n var opacity = retrieve2(textStyleModel.getShallow('opacity'), globalTextStyle.opacity);\n\n if (fillColor === 'inherit' || fillColor === 'auto') {\n if (process.env.NODE_ENV !== 'production') {\n if (fillColor === 'auto') {\n deprecateReplaceLog('color: \\'auto\\'', 'color: \\'inherit\\'');\n }\n }\n\n if (inheritColor) {\n fillColor = inheritColor;\n } else {\n fillColor = null;\n }\n }\n\n if (strokeColor === 'inherit' || strokeColor === 'auto') {\n if (process.env.NODE_ENV !== 'production') {\n if (strokeColor === 'auto') {\n deprecateReplaceLog('color: \\'auto\\'', 'color: \\'inherit\\'');\n }\n }\n\n if (inheritColor) {\n strokeColor = inheritColor;\n } else {\n strokeColor = null;\n }\n }\n\n if (!isAttached) {\n // Only use default global textStyle.color if text is individual.\n // Otherwise it will use the strategy of attached text color because text may be on a path.\n fillColor = fillColor || globalTextStyle.color;\n strokeColor = strokeColor || globalTextStyle.textBorderColor;\n }\n\n if (fillColor != null) {\n textStyle.fill = fillColor;\n }\n\n if (strokeColor != null) {\n textStyle.stroke = strokeColor;\n }\n\n var textBorderWidth = retrieve2(textStyleModel.getShallow('textBorderWidth'), globalTextStyle.textBorderWidth);\n\n if (textBorderWidth != null) {\n textStyle.lineWidth = textBorderWidth;\n }\n\n var textBorderType = retrieve2(textStyleModel.getShallow('textBorderType'), globalTextStyle.textBorderType);\n\n if (textBorderType != null) {\n textStyle.lineDash = textBorderType;\n }\n\n var textBorderDashOffset = retrieve2(textStyleModel.getShallow('textBorderDashOffset'), globalTextStyle.textBorderDashOffset);\n\n if (textBorderDashOffset != null) {\n textStyle.lineDashOffset = textBorderDashOffset;\n }\n\n if (!isNotNormal && opacity == null && !inRich) {\n opacity = opt && opt.defaultOpacity;\n }\n\n if (opacity != null) {\n textStyle.opacity = opacity;\n } // TODO\n\n\n if (!isNotNormal && !isAttached) {\n // Set default finally.\n if (textStyle.fill == null && opt.inheritColor) {\n textStyle.fill = opt.inheritColor;\n }\n } // Do not use `getFont` here, because merge should be supported, where\n // part of these properties may be changed in emphasis style, and the\n // others should remain their original value got from normal style.\n\n\n for (var i = 0; i < TEXT_PROPS_WITH_GLOBAL.length; i++) {\n var key = TEXT_PROPS_WITH_GLOBAL[i];\n var val = retrieve2(textStyleModel.getShallow(key), globalTextStyle[key]);\n\n if (val != null) {\n textStyle[key] = val;\n }\n }\n\n for (var i = 0; i < TEXT_PROPS_SELF.length; i++) {\n var key = TEXT_PROPS_SELF[i];\n var val = textStyleModel.getShallow(key);\n\n if (val != null) {\n textStyle[key] = val;\n }\n }\n\n if (textStyle.verticalAlign == null) {\n var baseline = textStyleModel.getShallow('baseline');\n\n if (baseline != null) {\n textStyle.verticalAlign = baseline;\n }\n }\n\n if (!isBlock || !opt.disableBox) {\n for (var i = 0; i < TEXT_PROPS_BOX.length; i++) {\n var key = TEXT_PROPS_BOX[i];\n var val = textStyleModel.getShallow(key);\n\n if (val != null) {\n textStyle[key] = val;\n }\n }\n\n var borderType = textStyleModel.getShallow('borderType');\n\n if (borderType != null) {\n textStyle.borderDash = borderType;\n }\n\n if ((textStyle.backgroundColor === 'auto' || textStyle.backgroundColor === 'inherit') && inheritColor) {\n if (process.env.NODE_ENV !== 'production') {\n if (textStyle.backgroundColor === 'auto') {\n deprecateReplaceLog('backgroundColor: \\'auto\\'', 'backgroundColor: \\'inherit\\'');\n }\n }\n\n textStyle.backgroundColor = inheritColor;\n }\n\n if ((textStyle.borderColor === 'auto' || textStyle.borderColor === 'inherit') && inheritColor) {\n if (process.env.NODE_ENV !== 'production') {\n if (textStyle.borderColor === 'auto') {\n deprecateReplaceLog('borderColor: \\'auto\\'', 'borderColor: \\'inherit\\'');\n }\n }\n\n textStyle.borderColor = inheritColor;\n }\n }\n}\n\nexport function getFont(opt, ecModel) {\n var gTextStyleModel = ecModel && ecModel.getModel('textStyle');\n return trim([// FIXME in node-canvas fontWeight is before fontStyle\n opt.fontStyle || gTextStyleModel && gTextStyleModel.getShallow('fontStyle') || '', opt.fontWeight || gTextStyleModel && gTextStyleModel.getShallow('fontWeight') || '', (opt.fontSize || gTextStyleModel && gTextStyleModel.getShallow('fontSize') || 12) + 'px', opt.fontFamily || gTextStyleModel && gTextStyleModel.getShallow('fontFamily') || 'sans-serif'].join(' '));\n}\nexport var labelInner = makeInner();\nexport function setLabelValueAnimation(label, labelStatesModels, value, getDefaultText) {\n if (!label) {\n return;\n }\n\n var obj = labelInner(label);\n obj.prevValue = obj.value;\n obj.value = value;\n var normalLabelModel = labelStatesModels.normal;\n obj.valueAnimation = normalLabelModel.get('valueAnimation');\n\n if (obj.valueAnimation) {\n obj.precision = normalLabelModel.get('precision');\n obj.defaultInterpolatedText = getDefaultText;\n obj.statesModels = labelStatesModels;\n }\n}\nexport function animateLabelValue(textEl, dataIndex, data, animatableModel, labelFetcher) {\n var labelInnerStore = labelInner(textEl);\n\n if (!labelInnerStore.valueAnimation || labelInnerStore.prevValue === labelInnerStore.value) {\n // Value not changed, no new label animation\n return;\n }\n\n var defaultInterpolatedText = labelInnerStore.defaultInterpolatedText; // Consider the case that being animating, do not use the `obj.value`,\n // Otherwise it will jump to the `obj.value` when this new animation started.\n\n var currValue = retrieve2(labelInnerStore.interpolatedValue, labelInnerStore.prevValue);\n var targetValue = labelInnerStore.value;\n\n function during(percent) {\n var interpolated = interpolateRawValues(data, labelInnerStore.precision, currValue, targetValue, percent);\n labelInnerStore.interpolatedValue = percent === 1 ? null : interpolated;\n var labelText = getLabelText({\n labelDataIndex: dataIndex,\n labelFetcher: labelFetcher,\n defaultText: defaultInterpolatedText ? defaultInterpolatedText(interpolated) : interpolated + ''\n }, labelInnerStore.statesModels, interpolated);\n setLabelText(textEl, labelText);\n }\n\n textEl.percent = 0;\n (labelInnerStore.prevValue == null ? initProps : updateProps)(textEl, {\n // percent is used to prevent animation from being aborted #15916\n percent: 1\n }, animatableModel, dataIndex, null, during);\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\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/**\r\n * @return {Object} {width, offset, offsetCenter} If axis.type is not 'category', return undefined.\r\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/**\r\n * Map from (baseAxis.dim + '_' + baseAxis.index) to min gap of two adjacent\r\n * values.\r\n * This works for time axes, value axes, and log axes.\r\n * For a single time axis, return value is in the form like\r\n * {'x_0': [1000000]}.\r\n * The value of 1000000 is in milliseconds.\r\n */\n\nfunction getValueAxesMinGaps(barSeries) {\n /**\r\n * Map from axis.index to values.\r\n * For a single time axis, axisValues is in the form like\r\n * {'x_0': [1495555200000, 1495641600000, 1495728000000]}.\r\n * Items in axisValues[x], e.g. 1495555200000, are time values of all\r\n * series.\r\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 whether 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. Because 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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\n*/\nimport { Text } from '../util/graphic.js';\nexport function getTextRect(text, font, align, verticalAlign, padding, rich, truncate, lineHeight) {\n var textEl = new Text({\n style: {\n text: text,\n font: font,\n align: align,\n verticalAlign: verticalAlign,\n padding: padding,\n rich: rich,\n overflow: truncate ? 'truncate' : null,\n lineHeight: lineHeight\n }\n });\n return textEl.getBoundingRect();\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\n*/\nimport { __extends } from \"tslib\";\nimport * as zrUtil from 'zrender/lib/core/util.js';\nimport Model from './Model.js';\nimport * as componentUtil from '../util/component.js';\nimport { enableClassManagement, parseClassType, isExtendedClass, mountExtend } from '../util/clazz.js';\nimport { makeInner, queryReferringComponents } from '../util/model.js';\nimport * as layout from '../util/layout.js';\nvar inner = makeInner();\n\nvar ComponentModel =\n/** @class */\nfunction (_super) {\n __extends(ComponentModel, _super);\n\n function ComponentModel(option, parentModel, ecModel) {\n var _this = _super.call(this, option, parentModel, ecModel) || this;\n\n _this.uid = componentUtil.getUID('ec_cpt_model');\n return _this;\n }\n\n ComponentModel.prototype.init = function (option, parentModel, ecModel) {\n this.mergeDefaultAndTheme(option, ecModel);\n };\n\n ComponentModel.prototype.mergeDefaultAndTheme = function (option, ecModel) {\n var layoutMode = layout.fetchLayoutMode(this);\n var inputPositionParams = layoutMode ? layout.getLayoutParams(option) : {};\n var themeModel = ecModel.getTheme();\n zrUtil.merge(option, themeModel.get(this.mainType));\n zrUtil.merge(option, this.getDefaultOption());\n\n if (layoutMode) {\n layout.mergeLayoutParam(option, inputPositionParams, layoutMode);\n }\n };\n\n ComponentModel.prototype.mergeOption = function (option, ecModel) {\n zrUtil.merge(this.option, option, true);\n var layoutMode = layout.fetchLayoutMode(this);\n\n if (layoutMode) {\n layout.mergeLayoutParam(this.option, option, layoutMode);\n }\n };\n /**\r\n * Called immediately after `init` or `mergeOption` of this instance called.\r\n */\n\n\n ComponentModel.prototype.optionUpdated = function (newCptOption, isInit) {};\n /**\r\n * [How to declare defaultOption]:\r\n *\r\n * (A) If using class declaration in typescript (since echarts 5):\r\n * ```ts\r\n * import {ComponentOption} from '../model/option.js';\r\n * export interface XxxOption extends ComponentOption {\r\n * aaa: number\r\n * }\r\n * export class XxxModel extends Component {\r\n * static type = 'xxx';\r\n * static defaultOption: XxxOption = {\r\n * aaa: 123\r\n * }\r\n * }\r\n * Component.registerClass(XxxModel);\r\n * ```\r\n * ```ts\r\n * import {inheritDefaultOption} from '../util/component.js';\r\n * import {XxxModel, XxxOption} from './XxxModel.js';\r\n * export interface XxxSubOption extends XxxOption {\r\n * bbb: number\r\n * }\r\n * class XxxSubModel extends XxxModel {\r\n * static defaultOption: XxxSubOption = inheritDefaultOption(XxxModel.defaultOption, {\r\n * bbb: 456\r\n * })\r\n * fn() {\r\n * let opt = this.getDefaultOption();\r\n * // opt is {aaa: 123, bbb: 456}\r\n * }\r\n * }\r\n * ```\r\n *\r\n * (B) If using class extend (previous approach in echarts 3 & 4):\r\n * ```js\r\n * let XxxComponent = Component.extend({\r\n * defaultOption: {\r\n * xx: 123\r\n * }\r\n * })\r\n * ```\r\n * ```js\r\n * let XxxSubComponent = XxxComponent.extend({\r\n * defaultOption: {\r\n * yy: 456\r\n * },\r\n * fn: function () {\r\n * let opt = this.getDefaultOption();\r\n * // opt is {xx: 123, yy: 456}\r\n * }\r\n * })\r\n * ```\r\n */\n\n\n ComponentModel.prototype.getDefaultOption = function () {\n var ctor = this.constructor; // If using class declaration, it is different to travel super class\n // in legacy env and auto merge defaultOption. So if using class\n // declaration, defaultOption should be merged manually.\n\n if (!isExtendedClass(ctor)) {\n // When using ts class, defaultOption must be declared as static.\n return ctor.defaultOption;\n } // FIXME: remove this approach?\n\n\n var fields = inner(this);\n\n if (!fields.defaultOption) {\n var optList = [];\n var clz = ctor;\n\n while (clz) {\n var opt = clz.prototype.defaultOption;\n opt && optList.push(opt);\n clz = clz.superClass;\n }\n\n var defaultOption = {};\n\n for (var i = optList.length - 1; i >= 0; i--) {\n defaultOption = zrUtil.merge(defaultOption, optList[i], true);\n }\n\n fields.defaultOption = defaultOption;\n }\n\n return fields.defaultOption;\n };\n /**\r\n * Notice: always force to input param `useDefault` in case that forget to consider it.\r\n * The same behavior as `modelUtil.parseFinder`.\r\n *\r\n * @param useDefault In many cases like series refer axis and axis refer grid,\r\n * If axis index / axis id not specified, use the first target as default.\r\n * In other cases like dataZoom refer axis, if not specified, measn no refer.\r\n */\n\n\n ComponentModel.prototype.getReferringComponents = function (mainType, opt) {\n var indexKey = mainType + 'Index';\n var idKey = mainType + 'Id';\n return queryReferringComponents(this.ecModel, mainType, {\n index: this.get(indexKey, true),\n id: this.get(idKey, true)\n }, opt);\n };\n\n ComponentModel.prototype.getBoxLayoutParams = function () {\n // Consider itself having box layout configs.\n var boxLayoutModel = this;\n return {\n left: boxLayoutModel.get('left'),\n top: boxLayoutModel.get('top'),\n right: boxLayoutModel.get('right'),\n bottom: boxLayoutModel.get('bottom'),\n width: boxLayoutModel.get('width'),\n height: boxLayoutModel.get('height')\n };\n };\n /**\r\n * Get key for zlevel.\r\n * If developers don't configure zlevel. We will assign zlevel to series based on the key.\r\n * For example, lines with trail effect and progressive series will in an individual zlevel.\r\n */\n\n\n ComponentModel.prototype.getZLevelKey = function () {\n return '';\n };\n\n ComponentModel.prototype.setZLevel = function (zlevel) {\n this.option.zlevel = zlevel;\n };\n\n ComponentModel.protoInitialize = function () {\n var proto = ComponentModel.prototype;\n proto.type = 'component';\n proto.id = '';\n proto.name = '';\n proto.mainType = '';\n proto.subType = '';\n proto.componentIndex = 0;\n }();\n\n return ComponentModel;\n}(Model);\n\nmountExtend(ComponentModel, Model);\nenableClassManagement(ComponentModel);\ncomponentUtil.enableSubTypeDefaulter(ComponentModel);\ncomponentUtil.enableTopologicalTravel(ComponentModel, getDependencies);\n\nfunction getDependencies(componentType) {\n var deps = [];\n zrUtil.each(ComponentModel.getClassesByMainType(componentType), function (clz) {\n deps = deps.concat(clz.dependencies || clz.prototype.dependencies || []);\n }); // Ensure main type.\n\n deps = zrUtil.map(deps, function (type) {\n return parseClassType(type).main;\n }); // Hack dataset for convenience.\n\n if (componentType !== 'dataset' && zrUtil.indexOf(deps, 'dataset') <= 0) {\n deps.unshift('dataset');\n }\n\n return deps;\n}\n\nexport default ComponentModel;","\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\n*/\nimport makeStyleMapper from './makeStyleMapper.js';\nexport var AREA_STYLE_KEY_MAP = [['fill', 'color'], ['shadowBlur'], ['shadowOffsetX'], ['shadowOffsetY'], ['opacity'], ['shadowColor'] // Option decal is in `DecalObject` but style.decal is in `PatternObject`.\n// So do not transfer decal directly.\n];\nvar getAreaStyle = makeStyleMapper(AREA_STYLE_KEY_MAP);\n\nvar AreaStyleMixin =\n/** @class */\nfunction () {\n function AreaStyleMixin() {}\n\n AreaStyleMixin.prototype.getAreaStyle = function (excludes, includes) {\n return getAreaStyle(this, excludes, includes);\n };\n\n return AreaStyleMixin;\n}();\n\n;\nexport { AreaStyleMixin };","\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\n*/\nimport { getFont } from '../../label/labelStyle.js';\nimport ZRText from 'zrender/lib/graphic/Text.js';\nvar PATH_COLOR = ['textStyle', 'color'];\nvar textStyleParams = ['fontStyle', 'fontWeight', 'fontSize', 'fontFamily', 'padding', 'lineHeight', 'rich', 'width', 'height', 'overflow']; // TODO Performance improvement?\n\nvar tmpText = new ZRText();\n\nvar TextStyleMixin =\n/** @class */\nfunction () {\n function TextStyleMixin() {}\n /**\r\n * Get color property or get color from option.textStyle.color\r\n */\n // TODO Callback\n\n\n TextStyleMixin.prototype.getTextColor = function (isEmphasis) {\n var ecModel = this.ecModel;\n return this.getShallow('color') || (!isEmphasis && ecModel ? ecModel.get(PATH_COLOR) : null);\n };\n /**\r\n * Create font string from fontStyle, fontWeight, fontSize, fontFamily\r\n * @return {string}\r\n */\n\n\n TextStyleMixin.prototype.getFont = function () {\n return getFont({\n fontStyle: this.getShallow('fontStyle'),\n fontWeight: this.getShallow('fontWeight'),\n fontSize: this.getShallow('fontSize'),\n fontFamily: this.getShallow('fontFamily')\n }, this.ecModel);\n };\n\n TextStyleMixin.prototype.getTextRect = function (text) {\n var style = {\n text: text,\n verticalAlign: this.getShallow('verticalAlign') || this.getShallow('baseline')\n };\n\n for (var i = 0; i < textStyleParams.length; i++) {\n style[textStyleParams[i]] = this.getShallow(textStyleParams[i]);\n }\n\n tmpText.useStyle(style);\n tmpText.update();\n return tmpText.getBoundingRect();\n };\n\n return TextStyleMixin;\n}();\n\n;\nexport default TextStyleMixin;","\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\n*/\nimport env from 'zrender/lib/core/env.js';\nimport { enableClassExtend, enableClassCheck } from '../util/clazz.js';\nimport { AreaStyleMixin } from './mixin/areaStyle.js';\nimport TextStyleMixin from './mixin/textStyle.js';\nimport { LineStyleMixin } from './mixin/lineStyle.js';\nimport { ItemStyleMixin } from './mixin/itemStyle.js';\nimport { mixin, clone, merge } from 'zrender/lib/core/util.js';\n\nvar Model =\n/** @class */\nfunction () {\n function Model(option, parentModel, ecModel) {\n this.parentModel = parentModel;\n this.ecModel = ecModel;\n this.option = option; // Simple optimization\n // if (this.init) {\n // if (arguments.length <= 4) {\n // this.init(option, parentModel, ecModel, extraOpt);\n // }\n // else {\n // this.init.apply(this, arguments);\n // }\n // }\n }\n\n Model.prototype.init = function (option, parentModel, ecModel) {\n var rest = [];\n\n for (var _i = 3; _i < arguments.length; _i++) {\n rest[_i - 3] = arguments[_i];\n }\n };\n /**\r\n * Merge the input option to me.\r\n */\n\n\n Model.prototype.mergeOption = function (option, ecModel) {\n merge(this.option, option, true);\n }; // `path` can be 'a.b.c', so the return value type have to be `ModelOption`\n // TODO: TYPE strict key check?\n // get(path: string | string[], ignoreParent?: boolean): ModelOption;\n\n\n Model.prototype.get = function (path, ignoreParent) {\n if (path == null) {\n return this.option;\n }\n\n return this._doGet(this.parsePath(path), !ignoreParent && this.parentModel);\n };\n\n Model.prototype.getShallow = function (key, ignoreParent) {\n var option = this.option;\n var val = option == null ? option : option[key];\n\n if (val == null && !ignoreParent) {\n var parentModel = this.parentModel;\n\n if (parentModel) {\n // FIXME:TS do not know how to make it works\n val = parentModel.getShallow(key);\n }\n }\n\n return val;\n }; // `path` can be 'a.b.c', so the return value type have to be `Model`\n // getModel(path: string | string[], parentModel?: Model): Model;\n // TODO 'a.b.c' is deprecated\n\n\n Model.prototype.getModel = function (path, parentModel) {\n var hasPath = path != null;\n var pathFinal = hasPath ? this.parsePath(path) : null;\n var obj = hasPath ? this._doGet(pathFinal) : this.option;\n parentModel = parentModel || this.parentModel && this.parentModel.getModel(this.resolveParentPath(pathFinal));\n return new Model(obj, parentModel, this.ecModel);\n };\n /**\r\n * If model has option\r\n */\n\n\n Model.prototype.isEmpty = function () {\n return this.option == null;\n };\n\n Model.prototype.restoreData = function () {}; // Pending\n\n\n Model.prototype.clone = function () {\n var Ctor = this.constructor;\n return new Ctor(clone(this.option));\n }; // setReadOnly(properties): void {\n // clazzUtil.setReadOnly(this, properties);\n // }\n // If path is null/undefined, return null/undefined.\n\n\n Model.prototype.parsePath = function (path) {\n if (typeof path === 'string') {\n return path.split('.');\n }\n\n return path;\n }; // Resolve path for parent. Perhaps useful when parent use a different property.\n // Default to be a identity resolver.\n // Can be modified to a different resolver.\n\n\n Model.prototype.resolveParentPath = function (path) {\n return path;\n }; // FIXME:TS check whether put this method here\n\n\n Model.prototype.isAnimationEnabled = function () {\n if (!env.node && this.option) {\n if (this.option.animation != null) {\n return !!this.option.animation;\n } else if (this.parentModel) {\n return this.parentModel.isAnimationEnabled();\n }\n }\n };\n\n Model.prototype._doGet = function (pathArr, parentModel) {\n var obj = this.option;\n\n if (!pathArr) {\n return obj;\n }\n\n for (var i = 0; i < pathArr.length; i++) {\n // Ignore empty\n if (!pathArr[i]) {\n continue;\n } // obj could be number/string/... (like 0)\n\n\n obj = obj && typeof obj === 'object' ? obj[pathArr[i]] : null;\n\n if (obj == null) {\n break;\n }\n }\n\n if (obj == null && parentModel) {\n obj = parentModel._doGet(this.resolveParentPath(pathArr), parentModel.parentModel);\n }\n\n return obj;\n };\n\n return Model;\n}();\n\n; // Enable Model.extend.\n\nenableClassExtend(Model);\nenableClassCheck(Model);\nmixin(Model, LineStyleMixin);\nmixin(Model, ItemStyleMixin);\nmixin(Model, AreaStyleMixin);\nmixin(Model, TextStyleMixin);\nexport default Model;","\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\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 is not specified, do not show a header line with only '-'.\n // This case always happens 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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\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]: Because 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 /**\r\n * Util for merge default and theme to option\r\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 /**\r\n * Init a data structure from data related option in series\r\n * Must be overridden.\r\n */\n\n\n SeriesModel.prototype.getInitialData = function (option, ecModel) {\n return;\n };\n /**\r\n * Append data to list\r\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 /**\r\n * Consider some method like `filter`, `map` need make new data,\r\n * We should make sure that `seriesModel.getData()` get correct\r\n * data in the stream procedure. So we fetch data from upstream\r\n * each time `task.perform` called.\r\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 /**\r\n * Get data before processed\r\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 /**\r\n * Get base axis if has coordinate system and has axis.\r\n * By default use coordSys.getBaseAxis();\r\n * Can be overridden for some chart.\r\n * @return {type} description\r\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 /**\r\n * Default tooltip formatter\r\n *\r\n * @param dataIndex\r\n * @param multipleSeries\r\n * @param dataType\r\n * @param renderMode valid values: 'html'(by default) and 'richText'.\r\n * 'html' is used for rendering tooltip in extra DOM form, and the result\r\n * string is used as DOM HTML content.\r\n * 'richText' is used for rendering tooltip in rich text form, for those where\r\n * DOM operation is not supported.\r\n * @return formatted tooltip with `html` and `markers`\r\n * Notice: The override method can also return string\r\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 /**\r\n * Use `data.mapDimensionsAll(coordDim)` instead.\r\n * @deprecated\r\n */\n\n\n SeriesModel.prototype.coordDimToDataDim = function (coordDim) {\n return this.getRawData().mapDimensionsAll(coordDim);\n };\n /**\r\n * Get progressive rendering count each step\r\n */\n\n\n SeriesModel.prototype.getProgressive = function () {\n return this.get('progressive');\n };\n /**\r\n * Get progressive rendering count each step\r\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 different 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/**\r\n * MUST be called after `prepareSource` called\r\n * Here we need to make auto series, especially for auto legend. But we\r\n * do not modify series.name in option to avoid side effects.\r\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 repeat 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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\n*/\nimport * as zrUtil from 'zrender/lib/core/util.js';\nimport { retrieveRawValue } from '../../data/helper/dataProvider.js';\nimport { formatTpl } from '../../util/format.js';\nimport { error, makePrintable } from '../../util/log.js';\nvar DIMENSION_LABEL_REG = /\\{@(.+?)\\}/g;\n\nvar DataFormatMixin =\n/** @class */\nfunction () {\n function DataFormatMixin() {}\n /**\r\n * Get params for formatter\r\n */\n\n\n DataFormatMixin.prototype.getDataParams = function (dataIndex, dataType) {\n var data = this.getData(dataType);\n var rawValue = this.getRawValue(dataIndex, dataType);\n var rawDataIndex = data.getRawIndex(dataIndex);\n var name = data.getName(dataIndex);\n var itemOpt = data.getRawDataItem(dataIndex);\n var style = data.getItemVisual(dataIndex, 'style');\n var color = style && style[data.getItemVisual(dataIndex, 'drawType') || 'fill'];\n var borderColor = style && style.stroke;\n var mainType = this.mainType;\n var isSeries = mainType === 'series';\n var userOutput = data.userOutput && data.userOutput.get();\n return {\n componentType: mainType,\n componentSubType: this.subType,\n componentIndex: this.componentIndex,\n seriesType: isSeries ? this.subType : null,\n seriesIndex: this.seriesIndex,\n seriesId: isSeries ? this.id : null,\n seriesName: isSeries ? this.name : null,\n name: name,\n dataIndex: rawDataIndex,\n data: itemOpt,\n dataType: dataType,\n value: rawValue,\n color: color,\n borderColor: borderColor,\n dimensionNames: userOutput ? userOutput.fullDimensions : null,\n encode: userOutput ? userOutput.encode : null,\n // Param name list for mapping `a`, `b`, `c`, `d`, `e`\n $vars: ['seriesName', 'name', 'value']\n };\n };\n /**\r\n * Format label\r\n * @param dataIndex\r\n * @param status 'normal' by default\r\n * @param dataType\r\n * @param labelDimIndex Only used in some chart that\r\n * use formatter in different dimensions, like radar.\r\n * @param formatter Formatter given outside.\r\n * @return return null/undefined if no formatter\r\n */\n\n\n DataFormatMixin.prototype.getFormattedLabel = function (dataIndex, status, dataType, labelDimIndex, formatter, extendParams) {\n status = status || 'normal';\n var data = this.getData(dataType);\n var params = this.getDataParams(dataIndex, dataType);\n\n if (extendParams) {\n params.value = extendParams.interpolatedValue;\n }\n\n if (labelDimIndex != null && zrUtil.isArray(params.value)) {\n params.value = params.value[labelDimIndex];\n }\n\n if (!formatter) {\n var itemModel = data.getItemModel(dataIndex); // @ts-ignore\n\n formatter = itemModel.get(status === 'normal' ? ['label', 'formatter'] : [status, 'label', 'formatter']);\n }\n\n if (zrUtil.isFunction(formatter)) {\n params.status = status;\n params.dimensionIndex = labelDimIndex;\n return formatter(params);\n } else if (zrUtil.isString(formatter)) {\n var str = formatTpl(formatter, params); // Support 'aaa{@[3]}bbb{@product}ccc'.\n // Do not support '}' in dim name util have to.\n\n return str.replace(DIMENSION_LABEL_REG, function (origin, dimStr) {\n var len = dimStr.length;\n var dimLoose = dimStr;\n\n if (dimLoose.charAt(0) === '[' && dimLoose.charAt(len - 1) === ']') {\n dimLoose = +dimLoose.slice(1, len - 1); // Also support: '[]' => 0\n\n if (process.env.NODE_ENV !== 'production') {\n if (isNaN(dimLoose)) {\n error(\"Invalide label formatter: @\" + dimStr + \", only support @[0], @[1], @[2], ...\");\n }\n }\n }\n\n var val = retrieveRawValue(data, dataIndex, dimLoose);\n\n if (extendParams && zrUtil.isArray(extendParams.interpolatedValue)) {\n var dimIndex = data.getDimensionIndex(dimLoose);\n\n if (dimIndex >= 0) {\n val = extendParams.interpolatedValue[dimIndex];\n }\n }\n\n return val != null ? val + '' : '';\n });\n }\n };\n /**\r\n * Get raw value in option\r\n */\n\n\n DataFormatMixin.prototype.getRawValue = function (idx, dataType) {\n return retrieveRawValue(this.getData(dataType), idx);\n };\n /**\r\n * Should be implemented.\r\n * @param {number} dataIndex\r\n * @param {boolean} [multipleSeries=false]\r\n * @param {string} [dataType]\r\n */\n\n\n DataFormatMixin.prototype.formatTooltip = function (dataIndex, multipleSeries, dataType) {\n // Empty function\n return;\n };\n\n return DataFormatMixin;\n}();\n\nexport { DataFormatMixin };\n; // PENDING: previously we accept this type when calling `formatTooltip`,\n// but guess little chance has been used outside. Do we need to backward\n// compat it?\n// type TooltipFormatResultLegacyObject = {\n// // `html` means the markup language text, either in 'html' or 'richText'.\n// // The name `html` is not appropriate because in 'richText' it is not a HTML\n// // string. But still support it for backward compatibility.\n// html: string;\n// markers: Dictionary;\n// };\n\n/**\r\n * For backward compat, normalize the return from `formatTooltip`.\r\n */\n\nexport function normalizeTooltipFormatResult(result) {\n var markupText; // let markers: Dictionary;\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\n*/\nimport makeStyleMapper from './makeStyleMapper.js';\nexport var ITEM_STYLE_KEY_MAP = [['fill', 'color'], ['stroke', 'borderColor'], ['lineWidth', 'borderWidth'], ['opacity'], ['shadowBlur'], ['shadowOffsetX'], ['shadowOffsetY'], ['shadowColor'], ['lineDash', 'borderType'], ['lineDashOffset', 'borderDashOffset'], ['lineCap', 'borderCap'], ['lineJoin', 'borderJoin'], ['miterLimit', 'borderMiterLimit'] // Option decal is in `DecalObject` but style.decal is in `PatternObject`.\n// So do not transfer decal directly.\n];\nvar getItemStyle = makeStyleMapper(ITEM_STYLE_KEY_MAP);\n\nvar ItemStyleMixin =\n/** @class */\nfunction () {\n function ItemStyleMixin() {}\n\n ItemStyleMixin.prototype.getItemStyle = function (excludes, includes) {\n return getItemStyle(this, excludes, includes);\n };\n\n return ItemStyleMixin;\n}();\n\nexport { ItemStyleMixin };","\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\n*/\nimport makeStyleMapper from './makeStyleMapper.js';\nexport var LINE_STYLE_KEY_MAP = [['lineWidth', 'width'], ['stroke', 'color'], ['opacity'], ['shadowBlur'], ['shadowOffsetX'], ['shadowOffsetY'], ['shadowColor'], ['lineDash', 'type'], ['lineDashOffset', 'dashOffset'], ['lineCap', 'cap'], ['lineJoin', 'join'], ['miterLimit'] // Option decal is in `DecalObject` but style.decal is in `PatternObject`.\n// So do not transfer decal directly.\n];\nvar getLineStyle = makeStyleMapper(LINE_STYLE_KEY_MAP);\n\nvar LineStyleMixin =\n/** @class */\nfunction () {\n function LineStyleMixin() {}\n\n LineStyleMixin.prototype.getLineStyle = function (excludes) {\n return getLineStyle(this, excludes);\n };\n\n return LineStyleMixin;\n}();\n\n;\nexport { LineStyleMixin };","\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\n*/\n// TODO Parse shadow style\n// TODO Only shallow path support\nimport * as zrUtil from 'zrender/lib/core/util.js';\nexport default function makeStyleMapper(properties, ignoreParent) {\n // Normalize\n for (var i = 0; i < properties.length; i++) {\n if (!properties[i][1]) {\n properties[i][1] = properties[i][0];\n }\n }\n\n ignoreParent = ignoreParent || false;\n return function (model, excludes, includes) {\n var style = {};\n\n for (var i = 0; i < properties.length; i++) {\n var propName = properties[i][1];\n\n if (excludes && zrUtil.indexOf(excludes, propName) >= 0 || includes && zrUtil.indexOf(includes, propName) < 0) {\n continue;\n }\n\n var val = model.getShallow(propName, ignoreParent);\n\n if (val != null) {\n style[properties[i][0]] = val;\n }\n } // TODO Text or image?\n\n\n return style;\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\n*/\nimport { makeInner, normalizeToArray } from '../../util/model.js';\nvar innerColor = makeInner();\nvar innerDecal = makeInner();\n\nvar PaletteMixin =\n/** @class */\nfunction () {\n function PaletteMixin() {}\n\n PaletteMixin.prototype.getColorFromPalette = function (name, scope, requestNum) {\n var defaultPalette = normalizeToArray(this.get('color', true));\n var layeredPalette = this.get('colorLayer', true);\n return getFromPalette(this, innerColor, defaultPalette, layeredPalette, name, scope, requestNum);\n };\n\n PaletteMixin.prototype.clearColorPalette = function () {\n clearPalette(this, innerColor);\n };\n\n return PaletteMixin;\n}();\n\nexport function getDecalFromPalette(ecModel, name, scope, requestNum) {\n var defaultDecals = normalizeToArray(ecModel.get(['aria', 'decal', 'decals']));\n return getFromPalette(ecModel, innerDecal, defaultDecals, null, name, scope, requestNum);\n}\n\nfunction getNearestPalette(palettes, requestColorNum) {\n var paletteNum = palettes.length; // TODO palettes must be in order\n\n for (var i = 0; i < paletteNum; i++) {\n if (palettes[i].length > requestColorNum) {\n return palettes[i];\n }\n }\n\n return palettes[paletteNum - 1];\n}\n/**\r\n * @param name MUST NOT be null/undefined. Otherwise call this function\r\n * twise with the same parameters will get different result.\r\n * @param scope default this.\r\n * @return Can be null/undefined\r\n */\n\n\nfunction getFromPalette(that, inner, defaultPalette, layeredPalette, name, scope, requestNum) {\n scope = scope || that;\n var scopeFields = inner(scope);\n var paletteIdx = scopeFields.paletteIdx || 0;\n var paletteNameMap = scopeFields.paletteNameMap = scopeFields.paletteNameMap || {}; // Use `hasOwnProperty` to avoid conflict with Object.prototype.\n\n if (paletteNameMap.hasOwnProperty(name)) {\n return paletteNameMap[name];\n }\n\n var palette = requestNum == null || !layeredPalette ? defaultPalette : getNearestPalette(layeredPalette, requestNum); // In case can't find in layered color palette.\n\n palette = palette || defaultPalette;\n\n if (!palette || !palette.length) {\n return;\n }\n\n var pickedPaletteItem = palette[paletteIdx];\n\n if (name) {\n paletteNameMap[name] = pickedPaletteItem;\n }\n\n scopeFields.paletteIdx = (paletteIdx + 1) % palette.length;\n return pickedPaletteItem;\n}\n\nfunction clearPalette(that, inner) {\n inner(that).paletteIdx = 0;\n inner(that).paletteNameMap = {};\n}\n\nexport { PaletteMixin };","\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\n*/\n\n/**\r\n * Helper for model references.\r\n * There are many manners to refer axis/coordSys.\r\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/**\r\n * @class\r\n * For example:\r\n * {\r\n * coordSysName: 'cartesian2d',\r\n * coordSysDims: ['x', 'y', ...],\r\n * axisMap: HashMap({\r\n * x: xAxisModel,\r\n * y: yAxisModel\r\n * }),\r\n * categoryAxisMap: HashMap({\r\n * x: xAxisModel,\r\n * y: undefined\r\n * }),\r\n * // The index of the first category axis in `coordSysDims`.\r\n * // `null/undefined` means no category axis exists.\r\n * firstCategoryDimIndex: 1,\r\n * // To replace user specified encode.\r\n * }\r\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\n*/\nimport * as zrUtil from 'zrender/lib/core/util.js';\nimport * as modelUtil from '../../util/model.js';\nimport { deprecateLog, deprecateReplaceLog } from '../../util/log.js';\nvar each = zrUtil.each;\nvar isObject = zrUtil.isObject;\nvar POSSIBLE_STYLES = ['areaStyle', 'lineStyle', 'nodeStyle', 'linkStyle', 'chordStyle', 'label', 'labelLine'];\n\nfunction compatEC2ItemStyle(opt) {\n var itemStyleOpt = opt && opt.itemStyle;\n\n if (!itemStyleOpt) {\n return;\n }\n\n for (var i = 0, len = POSSIBLE_STYLES.length; i < len; i++) {\n var styleName = POSSIBLE_STYLES[i];\n var normalItemStyleOpt = itemStyleOpt.normal;\n var emphasisItemStyleOpt = itemStyleOpt.emphasis;\n\n if (normalItemStyleOpt && normalItemStyleOpt[styleName]) {\n if (process.env.NODE_ENV !== 'production') {\n deprecateReplaceLog(\"itemStyle.normal.\" + styleName, styleName);\n }\n\n opt[styleName] = opt[styleName] || {};\n\n if (!opt[styleName].normal) {\n opt[styleName].normal = normalItemStyleOpt[styleName];\n } else {\n zrUtil.merge(opt[styleName].normal, normalItemStyleOpt[styleName]);\n }\n\n normalItemStyleOpt[styleName] = null;\n }\n\n if (emphasisItemStyleOpt && emphasisItemStyleOpt[styleName]) {\n if (process.env.NODE_ENV !== 'production') {\n deprecateReplaceLog(\"itemStyle.emphasis.\" + styleName, \"emphasis.\" + styleName);\n }\n\n opt[styleName] = opt[styleName] || {};\n\n if (!opt[styleName].emphasis) {\n opt[styleName].emphasis = emphasisItemStyleOpt[styleName];\n } else {\n zrUtil.merge(opt[styleName].emphasis, emphasisItemStyleOpt[styleName]);\n }\n\n emphasisItemStyleOpt[styleName] = null;\n }\n }\n}\n\nfunction convertNormalEmphasis(opt, optType, useExtend) {\n if (opt && opt[optType] && (opt[optType].normal || opt[optType].emphasis)) {\n var normalOpt = opt[optType].normal;\n var emphasisOpt = opt[optType].emphasis;\n\n if (normalOpt) {\n if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line max-len\n deprecateLog(\"'normal' hierarchy in \" + optType + \" has been removed since 4.0. All style properties are configured in \" + optType + \" directly now.\");\n } // Timeline controlStyle has other properties besides normal and emphasis\n\n\n if (useExtend) {\n opt[optType].normal = opt[optType].emphasis = null;\n zrUtil.defaults(opt[optType], normalOpt);\n } else {\n opt[optType] = normalOpt;\n }\n }\n\n if (emphasisOpt) {\n if (process.env.NODE_ENV !== 'production') {\n deprecateLog(optType + \".emphasis has been changed to emphasis.\" + optType + \" since 4.0\");\n }\n\n opt.emphasis = opt.emphasis || {};\n opt.emphasis[optType] = emphasisOpt; // Also compat the case user mix the style and focus together in ec3 style\n // for example: { itemStyle: { normal: {}, emphasis: {focus, shadowBlur} } }\n\n if (emphasisOpt.focus) {\n opt.emphasis.focus = emphasisOpt.focus;\n }\n\n if (emphasisOpt.blurScope) {\n opt.emphasis.blurScope = emphasisOpt.blurScope;\n }\n }\n }\n}\n\nfunction removeEC3NormalStatus(opt) {\n convertNormalEmphasis(opt, 'itemStyle');\n convertNormalEmphasis(opt, 'lineStyle');\n convertNormalEmphasis(opt, 'areaStyle');\n convertNormalEmphasis(opt, 'label');\n convertNormalEmphasis(opt, 'labelLine'); // treemap\n\n convertNormalEmphasis(opt, 'upperLabel'); // graph\n\n convertNormalEmphasis(opt, 'edgeLabel');\n}\n\nfunction compatTextStyle(opt, propName) {\n // Check whether is not object (string\\null\\undefined ...)\n var labelOptSingle = isObject(opt) && opt[propName];\n var textStyle = isObject(labelOptSingle) && labelOptSingle.textStyle;\n\n if (textStyle) {\n if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line max-len\n deprecateLog(\"textStyle hierarchy in \" + propName + \" has been removed since 4.0. All textStyle properties are configured in \" + propName + \" directly now.\");\n }\n\n for (var i = 0, len = modelUtil.TEXT_STYLE_OPTIONS.length; i < len; i++) {\n var textPropName = modelUtil.TEXT_STYLE_OPTIONS[i];\n\n if (textStyle.hasOwnProperty(textPropName)) {\n labelOptSingle[textPropName] = textStyle[textPropName];\n }\n }\n }\n}\n\nfunction compatEC3CommonStyles(opt) {\n if (opt) {\n removeEC3NormalStatus(opt);\n compatTextStyle(opt, 'label');\n opt.emphasis && compatTextStyle(opt.emphasis, 'label');\n }\n}\n\nfunction processSeries(seriesOpt) {\n if (!isObject(seriesOpt)) {\n return;\n }\n\n compatEC2ItemStyle(seriesOpt);\n removeEC3NormalStatus(seriesOpt);\n compatTextStyle(seriesOpt, 'label'); // treemap\n\n compatTextStyle(seriesOpt, 'upperLabel'); // graph\n\n compatTextStyle(seriesOpt, 'edgeLabel');\n\n if (seriesOpt.emphasis) {\n compatTextStyle(seriesOpt.emphasis, 'label'); // treemap\n\n compatTextStyle(seriesOpt.emphasis, 'upperLabel'); // graph\n\n compatTextStyle(seriesOpt.emphasis, 'edgeLabel');\n }\n\n var markPoint = seriesOpt.markPoint;\n\n if (markPoint) {\n compatEC2ItemStyle(markPoint);\n compatEC3CommonStyles(markPoint);\n }\n\n var markLine = seriesOpt.markLine;\n\n if (markLine) {\n compatEC2ItemStyle(markLine);\n compatEC3CommonStyles(markLine);\n }\n\n var markArea = seriesOpt.markArea;\n\n if (markArea) {\n compatEC3CommonStyles(markArea);\n }\n\n var data = seriesOpt.data; // Break with ec3: if `setOption` again, there may be no `type` in option,\n // then the backward compat based on option type will not be performed.\n\n if (seriesOpt.type === 'graph') {\n data = data || seriesOpt.nodes;\n var edgeData = seriesOpt.links || seriesOpt.edges;\n\n if (edgeData && !zrUtil.isTypedArray(edgeData)) {\n for (var i = 0; i < edgeData.length; i++) {\n compatEC3CommonStyles(edgeData[i]);\n }\n }\n\n zrUtil.each(seriesOpt.categories, function (opt) {\n removeEC3NormalStatus(opt);\n });\n }\n\n if (data && !zrUtil.isTypedArray(data)) {\n for (var i = 0; i < data.length; i++) {\n compatEC3CommonStyles(data[i]);\n }\n } // mark point data\n\n\n markPoint = seriesOpt.markPoint;\n\n if (markPoint && markPoint.data) {\n var mpData = markPoint.data;\n\n for (var i = 0; i < mpData.length; i++) {\n compatEC3CommonStyles(mpData[i]);\n }\n } // mark line data\n\n\n markLine = seriesOpt.markLine;\n\n if (markLine && markLine.data) {\n var mlData = markLine.data;\n\n for (var i = 0; i < mlData.length; i++) {\n if (zrUtil.isArray(mlData[i])) {\n compatEC3CommonStyles(mlData[i][0]);\n compatEC3CommonStyles(mlData[i][1]);\n } else {\n compatEC3CommonStyles(mlData[i]);\n }\n }\n } // Series\n\n\n if (seriesOpt.type === 'gauge') {\n compatTextStyle(seriesOpt, 'axisLabel');\n compatTextStyle(seriesOpt, 'title');\n compatTextStyle(seriesOpt, 'detail');\n } else if (seriesOpt.type === 'treemap') {\n convertNormalEmphasis(seriesOpt.breadcrumb, 'itemStyle');\n zrUtil.each(seriesOpt.levels, function (opt) {\n removeEC3NormalStatus(opt);\n });\n } else if (seriesOpt.type === 'tree') {\n removeEC3NormalStatus(seriesOpt.leaves);\n } // sunburst starts from ec4, so it does not need to compat levels.\n\n}\n\nfunction toArr(o) {\n return zrUtil.isArray(o) ? o : o ? [o] : [];\n}\n\nfunction toObj(o) {\n return (zrUtil.isArray(o) ? o[0] : o) || {};\n}\n\nexport default function globalCompatStyle(option, isTheme) {\n each(toArr(option.series), function (seriesOpt) {\n isObject(seriesOpt) && processSeries(seriesOpt);\n });\n var axes = ['xAxis', 'yAxis', 'radiusAxis', 'angleAxis', 'singleAxis', 'parallelAxis', 'radar'];\n isTheme && axes.push('valueAxis', 'categoryAxis', 'logAxis', 'timeAxis');\n each(axes, function (axisName) {\n each(toArr(option[axisName]), function (axisOpt) {\n if (axisOpt) {\n compatTextStyle(axisOpt, 'axisLabel');\n compatTextStyle(axisOpt.axisPointer, 'label');\n }\n });\n });\n each(toArr(option.parallel), function (parallelOpt) {\n var parallelAxisDefault = parallelOpt && parallelOpt.parallelAxisDefault;\n compatTextStyle(parallelAxisDefault, 'axisLabel');\n compatTextStyle(parallelAxisDefault && parallelAxisDefault.axisPointer, 'label');\n });\n each(toArr(option.calendar), function (calendarOpt) {\n convertNormalEmphasis(calendarOpt, 'itemStyle');\n compatTextStyle(calendarOpt, 'dayLabel');\n compatTextStyle(calendarOpt, 'monthLabel');\n compatTextStyle(calendarOpt, 'yearLabel');\n }); // radar.name.textStyle\n\n each(toArr(option.radar), function (radarOpt) {\n compatTextStyle(radarOpt, 'name'); // Use axisName instead of name because component has name property\n\n if (radarOpt.name && radarOpt.axisName == null) {\n radarOpt.axisName = radarOpt.name;\n delete radarOpt.name;\n\n if (process.env.NODE_ENV !== 'production') {\n deprecateLog('name property in radar component has been changed to axisName');\n }\n }\n\n if (radarOpt.nameGap != null && radarOpt.axisNameGap == null) {\n radarOpt.axisNameGap = radarOpt.nameGap;\n delete radarOpt.nameGap;\n\n if (process.env.NODE_ENV !== 'production') {\n deprecateLog('nameGap property in radar component has been changed to axisNameGap');\n }\n }\n\n if (process.env.NODE_ENV !== 'production') {\n each(radarOpt.indicator, function (indicatorOpt) {\n if (indicatorOpt.text) {\n deprecateReplaceLog('text', 'name', 'radar.indicator');\n }\n });\n }\n });\n each(toArr(option.geo), function (geoOpt) {\n if (isObject(geoOpt)) {\n compatEC3CommonStyles(geoOpt);\n each(toArr(geoOpt.regions), function (regionObj) {\n compatEC3CommonStyles(regionObj);\n });\n }\n });\n each(toArr(option.timeline), function (timelineOpt) {\n compatEC3CommonStyles(timelineOpt);\n convertNormalEmphasis(timelineOpt, 'label');\n convertNormalEmphasis(timelineOpt, 'itemStyle');\n convertNormalEmphasis(timelineOpt, 'controlStyle', true);\n var data = timelineOpt.data;\n zrUtil.isArray(data) && zrUtil.each(data, function (item) {\n if (zrUtil.isObject(item)) {\n convertNormalEmphasis(item, 'label');\n convertNormalEmphasis(item, 'itemStyle');\n }\n });\n });\n each(toArr(option.toolbox), function (toolboxOpt) {\n convertNormalEmphasis(toolboxOpt, 'iconStyle');\n each(toolboxOpt.feature, function (featureOpt) {\n convertNormalEmphasis(featureOpt, 'iconStyle');\n });\n });\n compatTextStyle(toObj(option.axisPointer), 'label');\n compatTextStyle(toObj(option.tooltip).axisPointer, 'label'); // Clean logs\n // storedLogs = {};\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\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 (isFinite(rate) && 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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\n*/\nimport CanvasPainter from 'zrender/lib/canvas/Painter.js';\nexport function install(registers) {\n registers.registerPainter('canvas', CanvasPainter);\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\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-set extent.\n // We assume user wants 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 /**\r\n * @param expandToNicedExtent Whether expand the ticks to niced extent.\r\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 /**\r\n * @param opt.precision If 'auto', use nice presision.\r\n * @param opt.pad returns 1.50 but not 1.5 if precision is 2.\r\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 /**\r\n * @param splitNumber By default `5`.\r\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 // Note that extents can be both negative. See #13154\n var expandSize = Math.abs(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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\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 /**\r\n * @param Whether expand the ticks to niced extent.\r\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 = mathLog(this.base); // log(-Infinity) is NaN, so safe guard here\n\n start = mathLog(Math.max(0, start)) / base;\n end = mathLog(Math.max(0, end)) / base;\n intervalScaleProto.setExtent.call(this, start, end);\n };\n /**\r\n * @return {number} end\r\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 /**\r\n * Update interval and extent of intervals for nice ticks\r\n * @param approxTickNum default 10 Given approx tick number\r\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\n*/\nimport { __extends } from \"tslib\";\n/**\r\n * Linear continuous scale\r\n * http://en.wikipedia.org/wiki/Level_of_measurement\r\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 // Caution: Math.round(null) will return `0` rather than `NaN`\n if (val == null) {\n return NaN;\n }\n\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 /**\r\n * Normalize given rank or name to linear [0, 1]\r\n * @param val raw ordinal number.\r\n * @return normalized value in [0, 1].\r\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 /**\r\n * @param val normalized value in [0, 1].\r\n * @return raw ordinal number.\r\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 /**\r\n * @see `Ordinal['_ordinalNumbersByTick']`\r\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 /**\r\n * @usage\r\n * ```js\r\n * const ordinalNumber = ordinalScale.getRawOrdinalNumber(tickVal);\r\n *\r\n * // case0\r\n * const rawOrdinalValue = axisModel.getCategories()[ordinalNumber];\r\n * // case1\r\n * const rawOrdinalValue = this._ordinalMeta.categories[ordinalNumber];\r\n * // case2\r\n * const coord = axis.dataToCoord(ordinalNumber);\r\n * ```\r\n *\r\n * @param {OrdinalNumber} tickNumber index of display\r\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 /**\r\n * Get item on tick\r\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 /**\r\n * @override\r\n * If value is in extent range\r\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\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 /**\r\n * Set extent from data\r\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 /**\r\n * Set extent from data\r\n */\n\n\n Scale.prototype.unionExtentFromData = function (data, dim) {\n this.unionExtent(data.getApproximateExtent(dim));\n };\n /**\r\n * Get extent\r\n *\r\n * Extent is always in increase order.\r\n */\n\n\n Scale.prototype.getExtent = function () {\n return this._extent.slice();\n };\n /**\r\n * Set extent\r\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 /**\r\n * If value is in extent range\r\n */\n\n\n Scale.prototype.isInExtentRange = function (value) {\n return this._extent[0] <= value && this._extent[1] >= value;\n };\n /**\r\n * When axis extent depends on data and no data exists,\r\n * axis ticks should not be drawn, which is named 'blank'.\r\n */\n\n\n Scale.prototype.isBlank = function () {\n return this._isBlank;\n };\n /**\r\n * When axis extent depends on data and no data exists,\r\n * axis ticks should not be drawn, which is named 'blank'.\r\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\n*/\nimport { __extends } from \"tslib\";\n/*\r\n* A third-party license is embedded for some of the code in this file:\r\n* The \"scaleLevels\" was originally copied from \"d3.js\" with some\r\n* modifications made for this project.\r\n* (See more details in the comment on the definition of \"scaleLevels\" below.)\r\n* The use of the source code of this file is also subject to the terms\r\n* and consitions of the license of \"d3.js\" (BSD-3Clause, see\r\n* ).\r\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 has\n// considered these common cases:\n// (1) Time that is persistent in server is in UTC, but it is needed to be displayed\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 /**\r\n * Get label is mainly for other components like dataZoom, tooltip.\r\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 /**\r\n * @override\r\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/**\r\n * This implementation was originally copied from \"d3.js\"\r\n * \r\n * with some modifications made for this program.\r\n * See the license statement at the head of this file.\r\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 between two months.\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\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/**\r\n * @param extent Both extent[0] and extent[1] should be valid number.\r\n * Should be extent[0] < extent[1].\r\n * @param splitNumber splitNumber should be >= 1.\r\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/**\r\n * @return interval precision\r\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\n*/\nimport { __extends } from \"tslib\";\nimport * as zrUtil from 'zrender/lib/core/util.js';\nvar TYPE_DELIMITER = '.';\nvar IS_CONTAINER = '___EC__COMPONENT__CONTAINER___';\nvar IS_EXTENDED_CLASS = '___EC__EXTENDED_CLASS___';\n/**\r\n * Notice, parseClassType('') should returns {main: '', sub: ''}\r\n * @public\r\n */\n\nexport function parseClassType(componentType) {\n var ret = {\n main: '',\n sub: ''\n };\n\n if (componentType) {\n var typeArr = componentType.split(TYPE_DELIMITER);\n ret.main = typeArr[0] || '';\n ret.sub = typeArr[1] || '';\n }\n\n return ret;\n}\n/**\r\n * @public\r\n */\n\nfunction checkClassType(componentType) {\n zrUtil.assert(/^[a-zA-Z0-9_]+([.][a-zA-Z0-9_]+)?$/.test(componentType), 'componentType \"' + componentType + '\" illegal');\n}\n\nexport function isExtendedClass(clz) {\n return !!(clz && clz[IS_EXTENDED_CLASS]);\n}\n/**\r\n * Implements `ExtendableConstructor` for `rootClz`.\r\n *\r\n * @usage\r\n * ```ts\r\n * class Xxx {}\r\n * type XxxConstructor = typeof Xxx & ExtendableConstructor\r\n * enableClassExtend(Xxx as XxxConstructor);\r\n * ```\r\n */\n\nexport function enableClassExtend(rootClz, mandatoryMethods) {\n rootClz.$constructor = rootClz; // FIXME: not necessary?\n\n rootClz.extend = function (proto) {\n if (process.env.NODE_ENV !== 'production') {\n zrUtil.each(mandatoryMethods, function (method) {\n if (!proto[method]) {\n console.warn('Method `' + method + '` should be implemented' + (proto.type ? ' in ' + proto.type : '') + '.');\n }\n });\n }\n\n var superClass = this;\n var ExtendedClass;\n\n if (isESClass(superClass)) {\n ExtendedClass =\n /** @class */\n function (_super) {\n __extends(class_1, _super);\n\n function class_1() {\n return _super.apply(this, arguments) || this;\n }\n\n return class_1;\n }(superClass);\n } else {\n // For backward compat, we both support ts class inheritance and this\n // \"extend\" approach.\n // The constructor should keep the same behavior as ts class inheritance:\n // If this constructor/$constructor is not declared, auto invoke the super\n // constructor.\n // If this constructor/$constructor is declared, it is responsible for\n // calling the super constructor.\n ExtendedClass = function () {\n (proto.$constructor || superClass).apply(this, arguments);\n };\n\n zrUtil.inherits(ExtendedClass, this);\n }\n\n zrUtil.extend(ExtendedClass.prototype, proto);\n ExtendedClass[IS_EXTENDED_CLASS] = true;\n ExtendedClass.extend = this.extend;\n ExtendedClass.superCall = superCall;\n ExtendedClass.superApply = superApply;\n ExtendedClass.superClass = superClass;\n return ExtendedClass;\n };\n}\n\nfunction isESClass(fn) {\n return zrUtil.isFunction(fn) && /^class\\s/.test(Function.prototype.toString.call(fn));\n}\n/**\r\n * A work around to both support ts extend and this extend mechanism.\r\n * on sub-class.\r\n * @usage\r\n * ```ts\r\n * class Component { ... }\r\n * classUtil.enableClassExtend(Component);\r\n * classUtil.enableClassManagement(Component, {registerWhenExtend: true});\r\n *\r\n * class Series extends Component { ... }\r\n * // Without calling `markExtend`, `registerWhenExtend` will not work.\r\n * Component.markExtend(Series);\r\n * ```\r\n */\n\n\nexport function mountExtend(SubClz, SupperClz) {\n SubClz.extend = SupperClz.extend;\n} // A random offset.\n\nvar classBase = Math.round(Math.random() * 10);\n/**\r\n * Implements `CheckableConstructor` for `target`.\r\n * Can not use instanceof, consider different scope by\r\n * cross domain or es module import in ec extensions.\r\n * Mount a method \"isInstance()\" to Clz.\r\n *\r\n * @usage\r\n * ```ts\r\n * class Xxx {}\r\n * type XxxConstructor = typeof Xxx & CheckableConstructor;\r\n * enableClassCheck(Xxx as XxxConstructor)\r\n * ```\r\n */\n\nexport function enableClassCheck(target) {\n var classAttr = ['__\\0is_clz', classBase++].join('_');\n target.prototype[classAttr] = true;\n\n if (process.env.NODE_ENV !== 'production') {\n zrUtil.assert(!target.isInstance, 'The method \"is\" can not be defined.');\n }\n\n target.isInstance = function (obj) {\n return !!(obj && obj[classAttr]);\n };\n} // superCall should have class info, which can not be fetched from 'this'.\n// Consider this case:\n// class A has method f,\n// class B inherits class A, overrides method f, f call superApply('f'),\n// class C inherits class B, does not override method f,\n// then when method of class C is called, dead loop occurred.\n\nfunction superCall(context, methodName) {\n var args = [];\n\n for (var _i = 2; _i < arguments.length; _i++) {\n args[_i - 2] = arguments[_i];\n }\n\n return this.superClass.prototype[methodName].apply(context, args);\n}\n\nfunction superApply(context, methodName, args) {\n return this.superClass.prototype[methodName].apply(context, args);\n}\n/**\r\n * Implements `ClassManager` for `target`\r\n *\r\n * @usage\r\n * ```ts\r\n * class Xxx {}\r\n * type XxxConstructor = typeof Xxx & ClassManager\r\n * enableClassManagement(Xxx as XxxConstructor);\r\n * ```\r\n */\n\n\nexport function enableClassManagement(target) {\n /**\r\n * Component model classes\r\n * key: componentType,\r\n * value:\r\n * componentClass, when componentType is 'a'\r\n * or Object., when componentType is 'a.b'\r\n */\n var storage = {};\n\n target.registerClass = function (clz) {\n // `type` should not be a \"instance member\".\n // If using TS class, should better declared as `static type = 'series.pie'`.\n // otherwise users have to mount `type` on prototype manually.\n // For backward compat and enable instance visit type via `this.type`,\n // we still support fetch `type` from prototype.\n var componentFullType = clz.type || clz.prototype.type;\n\n if (componentFullType) {\n checkClassType(componentFullType); // If only static type declared, we assign it to prototype mandatorily.\n\n clz.prototype.type = componentFullType;\n var componentTypeInfo = parseClassType(componentFullType);\n\n if (!componentTypeInfo.sub) {\n if (process.env.NODE_ENV !== 'production') {\n if (storage[componentTypeInfo.main]) {\n console.warn(componentTypeInfo.main + ' exists.');\n }\n }\n\n storage[componentTypeInfo.main] = clz;\n } else if (componentTypeInfo.sub !== IS_CONTAINER) {\n var container = makeContainer(componentTypeInfo);\n container[componentTypeInfo.sub] = clz;\n }\n }\n\n return clz;\n };\n\n target.getClass = function (mainType, subType, throwWhenNotFound) {\n var clz = storage[mainType];\n\n if (clz && clz[IS_CONTAINER]) {\n clz = subType ? clz[subType] : null;\n }\n\n if (throwWhenNotFound && !clz) {\n throw new Error(!subType ? mainType + '.' + 'type should be specified.' : 'Component ' + mainType + '.' + (subType || '') + ' is used but not imported.');\n }\n\n return clz;\n };\n\n target.getClassesByMainType = function (componentType) {\n var componentTypeInfo = parseClassType(componentType);\n var result = [];\n var obj = storage[componentTypeInfo.main];\n\n if (obj && obj[IS_CONTAINER]) {\n zrUtil.each(obj, function (o, type) {\n type !== IS_CONTAINER && result.push(o);\n });\n } else {\n result.push(obj);\n }\n\n return result;\n };\n\n target.hasClass = function (componentType) {\n // Just consider componentType.main.\n var componentTypeInfo = parseClassType(componentType);\n return !!storage[componentTypeInfo.main];\n };\n /**\r\n * @return Like ['aa', 'bb'], but can not be ['aa.xx']\r\n */\n\n\n target.getAllClassMainTypes = function () {\n var types = [];\n zrUtil.each(storage, function (obj, type) {\n types.push(type);\n });\n return types;\n };\n /**\r\n * If a main type is container and has sub types\r\n */\n\n\n target.hasSubTypes = function (componentType) {\n var componentTypeInfo = parseClassType(componentType);\n var obj = storage[componentTypeInfo.main];\n return obj && obj[IS_CONTAINER];\n };\n\n function makeContainer(componentTypeInfo) {\n var container = storage[componentTypeInfo.main];\n\n if (!container || !container[IS_CONTAINER]) {\n container = storage[componentTypeInfo.main] = {};\n container[IS_CONTAINER] = true;\n }\n\n return container;\n }\n} // /**\n// * @param {string|Array.} properties\n// */\n// export function setReadOnly(obj, properties) {\n// FIXME It seems broken in IE8 simulation of IE11\n// if (!zrUtil.isArray(properties)) {\n// properties = properties != null ? [properties] : [];\n// }\n// zrUtil.each(properties, function (prop) {\n// let value = obj[prop];\n// Object.defineProperty\n// && Object.defineProperty(obj, prop, {\n// value: value, writable: false\n// });\n// zrUtil.isArray(obj[prop])\n// && Object.freeze\n// && Object.freeze(obj[prop]);\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\n*/\nimport * as zrUtil from 'zrender/lib/core/util.js';\nimport { parseClassType } from './clazz.js';\nimport { makePrintable } from './log.js'; // A random offset\n\nvar base = Math.round(Math.random() * 10);\n/**\r\n * @public\r\n * @param {string} type\r\n * @return {string}\r\n */\n\nexport function getUID(type) {\n // Considering the case of crossing js context,\n // use Math.random to make id as unique as possible.\n return [type || '', base++].join('_');\n}\n/**\r\n * Implements `SubTypeDefaulterManager` for `target`.\r\n */\n\nexport function enableSubTypeDefaulter(target) {\n var subTypeDefaulters = {};\n\n target.registerSubTypeDefaulter = function (componentType, defaulter) {\n var componentTypeInfo = parseClassType(componentType);\n subTypeDefaulters[componentTypeInfo.main] = defaulter;\n };\n\n target.determineSubType = function (componentType, option) {\n var type = option.type;\n\n if (!type) {\n var componentTypeMain = parseClassType(componentType).main;\n\n if (target.hasSubTypes(componentType) && subTypeDefaulters[componentTypeMain]) {\n type = subTypeDefaulters[componentTypeMain](option);\n }\n }\n\n return type;\n };\n}\n/**\r\n * Implements `TopologicalTravelable` for `entity`.\r\n *\r\n * Topological travel on Activity Network (Activity On Vertices).\r\n * Dependencies is defined in Model.prototype.dependencies, like ['xAxis', 'yAxis'].\r\n * If 'xAxis' or 'yAxis' is absent in componentTypeList, just ignore it in topology.\r\n * If there is circular dependencey, Error will be thrown.\r\n */\n\nexport function enableTopologicalTravel(entity, dependencyGetter) {\n /**\r\n * @param targetNameList Target Component type list.\r\n * Can be ['aa', 'bb', 'aa.xx']\r\n * @param fullNameList By which we can build dependency graph.\r\n * @param callback Params: componentType, dependencies.\r\n * @param context Scope of callback.\r\n */\n entity.topologicalTravel = function (targetNameList, fullNameList, callback, context) {\n if (!targetNameList.length) {\n return;\n }\n\n var result = makeDepndencyGraph(fullNameList);\n var graph = result.graph;\n var noEntryList = result.noEntryList;\n var targetNameSet = {};\n zrUtil.each(targetNameList, function (name) {\n targetNameSet[name] = true;\n });\n\n while (noEntryList.length) {\n var currComponentType = noEntryList.pop();\n var currVertex = graph[currComponentType];\n var isInTargetNameSet = !!targetNameSet[currComponentType];\n\n if (isInTargetNameSet) {\n callback.call(context, currComponentType, currVertex.originalDeps.slice());\n delete targetNameSet[currComponentType];\n }\n\n zrUtil.each(currVertex.successor, isInTargetNameSet ? removeEdgeAndAdd : removeEdge);\n }\n\n zrUtil.each(targetNameSet, function () {\n var errMsg = '';\n\n if (process.env.NODE_ENV !== 'production') {\n errMsg = makePrintable('Circular dependency may exists: ', targetNameSet, targetNameList, fullNameList);\n }\n\n throw new Error(errMsg);\n });\n\n function removeEdge(succComponentType) {\n graph[succComponentType].entryCount--;\n\n if (graph[succComponentType].entryCount === 0) {\n noEntryList.push(succComponentType);\n }\n } // Consider this case: legend depends on series, and we call\n // chart.setOption({series: [...]}), where only series is in option.\n // If we do not have 'removeEdgeAndAdd', legendModel.mergeOption will\n // not be called, but only sereis.mergeOption is called. Thus legend\n // have no chance to update its local record about series (like which\n // name of series is available in legend).\n\n\n function removeEdgeAndAdd(succComponentType) {\n targetNameSet[succComponentType] = true;\n removeEdge(succComponentType);\n }\n };\n\n function makeDepndencyGraph(fullNameList) {\n var graph = {};\n var noEntryList = [];\n zrUtil.each(fullNameList, function (name) {\n var thisItem = createDependencyGraphItem(graph, name);\n var originalDeps = thisItem.originalDeps = dependencyGetter(name);\n var availableDeps = getAvailableDependencies(originalDeps, fullNameList);\n thisItem.entryCount = availableDeps.length;\n\n if (thisItem.entryCount === 0) {\n noEntryList.push(name);\n }\n\n zrUtil.each(availableDeps, function (dependentName) {\n if (zrUtil.indexOf(thisItem.predecessor, dependentName) < 0) {\n thisItem.predecessor.push(dependentName);\n }\n\n var thatItem = createDependencyGraphItem(graph, dependentName);\n\n if (zrUtil.indexOf(thatItem.successor, dependentName) < 0) {\n thatItem.successor.push(name);\n }\n });\n });\n return {\n graph: graph,\n noEntryList: noEntryList\n };\n }\n\n function createDependencyGraphItem(graph, name) {\n if (!graph[name]) {\n graph[name] = {\n predecessor: [],\n successor: []\n };\n }\n\n return graph[name];\n }\n\n function getAvailableDependencies(originalDeps, fullNameList) {\n var availableDeps = [];\n zrUtil.each(originalDeps, function (dep) {\n zrUtil.indexOf(fullNameList, dep) >= 0 && availableDeps.push(dep);\n });\n return availableDeps;\n }\n}\nexport function inheritDefaultOption(superOption, subOption) {\n // See also `model/Component.ts#getDefaultOption`\n return zrUtil.merge(zrUtil.merge({}, superOption, true), subOption, true);\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\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/**\r\n * Create or update pattern image from decal options\r\n *\r\n * @param {InnerDecalObject | 'none'} decalObject decal options, 'none' if no decal\r\n * @return {Pattern} pattern with generated image, null if no decal\r\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 /**\r\n * Get minimum length that can make a repeatable pattern.\r\n *\r\n * @return {Object} pattern width and height\r\n */\n\n function getPatternSize() {\n /**\r\n * For example, if dash is [[3, 2], [2, 1]] for X, it looks like\r\n * |--- --- --- --- --- ...\r\n * |-- -- -- -- -- -- -- -- ...\r\n * |--- --- --- --- --- ...\r\n * |-- -- -- -- -- -- -- -- ...\r\n * So the minimum length of X is 15,\r\n * which is the least common multiple of `3 + 2` and `2 + 1`\r\n * |--- --- --- |--- --- ...\r\n * |-- -- -- -- -- |-- -- -- ...\r\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/**\r\n * Convert symbol array into normalized array\r\n *\r\n * @param {string | (string | string[])[]} symbol symbol input\r\n * @return {string[][]} normolized symbol array\r\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/**\r\n * Convert dash input into dashArray\r\n *\r\n * @param {DecalDashArrayX} dash dash input\r\n * @return {number[][]} normolized dash array\r\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 /**\r\n * [20, 5] should be normalized into [[20, 5]],\r\n * while [20, [5, 10]] should be normalized into [[20, 20], [5, 10]]\r\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/**\r\n * Convert dash input into dashArray\r\n *\r\n * @param {DecalDashArrayY} dash dash input\r\n * @return {number[]} normolized dash array\r\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/**\r\n * Get block length of each line. A block is the length of dash line and space.\r\n * For example, a line with [4, 1] has a dash line of 4 and a space of 1 after\r\n * that, so the block length of this line is 5.\r\n *\r\n * @param {number[][]} dash dash array of X or Y\r\n * @return {number[]} block length of each line\r\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\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}","\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/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\n*/\nimport * as zrUtil from 'zrender/lib/core/util.js';\nimport { encodeHTML } from 'zrender/lib/core/dom.js';\nimport { parseDate, isNumeric, numericToNumber } from './number.js';\nimport { format as timeFormat, pad } from './time.js';\nimport { deprecateReplaceLog } from './log.js';\n/**\r\n * Add a comma each three digit.\r\n */\n\nexport function addCommas(x) {\n if (!isNumeric(x)) {\n return zrUtil.isString(x) ? x : '-';\n }\n\n var parts = (x + '').split('.');\n return parts[0].replace(/(\\d{1,3})(?=(?:\\d{3})+(?!\\d))/g, '$1,') + (parts.length > 1 ? '.' + parts[1] : '');\n}\nexport function toCamelCase(str, upperCaseFirst) {\n str = (str || '').toLowerCase().replace(/-(.)/g, function (match, group1) {\n return group1.toUpperCase();\n });\n\n if (upperCaseFirst && str) {\n str = str.charAt(0).toUpperCase() + str.slice(1);\n }\n\n return str;\n}\nexport var normalizeCssArray = zrUtil.normalizeCssArray;\nexport { encodeHTML };\n/**\r\n * Make value user readable for tooltip and label.\r\n * \"User readable\":\r\n * Try to not print programmer-specific text like NaN, Infinity, null, undefined.\r\n * Avoid to display an empty string, which users can not recognize there is\r\n * a value and it might look like a bug.\r\n */\n\nexport function makeValueReadable(value, valueType, useUTC) {\n var USER_READABLE_DEFUALT_TIME_PATTERN = '{yyyy}-{MM}-{dd} {HH}:{mm}:{ss}';\n\n function stringToUserReadable(str) {\n return str && zrUtil.trim(str) ? str : '-';\n }\n\n function isNumberUserReadable(num) {\n return !!(num != null && !isNaN(num) && isFinite(num));\n }\n\n var isTypeTime = valueType === 'time';\n var isValueDate = value instanceof Date;\n\n if (isTypeTime || isValueDate) {\n var date = isTypeTime ? parseDate(value) : value;\n\n if (!isNaN(+date)) {\n return timeFormat(date, USER_READABLE_DEFUALT_TIME_PATTERN, useUTC);\n } else if (isValueDate) {\n return '-';\n } // In other cases, continue to try to display the value in the following code.\n\n }\n\n if (valueType === 'ordinal') {\n return zrUtil.isStringSafe(value) ? stringToUserReadable(value) : zrUtil.isNumber(value) ? isNumberUserReadable(value) ? value + '' : '-' : '-';\n } // By default.\n\n\n var numericResult = numericToNumber(value);\n return isNumberUserReadable(numericResult) ? addCommas(numericResult) : zrUtil.isStringSafe(value) ? stringToUserReadable(value) : typeof value === 'boolean' ? value + '' : '-';\n}\nvar TPL_VAR_ALIAS = ['a', 'b', 'c', 'd', 'e', 'f', 'g'];\n\nvar wrapVar = function (varName, seriesIdx) {\n return '{' + varName + (seriesIdx == null ? '' : seriesIdx) + '}';\n};\n/**\r\n * Template formatter\r\n * @param {Array.