逐步完成前后端服务器

This commit is contained in:
2025-09-09 15:00:30 +08:00
parent fcb09432e9
commit c7dfa1e9fc
2937 changed files with 1477567 additions and 0 deletions

View File

@ -0,0 +1,81 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
* AUTO-GENERATED FILE. DO NOT MODIFY.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
* LegendVisualProvider is an bridge that pick encoded color from data and
* provide to the legend component.
*/
var LegendVisualProvider = /** @class */function () {
function LegendVisualProvider(
// Function to get data after filtered. It stores all the encoding info
getDataWithEncodedVisual,
// Function to get raw data before filtered.
getRawData) {
this._getDataWithEncodedVisual = getDataWithEncodedVisual;
this._getRawData = getRawData;
}
LegendVisualProvider.prototype.getAllNames = function () {
var rawData = this._getRawData();
// We find the name from the raw data. In case it's filtered by the legend component.
// Normally, the name can be found in rawData, but can't be found in filtered data will display as gray.
return rawData.mapArray(rawData.getName);
};
LegendVisualProvider.prototype.containName = function (name) {
var rawData = this._getRawData();
return rawData.indexOfName(name) >= 0;
};
LegendVisualProvider.prototype.indexOfName = function (name) {
// Only get data when necessary.
// Because LegendVisualProvider constructor may be new in the stage that data is not prepared yet.
// Invoking Series#getData immediately will throw an error.
var dataWithEncodedVisual = this._getDataWithEncodedVisual();
return dataWithEncodedVisual.indexOfName(name);
};
LegendVisualProvider.prototype.getItemVisual = function (dataIndex, key) {
// Get encoded visual properties from final filtered data.
var dataWithEncodedVisual = this._getDataWithEncodedVisual();
return dataWithEncodedVisual.getItemVisual(dataIndex, key);
};
return LegendVisualProvider;
}();
export default LegendVisualProvider;

View File

