逐步完成前后端服务器
This commit is contained in:
144
frontend/node_modules/echarts/lib/util/ECEventProcessor.js
generated
vendored
Normal file
144
frontend/node_modules/echarts/lib/util/ECEventProcessor.js
generated
vendored
Normal file
@ -0,0 +1,144 @@
|
||||
|
||||
/*
|
||||
* 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 { parseClassType } from './clazz.js';
|
||||
/**
|
||||
* Usage of query:
|
||||
* `chart.on('click', query, handler);`
|
||||
* The `query` can be:
|
||||
* + The component type query string, only `mainType` or `mainType.subType`,
|
||||
* like: 'xAxis', 'series', 'xAxis.category' or 'series.line'.
|
||||
* + The component query object, like:
|
||||
* `{seriesIndex: 2}`, `{seriesName: 'xx'}`, `{seriesId: 'some'}`,
|
||||
* `{xAxisIndex: 2}`, `{xAxisName: 'xx'}`, `{xAxisId: 'some'}`.
|
||||
* + The data query object, like:
|
||||
* `{dataIndex: 123}`, `{dataType: 'link'}`, `{name: 'some'}`.
|
||||
* + The other query object (cmponent customized query), like:
|
||||
* `{element: 'some'}` (only available in custom series).
|
||||
*
|
||||
* Caveat: If a prop in the `query` object is `null/undefined`, it is the
|
||||
* same as there is no such prop in the `query` object.
|
||||
*/
|
||||
var ECEventProcessor = /** @class */function () {
|
||||
function ECEventProcessor() {}
|
||||
ECEventProcessor.prototype.normalizeQuery = function (query) {
|
||||
var cptQuery = {};
|
||||
var dataQuery = {};
|
||||
var otherQuery = {};
|
||||
// `query` is `mainType` or `mainType.subType` of component.
|
||||
if (zrUtil.isString(query)) {
|
||||
var condCptType = parseClassType(query);
|
||||
// `.main` and `.sub` may be ''.
|
||||
cptQuery.mainType = condCptType.main || null;
|
||||
cptQuery.subType = condCptType.sub || null;
|
||||
}
|
||||
// `query` is an object, convert to {mainType, index, name, id}.
|
||||
else {
|
||||
// `xxxIndex`, `xxxName`, `xxxId`, `name`, `dataIndex`, `dataType` is reserved,
|
||||
// can not be used in `compomentModel.filterForExposedEvent`.
|
||||
var suffixes_1 = ['Index', 'Name', 'Id'];
|
||||
var dataKeys_1 = {
|
||||
name: 1,
|
||||
dataIndex: 1,
|
||||
dataType: 1
|
||||
};
|
||||
zrUtil.each(query, function (val, key) {
|
||||
var reserved = false;
|
||||
for (var i = 0; i < suffixes_1.length; i++) {
|
||||
var propSuffix = suffixes_1[i];
|
||||
var suffixPos = key.lastIndexOf(propSuffix);
|
||||
if (suffixPos > 0 && suffixPos === key.length - propSuffix.length) {
|
||||
var mainType = key.slice(0, suffixPos);
|
||||
// Consider `dataIndex`.
|
||||
if (mainType !== 'data') {
|
||||
cptQuery.mainType = mainType;
|
||||
cptQuery[propSuffix.toLowerCase()] = val;
|
||||
reserved = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (dataKeys_1.hasOwnProperty(key)) {
|
||||
dataQuery[key] = val;
|
||||
reserved = true;
|
||||
}
|
||||
if (!reserved) {
|
||||
otherQuery[key] = val;
|
||||
}
|
||||
});
|
||||
}
|
||||
return {
|
||||
cptQuery: cptQuery,
|
||||
dataQuery: dataQuery,
|
||||
otherQuery: otherQuery
|
||||
};
|
||||
};
|
||||
ECEventProcessor.prototype.filter = function (eventType, query) {
|
||||
// They should be assigned before each trigger call.
|
||||
var eventInfo = this.eventInfo;
|
||||
if (!eventInfo) {
|
||||
return true;
|
||||
}
|
||||
var targetEl = eventInfo.targetEl;
|
||||
var packedEvent = eventInfo.packedEvent;
|
||||
var model = eventInfo.model;
|
||||
var view = eventInfo.view;
|
||||
// For event like 'globalout'.
|
||||
if (!model || !view) {
|
||||
return true;
|
||||
}
|
||||
var cptQuery = query.cptQuery;
|
||||
var dataQuery = query.dataQuery;
|
||||
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));
|
||||
function check(query, host, prop, propOnHost) {
|
||||
return query[prop] == null || host[propOnHost || prop] === query[prop];
|
||||
}
|
||||
};
|
||||
ECEventProcessor.prototype.afterTrigger = function () {
|
||||
// Make sure the eventInfo won't be used in next trigger.
|
||||
this.eventInfo = null;
|
||||
};
|
||||
return ECEventProcessor;
|
||||
}();
|
||||
export { ECEventProcessor };
|
||||
;
|
255
frontend/node_modules/echarts/lib/util/KDTree.js
generated
vendored
Normal file
255
frontend/node_modules/echarts/lib/util/KDTree.js
generated
vendored
Normal file
@ -0,0 +1,255 @@
|
||||
|
||||
/*
|
||||
* 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 quickSelect from './quickSelect.js';
|
||||
var KDTreeNode = /** @class */function () {
|
||||
function KDTreeNode(axis, data) {
|
||||
this.axis = axis;
|
||||
this.data = data;
|
||||
}
|
||||
return KDTreeNode;
|
||||
}();
|
||||
/**
|
||||
* @constructor
|
||||
* @alias module:echarts/data/KDTree
|
||||
* @param {Array} points List of points.
|
||||
* each point needs an array property to represent the actual data
|
||||
* @param {Number} [dimension]
|
||||
* Point dimension.
|
||||
* Default will use the first point's length as dimension.
|
||||
*/
|
||||
var KDTree = /** @class */function () {
|
||||
function KDTree(points, dimension) {
|
||||
// Use one stack to avoid allocation
|
||||
// each time searching the nearest point
|
||||
this._stack = [];
|
||||
// Again avoid allocating a new array
|
||||
// each time searching nearest N points
|
||||
this._nearstNList = [];
|
||||
if (!points.length) {
|
||||
return;
|
||||
}
|
||||
if (!dimension) {
|
||||
dimension = points[0].array.length;
|
||||
}
|
||||
this.dimension = dimension;
|
||||
this.root = this._buildTree(points, 0, points.length - 1, 0);
|
||||
}
|
||||
/**
|
||||
* Recursively build the tree.
|
||||
*/
|
||||
KDTree.prototype._buildTree = function (points, left, right, axis) {
|
||||
if (right < left) {
|
||||
return null;
|
||||
}
|
||||
var medianIndex = Math.floor((left + right) / 2);
|
||||
medianIndex = quickSelect(points, left, right, medianIndex, function (a, b) {
|
||||
return a.array[axis] - b.array[axis];
|
||||
});
|
||||
var median = points[medianIndex];
|
||||
var node = new KDTreeNode(axis, median);
|
||||
axis = (axis + 1) % this.dimension;
|
||||
if (right > left) {
|
||||
node.left = this._buildTree(points, left, medianIndex - 1, axis);
|
||||
node.right = this._buildTree(points, medianIndex + 1, right, axis);
|
||||
}
|
||||
return node;
|
||||
};
|
||||
;
|
||||
/**
|
||||
* Find nearest point
|
||||
* @param target Target point
|
||||
* @param squaredDistance Squared distance function
|
||||
* @return Nearest point
|
||||
*/
|
||||
KDTree.prototype.nearest = function (target, squaredDistance) {
|
||||
var curr = this.root;
|
||||
var stack = this._stack;
|
||||
var idx = 0;
|
||||
var minDist = Infinity;
|
||||
var nearestNode = null;
|
||||
if (curr.data !== target) {
|
||||
minDist = squaredDistance(curr.data, target);
|
||||
nearestNode = curr;
|
||||
}
|
||||
if (target.array[curr.axis] < curr.data.array[curr.axis]) {
|
||||
// Left first
|
||||
curr.right && (stack[idx++] = curr.right);
|
||||
curr.left && (stack[idx++] = curr.left);
|
||||
} else {
|
||||
// Right first
|
||||
curr.left && (stack[idx++] = curr.left);
|
||||
curr.right && (stack[idx++] = curr.right);
|
||||
}
|
||||
while (idx--) {
|
||||
curr = stack[idx];
|
||||
var currDist = target.array[curr.axis] - curr.data.array[curr.axis];
|
||||
var isLeft = currDist < 0;
|
||||
var needsCheckOtherSide = false;
|
||||
currDist = currDist * currDist;
|
||||
// Intersecting right hyperplane with minDist hypersphere
|
||||
if (currDist < minDist) {
|
||||
currDist = squaredDistance(curr.data, target);
|
||||
if (currDist < minDist && curr.data !== target) {
|
||||
minDist = currDist;
|
||||
nearestNode = curr;
|
||||
}
|
||||
needsCheckOtherSide = true;
|
||||
}
|
||||
if (isLeft) {
|
||||
if (needsCheckOtherSide) {
|
||||
curr.right && (stack[idx++] = curr.right);
|
||||
}
|
||||
// Search in the left area
|
||||
curr.left && (stack[idx++] = curr.left);
|
||||
} else {
|
||||
if (needsCheckOtherSide) {
|
||||
curr.left && (stack[idx++] = curr.left);
|
||||
}
|
||||
// Search the right area
|
||||
curr.right && (stack[idx++] = curr.right);
|
||||
}
|
||||
}
|
||||
return nearestNode.data;
|
||||
};
|
||||
;
|
||||
KDTree.prototype._addNearest = function (found, dist, node) {
|
||||
var nearestNList = this._nearstNList;
|
||||
var i = found - 1;
|
||||
// Insert to the right position
|
||||
// Sort from small to large
|
||||
for (; i > 0; i--) {
|
||||
if (dist >= nearestNList[i - 1].dist) {
|
||||
break;
|
||||
} else {
|
||||
nearestNList[i].dist = nearestNList[i - 1].dist;
|
||||
nearestNList[i].node = nearestNList[i - 1].node;
|
||||
}
|
||||
}
|
||||
nearestNList[i].dist = dist;
|
||||
nearestNList[i].node = node;
|
||||
};
|
||||
;
|
||||
/**
|
||||
* Find nearest N points
|
||||
* @param target Target point
|
||||
* @param N
|
||||
* @param squaredDistance Squared distance function
|
||||
* @param output Output nearest N points
|
||||
*/
|
||||
KDTree.prototype.nearestN = function (target, N, squaredDistance, output) {
|
||||
if (N <= 0) {
|
||||
output.length = 0;
|
||||
return output;
|
||||
}
|
||||
var curr = this.root;
|
||||
var stack = this._stack;
|
||||
var idx = 0;
|
||||
var nearestNList = this._nearstNList;
|
||||
for (var i = 0; i < N; i++) {
|
||||
// Allocate
|
||||
if (!nearestNList[i]) {
|
||||
nearestNList[i] = {
|
||||
dist: 0,
|
||||
node: null
|
||||
};
|
||||
}
|
||||
nearestNList[i].dist = 0;
|
||||
nearestNList[i].node = null;
|
||||
}
|
||||
var currDist = squaredDistance(curr.data, target);
|
||||
var found = 0;
|
||||
if (curr.data !== target) {
|
||||
found++;
|
||||
this._addNearest(found, currDist, curr);
|
||||
}
|
||||
if (target.array[curr.axis] < curr.data.array[curr.axis]) {
|
||||
// Left first
|
||||
curr.right && (stack[idx++] = curr.right);
|
||||
curr.left && (stack[idx++] = curr.left);
|
||||
} else {
|
||||
// Right first
|
||||
curr.left && (stack[idx++] = curr.left);
|
||||
curr.right && (stack[idx++] = curr.right);
|
||||
}
|
||||
while (idx--) {
|
||||
curr = stack[idx];
|
||||
var currDist_1 = target.array[curr.axis] - curr.data.array[curr.axis];
|
||||
var isLeft = currDist_1 < 0;
|
||||
var needsCheckOtherSide = false;
|
||||
currDist_1 = currDist_1 * currDist_1;
|
||||
// Intersecting right hyperplane with minDist hypersphere
|
||||
if (found < N || currDist_1 < nearestNList[found - 1].dist) {
|
||||
currDist_1 = squaredDistance(curr.data, target);
|
||||
if ((found < N || currDist_1 < nearestNList[found - 1].dist) && curr.data !== target) {
|
||||
if (found < N) {
|
||||
found++;
|
||||
}
|
||||
this._addNearest(found, currDist_1, curr);
|
||||
}
|
||||
needsCheckOtherSide = true;
|
||||
}
|
||||
if (isLeft) {
|
||||
if (needsCheckOtherSide) {
|
||||
curr.right && (stack[idx++] = curr.right);
|
||||
}
|
||||
// Search in the left area
|
||||
curr.left && (stack[idx++] = curr.left);
|
||||
} else {
|
||||
if (needsCheckOtherSide) {
|
||||
curr.left && (stack[idx++] = curr.left);
|
||||
}
|
||||
// Search the right area
|
||||
curr.right && (stack[idx++] = curr.right);
|
||||
}
|
||||
}
|
||||
// Copy to output
|
||||
for (var i = 0; i < found; i++) {
|
||||
output[i] = nearestNList[i].node.data;
|
||||
}
|
||||
output.length = found;
|
||||
return output;
|
||||
};
|
||||
return KDTree;
|
||||
}();
|
||||
export default KDTree;
|
120
frontend/node_modules/echarts/lib/util/animation.js
generated
vendored
Normal file
120
frontend/node_modules/echarts/lib/util/animation.js
generated
vendored
Normal file
@ -0,0 +1,120 @@
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
/**
|
||||
* Animate multiple elements with a single done-callback.
|
||||
*
|
||||
* @example
|
||||
* animation
|
||||
* .createWrap()
|
||||
* .add(el1, {x: 10, y: 10})
|
||||
* .add(el2, {shape: {width: 500}, style: {fill: 'red'}}, 400)
|
||||
* .done(function () { // done })
|
||||
* .start('cubicOut');
|
||||
*/
|
||||
var AnimationWrap = /** @class */function () {
|
||||
function AnimationWrap() {
|
||||
this._storage = [];
|
||||
this._elExistsMap = {};
|
||||
}
|
||||
/**
|
||||
* Caution: a el can only be added once, otherwise 'done'
|
||||
* might not be called. This method checks this (by el.id),
|
||||
* suppresses adding and returns false when existing el found.
|
||||
*
|
||||
* @return Whether adding succeeded.
|
||||
*/
|
||||
AnimationWrap.prototype.add = function (el, target, duration, delay, easing) {
|
||||
if (this._elExistsMap[el.id]) {
|
||||
return false;
|
||||
}
|
||||
this._elExistsMap[el.id] = true;
|
||||
this._storage.push({
|
||||
el: el,
|
||||
target: target,
|
||||
duration: duration,
|
||||
delay: delay,
|
||||
easing: easing
|
||||
});
|
||||
return true;
|
||||
};
|
||||
/**
|
||||
* Only execute when animation done/aborted.
|
||||
*/
|
||||
AnimationWrap.prototype.finished = function (callback) {
|
||||
this._finishedCallback = callback;
|
||||
return this;
|
||||
};
|
||||
/**
|
||||
* Will stop exist animation firstly.
|
||||
*/
|
||||
AnimationWrap.prototype.start = function () {
|
||||
var _this = this;
|
||||
var count = this._storage.length;
|
||||
var checkTerminate = function () {
|
||||
count--;
|
||||
if (count <= 0) {
|
||||
// Guard.
|
||||
_this._storage.length = 0;
|
||||
_this._elExistsMap = {};
|
||||
_this._finishedCallback && _this._finishedCallback();
|
||||
}
|
||||
};
|
||||
for (var i = 0, len = this._storage.length; i < len; i++) {
|
||||
var item = this._storage[i];
|
||||
item.el.animateTo(item.target, {
|
||||
duration: item.duration,
|
||||
delay: item.delay,
|
||||
easing: item.easing,
|
||||
setToFinal: true,
|
||||
done: checkTerminate,
|
||||
aborted: checkTerminate
|
||||
});
|
||||
}
|
||||
return this;
|
||||
};
|
||||
return AnimationWrap;
|
||||
}();
|
||||
export function createWrap() {
|
||||
return new AnimationWrap();
|
||||
}
|
305
frontend/node_modules/echarts/lib/util/clazz.js
generated
vendored
Normal file
305
frontend/node_modules/echarts/lib/util/clazz.js
generated
vendored
Normal file
@ -0,0 +1,305 @@
|
||||
|
||||
/*
|
||||
* 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 { __extends } from "tslib";
|
||||
import * as zrUtil from 'zrender/lib/core/util.js';
|
||||
var TYPE_DELIMITER = '.';
|
||||
var IS_CONTAINER = '___EC__COMPONENT__CONTAINER___';
|
||||
var IS_EXTENDED_CLASS = '___EC__EXTENDED_CLASS___';
|
||||
/**
|
||||
* Notice, parseClassType('') should returns {main: '', sub: ''}
|
||||
* @public
|
||||
*/
|
||||
export function parseClassType(componentType) {
|
||||
var ret = {
|
||||
main: '',
|
||||
sub: ''
|
||||
};
|
||||
if (componentType) {
|
||||
var typeArr = componentType.split(TYPE_DELIMITER);
|
||||
ret.main = typeArr[0] || '';
|
||||
ret.sub = typeArr[1] || '';
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
function checkClassType(componentType) {
|
||||
zrUtil.assert(/^[a-zA-Z0-9_]+([.][a-zA-Z0-9_]+)?$/.test(componentType), 'componentType "' + componentType + '" illegal');
|
||||
}
|
||||
export function isExtendedClass(clz) {
|
||||
return !!(clz && clz[IS_EXTENDED_CLASS]);
|
||||
}
|
||||
/**
|
||||
* Implements `ExtendableConstructor` for `rootClz`.
|
||||
*
|
||||
* @usage
|
||||
* ```ts
|
||||
* class Xxx {}
|
||||
* type XxxConstructor = typeof Xxx & ExtendableConstructor
|
||||
* enableClassExtend(Xxx as XxxConstructor);
|
||||
* ```
|
||||
*/
|
||||
export function enableClassExtend(rootClz, mandatoryMethods) {
|
||||
rootClz.$constructor = rootClz; // FIXME: not necessary?
|
||||
rootClz.extend = function (proto) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
zrUtil.each(mandatoryMethods, function (method) {
|
||||
if (!proto[method]) {
|
||||
console.warn('Method `' + method + '` should be implemented' + (proto.type ? ' in ' + proto.type : '') + '.');
|
||||
}
|
||||
});
|
||||
}
|
||||
var superClass = this;
|
||||
var ExtendedClass;
|
||||
if (isESClass(superClass)) {
|
||||
ExtendedClass = /** @class */function (_super) {
|
||||
__extends(class_1, _super);
|
||||
function class_1() {
|
||||
return _super.apply(this, arguments) || this;
|
||||
}
|
||||
return class_1;
|
||||
}(superClass);
|
||||
} else {
|
||||
// For backward compat, we both support ts class inheritance and this
|
||||
// "extend" approach.
|
||||
// The constructor should keep the same behavior as ts class inheritance:
|
||||
// If this constructor/$constructor is not declared, auto invoke the super
|
||||
// constructor.
|
||||
// If this constructor/$constructor is declared, it is responsible for
|
||||
// calling the super constructor.
|
||||
ExtendedClass = function () {
|
||||
(proto.$constructor || superClass).apply(this, arguments);
|
||||
};
|
||||
zrUtil.inherits(ExtendedClass, this);
|
||||
}
|
||||
zrUtil.extend(ExtendedClass.prototype, proto);
|
||||
ExtendedClass[IS_EXTENDED_CLASS] = true;
|
||||
ExtendedClass.extend = this.extend;
|
||||
ExtendedClass.superCall = superCall;
|
||||
ExtendedClass.superApply = superApply;
|
||||
ExtendedClass.superClass = superClass;
|
||||
return ExtendedClass;
|
||||
};
|
||||
}
|
||||
function isESClass(fn) {
|
||||
return zrUtil.isFunction(fn) && /^class\s/.test(Function.prototype.toString.call(fn));
|
||||
}
|
||||
/**
|
||||
* A work around to both support ts extend and this extend mechanism.
|
||||
* on sub-class.
|
||||
* @usage
|
||||
* ```ts
|
||||
* class Component { ... }
|
||||
* classUtil.enableClassExtend(Component);
|
||||
* classUtil.enableClassManagement(Component, {registerWhenExtend: true});
|
||||
*
|
||||
* class Series extends Component { ... }
|
||||
* // Without calling `markExtend`, `registerWhenExtend` will not work.
|
||||
* Component.markExtend(Series);
|
||||
* ```
|
||||
*/
|
||||
export function mountExtend(SubClz, SupperClz) {
|
||||
SubClz.extend = SupperClz.extend;
|
||||
}
|
||||
// A random offset.
|
||||
var classBase = Math.round(Math.random() * 10);
|
||||
/**
|
||||
* Implements `CheckableConstructor` for `target`.
|
||||
* Can not use instanceof, consider different scope by
|
||||
* cross domain or es module import in ec extensions.
|
||||
* Mount a method "isInstance()" to Clz.
|
||||
*
|
||||
* @usage
|
||||
* ```ts
|
||||
* class Xxx {}
|
||||
* type XxxConstructor = typeof Xxx & CheckableConstructor;
|
||||
* enableClassCheck(Xxx as XxxConstructor)
|
||||
* ```
|
||||
*/
|
||||
export function enableClassCheck(target) {
|
||||
var classAttr = ['__\0is_clz', classBase++].join('_');
|
||||
target.prototype[classAttr] = true;
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
zrUtil.assert(!target.isInstance, 'The method "is" can not be defined.');
|
||||
}
|
||||
target.isInstance = function (obj) {
|
||||
return !!(obj && obj[classAttr]);
|
||||
};
|
||||
}
|
||||
// superCall should have class info, which can not be fetched from 'this'.
|
||||
// Consider this case:
|
||||
// class A has method f,
|
||||
// class B inherits class A, overrides method f, f call superApply('f'),
|
||||
// class C inherits class B, does not override method f,
|
||||
// then when method of class C is called, dead loop occurred.
|
||||
function superCall(context, methodName) {
|
||||
var args = [];
|
||||
for (var _i = 2; _i < arguments.length; _i++) {
|
||||
args[_i - 2] = arguments[_i];
|
||||
}
|
||||
return this.superClass.prototype[methodName].apply(context, args);
|
||||
}
|
||||
function superApply(context, methodName, args) {
|
||||
return this.superClass.prototype[methodName].apply(context, args);
|
||||
}
|
||||
/**
|
||||
* Implements `ClassManager` for `target`
|
||||
*
|
||||
* @usage
|
||||
* ```ts
|
||||
* class Xxx {}
|
||||
* type XxxConstructor = typeof Xxx & ClassManager
|
||||
* enableClassManagement(Xxx as XxxConstructor);
|
||||
* ```
|
||||
*/
|
||||
export function enableClassManagement(target) {
|
||||
/**
|
||||
* Component model classes
|
||||
* key: componentType,
|
||||
* value:
|
||||
* componentClass, when componentType is 'a'
|
||||
* or Object.<subKey, componentClass>, when componentType is 'a.b'
|
||||
*/
|
||||
var storage = {};
|
||||
target.registerClass = function (clz) {
|
||||
// `type` should not be a "instance member".
|
||||
// If using TS class, should better declared as `static type = 'series.pie'`.
|
||||
// otherwise users have to mount `type` on prototype manually.
|
||||
// For backward compat and enable instance visit type via `this.type`,
|
||||
// we still support fetch `type` from prototype.
|
||||
var componentFullType = clz.type || clz.prototype.type;
|
||||
if (componentFullType) {
|
||||
checkClassType(componentFullType);
|
||||
// If only static type declared, we assign it to prototype mandatorily.
|
||||
clz.prototype.type = componentFullType;
|
||||
var componentTypeInfo = parseClassType(componentFullType);
|
||||
if (!componentTypeInfo.sub) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (storage[componentTypeInfo.main]) {
|
||||
console.warn(componentTypeInfo.main + ' exists.');
|
||||
}
|
||||
}
|
||||
storage[componentTypeInfo.main] = clz;
|
||||
} else if (componentTypeInfo.sub !== IS_CONTAINER) {
|
||||
var container = makeContainer(componentTypeInfo);
|
||||
container[componentTypeInfo.sub] = clz;
|
||||
}
|
||||
}
|
||||
return clz;
|
||||
};
|
||||
target.getClass = function (mainType, subType, throwWhenNotFound) {
|
||||
var clz = storage[mainType];
|
||||
if (clz && clz[IS_CONTAINER]) {
|
||||
clz = subType ? clz[subType] : null;
|
||||
}
|
||||
if (throwWhenNotFound && !clz) {
|
||||
throw new Error(!subType ? mainType + '.' + 'type should be specified.' : 'Component ' + mainType + '.' + (subType || '') + ' is used but not imported.');
|
||||
}
|
||||
return clz;
|
||||
};
|
||||
target.getClassesByMainType = function (componentType) {
|
||||
var componentTypeInfo = parseClassType(componentType);
|
||||
var result = [];
|
||||
var obj = storage[componentTypeInfo.main];
|
||||
if (obj && obj[IS_CONTAINER]) {
|
||||
zrUtil.each(obj, function (o, type) {
|
||||
type !== IS_CONTAINER && result.push(o);
|
||||
});
|
||||
} else {
|
||||
result.push(obj);
|
||||
}
|
||||
return result;
|
||||
};
|
||||
target.hasClass = function (componentType) {
|
||||
// Just consider componentType.main.
|
||||
var componentTypeInfo = parseClassType(componentType);
|
||||
return !!storage[componentTypeInfo.main];
|
||||
};
|
||||
/**
|
||||
* @return Like ['aa', 'bb'], but can not be ['aa.xx']
|
||||
*/
|
||||
target.getAllClassMainTypes = function () {
|
||||
var types = [];
|
||||
zrUtil.each(storage, function (obj, type) {
|
||||
types.push(type);
|
||||
});
|
||||
return types;
|
||||
};
|
||||
/**
|
||||
* If a main type is container and has sub types
|
||||
*/
|
||||
target.hasSubTypes = function (componentType) {
|
||||
var componentTypeInfo = parseClassType(componentType);
|
||||
var obj = storage[componentTypeInfo.main];
|
||||
return obj && obj[IS_CONTAINER];
|
||||
};
|
||||
function makeContainer(componentTypeInfo) {
|
||||
var container = storage[componentTypeInfo.main];
|
||||
if (!container || !container[IS_CONTAINER]) {
|
||||
container = storage[componentTypeInfo.main] = {};
|
||||
container[IS_CONTAINER] = true;
|
||||
}
|
||||
return container;
|
||||
}
|
||||
}
|
||||
// /**
|
||||
// * @param {string|Array.<string>} properties
|
||||
// */
|
||||
// export function setReadOnly(obj, properties) {
|
||||
// FIXME It seems broken in IE8 simulation of IE11
|
||||
// if (!zrUtil.isArray(properties)) {
|
||||
// properties = properties != null ? [properties] : [];
|
||||
// }
|
||||
// zrUtil.each(properties, function (prop) {
|
||||
// let value = obj[prop];
|
||||
// Object.defineProperty
|
||||
// && Object.defineProperty(obj, prop, {
|
||||
// value: value, writable: false
|
||||
// });
|
||||
// zrUtil.isArray(obj[prop])
|
||||
// && Object.freeze
|
||||
// && Object.freeze(obj[prop]);
|
||||
// });
|
||||
// }
|
186
frontend/node_modules/echarts/lib/util/component.js
generated
vendored
Normal file
186
frontend/node_modules/echarts/lib/util/component.js
generated
vendored
Normal file
@ -0,0 +1,186 @@
|
||||
|
||||
/*
|
||||
* 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 { parseClassType } from './clazz.js';
|
||||
import { makePrintable } from './log.js';
|
||||
// A random offset
|
||||
var base = Math.round(Math.random() * 10);
|
||||
/**
|
||||
* @public
|
||||
* @param {string} type
|
||||
* @return {string}
|
||||
*/
|
||||
export function getUID(type) {
|
||||
// Considering the case of crossing js context,
|
||||
// use Math.random to make id as unique as possible.
|
||||
return [type || '', base++].join('_');
|
||||
}
|
||||
/**
|
||||
* Implements `SubTypeDefaulterManager` for `target`.
|
||||
*/
|
||||
export function enableSubTypeDefaulter(target) {
|
||||
var subTypeDefaulters = {};
|
||||
target.registerSubTypeDefaulter = function (componentType, defaulter) {
|
||||
var componentTypeInfo = parseClassType(componentType);
|
||||
subTypeDefaulters[componentTypeInfo.main] = defaulter;
|
||||
};
|
||||
target.determineSubType = function (componentType, option) {
|
||||
var type = option.type;
|
||||
if (!type) {
|
||||
var componentTypeMain = parseClassType(componentType).main;
|
||||
if (target.hasSubTypes(componentType) && subTypeDefaulters[componentTypeMain]) {
|
||||
type = subTypeDefaulters[componentTypeMain](option);
|
||||
}
|
||||
}
|
||||
return type;
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Implements `TopologicalTravelable<any>` for `entity`.
|
||||
*
|
||||
* Topological travel on Activity Network (Activity On Vertices).
|
||||
* Dependencies is defined in Model.prototype.dependencies, like ['xAxis', 'yAxis'].
|
||||
* If 'xAxis' or 'yAxis' is absent in componentTypeList, just ignore it in topology.
|
||||
* If there is circular dependencey, Error will be thrown.
|
||||
*/
|
||||
export function enableTopologicalTravel(entity, dependencyGetter) {
|
||||
/**
|
||||
* @param targetNameList Target Component type list.
|
||||
* Can be ['aa', 'bb', 'aa.xx']
|
||||
* @param fullNameList By which we can build dependency graph.
|
||||
* @param callback Params: componentType, dependencies.
|
||||
* @param context Scope of callback.
|
||||
*/
|
||||
entity.topologicalTravel = function (targetNameList, fullNameList, callback, context) {
|
||||
if (!targetNameList.length) {
|
||||
return;
|
||||
}
|
||||
var result = makeDepndencyGraph(fullNameList);
|
||||
var graph = result.graph;
|
||||
var noEntryList = result.noEntryList;
|
||||
var targetNameSet = {};
|
||||
zrUtil.each(targetNameList, function (name) {
|
||||
targetNameSet[name] = true;
|
||||
});
|
||||
while (noEntryList.length) {
|
||||
var currComponentType = noEntryList.pop();
|
||||
var currVertex = graph[currComponentType];
|
||||
var isInTargetNameSet = !!targetNameSet[currComponentType];
|
||||
if (isInTargetNameSet) {
|
||||
callback.call(context, currComponentType, currVertex.originalDeps.slice());
|
||||
delete targetNameSet[currComponentType];
|
||||
}
|
||||
zrUtil.each(currVertex.successor, isInTargetNameSet ? removeEdgeAndAdd : removeEdge);
|
||||
}
|
||||
zrUtil.each(targetNameSet, function () {
|
||||
var errMsg = '';
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
errMsg = makePrintable('Circular dependency may exists: ', targetNameSet, targetNameList, fullNameList);
|
||||
}
|
||||
throw new Error(errMsg);
|
||||
});
|
||||
function removeEdge(succComponentType) {
|
||||
graph[succComponentType].entryCount--;
|
||||
if (graph[succComponentType].entryCount === 0) {
|
||||
noEntryList.push(succComponentType);
|
||||
}
|
||||
}
|
||||
// Consider this case: legend depends on series, and we call
|
||||
// chart.setOption({series: [...]}), where only series is in option.
|
||||
// If we do not have 'removeEdgeAndAdd', legendModel.mergeOption will
|
||||
// not be called, but only sereis.mergeOption is called. Thus legend
|
||||
// have no chance to update its local record about series (like which
|
||||
// name of series is available in legend).
|
||||
function removeEdgeAndAdd(succComponentType) {
|
||||
targetNameSet[succComponentType] = true;
|
||||
removeEdge(succComponentType);
|
||||
}
|
||||
};
|
||||
function makeDepndencyGraph(fullNameList) {
|
||||
var graph = {};
|
||||
var noEntryList = [];
|
||||
zrUtil.each(fullNameList, function (name) {
|
||||
var thisItem = createDependencyGraphItem(graph, name);
|
||||
var originalDeps = thisItem.originalDeps = dependencyGetter(name);
|
||||
var availableDeps = getAvailableDependencies(originalDeps, fullNameList);
|
||||
thisItem.entryCount = availableDeps.length;
|
||||
if (thisItem.entryCount === 0) {
|
||||
noEntryList.push(name);
|
||||
}
|
||||
zrUtil.each(availableDeps, function (dependentName) {
|
||||
if (zrUtil.indexOf(thisItem.predecessor, dependentName) < 0) {
|
||||
thisItem.predecessor.push(dependentName);
|
||||
}
|
||||
var thatItem = createDependencyGraphItem(graph, dependentName);
|
||||
if (zrUtil.indexOf(thatItem.successor, dependentName) < 0) {
|
||||
thatItem.successor.push(name);
|
||||
}
|
||||
});
|
||||
});
|
||||
return {
|
||||
graph: graph,
|
||||
noEntryList: noEntryList
|
||||
};
|
||||
}
|
||||
function createDependencyGraphItem(graph, name) {
|
||||
if (!graph[name]) {
|
||||
graph[name] = {
|
||||
predecessor: [],
|
||||
successor: []
|
||||
};
|
||||
}
|
||||
return graph[name];
|
||||
}
|
||||
function getAvailableDependencies(originalDeps, fullNameList) {
|
||||
var availableDeps = [];
|
||||
zrUtil.each(originalDeps, function (dep) {
|
||||
zrUtil.indexOf(fullNameList, dep) >= 0 && availableDeps.push(dep);
|
||||
});
|
||||
return availableDeps;
|
||||
}
|
||||
}
|
||||
export function inheritDefaultOption(superOption, subOption) {
|
||||
// See also `model/Component.ts#getDefaultOption`
|
||||
return zrUtil.merge(zrUtil.merge({}, superOption, true), subOption, true);
|
||||
}
|
257
frontend/node_modules/echarts/lib/util/conditionalExpression.js
generated
vendored
Normal file
257
frontend/node_modules/echarts/lib/util/conditionalExpression.js
generated
vendored
Normal file
@ -0,0 +1,257 @@
|
||||
|
||||
/*
|
||||
* 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 { keys, isArray, map, isObject, isString, isRegExp, isArrayLike, hasOwn, isNumber } from 'zrender/lib/core/util.js';
|
||||
import { throwError, makePrintable } from './log.js';
|
||||
import { getRawValueParser, createFilterComparator } from '../data/helper/dataValueHelper.js';
|
||||
;
|
||||
var RELATIONAL_EXPRESSION_OP_ALIAS_MAP = {
|
||||
value: 'eq',
|
||||
// PENDING: not good for literal semantic?
|
||||
'<': 'lt',
|
||||
'<=': 'lte',
|
||||
'>': 'gt',
|
||||
'>=': 'gte',
|
||||
'=': 'eq',
|
||||
'!=': 'ne',
|
||||
'<>': 'ne'
|
||||
// Might be misleading for sake of the difference between '==' and '===',
|
||||
// so don't support them.
|
||||
// '==': 'eq',
|
||||
// '===': 'seq',
|
||||
// '!==': 'sne'
|
||||
// PENDING: Whether support some common alias "ge", "le", "neq"?
|
||||
// ge: 'gte',
|
||||
// le: 'lte',
|
||||
// neq: 'ne',
|
||||
};
|
||||
// type RelationalExpressionOpEvaluate = (tarVal: unknown, condVal: unknown) => boolean;
|
||||
var RegExpEvaluator = /** @class */function () {
|
||||
function RegExpEvaluator(rVal) {
|
||||
// Support condVal: RegExp | string
|
||||
var condValue = this._condVal = isString(rVal) ? new RegExp(rVal) : isRegExp(rVal) ? rVal : null;
|
||||
if (condValue == null) {
|
||||
var errMsg = '';
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
errMsg = makePrintable('Illegal regexp', rVal, 'in');
|
||||
}
|
||||
throwError(errMsg);
|
||||
}
|
||||
}
|
||||
RegExpEvaluator.prototype.evaluate = function (lVal) {
|
||||
var type = typeof lVal;
|
||||
return isString(type) ? this._condVal.test(lVal) : isNumber(type) ? this._condVal.test(lVal + '') : false;
|
||||
};
|
||||
return RegExpEvaluator;
|
||||
}();
|
||||
var ConstConditionInternal = /** @class */function () {
|
||||
function ConstConditionInternal() {}
|
||||
ConstConditionInternal.prototype.evaluate = function () {
|
||||
return this.value;
|
||||
};
|
||||
return ConstConditionInternal;
|
||||
}();
|
||||
var AndConditionInternal = /** @class */function () {
|
||||
function AndConditionInternal() {}
|
||||
AndConditionInternal.prototype.evaluate = function () {
|
||||
var children = this.children;
|
||||
for (var i = 0; i < children.length; i++) {
|
||||
if (!children[i].evaluate()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
||||
return AndConditionInternal;
|
||||
}();
|
||||
var OrConditionInternal = /** @class */function () {
|
||||
function OrConditionInternal() {}
|
||||
OrConditionInternal.prototype.evaluate = function () {
|
||||
var children = this.children;
|
||||
for (var i = 0; i < children.length; i++) {
|
||||
if (children[i].evaluate()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
return OrConditionInternal;
|
||||
}();
|
||||
var NotConditionInternal = /** @class */function () {
|
||||
function NotConditionInternal() {}
|
||||
NotConditionInternal.prototype.evaluate = function () {
|
||||
return !this.child.evaluate();
|
||||
};
|
||||
return NotConditionInternal;
|
||||
}();
|
||||
var RelationalConditionInternal = /** @class */function () {
|
||||
function RelationalConditionInternal() {}
|
||||
RelationalConditionInternal.prototype.evaluate = function () {
|
||||
var needParse = !!this.valueParser;
|
||||
// Call getValue with no `this`.
|
||||
var getValue = this.getValue;
|
||||
var tarValRaw = getValue(this.valueGetterParam);
|
||||
var tarValParsed = needParse ? this.valueParser(tarValRaw) : null;
|
||||
// Relational cond follow "and" logic internally.
|
||||
for (var i = 0; i < this.subCondList.length; i++) {
|
||||
if (!this.subCondList[i].evaluate(needParse ? tarValParsed : tarValRaw)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
||||
return RelationalConditionInternal;
|
||||
}();
|
||||
function parseOption(exprOption, getters) {
|
||||
if (exprOption === true || exprOption === false) {
|
||||
var cond = new ConstConditionInternal();
|
||||
cond.value = exprOption;
|
||||
return cond;
|
||||
}
|
||||
var errMsg = '';
|
||||
if (!isObjectNotArray(exprOption)) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
errMsg = makePrintable('Illegal config. Expect a plain object but actually', exprOption);
|
||||
}
|
||||
throwError(errMsg);
|
||||
}
|
||||
if (exprOption.and) {
|
||||
return parseAndOrOption('and', exprOption, getters);
|
||||
} else if (exprOption.or) {
|
||||
return parseAndOrOption('or', exprOption, getters);
|
||||
} else if (exprOption.not) {
|
||||
return parseNotOption(exprOption, getters);
|
||||
}
|
||||
return parseRelationalOption(exprOption, getters);
|
||||
}
|
||||
function parseAndOrOption(op, exprOption, getters) {
|
||||
var subOptionArr = exprOption[op];
|
||||
var errMsg = '';
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
errMsg = makePrintable('"and"/"or" condition should only be `' + op + ': [...]` and must not be empty array.', 'Illegal condition:', exprOption);
|
||||
}
|
||||
if (!isArray(subOptionArr)) {
|
||||
throwError(errMsg);
|
||||
}
|
||||
if (!subOptionArr.length) {
|
||||
throwError(errMsg);
|
||||
}
|
||||
var cond = op === 'and' ? new AndConditionInternal() : new OrConditionInternal();
|
||||
cond.children = map(subOptionArr, function (subOption) {
|
||||
return parseOption(subOption, getters);
|
||||
});
|
||||
if (!cond.children.length) {
|
||||
throwError(errMsg);
|
||||
}
|
||||
return cond;
|
||||
}
|
||||
function parseNotOption(exprOption, getters) {
|
||||
var subOption = exprOption.not;
|
||||
var errMsg = '';
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
errMsg = makePrintable('"not" condition should only be `not: {}`.', 'Illegal condition:', exprOption);
|
||||
}
|
||||
if (!isObjectNotArray(subOption)) {
|
||||
throwError(errMsg);
|
||||
}
|
||||
var cond = new NotConditionInternal();
|
||||
cond.child = parseOption(subOption, getters);
|
||||
if (!cond.child) {
|
||||
throwError(errMsg);
|
||||
}
|
||||
return cond;
|
||||
}
|
||||
function parseRelationalOption(exprOption, getters) {
|
||||
var errMsg = '';
|
||||
var valueGetterParam = getters.prepareGetValue(exprOption);
|
||||
var subCondList = [];
|
||||
var exprKeys = keys(exprOption);
|
||||
var parserName = exprOption.parser;
|
||||
var valueParser = parserName ? getRawValueParser(parserName) : null;
|
||||
for (var i = 0; i < exprKeys.length; i++) {
|
||||
var keyRaw = exprKeys[i];
|
||||
if (keyRaw === 'parser' || getters.valueGetterAttrMap.get(keyRaw)) {
|
||||
continue;
|
||||
}
|
||||
var op = hasOwn(RELATIONAL_EXPRESSION_OP_ALIAS_MAP, keyRaw) ? RELATIONAL_EXPRESSION_OP_ALIAS_MAP[keyRaw] : keyRaw;
|
||||
var condValueRaw = exprOption[keyRaw];
|
||||
var condValueParsed = valueParser ? valueParser(condValueRaw) : condValueRaw;
|
||||
var evaluator = createFilterComparator(op, condValueParsed) || op === 'reg' && new RegExpEvaluator(condValueParsed);
|
||||
if (!evaluator) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
errMsg = makePrintable('Illegal relational operation: "' + keyRaw + '" in condition:', exprOption);
|
||||
}
|
||||
throwError(errMsg);
|
||||
}
|
||||
subCondList.push(evaluator);
|
||||
}
|
||||
if (!subCondList.length) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
errMsg = makePrintable('Relational condition must have at least one operator.', 'Illegal condition:', exprOption);
|
||||
}
|
||||
// No relational operator always disabled in case of dangers result.
|
||||
throwError(errMsg);
|
||||
}
|
||||
var cond = new RelationalConditionInternal();
|
||||
cond.valueGetterParam = valueGetterParam;
|
||||
cond.valueParser = valueParser;
|
||||
cond.getValue = getters.getValue;
|
||||
cond.subCondList = subCondList;
|
||||
return cond;
|
||||
}
|
||||
function isObjectNotArray(val) {
|
||||
return isObject(val) && !isArrayLike(val);
|
||||
}
|
||||
var ConditionalExpressionParsed = /** @class */function () {
|
||||
function ConditionalExpressionParsed(exprOption, getters) {
|
||||
this._cond = parseOption(exprOption, getters);
|
||||
}
|
||||
ConditionalExpressionParsed.prototype.evaluate = function () {
|
||||
return this._cond.evaluate();
|
||||
};
|
||||
return ConditionalExpressionParsed;
|
||||
}();
|
||||
;
|
||||
export function parseConditionalExpression(exprOption, getters) {
|
||||
return new ConditionalExpressionParsed(exprOption, getters);
|
||||
}
|
392
frontend/node_modules/echarts/lib/util/decal.js
generated
vendored
Normal file
392
frontend/node_modules/echarts/lib/util/decal.js
generated
vendored
Normal file
@ -0,0 +1,392 @@
|
||||
|
||||
/*
|
||||
* 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 WeakMap from 'zrender/lib/core/WeakMap.js';
|
||||
import LRU from 'zrender/lib/core/LRU.js';
|
||||
import { defaults, map, isArray, isString, isNumber } from 'zrender/lib/core/util.js';
|
||||
import { getLeastCommonMultiple } from './number.js';
|
||||
import { createSymbol } from './symbol.js';
|
||||
import { brushSingle } from 'zrender/lib/canvas/graphic.js';
|
||||
import { platformApi } from 'zrender/lib/core/platform.js';
|
||||
var decalMap = new WeakMap();
|
||||
var decalCache = new LRU(100);
|
||||
var decalKeys = ['symbol', 'symbolSize', 'symbolKeepAspect', 'color', 'backgroundColor', 'dashArrayX', 'dashArrayY', 'maxTileWidth', 'maxTileHeight'];
|
||||
/**
|
||||
* Create or update pattern image from decal options
|
||||
*
|
||||
* @param {InnerDecalObject | 'none'} decalObject decal options, 'none' if no decal
|
||||
* @return {Pattern} pattern with generated image, null if no decal
|
||||
*/
|
||||
export function createOrUpdatePatternFromDecal(decalObject, api) {
|
||||
if (decalObject === 'none') {
|
||||
return null;
|
||||
}
|
||||
var dpr = api.getDevicePixelRatio();
|
||||
var zr = api.getZr();
|
||||
var isSVG = zr.painter.type === 'svg';
|
||||
if (decalObject.dirty) {
|
||||
decalMap["delete"](decalObject);
|
||||
}
|
||||
var oldPattern = decalMap.get(decalObject);
|
||||
if (oldPattern) {
|
||||
return oldPattern;
|
||||
}
|
||||
var decalOpt = defaults(decalObject, {
|
||||
symbol: 'rect',
|
||||
symbolSize: 1,
|
||||
symbolKeepAspect: true,
|
||||
color: 'rgba(0, 0, 0, 0.2)',
|
||||
backgroundColor: null,
|
||||
dashArrayX: 5,
|
||||
dashArrayY: 5,
|
||||
rotation: 0,
|
||||
maxTileWidth: 512,
|
||||
maxTileHeight: 512
|
||||
});
|
||||
if (decalOpt.backgroundColor === 'none') {
|
||||
decalOpt.backgroundColor = null;
|
||||
}
|
||||
var pattern = {
|
||||
repeat: 'repeat'
|
||||
};
|
||||
setPatternnSource(pattern);
|
||||
pattern.rotation = decalOpt.rotation;
|
||||
pattern.scaleX = pattern.scaleY = isSVG ? 1 : 1 / dpr;
|
||||
decalMap.set(decalObject, pattern);
|
||||
decalObject.dirty = false;
|
||||
return pattern;
|
||||
function setPatternnSource(pattern) {
|
||||
var keys = [dpr];
|
||||
var isValidKey = true;
|
||||
for (var i = 0; i < decalKeys.length; ++i) {
|
||||
var value = decalOpt[decalKeys[i]];
|
||||
if (value != null && !isArray(value) && !isString(value) && !isNumber(value) && typeof value !== 'boolean') {
|
||||
isValidKey = false;
|
||||
break;
|
||||
}
|
||||
keys.push(value);
|
||||
}
|
||||
var cacheKey;
|
||||
if (isValidKey) {
|
||||
cacheKey = keys.join(',') + (isSVG ? '-svg' : '');
|
||||
var cache = decalCache.get(cacheKey);
|
||||
if (cache) {
|
||||
isSVG ? pattern.svgElement = cache : pattern.image = cache;
|
||||
}
|
||||
}
|
||||
var dashArrayX = normalizeDashArrayX(decalOpt.dashArrayX);
|
||||
var dashArrayY = normalizeDashArrayY(decalOpt.dashArrayY);
|
||||
var symbolArray = normalizeSymbolArray(decalOpt.symbol);
|
||||
var lineBlockLengthsX = getLineBlockLengthX(dashArrayX);
|
||||
var lineBlockLengthY = getLineBlockLengthY(dashArrayY);
|
||||
var canvas = !isSVG && platformApi.createCanvas();
|
||||
var svgRoot = isSVG && {
|
||||
tag: 'g',
|
||||
attrs: {},
|
||||
key: 'dcl',
|
||||
children: []
|
||||
};
|
||||
var pSize = getPatternSize();
|
||||
var ctx;
|
||||
if (canvas) {
|
||||
canvas.width = pSize.width * dpr;
|
||||
canvas.height = pSize.height * dpr;
|
||||
ctx = canvas.getContext('2d');
|
||||
}
|
||||
brushDecal();
|
||||
if (isValidKey) {
|
||||
decalCache.put(cacheKey, canvas || svgRoot);
|
||||
}
|
||||
pattern.image = canvas;
|
||||
pattern.svgElement = svgRoot;
|
||||
pattern.svgWidth = pSize.width;
|
||||
pattern.svgHeight = pSize.height;
|
||||
/**
|
||||
* Get minimum length that can make a repeatable pattern.
|
||||
*
|
||||
* @return {Object} pattern width and height
|
||||
*/
|
||||
function getPatternSize() {
|
||||
/**
|
||||
* For example, if dash is [[3, 2], [2, 1]] for X, it looks like
|
||||
* |--- --- --- --- --- ...
|
||||
* |-- -- -- -- -- -- -- -- ...
|
||||
* |--- --- --- --- --- ...
|
||||
* |-- -- -- -- -- -- -- -- ...
|
||||
* So the minimum length of X is 15,
|
||||
* which is the least common multiple of `3 + 2` and `2 + 1`
|
||||
* |--- --- --- |--- --- ...
|
||||
* |-- -- -- -- -- |-- -- -- ...
|
||||
*/
|
||||
var width = 1;
|
||||
for (var i = 0, xlen = lineBlockLengthsX.length; i < xlen; ++i) {
|
||||
width = getLeastCommonMultiple(width, lineBlockLengthsX[i]);
|
||||
}
|
||||
var symbolRepeats = 1;
|
||||
for (var i = 0, xlen = symbolArray.length; i < xlen; ++i) {
|
||||
symbolRepeats = getLeastCommonMultiple(symbolRepeats, symbolArray[i].length);
|
||||
}
|
||||
width *= symbolRepeats;
|
||||
var height = lineBlockLengthY * lineBlockLengthsX.length * symbolArray.length;
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
var warn = function (attrName) {
|
||||
/* eslint-disable-next-line */
|
||||
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.");
|
||||
};
|
||||
if (width > decalOpt.maxTileWidth) {
|
||||
warn('maxTileWidth');
|
||||
}
|
||||
if (height > decalOpt.maxTileHeight) {
|
||||
warn('maxTileHeight');
|
||||
}
|
||||
}
|
||||
return {
|
||||
width: Math.max(1, Math.min(width, decalOpt.maxTileWidth)),
|
||||
height: Math.max(1, Math.min(height, decalOpt.maxTileHeight))
|
||||
};
|
||||
}
|
||||
function brushDecal() {
|
||||
if (ctx) {
|
||||
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
||||
if (decalOpt.backgroundColor) {
|
||||
ctx.fillStyle = decalOpt.backgroundColor;
|
||||
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
||||
}
|
||||
}
|
||||
var ySum = 0;
|
||||
for (var i = 0; i < dashArrayY.length; ++i) {
|
||||
ySum += dashArrayY[i];
|
||||
}
|
||||
if (ySum <= 0) {
|
||||
// dashArrayY is 0, draw nothing
|
||||
return;
|
||||
}
|
||||
var y = -lineBlockLengthY;
|
||||
var yId = 0;
|
||||
var yIdTotal = 0;
|
||||
var xId0 = 0;
|
||||
while (y < pSize.height) {
|
||||
if (yId % 2 === 0) {
|
||||
var symbolYId = yIdTotal / 2 % symbolArray.length;
|
||||
var x = 0;
|
||||
var xId1 = 0;
|
||||
var xId1Total = 0;
|
||||
while (x < pSize.width * 2) {
|
||||
var xSum = 0;
|
||||
for (var i = 0; i < dashArrayX[xId0].length; ++i) {
|
||||
xSum += dashArrayX[xId0][i];
|
||||
}
|
||||
if (xSum <= 0) {
|
||||
// Skip empty line
|
||||
break;
|
||||
}
|
||||
// E.g., [15, 5, 20, 5] draws only for 15 and 20
|
||||
if (xId1 % 2 === 0) {
|
||||
var size = (1 - decalOpt.symbolSize) * 0.5;
|
||||
var left = x + dashArrayX[xId0][xId1] * size;
|
||||
var top_1 = y + dashArrayY[yId] * size;
|
||||
var width = dashArrayX[xId0][xId1] * decalOpt.symbolSize;
|
||||
var height = dashArrayY[yId] * decalOpt.symbolSize;
|
||||
var symbolXId = xId1Total / 2 % symbolArray[symbolYId].length;
|
||||
brushSymbol(left, top_1, width, height, symbolArray[symbolYId][symbolXId]);
|
||||
}
|
||||
x += dashArrayX[xId0][xId1];
|
||||
++xId1Total;
|
||||
++xId1;
|
||||
if (xId1 === dashArrayX[xId0].length) {
|
||||
xId1 = 0;
|
||||
}
|
||||
}
|
||||
++xId0;
|
||||
if (xId0 === dashArrayX.length) {
|
||||
xId0 = 0;
|
||||
}
|
||||
}
|
||||
y += dashArrayY[yId];
|
||||
++yIdTotal;
|
||||
++yId;
|
||||
if (yId === dashArrayY.length) {
|
||||
yId = 0;
|
||||
}
|
||||
}
|
||||
function brushSymbol(x, y, width, height, symbolType) {
|
||||
var scale = isSVG ? 1 : dpr;
|
||||
var symbol = createSymbol(symbolType, x * scale, y * scale, width * scale, height * scale, decalOpt.color, decalOpt.symbolKeepAspect);
|
||||
if (isSVG) {
|
||||
var symbolVNode = zr.painter.renderOneToVNode(symbol);
|
||||
if (symbolVNode) {
|
||||
svgRoot.children.push(symbolVNode);
|
||||
}
|
||||
} else {
|
||||
// Paint to canvas for all other renderers.
|
||||
brushSingle(ctx, symbol);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Convert symbol array into normalized array
|
||||
*
|
||||
* @param {string | (string | string[])[]} symbol symbol input
|
||||
* @return {string[][]} normolized symbol array
|
||||
*/
|
||||
function normalizeSymbolArray(symbol) {
|
||||
if (!symbol || symbol.length === 0) {
|
||||
return [['rect']];
|
||||
}
|
||||
if (isString(symbol)) {
|
||||
return [[symbol]];
|
||||
}
|
||||
var isAllString = true;
|
||||
for (var i = 0; i < symbol.length; ++i) {
|
||||
if (!isString(symbol[i])) {
|
||||
isAllString = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (isAllString) {
|
||||
return normalizeSymbolArray([symbol]);
|
||||
}
|
||||
var result = [];
|
||||
for (var i = 0; i < symbol.length; ++i) {
|
||||
if (isString(symbol[i])) {
|
||||
result.push([symbol[i]]);
|
||||
} else {
|
||||
result.push(symbol[i]);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* Convert dash input into dashArray
|
||||
*
|
||||
* @param {DecalDashArrayX} dash dash input
|
||||
* @return {number[][]} normolized dash array
|
||||
*/
|
||||
function normalizeDashArrayX(dash) {
|
||||
if (!dash || dash.length === 0) {
|
||||
return [[0, 0]];
|
||||
}
|
||||
if (isNumber(dash)) {
|
||||
var dashValue = Math.ceil(dash);
|
||||
return [[dashValue, dashValue]];
|
||||
}
|
||||
/**
|
||||
* [20, 5] should be normalized into [[20, 5]],
|
||||
* while [20, [5, 10]] should be normalized into [[20, 20], [5, 10]]
|
||||
*/
|
||||
var isAllNumber = true;
|
||||
for (var i = 0; i < dash.length; ++i) {
|
||||
if (!isNumber(dash[i])) {
|
||||
isAllNumber = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (isAllNumber) {
|
||||
return normalizeDashArrayX([dash]);
|
||||
}
|
||||
var result = [];
|
||||
for (var i = 0; i < dash.length; ++i) {
|
||||
if (isNumber(dash[i])) {
|
||||
var dashValue = Math.ceil(dash[i]);
|
||||
result.push([dashValue, dashValue]);
|
||||
} else {
|
||||
var dashValue = map(dash[i], function (n) {
|
||||
return Math.ceil(n);
|
||||
});
|
||||
if (dashValue.length % 2 === 1) {
|
||||
// [4, 2, 1] means |---- - -- |---- - -- |
|
||||
// so normalize it to be [4, 2, 1, 4, 2, 1]
|
||||
result.push(dashValue.concat(dashValue));
|
||||
} else {
|
||||
result.push(dashValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* Convert dash input into dashArray
|
||||
*
|
||||
* @param {DecalDashArrayY} dash dash input
|
||||
* @return {number[]} normolized dash array
|
||||
*/
|
||||
function normalizeDashArrayY(dash) {
|
||||
if (!dash || typeof dash === 'object' && dash.length === 0) {
|
||||
return [0, 0];
|
||||
}
|
||||
if (isNumber(dash)) {
|
||||
var dashValue_1 = Math.ceil(dash);
|
||||
return [dashValue_1, dashValue_1];
|
||||
}
|
||||
var dashValue = map(dash, function (n) {
|
||||
return Math.ceil(n);
|
||||
});
|
||||
return dash.length % 2 ? dashValue.concat(dashValue) : dashValue;
|
||||
}
|
||||
/**
|
||||
* Get block length of each line. A block is the length of dash line and space.
|
||||
* For example, a line with [4, 1] has a dash line of 4 and a space of 1 after
|
||||
* that, so the block length of this line is 5.
|
||||
*
|
||||
* @param {number[][]} dash dash array of X or Y
|
||||
* @return {number[]} block length of each line
|
||||
*/
|
||||
function getLineBlockLengthX(dash) {
|
||||
return map(dash, function (line) {
|
||||
return getLineBlockLengthY(line);
|
||||
});
|
||||
}
|
||||
function getLineBlockLengthY(dash) {
|
||||
var blockLength = 0;
|
||||
for (var i = 0; i < dash.length; ++i) {
|
||||
blockLength += dash[i];
|
||||
}
|
||||
if (dash.length % 2 === 1) {
|
||||
// [4, 2, 1] means |---- - -- |---- - -- |
|
||||
// So total length is (4 + 2 + 1) * 2
|
||||
return blockLength * 2;
|
||||
}
|
||||
return blockLength;
|
||||
}
|
56
frontend/node_modules/echarts/lib/util/event.js
generated
vendored
Normal file
56
frontend/node_modules/echarts/lib/util/event.js
generated
vendored
Normal file
@ -0,0 +1,56 @@
|
||||
|
||||
/*
|
||||
* 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 findEventDispatcher(target, det, returnFirstMatch) {
|
||||
var found;
|
||||
while (target) {
|
||||
if (det(target)) {
|
||||
found = target;
|
||||
if (returnFirstMatch) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
target = target.__hostTarget || target.parent;
|
||||
}
|
||||
return found;
|
||||
}
|
240
frontend/node_modules/echarts/lib/util/format.js
generated
vendored
Normal file
240
frontend/node_modules/echarts/lib/util/format.js
generated
vendored
Normal file
@ -0,0 +1,240 @@
|
||||
|
||||
/*
|
||||
* 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 { encodeHTML } from 'zrender/lib/core/dom.js';
|
||||
import { parseDate, isNumeric, numericToNumber } from './number.js';
|
||||
import { format as timeFormat, pad } from './time.js';
|
||||
import { deprecateReplaceLog } from './log.js';
|
||||
/**
|
||||
* Add a comma each three digit.
|
||||
*/
|
||||
export function addCommas(x) {
|
||||
if (!isNumeric(x)) {
|
||||
return zrUtil.isString(x) ? x : '-';
|
||||
}
|
||||
var parts = (x + '').split('.');
|
||||
return parts[0].replace(/(\d{1,3})(?=(?:\d{3})+(?!\d))/g, '$1,') + (parts.length > 1 ? '.' + parts[1] : '');
|
||||
}
|
||||
export function toCamelCase(str, upperCaseFirst) {
|
||||
str = (str || '').toLowerCase().replace(/-(.)/g, function (match, group1) {
|
||||
return group1.toUpperCase();
|
||||
});
|
||||
if (upperCaseFirst && str) {
|
||||
str = str.charAt(0).toUpperCase() + str.slice(1);
|
||||
}
|
||||
return str;
|
||||
}
|
||||
export var normalizeCssArray = zrUtil.normalizeCssArray;
|
||||
export { encodeHTML };
|
||||
/**
|
||||
* Make value user readable for tooltip and label.
|
||||
* "User readable":
|
||||
* Try to not print programmer-specific text like NaN, Infinity, null, undefined.
|
||||
* Avoid to display an empty string, which users can not recognize there is
|
||||
* a value and it might look like a bug.
|
||||
*/
|
||||
export function makeValueReadable(value, valueType, useUTC) {
|
||||
var USER_READABLE_DEFUALT_TIME_PATTERN = '{yyyy}-{MM}-{dd} {HH}:{mm}:{ss}';
|
||||
function stringToUserReadable(str) {
|
||||
return str && zrUtil.trim(str) ? str : '-';
|
||||
}
|
||||
function isNumberUserReadable(num) {
|
||||
return !!(num != null && !isNaN(num) && isFinite(num));
|
||||
}
|
||||
var isTypeTime = valueType === 'time';
|
||||
var isValueDate = value instanceof Date;
|
||||
if (isTypeTime || isValueDate) {
|
||||
var date = isTypeTime ? parseDate(value) : value;
|
||||
if (!isNaN(+date)) {
|
||||
return timeFormat(date, USER_READABLE_DEFUALT_TIME_PATTERN, useUTC);
|
||||
} else if (isValueDate) {
|
||||
return '-';
|
||||
}
|
||||
// In other cases, continue to try to display the value in the following code.
|
||||
}
|
||||
if (valueType === 'ordinal') {
|
||||
return zrUtil.isStringSafe(value) ? stringToUserReadable(value) : zrUtil.isNumber(value) ? isNumberUserReadable(value) ? value + '' : '-' : '-';
|
||||
}
|
||||
// By default.
|
||||
var numericResult = numericToNumber(value);
|
||||
return isNumberUserReadable(numericResult) ? addCommas(numericResult) : zrUtil.isStringSafe(value) ? stringToUserReadable(value) : typeof value === 'boolean' ? value + '' : '-';
|
||||
}
|
||||
var TPL_VAR_ALIAS = ['a', 'b', 'c', 'd', 'e', 'f', 'g'];
|
||||
var wrapVar = function (varName, seriesIdx) {
|
||||
return '{' + varName + (seriesIdx == null ? '' : seriesIdx) + '}';
|
||||
};
|
||||
/**
|
||||
* Template formatter
|
||||
* @param {Array.<Object>|Object} paramsList
|
||||
*/
|
||||
export function formatTpl(tpl, paramsList, encode) {
|
||||
if (!zrUtil.isArray(paramsList)) {
|
||||
paramsList = [paramsList];
|
||||
}
|
||||
var seriesLen = paramsList.length;
|
||||
if (!seriesLen) {
|
||||
return '';
|
||||
}
|
||||
var $vars = paramsList[0].$vars || [];
|
||||
for (var i = 0; i < $vars.length; i++) {
|
||||
var alias = TPL_VAR_ALIAS[i];
|
||||
tpl = tpl.replace(wrapVar(alias), wrapVar(alias, 0));
|
||||
}
|
||||
for (var seriesIdx = 0; seriesIdx < seriesLen; seriesIdx++) {
|
||||
for (var k = 0; k < $vars.length; k++) {
|
||||
var val = paramsList[seriesIdx][$vars[k]];
|
||||
tpl = tpl.replace(wrapVar(TPL_VAR_ALIAS[k], seriesIdx), encode ? encodeHTML(val) : val);
|
||||
}
|
||||
}
|
||||
return tpl;
|
||||
}
|
||||
/**
|
||||
* simple Template formatter
|
||||
*/
|
||||
export function formatTplSimple(tpl, param, encode) {
|
||||
zrUtil.each(param, function (value, key) {
|
||||
tpl = tpl.replace('{' + key + '}', encode ? encodeHTML(value) : value);
|
||||
});
|
||||
return tpl;
|
||||
}
|
||||
export function getTooltipMarker(inOpt, extraCssText) {
|
||||
var opt = zrUtil.isString(inOpt) ? {
|
||||
color: inOpt,
|
||||
extraCssText: extraCssText
|
||||
} : inOpt || {};
|
||||
var color = opt.color;
|
||||
var type = opt.type;
|
||||
extraCssText = opt.extraCssText;
|
||||
var renderMode = opt.renderMode || 'html';
|
||||
if (!color) {
|
||||
return '';
|
||||
}
|
||||
if (renderMode === 'html') {
|
||||
return type === 'subItem' ? '<span style="display:inline-block;vertical-align:middle;margin-right:8px;margin-left:3px;' + 'border-radius:4px;width:4px;height:4px;background-color:'
|
||||
// Only support string
|
||||
+ encodeHTML(color) + ';' + (extraCssText || '') + '"></span>' : '<span style="display:inline-block;margin-right:4px;' + 'border-radius:10px;width:10px;height:10px;background-color:' + encodeHTML(color) + ';' + (extraCssText || '') + '"></span>';
|
||||
} else {
|
||||
// Should better not to auto generate style name by auto-increment number here.
|
||||
// Because this util is usually called in tooltip formatter, which is probably
|
||||
// called repeatedly when mouse move and the auto-increment number increases fast.
|
||||
// Users can make their own style name by theirselves, make it unique and readable.
|
||||
var markerId = opt.markerId || 'markerX';
|
||||
return {
|
||||
renderMode: renderMode,
|
||||
content: '{' + markerId + '|} ',
|
||||
style: type === 'subItem' ? {
|
||||
width: 4,
|
||||
height: 4,
|
||||
borderRadius: 2,
|
||||
backgroundColor: color
|
||||
} : {
|
||||
width: 10,
|
||||
height: 10,
|
||||
borderRadius: 5,
|
||||
backgroundColor: color
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @deprecated Use `time/format` instead.
|
||||
* ISO Date format
|
||||
* @param {string} tpl
|
||||
* @param {number} value
|
||||
* @param {boolean} [isUTC=false] Default in local time.
|
||||
* see `module:echarts/scale/Time`
|
||||
* and `module:echarts/util/number#parseDate`.
|
||||
* @inner
|
||||
*/
|
||||
export function formatTime(tpl, value, isUTC) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
deprecateReplaceLog('echarts.format.formatTime', 'echarts.time.format');
|
||||
}
|
||||
if (tpl === 'week' || tpl === 'month' || tpl === 'quarter' || tpl === 'half-year' || tpl === 'year') {
|
||||
tpl = 'MM-dd\nyyyy';
|
||||
}
|
||||
var date = parseDate(value);
|
||||
var getUTC = isUTC ? 'getUTC' : 'get';
|
||||
var y = date[getUTC + 'FullYear']();
|
||||
var M = date[getUTC + 'Month']() + 1;
|
||||
var d = date[getUTC + 'Date']();
|
||||
var h = date[getUTC + 'Hours']();
|
||||
var m = date[getUTC + 'Minutes']();
|
||||
var s = date[getUTC + 'Seconds']();
|
||||
var S = date[getUTC + 'Milliseconds']();
|
||||
tpl = tpl.replace('MM', pad(M, 2)).replace('M', M).replace('yyyy', y).replace('yy', pad(y % 100 + '', 2)).replace('dd', pad(d, 2)).replace('d', d).replace('hh', pad(h, 2)).replace('h', h).replace('mm', pad(m, 2)).replace('m', m).replace('ss', pad(s, 2)).replace('s', s).replace('SSS', pad(S, 3));
|
||||
return tpl;
|
||||
}
|
||||
/**
|
||||
* Capital first
|
||||
* @param {string} str
|
||||
* @return {string}
|
||||
*/
|
||||
export function capitalFirst(str) {
|
||||
return str ? str.charAt(0).toUpperCase() + str.substr(1) : str;
|
||||
}
|
||||
/**
|
||||
* @return Never be null/undefined.
|
||||
*/
|
||||
export function convertToColorString(color, defaultColor) {
|
||||
defaultColor = defaultColor || 'transparent';
|
||||
return zrUtil.isString(color) ? color : zrUtil.isObject(color) ? color.colorStops && (color.colorStops[0] || {}).color || defaultColor : defaultColor;
|
||||
}
|
||||
export { truncateText } from 'zrender/lib/graphic/helper/parseText.js';
|
||||
/**
|
||||
* open new tab
|
||||
* @param link url
|
||||
* @param target blank or self
|
||||
*/
|
||||
export function windowOpen(link, target) {
|
||||
/* global window */
|
||||
if (target === '_blank' || target === 'blank') {
|
||||
var blank = window.open();
|
||||
blank.opener = null;
|
||||
blank.location.href = link;
|
||||
} else {
|
||||
window.open(link, target);
|
||||
}
|
||||
}
|
||||
export { getTextRect } from '../legacy/getTextRect.js';
|
522
frontend/node_modules/echarts/lib/util/graphic.js
generated
vendored
Normal file
522
frontend/node_modules/echarts/lib/util/graphic.js
generated
vendored
Normal file
@ -0,0 +1,522 @@
|
||||
|
||||
/*
|
||||
* 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 pathTool from 'zrender/lib/tool/path.js';
|
||||
import * as matrix from 'zrender/lib/core/matrix.js';
|
||||
import * as vector from 'zrender/lib/core/vector.js';
|
||||
import Path from 'zrender/lib/graphic/Path.js';
|
||||
import Transformable from 'zrender/lib/core/Transformable.js';
|
||||
import ZRImage from 'zrender/lib/graphic/Image.js';
|
||||
import Group from 'zrender/lib/graphic/Group.js';
|
||||
import ZRText from 'zrender/lib/graphic/Text.js';
|
||||
import Circle from 'zrender/lib/graphic/shape/Circle.js';
|
||||
import Ellipse from 'zrender/lib/graphic/shape/Ellipse.js';
|
||||
import Sector from 'zrender/lib/graphic/shape/Sector.js';
|
||||
import Ring from 'zrender/lib/graphic/shape/Ring.js';
|
||||
import Polygon from 'zrender/lib/graphic/shape/Polygon.js';
|
||||
import Polyline from 'zrender/lib/graphic/shape/Polyline.js';
|
||||
import Rect from 'zrender/lib/graphic/shape/Rect.js';
|
||||
import Line from 'zrender/lib/graphic/shape/Line.js';
|
||||
import BezierCurve from 'zrender/lib/graphic/shape/BezierCurve.js';
|
||||
import Arc from 'zrender/lib/graphic/shape/Arc.js';
|
||||
import CompoundPath from 'zrender/lib/graphic/CompoundPath.js';
|
||||
import LinearGradient from 'zrender/lib/graphic/LinearGradient.js';
|
||||
import RadialGradient from 'zrender/lib/graphic/RadialGradient.js';
|
||||
import BoundingRect from 'zrender/lib/core/BoundingRect.js';
|
||||
import OrientedBoundingRect from 'zrender/lib/core/OrientedBoundingRect.js';
|
||||
import Point from 'zrender/lib/core/Point.js';
|
||||
import IncrementalDisplayable from 'zrender/lib/graphic/IncrementalDisplayable.js';
|
||||
import * as subPixelOptimizeUtil from 'zrender/lib/graphic/helper/subPixelOptimize.js';
|
||||
import { extend, isArrayLike, map, defaults, isString, keys, each, hasOwn, isArray } from 'zrender/lib/core/util.js';
|
||||
import { getECData } from './innerStore.js';
|
||||
import { updateProps, initProps, removeElement, removeElementWithFadeOut, isElementRemoved } from '../animation/basicTransition.js';
|
||||
/**
|
||||
* @deprecated export for compatitable reason
|
||||
*/
|
||||
export { updateProps, initProps, removeElement, removeElementWithFadeOut, isElementRemoved };
|
||||
var mathMax = Math.max;
|
||||
var mathMin = Math.min;
|
||||
var _customShapeMap = {};
|
||||
/**
|
||||
* Extend shape with parameters
|
||||
*/
|
||||
export function extendShape(opts) {
|
||||
return Path.extend(opts);
|
||||
}
|
||||
var extendPathFromString = pathTool.extendFromString;
|
||||
/**
|
||||
* Extend path
|
||||
*/
|
||||
export function extendPath(pathData, opts) {
|
||||
return extendPathFromString(pathData, opts);
|
||||
}
|
||||
/**
|
||||
* Register a user defined shape.
|
||||
* The shape class can be fetched by `getShapeClass`
|
||||
* This method will overwrite the registered shapes, including
|
||||
* the registered built-in shapes, if using the same `name`.
|
||||
* The shape can be used in `custom series` and
|
||||
* `graphic component` by declaring `{type: name}`.
|
||||
*
|
||||
* @param name
|
||||
* @param ShapeClass Can be generated by `extendShape`.
|
||||
*/
|
||||
export function registerShape(name, ShapeClass) {
|
||||
_customShapeMap[name] = ShapeClass;
|
||||
}
|
||||
/**
|
||||
* Find shape class registered by `registerShape`. Usually used in
|
||||
* fetching user defined shape.
|
||||
*
|
||||
* [Caution]:
|
||||
* (1) This method **MUST NOT be used inside echarts !!!**, unless it is prepared
|
||||
* to use user registered shapes.
|
||||
* Because the built-in shape (see `getBuiltInShape`) will be registered by
|
||||
* `registerShape` by default. That enables users to get both built-in
|
||||
* shapes as well as the shapes belonging to themsleves. But users can overwrite
|
||||
* the built-in shapes by using names like 'circle', 'rect' via calling
|
||||
* `registerShape`. So the echarts inner featrues should not fetch shapes from here
|
||||
* in case that it is overwritten by users, except that some features, like
|
||||
* `custom series`, `graphic component`, do it deliberately.
|
||||
*
|
||||
* (2) In the features like `custom series`, `graphic component`, the user input
|
||||
* `{tpye: 'xxx'}` does not only specify shapes but also specify other graphic
|
||||
* elements like `'group'`, `'text'`, `'image'` or event `'path'`. Those names
|
||||
* are reserved names, that is, if some user registers a shape named `'image'`,
|
||||
* the shape will not be used. If we intending to add some more reserved names
|
||||
* in feature, that might bring break changes (disable some existing user shape
|
||||
* names). But that case probably rarely happens. So we don't make more mechanism
|
||||
* to resolve this issue here.
|
||||
*
|
||||
* @param name
|
||||
* @return The shape class. If not found, return nothing.
|
||||
*/
|
||||
export function getShapeClass(name) {
|
||||
if (_customShapeMap.hasOwnProperty(name)) {
|
||||
return _customShapeMap[name];
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Create a path element from path data string
|
||||
* @param pathData
|
||||
* @param opts
|
||||
* @param rect
|
||||
* @param layout 'center' or 'cover' default to be cover
|
||||
*/
|
||||
export function makePath(pathData, opts, rect, layout) {
|
||||
var path = pathTool.createFromString(pathData, opts);
|
||||
if (rect) {
|
||||
if (layout === 'center') {
|
||||
rect = centerGraphic(rect, path.getBoundingRect());
|
||||
}
|
||||
resizePath(path, rect);
|
||||
}
|
||||
return path;
|
||||
}
|
||||
/**
|
||||
* Create a image element from image url
|
||||
* @param imageUrl image url
|
||||
* @param opts options
|
||||
* @param rect constrain rect
|
||||
* @param layout 'center' or 'cover'. Default to be 'cover'
|
||||
*/
|
||||
export function makeImage(imageUrl, rect, layout) {
|
||||
var zrImg = new ZRImage({
|
||||
style: {
|
||||
image: imageUrl,
|
||||
x: rect.x,
|
||||
y: rect.y,
|
||||
width: rect.width,
|
||||
height: rect.height
|
||||
},
|
||||
onload: function (img) {
|
||||
if (layout === 'center') {
|
||||
var boundingRect = {
|
||||
width: img.width,
|
||||
height: img.height
|
||||
};
|
||||
zrImg.setStyle(centerGraphic(rect, boundingRect));
|
||||
}
|
||||
}
|
||||
});
|
||||
return zrImg;
|
||||
}
|
||||
/**
|
||||
* Get position of centered element in bounding box.
|
||||
*
|
||||
* @param rect element local bounding box
|
||||
* @param boundingRect constraint bounding box
|
||||
* @return element position containing x, y, width, and height
|
||||
*/
|
||||
function centerGraphic(rect, boundingRect) {
|
||||
// Set rect to center, keep width / height ratio.
|
||||
var aspect = boundingRect.width / boundingRect.height;
|
||||
var width = rect.height * aspect;
|
||||
var height;
|
||||
if (width <= rect.width) {
|
||||
height = rect.height;
|
||||
} else {
|
||||
width = rect.width;
|
||||
height = width / aspect;
|
||||
}
|
||||
var cx = rect.x + rect.width / 2;
|
||||
var cy = rect.y + rect.height / 2;
|
||||
return {
|
||||
x: cx - width / 2,
|
||||
y: cy - height / 2,
|
||||
width: width,
|
||||
height: height
|
||||
};
|
||||
}
|
||||
export var mergePath = pathTool.mergePath;
|
||||
/**
|
||||
* Resize a path to fit the rect
|
||||
* @param path
|
||||
* @param rect
|
||||
*/
|
||||
export function resizePath(path, rect) {
|
||||
if (!path.applyTransform) {
|
||||
return;
|
||||
}
|
||||
var pathRect = path.getBoundingRect();
|
||||
var m = pathRect.calculateTransform(rect);
|
||||
path.applyTransform(m);
|
||||
}
|
||||
/**
|
||||
* Sub pixel optimize line for canvas
|
||||
*/
|
||||
export function subPixelOptimizeLine(shape, lineWidth) {
|
||||
subPixelOptimizeUtil.subPixelOptimizeLine(shape, shape, {
|
||||
lineWidth: lineWidth
|
||||
});
|
||||
return shape;
|
||||
}
|
||||
/**
|
||||
* Sub pixel optimize rect for canvas
|
||||
*/
|
||||
export function subPixelOptimizeRect(param) {
|
||||
subPixelOptimizeUtil.subPixelOptimizeRect(param.shape, param.shape, param.style);
|
||||
return param;
|
||||
}
|
||||
/**
|
||||
* Sub pixel optimize for canvas
|
||||
*
|
||||
* @param position Coordinate, such as x, y
|
||||
* @param lineWidth Should be nonnegative integer.
|
||||
* @param positiveOrNegative Default false (negative).
|
||||
* @return Optimized position.
|
||||
*/
|
||||
export var subPixelOptimize = subPixelOptimizeUtil.subPixelOptimize;
|
||||
/**
|
||||
* Get transform matrix of target (param target),
|
||||
* in coordinate of its ancestor (param ancestor)
|
||||
*
|
||||
* @param target
|
||||
* @param [ancestor]
|
||||
*/
|
||||
export function getTransform(target, ancestor) {
|
||||
var mat = matrix.identity([]);
|
||||
while (target && target !== ancestor) {
|
||||
matrix.mul(mat, target.getLocalTransform(), mat);
|
||||
target = target.parent;
|
||||
}
|
||||
return mat;
|
||||
}
|
||||
/**
|
||||
* Apply transform to an vertex.
|
||||
* @param target [x, y]
|
||||
* @param transform Can be:
|
||||
* + Transform matrix: like [1, 0, 0, 1, 0, 0]
|
||||
* + {position, rotation, scale}, the same as `zrender/Transformable`.
|
||||
* @param invert Whether use invert matrix.
|
||||
* @return [x, y]
|
||||
*/
|
||||
export function applyTransform(target, transform, invert) {
|
||||
if (transform && !isArrayLike(transform)) {
|
||||
transform = Transformable.getLocalTransform(transform);
|
||||
}
|
||||
if (invert) {
|
||||
transform = matrix.invert([], transform);
|
||||
}
|
||||
return vector.applyTransform([], target, transform);
|
||||
}
|
||||
/**
|
||||
* @param direction 'left' 'right' 'top' 'bottom'
|
||||
* @param transform Transform matrix: like [1, 0, 0, 1, 0, 0]
|
||||
* @param invert Whether use invert matrix.
|
||||
* @return Transformed direction. 'left' 'right' 'top' 'bottom'
|
||||
*/
|
||||
export function transformDirection(direction, transform, invert) {
|
||||
// Pick a base, ensure that transform result will not be (0, 0).
|
||||
var hBase = transform[4] === 0 || transform[5] === 0 || transform[0] === 0 ? 1 : Math.abs(2 * transform[4] / transform[0]);
|
||||
var vBase = transform[4] === 0 || transform[5] === 0 || transform[2] === 0 ? 1 : Math.abs(2 * transform[4] / transform[2]);
|
||||
var vertex = [direction === 'left' ? -hBase : direction === 'right' ? hBase : 0, direction === 'top' ? -vBase : direction === 'bottom' ? vBase : 0];
|
||||
vertex = applyTransform(vertex, transform, invert);
|
||||
return Math.abs(vertex[0]) > Math.abs(vertex[1]) ? vertex[0] > 0 ? 'right' : 'left' : vertex[1] > 0 ? 'bottom' : 'top';
|
||||
}
|
||||
function isNotGroup(el) {
|
||||
return !el.isGroup;
|
||||
}
|
||||
function isPath(el) {
|
||||
return el.shape != null;
|
||||
}
|
||||
/**
|
||||
* Apply group transition animation from g1 to g2.
|
||||
* If no animatableModel, no animation.
|
||||
*/
|
||||
export function groupTransition(g1, g2, animatableModel) {
|
||||
if (!g1 || !g2) {
|
||||
return;
|
||||
}
|
||||
function getElMap(g) {
|
||||
var elMap = {};
|
||||
g.traverse(function (el) {
|
||||
if (isNotGroup(el) && el.anid) {
|
||||
elMap[el.anid] = el;
|
||||
}
|
||||
});
|
||||
return elMap;
|
||||
}
|
||||
function getAnimatableProps(el) {
|
||||
var obj = {
|
||||
x: el.x,
|
||||
y: el.y,
|
||||
rotation: el.rotation
|
||||
};
|
||||
if (isPath(el)) {
|
||||
obj.shape = extend({}, el.shape);
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
var elMap1 = getElMap(g1);
|
||||
g2.traverse(function (el) {
|
||||
if (isNotGroup(el) && el.anid) {
|
||||
var oldEl = elMap1[el.anid];
|
||||
if (oldEl) {
|
||||
var newProp = getAnimatableProps(el);
|
||||
el.attr(getAnimatableProps(oldEl));
|
||||
updateProps(el, newProp, animatableModel, getECData(el).dataIndex);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
export function clipPointsByRect(points, rect) {
|
||||
// FIXME: This way might be incorrect when graphic clipped by a corner
|
||||
// and when element has a border.
|
||||
return map(points, function (point) {
|
||||
var x = point[0];
|
||||
x = mathMax(x, rect.x);
|
||||
x = mathMin(x, rect.x + rect.width);
|
||||
var y = point[1];
|
||||
y = mathMax(y, rect.y);
|
||||
y = mathMin(y, rect.y + rect.height);
|
||||
return [x, y];
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Return a new clipped rect. If rect size are negative, return undefined.
|
||||
*/
|
||||
export function clipRectByRect(targetRect, rect) {
|
||||
var x = mathMax(targetRect.x, rect.x);
|
||||
var x2 = mathMin(targetRect.x + targetRect.width, rect.x + rect.width);
|
||||
var y = mathMax(targetRect.y, rect.y);
|
||||
var y2 = mathMin(targetRect.y + targetRect.height, rect.y + rect.height);
|
||||
// If the total rect is cliped, nothing, including the border,
|
||||
// should be painted. So return undefined.
|
||||
if (x2 >= x && y2 >= y) {
|
||||
return {
|
||||
x: x,
|
||||
y: y,
|
||||
width: x2 - x,
|
||||
height: y2 - y
|
||||
};
|
||||
}
|
||||
}
|
||||
export function createIcon(iconStr,
|
||||
// Support 'image://' or 'path://' or direct svg path.
|
||||
opt, rect) {
|
||||
var innerOpts = extend({
|
||||
rectHover: true
|
||||
}, opt);
|
||||
var style = innerOpts.style = {
|
||||
strokeNoScale: true
|
||||
};
|
||||
rect = rect || {
|
||||
x: -1,
|
||||
y: -1,
|
||||
width: 2,
|
||||
height: 2
|
||||
};
|
||||
if (iconStr) {
|
||||
return iconStr.indexOf('image://') === 0 ? (style.image = iconStr.slice(8), defaults(style, rect), new ZRImage(innerOpts)) : makePath(iconStr.replace('path://', ''), innerOpts, rect, 'center');
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Return `true` if the given line (line `a`) and the given polygon
|
||||
* are intersect.
|
||||
* Note that we do not count colinear as intersect here because no
|
||||
* requirement for that. We could do that if required in future.
|
||||
*/
|
||||
export function linePolygonIntersect(a1x, a1y, a2x, a2y, points) {
|
||||
for (var i = 0, p2 = points[points.length - 1]; i < points.length; i++) {
|
||||
var p = points[i];
|
||||
if (lineLineIntersect(a1x, a1y, a2x, a2y, p[0], p[1], p2[0], p2[1])) {
|
||||
return true;
|
||||
}
|
||||
p2 = p;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Return `true` if the given two lines (line `a` and line `b`)
|
||||
* are intersect.
|
||||
* Note that we do not count colinear as intersect here because no
|
||||
* requirement for that. We could do that if required in future.
|
||||
*/
|
||||
export function lineLineIntersect(a1x, a1y, a2x, a2y, b1x, b1y, b2x, b2y) {
|
||||
// let `vec_m` to be `vec_a2 - vec_a1` and `vec_n` to be `vec_b2 - vec_b1`.
|
||||
var mx = a2x - a1x;
|
||||
var my = a2y - a1y;
|
||||
var nx = b2x - b1x;
|
||||
var ny = b2y - b1y;
|
||||
// `vec_m` and `vec_n` are parallel iff
|
||||
// existing `k` such that `vec_m = k · vec_n`, equivalent to `vec_m X vec_n = 0`.
|
||||
var nmCrossProduct = crossProduct2d(nx, ny, mx, my);
|
||||
if (nearZero(nmCrossProduct)) {
|
||||
return false;
|
||||
}
|
||||
// `vec_m` and `vec_n` are intersect iff
|
||||
// existing `p` and `q` in [0, 1] such that `vec_a1 + p * vec_m = vec_b1 + q * vec_n`,
|
||||
// such that `q = ((vec_a1 - vec_b1) X vec_m) / (vec_n X vec_m)`
|
||||
// and `p = ((vec_a1 - vec_b1) X vec_n) / (vec_n X vec_m)`.
|
||||
var b1a1x = a1x - b1x;
|
||||
var b1a1y = a1y - b1y;
|
||||
var q = crossProduct2d(b1a1x, b1a1y, mx, my) / nmCrossProduct;
|
||||
if (q < 0 || q > 1) {
|
||||
return false;
|
||||
}
|
||||
var p = crossProduct2d(b1a1x, b1a1y, nx, ny) / nmCrossProduct;
|
||||
if (p < 0 || p > 1) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* Cross product of 2-dimension vector.
|
||||
*/
|
||||
function crossProduct2d(x1, y1, x2, y2) {
|
||||
return x1 * y2 - x2 * y1;
|
||||
}
|
||||
function nearZero(val) {
|
||||
return val <= 1e-6 && val >= -1e-6;
|
||||
}
|
||||
export function setTooltipConfig(opt) {
|
||||
var itemTooltipOption = opt.itemTooltipOption;
|
||||
var componentModel = opt.componentModel;
|
||||
var itemName = opt.itemName;
|
||||
var itemTooltipOptionObj = isString(itemTooltipOption) ? {
|
||||
formatter: itemTooltipOption
|
||||
} : itemTooltipOption;
|
||||
var mainType = componentModel.mainType;
|
||||
var componentIndex = componentModel.componentIndex;
|
||||
var formatterParams = {
|
||||
componentType: mainType,
|
||||
name: itemName,
|
||||
$vars: ['name']
|
||||
};
|
||||
formatterParams[mainType + 'Index'] = componentIndex;
|
||||
var formatterParamsExtra = opt.formatterParamsExtra;
|
||||
if (formatterParamsExtra) {
|
||||
each(keys(formatterParamsExtra), function (key) {
|
||||
if (!hasOwn(formatterParams, key)) {
|
||||
formatterParams[key] = formatterParamsExtra[key];
|
||||
formatterParams.$vars.push(key);
|
||||
}
|
||||
});
|
||||
}
|
||||
var ecData = getECData(opt.el);
|
||||
ecData.componentMainType = mainType;
|
||||
ecData.componentIndex = componentIndex;
|
||||
ecData.tooltipConfig = {
|
||||
name: itemName,
|
||||
option: defaults({
|
||||
content: itemName,
|
||||
encodeHTMLContent: true,
|
||||
formatterParams: formatterParams
|
||||
}, itemTooltipOptionObj)
|
||||
};
|
||||
}
|
||||
function traverseElement(el, cb) {
|
||||
var stopped;
|
||||
// TODO
|
||||
// Polyfill for fixing zrender group traverse don't visit it's root issue.
|
||||
if (el.isGroup) {
|
||||
stopped = cb(el);
|
||||
}
|
||||
if (!stopped) {
|
||||
el.traverse(cb);
|
||||
}
|
||||
}
|
||||
export function traverseElements(els, cb) {
|
||||
if (els) {
|
||||
if (isArray(els)) {
|
||||
for (var i = 0; i < els.length; i++) {
|
||||
traverseElement(els[i], cb);
|
||||
}
|
||||
} else {
|
||||
traverseElement(els, cb);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Register built-in shapes. These shapes might be overwritten
|
||||
// by users, although we do not recommend that.
|
||||
registerShape('circle', Circle);
|
||||
registerShape('ellipse', Ellipse);
|
||||
registerShape('sector', Sector);
|
||||
registerShape('ring', Ring);
|
||||
registerShape('polygon', Polygon);
|
||||
registerShape('polyline', Polyline);
|
||||
registerShape('rect', Rect);
|
||||
registerShape('line', Line);
|
||||
registerShape('bezierCurve', BezierCurve);
|
||||
registerShape('arc', Arc);
|
||||
export { Group, ZRImage as Image, ZRText as Text, Circle, Ellipse, Sector, Ring, Polygon, Polyline, Rect, Line, BezierCurve, Arc, IncrementalDisplayable, CompoundPath, LinearGradient, RadialGradient, BoundingRect, OrientedBoundingRect, Point, Path };
|
66
frontend/node_modules/echarts/lib/util/innerStore.js
generated
vendored
Normal file
66
frontend/node_modules/echarts/lib/util/innerStore.js
generated
vendored
Normal 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 { makeInner } from './model.js';
|
||||
export var getECData = makeInner();
|
||||
export var setCommonECData = function (seriesIndex, dataType, dataIdx, el) {
|
||||
if (el) {
|
||||
var ecData = getECData(el);
|
||||
// Add data index and series index for indexing the data by element
|
||||
// Useful in tooltip
|
||||
ecData.dataIndex = dataIdx;
|
||||
ecData.dataType = dataType;
|
||||
ecData.seriesIndex = seriesIndex;
|
||||
ecData.ssrType = 'chart';
|
||||
// TODO: not store dataIndex on children.
|
||||
if (el.type === 'group') {
|
||||
el.traverse(function (child) {
|
||||
var childECData = getECData(child);
|
||||
childECData.seriesIndex = seriesIndex;
|
||||
childECData.dataIndex = dataIdx;
|
||||
childECData.dataType = dataType;
|
||||
childECData.ssrType = 'chart';
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
449
frontend/node_modules/echarts/lib/util/layout.js
generated
vendored
Normal file
449
frontend/node_modules/echarts/lib/util/layout.js
generated
vendored
Normal file
@ -0,0 +1,449 @@
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
// Layout helpers for each component positioning
|
||||
import * as zrUtil from 'zrender/lib/core/util.js';
|
||||
import BoundingRect from 'zrender/lib/core/BoundingRect.js';
|
||||
import { parsePercent } from './number.js';
|
||||
import * as formatUtil from './format.js';
|
||||
var each = zrUtil.each;
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export var LOCATION_PARAMS = ['left', 'right', 'top', 'bottom', 'width', 'height'];
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export var HV_NAMES = [['width', 'left', 'right'], ['height', 'top', 'bottom']];
|
||||
function boxLayout(orient, group, gap, maxWidth, maxHeight) {
|
||||
var x = 0;
|
||||
var y = 0;
|
||||
if (maxWidth == null) {
|
||||
maxWidth = Infinity;
|
||||
}
|
||||
if (maxHeight == null) {
|
||||
maxHeight = Infinity;
|
||||
}
|
||||
var currentLineMaxSize = 0;
|
||||
group.eachChild(function (child, idx) {
|
||||
var rect = child.getBoundingRect();
|
||||
var nextChild = group.childAt(idx + 1);
|
||||
var nextChildRect = nextChild && nextChild.getBoundingRect();
|
||||
var nextX;
|
||||
var nextY;
|
||||
if (orient === 'horizontal') {
|
||||
var moveX = rect.width + (nextChildRect ? -nextChildRect.x + rect.x : 0);
|
||||
nextX = x + moveX;
|
||||
// Wrap when width exceeds maxWidth or meet a `newline` group
|
||||
// FIXME compare before adding gap?
|
||||
if (nextX > maxWidth || child.newline) {
|
||||
x = 0;
|
||||
nextX = moveX;
|
||||
y += currentLineMaxSize + gap;
|
||||
currentLineMaxSize = rect.height;
|
||||
} else {
|
||||
// FIXME: consider rect.y is not `0`?
|
||||
currentLineMaxSize = Math.max(currentLineMaxSize, rect.height);
|
||||
}
|
||||
} else {
|
||||
var moveY = rect.height + (nextChildRect ? -nextChildRect.y + rect.y : 0);
|
||||
nextY = y + moveY;
|
||||
// Wrap when width exceeds maxHeight or meet a `newline` group
|
||||
if (nextY > maxHeight || child.newline) {
|
||||
x += currentLineMaxSize + gap;
|
||||
y = 0;
|
||||
nextY = moveY;
|
||||
currentLineMaxSize = rect.width;
|
||||
} else {
|
||||
currentLineMaxSize = Math.max(currentLineMaxSize, rect.width);
|
||||
}
|
||||
}
|
||||
if (child.newline) {
|
||||
return;
|
||||
}
|
||||
child.x = x;
|
||||
child.y = y;
|
||||
child.markRedraw();
|
||||
orient === 'horizontal' ? x = nextX + gap : y = nextY + gap;
|
||||
});
|
||||
}
|
||||
/**
|
||||
* VBox or HBox layouting
|
||||
* @param {string} orient
|
||||
* @param {module:zrender/graphic/Group} group
|
||||
* @param {number} gap
|
||||
* @param {number} [width=Infinity]
|
||||
* @param {number} [height=Infinity]
|
||||
*/
|
||||
export var box = boxLayout;
|
||||
/**
|
||||
* VBox layouting
|
||||
* @param {module:zrender/graphic/Group} group
|
||||
* @param {number} gap
|
||||
* @param {number} [width=Infinity]
|
||||
* @param {number} [height=Infinity]
|
||||
*/
|
||||
export var vbox = zrUtil.curry(boxLayout, 'vertical');
|
||||
/**
|
||||
* HBox layouting
|
||||
* @param {module:zrender/graphic/Group} group
|
||||
* @param {number} gap
|
||||
* @param {number} [width=Infinity]
|
||||
* @param {number} [height=Infinity]
|
||||
*/
|
||||
export var hbox = zrUtil.curry(boxLayout, 'horizontal');
|
||||
/**
|
||||
* If x or x2 is not specified or 'center' 'left' 'right',
|
||||
* the width would be as long as possible.
|
||||
* If y or y2 is not specified or 'middle' 'top' 'bottom',
|
||||
* the height would be as long as possible.
|
||||
*/
|
||||
export function getAvailableSize(positionInfo, containerRect, margin) {
|
||||
var containerWidth = containerRect.width;
|
||||
var containerHeight = containerRect.height;
|
||||
var x = parsePercent(positionInfo.left, containerWidth);
|
||||
var y = parsePercent(positionInfo.top, containerHeight);
|
||||
var x2 = parsePercent(positionInfo.right, containerWidth);
|
||||
var y2 = parsePercent(positionInfo.bottom, containerHeight);
|
||||
(isNaN(x) || isNaN(parseFloat(positionInfo.left))) && (x = 0);
|
||||
(isNaN(x2) || isNaN(parseFloat(positionInfo.right))) && (x2 = containerWidth);
|
||||
(isNaN(y) || isNaN(parseFloat(positionInfo.top))) && (y = 0);
|
||||
(isNaN(y2) || isNaN(parseFloat(positionInfo.bottom))) && (y2 = containerHeight);
|
||||
margin = formatUtil.normalizeCssArray(margin || 0);
|
||||
return {
|
||||
width: Math.max(x2 - x - margin[1] - margin[3], 0),
|
||||
height: Math.max(y2 - y - margin[0] - margin[2], 0)
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Parse position info.
|
||||
*/
|
||||
export function getLayoutRect(positionInfo, containerRect, margin) {
|
||||
margin = formatUtil.normalizeCssArray(margin || 0);
|
||||
var containerWidth = containerRect.width;
|
||||
var containerHeight = containerRect.height;
|
||||
var left = parsePercent(positionInfo.left, containerWidth);
|
||||
var top = parsePercent(positionInfo.top, containerHeight);
|
||||
var right = parsePercent(positionInfo.right, containerWidth);
|
||||
var bottom = parsePercent(positionInfo.bottom, containerHeight);
|
||||
var width = parsePercent(positionInfo.width, containerWidth);
|
||||
var height = parsePercent(positionInfo.height, containerHeight);
|
||||
var verticalMargin = margin[2] + margin[0];
|
||||
var horizontalMargin = margin[1] + margin[3];
|
||||
var aspect = positionInfo.aspect;
|
||||
// If width is not specified, calculate width from left and right
|
||||
if (isNaN(width)) {
|
||||
width = containerWidth - right - horizontalMargin - left;
|
||||
}
|
||||
if (isNaN(height)) {
|
||||
height = containerHeight - bottom - verticalMargin - top;
|
||||
}
|
||||
if (aspect != null) {
|
||||
// If width and height are not given
|
||||
// 1. Graph should not exceeds the container
|
||||
// 2. Aspect must be keeped
|
||||
// 3. Graph should take the space as more as possible
|
||||
// FIXME
|
||||
// Margin is not considered, because there is no case that both
|
||||
// using margin and aspect so far.
|
||||
if (isNaN(width) && isNaN(height)) {
|
||||
if (aspect > containerWidth / containerHeight) {
|
||||
width = containerWidth * 0.8;
|
||||
} else {
|
||||
height = containerHeight * 0.8;
|
||||
}
|
||||
}
|
||||
// Calculate width or height with given aspect
|
||||
if (isNaN(width)) {
|
||||
width = aspect * height;
|
||||
}
|
||||
if (isNaN(height)) {
|
||||
height = width / aspect;
|
||||
}
|
||||
}
|
||||
// If left is not specified, calculate left from right and width
|
||||
if (isNaN(left)) {
|
||||
left = containerWidth - right - width - horizontalMargin;
|
||||
}
|
||||
if (isNaN(top)) {
|
||||
top = containerHeight - bottom - height - verticalMargin;
|
||||
}
|
||||
// Align left and top
|
||||
switch (positionInfo.left || positionInfo.right) {
|
||||
case 'center':
|
||||
left = containerWidth / 2 - width / 2 - margin[3];
|
||||
break;
|
||||
case 'right':
|
||||
left = containerWidth - width - horizontalMargin;
|
||||
break;
|
||||
}
|
||||
switch (positionInfo.top || positionInfo.bottom) {
|
||||
case 'middle':
|
||||
case 'center':
|
||||
top = containerHeight / 2 - height / 2 - margin[0];
|
||||
break;
|
||||
case 'bottom':
|
||||
top = containerHeight - height - verticalMargin;
|
||||
break;
|
||||
}
|
||||
// If something is wrong and left, top, width, height are calculated as NaN
|
||||
left = left || 0;
|
||||
top = top || 0;
|
||||
if (isNaN(width)) {
|
||||
// Width may be NaN if only one value is given except width
|
||||
width = containerWidth - horizontalMargin - left - (right || 0);
|
||||
}
|
||||
if (isNaN(height)) {
|
||||
// Height may be NaN if only one value is given except height
|
||||
height = containerHeight - verticalMargin - top - (bottom || 0);
|
||||
}
|
||||
var rect = new BoundingRect(left + margin[3], top + margin[0], width, height);
|
||||
rect.margin = margin;
|
||||
return rect;
|
||||
}
|
||||
/**
|
||||
* Position a zr element in viewport
|
||||
* Group position is specified by either
|
||||
* {left, top}, {right, bottom}
|
||||
* If all properties exists, right and bottom will be igonred.
|
||||
*
|
||||
* Logic:
|
||||
* 1. Scale (against origin point in parent coord)
|
||||
* 2. Rotate (against origin point in parent coord)
|
||||
* 3. Translate (with el.position by this method)
|
||||
* So this method only fixes the last step 'Translate', which does not affect
|
||||
* scaling and rotating.
|
||||
*
|
||||
* If be called repeatedly with the same input el, the same result will be gotten.
|
||||
*
|
||||
* Return true if the layout happened.
|
||||
*
|
||||
* @param el Should have `getBoundingRect` method.
|
||||
* @param positionInfo
|
||||
* @param positionInfo.left
|
||||
* @param positionInfo.top
|
||||
* @param positionInfo.right
|
||||
* @param positionInfo.bottom
|
||||
* @param positionInfo.width Only for opt.boundingModel: 'raw'
|
||||
* @param positionInfo.height Only for opt.boundingModel: 'raw'
|
||||
* @param containerRect
|
||||
* @param margin
|
||||
* @param opt
|
||||
* @param opt.hv Only horizontal or only vertical. Default to be [1, 1]
|
||||
* @param opt.boundingMode
|
||||
* Specify how to calculate boundingRect when locating.
|
||||
* 'all': Position the boundingRect that is transformed and uioned
|
||||
* both itself and its descendants.
|
||||
* This mode simplies confine the elements in the bounding
|
||||
* of their container (e.g., using 'right: 0').
|
||||
* 'raw': Position the boundingRect that is not transformed and only itself.
|
||||
* This mode is useful when you want a element can overflow its
|
||||
* container. (Consider a rotated circle needs to be located in a corner.)
|
||||
* In this mode positionInfo.width/height can only be number.
|
||||
*/
|
||||
export function positionElement(el, positionInfo, containerRect, margin, opt, out) {
|
||||
var h = !opt || !opt.hv || opt.hv[0];
|
||||
var v = !opt || !opt.hv || opt.hv[1];
|
||||
var boundingMode = opt && opt.boundingMode || 'all';
|
||||
out = out || el;
|
||||
out.x = el.x;
|
||||
out.y = el.y;
|
||||
if (!h && !v) {
|
||||
return false;
|
||||
}
|
||||
var rect;
|
||||
if (boundingMode === 'raw') {
|
||||
rect = el.type === 'group' ? new BoundingRect(0, 0, +positionInfo.width || 0, +positionInfo.height || 0) : el.getBoundingRect();
|
||||
} else {
|
||||
rect = el.getBoundingRect();
|
||||
if (el.needLocalTransform()) {
|
||||
var transform = el.getLocalTransform();
|
||||
// Notice: raw rect may be inner object of el,
|
||||
// which should not be modified.
|
||||
rect = rect.clone();
|
||||
rect.applyTransform(transform);
|
||||
}
|
||||
}
|
||||
// The real width and height can not be specified but calculated by the given el.
|
||||
var layoutRect = getLayoutRect(zrUtil.defaults({
|
||||
width: rect.width,
|
||||
height: rect.height
|
||||
}, positionInfo), containerRect, margin);
|
||||
// Because 'tranlate' is the last step in transform
|
||||
// (see zrender/core/Transformable#getLocalTransform),
|
||||
// we can just only modify el.position to get final result.
|
||||
var dx = h ? layoutRect.x - rect.x : 0;
|
||||
var dy = v ? layoutRect.y - rect.y : 0;
|
||||
if (boundingMode === 'raw') {
|
||||
out.x = dx;
|
||||
out.y = dy;
|
||||
} else {
|
||||
out.x += dx;
|
||||
out.y += dy;
|
||||
}
|
||||
if (out === el) {
|
||||
el.markRedraw();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* @param option Contains some of the properties in HV_NAMES.
|
||||
* @param hvIdx 0: horizontal; 1: vertical.
|
||||
*/
|
||||
export function sizeCalculable(option, hvIdx) {
|
||||
return option[HV_NAMES[hvIdx][0]] != null || option[HV_NAMES[hvIdx][1]] != null && option[HV_NAMES[hvIdx][2]] != null;
|
||||
}
|
||||
export function fetchLayoutMode(ins) {
|
||||
var layoutMode = ins.layoutMode || ins.constructor.layoutMode;
|
||||
return zrUtil.isObject(layoutMode) ? layoutMode : layoutMode ? {
|
||||
type: layoutMode
|
||||
} : null;
|
||||
}
|
||||
/**
|
||||
* Consider Case:
|
||||
* When default option has {left: 0, width: 100}, and we set {right: 0}
|
||||
* through setOption or media query, using normal zrUtil.merge will cause
|
||||
* {right: 0} does not take effect.
|
||||
*
|
||||
* @example
|
||||
* ComponentModel.extend({
|
||||
* init: function () {
|
||||
* ...
|
||||
* let inputPositionParams = layout.getLayoutParams(option);
|
||||
* this.mergeOption(inputPositionParams);
|
||||
* },
|
||||
* mergeOption: function (newOption) {
|
||||
* newOption && zrUtil.merge(thisOption, newOption, true);
|
||||
* layout.mergeLayoutParam(thisOption, newOption);
|
||||
* }
|
||||
* });
|
||||
*
|
||||
* @param targetOption
|
||||
* @param newOption
|
||||
* @param opt
|
||||
*/
|
||||
export function mergeLayoutParam(targetOption, newOption, opt) {
|
||||
var ignoreSize = opt && opt.ignoreSize;
|
||||
!zrUtil.isArray(ignoreSize) && (ignoreSize = [ignoreSize, ignoreSize]);
|
||||
var hResult = merge(HV_NAMES[0], 0);
|
||||
var vResult = merge(HV_NAMES[1], 1);
|
||||
copy(HV_NAMES[0], targetOption, hResult);
|
||||
copy(HV_NAMES[1], targetOption, vResult);
|
||||
function merge(names, hvIdx) {
|
||||
var newParams = {};
|
||||
var newValueCount = 0;
|
||||
var merged = {};
|
||||
var mergedValueCount = 0;
|
||||
var enoughParamNumber = 2;
|
||||
each(names, function (name) {
|
||||
merged[name] = targetOption[name];
|
||||
});
|
||||
each(names, function (name) {
|
||||
// Consider case: newOption.width is null, which is
|
||||
// set by user for removing width setting.
|
||||
hasProp(newOption, name) && (newParams[name] = merged[name] = newOption[name]);
|
||||
hasValue(newParams, name) && newValueCount++;
|
||||
hasValue(merged, name) && mergedValueCount++;
|
||||
});
|
||||
if (ignoreSize[hvIdx]) {
|
||||
// Only one of left/right is premitted to exist.
|
||||
if (hasValue(newOption, names[1])) {
|
||||
merged[names[2]] = null;
|
||||
} else if (hasValue(newOption, names[2])) {
|
||||
merged[names[1]] = null;
|
||||
}
|
||||
return merged;
|
||||
}
|
||||
// Case: newOption: {width: ..., right: ...},
|
||||
// or targetOption: {right: ...} and newOption: {width: ...},
|
||||
// There is no conflict when merged only has params count
|
||||
// little than enoughParamNumber.
|
||||
if (mergedValueCount === enoughParamNumber || !newValueCount) {
|
||||
return merged;
|
||||
}
|
||||
// Case: newOption: {width: ..., right: ...},
|
||||
// Than we can make sure user only want those two, and ignore
|
||||
// all origin params in targetOption.
|
||||
else if (newValueCount >= enoughParamNumber) {
|
||||
return newParams;
|
||||
} else {
|
||||
// Chose another param from targetOption by priority.
|
||||
for (var i = 0; i < names.length; i++) {
|
||||
var name_1 = names[i];
|
||||
if (!hasProp(newParams, name_1) && hasProp(targetOption, name_1)) {
|
||||
newParams[name_1] = targetOption[name_1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
return newParams;
|
||||
}
|
||||
}
|
||||
function hasProp(obj, name) {
|
||||
return obj.hasOwnProperty(name);
|
||||
}
|
||||
function hasValue(obj, name) {
|
||||
return obj[name] != null && obj[name] !== 'auto';
|
||||
}
|
||||
function copy(names, target, source) {
|
||||
each(names, function (name) {
|
||||
target[name] = source[name];
|
||||
});
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Retrieve 'left', 'right', 'top', 'bottom', 'width', 'height' from object.
|
||||
*/
|
||||
export function getLayoutParams(source) {
|
||||
return copyLayoutParams({}, source);
|
||||
}
|
||||
/**
|
||||
* Retrieve 'left', 'right', 'top', 'bottom', 'width', 'height' from object.
|
||||
* @param {Object} source
|
||||
* @return {Object} Result contains those props.
|
||||
*/
|
||||
export function copyLayoutParams(target, source) {
|
||||
source && target && each(LOCATION_PARAMS, function (name) {
|
||||
source.hasOwnProperty(name) && (target[name] = source[name]);
|
||||
});
|
||||
return target;
|
||||
}
|
134
frontend/node_modules/echarts/lib/util/log.js
generated
vendored
Normal file
134
frontend/node_modules/echarts/lib/util/log.js
generated
vendored
Normal file
@ -0,0 +1,134 @@
|
||||
|
||||
/*
|
||||
* 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 { map, isString, isFunction, eqNaN, isRegExp } from 'zrender/lib/core/util.js';
|
||||
var ECHARTS_PREFIX = '[ECharts] ';
|
||||
var storedLogs = {};
|
||||
var hasConsole = typeof console !== 'undefined'
|
||||
// eslint-disable-next-line
|
||||
&& console.warn && console.log;
|
||||
function outputLog(type, str, onlyOnce) {
|
||||
if (hasConsole) {
|
||||
if (onlyOnce) {
|
||||
if (storedLogs[str]) {
|
||||
return;
|
||||
}
|
||||
storedLogs[str] = true;
|
||||
}
|
||||
// eslint-disable-next-line
|
||||
console[type](ECHARTS_PREFIX + str);
|
||||
}
|
||||
}
|
||||
export function log(str, onlyOnce) {
|
||||
outputLog('log', str, onlyOnce);
|
||||
}
|
||||
export function warn(str, onlyOnce) {
|
||||
outputLog('warn', str, onlyOnce);
|
||||
}
|
||||
export function error(str, onlyOnce) {
|
||||
outputLog('error', str, onlyOnce);
|
||||
}
|
||||
export function deprecateLog(str) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
// Not display duplicate message.
|
||||
outputLog('warn', 'DEPRECATED: ' + str, true);
|
||||
}
|
||||
}
|
||||
export function deprecateReplaceLog(oldOpt, newOpt, scope) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
deprecateLog((scope ? "[" + scope + "]" : '') + (oldOpt + " is deprecated, use " + newOpt + " instead."));
|
||||
}
|
||||
}
|
||||
/**
|
||||
* If in __DEV__ environment, get console printable message for users hint.
|
||||
* Parameters are separated by ' '.
|
||||
* @usage
|
||||
* makePrintable('This is an error on', someVar, someObj);
|
||||
*
|
||||
* @param hintInfo anything about the current execution context to hint users.
|
||||
* @throws Error
|
||||
*/
|
||||
export function makePrintable() {
|
||||
var hintInfo = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
hintInfo[_i] = arguments[_i];
|
||||
}
|
||||
var msg = '';
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
// Fuzzy stringify for print.
|
||||
// This code only exist in dev environment.
|
||||
var makePrintableStringIfPossible_1 = function (val) {
|
||||
return val === void 0 ? 'undefined' : val === Infinity ? 'Infinity' : val === -Infinity ? '-Infinity' : eqNaN(val) ? 'NaN' : val instanceof Date ? 'Date(' + val.toISOString() + ')' : isFunction(val) ? 'function () { ... }' : isRegExp(val) ? val + '' : null;
|
||||
};
|
||||
msg = map(hintInfo, function (arg) {
|
||||
if (isString(arg)) {
|
||||
// Print without quotation mark for some statement.
|
||||
return arg;
|
||||
} else {
|
||||
var printableStr = makePrintableStringIfPossible_1(arg);
|
||||
if (printableStr != null) {
|
||||
return printableStr;
|
||||
} else if (typeof JSON !== 'undefined' && JSON.stringify) {
|
||||
try {
|
||||
return JSON.stringify(arg, function (n, val) {
|
||||
var printableStr = makePrintableStringIfPossible_1(val);
|
||||
return printableStr == null ? val : printableStr;
|
||||
});
|
||||
// In most cases the info object is small, so do not line break.
|
||||
} catch (err) {
|
||||
return '?';
|
||||
}
|
||||
} else {
|
||||
return '?';
|
||||
}
|
||||
}
|
||||
}).join(' ');
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
/**
|
||||
* @throws Error
|
||||
*/
|
||||
export function throwError(msg) {
|
||||
throw new Error(msg);
|
||||
}
|
695
frontend/node_modules/echarts/lib/util/model.js
generated
vendored
Normal file
695
frontend/node_modules/echarts/lib/util/model.js
generated
vendored
Normal file
@ -0,0 +1,695 @@
|
||||
|
||||
/*
|
||||
* 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 { each, isObject, isArray, createHashMap, map, assert, isString, indexOf, isStringSafe, isNumber } from 'zrender/lib/core/util.js';
|
||||
import env from 'zrender/lib/core/env.js';
|
||||
import { isNumeric, getRandomIdBase, getPrecision, round } from './number.js';
|
||||
import { warn } from './log.js';
|
||||
function interpolateNumber(p0, p1, percent) {
|
||||
return (p1 - p0) * percent + p0;
|
||||
}
|
||||
/**
|
||||
* Make the name displayable. But we should
|
||||
* make sure it is not duplicated with user
|
||||
* specified name, so use '\0';
|
||||
*/
|
||||
var DUMMY_COMPONENT_NAME_PREFIX = 'series\0';
|
||||
var INTERNAL_COMPONENT_ID_PREFIX = '\0_ec_\0';
|
||||
/**
|
||||
* If value is not array, then translate it to array.
|
||||
* @param {*} value
|
||||
* @return {Array} [value] or value
|
||||
*/
|
||||
export function normalizeToArray(value) {
|
||||
return value instanceof Array ? value : value == null ? [] : [value];
|
||||
}
|
||||
/**
|
||||
* Sync default option between normal and emphasis like `position` and `show`
|
||||
* In case some one will write code like
|
||||
* label: {
|
||||
* show: false,
|
||||
* position: 'outside',
|
||||
* fontSize: 18
|
||||
* },
|
||||
* emphasis: {
|
||||
* label: { show: true }
|
||||
* }
|
||||
*/
|
||||
export function defaultEmphasis(opt, key, subOpts) {
|
||||
// Caution: performance sensitive.
|
||||
if (opt) {
|
||||
opt[key] = opt[key] || {};
|
||||
opt.emphasis = opt.emphasis || {};
|
||||
opt.emphasis[key] = opt.emphasis[key] || {};
|
||||
// Default emphasis option from normal
|
||||
for (var i = 0, len = subOpts.length; i < len; i++) {
|
||||
var subOptName = subOpts[i];
|
||||
if (!opt.emphasis[key].hasOwnProperty(subOptName) && opt[key].hasOwnProperty(subOptName)) {
|
||||
opt.emphasis[key][subOptName] = opt[key][subOptName];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
export var TEXT_STYLE_OPTIONS = ['fontStyle', 'fontWeight', 'fontSize', 'fontFamily', 'rich', 'tag', 'color', 'textBorderColor', 'textBorderWidth', 'width', 'height', 'lineHeight', 'align', 'verticalAlign', 'baseline', 'shadowColor', 'shadowBlur', 'shadowOffsetX', 'shadowOffsetY', 'textShadowColor', 'textShadowBlur', 'textShadowOffsetX', 'textShadowOffsetY', 'backgroundColor', 'borderColor', 'borderWidth', 'borderRadius', 'padding'];
|
||||
// modelUtil.LABEL_OPTIONS = modelUtil.TEXT_STYLE_OPTIONS.concat([
|
||||
// 'position', 'offset', 'rotate', 'origin', 'show', 'distance', 'formatter',
|
||||
// 'fontStyle', 'fontWeight', 'fontSize', 'fontFamily',
|
||||
// // FIXME: deprecated, check and remove it.
|
||||
// 'textStyle'
|
||||
// ]);
|
||||
/**
|
||||
* The method does not ensure performance.
|
||||
* data could be [12, 2323, {value: 223}, [1221, 23], {value: [2, 23]}]
|
||||
* This helper method retrieves value from data.
|
||||
*/
|
||||
export function getDataItemValue(dataItem) {
|
||||
return isObject(dataItem) && !isArray(dataItem) && !(dataItem instanceof Date) ? dataItem.value : dataItem;
|
||||
}
|
||||
/**
|
||||
* data could be [12, 2323, {value: 223}, [1221, 23], {value: [2, 23]}]
|
||||
* This helper method determine if dataItem has extra option besides value
|
||||
*/
|
||||
export function isDataItemOption(dataItem) {
|
||||
return isObject(dataItem) && !(dataItem instanceof Array);
|
||||
// // markLine data can be array
|
||||
// && !(dataItem[0] && isObject(dataItem[0]) && !(dataItem[0] instanceof Array));
|
||||
}
|
||||
;
|
||||
/**
|
||||
* Mapping to existings for merge.
|
||||
*
|
||||
* Mode "normalMege":
|
||||
* The mapping result (merge result) will keep the order of the existing
|
||||
* component, rather than the order of new option. Because we should ensure
|
||||
* some specified index reference (like xAxisIndex) keep work.
|
||||
* And in most cases, "merge option" is used to update partial option but not
|
||||
* be expected to change the order.
|
||||
*
|
||||
* Mode "replaceMege":
|
||||
* (1) Only the id mapped components will be merged.
|
||||
* (2) Other existing components (except internal components) will be removed.
|
||||
* (3) Other new options will be used to create new component.
|
||||
* (4) The index of the existing components will not be modified.
|
||||
* That means their might be "hole" after the removal.
|
||||
* The new components are created first at those available index.
|
||||
*
|
||||
* Mode "replaceAll":
|
||||
* This mode try to support that reproduce an echarts instance from another
|
||||
* echarts instance (via `getOption`) in some simple cases.
|
||||
* In this scenario, the `result` index are exactly the consistent with the `newCmptOptions`,
|
||||
* which ensures the component index referring (like `xAxisIndex: ?`) corrent. That is,
|
||||
* the "hole" in `newCmptOptions` will also be kept.
|
||||
* On the contrary, other modes try best to eliminate holes.
|
||||
* PENDING: This is an experimental mode yet.
|
||||
*
|
||||
* @return See the comment of <MappingResult>.
|
||||
*/
|
||||
export function mappingToExists(existings, newCmptOptions, mode) {
|
||||
var isNormalMergeMode = mode === 'normalMerge';
|
||||
var isReplaceMergeMode = mode === 'replaceMerge';
|
||||
var isReplaceAllMode = mode === 'replaceAll';
|
||||
existings = existings || [];
|
||||
newCmptOptions = (newCmptOptions || []).slice();
|
||||
var existingIdIdxMap = createHashMap();
|
||||
// Validate id and name on user input option.
|
||||
each(newCmptOptions, function (cmptOption, index) {
|
||||
if (!isObject(cmptOption)) {
|
||||
newCmptOptions[index] = null;
|
||||
return;
|
||||
}
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
// There is some legacy case that name is set as `false`.
|
||||
// But should work normally rather than throw error.
|
||||
if (cmptOption.id != null && !isValidIdOrName(cmptOption.id)) {
|
||||
warnInvalidateIdOrName(cmptOption.id);
|
||||
}
|
||||
if (cmptOption.name != null && !isValidIdOrName(cmptOption.name)) {
|
||||
warnInvalidateIdOrName(cmptOption.name);
|
||||
}
|
||||
}
|
||||
});
|
||||
var result = prepareResult(existings, existingIdIdxMap, mode);
|
||||
if (isNormalMergeMode || isReplaceMergeMode) {
|
||||
mappingById(result, existings, existingIdIdxMap, newCmptOptions);
|
||||
}
|
||||
if (isNormalMergeMode) {
|
||||
mappingByName(result, newCmptOptions);
|
||||
}
|
||||
if (isNormalMergeMode || isReplaceMergeMode) {
|
||||
mappingByIndex(result, newCmptOptions, isReplaceMergeMode);
|
||||
} else if (isReplaceAllMode) {
|
||||
mappingInReplaceAllMode(result, newCmptOptions);
|
||||
}
|
||||
makeIdAndName(result);
|
||||
// The array `result` MUST NOT contain elided items, otherwise the
|
||||
// forEach will omit those items and result in incorrect result.
|
||||
return result;
|
||||
}
|
||||
function prepareResult(existings, existingIdIdxMap, mode) {
|
||||
var result = [];
|
||||
if (mode === 'replaceAll') {
|
||||
return result;
|
||||
}
|
||||
// Do not use native `map` to in case that the array `existings`
|
||||
// contains elided items, which will be omitted.
|
||||
for (var index = 0; index < existings.length; index++) {
|
||||
var existing = existings[index];
|
||||
// Because of replaceMerge, `existing` may be null/undefined.
|
||||
if (existing && existing.id != null) {
|
||||
existingIdIdxMap.set(existing.id, index);
|
||||
}
|
||||
// For non-internal-componnets:
|
||||
// Mode "normalMerge": all existings kept.
|
||||
// Mode "replaceMerge": all existing removed unless mapped by id.
|
||||
// For internal-components:
|
||||
// go with "replaceMerge" approach in both mode.
|
||||
result.push({
|
||||
existing: mode === 'replaceMerge' || isComponentIdInternal(existing) ? null : existing,
|
||||
newOption: null,
|
||||
keyInfo: null,
|
||||
brandNew: null
|
||||
});
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function mappingById(result, existings, existingIdIdxMap, newCmptOptions) {
|
||||
// Mapping by id if specified.
|
||||
each(newCmptOptions, function (cmptOption, index) {
|
||||
if (!cmptOption || cmptOption.id == null) {
|
||||
return;
|
||||
}
|
||||
var optionId = makeComparableKey(cmptOption.id);
|
||||
var existingIdx = existingIdIdxMap.get(optionId);
|
||||
if (existingIdx != null) {
|
||||
var resultItem = result[existingIdx];
|
||||
assert(!resultItem.newOption, 'Duplicated option on id "' + optionId + '".');
|
||||
resultItem.newOption = cmptOption;
|
||||
// In both mode, if id matched, new option will be merged to
|
||||
// the existings rather than creating new component model.
|
||||
resultItem.existing = existings[existingIdx];
|
||||
newCmptOptions[index] = null;
|
||||
}
|
||||
});
|
||||
}
|
||||
function mappingByName(result, newCmptOptions) {
|
||||
// Mapping by name if specified.
|
||||
each(newCmptOptions, function (cmptOption, index) {
|
||||
if (!cmptOption || cmptOption.name == null) {
|
||||
return;
|
||||
}
|
||||
for (var i = 0; i < result.length; i++) {
|
||||
var existing = result[i].existing;
|
||||
if (!result[i].newOption // Consider name: two map to one.
|
||||
// Can not match when both ids existing but different.
|
||||
&& existing && (existing.id == null || cmptOption.id == null) && !isComponentIdInternal(cmptOption) && !isComponentIdInternal(existing) && keyExistAndEqual('name', existing, cmptOption)) {
|
||||
result[i].newOption = cmptOption;
|
||||
newCmptOptions[index] = null;
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
function mappingByIndex(result, newCmptOptions, brandNew) {
|
||||
each(newCmptOptions, function (cmptOption) {
|
||||
if (!cmptOption) {
|
||||
return;
|
||||
}
|
||||
// Find the first place that not mapped by id and not internal component (consider the "hole").
|
||||
var resultItem;
|
||||
var nextIdx = 0;
|
||||
while (
|
||||
// Be `!resultItem` only when `nextIdx >= result.length`.
|
||||
(resultItem = result[nextIdx]
|
||||
// (1) Existing models that already have id should be able to mapped to. Because
|
||||
// after mapping performed, model will always be assigned with an id if user not given.
|
||||
// After that all models have id.
|
||||
// (2) If new option has id, it can only set to a hole or append to the last. It should
|
||||
// not be merged to the existings with different id. Because id should not be overwritten.
|
||||
// (3) Name can be overwritten, because axis use name as 'show label text'.
|
||||
) && (resultItem.newOption || isComponentIdInternal(resultItem.existing) ||
|
||||
// In mode "replaceMerge", here no not-mapped-non-internal-existing.
|
||||
resultItem.existing && cmptOption.id != null && !keyExistAndEqual('id', cmptOption, resultItem.existing))) {
|
||||
nextIdx++;
|
||||
}
|
||||
if (resultItem) {
|
||||
resultItem.newOption = cmptOption;
|
||||
resultItem.brandNew = brandNew;
|
||||
} else {
|
||||
result.push({
|
||||
newOption: cmptOption,
|
||||
brandNew: brandNew,
|
||||
existing: null,
|
||||
keyInfo: null
|
||||
});
|
||||
}
|
||||
nextIdx++;
|
||||
});
|
||||
}
|
||||
function mappingInReplaceAllMode(result, newCmptOptions) {
|
||||
each(newCmptOptions, function (cmptOption) {
|
||||
// The feature "reproduce" requires "hole" will also reproduced
|
||||
// in case that component index referring are broken.
|
||||
result.push({
|
||||
newOption: cmptOption,
|
||||
brandNew: true,
|
||||
existing: null,
|
||||
keyInfo: null
|
||||
});
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Make id and name for mapping result (result of mappingToExists)
|
||||
* into `keyInfo` field.
|
||||
*/
|
||||
function makeIdAndName(mapResult) {
|
||||
// We use this id to hash component models and view instances
|
||||
// in echarts. id can be specified by user, or auto generated.
|
||||
// The id generation rule ensures new view instance are able
|
||||
// to mapped to old instance when setOption are called in
|
||||
// no-merge mode. So we generate model id by name and plus
|
||||
// type in view id.
|
||||
// name can be duplicated among components, which is convenient
|
||||
// to specify multi components (like series) by one name.
|
||||
// Ensure that each id is distinct.
|
||||
var idMap = createHashMap();
|
||||
each(mapResult, function (item) {
|
||||
var existing = item.existing;
|
||||
existing && idMap.set(existing.id, item);
|
||||
});
|
||||
each(mapResult, function (item) {
|
||||
var opt = item.newOption;
|
||||
// Force ensure id not duplicated.
|
||||
assert(!opt || opt.id == null || !idMap.get(opt.id) || idMap.get(opt.id) === item, 'id duplicates: ' + (opt && opt.id));
|
||||
opt && opt.id != null && idMap.set(opt.id, item);
|
||||
!item.keyInfo && (item.keyInfo = {});
|
||||
});
|
||||
// Make name and id.
|
||||
each(mapResult, function (item, index) {
|
||||
var existing = item.existing;
|
||||
var opt = item.newOption;
|
||||
var keyInfo = item.keyInfo;
|
||||
if (!isObject(opt)) {
|
||||
return;
|
||||
}
|
||||
// Name can be overwritten. Consider case: axis.name = '20km'.
|
||||
// But id generated by name will not be changed, which affect
|
||||
// only in that case: setOption with 'not merge mode' and view
|
||||
// instance will be recreated, which can be accepted.
|
||||
keyInfo.name = opt.name != null ? makeComparableKey(opt.name) : existing ? existing.name
|
||||
// Avoid that different series has the same name,
|
||||
// because name may be used like in color pallet.
|
||||
: DUMMY_COMPONENT_NAME_PREFIX + index;
|
||||
if (existing) {
|
||||
keyInfo.id = makeComparableKey(existing.id);
|
||||
} else if (opt.id != null) {
|
||||
keyInfo.id = makeComparableKey(opt.id);
|
||||
} else {
|
||||
// Consider this situatoin:
|
||||
// optionA: [{name: 'a'}, {name: 'a'}, {..}]
|
||||
// optionB [{..}, {name: 'a'}, {name: 'a'}]
|
||||
// Series with the same name between optionA and optionB
|
||||
// should be mapped.
|
||||
var idNum = 0;
|
||||
do {
|
||||
keyInfo.id = '\0' + keyInfo.name + '\0' + idNum++;
|
||||
} while (idMap.get(keyInfo.id));
|
||||
}
|
||||
idMap.set(keyInfo.id, item);
|
||||
});
|
||||
}
|
||||
function keyExistAndEqual(attr, obj1, obj2) {
|
||||
var key1 = convertOptionIdName(obj1[attr], null);
|
||||
var key2 = convertOptionIdName(obj2[attr], null);
|
||||
// See `MappingExistingItem`. `id` and `name` trade string equals to number.
|
||||
return key1 != null && key2 != null && key1 === key2;
|
||||
}
|
||||
/**
|
||||
* @return return null if not exist.
|
||||
*/
|
||||
function makeComparableKey(val) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (val == null) {
|
||||
throw new Error();
|
||||
}
|
||||
}
|
||||
return convertOptionIdName(val, '');
|
||||
}
|
||||
export function convertOptionIdName(idOrName, defaultValue) {
|
||||
if (idOrName == null) {
|
||||
return defaultValue;
|
||||
}
|
||||
return isString(idOrName) ? idOrName : isNumber(idOrName) || isStringSafe(idOrName) ? idOrName + '' : defaultValue;
|
||||
}
|
||||
function warnInvalidateIdOrName(idOrName) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
warn('`' + idOrName + '` is invalid id or name. Must be a string or number.');
|
||||
}
|
||||
}
|
||||
function isValidIdOrName(idOrName) {
|
||||
return isStringSafe(idOrName) || isNumeric(idOrName);
|
||||
}
|
||||
export function isNameSpecified(componentModel) {
|
||||
var name = componentModel.name;
|
||||
// Is specified when `indexOf` get -1 or > 0.
|
||||
return !!(name && name.indexOf(DUMMY_COMPONENT_NAME_PREFIX));
|
||||
}
|
||||
/**
|
||||
* @public
|
||||
* @param {Object} cmptOption
|
||||
* @return {boolean}
|
||||
*/
|
||||
export function isComponentIdInternal(cmptOption) {
|
||||
return cmptOption && cmptOption.id != null && makeComparableKey(cmptOption.id).indexOf(INTERNAL_COMPONENT_ID_PREFIX) === 0;
|
||||
}
|
||||
export function makeInternalComponentId(idSuffix) {
|
||||
return INTERNAL_COMPONENT_ID_PREFIX + idSuffix;
|
||||
}
|
||||
export function setComponentTypeToKeyInfo(mappingResult, mainType, componentModelCtor) {
|
||||
// Set mainType and complete subType.
|
||||
each(mappingResult, function (item) {
|
||||
var newOption = item.newOption;
|
||||
if (isObject(newOption)) {
|
||||
item.keyInfo.mainType = mainType;
|
||||
item.keyInfo.subType = determineSubType(mainType, newOption, item.existing, componentModelCtor);
|
||||
}
|
||||
});
|
||||
}
|
||||
function determineSubType(mainType, newCmptOption, existComponent, componentModelCtor) {
|
||||
var subType = newCmptOption.type ? newCmptOption.type : existComponent ? existComponent.subType
|
||||
// Use determineSubType only when there is no existComponent.
|
||||
: componentModelCtor.determineSubType(mainType, newCmptOption);
|
||||
// tooltip, markline, markpoint may always has no subType
|
||||
return subType;
|
||||
}
|
||||
/**
|
||||
* A helper for removing duplicate items between batchA and batchB,
|
||||
* and in themselves, and categorize by series.
|
||||
*
|
||||
* @param batchA Like: [{seriesId: 2, dataIndex: [32, 4, 5]}, ...]
|
||||
* @param batchB Like: [{seriesId: 2, dataIndex: [32, 4, 5]}, ...]
|
||||
* @return result: [resultBatchA, resultBatchB]
|
||||
*/
|
||||
export function compressBatches(batchA, batchB) {
|
||||
var mapA = {};
|
||||
var mapB = {};
|
||||
makeMap(batchA || [], mapA);
|
||||
makeMap(batchB || [], mapB, mapA);
|
||||
return [mapToArray(mapA), mapToArray(mapB)];
|
||||
function makeMap(sourceBatch, map, otherMap) {
|
||||
for (var i = 0, len = sourceBatch.length; i < len; i++) {
|
||||
var seriesId = convertOptionIdName(sourceBatch[i].seriesId, null);
|
||||
if (seriesId == null) {
|
||||
return;
|
||||
}
|
||||
var dataIndices = normalizeToArray(sourceBatch[i].dataIndex);
|
||||
var otherDataIndices = otherMap && otherMap[seriesId];
|
||||
for (var j = 0, lenj = dataIndices.length; j < lenj; j++) {
|
||||
var dataIndex = dataIndices[j];
|
||||
if (otherDataIndices && otherDataIndices[dataIndex]) {
|
||||
otherDataIndices[dataIndex] = null;
|
||||
} else {
|
||||
(map[seriesId] || (map[seriesId] = {}))[dataIndex] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function mapToArray(map, isData) {
|
||||
var result = [];
|
||||
for (var i in map) {
|
||||
if (map.hasOwnProperty(i) && map[i] != null) {
|
||||
if (isData) {
|
||||
result.push(+i);
|
||||
} else {
|
||||
var dataIndices = mapToArray(map[i], true);
|
||||
dataIndices.length && result.push({
|
||||
seriesId: i,
|
||||
dataIndex: dataIndices
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @param payload Contains dataIndex (means rawIndex) / dataIndexInside / name
|
||||
* each of which can be Array or primary type.
|
||||
* @return dataIndex If not found, return undefined/null.
|
||||
*/
|
||||
export function queryDataIndex(data, payload) {
|
||||
if (payload.dataIndexInside != null) {
|
||||
return payload.dataIndexInside;
|
||||
} else if (payload.dataIndex != null) {
|
||||
return isArray(payload.dataIndex) ? map(payload.dataIndex, function (value) {
|
||||
return data.indexOfRawIndex(value);
|
||||
}) : data.indexOfRawIndex(payload.dataIndex);
|
||||
} else if (payload.name != null) {
|
||||
return isArray(payload.name) ? map(payload.name, function (value) {
|
||||
return data.indexOfName(value);
|
||||
}) : data.indexOfName(payload.name);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Enable property storage to any host object.
|
||||
* Notice: Serialization is not supported.
|
||||
*
|
||||
* For example:
|
||||
* let inner = zrUitl.makeInner();
|
||||
*
|
||||
* function some1(hostObj) {
|
||||
* inner(hostObj).someProperty = 1212;
|
||||
* ...
|
||||
* }
|
||||
* function some2() {
|
||||
* let fields = inner(this);
|
||||
* fields.someProperty1 = 1212;
|
||||
* fields.someProperty2 = 'xx';
|
||||
* ...
|
||||
* }
|
||||
*
|
||||
* @return {Function}
|
||||
*/
|
||||
export function makeInner() {
|
||||
var key = '__ec_inner_' + innerUniqueIndex++;
|
||||
return function (hostObj) {
|
||||
return hostObj[key] || (hostObj[key] = {});
|
||||
};
|
||||
}
|
||||
var innerUniqueIndex = getRandomIdBase();
|
||||
/**
|
||||
* The same behavior as `component.getReferringComponents`.
|
||||
*/
|
||||
export function parseFinder(ecModel, finderInput, opt) {
|
||||
var _a = preParseFinder(finderInput, opt),
|
||||
mainTypeSpecified = _a.mainTypeSpecified,
|
||||
queryOptionMap = _a.queryOptionMap,
|
||||
others = _a.others;
|
||||
var result = others;
|
||||
var defaultMainType = opt ? opt.defaultMainType : null;
|
||||
if (!mainTypeSpecified && defaultMainType) {
|
||||
queryOptionMap.set(defaultMainType, {});
|
||||
}
|
||||
queryOptionMap.each(function (queryOption, mainType) {
|
||||
var queryResult = queryReferringComponents(ecModel, mainType, queryOption, {
|
||||
useDefault: defaultMainType === mainType,
|
||||
enableAll: opt && opt.enableAll != null ? opt.enableAll : true,
|
||||
enableNone: opt && opt.enableNone != null ? opt.enableNone : true
|
||||
});
|
||||
result[mainType + 'Models'] = queryResult.models;
|
||||
result[mainType + 'Model'] = queryResult.models[0];
|
||||
});
|
||||
return result;
|
||||
}
|
||||
export function preParseFinder(finderInput, opt) {
|
||||
var finder;
|
||||
if (isString(finderInput)) {
|
||||
var obj = {};
|
||||
obj[finderInput + 'Index'] = 0;
|
||||
finder = obj;
|
||||
} else {
|
||||
finder = finderInput;
|
||||
}
|
||||
var queryOptionMap = createHashMap();
|
||||
var others = {};
|
||||
var mainTypeSpecified = false;
|
||||
each(finder, function (value, key) {
|
||||
// Exclude 'dataIndex' and other illgal keys.
|
||||
if (key === 'dataIndex' || key === 'dataIndexInside') {
|
||||
others[key] = value;
|
||||
return;
|
||||
}
|
||||
var parsedKey = key.match(/^(\w+)(Index|Id|Name)$/) || [];
|
||||
var mainType = parsedKey[1];
|
||||
var queryType = (parsedKey[2] || '').toLowerCase();
|
||||
if (!mainType || !queryType || opt && opt.includeMainTypes && indexOf(opt.includeMainTypes, mainType) < 0) {
|
||||
return;
|
||||
}
|
||||
mainTypeSpecified = mainTypeSpecified || !!mainType;
|
||||
var queryOption = queryOptionMap.get(mainType) || queryOptionMap.set(mainType, {});
|
||||
queryOption[queryType] = value;
|
||||
});
|
||||
return {
|
||||
mainTypeSpecified: mainTypeSpecified,
|
||||
queryOptionMap: queryOptionMap,
|
||||
others: others
|
||||
};
|
||||
}
|
||||
export var SINGLE_REFERRING = {
|
||||
useDefault: true,
|
||||
enableAll: false,
|
||||
enableNone: false
|
||||
};
|
||||
export var MULTIPLE_REFERRING = {
|
||||
useDefault: false,
|
||||
enableAll: true,
|
||||
enableNone: true
|
||||
};
|
||||
export function queryReferringComponents(ecModel, mainType, userOption, opt) {
|
||||
opt = opt || SINGLE_REFERRING;
|
||||
var indexOption = userOption.index;
|
||||
var idOption = userOption.id;
|
||||
var nameOption = userOption.name;
|
||||
var result = {
|
||||
models: null,
|
||||
specified: indexOption != null || idOption != null || nameOption != null
|
||||
};
|
||||
if (!result.specified) {
|
||||
// Use the first as default if `useDefault`.
|
||||
var firstCmpt = void 0;
|
||||
result.models = opt.useDefault && (firstCmpt = ecModel.getComponent(mainType)) ? [firstCmpt] : [];
|
||||
return result;
|
||||
}
|
||||
if (indexOption === 'none' || indexOption === false) {
|
||||
assert(opt.enableNone, '`"none"` or `false` is not a valid value on index option.');
|
||||
result.models = [];
|
||||
return result;
|
||||
}
|
||||
// `queryComponents` will return all components if
|
||||
// both all of index/id/name are null/undefined.
|
||||
if (indexOption === 'all') {
|
||||
assert(opt.enableAll, '`"all"` is not a valid value on index option.');
|
||||
indexOption = idOption = nameOption = null;
|
||||
}
|
||||
result.models = ecModel.queryComponents({
|
||||
mainType: mainType,
|
||||
index: indexOption,
|
||||
id: idOption,
|
||||
name: nameOption
|
||||
});
|
||||
return result;
|
||||
}
|
||||
export function setAttribute(dom, key, value) {
|
||||
dom.setAttribute ? dom.setAttribute(key, value) : dom[key] = value;
|
||||
}
|
||||
export function getAttribute(dom, key) {
|
||||
return dom.getAttribute ? dom.getAttribute(key) : dom[key];
|
||||
}
|
||||
export function getTooltipRenderMode(renderModeOption) {
|
||||
if (renderModeOption === 'auto') {
|
||||
// Using html when `document` exists, use richText otherwise
|
||||
return env.domSupported ? 'html' : 'richText';
|
||||
} else {
|
||||
return renderModeOption || 'html';
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Group a list by key.
|
||||
*/
|
||||
export function groupData(array, getKey // return key
|
||||
) {
|
||||
var buckets = createHashMap();
|
||||
var keys = [];
|
||||
each(array, function (item) {
|
||||
var key = getKey(item);
|
||||
(buckets.get(key) || (keys.push(key), buckets.set(key, []))).push(item);
|
||||
});
|
||||
return {
|
||||
keys: keys,
|
||||
buckets: buckets
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Interpolate raw values of a series with percent
|
||||
*
|
||||
* @param data data
|
||||
* @param labelModel label model of the text element
|
||||
* @param sourceValue start value. May be null/undefined when init.
|
||||
* @param targetValue end value
|
||||
* @param percent 0~1 percentage; 0 uses start value while 1 uses end value
|
||||
* @return interpolated values
|
||||
* If `sourceValue` and `targetValue` are `number`, return `number`.
|
||||
* If `sourceValue` and `targetValue` are `string`, return `string`.
|
||||
* If `sourceValue` and `targetValue` are `(string | number)[]`, return `(string | number)[]`.
|
||||
* Other cases do not supported.
|
||||
*/
|
||||
export function interpolateRawValues(data, precision, sourceValue, targetValue, percent) {
|
||||
var isAutoPrecision = precision == null || precision === 'auto';
|
||||
if (targetValue == null) {
|
||||
return targetValue;
|
||||
}
|
||||
if (isNumber(targetValue)) {
|
||||
var value = interpolateNumber(sourceValue || 0, targetValue, percent);
|
||||
return round(value, isAutoPrecision ? Math.max(getPrecision(sourceValue || 0), getPrecision(targetValue)) : precision);
|
||||
} else if (isString(targetValue)) {
|
||||
return percent < 1 ? sourceValue : targetValue;
|
||||
} else {
|
||||
var interpolated = [];
|
||||
var leftArr = sourceValue;
|
||||
var rightArr = targetValue;
|
||||
var length_1 = Math.max(leftArr ? leftArr.length : 0, rightArr.length);
|
||||
for (var i = 0; i < length_1; ++i) {
|
||||
var info = data.getDimensionInfo(i);
|
||||
// Don't interpolate ordinal dims
|
||||
if (info && info.type === 'ordinal') {
|
||||
// In init, there is no `sourceValue`, but should better not to get undefined result.
|
||||
interpolated[i] = (percent < 1 && leftArr ? leftArr : rightArr)[i];
|
||||
} else {
|
||||
var leftVal = leftArr && leftArr[i] ? leftArr[i] : 0;
|
||||
var rightVal = rightArr[i];
|
||||
var value = interpolateNumber(leftVal, rightVal, percent);
|
||||
interpolated[i] = round(value, isAutoPrecision ? Math.max(getPrecision(leftVal), getPrecision(rightVal)) : precision);
|
||||
}
|
||||
}
|
||||
return interpolated;
|
||||
}
|
||||
}
|
563
frontend/node_modules/echarts/lib/util/number.js
generated
vendored
Normal file
563
frontend/node_modules/echarts/lib/util/number.js
generated
vendored
Normal file
@ -0,0 +1,563 @@
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
/*
|
||||
* A third-party license is embedded for some of the code in this file:
|
||||
* The method "quantile" was copied from "d3.js".
|
||||
* (See more details in the comment of the method below.)
|
||||
* The use of the source code of this file is also subject to the terms
|
||||
* and consitions of the license of "d3.js" (BSD-3Clause, see
|
||||
* </licenses/LICENSE-d3>).
|
||||
*/
|
||||
import * as zrUtil from 'zrender/lib/core/util.js';
|
||||
var RADIAN_EPSILON = 1e-4;
|
||||
// Although chrome already enlarge this number to 100 for `toFixed`, but
|
||||
// we sill follow the spec for compatibility.
|
||||
var ROUND_SUPPORTED_PRECISION_MAX = 20;
|
||||
function _trim(str) {
|
||||
return str.replace(/^\s+|\s+$/g, '');
|
||||
}
|
||||
/**
|
||||
* Linear mapping a value from domain to range
|
||||
* @param val
|
||||
* @param domain Domain extent domain[0] can be bigger than domain[1]
|
||||
* @param range Range extent range[0] can be bigger than range[1]
|
||||
* @param clamp Default to be false
|
||||
*/
|
||||
export function linearMap(val, domain, range, clamp) {
|
||||
var d0 = domain[0];
|
||||
var d1 = domain[1];
|
||||
var r0 = range[0];
|
||||
var r1 = range[1];
|
||||
var subDomain = d1 - d0;
|
||||
var subRange = r1 - r0;
|
||||
if (subDomain === 0) {
|
||||
return subRange === 0 ? r0 : (r0 + r1) / 2;
|
||||
}
|
||||
// Avoid accuracy problem in edge, such as
|
||||
// 146.39 - 62.83 === 83.55999999999999.
|
||||
// See echarts/test/ut/spec/util/number.js#linearMap#accuracyError
|
||||
// It is a little verbose for efficiency considering this method
|
||||
// is a hotspot.
|
||||
if (clamp) {
|
||||
if (subDomain > 0) {
|
||||
if (val <= d0) {
|
||||
return r0;
|
||||
} else if (val >= d1) {
|
||||
return r1;
|
||||
}
|
||||
} else {
|
||||
if (val >= d0) {
|
||||
return r0;
|
||||
} else if (val <= d1) {
|
||||
return r1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (val === d0) {
|
||||
return r0;
|
||||
}
|
||||
if (val === d1) {
|
||||
return r1;
|
||||
}
|
||||
}
|
||||
return (val - d0) / subDomain * subRange + r0;
|
||||
}
|
||||
/**
|
||||
* Convert a percent string to absolute number.
|
||||
* Returns NaN if percent is not a valid string or number
|
||||
*/
|
||||
export function parsePercent(percent, all) {
|
||||
switch (percent) {
|
||||
case 'center':
|
||||
case 'middle':
|
||||
percent = '50%';
|
||||
break;
|
||||
case 'left':
|
||||
case 'top':
|
||||
percent = '0%';
|
||||
break;
|
||||
case 'right':
|
||||
case 'bottom':
|
||||
percent = '100%';
|
||||
break;
|
||||
}
|
||||
if (zrUtil.isString(percent)) {
|
||||
if (_trim(percent).match(/%$/)) {
|
||||
return parseFloat(percent) / 100 * all;
|
||||
}
|
||||
return parseFloat(percent);
|
||||
}
|
||||
return percent == null ? NaN : +percent;
|
||||
}
|
||||
export function round(x, precision, returnStr) {
|
||||
if (precision == null) {
|
||||
precision = 10;
|
||||
}
|
||||
// Avoid range error
|
||||
precision = Math.min(Math.max(0, precision), ROUND_SUPPORTED_PRECISION_MAX);
|
||||
// PENDING: 1.005.toFixed(2) is '1.00' rather than '1.01'
|
||||
x = (+x).toFixed(precision);
|
||||
return returnStr ? x : +x;
|
||||
}
|
||||
/**
|
||||
* Inplacd asc sort arr.
|
||||
* The input arr will be modified.
|
||||
*/
|
||||
export function asc(arr) {
|
||||
arr.sort(function (a, b) {
|
||||
return a - b;
|
||||
});
|
||||
return arr;
|
||||
}
|
||||
/**
|
||||
* Get precision.
|
||||
*/
|
||||
export function getPrecision(val) {
|
||||
val = +val;
|
||||
if (isNaN(val)) {
|
||||
return 0;
|
||||
}
|
||||
// It is much faster than methods converting number to string as follows
|
||||
// let tmp = val.toString();
|
||||
// return tmp.length - 1 - tmp.indexOf('.');
|
||||
// especially when precision is low
|
||||
// Notice:
|
||||
// (1) If the loop count is over about 20, it is slower than `getPrecisionSafe`.
|
||||
// (see https://jsbench.me/2vkpcekkvw/1)
|
||||
// (2) If the val is less than for example 1e-15, the result may be incorrect.
|
||||
// (see test/ut/spec/util/number.test.ts `getPrecision_equal_random`)
|
||||
if (val > 1e-14) {
|
||||
var e = 1;
|
||||
for (var i = 0; i < 15; i++, e *= 10) {
|
||||
if (Math.round(val * e) / e === val) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
return getPrecisionSafe(val);
|
||||
}
|
||||
/**
|
||||
* Get precision with slow but safe method
|
||||
*/
|
||||
export function getPrecisionSafe(val) {
|
||||
// toLowerCase for: '3.4E-12'
|
||||
var str = val.toString().toLowerCase();
|
||||
// Consider scientific notation: '3.4e-12' '3.4e+12'
|
||||
var eIndex = str.indexOf('e');
|
||||
var exp = eIndex > 0 ? +str.slice(eIndex + 1) : 0;
|
||||
var significandPartLen = eIndex > 0 ? eIndex : str.length;
|
||||
var dotIndex = str.indexOf('.');
|
||||
var decimalPartLen = dotIndex < 0 ? 0 : significandPartLen - 1 - dotIndex;
|
||||
return Math.max(0, decimalPartLen - exp);
|
||||
}
|
||||
/**
|
||||
* Minimal dicernible data precisioin according to a single pixel.
|
||||
*/
|
||||
export function getPixelPrecision(dataExtent, pixelExtent) {
|
||||
var log = Math.log;
|
||||
var LN10 = Math.LN10;
|
||||
var dataQuantity = Math.floor(log(dataExtent[1] - dataExtent[0]) / LN10);
|
||||
var sizeQuantity = Math.round(log(Math.abs(pixelExtent[1] - pixelExtent[0])) / LN10);
|
||||
// toFixed() digits argument must be between 0 and 20.
|
||||
var precision = Math.min(Math.max(-dataQuantity + sizeQuantity, 0), 20);
|
||||
return !isFinite(precision) ? 20 : precision;
|
||||
}
|
||||
/**
|
||||
* Get a data of given precision, assuring the sum of percentages
|
||||
* in valueList is 1.
|
||||
* The largest remainder method is used.
|
||||
* https://en.wikipedia.org/wiki/Largest_remainder_method
|
||||
*
|
||||
* @param valueList a list of all data
|
||||
* @param idx index of the data to be processed in valueList
|
||||
* @param precision integer number showing digits of precision
|
||||
* @return percent ranging from 0 to 100
|
||||
*/
|
||||
export function getPercentWithPrecision(valueList, idx, precision) {
|
||||
if (!valueList[idx]) {
|
||||
return 0;
|
||||
}
|
||||
var seats = getPercentSeats(valueList, precision);
|
||||
return seats[idx] || 0;
|
||||
}
|
||||
/**
|
||||
* Get a data of given precision, assuring the sum of percentages
|
||||
* in valueList is 1.
|
||||
* The largest remainder method is used.
|
||||
* https://en.wikipedia.org/wiki/Largest_remainder_method
|
||||
*
|
||||
* @param valueList a list of all data
|
||||
* @param precision integer number showing digits of precision
|
||||
* @return {Array<number>}
|
||||
*/
|
||||
export function getPercentSeats(valueList, precision) {
|
||||
var sum = zrUtil.reduce(valueList, function (acc, val) {
|
||||
return acc + (isNaN(val) ? 0 : val);
|
||||
}, 0);
|
||||
if (sum === 0) {
|
||||
return [];
|
||||
}
|
||||
var digits = Math.pow(10, precision);
|
||||
var votesPerQuota = zrUtil.map(valueList, function (val) {
|
||||
return (isNaN(val) ? 0 : val) / sum * digits * 100;
|
||||
});
|
||||
var targetSeats = digits * 100;
|
||||
var seats = zrUtil.map(votesPerQuota, function (votes) {
|
||||
// Assign automatic seats.
|
||||
return Math.floor(votes);
|
||||
});
|
||||
var currentSum = zrUtil.reduce(seats, function (acc, val) {
|
||||
return acc + val;
|
||||
}, 0);
|
||||
var remainder = zrUtil.map(votesPerQuota, function (votes, idx) {
|
||||
return votes - seats[idx];
|
||||
});
|
||||
// Has remainding votes.
|
||||
while (currentSum < targetSeats) {
|
||||
// Find next largest remainder.
|
||||
var max = Number.NEGATIVE_INFINITY;
|
||||
var maxId = null;
|
||||
for (var i = 0, len = remainder.length; i < len; ++i) {
|
||||
if (remainder[i] > max) {
|
||||
max = remainder[i];
|
||||
maxId = i;
|
||||
}
|
||||
}
|
||||
// Add a vote to max remainder.
|
||||
++seats[maxId];
|
||||
remainder[maxId] = 0;
|
||||
++currentSum;
|
||||
}
|
||||
return zrUtil.map(seats, function (seat) {
|
||||
return seat / digits;
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Solve the floating point adding problem like 0.1 + 0.2 === 0.30000000000000004
|
||||
* See <http://0.30000000000000004.com/>
|
||||
*/
|
||||
export function addSafe(val0, val1) {
|
||||
var maxPrecision = Math.max(getPrecision(val0), getPrecision(val1));
|
||||
// const multiplier = Math.pow(10, maxPrecision);
|
||||
// return (Math.round(val0 * multiplier) + Math.round(val1 * multiplier)) / multiplier;
|
||||
var sum = val0 + val1;
|
||||
// // PENDING: support more?
|
||||
return maxPrecision > ROUND_SUPPORTED_PRECISION_MAX ? sum : round(sum, maxPrecision);
|
||||
}
|
||||
// Number.MAX_SAFE_INTEGER, ie do not support.
|
||||
export var MAX_SAFE_INTEGER = 9007199254740991;
|
||||
/**
|
||||
* To 0 - 2 * PI, considering negative radian.
|
||||
*/
|
||||
export function remRadian(radian) {
|
||||
var pi2 = Math.PI * 2;
|
||||
return (radian % pi2 + pi2) % pi2;
|
||||
}
|
||||
/**
|
||||
* @param {type} radian
|
||||
* @return {boolean}
|
||||
*/
|
||||
export function isRadianAroundZero(val) {
|
||||
return val > -RADIAN_EPSILON && val < RADIAN_EPSILON;
|
||||
}
|
||||
// eslint-disable-next-line
|
||||
var TIME_REG = /^(?:(\d{4})(?:[-\/](\d{1,2})(?:[-\/](\d{1,2})(?:[T ](\d{1,2})(?::(\d{1,2})(?::(\d{1,2})(?:[.,](\d+))?)?)?(Z|[\+\-]\d\d:?\d\d)?)?)?)?)?$/; // jshint ignore:line
|
||||
/**
|
||||
* @param value valid type: number | string | Date, otherwise return `new Date(NaN)`
|
||||
* These values can be accepted:
|
||||
* + An instance of Date, represent a time in its own time zone.
|
||||
* + Or string in a subset of ISO 8601, only including:
|
||||
* + only year, month, date: '2012-03', '2012-03-01', '2012-03-01 05', '2012-03-01 05:06',
|
||||
* + separated with T or space: '2012-03-01T12:22:33.123', '2012-03-01 12:22:33.123',
|
||||
* + time zone: '2012-03-01T12:22:33Z', '2012-03-01T12:22:33+8000', '2012-03-01T12:22:33-05:00',
|
||||
* all of which will be treated as local time if time zone is not specified
|
||||
* (see <https://momentjs.com/>).
|
||||
* + Or other string format, including (all of which will be treated as local time):
|
||||
* '2012', '2012-3-1', '2012/3/1', '2012/03/01',
|
||||
* '2009/6/12 2:00', '2009/6/12 2:05:08', '2009/6/12 2:05:08.123'
|
||||
* + a timestamp, which represent a time in UTC.
|
||||
* @return date Never be null/undefined. If invalid, return `new Date(NaN)`.
|
||||
*/
|
||||
export function parseDate(value) {
|
||||
if (value instanceof Date) {
|
||||
return value;
|
||||
} else if (zrUtil.isString(value)) {
|
||||
// Different browsers parse date in different way, so we parse it manually.
|
||||
// Some other issues:
|
||||
// new Date('1970-01-01') is UTC,
|
||||
// new Date('1970/01/01') and new Date('1970-1-01') is local.
|
||||
// See issue #3623
|
||||
var match = TIME_REG.exec(value);
|
||||
if (!match) {
|
||||
// return Invalid Date.
|
||||
return new Date(NaN);
|
||||
}
|
||||
// Use local time when no timezone offset is specified.
|
||||
if (!match[8]) {
|
||||
// match[n] can only be string or undefined.
|
||||
// But take care of '12' + 1 => '121'.
|
||||
return new Date(+match[1], +(match[2] || 1) - 1, +match[3] || 1, +match[4] || 0, +(match[5] || 0), +match[6] || 0, match[7] ? +match[7].substring(0, 3) : 0);
|
||||
}
|
||||
// Timezoneoffset of Javascript Date has considered DST (Daylight Saving Time,
|
||||
// https://tc39.github.io/ecma262/#sec-daylight-saving-time-adjustment).
|
||||
// For example, system timezone is set as "Time Zone: America/Toronto",
|
||||
// then these code will get different result:
|
||||
// `new Date(1478411999999).getTimezoneOffset(); // get 240`
|
||||
// `new Date(1478412000000).getTimezoneOffset(); // get 300`
|
||||
// So we should not use `new Date`, but use `Date.UTC`.
|
||||
else {
|
||||
var hour = +match[4] || 0;
|
||||
if (match[8].toUpperCase() !== 'Z') {
|
||||
hour -= +match[8].slice(0, 3);
|
||||
}
|
||||
return new Date(Date.UTC(+match[1], +(match[2] || 1) - 1, +match[3] || 1, hour, +(match[5] || 0), +match[6] || 0, match[7] ? +match[7].substring(0, 3) : 0));
|
||||
}
|
||||
} else if (value == null) {
|
||||
return new Date(NaN);
|
||||
}
|
||||
return new Date(Math.round(value));
|
||||
}
|
||||
/**
|
||||
* Quantity of a number. e.g. 0.1, 1, 10, 100
|
||||
*
|
||||
* @param val
|
||||
* @return
|
||||
*/
|
||||
export function quantity(val) {
|
||||
return Math.pow(10, quantityExponent(val));
|
||||
}
|
||||
/**
|
||||
* Exponent of the quantity of a number
|
||||
* e.g., 1234 equals to 1.234*10^3, so quantityExponent(1234) is 3
|
||||
*
|
||||
* @param val non-negative value
|
||||
* @return
|
||||
*/
|
||||
export function quantityExponent(val) {
|
||||
if (val === 0) {
|
||||
return 0;
|
||||
}
|
||||
var exp = Math.floor(Math.log(val) / Math.LN10);
|
||||
/**
|
||||
* exp is expected to be the rounded-down result of the base-10 log of val.
|
||||
* But due to the precision loss with Math.log(val), we need to restore it
|
||||
* using 10^exp to make sure we can get val back from exp. #11249
|
||||
*/
|
||||
if (val / Math.pow(10, exp) >= 10) {
|
||||
exp++;
|
||||
}
|
||||
return exp;
|
||||
}
|
||||
/**
|
||||
* find a “nice” number approximately equal to x. Round the number if round = true,
|
||||
* take ceiling if round = false. The primary observation is that the “nicest”
|
||||
* numbers in decimal are 1, 2, and 5, and all power-of-ten multiples of these numbers.
|
||||
*
|
||||
* See "Nice Numbers for Graph Labels" of Graphic Gems.
|
||||
*
|
||||
* @param val Non-negative value.
|
||||
* @param round
|
||||
* @return Niced number
|
||||
*/
|
||||
export function nice(val, round) {
|
||||
var exponent = quantityExponent(val);
|
||||
var exp10 = Math.pow(10, exponent);
|
||||
var f = val / exp10; // 1 <= f < 10
|
||||
var nf;
|
||||
if (round) {
|
||||
if (f < 1.5) {
|
||||
nf = 1;
|
||||
} else if (f < 2.5) {
|
||||
nf = 2;
|
||||
} else if (f < 4) {
|
||||
nf = 3;
|
||||
} else if (f < 7) {
|
||||
nf = 5;
|
||||
} else {
|
||||
nf = 10;
|
||||
}
|
||||
} else {
|
||||
if (f < 1) {
|
||||
nf = 1;
|
||||
} else if (f < 2) {
|
||||
nf = 2;
|
||||
} else if (f < 3) {
|
||||
nf = 3;
|
||||
} else if (f < 5) {
|
||||
nf = 5;
|
||||
} else {
|
||||
nf = 10;
|
||||
}
|
||||
}
|
||||
val = nf * exp10;
|
||||
// Fix 3 * 0.1 === 0.30000000000000004 issue (see IEEE 754).
|
||||
// 20 is the uppper bound of toFixed.
|
||||
return exponent >= -20 ? +val.toFixed(exponent < 0 ? -exponent : 0) : val;
|
||||
}
|
||||
/**
|
||||
* This code was copied from "d3.js"
|
||||
* <https://github.com/d3/d3/blob/9cc9a875e636a1dcf36cc1e07bdf77e1ad6e2c74/src/arrays/quantile.js>.
|
||||
* See the license statement at the head of this file.
|
||||
* @param ascArr
|
||||
*/
|
||||
export function quantile(ascArr, p) {
|
||||
var H = (ascArr.length - 1) * p + 1;
|
||||
var h = Math.floor(H);
|
||||
var v = +ascArr[h - 1];
|
||||
var e = H - h;
|
||||
return e ? v + e * (ascArr[h] - v) : v;
|
||||
}
|
||||
/**
|
||||
* Order intervals asc, and split them when overlap.
|
||||
* expect(numberUtil.reformIntervals([
|
||||
* {interval: [18, 62], close: [1, 1]},
|
||||
* {interval: [-Infinity, -70], close: [0, 0]},
|
||||
* {interval: [-70, -26], close: [1, 1]},
|
||||
* {interval: [-26, 18], close: [1, 1]},
|
||||
* {interval: [62, 150], close: [1, 1]},
|
||||
* {interval: [106, 150], close: [1, 1]},
|
||||
* {interval: [150, Infinity], close: [0, 0]}
|
||||
* ])).toEqual([
|
||||
* {interval: [-Infinity, -70], close: [0, 0]},
|
||||
* {interval: [-70, -26], close: [1, 1]},
|
||||
* {interval: [-26, 18], close: [0, 1]},
|
||||
* {interval: [18, 62], close: [0, 1]},
|
||||
* {interval: [62, 150], close: [0, 1]},
|
||||
* {interval: [150, Infinity], close: [0, 0]}
|
||||
* ]);
|
||||
* @param list, where `close` mean open or close
|
||||
* of the interval, and Infinity can be used.
|
||||
* @return The origin list, which has been reformed.
|
||||
*/
|
||||
export function reformIntervals(list) {
|
||||
list.sort(function (a, b) {
|
||||
return littleThan(a, b, 0) ? -1 : 1;
|
||||
});
|
||||
var curr = -Infinity;
|
||||
var currClose = 1;
|
||||
for (var i = 0; i < list.length;) {
|
||||
var interval = list[i].interval;
|
||||
var close_1 = list[i].close;
|
||||
for (var lg = 0; lg < 2; lg++) {
|
||||
if (interval[lg] <= curr) {
|
||||
interval[lg] = curr;
|
||||
close_1[lg] = !lg ? 1 - currClose : 1;
|
||||
}
|
||||
curr = interval[lg];
|
||||
currClose = close_1[lg];
|
||||
}
|
||||
if (interval[0] === interval[1] && close_1[0] * close_1[1] !== 1) {
|
||||
list.splice(i, 1);
|
||||
} else {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
return list;
|
||||
function littleThan(a, b, lg) {
|
||||
return a.interval[lg] < b.interval[lg] || a.interval[lg] === b.interval[lg] && (a.close[lg] - b.close[lg] === (!lg ? 1 : -1) || !lg && littleThan(a, b, 1));
|
||||
}
|
||||
}
|
||||
/**
|
||||
* [Numeric is defined as]:
|
||||
* `parseFloat(val) == val`
|
||||
* For example:
|
||||
* numeric:
|
||||
* typeof number except NaN, '-123', '123', '2e3', '-2e3', '011', 'Infinity', Infinity,
|
||||
* and they rounded by white-spaces or line-terminal like ' -123 \n ' (see es spec)
|
||||
* not-numeric:
|
||||
* null, undefined, [], {}, true, false, 'NaN', NaN, '123ab',
|
||||
* empty string, string with only white-spaces or line-terminal (see es spec),
|
||||
* 0x12, '0x12', '-0x12', 012, '012', '-012',
|
||||
* non-string, ...
|
||||
*
|
||||
* @test See full test cases in `test/ut/spec/util/number.js`.
|
||||
* @return Must be a typeof number. If not numeric, return NaN.
|
||||
*/
|
||||
export function numericToNumber(val) {
|
||||
var valFloat = parseFloat(val);
|
||||
return valFloat == val // eslint-disable-line eqeqeq
|
||||
&& (valFloat !== 0 || !zrUtil.isString(val) || val.indexOf('x') <= 0) // For case ' 0x0 '.
|
||||
? valFloat : NaN;
|
||||
}
|
||||
/**
|
||||
* Definition of "numeric": see `numericToNumber`.
|
||||
*/
|
||||
export function isNumeric(val) {
|
||||
return !isNaN(numericToNumber(val));
|
||||
}
|
||||
/**
|
||||
* Use random base to prevent users hard code depending on
|
||||
* this auto generated marker id.
|
||||
* @return An positive integer.
|
||||
*/
|
||||
export function getRandomIdBase() {
|
||||
return Math.round(Math.random() * 9);
|
||||
}
|
||||
/**
|
||||
* Get the greatest common divisor.
|
||||
*
|
||||
* @param {number} a one number
|
||||
* @param {number} b the other number
|
||||
*/
|
||||
export function getGreatestCommonDividor(a, b) {
|
||||
if (b === 0) {
|
||||
return a;
|
||||
}
|
||||
return getGreatestCommonDividor(b, a % b);
|
||||
}
|
||||
/**
|
||||
* Get the least common multiple.
|
||||
*
|
||||
* @param {number} a one number
|
||||
* @param {number} b the other number
|
||||
*/
|
||||
export function getLeastCommonMultiple(a, b) {
|
||||
if (a == null) {
|
||||
return b;
|
||||
}
|
||||
if (b == null) {
|
||||
return a;
|
||||
}
|
||||
return a * b / getGreatestCommonDividor(a, b);
|
||||
}
|
92
frontend/node_modules/echarts/lib/util/quickSelect.js
generated
vendored
Normal file
92
frontend/node_modules/echarts/lib/util/quickSelect.js
generated
vendored
Normal file
@ -0,0 +1,92 @@
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
function defaultCompareFunc(a, b) {
|
||||
return a - b;
|
||||
}
|
||||
function swapElement(arr, idx0, idx1) {
|
||||
var tmp = arr[idx0];
|
||||
arr[idx0] = arr[idx1];
|
||||
arr[idx1] = tmp;
|
||||
}
|
||||
function select(arr, left, right, nth, compareFunc) {
|
||||
var pivotIdx = left;
|
||||
var pivotValue;
|
||||
while (right > left) {
|
||||
pivotIdx = Math.round((right + left) / 2);
|
||||
pivotValue = arr[pivotIdx];
|
||||
// Swap pivot to the end
|
||||
swapElement(arr, pivotIdx, right);
|
||||
pivotIdx = left;
|
||||
for (var i = left; i <= right - 1; i++) {
|
||||
if (compareFunc(pivotValue, arr[i]) >= 0) {
|
||||
swapElement(arr, i, pivotIdx);
|
||||
pivotIdx++;
|
||||
}
|
||||
}
|
||||
swapElement(arr, right, pivotIdx);
|
||||
if (pivotIdx === nth) {
|
||||
return pivotIdx;
|
||||
} else if (pivotIdx < nth) {
|
||||
left = pivotIdx + 1;
|
||||
} else {
|
||||
right = pivotIdx - 1;
|
||||
}
|
||||
}
|
||||
// Left == right
|
||||
return left;
|
||||
}
|
||||
function quickSelect(arr, left, right, nth, compareFunc) {
|
||||
if (arguments.length <= 3) {
|
||||
nth = left;
|
||||
if (arguments.length === 2) {
|
||||
compareFunc = defaultCompareFunc;
|
||||
} else {
|
||||
compareFunc = right;
|
||||
}
|
||||
left = 0;
|
||||
right = arr.length - 1;
|
||||
}
|
||||
return select(arr, left, right, nth, compareFunc);
|
||||
}
|
||||
export default quickSelect;
|
106
frontend/node_modules/echarts/lib/util/shape/sausage.js
generated
vendored
Normal file
106
frontend/node_modules/echarts/lib/util/shape/sausage.js
generated
vendored
Normal file
@ -0,0 +1,106 @@
|
||||
|
||||
/*
|
||||
* 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 { __extends } from "tslib";
|
||||
import { Path } from '../graphic.js';
|
||||
/**
|
||||
* Sausage: similar to sector, but have half circle on both sides
|
||||
*/
|
||||
var SausageShape = /** @class */function () {
|
||||
function SausageShape() {
|
||||
this.cx = 0;
|
||||
this.cy = 0;
|
||||
this.r0 = 0;
|
||||
this.r = 0;
|
||||
this.startAngle = 0;
|
||||
this.endAngle = Math.PI * 2;
|
||||
this.clockwise = true;
|
||||
}
|
||||
return SausageShape;
|
||||
}();
|
||||
var SausagePath = /** @class */function (_super) {
|
||||
__extends(SausagePath, _super);
|
||||
function SausagePath(opts) {
|
||||
var _this = _super.call(this, opts) || this;
|
||||
_this.type = 'sausage';
|
||||
return _this;
|
||||
}
|
||||
SausagePath.prototype.getDefaultShape = function () {
|
||||
return new SausageShape();
|
||||
};
|
||||
SausagePath.prototype.buildPath = function (ctx, shape) {
|
||||
var cx = shape.cx;
|
||||
var cy = shape.cy;
|
||||
var r0 = Math.max(shape.r0 || 0, 0);
|
||||
var r = Math.max(shape.r, 0);
|
||||
var dr = (r - r0) * 0.5;
|
||||
var rCenter = r0 + dr;
|
||||
var startAngle = shape.startAngle;
|
||||
var endAngle = shape.endAngle;
|
||||
var clockwise = shape.clockwise;
|
||||
var PI2 = Math.PI * 2;
|
||||
var lessThanCircle = clockwise ? endAngle - startAngle < PI2 : startAngle - endAngle < PI2;
|
||||
if (!lessThanCircle) {
|
||||
// Normalize angles
|
||||
startAngle = endAngle - (clockwise ? PI2 : -PI2);
|
||||
}
|
||||
var unitStartX = Math.cos(startAngle);
|
||||
var unitStartY = Math.sin(startAngle);
|
||||
var unitEndX = Math.cos(endAngle);
|
||||
var unitEndY = Math.sin(endAngle);
|
||||
if (lessThanCircle) {
|
||||
ctx.moveTo(unitStartX * r0 + cx, unitStartY * r0 + cy);
|
||||
ctx.arc(unitStartX * rCenter + cx, unitStartY * rCenter + cy, dr, -Math.PI + startAngle, startAngle, !clockwise);
|
||||
} else {
|
||||
ctx.moveTo(unitStartX * r + cx, unitStartY * r + cy);
|
||||
}
|
||||
ctx.arc(cx, cy, r, startAngle, endAngle, !clockwise);
|
||||
ctx.arc(unitEndX * rCenter + cx, unitEndY * rCenter + cy, dr, endAngle - Math.PI * 2, endAngle - Math.PI, !clockwise);
|
||||
if (r0 !== 0) {
|
||||
ctx.arc(cx, cy, r0, endAngle, startAngle, clockwise);
|
||||
}
|
||||
// ctx.closePath();
|
||||
};
|
||||
return SausagePath;
|
||||
}(Path);
|
||||
export default SausagePath;
|
704
frontend/node_modules/echarts/lib/util/states.js
generated
vendored
Normal file
704
frontend/node_modules/echarts/lib/util/states.js
generated
vendored
Normal file
@ -0,0 +1,704 @@
|
||||
|
||||
/*
|
||||
* 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, indexOf, isArrayLike, isObject, keys, isArray, each } from 'zrender/lib/core/util.js';
|
||||
import { getECData } from './innerStore.js';
|
||||
import { liftColor } from 'zrender/lib/tool/color.js';
|
||||
import { queryDataIndex, makeInner } from './model.js';
|
||||
import Path from 'zrender/lib/graphic/Path.js';
|
||||
import { error } from './log.js';
|
||||
// Reserve 0 as default.
|
||||
var _highlightNextDigit = 1;
|
||||
var _highlightKeyMap = {};
|
||||
var getSavedStates = makeInner();
|
||||
var getComponentStates = makeInner();
|
||||
export var HOVER_STATE_NORMAL = 0;
|
||||
export var HOVER_STATE_BLUR = 1;
|
||||
export var HOVER_STATE_EMPHASIS = 2;
|
||||
export var SPECIAL_STATES = ['emphasis', 'blur', 'select'];
|
||||
export var DISPLAY_STATES = ['normal', 'emphasis', 'blur', 'select'];
|
||||
export var Z2_EMPHASIS_LIFT = 10;
|
||||
export var Z2_SELECT_LIFT = 9;
|
||||
export var HIGHLIGHT_ACTION_TYPE = 'highlight';
|
||||
export var DOWNPLAY_ACTION_TYPE = 'downplay';
|
||||
export var SELECT_ACTION_TYPE = 'select';
|
||||
export var UNSELECT_ACTION_TYPE = 'unselect';
|
||||
export var TOGGLE_SELECT_ACTION_TYPE = 'toggleSelect';
|
||||
function hasFillOrStroke(fillOrStroke) {
|
||||
return fillOrStroke != null && fillOrStroke !== 'none';
|
||||
}
|
||||
function doChangeHoverState(el, stateName, hoverStateEnum) {
|
||||
if (el.onHoverStateChange && (el.hoverState || 0) !== hoverStateEnum) {
|
||||
el.onHoverStateChange(stateName);
|
||||
}
|
||||
el.hoverState = hoverStateEnum;
|
||||
}
|
||||
function singleEnterEmphasis(el) {
|
||||
// Only mark the flag.
|
||||
// States will be applied in the echarts.ts in next frame.
|
||||
doChangeHoverState(el, 'emphasis', HOVER_STATE_EMPHASIS);
|
||||
}
|
||||
function singleLeaveEmphasis(el) {
|
||||
// Only mark the flag.
|
||||
// States will be applied in the echarts.ts in next frame.
|
||||
if (el.hoverState === HOVER_STATE_EMPHASIS) {
|
||||
doChangeHoverState(el, 'normal', HOVER_STATE_NORMAL);
|
||||
}
|
||||
}
|
||||
function singleEnterBlur(el) {
|
||||
doChangeHoverState(el, 'blur', HOVER_STATE_BLUR);
|
||||
}
|
||||
function singleLeaveBlur(el) {
|
||||
if (el.hoverState === HOVER_STATE_BLUR) {
|
||||
doChangeHoverState(el, 'normal', HOVER_STATE_NORMAL);
|
||||
}
|
||||
}
|
||||
function singleEnterSelect(el) {
|
||||
el.selected = true;
|
||||
}
|
||||
function singleLeaveSelect(el) {
|
||||
el.selected = false;
|
||||
}
|
||||
function updateElementState(el, updater, commonParam) {
|
||||
updater(el, commonParam);
|
||||
}
|
||||
function traverseUpdateState(el, updater, commonParam) {
|
||||
updateElementState(el, updater, commonParam);
|
||||
el.isGroup && el.traverse(function (child) {
|
||||
updateElementState(child, updater, commonParam);
|
||||
});
|
||||
}
|
||||
export function setStatesFlag(el, stateName) {
|
||||
switch (stateName) {
|
||||
case 'emphasis':
|
||||
el.hoverState = HOVER_STATE_EMPHASIS;
|
||||
break;
|
||||
case 'normal':
|
||||
el.hoverState = HOVER_STATE_NORMAL;
|
||||
break;
|
||||
case 'blur':
|
||||
el.hoverState = HOVER_STATE_BLUR;
|
||||
break;
|
||||
case 'select':
|
||||
el.selected = true;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* If we reuse elements when rerender.
|
||||
* DON'T forget to clearStates before we update the style and shape.
|
||||
* Or we may update on the wrong state instead of normal state.
|
||||
*/
|
||||
export function clearStates(el) {
|
||||
if (el.isGroup) {
|
||||
el.traverse(function (child) {
|
||||
child.clearStates();
|
||||
});
|
||||
} else {
|
||||
el.clearStates();
|
||||
}
|
||||
}
|
||||
function getFromStateStyle(el, props, toStateName, defaultValue) {
|
||||
var style = el.style;
|
||||
var fromState = {};
|
||||
for (var i = 0; i < props.length; i++) {
|
||||
var propName = props[i];
|
||||
var val = style[propName];
|
||||
fromState[propName] = val == null ? defaultValue && defaultValue[propName] : val;
|
||||
}
|
||||
for (var i = 0; i < el.animators.length; i++) {
|
||||
var animator = el.animators[i];
|
||||
if (animator.__fromStateTransition
|
||||
// Don't consider the animation to emphasis state.
|
||||
&& animator.__fromStateTransition.indexOf(toStateName) < 0 && animator.targetName === 'style') {
|
||||
animator.saveTo(fromState, props);
|
||||
}
|
||||
}
|
||||
return fromState;
|
||||
}
|
||||
function createEmphasisDefaultState(el, stateName, targetStates, state) {
|
||||
var hasSelect = targetStates && indexOf(targetStates, 'select') >= 0;
|
||||
var cloned = false;
|
||||
if (el instanceof Path) {
|
||||
var store = getSavedStates(el);
|
||||
var fromFill = hasSelect ? store.selectFill || store.normalFill : store.normalFill;
|
||||
var fromStroke = hasSelect ? store.selectStroke || store.normalStroke : store.normalStroke;
|
||||
if (hasFillOrStroke(fromFill) || hasFillOrStroke(fromStroke)) {
|
||||
state = state || {};
|
||||
var emphasisStyle = state.style || {};
|
||||
// inherit case
|
||||
if (emphasisStyle.fill === 'inherit') {
|
||||
cloned = true;
|
||||
state = extend({}, state);
|
||||
emphasisStyle = extend({}, emphasisStyle);
|
||||
emphasisStyle.fill = fromFill;
|
||||
}
|
||||
// Apply default color lift
|
||||
else if (!hasFillOrStroke(emphasisStyle.fill) && hasFillOrStroke(fromFill)) {
|
||||
cloned = true;
|
||||
// Not modify the original value.
|
||||
state = extend({}, state);
|
||||
emphasisStyle = extend({}, emphasisStyle);
|
||||
// Already being applied 'emphasis'. DON'T lift color multiple times.
|
||||
emphasisStyle.fill = liftColor(fromFill);
|
||||
}
|
||||
// Not highlight stroke if fill has been highlighted.
|
||||
else if (!hasFillOrStroke(emphasisStyle.stroke) && hasFillOrStroke(fromStroke)) {
|
||||
if (!cloned) {
|
||||
state = extend({}, state);
|
||||
emphasisStyle = extend({}, emphasisStyle);
|
||||
}
|
||||
emphasisStyle.stroke = liftColor(fromStroke);
|
||||
}
|
||||
state.style = emphasisStyle;
|
||||
}
|
||||
}
|
||||
if (state) {
|
||||
// TODO Share with textContent?
|
||||
if (state.z2 == null) {
|
||||
if (!cloned) {
|
||||
state = extend({}, state);
|
||||
}
|
||||
var z2EmphasisLift = el.z2EmphasisLift;
|
||||
state.z2 = el.z2 + (z2EmphasisLift != null ? z2EmphasisLift : Z2_EMPHASIS_LIFT);
|
||||
}
|
||||
}
|
||||
return state;
|
||||
}
|
||||
function createSelectDefaultState(el, stateName, state) {
|
||||
// const hasSelect = indexOf(el.currentStates, stateName) >= 0;
|
||||
if (state) {
|
||||
// TODO Share with textContent?
|
||||
if (state.z2 == null) {
|
||||
state = extend({}, state);
|
||||
var z2SelectLift = el.z2SelectLift;
|
||||
state.z2 = el.z2 + (z2SelectLift != null ? z2SelectLift : Z2_SELECT_LIFT);
|
||||
}
|
||||
}
|
||||
return state;
|
||||
}
|
||||
function createBlurDefaultState(el, stateName, state) {
|
||||
var hasBlur = indexOf(el.currentStates, stateName) >= 0;
|
||||
var currentOpacity = el.style.opacity;
|
||||
var fromState = !hasBlur ? getFromStateStyle(el, ['opacity'], stateName, {
|
||||
opacity: 1
|
||||
}) : null;
|
||||
state = state || {};
|
||||
var blurStyle = state.style || {};
|
||||
if (blurStyle.opacity == null) {
|
||||
// clone state
|
||||
state = extend({}, state);
|
||||
blurStyle = extend({
|
||||
// Already being applied 'emphasis'. DON'T mul opacity multiple times.
|
||||
opacity: hasBlur ? currentOpacity : fromState.opacity * 0.1
|
||||
}, blurStyle);
|
||||
state.style = blurStyle;
|
||||
}
|
||||
return state;
|
||||
}
|
||||
function elementStateProxy(stateName, targetStates) {
|
||||
var state = this.states[stateName];
|
||||
if (this.style) {
|
||||
if (stateName === 'emphasis') {
|
||||
return createEmphasisDefaultState(this, stateName, targetStates, state);
|
||||
} else if (stateName === 'blur') {
|
||||
return createBlurDefaultState(this, stateName, state);
|
||||
} else if (stateName === 'select') {
|
||||
return createSelectDefaultState(this, stateName, state);
|
||||
}
|
||||
}
|
||||
return state;
|
||||
}
|
||||
/**
|
||||
* Set hover style (namely "emphasis style") of element.
|
||||
* @param el Should not be `zrender/graphic/Group`.
|
||||
* @param focus 'self' | 'selfInSeries' | 'series'
|
||||
*/
|
||||
export function setDefaultStateProxy(el) {
|
||||
el.stateProxy = elementStateProxy;
|
||||
var textContent = el.getTextContent();
|
||||
var textGuide = el.getTextGuideLine();
|
||||
if (textContent) {
|
||||
textContent.stateProxy = elementStateProxy;
|
||||
}
|
||||
if (textGuide) {
|
||||
textGuide.stateProxy = elementStateProxy;
|
||||
}
|
||||
}
|
||||
export function enterEmphasisWhenMouseOver(el, e) {
|
||||
!shouldSilent(el, e)
|
||||
// "emphasis" event highlight has higher priority than mouse highlight.
|
||||
&& !el.__highByOuter && traverseUpdateState(el, singleEnterEmphasis);
|
||||
}
|
||||
export function leaveEmphasisWhenMouseOut(el, e) {
|
||||
!shouldSilent(el, e)
|
||||
// "emphasis" event highlight has higher priority than mouse highlight.
|
||||
&& !el.__highByOuter && traverseUpdateState(el, singleLeaveEmphasis);
|
||||
}
|
||||
export function enterEmphasis(el, highlightDigit) {
|
||||
el.__highByOuter |= 1 << (highlightDigit || 0);
|
||||
traverseUpdateState(el, singleEnterEmphasis);
|
||||
}
|
||||
export function leaveEmphasis(el, highlightDigit) {
|
||||
!(el.__highByOuter &= ~(1 << (highlightDigit || 0))) && traverseUpdateState(el, singleLeaveEmphasis);
|
||||
}
|
||||
export function enterBlur(el) {
|
||||
traverseUpdateState(el, singleEnterBlur);
|
||||
}
|
||||
export function leaveBlur(el) {
|
||||
traverseUpdateState(el, singleLeaveBlur);
|
||||
}
|
||||
export function enterSelect(el) {
|
||||
traverseUpdateState(el, singleEnterSelect);
|
||||
}
|
||||
export function leaveSelect(el) {
|
||||
traverseUpdateState(el, singleLeaveSelect);
|
||||
}
|
||||
function shouldSilent(el, e) {
|
||||
return el.__highDownSilentOnTouch && e.zrByTouch;
|
||||
}
|
||||
export function allLeaveBlur(api) {
|
||||
var model = api.getModel();
|
||||
var leaveBlurredSeries = [];
|
||||
var allComponentViews = [];
|
||||
model.eachComponent(function (componentType, componentModel) {
|
||||
var componentStates = getComponentStates(componentModel);
|
||||
var isSeries = componentType === 'series';
|
||||
var view = isSeries ? api.getViewOfSeriesModel(componentModel) : api.getViewOfComponentModel(componentModel);
|
||||
!isSeries && allComponentViews.push(view);
|
||||
if (componentStates.isBlured) {
|
||||
// Leave blur anyway
|
||||
view.group.traverse(function (child) {
|
||||
singleLeaveBlur(child);
|
||||
});
|
||||
isSeries && leaveBlurredSeries.push(componentModel);
|
||||
}
|
||||
componentStates.isBlured = false;
|
||||
});
|
||||
each(allComponentViews, function (view) {
|
||||
if (view && view.toggleBlurSeries) {
|
||||
view.toggleBlurSeries(leaveBlurredSeries, false, model);
|
||||
}
|
||||
});
|
||||
}
|
||||
export function blurSeries(targetSeriesIndex, focus, blurScope, api) {
|
||||
var ecModel = api.getModel();
|
||||
blurScope = blurScope || 'coordinateSystem';
|
||||
function leaveBlurOfIndices(data, dataIndices) {
|
||||
for (var i = 0; i < dataIndices.length; i++) {
|
||||
var itemEl = data.getItemGraphicEl(dataIndices[i]);
|
||||
itemEl && leaveBlur(itemEl);
|
||||
}
|
||||
}
|
||||
if (targetSeriesIndex == null) {
|
||||
return;
|
||||
}
|
||||
if (!focus || focus === 'none') {
|
||||
return;
|
||||
}
|
||||
var targetSeriesModel = ecModel.getSeriesByIndex(targetSeriesIndex);
|
||||
var targetCoordSys = targetSeriesModel.coordinateSystem;
|
||||
if (targetCoordSys && targetCoordSys.master) {
|
||||
targetCoordSys = targetCoordSys.master;
|
||||
}
|
||||
var blurredSeries = [];
|
||||
ecModel.eachSeries(function (seriesModel) {
|
||||
var sameSeries = targetSeriesModel === seriesModel;
|
||||
var coordSys = seriesModel.coordinateSystem;
|
||||
if (coordSys && coordSys.master) {
|
||||
coordSys = coordSys.master;
|
||||
}
|
||||
var sameCoordSys = coordSys && targetCoordSys ? coordSys === targetCoordSys : sameSeries; // If there is no coordinate system. use sameSeries instead.
|
||||
if (!(
|
||||
// Not blur other series if blurScope series
|
||||
blurScope === 'series' && !sameSeries
|
||||
// Not blur other coordinate system if blurScope is coordinateSystem
|
||||
|| blurScope === 'coordinateSystem' && !sameCoordSys
|
||||
// Not blur self series if focus is series.
|
||||
|| focus === 'series' && sameSeries
|
||||
// TODO blurScope: coordinate system
|
||||
)) {
|
||||
var view = api.getViewOfSeriesModel(seriesModel);
|
||||
view.group.traverse(function (child) {
|
||||
// For the elements that have been triggered by other components,
|
||||
// and are still required to be highlighted,
|
||||
// because the current is directly forced to blur the element,
|
||||
// it will cause the focus self to be unable to highlight, so skip the blur of this element.
|
||||
if (child.__highByOuter && sameSeries && focus === 'self') {
|
||||
return;
|
||||
}
|
||||
singleEnterBlur(child);
|
||||
});
|
||||
if (isArrayLike(focus)) {
|
||||
leaveBlurOfIndices(seriesModel.getData(), focus);
|
||||
} else if (isObject(focus)) {
|
||||
var dataTypes = keys(focus);
|
||||
for (var d = 0; d < dataTypes.length; d++) {
|
||||
leaveBlurOfIndices(seriesModel.getData(dataTypes[d]), focus[dataTypes[d]]);
|
||||
}
|
||||
}
|
||||
blurredSeries.push(seriesModel);
|
||||
getComponentStates(seriesModel).isBlured = true;
|
||||
}
|
||||
});
|
||||
ecModel.eachComponent(function (componentType, componentModel) {
|
||||
if (componentType === 'series') {
|
||||
return;
|
||||
}
|
||||
var view = api.getViewOfComponentModel(componentModel);
|
||||
if (view && view.toggleBlurSeries) {
|
||||
view.toggleBlurSeries(blurredSeries, true, ecModel);
|
||||
}
|
||||
});
|
||||
}
|
||||
export function blurComponent(componentMainType, componentIndex, api) {
|
||||
if (componentMainType == null || componentIndex == null) {
|
||||
return;
|
||||
}
|
||||
var componentModel = api.getModel().getComponent(componentMainType, componentIndex);
|
||||
if (!componentModel) {
|
||||
return;
|
||||
}
|
||||
getComponentStates(componentModel).isBlured = true;
|
||||
var view = api.getViewOfComponentModel(componentModel);
|
||||
if (!view || !view.focusBlurEnabled) {
|
||||
return;
|
||||
}
|
||||
view.group.traverse(function (child) {
|
||||
singleEnterBlur(child);
|
||||
});
|
||||
}
|
||||
export function blurSeriesFromHighlightPayload(seriesModel, payload, api) {
|
||||
var seriesIndex = seriesModel.seriesIndex;
|
||||
var data = seriesModel.getData(payload.dataType);
|
||||
if (!data) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
error("Unknown dataType " + payload.dataType);
|
||||
}
|
||||
return;
|
||||
}
|
||||
var dataIndex = queryDataIndex(data, payload);
|
||||
// Pick the first one if there is multiple/none exists.
|
||||
dataIndex = (isArray(dataIndex) ? dataIndex[0] : dataIndex) || 0;
|
||||
var el = data.getItemGraphicEl(dataIndex);
|
||||
if (!el) {
|
||||
var count = data.count();
|
||||
var current = 0;
|
||||
// If data on dataIndex is NaN.
|
||||
while (!el && current < count) {
|
||||
el = data.getItemGraphicEl(current++);
|
||||
}
|
||||
}
|
||||
if (el) {
|
||||
var ecData = getECData(el);
|
||||
blurSeries(seriesIndex, ecData.focus, ecData.blurScope, api);
|
||||
} else {
|
||||
// If there is no element put on the data. Try getting it from raw option
|
||||
// TODO Should put it on seriesModel?
|
||||
var focus_1 = seriesModel.get(['emphasis', 'focus']);
|
||||
var blurScope = seriesModel.get(['emphasis', 'blurScope']);
|
||||
if (focus_1 != null) {
|
||||
blurSeries(seriesIndex, focus_1, blurScope, api);
|
||||
}
|
||||
}
|
||||
}
|
||||
export function findComponentHighDownDispatchers(componentMainType, componentIndex, name, api) {
|
||||
var ret = {
|
||||
focusSelf: false,
|
||||
dispatchers: null
|
||||
};
|
||||
if (componentMainType == null || componentMainType === 'series' || componentIndex == null || name == null) {
|
||||
return ret;
|
||||
}
|
||||
var componentModel = api.getModel().getComponent(componentMainType, componentIndex);
|
||||
if (!componentModel) {
|
||||
return ret;
|
||||
}
|
||||
var view = api.getViewOfComponentModel(componentModel);
|
||||
if (!view || !view.findHighDownDispatchers) {
|
||||
return ret;
|
||||
}
|
||||
var dispatchers = view.findHighDownDispatchers(name);
|
||||
// At presnet, the component (like Geo) only blur inside itself.
|
||||
// So we do not use `blurScope` in component.
|
||||
var focusSelf;
|
||||
for (var i = 0; i < dispatchers.length; i++) {
|
||||
if (process.env.NODE_ENV !== 'production' && !isHighDownDispatcher(dispatchers[i])) {
|
||||
error('param should be highDownDispatcher');
|
||||
}
|
||||
if (getECData(dispatchers[i]).focus === 'self') {
|
||||
focusSelf = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return {
|
||||
focusSelf: focusSelf,
|
||||
dispatchers: dispatchers
|
||||
};
|
||||
}
|
||||
export function handleGlobalMouseOverForHighDown(dispatcher, e, api) {
|
||||
if (process.env.NODE_ENV !== 'production' && !isHighDownDispatcher(dispatcher)) {
|
||||
error('param should be highDownDispatcher');
|
||||
}
|
||||
var ecData = getECData(dispatcher);
|
||||
var _a = findComponentHighDownDispatchers(ecData.componentMainType, ecData.componentIndex, ecData.componentHighDownName, api),
|
||||
dispatchers = _a.dispatchers,
|
||||
focusSelf = _a.focusSelf;
|
||||
// If `findHighDownDispatchers` is supported on the component,
|
||||
// highlight/downplay elements with the same name.
|
||||
if (dispatchers) {
|
||||
if (focusSelf) {
|
||||
blurComponent(ecData.componentMainType, ecData.componentIndex, api);
|
||||
}
|
||||
each(dispatchers, function (dispatcher) {
|
||||
return enterEmphasisWhenMouseOver(dispatcher, e);
|
||||
});
|
||||
} else {
|
||||
// Try blur all in the related series. Then emphasis the hoverred.
|
||||
// TODO. progressive mode.
|
||||
blurSeries(ecData.seriesIndex, ecData.focus, ecData.blurScope, api);
|
||||
if (ecData.focus === 'self') {
|
||||
blurComponent(ecData.componentMainType, ecData.componentIndex, api);
|
||||
}
|
||||
// Other than series, component that not support `findHighDownDispatcher` will
|
||||
// also use it. But in this case, highlight/downplay are only supported in
|
||||
// mouse hover but not in dispatchAction.
|
||||
enterEmphasisWhenMouseOver(dispatcher, e);
|
||||
}
|
||||
}
|
||||
export function handleGlobalMouseOutForHighDown(dispatcher, e, api) {
|
||||
if (process.env.NODE_ENV !== 'production' && !isHighDownDispatcher(dispatcher)) {
|
||||
error('param should be highDownDispatcher');
|
||||
}
|
||||
allLeaveBlur(api);
|
||||
var ecData = getECData(dispatcher);
|
||||
var dispatchers = findComponentHighDownDispatchers(ecData.componentMainType, ecData.componentIndex, ecData.componentHighDownName, api).dispatchers;
|
||||
if (dispatchers) {
|
||||
each(dispatchers, function (dispatcher) {
|
||||
return leaveEmphasisWhenMouseOut(dispatcher, e);
|
||||
});
|
||||
} else {
|
||||
leaveEmphasisWhenMouseOut(dispatcher, e);
|
||||
}
|
||||
}
|
||||
export function toggleSelectionFromPayload(seriesModel, payload, api) {
|
||||
if (!isSelectChangePayload(payload)) {
|
||||
return;
|
||||
}
|
||||
var dataType = payload.dataType;
|
||||
var data = seriesModel.getData(dataType);
|
||||
var dataIndex = queryDataIndex(data, payload);
|
||||
if (!isArray(dataIndex)) {
|
||||
dataIndex = [dataIndex];
|
||||
}
|
||||
seriesModel[payload.type === TOGGLE_SELECT_ACTION_TYPE ? 'toggleSelect' : payload.type === SELECT_ACTION_TYPE ? 'select' : 'unselect'](dataIndex, dataType);
|
||||
}
|
||||
export function updateSeriesElementSelection(seriesModel) {
|
||||
var allData = seriesModel.getAllData();
|
||||
each(allData, function (_a) {
|
||||
var data = _a.data,
|
||||
type = _a.type;
|
||||
data.eachItemGraphicEl(function (el, idx) {
|
||||
seriesModel.isSelected(idx, type) ? enterSelect(el) : leaveSelect(el);
|
||||
});
|
||||
});
|
||||
}
|
||||
export function getAllSelectedIndices(ecModel) {
|
||||
var ret = [];
|
||||
ecModel.eachSeries(function (seriesModel) {
|
||||
var allData = seriesModel.getAllData();
|
||||
each(allData, function (_a) {
|
||||
var data = _a.data,
|
||||
type = _a.type;
|
||||
var dataIndices = seriesModel.getSelectedDataIndices();
|
||||
if (dataIndices.length > 0) {
|
||||
var item = {
|
||||
dataIndex: dataIndices,
|
||||
seriesIndex: seriesModel.seriesIndex
|
||||
};
|
||||
if (type != null) {
|
||||
item.dataType = type;
|
||||
}
|
||||
ret.push(item);
|
||||
}
|
||||
});
|
||||
});
|
||||
return ret;
|
||||
}
|
||||
/**
|
||||
* Enable the function that mouseover will trigger the emphasis state.
|
||||
*
|
||||
* NOTE:
|
||||
* This function should be used on the element with dataIndex, seriesIndex.
|
||||
*
|
||||
*/
|
||||
export function enableHoverEmphasis(el, focus, blurScope) {
|
||||
setAsHighDownDispatcher(el, true);
|
||||
traverseUpdateState(el, setDefaultStateProxy);
|
||||
enableHoverFocus(el, focus, blurScope);
|
||||
}
|
||||
export function disableHoverEmphasis(el) {
|
||||
setAsHighDownDispatcher(el, false);
|
||||
}
|
||||
export function toggleHoverEmphasis(el, focus, blurScope, isDisabled) {
|
||||
isDisabled ? disableHoverEmphasis(el) : enableHoverEmphasis(el, focus, blurScope);
|
||||
}
|
||||
export function enableHoverFocus(el, focus, blurScope) {
|
||||
var ecData = getECData(el);
|
||||
if (focus != null) {
|
||||
// TODO dataIndex may be set after this function. This check is not useful.
|
||||
// if (ecData.dataIndex == null) {
|
||||
// if (__DEV__) {
|
||||
// console.warn('focus can only been set on element with dataIndex');
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
ecData.focus = focus;
|
||||
ecData.blurScope = blurScope;
|
||||
// }
|
||||
} else if (ecData.focus) {
|
||||
ecData.focus = null;
|
||||
}
|
||||
}
|
||||
var OTHER_STATES = ['emphasis', 'blur', 'select'];
|
||||
var defaultStyleGetterMap = {
|
||||
itemStyle: 'getItemStyle',
|
||||
lineStyle: 'getLineStyle',
|
||||
areaStyle: 'getAreaStyle'
|
||||
};
|
||||
/**
|
||||
* Set emphasis/blur/selected states of element.
|
||||
*/
|
||||
export function setStatesStylesFromModel(el, itemModel, styleType,
|
||||
// default itemStyle
|
||||
getter) {
|
||||
styleType = styleType || 'itemStyle';
|
||||
for (var i = 0; i < OTHER_STATES.length; i++) {
|
||||
var stateName = OTHER_STATES[i];
|
||||
var model = itemModel.getModel([stateName, styleType]);
|
||||
var state = el.ensureState(stateName);
|
||||
// Let it throw error if getterType is not found.
|
||||
state.style = getter ? getter(model) : model[defaultStyleGetterMap[styleType]]();
|
||||
}
|
||||
}
|
||||
/**
|
||||
*
|
||||
* Set element as highlight / downplay dispatcher.
|
||||
* It will be checked when element received mouseover event or from highlight action.
|
||||
* It's in change of all highlight/downplay behavior of it's children.
|
||||
*
|
||||
* @param el
|
||||
* @param el.highDownSilentOnTouch
|
||||
* In touch device, mouseover event will be trigger on touchstart event
|
||||
* (see module:zrender/dom/HandlerProxy). By this mechanism, we can
|
||||
* conveniently use hoverStyle when tap on touch screen without additional
|
||||
* code for compatibility.
|
||||
* But if the chart/component has select feature, which usually also use
|
||||
* hoverStyle, there might be conflict between 'select-highlight' and
|
||||
* 'hover-highlight' especially when roam is enabled (see geo for example).
|
||||
* In this case, `highDownSilentOnTouch` should be used to disable
|
||||
* hover-highlight on touch device.
|
||||
* @param asDispatcher If `false`, do not set as "highDownDispatcher".
|
||||
*/
|
||||
export function setAsHighDownDispatcher(el, asDispatcher) {
|
||||
var disable = asDispatcher === false;
|
||||
var extendedEl = el;
|
||||
// Make `highDownSilentOnTouch` and `onStateChange` only work after
|
||||
// `setAsHighDownDispatcher` called. Avoid it is modified by user unexpectedly.
|
||||
if (el.highDownSilentOnTouch) {
|
||||
extendedEl.__highDownSilentOnTouch = el.highDownSilentOnTouch;
|
||||
}
|
||||
// Simple optimize, since this method might be
|
||||
// called for each elements of a group in some cases.
|
||||
if (!disable || extendedEl.__highDownDispatcher) {
|
||||
// Emphasis, normal can be triggered manually by API or other components like hover link.
|
||||
// el[method]('emphasis', onElementEmphasisEvent)[method]('normal', onElementNormalEvent);
|
||||
// Also keep previous record.
|
||||
extendedEl.__highByOuter = extendedEl.__highByOuter || 0;
|
||||
extendedEl.__highDownDispatcher = !disable;
|
||||
}
|
||||
}
|
||||
export function isHighDownDispatcher(el) {
|
||||
return !!(el && el.__highDownDispatcher);
|
||||
}
|
||||
/**
|
||||
* Enable component highlight/downplay features:
|
||||
* + hover link (within the same name)
|
||||
* + focus blur in component
|
||||
*/
|
||||
export function enableComponentHighDownFeatures(el, componentModel, componentHighDownName) {
|
||||
var ecData = getECData(el);
|
||||
ecData.componentMainType = componentModel.mainType;
|
||||
ecData.componentIndex = componentModel.componentIndex;
|
||||
ecData.componentHighDownName = componentHighDownName;
|
||||
}
|
||||
/**
|
||||
* Support highlight/downplay record on each elements.
|
||||
* For the case: hover highlight/downplay (legend, visualMap, ...) and
|
||||
* user triggered highlight/downplay should not conflict.
|
||||
* Only all of the highlightDigit cleared, return to normal.
|
||||
* @param {string} highlightKey
|
||||
* @return {number} highlightDigit
|
||||
*/
|
||||
export function getHighlightDigit(highlightKey) {
|
||||
var highlightDigit = _highlightKeyMap[highlightKey];
|
||||
if (highlightDigit == null && _highlightNextDigit <= 32) {
|
||||
highlightDigit = _highlightKeyMap[highlightKey] = _highlightNextDigit++;
|
||||
}
|
||||
return highlightDigit;
|
||||
}
|
||||
export function isSelectChangePayload(payload) {
|
||||
var payloadType = payload.type;
|
||||
return payloadType === SELECT_ACTION_TYPE || payloadType === UNSELECT_ACTION_TYPE || payloadType === TOGGLE_SELECT_ACTION_TYPE;
|
||||
}
|
||||
export function isHighDownPayload(payload) {
|
||||
var payloadType = payload.type;
|
||||
return payloadType === HIGHLIGHT_ACTION_TYPE || payloadType === DOWNPLAY_ACTION_TYPE;
|
||||
}
|
||||
export function savePathStates(el) {
|
||||
var store = getSavedStates(el);
|
||||
store.normalFill = el.style.fill;
|
||||
store.normalStroke = el.style.stroke;
|
||||
var selectState = el.states.select || {};
|
||||
store.selectFill = selectState.style && selectState.style.fill || null;
|
||||
store.selectStroke = selectState.style && selectState.style.stroke || null;
|
||||
}
|
226
frontend/node_modules/echarts/lib/util/styleCompat.js
generated
vendored
Normal file
226
frontend/node_modules/echarts/lib/util/styleCompat.js
generated
vendored
Normal file
@ -0,0 +1,226 @@
|
||||
|
||||
/*
|
||||
* 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 { each, hasOwn } from 'zrender/lib/core/util.js';
|
||||
var deprecatedLogs = {};
|
||||
/**
|
||||
* Whether need to call `convertEC4CompatibleStyle`.
|
||||
*/
|
||||
export function isEC4CompatibleStyle(style, elType, hasOwnTextContentOption, hasOwnTextConfig) {
|
||||
// Since echarts5, `RectText` is separated from its host element and style.text
|
||||
// does not exist any more. The compat work brings some extra burden on performance.
|
||||
// So we provide:
|
||||
// `legacy: true` force make compat.
|
||||
// `legacy: false`, force do not compat.
|
||||
// `legacy` not set: auto detect whether legacy.
|
||||
// But in this case we do not compat (difficult to detect and rare case):
|
||||
// Becuse custom series and graphic component support "merge", users may firstly
|
||||
// only set `textStrokeWidth` style or secondly only set `text`.
|
||||
return style && (style.legacy || style.legacy !== false && !hasOwnTextContentOption && !hasOwnTextConfig && elType !== 'tspan'
|
||||
// Difficult to detect whether legacy for a "text" el.
|
||||
&& (elType === 'text' || hasOwn(style, 'text')));
|
||||
}
|
||||
/**
|
||||
* `EC4CompatibleStyle` is style that might be in echarts4 format or echarts5 format.
|
||||
* @param hostStyle The properties might be modified.
|
||||
* @return If be text el, `textContentStyle` and `textConfig` will not be returned.
|
||||
* Otherwise a `textContentStyle` and `textConfig` will be created, whose props area
|
||||
* retried from the `hostStyle`.
|
||||
*/
|
||||
export function convertFromEC4CompatibleStyle(hostStyle, elType, isNormal) {
|
||||
var srcStyle = hostStyle;
|
||||
var textConfig;
|
||||
var textContent;
|
||||
var textContentStyle;
|
||||
if (elType === 'text') {
|
||||
textContentStyle = srcStyle;
|
||||
} else {
|
||||
textContentStyle = {};
|
||||
hasOwn(srcStyle, 'text') && (textContentStyle.text = srcStyle.text);
|
||||
hasOwn(srcStyle, 'rich') && (textContentStyle.rich = srcStyle.rich);
|
||||
hasOwn(srcStyle, 'textFill') && (textContentStyle.fill = srcStyle.textFill);
|
||||
hasOwn(srcStyle, 'textStroke') && (textContentStyle.stroke = srcStyle.textStroke);
|
||||
hasOwn(srcStyle, 'fontFamily') && (textContentStyle.fontFamily = srcStyle.fontFamily);
|
||||
hasOwn(srcStyle, 'fontSize') && (textContentStyle.fontSize = srcStyle.fontSize);
|
||||
hasOwn(srcStyle, 'fontStyle') && (textContentStyle.fontStyle = srcStyle.fontStyle);
|
||||
hasOwn(srcStyle, 'fontWeight') && (textContentStyle.fontWeight = srcStyle.fontWeight);
|
||||
textContent = {
|
||||
type: 'text',
|
||||
style: textContentStyle,
|
||||
// ec4 does not support rectText trigger.
|
||||
// And when text position is different in normal and emphasis
|
||||
// => hover text trigger emphasis;
|
||||
// => text position changed, leave mouse pointer immediately;
|
||||
// That might cause incorrect state.
|
||||
silent: true
|
||||
};
|
||||
textConfig = {};
|
||||
var hasOwnPos = hasOwn(srcStyle, 'textPosition');
|
||||
if (isNormal) {
|
||||
textConfig.position = hasOwnPos ? srcStyle.textPosition : 'inside';
|
||||
} else {
|
||||
hasOwnPos && (textConfig.position = srcStyle.textPosition);
|
||||
}
|
||||
hasOwn(srcStyle, 'textPosition') && (textConfig.position = srcStyle.textPosition);
|
||||
hasOwn(srcStyle, 'textOffset') && (textConfig.offset = srcStyle.textOffset);
|
||||
hasOwn(srcStyle, 'textRotation') && (textConfig.rotation = srcStyle.textRotation);
|
||||
hasOwn(srcStyle, 'textDistance') && (textConfig.distance = srcStyle.textDistance);
|
||||
}
|
||||
convertEC4CompatibleRichItem(textContentStyle, hostStyle);
|
||||
each(textContentStyle.rich, function (richItem) {
|
||||
convertEC4CompatibleRichItem(richItem, richItem);
|
||||
});
|
||||
return {
|
||||
textConfig: textConfig,
|
||||
textContent: textContent
|
||||
};
|
||||
}
|
||||
/**
|
||||
* The result will be set to `out`.
|
||||
*/
|
||||
function convertEC4CompatibleRichItem(out, richItem) {
|
||||
if (!richItem) {
|
||||
return;
|
||||
}
|
||||
// (1) For simplicity, make textXXX properties (deprecated since ec5) has
|
||||
// higher priority. For example, consider in ec4 `borderColor: 5, textBorderColor: 10`
|
||||
// on a rect means `borderColor: 4` on the rect and `borderColor: 10` on an attached
|
||||
// richText in ec5.
|
||||
// (2) `out === richItem` if and only if `out` is text el or rich item.
|
||||
// So we can overwrite existing props in `out` since textXXX has higher priority.
|
||||
richItem.font = richItem.textFont || richItem.font;
|
||||
hasOwn(richItem, 'textStrokeWidth') && (out.lineWidth = richItem.textStrokeWidth);
|
||||
hasOwn(richItem, 'textAlign') && (out.align = richItem.textAlign);
|
||||
hasOwn(richItem, 'textVerticalAlign') && (out.verticalAlign = richItem.textVerticalAlign);
|
||||
hasOwn(richItem, 'textLineHeight') && (out.lineHeight = richItem.textLineHeight);
|
||||
hasOwn(richItem, 'textWidth') && (out.width = richItem.textWidth);
|
||||
hasOwn(richItem, 'textHeight') && (out.height = richItem.textHeight);
|
||||
hasOwn(richItem, 'textBackgroundColor') && (out.backgroundColor = richItem.textBackgroundColor);
|
||||
hasOwn(richItem, 'textPadding') && (out.padding = richItem.textPadding);
|
||||
hasOwn(richItem, 'textBorderColor') && (out.borderColor = richItem.textBorderColor);
|
||||
hasOwn(richItem, 'textBorderWidth') && (out.borderWidth = richItem.textBorderWidth);
|
||||
hasOwn(richItem, 'textBorderRadius') && (out.borderRadius = richItem.textBorderRadius);
|
||||
hasOwn(richItem, 'textBoxShadowColor') && (out.shadowColor = richItem.textBoxShadowColor);
|
||||
hasOwn(richItem, 'textBoxShadowBlur') && (out.shadowBlur = richItem.textBoxShadowBlur);
|
||||
hasOwn(richItem, 'textBoxShadowOffsetX') && (out.shadowOffsetX = richItem.textBoxShadowOffsetX);
|
||||
hasOwn(richItem, 'textBoxShadowOffsetY') && (out.shadowOffsetY = richItem.textBoxShadowOffsetY);
|
||||
}
|
||||
/**
|
||||
* Convert to pure echarts4 format style.
|
||||
* `itemStyle` will be modified, added with ec4 style properties from
|
||||
* `textStyle` and `textConfig`.
|
||||
*
|
||||
* [Caveat]: For simplicity, `insideRollback` in ec4 does not compat, where
|
||||
* `styleEmphasis: {textFill: 'red'}` will remove the normal auto added stroke.
|
||||
*/
|
||||
export function convertToEC4StyleForCustomSerise(itemStl, txStl, txCfg) {
|
||||
var out = itemStl;
|
||||
// See `custom.ts`, a trick to set extra `textPosition` firstly.
|
||||
out.textPosition = out.textPosition || txCfg.position || 'inside';
|
||||
txCfg.offset != null && (out.textOffset = txCfg.offset);
|
||||
txCfg.rotation != null && (out.textRotation = txCfg.rotation);
|
||||
txCfg.distance != null && (out.textDistance = txCfg.distance);
|
||||
var isInside = out.textPosition.indexOf('inside') >= 0;
|
||||
var hostFill = itemStl.fill || '#000';
|
||||
convertToEC4RichItem(out, txStl);
|
||||
var textFillNotSet = out.textFill == null;
|
||||
if (isInside) {
|
||||
if (textFillNotSet) {
|
||||
out.textFill = txCfg.insideFill || '#fff';
|
||||
!out.textStroke && txCfg.insideStroke && (out.textStroke = txCfg.insideStroke);
|
||||
!out.textStroke && (out.textStroke = hostFill);
|
||||
out.textStrokeWidth == null && (out.textStrokeWidth = 2);
|
||||
}
|
||||
} else {
|
||||
if (textFillNotSet) {
|
||||
out.textFill = itemStl.fill || txCfg.outsideFill || '#000';
|
||||
}
|
||||
!out.textStroke && txCfg.outsideStroke && (out.textStroke = txCfg.outsideStroke);
|
||||
}
|
||||
out.text = txStl.text;
|
||||
out.rich = txStl.rich;
|
||||
each(txStl.rich, function (richItem) {
|
||||
convertToEC4RichItem(richItem, richItem);
|
||||
});
|
||||
return out;
|
||||
}
|
||||
function convertToEC4RichItem(out, richItem) {
|
||||
if (!richItem) {
|
||||
return;
|
||||
}
|
||||
hasOwn(richItem, 'fill') && (out.textFill = richItem.fill);
|
||||
hasOwn(richItem, 'stroke') && (out.textStroke = richItem.fill);
|
||||
hasOwn(richItem, 'lineWidth') && (out.textStrokeWidth = richItem.lineWidth);
|
||||
hasOwn(richItem, 'font') && (out.font = richItem.font);
|
||||
hasOwn(richItem, 'fontStyle') && (out.fontStyle = richItem.fontStyle);
|
||||
hasOwn(richItem, 'fontWeight') && (out.fontWeight = richItem.fontWeight);
|
||||
hasOwn(richItem, 'fontSize') && (out.fontSize = richItem.fontSize);
|
||||
hasOwn(richItem, 'fontFamily') && (out.fontFamily = richItem.fontFamily);
|
||||
hasOwn(richItem, 'align') && (out.textAlign = richItem.align);
|
||||
hasOwn(richItem, 'verticalAlign') && (out.textVerticalAlign = richItem.verticalAlign);
|
||||
hasOwn(richItem, 'lineHeight') && (out.textLineHeight = richItem.lineHeight);
|
||||
hasOwn(richItem, 'width') && (out.textWidth = richItem.width);
|
||||
hasOwn(richItem, 'height') && (out.textHeight = richItem.height);
|
||||
hasOwn(richItem, 'backgroundColor') && (out.textBackgroundColor = richItem.backgroundColor);
|
||||
hasOwn(richItem, 'padding') && (out.textPadding = richItem.padding);
|
||||
hasOwn(richItem, 'borderColor') && (out.textBorderColor = richItem.borderColor);
|
||||
hasOwn(richItem, 'borderWidth') && (out.textBorderWidth = richItem.borderWidth);
|
||||
hasOwn(richItem, 'borderRadius') && (out.textBorderRadius = richItem.borderRadius);
|
||||
hasOwn(richItem, 'shadowColor') && (out.textBoxShadowColor = richItem.shadowColor);
|
||||
hasOwn(richItem, 'shadowBlur') && (out.textBoxShadowBlur = richItem.shadowBlur);
|
||||
hasOwn(richItem, 'shadowOffsetX') && (out.textBoxShadowOffsetX = richItem.shadowOffsetX);
|
||||
hasOwn(richItem, 'shadowOffsetY') && (out.textBoxShadowOffsetY = richItem.shadowOffsetY);
|
||||
hasOwn(richItem, 'textShadowColor') && (out.textShadowColor = richItem.textShadowColor);
|
||||
hasOwn(richItem, 'textShadowBlur') && (out.textShadowBlur = richItem.textShadowBlur);
|
||||
hasOwn(richItem, 'textShadowOffsetX') && (out.textShadowOffsetX = richItem.textShadowOffsetX);
|
||||
hasOwn(richItem, 'textShadowOffsetY') && (out.textShadowOffsetY = richItem.textShadowOffsetY);
|
||||
}
|
||||
export function warnDeprecated(deprecated, insteadApproach) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
var key = deprecated + '^_^' + insteadApproach;
|
||||
if (!deprecatedLogs[key]) {
|
||||
console.warn("[ECharts] DEPRECATED: \"" + deprecated + "\" has been deprecated. " + insteadApproach);
|
||||
deprecatedLogs[key] = true;
|
||||
}
|
||||
}
|
||||
}
|
334
frontend/node_modules/echarts/lib/util/symbol.js
generated
vendored
Normal file
334
frontend/node_modules/echarts/lib/util/symbol.js
generated
vendored
Normal file
@ -0,0 +1,334 @@
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
// Symbol factory
|
||||
import { each, isArray, retrieve2 } from 'zrender/lib/core/util.js';
|
||||
import * as graphic from './graphic.js';
|
||||
import BoundingRect from 'zrender/lib/core/BoundingRect.js';
|
||||
import { calculateTextPosition } from 'zrender/lib/contain/text.js';
|
||||
import { parsePercent } from './number.js';
|
||||
/**
|
||||
* Triangle shape
|
||||
* @inner
|
||||
*/
|
||||
var Triangle = graphic.Path.extend({
|
||||
type: 'triangle',
|
||||
shape: {
|
||||
cx: 0,
|
||||
cy: 0,
|
||||
width: 0,
|
||||
height: 0
|
||||
},
|
||||
buildPath: function (path, shape) {
|
||||
var cx = shape.cx;
|
||||
var cy = shape.cy;
|
||||
var width = shape.width / 2;
|
||||
var height = shape.height / 2;
|
||||
path.moveTo(cx, cy - height);
|
||||
path.lineTo(cx + width, cy + height);
|
||||
path.lineTo(cx - width, cy + height);
|
||||
path.closePath();
|
||||
}
|
||||
});
|
||||
/**
|
||||
* Diamond shape
|
||||
* @inner
|
||||
*/
|
||||
var Diamond = graphic.Path.extend({
|
||||
type: 'diamond',
|
||||
shape: {
|
||||
cx: 0,
|
||||
cy: 0,
|
||||
width: 0,
|
||||
height: 0
|
||||
},
|
||||
buildPath: function (path, shape) {
|
||||
var cx = shape.cx;
|
||||
var cy = shape.cy;
|
||||
var width = shape.width / 2;
|
||||
var height = shape.height / 2;
|
||||
path.moveTo(cx, cy - height);
|
||||
path.lineTo(cx + width, cy);
|
||||
path.lineTo(cx, cy + height);
|
||||
path.lineTo(cx - width, cy);
|
||||
path.closePath();
|
||||
}
|
||||
});
|
||||
/**
|
||||
* Pin shape
|
||||
* @inner
|
||||
*/
|
||||
var Pin = graphic.Path.extend({
|
||||
type: 'pin',
|
||||
shape: {
|
||||
// x, y on the cusp
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: 0,
|
||||
height: 0
|
||||
},
|
||||
buildPath: function (path, shape) {
|
||||
var x = shape.x;
|
||||
var y = shape.y;
|
||||
var w = shape.width / 5 * 3;
|
||||
// Height must be larger than width
|
||||
var h = Math.max(w, shape.height);
|
||||
var r = w / 2;
|
||||
// Dist on y with tangent point and circle center
|
||||
var dy = r * r / (h - r);
|
||||
var cy = y - h + r + dy;
|
||||
var angle = Math.asin(dy / r);
|
||||
// Dist on x with tangent point and circle center
|
||||
var dx = Math.cos(angle) * r;
|
||||
var tanX = Math.sin(angle);
|
||||
var tanY = Math.cos(angle);
|
||||
var cpLen = r * 0.6;
|
||||
var cpLen2 = r * 0.7;
|
||||
path.moveTo(x - dx, cy + dy);
|
||||
path.arc(x, cy, r, Math.PI - angle, Math.PI * 2 + angle);
|
||||
path.bezierCurveTo(x + dx - tanX * cpLen, cy + dy + tanY * cpLen, x, y - cpLen2, x, y);
|
||||
path.bezierCurveTo(x, y - cpLen2, x - dx + tanX * cpLen, cy + dy + tanY * cpLen, x - dx, cy + dy);
|
||||
path.closePath();
|
||||
}
|
||||
});
|
||||
/**
|
||||
* Arrow shape
|
||||
* @inner
|
||||
*/
|
||||
var Arrow = graphic.Path.extend({
|
||||
type: 'arrow',
|
||||
shape: {
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: 0,
|
||||
height: 0
|
||||
},
|
||||
buildPath: function (ctx, shape) {
|
||||
var height = shape.height;
|
||||
var width = shape.width;
|
||||
var x = shape.x;
|
||||
var y = shape.y;
|
||||
var dx = width / 3 * 2;
|
||||
ctx.moveTo(x, y);
|
||||
ctx.lineTo(x + dx, y + height);
|
||||
ctx.lineTo(x, y + height / 4 * 3);
|
||||
ctx.lineTo(x - dx, y + height);
|
||||
ctx.lineTo(x, y);
|
||||
ctx.closePath();
|
||||
}
|
||||
});
|
||||
/**
|
||||
* Map of path constructors
|
||||
*/
|
||||
// TODO Use function to build symbol path.
|
||||
var symbolCtors = {
|
||||
line: graphic.Line,
|
||||
rect: graphic.Rect,
|
||||
roundRect: graphic.Rect,
|
||||
square: graphic.Rect,
|
||||
circle: graphic.Circle,
|
||||
diamond: Diamond,
|
||||
pin: Pin,
|
||||
arrow: Arrow,
|
||||
triangle: Triangle
|
||||
};
|
||||
var symbolShapeMakers = {
|
||||
line: function (x, y, w, h, shape) {
|
||||
shape.x1 = x;
|
||||
shape.y1 = y + h / 2;
|
||||
shape.x2 = x + w;
|
||||
shape.y2 = y + h / 2;
|
||||
},
|
||||
rect: function (x, y, w, h, shape) {
|
||||
shape.x = x;
|
||||
shape.y = y;
|
||||
shape.width = w;
|
||||
shape.height = h;
|
||||
},
|
||||
roundRect: function (x, y, w, h, shape) {
|
||||
shape.x = x;
|
||||
shape.y = y;
|
||||
shape.width = w;
|
||||
shape.height = h;
|
||||
shape.r = Math.min(w, h) / 4;
|
||||
},
|
||||
square: function (x, y, w, h, shape) {
|
||||
var size = Math.min(w, h);
|
||||
shape.x = x;
|
||||
shape.y = y;
|
||||
shape.width = size;
|
||||
shape.height = size;
|
||||
},
|
||||
circle: function (x, y, w, h, shape) {
|
||||
// Put circle in the center of square
|
||||
shape.cx = x + w / 2;
|
||||
shape.cy = y + h / 2;
|
||||
shape.r = Math.min(w, h) / 2;
|
||||
},
|
||||
diamond: function (x, y, w, h, shape) {
|
||||
shape.cx = x + w / 2;
|
||||
shape.cy = y + h / 2;
|
||||
shape.width = w;
|
||||
shape.height = h;
|
||||
},
|
||||
pin: function (x, y, w, h, shape) {
|
||||
shape.x = x + w / 2;
|
||||
shape.y = y + h / 2;
|
||||
shape.width = w;
|
||||
shape.height = h;
|
||||
},
|
||||
arrow: function (x, y, w, h, shape) {
|
||||
shape.x = x + w / 2;
|
||||
shape.y = y + h / 2;
|
||||
shape.width = w;
|
||||
shape.height = h;
|
||||
},
|
||||
triangle: function (x, y, w, h, shape) {
|
||||
shape.cx = x + w / 2;
|
||||
shape.cy = y + h / 2;
|
||||
shape.width = w;
|
||||
shape.height = h;
|
||||
}
|
||||
};
|
||||
export var symbolBuildProxies = {};
|
||||
each(symbolCtors, function (Ctor, name) {
|
||||
symbolBuildProxies[name] = new Ctor();
|
||||
});
|
||||
var SymbolClz = graphic.Path.extend({
|
||||
type: 'symbol',
|
||||
shape: {
|
||||
symbolType: '',
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: 0,
|
||||
height: 0
|
||||
},
|
||||
calculateTextPosition: function (out, config, rect) {
|
||||
var res = calculateTextPosition(out, config, rect);
|
||||
var shape = this.shape;
|
||||
if (shape && shape.symbolType === 'pin' && config.position === 'inside') {
|
||||
res.y = rect.y + rect.height * 0.4;
|
||||
}
|
||||
return res;
|
||||
},
|
||||
buildPath: function (ctx, shape, inBundle) {
|
||||
var symbolType = shape.symbolType;
|
||||
if (symbolType !== 'none') {
|
||||
var proxySymbol = symbolBuildProxies[symbolType];
|
||||
if (!proxySymbol) {
|
||||
// Default rect
|
||||
symbolType = 'rect';
|
||||
proxySymbol = symbolBuildProxies[symbolType];
|
||||
}
|
||||
symbolShapeMakers[symbolType](shape.x, shape.y, shape.width, shape.height, proxySymbol.shape);
|
||||
proxySymbol.buildPath(ctx, proxySymbol.shape, inBundle);
|
||||
}
|
||||
}
|
||||
});
|
||||
// Provide setColor helper method to avoid determine if set the fill or stroke outside
|
||||
function symbolPathSetColor(color, innerColor) {
|
||||
if (this.type !== 'image') {
|
||||
var symbolStyle = this.style;
|
||||
if (this.__isEmptyBrush) {
|
||||
symbolStyle.stroke = color;
|
||||
symbolStyle.fill = innerColor || '#fff';
|
||||
// TODO Same width with lineStyle in LineView
|
||||
symbolStyle.lineWidth = 2;
|
||||
} else if (this.shape.symbolType === 'line') {
|
||||
symbolStyle.stroke = color;
|
||||
} else {
|
||||
symbolStyle.fill = color;
|
||||
}
|
||||
this.markRedraw();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Create a symbol element with given symbol configuration: shape, x, y, width, height, color
|
||||
*/
|
||||
export function createSymbol(symbolType, x, y, w, h, color,
|
||||
// whether to keep the ratio of w/h,
|
||||
keepAspect) {
|
||||
// TODO Support image object, DynamicImage.
|
||||
var isEmpty = symbolType.indexOf('empty') === 0;
|
||||
if (isEmpty) {
|
||||
symbolType = symbolType.substr(5, 1).toLowerCase() + symbolType.substr(6);
|
||||
}
|
||||
var symbolPath;
|
||||
if (symbolType.indexOf('image://') === 0) {
|
||||
symbolPath = graphic.makeImage(symbolType.slice(8), new BoundingRect(x, y, w, h), keepAspect ? 'center' : 'cover');
|
||||
} else if (symbolType.indexOf('path://') === 0) {
|
||||
symbolPath = graphic.makePath(symbolType.slice(7), {}, new BoundingRect(x, y, w, h), keepAspect ? 'center' : 'cover');
|
||||
} else {
|
||||
symbolPath = new SymbolClz({
|
||||
shape: {
|
||||
symbolType: symbolType,
|
||||
x: x,
|
||||
y: y,
|
||||
width: w,
|
||||
height: h
|
||||
}
|
||||
});
|
||||
}
|
||||
symbolPath.__isEmptyBrush = isEmpty;
|
||||
// TODO Should deprecate setColor
|
||||
symbolPath.setColor = symbolPathSetColor;
|
||||
if (color) {
|
||||
symbolPath.setColor(color);
|
||||
}
|
||||
return symbolPath;
|
||||
}
|
||||
export function normalizeSymbolSize(symbolSize) {
|
||||
if (!isArray(symbolSize)) {
|
||||
symbolSize = [+symbolSize, +symbolSize];
|
||||
}
|
||||
return [symbolSize[0] || 0, symbolSize[1] || 0];
|
||||
}
|
||||
export function normalizeSymbolOffset(symbolOffset, symbolSize) {
|
||||
if (symbolOffset == null) {
|
||||
return;
|
||||
}
|
||||
if (!isArray(symbolOffset)) {
|
||||
symbolOffset = [symbolOffset, symbolOffset];
|
||||
}
|
||||
return [parsePercent(symbolOffset[0], symbolSize[0]) || 0, parsePercent(retrieve2(symbolOffset[1], symbolOffset[0]), symbolSize[1]) || 0];
|
||||
}
|
172
frontend/node_modules/echarts/lib/util/throttle.js
generated
vendored
Normal file
172
frontend/node_modules/echarts/lib/util/throttle.js
generated
vendored
Normal file
@ -0,0 +1,172 @@
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
var ORIGIN_METHOD = '\0__throttleOriginMethod';
|
||||
var RATE = '\0__throttleRate';
|
||||
var THROTTLE_TYPE = '\0__throttleType';
|
||||
;
|
||||
/**
|
||||
* @public
|
||||
* @param {(Function)} fn
|
||||
* @param {number} [delay=0] Unit: ms.
|
||||
* @param {boolean} [debounce=false]
|
||||
* true: If call interval less than `delay`, only the last call works.
|
||||
* false: If call interval less than `delay, call works on fixed rate.
|
||||
* @return {(Function)} throttled fn.
|
||||
*/
|
||||
export function throttle(fn, delay, debounce) {
|
||||
var currCall;
|
||||
var lastCall = 0;
|
||||
var lastExec = 0;
|
||||
var timer = null;
|
||||
var diff;
|
||||
var scope;
|
||||
var args;
|
||||
var debounceNextCall;
|
||||
delay = delay || 0;
|
||||
function exec() {
|
||||
lastExec = new Date().getTime();
|
||||
timer = null;
|
||||
fn.apply(scope, args || []);
|
||||
}
|
||||
var cb = function () {
|
||||
var cbArgs = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
cbArgs[_i] = arguments[_i];
|
||||
}
|
||||
currCall = new Date().getTime();
|
||||
scope = this;
|
||||
args = cbArgs;
|
||||
var thisDelay = debounceNextCall || delay;
|
||||
var thisDebounce = debounceNextCall || debounce;
|
||||
debounceNextCall = null;
|
||||
diff = currCall - (thisDebounce ? lastCall : lastExec) - thisDelay;
|
||||
clearTimeout(timer);
|
||||
// Here we should make sure that: the `exec` SHOULD NOT be called later
|
||||
// than a new call of `cb`, that is, preserving the command order. Consider
|
||||
// calculating "scale rate" when roaming as an example. When a call of `cb`
|
||||
// happens, either the `exec` is called dierectly, or the call is delayed.
|
||||
// But the delayed call should never be later than next call of `cb`. Under
|
||||
// this assurance, we can simply update view state each time `dispatchAction`
|
||||
// triggered by user roaming, but not need to add extra code to avoid the
|
||||
// state being "rolled-back".
|
||||
if (thisDebounce) {
|
||||
timer = setTimeout(exec, thisDelay);
|
||||
} else {
|
||||
if (diff >= 0) {
|
||||
exec();
|
||||
} else {
|
||||
timer = setTimeout(exec, -diff);
|
||||
}
|
||||
}
|
||||
lastCall = currCall;
|
||||
};
|
||||
/**
|
||||
* Clear throttle.
|
||||
* @public
|
||||
*/
|
||||
cb.clear = function () {
|
||||
if (timer) {
|
||||
clearTimeout(timer);
|
||||
timer = null;
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Enable debounce once.
|
||||
*/
|
||||
cb.debounceNextCall = function (debounceDelay) {
|
||||
debounceNextCall = debounceDelay;
|
||||
};
|
||||
return cb;
|
||||
}
|
||||
/**
|
||||
* Create throttle method or update throttle rate.
|
||||
*
|
||||
* @example
|
||||
* ComponentView.prototype.render = function () {
|
||||
* ...
|
||||
* throttle.createOrUpdate(
|
||||
* this,
|
||||
* '_dispatchAction',
|
||||
* this.model.get('throttle'),
|
||||
* 'fixRate'
|
||||
* );
|
||||
* };
|
||||
* ComponentView.prototype.remove = function () {
|
||||
* throttle.clear(this, '_dispatchAction');
|
||||
* };
|
||||
* ComponentView.prototype.dispose = function () {
|
||||
* throttle.clear(this, '_dispatchAction');
|
||||
* };
|
||||
*
|
||||
*/
|
||||
export function createOrUpdate(obj, fnAttr, rate, throttleType) {
|
||||
var fn = obj[fnAttr];
|
||||
if (!fn) {
|
||||
return;
|
||||
}
|
||||
var originFn = fn[ORIGIN_METHOD] || fn;
|
||||
var lastThrottleType = fn[THROTTLE_TYPE];
|
||||
var lastRate = fn[RATE];
|
||||
if (lastRate !== rate || lastThrottleType !== throttleType) {
|
||||
if (rate == null || !throttleType) {
|
||||
return obj[fnAttr] = originFn;
|
||||
}
|
||||
fn = obj[fnAttr] = throttle(originFn, rate, throttleType === 'debounce');
|
||||
fn[ORIGIN_METHOD] = originFn;
|
||||
fn[THROTTLE_TYPE] = throttleType;
|
||||
fn[RATE] = rate;
|
||||
}
|
||||
return fn;
|
||||
}
|
||||
/**
|
||||
* Clear throttle. Example see throttle.createOrUpdate.
|
||||
*/
|
||||
export function clear(obj, fnAttr) {
|
||||
var fn = obj[fnAttr];
|
||||
if (fn && fn[ORIGIN_METHOD]) {
|
||||
// Clear throttle
|
||||
fn.clear && fn.clear();
|
||||
obj[fnAttr] = fn[ORIGIN_METHOD];
|
||||
}
|
||||
}
|
273
frontend/node_modules/echarts/lib/util/time.js
generated
vendored
Normal file
273
frontend/node_modules/echarts/lib/util/time.js
generated
vendored
Normal file
@ -0,0 +1,273 @@
|
||||
|
||||
/*
|
||||
* 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 numberUtil from './number.js';
|
||||
import { getDefaultLocaleModel, getLocaleModel, SYSTEM_LANG } from '../core/locale.js';
|
||||
import Model from '../model/Model.js';
|
||||
export var ONE_SECOND = 1000;
|
||||
export var ONE_MINUTE = ONE_SECOND * 60;
|
||||
export var ONE_HOUR = ONE_MINUTE * 60;
|
||||
export var ONE_DAY = ONE_HOUR * 24;
|
||||
export var ONE_YEAR = ONE_DAY * 365;
|
||||
export var defaultLeveledFormatter = {
|
||||
year: '{yyyy}',
|
||||
month: '{MMM}',
|
||||
day: '{d}',
|
||||
hour: '{HH}:{mm}',
|
||||
minute: '{HH}:{mm}',
|
||||
second: '{HH}:{mm}:{ss}',
|
||||
millisecond: '{HH}:{mm}:{ss} {SSS}',
|
||||
none: '{yyyy}-{MM}-{dd} {HH}:{mm}:{ss} {SSS}'
|
||||
};
|
||||
var fullDayFormatter = '{yyyy}-{MM}-{dd}';
|
||||
export var fullLeveledFormatter = {
|
||||
year: '{yyyy}',
|
||||
month: '{yyyy}-{MM}',
|
||||
day: fullDayFormatter,
|
||||
hour: fullDayFormatter + ' ' + defaultLeveledFormatter.hour,
|
||||
minute: fullDayFormatter + ' ' + defaultLeveledFormatter.minute,
|
||||
second: fullDayFormatter + ' ' + defaultLeveledFormatter.second,
|
||||
millisecond: defaultLeveledFormatter.none
|
||||
};
|
||||
export var primaryTimeUnits = ['year', 'month', 'day', 'hour', 'minute', 'second', 'millisecond'];
|
||||
export var timeUnits = ['year', 'half-year', 'quarter', 'month', 'week', 'half-week', 'day', 'half-day', 'quarter-day', 'hour', 'minute', 'second', 'millisecond'];
|
||||
export function pad(str, len) {
|
||||
str += '';
|
||||
return '0000'.substr(0, len - str.length) + str;
|
||||
}
|
||||
export function getPrimaryTimeUnit(timeUnit) {
|
||||
switch (timeUnit) {
|
||||
case 'half-year':
|
||||
case 'quarter':
|
||||
return 'month';
|
||||
case 'week':
|
||||
case 'half-week':
|
||||
return 'day';
|
||||
case 'half-day':
|
||||
case 'quarter-day':
|
||||
return 'hour';
|
||||
default:
|
||||
// year, minutes, second, milliseconds
|
||||
return timeUnit;
|
||||
}
|
||||
}
|
||||
export function isPrimaryTimeUnit(timeUnit) {
|
||||
return timeUnit === getPrimaryTimeUnit(timeUnit);
|
||||
}
|
||||
export function getDefaultFormatPrecisionOfInterval(timeUnit) {
|
||||
switch (timeUnit) {
|
||||
case 'year':
|
||||
case 'month':
|
||||
return 'day';
|
||||
case 'millisecond':
|
||||
return 'millisecond';
|
||||
default:
|
||||
// Also for day, hour, minute, second
|
||||
return 'second';
|
||||
}
|
||||
}
|
||||
export function format(
|
||||
// Note: The result based on `isUTC` are totally different, which can not be just simply
|
||||
// substituted by the result without `isUTC`. So we make the param `isUTC` mandatory.
|
||||
time, template, isUTC, lang) {
|
||||
var date = numberUtil.parseDate(time);
|
||||
var y = date[fullYearGetterName(isUTC)]();
|
||||
var M = date[monthGetterName(isUTC)]() + 1;
|
||||
var q = Math.floor((M - 1) / 3) + 1;
|
||||
var d = date[dateGetterName(isUTC)]();
|
||||
var e = date['get' + (isUTC ? 'UTC' : '') + 'Day']();
|
||||
var H = date[hoursGetterName(isUTC)]();
|
||||
var h = (H - 1) % 12 + 1;
|
||||
var m = date[minutesGetterName(isUTC)]();
|
||||
var s = date[secondsGetterName(isUTC)]();
|
||||
var S = date[millisecondsGetterName(isUTC)]();
|
||||
var a = H >= 12 ? 'pm' : 'am';
|
||||
var A = a.toUpperCase();
|
||||
var localeModel = lang instanceof Model ? lang : getLocaleModel(lang || SYSTEM_LANG) || getDefaultLocaleModel();
|
||||
var timeModel = localeModel.getModel('time');
|
||||
var month = timeModel.get('month');
|
||||
var monthAbbr = timeModel.get('monthAbbr');
|
||||
var dayOfWeek = timeModel.get('dayOfWeek');
|
||||
var dayOfWeekAbbr = timeModel.get('dayOfWeekAbbr');
|
||||
return (template || '').replace(/{a}/g, a + '').replace(/{A}/g, A + '').replace(/{yyyy}/g, y + '').replace(/{yy}/g, pad(y % 100 + '', 2)).replace(/{Q}/g, q + '').replace(/{MMMM}/g, month[M - 1]).replace(/{MMM}/g, monthAbbr[M - 1]).replace(/{MM}/g, pad(M, 2)).replace(/{M}/g, M + '').replace(/{dd}/g, pad(d, 2)).replace(/{d}/g, d + '').replace(/{eeee}/g, dayOfWeek[e]).replace(/{ee}/g, dayOfWeekAbbr[e]).replace(/{e}/g, e + '').replace(/{HH}/g, pad(H, 2)).replace(/{H}/g, H + '').replace(/{hh}/g, pad(h + '', 2)).replace(/{h}/g, h + '').replace(/{mm}/g, pad(m, 2)).replace(/{m}/g, m + '').replace(/{ss}/g, pad(s, 2)).replace(/{s}/g, s + '').replace(/{SSS}/g, pad(S, 3)).replace(/{S}/g, S + '');
|
||||
}
|
||||
export function leveledFormat(tick, idx, formatter, lang, isUTC) {
|
||||
var template = null;
|
||||
if (zrUtil.isString(formatter)) {
|
||||
// Single formatter for all units at all levels
|
||||
template = formatter;
|
||||
} else if (zrUtil.isFunction(formatter)) {
|
||||
// Callback formatter
|
||||
template = formatter(tick.value, idx, {
|
||||
level: tick.level
|
||||
});
|
||||
} else {
|
||||
var defaults = zrUtil.extend({}, defaultLeveledFormatter);
|
||||
if (tick.level > 0) {
|
||||
for (var i = 0; i < primaryTimeUnits.length; ++i) {
|
||||
defaults[primaryTimeUnits[i]] = "{primary|" + defaults[primaryTimeUnits[i]] + "}";
|
||||
}
|
||||
}
|
||||
var mergedFormatter = formatter ? formatter.inherit === false ? formatter // Use formatter with bigger units
|
||||
: zrUtil.defaults(formatter, defaults) : defaults;
|
||||
var unit = getUnitFromValue(tick.value, isUTC);
|
||||
if (mergedFormatter[unit]) {
|
||||
template = mergedFormatter[unit];
|
||||
} else if (mergedFormatter.inherit) {
|
||||
// Unit formatter is not defined and should inherit from bigger units
|
||||
var targetId = timeUnits.indexOf(unit);
|
||||
for (var i = targetId - 1; i >= 0; --i) {
|
||||
if (mergedFormatter[unit]) {
|
||||
template = mergedFormatter[unit];
|
||||
break;
|
||||
}
|
||||
}
|
||||
template = template || defaults.none;
|
||||
}
|
||||
if (zrUtil.isArray(template)) {
|
||||
var levelId = tick.level == null ? 0 : tick.level >= 0 ? tick.level : template.length + tick.level;
|
||||
levelId = Math.min(levelId, template.length - 1);
|
||||
template = template[levelId];
|
||||
}
|
||||
}
|
||||
return format(new Date(tick.value), template, isUTC, lang);
|
||||
}
|
||||
export function getUnitFromValue(value, isUTC) {
|
||||
var date = numberUtil.parseDate(value);
|
||||
var M = date[monthGetterName(isUTC)]() + 1;
|
||||
var d = date[dateGetterName(isUTC)]();
|
||||
var h = date[hoursGetterName(isUTC)]();
|
||||
var m = date[minutesGetterName(isUTC)]();
|
||||
var s = date[secondsGetterName(isUTC)]();
|
||||
var S = date[millisecondsGetterName(isUTC)]();
|
||||
var isSecond = S === 0;
|
||||
var isMinute = isSecond && s === 0;
|
||||
var isHour = isMinute && m === 0;
|
||||
var isDay = isHour && h === 0;
|
||||
var isMonth = isDay && d === 1;
|
||||
var isYear = isMonth && M === 1;
|
||||
if (isYear) {
|
||||
return 'year';
|
||||
} else if (isMonth) {
|
||||
return 'month';
|
||||
} else if (isDay) {
|
||||
return 'day';
|
||||
} else if (isHour) {
|
||||
return 'hour';
|
||||
} else if (isMinute) {
|
||||
return 'minute';
|
||||
} else if (isSecond) {
|
||||
return 'second';
|
||||
} else {
|
||||
return 'millisecond';
|
||||
}
|
||||
}
|
||||
export function getUnitValue(value, unit, isUTC) {
|
||||
var date = zrUtil.isNumber(value) ? numberUtil.parseDate(value) : value;
|
||||
unit = unit || getUnitFromValue(value, isUTC);
|
||||
switch (unit) {
|
||||
case 'year':
|
||||
return date[fullYearGetterName(isUTC)]();
|
||||
case 'half-year':
|
||||
return date[monthGetterName(isUTC)]() >= 6 ? 1 : 0;
|
||||
case 'quarter':
|
||||
return Math.floor((date[monthGetterName(isUTC)]() + 1) / 4);
|
||||
case 'month':
|
||||
return date[monthGetterName(isUTC)]();
|
||||
case 'day':
|
||||
return date[dateGetterName(isUTC)]();
|
||||
case 'half-day':
|
||||
return date[hoursGetterName(isUTC)]() / 24;
|
||||
case 'hour':
|
||||
return date[hoursGetterName(isUTC)]();
|
||||
case 'minute':
|
||||
return date[minutesGetterName(isUTC)]();
|
||||
case 'second':
|
||||
return date[secondsGetterName(isUTC)]();
|
||||
case 'millisecond':
|
||||
return date[millisecondsGetterName(isUTC)]();
|
||||
}
|
||||
}
|
||||
export function fullYearGetterName(isUTC) {
|
||||
return isUTC ? 'getUTCFullYear' : 'getFullYear';
|
||||
}
|
||||
export function monthGetterName(isUTC) {
|
||||
return isUTC ? 'getUTCMonth' : 'getMonth';
|
||||
}
|
||||
export function dateGetterName(isUTC) {
|
||||
return isUTC ? 'getUTCDate' : 'getDate';
|
||||
}
|
||||
export function hoursGetterName(isUTC) {
|
||||
return isUTC ? 'getUTCHours' : 'getHours';
|
||||
}
|
||||
export function minutesGetterName(isUTC) {
|
||||
return isUTC ? 'getUTCMinutes' : 'getMinutes';
|
||||
}
|
||||
export function secondsGetterName(isUTC) {
|
||||
return isUTC ? 'getUTCSeconds' : 'getSeconds';
|
||||
}
|
||||
export function millisecondsGetterName(isUTC) {
|
||||
return isUTC ? 'getUTCMilliseconds' : 'getMilliseconds';
|
||||
}
|
||||
export function fullYearSetterName(isUTC) {
|
||||
return isUTC ? 'setUTCFullYear' : 'setFullYear';
|
||||
}
|
||||
export function monthSetterName(isUTC) {
|
||||
return isUTC ? 'setUTCMonth' : 'setMonth';
|
||||
}
|
||||
export function dateSetterName(isUTC) {
|
||||
return isUTC ? 'setUTCDate' : 'setDate';
|
||||
}
|
||||
export function hoursSetterName(isUTC) {
|
||||
return isUTC ? 'setUTCHours' : 'setHours';
|
||||
}
|
||||
export function minutesSetterName(isUTC) {
|
||||
return isUTC ? 'setUTCMinutes' : 'setMinutes';
|
||||
}
|
||||
export function secondsSetterName(isUTC) {
|
||||
return isUTC ? 'setUTCSeconds' : 'setSeconds';
|
||||
}
|
||||
export function millisecondsSetterName(isUTC) {
|
||||
return isUTC ? 'setUTCMilliseconds' : 'setMilliseconds';
|
||||
}
|
60
frontend/node_modules/echarts/lib/util/types.js
generated
vendored
Normal file
60
frontend/node_modules/echarts/lib/util/types.js
generated
vendored
Normal file
@ -0,0 +1,60 @@
|
||||
|
||||
/*
|
||||
* 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 { createHashMap } from 'zrender/lib/core/util.js';
|
||||
;
|
||||
;
|
||||
;
|
||||
export var VISUAL_DIMENSIONS = createHashMap(['tooltip', 'label', 'itemName', 'itemId', 'itemGroupId', 'itemChildGroupId', 'seriesName']);
|
||||
export var SOURCE_FORMAT_ORIGINAL = 'original';
|
||||
export var SOURCE_FORMAT_ARRAY_ROWS = 'arrayRows';
|
||||
export var SOURCE_FORMAT_OBJECT_ROWS = 'objectRows';
|
||||
export var SOURCE_FORMAT_KEYED_COLUMNS = 'keyedColumns';
|
||||
export var SOURCE_FORMAT_TYPED_ARRAY = 'typedArray';
|
||||
export var SOURCE_FORMAT_UNKNOWN = 'unknown';
|
||||
export var SERIES_LAYOUT_BY_COLUMN = 'column';
|
||||
export var SERIES_LAYOUT_BY_ROW = 'row';
|
||||
;
|
||||
;
|
||||
;
|
||||
;
|
55
frontend/node_modules/echarts/lib/util/vendor.js
generated
vendored
Normal file
55
frontend/node_modules/echarts/lib/util/vendor.js
generated
vendored
Normal file
@ -0,0 +1,55 @@
|
||||
|
||||
/*
|
||||
* 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 { isArray } from 'zrender/lib/core/util.js';
|
||||
/* global Float32Array */
|
||||
var supportFloat32Array = typeof Float32Array !== 'undefined';
|
||||
var Float32ArrayCtor = !supportFloat32Array ? Array : Float32Array;
|
||||
export function createFloat32Array(arg) {
|
||||
if (isArray(arg)) {
|
||||
// Return self directly if don't support TypedArray.
|
||||
return supportFloat32Array ? new Float32Array(arg) : arg;
|
||||
}
|
||||
// Else is number
|
||||
return new Float32ArrayCtor(arg);
|
||||
}
|
Reference in New Issue
Block a user