逐步完成前后端服务器
This commit is contained in:
152
frontend/node_modules/echarts/lib/chart/line/LineSeries.js
generated
vendored
Normal file
152
frontend/node_modules/echarts/lib/chart/line/LineSeries.js
generated
vendored
Normal file
@ -0,0 +1,152 @@
|
||||
|
||||
/*
|
||||
* 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 createSeriesData from '../helper/createSeriesData.js';
|
||||
import SeriesModel from '../../model/Series.js';
|
||||
import { createSymbol } from '../../util/symbol.js';
|
||||
import { Group } from '../../util/graphic.js';
|
||||
var LineSeriesModel = /** @class */function (_super) {
|
||||
__extends(LineSeriesModel, _super);
|
||||
function LineSeriesModel() {
|
||||
var _this = _super !== null && _super.apply(this, arguments) || this;
|
||||
_this.type = LineSeriesModel.type;
|
||||
_this.hasSymbolVisual = true;
|
||||
return _this;
|
||||
}
|
||||
LineSeriesModel.prototype.getInitialData = function (option) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
var coordSys = option.coordinateSystem;
|
||||
if (coordSys !== 'polar' && coordSys !== 'cartesian2d') {
|
||||
throw new Error('Line not support coordinateSystem besides cartesian and polar');
|
||||
}
|
||||
}
|
||||
return createSeriesData(null, this, {
|
||||
useEncodeDefaulter: true
|
||||
});
|
||||
};
|
||||
LineSeriesModel.prototype.getLegendIcon = function (opt) {
|
||||
var group = new Group();
|
||||
var line = createSymbol('line', 0, opt.itemHeight / 2, opt.itemWidth, 0, opt.lineStyle.stroke, false);
|
||||
group.add(line);
|
||||
line.setStyle(opt.lineStyle);
|
||||
var visualType = this.getData().getVisual('symbol');
|
||||
var visualRotate = this.getData().getVisual('symbolRotate');
|
||||
var symbolType = visualType === 'none' ? 'circle' : visualType;
|
||||
// Symbol size is 80% when there is a line
|
||||
var size = opt.itemHeight * 0.8;
|
||||
var symbol = createSymbol(symbolType, (opt.itemWidth - size) / 2, (opt.itemHeight - size) / 2, size, size, opt.itemStyle.fill);
|
||||
group.add(symbol);
|
||||
symbol.setStyle(opt.itemStyle);
|
||||
var symbolRotate = opt.iconRotate === 'inherit' ? visualRotate : opt.iconRotate || 0;
|
||||
symbol.rotation = symbolRotate * Math.PI / 180;
|
||||
symbol.setOrigin([opt.itemWidth / 2, opt.itemHeight / 2]);
|
||||
if (symbolType.indexOf('empty') > -1) {
|
||||
symbol.style.stroke = symbol.style.fill;
|
||||
symbol.style.fill = '#fff';
|
||||
symbol.style.lineWidth = 2;
|
||||
}
|
||||
return group;
|
||||
};
|
||||
LineSeriesModel.type = 'series.line';
|
||||
LineSeriesModel.dependencies = ['grid', 'polar'];
|
||||
LineSeriesModel.defaultOption = {
|
||||
// zlevel: 0,
|
||||
z: 3,
|
||||
coordinateSystem: 'cartesian2d',
|
||||
legendHoverLink: true,
|
||||
clip: true,
|
||||
label: {
|
||||
position: 'top'
|
||||
},
|
||||
// itemStyle: {
|
||||
// },
|
||||
endLabel: {
|
||||
show: false,
|
||||
valueAnimation: true,
|
||||
distance: 8
|
||||
},
|
||||
lineStyle: {
|
||||
width: 2,
|
||||
type: 'solid'
|
||||
},
|
||||
emphasis: {
|
||||
scale: true
|
||||
},
|
||||
// areaStyle: {
|
||||
// origin of areaStyle. Valid values:
|
||||
// `'auto'/null/undefined`: from axisLine to data
|
||||
// `'start'`: from min to data
|
||||
// `'end'`: from data to max
|
||||
// origin: 'auto'
|
||||
// },
|
||||
// false, 'start', 'end', 'middle'
|
||||
step: false,
|
||||
// Disabled if step is true
|
||||
smooth: false,
|
||||
smoothMonotone: null,
|
||||
symbol: 'emptyCircle',
|
||||
symbolSize: 4,
|
||||
symbolRotate: null,
|
||||
showSymbol: true,
|
||||
// `false`: follow the label interval strategy.
|
||||
// `true`: show all symbols.
|
||||
// `'auto'`: If possible, show all symbols, otherwise
|
||||
// follow the label interval strategy.
|
||||
showAllSymbol: 'auto',
|
||||
// Whether to connect break point.
|
||||
connectNulls: false,
|
||||
// Sampling for large data. Can be: 'average', 'max', 'min', 'sum', 'lttb'.
|
||||
sampling: 'none',
|
||||
animationEasing: 'linear',
|
||||
// Disable progressive
|
||||
progressive: 0,
|
||||
hoverLayerThreshold: Infinity,
|
||||
universalTransition: {
|
||||
divideShape: 'clone'
|
||||
},
|
||||
triggerLineEvent: false
|
||||
};
|
||||
return LineSeriesModel;
|
||||
}(SeriesModel);
|
||||
export default LineSeriesModel;
|
1119
frontend/node_modules/echarts/lib/chart/line/LineView.js
generated
vendored
Normal file
1119
frontend/node_modules/echarts/lib/chart/line/LineView.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
122
frontend/node_modules/echarts/lib/chart/line/helper.js
generated
vendored
Normal file
122
frontend/node_modules/echarts/lib/chart/line/helper.js
generated
vendored
Normal file
@ -0,0 +1,122 @@
|
||||
|
||||
/*
|
||||
* 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 { isDimensionStacked } from '../../data/helper/dataStackHelper.js';
|
||||
import { isNumber, map } from 'zrender/lib/core/util.js';
|
||||
export function prepareDataCoordInfo(coordSys, data, valueOrigin) {
|
||||
var baseAxis = coordSys.getBaseAxis();
|
||||
var valueAxis = coordSys.getOtherAxis(baseAxis);
|
||||
var valueStart = getValueStart(valueAxis, valueOrigin);
|
||||
var baseAxisDim = baseAxis.dim;
|
||||
var valueAxisDim = valueAxis.dim;
|
||||
var valueDim = data.mapDimension(valueAxisDim);
|
||||
var baseDim = data.mapDimension(baseAxisDim);
|
||||
var baseDataOffset = valueAxisDim === 'x' || valueAxisDim === 'radius' ? 1 : 0;
|
||||
var dims = map(coordSys.dimensions, function (coordDim) {
|
||||
return data.mapDimension(coordDim);
|
||||
});
|
||||
var stacked = false;
|
||||
var stackResultDim = data.getCalculationInfo('stackResultDimension');
|
||||
if (isDimensionStacked(data, dims[0] /* , dims[1] */)) {
|
||||
// jshint ignore:line
|
||||
stacked = true;
|
||||
dims[0] = stackResultDim;
|
||||
}
|
||||
if (isDimensionStacked(data, dims[1] /* , dims[0] */)) {
|
||||
// jshint ignore:line
|
||||
stacked = true;
|
||||
dims[1] = stackResultDim;
|
||||
}
|
||||
return {
|
||||
dataDimsForPoint: dims,
|
||||
valueStart: valueStart,
|
||||
valueAxisDim: valueAxisDim,
|
||||
baseAxisDim: baseAxisDim,
|
||||
stacked: !!stacked,
|
||||
valueDim: valueDim,
|
||||
baseDim: baseDim,
|
||||
baseDataOffset: baseDataOffset,
|
||||
stackedOverDimension: data.getCalculationInfo('stackedOverDimension')
|
||||
};
|
||||
}
|
||||
function getValueStart(valueAxis, valueOrigin) {
|
||||
var valueStart = 0;
|
||||
var extent = valueAxis.scale.getExtent();
|
||||
if (valueOrigin === 'start') {
|
||||
valueStart = extent[0];
|
||||
} else if (valueOrigin === 'end') {
|
||||
valueStart = extent[1];
|
||||
}
|
||||
// If origin is specified as a number, use it as
|
||||
// valueStart directly
|
||||
else if (isNumber(valueOrigin) && !isNaN(valueOrigin)) {
|
||||
valueStart = valueOrigin;
|
||||
}
|
||||
// auto
|
||||
else {
|
||||
// Both positive
|
||||
if (extent[0] > 0) {
|
||||
valueStart = extent[0];
|
||||
}
|
||||
// Both negative
|
||||
else if (extent[1] < 0) {
|
||||
valueStart = extent[1];
|
||||
}
|
||||
// If is one positive, and one negative, onZero shall be true
|
||||
}
|
||||
return valueStart;
|
||||
}
|
||||
export function getStackedOnPoint(dataCoordInfo, coordSys, data, idx) {
|
||||
var value = NaN;
|
||||
if (dataCoordInfo.stacked) {
|
||||
value = data.get(data.getCalculationInfo('stackedOverDimension'), idx);
|
||||
}
|
||||
if (isNaN(value)) {
|
||||
value = dataCoordInfo.valueStart;
|
||||
}
|
||||
var baseDataOffset = dataCoordInfo.baseDataOffset;
|
||||
var stackedData = [];
|
||||
stackedData[baseDataOffset] = data.get(dataCoordInfo.baseDim, idx);
|
||||
stackedData[1 - baseDataOffset] = value;
|
||||
return coordSys.dataToPoint(stackedData);
|
||||
}
|
69
frontend/node_modules/echarts/lib/chart/line/install.js
generated
vendored
Normal file
69
frontend/node_modules/echarts/lib/chart/line/install.js
generated
vendored
Normal file
@ -0,0 +1,69 @@
|
||||
|
||||
/*
|
||||
* 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 LineSeries from './LineSeries.js';
|
||||
import LineView from './LineView.js';
|
||||
// In case developer forget to include grid component
|
||||
import layoutPoints from '../../layout/points.js';
|
||||
import dataSample from '../../processor/dataSample.js';
|
||||
export function install(registers) {
|
||||
registers.registerChartView(LineView);
|
||||
registers.registerSeriesModel(LineSeries);
|
||||
registers.registerLayout(layoutPoints('line', true));
|
||||
registers.registerVisual({
|
||||
seriesType: 'line',
|
||||
reset: function (seriesModel) {
|
||||
var data = seriesModel.getData();
|
||||
// Visual coding for legend
|
||||
var lineStyle = seriesModel.getModel('lineStyle').getLineStyle();
|
||||
if (lineStyle && !lineStyle.stroke) {
|
||||
// Fill in visual should be palette color if
|
||||
// has color callback
|
||||
lineStyle.stroke = data.getVisual('style').fill;
|
||||
}
|
||||
data.setVisual('legendLineStyle', lineStyle);
|
||||
}
|
||||
});
|
||||
// Down sample after filter
|
||||
registers.registerProcessor(registers.PRIORITY.PROCESSOR.STATISTIC, dataSample('line'));
|
||||
}
|
165
frontend/node_modules/echarts/lib/chart/line/lineAnimationDiff.js
generated
vendored
Normal file
165
frontend/node_modules/echarts/lib/chart/line/lineAnimationDiff.js
generated
vendored
Normal file
@ -0,0 +1,165 @@
|
||||
|
||||
/*
|
||||
* 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 { prepareDataCoordInfo, getStackedOnPoint } from './helper.js';
|
||||
import { createFloat32Array } from '../../util/vendor.js';
|
||||
function diffData(oldData, newData) {
|
||||
var diffResult = [];
|
||||
newData.diff(oldData).add(function (idx) {
|
||||
diffResult.push({
|
||||
cmd: '+',
|
||||
idx: idx
|
||||
});
|
||||
}).update(function (newIdx, oldIdx) {
|
||||
diffResult.push({
|
||||
cmd: '=',
|
||||
idx: oldIdx,
|
||||
idx1: newIdx
|
||||
});
|
||||
}).remove(function (idx) {
|
||||
diffResult.push({
|
||||
cmd: '-',
|
||||
idx: idx
|
||||
});
|
||||
}).execute();
|
||||
return diffResult;
|
||||
}
|
||||
export default function lineAnimationDiff(oldData, newData, oldStackedOnPoints, newStackedOnPoints, oldCoordSys, newCoordSys, oldValueOrigin, newValueOrigin) {
|
||||
var diff = diffData(oldData, newData);
|
||||
// let newIdList = newData.mapArray(newData.getId);
|
||||
// let oldIdList = oldData.mapArray(oldData.getId);
|
||||
// convertToIntId(newIdList, oldIdList);
|
||||
// // FIXME One data ?
|
||||
// diff = arrayDiff(oldIdList, newIdList);
|
||||
var currPoints = [];
|
||||
var nextPoints = [];
|
||||
// Points for stacking base line
|
||||
var currStackedPoints = [];
|
||||
var nextStackedPoints = [];
|
||||
var status = [];
|
||||
var sortedIndices = [];
|
||||
var rawIndices = [];
|
||||
var newDataOldCoordInfo = prepareDataCoordInfo(oldCoordSys, newData, oldValueOrigin);
|
||||
// const oldDataNewCoordInfo = prepareDataCoordInfo(newCoordSys, oldData, newValueOrigin);
|
||||
var oldPoints = oldData.getLayout('points') || [];
|
||||
var newPoints = newData.getLayout('points') || [];
|
||||
for (var i = 0; i < diff.length; i++) {
|
||||
var diffItem = diff[i];
|
||||
var pointAdded = true;
|
||||
var oldIdx2 = void 0;
|
||||
var newIdx2 = void 0;
|
||||
// FIXME, animation is not so perfect when dataZoom window moves fast
|
||||
// Which is in case remvoing or add more than one data in the tail or head
|
||||
switch (diffItem.cmd) {
|
||||
case '=':
|
||||
oldIdx2 = diffItem.idx * 2;
|
||||
newIdx2 = diffItem.idx1 * 2;
|
||||
var currentX = oldPoints[oldIdx2];
|
||||
var currentY = oldPoints[oldIdx2 + 1];
|
||||
var nextX = newPoints[newIdx2];
|
||||
var nextY = newPoints[newIdx2 + 1];
|
||||
// If previous data is NaN, use next point directly
|
||||
if (isNaN(currentX) || isNaN(currentY)) {
|
||||
currentX = nextX;
|
||||
currentY = nextY;
|
||||
}
|
||||
currPoints.push(currentX, currentY);
|
||||
nextPoints.push(nextX, nextY);
|
||||
currStackedPoints.push(oldStackedOnPoints[oldIdx2], oldStackedOnPoints[oldIdx2 + 1]);
|
||||
nextStackedPoints.push(newStackedOnPoints[newIdx2], newStackedOnPoints[newIdx2 + 1]);
|
||||
rawIndices.push(newData.getRawIndex(diffItem.idx1));
|
||||
break;
|
||||
case '+':
|
||||
var newIdx = diffItem.idx;
|
||||
var newDataDimsForPoint = newDataOldCoordInfo.dataDimsForPoint;
|
||||
var oldPt = oldCoordSys.dataToPoint([newData.get(newDataDimsForPoint[0], newIdx), newData.get(newDataDimsForPoint[1], newIdx)]);
|
||||
newIdx2 = newIdx * 2;
|
||||
currPoints.push(oldPt[0], oldPt[1]);
|
||||
nextPoints.push(newPoints[newIdx2], newPoints[newIdx2 + 1]);
|
||||
var stackedOnPoint = getStackedOnPoint(newDataOldCoordInfo, oldCoordSys, newData, newIdx);
|
||||
currStackedPoints.push(stackedOnPoint[0], stackedOnPoint[1]);
|
||||
nextStackedPoints.push(newStackedOnPoints[newIdx2], newStackedOnPoints[newIdx2 + 1]);
|
||||
rawIndices.push(newData.getRawIndex(newIdx));
|
||||
break;
|
||||
case '-':
|
||||
pointAdded = false;
|
||||
}
|
||||
// Original indices
|
||||
if (pointAdded) {
|
||||
status.push(diffItem);
|
||||
sortedIndices.push(sortedIndices.length);
|
||||
}
|
||||
}
|
||||
// Diff result may be crossed if all items are changed
|
||||
// Sort by data index
|
||||
sortedIndices.sort(function (a, b) {
|
||||
return rawIndices[a] - rawIndices[b];
|
||||
});
|
||||
var len = currPoints.length;
|
||||
var sortedCurrPoints = createFloat32Array(len);
|
||||
var sortedNextPoints = createFloat32Array(len);
|
||||
var sortedCurrStackedPoints = createFloat32Array(len);
|
||||
var sortedNextStackedPoints = createFloat32Array(len);
|
||||
var sortedStatus = [];
|
||||
for (var i = 0; i < sortedIndices.length; i++) {
|
||||
var idx = sortedIndices[i];
|
||||
var i2 = i * 2;
|
||||
var idx2 = idx * 2;
|
||||
sortedCurrPoints[i2] = currPoints[idx2];
|
||||
sortedCurrPoints[i2 + 1] = currPoints[idx2 + 1];
|
||||
sortedNextPoints[i2] = nextPoints[idx2];
|
||||
sortedNextPoints[i2 + 1] = nextPoints[idx2 + 1];
|
||||
sortedCurrStackedPoints[i2] = currStackedPoints[idx2];
|
||||
sortedCurrStackedPoints[i2 + 1] = currStackedPoints[idx2 + 1];
|
||||
sortedNextStackedPoints[i2] = nextStackedPoints[idx2];
|
||||
sortedNextStackedPoints[i2 + 1] = nextStackedPoints[idx2 + 1];
|
||||
sortedStatus[i] = status[idx];
|
||||
}
|
||||
return {
|
||||
current: sortedCurrPoints,
|
||||
next: sortedNextPoints,
|
||||
stackedOnCurrent: sortedCurrStackedPoints,
|
||||
stackedOnNext: sortedNextStackedPoints,
|
||||
status: sortedStatus
|
||||
};
|
||||
}
|
353
frontend/node_modules/echarts/lib/chart/line/poly.js
generated
vendored
Normal file
353
frontend/node_modules/echarts/lib/chart/line/poly.js
generated
vendored
Normal file
@ -0,0 +1,353 @@
|
||||
|
||||
/*
|
||||
* 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";
|
||||
// Poly path support NaN point
|
||||
import Path from 'zrender/lib/graphic/Path.js';
|
||||
import PathProxy from 'zrender/lib/core/PathProxy.js';
|
||||
import { cubicRootAt, cubicAt } from 'zrender/lib/core/curve.js';
|
||||
var mathMin = Math.min;
|
||||
var mathMax = Math.max;
|
||||
function isPointNull(x, y) {
|
||||
return isNaN(x) || isNaN(y);
|
||||
}
|
||||
/**
|
||||
* Draw smoothed line in non-monotone, in may cause undesired curve in extreme
|
||||
* situations. This should be used when points are non-monotone neither in x or
|
||||
* y dimension.
|
||||
*/
|
||||
function drawSegment(ctx, points, start, segLen, allLen, dir, smooth, smoothMonotone, connectNulls) {
|
||||
var prevX;
|
||||
var prevY;
|
||||
var cpx0;
|
||||
var cpy0;
|
||||
var cpx1;
|
||||
var cpy1;
|
||||
var idx = start;
|
||||
var k = 0;
|
||||
for (; k < segLen; k++) {
|
||||
var x = points[idx * 2];
|
||||
var y = points[idx * 2 + 1];
|
||||
if (idx >= allLen || idx < 0) {
|
||||
break;
|
||||
}
|
||||
if (isPointNull(x, y)) {
|
||||
if (connectNulls) {
|
||||
idx += dir;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (idx === start) {
|
||||
ctx[dir > 0 ? 'moveTo' : 'lineTo'](x, y);
|
||||
cpx0 = x;
|
||||
cpy0 = y;
|
||||
} else {
|
||||
var dx = x - prevX;
|
||||
var dy = y - prevY;
|
||||
// Ignore tiny segment.
|
||||
if (dx * dx + dy * dy < 0.5) {
|
||||
idx += dir;
|
||||
continue;
|
||||
}
|
||||
if (smooth > 0) {
|
||||
var nextIdx = idx + dir;
|
||||
var nextX = points[nextIdx * 2];
|
||||
var nextY = points[nextIdx * 2 + 1];
|
||||
// Ignore duplicate point
|
||||
while (nextX === x && nextY === y && k < segLen) {
|
||||
k++;
|
||||
nextIdx += dir;
|
||||
idx += dir;
|
||||
nextX = points[nextIdx * 2];
|
||||
nextY = points[nextIdx * 2 + 1];
|
||||
x = points[idx * 2];
|
||||
y = points[idx * 2 + 1];
|
||||
dx = x - prevX;
|
||||
dy = y - prevY;
|
||||
}
|
||||
var tmpK = k + 1;
|
||||
if (connectNulls) {
|
||||
// Find next point not null
|
||||
while (isPointNull(nextX, nextY) && tmpK < segLen) {
|
||||
tmpK++;
|
||||
nextIdx += dir;
|
||||
nextX = points[nextIdx * 2];
|
||||
nextY = points[nextIdx * 2 + 1];
|
||||
}
|
||||
}
|
||||
var ratioNextSeg = 0.5;
|
||||
var vx = 0;
|
||||
var vy = 0;
|
||||
var nextCpx0 = void 0;
|
||||
var nextCpy0 = void 0;
|
||||
// Is last point
|
||||
if (tmpK >= segLen || isPointNull(nextX, nextY)) {
|
||||
cpx1 = x;
|
||||
cpy1 = y;
|
||||
} else {
|
||||
vx = nextX - prevX;
|
||||
vy = nextY - prevY;
|
||||
var dx0 = x - prevX;
|
||||
var dx1 = nextX - x;
|
||||
var dy0 = y - prevY;
|
||||
var dy1 = nextY - y;
|
||||
var lenPrevSeg = void 0;
|
||||
var lenNextSeg = void 0;
|
||||
if (smoothMonotone === 'x') {
|
||||
lenPrevSeg = Math.abs(dx0);
|
||||
lenNextSeg = Math.abs(dx1);
|
||||
var dir_1 = vx > 0 ? 1 : -1;
|
||||
cpx1 = x - dir_1 * lenPrevSeg * smooth;
|
||||
cpy1 = y;
|
||||
nextCpx0 = x + dir_1 * lenNextSeg * smooth;
|
||||
nextCpy0 = y;
|
||||
} else if (smoothMonotone === 'y') {
|
||||
lenPrevSeg = Math.abs(dy0);
|
||||
lenNextSeg = Math.abs(dy1);
|
||||
var dir_2 = vy > 0 ? 1 : -1;
|
||||
cpx1 = x;
|
||||
cpy1 = y - dir_2 * lenPrevSeg * smooth;
|
||||
nextCpx0 = x;
|
||||
nextCpy0 = y + dir_2 * lenNextSeg * smooth;
|
||||
} else {
|
||||
lenPrevSeg = Math.sqrt(dx0 * dx0 + dy0 * dy0);
|
||||
lenNextSeg = Math.sqrt(dx1 * dx1 + dy1 * dy1);
|
||||
// Use ratio of seg length
|
||||
ratioNextSeg = lenNextSeg / (lenNextSeg + lenPrevSeg);
|
||||
cpx1 = x - vx * smooth * (1 - ratioNextSeg);
|
||||
cpy1 = y - vy * smooth * (1 - ratioNextSeg);
|
||||
// cp0 of next segment
|
||||
nextCpx0 = x + vx * smooth * ratioNextSeg;
|
||||
nextCpy0 = y + vy * smooth * ratioNextSeg;
|
||||
// Smooth constraint between point and next point.
|
||||
// Avoid exceeding extreme after smoothing.
|
||||
nextCpx0 = mathMin(nextCpx0, mathMax(nextX, x));
|
||||
nextCpy0 = mathMin(nextCpy0, mathMax(nextY, y));
|
||||
nextCpx0 = mathMax(nextCpx0, mathMin(nextX, x));
|
||||
nextCpy0 = mathMax(nextCpy0, mathMin(nextY, y));
|
||||
// Reclaculate cp1 based on the adjusted cp0 of next seg.
|
||||
vx = nextCpx0 - x;
|
||||
vy = nextCpy0 - y;
|
||||
cpx1 = x - vx * lenPrevSeg / lenNextSeg;
|
||||
cpy1 = y - vy * lenPrevSeg / lenNextSeg;
|
||||
// Smooth constraint between point and prev point.
|
||||
// Avoid exceeding extreme after smoothing.
|
||||
cpx1 = mathMin(cpx1, mathMax(prevX, x));
|
||||
cpy1 = mathMin(cpy1, mathMax(prevY, y));
|
||||
cpx1 = mathMax(cpx1, mathMin(prevX, x));
|
||||
cpy1 = mathMax(cpy1, mathMin(prevY, y));
|
||||
// Adjust next cp0 again.
|
||||
vx = x - cpx1;
|
||||
vy = y - cpy1;
|
||||
nextCpx0 = x + vx * lenNextSeg / lenPrevSeg;
|
||||
nextCpy0 = y + vy * lenNextSeg / lenPrevSeg;
|
||||
}
|
||||
}
|
||||
ctx.bezierCurveTo(cpx0, cpy0, cpx1, cpy1, x, y);
|
||||
cpx0 = nextCpx0;
|
||||
cpy0 = nextCpy0;
|
||||
} else {
|
||||
ctx.lineTo(x, y);
|
||||
}
|
||||
}
|
||||
prevX = x;
|
||||
prevY = y;
|
||||
idx += dir;
|
||||
}
|
||||
return k;
|
||||
}
|
||||
var ECPolylineShape = /** @class */function () {
|
||||
function ECPolylineShape() {
|
||||
this.smooth = 0;
|
||||
this.smoothConstraint = true;
|
||||
}
|
||||
return ECPolylineShape;
|
||||
}();
|
||||
var ECPolyline = /** @class */function (_super) {
|
||||
__extends(ECPolyline, _super);
|
||||
function ECPolyline(opts) {
|
||||
var _this = _super.call(this, opts) || this;
|
||||
_this.type = 'ec-polyline';
|
||||
return _this;
|
||||
}
|
||||
ECPolyline.prototype.getDefaultStyle = function () {
|
||||
return {
|
||||
stroke: '#000',
|
||||
fill: null
|
||||
};
|
||||
};
|
||||
ECPolyline.prototype.getDefaultShape = function () {
|
||||
return new ECPolylineShape();
|
||||
};
|
||||
ECPolyline.prototype.buildPath = function (ctx, shape) {
|
||||
var points = shape.points;
|
||||
var i = 0;
|
||||
var len = points.length / 2;
|
||||
// const result = getBoundingBox(points, shape.smoothConstraint);
|
||||
if (shape.connectNulls) {
|
||||
// Must remove first and last null values avoid draw error in polygon
|
||||
for (; len > 0; len--) {
|
||||
if (!isPointNull(points[len * 2 - 2], points[len * 2 - 1])) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (; i < len; i++) {
|
||||
if (!isPointNull(points[i * 2], points[i * 2 + 1])) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
while (i < len) {
|
||||
i += drawSegment(ctx, points, i, len, len, 1, shape.smooth, shape.smoothMonotone, shape.connectNulls) + 1;
|
||||
}
|
||||
};
|
||||
ECPolyline.prototype.getPointOn = function (xOrY, dim) {
|
||||
if (!this.path) {
|
||||
this.createPathProxy();
|
||||
this.buildPath(this.path, this.shape);
|
||||
}
|
||||
var path = this.path;
|
||||
var data = path.data;
|
||||
var CMD = PathProxy.CMD;
|
||||
var x0;
|
||||
var y0;
|
||||
var isDimX = dim === 'x';
|
||||
var roots = [];
|
||||
for (var i = 0; i < data.length;) {
|
||||
var cmd = data[i++];
|
||||
var x = void 0;
|
||||
var y = void 0;
|
||||
var x2 = void 0;
|
||||
var y2 = void 0;
|
||||
var x3 = void 0;
|
||||
var y3 = void 0;
|
||||
var t = void 0;
|
||||
switch (cmd) {
|
||||
case CMD.M:
|
||||
x0 = data[i++];
|
||||
y0 = data[i++];
|
||||
break;
|
||||
case CMD.L:
|
||||
x = data[i++];
|
||||
y = data[i++];
|
||||
t = isDimX ? (xOrY - x0) / (x - x0) : (xOrY - y0) / (y - y0);
|
||||
if (t <= 1 && t >= 0) {
|
||||
var val = isDimX ? (y - y0) * t + y0 : (x - x0) * t + x0;
|
||||
return isDimX ? [xOrY, val] : [val, xOrY];
|
||||
}
|
||||
x0 = x;
|
||||
y0 = y;
|
||||
break;
|
||||
case CMD.C:
|
||||
x = data[i++];
|
||||
y = data[i++];
|
||||
x2 = data[i++];
|
||||
y2 = data[i++];
|
||||
x3 = data[i++];
|
||||
y3 = data[i++];
|
||||
var nRoot = isDimX ? cubicRootAt(x0, x, x2, x3, xOrY, roots) : cubicRootAt(y0, y, y2, y3, xOrY, roots);
|
||||
if (nRoot > 0) {
|
||||
for (var i_1 = 0; i_1 < nRoot; i_1++) {
|
||||
var t_1 = roots[i_1];
|
||||
if (t_1 <= 1 && t_1 >= 0) {
|
||||
var val = isDimX ? cubicAt(y0, y, y2, y3, t_1) : cubicAt(x0, x, x2, x3, t_1);
|
||||
return isDimX ? [xOrY, val] : [val, xOrY];
|
||||
}
|
||||
}
|
||||
}
|
||||
x0 = x3;
|
||||
y0 = y3;
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
return ECPolyline;
|
||||
}(Path);
|
||||
export { ECPolyline };
|
||||
var ECPolygonShape = /** @class */function (_super) {
|
||||
__extends(ECPolygonShape, _super);
|
||||
function ECPolygonShape() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
return ECPolygonShape;
|
||||
}(ECPolylineShape);
|
||||
var ECPolygon = /** @class */function (_super) {
|
||||
__extends(ECPolygon, _super);
|
||||
function ECPolygon(opts) {
|
||||
var _this = _super.call(this, opts) || this;
|
||||
_this.type = 'ec-polygon';
|
||||
return _this;
|
||||
}
|
||||
ECPolygon.prototype.getDefaultShape = function () {
|
||||
return new ECPolygonShape();
|
||||
};
|
||||
ECPolygon.prototype.buildPath = function (ctx, shape) {
|
||||
var points = shape.points;
|
||||
var stackedOnPoints = shape.stackedOnPoints;
|
||||
var i = 0;
|
||||
var len = points.length / 2;
|
||||
var smoothMonotone = shape.smoothMonotone;
|
||||
if (shape.connectNulls) {
|
||||
// Must remove first and last null values avoid draw error in polygon
|
||||
for (; len > 0; len--) {
|
||||
if (!isPointNull(points[len * 2 - 2], points[len * 2 - 1])) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (; i < len; i++) {
|
||||
if (!isPointNull(points[i * 2], points[i * 2 + 1])) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
while (i < len) {
|
||||
var k = drawSegment(ctx, points, i, len, len, 1, shape.smooth, smoothMonotone, shape.connectNulls);
|
||||
drawSegment(ctx, stackedOnPoints, i + k - 1, k, len, -1, shape.stackedOnSmooth, smoothMonotone, shape.connectNulls);
|
||||
i += k + 1;
|
||||
ctx.closePath();
|
||||
}
|
||||
};
|
||||
return ECPolygon;
|
||||
}(Path);
|
||||
export { ECPolygon };
|
Reference in New Issue
Block a user