@ -0,0 +1,478 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
* AUTO-GENERATED FILE. DO NOT MODIFY.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import * as zrUtil from 'zrender/lib/core/util.js';
import * as zrColor from 'zrender/lib/tool/color.js';
import { linearMap } from '../util/number.js';
import { warn } from '../util/log.js';
var each = zrUtil.each;
var isObject = zrUtil.isObject;
var CATEGORY_DEFAULT_VISUAL_INDEX = -1;
var VisualMapping = /** @class */function () {
function VisualMapping(option) {
var mappingMethod = option.mappingMethod;
var visualType = option.type;
var thisOption = this.option = zrUtil.clone(option);
this.type = visualType;
this.mappingMethod = mappingMethod;
this._normalizeData = normalizers[mappingMethod];
var visualHandler = VisualMapping.visualHandlers[visualType];
this.applyVisual = visualHandler.applyVisual;
this.getColorMapper = visualHandler.getColorMapper;
this._normalizedToVisual = visualHandler._normalizedToVisual[mappingMethod];
if (mappingMethod === 'piecewise') {
normalizeVisualRange(thisOption);
preprocessForPiecewise(thisOption);
} else if (mappingMethod === 'category') {
thisOption.categories ? preprocessForSpecifiedCategory(thisOption)
// categories is ordinal when thisOption.categories not specified,
// which need no more preprocess except normalize visual.
: normalizeVisualRange(thisOption, true);
} else {
// mappingMethod === 'linear' or 'fixed'
zrUtil.assert(mappingMethod !== 'linear' || thisOption.dataExtent);
normalizeVisualRange(thisOption);
}
}
VisualMapping.prototype.mapValueToVisual = function (value) {
var normalized = this._normalizeData(value);
return this._normalizedToVisual(normalized, value);
};
VisualMapping.prototype.getNormalizer = function () {
return zrUtil.bind(this._normalizeData, this);
};
/**
* List available visual types.
*
* @public
* @return {Array.<string>}
*/
VisualMapping.listVisualTypes = function () {
return zrUtil.keys(VisualMapping.visualHandlers);
};
// /**
// * @public
// */
// static addVisualHandler(name, handler) {
// visualHandlers[name] = handler;
// }
/**
* @public
*/
VisualMapping.isValidType = function (visualType) {
return VisualMapping.visualHandlers.hasOwnProperty(visualType);
};
/**
* Convenient method.
* Visual can be Object or Array or primary type.
*/
VisualMapping.eachVisual = function (visual, callback, context) {
if (zrUtil.isObject(visual)) {
zrUtil.each(visual, callback, context);
} else {
callback.call(context, visual);
}
};
VisualMapping.mapVisual = function (visual, callback, context) {
var isPrimary;
var newVisual = zrUtil.isArray(visual) ? [] : zrUtil.isObject(visual) ? {} : (isPrimary = true, null);
VisualMapping.eachVisual(visual, function (v, key) {
var newVal = callback.call(context, v, key);
isPrimary ? newVisual = newVal : newVisual[key] = newVal;
});
return newVisual;
};
/**
* Retrieve visual properties from given object.
*/
VisualMapping.retrieveVisuals = function (obj) {
var ret = {};
var hasVisual;
obj && each(VisualMapping.visualHandlers, function (h, visualType) {
if (obj.hasOwnProperty(visualType)) {
ret[visualType] = obj[visualType];
hasVisual = true;
}
});
return hasVisual ? ret : null;
};
/**
* Give order to visual types, considering colorSaturation, colorAlpha depends on color.
*
* @public
* @param {(Object|Array)} visualTypes If Object, like: {color: ..., colorSaturation: ...}
* IF Array, like: ['color', 'symbol', 'colorSaturation']
* @return {Array.<string>} Sorted visual types.
*/
VisualMapping.prepareVisualTypes = function (visualTypes) {
if (zrUtil.isArray(visualTypes)) {
visualTypes = visualTypes.slice();
} else if (isObject(visualTypes)) {
var types_1 = [];
each(visualTypes, function (item, type) {
types_1.push(type);
});
visualTypes = types_1;
} else {
return [];
}
visualTypes.sort(function (type1, type2) {
// color should be front of colorSaturation, colorAlpha, ...
// symbol and symbolSize do not matter.
return type2 === 'color' && type1 !== 'color' && type1.indexOf('color') === 0 ? 1 : -1;
});
return visualTypes;
};
/**
* 'color', 'colorSaturation', 'colorAlpha', ... are depends on 'color'.
* Other visuals are only depends on themself.
*/
VisualMapping.dependsOn = function (visualType1, visualType2) {
return visualType2 === 'color' ? !!(visualType1 && visualType1.indexOf(visualType2) === 0) : visualType1 === visualType2;
};
/**
* @param value
* @param pieceList [{value: ..., interval: [min, max]}, ...]
* Always from small to big.
* @param findClosestWhenOutside Default to be false
* @return index
*/
VisualMapping.findPieceIndex = function (value, pieceList, findClosestWhenOutside) {
var possibleI;
var abs = Infinity;
// value has the higher priority.
for (var i = 0, len = pieceList.length; i < len; i++) {
var pieceValue = pieceList[i].value;
if (pieceValue != null) {
if (pieceValue === value
// FIXME
// It is supposed to compare value according to value type of dimension,
// but currently value type can exactly be string or number.
// Compromise for numeric-like string (like '12'), especially
// in the case that visualMap.categories is ['22', '33'].
|| zrUtil.isString(pieceValue) && pieceValue === value + '') {
return i;
}
findClosestWhenOutside && updatePossible(pieceValue, i);
}
}
for (var i = 0, len = pieceList.length; i < len; i++) {
var piece = pieceList[i];
var interval = piece.interval;
var close_1 = piece.close;
if (interval) {
if (interval[0] === -Infinity) {
if (littleThan(close_1[1], value, interval[1])) {
return i;
}
} else if (interval[1] === Infinity) {
if (littleThan(close_1[0], interval[0], value)) {
return i;
}
} else if (littleThan(close_1[0], interval[0], value) && littleThan(close_1[1], value, interval[1])) {
return i;
}
findClosestWhenOutside && updatePossible(interval[0], i);
findClosestWhenOutside && updatePossible(interval[1], i);
}
}
if (findClosestWhenOutside) {
return value === Infinity ? pieceList.length - 1 : value === -Infinity ? 0 : possibleI;
}
function updatePossible(val, index) {
var newAbs = Math.abs(val - value);
if (newAbs < abs) {
abs = newAbs;
possibleI = index;
}
}
};
VisualMapping.visualHandlers = {
color: {
applyVisual: makeApplyVisual('color'),
getColorMapper: function () {
var thisOption = this.option;
return zrUtil.bind(thisOption.mappingMethod === 'category' ? function (value, isNormalized) {
!isNormalized && (value = this._normalizeData(value));
return doMapCategory.call(this, value);
} : function (value, isNormalized, out) {
// If output rgb array
// which will be much faster and useful in pixel manipulation
var returnRGBArray = !!out;
!isNormalized && (value = this._normalizeData(value));
out = zrColor.fastLerp(value, thisOption.parsedVisual, out);
return returnRGBArray ? out : zrColor.stringify(out, 'rgba');
}, this);
},
_normalizedToVisual: {
linear: function (normalized) {
return zrColor.stringify(zrColor.fastLerp(normalized, this.option.parsedVisual), 'rgba');
},
category: doMapCategory,
piecewise: function (normalized, value) {
var result = getSpecifiedVisual.call(this, value);
if (result == null) {
result = zrColor.stringify(zrColor.fastLerp(normalized, this.option.parsedVisual), 'rgba');
}
return result;
},
fixed: doMapFixed
}
},
colorHue: makePartialColorVisualHandler(function (color, value) {
return zrColor.modifyHSL(color, value);
}),
colorSaturation: makePartialColorVisualHandler(function (color, value) {
return zrColor.modifyHSL(color, null, value);
}),
colorLightness: makePartialColorVisualHandler(function (color, value) {
return zrColor.modifyHSL(color, null, null, value);
}),
colorAlpha: makePartialColorVisualHandler(function (color, value) {
return zrColor.modifyAlpha(color, value);
}),
decal: {
applyVisual: makeApplyVisual('decal'),
_normalizedToVisual: {
linear: null,
category: doMapCategory,
piecewise: null,
fixed: null
}
},
opacity: {
applyVisual: makeApplyVisual('opacity'),
_normalizedToVisual: createNormalizedToNumericVisual([0, 1])
},
liftZ: {
applyVisual: makeApplyVisual('liftZ'),
_normalizedToVisual: {
linear: doMapFixed,
category: doMapFixed,
piecewise: doMapFixed,
fixed: doMapFixed
}
},
symbol: {
applyVisual: function (value, getter, setter) {
var symbolCfg = this.mapValueToVisual(value);
setter('symbol', symbolCfg);
},
_normalizedToVisual: {
linear: doMapToArray,
category: doMapCategory,
piecewise: function (normalized, value) {
var result = getSpecifiedVisual.call(this, value);
if (result == null) {
result = doMapToArray.call(this, normalized);
}
return result;
},
fixed: doMapFixed
}
},
symbolSize: {
applyVisual: makeApplyVisual('symbolSize'),
_normalizedToVisual: createNormalizedToNumericVisual([0, 1])
}
};
return VisualMapping;
}();
function preprocessForPiecewise(thisOption) {
var pieceList = thisOption.pieceList;
thisOption.hasSpecialVisual = false;
zrUtil.each(pieceList, function (piece, index) {
piece.originIndex = index;
// piece.visual is "result visual value" but not
// a visual range, so it does not need to be normalized.
if (piece.visual != null) {
thisOption.hasSpecialVisual = true;
}
});
}
function preprocessForSpecifiedCategory(thisOption) {
// Hash categories.
var categories = thisOption.categories;
var categoryMap = thisOption.categoryMap = {};
var visual = thisOption.visual;
each(categories, function (cate, index) {
categoryMap[cate] = index;
});
// Process visual map input.
if (!zrUtil.isArray(visual)) {
var visualArr_1 = [];
if (zrUtil.isObject(visual)) {
each(visual, function (v, cate) {
var index = categoryMap[cate];
visualArr_1[index != null ? index : CATEGORY_DEFAULT_VISUAL_INDEX] = v;
});
} else {
// Is primary type, represents default visual.
visualArr_1[CATEGORY_DEFAULT_VISUAL_INDEX] = visual;
}
visual = setVisualToOption(thisOption, visualArr_1);
}
// Remove categories that has no visual,
// then we can mapping them to CATEGORY_DEFAULT_VISUAL_INDEX.
for (var i = categories.length - 1; i >= 0; i--) {
if (visual[i] == null) {
delete categoryMap[categories[i]];
categories.pop();
}
}
}
function normalizeVisualRange(thisOption, isCategory) {
var visual = thisOption.visual;
var visualArr = [];
if (zrUtil.isObject(visual)) {
each(visual, function (v) {
visualArr.push(v);
});
} else if (visual != null) {
visualArr.push(visual);
}
var doNotNeedPair = {
color: 1,
symbol: 1
};
if (!isCategory && visualArr.length === 1 && !doNotNeedPair.hasOwnProperty(thisOption.type)) {
// Do not care visualArr.length === 0, which is illegal.
visualArr[1] = visualArr[0];
}
setVisualToOption(thisOption, visualArr);
}
function makePartialColorVisualHandler(applyValue) {
return {
applyVisual: function (value, getter, setter) {
// Only used in HSL
var colorChannel = this.mapValueToVisual(value);
// Must not be array value
setter('color', applyValue(getter('color'), colorChannel));
},
_normalizedToVisual: createNormalizedToNumericVisual([0, 1])
};
}
function doMapToArray(normalized) {
var visual = this.option.visual;
return visual[Math.round(linearMap(normalized, [0, 1], [0, visual.length - 1], true))] || {}; // TODO {}?
}
function makeApplyVisual(visualType) {
return function (value, getter, setter) {
setter(visualType, this.mapValueToVisual(value));
};
}
function doMapCategory(normalized) {
var visual = this.option.visual;
return visual[this.option.loop && normalized !== CATEGORY_DEFAULT_VISUAL_INDEX ? normalized % visual.length : normalized];
}
function doMapFixed() {
// visual will be convert to array.
return this.option.visual[0];
}
/**
* Create mapped to numeric visual
*/
function createNormalizedToNumericVisual(sourceExtent) {
return {
linear: function (normalized) {
return linearMap(normalized, sourceExtent, this.option.visual, true);
},
category: doMapCategory,
piecewise: function (normalized, value) {
var result = getSpecifiedVisual.call(this, value);
if (result == null) {
result = linearMap(normalized, sourceExtent, this.option.visual, true);
}
return result;
},
fixed: doMapFixed
};
}
function getSpecifiedVisual(value) {
var thisOption = this.option;
var pieceList = thisOption.pieceList;
if (thisOption.hasSpecialVisual) {
var pieceIndex = VisualMapping.findPieceIndex(value, pieceList);
var piece = pieceList[pieceIndex];
if (piece && piece.visual) {
return piece.visual[this.type];
}
}
}
function setVisualToOption(thisOption, visualArr) {
thisOption.visual = visualArr;
if (thisOption.type === 'color') {
thisOption.parsedVisual = zrUtil.map(visualArr, function (item) {
var color = zrColor.parse(item);
if (!color && process.env.NODE_ENV !== 'production') {
warn("'" + item + "' is an illegal color, fallback to '#000000'", true);
}
return color || [0, 0, 0, 1];
});
}
return visualArr;
}
/**
* Normalizers by mapping methods.
*/
var normalizers = {
linear: function (value) {
return linearMap(value, this.option.dataExtent, [0, 1], true);
},
piecewise: function (value) {
var pieceList = this.option.pieceList;
var pieceIndex = VisualMapping.findPieceIndex(value, pieceList, true);
if (pieceIndex != null) {
return linearMap(pieceIndex, [0, pieceList.length - 1], [0, 1], true);
}
},
category: function (value) {
var index = this.option.categories ? this.option.categoryMap[value] : value; // ordinal value
return index == null ? CATEGORY_DEFAULT_VISUAL_INDEX : index;
},
fixed: zrUtil.noop
};
function littleThan(close, a, b) {
return close ? a <= b : a < b;
}
export default VisualMapping;

