1 line
25 KiB
JSON
1 line
25 KiB
JSON
{"ast":null,"code":"import \"core-js/modules/es.array.fill.js\";\nimport \"core-js/modules/es.function.name.js\";\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 * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { isFunction, extend, createHashMap } from 'zrender/lib/core/util.js';\nimport makeStyleMapper from '../model/mixin/makeStyleMapper.js';\nimport { ITEM_STYLE_KEY_MAP } from '../model/mixin/itemStyle.js';\nimport { LINE_STYLE_KEY_MAP } from '../model/mixin/lineStyle.js';\nimport Model from '../model/Model.js';\nimport { makeInner } from '../util/model.js';\nvar inner = makeInner();\nvar defaultStyleMappers = {\n itemStyle: makeStyleMapper(ITEM_STYLE_KEY_MAP, true),\n lineStyle: makeStyleMapper(LINE_STYLE_KEY_MAP, true)\n};\nvar defaultColorKey = {\n lineStyle: 'stroke',\n itemStyle: 'fill'\n};\n\nfunction getStyleMapper(seriesModel, stylePath) {\n var styleMapper = seriesModel.visualStyleMapper || defaultStyleMappers[stylePath];\n\n if (!styleMapper) {\n console.warn(\"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 reset(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 dataEach(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 reset(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 overallReset(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 };","map":{"version":3,"sources":["D:/Work/WorkSpace/GitWorkSpace/TenShop/resource/ElectronicMall/src/ElectronicMallVue/node_modules/echarts/lib/visual/style.js"],"names":["isFunction","extend","createHashMap","makeStyleMapper","ITEM_STYLE_KEY_MAP","LINE_STYLE_KEY_MAP","Model","makeInner","inner","defaultStyleMappers","itemStyle","lineStyle","defaultColorKey","getStyleMapper","seriesModel","stylePath","styleMapper","visualStyleMapper","console","warn","getDefaultColorKey","colorKey","visualDrawType","seriesStyleTask","createOnAllSeries","performRawSeries","reset","ecModel","data","getData","visualStyleAccessPath","styleModel","getModel","getStyle","globalStyle","decalOption","getShallow","setVisual","dirty","color","colorCallback","hasAutoColor","fill","stroke","colorPalette","getColorFromPalette","name","getSeriesCount","isSeriesFiltered","dataEach","idx","dataParams","getDataParams","setItemVisual","sharedModel","dataStyleTask","ignoreStyleOnData","getVisual","hasItemOption","rawItem","getRawDataItem","option","style","existsStyle","ensureUniqueItemVisual","decal","dataColorPaletteTask","overallReset","paletteScopeGroupByType","eachSeries","colorBy","getColorBy","isColorBySeries","key","type","colorScope","get","set","scope","dataAll","getRawData","idxMap","each","rawIdx","getRawIndex","fromPalette","getItemVisual","name_1","getName","dataCount","count"],"mappings":";;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,UAAT,EAAqBC,MAArB,EAA6BC,aAA7B,QAAkD,0BAAlD;AACA,OAAOC,eAAP,MAA4B,mCAA5B;AACA,SAASC,kBAAT,QAAmC,6BAAnC;AACA,SAASC,kBAAT,QAAmC,6BAAnC;AACA,OAAOC,KAAP,MAAkB,mBAAlB;AACA,SAASC,SAAT,QAA0B,kBAA1B;AACA,IAAIC,KAAK,GAAGD,SAAS,EAArB;AACA,IAAIE,mBAAmB,GAAG;AACxBC,EAAAA,SAAS,EAAEP,eAAe,CAACC,kBAAD,EAAqB,IAArB,CADF;AAExBO,EAAAA,SAAS,EAAER,eAAe,CAACE,kBAAD,EAAqB,IAArB;AAFF,CAA1B;AAIA,IAAIO,eAAe,GAAG;AACpBD,EAAAA,SAAS,EAAE,QADS;AAEpBD,EAAAA,SAAS,EAAE;AAFS,CAAtB;;AAKA,SAASG,cAAT,CAAwBC,WAAxB,EAAqCC,SAArC,EAAgD;AAC9C,MAAIC,WAAW,GAAGF,WAAW,CAACG,iBA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AAxB,CAAlB,CAF6B,CAEkC;AAC/D;AACA;AACA;;AAEA,YAAImC,WAAJ,EAAiB;AACf,cAAI3E,SAAS,GAAGkB,IAAI,CAACoC,sBAAL,CAA4Bd,GAA5B,EAAiC,OAAjC,CAAhB;AACA,cAAIqC,MAAM,GAAGR,OAAO,CAACS,OAAR,CAAgBL,MAAhB,KAA2BA,MAAM,GAAG,EAAjD;AACA,cAAIM,SAAS,GAAGV,OAAO,CAACW,KAAR,EAAhB;AACAhF,UAAAA,SAAS,CAACW,QAAD,CAAT,GAAsBP,WAAW,CAAC+B,mBAAZ,CAAgC0C,MAAhC,EAAwCZ,UAAxC,EAAoDc,SAApD,CAAtB;AACD;AACF,OAbD;AAcD,KA/BD;AAgCD;AAvDwB,CAA3B;AAyDA,SAASlE,eAAT,EAA0BgC,aAA1B,EAAyCW,oBAAzC","sourcesContent":["\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { isFunction, extend, createHashMap } from 'zrender/lib/core/util.js';\nimport makeStyleMapper from '../model/mixin/makeStyleMapper.js';\nimport { ITEM_STYLE_KEY_MAP } from '../model/mixin/itemStyle.js';\nimport { LINE_STYLE_KEY_MAP } from '../model/mixin/lineStyle.js';\nimport Model from '../model/Model.js';\nimport { makeInner } from '../util/model.js';\nvar inner = makeInner();\nvar defaultStyleMappers = {\n itemStyle: makeStyleMapper(ITEM_STYLE_KEY_MAP, true),\n lineStyle: makeStyleMapper(LINE_STYLE_KEY_MAP, true)\n};\nvar defaultColorKey = {\n lineStyle: 'stroke',\n itemStyle: 'fill'\n};\n\nfunction getStyleMapper(seriesModel, stylePath) {\n var styleMapper = seriesModel.visualStyleMapper || defaultStyleMappers[stylePath];\n\n if (!styleMapper) {\n console.warn(\"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 };"]},"metadata":{},"sourceType":"module"} |