237
frontend/node_modules/echarts/lib/visual/aria.js generated vendored Normal file
View File

@ -0,0 +1,237 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
* AUTO-GENERATED FILE. DO NOT MODIFY.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import * as zrUtil from 'zrender/lib/core/util.js';
import { makeInner } from '../util/model.js';
import { getDecalFromPalette } from '../model/mixin/palette.js';
var DEFAULT_OPTION = {
label: {
enabled: true
},
decal: {
show: false
}
};
var inner = makeInner();
var decalPaletteScope = {};
export default function ariaVisual(ecModel, api) {
var ariaModel = ecModel.getModel('aria');
// See "area enabled" detection code in `GlobalModel.ts`.
if (!ariaModel.get('enabled')) {
return;
}
var defaultOption = zrUtil.clone(DEFAULT_OPTION);
zrUtil.merge(defaultOption.label, ecModel.getLocaleModel().get('aria'), false);
zrUtil.merge(ariaModel.option, defaultOption, false);
setDecal();
setLabel();
function setDecal() {
var decalModel = ariaModel.getModel('decal');
var useDecal = decalModel.get('show');
if (useDecal) {
// Each type of series use one scope.
// Pie and funnel are using different scopes.
var paletteScopeGroupByType_1 = zrUtil.createHashMap();
ecModel.eachSeries(function (seriesModel) {
if (seriesModel.isColorBySeries()) {
return;
}
var decalScope = paletteScopeGroupByType_1.get(seriesModel.type);
if (!decalScope) {
decalScope = {};
paletteScopeGroupByType_1.set(seriesModel.type, decalScope);
}
inner(seriesModel).scope = decalScope;
});
ecModel.eachRawSeries(function (seriesModel) {
if (ecModel.isSeriesFiltered(seriesModel)) {
return;
}
if (zrUtil.isFunction(seriesModel.enableAriaDecal)) {
// Let series define how to use decal palette on data
seriesModel.enableAriaDecal();
return;
}
var data = seriesModel.getData();
if (!seriesModel.isColorBySeries()) {
var dataAll_1 = seriesModel.getRawData();
var idxMap_1 = {};
var decalScope_1 = inner(seriesModel).scope;
data.each(function (idx) {
var rawIdx = data.getRawIndex(idx);
idxMap_1[rawIdx] = idx;
});
var dataCount_1 = dataAll_1.count();
dataAll_1.each(function (rawIdx) {
var idx = idxMap_1[rawIdx];
var name = dataAll_1.getName(rawIdx) || rawIdx + '';
var paletteDecal = getDecalFromPalette(seriesModel.ecModel, name, decalScope_1, dataCount_1);
var specifiedDecal = data.getItemVisual(idx, 'decal');
data.setItemVisual(idx, 'decal', mergeDecal(specifiedDecal, paletteDecal));
});
} else {
var paletteDecal = getDecalFromPalette(seriesModel.ecModel, seriesModel.name, decalPaletteScope, ecModel.getSeriesCount());
var specifiedDecal = data.getVisual('decal');
data.setVisual('decal', mergeDecal(specifiedDecal, paletteDecal));
}
function mergeDecal(specifiedDecal, paletteDecal) {
// Merge decal from palette to decal from itemStyle.
// User do not need to specify all of the decal props.
var resultDecal = specifiedDecal ? zrUtil.extend(zrUtil.extend({}, paletteDecal), specifiedDecal) : paletteDecal;
resultDecal.dirty = true;
return resultDecal;
}
});
}
}
function setLabel() {
var dom = api.getZr().dom;
// TODO: support for SSR
if (!dom) {
return;
}
var labelLocale = ecModel.getLocaleModel().get('aria');
var labelModel = ariaModel.getModel('label');
labelModel.option = zrUtil.defaults(labelModel.option, labelLocale);
if (!labelModel.get('enabled')) {
return;
}
dom.setAttribute('role', 'img');
if (labelModel.get('description')) {
dom.setAttribute('aria-label', labelModel.get('description'));
return;
}
var seriesCnt = ecModel.getSeriesCount();
var maxDataCnt = labelModel.get(['data', 'maxCount']) || 10;
var maxSeriesCnt = labelModel.get(['series', 'maxCount']) || 10;
var displaySeriesCnt = Math.min(seriesCnt, maxSeriesCnt);
var ariaLabel;
if (seriesCnt < 1) {
// No series, no aria label
return;
} else {
var title = getTitle();
if (title) {
var withTitle = labelModel.get(['general', 'withTitle']);
ariaLabel = replace(withTitle, {
title: title
});
} else {
ariaLabel = labelModel.get(['general', 'withoutTitle']);
}
var seriesLabels_1 = [];
var prefix = seriesCnt > 1 ? labelModel.get(['series', 'multiple', 'prefix']) : labelModel.get(['series', 'single', 'prefix']);
ariaLabel += replace(prefix, {
seriesCount: seriesCnt
});
ecModel.eachSeries(function (seriesModel, idx) {
if (idx < displaySeriesCnt) {
var seriesLabel = void 0;
var seriesName = seriesModel.get('name');
var withName = seriesName ? 'withName' : 'withoutName';
seriesLabel = seriesCnt > 1 ? labelModel.get(['series', 'multiple', withName]) : labelModel.get(['series', 'single', withName]);
seriesLabel = replace(seriesLabel, {
seriesId: seriesModel.seriesIndex,
seriesName: seriesModel.get('name'),
seriesType: getSeriesTypeName(seriesModel.subType)
});
var data = seriesModel.getData();
if (data.count() > maxDataCnt) {
// Show part of data
var partialLabel = labelModel.get(['data', 'partialData']);
seriesLabel += replace(partialLabel, {
displayCnt: maxDataCnt
});
} else {
seriesLabel += labelModel.get(['data', 'allData']);
}
var middleSeparator_1 = labelModel.get(['data', 'separator', 'middle']);
var endSeparator_1 = labelModel.get(['data', 'separator', 'end']);
var excludeDimensionId_1 = labelModel.get(['data', 'excludeDimensionId']);
var dataLabels = [];
for (var i = 0; i < data.count(); i++) {
if (i < maxDataCnt) {
var name_1 = data.getName(i);
var value = !excludeDimensionId_1 ? data.getValues(i) : zrUtil.filter(data.getValues(i), function (v, j) {
return zrUtil.indexOf(excludeDimensionId_1, j) === -1;
});
var dataLabel = labelModel.get(['data', name_1 ? 'withName' : 'withoutName']);
dataLabels.push(replace(dataLabel, {
name: name_1,
value: value.join(middleSeparator_1)
}));
}
}
seriesLabel += dataLabels.join(middleSeparator_1) + endSeparator_1;
seriesLabels_1.push(seriesLabel);
}
});
var separatorModel = labelModel.getModel(['series', 'multiple', 'separator']);
var middleSeparator = separatorModel.get('middle');
var endSeparator = separatorModel.get('end');
ariaLabel += seriesLabels_1.join(middleSeparator) + endSeparator;
dom.setAttribute('aria-label', ariaLabel);
}
}
function replace(str, keyValues) {
if (!zrUtil.isString(str)) {
return str;
}
var result = str;
zrUtil.each(keyValues, function (value, key) {
result = result.replace(new RegExp('\\{\\s*' + key + '\\s*\\}', 'g'), value);
});
return result;
}
function getTitle() {
var title = ecModel.get('title');
if (title && title.length) {
title = title[0];
}
return title && title.text;
}
function getSeriesTypeName(type) {
var typeNames = ecModel.getLocaleModel().get(['series', 'typeNames']);
return typeNames[type] || typeNames.chart;
}
}

View File

@ -0,0 +1,44 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
* AUTO-GENERATED FILE. DO NOT MODIFY.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
export {};

66
frontend/node_modules/echarts/lib/visual/decal.js generated vendored Normal file
View File

@ -0,0 +1,66 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
* AUTO-GENERATED FILE. DO NOT MODIFY.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import { createOrUpdatePatternFromDecal } from '../util/decal.js';
export default function decalVisual(ecModel, api) {
ecModel.eachRawSeries(function (seriesModel) {
if (ecModel.isSeriesFiltered(seriesModel)) {
return;
}
var data = seriesModel.getData();
if (data.hasItemVisual()) {
data.each(function (idx) {
var decal = data.getItemVisual(idx, 'decal');
if (decal) {
var itemStyle = data.ensureUniqueItemVisual(idx, 'style');
itemStyle.decal = createOrUpdatePatternFromDecal(decal, api);
}
});
}
var decal = data.getVisual('decal');
if (decal) {
var style = data.getVisual('style');
style.decal = createOrUpdatePatternFromDecal(decal, api);
}
});
}

100
frontend/node_modules/echarts/lib/visual/helper.js generated vendored Normal file
View File

@ -0,0 +1,100 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
* AUTO-GENERATED FILE. DO NOT MODIFY.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
export function getItemVisualFromData(data, dataIndex, key) {
switch (key) {
case 'color':
var style = data.getItemVisual(dataIndex, 'style');
return style[data.getVisual('drawType')];
case 'opacity':
return data.getItemVisual(dataIndex, 'style').opacity;
case 'symbol':
case 'symbolSize':
case 'liftZ':
return data.getItemVisual(dataIndex, key);
default:
if (process.env.NODE_ENV !== 'production') {
console.warn("Unknown visual type " + key);
}
}
}
export function getVisualFromData(data, key) {
switch (key) {
case 'color':
var style = data.getVisual('style');
return style[data.getVisual('drawType')];
case 'opacity':
return data.getVisual('style').opacity;
case 'symbol':
case 'symbolSize':
case 'liftZ':
return data.getVisual(key);
default:
if (process.env.NODE_ENV !== 'production') {
console.warn("Unknown visual type " + key);
}
}
}
export function setItemVisualFromData(data, dataIndex, key, value) {
switch (key) {
case 'color':
// Make sure not sharing style object.
var style = data.ensureUniqueItemVisual(dataIndex, 'style');
style[data.getVisual('drawType')] = value;
// Mark the color has been changed, not from palette anymore
data.setItemVisual(dataIndex, 'colorFromPalette', false);
break;
case 'opacity':
data.ensureUniqueItemVisual(dataIndex, 'style').opacity = value;
break;
case 'symbol':
case 'symbolSize':
case 'liftZ':
data.setItemVisual(dataIndex, key, value);
break;
default:
if (process.env.NODE_ENV !== 'production') {
console.warn("Unknown visual type " + key);
}
}
}

216
frontend/node_modules/echarts/lib/visual/style.js generated vendored Normal file
View File

@ -0,0 +1,216 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
* AUTO-GENERATED FILE. DO NOT MODIFY.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import { isFunction, extend, createHashMap } from 'zrender/lib/core/util.js';
import makeStyleMapper from '../model/mixin/makeStyleMapper.js';
import { ITEM_STYLE_KEY_MAP } from '../model/mixin/itemStyle.js';
import { LINE_STYLE_KEY_MAP } from '../model/mixin/lineStyle.js';
import Model from '../model/Model.js';
import { makeInner } from '../util/model.js';
var inner = makeInner();
var defaultStyleMappers = {
itemStyle: makeStyleMapper(ITEM_STYLE_KEY_MAP, true),
lineStyle: makeStyleMapper(LINE_STYLE_KEY_MAP, true)
};
var defaultColorKey = {
lineStyle: 'stroke',
itemStyle: 'fill'
};
function getStyleMapper(seriesModel, stylePath) {
var styleMapper = seriesModel.visualStyleMapper || defaultStyleMappers[stylePath];
if (!styleMapper) {
console.warn("Unknown style type '" + stylePath + "'.");
return defaultStyleMappers.itemStyle;
}
return styleMapper;
}
function getDefaultColorKey(seriesModel, stylePath) {
// return defaultColorKey[stylePath] ||
var colorKey = seriesModel.visualDrawType || defaultColorKey[stylePath];
if (!colorKey) {
console.warn("Unknown style type '" + stylePath + "'.");
return 'fill';
}
return colorKey;
}
var seriesStyleTask = {
createOnAllSeries: true,
performRawSeries: true,
reset: function (seriesModel, ecModel) {
var data = seriesModel.getData();
var stylePath = seriesModel.visualStyleAccessPath || 'itemStyle';
// Set in itemStyle
var styleModel = seriesModel.getModel(stylePath);
var getStyle = getStyleMapper(seriesModel, stylePath);
var globalStyle = getStyle(styleModel);
var decalOption = styleModel.getShallow('decal');
if (decalOption) {
data.setVisual('decal', decalOption);
decalOption.dirty = true;
}
// TODO
var colorKey = getDefaultColorKey(seriesModel, stylePath);
var color = globalStyle[colorKey];
// TODO style callback
var colorCallback = isFunction(color) ? color : null;
var hasAutoColor = globalStyle.fill === 'auto' || globalStyle.stroke === 'auto';
// Get from color palette by default.
if (!globalStyle[colorKey] || colorCallback || hasAutoColor) {
// Note: If some series has color specified (e.g., by itemStyle.color), we DO NOT
// make it effect palette. Because some scenarios users need to make some series
// transparent or as background, which should better not effect the palette.
var colorPalette = seriesModel.getColorFromPalette(
// TODO series count changed.
seriesModel.name, null, ecModel.getSeriesCount());
if (!globalStyle[colorKey]) {
globalStyle[colorKey] = colorPalette;
data.setVisual('colorFromPalette', true);
}
globalStyle.fill = globalStyle.fill === 'auto' || isFunction(globalStyle.fill) ? colorPalette : globalStyle.fill;
globalStyle.stroke = globalStyle.stroke === 'auto' || isFunction(globalStyle.stroke) ? colorPalette : globalStyle.stroke;
}
data.setVisual('style', globalStyle);
data.setVisual('drawType', colorKey);
// Only visible series has each data be visual encoded
if (!ecModel.isSeriesFiltered(seriesModel) && colorCallback) {
data.setVisual('colorFromPalette', false);
return {
dataEach: function (data, idx) {
var dataParams = seriesModel.getDataParams(idx);
var itemStyle = extend({}, globalStyle);
itemStyle[colorKey] = colorCallback(dataParams);
data.setItemVisual(idx, 'style', itemStyle);
}
};
}
}
};
var sharedModel = new Model();
var dataStyleTask = {
createOnAllSeries: true,
performRawSeries: true,
reset: function (seriesModel, ecModel) {
if (seriesModel.ignoreStyleOnData || ecModel.isSeriesFiltered(seriesModel)) {
return;
}
var data = seriesModel.getData();
var stylePath = seriesModel.visualStyleAccessPath || 'itemStyle';
// Set in itemStyle
var getStyle = getStyleMapper(seriesModel, stylePath);
var colorKey = data.getVisual('drawType');
return {
dataEach: data.hasItemOption ? function (data, idx) {
// Not use getItemModel for performance considuration
var rawItem = data.getRawDataItem(idx);
if (rawItem && rawItem[stylePath]) {
sharedModel.option = rawItem[stylePath];
var style = getStyle(sharedModel);
var existsStyle = data.ensureUniqueItemVisual(idx, 'style');
extend(existsStyle, style);
if (sharedModel.option.decal) {
data.setItemVisual(idx, 'decal', sharedModel.option.decal);
sharedModel.option.decal.dirty = true;
}
if (colorKey in style) {
data.setItemVisual(idx, 'colorFromPalette', false);
}
}
} : null
};
}
};
// Pick color from palette for the data which has not been set with color yet.
// Note: do not support stream rendering. No such cases yet.
var dataColorPaletteTask = {
performRawSeries: true,
overallReset: function (ecModel) {
// Each type of series uses one scope.
// Pie and funnel are using different scopes.
var paletteScopeGroupByType = createHashMap();
ecModel.eachSeries(function (seriesModel) {
var colorBy = seriesModel.getColorBy();
if (seriesModel.isColorBySeries()) {
return;
}
var key = seriesModel.type + '-' + colorBy;
var colorScope = paletteScopeGroupByType.get(key);
if (!colorScope) {
colorScope = {};
paletteScopeGroupByType.set(key, colorScope);
}
inner(seriesModel).scope = colorScope;
});
ecModel.eachSeries(function (seriesModel) {
if (seriesModel.isColorBySeries() || ecModel.isSeriesFiltered(seriesModel)) {
return;
}
var dataAll = seriesModel.getRawData();
var idxMap = {};
var data = seriesModel.getData();
var colorScope = inner(seriesModel).scope;
var stylePath = seriesModel.visualStyleAccessPath || 'itemStyle';
var colorKey = getDefaultColorKey(seriesModel, stylePath);
data.each(function (idx) {
var rawIdx = data.getRawIndex(idx);
idxMap[rawIdx] = idx;
});
// Iterate on data before filtered. To make sure color from palette can be
// Consistent when toggling legend.
dataAll.each(function (rawIdx) {
var idx = idxMap[rawIdx];
var fromPalette = data.getItemVisual(idx, 'colorFromPalette');
// Get color from palette for each data only when the color is inherited from series color, which is
// also picked from color palette. So following situation is not in the case:
// 1. series.itemStyle.color is set
// 2. color is encoded by visualMap
if (fromPalette) {
var itemStyle = data.ensureUniqueItemVisual(idx, 'style');
var name_1 = dataAll.getName(rawIdx) || rawIdx + '';
var dataCount = dataAll.count();
itemStyle[colorKey] = seriesModel.getColorFromPalette(name_1, colorScope, dataCount);
}
});
});
}
};
export { seriesStyleTask, dataStyleTask, dataColorPaletteTask };

124
frontend/node_modules/echarts/lib/visual/symbol.js generated vendored Normal file
View File

@ -0,0 +1,124 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
* AUTO-GENERATED FILE. DO NOT MODIFY.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import { extend, isFunction, keys } from 'zrender/lib/core/util.js';
var SYMBOL_PROPS_WITH_CB = ['symbol', 'symbolSize', 'symbolRotate', 'symbolOffset'];
var SYMBOL_PROPS = SYMBOL_PROPS_WITH_CB.concat(['symbolKeepAspect']);
// Encoding visual for all series include which is filtered for legend drawing
var seriesSymbolTask = {
createOnAllSeries: true,
// For legend.
performRawSeries: true,
reset: function (seriesModel, ecModel) {
var data = seriesModel.getData();
if (seriesModel.legendIcon) {
data.setVisual('legendIcon', seriesModel.legendIcon);
}
if (!seriesModel.hasSymbolVisual) {
return;
}
var symbolOptions = {};
var symbolOptionsCb = {};
var hasCallback = false;
for (var i = 0; i < SYMBOL_PROPS_WITH_CB.length; i++) {
var symbolPropName = SYMBOL_PROPS_WITH_CB[i];
var val = seriesModel.get(symbolPropName);
if (isFunction(val)) {
hasCallback = true;
symbolOptionsCb[symbolPropName] = val;
} else {
symbolOptions[symbolPropName] = val;
}
}
symbolOptions.symbol = symbolOptions.symbol || seriesModel.defaultSymbol;
data.setVisual(extend({
legendIcon: seriesModel.legendIcon || symbolOptions.symbol,
symbolKeepAspect: seriesModel.get('symbolKeepAspect')
}, symbolOptions));
// Only visible series has each data be visual encoded
if (ecModel.isSeriesFiltered(seriesModel)) {
return;
}
var symbolPropsCb = keys(symbolOptionsCb);
function dataEach(data, idx) {
var rawValue = seriesModel.getRawValue(idx);
var params = seriesModel.getDataParams(idx);
for (var i = 0; i < symbolPropsCb.length; i++) {
var symbolPropName = symbolPropsCb[i];
data.setItemVisual(idx, symbolPropName, symbolOptionsCb[symbolPropName](rawValue, params));
}
}
return {
dataEach: hasCallback ? dataEach : null
};
}
};
var dataSymbolTask = {
createOnAllSeries: true,
// For legend.
performRawSeries: true,
reset: function (seriesModel, ecModel) {
if (!seriesModel.hasSymbolVisual) {
return;
}
// Only visible series has each data be visual encoded
if (ecModel.isSeriesFiltered(seriesModel)) {
return;
}
var data = seriesModel.getData();
function dataEach(data, idx) {
var itemModel = data.getItemModel(idx);
for (var i = 0; i < SYMBOL_PROPS.length; i++) {
var symbolPropName = SYMBOL_PROPS[i];
var val = itemModel.getShallow(symbolPropName, true);
if (val != null) {
data.setItemVisual(idx, symbolPropName, val);
}
}
}
return {
dataEach: data.hasItemOption ? dataEach : null
};
}
};
export { seriesSymbolTask, dataSymbolTask };

View File

@ -0,0 +1,91 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
* AUTO-GENERATED FILE. DO NOT MODIFY.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
* @file Visual mapping.
*/
import * as zrUtil from 'zrender/lib/core/util.js';
var visualDefault = {
/**
* @public
*/
get: function (visualType, key, isCategory) {
var value = zrUtil.clone((defaultOption[visualType] || {})[key]);
return isCategory ? zrUtil.isArray(value) ? value[value.length - 1] : value : value;
}
};
var defaultOption = {
color: {
active: ['#006edd', '#e0ffff'],
inactive: ['rgba(0,0,0,0)']
},
colorHue: {
active: [0, 360],
inactive: [0, 0]
},
colorSaturation: {
active: [0.3, 1],
inactive: [0, 0]
},
colorLightness: {
active: [0.9, 0.5],
inactive: [0, 0]
},
colorAlpha: {
active: [0.3, 1],
inactive: [0, 0]
},
opacity: {
active: [0.3, 1],
inactive: [0, 0]
},
symbol: {
active: ['circle', 'roundRect', 'diamond'],
inactive: ['none']
},
symbolSize: {
active: [10, 50],
inactive: [0, 0]
}
};
export default visualDefault;

View File

@ -0,0 +1,202 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
* AUTO-GENERATED FILE. DO NOT MODIFY.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
* @file Visual solution, for consistent option specification.
*/
import * as zrUtil from 'zrender/lib/core/util.js';
import VisualMapping from './VisualMapping.js';
import { getItemVisualFromData, setItemVisualFromData } from './helper.js';
var each = zrUtil.each;
function hasKeys(obj) {
if (obj) {
for (var name_1 in obj) {
if (obj.hasOwnProperty(name_1)) {
return true;
}
}
}
}
export function createVisualMappings(option, stateList, supplementVisualOption) {
var visualMappings = {};
each(stateList, function (state) {
var mappings = visualMappings[state] = createMappings();
each(option[state], function (visualData, visualType) {
if (!VisualMapping.isValidType(visualType)) {
return;
}
var mappingOption = {
type: visualType,
visual: visualData
};
supplementVisualOption && supplementVisualOption(mappingOption, state);
mappings[visualType] = new VisualMapping(mappingOption);
// Prepare a alpha for opacity, for some case that opacity
// is not supported, such as rendering using gradient color.
if (visualType === 'opacity') {
mappingOption = zrUtil.clone(mappingOption);
mappingOption.type = 'colorAlpha';
mappings.__hidden.__alphaForOpacity = new VisualMapping(mappingOption);
}
});
});
return visualMappings;
function createMappings() {
var Creater = function () {};
// Make sure hidden fields will not be visited by
// object iteration (with hasOwnProperty checking).
Creater.prototype.__hidden = Creater.prototype;
var obj = new Creater();
return obj;
}
}
export function replaceVisualOption(thisOption, newOption, keys) {
// Visual attributes merge is not supported, otherwise it
// brings overcomplicated merge logic. See #2853. So if
// newOption has anyone of these keys, all of these keys
// will be reset. Otherwise, all keys remain.
var has;
zrUtil.each(keys, function (key) {
if (newOption.hasOwnProperty(key) && hasKeys(newOption[key])) {
has = true;
}
});
has && zrUtil.each(keys, function (key) {
if (newOption.hasOwnProperty(key) && hasKeys(newOption[key])) {
thisOption[key] = zrUtil.clone(newOption[key]);
} else {
delete thisOption[key];
}
});
}
/**
* @param stateList
* @param visualMappings
* @param list
* @param getValueState param: valueOrIndex, return: state.
* @param scope Scope for getValueState
* @param dimension Concrete dimension, if used.
*/
// ???! handle brush?
export function applyVisual(stateList, visualMappings, data, getValueState, scope, dimension) {
var visualTypesMap = {};
zrUtil.each(stateList, function (state) {
var visualTypes = VisualMapping.prepareVisualTypes(visualMappings[state]);
visualTypesMap[state] = visualTypes;
});
var dataIndex;
function getVisual(key) {
return getItemVisualFromData(data, dataIndex, key);
}
function setVisual(key, value) {
setItemVisualFromData(data, dataIndex, key, value);
}
if (dimension == null) {
data.each(eachItem);
} else {
data.each([dimension], eachItem);
}
function eachItem(valueOrIndex, index) {
dataIndex = dimension == null ? valueOrIndex // First argument is index
: index;
var rawDataItem = data.getRawDataItem(dataIndex);
// Consider performance
// @ts-ignore
if (rawDataItem && rawDataItem.visualMap === false) {
return;
}
var valueState = getValueState.call(scope, valueOrIndex);
var mappings = visualMappings[valueState];
var visualTypes = visualTypesMap[valueState];
for (var i = 0, len = visualTypes.length; i < len; i++) {
var type = visualTypes[i];
mappings[type] && mappings[type].applyVisual(valueOrIndex, getVisual, setVisual);
}
}
}
/**
* @param data
* @param stateList
* @param visualMappings <state, Object.<visualType, module:echarts/visual/VisualMapping>>
* @param getValueState param: valueOrIndex, return: state.
* @param dim dimension or dimension index.
*/
export function incrementalApplyVisual(stateList, visualMappings, getValueState, dim) {
var visualTypesMap = {};
zrUtil.each(stateList, function (state) {
var visualTypes = VisualMapping.prepareVisualTypes(visualMappings[state]);
visualTypesMap[state] = visualTypes;
});
return {
progress: function progress(params, data) {
var dimIndex;
if (dim != null) {
dimIndex = data.getDimensionIndex(dim);
}
function getVisual(key) {
return getItemVisualFromData(data, dataIndex, key);
}
function setVisual(key, value) {
setItemVisualFromData(data, dataIndex, key, value);
}
var dataIndex;
var store = data.getStore();
while ((dataIndex = params.next()) != null) {
var rawDataItem = data.getRawDataItem(dataIndex);
// Consider performance
// @ts-ignore
if (rawDataItem && rawDataItem.visualMap === false) {
continue;
}
var value = dim != null ? store.get(dimIndex, dataIndex) : dataIndex;
var valueState = getValueState(value);
var mappings = visualMappings[valueState];
var visualTypes = visualTypesMap[valueState];
for (var i = 0, len = visualTypes.length; i < len; i++) {
var type = visualTypes[i];
mappings[type] && mappings[type].applyVisual(value, getVisual, setVisual);
}
}
}
};
}